@fishjam-cloud/js-server-sdk 0.24.0 → 0.25.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,123 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
+ }) : x)(function(x) {
10
+ if (typeof require !== "undefined") return require.apply(this, arguments);
11
+ throw Error('Dynamic require of "' + x + '" is not supported');
12
+ });
13
+ var __commonJS = (cb, mod) => function __require2() {
14
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
15
+ };
16
+ var __copyProps = (to, from, except, desc) => {
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from))
19
+ if (!__hasOwnProp.call(to, key) && key !== except)
20
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
21
+ }
22
+ return to;
23
+ };
24
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
+ // If the importer is in node compatibility mode or this is not an ESM
26
+ // file that has been converted to a CommonJS file using a Babel-
27
+ // compatible transform (i.e. "__esModule" has not been set), then set
28
+ // "default" to the CommonJS "module.exports" for node compatibility.
29
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
30
+ mod
31
+ ));
32
+
33
+ // package.json
34
+ var package_default = {
35
+ name: "@fishjam-cloud/js-server-sdk",
36
+ version: "0.25.1",
37
+ description: "Fishjam server SDK for JavaScript",
38
+ homepage: "https://github.com/fishjam-cloud/js-server-sdk",
39
+ author: "Fishjam Team",
40
+ repository: {
41
+ type: "git",
42
+ url: "https://github.com/fishjam-cloud/js-server-sdk.git"
43
+ },
44
+ bugs: {
45
+ url: "https://github.com/fishjam-cloud/js-server-sdk/issues"
46
+ },
47
+ license: "Apache-2.0",
48
+ keywords: [
49
+ "webrtc",
50
+ "fishjam",
51
+ "server",
52
+ "membrane"
53
+ ],
54
+ main: "./dist/index.js",
55
+ types: "./dist/index.d.ts",
56
+ files: [
57
+ "dist"
58
+ ],
59
+ exports: {
60
+ ".": "./dist/index.js",
61
+ "./gemini": "./dist/integrations/gemini.js"
62
+ },
63
+ scripts: {
64
+ build: "tsup --dts-resolve",
65
+ format: "prettier --write .",
66
+ "format:check": "prettier --check .",
67
+ typecheck: "tsc --noEmit",
68
+ lint: "eslint . --fix",
69
+ "lint:check": "eslint . "
70
+ },
71
+ tsup: {
72
+ entry: [
73
+ "src/index.ts",
74
+ "src/integrations/gemini.ts",
75
+ "src/proto.ts"
76
+ ],
77
+ noExternal: [
78
+ "fishjam-openapi",
79
+ "fishjam-proto"
80
+ ],
81
+ minify: false,
82
+ format: [
83
+ "cjs",
84
+ "esm"
85
+ ],
86
+ outDir: "dist"
87
+ },
88
+ dependencies: {
89
+ axios: "^1.7.9",
90
+ uuid: "^11.1.0"
91
+ },
92
+ peerDependencies: {
93
+ "@google/genai": "^1.0.0"
94
+ },
95
+ peerDependenciesMeta: {
96
+ "@google/genai": {
97
+ optional: true
98
+ }
99
+ },
100
+ devDependencies: {
101
+ "@fishjam-cloud/fishjam-openapi": "workspace:*",
102
+ "@fishjam-cloud/fishjam-proto": "workspace:*",
103
+ "@openapitools/openapi-generator-cli": "^2.18.4",
104
+ "@types/node": "^22.13.16",
105
+ "@types/websocket": "^1.0.10",
106
+ eslint: "^9.33.0",
107
+ prettier: "^3.6.2",
108
+ tsup: "^8.4.0",
109
+ "typed-emitter": "^2.1.0"
110
+ },
111
+ "lint-staged": {
112
+ "*.{js,ts,tsx,mjs,cjs}": [
113
+ "eslint --fix --config packages/js-server-sdk/eslint.config.mjs"
114
+ ]
115
+ }
116
+ };
117
+
118
+ export {
119
+ __require,
120
+ __commonJS,
121
+ __toESM,
122
+ package_default
123
+ };
package/dist/index.d.mts CHANGED
@@ -381,6 +381,8 @@ interface ServerMessage {
381
381
  viewerDisconnected?: ServerMessage_ViewerDisconnected | undefined;
382
382
  streamerConnected?: ServerMessage_StreamerConnected | undefined;
383
383
  streamerDisconnected?: ServerMessage_StreamerDisconnected | undefined;
384
+ channelAdded?: ServerMessage_ChannelAdded | undefined;
385
+ channelRemoved?: ServerMessage_ChannelRemoved | undefined;
384
386
  }
