update deps (MisskeyIO#887)

(cherry picked from commit f7da2bad6f0b25652ded11e6a9f86efc40872200)
(cherry picked from commit d60c307c4e4c3eaba2a40b46ba41c4d684d5d370)

Co-authored-by: おさむのひと <46447427+samunohito@users.noreply.github.com>
Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>
This commit is contained in:
あわわわとーにゅ 2025-01-14 02:19:05 +09:00 committed by GitHub
parent cf1952ac0d
commit 9792ea0223
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 2018 additions and 1861 deletions

View file

@ -5,7 +5,7 @@
```ts
import { EventEmitter } from 'eventemitter3';
import _ReconnectingWebsocket from 'reconnecting-websocket';
import { Options } from 'reconnecting-websocket';
// Warning: (ae-forgotten-export) The symbol "components" needs to be exported by the entry point index.d.ts
//
@ -3023,7 +3023,7 @@ export class Stream extends EventEmitter<StreamEvents> {
constructor(origin: string, user: {
token: string;
} | null, options?: {
WebSocket?: _ReconnectingWebsocket.Options['WebSocket'];
WebSocket?: Options['WebSocket'];
});
// (undocumented)
close(): void;

View file

@ -9,7 +9,7 @@
"devDependencies": {
"@misskey-dev/eslint-plugin": "1.0.0",
"@readme/openapi-parser": "2.6.0",
"@types/node": "22.10.2",
"@types/node": "22.10.5",
"@typescript-eslint/eslint-plugin": "7.10.0",
"@typescript-eslint/parser": "7.10.0",
"eslint": "8.57.1",
@ -17,7 +17,7 @@
"openapi-typescript": "6.7.6",
"ts-case-convert": "2.1.0",
"tsx": "4.19.2",
"typescript": "5.7.2"
"typescript": "5.7.3"
},
"files": [
"built"

View file

@ -35,11 +35,11 @@
"url": "git+https://github.com/misskey-dev/misskey.js.git"
},
"devDependencies": {
"@microsoft/api-extractor": "7.48.1",
"@microsoft/api-extractor": "7.49.1",
"@misskey-dev/eslint-plugin": "1.0.0",
"@swc/jest": "0.2.37",
"@types/jest": "29.5.14",
"@types/node": "22.10.2",
"@types/node": "22.10.5",
"@typescript-eslint/eslint-plugin": "7.10.0",
"@typescript-eslint/parser": "7.10.0",
"eslint": "8.57.1",
@ -50,7 +50,7 @@
"ncp": "2.0.0",
"nodemon": "3.1.9",
"tsd": "0.31.2",
"typescript": "5.7.2"
"typescript": "5.7.3"
},
"files": [
"built",
@ -58,8 +58,8 @@
"built/dts"
],
"dependencies": {
"@swc/cli": "0.5.2",
"@swc/core": "1.10.3",
"@swc/cli": "0.6.0",
"@swc/core": "1.10.7",
"eventemitter3": "5.0.1",
"reconnecting-websocket": "4.4.0"
}

View file

@ -1,8 +1,10 @@
import { EventEmitter } from 'eventemitter3';
import _ReconnectingWebsocket from 'reconnecting-websocket';
import _ReconnectingWebSocket, { Options } from 'reconnecting-websocket';
import type { BroadcastEvents, Channels } from './streaming.types.js';
const ReconnectingWebsocket = _ReconnectingWebsocket as unknown as typeof _ReconnectingWebsocket['default'];
// コンストラクタとクラスそのものの定義が上手く解決出来ないため再定義
const ReconnectingWebSocketConstructor = _ReconnectingWebSocket as unknown as typeof _ReconnectingWebSocket.default;
type ReconnectingWebSocket = _ReconnectingWebSocket.default;
export function urlQuery(obj: Record<string, string | number | boolean | undefined>): string {
const params = Object.entries(obj)
@ -26,7 +28,7 @@ type StreamEvents = {
* Misskey stream connection
*/
export default class Stream extends EventEmitter<StreamEvents> {
private stream: _ReconnectingWebsocket.default;
private stream: ReconnectingWebSocket;
public state: 'initializing' | 'reconnecting' | 'connected' = 'initializing';
private sharedConnectionPools: Pool[] = [];
private sharedConnections: SharedConnection[] = [];
@ -34,7 +36,7 @@ export default class Stream extends EventEmitter<StreamEvents> {
private idCounter = 0;
constructor(origin: string, user: { token: string; } | null, options?: {
WebSocket?: _ReconnectingWebsocket.Options['WebSocket'];
WebSocket?: Options['WebSocket'];
}) {
super();
@ -62,7 +64,7 @@ export default class Stream extends EventEmitter<StreamEvents> {
const wsOrigin = origin.replace('http://', 'ws://').replace('https://', 'wss://');
this.stream = new ReconnectingWebsocket(`${wsOrigin}/streaming?${query}`, '', {
this.stream = new ReconnectingWebSocketConstructor(`${wsOrigin}/streaming?${query}`, '', {
minReconnectionDelay: 1, // https://github.com/pladaria/reconnecting-websocket/issues/91
WebSocket: options.WebSocket,
});