@fishjam-cloud/js-server-sdk 0.28.0 → 0.29.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "@fishjam-cloud/js-server-sdk",
4
- version: "0.28.0",
4
+ version: "0.29.0-rc.1",
5
5
  description: "Fishjam server SDK for JavaScript",
6
6
  homepage: "https://github.com/fishjam-cloud/js-server-sdk",
7
7
  author: "Fishjam Team",
@@ -90,7 +90,8 @@ var package_default = {
90
90
  "*.{js,ts,tsx,mjs,cjs}": [
91
91
  "eslint --fix --config eslint.config.mjs"
92
92
  ]
93
- }
93
+ },
94
+ stableVersion: "0.28.1"
94
95
  };
95
96
 
96
97
  export {
package/dist/index.d.mts CHANGED
@@ -12,13 +12,13 @@ interface AgentOutput {
12
12
  * @type {AudioFormat}
13
13
  * @memberof AgentOutput
14
14
  */
15
- audioFormat?: AudioFormat;
15
+ 'audioFormat'?: AudioFormat;
16
16
  /**
17
17
  *
18
18
  * @type {AudioSampleRate}
19
19
  * @memberof AgentOutput
20
20
  */
21
- audioSampleRate?: AudioSampleRate;
21
+ 'audioSampleRate'?: AudioSampleRate;
22
22
  }
23
23
  /**
24
24
  * The format of the output audio
@@ -28,7 +28,7 @@ interface AgentOutput {
28
28
  declare const AudioFormat: {
29
29
  readonly Pcm16: "pcm16";
30
30
  };
31
- type AudioFormat = (typeof AudioFormat)[keyof typeof AudioFormat];
31
+ type AudioFormat = typeof AudioFormat[keyof typeof AudioFormat];
32
32
  /**
33
33
  * The sample rate of the output audio
34
34
  * @export
@@ -38,38 +38,44 @@ declare const AudioSampleRate: {
38
38
  readonly NUMBER_16000: 16000;
39
39
  readonly NUMBER_24000: 24000;
40
40
  };
41
- type AudioSampleRate = (typeof AudioSampleRate)[keyof typeof AudioSampleRate];
41
+ type AudioSampleRate = typeof AudioSampleRate[keyof typeof AudioSampleRate];
42
42
  /**
43
- * Token for authorizing a MoQ relay connection
43
+ * Connection details for a MoQ relay client
44
44
  * @export
45
- * @interface MoqToken
45
+ * @interface MoqAccess
46
46
  */
47
- interface MoqToken {
47
+ interface MoqAccess {
48
48
  /**
49
- * JWT token for MoQ relay
49
+ * Relay connection URL with the JWT embedded as a `?jwt=` query parameter. Pass directly to a MoQ client SDK.
50
50
  * @type {string}
51
- * @memberof MoqToken
51
+ * @memberof MoqAccess
52
52
  */
53
- token: string;
53
+ 'connection_url': string;
54
+ /**
55
+ * JWT authorizing the MoQ relay connection, also embedded in `connection_url`
56
+ * @type {string}
57
+ * @memberof MoqAccess
58
+ */
59
+ 'token': string;
54
60
  }
55
61
  /**
56
- * MoQ token configuration
62
+ * MoQ access configuration
57
63
  * @export
58
- * @interface MoqTokenConfig
64
+ * @interface MoqAccessConfig
59
65
  */
60
- interface MoqTokenConfig {
66
+ interface MoqAccessConfig {
61
67
  /**
62
68
  * Path under the root the token grants publish access to
63
69
  * @type {string}
64
- * @memberof MoqTokenConfig
70
+ * @memberof MoqAccessConfig
65
71
  */
66
- publishPath?: string | null;
72
+ 'publishPath'?: string | null;
67
73
  /**
68
74
  * Path under the root the token grants subscribe access to
69
75
  * @type {string}
70
- * @memberof MoqTokenConfig
76
+ * @memberof MoqAccessConfig
71
77
  */
72
- subscribePath?: string | null;
78
+ 'subscribePath'?: string | null;
73
79
  }
74
80
  /**
75
81
  * Describes peer status
@@ -82,43 +88,43 @@ interface Peer$1 {
82
88
  * @type {string}
83
89
  * @memberof Peer
84
90
  */
85
- id: string;
91
+ 'id': string;
86
92
  /**
87
93
  * Custom metadata set by the peer
88
94
  * @type {object}
89
95
  * @memberof Peer
90
96
  */
91
- metadata: object | null;
97
+ 'metadata': object | null;
92
98
  /**
93
99
  *
94
100
  * @type {PeerStatus}
95
101
  * @memberof Peer
96
102
  */
97
- status: PeerStatus;
103
+ 'status': PeerStatus;
98
104
  /**
99
105
  *
100
106
  * @type {SubscribeMode}
101
107
  * @memberof Peer
102
108
  */
103
- subscribeMode: SubscribeMode;
109
+ 'subscribeMode': SubscribeMode;
104
110
  /**
105
111
  *
106
112
  * @type {Subscriptions}
107
113
  * @memberof Peer
108
114
  */
109
- subscriptions: Subscriptions;
115
+ 'subscriptions': Subscriptions;
110
116
  /**
111
117
  * List of all peer\'s tracks
112
118
  * @type {Array<Track>}
113
119
  * @memberof Peer
114
120
  */
115
- tracks: Array<Track$2>;
121
+ 'tracks': Array<Track$2>;
116
122
  /**
117
123
  *
118
124
  * @type {PeerType}
119
125
  * @memberof Peer
120
126
  */
121
- type: PeerType$1;
127
+ 'type': PeerType$1;
122
128
  }
123
129
  /**
124
130
  * @type PeerOptions
@@ -137,13 +143,13 @@ interface PeerOptionsAgent {
137
143
  * @type {AgentOutput}
138
144
  * @memberof PeerOptionsAgent
139
145
  */
140
- output?: AgentOutput;
146
+ 'output'?: AgentOutput;
141
147
  /**
142
148
  *
143
149
  * @type {SubscribeMode}
144
150
  * @memberof PeerOptionsAgent
145
151
  */
146
- subscribeMode?: SubscribeMode;
152
+ 'subscribeMode'?: SubscribeMode;
147
153
  }
148
154
  /**
149
155
  * Options specific to the VAPI peer
@@ -156,19 +162,19 @@ interface PeerOptionsVapi {
156
162
  * @type {string}
157
163
  * @memberof PeerOptionsVapi
158
164
  */
159
- apiKey: string;
165
+ 'apiKey': string;
160
166
  /**
161
167
  * VAPI call ID
162
168
  * @type {string}
163
169
  * @memberof PeerOptionsVapi
164
170
  */
165
- callId: string;
171
+ 'callId': string;
166
172
  /**
167
173
  *
168
174
  * @type {SubscribeMode}
169
175
  * @memberof PeerOptionsVapi
170
176
  */
171
- subscribeMode?: SubscribeMode;
177
+ 'subscribeMode'?: SubscribeMode;
172
178
  }
