@moqtap/codec 0.9.0 → 0.11.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 +173 -0
- package/dist/auth-redaction-DsdLq4Qs.d.cts +102 -0
- package/dist/auth-redaction-DsdLq4Qs.d.ts +102 -0
- package/dist/{chunk-PU2KV7VP.cjs → chunk-27K5BUAG.cjs} +485 -515
- package/dist/{chunk-BV6MITLO.js → chunk-3RNQMGKA.js} +365 -390
- package/dist/{chunk-2XH6PHXR.js → chunk-5AWIXOLB.js} +442 -467
- package/dist/{chunk-4XLYCT5Q.cjs → chunk-5IMHJIAZ.cjs} +52 -2
- package/dist/{chunk-TVSFDQYE.cjs → chunk-5JGZCKJO.cjs} +513 -531
- package/dist/{chunk-IADVBKEJ.cjs → chunk-73K4OSAN.cjs} +407 -432
- package/dist/{chunk-N2V7Z37J.js → chunk-7VQKRGRD.js} +19 -3
- package/dist/{chunk-UZO5Z2XT.cjs → chunk-A3UCQOIB.cjs} +490 -515
- package/dist/{chunk-JKMYAUGY.js → chunk-A7PDMVXM.js} +35 -11
- package/dist/{chunk-VZHL2U2N.cjs → chunk-A7VQO6YC.cjs} +54 -38
- package/dist/{chunk-KCH4BQXK.cjs → chunk-ACQHZLRZ.cjs} +73 -47
- package/dist/{chunk-H6DTAIWM.js → chunk-BBICOMW6.js} +47 -19
- package/dist/{chunk-MAXEHYVB.cjs → chunk-BNIUVOCJ.cjs} +554 -612
- package/dist/{chunk-QGIHC6BA.cjs → chunk-CNC6ANS4.cjs} +70 -46
- package/dist/{chunk-NH4L6NIY.js → chunk-FDLQSWHK.js} +437 -467
- package/dist/{chunk-IJAF6PAY.js → chunk-FFNOE4UR.js} +19 -3
- package/dist/{chunk-CZNW3R5E.cjs → chunk-GMENT63T.cjs} +54 -38
- package/dist/{chunk-7ENEWAMZ.cjs → chunk-HM7BLRVP.cjs} +305 -305
- package/dist/{chunk-XHAP2YST.js → chunk-HZONHFNO.js} +19 -3
- package/dist/{chunk-EVCPBFSR.cjs → chunk-ILYABWDK.cjs} +83 -55
- package/dist/{chunk-IDV2JYJ6.cjs → chunk-KRSFTZVO.cjs} +56 -40
- package/dist/{chunk-RIIA4ALQ.cjs → chunk-KSPH6KMH.cjs} +54 -38
- package/dist/{chunk-UA5XFP4O.cjs → chunk-KTY4LAUV.cjs} +485 -494
- package/dist/{chunk-RZTLQAKF.js → chunk-OJNLJT5D.js} +0 -1
- package/dist/{chunk-YJGOD3Y4.js → chunk-PJK2ZS3I.js} +492 -550
- package/dist/{chunk-TMXRYOBS.js → chunk-PSMZKHOC.js} +444 -453
- package/dist/{chunk-7RE6KSIY.cjs → chunk-Q5JQGHWY.cjs} +0 -1
- package/dist/{chunk-23KRITJ6.js → chunk-SQTUQY5E.js} +37 -11
- package/dist/{chunk-XQGEOFGE.js → chunk-WCRLAKDW.js} +253 -253
- package/dist/{chunk-KYVTM5VI.js → chunk-WL2YUEXH.js} +19 -3
- package/dist/{chunk-Q7NSUXXB.js → chunk-YCNIVZS7.js} +464 -482
- package/dist/{chunk-KLPWJU6W.js → chunk-YRZQVNZO.js} +50 -0
- package/dist/{codec-Bym-K2q2.d.cts → codec-76xzrLTL.d.cts} +21 -2
- package/dist/{codec-BKsVu3Fr.d.ts → codec-8p40WdLg.d.ts} +21 -2
- package/dist/{codec-Dl_QIXMz.d.ts → codec-BN2Bu0KI.d.ts} +20 -1
- package/dist/{codec-D4RvFQmu.d.ts → codec-Bb6GKTrv.d.ts} +21 -2
- package/dist/{codec-DAyiF5sq.d.cts → codec-BgpfHoAd.d.cts} +21 -2
- package/dist/{codec-CA6nbbEk.d.ts → codec-BkheTXO7.d.ts} +21 -2
- package/dist/{codec-DchsPfr3.d.cts → codec-BwVDkokh.d.cts} +21 -2
- package/dist/{codec-CgZdadPt.d.cts → codec-C5s1eBJX.d.cts} +21 -2
- package/dist/codec-CM5yd6n3.d.ts +38 -0
- package/dist/{codec-DJmqoIsp.d.cts → codec-Cb8HC3XV.d.cts} +21 -2
- package/dist/codec-Clu_skx8.d.cts +38 -0
- package/dist/{codec-DzkdW4kO.d.cts → codec-CpOpemR8.d.cts} +20 -1
- package/dist/{codec-CXCjya_G.d.cts → codec-Cshdl9Tt.d.cts} +20 -1
- package/dist/{codec-CSBFdPgP.d.cts → codec-DELe00w_.d.cts} +21 -2
- package/dist/{codec-C_xxsbKy.d.cts → codec-DHzKAUCa.d.cts} +21 -2
- package/dist/{codec--CVeqGQv.d.ts → codec-DdVBtvx7.d.ts} +20 -1
- package/dist/{codec-CviAa4lp.d.ts → codec-DlxGuYMv.d.ts} +21 -2
- package/dist/{codec-BNy5syCU.d.ts → codec-DxtgPxJS.d.ts} +20 -1
- package/dist/{codec-CtvFK4aV.d.cts → codec-GAY4lybi.d.cts} +21 -2
- package/dist/{codec-Cfo_z5ET.d.cts → codec-I8u2pfS4.d.cts} +20 -1
- package/dist/{codec-vddqy0KY.d.cts → codec-XLrnreeu.d.cts} +21 -2
- package/dist/{codec-O-1Js7h4.d.ts → codec-c0YEwwWn.d.ts} +21 -2
- package/dist/{codec-Cl73EfRW.d.ts → codec-ejDu-va6.d.ts} +21 -2
- package/dist/{codec-C006F75E.d.ts → codec-kaBUzdpV.d.ts} +21 -2
- package/dist/{codec-C5evFHL-.d.ts → codec-mVYqkIUF.d.ts} +21 -2
- package/dist/{codec-BMwgZIgG.d.ts → codec-qSbO5nOa.d.ts} +21 -2
- package/dist/{codec-BQa6Qsav.d.ts → codec-yYKGOipj.d.ts} +21 -2
- package/dist/{codec-DzLvG8Wb.d.cts → codec-zfzg9uiy.d.cts} +21 -2
- package/dist/draft07.cjs +48 -4
- package/dist/draft07.d.cts +42 -2
- package/dist/draft07.d.ts +42 -2
- package/dist/draft07.js +49 -5
- package/dist/draft08.cjs +76 -3
- package/dist/draft08.d.cts +70 -2
- package/dist/draft08.d.ts +70 -2
- package/dist/draft08.js +77 -4
- package/dist/draft09.cjs +76 -3
- package/dist/draft09.d.cts +70 -2
- package/dist/draft09.d.ts +70 -2
- package/dist/draft09.js +77 -4
- package/dist/draft10.cjs +76 -3
- package/dist/draft10.d.cts +70 -2
- package/dist/draft10.d.ts +70 -2
- package/dist/draft10.js +77 -4
- package/dist/draft11-session.d.cts +1 -1
- package/dist/draft11-session.d.ts +1 -1
- package/dist/draft11.cjs +104 -3
- package/dist/draft11.d.cts +100 -4
- package/dist/draft11.d.ts +100 -4
- package/dist/draft11.js +105 -4
- package/dist/draft12-session.d.cts +1 -1
- package/dist/draft12-session.d.ts +1 -1
- package/dist/draft12.cjs +113 -3
- package/dist/draft12.d.cts +109 -4
- package/dist/draft12.d.ts +109 -4
- package/dist/draft12.js +114 -4
- package/dist/draft13-session.d.cts +1 -1
- package/dist/draft13-session.d.ts +1 -1
- package/dist/draft13.cjs +105 -3
- package/dist/draft13.d.cts +101 -4
- package/dist/draft13.d.ts +101 -4
- package/dist/draft13.js +106 -4
- package/dist/draft14-session.d.cts +1 -1
- package/dist/draft14-session.d.ts +1 -1
- package/dist/draft14.cjs +107 -3
- package/dist/draft14.d.cts +103 -30
- package/dist/draft14.d.ts +103 -30
- package/dist/draft14.js +108 -4
- package/dist/draft15-session.d.cts +1 -1
- package/dist/draft15-session.d.ts +1 -1
- package/dist/draft15.cjs +69 -3
- package/dist/draft15.d.cts +65 -22
- package/dist/draft15.d.ts +65 -22
- package/dist/draft15.js +70 -4
- package/dist/draft16-session.cjs +2 -2
- package/dist/draft16-session.d.cts +1 -1
- package/dist/draft16-session.d.ts +1 -1
- package/dist/draft16-session.js +1 -1
- package/dist/draft16.cjs +76 -8
- package/dist/draft16.d.cts +67 -13
- package/dist/draft16.d.ts +67 -13
- package/dist/draft16.js +73 -5
- package/dist/draft17-session.d.cts +1 -1
- package/dist/draft17-session.d.ts +1 -1
- package/dist/draft17.cjs +77 -3
- package/dist/draft17.d.cts +73 -4
- package/dist/draft17.d.ts +73 -4
- package/dist/draft17.js +78 -4
- package/dist/draft18-session.d.cts +1 -1
- package/dist/draft18-session.d.ts +1 -1
- package/dist/draft18.cjs +8 -3
- package/dist/draft18.d.cts +4 -3
- package/dist/draft18.d.ts +4 -3
- package/dist/draft18.js +9 -4
- package/dist/draft19-session.d.cts +1 -1
- package/dist/draft19-session.d.ts +1 -1
- package/dist/draft19.cjs +11 -4
- package/dist/draft19.d.cts +4 -3
- package/dist/draft19.d.ts +4 -3
- package/dist/draft19.js +12 -5
- package/dist/draft20-session.d.cts +1 -1
- package/dist/draft20-session.d.ts +1 -1
- package/dist/draft20.cjs +8 -3
- package/dist/draft20.d.cts +4 -3
- package/dist/draft20.d.ts +4 -3
- package/dist/draft20.js +9 -4
- package/dist/index.cjs +30 -30
- package/dist/index.d.cts +25 -24
- package/dist/index.d.ts +25 -24
- package/dist/index.js +15 -15
- package/dist/session.cjs +2 -2
- package/dist/session.d.cts +10 -10
- package/dist/session.d.ts +10 -10
- package/dist/session.js +1 -1
- package/dist/{types-zHgCS6o5.d.cts → types-Btp416jt.d.cts} +15 -7
- package/dist/{types-zHgCS6o5.d.ts → types-Btp416jt.d.ts} +15 -7
- package/dist/{types-Cm9fjeYC.d.cts → types-BxTL1NXw.d.cts} +9 -2
- package/dist/{types-Cm9fjeYC.d.ts → types-BxTL1NXw.d.ts} +9 -2
- 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-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-CPaYBsMG.d.cts → types-CuibHYcf.d.cts} +9 -2
- package/dist/{types-CPaYBsMG.d.ts → types-CuibHYcf.d.ts} +9 -2
- package/dist/{types-CWCQwuvy.d.cts → types-CwN7AEoL.d.cts} +24 -12
- package/dist/{types-CWCQwuvy.d.ts → types-CwN7AEoL.d.ts} +24 -12
- 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-DAnalt5K.d.cts} +9 -2
- package/dist/{types-D9eiB_9A.d.ts → types-DAnalt5K.d.ts} +9 -2
- 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-Cqp10JtB.d.cts → types-DxXNP32l.d.cts} +10 -2
- package/dist/{types-Cqp10JtB.d.ts → types-DxXNP32l.d.ts} +10 -2
- package/package.json +3 -3
- package/src/core/auth-redaction.ts +192 -0
- package/src/drafts/draft07/codec.ts +40 -0
- package/src/drafts/draft07/error-codes.ts +44 -0
- package/src/drafts/draft07/index.ts +15 -0
- package/src/drafts/draft08/codec.ts +40 -0
- package/src/drafts/draft08/error-codes.ts +76 -0
- package/src/drafts/draft08/index.ts +21 -0
- package/src/drafts/draft09/codec.ts +40 -0
- package/src/drafts/draft09/error-codes.ts +76 -0
- package/src/drafts/draft09/index.ts +21 -0
- package/src/drafts/draft10/codec.ts +40 -0
- package/src/drafts/draft10/error-codes.ts +76 -0
- package/src/drafts/draft10/index.ts +21 -0
- package/src/drafts/draft11/codec.ts +71 -8
- package/src/drafts/draft11/error-codes.ts +106 -0
- package/src/drafts/draft11/index.ts +23 -0
- package/src/drafts/draft11/types.ts +1 -1
- package/src/drafts/draft12/codec.ts +83 -16
- package/src/drafts/draft12/error-codes.ts +116 -0
- package/src/drafts/draft12/index.ts +25 -0
- package/src/drafts/draft12/types.ts +2 -2
- package/src/drafts/draft13/codec.ts +75 -11
- package/src/drafts/draft13/error-codes.ts +107 -0
- package/src/drafts/draft13/index.ts +23 -0
- package/src/drafts/draft13/types.ts +3 -3
- package/src/drafts/draft14/codec.ts +79 -12
- package/src/drafts/draft14/data-streams.ts +331 -259
- package/src/drafts/draft14/error-codes.ts +109 -0
- package/src/drafts/draft14/index.ts +23 -0
- package/src/drafts/draft14/types.ts +1 -1
- package/src/drafts/draft15/codec.ts +71 -8
- package/src/drafts/draft15/data-streams.ts +489 -444
- package/src/drafts/draft15/error-codes.ts +66 -0
- package/src/drafts/draft15/index.ts +15 -0
- package/src/drafts/draft15/types.ts +9 -2
- package/src/drafts/draft16/codec.ts +149 -49
- package/src/drafts/draft16/data-streams.ts +513 -442
- package/src/drafts/draft16/error-codes.ts +68 -0
- package/src/drafts/draft16/index.ts +15 -0
- package/src/drafts/draft16/messages.ts +4 -4
- package/src/drafts/draft16/session-fsm.ts +0 -1
- package/src/drafts/draft16/types.ts +24 -10
- package/src/drafts/draft17/codec.ts +77 -10
- package/src/drafts/draft17/data-streams.ts +567 -488
- package/src/drafts/draft17/index.ts +15 -0
- package/src/drafts/draft17/types.ts +9 -2
- package/src/drafts/draft18/codec.ts +70 -7
- package/src/drafts/draft18/data-streams.ts +570 -482
- package/src/drafts/draft18/index.ts +3 -0
- package/src/drafts/draft18/types.ts +18 -10
- package/src/drafts/draft19/codec.ts +95 -23
- package/src/drafts/draft19/data-streams.ts +570 -482
- package/src/drafts/draft19/error-codes.ts +3 -1
- package/src/drafts/draft19/index.ts +3 -0
- package/src/drafts/draft19/messages.ts +3 -1
- package/src/drafts/draft19/types.ts +32 -18
- package/src/drafts/draft20/codec.ts +115 -36
- package/src/drafts/draft20/data-streams.ts +610 -563
- package/src/drafts/draft20/index.ts +3 -0
- package/src/drafts/draft20/types.ts +31 -13
- package/dist/codec-BJ7BHuiZ.d.ts +0 -18
- package/dist/codec-C6Mx4bwz.d.cts +0 -18
|
@@ -1,10 +1,12 @@
|
|
|
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; } var _class;
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunk5IMHJIAZcjs = require('./chunk-5IMHJIAZ.cjs');
|
|
8
10
|
|
|
9
11
|
// src/drafts/draft14/messages.ts
|
|
10
12
|
var MSG_SUBSCRIBE_UPDATE = 0x02n;
|
|
@@ -101,7 +103,7 @@ function isValidSubgroupType(t) {
|
|
|
101
103
|
return t >= 16 && t <= 21 || t >= 24 && t <= 29;
|
|
102
104
|
}
|
|
103
105
|
function encodeSubgroupStream(stream) {
|
|
104
|
-
const w = new (0,
|
|
106
|
+
const w = new (0, _chunk5IMHJIAZcjs.BufferWriter)();
|
|
105
107
|
w.writeVarInt(BigInt(stream.headerType));
|
|
106
108
|
w.writeVarInt(stream.trackAlias);
|
|
107
109
|
w.writeVarInt(stream.groupId);
|
|
@@ -133,7 +135,7 @@ function encodeSubgroupStream(stream) {
|
|
|
133
135
|
return w.finish();
|
|
134
136
|
}
|
|
135
137
|
function encodeDatagram(dg) {
|
|
136
|
-
const w = new (0,
|
|
138
|
+
const w = new (0, _chunk5IMHJIAZcjs.BufferWriter)();
|
|
137
139
|
w.writeVarInt(BigInt(dg.datagramType));
|
|
138
140
|
w.writeVarInt(dg.trackAlias);
|
|
139
141
|
w.writeVarInt(dg.groupId);
|
|
@@ -157,7 +159,7 @@ function encodeDatagram(dg) {
|
|
|
157
159
|
return w.finish();
|
|
158
160
|
}
|
|
159
161
|
function encodeFetchStream(stream) {
|
|
160
|
-
const w = new (0,
|
|
162
|
+
const w = new (0, _chunk5IMHJIAZcjs.BufferWriter)();
|
|
161
163
|
w.writeVarInt(FETCH_STREAM_TYPE);
|
|
162
164
|
w.writeVarInt(stream.requestId);
|
|
163
165
|
for (const obj of stream.objects) {
|
|
@@ -177,103 +179,111 @@ function encodeFetchStream(stream) {
|
|
|
177
179
|
}
|
|
178
180
|
return w.finish();
|
|
179
181
|
}
|
|
182
|
+
function readSubgroupHeader(r) {
|
|
183
|
+
const streamType = Number(r.readVarInt());
|
|
184
|
+
if (!isValidSubgroupType(streamType)) {
|
|
185
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
186
|
+
"CONSTRAINT_VIOLATION",
|
|
187
|
+
`Expected subgroup stream type 0x10-0x1D, got 0x${streamType.toString(16)}`,
|
|
188
|
+
0
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
const extensionsPresent = (streamType & 1) !== 0;
|
|
192
|
+
const hasSubgroupField = (streamType & 4) !== 0;
|
|
193
|
+
const subgroupIsFirstObjId = (streamType & 2) !== 0 && !hasSubgroupField;
|
|
194
|
+
const trackAlias = r.readVarInt();
|
|
195
|
+
const groupId = r.readVarInt();
|
|
196
|
+
let subgroupId = 0n;
|
|
197
|
+
if (hasSubgroupField) {
|
|
198
|
+
subgroupId = r.readVarInt();
|
|
199
|
+
}
|
|
200
|
+
const publisherPriority = r.readUint8();
|
|
201
|
+
return {
|
|
202
|
+
streamType,
|
|
203
|
+
extensionsPresent,
|
|
204
|
+
subgroupIsFirstObjId,
|
|
205
|
+
trackAlias,
|
|
206
|
+
groupId,
|
|
207
|
+
subgroupId,
|
|
208
|
+
publisherPriority
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
function readSubgroupObject(r, extensionsPresent, isFirst, prevObjectId, base) {
|
|
212
|
+
const byteOffset = base + r.offset;
|
|
213
|
+
const delta = r.readVarInt();
|
|
214
|
+
const objectId = isFirst ? delta : prevObjectId + 1n + delta;
|
|
215
|
+
let extensionData = new Uint8Array(0);
|
|
216
|
+
if (extensionsPresent) {
|
|
217
|
+
const extLen = Number(r.readVarInt());
|
|
218
|
+
extensionData = extLen > 0 ? r.readBytesView(extLen) : new Uint8Array(0);
|
|
219
|
+
}
|
|
220
|
+
const payloadLength = Number(r.readVarInt());
|
|
221
|
+
let payload;
|
|
222
|
+
let status;
|
|
223
|
+
let payloadByteOffset;
|
|
224
|
+
if (payloadLength === 0) {
|
|
225
|
+
status = r.readVarInt();
|
|
226
|
+
payloadByteOffset = base + r.offset;
|
|
227
|
+
payload = new Uint8Array(0);
|
|
228
|
+
} else {
|
|
229
|
+
payloadByteOffset = base + r.offset;
|
|
230
|
+
payload = r.readBytesView(payloadLength);
|
|
231
|
+
}
|
|
232
|
+
const obj = {
|
|
233
|
+
type: "object",
|
|
234
|
+
byteOffset,
|
|
235
|
+
payloadByteOffset,
|
|
236
|
+
objectId,
|
|
237
|
+
payloadLength,
|
|
238
|
+
payload,
|
|
239
|
+
extensionData
|
|
240
|
+
};
|
|
241
|
+
if (status !== void 0) obj.status = status;
|
|
242
|
+
return obj;
|
|
243
|
+
}
|
|
180
244
|
function decodeSubgroupStream(bytes) {
|
|
181
245
|
try {
|
|
182
|
-
const r = new (0,
|
|
183
|
-
const
|
|
184
|
-
if (!isValidSubgroupType(streamType)) {
|
|
185
|
-
return {
|
|
186
|
-
ok: false,
|
|
187
|
-
error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
188
|
-
"CONSTRAINT_VIOLATION",
|
|
189
|
-
`Expected subgroup stream type 0x10-0x1D, got 0x${streamType.toString(16)}`,
|
|
190
|
-
0
|
|
191
|
-
)
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
const extensionsPresent = (streamType & 1) !== 0;
|
|
195
|
-
const hasSubgroupField = (streamType & 4) !== 0;
|
|
196
|
-
const subgroupIsFirstObjId = (streamType & 2) !== 0 && !hasSubgroupField;
|
|
197
|
-
const trackAlias = r.readVarInt();
|
|
198
|
-
const groupId = r.readVarInt();
|
|
199
|
-
let subgroupId = 0n;
|
|
200
|
-
if (hasSubgroupField) {
|
|
201
|
-
subgroupId = r.readVarInt();
|
|
202
|
-
}
|
|
203
|
-
const publisherPriority = r.readUint8();
|
|
246
|
+
const r = new (0, _chunk5IMHJIAZcjs.BufferReader)(bytes);
|
|
247
|
+
const h = readSubgroupHeader(r);
|
|
204
248
|
const objects = [];
|
|
205
249
|
let prevObjectId = -1n;
|
|
206
|
-
let
|
|
250
|
+
let isFirst = true;
|
|
251
|
+
let subgroupId = h.subgroupId;
|
|
207
252
|
while (r.remaining > 0) {
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
if (firstObject) {
|
|
212
|
-
objectId = delta;
|
|
213
|
-
if (subgroupIsFirstObjId) {
|
|
214
|
-
subgroupId = objectId;
|
|
215
|
-
}
|
|
216
|
-
firstObject = false;
|
|
217
|
-
} else {
|
|
218
|
-
objectId = prevObjectId + 1n + delta;
|
|
219
|
-
}
|
|
220
|
-
let extensionData = new Uint8Array(0);
|
|
221
|
-
if (extensionsPresent) {
|
|
222
|
-
const extLen = Number(r.readVarInt());
|
|
223
|
-
extensionData = extLen > 0 ? r.readBytesView(extLen) : new Uint8Array(0);
|
|
224
|
-
}
|
|
225
|
-
const payloadLength = Number(r.readVarInt());
|
|
226
|
-
let payload;
|
|
227
|
-
let status;
|
|
228
|
-
let payloadByteOffset;
|
|
229
|
-
if (payloadLength === 0) {
|
|
230
|
-
status = r.readVarInt();
|
|
231
|
-
payloadByteOffset = r.offset;
|
|
232
|
-
payload = new Uint8Array(0);
|
|
233
|
-
} else {
|
|
234
|
-
payloadByteOffset = r.offset;
|
|
235
|
-
payload = r.readBytesView(payloadLength);
|
|
236
|
-
}
|
|
237
|
-
const obj = {
|
|
238
|
-
type: "object",
|
|
239
|
-
byteOffset,
|
|
240
|
-
payloadByteOffset,
|
|
241
|
-
objectId,
|
|
242
|
-
payloadLength,
|
|
243
|
-
payload,
|
|
244
|
-
extensionData
|
|
245
|
-
};
|
|
246
|
-
if (status !== void 0) obj.status = status;
|
|
253
|
+
const obj = readSubgroupObject(r, h.extensionsPresent, isFirst, prevObjectId, 0);
|
|
254
|
+
if (isFirst && h.subgroupIsFirstObjId) subgroupId = obj.objectId;
|
|
255
|
+
isFirst = false;
|
|
247
256
|
objects.push(obj);
|
|
248
|
-
prevObjectId = objectId;
|
|
257
|
+
prevObjectId = obj.objectId;
|
|
249
258
|
}
|
|
259
|
+
const result = {
|
|
260
|
+
type: "subgroup",
|
|
261
|
+
headerType: h.streamType,
|
|
262
|
+
trackAlias: h.trackAlias,
|
|
263
|
+
groupId: h.groupId,
|
|
264
|
+
subgroupId,
|
|
265
|
+
publisherPriority: h.publisherPriority,
|
|
266
|
+
objects
|
|
267
|
+
};
|
|
250
268
|
return {
|
|
251
269
|
ok: true,
|
|
252
|
-
value:
|
|
253
|
-
type: "subgroup",
|
|
254
|
-
headerType: streamType,
|
|
255
|
-
trackAlias,
|
|
256
|
-
groupId,
|
|
257
|
-
subgroupId,
|
|
258
|
-
publisherPriority,
|
|
259
|
-
objects
|
|
260
|
-
},
|
|
270
|
+
value: result,
|
|
261
271
|
bytesRead: r.offset
|
|
262
272
|
};
|
|
263
273
|
} catch (e) {
|
|
264
|
-
if (e instanceof
|
|
274
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError) return { ok: false, error: e };
|
|
265
275
|
throw e;
|
|
266
276
|
}
|
|
267
277
|
}
|
|
268
278
|
function decodeDatagram(bytes) {
|
|
269
279
|
try {
|
|
270
|
-
const r = new (0,
|
|
280
|
+
const r = new (0, _chunk5IMHJIAZcjs.BufferReader)(bytes);
|
|
271
281
|
const dgType = Number(r.readVarInt());
|
|
272
282
|
const validDatagram = dgType >= 0 && dgType <= 7 || dgType === 32 || dgType === 33;
|
|
273
283
|
if (!validDatagram) {
|
|
274
284
|
return {
|
|
275
285
|
ok: false,
|
|
276
|
-
error: new (0,
|
|
286
|
+
error: new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
277
287
|
"CONSTRAINT_VIOLATION",
|
|
278
288
|
`Expected datagram type 0x00-0x07 or 0x20-0x21, got 0x${dgType.toString(16)}`,
|
|
279
289
|
0
|
|
@@ -322,18 +332,56 @@ function decodeDatagram(bytes) {
|
|
|
322
332
|
result.extensionData = extensionData;
|
|
323
333
|
return { ok: true, value: result, bytesRead: r.offset };
|
|
324
334
|
} catch (e) {
|
|
325
|
-
if (e instanceof
|
|
335
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError) return { ok: false, error: e };
|
|
326
336
|
throw e;
|
|
327
337
|
}
|
|
328
338
|
}
|
|
339
|
+
function newFetchObjectState() {
|
|
340
|
+
return {};
|
|
341
|
+
}
|
|
342
|
+
function readFetchObject(r, base, _st) {
|
|
343
|
+
const byteOffset = base + r.offset;
|
|
344
|
+
const groupId = r.readVarInt();
|
|
345
|
+
const subgroupId = r.readVarInt();
|
|
346
|
+
const objectId = r.readVarInt();
|
|
347
|
+
const publisherPriority = r.readUint8();
|
|
348
|
+
const extLen = Number(r.readVarInt());
|
|
349
|
+
const extensionData = extLen > 0 ? r.readBytesView(extLen) : new Uint8Array(0);
|
|
350
|
+
const payloadLength = Number(r.readVarInt());
|
|
351
|
+
let payload;
|
|
352
|
+
let status;
|
|
353
|
+
let payloadByteOffset;
|
|
354
|
+
if (payloadLength === 0) {
|
|
355
|
+
status = r.readVarInt();
|
|
356
|
+
payloadByteOffset = base + r.offset;
|
|
357
|
+
payload = new Uint8Array(0);
|
|
358
|
+
} else {
|
|
359
|
+
payloadByteOffset = base + r.offset;
|
|
360
|
+
payload = r.readBytesView(payloadLength);
|
|
361
|
+
}
|
|
362
|
+
const obj = {
|
|
363
|
+
type: "object",
|
|
364
|
+
byteOffset,
|
|
365
|
+
payloadByteOffset,
|
|
366
|
+
groupId,
|
|
367
|
+
subgroupId,
|
|
368
|
+
objectId,
|
|
369
|
+
publisherPriority,
|
|
370
|
+
payloadLength,
|
|
371
|
+
payload,
|
|
372
|
+
extensionData
|
|
373
|
+
};
|
|
374
|
+
if (status !== void 0) obj.status = status;
|
|
375
|
+
return obj;
|
|
376
|
+
}
|
|
329
377
|
function decodeFetchStream(bytes) {
|
|
330
378
|
try {
|
|
331
|
-
const r = new (0,
|
|
379
|
+
const r = new (0, _chunk5IMHJIAZcjs.BufferReader)(bytes);
|
|
332
380
|
const streamType = r.readVarInt();
|
|
333
381
|
if (streamType !== FETCH_STREAM_TYPE) {
|
|
334
382
|
return {
|
|
335
383
|
ok: false,
|
|
336
|
-
error: new (0,
|
|
384
|
+
error: new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
337
385
|
"CONSTRAINT_VIOLATION",
|
|
338
386
|
`Expected fetch stream type 0x05, got 0x${streamType.toString(16)}`,
|
|
339
387
|
0
|
|
@@ -342,40 +390,9 @@ function decodeFetchStream(bytes) {
|
|
|
342
390
|
}
|
|
343
391
|
const requestId = r.readVarInt();
|
|
344
392
|
const objects = [];
|
|
393
|
+
const st = newFetchObjectState();
|
|
345
394
|
while (r.remaining > 0) {
|
|
346
|
-
|
|
347
|
-
const groupId = r.readVarInt();
|
|
348
|
-
const subgroupId = r.readVarInt();
|
|
349
|
-
const objectId = r.readVarInt();
|
|
350
|
-
const publisherPriority = r.readUint8();
|
|
351
|
-
const extLen = Number(r.readVarInt());
|
|
352
|
-
const extensionData = extLen > 0 ? r.readBytesView(extLen) : new Uint8Array(0);
|
|
353
|
-
const payloadLength = Number(r.readVarInt());
|
|
354
|
-
let payload;
|
|
355
|
-
let status;
|
|
356
|
-
let payloadByteOffset;
|
|
357
|
-
if (payloadLength === 0) {
|
|
358
|
-
status = r.readVarInt();
|
|
359
|
-
payloadByteOffset = r.offset;
|
|
360
|
-
payload = new Uint8Array(0);
|
|
361
|
-
} else {
|
|
362
|
-
payloadByteOffset = r.offset;
|
|
363
|
-
payload = r.readBytesView(payloadLength);
|
|
364
|
-
}
|
|
365
|
-
const obj = {
|
|
366
|
-
type: "object",
|
|
367
|
-
byteOffset,
|
|
368
|
-
payloadByteOffset,
|
|
369
|
-
groupId,
|
|
370
|
-
subgroupId,
|
|
371
|
-
objectId,
|
|
372
|
-
publisherPriority,
|
|
373
|
-
payloadLength,
|
|
374
|
-
payload,
|
|
375
|
-
extensionData
|
|
376
|
-
};
|
|
377
|
-
if (status !== void 0) obj.status = status;
|
|
378
|
-
objects.push(obj);
|
|
395
|
+
objects.push(readFetchObject(r, 0, st));
|
|
379
396
|
}
|
|
380
397
|
return {
|
|
381
398
|
ok: true,
|
|
@@ -383,7 +400,7 @@ function decodeFetchStream(bytes) {
|
|
|
383
400
|
bytesRead: r.offset
|
|
384
401
|
};
|
|
385
402
|
} catch (e) {
|
|
386
|
-
if (e instanceof
|
|
403
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError) return { ok: false, error: e };
|
|
387
404
|
throw e;
|
|
388
405
|
}
|
|
389
406
|
}
|
|
@@ -401,138 +418,123 @@ function decodeDataStream(streamType, bytes) {
|
|
|
401
418
|
}
|
|
402
419
|
}
|
|
403
420
|
}
|
|
421
|
+
var StreamBuffer = (_class = class {constructor() { _class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this); }
|
|
422
|
+
__init() {this.buf = new Uint8Array(0)}
|
|
423
|
+
/** Bytes written into `buf`. */
|
|
424
|
+
__init2() {this.len = 0}
|
|
425
|
+
/** Consumed prefix of `buf`; `base + offset` is the position in the stream. */
|
|
426
|
+
__init3() {this.offset = 0}
|
|
427
|
+
/** Absolute position of `buf[0]` within the stream. */
|
|
428
|
+
__init4() {this.base = 0}
|
|
429
|
+
get unread() {
|
|
430
|
+
return this.len - this.offset;
|
|
431
|
+
}
|
|
432
|
+
append(chunk) {
|
|
433
|
+
if (this.len + chunk.length > this.buf.length) {
|
|
434
|
+
const live = this.len - this.offset;
|
|
435
|
+
const needed = live + chunk.length;
|
|
436
|
+
let cap = Math.max(4096, this.buf.length);
|
|
437
|
+
while (cap < needed * 2) cap *= 2;
|
|
438
|
+
const next = new Uint8Array(cap);
|
|
439
|
+
next.set(this.buf.subarray(this.offset, this.len), 0);
|
|
440
|
+
this.buf = next;
|
|
441
|
+
this.base += this.offset;
|
|
442
|
+
this.len = live;
|
|
443
|
+
this.offset = 0;
|
|
444
|
+
}
|
|
445
|
+
this.buf.set(chunk, this.len);
|
|
446
|
+
this.len += chunk.length;
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* The written bytes, for a reader positioned at `offset`. Bounded by `len`
|
|
450
|
+
* rather than by capacity, so `BufferReader.remaining` counts real bytes and
|
|
451
|
+
* not the spare room after them.
|
|
452
|
+
*/
|
|
453
|
+
written() {
|
|
454
|
+
return this.buf.subarray(0, this.len);
|
|
455
|
+
}
|
|
456
|
+
}, _class);
|
|
404
457
|
function createSubgroupStreamDecoder() {
|
|
405
|
-
|
|
406
|
-
let
|
|
458
|
+
const b = new StreamBuffer();
|
|
459
|
+
let header = null;
|
|
407
460
|
let headerEmitted = false;
|
|
408
|
-
let extensionsPresent = false;
|
|
409
461
|
let prevObjectId = -1n;
|
|
410
|
-
let
|
|
462
|
+
let isFirst = true;
|
|
463
|
+
function emitHeader(controller, h, subgroupId) {
|
|
464
|
+
controller.enqueue({
|
|
465
|
+
type: "subgroup_header",
|
|
466
|
+
headerType: h.streamType,
|
|
467
|
+
trackAlias: h.trackAlias,
|
|
468
|
+
groupId: h.groupId,
|
|
469
|
+
subgroupId,
|
|
470
|
+
publisherPriority: h.publisherPriority
|
|
471
|
+
});
|
|
472
|
+
headerEmitted = true;
|
|
473
|
+
}
|
|
411
474
|
return new TransformStream({
|
|
412
475
|
transform(chunk, controller) {
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
}
|
|
417
|
-
const newBuffer = new Uint8Array(buffer.length + chunk.length);
|
|
418
|
-
newBuffer.set(buffer, 0);
|
|
419
|
-
newBuffer.set(chunk, buffer.length);
|
|
420
|
-
buffer = newBuffer;
|
|
421
|
-
if (!headerEmitted) {
|
|
476
|
+
b.append(chunk);
|
|
477
|
+
const view = b.written();
|
|
478
|
+
if (header === null) {
|
|
422
479
|
try {
|
|
423
|
-
const
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
controller.error(
|
|
427
|
-
new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
428
|
-
"CONSTRAINT_VIOLATION",
|
|
429
|
-
`Expected subgroup stream type 0x10-0x1D, got 0x${streamType.toString(16)}`,
|
|
430
|
-
0
|
|
431
|
-
)
|
|
432
|
-
);
|
|
433
|
-
return;
|
|
434
|
-
}
|
|
435
|
-
extensionsPresent = (streamType & 1) !== 0;
|
|
436
|
-
const hasSubgroupField = (streamType & 4) !== 0;
|
|
437
|
-
const trackAlias = r.readVarInt();
|
|
438
|
-
const groupId = r.readVarInt();
|
|
439
|
-
let subgroupId = 0n;
|
|
440
|
-
if (hasSubgroupField) {
|
|
441
|
-
subgroupId = r.readVarInt();
|
|
442
|
-
}
|
|
443
|
-
const publisherPriority = r.readUint8();
|
|
444
|
-
controller.enqueue({
|
|
445
|
-
type: "subgroup_header",
|
|
446
|
-
headerType: streamType,
|
|
447
|
-
trackAlias,
|
|
448
|
-
groupId,
|
|
449
|
-
subgroupId,
|
|
450
|
-
publisherPriority
|
|
451
|
-
});
|
|
452
|
-
headerEmitted = true;
|
|
453
|
-
offset += r.offset;
|
|
480
|
+
const hr = new (0, _chunk5IMHJIAZcjs.BufferReader)(view, b.offset);
|
|
481
|
+
header = readSubgroupHeader(hr);
|
|
482
|
+
b.offset = hr.offset;
|
|
454
483
|
} catch (e) {
|
|
455
|
-
if (e instanceof
|
|
484
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError && e.code === "UNEXPECTED_END") {
|
|
456
485
|
return;
|
|
457
486
|
}
|
|
458
487
|
controller.error(e);
|
|
459
488
|
return;
|
|
460
489
|
}
|
|
490
|
+
if (!header.subgroupIsFirstObjId) emitHeader(controller, header, header.subgroupId);
|
|
461
491
|
}
|
|
462
|
-
|
|
492
|
+
const h = header;
|
|
493
|
+
if (h === null) return;
|
|
494
|
+
const r = new (0, _chunk5IMHJIAZcjs.BufferReader)(view, b.offset);
|
|
495
|
+
while (r.remaining > 0) {
|
|
496
|
+
const start = r.offset;
|
|
497
|
+
let obj;
|
|
463
498
|
try {
|
|
464
|
-
|
|
465
|
-
const byteOffset = r.offset;
|
|
466
|
-
const delta = r.readVarInt();
|
|
467
|
-
const objectId = firstObject ? delta : prevObjectId + 1n + delta;
|
|
468
|
-
firstObject = false;
|
|
469
|
-
let extensionData = new Uint8Array(0);
|
|
470
|
-
if (extensionsPresent) {
|
|
471
|
-
const extLen = Number(r.readVarInt());
|
|
472
|
-
extensionData = extLen > 0 ? r.readBytesView(extLen) : new Uint8Array(0);
|
|
473
|
-
}
|
|
474
|
-
const payloadLength = Number(r.readVarInt());
|
|
475
|
-
let payload;
|
|
476
|
-
let status;
|
|
477
|
-
let payloadByteOffset;
|
|
478
|
-
if (payloadLength === 0) {
|
|
479
|
-
status = r.readVarInt();
|
|
480
|
-
payloadByteOffset = r.offset;
|
|
481
|
-
payload = new Uint8Array(0);
|
|
482
|
-
} else {
|
|
483
|
-
payloadByteOffset = r.offset;
|
|
484
|
-
payload = r.readBytesView(payloadLength);
|
|
485
|
-
}
|
|
486
|
-
const obj = {
|
|
487
|
-
type: "object",
|
|
488
|
-
byteOffset,
|
|
489
|
-
payloadByteOffset,
|
|
490
|
-
objectId,
|
|
491
|
-
payloadLength,
|
|
492
|
-
payload,
|
|
493
|
-
extensionData
|
|
494
|
-
};
|
|
495
|
-
if (status !== void 0) obj.status = status;
|
|
496
|
-
controller.enqueue(obj);
|
|
497
|
-
prevObjectId = objectId;
|
|
498
|
-
offset += r.offset;
|
|
499
|
+
obj = readSubgroupObject(r, h.extensionsPresent, isFirst, prevObjectId, b.base);
|
|
499
500
|
} catch (e) {
|
|
500
|
-
if (e instanceof
|
|
501
|
-
|
|
501
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError && e.code === "UNEXPECTED_END") {
|
|
502
|
+
b.offset = start;
|
|
503
|
+
return;
|
|
502
504
|
}
|
|
503
505
|
controller.error(e);
|
|
504
506
|
return;
|
|
505
507
|
}
|
|
508
|
+
if (!headerEmitted) emitHeader(controller, h, obj.objectId);
|
|
509
|
+
isFirst = false;
|
|
510
|
+
b.offset = r.offset;
|
|
511
|
+
prevObjectId = obj.objectId;
|
|
512
|
+
controller.enqueue(obj);
|
|
506
513
|
}
|
|
507
514
|
},
|
|
508
515
|
flush(controller) {
|
|
509
|
-
if (
|
|
510
|
-
|
|
516
|
+
if (header !== null && !headerEmitted) emitHeader(controller, header, 0n);
|
|
517
|
+
if (b.unread > 0) {
|
|
518
|
+
controller.error(new (0, _chunk5IMHJIAZcjs.DecodeError)("UNEXPECTED_END", "Stream ended with incomplete data", 0));
|
|
511
519
|
}
|
|
512
520
|
}
|
|
513
521
|
});
|
|
514
522
|
}
|
|
515
523
|
function createFetchStreamDecoder() {
|
|
516
|
-
|
|
517
|
-
let offset = 0;
|
|
524
|
+
const b = new StreamBuffer();
|
|
518
525
|
let headerEmitted = false;
|
|
526
|
+
const st = newFetchObjectState();
|
|
519
527
|
return new TransformStream({
|
|
520
528
|
transform(chunk, controller) {
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
offset = 0;
|
|
524
|
-
}
|
|
525
|
-
const newBuffer = new Uint8Array(buffer.length + chunk.length);
|
|
526
|
-
newBuffer.set(buffer, 0);
|
|
527
|
-
newBuffer.set(chunk, buffer.length);
|
|
528
|
-
buffer = newBuffer;
|
|
529
|
+
b.append(chunk);
|
|
530
|
+
const view = b.written();
|
|
529
531
|
if (!headerEmitted) {
|
|
530
532
|
try {
|
|
531
|
-
const
|
|
532
|
-
const streamType =
|
|
533
|
+
const r2 = new (0, _chunk5IMHJIAZcjs.BufferReader)(view, b.offset);
|
|
534
|
+
const streamType = r2.readVarInt();
|
|
533
535
|
if (streamType !== FETCH_STREAM_TYPE) {
|
|
534
536
|
controller.error(
|
|
535
|
-
new (0,
|
|
537
|
+
new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
536
538
|
"CONSTRAINT_VIOLATION",
|
|
537
539
|
`Expected fetch stream type 0x05, got 0x${streamType.toString(16)}`,
|
|
538
540
|
0
|
|
@@ -540,67 +542,39 @@ function createFetchStreamDecoder() {
|
|
|
540
542
|
);
|
|
541
543
|
return;
|
|
542
544
|
}
|
|
543
|
-
const requestId =
|
|
545
|
+
const requestId = r2.readVarInt();
|
|
544
546
|
controller.enqueue({ type: "fetch_header", requestId });
|
|
545
547
|
headerEmitted = true;
|
|
546
|
-
offset
|
|
548
|
+
b.offset = r2.offset;
|
|
547
549
|
} catch (e) {
|
|
548
|
-
if (e instanceof
|
|
550
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError && e.code === "UNEXPECTED_END") {
|
|
549
551
|
return;
|
|
550
552
|
}
|
|
551
553
|
controller.error(e);
|
|
552
554
|
return;
|
|
553
555
|
}
|
|
554
556
|
}
|
|
555
|
-
|
|
557
|
+
const r = new (0, _chunk5IMHJIAZcjs.BufferReader)(view, b.offset);
|
|
558
|
+
while (r.remaining > 0) {
|
|
559
|
+
const start = r.offset;
|
|
560
|
+
let obj;
|
|
556
561
|
try {
|
|
557
|
-
|
|
558
|
-
const byteOffset = r.offset;
|
|
559
|
-
const groupId = r.readVarInt();
|
|
560
|
-
const subgroupId = r.readVarInt();
|
|
561
|
-
const objectId = r.readVarInt();
|
|
562
|
-
const publisherPriority = r.readUint8();
|
|
563
|
-
const extLen = Number(r.readVarInt());
|
|
564
|
-
const extensionData = extLen > 0 ? r.readBytesView(extLen) : new Uint8Array(0);
|
|
565
|
-
const payloadLength = Number(r.readVarInt());
|
|
566
|
-
let payload;
|
|
567
|
-
let status;
|
|
568
|
-
let payloadByteOffset;
|
|
569
|
-
if (payloadLength === 0) {
|
|
570
|
-
status = r.readVarInt();
|
|
571
|
-
payloadByteOffset = r.offset;
|
|
572
|
-
payload = new Uint8Array(0);
|
|
573
|
-
} else {
|
|
574
|
-
payloadByteOffset = r.offset;
|
|
575
|
-
payload = r.readBytesView(payloadLength);
|
|
576
|
-
}
|
|
577
|
-
const obj = {
|
|
578
|
-
type: "object",
|
|
579
|
-
byteOffset,
|
|
580
|
-
payloadByteOffset,
|
|
581
|
-
groupId,
|
|
582
|
-
subgroupId,
|
|
583
|
-
objectId,
|
|
584
|
-
publisherPriority,
|
|
585
|
-
payloadLength,
|
|
586
|
-
payload,
|
|
587
|
-
extensionData
|
|
588
|
-
};
|
|
589
|
-
if (status !== void 0) obj.status = status;
|
|
590
|
-
controller.enqueue(obj);
|
|
591
|
-
offset += r.offset;
|
|
562
|
+
obj = readFetchObject(r, b.base, st);
|
|
592
563
|
} catch (e) {
|
|
593
|
-
if (e instanceof
|
|
594
|
-
|
|
564
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError && e.code === "UNEXPECTED_END") {
|
|
565
|
+
b.offset = start;
|
|
566
|
+
return;
|
|
595
567
|
}
|
|
596
568
|
controller.error(e);
|
|
597
569
|
return;
|
|
598
570
|
}
|
|
571
|
+
b.offset = r.offset;
|
|
572
|
+
controller.enqueue(obj);
|
|
599
573
|
}
|
|
600
574
|
},
|
|
601
575
|
flush(controller) {
|
|
602
|
-
if (
|
|
603
|
-
controller.error(new (0,
|
|
576
|
+
if (b.unread > 0) {
|
|
577
|
+
controller.error(new (0, _chunk5IMHJIAZcjs.DecodeError)("UNEXPECTED_END", "Stream ended with incomplete data", 0));
|
|
604
578
|
}
|
|
605
579
|
}
|
|
606
580
|
});
|
|
@@ -625,7 +599,7 @@ function createDataStreamDecoder() {
|
|
|
625
599
|
buffer = newBuffer;
|
|
626
600
|
if (detectedType === null) {
|
|
627
601
|
try {
|
|
628
|
-
const r = new (0,
|
|
602
|
+
const r = new (0, _chunk5IMHJIAZcjs.BufferReader)(buffer.subarray(offset));
|
|
629
603
|
const streamType = Number(r.readVarInt());
|
|
630
604
|
if (isValidSubgroupType(streamType)) {
|
|
631
605
|
detectedType = "subgroup";
|
|
@@ -633,7 +607,7 @@ function createDataStreamDecoder() {
|
|
|
633
607
|
detectedType = "fetch";
|
|
634
608
|
} else {
|
|
635
609
|
controller.error(
|
|
636
|
-
new (0,
|
|
610
|
+
new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
637
611
|
"CONSTRAINT_VIOLATION",
|
|
638
612
|
`Unknown data stream type: 0x${streamType.toString(16)}`,
|
|
639
613
|
0
|
|
@@ -642,7 +616,7 @@ function createDataStreamDecoder() {
|
|
|
642
616
|
return;
|
|
643
617
|
}
|
|
644
618
|
} catch (e) {
|
|
645
|
-
if (e instanceof
|
|
619
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError && e.code === "UNEXPECTED_END") {
|
|
646
620
|
return;
|
|
647
621
|
}
|
|
648
622
|
controller.error(e);
|
|
@@ -652,7 +626,7 @@ function createDataStreamDecoder() {
|
|
|
652
626
|
if (detectedType === "subgroup") {
|
|
653
627
|
if (!headerEmitted) {
|
|
654
628
|
try {
|
|
655
|
-
const r = new (0,
|
|
629
|
+
const r = new (0, _chunk5IMHJIAZcjs.BufferReader)(buffer.subarray(offset));
|
|
656
630
|
const streamType = Number(r.readVarInt());
|
|
657
631
|
extensionsPresent = (streamType & 1) !== 0;
|
|
658
632
|
const hasSubgroupField = (streamType & 4) !== 0;
|
|
@@ -672,14 +646,14 @@ function createDataStreamDecoder() {
|
|
|
672
646
|
headerEmitted = true;
|
|
673
647
|
offset += r.offset;
|
|
674
648
|
} catch (e) {
|
|
675
|
-
if (e instanceof
|
|
649
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError && e.code === "UNEXPECTED_END") return;
|
|
676
650
|
controller.error(e);
|
|
677
651
|
return;
|
|
678
652
|
}
|
|
679
653
|
}
|
|
680
654
|
while (offset < buffer.length) {
|
|
681
655
|
try {
|
|
682
|
-
const r = new (0,
|
|
656
|
+
const r = new (0, _chunk5IMHJIAZcjs.BufferReader)(buffer.subarray(offset));
|
|
683
657
|
const byteOffset = r.offset;
|
|
684
658
|
const delta = r.readVarInt();
|
|
685
659
|
const objectId = firstObject ? delta : prevObjectId + 1n + delta;
|
|
@@ -715,7 +689,7 @@ function createDataStreamDecoder() {
|
|
|
715
689
|
prevObjectId = objectId;
|
|
716
690
|
offset += r.offset;
|
|
717
691
|
} catch (e) {
|
|
718
|
-
if (e instanceof
|
|
692
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError && e.code === "UNEXPECTED_END") break;
|
|
719
693
|
controller.error(e);
|
|
720
694
|
return;
|
|
721
695
|
}
|
|
@@ -723,21 +697,21 @@ function createDataStreamDecoder() {
|
|
|
723
697
|
} else {
|
|
724
698
|
if (!headerEmitted) {
|
|
725
699
|
try {
|
|
726
|
-
const r = new (0,
|
|
700
|
+
const r = new (0, _chunk5IMHJIAZcjs.BufferReader)(buffer.subarray(offset));
|
|
727
701
|
r.readVarInt();
|
|
728
702
|
const requestId = r.readVarInt();
|
|
729
703
|
controller.enqueue({ type: "fetch_header", requestId });
|
|
730
704
|
headerEmitted = true;
|
|
731
705
|
offset += r.offset;
|
|
732
706
|
} catch (e) {
|
|
733
|
-
if (e instanceof
|
|
707
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError && e.code === "UNEXPECTED_END") return;
|
|
734
708
|
controller.error(e);
|
|
735
709
|
return;
|
|
736
710
|
}
|
|
737
711
|
}
|
|
738
712
|
while (offset < buffer.length) {
|
|
739
713
|
try {
|
|
740
|
-
const r = new (0,
|
|
714
|
+
const r = new (0, _chunk5IMHJIAZcjs.BufferReader)(buffer.subarray(offset));
|
|
741
715
|
const byteOffset = r.offset;
|
|
742
716
|
const groupId = r.readVarInt();
|
|
743
717
|
const subgroupId = r.readVarInt();
|
|
@@ -773,7 +747,7 @@ function createDataStreamDecoder() {
|
|
|
773
747
|
controller.enqueue(obj);
|
|
774
748
|
offset += r.offset;
|
|
775
749
|
} catch (e) {
|
|
776
|
-
if (e instanceof
|
|
750
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError && e.code === "UNEXPECTED_END") break;
|
|
777
751
|
controller.error(e);
|
|
778
752
|
return;
|
|
779
753
|
}
|
|
@@ -782,7 +756,7 @@ function createDataStreamDecoder() {
|
|
|
782
756
|
},
|
|
783
757
|
flush(controller) {
|
|
784
758
|
if (offset < buffer.length) {
|
|
785
|
-
controller.error(new (0,
|
|
759
|
+
controller.error(new (0, _chunk5IMHJIAZcjs.DecodeError)("UNEXPECTED_END", "Stream ended with incomplete data", 0));
|
|
786
760
|
}
|
|
787
761
|
}
|
|
788
762
|
});
|
|
@@ -801,7 +775,7 @@ function encodeSetupParams(params, writer) {
|
|
|
801
775
|
if (params.role !== void 0) count++;
|
|
802
776
|
if (params.path !== void 0) count++;
|
|
803
777
|
if (params.max_request_id !== void 0) count++;
|
|
804
|
-
|
|
778
|
+
count += _nullishCoalesce(_optionalChain([params, 'access', _ => _.authorization_token, 'optionalAccess', _2 => _2.length]), () => ( 0));
|
|
805
779
|
if (params.authority !== void 0) count++;
|
|
806
780
|
if (params.max_auth_token_cache_size !== void 0) count++;
|
|
807
781
|
if (params.moqt_implementation !== void 0) count++;
|
|
@@ -821,10 +795,10 @@ function encodeSetupParams(params, writer) {
|
|
|
821
795
|
writer.writeVarInt(PARAM_MAX_REQUEST_ID);
|
|
822
796
|
writer.writeVarInt(params.max_request_id);
|
|
823
797
|
}
|
|
824
|
-
|
|
798
|
+
for (const token of _nullishCoalesce(params.authorization_token, () => ( []))) {
|
|
825
799
|
writer.writeVarInt(PARAM_AUTHORIZATION_TOKEN);
|
|
826
|
-
const tok =
|
|
827
|
-
const tmpWriter = new (0,
|
|
800
|
+
const tok = token;
|
|
801
|
+
const tmpWriter = new (0, _chunk5IMHJIAZcjs.BufferWriter)(64);
|
|
828
802
|
tmpWriter.writeVarInt(tok.alias_type);
|
|
829
803
|
if (tok.token_type !== void 0) {
|
|
830
804
|
tmpWriter.writeVarInt(tok.token_type);
|
|
@@ -859,7 +833,7 @@ function encodeSetupParams(params, writer) {
|
|
|
859
833
|
for (const u of params.unknown) {
|
|
860
834
|
const id = BigInt(u.id);
|
|
861
835
|
writer.writeVarInt(id);
|
|
862
|
-
const raw =
|
|
836
|
+
const raw = _chunk5IMHJIAZcjs.hexToBytes.call(void 0, u.raw_hex);
|
|
863
837
|
writer.writeVarInt(raw.byteLength);
|
|
864
838
|
writer.writeBytes(raw);
|
|
865
839
|
}
|
|
@@ -880,13 +854,13 @@ function decodeSetupParams(reader) {
|
|
|
880
854
|
} else if (paramType === PARAM_MAX_AUTH_TOKEN_CACHE_SIZE) {
|
|
881
855
|
result.max_auth_token_cache_size = value;
|
|
882
856
|
} else {
|
|
883
|
-
const tmpWriter = new (0,
|
|
857
|
+
const tmpWriter = new (0, _chunk5IMHJIAZcjs.BufferWriter)(16);
|
|
884
858
|
tmpWriter.writeVarInt(value);
|
|
885
859
|
const raw = tmpWriter.finish();
|
|
886
860
|
unknown.push({
|
|
887
861
|
id: `0x${paramType.toString(16)}`,
|
|
888
862
|
length: raw.byteLength,
|
|
889
|
-
raw_hex:
|
|
863
|
+
raw_hex: _chunk5IMHJIAZcjs.bytesToHex.call(void 0, raw)
|
|
890
864
|
});
|
|
891
865
|
}
|
|
892
866
|
} else {
|
|
@@ -895,17 +869,21 @@ function decodeSetupParams(reader) {
|
|
|
895
869
|
if (paramType === PARAM_PATH) {
|
|
896
870
|
result.path = textDecoder.decode(bytes);
|
|
897
871
|
} else if (paramType === PARAM_AUTHORIZATION_TOKEN) {
|
|
898
|
-
const tokenReader = new (0,
|
|
872
|
+
const tokenReader = new (0, _chunk5IMHJIAZcjs.BufferReader)(bytes);
|
|
899
873
|
const alias_type = tokenReader.readVarInt();
|
|
900
874
|
const tok = { alias_type };
|
|
901
875
|
if (tokenReader.remaining > 0) {
|
|
902
876
|
tok.token_type = tokenReader.readVarInt();
|
|
903
877
|
if (tokenReader.remaining > 0) {
|
|
904
|
-
const
|
|
905
|
-
tok.token_value =
|
|
878
|
+
const value = new Uint8Array(tokenReader.readBytesView(tokenReader.remaining));
|
|
879
|
+
tok.token_value = value;
|
|
880
|
+
noteAuthTokenValue(reader.offset - length, length, value);
|
|
906
881
|
}
|
|
907
882
|
}
|
|
908
|
-
result.authorization_token =
|
|
883
|
+
result.authorization_token = [
|
|
884
|
+
..._nullishCoalesce(result.authorization_token, () => ( [])),
|
|
885
|
+
tok
|
|
886
|
+
];
|
|
909
887
|
} else if (paramType === PARAM_AUTHORITY) {
|
|
910
888
|
result.authority = textDecoder.decode(bytes);
|
|
911
889
|
} else if (paramType === PARAM_MOQT_IMPLEMENTATION) {
|
|
@@ -914,7 +892,7 @@ function decodeSetupParams(reader) {
|
|
|
914
892
|
unknown.push({
|
|
915
893
|
id: `0x${paramType.toString(16)}`,
|
|
916
894
|
length,
|
|
917
|
-
raw_hex:
|
|
895
|
+
raw_hex: _chunk5IMHJIAZcjs.bytesToHex.call(void 0, bytes)
|
|
918
896
|
});
|
|
919
897
|
}
|
|
920
898
|
}
|
|
@@ -925,7 +903,7 @@ function decodeSetupParams(reader) {
|
|
|
925
903
|
function encodeMessageParams(params, writer) {
|
|
926
904
|
let count = 0;
|
|
927
905
|
if (params.delivery_timeout !== void 0) count++;
|
|
928
|
-
|
|
906
|
+
count += _nullishCoalesce(_optionalChain([params, 'access', _3 => _3.authorization_token, 'optionalAccess', _4 => _4.length]), () => ( 0));
|
|
929
907
|
if (params.max_cache_duration !== void 0) count++;
|
|
930
908
|
if (params.unknown) count += params.unknown.length;
|
|
931
909
|
writer.writeVarInt(count);
|
|
@@ -933,10 +911,10 @@ function encodeMessageParams(params, writer) {
|
|
|
933
911
|
writer.writeVarInt(PARAM_DELIVERY_TIMEOUT);
|
|
934
912
|
writer.writeVarInt(params.delivery_timeout);
|
|
935
913
|
}
|
|
936
|
-
|
|
914
|
+
for (const token of _nullishCoalesce(params.authorization_token, () => ( []))) {
|
|
937
915
|
writer.writeVarInt(PARAM_AUTHORIZATION_TOKEN);
|
|
938
|
-
const tok =
|
|
939
|
-
const tmpWriter = new (0,
|
|
916
|
+
const tok = token;
|
|
917
|
+
const tmpWriter = new (0, _chunk5IMHJIAZcjs.BufferWriter)(64);
|
|
940
918
|
tmpWriter.writeVarInt(tok.alias_type);
|
|
941
919
|
if (tok.token_type !== void 0) {
|
|
942
920
|
tmpWriter.writeVarInt(tok.token_type);
|
|
@@ -959,7 +937,7 @@ function encodeMessageParams(params, writer) {
|
|
|
959
937
|
for (const u of params.unknown) {
|
|
960
938
|
const id = BigInt(u.id);
|
|
961
939
|
writer.writeVarInt(id);
|
|
962
|
-
const raw =
|
|
940
|
+
const raw = _chunk5IMHJIAZcjs.hexToBytes.call(void 0, u.raw_hex);
|
|
963
941
|
writer.writeVarInt(raw.byteLength);
|
|
964
942
|
writer.writeBytes(raw);
|
|
965
943
|
}
|
|
@@ -978,35 +956,39 @@ function decodeMessageParams(reader) {
|
|
|
978
956
|
} else if (paramType === PARAM_MAX_CACHE_DURATION) {
|
|
979
957
|
result.max_cache_duration = value;
|
|
980
958
|
} else {
|
|
981
|
-
const tmpWriter = new (0,
|
|
959
|
+
const tmpWriter = new (0, _chunk5IMHJIAZcjs.BufferWriter)(16);
|
|
982
960
|
tmpWriter.writeVarInt(value);
|
|
983
961
|
const raw = tmpWriter.finish();
|
|
984
962
|
unknown.push({
|
|
985
963
|
id: `0x${paramType.toString(16)}`,
|
|
986
964
|
length: raw.byteLength,
|
|
987
|
-
raw_hex:
|
|
965
|
+
raw_hex: _chunk5IMHJIAZcjs.bytesToHex.call(void 0, raw)
|
|
988
966
|
});
|
|
989
967
|
}
|
|
990
968
|
} else {
|
|
991
969
|
const length = Number(reader.readVarInt());
|
|
992
970
|
const bytes = reader.readBytes(length);
|
|
993
971
|
if (paramType === PARAM_AUTHORIZATION_TOKEN) {
|
|
994
|
-
const tokenReader = new (0,
|
|
972
|
+
const tokenReader = new (0, _chunk5IMHJIAZcjs.BufferReader)(bytes);
|
|
995
973
|
const alias_type = tokenReader.readVarInt();
|
|
996
974
|
const tok = { alias_type };
|
|
997
975
|
if (tokenReader.remaining > 0) {
|
|
998
976
|
tok.token_type = tokenReader.readVarInt();
|
|
999
977
|
if (tokenReader.remaining > 0) {
|
|
1000
|
-
const
|
|
1001
|
-
tok.token_value =
|
|
978
|
+
const value = new Uint8Array(tokenReader.readBytesView(tokenReader.remaining));
|
|
979
|
+
tok.token_value = value;
|
|
980
|
+
noteAuthTokenValue(reader.offset - length, length, value);
|
|
1002
981
|
}
|
|
1003
982
|
}
|
|
1004
|
-
result.authorization_token =
|
|
983
|
+
result.authorization_token = [
|
|
984
|
+
..._nullishCoalesce(result.authorization_token, () => ( [])),
|
|
985
|
+
tok
|
|
986
|
+
];
|
|
1005
987
|
} else {
|
|
1006
988
|
unknown.push({
|
|
1007
989
|
id: `0x${paramType.toString(16)}`,
|
|
1008
990
|
length,
|
|
1009
|
-
raw_hex:
|
|
991
|
+
raw_hex: _chunk5IMHJIAZcjs.bytesToHex.call(void 0, bytes)
|
|
1010
992
|
});
|
|
1011
993
|
}
|
|
1012
994
|
}
|
|
@@ -1230,7 +1212,7 @@ function encodeRequestsBlockedPayload(msg, w) {
|
|
|
1230
1212
|
function decodeClientSetupPayload(r) {
|
|
1231
1213
|
const numVersions = Number(r.readVarInt());
|
|
1232
1214
|
if (numVersions === 0) {
|
|
1233
|
-
throw new (0,
|
|
1215
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
1234
1216
|
"CONSTRAINT_VIOLATION",
|
|
1235
1217
|
"CLIENT_SETUP must offer at least one version",
|
|
1236
1218
|
r.offset
|
|
@@ -1257,7 +1239,7 @@ function decodeSubscribePayload(r) {
|
|
|
1257
1239
|
const forward = r.readVarInt();
|
|
1258
1240
|
const filter_type = r.readVarInt();
|
|
1259
1241
|
if (filter_type < FilterType.NextGroupStart || filter_type > FilterType.AbsoluteRange) {
|
|
1260
|
-
throw new (0,
|
|
1242
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)("CONSTRAINT_VIOLATION", `Invalid filter_type: ${filter_type}`, r.offset);
|
|
1261
1243
|
}
|
|
1262
1244
|
let start_group;
|
|
1263
1245
|
let start_object;
|
|
@@ -1493,7 +1475,7 @@ function decodeFetchPayload(r) {
|
|
|
1493
1475
|
const group_order = r.readUint8();
|
|
1494
1476
|
const fetch_type = r.readVarInt();
|
|
1495
1477
|
if (fetch_type < FetchType.Standalone || fetch_type > FetchType.AbsoluteJoining) {
|
|
1496
|
-
throw new (0,
|
|
1478
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)("CONSTRAINT_VIOLATION", `Invalid fetch_type: ${fetch_type}`, r.offset);
|
|
1497
1479
|
}
|
|
1498
1480
|
if (fetch_type === FetchType.Standalone) {
|
|
1499
1481
|
const standalone = {
|
|
@@ -1669,13 +1651,13 @@ function encodeMessage(message) {
|
|
|
1669
1651
|
if (typeId === void 0) {
|
|
1670
1652
|
throw new Error(`Unknown message type: ${message.type}`);
|
|
1671
1653
|
}
|
|
1672
|
-
const payloadWriter = new (0,
|
|
1654
|
+
const payloadWriter = new (0, _chunk5IMHJIAZcjs.BufferWriter)();
|
|
1673
1655
|
encodePayload(message, payloadWriter);
|
|
1674
1656
|
const payload = payloadWriter.finishView();
|
|
1675
1657
|
if (payload.byteLength > 65535) {
|
|
1676
1658
|
throw new Error(`Payload too large for 16-bit length: ${payload.byteLength}`);
|
|
1677
1659
|
}
|
|
1678
|
-
const writer = new (0,
|
|
1660
|
+
const writer = new (0, _chunk5IMHJIAZcjs.BufferWriter)(payload.byteLength + 16);
|
|
1679
1661
|
writer.writeVarInt(typeId);
|
|
1680
1662
|
writer.writeUint8(payload.byteLength >> 8 & 255);
|
|
1681
1663
|
writer.writeUint8(payload.byteLength & 255);
|
|
@@ -1752,18 +1734,18 @@ function encodePayload(msg, w) {
|
|
|
1752
1734
|
}
|
|
1753
1735
|
function decodeMessage(bytes) {
|
|
1754
1736
|
try {
|
|
1755
|
-
const reader = new (0,
|
|
1737
|
+
const reader = new (0, _chunk5IMHJIAZcjs.BufferReader)(bytes);
|
|
1756
1738
|
const typeId = reader.readVarInt();
|
|
1757
1739
|
const lenHi = reader.readUint8();
|
|
1758
1740
|
const lenLo = reader.readUint8();
|
|
1759
1741
|
const payloadLength = lenHi << 8 | lenLo;
|
|
1760
1742
|
const payloadBytes = reader.readBytes(payloadLength);
|
|
1761
|
-
const payloadReader = new (0,
|
|
1743
|
+
const payloadReader = new (0, _chunk5IMHJIAZcjs.BufferReader)(payloadBytes);
|
|
1762
1744
|
const decoder = payloadDecoders.get(typeId);
|
|
1763
1745
|
if (!decoder) {
|
|
1764
1746
|
return {
|
|
1765
1747
|
ok: false,
|
|
1766
|
-
error: new (0,
|
|
1748
|
+
error: new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
1767
1749
|
"UNKNOWN_MESSAGE_TYPE",
|
|
1768
1750
|
`Unknown message type ID: 0x${typeId.toString(16)}`,
|
|
1769
1751
|
0
|
|
@@ -1773,7 +1755,7 @@ function decodeMessage(bytes) {
|
|
|
1773
1755
|
const message = decoder(payloadReader);
|
|
1774
1756
|
return { ok: true, value: message, bytesRead: reader.offset };
|
|
1775
1757
|
} catch (e) {
|
|
1776
|
-
if (e instanceof
|
|
1758
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError) {
|
|
1777
1759
|
return { ok: false, error: e };
|
|
1778
1760
|
}
|
|
1779
1761
|
throw e;
|
|
@@ -1808,7 +1790,7 @@ function createStreamDecoder() {
|
|
|
1808
1790
|
flush(controller) {
|
|
1809
1791
|
if (offset < buffer.length) {
|
|
1810
1792
|
controller.error(
|
|
1811
|
-
new (0,
|
|
1793
|
+
new (0, _chunk5IMHJIAZcjs.DecodeError)("UNEXPECTED_END", "Stream ended with incomplete message data", 0)
|
|
1812
1794
|
);
|
|
1813
1795
|
}
|
|
1814
1796
|
}
|
|
@@ -1832,6 +1814,24 @@ function createDraft14Codec() {
|
|
|
1832
1814
|
createDataStreamDecoder
|
|
1833
1815
|
};
|
|
1834
1816
|
}
|
|
1817
|
+
function noteAuthTokenValue(valueStart, valueLength, value) {
|
|
1818
|
+
if (value === void 0 || value.byteLength === 0) return;
|
|
1819
|
+
_chunk5IMHJIAZcjs.recordAuthValueSpan.call(void 0, valueStart + valueLength - value.byteLength, value.byteLength);
|
|
1820
|
+
}
|
|
1821
|
+
function redactAuthTokens(bytes) {
|
|
1822
|
+
let payloadStart;
|
|
1823
|
+
try {
|
|
1824
|
+
const probe = new (0, _chunk5IMHJIAZcjs.BufferReader)(bytes);
|
|
1825
|
+
probe.readVarInt();
|
|
1826
|
+
probe.readUint8();
|
|
1827
|
+
probe.readUint8();
|
|
1828
|
+
payloadStart = probe.offset;
|
|
1829
|
+
} catch (e2) {
|
|
1830
|
+
return { bytes, redacted: 0, incomplete: false, decoded: false };
|
|
1831
|
+
}
|
|
1832
|
+
return _chunk5IMHJIAZcjs.redactWith.call(void 0, bytes, payloadStart, () => decodeMessage(bytes).ok);
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1835
1835
|
|
|
1836
1836
|
|
|
1837
1837
|
|
|
@@ -1887,4 +1887,4 @@ function createDraft14Codec() {
|
|
|
1887
1887
|
|
|
1888
1888
|
|
|
1889
1889
|
|
|
1890
|
-
exports.MSG_SUBSCRIBE_UPDATE = MSG_SUBSCRIBE_UPDATE; exports.MSG_SUBSCRIBE = MSG_SUBSCRIBE; exports.MSG_SUBSCRIBE_OK = MSG_SUBSCRIBE_OK; exports.MSG_SUBSCRIBE_ERROR = MSG_SUBSCRIBE_ERROR; exports.MSG_PUBLISH_NAMESPACE = MSG_PUBLISH_NAMESPACE; exports.MSG_PUBLISH_NAMESPACE_OK = MSG_PUBLISH_NAMESPACE_OK; exports.MSG_PUBLISH_NAMESPACE_ERROR = MSG_PUBLISH_NAMESPACE_ERROR; exports.MSG_PUBLISH_NAMESPACE_DONE = MSG_PUBLISH_NAMESPACE_DONE; exports.MSG_UNSUBSCRIBE = MSG_UNSUBSCRIBE; exports.MSG_PUBLISH_DONE = MSG_PUBLISH_DONE; exports.MSG_PUBLISH_NAMESPACE_CANCEL = MSG_PUBLISH_NAMESPACE_CANCEL; exports.MSG_TRACK_STATUS = MSG_TRACK_STATUS; exports.MSG_TRACK_STATUS_OK = MSG_TRACK_STATUS_OK; exports.MSG_TRACK_STATUS_ERROR = MSG_TRACK_STATUS_ERROR; exports.MSG_GOAWAY = MSG_GOAWAY; exports.MSG_SUBSCRIBE_NAMESPACE = MSG_SUBSCRIBE_NAMESPACE; exports.MSG_SUBSCRIBE_NAMESPACE_OK = MSG_SUBSCRIBE_NAMESPACE_OK; exports.MSG_SUBSCRIBE_NAMESPACE_ERROR = MSG_SUBSCRIBE_NAMESPACE_ERROR; exports.MSG_UNSUBSCRIBE_NAMESPACE = MSG_UNSUBSCRIBE_NAMESPACE; exports.MSG_MAX_REQUEST_ID = MSG_MAX_REQUEST_ID; exports.MSG_FETCH = MSG_FETCH; exports.MSG_FETCH_CANCEL = MSG_FETCH_CANCEL; exports.MSG_FETCH_OK = MSG_FETCH_OK; exports.MSG_FETCH_ERROR = MSG_FETCH_ERROR; exports.MSG_REQUESTS_BLOCKED = MSG_REQUESTS_BLOCKED; exports.MSG_PUBLISH = MSG_PUBLISH; exports.MSG_PUBLISH_OK = MSG_PUBLISH_OK; exports.MSG_PUBLISH_ERROR = MSG_PUBLISH_ERROR; exports.MSG_CLIENT_SETUP = MSG_CLIENT_SETUP; exports.MSG_SERVER_SETUP = MSG_SERVER_SETUP; exports.PARAM_ROLE = PARAM_ROLE; exports.PARAM_PATH = PARAM_PATH; exports.PARAM_MAX_REQUEST_ID = PARAM_MAX_REQUEST_ID; exports.PARAM_MOQT_IMPLEMENTATION = PARAM_MOQT_IMPLEMENTATION; exports.MESSAGE_TYPE_MAP = MESSAGE_TYPE_MAP; exports.MESSAGE_ID_MAP = MESSAGE_ID_MAP; exports.FilterType = FilterType; exports.GroupOrder = GroupOrder; exports.FetchType = FetchType; exports.encodeSubgroupStream = encodeSubgroupStream; exports.encodeDatagram = encodeDatagram; exports.encodeFetchStream = encodeFetchStream; exports.decodeSubgroupStream = decodeSubgroupStream; exports.decodeDatagram = decodeDatagram; exports.decodeFetchStream = decodeFetchStream; exports.decodeDataStream = decodeDataStream; exports.createSubgroupStreamDecoder = createSubgroupStreamDecoder; exports.createFetchStreamDecoder = createFetchStreamDecoder; exports.createDataStreamDecoder = createDataStreamDecoder; exports.encodeMessage = encodeMessage; exports.decodeMessage = decodeMessage; exports.createStreamDecoder = createStreamDecoder; exports.createDraft14Codec = createDraft14Codec;
|
|
1890
|
+
exports.MSG_SUBSCRIBE_UPDATE = MSG_SUBSCRIBE_UPDATE; exports.MSG_SUBSCRIBE = MSG_SUBSCRIBE; exports.MSG_SUBSCRIBE_OK = MSG_SUBSCRIBE_OK; exports.MSG_SUBSCRIBE_ERROR = MSG_SUBSCRIBE_ERROR; exports.MSG_PUBLISH_NAMESPACE = MSG_PUBLISH_NAMESPACE; exports.MSG_PUBLISH_NAMESPACE_OK = MSG_PUBLISH_NAMESPACE_OK; exports.MSG_PUBLISH_NAMESPACE_ERROR = MSG_PUBLISH_NAMESPACE_ERROR; exports.MSG_PUBLISH_NAMESPACE_DONE = MSG_PUBLISH_NAMESPACE_DONE; exports.MSG_UNSUBSCRIBE = MSG_UNSUBSCRIBE; exports.MSG_PUBLISH_DONE = MSG_PUBLISH_DONE; exports.MSG_PUBLISH_NAMESPACE_CANCEL = MSG_PUBLISH_NAMESPACE_CANCEL; exports.MSG_TRACK_STATUS = MSG_TRACK_STATUS; exports.MSG_TRACK_STATUS_OK = MSG_TRACK_STATUS_OK; exports.MSG_TRACK_STATUS_ERROR = MSG_TRACK_STATUS_ERROR; exports.MSG_GOAWAY = MSG_GOAWAY; exports.MSG_SUBSCRIBE_NAMESPACE = MSG_SUBSCRIBE_NAMESPACE; exports.MSG_SUBSCRIBE_NAMESPACE_OK = MSG_SUBSCRIBE_NAMESPACE_OK; exports.MSG_SUBSCRIBE_NAMESPACE_ERROR = MSG_SUBSCRIBE_NAMESPACE_ERROR; exports.MSG_UNSUBSCRIBE_NAMESPACE = MSG_UNSUBSCRIBE_NAMESPACE; exports.MSG_MAX_REQUEST_ID = MSG_MAX_REQUEST_ID; exports.MSG_FETCH = MSG_FETCH; exports.MSG_FETCH_CANCEL = MSG_FETCH_CANCEL; exports.MSG_FETCH_OK = MSG_FETCH_OK; exports.MSG_FETCH_ERROR = MSG_FETCH_ERROR; exports.MSG_REQUESTS_BLOCKED = MSG_REQUESTS_BLOCKED; exports.MSG_PUBLISH = MSG_PUBLISH; exports.MSG_PUBLISH_OK = MSG_PUBLISH_OK; exports.MSG_PUBLISH_ERROR = MSG_PUBLISH_ERROR; exports.MSG_CLIENT_SETUP = MSG_CLIENT_SETUP; exports.MSG_SERVER_SETUP = MSG_SERVER_SETUP; exports.PARAM_ROLE = PARAM_ROLE; exports.PARAM_PATH = PARAM_PATH; exports.PARAM_MAX_REQUEST_ID = PARAM_MAX_REQUEST_ID; exports.PARAM_MOQT_IMPLEMENTATION = PARAM_MOQT_IMPLEMENTATION; exports.MESSAGE_TYPE_MAP = MESSAGE_TYPE_MAP; exports.MESSAGE_ID_MAP = MESSAGE_ID_MAP; exports.FilterType = FilterType; exports.GroupOrder = GroupOrder; exports.FetchType = FetchType; exports.encodeSubgroupStream = encodeSubgroupStream; exports.encodeDatagram = encodeDatagram; exports.encodeFetchStream = encodeFetchStream; exports.decodeSubgroupStream = decodeSubgroupStream; exports.decodeDatagram = decodeDatagram; exports.decodeFetchStream = decodeFetchStream; exports.decodeDataStream = decodeDataStream; exports.createSubgroupStreamDecoder = createSubgroupStreamDecoder; exports.createFetchStreamDecoder = createFetchStreamDecoder; exports.createDataStreamDecoder = createDataStreamDecoder; exports.encodeMessage = encodeMessage; exports.decodeMessage = decodeMessage; exports.createStreamDecoder = createStreamDecoder; exports.createDraft14Codec = createDraft14Codec; exports.redactAuthTokens = redactAuthTokens;
|