@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.
- package/CHANGELOG.md +75 -0
- package/README.md +16 -4
- package/dist/{chunk-KCH4BQXK.cjs → chunk-AQ445VV7.cjs} +15 -9
- package/dist/{chunk-UZO5Z2XT.cjs → chunk-BIBMDTU5.cjs} +12 -6
- package/dist/chunk-BMJMY6FX.cjs +868 -0
- package/dist/{chunk-23KRITJ6.js → chunk-BX2N7TZM.js} +14 -8
- package/dist/{chunk-XQGEOFGE.js → chunk-CF5DDD3Q.js} +14 -8
- package/dist/chunk-FT3HDNIB.js +2374 -0
- package/dist/{chunk-TMXRYOBS.js → chunk-G53WYUXL.js} +13 -7
- package/dist/{chunk-JKMYAUGY.js → chunk-K2B3OVFK.js} +11 -8
- package/dist/{chunk-3YAR3I3S.js → chunk-KGDVC4O6.js} +36 -22
- package/dist/{chunk-VWXUT5R2.cjs → chunk-KTNERCTZ.cjs} +36 -22
- package/dist/{chunk-H6DTAIWM.js → chunk-L5DRACXS.js} +22 -16
- package/dist/{chunk-UA5XFP4O.cjs → chunk-OUNN4IQB.cjs} +14 -8
- package/dist/{chunk-NH4L6NIY.js → chunk-OZRK73NQ.js} +12 -6
- package/dist/{chunk-PU2KV7VP.cjs → chunk-RYKQXBG6.cjs} +12 -6
- package/dist/{chunk-EVCPBFSR.cjs → chunk-SDJTSMOW.cjs} +23 -17
- package/dist/chunk-T4VWPKDG.cjs +2374 -0
- package/dist/{chunk-2XH6PHXR.js → chunk-TSUZ6GJV.js} +12 -6
- package/dist/{chunk-QGIHC6BA.cjs → chunk-UKKDOOUO.cjs} +12 -9
- package/dist/{chunk-BV6MITLO.js → chunk-WCPENYNE.js} +14 -8
- package/dist/{chunk-IADVBKEJ.cjs → chunk-WCTMPDUX.cjs} +15 -9
- package/dist/chunk-WX5PU7HF.js +868 -0
- package/dist/{chunk-7ENEWAMZ.cjs → chunk-XCRCAUGI.cjs} +15 -9
- package/dist/{codec-BLYAy2OP.d.ts → codec--CVeqGQv.d.ts} +1 -1
- package/dist/{codec-BNS3gS77.d.ts → codec-08ZOr5wI.d.ts} +2 -2
- package/dist/{codec-DujHf55Z.d.ts → codec-BJ7BHuiZ.d.ts} +1 -1
- package/dist/{codec-CI0BjmHc.d.ts → codec-BNy5syCU.d.ts} +1 -1
- package/dist/{codec-N3g1lxQQ.d.cts → codec-Bd60SGKH.d.cts} +2 -2
- package/dist/{codec-xeuGZY77.d.cts → codec-BrTi4K7r.d.cts} +3 -3
- package/dist/{codec-DJmV04i0.d.ts → codec-Bux_Q40X.d.ts} +2 -2
- package/dist/{codec-BqqoYdh_.d.cts → codec-BxQTybUX.d.cts} +2 -2
- package/dist/{codec-D2JbI2tp.d.ts → codec-C3mdsGx3.d.ts} +2 -2
- package/dist/{codec-DQWQSam3.d.cts → codec-C6Mx4bwz.d.cts} +1 -1
- package/dist/{codec-DAePx2NL.d.ts → codec-CBdOIfMY.d.ts} +3 -3
- package/dist/codec-CFWu5KVT.d.cts +49 -0
- package/dist/{codec-CyApDKwf.d.cts → codec-CWnf8mn_.d.cts} +2 -2
- package/dist/{codec-DvcJgYKq.d.cts → codec-CXCjya_G.d.cts} +1 -1
- package/dist/{codec-BOyrk_C9.d.cts → codec-Cfo_z5ET.d.cts} +1 -1
- package/dist/{codec-v6Vloc7H.d.ts → codec-Cm3D261p.d.ts} +2 -2
- package/dist/codec-CwZ6OCPP.d.ts +49 -0
- package/dist/{codec-NMsTK0GX.d.cts → codec-Czejcmxr.d.cts} +2 -2
- package/dist/{codec-hvkJfCF5.d.cts → codec-DNmiG2e0.d.cts} +2 -2
- package/dist/{codec-CWj5iTxA.d.ts → codec-DOmAmFkI.d.ts} +2 -2
- package/dist/{codec-WwwUipaU.d.ts → codec-DaXjRrOV.d.ts} +2 -2
- package/dist/{codec-DplRgIKq.d.ts → codec-Dl_QIXMz.d.ts} +1 -1
- package/dist/{codec-D95gT98n.d.cts → codec-DzkdW4kO.d.cts} +1 -1
- package/dist/{codec-cou9XBMF.d.cts → codec-EvybrBuY.d.cts} +2 -2
- package/dist/{codec-DL0njGkL.d.ts → codec-alVA27Uc.d.ts} +2 -2
- package/dist/{codec-D89DWXbv.d.cts → codec-f7vxeVIS.d.cts} +2 -2
- package/dist/{codec-D47r_-Rl.d.ts → codec-gl4_QEva.d.ts} +2 -2
- package/dist/{codec-BOtv3R5j.d.cts → codec-guzqtfMk.d.cts} +2 -2
- package/dist/draft07-session.d.cts +3 -3
- package/dist/draft07-session.d.ts +3 -3
- package/dist/draft07.d.cts +3 -3
- package/dist/draft07.d.ts +3 -3
- package/dist/draft08-session.d.cts +3 -3
- package/dist/draft08-session.d.ts +3 -3
- package/dist/draft08.d.cts +4 -4
- package/dist/draft08.d.ts +4 -4
- package/dist/draft09-session.d.cts +3 -3
- package/dist/draft09-session.d.ts +3 -3
- package/dist/draft09.d.cts +4 -4
- package/dist/draft09.d.ts +4 -4
- package/dist/draft10-session.d.cts +3 -3
- package/dist/draft10-session.d.ts +3 -3
- package/dist/draft10.d.cts +4 -4
- package/dist/draft10.d.ts +4 -4
- package/dist/draft11-session.d.cts +4 -4
- package/dist/draft11-session.d.ts +4 -4
- package/dist/draft11.cjs +2 -2
- package/dist/draft11.d.cts +6 -6
- package/dist/draft11.d.ts +6 -6
- package/dist/draft11.js +1 -1
- package/dist/draft12-session.d.cts +4 -4
- package/dist/draft12-session.d.ts +4 -4
- package/dist/draft12.cjs +2 -2
- package/dist/draft12.d.cts +6 -6
- package/dist/draft12.d.ts +6 -6
- package/dist/draft12.js +1 -1
- package/dist/draft13-session.d.cts +4 -4
- package/dist/draft13-session.d.ts +4 -4
- package/dist/draft13.cjs +2 -2
- package/dist/draft13.d.cts +6 -6
- package/dist/draft13.d.ts +6 -6
- package/dist/draft13.js +1 -1
- package/dist/draft14-session.d.cts +4 -4
- package/dist/draft14-session.d.ts +4 -4
- package/dist/draft14.cjs +2 -2
- package/dist/draft14.d.cts +6 -6
- package/dist/draft14.d.ts +6 -6
- package/dist/draft14.js +1 -1
- package/dist/draft15-session.d.cts +4 -4
- package/dist/draft15-session.d.ts +4 -4
- package/dist/draft15.cjs +2 -2
- package/dist/draft15.d.cts +6 -6
- package/dist/draft15.d.ts +6 -6
- package/dist/draft15.js +1 -1
- package/dist/draft16-session.d.cts +4 -4
- package/dist/draft16-session.d.ts +4 -4
- package/dist/draft16.cjs +2 -2
- package/dist/draft16.d.cts +6 -6
- package/dist/draft16.d.ts +6 -6
- package/dist/draft16.js +1 -1
- package/dist/draft17-session.d.cts +4 -4
- package/dist/draft17-session.d.ts +4 -4
- package/dist/draft17.cjs +2 -2
- package/dist/draft17.d.cts +5 -5
- package/dist/draft17.d.ts +5 -5
- package/dist/draft17.js +1 -1
- package/dist/draft18-session.d.cts +4 -4
- package/dist/draft18-session.d.ts +4 -4
- package/dist/draft18.cjs +2 -2
- package/dist/draft18.d.cts +5 -5
- package/dist/draft18.d.ts +5 -5
- package/dist/draft18.js +1 -1
- package/dist/draft19-session.d.cts +4 -4
- package/dist/draft19-session.d.ts +4 -4
- package/dist/draft19.cjs +2 -2
- package/dist/draft19.d.cts +5 -5
- package/dist/draft19.d.ts +5 -5
- package/dist/draft19.js +1 -1
- package/dist/draft20-session.cjs +8 -0
- package/dist/draft20-session.d.cts +195 -0
- package/dist/draft20-session.d.ts +195 -0
- package/dist/draft20-session.js +8 -0
- package/dist/draft20.cjs +217 -0
- package/dist/draft20.d.cts +175 -0
- package/dist/draft20.d.ts +175 -0
- package/dist/draft20.js +217 -0
- package/dist/index.cjs +25 -19
- package/dist/index.d.cts +41 -26
- package/dist/index.d.ts +41 -26
- package/dist/index.js +16 -10
- package/dist/{session-types-KsqyVp6y.d.cts → session-types-B9idsih-.d.cts} +13 -1
- package/dist/{session-types-C0l_-Ups.d.ts → session-types-Dn7b3RZM.d.ts} +13 -1
- package/dist/session.cjs +5 -1
- package/dist/session.d.cts +14 -12
- package/dist/session.d.ts +14 -12
- package/dist/session.js +5 -1
- package/dist/{types-Cqp10JtB.d.cts → types-Bg86GGVZ.d.cts} +2 -2
- package/dist/{types-Cqp10JtB.d.ts → types-Bg86GGVZ.d.ts} +2 -2
- package/dist/{types-zHgCS6o5.d.cts → types-C1rxh-id.d.cts} +7 -7
- package/dist/{types-zHgCS6o5.d.ts → types-C1rxh-id.d.ts} +7 -7
- package/dist/{types-Bio-91Rt.d.cts → types-CI_SX4Xe.d.cts} +2 -2
- package/dist/{types-Bio-91Rt.d.ts → types-CI_SX4Xe.d.ts} +2 -2
- package/dist/types-CY-QWxd-.d.cts +359 -0
- package/dist/types-CY-QWxd-.d.ts +359 -0
- package/dist/{types-Cm9fjeYC.d.cts → types-CZTzbIzQ.d.cts} +2 -2
- package/dist/{types-Cm9fjeYC.d.ts → types-CZTzbIzQ.d.ts} +2 -2
- package/dist/{types-HI_bbXka.d.cts → types-CmqT0jUf.d.cts} +1 -1
- package/dist/{types-HI_bbXka.d.ts → types-CmqT0jUf.d.ts} +1 -1
- package/dist/{types-Ck45Ex5S.d.cts → types-D0kTgUuL.d.cts} +1 -1
- package/dist/{types-Ck45Ex5S.d.ts → types-D0kTgUuL.d.ts} +1 -1
- package/dist/{types-D9eiB_9A.d.cts → types-D4bmW8rY.d.cts} +2 -2
- package/dist/{types-D9eiB_9A.d.ts → types-D4bmW8rY.d.ts} +2 -2
- package/dist/{types-CdCSIfvI.d.cts → types-DG5_iKuv.d.cts} +1 -1
- package/dist/{types-CdCSIfvI.d.ts → types-DG5_iKuv.d.ts} +1 -1
- package/dist/{types-CXlSn0I9.d.cts → types-DjxexghA.d.cts} +2 -2
- package/dist/{types-CXlSn0I9.d.ts → types-DjxexghA.d.ts} +2 -2
- package/dist/{types-CPaYBsMG.d.cts → types-pShrs3fN.d.cts} +2 -2
- package/dist/{types-CPaYBsMG.d.ts → types-pShrs3fN.d.ts} +2 -2
- package/package.json +16 -3
- package/src/core/session-types.ts +7 -0
- package/src/core/types.ts +1 -0
- package/src/drafts/draft11/codec.ts +11 -8
- package/src/drafts/draft11/types.ts +1 -1
- package/src/drafts/draft12/codec.ts +22 -16
- package/src/drafts/draft12/types.ts +2 -2
- package/src/drafts/draft13/codec.ts +14 -8
- package/src/drafts/draft13/types.ts +2 -2
- package/src/drafts/draft14/codec.ts +14 -8
- package/src/drafts/draft14/types.ts +1 -1
- package/src/drafts/draft15/codec.ts +14 -8
- package/src/drafts/draft15/types.ts +2 -2
- package/src/drafts/draft16/codec.ts +13 -7
- package/src/drafts/draft16/types.ts +2 -2
- package/src/drafts/draft17/codec.ts +12 -6
- package/src/drafts/draft17/types.ts +2 -2
- package/src/drafts/draft18/codec.ts +12 -6
- package/src/drafts/draft18/types.ts +2 -2
- package/src/drafts/draft19/codec.ts +37 -23
- package/src/drafts/draft19/types.ts +10 -7
- package/src/drafts/draft20/codec.ts +1749 -0
- package/src/drafts/draft20/data-streams.ts +1291 -0
- package/src/drafts/draft20/error-codes.ts +135 -0
- package/src/drafts/draft20/index.ts +165 -0
- package/src/drafts/draft20/messages.ts +68 -0
- package/src/drafts/draft20/rules.ts +107 -0
- package/src/drafts/draft20/session-fsm.ts +1063 -0
- package/src/drafts/draft20/session.ts +21 -0
- package/src/drafts/draft20/types.ts +461 -0
- package/src/index.ts +20 -2
- package/src/session.ts +4 -0
|
@@ -935,12 +935,12 @@ function encodeSetupOptions(opts, writer) {
|
|
|
935
935
|
}
|
|
936
936
|
});
|
|
937
937
|
}
|
|
938
|
-
|
|
938
|
+
for (const token of opts.authorization_token ?? []) {
|
|
939
939
|
entries.push({
|
|
940
940
|
type: SETUP_OPT_AUTHORIZATION_TOKEN,
|
|
941
941
|
encode: (w) => {
|
|
942
942
|
const tmpW = new MoqtBufferWriter(64);
|
|
943
|
-
encodeAuthorizationToken(
|
|
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 =
|
|
1031
|
+
result.authorization_token = [
|
|
1032
|
+
...result.authorization_token ?? [],
|
|
1033
|
+
decodeAuthorizationToken(new 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
|
-
|
|
1144
|
+
for (const token of params.authorization_token ?? []) {
|
|
1142
1145
|
entries.push({
|
|
1143
1146
|
type: PARAM_AUTHORIZATION_TOKEN,
|
|
1144
1147
|
encode: (w) => {
|
|
1145
1148
|
const tmpW = new MoqtBufferWriter(64);
|
|
1146
|
-
encodeAuthorizationToken(
|
|
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 =
|
|
1289
|
+
result.authorization_token = [
|
|
1290
|
+
...result.authorization_token ?? [],
|
|
1291
|
+
decodeAuthorizationToken(new 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) {
|
|
@@ -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
|
|
|
@@ -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
|
-
|
|
431
|
+
count += _nullishCoalesce(_optionalChain([params, 'access', _2 => _2.authorization_token, 'optionalAccess', _3 => _3.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
|
-
|
|
435
|
+
for (const token of _nullishCoalesce(params.authorization_token, () => ( []))) {
|
|
436
436
|
w.writeVarInt(PARAM_AUTHORIZATION_TOKEN);
|
|
437
|
-
const at =
|
|
437
|
+
const at = token;
|
|
438
438
|
const tmpW = new (0, _chunk4XLYCT5Qcjs.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
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
500
|
+
result.authorization_token = [
|
|
501
|
+
..._nullishCoalesce(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({
|
|
@@ -747,7 +747,7 @@ function encodeSetupParams(params, writer) {
|
|
|
747
747
|
let count = 0;
|
|
748
748
|
if (params.path !== void 0) count++;
|
|
749
749
|
if (params.max_request_id !== void 0) count++;
|
|
750
|
-
|
|
750
|
+
count += params.authorization_token?.length ?? 0;
|
|
751
751
|
if (params.max_auth_token_cache_size !== void 0) count++;
|
|
752
752
|
if (params.authority !== void 0) count++;
|
|
753
753
|
if (params.moqt_implementation !== void 0) count++;
|
|
@@ -763,10 +763,10 @@ function encodeSetupParams(params, writer) {
|
|
|
763
763
|
writer.writeVarInt(SETUP_PARAM_MAX_REQUEST_ID);
|
|
764
764
|
writer.writeVarInt(params.max_request_id);
|
|
765
765
|
}
|
|
766
|
-
|
|
766
|
+
for (const token of params.authorization_token ?? []) {
|
|
767
767
|
writer.writeVarInt(SETUP_PARAM_AUTHORIZATION_TOKEN);
|
|
768
768
|
const tmpW = new BufferWriter(64);
|
|
769
|
-
encodeAuthorizationToken(
|
|
769
|
+
encodeAuthorizationToken(token, tmpW);
|
|
770
770
|
const raw = tmpW.finish();
|
|
771
771
|
writer.writeVarInt(raw.byteLength);
|
|
772
772
|
writer.writeBytes(raw);
|
|
@@ -832,7 +832,10 @@ function decodeSetupParams(reader) {
|
|
|
832
832
|
if (paramType === SETUP_PARAM_PATH) {
|
|
833
833
|
result.path = textDecoder.decode(bytes);
|
|
834
834
|
} else if (paramType === SETUP_PARAM_AUTHORIZATION_TOKEN) {
|
|
835
|
-
result.authorization_token =
|
|
835
|
+
result.authorization_token = [
|
|
836
|
+
...result.authorization_token ?? [],
|
|
837
|
+
decodeAuthorizationToken(new BufferReader(bytes))
|
|
838
|
+
];
|
|
836
839
|
} else if (paramType === SETUP_PARAM_AUTHORITY) {
|
|
837
840
|
result.authority = textDecoder.decode(bytes);
|
|
838
841
|
} else if (paramType === SETUP_PARAM_MOQT_IMPLEMENTATION) {
|
|
@@ -890,7 +893,7 @@ var PARAM_NEW_GROUP_REQUEST = 0x32n;
|
|
|
890
893
|
function encodeParams(params, writer) {
|
|
891
894
|
let count = params.unknown ? params.unknown.length : 0;
|
|
892
895
|
if (params.delivery_timeout !== void 0) count++;
|
|
893
|
-
|
|
896
|
+
count += params.authorization_token?.length ?? 0;
|
|
894
897
|
if (params.max_cache_duration !== void 0) count++;
|
|
895
898
|
if (params.expires !== void 0) count++;
|
|
896
899
|
if (params.largest_object !== void 0) count++;
|
|
@@ -906,10 +909,10 @@ function encodeParams(params, writer) {
|
|
|
906
909
|
writer.writeVarInt(PARAM_DELIVERY_TIMEOUT);
|
|
907
910
|
writer.writeVarInt(params.delivery_timeout);
|
|
908
911
|
}
|
|
909
|
-
|
|
912
|
+
for (const token of params.authorization_token ?? []) {
|
|
910
913
|
writer.writeVarInt(PARAM_AUTHORIZATION_TOKEN);
|
|
911
914
|
const tmpW = new BufferWriter(64);
|
|
912
|
-
encodeAuthorizationToken(
|
|
915
|
+
encodeAuthorizationToken(token, tmpW);
|
|
913
916
|
const raw = tmpW.finish();
|
|
914
917
|
writer.writeVarInt(raw.byteLength);
|
|
915
918
|
writer.writeBytes(raw);
|
|
@@ -999,7 +1002,10 @@ function decodeParams(reader) {
|
|
|
999
1002
|
} else if (paramType === PARAM_AUTHORIZATION_TOKEN) {
|
|
1000
1003
|
const length = Number(reader.readVarInt());
|
|
1001
1004
|
const tokenBytes = reader.readBytes(length);
|
|
1002
|
-
result.authorization_token =
|
|
1005
|
+
result.authorization_token = [
|
|
1006
|
+
...result.authorization_token ?? [],
|
|
1007
|
+
decodeAuthorizationToken(new BufferReader(tokenBytes))
|
|
1008
|
+
];
|
|
1003
1009
|
} else if (paramType === PARAM_MAX_CACHE_DURATION) {
|
|
1004
1010
|
result.max_cache_duration = reader.readVarInt();
|
|
1005
1011
|
} else if (paramType === PARAM_EXPIRES) {
|
|
@@ -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
|
|
|
@@ -747,7 +747,7 @@ function encodeSetupParams(params, writer) {
|
|
|
747
747
|
let count = 0;
|
|
748
748
|
if (params.path !== void 0) count++;
|
|
749
749
|
if (params.max_request_id !== void 0) count++;
|
|
750
|
-
|
|
750
|
+
count += _nullishCoalesce(_optionalChain([params, 'access', _ => _.authorization_token, 'optionalAccess', _2 => _2.length]), () => ( 0));
|
|
751
751
|
if (params.max_auth_token_cache_size !== void 0) count++;
|
|
752
752
|
if (params.authority !== void 0) count++;
|
|
753
753
|
if (params.moqt_implementation !== void 0) count++;
|
|
@@ -763,10 +763,10 @@ function encodeSetupParams(params, writer) {
|
|
|
763
763
|
writer.writeVarInt(SETUP_PARAM_MAX_REQUEST_ID);
|
|
764
764
|
writer.writeVarInt(params.max_request_id);
|
|
765
765
|
}
|
|
766
|
-
|
|
766
|
+
for (const token of _nullishCoalesce(params.authorization_token, () => ( []))) {
|
|
767
767
|
writer.writeVarInt(SETUP_PARAM_AUTHORIZATION_TOKEN);
|
|
768
768
|
const tmpW = new (0, _chunk4XLYCT5Qcjs.BufferWriter)(64);
|
|
769
|
-
encodeAuthorizationToken(
|
|
769
|
+
encodeAuthorizationToken(token, tmpW);
|
|
770
770
|
const raw = tmpW.finish();
|
|
771
771
|
writer.writeVarInt(raw.byteLength);
|
|
772
772
|
writer.writeBytes(raw);
|
|
@@ -832,7 +832,10 @@ function decodeSetupParams(reader) {
|
|
|
832
832
|
if (paramType === SETUP_PARAM_PATH) {
|
|
833
833
|
result.path = textDecoder.decode(bytes);
|
|
834
834
|
} else if (paramType === SETUP_PARAM_AUTHORIZATION_TOKEN) {
|
|
835
|
-
result.authorization_token =
|
|
835
|
+
result.authorization_token = [
|
|
836
|
+
..._nullishCoalesce(result.authorization_token, () => ( [])),
|
|
837
|
+
decodeAuthorizationToken(new (0, _chunk4XLYCT5Qcjs.BufferReader)(bytes))
|
|
838
|
+
];
|
|
836
839
|
} else if (paramType === SETUP_PARAM_AUTHORITY) {
|
|
837
840
|
result.authority = textDecoder.decode(bytes);
|
|
838
841
|
} else if (paramType === SETUP_PARAM_MOQT_IMPLEMENTATION) {
|
|
@@ -890,7 +893,7 @@ var PARAM_NEW_GROUP_REQUEST = 0x32n;
|
|
|
890
893
|
function encodeParams(params, writer) {
|
|
891
894
|
let count = params.unknown ? params.unknown.length : 0;
|
|
892
895
|
if (params.delivery_timeout !== void 0) count++;
|
|
893
|
-
|
|
896
|
+
count += _nullishCoalesce(_optionalChain([params, 'access', _3 => _3.authorization_token, 'optionalAccess', _4 => _4.length]), () => ( 0));
|
|
894
897
|
if (params.max_cache_duration !== void 0) count++;
|
|
895
898
|
if (params.expires !== void 0) count++;
|
|
896
899
|
if (params.largest_object !== void 0) count++;
|
|
@@ -906,10 +909,10 @@ function encodeParams(params, writer) {
|
|
|
906
909
|
writer.writeVarInt(PARAM_DELIVERY_TIMEOUT);
|
|
907
910
|
writer.writeVarInt(params.delivery_timeout);
|
|
908
911
|
}
|
|
909
|
-
|
|
912
|
+
for (const token of _nullishCoalesce(params.authorization_token, () => ( []))) {
|
|
910
913
|
writer.writeVarInt(PARAM_AUTHORIZATION_TOKEN);
|
|
911
914
|
const tmpW = new (0, _chunk4XLYCT5Qcjs.BufferWriter)(64);
|
|
912
|
-
encodeAuthorizationToken(
|
|
915
|
+
encodeAuthorizationToken(token, tmpW);
|
|
913
916
|
const raw = tmpW.finish();
|
|
914
917
|
writer.writeVarInt(raw.byteLength);
|
|
915
918
|
writer.writeBytes(raw);
|
|
@@ -999,7 +1002,10 @@ function decodeParams(reader) {
|
|
|
999
1002
|
} else if (paramType === PARAM_AUTHORIZATION_TOKEN) {
|
|
1000
1003
|
const length = Number(reader.readVarInt());
|
|
1001
1004
|
const tokenBytes = reader.readBytes(length);
|
|
1002
|
-
result.authorization_token =
|
|
1005
|
+
result.authorization_token = [
|
|
1006
|
+
..._nullishCoalesce(result.authorization_token, () => ( [])),
|
|
1007
|
+
decodeAuthorizationToken(new (0, _chunk4XLYCT5Qcjs.BufferReader)(tokenBytes))
|
|
1008
|
+
];
|
|
1003
1009
|
} else if (paramType === PARAM_MAX_CACHE_DURATION) {
|
|
1004
1010
|
result.max_cache_duration = reader.readVarInt();
|
|
1005
1011
|
} else if (paramType === PARAM_EXPIRES) {
|