@fishjam-cloud/js-server-sdk 0.27.0 → 0.28.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-GFB6IWU4.mjs → chunk-7QSC3SIL.mjs} +1 -1
- package/dist/index.d.mts +166 -94
- package/dist/index.d.ts +166 -94
- package/dist/index.js +263 -42
- package/dist/index.mjs +259 -41
- package/dist/integrations/gemini.js +1 -1
- package/dist/integrations/gemini.mjs +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
package_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-7QSC3SIL.mjs";
|
|
4
4
|
|
|
5
5
|
// ../fishjam-openapi/dist/index.js
|
|
6
6
|
import globalAxios2 from "axios";
|
|
@@ -90,12 +90,75 @@ var VideoCodec = {
|
|
|
90
90
|
H264: "h264",
|
|
91
91
|
Vp8: "vp8"
|
|
92
92
|
};
|
|
93
|
+
var CredentialsApiAxiosParamCreator = function(configuration) {
|
|
94
|
+
return {
|
|
95
|
+
/**
|
|
96
|
+
* Returns 200 if the provided Fishjam Management Token is valid, 404 otherwise.
|
|
97
|
+
* @summary Validate Fishjam Management Token
|
|
98
|
+
* @param {*} [options] Override http request option.
|
|
99
|
+
* @throws {RequiredError}
|
|
100
|
+
*/
|
|
101
|
+
validateCredentials: async (options = {}) => {
|
|
102
|
+
const localVarPath = `/validate`;
|
|
103
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
104
|
+
let baseOptions;
|
|
105
|
+
if (configuration) {
|
|
106
|
+
baseOptions = configuration.baseOptions;
|
|
107
|
+
}
|
|
108
|
+
const localVarRequestOptions = { method: "GET", ...baseOptions, ...options };
|
|
109
|
+
const localVarHeaderParameter = {};
|
|
110
|
+
const localVarQueryParameter = {};
|
|
111
|
+
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
112
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
113
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
114
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
115
|
+
return {
|
|
116
|
+
url: toPathString(localVarUrlObj),
|
|
117
|
+
options: localVarRequestOptions
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
var CredentialsApiFp = function(configuration) {
|
|
123
|
+
const localVarAxiosParamCreator = CredentialsApiAxiosParamCreator(configuration);
|
|
124
|
+
return {
|
|
125
|
+
/**
|
|
126
|
+
* Returns 200 if the provided Fishjam Management Token is valid, 404 otherwise.
|
|
127
|
+
* @summary Validate Fishjam Management Token
|
|
128
|
+
* @param {*} [options] Override http request option.
|
|
129
|
+
* @throws {RequiredError}
|
|
130
|
+
*/
|
|
131
|
+
async validateCredentials(options) {
|
|
132
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.validateCredentials(options);
|
|
133
|
+
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
134
|
+
const localVarOperationServerBasePath = operationServerMap["CredentialsApi.validateCredentials"]?.[localVarOperationServerIndex]?.url;
|
|
135
|
+
return (axios2, basePath) => createRequestFunction(
|
|
136
|
+
localVarAxiosArgs,
|
|
137
|
+
globalAxios2,
|
|
138
|
+
BASE_PATH,
|
|
139
|
+
configuration
|
|
140
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
var CredentialsApi = class extends BaseAPI {
|
|
145
|
+
/**
|
|
146
|
+
* Returns 200 if the provided Fishjam Management Token is valid, 404 otherwise.
|
|
147
|
+
* @summary Validate Fishjam Management Token
|
|
148
|
+
* @param {*} [options] Override http request option.
|
|
149
|
+
* @throws {RequiredError}
|
|
150
|
+
* @memberof CredentialsApi
|
|
151
|
+
*/
|
|
152
|
+
validateCredentials(options) {
|
|
153
|
+
return CredentialsApiFp(this.configuration).validateCredentials(options).then((request) => request(this.axios, this.basePath));
|
|
154
|
+
}
|
|
155
|
+
};
|
|
93
156
|
var MoQApiAxiosParamCreator = function(configuration) {
|
|
94
157
|
return {
|
|
95
158
|
/**
|
|
96
159
|
* Issue a short-lived JWT for a Media over QUIC client.
|
|
97
160
|
* @summary Create a MoQ token
|
|
98
|
-
* @param {MoqTokenConfig} [moqTokenConfig]
|
|
161
|
+
* @param {MoqTokenConfig} [moqTokenConfig]
|
|
99
162
|
* @param {*} [options] Override http request option.
|
|
100
163
|
* @throws {RequiredError}
|
|
101
164
|
*/
|
|
@@ -128,7 +191,7 @@ var MoQApiFp = function(configuration) {
|
|
|
128
191
|
/**
|
|
129
192
|
* Issue a short-lived JWT for a Media over QUIC client.
|
|
130
193
|
* @summary Create a MoQ token
|
|
131
|
-
* @param {MoqTokenConfig} [moqTokenConfig]
|
|
194
|
+
* @param {MoqTokenConfig} [moqTokenConfig]
|
|
132
195
|
* @param {*} [options] Override http request option.
|
|
133
196
|
* @throws {RequiredError}
|
|
134
197
|
*/
|
|
@@ -136,7 +199,12 @@ var MoQApiFp = function(configuration) {
|
|
|
136
199
|
const localVarAxiosArgs = await localVarAxiosParamCreator.createMoqToken(moqTokenConfig, options);
|
|
137
200
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
138
201
|
const localVarOperationServerBasePath = operationServerMap["MoQApi.createMoqToken"]?.[localVarOperationServerIndex]?.url;
|
|
139
|
-
return (axios2, basePath) => createRequestFunction(
|
|
202
|
+
return (axios2, basePath) => createRequestFunction(
|
|
203
|
+
localVarAxiosArgs,
|
|
204
|
+
globalAxios2,
|
|
205
|
+
BASE_PATH,
|
|
206
|
+
configuration
|
|
207
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
140
208
|
}
|
|
141
209
|
};
|
|
142
210
|
};
|
|
@@ -144,7 +212,7 @@ var MoQApi = class extends BaseAPI {
|
|
|
144
212
|
/**
|
|
145
213
|
* Issue a short-lived JWT for a Media over QUIC client.
|
|
146
214
|
* @summary Create a MoQ token
|
|
147
|
-
* @param {MoqTokenConfig} [moqTokenConfig]
|
|
215
|
+
* @param {MoqTokenConfig} [moqTokenConfig]
|
|
148
216
|
* @param {*} [options] Override http request option.
|
|
149
217
|
* @throws {RequiredError}
|
|
150
218
|
* @memberof MoQApi
|
|
@@ -159,7 +227,7 @@ var RoomsApiAxiosParamCreator = function(configuration) {
|
|
|
159
227
|
* Add a peer to a room and return its connection token.
|
|
160
228
|
* @summary Create a peer
|
|
161
229
|
* @param {string} roomId Room id
|
|
162
|
-
* @param {PeerConfig} [peerConfig]
|
|
230
|
+
* @param {PeerConfig} [peerConfig]
|
|
163
231
|
* @param {*} [options] Override http request option.
|
|
164
232
|
* @throws {RequiredError}
|
|
165
233
|
*/
|
|
@@ -188,7 +256,7 @@ var RoomsApiAxiosParamCreator = function(configuration) {
|
|
|
188
256
|
/**
|
|
189
257
|
* Create a new room with the given configuration.
|
|
190
258
|
* @summary Create a room
|
|
191
|
-
* @param {RoomConfig} [roomConfig]
|
|
259
|
+
* @param {RoomConfig} [roomConfig]
|
|
192
260
|
* @param {*} [options] Override http request option.
|
|
193
261
|
* @throws {RequiredError}
|
|
194
262
|
*/
|
|
@@ -409,7 +477,11 @@ var RoomsApiAxiosParamCreator = function(configuration) {
|
|
|
409
477
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
410
478
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
411
479
|
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
412
|
-
localVarRequestOptions.data = serializeDataIfNeeded(
|
|
480
|
+
localVarRequestOptions.data = serializeDataIfNeeded(
|
|
481
|
+
subscribeTracksRequest,
|
|
482
|
+
localVarRequestOptions,
|
|
483
|
+
configuration
|
|
484
|
+
);
|
|
413
485
|
return {
|
|
414
486
|
url: toPathString(localVarUrlObj),
|
|
415
487
|
options: localVarRequestOptions
|
|
@@ -424,7 +496,7 @@ var RoomsApiFp = function(configuration) {
|
|
|
424
496
|
* Add a peer to a room and return its connection token.
|
|
425
497
|
* @summary Create a peer
|
|
426
498
|
* @param {string} roomId Room id
|
|
427
|
-
* @param {PeerConfig} [peerConfig]
|
|
499
|
+
* @param {PeerConfig} [peerConfig]
|
|
428
500
|
* @param {*} [options] Override http request option.
|
|
429
501
|
* @throws {RequiredError}
|
|
430
502
|
*/
|
|
@@ -432,12 +504,17 @@ var RoomsApiFp = function(configuration) {
|
|
|
432
504
|
const localVarAxiosArgs = await localVarAxiosParamCreator.addPeer(roomId, peerConfig, options);
|
|
433
505
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
434
506
|
const localVarOperationServerBasePath = operationServerMap["RoomsApi.addPeer"]?.[localVarOperationServerIndex]?.url;
|
|
435
|
-
return (axios2, basePath) => createRequestFunction(
|
|
507
|
+
return (axios2, basePath) => createRequestFunction(
|
|
508
|
+
localVarAxiosArgs,
|
|
509
|
+
globalAxios2,
|
|
510
|
+
BASE_PATH,
|
|
511
|
+
configuration
|
|
512
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
436
513
|
},
|
|
437
514
|
/**
|
|
438
515
|
* Create a new room with the given configuration.
|
|
439
516
|
* @summary Create a room
|
|
440
|
-
* @param {RoomConfig} [roomConfig]
|
|
517
|
+
* @param {RoomConfig} [roomConfig]
|
|
441
518
|
* @param {*} [options] Override http request option.
|
|
442
519
|
* @throws {RequiredError}
|
|
443
520
|
*/
|
|
@@ -445,7 +522,12 @@ var RoomsApiFp = function(configuration) {
|
|
|
445
522
|
const localVarAxiosArgs = await localVarAxiosParamCreator.createRoom(roomConfig, options);
|
|
446
523
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
447
524
|
const localVarOperationServerBasePath = operationServerMap["RoomsApi.createRoom"]?.[localVarOperationServerIndex]?.url;
|
|
448
|
-
return (axios2, basePath) => createRequestFunction(
|
|
525
|
+
return (axios2, basePath) => createRequestFunction(
|
|
526
|
+
localVarAxiosArgs,
|
|
527
|
+
globalAxios2,
|
|
528
|
+
BASE_PATH,
|
|
529
|
+
configuration
|
|
530
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
449
531
|
},
|
|
450
532
|
/**
|
|
451
533
|
* Remove a peer from a room and disconnect it.
|
|
@@ -459,7 +541,12 @@ var RoomsApiFp = function(configuration) {
|
|
|
459
541
|
const localVarAxiosArgs = await localVarAxiosParamCreator.deletePeer(roomId, id, options);
|
|
460
542
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
461
543
|
const localVarOperationServerBasePath = operationServerMap["RoomsApi.deletePeer"]?.[localVarOperationServerIndex]?.url;
|
|
462
|
-
return (axios2, basePath) => createRequestFunction(
|
|
544
|
+
return (axios2, basePath) => createRequestFunction(
|
|
545
|
+
localVarAxiosArgs,
|
|
546
|
+
globalAxios2,
|
|
547
|
+
BASE_PATH,
|
|
548
|
+
configuration
|
|
549
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
463
550
|
},
|
|
464
551
|
/**
|
|
465
552
|
* Delete a room by id and disconnect all of its peers.
|
|
@@ -472,7 +559,12 @@ var RoomsApiFp = function(configuration) {
|
|
|
472
559
|
const localVarAxiosArgs = await localVarAxiosParamCreator.deleteRoom(roomId, options);
|
|
473
560
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
474
561
|
const localVarOperationServerBasePath = operationServerMap["RoomsApi.deleteRoom"]?.[localVarOperationServerIndex]?.url;
|
|
475
|
-
return (axios2, basePath) => createRequestFunction(
|
|
562
|
+
return (axios2, basePath) => createRequestFunction(
|
|
563
|
+
localVarAxiosArgs,
|
|
564
|
+
globalAxios2,
|
|
565
|
+
BASE_PATH,
|
|
566
|
+
configuration
|
|
567
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
476
568
|
},
|
|
477
569
|
/**
|
|
478
570
|
* List all rooms and livestreams.
|
|
@@ -484,7 +576,12 @@ var RoomsApiFp = function(configuration) {
|
|
|
484
576
|
const localVarAxiosArgs = await localVarAxiosParamCreator.getAllRooms(options);
|
|
485
577
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
486
578
|
const localVarOperationServerBasePath = operationServerMap["RoomsApi.getAllRooms"]?.[localVarOperationServerIndex]?.url;
|
|
487
|
-
return (axios2, basePath) => createRequestFunction(
|
|
579
|
+
return (axios2, basePath) => createRequestFunction(
|
|
580
|
+
localVarAxiosArgs,
|
|
581
|
+
globalAxios2,
|
|
582
|
+
BASE_PATH,
|
|
583
|
+
configuration
|
|
584
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
488
585
|
},
|
|
489
586
|
/**
|
|
490
587
|
* Get a room by id.
|
|
@@ -497,7 +594,12 @@ var RoomsApiFp = function(configuration) {
|
|
|
497
594
|
const localVarAxiosArgs = await localVarAxiosParamCreator.getRoom(roomId, options);
|
|
498
595
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
499
596
|
const localVarOperationServerBasePath = operationServerMap["RoomsApi.getRoom"]?.[localVarOperationServerIndex]?.url;
|
|
500
|
-
return (axios2, basePath) => createRequestFunction(
|
|
597
|
+
return (axios2, basePath) => createRequestFunction(
|
|
598
|
+
localVarAxiosArgs,
|
|
599
|
+
globalAxios2,
|
|
600
|
+
BASE_PATH,
|
|
601
|
+
configuration
|
|
602
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
501
603
|
},
|
|
502
604
|
/**
|
|
503
605
|
* Issue a fresh connection token for an existing peer.
|
|
@@ -511,7 +613,12 @@ var RoomsApiFp = function(configuration) {
|
|
|
511
613
|
const localVarAxiosArgs = await localVarAxiosParamCreator.refreshToken(roomId, id, options);
|
|
512
614
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
513
615
|
const localVarOperationServerBasePath = operationServerMap["RoomsApi.refreshToken"]?.[localVarOperationServerIndex]?.url;
|
|
514
|
-
return (axios2, basePath) => createRequestFunction(
|
|
616
|
+
return (axios2, basePath) => createRequestFunction(
|
|
617
|
+
localVarAxiosArgs,
|
|
618
|
+
globalAxios2,
|
|
619
|
+
BASE_PATH,
|
|
620
|
+
configuration
|
|
621
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
515
622
|
},
|
|
516
623
|
/**
|
|
517
624
|
* Subscribe a peer to all current and future tracks published by another peer in the same room.
|
|
@@ -526,7 +633,12 @@ var RoomsApiFp = function(configuration) {
|
|
|
526
633
|
const localVarAxiosArgs = await localVarAxiosParamCreator.subscribePeer(roomId, id, peerId, options);
|
|
527
634
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
528
635
|
const localVarOperationServerBasePath = operationServerMap["RoomsApi.subscribePeer"]?.[localVarOperationServerIndex]?.url;
|
|
529
|
-
return (axios2, basePath) => createRequestFunction(
|
|
636
|
+
return (axios2, basePath) => createRequestFunction(
|
|
637
|
+
localVarAxiosArgs,
|
|
638
|
+
globalAxios2,
|
|
639
|
+
BASE_PATH,
|
|
640
|
+
configuration
|
|
641
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
530
642
|
},
|
|
531
643
|
/**
|
|
532
644
|
* Subscribe a peer to a specific list of track IDs in the same room.
|
|
@@ -538,10 +650,20 @@ var RoomsApiFp = function(configuration) {
|
|
|
538
650
|
* @throws {RequiredError}
|
|
539
651
|
*/
|
|
540
652
|
async subscribeTracks(roomId, id, subscribeTracksRequest, options) {
|
|
541
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.subscribeTracks(
|
|
653
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.subscribeTracks(
|
|
654
|
+
roomId,
|
|
655
|
+
id,
|
|
656
|
+
subscribeTracksRequest,
|
|
657
|
+
options
|
|
658
|
+
);
|
|
542
659
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
543
660
|
const localVarOperationServerBasePath = operationServerMap["RoomsApi.subscribeTracks"]?.[localVarOperationServerIndex]?.url;
|
|
544
|
-
return (axios2, basePath) => createRequestFunction(
|
|
661
|
+
return (axios2, basePath) => createRequestFunction(
|
|
662
|
+
localVarAxiosArgs,
|
|
663
|
+
globalAxios2,
|
|
664
|
+
BASE_PATH,
|
|
665
|
+
configuration
|
|
666
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
545
667
|
}
|
|
546
668
|
};
|
|
547
669
|
};
|
|
@@ -550,7 +672,7 @@ var RoomsApi = class extends BaseAPI {
|
|
|
550
672
|
* Add a peer to a room and return its connection token.
|
|
551
673
|
* @summary Create a peer
|
|
552
674
|
* @param {string} roomId Room id
|
|
553
|
-
* @param {PeerConfig} [peerConfig]
|
|
675
|
+
* @param {PeerConfig} [peerConfig]
|
|
554
676
|
* @param {*} [options] Override http request option.
|
|
555
677
|
* @throws {RequiredError}
|
|
556
678
|
* @memberof RoomsApi
|
|
@@ -561,7 +683,7 @@ var RoomsApi = class extends BaseAPI {
|
|
|
561
683
|
/**
|
|
562
684
|
* Create a new room with the given configuration.
|
|
563
685
|
* @summary Create a room
|
|
564
|
-
* @param {RoomConfig} [roomConfig]
|
|
686
|
+
* @param {RoomConfig} [roomConfig]
|
|
565
687
|
* @param {*} [options] Override http request option.
|
|
566
688
|
* @throws {RequiredError}
|
|
567
689
|
* @memberof RoomsApi
|
|
@@ -663,7 +785,10 @@ var StreamersApiAxiosParamCreator = function(configuration) {
|
|
|
663
785
|
*/
|
|
664
786
|
createStreamer: async (streamId, options = {}) => {
|
|
665
787
|
assertParamExists("createStreamer", "streamId", streamId);
|
|
666
|
-
const localVarPath = `/livestream/{stream_id}/streamer`.replace(
|
|
788
|
+
const localVarPath = `/livestream/{stream_id}/streamer`.replace(
|
|
789
|
+
`{${"stream_id"}}`,
|
|
790
|
+
encodeURIComponent(String(streamId))
|
|
791
|
+
);
|
|
667
792
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
668
793
|
let baseOptions;
|
|
669
794
|
if (configuration) {
|
|
@@ -753,7 +878,12 @@ var StreamersApiFp = function(configuration) {
|
|
|
753
878
|
const localVarAxiosArgs = await localVarAxiosParamCreator.createStreamer(streamId, options);
|
|
754
879
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
755
880
|
const localVarOperationServerBasePath = operationServerMap["StreamersApi.createStreamer"]?.[localVarOperationServerIndex]?.url;
|
|
756
|
-
return (axios2, basePath) => createRequestFunction(
|
|
881
|
+
return (axios2, basePath) => createRequestFunction(
|
|
882
|
+
localVarAxiosArgs,
|
|
883
|
+
globalAxios2,
|
|
884
|
+
BASE_PATH,
|
|
885
|
+
configuration
|
|
886
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
757
887
|
},
|
|
758
888
|
/**
|
|
759
889
|
* Delete a streamer from a stream and revoke its token.
|
|
@@ -767,7 +897,12 @@ var StreamersApiFp = function(configuration) {
|
|
|
767
897
|
const localVarAxiosArgs = await localVarAxiosParamCreator.deleteStreamer(streamId, streamerId, options);
|
|
768
898
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
769
899
|
const localVarOperationServerBasePath = operationServerMap["StreamersApi.deleteStreamer"]?.[localVarOperationServerIndex]?.url;
|
|
770
|
-
return (axios2, basePath) => createRequestFunction(
|
|
900
|
+
return (axios2, basePath) => createRequestFunction(
|
|
901
|
+
localVarAxiosArgs,
|
|
902
|
+
globalAxios2,
|
|
903
|
+
BASE_PATH,
|
|
904
|
+
configuration
|
|
905
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
771
906
|
},
|
|
772
907
|
/**
|
|
773
908
|
* Issue a fresh streamer token.
|
|
@@ -780,7 +915,12 @@ var StreamersApiFp = function(configuration) {
|
|
|
780
915
|
const localVarAxiosArgs = await localVarAxiosParamCreator.generateStreamerToken(roomId, options);
|
|
781
916
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
782
917
|
const localVarOperationServerBasePath = operationServerMap["StreamersApi.generateStreamerToken"]?.[localVarOperationServerIndex]?.url;
|
|
783
|
-
return (axios2, basePath) => createRequestFunction(
|
|
918
|
+
return (axios2, basePath) => createRequestFunction(
|
|
919
|
+
localVarAxiosArgs,
|
|
920
|
+
globalAxios2,
|
|
921
|
+
BASE_PATH,
|
|
922
|
+
configuration
|
|
923
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
784
924
|
}
|
|
785
925
|
};
|
|
786
926
|
};
|
|
@@ -831,7 +971,10 @@ var ViewersApiAxiosParamCreator = function(configuration) {
|
|
|
831
971
|
*/
|
|
832
972
|
createViewer: async (streamId, options = {}) => {
|
|
833
973
|
assertParamExists("createViewer", "streamId", streamId);
|
|
834
|
-
const localVarPath = `/livestream/{stream_id}/viewer`.replace(
|
|
974
|
+
const localVarPath = `/livestream/{stream_id}/viewer`.replace(
|
|
975
|
+
`{${"stream_id"}}`,
|
|
976
|
+
encodeURIComponent(String(streamId))
|
|
977
|
+
);
|
|
835
978
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
836
979
|
let baseOptions;
|
|
837
980
|
if (configuration) {
|
|
@@ -921,7 +1064,12 @@ var ViewersApiFp = function(configuration) {
|
|
|
921
1064
|
const localVarAxiosArgs = await localVarAxiosParamCreator.createViewer(streamId, options);
|
|
922
1065
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
923
1066
|
const localVarOperationServerBasePath = operationServerMap["ViewersApi.createViewer"]?.[localVarOperationServerIndex]?.url;
|
|
924
|
-
return (axios2, basePath) => createRequestFunction(
|
|
1067
|
+
return (axios2, basePath) => createRequestFunction(
|
|
1068
|
+
localVarAxiosArgs,
|
|
1069
|
+
globalAxios2,
|
|
1070
|
+
BASE_PATH,
|
|
1071
|
+
configuration
|
|
1072
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
925
1073
|
},
|
|
926
1074
|
/**
|
|
927
1075
|
* Delete a viewer from a stream and revoke its token.
|
|
@@ -935,7 +1083,12 @@ var ViewersApiFp = function(configuration) {
|
|
|
935
1083
|
const localVarAxiosArgs = await localVarAxiosParamCreator.deleteViewer(streamId, viewerId, options);
|
|
936
1084
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
937
1085
|
const localVarOperationServerBasePath = operationServerMap["ViewersApi.deleteViewer"]?.[localVarOperationServerIndex]?.url;
|
|
938
|
-
return (axios2, basePath) => createRequestFunction(
|
|
1086
|
+
return (axios2, basePath) => createRequestFunction(
|
|
1087
|
+
localVarAxiosArgs,
|
|
1088
|
+
globalAxios2,
|
|
1089
|
+
BASE_PATH,
|
|
1090
|
+
configuration
|
|
1091
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
939
1092
|
},
|
|
940
1093
|
/**
|
|
941
1094
|
* Issue a fresh viewer token.
|
|
@@ -948,7 +1101,12 @@ var ViewersApiFp = function(configuration) {
|
|
|
948
1101
|
const localVarAxiosArgs = await localVarAxiosParamCreator.generateViewerToken(roomId, options);
|
|
949
1102
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
950
1103
|
const localVarOperationServerBasePath = operationServerMap["ViewersApi.generateViewerToken"]?.[localVarOperationServerIndex]?.url;
|
|
951
|
-
return (axios2, basePath) => createRequestFunction(
|
|
1104
|
+
return (axios2, basePath) => createRequestFunction(
|
|
1105
|
+
localVarAxiosArgs,
|
|
1106
|
+
globalAxios2,
|
|
1107
|
+
BASE_PATH,
|
|
1108
|
+
configuration
|
|
1109
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
952
1110
|
}
|
|
953
1111
|
};
|
|
954
1112
|
};
|
|
@@ -5767,10 +5925,14 @@ var RoomNotFoundException = class extends FishjamBaseException {
|
|
|
5767
5925
|
};
|
|
5768
5926
|
var FishjamNotFoundException = class extends FishjamBaseException {
|
|
5769
5927
|
};
|
|
5928
|
+
var InvalidFishjamCredentialsException = class extends FishjamBaseException {
|
|
5929
|
+
};
|
|
5770
5930
|
var PeerNotFoundException = class extends FishjamBaseException {
|
|
5771
5931
|
};
|
|
5772
5932
|
var ServiceUnavailableException = class extends FishjamBaseException {
|
|
5773
5933
|
};
|
|
5934
|
+
var QuotaExceededException = class extends FishjamBaseException {
|
|
5935
|
+
};
|
|
5774
5936
|
var UnknownException = class extends FishjamBaseException {
|
|
5775
5937
|
};
|
|
5776
5938
|
|
|
@@ -5844,6 +6006,16 @@ var mapNotification = (event, msg) => {
|
|
|
5844
6006
|
}
|
|
5845
6007
|
return msg;
|
|
5846
6008
|
};
|
|
6009
|
+
var isExpectedEvent = (event) => expectedEventsList.includes(event);
|
|
6010
|
+
var flattenServerMessage = (message) => message.notificationBatch?.notifications ?? [message];
|
|
6011
|
+
var toServerNotification = (message) => {
|
|
6012
|
+
const entry = Object.entries(message).find(([, value]) => value);
|
|
6013
|
+
if (!entry) return null;
|
|
6014
|
+
const [event, msg] = entry;
|
|
6015
|
+
if (!isExpectedEvent(event)) return null;
|
|
6016
|
+
return { type: event, notification: mapNotification(event, msg) };
|
|
6017
|
+
};
|
|
6018
|
+
var extractNotifications = (message) => flattenServerMessage(message).map(toServerNotification).filter((notification) => notification !== null);
|
|
5847
6019
|
|
|
5848
6020
|
// src/ws_notifier.ts
|
|
5849
6021
|
var FishjamWSNotifier = class extends EventEmitter {
|
|
@@ -5861,12 +6033,11 @@ var FishjamWSNotifier = class extends EventEmitter {
|
|
|
5861
6033
|
}
|
|
5862
6034
|
dispatchNotification(message) {
|
|
5863
6035
|
try {
|
|
5864
|
-
const
|
|
5865
|
-
const
|
|
5866
|
-
const
|
|
5867
|
-
|
|
5868
|
-
|
|
5869
|
-
emit(notification, mapNotification(notification, msg));
|
|
6036
|
+
const decodedMessage = ServerMessage.decode(new Uint8Array(message.data));
|
|
6037
|
+
const emit = this.emit.bind(this);
|
|
6038
|
+
for (const { type, notification } of extractNotifications(decodedMessage)) {
|
|
6039
|
+
emit(type, notification);
|
|
6040
|
+
}
|
|
5870
6041
|
} catch (e) {
|
|
5871
6042
|
console.error("Couldn't decode websocket server message", e, message);
|
|
5872
6043
|
}
|
|
@@ -5879,11 +6050,11 @@ var FishjamWSNotifier = class extends EventEmitter {
|
|
|
5879
6050
|
this.client.send(auth);
|
|
5880
6051
|
this.client.send(subscription);
|
|
5881
6052
|
}
|
|
5882
|
-
isExpectedEvent(notification) {
|
|
5883
|
-
return expectedEventsList.includes(notification);
|
|
5884
|
-
}
|
|
5885
6053
|
};
|
|
5886
6054
|
|
|
6055
|
+
// src/webhook.ts
|
|
6056
|
+
var decodeServerNotifications = (data) => extractNotifications(ServerMessage.decode(data instanceof Uint8Array ? data : new Uint8Array(data)));
|
|
6057
|
+
|
|
5887
6058
|
// src/agent.ts
|
|
5888
6059
|
import { EventEmitter as EventEmitter2 } from "events";
|
|
5889
6060
|
import { v4 as uuid4 } from "uuid";
|
|
@@ -6044,9 +6215,14 @@ var mapException = (error, entity) => {
|
|
|
6044
6215
|
switch (error.response?.status) {
|
|
6045
6216
|
case 400:
|
|
6046
6217
|
return new BadRequestException(error);
|
|
6218
|
+
case 402:
|
|
6219
|
+
return new QuotaExceededException(error);
|
|
6047
6220
|
case 401:
|
|
6048
6221
|
throw new UnauthorizedException(error);
|
|
6049
6222
|
case 404:
|
|
6223
|
+
if (error.request.path.includes("validate")) {
|
|
6224
|
+
return new InvalidFishjamCredentialsException(error);
|
|
6225
|
+
}
|
|
6050
6226
|
switch (entity) {
|
|
6051
6227
|
case "peer":
|
|
6052
6228
|
return new PeerNotFoundException(error);
|
|
@@ -6066,16 +6242,21 @@ var mapException = (error, entity) => {
|
|
|
6066
6242
|
};
|
|
6067
6243
|
|
|
6068
6244
|
// src/client.ts
|
|
6069
|
-
var FishjamClient = class {
|
|
6245
|
+
var FishjamClient = class _FishjamClient {
|
|
6070
6246
|
moqApi;
|
|
6071
6247
|
roomApi;
|
|
6072
6248
|
viewerApi;
|
|
6073
6249
|
streamerApi;
|
|
6250
|
+
credentialsApi;
|
|
6074
6251
|
fishjamConfig;
|
|
6075
6252
|
deprecationWarningShown = false;
|
|
6076
6253
|
/**
|
|
6077
6254
|
* Create new instance of Fishjam Client.
|
|
6078
6255
|
*
|
|
6256
|
+
* Does not verify credentials against the backend — use
|
|
6257
|
+
* {@link FishjamClient.create} or call
|
|
6258
|
+
* {@link FishjamClient.checkCredentials} afterwards for that.
|
|
6259
|
+
*
|
|
6079
6260
|
* Example usage:
|
|
6080
6261
|
* ```
|
|
6081
6262
|
* const fishjamClient = new FishjamClient({
|
|
@@ -6100,8 +6281,42 @@ var FishjamClient = class {
|
|
|
6100
6281
|
this.roomApi = new RoomsApi(void 0, fishjamUrl, client);
|
|
6101
6282
|
this.viewerApi = new ViewersApi(void 0, fishjamUrl, client);
|
|
6102
6283
|
this.streamerApi = new StreamersApi(void 0, fishjamUrl, client);
|
|
6284
|
+
this.credentialsApi = new CredentialsApi(void 0, fishjamUrl, client);
|
|
6103
6285
|
this.fishjamConfig = config;
|
|
6104
6286
|
}
|
|
6287
|
+
/**
|
|
6288
|
+
* Async factory: constructs a client and verifies credentials against
|
|
6289
|
+
* the backend.
|
|
6290
|
+
*
|
|
6291
|
+
* Throws {@link InvalidFishjamCredentialsException} when the
|
|
6292
|
+
* `fishjamId` / `managementToken` pair is rejected by the backend.
|
|
6293
|
+
*
|
|
6294
|
+
* Example:
|
|
6295
|
+
* ```
|
|
6296
|
+
* const client = await FishjamClient.create({
|
|
6297
|
+
* fishjamId: process.env.FISHJAM_ID!,
|
|
6298
|
+
* managementToken: process.env.FISHJAM_MANAGEMENT_TOKEN!,
|
|
6299
|
+
* });
|
|
6300
|
+
* ```
|
|
6301
|
+
*/
|
|
6302
|
+
static async create(config) {
|
|
6303
|
+
const client = new _FishjamClient(config);
|
|
6304
|
+
await client.checkCredentials();
|
|
6305
|
+
return client;
|
|
6306
|
+
}
|
|
6307
|
+
/**
|
|
6308
|
+
* Verifies the configured credentials by making a single lightweight
|
|
6309
|
+
* call to the Fishjam backend. Resolves on success, throws
|
|
6310
|
+
* {@link InvalidFishjamCredentialsException} on 401/404 from the backend,
|
|
6311
|
+
* otherwise rethrows the standard mapped exception.
|
|
6312
|
+
*/
|
|
6313
|
+
async checkCredentials() {
|
|
6314
|
+
try {
|
|
6315
|
+
await this.credentialsApi.validateCredentials();
|
|
6316
|
+
} catch (error) {
|
|
6317
|
+
throw mapException(error);
|
|
6318
|
+
}
|
|
6319
|
+
}
|
|
6105
6320
|
handleDeprecationHeader(headers) {
|
|
6106
6321
|
try {
|
|
6107
6322
|
const deprecationHeader = headers["x-fishjam-api-deprecated"];
|
|
@@ -6307,14 +6522,17 @@ export {
|
|
|
6307
6522
|
FishjamNotFoundException,
|
|
6308
6523
|
FishjamWSNotifier,
|
|
6309
6524
|
ForbiddenException,
|
|
6525
|
+
InvalidFishjamCredentialsException,
|
|
6310
6526
|
MissingFishjamIdException,
|
|
6311
6527
|
PeerNotFoundException,
|
|
6312
6528
|
PeerStatus,
|
|
6529
|
+
QuotaExceededException,
|
|
6313
6530
|
RoomNotFoundException,
|
|
6314
6531
|
RoomType,
|
|
6315
6532
|
ServerMessage,
|
|
6316
6533
|
ServiceUnavailableException,
|
|
6317
6534
|
UnauthorizedException,
|
|
6318
6535
|
UnknownException,
|
|
6319
|
-
VideoCodec
|
|
6536
|
+
VideoCodec,
|
|
6537
|
+
decodeServerNotifications
|
|
6320
6538
|
};
|
|
@@ -31,7 +31,7 @@ var import_genai = require("@google/genai");
|
|
|
31
31
|
// package.json
|
|
32
32
|
var package_default = {
|
|
33
33
|
name: "@fishjam-cloud/js-server-sdk",
|
|
34
|
-
version: "0.
|
|
34
|
+
version: "0.28.0",
|
|
35
35
|
description: "Fishjam server SDK for JavaScript",
|
|
36
36
|
homepage: "https://github.com/fishjam-cloud/js-server-sdk",
|
|
37
37
|
author: "Fishjam Team",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fishjam-cloud/js-server-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.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",
|
|
@@ -74,8 +74,8 @@
|
|
|
74
74
|
}
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@fishjam-cloud/fishjam-openapi": "0.
|
|
78
|
-
"@fishjam-cloud/fishjam-proto": "0.
|
|
77
|
+
"@fishjam-cloud/fishjam-openapi": "0.28.0",
|
|
78
|
+
"@fishjam-cloud/fishjam-proto": "0.28.0",
|
|
79
79
|
"@openapitools/openapi-generator-cli": "^2.18.4",
|
|
80
80
|
"@types/node": "^22.13.16",
|
|
81
81
|
"@types/websocket": "^1.0.10",
|