@urun-sh/core 0.1.47 → 0.2.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/internal.mjs CHANGED
@@ -1 +1 @@
1
- import{a as e,b as o,c as r,d as n,e as t,g as s,h as p,i as a}from"./chunk-O7ZS2RQJ.mjs";export{e as ChannelMultiplexer,o as DeferredChannelMultiplexer,a as TransportSession,p as decodeDocSyncFrame,s as encodeDocSyncFrame,t as ensureNodeWebRTC,r as isNodeRuntime,n as nodeMediasoupHandlerName};
1
+ import{a as e,b as r,c as o,d as t,e as a,g as n,h as p,i as s,j as m,l as c,m as i,n as f,o as x}from"./chunk-2TYDFOWI.mjs";export{e as ChannelMultiplexer,r as DeferredChannelMultiplexer,f as DeferredDocConnector,n as LoopbackStreamData,m as TransportSession,x as createPresence,i as createWebsocketDocConnector,c as deriveYjsServerUrl,a as ensureNodeWebRTC,o as isNodeRuntime,t as nodeMediasoupHandlerName,s as streamDataLabel,p as transportStreamData};
@@ -1,4 +1,95 @@
1
+ import * as Y from 'yjs';
2
+ import { Awareness } from 'y-protocols/awareness';
1
3
 
4
+ interface MediaChunkSource {
5
+
6
+ start(onChunk: (chunk: Uint8Array) => void, onEnd: () => void): void;
7
+
8
+ stop(): void;
9
+ }
10
+
11
+ interface MediaChunkBinding {
12
+
13
+ track(): MediaStreamTrack | null;
14
+
15
+ onTrack(cb: (track: MediaStreamTrack | null) => void): () => void;
16
+ }
17
+
18
+ type MediaChunkSourceFactory = (binding: MediaChunkBinding) => MediaChunkSource;
19
+
20
+ type ChunkReadable = ReadableStream<Uint8Array> & AsyncIterable<Uint8Array>;
21
+
22
+ interface StreamChunkOptions {
23
+
24
+ source?: MediaChunkSourceFactory;
25
+ }
26
+
27
+ interface MediaRecorderChunkSourceOptions {
28
+
29
+ mimeType?: string;
30
+
31
+ timesliceMs?: number;
32
+ }
33
+
34
+ declare function mediaRecorderChunkSource(binding: MediaChunkBinding, options?: MediaRecorderChunkSourceOptions): MediaChunkSource;
35
+
36
+ interface DocConnection {
37
+
38
+ readonly awareness: Awareness;
39
+
40
+ readonly synced: boolean;
41
+
42
+ onSync(handler: (synced: boolean) => void): () => void;
43
+
44
+ destroy(): void;
45
+ }
46
+
47
+ type DocConnector = (docName: string, doc: Y.Doc, awareness: Awareness) => DocConnection;
48
+
49
+ declare function deriveYjsServerUrl(signalingWsUrl: string): string;
50
+
51
+ interface WebsocketDocConnectorOptions {
52
+
53
+ serverUrl: string;
54
+
55
+ sessionId: string;
56
+
57
+ token?: string;
58
+
59
+ WebSocketPolyfill?: typeof WebSocket;
60
+ }
61
+
62
+ declare function createWebsocketDocConnector(opts: WebsocketDocConnectorOptions): DocConnector;
63
+
64
+ declare class DeferredDocConnector {
65
+ private _target;
66
+ private _bridges;
67
+
68
+ readonly connect: DocConnector;
69
+
70
+ get connected(): boolean;
71
+
72
+ setTarget(target: DocConnector): void;
73
+ }
74
+
75
+ type PresenceState = Record<string, unknown>;
76
+
77
+ interface Presence {
78
+
79
+ readonly clientId: number;
80
+
81
+ set(state: PresenceState | null): void;
82
+
83
+ setField(field: string, value: unknown): void;
84
+
85
+ getLocal(): PresenceState | null;
86
+
87
+ getStates(): Map<number, PresenceState>;
88
+
89
+ on(event: 'change', handler: (states: Map<number, PresenceState>) => void): () => void;
90
+ }
91
+
92
+ declare function createPresence(awareness: Awareness): Presence;
2
93
 
