@fishjam-cloud/js-server-sdk 0.27.0-rc.1 → 0.27.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.
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "@fishjam-cloud/js-server-sdk",
4
- version: "0.27.0-rc.1",
4
+ version: "0.27.0",
5
5
  description: "Fishjam server SDK for JavaScript",
6
6
  homepage: "https://github.com/fishjam-cloud/js-server-sdk",
7
7
  author: "Fishjam Team",
package/dist/index.d.mts CHANGED
@@ -112,13 +112,13 @@ interface Peer$1 {
112
112
  * @type {Array<Track>}
113
113
  * @memberof Peer
114
114
  */
115
- 'tracks': Array<Track$1>;
115
+ 'tracks': Array<Track$2>;
116
116
  /**
117
117
  *
118
118
  * @type {PeerType}
119
119
  * @memberof Peer
120
120
  */
121
- 'type': PeerType;
121
+ 'type': PeerType$1;
122
122
  }
123
123
  /**
124
124
  * @type PeerOptions
@@ -206,18 +206,24 @@ type PeerStatus = typeof PeerStatus[keyof typeof PeerStatus];
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}
@@ -264,13 +270,13 @@ declare const RoomType: {
264
270
  };
265
271
  type RoomType = typeof RoomType[keyof typeof RoomType];
266
272
  /**
267
- * Token for authorizing broadcaster streamer connection
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
  */
@@ -306,11 +312,11 @@ interface Subscriptions {
306
312
  'tracks': Array<string>;
307
313
  }
308
314
  /**
309
- * Describes media track of a Peer
315
+ * Media track of a Peer
310
316
  * @export
311
317
  * @interface Track
312
318
  */
