@urun-sh/core 0.2.6 → 0.2.7

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,2 @@
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-H23H4OCS.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 { 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};
@@ -93,7 +93,13 @@ declare function createPresence(awareness: Awareness): Presence;
93
93
 
94
94
  type TransportState = 'connecting' | 'connected' | 'reconnecting' | 'renegotiating' | 'disconnected' | 'failed';
95
95
 
96
- type SessionPhaseName = 'idle' | 'queued' | 'provisioning' | 'connecting' | 'live' | 'error' | 'ended';
96
+ type SessionPhaseName = 'idle' | 'queued' | 'unavailable' | 'provisioning' | 'connecting' | 'live' | 'error' | 'ended';
97
+
98
+ interface RuntimeAvailability {
99
+ state: 'unavailable' | 'starting' | 'busy';
100
+
101
+ reason?: string;
102
+ }
97
103
 
98
104
  type SessionFailureKind = 'create-failed' | 'never-live' | 'transport-failed' | 'media-permission' | 'ended';
99
105
 
@@ -117,6 +123,8 @@ interface SessionPhase {
117
123
  depth: number;
118
124
  };
119
125
 
126
+ runtime?: RuntimeAvailability;
127
+
120
128
  requestId?: string;
121
129
 
122
130
  sessionId?: string;
@@ -143,6 +151,8 @@ interface SessionStatus {
143
151
  depth: number;
144
152
  };
145
153
 
154
+ runtime?: RuntimeAvailability;
155
+
146
156
  error?: SessionPhaseError;
147
157
  }
148
158
 
@@ -764,11 +774,72 @@ declare class TransportSession {
764
774
 
765
775
  private _setPhase;
766
776
 
777
+ reportAdmission(update: {
778
+ status: 'queued' | 'pending';
779
+ requestId?: string;
780
+ queue?: {
781
+ position: number;
782
+ depth: number;
783
+ };
784
+ runtime?: RuntimeAvailability;
785
+ }): void;
786
+
767
787
  private _emitError;
768
788
 
769
789
  reportAllocationFailure(error: Error, httpStatus?: number): void;
770
790
  }
771
791
 
792
+ declare class SessionDocumentImpl implements SessionDocument {
793
+ private _doc;
794
+ private _root;
795
+ private _awareness;
796
+ private _listeners;
797
+ private _key;
798
+ private _sessionId;
799
+ private _connection;
800
+ private _connUnsub;
801
+
802
+ private _synced;
803
+
804
+ private _syncWaiters;
805
+
806
+ private _texts;
807
+ private _observer;
808
+ constructor(key: string, sessionId: string, connector?: DocConnector | null);
809
+
810
+ get awareness(): Awareness;
811
+
812
+ setSessionId(sessionId: string): void;
813
+
814
+ get synced(): boolean;
815
+
816
+ onSynced(handler: () => void): () => void;
817
+
818
+ set(patch: Record<string, unknown>): void;
819
+ get(path?: string, defaultValue?: unknown): unknown;
820
+ on(event: 'change', handler: (snap: Record<string, unknown>) => void): () => void;
821
+
822
+ text(field: string): SessionTextImpl;
823
+ dispose(): void;
824
+ private _markSynced;
825
+
826
+ private applyPatch;
827
+ private snapshot;
828
+ private notify;
829
+ }
830
+
831
+ declare class SessionTextImpl implements SessionText {
832
+ private _ytext;
833
+ private _delta;
834
+ private _observer;
835
+ constructor(_ytext: Y.Text);
836
+ append(text: string): void;
837
+ toString(): string;
838
+ get length(): number;
839
+ on(event: 'delta', handler: (inserted: string) => void): () => void;
840
+ dispose(): void;
841
+ }
842
+
772
843
  interface StreamDataTransport {
773
844
 
774
845
  readonly consumerId: string;
@@ -800,4 +871,4 @@ interface DataChannelTransport {
800
871
 
801
872
  declare function transportStreamData(transport: DataChannelTransport): StreamDataTransport;
802
873
 
803
- 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 };
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 };
@@ -93,7 +93,13 @@ declare function createPresence(awareness: Awareness): Presence;
93
93
 
94
94
  type TransportState = 'connecting' | 'connected' | 'reconnecting' | 'renegotiating' | 'disconnected' | 'failed';
95
95
 
96
- type SessionPhaseName = 'idle' | 'queued' | 'provisioning' | 'connecting' | 'live' | 'error' | 'ended';
96
+ type SessionPhaseName = 'idle' | 'queued' | 'unavailable' | 'provisioning' | 'connecting' | 'live' | 'error' | 'ended';
97
+
98
+ interface RuntimeAvailability {
99
+ state: 'unavailable' | 'starting' | 'busy';
100
+
101
+ reason?: string;
102
+ }
97
103
 
98
104
  type SessionFailureKind = 'create-failed' | 'never-live' | 'transport-failed' | 'media-permission' | 'ended';
99
105
 
@@ -117,6 +123,8 @@ interface SessionPhase {
117
123
  depth: number;
118
124
  };
119
125
 
