@urun-sh/core 0.1.38 → 0.1.41

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.
@@ -37,6 +37,8 @@ interface TransportSessionOptions {
37
37
 
38
38
  sessionId?: string;
39
39
 
40
+ iceServers?: RTCIceServer[];
41
+
40
42
  mediaLiveness?: MediaLivenessOptions;
41
43
  }
42
44
 
@@ -168,6 +170,10 @@ interface SessionDocument {
168
170
  on(event: 'change', handler: (snapshot: Record<string, unknown>) => void): () => void;
169
171
 
170
172
  text(field: string): SessionText;
173
+
174
+ readonly synced: boolean;
175
+
176
+ onSynced(handler: () => void): () => void;
171
177
  }
172
178
 
173
179
  interface SessionStream {
@@ -176,8 +182,12 @@ interface SessionStream {
176
182
 
177
183
  attach(track: MediaStreamTrack): Promise<void>;
178
184
 
185
+ attachVideo(track: MediaStreamTrack): Promise<void>;
186
+
179
187
  detach(): Promise<void>;
180
188
 
189
+ detachVideo(): Promise<void>;
190
+
181
191
  seek(target: number | 'live'): Promise<void>;
182
192
 
183
193
  on(event: 'track', handler: (track: MediaStreamTrack | null) => void): () => void;
@@ -195,6 +205,8 @@ interface RequestOptions {
195
205
  interface RequestStreamOptions {
196
206
 
197
207
  signal?: AbortSignal;
208
+
209
+ docSyncTimeout?: number;
198
210
  }
199
211
 
200
212
  interface Session {
@@ -278,11 +290,26 @@ declare class ChannelMultiplexer implements ChannelEndpoint {
278
290
  private flushPendingSends;
279
291
  private listenForOpen;
280
292
  }
293
+ declare class DeferredChannelMultiplexer implements ChannelEndpoint {
294
+ private _handlers;
295
+ private _pendingSends;
296
+ private _target;
297
+ private _targetUnsubscribes;
298
+ private _disposed;
299
+ setTarget(target: ChannelEndpoint): void;
300
+ rewriteSessionChannels(oldSessionId: string, newSessionId: string): void;
301
+ on(channel: string, handler: (data: ChannelMessage) => void): () => void;
302
+ emit(channel: string, data: Record<string, unknown>): void;
303
+ dispose(): void;
304
+ private detachTarget;
305
+ }
281
306
 
282
307
  interface TransportConnection {
283
308
  url: string;
284
309
  sessionId: string;
285
310
  jwt?: string;
311
+
312
+ iceServers?: RTCIceServer[];
286
313
  }
287
314
 
288
315
  declare function encodeDocSyncFrame(docKey: string, payload: Uint8Array): Uint8Array;
@@ -335,6 +362,7 @@ declare class TransportSession {
335
362
  private _sendTransport;
336
363
  private _consumers;
337
364
  private _audioProducer;
365
+ private _videoProducer;
338
366
  private _pendingProduce;
339
367
  private _multiplexer;
340
368
  private _reconnectAttempts;
@@ -382,7 +410,7 @@ declare class TransportSession {
382
410
  getTrackByName(name: string): MediaStreamTrack | undefined;
383
411
  setAuth(options: Pick<TransportSessionOptions, 'orgId' | 'jwt' | 'authProvider'>): void;
384
412
  constructor(options?: TransportSessionOptions);
385
- setConnection(options: Pick<TransportSessionOptions, 'url' | 'fallbackUrls' | 'sessionId'>): void;
413
+ setConnection(options: Pick<TransportSessionOptions, 'url' | 'fallbackUrls' | 'sessionId' | 'iceServers'>): void;
386
414
  setConnectionResolver(resolveConnection: (() => Promise<TransportConnection>) | null): void;
387
415
 
388
416
  applyControlDocState(state: Record<string, unknown> | null | undefined): void;
@@ -406,6 +434,10 @@ declare class TransportSession {
406
434
  private _emitDocSyncFrame;
407
435
  addTrack(track: MediaStreamTrack): Promise<void>;
408
436
  removeTrack(): void;
437
+
438
+ addVideoTrack(track: MediaStreamTrack): Promise<void>;
439
+
440
+ stopVideo(): void;
409
441
  requestDiagnostics(): void;
410
442
  seekStream(name: string, target: number | 'live'): void;
411
443
 
@@ -452,4 +484,4 @@ declare class TransportSession {
452
484
  private _emitError;
453
485
  }
454
486
 
455
- export { type App as A, type ChannelEndpoint as C, type Layer as L, type RequestOptions as R, type SceneContext as S, TransportSession as T, type AppOptions as a, type AttachOptions as b, type ChannelMessage as c, ChannelMultiplexer as d, type ChannelName as e, type LayoutConfig as f, type LayoutContext as g, type RequestStreamOptions as h, type SceneGraph as i, type Session as j, type SessionDocument as k, type SessionPhase as l, type SessionPhaseName as m, type SessionStartOptions as n, type SessionStream as o, type SessionText as p, type Store as q, type StoreOptions as r, type TransportSessionOptions as s, type TransportState as t, decodeDocSyncFrame as u, encodeDocSyncFrame as v };
487
+ export { type App as A, type ChannelEndpoint as C, DeferredChannelMultiplexer as D, type Layer as L, type RequestOptions as R, type SceneContext as S, TransportSession as T, type AppOptions as a, type AttachOptions as b, type ChannelMessage as c, ChannelMultiplexer as d, type ChannelName as e, type LayoutConfig as f, type LayoutContext as g, type RequestStreamOptions as h, type SceneGraph as i, type Session as j, type SessionDocument as k, type SessionPhase as l, type SessionPhaseName as m, type SessionStartOptions as n, type SessionStream as o, type SessionText as p, type Store as q, type StoreOptions as r, type TransportSessionOptions as s, type TransportState as t, decodeDocSyncFrame as u, encodeDocSyncFrame as v };
@@ -37,6 +37,8 @@ interface TransportSessionOptions {
37
37
 
38
38
  sessionId?: string;
39
39
 
40
+ iceServers?: RTCIceServer[];
41
+
40
42
  mediaLiveness?: MediaLivenessOptions;
41
43
  }
42
44
 
@@ -168,6 +170,10 @@ interface SessionDocument {
168
170
  on(event: 'change', handler: (snapshot: Record<string, unknown>) => void): () => void;
169
171
 
170
172
  text(field: string): SessionText;
173
+
174
+ readonly synced: boolean;
175
+
176
+ onSynced(handler: () => void): () => void;
171
177
  }
172
178
 
173
179
  interface SessionStream {
@@ -176,8 +182,12 @@ interface SessionStream {
176
182
 
177
183
  attach(track: MediaStreamTrack): Promise<void>;
178
184
 
185
+ attachVideo(track: MediaStreamTrack): Promise<void>;
186
+
179
187
  detach(): Promise<void>;
180
188
 
189
+ detachVideo(): Promise<void>;
190
+
181
191
  seek(target: number | 'live'): Promise<void>;
182
192
 
183
193
  on(event: 'track', handler: (track: MediaStreamTrack | null) => void): () => void;
@@ -195,6 +205,8 @@ interface RequestOptions {
195
205
  interface RequestStreamOptions {
196
206
 
197
207
  signal?: AbortSignal;
208
+
209
+ docSyncTimeout?: number;
198
210
  }
199
211
 
200
212
  interface Session {
@@ -278,11 +290,26 @@ declare class ChannelMultiplexer implements ChannelEndpoint {
278
290
  private flushPendingSends;
279
291
  private listenForOpen;
280
292
  }
293
+ declare class DeferredChannelMultiplexer implements ChannelEndpoint {
294
+ private _handlers;
295
+ private _pendingSends;
296
+ private _target;
297
+ private _targetUnsubscribes;
298
+ private _disposed;
299
+ setTarget(target: ChannelEndpoint): void;
300
+ rewriteSessionChannels(oldSessionId: string, newSessionId: string): void;
301
+ on(channel: string, handler: (data: ChannelMessage) => void): () => void;
302
+ emit(channel: string, data: Record<string, unknown>): void;
303
+ dispose(): void;
304
+ private detachTarget;
305
+ }
281
306
 
282
307
  interface TransportConnection {
283
308
  url: string;
284
309
  sessionId: string;
285
310
  jwt?: string;
311
+
312
+ iceServers?: RTCIceServer[];
286
313
  }
287
314
 
288
315
  declare function encodeDocSyncFrame(docKey: string, payload: Uint8Array): Uint8Array;
@@ -335,6 +362,7 @@ declare class TransportSession {
335
362
  private _sendTransport;
336
363
  private _consumers;
337
364
  private _audioProducer;
365
+ private _videoProducer;
338
366
  private _pendingProduce;
339
367
  private _multiplexer;
340
368
  private _reconnectAttempts;
@@ -382,7 +410,7 @@ declare class TransportSession {
382
410
  getTrackByName(name: string): MediaStreamTrack | undefined;
383
411
  setAuth(options: Pick<TransportSessionOptions, 'orgId' | 'jwt' | 'authProvider'>): void;
384
412
  constructor(options?: TransportSessionOptions);
385
- setConnection(options: Pick<TransportSessionOptions, 'url' | 'fallbackUrls' | 'sessionId'>): void;
413
+ setConnection(options: Pick<TransportSessionOptions, 'url' | 'fallbackUrls' | 'sessionId' | 'iceServers'>): void;
386
414
  setConnectionResolver(resolveConnection: (() => Promise<TransportConnection>) | null): void;
387
415
 
388
416
  applyControlDocState(state: Record<string, unknown> | null | undefined): void;
@@ -406,6 +434,10 @@ declare class TransportSession {
406
434
  private _emitDocSyncFrame;
407
435
  addTrack(track: MediaStreamTrack): Promise<void>;
408
436
  removeTrack(): void;
437
+
438
+ addVideoTrack(track: MediaStreamTrack): Promise<void>;
439
+
440
+ stopVideo(): void;
409
441
  requestDiagnostics(): void;
410
442
  seekStream(name: string, target: number | 'live'): void;
411
443
 
@@ -452,4 +484,4 @@ declare class TransportSession {
452
484
  private _emitError;
453
485
  }
454
486
 
455
- export { type App as A, type ChannelEndpoint as C, type Layer as L, type RequestOptions as R, type SceneContext as S, TransportSession as T, type AppOptions as a, type AttachOptions as b, type ChannelMessage as c, ChannelMultiplexer as d, type ChannelName as e, type LayoutConfig as f, type LayoutContext as g, type RequestStreamOptions as h, type SceneGraph as i, type Session as j, type SessionDocument as k, type SessionPhase as l, type SessionPhaseName as m, type SessionStartOptions as n, type SessionStream as o, type SessionText as p, type Store as q, type StoreOptions as r, type TransportSessionOptions as s, type TransportState as t, decodeDocSyncFrame as u, encodeDocSyncFrame as v };
487
+ export { type App as A, type ChannelEndpoint as C, DeferredChannelMultiplexer as D, type Layer as L, type RequestOptions as R, type SceneContext as S, TransportSession as T, type AppOptions as a, type AttachOptions as b, type ChannelMessage as c, ChannelMultiplexer as d, type ChannelName as e, type LayoutConfig as f, type LayoutContext as g, type RequestStreamOptions as h, type SceneGraph as i, type Session as j, type SessionDocument as k, type SessionPhase as l, type SessionPhaseName as m, type SessionStartOptions as n, type SessionStream as o, type SessionText as p, type Store as q, type StoreOptions as r, type TransportSessionOptions as s, type TransportState as t, decodeDocSyncFrame as u, encodeDocSyncFrame as v };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@urun-sh/core",
3
- "version": "0.1.38",
3
+ "version": "0.1.41",
4
4
  "description": "Core transport and channel primitives for the urun TypeScript SDK",
5
5
  "repository": {
6
6
  "type": "git",
@@ -35,10 +35,10 @@
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/ws": "^8.5.12",
38
- "tsup": "^8.5.0",
39
- "vitest": "^3.0.0",
40
38
  "happy-dom": "^20.9.0",
41
- "typescript": "^5.3.0"
39
+ "tsup": "^8.5.0",
40
+ "typescript": "^5.3.0",
41
+ "vitest": "^3.0.0"
42
42
  },
43
43
  "files": [
44
44
  "dist",
@@ -62,7 +62,7 @@
62
62
  "yjs": "^13.6.0"
63
63
  },
64
64
  "optionalDependencies": {
65
- "@roamhq/wrtc": "^0.8.0",
65
+ "werift": "0.23.0",
66
66
  "ws": "^8.18.0"
67
67
  }
68
68
  }