@urun-sh/core 0.1.36 → 0.1.38

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/index.d.mts CHANGED
@@ -1,13 +1,14 @@
1
- import { a as AppOptions, A as App$1, j as SessionDocument, i as Session$1, C as ChannelEndpoint, T as TransportSession, b as AttachOptions, k as SessionPhase, n as SessionStream$1, p as StoreOptions, o as Store, d as ChannelMultiplexer } from './internal-BYsSyqG4.mjs';
2
- export { L as Layer, f as LayoutConfig, g as LayoutContext, S as SceneContext, h as SceneGraph, l as SessionPhaseName, r as TransportState } from './internal-BYsSyqG4.mjs';
1
+ import { a as AppOptions, A as App$1, k as SessionDocument, p as SessionText, j as Session$1, C as ChannelEndpoint, T as TransportSession, b as AttachOptions, l as SessionPhase, o as SessionStream$1, R as RequestOptions, h as RequestStreamOptions, r as StoreOptions, q as Store, d as ChannelMultiplexer } from './internal-CrXsIQMr.mjs';
2
+ export { L as Layer, f as LayoutConfig, g as LayoutContext, S as SceneContext, i as SceneGraph, m as SessionPhaseName, t as TransportState } from './internal-CrXsIQMr.mjs';
3
+ import * as Y from 'yjs';
3
4
 
4
5
  declare function App(appId: string, options: AppOptions): App$1;
5
6
 
