@fishjam-cloud/js-server-sdk 0.27.0-rc.1 → 0.28.0-rc.0
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.
- package/dist/{chunk-B3H63SYI.mjs → chunk-GERVP75S.mjs} +3 -2
- package/dist/index.d.mts +203 -92
- package/dist/index.d.ts +203 -92
- package/dist/index.js +528 -201
- package/dist/index.mjs +524 -200
- package/dist/integrations/gemini.js +3 -2
- package/dist/integrations/gemini.mjs +1 -1
- package/package.json +5 -4
package/dist/index.d.ts
CHANGED
|
@@ -12,13 +12,13 @@ interface AgentOutput {
|
|
|
12
12
|
* @type {AudioFormat}
|
|
13
13
|
* @memberof AgentOutput
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
audioFormat?: AudioFormat;
|
|
16
16
|
/**
|
|
17
17
|
*
|
|
18
18
|
* @type {AudioSampleRate}
|
|
19
19
|
* @memberof AgentOutput
|
|
20
20
|
*/
|
|
21
|
-
|
|
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,7 +38,7 @@ 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
43
|
* Token for authorizing a MoQ relay connection
|
|
44
44
|
* @export
|
|
@@ -50,7 +50,7 @@ interface MoqToken {
|
|
|
50
50
|
* @type {string}
|
|
51
51
|
* @memberof MoqToken
|
|
52
52
|
*/
|
|
53
|
-
|
|
53
|
+
token: string;
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
56
|
* MoQ token configuration
|
|
@@ -63,13 +63,13 @@ interface MoqTokenConfig {
|
|
|
63
63
|
* @type {string}
|
|
64
64
|
* @memberof MoqTokenConfig
|
|
65
65
|
*/
|
|
66
|
-
|
|
66
|
+
publishPath?: string | null;
|
|
67
67
|
/**
|
|
68
68
|
* Path under the root the token grants subscribe access to
|
|
69
69
|
* @type {string}
|
|
70
70
|
* @memberof MoqTokenConfig
|
|
71
71
|
*/
|
|
72
|
-
|
|
72
|
+
subscribePath?: string | null;
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
75
|
* Describes peer status
|
|
@@ -82,43 +82,43 @@ interface Peer$1 {
|
|
|
82
82
|
* @type {string}
|
|
83
83
|
* @memberof Peer
|
|
84
84
|
*/
|
|
85
|
-
|
|
85
|
+
id: string;
|
|
86
86
|
/**
|
|
87
87
|
* Custom metadata set by the peer
|
|
88
88
|
* @type {object}
|
|
89
89
|
* @memberof Peer
|
|
90
90
|
*/
|
|
91
|
-
|
|
91
|
+
metadata: object | null;
|
|
92
92
|
/**
|
|
93
93
|
*
|
|
94
94
|
* @type {PeerStatus}
|
|
95
95
|
* @memberof Peer
|
|
96
96
|
*/
|
|
97
|
-
|
|
97
|
+
status: PeerStatus;
|
|
98
98
|
/**
|
|
99
99
|
*
|
|
100
100
|
* @type {SubscribeMode}
|
|
101
101
|
* @memberof Peer
|
|
102
102
|
*/
|
|
103
|
-
|
|
103
|
+
subscribeMode: SubscribeMode;
|
|
104
104
|
/**
|
|
105
105
|
*
|
|
106
106
|
* @type {Subscriptions}
|
|
107
107
|
* @memberof Peer
|
|
108
108
|
*/
|
|
109
|
-
|
|
109
|
+
subscriptions: Subscriptions;
|
|
110
110
|
/**
|
|
111
111
|
* List of all peer\'s tracks
|
|
112
112
|
* @type {Array<Track>}
|
|
113
113
|
* @memberof Peer
|
|
114
114
|
*/
|
|
115
|
-
|
|
115
|
+
tracks: Array<Track$2>;
|
|
116
116
|
/**
|
|
117
117
|
*
|
|
118
118
|
* @type {PeerType}
|
|
119
119
|
* @memberof Peer
|
|
120
120
|
*/
|
|
121
|
-
|
|
121
|
+
type: PeerType$1;
|
|
122
122
|
}
|
|
123
123
|
/**
|
|
124
124
|
* @type PeerOptions
|
|
@@ -137,13 +137,13 @@ interface PeerOptionsAgent {
|
|
|
137
137
|
* @type {AgentOutput}
|
|
138
138
|
* @memberof PeerOptionsAgent
|
|
139
139
|
*/
|
|
140
|
-
|
|
140
|
+
output?: AgentOutput;
|
|
141
141
|
/**
|
|
142
142
|
*
|
|
143
143
|
* @type {SubscribeMode}
|
|
144
144
|
* @memberof PeerOptionsAgent
|
|
145
145
|
*/
|
|
146
|
-
|
|
146
|
+
subscribeMode?: SubscribeMode;
|
|
147
147
|
}
|
|
148
148
|
/**
|
|
149
149
|
* Options specific to the VAPI peer
|
|
@@ -156,19 +156,19 @@ interface PeerOptionsVapi {
|
|
|
156
156
|
* @type {string}
|
|
157
157
|
* @memberof PeerOptionsVapi
|
|
158
158
|
*/
|
|
159
|
-
|
|
159
|
+
apiKey: string;
|
|
160
160
|
/**
|
|
161
161
|
* VAPI call ID
|
|
162
162
|
* @type {string}
|
|
163
163
|
* @memberof PeerOptionsVapi
|
|
164
164
|
*/
|
|
165
|
-
|
|
165
|
+
callId: string;
|
|
166
166
|
/**
|
|
167
167
|
*
|
|
168
168
|
* @type {SubscribeMode}
|
|
169
169
|
* @memberof PeerOptionsVapi
|
|
170
170
|
*/
|
|
171
|
-
|
|
171
|
+
subscribeMode?: SubscribeMode;
|
|
172
172
|
}
|
|
173
173
|
/**
|
|
174
174
|
* Options specific to the WebRTC peer
|
|
@@ -181,7 +181,7 @@ interface PeerOptionsWebRTC {
|
|
|
181
181
|
* @type {{ [key: string]: any; }}
|
|
182
182
|
* @memberof PeerOptionsWebRTC
|
|
183
183
|
*/
|
|
184
|
-
|
|
184
|
+
metadata?: {
|
|
185
185
|
[key: string]: any;
|
|
186
186
|
};
|
|
187
187
|
/**
|
|
@@ -189,7 +189,7 @@ interface PeerOptionsWebRTC {
|
|
|
189
189
|
* @type {SubscribeMode}
|
|
190
190
|
* @memberof PeerOptionsWebRTC
|
|
191
191
|
*/
|
|
192
|
-
|
|
192
|
+
subscribeMode?: SubscribeMode;
|
|
193
193
|
}
|
|
194
194
|
/**
|
|
195
195
|
* Informs about the peer status
|
|
@@ -200,54 +200,60 @@ declare const PeerStatus: {
|
|
|
200
200
|
readonly Connected: "connected";
|
|
201
201
|
readonly Disconnected: "disconnected";
|
|
202
202
|
};
|
|
203
|
-
type PeerStatus = typeof PeerStatus[keyof typeof PeerStatus];
|
|
203
|
+
type PeerStatus = (typeof PeerStatus)[keyof typeof PeerStatus];
|
|
204
204
|
/**
|
|
205
205
|
* Peer type
|
|
206
206
|
* @export
|
|
207
207
|
* @enum {string}
|
|
208
208
|
*/
|
|
209
|
-
declare const PeerType: {
|
|
209
|
+
declare const PeerType$1: {
|
|
210
210
|
readonly Webrtc: "webrtc";
|
|
211
211
|
readonly Agent: "agent";
|
|
212
212
|
readonly Vapi: "vapi";
|
|
213
213
|
};
|
|
214
|
-
type PeerType = typeof PeerType[keyof typeof PeerType];
|
|
214
|
+
type PeerType$1 = (typeof PeerType$1)[keyof typeof PeerType$1];
|
|
215
215
|
/**
|
|
216
216
|
* Room configuration
|
|
217
217
|
* @export
|
|
218
218
|
* @interface RoomConfig
|
|
219
219
|
*/
|
|
220
220
|
interface RoomConfig {
|
|
221
|
+
/**
|
|
222
|
+
* If true, webhook notifications for this room are coalesced into a single NotificationBatch per HTTP send instead of one request per notification. VAD notifications are unaffected.
|
|
223
|
+
* @type {boolean}
|
|
224
|
+
* @memberof RoomConfig
|
|
225
|
+
*/
|
|
226
|
+
batchWebhookNotifications?: boolean;
|
|
221
227
|
/**
|
|
222
228
|
* Maximum amount of peers allowed into the room
|
|
223
229
|
* @type {number}
|
|
224
230
|
* @memberof RoomConfig
|
|
225
231
|
*/
|
|
226
|
-
|
|
232
|
+
maxPeers?: number | null;
|
|
227
233
|
/**
|
|
228
234
|
* True if livestream viewers can omit specifying a token.
|
|
229
235
|
* @type {boolean}
|
|
230
236
|
* @memberof RoomConfig
|
|
231
237
|
*/
|
|
232
|
-
|
|
238
|
+
public?: boolean;
|
|
233
239
|
/**
|
|
234
240
|
*
|
|
235
241
|
* @type {RoomType}
|
|
236
242
|
* @memberof RoomConfig
|
|
237
243
|
*/
|
|
238
|
-
|
|
244
|
+
roomType?: RoomType;
|
|
239
245
|
/**
|
|
240
246
|
*
|
|
241
247
|
* @type {VideoCodec}
|
|
242
248
|
* @memberof RoomConfig
|
|
243
249
|
*/
|
|
244
|
-
|
|
250
|
+
videoCodec?: VideoCodec;
|
|
245
251
|
/**
|
|
246
252
|
* URL where Fishjam notifications will be sent
|
|
247
253
|
* @type {string}
|
|
248
254
|
* @memberof RoomConfig
|
|
249
255
|
*/
|
|
250
|
-
|
|
256
|
+
webhookUrl?: string | null;
|
|
251
257
|
}
|
|
252
258
|
/**
|
|
253
259
|
* The use-case of the room. If not provided, this defaults to conference.
|
|
@@ -262,19 +268,19 @@ declare const RoomType: {
|
|
|
262
268
|
readonly Conference: "conference";
|
|
263
269
|
readonly AudioOnlyLivestream: "audio_only_livestream";
|
|
264
270
|
};
|
|
265
|
-
type RoomType = typeof RoomType[keyof typeof RoomType];
|
|
271
|
+
type RoomType = (typeof RoomType)[keyof typeof RoomType];
|
|
266
272
|
/**
|
|
267
|
-
*
|
|
273
|
+
* Streamer authorization token
|
|
268
274
|
* @export
|
|
269
275
|
* @interface StreamerToken
|
|
270
276
|
*/
|
|
271
277
|
interface StreamerToken {
|
|
272
278
|
/**
|
|
273
|
-
*
|
|
279
|
+
* Token streamer should authorize with
|
|
274
280
|
* @type {string}
|
|
275
281
|
* @memberof StreamerToken
|
|
276
282
|
*/
|
|
277
|
-
|
|
283
|
+
token: string;
|
|
278
284
|
}
|
|
279
285
|
/**
|
|
280
286
|
* Configuration of peer\'s subscribing policy
|
|
@@ -285,7 +291,7 @@ declare const SubscribeMode: {
|
|
|
285
291
|
readonly Auto: "auto";
|
|
286
292
|
readonly Manual: "manual";
|
|
287
293
|
};
|
|
288
|
-
type SubscribeMode = typeof SubscribeMode[keyof typeof SubscribeMode];
|
|
294
|
+
type SubscribeMode = (typeof SubscribeMode)[keyof typeof SubscribeMode];
|
|
289
295
|
/**
|
|
290
296
|
* Describes peer\'s subscriptions in manual mode
|
|
291
297
|
* @export
|
|
@@ -297,41 +303,41 @@ interface Subscriptions {
|
|
|
297
303
|
* @type {Array<string>}
|
|
298
304
|
* @memberof Subscriptions
|
|
299
305
|
*/
|
|
300
|
-
|
|
306
|
+
peers: Array<string>;
|
|
301
307
|
/**
|
|
302
308
|
* List of track IDs this peer subscribes to
|
|
303
309
|
* @type {Array<string>}
|
|
304
310
|
* @memberof Subscriptions
|
|
305
311
|
*/
|
|
306
|
-
|
|
312
|
+
tracks: Array<string>;
|
|
307
313
|
}
|
|
308
314
|
/**
|
|
309
|
-
*
|
|
315
|
+
* Media track of a Peer
|
|
310
316
|
* @export
|
|
311
317
|
* @interface Track
|
|
312
318
|
*/
|
|
313
|
-
interface Track$
|
|
319
|
+
interface Track$2 {
|
|
314
320
|
/**
|
|
315
321
|
* Assigned track id
|
|
316
322
|
* @type {string}
|
|
317
323
|
* @memberof Track
|
|
318
324
|
*/
|
|
319
|
-
|
|
325
|
+
id?: string;
|
|
320
326
|
/**
|
|
321
|
-
*
|
|
327
|
+
* Metadata attached to the track by the peer
|
|
322
328
|
* @type {object}
|
|
323
329
|
* @memberof Track
|
|
324
330
|
*/
|
|
325
|
-
|
|
331
|
+
metadata?: object | null;
|
|
326
332
|
/**
|
|
327
333
|
*
|
|
328
334
|
* @type {TrackType}
|
|
329
335
|
* @memberof Track
|
|
330
336
|
*/
|
|
331
|
-
|
|
337
|
+
type?: TrackType$2;
|
|
332
338
|
}
|
|
333
339
|
/**
|
|
334
|
-
*
|
|
340
|
+
* Media type carried by the track
|
|
335
341
|
* @export
|
|
336
342
|
* @enum {string}
|
|
337
343
|
*/
|
|
@@ -339,7 +345,7 @@ declare const TrackType$2: {
|
|
|
339
345
|
readonly Audio: "audio";
|
|
340
346
|
readonly Video: "video";
|
|
341
347
|
};
|
|
342
|
-
type TrackType$2 = typeof TrackType$2[keyof typeof TrackType$2];
|
|
348
|
+
type TrackType$2 = (typeof TrackType$2)[keyof typeof TrackType$2];
|
|
343
349
|
/**
|
|
344
350
|
* Enforces video codec for each peer in the room
|
|
345
351
|
* @export
|
|
@@ -349,19 +355,19 @@ declare const VideoCodec: {
|
|
|
349
355
|
readonly H264: "h264";
|
|
350
356
|
readonly Vp8: "vp8";
|
|
351
357
|
};
|
|
352
|
-
type VideoCodec = typeof VideoCodec[keyof typeof VideoCodec];
|
|
358
|
+
type VideoCodec = (typeof VideoCodec)[keyof typeof VideoCodec];
|
|
353
359
|
/**
|
|
354
|
-
*
|
|
360
|
+
* Viewer authorization token
|
|
355
361
|
* @export
|
|
356
362
|
* @interface ViewerToken
|
|
357
363
|
*/
|
|
358
364
|
interface ViewerToken {
|
|
359
365
|
/**
|
|
360
|
-
*
|
|
366
|
+
* Token viewer should authorize with
|
|
361
367
|
* @type {string}
|
|
362
368
|
* @memberof ViewerToken
|
|
363
369
|
*/
|
|
364
|
-
|
|
370
|
+
token: string;
|
|
365
371
|
}
|
|
366
372
|
|
|
367
373
|
/** Defines types of tracks being published by peers and component */
|
|
@@ -372,12 +378,12 @@ declare enum TrackType$1 {
|
|
|
372
378
|
UNRECOGNIZED = -1
|
|
373
379
|
}
|
|
374
380
|
/** Describes a media track */
|
|
375
|
-
interface Track {
|
|
381
|
+
interface Track$1 {
|
|
376
382
|
id: string;
|
|
377
383
|
type: TrackType$1;
|
|
378
384
|
metadata: string;
|
|
379
385
|
}
|
|
380
|
-
declare const Track: MessageFns$2<Track>;
|
|
386
|
+
declare const Track$1: MessageFns$2<Track$1>;
|
|
381
387
|
type Builtin$2 = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
382
388
|
type DeepPartial$2<T> = T extends Builtin$2 ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial$2<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial$2<U>> : T extends {} ? {
|
|
383
389
|
[K in keyof T]?: DeepPartial$2<T[K]>;
|
|
@@ -443,6 +449,8 @@ interface ServerMessage {
|
|
|
443
449
|
viewerDisconnected?: ServerMessage_ViewerDisconnected | undefined;
|
|
444
450
|
streamerConnected?: ServerMessage_StreamerConnected | undefined;
|
|
445
451
|
streamerDisconnected?: ServerMessage_StreamerDisconnected | undefined;
|
|
452
|
+
/** Batch */
|
|
453
|
+
notificationBatch?: ServerMessage_NotificationBatch | undefined;
|
|
446
454
|
/** @deprecated */
|
|
447
455
|
streamConnected?: ServerMessage_StreamConnected | undefined;
|
|
448
456
|
/** @deprecated */
|
|
@@ -562,7 +570,7 @@ interface ServerMessage_TrackAdded {
|
|
|
562
570
|
roomId: string;
|
|
563
571
|
peerId?: string | undefined;
|
|
564
572
|
componentId?: string | undefined;
|
|
565
|
-
track: Track | undefined;
|
|
573
|
+
track: Track$1 | undefined;
|
|
566
574
|
}
|
|
567
575
|
declare const ServerMessage_TrackAdded: MessageFns$1<ServerMessage_TrackAdded>;
|
|
568
576
|
/** Notification sent when a track is removed */
|
|
@@ -570,7 +578,7 @@ interface ServerMessage_TrackRemoved {
|
|
|
570
578
|
roomId: string;
|
|
571
579
|
peerId?: string | undefined;
|
|
572
580
|
componentId?: string | undefined;
|
|
573
|
-
track: Track | undefined;
|
|
581
|
+
track: Track$1 | undefined;
|
|
574
582
|
}
|
|
575
583
|
declare const ServerMessage_TrackRemoved: MessageFns$1<ServerMessage_TrackRemoved>;
|
|
576
584
|
/** Notification sent when metadata of a multimedia track is updated */
|
|
@@ -578,7 +586,7 @@ interface ServerMessage_TrackMetadataUpdated {
|
|
|
578
586
|
roomId: string;
|
|
579
587
|
peerId?: string | undefined;
|
|
580
588
|
componentId?: string | undefined;
|
|
581
|
-
track: Track | undefined;
|
|
589
|
+
track: Track$1 | undefined;
|
|
582
590
|
}
|
|
583
591
|
declare const ServerMessage_TrackMetadataUpdated: MessageFns$1<ServerMessage_TrackMetadataUpdated>;
|
|
584
592
|
/** Notification sent when a peer creates a channel */
|
|
@@ -604,8 +612,8 @@ interface ServerMessage_TrackForwarding {
|
|
|
604
612
|
compositionUrl: string;
|
|
605
613
|
inputId: string;
|
|
606
614
|
/** Track has id, type, and metadata */
|
|
607
|
-
audioTrack?: Track | undefined;
|
|
608
|
-
videoTrack?: Track | undefined;
|
|
615
|
+
audioTrack?: Track$1 | undefined;
|
|
616
|
+
videoTrack?: Track$1 | undefined;
|
|
609
617
|
}
|
|
610
618
|
declare const ServerMessage_TrackForwarding: MessageFns$1<ServerMessage_TrackForwarding>;
|
|
611
619
|
/** Sent when track forwarding is removed */
|
|
@@ -656,6 +664,23 @@ interface ServerMessage_StreamerDisconnected {
|
|
|
656
664
|
streamerId: string;
|
|
657
665
|
}
|
|
658
666
|
declare const ServerMessage_StreamerDisconnected: MessageFns$1<ServerMessage_StreamerDisconnected>;
|
|
667
|
+
/**
|
|
668
|
+
* Carries multiple notifications in a single wire frame.
|
|
669
|
+
*
|
|
670
|
+
* Constraints (documented, not schema-enforced):
|
|
671
|
+
* - Each element's `content` MUST be a notification variant — never
|
|
672
|
+
* Authenticated, AuthRequest, SubscribeRequest, or SubscribeResponse.
|
|
673
|
+
* - NotificationBatch MUST NOT be nested inside another NotificationBatch.
|
|
674
|
+
* The schema technically permits this, but senders must not emit
|
|
675
|
+
* recursive batches and receivers may treat them as a protocol violation.
|
|
676
|
+
* - Notifications are delivered in array order; consumers must process
|
|
677
|
+
* them in order.
|
|
678
|
+
* - Sent only for webhooks, for peers that .
|
|
679
|
+
*/
|
|
680
|
+
interface ServerMessage_NotificationBatch {
|
|
681
|
+
notifications: ServerMessage[];
|
|
682
|
+
}
|
|
683
|
+
declare const ServerMessage_NotificationBatch: MessageFns$1<ServerMessage_NotificationBatch>;
|
|
659
684
|
type Builtin$1 = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
660
685
|
type DeepPartial$1<T> = T extends Builtin$1 ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial$1<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial$1<U>> : T extends {} ? {
|
|
661
686
|
[K in keyof T]?: DeepPartial$1<T[K]>;
|
|
@@ -694,7 +719,7 @@ declare const AgentResponse_Authenticated: MessageFns<AgentResponse_Authenticate
|
|
|
694
719
|
/** Notification containing a chunk of a track's data stream */
|
|
695
720
|
interface AgentResponse_TrackData {
|
|
696
721
|
peerId: string;
|
|
697
|
-
track: Track | undefined;
|
|
722
|
+
track: Track$1 | undefined;
|
|
698
723
|
data: Uint8Array;
|
|
699
724
|
}
|
|
700
725
|
declare const AgentResponse_TrackData: MessageFns<AgentResponse_TrackData>;
|
|
@@ -772,6 +797,21 @@ declare const brand: unique symbol;
|
|
|
772
797
|
type Brand<T, TBrand extends string> = T & {
|
|
773
798
|
[brand]: TBrand;
|
|
774
799
|
};
|
|
800
|
+
/**
|
|
801
|
+
* Replaces the types of fields in `T` whose names appear in `M`, leaving the rest untouched.
|
|
802
|
+
* Produces a flat object type (single mapped type, no `Omit & {...}` chain) so editor hover
|
|
803
|
+
* displays the resulting properties directly.
|
|
804
|
+
*
|
|
805
|
+
* Keys present in `M` but not in `T` are ignored — only fields that already exist on `T`
|
|
806
|
+
* are overridden, so a shared override map can be reused across multiple source types.
|
|
807
|
+
*
|
|
808
|
+
* `undefined` is re-added to the override when the original field allowed it, so optional
|
|
809
|
+
* fields on generated proto types (e.g. `peerId?: string | undefined`) remain assignable
|
|
810
|
+
* from `undefined` under `exactOptionalPropertyTypes`.
|
|
811
|
+
*/
|
|
812
|
+
type Override<T, M> = {
|
|
813
|
+
[K in keyof T]: K extends keyof M ? (undefined extends T[K] ? M[K] | undefined : M[K]) : T[K];
|
|
814
|
+
};
|
|
775
815
|
/**
|
|
776
816
|
* ID of the Room.
|
|
777
817
|
* Room can be created with {@link FishjamClient.createRoom}.
|
|
@@ -781,9 +821,19 @@ type RoomId = Brand<string, 'RoomId'>;
|
|
|
781
821
|
* ID of Peer. Peer is associated with Room and can be created with {@link FishjamClient.createPeer}.
|
|
782
822
|
*/
|
|
783
823
|
type PeerId = Brand<string, 'PeerId'>;
|
|
784
|
-
type Peer =
|
|
824
|
+
type Peer = Override<Peer$1, {
|
|
785
825
|
id: PeerId;
|
|
786
|
-
}
|
|
826
|
+
}>;
|
|
827
|
+
/**
|
|
828
|
+
* Peer type as emitted by {@link FishjamWSNotifier}. Matches the REST API's `PeerType`,
|
|
829
|
+
* with the addition of `'unspecified'` for messages whose peer type is not set on the wire.
|
|
830
|
+
*/
|
|
831
|
+
type PeerType = PeerType$1 | 'unspecified';
|
|
832
|
+
/**
|
|
833
|
+
* Track type as emitted by {@link FishjamWSNotifier}. Matches the REST API's `TrackType`,
|
|
834
|
+
* with the addition of `'unspecified'` for messages whose track type is not set on the wire.
|
|
835
|
+
*/
|
|
836
|
+
type TrackType = TrackType$2 | 'unspecified';
|
|
787
837
|
type Room = {
|
|
788
838
|
id: RoomId;
|
|
789
839
|
peers: Peer[];
|
|
@@ -800,31 +850,60 @@ type AgentCallbacks = {
|
|
|
800
850
|
onClose?: CloseEventHandler;
|
|
801
851
|
};
|
|
802
852
|
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
type WithPeerId<T> = {
|
|
811
|
-
[P in keyof T]: NonNullable<T[P]> extends {
|
|
812
|
-
peerId: string;
|
|
813
|
-
} ? Omit<NonNullable<T[P]>, 'peerId'> & {
|
|
814
|
-
peerId: PeerId;
|
|
815
|
-
} : T[P];
|
|
853
|
+
/**
|
|
854
|
+
* Track payload embedded in {@link TrackAdded}, {@link TrackRemoved}, {@link TrackMetadataUpdated}.
|
|
855
|
+
*/
|
|
856
|
+
type Track = {
|
|
857
|
+
id: string;
|
|
858
|
+
type: TrackType;
|
|
859
|
+
metadata: string;
|
|
816
860
|
};
|
|
817
|
-
|
|
818
|
-
type ExpectedEvents =
|
|
861
|
+
declare const expectedEventsList$1: readonly ["roomCreated", "roomDeleted", "roomCrashed", "peerAdded", "peerDeleted", "peerConnected", "peerDisconnected", "peerMetadataUpdated", "peerCrashed", "streamerConnected", "streamerDisconnected", "viewerConnected", "viewerDisconnected", "trackAdded", "trackRemoved", "trackMetadataUpdated", "channelAdded", "channelRemoved"];
|
|
862
|
+
type ExpectedEvents = (typeof expectedEventsList$1)[number];
|
|
863
|
+
/**
|
|
864
|
+
* `ServerMessage` oneof members that are intentionally NOT emitted to users.
|
|
865
|
+
* Grouped with a brief rationale so the classification stays reviewable.
|
|
866
|
+
* Mirrors the Python SDK's `IGNORED_NOTIFICATIONS` partition (FCE-3215).
|
|
867
|
+
*/
|
|
868
|
+
declare const ignoredEventsList: readonly ["authenticated", "authRequest", "subscribeRequest", "subscribeResponse", "trackForwarding", "trackForwardingRemoved", "vadNotification", "notificationBatch", "streamConnected", "streamDisconnected", "hlsPlayable", "hlsUploaded", "hlsUploadCrashed", "componentCrashed"];
|
|
869
|
+
type IgnoredEvents = (typeof ignoredEventsList)[number];
|
|
819
870
|
/**
|
|
871
|
+
* Field-level overrides applied to every notification payload: branded ID types
|
|
872
|
+
* and the user-facing enums replace their raw protobuf counterparts. {@link Override}
|
|
873
|
+
* only swaps keys that exist on the source type, so a single map covers all variants.
|
|
874
|
+
*
|
|
820
875
|
* @inline
|
|
821
876
|
*/
|
|
822
|
-
type
|
|
877
|
+
type NotificationOverrides = {
|
|
878
|
+
roomId: RoomId;
|
|
879
|
+
peerId: PeerId;
|
|
880
|
+
peerType: PeerType;
|
|
881
|
+
track: Track | undefined;
|
|
882
|
+
};
|
|
883
|
+
/** @inline */
|
|
884
|
+
type Notification<K extends keyof ServerMessage> = Override<NonNullable<ServerMessage[K]>, NotificationOverrides>;
|
|
823
885
|
/**
|
|
824
886
|
* @inline
|
|
825
887
|
*/
|
|
826
888
|
type Notifications = {
|
|
827
|
-
|
|
889
|
+
roomCreated: Notification<'roomCreated'>;
|
|
890
|
+
roomDeleted: Notification<'roomDeleted'>;
|
|
891
|
+
roomCrashed: Notification<'roomCrashed'>;
|
|
892
|
+
peerAdded: Notification<'peerAdded'>;
|
|
893
|
+
peerDeleted: Notification<'peerDeleted'>;
|
|
894
|
+
peerConnected: Notification<'peerConnected'>;
|
|
895
|
+
peerDisconnected: Notification<'peerDisconnected'>;
|
|
896
|
+
peerMetadataUpdated: Notification<'peerMetadataUpdated'>;
|
|
897
|
+
peerCrashed: Notification<'peerCrashed'>;
|
|
898
|
+
streamerConnected: Notification<'streamerConnected'>;
|
|
899
|
+
streamerDisconnected: Notification<'streamerDisconnected'>;
|
|
900
|
+
viewerConnected: Notification<'viewerConnected'>;
|
|
901
|
+
viewerDisconnected: Notification<'viewerDisconnected'>;
|
|
902
|
+
trackAdded: Notification<'trackAdded'>;
|
|
903
|
+
trackRemoved: Notification<'trackRemoved'>;
|
|
904
|
+
trackMetadataUpdated: Notification<'trackMetadataUpdated'>;
|
|
905
|
+
channelAdded: Notification<'channelAdded'>;
|
|
906
|
+
channelRemoved: Notification<'channelRemoved'>;
|
|
828
907
|
};
|
|
829
908
|
type RoomCreated = Notifications['roomCreated'];
|
|
830
909
|
type RoomDeleted = Notifications['roomDeleted'];
|
|
@@ -835,16 +914,19 @@ type PeerConnected = Notifications['peerConnected'];
|
|
|
835
914
|
type PeerDisconnected = Notifications['peerDisconnected'];
|
|
836
915
|
type PeerMetadataUpdated = Notifications['peerMetadataUpdated'];
|
|
837
916
|
type PeerCrashed = Notifications['peerCrashed'];
|
|
838
|
-
type
|
|
839
|
-
type
|
|
917
|
+
type StreamerConnected = Notifications['streamerConnected'];
|
|
918
|
+
type StreamerDisconnected = Notifications['streamerDisconnected'];
|
|
840
919
|
type ViewerConnected = Notifications['viewerConnected'];
|
|
841
920
|
type ViewerDisconnected = Notifications['viewerDisconnected'];
|
|
842
921
|
type TrackAdded = Notifications['trackAdded'];
|
|
843
922
|
type TrackRemoved = Notifications['trackRemoved'];
|
|
844
923
|
type TrackMetadataUpdated = Notifications['trackMetadataUpdated'];
|
|
924
|
+
type ChannelAdded = Notifications['channelAdded'];
|
|
925
|
+
type ChannelRemoved = Notifications['channelRemoved'];
|
|
845
926
|
type NotificationEvents = {
|
|
846
|
-
[K in ExpectedEvents]: (message:
|
|
927
|
+
[K in ExpectedEvents]: (message: Notifications[K]) => void;
|
|
847
928
|
};
|
|
929
|
+
|
|
848
930
|
declare const FishjamWSNotifier_base: new () => TypedEventEmitter<NotificationEvents>;
|
|
849
931
|
/**
|
|
850
932
|
* Notifier object that can be used to get notified about various events related to the Fishjam App.
|
|
@@ -863,29 +945,26 @@ declare const expectedEventsList: readonly ["trackData"];
|
|
|
863
945
|
* @useDeclaredType
|
|
864
946
|
*/
|
|
865
947
|
type ExpectedAgentEvents = (typeof expectedEventsList)[number];
|
|
866
|
-
type IncomingTrackData =
|
|
948
|
+
type IncomingTrackData = Override<NonNullable<AgentResponse_TrackData>, {
|
|
867
949
|
peerId: PeerId;
|
|
868
|
-
}
|
|
950
|
+
}>;
|
|
869
951
|
type IncomingTrackImage = NonNullable<AgentResponse_TrackImage>;
|
|
870
|
-
type OutgoingTrackData =
|
|
952
|
+
type OutgoingTrackData = Override<NonNullable<AgentRequest_TrackData>, {
|
|
871
953
|
peerId: PeerId;
|
|
872
|
-
}
|
|
873
|
-
type AgentTrack =
|
|
954
|
+
}>;
|
|
955
|
+
type AgentTrack = Override<Track$1, {
|
|
874
956
|
id: TrackId;
|
|
875
|
-
}
|
|
876
|
-
type TrackType = 'audio' | 'video';
|
|
957
|
+
}>;
|
|
877
958
|
type AudioCodecParameters = {
|
|
878
959
|
encoding: 'opus' | 'pcm16';
|
|
879
960
|
sampleRate: 16000 | 24000 | 48000;
|
|
880
961
|
channels: 1;
|
|
881
962
|
};
|
|
882
963
|
type TrackId = Brand<string, 'TrackId'>;
|
|
883
|
-
/**
|
|
884
|
-
* @inline
|
|
885
|
-
*/
|
|
886
|
-
type ResponseWithPeerId = WithPeerId<AgentResponse>;
|
|
887
964
|
type AgentEvents = {
|
|
888
|
-
[K in ExpectedAgentEvents]: (message: NonNullable<
|
|
965
|
+
[K in ExpectedAgentEvents]: (message: Override<NonNullable<AgentResponse[K]>, {
|
|
966
|
+
peerId: PeerId;
|
|
967
|
+
}>) => void;
|
|
889
968
|
};
|
|
890
969
|
declare const FishjamAgent_base: new () => TypedEventEmitter<AgentEvents>;
|
|
891
970
|
declare class FishjamAgent extends FishjamAgent_base {
|
|
@@ -926,7 +1005,7 @@ declare class FishjamAgent extends FishjamAgent_base {
|
|
|
926
1005
|
* @param timeoutMs - timeout in milliseconds (default: 5000)
|
|
927
1006
|
* @returns a promise that resolves with the captured image data
|
|
928
1007
|
*/
|
|
929
|
-
captureImage(trackId:
|
|
1008
|
+
captureImage(trackId: TrackId, timeoutMs?: number): Promise<IncomingTrackImage>;
|
|
930
1009
|
disconnect(): void;
|
|
931
1010
|
private handleTrackImageMessage;
|
|
932
1011
|
private rejectPendingCaptures;
|
|
@@ -945,11 +1024,16 @@ declare class FishjamClient {
|
|
|
945
1024
|
private readonly roomApi;
|
|
946
1025
|
private readonly viewerApi;
|
|
947
1026
|
private readonly streamerApi;
|
|
1027
|
+
private readonly credentialsApi;
|
|
948
1028
|
private readonly fishjamConfig;
|
|
949
1029
|
private deprecationWarningShown;
|
|
950
1030
|
/**
|
|
951
1031
|
* Create new instance of Fishjam Client.
|
|
952
1032
|
*
|
|
1033
|
+
* Does not verify credentials against the backend — use
|
|
1034
|
+
* {@link FishjamClient.create} or call
|
|
1035
|
+
* {@link FishjamClient.checkCredentials} afterwards for that.
|
|
1036
|
+
*
|
|
953
1037
|
* Example usage:
|
|
954
1038
|
* ```
|
|
955
1039
|
* const fishjamClient = new FishjamClient({
|
|
@@ -959,6 +1043,29 @@ declare class FishjamClient {
|
|
|
959
1043
|
* ```
|
|
960
1044
|
*/
|
|
961
1045
|
constructor(config: FishjamConfig);
|
|
1046
|
+
/**
|
|
1047
|
+
* Async factory: constructs a client and verifies credentials against
|
|
1048
|
+
* the backend.
|
|
1049
|
+
*
|
|
1050
|
+
* Throws {@link InvalidFishjamCredentialsException} when the
|
|
1051
|
+
* `fishjamId` / `managementToken` pair is rejected by the backend.
|
|
1052
|
+
*
|
|
1053
|
+
* Example:
|
|
1054
|
+
* ```
|
|
1055
|
+
* const client = await FishjamClient.create({
|
|
1056
|
+
* fishjamId: process.env.FISHJAM_ID!,
|
|
1057
|
+
* managementToken: process.env.FISHJAM_MANAGEMENT_TOKEN!,
|
|
1058
|
+
* });
|
|
1059
|
+
* ```
|
|
1060
|
+
*/
|
|
1061
|
+
static create(config: FishjamConfig): Promise<FishjamClient>;
|
|
1062
|
+
/**
|
|
1063
|
+
* Verifies the configured credentials by making a single lightweight
|
|
1064
|
+
* call to the Fishjam backend. Resolves on success, throws
|
|
1065
|
+
* {@link InvalidFishjamCredentialsException} on 401/404 from the backend,
|
|
1066
|
+
* otherwise rethrows the standard mapped exception.
|
|
1067
|
+
*/
|
|
1068
|
+
checkCredentials(): Promise<void>;
|
|
962
1069
|
private handleDeprecationHeader;
|
|
963
1070
|
/**
|
|
964
1071
|
* Create a new room. All peers connected to the same room will be able to send/receive streams to each other.
|
|
@@ -1052,11 +1159,15 @@ declare class RoomNotFoundException extends FishjamBaseException {
|
|
|
1052
1159
|
}
|
|
1053
1160
|
declare class FishjamNotFoundException extends FishjamBaseException {
|
|
1054
1161
|
}
|
|
1162
|
+
declare class InvalidFishjamCredentialsException extends FishjamBaseException {
|
|
1163
|
+
}
|
|
1055
1164
|
declare class PeerNotFoundException extends FishjamBaseException {
|
|
1056
1165
|
}
|
|
1057
1166
|
declare class ServiceUnavailableException extends FishjamBaseException {
|
|
1058
1167
|
}
|
|
1168
|
+
declare class QuotaExceededException extends FishjamBaseException {
|
|
1169
|
+
}
|
|
1059
1170
|
declare class UnknownException extends FishjamBaseException {
|
|
1060
1171
|
}
|
|
1061
1172
|
|
|
1062
|
-
export { type AgentCallbacks, type AgentEvents, type AgentTrack, type AudioCodecParameters, BadRequestException, type Brand, type CloseEventHandler, type ErrorEventHandler, type ExpectedAgentEvents, type ExpectedEvents, FishjamAgent, FishjamBaseException, FishjamClient, type FishjamConfig, FishjamNotFoundException, FishjamWSNotifier, ForbiddenException, type IncomingTrackData, type IncomingTrackImage, MissingFishjamIdException, type MoqToken, type MoqTokenConfig, type NotificationEvents, type OutgoingTrackData, 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 Room, type RoomConfig, type RoomCrashed, type RoomCreated, type RoomDeleted, type RoomId, RoomNotFoundException, RoomType, ServerMessage, ServiceUnavailableException, type
|
|
1173
|
+
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, 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 };
|