@urun-sh/core 0.2.4 → 0.2.5

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 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-QU4I4XC5.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
+ 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-XOU67U3G.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};
@@ -95,6 +95,19 @@ type TransportState = 'connecting' | 'connected' | 'reconnecting' | 'renegotiati
95
95
 
96
96
  type SessionPhaseName = 'idle' | 'queued' | 'provisioning' | 'connecting' | 'live' | 'error' | 'ended';
97
97
 
98
+ type SessionFailureKind = 'create-failed' | 'never-live' | 'transport-failed' | 'media-permission' | 'ended';
99
+
100
+ interface SessionPhaseError {
101
+
102
+ reason: string;
103
+
104
+ code?: string;
105
+
106
+ kind?: SessionFailureKind;
107
+
108
+ httpStatus?: number;
109
+ }
110
+
98
111
  interface SessionPhase {
99
112
 
100
113
  name: SessionPhaseName;
@@ -108,10 +121,29 @@ interface SessionPhase {
108
121
 
109
122
  sessionId?: string;
110
123
 
111
- error?: {
112
- reason: string;
113
- code?: string;
124
+ error?: SessionPhaseError;
125
+ }
126
+
127
+ interface SessionStatus {
128
+
129
+ phase: SessionPhaseName;
130
+
131
+ transportState: TransportState;
132
+
133
+ sessionId?: string;
134
+
135
+ requestId?: string;
136
+
137
+ lastServerStatus?: string;
138
+
139
+ elapsedMs?: number;
140
+
141
+ queue?: {
142
+ position: number;
143
+ depth: number;
114
144
  };
145
+
146
+ error?: SessionPhaseError;
115
147
  }
116
148
 
117
149
  interface TransportSessionOptions {
@@ -314,6 +346,8 @@ interface Session {
314
346
 
315
347
  readonly phase: SessionPhase;
316
348
 
349
+ readonly status: SessionStatus;
350
+
317
351
  stream(name: string): SessionStream;
318
352
 
319
353
  doc(key: string): SessionDocument;
@@ -570,6 +604,12 @@ declare class TransportSession {
570
604
  private _requestId;
571
605
  private _liveReached;
572
606
 
607
+ private _lastServerStatus;
608
+
609
+ private _forceResolveOnNextConnect;
610
+
611
+ private _connectStartedAt;
612
+
573
613
  private _mediaMonitorTimer;
574
614
 
575
615
  private _lastInboundTotal;
@@ -609,6 +649,8 @@ declare class TransportSession {
609
649
 
610
650
  get currentIncarnation(): number;
611
651
  get phase(): SessionPhase;
652
+
653
+ get status(): SessionStatus;
612
654
  get sessionId(): string | null;
613
655
  get tracks(): Map<string, MediaStreamTrack>;
614
656
  get multiplexer(): ChannelMultiplexer | null;
@@ -660,6 +702,8 @@ declare class TransportSession {
660
702
  private _flushStreamSubscribes;
661
703
  private _handleMessage;
662
704
 
705
+ private _onServerError;
706
+
663
707
  private _onStreamSeeked;
664
708
 
665
709
  private _onStatus;
@@ -713,6 +757,8 @@ declare class TransportSession {
713
757
  private _setPhase;
714
758
 
715
759
  private _emitError;
760
+
761
+ reportAllocationFailure(error: Error, httpStatus?: number): void;
716
762
  }
717
763
 
718
764
  interface StreamDataTransport {
@@ -746,4 +792,4 @@ interface DataChannelTransport {
746
792
 
747
793
  declare function transportStreamData(transport: DataChannelTransport): StreamDataTransport;
748
794
 
749
- export { mediaRecorderChunkSource as $, type AccessTokenOptions as A, type SceneGraph as B, type ChannelEndpoint as C, DeferredChannelMultiplexer as D, type Session as E, type SessionDocument as F, type SessionPhase as G, type SessionPhaseName as H, type SessionStartOptions as I, type SessionStream as J, type SessionText as K, type Layer as L, type MediaChunkBinding as M, type Store as N, type StoreOptions as O, type Presence as P, type StreamChunkOptions as Q, type Recording as R, type SceneContext as S, type StreamDataTransport as T, TransportSession as U, type TransportSessionOptions as V, type TransportState as W, createPresence as X, createWebsocketDocConnector as Y, deriveYjsServerUrl as Z, isPendingRecording as _, type App as a, streamDataLabel as a0, transportStreamData as a1, 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 };
795
+ export { createWebsocketDocConnector as $, type AccessTokenOptions as A, type SceneGraph as B, type ChannelEndpoint as C, DeferredChannelMultiplexer as D, type Session as E, type SessionDocument as F, type SessionFailureKind as G, type SessionPhase as H, type SessionPhaseError as I, type SessionPhaseName as J, type SessionStartOptions as K, type Layer as L, type MediaChunkBinding as M, type SessionStatus as N, type SessionStream as O, type Presence as P, type SessionText as Q, type Recording as R, type SceneContext as S, type Store as T, type StoreOptions as U, type StreamChunkOptions as V, type StreamDataTransport as W, TransportSession as X, type TransportSessionOptions as Y, type TransportState as Z, createPresence as _, type App as a, deriveYjsServerUrl as a0, isPendingRecording as a1, mediaRecorderChunkSource as a2, streamDataLabel as a3, transportStreamData as a4, 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 };
@@ -95,6 +95,19 @@ type TransportState = 'connecting' | 'connected' | 'reconnecting' | 'renegotiati
95
95
 
96
96
  type SessionPhaseName = 'idle' | 'queued' | 'provisioning' | 'connecting' | 'live' | 'error' | 'ended';
97
97
 
98
+ type SessionFailureKind = 'create-failed' | 'never-live' | 'transport-failed' | 'media-permission' | 'ended';
99
+
100
+ interface SessionPhaseError {
101
+
102
+ reason: string;
103
+
104
+ code?: string;
105
+
106
+ kind?: SessionFailureKind;
107
+
108
+ httpStatus?: number;
109
+ }
110
+
98
111
  interface SessionPhase {
99
112
 
100
113
  name: SessionPhaseName;
@@ -108,10 +121,29 @@ interface SessionPhase {
108
121
 
109
122
  sessionId?: string;
110
123
 
111
- error?: {
112
- reason: string;
113
- code?: string;
124
+ error?: SessionPhaseError;
125
+ }
126
+
127
+ interface SessionStatus {
128
+
129
+ phase: SessionPhaseName;
130
+
131
+ transportState: TransportState;
132
+
133
+ sessionId?: string;
134
+
135
+ requestId?: string;
136
+
137
+ lastServerStatus?: string;
138
+
139
+ elapsedMs?: number;
140
+
141
+ queue?: {
142
+ position: number;
143
+ depth: number;
114
144
  };
145
+
146
+ error?: SessionPhaseError;
115
147
  }
116
148
 
117
149
  interface TransportSessionOptions {
@@ -314,6 +346,8 @@ interface Session {
314
346
 
315
347
  readonly phase: SessionPhase;
316
348
 
349
+ readonly status: SessionStatus;
350
+
317
351
  stream(name: string): SessionStream;
318
352
 
319
353
  doc(key: string): SessionDocument;
@@ -570,6 +604,12 @@ declare class TransportSession {
570
604
  private _requestId;
571
605
  private _liveReached;
572
606
 
607
+ private _lastServerStatus;
608
+
609
+ private _forceResolveOnNextConnect;
610
+
611
+ private _connectStartedAt;
612
+
573
613
  private _mediaMonitorTimer;
574
614
 
575
615
  private _lastInboundTotal;
@@ -609,6 +649,8 @@ declare class TransportSession {
609
649
 
610
650
  get currentIncarnation(): number;
611
651
  get phase(): SessionPhase;
652
+
653
+ get status(): SessionStatus;
612
654
  get sessionId(): string | null;
613
655
  get tracks(): Map<string, MediaStreamTrack>;
614
656
  get multiplexer(): ChannelMultiplexer | null;
@@ -660,6 +702,8 @@ declare class TransportSession {
660
702
  private _flushStreamSubscribes;
661
703
  private _handleMessage;
662
704
 
705
+ private _onServerError;
706
+
663
707
  private _onStreamSeeked;
664
708
 
665
709
  private _onStatus;
@@ -713,6 +757,8 @@ declare class TransportSession {
713
757
  private _setPhase;
714
758
 
715
759
  private _emitError;
760
+
761
+ reportAllocationFailure(error: Error, httpStatus?: number): void;
716
762
  }
717
763
 
718
764
  interface StreamDataTransport {
@@ -746,4 +792,4 @@ interface DataChannelTransport {
746
792
 
747
793
  declare function transportStreamData(transport: DataChannelTransport): StreamDataTransport;
748
794
 
749
- export { mediaRecorderChunkSource as $, type AccessTokenOptions as A, type SceneGraph as B, type ChannelEndpoint as C, DeferredChannelMultiplexer as D, type Session as E, type SessionDocument as F, type SessionPhase as G, type SessionPhaseName as H, type SessionStartOptions as I, type SessionStream as J, type SessionText as K, type Layer as L, type MediaChunkBinding as M, type Store as N, type StoreOptions as O, type Presence as P, type StreamChunkOptions as Q, type Recording as R, type SceneContext as S, type StreamDataTransport as T, TransportSession as U, type TransportSessionOptions as V, type TransportState as W, createPresence as X, createWebsocketDocConnector as Y, deriveYjsServerUrl as Z, isPendingRecording as _, type App as a, streamDataLabel as a0, transportStreamData as a1, 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 };
795
+ export { createWebsocketDocConnector as $, type AccessTokenOptions as A, type SceneGraph as B, type ChannelEndpoint as C, DeferredChannelMultiplexer as D, type Session as E, type SessionDocument as F, type SessionFailureKind as G, type SessionPhase as H, type SessionPhaseError as I, type SessionPhaseName as J, type SessionStartOptions as K, type Layer as L, type MediaChunkBinding as M, type SessionStatus as N, type SessionStream as O, type Presence as P, type SessionText as Q, type Recording as R, type SceneContext as S, type Store as T, type StoreOptions as U, type StreamChunkOptions as V, type StreamDataTransport as W, TransportSession as X, type TransportSessionOptions as Y, type TransportState as Z, createPresence as _, type App as a, deriveYjsServerUrl as a0, isPendingRecording as a1, mediaRecorderChunkSource as a2, streamDataLabel as a3, transportStreamData as a4, 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@urun-sh/core",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "Core transport and channel primitives for the urun TypeScript SDK",
5
5
  "repository": {
6
6
  "type": "git",