126
+ runtime?: RuntimeAvailability;
127
+
120
128
  requestId?: string;
121
129
 
122
130
  sessionId?: string;
@@ -143,6 +151,8 @@ interface SessionStatus {
143
151
  depth: number;
144
152
  };
145
153
 
154
+ runtime?: RuntimeAvailability;
155
+
146
156
  error?: SessionPhaseError;
147
157
  }
148
158
 
@@ -764,11 +774,72 @@ declare class TransportSession {
764
774
 
765
775
  private _setPhase;
766
776
 
777
+ reportAdmission(update: {
778
+ status: 'queued' | 'pending';
779
+ requestId?: string;
780
+ queue?: {
781
+ position: number;
782
+ depth: number;
783
+ };
784
+ runtime?: RuntimeAvailability;
785
+ }): void;
786
+
767
787
  private _emitError;
768
788
 
769
789
  reportAllocationFailure(error: Error, httpStatus?: number): void;
770
790
  }
771
791
 
792
+ declare class SessionDocumentImpl implements SessionDocument {
793
+ private _doc;
794
+ private _root;
795
+ private _awareness;
796
+ private _listeners;
797
+ private _key;
798
+ private _sessionId;
799
+ private _connection;
800
+ private _connUnsub;
801
+
802
+ private _synced;
803
+
804
+ private _syncWaiters;
805
+
806
+ private _texts;
807
+ private _observer;
808
+ constructor(key: string, sessionId: string, connector?: DocConnector | null);
809
+
810
+ get awareness(): Awareness;
811
+
812
+ setSessionId(sessionId: string): void;
813
+
814
+ get synced(): boolean;
815
+
816
+ onSynced(handler: () => void): () => void;
817
+
818
+ set(patch: Record<string, unknown>): void;
819
+ get(path?: string, defaultValue?: unknown): unknown;
820
+ on(event: 'change', handler: (snap: Record<string, unknown>) => void): () => void;
821
+
822
+ text(field: string): SessionTextImpl;
823
+ dispose(): void;
824
+ private _markSynced;
825
+
826
+ private applyPatch;
827
+ private snapshot;
828
+ private notify;
829
+ }
830
+
831
+ declare class SessionTextImpl implements SessionText {
832
+ private _ytext;
833
+ private _delta;
834
+ private _observer;
835
+ constructor(_ytext: Y.Text);
836
+ append(text: string): void;
837
+ toString(): string;
838
+ get length(): number;
839
+ on(event: 'delta', handler: (inserted: string) => void): () => void;
840
+ dispose(): void;
841
+ }
842
+
772
843
  interface StreamDataTransport {
773
844
 
774
845
  readonly consumerId: string;
@@ -800,4 +871,4 @@ interface DataChannelTransport {
800
871
 
801
872
  declare function transportStreamData(transport: DataChannelTransport): StreamDataTransport;
802
873
 
803
- 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 };
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@urun-sh/core",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "Core transport and channel primitives for the urun TypeScript SDK",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,6 +17,21 @@
17
17
  "exports": {
18
18
  ".": {
19
19
  "types": "./dist/index.d.ts",
20
+ "edge-light": {
21
+ "types": "./dist/index.browser.d.ts",
22
+ "import": "./dist/index.browser.mjs",
23
+ "require": "./dist/index.browser.js"
24
+ },
25
+ "workerd": {
26
+ "types": "./dist/index.browser.d.ts",
27
+ "import": "./dist/index.browser.mjs",
28
+ "require": "./dist/index.browser.js"
29
+ },
30
+ "worker": {
31
+ "types": "./dist/index.browser.d.ts",
32
+ "import": "./dist/index.browser.mjs",
33
+ "require": "./dist/index.browser.js"
34
+ },
20
35
  "browser": {
21
36
  "types": "./dist/index.browser.d.ts",
22
37
  "import": "./dist/index.browser.mjs",
@@ -27,6 +42,21 @@
27
42
  },
28
43
  "./internal": {
29
44
  "types": "./dist/internal.d.ts",
45
+ "edge-light": {
46
+ "types": "./dist/internal.browser.d.ts",
47
+ "import": "./dist/internal.browser.mjs",
48
+ "require": "./dist/internal.browser.js"
49
+ },
50
+ "workerd": {
51
+ "types": "./dist/internal.browser.d.ts",
52
+ "import": "./dist/internal.browser.mjs",
53
+ "require": "./dist/internal.browser.js"
54
+ },
55
+ "worker": {
56
+ "types": "./dist/internal.browser.d.ts",
57
+ "import": "./dist/internal.browser.mjs",
58
+ "require": "./dist/internal.browser.js"
59
+ },
30
60
  "browser": {
31
61
  "types": "./dist/internal.browser.d.ts",
32
62
  "import": "./dist/internal.browser.mjs",
@@ -69,6 +99,7 @@
69
99
  },
70
100
  "license": "MIT",
71
101
  "dependencies": {
102
+ "debug": "^4.4.3",
72
103
  "y-protocols": "1.0.7",
73
104
  "y-websocket": "3.0.0",
74
105
  "yjs": "^13.6.31"