fix(misskey-js): WebSocketの型定義をReconnectingWebsocketに依存するように (#14850)
* fix(misskey-js): WebSocketの型定義をReconnectingWebsocketに依存するように * Update Changelog * run api extractor * fix * fix
This commit is contained in:
parent
a6a1e3d733
commit
ec4358d1e8
|
@ -26,6 +26,9 @@
|
||||||
- Fix: 招待コードの発行可能な残り数算出に使用すべきロールポリシーの値が違う問題を修正
|
- Fix: 招待コードの発行可能な残り数算出に使用すべきロールポリシーの値が違う問題を修正
|
||||||
(Cherry-picked from https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/706)
|
(Cherry-picked from https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/706)
|
||||||
|
|
||||||
|
### Misskey.js
|
||||||
|
- Fix: Stream初期化時、別途WebSocketを指定する場合の型定義を修正
|
||||||
|
|
||||||
## 2024.10.1
|
## 2024.10.1
|
||||||
|
|
||||||
### Note
|
### Note
|
||||||
|
|
|
@ -232,7 +232,6 @@ export async function isFired<C extends keyof Misskey.Channels, T extends keyof
|
||||||
params?: Misskey.Channels[C]['params'],
|
params?: Misskey.Channels[C]['params'],
|
||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
return new Promise<boolean>(async (resolve, reject) => {
|
return new Promise<boolean>(async (resolve, reject) => {
|
||||||
// @ts-expect-error TODO: why?
|
|
||||||
const stream = new Misskey.Stream(`wss://${host}`, { token: user.i }, { WebSocket });
|
const stream = new Misskey.Stream(`wss://${host}`, { token: user.i }, { WebSocket });
|
||||||
const connection = stream.useChannel(channel, params);
|
const connection = stream.useChannel(channel, params);
|
||||||
connection.on(type as any, ((msg: any) => {
|
connection.on(type as any, ((msg: any) => {
|
||||||
|
@ -266,7 +265,6 @@ export async function isNoteUpdatedEventFired(
|
||||||
cond: (msg: Parameters<Misskey.StreamEvents['noteUpdated']>[0]) => boolean,
|
cond: (msg: Parameters<Misskey.StreamEvents['noteUpdated']>[0]) => boolean,
|
||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
return new Promise<boolean>(async (resolve, reject) => {
|
return new Promise<boolean>(async (resolve, reject) => {
|
||||||
// @ts-expect-error TODO: why?
|
|
||||||
const stream = new Misskey.Stream(`wss://${host}`, { token: user.i }, { WebSocket });
|
const stream = new Misskey.Stream(`wss://${host}`, { token: user.i }, { WebSocket });
|
||||||
stream.send('s', { id: noteId });
|
stream.send('s', { id: noteId });
|
||||||
stream.on('noteUpdated', msg => {
|
stream.on('noteUpdated', msg => {
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
import type { AuthenticationResponseJSON } from '@simplewebauthn/types';
|
import type { AuthenticationResponseJSON } from '@simplewebauthn/types';
|
||||||
import { EventEmitter } from 'eventemitter3';
|
import { EventEmitter } from 'eventemitter3';
|
||||||
import type { PublicKeyCredentialRequestOptionsJSON } from '@simplewebauthn/types';
|
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
|
// Warning: (ae-forgotten-export) The symbol "components" needs to be exported by the entry point index.d.ts
|
||||||
//
|
//
|
||||||
|
@ -3137,7 +3138,7 @@ export class Stream extends EventEmitter<StreamEvents> implements IStream {
|
||||||
constructor(origin: string, user: {
|
constructor(origin: string, user: {
|
||||||
token: string;
|
token: string;
|
||||||
} | null, options?: {
|
} | null, options?: {
|
||||||
WebSocket?: WebSocket;
|
WebSocket?: _ReconnectingWebsocket.Options['WebSocket'];
|
||||||
});
|
});
|
||||||
// (undocumented)
|
// (undocumented)
|
||||||
close(): void;
|
close(): void;
|
||||||
|
|
|
@ -51,7 +51,7 @@ export default class Stream extends EventEmitter<StreamEvents> implements IStrea
|
||||||
private idCounter = 0;
|
private idCounter = 0;
|
||||||
|
|
||||||
constructor(origin: string, user: { token: string; } | null, options?: {
|
constructor(origin: string, user: { token: string; } | null, options?: {
|
||||||
WebSocket?: WebSocket;
|
WebSocket?: _ReconnectingWebsocket.Options['WebSocket'];
|
||||||
}) {
|
}) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue