moqtail 0.16.0 → 0.17.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/dist/model.cjs CHANGED
@@ -1233,6 +1233,267 @@ let ObjectStatus = /* @__PURE__ */ function(ObjectStatus) {
1233
1233
  }
1234
1234
  _ObjectStatus.tryFrom = tryFrom;
1235
1235
  })(ObjectStatus || (ObjectStatus = {}));
1236
+ // src/model/common/grease.ts
1237
+ /**
1238
+ * Copyright 2026 The MOQtail Authors
1239
+ *
1240
+ * Licensed under the Apache License, Version 2.0 (the "License");
1241
+ * you may not use this file except in compliance with the License.
1242
+ * You may obtain a copy of the License at
1243
+ *
1244
+ * http://www.apache.org/licenses/LICENSE-2.0
1245
+ *
1246
+ * Unless required by applicable law or agreed to in writing, software
1247
+ * distributed under the License is distributed on an "AS IS" BASIS,
1248
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1249
+ * See the License for the specific language governing permissions and
1250
+ * limitations under the License.
1251
+ */
1252
+ /**
1253
+ * GREASE reservations (§14). Values matching `0x7f * N + 0x9D` are reserved across
1254
+ * several registries (Setup Options, Properties, error codes) so peers can emit them
1255
+ * to exercise unknown-value handling. Receivers treat them like any other unknown
1256
+ * value: ignore, never fatal.
1257
+ */
1258
+ /** Step between successive GREASE values. */
1259
+ const GREASE_STEP = 127n;
1260
+ /** The smallest GREASE value (N = 0). */
1261
+ const GREASE_BASE = 157n;
1262
+ /** The largest GREASE value that still fits a varint, i.e. `0x3fffffffffffffde`. */
1263
+ const GREASE_MAX = 4611686018427387870n;
1264
+ /**
1265
+ * @public
1266
+ * True if `value` is a reserved GREASE value, i.e. `0x7f * N + 0x9D` for some
1267
+ * non-negative `N`.
1268
+ */
1269
+ function isGrease(value) {
1270
+ const v = BigInt(value);
1271
+ return v >= 157n && (v - 157n) % 127n === 0n;
1272
+ }
1273
+ /**
1274
+ * @public
1275
+ * The `N`-th GREASE value, `0x7f * N + 0x9D`, or undefined if it would exceed what a
1276
+ * varint can carry (the pattern is capped at `0x3fffffffffffffde`).
1277
+ */
1278
+ function greaseValue(n) {
1279
+ const value = GREASE_STEP * BigInt(n) + GREASE_BASE;
1280
+ return value > GREASE_MAX ? void 0 : value;
1281
+ }
1282
+ // src/model/property/constant.ts
1283
+ /**
1284
+ * Copyright 2025 The MOQtail Authors
1285
+ *
1286
+ * Licensed under the Apache License, Version 2.0 (the "License");
1287
+ * you may not use this file except in compliance with the License.
1288
+ * You may obtain a copy of the License at
1289
+ *
1290
+ * http://www.apache.org/licenses/LICENSE-2.0
1291
+ *
1292
+ * Unless required by applicable law or agreed to in writing, software
1293
+ * distributed under the License is distributed on an "AS IS" BASIS,
1294
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1295
+ * See the License for the specific language governing permissions and
1296
+ * limitations under the License.
1297
+ */
1298
+ let LOCPropertyId = /* @__PURE__ */ function(LOCPropertyId) {
1299
+ LOCPropertyId[LOCPropertyId["Timescale"] = 8] = "Timescale";
1300
+ LOCPropertyId[LOCPropertyId["VideoFrameMarking"] = 9] = "VideoFrameMarking";
1301
+ LOCPropertyId[LOCPropertyId["AudioLevel"] = 12] = "AudioLevel";
1302
+ LOCPropertyId[LOCPropertyId["VideoConfig"] = 13] = "VideoConfig";
1303
+ LOCPropertyId[LOCPropertyId["AudioConfig"] = 15] = "AudioConfig";
1304
+ LOCPropertyId[LOCPropertyId["Timestamp"] = 16] = "Timestamp";
1305
+ return LOCPropertyId;
1306
+ }({});
1307
+ let TrackPropertyType = /* @__PURE__ */ function(TrackPropertyType) {
1308
+ TrackPropertyType[TrackPropertyType["ObjectDeliveryTimeout"] = 2] = "ObjectDeliveryTimeout";
1309
+ TrackPropertyType[TrackPropertyType["MaxCacheDuration"] = 4] = "MaxCacheDuration";
1310
+ TrackPropertyType[TrackPropertyType["SubgroupDeliveryTimeout"] = 6] = "SubgroupDeliveryTimeout";
1311
+ TrackPropertyType[TrackPropertyType["ImmutableProperties"] = 11] = "ImmutableProperties";
1312
+ TrackPropertyType[TrackPropertyType["DefaultPublisherPriority"] = 14] = "DefaultPublisherPriority";
1313
+ TrackPropertyType[TrackPropertyType["DefaultPublisherGroupOrder"] = 34] = "DefaultPublisherGroupOrder";
1314
+ TrackPropertyType[TrackPropertyType["DynamicGroups"] = 48] = "DynamicGroups";
1315
+ TrackPropertyType[TrackPropertyType["PriorGroupIdGap"] = 60] = "PriorGroupIdGap";
1316
+ TrackPropertyType[TrackPropertyType["PriorObjectIdGap"] = 62] = "PriorObjectIdGap";
1317
+ return TrackPropertyType;
1318
+ }({});
1319
+ function locPropertyIdFromNumber(value) {
1320
+ switch (value) {
1321
+ case 8: return 8;
1322
+ case 9: return 9;
1323
+ case 12: return 12;
1324
+ case 13: return 13;
1325
+ case 15: return 15;
1326
+ case 16: return 16;
1327
+ default: throw new InvalidTypeError("locPropertyIdFromNumber", `Invalid LOC property id: ${value}`);
1328
+ }
1329
+ }
1330
+ /**
1331
+ * @public
1332
+ * Registration-policy ranges for the Property Type space.
1333
+ *
1334
+ */
1335
+ const PropertyRanges = {
1336
+ /** Standards Action or IESG Approval (1-byte encoding). */
1337
+ StandardsAction: {
1338
+ from: 0n,
1339
+ to: 119n
1340
+ },
1341
+ /** Application-specific use, no registration permitted (1-byte encoding). */
1342
+ AppSpecific1Byte: {
1343
+ from: 120n,
1344
+ to: 127n
1345
+ },
1346
+ /** Specification Required (2-byte encoding). */
1347
+ SpecRequired: {
1348
+ from: 128n,
1349
+ to: 14335n
1350
+ },
1351
+ /** Application-specific use, no registration permitted (2-byte encoding). */
1352
+ AppSpecific2Byte: {
1353
+ from: 14336n,
1354
+ to: 16383n
1355
+ },
1356
+ /** Mandatory Track Properties; Track scope only. */
1357
+ MandatoryTrack: {
1358
+ from: 16384n,
1359
+ to: 32767n
1360
+ },
1361
+ /** First Come First Served begins here (open-ended). */
1362
+ Fcfs: { from: 32768n }
1363
+ };
1364
+ function inRange(range, typeValue) {
1365
+ return typeValue >= range.from && (range.to === void 0 || typeValue <= range.to);
1366
+ }
1367
+ /**
1368
+ * @public
1369
+ * True if a Property Type is reserved for application-specific use (either encoding-width
1370
+ * range), for which no IANA registration is permitted.
1371
+ */
1372
+ function isApplicationSpecificProperty(typeValue) {
1373
+ const v = BigInt(typeValue);
1374
+ return inRange(PropertyRanges.AppSpecific1Byte, v) || inRange(PropertyRanges.AppSpecific2Byte, v);
1375
+ }
1376
+ // src/model/property/object_property.ts
1377
+ /**
1378
+ * Copyright 2026 The MOQtail Authors
1379
+ *
1380
+ * Licensed under the Apache License, Version 2.0 (the "License");
1381
+ * you may not use this file except in compliance with the License.
1382
+ * You may obtain a copy of the License at
1383
+ *
1384
+ * http://www.apache.org/licenses/LICENSE-2.0
1385
+ *
1386
+ * Unless required by applicable law or agreed to in writing, software
1387
+ * distributed under the License is distributed on an "AS IS" BASIS,
1388
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1389
+ * See the License for the specific language governing permissions and
1390
+ * limitations under the License.
1391
+ */
1392
+ var ImmutablePropertiesObjectProperty = class ImmutablePropertiesObjectProperty {
1393
+ properties;
1394
+ static TYPE = 11;
1395
+ constructor(properties) {
1396
+ this.properties = properties;
1397
+ }
1398
+ toKeyValuePair() {
1399
+ return KeyValuePair.tryNewBytes(ImmutablePropertiesObjectProperty.TYPE, serializeKvpList(this.properties).toUint8Array());
1400
+ }
1401
+ static fromKeyValuePair(pair) {
1402
+ if (Number(pair.typeValue) !== ImmutablePropertiesObjectProperty.TYPE || !(pair.value instanceof Uint8Array)) return void 0;
1403
+ const properties = deserializeKvpListUntilEmpty(new FrozenByteBuffer(pair.value));
1404
+ properties.forEach(rejectMandatoryTrackProperty);
1405
+ if (properties.some((inner) => Number(inner.typeValue) === 11)) throw new ProtocolViolationError("ImmutablePropertiesObjectProperty.fromKeyValuePair", "ImmutableProperties must not contain nested ImmutableProperties (0x0B)");
1406
+ return new ImmutablePropertiesObjectProperty(properties);
1407
+ }
1408
+ };
1409
+ function rejectMandatoryTrackProperty(pair) {
1410
+ const { from, to } = PropertyRanges.MandatoryTrack;
1411
+ if (pair.typeValue >= from && pair.typeValue <= to && !isGrease(pair.typeValue)) throw new ProtocolViolationError("ObjectProperty.fromKeyValuePair", `Mandatory Track Property 0x${pair.typeValue.toString(16)} is not allowed on an Object`);
1412
+ }
1413
+ var PriorGroupIdGapProperty = class PriorGroupIdGapProperty {
1414
+ gap;
1415
+ static TYPE = 60;
1416
+ constructor(gap) {
1417
+ this.gap = gap;
1418
+ }
1419
+ toKeyValuePair() {
1420
+ return KeyValuePair.tryNewVarInt(PriorGroupIdGapProperty.TYPE, this.gap);
1421
+ }
1422
+ static fromKeyValuePair(pair) {
1423
+ if (Number(pair.typeValue) !== PriorGroupIdGapProperty.TYPE || typeof pair.value !== "bigint") return void 0;
1424
+ return new PriorGroupIdGapProperty(pair.value);
1425
+ }
1426
+ };
1427
+ var PriorObjectIdGapProperty = class PriorObjectIdGapProperty {
1428
+ gap;
1429
+ static TYPE = 62;
1430
+ constructor(gap) {
1431
+ this.gap = gap;
1432
+ }
1433
+ toKeyValuePair() {
1434
+ return KeyValuePair.tryNewVarInt(PriorObjectIdGapProperty.TYPE, this.gap);
1435
+ }
1436
+ static fromKeyValuePair(pair) {
1437
+ if (Number(pair.typeValue) !== PriorObjectIdGapProperty.TYPE || typeof pair.value !== "bigint") return void 0;
1438
+ return new PriorObjectIdGapProperty(pair.value);
1439
+ }
1440
+ };
1441
+ var UnknownObjectProperty = class {
1442
+ kvp;
1443
+ constructor(kvp) {
1444
+ this.kvp = kvp;
1445
+ }
1446
+ toKeyValuePair() {
1447
+ return this.kvp;
1448
+ }
1449
+ };
1450
+ let ObjectProperty;
1451
+ (function(_ObjectProperty) {
1452
+ function fromKeyValuePair(pair) {
1453
+ rejectMandatoryTrackProperty(pair);
1454
+ return ImmutablePropertiesObjectProperty.fromKeyValuePair(pair) ?? PriorGroupIdGapProperty.fromKeyValuePair(pair) ?? PriorObjectIdGapProperty.fromKeyValuePair(pair) ?? new UnknownObjectProperty(pair);
1455
+ }
1456
+ _ObjectProperty.fromKeyValuePair = fromKeyValuePair;
1457
+ function deserializeRaw(buf) {
1458
+ try {
1459
+ const pairs = deserializeKvpListUntilEmpty(buf);
1460
+ pairs.forEach(fromKeyValuePair);
1461
+ return pairs;
1462
+ } catch (e) {
1463
+ if (e instanceof NotEnoughBytesError) throw new ProtocolViolationError("ObjectProperty.deserializeRaw", e.message);
1464
+ throw e;
1465
+ }
1466
+ }
1467
+ _ObjectProperty.deserializeRaw = deserializeRaw;
1468
+ function toKeyValuePair(ext) {
1469
+ return ext.toKeyValuePair();
1470
+ }
1471
+ _ObjectProperty.toKeyValuePair = toKeyValuePair;
1472
+ function deserializeAll(buf) {
1473
+ return deserializeKvpListUntilEmpty(buf).map(fromKeyValuePair);
1474
+ }
1475
+ _ObjectProperty.deserializeAll = deserializeAll;
1476
+ function serializeInto(exts, payload) {
1477
+ payload.putBytes(serializeKvpList(exts.map((ext) => ext.toKeyValuePair())).toUint8Array());
1478
+ }
1479
+ _ObjectProperty.serializeInto = serializeInto;
1480
+ function isImmutableProperties(ext) {
1481
+ return ext instanceof ImmutablePropertiesObjectProperty;
1482
+ }
1483
+ _ObjectProperty.isImmutableProperties = isImmutableProperties;
1484
+ function isPriorGroupIdGap(ext) {
1485
+ return ext instanceof PriorGroupIdGapProperty;
1486
+ }
1487
+ _ObjectProperty.isPriorGroupIdGap = isPriorGroupIdGap;
1488
+ function isPriorObjectIdGap(ext) {
1489
+ return ext instanceof PriorObjectIdGapProperty;
1490
+ }
1491
+ _ObjectProperty.isPriorObjectIdGap = isPriorObjectIdGap;
1492
+ function isUnknown(ext) {
1493
+ return ext instanceof UnknownObjectProperty;
1494
+ }
1495
+ _ObjectProperty.isUnknown = isUnknown;
1496
+ })(ObjectProperty || (ObjectProperty = {}));
1236
1497
  // src/model/data/datagram.ts
