@fishjam-cloud/js-server-sdk 0.26.0 → 0.27.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.
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "@fishjam-cloud/js-server-sdk",
4
- version: "0.26.0",
4
+ version: "0.27.0-rc.0",
5
5
  description: "Fishjam server SDK for JavaScript",
6
6
  homepage: "https://github.com/fishjam-cloud/js-server-sdk",
7
7
  author: "Fishjam Team",
@@ -42,7 +42,8 @@ var package_default = {
42
42
  "format:check": "prettier --check .",
43
43
  typecheck: "tsc --noEmit",
44
44
  lint: "eslint . --fix",
45
- "lint:check": "eslint . "
45
+ "lint:check": "eslint .",
46
+ test: "vitest run"
46
47
  },
47
48
  tsup: {
48
49
  entry: [
@@ -82,7 +83,8 @@ var package_default = {
82
83
  eslint: "^9.33.0",
83
84
  prettier: "^3.6.2",
84
85
  tsup: "^8.4.0",
85
- "typed-emitter": "^2.1.0"
86
+ "typed-emitter": "^2.1.0",
87
+ vitest: "^3.0.0"
86
88
  },
87
89
  "lint-staged": {
88
90
  "*.{js,ts,tsx,mjs,cjs}": [
package/dist/index.d.mts CHANGED
@@ -39,6 +39,19 @@ declare const AudioSampleRate: {
39
39
  readonly NUMBER_24000: 24000;
40
40
  };
41
41
  type AudioSampleRate = typeof AudioSampleRate[keyof typeof AudioSampleRate];
42
+ /**
43
+ * Token for authorizing a MoQ relay connection
44
+ * @export
45
+ * @interface MoqToken
46
+ */
47
+ interface MoqToken {
48
+ /**
49
+ * JWT token for MoQ relay
50
+ * @type {string}
51
+ * @memberof MoqToken
52
+ */
53
+ 'token': string;
54
+ }
42
55
  /**
43
56
  * Describes peer status
44
57
  * @export
@@ -749,6 +762,11 @@ type RoomId = Brand<string, 'RoomId'>;
749
762
  * ID of Peer. Peer is associated with Room and can be created with {@link FishjamClient.createPeer}.
750
763
  */
751
764
  type PeerId = Brand<string, 'PeerId'>;
765
+ /**
766
+ * ID of a MoQ stream. Tokens for a stream can be created with
767
+ * {@link FishjamClient.createMoqPublisherToken} and {@link FishjamClient.createMoqSubscriberToken}.
768
+ */
769
+ type StreamId = Brand<string, 'StreamId'>;
752
770
  type Peer = Omit<Peer$1, 'id'> & {
753
771
  id: PeerId;
754
772
  };
@@ -909,6 +927,7 @@ declare class FishjamAgent extends FishjamAgent_base {
909
927
  * @category Client
910
928
  */
911
929
  declare class FishjamClient {
930
+ private readonly moqApi;
912
931
  private readonly roomApi;
913
932
  private readonly viewerApi;
914
933
  private readonly streamerApi;
@@ -993,6 +1012,16 @@ declare class FishjamClient {
993
1012
  * @returns a livestream streamer token
994
1013
  */
995
1014
  createLivestreamStreamerToken(roomId: RoomId): Promise<StreamerToken>;
1015
+ /**
1016
+ * Creates a MoQ publisher token for the given stream.
1017
+ * @returns a MoQ publisher token
1018
+ */
1019
+ createMoqPublisherToken(streamId: StreamId): Promise<MoqToken>;
1020
+ /**
1021
+ * Creates a MoQ subscriber token for the given stream.
1022
+ * @returns a MoQ subscriber token
1023
+ */
1024
+ createMoqSubscriberToken(streamId: StreamId): Promise<MoqToken>;
996
1025
  }
997
1026
 
998
1027
  declare class MissingFishjamIdException extends Error {
@@ -1021,4 +1050,4 @@ declare class ServiceUnavailableException extends FishjamBaseException {
1021
1050
  declare class UnknownException extends FishjamBaseException {
1022
1051
  }
1023
1052
 
1024
- export { type AgentCallbacks, type AgentEvents, type AgentTrack, type AudioCodecParameters, BadRequestException, type Brand, type CloseEventHandler, type ErrorEventHandler, type ExpectedAgentEvents, type ExpectedEvents, FishjamAgent, FishjamBaseException, FishjamClient, type FishjamConfig, FishjamNotFoundException, FishjamWSNotifier, ForbiddenException, type IncomingTrackData, type IncomingTrackImage, MissingFishjamIdException, type NotificationEvents, type OutgoingTrackData, type Peer, type PeerAdded, type PeerConnected, type PeerCrashed, type PeerDeleted, type PeerDisconnected, type PeerId, type PeerMetadataUpdated, PeerNotFoundException, type PeerOptions, type PeerOptionsAgent, type PeerOptionsVapi, type PeerOptionsWebRTC, PeerStatus, type Room, type RoomConfig, type RoomCrashed, type RoomCreated, type RoomDeleted, type RoomId, RoomNotFoundException, RoomType, ServerMessage, ServiceUnavailableException, type StreamConnected, type StreamDisconnected, type StreamerToken, type TrackAdded, type TrackId, type TrackMetadataUpdated, type TrackRemoved, type TrackType, UnauthorizedException, UnknownException, VideoCodec, type ViewerConnected, type ViewerDisconnected, type ViewerToken };
1053
+ export { type AgentCallbacks, type AgentEvents, type AgentTrack, type AudioCodecParameters, BadRequestException, type Brand, type CloseEventHandler, type ErrorEventHandler, type ExpectedAgentEvents, type ExpectedEvents, FishjamAgent, FishjamBaseException, FishjamClient, type FishjamConfig, FishjamNotFoundException, FishjamWSNotifier, ForbiddenException, type IncomingTrackData, type IncomingTrackImage, MissingFishjamIdException, type MoqToken, 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 PeerOptionsVapi, type PeerOptionsWebRTC, PeerStatus, type Room, type RoomConfig, type RoomCrashed, type RoomCreated, type RoomDeleted, type RoomId, RoomNotFoundException, RoomType, ServerMessage, ServiceUnavailableException, type StreamConnected, type StreamDisconnected, type StreamId, type StreamerToken, type TrackAdded, type TrackId, type TrackMetadataUpdated, type TrackRemoved, type TrackType, UnauthorizedException, UnknownException, VideoCodec, type ViewerConnected, type ViewerDisconnected, type ViewerToken };
package/dist/index.d.ts CHANGED
@@ -39,6 +39,19 @@ declare const AudioSampleRate: {
39
39
  readonly NUMBER_24000: 24000;
40
40
  };
41
41
  type AudioSampleRate = typeof AudioSampleRate[keyof typeof AudioSampleRate];
42
+ /**
43
+ * Token for authorizing a MoQ relay connection
44
+ * @export
45
+ * @interface MoqToken
46
+ */
47
+ interface MoqToken {
48
+ /**
49
+ * JWT token for MoQ relay
50
+ * @type {string}
51
+ * @memberof MoqToken
52
+ */
53
+ 'token': string;
54
+ }
42
55
  /**
43
56
  * Describes peer status
44
57
  * @export
@@ -749,6 +762,11 @@ type RoomId = Brand<string, 'RoomId'>;
749
762
  * ID of Peer. Peer is associated with Room and can be created with {@link FishjamClient.createPeer}.
750
763
  */
751
764
  type PeerId = Brand<string, 'PeerId'>;
765
+ /**
766
+ * ID of a MoQ stream. Tokens for a stream can be created with
767
+ * {@link FishjamClient.createMoqPublisherToken} and {@link FishjamClient.createMoqSubscriberToken}.
768
+ */
769
+ type StreamId = Brand<string, 'StreamId'>;
752
770
  type Peer = Omit<Peer$1, 'id'> & {
753
771
  id: PeerId;
754
772
  };
@@ -909,6 +927,7 @@ declare class FishjamAgent extends FishjamAgent_base {
909
927
  * @category Client
910
928
  */
911
929
  declare class FishjamClient {
930
+ private readonly moqApi;
912
931
  private readonly roomApi;
913
932
  private readonly viewerApi;
914
933
  private readonly streamerApi;
@@ -993,6 +1012,16 @@ declare class FishjamClient {
993
1012
  * @returns a livestream streamer token
994
1013
  */
995
1014
  createLivestreamStreamerToken(roomId: RoomId): Promise<StreamerToken>;
1015
+ /**
1016
+ * Creates a MoQ publisher token for the given stream.
1017
+ * @returns a MoQ publisher token
1018
+ */
1019
+ createMoqPublisherToken(streamId: StreamId): Promise<MoqToken>;
1020
+ /**
1021
+ * Creates a MoQ subscriber token for the given stream.
1022
+ * @returns a MoQ subscriber token
1023
+ */
1024
+ createMoqSubscriberToken(streamId: StreamId): Promise<MoqToken>;
996
1025
  }
997
1026
 
998
1027
  declare class MissingFishjamIdException extends Error {
@@ -1021,4 +1050,4 @@ declare class ServiceUnavailableException extends FishjamBaseException {
1021
1050
  declare class UnknownException extends FishjamBaseException {
1022
1051
  }
1023
1052
 
1024
- export { type AgentCallbacks, type AgentEvents, type AgentTrack, type AudioCodecParameters, BadRequestException, type Brand, type CloseEventHandler, type ErrorEventHandler, type ExpectedAgentEvents, type ExpectedEvents, FishjamAgent, FishjamBaseException, FishjamClient, type FishjamConfig, FishjamNotFoundException, FishjamWSNotifier, ForbiddenException, type IncomingTrackData, type IncomingTrackImage, MissingFishjamIdException, type NotificationEvents, type OutgoingTrackData, type Peer, type PeerAdded, type PeerConnected, type PeerCrashed, type PeerDeleted, type PeerDisconnected, type PeerId, type PeerMetadataUpdated, PeerNotFoundException, type PeerOptions, type PeerOptionsAgent, type PeerOptionsVapi, type PeerOptionsWebRTC, PeerStatus, type Room, type RoomConfig, type RoomCrashed, type RoomCreated, type RoomDeleted, type RoomId, RoomNotFoundException, RoomType, ServerMessage, ServiceUnavailableException, type StreamConnected, type StreamDisconnected, type StreamerToken, type TrackAdded, type TrackId, type TrackMetadataUpdated, type TrackRemoved, type TrackType, UnauthorizedException, UnknownException, VideoCodec, type ViewerConnected, type ViewerDisconnected, type ViewerToken };
1053
+ export { type AgentCallbacks, type AgentEvents, type AgentTrack, type AudioCodecParameters, BadRequestException, type Brand, type CloseEventHandler, type ErrorEventHandler, type ExpectedAgentEvents, type ExpectedEvents, FishjamAgent, FishjamBaseException, FishjamClient, type FishjamConfig, FishjamNotFoundException, FishjamWSNotifier, ForbiddenException, type IncomingTrackData, type IncomingTrackImage, MissingFishjamIdException, type MoqToken, 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 PeerOptionsVapi, type PeerOptionsWebRTC, PeerStatus, type Room, type RoomConfig, type RoomCrashed, type RoomCreated, type RoomDeleted, type RoomId, RoomNotFoundException, RoomType, ServerMessage, ServiceUnavailableException, type StreamConnected, type StreamDisconnected, type StreamId, type StreamerToken, type TrackAdded, type TrackId, type TrackMetadataUpdated, type TrackRemoved, type TrackType, UnauthorizedException, UnknownException, VideoCodec, type ViewerConnected, type ViewerDisconnected, type ViewerToken };
package/dist/index.js CHANGED
@@ -138,6 +138,119 @@ var VideoCodec = {
138
138
  H264: "h264",
139
139
  Vp8: "vp8"
140
140
  };
141
+ var MoqApiAxiosParamCreator = function(configuration) {
142
+ return {
143
+ /**
144
+ *
145
+ * @summary Creates a MoQ publisher token for the given stream
146
+ * @param {string} streamId Stream id
147
+ * @param {*} [options] Override http request option.
148
+ * @throws {RequiredError}
149
+ */
150
+ createMoqPublisherToken: async (streamId, options = {}) => {
151
+ assertParamExists("createMoqPublisherToken", "streamId", streamId);
152
+ const localVarPath = `/moq/{stream_id}/publisher`.replace(`{${"stream_id"}}`, encodeURIComponent(String(streamId)));
153
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
154
+ let baseOptions;
155
+ if (configuration) {
156
+ baseOptions = configuration.baseOptions;
157
+ }
158
+ const localVarRequestOptions = { method: "POST", ...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
+ * @summary Creates a MoQ subscriber token for the given stream
173
+ * @param {string} streamId Stream id
174
+ * @param {*} [options] Override http request option.
175
+ * @throws {RequiredError}
176
+ */
177
+ createMoqSubscriberToken: async (streamId, options = {}) => {
178
+ assertParamExists("createMoqSubscriberToken", "streamId", streamId);
179
+ const localVarPath = `/moq/{stream_id}/subscriber`.replace(`{${"stream_id"}}`, encodeURIComponent(String(streamId)));
180
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
181
+ let baseOptions;
182
+ if (configuration) {
183
+ baseOptions = configuration.baseOptions;
184
+ }
185
+ const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
186
+ const localVarHeaderParameter = {};
187
+ const localVarQueryParameter = {};
188
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
189
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
190
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
191
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
192
+ return {
193
+ url: toPathString(localVarUrlObj),
194
+ options: localVarRequestOptions
195
+ };
196
+ }
197
+ };
198
+ };
199
+ var MoqApiFp = function(configuration) {
200
+ const localVarAxiosParamCreator = MoqApiAxiosParamCreator(configuration);
201
+ return {
202
+ /**
203
+ *
204
+ * @summary Creates a MoQ publisher token for the given stream
205
+ * @param {string} streamId Stream id
206
+ * @param {*} [options] Override http request option.
207
+ * @throws {RequiredError}
208
+ */
209
+ async createMoqPublisherToken(streamId, options) {
210
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createMoqPublisherToken(streamId, options);
211
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
212
+ const localVarOperationServerBasePath = operationServerMap["MoqApi.createMoqPublisherToken"]?.[localVarOperationServerIndex]?.url;
213
+ return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, import_axios.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
214
+ },
215
+ /**
216
+ *
217
+ * @summary Creates a MoQ subscriber token for the given stream
218
+ * @param {string} streamId Stream id
219
+ * @param {*} [options] Override http request option.
220
+ * @throws {RequiredError}
221
+ */
222
+ async createMoqSubscriberToken(streamId, options) {
223
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createMoqSubscriberToken(streamId, options);
224
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
225
+ const localVarOperationServerBasePath = operationServerMap["MoqApi.createMoqSubscriberToken"]?.[localVarOperationServerIndex]?.url;
226
+ return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, import_axios.default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
227
+ }
228
+ };
229
+ };
230
+ var MoqApi = class extends BaseAPI {
231
+ /**
232
+ *
233
+ * @summary Creates a MoQ publisher token for the given stream
234
+ * @param {string} streamId Stream id
235
+ * @param {*} [options] Override http request option.
236
+ * @throws {RequiredError}
237
+ * @memberof MoqApi
238
+ */
239
+ createMoqPublisherToken(streamId, options) {
240
+ return MoqApiFp(this.configuration).createMoqPublisherToken(streamId, options).then((request) => request(this.axios, this.basePath));
241
+ }
242
+ /**
243
+ *
244
+ * @summary Creates a MoQ subscriber token for the given stream
245
+ * @param {string} streamId Stream id
246
+ * @param {*} [options] Override http request option.
247
+ * @throws {RequiredError}
248
+ * @memberof MoqApi
249
+ */
250
+ createMoqSubscriberToken(streamId, options) {
251
+ return MoqApiFp(this.configuration).createMoqSubscriberToken(streamId, options).then((request) => request(this.axios, this.basePath));
252
+ }
253
+ };
141
254
  var RoomApiAxiosParamCreator = function(configuration) {
142
255
  return {
143
256
  /**
@@ -5937,7 +6050,7 @@ var mapException = (error, entity) => {
5937
6050
  // package.json
5938
6051
  var package_default = {
5939
6052
  name: "@fishjam-cloud/js-server-sdk",
5940
- version: "0.26.0",
6053
+ version: "0.27.0-rc.0",
5941
6054
  description: "Fishjam server SDK for JavaScript",
5942
6055
  homepage: "https://github.com/fishjam-cloud/js-server-sdk",
5943
6056
  author: "Fishjam Team",
@@ -5978,7 +6091,8 @@ var package_default = {
5978
6091
  "format:check": "prettier --check .",
5979
6092
  typecheck: "tsc --noEmit",
5980
6093
  lint: "eslint . --fix",
5981
- "lint:check": "eslint . "
6094
+ "lint:check": "eslint .",
6095
+ test: "vitest run"
5982
6096
  },
5983
6097
  tsup: {
5984
6098
  entry: [
@@ -6018,7 +6132,8 @@ var package_default = {
6018
6132
  eslint: "^9.33.0",
6019
6133
  prettier: "^3.6.2",
6020
6134
  tsup: "^8.4.0",
6021
- "typed-emitter": "^2.1.0"
6135
+ "typed-emitter": "^2.1.0",
6136
+ vitest: "^3.0.0"
6022
6137
  },
6023
6138
  "lint-staged": {
6024
6139
  "*.{js,ts,tsx,mjs,cjs}": [
@@ -6029,6 +6144,7 @@ var package_default = {
6029
6144
 
6030
6145
  // src/client.ts
6031
6146
  var FishjamClient = class {
6147
+ moqApi;
6032
6148
  roomApi;
6033
6149
  viewerApi;
6034
6150
  streamerApi;
@@ -6057,6 +6173,7 @@ var FishjamClient = class {
6057
6173
  return response;
6058
6174
  });
6059
6175
  const fishjamUrl = getFishjamUrl(config);
6176
+ this.moqApi = new MoqApi(void 0, fishjamUrl, client);
6060
6177
  this.roomApi = new RoomApi(void 0, fishjamUrl, client);
6061
6178
  this.viewerApi = new ViewerApi(void 0, fishjamUrl, client);
6062
6179
  this.streamerApi = new StreamerApi(void 0, fishjamUrl, client);
@@ -6246,6 +6363,30 @@ var FishjamClient = class {
6246
6363
  throw mapException(error);
6247
6364
  }
6248
6365
  }
6366
+ /**
6367
+ * Creates a MoQ publisher token for the given stream.
6368
+ * @returns a MoQ publisher token
6369
+ */
6370
+ async createMoqPublisherToken(streamId) {
6371
+ try {
6372
+ const tokenResponse = await this.moqApi.createMoqPublisherToken(streamId);
6373
+ return tokenResponse.data;
6374
+ } catch (error) {
6375
+ throw mapException(error);
6376
+ }
6377
+ }
6378
+ /**
6379
+ * Creates a MoQ subscriber token for the given stream.
6380
+ * @returns a MoQ subscriber token
6381
+ */
6382
+ async createMoqSubscriberToken(streamId) {
6383
+ try {
6384
+ const tokenResponse = await this.moqApi.createMoqSubscriberToken(streamId);
6385
+ return tokenResponse.data;
6386
+ } catch (error) {
6387
+ throw mapException(error);
6388
+ }
6389
+ }
6249
6390
  };
6250
6391
  // Annotate the CommonJS export names for ESM import in node:
6251
6392
  0 && (module.exports = {
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  package_default
3
- } from "./chunk-ASJFPK3O.mjs";
3
+ } from "./chunk-Q5OZUPAC.mjs";
4
4
 
5
5
  // ../fishjam-openapi/dist/index.js
6
6
  import globalAxios2 from "axios";
@@ -90,6 +90,119 @@ var VideoCodec = {
90
90
  H264: "h264",
91
91
  Vp8: "vp8"
92
92
  };
93
+ var MoqApiAxiosParamCreator = function(configuration) {
94
+ return {
95
+ /**
96
+ *
97
+ * @summary Creates a MoQ publisher token for the given stream
98
+ * @param {string} streamId Stream id
99
+ * @param {*} [options] Override http request option.
100
+ * @throws {RequiredError}
101
+ */
102
+ createMoqPublisherToken: async (streamId, options = {}) => {
103
+ assertParamExists("createMoqPublisherToken", "streamId", streamId);
104
+ const localVarPath = `/moq/{stream_id}/publisher`.replace(`{${"stream_id"}}`, encodeURIComponent(String(streamId)));
105
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
106
+ let baseOptions;
107
+ if (configuration) {
108
+ baseOptions = configuration.baseOptions;
109
+ }
110
+ const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
111
+ const localVarHeaderParameter = {};
112
+ const localVarQueryParameter = {};
113
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
114
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
115
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
116
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
117
+ return {
118
+ url: toPathString(localVarUrlObj),
119
+ options: localVarRequestOptions
120
+ };
121
+ },
122
+ /**
123
+ *
124
+ * @summary Creates a MoQ subscriber token for the given stream
125
+ * @param {string} streamId Stream id
126
+ * @param {*} [options] Override http request option.
127
+ * @throws {RequiredError}
128
+ */
129
+ createMoqSubscriberToken: async (streamId, options = {}) => {
130
+ assertParamExists("createMoqSubscriberToken", "streamId", streamId);
131
+ const localVarPath = `/moq/{stream_id}/subscriber`.replace(`{${"stream_id"}}`, encodeURIComponent(String(streamId)));
132
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
133
+ let baseOptions;
134
+ if (configuration) {
135
+ baseOptions = configuration.baseOptions;
136
+ }
137
+ const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
138
+ const localVarHeaderParameter = {};
139
+ const localVarQueryParameter = {};
140
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
141
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
142
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
143
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
144
+ return {
145
+ url: toPathString(localVarUrlObj),
146
+ options: localVarRequestOptions
147
+ };
148
+ }
149
+ };
150
+ };
151
+ var MoqApiFp = function(configuration) {
152
+ const localVarAxiosParamCreator = MoqApiAxiosParamCreator(configuration);
153
+ return {
154
+ /**
155
+ *
156
+ * @summary Creates a MoQ publisher token for the given stream
157
+ * @param {string} streamId Stream id
158
+ * @param {*} [options] Override http request option.
159
+ * @throws {RequiredError}
160
+ */
161
+ async createMoqPublisherToken(streamId, options) {
162
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createMoqPublisherToken(streamId, options);
163
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
164
+ const localVarOperationServerBasePath = operationServerMap["MoqApi.createMoqPublisherToken"]?.[localVarOperationServerIndex]?.url;
165
+ return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
166
+ },
167
+ /**
168
+ *
169
+ * @summary Creates a MoQ subscriber token for the given stream
170
+ * @param {string} streamId Stream id
171
+ * @param {*} [options] Override http request option.
172
+ * @throws {RequiredError}
173
+ */
174
+ async createMoqSubscriberToken(streamId, options) {
175
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createMoqSubscriberToken(streamId, options);
176
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
177
+ const localVarOperationServerBasePath = operationServerMap["MoqApi.createMoqSubscriberToken"]?.[localVarOperationServerIndex]?.url;
178
+ return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
179
+ }
180
+ };
181
+ };
182
+ var MoqApi = class extends BaseAPI {
183
+ /**
184
+ *
185
+ * @summary Creates a MoQ publisher token for the given stream
186
+ * @param {string} streamId Stream id
187
+ * @param {*} [options] Override http request option.
188
+ * @throws {RequiredError}
189
+ * @memberof MoqApi
190
+ */
191
+ createMoqPublisherToken(streamId, options) {
192
+ return MoqApiFp(this.configuration).createMoqPublisherToken(streamId, options).then((request) => request(this.axios, this.basePath));
193
+ }
194
+ /**
195
+ *
196
+ * @summary Creates a MoQ subscriber token for the given stream
197
+ * @param {string} streamId Stream id
198
+ * @param {*} [options] Override http request option.
199
+ * @throws {RequiredError}
200
+ * @memberof MoqApi
201
+ */
202
+ createMoqSubscriberToken(streamId, options) {
203
+ return MoqApiFp(this.configuration).createMoqSubscriberToken(streamId, options).then((request) => request(this.axios, this.basePath));
204
+ }
205
+ };
93
206
  var RoomApiAxiosParamCreator = function(configuration) {
94
207
  return {
95
208
  /**
@@ -5888,6 +6001,7 @@ var mapException = (error, entity) => {
5888
6001
 
5889
6002
  // src/client.ts
5890
6003
  var FishjamClient = class {
6004
+ moqApi;
5891
6005
  roomApi;
5892
6006
  viewerApi;
5893
6007
  streamerApi;
@@ -5916,6 +6030,7 @@ var FishjamClient = class {
5916
6030
  return response;
5917
6031
  });
5918
6032
  const fishjamUrl = getFishjamUrl(config);
6033
+ this.moqApi = new MoqApi(void 0, fishjamUrl, client);
5919
6034
  this.roomApi = new RoomApi(void 0, fishjamUrl, client);
5920
6035
  this.viewerApi = new ViewerApi(void 0, fishjamUrl, client);
5921
6036
  this.streamerApi = new StreamerApi(void 0, fishjamUrl, client);
@@ -6105,6 +6220,30 @@ var FishjamClient = class {
6105
6220
  throw mapException(error);
6106
6221
  }
6107
6222
  }
6223
+ /**
6224
+ * Creates a MoQ publisher token for the given stream.
6225
+ * @returns a MoQ publisher token
6226
+ */
6227
+ async createMoqPublisherToken(streamId) {
6228
+ try {
6229
+ const tokenResponse = await this.moqApi.createMoqPublisherToken(streamId);
6230
+ return tokenResponse.data;
6231
+ } catch (error) {
6232
+ throw mapException(error);
6233
+ }
6234
+ }
6235
+ /**
6236
+ * Creates a MoQ subscriber token for the given stream.
6237
+ * @returns a MoQ subscriber token
6238
+ */
6239
+ async createMoqSubscriberToken(streamId) {
6240
+ try {
6241
+ const tokenResponse = await this.moqApi.createMoqSubscriberToken(streamId);
6242
+ return tokenResponse.data;
6243
+ } catch (error) {
6244
+ throw mapException(error);
6245
+ }
6246
+ }
6108
6247
  };
6109
6248
  export {
6110
6249
  BadRequestException,
@@ -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.26.0",
34
+ version: "0.27.0-rc.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",
@@ -72,7 +72,8 @@ var package_default = {
72
72
  "format:check": "prettier --check .",
73
73
  typecheck: "tsc --noEmit",
74
74
  lint: "eslint . --fix",
75
- "lint:check": "eslint . "
75
+ "lint:check": "eslint .",
76
+ test: "vitest run"
76
77
  },
77
78
  tsup: {
78
79
  entry: [
@@ -112,7 +113,8 @@ var package_default = {
112
113
  eslint: "^9.33.0",
113
114
  prettier: "^3.6.2",
114
115
  tsup: "^8.4.0",
115
- "typed-emitter": "^2.1.0"
116
+ "typed-emitter": "^2.1.0",
117
+ vitest: "^3.0.0"
116
118
  },
117
119
  "lint-staged": {
118
120
  "*.{js,ts,tsx,mjs,cjs}": [
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  package_default
3
- } from "../chunk-ASJFPK3O.mjs";
3
+ } from "../chunk-Q5OZUPAC.mjs";
4
4
 
5
5
  // src/integrations/gemini.ts
6
6
  import { GoogleGenAI } from "@google/genai";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fishjam-cloud/js-server-sdk",
3
- "version": "0.26.0",
3
+ "version": "0.27.0-rc.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",
@@ -41,7 +41,8 @@
41
41
  "format:check": "prettier --check .",
42
42
  "typecheck": "tsc --noEmit",
43
43
  "lint": "eslint . --fix",
44
- "lint:check": "eslint . "
44
+ "lint:check": "eslint .",
45
+ "test": "vitest run"
45
46
  },
46
47
  "tsup": {
47
48
  "entry": [
@@ -73,19 +74,20 @@
73
74
  }
74
75
  },
75
76
  "devDependencies": {
76
- "@fishjam-cloud/fishjam-openapi": "workspace:*",
77
- "@fishjam-cloud/fishjam-proto": "workspace:*",
77
+ "@fishjam-cloud/fishjam-openapi": "0.27.0-rc.0",
78
+ "@fishjam-cloud/fishjam-proto": "0.27.0-rc.0",
78
79
  "@openapitools/openapi-generator-cli": "^2.18.4",
79
80
  "@types/node": "^22.13.16",
80
81
  "@types/websocket": "^1.0.10",
81
82
  "eslint": "^9.33.0",
82
83
  "prettier": "^3.6.2",
83
84
  "tsup": "^8.4.0",
84
- "typed-emitter": "^2.1.0"
85
+ "typed-emitter": "^2.1.0",
86
+ "vitest": "^3.0.0"
85
87
  },
86
88
  "lint-staged": {
87
89
  "*.{js,ts,tsx,mjs,cjs}": [
88
90
  "eslint --fix --config eslint.config.mjs"
89
91
  ]
90
92
  }
91
- }
93
+ }