moqtail 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -577,27 +577,37 @@ var ObjectDatagramStatusType, ObjectDatagramType, FetchHeaderType, SubgroupHeade
577
577
  var init_constant = __esm({
578
578
  "src/model/data/constant.ts"() {
579
579
  ObjectDatagramStatusType = /* @__PURE__ */ ((ObjectDatagramStatusType2) => {
580
- ObjectDatagramStatusType2[ObjectDatagramStatusType2["WithoutExtensions"] = 2] = "WithoutExtensions";
581
- ObjectDatagramStatusType2[ObjectDatagramStatusType2["WithExtensions"] = 3] = "WithExtensions";
580
+ ObjectDatagramStatusType2[ObjectDatagramStatusType2["WithoutExtensions"] = 32] = "WithoutExtensions";
581
+ ObjectDatagramStatusType2[ObjectDatagramStatusType2["WithExtensions"] = 33] = "WithExtensions";
582
582
  return ObjectDatagramStatusType2;
583
583
  })(ObjectDatagramStatusType || {});
584
584
  ((ObjectDatagramStatusType2) => {
585
585
  function tryFrom(value) {
586
586
  const v = typeof value === "bigint" ? Number(value) : value;
587
587
  switch (v) {
588
- case 2:
589
- return 2 /* WithoutExtensions */;
590
- case 3:
591
- return 3 /* WithExtensions */;
588
+ case 32:
589
+ return 32 /* WithoutExtensions */;
590
+ case 33:
591
+ return 33 /* WithExtensions */;
592
592
  default:
593
593
  throw new Error(`Invalid ObjectDatagramStatusType: ${value}`);
594
594
  }
595
595
  }
596
596
  ObjectDatagramStatusType2.tryFrom = tryFrom;
597
+ function hasExtensions(t) {
598
+ return t === 33 /* WithExtensions */;
599
+ }
600
+ ObjectDatagramStatusType2.hasExtensions = hasExtensions;
597
601
  })(ObjectDatagramStatusType || (ObjectDatagramStatusType = {}));
598
602
  ObjectDatagramType = /* @__PURE__ */ ((ObjectDatagramType2) => {
599
- ObjectDatagramType2[ObjectDatagramType2["WithoutExtensions"] = 0] = "WithoutExtensions";
600
- ObjectDatagramType2[ObjectDatagramType2["WithExtensions"] = 1] = "WithExtensions";
603
+ ObjectDatagramType2[ObjectDatagramType2["Type0x00"] = 0] = "Type0x00";
604
+ ObjectDatagramType2[ObjectDatagramType2["Type0x01"] = 1] = "Type0x01";
605
+ ObjectDatagramType2[ObjectDatagramType2["Type0x02"] = 2] = "Type0x02";
606
+ ObjectDatagramType2[ObjectDatagramType2["Type0x03"] = 3] = "Type0x03";
607
+ ObjectDatagramType2[ObjectDatagramType2["Type0x04"] = 4] = "Type0x04";
608
+ ObjectDatagramType2[ObjectDatagramType2["Type0x05"] = 5] = "Type0x05";
609
+ ObjectDatagramType2[ObjectDatagramType2["Type0x06"] = 6] = "Type0x06";
610
+ ObjectDatagramType2[ObjectDatagramType2["Type0x07"] = 7] = "Type0x07";
601
611
  return ObjectDatagramType2;
602
612
  })(ObjectDatagramType || {});
603
613
  ((ObjectDatagramType2) => {
@@ -605,14 +615,46 @@ var init_constant = __esm({
605
615
  const v = typeof value === "bigint" ? Number(value) : value;
606
616
  switch (v) {
607
617
  case 0:
608
- return 0 /* WithoutExtensions */;
618
+ return 0 /* Type0x00 */;
609
619
  case 1:
610
- return 1 /* WithExtensions */;
620
+ return 1 /* Type0x01 */;
621
+ case 2:
622
+ return 2 /* Type0x02 */;
623
+ case 3:
624
+ return 3 /* Type0x03 */;
625
+ case 4:
626
+ return 4 /* Type0x04 */;
627
+ case 5:
628
+ return 5 /* Type0x05 */;
629
+ case 6:
630
+ return 6 /* Type0x06 */;
631
+ case 7:
632
+ return 7 /* Type0x07 */;
611
633
  default:
612
634
  throw new Error(`Invalid ObjectDatagramType: ${value}`);
613
635
  }
614
636
  }
615
637
  ObjectDatagramType2.tryFrom = tryFrom;
638
+ function hasExtensions(t) {
639
+ return (t & 1) !== 0;
640
+ }
641
+ ObjectDatagramType2.hasExtensions = hasExtensions;
642
+ function isEndOfGroup(t) {
643
+ return (t & 2) !== 0;
644
+ }
645
+ ObjectDatagramType2.isEndOfGroup = isEndOfGroup;
646
+ function hasObjectId(t) {
647
+ return (t & 4) === 0;
648
+ }
649
+ ObjectDatagramType2.hasObjectId = hasObjectId;
650
+ function fromProperties(hasExtensions2, endOfGroup, objectIdIsZero) {
651
+ let type = 0;
652
+ if (hasExtensions2) type |= 1;
653
+ if (endOfGroup) type |= 2;
654
+ if (objectIdIsZero) type |= 4;
655
+ return type;
656
+ }
657
+ ObjectDatagramType2.fromProperties = fromProperties;
616
658
  })(ObjectDatagramType || (ObjectDatagramType = {}));
617
659
  FetchHeaderType = /* @__PURE__ */ ((FetchHeaderType3) => {
618
660
  FetchHeaderType3[FetchHeaderType3["Type0x05"] = 5] = "Type0x05";
@@ -767,11 +809,12 @@ var init_datagram_object = __esm({
767
809
  init_constant();
768
810
  init_location();
769
811
  DatagramObject = class _DatagramObject {
770
- constructor(type, trackAlias, location, publisherPriority, extensionHeaders, payload) {
812
+ constructor(type, trackAlias, location, publisherPriority, extensionHeaders, payload, endOfGroup) {
771
813
  this.type = type;
772
814
  this.publisherPriority = publisherPriority;
773
815
  this.extensionHeaders = extensionHeaders;
774
816
  this.payload = payload;
817
+ this.endOfGroup = endOfGroup;
775
818
  this.trackAlias = BigInt(trackAlias);
776
819
  this.location = location;
777
820
  }
@@ -783,34 +826,48 @@ var init_datagram_object = __esm({
783
826
  get objectId() {
784
827
  return this.location.object;
785
828
  }
786
- static newWithExtensions(trackAlias, groupId, objectId, publisherPriority, extensionHeaders, payload) {
829
+ /**
830
+ * Create a new DatagramObject with all properties specified.
831
+ * The type is automatically determined based on extensions, endOfGroup, and objectId.
832
+ */
833
+ static new(trackAlias, groupId, objectId, publisherPriority, extensionHeaders, payload, endOfGroup = false) {
834
+ const hasExtensions = extensionHeaders !== null && extensionHeaders.length > 0;
835
+ const objectIdIsZero = objectId === 0n;
836
+ const type = ObjectDatagramType.fromProperties(hasExtensions, endOfGroup, objectIdIsZero);
787
837
  return new _DatagramObject(
788
- 1 /* WithExtensions */,
838
+ type,
789
839
  trackAlias,
790
840
  new Location(groupId, objectId),
791
841
  publisherPriority,
792
- extensionHeaders,
793
- payload
842
+ hasExtensions ? extensionHeaders : null,
843
+ payload,
844
+ endOfGroup
794
845
  );
795
846
  }
796
- static newWithoutExtensions(trackAlias, groupId, objectId, publisherPriority, payload) {
797
- return new _DatagramObject(
798
- 0 /* WithoutExtensions */,
799
- trackAlias,
800
- new Location(groupId, objectId),
801
- publisherPriority,
802
- null,
803
- payload
804
- );
847
+ /**
848
+ * Create a DatagramObject with extensions.
849
+ * @deprecated Use DatagramObject.new() instead for Draft-14 compliance.
850
+ */
851
+ static newWithExtensions(trackAlias, groupId, objectId, publisherPriority, extensionHeaders, payload, endOfGroup = false) {
852
+ return _DatagramObject.new(trackAlias, groupId, objectId, publisherPriority, extensionHeaders, payload, endOfGroup);
853
+ }
854
+ /**
855
+ * Create a DatagramObject without extensions.
856
+ * @deprecated Use DatagramObject.new() instead for Draft-14 compliance.
857
+ */
858
+ static newWithoutExtensions(trackAlias, groupId, objectId, publisherPriority, payload, endOfGroup = false) {
859
+ return _DatagramObject.new(trackAlias, groupId, objectId, publisherPriority, null, payload, endOfGroup);
805
860
  }
806
861
  serialize() {
807
862
  const buf = new ByteBuffer();
808
863
  buf.putVI(this.type);
809
864
  buf.putVI(this.trackAlias);
810
865
  buf.putVI(this.location.group);
811
- buf.putVI(this.location.object);
866
+ if (ObjectDatagramType.hasObjectId(this.type)) {
867
+ buf.putVI(this.location.object);
868
+ }
812
869
  buf.putU8(this.publisherPriority);
813
- if (this.type === 1 /* WithExtensions */) {
870
+ if (ObjectDatagramType.hasExtensions(this.type)) {
814
871
  const extBuf = new ByteBuffer();
815
872
  if (this.extensionHeaders) {
816
873
  for (const header of this.extensionHeaders) {
@@ -828,28 +885,32 @@ var init_datagram_object = __esm({
828
885
  const msgType = ObjectDatagramType.tryFrom(msgTypeRaw);
829
886
  const trackAlias = buf.getVI();
830
887
  const groupId = buf.getVI();
831
- const objectId = buf.getVI();
888
+ let objectId;
889
+ if (ObjectDatagramType.hasObjectId(msgType)) {
890
+ objectId = buf.getVI();
891
+ } else {
892
+ objectId = 0n;
893
+ }
832
894
  const publisherPriority = buf.getU8();
833
895
  let extensionHeaders = null;
834
- switch (msgType) {
835
- case 1 /* WithExtensions */: {
836
- const extBytes = buf.getLengthPrefixedBytes();
837
- const headerBytes = new FrozenByteBuffer5(extBytes);
838
- extensionHeaders = [];
839
- while (headerBytes.remaining > 0) {
840
- extensionHeaders.push(headerBytes.getKeyValuePair());
841
- }
842
- break;
896
+ if (ObjectDatagramType.hasExtensions(msgType)) {
897
+ const extBytes = buf.getLengthPrefixedBytes();
898
+ const headerBytes = new FrozenByteBuffer5(extBytes);
899
+ extensionHeaders = [];
900
+ while (headerBytes.remaining > 0) {
901
+ extensionHeaders.push(headerBytes.getKeyValuePair());
843
902
  }
844
903
  }
845
904
  const payload = buf.getBytes(buf.remaining);
905
+ const endOfGroup = ObjectDatagramType.isEndOfGroup(msgType);
846
906
  return new _DatagramObject(
847
907
  msgType,
848
908
  trackAlias,
849
909
  new Location(groupId, objectId),
850
910
  publisherPriority,
851
911
  extensionHeaders,
852
- payload
912
+ payload,
913
+ endOfGroup
853
914
  );
854
915
  }
855
916
  };
@@ -881,25 +942,35 @@ var init_datagram_status = __esm({
881
942
  get objectId() {
882
943
  return this.location.object;
883
944
  }
884
- static withExtensions(trackAlias, location, publisherPriority, extensionHeaders, objectStatus) {
945
+ /**
946
+ * Create a new DatagramStatus with all properties specified.
947
+ * The type is automatically determined based on whether extensions are present.
948
+ */
949
+ static new(trackAlias, location, publisherPriority, extensionHeaders, objectStatus) {
950
+ const hasExtensions = extensionHeaders !== null && extensionHeaders.length > 0;
951
+ const type = hasExtensions ? 33 /* WithExtensions */ : 32 /* WithoutExtensions */;
885
952
  return new _DatagramStatus(
886
- 3 /* WithExtensions */,
953
+ type,
887
954
  trackAlias,
888
955
  location,
889
956
  publisherPriority,
890
- extensionHeaders,
957
+ hasExtensions ? extensionHeaders : null,
891
958
  objectStatus
892
959
  );
893
960
  }
961
+ /**
962
+ * Create a DatagramStatus with extensions.
963
+ * @deprecated Use DatagramStatus.new() instead for Draft-14 compliance.
964
+ */
965
+ static withExtensions(trackAlias, location, publisherPriority, extensionHeaders, objectStatus) {
966
+ return _DatagramStatus.new(trackAlias, location, publisherPriority, extensionHeaders, objectStatus);
967
+ }
968
+ /**
969
+ * Create a DatagramStatus without extensions.
970
+ * @deprecated Use DatagramStatus.new() instead for Draft-14 compliance.
971
+ */
894
972
  static newWithoutExtensions(trackAlias, location, publisherPriority, objectStatus) {
895
- return new _DatagramStatus(
896
- 2 /* WithoutExtensions */,
897
- trackAlias,
898
- location,
899
- publisherPriority,
900
- null,
901
- objectStatus
902
- );
973
+ return _DatagramStatus.new(trackAlias, location, publisherPriority, null, objectStatus);
903
974
  }
904
975
  serialize() {
905
976
  const buf = new ByteBuffer();
@@ -908,7 +979,7 @@ var init_datagram_status = __esm({
908
979
  buf.putVI(this.location.group);
909
980
  buf.putVI(this.location.object);
910
981
  buf.putU8(this.publisherPriority);
911
- if (this.type === 3 /* WithExtensions */) {
982
+ if (ObjectDatagramStatusType.hasExtensions(this.type)) {
912
983
  const extBuf = new ByteBuffer();
913
984
  if (this.extensionHeaders) {
914
985
  for (const header of this.extensionHeaders) {
@@ -929,18 +1000,14 @@ var init_datagram_status = __esm({
929
1000
  const objectId = buf.getVI();
930
1001
  const publisherPriority = buf.getU8();
931
1002
  let extensionHeaders = null;
932
- switch (msgType) {
933
- case 3 /* WithExtensions */: {
934
- const extBytes = buf.getLengthPrefixedBytes();
935
- const headerBytes = new FrozenByteBuffer5(extBytes);
936
- extensionHeaders = [];
937
- while (headerBytes.remaining > 0) {
938
- extensionHeaders.push(headerBytes.getKeyValuePair());
939
- }
940
- break;
1003
+ if (ObjectDatagramStatusType.hasExtensions(msgType)) {
1004
+ const extBytes = buf.getLengthPrefixedBytes();
1005
+ const headerBytes = new FrozenByteBuffer5(extBytes);
1006
+ extensionHeaders = [];
1007
+ while (headerBytes.remaining > 0) {
1008
+ extensionHeaders.push(headerBytes.getKeyValuePair());
941
1009
  }
942
1010
  }
943
- console.log("Came here for trying tryFrom with object status");
944
1011
  const objectStatus = ObjectStatus.tryFrom(buf.getVI());
945
1012
  return new _DatagramStatus(
946
1013
  msgType,
@@ -1656,6 +1723,14 @@ var init_object = __esm({
1656
1723
  datagramObject.payload
1657
1724
  );
1658
1725
  }
1726
+ /**
1727
+ * Returns the endOfGroup flag from the source DatagramObject.
1728
+ * This is separate from ObjectStatus.EndOfGroup - the flag indicates
1729
+ * this is the last object in the group even with Normal status.
1730
+ */
1731
+ static isDatagramEndOfGroup(datagramObject) {
1732
+ return datagramObject.endOfGroup;
1733
+ }
1659
1734
  static fromDatagramStatus(datagramStatus, fullTrackName) {
1660
1735
  return new _MoqtObject(
1661
1736
  fullTrackName,
@@ -1692,7 +1767,12 @@ var init_object = __esm({
1692
1767
  subgroupObject.payload
1693
1768
  );
1694
1769
  }
1695
- tryIntoDatagramObject(trackAlias) {
1770
+ /**
1771
+ * Convert to DatagramObject for wire transmission.
1772
+ * @param trackAlias - The track alias to use
1773
+ * @param endOfGroup - Draft-14: Whether this is the last object in the group
1774
+ */
1775
+ tryIntoDatagramObject(trackAlias, endOfGroup = false) {
1696
1776
  if (this.objectForwardingPreference !== "Datagram" /* Datagram */) {
1697
1777
  throw new CastingError(
1698
1778
  "MoqtObject.tryIntoDatagramObject",
@@ -1708,24 +1788,15 @@ var init_object = __esm({
1708
1788
  );
1709
1789
  }
1710
1790
  const alias = BigInt(trackAlias);
1711
- if (this.extensionHeaders && this.extensionHeaders.length > 0) {
1712
- return DatagramObject.newWithExtensions(
1713
- alias,
1714
- this.groupId,
1715
- this.objectId,
1716
- this.publisherPriority,
1717
- this.extensionHeaders,
1718
- this.payload
1719
- );
1720
- } else {
1721
- return DatagramObject.newWithoutExtensions(
1722
- alias,
1723
- this.groupId,
1724
- this.objectId,
1725
- this.publisherPriority,
1726
- this.payload
1727
- );
1728
- }
1791
+ return DatagramObject.new(
1792
+ alias,
1793
+ this.groupId,
1794
+ this.objectId,
1795
+ this.publisherPriority,
1796
+ this.extensionHeaders,
1797
+ this.payload,
1798
+ endOfGroup
1799
+ );
1729
1800
  }
1730
1801
  tryIntoDatagramStatus(trackAlias) {
1731
1802
  if (this.objectForwardingPreference !== "Datagram" /* Datagram */) {
@@ -2528,11 +2599,11 @@ function fetchTypeFromBigInt(v) {
2528
2599
  throw new CastingError("fetchTypeFromBigInt", "bigint", "FetchType", `Invalid FetchType:${v}`);
2529
2600
  }
2530
2601
  }
2531
- var GroupOrder = /* @__PURE__ */ ((GroupOrder7) => {
2532
- GroupOrder7[GroupOrder7["Original"] = 0] = "Original";
2533
- GroupOrder7[GroupOrder7["Ascending"] = 1] = "Ascending";
2534
- GroupOrder7[GroupOrder7["Descending"] = 2] = "Descending";
2535
- return GroupOrder7;
2602
+ var GroupOrder = /* @__PURE__ */ ((GroupOrder6) => {
2603
+ GroupOrder6[GroupOrder6["Original"] = 0] = "Original";
2604
+ GroupOrder6[GroupOrder6["Ascending"] = 1] = "Ascending";
2605
+ GroupOrder6[GroupOrder6["Descending"] = 2] = "Descending";
2606
+ return GroupOrder6;
2536
2607
  })(GroupOrder || {});
2537
2608
  function groupOrderFromNumber(v) {
2538
2609
  switch (v) {
@@ -3538,15 +3609,14 @@ var PublishDone = class _PublishDone {
3538
3609
 
3539
3610
  // src/model/control/publish.ts
3540
3611
  init_byte_buffer();
3541
- init_tuple();
3542
3612
  init_location();
3543
3613
  init_pair();
3544
3614
  init_error();
3615
+ init_data();
3545
3616
  var Publish = class _Publish {
3546
- constructor(requestId, trackNamespace, trackName, trackAlias, groupOrder, contentExists, largestLocation, forward, parameters) {
3617
+ constructor(requestId, fullTrackName, trackAlias, groupOrder, contentExists, largestLocation, forward, parameters) {
3547
3618
  this.requestId = requestId;
3548
- this.trackNamespace = trackNamespace;
3549
- this.trackName = trackName;
3619
+ this.fullTrackName = fullTrackName;
3550
3620
  this.trackAlias = trackAlias;
3551
3621
  this.groupOrder = groupOrder;
3552
3622
  this.contentExists = contentExists;
@@ -3554,11 +3624,10 @@ var Publish = class _Publish {
3554
3624
  this.forward = forward;
3555
3625
  this.parameters = parameters;
3556
3626
  }
3557
- static new(requestId, trackNamespace, trackName, trackAlias, groupOrder, contentExists, largestLocation, forward, parameters) {
3627
+ static new(requestId, fullTrackName, trackAlias, groupOrder, contentExists, largestLocation, forward, parameters) {
3558
3628
  return new _Publish(
3559
3629
  BigInt(requestId),
3560
- trackNamespace,
3561
- trackName,
3630
+ fullTrackName,
3562
3631
  BigInt(trackAlias),
3563
3632
  groupOrder,
3564
3633
  contentExists,
@@ -3575,9 +3644,7 @@ var Publish = class _Publish {
3575
3644
  buf.putVI(29 /* Publish */);
3576
3645
  const payload = new ByteBuffer();
3577
3646
  payload.putVI(this.requestId);
3578
- payload.putTuple(this.trackNamespace);
3579
- payload.putVI(this.trackName.length);
3580
- payload.putBytes(new TextEncoder().encode(this.trackName));
3647
+ payload.putBytes(this.fullTrackName.serialize().toUint8Array());
3581
3648
  payload.putVI(this.trackAlias);
3582
3649
  payload.putU8(this.groupOrder);
3583
3650
  payload.putU8(this.contentExists);
@@ -3599,10 +3666,7 @@ var Publish = class _Publish {
3599
3666
  }
3600
3667
  static parsePayload(buf) {
3601
3668
  const requestId = buf.getVI();
3602
- const trackNamespace = buf.getTuple();
3603
- const trackNameLength = buf.getVI();
3604
- const trackNameBytes = buf.getBytes(Number(trackNameLength));
3605
- const trackName = new TextDecoder().decode(trackNameBytes);
3669
+ const fullTrackName = buf.getFullTrackName();
3606
3670
  const trackAlias = buf.getVI();
3607
3671
  const groupOrder = buf.getU8();
3608
3672
  const contentExists = buf.getU8();
@@ -3618,8 +3682,7 @@ var Publish = class _Publish {
3618
3682
  }
3619
3683
  return new _Publish(
3620
3684
  requestId,
3621
- trackNamespace,
3622
- trackName,
3685
+ fullTrackName,
3623
3686
  trackAlias,
3624
3687
  groupOrder,
3625
3688
  contentExists,
@@ -5491,6 +5554,70 @@ var SubscribeRequest = class {
5491
5554
  }
5492
5555
  };
5493
5556
 
5557
+ // src/client/request/subscribe_namespace.ts
5558
+ var SubscribeNamespaceRequest = class {
5559
+ requestId;
5560
+ message;
5561
+ _resolve;
5562
+ _reject;
5563
+ promise;
5564
+ constructor(msg) {
5565
+ this.requestId = msg.requestId;
5566
+ this.message = msg;
5567
+ this.promise = new Promise((resolve, reject) => {
5568
+ this._resolve = resolve;
5569
+ this._reject = reject;
5570
+ });
5571
+ }
5572
+ resolve(value) {
5573
+ this._resolve(value);
5574
+ }
5575
+ reject(reason) {
5576
+ this._reject(reason);
5577
+ }
5578
+ then(onfulfilled, onrejected) {
5579
+ return this.promise.then(onfulfilled, onrejected);
5580
+ }
5581
+ catch(onrejected) {
5582
+ return this.promise.catch(onrejected);
5583
+ }
5584
+ finally(onfinally) {
5585
+ return this.promise.finally(onfinally);
5586
+ }
5587
+ };
5588
+
5589
+ // src/client/request/publish.ts
5590
+ var PublishRequest = class {
5591
+ requestId;
5592
+ message;
5593
+ _resolve;
5594
+ _reject;
5595
+ promise;
5596
+ constructor(msg) {
5597
+ this.requestId = msg.requestId;
5598
+ this.message = msg;
5599
+ this.promise = new Promise((resolve, reject) => {
5600
+ this._resolve = resolve;
5601
+ this._reject = reject;
5602
+ });
5603
+ }
5604
+ resolve(value) {
5605
+ this._resolve(value);
5606
+ }
5607
+ reject(reason) {
5608
+ this._reject(reason);
5609
+ }
5610
+ then(onfulfilled, onrejected) {
5611
+ return this.promise.then(onfulfilled, onrejected);
5612
+ }
5613
+ catch(onrejected) {
5614
+ return this.promise.catch(onrejected);
5615
+ }
5616
+ finally(onfinally) {
5617
+ return this.promise.finally(onfinally);
5618
+ }
5619
+ };
5620
+
5494
5621
  // src/client/handler/publish_namespace.ts
5495
5622
  var handlerPublishNamespace = async (client, msg) => {
5496
5623
  if (client.onNamespacePublished) {
@@ -6027,7 +6154,12 @@ var handlerSubscribe = async (client, msg) => {
6027
6154
  };
6028
6155
 
6029
6156
  // src/client/handler/subscribe_namespace.ts
6030
- var handlerSubscribeNamespace = async (_client, _msg) => {
6157
+ var handlerSubscribeNamespace = async (client, msg) => {
6158
+ if (client.onPeerSubscribeNamespace) {
6159
+ client.onPeerSubscribeNamespace(msg);
6160
+ }
6161
+ const okMsg = new SubscribeNamespaceOk(msg.requestId);
6162
+ await client.controlStream.send(okMsg);
6031
6163
  };
6032
6164
 
6033
6165
  // src/client/handler/subscribe_namespace_error.ts
@@ -6113,8 +6245,229 @@ var handlerUnsubscribe = async (client, msg) => {
6113
6245
  var handlerUnsubscribeNamespace = async (_client, _msg) => {
6114
6246
  };
6115
6247
 
6248
+ // src/client/handler/publish.ts
6249
+ var handlerPublish = async (client, msg) => {
6250
+ let streamController;
6251
+ const stream = new ReadableStream({
6252
+ start(c) {
6253
+ streamController = c;
6254
+ }
6255
+ });
6256
+ const localPseudoRequestId = client.allocatePseudoRequestId();
6257
+ client.requestIdMap.addMapping(localPseudoRequestId, msg.fullTrackName);
6258
+ client.subscriptionAliasMap.set(localPseudoRequestId, msg.trackAlias);
6259
+ client.aliasFullTrackNameMap.set(msg.trackAlias, msg.fullTrackName);
6260
+ const receiver = {
6261
+ requestId: localPseudoRequestId,
6262
+ streamsAccepted: 0,
6263
+ largestLocation: void 0,
6264
+ controller: streamController
6265
+ };
6266
+ client.subscriptions.set(msg.trackAlias, receiver);
6267
+ if (client.onPeerPublish) {
6268
+ client.onPeerPublish(msg, stream);
6269
+ }
6270
+ const publishOk = new PublishOk(
6271
+ msg.requestId,
6272
+ 1,
6273
+ 255,
6274
+ 1 /* Ascending */,
6275
+ 2 /* LatestObject */,
6276
+ void 0,
6277
+ void 0,
6278
+ []
6279
+ );
6280
+ await client.controlStream.send(publishOk);
6281
+ };
6282
+
6283
+ // src/client/publication/publish.ts
6284
+ init_subgroup_header();
6285
+ var PublishPublication = class {
6286
+ /**
6287
+ * Creates a new PublishPublication instance.
6288
+ * @param client - The MOQT client managing the connection.
6289
+ * @param track - The track being proactively published.
6290
+ * @param publishMsg - The publish message that initiated this session.
6291
+ */
6292
+ constructor(client, track, publishMsg) {
6293
+ this.client = client;
6294
+ this.track = track;
6295
+ this.publishMsg = publishMsg;
6296
+ this.#trackAlias = track.trackAlias;
6297
+ this.#publisherPriority = track.publisherPriority;
6298
+ this.publishToRelay();
6299
+ }
6300
+ /**
6301
+ * The latest location that was published to the relay.
6302
+ */
6303
+ latestLocation;
6304
+ /**
6305
+ * The alias for the track being published.
6306
+ */
6307
+ #trackAlias;
6308
+ /**
6309
+ * The priority of the publisher.
6310
+ */
6311
+ #publisherPriority;
6312
+ /**
6313
+ * The number of streams opened for this publication.
6314
+ */
6315
+ #streamsOpened = 0n;
6316
+ /**
6317
+ * Function to cancel publishing, if set.
6318
+ */
6319
+ #cancelPublishing;
6320
+ /**
6321
+ * Whether publishing is completed/cancelled.
6322
+ */
6323
+ #isCompleted = false;
6324
+ /**
6325
+ * Lock for synchronizing stream operations.
6326
+ */
6327
+ #lock = new SimpleLock();
6328
+ /**
6329
+ * Map of group IDs to their corresponding send streams.
6330
+ */
6331
+ #streams = /* @__PURE__ */ new Map();
6332
+ /**
6333
+ * Unique identifier for this publication instance.
6334
+ */
6335
+ #id = Math.floor(Math.random() * 1e6);
6336
+ /**
6337
+ * Calculates the stream priority based on publisher priority.
6338
+ * (Since this is a proactive push, there is no subscriber priority to average with).
6339
+ */
6340
+ get #streamPriority() {
6341
+ return getTransportPriority(this.#publisherPriority);
6342
+ }
6343
+ /**
6344
+ * Cancels the publication and cleans up resources.
6345
+ * Removes the publication from the client's publication map.
6346
+ */
6347
+ cancel() {
6348
+ if (this.#cancelPublishing) {
6349
+ this.#cancelPublishing();
6350
+ this.client.publications.delete(this.publishMsg.requestId);
6351
+ }
6352
+ this.#isCompleted = true;
6353
+ this.#lock.acquire().then(() => {
6354
+ for (const [groupId, stream] of this.#streams.entries()) {
6355
+ stream.close().catch((e) => console.warn(`Failed to close stream for group ${groupId}:`, e));
6356
+ }
6357
+ this.#streams.clear();
6358
+ this.#lock.release();
6359
+ });
6360
+ }
6361
+ /**
6362
+ * Publishes MOQT objects to the relay as they become available.
6363
+ * Handles stream creation, object writing, and stream closure.
6364
+ * @throws :{@link InternalError} If the track does not support live content.
6365
+ */
6366
+ async publishToRelay() {
6367
+ if (!this.track.trackSource.live)
6368
+ throw new InternalError("PublishPublication.publishToRelay", "Track does not support live content");
6369
+ this.track.trackSource.live.onDone(() => {
6370
+ this.cancel();
6371
+ });
6372
+ this.#cancelPublishing = this.track.trackSource.live.onNewObject(async (obj) => {
6373
+ if (this.#isCompleted) return;
6374
+ try {
6375
+ if (!this.#streams.has(obj.location.group)) {
6376
+ await this.#lock.acquire();
6377
+ if (!this.#streams.has(obj.location.group)) {
6378
+ const writeStream = await this.client.webTransport.createUnidirectionalStream({
6379
+ sendOrder: this.#streamPriority
6380
+ });
6381
+ let subgroupId;
6382
+ if (SubgroupHeaderType.hasExplicitSubgroupId(obj.getSubgroupHeaderType(true))) subgroupId = obj.subgroupId;
6383
+ const header = new SubgroupHeader(
6384
+ obj.getSubgroupHeaderType(true),
6385
+ this.#trackAlias,
6386
+ obj.location.group,
6387
+ subgroupId,
6388
+ this.#publisherPriority
6389
+ );
6390
+ const sendStream2 = await SendStream.new(writeStream, header);
6391
+ this.#streams.set(obj.location.group, sendStream2);
6392
+ this.#streamsOpened++;
6393
+ }
6394
+ await this.#lock.release();
6395
+ }
6396
+ const sendStream = this.#streams.get(obj.location.group);
6397
+ await this.#lock.acquire();
6398
+ await sendStream.write(obj.tryIntoSubgroupObject());
6399
+ await this.#lock.release();
6400
+ if (this.latestLocation && this.latestLocation.group !== obj.location.group) {
6401
+ const prevGroup = this.latestLocation.group;
6402
+ try {
6403
+ await this.#lock.acquire();
6404
+ const prevStream = this.#streams.get(prevGroup);
6405
+ if (prevStream) {
6406
+ try {
6407
+ await prevStream.close();
6408
+ } catch (err) {
6409
+ console.warn("error in closing stream", prevGroup, err);
6410
+ }
6411
+ this.#streams.delete(prevGroup);
6412
+ }
6413
+ await this.#lock.release();
6414
+ } catch (err) {
6415
+ console.warn(
6416
+ "error in closing stream: id, latestLocation.group, err",
6417
+ this.#id,
6418
+ this.latestLocation.group,
6419
+ err
6420
+ );
6421
+ }
6422
+ }
6423
+ await this.#lock.acquire();
6424
+ this.latestLocation = obj.location;
6425
+ await this.#lock.release();
6426
+ } catch (err) {
6427
+ this.cancel();
6428
+ throw err;
6429
+ }
6430
+ });
6431
+ }
6432
+ };
6433
+
6434
+ // src/client/handler/publish_ok.ts
6435
+ var handlerPublishOk = async (client, msg) => {
6436
+ const request = client.requests.get(msg.requestId);
6437
+ if (request instanceof PublishRequest) {
6438
+ request.resolve(msg);
6439
+ const fullTrackName = client.requestIdMap.getNameByRequestId(msg.requestId);
6440
+ if (!fullTrackName) {
6441
+ console.warn(`[MOQtail] No track mapped for PublishOk requestId: ${msg.requestId}`);
6442
+ return;
6443
+ }
6444
+ const track = client.trackSources.get(fullTrackName.toString());
6445
+ if (!track || !track.trackSource.live) {
6446
+ console.warn(`[MOQtail] Live track source not found for ${fullTrackName.toString()}`);
6447
+ return;
6448
+ }
6449
+ const publication = new PublishPublication(client, track, request.message);
6450
+ client.publications.set(msg.requestId, publication);
6451
+ } else {
6452
+ throw new ProtocolViolationError("handlerPublishOk", "No publish request was found with the given request id");
6453
+ }
6454
+ };
6455
+
6456
+ // src/client/handler/publish_error.ts
6457
+ var handlerPublishError = async (client, msg) => {
6458
+ const request = client.requests.get(msg.requestId);
6459
+ if (request instanceof PublishRequest) {
6460
+ request.resolve(msg);
6461
+ } else {
6462
+ throw new ProtocolViolationError("handlerPublishError", "No publish request was found with the given request id");
6463
+ }
6464
+ };
6465
+
6116
6466
  // src/client/handler/handler.ts
6117
6467
  function getHandlerForControlMessage(msg) {
6468
+ if (msg instanceof Publish) return handlerPublish;
6469
+ if (msg instanceof PublishOk) return handlerPublishOk;
6470
+ if (msg instanceof PublishError) return handlerPublishError;
6118
6471
  if (msg instanceof PublishDone) return handlerPublishDone;
6119
6472
  if (msg instanceof PublishNamespace) return handlerPublishNamespace;
6120
6473
  if (msg instanceof PublishNamespaceCancel) return handlerPublishNamespaceCancel;
@@ -6268,7 +6621,7 @@ var RecvDatagramStream = class _RecvDatagramStream {
6268
6621
  }
6269
6622
  try {
6270
6623
  const firstByte = datagramBytes[0];
6271
- const isStatus = firstByte === 2 || firstByte === 3;
6624
+ const isStatus = firstByte === 32 || firstByte === 33;
6272
6625
  let moqtObject;
6273
6626
  if (isStatus) {
6274
6627
  const datagramStatus = DatagramStatus.deserialize(
@@ -6444,6 +6797,10 @@ var MOQtailClient = class _MOQtailClient {
6444
6797
  onDatagramReceived;
6445
6798
  /** Invoked after enqueuing each outbound datagram object/status. */
6446
6799
  onDatagramSent;
6800
+ /** Fired when an inbound PUBLISH control message is received. */
6801
+ onPeerPublish;
6802
+ /** Fired when an inbound SUBSCRIBE_NAMESPACE control message is received. */
6803
+ onPeerSubscribeNamespace;
6447
6804
  /** Datagram writer for sending datagrams. */
6448
6805
  #datagramWriter;
6449
6806
  /** Datagram reader for receiving datagrams. */
@@ -6471,6 +6828,12 @@ var MOQtailClient = class _MOQtailClient {
6471
6828
  this.#dontUseRequestId += 2n;
6472
6829
  return id;
6473
6830
  }
6831
+ /**
6832
+ * Generates a safe, sequential local request ID for tracking pushed/incoming tracks.
6833
+ */
6834
+ allocatePseudoRequestId() {
6835
+ return this.#nextClientRequestId;
6836
+ }
6474
6837
  /**
6475
6838
  * Gets the current server setup configuration.
6476
6839
  *
@@ -6750,7 +7113,7 @@ var MOQtailClient = class _MOQtailClient {
6750
7113
  }
6751
7114
  const firstByte = datagramBytes[0];
6752
7115
  try {
6753
- const isStatus = firstByte === 2 || firstByte === 3;
7116
+ const isStatus = firstByte === 32 || firstByte === 33;
6754
7117
  let moqtObject;
6755
7118
  let trackAlias;
6756
7119
  if (isStatus) {
@@ -7476,6 +7839,73 @@ var MOQtailClient = class _MOQtailClient {
7476
7839
  throw error;
7477
7840
  }
7478
7841
  }
7842
+ /**
7843
+ * Proactively push a track to the relay/peer.
7844
+ */
7845
+ async publish(fullTrackName, forward, trackAlias, parameters) {
7846
+ this.#ensureActive();
7847
+ try {
7848
+ const params = parameters ? parameters.build() : new VersionSpecificParameters().build();
7849
+ const requestId = this.#nextClientRequestId;
7850
+ const msg = new Publish(
7851
+ requestId,
7852
+ fullTrackName,
7853
+ trackAlias,
7854
+ 1 /* Ascending */,
7855
+ 0,
7856
+ // ContentExists (0 = Unknown/No)
7857
+ void 0,
7858
+ // Largest Location
7859
+ forward ? 1 : 0,
7860
+ params
7861
+ );
7862
+ const request = new PublishRequest(msg);
7863
+ this.requests.set(msg.requestId, request);
7864
+ this.requestIdMap.addMapping(msg.requestId, fullTrackName);
7865
+ this.subscriptionAliasMap.set(msg.requestId, trackAlias);
7866
+ await this.controlStream.send(msg);
7867
+ const response = await request;
7868
+ if (response instanceof PublishError) {
7869
+ this.requests.delete(msg.requestId);
7870
+ this.requestIdMap.removeMappingByRequestId(msg.requestId);
7871
+ this.subscriptionAliasMap.delete(msg.requestId);
7872
+ return response;
7873
+ } else {
7874
+ return { requestId: msg.requestId, trackAlias };
7875
+ }
7876
+ } catch (error) {
7877
+ await this.disconnect(
7878
+ new InternalError("MOQtailClient.publish", error instanceof Error ? error.message : String(error))
7879
+ );
7880
+ throw error;
7881
+ }
7882
+ }
7883
+ /**
7884
+ * Registers an incoming PUBLISH announcement as a valid data receiver.
7885
+ * This prepares the client to ingest pushed data streams matching the published alias.
7886
+ * * @param msg - The incoming Publish control message
7887
+ * @returns - A stream of MoqtObjects being pushed by the publisher
7888
+ */
7889
+ acceptPushedTrack(msg) {
7890
+ this.#ensureActive();
7891
+ let streamController;
7892
+ const stream = new ReadableStream({
7893
+ start(c) {
7894
+ streamController = c;
7895
+ }
7896
+ });
7897
+ this.requestIdMap.addMapping(msg.requestId, msg.fullTrackName);
7898
+ this.subscriptionAliasMap.set(msg.requestId, msg.trackAlias);
7899
+ this.aliasFullTrackNameMap.set(msg.trackAlias, msg.fullTrackName);
7900
+ const receiver = {
7901
+ requestId: msg.requestId,
7902
+ streamsAccepted: 0,
7903
+ largestLocation: void 0,
7904
+ controller: streamController
7905
+ };
7906
+ this.subscriptions.set(msg.trackAlias, receiver);
7907
+ return stream;
7908
+ }
7479
7909
  // TODO: Each announced track should checked against ongoing subscribe_namespace
7480
7910
  // If matches it should send an announce to that peer automatically
7481
7911
  /**
@@ -7624,10 +8054,20 @@ var MOQtailClient = class _MOQtailClient {
7624
8054
  }
7625
8055
  }
7626
8056
  // INFO: Subscriber calls this the get matching announce messages with this prefix
7627
- async subscribeNamespace(msg) {
8057
+ async subscribeNamespace(trackNamespacePrefix, parameters) {
7628
8058
  this.#ensureActive();
7629
8059
  try {
7630
- await this.controlStream.send(msg);
8060
+ const params = parameters ? parameters.build() : new VersionSpecificParameters().build();
8061
+ const msg = new SubscribeNamespace(this.#nextClientRequestId, trackNamespacePrefix, params);
8062
+ const request = new SubscribeNamespaceRequest(msg);
8063
+ this.requests.set(msg.requestId, request);
8064
+ this.controlStream.send(msg);
8065
+ const response = await request;
8066
+ if (response instanceof SubscribeNamespaceOk) {
8067
+ this.subscribedAnnounces.add(msg.trackNamespacePrefix);
8068
+ }
8069
+ this.requests.delete(msg.requestId);
8070
+ return response;
7631
8071
  } catch (error) {
7632
8072
  await this.disconnect(
7633
8073
  new InternalError("MOQtailClient.subscribeNamespace", error instanceof Error ? error.message : String(error))
@@ -7780,8 +8220,9 @@ var MOQtailClient = class _MOQtailClient {
7780
8220
  subgroupId = header.subgroupId;
7781
8221
  }
7782
8222
  const fullTrackName = this.aliasFullTrackNameMap.get(header.trackAlias);
7783
- if (!fullTrackName)
8223
+ if (!fullTrackName) {
7784
8224
  throw new ProtocolViolationError("MOQtailClient", "No full track name for received track alias");
8225
+ }
7785
8226
  const moqtObject = MoqtObject.fromSubgroupObject(
7786
8227
  nextObject,
7787
8228
  header.groupId,
@@ -7996,38 +8437,6 @@ var RingBufferObjectCache = class {
7996
8437
  }
7997
8438
  };
7998
8439
 
7999
- // src/client/request/subscribe_namespace.ts
8000
- var SubscribeNamespaceRequest = class {
8001
- requestId;
8002
- message;
8003
- _resolve;
8004
- _reject;
8005
- promise;
8006
- constructor(requestId, message) {
8007
- this.requestId = requestId;
8008
- this.message = message;
8009
- this.promise = new Promise((resolve, reject) => {
8010
- this._resolve = resolve;
8011
- this._reject = reject;
8012
- });
8013
- }
8014
- resolve(value) {
8015
- this._resolve(value);
8016
- }
8017
- reject(reason) {
8018
- this._reject(reason);
8019
- }
8020
- then(onfulfilled, onrejected) {
8021
- return this.promise.then(onfulfilled, onrejected);
8022
- }
8023
- catch(onrejected) {
8024
- return this.promise.catch(onrejected);
8025
- }
8026
- finally(onfinally) {
8027
- return this.promise.finally(onfinally);
8028
- }
8029
- };
8030
-
8031
8440
  // src/util/telemetry.ts
8032
8441
  var NetworkTelemetry = class {
8033
8442
  events = [];
@@ -8420,40 +8829,4 @@ var ClockNormalizer = class _ClockNormalizer {
8420
8829
  }
8421
8830
  };
8422
8831
 
8423
- // src/util/get_akamai_offset.ts
8424
- var AkamaiOffset = class _AkamaiOffset {
8425
- static _offset = null;
8426
- static _promise = null;
8427
- static async getClockSkew() {
8428
- if (_AkamaiOffset._offset !== null) {
8429
- return _AkamaiOffset._offset;
8430
- }
8431
- if (_AkamaiOffset._promise) {
8432
- return _AkamaiOffset._promise;
8433
- }
8434
- _AkamaiOffset._promise = _AkamaiOffset.ClockSkew().then((offset2) => {
8435
- _AkamaiOffset._offset = offset2;
8436
- return offset2;
8437
- });
8438
- const offset = await _AkamaiOffset._promise;
8439
- return Math.round(offset);
8440
- }
8441
- static async ClockSkew() {
8442
- const akamaiUrl = "https://time.akamai.com?ms";
8443
- performance.clearResourceTimings();
8444
- const response = await fetch(akamaiUrl);
8445
- const text = await response.text();
8446
- const TR = parseFloat(text.trim()) * 1e3;
8447
- const entry = performance.getEntriesByType("resource").find((e) => e.name.includes("time.akamai.com"));
8448
- if (!entry) {
8449
- console.warn("No resource entry found for Akamai time request");
8450
- return 0;
8451
- }
8452
- const T0 = entry.fetchStart + performance.timeOrigin;
8453
- const T1 = entry.responseStart + performance.timeOrigin;
8454
- const offset = (T0 + T1) / 2 - TR;
8455
- return offset;
8456
- }
8457
- };
8458
-
8459
- export { AkamaiOffset, AudioLevel, AuthorizationToken, BaseByteBuffer12 as BaseByteBuffer, ByteBuffer, CaptureTimestamp, CastingError, ClientSetup, ClockNormalizer, CommonType, ControlMessage, ControlMessageType, ControlStream, DRAFT_14, DatagramObject, DatagramStatus, DeliveryTimeout, ExtensionHeader, ExtensionHeaders, Fetch, FetchCancel, FetchError, FetchErrorCode, FetchHeader, FetchHeaderType, FetchObject, FetchOk, FetchPublication, FetchRequest, FetchType, FilterType, FrozenByteBuffer5 as FrozenByteBuffer, FullTrackName, GoAway, GroupOrder, Header, HybridTrackSource, InternalError, InvalidTypeError, InvalidUTF8Error, KeyValueFormattingError, KeyValuePair, LOCHeaderExtensionId, LengthExceedsMaxError, LiveTrackSource, Location, MAX_FULL_TRACK_NAME_LENGTH, MAX_NAMESPACE_TUPLE_COUNT, MAX_REASON_PHRASE_LEN, MOQtailClient, MOQtailError, MaxAuthTokenCacheSize, MaxCacheDuration, MaxRequestId, MaxRequestId2 as MaxRequestIdParameter, MemoryObjectCache, MoqtObject, NetworkTelemetry, NotEnoughBytesError, ObjectDatagramStatusType, ObjectDatagramType, ObjectForwardingPreference, ObjectStatus, Path, PlayoutBuffer, ProtocolViolationError, Publish, PublishDone, PublishDoneStatusCode, PublishError, PublishErrorCode, PublishNamespace, PublishNamespaceCancel, PublishNamespaceDone, PublishNamespaceError, PublishNamespaceErrorCode, PublishNamespaceOk, PublishNamespaceRequest, PublishOk, PullPlayoutBuffer, ReasonPhrase, RecvDatagramStream, RecvStream, RequestIdError, RequestIdMap, RequestsBlocked, RingBufferObjectCache, SendDatagramStream, SendStream, ServerSetup, SetupParameter, SetupParameterType, SetupParameters, StaticTrackSource, SubgroupHeader, SubgroupHeaderType, SubgroupObject, Subscribe, SubscribeError, SubscribeErrorCode, SubscribeNamespace, SubscribeNamespaceError, SubscribeNamespaceErrorCode, SubscribeNamespaceOk, SubscribeNamespaceRequest, SubscribeOk, SubscribePublication, SubscribeRequest, SubscribeUpdate, Switch, TerminationCode, TerminationError, TimeoutError, TokenAliasType, TrackNameError, TrackStatus, TrackStatusCode, TrackStatusError, TrackStatusOk, Tuple, TupleField, Unsubscribe, UnsubscribeNamespace, VarIntOverflowError, VersionSpecificParameter, VersionSpecificParameterType, VersionSpecificParameters, VideoConfig, VideoFrameMarking, commonTypeFromNumber, controlMessageTypeFromBigInt, fetchErrorCodeFromBigInt, fetchTypeFromBigInt, filterTypeFromBigInt, groupOrderFromNumber, isBytes, isVarInt, locHeaderExtensionIdFromNumber, publishDoneStatusCodeFromBigInt, publishErrorCodeFromBigInt, publishNamespaceErrorCodeFromBigInt, setupParameterTypeFromNumber, subscribeErrorCodeFromBigInt, subscribeNamespaceErrorCodeFromBigInt, tokenAliasTypeFromNumber, trackStatusCodeFromBigInt, versionSpecificParameterTypeFromNumber };
8832
+ export { AudioLevel, AuthorizationToken, BaseByteBuffer12 as BaseByteBuffer, ByteBuffer, CaptureTimestamp, CastingError, ClientSetup, ClockNormalizer, CommonType, ControlMessage, ControlMessageType, ControlStream, DRAFT_14, DatagramObject, DatagramStatus, DeliveryTimeout, ExtensionHeader, ExtensionHeaders, Fetch, FetchCancel, FetchError, FetchErrorCode, FetchHeader, FetchHeaderType, FetchObject, FetchOk, FetchPublication, FetchRequest, FetchType, FilterType, FrozenByteBuffer5 as FrozenByteBuffer, FullTrackName, GoAway, GroupOrder, Header, HybridTrackSource, InternalError, InvalidTypeError, InvalidUTF8Error, KeyValueFormattingError, KeyValuePair, LOCHeaderExtensionId, LengthExceedsMaxError, LiveTrackSource, Location, MAX_FULL_TRACK_NAME_LENGTH, MAX_NAMESPACE_TUPLE_COUNT, MAX_REASON_PHRASE_LEN, MOQtailClient, MOQtailError, MaxAuthTokenCacheSize, MaxCacheDuration, MaxRequestId, MaxRequestId2 as MaxRequestIdParameter, MemoryObjectCache, MoqtObject, NetworkTelemetry, NotEnoughBytesError, ObjectDatagramStatusType, ObjectDatagramType, ObjectForwardingPreference, ObjectStatus, Path, PlayoutBuffer, ProtocolViolationError, Publish, PublishDone, PublishDoneStatusCode, PublishError, PublishErrorCode, PublishNamespace, PublishNamespaceCancel, PublishNamespaceDone, PublishNamespaceError, PublishNamespaceErrorCode, PublishNamespaceOk, PublishNamespaceRequest, PublishOk, PublishPublication, PublishRequest, PullPlayoutBuffer, ReasonPhrase, RecvDatagramStream, RecvStream, RequestIdError, RequestIdMap, RequestsBlocked, RingBufferObjectCache, SendDatagramStream, SendStream, ServerSetup, SetupParameter, SetupParameterType, SetupParameters, StaticTrackSource, SubgroupHeader, SubgroupHeaderType, SubgroupObject, Subscribe, SubscribeError, SubscribeErrorCode, SubscribeNamespace, SubscribeNamespaceError, SubscribeNamespaceErrorCode, SubscribeNamespaceOk, SubscribeNamespaceRequest, SubscribeOk, SubscribePublication, SubscribeRequest, SubscribeUpdate, Switch, TerminationCode, TerminationError, TimeoutError, TokenAliasType, TrackNameError, TrackStatus, TrackStatusCode, TrackStatusError, TrackStatusOk, Tuple, TupleField, Unsubscribe, UnsubscribeNamespace, VarIntOverflowError, VersionSpecificParameter, VersionSpecificParameterType, VersionSpecificParameters, VideoConfig, VideoFrameMarking, commonTypeFromNumber, controlMessageTypeFromBigInt, fetchErrorCodeFromBigInt, fetchTypeFromBigInt, filterTypeFromBigInt, groupOrderFromNumber, isBytes, isVarInt, locHeaderExtensionIdFromNumber, publishDoneStatusCodeFromBigInt, publishErrorCodeFromBigInt, publishNamespaceErrorCodeFromBigInt, setupParameterTypeFromNumber, subscribeErrorCodeFromBigInt, subscribeNamespaceErrorCodeFromBigInt, tokenAliasTypeFromNumber, trackStatusCodeFromBigInt, versionSpecificParameterTypeFromNumber };