@moqtap/codec 0.6.0 → 0.7.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/README.md +4 -2
- package/dist/{chunk-CXFAQKL3.js → chunk-23KRITJ6.js} +1 -1
- package/dist/{chunk-JL3NEW3O.cjs → chunk-4XLYCT5Q.cjs} +90 -1
- package/dist/{chunk-DLSGOZ6P.js → chunk-5XZKO2U5.js} +34 -34
- package/dist/{chunk-62LYLROG.js → chunk-APTV6F72.js} +35 -35
- package/dist/{chunk-JB5VDJ2V.cjs → chunk-B56AG5HU.cjs} +37 -37
- package/dist/{chunk-4HBKHNU2.cjs → chunk-CZNW3R5E.cjs} +37 -37
- package/dist/{chunk-Q5D6OW6Q.js → chunk-DORX55MO.js} +1 -1
- package/dist/{chunk-OGZTQA24.cjs → chunk-EQAYMCXO.cjs} +64 -64
- package/dist/{chunk-HYI6LFMD.js → chunk-HEO2JG6C.js} +1 -1
- package/dist/{chunk-UP4XPH4J.js → chunk-I55J3KXD.js} +31 -31
- package/dist/{chunk-HZHSO7EW.cjs → chunk-IDV2JYJ6.cjs} +39 -39
- package/dist/{chunk-BAG6YWCP.cjs → chunk-IEJULBKB.cjs} +63 -63
- package/dist/{chunk-Y6KCSM3V.js → chunk-IJAF6PAY.js} +1 -1
- package/dist/{chunk-WMJVSBBE.cjs → chunk-J3ASFPCX.cjs} +57 -57
- package/dist/{chunk-COWGGUL4.js → chunk-JKMYAUGY.js} +1 -1
- package/dist/{chunk-SIYYMFCC.cjs → chunk-KCH4BQXK.cjs} +37 -37
- package/dist/{chunk-VOU7PNHI.js → chunk-KLPWJU6W.js} +89 -0
- package/dist/{chunk-NZ7GYEMT.js → chunk-KNLPX3YA.js} +1 -1
- package/dist/{chunk-A33U4WVS.cjs → chunk-KTVN4P6J.cjs} +67 -67
- package/dist/{chunk-7KBAWOBA.js → chunk-KYVTM5VI.js} +1 -1
- package/dist/{chunk-RZ3UML47.js → chunk-MD2OA7SE.js} +1 -1
- package/dist/{chunk-MSG2FXJ2.cjs → chunk-MH7537FB.cjs} +68 -68
- package/dist/{chunk-SHMA4PBY.js → chunk-N2V7Z37J.js} +1 -1
- package/dist/{chunk-HO44OANK.cjs → chunk-QGIHC6BA.cjs} +36 -36
- package/dist/{chunk-PKEOQSSZ.cjs → chunk-RIIA4ALQ.cjs} +37 -37
- package/dist/{chunk-XZE5R57R.cjs → chunk-VZHL2U2N.cjs} +37 -37
- package/dist/{chunk-RW4UG7CN.js → chunk-XHAP2YST.js} +1 -1
- package/dist/{chunk-JTRU76JN.cjs → chunk-Y4FRXYX6.cjs} +59 -59
- package/dist/draft07.cjs +4 -4
- package/dist/draft07.js +2 -2
- package/dist/draft08.cjs +3 -3
- package/dist/draft08.js +2 -2
- package/dist/draft09.cjs +3 -3
- package/dist/draft09.js +2 -2
- package/dist/draft10.cjs +3 -3
- package/dist/draft10.js +2 -2
- package/dist/draft11.cjs +3 -3
- package/dist/draft11.js +2 -2
- package/dist/draft12.cjs +3 -3
- package/dist/draft12.js +2 -2
- package/dist/draft13.cjs +3 -3
- package/dist/draft13.js +2 -2
- package/dist/draft14.cjs +3 -3
- package/dist/draft14.js +2 -2
- package/dist/draft15.cjs +3 -3
- package/dist/draft15.js +2 -2
- package/dist/draft16.cjs +3 -3
- package/dist/draft16.js +2 -2
- package/dist/draft17.cjs +3 -3
- package/dist/draft17.js +2 -2
- package/dist/draft18.cjs +3 -3
- package/dist/draft18.js +2 -2
- package/dist/draft19.cjs +3 -3
- package/dist/draft19.js +2 -2
- package/dist/index.cjs +28 -28
- package/dist/index.js +14 -14
- package/package.json +2 -2
- package/src/core/buffer-reader.ts +74 -2
- package/src/core/buffer-writer.ts +56 -4
- package/src/drafts/draft17/codec.ts +2 -2
- package/src/drafts/draft17/data-streams.ts +2 -2
- package/src/drafts/draft18/codec.ts +2 -2
- package/src/drafts/draft18/data-streams.ts +2 -2
- package/src/drafts/draft19/codec.ts +2 -2
- package/src/drafts/draft19/data-streams.ts +2 -2
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunk4XLYCT5Qcjs = require('./chunk-4XLYCT5Q.cjs');
|
|
8
8
|
|
|
9
9
|
// src/drafts/draft17/messages.ts
|
|
10
10
|
var MSG_REQUEST_UPDATE = 0x02n;
|
|
@@ -102,7 +102,7 @@ function encodeObjectProperties(props, w) {
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
function encodeSubgroupStream(stream) {
|
|
105
|
-
const w = new (0,
|
|
105
|
+
const w = new (0, _chunk4XLYCT5Qcjs.Draft17BufferWriter)();
|
|
106
106
|
const streamType = stream.headerType;
|
|
107
107
|
w.writeVarInt(BigInt(streamType));
|
|
108
108
|
const propertiesPresent = (streamType & 1) !== 0;
|
|
@@ -122,7 +122,7 @@ function encodeSubgroupStream(stream) {
|
|
|
122
122
|
w.writeVarInt(delta);
|
|
123
123
|
if (propertiesPresent) {
|
|
124
124
|
if (obj.objectProperties && Object.keys(obj.objectProperties).length > 0) {
|
|
125
|
-
const tmpW = new (0,
|
|
125
|
+
const tmpW = new (0, _chunk4XLYCT5Qcjs.Draft17BufferWriter)(32);
|
|
126
126
|
encodeObjectProperties(obj.objectProperties, tmpW);
|
|
127
127
|
const raw = tmpW.finish();
|
|
128
128
|
w.writeVarInt(BigInt(raw.byteLength));
|
|
@@ -142,7 +142,7 @@ function encodeSubgroupStream(stream) {
|
|
|
142
142
|
return w.finish();
|
|
143
143
|
}
|
|
144
144
|
function encodeDatagram(dg) {
|
|
145
|
-
const w = new (0,
|
|
145
|
+
const w = new (0, _chunk4XLYCT5Qcjs.Draft17BufferWriter)();
|
|
146
146
|
const dgType = dg.datagramType;
|
|
147
147
|
w.writeVarInt(BigInt(dgType));
|
|
148
148
|
w.writeVarInt(dg.trackAlias);
|
|
@@ -159,7 +159,7 @@ function encodeDatagram(dg) {
|
|
|
159
159
|
}
|
|
160
160
|
if (propertiesPresent) {
|
|
161
161
|
if (dg.objectProperties && Object.keys(dg.objectProperties).length > 0) {
|
|
162
|
-
const tmpW = new (0,
|
|
162
|
+
const tmpW = new (0, _chunk4XLYCT5Qcjs.Draft17BufferWriter)(32);
|
|
163
163
|
encodeObjectProperties(dg.objectProperties, tmpW);
|
|
164
164
|
const raw = tmpW.finish();
|
|
165
165
|
w.writeVarInt(BigInt(raw.byteLength));
|
|
@@ -176,7 +176,7 @@ function encodeDatagram(dg) {
|
|
|
176
176
|
return w.finish();
|
|
177
177
|
}
|
|
178
178
|
function encodeFetchStream(stream) {
|
|
179
|
-
const w = new (0,
|
|
179
|
+
const w = new (0, _chunk4XLYCT5Qcjs.Draft17BufferWriter)();
|
|
180
180
|
w.writeVarInt(FETCH_STREAM_TYPE);
|
|
181
181
|
w.writeVarInt(stream.requestId);
|
|
182
182
|
for (const obj of stream.objects) {
|
|
@@ -192,7 +192,7 @@ function encodeFetchStream(stream) {
|
|
|
192
192
|
if (flags & 16) w.writeUint8(obj.publisherPriority);
|
|
193
193
|
if (flags & 32) {
|
|
194
194
|
if (obj.objectProperties && Object.keys(obj.objectProperties).length > 0) {
|
|
195
|
-
const tmpW = new (0,
|
|
195
|
+
const tmpW = new (0, _chunk4XLYCT5Qcjs.Draft17BufferWriter)(32);
|
|
196
196
|
encodeObjectProperties(obj.objectProperties, tmpW);
|
|
197
197
|
const raw = tmpW.finish();
|
|
198
198
|
w.writeVarInt(BigInt(raw.byteLength));
|
|
@@ -213,7 +213,7 @@ function encodeFetchStream(stream) {
|
|
|
213
213
|
if (flags & 16) w.writeUint8(obj.publisherPriority);
|
|
214
214
|
if (flags & 32) {
|
|
215
215
|
if (obj.objectProperties && Object.keys(obj.objectProperties).length > 0) {
|
|
216
|
-
const tmpW = new (0,
|
|
216
|
+
const tmpW = new (0, _chunk4XLYCT5Qcjs.Draft17BufferWriter)(32);
|
|
217
217
|
encodeObjectProperties(obj.objectProperties, tmpW);
|
|
218
218
|
const raw = tmpW.finish();
|
|
219
219
|
w.writeVarInt(BigInt(raw.byteLength));
|
|
@@ -232,12 +232,12 @@ function encodeFetchStream(stream) {
|
|
|
232
232
|
}
|
|
233
233
|
function decodeSubgroupStream(bytes) {
|
|
234
234
|
try {
|
|
235
|
-
const r = new (0,
|
|
235
|
+
const r = new (0, _chunk4XLYCT5Qcjs.Draft17BufferReader)(bytes);
|
|
236
236
|
const streamType = Number(r.readVarInt());
|
|
237
237
|
if (!(streamType >= 16 && streamType <= 29 || streamType >= 48 && streamType <= 61) || (streamType & 6) === 6) {
|
|
238
238
|
return {
|
|
239
239
|
ok: false,
|
|
240
|
-
error: new (0,
|
|
240
|
+
error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
241
241
|
"CONSTRAINT_VIOLATION",
|
|
242
242
|
`Expected subgroup stream type 0x10-0x15/0x18-0x1D/0x30-0x35/0x38-0x3D, got 0x${streamType.toString(16)}`,
|
|
243
243
|
0
|
|
@@ -326,13 +326,13 @@ function decodeSubgroupStream(bytes) {
|
|
|
326
326
|
bytesRead: r.offset
|
|
327
327
|
};
|
|
328
328
|
} catch (e) {
|
|
329
|
-
if (e instanceof
|
|
329
|
+
if (e instanceof _chunk4XLYCT5Qcjs.DecodeError) return { ok: false, error: e };
|
|
330
330
|
throw e;
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
333
|
function decodeDatagram(bytes) {
|
|
334
334
|
try {
|
|
335
|
-
const r = new (0,
|
|
335
|
+
const r = new (0, _chunk4XLYCT5Qcjs.Draft17BufferReader)(bytes);
|
|
336
336
|
const dgType = Number(r.readVarInt());
|
|
337
337
|
const objectIdAbsent = (dgType & 4) !== 0;
|
|
338
338
|
const endOfGroup = (dgType & 2) !== 0;
|
|
@@ -382,18 +382,18 @@ function decodeDatagram(bytes) {
|
|
|
382
382
|
result.objectProperties = objectProperties;
|
|
383
383
|
return { ok: true, value: result, bytesRead: r.offset };
|
|
384
384
|
} catch (e) {
|
|
385
|
-
if (e instanceof
|
|
385
|
+
if (e instanceof _chunk4XLYCT5Qcjs.DecodeError) return { ok: false, error: e };
|
|
386
386
|
throw e;
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
389
|
function decodeFetchStream(bytes) {
|
|
390
390
|
try {
|
|
391
|
-
const r = new (0,
|
|
391
|
+
const r = new (0, _chunk4XLYCT5Qcjs.Draft17BufferReader)(bytes);
|
|
392
392
|
const streamType = r.readVarInt();
|
|
393
393
|
if (streamType !== FETCH_STREAM_TYPE) {
|
|
394
394
|
return {
|
|
395
395
|
ok: false,
|
|
396
|
-
error: new (0,
|
|
396
|
+
error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
397
397
|
"CONSTRAINT_VIOLATION",
|
|
398
398
|
`Expected fetch stream type 0x05, got 0x${streamType.toString(16)}`,
|
|
399
399
|
0
|
|
@@ -421,7 +421,7 @@ function decodeFetchStream(bytes) {
|
|
|
421
421
|
if (flags !== 140 && flags !== 268) {
|
|
422
422
|
return {
|
|
423
423
|
ok: false,
|
|
424
|
-
error: new (0,
|
|
424
|
+
error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
425
425
|
"CONSTRAINT_VIOLATION",
|
|
426
426
|
`Unknown serialization flags value: 0x${flags.toString(16)}`,
|
|
427
427
|
r.offset
|
|
@@ -488,7 +488,7 @@ function decodeFetchStream(bytes) {
|
|
|
488
488
|
} else if (first) {
|
|
489
489
|
return {
|
|
490
490
|
ok: false,
|
|
491
|
-
error: new (0,
|
|
491
|
+
error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
492
492
|
"CONSTRAINT_VIOLATION",
|
|
493
493
|
"First fetch object must include groupId",
|
|
494
494
|
r.offset
|
|
@@ -501,7 +501,7 @@ function decodeFetchStream(bytes) {
|
|
|
501
501
|
if (first) {
|
|
502
502
|
return {
|
|
503
503
|
ok: false,
|
|
504
|
-
error: new (0,
|
|
504
|
+
error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
505
505
|
"CONSTRAINT_VIOLATION",
|
|
506
506
|
"First fetch object cannot reference prior subgroupId",
|
|
507
507
|
r.offset
|
|
@@ -513,7 +513,7 @@ function decodeFetchStream(bytes) {
|
|
|
513
513
|
if (first) {
|
|
514
514
|
return {
|
|
515
515
|
ok: false,
|
|
516
|
-
error: new (0,
|
|
516
|
+
error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
517
517
|
"CONSTRAINT_VIOLATION",
|
|
518
518
|
"First fetch object cannot reference prior subgroupId",
|
|
519
519
|
r.offset
|
|
@@ -529,7 +529,7 @@ function decodeFetchStream(bytes) {
|
|
|
529
529
|
} else if (first) {
|
|
530
530
|
return {
|
|
531
531
|
ok: false,
|
|
532
|
-
error: new (0,
|
|
532
|
+
error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
533
533
|
"CONSTRAINT_VIOLATION",
|
|
534
534
|
"First fetch object must include objectId",
|
|
535
535
|
r.offset
|
|
@@ -597,7 +597,7 @@ function decodeFetchStream(bytes) {
|
|
|
597
597
|
bytesRead: r.offset
|
|
598
598
|
};
|
|
599
599
|
} catch (e) {
|
|
600
|
-
if (e instanceof
|
|
600
|
+
if (e instanceof _chunk4XLYCT5Qcjs.DecodeError) return { ok: false, error: e };
|
|
601
601
|
throw e;
|
|
602
602
|
}
|
|
603
603
|
}
|
|
@@ -635,11 +635,11 @@ function createSubgroupStreamDecoder() {
|
|
|
635
635
|
buffer = newBuffer;
|
|
636
636
|
if (!headerEmitted) {
|
|
637
637
|
try {
|
|
638
|
-
const r = new (0,
|
|
638
|
+
const r = new (0, _chunk4XLYCT5Qcjs.Draft17BufferReader)(buffer.subarray(offset));
|
|
639
639
|
const streamType = Number(r.readVarInt());
|
|
640
640
|
if (!(streamType >= 16 && streamType <= 29 || streamType >= 48 && streamType <= 61)) {
|
|
641
641
|
controller.error(
|
|
642
|
-
new (0,
|
|
642
|
+
new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
643
643
|
"CONSTRAINT_VIOLATION",
|
|
644
644
|
`Expected subgroup stream type, got 0x${streamType.toString(16)}`,
|
|
645
645
|
0
|
|
@@ -671,7 +671,7 @@ function createSubgroupStreamDecoder() {
|
|
|
671
671
|
headerEmitted = true;
|
|
672
672
|
offset += r.offset;
|
|
673
673
|
} catch (e) {
|
|
674
|
-
if (e instanceof
|
|
674
|
+
if (e instanceof _chunk4XLYCT5Qcjs.DecodeError && e.code === "UNEXPECTED_END") {
|
|
675
675
|
return;
|
|
676
676
|
}
|
|
677
677
|
controller.error(e);
|
|
@@ -680,7 +680,7 @@ function createSubgroupStreamDecoder() {
|
|
|
680
680
|
}
|
|
681
681
|
while (offset < buffer.length) {
|
|
682
682
|
try {
|
|
683
|
-
const r = new (0,
|
|
683
|
+
const r = new (0, _chunk4XLYCT5Qcjs.Draft17BufferReader)(buffer.subarray(offset));
|
|
684
684
|
const delta = r.readVarInt();
|
|
685
685
|
let objectId;
|
|
686
686
|
if (firstObject) {
|
|
@@ -709,7 +709,7 @@ function createSubgroupStreamDecoder() {
|
|
|
709
709
|
offset += r.offset;
|
|
710
710
|
prevObjectId = objectId;
|
|
711
711
|
} catch (e) {
|
|
712
|
-
if (e instanceof
|
|
712
|
+
if (e instanceof _chunk4XLYCT5Qcjs.DecodeError && e.code === "UNEXPECTED_END") {
|
|
713
713
|
break;
|
|
714
714
|
}
|
|
715
715
|
controller.error(e);
|
|
@@ -719,7 +719,7 @@ function createSubgroupStreamDecoder() {
|
|
|
719
719
|
},
|
|
720
720
|
flush(controller) {
|
|
721
721
|
if (offset < buffer.length) {
|
|
722
|
-
controller.error(new (0,
|
|
722
|
+
controller.error(new (0, _chunk4XLYCT5Qcjs.DecodeError)("UNEXPECTED_END", "Stream ended with incomplete data", 0));
|
|
723
723
|
}
|
|
724
724
|
}
|
|
725
725
|
});
|
|
@@ -740,11 +740,11 @@ function createFetchStreamDecoder() {
|
|
|
740
740
|
buffer = newBuffer;
|
|
741
741
|
if (!headerEmitted) {
|
|
742
742
|
try {
|
|
743
|
-
const r = new (0,
|
|
743
|
+
const r = new (0, _chunk4XLYCT5Qcjs.Draft17BufferReader)(buffer.subarray(offset));
|
|
744
744
|
const streamType = r.readVarInt();
|
|
745
745
|
if (streamType !== FETCH_STREAM_TYPE) {
|
|
746
746
|
controller.error(
|
|
747
|
-
new (0,
|
|
747
|
+
new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
748
748
|
"CONSTRAINT_VIOLATION",
|
|
749
749
|
`Expected fetch stream type 0x05, got 0x${streamType.toString(16)}`,
|
|
750
750
|
0
|
|
@@ -757,7 +757,7 @@ function createFetchStreamDecoder() {
|
|
|
757
757
|
headerEmitted = true;
|
|
758
758
|
offset += r.offset;
|
|
759
759
|
} catch (e) {
|
|
760
|
-
if (e instanceof
|
|
760
|
+
if (e instanceof _chunk4XLYCT5Qcjs.DecodeError && e.code === "UNEXPECTED_END") {
|
|
761
761
|
return;
|
|
762
762
|
}
|
|
763
763
|
controller.error(e);
|
|
@@ -766,7 +766,7 @@ function createFetchStreamDecoder() {
|
|
|
766
766
|
}
|
|
767
767
|
while (offset < buffer.length) {
|
|
768
768
|
try {
|
|
769
|
-
const r = new (0,
|
|
769
|
+
const r = new (0, _chunk4XLYCT5Qcjs.Draft17BufferReader)(buffer.subarray(offset));
|
|
770
770
|
const flags = Number(r.readVarInt());
|
|
771
771
|
const objectIdPresent = (flags & 4) !== 0;
|
|
772
772
|
const groupIdPresent = (flags & 8) !== 0;
|
|
@@ -797,7 +797,7 @@ function createFetchStreamDecoder() {
|
|
|
797
797
|
});
|
|
798
798
|
offset += r.offset;
|
|
799
799
|
} catch (e) {
|
|
800
|
-
if (e instanceof
|
|
800
|
+
if (e instanceof _chunk4XLYCT5Qcjs.DecodeError && e.code === "UNEXPECTED_END") {
|
|
801
801
|
break;
|
|
802
802
|
}
|
|
803
803
|
controller.error(e);
|
|
@@ -807,7 +807,7 @@ function createFetchStreamDecoder() {
|
|
|
807
807
|
},
|
|
808
808
|
flush(controller) {
|
|
809
809
|
if (offset < buffer.length) {
|
|
810
|
-
controller.error(new (0,
|
|
810
|
+
controller.error(new (0, _chunk4XLYCT5Qcjs.DecodeError)("UNEXPECTED_END", "Stream ended with incomplete data", 0));
|
|
811
811
|
}
|
|
812
812
|
}
|
|
813
813
|
});
|
|
@@ -837,7 +837,7 @@ function createDataStreamDecoder() {
|
|
|
837
837
|
inner = decoder;
|
|
838
838
|
} else {
|
|
839
839
|
controller.error(
|
|
840
|
-
new (0,
|
|
840
|
+
new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
841
841
|
"CONSTRAINT_VIOLATION",
|
|
842
842
|
`Unknown data stream type: 0x${firstByte.toString(16)}`,
|
|
843
843
|
0
|
|
@@ -858,7 +858,7 @@ function createDataStreamDecoder() {
|
|
|
858
858
|
result = decodeFetchStream(view);
|
|
859
859
|
} else {
|
|
860
860
|
controller.error(
|
|
861
|
-
new (0,
|
|
861
|
+
new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
862
862
|
"CONSTRAINT_VIOLATION",
|
|
863
863
|
`Unknown data stream type: 0x${firstByte.toString(16)}`,
|
|
864
864
|
0
|
|
@@ -914,7 +914,7 @@ function encodeSetupOptions(opts, writer) {
|
|
|
914
914
|
entries.push({
|
|
915
915
|
type: SETUP_OPT_AUTHORIZATION_TOKEN,
|
|
916
916
|
encode: (w) => {
|
|
917
|
-
const tmpW = new (0,
|
|
917
|
+
const tmpW = new (0, _chunk4XLYCT5Qcjs.Draft17BufferWriter)(64);
|
|
918
918
|
encodeAuthorizationToken(opts.authorization_token, tmpW);
|
|
919
919
|
const raw = tmpW.finish();
|
|
920
920
|
w.writeVarInt(BigInt(raw.byteLength));
|
|
@@ -955,11 +955,11 @@ function encodeSetupOptions(opts, writer) {
|
|
|
955
955
|
type: id,
|
|
956
956
|
encode: (w) => {
|
|
957
957
|
if (id % 2n === 0n) {
|
|
958
|
-
const raw =
|
|
959
|
-
const tmpReader = new (0,
|
|
958
|
+
const raw = _chunk4XLYCT5Qcjs.hexToBytes.call(void 0, u.raw_hex);
|
|
959
|
+
const tmpReader = new (0, _chunk4XLYCT5Qcjs.Draft17BufferReader)(raw);
|
|
960
960
|
w.writeVarInt(tmpReader.readVarInt());
|
|
961
961
|
} else {
|
|
962
|
-
const raw =
|
|
962
|
+
const raw = _chunk4XLYCT5Qcjs.hexToBytes.call(void 0, u.raw_hex);
|
|
963
963
|
w.writeVarInt(BigInt(raw.byteLength));
|
|
964
964
|
w.writeBytes(raw);
|
|
965
965
|
}
|
|
@@ -988,13 +988,13 @@ function decodeSetupOptions(reader, payloadEnd) {
|
|
|
988
988
|
if (optType === SETUP_OPT_MAX_AUTH_TOKEN_CACHE_SIZE) {
|
|
989
989
|
result.max_auth_token_cache_size = value;
|
|
990
990
|
} else {
|
|
991
|
-
const tmpWriter = new (0,
|
|
991
|
+
const tmpWriter = new (0, _chunk4XLYCT5Qcjs.Draft17BufferWriter)(16);
|
|
992
992
|
tmpWriter.writeVarInt(value);
|
|
993
993
|
const raw = tmpWriter.finish();
|
|
994
994
|
unknown.push({
|
|
995
995
|
id: `0x${optType.toString(16)}`,
|
|
996
996
|
length: raw.byteLength,
|
|
997
|
-
raw_hex:
|
|
997
|
+
raw_hex: _chunk4XLYCT5Qcjs.bytesToHex.call(void 0, raw)
|
|
998
998
|
});
|
|
999
999
|
}
|
|
1000
1000
|
} else {
|
|
@@ -1003,7 +1003,7 @@ function decodeSetupOptions(reader, payloadEnd) {
|
|
|
1003
1003
|
if (optType === SETUP_OPT_PATH) {
|
|
1004
1004
|
result.path = textDecoder.decode(bytes);
|
|
1005
1005
|
} else if (optType === SETUP_OPT_AUTHORIZATION_TOKEN) {
|
|
1006
|
-
result.authorization_token = decodeAuthorizationToken(new (0,
|
|
1006
|
+
result.authorization_token = decodeAuthorizationToken(new (0, _chunk4XLYCT5Qcjs.Draft17BufferReader)(bytes));
|
|
1007
1007
|
} else if (optType === SETUP_OPT_AUTHORITY) {
|
|
1008
1008
|
result.authority = textDecoder.decode(bytes);
|
|
1009
1009
|
} else if (optType === SETUP_OPT_MOQT_IMPLEMENTATION) {
|
|
@@ -1012,7 +1012,7 @@ function decodeSetupOptions(reader, payloadEnd) {
|
|
|
1012
1012
|
unknown.push({
|
|
1013
1013
|
id: `0x${optType.toString(16)}`,
|
|
1014
1014
|
length,
|
|
1015
|
-
raw_hex:
|
|
1015
|
+
raw_hex: _chunk4XLYCT5Qcjs.bytesToHex.call(void 0, bytes)
|
|
1016
1016
|
});
|
|
1017
1017
|
}
|
|
1018
1018
|
}
|
|
@@ -1072,7 +1072,7 @@ function encodeParams(params, writer) {
|
|
|
1072
1072
|
entries.push({
|
|
1073
1073
|
type: PARAM_AUTHORIZATION_TOKEN,
|
|
1074
1074
|
encode: (w) => {
|
|
1075
|
-
const tmpW = new (0,
|
|
1075
|
+
const tmpW = new (0, _chunk4XLYCT5Qcjs.Draft17BufferWriter)(64);
|
|
1076
1076
|
encodeAuthorizationToken(params.authorization_token, tmpW);
|
|
1077
1077
|
const raw = tmpW.finish();
|
|
1078
1078
|
w.writeVarInt(BigInt(raw.byteLength));
|
|
@@ -1118,7 +1118,7 @@ function encodeParams(params, writer) {
|
|
|
1118
1118
|
type: PARAM_SUBSCRIPTION_FILTER,
|
|
1119
1119
|
encode: (w) => {
|
|
1120
1120
|
const f = params.subscription_filter;
|
|
1121
|
-
const tmpW = new (0,
|
|
1121
|
+
const tmpW = new (0, _chunk4XLYCT5Qcjs.Draft17BufferWriter)(32);
|
|
1122
1122
|
tmpW.writeVarInt(f.filter_type);
|
|
1123
1123
|
if (f.filter_type === 3n || f.filter_type === 4n) {
|
|
1124
1124
|
tmpW.writeVarInt(f.start_group);
|
|
@@ -1151,7 +1151,7 @@ function encodeParams(params, writer) {
|
|
|
1151
1151
|
entries.push({
|
|
1152
1152
|
type: id,
|
|
1153
1153
|
encode: (w) => {
|
|
1154
|
-
const raw =
|
|
1154
|
+
const raw = _chunk4XLYCT5Qcjs.hexToBytes.call(void 0, u.raw_hex);
|
|
1155
1155
|
w.writeBytes(raw);
|
|
1156
1156
|
}
|
|
1157
1157
|
});
|
|
@@ -1180,7 +1180,7 @@ function decodeParams(reader) {
|
|
|
1180
1180
|
} else if (paramType === PARAM_AUTHORIZATION_TOKEN) {
|
|
1181
1181
|
const length = Number(reader.readVarInt());
|
|
1182
1182
|
const bytes = reader.readBytes(length);
|
|
1183
|
-
result.authorization_token = decodeAuthorizationToken(new (0,
|
|
1183
|
+
result.authorization_token = decodeAuthorizationToken(new (0, _chunk4XLYCT5Qcjs.Draft17BufferReader)(bytes));
|
|
1184
1184
|
} else if (paramType === PARAM_RENDEZVOUS_TIMEOUT) {
|
|
1185
1185
|
result.rendezvous_timeout = reader.readVarInt();
|
|
1186
1186
|
} else if (paramType === PARAM_EXPIRES) {
|
|
@@ -1215,13 +1215,13 @@ function decodeParams(reader) {
|
|
|
1215
1215
|
} else {
|
|
1216
1216
|
if (paramType % 2n === 0n) {
|
|
1217
1217
|
const value = reader.readVarInt();
|
|
1218
|
-
const tmpWriter = new (0,
|
|
1218
|
+
const tmpWriter = new (0, _chunk4XLYCT5Qcjs.Draft17BufferWriter)(16);
|
|
1219
1219
|
tmpWriter.writeVarInt(value);
|
|
1220
1220
|
const raw = tmpWriter.finish();
|
|
1221
1221
|
unknown.push({
|
|
1222
1222
|
id: `0x${paramType.toString(16)}`,
|
|
1223
1223
|
length: raw.byteLength,
|
|
1224
|
-
raw_hex:
|
|
1224
|
+
raw_hex: _chunk4XLYCT5Qcjs.bytesToHex.call(void 0, raw)
|
|
1225
1225
|
});
|
|
1226
1226
|
} else {
|
|
1227
1227
|
const length = Number(reader.readVarInt());
|
|
@@ -1229,7 +1229,7 @@ function decodeParams(reader) {
|
|
|
1229
1229
|
unknown.push({
|
|
1230
1230
|
id: `0x${paramType.toString(16)}`,
|
|
1231
1231
|
length,
|
|
1232
|
-
raw_hex:
|
|
1232
|
+
raw_hex: _chunk4XLYCT5Qcjs.bytesToHex.call(void 0, bytes)
|
|
1233
1233
|
});
|
|
1234
1234
|
}
|
|
1235
1235
|
}
|
|
@@ -1292,11 +1292,11 @@ function encodeTrackProperties(props, writer) {
|
|
|
1292
1292
|
type: id,
|
|
1293
1293
|
encode: (w) => {
|
|
1294
1294
|
if (id % 2n === 0n) {
|
|
1295
|
-
const raw =
|
|
1296
|
-
const tmpReader = new (0,
|
|
1295
|
+
const raw = _chunk4XLYCT5Qcjs.hexToBytes.call(void 0, u.raw_hex);
|
|
1296
|
+
const tmpReader = new (0, _chunk4XLYCT5Qcjs.Draft17BufferReader)(raw);
|
|
1297
1297
|
w.writeVarInt(tmpReader.readVarInt());
|
|
1298
1298
|
} else {
|
|
1299
|
-
const raw =
|
|
1299
|
+
const raw = _chunk4XLYCT5Qcjs.hexToBytes.call(void 0, u.raw_hex);
|
|
1300
1300
|
w.writeVarInt(BigInt(raw.byteLength));
|
|
1301
1301
|
w.writeBytes(raw);
|
|
1302
1302
|
}
|
|
@@ -1333,13 +1333,13 @@ function decodeTrackProperties(reader, payloadEnd) {
|
|
|
1333
1333
|
} else if (propType === TPROP_DYNAMIC_GROUPS) {
|
|
1334
1334
|
result.dynamic_groups = value;
|
|
1335
1335
|
} else {
|
|
1336
|
-
const tmpWriter = new (0,
|
|
1336
|
+
const tmpWriter = new (0, _chunk4XLYCT5Qcjs.Draft17BufferWriter)(16);
|
|
1337
1337
|
tmpWriter.writeVarInt(value);
|
|
1338
1338
|
const raw = tmpWriter.finish();
|
|
1339
1339
|
unknown.push({
|
|
1340
1340
|
id: `0x${propType.toString(16)}`,
|
|
1341
1341
|
length: raw.byteLength,
|
|
1342
|
-
raw_hex:
|
|
1342
|
+
raw_hex: _chunk4XLYCT5Qcjs.bytesToHex.call(void 0, raw)
|
|
1343
1343
|
});
|
|
1344
1344
|
}
|
|
1345
1345
|
} else {
|
|
@@ -1351,7 +1351,7 @@ function decodeTrackProperties(reader, payloadEnd) {
|
|
|
1351
1351
|
unknown.push({
|
|
1352
1352
|
id: `0x${propType.toString(16)}`,
|
|
1353
1353
|
length,
|
|
1354
|
-
raw_hex:
|
|
1354
|
+
raw_hex: _chunk4XLYCT5Qcjs.bytesToHex.call(void 0, bytes)
|
|
1355
1355
|
});
|
|
1356
1356
|
}
|
|
1357
1357
|
}
|
|
@@ -1575,7 +1575,7 @@ function decodeFetchPayload(r) {
|
|
|
1575
1575
|
const fetch_type = r.readVarInt();
|
|
1576
1576
|
const ft = Number(fetch_type);
|
|
1577
1577
|
if (ft < 1 || ft > 3) {
|
|
1578
|
-
throw new (0,
|
|
1578
|
+
throw new (0, _chunk4XLYCT5Qcjs.DecodeError)("CONSTRAINT_VIOLATION", `Invalid fetch_type: ${ft}`, r.offset);
|
|
1579
1579
|
}
|
|
1580
1580
|
let standalone;
|
|
1581
1581
|
let joining;
|
|
@@ -1660,13 +1660,13 @@ function encodeMessage(message) {
|
|
|
1660
1660
|
if (typeId === void 0) {
|
|
1661
1661
|
throw new Error(`Unknown message type: ${message.type}`);
|
|
1662
1662
|
}
|
|
1663
|
-
const payloadWriter = new (0,
|
|
1663
|
+
const payloadWriter = new (0, _chunk4XLYCT5Qcjs.Draft17BufferWriter)();
|
|
1664
1664
|
encodePayload(message, payloadWriter);
|
|
1665
1665
|
const payload = payloadWriter.finishView();
|
|
1666
1666
|
if (payload.byteLength > 65535) {
|
|
1667
1667
|
throw new Error(`Payload too large for 16-bit length: ${payload.byteLength}`);
|
|
1668
1668
|
}
|
|
1669
|
-
const writer = new (0,
|
|
1669
|
+
const writer = new (0, _chunk4XLYCT5Qcjs.Draft17BufferWriter)(payload.byteLength + 16);
|
|
1670
1670
|
writer.writeVarInt(typeId);
|
|
1671
1671
|
writer.writeUint8(payload.byteLength >> 8 & 255);
|
|
1672
1672
|
writer.writeUint8(payload.byteLength & 255);
|
|
@@ -1719,7 +1719,7 @@ function encodePayload(msg, w) {
|
|
|
1719
1719
|
}
|
|
1720
1720
|
function decodeMessage(bytes) {
|
|
1721
1721
|
try {
|
|
1722
|
-
const reader = new (0,
|
|
1722
|
+
const reader = new (0, _chunk4XLYCT5Qcjs.Draft17BufferReader)(bytes);
|
|
1723
1723
|
const typeId = reader.readVarInt();
|
|
1724
1724
|
const lenHi = reader.readUint8();
|
|
1725
1725
|
const lenLo = reader.readUint8();
|
|
@@ -1727,7 +1727,7 @@ function decodeMessage(bytes) {
|
|
|
1727
1727
|
const payloadStart = reader.offset;
|
|
1728
1728
|
const _payloadEnd = payloadStart + payloadLength;
|
|
1729
1729
|
const payloadBytes = reader.readBytes(payloadLength);
|
|
1730
|
-
const payloadReader = new (0,
|
|
1730
|
+
const payloadReader = new (0, _chunk4XLYCT5Qcjs.Draft17BufferReader)(payloadBytes);
|
|
1731
1731
|
let message;
|
|
1732
1732
|
if (typeId === MSG_SETUP) {
|
|
1733
1733
|
message = decodeSetupPayload(payloadReader, payloadLength);
|
|
@@ -1768,7 +1768,7 @@ function decodeMessage(bytes) {
|
|
|
1768
1768
|
} else {
|
|
1769
1769
|
return {
|
|
1770
1770
|
ok: false,
|
|
1771
|
-
error: new (0,
|
|
1771
|
+
error: new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
1772
1772
|
"UNKNOWN_MESSAGE_TYPE",
|
|
1773
1773
|
`Unknown message type ID: 0x${typeId.toString(16)}`,
|
|
1774
1774
|
0
|
|
@@ -1777,7 +1777,7 @@ function decodeMessage(bytes) {
|
|
|
1777
1777
|
}
|
|
1778
1778
|
return { ok: true, value: message, bytesRead: reader.offset };
|
|
1779
1779
|
} catch (e) {
|
|
1780
|
-
if (e instanceof
|
|
1780
|
+
if (e instanceof _chunk4XLYCT5Qcjs.DecodeError) {
|
|
1781
1781
|
return { ok: false, error: e };
|
|
1782
1782
|
}
|
|
1783
1783
|
throw e;
|
|
@@ -1812,7 +1812,7 @@ function createStreamDecoder() {
|
|
|
1812
1812
|
flush(controller) {
|
|
1813
1813
|
if (offset < buffer.length) {
|
|
1814
1814
|
controller.error(
|
|
1815
|
-
new (0,
|
|
1815
|
+
new (0, _chunk4XLYCT5Qcjs.DecodeError)("UNEXPECTED_END", "Stream ended with incomplete message data", 0)
|
|
1816
1816
|
);
|
|
1817
1817
|
}
|
|
1818
1818
|
}
|