@moqtap/codec 0.8.1 → 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 (194) hide show
  1. package/CHANGELOG.md +75 -0
  2. package/README.md +16 -4
  3. package/dist/{chunk-KCH4BQXK.cjs → chunk-AQ445VV7.cjs} +15 -9
  4. package/dist/{chunk-UZO5Z2XT.cjs → chunk-BIBMDTU5.cjs} +12 -6
  5. package/dist/chunk-BMJMY6FX.cjs +868 -0
  6. package/dist/{chunk-23KRITJ6.js → chunk-BX2N7TZM.js} +14 -8
  7. package/dist/{chunk-XQGEOFGE.js → chunk-CF5DDD3Q.js} +14 -8
  8. package/dist/chunk-FT3HDNIB.js +2374 -0
  9. package/dist/{chunk-TMXRYOBS.js → chunk-G53WYUXL.js} +13 -7
  10. package/dist/{chunk-JKMYAUGY.js → chunk-K2B3OVFK.js} +11 -8
  11. package/dist/{chunk-3YAR3I3S.js → chunk-KGDVC4O6.js} +36 -22
  12. package/dist/{chunk-VWXUT5R2.cjs → chunk-KTNERCTZ.cjs} +36 -22
  13. package/dist/{chunk-H6DTAIWM.js → chunk-L5DRACXS.js} +22 -16
  14. package/dist/{chunk-UA5XFP4O.cjs → chunk-OUNN4IQB.cjs} +14 -8
  15. package/dist/{chunk-NH4L6NIY.js → chunk-OZRK73NQ.js} +12 -6
  16. package/dist/{chunk-PU2KV7VP.cjs → chunk-RYKQXBG6.cjs} +12 -6
  17. package/dist/{chunk-EVCPBFSR.cjs → chunk-SDJTSMOW.cjs} +23 -17
  18. package/dist/chunk-T4VWPKDG.cjs +2374 -0
  19. package/dist/{chunk-2XH6PHXR.js → chunk-TSUZ6GJV.js} +12 -6
  20. package/dist/{chunk-QGIHC6BA.cjs → chunk-UKKDOOUO.cjs} +12 -9
  21. package/dist/{chunk-BV6MITLO.js → chunk-WCPENYNE.js} +14 -8
  22. package/dist/{chunk-IADVBKEJ.cjs → chunk-WCTMPDUX.cjs} +15 -9
  23. package/dist/chunk-WX5PU7HF.js +868 -0
  24. package/dist/{chunk-7ENEWAMZ.cjs → chunk-XCRCAUGI.cjs} +15 -9
  25. package/dist/{codec-BLYAy2OP.d.ts → codec--CVeqGQv.d.ts} +1 -1
  26. package/dist/{codec-BNS3gS77.d.ts → codec-08ZOr5wI.d.ts} +2 -2
  27. package/dist/{codec-DujHf55Z.d.ts → codec-BJ7BHuiZ.d.ts} +1 -1
  28. package/dist/{codec-CI0BjmHc.d.ts → codec-BNy5syCU.d.ts} +1 -1
  29. package/dist/{codec-N3g1lxQQ.d.cts → codec-Bd60SGKH.d.cts} +2 -2
  30. package/dist/{codec-xeuGZY77.d.cts → codec-BrTi4K7r.d.cts} +3 -3
  31. package/dist/{codec-DJmV04i0.d.ts → codec-Bux_Q40X.d.ts} +2 -2
  32. package/dist/{codec-BqqoYdh_.d.cts → codec-BxQTybUX.d.cts} +2 -2
  33. package/dist/{codec-D2JbI2tp.d.ts → codec-C3mdsGx3.d.ts} +2 -2
  34. package/dist/{codec-DQWQSam3.d.cts → codec-C6Mx4bwz.d.cts} +1 -1
  35. package/dist/{codec-DAePx2NL.d.ts → codec-CBdOIfMY.d.ts} +3 -3
  36. package/dist/codec-CFWu5KVT.d.cts +49 -0
  37. package/dist/{codec-CyApDKwf.d.cts → codec-CWnf8mn_.d.cts} +2 -2
  38. package/dist/{codec-DvcJgYKq.d.cts → codec-CXCjya_G.d.cts} +1 -1
  39. package/dist/{codec-BOyrk_C9.d.cts → codec-Cfo_z5ET.d.cts} +1 -1
  40. package/dist/{codec-v6Vloc7H.d.ts → codec-Cm3D261p.d.ts} +2 -2
  41. package/dist/codec-CwZ6OCPP.d.ts +49 -0
  42. package/dist/{codec-NMsTK0GX.d.cts → codec-Czejcmxr.d.cts} +2 -2
  43. package/dist/{codec-hvkJfCF5.d.cts → codec-DNmiG2e0.d.cts} +2 -2
  44. package/dist/{codec-CWj5iTxA.d.ts → codec-DOmAmFkI.d.ts} +2 -2
  45. package/dist/{codec-WwwUipaU.d.ts → codec-DaXjRrOV.d.ts} +2 -2
  46. package/dist/{codec-DplRgIKq.d.ts → codec-Dl_QIXMz.d.ts} +1 -1
  47. package/dist/{codec-D95gT98n.d.cts → codec-DzkdW4kO.d.cts} +1 -1
  48. package/dist/{codec-cou9XBMF.d.cts → codec-EvybrBuY.d.cts} +2 -2
  49. package/dist/{codec-DL0njGkL.d.ts → codec-alVA27Uc.d.ts} +2 -2
  50. package/dist/{codec-D89DWXbv.d.cts → codec-f7vxeVIS.d.cts} +2 -2
  51. package/dist/{codec-D47r_-Rl.d.ts → codec-gl4_QEva.d.ts} +2 -2
  52. package/dist/{codec-BOtv3R5j.d.cts → codec-guzqtfMk.d.cts} +2 -2
  53. package/dist/draft07-session.d.cts +3 -3
  54. package/dist/draft07-session.d.ts +3 -3
  55. package/dist/draft07.d.cts +3 -3
  56. package/dist/draft07.d.ts +3 -3
  57. package/dist/draft08-session.d.cts +3 -3
  58. package/dist/draft08-session.d.ts +3 -3
  59. package/dist/draft08.d.cts +4 -4
  60. package/dist/draft08.d.ts +4 -4
  61. package/dist/draft09-session.d.cts +3 -3
  62. package/dist/draft09-session.d.ts +3 -3
  63. package/dist/draft09.d.cts +4 -4
  64. package/dist/draft09.d.ts +4 -4
  65. package/dist/draft10-session.d.cts +3 -3
  66. package/dist/draft10-session.d.ts +3 -3
  67. package/dist/draft10.d.cts +4 -4
  68. package/dist/draft10.d.ts +4 -4
  69. package/dist/draft11-session.d.cts +4 -4
  70. package/dist/draft11-session.d.ts +4 -4
  71. package/dist/draft11.cjs +2 -2
  72. package/dist/draft11.d.cts +6 -6
  73. package/dist/draft11.d.ts +6 -6
  74. package/dist/draft11.js +1 -1
  75. package/dist/draft12-session.d.cts +4 -4
  76. package/dist/draft12-session.d.ts +4 -4
  77. package/dist/draft12.cjs +2 -2
  78. package/dist/draft12.d.cts +6 -6
  79. package/dist/draft12.d.ts +6 -6
  80. package/dist/draft12.js +1 -1
  81. package/dist/draft13-session.d.cts +4 -4
  82. package/dist/draft13-session.d.ts +4 -4
  83. package/dist/draft13.cjs +2 -2
  84. package/dist/draft13.d.cts +6 -6
  85. package/dist/draft13.d.ts +6 -6
  86. package/dist/draft13.js +1 -1
  87. package/dist/draft14-session.d.cts +4 -4
  88. package/dist/draft14-session.d.ts +4 -4
  89. package/dist/draft14.cjs +2 -2
  90. package/dist/draft14.d.cts +6 -6
  91. package/dist/draft14.d.ts +6 -6
  92. package/dist/draft14.js +1 -1
  93. package/dist/draft15-session.d.cts +4 -4
  94. package/dist/draft15-session.d.ts +4 -4
  95. package/dist/draft15.cjs +2 -2
  96. package/dist/draft15.d.cts +6 -6
  97. package/dist/draft15.d.ts +6 -6
  98. package/dist/draft15.js +1 -1
  99. package/dist/draft16-session.d.cts +4 -4
  100. package/dist/draft16-session.d.ts +4 -4
  101. package/dist/draft16.cjs +2 -2
  102. package/dist/draft16.d.cts +6 -6
  103. package/dist/draft16.d.ts +6 -6
  104. package/dist/draft16.js +1 -1
  105. package/dist/draft17-session.d.cts +4 -4
  106. package/dist/draft17-session.d.ts +4 -4
  107. package/dist/draft17.cjs +2 -2
  108. package/dist/draft17.d.cts +5 -5
  109. package/dist/draft17.d.ts +5 -5
  110. package/dist/draft17.js +1 -1
  111. package/dist/draft18-session.d.cts +4 -4
  112. package/dist/draft18-session.d.ts +4 -4
  113. package/dist/draft18.cjs +2 -2
  114. package/dist/draft18.d.cts +5 -5
  115. package/dist/draft18.d.ts +5 -5
  116. package/dist/draft18.js +1 -1
  117. package/dist/draft19-session.d.cts +4 -4
  118. package/dist/draft19-session.d.ts +4 -4
  119. package/dist/draft19.cjs +2 -2
  120. package/dist/draft19.d.cts +5 -5
  121. package/dist/draft19.d.ts +5 -5
  122. package/dist/draft19.js +1 -1
  123. package/dist/draft20-session.cjs +8 -0
  124. package/dist/draft20-session.d.cts +195 -0
  125. package/dist/draft20-session.d.ts +195 -0
  126. package/dist/draft20-session.js +8 -0
  127. package/dist/draft20.cjs +217 -0
  128. package/dist/draft20.d.cts +175 -0
  129. package/dist/draft20.d.ts +175 -0
  130. package/dist/draft20.js +217 -0
  131. package/dist/index.cjs +25 -19
  132. package/dist/index.d.cts +41 -26
  133. package/dist/index.d.ts +41 -26
  134. package/dist/index.js +16 -10
  135. package/dist/{session-types-KsqyVp6y.d.cts → session-types-B9idsih-.d.cts} +13 -1
  136. package/dist/{session-types-C0l_-Ups.d.ts → session-types-Dn7b3RZM.d.ts} +13 -1
  137. package/dist/session.cjs +5 -1
  138. package/dist/session.d.cts +14 -12
  139. package/dist/session.d.ts +14 -12
  140. package/dist/session.js +5 -1
  141. package/dist/{types-Cqp10JtB.d.cts → types-Bg86GGVZ.d.cts} +2 -2
  142. package/dist/{types-Cqp10JtB.d.ts → types-Bg86GGVZ.d.ts} +2 -2
  143. package/dist/{types-zHgCS6o5.d.cts → types-C1rxh-id.d.cts} +7 -7
  144. package/dist/{types-zHgCS6o5.d.ts → types-C1rxh-id.d.ts} +7 -7
  145. package/dist/{types-Bio-91Rt.d.cts → types-CI_SX4Xe.d.cts} +2 -2
  146. package/dist/{types-Bio-91Rt.d.ts → types-CI_SX4Xe.d.ts} +2 -2
  147. package/dist/types-CY-QWxd-.d.cts +359 -0
  148. package/dist/types-CY-QWxd-.d.ts +359 -0
  149. package/dist/{types-Cm9fjeYC.d.cts → types-CZTzbIzQ.d.cts} +2 -2
  150. package/dist/{types-Cm9fjeYC.d.ts → types-CZTzbIzQ.d.ts} +2 -2
  151. package/dist/{types-HI_bbXka.d.cts → types-CmqT0jUf.d.cts} +1 -1
  152. package/dist/{types-HI_bbXka.d.ts → types-CmqT0jUf.d.ts} +1 -1
  153. package/dist/{types-Ck45Ex5S.d.cts → types-D0kTgUuL.d.cts} +1 -1
  154. package/dist/{types-Ck45Ex5S.d.ts → types-D0kTgUuL.d.ts} +1 -1
  155. package/dist/{types-D9eiB_9A.d.cts → types-D4bmW8rY.d.cts} +2 -2
  156. package/dist/{types-D9eiB_9A.d.ts → types-D4bmW8rY.d.ts} +2 -2
  157. package/dist/{types-CdCSIfvI.d.cts → types-DG5_iKuv.d.cts} +1 -1
  158. package/dist/{types-CdCSIfvI.d.ts → types-DG5_iKuv.d.ts} +1 -1
  159. package/dist/{types-CXlSn0I9.d.cts → types-DjxexghA.d.cts} +2 -2
  160. package/dist/{types-CXlSn0I9.d.ts → types-DjxexghA.d.ts} +2 -2
  161. package/dist/{types-CPaYBsMG.d.cts → types-pShrs3fN.d.cts} +2 -2
  162. package/dist/{types-CPaYBsMG.d.ts → types-pShrs3fN.d.ts} +2 -2
  163. package/package.json +16 -3
  164. package/src/core/session-types.ts +7 -0
  165. package/src/core/types.ts +1 -0
  166. package/src/drafts/draft11/codec.ts +11 -8
  167. package/src/drafts/draft11/types.ts +1 -1
  168. package/src/drafts/draft12/codec.ts +22 -16
  169. package/src/drafts/draft12/types.ts +2 -2
  170. package/src/drafts/draft13/codec.ts +14 -8
  171. package/src/drafts/draft13/types.ts +2 -2
  172. package/src/drafts/draft14/codec.ts +14 -8
  173. package/src/drafts/draft14/types.ts +1 -1
  174. package/src/drafts/draft15/codec.ts +14 -8
  175. package/src/drafts/draft15/types.ts +2 -2
  176. package/src/drafts/draft16/codec.ts +13 -7
  177. package/src/drafts/draft16/types.ts +2 -2
  178. package/src/drafts/draft17/codec.ts +12 -6
  179. package/src/drafts/draft17/types.ts +2 -2
  180. package/src/drafts/draft18/codec.ts +12 -6
  181. package/src/drafts/draft18/types.ts +2 -2
  182. package/src/drafts/draft19/codec.ts +37 -23
  183. package/src/drafts/draft19/types.ts +10 -7
  184. package/src/drafts/draft20/codec.ts +1749 -0
  185. package/src/drafts/draft20/data-streams.ts +1291 -0
  186. package/src/drafts/draft20/error-codes.ts +135 -0
  187. package/src/drafts/draft20/index.ts +165 -0
  188. package/src/drafts/draft20/messages.ts +68 -0
  189. package/src/drafts/draft20/rules.ts +107 -0
  190. package/src/drafts/draft20/session-fsm.ts +1063 -0
  191. package/src/drafts/draft20/session.ts +21 -0
  192. package/src/drafts/draft20/types.ts +461 -0
  193. package/src/index.ts +20 -2
  194. package/src/session.ts +4 -0