1237
1498
  /**
1238
1499
  * Copyright 2026 The MOQtail Authors
@@ -1333,7 +1594,10 @@ var Datagram = class Datagram {
1333
1594
  if (ObjectDatagramType.hasDefaultPriority(msgType)) publisherPriority = null;
1334
1595
  else publisherPriority = buf.getU8();
1335
1596
  let properties = null;
1336
- if (ObjectDatagramType.hasProperties(msgType)) properties = deserializeKvpListUntilEmpty(new FrozenByteBuffer(buf.getLengthPrefixedBytes()));
1597
+ if (ObjectDatagramType.hasProperties(msgType)) {
1598
+ const headerBytes = new FrozenByteBuffer(buf.getLengthPrefixedBytes());
1599
+ properties = ObjectProperty.deserializeRaw(headerBytes);
1600
+ }
1337
1601
  let payload = null;
1338
1602
  let objectStatus = null;
1339
1603
  if (ObjectDatagramType.isStatus(msgType)) objectStatus = ObjectStatus.tryFrom(buf.getVI());
@@ -1898,7 +2162,8 @@ var FetchObject = class FetchObject {
1898
2162
  let properties = null;
1899
2163
  if (hasProperties) {
1900
2164
  const extLen = buf.getNumberVI();
1901
- properties = deserializeKvpListUntilEmpty(new FrozenByteBuffer(buf.getBytes(extLen)));
2165
+ const headerBytes = new FrozenByteBuffer(buf.getBytes(extLen));
2166
+ properties = ObjectProperty.deserializeRaw(headerBytes);
1902
2167
  }
1903
2168
  const payloadLen = buf.getNumberVI();
1904
2169
  const payload = buf.getBytes(payloadLen);
@@ -2008,100 +2273,6 @@ var FullTrackName = class FullTrackName {
2008
2273
  return new FullTrackName(namespace, name);
2009
2274
  }
2010
2275
  };
2011
- // src/model/property/constant.ts
2012
- /**
2013
- * Copyright 2025 The MOQtail Authors
2014
- *
2015
- * Licensed under the Apache License, Version 2.0 (the "License");
2016
- * you may not use this file except in compliance with the License.
2017
- * You may obtain a copy of the License at
2018
- *
2019
- * http://www.apache.org/licenses/LICENSE-2.0
2020
- *
2021
- * Unless required by applicable law or agreed to in writing, software
2022
- * distributed under the License is distributed on an "AS IS" BASIS,
2023
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2024
- * See the License for the specific language governing permissions and
2025
- * limitations under the License.
2026
- */
2027
- let LOCPropertyId = /* @__PURE__ */ function(LOCPropertyId) {
2028
- LOCPropertyId[LOCPropertyId["Timescale"] = 8] = "Timescale";
2029
- LOCPropertyId[LOCPropertyId["VideoFrameMarking"] = 9] = "VideoFrameMarking";
2030
- LOCPropertyId[LOCPropertyId["AudioLevel"] = 12] = "AudioLevel";
2031
- LOCPropertyId[LOCPropertyId["VideoConfig"] = 13] = "VideoConfig";
2032
- LOCPropertyId[LOCPropertyId["AudioConfig"] = 15] = "AudioConfig";
2033
- LOCPropertyId[LOCPropertyId["Timestamp"] = 16] = "Timestamp";
2034
- return LOCPropertyId;
2035
- }({});
2036
- let TrackPropertyType = /* @__PURE__ */ function(TrackPropertyType) {
2037
- TrackPropertyType[TrackPropertyType["ObjectDeliveryTimeout"] = 2] = "ObjectDeliveryTimeout";
2038
- TrackPropertyType[TrackPropertyType["MaxCacheDuration"] = 4] = "MaxCacheDuration";
2039
- TrackPropertyType[TrackPropertyType["SubgroupDeliveryTimeout"] = 6] = "SubgroupDeliveryTimeout";
2040
- TrackPropertyType[TrackPropertyType["ImmutableProperties"] = 11] = "ImmutableProperties";
2041
- TrackPropertyType[TrackPropertyType["DefaultPublisherPriority"] = 14] = "DefaultPublisherPriority";
2042
- TrackPropertyType[TrackPropertyType["DefaultPublisherGroupOrder"] = 34] = "DefaultPublisherGroupOrder";
2043
- TrackPropertyType[TrackPropertyType["DynamicGroups"] = 48] = "DynamicGroups";
2044
- TrackPropertyType[TrackPropertyType["PriorGroupIdGap"] = 60] = "PriorGroupIdGap";
2045
- TrackPropertyType[TrackPropertyType["PriorObjectIdGap"] = 62] = "PriorObjectIdGap";
2046
- return TrackPropertyType;
2047
- }({});
2048
- function locPropertyIdFromNumber(value) {
2049
- switch (value) {
2050
- case 8: return 8;
2051
- case 9: return 9;
2052
- case 12: return 12;
2053
- case 13: return 13;
2054
- case 15: return 15;
2055
- case 16: return 16;
2056
- default: throw new InvalidTypeError("locPropertyIdFromNumber", `Invalid LOC property id: ${value}`);
2057
- }
2058
- }
2059
- /**
2060
- * @public
2061
- * Registration-policy ranges for the Property Type space.
2062
- *
2063
- */
2064
- const PropertyRanges = {
2065
- /** Standards Action or IESG Approval (1-byte encoding). */
2066
- StandardsAction: {
2067
- from: 0n,
2068
- to: 119n
2069
- },
2070
- /** Application-specific use, no registration permitted (1-byte encoding). */
2071
- AppSpecific1Byte: {
2072
- from: 120n,
2073
- to: 127n
2074
- },
2075
- /** Specification Required (2-byte encoding). */
2076
- SpecRequired: {
2077
- from: 128n,
2078
- to: 14335n
2079
- },
2080
- /** Application-specific use, no registration permitted (2-byte encoding). */
2081
- AppSpecific2Byte: {
2082
- from: 14336n,
2083
- to: 16383n
2084
- },
2085
- /** Mandatory Track Properties; Track scope only. */
2086
- MandatoryTrack: {
2087
- from: 16384n,
2088
- to: 32767n
2089
- },
2090
- /** First Come First Served begins here (open-ended). */
2091
- Fcfs: { from: 32768n }
2092
- };
2093
- function inRange(range, typeValue) {
2094
- return typeValue >= range.from && (range.to === void 0 || typeValue <= range.to);
2095
- }
2096
- /**
2097
- * @public
2098
- * True if a Property Type is reserved for application-specific use (either encoding-width
2099
- * range), for which no IANA registration is permitted.
2100
- */
2101
- function isApplicationSpecificProperty(typeValue) {
2102
- const v = BigInt(typeValue);
2103
- return inRange(PropertyRanges.AppSpecific1Byte, v) || inRange(PropertyRanges.AppSpecific2Byte, v);
2104
- }
2105
2276
  // src/model/property/timestamp.ts
