moqtail 0.9.0 → 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.
package/dist/client.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { d as ControlMessage, E as MoqtObject, L as Location, s as FullTrackName, J as ObjectForwardingPreference, ab as Subscribe, T as PublishDoneStatusCode, aj as SubscribeUpdate, F as Fetch, R as Publish, $ as PublishNamespaceOk, Z as PublishNamespaceError, W as PublishNamespace, o as FetchOk, j as FetchError, ai as SubscribeOk, ac as SubscribeError, K as KeyValuePair, ah as SubscribeNamespaceOk, af as SubscribeNamespaceError, ae as SubscribeNamespace, a0 as PublishOk, U as PublishError, t as GroupOrder, p as FetchType, av as VersionSpecificParameters, a7 as SetupParameters, f as DatagramObject, g as DatagramStatus, q as FilterType, ap as Tuple, a2 as RequestIdMap, Y as PublishNamespaceDone, G as GoAway, aa as SubgroupObject, a8 as SubgroupHeader, n as FetchObject, l as FetchHeader, S as PublishDone, a4 as ServerSetup, X as PublishNamespaceCancel, as as UnsubscribeNamespace, H as Header } from './version_parameter-DXBOBueW.js';
1
+ import { c as ControlMessage, U as MoqtObject, y as Location, u as FullTrackName, _ as ObjectForwardingPreference, au as TrackExtension, ao as Subscribe, a4 as PublishDoneStatusCode, ae as RequestUpdate, F as Fetch, a2 as Publish, ad as RequestOk, aa as RequestError, a5 as PublishNamespace, p as FetchOk, aq as SubscribeOk, R as MessageParameter, ap as SubscribeNamespace, a8 as PublishOk, v as GroupOrder, q as FetchType, ak as SetupParameters, D as Datagram, r as FilterType, ay as Tuple, ac as RequestIdMap, a7 as PublishNamespaceDone, G as GoAway, an as SubgroupObject, al as SubgroupHeader, n as FetchObject, l as FetchHeader, a3 as PublishDone, ah as ServerSetup, a6 as PublishNamespaceCancel, X as NamespaceSubscribeOptions, aC as UnsubscribeNamespace, aw as TrackStatus, H as Header } from './setup_parameter-BOeGq6Mv.js';
2
+ import { L as LogLevel } from './logger-C6QS408Z.js';
2
3
 
3
4
  /**
4
5
  * Copyright 2025 The MOQtail Authors
@@ -170,7 +171,7 @@ declare class LiveTrackSource implements LiveObjectSource {
170
171
  readonly stream: ReadableStream<MoqtObject>;
171
172
  constructor(stream: ReadableStream<MoqtObject>);
172
173
  get largestLocation(): Location | undefined;
173
- onNewObject(listener: (obj: MoqtObject) => void): () => void;
174
+ onNewObject(listener: (obj: MoqtObject) => Promise<void> | void): () => void;
174
175
  onDone(listener: () => void): () => void;
175
176
  stop(): void;
176
177
  }
@@ -260,6 +261,12 @@ type Track = {
260
261
  * Optional compact numeric alias assigned during protocol negotiation.
261
262
  */
262
263
  trackAlias?: bigint;
264
+ /**
265
+ * Track extensions advertised by the publisher.
266
+ * Set before calling `publish()` to include extensions in the PUBLISH message.
267
+ * Populated automatically on the subscriber side when SUBSCRIBE_OK or FETCH_OK is received.
268
+ */
269
+ trackExtensions?: TrackExtension[];
263
270
  };
264
271
 
265
272
  /**
@@ -312,10 +319,10 @@ declare class SubscribePublication {
312
319
  */
313
320
  done(statusCode: PublishDoneStatusCode): Promise<void>;
314
321
  /**
315
- * Updates the subscription parameters and locations based on a SubscribeUpdate message.
316
- * @param msg - The update message containing new subscription details.
322
+ * Updates the subscription parameters and locations based on a RequestUpdate message.
323
+ * @param msg - The update message containing new request details.
317
324
  */
318
- update(msg: SubscribeUpdate): void;
325
+ update(msg: RequestUpdate): void;
319
326
  /**
320
327
  * Publishes MOQT objects to the subscriber as they become available.
321
328
  * Handles stream creation, object writing, and stream closure based on subscription parameters.
@@ -398,7 +405,7 @@ declare class PublishPublication {
398
405
  }
399
406
 
400
407
  /**
401
- * Copyright 2025 The MOQtail Authors
408
+ * Copyright 2026 The MOQtail Authors
402
409
  *
403
410
  * Licensed under the Apache License, Version 2.0 (the "License");
404
411
  * you may not use this file except in compliance with the License.
@@ -413,18 +420,18 @@ declare class PublishPublication {
413
420
  * limitations under the License.
414
421
  */
415
422
 
