@urun-sh/core 0.2.7 → 0.2.9

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,2 +1,2 @@
1
1
  import { createRequire as __urunCreateRequire } from 'node:module'; const require = globalThis.require ?? __urunCreateRequire(import.meta.url);
2
- 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,k as c,l as i,m as f,n as x,o as l}from"./chunk-YYZIRCR7.mjs";export{e as ChannelMultiplexer,r as DeferredChannelMultiplexer,f as DeferredDocConnector,n as LoopbackStreamData,x as SessionDocumentImpl,m as TransportSession,l as createPresence,i as createWebsocketDocConnector,c as deriveYjsServerUrl,a as ensureNodeWebRTC,o as isNodeRuntime,t as nodeMediasoupHandlerName,s as streamDataLabel,p as transportStreamData};
2
+ import{A as f,B as x,C,D as l,a as e,b as r,q as o,r as t,s as a,u as n,v as p,w as s,x as m,y as c,z as i}from"./chunk-7DY3HQ7G.mjs";export{e as ChannelMultiplexer,c as DOC_SYNC_WIRE_CONTRACT_VERSION,r as DeferredChannelMultiplexer,x as DeferredDocConnector,n as LoopbackStreamData,C as SessionDocumentImpl,m as TransportSession,l as createPresence,f as createWebsocketDocConnector,i as deriveYjsServerUrl,a as ensureNodeWebRTC,o as isNodeRuntime,t as nodeMediasoupHandlerName,s as streamDataLabel,p as transportStreamData};
@@ -33,6 +33,8 @@ interface MediaRecorderChunkSourceOptions {
33
33
 
34
34
  declare function mediaRecorderChunkSource(binding: MediaChunkBinding, options?: MediaRecorderChunkSourceOptions): MediaChunkSource;
35
35
 
36
+ declare const DOC_SYNC_WIRE_CONTRACT_VERSION = 1;
37
+
36
38
  interface DocConnection {
37
39
 
38
40
  readonly awareness: Awareness;
@@ -41,6 +43,8 @@ interface DocConnection {
41
43
 
42
44
  onSync(handler: (synced: boolean) => void): () => void;
43
45
 
46
+ ensureConnected?(): void;
47
+
44
48
  destroy(): void;
45
49
  }
46
50
 
@@ -93,7 +97,7 @@ declare function createPresence(awareness: Awareness): Presence;
93
97
 
94
98
  type TransportState = 'connecting' | 'connected' | 'reconnecting' | 'renegotiating' | 'disconnected' | 'failed';
95
99
 
96
- type SessionPhaseName = 'idle' | 'queued' | 'unavailable' | 'provisioning' | 'connecting' | 'live' | 'error' | 'ended';
100
+ type SessionPhaseName = 'idle' | 'queued' | 'unavailable' | 'provisioning' | 'connecting' | 'live' | 'error' | 'ended' | 'expired';
97
101
 
98
102
  interface RuntimeAvailability {
99
103
  state: 'unavailable' | 'starting' | 'busy';
@@ -101,7 +105,7 @@ interface RuntimeAvailability {
101
105
  reason?: string;
102
106
  }
103
107
 
104
- type SessionFailureKind = 'create-failed' | 'never-live' | 'transport-failed' | 'media-permission' | 'ended';
108
+ type SessionFailureKind = 'create-failed' | 'never-live' | 'transport-failed' | 'media-permission' | 'ended' | 'runtime-failed' | 'expired';
105
109
 
106
110
  interface SessionPhaseError {
107
111
 
@@ -125,10 +129,14 @@ interface SessionPhase {
125
129
 
126
130
  runtime?: RuntimeAvailability;
127
131
 
132
+ wakingSince?: number;
133
+
128
134
  requestId?: string;
129
135
 
130
136
  sessionId?: string;
131
137
 
138
+ endsAt?: Date;
139
+
132
140
  error?: SessionPhaseError;
133
141
  }
134
142
 
@@ -153,6 +161,10 @@ interface SessionStatus {
153
161
 
154
162
  runtime?: RuntimeAvailability;
155
163
 
164
+ endsAt?: Date;
165
+
166
+ wakingSince?: number;
167
+
156
168
  error?: SessionPhaseError;
157
169
  }
158
170
 
@@ -356,6 +368,8 @@ interface Session {
356
368
 
357
369
  readonly phase: SessionPhase;
358
370
 
371
+ readonly endsAt: Date | null;
372
+
359
373
  readonly status: SessionStatus;
360
374
 
361
375
  stream(name: string): SessionStream;
@@ -381,6 +395,10 @@ interface Session {
381
395
 
382
396
  readonly artifacts: RuntimeArtifactsAccessor;
383
397
 
398
+ recover(): void;
399
+
400
+ onRecovery(hook: () => void): () => void;
401
+
384
402
  disconnect(): void;
385
403
  }
386
404
 
@@ -549,6 +567,8 @@ interface TransportConnection {
549
567
  jwt?: string;
550
568
 
551
569
  iceServers?: RTCIceServer[];
570
+
571
+ endsAt?: Date | null;
552
572
  }
553
573
  declare function streamDataLabel(name: string): string;
554
574
  interface TransportEvents {
@@ -594,6 +614,8 @@ declare class TransportSession {
594
614
  private _consumers;
595
615
  private _audioProducer;
596
616
  private _videoProducer;
617
+ private _publishedAudio;
618
+ private _publishedVideo;
597
619
  private _pendingProduce;
598
620
  private _multiplexer;
599
621
  private _reconnectAttempts;
@@ -616,10 +638,14 @@ declare class TransportSession {
616
638
 
617
639
  private _lastServerStatus;
618
640
 
641
+ private _endsAt;
642
+
619
643
  private _forceResolveOnNextConnect;
620
644
 
621
645
  private _connectStartedAt;
622
646
 
647
+ private _wakingSince;
648
+
623
649
  private _mediaMonitorTimer;
624
650
 
625
651
  private _lastInboundTotal;
@@ -662,6 +688,12 @@ declare class TransportSession {
662
688
  get currentIncarnation(): number;
663
689
  get phase(): SessionPhase;
664
690
 
691
+ get endsAt(): Date | null;
692
+
693
+ setEndsAt(endsAt: Date | null): void;
694
+
695
+ private _pastDeadline;
696
+
665
697
  get status(): SessionStatus;
666
698
  get sessionId(): string | null;
667
699
  get tracks(): Map<string, MediaStreamTrack>;
@@ -742,6 +774,8 @@ declare class TransportSession {
742
774
  private _clearSendIceRestart;
743
775
  private _onCreateSendTransport;
744
776
 
777
+ private _republishPublishedTracks;
778
+
745
779
  private _onConsumeData;
746
780
  private _onConsume;
747
781
 
@@ -758,6 +792,8 @@ declare class TransportSession {
758
792
  private _checkDecodeLiveness;
759
793
 
760
794
  private _renegotiate;
795
+
796
+ recover(): void;
761
797
  private _attemptReconnect;
762
798
  private _connectUrls;
763
799
  private _connectOnce;
@@ -772,6 +808,8 @@ declare class TransportSession {
772
808
  private _send;
773
809
  private _setState;
774
810
 
811
+
812
+ private _isTerminalPhase;
775
813
  private _setPhase;
776
814
 
777
815
  reportAdmission(update: {
@@ -813,6 +851,8 @@ declare class SessionDocumentImpl implements SessionDocument {
813
851
 
814
852
  get synced(): boolean;
815
853
 
854
+ ensureConnected(): void;
855
+
816
856
  onSynced(handler: () => void): () => void;
817
857
 
818
858
  set(patch: Record<string, unknown>): void;
@@ -871,4 +911,4 @@ interface DataChannelTransport {
871
911
 
872
912
  declare function transportStreamData(transport: DataChannelTransport): StreamDataTransport;
873
913
 
874
- export { type TransportState as $, type AccessTokenOptions as A, type RuntimeAvailability as B, type ChannelEndpoint as C, DeferredChannelMultiplexer as D, type SceneGraph as E, type Session as F, type SessionDocument as G, SessionDocumentImpl as H, type SessionFailureKind as I, type SessionPhase as J, type SessionPhaseError as K, type Layer as L, type MediaChunkBinding as M, type SessionPhaseName as N, type SessionStartOptions as O, type Presence as P, type SessionStatus as Q, type Recording as R, type SceneContext as S, type SessionStream as T, type SessionText as U, type Store as V, type StoreOptions as W, type StreamChunkOptions as X, type StreamDataTransport as Y, TransportSession as Z, type TransportSessionOptions as _, type App as a, createPresence as a0, createWebsocketDocConnector as a1, deriveYjsServerUrl as a2, isPendingRecording as a3, mediaRecorderChunkSource as a4, streamDataLabel as a5, transportStreamData as a6, 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 RuntimeArtifact as x, type RuntimeArtifactDownload as y, type RuntimeArtifactsAccessor as z };
914
+ export { type TransportSessionOptions as $, type AccessTokenOptions as A, type RuntimeArtifactsAccessor as B, type ChannelEndpoint as C, DOC_SYNC_WIRE_CONTRACT_VERSION as D, type RuntimeAvailability as E, type SceneGraph as F, type Session as G, type SessionDocument as H, SessionDocumentImpl as I, type SessionFailureKind as J, type SessionPhase as K, type Layer as L, type MediaChunkBinding as M, type SessionPhaseError as N, type SessionPhaseName as O, type Presence as P, type SessionStartOptions as Q, type Recording as R, type SceneContext as S, type SessionStatus as T, type SessionStream as U, type SessionText as V, type Store as W, type StoreOptions as X, type StreamChunkOptions as Y, type StreamDataTransport as Z, TransportSession as _, type App as a, type TransportState as a0, createPresence as a1, createWebsocketDocConnector as a2, deriveYjsServerUrl as a3, isPendingRecording as a4, mediaRecorderChunkSource as a5, streamDataLabel as a6, transportStreamData as a7, type AppOptions as b, type AttachOptions as c, type ChannelMessage as d, ChannelMultiplexer as e, type ChannelName as f, type ChunkReadable as g, DeferredChannelMultiplexer as h, DeferredDocConnector as i, type DocConnection as j, type DocConnector as k, type LayoutConfig as l, type LayoutContext as m, LoopbackStreamData as n, type MediaChunkSource as o, type MediaChunkSourceFactory as p, type MediaRecorderChunkSourceOptions as q, type PresenceState as r, type RecordingBucket as s, type RecordingLifecycle as t, type RecordingStatus as u, type RecordingsAccessor as v, type RequestOptions as w, type RequestStreamOptions as x, type RuntimeArtifact as y, type RuntimeArtifactDownload as z };
@@ -33,6 +33,8 @@ interface MediaRecorderChunkSourceOptions {
33
33
 
34
34
  declare function mediaRecorderChunkSource(binding: MediaChunkBinding, options?: MediaRecorderChunkSourceOptions): MediaChunkSource;
35
35
 
36
+ declare const DOC_SYNC_WIRE_CONTRACT_VERSION = 1;
37
+
36
38
  interface DocConnection {
37
39
 
38
40
  readonly awareness: Awareness;
@@ -41,6 +43,8 @@ interface DocConnection {
41
43
 
42
44
  onSync(handler: (synced: boolean) => void): () => void;
43
45
 
46
+ ensureConnected?(): void;
47
+
44
48
  destroy(): void;
45
49
  }
46
50
 
@@ -93,7 +97,7 @@ declare function createPresence(awareness: Awareness): Presence;
93
97
 
94
98
  type TransportState = 'connecting' | 'connected' | 'reconnecting' | 'renegotiating' | 'disconnected' | 'failed';
95
99
 
96
- type SessionPhaseName = 'idle' | 'queued' | 'unavailable' | 'provisioning' | 'connecting' | 'live' | 'error' | 'ended';
100
+ type SessionPhaseName = 'idle' | 'queued' | 'unavailable' | 'provisioning' | 'connecting' | 'live' | 'error' | 'ended' | 'expired';
97
101
 
98
102
  interface RuntimeAvailability {
99
103
  state: 'unavailable' | 'starting' | 'busy';
@@ -101,7 +105,7 @@ interface RuntimeAvailability {
101
105
  reason?: string;
102
106
  }
103
107
 
104
- type SessionFailureKind = 'create-failed' | 'never-live' | 'transport-failed' | 'media-permission' | 'ended';
108
+ type SessionFailureKind = 'create-failed' | 'never-live' | 'transport-failed' | 'media-permission' | 'ended' | 'runtime-failed' | 'expired';
105
109
 
106
110
  interface SessionPhaseError {
107
111
 
@@ -125,10 +129,14 @@ interface SessionPhase {
125
129
 
126
130
  runtime?: RuntimeAvailability;
127
131
 
132
+ wakingSince?: number;
133
+
128
134
  requestId?: string;
129
135
 
130
136
  sessionId?: string;
131
137
 
138
+ endsAt?: Date;
139
+
132
140
  error?: SessionPhaseError;
133
141
  }
134
142
 
@@ -153,6 +161,10 @@ interface SessionStatus {
153
161
 
154
162
  runtime?: RuntimeAvailability;
155
163
 
164
+ endsAt?: Date;
165
+
166
+ wakingSince?: number;
167
+
156
168
  error?: SessionPhaseError;
157
169
  }
158
170
 
@@ -356,6 +368,8 @@ interface Session {
356
368
 
357
369
  readonly phase: SessionPhase;
358
370
 
371
+ readonly endsAt: Date | null;
372
+
359
373
  readonly status: SessionStatus;
360
374
 
361
375
  stream(name: string): SessionStream;
@@ -381,6 +395,10 @@ interface Session {
381
395
 
382
396
  readonly artifacts: RuntimeArtifactsAccessor;
383
397
 
398
+ recover(): void;
399
+
400
+ onRecovery(hook: () => void): () => void;
401
+
384
402
  disconnect(): void;
385
403
  }
386
404
 
@@ -549,6 +567,8 @@ interface TransportConnection {
549
567
  jwt?: string;
550
568
 
551
569
  iceServers?: RTCIceServer[];
570
+
571
+ endsAt?: Date | null;
552
572
  }
553
573
  declare function streamDataLabel(name: string): string;
554
574
  interface TransportEvents {
@@ -594,6 +614,8 @@ declare class TransportSession {
594
614
  private _consumers;
595
615
  private _audioProducer;
596
616
  private _videoProducer;
617
+ private _publishedAudio;
618
+ private _publishedVideo;
597
619
  private _pendingProduce;
598
620
  private _multiplexer;
599
621
  private _reconnectAttempts;
@@ -616,10 +638,14 @@ declare class TransportSession {
616
638
 
617
639
  private _lastServerStatus;
618
640
 
641
+ private _endsAt;
642
+
619
643
  private _forceResolveOnNextConnect;
620
644
 
621
645
  private _connectStartedAt;
622
646
 
647
+ private _wakingSince;
648
+
623
649
  private _mediaMonitorTimer;
624
650
 
625
651
  private _lastInboundTotal;
@@ -662,6 +688,12 @@ declare class TransportSession {
662
688
  get currentIncarnation(): number;
663
689
  get phase(): SessionPhase;
664
690
 
691
+ get endsAt(): Date | null;
692
+
693
+ setEndsAt(endsAt: Date | null): void;
694
+
695
+ private _pastDeadline;
696
+
665
697
  get status(): SessionStatus;
666
698
  get sessionId(): string | null;
667
699
  get tracks(): Map<string, MediaStreamTrack>;
@@ -742,6 +774,8 @@ declare class TransportSession {
742
774
  private _clearSendIceRestart;
743
775
  private _onCreateSendTransport;
744
776
 
777
+ private _republishPublishedTracks;
778
+
745
779
  private _onConsumeData;
746
780
  private _onConsume;
747
781
 
@@ -758,6 +792,8 @@ declare class TransportSession {
758
792
  private _checkDecodeLiveness;
759
793
 
760
794
  private _renegotiate;
795
+
796
+ recover(): void;
761
797
  private _attemptReconnect;
762
798
  private _connectUrls;
763
799
  private _connectOnce;
@@ -772,6 +808,8 @@ declare class TransportSession {
772
808
  private _send;
773
809
  private _setState;
774
810
 
811
+
812
+ private _isTerminalPhase;
775
813
  private _setPhase;
776
814
 
777
815
  reportAdmission(update: {
@@ -813,6 +851,8 @@ declare class SessionDocumentImpl implements SessionDocument {
813
851
 
814
852
  get synced(): boolean;
815
853
 
854
+ ensureConnected(): void;
855
+
816
856
  onSynced(handler: () => void): () => void;
817
857
 
818
858
  set(patch: Record<string, unknown>): void;
@@ -871,4 +911,4 @@ interface DataChannelTransport {
871
911
 
872
912
  declare function transportStreamData(transport: DataChannelTransport): StreamDataTransport;
873
913
 
874
- export { type TransportState as $, type AccessTokenOptions as A, type RuntimeAvailability as B, type ChannelEndpoint as C, DeferredChannelMultiplexer as D, type SceneGraph as E, type Session as F, type SessionDocument as G, SessionDocumentImpl as H, type SessionFailureKind as I, type SessionPhase as J, type SessionPhaseError as K, type Layer as L, type MediaChunkBinding as M, type SessionPhaseName as N, type SessionStartOptions as O, type Presence as P, type SessionStatus as Q, type Recording as R, type SceneContext as S, type SessionStream as T, type SessionText as U, type Store as V, type StoreOptions as W, type StreamChunkOptions as X, type StreamDataTransport as Y, TransportSession as Z, type TransportSessionOptions as _, type App as a, createPresence as a0, createWebsocketDocConnector as a1, deriveYjsServerUrl as a2, isPendingRecording as a3, mediaRecorderChunkSource as a4, streamDataLabel as a5, transportStreamData as a6, 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 RuntimeArtifact as x, type RuntimeArtifactDownload as y, type RuntimeArtifactsAccessor as z };
914
+ export { type TransportSessionOptions as $, type AccessTokenOptions as A, type RuntimeArtifactsAccessor as B, type ChannelEndpoint as C, DOC_SYNC_WIRE_CONTRACT_VERSION as D, type RuntimeAvailability as E, type SceneGraph as F, type Session as G, type SessionDocument as H, SessionDocumentImpl as I, type SessionFailureKind as J, type SessionPhase as K, type Layer as L, type MediaChunkBinding as M, type SessionPhaseError as N, type SessionPhaseName as O, type Presence as P, type SessionStartOptions as Q, type Recording as R, type SceneContext as S, type SessionStatus as T, type SessionStream as U, type SessionText as V, type Store as W, type StoreOptions as X, type StreamChunkOptions as Y, type StreamDataTransport as Z, TransportSession as _, type App as a, type TransportState as a0, createPresence as a1, createWebsocketDocConnector as a2, deriveYjsServerUrl as a3, isPendingRecording as a4, mediaRecorderChunkSource as a5, streamDataLabel as a6, transportStreamData as a7, type AppOptions as b, type AttachOptions as c, type ChannelMessage as d, ChannelMultiplexer as e, type ChannelName as f, type ChunkReadable as g, DeferredChannelMultiplexer as h, DeferredDocConnector as i, type DocConnection as j, type DocConnector as k, type LayoutConfig as l, type LayoutContext as m, LoopbackStreamData as n, type MediaChunkSource as o, type MediaChunkSourceFactory as p, type MediaRecorderChunkSourceOptions as q, type PresenceState as r, type RecordingBucket as s, type RecordingLifecycle as t, type RecordingStatus as u, type RecordingsAccessor as v, type RequestOptions as w, type RequestStreamOptions as x, type RuntimeArtifact as y, type RuntimeArtifactDownload as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@urun-sh/core",
3
- "version": "0.2.7",
3
+ "version": "0.2.9",
4
4
  "description": "Core transport and channel primitives for the urun TypeScript SDK",
5
5
  "repository": {
6
6
  "type": "git",