2106
2277
  /**
2107
2278
  * Copyright 2025 The MOQtail Authors
@@ -2362,52 +2533,6 @@ var LOCProperties = class {
2362
2533
  return result;
2363
2534
  }
2364
2535
  };
2365
- // src/model/common/grease.ts
2366
- /**
2367
- * Copyright 2026 The MOQtail Authors
2368
- *
2369
- * Licensed under the Apache License, Version 2.0 (the "License");
2370
- * you may not use this file except in compliance with the License.
2371
- * You may obtain a copy of the License at
2372
- *
2373
- * http://www.apache.org/licenses/LICENSE-2.0
2374
- *
2375
- * Unless required by applicable law or agreed to in writing, software
2376
- * distributed under the License is distributed on an "AS IS" BASIS,
2377
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2378
- * See the License for the specific language governing permissions and
2379
- * limitations under the License.
2380
- */
2381
- /**
2382
- * GREASE reservations (§14). Values matching `0x7f * N + 0x9D` are reserved across
2383
- * several registries (Setup Options, Properties, error codes) so peers can emit them
2384
- * to exercise unknown-value handling. Receivers treat them like any other unknown
2385
- * value: ignore, never fatal.
2386
- */
2387
- /** Step between successive GREASE values. */
2388
- const GREASE_STEP = 127n;
2389
- /** The smallest GREASE value (N = 0). */
2390
- const GREASE_BASE = 157n;
2391
- /** The largest GREASE value that still fits a varint, i.e. `0x3fffffffffffffde`. */
2392
- const GREASE_MAX = 4611686018427387870n;
2393
- /**
2394
- * @public
2395
- * True if `value` is a reserved GREASE value, i.e. `0x7f * N + 0x9D` for some
2396
- * non-negative `N`.
2397
- */
2398
- function isGrease(value) {
2399
- const v = BigInt(value);
2400
- return v >= 157n && (v - 157n) % 127n === 0n;
2401
- }
2402
- /**
2403
- * @public
2404
- * The `N`-th GREASE value, `0x7f * N + 0x9D`, or undefined if it would exceed what a
2405
- * varint can carry (the pattern is capped at `0x3fffffffffffffde`).
2406
- */
2407
- function greaseValue(n) {
2408
- const value = GREASE_STEP * BigInt(n) + GREASE_BASE;
2409
- return value > GREASE_MAX ? void 0 : value;
2410
- }
2411
2536
  // src/model/property/track_property.ts