416
- declare class PublishNamespaceRequest implements PromiseLike<PublishNamespaceOk | PublishNamespaceError> {
423
+ declare class PublishNamespaceRequest implements PromiseLike<RequestOk | RequestError> {
417
424
  readonly requestId: bigint;
418
425
  readonly message: PublishNamespace;
419
426
  private _resolve;
420
427
  private _reject;
421
428
  private promise;
422
429
  constructor(requestId: bigint, message: PublishNamespace);
423
- resolve(value: PublishNamespaceOk | PublishNamespaceError | PromiseLike<PublishNamespaceOk | PublishNamespaceError>): void;
430
+ resolve(value: RequestOk | RequestError | PromiseLike<RequestOk | RequestError>): void;
424
431
  reject(reason?: any): void;
425
- then<TResult1 = PublishNamespaceOk | PublishNamespaceError, TResult2 = never>(onfulfilled?: ((value: PublishNamespaceOk | PublishNamespaceError) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): PromiseLike<TResult1 | TResult2>;
426
- catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<PublishNamespaceOk | PublishNamespaceError | TResult>;
427
- finally(onfinally?: (() => void) | undefined | null): Promise<PublishNamespaceOk | PublishNamespaceError>;
432
+ then<TResult1 = RequestOk | RequestError, TResult2 = never>(onfulfilled?: ((value: RequestOk | RequestError) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): PromiseLike<TResult1 | TResult2>;
433
+ catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<RequestOk | RequestError | TResult>;
434
+ finally(onfinally?: (() => void) | undefined | null): Promise<RequestOk | RequestError>;
428
435
  }
429
436
 
430
437
  /**
@@ -443,7 +450,7 @@ declare class PublishNamespaceRequest implements PromiseLike<PublishNamespaceOk
443
450
  * limitations under the License.
444
451
  */
445
452
 
446
- declare class FetchRequest implements PromiseLike<FetchOk | FetchError> {
453
+ declare class FetchRequest implements PromiseLike<FetchOk | RequestError> {
447
454
  readonly requestId: bigint;
448
455
  readonly message: Fetch;
449
456
  private _resolve;
@@ -454,11 +461,11 @@ declare class FetchRequest implements PromiseLike<FetchOk | FetchError> {
454
461
  isActive: boolean;
455
462
  isResolved: boolean;
456
463
  constructor(message: Fetch);
457
- resolve(value: FetchOk | FetchError | PromiseLike<FetchOk | FetchError>): void;
464
+ resolve(value: FetchOk | RequestError | PromiseLike<FetchOk | RequestError>): void;
458
465
  reject(reason?: any): void;
459
- then<TResult1 = FetchOk | FetchError, TResult2 = never>(onfulfilled?: ((value: FetchOk | FetchError) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): PromiseLike<TResult1 | TResult2>;
460
- catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<FetchOk | FetchError | TResult>;
461
- finally(onfinally?: (() => void) | undefined | null): Promise<FetchOk | FetchError>;
466
+ then<TResult1 = FetchOk | RequestError, TResult2 = never>(onfulfilled?: ((value: FetchOk | RequestError) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): PromiseLike<TResult1 | TResult2>;
467
+ catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<FetchOk | RequestError | TResult>;
468
+ finally(onfinally?: (() => void) | undefined | null): Promise<FetchOk | RequestError>;
462
469
  }
463
470
 
464
471
  /**
@@ -477,7 +484,7 @@ declare class FetchRequest implements PromiseLike<FetchOk | FetchError> {
477
484
  * limitations under the License.
478
485
  */
479
486
 
480
- declare class SubscribeRequest implements PromiseLike<SubscribeOk | SubscribeError> {
487
+ declare class SubscribeRequest implements PromiseLike<SubscribeOk | RequestError> {
481
488
  #private;
482
489
  requestId: bigint;
483
490
  fullTrackName: FullTrackName;
@@ -486,25 +493,25 @@ declare class SubscribeRequest implements PromiseLike<SubscribeOk | SubscribeErr
486
493
  endGroup: bigint | undefined;
487
494
  priority: number;
488
495
  forward: boolean;
489
- subscribeParameters: KeyValuePair[];
496
+ subscribeParameters: MessageParameter[];
490
497
  largestLocation: Location | undefined;
491
498
  streamsAccepted: bigint;
492
499
  expectedStreams: bigint | undefined;
493
500
  readonly controller: ReadableStreamDefaultController<MoqtObject>;
494
501
  readonly stream: ReadableStream<MoqtObject>;
495
502
  constructor(msg: Subscribe);
496
- update(msg: SubscribeUpdate): void;
497
- switch(newTrackName: FullTrackName, newParameters: KeyValuePair[]): void;
503
+ update(msg: RequestUpdate): void;
504
+ switch(newTrackName: FullTrackName, newParameters: MessageParameter[]): void;
498
505
  unsubscribe(): void;
499
- resolve(value: SubscribeOk | SubscribeError | PromiseLike<SubscribeOk | SubscribeError>): void;
506
+ resolve(value: SubscribeOk | RequestError | PromiseLike<SubscribeOk | RequestError>): void;
500
507
  reject(reason?: any): void;
501
- then<TResult1 = SubscribeOk | SubscribeError, TResult2 = never>(onfulfilled?: ((value: SubscribeOk | SubscribeError) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): PromiseLike<TResult1 | TResult2>;
502
- catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<SubscribeOk | SubscribeError | TResult>;
503
- finally(onfinally?: (() => void) | undefined | null): Promise<SubscribeOk | SubscribeError>;
508
+ then<TResult1 = SubscribeOk | RequestError, TResult2 = never>(onfulfilled?: ((value: SubscribeOk | RequestError) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): PromiseLike<TResult1 | TResult2>;
509
+ catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<SubscribeOk | RequestError | TResult>;
510
+ finally(onfinally?: (() => void) | undefined | null): Promise<SubscribeOk | RequestError>;
504
511
  }
505
512
 
506
513
  /**
507
- * Copyright 2025 The MOQtail Authors
514
+ * Copyright 2026 The MOQtail Authors
508
515
  *
509
516
  * Licensed under the Apache License, Version 2.0 (the "License");
510
517
  * you may not use this file except in compliance with the License.
@@ -519,18 +526,18 @@ declare class SubscribeRequest implements PromiseLike<SubscribeOk | SubscribeErr
519
526
  * limitations under the License.
520
527
  */
521
528
 
522
- declare class SubscribeNamespaceRequest implements PromiseLike<SubscribeNamespaceOk | SubscribeNamespaceError> {
529
+ declare class SubscribeNamespaceRequest implements PromiseLike<RequestOk | RequestError> {
523
530
  readonly requestId: bigint;
524
531
  readonly message: SubscribeNamespace;
525
532
  private _resolve;
526
533
  private _reject;
527
534
  private promise;
528
535
  constructor(msg: SubscribeNamespace);
529
- resolve(value: SubscribeNamespaceOk | SubscribeNamespaceError | PromiseLike<SubscribeNamespaceOk | SubscribeNamespaceError>): void;
536
+ resolve(value: RequestOk | RequestError | PromiseLike<RequestOk | RequestError>): void;
530
537
  reject(reason?: any): void;
531
- then<TResult1 = SubscribeNamespaceOk | SubscribeNamespaceError, TResult2 = never>(onfulfilled?: ((value: SubscribeNamespaceOk | SubscribeNamespaceError) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): PromiseLike<TResult1 | TResult2>;
532
- catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<SubscribeNamespaceOk | SubscribeNamespaceError | TResult>;
533
- finally(onfinally?: (() => void) | undefined | null): Promise<SubscribeNamespaceOk | SubscribeNamespaceError>;
538
+ then<TResult1 = RequestOk | RequestError, TResult2 = never>(onfulfilled?: ((value: RequestOk | RequestError) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): PromiseLike<TResult1 | TResult2>;
539
+ catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<RequestOk | RequestError | TResult>;
540
+ finally(onfinally?: (() => void) | undefined | null): Promise<RequestOk | RequestError>;
534
541
  }
535
542
 
536
543
  /**
@@ -549,18 +556,18 @@ declare class SubscribeNamespaceRequest implements PromiseLike<SubscribeNamespac
549
556
  * limitations under the License.
550
557
  */
551
558
 
552
- declare class PublishRequest implements PromiseLike<PublishOk | PublishError> {
559
+ declare class PublishRequest implements PromiseLike<PublishOk | RequestError> {
553
560
  readonly requestId: bigint;
554
561
  readonly message: Publish;
555
562
  private _resolve;
556
563
  private _reject;
557
564
  private promise;
558
565
  constructor(msg: Publish);
559
- resolve(value: PublishOk | PublishError | PromiseLike<PublishOk | PublishError>): void;
566
+ resolve(value: PublishOk | RequestError | PromiseLike<PublishOk | RequestError>): void;
560
567
  reject(reason?: any): void;
561
- then<TResult1 = PublishOk | PublishError, TResult2 = never>(onfulfilled?: ((value: PublishOk | PublishError) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): PromiseLike<TResult1 | TResult2>;
562
- catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<PublishOk | PublishError | TResult>;
563
- finally(onfinally?: (() => void) | undefined | null): Promise<PublishOk | PublishError>;
568
+ then<TResult1 = PublishOk | RequestError, TResult2 = never>(onfulfilled?: ((value: PublishOk | RequestError) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): PromiseLike<TResult1 | TResult2>;
569
+ catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<PublishOk | RequestError | TResult>;
570
+ finally(onfinally?: (() => void) | undefined | null): Promise<PublishOk | RequestError>;
564
571
  }
565
572
 
566
573
  /**
@@ -640,12 +647,12 @@ type MOQtailRequest = PublishRequest | PublishNamespaceRequest | SubscribeNamesp
640
647
  type MOQtailClientOptions = {
641
648
  /** Relay / server endpoint for the underlying {@link https://developer.mozilla.org/docs/Web/API/WebTransport | WebTransport} session (can be absolute {@link https://developer.mozilla.org/en-US/docs/Web/API/URL | URL} or string).*/
642
649
  url: string | URL;
643
- /** Ordered preference list of MOQT protocol version numbers (e.g. `0xff00000b`). */
644
- supportedVersions: number[];
645
650
  /** {@link SetupParameters} customizations; if omitted a default instance is built.*/
646
651
  setupParameters?: SetupParameters;
647
652
  /** Passed directly to the browser's {@link https://developer.mozilla.org/docs/Web/API/WebTransport | WebTransport} constructor for {@link https://developer.mozilla.org/docs/Web/API/WebTransportOptions | WebTransportOptions}. */
648
- transportOptions?: WebTransportOptions;
653
+ transportOptions?: WebTransportOptions & {
654
+ protocols?: string[];
655
+ };
649
656
  /** Per *data* uni-stream idle timeout in milliseconds. */
650
657
  dataStreamTimeoutMs?: number;
651
658
  /** Control stream read timeout in milliseconds. */
@@ -661,9 +668,9 @@ type MOQtailClientOptions = {
661
668
  /** Fired once when the session ends (normal or error). Receives the reason passed to {@link MOQtailClient.disconnect | disconnect}. */
662
669
  onSessionTerminated?: (reason?: unknown) => void;
663
670
  /** Invoked for each decoded datagram object/status arriving. */
664
- onDatagramReceived?: (data: DatagramObject | DatagramStatus) => void;
671
+ onDatagramReceived?: (data: Datagram) => void;
665
672
  /** Invoked after enqueuing each outbound datagram object/status. */
666
- onDatagramSent?: (data: DatagramObject | DatagramStatus) => void;
673
+ onDatagramSent?: (data: Datagram) => void;
667
674
  };
668
675
  };
669
676
  /**
@@ -703,8 +710,8 @@ type SubscribeOptions = {
703
710
  forward: boolean;
704
711
  /** {@link FilterType} variant controlling starting subset (e.g. {@link FilterType.LatestObject}). */
705
712
  filterType: FilterType;
706
- /** Optional extension {@link VersionSpecificParameters} appended to the SUBSCRIBE control message. */
707
- parameters?: VersionSpecificParameters;
713
+ /** Optional extension parameters appended to the SUBSCRIBE control message. */
714
+ parameters?: MessageParameter[];
708
715
  /** Required for {@link FilterType.AbsoluteStart} / {@link FilterType.AbsoluteRange}; earliest {@link Location} to include. */
709
716
  startLocation?: Location;
710
717
  /** Required for {@link FilterType.AbsoluteRange}; exclusive upper group boundary (coerced to bigint if number provided). */
@@ -737,8 +744,8 @@ type SubscribeUpdateOptions = {
737
744
  priority: number;
738
745
  /** Updated direction flag. */
739
746
  forward: boolean;
740
- /** Optional additional {@link VersionSpecificParameters}; existing parameters persist if omitted. */
741
- parameters?: VersionSpecificParameters;
747
+ /** Optional additional parameters; existing parameters persist if omitted. */
748
+ parameters?: MessageParameter[];
742
749
  };
743
750
  /**
744
751
  * Parameters for {@link MOQtailClient.switch | switching} an existing SUBSCRIBE to a new track.
@@ -756,8 +763,8 @@ type SwitchOptions = {
756
763
  fullTrackName: FullTrackName;
757
764
  /** The original SUBSCRIBE request id (bigint) being updated. */
758
765
  subscriptionRequestId: bigint;
759
- /** Optional additional {@link VersionSpecificParameters}; existing parameters persist if omitted. */
760
- parameters?: VersionSpecificParameters;
766
+ /** Optional additional parameters; existing parameters persist if omitted. */
767
+ parameters?: MessageParameter[];
761
768
  };
762
769
  /**
763
770
  * Options for {@link MOQtailClient.fetch | performing a FETCH} operation for historical or relative object ranges.
@@ -768,7 +775,7 @@ type SwitchOptions = {
768
775
  * priority: 64,
769
776
  * groupOrder: GroupOrder.Original,
770
777
  * typeAndProps: {
771
- * type: FetchType.StandAlone,
778
+ * type: FetchType.Standalone,
772
779
  * props: { fullTrackName, startLocation, endLocation }
773
780
  * }
774
781
  * })
@@ -799,12 +806,12 @@ type FetchOptions = {
799
806
  groupOrder: GroupOrder;
800
807
  /**
801
808
  * Discriminated union selecting the {@link FetchType} mode and its specific properties:
802
- * - StandAlone: full explicit range on a {@link FullTrackName} with start/end {@link Location}s.
809
+ * - Standalone: full explicit range on a {@link FullTrackName} with start/end {@link Location}s.
803
810
  * - Relative / Absolute: join an existing {@link SubscribeRequest} (identified by `joiningRequestId`) with starting position `joiningStart`.
804
811
  */
805
812
  typeAndProps: {
806
813
  /** Standalone historical/segment fetch for a specific {@link FullTrackName}. */
807
- type: FetchType.StandAlone;
814
+ type: FetchType.Standalone;
808
815
  /** Properties for standalone fetch: explicit track and range. */
809
816
  props: {
810
817
  fullTrackName: FullTrackName;
@@ -828,8 +835,8 @@ type FetchOptions = {
828
835
  joiningStart: bigint;
829
836
  };
830
837
  };
831
- /** Optional {@link VersionSpecificParameters} block. */
832
- parameters?: VersionSpecificParameters;
838
+ /** Optional parameters block. */
839
+ parameters?: MessageParameter[];
833
840
  };
834
841
 
835
842
  /**
@@ -860,8 +867,8 @@ type FetchOptions = {
860
867
  */
861
868
  declare class SendDatagramStream {
862
869
  #private;
863
- readonly onDataSent?: (data: DatagramObject | DatagramStatus) => void;
864
- constructor(writer: WritableStreamDefaultWriter<Uint8Array>, trackAlias: bigint, onDataSent?: (data: DatagramObject | DatagramStatus) => void);
870
+ readonly onDataSent?: (data: Datagram) => void;
871
+ constructor(writer: WritableStreamDefaultWriter<Uint8Array>, trackAlias: bigint, onDataSent?: (data: Datagram) => void);
865
872
  /**
866
873
  * Create a new datagram sender for a specific track.
867
874
  *
@@ -870,7 +877,7 @@ declare class SendDatagramStream {
870
877
  * @param onDataSent - Optional callback fired when datagram is sent
871
878
  * @returns SendDatagramStream instance
872
879
  */
873
- static new(writeStream: WritableStream<Uint8Array>, trackAlias: bigint, onDataSent?: (data: DatagramObject | DatagramStatus) => void): Promise<SendDatagramStream>;
880
+ static new(writeStream: WritableStream<Uint8Array>, trackAlias: bigint, onDataSent?: (data: Datagram) => void): Promise<SendDatagramStream>;
874
881
  /**
875
882
  * Create a datagram sender using an existing shared writer.
876
883
  * Use this when multiple senders need to share a single writer.
@@ -880,13 +887,12 @@ declare class SendDatagramStream {
880
887
  * @param onDataSent - Optional callback fired when datagram is sent
881
888
  * @returns SendDatagramStream instance
882
889
  */
883
- static fromWriter(writer: WritableStreamDefaultWriter<Uint8Array>, trackAlias: bigint, onDataSent?: (data: DatagramObject | DatagramStatus) => void): SendDatagramStream;
890
+ static fromWriter(writer: WritableStreamDefaultWriter<Uint8Array>, trackAlias: bigint, onDataSent?: (data: Datagram) => void): SendDatagramStream;
884
891
  /**
885
892
  * Write a MoqtObject as a datagram.
886
- * Converts to DatagramObject or DatagramStatus automatically.
893
+ * Converts to Datagram automatically based on object state.
887
894
  *
888
895
  * @param object - MoqtObject to send (must have Datagram forwarding preference)
889
- * @throws ProtocolViolationError if object is not datagram-compatible
890
896
  */
891
897
  write(object: MoqtObject): Promise<void>;
892
898
  /**
@@ -903,8 +909,7 @@ declare class SendDatagramStream {
903
909
  * Parallel to RecvStream but for datagram-based delivery.
904
910
  *
905
911
  * Automatically handles:
906
- * - DatagramObject parsing (objects with payloads)
907
- * - DatagramStatus parsing (status-only objects)
912
+ * - Datagram parsing (both payload and status datagrams)
908
913
  * - Track alias to full track name resolution
909
914
  *
910
915
  * @example
@@ -922,7 +927,7 @@ declare class SendDatagramStream {
922
927
  declare class RecvDatagramStream {
923
928
  #private;
924
929
  readonly stream: ReadableStream<MoqtObject>;
925
- readonly onDataReceived?: (data: DatagramObject | DatagramStatus) => void;
930
+ readonly onDataReceived?: (data: Datagram) => void;
926
931
  private constructor();
927
932
  /**
928
933
  * Create a new datagram receiver.
@@ -932,7 +937,7 @@ declare class RecvDatagramStream {
932
937
  * @param onDataReceived - Optional callback fired when datagram is received
933
938
  * @returns RecvDatagramStream instance
934
939
  */
935
- static new(readStream: ReadableStream<Uint8Array>, trackAliasResolver: (trackAlias: bigint) => FullTrackName, onDataReceived?: (data: DatagramObject | DatagramStatus) => void): Promise<RecvDatagramStream>;
940
+ static new(readStream: ReadableStream<Uint8Array>, trackAliasResolver: (trackAlias: bigint) => FullTrackName, onDataReceived?: (data: Datagram) => void): Promise<RecvDatagramStream>;
936
941
  /**
937
942
  * Cancel the datagram reader.
938
943
  */
@@ -943,6 +948,22 @@ declare class RecvDatagramStream {
943
948
  releaseLock(): void;
944
949
  }
945
950
 
951
+ /**
952
+ * Copyright 2025 The MOQtail Authors
953
+ *
954
+ * Licensed under the Apache License, Version 2.0 (the "License");
955
+ * you may not use this file except in compliance with the License.
956
+ * You may obtain a copy of the License at
957
+ *
958
+ * http://www.apache.org/licenses/LICENSE-2.0
959
+ *
960
+ * Unless required by applicable law or agreed to in writing, software
961
+ * distributed under the License is distributed on an "AS IS" BASIS,
962
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
963
+ * See the License for the specific language governing permissions and
964
+ * limitations under the License.
965
+ */
966
+
946
967
  /**
947
968
  * @public
948
969
  * Represents a Media Over QUIC Transport (MOQT) client session.
@@ -957,7 +978,7 @@ declare class RecvDatagramStream {
957
978
  *
958
979
  * ### Connect and Subscribe to a Track
959
980
  * ```ts
960
- * const client = await MOQtailClient.new({ url, supportedVersions: [0xff00000b] });
981
+ * const client = await MOQtailClient.new({ url });
961
982
  * const result = await client.subscribe({
962
983
  * fullTrackName,
963
984
  * filterType: FilterType.LatestObject,
@@ -965,7 +986,7 @@ declare class RecvDatagramStream {
965
986
  * groupOrder: GroupOrder.Original,
966
987
  * priority: 0
967
988
  * });
968
- * if (!(result instanceof SubscribeError)) {
989
+ * if (!(result instanceof RequestError)) {
969
990
  * for await (const object of result.stream) {
970
991
  * // Consume MOQT objects
971
992
  * }
@@ -974,9 +995,9 @@ declare class RecvDatagramStream {
974
995
  *
975
996
  * ### Publish a namespace for Publishing
976
997
  * ```ts
977
- * const client = await MOQtailClient.new({ url, supportedVersions: [0xff00000b] });
998
+ * const client = await MOQtailClient.new({ url });
978
999
  * const publishNamespaceResult = await client.publishNamespace(["camera", "main"]);
979
- * if (!(publishNamespaceResult instanceof PublishNamespaceError)) {
1000
+ * if (!(publishNamespaceResult instanceof RequestError)) {
980
1001
  * // Ready to publish objects under this namespace
981
1002
  * }
982
1003
  * ```
@@ -1070,7 +1091,7 @@ declare class MOQtailClient {
1070
1091
  */
1071
1092
  onGoaway?: (msg: GoAway) => void;
1072
1093
  /**
1073
- * Fired if the underlying WebTransport session fails (ready closed prematurely).
1094
+ * Fired if the underlying WebTransport session fails (ready -\> closed prematurely).
1074
1095
  * Use to log or alert on transport errors.
1075
1096
  * Lifecycle/error handler.
1076
1097
  */
@@ -1112,15 +1133,19 @@ declare class MOQtailClient {
1112
1133
  */
1113
1134
  onError?: (er: unknown) => void;
1114
1135
  /** Invoked for each decoded datagram object/status arriving. */
1115
- onDatagramReceived?: (data: DatagramObject | DatagramStatus) => void;
1136
+ onDatagramReceived?: (data: Datagram) => void;
1116
1137
  /** Invoked after enqueuing each outbound datagram object/status. */
1117
- onDatagramSent?: (data: DatagramObject | DatagramStatus) => void;
1138
+ onDatagramSent?: (data: Datagram) => void;
1118
1139
  /** Fired when an inbound PUBLISH control message is received. */
1119
1140
  onPeerPublish?: (msg: Publish, stream: ReadableStream<MoqtObject>) => void;
1120
1141
  /** Fired when an inbound PUBLISH_DONE control message is received. */
1121
1142
  onPeerPublishDone?: (msg: PublishDone) => void;
1122
1143
  /** Fired when an inbound SUBSCRIBE_NAMESPACE control message is received. */
1123
1144
  onPeerSubscribeNamespace?: (msg: SubscribeNamespace) => void;
1145
+ /** Fired when a NAMESPACE message arrives on a SUBSCRIBE_NAMESPACE bi-stream (prefix + suffix). */
1146
+ onPeerNamespace?: (prefix: Tuple, suffix: Tuple) => void;
1147
+ /** Fired when a NAMESPACE_DONE message arrives on a SUBSCRIBE_NAMESPACE bi-stream (prefix + suffix). */
1148
+ onPeerNamespaceDone?: (prefix: Tuple, suffix: Tuple) => void;
1124
1149
  /**
1125
1150
  * Stream of all received MoqtObjects from datagrams across all tracks
1126
1151
  * Consumer should filter by fullTrackName as needed
@@ -1143,6 +1168,16 @@ declare class MOQtailClient {
1143
1168
  * Returns true if datagram support is currently active
1144
1169
  */
1145
1170
  get isDatagramsEnabled(): boolean;
1171
+ /**
1172
+ * Sets the global log level for all moqtail-ts loggers.
1173
+ * @param level - The minimum {@link LogLevel} to output. Use `LogLevel.NONE` to silence all logs.
1174
+ */
1175
+ static setLogLevel(level: LogLevel): void;
1176
+ /**
1177
+ * Restricts log output to the specified module names. Pass `null` to allow all modules.
1178
+ * @param modules - Array of module name strings, or `null` to enable all modules.
1179
+ */
1180
+ static setLogEnabledModules(modules: string[] | null): void;
1146
1181
  private constructor();
1147
1182
  /**
1148
1183
  * Establishes a new {@link MOQtailClient} session over WebTransport and performs the MOQT setup handshake.
@@ -1156,8 +1191,7 @@ declare class MOQtailClient {
1156
1191
  * @example Minimal connection
1157
1192
  * ```ts
1158
1193
  * const client = await MOQtailClient.new({
1159
- * url: 'https://relay.example.com/transport',
1160
- * supportedVersions: [0xff00000b]
1194
+ * url: 'https://relay.example.com/transport'
1161
1195
  * });
1162
1196
  * ```
1163
1197
  *
@@ -1165,7 +1199,6 @@ declare class MOQtailClient {
1165
1199
  * ```ts
1166
1200
  * const client = await MOQtailClient.new({
1167
1201
  * url,
1168
- * supportedVersions: [0xff00000b],
1169
1202
  * setupParameters: new SetupParameters().addMaxRequestId(1000),
1170
1203
  * transportOptions: { congestionControl: 'default' },
1171
1204
  * dataStreamTimeoutMs: 5000,
@@ -1354,11 +1387,11 @@ declare class MOQtailClient {
1354
1387
  * - `filterType: AbsoluteRange` lets you specify a start and end group, both of should be in the future; the stream waits for those objects. If the start location is \< the latest object
1355
1388
  * observed at the publisher then it behaves as `filterType: LatestObject`.
1356
1389
  *
1357
- * The method returns either a {@link SubscribeError} (on refusal) or an object with the subscription `requestId` and a `ReadableStream` of {@link MoqtObject}s.
1390
+ * The method returns either a {@link RequestError} (on refusal) or an object with the subscription `requestId` and a `ReadableStream` of {@link MoqtObject}s.
1358
1391
  * Use the `requestId` for {@link MOQtailClient.unsubscribe} or {@link MOQtailClient.subscribeUpdate}. Use the `stream` to decode and display objects.
1359
1392
  *
1360
1393
  * @param args - {@link SubscribeOptions} describing the subscription window and relay forwarding behavior.
1361
- * @returns Either a {@link SubscribeError} or `{ requestId, stream }` for consuming objects.
1394
+ * @returns Either a {@link RequestError} or `{ requestId, stream }` for consuming objects.
1362
1395
  * @throws : {@link MOQtailError} If the client is destroyed.
1363
1396
  * @throws : {@link ProtocolViolationError} If required fields are missing or inconsistent.
1364
1397
  * @throws : {@link InternalError} On transport/protocol failure (disconnect is triggered before rethrow).
@@ -1372,7 +1405,7 @@ declare class MOQtailClient {
1372
1405
  * groupOrder: GroupOrder.Original,
1373
1406
  * priority: 32
1374
1407
  * });
1375
- * if (!(result instanceof SubscribeError)) {
1408
+ * if (!(result instanceof RequestError)) {
1376
1409
  * for await (const obj of result.stream) {
1377
1410
  * // decode and display obj
1378
1411
  * }
@@ -1392,7 +1425,7 @@ declare class MOQtailClient {
1392
1425
  * });
1393
1426
  * ```
1394
1427
  */
1395
- subscribe(args: SubscribeOptions): Promise<SubscribeError | {
1428
+ subscribe(args: SubscribeOptions): Promise<RequestError | {
1396
1429
  requestId: bigint;
1397
1430
  stream: ReadableStream<MoqtObject>;
1398
1431
  }>;
@@ -1417,7 +1450,7 @@ declare class MOQtailClient {
1417
1450
  * @example Subscribe and later unsubscribe
1418
1451
  * ```ts
1419
1452
  * const sub = await client.subscribe({ fullTrackName, filterType: FilterType.LatestObject, forward: true, groupOrder: GroupOrder.Original, priority: 0 });
1420
- * if (!(sub instanceof SubscribeError)) {
1453
+ * if (!(sub instanceof RequestError)) {
1421
1454
  * // ...consume objects...
1422
1455
  * await client.unsubscribe(sub.requestId);
1423
1456
  * }
@@ -1489,7 +1522,7 @@ declare class MOQtailClient {
1489
1522
  * await client.switch({ subscriptionRequestId, fullTrackName: newTrackName });
1490
1523
  * ```
1491
1524
  */
1492
- switch(args: SwitchOptions): Promise<SubscribeError | {
1525
+ switch(args: SwitchOptions): Promise<RequestError | {
1493
1526
  requestId: bigint;
1494
1527
  stream: ReadableStream<MoqtObject>;
1495
1528
  }>;
@@ -1497,7 +1530,7 @@ declare class MOQtailClient {
1497
1530
  * One-shot retrieval of a bounded object span, optionally anchored to an existing subscription, returning a stream of {@link MoqtObject}s.
1498
1531
  *
1499
1532
  * Choose a fetch type via `typeAndProps.type`:
1500
- * - StandAlone: Historical slice of a specific {@link FullTrackName} independent of active subscriptions.
1533
+ * - Standalone: Historical slice of a specific {@link FullTrackName} independent of active subscriptions.
1501
1534
  * - Relative: Range relative to the JOINING subscription's current (largest) location; use when you want "N groups back" from live.
1502
1535
  * - Absolute: Absolute group/object offsets tied to an existing subscription (stable anchor) even if that subscription keeps forwarding.
1503
1536
  *
@@ -1507,7 +1540,7 @@ declare class MOQtailClient {
1507
1540
  * - typeAndProps: Discriminated union carrying parameters specific to each fetch mode (see examples).
1508
1541
  * - parameters: Optional version-specific extension block.
1509
1542
  *
1510
- * Returns either a {@link FetchError} (refusal / invalid request at protocol level) or `{ requestId, stream }` whose `stream`
1543
+ * Returns either a {@link RequestError} (refusal / invalid request at protocol level) or `{ requestId, stream }` whose `stream`
1511
1544
  * ends naturally after the bounded range completes (no explicit cancel needed for normal completion).
1512
1545
  *
1513
1546
  * Use cases:
@@ -1530,11 +1563,11 @@ declare class MOQtailClient {
1530
1563
  * priority: 64,
1531
1564
  * groupOrder: GroupOrder.Original,
1532
1565
  * typeAndProps: {
1533
- * type: FetchType.StandAlone,
1566
+ * type: FetchType.Standalone,
1534
1567
  * props: { fullTrackName, startLocation, endLocation }
1535
1568
  * }
1536
1569
  * })
1537
- * if (!(r instanceof FetchError)) {
1570
+ * if (!(r instanceof RequestError)) {
1538
1571
  * for await (const obj of r.stream as any) {
1539
1572
  * // consume objects then stream ends automatically
1540
1573
  * }
@@ -1544,7 +1577,7 @@ declare class MOQtailClient {
1544
1577
  * @example Relative to live subscription (e.g. last 5 groups)
1545
1578
  * ```ts
1546
1579
  * const sub = await client.subscribe({ fullTrackName, filterType: FilterType.LatestObject, forward: true, groupOrder: GroupOrder.Original, priority: 0 })
1547
- * if (!(sub instanceof SubscribeError)) {
1580
+ * if (!(sub instanceof RequestError)) {
1548
1581
  * const slice = await client.fetch({
1549
1582
  * priority: 32,
1550
1583
  * groupOrder: GroupOrder.Original,
@@ -1553,7 +1586,7 @@ declare class MOQtailClient {
1553
1586
  * }
1554
1587
  * ```
1555
1588
  */
1556
- fetch(args: FetchOptions): Promise<FetchError | {
1589
+ fetch(args: FetchOptions): Promise<RequestError | {
1557
1590
  requestId: bigint;
1558
1591
  stream: ReadableStream<MoqtObject>;
1559
1592
  }>;
@@ -1579,8 +1612,8 @@ declare class MOQtailClient {
1579
1612
  *
1580
1613
  * @example Cancel shortly after starting
1581
1614
  * ```ts
1582
- * const r = await client.fetch({ priority: 32, groupOrder: GroupOrder.Original, typeAndProps: { type: FetchType.StandAlone, props: { fullTrackName, startLocation, endLocation } } })
1583
- * if (!(r instanceof FetchError)) {
1615
+ * const r = await client.fetch({ priority: 32, groupOrder: GroupOrder.Original, typeAndProps: { type: FetchType.Standalone, props: { fullTrackName, startLocation, endLocation } } })
1616
+ * if (!(r instanceof RequestError)) {
1584
1617
  * // user navigated away
1585
1618
  * await client.fetchCancel(r.requestId)
1586
1619
  * }
@@ -1596,7 +1629,7 @@ declare class MOQtailClient {
1596
1629
  /**
1597
1630
  * Proactively push a track to the relay/peer.
1598
1631
  */
1599
- publish(fullTrackName: FullTrackName, forward: boolean, trackAlias: bigint, parameters?: VersionSpecificParameters): Promise<PublishError | {
1632
+ publish(fullTrackName: FullTrackName, forward: boolean, trackAlias: bigint, parameters?: MessageParameter[], trackExtensions?: TrackExtension[]): Promise<RequestError | {
1600
1633
  requestId: bigint;
1601
1634
  trackAlias: bigint;
1602
1635
  }>;
@@ -1623,9 +1656,9 @@ declare class MOQtailClient {
1623
1656
  *
1624
1657
  * Parameter semantics:
1625
1658
  * - trackNamespace: Tuple representing the namespace prefix (e.g. ["camera","main"]). All tracks whose full names start with this tuple are considered within the announce scope.
1626
- * - parameters: Optional {@link VersionSpecificParameters}; omitted =\> default instance.
1659
+ * - parameters: Optional {@link MessageParameters}; omitted =\> default instance.
1627
1660
  *
1628
- * Returns: {@link PublishNamespaceOk} on success (namespace added to `announcedNamespaces`) or {@link PublishNamespaceError} explaining refusal.
1661
+ * Returns: {@link RequestOk} on success (namespace added to `announcedNamespaces`) or {@link RequestError} explaining refusal.
1629
1662
  *
1630
1663
  * Use cases:
1631
1664
  * - Make a camera or sensor namespace available before any objects are pushed.
@@ -1643,18 +1676,18 @@ declare class MOQtailClient {
1643
1676
  * @example Minimal announce
1644
1677
  * ```ts
1645
1678
  * const res = await client.publishNamespace(["camera","main"])
1646
- * if (res instanceof PublishNamespaceOk) {
1679
+ * if (res instanceof RequestOk) {
1647
1680
  * // ready to publish objects under tracks with this namespace prefix
1648
1681
  * }
1649
1682
  * ```
1650
1683
  *
1651
1684
  * @example PublishNamespace with parameters block
1652
1685
  * ```ts
1653
- * const params = new VersionSpecificParameters().setSomeExtensionFlag(true)
1686
+ * const params = new MessageParameters().setSomeExtensionFlag(true)
1654
1687
  * const resp = await client.publishNamespace(["room","1234"], params)
1655
1688
  * ```
1656
1689
  */
1657
- publishNamespace(trackNamespace: Tuple, parameters?: VersionSpecificParameters): Promise<PublishNamespaceError | PublishNamespaceOk>;
1690
+ publishNamespace(trackNamespace: Tuple, parameters?: MessageParameter[]): Promise<RequestOk | RequestError>;
1658
1691
  /**
1659
1692
  * Withdraw a previously announced namespace so new subscribers no longer discover its tracks.
1660
1693
  *
@@ -1716,10 +1749,43 @@ declare class MOQtailClient {
1716
1749
  * ```
1717
1750
  */
1718
1751
  publishNamespaceCancel(msg: PublishNamespaceCancel): Promise<void>;
1719
- subscribeNamespace(trackNamespacePrefix: Tuple, parameters?: VersionSpecificParameters): Promise<SubscribeNamespaceError | SubscribeNamespaceOk>;
1752
+ subscribeNamespace(trackNamespacePrefix: Tuple, subscribeOptions?: NamespaceSubscribeOptions, parameters?: MessageParameter[]): Promise<{
1753
+ response: RequestOk | RequestError;
1754
+ cancel: () => Promise<void>;
1755
+ }>;
1720
1756
  unsubscribeNamespace(msg: UnsubscribeNamespace): Promise<void>;
1721
1757
  }
1722
1758
 
1759
+ /**
1760
+ * Copyright 2026 The MOQtail Authors
1761
+ *
1762
+ * Licensed under the Apache License, Version 2.0 (the "License");
1763
+ * you may not use this file except in compliance with the License.
1764
+ * You may obtain a copy of the License at
1765
+ *
1766
+ * http://www.apache.org/licenses/LICENSE-2.0
1767
+ *
1768
+ * Unless required by applicable law or agreed to in writing, software
1769
+ * distributed under the License is distributed on an "AS IS" BASIS,
1770
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1771
+ * See the License for the specific language governing permissions and
1772
+ * limitations under the License.
1773
+ */
1774
+
1775
+ declare class TrackStatusRequest implements PromiseLike<RequestOk | RequestError> {
1776
+ readonly requestId: bigint;
1777
+ readonly message: TrackStatus;
1778
+ private _resolve;
1779
+ private _reject;
1780
+ private promise;
1781
+ constructor(msg: TrackStatus);
1782
+ resolve(value: RequestOk | RequestError | PromiseLike<RequestOk | RequestError>): void;
1783
+ reject(reason?: any): void;
1784
+ then<TResult1 = RequestOk | RequestError, TResult2 = never>(onfulfilled?: ((value: RequestOk | RequestError) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): PromiseLike<TResult1 | TResult2>;
1785
+ catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<RequestOk | RequestError | TResult>;
1786
+ finally(onfinally?: (() => void) | undefined | null): Promise<RequestOk | RequestError>;
1787
+ }
1788
+
1723
1789
  /**
1724
1790
  * Copyright 2025 The MOQtail Authors
1725
1791
  *
@@ -1754,4 +1820,4 @@ declare class RecvStream {
1754
1820
  static new(readStream: ReadableStream<Uint8Array>, partialDataTimeout?: number, onDataReceived?: (data: SubgroupObject | SubgroupHeader | FetchObject | FetchHeader) => void): Promise<RecvStream>;
1755
1821
  }
1756
1822
 
1757
- export { ControlStream, type FetchOptions, FetchPublication, FetchRequest, HybridTrackSource, type LiveObjectSource, LiveTrackSource, MOQtailClient, type MOQtailClientOptions, type MOQtailRequest, MemoryObjectCache, type ObjectCache, type PastObjectSource, PublishNamespaceRequest, PublishPublication, PublishRequest, RecvDatagramStream, RecvStream, RingBufferObjectCache, SendDatagramStream, SendStream, StaticTrackSource, SubscribeNamespaceRequest, type SubscribeOptions, SubscribePublication, SubscribeRequest, type SubscribeUpdateOptions, type SwitchOptions, type Track, type TrackSource };
1823
+ export { ControlStream, type FetchOptions, FetchPublication, FetchRequest, HybridTrackSource, type LiveObjectSource, LiveTrackSource, MOQtailClient, type MOQtailClientOptions, type MOQtailRequest, MemoryObjectCache, type ObjectCache, type PastObjectSource, PublishNamespaceRequest, PublishPublication, PublishRequest, RecvDatagramStream, RecvStream, RingBufferObjectCache, SendDatagramStream, SendStream, StaticTrackSource, SubscribeNamespaceRequest, type SubscribeOptions, SubscribePublication, SubscribeRequest, type SubscribeUpdateOptions, type SwitchOptions, type Track, type TrackSource, TrackStatusRequest };