6
7
  interface SessionDocTransport {
7
8
 
8
- sendDocSync(payload: Uint8Array): void;
9
+ sendDocSync(docKey: string, payload: Uint8Array): void;
9
10
 
10
- onDocSync(handler: (payload: Uint8Array) => void): () => void;
11
+ onDocSync(docKey: string, handler: (payload: Uint8Array) => void): () => void;
11
12
 
12
13
  onDocSyncReady(handler: () => void): () => void;
13
14
 
@@ -26,6 +27,8 @@ declare class SessionDocumentImpl implements SessionDocument {
26
27
  private _synced;
27
28
 
28
29
  private _pendingPatches;
30
+
31
+ private _texts;
29
32
  private _observer;
30
33
  private _updateHandler;
31
34
  constructor(key: string, sessionId: string, transport?: SessionDocTransport | null);
@@ -35,6 +38,8 @@ declare class SessionDocumentImpl implements SessionDocument {
35
38
  set(patch: Record<string, unknown>): void;
36
39
  get(path?: string, defaultValue?: unknown): unknown;
37
40
  on(event: 'change', handler: (snap: Record<string, unknown>) => void): () => void;
41
+
42
+ text(field: string): SessionTextImpl;
38
43
  dispose(): void;
39
44
 
40
45
  private sendHello;
@@ -45,13 +50,44 @@ declare class SessionDocumentImpl implements SessionDocument {
45
50
  private notify;
46
51
  }
47
52
 
53
+ declare class SessionTextImpl implements SessionText {
54
+ private _ytext;
55
+ private _delta;
56
+ private _observer;
57
+ constructor(_ytext: Y.Text);
58
+ append(text: string): void;
59
+ toString(): string;
60
+ get length(): number;
61
+ on(event: 'delta', handler: (inserted: string) => void): () => void;
62
+ dispose(): void;
63
+ }
64
+
48
65
  declare class SessionStream implements SessionStream$1 {
49
66
  private _name;
50
67
  private _transport;
68
+
69
+ private _laneDoc?;
51
70
  private _track;
52
71
  private _handlers;
53
72
  private _unsubscribeTransport;
54
- constructor(_name: string, _transport: TransportSession);
73
+
74
+ private _subscribed;
75
+
76
+ private _messageConsumers;
77
+
78
+ private _laneUnsubs;
79
+
80
+ private _laneSeen;
81
+ private _disposed;
82
+ constructor(_name: string, _transport: TransportSession,
83
+
84
+ _laneDoc?: ((key: string) => SessionDocumentImpl) | undefined);
85
+
86
+ messages(): AsyncIterable<unknown>;
87
+
88
+ private _ensureSubscribed;
89
+
90
+ private _drainLane;
55
91
  get track(): MediaStreamTrack | null;
56
92
  attach(track: MediaStreamTrack): Promise<void>;
57
93
  detach(): Promise<void>;
@@ -67,6 +103,8 @@ declare class Session implements Session$1 {
67
103
  private _transport;
68
104
  private _docs;
69
105
  private _streams;
106
+
107
+ private _activeRequests;
70
108
  constructor(sessionId: string, multiplexer: ChannelEndpoint, transport: TransportSession);
71
109
  private _wireControlDocIncarnation;
72
110
 
@@ -80,6 +118,14 @@ declare class Session implements Session$1 {
80
118
  stream(name: string): SessionStream;
81
119
 
82
120
  doc(key: string): SessionDocumentImpl;
121
+
122
+ request(payload: unknown, options?: RequestOptions): Promise<unknown>;
123
+
124
+ private _consumeResponse;
125
+
126
+ requestStream(payload: unknown, options?: RequestStreamOptions): AsyncIterable<string>;
127
+
128
+ complete(payload: unknown, options?: RequestStreamOptions): Promise<unknown>;
83
129
  disconnect(): void;
84
130
  }
85
131
 
@@ -97,4 +143,30 @@ interface VideoStreamOptions {
97
143
 
98
144
  declare function videoStream(source: ReadableStream<Uint8Array>, options?: VideoStreamOptions): MediaStream;
99
145
 
100
- export { App, App$1 as AppInterface, AppOptions, AttachOptions, Session, SessionDocument, Session$1 as SessionInterface, SessionPhase, SessionStream$1 as SessionStream, Store, StoreOptions, type VideoStreamOptions, createStore, videoStream };
146
+ declare class RequestError extends Error {
147
+
148
+ readonly requestId?: string;
149
+
150
+ readonly code?: string;
151
+ constructor(message: string, options?: {
152
+ requestId?: string;
153
+ code?: string;
154
+ cause?: unknown;
155
+ });
156
+ }
157
+
158
+ declare class RequestTimeoutError extends RequestError {
159
+
160
+ readonly timeoutMs: number;
161
+ constructor(timeoutMs: number, requestId?: string);
162
+ }
163
+
164
+ declare class RequestAbortError extends RequestError {
165
+ constructor(requestId?: string);
166
+ }
167
+
168
+ declare class RequestCancelledError extends RequestError {
169
+ constructor(requestId?: string);
170
+ }
171
+
172
+ export { App, App$1 as AppInterface, AppOptions, AttachOptions, RequestAbortError, RequestCancelledError, RequestError, RequestOptions, RequestStreamOptions, RequestTimeoutError, Session, SessionDocument, Session$1 as SessionInterface, SessionPhase, SessionStream$1 as SessionStream, SessionText, Store, StoreOptions, type VideoStreamOptions, createStore, videoStream };
package/dist/index.d.ts CHANGED
@@ -1,13 +1,14 @@
1
- import { a as AppOptions, A as App$1, j as SessionDocument, i as Session$1, C as ChannelEndpoint, T as TransportSession, b as AttachOptions, k as SessionPhase, n as SessionStream$1, p as StoreOptions, o as Store, d as ChannelMultiplexer } from './internal-BYsSyqG4.js';
2
- export { L as Layer, f as LayoutConfig, g as LayoutContext, S as SceneContext, h as SceneGraph, l as SessionPhaseName, r as TransportState } from './internal-BYsSyqG4.js';
1
+ import { a as AppOptions, A as App$1, k as SessionDocument, p as SessionText, j as Session$1, C as ChannelEndpoint, T as TransportSession, b as AttachOptions, l as SessionPhase, o as SessionStream$1, R as RequestOptions, h as RequestStreamOptions, r as StoreOptions, q as Store, d as ChannelMultiplexer } from './internal-CrXsIQMr.js';
2
+ export { L as Layer, f as LayoutConfig, g as LayoutContext, S as SceneContext, i as SceneGraph, m as SessionPhaseName, t as TransportState } from './internal-CrXsIQMr.js';
3
+ import * as Y from 'yjs';
3
4
 
4
5
  declare function App(appId: string, options: AppOptions): App$1;
5
6
 
6
7
  interface SessionDocTransport {
7
8
 
8
- sendDocSync(payload: Uint8Array): void;
9
+ sendDocSync(docKey: string, payload: Uint8Array): void;
9
10
 
10
- onDocSync(handler: (payload: Uint8Array) => void): () => void;
11
+ onDocSync(docKey: string, handler: (payload: Uint8Array) => void): () => void;
11
12
 
12
13
  onDocSyncReady(handler: () => void): () => void;
13
14
 
@@ -26,6 +27,8 @@ declare class SessionDocumentImpl implements SessionDocument {
26
27
  private _synced;
27
28
 
28
29
  private _pendingPatches;
30
+
31
+ private _texts;
29
32
  private _observer;
30
33
  private _updateHandler;
31
34
  constructor(key: string, sessionId: string, transport?: SessionDocTransport | null);
@@ -35,6 +38,8 @@ declare class SessionDocumentImpl implements SessionDocument {
35
38
  set(patch: Record<string, unknown>): void;
36
39
  get(path?: string, defaultValue?: unknown): unknown;
37
40
  on(event: 'change', handler: (snap: Record<string, unknown>) => void): () => void;
41
+
42
+ text(field: string): SessionTextImpl;
38
43
  dispose(): void;
39
44
 
40
45
  private sendHello;
@@ -45,13 +50,44 @@ declare class SessionDocumentImpl implements SessionDocument {
45
50
  private notify;
46
51
  }
47
52
 
53
+ declare class SessionTextImpl implements SessionText {
54
+ private _ytext;
55
+ private _delta;
56
+ private _observer;
57
+ constructor(_ytext: Y.Text);
58
+ append(text: string): void;
59
+ toString(): string;
60
+ get length(): number;
61
+ on(event: 'delta', handler: (inserted: string) => void): () => void;
62
+ dispose(): void;
63
+ }
64
+
48
65
  declare class SessionStream implements SessionStream$1 {
49
66
  private _name;
50
67
  private _transport;
68
+
69
+ private _laneDoc?;
51
70
  private _track;
52
71
  private _handlers;
53
72
  private _unsubscribeTransport;
54
- constructor(_name: string, _transport: TransportSession);
73
+
74
+ private _subscribed;
75
+
76
+ private _messageConsumers;
77
+
78
+ private _laneUnsubs;
79
+
80
+ private _laneSeen;
81
+ private _disposed;
82
+ constructor(_name: string, _transport: TransportSession,
83
+
84
+ _laneDoc?: ((key: string) => SessionDocumentImpl) | undefined);
85
+
86
+ messages(): AsyncIterable<unknown>;
87
+
88
+ private _ensureSubscribed;
89
+
90
+ private _drainLane;
55
91
  get track(): MediaStreamTrack | null;
56
92
  attach(track: MediaStreamTrack): Promise<void>;
57
93
  detach(): Promise<void>;
@@ -67,6 +103,8 @@ declare class Session implements Session$1 {
67
103
  private _transport;
68
104
  private _docs;
69
105
  private _streams;
106
+
107
+ private _activeRequests;
70
108
  constructor(sessionId: string, multiplexer: ChannelEndpoint, transport: TransportSession);
71
109
  private _wireControlDocIncarnation;
72
110
 
@@ -80,6 +118,14 @@ declare class Session implements Session$1 {
80
118
  stream(name: string): SessionStream;
81
119
 
82
120
  doc(key: string): SessionDocumentImpl;
121
+
122
+ request(payload: unknown, options?: RequestOptions): Promise<unknown>;
123
+
124
+ private _consumeResponse;
125
+
126
+ requestStream(payload: unknown, options?: RequestStreamOptions): AsyncIterable<string>;
127
+
128
+ complete(payload: unknown, options?: RequestStreamOptions): Promise<unknown>;
83
129
  disconnect(): void;
84
130
  }
85
131
 
@@ -97,4 +143,30 @@ interface VideoStreamOptions {
97
143
 
98
144
  declare function videoStream(source: ReadableStream<Uint8Array>, options?: VideoStreamOptions): MediaStream;
99
145
 
100
- export { App, App$1 as AppInterface, AppOptions, AttachOptions, Session, SessionDocument, Session$1 as SessionInterface, SessionPhase, SessionStream$1 as SessionStream, Store, StoreOptions, type VideoStreamOptions, createStore, videoStream };
146
+ declare class RequestError extends Error {
147
+
148
+ readonly requestId?: string;
149
+
150
+ readonly code?: string;
151
+ constructor(message: string, options?: {
152
+ requestId?: string;
153
+ code?: string;
154
+ cause?: unknown;
155
+ });
156
+ }
157
+
158
+ declare class RequestTimeoutError extends RequestError {
159
+
160
+ readonly timeoutMs: number;
161
+ constructor(timeoutMs: number, requestId?: string);
162
+ }
163
+
164
+ declare class RequestAbortError extends RequestError {
165
+ constructor(requestId?: string);
166
+ }
167
+
168
+ declare class RequestCancelledError extends RequestError {
169
+ constructor(requestId?: string);
170
+ }
171
+
172
+ export { App, App$1 as AppInterface, AppOptions, AttachOptions, RequestAbortError, RequestCancelledError, RequestError, RequestOptions, RequestStreamOptions, RequestTimeoutError, Session, SessionDocument, Session$1 as SessionInterface, SessionPhase, SessionStream$1 as SessionStream, SessionText, Store, StoreOptions, type VideoStreamOptions, createStore, videoStream };