385
387
  declare const ServerMessage: MessageFns$1<ServerMessage>;
386
388
  /** Notification sent when a room crashes */
@@ -439,7 +441,7 @@ interface ServerMessage_AuthRequest {
439
441
  token: string;
440
442
  }
441
443
  declare const ServerMessage_AuthRequest: MessageFns$1<ServerMessage_AuthRequest>;
442
- /** Request sent by peer to subsribe for certain message type */
444
+ /** Request sent by peer to subscribe for certain message type */
443
445
  interface ServerMessage_SubscribeRequest {
444
446
  eventType: ServerMessage_EventType;
445
447
  }
@@ -465,7 +467,7 @@ interface ServerMessage_HlsPlayable {
465
467
  componentId: string;
466
468
  }
467
469
  declare const ServerMessage_HlsPlayable: MessageFns$1<ServerMessage_HlsPlayable>;
468
- /** Notification sent when the HLS recording is successfully uploded to AWS S3 */
470
+ /** Notification sent when the HLS recording is successfully uploaded to AWS S3 */
469
471
  interface ServerMessage_HlsUploaded {
470
472
  roomId: string;
471
473
  }
@@ -507,6 +509,22 @@ interface ServerMessage_TrackMetadataUpdated {
507
509
  track: Track | undefined;
508
510
  }
509
511
  declare const ServerMessage_TrackMetadataUpdated: MessageFns$1<ServerMessage_TrackMetadataUpdated>;
512
+ /** Notification sent when a peer creates a channel */
513
+ interface ServerMessage_ChannelAdded {
514
+ roomId: string;
515
+ peerId?: string | undefined;
516
+ componentId?: string | undefined;
517
+ channelId: string;
518
+ }
519
+ declare const ServerMessage_ChannelAdded: MessageFns$1<ServerMessage_ChannelAdded>;
520
+ /** Notification sent when a peer deletes a channel */
521
+ interface ServerMessage_ChannelRemoved {
522
+ roomId: string;
523
+ peerId?: string | undefined;
524
+ componentId?: string | undefined;
525
+ channelId: string;
526
+ }
527
+ declare const ServerMessage_ChannelRemoved: MessageFns$1<ServerMessage_ChannelRemoved>;
510
528
  /** Notification sent when streamer successfully connects */
