@urun-sh/core 0.1.37 → 0.1.39

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
 
@@ -176,11 +178,17 @@ interface SessionStream {
176
178
 
177
179
  attach(track: MediaStreamTrack): Promise<void>;
178
180
 
181
+ attachVideo(track: MediaStreamTrack): Promise<void>;
182
+
179
183
  detach(): Promise<void>;
180
184
 
185
+ detachVideo(): Promise<void>;
186
+
181
187
  seek(target: number | 'live'): Promise<void>;
182
188
 
183
189
  on(event: 'track', handler: (track: MediaStreamTrack | null) => void): () => void;
190
+
191
+ messages(): AsyncIterable<unknown>;
184
192
  }
185
193
 
186
194
  interface RequestOptions {
@@ -209,6 +217,8 @@ interface Session {
209
217
 
210
218
  requestStream(payload: unknown, options?: RequestStreamOptions): AsyncIterable<string>;
211
219
 
220
+ complete(payload: unknown, options?: RequestStreamOptions): Promise<unknown>;
221
+
212
222
  onPhase(handler: (phase: SessionPhase) => void): () => void;
213
223
 
214
224
  disconnect(): void;
@@ -274,11 +284,26 @@ declare class ChannelMultiplexer implements ChannelEndpoint {
274
284
  private flushPendingSends;
275
285
  private listenForOpen;
276
286
  }
287
+ declare class DeferredChannelMultiplexer implements ChannelEndpoint {
288
+ private _handlers;
289
+ private _pendingSends;
290
+ private _target;
291
+ private _targetUnsubscribes;
292
+ private _disposed;
293
+ setTarget(target: ChannelEndpoint): void;
294
+ rewriteSessionChannels(oldSessionId: string, newSessionId: string): void;
295
+ on(channel: string, handler: (data: ChannelMessage) => void): () => void;
296
+ emit(channel: string, data: Record<string, unknown>): void;
297
+ dispose(): void;
298
+ private detachTarget;
299
+ }
277
300
 
278
301
  interface TransportConnection {
279
302
  url: string;
280
303
  sessionId: string;
281
304
  jwt?: string;
305
+
306
+ iceServers?: RTCIceServer[];
282
307
  }
283
308
 
284
309
  declare function encodeDocSyncFrame(docKey: string, payload: Uint8Array): Uint8Array;
@@ -331,6 +356,7 @@ declare class TransportSession {
331
356
  private _sendTransport;
332
357
  private _consumers;
333
358
  private _audioProducer;
359
+ private _videoProducer;
334
360
  private _pendingProduce;
335
361
  private _multiplexer;
336
362
  private _reconnectAttempts;
@@ -360,6 +386,12 @@ declare class TransportSession {
360
386
  private _mediaDeathHandled;
361
387
 
362
388
  private _currentEpoch;
389
+
390
+ private _consumerId;
391
+
392
+ private _pendingStreamSubscribes;
393
+
394
+ get consumerId(): string;
363
395
  get state(): TransportState;
364
396
 
365
397
  get currentIncarnation(): number;
@@ -372,7 +404,7 @@ declare class TransportSession {
372
404
  getTrackByName(name: string): MediaStreamTrack | undefined;
373
405
  setAuth(options: Pick<TransportSessionOptions, 'orgId' | 'jwt' | 'authProvider'>): void;
374
406
  constructor(options?: TransportSessionOptions);
375
- setConnection(options: Pick<TransportSessionOptions, 'url' | 'fallbackUrls' | 'sessionId'>): void;
407
+ setConnection(options: Pick<TransportSessionOptions, 'url' | 'fallbackUrls' | 'sessionId' | 'iceServers'>): void;
376
408
  setConnectionResolver(resolveConnection: (() => Promise<TransportConnection>) | null): void;
377
409
 
378
410
  applyControlDocState(state: Record<string, unknown> | null | undefined): void;
@@ -396,8 +428,19 @@ declare class TransportSession {
396
428
  private _emitDocSyncFrame;
397
429
  addTrack(track: MediaStreamTrack): Promise<void>;
398
430
  removeTrack(): void;
431
+
432
+ addVideoTrack(track: MediaStreamTrack): Promise<void>;
433
+
434
+ stopVideo(): void;
399
435
  requestDiagnostics(): void;
400
436
  seekStream(name: string, target: number | 'live'): void;
437
+
438
+ subscribeStream(name: string): void;
439
+
440
+ unsubscribeStream(name: string): void;
441
+ private _sendStreamSubscribe;
442
+
443
+ private _flushStreamSubscribes;
401
444
  private _handleMessage;
402
445
 
403
446
  private _onStatus;
@@ -435,4 +478,4 @@ declare class TransportSession {
435
478
  private _emitError;
436
479
  }
437
480
 
438
- 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 };
481
+ 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
 
@@ -176,11 +178,17 @@ interface SessionStream {
176
178
 
177
179
  attach(track: MediaStreamTrack): Promise<void>;
178
180
 
181
+ attachVideo(track: MediaStreamTrack): Promise<void>;
182
+
179
183
  detach(): Promise<void>;
180
184
 
185
+ detachVideo(): Promise<void>;
186
+
181
187
  seek(target: number | 'live'): Promise<void>;
182
188
 
183
189
  on(event: 'track', handler: (track: MediaStreamTrack | null) => void): () => void;
190
+
191
+ messages(): AsyncIterable<unknown>;
184
192
  }
185
193
 
186
194
  interface RequestOptions {
@@ -209,6 +217,8 @@ interface Session {
209
217
 
210
218
  requestStream(payload: unknown, options?: RequestStreamOptions): AsyncIterable<string>;
211
219
 
220
+ complete(payload: unknown, options?: RequestStreamOptions): Promise<unknown>;
221
+
212
222
  onPhase(handler: (phase: SessionPhase) => void): () => void;
213
223
 
214
224
  disconnect(): void;
@@ -274,11 +284,26 @@ declare class ChannelMultiplexer implements ChannelEndpoint {
274
284
  private flushPendingSends;
275
285
  private listenForOpen;
276
286
  }
287
+ declare class DeferredChannelMultiplexer implements ChannelEndpoint {
288
+ private _handlers;
289
+ private _pendingSends;
290
+ private _target;
291
+ private _targetUnsubscribes;
292
+ private _disposed;
293
+ setTarget(target: ChannelEndpoint): void;
294
+ rewriteSessionChannels(oldSessionId: string, newSessionId: string): void;
295
+ on(channel: string, handler: (data: ChannelMessage) => void): () => void;
296
+ emit(channel: string, data: Record<string, unknown>): void;
297
+ dispose(): void;
298
+ private detachTarget;
299
+ }
277
300
 
278
301
  interface TransportConnection {
279
302
  url: string;
280
303
  sessionId: string;
281
304
  jwt?: string;
305
+
306
+ iceServers?: RTCIceServer[];
282
307
  }
283
308
 
284
309
  declare function encodeDocSyncFrame(docKey: string, payload: Uint8Array): Uint8Array;
@@ -331,6 +356,7 @@ declare class TransportSession {
331
356
  private _sendTransport;
332
357
  private _consumers;
333
358
  private _audioProducer;
359
+ private _videoProducer;
334
360
  private _pendingProduce;
335
361
  private _multiplexer;
336
362
  private _reconnectAttempts;
@@ -360,6 +386,12 @@ declare class TransportSession {
360
386
  private _mediaDeathHandled;
361
387
 
362
388
  private _currentEpoch;
389
+
390
+ private _consumerId;
391
+
392
+ private _pendingStreamSubscribes;
393
+
394
+ get consumerId(): string;
363
395
  get state(): TransportState;
364
396
 
365
397
  get currentIncarnation(): number;
@@ -372,7 +404,7 @@ declare class TransportSession {
372
404
  getTrackByName(name: string): MediaStreamTrack | undefined;
373
405
  setAuth(options: Pick<TransportSessionOptions, 'orgId' | 'jwt' | 'authProvider'>): void;
374
406
  constructor(options?: TransportSessionOptions);
375
- setConnection(options: Pick<TransportSessionOptions, 'url' | 'fallbackUrls' | 'sessionId'>): void;
407
+ setConnection(options: Pick<TransportSessionOptions, 'url' | 'fallbackUrls' | 'sessionId' | 'iceServers'>): void;
376
408
  setConnectionResolver(resolveConnection: (() => Promise<TransportConnection>) | null): void;
377
409
 
378
410
  applyControlDocState(state: Record<string, unknown> | null | undefined): void;
@@ -396,8 +428,19 @@ declare class TransportSession {
396
428
  private _emitDocSyncFrame;
397
429
  addTrack(track: MediaStreamTrack): Promise<void>;
398
430
  removeTrack(): void;
431
+
432
+ addVideoTrack(track: MediaStreamTrack): Promise<void>;
433
+
434
+ stopVideo(): void;
399
435
  requestDiagnostics(): void;
400
436
  seekStream(name: string, target: number | 'live'): void;
437
+
438
+ subscribeStream(name: string): void;
439
+
440
+ unsubscribeStream(name: string): void;
441
+ private _sendStreamSubscribe;
442
+
443
+ private _flushStreamSubscribes;
401
444
  private _handleMessage;
402
445
 
403
446
  private _onStatus;
@@ -435,4 +478,4 @@ declare class TransportSession {
435
478
  private _emitError;
436
479
  }
437
480
 
438
- 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 };
481
+ 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.37",
3
+ "version": "0.1.39",
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
  }