2412
2537
  /**
2413
2538
  * Copyright 2026 The MOQtail Authors
@@ -2588,110 +2713,6 @@ let TrackProperty;
2588
2713
  }
2589
2714
  _TrackProperty.isUnknown = isUnknown;
2590
2715
  })(TrackProperty || (TrackProperty = {}));
2591
- // src/model/property/object_property.ts
2592
- /**
2593
- * Copyright 2026 The MOQtail Authors
2594
- *
2595
- * Licensed under the Apache License, Version 2.0 (the "License");
2596
- * you may not use this file except in compliance with the License.
2597
- * You may obtain a copy of the License at
2598
- *
2599
- * http://www.apache.org/licenses/LICENSE-2.0
2600
- *
2601
- * Unless required by applicable law or agreed to in writing, software
2602
- * distributed under the License is distributed on an "AS IS" BASIS,
2603
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2604
- * See the License for the specific language governing permissions and
2605
- * limitations under the License.
2606
- */
2607
- var ImmutablePropertiesObjectProperty = class ImmutablePropertiesObjectProperty {
2608
- properties;
2609
- static TYPE = 11;
2610
- constructor(properties) {
2611
- this.properties = properties;
2612
- }
2613
- toKeyValuePair() {
2614
- return KeyValuePair.tryNewBytes(ImmutablePropertiesObjectProperty.TYPE, serializeKvpList(this.properties).toUint8Array());
2615
- }
2616
- static fromKeyValuePair(pair) {
2617
- if (Number(pair.typeValue) !== ImmutablePropertiesObjectProperty.TYPE || !(pair.value instanceof Uint8Array)) return void 0;
2618
- const properties = deserializeKvpListUntilEmpty(new FrozenByteBuffer(pair.value));
2619
- if (properties.some((inner) => Number(inner.typeValue) === 11)) throw new ProtocolViolationError("ImmutablePropertiesObjectProperty.fromKeyValuePair", "ImmutableProperties must not contain nested ImmutableProperties (0x0B)");
2620
- return new ImmutablePropertiesObjectProperty(properties);
2621
- }
2622
- };
2623
- var PriorGroupIdGapProperty = class PriorGroupIdGapProperty {
2624
- gap;
2625
- static TYPE = 60;
2626
- constructor(gap) {
2627
- this.gap = gap;
2628
- }
2629
- toKeyValuePair() {
2630
- return KeyValuePair.tryNewVarInt(PriorGroupIdGapProperty.TYPE, this.gap);
2631
- }
2632
- static fromKeyValuePair(pair) {
2633
- if (Number(pair.typeValue) !== PriorGroupIdGapProperty.TYPE || typeof pair.value !== "bigint") return void 0;
2634
- return new PriorGroupIdGapProperty(pair.value);
2635
- }
2636
- };
2637
- var PriorObjectIdGapProperty = class PriorObjectIdGapProperty {
2638
- gap;
2639
- static TYPE = 62;
2640
- constructor(gap) {
2641
- this.gap = gap;
2642
- }
2643
- toKeyValuePair() {
2644
- return KeyValuePair.tryNewVarInt(PriorObjectIdGapProperty.TYPE, this.gap);
2645
- }
2646
- static fromKeyValuePair(pair) {
2647
- if (Number(pair.typeValue) !== PriorObjectIdGapProperty.TYPE || typeof pair.value !== "bigint") return void 0;
2648
- return new PriorObjectIdGapProperty(pair.value);
2649
- }
2650
- };
2651
- var UnknownObjectProperty = class {
2652
- kvp;
2653
- constructor(kvp) {
2654
- this.kvp = kvp;
2655
- }
2656
- toKeyValuePair() {
2657
- return this.kvp;
2658
- }
2659
- };
2660
- let ObjectProperty;
2661
- (function(_ObjectProperty) {
2662
- function fromKeyValuePair(pair) {
2663
- return ImmutablePropertiesObjectProperty.fromKeyValuePair(pair) ?? PriorGroupIdGapProperty.fromKeyValuePair(pair) ?? PriorObjectIdGapProperty.fromKeyValuePair(pair) ?? new UnknownObjectProperty(pair);
2664
- }
2665
- _ObjectProperty.fromKeyValuePair = fromKeyValuePair;
2666
- function toKeyValuePair(ext) {
2667
- return ext.toKeyValuePair();
2668
- }
2669
- _ObjectProperty.toKeyValuePair = toKeyValuePair;
2670
- function deserializeAll(buf) {
2671
- return deserializeKvpListUntilEmpty(buf).map(fromKeyValuePair);
2672
- }
2673
- _ObjectProperty.deserializeAll = deserializeAll;
2674
- function serializeInto(exts, payload) {
2675
- payload.putBytes(serializeKvpList(exts.map((ext) => ext.toKeyValuePair())).toUint8Array());
2676
- }
2677
- _ObjectProperty.serializeInto = serializeInto;
2678
- function isImmutableProperties(ext) {
2679
- return ext instanceof ImmutablePropertiesObjectProperty;
2680
- }
2681
- _ObjectProperty.isImmutableProperties = isImmutableProperties;
2682
- function isPriorGroupIdGap(ext) {
2683
- return ext instanceof PriorGroupIdGapProperty;
2684
- }
2685
- _ObjectProperty.isPriorGroupIdGap = isPriorGroupIdGap;
2686
- function isPriorObjectIdGap(ext) {
2687
- return ext instanceof PriorObjectIdGapProperty;
2688
- }
2689
- _ObjectProperty.isPriorObjectIdGap = isPriorObjectIdGap;
2690
- function isUnknown(ext) {
2691
- return ext instanceof UnknownObjectProperty;
2692
- }
2693
- _ObjectProperty.isUnknown = isUnknown;
2694
- })(ObjectProperty || (ObjectProperty = {}));
2695
2716
  // src/model/property/find.ts
