@fishjam-cloud/js-server-sdk 0.17.0 → 0.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -238,12 +238,44 @@ type Peer = Omit<Peer$1, 'id'> & {
238
238
  type Room = {
239
239
  id: RoomId;
240
240
  peers: Peer[];
241
- config: RoomConfig;
241
+ config: RoomOptions;
242
242
  };
243
243
  type FishjamConfig = {
244
244
  fishjamUrl: string;
245
245
  managementToken: string;
246
246
  };
247
+ type RoomOptions = {
248
+ /**
249
+ * Maximum amount of peers allowed into the room
250
+ * @type {number}
251
+ */
252
+ maxPeers?: number | null;
253
+ /**
254
+ * Duration (in seconds) after which the peer will be removed if it is disconnected. If not provided, this feature is disabled.
255
+ * @type {number}
256
+ */
257
+ peerDisconnectedTimeout?: number | null;
258
+ /**
259
+ * Duration (in seconds) after which the room will be removed if no peers are connected. If not provided, this feature is disabled.
260
+ * @type {number}
261
+ */
262
+ peerlessPurgeTimeout?: number | null;
263
+ /**
264
+ * The use-case of the room. If not provided, this defaults to full_feature.
265
+ * @type {string}
266
+ */
267
+ roomType?: RoomConfigRoomTypeEnum | 'livestream';
268
+ /**
269
+ * Enforces video codec for each peer in the room
270
+ * @type {string}
271
+ */
272
+ videoCodec?: RoomConfigVideoCodecEnum | null;
273
+ /**
274
+ * URL where Fishjam notifications will be sent
275
+ * @type {string}
276
+ */
277
+ webhookUrl?: string | null;
278
+ };
247
279
 
248
280
  type ExpectedEvents = 'roomCreated' | 'roomDeleted' | 'roomCrashed' | 'peerAdded' | 'peerDeleted' | 'peerConnected' | 'peerDisconnected' | 'peerMetadataUpdated' | 'peerCrashed' | 'trackAdded' | 'trackRemoved' | 'trackMetadataUpdated';
249
281
  type ErrorEventHandler = (msg: Error) => void;
@@ -285,7 +317,7 @@ declare class FishjamClient {
285
317
  /**
286
318
  * Create a new room. All peers connected to the same room will be able to send/receive streams to each other.
287
319
  */
288
- createRoom(config?: RoomConfig): Promise<Room>;
320
+ createRoom(config?: RoomOptions): Promise<Room>;
289
321
  /**
290
322
  * Delete an existing room. All peers connected to this room will be disconnected and removed.
291
323
  */
@@ -316,10 +348,10 @@ declare class FishjamClient {
316
348
  */
317
349
  refreshPeerToken(roomId: RoomId, peerId: PeerId): Promise<string>;
318
350
  /**
319
- * Creates a broadcast viewer token for the given room.
320
- * @returns a broadcast viewer token
351
+ * Creates a livestream viewer token for the given room.
352
+ * @returns a livestream viewer token
321
353
  */
322
- createBroadcastViewerToken(roomId: RoomId): Promise<ViewerToken>;
354
+ createLivestreamViewerToken(roomId: RoomId): Promise<ViewerToken>;
323
355
  }
324
356
 
325
357
  declare class FishjamBaseException extends Error {
@@ -345,4 +377,4 @@ declare class ServiceUnavailableException extends FishjamBaseException {
345
377
  declare class UnknownException extends FishjamBaseException {
346
378
  }
347
379
 
348
- export { BadRequestException, type Brand, type CloseEventHandler, type ErrorEventHandler, type ExpectedEvents, FishjamBaseException, FishjamClient, type FishjamConfig, FishjamNotFoundException, FishjamWSNotifier, ForbiddenException, type NotificationEvents, type Peer, type PeerId, PeerNotFoundException, type PeerOptions, PeerStatus, type Room, type RoomConfig, RoomConfigRoomTypeEnum, RoomConfigVideoCodecEnum, type RoomId, RoomNotFoundException, ServiceUnavailableException, UnauthorizedException, UnknownException, type ViewerToken };
380
+ export { BadRequestException, type Brand, type CloseEventHandler, type ErrorEventHandler, type ExpectedEvents, FishjamBaseException, FishjamClient, type FishjamConfig, FishjamNotFoundException, FishjamWSNotifier, ForbiddenException, type NotificationEvents, type Peer, type PeerId, PeerNotFoundException, type PeerOptions, PeerStatus, type Room, type RoomConfig, RoomConfigRoomTypeEnum, RoomConfigVideoCodecEnum, type RoomId, RoomNotFoundException, type RoomOptions, ServiceUnavailableException, UnauthorizedException, UnknownException, type ViewerToken };
package/dist/index.d.ts CHANGED
@@ -238,12 +238,44 @@ type Peer = Omit<Peer$1, 'id'> & {
238
238
  type Room = {
239
239
  id: RoomId;
240
240
  peers: Peer[];
241
- config: RoomConfig;
241
+ config: RoomOptions;
242
242
  };
243
243
  type FishjamConfig = {
244
244
  fishjamUrl: string;
245
245
  managementToken: string;
246
246
  };
247
+ type RoomOptions = {
248
+ /**
249
+ * Maximum amount of peers allowed into the room
250
+ * @type {number}
251
+ */
252
+ maxPeers?: number | null;
253
+ /**
254
+ * Duration (in seconds) after which the peer will be removed if it is disconnected. If not provided, this feature is disabled.
255
+ * @type {number}
256
+ */
257
+ peerDisconnectedTimeout?: number | null;
258
+ /**
259
+ * Duration (in seconds) after which the room will be removed if no peers are connected. If not provided, this feature is disabled.
260
+ * @type {number}
261
+ */
262
+ peerlessPurgeTimeout?: number | null;
263
+ /**
264
+ * The use-case of the room. If not provided, this defaults to full_feature.
265
+ * @type {string}
266
+ */
267
+ roomType?: RoomConfigRoomTypeEnum | 'livestream';
268
+ /**
269
+ * Enforces video codec for each peer in the room
270
+ * @type {string}
271
+ */
272
+ videoCodec?: RoomConfigVideoCodecEnum | null;
273
+ /**
274
+ * URL where Fishjam notifications will be sent
275
+ * @type {string}
276
+ */
277
+ webhookUrl?: string | null;
278
+ };
247
279
 
248
280
  type ExpectedEvents = 'roomCreated' | 'roomDeleted' | 'roomCrashed' | 'peerAdded' | 'peerDeleted' | 'peerConnected' | 'peerDisconnected' | 'peerMetadataUpdated' | 'peerCrashed' | 'trackAdded' | 'trackRemoved' | 'trackMetadataUpdated';
249
281
  type ErrorEventHandler = (msg: Error) => void;
@@ -285,7 +317,7 @@ declare class FishjamClient {
285
317
  /**
286
318
  * Create a new room. All peers connected to the same room will be able to send/receive streams to each other.
287
319
  */
288
- createRoom(config?: RoomConfig): Promise<Room>;
320
+ createRoom(config?: RoomOptions): Promise<Room>;
289
321
  /**
290
322
  * Delete an existing room. All peers connected to this room will be disconnected and removed.
291
323
  */
@@ -316,10 +348,10 @@ declare class FishjamClient {
316
348
  */
317
349
  refreshPeerToken(roomId: RoomId, peerId: PeerId): Promise<string>;
318
350
  /**
319
- * Creates a broadcast viewer token for the given room.
320
- * @returns a broadcast viewer token
351
+ * Creates a livestream viewer token for the given room.
352
+ * @returns a livestream viewer token
321
353
  */
322
- createBroadcastViewerToken(roomId: RoomId): Promise<ViewerToken>;
354
+ createLivestreamViewerToken(roomId: RoomId): Promise<ViewerToken>;
323
355
  }
324
356
 
325
357
  declare class FishjamBaseException extends Error {
@@ -345,4 +377,4 @@ declare class ServiceUnavailableException extends FishjamBaseException {
345
377
  declare class UnknownException extends FishjamBaseException {
346
378
  }
347
379
 
348
- export { BadRequestException, type Brand, type CloseEventHandler, type ErrorEventHandler, type ExpectedEvents, FishjamBaseException, FishjamClient, type FishjamConfig, FishjamNotFoundException, FishjamWSNotifier, ForbiddenException, type NotificationEvents, type Peer, type PeerId, PeerNotFoundException, type PeerOptions, PeerStatus, type Room, type RoomConfig, RoomConfigRoomTypeEnum, RoomConfigVideoCodecEnum, type RoomId, RoomNotFoundException, ServiceUnavailableException, UnauthorizedException, UnknownException, type ViewerToken };
380
+ export { BadRequestException, type Brand, type CloseEventHandler, type ErrorEventHandler, type ExpectedEvents, FishjamBaseException, FishjamClient, type FishjamConfig, FishjamNotFoundException, FishjamWSNotifier, ForbiddenException, type NotificationEvents, type Peer, type PeerId, PeerNotFoundException, type PeerOptions, PeerStatus, type Room, type RoomConfig, RoomConfigRoomTypeEnum, RoomConfigVideoCodecEnum, type RoomId, RoomNotFoundException, type RoomOptions, ServiceUnavailableException, UnauthorizedException, UnknownException, type ViewerToken };
package/dist/index.js CHANGED
@@ -10806,7 +10806,7 @@ var require_dist = __commonJS({
10806
10806
  RoomApiAxiosParamCreator: () => RoomApiAxiosParamCreator,
10807
10807
  RoomApiFactory: () => RoomApiFactory,
10808
10808
  RoomApiFp: () => RoomApiFp,
10809
- RoomConfigRoomTypeEnum: () => RoomConfigRoomTypeEnum2,
10809
+ RoomConfigRoomTypeEnum: () => RoomConfigRoomTypeEnum3,
10810
10810
  RoomConfigVideoCodecEnum: () => RoomConfigVideoCodecEnum2,
10811
10811
  SipApi: () => SipApi,
10812
10812
  SipApiAxiosParamCreator: () => SipApiAxiosParamCreator,
@@ -14084,7 +14084,7 @@ var require_dist = __commonJS({
14084
14084
  Connected: "connected",
14085
14085
  Disconnected: "disconnected"
14086
14086
  };
14087
- var RoomConfigRoomTypeEnum2 = {
14087
+ var RoomConfigRoomTypeEnum3 = {
14088
14088
  FullFeature: "full_feature",
14089
14089
  AudioOnly: "audio_only",
14090
14090
  Broadcaster: "broadcaster"
@@ -18710,7 +18710,8 @@ var FishjamClient = class {
18710
18710
  */
18711
18711
  async createRoom(config = {}) {
18712
18712
  try {
18713
- const response = await this.roomApi.createRoom(config);
18713
+ const parsedRoomType = config.roomType == "livestream" ? import_fishjam_openapi.RoomConfigRoomTypeEnum.Broadcaster : config.roomType;
18714
+ const response = await this.roomApi.createRoom({ ...config, roomType: parsedRoomType });
18714
18715
  const {
18715
18716
  data: {
18716
18717
  data: {
@@ -18797,10 +18798,10 @@ var FishjamClient = class {
18797
18798
  }
18798
18799
  }
18799
18800
  /**
18800
- * Creates a broadcast viewer token for the given room.
18801
- * @returns a broadcast viewer token
18801
+ * Creates a livestream viewer token for the given room.
18802
+ * @returns a livestream viewer token
18802
18803
  */
18803
- async createBroadcastViewerToken(roomId) {
18804
+ async createLivestreamViewerToken(roomId) {
18804
18805
  try {
18805
18806
  const tokenResponse = await this.viewerApi.generateToken(roomId);
18806
18807
  return tokenResponse.data;
package/dist/index.mjs CHANGED
@@ -10781,7 +10781,7 @@ var require_dist = __commonJS({
10781
10781
  RoomApiAxiosParamCreator: () => RoomApiAxiosParamCreator,
10782
10782
  RoomApiFactory: () => RoomApiFactory,
10783
10783
  RoomApiFp: () => RoomApiFp,
10784
- RoomConfigRoomTypeEnum: () => RoomConfigRoomTypeEnum2,
10784
+ RoomConfigRoomTypeEnum: () => RoomConfigRoomTypeEnum3,
10785
10785
  RoomConfigVideoCodecEnum: () => RoomConfigVideoCodecEnum2,
10786
10786
  SipApi: () => SipApi,
10787
10787
  SipApiAxiosParamCreator: () => SipApiAxiosParamCreator,
@@ -14059,7 +14059,7 @@ var require_dist = __commonJS({
14059
14059
  Connected: "connected",
14060
14060
  Disconnected: "disconnected"
14061
14061
  };
14062
- var RoomConfigRoomTypeEnum2 = {
14062
+ var RoomConfigRoomTypeEnum3 = {
14063
14063
  FullFeature: "full_feature",
14064
14064
  AudioOnly: "audio_only",
14065
14065
  Broadcaster: "broadcaster"
@@ -15995,7 +15995,8 @@ var FishjamClient = class {
15995
15995
  */
15996
15996
  async createRoom(config = {}) {
15997
15997
  try {
15998
- const response = await this.roomApi.createRoom(config);
15998
+ const parsedRoomType = config.roomType == "livestream" ? import_fishjam_openapi.RoomConfigRoomTypeEnum.Broadcaster : config.roomType;
15999
+ const response = await this.roomApi.createRoom({ ...config, roomType: parsedRoomType });
15999
16000
  const {
16000
16001
  data: {
16001
16002
  data: {
@@ -16082,10 +16083,10 @@ var FishjamClient = class {
16082
16083
  }
16083
16084
  }
16084
16085
  /**
16085
- * Creates a broadcast viewer token for the given room.
16086
- * @returns a broadcast viewer token
16086
+ * Creates a livestream viewer token for the given room.
16087
+ * @returns a livestream viewer token
16087
16088
  */
16088
- async createBroadcastViewerToken(roomId) {
16089
+ async createLivestreamViewerToken(roomId) {
16089
16090
  try {
16090
16091
  const tokenResponse = await this.viewerApi.generateToken(roomId);
16091
16092
  return tokenResponse.data;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fishjam-cloud/js-server-sdk",
3
- "version": "0.17.0",
3
+ "version": "0.17.1",
4
4
  "description": "Fishjam server SDK for JavaScript",
5
5
  "homepage": "https://github.com/fishjam-cloud/js-server-sdk",
6
6
  "author": "Fishjam Team",
@@ -56,8 +56,8 @@
56
56
  "websocket": "^1.0.35"
57
57
  },
58
58
  "devDependencies": {
59
- "@fishjam-cloud/fishjam-openapi": "0.17.0",
60
- "@fishjam-cloud/fishjam-proto": "0.17.0",
59
+ "@fishjam-cloud/fishjam-openapi": "0.17.1",
60
+ "@fishjam-cloud/fishjam-proto": "0.17.1",
61
61
  "@openapitools/openapi-generator-cli": "^2.18.4",
62
62
  "@types/node": "^22.13.16",
63
63
  "@types/websocket": "^1.0.10",