@@ -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) {
@@ -2048,7 +2060,9 @@ function createStreamDecoder() {
2048
2060
  }
2049
2061
  function createDraft19Codec() {
2050
2062
  return {
2051
- draft: "18",
2063
+ // Was '18' — a copy-paste from draft18/codec.ts. createSessionState() keys
2064
+ // off codec.draft, so a draft-19 codec was handing back a draft-18 FSM.
2065
+ draft: "19",
2052
2066
  encodeMessage,
2053
2067
  decodeMessage,
2054
2068
  encodeSubgroupStream,
@@ -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 _nullishCoalesce(opts.authorization_token, () => ( []))) {
941
941
  entries.push({
942
942
  type: SETUP_OPT_AUTHORIZATION_TOKEN,
943
943
  encode: (w) => {
944
944
  const tmpW = new (0, _chunk4XLYCT5Qcjs.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 (0, _chunk4XLYCT5Qcjs.MoqtBufferReader)(bytes));
1049
+ result.authorization_token = [
1050
+ ..._nullishCoalesce(result.authorization_token, () => ( [])),
1051
+ decodeAuthorizationToken(new (0, _chunk4XLYCT5Qcjs.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 _nullishCoalesce(params.authorization_token, () => ( []))) {
1217
1220
  entries.push({
1218
1221
  type: PARAM_AUTHORIZATION_TOKEN,
1219
1222
  encode: (w) => {
1220
1223
  const tmpW = new (0, _chunk4XLYCT5Qcjs.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 _nullishCoalesce(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 _nullishCoalesce(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 _nullishCoalesce(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 _nullishCoalesce(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 _nullishCoalesce(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 (0, _chunk4XLYCT5Qcjs.MoqtBufferReader)(bytes));
1394
+ result.authorization_token = [
1395
+ ..._nullishCoalesce(result.authorization_token, () => ( [])),
1396
+ decodeAuthorizationToken(new (0, _chunk4XLYCT5Qcjs.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 = [..._nullishCoalesce(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 = [..._nullishCoalesce(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 = [..._nullishCoalesce(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
+ ..._nullishCoalesce(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
+ ..._nullishCoalesce(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) {
@@ -2048,7 +2060,9 @@ function createStreamDecoder() {
2048
2060
  }
2049
2061
  function createDraft19Codec() {
2050
2062
  return {
2051
- draft: "18",
2063
+ // Was '18' — a copy-paste from draft18/codec.ts. createSessionState() keys
2064
+ // off codec.draft, so a draft-19 codec was handing back a draft-18 FSM.
2065
+ draft: "19",
2052
2066
  encodeMessage,
2053
2067
  decodeMessage,
2054
2068
  encodeSubgroupStream,
@@ -376,7 +376,7 @@ function encodeSetupParams(params, w) {
376
376
  let count = 0;
377
377
  if (params.path !== void 0) count++;
378
378
  if (params.max_request_id !== void 0) count++;
379
- if (params.authorization_token !== void 0) count++;
379
+ count += params.authorization_token?.length ?? 0;
380
380
  if (params.unknown) count += params.unknown.length;
381
381
  w.writeVarInt(count);
382
382
  if (params.path !== void 0) {
@@ -389,9 +389,9 @@ function encodeSetupParams(params, w) {
389
389
  w.writeVarInt(SETUP_PARAM_MAX_REQUEST_ID);
390
390
  w.writeVarInt(params.max_request_id);
391
391
  }
392
- if (params.authorization_token !== void 0) {
392
+ for (const token of params.authorization_token ?? []) {
393
393
  w.writeVarInt(PARAM_AUTHORIZATION_TOKEN);
394
- const at = params.authorization_token;
394
+ const at = token;
395
395
  const tmpW = new BufferWriter(64);
396
396
  tmpW.writeVarInt(at.alias_type);
397
397
  tmpW.writeVarInt(at.token_type);
@@ -447,11 +447,14 @@ function decodeSetupParams(r) {
447
447
  const token_type = r.readVarInt();
448
448
  const tokenBytesLen = length - (r.offset - startOff);
449
449
  const tokenBytes = r.readBytes(tokenBytesLen);
450
- result.authorization_token = {
451
- alias_type,
452
- token_type,
453
- token_value: tokenBytes
454
- };
450
+ result.authorization_token = [
451
+ ...result.authorization_token ?? [],
452
+ {
453
+ alias_type,
454
+ token_type,
455
+ token_value: tokenBytes
456
+ }
457
+ ];
455
458
  } else {
456
459
  const bytes = r.readBytes(length);
457
460
  unknown.push({
@@ -468,16 +471,16 @@ function decodeSetupParams(r) {
468
471
  function encodeParams(params, w) {
469
472
  let count = params.unknown ? params.unknown.length : 0;
470
473
  if (params.delivery_timeout !== void 0) count++;
471
- if (params.authorization_token !== void 0) count++;
474
+ count += params.authorization_token?.length ?? 0;
472
475
  if (params.max_cache_duration !== void 0) count++;
473
476
  w.writeVarInt(count);
474
477
  if (params.delivery_timeout !== void 0) {
475
478
  w.writeVarInt(PARAM_DELIVERY_TIMEOUT);
476
479
  w.writeVarInt(params.delivery_timeout);
477
480
  }
478
- if (params.authorization_token !== void 0) {
481
+ for (const token of params.authorization_token ?? []) {
479
482
  w.writeVarInt(PARAM_AUTHORIZATION_TOKEN);
480
- const at = params.authorization_token;
483
+ const at = token;
481
484
  const tmpW = new BufferWriter(64);
482
485
  tmpW.writeVarInt(at.alias_type);
483
486
  tmpW.writeVarInt(at.token_type);
@@ -536,11 +539,14 @@ function decodeParams(r) {
536
539
  const token_type = r.readVarInt();
537
540
  const tokenBytesLen = length - (r.offset - startOff);
538
541
  const tokenBytes = r.readBytes(tokenBytesLen);
539
- result.authorization_token = {
540
- alias_type,
541
- token_type,
542
- token_value: tokenBytes
543
- };
542
+ result.authorization_token = [
543
+ ...result.authorization_token ?? [],
544
+ {
545
+ alias_type,
546
+ token_type,
547
+ token_value: tokenBytes
548
+ }
549
+ ];
544
550
  } else {
545
551
  const bytes = r.readBytes(length);
546
552
  unknown.push({
@@ -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
 
@@ -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 += _nullishCoalesce(_optionalChain([params, 'access', _ => _.authorization_token, 'optionalAccess', _2 => _2.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 _nullishCoalesce(params.authorization_token, () => ( []))) {
796
796
  writer.writeVarInt(SETUP_PARAM_AUTHORIZATION_TOKEN);
797
797
  const tmpW = new (0, _chunk4XLYCT5Qcjs.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 (0, _chunk4XLYCT5Qcjs.BufferReader)(bytes));
864
+ result.authorization_token = [
865
+ ..._nullishCoalesce(result.authorization_token, () => ( [])),
866
+ decodeAuthorizationToken(new (0, _chunk4XLYCT5Qcjs.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 _nullishCoalesce(params.authorization_token, () => ( []))) {
998
1001
  entries.push({
999
1002
  type: PARAM_AUTHORIZATION_TOKEN,
1000
1003
  encode: (w) => {
1001
1004
  const tmpW = new (0, _chunk4XLYCT5Qcjs.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 (0, _chunk4XLYCT5Qcjs.BufferReader)(tokenBytes));
1127
+ result.authorization_token = [
1128
+ ..._nullishCoalesce(result.authorization_token, () => ( [])),
1129
+ decodeAuthorizationToken(new (0, _chunk4XLYCT5Qcjs.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) {
@@ -910,12 +910,12 @@ function encodeSetupOptions(opts, writer) {
910
910
  }
911
911
  });
912
912
  }
913
- if (opts.authorization_token !== void 0) {
913
+ for (const token of opts.authorization_token ?? []) {
914
914
  entries.push({
915
915
  type: SETUP_OPT_AUTHORIZATION_TOKEN,
916
916
  encode: (w) => {
917
917
  const tmpW = new Draft17BufferWriter(64);
918
- encodeAuthorizationToken(opts.authorization_token, tmpW);
918
+ encodeAuthorizationToken(token, tmpW);
919
919
  const raw = tmpW.finish();
920
920
  w.writeVarInt(BigInt(raw.byteLength));
921
921
  w.writeBytes(raw);
@@ -1003,7 +1003,10 @@ function decodeSetupOptions(reader, payloadEnd) {
1003
1003
  if (optType === SETUP_OPT_PATH) {
1004
1004
  result.path = textDecoder.decode(bytes);
1005
1005
  } else if (optType === SETUP_OPT_AUTHORIZATION_TOKEN) {
1006
- result.authorization_token = decodeAuthorizationToken(new Draft17BufferReader(bytes));
1006
+ result.authorization_token = [
1007
+ ...result.authorization_token ?? [],
1008
+ decodeAuthorizationToken(new Draft17BufferReader(bytes))
1009
+ ];
1007
1010
  } else if (optType === SETUP_OPT_AUTHORITY) {
1008
1011
  result.authority = textDecoder.decode(bytes);
1009
1012
  } else if (optType === SETUP_OPT_MOQT_IMPLEMENTATION) {
@@ -1091,12 +1094,12 @@ function encodeParams(params, writer) {
1091
1094
  encode: (w) => w.writeVarInt(params.delivery_timeout)
1092
1095
  });
1093
1096
  }
1094
- if (params.authorization_token !== void 0) {
1097
+ for (const token of params.authorization_token ?? []) {
1095
1098
  entries.push({
1096
1099
  type: PARAM_AUTHORIZATION_TOKEN,
1097
1100
  encode: (w) => {
1098
1101
  const tmpW = new Draft17BufferWriter(64);
1099
- encodeAuthorizationToken(params.authorization_token, tmpW);
1102
+ encodeAuthorizationToken(token, tmpW);
1100
1103
  const raw = tmpW.finish();
1101
1104
  w.writeVarInt(BigInt(raw.byteLength));
1102
1105
  w.writeBytes(raw);
@@ -1210,7 +1213,10 @@ function decodeParams(reader, messageType) {
1210
1213
  } else if (paramType === PARAM_AUTHORIZATION_TOKEN) {
1211
1214
  const length = Number(reader.readVarInt());
1212
1215
  const bytes = reader.readBytes(length);
1213
- result.authorization_token = decodeAuthorizationToken(new Draft17BufferReader(bytes));
1216
+ result.authorization_token = [
1217
+ ...result.authorization_token ?? [],
1218
+ decodeAuthorizationToken(new Draft17BufferReader(bytes))
1219
+ ];
1214
1220
  } else if (paramType === PARAM_RENDEZVOUS_TIMEOUT) {
1215
1221
  result.rendezvous_timeout = reader.readVarInt();
1216
1222
  } else if (paramType === PARAM_EXPIRES) {
@@ -910,12 +910,12 @@ function encodeSetupOptions(opts, writer) {
910
910
  }
911
911
  });
912
912
  }
913
- if (opts.authorization_token !== void 0) {
913
+ for (const token of _nullishCoalesce(opts.authorization_token, () => ( []))) {
914
914
  entries.push({
915
915
  type: SETUP_OPT_AUTHORIZATION_TOKEN,
916
916
  encode: (w) => {
917
917
  const tmpW = new (0, _chunk4XLYCT5Qcjs.Draft17BufferWriter)(64);
918
- encodeAuthorizationToken(opts.authorization_token, tmpW);
918
+ encodeAuthorizationToken(token, tmpW);
919
919
  const raw = tmpW.finish();
920
920
  w.writeVarInt(BigInt(raw.byteLength));
921
921
  w.writeBytes(raw);
@@ -1003,7 +1003,10 @@ function decodeSetupOptions(reader, payloadEnd) {
1003
1003
  if (optType === SETUP_OPT_PATH) {
1004
1004
  result.path = textDecoder.decode(bytes);
1005
1005
  } else if (optType === SETUP_OPT_AUTHORIZATION_TOKEN) {
1006
- result.authorization_token = decodeAuthorizationToken(new (0, _chunk4XLYCT5Qcjs.Draft17BufferReader)(bytes));
1006
+ result.authorization_token = [
1007
+ ..._nullishCoalesce(result.authorization_token, () => ( [])),
1008
+ decodeAuthorizationToken(new (0, _chunk4XLYCT5Qcjs.Draft17BufferReader)(bytes))
1009
+ ];
1007
1010
  } else if (optType === SETUP_OPT_AUTHORITY) {
1008
1011
  result.authority = textDecoder.decode(bytes);
1009
1012
  } else if (optType === SETUP_OPT_MOQT_IMPLEMENTATION) {
@@ -1091,12 +1094,12 @@ function encodeParams(params, writer) {
1091
1094
  encode: (w) => w.writeVarInt(params.delivery_timeout)
1092
1095
  });
1093
1096
  }
1094
- if (params.authorization_token !== void 0) {
1097
+ for (const token of _nullishCoalesce(params.authorization_token, () => ( []))) {
1095
1098
  entries.push({
1096
1099
  type: PARAM_AUTHORIZATION_TOKEN,
1097
1100
  encode: (w) => {
1098
1101
  const tmpW = new (0, _chunk4XLYCT5Qcjs.Draft17BufferWriter)(64);
1099
- encodeAuthorizationToken(params.authorization_token, tmpW);
1102
+ encodeAuthorizationToken(token, tmpW);
1100
1103
  const raw = tmpW.finish();
1101
1104
  w.writeVarInt(BigInt(raw.byteLength));
1102
1105
  w.writeBytes(raw);
@@ -1210,7 +1213,10 @@ function decodeParams(reader, messageType) {
1210
1213
  } else if (paramType === PARAM_AUTHORIZATION_TOKEN) {
1211
1214
  const length = Number(reader.readVarInt());
1212
1215
  const bytes = reader.readBytes(length);
1213
- result.authorization_token = decodeAuthorizationToken(new (0, _chunk4XLYCT5Qcjs.Draft17BufferReader)(bytes));
1216
+ result.authorization_token = [
1217
+ ..._nullishCoalesce(result.authorization_token, () => ( [])),
1218
+ decodeAuthorizationToken(new (0, _chunk4XLYCT5Qcjs.Draft17BufferReader)(bytes))
1219
+ ];
1214
1220
  } else if (paramType === PARAM_RENDEZVOUS_TIMEOUT) {
1215
1221
  result.rendezvous_timeout = reader.readVarInt();
1216
1222
  } else if (paramType === PARAM_EXPIRES) {