@fishjam-cloud/js-server-sdk 0.22.1 → 0.23.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-6DZX6EAA.mjs +37 -0
- package/dist/index.d.mts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +20 -0
- package/dist/index.mjs +50 -56
- package/dist/integrations/gemini.d.mts +39 -0
- package/dist/integrations/gemini.d.ts +39 -0
- package/dist/integrations/gemini.js +154 -0
- package/dist/integrations/gemini.mjs +135 -0
- package/package.json +14 -4
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
export {
|
|
34
|
+
__require,
|
|
35
|
+
__commonJS,
|
|
36
|
+
__toESM
|
|
37
|
+
};
|
package/dist/index.d.mts
CHANGED
|
@@ -737,7 +737,13 @@ type AgentEvents = {
|
|
|
737
737
|
declare const FishjamAgent_base: new () => TypedEventEmitter<AgentEvents>;
|
|
738
738
|
declare class FishjamAgent extends FishjamAgent_base {
|
|
739
739
|
private readonly client;
|
|
740
|
+
private resolveConnectionPromise;
|
|
741
|
+
private readonly connectionPromise;
|
|
740
742
|
constructor(config: FishjamConfig, agentToken: string, callbacks?: AgentCallbacks);
|
|
743
|
+
/**
|
|
744
|
+
* Await Agent connection to Fishjam.
|
|
745
|
+
*/
|
|
746
|
+
awaitConnected(): Promise<void>;
|
|
741
747
|
/**
|
|
742
748
|
* Creates an outgoing audio track for the agent
|
|
743
749
|
* @returns a new audio track
|
|
@@ -876,4 +882,4 @@ declare class ServiceUnavailableException extends FishjamBaseException {
|
|
|
876
882
|
declare class UnknownException extends FishjamBaseException {
|
|
877
883
|
}
|
|
878
884
|
|
|
879
|
-
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, PeerStatus, type Room, type RoomConfig, RoomConfigRoomTypeEnum, RoomConfigVideoCodecEnum, type RoomCrashed, type RoomCreated, type RoomDeleted, type RoomId, RoomNotFoundException, ServerMessage, ServiceUnavailableException, type StreamConnected, type StreamDisconnected, type StreamerToken, type TrackAdded, type TrackId, type TrackMetadataUpdated, type TrackRemoved, type TrackType, UnauthorizedException, UnknownException, type ViewerConnected, type ViewerDisconnected, type ViewerToken };
|
|
885
|
+
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, RoomConfigRoomTypeEnum, RoomConfigVideoCodecEnum, type RoomCrashed, type RoomCreated, type RoomDeleted, type RoomId, RoomNotFoundException, ServerMessage, ServiceUnavailableException, type StreamConnected, type StreamDisconnected, type StreamerToken, type TrackAdded, type TrackId, type TrackMetadataUpdated, type TrackRemoved, type TrackType, UnauthorizedException, UnknownException, type ViewerConnected, type ViewerDisconnected, type ViewerToken };
|
package/dist/index.d.ts
CHANGED
|
@@ -737,7 +737,13 @@ type AgentEvents = {
|
|
|
737
737
|
declare const FishjamAgent_base: new () => TypedEventEmitter<AgentEvents>;
|
|
738
738
|
declare class FishjamAgent extends FishjamAgent_base {
|
|
739
739
|
private readonly client;
|
|
740
|
+
private resolveConnectionPromise;
|
|
741
|
+
private readonly connectionPromise;
|
|
740
742
|
constructor(config: FishjamConfig, agentToken: string, callbacks?: AgentCallbacks);
|
|
743
|
+
/**
|
|
744
|
+
* Await Agent connection to Fishjam.
|
|
745
|
+
*/
|
|
746
|
+
awaitConnected(): Promise<void>;
|
|
741
747
|
/**
|
|
742
748
|
* Creates an outgoing audio track for the agent
|
|
743
749
|
* @returns a new audio track
|
|
@@ -876,4 +882,4 @@ declare class ServiceUnavailableException extends FishjamBaseException {
|
|
|
876
882
|
declare class UnknownException extends FishjamBaseException {
|
|
877
883
|
}
|
|
878
884
|
|
|
879
|
-
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, PeerStatus, type Room, type RoomConfig, RoomConfigRoomTypeEnum, RoomConfigVideoCodecEnum, type RoomCrashed, type RoomCreated, type RoomDeleted, type RoomId, RoomNotFoundException, ServerMessage, ServiceUnavailableException, type StreamConnected, type StreamDisconnected, type StreamerToken, type TrackAdded, type TrackId, type TrackMetadataUpdated, type TrackRemoved, type TrackType, UnauthorizedException, UnknownException, type ViewerConnected, type ViewerDisconnected, type ViewerToken };
|
|
885
|
+
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, RoomConfigRoomTypeEnum, RoomConfigVideoCodecEnum, type RoomCrashed, type RoomCreated, type RoomDeleted, type RoomId, RoomNotFoundException, ServerMessage, ServiceUnavailableException, type StreamConnected, type StreamDisconnected, type StreamerToken, type TrackAdded, type TrackId, type TrackMetadataUpdated, type TrackRemoved, type TrackType, UnauthorizedException, UnknownException, type ViewerConnected, type ViewerDisconnected, type ViewerToken };
|
package/dist/index.js
CHANGED
|
@@ -19424,6 +19424,8 @@ __export(index_exports, {
|
|
|
19424
19424
|
MissingFishjamIdException: () => MissingFishjamIdException,
|
|
19425
19425
|
PeerNotFoundException: () => PeerNotFoundException,
|
|
19426
19426
|
PeerOptions: () => import_fishjam_openapi2.PeerOptions,
|
|
19427
|
+
PeerOptionsAgent: () => import_fishjam_openapi2.PeerOptionsAgent,
|
|
19428
|
+
PeerOptionsWebRTC: () => import_fishjam_openapi2.PeerOptionsWebRTC,
|
|
19427
19429
|
PeerStatus: () => import_fishjam_openapi2.PeerStatus,
|
|
19428
19430
|
RoomConfig: () => import_fishjam_openapi2.RoomConfig,
|
|
19429
19431
|
RoomConfigRoomTypeEnum: () => import_fishjam_openapi2.RoomConfigRoomTypeEnum,
|
|
@@ -19556,6 +19558,8 @@ var import_fishjam_proto2 = __toESM(require_dist2());
|
|
|
19556
19558
|
var expectedEventsList2 = ["trackData"];
|
|
19557
19559
|
var FishjamAgent = class extends import_events2.EventEmitter {
|
|
19558
19560
|
client;
|
|
19561
|
+
resolveConnectionPromise = null;
|
|
19562
|
+
connectionPromise;
|
|
19559
19563
|
constructor(config, agentToken, callbacks) {
|
|
19560
19564
|
super();
|
|
19561
19565
|
const fishjamUrl = getFishjamUrl(config);
|
|
@@ -19566,6 +19570,15 @@ var FishjamAgent = class extends import_events2.EventEmitter {
|
|
|
19566
19570
|
this.client.onerror = (message) => callbacks?.onError?.(message);
|
|
19567
19571
|
this.client.onmessage = (message) => this.dispatchNotification(message);
|
|
19568
19572
|
this.client.onopen = () => this.setupConnection(agentToken);
|
|
19573
|
+
this.connectionPromise = new Promise((resolve) => {
|
|
19574
|
+
this.resolveConnectionPromise = resolve;
|
|
19575
|
+
});
|
|
19576
|
+
}
|
|
19577
|
+
/**
|
|
19578
|
+
* Await Agent connection to Fishjam.
|
|
19579
|
+
*/
|
|
19580
|
+
async awaitConnected() {
|
|
19581
|
+
return this.connectionPromise;
|
|
19569
19582
|
}
|
|
19570
19583
|
/**
|
|
19571
19584
|
* Creates an outgoing audio track for the agent
|
|
@@ -19625,6 +19638,10 @@ var FishjamAgent = class extends import_events2.EventEmitter {
|
|
|
19625
19638
|
setupConnection(agentToken) {
|
|
19626
19639
|
const auth = import_fishjam_proto2.AgentRequest.encode({ authRequest: { token: agentToken } }).finish();
|
|
19627
19640
|
this.client.send(auth);
|
|
19641
|
+
if (this.resolveConnectionPromise) {
|
|
19642
|
+
this.resolveConnectionPromise();
|
|
19643
|
+
this.resolveConnectionPromise = null;
|
|
19644
|
+
}
|
|
19628
19645
|
}
|
|
19629
19646
|
isExpectedEvent(notification) {
|
|
19630
19647
|
return expectedEventsList2.includes(notification);
|
|
@@ -19765,6 +19782,7 @@ var FishjamClient = class {
|
|
|
19765
19782
|
data: { data }
|
|
19766
19783
|
} = response;
|
|
19767
19784
|
const agent = new FishjamAgent(this.fishjamConfig, data.token, callbacks);
|
|
19785
|
+
await agent.awaitConnected();
|
|
19768
19786
|
return { agent, peer: data.peer };
|
|
19769
19787
|
} catch (error) {
|
|
19770
19788
|
throw mapException(error);
|
|
@@ -19863,6 +19881,8 @@ var FishjamClient = class {
|
|
|
19863
19881
|
MissingFishjamIdException,
|
|
19864
19882
|
PeerNotFoundException,
|
|
19865
19883
|
PeerOptions,
|
|
19884
|
+
PeerOptionsAgent,
|
|
19885
|
+
PeerOptionsWebRTC,
|
|
19866
19886
|
PeerStatus,
|
|
19867
19887
|
RoomConfig,
|
|
19868
19888
|
RoomConfigRoomTypeEnum,
|
package/dist/index.mjs
CHANGED
|
@@ -1,69 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
));
|
|
1
|
+
import {
|
|
2
|
+
__commonJS,
|
|
3
|
+
__require,
|
|
4
|
+
__toESM
|
|
5
|
+
} from "./chunk-6DZX6EAA.mjs";
|
|
32
6
|
|
|
33
7
|
// ../fishjam-openapi/dist/index.js
|
|
34
8
|
var require_dist = __commonJS({
|
|
35
9
|
"../fishjam-openapi/dist/index.js"(exports, module) {
|
|
36
10
|
"use strict";
|
|
37
|
-
var
|
|
38
|
-
var
|
|
39
|
-
var
|
|
40
|
-
var
|
|
41
|
-
var
|
|
42
|
-
var
|
|
11
|
+
var __create = Object.create;
|
|
12
|
+
var __defProp = Object.defineProperty;
|
|
13
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
14
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
15
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
16
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
43
17
|
var __commonJS2 = (cb, mod) => function __require2() {
|
|
44
|
-
return mod || (0, cb[
|
|
18
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
45
19
|
};
|
|
46
20
|
var __export = (target, all3) => {
|
|
47
21
|
for (var name in all3)
|
|
48
|
-
|
|
22
|
+
__defProp(target, name, { get: all3[name], enumerable: true });
|
|
49
23
|
};
|
|
50
|
-
var
|
|
24
|
+
var __copyProps = (to, from, except, desc) => {
|
|
51
25
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
52
|
-
for (let key of
|
|
53
|
-
if (!
|
|
54
|
-
|
|
26
|
+
for (let key of __getOwnPropNames(from))
|
|
27
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
28
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
55
29
|
}
|
|
56
30
|
return to;
|
|
57
31
|
};
|
|
58
|
-
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ?
|
|
32
|
+
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
59
33
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
60
34
|
// file that has been converted to a CommonJS file using a Babel-
|
|
61
35
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
62
36
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
63
|
-
isNodeMode || !mod || !mod.__esModule ?
|
|
37
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
64
38
|
mod
|
|
65
39
|
));
|
|
66
|
-
var __toCommonJS = (mod) =>
|
|
40
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
67
41
|
var require_delayed_stream = __commonJS2({
|
|
68
42
|
"../../node_modules/delayed-stream/lib/delayed_stream.js"(exports2, module2) {
|
|
69
43
|
"use strict";
|
|
@@ -15459,23 +15433,23 @@ var require_dist = __commonJS({
|
|
|
15459
15433
|
var require_dist2 = __commonJS({
|
|
15460
15434
|
"../fishjam-proto/dist/index.js"(exports, module) {
|
|
15461
15435
|
"use strict";
|
|
15462
|
-
var
|
|
15463
|
-
var
|
|
15464
|
-
var
|
|
15465
|
-
var
|
|
15436
|
+
var __defProp = Object.defineProperty;
|
|
15437
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
15438
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
15439
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
15466
15440
|
var __export = (target, all) => {
|
|
15467
15441
|
for (var name in all)
|
|
15468
|
-
|
|
15442
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
15469
15443
|
};
|
|
15470
|
-
var
|
|
15444
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15471
15445
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
15472
|
-
for (let key of
|
|
15473
|
-
if (!
|
|
15474
|
-
|
|
15446
|
+
for (let key of __getOwnPropNames(from))
|
|
15447
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15448
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15475
15449
|
}
|
|
15476
15450
|
return to;
|
|
15477
15451
|
};
|
|
15478
|
-
var __toCommonJS = (mod) =>
|
|
15452
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15479
15453
|
var index_exports = {};
|
|
15480
15454
|
__export(index_exports, {
|
|
15481
15455
|
AgentRequest: () => AgentRequest2,
|
|
@@ -19531,6 +19505,8 @@ import { v4 as uuid4 } from "uuid";
|
|
|
19531
19505
|
var expectedEventsList2 = ["trackData"];
|
|
19532
19506
|
var FishjamAgent = class extends EventEmitter2 {
|
|
19533
19507
|
client;
|
|
19508
|
+
resolveConnectionPromise = null;
|
|
19509
|
+
connectionPromise;
|
|
19534
19510
|
constructor(config, agentToken, callbacks) {
|
|
19535
19511
|
super();
|
|
19536
19512
|
const fishjamUrl = getFishjamUrl(config);
|
|
@@ -19541,6 +19517,15 @@ var FishjamAgent = class extends EventEmitter2 {
|
|
|
19541
19517
|
this.client.onerror = (message) => callbacks?.onError?.(message);
|
|
19542
19518
|
this.client.onmessage = (message) => this.dispatchNotification(message);
|
|
19543
19519
|
this.client.onopen = () => this.setupConnection(agentToken);
|
|
19520
|
+
this.connectionPromise = new Promise((resolve) => {
|
|
19521
|
+
this.resolveConnectionPromise = resolve;
|
|
19522
|
+
});
|
|
19523
|
+
}
|
|
19524
|
+
/**
|
|
19525
|
+
* Await Agent connection to Fishjam.
|
|
19526
|
+
*/
|
|
19527
|
+
async awaitConnected() {
|
|
19528
|
+
return this.connectionPromise;
|
|
19544
19529
|
}
|
|
19545
19530
|
/**
|
|
19546
19531
|
* Creates an outgoing audio track for the agent
|
|
@@ -19600,6 +19585,10 @@ var FishjamAgent = class extends EventEmitter2 {
|
|
|
19600
19585
|
setupConnection(agentToken) {
|
|
19601
19586
|
const auth = import_fishjam_proto2.AgentRequest.encode({ authRequest: { token: agentToken } }).finish();
|
|
19602
19587
|
this.client.send(auth);
|
|
19588
|
+
if (this.resolveConnectionPromise) {
|
|
19589
|
+
this.resolveConnectionPromise();
|
|
19590
|
+
this.resolveConnectionPromise = null;
|
|
19591
|
+
}
|
|
19603
19592
|
}
|
|
19604
19593
|
isExpectedEvent(notification) {
|
|
19605
19594
|
return expectedEventsList2.includes(notification);
|
|
@@ -19740,6 +19729,7 @@ var FishjamClient = class {
|
|
|
19740
19729
|
data: { data }
|
|
19741
19730
|
} = response;
|
|
19742
19731
|
const agent = new FishjamAgent(this.fishjamConfig, data.token, callbacks);
|
|
19732
|
+
await agent.awaitConnected();
|
|
19743
19733
|
return { agent, peer: data.peer };
|
|
19744
19734
|
} catch (error) {
|
|
19745
19735
|
throw mapException(error);
|
|
@@ -19827,6 +19817,8 @@ var FishjamClient = class {
|
|
|
19827
19817
|
}
|
|
19828
19818
|
};
|
|
19829
19819
|
var export_PeerOptions = import_fishjam_openapi2.PeerOptions;
|
|
19820
|
+
var export_PeerOptionsAgent = import_fishjam_openapi2.PeerOptionsAgent;
|
|
19821
|
+
var export_PeerOptionsWebRTC = import_fishjam_openapi2.PeerOptionsWebRTC;
|
|
19830
19822
|
var export_PeerStatus = import_fishjam_openapi2.PeerStatus;
|
|
19831
19823
|
var export_RoomConfig = import_fishjam_openapi2.RoomConfig;
|
|
19832
19824
|
var export_RoomConfigRoomTypeEnum = import_fishjam_openapi2.RoomConfigRoomTypeEnum;
|
|
@@ -19845,6 +19837,8 @@ export {
|
|
|
19845
19837
|
MissingFishjamIdException,
|
|
19846
19838
|
PeerNotFoundException,
|
|
19847
19839
|
export_PeerOptions as PeerOptions,
|
|
19840
|
+
export_PeerOptionsAgent as PeerOptionsAgent,
|
|
19841
|
+
export_PeerOptionsWebRTC as PeerOptionsWebRTC,
|
|
19848
19842
|
export_PeerStatus as PeerStatus,
|
|
19849
19843
|
export_RoomConfig as RoomConfig,
|
|
19850
19844
|
export_RoomConfigRoomTypeEnum as RoomConfigRoomTypeEnum,
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { GoogleGenAIOptions, GoogleGenAI } from '@google/genai';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A collection of settings for Google Gemini integration.
|
|
5
|
+
*/
|
|
6
|
+
declare const _default: {
|
|
7
|
+
/**
|
|
8
|
+
* Creates a GoogleGenAI client.
|
|
9
|
+
* This function dynamically imports the "@google/genai" module,
|
|
10
|
+
* so it will only be loaded when this function is called.
|
|
11
|
+
*
|
|
12
|
+
* @param options Configuration for the GoogleGenAI client.
|
|
13
|
+
* @returns A GoogleGenAI instance.
|
|
14
|
+
*/
|
|
15
|
+
createClient: (options: GoogleGenAIOptions) => GoogleGenAI;
|
|
16
|
+
/**
|
|
17
|
+
* Predefined audio settings for the agent's output track,
|
|
18
|
+
* configured for Gemini's 24kHz audio output.
|
|
19
|
+
*/
|
|
20
|
+
geminiOutputAudioSettings: {
|
|
21
|
+
readonly encoding: "pcm16";
|
|
22
|
+
readonly channels: 1;
|
|
23
|
+
readonly sampleRate: 24000;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Predefined audio settings for subscribing to room audio,
|
|
27
|
+
* configured for Gemini's 16kHz audio input.
|
|
28
|
+
*/
|
|
29
|
+
geminiInputAudioSettings: {
|
|
30
|
+
readonly audioFormat: "pcm16";
|
|
31
|
+
readonly audioSampleRate: 16000;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* The MIME type for the audio data sent to Gemini.
|
|
35
|
+
*/
|
|
36
|
+
inputMimeType: "audio/pcm;rate=16000";
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export { _default as default };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { GoogleGenAIOptions, GoogleGenAI } from '@google/genai';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A collection of settings for Google Gemini integration.
|
|
5
|
+
*/
|
|
6
|
+
declare const _default: {
|
|
7
|
+
/**
|
|
8
|
+
* Creates a GoogleGenAI client.
|
|
9
|
+
* This function dynamically imports the "@google/genai" module,
|
|
10
|
+
* so it will only be loaded when this function is called.
|
|
11
|
+
*
|
|
12
|
+
* @param options Configuration for the GoogleGenAI client.
|
|
13
|
+
* @returns A GoogleGenAI instance.
|
|
14
|
+
*/
|
|
15
|
+
createClient: (options: GoogleGenAIOptions) => GoogleGenAI;
|
|
16
|
+
/**
|
|
17
|
+
* Predefined audio settings for the agent's output track,
|
|
18
|
+
* configured for Gemini's 24kHz audio output.
|
|
19
|
+
*/
|
|
20
|
+
geminiOutputAudioSettings: {
|
|
21
|
+
readonly encoding: "pcm16";
|
|
22
|
+
readonly channels: 1;
|
|
23
|
+
readonly sampleRate: 24000;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Predefined audio settings for subscribing to room audio,
|
|
27
|
+
* configured for Gemini's 16kHz audio input.
|
|
28
|
+
*/
|
|
29
|
+
geminiInputAudioSettings: {
|
|
30
|
+
readonly audioFormat: "pcm16";
|
|
31
|
+
readonly audioSampleRate: 16000;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* The MIME type for the audio data sent to Gemini.
|
|
35
|
+
*/
|
|
36
|
+
inputMimeType: "audio/pcm;rate=16000";
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export { _default as default };
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/integrations/gemini.ts
|
|
21
|
+
var gemini_exports = {};
|
|
22
|
+
__export(gemini_exports, {
|
|
23
|
+
default: () => gemini_default
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(gemini_exports);
|
|
26
|
+
|
|
27
|
+
// package.json
|
|
28
|
+
var package_default = {
|
|
29
|
+
name: "@fishjam-cloud/js-server-sdk",
|
|
30
|
+
version: "0.23.0",
|
|
31
|
+
description: "Fishjam server SDK for JavaScript",
|
|
32
|
+
homepage: "https://github.com/fishjam-cloud/js-server-sdk",
|
|
33
|
+
author: "Fishjam Team",
|
|
34
|
+
repository: {
|
|
35
|
+
type: "git",
|
|
36
|
+
url: "https://github.com/fishjam-cloud/js-server-sdk.git"
|
|
37
|
+
},
|
|
38
|
+
bugs: {
|
|
39
|
+
url: "https://github.com/fishjam-cloud/js-server-sdk/issues"
|
|
40
|
+
},
|
|
41
|
+
license: "Apache-2.0",
|
|
42
|
+
keywords: [
|
|
43
|
+
"webrtc",
|
|
44
|
+
"fishjam",
|
|
45
|
+
"server",
|
|
46
|
+
"membrane"
|
|
47
|
+
],
|
|
48
|
+
main: "./dist/index.js",
|
|
49
|
+
types: "./dist/index.d.ts",
|
|
50
|
+
files: [
|
|
51
|
+
"dist"
|
|
52
|
+
],
|
|
53
|
+
exports: {
|
|
54
|
+
".": "./dist/index.js",
|
|
55
|
+
"./gemini": "./dist/integrations/gemini.js"
|
|
56
|
+
},
|
|
57
|
+
scripts: {
|
|
58
|
+
build: "tsup --dts-resolve",
|
|
59
|
+
format: "prettier --write .",
|
|
60
|
+
"format:check": "prettier --check .",
|
|
61
|
+
typecheck: "tsc --noEmit",
|
|
62
|
+
lint: "eslint . --fix",
|
|
63
|
+
"lint:check": "eslint . "
|
|
64
|
+
},
|
|
65
|
+
tsup: {
|
|
66
|
+
entry: [
|
|
67
|
+
"src/index.ts",
|
|
68
|
+
"src/integrations/gemini.ts",
|
|
69
|
+
"src/proto.ts"
|
|
70
|
+
],
|
|
71
|
+
noExternal: [
|
|
72
|
+
"fishjam-openapi",
|
|
73
|
+
"fishjam-proto"
|
|
74
|
+
],
|
|
75
|
+
minify: false,
|
|
76
|
+
format: [
|
|
77
|
+
"cjs",
|
|
78
|
+
"esm"
|
|
79
|
+
],
|
|
80
|
+
outDir: "dist"
|
|
81
|
+
},
|
|
82
|
+
dependencies: {
|
|
83
|
+
axios: "^1.7.9",
|
|
84
|
+
uuid: "^11.1.0"
|
|
85
|
+
},
|
|
86
|
+
peerDependencies: {
|
|
87
|
+
"@google/genai": "^1.0.0"
|
|
88
|
+
},
|
|
89
|
+
peerDependenciesMeta: {
|
|
90
|
+
"@google/genai": {
|
|
91
|
+
optional: true
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
devDependencies: {
|
|
95
|
+
"@fishjam-cloud/fishjam-openapi": "workspace:*",
|
|
96
|
+
"@fishjam-cloud/fishjam-proto": "workspace:*",
|
|
97
|
+
"@openapitools/openapi-generator-cli": "^2.18.4",
|
|
98
|
+
"@types/node": "^22.13.16",
|
|
99
|
+
"@types/websocket": "^1.0.10",
|
|
100
|
+
eslint: "^9.33.0",
|
|
101
|
+
prettier: "^3.6.2",
|
|
102
|
+
tsup: "^8.4.0",
|
|
103
|
+
"typed-emitter": "^2.1.0"
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
// src/integrations/gemini.ts
|
|
108
|
+
var SDK_NAME = "fishjam-js-server-sdk";
|
|
109
|
+
var gemini_default = {
|
|
110
|
+
/**
|
|
111
|
+
* Creates a GoogleGenAI client.
|
|
112
|
+
* This function dynamically imports the "@google/genai" module,
|
|
113
|
+
* so it will only be loaded when this function is called.
|
|
114
|
+
*
|
|
115
|
+
* @param options Configuration for the GoogleGenAI client.
|
|
116
|
+
* @returns A GoogleGenAI instance.
|
|
117
|
+
*/
|
|
118
|
+
createClient: (options) => {
|
|
119
|
+
const { GoogleGenAI } = require("@google/genai");
|
|
120
|
+
const trackingHeader = { "X-Goog-Api-Client": `${SDK_NAME}/${package_default.version}` };
|
|
121
|
+
const finalOptions = {
|
|
122
|
+
...options,
|
|
123
|
+
httpOptions: {
|
|
124
|
+
...options.httpOptions,
|
|
125
|
+
headers: {
|
|
126
|
+
...options.httpOptions?.headers,
|
|
127
|
+
...trackingHeader
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
return new GoogleGenAI(finalOptions);
|
|
132
|
+
},
|
|
133
|
+
/**
|
|
134
|
+
* Predefined audio settings for the agent's output track,
|
|
135
|
+
* configured for Gemini's 24kHz audio output.
|
|
136
|
+
*/
|
|
137
|
+
geminiOutputAudioSettings: {
|
|
138
|
+
encoding: "pcm16",
|
|
139
|
+
channels: 1,
|
|
140
|
+
sampleRate: 24e3
|
|
141
|
+
},
|
|
142
|
+
/**
|
|
143
|
+
* Predefined audio settings for subscribing to room audio,
|
|
144
|
+
* configured for Gemini's 16kHz audio input.
|
|
145
|
+
*/
|
|
146
|
+
geminiInputAudioSettings: {
|
|
147
|
+
audioFormat: "pcm16",
|
|
148
|
+
audioSampleRate: 16e3
|
|
149
|
+
},
|
|
150
|
+
/**
|
|
151
|
+
* The MIME type for the audio data sent to Gemini.
|
|
152
|
+
*/
|
|
153
|
+
inputMimeType: "audio/pcm;rate=16000"
|
|
154
|
+
};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__require
|
|
3
|
+
} from "../chunk-6DZX6EAA.mjs";
|
|
4
|
+
|
|
5
|
+
// package.json
|
|
6
|
+
var package_default = {
|
|
7
|
+
name: "@fishjam-cloud/js-server-sdk",
|
|
8
|
+
version: "0.23.0",
|
|
9
|
+
description: "Fishjam server SDK for JavaScript",
|
|
10
|
+
homepage: "https://github.com/fishjam-cloud/js-server-sdk",
|
|
11
|
+
author: "Fishjam Team",
|
|
12
|
+
repository: {
|
|
13
|
+
type: "git",
|
|
14
|
+
url: "https://github.com/fishjam-cloud/js-server-sdk.git"
|
|
15
|
+
},
|
|
16
|
+
bugs: {
|
|
17
|
+
url: "https://github.com/fishjam-cloud/js-server-sdk/issues"
|
|
18
|
+
},
|
|
19
|
+
license: "Apache-2.0",
|
|
20
|
+
keywords: [
|
|
21
|
+
"webrtc",
|
|
22
|
+
"fishjam",
|
|
23
|
+
"server",
|
|
24
|
+
"membrane"
|
|
25
|
+
],
|
|
26
|
+
main: "./dist/index.js",
|
|
27
|
+
types: "./dist/index.d.ts",
|
|
28
|
+
files: [
|
|
29
|
+
"dist"
|
|
30
|
+
],
|
|
31
|
+
exports: {
|
|
32
|
+
".": "./dist/index.js",
|
|
33
|
+
"./gemini": "./dist/integrations/gemini.js"
|
|
34
|
+
},
|
|
35
|
+
scripts: {
|
|
36
|
+
build: "tsup --dts-resolve",
|
|
37
|
+
format: "prettier --write .",
|
|
38
|
+
"format:check": "prettier --check .",
|
|
39
|
+
typecheck: "tsc --noEmit",
|
|
40
|
+
lint: "eslint . --fix",
|
|
41
|
+
"lint:check": "eslint . "
|
|
42
|
+
},
|
|
43
|
+
tsup: {
|
|
44
|
+
entry: [
|
|
45
|
+
"src/index.ts",
|
|
46
|
+
"src/integrations/gemini.ts",
|
|
47
|
+
"src/proto.ts"
|
|
48
|
+
],
|
|
49
|
+
noExternal: [
|
|
50
|
+
"fishjam-openapi",
|
|
51
|
+
"fishjam-proto"
|
|
52
|
+
],
|
|
53
|
+
minify: false,
|
|
54
|
+
format: [
|
|
55
|
+
"cjs",
|
|
56
|
+
"esm"
|
|
57
|
+
],
|
|
58
|
+
outDir: "dist"
|
|
59
|
+
},
|
|
60
|
+
dependencies: {
|
|
61
|
+
axios: "^1.7.9",
|
|
62
|
+
uuid: "^11.1.0"
|
|
63
|
+
},
|
|
64
|
+
peerDependencies: {
|
|
65
|
+
"@google/genai": "^1.0.0"
|
|
66
|
+
},
|
|
67
|
+
peerDependenciesMeta: {
|
|
68
|
+
"@google/genai": {
|
|
69
|
+
optional: true
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
devDependencies: {
|
|
73
|
+
"@fishjam-cloud/fishjam-openapi": "workspace:*",
|
|
74
|
+
"@fishjam-cloud/fishjam-proto": "workspace:*",
|
|
75
|
+
"@openapitools/openapi-generator-cli": "^2.18.4",
|
|
76
|
+
"@types/node": "^22.13.16",
|
|
77
|
+
"@types/websocket": "^1.0.10",
|
|
78
|
+
eslint: "^9.33.0",
|
|
79
|
+
prettier: "^3.6.2",
|
|
80
|
+
tsup: "^8.4.0",
|
|
81
|
+
"typed-emitter": "^2.1.0"
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// src/integrations/gemini.ts
|
|
86
|
+
var SDK_NAME = "fishjam-js-server-sdk";
|
|
87
|
+
var gemini_default = {
|
|
88
|
+
/**
|
|
89
|
+
* Creates a GoogleGenAI client.
|
|
90
|
+
* This function dynamically imports the "@google/genai" module,
|
|
91
|
+
* so it will only be loaded when this function is called.
|
|
92
|
+
*
|
|
93
|
+
* @param options Configuration for the GoogleGenAI client.
|
|
94
|
+
* @returns A GoogleGenAI instance.
|
|
95
|
+
*/
|
|
96
|
+
createClient: (options) => {
|
|
97
|
+
const { GoogleGenAI } = __require("@google/genai");
|
|
98
|
+
const trackingHeader = { "X-Goog-Api-Client": `${SDK_NAME}/${package_default.version}` };
|
|
99
|
+
const finalOptions = {
|
|
100
|
+
...options,
|
|
101
|
+
httpOptions: {
|
|
102
|
+
...options.httpOptions,
|
|
103
|
+
headers: {
|
|
104
|
+
...options.httpOptions?.headers,
|
|
105
|
+
...trackingHeader
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
return new GoogleGenAI(finalOptions);
|
|
110
|
+
},
|
|
111
|
+
/**
|
|
112
|
+
* Predefined audio settings for the agent's output track,
|
|
113
|
+
* configured for Gemini's 24kHz audio output.
|
|
114
|
+
*/
|
|
115
|
+
geminiOutputAudioSettings: {
|
|
116
|
+
encoding: "pcm16",
|
|
117
|
+
channels: 1,
|
|
118
|
+
sampleRate: 24e3
|
|
119
|
+
},
|
|
120
|
+
/**
|
|
121
|
+
* Predefined audio settings for subscribing to room audio,
|
|
122
|
+
* configured for Gemini's 16kHz audio input.
|
|
123
|
+
*/
|
|
124
|
+
geminiInputAudioSettings: {
|
|
125
|
+
audioFormat: "pcm16",
|
|
126
|
+
audioSampleRate: 16e3
|
|
127
|
+
},
|
|
128
|
+
/**
|
|
129
|
+
* The MIME type for the audio data sent to Gemini.
|
|
130
|
+
*/
|
|
131
|
+
inputMimeType: "audio/pcm;rate=16000"
|
|
132
|
+
};
|
|
133
|
+
export {
|
|
134
|
+
gemini_default as default
|
|
135
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fishjam-cloud/js-server-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "Fishjam server SDK for JavaScript",
|
|
5
5
|
"homepage": "https://github.com/fishjam-cloud/js-server-sdk",
|
|
6
6
|
"author": "Fishjam Team",
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
"dist"
|
|
25
25
|
],
|
|
26
26
|
"exports": {
|
|
27
|
-
".": "./dist/index.js"
|
|
27
|
+
".": "./dist/index.js",
|
|
28
|
+
"./gemini": "./dist/integrations/gemini.js"
|
|
28
29
|
},
|
|
29
30
|
"scripts": {
|
|
30
31
|
"build": "tsup --dts-resolve",
|
|
@@ -37,6 +38,7 @@
|
|
|
37
38
|
"tsup": {
|
|
38
39
|
"entry": [
|
|
39
40
|
"src/index.ts",
|
|
41
|
+
"src/integrations/gemini.ts",
|
|
40
42
|
"src/proto.ts"
|
|
41
43
|
],
|
|
42
44
|
"noExternal": [
|
|
@@ -54,9 +56,17 @@
|
|
|
54
56
|
"axios": "^1.7.9",
|
|
55
57
|
"uuid": "^11.1.0"
|
|
56
58
|
},
|
|
59
|
+
"peerDependencies": {
|
|
60
|
+
"@google/genai": "^1.0.0"
|
|
61
|
+
},
|
|
62
|
+
"peerDependenciesMeta": {
|
|
63
|
+
"@google/genai": {
|
|
64
|
+
"optional": true
|
|
65
|
+
}
|
|
66
|
+
},
|
|
57
67
|
"devDependencies": {
|
|
58
|
-
"@fishjam-cloud/fishjam-openapi": "0.
|
|
59
|
-
"@fishjam-cloud/fishjam-proto": "0.
|
|
68
|
+
"@fishjam-cloud/fishjam-openapi": "0.23.0",
|
|
69
|
+
"@fishjam-cloud/fishjam-proto": "0.23.0",
|
|
60
70
|
"@openapitools/openapi-generator-cli": "^2.18.4",
|
|
61
71
|
"@types/node": "^22.13.16",
|
|
62
72
|
"@types/websocket": "^1.0.10",
|