moqtail 0.7.0 → 0.8.1

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.
@@ -1,5 +1,5 @@
1
- import { w as ControlMessage, U as SubscribeOk, Q as SubscribeError, S as Subscribe, V as SubscribeUpdate, q as PublishDoneStatusCode, x as Fetch, b as PublishNamespaceOk, a as PublishNamespaceError, P as PublishNamespace, A as FetchOk, z as FetchError, J as SubscribeNamespaceOk, I as SubscribeNamespaceError, H as SubscribeNamespace, a5 as SetupParameters, G as GroupOrder, F as FilterType, a7 as VersionSpecificParameters, h as FetchType, a2 as RequestIdMap, Z as PublishNamespaceDone, B as GoAway, a1 as SubgroupHeader, a0 as FetchHeader, E as ServerSetup, c as PublishNamespaceCancel, $ as UnsubscribeNamespace, a3 as Header } from '../version_parameter-DCE9_itC.cjs';
2
- import { n as MoqtObject, L as Location, m as FullTrackName, f as ObjectForwardingPreference, K as KeyValuePair, D as DatagramObject, h as DatagramStatus, c as Tuple, o as SubgroupObject, j as FetchObject } from '../byte_buffer-BOK6VPTF.cjs';
1
+ import { n as MoqtObject, L as Location, m as FullTrackName, f as ObjectForwardingPreference, K as KeyValuePair, D as DatagramObject, h as DatagramStatus, c as Tuple, o as SubgroupObject, j as FetchObject } from '../byte_buffer-BM4uNj4n.cjs';
2
+ import { w as ControlMessage, S as Subscribe, q as PublishDoneStatusCode, V as SubscribeUpdate, x as Fetch, L as Publish, b as PublishNamespaceOk, a as PublishNamespaceError, P as PublishNamespace, A as FetchOk, z as FetchError, U as SubscribeOk, Q as SubscribeError, J as SubscribeNamespaceOk, I as SubscribeNamespaceError, H as SubscribeNamespace, O as PublishOk, N as PublishError, a5 as SetupParameters, G as GroupOrder, F as FilterType, a7 as VersionSpecificParameters, h as FetchType, a2 as RequestIdMap, Z as PublishNamespaceDone, B as GoAway, a1 as SubgroupHeader, a0 as FetchHeader, E as ServerSetup, c as PublishNamespaceCancel, $ as UnsubscribeNamespace, a3 as Header } from '../version_parameter-BpmuiMQj.cjs';
3
3
 
