Skip to content

Commit

Permalink
fix(misskey-js): WebSocketの型定義をReconnectingWebsocketに依存するように (#14850)
Browse files Browse the repository at this point in the history
* fix(misskey-js): WebSocketの型定義をReconnectingWebsocketに依存するように

* Update Changelog

* run api extractor

* fix

* fix
  • Loading branch information
kakkokari-gtyih authored Oct 28, 2024
1 parent a6a1e3d commit ec4358d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,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

0 comments on commit ec4358d

Please sign in to comment.