@moqtap/codec 0.9.0 → 0.10.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.
Files changed (148) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/{chunk-KCH4BQXK.cjs → chunk-AQ445VV7.cjs} +15 -9
  3. package/dist/{chunk-UZO5Z2XT.cjs → chunk-BIBMDTU5.cjs} +12 -6
  4. package/dist/{chunk-23KRITJ6.js → chunk-BX2N7TZM.js} +14 -8
  5. package/dist/{chunk-XQGEOFGE.js → chunk-CF5DDD3Q.js} +14 -8
  6. package/dist/{chunk-YJGOD3Y4.js → chunk-FT3HDNIB.js} +33 -21
  7. package/dist/{chunk-TMXRYOBS.js → chunk-G53WYUXL.js} +13 -7
  8. package/dist/{chunk-JKMYAUGY.js → chunk-K2B3OVFK.js} +11 -8
  9. package/dist/{chunk-Q7NSUXXB.js → chunk-KGDVC4O6.js} +33 -21
  10. package/dist/{chunk-TVSFDQYE.cjs → chunk-KTNERCTZ.cjs} +33 -21
  11. package/dist/{chunk-H6DTAIWM.js → chunk-L5DRACXS.js} +22 -16
  12. package/dist/{chunk-UA5XFP4O.cjs → chunk-OUNN4IQB.cjs} +14 -8
  13. package/dist/{chunk-NH4L6NIY.js → chunk-OZRK73NQ.js} +12 -6
  14. package/dist/{chunk-PU2KV7VP.cjs → chunk-RYKQXBG6.cjs} +12 -6
  15. package/dist/{chunk-EVCPBFSR.cjs → chunk-SDJTSMOW.cjs} +23 -17
  16. package/dist/{chunk-MAXEHYVB.cjs → chunk-T4VWPKDG.cjs} +33 -21
  17. package/dist/{chunk-2XH6PHXR.js → chunk-TSUZ6GJV.js} +12 -6
  18. package/dist/{chunk-QGIHC6BA.cjs → chunk-UKKDOOUO.cjs} +12 -9
  19. package/dist/{chunk-BV6MITLO.js → chunk-WCPENYNE.js} +14 -8
  20. package/dist/{chunk-IADVBKEJ.cjs → chunk-WCTMPDUX.cjs} +15 -9
  21. package/dist/{chunk-7ENEWAMZ.cjs → chunk-XCRCAUGI.cjs} +15 -9
  22. package/dist/{codec-BMwgZIgG.d.ts → codec-08ZOr5wI.d.ts} +1 -1
  23. package/dist/{codec-DzLvG8Wb.d.cts → codec-Bd60SGKH.d.cts} +1 -1
  24. package/dist/{codec-CgZdadPt.d.cts → codec-BrTi4K7r.d.cts} +1 -1
  25. package/dist/{codec-D4RvFQmu.d.ts → codec-Bux_Q40X.d.ts} +1 -1
  26. package/dist/{codec-vddqy0KY.d.cts → codec-BxQTybUX.d.cts} +1 -1
  27. package/dist/{codec-C006F75E.d.ts → codec-C3mdsGx3.d.ts} +1 -1
  28. package/dist/{codec-CviAa4lp.d.ts → codec-CBdOIfMY.d.ts} +1 -1
  29. package/dist/{codec-Bym-K2q2.d.cts → codec-CFWu5KVT.d.cts} +1 -1
  30. package/dist/{codec-DJmqoIsp.d.cts → codec-CWnf8mn_.d.cts} +1 -1
  31. package/dist/{codec-BQa6Qsav.d.ts → codec-Cm3D261p.d.ts} +1 -1
  32. package/dist/{codec-C5evFHL-.d.ts → codec-CwZ6OCPP.d.ts} +1 -1
  33. package/dist/{codec-DchsPfr3.d.cts → codec-Czejcmxr.d.cts} +1 -1
  34. package/dist/{codec-C_xxsbKy.d.cts → codec-DNmiG2e0.d.cts} +1 -1
  35. package/dist/{codec-O-1Js7h4.d.ts → codec-DOmAmFkI.d.ts} +1 -1
  36. package/dist/{codec-Cl73EfRW.d.ts → codec-DaXjRrOV.d.ts} +1 -1
  37. package/dist/{codec-DAyiF5sq.d.cts → codec-EvybrBuY.d.cts} +1 -1
  38. package/dist/{codec-CA6nbbEk.d.ts → codec-alVA27Uc.d.ts} +1 -1
  39. package/dist/{codec-CSBFdPgP.d.cts → codec-f7vxeVIS.d.cts} +1 -1
  40. package/dist/{codec-BKsVu3Fr.d.ts → codec-gl4_QEva.d.ts} +1 -1
  41. package/dist/{codec-CtvFK4aV.d.cts → codec-guzqtfMk.d.cts} +1 -1
  42. package/dist/draft11-session.d.cts +1 -1
  43. package/dist/draft11-session.d.ts +1 -1
  44. package/dist/draft11.cjs +2 -2
  45. package/dist/draft11.d.cts +3 -3
  46. package/dist/draft11.d.ts +3 -3
  47. package/dist/draft11.js +1 -1
  48. package/dist/draft12-session.d.cts +1 -1
  49. package/dist/draft12-session.d.ts +1 -1
  50. package/dist/draft12.cjs +2 -2
  51. package/dist/draft12.d.cts +3 -3
  52. package/dist/draft12.d.ts +3 -3
  53. package/dist/draft12.js +1 -1
  54. package/dist/draft13-session.d.cts +1 -1
  55. package/dist/draft13-session.d.ts +1 -1
  56. package/dist/draft13.cjs +2 -2
  57. package/dist/draft13.d.cts +3 -3
  58. package/dist/draft13.d.ts +3 -3
  59. package/dist/draft13.js +1 -1
  60. package/dist/draft14-session.d.cts +1 -1
  61. package/dist/draft14-session.d.ts +1 -1
  62. package/dist/draft14.cjs +2 -2
  63. package/dist/draft14.d.cts +3 -3
  64. package/dist/draft14.d.ts +3 -3
  65. package/dist/draft14.js +1 -1
  66. package/dist/draft15-session.d.cts +1 -1
  67. package/dist/draft15-session.d.ts +1 -1
  68. package/dist/draft15.cjs +2 -2
  69. package/dist/draft15.d.cts +3 -3
  70. package/dist/draft15.d.ts +3 -3
  71. package/dist/draft15.js +1 -1
  72. package/dist/draft16-session.d.cts +1 -1
  73. package/dist/draft16-session.d.ts +1 -1
  74. package/dist/draft16.cjs +2 -2
  75. package/dist/draft16.d.cts +3 -3
  76. package/dist/draft16.d.ts +3 -3
  77. package/dist/draft16.js +1 -1
  78. package/dist/draft17-session.d.cts +1 -1
  79. package/dist/draft17-session.d.ts +1 -1
  80. package/dist/draft17.cjs +2 -2
  81. package/dist/draft17.d.cts +3 -3
  82. package/dist/draft17.d.ts +3 -3
  83. package/dist/draft17.js +1 -1
  84. package/dist/draft18-session.d.cts +1 -1
  85. package/dist/draft18-session.d.ts +1 -1
  86. package/dist/draft18.cjs +2 -2
  87. package/dist/draft18.d.cts +3 -3
  88. package/dist/draft18.d.ts +3 -3
  89. package/dist/draft18.js +1 -1
  90. package/dist/draft19-session.d.cts +1 -1
  91. package/dist/draft19-session.d.ts +1 -1
  92. package/dist/draft19.cjs +2 -2
  93. package/dist/draft19.d.cts +3 -3
  94. package/dist/draft19.d.ts +3 -3
  95. package/dist/draft19.js +1 -1
  96. package/dist/draft20-session.d.cts +1 -1
  97. package/dist/draft20-session.d.ts +1 -1
  98. package/dist/draft20.cjs +2 -2
  99. package/dist/draft20.d.cts +3 -3
  100. package/dist/draft20.d.ts +3 -3
  101. package/dist/draft20.js +1 -1
  102. package/dist/index.cjs +20 -20
  103. package/dist/index.d.cts +20 -20
  104. package/dist/index.d.ts +20 -20
  105. package/dist/index.js +10 -10
  106. package/dist/session.d.cts +10 -10
  107. package/dist/session.d.ts +10 -10
  108. package/dist/{types-Cqp10JtB.d.cts → types-Bg86GGVZ.d.cts} +2 -2
  109. package/dist/{types-Cqp10JtB.d.ts → types-Bg86GGVZ.d.ts} +2 -2
  110. package/dist/{types-zHgCS6o5.d.cts → types-C1rxh-id.d.cts} +7 -7
  111. package/dist/{types-zHgCS6o5.d.ts → types-C1rxh-id.d.ts} +7 -7
  112. package/dist/{types-Bio-91Rt.d.cts → types-CI_SX4Xe.d.cts} +2 -2
  113. package/dist/{types-Bio-91Rt.d.ts → types-CI_SX4Xe.d.ts} +2 -2
  114. package/dist/{types-CWCQwuvy.d.cts → types-CY-QWxd-.d.cts} +11 -11
  115. package/dist/{types-CWCQwuvy.d.ts → types-CY-QWxd-.d.ts} +11 -11
  116. package/dist/{types-Cm9fjeYC.d.cts → types-CZTzbIzQ.d.cts} +2 -2
  117. package/dist/{types-Cm9fjeYC.d.ts → types-CZTzbIzQ.d.ts} +2 -2
  118. package/dist/{types-HI_bbXka.d.cts → types-CmqT0jUf.d.cts} +1 -1
  119. package/dist/{types-HI_bbXka.d.ts → types-CmqT0jUf.d.ts} +1 -1
  120. package/dist/{types-Ck45Ex5S.d.cts → types-D0kTgUuL.d.cts} +1 -1
  121. package/dist/{types-Ck45Ex5S.d.ts → types-D0kTgUuL.d.ts} +1 -1
  122. package/dist/{types-D9eiB_9A.d.cts → types-D4bmW8rY.d.cts} +2 -2
  123. package/dist/{types-D9eiB_9A.d.ts → types-D4bmW8rY.d.ts} +2 -2
  124. package/dist/{types-CXlSn0I9.d.cts → types-DjxexghA.d.cts} +2 -2
  125. package/dist/{types-CXlSn0I9.d.ts → types-DjxexghA.d.ts} +2 -2
  126. package/dist/{types-CPaYBsMG.d.cts → types-pShrs3fN.d.cts} +2 -2
  127. package/dist/{types-CPaYBsMG.d.ts → types-pShrs3fN.d.ts} +2 -2
  128. package/package.json +2 -2
  129. package/src/drafts/draft11/codec.ts +11 -8
  130. package/src/drafts/draft11/types.ts +1 -1
  131. package/src/drafts/draft12/codec.ts +22 -16
  132. package/src/drafts/draft12/types.ts +2 -2
  133. package/src/drafts/draft13/codec.ts +14 -8
  134. package/src/drafts/draft13/types.ts +2 -2
  135. package/src/drafts/draft14/codec.ts +14 -8
  136. package/src/drafts/draft14/types.ts +1 -1
  137. package/src/drafts/draft15/codec.ts +14 -8
  138. package/src/drafts/draft15/types.ts +2 -2
  139. package/src/drafts/draft16/codec.ts +13 -7
  140. package/src/drafts/draft16/types.ts +2 -2
  141. package/src/drafts/draft17/codec.ts +12 -6
  142. package/src/drafts/draft17/types.ts +2 -2
  143. package/src/drafts/draft18/codec.ts +12 -6
  144. package/src/drafts/draft18/types.ts +2 -2
  145. package/src/drafts/draft19/codec.ts +33 -21
  146. package/src/drafts/draft19/types.ts +10 -7
  147. package/src/drafts/draft20/codec.ts +33 -21
  148. package/src/drafts/draft20/types.ts +17 -11
