@fishjam-cloud/js-server-sdk 0.29.0 → 0.30.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/index.js CHANGED
@@ -20,22 +20,32 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
+ AudioFormat: () => AudioFormat,
24
+ AudioSampleRate: () => AudioSampleRate,
23
25
  BadRequestException: () => BadRequestException,
26
+ CompositionClient: () => CompositionClient,
27
+ CompositionNotFoundException: () => CompositionNotFoundException,
24
28
  FishjamAgent: () => FishjamAgent,
25
29
  FishjamBaseException: () => FishjamBaseException,
26
30
  FishjamClient: () => FishjamClient,
27
31
  FishjamNotFoundException: () => FishjamNotFoundException,
28
32
  FishjamWSNotifier: () => FishjamWSNotifier,
29
33
  ForbiddenException: () => ForbiddenException,
34
+ InputNotFoundException: () => InputNotFoundException,
30
35
  InvalidFishjamCredentialsException: () => InvalidFishjamCredentialsException,
31
36
  MissingFishjamIdException: () => MissingFishjamIdException,
37
+ OutputNotFoundException: () => OutputNotFoundException,
32
38
  PeerNotFoundException: () => PeerNotFoundException,
33
39
  PeerStatus: () => PeerStatus,
34
40
  QuotaExceededException: () => QuotaExceededException,
41
+ RecordingNotFoundException: () => RecordingNotFoundException,
42
+ RendererNotFoundException: () => RendererNotFoundException,
35
43
  RoomNotFoundException: () => RoomNotFoundException,
36
44
  RoomType: () => RoomType,
37
45
  ServerMessage: () => ServerMessage,
38
46
  ServiceUnavailableException: () => ServiceUnavailableException,
47
+ StaleSdkException: () => StaleSdkException,
48
+ SubscribeMode: () => SubscribeMode,
39
49
  UnauthorizedException: () => UnauthorizedException,
40
50
  UnknownException: () => UnknownException,
41
51
  VideoCodec: () => VideoCodec,
@@ -410,9 +420,336 @@ var MoQApi = class extends BaseAPI {
410
420
  return await response.value();
411
421
  }
412
422
  };
423
+ function RecordingSourceFromJSON(json) {
424
+ return RecordingSourceFromJSONTyped(json, false);
425
+ }
426
+ function RecordingSourceFromJSONTyped(json, ignoreDiscriminator) {
427
+ if (json == null) {
428
+ return json;
429
+ }
430
+ return {
431
+ "compositionURL": json["compositionURL"],
432
+ "outputId": json["outputId"],
433
+ "scaleRatio": json["scaleRatio"] == null ? void 0 : json["scaleRatio"]
434
+ };
435
+ }
436
+ function RecordingSourceToJSON(json) {
437
+ return RecordingSourceToJSONTyped(json, false);
438
+ }
439
+ function RecordingSourceToJSONTyped(value, ignoreDiscriminator = false) {
440
+ if (value == null) {
441
+ return value;
442
+ }
443
+ return {
444
+ "compositionURL": value["compositionURL"],
445
+ "outputId": value["outputId"],
446
+ "scaleRatio": value["scaleRatio"]
447
+ };
448
+ }
449
+ function RecordingConfigToJSON(json) {
450
+ return RecordingConfigToJSONTyped(json, false);
451
+ }
452
+ function RecordingConfigToJSONTyped(value, ignoreDiscriminator = false) {
453
+ if (value == null) {
454
+ return value;
455
+ }
456
+ return {
457
+ "metadata": value["metadata"],
458
+ "source": RecordingSourceToJSON(value["source"])
459
+ };
460
+ }
461
+ function RecordingStatusFromJSON(json) {
462
+ return RecordingStatusFromJSONTyped(json, false);
463
+ }
464
+ function RecordingStatusFromJSONTyped(json, ignoreDiscriminator) {
465
+ return json;
466
+ }
467
+ function RecordingFileFromJSON(json) {
468
+ return RecordingFileFromJSONTyped(json, false);
469
+ }
470
+ function RecordingFileFromJSONTyped(json, ignoreDiscriminator) {
471
+ if (json == null) {
472
+ return json;
473
+ }
474
+ return {
475
+ "url": json["url"]
476
+ };
477
+ }
478
+ function RecordingFromJSON(json) {
479
+ return RecordingFromJSONTyped(json, false);
480
+ }
481
+ function RecordingFromJSONTyped(json, ignoreDiscriminator) {
482
+ if (json == null) {
483
+ return json;
484
+ }
485
+ return {
486
+ "files": json["files"].map(RecordingFileFromJSON),
487
+ "id": json["id"],
488
+ "metadata": json["metadata"] == null ? void 0 : json["metadata"],
489
+ "source": RecordingSourceFromJSON(json["source"]),
490
+ "status": RecordingStatusFromJSON(json["status"])
491
+ };
492
+ }
493
+ function RecordingDetailsResponseFromJSON(json) {
494
+ return RecordingDetailsResponseFromJSONTyped(json, false);
495
+ }
496
+ function RecordingDetailsResponseFromJSONTyped(json, ignoreDiscriminator) {
497
+ if (json == null) {
498
+ return json;
499
+ }
500
+ return {
501
+ "data": RecordingFromJSON(json["data"])
502
+ };
503
+ }
504
+ function RecordingListResponseFromJSON(json) {
505
+ return RecordingListResponseFromJSONTyped(json, false);
506
+ }
507
+ function RecordingListResponseFromJSONTyped(json, ignoreDiscriminator) {
508
+ if (json == null) {
509
+ return json;
510
+ }
511
+ return {
512
+ "data": json["data"].map(RecordingFromJSON)
513
+ };
514
+ }
515
+ var RecordingsApi = class extends BaseAPI {
516
+ /**
517
+ * Creates request options for createRecording without sending the request
518
+ */
519
+ async createRecordingRequestOpts(requestParameters) {
520
+ if (requestParameters["recordingConfig"] == null) {
521
+ throw new RequiredError(
522
+ "recordingConfig",
523
+ 'Required parameter "recordingConfig" was null or undefined when calling createRecording().'
524
+ );
525
+ }
526
+ const queryParameters = {};
527
+ const headerParameters = {};
528
+ headerParameters["Content-Type"] = "application/json";
529
+ if (this.configuration && this.configuration.accessToken) {
530
+ const token = this.configuration.accessToken;
531
+ const tokenString = await token("management_token", []);
532
+ if (tokenString) {
533
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
534
+ }
535
+ }
536
+ let urlPath = `/recordings`;
537
+ return {
538
+ path: urlPath,
539
+ method: "POST",
540
+ headers: headerParameters,
541
+ query: queryParameters,
542
+ body: RecordingConfigToJSON(requestParameters["recordingConfig"])
543
+ };
544
+ }
545
+ /**
546
+ * Create a recording resource. Capturing starts synchronously, so it is returned with status `active`.
547
+ * Create a recording
548
+ */
549
+ async createRecordingRaw(requestParameters, initOverrides) {
550
+ const requestOptions = await this.createRecordingRequestOpts(requestParameters);
551
+ const response = await this.request(requestOptions, initOverrides);
552
+ return new JSONApiResponse(response, (jsonValue) => RecordingDetailsResponseFromJSON(jsonValue));
553
+ }
554
+ /**
555
+ * Create a recording resource. Capturing starts synchronously, so it is returned with status `active`.
556
+ * Create a recording
557
+ */
558
+ async createRecording(requestParameters, initOverrides) {
559
+ const response = await this.createRecordingRaw(requestParameters, initOverrides);
560
+ return await response.value();
561
+ }
562
+ /**
563
+ * Creates request options for deleteRecording without sending the request
564
+ */
565
+ async deleteRecordingRequestOpts(requestParameters) {
566
+ if (requestParameters["recordingId"] == null) {
567
+ throw new RequiredError(
568
+ "recordingId",
569
+ 'Required parameter "recordingId" was null or undefined when calling deleteRecording().'
570
+ );
571
+ }
572
+ const queryParameters = {};
573
+ const headerParameters = {};
574
+ if (this.configuration && this.configuration.accessToken) {
575
+ const token = this.configuration.accessToken;
576
+ const tokenString = await token("management_token", []);
577
+ if (tokenString) {
578
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
579
+ }
580
+ }
581
+ let urlPath = `/recordings/{recording_id}`;
582
+ urlPath = urlPath.replace("{recording_id}", encodeURIComponent(String(requestParameters["recordingId"])));
583
+ return {
584
+ path: urlPath,
585
+ method: "DELETE",
586
+ headers: headerParameters,
587
+ query: queryParameters
588
+ };
589
+ }
590
+ /**
591
+ * Delete a recording by id. The recording disappears from the API immediately; its stored media is removed asynchronously by a background job. A recording that is still `active` cannot be deleted — wait for it to finish or fail.
592
+ * Delete a recording
593
+ */
594
+ async deleteRecordingRaw(requestParameters, initOverrides) {
595
+ const requestOptions = await this.deleteRecordingRequestOpts(requestParameters);
596
+ const response = await this.request(requestOptions, initOverrides);
597
+ return new VoidApiResponse(response);
598
+ }
599
+ /**
600
+ * Delete a recording by id. The recording disappears from the API immediately; its stored media is removed asynchronously by a background job. A recording that is still `active` cannot be deleted — wait for it to finish or fail.
601
+ * Delete a recording
602
+ */
603
+ async deleteRecording(requestParameters, initOverrides) {
604
+ await this.deleteRecordingRaw(requestParameters, initOverrides);
605
+ }
606
+ /**
607
+ * Creates request options for getRecording without sending the request
608
+ */
609
+ async getRecordingRequestOpts(requestParameters) {
610
+ if (requestParameters["recordingId"] == null) {
611
+ throw new RequiredError(
612
+ "recordingId",
613
+ 'Required parameter "recordingId" was null or undefined when calling getRecording().'
614
+ );
615
+ }
616
+ const queryParameters = {};
617
+ const headerParameters = {};
618
+ if (this.configuration && this.configuration.accessToken) {
619
+ const token = this.configuration.accessToken;
620
+ const tokenString = await token("management_token", []);
621
+ if (tokenString) {
622
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
623
+ }
624
+ }
625
+ let urlPath = `/recordings/{recording_id}`;
626
+ urlPath = urlPath.replace("{recording_id}", encodeURIComponent(String(requestParameters["recordingId"])));
627
+ return {
628
+ path: urlPath,
629
+ method: "GET",
630
+ headers: headerParameters,
631
+ query: queryParameters
632
+ };
633
+ }
634
+ /**
635
+ * Get a recording by id.
636
+ * Get a recording
637
+ */
638
+ async getRecordingRaw(requestParameters, initOverrides) {
639
+ const requestOptions = await this.getRecordingRequestOpts(requestParameters);
640
+ const response = await this.request(requestOptions, initOverrides);
641
+ return new JSONApiResponse(response, (jsonValue) => RecordingDetailsResponseFromJSON(jsonValue));
642
+ }
643
+ /**
644
+ * Get a recording by id.
645
+ * Get a recording
646
+ */
647
+ async getRecording(requestParameters, initOverrides) {
648
+ const response = await this.getRecordingRaw(requestParameters, initOverrides);
649
+ return await response.value();
650
+ }
651
+ /**
652
+ * Creates request options for listRecordings without sending the request
653
+ */
654
+ async listRecordingsRequestOpts(requestParameters) {
655
+ const queryParameters = {};
656
+ if (requestParameters["metadata"] != null) {
657
+ for (let key of Object.keys(requestParameters["metadata"])) {
658
+ queryParameters[key] = requestParameters["metadata"][key];
659
+ }
660
+ }
661
+ if (requestParameters["status"] != null) {
662
+ queryParameters["status"] = requestParameters["status"];
663
+ }
664
+ const headerParameters = {};
665
+ if (this.configuration && this.configuration.accessToken) {
666
+ const token = this.configuration.accessToken;
667
+ const tokenString = await token("management_token", []);
668
+ if (tokenString) {
669
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
670
+ }
671
+ }
672
+ let urlPath = `/recordings`;
673
+ return {
674
+ path: urlPath,
675
+ method: "GET",
676
+ headers: headerParameters,
677
+ query: queryParameters
678
+ };
679
+ }
680
+ /**
681
+ * List recordings for the tenant, optionally filtered by metadata and status.
682
+ * List recordings
683
+ */
684
+ async listRecordingsRaw(requestParameters, initOverrides) {
685
+ const requestOptions = await this.listRecordingsRequestOpts(requestParameters);
686
+ const response = await this.request(requestOptions, initOverrides);
687
+ return new JSONApiResponse(response, (jsonValue) => RecordingListResponseFromJSON(jsonValue));
688
+ }
689
+ /**
690
+ * List recordings for the tenant, optionally filtered by metadata and status.
691
+ * List recordings
692
+ */
693
+ async listRecordings(requestParameters = {}, initOverrides) {
694
+ const response = await this.listRecordingsRaw(requestParameters, initOverrides);
695
+ return await response.value();
696
+ }
697
+ /**
698
+ * Creates request options for stopRecording without sending the request
699
+ */
700
+ async stopRecordingRequestOpts(requestParameters) {
701
+ if (requestParameters["recordingId"] == null) {
702
+ throw new RequiredError(
703
+ "recordingId",
704
+ 'Required parameter "recordingId" was null or undefined when calling stopRecording().'
705
+ );
706
+ }
707
+ const queryParameters = {};
708
+ const headerParameters = {};
709
+ if (this.configuration && this.configuration.accessToken) {
710
+ const token = this.configuration.accessToken;
711
+ const tokenString = await token("management_token", []);
712
+ if (tokenString) {
713
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
714
+ }
715
+ }
716
+ let urlPath = `/recordings/{recording_id}/stop`;
717
+ urlPath = urlPath.replace("{recording_id}", encodeURIComponent(String(requestParameters["recordingId"])));
718
+ return {
719
+ path: urlPath,
720
+ method: "POST",
721
+ headers: headerParameters,
722
+ query: queryParameters
723
+ };
724
+ }
725
+ /**
726
+ * Request the recorder to stop capturing. Finalization is asynchronous: the recording stays `active` until the capture is finalized, then becomes `finished`. Stopping a recording that is no longer active is a no-op.
727
+ * Stop a recording
728
+ */
729
+ async stopRecordingRaw(requestParameters, initOverrides) {
730
+ const requestOptions = await this.stopRecordingRequestOpts(requestParameters);
731
+ const response = await this.request(requestOptions, initOverrides);
732
+ return new JSONApiResponse(response, (jsonValue) => RecordingDetailsResponseFromJSON(jsonValue));
733
+ }
734
+ /**
735
+ * Request the recorder to stop capturing. Finalization is asynchronous: the recording stays `active` until the capture is finalized, then becomes `finished`. Stopping a recording that is no longer active is a no-op.
736
+ * Stop a recording
737
+ */
738
+ async stopRecording(requestParameters, initOverrides) {
739
+ const response = await this.stopRecordingRaw(requestParameters, initOverrides);
740
+ return await response.value();
741
+ }
742
+ };
743
+ var AudioSampleRate = {
744
+ NUMBER_16000: 16e3,
745
+ NUMBER_24000: 24e3
746
+ };
413
747
  function AudioSampleRateToJSON(value) {
414
748
  return value;
415
749
  }
750
+ var AudioFormat = {
751
+ Pcm16: "pcm16"
752
+ };
416
753
  function AudioFormatToJSON(value) {
417
754
  return value;
418
755
  }
@@ -428,6 +765,10 @@ function AgentOutputToJSONTyped(value, ignoreDiscriminator = false) {
428
765
  "audioSampleRate": AudioSampleRateToJSON(value["audioSampleRate"])
429
766
  };
430
767
  }
768
+ var SubscribeMode = {
769
+ Auto: "auto",
770
+ Manual: "manual"
771
+ };
431
772
  function SubscribeModeFromJSON(json) {
432
773
  return SubscribeModeFromJSONTyped(json, false);
433
774
  }
@@ -1411,6 +1752,72 @@ function ViewerFromJSONTyped(json, ignoreDiscriminator) {
1411
1752
  "token": json["token"]
1412
1753
  };
1413
1754
  }
1755
+ function TrackForwardingToJSON(json) {
1756
+ return TrackForwardingToJSONTyped(json, false);
1757
+ }
1758
+ function TrackForwardingToJSONTyped(value, ignoreDiscriminator = false) {
1759
+ if (value == null) {
1760
+ return value;
1761
+ }
1762
+ return {
1763
+ "compositionURL": value["compositionURL"],
1764
+ "selector": value["selector"]
1765
+ };
1766
+ }
1767
+ var TrackForwardingsApi = class extends BaseAPI {
1768
+ /**
1769
+ * Creates request options for createTrackForwarding without sending the request
1770
+ */
1771
+ async createTrackForwardingRequestOpts(requestParameters) {
1772
+ if (requestParameters["roomId"] == null) {
1773
+ throw new RequiredError(
1774
+ "roomId",
1775
+ 'Required parameter "roomId" was null or undefined when calling createTrackForwarding().'
1776
+ );
1777
+ }
1778
+ if (requestParameters["trackForwarding"] == null) {
1779
+ throw new RequiredError(
1780
+ "trackForwarding",
1781
+ 'Required parameter "trackForwarding" was null or undefined when calling createTrackForwarding().'
1782
+ );
1783
+ }
1784
+ const queryParameters = {};
1785
+ const headerParameters = {};
1786
+ headerParameters["Content-Type"] = "application/json";
1787
+ if (this.configuration && this.configuration.accessToken) {
1788
+ const token = this.configuration.accessToken;
1789
+ const tokenString = await token("management_token", []);
1790
+ if (tokenString) {
1791
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
1792
+ }
1793
+ }
1794
+ let urlPath = `/room/{room_id}/track_forwardings`;
1795
+ urlPath = urlPath.replace("{room_id}", encodeURIComponent(String(requestParameters["roomId"])));
1796
+ return {
1797
+ path: urlPath,
1798
+ method: "POST",
1799
+ headers: headerParameters,
1800
+ query: queryParameters,
1801
+ body: TrackForwardingToJSON(requestParameters["trackForwarding"])
1802
+ };
1803
+ }
1804
+ /**
1805
+ * Forward a room\'s tracks into an external composition.
1806
+ * Create a track forwarding
1807
+ */
1808
+ async createTrackForwardingRaw(requestParameters, initOverrides) {
1809
+ const requestOptions = await this.createTrackForwardingRequestOpts(requestParameters);
1810
+ const response = await this.request(requestOptions, initOverrides);
1811
+ return new VoidApiResponse(response);
1812
+ }
1813
+ /**
1814
+ * Forward a room\'s tracks into an external composition.
1815
+ * Create a track forwarding
1816
+ */
1817
+ async createTrackForwarding(requestParameters, initOverrides) {
1818
+ await this.createTrackForwardingRaw(requestParameters, initOverrides);
1819
+ }
1820
+ };
1414
1821
  function ViewerDetailsResponseFromJSON(json) {
1415
1822
  return ViewerDetailsResponseFromJSONTyped(json, false);
1416
1823
  }