173
179
  /**
174
180
  * Options specific to the WebRTC peer
@@ -181,7 +187,7 @@ interface PeerOptionsWebRTC {
181
187
  * @type {{ [key: string]: any; }}
182
188
  * @memberof PeerOptionsWebRTC
183
189
  */
184
- metadata?: {
190
+ 'metadata'?: {
185
191
  [key: string]: any;
186
192
  };
187
193
  /**
@@ -189,7 +195,7 @@ interface PeerOptionsWebRTC {
189
195
  * @type {SubscribeMode}
190
196
  * @memberof PeerOptionsWebRTC
191
197
  */
192
- subscribeMode?: SubscribeMode;
198
+ 'subscribeMode'?: SubscribeMode;
193
199
  }
194
200
  /**
195
201
  * Informs about the peer status
@@ -200,7 +206,7 @@ declare const PeerStatus: {
200
206
  readonly Connected: "connected";
201
207
  readonly Disconnected: "disconnected";
202
208
  };
203
- type PeerStatus = (typeof PeerStatus)[keyof typeof PeerStatus];
209
+ type PeerStatus = typeof PeerStatus[keyof typeof PeerStatus];
204
210
  /**
205
211
  * Peer type
206
212
  * @export
@@ -211,7 +217,7 @@ declare const PeerType$1: {
211
217
  readonly Agent: "agent";
212
218
  readonly Vapi: "vapi";
213
219
  };
214
- type PeerType$1 = (typeof PeerType$1)[keyof typeof PeerType$1];
220
+ type PeerType$1 = typeof PeerType$1[keyof typeof PeerType$1];
215
221
  /**
216
222
  * Room configuration
217
223
  * @export
@@ -223,37 +229,37 @@ interface RoomConfig {
223
229
  * @type {boolean}
224
230
  * @memberof RoomConfig
225
231
  */
