moqtail 0.8.1 → 0.10.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.
@@ -0,0 +1,2724 @@
1
+ /**
2
+ * Copyright 2025 The MOQtail Authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ /**
18
+ * @public
19
+ * Represents a key-value pair for MOQT protocol parameters.
20
+ *
21
+ * - If `typeValue` is **even**, the value is a varint (`bigint`).
22
+ * - If `typeValue` is **odd**, the value is a binary blob (`Uint8Array`) with a maximum length of 65535 bytes.
23
+ *
24
+ * Use {@link KeyValuePair.tryNewVarInt} for varint pairs and {@link KeyValuePair.tryNewBytes} for blob pairs.
25
+ */
26
+ declare class KeyValuePair {
27
+ /**
28
+ * The key/type identifier for this pair.
29
+ * - Even: value is a varint.
30
+ * - Odd: value is a blob.
31
+ */
32
+ readonly typeValue: bigint;
33
+ /**
34
+ * The value for this pair.
35
+ * - If `typeValue` is even: a varint (`bigint`).
36
+ * - If `typeValue` is odd: a binary blob (`Uint8Array`).
37
+ */
38
+ readonly value: bigint | Uint8Array;
39
+ /**
40
+ * Constructs a new KeyValuePair.
41
+ * @param typeValue - The key/type identifier.
42
+ * @param value - The value (varint or blob).
43
+ * @internal Use static factory methods instead.
44
+ */
45
+ private constructor();
46
+ /**
47
+ * Creates a new varint KeyValuePair.
48
+ * @param typeValue - Must be even.
49
+ * @param value - The varint value.
50
+ * @returns A KeyValuePair with varint value.
51
+ * @throws KeyValueFormattingError if typeValue is not even.
52
+ */
53
+ static tryNewVarInt(typeValue: bigint | number, value: bigint | number): KeyValuePair;
54
+ /**
55
+ * Creates a new blob KeyValuePair.
56
+ * @param typeValue - Must be odd.
57
+ * @param value - The binary blob value.
58
+ * @returns A KeyValuePair with blob value.
59
+ * @throws KeyValueFormattingError if typeValue is not odd.
60
+ * @throws LengthExceedsMaxError if value length exceeds 65535 bytes.
61
+ */
62
+ static tryNewBytes(typeValue: bigint | number, value: Uint8Array): KeyValuePair;
63
+ /**
64
+ * Serializes this key-value pair to a frozen byte buffer.
65
+ * @returns The serialized buffer.
66
+ */
67
+ serialize(): FrozenByteBuffer;
68
+ /**
69
+ * Deserializes a KeyValuePair from a buffer.
70
+ * @param buf - The buffer to read from.
71
+ * @returns The deserialized KeyValuePair.
72
+ * @throws LengthExceedsMaxError if blob length exceeds 65535 bytes.
73
+ * @throws NotEnoughBytesError if buffer does not contain enough bytes.
74
+ */
75
+ static deserialize(buf: BaseByteBuffer): KeyValuePair;
76
+ /**
77
+ * Checks if this pair is equal to another.
78
+ * @param other - The other KeyValuePair.
79
+ * @returns True if both type and value are equal.
80
+ */
81
+ equals(other: KeyValuePair): boolean;
82
+ }
83
+ /**
84
+ * Checks if the KeyValuePair is a varint pair (even typeValue).
85
+ * @param pair - The KeyValuePair to check.
86
+ * @returns True if value is a varint.
87
+ */
88
+ declare function isVarInt(pair: KeyValuePair): pair is KeyValuePair & {
89
+ value: bigint;
90
+ };
91
+ /**
92
+ * Checks if the KeyValuePair is a blob pair (odd typeValue).
93
+ * @param pair - The KeyValuePair to check.
94
+ * @returns True if value is a Uint8Array.
95
+ */
96
+ declare function isBytes(pair: KeyValuePair): pair is KeyValuePair & {
97
+ value: Uint8Array;
98
+ };
99
+
100
+ /**
101
+ * Copyright 2025 The MOQtail Authors
102
+ *
103
+ * Licensed under the Apache License, Version 2.0 (the "License");
104
+ * you may not use this file except in compliance with the License.
105
+ * You may obtain a copy of the License at
106
+ *
107
+ * http://www.apache.org/licenses/LICENSE-2.0
108
+ *
109
+ * Unless required by applicable law or agreed to in writing, software
110
+ * distributed under the License is distributed on an "AS IS" BASIS,
111
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
112
+ * See the License for the specific language governing permissions and
113
+ * limitations under the License.
114
+ */
115
+
116
+ /**
117
+ * @public
118
+ * Represents a position in a MOQT track, consisting of a group and object index.
119
+ *
120
+ * Used for specifying start/end positions in subscription and fetch requests.
121
+ * - `group`: The group index (e.g. segment, GOP, or logical group).
122
+ * - `object`: The object index within the group (e.g. frame, chunk).
123
+ */
124
+ declare class Location {
125
+ /**
126
+ * The group index for this location.
127
+ */
128
+ readonly group: bigint;
129
+ /**
130
+ * The object index within the group for this location.
131
+ */
132
+ readonly object: bigint;
133
+ /**
134
+ * Constructs a new Location.
135
+ * @param group - The group index (number or bigint).
136
+ * @param object - The object index (number or bigint).
137
+ */
138
+ constructor(group: bigint | number, object: bigint | number);
139
+ /**
140
+ * Serializes this Location to a FrozenByteBuffer.
141
+ * @returns The serialized buffer.
142
+ * @throws CastingError if group or object is negative.
143
+ * @throws VarIntOverflowError if group or object exceeds varint encoding limits.
144
+ */
145
+ serialize(): FrozenByteBuffer;
146
+ /**
147
+ * Deserializes a Location from a buffer.
148
+ * @param buf - The buffer to read from.
149
+ * @returns The deserialized Location.
150
+ * @throws NotEnoughBytesError if buffer does not contain enough bytes.
151
+ */
152
+ static deserialize(buf: BaseByteBuffer): Location;
153
+ /**
154
+ * Checks if this Location is equal to another.
155
+ * @param other - The other Location to compare.
156
+ * @returns True if both group and object are equal.
157
+ */
158
+ equals(other: Location): boolean;
159
+ /**
160
+ * Compares this Location to another for ordering.
161
+ * @param other - The other Location to compare.
162
+ * @returns -1 if this \< other, 1 if this \> other, 0 if equal.
163
+ */
164
+ compare(other: Location): number;
165
+ }
166
+
167
+ /**
168
+ * Copyright 2025 The MOQtail Authors
169
+ *
170
+ * Licensed under the Apache License, Version 2.0 (the "License");
171
+ * you may not use this file except in compliance with the License.
172
+ * You may obtain a copy of the License at
173
+ *
174
+ * http://www.apache.org/licenses/LICENSE-2.0
175
+ *
176
+ * Unless required by applicable law or agreed to in writing, software
177
+ * distributed under the License is distributed on an "AS IS" BASIS,
178
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
179
+ * See the License for the specific language governing permissions and
180
+ * limitations under the License.
181
+ */
182
+
183
+ /**
184
+ * @public
185
+ * Represents a single field in a Tuple, storing a value as a UTF-8 encoded byte array.
186
+ *
187
+ * Used for path segments or protocol fields in MOQT.
188
+ */
189
+ declare class TupleField {
190
+ readonly value: Uint8Array;
191
+ /**
192
+ * The raw value of the field as a byte array.
193
+ */
194
+ constructor(value: Uint8Array);
195
+ /**
196
+ * Creates a TupleField from a UTF-8 string.
197
+ * @param str - The string to encode.
198
+ * @returns A new TupleField containing the encoded value.
199
+ */
200
+ static fromUtf8(str: string): TupleField;
201
+ /**
202
+ * Decodes the field value to a UTF-8 string.
203
+ * @returns The decoded string.
204
+ */
205
+ toUtf8(): string;
206
+ /**
207
+ * Serializes this field to a length-prefixed byte array.
208
+ * @returns The serialized bytes.
209
+ */
210
+ serialize(): Uint8Array;
211
+ /**
212
+ * Deserializes a TupleField from a buffer.
213
+ * @param buf - The buffer to read from.
214
+ * @returns The deserialized TupleField.
215
+ * @throws CastingError if the length cannot be safely cast to number.
216
+ * @throws NotEnoughBytesError if buffer does not contain enough bytes.
217
+ */
218
+ static deserialize(buf: BaseByteBuffer): TupleField;
219
+ }
220
+ /**
221
+ * @public
222
+ * Represents a sequence of TupleFields, typically used for hierarchical paths or protocol tuples in MOQT.
223
+ */
224
+ declare class Tuple {
225
+ readonly fields: TupleField[];
226
+ /**
227
+ * The ordered list of fields in this tuple.
228
+ */
229
+ constructor(fields?: TupleField[]);
230
+ /**
231
+ * Creates a Tuple from a path string, splitting on '/'.
232
+ * @param path - The path string (e.g. '/foo/bar').
233
+ * @returns A Tuple with each segment as a field.
234
+ */
235
+ static fromUtf8Path(path: string): Tuple;
236
+ /**
237
+ * Converts the tuple to a path string, joining fields with '/'.
238
+ * @returns The path string (e.g. '/foo/bar').
239
+ */
240
+ toUtf8Path(): string;
241
+ /**
242
+ * Adds a field to the tuple.
243
+ * @param field - The TupleField to add.
244
+ */
245
+ add(field: TupleField): void;
246
+ /**
247
+ * Gets the field at the specified index.
248
+ * @param index - The field index.
249
+ * @returns The TupleField at the index.
250
+ * @throws Error if no field exists at the index.
251
+ */
252
+ get(index: number): TupleField;
253
+ /**
254
+ * Sets the field at the specified index.
255
+ * @param index - The field index.
256
+ * @param field - The TupleField to set.
257
+ */
258
+ set(index: number, field: TupleField): void;
259
+ /**
260
+ * Clears all fields from the tuple.
261
+ */
262
+ clear(): void;
263
+ /**
264
+ * Serializes the tuple to a FrozenByteBuffer.
265
+ * @returns The serialized buffer.
266
+ */
267
+ serialize(): FrozenByteBuffer;
268
+ /**
269
+ * Deserializes a Tuple from a buffer.
270
+ * @param buf - The buffer to read from.
271
+ * @returns The deserialized Tuple.
272
+ * @throws CastingError if the count cannot be safely cast to number.
273
+ * @throws NotEnoughBytesError if buffer does not contain enough bytes.
274
+ */
275
+ static deserialize(buf: BaseByteBuffer): Tuple;
276
+ /**
277
+ * Checks if this tuple is equal to another.
278
+ * @param other - The other Tuple to compare.
279
+ * @returns True if all fields are equal.
280
+ */
281
+ equals(other: Tuple): boolean;
282
+ }
283
+
284
+ /**
285
+ * Copyright 2025 The MOQtail Authors
286
+ *
287
+ * Licensed under the Apache License, Version 2.0 (the "License");
288
+ * you may not use this file except in compliance with the License.
289
+ * You may obtain a copy of the License at
290
+ *
291
+ * http://www.apache.org/licenses/LICENSE-2.0
292
+ *
293
+ * Unless required by applicable law or agreed to in writing, software
294
+ * distributed under the License is distributed on an "AS IS" BASIS,
295
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
296
+ * See the License for the specific language governing permissions and
297
+ * limitations under the License.
298
+ */
299
+
300
+ /**
301
+ * The maximum allowed length (in bytes) for a ReasonPhrase.
302
+ * @public
303
+ */
304
+ declare const MAX_REASON_PHRASE_LEN = 1024;
305
+ /**
306
+ * Represents a protocol ReasonPhrase, a short UTF-8 string used for error or status reporting.
307
+ * Enforces a maximum byte length and validates encoding.
308
+ *
309
+ * @public
310
+ */
311
+ declare class ReasonPhrase {
312
+ #private;
313
+ /**
314
+ * Constructs a ReasonPhrase, validating UTF-8 encoding and length.
315
+ *
316
+ * @param phrase - The string to use as the reason phrase.
317
+ * @throws {@link InvalidUTF8Error} if encoding fails.
318
+ * @throws {@link LengthExceedsMaxError} if the encoded phrase exceeds {@link MAX_REASON_PHRASE_LEN} bytes.
319
+ * @public
320
+ */
321
+ constructor(phrase: string);
322
+ /**
323
+ * Returns the phrase string.
324
+ * @public
325
+ */
326
+ get phrase(): string;
327
+ /**
328
+ * Serializes the ReasonPhrase into a {@link FrozenByteBuffer} containing:
329
+ * varint(length_of_phrase_bytes) || phrase_bytes
330
+ *
331
+ * @returns The serialized buffer.
332
+ * @public
333
+ */
334
+ serialize(): FrozenByteBuffer;
335
+ /**
336
+ * Deserializes a ReasonPhrase from the given buffer.
337
+ * Reads varint(length) || utf8‑bytes.
338
+ *
339
+ * @param buf - The buffer to read from.
340
+ * @returns The deserialized ReasonPhrase.
341
+ * @throws :{@link CastingError} if the length cannot be safely cast to a number.
342
+ * @throws :{@link LengthExceedsMaxError} if the length exceeds {@link MAX_REASON_PHRASE_LEN}.
343
+ * @throws :{@link NotEnoughBytesError} if the buffer does not contain enough bytes.
344
+ * @throws :{@link InvalidUTF8Error} if decoding fails.
345
+ * @public
346
+ */
347
+ static deserialize(buf: BaseByteBuffer): ReasonPhrase;
348
+ }
349
+
350
+ /**
351
+ * Copyright 2025 The MOQtail Authors
352
+ *
353
+ * Licensed under the Apache License, Version 2.0 (the "License");
354
+ * you may not use this file except in compliance with the License.
355
+ * You may obtain a copy of the License at
356
+ *
357
+ * http://www.apache.org/licenses/LICENSE-2.0
358
+ *
359
+ * Unless required by applicable law or agreed to in writing, software
360
+ * distributed under the License is distributed on an "AS IS" BASIS,
361
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
362
+ * See the License for the specific language governing permissions and
363
+ * limitations under the License.
364
+ */
365
+ /**
366
+ * @public
367
+ * Object datagram types for MOQT objects (Draft-16).
368
+ *
369
+ * Type bit layout (form 0b00X0XXXX):
370
+ * - Bit 0 (0x01): EXTENSIONS - Extensions field present
371
+ * - Bit 1 (0x02): END_OF_GROUP - Last object in group
372
+ * - Bit 2 (0x04): ZERO_OBJECT_ID - Object ID omitted (assumed 0)
373
+ * - Bit 3 (0x08): DEFAULT_PRIORITY - Publisher Priority omitted (inherited)
374
+ * - Bit 5 (0x20): STATUS - Object Status replaces Object Payload
375
+ *
376
+ * Invalid combinations:
377
+ * - STATUS (0x20) + END_OF_GROUP (0x02) together is a PROTOCOL_VIOLATION
378
+ * - Types outside the form 0b00X0XXXX are invalid
379
+ */
380
+ declare enum ObjectDatagramType {
381
+ Type0x00 = 0,
382
+ Type0x01 = 1,
383
+ Type0x02 = 2,
384
+ Type0x03 = 3,
385
+ Type0x04 = 4,
386
+ Type0x05 = 5,
387
+ Type0x06 = 6,
388
+ Type0x07 = 7,
389
+ Type0x08 = 8,
390
+ Type0x09 = 9,
391
+ Type0x0A = 10,
392
+ Type0x0B = 11,
393
+ Type0x0C = 12,
394
+ Type0x0D = 13,
395
+ Type0x0E = 14,
396
+ Type0x0F = 15,
397
+ Type0x20 = 32,
398
+ Type0x21 = 33,
399
+ Type0x24 = 36,
400
+ Type0x25 = 37,
401
+ Type0x28 = 40,
402
+ Type0x29 = 41,
403
+ Type0x2C = 44,
404
+ Type0x2D = 45
405
+ }
406
+ /**
407
+ * @public
408
+ * Namespace for ObjectDatagramType utilities.
409
+ */
410
+ declare namespace ObjectDatagramType {
411
+ /**
412
+ * Converts a number or bigint to ObjectDatagramType.
413
+ * Validates using bitmask: must match form 0b00X0XXXX,
414
+ * and STATUS + END_OF_GROUP cannot both be set.
415
+ * @param value - The value to convert.
416
+ * @returns The corresponding ObjectDatagramType.
417
+ * @throws Error if the value is not valid.
418
+ */
419
+ function tryFrom(value: number | bigint): ObjectDatagramType;
420
+ /**
421
+ * Returns true if the type has extensions (bit 0 set).
422
+ * @param t - The ObjectDatagramType.
423
+ */
424
+ function hasExtensions(t: ObjectDatagramType): boolean;
425
+ /**
426
+ * Returns true if the type indicates End of Group (bit 1 set).
427
+ * @param t - The ObjectDatagramType.
428
+ */
429
+ function isEndOfGroup(t: ObjectDatagramType): boolean;
430
+ /**
431
+ * Returns true if Object ID is absent (bit 2 set).
432
+ * When true, Object ID is omitted and assumed to be 0.
433
+ * @param t - The ObjectDatagramType.
434
+ */
435
+ function isZeroObjectId(t: ObjectDatagramType): boolean;
436
+ /**
437
+ * Returns true if Publisher Priority is omitted (bit 3 set).
438
+ * When true, the priority is inherited from the control message.
439
+ * @param t - The ObjectDatagramType.
440
+ */
441
+ function hasDefaultPriority(t: ObjectDatagramType): boolean;
442
+ /**
443
+ * Returns true if the datagram carries Object Status instead of payload (bit 5 set).
444
+ * @param t - The ObjectDatagramType.
445
+ */
446
+ function isStatus(t: ObjectDatagramType): boolean;
447
+ /**
448
+ * Determines the appropriate type for given properties.
449
+ * @param hasExtensions - Whether extensions are present.
450
+ * @param endOfGroup - Whether this is the last object in the group.
451
+ * @param objectIdIsZero - Whether the objectId is 0.
452
+ * @param defaultPriority - Whether publisher priority is inherited (omitted).
453
+ * @param isStatus - Whether the datagram carries status instead of payload.
454
+ * @throws Error if STATUS and END_OF_GROUP are both true (PROTOCOL_VIOLATION).
455
+ */
456
+ function fromProperties(hasExtensions: boolean, endOfGroup: boolean, objectIdIsZero: boolean, defaultPriority: boolean, isStatus: boolean): ObjectDatagramType;
457
+ }
458
+ /**
459
+ * @public
460
+ * Fetch header types for MOQT fetch requests.
461
+ */
462
+ declare enum FetchHeaderType {
463
+ Type0x05 = 5
464
+ }
465
+ /**
466
+ * Namespace for FetchHeaderType utilities.
467
+ */
468
+ declare namespace FetchHeaderType {
469
+ /**
470
+ * Converts a number or bigint to FetchHeaderType.
471
+ * @param value - The value to convert.
472
+ * @returns The corresponding FetchHeaderType.
473
+ * @throws Error if the value is not valid.
474
+ */
475
+ function tryFrom(value: number | bigint): FetchHeaderType;
476
+ }
477
+ /**
478
+ * @public
479
+ * Subgroup header types for MOQT subgroups.
480
+ *
481
+ * Type bit layout (0b00X1XXXX):
482
+ * - Bit 0 (0x01): EXTENSIONS - Extensions present in all objects
483
+ * - Bits 1-2 (0x06): SUBGROUP_ID_MODE - How subgroup ID is encoded (0b00=zero, 0b01=firstObjId, 0b10=explicit, 0b11=invalid)
484
+ * - Bit 3 (0x08): END_OF_GROUP - This subgroup contains the final object in the group
485
+ * - Bit 4 (0x10): Always set (distinguishes subgroup from other header types)
486
+ * - Bit 5 (0x20): DEFAULT_PRIORITY - Publisher priority field omitted, inherited from subscription
487
+ *
488
+ * Valid ranges: 0x10-0x15, 0x18-0x1D (bit 5=0), 0x30-0x35, 0x38-0x3D (bit 5=1)
489
+ * Invalid: 0x16, 0x17, 0x1E, 0x1F, 0x36, 0x37, 0x3E, 0x3F (SUBGROUP_ID_MODE=0b11)
490
+ */
491
+ declare enum SubgroupHeaderType {
492
+ Type0x10 = 16,
493
+ Type0x11 = 17,
494
+ Type0x12 = 18,
495
+ Type0x13 = 19,
496
+ Type0x14 = 20,
497
+ Type0x15 = 21,
498
+ Type0x18 = 24,
499
+ Type0x19 = 25,
500
+ Type0x1A = 26,
501
+ Type0x1B = 27,
502
+ Type0x1C = 28,
503
+ Type0x1D = 29,
504
+ Type0x30 = 48,
505
+ Type0x31 = 49,
506
+ Type0x32 = 50,
507
+ Type0x33 = 51,
508
+ Type0x34 = 52,
509
+ Type0x35 = 53,
510
+ Type0x38 = 56,
511
+ Type0x39 = 57,
512
+ Type0x3A = 58,
513
+ Type0x3B = 59,
514
+ Type0x3C = 60,
515
+ Type0x3D = 61
516
+ }
517
+ /**
518
+ * Namespace for SubgroupHeaderType utilities and bit constants.
519
+ */
520
+ declare namespace SubgroupHeaderType {
521
+ /** Extensions present in all objects (bit 0) */
522
+ const EXTENSIONS = 1;
523
+ /** Mask for SUBGROUP_ID_MODE (bits 1-2) */
524
+ const SUBGROUP_ID_MODE_MASK = 6;
525
+ /** This subgroup contains the final object in the group (bit 3) */
526
+ const END_OF_GROUP = 8;
527
+ /** Required bit that must always be set (bit 4) */
528
+ const REQUIRED_BIT = 16;
529
+ /** Publisher priority field omitted, inherited from subscription (bit 5) */
530
+ const DEFAULT_PRIORITY = 32;
531
+ function hasExtensions(t: SubgroupHeaderType): boolean;
532
+ function hasExplicitSubgroupId(t: SubgroupHeaderType): boolean;
533
+ function isSubgroupIdZero(t: SubgroupHeaderType): boolean;
534
+ function isSubgroupIdFirstObjectId(t: SubgroupHeaderType): boolean;
535
+ function containsEndOfGroup(t: SubgroupHeaderType): boolean;
536
+ function hasDefaultPriority(t: SubgroupHeaderType): boolean;
537
+ /**
538
+ * Converts a number or bigint to SubgroupHeaderType.
539
+ * Validates bit 4 must be set, SUBGROUP_ID_MODE must not be 0b11.
540
+ */
541
+ function tryFrom(value: number | bigint): SubgroupHeaderType;
542
+ /**
543
+ * Determines the appropriate type for given properties.
544
+ * @param subgroupIdMode - SUBGROUP_ID_MODE (0=zero, 1=firstObjId, 2=explicit).
545
+ */
546
+ function fromProperties(hasExtensions: boolean, subgroupIdMode: 0 | 1 | 2, containsEndOfGroup: boolean, hasDefaultPriority?: boolean): SubgroupHeaderType;
547
+ }
548
+ /**
549
+ * @public
550
+ * Publisher's preferred object delivery mechanism for a track.
551
+ * - `Subgroup`: Use ordered subgroups (reliable).
552
+ * - `Datagram`: Use unreliable datagrams when feasible.
553
+ *
554
+ * The preference is advisory: the relay/transport layer MAY override based on negotiated capabilities.
555
+ */
556
+ declare enum ObjectForwardingPreference {
557
+ Subgroup = "Subgroup",
558
+ Datagram = "Datagram"
559
+ }
560
+ /**
561
+ * Namespace for ObjectForwardingPreference utilities.
562
+ */
563
+ declare namespace ObjectForwardingPreference {
564
+ /**
565
+ * Converts a number, bigint, or string to ObjectForwardingPreference.
566
+ * @param value - The value to convert.
567
+ * @returns The corresponding ObjectForwardingPreference.
568
+ * @throws Error if the value is not valid.
569
+ */
570
+ function tryFrom(value: number | bigint | string): ObjectForwardingPreference;
571
+ }
572
+ /**
573
+ * @public
574
+ * Object status codes for MOQT objects.
575
+ * - `Normal`: Object exists and is available.
576
+ * - `EndOfGroup`: End of group marker.
577
+ * - `EndOfTrack`: End of track marker.
578
+ */
579
+ declare enum ObjectStatus {
580
+ Normal = 0,
581
+ EndOfGroup = 3,
582
+ EndOfTrack = 4
583
+ }
584
+ /**
585
+ * Namespace for ObjectStatus utilities.
586
+ */
587
+ declare namespace ObjectStatus {
588
+ /**
589
+ * Converts a number or bigint to ObjectStatus.
590
+ * @param value - The value to convert.
591
+ * @returns The corresponding ObjectStatus.
592
+ * @throws Error if the value is not valid.
593
+ */
594
+ function tryFrom(value: number | bigint): ObjectStatus;
595
+ }
596
+
597
+ /**
598
+ * Copyright 2026 The MOQtail Authors
599
+ *
600
+ * Licensed under the Apache License, Version 2.0 (the "License");
601
+ * you may not use this file except in compliance with the License.
602
+ * You may obtain a copy of the License at
603
+ *
604
+ * http://www.apache.org/licenses/LICENSE-2.0
605
+ *
606
+ * Unless required by applicable law or agreed to in writing, software
607
+ * distributed under the License is distributed on an "AS IS" BASIS,
608
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
609
+ * See the License for the specific language governing permissions and
610
+ * limitations under the License.
611
+ */
612
+
613
+ /**
614
+ * Represents a unified OBJECT_DATAGRAM message (Draft-16).
615
+ *
616
+ * Type bit layout (form 0b00X0XXXX):
617
+ * - Bit 0 (0x01): EXTENSIONS
618
+ * - Bit 1 (0x02): END_OF_GROUP
619
+ * - Bit 2 (0x04): ZERO_OBJECT_ID
620
+ * - Bit 3 (0x08): DEFAULT_PRIORITY
621
+ * - Bit 5 (0x20): STATUS
622
+ */
623
+ declare class Datagram {
624
+ readonly type: ObjectDatagramType;
625
+ readonly publisherPriority: number | null;
626
+ readonly extensionHeaders: KeyValuePair[] | null;
627
+ readonly payload: Uint8Array | null;
628
+ readonly objectStatus: ObjectStatus | null;
629
+ readonly endOfGroup: boolean;
630
+ readonly trackAlias: bigint;
631
+ readonly location: Location;
632
+ private constructor();
633
+ get groupId(): bigint;
634
+ get objectId(): bigint;
635
+ /**
636
+ * Create a new Datagram with payload content.
637
+ * The type is automatically determined based on the properties.
638
+ */
639
+ static newPayload(trackAlias: bigint, groupId: bigint, objectId: bigint, publisherPriority: number | null, extensionHeaders: KeyValuePair[] | null, payload: Uint8Array, endOfGroup?: boolean): Datagram;
640
+ /**
641
+ * Create a new Datagram with Object Status (no payload).
642
+ * endOfGroup is always false since STATUS + END_OF_GROUP is invalid.
643
+ */
644
+ static newStatus(trackAlias: bigint, groupId: bigint, objectId: bigint, publisherPriority: number | null, extensionHeaders: KeyValuePair[] | null, objectStatus: ObjectStatus): Datagram;
645
+ serialize(): FrozenByteBuffer;
646
+ static deserialize(buf: BaseByteBuffer): Datagram;
647
+ }
648
+
649
+ /**
650
+ * Copyright 2025 The MOQtail Authors
651
+ *
652
+ * Licensed under the Apache License, Version 2.0 (the "License");
653
+ * you may not use this file except in compliance with the License.
654
+ * You may obtain a copy of the License at
655
+ *
656
+ * http://www.apache.org/licenses/LICENSE-2.0
657
+ *
658
+ * Unless required by applicable law or agreed to in writing, software
659
+ * distributed under the License is distributed on an "AS IS" BASIS,
660
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
661
+ * See the License for the specific language governing permissions and
662
+ * limitations under the License.
663
+ */
664
+
665
+ declare class FetchHeader {
666
+ readonly type: FetchHeaderType;
667
+ readonly requestId: bigint;
668
+ constructor(type: FetchHeaderType, requestId: bigint | number);
669
+ serialize(): FrozenByteBuffer;
670
+ static deserialize(buf: BaseByteBuffer): FetchHeader;
671
+ }
672
+
673
+ /**
674
+ * Copyright 2025 The MOQtail Authors
675
+ *
676
+ * Licensed under the Apache License, Version 2.0 (the "License");
677
+ * you may not use this file except in compliance with the License.
678
+ * You may obtain a copy of the License at
679
+ *
680
+ * http://www.apache.org/licenses/LICENSE-2.0
681
+ *
682
+ * Unless required by applicable law or agreed to in writing, software
683
+ * distributed under the License is distributed on an "AS IS" BASIS,
684
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
685
+ * See the License for the specific language governing permissions and
686
+ * limitations under the License.
687
+ */
688
+
689
+ /**
690
+ * Prior-object state threaded across successive Fetch Objects on the same stream.
691
+ */
692
+ type FetchObjectContext = {
693
+ groupId: bigint;
694
+ subgroupId: bigint;
695
+ objectId: bigint;
696
+ publisherPriority: number;
697
+ };
698
+ /**
699
+ * Kind discriminator for End-of-Range markers (§10.4.4.2).
700
+ */
701
+ declare enum EndOfRangeKind {
702
+ NonExistent = 140,
703
+ Unknown = 268
704
+ }
705
+ /**
706
+ * Payload-bearing fetch object (§10.4.4, non-End-of-Range form).
707
+ *
708
+ * Draft-16 FETCH objects carry no Object Status field; a zero-length payload
709
+ * signals a zero-length Normal object.
710
+ */
711
+ declare class FetchObject {
712
+ readonly kind: 'object' | 'end_of_range';
713
+ readonly publisherPriority: number;
714
+ readonly forwardingPreference: ObjectForwardingPreference;
715
+ readonly extensionHeaders: KeyValuePair[] | null;
716
+ readonly payload: Uint8Array | null;
717
+ readonly endOfRange: EndOfRangeKind | null;
718
+ readonly location: Location;
719
+ readonly subgroupId: bigint;
720
+ private constructor();
721
+ get groupId(): bigint;
722
+ get objectId(): bigint;
723
+ /**
724
+ * Context to thread into the next call on this stream.
725
+ * Returns null for EndOfRange markers — they MUST NOT update prior state.
726
+ */
727
+ toContext(): FetchObjectContext | null;
728
+ static newObject(groupId: bigint | number, subgroupId: bigint | number, objectId: bigint | number, publisherPriority: number, forwardingPreference: ObjectForwardingPreference, extensionHeaders: KeyValuePair[] | null, payload: Uint8Array): FetchObject;
729
+ static newEndOfRange(kind: EndOfRangeKind, groupId: bigint | number, objectId: bigint | number): FetchObject;
730
+ serialize(prev?: FetchObjectContext): FrozenByteBuffer;
731
+ static deserialize(buf: BaseByteBuffer, prev?: FetchObjectContext): FetchObject;
732
+ }
733
+
734
+ /**
735
+ * Copyright 2025 The MOQtail Authors
736
+ *
737
+ * Licensed under the Apache License, Version 2.0 (the "License");
738
+ * you may not use this file except in compliance with the License.
739
+ * You may obtain a copy of the License at
740
+ *
741
+ * http://www.apache.org/licenses/LICENSE-2.0
742
+ *
743
+ * Unless required by applicable law or agreed to in writing, software
744
+ * distributed under the License is distributed on an "AS IS" BASIS,
745
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
746
+ * See the License for the specific language governing permissions and
747
+ * limitations under the License.
748
+ */
749
+
750
+ declare const MAX_NAMESPACE_TUPLE_COUNT = 32;
751
+ declare const MAX_FULL_TRACK_NAME_LENGTH = 4096;
752
+ /**
753
+ * Fully-qualified track identifier = hierarchical namespace (tuple) + leaf name bytes.
754
+ *
755
+ * Constraints enforced (throws {@link TrackNameError}):
756
+ * - Namespace tuple field count: 1 .. {@link MAX_NAMESPACE_TUPLE_COUNT} (must not be empty).
757
+ * - Total serialized length (namespace tuple + raw name bytes) less than or equals {@link MAX_FULL_TRACK_NAME_LENGTH} bytes.
758
+ *
759
+ * Namespace input may be:
760
+ * - `string` path with segments separated by `/` (converted via {@link Tuple.fromUtf8Path}). Empty segments are preserved
761
+ * except leading/trailing slashes are treated as empty fields and will be rejected by the length check if result is 0.
762
+ * - Existing {@link Tuple} instance.
763
+ *
764
+ * Name input may be:
765
+ * - UTF-8 string (encoded)
766
+ * - Raw `Uint8Array` (used directly)
767
+ *
768
+ * Instances are created via {@link FullTrackName.tryNew} (validates) or {@link FullTrackName.deserialize}.
769
+ * Use {@link FullTrackName.serialize} for wire encoding and {@link FullTrackName.toString} for a human friendly
770
+ * diagnostic format: `namespace/segments:hexname` (name rendered as lowercase hex, no 0x prefix).
771
+ *
772
+ * The string form is intended for logs/debug only; do not parse it for protocol operations.
773
+ */
774
+ declare class FullTrackName {
775
+ readonly namespace: Tuple;
776
+ readonly name: Uint8Array;
777
+ private constructor();
778
+ /**
779
+ * Human-readable representation: `\<namespace path joined by '/'\>:\<name as lowercase hex\>`.
780
+ * If the underlying {@link Tuple} exposes `toUtf8Path`, it's used; otherwise the raw fields are joined.
781
+ * This is lossy only in the sense that name bytes are hex encoded; round-tripping requires serialization.
782
+ */
783
+ toString(): string;
784
+ /**
785
+ * Construct a validated full track name.
786
+ *
787
+ * Validation steps:
788
+ * 1. Convert namespace string -\> {@link Tuple} (split on '/') if needed.
789
+ * 2. Reject if namespace tuple field count is 0 or \> {@link MAX_NAMESPACE_TUPLE_COUNT}.
790
+ * 3. Encode name string to UTF-8 if needed.
791
+ * 4. Reject if total serialized length (namespace tuple + name bytes) \> {@link MAX_FULL_TRACK_NAME_LENGTH}.
792
+ *
793
+ * @throws :{@link TrackNameError} on any constraint violation.
794
+ * @example
795
+ * ```ts
796
+ * const full = FullTrackName.tryNew('media/video', 'keyframe')
797
+ * console.log(full.toString()) // media/video:6b65796672616d65
798
+ * ```
799
+ */
800
+ static tryNew(namespace: string | Tuple, name: string | Uint8Array): FullTrackName;
801
+ /**
802
+ * Serialize to a frozen buffer: tuple (namespace) followed by length‑prefixed name bytes.
803
+ * Consumers needing raw bytes should call `.toUint8Array()` on the returned {@link FrozenByteBuffer}.
804
+ */
805
+ serialize(): FrozenByteBuffer;
806
+ /**
807
+ * Parse a serialized full track name. Performs the same validations as {@link FullTrackName.tryNew}.
808
+ * The provided buffer's read cursor advances accordingly.
809
+ * @throws :{@link TrackNameError} if constraints are violated.
810
+ */
811
+ static deserialize(buf: BaseByteBuffer): FullTrackName;
812
+ }
813
+
814
+ /**
815
+ * Copyright 2025 The MOQtail Authors
816
+ *
817
+ * Licensed under the Apache License, Version 2.0 (the "License");
818
+ * you may not use this file except in compliance with the License.
819
+ * You may obtain a copy of the License at
820
+ *
821
+ * http://www.apache.org/licenses/LICENSE-2.0
822
+ *
823
+ * Unless required by applicable law or agreed to in writing, software
824
+ * distributed under the License is distributed on an "AS IS" BASIS,
825
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
826
+ * See the License for the specific language governing permissions and
827
+ * limitations under the License.
828
+ */
829
+
830
+ declare class SubgroupObject {
831
+ readonly extensionHeaders: KeyValuePair[] | null;
832
+ readonly objectStatus: ObjectStatus | null;
833
+ readonly payload: Uint8Array | null;
834
+ readonly objectId: bigint;
835
+ private constructor();
836
+ static newWithStatus(objectId: bigint | number, extensionHeaders: KeyValuePair[] | null, objectStatus: ObjectStatus): SubgroupObject;
837
+ static newWithPayload(objectId: bigint | number, extensionHeaders: KeyValuePair[] | null, payload: Uint8Array): SubgroupObject;
838
+ serialize(previousObjectId: bigint | undefined): FrozenByteBuffer;
839
+ static deserialize(buf: BaseByteBuffer, hasExtensions: boolean, previousObjectId: bigint | undefined): SubgroupObject;
840
+ }
841
+
842
+ /**
843
+ * Copyright 2025 The MOQtail Authors
844
+ *
845
+ * Licensed under the Apache License, Version 2.0 (the "License");
846
+ * you may not use this file except in compliance with the License.
847
+ * You may obtain a copy of the License at
848
+ *
849
+ * http://www.apache.org/licenses/LICENSE-2.0
850
+ *
851
+ * Unless required by applicable law or agreed to in writing, software
852
+ * distributed under the License is distributed on an "AS IS" BASIS,
853
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
854
+ * See the License for the specific language governing permissions and
855
+ * limitations under the License.
856
+ */
857
+
858
+ declare class MoqtObject {
859
+ readonly fullTrackName: FullTrackName;
860
+ readonly publisherPriority: number;
861
+ readonly objectForwardingPreference: ObjectForwardingPreference;
862
+ readonly objectStatus: ObjectStatus;
863
+ readonly extensionHeaders: KeyValuePair[] | null;
864
+ readonly payload: Uint8Array | null;
865
+ readonly location: Location;
866
+ readonly subgroupId: bigint | null;
867
+ private constructor();
868
+ get groupId(): bigint;
869
+ get objectId(): bigint;
870
+ getSubgroupHeaderType(containsEnd: boolean, useDefaultPriority?: boolean): SubgroupHeaderType;
871
+ isDatagram(): boolean;
872
+ isSubgroup(): boolean;
873
+ isEndOfGroup(): boolean;
874
+ isEndOfTrack(): boolean;
875
+ hasPayload(): boolean;
876
+ hasStatus(): boolean;
877
+ static newWithPayload(fullTrackName: FullTrackName, location: Location, publisherPriority: number, objectForwardingPreference: ObjectForwardingPreference, subgroupId: bigint | number | null, extensionHeaders: KeyValuePair[] | null, payload: Uint8Array): MoqtObject;
878
+ static newWithStatus(fullTrackName: FullTrackName, location: Location, publisherPriority: number, objectForwardingPreference: ObjectForwardingPreference, subgroupId: bigint | number | null, extensionHeaders: KeyValuePair[] | null, objectStatus: ObjectStatus): MoqtObject;
879
+ /**
880
+ * Create a MoqtObject from a Datagram (Draft-16).
881
+ * @param datagram - The received Datagram.
882
+ * @param fullTrackName - The resolved full track name.
883
+ * @param defaultPriority - The default publisher priority from the control message (used when DEFAULT_PRIORITY bit is set).
884
+ */
885
+ static fromDatagram(datagram: Datagram, fullTrackName: FullTrackName, defaultPriority?: number): MoqtObject;
886
+ /**
887
+ * Returns the endOfGroup flag from the source Datagram.
888
+ * This is separate from ObjectStatus.EndOfGroup - the flag indicates
889
+ * this is the last object in the group even with Normal status.
890
+ */
891
+ static isDatagramEndOfGroup(datagram: Datagram): boolean;
892
+ static fromFetchObject(fetchObject: FetchObject, fullTrackName: FullTrackName): MoqtObject;
893
+ static fromSubgroupObject(subgroupObject: SubgroupObject, groupId: bigint | number, publisherPriority: number | undefined, subgroupId: bigint | number | null, fullTrackName: FullTrackName): MoqtObject;
894
+ /**
895
+ * Convert to Datagram for wire transmission (Draft-16).
896
+ * Automatically creates a payload or status Datagram based on the object's state.
897
+ * @param trackAlias - The track alias to use.
898
+ * @param endOfGroup - Whether this is the last object in the group (only for payload datagrams).
899
+ * @param defaultPriority - If provided and matches this object's priority, the DEFAULT_PRIORITY bit is set.
900
+ */
901
+ tryIntoDatagram(trackAlias: bigint | number, endOfGroup?: boolean, defaultPriority?: number): Datagram;
902
+ tryIntoFetchObject(): FetchObject;
903
+ tryIntoSubgroupObject(): SubgroupObject;
904
+ }
905
+
906
+ /**
907
+ * Copyright 2025 The MOQtail Authors
908
+ *
909
+ * Licensed under the Apache License, Version 2.0 (the "License");
910
+ * you may not use this file except in compliance with the License.
911
+ * You may obtain a copy of the License at
912
+ *
913
+ * http://www.apache.org/licenses/LICENSE-2.0
914
+ *
915
+ * Unless required by applicable law or agreed to in writing, software
916
+ * distributed under the License is distributed on an "AS IS" BASIS,
917
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
918
+ * See the License for the specific language governing permissions and
919
+ * limitations under the License.
920
+ */
921
+
922
+ declare class SubgroupHeader {
923
+ readonly type: SubgroupHeaderType;
924
+ readonly publisherPriority: number | undefined;
925
+ readonly subgroupId: bigint | undefined;
926
+ readonly trackAlias: bigint;
927
+ readonly groupId: bigint;
928
+ constructor(type: SubgroupHeaderType, trackAlias: bigint | number, groupId: bigint | number, subgroupId: bigint | number | undefined, publisherPriority: number | undefined);
929
+ serialize(): FrozenByteBuffer;
930
+ static deserialize(buf: BaseByteBuffer): SubgroupHeader;
931
+ }
932
+
933
+ /**
934
+ * Copyright 2025 The MOQtail Authors
935
+ *
936
+ * Licensed under the Apache License, Version 2.0 (the "License");
937
+ * you may not use this file except in compliance with the License.
938
+ * You may obtain a copy of the License at
939
+ *
940
+ * http://www.apache.org/licenses/LICENSE-2.0
941
+ *
942
+ * Unless required by applicable law or agreed to in writing, software
943
+ * distributed under the License is distributed on an "AS IS" BASIS,
944
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
945
+ * See the License for the specific language governing permissions and
946
+ * limitations under the License.
947
+ */
948
+
949
+ /**
950
+ * A bidirectional map between requestId (bigint) and full track names.
951
+ * Used to efficiently look up either by requestId or by name, enforcing uniqueness.
952
+ *
953
+ * @public
954
+ */
955
+ declare class RequestIdMap {
956
+ private requestIdToName;
957
+ private nameToRequestId;
958
+ /**
959
+ * @public
960
+ * Adds a mapping between a requestId and a full track name.
961
+ *
962
+ * @param requestId - The requestId to associate.
963
+ * @param name - The full track name to associate.
964
+ * @throws :{@link RequestIdError} if the requestId or name is already mapped to a different value.
965
+ */
966
+ addMapping(requestId: bigint, name: FullTrackName): void;
967
+ /**
968
+ * @public
969
+ * Gets the full track name for a given requestId.
970
+ *
971
+ * @param requestId - The requestId to look up.
972
+ * @returns The associated full track name.
973
+ * @throws :{@link RequestIdError} if the requestId does not exist.
974
+ */
975
+ getNameByRequestId(requestId: bigint): FullTrackName;
976
+ /**
977
+ * @public
978
+ * Gets the requestId for a given full track name.
979
+ *
980
+ * @param name - The full track name to look up.
981
+ * @returns The associated requestId.
982
+ * @throws :{@link RequestIdError} if the name does not exist.
983
+ */
984
+ getRequestIdByName(name: FullTrackName): bigint;
985
+ /**
986
+ * @public
987
+ * Removes a mapping by requestId.
988
+ *
989
+ * @param requestId - The requestId to remove.
990
+ * @returns The removed full track name, or undefined if not found.
991
+ */
992
+ removeMappingByRequestId(requestId: bigint): FullTrackName | undefined;
993
+ /**
994
+ * @public
995
+ * Removes a mapping by full track name.
996
+ *
997
+ * @param name - The full track name to remove.
998
+ * @returns The removed requestId, or undefined if not found.
999
+ */
1000
+ removeMappingByName(name: FullTrackName): bigint | undefined;
1001
+ /**
1002
+ * @public
1003
+ * Checks if the map contains a given requestId.
1004
+ *
1005
+ * @param requestId - The requestId to check.
1006
+ * @returns True if the requestId exists, false otherwise.
1007
+ */
1008
+ containsRequestId(requestId: bigint): boolean;
1009
+ /**
1010
+ * @public
1011
+ * Checks if the map contains a given full track name.
1012
+ *
1013
+ * @param name - The full track name to check.
1014
+ * @returns True if the name exists, false otherwise.
1015
+ */
1016
+ containsName(name: FullTrackName): boolean;
1017
+ }
1018
+
1019
+ /**
1020
+ * Copyright 2025 The MOQtail Authors
1021
+ *
1022
+ * Licensed under the Apache License, Version 2.0 (the "License");
1023
+ * you may not use this file except in compliance with the License.
1024
+ * You may obtain a copy of the License at
1025
+ *
1026
+ * http://www.apache.org/licenses/LICENSE-2.0
1027
+ *
1028
+ * Unless required by applicable law or agreed to in writing, software
1029
+ * distributed under the License is distributed on an "AS IS" BASIS,
1030
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1031
+ * See the License for the specific language governing permissions and
1032
+ * limitations under the License.
1033
+ */
1034
+
1035
+ type Header = FetchHeader | SubgroupHeader;
1036
+ declare namespace Header {
1037
+ function newFetch(...args: ConstructorParameters<typeof FetchHeader>): Header;
1038
+ function newSubgroup(...args: ConstructorParameters<typeof SubgroupHeader>): Header;
1039
+ function isFetch(header: Header): header is FetchHeader;
1040
+ function isSubgroup(header: Header): header is SubgroupHeader;
1041
+ function serialize(header: Header): FrozenByteBuffer;
1042
+ function deserialize(buf: BaseByteBuffer): Header;
1043
+ }
1044
+
1045
+ /**
1046
+ * Copyright 2025 The MOQtail Authors
1047
+ *
1048
+ * Licensed under the Apache License, Version 2.0 (the "License");
1049
+ * you may not use this file except in compliance with the License.
1050
+ * You may obtain a copy of the License at
1051
+ *
1052
+ * http://www.apache.org/licenses/LICENSE-2.0
1053
+ *
1054
+ * Unless required by applicable law or agreed to in writing, software
1055
+ * distributed under the License is distributed on an "AS IS" BASIS,
1056
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1057
+ * See the License for the specific language governing permissions and
1058
+ * limitations under the License.
1059
+ */
1060
+
1061
+ declare abstract class BaseByteBuffer {
1062
+ protected buf: Uint8Array;
1063
+ protected view: DataView;
1064
+ protected _offset: number;
1065
+ protected _checkpoint: number;
1066
+ constructor(buf: Uint8Array);
1067
+ get offset(): number;
1068
+ abstract get length(): number;
1069
+ get remaining(): number;
1070
+ /**
1071
+ * Save current read position for potential rollback
1072
+ */
1073
+ checkpoint(): void;
1074
+ /**
1075
+ * Restore read position to last checkpoint
1076
+ */
1077
+ restore(): void;
1078
+ toUint8Array(): Uint8Array;
1079
+ getU8(): number;
1080
+ getU16(): number;
1081
+ getVI(): bigint;
1082
+ getNumberVI(): number;
1083
+ getBytes(len: number): Uint8Array;
1084
+ getLengthPrefixedBytes(): Uint8Array;
1085
+ getKeyValuePair(): KeyValuePair;
1086
+ getReasonPhrase(): ReasonPhrase;
1087
+ getLocation(): Location;
1088
+ getTuple(): Tuple;
1089
+ getFullTrackName(): FullTrackName;
1090
+ }
1091
+ declare class ByteBuffer extends BaseByteBuffer {
1092
+ private _length;
1093
+ constructor(initialSize?: number);
1094
+ get length(): number;
1095
+ /**
1096
+ * Clear all data and reset all positions
1097
+ */
1098
+ clear(): void;
1099
+ /**
1100
+ * Drop all data before current offset and reset positions
1101
+ * This is the key method for memory management - removes processed data
1102
+ */
1103
+ commit(): void;
1104
+ private ensureCapacity;
1105
+ putU8(v: number): void;
1106
+ putU16(v: number): void;
1107
+ /**
1108
+ * Write a variable-length integer (QUIC-style varint)
1109
+ * Encoding:
1110
+ * - 2 MSB = 00: 1 byte (6 bits) for values 0-63
1111
+ * - 2 MSB = 01: 2 bytes (14 bits) for values 0-16383
1112
+ * - 2 MSB = 10: 4 bytes (30 bits) for values 0-1073741823
1113
+ * - 2 MSB = 11: 8 bytes (62 bits) for values 0-4611686018427387903
1114
+ */
1115
+ putVI(v: bigint | number): void;
1116
+ putBytes(src: Uint8Array): void;
1117
+ putLengthPrefixedBytes(src: Uint8Array): void;
1118
+ putKeyValuePair(pair: KeyValuePair): void;
1119
+ putReasonPhrase(reason: ReasonPhrase): void;
1120
+ toUint8Array(): Uint8Array;
1121
+ freeze(): FrozenByteBuffer;
1122
+ putLocation(loc: Location): void;
1123
+ putTuple(tuple: Tuple): void;
1124
+ putFullTrackName(fullTrackName: FullTrackName): void;
1125
+ }
1126
+ declare class FrozenByteBuffer extends BaseByteBuffer {
1127
+ constructor(buf: Uint8Array);
1128
+ get length(): number;
1129
+ }
1130
+
1131
+ /**
1132
+ * Copyright 2025 The MOQtail Authors
1133
+ *
1134
+ * Licensed under the Apache License, Version 2.0 (the "License");
1135
+ * you may not use this file except in compliance with the License.
1136
+ * You may obtain a copy of the License at
1137
+ *
1138
+ * http://www.apache.org/licenses/LICENSE-2.0
1139
+ *
1140
+ * Unless required by applicable law or agreed to in writing, software
1141
+ * distributed under the License is distributed on an "AS IS" BASIS,
1142
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1143
+ * See the License for the specific language governing permissions and
1144
+ * limitations under the License.
1145
+ */
1146
+ /**
1147
+ * Protocol string array exchanged in wt-available-protocols header
1148
+ */
1149
+ declare const SUPPORTED_VERSIONS: string[];
1150
+ /**
1151
+ * @public
1152
+ * Control message types for MOQT protocol.
1153
+ * Each value corresponds to a specific control frame.
1154
+ */
1155
+ declare enum ControlMessageType {
1156
+ ReservedSetupV00 = 1,
1157
+ ReservedClientSetupV10 = 64,
1158
+ ReservedServerSetupV10 = 65,
1159
+ ClientSetup = 32,
1160
+ ServerSetup = 33,
1161
+ GoAway = 16,
1162
+ MaxRequestId = 21,
1163
+ RequestsBlocked = 26,
1164
+ Subscribe = 3,
1165
+ SubscribeOk = 4,
1166
+ RequestError = 5,
1167
+ Unsubscribe = 10,
1168
+ RequestUpdate = 2,
1169
+ PublishDone = 11,
1170
+ Fetch = 22,
1171
+ FetchOk = 24,
1172
+ FetchCancel = 23,
1173
+ TrackStatus = 13,
1174
+ PublishNamespace = 6,
1175
+ RequestOk = 7,
1176
+ Namespace = 8,
1177
+ PublishNamespaceDone = 9,
1178
+ NamespaceDone = 14,
1179
+ PublishNamespaceCancel = 12,
1180
+ SubscribeNamespace = 17,
1181
+ UnsubscribeNamespace = 20,
1182
+ Publish = 29,
1183
+ PublishOk = 30,
1184
+ Switch = 34
1185
+ }
1186
+ /**
1187
+ * Converts a bigint value to a ControlMessageType enum.
1188
+ * @param v - The bigint value.
1189
+ * @returns The corresponding ControlMessageType.
1190
+ * @throws Error if the value is not a valid control message type.
1191
+ */
1192
+ declare function controlMessageTypeFromBigInt(v: bigint): ControlMessageType;
1193
+ /**
1194
+ * @public
1195
+ * Error codes for PublishNamespace control messages.
1196
+ */
1197
+ /**
1198
+ * @public
1199
+ * Subscribe options for SUBSCRIBE_NAMESPACE requests.
1200
+ */
1201
+ declare enum NamespaceSubscribeOptions {
1202
+ PublishOnly = 0,
1203
+ NamespaceOnly = 1,
1204
+ Both = 2
1205
+ }
1206
+ /**
1207
+ * @public
1208
+ * Filter types for subscription requests.
1209
+ */
1210
+ declare enum FilterType {
1211
+ NextGroupStart = 1,
1212
+ LatestObject = 2,
1213
+ AbsoluteStart = 3,
1214
+ AbsoluteRange = 4
1215
+ }
1216
+ /**
1217
+ * Converts a bigint value to a FilterType enum.
1218
+ * @param v - The bigint value.
1219
+ * @returns The corresponding FilterType.
1220
+ * @throws Error if the value is not a valid filter type.
1221
+ */
1222
+ declare function filterTypeFromBigInt(v: bigint): FilterType;
1223
+ /**
1224
+ * @public
1225
+ * Fetch request types for MOQT protocol.
1226
+ */
1227
+ declare enum FetchType {
1228
+ Standalone = 1,
1229
+ Relative = 2,
1230
+ Absolute = 3
1231
+ }
1232
+ /**
1233
+ * Converts a bigint value to a FetchType enum.
1234
+ * @param v - The bigint value.
1235
+ * @returns The corresponding FetchType.
1236
+ * @throws CastingError if the value is not a valid fetch type.
1237
+ */
1238
+ declare function fetchTypeFromBigInt(v: bigint): FetchType;
1239
+ /**
1240
+ * @public
1241
+ * Group ordering options for object delivery.
1242
+ */
1243
+ declare enum GroupOrder {
1244
+ Original = 0,
1245
+ Ascending = 1,
1246
+ Descending = 2
1247
+ }
1248
+ /**
1249
+ * Converts a number value to a GroupOrder enum.
1250
+ * @param v - The number value.
1251
+ * @returns The corresponding GroupOrder.
1252
+ * @throws CastingError if the value is not a valid group order.
1253
+ */
1254
+ declare function groupOrderFromNumber(v: number): GroupOrder;
1255
+ /**
1256
+ * @public
1257
+ * Status codes for track status responses.
1258
+ */
1259
+ declare enum TrackStatusCode {
1260
+ InProgress = 0,
1261
+ DoesNotExist = 1,
1262
+ NotYetBegun = 2,
1263
+ Finished = 3,
1264
+ RelayUnavailable = 4
1265
+ }
1266
+ /**
1267
+ * Converts a bigint value to a TrackStatusCode enum.
1268
+ * @param v - The bigint value.
1269
+ * @returns The corresponding TrackStatusCode.
1270
+ * @throws Error if the value is not a valid track status code.
1271
+ */
1272
+ declare function trackStatusCodeFromBigInt(v: bigint): TrackStatusCode;
1273
+ /**
1274
+ * @public
1275
+ * Status codes for PublishDone control messages.
1276
+ */
1277
+ declare enum PublishDoneStatusCode {
1278
+ InternalError = 0,
1279
+ Unauthorized = 1,
1280
+ TrackEnded = 2,
1281
+ SubscriptionEnded = 3,
1282
+ GoingAway = 4,
1283
+ Expired = 5,
1284
+ TooFarBehind = 6,
1285
+ UpdateFailed = 8,
1286
+ MalformedTrack = 18
1287
+ }
1288
+ /**
1289
+ * Converts a bigint value to a PublishDoneStatusCode enum.
1290
+ * @param v - The bigint value.
1291
+ * @returns The corresponding PublishDoneStatusCode.
1292
+ * @throws Error if the value is not a valid subscribe done status code.
1293
+ */
1294
+ declare function publishDoneStatusCodeFromBigInt(v: bigint): PublishDoneStatusCode;
1295
+ /**
1296
+ * @public
1297
+ * Unified error codes for REQUEST_ERROR control messages.
1298
+ */
1299
+ declare enum RequestErrorCode {
1300
+ InternalError = 0,
1301
+ Unauthorized = 1,
1302
+ Timeout = 2,
1303
+ NotSupported = 3,
1304
+ MalformedAuthToken = 4,
1305
+ ExpiredAuthToken = 5,
1306
+ DoesNotExist = 16,
1307
+ InvalidRange = 17,
1308
+ MalformedTrack = 18,
1309
+ DuplicateSubscription = 25,
1310
+ Uninterested = 32,
1311
+ PrefixOverlap = 48,
1312
+ InvalidJoiningRequestId = 50
1313
+ }
1314
+ /**
1315
+ * Converts a bigint value to a RequestErrorCode enum.
1316
+ * @param v - The bigint value.
1317
+ * @returns The corresponding RequestErrorCode.
1318
+ * @throws CastingError if the value is not a valid request error code.
1319
+ */
1320
+ declare function requestErrorCodeFromBigInt(v: bigint): RequestErrorCode;
1321
+
1322
+ /**
1323
+ * Copyright 2026 The MOQtail Authors
1324
+ *
1325
+ * Licensed under the Apache License, Version 2.0 (the "License");
1326
+ * you may not use this file except in compliance with the License.
1327
+ * You may obtain a copy of the License at
1328
+ *
1329
+ * http://www.apache.org/licenses/LICENSE-2.0
1330
+ *
1331
+ * Unless required by applicable law or agreed to in writing, software
1332
+ * distributed under the License is distributed on an "AS IS" BASIS,
1333
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1334
+ * See the License for the specific language governing permissions and
1335
+ * limitations under the License.
1336
+ */
1337
+ declare enum SetupParameterType {
1338
+ Path = 1,
1339
+ MaxRequestId = 2,
1340
+ AuthorizationToken = 3,
1341
+ MaxAuthTokenCacheSize = 4
1342
+ }
1343
+ declare function setupParameterTypeFromNumber(value: number): SetupParameterType;
1344
+ declare enum MessageParameterType {
1345
+ DeliveryTimeout = 2,
1346
+ AuthorizationToken = 3,
1347
+ Expires = 8,
1348
+ LargestObject = 9,
1349
+ Forward = 16,
1350
+ SubscriberPriority = 32,
1351
+ SubscriptionFilter = 33,
1352
+ GroupOrder = 34,
1353
+ NewGroupRequest = 50
1354
+ }
1355
+ declare function messageParameterTypeFromNumber(value: bigint | number): MessageParameterType;
1356
+ declare enum TokenAliasType {
1357
+ Delete = 0,
1358
+ Register = 1,
1359
+ UseAlias = 2,
1360
+ UseValue = 3
1361
+ }
1362
+ declare function tokenAliasTypeFromNumber(value: number): TokenAliasType;
1363
+
1364
+ /**
1365
+ * Copyright 2025 The MOQtail Authors
1366
+ *
1367
+ * Licensed under the Apache License, Version 2.0 (the "License");
1368
+ * you may not use this file except in compliance with the License.
1369
+ * You may obtain a copy of the License at
1370
+ *
1371
+ * http://www.apache.org/licenses/LICENSE-2.0
1372
+ *
1373
+ * Unless required by applicable law or agreed to in writing, software
1374
+ * distributed under the License is distributed on an "AS IS" BASIS,
1375
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1376
+ * See the License for the specific language governing permissions and
1377
+ * limitations under the License.
1378
+ */
1379
+
1380
+ interface Parameter {
1381
+ toKeyValuePair(): KeyValuePair;
1382
+ }
1383
+
1384
+ /**
1385
+ * Copyright 2026 The MOQtail Authors
1386
+ *
1387
+ * Licensed under the Apache License, Version 2.0 (the "License");
1388
+ * you may not use this file except in compliance with the License.
1389
+ * You may obtain a copy of the License at
1390
+ *
1391
+ * http://www.apache.org/licenses/LICENSE-2.0
1392
+ *
1393
+ * Unless required by applicable law or agreed to in writing, software
1394
+ * distributed under the License is distributed on an "AS IS" BASIS,
1395
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1396
+ * See the License for the specific language governing permissions and
1397
+ * limitations under the License.
1398
+ */
1399
+
1400
+ type AuthTokenVariant = {
1401
+ aliasType: TokenAliasType.Delete;
1402
+ tokenAlias: bigint;
1403
+ } | {
1404
+ aliasType: TokenAliasType.Register;
1405
+ tokenAlias: bigint;
1406
+ tokenType: bigint;
1407
+ tokenValue: Uint8Array;
1408
+ } | {
1409
+ aliasType: TokenAliasType.UseAlias;
1410
+ tokenAlias: bigint;
1411
+ } | {
1412
+ aliasType: TokenAliasType.UseValue;
1413
+ tokenType: bigint;
1414
+ tokenValue: Uint8Array;
1415
+ };
1416
+ declare class AuthorizationToken implements Parameter {
1417
+ readonly variant: AuthTokenVariant;
1418
+ static readonly TYPE = MessageParameterType.AuthorizationToken;
1419
+ private constructor();
1420
+ static newDelete(tokenAlias: bigint | number): AuthorizationToken;
1421
+ static newRegister(tokenAlias: bigint | number, tokenType: bigint | number, tokenValue: Uint8Array): AuthorizationToken;
1422
+ static newUseAlias(tokenAlias: bigint | number): AuthorizationToken;
1423
+ static newUseValue(tokenType: bigint | number, tokenValue: Uint8Array): AuthorizationToken;
1424
+ toKeyValuePair(): KeyValuePair;
1425
+ static fromKeyValuePair(pair: KeyValuePair): AuthorizationToken | undefined;
1426
+ }
1427
+
1428
+ /**
1429
+ * Copyright 2026 The MOQtail Authors
1430
+ *
1431
+ * Licensed under the Apache License, Version 2.0 (the "License");
1432
+ * you may not use this file except in compliance with the License.
1433
+ * You may obtain a copy of the License at
1434
+ *
1435
+ * http://www.apache.org/licenses/LICENSE-2.0
1436
+ *
1437
+ * Unless required by applicable law or agreed to in writing, software
1438
+ * distributed under the License is distributed on an "AS IS" BASIS,
1439
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1440
+ * See the License for the specific language governing permissions and
1441
+ * limitations under the License.
1442
+ */
1443
+
1444
+ /**
1445
+ * Duration in milliseconds the relay SHOULD continue to attempt forwarding Objects.
1446
+ * Value MUST be greater than 0; a value of 0 is a PROTOCOL_VIOLATION.
1447
+ * This parameter is subscription-specific and SHOULD NOT be forwarded upstream
1448
+ * by a relay serving multiple subscriptions for the same track.
1449
+ */
1450
+ declare class DeliveryTimeout implements Parameter {
1451
+ readonly timeout: bigint;
1452
+ static readonly TYPE = MessageParameterType.DeliveryTimeout;
1453
+ constructor(timeout: bigint);
1454
+ toKeyValuePair(): KeyValuePair;
1455
+ static fromKeyValuePair(pair: KeyValuePair): DeliveryTimeout | undefined;
1456
+ }
1457
+
1458
+ /**
1459
+ * Copyright 2026 The MOQtail Authors
1460
+ *
1461
+ * Licensed under the Apache License, Version 2.0 (the "License");
1462
+ * you may not use this file except in compliance with the License.
1463
+ * You may obtain a copy of the License at
1464
+ *
1465
+ * http://www.apache.org/licenses/LICENSE-2.0
1466
+ *
1467
+ * Unless required by applicable law or agreed to in writing, software
1468
+ * distributed under the License is distributed on an "AS IS" BASIS,
1469
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1470
+ * See the License for the specific language governing permissions and
1471
+ * limitations under the License.
1472
+ */
1473
+
1474
+ /**
1475
+ * Time in milliseconds after which the sender will terminate the subscription.
1476
+ * A value of 0 means the subscription does not expire or expires at an unknown time.
1477
+ * The receiver can extend the subscription by sending a REQUEST_UPDATE.
1478
+ */
1479
+ declare class Expires implements Parameter {
1480
+ readonly expires: bigint;
1481
+ static readonly TYPE = MessageParameterType.Expires;
1482
+ constructor(expires: bigint);
1483
+ toKeyValuePair(): KeyValuePair;
1484
+ static fromKeyValuePair(pair: KeyValuePair): Expires | undefined;
1485
+ }
1486
+
1487
+ /**
1488
+ * Copyright 2026 The MOQtail Authors
1489
+ *
1490
+ * Licensed under the Apache License, Version 2.0 (the "License");
1491
+ * you may not use this file except in compliance with the License.
1492
+ * You may obtain a copy of the License at
1493
+ *
1494
+ * http://www.apache.org/licenses/LICENSE-2.0
1495
+ *
1496
+ * Unless required by applicable law or agreed to in writing, software
1497
+ * distributed under the License is distributed on an "AS IS" BASIS,
1498
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1499
+ * See the License for the specific language governing permissions and
1500
+ * limitations under the License.
1501
+ */
1502
+
1503
+ /**
1504
+ * Forwarding state for affected subscriptions.
1505
+ * Allowed wire values: 0 (don't forward) or 1 (forward).
1506
+ * Any other value is a PROTOCOL_VIOLATION.
1507
+ * Default (when omitted) is 1 (forward).
1508
+ */
1509
+ declare class Forward implements Parameter {
1510
+ readonly forward: boolean;
1511
+ static readonly TYPE = MessageParameterType.Forward;
1512
+ constructor(forward: boolean);
1513
+ toKeyValuePair(): KeyValuePair;
1514
+ static fromKeyValuePair(pair: KeyValuePair): Forward | undefined;
1515
+ }
1516
+
1517
+ /**
1518
+ * Copyright 2026 The MOQtail Authors
1519
+ *
1520
+ * Licensed under the Apache License, Version 2.0 (the "License");
1521
+ * you may not use this file except in compliance with the License.
1522
+ * You may obtain a copy of the License at
1523
+ *
1524
+ * http://www.apache.org/licenses/LICENSE-2.0
1525
+ *
1526
+ * Unless required by applicable law or agreed to in writing, software
1527
+ * distributed under the License is distributed on an "AS IS" BASIS,
1528
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1529
+ * See the License for the specific language governing permissions and
1530
+ * limitations under the License.
1531
+ */
1532
+
1533
+ /**
1534
+ * How to prioritize Objects from different groups (Ascending=0x1 or Descending=0x2).
1535
+ * Values outside this range are a PROTOCOL_VIOLATION (Original/0x0 is not a valid wire value).
1536
+ * If omitted from SUBSCRIBE, the publisher's track preference is used.
1537
+ * If omitted from FETCH, Ascending (0x1) is used.
1538
+ */
1539
+ declare class GroupOrderParam implements Parameter {
1540
+ readonly order: GroupOrder.Ascending | GroupOrder.Descending;
1541
+ static readonly TYPE = MessageParameterType.GroupOrder;
1542
+ constructor(order: GroupOrder.Ascending | GroupOrder.Descending);
1543
+ toKeyValuePair(): KeyValuePair;
1544
+ static fromKeyValuePair(pair: KeyValuePair): GroupOrderParam | undefined;
1545
+ }
1546
+
1547
+ /**
1548
+ * Copyright 2026 The MOQtail Authors
1549
+ *
1550
+ * Licensed under the Apache License, Version 2.0 (the "License");
1551
+ * you may not use this file except in compliance with the License.
1552
+ * You may obtain a copy of the License at
1553
+ *
1554
+ * http://www.apache.org/licenses/LICENSE-2.0
1555
+ *
1556
+ * Unless required by applicable law or agreed to in writing, software
1557
+ * distributed under the License is distributed on an "AS IS" BASIS,
1558
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1559
+ * See the License for the specific language governing permissions and
1560
+ * limitations under the License.
1561
+ */
1562
+
1563
+ /**
1564
+ * The largest Location in the Track observed by the sending endpoint.
1565
+ * If omitted from a message, the sending endpoint has not published or
1566
+ * received any Objects in the Track.
1567
+ */
1568
+ declare class LargestObject implements Parameter {
1569
+ readonly location: Location;
1570
+ static readonly TYPE = MessageParameterType.LargestObject;
1571
+ constructor(location: Location);
1572
+ toKeyValuePair(): KeyValuePair;
1573
+ static fromKeyValuePair(pair: KeyValuePair): LargestObject | undefined;
1574
+ }
1575
+
1576
+ /**
1577
+ * Copyright 2026 The MOQtail Authors
1578
+ *
1579
+ * Licensed under the Apache License, Version 2.0 (the "License");
1580
+ * you may not use this file except in compliance with the License.
1581
+ * You may obtain a copy of the License at
1582
+ *
1583
+ * http://www.apache.org/licenses/LICENSE-2.0
1584
+ *
1585
+ * Unless required by applicable law or agreed to in writing, software
1586
+ * distributed under the License is distributed on an "AS IS" BASIS,
1587
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1588
+ * See the License for the specific language governing permissions and
1589
+ * limitations under the License.
1590
+ */
1591
+
1592
+ /**
1593
+ * The largest Group ID in the Track known by the subscriber, plus 1.
1594
+ * A value of 0 indicates the subscriber has no Group information for the Track.
1595
+ * Only valid for tracks with the DYNAMIC_GROUPS extension (value 1).
1596
+ */
1597
+ declare class NewGroupRequest implements Parameter {
1598
+ readonly group: bigint;
1599
+ static readonly TYPE = MessageParameterType.NewGroupRequest;
1600
+ constructor(group: bigint);
1601
+ toKeyValuePair(): KeyValuePair;
1602
+ static fromKeyValuePair(pair: KeyValuePair): NewGroupRequest | undefined;
1603
+ }
1604
+
1605
+ /**
1606
+ * Copyright 2026 The MOQtail Authors
1607
+ *
1608
+ * Licensed under the Apache License, Version 2.0 (the "License");
1609
+ * you may not use this file except in compliance with the License.
1610
+ * You may obtain a copy of the License at
1611
+ *
1612
+ * http://www.apache.org/licenses/LICENSE-2.0
1613
+ *
1614
+ * Unless required by applicable law or agreed to in writing, software
1615
+ * distributed under the License is distributed on an "AS IS" BASIS,
1616
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1617
+ * See the License for the specific language governing permissions and
1618
+ * limitations under the License.
1619
+ */
1620
+
1621
+ /**
1622
+ * Priority of a subscription relative to others in the same session.
1623
+ * Lower numbers have higher priority. Range: 0-255.
1624
+ * Values outside this range are a PROTOCOL_VIOLATION.
1625
+ * Default (when omitted from SUBSCRIBE, PUBLISH_OK, or FETCH) is 128.
1626
+ */
1627
+ declare class SubscriberPriority implements Parameter {
1628
+ readonly priority: number;
1629
+ static readonly TYPE = MessageParameterType.SubscriberPriority;
1630
+ constructor(priority: number);
1631
+ toKeyValuePair(): KeyValuePair;
1632
+ static fromKeyValuePair(pair: KeyValuePair): SubscriberPriority | undefined;
1633
+ }
1634
+
1635
+ /**
1636
+ * Copyright 2026 The MOQtail Authors
1637
+ *
1638
+ * Licensed under the Apache License, Version 2.0 (the "License");
1639
+ * you may not use this file except in compliance with the License.
1640
+ * You may obtain a copy of the License at
1641
+ *
1642
+ * http://www.apache.org/licenses/LICENSE-2.0
1643
+ *
1644
+ * Unless required by applicable law or agreed to in writing, software
1645
+ * distributed under the License is distributed on an "AS IS" BASIS,
1646
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1647
+ * See the License for the specific language governing permissions and
1648
+ * limitations under the License.
1649
+ */
1650
+
1651
+ /**
1652
+ * Length-prefixed Subscription Filter specifying what objects the subscriber wants.
1653
+ * If omitted from SUBSCRIBE or PUBLISH_OK, the subscription is unfiltered (LatestObject).
1654
+ * If omitted from REQUEST_UPDATE, the value is unchanged.
1655
+ */
1656
+ declare class SubscriptionFilter implements Parameter {
1657
+ readonly filterType: FilterType;
1658
+ readonly startLocation?: Location | undefined;
1659
+ readonly endGroup?: bigint | undefined;
1660
+ static readonly TYPE = MessageParameterType.SubscriptionFilter;
1661
+ constructor(filterType: FilterType, startLocation?: Location | undefined, endGroup?: bigint | undefined);
1662
+ toKeyValuePair(): KeyValuePair;
1663
+ static fromKeyValuePair(pair: KeyValuePair): SubscriptionFilter | undefined;
1664
+ }
1665
+
1666
+ /**
1667
+ * Copyright 2026 The MOQtail Authors
1668
+ *
1669
+ * Licensed under the Apache License, Version 2.0 (the "License");
1670
+ * you may not use this file except in compliance with the License.
1671
+ * You may obtain a copy of the License at
1672
+ *
1673
+ * http://www.apache.org/licenses/LICENSE-2.0
1674
+ *
1675
+ * Unless required by applicable law or agreed to in writing, software
1676
+ * distributed under the License is distributed on an "AS IS" BASIS,
1677
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1678
+ * See the License for the specific language governing permissions and
1679
+ * limitations under the License.
1680
+ */
1681
+
1682
+ type MessageParameter = DeliveryTimeout | AuthorizationToken | Expires | LargestObject | Forward | SubscriberPriority | GroupOrderParam | SubscriptionFilter | NewGroupRequest;
1683
+ declare namespace MessageParameter {
1684
+ /**
1685
+ * Parses a single KeyValuePair into a MessageParameter.
1686
+ * Returns undefined for unrecognized parameter types (be forgiving).
1687
+ * Still throws ProtocolViolationError for known types with invalid values.
1688
+ */
1689
+ function fromKeyValuePair(pair: KeyValuePair): MessageParameter | undefined;
1690
+ function toKeyValuePair(param: MessageParameter): KeyValuePair;
1691
+ function isDeliveryTimeout(param: MessageParameter): param is DeliveryTimeout;
1692
+ function isAuthorizationToken(param: MessageParameter): param is AuthorizationToken;
1693
+ function isExpires(param: MessageParameter): param is Expires;
1694
+ function isLargestObject(param: MessageParameter): param is LargestObject;
1695
+ function isForward(param: MessageParameter): param is Forward;
1696
+ function isSubscriberPriority(param: MessageParameter): param is SubscriberPriority;
1697
+ function isGroupOrderParam(param: MessageParameter): param is GroupOrderParam;
1698
+ function isSubscriptionFilter(param: MessageParameter): param is SubscriptionFilter;
1699
+ function isNewGroupRequest(param: MessageParameter): param is NewGroupRequest;
1700
+ }
1701
+ /**
1702
+ * Builder for constructing a list of MessageParameters.
1703
+ * Mirrors the SetupParameters builder pattern.
1704
+ */
1705
+ declare class MessageParameters {
1706
+ private params;
1707
+ add(param: MessageParameter): this;
1708
+ addDeliveryTimeout(timeout: bigint | number): this;
1709
+ addAuthorizationToken(token: AuthorizationToken): this;
1710
+ addExpires(expires: bigint | number): this;
1711
+ addForward(forward: boolean): this;
1712
+ addSubscriberPriority(priority: number): this;
1713
+ addGroupOrder(order: GroupOrderParam['order']): this;
1714
+ addSubscriptionFilter(filter: SubscriptionFilter): this;
1715
+ addNewGroupRequest(group: bigint | number): this;
1716
+ build(): MessageParameter[];
1717
+ /**
1718
+ * Parses an array of KeyValuePairs into a list of MessageParameters.
1719
+ * Unrecognized parameter types are silently skipped.
1720
+ * Known parameter types with invalid values still throw ProtocolViolationError.
1721
+ */
1722
+ static fromKeyValuePairs(pairs: KeyValuePair[]): MessageParameter[];
1723
+ }
1724
+ /**
1725
+ * Applies a set of parameter updates to an existing parameter list.
1726
+ * For each update, replaces the matching parameter (by wire type value) or appends it.
1727
+ * Per spec: "If omitted from REQUEST_UPDATE/SUBSCRIBE_UPDATE, the value is unchanged."
1728
+ */
1729
+ declare function applyMessageParameterUpdate(current: MessageParameter[], updates: MessageParameter[]): void;
1730
+
1731
+ /**
1732
+ * Copyright 2025 The MOQtail Authors
1733
+ *
1734
+ * Licensed under the Apache License, Version 2.0 (the "License");
1735
+ * you may not use this file except in compliance with the License.
1736
+ * You may obtain a copy of the License at
1737
+ *
1738
+ * http://www.apache.org/licenses/LICENSE-2.0
1739
+ *
1740
+ * Unless required by applicable law or agreed to in writing, software
1741
+ * distributed under the License is distributed on an "AS IS" BASIS,
1742
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1743
+ * See the License for the specific language governing permissions and
1744
+ * limitations under the License.
1745
+ */
1746
+
1747
+ /**
1748
+ * Represents a protocol PublishNamespace message, used to announce a track and its parameters.
1749
+ *
1750
+ * @public
1751
+ */
1752
+ declare class PublishNamespace {
1753
+ readonly requestId: bigint;
1754
+ readonly trackNamespace: Tuple;
1755
+ readonly parameters: MessageParameter[];
1756
+ /**
1757
+ * @public
1758
+ * Constructs a PublishNamespace message.
1759
+ *
1760
+ * @param requestId - The request ID for this publish namespace message.
1761
+ * @param trackNamespace - The track namespace as a Tuple.
1762
+ * @param parameters - The list of strongly-typed message parameters for the track.
1763
+ */
1764
+ constructor(requestId: bigint, trackNamespace: Tuple, parameters: MessageParameter[]);
1765
+ /**
1766
+ * @public
1767
+ * Gets the message type for this PublishNamespace message.
1768
+ *
1769
+ * @returns The ControlMessageType.PublishNamespace value.
1770
+ */
1771
+ getType(): ControlMessageType;
1772
+ /**
1773
+ * @public
1774
+ * Serializes the PublishNamespace message into a {@link FrozenByteBuffer}.
1775
+ *
1776
+ * @returns The serialized buffer.
1777
+ * @throws :{@link LengthExceedsMaxError} If the payload exceeds 65535 bytes.
1778
+ */
1779
+ serialize(): FrozenByteBuffer;
1780
+ /**
1781
+ * @public
1782
+ * Parses a PublishNamespace message from the given buffer.
1783
+ *
1784
+ * @param buf - The buffer to parse from.
1785
+ * @returns The parsed PublishNamespace message.
1786
+ * @throws :{@link NotEnoughBytesError} If the buffer does not contain enough bytes.
1787
+ */
1788
+ static parsePayload(buf: BaseByteBuffer): PublishNamespace;
1789
+ }
1790
+
1791
+ /**
1792
+ * Copyright 2025 The MOQtail Authors
1793
+ *
1794
+ * Licensed under the Apache License, Version 2.0 (the "License");
1795
+ * you may not use this file except in compliance with the License.
1796
+ * You may obtain a copy of the License at
1797
+ *
1798
+ * http://www.apache.org/licenses/LICENSE-2.0
1799
+ *
1800
+ * Unless required by applicable law or agreed to in writing, software
1801
+ * distributed under the License is distributed on an "AS IS" BASIS,
1802
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1803
+ * See the License for the specific language governing permissions and
1804
+ * limitations under the License.
1805
+ */
1806
+
1807
+ declare class PublishNamespaceCancel {
1808
+ readonly requestId: bigint;
1809
+ readonly errorCode: RequestErrorCode;
1810
+ readonly reasonPhrase: ReasonPhrase;
1811
+ constructor(requestId: bigint, errorCode: RequestErrorCode, reasonPhrase: ReasonPhrase);
1812
+ getType(): ControlMessageType;
1813
+ serialize(): FrozenByteBuffer;
1814
+ static parsePayload(buf: BaseByteBuffer): PublishNamespaceCancel;
1815
+ }
1816
+
1817
+ /**
1818
+ * Copyright 2025 The MOQtail Authors
1819
+ *
1820
+ * Licensed under the Apache License, Version 2.0 (the "License");
1821
+ * you may not use this file except in compliance with the License.
1822
+ * You may obtain a copy of the License at
1823
+ *
1824
+ * http://www.apache.org/licenses/LICENSE-2.0
1825
+ *
1826
+ * Unless required by applicable law or agreed to in writing, software
1827
+ * distributed under the License is distributed on an "AS IS" BASIS,
1828
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1829
+ * See the License for the specific language governing permissions and
1830
+ * limitations under the License.
1831
+ */
1832
+
1833
+ /**
1834
+ * @public
1835
+ * Represents a NAMESPACE message sent on a SUBSCRIBE_NAMESPACE bi-stream.
1836
+ * Carries the namespace suffix (fields after the subscriber's prefix).
1837
+ */
1838
+ declare class Namespace {
1839
+ readonly trackNamespaceSuffix: Tuple;
1840
+ constructor(trackNamespaceSuffix: Tuple);
1841
+ getType(): ControlMessageType;
1842
+ serialize(): FrozenByteBuffer;
1843
+ static parsePayload(buf: BaseByteBuffer): Namespace;
1844
+ }
1845
+
1846
+ /**
1847
+ * Copyright 2025 The MOQtail Authors
1848
+ *
1849
+ * Licensed under the Apache License, Version 2.0 (the "License");
1850
+ * you may not use this file except in compliance with the License.
1851
+ * You may obtain a copy of the License at
1852
+ *
1853
+ * http://www.apache.org/licenses/LICENSE-2.0
1854
+ *
1855
+ * Unless required by applicable law or agreed to in writing, software
1856
+ * distributed under the License is distributed on an "AS IS" BASIS,
1857
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1858
+ * See the License for the specific language governing permissions and
1859
+ * limitations under the License.
1860
+ */
1861
+
1862
+ /**
1863
+ * @public
1864
+ * Represents a NAMESPACE_DONE message sent on a SUBSCRIBE_NAMESPACE bi-stream.
1865
+ * Signals that a previously announced namespace suffix is no longer available.
1866
+ */
1867
+ declare class NamespaceDone {
1868
+ readonly trackNamespaceSuffix: Tuple;
1869
+ constructor(trackNamespaceSuffix: Tuple);
1870
+ getType(): ControlMessageType;
1871
+ serialize(): FrozenByteBuffer;
1872
+ static parsePayload(buf: BaseByteBuffer): NamespaceDone;
1873
+ }
1874
+
1875
+ /**
1876
+ * Copyright 2025 The MOQtail Authors
1877
+ *
1878
+ * Licensed under the Apache License, Version 2.0 (the "License");
1879
+ * you may not use this file except in compliance with the License.
1880
+ * You may obtain a copy of the License at
1881
+ *
1882
+ * http://www.apache.org/licenses/LICENSE-2.0
1883
+ *
1884
+ * Unless required by applicable law or agreed to in writing, software
1885
+ * distributed under the License is distributed on an "AS IS" BASIS,
1886
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1887
+ * See the License for the specific language governing permissions and
1888
+ * limitations under the License.
1889
+ */
1890
+
1891
+ declare class ClientSetup {
1892
+ readonly setupParameters: KeyValuePair[];
1893
+ constructor(setupParameters: KeyValuePair[]);
1894
+ getType(): ControlMessageType;
1895
+ serialize(): FrozenByteBuffer;
1896
+ static parsePayload(buf: BaseByteBuffer): ClientSetup;
1897
+ }
1898
+
1899
+ /**
1900
+ * Copyright 2025 The MOQtail Authors
1901
+ *
1902
+ * Licensed under the Apache License, Version 2.0 (the "License");
1903
+ * you may not use this file except in compliance with the License.
1904
+ * You may obtain a copy of the License at
1905
+ *
1906
+ * http://www.apache.org/licenses/LICENSE-2.0
1907
+ *
1908
+ * Unless required by applicable law or agreed to in writing, software
1909
+ * distributed under the License is distributed on an "AS IS" BASIS,
1910
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1911
+ * See the License for the specific language governing permissions and
1912
+ * limitations under the License.
1913
+ */
1914
+
1915
+ declare class Fetch {
1916
+ readonly requestId: bigint;
1917
+ readonly typeAndProps: {
1918
+ readonly type: FetchType.Standalone;
1919
+ readonly props: {
1920
+ fullTrackName: FullTrackName;
1921
+ startLocation: Location;
1922
+ endLocation: Location;
1923
+ };
1924
+ } | {
1925
+ readonly type: FetchType.Relative;
1926
+ readonly props: {
1927
+ joiningRequestId: bigint;
1928
+ joiningStart: bigint;
1929
+ };
1930
+ } | {
1931
+ readonly type: FetchType.Absolute;
1932
+ readonly props: {
1933
+ joiningRequestId: bigint;
1934
+ joiningStart: bigint;
1935
+ };
1936
+ };
1937
+ readonly parameters: MessageParameter[];
1938
+ constructor(requestId: bigint, typeAndProps: {
1939
+ readonly type: FetchType.Standalone;
1940
+ readonly props: {
1941
+ fullTrackName: FullTrackName;
1942
+ startLocation: Location;
1943
+ endLocation: Location;
1944
+ };
1945
+ } | {
1946
+ readonly type: FetchType.Relative;
1947
+ readonly props: {
1948
+ joiningRequestId: bigint;
1949
+ joiningStart: bigint;
1950
+ };
1951
+ } | {
1952
+ readonly type: FetchType.Absolute;
1953
+ readonly props: {
1954
+ joiningRequestId: bigint;
1955
+ joiningStart: bigint;
1956
+ };
1957
+ }, parameters: MessageParameter[]);
1958
+ getType(): ControlMessageType;
1959
+ serialize(): FrozenByteBuffer;
1960
+ static parsePayload(buf: BaseByteBuffer): Fetch;
1961
+ }
1962
+
1963
+ /**
1964
+ * Copyright 2025 The MOQtail Authors
1965
+ *
1966
+ * Licensed under the Apache License, Version 2.0 (the "License");
1967
+ * you may not use this file except in compliance with the License.
1968
+ * You may obtain a copy of the License at
1969
+ *
1970
+ * http://www.apache.org/licenses/LICENSE-2.0
1971
+ *
1972
+ * Unless required by applicable law or agreed to in writing, software
1973
+ * distributed under the License is distributed on an "AS IS" BASIS,
1974
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1975
+ * See the License for the specific language governing permissions and
1976
+ * limitations under the License.
1977
+ */
1978
+
1979
+ declare class FetchCancel {
1980
+ readonly requestId: bigint;
1981
+ constructor(requestId: bigint | number);
1982
+ getType(): ControlMessageType;
1983
+ serialize(): FrozenByteBuffer;
1984
+ static parsePayload(buf: BaseByteBuffer): FetchCancel;
1985
+ }
1986
+
1987
+ /**
1988
+ * Copyright 2025 The MOQtail Authors
1989
+ *
1990
+ * Licensed under the Apache License, Version 2.0 (the "License");
1991
+ * you may not use this file except in compliance with the License.
1992
+ * You may obtain a copy of the License at
1993
+ *
1994
+ * http://www.apache.org/licenses/LICENSE-2.0
1995
+ *
1996
+ * Unless required by applicable law or agreed to in writing, software
1997
+ * distributed under the License is distributed on an "AS IS" BASIS,
1998
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1999
+ * See the License for the specific language governing permissions and
2000
+ * limitations under the License.
2001
+ */
2002
+ declare enum LOCHeaderExtensionId {
2003
+ CaptureTimestamp = 2,
2004
+ VideoFrameMarking = 4,
2005
+ AudioLevel = 6,
2006
+ VideoConfig = 13
2007
+ }
2008
+ declare enum TrackExtensionType {
2009
+ DeliveryTimeout = 2,
2010
+ MaxCacheDuration = 4,
2011
+ ImmutableExtensions = 11,
2012
+ DefaultPublisherPriority = 14,
2013
+ DefaultPublisherGroupOrder = 34,
2014
+ DynamicGroups = 48,
2015
+ PriorGroupIdGap = 60,
2016
+ PriorObjectIdGap = 62
2017
+ }
2018
+ declare function locHeaderExtensionIdFromNumber(value: number): LOCHeaderExtensionId;
2019
+
2020
+ /**
2021
+ * Copyright 2026 The MOQtail Authors
2022
+ *
2023
+ * Licensed under the Apache License, Version 2.0 (the "License");
2024
+ * you may not use this file except in compliance with the License.
2025
+ * You may obtain a copy of the License at
2026
+ *
2027
+ * http://www.apache.org/licenses/LICENSE-2.0
2028
+ *
2029
+ * Unless required by applicable law or agreed to in writing, software
2030
+ * distributed under the License is distributed on an "AS IS" BASIS,
2031
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2032
+ * See the License for the specific language governing permissions and
2033
+ * limitations under the License.
2034
+ */
2035
+
2036
+ declare class DeliveryTimeoutExtension {
2037
+ readonly timeoutMs: bigint;
2038
+ static readonly TYPE = TrackExtensionType.DeliveryTimeout;
2039
+ constructor(timeoutMs: bigint);
2040
+ toKeyValuePair(): KeyValuePair;
2041
+ static fromKeyValuePair(pair: KeyValuePair): DeliveryTimeoutExtension | undefined;
2042
+ }
2043
+ declare class MaxCacheDurationExtension {
2044
+ readonly durationMs: bigint;
2045
+ static readonly TYPE = TrackExtensionType.MaxCacheDuration;
2046
+ constructor(durationMs: bigint);
2047
+ toKeyValuePair(): KeyValuePair;
2048
+ static fromKeyValuePair(pair: KeyValuePair): MaxCacheDurationExtension | undefined;
2049
+ }
2050
+ declare class ImmutableExtensionsExtension {
2051
+ readonly extensions: KeyValuePair[];
2052
+ static readonly TYPE = TrackExtensionType.ImmutableExtensions;
2053
+ constructor(extensions: KeyValuePair[]);
2054
+ toKeyValuePair(): KeyValuePair;
2055
+ static fromKeyValuePair(pair: KeyValuePair): ImmutableExtensionsExtension | undefined;
2056
+ }
2057
+ declare class DefaultPublisherPriorityExtension {
2058
+ readonly priority: number;
2059
+ static readonly TYPE = TrackExtensionType.DefaultPublisherPriority;
2060
+ constructor(priority: number);
2061
+ toKeyValuePair(): KeyValuePair;
2062
+ static fromKeyValuePair(pair: KeyValuePair): DefaultPublisherPriorityExtension | undefined;
2063
+ }
2064
+ declare class DefaultPublisherGroupOrderExtension {
2065
+ readonly order: GroupOrder;
2066
+ static readonly TYPE = TrackExtensionType.DefaultPublisherGroupOrder;
2067
+ constructor(order: GroupOrder);
2068
+ toKeyValuePair(): KeyValuePair;
2069
+ static fromKeyValuePair(pair: KeyValuePair): DefaultPublisherGroupOrderExtension | undefined;
2070
+ }
2071
+ declare class DynamicGroupsExtension {
2072
+ readonly enabled: boolean;
2073
+ static readonly TYPE = TrackExtensionType.DynamicGroups;
2074
+ constructor(enabled: boolean);
2075
+ toKeyValuePair(): KeyValuePair;
2076
+ static fromKeyValuePair(pair: KeyValuePair): DynamicGroupsExtension | undefined;
2077
+ }
2078
+ declare class UnknownTrackExtension {
2079
+ readonly kvp: KeyValuePair;
2080
+ constructor(kvp: KeyValuePair);
2081
+ toKeyValuePair(): KeyValuePair;
2082
+ }
2083
+ type TrackExtension = DeliveryTimeoutExtension | MaxCacheDurationExtension | ImmutableExtensionsExtension | DefaultPublisherPriorityExtension | DefaultPublisherGroupOrderExtension | DynamicGroupsExtension | UnknownTrackExtension;
2084
+ declare namespace TrackExtension {
2085
+ function fromKeyValuePair(pair: KeyValuePair): TrackExtension;
2086
+ function toKeyValuePair(ext: TrackExtension): KeyValuePair;
2087
+ function deserializeAll(buf: BaseByteBuffer): TrackExtension[];
2088
+ function serializeInto(exts: TrackExtension[], payload: ByteBuffer): void;
2089
+ function isDeliveryTimeout(ext: TrackExtension): ext is DeliveryTimeoutExtension;
2090
+ function isMaxCacheDuration(ext: TrackExtension): ext is MaxCacheDurationExtension;
2091
+ function isImmutableExtensions(ext: TrackExtension): ext is ImmutableExtensionsExtension;
2092
+ function isDefaultPublisherPriority(ext: TrackExtension): ext is DefaultPublisherPriorityExtension;
2093
+ function isDefaultPublisherGroupOrder(ext: TrackExtension): ext is DefaultPublisherGroupOrderExtension;
2094
+ function isDynamicGroups(ext: TrackExtension): ext is DynamicGroupsExtension;
2095
+ function isUnknown(ext: TrackExtension): ext is UnknownTrackExtension;
2096
+ }
2097
+
2098
+ /**
2099
+ * Copyright 2025 The MOQtail Authors
2100
+ *
2101
+ * Licensed under the Apache License, Version 2.0 (the "License");
2102
+ * you may not use this file except in compliance with the License.
2103
+ * You may obtain a copy of the License at
2104
+ *
2105
+ * http://www.apache.org/licenses/LICENSE-2.0
2106
+ *
2107
+ * Unless required by applicable law or agreed to in writing, software
2108
+ * distributed under the License is distributed on an "AS IS" BASIS,
2109
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2110
+ * See the License for the specific language governing permissions and
2111
+ * limitations under the License.
2112
+ */
2113
+
2114
+ declare class FetchOk {
2115
+ readonly requestId: bigint;
2116
+ readonly endOfTrack: boolean;
2117
+ readonly endLocation: Location;
2118
+ readonly parameters: MessageParameter[];
2119
+ readonly trackExtensions: TrackExtension[];
2120
+ constructor(requestId: bigint, endOfTrack: boolean, endLocation: Location, parameters: MessageParameter[], trackExtensions?: TrackExtension[]);
2121
+ serialize(): FrozenByteBuffer;
2122
+ static parsePayload(buf: BaseByteBuffer): FetchOk;
2123
+ }
2124
+
2125
+ /**
2126
+ * Copyright 2025 The MOQtail Authors
2127
+ *
2128
+ * Licensed under the Apache License, Version 2.0 (the "License");
2129
+ * you may not use this file except in compliance with the License.
2130
+ * You may obtain a copy of the License at
2131
+ *
2132
+ * http://www.apache.org/licenses/LICENSE-2.0
2133
+ *
2134
+ * Unless required by applicable law or agreed to in writing, software
2135
+ * distributed under the License is distributed on an "AS IS" BASIS,
2136
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2137
+ * See the License for the specific language governing permissions and
2138
+ * limitations under the License.
2139
+ */
2140
+
2141
+ declare class GoAway {
2142
+ newSessionUri?: string | undefined;
2143
+ constructor(newSessionUri?: string);
2144
+ static getType(): ControlMessageType;
2145
+ serialize(): FrozenByteBuffer;
2146
+ static parsePayload(buf: BaseByteBuffer): GoAway;
2147
+ }
2148
+
2149
+ /**
2150
+ * Copyright 2025 The MOQtail Authors
2151
+ *
2152
+ * Licensed under the Apache License, Version 2.0 (the "License");
2153
+ * you may not use this file except in compliance with the License.
2154
+ * You may obtain a copy of the License at
2155
+ *
2156
+ * http://www.apache.org/licenses/LICENSE-2.0
2157
+ *
2158
+ * Unless required by applicable law or agreed to in writing, software
2159
+ * distributed under the License is distributed on an "AS IS" BASIS,
2160
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2161
+ * See the License for the specific language governing permissions and
2162
+ * limitations under the License.
2163
+ */
2164
+
2165
+ declare class MaxRequestId$1 {
2166
+ readonly maxRequestId: bigint;
2167
+ constructor(maxRequestId: bigint | number);
2168
+ getType(): ControlMessageType;
2169
+ serialize(): FrozenByteBuffer;
2170
+ static parsePayload(buf: BaseByteBuffer): MaxRequestId$1;
2171
+ }
2172
+
2173
+ /**
2174
+ * Copyright 2025 The MOQtail Authors
2175
+ *
2176
+ * Licensed under the Apache License, Version 2.0 (the "License");
2177
+ * you may not use this file except in compliance with the License.
2178
+ * You may obtain a copy of the License at
2179
+ *
2180
+ * http://www.apache.org/licenses/LICENSE-2.0
2181
+ *
2182
+ * Unless required by applicable law or agreed to in writing, software
2183
+ * distributed under the License is distributed on an "AS IS" BASIS,
2184
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2185
+ * See the License for the specific language governing permissions and
2186
+ * limitations under the License.
2187
+ */
2188
+
2189
+ declare class ServerSetup {
2190
+ readonly setupParameters: KeyValuePair[];
2191
+ constructor(setupParameters: KeyValuePair[]);
2192
+ getType(): ControlMessageType;
2193
+ serialize(): FrozenByteBuffer;
2194
+ static parsePayload(buf: BaseByteBuffer): ServerSetup;
2195
+ }
2196
+
2197
+ /**
2198
+ * Copyright 2025 The MOQtail Authors
2199
+ *
2200
+ * Licensed under the Apache License, Version 2.0 (the "License");
2201
+ * you may not use this file except in compliance with the License.
2202
+ * You may obtain a copy of the License at
2203
+ *
2204
+ * http://www.apache.org/licenses/LICENSE-2.0
2205
+ *
2206
+ * Unless required by applicable law or agreed to in writing, software
2207
+ * distributed under the License is distributed on an "AS IS" BASIS,
2208
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2209
+ * See the License for the specific language governing permissions and
2210
+ * limitations under the License.
2211
+ */
2212
+
2213
+ declare class Subscribe {
2214
+ requestId: bigint;
2215
+ fullTrackName: FullTrackName;
2216
+ parameters: MessageParameter[];
2217
+ private constructor();
2218
+ static newNextGroupStart(requestId: bigint, fullTrackName: FullTrackName, parameters: MessageParameter[]): Subscribe;
2219
+ static newLatestObject(requestId: bigint, fullTrackName: FullTrackName, parameters: MessageParameter[]): Subscribe;
2220
+ static newAbsoluteStart(requestId: bigint, fullTrackName: FullTrackName, startLocation: Location, parameters: MessageParameter[]): Subscribe;
2221
+ static newAbsoluteRange(requestId: bigint, fullTrackName: FullTrackName, startLocation: Location, endGroup: bigint, parameters: MessageParameter[]): Subscribe;
2222
+ serialize(): FrozenByteBuffer;
2223
+ static parsePayload(buf: BaseByteBuffer): Subscribe;
2224
+ }
2225
+
2226
+ /**
2227
+ * Copyright 2025 The MOQtail Authors
2228
+ *
2229
+ * Licensed under the Apache License, Version 2.0 (the "License");
2230
+ * you may not use this file except in compliance with the License.
2231
+ * You may obtain a copy of the License at
2232
+ *
2233
+ * http://www.apache.org/licenses/LICENSE-2.0
2234
+ *
2235
+ * Unless required by applicable law or agreed to in writing, software
2236
+ * distributed under the License is distributed on an "AS IS" BASIS,
2237
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2238
+ * See the License for the specific language governing permissions and
2239
+ * limitations under the License.
2240
+ */
2241
+
2242
+ declare class PublishDone {
2243
+ readonly requestId: bigint;
2244
+ readonly statusCode: PublishDoneStatusCode;
2245
+ readonly streamCount: bigint;
2246
+ readonly errorReason: ReasonPhrase;
2247
+ constructor(requestId: bigint, statusCode: PublishDoneStatusCode, streamCount: bigint, errorReason: ReasonPhrase);
2248
+ static new(requestId: bigint | number, statusCode: PublishDoneStatusCode, streamCount: bigint, errorReason: ReasonPhrase): PublishDone;
2249
+ getType(): ControlMessageType;
2250
+ serialize(): FrozenByteBuffer;
2251
+ static parsePayload(buf: BaseByteBuffer): PublishDone;
2252
+ }
2253
+
2254
+ /**
2255
+ * Copyright 2025 The MOQtail Authors
2256
+ *
2257
+ * Licensed under the Apache License, Version 2.0 (the "License");
2258
+ * you may not use this file except in compliance with the License.
2259
+ * You may obtain a copy of the License at
2260
+ *
2261
+ * http://www.apache.org/licenses/LICENSE-2.0
2262
+ *
2263
+ * Unless required by applicable law or agreed to in writing, software
2264
+ * distributed under the License is distributed on an "AS IS" BASIS,
2265
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2266
+ * See the License for the specific language governing permissions and
2267
+ * limitations under the License.
2268
+ */
2269
+
2270
+ declare class Publish {
2271
+ readonly requestId: bigint;
2272
+ readonly fullTrackName: FullTrackName;
2273
+ readonly trackAlias: bigint;
2274
+ readonly parameters: MessageParameter[];
2275
+ readonly trackExtensions: TrackExtension[];
2276
+ constructor(requestId: bigint, fullTrackName: FullTrackName, trackAlias: bigint, parameters: MessageParameter[], trackExtensions?: TrackExtension[]);
2277
+ getType(): ControlMessageType;
2278
+ serialize(): FrozenByteBuffer;
2279
+ static parsePayload(buf: BaseByteBuffer): Publish;
2280
+ }
2281
+
2282
+ /**
2283
+ * Copyright 2025 The MOQtail Authors
2284
+ *
2285
+ * Licensed under the Apache License, Version 2.0 (the "License");
2286
+ * you may not use this file except in compliance with the License.
2287
+ * You may obtain a copy of the License at
2288
+ *
2289
+ * http://www.apache.org/licenses/LICENSE-2.0
2290
+ *
2291
+ * Unless required by applicable law or agreed to in writing, software
2292
+ * distributed under the License is distributed on an "AS IS" BASIS,
2293
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2294
+ * See the License for the specific language governing permissions and
2295
+ * limitations under the License.
2296
+ */
2297
+
2298
+ declare class PublishOk {
2299
+ readonly requestId: bigint;
2300
+ readonly parameters: MessageParameter[];
2301
+ constructor(requestId: bigint, parameters: MessageParameter[]);
2302
+ getType(): ControlMessageType;
2303
+ serialize(): FrozenByteBuffer;
2304
+ static parsePayload(buf: BaseByteBuffer): PublishOk;
2305
+ }
2306
+
2307
+ /**
2308
+ * Copyright 2025 The MOQtail Authors
2309
+ *
2310
+ * Licensed under the Apache License, Version 2.0 (the "License");
2311
+ * you may not use this file except in compliance with the License.
2312
+ * You may obtain a copy of the License at
2313
+ *
2314
+ * http://www.apache.org/licenses/LICENSE-2.0
2315
+ *
2316
+ * Unless required by applicable law or agreed to in writing, software
2317
+ * distributed under the License is distributed on an "AS IS" BASIS,
2318
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2319
+ * See the License for the specific language governing permissions and
2320
+ * limitations under the License.
2321
+ */
2322
+
2323
+ declare class SubscribeOk {
2324
+ requestId: bigint;
2325
+ trackAlias: bigint;
2326
+ parameters: MessageParameter[];
2327
+ trackExtensions: TrackExtension[];
2328
+ private constructor();
2329
+ static create(requestId: bigint, trackAlias: bigint, parameters: MessageParameter[], trackExtensions?: TrackExtension[]): SubscribeOk;
2330
+ serialize(): FrozenByteBuffer;
2331
+ static parsePayload(buf: BaseByteBuffer): SubscribeOk;
2332
+ }
2333
+
2334
+ /**
2335
+ * Copyright 2025 The MOQtail Authors
2336
+ *
2337
+ * Licensed under the Apache License, Version 2.0 (the "License");
2338
+ * you may not use this file except in compliance with the License.
2339
+ * You may obtain a copy of the License at
2340
+ *
2341
+ * http://www.apache.org/licenses/LICENSE-2.0
2342
+ *
2343
+ * Unless required by applicable law or agreed to in writing, software
2344
+ * distributed under the License is distributed on an "AS IS" BASIS,
2345
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2346
+ * See the License for the specific language governing permissions and
2347
+ * limitations under the License.
2348
+ */
2349
+
2350
+ declare class RequestUpdate {
2351
+ requestId: bigint;
2352
+ existingRequestId: bigint;
2353
+ parameters: MessageParameter[];
2354
+ constructor(requestId: bigint, existingRequestId: bigint, parameters: MessageParameter[]);
2355
+ getType(): ControlMessageType;
2356
+ serialize(): FrozenByteBuffer;
2357
+ static parsePayload(buf: BaseByteBuffer): RequestUpdate;
2358
+ equals(other: RequestUpdate): boolean;
2359
+ }
2360
+
2361
+ /**
2362
+ * Copyright 2025 The MOQtail Authors
2363
+ *
2364
+ * Licensed under the Apache License, Version 2.0 (the "License");
2365
+ * you may not use this file except in compliance with the License.
2366
+ * You may obtain a copy of the License at
2367
+ *
2368
+ * http://www.apache.org/licenses/LICENSE-2.0
2369
+ *
2370
+ * Unless required by applicable law or agreed to in writing, software
2371
+ * distributed under the License is distributed on an "AS IS" BASIS,
2372
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2373
+ * See the License for the specific language governing permissions and
2374
+ * limitations under the License.
2375
+ */
2376
+
2377
+ declare class RequestsBlocked {
2378
+ readonly maximumRequestId: bigint;
2379
+ constructor(maximumRequestId: bigint | number);
2380
+ getType(): ControlMessageType;
2381
+ serialize(): FrozenByteBuffer;
2382
+ static parsePayload(buf: BaseByteBuffer): RequestsBlocked;
2383
+ }
2384
+
2385
+ /**
2386
+ * Copyright 2025 The MOQtail Authors
2387
+ *
2388
+ * Licensed under the Apache License, Version 2.0 (the "License");
2389
+ * you may not use this file except in compliance with the License.
2390
+ * You may obtain a copy of the License at
2391
+ *
2392
+ * http://www.apache.org/licenses/LICENSE-2.0
2393
+ *
2394
+ * Unless required by applicable law or agreed to in writing, software
2395
+ * distributed under the License is distributed on an "AS IS" BASIS,
2396
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2397
+ * See the License for the specific language governing permissions and
2398
+ * limitations under the License.
2399
+ */
2400
+
2401
+ declare class TrackStatus {
2402
+ requestId: bigint;
2403
+ trackAlias: bigint;
2404
+ fullTrackName: FullTrackName;
2405
+ subscriberPriority: number;
2406
+ groupOrder: GroupOrder;
2407
+ forward: boolean;
2408
+ filterType: FilterType;
2409
+ startLocation: Location | undefined;
2410
+ endGroup: bigint | undefined;
2411
+ subscribeParameters: MessageParameter[];
2412
+ private constructor();
2413
+ static newNextGroupStart(requestId: bigint, trackAlias: bigint, fullTrackName: FullTrackName, subscriberPriority: number, groupOrder: GroupOrder, forward: boolean, subscribeParameters: MessageParameter[]): TrackStatus;
2414
+ static newLatestObject(requestId: bigint, trackAlias: bigint, fullTrackName: FullTrackName, subscriberPriority: number, groupOrder: GroupOrder, forward: boolean, subscribeParameters: MessageParameter[]): TrackStatus;
2415
+ static newAbsoluteStart(requestId: bigint, trackAlias: bigint, fullTrackName: FullTrackName, subscriberPriority: number, groupOrder: GroupOrder, forward: boolean, startLocation: Location, subscribeParameters: MessageParameter[]): TrackStatus;
2416
+ static newAbsoluteRange(requestId: bigint, trackAlias: bigint, fullTrackName: FullTrackName, subscriberPriority: number, groupOrder: GroupOrder, forward: boolean, startLocation: Location, endGroup: bigint, subscribeParameters: MessageParameter[]): TrackStatus;
2417
+ serialize(): FrozenByteBuffer;
2418
+ static parsePayload(buf: BaseByteBuffer): TrackStatus;
2419
+ }
2420
+
2421
+ /**
2422
+ * Copyright 2025 The MOQtail Authors
2423
+ *
2424
+ * Licensed under the Apache License, Version 2.0 (the "License");
2425
+ * you may not use this file except in compliance with the License.
2426
+ * You may obtain a copy of the License at
2427
+ *
2428
+ * http://www.apache.org/licenses/LICENSE-2.0
2429
+ *
2430
+ * Unless required by applicable law or agreed to in writing, software
2431
+ * distributed under the License is distributed on an "AS IS" BASIS,
2432
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2433
+ * See the License for the specific language governing permissions and
2434
+ * limitations under the License.
2435
+ */
2436
+
2437
+ /**
2438
+ * @public
2439
+ * Represents a protocol PublishNamespaceDone message, used to unpublish a track namespace.
2440
+ */
2441
+ declare class PublishNamespaceDone {
2442
+ readonly trackNamespace: Tuple;
2443
+ /**
2444
+ * Constructs a PublishNamespaceDone message.
2445
+ * @param trackNamespace - The track namespace to unpublish.
2446
+ */
2447
+ constructor(trackNamespace: Tuple);
2448
+ /**
2449
+ * Gets the control message type for this PublishNamespaceDone message.
2450
+ * @returns The ControlMessageType.PublishNamespaceDone enum value.
2451
+ */
2452
+ getType(): ControlMessageType;
2453
+ /**
2454
+ * Serializes the PublishNamespaceDone message to a frozen byte buffer.
2455
+ * @returns The serialized message as a FrozenByteBuffer.
2456
+ * @throws :{@link LengthExceedsMaxError} If the payload exceeds 65535 bytes.
2457
+ */
2458
+ serialize(): FrozenByteBuffer;
2459
+ /**
2460
+ * Parses a PublishNamespaceDone message payload from a buffer.
2461
+ * @param buf - The buffer containing the payload.
2462
+ * @returns The parsed PublishNamespaceDone message.
2463
+ */
2464
+ static parsePayload(buf: BaseByteBuffer): PublishNamespaceDone;
2465
+ }
2466
+
2467
+ /**
2468
+ * Copyright 2025 The MOQtail Authors
2469
+ *
2470
+ * Licensed under the Apache License, Version 2.0 (the "License");
2471
+ * you may not use this file except in compliance with the License.
2472
+ * You may obtain a copy of the License at
2473
+ *
2474
+ * http://www.apache.org/licenses/LICENSE-2.0
2475
+ *
2476
+ * Unless required by applicable law or agreed to in writing, software
2477
+ * distributed under the License is distributed on an "AS IS" BASIS,
2478
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2479
+ * See the License for the specific language governing permissions and
2480
+ * limitations under the License.
2481
+ */
2482
+
2483
+ declare class Unsubscribe {
2484
+ readonly requestId: bigint;
2485
+ constructor(requestId: bigint | number);
2486
+ getType(): ControlMessageType;
2487
+ serialize(): FrozenByteBuffer;
2488
+ static parsePayload(buf: BaseByteBuffer): Unsubscribe;
2489
+ }
2490
+
2491
+ /**
2492
+ * Copyright 2025 The MOQtail Authors
2493
+ *
2494
+ * Licensed under the Apache License, Version 2.0 (the "License");
2495
+ * you may not use this file except in compliance with the License.
2496
+ * You may obtain a copy of the License at
2497
+ *
2498
+ * http://www.apache.org/licenses/LICENSE-2.0
2499
+ *
2500
+ * Unless required by applicable law or agreed to in writing, software
2501
+ * distributed under the License is distributed on an "AS IS" BASIS,
2502
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2503
+ * See the License for the specific language governing permissions and
2504
+ * limitations under the License.
2505
+ */
2506
+
2507
+ declare class SubscribeNamespace {
2508
+ readonly requestId: bigint;
2509
+ readonly trackNamespacePrefix: Tuple;
2510
+ readonly subscribeOptions: NamespaceSubscribeOptions;
2511
+ readonly parameters: MessageParameter[];
2512
+ constructor(requestId: bigint, trackNamespacePrefix: Tuple, subscribeOptions: NamespaceSubscribeOptions, parameters: MessageParameter[]);
2513
+ getType(): ControlMessageType;
2514
+ serialize(): FrozenByteBuffer;
2515
+ static parsePayload(buf: BaseByteBuffer): SubscribeNamespace;
2516
+ }
2517
+
2518
+ /**
2519
+ * Copyright 2025 The MOQtail Authors
2520
+ *
2521
+ * Licensed under the Apache License, Version 2.0 (the "License");
2522
+ * you may not use this file except in compliance with the License.
2523
+ * You may obtain a copy of the License at
2524
+ *
2525
+ * http://www.apache.org/licenses/LICENSE-2.0
2526
+ *
2527
+ * Unless required by applicable law or agreed to in writing, software
2528
+ * distributed under the License is distributed on an "AS IS" BASIS,
2529
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2530
+ * See the License for the specific language governing permissions and
2531
+ * limitations under the License.
2532
+ */
2533
+
2534
+ declare class UnsubscribeNamespace {
2535
+ readonly trackNamespacePrefix: Tuple;
2536
+ constructor(trackNamespacePrefix: Tuple);
2537
+ getType(): ControlMessageType;
2538
+ serialize(): FrozenByteBuffer;
2539
+ static parsePayload(buf: BaseByteBuffer): UnsubscribeNamespace;
2540
+ }
2541
+
2542
+ /**
2543
+ * Copyright 2026 The MOQtail Authors
2544
+ *
2545
+ * Licensed under the Apache License, Version 2.0 (the "License");
2546
+ * you may not use this file except in compliance with the License.
2547
+ * You may obtain a copy of the License at
2548
+ *
2549
+ * http://www.apache.org/licenses/LICENSE-2.0
2550
+ *
2551
+ * Unless required by applicable law or agreed to in writing, software
2552
+ * distributed under the License is distributed on an "AS IS" BASIS,
2553
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2554
+ * See the License for the specific language governing permissions and
2555
+ * limitations under the License.
2556
+ */
2557
+
2558
+ declare class RequestOk {
2559
+ readonly requestId: bigint;
2560
+ readonly parameters: MessageParameter[];
2561
+ constructor(requestId: bigint | number, parameters?: MessageParameter[]);
2562
+ getType(): ControlMessageType;
2563
+ serialize(): FrozenByteBuffer;
2564
+ static parsePayload(buf: BaseByteBuffer): RequestOk;
2565
+ }
2566
+
2567
+ /**
2568
+ * Copyright 2025 The MOQtail Authors
2569
+ *
2570
+ * Licensed under the Apache License, Version 2.0 (the "License");
2571
+ * you may not use this file except in compliance with the License.
2572
+ * You may obtain a copy of the License at
2573
+ *
2574
+ * http://www.apache.org/licenses/LICENSE-2.0
2575
+ *
2576
+ * Unless required by applicable law or agreed to in writing, software
2577
+ * distributed under the License is distributed on an "AS IS" BASIS,
2578
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2579
+ * See the License for the specific language governing permissions and
2580
+ * limitations under the License.
2581
+ */
2582
+
2583
+ declare class RequestError {
2584
+ readonly requestId: bigint;
2585
+ readonly errorCode: RequestErrorCode;
2586
+ readonly retryInterval: bigint;
2587
+ readonly reasonPhrase: ReasonPhrase;
2588
+ constructor(requestId: bigint, errorCode: RequestErrorCode, retryInterval: bigint, reasonPhrase: ReasonPhrase);
2589
+ getType(): ControlMessageType;
2590
+ serialize(): FrozenByteBuffer;
2591
+ static parsePayload(buf: BaseByteBuffer): RequestError;
2592
+ }
2593
+
2594
+ /**
2595
+ * Copyright 2025 The MOQtail Authors
2596
+ *
2597
+ * Licensed under the Apache License, Version 2.0 (the "License");
2598
+ * you may not use this file except in compliance with the License.
2599
+ * You may obtain a copy of the License at
2600
+ *
2601
+ * http://www.apache.org/licenses/LICENSE-2.0
2602
+ *
2603
+ * Unless required by applicable law or agreed to in writing, software
2604
+ * distributed under the License is distributed on an "AS IS" BASIS,
2605
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2606
+ * See the License for the specific language governing permissions and
2607
+ * limitations under the License.
2608
+ */
2609
+
2610
+ type ControlMessage = Publish | PublishOk | PublishDone | PublishNamespace | PublishNamespaceCancel | Namespace | NamespaceDone | ClientSetup | Fetch | FetchCancel | FetchOk | GoAway | MaxRequestId$1 | ServerSetup | Subscribe | RequestError | SubscribeOk | RequestUpdate | RequestsBlocked | TrackStatus | PublishNamespaceDone | Unsubscribe | SubscribeNamespace | UnsubscribeNamespace | RequestOk;
2611
+ declare namespace ControlMessage {
2612
+ function deserialize(buf: FrozenByteBuffer): ControlMessage;
2613
+ function serialize(msg: ControlMessage): FrozenByteBuffer;
2614
+ }
2615
+
2616
+ /**
2617
+ * Copyright 2025 The MOQtail Authors
2618
+ *
2619
+ * Licensed under the Apache License, Version 2.0 (the "License");
2620
+ * you may not use this file except in compliance with the License.
2621
+ * You may obtain a copy of the License at
2622
+ *
2623
+ * http://www.apache.org/licenses/LICENSE-2.0
2624
+ *
2625
+ * Unless required by applicable law or agreed to in writing, software
2626
+ * distributed under the License is distributed on an "AS IS" BASIS,
2627
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2628
+ * See the License for the specific language governing permissions and
2629
+ * limitations under the License.
2630
+ */
2631
+
2632
+ declare class MaxRequestId implements Parameter {
2633
+ readonly maxId: bigint;
2634
+ static readonly TYPE = SetupParameterType.MaxRequestId;
2635
+ constructor(maxId: bigint);
2636
+ toKeyValuePair(): KeyValuePair;
2637
+ static fromKeyValuePair(pair: KeyValuePair): MaxRequestId | undefined;
2638
+ }
2639
+
2640
+ /**
2641
+ * Copyright 2025 The MOQtail Authors
2642
+ *
2643
+ * Licensed under the Apache License, Version 2.0 (the "License");
2644
+ * you may not use this file except in compliance with the License.
2645
+ * You may obtain a copy of the License at
2646
+ *
2647
+ * http://www.apache.org/licenses/LICENSE-2.0
2648
+ *
2649
+ * Unless required by applicable law or agreed to in writing, software
2650
+ * distributed under the License is distributed on an "AS IS" BASIS,
2651
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2652
+ * See the License for the specific language governing permissions and
2653
+ * limitations under the License.
2654
+ */
2655
+
2656
+ declare class Path implements Parameter {
2657
+ readonly moqtPath: string;
2658
+ static readonly TYPE = SetupParameterType.Path;
2659
+ constructor(moqtPath: string);
2660
+ toKeyValuePair(): KeyValuePair;
2661
+ static fromKeyValuePair(pair: KeyValuePair): Path | undefined;
2662
+ }
2663
+
2664
+ /**
2665
+ * Copyright 2025 The MOQtail Authors
2666
+ *
2667
+ * Licensed under the Apache License, Version 2.0 (the "License");
2668
+ * you may not use this file except in compliance with the License.
2669
+ * You may obtain a copy of the License at
2670
+ *
2671
+ * http://www.apache.org/licenses/LICENSE-2.0
2672
+ *
2673
+ * Unless required by applicable law or agreed to in writing, software
2674
+ * distributed under the License is distributed on an "AS IS" BASIS,
2675
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2676
+ * See the License for the specific language governing permissions and
2677
+ * limitations under the License.
2678
+ */
2679
+
2680
+ declare class MaxAuthTokenCacheSize implements Parameter {
2681
+ readonly maxSize: bigint;
2682
+ static readonly TYPE = SetupParameterType.MaxAuthTokenCacheSize;
2683
+ constructor(maxSize: bigint);
2684
+ toKeyValuePair(): KeyValuePair;
2685
+ static fromKeyValuePair(pair: KeyValuePair): MaxAuthTokenCacheSize | undefined;
2686
+ }
2687
+
2688
+ /**
2689
+ * Copyright 2025 The MOQtail Authors
2690
+ *
2691
+ * Licensed under the Apache License, Version 2.0 (the "License");
2692
+ * you may not use this file except in compliance with the License.
2693
+ * You may obtain a copy of the License at
2694
+ *
2695
+ * http://www.apache.org/licenses/LICENSE-2.0
2696
+ *
2697
+ * Unless required by applicable law or agreed to in writing, software
2698
+ * distributed under the License is distributed on an "AS IS" BASIS,
2699
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2700
+ * See the License for the specific language governing permissions and
2701
+ * limitations under the License.
2702
+ */
2703
+
2704
+ type SetupParameter = Path | MaxRequestId | MaxAuthTokenCacheSize | AuthorizationToken;
2705
+ declare namespace SetupParameter {
2706
+ function fromKeyValuePair(pair: KeyValuePair): SetupParameter | undefined;
2707
+ function toKeyValuePair(param: SetupParameter): KeyValuePair;
2708
+ function isPath(param: SetupParameter): param is Path;
2709
+ function isMaxRequestId(param: SetupParameter): param is MaxRequestId;
2710
+ function isMaxAuthTokenCacheSize(param: SetupParameter): param is MaxAuthTokenCacheSize;
2711
+ function isAuthorizationToken(param: SetupParameter): param is AuthorizationToken;
2712
+ }
2713
+ declare class SetupParameters {
2714
+ private kvps;
2715
+ addMaxAuthTokenCacheSize(maxSize: bigint | number): this;
2716
+ addMaxRequestId(maxId: bigint | number): this;
2717
+ addPath(moqtPath: string): this;
2718
+ addAuthorizationToken(auth: AuthorizationToken): this;
2719
+ addRaw(pair: KeyValuePair): this;
2720
+ build(): KeyValuePair[];
2721
+ static fromKeyValuePairs(kvps: KeyValuePair[]): SetupParameter[];
2722
+ }
2723
+
2724
+ export { ObjectStatus as $, type AuthTokenVariant as A, BaseByteBuffer as B, ClientSetup as C, Datagram as D, EndOfRangeKind as E, Fetch as F, GoAway as G, Header as H, ImmutableExtensionsExtension as I, MAX_REASON_PHRASE_LEN as J, KeyValuePair as K, LOCHeaderExtensionId as L, MAX_FULL_TRACK_NAME_LENGTH as M, MaxAuthTokenCacheSize as N, MaxCacheDurationExtension as O, MaxRequestId$1 as P, MaxRequestId as Q, MessageParameter as R, MessageParameterType as S, MessageParameters as T, MoqtObject as U, Namespace as V, NamespaceDone as W, NamespaceSubscribeOptions as X, NewGroupRequest as Y, ObjectDatagramType as Z, ObjectForwardingPreference as _, AuthorizationToken as a, type Parameter as a0, Path as a1, Publish as a2, PublishDone as a3, PublishDoneStatusCode as a4, PublishNamespace as a5, PublishNamespaceCancel as a6, PublishNamespaceDone as a7, PublishOk as a8, ReasonPhrase as a9, UnknownTrackExtension as aA, Unsubscribe as aB, UnsubscribeNamespace as aC, applyMessageParameterUpdate as aD, controlMessageTypeFromBigInt as aE, fetchTypeFromBigInt as aF, filterTypeFromBigInt as aG, groupOrderFromNumber as aH, isBytes as aI, isVarInt as aJ, locHeaderExtensionIdFromNumber as aK, messageParameterTypeFromNumber as aL, publishDoneStatusCodeFromBigInt as aM, requestErrorCodeFromBigInt as aN, setupParameterTypeFromNumber as aO, tokenAliasTypeFromNumber as aP, trackStatusCodeFromBigInt as aQ, RequestError as aa, RequestErrorCode as ab, RequestIdMap as ac, RequestOk as ad, RequestUpdate as ae, RequestsBlocked as af, SUPPORTED_VERSIONS as ag, ServerSetup as ah, SetupParameter as ai, SetupParameterType as aj, SetupParameters as ak, SubgroupHeader as al, SubgroupHeaderType as am, SubgroupObject as an, Subscribe as ao, SubscribeNamespace as ap, SubscribeOk as aq, SubscriberPriority as ar, SubscriptionFilter as as, TokenAliasType as at, TrackExtension as au, TrackExtensionType as av, TrackStatus as aw, TrackStatusCode as ax, Tuple as ay, TupleField as az, ByteBuffer as b, ControlMessage as c, ControlMessageType as d, DefaultPublisherGroupOrderExtension as e, DefaultPublisherPriorityExtension as f, DeliveryTimeout as g, DeliveryTimeoutExtension as h, DynamicGroupsExtension as i, Expires as j, FetchCancel as k, FetchHeader as l, FetchHeaderType as m, FetchObject as n, type FetchObjectContext as o, FetchOk as p, FetchType as q, FilterType as r, Forward as s, FrozenByteBuffer as t, FullTrackName as u, GroupOrder as v, GroupOrderParam as w, LargestObject as x, Location as y, MAX_NAMESPACE_TUPLE_COUNT as z };