@fishjam-cloud/js-server-sdk 0.27.0 → 0.28.0-rc.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-GERVP75S.mjs} +3 -2
- package/dist/index.d.mts +126 -93
- package/dist/index.d.ts +126 -93
- package/dist/index.js +243 -32
- package/dist/index.mjs +239 -31
- package/dist/integrations/gemini.js +3 -2
- package/dist/integrations/gemini.mjs +1 -1
- package/package.json +5 -4
package/dist/index.js
CHANGED
|
@@ -37,9 +37,11 @@ __export(index_exports, {
|
|
|
37
37
|
FishjamNotFoundException: () => FishjamNotFoundException,
|
|
38
38
|
FishjamWSNotifier: () => FishjamWSNotifier,
|
|
39
39
|
ForbiddenException: () => ForbiddenException,
|
|
40
|
+
InvalidFishjamCredentialsException: () => InvalidFishjamCredentialsException,
|
|
40
41
|
MissingFishjamIdException: () => MissingFishjamIdException,
|
|
41
42
|
PeerNotFoundException: () => PeerNotFoundException,
|
|
42
43
|
PeerStatus: () => PeerStatus,
|
|
44
|
+
QuotaExceededException: () => QuotaExceededException,
|
|
43
45
|
RoomNotFoundException: () => RoomNotFoundException,
|
|
44
46
|
RoomType: () => RoomType,
|
|
45
47
|
ServerMessage: () => ServerMessage,
|
|
@@ -138,12 +140,75 @@ var VideoCodec = {
|
|
|
138
140
|
H264: "h264",
|
|
139
141
|
Vp8: "vp8"
|
|
140
142
|
};
|
|
143
|
+
var CredentialsApiAxiosParamCreator = function(configuration) {
|
|
144
|
+
return {
|
|
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
|
+
*/
|
|
151
|
+
validateCredentials: async (options = {}) => {
|
|
152
|
+
const localVarPath = `/validate`;
|
|
153
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
154
|
+
let baseOptions;
|
|
155
|
+
if (configuration) {
|
|
156
|
+
baseOptions = configuration.baseOptions;
|
|
157
|
+
}
|
|
158
|
+
const localVarRequestOptions = { method: "GET", ...baseOptions, ...options };
|
|
159
|
+
const localVarHeaderParameter = {};
|
|
160
|
+
const localVarQueryParameter = {};
|
|
161
|
+
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
162
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
163
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
164
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
165
|
+
return {
|
|
166
|
+
url: toPathString(localVarUrlObj),
|
|
167
|
+
options: localVarRequestOptions
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
var CredentialsApiFp = function(configuration) {
|
|
173
|
+
const localVarAxiosParamCreator = CredentialsApiAxiosParamCreator(configuration);
|
|
174
|
+
return {
|
|
175
|
+
/**
|
|
176
|
+
* Returns 200 if the provided Fishjam Management Token is valid, 404 otherwise.
|
|
177
|
+
* @summary Validate Fishjam Management Token
|
|
178
|
+
* @param {*} [options] Override http request option.
|
|
179
|
+
* @throws {RequiredError}
|
|
180
|
+
*/
|
|
181
|
+
async validateCredentials(options) {
|
|
182
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.validateCredentials(options);
|
|
183
|
+
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
184
|
+
const localVarOperationServerBasePath = operationServerMap["CredentialsApi.validateCredentials"]?.[localVarOperationServerIndex]?.url;
|
|
185
|
+
return (axios2, basePath) => createRequestFunction(
|
|
186
|
+
localVarAxiosArgs,
|
|
187
|
+
import_axios.default,
|
|
188
|
+
BASE_PATH,
|
|
189
|
+
configuration
|
|
190
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
var CredentialsApi = class extends BaseAPI {
|
|
195
|
+
/**
|
|
196
|
+
* Returns 200 if the provided Fishjam Management Token is valid, 404 otherwise.
|
|
197
|
+
* @summary Validate Fishjam Management Token
|
|
198
|
+
* @param {*} [options] Override http request option.
|
|
199
|
+
* @throws {RequiredError}
|
|
200
|
+
* @memberof CredentialsApi
|
|
201
|
+
*/
|
|
202
|
+
validateCredentials(options) {
|
|
203
|
+
return CredentialsApiFp(this.configuration).validateCredentials(options).then((request) => request(this.axios, this.basePath));
|
|
204
|
+
}
|
|
205
|
+
};
|
|
141
206
|
var MoQApiAxiosParamCreator = function(configuration) {
|
|
142
207
|
return {
|
|
143
208
|
/**
|
|
144
209
|
* Issue a short-lived JWT for a Media over QUIC client.
|
|
145
210
|
* @summary Create a MoQ token
|
|
146
|
-
* @param {MoqTokenConfig} [moqTokenConfig]
|
|
211
|
+
* @param {MoqTokenConfig} [moqTokenConfig]
|
|
147
212
|
* @param {*} [options] Override http request option.
|
|
148
213
|
* @throws {RequiredError}
|
|
149
214
|
*/
|
|
@@ -176,7 +241,7 @@ var MoQApiFp = function(configuration) {
|
|
|
176
241
|
/**
|
|
177
242
|
* Issue a short-lived JWT for a Media over QUIC client.
|
|
178
243
|
* @summary Create a MoQ token
|
|
179
|
-
* @param {MoqTokenConfig} [moqTokenConfig]
|
|
244
|
+
* @param {MoqTokenConfig} [moqTokenConfig]
|
|
180
245
|
* @param {*} [options] Override http request option.
|
|
181
246
|
* @throws {RequiredError}
|
|
182
247
|
*/
|
|
@@ -184,7 +249,12 @@ var MoQApiFp = function(configuration) {
|
|
|
184
249
|
const localVarAxiosArgs = await localVarAxiosParamCreator.createMoqToken(moqTokenConfig, options);
|
|
185
250
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
186
251
|
const localVarOperationServerBasePath = operationServerMap["MoQApi.createMoqToken"]?.[localVarOperationServerIndex]?.url;
|
|
187
|
-
return (axios2, basePath) => createRequestFunction(
|
|
252
|
+
return (axios2, basePath) => createRequestFunction(
|
|
253
|
+
localVarAxiosArgs,
|
|
254
|
+
import_axios.default,
|
|
255
|
+
BASE_PATH,
|
|
256
|
+
configuration
|
|
257
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
188
258
|
}
|
|
189
259
|
};
|
|
190
260
|
};
|
|
@@ -192,7 +262,7 @@ var MoQApi = class extends BaseAPI {
|
|
|
192
262
|
/**
|
|
193
263
|
* Issue a short-lived JWT for a Media over QUIC client.
|
|
194
264
|
* @summary Create a MoQ token
|
|
195
|
-
* @param {MoqTokenConfig} [moqTokenConfig]
|
|
265
|
+
* @param {MoqTokenConfig} [moqTokenConfig]
|
|
196
266
|
* @param {*} [options] Override http request option.
|
|
197
267
|
* @throws {RequiredError}
|
|
198
268
|
* @memberof MoQApi
|
|
@@ -207,7 +277,7 @@ var RoomsApiAxiosParamCreator = function(configuration) {
|
|
|
207
277
|
* Add a peer to a room and return its connection token.
|
|
208
278
|
* @summary Create a peer
|
|
209
279
|
* @param {string} roomId Room id
|
|
210
|
-
* @param {PeerConfig} [peerConfig]
|
|
280
|
+
* @param {PeerConfig} [peerConfig]
|
|
211
281
|
* @param {*} [options] Override http request option.
|
|
212
282
|
* @throws {RequiredError}
|
|
213
283
|
*/
|
|
@@ -236,7 +306,7 @@ var RoomsApiAxiosParamCreator = function(configuration) {
|
|
|
236
306
|
/**
|
|
237
307
|
* Create a new room with the given configuration.
|
|
238
308
|
* @summary Create a room
|
|
239
|
-
* @param {RoomConfig} [roomConfig]
|
|
309
|
+
* @param {RoomConfig} [roomConfig]
|
|
240
310
|
* @param {*} [options] Override http request option.
|
|
241
311
|
* @throws {RequiredError}
|
|
242
312
|
*/
|
|
@@ -457,7 +527,11 @@ var RoomsApiAxiosParamCreator = function(configuration) {
|
|
|
457
527
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
458
528
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
459
529
|
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
460
|
-
localVarRequestOptions.data = serializeDataIfNeeded(
|
|
530
|
+
localVarRequestOptions.data = serializeDataIfNeeded(
|
|
531
|
+
subscribeTracksRequest,
|
|
532
|
+
localVarRequestOptions,
|
|
533
|
+
configuration
|
|
534
|
+
);
|
|
461
535
|
return {
|
|
462
536
|
url: toPathString(localVarUrlObj),
|
|
463
537
|
options: localVarRequestOptions
|
|
@@ -472,7 +546,7 @@ var RoomsApiFp = function(configuration) {
|
|
|
472
546
|
* Add a peer to a room and return its connection token.
|
|
473
547
|
* @summary Create a peer
|
|
474
548
|
* @param {string} roomId Room id
|
|
475
|
-
* @param {PeerConfig} [peerConfig]
|
|
549
|
+
* @param {PeerConfig} [peerConfig]
|
|
476
550
|
* @param {*} [options] Override http request option.
|
|
477
551
|
* @throws {RequiredError}
|
|
478
552
|
*/
|
|
@@ -480,12 +554,17 @@ var RoomsApiFp = function(configuration) {
|
|
|
480
554
|
const localVarAxiosArgs = await localVarAxiosParamCreator.addPeer(roomId, peerConfig, options);
|
|
481
555
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
482
556
|
const localVarOperationServerBasePath = operationServerMap["RoomsApi.addPeer"]?.[localVarOperationServerIndex]?.url;
|
|
483
|
-
return (axios2, basePath) => createRequestFunction(
|
|
557
|
+
return (axios2, basePath) => createRequestFunction(
|
|
558
|
+
localVarAxiosArgs,
|
|
559
|
+
import_axios.default,
|
|
560
|
+
BASE_PATH,
|
|
561
|
+
configuration
|
|
562
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
484
563
|
},
|
|
485
564
|
/**
|
|
486
565
|
* Create a new room with the given configuration.
|
|
487
566
|
* @summary Create a room
|
|
488
|
-
* @param {RoomConfig} [roomConfig]
|
|
567
|
+
* @param {RoomConfig} [roomConfig]
|
|
489
568
|
* @param {*} [options] Override http request option.
|
|
490
569
|
* @throws {RequiredError}
|
|
491
570
|
*/
|
|
@@ -493,7 +572,12 @@ var RoomsApiFp = function(configuration) {
|
|
|
493
572
|
const localVarAxiosArgs = await localVarAxiosParamCreator.createRoom(roomConfig, options);
|
|
494
573
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
495
574
|
const localVarOperationServerBasePath = operationServerMap["RoomsApi.createRoom"]?.[localVarOperationServerIndex]?.url;
|
|
496
|
-
return (axios2, basePath) => createRequestFunction(
|
|
575
|
+
return (axios2, basePath) => createRequestFunction(
|
|
576
|
+
localVarAxiosArgs,
|
|
577
|
+
import_axios.default,
|
|
578
|
+
BASE_PATH,
|
|
579
|
+
configuration
|
|
580
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
497
581
|
},
|
|
498
582
|
/**
|
|
499
583
|
* Remove a peer from a room and disconnect it.
|
|
@@ -507,7 +591,12 @@ var RoomsApiFp = function(configuration) {
|
|
|
507
591
|
const localVarAxiosArgs = await localVarAxiosParamCreator.deletePeer(roomId, id, options);
|
|
508
592
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
509
593
|
const localVarOperationServerBasePath = operationServerMap["RoomsApi.deletePeer"]?.[localVarOperationServerIndex]?.url;
|
|
510
|
-
return (axios2, basePath) => createRequestFunction(
|
|
594
|
+
return (axios2, basePath) => createRequestFunction(
|
|
595
|
+
localVarAxiosArgs,
|
|
596
|
+
import_axios.default,
|
|
597
|
+
BASE_PATH,
|
|
598
|
+
configuration
|
|
599
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
511
600
|
},
|
|
512
601
|
/**
|
|
513
602
|
* Delete a room by id and disconnect all of its peers.
|
|
@@ -520,7 +609,12 @@ var RoomsApiFp = function(configuration) {
|
|
|
520
609
|
const localVarAxiosArgs = await localVarAxiosParamCreator.deleteRoom(roomId, options);
|
|
521
610
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
522
611
|
const localVarOperationServerBasePath = operationServerMap["RoomsApi.deleteRoom"]?.[localVarOperationServerIndex]?.url;
|
|
523
|
-
return (axios2, basePath) => createRequestFunction(
|
|
612
|
+
return (axios2, basePath) => createRequestFunction(
|
|
613
|
+
localVarAxiosArgs,
|
|
614
|
+
import_axios.default,
|
|
615
|
+
BASE_PATH,
|
|
616
|
+
configuration
|
|
617
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
524
618
|
},
|
|
525
619
|
/**
|
|
526
620
|
* List all rooms and livestreams.
|
|
@@ -532,7 +626,12 @@ var RoomsApiFp = function(configuration) {
|
|
|
532
626
|
const localVarAxiosArgs = await localVarAxiosParamCreator.getAllRooms(options);
|
|
533
627
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
534
628
|
const localVarOperationServerBasePath = operationServerMap["RoomsApi.getAllRooms"]?.[localVarOperationServerIndex]?.url;
|
|
535
|
-
return (axios2, basePath) => createRequestFunction(
|
|
629
|
+
return (axios2, basePath) => createRequestFunction(
|
|
630
|
+
localVarAxiosArgs,
|
|
631
|
+
import_axios.default,
|
|
632
|
+
BASE_PATH,
|
|
633
|
+
configuration
|
|
634
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
536
635
|
},
|
|
537
636
|
/**
|
|
538
637
|
* Get a room by id.
|
|
@@ -545,7 +644,12 @@ var RoomsApiFp = function(configuration) {
|
|
|
545
644
|
const localVarAxiosArgs = await localVarAxiosParamCreator.getRoom(roomId, options);
|
|
546
645
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
547
646
|
const localVarOperationServerBasePath = operationServerMap["RoomsApi.getRoom"]?.[localVarOperationServerIndex]?.url;
|
|
548
|
-
return (axios2, basePath) => createRequestFunction(
|
|
647
|
+
return (axios2, basePath) => createRequestFunction(
|
|
648
|
+
localVarAxiosArgs,
|
|
649
|
+
import_axios.default,
|
|
650
|
+
BASE_PATH,
|
|
651
|
+
configuration
|
|
652
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
549
653
|
},
|
|
550
654
|
/**
|
|
551
655
|
* Issue a fresh connection token for an existing peer.
|
|
@@ -559,7 +663,12 @@ var RoomsApiFp = function(configuration) {
|
|
|
559
663
|
const localVarAxiosArgs = await localVarAxiosParamCreator.refreshToken(roomId, id, options);
|
|
560
664
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
561
665
|
const localVarOperationServerBasePath = operationServerMap["RoomsApi.refreshToken"]?.[localVarOperationServerIndex]?.url;
|
|
562
|
-
return (axios2, basePath) => createRequestFunction(
|
|
666
|
+
return (axios2, basePath) => createRequestFunction(
|
|
667
|
+
localVarAxiosArgs,
|
|
668
|
+
import_axios.default,
|
|
669
|
+
BASE_PATH,
|
|
670
|
+
configuration
|
|
671
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
563
672
|
},
|
|
564
673
|
/**
|
|
565
674
|
* Subscribe a peer to all current and future tracks published by another peer in the same room.
|
|
@@ -574,7 +683,12 @@ var RoomsApiFp = function(configuration) {
|
|
|
574
683
|
const localVarAxiosArgs = await localVarAxiosParamCreator.subscribePeer(roomId, id, peerId, options);
|
|
575
684
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
576
685
|
const localVarOperationServerBasePath = operationServerMap["RoomsApi.subscribePeer"]?.[localVarOperationServerIndex]?.url;
|
|
577
|
-
return (axios2, basePath) => createRequestFunction(
|
|
686
|
+
return (axios2, basePath) => createRequestFunction(
|
|
687
|
+
localVarAxiosArgs,
|
|
688
|
+
import_axios.default,
|
|
689
|
+
BASE_PATH,
|
|
690
|
+
configuration
|
|
691
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
578
692
|
},
|
|
579
693
|
/**
|
|
580
694
|
* Subscribe a peer to a specific list of track IDs in the same room.
|
|
@@ -586,10 +700,20 @@ var RoomsApiFp = function(configuration) {
|
|
|
586
700
|
* @throws {RequiredError}
|
|
587
701
|
*/
|
|
588
702
|
async subscribeTracks(roomId, id, subscribeTracksRequest, options) {
|
|
589
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.subscribeTracks(
|
|
703
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.subscribeTracks(
|
|
704
|
+
roomId,
|
|
705
|
+
id,
|
|
706
|
+
subscribeTracksRequest,
|
|
707
|
+
options
|
|
708
|
+
);
|
|
590
709
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
591
710
|
const localVarOperationServerBasePath = operationServerMap["RoomsApi.subscribeTracks"]?.[localVarOperationServerIndex]?.url;
|
|
592
|
-
return (axios2, basePath) => createRequestFunction(
|
|
711
|
+
return (axios2, basePath) => createRequestFunction(
|
|
712
|
+
localVarAxiosArgs,
|
|
713
|
+
import_axios.default,
|
|
714
|
+
BASE_PATH,
|
|
715
|
+
configuration
|
|
716
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
593
717
|
}
|
|
594
718
|
};
|
|
595
719
|
};
|
|
@@ -598,7 +722,7 @@ var RoomsApi = class extends BaseAPI {
|
|
|
598
722
|
* Add a peer to a room and return its connection token.
|
|
599
723
|
* @summary Create a peer
|
|
600
724
|
* @param {string} roomId Room id
|
|
601
|
-
* @param {PeerConfig} [peerConfig]
|
|
725
|
+
* @param {PeerConfig} [peerConfig]
|
|
602
726
|
* @param {*} [options] Override http request option.
|
|
603
727
|
* @throws {RequiredError}
|
|
604
728
|
* @memberof RoomsApi
|
|
@@ -609,7 +733,7 @@ var RoomsApi = class extends BaseAPI {
|
|
|
609
733
|
/**
|
|
610
734
|
* Create a new room with the given configuration.
|
|
611
735
|
* @summary Create a room
|
|
612
|
-
* @param {RoomConfig} [roomConfig]
|
|
736
|
+
* @param {RoomConfig} [roomConfig]
|
|
613
737
|
* @param {*} [options] Override http request option.
|
|
614
738
|
* @throws {RequiredError}
|
|
615
739
|
* @memberof RoomsApi
|
|
@@ -711,7 +835,10 @@ var StreamersApiAxiosParamCreator = function(configuration) {
|
|
|
711
835
|
*/
|
|
712
836
|
createStreamer: async (streamId, options = {}) => {
|
|
713
837
|
assertParamExists("createStreamer", "streamId", streamId);
|
|
714
|
-
const localVarPath = `/livestream/{stream_id}/streamer`.replace(
|
|
838
|
+
const localVarPath = `/livestream/{stream_id}/streamer`.replace(
|
|
839
|
+
`{${"stream_id"}}`,
|
|
840
|
+
encodeURIComponent(String(streamId))
|
|
841
|
+
);
|
|
715
842
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
716
843
|
let baseOptions;
|
|
717
844
|
if (configuration) {
|
|
@@ -801,7 +928,12 @@ var StreamersApiFp = function(configuration) {
|
|
|
801
928
|
const localVarAxiosArgs = await localVarAxiosParamCreator.createStreamer(streamId, options);
|
|
802
929
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
803
930
|
const localVarOperationServerBasePath = operationServerMap["StreamersApi.createStreamer"]?.[localVarOperationServerIndex]?.url;
|
|
804
|
-
return (axios2, basePath) => createRequestFunction(
|
|
931
|
+
return (axios2, basePath) => createRequestFunction(
|
|
932
|
+
localVarAxiosArgs,
|
|
933
|
+
import_axios.default,
|
|
934
|
+
BASE_PATH,
|
|
935
|
+
configuration
|
|
936
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
805
937
|
},
|
|
806
938
|
/**
|
|
807
939
|
* Delete a streamer from a stream and revoke its token.
|
|
@@ -815,7 +947,12 @@ var StreamersApiFp = function(configuration) {
|
|
|
815
947
|
const localVarAxiosArgs = await localVarAxiosParamCreator.deleteStreamer(streamId, streamerId, options);
|
|
816
948
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
817
949
|
const localVarOperationServerBasePath = operationServerMap["StreamersApi.deleteStreamer"]?.[localVarOperationServerIndex]?.url;
|
|
818
|
-
return (axios2, basePath) => createRequestFunction(
|
|
950
|
+
return (axios2, basePath) => createRequestFunction(
|
|
951
|
+
localVarAxiosArgs,
|
|
952
|
+
import_axios.default,
|
|
953
|
+
BASE_PATH,
|
|
954
|
+
configuration
|
|
955
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
819
956
|
},
|
|
820
957
|
/**
|
|
821
958
|
* Issue a fresh streamer token.
|
|
@@ -828,7 +965,12 @@ var StreamersApiFp = function(configuration) {
|
|
|
828
965
|
const localVarAxiosArgs = await localVarAxiosParamCreator.generateStreamerToken(roomId, options);
|
|
829
966
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
830
967
|
const localVarOperationServerBasePath = operationServerMap["StreamersApi.generateStreamerToken"]?.[localVarOperationServerIndex]?.url;
|
|
831
|
-
return (axios2, basePath) => createRequestFunction(
|
|
968
|
+
return (axios2, basePath) => createRequestFunction(
|
|
969
|
+
localVarAxiosArgs,
|
|
970
|
+
import_axios.default,
|
|
971
|
+
BASE_PATH,
|
|
972
|
+
configuration
|
|
973
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
832
974
|
}
|
|
833
975
|
};
|
|
834
976
|
};
|
|
@@ -879,7 +1021,10 @@ var ViewersApiAxiosParamCreator = function(configuration) {
|
|
|
879
1021
|
*/
|
|
880
1022
|
createViewer: async (streamId, options = {}) => {
|
|
881
1023
|
assertParamExists("createViewer", "streamId", streamId);
|
|
882
|
-
const localVarPath = `/livestream/{stream_id}/viewer`.replace(
|
|
1024
|
+
const localVarPath = `/livestream/{stream_id}/viewer`.replace(
|
|
1025
|
+
`{${"stream_id"}}`,
|
|
1026
|
+
encodeURIComponent(String(streamId))
|
|
1027
|
+
);
|
|
883
1028
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
884
1029
|
let baseOptions;
|
|
885
1030
|
if (configuration) {
|
|
@@ -969,7 +1114,12 @@ var ViewersApiFp = function(configuration) {
|
|
|
969
1114
|
const localVarAxiosArgs = await localVarAxiosParamCreator.createViewer(streamId, options);
|
|
970
1115
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
971
1116
|
const localVarOperationServerBasePath = operationServerMap["ViewersApi.createViewer"]?.[localVarOperationServerIndex]?.url;
|
|
972
|
-
return (axios2, basePath) => createRequestFunction(
|
|
1117
|
+
return (axios2, basePath) => createRequestFunction(
|
|
1118
|
+
localVarAxiosArgs,
|
|
1119
|
+
import_axios.default,
|
|
1120
|
+
BASE_PATH,
|
|
1121
|
+
configuration
|
|
1122
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
973
1123
|
},
|
|
974
1124
|
/**
|
|
975
1125
|
* Delete a viewer from a stream and revoke its token.
|
|
@@ -983,7 +1133,12 @@ var ViewersApiFp = function(configuration) {
|
|
|
983
1133
|
const localVarAxiosArgs = await localVarAxiosParamCreator.deleteViewer(streamId, viewerId, options);
|
|
984
1134
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
985
1135
|
const localVarOperationServerBasePath = operationServerMap["ViewersApi.deleteViewer"]?.[localVarOperationServerIndex]?.url;
|
|
986
|
-
return (axios2, basePath) => createRequestFunction(
|
|
1136
|
+
return (axios2, basePath) => createRequestFunction(
|
|
1137
|
+
localVarAxiosArgs,
|
|
1138
|
+
import_axios.default,
|
|
1139
|
+
BASE_PATH,
|
|
1140
|
+
configuration
|
|
1141
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
987
1142
|
},
|
|
988
1143
|
/**
|
|
989
1144
|
* Issue a fresh viewer token.
|
|
@@ -996,7 +1151,12 @@ var ViewersApiFp = function(configuration) {
|
|
|
996
1151
|
const localVarAxiosArgs = await localVarAxiosParamCreator.generateViewerToken(roomId, options);
|
|
997
1152
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
998
1153
|
const localVarOperationServerBasePath = operationServerMap["ViewersApi.generateViewerToken"]?.[localVarOperationServerIndex]?.url;
|
|
999
|
-
return (axios2, basePath) => createRequestFunction(
|
|
1154
|
+
return (axios2, basePath) => createRequestFunction(
|
|
1155
|
+
localVarAxiosArgs,
|
|
1156
|
+
import_axios.default,
|
|
1157
|
+
BASE_PATH,
|
|
1158
|
+
configuration
|
|
1159
|
+
)(axios2, localVarOperationServerBasePath || basePath);
|
|
1000
1160
|
}
|
|
1001
1161
|
};
|
|
1002
1162
|
};
|
|
@@ -5815,10 +5975,14 @@ var RoomNotFoundException = class extends FishjamBaseException {
|
|
|
5815
5975
|
};
|
|
5816
5976
|
var FishjamNotFoundException = class extends FishjamBaseException {
|
|
5817
5977
|
};
|
|
5978
|
+
var InvalidFishjamCredentialsException = class extends FishjamBaseException {
|
|
5979
|
+
};
|
|
5818
5980
|
var PeerNotFoundException = class extends FishjamBaseException {
|
|
5819
5981
|
};
|
|
5820
5982
|
var ServiceUnavailableException = class extends FishjamBaseException {
|
|
5821
5983
|
};
|
|
5984
|
+
var QuotaExceededException = class extends FishjamBaseException {
|
|
5985
|
+
};
|
|
5822
5986
|
var UnknownException = class extends FishjamBaseException {
|
|
5823
5987
|
};
|
|
5824
5988
|
|
|
@@ -6092,9 +6256,14 @@ var mapException = (error, entity) => {
|
|
|
6092
6256
|
switch (error.response?.status) {
|
|
6093
6257
|
case 400:
|
|
6094
6258
|
return new BadRequestException(error);
|
|
6259
|
+
case 402:
|
|
6260
|
+
return new QuotaExceededException(error);
|
|
6095
6261
|
case 401:
|
|
6096
6262
|
throw new UnauthorizedException(error);
|
|
6097
6263
|
case 404:
|
|
6264
|
+
if (error.request.path.includes("validate")) {
|
|
6265
|
+
return new InvalidFishjamCredentialsException(error);
|
|
6266
|
+
}
|
|
6098
6267
|
switch (entity) {
|
|
6099
6268
|
case "peer":
|
|
6100
6269
|
return new PeerNotFoundException(error);
|
|
@@ -6116,7 +6285,7 @@ var mapException = (error, entity) => {
|
|
|
6116
6285
|
// package.json
|
|
6117
6286
|
var package_default = {
|
|
6118
6287
|
name: "@fishjam-cloud/js-server-sdk",
|
|
6119
|
-
version: "0.
|
|
6288
|
+
version: "0.28.0-rc.0",
|
|
6120
6289
|
description: "Fishjam server SDK for JavaScript",
|
|
6121
6290
|
homepage: "https://github.com/fishjam-cloud/js-server-sdk",
|
|
6122
6291
|
author: "Fishjam Team",
|
|
@@ -6205,20 +6374,26 @@ var package_default = {
|
|
|
6205
6374
|
"*.{js,ts,tsx,mjs,cjs}": [
|
|
6206
6375
|
"eslint --fix --config eslint.config.mjs"
|
|
6207
6376
|
]
|
|
6208
|
-
}
|
|
6377
|
+
},
|
|
6378
|
+
stableVersion: "0.27.0"
|
|
6209
6379
|
};
|
|
6210
6380
|
|
|
6211
6381
|
// src/client.ts
|
|
6212
|
-
var FishjamClient = class {
|
|
6382
|
+
var FishjamClient = class _FishjamClient {
|
|
6213
6383
|
moqApi;
|
|
6214
6384
|
roomApi;
|
|
6215
6385
|
viewerApi;
|
|
6216
6386
|
streamerApi;
|
|
6387
|
+
credentialsApi;
|
|
6217
6388
|
fishjamConfig;
|
|
6218
6389
|
deprecationWarningShown = false;
|
|
6219
6390
|
/**
|
|
6220
6391
|
* Create new instance of Fishjam Client.
|
|
6221
6392
|
*
|
|
6393
|
+
* Does not verify credentials against the backend — use
|
|
6394
|
+
* {@link FishjamClient.create} or call
|
|
6395
|
+
* {@link FishjamClient.checkCredentials} afterwards for that.
|
|
6396
|
+
*
|
|
6222
6397
|
* Example usage:
|
|
6223
6398
|
* ```
|
|
6224
6399
|
* const fishjamClient = new FishjamClient({
|
|
@@ -6243,8 +6418,42 @@ var FishjamClient = class {
|
|
|
6243
6418
|
this.roomApi = new RoomsApi(void 0, fishjamUrl, client);
|
|
6244
6419
|
this.viewerApi = new ViewersApi(void 0, fishjamUrl, client);
|
|
6245
6420
|
this.streamerApi = new StreamersApi(void 0, fishjamUrl, client);
|
|
6421
|
+
this.credentialsApi = new CredentialsApi(void 0, fishjamUrl, client);
|
|
6246
6422
|
this.fishjamConfig = config;
|
|
6247
6423
|
}
|
|
6424
|
+
/**
|
|
6425
|
+
* Async factory: constructs a client and verifies credentials against
|
|
6426
|
+
* the backend.
|
|
6427
|
+
*
|
|
6428
|
+
* Throws {@link InvalidFishjamCredentialsException} when the
|
|
6429
|
+
* `fishjamId` / `managementToken` pair is rejected by the backend.
|
|
6430
|
+
*
|
|
6431
|
+
* Example:
|
|
6432
|
+
* ```
|
|
6433
|
+
* const client = await FishjamClient.create({
|
|
6434
|
+
* fishjamId: process.env.FISHJAM_ID!,
|
|
6435
|
+
* managementToken: process.env.FISHJAM_MANAGEMENT_TOKEN!,
|
|
6436
|
+
* });
|
|
6437
|
+
* ```
|
|
6438
|
+
*/
|
|
6439
|
+
static async create(config) {
|
|
6440
|
+
const client = new _FishjamClient(config);
|
|
6441
|
+
await client.checkCredentials();
|
|
6442
|
+
return client;
|
|
6443
|
+
}
|
|
6444
|
+
/**
|
|
6445
|
+
* Verifies the configured credentials by making a single lightweight
|
|
6446
|
+
* call to the Fishjam backend. Resolves on success, throws
|
|
6447
|
+
* {@link InvalidFishjamCredentialsException} on 401/404 from the backend,
|
|
6448
|
+
* otherwise rethrows the standard mapped exception.
|
|
6449
|
+
*/
|
|
6450
|
+
async checkCredentials() {
|
|
6451
|
+
try {
|
|
6452
|
+
await this.credentialsApi.validateCredentials();
|
|
6453
|
+
} catch (error) {
|
|
6454
|
+
throw mapException(error);
|
|
6455
|
+
}
|
|
6456
|
+
}
|
|
6248
6457
|
handleDeprecationHeader(headers) {
|
|
6249
6458
|
try {
|
|
6250
6459
|
const deprecationHeader = headers["x-fishjam-api-deprecated"];
|
|
@@ -6451,9 +6660,11 @@ var FishjamClient = class {
|
|
|
6451
6660
|
FishjamNotFoundException,
|
|
6452
6661
|
FishjamWSNotifier,
|
|
6453
6662
|
ForbiddenException,
|
|
6663
|
+
InvalidFishjamCredentialsException,
|
|
6454
6664
|
MissingFishjamIdException,
|
|
6455
6665
|
PeerNotFoundException,
|
|
6456
6666
|
PeerStatus,
|
|
6667
|
+
QuotaExceededException,
|
|
6457
6668
|
RoomNotFoundException,
|
|
6458
6669
|
RoomType,
|
|
6459
6670
|
ServerMessage,
|