226
- batchWebhookNotifications?: boolean;
232
+ 'batchWebhookNotifications'?: boolean;
227
233
  /**
228
234
  * Maximum amount of peers allowed into the room
229
235
  * @type {number}
230
236
  * @memberof RoomConfig
231
237
  */
232
- maxPeers?: number | null;
238
+ 'maxPeers'?: number | null;
233
239
  /**
234
240
  * True if livestream viewers can omit specifying a token.
235
241
  * @type {boolean}
236
242
  * @memberof RoomConfig
237
243
  */
238
- public?: boolean;
244
+ 'public'?: boolean;
239
245
  /**
240
246
  *
241
247
  * @type {RoomType}
242
248
  * @memberof RoomConfig
243
249
  */
244
- roomType?: RoomType;
250
+ 'roomType'?: RoomType;
245
251
  /**
246
252
  *
247
253
  * @type {VideoCodec}
248
254
  * @memberof RoomConfig
249
255
  */
250
- videoCodec?: VideoCodec;
256
+ 'videoCodec'?: VideoCodec;
251
257
  /**
252
258
  * URL where Fishjam notifications will be sent
253
259
  * @type {string}
254
260
  * @memberof RoomConfig
255
261
  */
256
- webhookUrl?: string | null;
262
+ 'webhookUrl'?: string | null;
257
263
  }
258
264
  /**
259
265
  * The use-case of the room. If not provided, this defaults to conference.
@@ -268,7 +274,7 @@ declare const RoomType: {
268
274
  readonly Conference: "conference";
269
275
  readonly AudioOnlyLivestream: "audio_only_livestream";
270
276
  };
271
- type RoomType = (typeof RoomType)[keyof typeof RoomType];
277
+ type RoomType = typeof RoomType[keyof typeof RoomType];
272
278
  /**
273
279
  * Streamer authorization token
274
280
  * @export
@@ -280,7 +286,7 @@ interface StreamerToken {
280
286
  * @type {string}
281
287
  * @memberof StreamerToken
282
288
  */
283
- token: string;
289
+ 'token': string;
284
290
  }
285
291
  /**
286
292
  * Configuration of peer\'s subscribing policy
@@ -291,7 +297,7 @@ declare const SubscribeMode: {
291
297
  readonly Auto: "auto";
292
298
  readonly Manual: "manual";
293
299
  };
294
- type SubscribeMode = (typeof SubscribeMode)[keyof typeof SubscribeMode];
300
+ type SubscribeMode = typeof SubscribeMode[keyof typeof SubscribeMode];
295
301
  /**
296
302
  * Describes peer\'s subscriptions in manual mode
297
303
  * @export
@@ -303,13 +309,13 @@ interface Subscriptions {
303
309
  * @type {Array<string>}
304
310
  * @memberof Subscriptions
305
311
  */