2696
2717
  /**
2697
2718
  * Copyright 2026 The MOQtail Authors
@@ -2781,7 +2802,8 @@ var SubgroupObject = class SubgroupObject {
2781
2802
  let properties = null;
2782
2803
  if (hasProperties) {
2783
2804
  const extLen = buf.getNumberVI();
2784
- properties = deserializeKvpListUntilEmpty(new FrozenByteBuffer(buf.getBytes(extLen)));
2805
+ const headerBytes = new FrozenByteBuffer(buf.getBytes(extLen));
2806
+ properties = ObjectProperty.deserializeRaw(headerBytes);
2785
2807
  }
2786
2808
  const payloadLen = buf.getNumberVI();
2787
2809
  let objectStatus = null;
@@ -4968,14 +4990,14 @@ function valueShapeOf(typeValue) {
4968
4990
  case BigInt(53): return 1;
4969
4991
  case BigInt(9): return 2;
4970
4992
  case BigInt(33): return 3;
4993
+ case BigInt(52): return 4;
4971
4994
  case BigInt(36):
4972
- case BigInt(52):
4973
4995
  case BigInt(37):
4974
4996
  case BigInt(38):
4975
4997
  case BigInt(39):
4976
4998
  case BigInt(40):
4977
- case BigInt(41): return 4;
4978
- default: return typeValue % 2n === 0n ? 0 : 4;
4999
+ case BigInt(41): return 5;
5000
+ default: return typeValue % 2n === 0n ? 0 : 5;
4979
5001
  }
4980
5002
  }
4981
5003
  /**
@@ -4995,9 +5017,10 @@ function serializeMessageParameterKvps(items) {
4995
5017
  break;
4996
5018
  case 2:
4997
5019
  case 3:
5020
+ case 4:
4998
5021
  if (isBytes(kvp)) buf.putBytes(kvp.value);
4999
5022
  break;
5000
- case 4:
5023
+ case 5:
5001
5024
  if (isBytes(kvp)) buf.putLengthPrefixedBytes(kvp.value);
5002
5025
  break;
5003
5026
  case 0: if (isVarInt(kvp)) buf.putVI(kvp.value);
@@ -5035,6 +5058,9 @@ function readMessageParameterKvps(buf, more) {
5035
5058
  items.push(KeyValuePair.newBytes(typeValue, LocationFilter.deserializeValue(buf).serializeValue()));
5036
5059
  break;
5037
5060
  case 4:
5061
+ items.push(KeyValuePair.newBytes(typeValue, Tuple.deserialize(buf).serialize().toUint8Array()));
5062
+ break;
5063
+ case 5:
5038
5064
  items.push(KeyValuePair.deserializeBytesValue(buf, typeValue));
5039
5065
  break;
5040
5066
  case 0: items.push(KeyValuePair.tryNewVarInt(typeValue, buf.getVI()));
package/dist/model.d.cts CHANGED
@@ -2725,6 +2725,11 @@ export declare class UnknownObjectProperty {
2725
2725
  export type ObjectProperty = ImmutablePropertiesObjectProperty | PriorGroupIdGapProperty | PriorObjectIdGapProperty | UnknownObjectProperty;
2726
2726
  export declare namespace ObjectProperty {
2727
2727
  function fromKeyValuePair(pair: KeyValuePair): ObjectProperty;
2728
+ /**
2729
+ * Reads an Object's length-delimited property block as raw pairs, checked like
2730
+ * `fromKeyValuePair`. Throws ProtocolViolationError if it is malformed.
2731
+ */
2732
+ function deserializeRaw(buf: BaseByteBuffer): KeyValuePair[];
2728
2733
  function toKeyValuePair(ext: ObjectProperty): KeyValuePair;
