moqtail 0.13.0 → 0.15.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 +43 -0
- package/dist/{client-DahXR3l4.cjs → client-BviQ20Lc.cjs} +1297 -699
- package/dist/{client-BzncAN14.mjs → client-zi0lmuIL.mjs} +1284 -716
- package/dist/client.cjs +6 -1
- package/dist/client.d.cts +596 -333
- package/dist/client.d.mts +596 -333
- package/dist/client.mjs +2 -2
- package/dist/{index-C8pNnaj0.d.cts → index-BY6e1obL.d.cts} +645 -372
- package/dist/{index-C8pNnaj0.d.mts → index-BY6e1obL.d.mts} +645 -372
- package/dist/index.cjs +31 -16
- package/dist/index.d.cts +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +3 -3
- package/dist/model.cjs +1288 -571
- package/dist/model.d.cts +2 -2
- package/dist/model.d.mts +2 -2
- package/dist/model.mjs +1264 -557
- package/package.json +1 -1
package/dist/model.cjs
CHANGED
|
@@ -214,7 +214,7 @@ var TerminationError = class extends MOQtailError {
|
|
|
214
214
|
* limitations under the License.
|
|
215
215
|
*/
|
|
216
216
|
const MAX_VALUE_LENGTH = 2 ** 16 - 1;
|
|
217
|
-
const MAX_U64 = 2n ** 64n - 1n;
|
|
217
|
+
const MAX_U64$2 = 2n ** 64n - 1n;
|
|
218
218
|
/**
|
|
219
219
|
* @public
|
|
220
220
|
* Represents a key-value pair for MOQT protocol parameters.
|
|
@@ -223,6 +223,8 @@ const MAX_U64 = 2n ** 64n - 1n;
|
|
|
223
223
|
* - If `typeValue` is **odd**, the value is a binary blob (`Uint8Array`) with a maximum length of 65535 bytes.
|
|
224
224
|
*
|
|
225
225
|
* Use {@link KeyValuePair.tryNewVarInt} for varint pairs and {@link KeyValuePair.tryNewBytes} for blob pairs.
|
|
226
|
+
* A Type whose own namespace fixes the value encoding overrides the parity rule; see
|
|
227
|
+
* {@link KeyValuePair.newBytes}.
|
|
226
228
|
*/
|
|
227
229
|
var KeyValuePair = class KeyValuePair {
|
|
228
230
|
/**
|
|
@@ -261,6 +263,17 @@ var KeyValuePair = class KeyValuePair {
|
|
|
261
263
|
return new KeyValuePair(tv, v);
|
|
262
264
|
}
|
|
263
265
|
/**
|
|
266
|
+
* Creates a varint KeyValuePair for a Type whose namespace defines a numeric value
|
|
267
|
+
* regardless of parity. Prefer {@link KeyValuePair.tryNewVarInt}.
|
|
268
|
+
* @param typeValue - The key/type identifier; parity is not checked.
|
|
269
|
+
* @param value - The varint value.
|
|
270
|
+
*/
|
|
271
|
+
static newVarInt(typeValue, value) {
|
|
272
|
+
const tv = typeof typeValue === "number" ? BigInt(typeValue) : typeValue;
|
|
273
|
+
const v = typeof value === "number" ? BigInt(value) : value;
|
|
274
|
+
return new KeyValuePair(tv, v);
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
264
277
|
* Creates a new blob KeyValuePair.
|
|
265
278
|
* @param typeValue - Must be odd.
|
|
266
279
|
* @param value - The binary blob value.
|
|
@@ -271,8 +284,19 @@ var KeyValuePair = class KeyValuePair {
|
|
|
271
284
|
static tryNewBytes(typeValue, value) {
|
|
272
285
|
const tv = typeof typeValue === "number" ? BigInt(typeValue) : typeValue;
|
|
273
286
|
if (tv % 2n === 0n) throw new KeyValueFormattingError("KeyValuePair.tryNewBytes");
|
|
287
|
+
return KeyValuePair.newBytes(tv, value);
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Creates a blob KeyValuePair for a Type whose namespace defines a byte-string
|
|
291
|
+
* value regardless of parity. Prefer {@link KeyValuePair.tryNewBytes}.
|
|
292
|
+
* @param typeValue - The key/type identifier; parity is not checked.
|
|
293
|
+
* @param value - The binary blob value.
|
|
294
|
+
* @throws LengthExceedsMaxError if value length exceeds 65535 bytes.
|
|
295
|
+
*/
|
|
296
|
+
static newBytes(typeValue, value) {
|
|
297
|
+
const tv = typeof typeValue === "number" ? BigInt(typeValue) : typeValue;
|
|
274
298
|
const len = value.length;
|
|
275
|
-
if (len > MAX_VALUE_LENGTH) throw new LengthExceedsMaxError("KeyValuePair.
|
|
299
|
+
if (len > MAX_VALUE_LENGTH) throw new LengthExceedsMaxError("KeyValuePair.newBytes", MAX_VALUE_LENGTH, len);
|
|
276
300
|
return new KeyValuePair(tv, value);
|
|
277
301
|
}
|
|
278
302
|
/**
|
|
@@ -321,7 +345,7 @@ var KeyValuePair = class KeyValuePair {
|
|
|
321
345
|
static deserializeDelta(buf, prevType) {
|
|
322
346
|
const deltaType = buf.getVI();
|
|
323
347
|
const typeValue = prevType + deltaType;
|
|
324
|
-
if (typeValue > MAX_U64) throw new ProtocolViolationError("KeyValuePair.deserializeDelta", `previous type ${prevType} plus delta type ${deltaType} exceeds 2^64 - 1`);
|
|
348
|
+
if (typeValue > MAX_U64$2) throw new ProtocolViolationError("KeyValuePair.deserializeDelta", `previous type ${prevType} plus delta type ${deltaType} exceeds 2^64 - 1`);
|
|
325
349
|
return KeyValuePair.deserializeValue(buf, typeValue);
|
|
326
350
|
}
|
|
327
351
|
/**
|
|
@@ -335,12 +359,20 @@ var KeyValuePair = class KeyValuePair {
|
|
|
335
359
|
if (typeValue % 2n === 0n) {
|
|
336
360
|
const value = buf.getVI();
|
|
337
361
|
return new KeyValuePair(typeValue, value);
|
|
338
|
-
} else {
|
|
339
|
-
const len = buf.getNumberVI();
|
|
340
|
-
if (len > MAX_VALUE_LENGTH) throw new LengthExceedsMaxError("KeyValuePair.deserialize", MAX_VALUE_LENGTH, len);
|
|
341
|
-
const value = buf.getBytes(len);
|
|
342
|
-
return new KeyValuePair(typeValue, value);
|
|
343
362
|
}
|
|
363
|
+
return KeyValuePair.deserializeBytesValue(buf, typeValue);
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Reads a length-prefixed byte-string Value, independent of Type parity.
|
|
367
|
+
* @param buf - The buffer to read from.
|
|
368
|
+
* @param typeValue - The already-decoded Type.
|
|
369
|
+
* @throws LengthExceedsMaxError if the length exceeds 65535 bytes.
|
|
370
|
+
*/
|
|
371
|
+
static deserializeBytesValue(buf, typeValue) {
|
|
372
|
+
const len = buf.getNumberVI();
|
|
373
|
+
if (len > MAX_VALUE_LENGTH) throw new LengthExceedsMaxError("KeyValuePair.deserializeBytesValue", MAX_VALUE_LENGTH, len);
|
|
374
|
+
const value = buf.getBytes(len);
|
|
375
|
+
return new KeyValuePair(typeValue, value);
|
|
344
376
|
}
|
|
345
377
|
/**
|
|
346
378
|
* Checks if this pair is equal to another.
|
|
@@ -403,20 +435,20 @@ function deserializeKvpListUntilEmpty(buf) {
|
|
|
403
435
|
return items;
|
|
404
436
|
}
|
|
405
437
|
/**
|
|
406
|
-
* Checks if the KeyValuePair
|
|
438
|
+
* Checks if the KeyValuePair carries a varint value.
|
|
407
439
|
* @param pair - The KeyValuePair to check.
|
|
408
440
|
* @returns True if value is a varint.
|
|
409
441
|
*/
|
|
410
442
|
function isVarInt(pair) {
|
|
411
|
-
return pair.
|
|
443
|
+
return typeof pair.value === "bigint";
|
|
412
444
|
}
|
|
413
445
|
/**
|
|
414
|
-
* Checks if the KeyValuePair
|
|
446
|
+
* Checks if the KeyValuePair carries a blob value.
|
|
415
447
|
* @param pair - The KeyValuePair to check.
|
|
416
448
|
* @returns True if value is a Uint8Array.
|
|
417
449
|
*/
|
|
418
450
|
function isBytes(pair) {
|
|
419
|
-
return pair.
|
|
451
|
+
return pair.value instanceof Uint8Array;
|
|
420
452
|
}
|
|
421
453
|
//#endregion
|
|
422
454
|
//#region src/model/common/location.ts
|
|
@@ -812,12 +844,12 @@ let TerminationCode = /* @__PURE__ */ function(TerminationCode) {
|
|
|
812
844
|
TerminationCode[TerminationCode["DATA_STREAM_TIMEOUT"] = 18] = "DATA_STREAM_TIMEOUT";
|
|
813
845
|
TerminationCode[TerminationCode["AUTH_TOKEN_CACHE_OVERFLOW"] = 19] = "AUTH_TOKEN_CACHE_OVERFLOW";
|
|
814
846
|
TerminationCode[TerminationCode["DUPLICATE_AUTH_TOKEN_ALIAS"] = 20] = "DUPLICATE_AUTH_TOKEN_ALIAS";
|
|
815
|
-
TerminationCode[TerminationCode["VERSION_NEGOTIATION_FAILED"] = 21] = "VERSION_NEGOTIATION_FAILED";
|
|
816
847
|
TerminationCode[TerminationCode["MALFORMED_AUTH_TOKEN"] = 22] = "MALFORMED_AUTH_TOKEN";
|
|
817
848
|
TerminationCode[TerminationCode["UNKNOWN_AUTH_TOKEN_ALIAS"] = 23] = "UNKNOWN_AUTH_TOKEN_ALIAS";
|
|
818
849
|
TerminationCode[TerminationCode["EXPIRED_AUTH_TOKEN"] = 24] = "EXPIRED_AUTH_TOKEN";
|
|
819
850
|
TerminationCode[TerminationCode["INVALID_AUTHORITY"] = 25] = "INVALID_AUTHORITY";
|
|
820
851
|
TerminationCode[TerminationCode["MALFORMED_AUTHORITY"] = 26] = "MALFORMED_AUTHORITY";
|
|
852
|
+
TerminationCode[TerminationCode["TOO_MANY_REQUEST_UPDATES"] = 27] = "TOO_MANY_REQUEST_UPDATES";
|
|
821
853
|
return TerminationCode;
|
|
822
854
|
}({});
|
|
823
855
|
(function(_TerminationCode) {
|
|
@@ -837,12 +869,12 @@ let TerminationCode = /* @__PURE__ */ function(TerminationCode) {
|
|
|
837
869
|
case 18: return 18;
|
|
838
870
|
case 19: return 19;
|
|
839
871
|
case 20: return 20;
|
|
840
|
-
case 21: return 21;
|
|
841
872
|
case 22: return 22;
|
|
842
873
|
case 23: return 23;
|
|
843
874
|
case 24: return 24;
|
|
844
875
|
case 25: return 25;
|
|
845
876
|
case 26: return 26;
|
|
877
|
+
case 27: return 27;
|
|
846
878
|
default: throw new InvalidTypeError("TerminationCode.tryFrom", `Unknown termination code: ${code}`);
|
|
847
879
|
}
|
|
848
880
|
}
|
|
@@ -867,8 +899,7 @@ let TerminationCode = /* @__PURE__ */ function(TerminationCode) {
|
|
|
867
899
|
*/
|
|
868
900
|
/**
|
|
869
901
|
* @public
|
|
870
|
-
* Codes carried when resetting a request stream or sending STOP_SENDING on one
|
|
871
|
-
* draft-18 §3.3.3.
|
|
902
|
+
* Codes carried when resetting a request stream or sending STOP_SENDING on one.
|
|
872
903
|
*
|
|
873
904
|
* A separate registry from {@link (RequestErrorCode:enum)}, which disagrees with it on
|
|
874
905
|
* the same names: `GOING_AWAY` is `0x4` here but `0x6` there.
|
|
@@ -923,7 +954,7 @@ let StreamResetCode = /* @__PURE__ */ function(StreamResetCode) {
|
|
|
923
954
|
*/
|
|
924
955
|
/**
|
|
925
956
|
* @public
|
|
926
|
-
* Object datagram types for MOQT objects
|
|
957
|
+
* Object datagram types for MOQT objects.
|
|
927
958
|
*
|
|
928
959
|
* Type bit layout (form 0b00X0XXXX):
|
|
929
960
|
* - Bit 0 (0x01): PROPERTIES - Properties field present
|
|
@@ -1227,7 +1258,7 @@ let ObjectStatus = /* @__PURE__ */ function(ObjectStatus) {
|
|
|
1227
1258
|
* limitations under the License.
|
|
1228
1259
|
*/
|
|
1229
1260
|
/**
|
|
1230
|
-
* Represents a unified OBJECT_DATAGRAM message
|
|
1261
|
+
* Represents a unified OBJECT_DATAGRAM message.
|
|
1231
1262
|
*
|
|
1232
1263
|
* Type bit layout (form 0b00X0XXXX):
|
|
1233
1264
|
* - Bit 0 (0x01): PROPERTIES
|
|
@@ -1357,53 +1388,6 @@ var FetchHeader = class FetchHeader {
|
|
|
1357
1388
|
}
|
|
1358
1389
|
};
|
|
1359
1390
|
//#endregion
|
|
1360
|
-
//#region src/model/common/grease.ts
|
|
1361
|
-
/**
|
|
1362
|
-
* Copyright 2026 The MOQtail Authors
|
|
1363
|
-
*
|
|
1364
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1365
|
-
* you may not use this file except in compliance with the License.
|
|
1366
|
-
* You may obtain a copy of the License at
|
|
1367
|
-
*
|
|
1368
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1369
|
-
*
|
|
1370
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1371
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1372
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1373
|
-
* See the License for the specific language governing permissions and
|
|
1374
|
-
* limitations under the License.
|
|
1375
|
-
*/
|
|
1376
|
-
/**
|
|
1377
|
-
* GREASE reservations (§14). Values matching `0x7f * N + 0x9D` are reserved across
|
|
1378
|
-
* several registries (Setup Options, Properties, error codes) so peers can emit them
|
|
1379
|
-
* to exercise unknown-value handling. Receivers treat them like any other unknown
|
|
1380
|
-
* value: ignore, never fatal.
|
|
1381
|
-
*/
|
|
1382
|
-
/** Step between successive GREASE values. */
|
|
1383
|
-
const GREASE_STEP = 127n;
|
|
1384
|
-
/** The smallest GREASE value (N = 0). */
|
|
1385
|
-
const GREASE_BASE = 157n;
|
|
1386
|
-
/** The largest GREASE value that still fits a varint, i.e. `0x3fffffffffffffde`. */
|
|
1387
|
-
const GREASE_MAX = 4611686018427387870n;
|
|
1388
|
-
/**
|
|
1389
|
-
* @public
|
|
1390
|
-
* True if `value` is a reserved GREASE value, i.e. `0x7f * N + 0x9D` for some
|
|
1391
|
-
* non-negative `N`.
|
|
1392
|
-
*/
|
|
1393
|
-
function isGrease(value) {
|
|
1394
|
-
const v = BigInt(value);
|
|
1395
|
-
return v >= 157n && (v - 157n) % 127n === 0n;
|
|
1396
|
-
}
|
|
1397
|
-
/**
|
|
1398
|
-
* @public
|
|
1399
|
-
* The `N`-th GREASE value, `0x7f * N + 0x9D`, or undefined if it would exceed what a
|
|
1400
|
-
* varint can carry (the pattern is capped at `0x3fffffffffffffde`).
|
|
1401
|
-
*/
|
|
1402
|
-
function greaseValue(n) {
|
|
1403
|
-
const value = GREASE_STEP * BigInt(n) + GREASE_BASE;
|
|
1404
|
-
return value > GREASE_MAX ? void 0 : value;
|
|
1405
|
-
}
|
|
1406
|
-
//#endregion
|
|
1407
1391
|
//#region src/model/control/constant.ts
|
|
1408
1392
|
/**
|
|
1409
1393
|
* Copyright 2025 The MOQtail Authors
|
|
@@ -1423,21 +1407,10 @@ function greaseValue(n) {
|
|
|
1423
1407
|
/**
|
|
1424
1408
|
* Protocol string array exchanged in wt-available-protocols header
|
|
1425
1409
|
*/
|
|
1426
|
-
const SUPPORTED_VERSIONS = ["moqt-
|
|
1410
|
+
const SUPPORTED_VERSIONS = ["moqt-22"];
|
|
1427
1411
|
/**
|
|
1428
1412
|
* @public
|
|
1429
|
-
* Control message types
|
|
1430
|
-
*
|
|
1431
|
-
* The comment on each member is the Stream column: `Control` is the control stream
|
|
1432
|
-
* (§3.3), `Request` a bidirectional request stream, and `First` means the message MUST
|
|
1433
|
-
* be the first on a new request stream.
|
|
1434
|
-
*
|
|
1435
|
-
* Table 5 reserves `0x01` (SETUP for version 00), `0x40`/`0x41` (CLIENT_SETUP /
|
|
1436
|
-
* SERVER_SETUP for versions 10 and below) and `0x20`/`0x21` (CLIENT_SETUP /
|
|
1437
|
-
* SERVER_SETUP for versions 16 and below — folded into Setup by #256). All five stay
|
|
1438
|
-
* in the enum as documentation, but `tryFrom` rejects every RESERVED codepoint, which
|
|
1439
|
-
* is what §10 requires — an endpoint receiving an unknown message type MUST close the
|
|
1440
|
-
* session.
|
|
1413
|
+
* Control message types.
|
|
1441
1414
|
*/
|
|
1442
1415
|
let ControlMessageType = /* @__PURE__ */ function(ControlMessageType) {
|
|
1443
1416
|
ControlMessageType[ControlMessageType["ReservedSetupV00"] = 1] = "ReservedSetupV00";
|
|
@@ -1463,8 +1436,7 @@ let ControlMessageType = /* @__PURE__ */ function(ControlMessageType) {
|
|
|
1463
1436
|
ControlMessageType[ControlMessageType["SubscribeTracks"] = 81] = "SubscribeTracks";
|
|
1464
1437
|
ControlMessageType[ControlMessageType["Publish"] = 29] = "Publish";
|
|
1465
1438
|
ControlMessageType[ControlMessageType["PublishOk"] = 30] = "PublishOk";
|
|
1466
|
-
ControlMessageType[ControlMessageType["
|
|
1467
|
-
ControlMessageType[ControlMessageType["Switch"] = 34] = "Switch";
|
|
1439
|
+
ControlMessageType[ControlMessageType["PublishSkipped"] = 15] = "PublishSkipped";
|
|
1468
1440
|
return ControlMessageType;
|
|
1469
1441
|
}({});
|
|
1470
1442
|
(function(_ControlMessageType) {
|
|
@@ -1521,48 +1493,45 @@ let ControlMessageType = /* @__PURE__ */ function(ControlMessageType) {
|
|
|
1521
1493
|
})(ControlMessageType || (ControlMessageType = {}));
|
|
1522
1494
|
/**
|
|
1523
1495
|
* @public
|
|
1524
|
-
*
|
|
1525
|
-
*/
|
|
1526
|
-
let
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1496
|
+
* Which fields of a LOCATION_FILTER follow its type, and how they are read.
|
|
1497
|
+
*/
|
|
1498
|
+
let LocationFilterType = /* @__PURE__ */ function(LocationFilterType) {
|
|
1499
|
+
/** No filter: every Object passes. */
|
|
1500
|
+
LocationFilterType[LocationFilterType["None"] = 0] = "None";
|
|
1501
|
+
/** Starts StartGroup groups before the Next Group. */
|
|
1502
|
+
LocationFilterType[LocationFilterType["RelativeStart"] = 1] = "RelativeStart";
|
|
1503
|
+
LocationFilterType[LocationFilterType["AbsoluteStart"] = 2] = "AbsoluteStart";
|
|
1504
|
+
/** Ends with the last Object of the End Group. */
|
|
1505
|
+
LocationFilterType[LocationFilterType["AbsoluteStartGroupEnd"] = 3] = "AbsoluteStartGroupEnd";
|
|
1506
|
+
/** Ends with End Object of the End Group. */
|
|
1507
|
+
LocationFilterType[LocationFilterType["AbsoluteRange"] = 4] = "AbsoluteRange";
|
|
1508
|
+
/** Starts at the Object after the Largest Object. */
|
|
1509
|
+
LocationFilterType[LocationFilterType["NextObject"] = 5] = "NextObject";
|
|
1510
|
+
return LocationFilterType;
|
|
1532
1511
|
}({});
|
|
1533
|
-
(function(
|
|
1512
|
+
(function(_LocationFilterType) {
|
|
1534
1513
|
function tryFrom(v) {
|
|
1535
1514
|
switch (v) {
|
|
1515
|
+
case 0n: return 0;
|
|
1536
1516
|
case 1n: return 1;
|
|
1537
1517
|
case 2n: return 2;
|
|
1538
1518
|
case 3n: return 3;
|
|
1539
1519
|
case 4n: return 4;
|
|
1540
|
-
|
|
1520
|
+
case 5n: return 5;
|
|
1521
|
+
default: throw new InvalidEnumValue("LocationFilterType.tryFrom", v);
|
|
1541
1522
|
}
|
|
1542
1523
|
}
|
|
1543
|
-
|
|
1544
|
-
})(
|
|
1524
|
+
_LocationFilterType.tryFrom = tryFrom;
|
|
1525
|
+
})(LocationFilterType || (LocationFilterType = {}));
|
|
1545
1526
|
/**
|
|
1546
1527
|
* @public
|
|
1547
|
-
*
|
|
1528
|
+
* Switch modes for subscription switching requests.
|
|
1548
1529
|
*/
|
|
1549
|
-
let
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
return FetchType;
|
|
1530
|
+
let SwitchMode = /* @__PURE__ */ function(SwitchMode) {
|
|
1531
|
+
SwitchMode[SwitchMode["Hard"] = 0] = "Hard";
|
|
1532
|
+
SwitchMode[SwitchMode["Soft"] = 1] = "Soft";
|
|
1533
|
+
return SwitchMode;
|
|
1554
1534
|
}({});
|
|
1555
|
-
(function(_FetchType) {
|
|
1556
|
-
function tryFrom(v) {
|
|
1557
|
-
switch (v) {
|
|
1558
|
-
case 1n: return 1;
|
|
1559
|
-
case 2n: return 2;
|
|
1560
|
-
case 3n: return 3;
|
|
1561
|
-
default: throw new InvalidEnumValue("FetchType.tryFrom", v);
|
|
1562
|
-
}
|
|
1563
|
-
}
|
|
1564
|
-
_FetchType.tryFrom = tryFrom;
|
|
1565
|
-
})(FetchType || (FetchType = {}));
|
|
1566
1535
|
/**
|
|
1567
1536
|
* @public
|
|
1568
1537
|
* Group ordering options for object delivery.
|
|
@@ -1617,7 +1586,6 @@ let PublishDoneStatusCode = /* @__PURE__ */ function(PublishDoneStatusCode) {
|
|
|
1617
1586
|
PublishDoneStatusCode[PublishDoneStatusCode["InternalError"] = 0] = "InternalError";
|
|
1618
1587
|
PublishDoneStatusCode[PublishDoneStatusCode["Unauthorized"] = 1] = "Unauthorized";
|
|
1619
1588
|
PublishDoneStatusCode[PublishDoneStatusCode["TrackEnded"] = 2] = "TrackEnded";
|
|
1620
|
-
PublishDoneStatusCode[PublishDoneStatusCode["SubscriptionEnded"] = 3] = "SubscriptionEnded";
|
|
1621
1589
|
PublishDoneStatusCode[PublishDoneStatusCode["GoingAway"] = 4] = "GoingAway";
|
|
1622
1590
|
PublishDoneStatusCode[PublishDoneStatusCode["TooFarBehind"] = 5] = "TooFarBehind";
|
|
1623
1591
|
PublishDoneStatusCode[PublishDoneStatusCode["Expired"] = 6] = "Expired";
|
|
@@ -1632,7 +1600,6 @@ let PublishDoneStatusCode = /* @__PURE__ */ function(PublishDoneStatusCode) {
|
|
|
1632
1600
|
case 0n: return 0;
|
|
1633
1601
|
case 1n: return 1;
|
|
1634
1602
|
case 2n: return 2;
|
|
1635
|
-
case 3n: return 3;
|
|
1636
1603
|
case 4n: return 4;
|
|
1637
1604
|
case 5n: return 5;
|
|
1638
1605
|
case 6n: return 6;
|
|
@@ -1671,13 +1638,14 @@ let RequestErrorCode = /* @__PURE__ */ function(RequestErrorCode) {
|
|
|
1671
1638
|
RequestErrorCode[RequestErrorCode["DoesNotExist"] = 16] = "DoesNotExist";
|
|
1672
1639
|
RequestErrorCode[RequestErrorCode["InvalidRange"] = 17] = "InvalidRange";
|
|
1673
1640
|
RequestErrorCode[RequestErrorCode["MalformedTrack"] = 18] = "MalformedTrack";
|
|
1674
|
-
RequestErrorCode[RequestErrorCode["DuplicateSubscription"] = 25] = "DuplicateSubscription";
|
|
1675
1641
|
RequestErrorCode[RequestErrorCode["Uninterested"] = 32] = "Uninterested";
|
|
1676
1642
|
RequestErrorCode[RequestErrorCode["PrefixOverlap"] = 48] = "PrefixOverlap";
|
|
1677
1643
|
RequestErrorCode[RequestErrorCode["NamespaceTooLarge"] = 49] = "NamespaceTooLarge";
|
|
1678
|
-
RequestErrorCode[RequestErrorCode["
|
|
1644
|
+
RequestErrorCode[RequestErrorCode["InvalidSwitch"] = 50] = "InvalidSwitch";
|
|
1679
1645
|
RequestErrorCode[RequestErrorCode["UnsupportedExtension"] = 51] = "UnsupportedExtension";
|
|
1680
1646
|
RequestErrorCode[RequestErrorCode["Redirect"] = 52] = "Redirect";
|
|
1647
|
+
RequestErrorCode[RequestErrorCode["ConflictingFilters"] = 53] = "ConflictingFilters";
|
|
1648
|
+
RequestErrorCode[RequestErrorCode["InvalidFilter"] = 54] = "InvalidFilter";
|
|
1681
1649
|
return RequestErrorCode;
|
|
1682
1650
|
}({});
|
|
1683
1651
|
(function(_RequestErrorCode) {
|
|
@@ -1694,13 +1662,14 @@ let RequestErrorCode = /* @__PURE__ */ function(RequestErrorCode) {
|
|
|
1694
1662
|
case 16n: return 16;
|
|
1695
1663
|
case 17n: return 17;
|
|
1696
1664
|
case 18n: return 18;
|
|
1697
|
-
case 25n: return 25;
|
|
1698
1665
|
case 32n: return 32;
|
|
1699
1666
|
case 48n: return 48;
|
|
1700
1667
|
case 49n: return 49;
|
|
1701
1668
|
case 50n: return 50;
|
|
1702
1669
|
case 51n: return 51;
|
|
1703
1670
|
case 52n: return 52;
|
|
1671
|
+
case 53n: return 53;
|
|
1672
|
+
case 54n: return 54;
|
|
1704
1673
|
default: throw new InvalidEnumValue("RequestErrorCode.tryFrom", v);
|
|
1705
1674
|
}
|
|
1706
1675
|
}
|
|
@@ -1743,13 +1712,21 @@ const SUBGROUP_MODE_PRIOR_PLUS_ONE = 2;
|
|
|
1743
1712
|
const SUBGROUP_MODE_PRESENT = 3;
|
|
1744
1713
|
const END_OF_NON_EXISTENT_RANGE = 140n;
|
|
1745
1714
|
const END_OF_UNKNOWN_RANGE = 268n;
|
|
1715
|
+
const END_OF_TIMED_OUT_RANGE = 524n;
|
|
1746
1716
|
const MAX_VARINT = 2n ** 64n - 1n;
|
|
1747
1717
|
/**
|
|
1748
|
-
* Kind discriminator for End-of-Range markers
|
|
1718
|
+
* Kind discriminator for End-of-Range markers.
|
|
1749
1719
|
*/
|
|
1750
1720
|
let EndOfRangeKind = /* @__PURE__ */ function(EndOfRangeKind) {
|
|
1721
|
+
/** Serialization Flags = 0x8C: all objects in the range are known not to exist. */
|
|
1751
1722
|
EndOfRangeKind[EndOfRangeKind["NonExistent"] = 140] = "NonExistent";
|
|
1723
|
+
/** Serialization Flags = 0x10C: the range is cache-unknown. */
|
|
1752
1724
|
EndOfRangeKind[EndOfRangeKind["Unknown"] = 268] = "Unknown";
|
|
1725
|
+
/**
|
|
1726
|
+
* Serialization Flags = 0x20C: the range timed out, e.g. a relay ran out of its
|
|
1727
|
+
* fill budget before it could retrieve it.
|
|
1728
|
+
*/
|
|
1729
|
+
EndOfRangeKind[EndOfRangeKind["TimedOut"] = 524] = "TimedOut";
|
|
1753
1730
|
return EndOfRangeKind;
|
|
1754
1731
|
}({});
|
|
1755
1732
|
/**
|
|
@@ -1784,11 +1761,20 @@ var FetchObject = class FetchObject {
|
|
|
1784
1761
|
return this.location.object;
|
|
1785
1762
|
}
|
|
1786
1763
|
/**
|
|
1787
|
-
*
|
|
1788
|
-
*
|
|
1764
|
+
* What the entry after this one is encoded against, given what this one was
|
|
1765
|
+
* encoded against (`prev`).
|
|
1766
|
+
*
|
|
1767
|
+
* After an Object, that is the Object itself. After an End of Range marker, it is
|
|
1768
|
+
* the marker's Group and Object IDs, with the Subgroup ID and priority still those
|
|
1769
|
+
* of the last Object before the marker, or none if no Object came before it.
|
|
1789
1770
|
*/
|
|
1790
|
-
|
|
1791
|
-
if (this.kind === "end_of_range") return
|
|
1771
|
+
nextContext(prev) {
|
|
1772
|
+
if (this.kind === "end_of_range") return {
|
|
1773
|
+
groupId: this.groupId,
|
|
1774
|
+
subgroupId: prev?.subgroupId ?? null,
|
|
1775
|
+
objectId: this.objectId,
|
|
1776
|
+
publisherPriority: prev?.publisherPriority ?? null
|
|
1777
|
+
};
|
|
1792
1778
|
return {
|
|
1793
1779
|
groupId: this.groupId,
|
|
1794
1780
|
subgroupId: this.subgroupId,
|
|
@@ -1805,7 +1791,7 @@ var FetchObject = class FetchObject {
|
|
|
1805
1791
|
serialize(prev, groupOrder = 0) {
|
|
1806
1792
|
const buf = new ByteBuffer();
|
|
1807
1793
|
if (this.kind === "end_of_range") {
|
|
1808
|
-
buf.putVI(this.endOfRange
|
|
1794
|
+
buf.putVI(BigInt(this.endOfRange));
|
|
1809
1795
|
buf.putVI(this.groupId);
|
|
1810
1796
|
buf.putVI(this.objectId);
|
|
1811
1797
|
return buf.freeze();
|
|
@@ -1831,7 +1817,7 @@ var FetchObject = class FetchObject {
|
|
|
1831
1817
|
let subgroupMode;
|
|
1832
1818
|
if (isDatagram || this.subgroupId === 0n) subgroupMode = SUBGROUP_MODE_ZERO;
|
|
1833
1819
|
else if (prev && prev.subgroupId === this.subgroupId) subgroupMode = SUBGROUP_MODE_PRIOR;
|
|
1834
|
-
else if (prev && prev.subgroupId + 1n === this.subgroupId) subgroupMode = SUBGROUP_MODE_PRIOR_PLUS_ONE;
|
|
1820
|
+
else if (prev && prev.subgroupId !== null && prev.subgroupId + 1n === this.subgroupId) subgroupMode = SUBGROUP_MODE_PRIOR_PLUS_ONE;
|
|
1835
1821
|
else subgroupMode = SUBGROUP_MODE_PRESENT;
|
|
1836
1822
|
let flags = subgroupMode & FLAG_SUBGROUP_MODE_MASK;
|
|
1837
1823
|
if (objectDelta !== null) flags |= FLAG_OBJECT_ID_PRESENT;
|
|
@@ -1855,6 +1841,7 @@ var FetchObject = class FetchObject {
|
|
|
1855
1841
|
let kind;
|
|
1856
1842
|
if (flagsRaw === END_OF_NON_EXISTENT_RANGE) kind = 140;
|
|
1857
1843
|
else if (flagsRaw === END_OF_UNKNOWN_RANGE) kind = 268;
|
|
1844
|
+
else if (flagsRaw === END_OF_TIMED_OUT_RANGE) kind = 524;
|
|
1858
1845
|
else throw new ProtocolViolationError("FetchObject.deserialize", `invalid Serialization Flags value 0x${flagsRaw.toString(16)}`);
|
|
1859
1846
|
const groupId = buf.getVI();
|
|
1860
1847
|
const objectId = buf.getVI();
|
|
@@ -1890,11 +1877,11 @@ var FetchObject = class FetchObject {
|
|
|
1890
1877
|
subgroupId = 0n;
|
|
1891
1878
|
break;
|
|
1892
1879
|
case SUBGROUP_MODE_PRIOR:
|
|
1893
|
-
if (!prev) throw new ProtocolViolationError("FetchObject.deserialize", "subgroup_id inherited but no prior object");
|
|
1880
|
+
if (!prev || prev.subgroupId === null) throw new ProtocolViolationError("FetchObject.deserialize", "subgroup_id inherited but no prior object");
|
|
1894
1881
|
subgroupId = prev.subgroupId;
|
|
1895
1882
|
break;
|
|
1896
1883
|
case SUBGROUP_MODE_PRIOR_PLUS_ONE:
|
|
1897
|
-
if (!prev) throw new ProtocolViolationError("FetchObject.deserialize", "subgroup_id inherited but no prior object");
|
|
1884
|
+
if (!prev || prev.subgroupId === null) throw new ProtocolViolationError("FetchObject.deserialize", "subgroup_id inherited but no prior object");
|
|
1898
1885
|
subgroupId = prev.subgroupId + 1n;
|
|
1899
1886
|
break;
|
|
1900
1887
|
case SUBGROUP_MODE_PRESENT:
|
|
@@ -1916,7 +1903,7 @@ var FetchObject = class FetchObject {
|
|
|
1916
1903
|
if (objectId > MAX_VARINT) throw new ProtocolViolationError("FetchObject.deserialize", `object id wraps: prior=${prev.objectId} +1`);
|
|
1917
1904
|
}
|
|
1918
1905
|
const publisherPriority = hasPriority ? buf.getU8() : (() => {
|
|
1919
|
-
if (!prev) throw new ProtocolViolationError("FetchObject.deserialize", "priority inherited but no prior object");
|
|
1906
|
+
if (!prev || prev.publisherPriority === null) throw new ProtocolViolationError("FetchObject.deserialize", "priority inherited but no prior object");
|
|
1920
1907
|
return prev.publisherPriority;
|
|
1921
1908
|
})();
|
|
1922
1909
|
let properties = null;
|
|
@@ -1954,7 +1941,7 @@ const MAX_FULL_TRACK_NAME_LENGTH = 4096;
|
|
|
1954
1941
|
* Fully-qualified track identifier = hierarchical namespace (tuple) + leaf name bytes.
|
|
1955
1942
|
*
|
|
1956
1943
|
* Constraints enforced (throws {@link TrackNameError}):
|
|
1957
|
-
* - Namespace tuple field count: 0 .. {@link MAX_NAMESPACE_TUPLE_COUNT} (
|
|
1944
|
+
* - Namespace tuple field count: 0 .. {@link MAX_NAMESPACE_TUPLE_COUNT} (an empty namespace is legal).
|
|
1958
1945
|
* - Total serialized length (namespace tuple + raw name bytes) less than or equals {@link MAX_FULL_TRACK_NAME_LENGTH} bytes.
|
|
1959
1946
|
*
|
|
1960
1947
|
* Namespace input may be:
|
|
@@ -2051,11 +2038,12 @@ var FullTrackName = class FullTrackName {
|
|
|
2051
2038
|
* limitations under the License.
|
|
2052
2039
|
*/
|
|
2053
2040
|
let LOCPropertyId = /* @__PURE__ */ function(LOCPropertyId) {
|
|
2054
|
-
LOCPropertyId[LOCPropertyId["Timestamp"] = 6] = "Timestamp";
|
|
2055
2041
|
LOCPropertyId[LOCPropertyId["Timescale"] = 8] = "Timescale";
|
|
2056
|
-
LOCPropertyId[LOCPropertyId["VideoFrameMarking"] =
|
|
2042
|
+
LOCPropertyId[LOCPropertyId["VideoFrameMarking"] = 9] = "VideoFrameMarking";
|
|
2057
2043
|
LOCPropertyId[LOCPropertyId["AudioLevel"] = 12] = "AudioLevel";
|
|
2058
2044
|
LOCPropertyId[LOCPropertyId["VideoConfig"] = 13] = "VideoConfig";
|
|
2045
|
+
LOCPropertyId[LOCPropertyId["AudioConfig"] = 15] = "AudioConfig";
|
|
2046
|
+
LOCPropertyId[LOCPropertyId["Timestamp"] = 16] = "Timestamp";
|
|
2059
2047
|
return LOCPropertyId;
|
|
2060
2048
|
}({});
|
|
2061
2049
|
let TrackPropertyType = /* @__PURE__ */ function(TrackPropertyType) {
|
|
@@ -2072,21 +2060,19 @@ let TrackPropertyType = /* @__PURE__ */ function(TrackPropertyType) {
|
|
|
2072
2060
|
}({});
|
|
2073
2061
|
function locPropertyIdFromNumber(value) {
|
|
2074
2062
|
switch (value) {
|
|
2075
|
-
case 6: return 6;
|
|
2076
2063
|
case 8: return 8;
|
|
2077
|
-
case
|
|
2064
|
+
case 9: return 9;
|
|
2078
2065
|
case 12: return 12;
|
|
2079
2066
|
case 13: return 13;
|
|
2067
|
+
case 15: return 15;
|
|
2068
|
+
case 16: return 16;
|
|
2080
2069
|
default: throw new InvalidTypeError("locPropertyIdFromNumber", `Invalid LOC property id: ${value}`);
|
|
2081
2070
|
}
|
|
2082
2071
|
}
|
|
2083
2072
|
/**
|
|
2084
2073
|
* @public
|
|
2085
|
-
* Registration-policy ranges for the Property Type space
|
|
2074
|
+
* Registration-policy ranges for the Property Type space.
|
|
2086
2075
|
*
|
|
2087
|
-
* §2.5 gives the 1-byte application-specific range as `0x38-0x3F`; that is stale text
|
|
2088
|
-
* from before draft-18's varint change, which made the 1-byte space `0x00-0x7F`.
|
|
2089
|
-
* §15.8 is the correct table and is what these constants follow.
|
|
2090
2076
|
*/
|
|
2091
2077
|
const PropertyRanges = {
|
|
2092
2078
|
/** Standards Action or IESG Approval (1-byte encoding). */
|
|
@@ -2148,7 +2134,7 @@ function isApplicationSpecificProperty(typeValue) {
|
|
|
2148
2134
|
*/
|
|
2149
2135
|
var Timestamp = class Timestamp {
|
|
2150
2136
|
timestamp;
|
|
2151
|
-
static TYPE =
|
|
2137
|
+
static TYPE = 16;
|
|
2152
2138
|
constructor(timestamp) {
|
|
2153
2139
|
this.timestamp = timestamp;
|
|
2154
2140
|
}
|
|
@@ -2206,17 +2192,24 @@ var Timescale = class Timescale {
|
|
|
2206
2192
|
* See the License for the specific language governing permissions and
|
|
2207
2193
|
* limitations under the License.
|
|
2208
2194
|
*/
|
|
2195
|
+
/** The I (independent frame) bit of the RFC 9626 flag octet. */
|
|
2196
|
+
const INDEPENDENT = 32;
|
|
2209
2197
|
var VideoFrameMarking = class VideoFrameMarking {
|
|
2210
2198
|
value;
|
|
2211
|
-
static TYPE =
|
|
2199
|
+
static TYPE = 9;
|
|
2200
|
+
/** The RFC 9626 frame-marking octets (1 to 4), without the length prefix. */
|
|
2212
2201
|
constructor(value) {
|
|
2213
2202
|
this.value = value;
|
|
2214
2203
|
}
|
|
2204
|
+
/** True if the frame decodes without temporally prior frames (the I bit). */
|
|
2205
|
+
get independent() {
|
|
2206
|
+
return ((this.value[0] ?? 0) & INDEPENDENT) !== 0;
|
|
2207
|
+
}
|
|
2215
2208
|
toKeyValuePair() {
|
|
2216
|
-
return KeyValuePair.
|
|
2209
|
+
return KeyValuePair.tryNewBytes(VideoFrameMarking.TYPE, this.value);
|
|
2217
2210
|
}
|
|
2218
2211
|
static fromKeyValuePair(pair) {
|
|
2219
|
-
if (Number(pair.typeValue) === VideoFrameMarking.TYPE &&
|
|
2212
|
+
if (Number(pair.typeValue) === VideoFrameMarking.TYPE && pair.value instanceof Uint8Array) return new VideoFrameMarking(pair.value);
|
|
2220
2213
|
}
|
|
2221
2214
|
};
|
|
2222
2215
|
//#endregion
|
|
@@ -2280,11 +2273,41 @@ var VideoConfig = class VideoConfig {
|
|
|
2280
2273
|
}
|
|
2281
2274
|
};
|
|
2282
2275
|
//#endregion
|
|
2276
|
+
//#region src/model/property/audio_config.ts
|
|
2277
|
+
/**
|
|
2278
|
+
* Copyright 2026 The MOQtail Authors
|
|
2279
|
+
*
|
|
2280
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2281
|
+
* you may not use this file except in compliance with the License.
|
|
2282
|
+
* You may obtain a copy of the License at
|
|
2283
|
+
*
|
|
2284
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2285
|
+
*
|
|
2286
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2287
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2288
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2289
|
+
* See the License for the specific language governing permissions and
|
|
2290
|
+
* limitations under the License.
|
|
2291
|
+
*/
|
|
2292
|
+
var AudioConfig = class AudioConfig {
|
|
2293
|
+
config;
|
|
2294
|
+
static TYPE = 15;
|
|
2295
|
+
constructor(config) {
|
|
2296
|
+
this.config = config;
|
|
2297
|
+
}
|
|
2298
|
+
toKeyValuePair() {
|
|
2299
|
+
return KeyValuePair.tryNewBytes(AudioConfig.TYPE, this.config);
|
|
2300
|
+
}
|
|
2301
|
+
static fromKeyValuePair(pair) {
|
|
2302
|
+
if (Number(pair.typeValue) === AudioConfig.TYPE && pair.value instanceof Uint8Array) return new AudioConfig(pair.value);
|
|
2303
|
+
}
|
|
2304
|
+
};
|
|
2305
|
+
//#endregion
|
|
2283
2306
|
//#region src/model/property/loc.ts
|
|
2284
2307
|
let LOCProperty;
|
|
2285
2308
|
(function(_LOCProperty) {
|
|
2286
2309
|
function fromKeyValuePair(pair) {
|
|
2287
|
-
return Timestamp.fromKeyValuePair(pair) || Timescale.fromKeyValuePair(pair) || VideoFrameMarking.fromKeyValuePair(pair) || AudioLevel.fromKeyValuePair(pair) || VideoConfig.fromKeyValuePair(pair);
|
|
2310
|
+
return Timestamp.fromKeyValuePair(pair) || Timescale.fromKeyValuePair(pair) || VideoFrameMarking.fromKeyValuePair(pair) || AudioLevel.fromKeyValuePair(pair) || VideoConfig.fromKeyValuePair(pair) || AudioConfig.fromKeyValuePair(pair);
|
|
2288
2311
|
}
|
|
2289
2312
|
_LOCProperty.fromKeyValuePair = fromKeyValuePair;
|
|
2290
2313
|
function toKeyValuePair(header) {
|
|
@@ -2311,6 +2334,10 @@ let LOCProperty;
|
|
|
2311
2334
|
return header instanceof VideoConfig;
|
|
2312
2335
|
}
|
|
2313
2336
|
_LOCProperty.isVideoConfig = isVideoConfig;
|
|
2337
|
+
function isAudioConfig(header) {
|
|
2338
|
+
return header instanceof AudioConfig;
|
|
2339
|
+
}
|
|
2340
|
+
_LOCProperty.isAudioConfig = isAudioConfig;
|
|
2314
2341
|
})(LOCProperty || (LOCProperty = {}));
|
|
2315
2342
|
var LOCProperties = class {
|
|
2316
2343
|
kvps = [];
|
|
@@ -2322,8 +2349,9 @@ var LOCProperties = class {
|
|
|
2322
2349
|
this.kvps.push(new Timescale(BigInt(timescale)).toKeyValuePair());
|
|
2323
2350
|
return this;
|
|
2324
2351
|
}
|
|
2325
|
-
|
|
2326
|
-
|
|
2352
|
+
/** Marks a whole, non-scalable frame (RFC 9626 short form): S and E set, I set on a keyframe. */
|
|
2353
|
+
addVideoFrameMarking(isKey) {
|
|
2354
|
+
this.kvps.push(new VideoFrameMarking(new Uint8Array([isKey ? 224 : 192])).toKeyValuePair());
|
|
2327
2355
|
return this;
|
|
2328
2356
|
}
|
|
2329
2357
|
addAudioLevel(audioLevel) {
|
|
@@ -2334,6 +2362,10 @@ var LOCProperties = class {
|
|
|
2334
2362
|
this.kvps.push(new VideoConfig(config).toKeyValuePair());
|
|
2335
2363
|
return this;
|
|
2336
2364
|
}
|
|
2365
|
+
addAudioConfig(config) {
|
|
2366
|
+
this.kvps.push(new AudioConfig(config).toKeyValuePair());
|
|
2367
|
+
return this;
|
|
2368
|
+
}
|
|
2337
2369
|
addRaw(pair) {
|
|
2338
2370
|
this.kvps.push(pair);
|
|
2339
2371
|
return this;
|
|
@@ -2351,6 +2383,53 @@ var LOCProperties = class {
|
|
|
2351
2383
|
}
|
|
2352
2384
|
};
|
|
2353
2385
|
//#endregion
|
|
2386
|
+
//#region src/model/common/grease.ts
|
|
2387
|
+
/**
|
|
2388
|
+
* Copyright 2026 The MOQtail Authors
|
|
2389
|
+
*
|
|
2390
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2391
|
+
* you may not use this file except in compliance with the License.
|
|
2392
|
+
* You may obtain a copy of the License at
|
|
2393
|
+
*
|
|
2394
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2395
|
+
*
|
|
2396
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2397
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2398
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2399
|
+
* See the License for the specific language governing permissions and
|
|
2400
|
+
* limitations under the License.
|
|
2401
|
+
*/
|
|
2402
|
+
/**
|
|
2403
|
+
* GREASE reservations (§14). Values matching `0x7f * N + 0x9D` are reserved across
|
|
2404
|
+
* several registries (Setup Options, Properties, error codes) so peers can emit them
|
|
2405
|
+
* to exercise unknown-value handling. Receivers treat them like any other unknown
|
|
2406
|
+
* value: ignore, never fatal.
|
|
2407
|
+
*/
|
|
2408
|
+
/** Step between successive GREASE values. */
|
|
2409
|
+
const GREASE_STEP = 127n;
|
|
2410
|
+
/** The smallest GREASE value (N = 0). */
|
|
2411
|
+
const GREASE_BASE = 157n;
|
|
2412
|
+
/** The largest GREASE value that still fits a varint, i.e. `0x3fffffffffffffde`. */
|
|
2413
|
+
const GREASE_MAX = 4611686018427387870n;
|
|
2414
|
+
/**
|
|
2415
|
+
* @public
|
|
2416
|
+
* True if `value` is a reserved GREASE value, i.e. `0x7f * N + 0x9D` for some
|
|
2417
|
+
* non-negative `N`.
|
|
2418
|
+
*/
|
|
2419
|
+
function isGrease(value) {
|
|
2420
|
+
const v = BigInt(value);
|
|
2421
|
+
return v >= 157n && (v - 157n) % 127n === 0n;
|
|
2422
|
+
}
|
|
2423
|
+
/**
|
|
2424
|
+
* @public
|
|
2425
|
+
* The `N`-th GREASE value, `0x7f * N + 0x9D`, or undefined if it would exceed what a
|
|
2426
|
+
* varint can carry (the pattern is capped at `0x3fffffffffffffde`).
|
|
2427
|
+
*/
|
|
2428
|
+
function greaseValue(n) {
|
|
2429
|
+
const value = GREASE_STEP * BigInt(n) + GREASE_BASE;
|
|
2430
|
+
return value > GREASE_MAX ? void 0 : value;
|
|
2431
|
+
}
|
|
2432
|
+
//#endregion
|
|
2354
2433
|
//#region src/model/property/track_property.ts
|
|
2355
2434
|
/**
|
|
2356
2435
|
* Copyright 2026 The MOQtail Authors
|
|
@@ -2675,7 +2754,7 @@ var SubgroupObject = class SubgroupObject {
|
|
|
2675
2754
|
return new SubgroupObject(objectId, normalizeProperties(properties), null, payload);
|
|
2676
2755
|
}
|
|
2677
2756
|
serialize(previousObjectId) {
|
|
2678
|
-
let objectIdDelta = previousObjectId ? this.objectId - previousObjectId - BigInt(1) : this.objectId;
|
|
2757
|
+
let objectIdDelta = previousObjectId !== void 0 ? this.objectId - previousObjectId - BigInt(1) : this.objectId;
|
|
2679
2758
|
const buf = new ByteBuffer();
|
|
2680
2759
|
buf.putVI(objectIdDelta);
|
|
2681
2760
|
if (this.properties !== null) buf.putLengthPrefixedBytes(serializeKvpList(this.properties).toUint8Array());
|
|
@@ -2762,7 +2841,7 @@ var MoqtObject = class MoqtObject {
|
|
|
2762
2841
|
return new MoqtObject(fullTrackName, location, publisherPriority, objectForwardingPreference, subgroupId, objectStatus, properties, null);
|
|
2763
2842
|
}
|
|
2764
2843
|
/**
|
|
2765
|
-
* Create a MoqtObject from a Datagram
|
|
2844
|
+
* Create a MoqtObject from a Datagram.
|
|
2766
2845
|
* @param datagram - The received Datagram.
|
|
2767
2846
|
* @param fullTrackName - The resolved full track name.
|
|
2768
2847
|
* @param defaultPriority - The default publisher priority from the control message (used when DEFAULT_PRIORITY bit is set).
|
|
@@ -2789,7 +2868,7 @@ var MoqtObject = class MoqtObject {
|
|
|
2789
2868
|
return new MoqtObject(fullTrackName, new Location(groupId, subgroupObject.objectId), publisherPriority ?? 128, "Subgroup", subgroupId, subgroupObject.objectStatus || 0, subgroupObject.properties, subgroupObject.payload);
|
|
2790
2869
|
}
|
|
2791
2870
|
/**
|
|
2792
|
-
* Convert to Datagram for wire transmission
|
|
2871
|
+
* Convert to Datagram for wire transmission.
|
|
2793
2872
|
* Automatically creates a payload or status Datagram based on the object's state.
|
|
2794
2873
|
* @param trackAlias - The track alias to use.
|
|
2795
2874
|
* @param endOfGroup - Whether this is the last object in the group (only for payload datagrams).
|
|
@@ -3237,8 +3316,7 @@ var ByteBuffer = class extends BaseByteBuffer {
|
|
|
3237
3316
|
}
|
|
3238
3317
|
/**
|
|
3239
3318
|
/**
|
|
3240
|
-
* Encode a MOQT
|
|
3241
|
-
* See section 1.4.1 https://datatracker.ietf.org/doc/draft-ietf-moq-transport/
|
|
3319
|
+
* Encode a MOQT varint using the minimal length.
|
|
3242
3320
|
*/
|
|
3243
3321
|
putVI(v) {
|
|
3244
3322
|
const value = typeof v === "number" ? BigInt(v) : v;
|
|
@@ -3309,7 +3387,7 @@ var FrozenByteBuffer = class extends BaseByteBuffer {
|
|
|
3309
3387
|
}
|
|
3310
3388
|
};
|
|
3311
3389
|
//#endregion
|
|
3312
|
-
//#region src/model/control/
|
|
3390
|
+
//#region src/model/control/publish_skipped.ts
|
|
3313
3391
|
/**
|
|
3314
3392
|
* Copyright 2026 The MOQtail Authors
|
|
3315
3393
|
*
|
|
@@ -3327,15 +3405,13 @@ var FrozenByteBuffer = class extends BaseByteBuffer {
|
|
|
3327
3405
|
*/
|
|
3328
3406
|
/**
|
|
3329
3407
|
* @public
|
|
3330
|
-
*
|
|
3331
|
-
* would start a subscription to a track under a SUBSCRIBE_TRACKS namespace
|
|
3332
|
-
* is blocked by the peer's bidirectional stream limit. It MUST NOT send PUBLISH for
|
|
3333
|
-
* that track until the limit lifts (§10.20).
|
|
3408
|
+
* PUBLISH_SKIPPED (0xF): a publisher tells the peer it cannot send the PUBLISH that
|
|
3409
|
+
* would start a subscription to a track under a SUBSCRIBE_TRACKS namespace.
|
|
3334
3410
|
*
|
|
3335
3411
|
* Sent on the SUBSCRIBE_TRACKS response stream, so only the namespace suffix after that
|
|
3336
3412
|
* subscription's prefix is carried.
|
|
3337
3413
|
*/
|
|
3338
|
-
var
|
|
3414
|
+
var PublishSkipped = class PublishSkipped {
|
|
3339
3415
|
trackNamespaceSuffix;
|
|
3340
3416
|
trackName;
|
|
3341
3417
|
constructor(trackNamespaceSuffix, trackName) {
|
|
@@ -3352,7 +3428,7 @@ var PublishBlocked = class PublishBlocked {
|
|
|
3352
3428
|
payload.putTuple(this.trackNamespaceSuffix);
|
|
3353
3429
|
payload.putLengthPrefixedBytes(this.trackName);
|
|
3354
3430
|
const payloadBytes = payload.toUint8Array();
|
|
3355
|
-
if (payloadBytes.length > 65535) throw new LengthExceedsMaxError("
|
|
3431
|
+
if (payloadBytes.length > 65535) throw new LengthExceedsMaxError("PublishSkipped::serialize(payloadBytes.length)", 65535, payloadBytes.length);
|
|
3356
3432
|
buf.putU16(payloadBytes.length);
|
|
3357
3433
|
buf.putBytes(payloadBytes);
|
|
3358
3434
|
return buf.freeze();
|
|
@@ -3360,11 +3436,11 @@ var PublishBlocked = class PublishBlocked {
|
|
|
3360
3436
|
static parsePayload(buf) {
|
|
3361
3437
|
const trackNamespaceSuffix = buf.getTuple();
|
|
3362
3438
|
const trackName = buf.getLengthPrefixedBytes();
|
|
3363
|
-
return new
|
|
3439
|
+
return new PublishSkipped(trackNamespaceSuffix, trackName);
|
|
3364
3440
|
}
|
|
3365
3441
|
};
|
|
3366
3442
|
//#endregion
|
|
3367
|
-
//#region src/model/
|
|
3443
|
+
//#region src/model/parameter/constant.ts
|
|
3368
3444
|
/**
|
|
3369
3445
|
* Copyright 2026 The MOQtail Authors
|
|
3370
3446
|
*
|
|
@@ -3380,68 +3456,193 @@ var PublishBlocked = class PublishBlocked {
|
|
|
3380
3456
|
* See the License for the specific language governing permissions and
|
|
3381
3457
|
* limitations under the License.
|
|
3382
3458
|
*/
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
fragment = parseFragment(rest.slice(hashIdx + 1));
|
|
3412
|
-
rest = rest.slice(0, hashIdx);
|
|
3413
|
-
}
|
|
3414
|
-
let query;
|
|
3415
|
-
const queryIdx = rest.indexOf("?");
|
|
3416
|
-
if (queryIdx !== -1) {
|
|
3417
|
-
query = rest.slice(queryIdx + 1);
|
|
3418
|
-
rest = rest.slice(0, queryIdx);
|
|
3419
|
-
}
|
|
3420
|
-
const slashIdx = rest.indexOf("/");
|
|
3421
|
-
const authority = slashIdx === -1 ? rest : rest.slice(0, slashIdx);
|
|
3422
|
-
const path = slashIdx === -1 ? "" : rest.slice(slashIdx);
|
|
3423
|
-
if (authority.length === 0) throw new ProtocolViolationError("MoqtUrl.parse", `moqt:// URL has an empty authority: ${input}`);
|
|
3424
|
-
return new MoqtUrl(authority, path, query, fragment);
|
|
3425
|
-
}
|
|
3426
|
-
/** The `path[?query]` string carried in the PATH setup option on native QUIC. */
|
|
3427
|
-
pathAndQuery() {
|
|
3428
|
-
return this.query !== void 0 ? `${this.path}?${this.query}` : this.path;
|
|
3429
|
-
}
|
|
3430
|
-
/** The equivalent `https://` URL for WebTransport, dropping the local fragment. */
|
|
3431
|
-
toHttps() {
|
|
3432
|
-
return `https://${this.authority}${this.pathAndQuery()}`;
|
|
3459
|
+
let SetupOptionType = /* @__PURE__ */ function(SetupOptionType) {
|
|
3460
|
+
SetupOptionType[SetupOptionType["Path"] = 1] = "Path";
|
|
3461
|
+
SetupOptionType[SetupOptionType["AuthorizationToken"] = 3] = "AuthorizationToken";
|
|
3462
|
+
SetupOptionType[SetupOptionType["MaxAuthTokenCacheSize"] = 4] = "MaxAuthTokenCacheSize";
|
|
3463
|
+
/** Raw-QUIC only. Client-only; MUST NOT be sent over WebTransport. */
|
|
3464
|
+
SetupOptionType[SetupOptionType["Authority"] = 5] = "Authority";
|
|
3465
|
+
SetupOptionType[SetupOptionType["MaxFilterRanges"] = 6] = "MaxFilterRanges";
|
|
3466
|
+
SetupOptionType[SetupOptionType["MoqtImplementation"] = 7] = "MoqtImplementation";
|
|
3467
|
+
SetupOptionType[SetupOptionType["MaxRequestUpdates"] = 8] = "MaxRequestUpdates";
|
|
3468
|
+
/**
|
|
3469
|
+
* PROVISIONAL: sender-side track switching is not an adopted extension, so this
|
|
3470
|
+
* codepoint is absent from the registry the conformance fixture tracks. It sits in the
|
|
3471
|
+
* 0x07-0x7F range of this space, which that registry leaves free.
|
|
3472
|
+
*/
|
|
3473
|
+
SetupOptionType[SetupOptionType["SstsAlgorithms"] = 9] = "SstsAlgorithms";
|
|
3474
|
+
return SetupOptionType;
|
|
3475
|
+
}({});
|
|
3476
|
+
function setupOptionTypeFromNumber(value) {
|
|
3477
|
+
switch (value) {
|
|
3478
|
+
case 1: return 1;
|
|
3479
|
+
case 3: return 3;
|
|
3480
|
+
case 4: return 4;
|
|
3481
|
+
case 5: return 5;
|
|
3482
|
+
case 6: return 6;
|
|
3483
|
+
case 7: return 7;
|
|
3484
|
+
case 8: return 8;
|
|
3485
|
+
case 9: return 9;
|
|
3486
|
+
default: throw new InvalidTypeError("setupOptionTypeFromNumber", `Invalid setup option type: ${value}`);
|
|
3433
3487
|
}
|
|
3434
|
-
}
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3488
|
+
}
|
|
3489
|
+
let MessageParameterType = /* @__PURE__ */ function(MessageParameterType) {
|
|
3490
|
+
MessageParameterType[MessageParameterType["ObjectDeliveryTimeout"] = 2] = "ObjectDeliveryTimeout";
|
|
3491
|
+
MessageParameterType[MessageParameterType["AuthorizationToken"] = 3] = "AuthorizationToken";
|
|
3492
|
+
MessageParameterType[MessageParameterType["RendezvousTimeout"] = 4] = "RendezvousTimeout";
|
|
3493
|
+
MessageParameterType[MessageParameterType["SubgroupDeliveryTimeout"] = 6] = "SubgroupDeliveryTimeout";
|
|
3494
|
+
MessageParameterType[MessageParameterType["Expires"] = 8] = "Expires";
|
|
3495
|
+
MessageParameterType[MessageParameterType["LargestObject"] = 9] = "LargestObject";
|
|
3496
|
+
MessageParameterType[MessageParameterType["FillTimeout"] = 10] = "FillTimeout";
|
|
3497
|
+
MessageParameterType[MessageParameterType["Forward"] = 16] = "Forward";
|
|
3498
|
+
MessageParameterType[MessageParameterType["SubscriberPriority"] = 32] = "SubscriberPriority";
|
|
3499
|
+
MessageParameterType[MessageParameterType["LocationFilter"] = 33] = "LocationFilter";
|
|
3500
|
+
MessageParameterType[MessageParameterType["GroupOrder"] = 34] = "GroupOrder";
|
|
3501
|
+
MessageParameterType[MessageParameterType["FillParameters"] = 35] = "FillParameters";
|
|
3502
|
+
MessageParameterType[MessageParameterType["SwitchFrom"] = 36] = "SwitchFrom";
|
|
3503
|
+
MessageParameterType[MessageParameterType["SubgroupFilter"] = 37] = "SubgroupFilter";
|
|
3504
|
+
MessageParameterType[MessageParameterType["ObjectIdFilter"] = 38] = "ObjectIdFilter";
|
|
3505
|
+
MessageParameterType[MessageParameterType["PriorityFilter"] = 39] = "PriorityFilter";
|
|
3506
|
+
MessageParameterType[MessageParameterType["ObjectPropertyFilter"] = 40] = "ObjectPropertyFilter";
|
|
3507
|
+
MessageParameterType[MessageParameterType["TrackPropertyFilter"] = 41] = "TrackPropertyFilter";
|
|
3508
|
+
MessageParameterType[MessageParameterType["NewGroupRequest"] = 50] = "NewGroupRequest";
|
|
3509
|
+
/**
|
|
3510
|
+
* Registered codepoint with no typed parameter yet: its consumer is REQUEST_UPDATE for
|
|
3511
|
+
* SUBSCRIBE_TRACKS (TS-11), and the value is a Track Namespace tuple rather than the
|
|
3512
|
+
* varint its even Type implies.
|
|
3513
|
+
*/
|
|
3514
|
+
MessageParameterType[MessageParameterType["TrackNamespacePrefix"] = 52] = "TrackNamespacePrefix";
|
|
3515
|
+
MessageParameterType[MessageParameterType["IncludeProperties"] = 53] = "IncludeProperties";
|
|
3516
|
+
/**
|
|
3517
|
+
* PROVISIONAL: sender-side track switching is not an adopted extension, so this
|
|
3518
|
+
* codepoint is absent from the registry the conformance fixture tracks; see its
|
|
3519
|
+
* `local_extensions`.
|
|
3520
|
+
*/
|
|
3521
|
+
MessageParameterType[MessageParameterType["SwitchingSetAssignment"] = 65] = "SwitchingSetAssignment";
|
|
3522
|
+
return MessageParameterType;
|
|
3523
|
+
}({});
|
|
3524
|
+
function messageParameterTypeFromNumber(value) {
|
|
3525
|
+
switch (Number(value)) {
|
|
3526
|
+
case 2: return 2;
|
|
3527
|
+
case 3: return 3;
|
|
3528
|
+
case 4: return 4;
|
|
3529
|
+
case 6: return 6;
|
|
3530
|
+
case 8: return 8;
|
|
3531
|
+
case 9: return 9;
|
|
3532
|
+
case 10: return 10;
|
|
3533
|
+
case 16: return 16;
|
|
3534
|
+
case 32: return 32;
|
|
3535
|
+
case 33: return 33;
|
|
3536
|
+
case 34: return 34;
|
|
3537
|
+
case 35: return 35;
|
|
3538
|
+
case 36: return 36;
|
|
3539
|
+
case 37: return 37;
|
|
3540
|
+
case 38: return 38;
|
|
3541
|
+
case 39: return 39;
|
|
3542
|
+
case 40: return 40;
|
|
3543
|
+
case 41: return 41;
|
|
3544
|
+
case 50: return 50;
|
|
3545
|
+
case 52: return 52;
|
|
3546
|
+
case 53: return 53;
|
|
3547
|
+
case 65: return 65;
|
|
3548
|
+
default: throw new InvalidTypeError("messageParameterTypeFromNumber", `Unknown message parameter type: ${value}`);
|
|
3549
|
+
}
|
|
3550
|
+
}
|
|
3551
|
+
let TokenAliasType = /* @__PURE__ */ function(TokenAliasType) {
|
|
3552
|
+
TokenAliasType[TokenAliasType["Delete"] = 0] = "Delete";
|
|
3553
|
+
TokenAliasType[TokenAliasType["Register"] = 1] = "Register";
|
|
3554
|
+
TokenAliasType[TokenAliasType["UseAlias"] = 2] = "UseAlias";
|
|
3555
|
+
TokenAliasType[TokenAliasType["UseValue"] = 3] = "UseValue";
|
|
3556
|
+
return TokenAliasType;
|
|
3557
|
+
}({});
|
|
3558
|
+
function tokenAliasTypeFromNumber(value) {
|
|
3559
|
+
switch (value) {
|
|
3560
|
+
case 0: return 0;
|
|
3561
|
+
case 1: return 1;
|
|
3562
|
+
case 2: return 2;
|
|
3563
|
+
case 3: return 3;
|
|
3564
|
+
default: throw new InvalidTypeError("tokenAliasTypeFromNumber", `Invalid token alias type: ${value}`);
|
|
3565
|
+
}
|
|
3566
|
+
}
|
|
3567
|
+
//#endregion
|
|
3568
|
+
//#region src/model/common/moqt_url.ts
|
|
3569
|
+
/**
|
|
3570
|
+
* Copyright 2026 The MOQtail Authors
|
|
3571
|
+
*
|
|
3572
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3573
|
+
* you may not use this file except in compliance with the License.
|
|
3574
|
+
* You may obtain a copy of the License at
|
|
3575
|
+
*
|
|
3576
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3577
|
+
*
|
|
3578
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3579
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3580
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3581
|
+
* See the License for the specific language governing permissions and
|
|
3582
|
+
* limitations under the License.
|
|
3583
|
+
*/
|
|
3584
|
+
/**
|
|
3585
|
+
* @public
|
|
3586
|
+
* A parsed `moqt://authority/path[?query][#fragment]` URI.
|
|
3587
|
+
*
|
|
3588
|
+
* `moqt-URI = "moqt" "://" authority path-abempty [ "?" query ]`, with an optional
|
|
3589
|
+
* local-only fragment. `authority` is `host[:port]`; `path` keeps its leading `/`
|
|
3590
|
+
* (empty when absent); `query` excludes the `?`.
|
|
3591
|
+
*
|
|
3592
|
+
* This is the TypeScript twin of `MoqtUrl` in `apps/client/src/connection.rs`; the two
|
|
3593
|
+
* must agree on what a given URL means.
|
|
3594
|
+
*/
|
|
3595
|
+
var MoqtUrl = class MoqtUrl {
|
|
3596
|
+
authority;
|
|
3597
|
+
path;
|
|
3598
|
+
query;
|
|
3599
|
+
fragment;
|
|
3600
|
+
constructor(authority, path, query, fragment) {
|
|
3601
|
+
this.authority = authority;
|
|
3602
|
+
this.path = path;
|
|
3603
|
+
this.query = query;
|
|
3604
|
+
this.fragment = fragment;
|
|
3605
|
+
}
|
|
3606
|
+
static parse(input) {
|
|
3607
|
+
if (!input.startsWith("moqt://")) throw new ProtocolViolationError("MoqtUrl.parse", `URL must use the moqt:// scheme: ${input}`);
|
|
3608
|
+
let rest = input.slice(7);
|
|
3609
|
+
let fragment;
|
|
3610
|
+
const hashIdx = rest.indexOf("#");
|
|
3611
|
+
if (hashIdx !== -1) {
|
|
3612
|
+
fragment = parseFragment(rest.slice(hashIdx + 1));
|
|
3613
|
+
rest = rest.slice(0, hashIdx);
|
|
3614
|
+
}
|
|
3615
|
+
let query;
|
|
3616
|
+
const queryIdx = rest.indexOf("?");
|
|
3617
|
+
if (queryIdx !== -1) {
|
|
3618
|
+
query = rest.slice(queryIdx + 1);
|
|
3619
|
+
rest = rest.slice(0, queryIdx);
|
|
3620
|
+
}
|
|
3621
|
+
const slashIdx = rest.indexOf("/");
|
|
3622
|
+
const authority = slashIdx === -1 ? rest : rest.slice(0, slashIdx);
|
|
3623
|
+
const path = slashIdx === -1 ? "" : rest.slice(slashIdx);
|
|
3624
|
+
if (authority.length === 0) throw new ProtocolViolationError("MoqtUrl.parse", `moqt:// URL has an empty authority: ${input}`);
|
|
3625
|
+
return new MoqtUrl(authority, path, query, fragment);
|
|
3626
|
+
}
|
|
3627
|
+
/** The `path[?query]` string carried in the PATH setup option on native QUIC. */
|
|
3628
|
+
pathAndQuery() {
|
|
3629
|
+
return this.query !== void 0 ? `${this.path}?${this.query}` : this.path;
|
|
3630
|
+
}
|
|
3631
|
+
/** The equivalent `https://` URL for WebTransport, dropping the local fragment. */
|
|
3632
|
+
toHttps() {
|
|
3633
|
+
return `https://${this.authority}${this.pathAndQuery()}`;
|
|
3634
|
+
}
|
|
3635
|
+
};
|
|
3636
|
+
/**
|
|
3637
|
+
* Parses a fragment `<type>:<value>`. The type identifier must be ASCII lowercase
|
|
3638
|
+
* letters, digits, and hyphens; the value is opaque here.
|
|
3639
|
+
*/
|
|
3640
|
+
function parseFragment(fragment) {
|
|
3641
|
+
const colonIdx = fragment.indexOf(":");
|
|
3642
|
+
if (colonIdx === -1) throw new ProtocolViolationError("MoqtUrl.parse", `moqt:// fragment must be <type>:<value>, got #${fragment}`);
|
|
3643
|
+
const kind = fragment.slice(0, colonIdx);
|
|
3644
|
+
if (kind.length === 0 || !/^[a-z0-9-]+$/.test(kind)) throw new ProtocolViolationError("MoqtUrl.parse", `moqt:// fragment type must be [a-z0-9-]+, got #${fragment}`);
|
|
3645
|
+
return {
|
|
3445
3646
|
kind,
|
|
3446
3647
|
value: fragment.slice(colonIdx + 1)
|
|
3447
3648
|
};
|
|
@@ -3522,111 +3723,6 @@ var Redirect = class Redirect {
|
|
|
3522
3723
|
}
|
|
3523
3724
|
};
|
|
3524
3725
|
//#endregion
|
|
3525
|
-
//#region src/model/parameter/constant.ts
|
|
3526
|
-
/**
|
|
3527
|
-
* Copyright 2026 The MOQtail Authors
|
|
3528
|
-
*
|
|
3529
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3530
|
-
* you may not use this file except in compliance with the License.
|
|
3531
|
-
* You may obtain a copy of the License at
|
|
3532
|
-
*
|
|
3533
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3534
|
-
*
|
|
3535
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
3536
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3537
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3538
|
-
* See the License for the specific language governing permissions and
|
|
3539
|
-
* limitations under the License.
|
|
3540
|
-
*/
|
|
3541
|
-
let SetupOptionType = /* @__PURE__ */ function(SetupOptionType) {
|
|
3542
|
-
SetupOptionType[SetupOptionType["Path"] = 1] = "Path";
|
|
3543
|
-
SetupOptionType[SetupOptionType["AuthorizationToken"] = 3] = "AuthorizationToken";
|
|
3544
|
-
SetupOptionType[SetupOptionType["MaxAuthTokenCacheSize"] = 4] = "MaxAuthTokenCacheSize";
|
|
3545
|
-
/** Raw-QUIC only. Client-only; MUST NOT be sent over WebTransport (draft-18 §10.3.1.1). */
|
|
3546
|
-
SetupOptionType[SetupOptionType["Authority"] = 5] = "Authority";
|
|
3547
|
-
SetupOptionType[SetupOptionType["MoqtImplementation"] = 7] = "MoqtImplementation";
|
|
3548
|
-
/**
|
|
3549
|
-
* PROVISIONAL: sender-side track switching is not an adopted extension, so this
|
|
3550
|
-
* codepoint is absent from the registry the conformance fixture tracks. It sits in the
|
|
3551
|
-
* 0x07-0x7F range of this space, which that registry leaves free.
|
|
3552
|
-
*/
|
|
3553
|
-
SetupOptionType[SetupOptionType["SstsAlgorithms"] = 9] = "SstsAlgorithms";
|
|
3554
|
-
return SetupOptionType;
|
|
3555
|
-
}({});
|
|
3556
|
-
function setupOptionTypeFromNumber(value) {
|
|
3557
|
-
switch (value) {
|
|
3558
|
-
case 1: return 1;
|
|
3559
|
-
case 3: return 3;
|
|
3560
|
-
case 4: return 4;
|
|
3561
|
-
case 5: return 5;
|
|
3562
|
-
case 7: return 7;
|
|
3563
|
-
case 9: return 9;
|
|
3564
|
-
default: throw new InvalidTypeError("setupOptionTypeFromNumber", `Invalid setup option type: ${value}`);
|
|
3565
|
-
}
|
|
3566
|
-
}
|
|
3567
|
-
let MessageParameterType = /* @__PURE__ */ function(MessageParameterType) {
|
|
3568
|
-
MessageParameterType[MessageParameterType["ObjectDeliveryTimeout"] = 2] = "ObjectDeliveryTimeout";
|
|
3569
|
-
MessageParameterType[MessageParameterType["AuthorizationToken"] = 3] = "AuthorizationToken";
|
|
3570
|
-
MessageParameterType[MessageParameterType["RendezvousTimeout"] = 4] = "RendezvousTimeout";
|
|
3571
|
-
MessageParameterType[MessageParameterType["SubgroupDeliveryTimeout"] = 6] = "SubgroupDeliveryTimeout";
|
|
3572
|
-
MessageParameterType[MessageParameterType["Expires"] = 8] = "Expires";
|
|
3573
|
-
MessageParameterType[MessageParameterType["LargestObject"] = 9] = "LargestObject";
|
|
3574
|
-
MessageParameterType[MessageParameterType["FillTimeout"] = 10] = "FillTimeout";
|
|
3575
|
-
MessageParameterType[MessageParameterType["Forward"] = 16] = "Forward";
|
|
3576
|
-
MessageParameterType[MessageParameterType["SubscriberPriority"] = 32] = "SubscriberPriority";
|
|
3577
|
-
MessageParameterType[MessageParameterType["SubscriptionFilter"] = 33] = "SubscriptionFilter";
|
|
3578
|
-
MessageParameterType[MessageParameterType["GroupOrder"] = 34] = "GroupOrder";
|
|
3579
|
-
MessageParameterType[MessageParameterType["NewGroupRequest"] = 50] = "NewGroupRequest";
|
|
3580
|
-
/**
|
|
3581
|
-
* Registered codepoint with no typed parameter yet: its consumer is REQUEST_UPDATE for
|
|
3582
|
-
* SUBSCRIBE_TRACKS (TS-11), and the value is a Track Namespace tuple rather than the
|
|
3583
|
-
* varint its even Type implies.
|
|
3584
|
-
*/
|
|
3585
|
-
MessageParameterType[MessageParameterType["TrackNamespacePrefix"] = 52] = "TrackNamespacePrefix";
|
|
3586
|
-
/**
|
|
3587
|
-
* PROVISIONAL: sender-side track switching is not an adopted extension, so this
|
|
3588
|
-
* codepoint is absent from the registry the conformance fixture tracks; see its
|
|
3589
|
-
* `local_extensions`.
|
|
3590
|
-
*/
|
|
3591
|
-
MessageParameterType[MessageParameterType["SwitchingSetAssignment"] = 65] = "SwitchingSetAssignment";
|
|
3592
|
-
return MessageParameterType;
|
|
3593
|
-
}({});
|
|
3594
|
-
function messageParameterTypeFromNumber(value) {
|
|
3595
|
-
switch (Number(value)) {
|
|
3596
|
-
case 2: return 2;
|
|
3597
|
-
case 3: return 3;
|
|
3598
|
-
case 4: return 4;
|
|
3599
|
-
case 6: return 6;
|
|
3600
|
-
case 8: return 8;
|
|
3601
|
-
case 9: return 9;
|
|
3602
|
-
case 10: return 10;
|
|
3603
|
-
case 16: return 16;
|
|
3604
|
-
case 32: return 32;
|
|
3605
|
-
case 33: return 33;
|
|
3606
|
-
case 34: return 34;
|
|
3607
|
-
case 50: return 50;
|
|
3608
|
-
case 52: return 52;
|
|
3609
|
-
case 65: return 65;
|
|
3610
|
-
default: throw new InvalidTypeError("messageParameterTypeFromNumber", `Unknown message parameter type: ${value}`);
|
|
3611
|
-
}
|
|
3612
|
-
}
|
|
3613
|
-
let TokenAliasType = /* @__PURE__ */ function(TokenAliasType) {
|
|
3614
|
-
TokenAliasType[TokenAliasType["Delete"] = 0] = "Delete";
|
|
3615
|
-
TokenAliasType[TokenAliasType["Register"] = 1] = "Register";
|
|
3616
|
-
TokenAliasType[TokenAliasType["UseAlias"] = 2] = "UseAlias";
|
|
3617
|
-
TokenAliasType[TokenAliasType["UseValue"] = 3] = "UseValue";
|
|
3618
|
-
return TokenAliasType;
|
|
3619
|
-
}({});
|
|
3620
|
-
function tokenAliasTypeFromNumber(value) {
|
|
3621
|
-
switch (value) {
|
|
3622
|
-
case 0: return 0;
|
|
3623
|
-
case 1: return 1;
|
|
3624
|
-
case 2: return 2;
|
|
3625
|
-
case 3: return 3;
|
|
3626
|
-
default: throw new InvalidTypeError("tokenAliasTypeFromNumber", `Invalid token alias type: ${value}`);
|
|
3627
|
-
}
|
|
3628
|
-
}
|
|
3629
|
-
//#endregion
|
|
3630
3726
|
//#region src/model/parameter/common/authorization_token.ts
|
|
3631
3727
|
/**
|
|
3632
3728
|
* Copyright 2026 The MOQtail Authors
|
|
@@ -3957,6 +4053,45 @@ var Forward = class Forward {
|
|
|
3957
4053
|
}
|
|
3958
4054
|
};
|
|
3959
4055
|
//#endregion
|
|
4056
|
+
//#region src/model/parameter/message/include_properties.ts
|
|
4057
|
+
/**
|
|
4058
|
+
* Copyright 2026 The MOQtail Authors
|
|
4059
|
+
*
|
|
4060
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4061
|
+
* you may not use this file except in compliance with the License.
|
|
4062
|
+
* You may obtain a copy of the License at
|
|
4063
|
+
*
|
|
4064
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4065
|
+
*
|
|
4066
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
4067
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4068
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4069
|
+
* See the License for the specific language governing permissions and
|
|
4070
|
+
* limitations under the License.
|
|
4071
|
+
*/
|
|
4072
|
+
/**
|
|
4073
|
+
* Whether the response carries Track Properties: the OK answering a SUBSCRIBE,
|
|
4074
|
+
* TRACK_STATUS or FETCH, or each PUBLISH a SUBSCRIBE_TRACKS brings. With 0 the
|
|
4075
|
+
* Track Properties field is still there, but empty.
|
|
4076
|
+
* Allowed wire values: 0 or 1; any other value is a PROTOCOL_VIOLATION.
|
|
4077
|
+
* Default (when omitted) is 1 (include them).
|
|
4078
|
+
*/
|
|
4079
|
+
var IncludeProperties = class IncludeProperties {
|
|
4080
|
+
include;
|
|
4081
|
+
static TYPE = 53;
|
|
4082
|
+
constructor(include) {
|
|
4083
|
+
this.include = include;
|
|
4084
|
+
}
|
|
4085
|
+
toKeyValuePair() {
|
|
4086
|
+
return KeyValuePair.newVarInt(IncludeProperties.TYPE, this.include ? 1n : 0n);
|
|
4087
|
+
}
|
|
4088
|
+
static fromKeyValuePair(pair) {
|
|
4089
|
+
if (Number(pair.typeValue) !== IncludeProperties.TYPE || typeof pair.value !== "bigint") return void 0;
|
|
4090
|
+
if (pair.value !== 0n && pair.value !== 1n) throw new ProtocolViolationError("IncludeProperties.fromKeyValuePair", `INCLUDE_PROPERTIES must be 0 or 1, got ${pair.value}`);
|
|
4091
|
+
return new IncludeProperties(pair.value === 1n);
|
|
4092
|
+
}
|
|
4093
|
+
};
|
|
4094
|
+
//#endregion
|
|
3960
4095
|
//#region src/model/parameter/message/group_order_param.ts
|
|
3961
4096
|
/**
|
|
3962
4097
|
* Copyright 2026 The MOQtail Authors
|
|
@@ -4095,7 +4230,7 @@ var NewGroupRequest = class NewGroupRequest {
|
|
|
4095
4230
|
*
|
|
4096
4231
|
* PROVISIONAL: sender-side track switching is not an adopted extension, so
|
|
4097
4232
|
* this parameter has no codepoint in the registry the conformance fixture
|
|
4098
|
-
* tracks (`dev/conformance/
|
|
4233
|
+
* tracks (`dev/conformance/draft22`) and is never asserted against it. Id 0 is
|
|
4099
4234
|
* the default allocation every implementation runs; other ids select an
|
|
4100
4235
|
* algorithm specific to one implementation.
|
|
4101
4236
|
*/
|
|
@@ -4179,7 +4314,7 @@ var SubscriberPriority = class SubscriberPriority {
|
|
|
4179
4314
|
}
|
|
4180
4315
|
};
|
|
4181
4316
|
//#endregion
|
|
4182
|
-
//#region src/model/parameter/message/
|
|
4317
|
+
//#region src/model/parameter/message/location_filter.ts
|
|
4183
4318
|
/**
|
|
4184
4319
|
* Copyright 2026 The MOQtail Authors
|
|
4185
4320
|
*
|
|
@@ -4195,40 +4330,466 @@ var SubscriberPriority = class SubscriberPriority {
|
|
|
4195
4330
|
* See the License for the specific language governing permissions and
|
|
4196
4331
|
* limitations under the License.
|
|
4197
4332
|
*/
|
|
4333
|
+
const MAX_U64$1 = 18446744073709551615n;
|
|
4334
|
+
/** The fields each Location Filter Type carries, in wire order. */
|
|
4335
|
+
const FIELD_COUNT = {
|
|
4336
|
+
[0]: 0,
|
|
4337
|
+
[1]: 1,
|
|
4338
|
+
[2]: 2,
|
|
4339
|
+
[3]: 3,
|
|
4340
|
+
[4]: 4,
|
|
4341
|
+
[5]: 0
|
|
4342
|
+
};
|
|
4198
4343
|
/**
|
|
4199
|
-
*
|
|
4200
|
-
*
|
|
4344
|
+
* The range of Locations a subscription or fetch selects. The Location Filter
|
|
4345
|
+
* Type decides which fields are set, and the value is not length-prefixed.
|
|
4346
|
+
*
|
|
4347
|
+
* Every Group here is absolute, except `startGroup` of a
|
|
4348
|
+
* {@link (LocationFilterType:enum).RelativeStart}, which counts back from the Next
|
|
4349
|
+
* Group: 0 is the Next Group, 1 the current one. The wire carries the End Group
|
|
4350
|
+
* as a delta from the Start Group; that is undone on the way in and redone on
|
|
4351
|
+
* the way out.
|
|
4352
|
+
*
|
|
4353
|
+
* If omitted from SUBSCRIBE or FETCH, the subscription or fetch is unfiltered.
|
|
4201
4354
|
* If omitted from REQUEST_UPDATE, the value is unchanged.
|
|
4202
4355
|
*/
|
|
4203
|
-
var
|
|
4356
|
+
var LocationFilter = class LocationFilter {
|
|
4204
4357
|
filterType;
|
|
4205
|
-
|
|
4358
|
+
startGroup;
|
|
4359
|
+
startObject;
|
|
4206
4360
|
endGroup;
|
|
4361
|
+
endObject;
|
|
4207
4362
|
static TYPE = 33;
|
|
4208
|
-
|
|
4363
|
+
/**
|
|
4364
|
+
* @throws :{@link ProtocolViolationError} When a field the type calls for is
|
|
4365
|
+
* missing, or the End Group is before the Start Group.
|
|
4366
|
+
*/
|
|
4367
|
+
constructor(filterType, startGroup, startObject, endGroup, endObject) {
|
|
4209
4368
|
this.filterType = filterType;
|
|
4210
|
-
this.
|
|
4369
|
+
this.startGroup = startGroup;
|
|
4370
|
+
this.startObject = startObject;
|
|
4211
4371
|
this.endGroup = endGroup;
|
|
4372
|
+
this.endObject = endObject;
|
|
4373
|
+
const fields = [
|
|
4374
|
+
startGroup,
|
|
4375
|
+
startObject,
|
|
4376
|
+
endGroup,
|
|
4377
|
+
endObject
|
|
4378
|
+
];
|
|
4379
|
+
const count = FIELD_COUNT[filterType];
|
|
4380
|
+
if (count === void 0) throw new ProtocolViolationError("LocationFilter", `unknown Location Filter Type ${filterType}`);
|
|
4381
|
+
fields.forEach((field, i) => {
|
|
4382
|
+
if (field !== void 0 !== i < count) throw new ProtocolViolationError("LocationFilter", `Location Filter Type ${filterType} carries ${count} fields; field ${i + 1} is ${field === void 0 ? "missing" : "not one of them"}`);
|
|
4383
|
+
});
|
|
4384
|
+
if (endGroup !== void 0 && endGroup < startGroup) throw new ProtocolViolationError("LocationFilter", `End Group ${endGroup} is before Start Group ${startGroup}`);
|
|
4385
|
+
}
|
|
4386
|
+
/**
|
|
4387
|
+
* The first Location the filter passes, given the track's Largest Object, or
|
|
4388
|
+
* `undefined` when there is no filter. A relative start that would fall before
|
|
4389
|
+
* group 0 is group 0; a track with nothing published yet starts a relative
|
|
4390
|
+
* filter at `{0,0}`.
|
|
4391
|
+
*/
|
|
4392
|
+
startLocation(largest) {
|
|
4393
|
+
switch (this.filterType) {
|
|
4394
|
+
case 0: return;
|
|
4395
|
+
case 1: {
|
|
4396
|
+
if (!largest) return new Location(0n, 0n);
|
|
4397
|
+
const group = largest.group + 1n - this.startGroup;
|
|
4398
|
+
return new Location(group < 0n ? 0n : group > MAX_U64$1 ? MAX_U64$1 : group, 0n);
|
|
4399
|
+
}
|
|
4400
|
+
case 5: return largest ? new Location(largest.group, largest.object + 1n) : new Location(0n, 0n);
|
|
4401
|
+
default: return new Location(this.startGroup, this.startObject);
|
|
4402
|
+
}
|
|
4403
|
+
}
|
|
4404
|
+
/** The Start Location an absolute filter carries; `undefined` for the others. */
|
|
4405
|
+
get absoluteStart() {
|
|
4406
|
+
switch (this.filterType) {
|
|
4407
|
+
case 2:
|
|
4408
|
+
case 3:
|
|
4409
|
+
case 4: return new Location(this.startGroup, this.startObject);
|
|
4410
|
+
default: return;
|
|
4411
|
+
}
|
|
4412
|
+
}
|
|
4413
|
+
/**
|
|
4414
|
+
* The last Location the filter passes, inclusive, or `undefined` when it is
|
|
4415
|
+
* open-ended. A Group End is the whole of that group, so its Object is 2^64-1.
|
|
4416
|
+
*/
|
|
4417
|
+
endLocation() {
|
|
4418
|
+
switch (this.filterType) {
|
|
4419
|
+
case 3: return new Location(this.endGroup, MAX_U64$1);
|
|
4420
|
+
case 4: return new Location(this.endGroup, this.endObject);
|
|
4421
|
+
default: return;
|
|
4422
|
+
}
|
|
4423
|
+
}
|
|
4424
|
+
/**
|
|
4425
|
+
* The inclusive range the filter selects under the rules for a Fetch, which
|
|
4426
|
+
* never reach past the Largest Object: an open end is the Largest Object, and
|
|
4427
|
+
* no filter at all is the whole track up to it.
|
|
4428
|
+
*
|
|
4429
|
+
* `undefined` when that range is empty, which includes a track with nothing
|
|
4430
|
+
* published yet and a Next Object filter, whose start is always past the
|
|
4431
|
+
* Largest Object.
|
|
4432
|
+
*/
|
|
4433
|
+
fetchRange(largest) {
|
|
4434
|
+
if (!largest) return void 0;
|
|
4435
|
+
const start = this.startLocation(largest) ?? new Location(0n, 0n);
|
|
4436
|
+
const filterEnd = this.endLocation();
|
|
4437
|
+
const end = filterEnd && filterEnd.compare(largest) < 0 ? filterEnd : largest;
|
|
4438
|
+
return start.compare(end) <= 0 ? {
|
|
4439
|
+
start,
|
|
4440
|
+
end
|
|
4441
|
+
} : void 0;
|
|
4442
|
+
}
|
|
4443
|
+
/** The Location Filter Type and its fields, without the Parameter Type. */
|
|
4444
|
+
serializeValue() {
|
|
4445
|
+
const buf = new ByteBuffer();
|
|
4446
|
+
buf.putVI(this.filterType);
|
|
4447
|
+
const count = FIELD_COUNT[this.filterType];
|
|
4448
|
+
if (count > 0) buf.putVI(this.startGroup);
|
|
4449
|
+
if (count > 1) buf.putVI(this.startObject);
|
|
4450
|
+
if (count > 2) buf.putVI(this.endGroup - this.startGroup);
|
|
4451
|
+
if (count > 3) buf.putVI(this.endObject);
|
|
4452
|
+
return buf.toUint8Array();
|
|
4453
|
+
}
|
|
4454
|
+
/**
|
|
4455
|
+
* Reads a Location Filter Type and exactly the fields it calls for.
|
|
4456
|
+
* @throws :{@link ProtocolViolationError} For an unknown Location Filter Type,
|
|
4457
|
+
* or an End Group past 2^64-1.
|
|
4458
|
+
*/
|
|
4459
|
+
static deserializeValue(buf) {
|
|
4460
|
+
const raw = buf.getVI();
|
|
4461
|
+
let filterType;
|
|
4462
|
+
try {
|
|
4463
|
+
filterType = LocationFilterType.tryFrom(raw);
|
|
4464
|
+
} catch {
|
|
4465
|
+
throw new ProtocolViolationError("LocationFilter.deserializeValue", `unknown Location Filter Type ${raw}`);
|
|
4466
|
+
}
|
|
4467
|
+
const count = FIELD_COUNT[filterType];
|
|
4468
|
+
const startGroup = count > 0 ? buf.getVI() : void 0;
|
|
4469
|
+
const startObject = count > 1 ? buf.getVI() : void 0;
|
|
4470
|
+
let endGroup;
|
|
4471
|
+
if (count > 2) {
|
|
4472
|
+
endGroup = startGroup + buf.getVI();
|
|
4473
|
+
if (endGroup > MAX_U64$1) throw new ProtocolViolationError("LocationFilter.deserializeValue", `StartGroup plus EndGroupDelta exceeds 2^64 - 1`);
|
|
4474
|
+
}
|
|
4475
|
+
const endObject = count > 3 ? buf.getVI() : void 0;
|
|
4476
|
+
return new LocationFilter(filterType, startGroup, startObject, endGroup, endObject);
|
|
4477
|
+
}
|
|
4478
|
+
toKeyValuePair() {
|
|
4479
|
+
return KeyValuePair.tryNewBytes(LocationFilter.TYPE, this.serializeValue());
|
|
4480
|
+
}
|
|
4481
|
+
static fromKeyValuePair(pair) {
|
|
4482
|
+
if (Number(pair.typeValue) !== LocationFilter.TYPE || !(pair.value instanceof Uint8Array)) return void 0;
|
|
4483
|
+
const buf = new ByteBuffer();
|
|
4484
|
+
buf.putBytes(pair.value);
|
|
4485
|
+
const frozen = buf.freeze();
|
|
4486
|
+
const filter = LocationFilter.deserializeValue(frozen);
|
|
4487
|
+
if (frozen.remaining > 0) throw new ProtocolViolationError("LocationFilter.fromKeyValuePair", "trailing bytes after the Location Filter");
|
|
4488
|
+
return filter;
|
|
4489
|
+
}
|
|
4490
|
+
};
|
|
4491
|
+
//#endregion
|
|
4492
|
+
//#region src/model/parameter/message/switch_from.ts
|
|
4493
|
+
/**
|
|
4494
|
+
* Copyright 2026 The MOQtail Authors
|
|
4495
|
+
*
|
|
4496
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4497
|
+
* you may not use this file except in compliance with the License.
|
|
4498
|
+
* You may obtain a copy of the License at
|
|
4499
|
+
*
|
|
4500
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4501
|
+
*
|
|
4502
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
4503
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4504
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4505
|
+
* See the License for the specific language governing permissions and
|
|
4506
|
+
* limitations under the License.
|
|
4507
|
+
*/
|
|
4508
|
+
/**
|
|
4509
|
+
* Identifies the subscription being replaced by a switch request.
|
|
4510
|
+
* The value is two varints followed by a flags byte: bit 7 (MSB) is Publish Done;
|
|
4511
|
+
* bits 0 through 6 are reserved and must be zero.
|
|
4512
|
+
*/
|
|
4513
|
+
var SwitchFrom = class SwitchFrom {
|
|
4514
|
+
requestId;
|
|
4515
|
+
mode;
|
|
4516
|
+
publishDone;
|
|
4517
|
+
static TYPE = 36;
|
|
4518
|
+
constructor(requestId, mode, publishDone) {
|
|
4519
|
+
this.requestId = requestId;
|
|
4520
|
+
this.mode = mode;
|
|
4521
|
+
this.publishDone = publishDone;
|
|
4522
|
+
}
|
|
4523
|
+
toKeyValuePair() {
|
|
4524
|
+
const buf = new ByteBuffer();
|
|
4525
|
+
buf.putVI(this.requestId);
|
|
4526
|
+
buf.putVI(this.mode);
|
|
4527
|
+
buf.putU8(this.publishDone ? 128 : 0);
|
|
4528
|
+
return KeyValuePair.newBytes(SwitchFrom.TYPE, buf.toUint8Array());
|
|
4529
|
+
}
|
|
4530
|
+
static fromKeyValuePair(pair) {
|
|
4531
|
+
if (Number(pair.typeValue) !== SwitchFrom.TYPE || !(pair.value instanceof Uint8Array)) return void 0;
|
|
4532
|
+
const buf = new ByteBuffer();
|
|
4533
|
+
buf.putBytes(pair.value);
|
|
4534
|
+
const requestId = buf.getVI();
|
|
4535
|
+
const modeValue = buf.getVI();
|
|
4536
|
+
if (modeValue !== BigInt(0) && modeValue !== BigInt(1)) throw new ProtocolViolationError("SwitchFrom.fromKeyValuePair", `invalid mode ${modeValue}`);
|
|
4537
|
+
const flags = buf.getU8();
|
|
4538
|
+
if ((flags & 127) !== 0) throw new ProtocolViolationError("SwitchFrom.fromKeyValuePair", `reserved bits must be zero, got ${flags}`);
|
|
4539
|
+
if (buf.remaining !== 0) throw new ProtocolViolationError("SwitchFrom.fromKeyValuePair", "unexpected trailing bytes");
|
|
4540
|
+
return new SwitchFrom(requestId, Number(modeValue), (flags & 128) !== 0);
|
|
4541
|
+
}
|
|
4542
|
+
};
|
|
4543
|
+
//#endregion
|
|
4544
|
+
//#region src/model/parameter/message/fill_parameters.ts
|
|
4545
|
+
/**
|
|
4546
|
+
* Copyright 2026 The MOQtail Authors
|
|
4547
|
+
*
|
|
4548
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4549
|
+
* you may not use this file except in compliance with the License.
|
|
4550
|
+
* You may obtain a copy of the License at
|
|
4551
|
+
*
|
|
4552
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4553
|
+
*
|
|
4554
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
4555
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4556
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4557
|
+
* See the License for the specific language governing permissions and
|
|
4558
|
+
* limitations under the License.
|
|
4559
|
+
*/
|
|
4560
|
+
/** The only parameters that may override anything for the fill fetch stream. */
|
|
4561
|
+
const ALLOWED = [
|
|
4562
|
+
10,
|
|
4563
|
+
32,
|
|
4564
|
+
33,
|
|
4565
|
+
34,
|
|
4566
|
+
37,
|
|
4567
|
+
38,
|
|
4568
|
+
39,
|
|
4569
|
+
40
|
|
4570
|
+
];
|
|
4571
|
+
/**
|
|
4572
|
+
* Requests a fill fetch stream, and overrides for it. An omitted parameter keeps
|
|
4573
|
+
* the value it has for the live subscription; an omitted LOCATION_FILTER fills
|
|
4574
|
+
* over the subscription's own.
|
|
4575
|
+
*/
|
|
4576
|
+
var FillParameters = class FillParameters {
|
|
4577
|
+
parameters;
|
|
4578
|
+
static TYPE = 35;
|
|
4579
|
+
constructor(parameters) {
|
|
4580
|
+
this.parameters = parameters;
|
|
4581
|
+
}
|
|
4582
|
+
toKeyValuePair() {
|
|
4583
|
+
const pairs = this.parameters.map((p) => p.toKeyValuePair());
|
|
4584
|
+
for (const pair of pairs) if (!ALLOWED.includes(Number(pair.typeValue))) throw new ProtocolViolationError("FillParameters.toKeyValuePair", `parameter type 0x${pair.typeValue.toString(16)} is not allowed inside FILL_PARAMETERS`);
|
|
4585
|
+
const value = new ByteBuffer();
|
|
4586
|
+
value.putVI(pairs.length);
|
|
4587
|
+
value.putBytes(serializeMessageParameterKvps(pairs).toUint8Array());
|
|
4588
|
+
return KeyValuePair.tryNewBytes(FillParameters.TYPE, value.toUint8Array());
|
|
4589
|
+
}
|
|
4590
|
+
static fromKeyValuePair(pair) {
|
|
4591
|
+
if (Number(pair.typeValue) !== FillParameters.TYPE || !(pair.value instanceof Uint8Array)) return void 0;
|
|
4592
|
+
const buf = new ByteBuffer();
|
|
4593
|
+
buf.putBytes(pair.value);
|
|
4594
|
+
const frozen = buf.freeze();
|
|
4595
|
+
const count = frozen.getVI();
|
|
4596
|
+
const pairs = deserializeMessageParameterKvps(frozen, count);
|
|
4597
|
+
if (frozen.remaining > 0) throw new ProtocolViolationError("FillParameters.fromKeyValuePair", `${frozen.remaining} bytes left after ${count} parameters`);
|
|
4598
|
+
for (const inner of pairs) if (!ALLOWED.includes(Number(inner.typeValue))) throw new ProtocolViolationError("FillParameters.fromKeyValuePair", `parameter type 0x${inner.typeValue.toString(16)} is not allowed inside FILL_PARAMETERS`);
|
|
4599
|
+
return new FillParameters(MessageParameters.fromKeyValuePairs(pairs));
|
|
4600
|
+
}
|
|
4601
|
+
};
|
|
4602
|
+
//#endregion
|
|
4603
|
+
//#region src/model/parameter/message/range_filter.ts
|
|
4604
|
+
/**
|
|
4605
|
+
* Copyright 2026 The MOQtail Authors
|
|
4606
|
+
*
|
|
4607
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4608
|
+
* you may not use this file except in compliance with the License.
|
|
4609
|
+
* You may obtain a copy of the License at
|
|
4610
|
+
*
|
|
4611
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4612
|
+
*
|
|
4613
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
4614
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4615
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4616
|
+
* See the License for the specific language governing permissions and
|
|
4617
|
+
* limitations under the License.
|
|
4618
|
+
*/
|
|
4619
|
+
const MAX_U64 = 18446744073709551615n;
|
|
4620
|
+
/**
|
|
4621
|
+
* What a Range Filter selects on. Each kind is its own parameter type, and the two
|
|
4622
|
+
* property kinds also name the Property they read.
|
|
4623
|
+
*/
|
|
4624
|
+
let RangeFilterKind = /* @__PURE__ */ function(RangeFilterKind) {
|
|
4625
|
+
RangeFilterKind[RangeFilterKind["Subgroup"] = 37] = "Subgroup";
|
|
4626
|
+
RangeFilterKind[RangeFilterKind["ObjectId"] = 38] = "ObjectId";
|
|
4627
|
+
/** Publisher Priority, which is a single byte. */
|
|
4628
|
+
RangeFilterKind[RangeFilterKind["Priority"] = 39] = "Priority";
|
|
4629
|
+
RangeFilterKind[RangeFilterKind["ObjectProperty"] = 40] = "ObjectProperty";
|
|
4630
|
+
/** Selects tracks rather than Objects, so it only rides SUBSCRIBE_TRACKS. */
|
|
4631
|
+
RangeFilterKind[RangeFilterKind["TrackProperty"] = 41] = "TrackProperty";
|
|
4632
|
+
return RangeFilterKind;
|
|
4633
|
+
}({});
|
|
4634
|
+
(function(_RangeFilterKind) {
|
|
4635
|
+
function hasPropertyType(kind) {
|
|
4636
|
+
return kind === RangeFilterKind.ObjectProperty || kind === RangeFilterKind.TrackProperty;
|
|
4637
|
+
}
|
|
4638
|
+
_RangeFilterKind.hasPropertyType = hasPropertyType;
|
|
4639
|
+
function isRangeFilterType(typeValue) {
|
|
4640
|
+
const n = Number(typeValue);
|
|
4641
|
+
return n >= 37 && n <= 41;
|
|
4642
|
+
}
|
|
4643
|
+
_RangeFilterKind.isRangeFilterType = isRangeFilterType;
|
|
4644
|
+
})(RangeFilterKind || (RangeFilterKind = {}));
|
|
4645
|
+
/**
|
|
4646
|
+
* A Range Filter that cannot be honoured. A peer that sends one is answered with
|
|
4647
|
+
* REQUEST_ERROR INVALID_FILTER rather than a closed session: the request is
|
|
4648
|
+
* well-formed, it just asks for something that cannot be applied.
|
|
4649
|
+
*/
|
|
4650
|
+
var InvalidFilterError = class extends MOQtailError {
|
|
4651
|
+
context;
|
|
4652
|
+
details;
|
|
4653
|
+
constructor(context, details) {
|
|
4654
|
+
super(`Invalid filter in ${context}: ${details}`);
|
|
4655
|
+
this.context = context;
|
|
4656
|
+
this.details = details;
|
|
4657
|
+
}
|
|
4658
|
+
};
|
|
4659
|
+
/**
|
|
4660
|
+
* Delta-encodes ascending `ranges`. Only the last may be open-ended.
|
|
4661
|
+
* @throws :{@link InvalidFilterError} When the ranges do not ascend.
|
|
4662
|
+
*/
|
|
4663
|
+
function encodeRanges(ranges) {
|
|
4664
|
+
const deltas = [];
|
|
4665
|
+
let priorEnd = 0n;
|
|
4666
|
+
ranges.forEach((range, i) => {
|
|
4667
|
+
if (range.start < priorEnd || range.end !== void 0 && range.end < range.start) throw new InvalidFilterError("encodeRanges", "ranges are not ascending");
|
|
4668
|
+
if (range.end === void 0) {
|
|
4669
|
+
if (i + 1 !== ranges.length) throw new InvalidFilterError("encodeRanges", "only the last range can be open-ended");
|
|
4670
|
+
deltas.push([range.start - priorEnd]);
|
|
4671
|
+
return;
|
|
4672
|
+
}
|
|
4673
|
+
deltas.push([range.start - priorEnd, range.end - range.start]);
|
|
4674
|
+
priorEnd = range.end;
|
|
4675
|
+
});
|
|
4676
|
+
return deltas;
|
|
4677
|
+
}
|
|
4678
|
+
/**
|
|
4679
|
+
* One Range Filter parameter. Unlike other parameters it may repeat in a message,
|
|
4680
|
+
* once per SetID (and Property Type).
|
|
4681
|
+
*
|
|
4682
|
+
* Without a `setId` it is the zero-length form, which in REQUEST_UPDATE removes the
|
|
4683
|
+
* filters of its kind.
|
|
4684
|
+
*
|
|
4685
|
+
* The Ranges are held as the wire's deltas and only added back by {@link
|
|
4686
|
+
* RangeFilter.ranges}: a sum past 2^64-1 is answered with a REQUEST_ERROR for the
|
|
4687
|
+
* request that carried it, which a parser that rejected it could not do.
|
|
4688
|
+
*/
|
|
4689
|
+
var RangeFilter = class RangeFilter {
|
|
4690
|
+
kind;
|
|
4691
|
+
setId;
|
|
4692
|
+
propertyType;
|
|
4693
|
+
deltas;
|
|
4694
|
+
/**
|
|
4695
|
+
* @throws :{@link ProtocolViolationError} When the Property Type's presence does not
|
|
4696
|
+
* match the kind, or a removal carries anything but its kind.
|
|
4697
|
+
*/
|
|
4698
|
+
constructor(kind, setId, propertyType, deltas = []) {
|
|
4699
|
+
this.kind = kind;
|
|
4700
|
+
this.setId = setId;
|
|
4701
|
+
this.propertyType = propertyType;
|
|
4702
|
+
this.deltas = deltas;
|
|
4703
|
+
if (setId === void 0) {
|
|
4704
|
+
if (propertyType !== void 0 || deltas.length > 0) throw new ProtocolViolationError("RangeFilter", "a removal carries no SetID, Property Type or Ranges");
|
|
4705
|
+
return;
|
|
4706
|
+
}
|
|
4707
|
+
if (!Number.isInteger(setId) || setId < 0 || setId > 255) throw new ProtocolViolationError("RangeFilter", `SetID ${setId} is not a single byte`);
|
|
4708
|
+
if (RangeFilterKind.hasPropertyType(kind) !== (propertyType !== void 0)) throw new ProtocolViolationError("RangeFilter", `${RangeFilterKind[kind]} filter has the wrong Property Type presence`);
|
|
4709
|
+
deltas.forEach(([, end], i) => {
|
|
4710
|
+
if (end === void 0 && i + 1 !== deltas.length) throw new ProtocolViolationError("RangeFilter", "only the last range can be open-ended");
|
|
4711
|
+
});
|
|
4712
|
+
}
|
|
4713
|
+
/** The zero-length form, which removes the filters of its kind. */
|
|
4714
|
+
get isRemoval() {
|
|
4715
|
+
return this.setId === void 0;
|
|
4716
|
+
}
|
|
4717
|
+
/** How many Ranges the filter holds, which is what a peer's range limit counts. */
|
|
4718
|
+
get rangeCount() {
|
|
4719
|
+
return this.deltas.length;
|
|
4720
|
+
}
|
|
4721
|
+
/**
|
|
4722
|
+
* The Ranges with their deltas added back.
|
|
4723
|
+
* @throws :{@link InvalidFilterError} When a bound exceeds 2^64-1.
|
|
4724
|
+
*/
|
|
4725
|
+
ranges() {
|
|
4726
|
+
const ranges = [];
|
|
4727
|
+
let priorEnd = 0n;
|
|
4728
|
+
for (const [startDelta, endDelta] of this.deltas) {
|
|
4729
|
+
const start = priorEnd + startDelta;
|
|
4730
|
+
if (start > MAX_U64) throw new InvalidFilterError("RangeFilter.ranges", "a range bound exceeds 2^64 - 1");
|
|
4731
|
+
if (endDelta === void 0) {
|
|
4732
|
+
ranges.push({ start });
|
|
4733
|
+
continue;
|
|
4734
|
+
}
|
|
4735
|
+
const end = start + endDelta;
|
|
4736
|
+
if (end > MAX_U64) throw new InvalidFilterError("RangeFilter.ranges", "a range bound exceeds 2^64 - 1");
|
|
4737
|
+
ranges.push({
|
|
4738
|
+
start,
|
|
4739
|
+
end
|
|
4740
|
+
});
|
|
4741
|
+
priorEnd = end;
|
|
4742
|
+
}
|
|
4743
|
+
return ranges;
|
|
4744
|
+
}
|
|
4745
|
+
/**
|
|
4746
|
+
* The Ranges, once everything a filter of this kind has to satisfy holds.
|
|
4747
|
+
* @throws :{@link InvalidFilterError} For an odd Property Type, a priority above
|
|
4748
|
+
* 255, or a bound past 2^64-1.
|
|
4749
|
+
*/
|
|
4750
|
+
validate() {
|
|
4751
|
+
if (this.propertyType !== void 0 && this.propertyType % 2n !== 0n) throw new InvalidFilterError("RangeFilter.validate", `property type 0x${this.propertyType.toString(16)} is odd`);
|
|
4752
|
+
const ranges = this.ranges();
|
|
4753
|
+
if (this.kind === RangeFilterKind.Priority) {
|
|
4754
|
+
const over = ranges.flatMap((r) => [r.start, r.end]).find((v) => v !== void 0 && v > 255n);
|
|
4755
|
+
if (over !== void 0) throw new InvalidFilterError("RangeFilter.validate", `priority ${over} is outside 0-255`);
|
|
4756
|
+
}
|
|
4757
|
+
return ranges;
|
|
4212
4758
|
}
|
|
4213
|
-
|
|
4759
|
+
/** The SetID, Property Type if any, and the Ranges, without the Type or Length. */
|
|
4760
|
+
serializeValue() {
|
|
4761
|
+
if (this.setId === void 0) return /* @__PURE__ */ new Uint8Array();
|
|
4214
4762
|
const buf = new ByteBuffer();
|
|
4215
|
-
buf.
|
|
4216
|
-
if (this.
|
|
4217
|
-
|
|
4763
|
+
buf.putU8(this.setId);
|
|
4764
|
+
if (this.propertyType !== void 0) buf.putVI(this.propertyType);
|
|
4765
|
+
for (const [start, end] of this.deltas) {
|
|
4766
|
+
buf.putVI(start);
|
|
4767
|
+
if (end !== void 0) buf.putVI(end);
|
|
4218
4768
|
}
|
|
4219
|
-
|
|
4220
|
-
|
|
4769
|
+
return buf.toUint8Array();
|
|
4770
|
+
}
|
|
4771
|
+
toKeyValuePair() {
|
|
4772
|
+
return KeyValuePair.newBytes(this.kind, this.serializeValue());
|
|
4221
4773
|
}
|
|
4774
|
+
/**
|
|
4775
|
+
* Decodes a Range Filter value. The Value ends with the last Range, so a Start
|
|
4776
|
+
* with nothing after it is an open-ended last Range.
|
|
4777
|
+
*/
|
|
4222
4778
|
static fromKeyValuePair(pair) {
|
|
4223
|
-
if (
|
|
4779
|
+
if (!RangeFilterKind.isRangeFilterType(pair.typeValue) || !(pair.value instanceof Uint8Array)) return void 0;
|
|
4780
|
+
const kind = Number(pair.typeValue);
|
|
4781
|
+
if (pair.value.length === 0) return new RangeFilter(kind);
|
|
4224
4782
|
const buf = new ByteBuffer();
|
|
4225
4783
|
buf.putBytes(pair.value);
|
|
4226
|
-
const
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4784
|
+
const frozen = buf.freeze();
|
|
4785
|
+
const setId = frozen.getU8();
|
|
4786
|
+
const propertyType = RangeFilterKind.hasPropertyType(kind) ? frozen.getVI() : void 0;
|
|
4787
|
+
const deltas = [];
|
|
4788
|
+
while (frozen.remaining > 0) {
|
|
4789
|
+
const start = frozen.getVI();
|
|
4790
|
+
deltas.push(frozen.remaining > 0 ? [start, frozen.getVI()] : [start]);
|
|
4791
|
+
}
|
|
4792
|
+
return new RangeFilter(kind, setId, propertyType, deltas);
|
|
4232
4793
|
}
|
|
4233
4794
|
};
|
|
4234
4795
|
//#endregion
|
|
@@ -4251,7 +4812,7 @@ var SubscriptionFilter = class SubscriptionFilter {
|
|
|
4251
4812
|
let MessageParameter;
|
|
4252
4813
|
(function(_MessageParameter) {
|
|
4253
4814
|
function fromKeyValuePair(pair) {
|
|
4254
|
-
return ObjectDeliveryTimeout.fromKeyValuePair(pair) ?? SubgroupDeliveryTimeout.fromKeyValuePair(pair) ?? RendezvousTimeout.fromKeyValuePair(pair) ?? FillTimeout.fromKeyValuePair(pair) ?? AuthorizationToken.fromKeyValuePair(pair) ?? Expires.fromKeyValuePair(pair) ?? LargestObject.fromKeyValuePair(pair) ?? Forward.fromKeyValuePair(pair) ?? SubscriberPriority.fromKeyValuePair(pair) ?? GroupOrderParam.fromKeyValuePair(pair) ??
|
|
4815
|
+
return ObjectDeliveryTimeout.fromKeyValuePair(pair) ?? SubgroupDeliveryTimeout.fromKeyValuePair(pair) ?? RendezvousTimeout.fromKeyValuePair(pair) ?? FillTimeout.fromKeyValuePair(pair) ?? AuthorizationToken.fromKeyValuePair(pair) ?? Expires.fromKeyValuePair(pair) ?? LargestObject.fromKeyValuePair(pair) ?? Forward.fromKeyValuePair(pair) ?? SubscriberPriority.fromKeyValuePair(pair) ?? GroupOrderParam.fromKeyValuePair(pair) ?? LocationFilter.fromKeyValuePair(pair) ?? NewGroupRequest.fromKeyValuePair(pair) ?? SwitchFrom.fromKeyValuePair(pair) ?? FillParameters.fromKeyValuePair(pair) ?? RangeFilter.fromKeyValuePair(pair) ?? IncludeProperties.fromKeyValuePair(pair) ?? SwitchingSetAssignment.fromKeyValuePair(pair);
|
|
4255
4816
|
}
|
|
4256
4817
|
_MessageParameter.fromKeyValuePair = fromKeyValuePair;
|
|
4257
4818
|
function toKeyValuePair(param) {
|
|
@@ -4306,14 +4867,42 @@ let MessageParameter;
|
|
|
4306
4867
|
return params.find(isGroupOrderParam)?.order ?? 0;
|
|
4307
4868
|
}
|
|
4308
4869
|
_MessageParameter.groupOrderOf = groupOrderOf;
|
|
4309
|
-
function
|
|
4310
|
-
return param instanceof
|
|
4870
|
+
function isLocationFilter(param) {
|
|
4871
|
+
return param instanceof LocationFilter;
|
|
4311
4872
|
}
|
|
4312
|
-
_MessageParameter.
|
|
4873
|
+
_MessageParameter.isLocationFilter = isLocationFilter;
|
|
4313
4874
|
function isNewGroupRequest(param) {
|
|
4314
4875
|
return param instanceof NewGroupRequest;
|
|
4315
4876
|
}
|
|
4316
4877
|
_MessageParameter.isNewGroupRequest = isNewGroupRequest;
|
|
4878
|
+
function isSwitchFrom(param) {
|
|
4879
|
+
return param instanceof SwitchFrom;
|
|
4880
|
+
}
|
|
4881
|
+
_MessageParameter.isSwitchFrom = isSwitchFrom;
|
|
4882
|
+
function isFillParameters(param) {
|
|
4883
|
+
return param instanceof FillParameters;
|
|
4884
|
+
}
|
|
4885
|
+
_MessageParameter.isFillParameters = isFillParameters;
|
|
4886
|
+
function isRangeFilter(param) {
|
|
4887
|
+
return param instanceof RangeFilter;
|
|
4888
|
+
}
|
|
4889
|
+
_MessageParameter.isRangeFilter = isRangeFilter;
|
|
4890
|
+
function carriesRangeFilter(params) {
|
|
4891
|
+
return params.some((p) => isRangeFilter(p) || isFillParameters(p) && carriesRangeFilter(p.parameters));
|
|
4892
|
+
}
|
|
4893
|
+
_MessageParameter.carriesRangeFilter = carriesRangeFilter;
|
|
4894
|
+
function isIncludeProperties(param) {
|
|
4895
|
+
return param instanceof IncludeProperties;
|
|
4896
|
+
}
|
|
4897
|
+
_MessageParameter.isIncludeProperties = isIncludeProperties;
|
|
4898
|
+
function publishParametersFor(subscribeTracks) {
|
|
4899
|
+
return subscribeTracks.filter((p) => isForward(p) || isGroupOrderParam(p) || isLocationFilter(p));
|
|
4900
|
+
}
|
|
4901
|
+
_MessageParameter.publishParametersFor = publishParametersFor;
|
|
4902
|
+
function includesProperties(params) {
|
|
4903
|
+
return !params.some((p) => isIncludeProperties(p) && !p.include);
|
|
4904
|
+
}
|
|
4905
|
+
_MessageParameter.includesProperties = includesProperties;
|
|
4317
4906
|
})(MessageParameter || (MessageParameter = {}));
|
|
4318
4907
|
/**
|
|
4319
4908
|
* Builder for constructing a list of MessageParameters.
|
|
@@ -4346,18 +4935,30 @@ var MessageParameters = class {
|
|
|
4346
4935
|
addForward(forward) {
|
|
4347
4936
|
return this.add(new Forward(forward));
|
|
4348
4937
|
}
|
|
4938
|
+
addIncludeProperties(include) {
|
|
4939
|
+
return this.add(new IncludeProperties(include));
|
|
4940
|
+
}
|
|
4349
4941
|
addSubscriberPriority(priority) {
|
|
4350
4942
|
return this.add(new SubscriberPriority(priority));
|
|
4351
4943
|
}
|
|
4352
4944
|
addGroupOrder(order) {
|
|
4353
4945
|
return this.add(new GroupOrderParam(order));
|
|
4354
4946
|
}
|
|
4355
|
-
|
|
4947
|
+
addLocationFilter(filter) {
|
|
4356
4948
|
return this.add(filter);
|
|
4357
4949
|
}
|
|
4358
4950
|
addNewGroupRequest(group) {
|
|
4359
4951
|
return this.add(new NewGroupRequest(BigInt(group)));
|
|
4360
4952
|
}
|
|
4953
|
+
addSwitchFrom(requestId, mode, publishDone) {
|
|
4954
|
+
return this.add(new SwitchFrom(BigInt(requestId), mode, publishDone));
|
|
4955
|
+
}
|
|
4956
|
+
addFillParameters(parameters) {
|
|
4957
|
+
return this.add(new FillParameters(parameters));
|
|
4958
|
+
}
|
|
4959
|
+
addRangeFilter(filter) {
|
|
4960
|
+
return this.add(filter);
|
|
4961
|
+
}
|
|
4361
4962
|
build() {
|
|
4362
4963
|
return [...this.params];
|
|
4363
4964
|
}
|
|
@@ -4375,24 +4976,23 @@ var MessageParameters = class {
|
|
|
4375
4976
|
return result;
|
|
4376
4977
|
}
|
|
4377
4978
|
};
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
return typeValue === 16n || typeValue === 32n || typeValue === 34n;
|
|
4979
|
+
function valueShapeOf(typeValue) {
|
|
4980
|
+
switch (typeValue) {
|
|
4981
|
+
case BigInt(16):
|
|
4982
|
+
case BigInt(32):
|
|
4983
|
+
case BigInt(34):
|
|
4984
|
+
case BigInt(53): return 1;
|
|
4985
|
+
case BigInt(9): return 2;
|
|
4986
|
+
case BigInt(33): return 3;
|
|
4987
|
+
case BigInt(36):
|
|
4988
|
+
case BigInt(52):
|
|
4989
|
+
case BigInt(37):
|
|
4990
|
+
case BigInt(38):
|
|
4991
|
+
case BigInt(39):
|
|
4992
|
+
case BigInt(40):
|
|
4993
|
+
case BigInt(41): return 4;
|
|
4994
|
+
default: return typeValue % 2n === 0n ? 0 : 4;
|
|
4995
|
+
}
|
|
4396
4996
|
}
|
|
4397
4997
|
/**
|
|
4398
4998
|
* Serializes a list of message-parameter KVPs, delta-encoding the Types.
|
|
@@ -4404,12 +5004,22 @@ function serializeMessageParameterKvps(items) {
|
|
|
4404
5004
|
let prevType = 0n;
|
|
4405
5005
|
for (const kvp of sorted) {
|
|
4406
5006
|
buf.putVI(kvp.typeValue - prevType);
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
5007
|
+
switch (valueShapeOf(kvp.typeValue)) {
|
|
5008
|
+
case 1:
|
|
5009
|
+
if (!isVarInt(kvp) || kvp.value < 0n || kvp.value > 255n) throw new ProtocolViolationError("serializeMessageParameterKvps", `uint8 parameter 0x${kvp.typeValue.toString(16)} value ${kvp.value} exceeds 255`);
|
|
5010
|
+
buf.putU8(Number(kvp.value));
|
|
5011
|
+
break;
|
|
5012
|
+
case 2:
|
|
5013
|
+
case 3:
|
|
5014
|
+
if (isBytes(kvp)) buf.putBytes(kvp.value);
|
|
5015
|
+
break;
|
|
5016
|
+
case 4:
|
|
5017
|
+
if (isBytes(kvp)) buf.putLengthPrefixedBytes(kvp.value);
|
|
5018
|
+
break;
|
|
5019
|
+
case 0:
|
|
5020
|
+
if (isVarInt(kvp)) buf.putVI(kvp.value);
|
|
5021
|
+
break;
|
|
5022
|
+
}
|
|
4413
5023
|
prevType = kvp.typeValue;
|
|
4414
5024
|
}
|
|
4415
5025
|
return buf.freeze();
|
|
@@ -4420,33 +5030,53 @@ function serializeMessageParameterKvps(items) {
|
|
|
4420
5030
|
*/
|
|
4421
5031
|
function deserializeMessageParameterKvps(buf, count) {
|
|
4422
5032
|
const n = typeof count === "bigint" ? Number(count) : count;
|
|
4423
|
-
|
|
5033
|
+
let read = 0;
|
|
5034
|
+
return readMessageParameterKvps(buf, () => read++ < n);
|
|
5035
|
+
}
|
|
5036
|
+
function readMessageParameterKvps(buf, more) {
|
|
5037
|
+
const items = [];
|
|
4424
5038
|
let prevType = 0n;
|
|
4425
|
-
|
|
5039
|
+
while (more()) {
|
|
4426
5040
|
const typeValue = prevType + buf.getVI();
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
5041
|
+
switch (valueShapeOf(typeValue)) {
|
|
5042
|
+
case 1:
|
|
5043
|
+
items.push(KeyValuePair.newVarInt(typeValue, BigInt(buf.getU8())));
|
|
5044
|
+
break;
|
|
5045
|
+
case 2: {
|
|
5046
|
+
const loc = new ByteBuffer();
|
|
5047
|
+
loc.putVI(buf.getVI());
|
|
5048
|
+
loc.putVI(buf.getVI());
|
|
5049
|
+
items.push(KeyValuePair.newBytes(typeValue, loc.toUint8Array()));
|
|
5050
|
+
break;
|
|
5051
|
+
}
|
|
5052
|
+
case 3:
|
|
5053
|
+
items.push(KeyValuePair.newBytes(typeValue, LocationFilter.deserializeValue(buf).serializeValue()));
|
|
5054
|
+
break;
|
|
5055
|
+
case 4:
|
|
5056
|
+
items.push(KeyValuePair.deserializeBytesValue(buf, typeValue));
|
|
5057
|
+
break;
|
|
5058
|
+
case 0:
|
|
5059
|
+
items.push(KeyValuePair.tryNewVarInt(typeValue, buf.getVI()));
|
|
5060
|
+
break;
|
|
5061
|
+
}
|
|
4434
5062
|
prevType = typeValue;
|
|
4435
5063
|
}
|
|
4436
5064
|
return items;
|
|
4437
5065
|
}
|
|
4438
5066
|
/**
|
|
4439
5067
|
* Applies a set of parameter updates to an existing parameter list.
|
|
4440
|
-
*
|
|
4441
|
-
*
|
|
5068
|
+
*
|
|
5069
|
+
* A Type the update leaves out keeps its value. A Type it carries is replaced
|
|
5070
|
+
* outright, every instance of it: a Range Filter can repeat, and an update that
|
|
5071
|
+
* names a filter kind states the whole of that kind, so one left over from before
|
|
5072
|
+
* would quietly widen or narrow what the subscriber asked for. A zero-length Range
|
|
5073
|
+
* Filter replaces its kind with nothing.
|
|
4442
5074
|
*/
|
|
4443
5075
|
function applyMessageParameterUpdate(current, updates) {
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
else current.push(update);
|
|
4449
|
-
}
|
|
5076
|
+
const typeOf = (p) => p.toKeyValuePair().typeValue;
|
|
5077
|
+
const updated = new Set(updates.map(typeOf));
|
|
5078
|
+
const kept = current.filter((p) => !updated.has(typeOf(p)));
|
|
5079
|
+
current.splice(0, current.length, ...kept, ...updates.filter((u) => !(u instanceof RangeFilter && u.isRemoval)));
|
|
4450
5080
|
}
|
|
4451
5081
|
//#endregion
|
|
4452
5082
|
//#region src/model/control/publish_namespace.ts
|
|
@@ -4643,11 +5273,10 @@ var NamespaceDone = class NamespaceDone {
|
|
|
4643
5273
|
* limitations under the License.
|
|
4644
5274
|
*/
|
|
4645
5275
|
/**
|
|
4646
|
-
* The first message each endpoint sends on its control stream
|
|
5276
|
+
* The first message each endpoint sends on its control stream.
|
|
4647
5277
|
*
|
|
4648
5278
|
* Both peers send the same message; there are no separate client and server forms and
|
|
4649
|
-
* no version fields, since version negotiation happens over ALPN
|
|
4650
|
-
* CLIENT_SETUP / SERVER_SETUP.
|
|
5279
|
+
* no version fields, since version negotiation happens over ALPN.
|
|
4651
5280
|
*
|
|
4652
5281
|
* Some options are client-only (see {@link SetupOptionType}); whether a peer is
|
|
4653
5282
|
* allowed to send a given option depends on which side it is and on the transport,
|
|
@@ -4695,13 +5324,20 @@ var Setup = class Setup {
|
|
|
4695
5324
|
*/
|
|
4696
5325
|
var Fetch = class Fetch {
|
|
4697
5326
|
requestId;
|
|
4698
|
-
|
|
5327
|
+
fullTrackName;
|
|
4699
5328
|
parameters;
|
|
4700
|
-
constructor(requestId,
|
|
5329
|
+
constructor(requestId, fullTrackName, parameters) {
|
|
4701
5330
|
this.requestId = requestId;
|
|
4702
|
-
this.
|
|
5331
|
+
this.fullTrackName = fullTrackName;
|
|
4703
5332
|
this.parameters = parameters;
|
|
4704
5333
|
}
|
|
5334
|
+
/**
|
|
5335
|
+
* The requested range. A FETCH without a LOCATION_FILTER parameter asks for the
|
|
5336
|
+
* whole track up to the Largest Object, the same as a {@link (LocationFilterType:enum).None} filter.
|
|
5337
|
+
*/
|
|
5338
|
+
get locationFilter() {
|
|
5339
|
+
return this.parameters.find(MessageParameter.isLocationFilter) ?? new LocationFilter(0);
|
|
5340
|
+
}
|
|
4705
5341
|
getType() {
|
|
4706
5342
|
return 22;
|
|
4707
5343
|
}
|
|
@@ -4710,19 +5346,7 @@ var Fetch = class Fetch {
|
|
|
4710
5346
|
buf.putVI(22);
|
|
4711
5347
|
const payload = new ByteBuffer();
|
|
4712
5348
|
payload.putVI(this.requestId);
|
|
4713
|
-
payload.
|
|
4714
|
-
switch (this.typeAndProps.type) {
|
|
4715
|
-
case 3:
|
|
4716
|
-
case 2:
|
|
4717
|
-
payload.putVI(this.typeAndProps.props.joiningRequestId);
|
|
4718
|
-
payload.putVI(this.typeAndProps.props.joiningStart);
|
|
4719
|
-
break;
|
|
4720
|
-
case 1:
|
|
4721
|
-
payload.putFullTrackName(this.typeAndProps.props.fullTrackName);
|
|
4722
|
-
payload.putLocation(this.typeAndProps.props.startLocation);
|
|
4723
|
-
payload.putLocation(this.typeAndProps.props.endLocation);
|
|
4724
|
-
break;
|
|
4725
|
-
}
|
|
5349
|
+
payload.putFullTrackName(this.fullTrackName);
|
|
4726
5350
|
payload.putVI(this.parameters.length);
|
|
4727
5351
|
payload.putBytes(serializeMessageParameterKvps(this.parameters.map((p) => p.toKeyValuePair())).toUint8Array());
|
|
4728
5352
|
const payloadBytes = payload.toUint8Array();
|
|
@@ -4733,35 +5357,10 @@ var Fetch = class Fetch {
|
|
|
4733
5357
|
}
|
|
4734
5358
|
static parsePayload(buf) {
|
|
4735
5359
|
const requestId = buf.getVI();
|
|
4736
|
-
const
|
|
4737
|
-
const fetchType = FetchType.tryFrom(fetchTypeRaw);
|
|
4738
|
-
let props;
|
|
4739
|
-
switch (fetchType) {
|
|
4740
|
-
case 3:
|
|
4741
|
-
case 2:
|
|
4742
|
-
props = {
|
|
4743
|
-
type: fetchType,
|
|
4744
|
-
props: {
|
|
4745
|
-
joiningRequestId: buf.getVI(),
|
|
4746
|
-
joiningStart: buf.getVI()
|
|
4747
|
-
}
|
|
4748
|
-
};
|
|
4749
|
-
break;
|
|
4750
|
-
case 1:
|
|
4751
|
-
props = {
|
|
4752
|
-
type: 1,
|
|
4753
|
-
props: {
|
|
4754
|
-
fullTrackName: buf.getFullTrackName(),
|
|
4755
|
-
startLocation: buf.getLocation(),
|
|
4756
|
-
endLocation: buf.getLocation()
|
|
4757
|
-
}
|
|
4758
|
-
};
|
|
4759
|
-
break;
|
|
4760
|
-
default: throw new Error(`Unknown fetch type: ${fetchType}`);
|
|
4761
|
-
}
|
|
5360
|
+
const fullTrackName = buf.getFullTrackName();
|
|
4762
5361
|
const rawParams = deserializeMessageParameterKvps(buf, buf.getNumberVI());
|
|
4763
5362
|
const parameters = MessageParameters.fromKeyValuePairs(rawParams);
|
|
4764
|
-
return new Fetch(requestId,
|
|
5363
|
+
return new Fetch(requestId, fullTrackName, parameters);
|
|
4765
5364
|
}
|
|
4766
5365
|
};
|
|
4767
5366
|
//#endregion
|
|
@@ -4850,7 +5449,7 @@ var FetchOk = class FetchOk {
|
|
|
4850
5449
|
const MAX_NEW_SESSION_URI_LENGTH = 8192;
|
|
4851
5450
|
/**
|
|
4852
5451
|
* GOAWAY (0x10) winds down a session, or — on a request stream — migrates that one
|
|
4853
|
-
* request
|
|
5452
|
+
* request.
|
|
4854
5453
|
*/
|
|
4855
5454
|
var GoAway = class GoAway {
|
|
4856
5455
|
newSessionUri;
|
|
@@ -4860,16 +5459,10 @@ var GoAway = class GoAway {
|
|
|
4860
5459
|
* on a request stream it resets the stream with `GOING_AWAY`.
|
|
4861
5460
|
*/
|
|
4862
5461
|
timeout;
|
|
4863
|
-
|
|
4864
|
-
* The smallest peer Request ID that was not or might not have been processed. Present
|
|
4865
|
-
* only on the control stream, so a GOAWAY migrating a single request omits it.
|
|
4866
|
-
*/
|
|
4867
|
-
requestId;
|
|
4868
|
-
constructor(newSessionUri, timeout = 0n, requestId) {
|
|
5462
|
+
constructor(newSessionUri, timeout = 0n) {
|
|
4869
5463
|
if (newSessionUri && newSessionUri.length === 0) this.newSessionUri = void 0;
|
|
4870
5464
|
else this.newSessionUri = newSessionUri;
|
|
4871
5465
|
this.timeout = timeout;
|
|
4872
|
-
this.requestId = requestId;
|
|
4873
5466
|
}
|
|
4874
5467
|
getType() {
|
|
4875
5468
|
return 16;
|
|
@@ -4888,7 +5481,6 @@ var GoAway = class GoAway {
|
|
|
4888
5481
|
payload.putLengthPrefixedBytes(uriBytes);
|
|
4889
5482
|
} else payload.putVI(0);
|
|
4890
5483
|
payload.putVI(this.timeout);
|
|
4891
|
-
if (this.requestId !== void 0) payload.putVI(this.requestId);
|
|
4892
5484
|
const payloadBytes = payload.toUint8Array();
|
|
4893
5485
|
if (payloadBytes.length > 65535) throw new LengthExceedsMaxError("GoAway::serialize(payloadBytes.length)", 65535, payloadBytes.length);
|
|
4894
5486
|
buf.putU16(payloadBytes.length);
|
|
@@ -4909,8 +5501,7 @@ var GoAway = class GoAway {
|
|
|
4909
5501
|
}
|
|
4910
5502
|
}
|
|
4911
5503
|
const timeout = buf.getVI();
|
|
4912
|
-
|
|
4913
|
-
return new GoAway(newSessionUri, timeout, requestId);
|
|
5504
|
+
return new GoAway(newSessionUri, timeout);
|
|
4914
5505
|
}
|
|
4915
5506
|
};
|
|
4916
5507
|
//#endregion
|
|
@@ -4939,19 +5530,6 @@ var Subscribe = class Subscribe {
|
|
|
4939
5530
|
this.fullTrackName = fullTrackName;
|
|
4940
5531
|
this.parameters = parameters;
|
|
4941
5532
|
}
|
|
4942
|
-
static newNextGroupStart(requestId, fullTrackName, parameters) {
|
|
4943
|
-
return new Subscribe(requestId, fullTrackName, [...parameters, new SubscriptionFilter(1)]);
|
|
4944
|
-
}
|
|
4945
|
-
static newLatestObject(requestId, fullTrackName, parameters) {
|
|
4946
|
-
return new Subscribe(requestId, fullTrackName, [...parameters, new SubscriptionFilter(2)]);
|
|
4947
|
-
}
|
|
4948
|
-
static newAbsoluteStart(requestId, fullTrackName, startLocation, parameters) {
|
|
4949
|
-
return new Subscribe(requestId, fullTrackName, [...parameters, new SubscriptionFilter(3, startLocation)]);
|
|
4950
|
-
}
|
|
4951
|
-
static newAbsoluteRange(requestId, fullTrackName, startLocation, endGroup, parameters) {
|
|
4952
|
-
if (endGroup < startLocation.group) throw new Error("End Group must be >= Start Group");
|
|
4953
|
-
return new Subscribe(requestId, fullTrackName, [...parameters, new SubscriptionFilter(4, startLocation, endGroup)]);
|
|
4954
|
-
}
|
|
4955
5533
|
getType() {
|
|
4956
5534
|
return 3;
|
|
4957
5535
|
}
|
|
@@ -5001,6 +5579,11 @@ var PublishDone = class PublishDone {
|
|
|
5001
5579
|
statusCode;
|
|
5002
5580
|
streamCount;
|
|
5003
5581
|
errorReason;
|
|
5582
|
+
/**
|
|
5583
|
+
* The Stream Count a publisher sends when it cannot name the exact number of streams
|
|
5584
|
+
* it opened. Receivers fall back on a timeout to end the subscription.
|
|
5585
|
+
*/
|
|
5586
|
+
static UNKNOWN_STREAM_COUNT = 2n ** 64n - 1n;
|
|
5004
5587
|
constructor(statusCode, streamCount, errorReason) {
|
|
5005
5588
|
this.statusCode = statusCode;
|
|
5006
5589
|
this.streamCount = streamCount;
|
|
@@ -5239,35 +5822,18 @@ var TrackStatus = class TrackStatus {
|
|
|
5239
5822
|
subscriberPriority;
|
|
5240
5823
|
groupOrder;
|
|
5241
5824
|
forward;
|
|
5242
|
-
|
|
5243
|
-
startLocation;
|
|
5244
|
-
endGroup;
|
|
5825
|
+
locationFilter;
|
|
5245
5826
|
subscribeParameters;
|
|
5246
|
-
constructor(requestId, trackAlias, fullTrackName, subscriberPriority, groupOrder, forward,
|
|
5827
|
+
constructor(requestId, trackAlias, fullTrackName, subscriberPriority, groupOrder, forward, locationFilter, subscribeParameters) {
|
|
5247
5828
|
this.requestId = requestId;
|
|
5248
5829
|
this.trackAlias = trackAlias;
|
|
5249
5830
|
this.fullTrackName = fullTrackName;
|
|
5250
5831
|
this.subscriberPriority = subscriberPriority;
|
|
5251
5832
|
this.groupOrder = groupOrder;
|
|
5252
5833
|
this.forward = forward;
|
|
5253
|
-
this.
|
|
5254
|
-
this.startLocation = startLocation;
|
|
5255
|
-
this.endGroup = endGroup;
|
|
5834
|
+
this.locationFilter = locationFilter;
|
|
5256
5835
|
this.subscribeParameters = subscribeParameters;
|
|
5257
5836
|
}
|
|
5258
|
-
static newNextGroupStart(requestId, trackAlias, fullTrackName, subscriberPriority, groupOrder, forward, subscribeParameters) {
|
|
5259
|
-
return new TrackStatus(requestId, trackAlias, fullTrackName, subscriberPriority, groupOrder, forward, 1, void 0, void 0, subscribeParameters);
|
|
5260
|
-
}
|
|
5261
|
-
static newLatestObject(requestId, trackAlias, fullTrackName, subscriberPriority, groupOrder, forward, subscribeParameters) {
|
|
5262
|
-
return new TrackStatus(requestId, trackAlias, fullTrackName, subscriberPriority, groupOrder, forward, 2, void 0, void 0, subscribeParameters);
|
|
5263
|
-
}
|
|
5264
|
-
static newAbsoluteStart(requestId, trackAlias, fullTrackName, subscriberPriority, groupOrder, forward, startLocation, subscribeParameters) {
|
|
5265
|
-
return new TrackStatus(requestId, trackAlias, fullTrackName, subscriberPriority, groupOrder, forward, 3, startLocation, void 0, subscribeParameters);
|
|
5266
|
-
}
|
|
5267
|
-
static newAbsoluteRange(requestId, trackAlias, fullTrackName, subscriberPriority, groupOrder, forward, startLocation, endGroup, subscribeParameters) {
|
|
5268
|
-
if (endGroup < startLocation.group) throw new Error("End Group must be >= Start Group");
|
|
5269
|
-
return new TrackStatus(requestId, trackAlias, fullTrackName, subscriberPriority, groupOrder, forward, 4, startLocation, endGroup, subscribeParameters);
|
|
5270
|
-
}
|
|
5271
5837
|
getType() {
|
|
5272
5838
|
return 13;
|
|
5273
5839
|
}
|
|
@@ -5281,15 +5847,7 @@ var TrackStatus = class TrackStatus {
|
|
|
5281
5847
|
payload.putU8(this.subscriberPriority);
|
|
5282
5848
|
payload.putU8(this.groupOrder);
|
|
5283
5849
|
payload.putU8(this.forward ? 1 : 0);
|
|
5284
|
-
payload.
|
|
5285
|
-
if (this.filterType === 3 || this.filterType === 4) {
|
|
5286
|
-
if (!this.startLocation) throw new Error("StartLocation required for selected filterType");
|
|
5287
|
-
payload.putLocation(this.startLocation);
|
|
5288
|
-
}
|
|
5289
|
-
if (this.filterType === 4) {
|
|
5290
|
-
if (this.endGroup == null) throw new Error("EndGroup required for AbsoluteRange");
|
|
5291
|
-
payload.putVI(this.endGroup);
|
|
5292
|
-
}
|
|
5850
|
+
payload.putBytes(this.locationFilter.serializeValue());
|
|
5293
5851
|
payload.putVI(this.subscribeParameters.length);
|
|
5294
5852
|
payload.putBytes(serializeMessageParameterKvps(this.subscribeParameters.map((p) => p.toKeyValuePair())).toUint8Array());
|
|
5295
5853
|
const payloadBytes = payload.toUint8Array();
|
|
@@ -5304,14 +5862,10 @@ var TrackStatus = class TrackStatus {
|
|
|
5304
5862
|
const subscriberPriority = buf.getU8();
|
|
5305
5863
|
const groupOrder = buf.getU8();
|
|
5306
5864
|
const forward = buf.getU8() === 1;
|
|
5307
|
-
const
|
|
5308
|
-
let startLocation = void 0;
|
|
5309
|
-
let endGroup = void 0;
|
|
5310
|
-
if (filterType === 3 || filterType === 4) startLocation = buf.getLocation();
|
|
5311
|
-
if (filterType === 4) endGroup = buf.getVI();
|
|
5865
|
+
const locationFilter = LocationFilter.deserializeValue(buf);
|
|
5312
5866
|
const rawParams = deserializeMessageParameterKvps(buf, Number(buf.getVI()));
|
|
5313
5867
|
const subscribeParameters = MessageParameters.fromKeyValuePairs(rawParams);
|
|
5314
|
-
return new TrackStatus(requestId, trackAlias, fullTrackName, subscriberPriority, groupOrder, forward,
|
|
5868
|
+
return new TrackStatus(requestId, trackAlias, fullTrackName, subscriberPriority, groupOrder, forward, locationFilter, subscribeParameters);
|
|
5315
5869
|
}
|
|
5316
5870
|
};
|
|
5317
5871
|
//#endregion
|
|
@@ -5447,13 +6001,12 @@ var SubscribeTracks = class SubscribeTracks {
|
|
|
5447
6001
|
* names (PUBLISH_OK, TRACK_STATUS_OK, ...) are shorthands for logging, not distinct
|
|
5448
6002
|
* messages. SUBSCRIBE_OK (0x4) and FETCH_OK (0x18) do keep bodies of their own.
|
|
5449
6003
|
*
|
|
5450
|
-
* It carries no Request ID: the request stream it arrives on identifies the request
|
|
5451
|
-
* (§10.1).
|
|
6004
|
+
* It carries no Request ID: the request stream it arrives on identifies the request.
|
|
5452
6005
|
*/
|
|
5453
6006
|
var RequestOk = class RequestOk {
|
|
5454
6007
|
parameters;
|
|
5455
6008
|
/**
|
|
5456
|
-
*
|
|
6009
|
+
* Track Properties, which the trailing bytes of the payload carry with no
|
|
5457
6010
|
* count of their own. Populated only in TRACK_STATUS_OK; empty for every other request
|
|
5458
6011
|
* type — see {@link RequestOk.validateTrackProperties}.
|
|
5459
6012
|
*/
|
|
@@ -5615,7 +6168,7 @@ let ControlMessage;
|
|
|
5615
6168
|
case 80: return SubscribeNamespace.parsePayload(payload);
|
|
5616
6169
|
case 81: return SubscribeTracks.parsePayload(payload);
|
|
5617
6170
|
case 12032: return Setup.parsePayload(payload);
|
|
5618
|
-
case 15: return
|
|
6171
|
+
case 15: return PublishSkipped.parsePayload(payload);
|
|
5619
6172
|
default: throw new Error(`Unknown or unhandled ControlMessageType: ${messageType}`);
|
|
5620
6173
|
}
|
|
5621
6174
|
}
|
|
@@ -5794,59 +6347,6 @@ var CMSFCatalog = class CMSFCatalog {
|
|
|
5794
6347
|
}
|
|
5795
6348
|
};
|
|
5796
6349
|
//#endregion
|
|
5797
|
-
//#region src/model/control/switch.ts
|
|
5798
|
-
/**
|
|
5799
|
-
* Copyright 2025 The MOQtail Authors
|
|
5800
|
-
*
|
|
5801
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5802
|
-
* you may not use this file except in compliance with the License.
|
|
5803
|
-
* You may obtain a copy of the License at
|
|
5804
|
-
*
|
|
5805
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5806
|
-
*
|
|
5807
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
5808
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5809
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5810
|
-
* See the License for the specific language governing permissions and
|
|
5811
|
-
* limitations under the License.
|
|
5812
|
-
*/
|
|
5813
|
-
var Switch = class Switch {
|
|
5814
|
-
requestId;
|
|
5815
|
-
fullTrackName;
|
|
5816
|
-
subscriptionRequestId;
|
|
5817
|
-
parameters;
|
|
5818
|
-
constructor(requestId, fullTrackName, subscriptionRequestId, parameters) {
|
|
5819
|
-
this.requestId = requestId;
|
|
5820
|
-
this.fullTrackName = fullTrackName;
|
|
5821
|
-
this.subscriptionRequestId = subscriptionRequestId;
|
|
5822
|
-
this.parameters = parameters;
|
|
5823
|
-
}
|
|
5824
|
-
getType() {
|
|
5825
|
-
return 34;
|
|
5826
|
-
}
|
|
5827
|
-
serialize() {
|
|
5828
|
-
const buf = new ByteBuffer();
|
|
5829
|
-
buf.putVI(34);
|
|
5830
|
-
const payload = new ByteBuffer();
|
|
5831
|
-
payload.putVI(this.requestId);
|
|
5832
|
-
payload.putBytes(this.fullTrackName.serialize().toUint8Array());
|
|
5833
|
-
payload.putVI(this.subscriptionRequestId);
|
|
5834
|
-
payload.putVI(this.parameters.length);
|
|
5835
|
-
payload.putBytes(serializeMessageParameterKvps(this.parameters).toUint8Array());
|
|
5836
|
-
const payloadBytes = payload.toUint8Array();
|
|
5837
|
-
buf.putU16(payloadBytes.length);
|
|
5838
|
-
buf.putBytes(payloadBytes);
|
|
5839
|
-
return buf.freeze();
|
|
5840
|
-
}
|
|
5841
|
-
static parsePayload(buf) {
|
|
5842
|
-
const requestId = buf.getVI();
|
|
5843
|
-
const fullTrackName = buf.getFullTrackName();
|
|
5844
|
-
const subscriptionRequestId = buf.getVI();
|
|
5845
|
-
const parameters = deserializeMessageParameterKvps(buf, Number(buf.getVI()));
|
|
5846
|
-
return new Switch(requestId, fullTrackName, subscriptionRequestId, parameters);
|
|
5847
|
-
}
|
|
5848
|
-
};
|
|
5849
|
-
//#endregion
|
|
5850
6350
|
//#region src/model/parameter/setup/path.ts
|
|
5851
6351
|
/**
|
|
5852
6352
|
* Copyright 2025 The MOQtail Authors
|
|
@@ -5929,7 +6429,7 @@ var MaxAuthTokenCacheSize = class MaxAuthTokenCacheSize {
|
|
|
5929
6429
|
*/
|
|
5930
6430
|
/**
|
|
5931
6431
|
* Raw-QUIC only: the authority component of the `moqt://` URI, carried in SETUP because
|
|
5932
|
-
* there is no HTTP CONNECT to carry it
|
|
6432
|
+
* there is no HTTP CONNECT to carry it.
|
|
5933
6433
|
*
|
|
5934
6434
|
* Client-only; MUST NOT be sent by a server or over WebTransport. moqtail-ts always
|
|
5935
6435
|
* connects over WebTransport, so its own handshake never sends this — see
|
|
@@ -5952,6 +6452,42 @@ var Authority = class Authority {
|
|
|
5952
6452
|
}
|
|
5953
6453
|
};
|
|
5954
6454
|
//#endregion
|
|
6455
|
+
//#region src/model/parameter/setup/max_filter_ranges.ts
|
|
6456
|
+
/**
|
|
6457
|
+
* Copyright 2026 The MOQtail Authors
|
|
6458
|
+
*
|
|
6459
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6460
|
+
* you may not use this file except in compliance with the License.
|
|
6461
|
+
* You may obtain a copy of the License at
|
|
6462
|
+
*
|
|
6463
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
6464
|
+
*
|
|
6465
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
6466
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
6467
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
6468
|
+
* See the License for the specific language governing permissions and
|
|
6469
|
+
* limitations under the License.
|
|
6470
|
+
*/
|
|
6471
|
+
/**
|
|
6472
|
+
* Limits the total number of Ranges the peer may have across all Range filter parameters
|
|
6473
|
+
* of a single subscription or fetch. Zero, the default when absent, means the peer may
|
|
6474
|
+
* not send Range filters at all.
|
|
6475
|
+
*/
|
|
6476
|
+
var MaxFilterRanges = class MaxFilterRanges {
|
|
6477
|
+
value;
|
|
6478
|
+
static TYPE = 6;
|
|
6479
|
+
constructor(value) {
|
|
6480
|
+
this.value = value;
|
|
6481
|
+
}
|
|
6482
|
+
toKeyValuePair() {
|
|
6483
|
+
return KeyValuePair.tryNewVarInt(MaxFilterRanges.TYPE, this.value);
|
|
6484
|
+
}
|
|
6485
|
+
static fromKeyValuePair(pair) {
|
|
6486
|
+
if (Number(pair.typeValue) !== MaxFilterRanges.TYPE || typeof pair.value !== "bigint") return void 0;
|
|
6487
|
+
return new MaxFilterRanges(pair.value);
|
|
6488
|
+
}
|
|
6489
|
+
};
|
|
6490
|
+
//#endregion
|
|
5955
6491
|
//#region src/model/parameter/setup/moqt_implementation.ts
|
|
5956
6492
|
/**
|
|
5957
6493
|
* Copyright 2026 The MOQtail Authors
|
|
@@ -5969,8 +6505,8 @@ var Authority = class Authority {
|
|
|
5969
6505
|
* limitations under the License.
|
|
5970
6506
|
*/
|
|
5971
6507
|
/**
|
|
5972
|
-
* Free-form implementation identification string, e.g. for logging and debugging
|
|
5973
|
-
*
|
|
6508
|
+
* Free-form implementation identification string, e.g. for logging and debugging.
|
|
6509
|
+
* Either peer may send it.
|
|
5974
6510
|
*/
|
|
5975
6511
|
var MoqtImplementation = class MoqtImplementation {
|
|
5976
6512
|
info;
|
|
@@ -5989,6 +6525,42 @@ var MoqtImplementation = class MoqtImplementation {
|
|
|
5989
6525
|
}
|
|
5990
6526
|
};
|
|
5991
6527
|
//#endregion
|
|
6528
|
+
//#region src/model/parameter/setup/max_request_updates.ts
|
|
6529
|
+
/**
|
|
6530
|
+
* Copyright 2026 The MOQtail Authors
|
|
6531
|
+
*
|
|
6532
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6533
|
+
* you may not use this file except in compliance with the License.
|
|
6534
|
+
* You may obtain a copy of the License at
|
|
6535
|
+
*
|
|
6536
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
6537
|
+
*
|
|
6538
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
6539
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
6540
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
6541
|
+
* See the License for the specific language governing permissions and
|
|
6542
|
+
* limitations under the License.
|
|
6543
|
+
*/
|
|
6544
|
+
/**
|
|
6545
|
+
* Maximum number of outstanding REQUEST_UPDATEs per request stream: an update counts
|
|
6546
|
+
* until its REQUEST_OK or REQUEST_ERROR arrives. Zero, the default when absent, means
|
|
6547
|
+
* no limit. Receiving one past the limit closes the session with TOO_MANY_REQUEST_UPDATES.
|
|
6548
|
+
*/
|
|
6549
|
+
var MaxRequestUpdates = class MaxRequestUpdates {
|
|
6550
|
+
value;
|
|
6551
|
+
static TYPE = 8;
|
|
6552
|
+
constructor(value) {
|
|
6553
|
+
this.value = value;
|
|
6554
|
+
}
|
|
6555
|
+
toKeyValuePair() {
|
|
6556
|
+
return KeyValuePair.tryNewVarInt(MaxRequestUpdates.TYPE, this.value);
|
|
6557
|
+
}
|
|
6558
|
+
static fromKeyValuePair(pair) {
|
|
6559
|
+
if (Number(pair.typeValue) !== MaxRequestUpdates.TYPE || typeof pair.value !== "bigint") return void 0;
|
|
6560
|
+
return new MaxRequestUpdates(pair.value);
|
|
6561
|
+
}
|
|
6562
|
+
};
|
|
6563
|
+
//#endregion
|
|
5992
6564
|
//#region src/model/parameter/setup/ssts_algorithms.ts
|
|
5993
6565
|
/**
|
|
5994
6566
|
* Copyright 2026 The MOQtail Authors
|
|
@@ -6010,7 +6582,7 @@ var MoqtImplementation = class MoqtImplementation {
|
|
|
6010
6582
|
*
|
|
6011
6583
|
* PROVISIONAL: sender-side track switching is not an adopted extension, so
|
|
6012
6584
|
* this option has no codepoint in the registry the conformance fixture tracks
|
|
6013
|
-
* (`dev/conformance/
|
|
6585
|
+
* (`dev/conformance/draft22`) and is never asserted against it. An empty list
|
|
6014
6586
|
* — or the absence of the option — prohibits the use of SSTS.
|
|
6015
6587
|
*/
|
|
6016
6588
|
var SstsAlgorithms = class SstsAlgorithms {
|
|
@@ -6038,7 +6610,7 @@ var SstsAlgorithms = class SstsAlgorithms {
|
|
|
6038
6610
|
let SetupOption;
|
|
6039
6611
|
(function(_SetupOption) {
|
|
6040
6612
|
function fromKeyValuePair(pair) {
|
|
6041
|
-
return Path.fromKeyValuePair(pair) || MaxAuthTokenCacheSize.fromKeyValuePair(pair) || AuthorizationToken.fromKeyValuePair(pair) || Authority.fromKeyValuePair(pair) || MoqtImplementation.fromKeyValuePair(pair) || SstsAlgorithms.fromKeyValuePair(pair);
|
|
6613
|
+
return Path.fromKeyValuePair(pair) || MaxAuthTokenCacheSize.fromKeyValuePair(pair) || AuthorizationToken.fromKeyValuePair(pair) || Authority.fromKeyValuePair(pair) || MaxFilterRanges.fromKeyValuePair(pair) || MoqtImplementation.fromKeyValuePair(pair) || MaxRequestUpdates.fromKeyValuePair(pair) || SstsAlgorithms.fromKeyValuePair(pair);
|
|
6042
6614
|
}
|
|
6043
6615
|
_SetupOption.fromKeyValuePair = fromKeyValuePair;
|
|
6044
6616
|
function toKeyValuePair(param) {
|
|
@@ -6061,6 +6633,14 @@ let SetupOption;
|
|
|
6061
6633
|
return param instanceof Authority;
|
|
6062
6634
|
}
|
|
6063
6635
|
_SetupOption.isAuthority = isAuthority;
|
|
6636
|
+
function isMaxFilterRanges(param) {
|
|
6637
|
+
return param instanceof MaxFilterRanges;
|
|
6638
|
+
}
|
|
6639
|
+
_SetupOption.isMaxFilterRanges = isMaxFilterRanges;
|
|
6640
|
+
function isMaxRequestUpdates(param) {
|
|
6641
|
+
return param instanceof MaxRequestUpdates;
|
|
6642
|
+
}
|
|
6643
|
+
_SetupOption.isMaxRequestUpdates = isMaxRequestUpdates;
|
|
6064
6644
|
function isMoqtImplementation(param) {
|
|
6065
6645
|
return param instanceof MoqtImplementation;
|
|
6066
6646
|
}
|
|
@@ -6072,7 +6652,7 @@ let SetupOption;
|
|
|
6072
6652
|
})(SetupOption || (SetupOption = {}));
|
|
6073
6653
|
/** Throws if `params` carries AUTHORITY, which MUST NOT be sent over WebTransport. */
|
|
6074
6654
|
function assertNoAuthorityOverWebTransport(params) {
|
|
6075
|
-
if (params.some((p) => Number(p.typeValue) === 5)) throw new ProtocolViolationError("assertNoAuthorityOverWebTransport", "AUTHORITY setup option MUST NOT be sent over WebTransport
|
|
6655
|
+
if (params.some((p) => Number(p.typeValue) === 5)) throw new ProtocolViolationError("assertNoAuthorityOverWebTransport", "AUTHORITY setup option MUST NOT be sent over WebTransport");
|
|
6076
6656
|
}
|
|
6077
6657
|
var SetupOptions = class {
|
|
6078
6658
|
kvps = [];
|
|
@@ -6088,6 +6668,14 @@ var SetupOptions = class {
|
|
|
6088
6668
|
this.kvps.push(auth.toKeyValuePair());
|
|
6089
6669
|
return this;
|
|
6090
6670
|
}
|
|
6671
|
+
addMaxFilterRanges(value) {
|
|
6672
|
+
this.kvps.push(new MaxFilterRanges(BigInt(value)).toKeyValuePair());
|
|
6673
|
+
return this;
|
|
6674
|
+
}
|
|
6675
|
+
addMaxRequestUpdates(value) {
|
|
6676
|
+
this.kvps.push(new MaxRequestUpdates(BigInt(value)).toKeyValuePair());
|
|
6677
|
+
return this;
|
|
6678
|
+
}
|
|
6091
6679
|
addMoqtImplementation(info) {
|
|
6092
6680
|
this.kvps.push(new MoqtImplementation(info).toKeyValuePair());
|
|
6093
6681
|
return this;
|
|
@@ -6106,13 +6694,133 @@ var SetupOptions = class {
|
|
|
6106
6694
|
static fromKeyValuePairs(kvps) {
|
|
6107
6695
|
const result = [];
|
|
6108
6696
|
for (const kvp of kvps) {
|
|
6109
|
-
const parsed = Path.fromKeyValuePair(kvp) || MaxAuthTokenCacheSize.fromKeyValuePair(kvp) || AuthorizationToken.fromKeyValuePair(kvp) || Authority.fromKeyValuePair(kvp) || MoqtImplementation.fromKeyValuePair(kvp) || SstsAlgorithms.fromKeyValuePair(kvp);
|
|
6697
|
+
const parsed = Path.fromKeyValuePair(kvp) || MaxAuthTokenCacheSize.fromKeyValuePair(kvp) || AuthorizationToken.fromKeyValuePair(kvp) || Authority.fromKeyValuePair(kvp) || MaxFilterRanges.fromKeyValuePair(kvp) || MoqtImplementation.fromKeyValuePair(kvp) || MaxRequestUpdates.fromKeyValuePair(kvp) || SstsAlgorithms.fromKeyValuePair(kvp);
|
|
6110
6698
|
if (parsed) result.push(parsed);
|
|
6111
6699
|
}
|
|
6112
6700
|
return result;
|
|
6113
6701
|
}
|
|
6114
6702
|
};
|
|
6115
6703
|
//#endregion
|
|
6704
|
+
//#region src/model/parameter/message/combined_filter.ts
|
|
6705
|
+
/**
|
|
6706
|
+
* Copyright 2026 The MOQtail Authors
|
|
6707
|
+
*
|
|
6708
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6709
|
+
* you may not use this file except in compliance with the License.
|
|
6710
|
+
* You may obtain a copy of the License at
|
|
6711
|
+
*
|
|
6712
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
6713
|
+
*
|
|
6714
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
6715
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
6716
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
6717
|
+
* See the License for the specific language governing permissions and
|
|
6718
|
+
* limitations under the License.
|
|
6719
|
+
*/
|
|
6720
|
+
const within = (ranges, value) => ranges.some((r) => value >= r.start && (r.end === void 0 || value <= r.end));
|
|
6721
|
+
/**
|
|
6722
|
+
* The object filter a request's Range Filters add up to.
|
|
6723
|
+
*
|
|
6724
|
+
* Ranges within one filter are OR'd, filters sharing a SetID are AND'd, and the
|
|
6725
|
+
* SetIDs are OR'd with each other. No filter at all passes every Object.
|
|
6726
|
+
*/
|
|
6727
|
+
var CombinedFilter = class {
|
|
6728
|
+
#sets = /* @__PURE__ */ new Map();
|
|
6729
|
+
/** How many Ranges the filters hold, which is what a range limit counts. */
|
|
6730
|
+
rangeCount;
|
|
6731
|
+
/**
|
|
6732
|
+
* Builds the filter from every Range Filter in `params`; anything else, and a
|
|
6733
|
+
* zero-length removal, is ignored.
|
|
6734
|
+
*
|
|
6735
|
+
* @throws :{@link InvalidFilterError} For a filter that cannot be applied: one
|
|
6736
|
+
* that repeats a Type, SetID and Property Type already given, one with an odd
|
|
6737
|
+
* Property Type, a priority above 255 or a bound past 2^64-1, or a track filter,
|
|
6738
|
+
* which selects tracks rather than Objects.
|
|
6739
|
+
*/
|
|
6740
|
+
constructor(params) {
|
|
6741
|
+
let rangeCount = 0;
|
|
6742
|
+
const seen = /* @__PURE__ */ new Set();
|
|
6743
|
+
for (const param of params) {
|
|
6744
|
+
if (!(param instanceof RangeFilter) || param.isRemoval) continue;
|
|
6745
|
+
const filter = param;
|
|
6746
|
+
if (filter.kind === RangeFilterKind.TrackProperty) throw new InvalidFilterError("CombinedFilter", "a track property filter selects tracks, not Objects");
|
|
6747
|
+
const key = `${filter.kind}/${filter.setId}/${filter.propertyType ?? ""}`;
|
|
6748
|
+
if (seen.has(key)) throw new InvalidFilterError("CombinedFilter", `${RangeFilterKind[filter.kind]} filter repeats SetID ${filter.setId}` + (filter.propertyType !== void 0 ? ` for property 0x${filter.propertyType.toString(16)}` : ""));
|
|
6749
|
+
seen.add(key);
|
|
6750
|
+
const ranges = filter.validate();
|
|
6751
|
+
rangeCount += ranges.length;
|
|
6752
|
+
let set = this.#sets.get(filter.setId);
|
|
6753
|
+
if (!set) {
|
|
6754
|
+
set = { properties: /* @__PURE__ */ new Map() };
|
|
6755
|
+
this.#sets.set(filter.setId, set);
|
|
6756
|
+
}
|
|
6757
|
+
switch (filter.kind) {
|
|
6758
|
+
case RangeFilterKind.Subgroup:
|
|
6759
|
+
set.subgroup = ranges;
|
|
6760
|
+
break;
|
|
6761
|
+
case RangeFilterKind.ObjectId:
|
|
6762
|
+
set.objectId = ranges;
|
|
6763
|
+
break;
|
|
6764
|
+
case RangeFilterKind.Priority:
|
|
6765
|
+
set.priority = ranges;
|
|
6766
|
+
break;
|
|
6767
|
+
case RangeFilterKind.ObjectProperty:
|
|
6768
|
+
set.properties.set(filter.propertyType, ranges);
|
|
6769
|
+
break;
|
|
6770
|
+
}
|
|
6771
|
+
}
|
|
6772
|
+
this.rangeCount = rangeCount;
|
|
6773
|
+
}
|
|
6774
|
+
/** Whether the filter passes everything. */
|
|
6775
|
+
get isEmpty() {
|
|
6776
|
+
return this.#sets.size === 0;
|
|
6777
|
+
}
|
|
6778
|
+
/**
|
|
6779
|
+
* Whether `obj` passes.
|
|
6780
|
+
*
|
|
6781
|
+
* @param subgroupId - The Subgroup ID `obj` travels in. It is passed in because an
|
|
6782
|
+
* Object whose Subgroup ID is its subgroup's first Object ID does not know it
|
|
6783
|
+
* itself. `null` — a datagram — has no subgroup, so no subgroup filter passes it.
|
|
6784
|
+
*/
|
|
6785
|
+
matches(obj, subgroupId = obj.subgroupId) {
|
|
6786
|
+
if (this.isEmpty) return true;
|
|
6787
|
+
for (const set of this.#sets.values()) {
|
|
6788
|
+
if (set.subgroup && (subgroupId === null || !within(set.subgroup, subgroupId))) continue;
|
|
6789
|
+
if (set.objectId && !within(set.objectId, obj.location.object)) continue;
|
|
6790
|
+
if (set.priority && !within(set.priority, BigInt(obj.publisherPriority))) continue;
|
|
6791
|
+
if (!propertiesPass(set.properties, obj.properties)) continue;
|
|
6792
|
+
return true;
|
|
6793
|
+
}
|
|
6794
|
+
return false;
|
|
6795
|
+
}
|
|
6796
|
+
};
|
|
6797
|
+
/**
|
|
6798
|
+
* Whether each required Property is present with a value in its Ranges. One the
|
|
6799
|
+
* Object does not carry fails. Properties inside ImmutableProperties count as the
|
|
6800
|
+
* Object's own.
|
|
6801
|
+
*/
|
|
6802
|
+
function propertiesPass(required, properties) {
|
|
6803
|
+
if (required.size === 0) return true;
|
|
6804
|
+
const values = /* @__PURE__ */ new Map();
|
|
6805
|
+
const collect = (pairs) => {
|
|
6806
|
+
for (const pair of pairs) {
|
|
6807
|
+
if (isVarInt(pair)) {
|
|
6808
|
+
if (!values.has(pair.typeValue)) values.set(pair.typeValue, pair.value);
|
|
6809
|
+
continue;
|
|
6810
|
+
}
|
|
6811
|
+
const immutable = ImmutablePropertiesObjectProperty.fromKeyValuePair(pair);
|
|
6812
|
+
if (immutable) collect(immutable.properties);
|
|
6813
|
+
}
|
|
6814
|
+
};
|
|
6815
|
+
collect(properties ?? []);
|
|
6816
|
+
for (const [type, ranges] of required) {
|
|
6817
|
+
const value = values.get(type);
|
|
6818
|
+
if (value === void 0 || !within(ranges, value)) return false;
|
|
6819
|
+
}
|
|
6820
|
+
return true;
|
|
6821
|
+
}
|
|
6822
|
+
//#endregion
|
|
6823
|
+
exports.AudioConfig = AudioConfig;
|
|
6116
6824
|
exports.AudioLevel = AudioLevel;
|
|
6117
6825
|
exports.Authority = Authority;
|
|
6118
6826
|
exports.AuthorizationToken = AuthorizationToken;
|
|
@@ -6120,6 +6828,7 @@ exports.BaseByteBuffer = BaseByteBuffer;
|
|
|
6120
6828
|
exports.ByteBuffer = ByteBuffer;
|
|
6121
6829
|
exports.CMSFCatalog = CMSFCatalog;
|
|
6122
6830
|
exports.CastingError = CastingError;
|
|
6831
|
+
exports.CombinedFilter = CombinedFilter;
|
|
6123
6832
|
Object.defineProperty(exports, "ControlMessage", {
|
|
6124
6833
|
enumerable: true,
|
|
6125
6834
|
get: function() {
|
|
@@ -6149,19 +6858,8 @@ Object.defineProperty(exports, "FetchHeaderType", {
|
|
|
6149
6858
|
});
|
|
6150
6859
|
exports.FetchObject = FetchObject;
|
|
6151
6860
|
exports.FetchOk = FetchOk;
|
|
6152
|
-
|
|
6153
|
-
enumerable: true,
|
|
6154
|
-
get: function() {
|
|
6155
|
-
return FetchType;
|
|
6156
|
-
}
|
|
6157
|
-
});
|
|
6861
|
+
exports.FillParameters = FillParameters;
|
|
6158
6862
|
exports.FillTimeout = FillTimeout;
|
|
6159
|
-
Object.defineProperty(exports, "FilterType", {
|
|
6160
|
-
enumerable: true,
|
|
6161
|
-
get: function() {
|
|
6162
|
-
return FilterType;
|
|
6163
|
-
}
|
|
6164
|
-
});
|
|
6165
6863
|
exports.Forward = Forward;
|
|
6166
6864
|
exports.FrozenByteBuffer = FrozenByteBuffer;
|
|
6167
6865
|
exports.FullTrackName = FullTrackName;
|
|
@@ -6183,8 +6881,10 @@ Object.defineProperty(exports, "Header", {
|
|
|
6183
6881
|
});
|
|
6184
6882
|
exports.ImmutablePropertiesObjectProperty = ImmutablePropertiesObjectProperty;
|
|
6185
6883
|
exports.ImmutablePropertiesTrackProperty = ImmutablePropertiesTrackProperty;
|
|
6884
|
+
exports.IncludeProperties = IncludeProperties;
|
|
6186
6885
|
exports.InternalError = InternalError;
|
|
6187
6886
|
exports.InvalidEnumValue = InvalidEnumValue;
|
|
6887
|
+
exports.InvalidFilterError = InvalidFilterError;
|
|
6188
6888
|
exports.InvalidTypeError = InvalidTypeError;
|
|
6189
6889
|
exports.InvalidUTF8Error = InvalidUTF8Error;
|
|
6190
6890
|
exports.KeyValueFormattingError = KeyValueFormattingError;
|
|
@@ -6200,6 +6900,13 @@ exports.LOCPropertyId = LOCPropertyId;
|
|
|
6200
6900
|
exports.LargestObject = LargestObject;
|
|
6201
6901
|
exports.LengthExceedsMaxError = LengthExceedsMaxError;
|
|
6202
6902
|
exports.Location = Location;
|
|
6903
|
+
exports.LocationFilter = LocationFilter;
|
|
6904
|
+
Object.defineProperty(exports, "LocationFilterType", {
|
|
6905
|
+
enumerable: true,
|
|
6906
|
+
get: function() {
|
|
6907
|
+
return LocationFilterType;
|
|
6908
|
+
}
|
|
6909
|
+
});
|
|
6203
6910
|
exports.MAX_FULL_TRACK_NAME_LENGTH = MAX_FULL_TRACK_NAME_LENGTH;
|
|
6204
6911
|
exports.MAX_NAMESPACE_TUPLE_COUNT = MAX_NAMESPACE_TUPLE_COUNT;
|
|
6205
6912
|
exports.MAX_NEW_SESSION_URI_LENGTH = MAX_NEW_SESSION_URI_LENGTH;
|
|
@@ -6207,6 +6914,8 @@ exports.MAX_REASON_PHRASE_LEN = MAX_REASON_PHRASE_LEN;
|
|
|
6207
6914
|
exports.MOQtailError = MOQtailError;
|
|
6208
6915
|
exports.MaxAuthTokenCacheSize = MaxAuthTokenCacheSize;
|
|
6209
6916
|
exports.MaxCacheDurationProperty = MaxCacheDurationProperty;
|
|
6917
|
+
exports.MaxFilterRanges = MaxFilterRanges;
|
|
6918
|
+
exports.MaxRequestUpdates = MaxRequestUpdates;
|
|
6210
6919
|
Object.defineProperty(exports, "MessageParameter", {
|
|
6211
6920
|
enumerable: true,
|
|
6212
6921
|
get: function() {
|
|
@@ -6254,7 +6963,6 @@ exports.PriorObjectIdGapProperty = PriorObjectIdGapProperty;
|
|
|
6254
6963
|
exports.PropertyRanges = PropertyRanges;
|
|
6255
6964
|
exports.ProtocolViolationError = ProtocolViolationError;
|
|
6256
6965
|
exports.Publish = Publish;
|
|
6257
|
-
exports.PublishBlocked = PublishBlocked;
|
|
6258
6966
|
exports.PublishDone = PublishDone;
|
|
6259
6967
|
Object.defineProperty(exports, "PublishDoneStatusCode", {
|
|
6260
6968
|
enumerable: true,
|
|
@@ -6263,6 +6971,14 @@ Object.defineProperty(exports, "PublishDoneStatusCode", {
|
|
|
6263
6971
|
}
|
|
6264
6972
|
});
|
|
6265
6973
|
exports.PublishNamespace = PublishNamespace;
|
|
6974
|
+
exports.PublishSkipped = PublishSkipped;
|
|
6975
|
+
exports.RangeFilter = RangeFilter;
|
|
6976
|
+
Object.defineProperty(exports, "RangeFilterKind", {
|
|
6977
|
+
enumerable: true,
|
|
6978
|
+
get: function() {
|
|
6979
|
+
return RangeFilterKind;
|
|
6980
|
+
}
|
|
6981
|
+
});
|
|
6266
6982
|
exports.ReasonPhrase = ReasonPhrase;
|
|
6267
6983
|
exports.Redirect = Redirect;
|
|
6268
6984
|
exports.RendezvousTimeout = RendezvousTimeout;
|
|
@@ -6309,8 +7025,8 @@ exports.SubscribeNamespace = SubscribeNamespace;
|
|
|
6309
7025
|
exports.SubscribeOk = SubscribeOk;
|
|
6310
7026
|
exports.SubscribeTracks = SubscribeTracks;
|
|
6311
7027
|
exports.SubscriberPriority = SubscriberPriority;
|
|
6312
|
-
exports.
|
|
6313
|
-
exports.
|
|
7028
|
+
exports.SwitchFrom = SwitchFrom;
|
|
7029
|
+
exports.SwitchMode = SwitchMode;
|
|
6314
7030
|
exports.SwitchingSetAssignment = SwitchingSetAssignment;
|
|
6315
7031
|
Object.defineProperty(exports, "TerminationCode", {
|
|
6316
7032
|
enumerable: true,
|
|
@@ -6350,6 +7066,7 @@ exports.assertNoAuthorityOverWebTransport = assertNoAuthorityOverWebTransport;
|
|
|
6350
7066
|
exports.deserializeKvpList = deserializeKvpList;
|
|
6351
7067
|
exports.deserializeKvpListUntilEmpty = deserializeKvpListUntilEmpty;
|
|
6352
7068
|
exports.deserializeMessageParameterKvps = deserializeMessageParameterKvps;
|
|
7069
|
+
exports.encodeRanges = encodeRanges;
|
|
6353
7070
|
exports.greaseValue = greaseValue;
|
|
6354
7071
|
exports.isApplicationSpecificProperty = isApplicationSpecificProperty;
|
|
6355
7072
|
exports.isBytes = isBytes;
|