4
4
  /**
5
5
  * Copyright 2025 The MOQtail Authors
@@ -263,48 +263,6 @@ type Track = {
263
263
  trackAlias?: bigint;
264
264
  };
265
265
 
266
- /**
267
- * Copyright 2025 The MOQtail Authors
268
- *
269
- * Licensed under the Apache License, Version 2.0 (the "License");
270
- * you may not use this file except in compliance with the License.
271
- * You may obtain a copy of the License at
272
- *
273
- * http://www.apache.org/licenses/LICENSE-2.0
274
- *
275
- * Unless required by applicable law or agreed to in writing, software
276
- * distributed under the License is distributed on an "AS IS" BASIS,
277
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
278
- * See the License for the specific language governing permissions and
279
- * limitations under the License.
280
- */
281
-
282
- declare class SubscribeRequest implements PromiseLike<SubscribeOk | SubscribeError> {
283
- #private;
284
- requestId: bigint;
285
- fullTrackName: FullTrackName;
286
- isCanceled: boolean;
287
- startLocation: Location | undefined;
288
- endGroup: bigint | undefined;
289
- priority: number;
290
- forward: boolean;
291
- subscribeParameters: KeyValuePair[];
292
- largestLocation: Location | undefined;
293
- streamsAccepted: bigint;
294
- expectedStreams: bigint | undefined;
295
- readonly controller: ReadableStreamDefaultController<MoqtObject>;
296
- readonly stream: ReadableStream<MoqtObject>;
297
- constructor(msg: Subscribe);
298
- update(msg: SubscribeUpdate): void;
299
- switch(newTrackName: FullTrackName, newParameters: KeyValuePair[]): void;
300
- unsubscribe(): void;
301
- resolve(value: SubscribeOk | SubscribeError | PromiseLike<SubscribeOk | SubscribeError>): void;
302
- reject(reason?: any): void;
303
- 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>;
304
- catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<SubscribeOk | SubscribeError | TResult>;
305
- finally(onfinally?: (() => void) | undefined | null): Promise<SubscribeOk | SubscribeError>;
306
- }
307
-
308
266
  /**
309
267
  * Copyright 2025 The MOQtail Authors
310
268
  *
@@ -390,6 +348,56 @@ declare class FetchPublication {
390
348
  publish(): Promise<void>;
391
349
  }
392
350
 
351
+ /**
352
+ * Copyright 2025 The MOQtail Authors
353
+ *
354
+ * Licensed under the Apache License, Version 2.0 (the "License");
355
+ * you may not use this file except in compliance with the License.
356
+ * You may obtain a copy of the License at
357
+ *
358
+ * http://www.apache.org/licenses/LICENSE-2.0
359
+ *
360
+ * Unless required by applicable law or agreed to in writing, software
361
+ * distributed under the License is distributed on an "AS IS" BASIS,
362
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
363
+ * See the License for the specific language governing permissions and
364
+ * limitations under the License.
365
+ */
366
+
367
+ /**
368
+ * @public
369
+ * Manages the proactive publication of MOQT objects from a publisher to the relay.
370
+ * Handles live object streaming and stream management.
371
+ */
372
+ declare class PublishPublication {
373
+ #private;
374
+ private readonly client;
375
+ readonly track: Track;
376
+ private readonly publishMsg;
377
+ /**
378
+ * The latest location that was published to the relay.
379
+ */
380
+ latestLocation: Location | undefined;
381
+ /**
382
+ * Creates a new PublishPublication instance.
383
+ * @param client - The MOQT client managing the connection.
384
+ * @param track - The track being proactively published.
385
+ * @param publishMsg - The publish message that initiated this session.
386
+ */
387
+ constructor(client: MOQtailClient, track: Track, publishMsg: Publish);
388
+ /**
389
+ * Cancels the publication and cleans up resources.
390
+ * Removes the publication from the client's publication map.
391
+ */
392
+ cancel(): void;
393
+ /**
394
+ * Publishes MOQT objects to the relay as they become available.
395
+ * Handles stream creation, object writing, and stream closure.
396
+ * @throws :{@link InternalError} If the track does not support live content.
397
+ */
398
+ publishToRelay(): Promise<void>;
399
+ }
400
+
393
401
  /**
394
402
  * Copyright 2025 The MOQtail Authors
395
403
  *
@@ -454,6 +462,48 @@ declare class FetchRequest implements PromiseLike<FetchOk | FetchError> {
454
462
  finally(onfinally?: (() => void) | undefined | null): Promise<FetchOk | FetchError>;
455
463
  }
456
464
 
465
+ /**
466
+ * Copyright 2025 The MOQtail Authors
467
+ *
468
+ * Licensed under the Apache License, Version 2.0 (the "License");
469
+ * you may not use this file except in compliance with the License.
470
+ * You may obtain a copy of the License at
471
+ *
472
+ * http://www.apache.org/licenses/LICENSE-2.0
473
+ *
474
+ * Unless required by applicable law or agreed to in writing, software
475
+ * distributed under the License is distributed on an "AS IS" BASIS,
476
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
477
+ * See the License for the specific language governing permissions and
478
+ * limitations under the License.
479
+ */
480
+
481
+ declare class SubscribeRequest implements PromiseLike<SubscribeOk | SubscribeError> {
482
+ #private;
483
+ requestId: bigint;
484
+ fullTrackName: FullTrackName;
485
+ isCanceled: boolean;
486
+ startLocation: Location | undefined;
487
+ endGroup: bigint | undefined;
488
+ priority: number;
489
+ forward: boolean;
490
+ subscribeParameters: KeyValuePair[];
491
+ largestLocation: Location | undefined;
492
+ streamsAccepted: bigint;
493
+ expectedStreams: bigint | undefined;
494
+ readonly controller: ReadableStreamDefaultController<MoqtObject>;
495
+ readonly stream: ReadableStream<MoqtObject>;
496
+ constructor(msg: Subscribe);
497
+ update(msg: SubscribeUpdate): void;
498
+ switch(newTrackName: FullTrackName, newParameters: KeyValuePair[]): void;
499
+ unsubscribe(): void;
500
+ resolve(value: SubscribeOk | SubscribeError | PromiseLike<SubscribeOk | SubscribeError>): void;
501
+ reject(reason?: any): void;
502
+ 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>;
503
+ catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<SubscribeOk | SubscribeError | TResult>;
504
+ finally(onfinally?: (() => void) | undefined | null): Promise<SubscribeOk | SubscribeError>;
505
+ }
506
+
457
507
  /**
458
508
  * Copyright 2025 The MOQtail Authors
459
509
  *
@@ -476,7 +526,7 @@ declare class SubscribeNamespaceRequest implements PromiseLike<SubscribeNamespac
476
526
  private _resolve;
477
527
  private _reject;
478
528
  private promise;
479
- constructor(requestId: bigint, message: SubscribeNamespace);
529
+ constructor(msg: SubscribeNamespace);
480
530
  resolve(value: SubscribeNamespaceOk | SubscribeNamespaceError | PromiseLike<SubscribeNamespaceOk | SubscribeNamespaceError>): void;
481
531
  reject(reason?: any): void;
482
532
  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>;
@@ -484,6 +534,36 @@ declare class SubscribeNamespaceRequest implements PromiseLike<SubscribeNamespac
484
534
  finally(onfinally?: (() => void) | undefined | null): Promise<SubscribeNamespaceOk | SubscribeNamespaceError>;
485
535
  }
486
536
 
537
+ /**
538
+ * Copyright 2025 The MOQtail Authors
539
+ *
540
+ * Licensed under the Apache License, Version 2.0 (the "License");
541
+ * you may not use this file except in compliance with the License.
542
+ * You may obtain a copy of the License at
543
+ *
544
+ * http://www.apache.org/licenses/LICENSE-2.0
545
+ *
546
+ * Unless required by applicable law or agreed to in writing, software
547
+ * distributed under the License is distributed on an "AS IS" BASIS,
548
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
549
+ * See the License for the specific language governing permissions and
550
+ * limitations under the License.
551
+ */
552
+
553
+ declare class PublishRequest implements PromiseLike<PublishOk | PublishError> {
554
+ readonly requestId: bigint;
555
+ readonly message: Publish;
556
+ private _resolve;
557
+ private _reject;
558
+ private promise;
559
+ constructor(msg: Publish);
560
+ resolve(value: PublishOk | PublishError | PromiseLike<PublishOk | PublishError>): void;
561
+ reject(reason?: any): void;
562
+ 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>;
563
+ catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<PublishOk | PublishError | TResult>;
564
+ finally(onfinally?: (() => void) | undefined | null): Promise<PublishOk | PublishError>;
565
+ }
566
+
487
567
  /**
488
568
  * Copyright 2025 The MOQtail Authors
489
569
  *
@@ -530,7 +610,7 @@ declare class SubscribeNamespaceRequest implements PromiseLike<SubscribeNamespac
530
610
  * }
531
611
  * ```
532
612
  */