@@ -2557,13 +2964,62 @@ function serverMessage_VadNotification_StatusToJSON(object) {
2557
2964
  return "UNRECOGNIZED";
2558
2965
  }
2559
2966
  }
2560
- function createBaseServerMessage() {
2561
- return {
2562
- authenticated: void 0,
2563
- authRequest: void 0,
2564
- subscribeRequest: void 0,
2565
- subscribeResponse: void 0,
2566
- roomCreated: void 0,
2967
+ var ServerMessage_RecordingStatusChanged_Status = /* @__PURE__ */ ((ServerMessage_RecordingStatusChanged_Status2) => {
2968
+ ServerMessage_RecordingStatusChanged_Status2[ServerMessage_RecordingStatusChanged_Status2["STATUS_UNSPECIFIED"] = 0] = "STATUS_UNSPECIFIED";
2969
+ ServerMessage_RecordingStatusChanged_Status2[ServerMessage_RecordingStatusChanged_Status2["STATUS_ACTIVE"] = 1] = "STATUS_ACTIVE";
2970
+ ServerMessage_RecordingStatusChanged_Status2[ServerMessage_RecordingStatusChanged_Status2["STATUS_FINISHED"] = 2] = "STATUS_FINISHED";
2971
+ ServerMessage_RecordingStatusChanged_Status2[ServerMessage_RecordingStatusChanged_Status2["STATUS_AVAILABLE"] = 3] = "STATUS_AVAILABLE";
2972
+ ServerMessage_RecordingStatusChanged_Status2[ServerMessage_RecordingStatusChanged_Status2["STATUS_FAILED"] = 4] = "STATUS_FAILED";
2973
+ ServerMessage_RecordingStatusChanged_Status2[ServerMessage_RecordingStatusChanged_Status2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
2974
+ return ServerMessage_RecordingStatusChanged_Status2;
2975
+ })(ServerMessage_RecordingStatusChanged_Status || {});
2976
+ function serverMessage_RecordingStatusChanged_StatusFromJSON(object) {
2977
+ switch (object) {
2978
+ case 0:
2979
+ case "STATUS_UNSPECIFIED":
2980
+ return 0;
2981
+ case 1:
2982
+ case "STATUS_ACTIVE":
2983
+ return 1;
2984
+ case 2:
2985
+ case "STATUS_FINISHED":
2986
+ return 2;
2987
+ case 3:
2988
+ case "STATUS_AVAILABLE":
2989
+ return 3;
2990
+ case 4:
2991
+ case "STATUS_FAILED":
2992
+ return 4;
2993
+ case -1:
2994
+ case "UNRECOGNIZED":
2995
+ default:
2996
+ return -1;
2997
+ }
2998
+ }
2999
+ function serverMessage_RecordingStatusChanged_StatusToJSON(object) {
3000
+ switch (object) {
3001
+ case 0:
3002
+ return "STATUS_UNSPECIFIED";
3003
+ case 1:
3004
+ return "STATUS_ACTIVE";
3005
+ case 2:
3006
+ return "STATUS_FINISHED";
3007
+ case 3:
3008
+ return "STATUS_AVAILABLE";
3009
+ case 4:
3010
+ return "STATUS_FAILED";
3011
+ case -1:
3012
+ default:
3013
+ return "UNRECOGNIZED";
3014
+ }
3015
+ }
3016
+ function createBaseServerMessage() {
3017
+ return {
3018
+ authenticated: void 0,
3019
+ authRequest: void 0,
3020
+ subscribeRequest: void 0,
3021
+ subscribeResponse: void 0,
3022
+ roomCreated: void 0,
2567
3023
  roomDeleted: void 0,
2568
3024
  roomCrashed: void 0,
2569
3025
  peerConnected: void 0,
@@ -2584,6 +3040,7 @@ function createBaseServerMessage() {
2584
3040
  viewerDisconnected: void 0,
2585
3041
  streamerConnected: void 0,
2586
3042
  streamerDisconnected: void 0,
3043
+ recordingStatusChanged: void 0,
2587
3044
  notificationBatch: void 0,
2588
3045
  streamConnected: void 0,
2589
3046
  streamDisconnected: void 0,
@@ -2670,6 +3127,9 @@ var ServerMessage = {
2670
3127
  if (message.streamerDisconnected !== void 0) {
2671
3128
  ServerMessage_StreamerDisconnected.encode(message.streamerDisconnected, writer.uint32(218).fork()).join();
2672
3129
  }
3130
+ if (message.recordingStatusChanged !== void 0) {
3131
+ ServerMessage_RecordingStatusChanged.encode(message.recordingStatusChanged, writer.uint32(274).fork()).join();
3132
+ }
2673
3133
  if (message.notificationBatch !== void 0) {
2674
3134
  ServerMessage_NotificationBatch.encode(message.notificationBatch, writer.uint32(266).fork()).join();
2675
3135
  }
@@ -2875,6 +3335,13 @@ var ServerMessage = {
2875
3335
  message.streamerDisconnected = ServerMessage_StreamerDisconnected.decode(reader, reader.uint32());
2876
3336
  continue;
2877
3337
  }
3338
+ case 34: {
3339
+ if (tag !== 274) {
3340
+ break;
3341
+ }
3342
+ message.recordingStatusChanged = ServerMessage_RecordingStatusChanged.decode(reader, reader.uint32());
3343
+ continue;
3344
+ }
2878
3345
  case 33: {
2879
3346
  if (tag !== 266) {
2880
3347
  break;
@@ -2959,6 +3426,7 @@ var ServerMessage = {
2959
3426
  viewerDisconnected: isSet2(object.viewerDisconnected) ? ServerMessage_ViewerDisconnected.fromJSON(object.viewerDisconnected) : void 0,
2960
3427
  streamerConnected: isSet2(object.streamerConnected) ? ServerMessage_StreamerConnected.fromJSON(object.streamerConnected) : void 0,
2961
3428
  streamerDisconnected: isSet2(object.streamerDisconnected) ? ServerMessage_StreamerDisconnected.fromJSON(object.streamerDisconnected) : void 0,
3429
+ recordingStatusChanged: isSet2(object.recordingStatusChanged) ? ServerMessage_RecordingStatusChanged.fromJSON(object.recordingStatusChanged) : void 0,
2962
3430
  notificationBatch: isSet2(object.notificationBatch) ? ServerMessage_NotificationBatch.fromJSON(object.notificationBatch) : void 0,
2963
3431
  streamConnected: isSet2(object.streamConnected) ? ServerMessage_StreamConnected.fromJSON(object.streamConnected) : void 0,
2964
3432
  streamDisconnected: isSet2(object.streamDisconnected) ? ServerMessage_StreamDisconnected.fromJSON(object.streamDisconnected) : void 0,
@@ -3045,6 +3513,9 @@ var ServerMessage = {
3045
3513
  if (message.streamerDisconnected !== void 0) {
3046
3514
  obj.streamerDisconnected = ServerMessage_StreamerDisconnected.toJSON(message.streamerDisconnected);
3047
3515
  }
3516
+ if (message.recordingStatusChanged !== void 0) {
3517
+ obj.recordingStatusChanged = ServerMessage_RecordingStatusChanged.toJSON(message.recordingStatusChanged);
3518
+ }
3048
3519
  if (message.notificationBatch !== void 0) {
3049
3520
  obj.notificationBatch = ServerMessage_NotificationBatch.toJSON(message.notificationBatch);
3050
3521
  }
@@ -3098,6 +3569,7 @@ var ServerMessage = {
3098
3569
  message.viewerDisconnected = object.viewerDisconnected !== void 0 && object.viewerDisconnected !== null ? ServerMessage_ViewerDisconnected.fromPartial(object.viewerDisconnected) : void 0;
3099
3570
  message.streamerConnected = object.streamerConnected !== void 0 && object.streamerConnected !== null ? ServerMessage_StreamerConnected.fromPartial(object.streamerConnected) : void 0;
3100
3571
  message.streamerDisconnected = object.streamerDisconnected !== void 0 && object.streamerDisconnected !== null ? ServerMessage_StreamerDisconnected.fromPartial(object.streamerDisconnected) : void 0;
3572
+ message.recordingStatusChanged = object.recordingStatusChanged !== void 0 && object.recordingStatusChanged !== null ? ServerMessage_RecordingStatusChanged.fromPartial(object.recordingStatusChanged) : void 0;
3101
3573
  message.notificationBatch = object.notificationBatch !== void 0 && object.notificationBatch !== null ? ServerMessage_NotificationBatch.fromPartial(object.notificationBatch) : void 0;
3102
3574
  message.streamConnected = object.streamConnected !== void 0 && object.streamConnected !== null ? ServerMessage_StreamConnected.fromPartial(object.streamConnected) : void 0;
3103
3575
  message.streamDisconnected = object.streamDisconnected !== void 0 && object.streamDisconnected !== null ? ServerMessage_StreamDisconnected.fromPartial(object.streamDisconnected) : void 0;
@@ -5405,6 +5877,89 @@ var ServerMessage_StreamerDisconnected = {
5405
5877
  return message;
5406
5878
  }
5407
5879
  };
5880
+ function createBaseServerMessage_RecordingStatusChanged() {
5881
+ return { recordingId: "", status: 0, metadata: "" };
5882
+ }
5883
+ var ServerMessage_RecordingStatusChanged = {
5884
+ encode(message, writer = new BinaryWriter()) {
5885
+ if (message.recordingId !== "") {
5886
+ writer.uint32(10).string(message.recordingId);
5887
+ }
5888
+ if (message.status !== 0) {
5889
+ writer.uint32(16).int32(message.status);
5890
+ }
5891
+ if (message.metadata !== "") {
5892
+ writer.uint32(26).string(message.metadata);
5893
+ }
5894
+ return writer;
5895
+ },
5896
+ decode(input, length) {
5897
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
5898
+ let end = length === void 0 ? reader.len : reader.pos + length;
5899
+ const message = createBaseServerMessage_RecordingStatusChanged();
5900
+ while (reader.pos < end) {
5901
+ const tag = reader.uint32();
5902
+ switch (tag >>> 3) {
5903
+ case 1: {
5904
+ if (tag !== 10) {
5905
+ break;
5906
+ }
5907
+ message.recordingId = reader.string();
5908
+ continue;
5909
+ }
5910
+ case 2: {
5911
+ if (tag !== 16) {
5912
+ break;
5913
+ }
5914
+ message.status = reader.int32();
5915
+ continue;
5916
+ }
5917
+ case 3: {
5918
+ if (tag !== 26) {
5919
+ break;
5920
+ }
5921
+ message.metadata = reader.string();
5922
+ continue;
5923
+ }
5924
+ }
5925
+ if ((tag & 7) === 4 || tag === 0) {
5926
+ break;
5927
+ }
5928
+ reader.skip(tag & 7);
5929
+ }
5930
+ return message;
5931
+ },
5932
+ fromJSON(object) {
5933
+ return {
5934
+ recordingId: isSet2(object.recordingId) ? globalThis.String(object.recordingId) : "",
5935
+ status: isSet2(object.status) ? serverMessage_RecordingStatusChanged_StatusFromJSON(object.status) : 0,
5936
+ metadata: isSet2(object.metadata) ? globalThis.String(object.metadata) : ""
5937
+ };
5938
+ },
5939
+ toJSON(message) {
5940
+ const obj = {};
5941
+ if (message.recordingId !== "") {
5942
+ obj.recordingId = message.recordingId;
5943
+ }
5944
+ if (message.status !== 0) {
5945
+ obj.status = serverMessage_RecordingStatusChanged_StatusToJSON(message.status);
5946
+ }
5947
+ if (message.metadata !== "") {
5948
+ obj.metadata = message.metadata;
5949
+ }
5950
+ return obj;
5951
+ },
5952
+ create(base) {
5953
+ return ServerMessage_RecordingStatusChanged.fromPartial(base ?? {});
5954
+ },
5955
+ fromPartial(object) {
5956
+ const message = createBaseServerMessage_RecordingStatusChanged();
5957
+ message.recordingId = object.recordingId ?? "";
5958
+ message.status = object.status ?? 0;
5959
+ message.metadata = object.metadata ?? "";
5960
+ return message;
5961
+ }
5962
+ };
5408
5963
  function createBaseServerMessage_NotificationBatch() {
5409
5964
  return { notifications: [] };
5410
5965
  }
@@ -6335,12 +6890,25 @@ function isSet3(value) {
6335
6890
  // src/ws_notifier.ts
6336
6891
  var import_events = require("events");
6337
6892
 
6893
+ // src/utils.ts
6894
+ var import_promises = require("fs/promises");
6895
+
6338
6896
  // src/exceptions/index.ts
6339
6897
  var MissingFishjamIdException = class extends Error {
6340
6898
  constructor() {
6341
6899
  super("Fishjam ID is required");
6342
6900
  }
6343
6901
  };
6902
+ var StaleSdkException = class extends Error {
6903
+ /** Raw wire value received from the server. */
6904
+ status;
6905
+ constructor(status) {
6906
+ super(
6907
+ `Received a recording status this SDK cannot parse (${status}). You are probably using an outdated version of @fishjam-cloud/js-server-sdk \u2014 please update it.`
6908
+ );
6909
+ this.status = status;
6910
+ }
6911
+ };
6344
6912
  var FishjamBaseException = class extends Error {
6345
6913
  statusCode;
6346
6914
  details;
@@ -6364,6 +6932,16 @@ var InvalidFishjamCredentialsException = class extends FishjamBaseException {
6364
6932
  };
6365
6933
  var PeerNotFoundException = class extends FishjamBaseException {
6366
6934
  };
6935
+ var RecordingNotFoundException = class extends FishjamBaseException {
6936
+ };
6937
+ var CompositionNotFoundException = class extends FishjamBaseException {
6938
+ };
6939
+ var InputNotFoundException = class extends FishjamBaseException {
6940
+ };
6941
+ var OutputNotFoundException = class extends FishjamBaseException {
6942
+ };
6943
+ var RendererNotFoundException = class extends FishjamBaseException {
6944
+ };
6367
6945
  var ServiceUnavailableException = class extends FishjamBaseException {
6368
6946
  };
6369
6947
  var QuotaExceededException = class extends FishjamBaseException {
@@ -6372,6 +6950,7 @@ var UnknownException = class extends FishjamBaseException {
6372
6950
  };
6373
6951
 
6374
6952
  // src/utils.ts
6953
+ var FISHJAM_URL = "https://fishjam.io";
6375
6954
  var httpToWebsocket = (httpUrl) => {
6376
6955
  const url = new URL(httpUrl);
6377
6956
  url.protocol = url.protocol.replace("http", "ws");
@@ -6382,7 +6961,7 @@ var getFishjamUrl = (config) => {
6382
6961
  try {
6383
6962
  return new URL(config.fishjamId).href;
6384
6963
  } catch {
6385
- return `https://fishjam.io/api/v1/connect/${config.fishjamId}`;
6964
+ return `${FISHJAM_URL}/api/v1/connect/${config.fishjamId}`;
6386
6965
  }
6387
6966
  };
6388
6967
  var AGENT_SOCKET_PATH = "/socket/agent/websocket";
@@ -6395,6 +6974,10 @@ var getAgentWebsocketUrl = (config, peerWebsocketUrl) => {
6395
6974
  }
6396
6975
  return `${httpToWebsocket(getFishjamUrl(config))}${AGENT_SOCKET_PATH}`;
6397
6976
  };
6977
+ var COMPOSITION_URL = "https://rtc.fishjam.io";
6978
+ var getCompositionOrigin = (config) => new URL(config.compositionUrl ?? COMPOSITION_URL).origin;
6979
+ var toBlob = async (file) => typeof file === "string" ? new Blob([await (0, import_promises.readFile)(file)]) : file;
6980
+ var getLivestreamWhipUrl = (config) => `${new URL(getFishjamUrl(config)).origin}/api/v1/live/api/whip`;
6398
6981
 
6399
6982
  // src/notifications.ts
6400
6983
  var peerTypeMap = {
@@ -6416,6 +6999,20 @@ var vadStatusMap = {
6416
6999
  [ServerMessage_VadNotification_Status.STATUS_SPEECH]: "speech",
6417
7000
  [ServerMessage_VadNotification_Status.UNRECOGNIZED]: "silence"
6418
7001
  };
7002
+ var mapRecordingStatus = (status) => {
7003
+ switch (status) {
7004
+ case ServerMessage_RecordingStatusChanged_Status.STATUS_ACTIVE:
7005
+ return "active";
7006
+ case ServerMessage_RecordingStatusChanged_Status.STATUS_FINISHED:
7007
+ return "finished";
7008
+ case ServerMessage_RecordingStatusChanged_Status.STATUS_AVAILABLE:
7009
+ return "available";
7010
+ case ServerMessage_RecordingStatusChanged_Status.STATUS_FAILED:
7011
+ return "failed";
7012
+ default:
7013
+ throw new StaleSdkException(status);
7014
+ }
7015
+ };
6419
7016
  var expectedEventsList = [
6420
7017
  "roomCreated",
6421
7018
  "roomDeleted",
@@ -6437,7 +7034,8 @@ var expectedEventsList = [
6437
7034
  "trackForwardingRemoved",
6438
7035
  "vadNotification",
6439
7036
  "channelAdded",
6440
- "channelRemoved"
7037
+ "channelRemoved",
7038
+ "recordingStatusChanged"
6441
7039
  ];
6442
7040
  var peerEventsWithPeerType = /* @__PURE__ */ new Set([
6443
7041
  "peerAdded",
@@ -6466,6 +7064,10 @@ var mapNotification = (event, msg) => {
6466
7064
  const vad = msg;
6467
7065
  return { ...vad, status: vadStatusMap[vad.status] };
6468
7066
  }
7067
+ if (event === "recordingStatusChanged") {
7068
+ const recording = msg;
7069
+ return { ...recording, status: mapRecordingStatus(recording.status) };
7070
+ }
6469
7071
  return msg;
6470
7072
  };
6471
7073
  var isExpectedEvent = (event) => expectedEventsList.includes(event);
@@ -6690,129 +7292,2278 @@ var toProtoEncoding = (encoding) => {
6690
7292
  return TrackEncoding.TRACK_ENCODING_OPUS;
6691
7293
  };
6692
7294
 
6693
- // src/exceptions/mapper.ts
6694
- var notFoundException = (info, entity) => {
6695
- switch (entity) {
6696
- case "credentials":
6697
- return new InvalidFishjamCredentialsException(info);
6698
- case "peer":
6699
- return new PeerNotFoundException(info);
6700
- case "room":
6701
- return new RoomNotFoundException(info);
6702
- default:
6703
- return new FishjamNotFoundException(info);
7295
+ // ../composition-openapi/dist/index.js
7296
+ var BASE_PATH2 = "https://rtc.fishjam.io".replace(/\/+$/, "");
7297
+ var Configuration2 = class {
7298
+ constructor(configuration = {}) {
7299
+ this.configuration = configuration;
6704
7300
  }
6705
- };
6706
- var mapException = async (error, entity) => {
6707
- if (error instanceof FetchError) {
6708
- return new UnknownException({ message: error.cause.message, statusCode: 500, details: error.cause.message });
7301
+ set config(configuration) {
7302
+ this.configuration = configuration;
6709
7303
  }
6710
- if (!(error instanceof ResponseError)) {
6711
- return error;
7304
+ get basePath() {
7305
+ return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH2;
6712
7306
  }
6713
- const status = error.response.status;
6714
- const body = await error.response.json().catch(() => ({}));
6715
- const info = {
6716
- message: `Request failed with status code ${status}`,
6717
- statusCode: status,
6718
- details: body["detail"] ?? body["errors"] ?? "Unknown error"
6719
- };
6720
- switch (status) {
6721
- case 400:
6722
- return new BadRequestException(info);
6723
- case 402:
6724
- return new QuotaExceededException(info);
6725
- case 401:
6726
- return new UnauthorizedException(info);
6727
- case 404:
6728
- return notFoundException(info, entity);
6729
- case 503:
6730
- return new ServiceUnavailableException(info);
6731
- default:
6732
- return new UnknownException(info);
7307
+ get fetchApi() {
7308
+ return this.configuration.fetchApi;
6733
7309
  }
6734
- };
6735
-
6736
- // package.json
6737
- var package_default = {
6738
- name: "@fishjam-cloud/js-server-sdk",
6739
- version: "0.29.0",
6740
- description: "Fishjam server SDK for JavaScript",
6741
- homepage: "https://github.com/fishjam-cloud/js-server-sdk",
6742
- author: "Fishjam Team",
6743
- repository: {
6744
- type: "git",
6745
- url: "https://github.com/fishjam-cloud/js-server-sdk.git"
6746
- },
6747
- bugs: {
6748
- url: "https://github.com/fishjam-cloud/js-server-sdk/issues"
6749
- },
6750
- license: "Apache-2.0",
6751
- keywords: [
6752
- "webrtc",
6753
- "fishjam",
6754
- "server",
6755
- "membrane"
6756
- ],
6757
- main: "./dist/index.js",
6758
- types: "./dist/index.d.ts",
6759
- files: [
6760
- "dist"
6761
- ],
6762
- exports: {
6763
- ".": {
6764
- types: "./dist/index.d.ts",
6765
- import: "./dist/index.mjs",
6766
- require: "./dist/index.js"
6767
- },
6768
- "./gemini": {
6769
- types: "./dist/integrations/gemini.d.ts",
6770
- import: "./dist/integrations/gemini.mjs",
6771
- require: "./dist/integrations/gemini.js"
6772
- }
6773
- },
6774
- scripts: {
6775
- build: "tsup --dts-resolve",
6776
- format: "prettier --write .",
6777
- "format:check": "prettier --check .",
6778
- typecheck: "tsc --noEmit",
6779
- lint: "eslint . --fix",
6780
- "lint:check": "eslint .",
6781
- test: "vitest run"
6782
- },
6783
- tsup: {
6784
- entry: [
6785
- "src/index.ts",
6786
- "src/integrations/gemini.ts",
6787
- "src/proto.ts"
6788
- ],
6789
- noExternal: [
6790
- "fishjam-openapi",
6791
- "fishjam-proto"
6792
- ],
6793
- minify: false,
6794
- format: [
6795
- "cjs",
6796
- "esm"
6797
- ],
6798
- outDir: "dist"
6799
- },
6800
- dependencies: {
6801
- uuid: "^11.1.0"
6802
- },
6803
- engines: {
6804
- node: ">=18"
6805
- },
6806
- peerDependencies: {
6807
- "@google/genai": "^1.0.0"
6808
- },
6809
- peerDependenciesMeta: {
6810
- "@google/genai": {
6811
- optional: true
7310
+ get middleware() {
7311
+ return this.configuration.middleware || [];
7312
+ }
7313
+ get queryParamsStringify() {
7314
+ return this.configuration.queryParamsStringify || querystring2;
7315
+ }
7316
+ get username() {
7317
+ return this.configuration.username;
7318
+ }
7319
+ get password() {
7320
+ return this.configuration.password;
7321
+ }
7322
+ get apiKey() {
7323
+ const apiKey = this.configuration.apiKey;
7324
+ if (apiKey) {
7325
+ return typeof apiKey === "function" ? apiKey : () => apiKey;
6812
7326
  }
6813
- },
6814
- devDependencies: {
6815
- "@fishjam-cloud/fishjam-openapi": "workspace:*",
7327
+ return void 0;
7328
+ }
7329
+ get accessToken() {
7330
+ const accessToken = this.configuration.accessToken;
7331
+ if (accessToken) {
7332
+ return typeof accessToken === "function" ? accessToken : async () => accessToken;
7333
+ }
7334
+ return void 0;
7335
+ }
7336
+ get headers() {
7337
+ return this.configuration.headers;
7338
+ }
7339
+ get credentials() {
7340
+ return this.configuration.credentials;
7341
+ }
7342
+ };
7343
+ var DefaultConfig2 = new Configuration2();
7344
+ var BaseAPI2 = class _BaseAPI2 {
7345
+ constructor(configuration = DefaultConfig2) {
7346
+ this.configuration = configuration;
7347
+ this.middleware = configuration.middleware;
7348
+ }
7349
+ static jsonRegex = /^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$/i;
7350
+ middleware;
7351
+ withMiddleware(...middlewares) {
7352
+ const next = this.clone();
7353
+ next.middleware = next.middleware.concat(...middlewares);
7354
+ return next;
7355
+ }
7356
+ withPreMiddleware(...preMiddlewares) {
7357
+ const middlewares = preMiddlewares.map((pre) => ({ pre }));
7358
+ return this.withMiddleware(...middlewares);
7359
+ }
7360
+ withPostMiddleware(...postMiddlewares) {
7361
+ const middlewares = postMiddlewares.map((post) => ({ post }));
7362
+ return this.withMiddleware(...middlewares);
7363
+ }
7364
+ /**
7365
+ * Check if the given MIME is a JSON MIME.
7366
+ * JSON MIME examples:
7367
+ * application/json
7368
+ * application/json; charset=UTF8
7369
+ * APPLICATION/JSON
7370
+ * application/vnd.company+json
7371
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
7372
+ * @return True if the given MIME is JSON, false otherwise.
7373
+ */
7374
+ isJsonMime(mime) {
7375
+ if (!mime) {
7376
+ return false;
7377
+ }
7378
+ return _BaseAPI2.jsonRegex.test(mime);
7379
+ }
7380
+ async request(context, initOverrides) {
7381
+ const { url, init } = await this.createFetchParams(context, initOverrides);
7382
+ const response = await this.fetchApi(url, init);
7383
+ if (response && response.status >= 200 && response.status < 300) {
7384
+ return response;
7385
+ }
7386
+ throw new ResponseError2(response, "Response returned an error code");
7387
+ }
7388
+ async createFetchParams(context, initOverrides) {
7389
+ let url = this.configuration.basePath + context.path;
7390
+ if (context.query !== void 0 && Object.keys(context.query).length !== 0) {
7391
+ url += "?" + this.configuration.queryParamsStringify(context.query);
7392
+ }
7393
+ const headers = Object.assign({}, this.configuration.headers, context.headers);
7394
+ Object.keys(headers).forEach((key) => headers[key] === void 0 ? delete headers[key] : {});
7395
+ const initOverrideFn = typeof initOverrides === "function" ? initOverrides : async () => initOverrides;
7396
+ const initParams = {
7397
+ method: context.method,
7398
+ headers,
7399
+ body: context.body,
7400
+ credentials: this.configuration.credentials
7401
+ };
7402
+ const overriddenInit = {
7403
+ ...initParams,
7404
+ ...await initOverrideFn({
7405
+ init: initParams,
7406
+ context
7407
+ })
7408
+ };
7409
+ let body;
7410
+ if (isFormData2(overriddenInit.body) || overriddenInit.body instanceof URLSearchParams || isBlob2(overriddenInit.body)) {
7411
+ body = overriddenInit.body;
7412
+ } else if (this.isJsonMime(headers["Content-Type"])) {
7413
+ body = JSON.stringify(overriddenInit.body);
7414
+ } else {
7415
+ body = overriddenInit.body;
7416
+ }
7417
+ const init = {
7418
+ ...overriddenInit,
7419
+ body
7420
+ };
7421
+ return { url, init };
7422
+ }
7423
+ fetchApi = async (url, init) => {
7424
+ let fetchParams = { url, init };
7425
+ for (const middleware of this.middleware) {
7426
+ if (middleware.pre) {
7427
+ fetchParams = await middleware.pre({
7428
+ fetch: this.fetchApi,
7429
+ ...fetchParams
7430
+ }) || fetchParams;
7431
+ }
7432
+ }
7433
+ let response = void 0;
7434
+ try {
7435
+ response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
7436
+ } catch (e) {
7437
+ for (const middleware of this.middleware) {
7438
+ if (middleware.onError) {
7439
+ response = await middleware.onError({
7440
+ fetch: this.fetchApi,
7441
+ url: fetchParams.url,
7442
+ init: fetchParams.init,
7443
+ error: e,
7444
+ response: response ? response.clone() : void 0
7445
+ }) || response;
7446
+ }
7447
+ }
7448
+ if (response === void 0) {
7449
+ if (e instanceof Error) {
7450
+ throw new FetchError2(e, "The request failed and the interceptors did not return an alternative response");
7451
+ } else {
7452
+ throw e;
7453
+ }
7454
+ }
7455
+ }
7456
+ for (const middleware of this.middleware) {
7457
+ if (middleware.post) {
7458
+ response = await middleware.post({
7459
+ fetch: this.fetchApi,
7460
+ url: fetchParams.url,
7461
+ init: fetchParams.init,
7462
+ response: response.clone()
7463
+ }) || response;
7464
+ }
7465
+ }
7466
+ return response;
7467
+ };
7468
+ /**
7469
+ * Create a shallow clone of `this` by constructing a new instance
7470
+ * and then shallow cloning data members.
7471
+ */
7472
+ clone() {
7473
+ const constructor = this.constructor;
7474
+ const next = new constructor(this.configuration);
7475
+ next.middleware = this.middleware.slice();
7476
+ return next;
7477
+ }
7478
+ };
7479
+ function isBlob2(value) {
7480
+ return typeof Blob !== "undefined" && value instanceof Blob;
7481
+ }
7482
+ function isFormData2(value) {
7483
+ return typeof FormData !== "undefined" && value instanceof FormData;
7484
+ }
7485
+ var ResponseError2 = class extends Error {
7486
+ constructor(response, msg) {
7487
+ super(msg);
7488
+ this.response = response;
7489
+ const actualProto = new.target.prototype;
7490
+ if (Object.setPrototypeOf) {
7491
+ Object.setPrototypeOf(this, actualProto);
7492
+ }
7493
+ }
7494
+ name = "ResponseError";
7495
+ };
7496
+ var FetchError2 = class extends Error {
7497
+ constructor(cause, msg) {
7498
+ super(msg);
7499
+ this.cause = cause;
7500
+ const actualProto = new.target.prototype;
7501
+ if (Object.setPrototypeOf) {
7502
+ Object.setPrototypeOf(this, actualProto);
7503
+ }
7504
+ }
7505
+ name = "FetchError";
7506
+ };
7507
+ var RequiredError2 = class extends Error {
7508
+ constructor(field, msg) {
7509
+ super(msg);
7510
+ this.field = field;
7511
+ const actualProto = new.target.prototype;
7512
+ if (Object.setPrototypeOf) {
7513
+ Object.setPrototypeOf(this, actualProto);
7514
+ }
7515
+ }
7516
+ name = "RequiredError";
7517
+ };
7518
+ function querystring2(params, prefix = "") {
7519
+ return Object.keys(params).map((key) => querystringSingleKey2(key, params[key], prefix)).filter((part) => part.length > 0).join("&");
7520
+ }
7521
+ function querystringSingleKey2(key, value, keyPrefix = "") {
7522
+ const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key);
7523
+ if (value instanceof Array) {
7524
+ const multiValue = value.map((singleValue) => encodeURIComponent(String(singleValue))).join(`&${encodeURIComponent(fullKey)}=`);
7525
+ return `${encodeURIComponent(fullKey)}=${multiValue}`;
7526
+ }
7527
+ if (value instanceof Set) {
7528
+ const valueAsArray = Array.from(value);
7529
+ return querystringSingleKey2(key, valueAsArray, keyPrefix);
7530
+ }
7531
+ if (value instanceof Date) {
7532
+ return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`;
7533
+ }
7534
+ if (value instanceof Object) {
7535
+ return querystring2(value, fullKey);
7536
+ }
7537
+ return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
7538
+ }
7539
+ function canConsumeForm(consumes) {
7540
+ for (const consume of consumes) {
7541
+ if (consume.contentType?.startsWith("multipart/form-data") == true) {
7542
+ return true;
7543
+ }
7544
+ }
7545
+ return false;
7546
+ }
7547
+ var JSONApiResponse2 = class {
7548
+ constructor(raw, transformer = (jsonValue) => jsonValue) {
7549
+ this.raw = raw;
7550
+ this.transformer = transformer;
7551
+ }
7552
+ async value() {
7553
+ return this.transformer(await this.raw.json());
7554
+ }
7555
+ };
7556
+ var VoidApiResponse2 = class {
7557
+ constructor(raw) {
7558
+ this.raw = raw;
7559
+ }
7560
+ async value() {
7561
+ return void 0;
7562
+ }
7563
+ };
7564
+ var TextApiResponse = class {
7565
+ constructor(raw) {
7566
+ this.raw = raw;
7567
+ }
7568
+ async value() {
7569
+ return await this.raw.text();
7570
+ }
7571
+ };
7572
+ function CompositionCreatedResponseFromJSON(json) {
7573
+ return CompositionCreatedResponseFromJSONTyped(json, false);
7574
+ }
7575
+ function CompositionCreatedResponseFromJSONTyped(json, ignoreDiscriminator) {
7576
+ if (json == null) {
7577
+ return json;
7578
+ }
7579
+ return {
7580
+ compositionId: json["composition_id"],
7581
+ apiUrl: json["api_url"]
7582
+ };
7583
+ }
7584
+ function CreateCompositionRequestToJSON(json) {
7585
+ return CreateCompositionRequestToJSONTyped(json, false);
7586
+ }
7587
+ function CreateCompositionRequestToJSONTyped(value, ignoreDiscriminator = false) {
7588
+ if (value == null) {
7589
+ return value;
7590
+ }
7591
+ return {
7592
+ autostart: value["autostart"],
7593
+ cleanup_without_inputs: value["cleanupWithoutInputs"]
7594
+ };
7595
+ }
7596
+ var CompositionsApi = class extends BaseAPI2 {
7597
+ /**
7598
+ * Creates request options for createComposition without sending the request
7599
+ */
7600
+ async createCompositionRequestOpts(requestParameters) {
7601
+ if (requestParameters["createCompositionRequest"] == null) {
7602
+ throw new RequiredError2(
7603
+ "createCompositionRequest",
7604
+ 'Required parameter "createCompositionRequest" was null or undefined when calling createComposition().'
7605
+ );
7606
+ }
7607
+ const queryParameters = {};
7608
+ const headerParameters = {};
7609
+ headerParameters["Content-Type"] = "application/json";
7610
+ if (this.configuration && this.configuration.accessToken) {
7611
+ const token = this.configuration.accessToken;
7612
+ const tokenString = await token("BearerAuth", []);
7613
+ if (tokenString) {
7614
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
7615
+ }
7616
+ }
7617
+ let urlPath = `/api/composition`;
7618
+ return {
7619
+ path: urlPath,
7620
+ method: "POST",
7621
+ headers: headerParameters,
7622
+ query: queryParameters,
7623
+ body: CreateCompositionRequestToJSON(requestParameters["createCompositionRequest"])
7624
+ };
7625
+ }
7626
+ /**
7627
+ * Create a composition
7628
+ */
7629
+ async createCompositionRaw(requestParameters, initOverrides) {
7630
+ const requestOptions = await this.createCompositionRequestOpts(requestParameters);
7631
+ const response = await this.request(requestOptions, initOverrides);
7632
+ return new JSONApiResponse2(response, (jsonValue) => CompositionCreatedResponseFromJSON(jsonValue));
7633
+ }
7634
+ /**
7635
+ * Create a composition
7636
+ */
7637
+ async createComposition(requestParameters, initOverrides) {
7638
+ const response = await this.createCompositionRaw(requestParameters, initOverrides);
7639
+ return await response.value();
7640
+ }
7641
+ /**
7642
+ * Creates request options for deleteComposition without sending the request
7643
+ */
7644
+ async deleteCompositionRequestOpts(requestParameters) {
7645
+ if (requestParameters["compositionId"] == null) {
7646
+ throw new RequiredError2(
7647
+ "compositionId",
7648
+ 'Required parameter "compositionId" was null or undefined when calling deleteComposition().'
7649
+ );
7650
+ }
7651
+ const queryParameters = {};
7652
+ const headerParameters = {};
7653
+ if (this.configuration && this.configuration.accessToken) {
7654
+ const token = this.configuration.accessToken;
7655
+ const tokenString = await token("BearerAuth", []);
7656
+ if (tokenString) {
7657
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
7658
+ }
7659
+ }
7660
+ let urlPath = `/api/composition/{composition_id}`;
7661
+ urlPath = urlPath.replace("{composition_id}", encodeURIComponent(String(requestParameters["compositionId"])));
7662
+ return {
7663
+ path: urlPath,
7664
+ method: "DELETE",
7665
+ headers: headerParameters,
7666
+ query: queryParameters
7667
+ };
7668
+ }
7669
+ /**
7670
+ * Delete a composition
7671
+ */
7672
+ async deleteCompositionRaw(requestParameters, initOverrides) {
7673
+ const requestOptions = await this.deleteCompositionRequestOpts(requestParameters);
7674
+ const response = await this.request(requestOptions, initOverrides);
7675
+ return new VoidApiResponse2(response);
7676
+ }
7677
+ /**
7678
+ * Delete a composition
7679
+ */
7680
+ async deleteComposition(requestParameters, initOverrides) {
7681
+ await this.deleteCompositionRaw(requestParameters, initOverrides);
7682
+ }
7683
+ /**
7684
+ * Creates request options for reset without sending the request
7685
+ */
7686
+ async resetRequestOpts(requestParameters) {
7687
+ if (requestParameters["compositionId"] == null) {
7688
+ throw new RequiredError2(
7689
+ "compositionId",
7690
+ 'Required parameter "compositionId" was null or undefined when calling reset().'
7691
+ );
7692
+ }
7693
+ const queryParameters = {};
7694
+ const headerParameters = {};
7695
+ if (this.configuration && this.configuration.accessToken) {
7696
+ const token = this.configuration.accessToken;
7697
+ const tokenString = await token("BearerAuth", []);
7698
+ if (tokenString) {
7699
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
7700
+ }
7701
+ }
7702
+ let urlPath = `/api/composition/{composition_id}/reset`;
7703
+ urlPath = urlPath.replace("{composition_id}", encodeURIComponent(String(requestParameters["compositionId"])));
7704
+ return {
7705
+ path: urlPath,
7706
+ method: "POST",
7707
+ headers: headerParameters,
7708
+ query: queryParameters
7709
+ };
7710
+ }
7711
+ /**
7712
+ * Reset a composition
7713
+ */
7714
+ async resetRaw(requestParameters, initOverrides) {
7715
+ const requestOptions = await this.resetRequestOpts(requestParameters);
7716
+ const response = await this.request(requestOptions, initOverrides);
7717
+ return new JSONApiResponse2(response);
7718
+ }
7719
+ /**
7720
+ * Reset a composition
7721
+ */
7722
+ async reset(requestParameters, initOverrides) {
7723
+ const response = await this.resetRaw(requestParameters, initOverrides);
7724
+ return await response.value();
7725
+ }
7726
+ /**
7727
+ * Creates request options for start without sending the request
7728
+ */
7729
+ async startRequestOpts(requestParameters) {
7730
+ if (requestParameters["compositionId"] == null) {
7731
+ throw new RequiredError2(
7732
+ "compositionId",
7733
+ 'Required parameter "compositionId" was null or undefined when calling start().'
7734
+ );
7735
+ }
7736
+ const queryParameters = {};
7737
+ const headerParameters = {};
7738
+ if (this.configuration && this.configuration.accessToken) {
7739
+ const token = this.configuration.accessToken;
7740
+ const tokenString = await token("BearerAuth", []);
7741
+ if (tokenString) {
7742
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
7743
+ }
7744
+ }
7745
+ let urlPath = `/api/composition/{composition_id}/start`;
7746
+ urlPath = urlPath.replace("{composition_id}", encodeURIComponent(String(requestParameters["compositionId"])));
7747
+ return {
7748
+ path: urlPath,
7749
+ method: "POST",
7750
+ headers: headerParameters,
7751
+ query: queryParameters
7752
+ };
7753
+ }
7754
+ /**
7755
+ * Start a composition
7756
+ */
7757
+ async startRaw(requestParameters, initOverrides) {
7758
+ const requestOptions = await this.startRequestOpts(requestParameters);
7759
+ const response = await this.request(requestOptions, initOverrides);
7760
+ return new JSONApiResponse2(response);
7761
+ }
7762
+ /**
7763
+ * Start a composition
7764
+ */
7765
+ async start(requestParameters, initOverrides) {
7766
+ const response = await this.startRaw(requestParameters, initOverrides);
7767
+ return await response.value();
7768
+ }
7769
+ };
7770
+ function SendCompositionEventRequestToJSON(json) {
7771
+ return SendCompositionEventRequestToJSONTyped(json, false);
7772
+ }
7773
+ function SendCompositionEventRequestToJSONTyped(value, ignoreDiscriminator = false) {
7774
+ if (value == null) {
7775
+ return value;
7776
+ }
7777
+ return {
7778
+ event_name: value["eventName"],
7779
+ data: value["data"]
7780
+ };
7781
+ }
7782
+ var EventsApi = class extends BaseAPI2 {
7783
+ /**
7784
+ * Creates request options for sendCompositionEvent without sending the request
7785
+ */
7786
+ async sendCompositionEventRequestOpts(requestParameters) {
7787
+ if (requestParameters["compositionId"] == null) {
7788
+ throw new RequiredError2(
7789
+ "compositionId",
7790
+ 'Required parameter "compositionId" was null or undefined when calling sendCompositionEvent().'
7791
+ );
7792
+ }
7793
+ if (requestParameters["sendCompositionEventRequest"] == null) {
7794
+ throw new RequiredError2(
7795
+ "sendCompositionEventRequest",
7796
+ 'Required parameter "sendCompositionEventRequest" was null or undefined when calling sendCompositionEvent().'
7797
+ );
7798
+ }
7799
+ const queryParameters = {};
7800
+ const headerParameters = {};
7801
+ headerParameters["Content-Type"] = "application/json";
7802
+ if (this.configuration && this.configuration.accessToken) {
7803
+ const token = this.configuration.accessToken;
7804
+ const tokenString = await token("BearerAuth", []);
7805
+ if (tokenString) {
7806
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
7807
+ }
7808
+ }
7809
+ let urlPath = `/api/composition/{composition_id}/event`;
7810
+ urlPath = urlPath.replace("{composition_id}", encodeURIComponent(String(requestParameters["compositionId"])));
7811
+ return {
7812
+ path: urlPath,
7813
+ method: "POST",
7814
+ headers: headerParameters,
7815
+ query: queryParameters,
7816
+ body: SendCompositionEventRequestToJSON(requestParameters["sendCompositionEventRequest"])
7817
+ };
7818
+ }
7819
+ /**
7820
+ * Send an event to templates
7821
+ */
7822
+ async sendCompositionEventRaw(requestParameters, initOverrides) {
7823
+ const requestOptions = await this.sendCompositionEventRequestOpts(requestParameters);
7824
+ const response = await this.request(requestOptions, initOverrides);
7825
+ return new JSONApiResponse2(response);
7826
+ }
7827
+ /**
7828
+ * Send an event to templates
7829
+ */
7830
+ async sendCompositionEvent(requestParameters, initOverrides) {
7831
+ const response = await this.sendCompositionEventRaw(requestParameters, initOverrides);
7832
+ return await response.value();
7833
+ }
7834
+ };
7835
+ function instanceOfMp4Input(value) {
7836
+ if (!("url" in value) || value["url"] === void 0) return false;
7837
+ if (!("type" in value) || value["type"] === void 0) return false;
7838
+ if (value["type"] !== "mp4") return false;
7839
+ return true;
7840
+ }
7841
+ function Mp4InputToJSON(json) {
7842
+ return Mp4InputToJSONTyped(json, false);
7843
+ }
7844
+ function Mp4InputToJSONTyped(value, ignoreDiscriminator = false) {
7845
+ if (value == null) {
7846
+ return value;
7847
+ }
7848
+ return {
7849
+ url: value["url"],
7850
+ loop: value["loop"],
7851
+ type: value["type"]
7852
+ };
7853
+ }
7854
+ function instanceOfRtmpInput(value) {
7855
+ if (!("streamKey" in value) && !("stream_key" in value) || value["streamKey"] === void 0 && value["stream_key"] === void 0)
7856
+ return false;
7857
+ if (!("type" in value) || value["type"] === void 0) return false;
7858
+ if (value["type"] !== "rtmp_server") return false;
7859
+ return true;
7860
+ }
7861
+ function RtmpInputToJSON(json) {
7862
+ return RtmpInputToJSONTyped(json, false);
7863
+ }
7864
+ function RtmpInputToJSONTyped(value, ignoreDiscriminator = false) {
7865
+ if (value == null) {
7866
+ return value;
7867
+ }
7868
+ return {
7869
+ stream_key: value["streamKey"],
7870
+ type: value["type"]
7871
+ };
7872
+ }
7873
+ function instanceOfWhepInput(value) {
7874
+ if (!("endpointUrl" in value) && !("endpoint_url" in value) || value["endpointUrl"] === void 0 && value["endpoint_url"] === void 0)
7875
+ return false;
7876
+ if (!("type" in value) || value["type"] === void 0) return false;
7877
+ if (value["type"] !== "whep_client") return false;
7878
+ return true;
7879
+ }
7880
+ function WhepInputToJSON(json) {
7881
+ return WhepInputToJSONTyped(json, false);
7882
+ }
7883
+ function WhepInputToJSONTyped(value, ignoreDiscriminator = false) {
7884
+ if (value == null) {
7885
+ return value;
7886
+ }
7887
+ return {
7888
+ endpoint_url: value["endpointUrl"],
7889
+ bearer_token: value["bearerToken"],
7890
+ video: value["video"],
7891
+ type: value["type"]
7892
+ };
7893
+ }
7894
+ function instanceOfWhipInput(value) {
7895
+ if (!("type" in value) || value["type"] === void 0) return false;
7896
+ if (value["type"] !== "whip_server") return false;
7897
+ return true;
7898
+ }
7899
+ function WhipInputToJSON(json) {
7900
+ return WhipInputToJSONTyped(json, false);
7901
+ }
7902
+ function WhipInputToJSONTyped(value, ignoreDiscriminator = false) {
7903
+ if (value == null) {
7904
+ return value;
7905
+ }
7906
+ return {
7907
+ bearer_token: value["bearerToken"],
7908
+ video: value["video"],
7909
+ type: value["type"]
7910
+ };
7911
+ }
7912
+ function RegisterInputToJSON(json) {
7913
+ return RegisterInputToJSONTyped(json, false);
7914
+ }
7915
+ function RegisterInputToJSONTyped(value, ignoreDiscriminator = false) {
7916
+ if (value == null) {
7917
+ return value;
7918
+ }
7919
+ if (typeof value !== "object") {
7920
+ return value;
7921
+ }
7922
+ if (instanceOfMp4Input(value)) {
7923
+ return Mp4InputToJSON(value);
7924
+ }
7925
+ if (instanceOfRtmpInput(value)) {
7926
+ return RtmpInputToJSON(value);
7927
+ }
7928
+ if (instanceOfWhepInput(value)) {
7929
+ return WhepInputToJSON(value);
7930
+ }
7931
+ if (instanceOfWhipInput(value)) {
7932
+ return WhipInputToJSON(value);
7933
+ }
7934
+ return {};
7935
+ }
7936
+ function RegisterInputResponseFromJSON(json) {
7937
+ return RegisterInputResponseFromJSONTyped(json, false);
7938
+ }
7939
+ function RegisterInputResponseFromJSONTyped(json, ignoreDiscriminator) {
7940
+ if (json == null) {
7941
+ return json;
7942
+ }
7943
+ return {
7944
+ bearerToken: json["bearer_token"] === void 0 ? void 0 : json["bearer_token"] === null ? null : json["bearer_token"],
7945
+ endpointRoute: json["endpoint_route"] === void 0 ? void 0 : json["endpoint_route"] === null ? null : json["endpoint_route"],
7946
+ videoDurationMs: json["video_duration_ms"] === void 0 ? void 0 : json["video_duration_ms"] === null ? null : json["video_duration_ms"],
7947
+ audioDurationMs: json["audio_duration_ms"] === void 0 ? void 0 : json["audio_duration_ms"] === null ? null : json["audio_duration_ms"],
7948
+ port: json["port"] === void 0 ? void 0 : json["port"] === null ? null : json["port"]
7949
+ };
7950
+ }
7951
+ function UnregisterInputToJSON(json) {
7952
+ return UnregisterInputToJSONTyped(json, false);
7953
+ }
7954
+ function UnregisterInputToJSONTyped(value, ignoreDiscriminator = false) {
7955
+ if (value == null) {
7956
+ return value;
7957
+ }
7958
+ return {
7959
+ schedule_time_ms: value["scheduleTimeMs"]
7960
+ };
7961
+ }
7962
+ var InputsApi = class extends BaseAPI2 {
7963
+ /**
7964
+ * Creates request options for registerInput without sending the request
7965
+ */
7966
+ async registerInputRequestOpts(requestParameters) {
7967
+ if (requestParameters["compositionId"] == null) {
7968
+ throw new RequiredError2(
7969
+ "compositionId",
7970
+ 'Required parameter "compositionId" was null or undefined when calling registerInput().'
7971
+ );
7972
+ }
7973
+ if (requestParameters["inputId"] == null) {
7974
+ throw new RequiredError2(
7975
+ "inputId",
7976
+ 'Required parameter "inputId" was null or undefined when calling registerInput().'
7977
+ );
7978
+ }
7979
+ if (requestParameters["registerInput"] == null) {
7980
+ throw new RequiredError2(
7981
+ "registerInput",
7982
+ 'Required parameter "registerInput" was null or undefined when calling registerInput().'
7983
+ );
7984
+ }
7985
+ const queryParameters = {};
7986
+ const headerParameters = {};
7987
+ headerParameters["Content-Type"] = "application/json";
7988
+ if (this.configuration && this.configuration.accessToken) {
7989
+ const token = this.configuration.accessToken;
7990
+ const tokenString = await token("BearerAuth", []);
7991
+ if (tokenString) {
7992
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
7993
+ }
7994
+ }
7995
+ let urlPath = `/api/composition/{composition_id}/input/{input_id}/register`;
7996
+ urlPath = urlPath.replace("{composition_id}", encodeURIComponent(String(requestParameters["compositionId"])));
7997
+ urlPath = urlPath.replace("{input_id}", encodeURIComponent(String(requestParameters["inputId"])));
7998
+ return {
7999
+ path: urlPath,
8000
+ method: "POST",
8001
+ headers: headerParameters,
8002
+ query: queryParameters,
8003
+ body: RegisterInputToJSON(requestParameters["registerInput"])
8004
+ };
8005
+ }
8006
+ /**
8007
+ * Register an input
8008
+ */
8009
+ async registerInputRaw(requestParameters, initOverrides) {
8010
+ const requestOptions = await this.registerInputRequestOpts(requestParameters);
8011
+ const response = await this.request(requestOptions, initOverrides);
8012
+ return new JSONApiResponse2(response, (jsonValue) => RegisterInputResponseFromJSON(jsonValue));
8013
+ }
8014
+ /**
8015
+ * Register an input
8016
+ */
8017
+ async registerInput(requestParameters, initOverrides) {
8018
+ const response = await this.registerInputRaw(requestParameters, initOverrides);
8019
+ return await response.value();
8020
+ }
8021
+ /**
8022
+ * Creates request options for unregisterInput without sending the request
8023
+ */
8024
+ async unregisterInputRequestOpts(requestParameters) {
8025
+ if (requestParameters["compositionId"] == null) {
8026
+ throw new RequiredError2(
8027
+ "compositionId",
8028
+ 'Required parameter "compositionId" was null or undefined when calling unregisterInput().'
8029
+ );
8030
+ }
8031
+ if (requestParameters["inputId"] == null) {
8032
+ throw new RequiredError2(
8033
+ "inputId",
8034
+ 'Required parameter "inputId" was null or undefined when calling unregisterInput().'
8035
+ );
8036
+ }
8037
+ if (requestParameters["unregisterInput"] == null) {
8038
+ throw new RequiredError2(
8039
+ "unregisterInput",
8040
+ 'Required parameter "unregisterInput" was null or undefined when calling unregisterInput().'
8041
+ );
8042
+ }
8043
+ const queryParameters = {};
8044
+ const headerParameters = {};
8045
+ headerParameters["Content-Type"] = "application/json";
8046
+ if (this.configuration && this.configuration.accessToken) {
8047
+ const token = this.configuration.accessToken;
8048
+ const tokenString = await token("BearerAuth", []);
8049
+ if (tokenString) {
8050
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
8051
+ }
8052
+ }
8053
+ let urlPath = `/api/composition/{composition_id}/input/{input_id}/unregister`;
8054
+ urlPath = urlPath.replace("{composition_id}", encodeURIComponent(String(requestParameters["compositionId"])));
8055
+ urlPath = urlPath.replace("{input_id}", encodeURIComponent(String(requestParameters["inputId"])));
8056
+ return {
8057
+ path: urlPath,
8058
+ method: "POST",
8059
+ headers: headerParameters,
8060
+ query: queryParameters,
8061
+ body: UnregisterInputToJSON(requestParameters["unregisterInput"])
8062
+ };
8063
+ }
8064
+ /**
8065
+ * Unregister an input
8066
+ */
8067
+ async unregisterInputRaw(requestParameters, initOverrides) {
8068
+ const requestOptions = await this.unregisterInputRequestOpts(requestParameters);
8069
+ const response = await this.request(requestOptions, initOverrides);
8070
+ return new JSONApiResponse2(response);
8071
+ }
8072
+ /**
8073
+ * Unregister an input
8074
+ */
8075
+ async unregisterInput(requestParameters, initOverrides) {
8076
+ const response = await this.unregisterInputRaw(requestParameters, initOverrides);
8077
+ return await response.value();
8078
+ }
8079
+ };
8080
+ var MediaTransportApi = class extends BaseAPI2 {
8081
+ /**
8082
+ * Creates request options for whepOffer without sending the request
8083
+ */
8084
+ async whepOfferRequestOpts(requestParameters) {
8085
+ if (requestParameters["compositionId"] == null) {
8086
+ throw new RequiredError2(
8087
+ "compositionId",
8088
+ 'Required parameter "compositionId" was null or undefined when calling whepOffer().'
8089
+ );
8090
+ }
8091
+ if (requestParameters["outputId"] == null) {
8092
+ throw new RequiredError2(
8093
+ "outputId",
8094
+ 'Required parameter "outputId" was null or undefined when calling whepOffer().'
8095
+ );
8096
+ }
8097
+ if (requestParameters["body"] == null) {
8098
+ throw new RequiredError2(
8099
+ "body",
8100
+ 'Required parameter "body" was null or undefined when calling whepOffer().'
8101
+ );
8102
+ }
8103
+ const queryParameters = {};
8104
+ const headerParameters = {};
8105
+ headerParameters["Content-Type"] = "application/sdp";
8106
+ if (this.configuration && this.configuration.accessToken) {
8107
+ const token = this.configuration.accessToken;
8108
+ const tokenString = await token("BearerAuth", []);
8109
+ if (tokenString) {
8110
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
8111
+ }
8112
+ }
8113
+ let urlPath = `/api/composition/{composition_id}/whep/{output_id}`;
8114
+ urlPath = urlPath.replace("{composition_id}", encodeURIComponent(String(requestParameters["compositionId"])));
8115
+ urlPath = urlPath.replace("{output_id}", encodeURIComponent(String(requestParameters["outputId"])));
8116
+ return {
8117
+ path: urlPath,
8118
+ method: "POST",
8119
+ headers: headerParameters,
8120
+ query: queryParameters,
8121
+ body: requestParameters["body"]
8122
+ };
8123
+ }
8124
+ /**
8125
+ * Play an output over WHEP
8126
+ */
8127
+ async whepOfferRaw(requestParameters, initOverrides) {
8128
+ const requestOptions = await this.whepOfferRequestOpts(requestParameters);
8129
+ const response = await this.request(requestOptions, initOverrides);
8130
+ if (this.isJsonMime(response.headers.get("content-type"))) {
8131
+ return new JSONApiResponse2(response);
8132
+ } else {
8133
+ return new TextApiResponse(response);
8134
+ }
8135
+ }
8136
+ /**
8137
+ * Play an output over WHEP
8138
+ */
8139
+ async whepOffer(requestParameters, initOverrides) {
8140
+ const response = await this.whepOfferRaw(requestParameters, initOverrides);
8141
+ return await response.value();
8142
+ }
8143
+ /**
8144
+ * Creates request options for whipOffer without sending the request
8145
+ */
8146
+ async whipOfferRequestOpts(requestParameters) {
8147
+ if (requestParameters["compositionId"] == null) {
8148
+ throw new RequiredError2(
8149
+ "compositionId",
8150
+ 'Required parameter "compositionId" was null or undefined when calling whipOffer().'
8151
+ );
8152
+ }
8153
+ if (requestParameters["inputId"] == null) {
8154
+ throw new RequiredError2(
8155
+ "inputId",
8156
+ 'Required parameter "inputId" was null or undefined when calling whipOffer().'
8157
+ );
8158
+ }
8159
+ if (requestParameters["body"] == null) {
8160
+ throw new RequiredError2(
8161
+ "body",
8162
+ 'Required parameter "body" was null or undefined when calling whipOffer().'
8163
+ );
8164
+ }
8165
+ const queryParameters = {};
8166
+ const headerParameters = {};
8167
+ headerParameters["Content-Type"] = "application/sdp";
8168
+ if (this.configuration && this.configuration.accessToken) {
8169
+ const token = this.configuration.accessToken;
8170
+ const tokenString = await token("BearerAuth", []);
8171
+ if (tokenString) {
8172
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
8173
+ }
8174
+ }
8175
+ let urlPath = `/api/composition/{composition_id}/whip/{input_id}`;
8176
+ urlPath = urlPath.replace("{composition_id}", encodeURIComponent(String(requestParameters["compositionId"])));
8177
+ urlPath = urlPath.replace("{input_id}", encodeURIComponent(String(requestParameters["inputId"])));
8178
+ return {
8179
+ path: urlPath,
8180
+ method: "POST",
8181
+ headers: headerParameters,
8182
+ query: queryParameters,
8183
+ body: requestParameters["body"]
8184
+ };
8185
+ }
8186
+ /**
8187
+ * Publish to an input over WHIP
8188
+ */
8189
+ async whipOfferRaw(requestParameters, initOverrides) {
8190
+ const requestOptions = await this.whipOfferRequestOpts(requestParameters);
8191
+ const response = await this.request(requestOptions, initOverrides);
8192
+ if (this.isJsonMime(response.headers.get("content-type"))) {
8193
+ return new JSONApiResponse2(response);
8194
+ } else {
8195
+ return new TextApiResponse(response);
8196
+ }
8197
+ }
8198
+ /**
8199
+ * Publish to an input over WHIP
8200
+ */
8201
+ async whipOffer(requestParameters, initOverrides) {
8202
+ const response = await this.whipOfferRaw(requestParameters, initOverrides);
8203
+ return await response.value();
8204
+ }
8205
+ };
8206
+ function instanceOfImage(value) {
8207
+ if (!("imageId" in value) && !("image_id" in value) || value["imageId"] === void 0 && value["image_id"] === void 0)
8208
+ return false;
8209
+ if (!("type" in value) || value["type"] === void 0) return false;
8210
+ if (value["type"] !== "image") return false;
8211
+ return true;
8212
+ }
8213
+ function ImageToJSON(json) {
8214
+ return ImageToJSONTyped(json, false);
8215
+ }
8216
+ function ImageToJSONTyped(value, ignoreDiscriminator = false) {
8217
+ if (value == null) {
8218
+ return value;
8219
+ }
8220
+ return {
8221
+ id: value["id"],
8222
+ image_id: value["imageId"],
8223
+ width: value["width"],
8224
+ height: value["height"],
8225
+ type: value["type"]
8226
+ };
8227
+ }
8228
+ function instanceOfInputStream(value) {
8229
+ if (!("inputId" in value) && !("input_id" in value) || value["inputId"] === void 0 && value["input_id"] === void 0)
8230
+ return false;
8231
+ if (!("type" in value) || value["type"] === void 0) return false;
8232
+ if (value["type"] !== "input_stream") return false;
8233
+ return true;
8234
+ }
8235
+ function InputStreamToJSON(json) {
8236
+ return InputStreamToJSONTyped(json, false);
8237
+ }
8238
+ function InputStreamToJSONTyped(value, ignoreDiscriminator = false) {
8239
+ if (value == null) {
8240
+ return value;
8241
+ }
8242
+ return {
8243
+ id: value["id"],
8244
+ input_id: value["inputId"],
8245
+ type: value["type"]
8246
+ };
8247
+ }
8248
+ function RescaleModeToJSON(value) {
8249
+ return value;
8250
+ }
8251
+ function VerticalAlignToJSON(value) {
8252
+ return value;
8253
+ }
8254
+ function BoxShadowToJSON(json) {
8255
+ return BoxShadowToJSONTyped(json, false);
8256
+ }
8257
+ function BoxShadowToJSONTyped(value, ignoreDiscriminator = false) {
8258
+ if (value == null) {
8259
+ return value;
8260
+ }
8261
+ return {
8262
+ offset_x: value["offsetX"],
8263
+ offset_y: value["offsetY"],
8264
+ color: value["color"],
8265
+ blur_radius: value["blurRadius"]
8266
+ };
8267
+ }
8268
+ function HorizontalAlignToJSON(value) {
8269
+ return value;
8270
+ }
8271
+ function instanceOfEasingFunctionBounce(value) {
8272
+ if (!("functionName" in value) && !("function_name" in value) || value["functionName"] === void 0 && value["function_name"] === void 0)
8273
+ return false;
8274
+ if (value["functionName"] !== "bounce" && value["function_name"] !== "bounce")
8275
+ return false;
8276
+ return true;
8277
+ }
8278
+ function EasingFunctionBounceToJSON(json) {
8279
+ return EasingFunctionBounceToJSONTyped(json, false);
8280
+ }
8281
+ function EasingFunctionBounceToJSONTyped(value, ignoreDiscriminator = false) {
8282
+ if (value == null) {
8283
+ return value;
8284
+ }
8285
+ return {
8286
+ function_name: value["functionName"]
8287
+ };
8288
+ }
8289
+ function instanceOfEasingFunctionCubicBezier(value) {
8290
+ if (!("points" in value) || value["points"] === void 0) return false;
8291
+ if (!("functionName" in value) && !("function_name" in value) || value["functionName"] === void 0 && value["function_name"] === void 0)
8292
+ return false;
8293
+ if (value["functionName"] !== "cubic_bezier" && value["function_name"] !== "cubic_bezier")
8294
+ return false;
8295
+ return true;
8296
+ }
8297
+ function EasingFunctionCubicBezierToJSON(json) {
8298
+ return EasingFunctionCubicBezierToJSONTyped(json, false);
8299
+ }
8300
+ function EasingFunctionCubicBezierToJSONTyped(value, ignoreDiscriminator = false) {
8301
+ if (value == null) {
8302
+ return value;
8303
+ }
8304
+ return {
8305
+ points: value["points"],
8306
+ function_name: value["functionName"]
8307
+ };
8308
+ }
8309
+ function instanceOfEasingFunctionLinear(value) {
8310
+ if (!("functionName" in value) && !("function_name" in value) || value["functionName"] === void 0 && value["function_name"] === void 0)
8311
+ return false;
8312
+ if (value["functionName"] !== "linear" && value["function_name"] !== "linear")
8313
+ return false;
8314
+ return true;
8315
+ }
8316
+ function EasingFunctionLinearToJSON(json) {
8317
+ return EasingFunctionLinearToJSONTyped(json, false);
8318
+ }
8319
+ function EasingFunctionLinearToJSONTyped(value, ignoreDiscriminator = false) {
8320
+ if (value == null) {
8321
+ return value;
8322
+ }
8323
+ return {
8324
+ function_name: value["functionName"]
8325
+ };
8326
+ }
8327
+ function EasingFunctionToJSON(json) {
8328
+ return EasingFunctionToJSONTyped(json, false);
8329
+ }
8330
+ function EasingFunctionToJSONTyped(value, ignoreDiscriminator = false) {
8331
+ if (value == null) {
8332
+ return value;
8333
+ }
8334
+ if (typeof value !== "object") {
8335
+ return value;
8336
+ }
8337
+ if (instanceOfEasingFunctionBounce(value)) {
8338
+ return EasingFunctionBounceToJSON(value);
8339
+ }
8340
+ if (instanceOfEasingFunctionCubicBezier(value)) {
8341
+ return EasingFunctionCubicBezierToJSON(value);
8342
+ }
8343
+ if (instanceOfEasingFunctionLinear(value)) {
8344
+ return EasingFunctionLinearToJSON(value);
8345
+ }
8346
+ return {};
8347
+ }
8348
+ function TransitionToJSON(json) {
8349
+ return TransitionToJSONTyped(json, false);
8350
+ }
8351
+ function TransitionToJSONTyped(value, ignoreDiscriminator = false) {
8352
+ if (value == null) {
8353
+ return value;
8354
+ }
8355
+ return {
8356
+ duration_ms: value["durationMs"],
8357
+ easing_function: EasingFunctionToJSON(value["easingFunction"]),
8358
+ should_interrupt: value["shouldInterrupt"]
8359
+ };
8360
+ }
8361
+ function instanceOfRescaler(value) {
8362
+ if (!("child" in value) || value["child"] === void 0) return false;
8363
+ if (!("type" in value) || value["type"] === void 0) return false;
8364
+ if (value["type"] !== "rescaler") return false;
8365
+ return true;
8366
+ }
8367
+ function RescalerToJSON(json) {
8368
+ return RescalerToJSONTyped(json, false);
8369
+ }
8370
+ function RescalerToJSONTyped(value, ignoreDiscriminator = false) {
8371
+ if (value == null) {
8372
+ return value;
8373
+ }
8374
+ return {
8375
+ id: value["id"],
8376
+ child: ComponentToJSON(value["child"]),
8377
+ mode: RescaleModeToJSON(value["mode"]),
8378
+ horizontal_align: HorizontalAlignToJSON(value["horizontalAlign"]),
8379
+ vertical_align: VerticalAlignToJSON(value["verticalAlign"]),
8380
+ width: value["width"],
8381
+ height: value["height"],
8382
+ top: value["top"],
8383
+ left: value["left"],
8384
+ bottom: value["bottom"],
8385
+ right: value["right"],
8386
+ rotation: value["rotation"],
8387
+ transition: TransitionToJSON(value["transition"]),
8388
+ border_radius: value["borderRadius"],
8389
+ border_width: value["borderWidth"],
8390
+ border_color: value["borderColor"],
8391
+ box_shadow: value["boxShadow"] == null ? void 0 : value["boxShadow"].map(BoxShadowToJSON),
8392
+ type: value["type"]
8393
+ };
8394
+ }
8395
+ function TextStyleToJSON(value) {
8396
+ return value;
8397
+ }
8398
+ function TextWeightToJSON(value) {
8399
+ return value;
8400
+ }
8401
+ function TextWrapModeToJSON(value) {
8402
+ return value;
8403
+ }
8404
+ function instanceOfText(value) {
8405
+ if (!("text" in value) || value["text"] === void 0) return false;
8406
+ if (!("fontSize" in value) && !("font_size" in value) || value["fontSize"] === void 0 && value["font_size"] === void 0)
8407
+ return false;
8408
+ if (!("type" in value) || value["type"] === void 0) return false;
8409
+ if (value["type"] !== "text") return false;
8410
+ return true;
8411
+ }
8412
+ function TextToJSON(json) {
8413
+ return TextToJSONTyped(json, false);
8414
+ }
8415
+ function TextToJSONTyped(value, ignoreDiscriminator = false) {
8416
+ if (value == null) {
8417
+ return value;
8418
+ }
8419
+ return {
8420
+ id: value["id"],
8421
+ text: value["text"],
8422
+ width: value["width"],
8423
+ height: value["height"],
8424
+ max_width: value["maxWidth"],
8425
+ max_height: value["maxHeight"],
8426
+ font_size: value["fontSize"],
8427
+ line_height: value["lineHeight"],
8428
+ color: value["color"],
8429
+ background_color: value["backgroundColor"],
8430
+ font_family: value["fontFamily"],
8431
+ style: TextStyleToJSON(value["style"]),
8432
+ align: HorizontalAlignToJSON(value["align"]),
8433
+ wrap: TextWrapModeToJSON(value["wrap"]),
8434
+ weight: TextWeightToJSON(value["weight"]),
8435
+ type: value["type"]
8436
+ };
8437
+ }
8438
+ function instanceOfTiles(value) {
8439
+ if (!("type" in value) || value["type"] === void 0) return false;
8440
+ if (value["type"] !== "tiles") return false;
8441
+ return true;
8442
+ }
8443
+ function TilesToJSON(json) {
8444
+ return TilesToJSONTyped(json, false);
8445
+ }
8446
+ function TilesToJSONTyped(value, ignoreDiscriminator = false) {
8447
+ if (value == null) {
8448
+ return value;
8449
+ }
8450
+ return {
8451
+ id: value["id"],
8452
+ children: value["children"] == null ? void 0 : value["children"].map(ComponentToJSON),
8453
+ width: value["width"],
8454
+ height: value["height"],
8455
+ background_color: value["backgroundColor"],
8456
+ tile_aspect_ratio: value["tileAspectRatio"],
8457
+ margin: value["margin"],
8458
+ padding: value["padding"],
8459
+ horizontal_align: HorizontalAlignToJSON(value["horizontalAlign"]),
8460
+ vertical_align: VerticalAlignToJSON(value["verticalAlign"]),
8461
+ transition: TransitionToJSON(value["transition"]),
8462
+ type: value["type"]
8463
+ };
8464
+ }
8465
+ function ViewDirectionToJSON(value) {
8466
+ return value;
8467
+ }
8468
+ function OverflowToJSON(value) {
8469
+ return value;
8470
+ }
8471
+ function instanceOfView(value) {
8472
+ if (!("type" in value) || value["type"] === void 0) return false;
8473
+ if (value["type"] !== "view") return false;
8474
+ return true;
8475
+ }
8476
+ function ViewToJSON(json) {
8477
+ return ViewToJSONTyped(json, false);
8478
+ }
8479
+ function ViewToJSONTyped(value, ignoreDiscriminator = false) {
8480
+ if (value == null) {
8481
+ return value;
8482
+ }
8483
+ return {
8484
+ id: value["id"],
8485
+ children: value["children"] == null ? void 0 : value["children"].map(ComponentToJSON),
8486
+ width: value["width"],
8487
+ height: value["height"],
8488
+ direction: ViewDirectionToJSON(value["direction"]),
8489
+ top: value["top"],
8490
+ left: value["left"],
8491
+ bottom: value["bottom"],
8492
+ right: value["right"],
8493
+ rotation: value["rotation"],
8494
+ transition: TransitionToJSON(value["transition"]),
8495
+ overflow: OverflowToJSON(value["overflow"]),
8496
+ background_color: value["backgroundColor"],
8497
+ border_radius: value["borderRadius"],
8498
+ border_width: value["borderWidth"],
8499
+ border_color: value["borderColor"],
8500
+ box_shadow: value["boxShadow"] == null ? void 0 : value["boxShadow"].map(BoxShadowToJSON),
8501
+ padding: value["padding"],
8502
+ padding_vertical: value["paddingVertical"],
8503
+ padding_horizontal: value["paddingHorizontal"],
8504
+ padding_top: value["paddingTop"],
8505
+ padding_right: value["paddingRight"],
8506
+ padding_bottom: value["paddingBottom"],
8507
+ padding_left: value["paddingLeft"],
8508
+ type: value["type"]
8509
+ };
8510
+ }
8511
+ function ComponentToJSON(json) {
8512
+ return ComponentToJSONTyped4(json, false);
8513
+ }
8514
+ function ComponentToJSONTyped4(value, ignoreDiscriminator = false) {
8515
+ if (value == null) {
8516
+ return value;
8517
+ }
8518
+ if (typeof value !== "object") {
8519
+ return value;
8520
+ }
8521
+ if (instanceOfImage(value)) {
8522
+ return ImageToJSON(value);
8523
+ }
8524
+ if (instanceOfInputStream(value)) {
8525
+ return InputStreamToJSON(value);
8526
+ }
8527
+ if (instanceOfRescaler(value)) {
8528
+ return RescalerToJSON(value);
8529
+ }
8530
+ if (instanceOfText(value)) {
8531
+ return TextToJSON(value);
8532
+ }
8533
+ if (instanceOfTiles(value)) {
8534
+ return TilesToJSON(value);
8535
+ }
8536
+ if (instanceOfView(value)) {
8537
+ return ViewToJSON(value);
8538
+ }
8539
+ return {};
8540
+ }
8541
+ function VideoSceneToJSON(json) {
8542
+ return VideoSceneToJSONTyped(json, false);
8543
+ }
8544
+ function VideoSceneToJSONTyped(value, ignoreDiscriminator = false) {
8545
+ if (value == null) {
8546
+ return value;
8547
+ }
8548
+ return {
8549
+ root: ComponentToJSON(value["root"])
8550
+ };
8551
+ }
8552
+ function OutputEndConditionToJSON(json) {
8553
+ return OutputEndConditionToJSONTyped(json, false);
8554
+ }
8555
+ function OutputEndConditionToJSONTyped(value, ignoreDiscriminator = false) {
8556
+ if (value == null) {
8557
+ return value;
8558
+ }
8559
+ return {
8560
+ any_of: value["anyOf"],
8561
+ all_of: value["allOf"],
8562
+ any_input: value["anyInput"],
8563
+ all_inputs: value["allInputs"]
8564
+ };
8565
+ }
8566
+ function ResolutionToJSON(json) {
8567
+ return ResolutionToJSONTyped(json, false);
8568
+ }
8569
+ function ResolutionToJSONTyped(value, ignoreDiscriminator = false) {
8570
+ if (value == null) {
8571
+ return value;
8572
+ }
8573
+ return {
8574
+ width: value["width"],
8575
+ height: value["height"]
8576
+ };
8577
+ }
8578
+ function OutputRtmpClientVideoOptionsToJSON(json) {
8579
+ return OutputRtmpClientVideoOptionsToJSONTyped(json, false);
8580
+ }
8581
+ function OutputRtmpClientVideoOptionsToJSONTyped(value, ignoreDiscriminator = false) {
8582
+ if (value == null) {
8583
+ return value;
8584
+ }
8585
+ return {
8586
+ resolution: ResolutionToJSON(value["resolution"]),
8587
+ send_eos_when: OutputEndConditionToJSON(value["sendEosWhen"]),
8588
+ initial: VideoSceneToJSON(value["initial"])
8589
+ };
8590
+ }
8591
+ function AudioChannelsToJSON(value) {
8592
+ return value;
8593
+ }
8594
+ function AudioMixingStrategyToJSON(value) {
8595
+ return value;
8596
+ }
8597
+ function AudioSceneInputToJSON(json) {
8598
+ return AudioSceneInputToJSONTyped(json, false);
8599
+ }
8600
+ function AudioSceneInputToJSONTyped(value, ignoreDiscriminator = false) {
8601
+ if (value == null) {
8602
+ return value;
8603
+ }
8604
+ return {
8605
+ input_id: value["inputId"],
8606
+ volume: value["volume"]
8607
+ };
8608
+ }
8609
+ function AudioSceneToJSON(json) {
8610
+ return AudioSceneToJSONTyped(json, false);
8611
+ }
8612
+ function AudioSceneToJSONTyped(value, ignoreDiscriminator = false) {
8613
+ if (value == null) {
8614
+ return value;
8615
+ }
8616
+ return {
8617
+ inputs: value["inputs"].map(AudioSceneInputToJSON)
8618
+ };
8619
+ }
8620
+ function OutputRtmpClientAudioOptionsToJSON(json) {
8621
+ return OutputRtmpClientAudioOptionsToJSONTyped(json, false);
8622
+ }
8623
+ function OutputRtmpClientAudioOptionsToJSONTyped(value, ignoreDiscriminator = false) {
8624
+ if (value == null) {
8625
+ return value;
8626
+ }
8627
+ return {
8628
+ mixing_strategy: AudioMixingStrategyToJSON(value["mixingStrategy"]),
8629
+ send_eos_when: OutputEndConditionToJSON(value["sendEosWhen"]),
8630
+ channels: AudioChannelsToJSON(value["channels"]),
8631
+ initial: AudioSceneToJSON(value["initial"])
8632
+ };
8633
+ }
8634
+ function instanceOfRtmpOutput(value) {
8635
+ if (!("url" in value) || value["url"] === void 0) return false;
8636
+ if (!("type" in value) || value["type"] === void 0) return false;
8637
+ if (value["type"] !== "rtmp_client") return false;
8638
+ return true;
8639
+ }
8640
+ function RtmpOutputToJSON(json) {
8641
+ return RtmpOutputToJSONTyped(json, false);
8642
+ }
8643
+ function RtmpOutputToJSONTyped(value, ignoreDiscriminator = false) {
8644
+ if (value == null) {
8645
+ return value;
8646
+ }
8647
+ return {
8648
+ url: value["url"],
8649
+ video: OutputRtmpClientVideoOptionsToJSON(value["video"]),
8650
+ audio: OutputRtmpClientAudioOptionsToJSON(value["audio"]),
8651
+ type: value["type"]
8652
+ };
8653
+ }
8654
+ function OutputWhipVideoOptionsToJSON(json) {
8655
+ return OutputWhipVideoOptionsToJSONTyped(json, false);
8656
+ }
8657
+ function OutputWhipVideoOptionsToJSONTyped(value, ignoreDiscriminator = false) {
8658
+ if (value == null) {
8659
+ return value;
8660
+ }
8661
+ return {
8662
+ resolution: ResolutionToJSON(value["resolution"]),
8663
+ send_eos_when: OutputEndConditionToJSON(value["sendEosWhen"]),
8664
+ initial: VideoSceneToJSON(value["initial"])
8665
+ };
8666
+ }
8667
+ function instanceOfWhipAudioEncoderOptionsAny(value) {
8668
+ if (!("type" in value) || value["type"] === void 0) return false;
8669
+ if (value["type"] !== "any") return false;
8670
+ return true;
8671
+ }
8672
+ function WhipAudioEncoderOptionsAnyToJSON(json) {
8673
+ return WhipAudioEncoderOptionsAnyToJSONTyped(json, false);
8674
+ }
8675
+ function WhipAudioEncoderOptionsAnyToJSONTyped(value, ignoreDiscriminator = false) {
8676
+ if (value == null) {
8677
+ return value;
8678
+ }
8679
+ return {
8680
+ type: value["type"]
8681
+ };
8682
+ }
8683
+ function OpusEncoderPresetToJSON(value) {
8684
+ return value;
8685
+ }
8686
+ function instanceOfWhipAudioEncoderOptionsOpus(value) {
8687
+ if (!("type" in value) || value["type"] === void 0) return false;
8688
+ if (value["type"] !== "opus") return false;
8689
+ return true;
8690
+ }
8691
+ function WhipAudioEncoderOptionsOpusToJSON(json) {
8692
+ return WhipAudioEncoderOptionsOpusToJSONTyped(json, false);
8693
+ }
8694
+ function WhipAudioEncoderOptionsOpusToJSONTyped(value, ignoreDiscriminator = false) {
8695
+ if (value == null) {
8696
+ return value;
8697
+ }
8698
+ return {
8699
+ preset: OpusEncoderPresetToJSON(value["preset"]),
8700
+ sample_rate: value["sampleRate"],
8701
+ forward_error_correction: value["forwardErrorCorrection"],
8702
+ type: value["type"]
8703
+ };
8704
+ }
8705
+ function WhipAudioEncoderOptionsToJSON(json) {
8706
+ return WhipAudioEncoderOptionsToJSONTyped(json, false);
8707
+ }
8708
+ function WhipAudioEncoderOptionsToJSONTyped(value, ignoreDiscriminator = false) {
8709
+ if (value == null) {
8710
+ return value;
8711
+ }
8712
+ if (typeof value !== "object") {
8713
+ return value;
8714
+ }
8715
+ if (instanceOfWhipAudioEncoderOptionsAny(value)) {
8716
+ return WhipAudioEncoderOptionsAnyToJSON(value);
8717
+ }
8718
+ if (instanceOfWhipAudioEncoderOptionsOpus(value)) {
8719
+ return WhipAudioEncoderOptionsOpusToJSON(value);
8720
+ }
8721
+ return {};
8722
+ }
8723
+ function OutputWhipAudioOptionsToJSON(json) {
8724
+ return OutputWhipAudioOptionsToJSONTyped(json, false);
8725
+ }
8726
+ function OutputWhipAudioOptionsToJSONTyped(value, ignoreDiscriminator = false) {
8727
+ if (value == null) {
8728
+ return value;
8729
+ }
8730
+ return {
8731
+ mixing_strategy: AudioMixingStrategyToJSON(value["mixingStrategy"]),
8732
+ send_eos_when: OutputEndConditionToJSON(value["sendEosWhen"]),
8733
+ channels: AudioChannelsToJSON(value["channels"]),
8734
+ encoder_preferences: value["encoderPreferences"] == null ? void 0 : value["encoderPreferences"].map(WhipAudioEncoderOptionsToJSON),
8735
+ initial: AudioSceneToJSON(value["initial"])
8736
+ };
8737
+ }
8738
+ function instanceOfWhipOutput(value) {
8739
+ if (!("endpointUrl" in value) && !("endpoint_url" in value) || value["endpointUrl"] === void 0 && value["endpoint_url"] === void 0)
8740
+ return false;
8741
+ if (!("type" in value) || value["type"] === void 0) return false;
8742
+ if (value["type"] !== "whip_client") return false;
8743
+ return true;
8744
+ }
8745
+ function WhipOutputToJSON(json) {
8746
+ return WhipOutputToJSONTyped(json, false);
8747
+ }
8748
+ function WhipOutputToJSONTyped(value, ignoreDiscriminator = false) {
8749
+ if (value == null) {
8750
+ return value;
8751
+ }
8752
+ return {
8753
+ endpoint_url: value["endpointUrl"],
8754
+ bearer_token: value["bearerToken"],
8755
+ video: OutputWhipVideoOptionsToJSON(value["video"]),
8756
+ audio: OutputWhipAudioOptionsToJSON(value["audio"]),
8757
+ type: value["type"]
8758
+ };
8759
+ }
8760
+ function RegisterOutputToJSON(json) {
8761
+ return RegisterOutputToJSONTyped(json, false);
8762
+ }
8763
+ function RegisterOutputToJSONTyped(value, ignoreDiscriminator = false) {
8764
+ if (value == null) {
8765
+ return value;
8766
+ }
8767
+ if (typeof value !== "object") {
8768
+ return value;
8769
+ }
8770
+ if (instanceOfRtmpOutput(value)) {
8771
+ return RtmpOutputToJSON(value);
8772
+ }
8773
+ if (instanceOfWhipOutput(value)) {
8774
+ return WhipOutputToJSON(value);
8775
+ }
8776
+ return {};
8777
+ }
8778
+ function UnregisterOutputToJSON(json) {
8779
+ return UnregisterOutputToJSONTyped(json, false);
8780
+ }
8781
+ function UnregisterOutputToJSONTyped(value, ignoreDiscriminator = false) {
8782
+ if (value == null) {
8783
+ return value;
8784
+ }
8785
+ return {
8786
+ schedule_time_ms: value["scheduleTimeMs"]
8787
+ };
8788
+ }
8789
+ function UpdateOutputRequestToJSON(json) {
8790
+ return UpdateOutputRequestToJSONTyped(json, false);
8791
+ }
8792
+ function UpdateOutputRequestToJSONTyped(value, ignoreDiscriminator = false) {
8793
+ if (value == null) {
8794
+ return value;
8795
+ }
8796
+ return {
8797
+ video: VideoSceneToJSON(value["video"]),
8798
+ audio: AudioSceneToJSON(value["audio"]),
8799
+ schedule_time_ms: value["scheduleTimeMs"]
8800
+ };
8801
+ }
8802
+ var OutputsApi = class extends BaseAPI2 {
8803
+ /**
8804
+ * Creates request options for registerOutput without sending the request
8805
+ */
8806
+ async registerOutputRequestOpts(requestParameters) {
8807
+ if (requestParameters["compositionId"] == null) {
8808
+ throw new RequiredError2(
8809
+ "compositionId",
8810
+ 'Required parameter "compositionId" was null or undefined when calling registerOutput().'
8811
+ );
8812
+ }
8813
+ if (requestParameters["outputId"] == null) {
8814
+ throw new RequiredError2(
8815
+ "outputId",
8816
+ 'Required parameter "outputId" was null or undefined when calling registerOutput().'
8817
+ );
8818
+ }
8819
+ if (requestParameters["registerOutput"] == null) {
8820
+ throw new RequiredError2(
8821
+ "registerOutput",
8822
+ 'Required parameter "registerOutput" was null or undefined when calling registerOutput().'
8823
+ );
8824
+ }
8825
+ const queryParameters = {};
8826
+ const headerParameters = {};
8827
+ headerParameters["Content-Type"] = "application/json";
8828
+ if (this.configuration && this.configuration.accessToken) {
8829
+ const token = this.configuration.accessToken;
8830
+ const tokenString = await token("BearerAuth", []);
8831
+ if (tokenString) {
8832
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
8833
+ }
8834
+ }
8835
+ let urlPath = `/api/composition/{composition_id}/output/{output_id}/register`;
8836
+ urlPath = urlPath.replace("{composition_id}", encodeURIComponent(String(requestParameters["compositionId"])));
8837
+ urlPath = urlPath.replace("{output_id}", encodeURIComponent(String(requestParameters["outputId"])));
8838
+ return {
8839
+ path: urlPath,
8840
+ method: "POST",
8841
+ headers: headerParameters,
8842
+ query: queryParameters,
8843
+ body: RegisterOutputToJSON(requestParameters["registerOutput"])
8844
+ };
8845
+ }
8846
+ /**
8847
+ * Register an output
8848
+ */
8849
+ async registerOutputRaw(requestParameters, initOverrides) {
8850
+ const requestOptions = await this.registerOutputRequestOpts(requestParameters);
8851
+ const response = await this.request(requestOptions, initOverrides);
8852
+ return new JSONApiResponse2(response);
8853
+ }
8854
+ /**
8855
+ * Register an output
8856
+ */
8857
+ async registerOutput(requestParameters, initOverrides) {
8858
+ const response = await this.registerOutputRaw(requestParameters, initOverrides);
8859
+ return await response.value();
8860
+ }
8861
+ /**
8862
+ * Creates request options for registerTemplateOutput without sending the request
8863
+ */
8864
+ async registerTemplateOutputRequestOpts(requestParameters) {
8865
+ if (requestParameters["compositionId"] == null) {
8866
+ throw new RequiredError2(
8867
+ "compositionId",
8868
+ 'Required parameter "compositionId" was null or undefined when calling registerTemplateOutput().'
8869
+ );
8870
+ }
8871
+ if (requestParameters["outputId"] == null) {
8872
+ throw new RequiredError2(
8873
+ "outputId",
8874
+ 'Required parameter "outputId" was null or undefined when calling registerTemplateOutput().'
8875
+ );
8876
+ }
8877
+ if (requestParameters["config"] == null) {
8878
+ throw new RequiredError2(
8879
+ "config",
8880
+ 'Required parameter "config" was null or undefined when calling registerTemplateOutput().'
8881
+ );
8882
+ }
8883
+ if (requestParameters["template"] == null) {
8884
+ throw new RequiredError2(
8885
+ "template",
8886
+ 'Required parameter "template" was null or undefined when calling registerTemplateOutput().'
8887
+ );
8888
+ }
8889
+ const queryParameters = {};
8890
+ const headerParameters = {};
8891
+ if (this.configuration && this.configuration.accessToken) {
8892
+ const token = this.configuration.accessToken;
8893
+ const tokenString = await token("BearerAuth", []);
8894
+ if (tokenString) {
8895
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
8896
+ }
8897
+ }
8898
+ const consumes = [{ contentType: "multipart/form-data" }];
8899
+ const canConsumeForm2 = canConsumeForm(consumes);
8900
+ let formParams;
8901
+ let useForm = false;
8902
+ useForm = canConsumeForm2;
8903
+ if (useForm) {
8904
+ formParams = new FormData();
8905
+ } else {
8906
+ formParams = new URLSearchParams();
8907
+ }
8908
+ if (requestParameters["config"] != null) {
8909
+ formParams.append(
8910
+ "config",
8911
+ new Blob([JSON.stringify(RegisterOutputToJSON(requestParameters["config"]))], { type: "application/json" })
8912
+ );
8913
+ }
8914
+ if (requestParameters["template"] != null) {
8915
+ formParams.append("template", requestParameters["template"]);
8916
+ }
8917
+ let urlPath = `/api/composition/{composition_id}/output/{output_id}/template`;
8918
+ urlPath = urlPath.replace("{composition_id}", encodeURIComponent(String(requestParameters["compositionId"])));
8919
+ urlPath = urlPath.replace("{output_id}", encodeURIComponent(String(requestParameters["outputId"])));
8920
+ return {
8921
+ path: urlPath,
8922
+ method: "POST",
8923
+ headers: headerParameters,
8924
+ query: queryParameters,
8925
+ body: formParams
8926
+ };
8927
+ }
8928
+ /**
8929
+ * Register a templated output
8930
+ */
8931
+ async registerTemplateOutputRaw(requestParameters, initOverrides) {
8932
+ const requestOptions = await this.registerTemplateOutputRequestOpts(requestParameters);
8933
+ const response = await this.request(requestOptions, initOverrides);
8934
+ return new JSONApiResponse2(response);
8935
+ }
8936
+ /**
8937
+ * Register a templated output
8938
+ */
8939
+ async registerTemplateOutput(requestParameters, initOverrides) {
8940
+ const response = await this.registerTemplateOutputRaw(requestParameters, initOverrides);
8941
+ return await response.value();
8942
+ }
8943
+ /**
8944
+ * Creates request options for requestKeyframe without sending the request
8945
+ */
8946
+ async requestKeyframeRequestOpts(requestParameters) {
8947
+ if (requestParameters["compositionId"] == null) {
8948
+ throw new RequiredError2(
8949
+ "compositionId",
8950
+ 'Required parameter "compositionId" was null or undefined when calling requestKeyframe().'
8951
+ );
8952
+ }
8953
+ if (requestParameters["outputId"] == null) {
8954
+ throw new RequiredError2(
8955
+ "outputId",
8956
+ 'Required parameter "outputId" was null or undefined when calling requestKeyframe().'
8957
+ );
8958
+ }
8959
+ const queryParameters = {};
8960
+ const headerParameters = {};
8961
+ if (this.configuration && this.configuration.accessToken) {
8962
+ const token = this.configuration.accessToken;
8963
+ const tokenString = await token("BearerAuth", []);
8964
+ if (tokenString) {
8965
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
8966
+ }
8967
+ }
8968
+ let urlPath = `/api/composition/{composition_id}/output/{output_id}/request_keyframe`;
8969
+ urlPath = urlPath.replace("{composition_id}", encodeURIComponent(String(requestParameters["compositionId"])));
8970
+ urlPath = urlPath.replace("{output_id}", encodeURIComponent(String(requestParameters["outputId"])));
8971
+ return {
8972
+ path: urlPath,
8973
+ method: "POST",
8974
+ headers: headerParameters,
8975
+ query: queryParameters
8976
+ };
8977
+ }
8978
+ /**
8979
+ * Request a keyframe
8980
+ */
8981
+ async requestKeyframeRaw(requestParameters, initOverrides) {
8982
+ const requestOptions = await this.requestKeyframeRequestOpts(requestParameters);
8983
+ const response = await this.request(requestOptions, initOverrides);
8984
+ return new JSONApiResponse2(response);
8985
+ }
8986
+ /**
8987
+ * Request a keyframe
8988
+ */
8989
+ async requestKeyframe(requestParameters, initOverrides) {
8990
+ const response = await this.requestKeyframeRaw(requestParameters, initOverrides);
8991
+ return await response.value();
8992
+ }
8993
+ /**
8994
+ * Creates request options for unregisterOutput without sending the request
8995
+ */
8996
+ async unregisterOutputRequestOpts(requestParameters) {
8997
+ if (requestParameters["compositionId"] == null) {
8998
+ throw new RequiredError2(
8999
+ "compositionId",
9000
+ 'Required parameter "compositionId" was null or undefined when calling unregisterOutput().'
9001
+ );
9002
+ }
9003
+ if (requestParameters["outputId"] == null) {
9004
+ throw new RequiredError2(
9005
+ "outputId",
9006
+ 'Required parameter "outputId" was null or undefined when calling unregisterOutput().'
9007
+ );
9008
+ }
9009
+ if (requestParameters["unregisterOutput"] == null) {
9010
+ throw new RequiredError2(
9011
+ "unregisterOutput",
9012
+ 'Required parameter "unregisterOutput" was null or undefined when calling unregisterOutput().'
9013
+ );
9014
+ }
9015
+ const queryParameters = {};
9016
+ const headerParameters = {};
9017
+ headerParameters["Content-Type"] = "application/json";
9018
+ if (this.configuration && this.configuration.accessToken) {
9019
+ const token = this.configuration.accessToken;
9020
+ const tokenString = await token("BearerAuth", []);
9021
+ if (tokenString) {
9022
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
9023
+ }
9024
+ }
9025
+ let urlPath = `/api/composition/{composition_id}/output/{output_id}/unregister`;
9026
+ urlPath = urlPath.replace("{composition_id}", encodeURIComponent(String(requestParameters["compositionId"])));
9027
+ urlPath = urlPath.replace("{output_id}", encodeURIComponent(String(requestParameters["outputId"])));
9028
+ return {
9029
+ path: urlPath,
9030
+ method: "POST",
9031
+ headers: headerParameters,
9032
+ query: queryParameters,
9033
+ body: UnregisterOutputToJSON(requestParameters["unregisterOutput"])
9034
+ };
9035
+ }
9036
+ /**
9037
+ * Unregister an output
9038
+ */
9039
+ async unregisterOutputRaw(requestParameters, initOverrides) {
9040
+ const requestOptions = await this.unregisterOutputRequestOpts(requestParameters);
9041
+ const response = await this.request(requestOptions, initOverrides);
9042
+ return new JSONApiResponse2(response);
9043
+ }
9044
+ /**
9045
+ * Unregister an output
9046
+ */
9047
+ async unregisterOutput(requestParameters, initOverrides) {
9048
+ const response = await this.unregisterOutputRaw(requestParameters, initOverrides);
9049
+ return await response.value();
9050
+ }
9051
+ /**
9052
+ * Creates request options for updateOutput without sending the request
9053
+ */
9054
+ async updateOutputRequestOpts(requestParameters) {
9055
+ if (requestParameters["compositionId"] == null) {
9056
+ throw new RequiredError2(
9057
+ "compositionId",
9058
+ 'Required parameter "compositionId" was null or undefined when calling updateOutput().'
9059
+ );
9060
+ }
9061
+ if (requestParameters["outputId"] == null) {
9062
+ throw new RequiredError2(
9063
+ "outputId",
9064
+ 'Required parameter "outputId" was null or undefined when calling updateOutput().'
9065
+ );
9066
+ }
9067
+ if (requestParameters["updateOutputRequest"] == null) {
9068
+ throw new RequiredError2(
9069
+ "updateOutputRequest",
9070
+ 'Required parameter "updateOutputRequest" was null or undefined when calling updateOutput().'
9071
+ );
9072
+ }
9073
+ const queryParameters = {};
9074
+ const headerParameters = {};
9075
+ headerParameters["Content-Type"] = "application/json";
9076
+ if (this.configuration && this.configuration.accessToken) {
9077
+ const token = this.configuration.accessToken;
9078
+ const tokenString = await token("BearerAuth", []);
9079
+ if (tokenString) {
9080
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
9081
+ }
9082
+ }
9083
+ let urlPath = `/api/composition/{composition_id}/output/{output_id}/update`;
9084
+ urlPath = urlPath.replace("{composition_id}", encodeURIComponent(String(requestParameters["compositionId"])));
9085
+ urlPath = urlPath.replace("{output_id}", encodeURIComponent(String(requestParameters["outputId"])));
9086
+ return {
9087
+ path: urlPath,
9088
+ method: "POST",
9089
+ headers: headerParameters,
9090
+ query: queryParameters,
9091
+ body: UpdateOutputRequestToJSON(requestParameters["updateOutputRequest"])
9092
+ };
9093
+ }
9094
+ /**
9095
+ * Update an output\'s scene
9096
+ */
9097
+ async updateOutputRaw(requestParameters, initOverrides) {
9098
+ const requestOptions = await this.updateOutputRequestOpts(requestParameters);
9099
+ const response = await this.request(requestOptions, initOverrides);
9100
+ return new JSONApiResponse2(response);
9101
+ }
9102
+ /**
9103
+ * Update an output\'s scene
9104
+ */
9105
+ async updateOutput(requestParameters, initOverrides) {
9106
+ const response = await this.updateOutputRaw(requestParameters, initOverrides);
9107
+ return await response.value();
9108
+ }
9109
+ };
9110
+ function instanceOfImageSpecAuto(value) {
9111
+ if (!("url" in value) || value["url"] === void 0) return false;
9112
+ if (!("assetType" in value) && !("asset_type" in value) || value["assetType"] === void 0 && value["asset_type"] === void 0)
9113
+ return false;
9114
+ if (value["assetType"] !== "auto" && value["asset_type"] !== "auto")
9115
+ return false;
9116
+ return true;
9117
+ }
9118
+ function ImageSpecAutoToJSON(json) {
9119
+ return ImageSpecAutoToJSONTyped(json, false);
9120
+ }
9121
+ function ImageSpecAutoToJSONTyped(value, ignoreDiscriminator = false) {
9122
+ if (value == null) {
9123
+ return value;
9124
+ }
9125
+ return {
9126
+ url: value["url"],
9127
+ asset_type: value["assetType"]
9128
+ };
9129
+ }
9130
+ function instanceOfImageSpecGif(value) {
9131
+ if (!("url" in value) || value["url"] === void 0) return false;
9132
+ if (!("assetType" in value) && !("asset_type" in value) || value["assetType"] === void 0 && value["asset_type"] === void 0)
9133
+ return false;
9134
+ if (value["assetType"] !== "gif" && value["asset_type"] !== "gif")
9135
+ return false;
9136
+ return true;
9137
+ }
9138
+ function ImageSpecGifToJSON(json) {
9139
+ return ImageSpecGifToJSONTyped(json, false);
9140
+ }
9141
+ function ImageSpecGifToJSONTyped(value, ignoreDiscriminator = false) {
9142
+ if (value == null) {
9143
+ return value;
9144
+ }
9145
+ return {
9146
+ url: value["url"],
9147
+ asset_type: value["assetType"]
9148
+ };
9149
+ }
9150
+ function instanceOfImageSpecJpeg(value) {
9151
+ if (!("url" in value) || value["url"] === void 0) return false;
9152
+ if (!("assetType" in value) && !("asset_type" in value) || value["assetType"] === void 0 && value["asset_type"] === void 0)
9153
+ return false;
9154
+ if (value["assetType"] !== "jpeg" && value["asset_type"] !== "jpeg")
9155
+ return false;
9156
+ return true;
9157
+ }
9158
+ function ImageSpecJpegToJSON(json) {
9159
+ return ImageSpecJpegToJSONTyped(json, false);
9160
+ }
9161
+ function ImageSpecJpegToJSONTyped(value, ignoreDiscriminator = false) {
9162
+ if (value == null) {
9163
+ return value;
9164
+ }
9165
+ return {
9166
+ url: value["url"],
9167
+ asset_type: value["assetType"]
9168
+ };
9169
+ }
9170
+ function instanceOfImageSpecPng(value) {
9171
+ if (!("url" in value) || value["url"] === void 0) return false;
9172
+ if (!("assetType" in value) && !("asset_type" in value) || value["assetType"] === void 0 && value["asset_type"] === void 0)
9173
+ return false;
9174
+ if (value["assetType"] !== "png" && value["asset_type"] !== "png")
9175
+ return false;
9176
+ return true;
9177
+ }
9178
+ function ImageSpecPngToJSON(json) {
9179
+ return ImageSpecPngToJSONTyped(json, false);
9180
+ }
9181
+ function ImageSpecPngToJSONTyped(value, ignoreDiscriminator = false) {
9182
+ if (value == null) {
9183
+ return value;
9184
+ }
9185
+ return {
9186
+ url: value["url"],
9187
+ asset_type: value["assetType"]
9188
+ };
9189
+ }
9190
+ function instanceOfImageSpecSvg(value) {
9191
+ if (!("url" in value) || value["url"] === void 0) return false;
9192
+ if (!("assetType" in value) && !("asset_type" in value) || value["assetType"] === void 0 && value["asset_type"] === void 0)
9193
+ return false;
9194
+ if (value["assetType"] !== "svg" && value["asset_type"] !== "svg")
9195
+ return false;
9196
+ return true;
9197
+ }
9198
+ function ImageSpecSvgToJSON(json) {
9199
+ return ImageSpecSvgToJSONTyped(json, false);
9200
+ }
9201
+ function ImageSpecSvgToJSONTyped(value, ignoreDiscriminator = false) {
9202
+ if (value == null) {
9203
+ return value;
9204
+ }
9205
+ return {
9206
+ url: value["url"],
9207
+ resolution: ResolutionToJSON(value["resolution"]),
9208
+ asset_type: value["assetType"]
9209
+ };
9210
+ }
9211
+ function ImageSpecToJSON(json) {
9212
+ return ImageSpecToJSONTyped(json, false);
9213
+ }
9214
+ function ImageSpecToJSONTyped(value, ignoreDiscriminator = false) {
9215
+ if (value == null) {
9216
+ return value;
9217
+ }
9218
+ if (typeof value !== "object") {
9219
+ return value;
9220
+ }
9221
+ if (instanceOfImageSpecAuto(value)) {
9222
+ return ImageSpecAutoToJSON(value);
9223
+ }
9224
+ if (instanceOfImageSpecGif(value)) {
9225
+ return ImageSpecGifToJSON(value);
9226
+ }
9227
+ if (instanceOfImageSpecJpeg(value)) {
9228
+ return ImageSpecJpegToJSON(value);
9229
+ }
9230
+ if (instanceOfImageSpecPng(value)) {
9231
+ return ImageSpecPngToJSON(value);
9232
+ }
9233
+ if (instanceOfImageSpecSvg(value)) {
9234
+ return ImageSpecSvgToJSON(value);
9235
+ }
9236
+ return {};
9237
+ }
9238
+ function UnregisterRendererToJSON(json) {
9239
+ return UnregisterRendererToJSONTyped(json, false);
9240
+ }
9241
+ function UnregisterRendererToJSONTyped(value, ignoreDiscriminator = false) {
9242
+ if (value == null) {
9243
+ return value;
9244
+ }
9245
+ return {
9246
+ schedule_time_ms: value["scheduleTimeMs"]
9247
+ };
9248
+ }
9249
+ var RenderersApi = class extends BaseAPI2 {
9250
+ /**
9251
+ * Creates request options for registerFont without sending the request
9252
+ */
9253
+ async registerFontRequestOpts(requestParameters) {
9254
+ if (requestParameters["compositionId"] == null) {
9255
+ throw new RequiredError2(
9256
+ "compositionId",
9257
+ 'Required parameter "compositionId" was null or undefined when calling registerFont().'
9258
+ );
9259
+ }
9260
+ if (requestParameters["font"] == null) {
9261
+ throw new RequiredError2(
9262
+ "font",
9263
+ 'Required parameter "font" was null or undefined when calling registerFont().'
9264
+ );
9265
+ }
9266
+ const queryParameters = {};
9267
+ const headerParameters = {};
9268
+ if (this.configuration && this.configuration.accessToken) {
9269
+ const token = this.configuration.accessToken;
9270
+ const tokenString = await token("BearerAuth", []);
9271
+ if (tokenString) {
9272
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
9273
+ }
9274
+ }
9275
+ const consumes = [{ contentType: "multipart/form-data" }];
9276
+ const canConsumeForm2 = canConsumeForm(consumes);
9277
+ let formParams;
9278
+ let useForm = false;
9279
+ useForm = canConsumeForm2;
9280
+ if (useForm) {
9281
+ formParams = new FormData();
9282
+ } else {
9283
+ formParams = new URLSearchParams();
9284
+ }
9285
+ if (requestParameters["font"] != null) {
9286
+ formParams.append("font", requestParameters["font"]);
9287
+ }
9288
+ let urlPath = `/api/composition/{composition_id}/font/register`;
9289
+ urlPath = urlPath.replace("{composition_id}", encodeURIComponent(String(requestParameters["compositionId"])));
9290
+ return {
9291
+ path: urlPath,
9292
+ method: "POST",
9293
+ headers: headerParameters,
9294
+ query: queryParameters,
9295
+ body: formParams
9296
+ };
9297
+ }
9298
+ /**
9299
+ * Register a font
9300
+ */
9301
+ async registerFontRaw(requestParameters, initOverrides) {
9302
+ const requestOptions = await this.registerFontRequestOpts(requestParameters);
9303
+ const response = await this.request(requestOptions, initOverrides);
9304
+ return new JSONApiResponse2(response);
9305
+ }
9306
+ /**
9307
+ * Register a font
9308
+ */
9309
+ async registerFont(requestParameters, initOverrides) {
9310
+ const response = await this.registerFontRaw(requestParameters, initOverrides);
9311
+ return await response.value();
9312
+ }
9313
+ /**
9314
+ * Creates request options for registerImage without sending the request
9315
+ */
9316
+ async registerImageRequestOpts(requestParameters) {
9317
+ if (requestParameters["compositionId"] == null) {
9318
+ throw new RequiredError2(
9319
+ "compositionId",
9320
+ 'Required parameter "compositionId" was null or undefined when calling registerImage().'
9321
+ );
9322
+ }
9323
+ if (requestParameters["imageId"] == null) {
9324
+ throw new RequiredError2(
9325
+ "imageId",
9326
+ 'Required parameter "imageId" was null or undefined when calling registerImage().'
9327
+ );
9328
+ }
9329
+ if (requestParameters["imageSpec"] == null) {
9330
+ throw new RequiredError2(
9331
+ "imageSpec",
9332
+ 'Required parameter "imageSpec" was null or undefined when calling registerImage().'
9333
+ );
9334
+ }
9335
+ const queryParameters = {};
9336
+ const headerParameters = {};
9337
+ headerParameters["Content-Type"] = "application/json";
9338
+ if (this.configuration && this.configuration.accessToken) {
9339
+ const token = this.configuration.accessToken;
9340
+ const tokenString = await token("BearerAuth", []);
9341
+ if (tokenString) {
9342
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
9343
+ }
9344
+ }
9345
+ let urlPath = `/api/composition/{composition_id}/image/{image_id}/register`;
9346
+ urlPath = urlPath.replace("{composition_id}", encodeURIComponent(String(requestParameters["compositionId"])));
9347
+ urlPath = urlPath.replace("{image_id}", encodeURIComponent(String(requestParameters["imageId"])));
9348
+ return {
9349
+ path: urlPath,
9350
+ method: "POST",
9351
+ headers: headerParameters,
9352
+ query: queryParameters,
9353
+ body: ImageSpecToJSON(requestParameters["imageSpec"])
9354
+ };
9355
+ }
9356
+ /**
9357
+ * Register an image
9358
+ */
9359
+ async registerImageRaw(requestParameters, initOverrides) {
9360
+ const requestOptions = await this.registerImageRequestOpts(requestParameters);
9361
+ const response = await this.request(requestOptions, initOverrides);
9362
+ return new JSONApiResponse2(response);
9363
+ }
9364
+ /**
9365
+ * Register an image
9366
+ */
9367
+ async registerImage(requestParameters, initOverrides) {
9368
+ const response = await this.registerImageRaw(requestParameters, initOverrides);
9369
+ return await response.value();
9370
+ }
9371
+ /**
9372
+ * Creates request options for unregisterImage without sending the request
9373
+ */
9374
+ async unregisterImageRequestOpts(requestParameters) {
9375
+ if (requestParameters["compositionId"] == null) {
9376
+ throw new RequiredError2(
9377
+ "compositionId",
9378
+ 'Required parameter "compositionId" was null or undefined when calling unregisterImage().'
9379
+ );
9380
+ }
9381
+ if (requestParameters["imageId"] == null) {
9382
+ throw new RequiredError2(
9383
+ "imageId",
9384
+ 'Required parameter "imageId" was null or undefined when calling unregisterImage().'
9385
+ );
9386
+ }
9387
+ if (requestParameters["unregisterRenderer"] == null) {
9388
+ throw new RequiredError2(
9389
+ "unregisterRenderer",
9390
+ 'Required parameter "unregisterRenderer" was null or undefined when calling unregisterImage().'
9391
+ );
9392
+ }
9393
+ const queryParameters = {};
9394
+ const headerParameters = {};
9395
+ headerParameters["Content-Type"] = "application/json";
9396
+ if (this.configuration && this.configuration.accessToken) {
9397
+ const token = this.configuration.accessToken;
9398
+ const tokenString = await token("BearerAuth", []);
9399
+ if (tokenString) {
9400
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
9401
+ }
9402
+ }
9403
+ let urlPath = `/api/composition/{composition_id}/image/{image_id}/unregister`;
9404
+ urlPath = urlPath.replace("{composition_id}", encodeURIComponent(String(requestParameters["compositionId"])));
9405
+ urlPath = urlPath.replace("{image_id}", encodeURIComponent(String(requestParameters["imageId"])));
9406
+ return {
9407
+ path: urlPath,
9408
+ method: "POST",
9409
+ headers: headerParameters,
9410
+ query: queryParameters,
9411
+ body: UnregisterRendererToJSON(requestParameters["unregisterRenderer"])
9412
+ };
9413
+ }
9414
+ /**
9415
+ * Unregister an image
9416
+ */
9417
+ async unregisterImageRaw(requestParameters, initOverrides) {
9418
+ const requestOptions = await this.unregisterImageRequestOpts(requestParameters);
9419
+ const response = await this.request(requestOptions, initOverrides);
9420
+ return new JSONApiResponse2(response);
9421
+ }
9422
+ /**
9423
+ * Unregister an image
9424
+ */
9425
+ async unregisterImage(requestParameters, initOverrides) {
9426
+ const response = await this.unregisterImageRaw(requestParameters, initOverrides);
9427
+ return await response.value();
9428
+ }
9429
+ };
9430
+
9431
+ // src/exceptions/mapper.ts
9432
+ var notFoundException = (info, entity) => {
9433
+ switch (entity) {
9434
+ case "composition":
9435
+ return new CompositionNotFoundException(info);
9436
+ case "credentials":
9437
+ return new InvalidFishjamCredentialsException(info);
9438
+ case "input":
9439
+ return new InputNotFoundException(info);
9440
+ case "output":
9441
+ return new OutputNotFoundException(info);
9442
+ case "peer":
9443
+ return new PeerNotFoundException(info);
9444
+ case "recording":
9445
+ return new RecordingNotFoundException(info);
9446
+ case "renderer":
9447
+ return new RendererNotFoundException(info);
9448
+ case "room":
9449
+ return new RoomNotFoundException(info);
9450
+ default:
9451
+ return new FishjamNotFoundException(info);
9452
+ }
9453
+ };
9454
+ var mapException = async (error, entity) => {
9455
+ if (error instanceof FetchError || error instanceof FetchError2) {
9456
+ return new UnknownException({ message: error.cause.message, statusCode: 500, details: error.cause.message });
9457
+ }
9458
+ if (!(error instanceof ResponseError) && !(error instanceof ResponseError2)) {
9459
+ return error;
9460
+ }
9461
+ const status = error.response.status;
9462
+ const body = await error.response.json().catch(() => ({}));
9463
+ const info = {
9464
+ message: `Request failed with status code ${status}`,
9465
+ statusCode: status,
9466
+ details: body["detail"] ?? body["errors"] ?? body["message"] ?? "Unknown error"
9467
+ };
9468
+ switch (status) {
9469
+ case 400:
9470
+ case 422:
9471
+ return new BadRequestException(info);
9472
+ case 402:
9473
+ return new QuotaExceededException(info);
9474
+ case 401:
9475
+ return new UnauthorizedException(info);
9476
+ case 404:
9477
+ return notFoundException(info, entity);
9478
+ case 503:
9479
+ return new ServiceUnavailableException(info);
9480
+ default:
9481
+ return new UnknownException(info);
9482
+ }
9483
+ };
9484
+
9485
+ // package.json
9486
+ var package_default = {
9487
+ name: "@fishjam-cloud/js-server-sdk",
9488
+ version: "0.30.0",
9489
+ description: "Fishjam server SDK for JavaScript",
9490
+ homepage: "https://github.com/fishjam-cloud/js-server-sdk",
9491
+ author: "Fishjam Team",
9492
+ repository: {
9493
+ type: "git",
9494
+ url: "https://github.com/fishjam-cloud/js-server-sdk.git"
9495
+ },
9496
+ bugs: {
9497
+ url: "https://github.com/fishjam-cloud/js-server-sdk/issues"
9498
+ },
9499
+ license: "Apache-2.0",
9500
+ keywords: [
9501
+ "webrtc",
9502
+ "fishjam",
9503
+ "server",
9504
+ "membrane"
9505
+ ],
9506
+ main: "./dist/index.js",
9507
+ types: "./dist/index.d.ts",
9508
+ files: [
9509
+ "dist"
9510
+ ],
9511
+ exports: {
9512
+ ".": {
9513
+ types: "./dist/index.d.ts",
9514
+ import: "./dist/index.mjs",
9515
+ require: "./dist/index.js"
9516
+ },
9517
+ "./gemini": {
9518
+ types: "./dist/integrations/gemini.d.ts",
9519
+ import: "./dist/integrations/gemini.mjs",
9520
+ require: "./dist/integrations/gemini.js"
9521
+ }
9522
+ },
9523
+ scripts: {
9524
+ build: "tsup --dts-resolve",
9525
+ format: "prettier --write .",
9526
+ "format:check": "prettier --check .",
9527
+ typecheck: "tsc --noEmit",
9528
+ lint: "eslint . --fix",
9529
+ "lint:check": "eslint .",
9530
+ test: "vitest run"
9531
+ },
9532
+ tsup: {
9533
+ entry: [
9534
+ "src/index.ts",
9535
+ "src/integrations/gemini.ts",
9536
+ "src/proto.ts"
9537
+ ],
9538
+ noExternal: [
9539
+ "composition-openapi",
9540
+ "fishjam-openapi",
9541
+ "fishjam-proto"
9542
+ ],
9543
+ minify: false,
9544
+ format: [
9545
+ "cjs",
9546
+ "esm"
9547
+ ],
9548
+ outDir: "dist"
9549
+ },
9550
+ dependencies: {
9551
+ uuid: "^11.1.0"
9552
+ },
9553
+ engines: {
9554
+ node: ">=18"
9555
+ },
9556
+ peerDependencies: {
9557
+ "@google/genai": "^1.0.0"
9558
+ },
9559
+ peerDependenciesMeta: {
9560
+ "@google/genai": {
9561
+ optional: true
9562
+ }
9563
+ },
9564
+ devDependencies: {
9565
+ "@fishjam-cloud/composition-openapi": "workspace:*",
9566
+ "@fishjam-cloud/fishjam-openapi": "workspace:*",
6816
9567
  "@fishjam-cloud/fishjam-proto": "workspace:*",
6817
9568
  "@openapitools/openapi-generator-cli": "^2.18.4",
6818
9569
  "@types/node": "^22.13.16",
@@ -6837,6 +9588,8 @@ var FishjamClient = class _FishjamClient {
6837
9588
  viewerApi;
6838
9589
  streamerApi;
6839
9590
  credentialsApi;
9591
+ recordingsApi;
9592
+ trackForwardingsApi;
6840
9593
  fishjamConfig;
6841
9594
  deprecationWarningShown = false;
6842
9595
  /**
@@ -6874,6 +9627,8 @@ var FishjamClient = class _FishjamClient {
6874
9627
  this.viewerApi = new ViewersApi(apiConfig);
6875
9628
  this.streamerApi = new StreamersApi(apiConfig);
6876
9629
  this.credentialsApi = new CredentialsApi(apiConfig);
9630
+ this.recordingsApi = new RecordingsApi(apiConfig);
9631
+ this.trackForwardingsApi = new TrackForwardingsApi(apiConfig);
6877
9632
  this.fishjamConfig = config;
6878
9633
  }
6879
9634
  /**
@@ -7059,6 +9814,29 @@ var FishjamClient = class _FishjamClient {
7059
9814
  throw await mapException(error, "peer");
7060
9815
  }
7061
9816
  }
9817
+ /**
9818
+ * Forwards every track published in the room into a composition, which composes them into
9819
+ * its outputs. Pass the composition's address, as returned by
9820
+ * {@link CompositionClient.compositionUrl}.
9821
+ */
9822
+ async forwardRoomTracks(roomId, compositionUrl) {
9823
+ try {
9824
+ await this.trackForwardingsApi.createTrackForwarding({
9825
+ roomId,
9826
+ trackForwarding: { compositionURL: compositionUrl }
9827
+ });
9828
+ } catch (error) {
9829
+ throw await mapException(error, "room");
9830
+ }
9831
+ }
9832
+ /**
9833
+ * Where to publish a livestream, paired with a token from
9834
+ * {@link FishjamClient.createLivestreamStreamerToken}. A composition reaches viewers by
9835
+ * sending a WHIP output here.
9836
+ */
9837
+ livestreamWhipUrl() {
9838
+ return getLivestreamWhipUrl(this.fishjamConfig);
9839
+ }
7062
9840
  /**
7063
9841
  * Creates a livestream viewer token for the given room.
7064
9842
  * @returns a livestream viewer token
@@ -7092,25 +9870,343 @@ var FishjamClient = class _FishjamClient {
7092
9870
  throw await mapException(error);
7093
9871
  }
7094
9872
  }
9873
+ /**
9874
+ * Create a new recording. Capturing starts synchronously, so the returned recording is `active`.
9875
+ */
9876
+ async createRecording(config) {
9877
+ try {
9878
+ const { data } = await this.recordingsApi.createRecording({ recordingConfig: config });
9879
+ return data;
9880
+ } catch (error) {
9881
+ throw await mapException(error);
9882
+ }
9883
+ }
9884
+ /**
9885
+ * Get details about a given recording.
9886
+ */
9887
+ async getRecording(recordingId) {
9888
+ try {
9889
+ const { data } = await this.recordingsApi.getRecording({ recordingId });
9890
+ return data;
9891
+ } catch (error) {
9892
+ throw await mapException(error, "recording");
9893
+ }
9894
+ }
9895
+ /**
9896
+ * Get a list of all recordings, optionally filtered by metadata.
9897
+ * Returns recordings whose metadata contains all the given key-value pairs.
9898
+ */
9899
+ async getAllRecordings(metadata) {
9900
+ const metadataQuery = metadata ? Object.fromEntries(Object.entries(metadata).map(([key, value]) => [`metadata[${key}]`, value])) : void 0;
9901
+ try {
9902
+ const { data } = await this.recordingsApi.listRecordings({ metadata: metadataQuery });
9903
+ return data ?? [];
9904
+ } catch (error) {
9905
+ throw await mapException(error);
9906
+ }
9907
+ }
9908
+ /**
9909
+ * Stop an active recording. Finalization is asynchronous: the recording stays `active` until
9910
+ * the capture is finalized, then becomes `finished`. Stopping a recording that is no longer active is a no-op.
9911
+ */
9912
+ async stopRecording(recordingId) {
9913
+ try {
9914
+ const { data } = await this.recordingsApi.stopRecording({ recordingId });
9915
+ return data;
9916
+ } catch (error) {
9917
+ throw await mapException(error, "recording");
9918
+ }
9919
+ }
9920
+ /**
9921
+ * Delete a recording. Its stored media is removed asynchronously.
9922
+ * A recording that is still `active` cannot be deleted — stop it first or wait for it to finish.
9923
+ */
9924
+ async deleteRecording(recordingId) {
9925
+ try {
9926
+ await this.recordingsApi.deleteRecording({ recordingId });
9927
+ } catch (error) {
9928
+ throw await mapException(error, "recording");
9929
+ }
9930
+ }
9931
+ };
9932
+
9933
+ // src/composition.ts
9934
+ var CompositionClient = class {
9935
+ compositionsApi;
9936
+ eventsApi;
9937
+ inputsApi;
9938
+ mediaTransportApi;
9939
+ outputsApi;
9940
+ renderersApi;
9941
+ baseUrl;
9942
+ constructor(config) {
9943
+ this.baseUrl = getCompositionOrigin(config);
9944
+ const apiConfig = new Configuration2({
9945
+ basePath: this.baseUrl,
9946
+ headers: { Authorization: `Bearer ${config.managementToken}` }
9947
+ });
9948
+ this.compositionsApi = new CompositionsApi(apiConfig);
9949
+ this.eventsApi = new EventsApi(apiConfig);
9950
+ this.inputsApi = new InputsApi(apiConfig);
9951
+ this.mediaTransportApi = new MediaTransportApi(apiConfig);
9952
+ this.outputsApi = new OutputsApi(apiConfig);
9953
+ this.renderersApi = new RenderersApi(apiConfig);
9954
+ }
9955
+ /**
9956
+ * Create a new composition. Inputs registered on it are composed into the scenes its outputs render.
9957
+ */
9958
+ async createComposition(config = {}) {
9959
+ try {
9960
+ return await this.compositionsApi.createComposition({ createCompositionRequest: config });
9961
+ } catch (error) {
9962
+ throw await mapException(error);
9963
+ }
9964
+ }
9965
+ /**
9966
+ * The address of a composition, as other services refer to it. Fishjam needs it to forward a
9967
+ * room's tracks with {@link FishjamClient.forwardRoomTracks}.
9968
+ */
9969
+ compositionUrl(compositionId) {
9970
+ return new URL(`/api/composition/${compositionId}`, this.baseUrl).href;
9971
+ }
9972
+ /**
9973
+ * Start a composition created with `autostart` disabled. Its outputs begin producing audio and video.
9974
+ */
9975
+ async startComposition(compositionId) {
9976
+ try {
9977
+ await this.compositionsApi.start({ compositionId });
9978
+ } catch (error) {
9979
+ throw await mapException(error, "composition");
9980
+ }
9981
+ }
9982
+ /**
9983
+ * Reset a composition, tearing down its scene while keeping the composition itself alive.
9984
+ */
9985
+ async resetComposition(compositionId) {
9986
+ try {
9987
+ await this.compositionsApi.reset({ compositionId });
9988
+ } catch (error) {
9989
+ throw await mapException(error, "composition");
9990
+ }
9991
+ }
9992
+ /**
9993
+ * Delete an existing composition. Its inputs and outputs are torn down with it.
9994
+ */
9995
+ async deleteComposition(compositionId) {
9996
+ try {
9997
+ await this.compositionsApi.deleteComposition({ compositionId });
9998
+ } catch (error) {
9999
+ throw await mapException(error, "composition");
10000
+ }
10001
+ }
10002
+ /**
10003
+ * Register a media source on a composition. Prefer the variant methods, such as
10004
+ * {@link CompositionClient.registerWhipInput}, which return what that input type produces.
10005
+ */
10006
+ async registerInput(compositionId, inputId, input) {
10007
+ try {
10008
+ return await this.inputsApi.registerInput({ compositionId, inputId, registerInput: input });
10009
+ } catch (error) {
10010
+ throw await mapException(error, "composition");
10011
+ }
10012
+ }
10013
+ /**
10014
+ * Register an input that a WHIP publisher pushes media into.
10015
+ * @returns the address and token to publish with, see {@link WhipInputTarget}
10016
+ */
10017
+ async registerWhipInput(compositionId, inputId, options = {}) {
10018
+ const { bearerToken, endpointRoute } = await this.registerInput(compositionId, inputId, {
10019
+ ...options,
10020
+ type: "whip_server"
10021
+ });
10022
+ if (!bearerToken) {
10023
+ throw new UnknownException({
10024
+ message: `Could not obtain a publishing token for input "${inputId}", retry or report it`
10025
+ });
10026
+ }
10027
+ const url = endpointRoute ? `${this.compositionUrl(compositionId)}/${endpointRoute.replace(/^\//, "")}` : await this.whipPath(compositionId, inputId);
10028
+ return { url, bearerToken };
10029
+ }
10030
+ /**
10031
+ * Where WHIP publishing is served, for servers that do not report the route themselves.
10032
+ */
10033
+ async whipPath(compositionId, inputId) {
10034
+ const { path } = await this.mediaTransportApi.whipOfferRequestOpts({ compositionId, inputId, body: "" });
10035
+ return new URL(path, this.baseUrl).href;
10036
+ }
10037
+ /**
10038
+ * Register an input that pulls media from a WHEP endpoint.
10039
+ */
10040
+ async registerWhepInput(compositionId, inputId, options) {
10041
+ await this.registerInput(compositionId, inputId, { ...options, type: "whep_client" });
10042
+ }
10043
+ /**
10044
+ * Register an input that plays an MP4 file.
10045
+ * @returns how much media the file holds, see {@link Mp4InputDurations}
10046
+ */
10047
+ async registerMp4Input(compositionId, inputId, options) {
10048
+ const { videoDurationMs, audioDurationMs } = await this.registerInput(compositionId, inputId, {
10049
+ ...options,
10050
+ type: "mp4"
10051
+ });
10052
+ return { videoDurationMs: videoDurationMs ?? void 0, audioDurationMs: audioDurationMs ?? void 0 };
10053
+ }
10054
+ /**
10055
+ * Register an input that an RTMP publisher pushes media into. The stream key identifies the
10056
+ * input; the address to publish to belongs to the composition, not to this call.
10057
+ */
10058
+ async registerRtmpInput(compositionId, inputId, options) {
10059
+ await this.registerInput(compositionId, inputId, { ...options, type: "rtmp_server" });
10060
+ }
10061
+ /**
10062
+ * Unregister an input. Scenes referencing it stop receiving its media.
10063
+ */
10064
+ async unregisterInput(compositionId, inputId, options = {}) {
10065
+ try {
10066
+ await this.inputsApi.unregisterInput({ compositionId, inputId, unregisterInput: options });
10067
+ } catch (error) {
10068
+ throw await mapException(error, "input");
10069
+ }
10070
+ }
10071
+ /**
10072
+ * Register an output, the destination the composed result is sent to, carrying the scene to render.
10073
+ */
10074
+ async registerOutput(compositionId, outputId, output) {
10075
+ try {
10076
+ await this.outputsApi.registerOutput({ compositionId, outputId, registerOutput: output });
10077
+ } catch (error) {
10078
+ throw await mapException(error, "composition");
10079
+ }
10080
+ }
10081
+ /**
10082
+ * Register an output rendering a template bundle, as built by `@fishjam-cloud/composition-cli`.
10083
+ * The bundle is either a `Blob` or a path to read it from; never pass a path taken from
10084
+ * untrusted input, since its contents are uploaded.
10085
+ */
10086
+ async registerTemplateOutput(compositionId, outputId, config, template) {
10087
+ try {
10088
+ await this.outputsApi.registerTemplateOutput({
10089
+ compositionId,
10090
+ outputId,
10091
+ config,
10092
+ template: await toBlob(template)
10093
+ });
10094
+ } catch (error) {
10095
+ throw await mapException(error, "composition");
10096
+ }
10097
+ }
10098
+ /**
10099
+ * Register an output sending the composed result to a WHIP endpoint.
10100
+ */
10101
+ async registerWhipOutput(compositionId, outputId, options) {
10102
+ await this.registerOutput(compositionId, outputId, { ...options, type: "whip_client" });
10103
+ }
10104
+ /**
10105
+ * Register an output sending the composed result to an RTMP endpoint.
10106
+ */
10107
+ async registerRtmpOutput(compositionId, outputId, options) {
10108
+ await this.registerOutput(compositionId, outputId, { ...options, type: "rtmp_client" });
10109
+ }
10110
+ /**
10111
+ * Unregister an output. It stops producing audio and video.
10112
+ */
10113
+ async unregisterOutput(compositionId, outputId, options = {}) {
10114
+ try {
10115
+ await this.outputsApi.unregisterOutput({ compositionId, outputId, unregisterOutput: options });
10116
+ } catch (error) {
10117
+ throw await mapException(error, "output");
10118
+ }
10119
+ }
10120
+ /**
10121
+ * Replace the scene an output renders.
10122
+ */
10123
+ async updateOutput(compositionId, outputId, update) {
10124
+ try {
10125
+ await this.outputsApi.updateOutput({ compositionId, outputId, updateOutputRequest: update });
10126
+ } catch (error) {
10127
+ throw await mapException(error, "composition");
10128
+ }
10129
+ }
10130
+ /**
10131
+ * Ask an output to emit a keyframe, so a viewer joining mid-stream renders a full picture sooner.
10132
+ */
10133
+ async requestKeyframe(compositionId, outputId) {
10134
+ try {
10135
+ await this.outputsApi.requestKeyframe({ compositionId, outputId });
10136
+ } catch (error) {
10137
+ throw await mapException(error, "composition");
10138
+ }
10139
+ }
10140
+ /**
10141
+ * Register an image that scenes can reference by its renderer ID.
10142
+ */
10143
+ async registerImage(compositionId, imageId, image) {
10144
+ try {
10145
+ await this.renderersApi.registerImage({ compositionId, imageId, imageSpec: image });
10146
+ } catch (error) {
10147
+ throw await mapException(error, "composition");
10148
+ }
10149
+ }
10150
+ /**
10151
+ * Register a font that scenes can render text with. The font is either a `Blob` or a path
10152
+ * to read it from; never pass a path taken from untrusted input, since its contents are uploaded.
10153
+ */
10154
+ async registerFont(compositionId, font) {
10155
+ try {
10156
+ await this.renderersApi.registerFont({ compositionId, font: await toBlob(font) });
10157
+ } catch (error) {
10158
+ throw await mapException(error, "composition");
10159
+ }
10160
+ }
10161
+ /**
10162
+ * Unregister a previously registered image.
10163
+ */
10164
+ async unregisterImage(compositionId, imageId, options = {}) {
10165
+ try {
10166
+ await this.renderersApi.unregisterImage({ compositionId, imageId, unregisterRenderer: options });
10167
+ } catch (error) {
10168
+ throw await mapException(error, "renderer");
10169
+ }
10170
+ }
10171
+ /**
10172
+ * Deliver an event to the templates rendered by the composition's outputs.
10173
+ */
10174
+ async sendEvent(compositionId, event) {
10175
+ try {
10176
+ await this.eventsApi.sendCompositionEvent({ compositionId, sendCompositionEventRequest: event });
10177
+ } catch (error) {
10178
+ throw await mapException(error, "composition");
10179
+ }
10180
+ }
7095
10181
  };
7096
10182
  // Annotate the CommonJS export names for ESM import in node:
7097
10183
  0 && (module.exports = {
10184
+ AudioFormat,
10185
+ AudioSampleRate,
7098
10186
  BadRequestException,
10187
+ CompositionClient,
10188
+ CompositionNotFoundException,
7099
10189
  FishjamAgent,
7100
10190
  FishjamBaseException,
7101
10191
  FishjamClient,
7102
10192
  FishjamNotFoundException,
7103
10193
  FishjamWSNotifier,
7104
10194
  ForbiddenException,
10195
+ InputNotFoundException,
7105
10196
  InvalidFishjamCredentialsException,
7106
10197
  MissingFishjamIdException,
10198
+ OutputNotFoundException,
7107
10199
  PeerNotFoundException,
7108
10200
  PeerStatus,
7109
10201
  QuotaExceededException,
10202
+ RecordingNotFoundException,
10203
+ RendererNotFoundException,
7110
10204
  RoomNotFoundException,
7111
10205
  RoomType,
7112
10206
  ServerMessage,
7113
10207
  ServiceUnavailableException,
10208
+ StaleSdkException,
10209
+ SubscribeMode,
7114
10210
  UnauthorizedException,
7115
10211
  UnknownException,
7116
10212
  VideoCodec,