@fishjam-cloud/js-server-sdk 0.29.0 → 0.30.1

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