@fishjam-cloud/js-server-sdk 0.28.1 → 0.29.0-rc.2

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.1",
4
+ version: "0.29.0-rc.2",
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
@@ -840,6 +840,10 @@ type PeerType = PeerType$1 | 'unspecified';
840
840
  * with the addition of `'unspecified'` for messages whose track type is not set on the wire.
841
841
  */
842
842
  type TrackType = TrackType$2 | 'unspecified';
843
+ /**
844
+ * Voice activity status of a track.
845
+ */
846
+ type VadStatus = 'speech' | 'silence';
843
847
  type Room = {
844
848
  id: RoomId;
845
849
  peers: Peer[];
@@ -864,14 +868,14 @@ type Track = {
864
868
  type: TrackType;
865
869
  metadata: string;
866
870
  };
867
- 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"];
868
872
  type ExpectedEvents = (typeof expectedEventsList$1)[number];
869
873
  /**
870
874
  * `ServerMessage` oneof members that are intentionally NOT emitted to users.
871
875
  * Grouped with a brief rationale so the classification stays reviewable.
872
876
  * Mirrors the Python SDK's `IGNORED_NOTIFICATIONS` partition (FCE-3215).
873
877
  */
874
- 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"];
875
879
  type IgnoredEvents = (typeof ignoredEventsList)[number];
876
880
  /**
877
881
  * Field-level overrides applied to every notification payload: branded ID types
@@ -885,6 +889,9 @@ type NotificationOverrides = {
885
889
  peerId: PeerId;
886
890
  peerType: PeerType;
887
891
  track: Track | undefined;
892
+ audioTrack: Track | undefined;
893
+ videoTrack: Track | undefined;
894
+ status: VadStatus;
888
895
  };
889
896
  /** @inline */
890
897
  type Notification<K extends keyof ServerMessage> = Override<NonNullable<ServerMessage[K]>, NotificationOverrides>;
@@ -908,6 +915,9 @@ type Notifications = {
908
915
  trackAdded: Notification<'trackAdded'>;
909
916
  trackRemoved: Notification<'trackRemoved'>;
910
917
  trackMetadataUpdated: Notification<'trackMetadataUpdated'>;
918
+ trackForwarding: Notification<'trackForwarding'>;
919
+ trackForwardingRemoved: Notification<'trackForwardingRemoved'>;
920
+ vadNotification: Notification<'vadNotification'>;
911
921
  channelAdded: Notification<'channelAdded'>;
912
922
  channelRemoved: Notification<'channelRemoved'>;
913
923
  };
@@ -927,6 +937,9 @@ type ViewerDisconnected = Notifications['viewerDisconnected'];
927
937
  type TrackAdded = Notifications['trackAdded'];
928
938
  type TrackRemoved = Notifications['trackRemoved'];
929
939
  type TrackMetadataUpdated = Notifications['trackMetadataUpdated'];
940
+ type TrackForwarding = Notifications['trackForwarding'];
941
+ type TrackForwardingRemoved = Notifications['trackForwardingRemoved'];
942
+ type VadNotification = Notifications['vadNotification'];
930
943
  type ChannelAdded = Notifications['channelAdded'];
931
944
  type ChannelRemoved = Notifications['channelRemoved'];
932
945
  type NotificationEvents = {
@@ -952,6 +965,10 @@ declare const FishjamWSNotifier_base: new () => TypedEventEmitter<NotificationEv
952
965
  declare class FishjamWSNotifier extends FishjamWSNotifier_base {
953
966
  private readonly client;
954
967
  constructor(config: FishjamConfig, onError: ErrorEventHandler, onClose: CloseEventHandler);
968
+ /**
969
+ * Close the underlying WebSocket and stop emitting notifications.
970
+ */
971
+ disconnect(): void;
955
972
  private dispatchNotification;
956
973
  private setupConnection;
957
974
  }
@@ -1215,4 +1232,4 @@ declare class QuotaExceededException extends FishjamBaseException {
1215
1232
  declare class UnknownException extends FishjamBaseException {
1216
1233
  }
1217
1234
 
1218
- 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 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 };
package/dist/index.d.ts CHANGED
@@ -840,6 +840,10 @@ type PeerType = PeerType$1 | 'unspecified';
840
840
  * with the addition of `'unspecified'` for messages whose track type is not set on the wire.
841
841
  */
842
842
  type TrackType = TrackType$2 | 'unspecified';
843
+ /**
844
+ * Voice activity status of a track.
845
+ */
846
+ type VadStatus = 'speech' | 'silence';
843
847
  type Room = {
844
848
  id: RoomId;
845
849
  peers: Peer[];
@@ -864,14 +868,14 @@ type Track = {
864
868
  type: TrackType;
865
869
  metadata: string;
866
870
  };
867
- 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"];
868
872
  type ExpectedEvents = (typeof expectedEventsList$1)[number];
869
873
  /**
870
874
  * `ServerMessage` oneof members that are intentionally NOT emitted to users.
871
875
  * Grouped with a brief rationale so the classification stays reviewable.
872
876
  * Mirrors the Python SDK's `IGNORED_NOTIFICATIONS` partition (FCE-3215).
873
877
  */
874
- 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"];
875
879
  type IgnoredEvents = (typeof ignoredEventsList)[number];
876
880
  /**
877
881
  * Field-level overrides applied to every notification payload: branded ID types
@@ -885,6 +889,9 @@ type NotificationOverrides = {
885
889
  peerId: PeerId;
886
890
  peerType: PeerType;
887
891
  track: Track | undefined;
892
+ audioTrack: Track | undefined;
893
+ videoTrack: Track | undefined;
894
+ status: VadStatus;
888
895
  };
889
896
  /** @inline */
890
897
  type Notification<K extends keyof ServerMessage> = Override<NonNullable<ServerMessage[K]>, NotificationOverrides>;
@@ -908,6 +915,9 @@ type Notifications = {
908
915
  trackAdded: Notification<'trackAdded'>;
909
916
  trackRemoved: Notification<'trackRemoved'>;
910
917
  trackMetadataUpdated: Notification<'trackMetadataUpdated'>;
918
+ trackForwarding: Notification<'trackForwarding'>;
919
+ trackForwardingRemoved: Notification<'trackForwardingRemoved'>;
920
+ vadNotification: Notification<'vadNotification'>;
911
921
  channelAdded: Notification<'channelAdded'>;
912
922
  channelRemoved: Notification<'channelRemoved'>;
913
923
  };
@@ -927,6 +937,9 @@ type ViewerDisconnected = Notifications['viewerDisconnected'];
927
937
  type TrackAdded = Notifications['trackAdded'];
928
938
  type TrackRemoved = Notifications['trackRemoved'];
929
939
  type TrackMetadataUpdated = Notifications['trackMetadataUpdated'];
940
+ type TrackForwarding = Notifications['trackForwarding'];
941
+ type TrackForwardingRemoved = Notifications['trackForwardingRemoved'];
942
+ type VadNotification = Notifications['vadNotification'];
930
943
  type ChannelAdded = Notifications['channelAdded'];
931
944
  type ChannelRemoved = Notifications['channelRemoved'];
932
945
  type NotificationEvents = {
@@ -952,6 +965,10 @@ declare const FishjamWSNotifier_base: new () => TypedEventEmitter<NotificationEv
952
965
  declare class FishjamWSNotifier extends FishjamWSNotifier_base {
953
966
  private readonly client;
954
967
  constructor(config: FishjamConfig, onError: ErrorEventHandler, onClose: CloseEventHandler);
968
+ /**
969
+ * Close the underlying WebSocket and stop emitting notifications.
970
+ */
971
+ disconnect(): void;
955
972
  private dispatchNotification;
956
973
  private setupConnection;
957
974
  }
@@ -1215,4 +1232,4 @@ declare class QuotaExceededException extends FishjamBaseException {
1215
1232
  declare class UnknownException extends FishjamBaseException {
1216
1233
  }
1217
1234
 
1218
- 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 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 };
package/dist/index.js CHANGED
@@ -2041,6 +2041,13 @@ function serverMessage_EventTypeToJSON(object) {
2041
2041
  return "UNRECOGNIZED";
2042
2042
  }
2043
2043
  }
2044
+ var ServerMessage_VadNotification_Status = /* @__PURE__ */ ((ServerMessage_VadNotification_Status2) => {
2045
+ ServerMessage_VadNotification_Status2[ServerMessage_VadNotification_Status2["STATUS_UNSPECIFIED"] = 0] = "STATUS_UNSPECIFIED";
2046
+ ServerMessage_VadNotification_Status2[ServerMessage_VadNotification_Status2["STATUS_SILENCE"] = 1] = "STATUS_SILENCE";
2047
+ ServerMessage_VadNotification_Status2[ServerMessage_VadNotification_Status2["STATUS_SPEECH"] = 2] = "STATUS_SPEECH";
2048
+ ServerMessage_VadNotification_Status2[ServerMessage_VadNotification_Status2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
2049
+ return ServerMessage_VadNotification_Status2;
2050
+ })(ServerMessage_VadNotification_Status || {});
2044
2051
  function serverMessage_VadNotification_StatusFromJSON(object) {
2045
2052
  switch (object) {
2046
2053
  case 0:
@@ -5916,6 +5923,12 @@ var trackTypeMap = {
5916
5923
  [TrackType.TRACK_TYPE_AUDIO]: "audio",
5917
5924
  [TrackType.UNRECOGNIZED]: "unspecified"
5918
5925
  };
5926
+ var vadStatusMap = {
5927
+ [ServerMessage_VadNotification_Status.STATUS_UNSPECIFIED]: "silence",
5928
+ [ServerMessage_VadNotification_Status.STATUS_SILENCE]: "silence",
5929
+ [ServerMessage_VadNotification_Status.STATUS_SPEECH]: "speech",
5930
+ [ServerMessage_VadNotification_Status.UNRECOGNIZED]: "silence"
5931
+ };
5919
5932
  var expectedEventsList = [
5920
5933
  "roomCreated",
5921
5934
  "roomDeleted",
@@ -5933,6 +5946,9 @@ var expectedEventsList = [
5933
5946
  "trackAdded",
5934
5947
  "trackRemoved",
5935
5948
  "trackMetadataUpdated",
5949
+ "trackForwarding",
5950
+ "trackForwardingRemoved",
5951
+ "vadNotification",
5936
5952
  "channelAdded",
5937
5953
  "channelRemoved"
5938
5954
  ];
@@ -5955,6 +5971,14 @@ var mapNotification = (event, msg) => {
5955
5971
  const trackMsg = msg;
5956
5972
  return { ...trackMsg, track: mapTrack(trackMsg.track) };
5957
5973
  }
5974
+ if (event === "trackForwarding") {
5975
+ const fwd = msg;
5976
+ return { ...fwd, audioTrack: mapTrack(fwd.audioTrack), videoTrack: mapTrack(fwd.videoTrack) };
5977
+ }
5978
+ if (event === "vadNotification") {
5979
+ const vad = msg;
5980
+ return { ...vad, status: vadStatusMap[vad.status] };
5981
+ }
5958
5982
  return msg;
5959
5983
  };
5960
5984
  var isExpectedEvent = (event) => expectedEventsList.includes(event);
@@ -5982,6 +6006,13 @@ var FishjamWSNotifier = class extends import_events.EventEmitter {
5982
6006
  this.client.onmessage = (message) => this.dispatchNotification(message);
5983
6007
  this.client.onopen = () => this.setupConnection(config.managementToken);
5984
6008
  }
6009
+ /**
6010
+ * Close the underlying WebSocket and stop emitting notifications.
6011
+ */
6012
+ disconnect() {
6013
+ this.removeAllListeners();
6014
+ this.client.close();
6015
+ }
5985
6016
  dispatchNotification(message) {
5986
6017
  try {
5987
6018
  const decodedMessage = ServerMessage.decode(new Uint8Array(message.data));
@@ -6195,7 +6226,7 @@ var mapException = (error, entity) => {
6195
6226
  // package.json
6196
6227
  var package_default = {
6197
6228
  name: "@fishjam-cloud/js-server-sdk",
6198
- version: "0.28.1",
6229
+ version: "0.29.0-rc.2",
6199
6230
  description: "Fishjam server SDK for JavaScript",
6200
6231
  homepage: "https://github.com/fishjam-cloud/js-server-sdk",
6201
6232
  author: "Fishjam Team",
@@ -6284,7 +6315,8 @@ var package_default = {
6284
6315
  "*.{js,ts,tsx,mjs,cjs}": [
6285
6316
  "eslint --fix --config eslint.config.mjs"
6286
6317
  ]
6287
- }
6318
+ },
6319
+ stableVersion: "0.28.1"
6288
6320
  };
6289
6321
 
6290
6322
  // src/client.ts
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  package_default
3
- } from "./chunk-GTNIELH6.mjs";
3
+ } from "./chunk-ZKMES6M4.mjs";
4
4
 
5
5
  // ../fishjam-openapi/dist/index.js
6
6
  import globalAxios2 from "axios";
@@ -1990,6 +1990,13 @@ function serverMessage_EventTypeToJSON(object) {
1990
1990
  return "UNRECOGNIZED";
1991
1991
  }
1992
1992
  }
1993
+ var ServerMessage_VadNotification_Status = /* @__PURE__ */ ((ServerMessage_VadNotification_Status2) => {
1994
+ ServerMessage_VadNotification_Status2[ServerMessage_VadNotification_Status2["STATUS_UNSPECIFIED"] = 0] = "STATUS_UNSPECIFIED";
1995
+ ServerMessage_VadNotification_Status2[ServerMessage_VadNotification_Status2["STATUS_SILENCE"] = 1] = "STATUS_SILENCE";
1996
+ ServerMessage_VadNotification_Status2[ServerMessage_VadNotification_Status2["STATUS_SPEECH"] = 2] = "STATUS_SPEECH";
1997
+ ServerMessage_VadNotification_Status2[ServerMessage_VadNotification_Status2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
1998
+ return ServerMessage_VadNotification_Status2;
1999
+ })(ServerMessage_VadNotification_Status || {});
1993
2000
  function serverMessage_VadNotification_StatusFromJSON(object) {
1994
2001
  switch (object) {
1995
2002
  case 0:
@@ -5865,6 +5872,12 @@ var trackTypeMap = {
5865
5872
  [TrackType.TRACK_TYPE_AUDIO]: "audio",
5866
5873
  [TrackType.UNRECOGNIZED]: "unspecified"
5867
5874
  };
5875
+ var vadStatusMap = {
5876
+ [ServerMessage_VadNotification_Status.STATUS_UNSPECIFIED]: "silence",
5877
+ [ServerMessage_VadNotification_Status.STATUS_SILENCE]: "silence",
5878
+ [ServerMessage_VadNotification_Status.STATUS_SPEECH]: "speech",
5879
+ [ServerMessage_VadNotification_Status.UNRECOGNIZED]: "silence"
5880
+ };
5868
5881
  var expectedEventsList = [
5869
5882
  "roomCreated",
5870
5883
  "roomDeleted",
@@ -5882,6 +5895,9 @@ var expectedEventsList = [
5882
5895
  "trackAdded",
5883
5896
  "trackRemoved",
5884
5897
  "trackMetadataUpdated",
5898
+ "trackForwarding",
5899
+ "trackForwardingRemoved",
5900
+ "vadNotification",
5885
5901
  "channelAdded",
5886
5902
  "channelRemoved"
5887
5903
  ];
@@ -5904,6 +5920,14 @@ var mapNotification = (event, msg) => {
5904
5920
  const trackMsg = msg;
5905
5921
  return { ...trackMsg, track: mapTrack(trackMsg.track) };
5906
5922
  }
5923
+ if (event === "trackForwarding") {
5924
+ const fwd = msg;
5925
+ return { ...fwd, audioTrack: mapTrack(fwd.audioTrack), videoTrack: mapTrack(fwd.videoTrack) };
5926
+ }
5927
+ if (event === "vadNotification") {
5928
+ const vad = msg;
5929
+ return { ...vad, status: vadStatusMap[vad.status] };
5930
+ }
5907
5931
  return msg;
5908
5932
  };
5909
5933
  var isExpectedEvent = (event) => expectedEventsList.includes(event);
@@ -5931,6 +5955,13 @@ var FishjamWSNotifier = class extends EventEmitter {
5931
5955
  this.client.onmessage = (message) => this.dispatchNotification(message);
5932
5956
  this.client.onopen = () => this.setupConnection(config.managementToken);
5933
5957
  }
5958
+ /**
5959
+ * Close the underlying WebSocket and stop emitting notifications.
5960
+ */
5961
+ disconnect() {
5962
+ this.removeAllListeners();
5963
+ this.client.close();
5964
+ }
5934
5965
  dispatchNotification(message) {
5935
5966
  try {
5936
5967
  const decodedMessage = ServerMessage.decode(new Uint8Array(message.data));
@@ -6,10 +6,37 @@ import { GoogleGenAIOptions, GoogleGenAI } from '@google/genai';
6
6
  * This module is a separate entry point (`@fishjam-cloud/js-server-sdk/gemini`),
7
7
  * so `@google/genai` is only loaded when the consumer imports this module.
8
8
  *
9
+ * Does not verify the API key against Google — use {@link createClientAndValidate}
10
+ * or call {@link checkCredentials} afterwards for that.
11
+ *
9
12
  * @param options Configuration for the GoogleGenAI client.
10
13
  * @returns A GoogleGenAI instance.
11
14
  */
12
15
  declare const createClient: (options: GoogleGenAIOptions) => GoogleGenAI;
16
+ /**
17
+ * Verifies the API key by making a single lightweight authenticated call
18
+ * (`models.list`). Resolves on success; throws if the call fails — either
19
+ * because the key was rejected or because the request itself failed (e.g.
20
+ * network/connectivity). The original error is preserved as `cause`.
21
+ *
22
+ * Note: this catches the common cases (invalid / unauthorized / wrong-project /
23
+ * region-blocked keys). It does not guarantee the key can use a specific Live
24
+ * native-audio model — such model-specific rejections still surface only via the
25
+ * `live.connect` session callbacks (`onerror`/`onclose`).
26
+ *
27
+ * @param client A GoogleGenAI instance, e.g. from {@link createClient}.
28
+ */
29
+ declare const checkCredentials: (client: GoogleGenAI) => Promise<void>;
30
+ /**
31
+ * Creates a GoogleGenAI client and verifies the API key before returning it,
32
+ * so misconfiguration fails fast.
33
+ *
34
+ * Throws if the key is rejected (see {@link checkCredentials}).
35
+ *
36
+ * @param options Configuration for the GoogleGenAI client.
37
+ * @returns A validated GoogleGenAI instance.
38
+ */
39
+ declare const createClientAndValidate: (options: GoogleGenAIOptions) => Promise<GoogleGenAI>;
13
40
  /**
14
41
  * Predefined audio settings for the agent's output track,
15
42
  * configured for Gemini's 24kHz audio output.
@@ -32,4 +59,4 @@ declare const geminiInputAudioSettings: {
32
59
  */
33
60
  declare const inputMimeType: "audio/pcm;rate=16000";
34
61
 
35
- export { createClient, geminiInputAudioSettings, geminiOutputAudioSettings, inputMimeType };
62
+ export { checkCredentials, createClient, createClientAndValidate, geminiInputAudioSettings, geminiOutputAudioSettings, inputMimeType };
@@ -6,10 +6,37 @@ import { GoogleGenAIOptions, GoogleGenAI } from '@google/genai';
6
6
  * This module is a separate entry point (`@fishjam-cloud/js-server-sdk/gemini`),
7
7
  * so `@google/genai` is only loaded when the consumer imports this module.
8
8
  *
9
+ * Does not verify the API key against Google — use {@link createClientAndValidate}
10
+ * or call {@link checkCredentials} afterwards for that.
11
+ *
9
12
  * @param options Configuration for the GoogleGenAI client.
10
13
  * @returns A GoogleGenAI instance.
11
14
  */
12
15
  declare const createClient: (options: GoogleGenAIOptions) => GoogleGenAI;
16
+ /**
17
+ * Verifies the API key by making a single lightweight authenticated call
18
+ * (`models.list`). Resolves on success; throws if the call fails — either
19
+ * because the key was rejected or because the request itself failed (e.g.
20
+ * network/connectivity). The original error is preserved as `cause`.
21
+ *
22
+ * Note: this catches the common cases (invalid / unauthorized / wrong-project /
23
+ * region-blocked keys). It does not guarantee the key can use a specific Live
24
+ * native-audio model — such model-specific rejections still surface only via the
25
+ * `live.connect` session callbacks (`onerror`/`onclose`).
26
+ *
27
+ * @param client A GoogleGenAI instance, e.g. from {@link createClient}.
28
+ */
29
+ declare const checkCredentials: (client: GoogleGenAI) => Promise<void>;
30
+ /**
31
+ * Creates a GoogleGenAI client and verifies the API key before returning it,
32
+ * so misconfiguration fails fast.
33
+ *
34
+ * Throws if the key is rejected (see {@link checkCredentials}).
35
+ *
36
+ * @param options Configuration for the GoogleGenAI client.
37
+ * @returns A validated GoogleGenAI instance.
38
+ */
39
+ declare const createClientAndValidate: (options: GoogleGenAIOptions) => Promise<GoogleGenAI>;
13
40
  /**
14
41
  * Predefined audio settings for the agent's output track,
15
42
  * configured for Gemini's 24kHz audio output.
@@ -32,4 +59,4 @@ declare const geminiInputAudioSettings: {
32
59
  */
33
60
  declare const inputMimeType: "audio/pcm;rate=16000";
34
61
 
35
- export { createClient, geminiInputAudioSettings, geminiOutputAudioSettings, inputMimeType };
62
+ export { checkCredentials, createClient, createClientAndValidate, geminiInputAudioSettings, geminiOutputAudioSettings, inputMimeType };
@@ -20,7 +20,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/integrations/gemini.ts
21
21
  var gemini_exports = {};
22
22
  __export(gemini_exports, {
23
+ checkCredentials: () => checkCredentials,
23
24
  createClient: () => createClient,
25
+ createClientAndValidate: () => createClientAndValidate,
24
26
  geminiInputAudioSettings: () => geminiInputAudioSettings,
25
27
  geminiOutputAudioSettings: () => geminiOutputAudioSettings,
26
28
  inputMimeType: () => inputMimeType
@@ -31,7 +33,7 @@ var import_genai = require("@google/genai");
31
33
  // package.json
32
34
  var package_default = {
33
35
  name: "@fishjam-cloud/js-server-sdk",
34
- version: "0.28.1",
36
+ version: "0.29.0-rc.2",
35
37
  description: "Fishjam server SDK for JavaScript",
36
38
  homepage: "https://github.com/fishjam-cloud/js-server-sdk",
37
39
  author: "Fishjam Team",
@@ -120,7 +122,8 @@ var package_default = {
120
122
  "*.{js,ts,tsx,mjs,cjs}": [
121
123
  "eslint --fix --config eslint.config.mjs"
122
124
  ]
123
- }
125
+ },
126
+ stableVersion: "0.28.1"
124
127
  };
125
128
 
126
129
  // src/integrations/gemini.ts
@@ -139,6 +142,21 @@ var createClient = (options) => {
139
142
  };
140
143
  return new import_genai.GoogleGenAI(finalOptions);
141
144
  };
145
+ var checkCredentials = async (client) => {
146
+ try {
147
+ await client.models.list();
148
+ } catch (error) {
149
+ throw new Error(
150
+ "Could not verify the Gemini API key. The key may be invalid/unauthorized (check the key and that the Gemini API is enabled for its project/region), or the request to Gemini failed (e.g. network connectivity). See the cause for details.",
151
+ { cause: error }
152
+ );
153
+ }
154
+ };
155
+ var createClientAndValidate = async (options) => {
156
+ const client = createClient(options);
157
+ await checkCredentials(client);
158
+ return client;
159
+ };
142
160
  var geminiOutputAudioSettings = {
143
161
  encoding: "pcm16",
144
162
  channels: 1,
@@ -151,7 +169,9 @@ var geminiInputAudioSettings = {
151
169
  var inputMimeType = "audio/pcm;rate=16000";
152
170
  // Annotate the CommonJS export names for ESM import in node:
153
171
  0 && (module.exports = {
172
+ checkCredentials,
154
173
  createClient,
174
+ createClientAndValidate,
155
175
  geminiInputAudioSettings,
156
176
  geminiOutputAudioSettings,
157
177
  inputMimeType
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  package_default
3
- } from "../chunk-GTNIELH6.mjs";
3
+ } from "../chunk-ZKMES6M4.mjs";
4
4
 
5
5
  // src/integrations/gemini.ts
6
6
  import { GoogleGenAI } from "@google/genai";
@@ -19,6 +19,21 @@ var createClient = (options) => {
19
19
  };
20
20
  return new GoogleGenAI(finalOptions);
21
21
  };
22
+ var checkCredentials = async (client) => {
23
+ try {
24
+ await client.models.list();
25
+ } catch (error) {
26
+ throw new Error(
27
+ "Could not verify the Gemini API key. The key may be invalid/unauthorized (check the key and that the Gemini API is enabled for its project/region), or the request to Gemini failed (e.g. network connectivity). See the cause for details.",
28
+ { cause: error }
29
+ );
30
+ }
31
+ };
32
+ var createClientAndValidate = async (options) => {
33
+ const client = createClient(options);
34
+ await checkCredentials(client);
35
+ return client;
36
+ };
22
37
  var geminiOutputAudioSettings = {
23
38
  encoding: "pcm16",
24
39
  channels: 1,
@@ -30,7 +45,9 @@ var geminiInputAudioSettings = {
30
45
  };
31
46
  var inputMimeType = "audio/pcm;rate=16000";
32
47
  export {
48
+ checkCredentials,
33
49
  createClient,
50
+ createClientAndValidate,
34
51
  geminiInputAudioSettings,
35
52
  geminiOutputAudioSettings,
36
53
  inputMimeType
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fishjam-cloud/js-server-sdk",
3
- "version": "0.28.1",
3
+ "version": "0.29.0-rc.2",
4
4
  "description": "Fishjam server SDK for JavaScript",
5
5
  "homepage": "https://github.com/fishjam-cloud/js-server-sdk",
6
6
  "author": "Fishjam Team",
@@ -74,8 +74,8 @@
74
74
  }
75
75
  },
76
76
  "devDependencies": {
77
- "@fishjam-cloud/fishjam-openapi": "0.28.1",
78
- "@fishjam-cloud/fishjam-proto": "0.28.1",
77
+ "@fishjam-cloud/fishjam-openapi": "0.29.0-rc.2",
78
+ "@fishjam-cloud/fishjam-proto": "0.29.0-rc.2",
79
79
  "@openapitools/openapi-generator-cli": "^2.18.4",
80
80
  "@types/node": "^22.13.16",
81
81
  "@types/websocket": "^1.0.10",
@@ -89,5 +89,6 @@
89
89
  "*.{js,ts,tsx,mjs,cjs}": [
90
90
  "eslint --fix --config eslint.config.mjs"
91
91
  ]
92
- }
92
+ },
93
+ "stableVersion": "0.28.1"
93
94
  }