3
94
  type TransportState = 'connecting' | 'connected' | 'reconnecting' | 'renegotiating' | 'disconnected' | 'failed';
4
95
 
@@ -190,6 +281,10 @@ interface SessionStream {
190
281
 
191
282
  seek(target: number | 'live'): Promise<void>;
192
283
 
284
+ chunks(options?: StreamChunkOptions): ChunkReadable;
285
+
286
+ onSeeked(handler: (target: number | 'live') => void): () => void;
287
+
193
288
  on(event: 'track', handler: (track: MediaStreamTrack | null) => void): () => void;
194
289
 
195
290
  messages(): AsyncIterable<unknown>;
@@ -223,6 +318,8 @@ interface Session {
223
318
 
224
319
  doc(key: string): SessionDocument;
225
320
 
321
+ readonly presence: Presence;
322
+
226
323
  request(payload: unknown, options?: RequestOptions): Promise<unknown>;
227
324
 
228
325
  requestStream(payload: unknown, options?: RequestStreamOptions): AsyncIterable<string>;
@@ -231,9 +328,71 @@ interface Session {
231
328
 
232
329
  onPhase(handler: (phase: SessionPhase) => void): () => void;
233
330
 
331
+ readonly recordings: RecordingsAccessor;
332
+
234
333
  disconnect(): void;
235
334
  }
236
335
 
336
+ type RecordingBucket = 'temp' | 'pinned';
337
+
338
+ type RecordingLifecycle = 'temp' | 'pinned' | 'permanent';
339
+
340
+ type RecordingStatus = 'active' | 'deleting' | 'deleted' | 'pending_pin' | 'pending_unpin' | 'pending_permanent' | 'pending_delete';
341
+
342
+ interface Recording {
343
+
344
+ id: string;
345
+
346
+ org_id: string;
347
+
348
+ session_id: string;
349
+
350
+ stream_name: string;
351
+
352
+ bucket: RecordingBucket;
353
+
354
+ s3_key: string;
355
+
356
+ init_key: string;
357
+
358
+ manifest_key: string;
359
+
360
+ expires_at: string | null;
361
+
362
+ lifecycle: RecordingLifecycle;
363
+
364
+ retention: string | null;
365
+
366
+ size_bytes: number | null;
367
+
368
+ duration_s: number | null;
369
+
370
+ status: RecordingStatus;
371
+
372
+ created_at: string;
373
+
374
+ updated_at: string;
375
+ }
376
+
377
+ declare function isPendingRecording(recording: Pick<Recording, 'status'>): boolean;
378
+
379
+ interface RecordingsAccessor {
380
+
381
+ list(sessionId?: string): Promise<Recording[]>;
382
+
383
+ get(id: string): Promise<Recording>;
384
+
385
+ retain(id: string, duration: string): Promise<Recording>;
386
+
387
+ pin(id: string): Promise<Recording>;
388
+
389
+ unpin(id: string): Promise<Recording>;
390
+
391
+ permanent(id: string): Promise<Recording>;
392
+
393
+ delete(id: string): Promise<Recording>;
394
+ }
395
+
237
396
  interface AppOptions {
238
397
 
239
398
  baseUrl: string;
@@ -247,6 +406,8 @@ interface AppOptions {
247
406
  getAccessToken?: (options?: AccessTokenOptions) => string | null | undefined | Promise<string | null | undefined>;
248
407
 
249
408
  authProvider?: string;
409
+
410
+ functionsUrl?: string;
250
411
  }
251
412
  interface AccessTokenOptions {
252
413
  forceRefresh?: boolean;
@@ -266,6 +427,8 @@ interface AttachOptions {
266
427
  getAccessToken?: (options?: AccessTokenOptions) => string | null | undefined | Promise<string | null | undefined>;
267
428
 
268
429
  authProvider?: string;
430
+
431
+ functionsUrl?: string;
269
432
  }
270
433
 
271
434
  interface App {
@@ -315,13 +478,7 @@ interface TransportConnection {
315
478
 
316
479
  iceServers?: RTCIceServer[];
317
480
  }
318
-
319
- declare function encodeDocSyncFrame(docKey: string, payload: Uint8Array): Uint8Array;
320
-
321
- declare function decodeDocSyncFrame(frame: Uint8Array): {
322
- docKey: string;
323
- payload: Uint8Array;
324
- } | null;
481
+ declare function streamDataLabel(name: string): string;
325
482
  interface TransportEvents {
326
483
  connected: () => void;
327
484
  disconnected: () => void;
@@ -330,13 +487,11 @@ interface TransportEvents {
330
487
  started: () => void;
331
488
  audioTransportReady: () => void;
332
489
 
333
- docSync: (docKey: string, payload: Uint8Array) => void;
334
-
335
- docSyncReady: () => void;
336
-
337
490
  stateChange: (state: TransportState) => void;
338
491
 
339
492
  phase: (phase: SessionPhase) => void;
493
+
494
+ seeked: (stream: string, target: number | 'live') => void;
340
495
  }
341
496
  interface SessionStartOptions {
342
497
  app?: string;
@@ -401,6 +556,16 @@ declare class TransportSession {
401
556
 
402
557
  private _pendingStreamSubscribes;
403
558
 
559
+ private _streamDataHandlers;
560
+
561
+ private _dataProducers;
562
+
563
+ private _dataProducerPromises;
564
+
565
+ private _dataConsumers;
566
+
567
+ private _pendingDataProduce;
568
+
404
569
  get consumerId(): string;
405
570
  get state(): TransportState;
406
571
 
@@ -429,13 +594,17 @@ declare class TransportSession {
429
594
  on<E extends keyof TransportEvents>(event: E, handler: TransportEvents[E]): () => void;
430
595
  sendInput(data: Record<string, unknown>, sequence?: number): void;
431
596
 
432
- sendDocSync(docKey: string, payload: Uint8Array): void;
597
+ onStreamData(name: string, handler: (payload: unknown) => void): () => void;
598
+
599
+ sendStreamData(name: string, payload: unknown, _options?: {
600
+ to?: string;
601
+ }): void;
433
602
 
434
- onDocSync(docKey: string, handler: (payload: Uint8Array) => void): () => void;
603
+ private _ensureDataProducer;
435
604
 
436
- onDocSyncReady(handler: () => void): () => void;
605
+ private _dispatchStreamData;
437
606
 
438
- private _emitDocSyncFrame;
607
+ private _streamNameFromLabel;
439
608
  addTrack(track: MediaStreamTrack, name?: string): Promise<void>;
440
609
  removeTrack(): void;
441
610
 
@@ -453,6 +622,8 @@ declare class TransportSession {
453
622
  private _flushStreamSubscribes;
454
623
  private _handleMessage;
455
624
 
625
+ private _onStreamSeeked;
626
+
456
627
  private _onStatus;
457
628
  private _onRouterCapabilities;
458
629
  private _onCreateRecvTransport;
@@ -462,6 +633,8 @@ declare class TransportSession {
462
633
 
463
634
  private _failoverRecvToTcp;
464
635
  private _onCreateSendTransport;
636
+
637
+ private _onConsumeData;
465
638
  private _onConsume;
466
639
  private _mediaPollMs;
467
640
  private _mediaStallTimeoutMs;
@@ -479,6 +652,8 @@ declare class TransportSession {
479
652
 
480
653
  private _scheduleReconnectBudgetReset;
481
654
  private _clearReconnectBudgetReset;
655
+
656
+ private _cleanupDataChannels;
482
657
  private _cleanupMedia;
483
658
  private _send;
484
659
  private _setState;
@@ -488,4 +663,35 @@ declare class TransportSession {
488
663
  private _emitError;
489
664
  }
490
665
 
491
- export { type App as A, type ChannelEndpoint as C, DeferredChannelMultiplexer as D, type Layer as L, type RequestOptions as R, type SceneContext as S, TransportSession as T, type AppOptions as a, type AttachOptions as b, type ChannelMessage as c, ChannelMultiplexer as d, type ChannelName as e, type LayoutConfig as f, type LayoutContext as g, type RequestStreamOptions as h, type SceneGraph as i, type Session as j, type SessionDocument as k, type SessionPhase as l, type SessionPhaseName as m, type SessionStartOptions as n, type SessionStream as o, type SessionText as p, type Store as q, type StoreOptions as r, type TransportSessionOptions as s, type TransportState as t, decodeDocSyncFrame as u, encodeDocSyncFrame as v };
666
+ interface StreamDataTransport {
667
+
668
+ readonly consumerId: string;
669
+
670
+ onData(name: string, handler: (payload: unknown) => void): () => void;
671
+
672
+ sendData(name: string, payload: unknown, options?: {
673
+ to?: string;
674
+ }): void;
675
+ }
676
+
677
+ declare class LoopbackStreamData implements StreamDataTransport {
678
+ readonly consumerId: string;
679
+ private _handlers;
680
+ constructor(consumerId?: string);
681
+ onData(name: string, handler: (payload: unknown) => void): () => void;
682
+ sendData(name: string, payload: unknown, options?: {
683
+ to?: string;
684
+ }): void;
685
+ }
686
+
687
+ interface DataChannelTransport {
688
+ readonly consumerId: string;
689
+ onStreamData(name: string, handler: (payload: unknown) => void): () => void;
690
+ sendStreamData(name: string, payload: unknown, options?: {
691
+ to?: string;
692
+ }): void;
693
+ }
694
+
695
+ declare function transportStreamData(transport: DataChannelTransport): StreamDataTransport;
696
+
697
+ export { type AccessTokenOptions as A, type SessionPhase as B, type ChannelEndpoint as C, DeferredChannelMultiplexer as D, type SessionPhaseName as E, type SessionStartOptions as F, type SessionStream as G, type SessionText as H, type Store as I, type StoreOptions as J, type StreamChunkOptions as K, type Layer as L, type MediaChunkBinding as M, type StreamDataTransport as N, type TransportSessionOptions as O, type Presence as P, type TransportState as Q, type Recording as R, type SceneContext as S, TransportSession as T, createPresence as U, createWebsocketDocConnector as V, deriveYjsServerUrl as W, isPendingRecording as X, mediaRecorderChunkSource as Y, streamDataLabel as Z, transportStreamData as _, type App as a, type AppOptions as b, type AttachOptions as c, type ChannelMessage as d, ChannelMultiplexer as e, type ChannelName as f, type ChunkReadable as g, DeferredDocConnector as h, type DocConnection as i, type DocConnector as j, type LayoutConfig as k, type LayoutContext as l, LoopbackStreamData as m, type MediaChunkSource as n, type MediaChunkSourceFactory as o, type MediaRecorderChunkSourceOptions as p, type PresenceState as q, type RecordingBucket as r, type RecordingLifecycle as s, type RecordingStatus as t, type RecordingsAccessor as u, type RequestOptions as v, type RequestStreamOptions as w, type SceneGraph as x, type Session as y, type SessionDocument as z };
@@ -1,4 +1,95 @@
1
+ import * as Y from 'yjs';
2
+ import { Awareness } from 'y-protocols/awareness';
1
3
 
4
+ interface MediaChunkSource {
5
+
6
+ start(onChunk: (chunk: Uint8Array) => void, onEnd: () => void): void;
7
+
8
+ stop(): void;
9
+ }
10
+
11
+ interface MediaChunkBinding {
12
+
13
+ track(): MediaStreamTrack | null;
14
+
15
+ onTrack(cb: (track: MediaStreamTrack | null) => void): () => void;
16
+ }
17
+
18
+ type MediaChunkSourceFactory = (binding: MediaChunkBinding) => MediaChunkSource;
19
+
20
+ type ChunkReadable = ReadableStream<Uint8Array> & AsyncIterable<Uint8Array>;
21
+
22
+ interface StreamChunkOptions {
23
+
24
+ source?: MediaChunkSourceFactory;
25
+ }
26
+
27
+ interface MediaRecorderChunkSourceOptions {
28
+
29
+ mimeType?: string;
30
+
31
+ timesliceMs?: number;
32
+ }
33
+
34
+ declare function mediaRecorderChunkSource(binding: MediaChunkBinding, options?: MediaRecorderChunkSourceOptions): MediaChunkSource;
35
+
36
+ interface DocConnection {
37
+
38
+ readonly awareness: Awareness;
39
+
40
+ readonly synced: boolean;
41
+
42
+ onSync(handler: (synced: boolean) => void): () => void;
43
+
44
+ destroy(): void;
45
+ }
46
+
47
+ type DocConnector = (docName: string, doc: Y.Doc, awareness: Awareness) => DocConnection;
48
+
49
+ declare function deriveYjsServerUrl(signalingWsUrl: string): string;
50
+
51
+ interface WebsocketDocConnectorOptions {
52
+
53
+ serverUrl: string;
54
+
55
+ sessionId: string;
56
+
57
+ token?: string;
58
+
59
+ WebSocketPolyfill?: typeof WebSocket;
60
+ }
61
+
62
+ declare function createWebsocketDocConnector(opts: WebsocketDocConnectorOptions): DocConnector;
63
+
64
+ declare class DeferredDocConnector {
65
+ private _target;
66
+ private _bridges;
67
+
68
+ readonly connect: DocConnector;
69
+
70
+ get connected(): boolean;
71
+
72
+ setTarget(target: DocConnector): void;
73
+ }
74
+
75
+ type PresenceState = Record<string, unknown>;
76
+
77
+ interface Presence {
78
+
79
+ readonly clientId: number;
80
+
81
+ set(state: PresenceState | null): void;
82
+
83
+ setField(field: string, value: unknown): void;
84
+
85
+ getLocal(): PresenceState | null;
86
+
87
+ getStates(): Map<number, PresenceState>;
88
+
89
+ on(event: 'change', handler: (states: Map<number, PresenceState>) => void): () => void;
90
+ }
91
+
92
+ declare function createPresence(awareness: Awareness): Presence;
2
93
 
3
94
  type TransportState = 'connecting' | 'connected' | 'reconnecting' | 'renegotiating' | 'disconnected' | 'failed';
4
95
 
@@ -190,6 +281,10 @@ interface SessionStream {
190
281
 
191
282
  seek(target: number | 'live'): Promise<void>;
192
283
 
284
+ chunks(options?: StreamChunkOptions): ChunkReadable;
285
+
286
+ onSeeked(handler: (target: number | 'live') => void): () => void;
287
+
193
288
  on(event: 'track', handler: (track: MediaStreamTrack | null) => void): () => void;
194
289
 
195
290
  messages(): AsyncIterable<unknown>;
@@ -223,6 +318,8 @@ interface Session {
223
318
 
224
319
  doc(key: string): SessionDocument;
225
320
 
321
+ readonly presence: Presence;
322
+
226
323
  request(payload: unknown, options?: RequestOptions): Promise<unknown>;
227
324
 
228
325
  requestStream(payload: unknown, options?: RequestStreamOptions): AsyncIterable<string>;
@@ -231,9 +328,71 @@ interface Session {
231
328
 
232
329
  onPhase(handler: (phase: SessionPhase) => void): () => void;
233
330
 
331
+ readonly recordings: RecordingsAccessor;
332
+
234
333
  disconnect(): void;
235
334
  }
236
335
 
336
+ type RecordingBucket = 'temp' | 'pinned';
337
+
338
+ type RecordingLifecycle = 'temp' | 'pinned' | 'permanent';
339
+
340
+ type RecordingStatus = 'active' | 'deleting' | 'deleted' | 'pending_pin' | 'pending_unpin' | 'pending_permanent' | 'pending_delete';
341
+
342
+ interface Recording {
343
+
344
+ id: string;
345
+
346
+ org_id: string;
347
+
348
+ session_id: string;
349
+
350
+ stream_name: string;
351
+
352
+ bucket: RecordingBucket;
353
+
354
+ s3_key: string;
355
+
356
+ init_key: string;
357
+
358
+ manifest_key: string;
359
+
360
+ expires_at: string | null;
361
+
362
+ lifecycle: RecordingLifecycle;
363
+
364
+ retention: string | null;
365
+
366
+ size_bytes: number | null;
367
+
368
+ duration_s: number | null;
369
+
370
+ status: RecordingStatus;
371
+
372
+ created_at: string;
373
+
374
+ updated_at: string;
375
+ }
376
+
377
+ declare function isPendingRecording(recording: Pick<Recording, 'status'>): boolean;
378
+
379
+ interface RecordingsAccessor {
380
+
381
+ list(sessionId?: string): Promise<Recording[]>;
382
+
383
+ get(id: string): Promise<Recording>;
384
+
385
+ retain(id: string, duration: string): Promise<Recording>;
386
+
387
+ pin(id: string): Promise<Recording>;
388
+
389
+ unpin(id: string): Promise<Recording>;
390
+
391
+ permanent(id: string): Promise<Recording>;
392
+
393
+ delete(id: string): Promise<Recording>;
394
+ }
395
+
237
396
  interface AppOptions {
238
397
 
239
398
  baseUrl: string;
@@ -247,6 +406,8 @@ interface AppOptions {
247
406
  getAccessToken?: (options?: AccessTokenOptions) => string | null | undefined | Promise<string | null | undefined>;
248
407
 
249
408
  authProvider?: string;
409
+
410
+ functionsUrl?: string;
250
411
  }
251
412
  interface AccessTokenOptions {
252
413
  forceRefresh?: boolean;
@@ -266,6 +427,8 @@ interface AttachOptions {
266
427
  getAccessToken?: (options?: AccessTokenOptions) => string | null | undefined | Promise<string | null | undefined>;
267
428
 
268
429
  authProvider?: string;
430
+
431
+ functionsUrl?: string;
269
432
  }
270
433
 
271
434
  interface App {
@@ -315,13 +478,7 @@ interface TransportConnection {
315
478
 
316
479
  iceServers?: RTCIceServer[];
317
480
  }
318
-
319
- declare function encodeDocSyncFrame(docKey: string, payload: Uint8Array): Uint8Array;
320
-
321
- declare function decodeDocSyncFrame(frame: Uint8Array): {
322
- docKey: string;
323
- payload: Uint8Array;
324
- } | null;
481
+ declare function streamDataLabel(name: string): string;
325
482
  interface TransportEvents {
326
483
  connected: () => void;
327
484
  disconnected: () => void;
@@ -330,13 +487,11 @@ interface TransportEvents {
330
487
  started: () => void;
331
488
  audioTransportReady: () => void;
332
489
 
333
- docSync: (docKey: string, payload: Uint8Array) => void;
334
-
335
- docSyncReady: () => void;
336
-
337
490
  stateChange: (state: TransportState) => void;
338
491
 
339
492
  phase: (phase: SessionPhase) => void;
493
+
494
+ seeked: (stream: string, target: number | 'live') => void;
340
495
  }
341
496
  interface SessionStartOptions {
342
497
  app?: string;
@@ -401,6 +556,16 @@ declare class TransportSession {
401
556
 
402
557
  private _pendingStreamSubscribes;
403
558
 
559
+ private _streamDataHandlers;
560
+
561
+ private _dataProducers;
562
+
563
+ private _dataProducerPromises;
564
+
565
+ private _dataConsumers;
566
+
567
+ private _pendingDataProduce;
568
+
404
569
  get consumerId(): string;
405
570
  get state(): TransportState;
406
571
 
@@ -429,13 +594,17 @@ declare class TransportSession {
429
594
  on<E extends keyof TransportEvents>(event: E, handler: TransportEvents[E]): () => void;
430
595
  sendInput(data: Record<string, unknown>, sequence?: number): void;
431
596
 
432
- sendDocSync(docKey: string, payload: Uint8Array): void;
597
+ onStreamData(name: string, handler: (payload: unknown) => void): () => void;
598
+
599
+ sendStreamData(name: string, payload: unknown, _options?: {
600
+ to?: string;
601
+ }): void;
433
602
 
434
- onDocSync(docKey: string, handler: (payload: Uint8Array) => void): () => void;
603
+ private _ensureDataProducer;
435
604
 
436
- onDocSyncReady(handler: () => void): () => void;
605
+ private _dispatchStreamData;
437
606
 
438
- private _emitDocSyncFrame;
607
+ private _streamNameFromLabel;
439
608
  addTrack(track: MediaStreamTrack, name?: string): Promise<void>;
440
609
  removeTrack(): void;
441
610
 
@@ -453,6 +622,8 @@ declare class TransportSession {
453
622
  private _flushStreamSubscribes;
454
623
  private _handleMessage;
455
624
 
625
+ private _onStreamSeeked;
626
+
456
627
  private _onStatus;
457
628
  private _onRouterCapabilities;
458
629
  private _onCreateRecvTransport;
@@ -462,6 +633,8 @@ declare class TransportSession {
462
633
 
463
634
  private _failoverRecvToTcp;
464
635
  private _onCreateSendTransport;
636
+
637
+ private _onConsumeData;
465
638
  private _onConsume;
466
639
  private _mediaPollMs;
467
640
  private _mediaStallTimeoutMs;
@@ -479,6 +652,8 @@ declare class TransportSession {
479
652
 
480
653
  private _scheduleReconnectBudgetReset;
481
654
  private _clearReconnectBudgetReset;
655
+
656
+ private _cleanupDataChannels;
482
657
  private _cleanupMedia;
483
658
  private _send;
484
659
  private _setState;
@@ -488,4 +663,35 @@ declare class TransportSession {
488
663
  private _emitError;
489
664
  }
490
665
 
491
- export { type App as A, type ChannelEndpoint as C, DeferredChannelMultiplexer as D, type Layer as L, type RequestOptions as R, type SceneContext as S, TransportSession as T, type AppOptions as a, type AttachOptions as b, type ChannelMessage as c, ChannelMultiplexer as d, type ChannelName as e, type LayoutConfig as f, type LayoutContext as g, type RequestStreamOptions as h, type SceneGraph as i, type Session as j, type SessionDocument as k, type SessionPhase as l, type SessionPhaseName as m, type SessionStartOptions as n, type SessionStream as o, type SessionText as p, type Store as q, type StoreOptions as r, type TransportSessionOptions as s, type TransportState as t, decodeDocSyncFrame as u, encodeDocSyncFrame as v };
666
+ interface StreamDataTransport {
667
+
668
+ readonly consumerId: string;
669
+
670
+ onData(name: string, handler: (payload: unknown) => void): () => void;
671
+
672
+ sendData(name: string, payload: unknown, options?: {
673
+ to?: string;
674
+ }): void;
675
+ }
676
+
677
+ declare class LoopbackStreamData implements StreamDataTransport {
678
+ readonly consumerId: string;
679
+ private _handlers;
680
+ constructor(consumerId?: string);
681
+ onData(name: string, handler: (payload: unknown) => void): () => void;
682
+ sendData(name: string, payload: unknown, options?: {
683
+ to?: string;
684
+ }): void;
685
+ }
686
+
687
+ interface DataChannelTransport {
688
+ readonly consumerId: string;
689
+ onStreamData(name: string, handler: (payload: unknown) => void): () => void;
690
+ sendStreamData(name: string, payload: unknown, options?: {
691
+ to?: string;
692
+ }): void;
693
+ }
694
+
695
+ declare function transportStreamData(transport: DataChannelTransport): StreamDataTransport;
696
+
697
+ export { type AccessTokenOptions as A, type SessionPhase as B, type ChannelEndpoint as C, DeferredChannelMultiplexer as D, type SessionPhaseName as E, type SessionStartOptions as F, type SessionStream as G, type SessionText as H, type Store as I, type StoreOptions as J, type StreamChunkOptions as K, type Layer as L, type MediaChunkBinding as M, type StreamDataTransport as N, type TransportSessionOptions as O, type Presence as P, type TransportState as Q, type Recording as R, type SceneContext as S, TransportSession as T, createPresence as U, createWebsocketDocConnector as V, deriveYjsServerUrl as W, isPendingRecording as X, mediaRecorderChunkSource as Y, streamDataLabel as Z, transportStreamData as _, type App as a, type AppOptions as b, type AttachOptions as c, type ChannelMessage as d, ChannelMultiplexer as e, type ChannelName as f, type ChunkReadable as g, DeferredDocConnector as h, type DocConnection as i, type DocConnector as j, type LayoutConfig as k, type LayoutContext as l, LoopbackStreamData as m, type MediaChunkSource as n, type MediaChunkSourceFactory as o, type MediaRecorderChunkSourceOptions as p, type PresenceState as q, type RecordingBucket as r, type RecordingLifecycle as s, type RecordingStatus as t, type RecordingsAccessor as u, type RequestOptions as v, type RequestStreamOptions as w, type SceneGraph as x, type Session as y, type SessionDocument as z };