package/CHANGELOG.md CHANGED
@@ -7,6 +7,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  This file starts at 0.9.0. Earlier releases are in the git history.
9
9
 
10
+ ## [0.10.0] - 2026-09-03
11
+
12
+ ### Changed
13
+
14
+ - **Breaking.** `authorization_token` is `readonly AuthorizationToken[]` on
15
+ drafts 11 through 20, on message parameters and on setup options. A single
16
+ token is a one-element array.
17
+
18
+ Section 10.2.2 and its equivalents: "The AUTHORIZATION TOKEN parameter MAY be
19
+ repeated within a message as long as the combination of Token Type and Token
20
+ Value are unique after resolving any aliases."
21
+
22
+ - **Breaking.** `subgroup_filter`, `objectid_filter`, `priority_filter`,
23
+ `object_property_filter` and `track_property_filter` are
24
+ `readonly RangeFilter[]` on drafts 19 and 20, on message parameters and on
25
+ draft-20's `FILL_PARAMETERS`. A single filter is a one-element array.
26
+
27
+ Section 5.1.3 on draft-19 and 5.1.4 on draft-20: "All other filter parameters
28
+ MAY appear multiple times in a FETCH, SUBSCRIBE, SUBSCRIBE_TRACKS, or
29
+ REQUEST_UPDATE". One filter parameter carries one SetID and the sets are ORed,
30
+ so two alternatives over the same field need two parameters.
31
+
32
+ - `@moqtap/test-vectors` raised to `^0.15.0`, where a `decoded` message spells
33
+ each Key-Value-Pair block as a list of entries in wire order rather than as a
34
+ map keyed by parameter name.
35
+
10
36
  ## [0.9.0] - 2026-09-03