306
- peers: Array<string>;
312
+ 'peers': Array<string>;
307
313
  /**
308
314
  * List of track IDs this peer subscribes to
309
315
  * @type {Array<string>}
310
316
  * @memberof Subscriptions
311
317
  */
312
- tracks: Array<string>;
318
+ 'tracks': Array<string>;
313
319
  }
314
320
  /**
315
321
  * Media track of a Peer
@@ -322,19 +328,19 @@ interface Track$2 {
322
328
  * @type {string}
323
329
  * @memberof Track
324
330
  */
325
- id?: string;
331
+ 'id'?: string;
326
332
  /**
327
333
  * Metadata attached to the track by the peer
328
334
  * @type {object}
329
335
  * @memberof Track
330
336
  */
331
- metadata?: object | null;
337
+ 'metadata'?: object | null;
332
338
  /**
333
339
  *
334
340
  * @type {TrackType}
335
341
  * @memberof Track
336
342
  */
337
- type?: TrackType$2;
343
+ 'type'?: TrackType$2;
338
344
  }
339
345
  /**
340
346
  * Media type carried by the track
@@ -345,7 +351,7 @@ declare const TrackType$2: {
345
351
  readonly Audio: "audio";
346
352
  readonly Video: "video";
347
353
  };
348
- type TrackType$2 = (typeof TrackType$2)[keyof typeof TrackType$2];
354
+ type TrackType$2 = typeof TrackType$2[keyof typeof TrackType$2];
349
355
  /**
350
356
  * Enforces video codec for each peer in the room
351
357
  * @export
@@ -355,7 +361,7 @@ declare const VideoCodec: {
355
361
  readonly H264: "h264";
356
362
  readonly Vp8: "vp8";
357
363
  };
358
- type VideoCodec = (typeof VideoCodec)[keyof typeof VideoCodec];
364
+ type VideoCodec = typeof VideoCodec[keyof typeof VideoCodec];
359
365
  /**
360
366
  * Viewer authorization token
361
367
  * @export
@@ -367,7 +373,7 @@ interface ViewerToken {
367
373
  * @type {string}
368
374
  * @memberof ViewerToken
369
375
  */
370
- token: string;
376
+ 'token': string;
371
377
  }
372
378
 
373
379
  /** Defines types of tracks being published by peers and component */
@@ -834,6 +840,10 @@ type PeerType = PeerType$1 | 'unspecified';
834
840
  * with the addition of `'unspecified'` for messages whose track type is not set on the wire.
835
841
  */
836
842
  type TrackType = TrackType$2 | 'unspecified';
