@urun-sh/core 0.2.45 → 0.2.47

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{D as r,G as t,H as a,I as n,K as s,L as p,M as m,Q as c,R as i,S as l,T as f,U as x,V as S,W as C,a as e,b as o}from"./chunk-3YI4A64L.mjs";export{e as ChannelMultiplexer,i as DOC_SYNC_WIRE_CONTRACT_VERSION,o as DeferredChannelMultiplexer,x as DeferredDocConnector,s as LoopbackStreamData,S as SessionDocumentImpl,c as TransportSession,r as allocateSession,C as createPresence,f as createWebsocketDocConnector,l as deriveYjsServerUrl,n as ensureNodeWebRTC,t as isNodeRuntime,a as nodeMediasoupHandlerName,m as streamDataLabel,p as transportStreamData};
2
+ import{E as r,H as t,I as n,J as a,L as s,M as p,N as m,R as c,S as i,T as l,U as S,V as f,W as x,X as C,a as e,b as o}from"./chunk-MFBAY7ST.mjs";export{e as ChannelMultiplexer,i as DOC_SYNC_WIRE_CONTRACT_VERSION,o as DeferredChannelMultiplexer,f as DeferredDocConnector,s as LoopbackStreamData,x as SessionDocumentImpl,c as TransportSession,r as allocateSession,C as createPresence,S as createWebsocketDocConnector,l as deriveYjsServerUrl,a as ensureNodeWebRTC,t as isNodeRuntime,n as nodeMediasoupHandlerName,m as streamDataLabel,p as transportStreamData};
@@ -35,6 +35,19 @@ declare function mediaRecorderChunkSource(binding: MediaChunkBinding, options?:
35
35
 
36
36
  declare const DOC_SYNC_WIRE_CONTRACT_VERSION = 1;
37
37
 
38
+ interface DocConnectionState {
39
+
40
+ connected: boolean;
41
+
42
+ consecutiveFailures: number;
43
+
44
+ lastCloseCode: number | null;
45
+
46
+ lastCloseReason: string | null;
47
+ }
48
+
49
+ type DocTokenSupplier = () => string | undefined | Promise<string | undefined>;
50
+
38
51
  interface DocConnection {
39
52
 
40
53
  readonly awareness: Awareness;
@@ -45,6 +58,8 @@ interface DocConnection {
45
58
 
46
59
  ensureConnected?(): void;
47
60
 
61
+ onConnectionState?(handler: (state: DocConnectionState) => void): () => void;
62
+
48
63
  destroy(): void;
49
64
  }
50
65
 
@@ -58,9 +73,13 @@ interface WebsocketDocConnectorOptions {
58
73
 
59
74
  sessionId: string;
60
75
 
61
- token?: string;
76
+ token?: string | DocTokenSupplier;
62
77
 
63
78
  WebSocketPolyfill?: typeof WebSocket;
79
+
80
+ maxBackoffTimeMs?: number;
81
+
82
+ dialTimeoutMs?: number;
64
83
  }
65
84
 
66
85
  declare function createWebsocketDocConnector(opts: WebsocketDocConnectorOptions): DocConnector;
@@ -278,6 +297,8 @@ interface SessionDocument {
278
297
  readonly synced: boolean;
279
298
 
280
299
  onSynced(handler: () => void): () => void;
300
+
301
+ onConnectionState?(handler: (state: DocConnectionState) => void): () => void;
281
302
  }
282
303
 
283
304
  interface SessionStream {
@@ -828,6 +849,8 @@ declare class TransportSession {
828
849
 
829
850
  isStaleClosedMarker(marker: Record<string, unknown> | null | undefined): boolean;
830
851
  connect(startOptions?: SessionStartOptions): Promise<void>;
852
+
853
+ leaveLeg(): boolean;
831
854
  disconnect(): void;
832
855
  on<E extends keyof TransportEvents>(event: E, handler: TransportEvents[E]): () => void;
833
856
 
@@ -972,6 +995,8 @@ declare class SessionDocumentImpl implements SessionDocument {
972
995
 
973
996
  ensureConnected(): void;
974
997
 
998
+ onConnectionState(handler: (state: DocConnectionState) => void): () => void;
999
+
975
1000
  onSynced(handler: () => void): () => void;
976
1001
 
977
1002
  set(patch: Record<string, unknown>): void;
@@ -1030,4 +1055,4 @@ interface DataChannelTransport {
1030
1055
 
1031
1056
  declare function transportStreamData(transport: DataChannelTransport): StreamDataTransport;
1032
1057
 
1033
- export { type SessionStatus as $, type AccessTokenOptions$1 as A, type RecordingLifecycle as B, type ChannelEndpoint as C, DERIVED_LEG_SEP as D, type RecordingStatus as E, type RecordingsAccessor as F, type ReleaseSessionBeaconOptions as G, type RequestOptions as H, type RequestStreamOptions as I, type RuntimeArtifact as J, type RuntimeArtifactDownload as K, LoopbackStreamData as L, type MediaChunkBinding as M, type RuntimeArtifactsAccessor as N, type RuntimeAvailability as O, type Presence as P, type SessionDiagnostic as Q, type Recording as R, type Session as S, type SessionDocument as T, SessionDocumentImpl as U, type SessionEndResult as V, type SessionFailureKind as W, type SessionPhase as X, type SessionPhaseError as Y, type SessionPhaseName as Z, type SessionStartOptions as _, type AccessTokenOptions as a, type SessionStream as a0, type SessionText as a1, type Store as a2, type StoreOptions as a3, type StreamChunkOptions as a4, type StreamDataTransport as a5, TransportSession as a6, type TransportSessionOptions as a7, type TransportState as a8, allocateSession as a9, createPresence as aa, createWebsocketDocConnector as ab, deriveYjsServerUrl as ac, derivedLegName as ad, derivedLegRole as ae, isPendingRecording as af, mediaRecorderChunkSource as ag, prewake as ah, releaseSessionBeacon as ai, streamDataLabel as aj, transportStreamData as ak, type ActivationEvent as b, type ActivationState as c, type AllocateSessionOptions as d, type AllocatedSession as e, type App as f, type AppOptions as g, type AttachOptions as h, type ChannelMessage as i, ChannelMultiplexer as j, type ChannelName as k, type ChunkReadable as l, DOC_SYNC_WIRE_CONTRACT_VERSION as m, DeferredChannelMultiplexer as n, DeferredDocConnector as o, type DerivedLegRole as p, type DocConnection as q, type DocConnector as r, type MediaChunkSource as s, type MediaChunkSourceFactory as t, type MediaRecorderChunkSourceOptions as u, type PresenceState as v, type PrewakeOptions as w, type PrewakeResult as x, type PrewakeStatus as y, type RecordingBucket as z };
1058
+ export { type SessionPhaseName as $, type AccessTokenOptions$1 as A, type PrewakeStatus as B, type ChannelEndpoint as C, DERIVED_LEG_SEP as D, type RecordingBucket as E, type RecordingLifecycle as F, type RecordingStatus as G, type RecordingsAccessor as H, type ReleaseSessionBeaconOptions as I, type RequestOptions as J, type RequestStreamOptions as K, LoopbackStreamData as L, type MediaChunkBinding as M, type RuntimeArtifact as N, type RuntimeArtifactDownload as O, type Presence as P, type RuntimeArtifactsAccessor as Q, type Recording as R, type RuntimeAvailability as S, type Session as T, type SessionDiagnostic as U, type SessionDocument as V, SessionDocumentImpl as W, type SessionEndResult as X, type SessionFailureKind as Y, type SessionPhase as Z, type SessionPhaseError as _, type AccessTokenOptions as a, type SessionStartOptions as a0, type SessionStatus as a1, type SessionStream as a2, type SessionText as a3, type Store as a4, type StoreOptions as a5, type StreamChunkOptions as a6, type StreamDataTransport as a7, TransportSession as a8, type TransportSessionOptions as a9, type TransportState as aa, allocateSession as ab, createPresence as ac, createWebsocketDocConnector as ad, deriveYjsServerUrl as ae, derivedLegName as af, derivedLegRole as ag, isPendingRecording as ah, mediaRecorderChunkSource as ai, prewake as aj, releaseSessionBeacon as ak, streamDataLabel as al, transportStreamData as am, type ActivationEvent as b, type ActivationState as c, type AllocateSessionOptions as d, type AllocatedSession as e, type App as f, type AppOptions as g, type AttachOptions as h, type ChannelMessage as i, ChannelMultiplexer as j, type ChannelName as k, type ChunkReadable as l, DOC_SYNC_WIRE_CONTRACT_VERSION as m, DeferredChannelMultiplexer as n, DeferredDocConnector as o, type DerivedLegRole as p, type DocConnection as q, type DocConnectionState as r, type DocConnector as s, type DocTokenSupplier as t, type MediaChunkSource as u, type MediaChunkSourceFactory as v, type MediaRecorderChunkSourceOptions as w, type PresenceState as x, type PrewakeOptions as y, type PrewakeResult as z };
@@ -35,6 +35,19 @@ declare function mediaRecorderChunkSource(binding: MediaChunkBinding, options?:
35
35
 
36
36
  declare const DOC_SYNC_WIRE_CONTRACT_VERSION = 1;
37
37
 
38
+ interface DocConnectionState {
39
+
40
+ connected: boolean;
41
+
42
+ consecutiveFailures: number;
43
+
44
+ lastCloseCode: number | null;
45
+
46
+ lastCloseReason: string | null;
47
+ }
48
+
49
+ type DocTokenSupplier = () => string | undefined | Promise<string | undefined>;
50
+
38
51
  interface DocConnection {
39
52
 
40
53
  readonly awareness: Awareness;
@@ -45,6 +58,8 @@ interface DocConnection {
45
58
 
46
59
  ensureConnected?(): void;
47
60
 
61
+ onConnectionState?(handler: (state: DocConnectionState) => void): () => void;
62
+
48
63
  destroy(): void;
49
64
  }
50
65
 
@@ -58,9 +73,13 @@ interface WebsocketDocConnectorOptions {
58
73
 
59
74
  sessionId: string;
60
75
 
61
- token?: string;
76
+ token?: string | DocTokenSupplier;
62
77
 
63
78
  WebSocketPolyfill?: typeof WebSocket;
79
+
80
+ maxBackoffTimeMs?: number;
81
+
82
+ dialTimeoutMs?: number;
64
83
  }
65
84
 
66
85
  declare function createWebsocketDocConnector(opts: WebsocketDocConnectorOptions): DocConnector;
@@ -278,6 +297,8 @@ interface SessionDocument {
278
297
  readonly synced: boolean;
279
298
 
280
299
  onSynced(handler: () => void): () => void;
300
+
301
+ onConnectionState?(handler: (state: DocConnectionState) => void): () => void;
281
302
  }
282
303
 
283
304
  interface SessionStream {
@@ -828,6 +849,8 @@ declare class TransportSession {
828
849
 
829
850
  isStaleClosedMarker(marker: Record<string, unknown> | null | undefined): boolean;
830
851
  connect(startOptions?: SessionStartOptions): Promise<void>;
852
+
853
+ leaveLeg(): boolean;
831
854
  disconnect(): void;
832
855
  on<E extends keyof TransportEvents>(event: E, handler: TransportEvents[E]): () => void;
833
856
 
@@ -972,6 +995,8 @@ declare class SessionDocumentImpl implements SessionDocument {
972
995
 
973
996
  ensureConnected(): void;
974
997
 
998
+ onConnectionState(handler: (state: DocConnectionState) => void): () => void;
999
+
975
1000
  onSynced(handler: () => void): () => void;
976
1001
 
977
1002
  set(patch: Record<string, unknown>): void;
@@ -1030,4 +1055,4 @@ interface DataChannelTransport {
1030
1055
 
1031
1056
  declare function transportStreamData(transport: DataChannelTransport): StreamDataTransport;
1032
1057
 
1033
- export { type SessionStatus as $, type AccessTokenOptions$1 as A, type RecordingLifecycle as B, type ChannelEndpoint as C, DERIVED_LEG_SEP as D, type RecordingStatus as E, type RecordingsAccessor as F, type ReleaseSessionBeaconOptions as G, type RequestOptions as H, type RequestStreamOptions as I, type RuntimeArtifact as J, type RuntimeArtifactDownload as K, LoopbackStreamData as L, type MediaChunkBinding as M, type RuntimeArtifactsAccessor as N, type RuntimeAvailability as O, type Presence as P, type SessionDiagnostic as Q, type Recording as R, type Session as S, type SessionDocument as T, SessionDocumentImpl as U, type SessionEndResult as V, type SessionFailureKind as W, type SessionPhase as X, type SessionPhaseError as Y, type SessionPhaseName as Z, type SessionStartOptions as _, type AccessTokenOptions as a, type SessionStream as a0, type SessionText as a1, type Store as a2, type StoreOptions as a3, type StreamChunkOptions as a4, type StreamDataTransport as a5, TransportSession as a6, type TransportSessionOptions as a7, type TransportState as a8, allocateSession as a9, createPresence as aa, createWebsocketDocConnector as ab, deriveYjsServerUrl as ac, derivedLegName as ad, derivedLegRole as ae, isPendingRecording as af, mediaRecorderChunkSource as ag, prewake as ah, releaseSessionBeacon as ai, streamDataLabel as aj, transportStreamData as ak, type ActivationEvent as b, type ActivationState as c, type AllocateSessionOptions as d, type AllocatedSession as e, type App as f, type AppOptions as g, type AttachOptions as h, type ChannelMessage as i, ChannelMultiplexer as j, type ChannelName as k, type ChunkReadable as l, DOC_SYNC_WIRE_CONTRACT_VERSION as m, DeferredChannelMultiplexer as n, DeferredDocConnector as o, type DerivedLegRole as p, type DocConnection as q, type DocConnector as r, type MediaChunkSource as s, type MediaChunkSourceFactory as t, type MediaRecorderChunkSourceOptions as u, type PresenceState as v, type PrewakeOptions as w, type PrewakeResult as x, type PrewakeStatus as y, type RecordingBucket as z };
1058
+ export { type SessionPhaseName as $, type AccessTokenOptions$1 as A, type PrewakeStatus as B, type ChannelEndpoint as C, DERIVED_LEG_SEP as D, type RecordingBucket as E, type RecordingLifecycle as F, type RecordingStatus as G, type RecordingsAccessor as H, type ReleaseSessionBeaconOptions as I, type RequestOptions as J, type RequestStreamOptions as K, LoopbackStreamData as L, type MediaChunkBinding as M, type RuntimeArtifact as N, type RuntimeArtifactDownload as O, type Presence as P, type RuntimeArtifactsAccessor as Q, type Recording as R, type RuntimeAvailability as S, type Session as T, type SessionDiagnostic as U, type SessionDocument as V, SessionDocumentImpl as W, type SessionEndResult as X, type SessionFailureKind as Y, type SessionPhase as Z, type SessionPhaseError as _, type AccessTokenOptions as a, type SessionStartOptions as a0, type SessionStatus as a1, type SessionStream as a2, type SessionText as a3, type Store as a4, type StoreOptions as a5, type StreamChunkOptions as a6, type StreamDataTransport as a7, TransportSession as a8, type TransportSessionOptions as a9, type TransportState as aa, allocateSession as ab, createPresence as ac, createWebsocketDocConnector as ad, deriveYjsServerUrl as ae, derivedLegName as af, derivedLegRole as ag, isPendingRecording as ah, mediaRecorderChunkSource as ai, prewake as aj, releaseSessionBeacon as ak, streamDataLabel as al, transportStreamData as am, type ActivationEvent as b, type ActivationState as c, type AllocateSessionOptions as d, type AllocatedSession as e, type App as f, type AppOptions as g, type AttachOptions as h, type ChannelMessage as i, ChannelMultiplexer as j, type ChannelName as k, type ChunkReadable as l, DOC_SYNC_WIRE_CONTRACT_VERSION as m, DeferredChannelMultiplexer as n, DeferredDocConnector as o, type DerivedLegRole as p, type DocConnection as q, type DocConnectionState as r, type DocConnector as s, type DocTokenSupplier as t, type MediaChunkSource as u, type MediaChunkSourceFactory as v, type MediaRecorderChunkSourceOptions as w, type PresenceState as x, type PrewakeOptions as y, type PrewakeResult as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@urun-sh/core",
3
- "version": "0.2.45",
3
+ "version": "0.2.47",
4
4
  "description": "Core transport and channel primitives for the urun TypeScript SDK",
5
5
  "repository": {
6
6
  "type": "git",