533
- type MOQtailRequest = PublishNamespaceRequest | SubscribeNamespaceRequest | FetchRequest | SubscribeRequest;
613
+ type MOQtailRequest = PublishRequest | PublishNamespaceRequest | SubscribeNamespaceRequest | FetchRequest | SubscribeRequest;
534
614
  /**
535
615
  * Options for {@link MOQtailClient.new} controlling connection target, protocol negotiation, timeouts,
536
616
  * and lifecycle callbacks.
@@ -572,7 +652,7 @@ type MOQtailClientOptions = {
572
652
  /** Control stream read timeout in milliseconds. */
573
653
  controlStreamTimeoutMs?: number;
574
654
  /** If true, enables datagram support for the session. */
575
- enableDatagrams: boolean;
655
+ enableDatagrams?: boolean;
576
656
  /** callbacks for observability and logging purposes: */
577
657
  callbacks?: {
578
658
  /** Called after a control message is successfully written to the {@link ControlStream}. */
@@ -864,22 +944,6 @@ declare class RecvDatagramStream {
864
944
  releaseLock(): void;
865
945
  }
866
946
 
867
- /**
868
- * Copyright 2025 The MOQtail Authors
869
- *
870
- * Licensed under the Apache License, Version 2.0 (the "License");
871
- * you may not use this file except in compliance with the License.
872
- * You may obtain a copy of the License at
873
- *
874
- * http://www.apache.org/licenses/LICENSE-2.0
875
- *
876
- * Unless required by applicable law or agreed to in writing, software
877
- * distributed under the License is distributed on an "AS IS" BASIS,
878
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
879
- * See the License for the specific language governing permissions and
880
- * limitations under the License.
881
- */
882
-
883
947
  /**
884
948
  * @public
885
949
  * Represents a Media Over QUIC Transport (MOQT) client session.
@@ -954,12 +1018,12 @@ declare class MOQtailClient {
954
1018
  * Active publications (SUBSCRIBE or FETCH) keyed by requestId to manage object stream controllers and lifecycle.
955
1019
  * Subset / specialization view of `requests`.
956
1020
  */
957
- readonly publications: Map<bigint, SubscribePublication | FetchPublication>;
1021
+ readonly publications: Map<bigint, SubscribePublication | FetchPublication | PublishPublication>;
958
1022
  /**
959
1023
  * Active SUBSCRIBE request wrappers keyed by track alias for rapid alias -\> subscription resolution during
960
1024
  * incoming unidirectional data handling.
961
1025
  */
962
- readonly subscriptions: Map<bigint, SubscribeRequest>;
1026
+ readonly subscriptions: Map<bigint, any>;
963
1027
  /**
964
1028
  * Bidirectional track alias \<-\> subscription requestId mapping
965
1029
  */
@@ -1052,6 +1116,10 @@ declare class MOQtailClient {
1052
1116
  onDatagramReceived?: (data: DatagramObject | DatagramStatus) => void;
1053
1117
  /** Invoked after enqueuing each outbound datagram object/status. */
1054
1118
  onDatagramSent?: (data: DatagramObject | DatagramStatus) => void;
1119
+ /** Fired when an inbound PUBLISH control message is received. */
1120
+ onPeerPublish?: (msg: Publish, stream: ReadableStream<MoqtObject>) => void;
1121
+ /** Fired when an inbound SUBSCRIBE_NAMESPACE control message is received. */
1122
+ onPeerSubscribeNamespace?: (msg: SubscribeNamespace) => void;
1055
1123
  /**
1056
1124
  * Stream of all received MoqtObjects from datagrams across all tracks
1057
1125
  * Consumer should filter by fullTrackName as needed
@@ -1060,6 +1128,10 @@ declare class MOQtailClient {
1060
1128
  * use subscribeToTrackDatagrams() instead
1061
1129
  */
1062
1130
  readonly receivedDatagramObjects: ReadableStream<MoqtObject>;
1131
+ /**
1132
+ * Generates a safe, sequential local request ID for tracking pushed/incoming tracks.
1133
+ */
1134
+ allocatePseudoRequestId(): bigint;
1063
1135
  /**
1064
1136
  * Gets the current server setup configuration.
1065
1137
  *
@@ -1520,6 +1592,20 @@ declare class MOQtailClient {
1520
1592
  * ```
1521
1593
  */
1522
1594
  fetchCancel(requestId: bigint | number): Promise<void>;
1595
+ /**
1596
+ * Proactively push a track to the relay/peer.
1597
+ */
1598
+ publish(fullTrackName: FullTrackName, forward: boolean, trackAlias: bigint, parameters?: VersionSpecificParameters): Promise<PublishError | {
1599
+ requestId: bigint;
1600
+ trackAlias: bigint;
1601
+ }>;
1602
+ /**
1603
+ * Registers an incoming PUBLISH announcement as a valid data receiver.
1604
+ * This prepares the client to ingest pushed data streams matching the published alias.
1605
+ * * @param msg - The incoming Publish control message
1606
+ * @returns - A stream of MoqtObjects being pushed by the publisher
1607
+ */
1608
+ acceptPushedTrack(msg: Publish): ReadableStream<MoqtObject>;
1523
1609
  /**
1524
1610
  * Declare (publish) a track namespace to the peer so subscribers using matching prefixes (via {@link MOQtailClient.subscribeNamespace})
1525
1611
  * can discover and begin subscribing/fetching its tracks.
@@ -1624,7 +1710,7 @@ declare class MOQtailClient {
1624
1710
  * ```
1625
1711
  */
1626
1712
  publishNamespaceCancel(msg: PublishNamespaceCancel): Promise<void>;
1627
- subscribeNamespace(msg: SubscribeNamespace): Promise<void>;
1713
+ subscribeNamespace(trackNamespacePrefix: Tuple, parameters?: VersionSpecificParameters): Promise<SubscribeNamespaceError | SubscribeNamespaceOk>;
1628
1714
  unsubscribeNamespace(msg: UnsubscribeNamespace): Promise<void>;
1629
1715
  }
1630
1716
 
@@ -1662,4 +1748,4 @@ declare class RecvStream {
1662
1748
  static new(readStream: ReadableStream<Uint8Array>, partialDataTimeout?: number, onDataReceived?: (data: SubgroupObject | SubgroupHeader | FetchObject | FetchHeader) => void): Promise<RecvStream>;
1663
1749
  }
1664
1750
 
1665
- export { ControlStream, type FetchOptions, FetchPublication, FetchRequest, HybridTrackSource, type LiveObjectSource, LiveTrackSource, MOQtailClient, type MOQtailClientOptions, type MOQtailRequest, MemoryObjectCache, type ObjectCache, type PastObjectSource, PublishNamespaceRequest, RecvDatagramStream, RecvStream, RingBufferObjectCache, SendDatagramStream, SendStream, StaticTrackSource, SubscribeNamespaceRequest, type SubscribeOptions, SubscribePublication, SubscribeRequest, type SubscribeUpdateOptions, type SwitchOptions, type Track, type TrackSource };
1751
+ 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 };
@@ -1,5 +1,5 @@
1
- import { w as ControlMessage, U as SubscribeOk, Q as SubscribeError, S as Subscribe, V as SubscribeUpdate, q as PublishDoneStatusCode, x as Fetch, b as PublishNamespaceOk, a as PublishNamespaceError, P as PublishNamespace, A as FetchOk, z as FetchError, J as SubscribeNamespaceOk, I as SubscribeNamespaceError, H as SubscribeNamespace, a5 as SetupParameters, G as GroupOrder, F as FilterType, a7 as VersionSpecificParameters, h as FetchType, a2 as RequestIdMap, Z as PublishNamespaceDone, B as GoAway, a1 as SubgroupHeader, a0 as FetchHeader, E as ServerSetup, c as PublishNamespaceCancel, $ as UnsubscribeNamespace, a3 as Header } from '../version_parameter-CgEPNuUt.js';
2
- import { n as MoqtObject, L as Location, m as FullTrackName, f as ObjectForwardingPreference, K as KeyValuePair, D as DatagramObject, h as DatagramStatus, c as Tuple, o as SubgroupObject, j as FetchObject } from '../byte_buffer-BOK6VPTF.js';
1
+ import { n as MoqtObject, L as Location, m as FullTrackName, f as ObjectForwardingPreference, K as KeyValuePair, D as DatagramObject, h as DatagramStatus, c as Tuple, o as SubgroupObject, j as FetchObject } from '../byte_buffer-BM4uNj4n.js';
2
+ import { w as ControlMessage, S as Subscribe, q as PublishDoneStatusCode, V as SubscribeUpdate, x as Fetch, L as Publish, b as PublishNamespaceOk, a as PublishNamespaceError, P as PublishNamespace, A as FetchOk, z as FetchError, U as SubscribeOk, Q as SubscribeError, J as SubscribeNamespaceOk, I as SubscribeNamespaceError, H as SubscribeNamespace, O as PublishOk, N as PublishError, a5 as SetupParameters, G as GroupOrder, F as FilterType, a7 as VersionSpecificParameters, h as FetchType, a2 as RequestIdMap, Z as PublishNamespaceDone, B as GoAway, a1 as SubgroupHeader, a0 as FetchHeader, E as ServerSetup, c as PublishNamespaceCancel, $ as UnsubscribeNamespace, a3 as Header } from '../version_parameter-f75NkWiO.js';
3
3
 
