@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(); } } 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/draft17/messages.ts
|
|
10
12
|
var MSG_REQUEST_UPDATE = 0x02n;
|
|
@@ -102,7 +104,7 @@ function encodeObjectProperties(props, w) {
|
|
|
102
104
|
}
|
|
103
105
|
}
|
|
104
106
|
function encodeSubgroupStream(stream) {
|
|
105
|
-
const w = new (0,
|
|
107
|
+
const w = new (0, _chunk5IMHJIAZcjs.Draft17BufferWriter)();
|
|
106
108
|
const streamType = stream.headerType;
|
|
107
109
|
w.writeVarInt(BigInt(streamType));
|
|
108
110
|
const propertiesPresent = (streamType & 1) !== 0;
|
|
@@ -122,7 +124,7 @@ function encodeSubgroupStream(stream) {
|
|
|
122
124
|
w.writeVarInt(delta);
|
|
123
125
|
if (propertiesPresent) {
|
|
124
126
|
if (obj.objectProperties && Object.keys(obj.objectProperties).length > 0) {
|
|
125
|
-
const tmpW = new (0,
|
|
127
|
+
const tmpW = new (0, _chunk5IMHJIAZcjs.Draft17BufferWriter)(32);
|
|
126
128
|
encodeObjectProperties(obj.objectProperties, tmpW);
|
|
127
129
|
const raw = tmpW.finish();
|
|
128
130
|
w.writeVarInt(BigInt(raw.byteLength));
|
|
@@ -142,7 +144,7 @@ function encodeSubgroupStream(stream) {
|
|
|
142
144
|
return w.finish();
|
|
143
145
|
}
|
|
144
146
|
function encodeDatagram(dg) {
|
|
145
|
-
const w = new (0,
|
|
147
|
+
const w = new (0, _chunk5IMHJIAZcjs.Draft17BufferWriter)();
|
|
146
148
|
const dgType = dg.datagramType;
|
|
147
149
|
w.writeVarInt(BigInt(dgType));
|
|
148
150
|
w.writeVarInt(dg.trackAlias);
|
|
@@ -159,7 +161,7 @@ function encodeDatagram(dg) {
|
|
|
159
161
|
}
|
|
160
162
|
if (propertiesPresent) {
|
|
161
163
|
if (dg.objectProperties && Object.keys(dg.objectProperties).length > 0) {
|
|
162
|
-
const tmpW = new (0,
|
|
164
|
+
const tmpW = new (0, _chunk5IMHJIAZcjs.Draft17BufferWriter)(32);
|
|
163
165
|
encodeObjectProperties(dg.objectProperties, tmpW);
|
|
164
166
|
const raw = tmpW.finish();
|
|
165
167
|
w.writeVarInt(BigInt(raw.byteLength));
|
|
@@ -176,7 +178,7 @@ function encodeDatagram(dg) {
|
|
|
176
178
|
return w.finish();
|
|
177
179
|
}
|
|
178
180
|
function encodeFetchStream(stream) {
|
|
179
|
-
const w = new (0,
|
|
181
|
+
const w = new (0, _chunk5IMHJIAZcjs.Draft17BufferWriter)();
|
|
180
182
|
w.writeVarInt(FETCH_STREAM_TYPE);
|
|
181
183
|
w.writeVarInt(stream.requestId);
|
|
182
184
|
for (const obj of stream.objects) {
|
|
@@ -192,7 +194,7 @@ function encodeFetchStream(stream) {
|
|
|
192
194
|
if (flags & 16) w.writeUint8(obj.publisherPriority);
|
|
193
195
|
if (flags & 32) {
|
|
194
196
|
if (obj.objectProperties && Object.keys(obj.objectProperties).length > 0) {
|
|
195
|
-
const tmpW = new (0,
|
|
197
|
+
const tmpW = new (0, _chunk5IMHJIAZcjs.Draft17BufferWriter)(32);
|
|
196
198
|
encodeObjectProperties(obj.objectProperties, tmpW);
|
|
197
199
|
const raw = tmpW.finish();
|
|
198
200
|
w.writeVarInt(BigInt(raw.byteLength));
|
|
@@ -213,7 +215,7 @@ function encodeFetchStream(stream) {
|
|
|
213
215
|
if (flags & 16) w.writeUint8(obj.publisherPriority);
|
|
214
216
|
if (flags & 32) {
|
|
215
217
|
if (obj.objectProperties && Object.keys(obj.objectProperties).length > 0) {
|
|
216
|
-
const tmpW = new (0,
|
|
218
|
+
const tmpW = new (0, _chunk5IMHJIAZcjs.Draft17BufferWriter)(32);
|
|
217
219
|
encodeObjectProperties(obj.objectProperties, tmpW);
|
|
218
220
|
const raw = tmpW.finish();
|
|
219
221
|
w.writeVarInt(BigInt(raw.byteLength));
|
|
@@ -230,109 +232,117 @@ function encodeFetchStream(stream) {
|
|
|
230
232
|
}
|
|
231
233
|
return w.finish();
|
|
232
234
|
}
|
|
235
|
+
function readSubgroupHeader(r) {
|
|
236
|
+
const streamType = Number(r.readVarInt());
|
|
237
|
+
if (!(streamType >= 16 && streamType <= 29 || streamType >= 48 && streamType <= 61) || (streamType & 6) === 6) {
|
|
238
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
239
|
+
"CONSTRAINT_VIOLATION",
|
|
240
|
+
`Expected subgroup stream type 0x10-0x15/0x18-0x1D/0x30-0x35/0x38-0x3D, got 0x${streamType.toString(16)}`,
|
|
241
|
+
0
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
const propertiesPresent = (streamType & 1) !== 0;
|
|
245
|
+
const hasSubgroupField = (streamType & 4) !== 0;
|
|
246
|
+
const subgroupIsFirstObjId = (streamType & 2) !== 0 && !hasSubgroupField;
|
|
247
|
+
const hasPriority = streamType < 48;
|
|
248
|
+
const endOfGroup = (streamType & 8) !== 0;
|
|
249
|
+
const trackAlias = r.readVarInt();
|
|
250
|
+
const groupId = r.readVarInt();
|
|
251
|
+
let subgroupId = 0n;
|
|
252
|
+
if (hasSubgroupField) {
|
|
253
|
+
subgroupId = r.readVarInt();
|
|
254
|
+
}
|
|
255
|
+
let publisherPriority = 128;
|
|
256
|
+
if (hasPriority) {
|
|
257
|
+
publisherPriority = r.readUint8();
|
|
258
|
+
}
|
|
259
|
+
return {
|
|
260
|
+
streamType,
|
|
261
|
+
propertiesPresent,
|
|
262
|
+
subgroupIsFirstObjId,
|
|
263
|
+
endOfGroup,
|
|
264
|
+
trackAlias,
|
|
265
|
+
groupId,
|
|
266
|
+
subgroupId,
|
|
267
|
+
publisherPriority
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
function readSubgroupObject(r, propertiesPresent, isFirst, prevObjectId, base) {
|
|
271
|
+
const byteOffset = base + r.offset;
|
|
272
|
+
const delta = r.readVarInt();
|
|
273
|
+
const objectId = isFirst ? delta : prevObjectId + 1n + delta;
|
|
274
|
+
const extensionData = new Uint8Array(0);
|
|
275
|
+
let objectProperties;
|
|
276
|
+
if (propertiesPresent) {
|
|
277
|
+
const propsLen = Number(r.readVarInt());
|
|
278
|
+
if (propsLen > 0) {
|
|
279
|
+
objectProperties = decodeObjectProperties(r, propsLen);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
const payloadLength = Number(r.readVarInt());
|
|
283
|
+
let payload;
|
|
284
|
+
let status;
|
|
285
|
+
let payloadByteOffset;
|
|
286
|
+
if (payloadLength === 0) {
|
|
287
|
+
status = r.readVarInt();
|
|
288
|
+
payloadByteOffset = base + r.offset;
|
|
289
|
+
payload = new Uint8Array(0);
|
|
290
|
+
} else {
|
|
291
|
+
payloadByteOffset = base + r.offset;
|
|
292
|
+
payload = r.readBytesView(payloadLength);
|
|
293
|
+
}
|
|
294
|
+
const obj = {
|
|
295
|
+
type: "object",
|
|
296
|
+
byteOffset,
|
|
297
|
+
payloadByteOffset,
|
|
298
|
+
objectId,
|
|
299
|
+
payloadLength,
|
|
300
|
+
payload,
|
|
301
|
+
extensionData
|
|
302
|
+
};
|
|
303
|
+
if (status !== void 0) obj.status = status;
|
|
304
|
+
if (objectProperties !== void 0)
|
|
305
|
+
obj.objectProperties = objectProperties;
|
|
306
|
+
return obj;
|
|
307
|
+
}
|
|
233
308
|
function decodeSubgroupStream(bytes) {
|
|
234
309
|
try {
|
|
235
|
-
const r = new (0,
|
|
236
|
-
const
|
|
237
|
-
if (!(streamType >= 16 && streamType <= 29 || streamType >= 48 && streamType <= 61) || (streamType & 6) === 6) {
|
|
238
|
-
return {
|
|
239
|
-
ok: false,
|
|
240
|
-
error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
241
|
-
"CONSTRAINT_VIOLATION",
|
|
242
|
-
`Expected subgroup stream type 0x10-0x15/0x18-0x1D/0x30-0x35/0x38-0x3D, got 0x${streamType.toString(16)}`,
|
|
243
|
-
0
|
|
244
|
-
)
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
const propertiesPresent = (streamType & 1) !== 0;
|
|
248
|
-
const hasSubgroupField = (streamType & 4) !== 0;
|
|
249
|
-
const subgroupIsFirstObjId = (streamType & 2) !== 0 && !hasSubgroupField;
|
|
250
|
-
const hasPriority = streamType < 48;
|
|
251
|
-
const endOfGroup = (streamType & 8) !== 0;
|
|
252
|
-
const trackAlias = r.readVarInt();
|
|
253
|
-
const groupId = r.readVarInt();
|
|
254
|
-
let subgroupId = 0n;
|
|
255
|
-
if (hasSubgroupField) {
|
|
256
|
-
subgroupId = r.readVarInt();
|
|
257
|
-
}
|
|
258
|
-
let publisherPriority = 128;
|
|
259
|
-
if (hasPriority) {
|
|
260
|
-
publisherPriority = r.readUint8();
|
|
261
|
-
}
|
|
310
|
+
const r = new (0, _chunk5IMHJIAZcjs.Draft17BufferReader)(bytes);
|
|
311
|
+
const h = readSubgroupHeader(r);
|
|
262
312
|
const objects = [];
|
|
263
313
|
let prevObjectId = -1n;
|
|
264
|
-
let
|
|
314
|
+
let isFirst = true;
|
|
315
|
+
let subgroupId = h.subgroupId;
|
|
265
316
|
while (r.remaining > 0) {
|
|
266
|
-
const
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
if (firstObject) {
|
|
270
|
-
objectId = delta;
|
|
271
|
-
if (subgroupIsFirstObjId && firstObject) {
|
|
272
|
-
subgroupId = objectId;
|
|
273
|
-
}
|
|
274
|
-
firstObject = false;
|
|
275
|
-
} else {
|
|
276
|
-
objectId = prevObjectId + 1n + delta;
|
|
277
|
-
}
|
|
278
|
-
const extensionData = new Uint8Array(0);
|
|
279
|
-
let objectProperties;
|
|
280
|
-
if (propertiesPresent) {
|
|
281
|
-
const propsLen = Number(r.readVarInt());
|
|
282
|
-
if (propsLen > 0) {
|
|
283
|
-
objectProperties = decodeObjectProperties(r, propsLen);
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
const payloadLength = Number(r.readVarInt());
|
|
287
|
-
let payload;
|
|
288
|
-
let status;
|
|
289
|
-
let payloadByteOffset;
|
|
290
|
-
if (payloadLength === 0) {
|
|
291
|
-
status = r.readVarInt();
|
|
292
|
-
payloadByteOffset = r.offset;
|
|
293
|
-
payload = new Uint8Array(0);
|
|
294
|
-
} else {
|
|
295
|
-
payloadByteOffset = r.offset;
|
|
296
|
-
payload = r.readBytesView(payloadLength);
|
|
297
|
-
}
|
|
298
|
-
const obj = {
|
|
299
|
-
type: "object",
|
|
300
|
-
byteOffset,
|
|
301
|
-
payloadByteOffset,
|
|
302
|
-
objectId,
|
|
303
|
-
payloadLength,
|
|
304
|
-
payload,
|
|
305
|
-
extensionData
|
|
306
|
-
};
|
|
307
|
-
if (status !== void 0) obj.status = status;
|
|
308
|
-
if (objectProperties !== void 0)
|
|
309
|
-
obj.objectProperties = objectProperties;
|
|
317
|
+
const obj = readSubgroupObject(r, h.propertiesPresent, isFirst, prevObjectId, 0);
|
|
318
|
+
if (isFirst && h.subgroupIsFirstObjId) subgroupId = obj.objectId;
|
|
319
|
+
isFirst = false;
|
|
310
320
|
objects.push(obj);
|
|
311
|
-
prevObjectId = objectId;
|
|
321
|
+
prevObjectId = obj.objectId;
|
|
312
322
|
}
|
|
313
323
|
const result = {
|
|
314
324
|
type: "subgroup",
|
|
315
|
-
headerType: streamType,
|
|
316
|
-
trackAlias,
|
|
317
|
-
groupId,
|
|
325
|
+
headerType: h.streamType,
|
|
326
|
+
trackAlias: h.trackAlias,
|
|
327
|
+
groupId: h.groupId,
|
|
318
328
|
subgroupId,
|
|
319
|
-
publisherPriority,
|
|
320
|
-
objects
|
|
329
|
+
publisherPriority: h.publisherPriority,
|
|
330
|
+
objects,
|
|
331
|
+
...h.endOfGroup ? { endOfGroup: true } : {}
|
|
321
332
|
};
|
|
322
|
-
if (endOfGroup) result.endOfGroup = true;
|
|
323
333
|
return {
|
|
324
334
|
ok: true,
|
|
325
335
|
value: result,
|
|
326
336
|
bytesRead: r.offset
|
|
327
337
|
};
|
|
328
338
|
} catch (e) {
|
|
329
|
-
if (e instanceof
|
|
339
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError) return { ok: false, error: e };
|
|
330
340
|
throw e;
|
|
331
341
|
}
|
|
332
342
|
}
|
|
333
343
|
function decodeDatagram(bytes) {
|
|
334
344
|
try {
|
|
335
|
-
const r = new (0,
|
|
345
|
+
const r = new (0, _chunk5IMHJIAZcjs.Draft17BufferReader)(bytes);
|
|
336
346
|
const dgType = Number(r.readVarInt());
|
|
337
347
|
const objectIdAbsent = (dgType & 4) !== 0;
|
|
338
348
|
const endOfGroup = (dgType & 2) !== 0;
|
|
@@ -382,18 +392,188 @@ function decodeDatagram(bytes) {
|
|
|
382
392
|
result.objectProperties = objectProperties;
|
|
383
393
|
return { ok: true, value: result, bytesRead: r.offset };
|
|
384
394
|
} catch (e) {
|
|
385
|
-
if (e instanceof
|
|
395
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError) return { ok: false, error: e };
|
|
386
396
|
throw e;
|
|
387
397
|
}
|
|
388
398
|
}
|
|
399
|
+
function newFetchObjectState() {
|
|
400
|
+
return { prevGroupId: 0n, prevSubgroupId: 0n, prevObjectId: 0n, prevPriority: 128, first: true };
|
|
401
|
+
}
|
|
402
|
+
function readFetchObject(r, base, st) {
|
|
403
|
+
const byteOffset = base + r.offset;
|
|
404
|
+
const flags = Number(r.readVarInt());
|
|
405
|
+
let groupId = st.prevGroupId;
|
|
406
|
+
let subgroupId = st.prevSubgroupId;
|
|
407
|
+
let objectId = st.prevObjectId + 1n;
|
|
408
|
+
let payloadLength;
|
|
409
|
+
let payload;
|
|
410
|
+
let payloadByteOffset;
|
|
411
|
+
const extensionData = new Uint8Array(0);
|
|
412
|
+
if (flags >= 128) {
|
|
413
|
+
if (flags !== 140 && flags !== 268) {
|
|
414
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
415
|
+
"CONSTRAINT_VIOLATION",
|
|
416
|
+
`Unknown serialization flags value: 0x${flags.toString(16)}`,
|
|
417
|
+
r.offset
|
|
418
|
+
);
|
|
419
|
+
}
|
|
420
|
+
groupId = r.readVarInt();
|
|
421
|
+
objectId = r.readVarInt();
|
|
422
|
+
payloadLength = Number(r.readVarInt());
|
|
423
|
+
payloadByteOffset = base + r.offset;
|
|
424
|
+
payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
|
|
425
|
+
} else if (flags & 64) {
|
|
426
|
+
const objectIdPresent = (flags & 4) !== 0;
|
|
427
|
+
const groupIdPresent = (flags & 8) !== 0;
|
|
428
|
+
const priorityPresent = (flags & 16) !== 0;
|
|
429
|
+
const propsPresent = (flags & 32) !== 0;
|
|
430
|
+
if (groupIdPresent) {
|
|
431
|
+
groupId = r.readVarInt();
|
|
432
|
+
}
|
|
433
|
+
if (objectIdPresent) {
|
|
434
|
+
objectId = r.readVarInt();
|
|
435
|
+
}
|
|
436
|
+
if (priorityPresent) {
|
|
437
|
+
st.prevPriority = r.readUint8();
|
|
438
|
+
}
|
|
439
|
+
let objectProperties;
|
|
440
|
+
if (propsPresent) {
|
|
441
|
+
const propsLen = Number(r.readVarInt());
|
|
442
|
+
if (propsLen > 0) {
|
|
443
|
+
objectProperties = decodeObjectProperties(r, propsLen);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
payloadLength = Number(r.readVarInt());
|
|
447
|
+
payloadByteOffset = base + r.offset;
|
|
448
|
+
payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
|
|
449
|
+
const obj2 = {
|
|
450
|
+
type: "object",
|
|
451
|
+
byteOffset,
|
|
452
|
+
payloadByteOffset,
|
|
453
|
+
serializationFlags: flags,
|
|
454
|
+
groupId,
|
|
455
|
+
subgroupId: 0n,
|
|
456
|
+
objectId,
|
|
457
|
+
publisherPriority: st.prevPriority,
|
|
458
|
+
payloadLength,
|
|
459
|
+
payload,
|
|
460
|
+
extensionData
|
|
461
|
+
};
|
|
462
|
+
if (objectProperties)
|
|
463
|
+
obj2.objectProperties = objectProperties;
|
|
464
|
+
st.prevGroupId = groupId;
|
|
465
|
+
st.prevObjectId = objectId;
|
|
466
|
+
st.first = false;
|
|
467
|
+
return obj2;
|
|
468
|
+
} else {
|
|
469
|
+
const subgroupEncoding = flags & 3;
|
|
470
|
+
const objectIdPresent = (flags & 4) !== 0;
|
|
471
|
+
const groupIdPresent = (flags & 8) !== 0;
|
|
472
|
+
const priorityPresent = (flags & 16) !== 0;
|
|
473
|
+
const propsPresent = (flags & 32) !== 0;
|
|
474
|
+
if (groupIdPresent) {
|
|
475
|
+
groupId = r.readVarInt();
|
|
476
|
+
} else if (st.first) {
|
|
477
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
478
|
+
"CONSTRAINT_VIOLATION",
|
|
479
|
+
"First fetch object must include groupId",
|
|
480
|
+
r.offset
|
|
481
|
+
);
|
|
482
|
+
}
|
|
483
|
+
if (subgroupEncoding === 0) {
|
|
484
|
+
subgroupId = 0n;
|
|
485
|
+
} else if (subgroupEncoding === 1) {
|
|
486
|
+
if (st.first) {
|
|
487
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
488
|
+
"CONSTRAINT_VIOLATION",
|
|
489
|
+
"First fetch object cannot reference prior subgroupId",
|
|
490
|
+
r.offset
|
|
491
|
+
);
|
|
492
|
+
}
|
|
493
|
+
subgroupId = st.prevSubgroupId;
|
|
494
|
+
} else if (subgroupEncoding === 2) {
|
|
495
|
+
if (st.first) {
|
|
496
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
497
|
+
"CONSTRAINT_VIOLATION",
|
|
498
|
+
"First fetch object cannot reference prior subgroupId",
|
|
499
|
+
r.offset
|
|
500
|
+
);
|
|
501
|
+
}
|
|
502
|
+
subgroupId = st.prevSubgroupId + 1n;
|
|
503
|
+
} else if (subgroupEncoding === 3) {
|
|
504
|
+
subgroupId = r.readVarInt();
|
|
505
|
+
}
|
|
506
|
+
if (objectIdPresent) {
|
|
507
|
+
objectId = r.readVarInt();
|
|
508
|
+
} else if (st.first) {
|
|
509
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
510
|
+
"CONSTRAINT_VIOLATION",
|
|
511
|
+
"First fetch object must include objectId",
|
|
512
|
+
r.offset
|
|
513
|
+
);
|
|
514
|
+
}
|
|
515
|
+
if (priorityPresent) {
|
|
516
|
+
st.prevPriority = r.readUint8();
|
|
517
|
+
}
|
|
518
|
+
let objectProperties;
|
|
519
|
+
if (propsPresent) {
|
|
520
|
+
const propsLen = Number(r.readVarInt());
|
|
521
|
+
if (propsLen > 0) {
|
|
522
|
+
objectProperties = decodeObjectProperties(r, propsLen);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
payloadLength = Number(r.readVarInt());
|
|
526
|
+
payloadByteOffset = base + r.offset;
|
|
527
|
+
payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
|
|
528
|
+
if (objectProperties) {
|
|
529
|
+
const obj2 = {
|
|
530
|
+
type: "object",
|
|
531
|
+
byteOffset,
|
|
532
|
+
payloadByteOffset,
|
|
533
|
+
serializationFlags: flags,
|
|
534
|
+
groupId,
|
|
535
|
+
subgroupId,
|
|
536
|
+
objectId,
|
|
537
|
+
publisherPriority: st.prevPriority,
|
|
538
|
+
payloadLength,
|
|
539
|
+
payload,
|
|
540
|
+
extensionData
|
|
541
|
+
};
|
|
542
|
+
obj2.objectProperties = objectProperties;
|
|
543
|
+
st.prevGroupId = groupId;
|
|
544
|
+
st.prevSubgroupId = subgroupId;
|
|
545
|
+
st.prevObjectId = objectId;
|
|
546
|
+
st.first = false;
|
|
547
|
+
return obj2;
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
const obj = {
|
|
551
|
+
type: "object",
|
|
552
|
+
byteOffset,
|
|
553
|
+
payloadByteOffset,
|
|
554
|
+
serializationFlags: flags,
|
|
555
|
+
groupId,
|
|
556
|
+
subgroupId,
|
|
557
|
+
objectId,
|
|
558
|
+
publisherPriority: st.prevPriority,
|
|
559
|
+
payloadLength,
|
|
560
|
+
payload,
|
|
561
|
+
extensionData
|
|
562
|
+
};
|
|
563
|
+
st.prevGroupId = groupId;
|
|
564
|
+
st.prevSubgroupId = subgroupId;
|
|
565
|
+
st.prevObjectId = objectId;
|
|
566
|
+
st.first = false;
|
|
567
|
+
return obj;
|
|
568
|
+
}
|
|
389
569
|
function decodeFetchStream(bytes) {
|
|
390
570
|
try {
|
|
391
|
-
const r = new (0,
|
|
571
|
+
const r = new (0, _chunk5IMHJIAZcjs.Draft17BufferReader)(bytes);
|
|
392
572
|
const streamType = r.readVarInt();
|
|
393
573
|
if (streamType !== FETCH_STREAM_TYPE) {
|
|
394
574
|
return {
|
|
395
575
|
ok: false,
|
|
396
|
-
error: new (0,
|
|
576
|
+
error: new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
397
577
|
"CONSTRAINT_VIOLATION",
|
|
398
578
|
`Expected fetch stream type 0x05, got 0x${streamType.toString(16)}`,
|
|
399
579
|
0
|
|
@@ -402,194 +582,9 @@ function decodeFetchStream(bytes) {
|
|
|
402
582
|
}
|
|
403
583
|
const requestId = r.readVarInt();
|
|
404
584
|
const objects = [];
|
|
405
|
-
|
|
406
|
-
let prevSubgroupId = 0n;
|
|
407
|
-
let prevObjectId = 0n;
|
|
408
|
-
let prevPriority = 128;
|
|
409
|
-
let first = true;
|
|
585
|
+
const st = newFetchObjectState();
|
|
410
586
|
while (r.remaining > 0) {
|
|
411
|
-
|
|
412
|
-
const flags = Number(r.readVarInt());
|
|
413
|
-
let groupId = prevGroupId;
|
|
414
|
-
let subgroupId = prevSubgroupId;
|
|
415
|
-
let objectId = prevObjectId + 1n;
|
|
416
|
-
let payloadLength;
|
|
417
|
-
let payload;
|
|
418
|
-
let payloadByteOffset;
|
|
419
|
-
const extensionData = new Uint8Array(0);
|
|
420
|
-
if (flags >= 128) {
|
|
421
|
-
if (flags !== 140 && flags !== 268) {
|
|
422
|
-
return {
|
|
423
|
-
ok: false,
|
|
424
|
-
error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
425
|
-
"CONSTRAINT_VIOLATION",
|
|
426
|
-
`Unknown serialization flags value: 0x${flags.toString(16)}`,
|
|
427
|
-
r.offset
|
|
428
|
-
)
|
|
429
|
-
};
|
|
430
|
-
}
|
|
431
|
-
groupId = r.readVarInt();
|
|
432
|
-
objectId = r.readVarInt();
|
|
433
|
-
payloadLength = Number(r.readVarInt());
|
|
434
|
-
payloadByteOffset = r.offset;
|
|
435
|
-
payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
|
|
436
|
-
} else if (flags & 64) {
|
|
437
|
-
const objectIdPresent = (flags & 4) !== 0;
|
|
438
|
-
const groupIdPresent = (flags & 8) !== 0;
|
|
439
|
-
const priorityPresent = (flags & 16) !== 0;
|
|
440
|
-
const propsPresent = (flags & 32) !== 0;
|
|
441
|
-
if (groupIdPresent) {
|
|
442
|
-
groupId = r.readVarInt();
|
|
443
|
-
}
|
|
444
|
-
if (objectIdPresent) {
|
|
445
|
-
objectId = r.readVarInt();
|
|
446
|
-
}
|
|
447
|
-
if (priorityPresent) {
|
|
448
|
-
prevPriority = r.readUint8();
|
|
449
|
-
}
|
|
450
|
-
let objectProperties;
|
|
451
|
-
if (propsPresent) {
|
|
452
|
-
const propsLen = Number(r.readVarInt());
|
|
453
|
-
if (propsLen > 0) {
|
|
454
|
-
objectProperties = decodeObjectProperties(r, propsLen);
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
payloadLength = Number(r.readVarInt());
|
|
458
|
-
payloadByteOffset = r.offset;
|
|
459
|
-
payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
|
|
460
|
-
const obj2 = {
|
|
461
|
-
type: "object",
|
|
462
|
-
byteOffset,
|
|
463
|
-
payloadByteOffset,
|
|
464
|
-
serializationFlags: flags,
|
|
465
|
-
groupId,
|
|
466
|
-
subgroupId: 0n,
|
|
467
|
-
objectId,
|
|
468
|
-
publisherPriority: prevPriority,
|
|
469
|
-
payloadLength,
|
|
470
|
-
payload,
|
|
471
|
-
extensionData
|
|
472
|
-
};
|
|
473
|
-
if (objectProperties)
|
|
474
|
-
obj2.objectProperties = objectProperties;
|
|
475
|
-
objects.push(obj2);
|
|
476
|
-
prevGroupId = groupId;
|
|
477
|
-
prevObjectId = objectId;
|
|
478
|
-
first = false;
|
|
479
|
-
continue;
|
|
480
|
-
} else {
|
|
481
|
-
const subgroupEncoding = flags & 3;
|
|
482
|
-
const objectIdPresent = (flags & 4) !== 0;
|
|
483
|
-
const groupIdPresent = (flags & 8) !== 0;
|
|
484
|
-
const priorityPresent = (flags & 16) !== 0;
|
|
485
|
-
const propsPresent = (flags & 32) !== 0;
|
|
486
|
-
if (groupIdPresent) {
|
|
487
|
-
groupId = r.readVarInt();
|
|
488
|
-
} else if (first) {
|
|
489
|
-
return {
|
|
490
|
-
ok: false,
|
|
491
|
-
error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
492
|
-
"CONSTRAINT_VIOLATION",
|
|
493
|
-
"First fetch object must include groupId",
|
|
494
|
-
r.offset
|
|
495
|
-
)
|
|
496
|
-
};
|
|
497
|
-
}
|
|
498
|
-
if (subgroupEncoding === 0) {
|
|
499
|
-
subgroupId = 0n;
|
|
500
|
-
} else if (subgroupEncoding === 1) {
|
|
501
|
-
if (first) {
|
|
502
|
-
return {
|
|
503
|
-
ok: false,
|
|
504
|
-
error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
505
|
-
"CONSTRAINT_VIOLATION",
|
|
506
|
-
"First fetch object cannot reference prior subgroupId",
|
|
507
|
-
r.offset
|
|
508
|
-
)
|
|
509
|
-
};
|
|
510
|
-
}
|
|
511
|
-
subgroupId = prevSubgroupId;
|
|
512
|
-
} else if (subgroupEncoding === 2) {
|
|
513
|
-
if (first) {
|
|
514
|
-
return {
|
|
515
|
-
ok: false,
|
|
516
|
-
error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
517
|
-
"CONSTRAINT_VIOLATION",
|
|
518
|
-
"First fetch object cannot reference prior subgroupId",
|
|
519
|
-
r.offset
|
|
520
|
-
)
|
|
521
|
-
};
|
|
522
|
-
}
|
|
523
|
-
subgroupId = prevSubgroupId + 1n;
|
|
524
|
-
} else if (subgroupEncoding === 3) {
|
|
525
|
-
subgroupId = r.readVarInt();
|
|
526
|
-
}
|
|
527
|
-
if (objectIdPresent) {
|
|
528
|
-
objectId = r.readVarInt();
|
|
529
|
-
} else if (first) {
|
|
530
|
-
return {
|
|
531
|
-
ok: false,
|
|
532
|
-
error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
533
|
-
"CONSTRAINT_VIOLATION",
|
|
534
|
-
"First fetch object must include objectId",
|
|
535
|
-
r.offset
|
|
536
|
-
)
|
|
537
|
-
};
|
|
538
|
-
}
|
|
539
|
-
if (priorityPresent) {
|
|
540
|
-
prevPriority = r.readUint8();
|
|
541
|
-
}
|
|
542
|
-
let objectProperties;
|
|
543
|
-
if (propsPresent) {
|
|
544
|
-
const propsLen = Number(r.readVarInt());
|
|
545
|
-
if (propsLen > 0) {
|
|
546
|
-
objectProperties = decodeObjectProperties(r, propsLen);
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
payloadLength = Number(r.readVarInt());
|
|
550
|
-
payloadByteOffset = r.offset;
|
|
551
|
-
payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
|
|
552
|
-
if (objectProperties) {
|
|
553
|
-
const obj2 = {
|
|
554
|
-
type: "object",
|
|
555
|
-
byteOffset,
|
|
556
|
-
payloadByteOffset,
|
|
557
|
-
serializationFlags: flags,
|
|
558
|
-
groupId,
|
|
559
|
-
subgroupId,
|
|
560
|
-
objectId,
|
|
561
|
-
publisherPriority: prevPriority,
|
|
562
|
-
payloadLength,
|
|
563
|
-
payload,
|
|
564
|
-
extensionData
|
|
565
|
-
};
|
|
566
|
-
obj2.objectProperties = objectProperties;
|
|
567
|
-
objects.push(obj2);
|
|
568
|
-
prevGroupId = groupId;
|
|
569
|
-
prevSubgroupId = subgroupId;
|
|
570
|
-
prevObjectId = objectId;
|
|
571
|
-
first = false;
|
|
572
|
-
continue;
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
const obj = {
|
|
576
|
-
type: "object",
|
|
577
|
-
byteOffset,
|
|
578
|
-
payloadByteOffset,
|
|
579
|
-
serializationFlags: flags,
|
|
580
|
-
groupId,
|
|
581
|
-
subgroupId,
|
|
582
|
-
objectId,
|
|
583
|
-
publisherPriority: prevPriority,
|
|
584
|
-
payloadLength,
|
|
585
|
-
payload,
|
|
586
|
-
extensionData
|
|
587
|
-
};
|
|
588
|
-
objects.push(obj);
|
|
589
|
-
prevGroupId = groupId;
|
|
590
|
-
prevSubgroupId = subgroupId;
|
|
591
|
-
prevObjectId = objectId;
|
|
592
|
-
first = false;
|
|
587
|
+
objects.push(readFetchObject(r, 0, st));
|
|
593
588
|
}
|
|
594
589
|
return {
|
|
595
590
|
ok: true,
|
|
@@ -597,7 +592,7 @@ function decodeFetchStream(bytes) {
|
|
|
597
592
|
bytesRead: r.offset
|
|
598
593
|
};
|
|
599
594
|
} catch (e) {
|
|
600
|
-
if (e instanceof
|
|
595
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError) return { ok: false, error: e };
|
|
601
596
|
throw e;
|
|
602
597
|
}
|
|
603
598
|
}
|
|
@@ -615,136 +610,124 @@ function decodeDataStream(streamType, bytes) {
|
|
|
615
610
|
}
|
|
616
611
|
}
|
|
617
612
|
}
|
|
613
|
+
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); }
|
|
614
|
+
__init() {this.buf = new Uint8Array(0)}
|
|
615
|
+
/** Bytes written into `buf`. */
|
|
616
|
+
__init2() {this.len = 0}
|
|
617
|
+
/** Consumed prefix of `buf`; `base + offset` is the position in the stream. */
|
|
618
|
+
__init3() {this.offset = 0}
|
|
619
|
+
/** Absolute position of `buf[0]` within the stream. */
|
|
620
|
+
__init4() {this.base = 0}
|
|
621
|
+
get unread() {
|
|
622
|
+
return this.len - this.offset;
|
|
623
|
+
}
|
|
624
|
+
append(chunk) {
|
|
625
|
+
if (this.len + chunk.length > this.buf.length) {
|
|
626
|
+
const live = this.len - this.offset;
|
|
627
|
+
const needed = live + chunk.length;
|
|
628
|
+
let cap = Math.max(4096, this.buf.length);
|
|
629
|
+
while (cap < needed * 2) cap *= 2;
|
|
630
|
+
const next = new Uint8Array(cap);
|
|
631
|
+
next.set(this.buf.subarray(this.offset, this.len), 0);
|
|
632
|
+
this.buf = next;
|
|
633
|
+
this.base += this.offset;
|
|
634
|
+
this.len = live;
|
|
635
|
+
this.offset = 0;
|
|
636
|
+
}
|
|
637
|
+
this.buf.set(chunk, this.len);
|
|
638
|
+
this.len += chunk.length;
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* The written bytes, for a reader positioned at `offset`. Bounded by `len`
|
|
642
|
+
* rather than by capacity, so `BufferReader.remaining` counts real bytes and
|
|
643
|
+
* not the spare room after them.
|
|
644
|
+
*/
|
|
645
|
+
written() {
|
|
646
|
+
return this.buf.subarray(0, this.len);
|
|
647
|
+
}
|
|
648
|
+
}, _class);
|
|
618
649
|
function createSubgroupStreamDecoder() {
|
|
619
|
-
|
|
620
|
-
let
|
|
650
|
+
const b = new StreamBuffer();
|
|
651
|
+
let header = null;
|
|
621
652
|
let headerEmitted = false;
|
|
622
653
|
let prevObjectId = -1n;
|
|
623
|
-
let
|
|
624
|
-
|
|
625
|
-
|
|
654
|
+
let isFirst = true;
|
|
655
|
+
function emitHeader(controller, h, subgroupId) {
|
|
656
|
+
controller.enqueue({
|
|
657
|
+
type: "subgroup_header",
|
|
658
|
+
headerType: h.streamType,
|
|
659
|
+
trackAlias: h.trackAlias,
|
|
660
|
+
groupId: h.groupId,
|
|
661
|
+
subgroupId,
|
|
662
|
+
publisherPriority: h.publisherPriority,
|
|
663
|
+
...h.endOfGroup ? { endOfGroup: true } : {}
|
|
664
|
+
});
|
|
665
|
+
headerEmitted = true;
|
|
666
|
+
}
|
|
626
667
|
return new TransformStream({
|
|
627
668
|
transform(chunk, controller) {
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
}
|
|
632
|
-
const newBuffer = new Uint8Array(buffer.length + chunk.length);
|
|
633
|
-
newBuffer.set(buffer, 0);
|
|
634
|
-
newBuffer.set(chunk, buffer.length);
|
|
635
|
-
buffer = newBuffer;
|
|
636
|
-
if (!headerEmitted) {
|
|
669
|
+
b.append(chunk);
|
|
670
|
+
const view = b.written();
|
|
671
|
+
if (header === null) {
|
|
637
672
|
try {
|
|
638
|
-
const
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
controller.error(
|
|
642
|
-
new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
643
|
-
"CONSTRAINT_VIOLATION",
|
|
644
|
-
`Expected subgroup stream type, got 0x${streamType.toString(16)}`,
|
|
645
|
-
0
|
|
646
|
-
)
|
|
647
|
-
);
|
|
648
|
-
return;
|
|
649
|
-
}
|
|
650
|
-
_extensionsPresent = (streamType & 1) !== 0;
|
|
651
|
-
const hasSubgroupField = (streamType & 4) !== 0;
|
|
652
|
-
_subgroupIsFirstObjId = (streamType & 2) !== 0 && !hasSubgroupField;
|
|
653
|
-
const hasPriority = streamType < 48;
|
|
654
|
-
const trackAlias = r.readVarInt();
|
|
655
|
-
const groupId = r.readVarInt();
|
|
656
|
-
let subgroupId = 0n;
|
|
657
|
-
if (hasSubgroupField) {
|
|
658
|
-
subgroupId = r.readVarInt();
|
|
659
|
-
}
|
|
660
|
-
let publisherPriority = 128;
|
|
661
|
-
if (hasPriority) {
|
|
662
|
-
publisherPriority = r.readUint8();
|
|
663
|
-
}
|
|
664
|
-
controller.enqueue({
|
|
665
|
-
type: "subgroup_header",
|
|
666
|
-
trackAlias,
|
|
667
|
-
groupId,
|
|
668
|
-
subgroupId,
|
|
669
|
-
publisherPriority
|
|
670
|
-
});
|
|
671
|
-
headerEmitted = true;
|
|
672
|
-
offset += r.offset;
|
|
673
|
+
const hr = new (0, _chunk5IMHJIAZcjs.Draft17BufferReader)(view, b.offset);
|
|
674
|
+
header = readSubgroupHeader(hr);
|
|
675
|
+
b.offset = hr.offset;
|
|
673
676
|
} catch (e) {
|
|
674
|
-
if (e instanceof
|
|
677
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError && e.code === "UNEXPECTED_END") {
|
|
675
678
|
return;
|
|
676
679
|
}
|
|
677
680
|
controller.error(e);
|
|
678
681
|
return;
|
|
679
682
|
}
|
|
683
|
+
if (!header.subgroupIsFirstObjId) emitHeader(controller, header, header.subgroupId);
|
|
680
684
|
}
|
|
681
|
-
|
|
685
|
+
const h = header;
|
|
686
|
+
if (h === null) return;
|
|
687
|
+
const r = new (0, _chunk5IMHJIAZcjs.Draft17BufferReader)(view, b.offset);
|
|
688
|
+
while (r.remaining > 0) {
|
|
689
|
+
const start = r.offset;
|
|
690
|
+
let obj;
|
|
682
691
|
try {
|
|
683
|
-
|
|
684
|
-
const delta = r.readVarInt();
|
|
685
|
-
let objectId;
|
|
686
|
-
if (firstObject) {
|
|
687
|
-
objectId = delta;
|
|
688
|
-
firstObject = false;
|
|
689
|
-
} else {
|
|
690
|
-
objectId = prevObjectId + 1n + delta;
|
|
691
|
-
}
|
|
692
|
-
let extensionData = new Uint8Array(0);
|
|
693
|
-
if (_extensionsPresent) {
|
|
694
|
-
const extLen = Number(r.readVarInt());
|
|
695
|
-
extensionData = extLen > 0 ? r.readBytesView(extLen) : new Uint8Array(0);
|
|
696
|
-
}
|
|
697
|
-
const payloadLength = Number(r.readVarInt());
|
|
698
|
-
const payloadByteOffset = r.offset;
|
|
699
|
-
const payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
|
|
700
|
-
controller.enqueue({
|
|
701
|
-
type: "object",
|
|
702
|
-
objectId,
|
|
703
|
-
payloadLength,
|
|
704
|
-
payload,
|
|
705
|
-
extensionData,
|
|
706
|
-
byteOffset: 0,
|
|
707
|
-
payloadByteOffset
|
|
708
|
-
});
|
|
709
|
-
offset += r.offset;
|
|
710
|
-
prevObjectId = objectId;
|
|
692
|
+
obj = readSubgroupObject(r, h.propertiesPresent, isFirst, prevObjectId, b.base);
|
|
711
693
|
} catch (e) {
|
|
712
|
-
if (e instanceof
|
|
713
|
-
|
|
694
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError && e.code === "UNEXPECTED_END") {
|
|
695
|
+
b.offset = start;
|
|
696
|
+
return;
|
|
714
697
|
}
|
|
715
698
|
controller.error(e);
|
|
716
699
|
return;
|
|
717
700
|
}
|
|
701
|
+
if (!headerEmitted) emitHeader(controller, h, obj.objectId);
|
|
702
|
+
isFirst = false;
|
|
703
|
+
b.offset = r.offset;
|
|
704
|
+
prevObjectId = obj.objectId;
|
|
705
|
+
controller.enqueue(obj);
|
|
718
706
|
}
|
|
719
707
|
},
|
|
720
708
|
flush(controller) {
|
|
721
|
-
if (
|
|
722
|
-
|
|
709
|
+
if (header !== null && !headerEmitted) emitHeader(controller, header, 0n);
|
|
710
|
+
if (b.unread > 0) {
|
|
711
|
+
controller.error(new (0, _chunk5IMHJIAZcjs.DecodeError)("UNEXPECTED_END", "Stream ended with incomplete data", 0));
|
|
723
712
|
}
|
|
724
713
|
}
|
|
725
714
|
});
|
|
726
715
|
}
|
|
727
716
|
function createFetchStreamDecoder() {
|
|
728
|
-
|
|
729
|
-
let offset = 0;
|
|
717
|
+
const b = new StreamBuffer();
|
|
730
718
|
let headerEmitted = false;
|
|
719
|
+
const st = newFetchObjectState();
|
|
731
720
|
return new TransformStream({
|
|
732
721
|
transform(chunk, controller) {
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
offset = 0;
|
|
736
|
-
}
|
|
737
|
-
const newBuffer = new Uint8Array(buffer.length + chunk.length);
|
|
738
|
-
newBuffer.set(buffer, 0);
|
|
739
|
-
newBuffer.set(chunk, buffer.length);
|
|
740
|
-
buffer = newBuffer;
|
|
722
|
+
b.append(chunk);
|
|
723
|
+
const view = b.written();
|
|
741
724
|
if (!headerEmitted) {
|
|
742
725
|
try {
|
|
743
|
-
const
|
|
744
|
-
const streamType =
|
|
726
|
+
const r2 = new (0, _chunk5IMHJIAZcjs.Draft17BufferReader)(view, b.offset);
|
|
727
|
+
const streamType = r2.readVarInt();
|
|
745
728
|
if (streamType !== FETCH_STREAM_TYPE) {
|
|
746
729
|
controller.error(
|
|
747
|
-
new (0,
|
|
730
|
+
new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
748
731
|
"CONSTRAINT_VIOLATION",
|
|
749
732
|
`Expected fetch stream type 0x05, got 0x${streamType.toString(16)}`,
|
|
750
733
|
0
|
|
@@ -752,113 +735,96 @@ function createFetchStreamDecoder() {
|
|
|
752
735
|
);
|
|
753
736
|
return;
|
|
754
737
|
}
|
|
755
|
-
const requestId =
|
|
738
|
+
const requestId = r2.readVarInt();
|
|
756
739
|
controller.enqueue({ type: "fetch_header", requestId });
|
|
757
740
|
headerEmitted = true;
|
|
758
|
-
offset
|
|
741
|
+
b.offset = r2.offset;
|
|
759
742
|
} catch (e) {
|
|
760
|
-
if (e instanceof
|
|
743
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError && e.code === "UNEXPECTED_END") {
|
|
761
744
|
return;
|
|
762
745
|
}
|
|
763
746
|
controller.error(e);
|
|
764
747
|
return;
|
|
765
748
|
}
|
|
766
749
|
}
|
|
767
|
-
|
|
750
|
+
const r = new (0, _chunk5IMHJIAZcjs.Draft17BufferReader)(view, b.offset);
|
|
751
|
+
while (r.remaining > 0) {
|
|
752
|
+
const start = r.offset;
|
|
753
|
+
let obj;
|
|
768
754
|
try {
|
|
769
|
-
|
|
770
|
-
const flags = Number(r.readVarInt());
|
|
771
|
-
const objectIdPresent = (flags & 4) !== 0;
|
|
772
|
-
const groupIdPresent = (flags & 8) !== 0;
|
|
773
|
-
const priorityPresent = (flags & 16) !== 0;
|
|
774
|
-
const extensionsPresent = (flags & 32) !== 0;
|
|
775
|
-
const subgroupEncoding = flags & 3;
|
|
776
|
-
if (groupIdPresent) r.readVarInt();
|
|
777
|
-
if (subgroupEncoding === 3) r.readVarInt();
|
|
778
|
-
let objectId = 0n;
|
|
779
|
-
if (objectIdPresent) objectId = r.readVarInt();
|
|
780
|
-
if (priorityPresent) r.readUint8();
|
|
781
|
-
let extensionData = new Uint8Array(0);
|
|
782
|
-
if (extensionsPresent) {
|
|
783
|
-
const extLen = Number(r.readVarInt());
|
|
784
|
-
extensionData = extLen > 0 ? r.readBytesView(extLen) : new Uint8Array(0);
|
|
785
|
-
}
|
|
786
|
-
const payloadLength = Number(r.readVarInt());
|
|
787
|
-
const payloadByteOffset = r.offset;
|
|
788
|
-
const payload = payloadLength > 0 ? r.readBytesView(payloadLength) : new Uint8Array(0);
|
|
789
|
-
controller.enqueue({
|
|
790
|
-
type: "object",
|
|
791
|
-
objectId,
|
|
792
|
-
payloadLength,
|
|
793
|
-
payload,
|
|
794
|
-
extensionData,
|
|
795
|
-
byteOffset: 0,
|
|
796
|
-
payloadByteOffset
|
|
797
|
-
});
|
|
798
|
-
offset += r.offset;
|
|
755
|
+
obj = readFetchObject(r, b.base, st);
|
|
799
756
|
} catch (e) {
|
|
800
|
-
if (e instanceof
|
|
801
|
-
|
|
757
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError && e.code === "UNEXPECTED_END") {
|
|
758
|
+
b.offset = start;
|
|
759
|
+
return;
|
|
802
760
|
}
|
|
803
761
|
controller.error(e);
|
|
804
762
|
return;
|
|
805
763
|
}
|
|
764
|
+
b.offset = r.offset;
|
|
765
|
+
controller.enqueue(obj);
|
|
806
766
|
}
|
|
807
767
|
},
|
|
808
768
|
flush(controller) {
|
|
809
|
-
if (
|
|
810
|
-
controller.error(new (0,
|
|
769
|
+
if (b.unread > 0) {
|
|
770
|
+
controller.error(new (0, _chunk5IMHJIAZcjs.DecodeError)("UNEXPECTED_END", "Stream ended with incomplete data", 0));
|
|
811
771
|
}
|
|
812
772
|
}
|
|
813
773
|
});
|
|
814
774
|
}
|
|
815
775
|
function createDataStreamDecoder() {
|
|
816
|
-
let
|
|
817
|
-
let
|
|
818
|
-
let
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
if (
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
const decoder = createSubgroupStreamDecoder();
|
|
834
|
-
inner = decoder;
|
|
835
|
-
} else if (firstByte === 5) {
|
|
836
|
-
const decoder = createFetchStreamDecoder();
|
|
837
|
-
inner = decoder;
|
|
838
|
-
} else {
|
|
839
|
-
controller.error(
|
|
840
|
-
new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
841
|
-
"CONSTRAINT_VIOLATION",
|
|
842
|
-
`Unknown data stream type: 0x${firstByte.toString(16)}`,
|
|
843
|
-
0
|
|
844
|
-
)
|
|
845
|
-
);
|
|
846
|
-
return;
|
|
776
|
+
let writer = null;
|
|
777
|
+
let pump = Promise.resolve();
|
|
778
|
+
let broken = false;
|
|
779
|
+
function attach(inner, controller) {
|
|
780
|
+
writer = inner.writable.getWriter();
|
|
781
|
+
const reader = inner.readable.getReader();
|
|
782
|
+
pump = (async () => {
|
|
783
|
+
try {
|
|
784
|
+
for (; ; ) {
|
|
785
|
+
const { done, value } = await reader.read();
|
|
786
|
+
if (done) break;
|
|
787
|
+
controller.enqueue(value);
|
|
788
|
+
}
|
|
789
|
+
} catch (e) {
|
|
790
|
+
if (!broken) {
|
|
791
|
+
broken = true;
|
|
792
|
+
controller.error(e);
|
|
847
793
|
}
|
|
848
794
|
}
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
795
|
+
})();
|
|
796
|
+
}
|
|
797
|
+
async function feed(bytes) {
|
|
798
|
+
if (writer === null || broken || bytes.length === 0) return;
|
|
799
|
+
try {
|
|
800
|
+
await writer.write(bytes);
|
|
801
|
+
} catch (e2) {
|
|
802
|
+
broken = true;
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
return new TransformStream({
|
|
806
|
+
async transform(chunk, controller) {
|
|
807
|
+
if (broken) return;
|
|
808
|
+
if (writer !== null) {
|
|
809
|
+
await feed(chunk);
|
|
810
|
+
return;
|
|
811
|
+
}
|
|
812
|
+
if (chunk.length === 0) return;
|
|
813
|
+
const firstByte = chunk[0];
|
|
855
814
|
if (firstByte >= 16 && firstByte <= 29 || firstByte >= 48 && firstByte <= 61) {
|
|
856
|
-
|
|
815
|
+
attach(
|
|
816
|
+
createSubgroupStreamDecoder(),
|
|
817
|
+
controller
|
|
818
|
+
);
|
|
857
819
|
} else if (firstByte === 5) {
|
|
858
|
-
|
|
820
|
+
attach(
|
|
821
|
+
createFetchStreamDecoder(),
|
|
822
|
+
controller
|
|
823
|
+
);
|
|
859
824
|
} else {
|
|
825
|
+
broken = true;
|
|
860
826
|
controller.error(
|
|
861
|
-
new (0,
|
|
827
|
+
new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
862
828
|
"CONSTRAINT_VIOLATION",
|
|
863
829
|
`Unknown data stream type: 0x${firstByte.toString(16)}`,
|
|
864
830
|
0
|
|
@@ -866,31 +832,15 @@ function createDataStreamDecoder() {
|
|
|
866
832
|
);
|
|
867
833
|
return;
|
|
868
834
|
}
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
type: "subgroup_header",
|
|
877
|
-
trackAlias: stream.trackAlias,
|
|
878
|
-
groupId: stream.groupId,
|
|
879
|
-
subgroupId: stream.subgroupId,
|
|
880
|
-
publisherPriority: stream.publisherPriority
|
|
881
|
-
});
|
|
882
|
-
for (const obj of stream.objects) {
|
|
883
|
-
controller.enqueue(obj);
|
|
884
|
-
}
|
|
885
|
-
} else if (stream.type === "fetch") {
|
|
886
|
-
controller.enqueue({
|
|
887
|
-
type: "fetch_header",
|
|
888
|
-
requestId: stream.requestId
|
|
889
|
-
});
|
|
890
|
-
for (const obj of stream.objects) {
|
|
891
|
-
controller.enqueue(obj);
|
|
892
|
-
}
|
|
835
|
+
await feed(chunk);
|
|
836
|
+
},
|
|
837
|
+
async flush() {
|
|
838
|
+
if (writer === null) return;
|
|
839
|
+
try {
|
|
840
|
+
await writer.close();
|
|
841
|
+
} catch (e3) {
|
|
893
842
|
}
|
|
843
|
+
await pump;
|
|
894
844
|
}
|
|
895
845
|
});
|
|
896
846
|
}
|
|
@@ -910,12 +860,12 @@ function encodeSetupOptions(opts, writer) {
|
|
|
910
860
|
}
|
|
911
861
|
});
|
|
912
862
|
}
|
|
913
|
-
|
|
863
|
+
for (const token of _nullishCoalesce(opts.authorization_token, () => ( []))) {
|
|
914
864
|
entries.push({
|
|
915
865
|
type: SETUP_OPT_AUTHORIZATION_TOKEN,
|
|
916
866
|
encode: (w) => {
|
|
917
|
-
const tmpW = new (0,
|
|
918
|
-
encodeAuthorizationToken(
|
|
867
|
+
const tmpW = new (0, _chunk5IMHJIAZcjs.Draft17BufferWriter)(64);
|
|
868
|
+
encodeAuthorizationToken(token, tmpW);
|
|
919
869
|
const raw = tmpW.finish();
|
|
920
870
|
w.writeVarInt(BigInt(raw.byteLength));
|
|
921
871
|
w.writeBytes(raw);
|
|
@@ -955,11 +905,11 @@ function encodeSetupOptions(opts, writer) {
|
|
|
955
905
|
type: id,
|
|
956
906
|
encode: (w) => {
|
|
957
907
|
if (id % 2n === 0n) {
|
|
958
|
-
const raw =
|
|
959
|
-
const tmpReader = new (0,
|
|
908
|
+
const raw = _chunk5IMHJIAZcjs.hexToBytes.call(void 0, u.raw_hex);
|
|
909
|
+
const tmpReader = new (0, _chunk5IMHJIAZcjs.Draft17BufferReader)(raw);
|
|
960
910
|
w.writeVarInt(tmpReader.readVarInt());
|
|
961
911
|
} else {
|
|
962
|
-
const raw =
|
|
912
|
+
const raw = _chunk5IMHJIAZcjs.hexToBytes.call(void 0, u.raw_hex);
|
|
963
913
|
w.writeVarInt(BigInt(raw.byteLength));
|
|
964
914
|
w.writeBytes(raw);
|
|
965
915
|
}
|
|
@@ -988,13 +938,13 @@ function decodeSetupOptions(reader, payloadEnd) {
|
|
|
988
938
|
if (optType === SETUP_OPT_MAX_AUTH_TOKEN_CACHE_SIZE) {
|
|
989
939
|
result.max_auth_token_cache_size = value;
|
|
990
940
|
} else {
|
|
991
|
-
const tmpWriter = new (0,
|
|
941
|
+
const tmpWriter = new (0, _chunk5IMHJIAZcjs.Draft17BufferWriter)(16);
|
|
992
942
|
tmpWriter.writeVarInt(value);
|
|
993
943
|
const raw = tmpWriter.finish();
|
|
994
944
|
unknown.push({
|
|
995
945
|
id: `0x${optType.toString(16)}`,
|
|
996
946
|
length: raw.byteLength,
|
|
997
|
-
raw_hex:
|
|
947
|
+
raw_hex: _chunk5IMHJIAZcjs.bytesToHex.call(void 0, raw)
|
|
998
948
|
});
|
|
999
949
|
}
|
|
1000
950
|
} else {
|
|
@@ -1003,7 +953,9 @@ function decodeSetupOptions(reader, payloadEnd) {
|
|
|
1003
953
|
if (optType === SETUP_OPT_PATH) {
|
|
1004
954
|
result.path = textDecoder.decode(bytes);
|
|
1005
955
|
} else if (optType === SETUP_OPT_AUTHORIZATION_TOKEN) {
|
|
1006
|
-
|
|
956
|
+
const token = decodeAuthorizationToken(new (0, _chunk5IMHJIAZcjs.Draft17BufferReader)(bytes));
|
|
957
|
+
noteAuthTokenValue(reader.offset - length, length, token.token_value);
|
|
958
|
+
result.authorization_token = [..._nullishCoalesce(result.authorization_token, () => ( [])), token];
|
|
1007
959
|
} else if (optType === SETUP_OPT_AUTHORITY) {
|
|
1008
960
|
result.authority = textDecoder.decode(bytes);
|
|
1009
961
|
} else if (optType === SETUP_OPT_MOQT_IMPLEMENTATION) {
|
|
@@ -1012,7 +964,7 @@ function decodeSetupOptions(reader, payloadEnd) {
|
|
|
1012
964
|
unknown.push({
|
|
1013
965
|
id: `0x${optType.toString(16)}`,
|
|
1014
966
|
length,
|
|
1015
|
-
raw_hex:
|
|
967
|
+
raw_hex: _chunk5IMHJIAZcjs.bytesToHex.call(void 0, bytes)
|
|
1016
968
|
});
|
|
1017
969
|
}
|
|
1018
970
|
}
|
|
@@ -1029,7 +981,6 @@ function encodeAuthorizationToken(token, w) {
|
|
|
1029
981
|
if (aliasType === 1 || aliasType === 3) {
|
|
1030
982
|
w.writeVarInt(_nullishCoalesce(token.token_type, () => ( 0n)));
|
|
1031
983
|
const tv = _nullishCoalesce(token.token_value, () => ( new Uint8Array(0)));
|
|
1032
|
-
w.writeVarInt(BigInt(tv.byteLength));
|
|
1033
984
|
w.writeBytes(tv);
|
|
1034
985
|
}
|
|
1035
986
|
}
|
|
@@ -1044,8 +995,7 @@ function decodeAuthorizationToken(r) {
|
|
|
1044
995
|
if (aliasType === 1 || aliasType === 3) {
|
|
1045
996
|
;
|
|
1046
997
|
result.token_type = r.readVarInt();
|
|
1047
|
-
const
|
|
1048
|
-
const bytes = r.readBytes(len);
|
|
998
|
+
const bytes = r.readBytes(r.remaining);
|
|
1049
999
|
result.token_value = bytes;
|
|
1050
1000
|
}
|
|
1051
1001
|
return result;
|
|
@@ -1091,12 +1041,12 @@ function encodeParams(params, writer) {
|
|
|
1091
1041
|
encode: (w) => w.writeVarInt(params.delivery_timeout)
|
|
1092
1042
|
});
|
|
1093
1043
|
}
|
|
1094
|
-
|
|
1044
|
+
for (const token of _nullishCoalesce(params.authorization_token, () => ( []))) {
|
|
1095
1045
|
entries.push({
|
|
1096
1046
|
type: PARAM_AUTHORIZATION_TOKEN,
|
|
1097
1047
|
encode: (w) => {
|
|
1098
|
-
const tmpW = new (0,
|
|
1099
|
-
encodeAuthorizationToken(
|
|
1048
|
+
const tmpW = new (0, _chunk5IMHJIAZcjs.Draft17BufferWriter)(64);
|
|
1049
|
+
encodeAuthorizationToken(token, tmpW);
|
|
1100
1050
|
const raw = tmpW.finish();
|
|
1101
1051
|
w.writeVarInt(BigInt(raw.byteLength));
|
|
1102
1052
|
w.writeBytes(raw);
|
|
@@ -1141,7 +1091,7 @@ function encodeParams(params, writer) {
|
|
|
1141
1091
|
type: PARAM_SUBSCRIPTION_FILTER,
|
|
1142
1092
|
encode: (w) => {
|
|
1143
1093
|
const f = params.subscription_filter;
|
|
1144
|
-
const tmpW = new (0,
|
|
1094
|
+
const tmpW = new (0, _chunk5IMHJIAZcjs.Draft17BufferWriter)(32);
|
|
1145
1095
|
tmpW.writeVarInt(f.filter_type);
|
|
1146
1096
|
if (f.filter_type === 3n || f.filter_type === 4n) {
|
|
1147
1097
|
tmpW.writeVarInt(f.start_group);
|
|
@@ -1174,7 +1124,7 @@ function encodeParams(params, writer) {
|
|
|
1174
1124
|
entries.push({
|
|
1175
1125
|
type: id,
|
|
1176
1126
|
encode: (w) => {
|
|
1177
|
-
const raw =
|
|
1127
|
+
const raw = _chunk5IMHJIAZcjs.hexToBytes.call(void 0, u.raw_hex);
|
|
1178
1128
|
w.writeBytes(raw);
|
|
1179
1129
|
}
|
|
1180
1130
|
});
|
|
@@ -1199,7 +1149,7 @@ function decodeParams(reader, messageType) {
|
|
|
1199
1149
|
prevType = paramType;
|
|
1200
1150
|
const scope = PARAMETER_SCOPE.get(paramType);
|
|
1201
1151
|
if (scope !== void 0 && !scope.has(messageType)) {
|
|
1202
|
-
throw new (0,
|
|
1152
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
1203
1153
|
"CONSTRAINT_VIOLATION",
|
|
1204
1154
|
`Message Parameter 0x${paramType.toString(16)} may not appear in ${messageType}`,
|
|
1205
1155
|
reader.offset
|
|
@@ -1210,7 +1160,9 @@ function decodeParams(reader, messageType) {
|
|
|
1210
1160
|
} else if (paramType === PARAM_AUTHORIZATION_TOKEN) {
|
|
1211
1161
|
const length = Number(reader.readVarInt());
|
|
1212
1162
|
const bytes = reader.readBytes(length);
|
|
1213
|
-
|
|
1163
|
+
const token = decodeAuthorizationToken(new (0, _chunk5IMHJIAZcjs.Draft17BufferReader)(bytes));
|
|
1164
|
+
noteAuthTokenValue(reader.offset - length, length, token.token_value);
|
|
1165
|
+
result.authorization_token = [..._nullishCoalesce(result.authorization_token, () => ( [])), token];
|
|
1214
1166
|
} else if (paramType === PARAM_RENDEZVOUS_TIMEOUT) {
|
|
1215
1167
|
result.rendezvous_timeout = reader.readVarInt();
|
|
1216
1168
|
} else if (paramType === PARAM_EXPIRES) {
|
|
@@ -1243,7 +1195,7 @@ function decodeParams(reader, messageType) {
|
|
|
1243
1195
|
} else if (paramType === PARAM_NEW_GROUP_REQUEST) {
|
|
1244
1196
|
result.new_group_request = reader.readVarInt();
|
|
1245
1197
|
} else {
|
|
1246
|
-
throw new (0,
|
|
1198
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
1247
1199
|
"INVALID_PARAMETER",
|
|
1248
1200
|
`Unknown Message Parameter type 0x${paramType.toString(16)}`,
|
|
1249
1201
|
reader.offset
|
|
@@ -1307,11 +1259,11 @@ function encodeTrackProperties(props, writer) {
|
|
|
1307
1259
|
type: id,
|
|
1308
1260
|
encode: (w) => {
|
|
1309
1261
|
if (id % 2n === 0n) {
|
|
1310
|
-
const raw =
|
|
1311
|
-
const tmpReader = new (0,
|
|
1262
|
+
const raw = _chunk5IMHJIAZcjs.hexToBytes.call(void 0, u.raw_hex);
|
|
1263
|
+
const tmpReader = new (0, _chunk5IMHJIAZcjs.Draft17BufferReader)(raw);
|
|
1312
1264
|
w.writeVarInt(tmpReader.readVarInt());
|
|
1313
1265
|
} else {
|
|
1314
|
-
const raw =
|
|
1266
|
+
const raw = _chunk5IMHJIAZcjs.hexToBytes.call(void 0, u.raw_hex);
|
|
1315
1267
|
w.writeVarInt(BigInt(raw.byteLength));
|
|
1316
1268
|
w.writeBytes(raw);
|
|
1317
1269
|
}
|
|
@@ -1348,13 +1300,13 @@ function decodeTrackProperties(reader, payloadEnd) {
|
|
|
1348
1300
|
} else if (propType === TPROP_DYNAMIC_GROUPS) {
|
|
1349
1301
|
result.dynamic_groups = value;
|
|
1350
1302
|
} else {
|
|
1351
|
-
const tmpWriter = new (0,
|
|
1303
|
+
const tmpWriter = new (0, _chunk5IMHJIAZcjs.Draft17BufferWriter)(16);
|
|
1352
1304
|
tmpWriter.writeVarInt(value);
|
|
1353
1305
|
const raw = tmpWriter.finish();
|
|
1354
1306
|
unknown.push({
|
|
1355
1307
|
id: `0x${propType.toString(16)}`,
|
|
1356
1308
|
length: raw.byteLength,
|
|
1357
|
-
raw_hex:
|
|
1309
|
+
raw_hex: _chunk5IMHJIAZcjs.bytesToHex.call(void 0, raw)
|
|
1358
1310
|
});
|
|
1359
1311
|
}
|
|
1360
1312
|
} else {
|
|
@@ -1366,7 +1318,7 @@ function decodeTrackProperties(reader, payloadEnd) {
|
|
|
1366
1318
|
unknown.push({
|
|
1367
1319
|
id: `0x${propType.toString(16)}`,
|
|
1368
1320
|
length,
|
|
1369
|
-
raw_hex:
|
|
1321
|
+
raw_hex: _chunk5IMHJIAZcjs.bytesToHex.call(void 0, bytes)
|
|
1370
1322
|
});
|
|
1371
1323
|
}
|
|
1372
1324
|
}
|
|
@@ -1590,7 +1542,7 @@ function decodeFetchPayload(r) {
|
|
|
1590
1542
|
const fetch_type = r.readVarInt();
|
|
1591
1543
|
const ft = Number(fetch_type);
|
|
1592
1544
|
if (ft < 1 || ft > 3) {
|
|
1593
|
-
throw new (0,
|
|
1545
|
+
throw new (0, _chunk5IMHJIAZcjs.DecodeError)("CONSTRAINT_VIOLATION", `Invalid fetch_type: ${ft}`, r.offset);
|
|
1594
1546
|
}
|
|
1595
1547
|
let standalone;
|
|
1596
1548
|
let joining;
|
|
@@ -1675,13 +1627,13 @@ function encodeMessage(message) {
|
|
|
1675
1627
|
if (typeId === void 0) {
|
|
1676
1628
|
throw new Error(`Unknown message type: ${message.type}`);
|
|
1677
1629
|
}
|
|
1678
|
-
const payloadWriter = new (0,
|
|
1630
|
+
const payloadWriter = new (0, _chunk5IMHJIAZcjs.Draft17BufferWriter)();
|
|
1679
1631
|
encodePayload(message, payloadWriter);
|
|
1680
1632
|
const payload = payloadWriter.finishView();
|
|
1681
1633
|
if (payload.byteLength > 65535) {
|
|
1682
1634
|
throw new Error(`Payload too large for 16-bit length: ${payload.byteLength}`);
|
|
1683
1635
|
}
|
|
1684
|
-
const writer = new (0,
|
|
1636
|
+
const writer = new (0, _chunk5IMHJIAZcjs.Draft17BufferWriter)(payload.byteLength + 16);
|
|
1685
1637
|
writer.writeVarInt(typeId);
|
|
1686
1638
|
writer.writeUint8(payload.byteLength >> 8 & 255);
|
|
1687
1639
|
writer.writeUint8(payload.byteLength & 255);
|
|
@@ -1734,7 +1686,7 @@ function encodePayload(msg, w) {
|
|
|
1734
1686
|
}
|
|
1735
1687
|
function decodeMessage(bytes) {
|
|
1736
1688
|
try {
|
|
1737
|
-
const reader = new (0,
|
|
1689
|
+
const reader = new (0, _chunk5IMHJIAZcjs.Draft17BufferReader)(bytes);
|
|
1738
1690
|
const typeId = reader.readVarInt();
|
|
1739
1691
|
const lenHi = reader.readUint8();
|
|
1740
1692
|
const lenLo = reader.readUint8();
|
|
@@ -1742,7 +1694,7 @@ function decodeMessage(bytes) {
|
|
|
1742
1694
|
const payloadStart = reader.offset;
|
|
1743
1695
|
const _payloadEnd = payloadStart + payloadLength;
|
|
1744
1696
|
const payloadBytes = reader.readBytes(payloadLength);
|
|
1745
|
-
const payloadReader = new (0,
|
|
1697
|
+
const payloadReader = new (0, _chunk5IMHJIAZcjs.Draft17BufferReader)(payloadBytes);
|
|
1746
1698
|
let message;
|
|
1747
1699
|
if (typeId === MSG_SETUP) {
|
|
1748
1700
|
message = decodeSetupPayload(payloadReader, payloadLength);
|
|
@@ -1783,7 +1735,7 @@ function decodeMessage(bytes) {
|
|
|
1783
1735
|
} else {
|
|
1784
1736
|
return {
|
|
1785
1737
|
ok: false,
|
|
1786
|
-
error: new (0,
|
|
1738
|
+
error: new (0, _chunk5IMHJIAZcjs.DecodeError)(
|
|
1787
1739
|
"UNKNOWN_MESSAGE_TYPE",
|
|
1788
1740
|
`Unknown message type ID: 0x${typeId.toString(16)}`,
|
|
1789
1741
|
0
|
|
@@ -1792,7 +1744,7 @@ function decodeMessage(bytes) {
|
|
|
1792
1744
|
}
|
|
1793
1745
|
return { ok: true, value: message, bytesRead: reader.offset };
|
|
1794
1746
|
} catch (e) {
|
|
1795
|
-
if (e instanceof
|
|
1747
|
+
if (e instanceof _chunk5IMHJIAZcjs.DecodeError) {
|
|
1796
1748
|
return { ok: false, error: e };
|
|
1797
1749
|
}
|
|
1798
1750
|
throw e;
|
|
@@ -1827,7 +1779,7 @@ function createStreamDecoder() {
|
|
|
1827
1779
|
flush(controller) {
|
|
1828
1780
|
if (offset < buffer.length) {
|
|
1829
1781
|
controller.error(
|
|
1830
|
-
new (0,
|
|
1782
|
+
new (0, _chunk5IMHJIAZcjs.DecodeError)("UNEXPECTED_END", "Stream ended with incomplete message data", 0)
|
|
1831
1783
|
);
|
|
1832
1784
|
}
|
|
1833
1785
|
}
|
|
@@ -1851,6 +1803,24 @@ function createDraft17Codec() {
|
|
|
1851
1803
|
createDataStreamDecoder
|
|
1852
1804
|
};
|
|
1853
1805
|
}
|
|
1806
|
+
function noteAuthTokenValue(valueStart, valueLength, value) {
|
|
1807
|
+
if (value === void 0 || value.byteLength === 0) return;
|
|
1808
|
+
_chunk5IMHJIAZcjs.recordAuthValueSpan.call(void 0, valueStart + valueLength - value.byteLength, value.byteLength);
|
|
1809
|
+
}
|
|
1810
|
+
function redactAuthTokens(bytes) {
|
|
1811
|
+
let payloadStart;
|
|
1812
|
+
try {
|
|
1813
|
+
const probe = new (0, _chunk5IMHJIAZcjs.Draft17BufferReader)(bytes);
|
|
1814
|
+
probe.readVarInt();
|
|
1815
|
+
probe.readUint8();
|
|
1816
|
+
probe.readUint8();
|
|
1817
|
+
payloadStart = probe.offset;
|
|
1818
|
+
} catch (e4) {
|
|
1819
|
+
return { bytes, redacted: 0, incomplete: false, decoded: false };
|
|
1820
|
+
}
|
|
1821
|
+
return _chunk5IMHJIAZcjs.redactWith.call(void 0, bytes, payloadStart, () => decodeMessage(bytes).ok);
|
|
1822
|
+
}
|
|
1823
|
+
|
|
1854
1824
|
|
|
1855
1825
|
|
|
1856
1826
|
|
|
@@ -1891,4 +1861,4 @@ function createDraft17Codec() {
|
|
|
1891
1861
|
|
|
1892
1862
|
|
|
1893
1863
|
|
|
1894
|
-
exports.MSG_REQUEST_UPDATE = MSG_REQUEST_UPDATE; exports.MSG_SUBSCRIBE = MSG_SUBSCRIBE; exports.MSG_SUBSCRIBE_OK = MSG_SUBSCRIBE_OK; exports.MSG_REQUEST_ERROR = MSG_REQUEST_ERROR; exports.MSG_PUBLISH_NAMESPACE = MSG_PUBLISH_NAMESPACE; exports.MSG_REQUEST_OK = MSG_REQUEST_OK; exports.MSG_NAMESPACE = MSG_NAMESPACE; exports.MSG_PUBLISH_DONE = MSG_PUBLISH_DONE; exports.MSG_TRACK_STATUS = MSG_TRACK_STATUS; exports.MSG_NAMESPACE_DONE = MSG_NAMESPACE_DONE; exports.MSG_PUBLISH_BLOCKED = MSG_PUBLISH_BLOCKED; exports.MSG_GOAWAY = MSG_GOAWAY; exports.MSG_SUBSCRIBE_NAMESPACE = MSG_SUBSCRIBE_NAMESPACE; exports.MSG_FETCH = MSG_FETCH; exports.MSG_FETCH_OK = MSG_FETCH_OK; exports.MSG_PUBLISH = MSG_PUBLISH; exports.MSG_PUBLISH_OK = MSG_PUBLISH_OK; exports.MSG_SETUP = MSG_SETUP; exports.SETUP_OPT_PATH = SETUP_OPT_PATH; exports.SETUP_OPT_MAX_AUTH_TOKEN_CACHE_SIZE = SETUP_OPT_MAX_AUTH_TOKEN_CACHE_SIZE; exports.SETUP_OPT_AUTHORITY = SETUP_OPT_AUTHORITY; exports.SETUP_OPT_MOQT_IMPLEMENTATION = SETUP_OPT_MOQT_IMPLEMENTATION; exports.MESSAGE_TYPE_MAP = MESSAGE_TYPE_MAP; exports.MESSAGE_ID_MAP = MESSAGE_ID_MAP; 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.createDraft17Codec = createDraft17Codec;
|
|
1864
|
+
exports.MSG_REQUEST_UPDATE = MSG_REQUEST_UPDATE; exports.MSG_SUBSCRIBE = MSG_SUBSCRIBE; exports.MSG_SUBSCRIBE_OK = MSG_SUBSCRIBE_OK; exports.MSG_REQUEST_ERROR = MSG_REQUEST_ERROR; exports.MSG_PUBLISH_NAMESPACE = MSG_PUBLISH_NAMESPACE; exports.MSG_REQUEST_OK = MSG_REQUEST_OK; exports.MSG_NAMESPACE = MSG_NAMESPACE; exports.MSG_PUBLISH_DONE = MSG_PUBLISH_DONE; exports.MSG_TRACK_STATUS = MSG_TRACK_STATUS; exports.MSG_NAMESPACE_DONE = MSG_NAMESPACE_DONE; exports.MSG_PUBLISH_BLOCKED = MSG_PUBLISH_BLOCKED; exports.MSG_GOAWAY = MSG_GOAWAY; exports.MSG_SUBSCRIBE_NAMESPACE = MSG_SUBSCRIBE_NAMESPACE; exports.MSG_FETCH = MSG_FETCH; exports.MSG_FETCH_OK = MSG_FETCH_OK; exports.MSG_PUBLISH = MSG_PUBLISH; exports.MSG_PUBLISH_OK = MSG_PUBLISH_OK; exports.MSG_SETUP = MSG_SETUP; exports.SETUP_OPT_PATH = SETUP_OPT_PATH; exports.SETUP_OPT_MAX_AUTH_TOKEN_CACHE_SIZE = SETUP_OPT_MAX_AUTH_TOKEN_CACHE_SIZE; exports.SETUP_OPT_AUTHORITY = SETUP_OPT_AUTHORITY; exports.SETUP_OPT_MOQT_IMPLEMENTATION = SETUP_OPT_MOQT_IMPLEMENTATION; exports.MESSAGE_TYPE_MAP = MESSAGE_TYPE_MAP; exports.MESSAGE_ID_MAP = MESSAGE_ID_MAP; 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.createDraft17Codec = createDraft17Codec; exports.redactAuthTokens = redactAuthTokens;
|