Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(misskey-js): WebSocketの型定義をReconnectingWebsocketに依存するように #14850

Merged
merged 5 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
- Fix: 招待コードの発行可能な残り数算出に使用すべきロールポリシーの値が違う問題を修正
(Cherry-picked from https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/706)

### Misskey.js
- Fix: Stream初期化時、別途WebSocketを指定する場合の型定義を修正

## 2024.10.1

### Note
Expand Down
2 changes: 0 additions & 2 deletions packages/backend/test-federation/test/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ export async function isFired<C extends keyof Misskey.Channels, T extends keyof
params?: Misskey.Channels[C]['params'],
): Promise<boolean> {
return new Promise<boolean>(async (resolve, reject) => {
// @ts-expect-error TODO: why?
const stream = new Misskey.Stream(`wss://${host}`, { token: user.i }, { WebSocket });
const connection = stream.useChannel(channel, params);
connection.on(type as any, ((msg: any) => {
Expand Down Expand Up @@ -266,7 +265,6 @@ export async function isNoteUpdatedEventFired(
cond: (msg: Parameters<Misskey.StreamEvents['noteUpdated']>[0]) => boolean,
): Promise<boolean> {
return new Promise<boolean>(async (resolve, reject) => {
// @ts-expect-error TODO: why?
const stream = new Misskey.Stream(`wss://${host}`, { token: user.i }, { WebSocket });
stream.send('s', { id: noteId });
stream.on('noteUpdated', msg => {
Expand Down
3 changes: 2 additions & 1 deletion packages/misskey-js/etc/misskey-js.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import type { AuthenticationResponseJSON } from '@simplewebauthn/types';
import { EventEmitter } from 'eventemitter3';
import type { PublicKeyCredentialRequestOptionsJSON } from '@simplewebauthn/types';
import _ReconnectingWebsocket from 'reconnecting-websocket';

// Warning: (ae-forgotten-export) The symbol "components" needs to be exported by the entry point index.d.ts
//
Expand Down Expand Up @@ -3137,7 +3138,7 @@ export class Stream extends EventEmitter<StreamEvents> implements IStream {
constructor(origin: string, user: {
token: string;
} | null, options?: {
WebSocket?: WebSocket;
WebSocket?: _ReconnectingWebsocket.Options['WebSocket'];
});
// (undocumented)
close(): void;
Expand Down
2 changes: 1 addition & 1 deletion packages/misskey-js/src/streaming.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default class Stream extends EventEmitter<StreamEvents> implements IStrea
private idCounter = 0;

constructor(origin: string, user: { token: string; } | null, options?: {
WebSocket?: WebSocket;
WebSocket?: _ReconnectingWebsocket.Options['WebSocket'];
}) {
super();

Expand Down
Loading