@urun-sh/core 0.1.36 → 0.1.37

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-B7GoThNN.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-B7GoThNN.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,6 +50,18 @@ 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;
@@ -67,6 +84,8 @@ declare class Session implements Session$1 {
67
84
  private _transport;
68
85
  private _docs;
69
86
  private _streams;
87
+
88
+ private _activeRequests;
70
89
  constructor(sessionId: string, multiplexer: ChannelEndpoint, transport: TransportSession);
71
90
  private _wireControlDocIncarnation;
72
91
 
@@ -80,6 +99,10 @@ declare class Session implements Session$1 {
80
99
  stream(name: string): SessionStream;
81
100
 
82
101
  doc(key: string): SessionDocumentImpl;
102
+
103
+ request(payload: unknown, options?: RequestOptions): Promise<unknown>;
104
+
105
+ requestStream(payload: unknown, options?: RequestStreamOptions): AsyncIterable<string>;
83
106
  disconnect(): void;
84
107
  }
85
108
 
@@ -97,4 +120,30 @@ interface VideoStreamOptions {
97
120
 
98
121
  declare function videoStream(source: ReadableStream<Uint8Array>, options?: VideoStreamOptions): MediaStream;
99
122
 
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 };
123
+ declare class RequestError extends Error {
124
+
125
+ readonly requestId?: string;
126
+
127
+ readonly code?: string;
128
+ constructor(message: string, options?: {
129
+ requestId?: string;
130
+ code?: string;
131
+ cause?: unknown;
132
+ });
133
+ }
134
+
135
+ declare class RequestTimeoutError extends RequestError {
136
+
137
+ readonly timeoutMs: number;
138
+ constructor(timeoutMs: number, requestId?: string);
139
+ }
140
+
141
+ declare class RequestAbortError extends RequestError {
142
+ constructor(requestId?: string);
143
+ }
144
+
145
+ declare class RequestCancelledError extends RequestError {
146
+ constructor(requestId?: string);
147
+ }
148
+
149
+ 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-B7GoThNN.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-B7GoThNN.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,6 +50,18 @@ 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;
@@ -67,6 +84,8 @@ declare class Session implements Session$1 {
67
84
  private _transport;
68
85
  private _docs;
69
86
  private _streams;
87
+
88
+ private _activeRequests;
70
89
  constructor(sessionId: string, multiplexer: ChannelEndpoint, transport: TransportSession);
71
90
  private _wireControlDocIncarnation;
72
91
 
@@ -80,6 +99,10 @@ declare class Session implements Session$1 {
80
99
  stream(name: string): SessionStream;
81
100
 
82
101
  doc(key: string): SessionDocumentImpl;
102
+
103
+ request(payload: unknown, options?: RequestOptions): Promise<unknown>;
104
+
105
+ requestStream(payload: unknown, options?: RequestStreamOptions): AsyncIterable<string>;
83
106
  disconnect(): void;
84
107
  }
85
108
 
@@ -97,4 +120,30 @@ interface VideoStreamOptions {
97
120
 
98
121
  declare function videoStream(source: ReadableStream<Uint8Array>, options?: VideoStreamOptions): MediaStream;
99
122
 
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 };
123
+ declare class RequestError extends Error {
124
+
125
+ readonly requestId?: string;
126
+
127
+ readonly code?: string;
128
+ constructor(message: string, options?: {
129
+ requestId?: string;
130
+ code?: string;
131
+ cause?: unknown;
132
+ });
133
+ }
134
+
135
+ declare class RequestTimeoutError extends RequestError {
136
+
137
+ readonly timeoutMs: number;
138
+ constructor(timeoutMs: number, requestId?: string);
139
+ }
140
+
141
+ declare class RequestAbortError extends RequestError {
142
+ constructor(requestId?: string);
143
+ }
144
+
145
+ declare class RequestCancelledError extends RequestError {
146
+ constructor(requestId?: string);
147
+ }
148
+
149
+ 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 };