11
37
 
12
38
  Draft-20 support, and a fix to draft-19 that changes which state machine a
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
3
 
4
4
 
@@ -411,7 +411,7 @@ function encodeSetupParams(params, w) {
411
411
  let count = 0;
412
412
  if (params.path !== void 0) count++;
413
413
  if (params.max_request_id !== void 0) count++;
414
- if (params.authorization_token !== void 0) count++;
414
+ count += _nullishCoalesce(_optionalChain([params, 'access', _2 => _2.authorization_token, 'optionalAccess', _3 => _3.length]), () => ( 0));
415
415
  if (params.max_auth_token_cache_size !== void 0) count++;
416
416
  if (params.unknown) count += params.unknown.length;
417
417
  w.writeVarInt(count);
@@ -425,9 +425,9 @@ function encodeSetupParams(params, w) {
425
425
  w.writeVarInt(SETUP_PARAM_MAX_REQUEST_ID);
426
426
  w.writeVarInt(params.max_request_id);
427
427
  }
428
- if (params.authorization_token !== void 0) {
428
+ for (const token of _nullishCoalesce(params.authorization_token, () => ( []))) {
429
429
  w.writeVarInt(SETUP_PARAM_AUTHORIZATION_TOKEN);
430
- encodeAuthorizationToken(params.authorization_token, w);
430
+ encodeAuthorizationToken(token, w);
431
431
  }
432
432
  if (params.max_auth_token_cache_size !== void 0) {
433
433
  w.writeVarInt(SETUP_PARAM_MAX_AUTH_TOKEN_CACHE_SIZE);
@@ -477,7 +477,10 @@ function decodeSetupParams(r) {
477
477
  const bytes = r.readBytes(length);
478
478
  result.path = textDecoder.decode(bytes);
479
479
  } else if (paramType === SETUP_PARAM_AUTHORIZATION_TOKEN) {
480
- result.authorization_token = decodeAuthorizationToken(r, length);
480
+ result.authorization_token = [
481
+ ..._nullishCoalesce(result.authorization_token, () => ( [])),
482
+ decodeAuthorizationToken(r, length)
483
+ ];
481
484
  } else {
482
485
  const bytes = r.readBytes(length);
483
486
  unknown.push({
@@ -494,16 +497,16 @@ function decodeSetupParams(r) {
494
497
  function encodeParams(params, w) {
495
498
  let count = params.unknown ? params.unknown.length : 0;
496
499
  if (params.delivery_timeout !== void 0) count++;
497
- if (params.authorization_token !== void 0) count++;
500
+ count += _nullishCoalesce(_optionalChain([params, 'access', _4 => _4.authorization_token, 'optionalAccess', _5 => _5.length]), () => ( 0));
498
501
  if (params.max_cache_duration !== void 0) count++;
499
502
  w.writeVarInt(count);
500
503
  if (params.delivery_timeout !== void 0) {
501
504
  w.writeVarInt(PARAM_DELIVERY_TIMEOUT);
502
505
  w.writeVarInt(params.delivery_timeout);
503
506
  }
504
- if (params.authorization_token !== void 0) {
507
+ for (const token of _nullishCoalesce(params.authorization_token, () => ( []))) {
505
508
  w.writeVarInt(PARAM_AUTHORIZATION_TOKEN);
506
- encodeAuthorizationToken(params.authorization_token, w);
509
+ encodeAuthorizationToken(token, w);
507
510
  }
508
511
  if (params.max_cache_duration !== void 0) {
509
512
  w.writeVarInt(PARAM_MAX_CACHE_DURATION);
@@ -550,7 +553,10 @@ function decodeParams(r) {
550
553
  } else {
551
554
  const length = Number(r.readVarInt());
552
555
  if (paramType === PARAM_AUTHORIZATION_TOKEN) {
553
- result.authorization_token = decodeAuthorizationToken(r, length);
556
+ result.authorization_token = [
557
+ ..._nullishCoalesce(result.authorization_token, () => ( [])),
558
+ decodeAuthorizationToken(r, length)
559
+ ];
554
560
  } else {
555
561
  const bytes = r.readBytes(length);
556
562
  unknown.push({
@@ -935,12 +935,12 @@ function encodeSetupOptions(opts, writer) {
935
935
  }
936
936
  });
937
937
  }
938
- if (opts.authorization_token !== void 0) {
938
+ for (const token of _nullishCoalesce(opts.authorization_token, () => ( []))) {
939
939
  entries.push({
940
940
  type: SETUP_OPT_AUTHORIZATION_TOKEN,
941
941
  encode: (w) => {
942
942
  const tmpW = new (0, _chunk4XLYCT5Qcjs.MoqtBufferWriter)(64);
943
- encodeAuthorizationToken(opts.authorization_token, tmpW);
943
+ encodeAuthorizationToken(token, tmpW);
944
944
  const raw = tmpW.finish();
945
945
  w.writeVarInt(BigInt(raw.byteLength));
946
946
  w.writeBytes(raw);
@@ -1028,7 +1028,10 @@ function decodeSetupOptions(reader, payloadEnd) {
1028
1028
  if (optType === SETUP_OPT_PATH) {
1029
1029
  result.path = textDecoder.decode(bytes);
1030
1030
  } else if (optType === SETUP_OPT_AUTHORIZATION_TOKEN) {
1031
- result.authorization_token = decodeAuthorizationToken(new (0, _chunk4XLYCT5Qcjs.MoqtBufferReader)(bytes));
1031
+ result.authorization_token = [
1032
+ ..._nullishCoalesce(result.authorization_token, () => ( [])),
1033
+ decodeAuthorizationToken(new (0, _chunk4XLYCT5Qcjs.MoqtBufferReader)(bytes))
1034
+ ];
1032
1035
  } else if (optType === SETUP_OPT_AUTHORITY) {
1033
1036
  result.authority = textDecoder.decode(bytes);
1034
1037
  } else if (optType === SETUP_OPT_MOQT_IMPLEMENTATION) {
@@ -1138,12 +1141,12 @@ function encodeParams(params, writer) {
1138
1141
  encode: (w) => w.writeVarInt(params.object_delivery_timeout)
1139
1142
  });
1140
1143
  }
1141
- if (params.authorization_token !== void 0) {
1144
+ for (const token of _nullishCoalesce(params.authorization_token, () => ( []))) {
1142
1145
  entries.push({
1143
1146
  type: PARAM_AUTHORIZATION_TOKEN,
1144
1147
  encode: (w) => {
1145
1148
  const tmpW = new (0, _chunk4XLYCT5Qcjs.MoqtBufferWriter)(64);
1146
- encodeAuthorizationToken(params.authorization_token, tmpW);
1149
+ encodeAuthorizationToken(token, tmpW);
1147
1150
  const raw = tmpW.finish();
1148
1151
  w.writeVarInt(BigInt(raw.byteLength));
1149
1152
  w.writeBytes(raw);
@@ -1283,7 +1286,10 @@ function decodeParams(reader, messageType) {
1283
1286
  } else if (paramType === PARAM_AUTHORIZATION_TOKEN) {
1284
1287
  const length = Number(reader.readVarInt());
1285
1288
  const bytes = reader.readBytes(length);
1286
- result.authorization_token = decodeAuthorizationToken(new (0, _chunk4XLYCT5Qcjs.MoqtBufferReader)(bytes));
1289
+ result.authorization_token = [
1290
+ ..._nullishCoalesce(result.authorization_token, () => ( [])),
1291
+ decodeAuthorizationToken(new (0, _chunk4XLYCT5Qcjs.MoqtBufferReader)(bytes))
1292
+ ];
1287
1293
  } else if (paramType === PARAM_RENDEZVOUS_TIMEOUT) {
1288
1294
  result.rendezvous_timeout = reader.readVarInt();
1289
1295
  } else if (paramType === PARAM_SUBGROUP_DELIVERY_TIMEOUT) {
@@ -411,7 +411,7 @@ function encodeSetupParams(params, w) {
411
411
  let count = 0;
412
412
  if (params.path !== void 0) count++;
413
413
  if (params.max_request_id !== void 0) count++;
414
- if (params.authorization_token !== void 0) count++;
414
+ count += params.authorization_token?.length ?? 0;
415
415
  if (params.max_auth_token_cache_size !== void 0) count++;
416
416
  if (params.unknown) count += params.unknown.length;
417
417
  w.writeVarInt(count);
@@ -425,9 +425,9 @@ function encodeSetupParams(params, w) {
425
425
  w.writeVarInt(SETUP_PARAM_MAX_REQUEST_ID);
426
426
  w.writeVarInt(params.max_request_id);
427
427
  }
428
- if (params.authorization_token !== void 0) {
428
+ for (const token of params.authorization_token ?? []) {
429
429
  w.writeVarInt(SETUP_PARAM_AUTHORIZATION_TOKEN);
430
- encodeAuthorizationToken(params.authorization_token, w);
430
+ encodeAuthorizationToken(token, w);
431
431
  }
432
432
  if (params.max_auth_token_cache_size !== void 0) {
433
433
  w.writeVarInt(SETUP_PARAM_MAX_AUTH_TOKEN_CACHE_SIZE);
@@ -477,7 +477,10 @@ function decodeSetupParams(r) {
477
477
  const bytes = r.readBytes(length);
478
478
  result.path = textDecoder.decode(bytes);
479
479
  } else if (paramType === SETUP_PARAM_AUTHORIZATION_TOKEN) {
480
- result.authorization_token = decodeAuthorizationToken(r, length);
480
+ result.authorization_token = [
481
+ ...result.authorization_token ?? [],
482
+ decodeAuthorizationToken(r, length)
483
+ ];
481
484
  } else {
482
485
  const bytes = r.readBytes(length);
483
486
  unknown.push({
@@ -494,16 +497,16 @@ function decodeSetupParams(r) {
494
497
  function encodeParams(params, w) {
495
498
  let count = params.unknown ? params.unknown.length : 0;
496
499
  if (params.delivery_timeout !== void 0) count++;
497
- if (params.authorization_token !== void 0) count++;
500
+ count += params.authorization_token?.length ?? 0;
498
501
  if (params.max_cache_duration !== void 0) count++;
499
502
  w.writeVarInt(count);
500
503
  if (params.delivery_timeout !== void 0) {
501
504
  w.writeVarInt(PARAM_DELIVERY_TIMEOUT);
502
505
  w.writeVarInt(params.delivery_timeout);
503
506
  }
504
- if (params.authorization_token !== void 0) {
507
+ for (const token of params.authorization_token ?? []) {
505
508
  w.writeVarInt(PARAM_AUTHORIZATION_TOKEN);
506
- encodeAuthorizationToken(params.authorization_token, w);
509
+ encodeAuthorizationToken(token, w);
507
510
  }
508
511
  if (params.max_cache_duration !== void 0) {
509
512
  w.writeVarInt(PARAM_MAX_CACHE_DURATION);
@@ -550,7 +553,10 @@ function decodeParams(r) {
550
553
  } else {
551
554
  const length = Number(r.readVarInt());
552
555
  if (paramType === PARAM_AUTHORIZATION_TOKEN) {
553
- result.authorization_token = decodeAuthorizationToken(r, length);
556
+ result.authorization_token = [
557
+ ...result.authorization_token ?? [],
558
+ decodeAuthorizationToken(r, length)
559
+ ];
554
560
  } else {
555
561
  const bytes = r.readBytes(length);
556
562
  unknown.push({
@@ -801,7 +801,7 @@ function encodeSetupParams(params, writer) {
801
801
  if (params.role !== void 0) count++;
802
802
  if (params.path !== void 0) count++;
803
803
  if (params.max_request_id !== void 0) count++;
804
- if (params.authorization_token !== void 0) count++;
804
+ count += params.authorization_token?.length ?? 0;
805
805
  if (params.authority !== void 0) count++;
806
806
  if (params.max_auth_token_cache_size !== void 0) count++;
807
807
  if (params.moqt_implementation !== void 0) count++;
@@ -821,9 +821,9 @@ function encodeSetupParams(params, writer) {
821
821
  writer.writeVarInt(PARAM_MAX_REQUEST_ID);
822
822
  writer.writeVarInt(params.max_request_id);
823
823
  }
824
- if (params.authorization_token !== void 0) {
824
+ for (const token of params.authorization_token ?? []) {
825
825
  writer.writeVarInt(PARAM_AUTHORIZATION_TOKEN);
826
- const tok = params.authorization_token;
826
+ const tok = token;
827
827
  const tmpWriter = new BufferWriter(64);
828
828
  tmpWriter.writeVarInt(tok.alias_type);
829
829
  if (tok.token_type !== void 0) {
@@ -905,7 +905,10 @@ function decodeSetupParams(reader) {
905
905
  tok.token_value = new Uint8Array(tokenValue);
906
906
  }
907
907
  }
908
- result.authorization_token = tok;
908
+ result.authorization_token = [
909
+ ...result.authorization_token ?? [],
910
+ tok
911
+ ];
909
912
  } else if (paramType === PARAM_AUTHORITY) {
910
913
  result.authority = textDecoder.decode(bytes);
911
914
  } else if (paramType === PARAM_MOQT_IMPLEMENTATION) {
@@ -925,7 +928,7 @@ function decodeSetupParams(reader) {
925
928
  function encodeMessageParams(params, writer) {
926
929
  let count = 0;
927
930
  if (params.delivery_timeout !== void 0) count++;
928
- if (params.authorization_token !== void 0) count++;
931
+ count += params.authorization_token?.length ?? 0;
929
932
  if (params.max_cache_duration !== void 0) count++;
930
933
  if (params.unknown) count += params.unknown.length;
931
934
  writer.writeVarInt(count);
@@ -933,9 +936,9 @@ function encodeMessageParams(params, writer) {
933
936
  writer.writeVarInt(PARAM_DELIVERY_TIMEOUT);
934
937
  writer.writeVarInt(params.delivery_timeout);
935
938
  }
936
- if (params.authorization_token !== void 0) {
939
+ for (const token of params.authorization_token ?? []) {
937
940
  writer.writeVarInt(PARAM_AUTHORIZATION_TOKEN);
938
- const tok = params.authorization_token;
941
+ const tok = token;
939
942
  const tmpWriter = new BufferWriter(64);
940
943
  tmpWriter.writeVarInt(tok.alias_type);
941
944
  if (tok.token_type !== void 0) {
@@ -1001,7 +1004,10 @@ function decodeMessageParams(reader) {
1001
1004
  tok.token_value = new Uint8Array(tokenValue);
1002
1005
  }
1003
1006
  }
1004
- result.authorization_token = tok;
1007
+ result.authorization_token = [
1008
+ ...result.authorization_token ?? [],
1009
+ tok
1010
+ ];
1005
1011
  } else {
1006
1012
  unknown.push({
1007
1013
  id: `0x${paramType.toString(16)}`,
@@ -1079,12 +1079,12 @@ function encodeSetupOptions(opts, writer) {
1079
1079
  }
1080
1080
  });
1081
1081
  }
1082
- if (opts.authorization_token !== void 0) {
1082
+ for (const token of opts.authorization_token ?? []) {
1083
1083
  entries.push({
1084
1084
  type: SETUP_OPT_AUTHORIZATION_TOKEN,
1085
1085
  encode: (w) => {
1086
1086
  const tmpW = new MoqtBufferWriter(64);
1087
- encodeAuthorizationToken(opts.authorization_token, tmpW);
1087
+ encodeAuthorizationToken(token, tmpW);
1088
1088
  const raw = tmpW.finish();
1089
1089
  w.writeVarInt(BigInt(raw.byteLength));
1090
1090
  w.writeBytes(raw);
@@ -1188,7 +1188,10 @@ function decodeSetupOptions(reader, payloadEnd) {
1188
1188
  if (optType === SETUP_OPT_PATH) {
1189
1189
  result.path = textDecoder.decode(bytes);
1190
1190
  } else if (optType === SETUP_OPT_AUTHORIZATION_TOKEN) {
1191
- result.authorization_token = decodeAuthorizationToken(new MoqtBufferReader(bytes));
1191
+ result.authorization_token = [
1192
+ ...result.authorization_token ?? [],
1193
+ decodeAuthorizationToken(new MoqtBufferReader(bytes))
1194
+ ];
1192
1195
  } else if (optType === SETUP_OPT_AUTHORITY) {
1193
1196
  result.authority = textDecoder.decode(bytes);
1194
1197
  } else if (optType === SETUP_OPT_MOQT_IMPLEMENTATION) {
@@ -1469,12 +1472,12 @@ function encodeParams(params, writer) {
1469
1472
  encode: (w) => w.writeVarInt(params.object_delivery_timeout)
1470
1473
  });
1471
1474
  }
1472
- if (params.authorization_token !== void 0) {
1475
+ for (const token of params.authorization_token ?? []) {
1473
1476
  entries.push({
1474
1477
  type: PARAM_AUTHORIZATION_TOKEN,
1475
1478
  encode: (w) => {
1476
1479
  const tmpW = new MoqtBufferWriter(64);
1477
- encodeAuthorizationToken(params.authorization_token, tmpW);
1480
+ encodeAuthorizationToken(token, tmpW);
1478
1481
  const raw = tmpW.finish();
1479
1482
  w.writeVarInt(BigInt(raw.byteLength));
1480
1483
  w.writeBytes(raw);
@@ -1554,34 +1557,34 @@ function encodeParams(params, writer) {
1554
1557
  }
1555
1558
  });
1556
1559
  }
1557
- if (params.subgroup_filter !== void 0) {
1560
+ for (const filter of params.subgroup_filter ?? []) {
1558
1561
  entries.push({
1559
1562
  type: PARAM_SUBGROUP_FILTER,
1560
- encode: (w) => encodeRangeFilter(params.subgroup_filter, false, w)
1563
+ encode: (w) => encodeRangeFilter(filter, false, w)
1561
1564
  });
1562
1565
  }
1563
- if (params.objectid_filter !== void 0) {
1566
+ for (const filter of params.objectid_filter ?? []) {
1564
1567
  entries.push({
1565
1568
  type: PARAM_OBJECTID_FILTER,
1566
- encode: (w) => encodeRangeFilter(params.objectid_filter, false, w)
1569
+ encode: (w) => encodeRangeFilter(filter, false, w)
1567
1570
  });
1568
1571
  }
1569
- if (params.priority_filter !== void 0) {
1572
+ for (const filter of params.priority_filter ?? []) {
1570
1573
  entries.push({
1571
1574
  type: PARAM_PRIORITY_FILTER,
1572
- encode: (w) => encodeRangeFilter(params.priority_filter, false, w)
1575
+ encode: (w) => encodeRangeFilter(filter, false, w)
1573
1576
  });
1574
1577
  }
1575
- if (params.object_property_filter !== void 0) {
1578
+ for (const filter of params.object_property_filter ?? []) {
1576
1579
  entries.push({
1577
1580
  type: PARAM_OBJECT_PROPERTY_FILTER,
1578
- encode: (w) => encodeRangeFilter(params.object_property_filter, true, w)
1581
+ encode: (w) => encodeRangeFilter(filter, true, w)
1579
1582
  });
1580
1583
  }
1581
- if (params.track_property_filter !== void 0) {
1584
+ for (const filter of params.track_property_filter ?? []) {
1582
1585
  entries.push({
1583
1586
  type: PARAM_TRACK_PROPERTY_FILTER,
1584
- encode: (w) => encodeRangeFilter(params.track_property_filter, true, w)
1587
+ encode: (w) => encodeRangeFilter(filter, true, w)
1585
1588
  });
1586
1589
  }
1587
1590
  if (params.new_group_request !== void 0) {
@@ -1650,7 +1653,10 @@ function decodeParams(reader, messageType) {
1650
1653
  } else if (paramType === PARAM_AUTHORIZATION_TOKEN) {
1651
1654
  const length = Number(reader.readVarInt());
1652
1655
  const bytes = reader.readBytes(length);
1653
- result.authorization_token = decodeAuthorizationToken(new MoqtBufferReader(bytes));
1656
+ result.authorization_token = [
1657
+ ...result.authorization_token ?? [],
1658
+ decodeAuthorizationToken(new MoqtBufferReader(bytes))
1659
+ ];
1654
1660
  } else if (paramType === PARAM_RENDEZVOUS_TIMEOUT) {
1655
1661
  result.rendezvous_timeout = reader.readVarInt();
1656
1662
  } else if (paramType === PARAM_SUBGROUP_DELIVERY_TIMEOUT) {
@@ -1674,15 +1680,21 @@ function decodeParams(reader, messageType) {
1674
1680
  } else if (paramType === PARAM_FILL_PARAMETERS) {
1675
1681
  result.fill_parameters = decodeFillParameters(reader);
1676
1682
  } else if (paramType === PARAM_SUBGROUP_FILTER) {
1677
- result.subgroup_filter = decodeRangeFilter(reader, false);
1683
+ result.subgroup_filter = [...result.subgroup_filter ?? [], decodeRangeFilter(reader, false)];
1678
1684
  } else if (paramType === PARAM_OBJECTID_FILTER) {
1679
- result.objectid_filter = decodeRangeFilter(reader, false);
1685
+ result.objectid_filter = [...result.objectid_filter ?? [], decodeRangeFilter(reader, false)];
1680
1686
  } else if (paramType === PARAM_PRIORITY_FILTER) {
1681
- result.priority_filter = decodeRangeFilter(reader, false);
1687
+ result.priority_filter = [...result.priority_filter ?? [], decodeRangeFilter(reader, false)];
1682
1688
  } else if (paramType === PARAM_OBJECT_PROPERTY_FILTER) {
1683
- result.object_property_filter = decodeRangeFilter(reader, true);
1689
+ result.object_property_filter = [
1690
+ ...result.object_property_filter ?? [],
1691
+ decodeRangeFilter(reader, true)
1692
+ ];
1684
1693
  } else if (paramType === PARAM_TRACK_PROPERTY_FILTER) {
1685
- result.track_property_filter = decodeRangeFilter(reader, true);
1694
+ result.track_property_filter = [
1695
+ ...result.track_property_filter ?? [],
1696
+ decodeRangeFilter(reader, true)
1697
+ ];
1686
1698
  } else if (paramType === PARAM_NEW_GROUP_REQUEST) {
1687
1699
  result.new_group_request = reader.readVarInt();
1688
1700
  } else if (paramType === PARAM_TRACK_NAMESPACE_PREFIX) {
@@ -776,7 +776,7 @@ function encodeSetupParams(params, writer) {
776
776
  let count = 0;
777
777
  if (params.path !== void 0) count++;
778
778
  if (params.max_request_id !== void 0) count++;
779
- if (params.authorization_token !== void 0) count++;
779
+ count += params.authorization_token?.length ?? 0;
780
780
  if (params.max_auth_token_cache_size !== void 0) count++;
781
781
  if (params.authority !== void 0) count++;
782
782
  if (params.moqt_implementation !== void 0) count++;
@@ -792,10 +792,10 @@ function encodeSetupParams(params, writer) {
792
792
  writer.writeVarInt(SETUP_PARAM_MAX_REQUEST_ID);
793
793
  writer.writeVarInt(params.max_request_id);
794
794
  }
795
- if (params.authorization_token !== void 0) {
795
+ for (const token of params.authorization_token ?? []) {
796
796
  writer.writeVarInt(SETUP_PARAM_AUTHORIZATION_TOKEN);
797
797
  const tmpW = new BufferWriter(64);
798
- encodeAuthorizationToken(params.authorization_token, tmpW);
798
+ encodeAuthorizationToken(token, tmpW);
799
799
  const raw = tmpW.finish();
800
800
  writer.writeVarInt(raw.byteLength);
801
801
  writer.writeBytes(raw);
@@ -861,7 +861,10 @@ function decodeSetupParams(reader) {
861
861
  if (paramType === SETUP_PARAM_PATH) {
862
862
  result.path = textDecoder.decode(bytes);
863
863
  } else if (paramType === SETUP_PARAM_AUTHORIZATION_TOKEN) {
864
- result.authorization_token = decodeAuthorizationToken(new BufferReader(bytes));
864
+ result.authorization_token = [
865
+ ...result.authorization_token ?? [],
866
+ decodeAuthorizationToken(new BufferReader(bytes))
867
+ ];
865
868
  } else if (paramType === SETUP_PARAM_AUTHORITY) {
866
869
  result.authority = textDecoder.decode(bytes);
867
870
  } else if (paramType === SETUP_PARAM_MOQT_IMPLEMENTATION) {
@@ -994,12 +997,12 @@ function encodeParams(params, writer) {
994
997
  encode: (w) => w.writeVarInt(params.delivery_timeout)
995
998
  });
996
999
  }
997
- if (params.authorization_token !== void 0) {
1000
+ for (const token of params.authorization_token ?? []) {
998
1001
  entries.push({
999
1002
  type: PARAM_AUTHORIZATION_TOKEN,
1000
1003
  encode: (w) => {
1001
1004
  const tmpW = new BufferWriter(64);
1002
- encodeAuthorizationToken(params.authorization_token, tmpW);
1005
+ encodeAuthorizationToken(token, tmpW);
1003
1006
  const raw = tmpW.finish();
1004
1007
  w.writeVarInt(raw.byteLength);
1005
1008
  w.writeBytes(raw);
@@ -1121,7 +1124,10 @@ function decodeParams(reader) {
1121
1124
  } else if (paramType === PARAM_AUTHORIZATION_TOKEN) {
1122
1125
  const length = Number(reader.readVarInt());
1123
1126
  const tokenBytes = reader.readBytes(length);
1124
- result.authorization_token = decodeAuthorizationToken(new BufferReader(tokenBytes));
1127
+ result.authorization_token = [
1128
+ ...result.authorization_token ?? [],
1129
+ decodeAuthorizationToken(new BufferReader(tokenBytes))
1130
+ ];
1125
1131
  } else if (paramType === PARAM_MAX_CACHE_DURATION) {
1126
1132
  result.max_cache_duration = reader.readVarInt();
1127
1133
  } else if (paramType === PARAM_EXPIRES) {
@@ -428,13 +428,13 @@ function decodeSetupParams(r) {
428
428
  }
429
429
  function encodeParams(params, w) {
430
430
  let count = params.unknown ? params.unknown.length : 0;
431
- if (params.authorization_token !== void 0) count++;
431
+ count += params.authorization_token?.length ?? 0;
432
432
  if (params.delivery_timeout !== void 0) count++;
433
433
  if (params.max_cache_duration !== void 0) count++;
434
434
  w.writeVarInt(count);
435
- if (params.authorization_token !== void 0) {
435
+ for (const token of params.authorization_token ?? []) {
436
436
  w.writeVarInt(PARAM_AUTHORIZATION_TOKEN);
437
- const at = params.authorization_token;
437
+ const at = token;
438
438
  const tmpW = new BufferWriter(64);
439
439
  tmpW.writeVarInt(at.alias_type);
440
440
  tmpW.writeVarInt(at.token_type);
@@ -497,11 +497,14 @@ function decodeParams(r) {
497
497
  const token_type = r.readVarInt();
498
498
  const tokenBytesLen = length - (r.offset - startOff);
499
499
  const tokenBytes = r.readBytes(tokenBytesLen);
500
- result.authorization_token = {
501
- alias_type,
502
- token_type,
503
- token_value: tokenBytes
504
- };
500
+ result.authorization_token = [
501
+ ...result.authorization_token ?? [],
502
+ {
503
+ alias_type,
504
+ token_type,
505
+ token_value: tokenBytes
506
+ }
507
+ ];
505
508
  } else {
506
509
  const bytes = r.readBytes(length);
507
510
  unknown.push({
@@ -937,12 +937,12 @@ function encodeSetupOptions(opts, writer) {
937
937
  }
938
938
  });
939
939
  }
940
- if (opts.authorization_token !== void 0) {
940
+ for (const token of opts.authorization_token ?? []) {
941
941
  entries.push({
942
942
  type: SETUP_OPT_AUTHORIZATION_TOKEN,
943
943
  encode: (w) => {
944
944
  const tmpW = new MoqtBufferWriter(64);
945
- encodeAuthorizationToken(opts.authorization_token, tmpW);
945
+ encodeAuthorizationToken(token, tmpW);
946
946
  const raw = tmpW.finish();
947
947
  w.writeVarInt(BigInt(raw.byteLength));
948
948
  w.writeBytes(raw);
@@ -1046,7 +1046,10 @@ function decodeSetupOptions(reader, payloadEnd) {
1046
1046
  if (optType === SETUP_OPT_PATH) {
1047
1047
  result.path = textDecoder.decode(bytes);
1048
1048
  } else if (optType === SETUP_OPT_AUTHORIZATION_TOKEN) {
1049
- result.authorization_token = decodeAuthorizationToken(new MoqtBufferReader(bytes));
1049
+ result.authorization_token = [
1050
+ ...result.authorization_token ?? [],
1051
+ decodeAuthorizationToken(new MoqtBufferReader(bytes))
1052
+ ];
1050
1053
  } else if (optType === SETUP_OPT_AUTHORITY) {
1051
1054
  result.authority = textDecoder.decode(bytes);
1052
1055
  } else if (optType === SETUP_OPT_MOQT_IMPLEMENTATION) {
@@ -1213,12 +1216,12 @@ function encodeParams(params, writer) {
1213
1216
  encode: (w) => w.writeVarInt(params.object_delivery_timeout)
1214
1217
  });
1215
1218
  }
1216
- if (params.authorization_token !== void 0) {
1219
+ for (const token of params.authorization_token ?? []) {
1217
1220
  entries.push({
1218
1221
  type: PARAM_AUTHORIZATION_TOKEN,
1219
1222
  encode: (w) => {
1220
1223
  const tmpW = new MoqtBufferWriter(64);
1221
- encodeAuthorizationToken(params.authorization_token, tmpW);
1224
+ encodeAuthorizationToken(token, tmpW);
1222
1225
  const raw = tmpW.finish();
1223
1226
  w.writeVarInt(BigInt(raw.byteLength));
1224
1227
  w.writeBytes(raw);
@@ -1299,34 +1302,34 @@ function encodeParams(params, writer) {
1299
1302
  encode: (w) => w.writeUint8(Number(params.group_order))
1300
1303
  });
1301
1304
  }
1302
- if (params.subgroup_filter !== void 0) {
1305
+ for (const filter of params.subgroup_filter ?? []) {
1303
1306
  entries.push({
1304
1307
  type: PARAM_SUBGROUP_FILTER,
1305
- encode: (w) => encodeRangeFilter(params.subgroup_filter, false, w)
1308
+ encode: (w) => encodeRangeFilter(filter, false, w)
1306
1309
  });
1307
1310
  }
1308
- if (params.objectid_filter !== void 0) {
1311
+ for (const filter of params.objectid_filter ?? []) {
1309
1312
  entries.push({
1310
1313
  type: PARAM_OBJECTID_FILTER,
1311
- encode: (w) => encodeRangeFilter(params.objectid_filter, false, w)
1314
+ encode: (w) => encodeRangeFilter(filter, false, w)
1312
1315
  });
1313
1316
  }
1314
- if (params.priority_filter !== void 0) {
1317
+ for (const filter of params.priority_filter ?? []) {
1315
1318
  entries.push({
1316
1319
  type: PARAM_PRIORITY_FILTER,
1317
- encode: (w) => encodeRangeFilter(params.priority_filter, false, w)
1320
+ encode: (w) => encodeRangeFilter(filter, false, w)
1318
1321
  });
1319
1322
  }
1320
- if (params.object_property_filter !== void 0) {
1323
+ for (const filter of params.object_property_filter ?? []) {
1321
1324
  entries.push({
1322
1325
  type: PARAM_OBJECT_PROPERTY_FILTER,
1323
- encode: (w) => encodeRangeFilter(params.object_property_filter, true, w)
1326
+ encode: (w) => encodeRangeFilter(filter, true, w)
1324
1327
  });
1325
1328
  }
1326
- if (params.track_property_filter !== void 0) {
1329
+ for (const filter of params.track_property_filter ?? []) {
1327
1330
  entries.push({
1328
1331
  type: PARAM_TRACK_PROPERTY_FILTER,
1329
- encode: (w) => encodeRangeFilter(params.track_property_filter, true, w)
1332
+ encode: (w) => encodeRangeFilter(filter, true, w)
1330
1333
  });
1331
1334
  }
1332
1335
  if (params.new_group_request !== void 0) {
@@ -1388,7 +1391,10 @@ function decodeParams(reader, messageType) {
1388
1391
  } else if (paramType === PARAM_AUTHORIZATION_TOKEN) {
1389
1392
  const length = Number(reader.readVarInt());
1390
1393
  const bytes = reader.readBytes(length);
1391
- result.authorization_token = decodeAuthorizationToken(new MoqtBufferReader(bytes));
1394
+ result.authorization_token = [
1395
+ ...result.authorization_token ?? [],
1396
+ decodeAuthorizationToken(new MoqtBufferReader(bytes))
1397
+ ];
1392
1398
  } else if (paramType === PARAM_RENDEZVOUS_TIMEOUT) {
1393
1399
  result.rendezvous_timeout = reader.readVarInt();
1394
1400
  } else if (paramType === PARAM_SUBGROUP_DELIVERY_TIMEOUT) {
@@ -1423,15 +1429,21 @@ function decodeParams(reader, messageType) {
1423
1429
  } else if (paramType === PARAM_GROUP_ORDER) {
1424
1430
  result.group_order = BigInt(reader.readUint8());
1425
1431
  } else if (paramType === PARAM_SUBGROUP_FILTER) {
1426
- result.subgroup_filter = decodeRangeFilter(reader, false);
1432
+ result.subgroup_filter = [...result.subgroup_filter ?? [], decodeRangeFilter(reader, false)];
1427
1433
  } else if (paramType === PARAM_OBJECTID_FILTER) {
1428
- result.objectid_filter = decodeRangeFilter(reader, false);
1434
+ result.objectid_filter = [...result.objectid_filter ?? [], decodeRangeFilter(reader, false)];
1429
1435
  } else if (paramType === PARAM_PRIORITY_FILTER) {
1430
- result.priority_filter = decodeRangeFilter(reader, false);
1436
+ result.priority_filter = [...result.priority_filter ?? [], decodeRangeFilter(reader, false)];
1431
1437
  } else if (paramType === PARAM_OBJECT_PROPERTY_FILTER) {
1432
- result.object_property_filter = decodeRangeFilter(reader, true);
1438
+ result.object_property_filter = [
1439
+ ...result.object_property_filter ?? [],
1440
+ decodeRangeFilter(reader, true)
1441
+ ];
1433
1442
  } else if (paramType === PARAM_TRACK_PROPERTY_FILTER) {
1434
- result.track_property_filter = decodeRangeFilter(reader, true);
1443
+ result.track_property_filter = [
1444
+ ...result.track_property_filter ?? [],
1445
+ decodeRangeFilter(reader, true)
1446
+ ];
1435
1447
  } else if (paramType === PARAM_NEW_GROUP_REQUEST) {
1436
1448
  result.new_group_request = reader.readVarInt();
1437
1449
  } else if (paramType === PARAM_TRACK_NAMESPACE_PREFIX) {