843
+ /**
844
+ * Voice activity status of a track.
845
+ */
846
+ type VadStatus = 'speech' | 'silence';
837
847
  type Room = {
838
848
  id: RoomId;
839
849
  peers: Peer[];
@@ -858,14 +868,14 @@ type Track = {
858
868
  type: TrackType;
859
869
  metadata: string;
860
870
  };
861
- declare const expectedEventsList$1: readonly ["roomCreated", "roomDeleted", "roomCrashed", "peerAdded", "peerDeleted", "peerConnected", "peerDisconnected", "peerMetadataUpdated", "peerCrashed", "streamerConnected", "streamerDisconnected", "viewerConnected", "viewerDisconnected", "trackAdded", "trackRemoved", "trackMetadataUpdated", "channelAdded", "channelRemoved"];
871
+ declare const expectedEventsList$1: readonly ["roomCreated", "roomDeleted", "roomCrashed", "peerAdded", "peerDeleted", "peerConnected", "peerDisconnected", "peerMetadataUpdated", "peerCrashed", "streamerConnected", "streamerDisconnected", "viewerConnected", "viewerDisconnected", "trackAdded", "trackRemoved", "trackMetadataUpdated", "trackForwarding", "trackForwardingRemoved", "vadNotification", "channelAdded", "channelRemoved"];
862
872
  type ExpectedEvents = (typeof expectedEventsList$1)[number];
863
873
  /**
864
874
  * `ServerMessage` oneof members that are intentionally NOT emitted to users.
865
875
  * Grouped with a brief rationale so the classification stays reviewable.
866
876
  * Mirrors the Python SDK's `IGNORED_NOTIFICATIONS` partition (FCE-3215).
867
877
  */
868
- declare const ignoredEventsList: readonly ["authenticated", "authRequest", "subscribeRequest", "subscribeResponse", "trackForwarding", "trackForwardingRemoved", "vadNotification", "notificationBatch", "streamConnected", "streamDisconnected", "hlsPlayable", "hlsUploaded", "hlsUploadCrashed", "componentCrashed"];
878
+ declare const ignoredEventsList: readonly ["authenticated", "authRequest", "subscribeRequest", "subscribeResponse", "notificationBatch", "streamConnected", "streamDisconnected", "hlsPlayable", "hlsUploaded", "hlsUploadCrashed", "componentCrashed"];
869
879
  type IgnoredEvents = (typeof ignoredEventsList)[number];
870
880
  /**
871
881
  * Field-level overrides applied to every notification payload: branded ID types
@@ -879,6 +889,9 @@ type NotificationOverrides = {
879
889
  peerId: PeerId;
880
890
  peerType: PeerType;
881
891
  track: Track | undefined;
892
+ audioTrack: Track | undefined;
893
+ videoTrack: Track | undefined;
894
+ status: VadStatus;
882
895
  };
883
896
  /** @inline */
884
897
  type Notification<K extends keyof ServerMessage> = Override<NonNullable<ServerMessage[K]>, NotificationOverrides>;
@@ -902,6 +915,9 @@ type Notifications = {
902
915
  trackAdded: Notification<'trackAdded'>;
903
916
  trackRemoved: Notification<'trackRemoved'>;
904
917
  trackMetadataUpdated: Notification<'trackMetadataUpdated'>;
918
+ trackForwarding: Notification<'trackForwarding'>;
919
+ trackForwardingRemoved: Notification<'trackForwardingRemoved'>;
920
+ vadNotification: Notification<'vadNotification'>;
905
921
  channelAdded: Notification<'channelAdded'>;
906
922
  channelRemoved: Notification<'channelRemoved'>;
907
923
  };
@@ -921,6 +937,9 @@ type ViewerDisconnected = Notifications['viewerDisconnected'];
921
937
  type TrackAdded = Notifications['trackAdded'];
922
938
  type TrackRemoved = Notifications['trackRemoved'];
923
939
  type TrackMetadataUpdated = Notifications['trackMetadataUpdated'];
940
+ type TrackForwarding = Notifications['trackForwarding'];
941
+ type TrackForwardingRemoved = Notifications['trackForwardingRemoved'];
942
+ type VadNotification = Notifications['vadNotification'];
924
943
  type ChannelAdded = Notifications['channelAdded'];
925
944
  type ChannelRemoved = Notifications['channelRemoved'];
926
945
  type NotificationEvents = {
@@ -946,6 +965,10 @@ declare const FishjamWSNotifier_base: new () => TypedEventEmitter<NotificationEv
946
965
  declare class FishjamWSNotifier extends FishjamWSNotifier_base {
947
966
  private readonly client;
948
967
  constructor(config: FishjamConfig, onError: ErrorEventHandler, onClose: CloseEventHandler);
968
+ /**
969
+ * Close the underlying WebSocket and stop emitting notifications.
970
+ */
971
+ disconnect(): void;
949
972
  private dispatchNotification;
950
973
  private setupConnection;
951
974
  }
@@ -1173,10 +1196,10 @@ declare class FishjamClient {
1173
1196
  */
1174
1197
  createLivestreamStreamerToken(roomId: RoomId): Promise<StreamerToken>;
1175
1198
  /**
1176
- * Creates a MoQ token.
1177
- * @returns a MoQ token
1199
+ * Creates MoQ access.
1200
+ * @returns connection details containing the relay URL with the JWT embedded as a `?jwt=` query parameter, and the token itself
1178
1201
  */
1179
- createMoqToken(config?: MoqTokenConfig): Promise<MoqToken>;
1202
+ createMoqAccess(config?: MoqAccessConfig): Promise<MoqAccess>;
1180
1203
  }
1181
1204
 
1182
1205
  declare class MissingFishjamIdException extends Error {
@@ -1209,4 +1232,4 @@ declare class QuotaExceededException extends FishjamBaseException {
1209
1232
  declare class UnknownException extends FishjamBaseException {
1210
1233
  }
1211
1234
 
1212
- export { type AgentCallbacks, type AgentEvents, type AgentTrack, type AudioCodecParameters, BadRequestException, type Brand, type ChannelAdded, type ChannelRemoved, type CloseEventHandler, type ErrorEventHandler, type ExpectedAgentEvents, type ExpectedEvents, FishjamAgent, FishjamBaseException, FishjamClient, type FishjamConfig, FishjamNotFoundException, FishjamWSNotifier, ForbiddenException, type IgnoredEvents, type IncomingTrackData, type IncomingTrackImage, InvalidFishjamCredentialsException, MissingFishjamIdException, type MoqToken, type MoqTokenConfig, type NotificationEvents, type OutgoingTrackData, type Override, type Peer, type PeerAdded, type PeerConnected, type PeerCrashed, type PeerDeleted, type PeerDisconnected, type PeerId, type PeerMetadataUpdated, PeerNotFoundException, type PeerOptions, type PeerOptionsAgent, type PeerOptionsVapi, type PeerOptionsWebRTC, PeerStatus, type PeerType, QuotaExceededException, type Room, type RoomConfig, type RoomCrashed, type RoomCreated, type RoomDeleted, type RoomId, RoomNotFoundException, RoomType, ServerMessage, type ServerNotification, ServiceUnavailableException, type StreamerConnected, type StreamerDisconnected, type StreamerToken, type Track, type TrackAdded, type TrackId, type TrackMetadataUpdated, type TrackRemoved, type TrackType, UnauthorizedException, UnknownException, VideoCodec, type ViewerConnected, type ViewerDisconnected, type ViewerToken, decodeServerNotifications };
1235
+ export { type AgentCallbacks, type AgentEvents, type AgentTrack, type AudioCodecParameters, BadRequestException, type Brand, type ChannelAdded, type ChannelRemoved, type CloseEventHandler, type ErrorEventHandler, type ExpectedAgentEvents, type ExpectedEvents, FishjamAgent, FishjamBaseException, FishjamClient, type FishjamConfig, FishjamNotFoundException, FishjamWSNotifier, ForbiddenException, type IgnoredEvents, type IncomingTrackData, type IncomingTrackImage, InvalidFishjamCredentialsException, MissingFishjamIdException, type MoqAccess, type MoqAccessConfig, type NotificationEvents, type OutgoingTrackData, type Override, type Peer, type PeerAdded, type PeerConnected, type PeerCrashed, type PeerDeleted, type PeerDisconnected, type PeerId, type PeerMetadataUpdated, PeerNotFoundException, type PeerOptions, type PeerOptionsAgent, type PeerOptionsVapi, type PeerOptionsWebRTC, PeerStatus, type PeerType, QuotaExceededException, type Room, type RoomConfig, type RoomCrashed, type RoomCreated, type RoomDeleted, type RoomId, RoomNotFoundException, RoomType, ServerMessage, type ServerNotification, ServiceUnavailableException, type StreamerConnected, type StreamerDisconnected, type StreamerToken, type Track, type TrackAdded, type TrackForwarding, type TrackForwardingRemoved, type TrackId, type TrackMetadataUpdated, type TrackRemoved, type TrackType, UnauthorizedException, UnknownException, type VadNotification, type VadStatus, VideoCodec, type ViewerConnected, type ViewerDisconnected, type ViewerToken, decodeServerNotifications };