2729
2734
  function deserializeAll(buf: BaseByteBuffer): ObjectProperty[];
2730
2735
  function serializeInto(exts: ObjectProperty[], payload: ByteBuffer): void;
package/dist/model.d.mts CHANGED
@@ -13,5 +13,5 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { $ as PropertyRange, $n as isVarInt, $t as Expires, A as RequestError, An as LocationFilterType, At as RequestIdError, B as GoAway, Bn as ObjectDatagramType, Bt as NewGroupRequest, C as AudioLevel, Cn as MAX_FULL_TRACK_NAME_LENGTH, Ct as InvalidTypeError, D as StreamResetCode, Dn as FetchObjectContext, Dt as MOQtailError, E as Timestamp, En as FetchObject, Et as LengthExceedsMaxError, F as RequestUpdate, Fn as TrackStatusCode, Ft as FillParameters, G as DynamicGroupsProperty, Gn as ReasonPhrase, Gt as resolveTransportUrl, H as FetchOk, Hn as ObjectStatus, Ht as Redirect, I as SubscribeOk, In as FetchHeader, It as SwitchFrom, J as ObjectDeliveryTimeoutProperty, Jn as Location, Jt as greaseValue, K as ImmutablePropertiesTrackProperty, Kn as Tuple, Kt as GREASE_BASE, L as Publish, Ln as Datagram, Lt as LocationFilter, M as SubscribeTracks, Mn as RequestErrorCode, Mt as TimeoutError, N as SubscribeNamespace, Nn as SUPPORTED_VERSIONS, Nt as TrackNameError, O as TerminationCode, On as ControlMessageType, Ot as NotEnoughBytesError, P as TrackStatus, Pn as SwitchMode, Pt as VarIntOverflowError, Q as LOCPropertyId, Qn as isBytes, Qt as Forward, R as PublishDone, Rn as DEFAULT_PUBLISHER_PRIORITY, Rt as SubscriberPriority, S as VideoConfig, Sn as FullTrackName, St as InvalidEnumValue, T as Timescale, Tn as EndOfRangeKind, Tt as KeyValueFormattingError, U as DefaultPublisherGroupOrderProperty, Un as SubgroupHeaderType, Ut as MoqtFragment, V as MAX_NEW_SESSION_URI_LENGTH, Vn as ObjectForwardingPreference, Vt as LargestObject, W as DefaultPublisherPriorityProperty, Wn as MAX_REASON_PHRASE_LEN, Wt as MoqtUrl, X as TrackProperty, Xn as deserializeKvpList, Xt as GroupOrderParam, Y as SubgroupDeliveryTimeoutProperty, Yn as KeyValuePair, Yt as isGrease, Z as UnknownTrackProperty, Zn as deserializeKvpListUntilEmpty, Zt as IncludeProperties, _ as PriorObjectIdGapProperty, _n as Header, _t as RangeFilter, a as SstsAlgorithms, an as AuthorizationToken, at as Setup, b as LOCProperty, bn as MoqtObject, bt as CastingError, c as MaxFilterRanges, cn as SetupOptionType, ct as PublishNamespace, d as Path, dn as setupOptionTypeFromNumber, dt as applyMessageParameterUpdate, en as SubgroupDeliveryTimeout, er as serializeKvpList, et as PropertyRanges, f as PropertyReader, fn as tokenAliasTypeFromNumber, ft as deserializeMessageParameterKvps, g as PriorGroupIdGapProperty, gn as FrozenByteBuffer, gt as RangeDelta, h as ObjectProperty, hn as ByteBuffer, ht as Range, i as assertNoAuthorityOverWebTransport, in as AuthTokenVariant, it as Fetch, j as RequestOk, jn as PublishDoneStatusCode, jt as TerminationError, k as ControlMessage, kn as GroupOrder, kt as ProtocolViolationError, l as Authority, ln as TokenAliasType, lt as MessageParameter, m as ImmutablePropertiesObjectProperty, mn as BaseByteBuffer, mt as InvalidFilterError, n as SetupOption, nn as ObjectDeliveryTimeout, nt as isApplicationSpecificProperty, o as MaxRequestUpdates, on as Parameter, ot as NamespaceDone, p as findProperty, pn as PublishSkipped, pt as serializeMessageParameterKvps, q as MaxCacheDurationProperty, qn as TupleField, qt as GREASE_STEP, r as SetupOptions, rn as FillTimeout, rt as locPropertyIdFromNumber, s as MoqtImplementation, sn as MessageParameterType, st as Namespace, t as CombinedFilter, tn as RendezvousTimeout, tt as TrackPropertyType, u as MaxAuthTokenCacheSize, un as messageParameterTypeFromNumber, ut as MessageParameters, v as UnknownObjectProperty, vn as RequestIdMap, vt as RangeFilterKind, w as VideoFrameMarking, wn as MAX_NAMESPACE_TUPLE_COUNT, wt as InvalidUTF8Error, x as AudioConfig, xn as SubgroupObject, xt as InternalError, y as LOCProperties, yn as SubgroupHeader, yt as encodeRanges, z as Subscribe, zn as FetchHeaderType, zt as SwitchingSetAssignment } from "./index-CNn9BgO6.mjs";
16
+ import { $ as PropertyRange, $n as isVarInt, $t as Expires, A as RequestError, An as LocationFilterType, At as RequestIdError, B as GoAway, Bn as ObjectDatagramType, Bt as NewGroupRequest, C as AudioLevel, Cn as MAX_FULL_TRACK_NAME_LENGTH, Ct as InvalidTypeError, D as StreamResetCode, Dn as FetchObjectContext, Dt as MOQtailError, E as Timestamp, En as FetchObject, Et as LengthExceedsMaxError, F as RequestUpdate, Fn as TrackStatusCode, Ft as FillParameters, G as DynamicGroupsProperty, Gn as ReasonPhrase, Gt as resolveTransportUrl, H as FetchOk, Hn as ObjectStatus, Ht as Redirect, I as SubscribeOk, In as FetchHeader, It as SwitchFrom, J as ObjectDeliveryTimeoutProperty, Jn as Location, Jt as greaseValue, K as ImmutablePropertiesTrackProperty, Kn as Tuple, Kt as GREASE_BASE, L as Publish, Ln as Datagram, Lt as LocationFilter, M as SubscribeTracks, Mn as RequestErrorCode, Mt as TimeoutError, N as SubscribeNamespace, Nn as SUPPORTED_VERSIONS, Nt as TrackNameError, O as TerminationCode, On as ControlMessageType, Ot as NotEnoughBytesError, P as TrackStatus, Pn as SwitchMode, Pt as VarIntOverflowError, Q as LOCPropertyId, Qn as isBytes, Qt as Forward, R as PublishDone, Rn as DEFAULT_PUBLISHER_PRIORITY, Rt as SubscriberPriority, S as VideoConfig, Sn as FullTrackName, St as InvalidEnumValue, T as Timescale, Tn as EndOfRangeKind, Tt as KeyValueFormattingError, U as DefaultPublisherGroupOrderProperty, Un as SubgroupHeaderType, Ut as MoqtFragment, V as MAX_NEW_SESSION_URI_LENGTH, Vn as ObjectForwardingPreference, Vt as LargestObject, W as DefaultPublisherPriorityProperty, Wn as MAX_REASON_PHRASE_LEN, Wt as MoqtUrl, X as TrackProperty, Xn as deserializeKvpList, Xt as GroupOrderParam, Y as SubgroupDeliveryTimeoutProperty, Yn as KeyValuePair, Yt as isGrease, Z as UnknownTrackProperty, Zn as deserializeKvpListUntilEmpty, Zt as IncludeProperties, _ as PriorObjectIdGapProperty, _n as Header, _t as RangeFilter, a as SstsAlgorithms, an as AuthorizationToken, at as Setup, b as LOCProperty, bn as MoqtObject, bt as CastingError, c as MaxFilterRanges, cn as SetupOptionType, ct as PublishNamespace, d as Path, dn as setupOptionTypeFromNumber, dt as applyMessageParameterUpdate, en as SubgroupDeliveryTimeout, er as serializeKvpList, et as PropertyRanges, f as PropertyReader, fn as tokenAliasTypeFromNumber, ft as deserializeMessageParameterKvps, g as PriorGroupIdGapProperty, gn as FrozenByteBuffer, gt as RangeDelta, h as ObjectProperty, hn as ByteBuffer, ht as Range, i as assertNoAuthorityOverWebTransport, in as AuthTokenVariant, it as Fetch, j as RequestOk, jn as PublishDoneStatusCode, jt as TerminationError, k as ControlMessage, kn as GroupOrder, kt as ProtocolViolationError, l as Authority, ln as TokenAliasType, lt as MessageParameter, m as ImmutablePropertiesObjectProperty, mn as BaseByteBuffer, mt as InvalidFilterError, n as SetupOption, nn as ObjectDeliveryTimeout, nt as isApplicationSpecificProperty, o as MaxRequestUpdates, on as Parameter, ot as NamespaceDone, p as findProperty, pn as PublishSkipped, pt as serializeMessageParameterKvps, q as MaxCacheDurationProperty, qn as TupleField, qt as GREASE_STEP, r as SetupOptions, rn as FillTimeout, rt as locPropertyIdFromNumber, s as MoqtImplementation, sn as MessageParameterType, st as Namespace, t as CombinedFilter, tn as RendezvousTimeout, tt as TrackPropertyType, u as MaxAuthTokenCacheSize, un as messageParameterTypeFromNumber, ut as MessageParameters, v as UnknownObjectProperty, vn as RequestIdMap, vt as RangeFilterKind, w as VideoFrameMarking, wn as MAX_NAMESPACE_TUPLE_COUNT, wt as InvalidUTF8Error, x as AudioConfig, xn as SubgroupObject, xt as InternalError, y as LOCProperties, yn as SubgroupHeader, yt as encodeRanges, z as Subscribe, zn as FetchHeaderType, zt as SwitchingSetAssignment } from "./index-BaZgHZ8D.mjs";
17
17
  export { AudioConfig, AudioLevel, AuthTokenVariant, Authority, AuthorizationToken, BaseByteBuffer, ByteBuffer, CastingError, CombinedFilter, ControlMessage, ControlMessageType, DEFAULT_PUBLISHER_PRIORITY, Datagram, DefaultPublisherGroupOrderProperty, DefaultPublisherPriorityProperty, DynamicGroupsProperty, EndOfRangeKind, Expires, Fetch, FetchHeader, FetchHeaderType, FetchObject, FetchObjectContext, FetchOk, FillParameters, FillTimeout, Forward, FrozenByteBuffer, FullTrackName, GREASE_BASE, GREASE_STEP, GoAway, GroupOrder, GroupOrderParam, Header, ImmutablePropertiesObjectProperty, ImmutablePropertiesTrackProperty, IncludeProperties, InternalError, InvalidEnumValue, InvalidFilterError, InvalidTypeError, InvalidUTF8Error, KeyValueFormattingError, KeyValuePair, LOCProperties, LOCProperty, LOCPropertyId, LargestObject, LengthExceedsMaxError, Location, LocationFilter, LocationFilterType, MAX_FULL_TRACK_NAME_LENGTH, MAX_NAMESPACE_TUPLE_COUNT, MAX_NEW_SESSION_URI_LENGTH, MAX_REASON_PHRASE_LEN, MOQtailError, MaxAuthTokenCacheSize, MaxCacheDurationProperty, MaxFilterRanges, MaxRequestUpdates, MessageParameter, MessageParameterType, MessageParameters, MoqtFragment, MoqtImplementation, MoqtObject, MoqtUrl, Namespace, NamespaceDone, NewGroupRequest, NotEnoughBytesError, ObjectDatagramType, ObjectDeliveryTimeout, ObjectDeliveryTimeoutProperty, ObjectForwardingPreference, ObjectProperty, ObjectStatus, Parameter, Path, PriorGroupIdGapProperty, PriorObjectIdGapProperty, PropertyRange, PropertyRanges, PropertyReader, ProtocolViolationError, Publish, PublishDone, PublishDoneStatusCode, PublishNamespace, PublishSkipped, Range, RangeDelta, RangeFilter, RangeFilterKind, ReasonPhrase, Redirect, RendezvousTimeout, RequestError, RequestErrorCode, RequestIdError, RequestIdMap, RequestOk, RequestUpdate, SUPPORTED_VERSIONS, Setup, SetupOption, SetupOptionType, SetupOptions, SstsAlgorithms, StreamResetCode, SubgroupDeliveryTimeout, SubgroupDeliveryTimeoutProperty, SubgroupHeader, SubgroupHeaderType, SubgroupObject, Subscribe, SubscribeNamespace, SubscribeOk, SubscribeTracks, SubscriberPriority, SwitchFrom, SwitchMode, SwitchingSetAssignment, TerminationCode, TerminationError, TimeoutError, Timescale, Timestamp, TokenAliasType, TrackNameError, TrackProperty, TrackPropertyType, TrackStatus, TrackStatusCode, Tuple, TupleField, UnknownObjectProperty, UnknownTrackProperty, VarIntOverflowError, VideoConfig, VideoFrameMarking, applyMessageParameterUpdate, assertNoAuthorityOverWebTransport, deserializeKvpList, deserializeKvpListUntilEmpty, deserializeMessageParameterKvps, encodeRanges, findProperty, greaseValue, isApplicationSpecificProperty, isBytes, isGrease, isVarInt, locPropertyIdFromNumber, messageParameterTypeFromNumber, resolveTransportUrl, serializeKvpList, serializeMessageParameterKvps, setupOptionTypeFromNumber, tokenAliasTypeFromNumber };