511
529
  interface ServerMessage_StreamConnected {
512
530
  streamId: string;
@@ -567,6 +585,7 @@ declare const AgentRequest_TrackData: MessageFns<AgentRequest_TrackData>;
567
585
  interface AgentResponse {
568
586
  authenticated?: AgentResponse_Authenticated | undefined;
569
587
  trackData?: AgentResponse_TrackData | undefined;
588
+ trackImage?: AgentResponse_TrackImage | undefined;
570
589
  }
571
590
  declare const AgentResponse: MessageFns<AgentResponse>;
572
591
  /** Response confirming successful authentication */
@@ -580,6 +599,12 @@ interface AgentResponse_TrackData {
580
599
  data: Uint8Array;
581
600
  }
582
601
  declare const AgentResponse_TrackData: MessageFns<AgentResponse_TrackData>;
602
+ interface AgentResponse_TrackImage {
603
+ trackId: string;
604
+ contentType: string;
605
+ data: Uint8Array;
606
+ }
607
+ declare const AgentResponse_TrackImage: MessageFns<AgentResponse_TrackImage>;
583
608
  type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
584
609
  type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
585
610
  [K in keyof T]?: DeepPartial<T[K]>;
@@ -734,7 +759,7 @@ declare class FishjamWSNotifier extends FishjamWSNotifier_base {
734
759
  private isExpectedEvent;
735
760
  }
736
761
 
737
- declare const expectedEventsList: readonly ["trackData"];
762
+ declare const expectedEventsList: readonly ["trackData", "trackImage"];
738
763
  /**
739
764
  * @useDeclaredType
740
765
  */
@@ -742,6 +767,7 @@ type ExpectedAgentEvents = (typeof expectedEventsList)[number];
742
767
  type IncomingTrackData = Omit<NonNullable<AgentResponse_TrackData>, 'peerId'> & {
743
768
  peerId: PeerId;
744
769
  };
770
+ type IncomingTrackImage = NonNullable<AgentResponse_TrackImage>;
745
771
  type OutgoingTrackData = Omit<NonNullable<AgentRequest_TrackData>, 'peerId'> & {
746
772
  peerId: PeerId;
747
773
  };
@@ -794,6 +820,10 @@ declare class FishjamAgent extends FishjamAgent_base {
794
820
  * Send audio data for the given track
795
821
  */
796
822
  sendData(trackId: TrackId, data: Uint8Array): void;
823
+ /**
824
+ * Request a captured image from the given track
825
+ */
826
+ captureImage(trackId: TrackId): void;
797
827
  disconnect(): void;
798
828
  private dispatchNotification;
799
829
  private setupConnection;
@@ -810,6 +840,7 @@ declare class FishjamClient {
810
840
  private readonly viewerApi;
811
841
  private readonly streamerApi;
812
842
  private readonly fishjamConfig;
843
+ private deprecationWarningShown;
813
844
  /**
814
845
  * Create new instance of Fishjam Client.
815
846
  *
@@ -822,6 +853,7 @@ declare class FishjamClient {
822
853
  * ```
823
854
  */
824
855
  constructor(config: FishjamConfig);
856
+ private handleDeprecationHeader;
825
857
  /**
826
858
  * Create a new room. All peers connected to the same room will be able to send/receive streams to each other.
827
859
  */
@@ -910,4 +942,4 @@ declare class ServiceUnavailableException extends FishjamBaseException {
910
942
  declare class UnknownException extends FishjamBaseException {
911
943
  }
912
944
 
913
- 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, MissingFishjamIdException, 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 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 };
945
+ 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 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 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 };
package/dist/index.d.ts CHANGED
@@ -381,6 +381,8 @@ interface ServerMessage {
381
381
  viewerDisconnected?: ServerMessage_ViewerDisconnected | undefined;
382
382
  streamerConnected?: ServerMessage_StreamerConnected | undefined;
383
383
  streamerDisconnected?: ServerMessage_StreamerDisconnected | undefined;
384
+ channelAdded?: ServerMessage_ChannelAdded | undefined;
385
+ channelRemoved?: ServerMessage_ChannelRemoved | undefined;
384
386
  }
385
387
  declare const ServerMessage: MessageFns$1<ServerMessage>;
386
388
  /** Notification sent when a room crashes */
@@ -439,7 +441,7 @@ interface ServerMessage_AuthRequest {
439
441
  token: string;
440
442
  }
441
443
  declare const ServerMessage_AuthRequest: MessageFns$1<ServerMessage_AuthRequest>;
442
- /** Request sent by peer to subsribe for certain message type */
444
+ /** Request sent by peer to subscribe for certain message type */
443
445
  interface ServerMessage_SubscribeRequest {
444
446
  eventType: ServerMessage_EventType;
445
447
  }
@@ -465,7 +467,7 @@ interface ServerMessage_HlsPlayable {
465
467
  componentId: string;
466
468
  }
467
469
  declare const ServerMessage_HlsPlayable: MessageFns$1<ServerMessage_HlsPlayable>;
468
- /** Notification sent when the HLS recording is successfully uploded to AWS S3 */
470
+ /** Notification sent when the HLS recording is successfully uploaded to AWS S3 */
469
471
  interface ServerMessage_HlsUploaded {
470
472
  roomId: string;
471
473
  }
@@ -507,6 +509,22 @@ interface ServerMessage_TrackMetadataUpdated {
507
509
  track: Track | undefined;
508
510
  }
509
511
  declare const ServerMessage_TrackMetadataUpdated: MessageFns$1<ServerMessage_TrackMetadataUpdated>;
512
+ /** Notification sent when a peer creates a channel */
513
+ interface ServerMessage_ChannelAdded {
514
+ roomId: string;
515
+ peerId?: string | undefined;
516
+ componentId?: string | undefined;
517
+ channelId: string;
518
+ }
519
+ declare const ServerMessage_ChannelAdded: MessageFns$1<ServerMessage_ChannelAdded>;
520
+ /** Notification sent when a peer deletes a channel */
521
+ interface ServerMessage_ChannelRemoved {
522
+ roomId: string;
523
+ peerId?: string | undefined;
524
+ componentId?: string | undefined;
525
+ channelId: string;
526
+ }
527
+ declare const ServerMessage_ChannelRemoved: MessageFns$1<ServerMessage_ChannelRemoved>;
510
528
  /** Notification sent when streamer successfully connects */
511
529
  interface ServerMessage_StreamConnected {
512
530
  streamId: string;
@@ -567,6 +585,7 @@ declare const AgentRequest_TrackData: MessageFns<AgentRequest_TrackData>;
567
585
  interface AgentResponse {
568
586
  authenticated?: AgentResponse_Authenticated | undefined;
569
587
  trackData?: AgentResponse_TrackData | undefined;
588
+ trackImage?: AgentResponse_TrackImage | undefined;
570
589
  }
571
590
  declare const AgentResponse: MessageFns<AgentResponse>;
572
591
  /** Response confirming successful authentication */
@@ -580,6 +599,12 @@ interface AgentResponse_TrackData {
580
599
  data: Uint8Array;
581
600
  }
582
601
  declare const AgentResponse_TrackData: MessageFns<AgentResponse_TrackData>;
602
+ interface AgentResponse_TrackImage {
603
+ trackId: string;
604
+ contentType: string;
605
+ data: Uint8Array;
606
+ }
607
+ declare const AgentResponse_TrackImage: MessageFns<AgentResponse_TrackImage>;
583
608
  type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
584
609
  type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
585
610
  [K in keyof T]?: DeepPartial<T[K]>;
@@ -734,7 +759,7 @@ declare class FishjamWSNotifier extends FishjamWSNotifier_base {
734
759
  private isExpectedEvent;
735
760
  }
736
761
 
737
- declare const expectedEventsList: readonly ["trackData"];
762
+ declare const expectedEventsList: readonly ["trackData", "trackImage"];
738
763
  /**
739
764
  * @useDeclaredType
740
765
  */
@@ -742,6 +767,7 @@ type ExpectedAgentEvents = (typeof expectedEventsList)[number];
742
767
  type IncomingTrackData = Omit<NonNullable<AgentResponse_TrackData>, 'peerId'> & {
743
768
  peerId: PeerId;
744
769
  };
770
+ type IncomingTrackImage = NonNullable<AgentResponse_TrackImage>;
745
771
  type OutgoingTrackData = Omit<NonNullable<AgentRequest_TrackData>, 'peerId'> & {
746
772
  peerId: PeerId;
747
773
  };
@@ -794,6 +820,10 @@ declare class FishjamAgent extends FishjamAgent_base {
794
820
  * Send audio data for the given track
795
821
  */
796
822
  sendData(trackId: TrackId, data: Uint8Array): void;
823
+ /**
824
+ * Request a captured image from the given track
825
+ */
826
+ captureImage(trackId: TrackId): void;
797
827
  disconnect(): void;
798
828
  private dispatchNotification;
799
829
  private setupConnection;
@@ -810,6 +840,7 @@ declare class FishjamClient {
810
840
  private readonly viewerApi;
811
841
  private readonly streamerApi;
812
842
  private readonly fishjamConfig;
843
+ private deprecationWarningShown;
813
844
  /**
814
845
  * Create new instance of Fishjam Client.
815
846
  *
@@ -822,6 +853,7 @@ declare class FishjamClient {
822
853
  * ```
823
854
  */
824
855
  constructor(config: FishjamConfig);
856
+ private handleDeprecationHeader;
825
857
  /**
826
858
  * Create a new room. All peers connected to the same room will be able to send/receive streams to each other.
827
859
  */
@@ -910,4 +942,4 @@ declare class ServiceUnavailableException extends FishjamBaseException {
910
942
  declare class UnknownException extends FishjamBaseException {
911
943
  }
912
944
 
913
- 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, MissingFishjamIdException, 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 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 };
945
+ 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 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 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 };