313
- interface Track$1 {
319
+ interface Track$2 {
314
320
  /**
315
321
  * Assigned track id
316
322
  * @type {string}
@@ -318,7 +324,7 @@ interface Track$1 {
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
  */
@@ -331,7 +337,7 @@ interface Track$1 {
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
  */
@@ -351,13 +357,13 @@ declare const VideoCodec: {
351
357
  };
352
358
  type VideoCodec = typeof VideoCodec[keyof typeof VideoCodec];
353
359
  /**
354
- * Token for authorizing broadcaster viewer connection
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
  */
@@ -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>;
@@ -784,6 +809,16 @@ type PeerId = Brand<string, 'PeerId'>;
784
809
  type Peer = Omit<Peer$1, 'id'> & {
785
810
  id: PeerId;
786
811
  };
812
+ /**
813
+ * Peer type as emitted by {@link FishjamWSNotifier}. Matches the REST API's `PeerType`,
814
+ * with the addition of `'unspecified'` for messages whose peer type is not set on the wire.
815
+ */
816
+ type PeerType = PeerType$1 | 'unspecified';
817
+ /**
818
+ * Track type as emitted by {@link FishjamWSNotifier}. Matches the REST API's `TrackType`,
819
+ * with the addition of `'unspecified'` for messages whose track type is not set on the wire.
820
+ */
821
+ type TrackType = TrackType$2 | 'unspecified';
787
822
  type Room = {
788
823
  id: RoomId;
789
824
  peers: Peer[];
@@ -815,16 +850,57 @@ type WithPeerId<T> = {
815
850
  } : T[P];
816
851
  };
817
852
 
818
- type ExpectedEvents = 'roomCreated' | 'roomDeleted' | 'roomCrashed' | 'peerAdded' | 'peerDeleted' | 'peerConnected' | 'peerDisconnected' | 'peerMetadataUpdated' | 'peerCrashed' | 'streamConnected' | 'streamDisconnected' | 'viewerConnected' | 'viewerDisconnected' | 'trackAdded' | 'trackRemoved' | 'trackMetadataUpdated';
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;
860
+ };
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
  /**
820
871
  * @inline
821
872
  */
822
873
  type MessageWithIds = WithPeerId<WithRoomId<ServerMessage>>;
874
+ /** @inline */
875
+ type WithMappedPeerType<T> = Omit<T, 'peerType'> & {
876
+ peerType: PeerType;
877
+ };
878
+ /** @inline */
879
+ type WithMappedTrack<T> = Omit<T, 'track'> & {
880
+ track: Track | undefined;
881
+ };
823
882
  /**
824
883
  * @inline
825
884
  */
826
885
  type Notifications = {
827
- [K in ExpectedEvents]: NonNullable<MessageWithIds[K]>;
886
+ roomCreated: NonNullable<MessageWithIds['roomCreated']>;
887
+ roomDeleted: NonNullable<MessageWithIds['roomDeleted']>;
888
+ roomCrashed: NonNullable<MessageWithIds['roomCrashed']>;
889
+ peerAdded: WithMappedPeerType<NonNullable<MessageWithIds['peerAdded']>>;
890
+ peerDeleted: WithMappedPeerType<NonNullable<MessageWithIds['peerDeleted']>>;
891
+ peerConnected: WithMappedPeerType<NonNullable<MessageWithIds['peerConnected']>>;
892
+ peerDisconnected: WithMappedPeerType<NonNullable<MessageWithIds['peerDisconnected']>>;
893
+ peerMetadataUpdated: WithMappedPeerType<NonNullable<MessageWithIds['peerMetadataUpdated']>>;
894
+ peerCrashed: WithMappedPeerType<NonNullable<MessageWithIds['peerCrashed']>>;
895
+ streamerConnected: NonNullable<MessageWithIds['streamerConnected']>;
896
+ streamerDisconnected: NonNullable<MessageWithIds['streamerDisconnected']>;
897
+ viewerConnected: NonNullable<MessageWithIds['viewerConnected']>;
898
+ viewerDisconnected: NonNullable<MessageWithIds['viewerDisconnected']>;
899
+ trackAdded: WithMappedTrack<NonNullable<MessageWithIds['trackAdded']>>;
900
+ trackRemoved: WithMappedTrack<NonNullable<MessageWithIds['trackRemoved']>>;
901
+ trackMetadataUpdated: WithMappedTrack<NonNullable<MessageWithIds['trackMetadataUpdated']>>;
902
+ channelAdded: NonNullable<MessageWithIds['channelAdded']>;
903
+ channelRemoved: NonNullable<MessageWithIds['channelRemoved']>;
828
904
  };
829
905
  type RoomCreated = Notifications['roomCreated'];
830
906
  type RoomDeleted = Notifications['roomDeleted'];
@@ -835,16 +911,19 @@ type PeerConnected = Notifications['peerConnected'];
835
911
  type PeerDisconnected = Notifications['peerDisconnected'];
836
912
  type PeerMetadataUpdated = Notifications['peerMetadataUpdated'];
837
913
  type PeerCrashed = Notifications['peerCrashed'];
838
- type StreamConnected = Notifications['streamConnected'];
839
- type StreamDisconnected = Notifications['streamDisconnected'];
914
+ type StreamerConnected = Notifications['streamerConnected'];
915
+ type StreamerDisconnected = Notifications['streamerDisconnected'];
840
916
  type ViewerConnected = Notifications['viewerConnected'];
841
917
  type ViewerDisconnected = Notifications['viewerDisconnected'];
842
918
  type TrackAdded = Notifications['trackAdded'];
843
919
  type TrackRemoved = Notifications['trackRemoved'];
844
920
  type TrackMetadataUpdated = Notifications['trackMetadataUpdated'];
921
+ type ChannelAdded = Notifications['channelAdded'];
922
+ type ChannelRemoved = Notifications['channelRemoved'];
845
923
  type NotificationEvents = {
846
- [K in ExpectedEvents]: (message: NonNullable<MessageWithIds[K]>) => void;
924
+ [K in ExpectedEvents]: (message: Notifications[K]) => void;
847
925
  };
926
+
848
927
  declare const FishjamWSNotifier_base: new () => TypedEventEmitter<NotificationEvents>;
849
928
  /**
850
929
  * Notifier object that can be used to get notified about various events related to the Fishjam App.
@@ -870,10 +949,9 @@ type IncomingTrackImage = NonNullable<AgentResponse_TrackImage>;
870
949
  type OutgoingTrackData = Omit<NonNullable<AgentRequest_TrackData>, 'peerId'> & {
871
950
  peerId: PeerId;
872
951
  };
873
- type AgentTrack = Omit<Track, 'id'> & {
952
+ type AgentTrack = Omit<Track$1, 'id'> & {
874
953
  id: TrackId;
875
954
  };
876
- type TrackType = 'audio' | 'video';
877
955
  type AudioCodecParameters = {
878
956
  encoding: 'opus' | 'pcm16';
879
957
  sampleRate: 16000 | 24000 | 48000;
@@ -926,7 +1004,7 @@ declare class FishjamAgent extends FishjamAgent_base {
926
1004
  * @param timeoutMs - timeout in milliseconds (default: 5000)
927
1005
  * @returns a promise that resolves with the captured image data
928
1006
  */
929
- captureImage(trackId: string, timeoutMs?: number): Promise<IncomingTrackImage>;
1007
+ captureImage(trackId: TrackId, timeoutMs?: number): Promise<IncomingTrackImage>;
930
1008
  disconnect(): void;
931
1009
  private handleTrackImageMessage;
932
1010
  private rejectPendingCaptures;
@@ -1059,4 +1137,4 @@ declare class ServiceUnavailableException extends FishjamBaseException {
1059
1137
  declare class UnknownException extends FishjamBaseException {
1060
1138
  }
1061
1139
 
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 StreamConnected, type StreamDisconnected, type StreamerToken, type TrackAdded, type TrackId, type TrackMetadataUpdated, type TrackRemoved, type TrackType, UnauthorizedException, UnknownException, VideoCodec, type ViewerConnected, type ViewerDisconnected, type ViewerToken };
1140
+ 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, 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 PeerType, 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 };
package/dist/index.d.ts CHANGED
@@ -112,13 +112,13 @@ interface Peer$1 {
112
112
  * @type {Array<Track>}
113
113
  * @memberof Peer
114
114
  */
115
- 'tracks': Array<Track$1>;
115
+ 'tracks': Array<Track$2>;
116
116
  /**
117
117
  *
118
118
  * @type {PeerType}
119
119
  * @memberof Peer
120
120
  */
121
- 'type': PeerType;
121
+ 'type': PeerType$1;
122
122
  }
123
123
  /**
124
124
  * @type PeerOptions
@@ -206,18 +206,24 @@ type PeerStatus = typeof PeerStatus[keyof typeof PeerStatus];
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}
@@ -264,13 +270,13 @@ declare const RoomType: {
264
270
  };
265
271
  type RoomType = typeof RoomType[keyof typeof RoomType];
266
272
  /**
267
- * Token for authorizing broadcaster streamer connection
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
  */
@@ -306,11 +312,11 @@ interface Subscriptions {
306
312
  'tracks': Array<string>;
307
313
  }
308
314
  /**
309
- * Describes media track of a Peer
315
+ * Media track of a Peer
310
316
  * @export
311
317
  * @interface Track
312
318
  */
313
- interface Track$1 {
319
+ interface Track$2 {
314
320
  /**
315
321
  * Assigned track id
316
322
  * @type {string}
@@ -318,7 +324,7 @@ interface Track$1 {
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
  */
@@ -331,7 +337,7 @@ interface Track$1 {
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
  */
@@ -351,13 +357,13 @@ declare const VideoCodec: {
351
357
  };
352
358
  type VideoCodec = typeof VideoCodec[keyof typeof VideoCodec];
353
359
  /**
354
- * Token for authorizing broadcaster viewer connection
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
  */
@@ -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>;
@@ -784,6 +809,16 @@ type PeerId = Brand<string, 'PeerId'>;
784
809
  type Peer = Omit<Peer$1, 'id'> & {
785
810
  id: PeerId;
786
811
  };
812
+ /**
813
+ * Peer type as emitted by {@link FishjamWSNotifier}. Matches the REST API's `PeerType`,
814
+ * with the addition of `'unspecified'` for messages whose peer type is not set on the wire.
815
+ */
816
+ type PeerType = PeerType$1 | 'unspecified';
817
+ /**
818
+ * Track type as emitted by {@link FishjamWSNotifier}. Matches the REST API's `TrackType`,
819
+ * with the addition of `'unspecified'` for messages whose track type is not set on the wire.
820
+ */
821
+ type TrackType = TrackType$2 | 'unspecified';
787
822
  type Room = {
788
823
  id: RoomId;
789
824
  peers: Peer[];
@@ -815,16 +850,57 @@ type WithPeerId<T> = {
815
850
  } : T[P];
816
851
  };
817
852
 
818
- type ExpectedEvents = 'roomCreated' | 'roomDeleted' | 'roomCrashed' | 'peerAdded' | 'peerDeleted' | 'peerConnected' | 'peerDisconnected' | 'peerMetadataUpdated' | 'peerCrashed' | 'streamConnected' | 'streamDisconnected' | 'viewerConnected' | 'viewerDisconnected' | 'trackAdded' | 'trackRemoved' | 'trackMetadataUpdated';
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;
860
+ };
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
  /**
820
871
  * @inline
821
872
  */
822
873
  type MessageWithIds = WithPeerId<WithRoomId<ServerMessage>>;
874
+ /** @inline */
875
+ type WithMappedPeerType<T> = Omit<T, 'peerType'> & {
876
+ peerType: PeerType;
877
+ };
878
+ /** @inline */
879
+ type WithMappedTrack<T> = Omit<T, 'track'> & {
880
+ track: Track | undefined;
881
+ };
823
882
  /**
824
883
  * @inline
825
884
  */
826
885
  type Notifications = {
827
- [K in ExpectedEvents]: NonNullable<MessageWithIds[K]>;
886
+ roomCreated: NonNullable<MessageWithIds['roomCreated']>;
887
+ roomDeleted: NonNullable<MessageWithIds['roomDeleted']>;
888
+ roomCrashed: NonNullable<MessageWithIds['roomCrashed']>;
889
+ peerAdded: WithMappedPeerType<NonNullable<MessageWithIds['peerAdded']>>;
890
+ peerDeleted: WithMappedPeerType<NonNullable<MessageWithIds['peerDeleted']>>;
891
+ peerConnected: WithMappedPeerType<NonNullable<MessageWithIds['peerConnected']>>;
892
+ peerDisconnected: WithMappedPeerType<NonNullable<MessageWithIds['peerDisconnected']>>;
893
+ peerMetadataUpdated: WithMappedPeerType<NonNullable<MessageWithIds['peerMetadataUpdated']>>;
894
+ peerCrashed: WithMappedPeerType<NonNullable<MessageWithIds['peerCrashed']>>;
895
+ streamerConnected: NonNullable<MessageWithIds['streamerConnected']>;
896
+ streamerDisconnected: NonNullable<MessageWithIds['streamerDisconnected']>;
897
+ viewerConnected: NonNullable<MessageWithIds['viewerConnected']>;
898
+ viewerDisconnected: NonNullable<MessageWithIds['viewerDisconnected']>;
899
+ trackAdded: WithMappedTrack<NonNullable<MessageWithIds['trackAdded']>>;
900
+ trackRemoved: WithMappedTrack<NonNullable<MessageWithIds['trackRemoved']>>;
901
+ trackMetadataUpdated: WithMappedTrack<NonNullable<MessageWithIds['trackMetadataUpdated']>>;
902
+ channelAdded: NonNullable<MessageWithIds['channelAdded']>;
903
+ channelRemoved: NonNullable<MessageWithIds['channelRemoved']>;
828
904
  };
829
905
  type RoomCreated = Notifications['roomCreated'];
830
906
  type RoomDeleted = Notifications['roomDeleted'];
@@ -835,16 +911,19 @@ type PeerConnected = Notifications['peerConnected'];
835
911
  type PeerDisconnected = Notifications['peerDisconnected'];
836
912
  type PeerMetadataUpdated = Notifications['peerMetadataUpdated'];
837
913
  type PeerCrashed = Notifications['peerCrashed'];
838
- type StreamConnected = Notifications['streamConnected'];
839
- type StreamDisconnected = Notifications['streamDisconnected'];
914
+ type StreamerConnected = Notifications['streamerConnected'];
915
+ type StreamerDisconnected = Notifications['streamerDisconnected'];
840
916
  type ViewerConnected = Notifications['viewerConnected'];
841
917
  type ViewerDisconnected = Notifications['viewerDisconnected'];
842
918
  type TrackAdded = Notifications['trackAdded'];
843
919
  type TrackRemoved = Notifications['trackRemoved'];
844
920
  type TrackMetadataUpdated = Notifications['trackMetadataUpdated'];
921
+ type ChannelAdded = Notifications['channelAdded'];
922
+ type ChannelRemoved = Notifications['channelRemoved'];
845
923
  type NotificationEvents = {
846
- [K in ExpectedEvents]: (message: NonNullable<MessageWithIds[K]>) => void;
924
+ [K in ExpectedEvents]: (message: Notifications[K]) => void;
847
925
  };
926
+
848
927
  declare const FishjamWSNotifier_base: new () => TypedEventEmitter<NotificationEvents>;
849
928
  /**
850
929
  * Notifier object that can be used to get notified about various events related to the Fishjam App.
@@ -870,10 +949,9 @@ type IncomingTrackImage = NonNullable<AgentResponse_TrackImage>;
870
949
  type OutgoingTrackData = Omit<NonNullable<AgentRequest_TrackData>, 'peerId'> & {
871
950
  peerId: PeerId;
872
951
  };
873
- type AgentTrack = Omit<Track, 'id'> & {
952
+ type AgentTrack = Omit<Track$1, 'id'> & {
874
953
  id: TrackId;
875
954
  };
876
- type TrackType = 'audio' | 'video';
877
955
  type AudioCodecParameters = {
878
956
  encoding: 'opus' | 'pcm16';
879
957
  sampleRate: 16000 | 24000 | 48000;
@@ -926,7 +1004,7 @@ declare class FishjamAgent extends FishjamAgent_base {
926
1004
  * @param timeoutMs - timeout in milliseconds (default: 5000)
927
1005
  * @returns a promise that resolves with the captured image data
928
1006
  */
929
- captureImage(trackId: string, timeoutMs?: number): Promise<IncomingTrackImage>;
1007
+ captureImage(trackId: TrackId, timeoutMs?: number): Promise<IncomingTrackImage>;
930
1008
  disconnect(): void;
931
1009
  private handleTrackImageMessage;
932
1010
  private rejectPendingCaptures;
@@ -1059,4 +1137,4 @@ declare class ServiceUnavailableException extends FishjamBaseException {
1059
1137
  declare class UnknownException extends FishjamBaseException {
1060
1138
  }
1061
1139
 
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 StreamConnected, type StreamDisconnected, type StreamerToken, type TrackAdded, type TrackId, type TrackMetadataUpdated, type TrackRemoved, type TrackType, UnauthorizedException, UnknownException, VideoCodec, type ViewerConnected, type ViewerDisconnected, type ViewerToken };
1140
+ 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, 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 PeerType, 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 };