4
4
  /**
5
5
  * Copyright 2025 The MOQtail Authors
@@ -263,48 +263,6 @@ type Track = {
263
263
  trackAlias?: bigint;
264
264
  };
265
265
 
266
- /**
267
- * Copyright 2025 The MOQtail Authors
268
- *
269
- * Licensed under the Apache License, Version 2.0 (the "License");
270
- * you may not use this file except in compliance with the License.
271
- * You may obtain a copy of the License at
272
- *
273
- * http://www.apache.org/licenses/LICENSE-2.0
274
- *
275
- * Unless required by applicable law or agreed to in writing, software
276
- * distributed under the License is distributed on an "AS IS" BASIS,
277
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
278
- * See the License for the specific language governing permissions and
279
- * limitations under the License.
280
- */
281
-
282
- declare class SubscribeRequest implements PromiseLike<SubscribeOk | SubscribeError> {
283
- #private;
284
- requestId: bigint;
285
- fullTrackName: FullTrackName;
286
- isCanceled: boolean;
287
- startLocation: Location | undefined;
288
- endGroup: bigint | undefined;
289
- priority: number;
290
- forward: boolean;
291
- subscribeParameters: KeyValuePair[];
292
- largestLocation: Location | undefined;
293
- streamsAccepted: bigint;
294
- expectedStreams: bigint | undefined;
295
- readonly controller: ReadableStreamDefaultController<MoqtObject>;
296
- readonly stream: ReadableStream<MoqtObject>;
297
- constructor(msg: Subscribe);
298
- update(msg: SubscribeUpdate): void;
299
- switch(newTrackName: FullTrackName, newParameters: KeyValuePair[]): void;
300
- unsubscribe(): void;
301
- resolve(value: SubscribeOk | SubscribeError | PromiseLike<SubscribeOk | SubscribeError>): void;
302
- reject(reason?: any): void;
303
- 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>;
304
- catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<SubscribeOk | SubscribeError | TResult>;
305
- finally(onfinally?: (() => void) | undefined | null): Promise<SubscribeOk | SubscribeError>;
306
- }
307
-
308
266
  /**
309
267
  * Copyright 2025 The MOQtail Authors
310
268
  *
@@ -390,6 +348,56 @@ declare class FetchPublication {
390
348
  publish(): Promise<void>;
391
349
  }
392
350
 
351
+ /**
352
+ * Copyright 2025 The MOQtail Authors
353
+ *
354
+ * Licensed under the Apache License, Version 2.0 (the "License");
355
+ * you may not use this file except in compliance with the License.
356
+ * You may obtain a copy of the License at
357
+ *
358
+ * http://www.apache.org/licenses/LICENSE-2.0
359
+ *
360
+ * Unless required by applicable law or agreed to in writing, software
361
+ * distributed under the License is distributed on an "AS IS" BASIS,
362
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
363
+ * See the License for the specific language governing permissions and
364
+ * limitations under the License.
365
+ */
366
+
367
+ /**
368
+ * @public
369
+ * Manages the proactive publication of MOQT objects from a publisher to the relay.
370
+ * Handles live object streaming and stream management.
371
+ */
372
+ declare class PublishPublication {
373
+ #private;
374
+ private readonly client;
375
+ readonly track: Track;
376
+ private readonly publishMsg;
377
+ /**
378
+ * The latest location that was published to the relay.
379
+ */
380
+ latestLocation: Location | undefined;
381
+ /**
382
+ * Creates a new PublishPublication instance.
383
+ * @param client - The MOQT client managing the connection.
384
+ * @param track - The track being proactively published.
385
+ * @param publishMsg - The publish message that initiated this session.
386
+ */
387
+ constructor(client: MOQtailClient, track: Track, publishMsg: Publish);
388
+ /**
389
+ * Cancels the publication and cleans up resources.
390
+ * Removes the publication from the client's publication map.
391
+ */
392
+ cancel(): void;
393
+ /**
394
+ * Publishes MOQT objects to the relay as they become available.
395
+ * Handles stream creation, object writing, and stream closure.
396
+ * @throws :{@link InternalError} If the track does not support live content.
397
+ */
398
+ publishToRelay(): Promise<void>;
399
+ }
400
+
393
401
  /**
394
402
  * Copyright 2025 The MOQtail Authors
395
403
  *
@@ -454,6 +462,48 @@ declare class FetchRequest implements PromiseLike<FetchOk | FetchError> {
454
462
  finally(onfinally?: (() => void) | undefined | null): Promise<FetchOk | FetchError>;
455
463
  }
456
464
 
465
+ /**
466
+ * Copyright 2025 The MOQtail Authors
467
+ *
468
+ * Licensed under the Apache License, Version 2.0 (the "License");
469
+ * you may not use this file except in compliance with the License.
470
+ * You may obtain a copy of the License at
471
+ *
472
+ * http://www.apache.org/licenses/LICENSE-2.0
473
+ *
474
+ * Unless required by applicable law or agreed to in writing, software
475
+ * distributed under the License is distributed on an "AS IS" BASIS,
476
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
477
+ * See the License for the specific language governing permissions and
478
+ * limitations under the License.
479
+ */
480
+
481
+ declare class SubscribeRequest implements PromiseLike<SubscribeOk | SubscribeError> {
482
+ #private;
483
+ requestId: bigint;
484
+ fullTrackName: FullTrackName;
485
+ isCanceled: boolean;
486
+ startLocation: Location | undefined;
487
+ endGroup: bigint | undefined;
488
+ priority: number;
489
+ forward: boolean;
490
+ subscribeParameters: KeyValuePair[];
491
+ largestLocation: Location | undefined;
492
+ streamsAccepted: bigint;
493
+ expectedStreams: bigint | undefined;
494
+ readonly controller: ReadableStreamDefaultController<MoqtObject>;
495
+ readonly stream: ReadableStream<MoqtObject>;
496
+ constructor(msg: Subscribe);
497
+ update(msg: SubscribeUpdate): void;
498
+ switch(newTrackName: FullTrackName, newParameters: KeyValuePair[]): void;
499
+ unsubscribe(): void;
500
+ resolve(value: SubscribeOk | SubscribeError | PromiseLike<SubscribeOk | SubscribeError>): void;
501
+ reject(reason?: any): void;
502
+ 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>;
503
+ catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<SubscribeOk | SubscribeError | TResult>;
504
+ finally(onfinally?: (() => void) | undefined | null): Promise<SubscribeOk | SubscribeError>;
505
+ }
506
+
457
507
  /**
458
508
  * Copyright 2025 The MOQtail Authors
459
509
  *
@@ -476,7 +526,7 @@ declare class SubscribeNamespaceRequest implements PromiseLike<SubscribeNamespac
476
526
  private _resolve;
477
527
  private _reject;
478
528
  private promise;
479
- constructor(requestId: bigint, message: SubscribeNamespace);
529
+ constructor(msg: SubscribeNamespace);
480
530
  resolve(value: SubscribeNamespaceOk | SubscribeNamespaceError | PromiseLike<SubscribeNamespaceOk | SubscribeNamespaceError>): void;
481
531
  reject(reason?: any): void;
482
532
  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>;
@@ -484,6 +534,36 @@ declare class SubscribeNamespaceRequest implements PromiseLike<SubscribeNamespac
484
534
  finally(onfinally?: (() => void) | undefined | null): Promise<SubscribeNamespaceOk | SubscribeNamespaceError>;
485
535
  }
486
536
 
537
+ /**
538
+ * Copyright 2025 The MOQtail Authors
539
+ *
540
+ * Licensed under the Apache License, Version 2.0 (the "License");
541
+ * you may not use this file except in compliance with the License.
542
+ * You may obtain a copy of the License at
543
+ *
544
+ * http://www.apache.org/licenses/LICENSE-2.0
545
+ *
546
+ * Unless required by applicable law or agreed to in writing, software
547
+ * distributed under the License is distributed on an "AS IS" BASIS,
548
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
549
+ * See the License for the specific language governing permissions and
550
+ * limitations under the License.
551
+ */
552
+
553
+ declare class PublishRequest implements PromiseLike<PublishOk | PublishError> {
554
+ readonly requestId: bigint;
555
+ readonly message: Publish;
556
+ private _resolve;
557
+ private _reject;
558
+ private promise;
559
+ constructor(msg: Publish);
560
+ resolve(value: PublishOk | PublishError | PromiseLike<PublishOk | PublishError>): void;
561
+ reject(reason?: any): void;
562
+ 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>;
563
+ catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<PublishOk | PublishError | TResult>;
564
+ finally(onfinally?: (() => void) | undefined | null): Promise<PublishOk | PublishError>;
565
+ }
566
+
487
567
  /**
488
568
  * Copyright 2025 The MOQtail Authors
489
569
  *
@@ -530,7 +610,7 @@ declare class SubscribeNamespaceRequest implements PromiseLike<SubscribeNamespac
530
610
  * }
531
611
  * ```
532
612
  */
533
- type MOQtailRequest = PublishNamespaceRequest | SubscribeNamespaceRequest | FetchRequest | SubscribeRequest;
613
+ type MOQtailRequest = PublishRequest | PublishNamespaceRequest | SubscribeNamespaceRequest | FetchRequest | SubscribeRequest;
534
614
  /**
535
615
  * Options for {@link MOQtailClient.new} controlling connection target, protocol negotiation, timeouts,
536
616
  * and lifecycle callbacks.
@@ -572,7 +652,7 @@ type MOQtailClientOptions = {
572
652
  /** Control stream read timeout in milliseconds. */
573
653
  controlStreamTimeoutMs?: number;
574
654
  /** If true, enables datagram support for the session. */
575
- enableDatagrams: boolean;
655
+ enableDatagrams?: boolean;
576
656
  /** callbacks for observability and logging purposes: */
577
657
  callbacks?: {
578
658
  /** Called after a control message is successfully written to the {@link ControlStream}. */
@@ -864,22 +944,6 @@ declare class RecvDatagramStream {
864
944
  releaseLock(): void;
865
945
  }
866
946
 
867
- /**
868
- * Copyright 2025 The MOQtail Authors
869
- *
870
- * Licensed under the Apache License, Version 2.0 (the "License");
871
- * you may not use this file except in compliance with the License.
872
- * You may obtain a copy of the License at
873
- *
874
- * http://www.apache.org/licenses/LICENSE-2.0
875
- *
876
- * Unless required by applicable law or agreed to in writing, software
877
- * distributed under the License is distributed on an "AS IS" BASIS,
878
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
879
- * See the License for the specific language governing permissions and
880
- * limitations under the License.
881
- */
882
-
883
947
  /**
884
948
  * @public
885
949
  * Represents a Media Over QUIC Transport (MOQT) client session.
@@ -954,12 +1018,12 @@ declare class MOQtailClient {
954
1018
  * Active publications (SUBSCRIBE or FETCH) keyed by requestId to manage object stream controllers and lifecycle.
955
1019
  * Subset / specialization view of `requests`.
956
1020
  */
957
- readonly publications: Map<bigint, SubscribePublication | FetchPublication>;
1021
+ readonly publications: Map<bigint, SubscribePublication | FetchPublication | PublishPublication>;
958
1022
  /**
959
1023
  * Active SUBSCRIBE request wrappers keyed by track alias for rapid alias -\> subscription resolution during
960
1024
  * incoming unidirectional data handling.
961
1025
  */
962
- readonly subscriptions: Map<bigint, SubscribeRequest>;
1026
+ readonly subscriptions: Map<bigint, any>;
963
1027
  /**
964
1028
  * Bidirectional track alias \<-\> subscription requestId mapping
965
1029
  */
@@ -1052,6 +1116,10 @@ declare class MOQtailClient {
1052
1116
  onDatagramReceived?: (data: DatagramObject | DatagramStatus) => void;
1053
1117
  /** Invoked after enqueuing each outbound datagram object/status. */
1054
1118
  onDatagramSent?: (data: DatagramObject | DatagramStatus) => void;
1119
+ /** Fired when an inbound PUBLISH control message is received. */
1120
+ onPeerPublish?: (msg: Publish, stream: ReadableStream<MoqtObject>) => void;
1121
+ /** Fired when an inbound SUBSCRIBE_NAMESPACE control message is received. */
1122
+ onPeerSubscribeNamespace?: (msg: SubscribeNamespace) => void;
1055
1123
  /**
1056
1124
  * Stream of all received MoqtObjects from datagrams across all tracks
1057
1125
  * Consumer should filter by fullTrackName as needed
@@ -1060,6 +1128,10 @@ declare class MOQtailClient {
1060
1128
  * use subscribeToTrackDatagrams() instead
1061
1129
  */
1062
1130
  readonly receivedDatagramObjects: ReadableStream<MoqtObject>;
1131
+ /**
1132
+ * Generates a safe, sequential local request ID for tracking pushed/incoming tracks.
1133
+ */
1134
+ allocatePseudoRequestId(): bigint;
1063
1135
  /**
1064
1136
  * Gets the current server setup configuration.
1065
1137
  *
@@ -1520,6 +1592,20 @@ declare class MOQtailClient {
1520
1592
  * ```
1521
1593
  */
1522
1594
  fetchCancel(requestId: bigint | number): Promise<void>;
1595
+ /**
1596
+ * Proactively push a track to the relay/peer.
1597
+ */
1598
+ publish(fullTrackName: FullTrackName, forward: boolean, trackAlias: bigint, parameters?: VersionSpecificParameters): Promise<PublishError | {
1599
+ requestId: bigint;
1600
+ trackAlias: bigint;
1601
+ }>;
1602
+ /**
1603
+ * Registers an incoming PUBLISH announcement as a valid data receiver.
1604
+ * This prepares the client to ingest pushed data streams matching the published alias.
1605
+ * * @param msg - The incoming Publish control message
1606
+ * @returns - A stream of MoqtObjects being pushed by the publisher
1607
+ */
1608
+ acceptPushedTrack(msg: Publish): ReadableStream<MoqtObject>;
1523
1609
  /**
1524
1610
  * Declare (publish) a track namespace to the peer so subscribers using matching prefixes (via {@link MOQtailClient.subscribeNamespace})
1525
1611
  * can discover and begin subscribing/fetching its tracks.
@@ -1624,7 +1710,7 @@ declare class MOQtailClient {
1624
1710
  * ```
1625
1711
  */
1626
1712
  publishNamespaceCancel(msg: PublishNamespaceCancel): Promise<void>;
1627
- subscribeNamespace(msg: SubscribeNamespace): Promise<void>;
1713
+ subscribeNamespace(trackNamespacePrefix: Tuple, parameters?: VersionSpecificParameters): Promise<SubscribeNamespaceError | SubscribeNamespaceOk>;
1628
1714
  unsubscribeNamespace(msg: UnsubscribeNamespace): Promise<void>;
1629
1715
  }
1630
1716
 
@@ -1662,4 +1748,4 @@ declare class RecvStream {
1662
1748
  static new(readStream: ReadableStream<Uint8Array>, partialDataTimeout?: number, onDataReceived?: (data: SubgroupObject | SubgroupHeader | FetchObject | FetchHeader) => void): Promise<RecvStream>;
1663
1749
  }
1664
1750
 
1665
- export { ControlStream, type FetchOptions, FetchPublication, FetchRequest, HybridTrackSource, type LiveObjectSource, LiveTrackSource, MOQtailClient, type MOQtailClientOptions, type MOQtailRequest, MemoryObjectCache, type ObjectCache, type PastObjectSource, PublishNamespaceRequest, RecvDatagramStream, RecvStream, RingBufferObjectCache, SendDatagramStream, SendStream, StaticTrackSource, SubscribeNamespaceRequest, type SubscribeOptions, SubscribePublication, SubscribeRequest, type SubscribeUpdateOptions, type SwitchOptions, type Track, type TrackSource };
1751
+ 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 };