@urun-sh/core 0.1.48 → 0.2.1
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/CHANGELOG.md +12 -0
- package/dist/chunk-2TYDFOWI.mjs +7 -0
- package/dist/{chunk-DFVMGNRH.mjs → chunk-QTLLNENF.mjs} +5 -5
- package/dist/index.browser.d.mts +321 -0
- package/dist/index.browser.d.ts +321 -0
- package/dist/index.browser.js +7 -0
- package/dist/index.browser.mjs +1 -0
- package/dist/index.d.mts +126 -24
- package/dist/index.d.ts +126 -24
- package/dist/index.js +5 -5
- package/dist/index.mjs +1 -1
- package/dist/internal.browser.d.mts +11 -0
- package/dist/internal.browser.d.ts +11 -0
- package/dist/internal.browser.js +7 -0
- package/dist/internal.browser.mjs +1 -0
- package/dist/internal.d.mts +3 -1
- package/dist/internal.d.ts +3 -1
- package/dist/internal.js +5 -5
- package/dist/internal.mjs +1 -1
- package/dist/{transport-C3iRb9nz.d.mts → stream-data-BQHZia_W.d.mts} +183 -17
- package/dist/{transport-C3iRb9nz.d.ts → stream-data-BQHZia_W.d.ts} +183 -17
- package/package.json +14 -2
package/dist/internal.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,b as
|
|
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-2TYDFOWI.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,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import * as Y from 'yjs';
|
|
2
|
+
import { Awareness } from 'y-protocols/awareness';
|
|
2
3
|
|
|
3
4
|
interface MediaChunkSource {
|
|
4
5
|
|
|
@@ -32,6 +33,64 @@ interface MediaRecorderChunkSourceOptions {
|
|
|
32
33
|
|
|
33
34
|
declare function mediaRecorderChunkSource(binding: MediaChunkBinding, options?: MediaRecorderChunkSourceOptions): MediaChunkSource;
|
|
34
35
|
|
|
36
|
+
interface DocConnection {
|
|
37
|
+
|
|
38
|
+
readonly awareness: Awareness;
|
|
39
|
+
|
|
40
|
+
readonly synced: boolean;
|
|
41
|
+
|
|
42
|
+
onSync(handler: (synced: boolean) => void): () => void;
|
|
43
|
+
|
|
44
|
+
destroy(): void;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
type DocConnector = (docName: string, doc: Y.Doc, awareness: Awareness) => DocConnection;
|
|
48
|
+
|
|
49
|
+
declare function deriveYjsServerUrl(signalingWsUrl: string): string;
|
|
50
|
+
|
|
51
|
+
interface WebsocketDocConnectorOptions {
|
|
52
|
+
|
|
53
|
+
serverUrl: string;
|
|
54
|
+
|
|
55
|
+
sessionId: string;
|
|
56
|
+
|
|
57
|
+
token?: string;
|
|
58
|
+
|
|
59
|
+
WebSocketPolyfill?: typeof WebSocket;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
declare function createWebsocketDocConnector(opts: WebsocketDocConnectorOptions): DocConnector;
|
|
63
|
+
|
|
64
|
+
declare class DeferredDocConnector {
|
|
65
|
+
private _target;
|
|
66
|
+
private _bridges;
|
|
67
|
+
|
|
68
|
+
readonly connect: DocConnector;
|
|
69
|
+
|
|
70
|
+
get connected(): boolean;
|
|
71
|
+
|
|
72
|
+
setTarget(target: DocConnector): void;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
type PresenceState = Record<string, unknown>;
|
|
76
|
+
|
|
77
|
+
interface Presence {
|
|
78
|
+
|
|
79
|
+
readonly clientId: number;
|
|
80
|
+
|
|
81
|
+
set(state: PresenceState | null): void;
|
|
82
|
+
|
|
83
|
+
setField(field: string, value: unknown): void;
|
|
84
|
+
|
|
85
|
+
getLocal(): PresenceState | null;
|
|
86
|
+
|
|
87
|
+
getStates(): Map<number, PresenceState>;
|
|
88
|
+
|
|
89
|
+
on(event: 'change', handler: (states: Map<number, PresenceState>) => void): () => void;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
declare function createPresence(awareness: Awareness): Presence;
|
|
93
|
+
|
|
35
94
|
type TransportState = 'connecting' | 'connected' | 'reconnecting' | 'renegotiating' | 'disconnected' | 'failed';
|
|
36
95
|
|
|
37
96
|
type SessionPhaseName = 'idle' | 'queued' | 'provisioning' | 'connecting' | 'live' | 'error' | 'ended';
|
|
@@ -259,6 +318,8 @@ interface Session {
|
|
|
259
318
|
|
|
260
319
|
doc(key: string): SessionDocument;
|
|
261
320
|
|
|
321
|
+
readonly presence: Presence;
|
|
322
|
+
|
|
262
323
|
request(payload: unknown, options?: RequestOptions): Promise<unknown>;
|
|
263
324
|
|
|
264
325
|
requestStream(payload: unknown, options?: RequestStreamOptions): AsyncIterable<string>;
|
|
@@ -267,9 +328,71 @@ interface Session {
|
|
|
267
328
|
|
|
268
329
|
onPhase(handler: (phase: SessionPhase) => void): () => void;
|
|
269
330
|
|
|
331
|
+
readonly recordings: RecordingsAccessor;
|
|
332
|
+
|
|
270
333
|
disconnect(): void;
|
|
271
334
|
}
|
|
272
335
|
|
|
336
|
+
type RecordingBucket = 'temp' | 'pinned';
|
|
337
|
+
|
|
338
|
+
type RecordingLifecycle = 'temp' | 'pinned' | 'permanent';
|
|
339
|
+
|
|
340
|
+
type RecordingStatus = 'active' | 'deleting' | 'deleted' | 'pending_pin' | 'pending_unpin' | 'pending_permanent' | 'pending_delete';
|
|
341
|
+
|
|
342
|
+
interface Recording {
|
|
343
|
+
|
|
344
|
+
id: string;
|
|
345
|
+
|
|
346
|
+
org_id: string;
|
|
347
|
+
|
|
348
|
+
session_id: string;
|
|
349
|
+
|
|
350
|
+
stream_name: string;
|
|
351
|
+
|
|
352
|
+
bucket: RecordingBucket;
|
|
353
|
+
|
|
354
|
+
s3_key: string;
|
|
355
|
+
|
|
356
|
+
init_key: string;
|
|
357
|
+
|
|
358
|
+
manifest_key: string;
|
|
359
|
+
|
|
360
|
+
expires_at: string | null;
|
|
361
|
+
|
|
362
|
+
lifecycle: RecordingLifecycle;
|
|
363
|
+
|
|
364
|
+
retention: string | null;
|
|
365
|
+
|
|
366
|
+
size_bytes: number | null;
|
|
367
|
+
|
|
368
|
+
duration_s: number | null;
|
|
369
|
+
|
|
370
|
+
status: RecordingStatus;
|
|
371
|
+
|
|
372
|
+
created_at: string;
|
|
373
|
+
|
|
374
|
+
updated_at: string;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
declare function isPendingRecording(recording: Pick<Recording, 'status'>): boolean;
|
|
378
|
+
|
|
379
|
+
interface RecordingsAccessor {
|
|
380
|
+
|
|
381
|
+
list(sessionId?: string): Promise<Recording[]>;
|
|
382
|
+
|
|
383
|
+
get(id: string): Promise<Recording>;
|
|
384
|
+
|
|
385
|
+
retain(id: string, duration: string): Promise<Recording>;
|
|
386
|
+
|
|
387
|
+
pin(id: string): Promise<Recording>;
|
|
388
|
+
|
|
389
|
+
unpin(id: string): Promise<Recording>;
|
|
390
|
+
|
|
391
|
+
permanent(id: string): Promise<Recording>;
|
|
392
|
+
|
|
393
|
+
delete(id: string): Promise<Recording>;
|
|
394
|
+
}
|
|
395
|
+
|
|
273
396
|
interface AppOptions {
|
|
274
397
|
|
|
275
398
|
baseUrl: string;
|
|
@@ -283,6 +406,8 @@ interface AppOptions {
|
|
|
283
406
|
getAccessToken?: (options?: AccessTokenOptions) => string | null | undefined | Promise<string | null | undefined>;
|
|
284
407
|
|
|
285
408
|
authProvider?: string;
|
|
409
|
+
|
|
410
|
+
functionsUrl?: string;
|
|
286
411
|
}
|
|
287
412
|
interface AccessTokenOptions {
|
|
288
413
|
forceRefresh?: boolean;
|
|
@@ -302,6 +427,8 @@ interface AttachOptions {
|
|
|
302
427
|
getAccessToken?: (options?: AccessTokenOptions) => string | null | undefined | Promise<string | null | undefined>;
|
|
303
428
|
|
|
304
429
|
authProvider?: string;
|
|
430
|
+
|
|
431
|
+
functionsUrl?: string;
|
|
305
432
|
}
|
|
306
433
|
|
|
307
434
|
interface App {
|
|
@@ -351,13 +478,7 @@ interface TransportConnection {
|
|
|
351
478
|
|
|
352
479
|
iceServers?: RTCIceServer[];
|
|
353
480
|
}
|
|
354
|
-
|
|
355
|
-
declare function encodeDocSyncFrame(docKey: string, payload: Uint8Array): Uint8Array;
|
|
356
|
-
|
|
357
|
-
declare function decodeDocSyncFrame(frame: Uint8Array): {
|
|
358
|
-
docKey: string;
|
|
359
|
-
payload: Uint8Array;
|
|
360
|
-
} | null;
|
|
481
|
+
declare function streamDataLabel(name: string): string;
|
|
361
482
|
interface TransportEvents {
|
|
362
483
|
connected: () => void;
|
|
363
484
|
disconnected: () => void;
|
|
@@ -366,10 +487,6 @@ interface TransportEvents {
|
|
|
366
487
|
started: () => void;
|
|
367
488
|
audioTransportReady: () => void;
|
|
368
489
|
|
|
369
|
-
docSync: (docKey: string, payload: Uint8Array) => void;
|
|
370
|
-
|
|
371
|
-
docSyncReady: () => void;
|
|
372
|
-
|
|
373
490
|
stateChange: (state: TransportState) => void;
|
|
374
491
|
|
|
375
492
|
phase: (phase: SessionPhase) => void;
|
|
@@ -439,6 +556,16 @@ declare class TransportSession {
|
|
|
439
556
|
|
|
440
557
|
private _pendingStreamSubscribes;
|
|
441
558
|
|
|
559
|
+
private _streamDataHandlers;
|
|
560
|
+
|
|
561
|
+
private _dataProducers;
|
|
562
|
+
|
|
563
|
+
private _dataProducerPromises;
|
|
564
|
+
|
|
565
|
+
private _dataConsumers;
|
|
566
|
+
|
|
567
|
+
private _pendingDataProduce;
|
|
568
|
+
|
|
442
569
|
get consumerId(): string;
|
|
443
570
|
get state(): TransportState;
|
|
444
571
|
|
|
@@ -467,13 +594,17 @@ declare class TransportSession {
|
|
|
467
594
|
on<E extends keyof TransportEvents>(event: E, handler: TransportEvents[E]): () => void;
|
|
468
595
|
sendInput(data: Record<string, unknown>, sequence?: number): void;
|
|
469
596
|
|
|
470
|
-
|
|
597
|
+
onStreamData(name: string, handler: (payload: unknown) => void): () => void;
|
|
471
598
|
|
|
472
|
-
|
|
599
|
+
sendStreamData(name: string, payload: unknown, _options?: {
|
|
600
|
+
to?: string;
|
|
601
|
+
}): void;
|
|
602
|
+
|
|
603
|
+
private _ensureDataProducer;
|
|
473
604
|
|
|
474
|
-
|
|
605
|
+
private _dispatchStreamData;
|
|
475
606
|
|
|
476
|
-
private
|
|
607
|
+
private _streamNameFromLabel;
|
|
477
608
|
addTrack(track: MediaStreamTrack, name?: string): Promise<void>;
|
|
478
609
|
removeTrack(): void;
|
|
479
610
|
|
|
@@ -502,6 +633,8 @@ declare class TransportSession {
|
|
|
502
633
|
|
|
503
634
|
private _failoverRecvToTcp;
|
|
504
635
|
private _onCreateSendTransport;
|
|
636
|
+
|
|
637
|
+
private _onConsumeData;
|
|
505
638
|
private _onConsume;
|
|
506
639
|
private _mediaPollMs;
|
|
507
640
|
private _mediaStallTimeoutMs;
|
|
@@ -519,6 +652,8 @@ declare class TransportSession {
|
|
|
519
652
|
|
|
520
653
|
private _scheduleReconnectBudgetReset;
|
|
521
654
|
private _clearReconnectBudgetReset;
|
|
655
|
+
|
|
656
|
+
private _cleanupDataChannels;
|
|
522
657
|
private _cleanupMedia;
|
|
523
658
|
private _send;
|
|
524
659
|
private _setState;
|
|
@@ -528,4 +663,35 @@ declare class TransportSession {
|
|
|
528
663
|
private _emitError;
|
|
529
664
|
}
|
|
530
665
|
|
|
531
|
-
|
|
666
|
+
interface StreamDataTransport {
|
|
667
|
+
|
|
668
|
+
readonly consumerId: string;
|
|
669
|
+
|
|
670
|
+
onData(name: string, handler: (payload: unknown) => void): () => void;
|
|
671
|
+
|
|
672
|
+
sendData(name: string, payload: unknown, options?: {
|
|
673
|
+
to?: string;
|
|
674
|
+
}): void;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
declare class LoopbackStreamData implements StreamDataTransport {
|
|
678
|
+
readonly consumerId: string;
|
|
679
|
+
private _handlers;
|
|
680
|
+
constructor(consumerId?: string);
|
|
681
|
+
onData(name: string, handler: (payload: unknown) => void): () => void;
|
|
682
|
+
sendData(name: string, payload: unknown, options?: {
|
|
683
|
+
to?: string;
|
|
684
|
+
}): void;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
interface DataChannelTransport {
|
|
688
|
+
readonly consumerId: string;
|
|
689
|
+
onStreamData(name: string, handler: (payload: unknown) => void): () => void;
|
|
690
|
+
sendStreamData(name: string, payload: unknown, options?: {
|
|
691
|
+
to?: string;
|
|
692
|
+
}): void;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
declare function transportStreamData(transport: DataChannelTransport): StreamDataTransport;
|
|
696
|
+
|
|
697
|
+
export { type AccessTokenOptions as A, type SessionPhase as B, type ChannelEndpoint as C, DeferredChannelMultiplexer as D, type SessionPhaseName as E, type SessionStartOptions as F, type SessionStream as G, type SessionText as H, type Store as I, type StoreOptions as J, type StreamChunkOptions as K, type Layer as L, type MediaChunkBinding as M, type StreamDataTransport as N, type TransportSessionOptions as O, type Presence as P, type TransportState as Q, type Recording as R, type SceneContext as S, TransportSession as T, createPresence as U, createWebsocketDocConnector as V, deriveYjsServerUrl as W, isPendingRecording as X, mediaRecorderChunkSource as Y, streamDataLabel as Z, transportStreamData as _, type App as a, 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 SceneGraph as x, type Session as y, type SessionDocument as z };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import * as Y from 'yjs';
|
|
2
|
+
import { Awareness } from 'y-protocols/awareness';
|
|
2
3
|
|
|
3
4
|
interface MediaChunkSource {
|
|
4
5
|
|
|
@@ -32,6 +33,64 @@ interface MediaRecorderChunkSourceOptions {
|
|
|
32
33
|
|
|
33
34
|
declare function mediaRecorderChunkSource(binding: MediaChunkBinding, options?: MediaRecorderChunkSourceOptions): MediaChunkSource;
|
|
34
35
|
|
|
36
|
+
interface DocConnection {
|
|
37
|
+
|
|
38
|
+
readonly awareness: Awareness;
|
|
39
|
+
|
|
40
|
+
readonly synced: boolean;
|
|
41
|
+
|
|
42
|
+
onSync(handler: (synced: boolean) => void): () => void;
|
|
43
|
+
|
|
44
|
+
destroy(): void;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
type DocConnector = (docName: string, doc: Y.Doc, awareness: Awareness) => DocConnection;
|
|
48
|
+
|
|
49
|
+
declare function deriveYjsServerUrl(signalingWsUrl: string): string;
|
|
50
|
+
|
|
51
|
+
interface WebsocketDocConnectorOptions {
|
|
52
|
+
|
|
53
|
+
serverUrl: string;
|
|
54
|
+
|
|
55
|
+
sessionId: string;
|
|
56
|
+
|
|
57
|
+
token?: string;
|
|
58
|
+
|
|
59
|
+
WebSocketPolyfill?: typeof WebSocket;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
declare function createWebsocketDocConnector(opts: WebsocketDocConnectorOptions): DocConnector;
|
|
63
|
+
|
|
64
|
+
declare class DeferredDocConnector {
|
|
65
|
+
private _target;
|
|
66
|
+
private _bridges;
|
|
67
|
+
|
|
68
|
+
readonly connect: DocConnector;
|
|
69
|
+
|
|
70
|
+
get connected(): boolean;
|
|
71
|
+
|
|
72
|
+
setTarget(target: DocConnector): void;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
type PresenceState = Record<string, unknown>;
|
|
76
|
+
|
|
77
|
+
interface Presence {
|
|
78
|
+
|
|
79
|
+
readonly clientId: number;
|
|
80
|
+
|
|
81
|
+
set(state: PresenceState | null): void;
|
|
82
|
+
|
|
83
|
+
setField(field: string, value: unknown): void;
|
|
84
|
+
|
|
85
|
+
getLocal(): PresenceState | null;
|
|
86
|
+
|
|
87
|
+
getStates(): Map<number, PresenceState>;
|
|
88
|
+
|
|
89
|
+
on(event: 'change', handler: (states: Map<number, PresenceState>) => void): () => void;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
declare function createPresence(awareness: Awareness): Presence;
|
|
93
|
+
|
|
35
94
|
type TransportState = 'connecting' | 'connected' | 'reconnecting' | 'renegotiating' | 'disconnected' | 'failed';
|
|
36
95
|
|
|
37
96
|
type SessionPhaseName = 'idle' | 'queued' | 'provisioning' | 'connecting' | 'live' | 'error' | 'ended';
|
|
@@ -259,6 +318,8 @@ interface Session {
|
|
|
259
318
|
|
|
260
319
|
doc(key: string): SessionDocument;
|
|
261
320
|
|
|
321
|
+
readonly presence: Presence;
|
|
322
|
+
|
|
262
323
|
request(payload: unknown, options?: RequestOptions): Promise<unknown>;
|
|
263
324
|
|
|
264
325
|
requestStream(payload: unknown, options?: RequestStreamOptions): AsyncIterable<string>;
|
|
@@ -267,9 +328,71 @@ interface Session {
|
|
|
267
328
|
|
|
268
329
|
onPhase(handler: (phase: SessionPhase) => void): () => void;
|
|
269
330
|
|
|
331
|
+
readonly recordings: RecordingsAccessor;
|
|
332
|
+
|
|
270
333
|
disconnect(): void;
|
|
271
334
|
}
|
|
272
335
|
|
|
336
|
+
type RecordingBucket = 'temp' | 'pinned';
|
|
337
|
+
|
|
338
|
+
type RecordingLifecycle = 'temp' | 'pinned' | 'permanent';
|
|
339
|
+
|
|
340
|
+
type RecordingStatus = 'active' | 'deleting' | 'deleted' | 'pending_pin' | 'pending_unpin' | 'pending_permanent' | 'pending_delete';
|
|
341
|
+
|
|
342
|
+
interface Recording {
|
|
343
|
+
|
|
344
|
+
id: string;
|
|
345
|
+
|
|
346
|
+
org_id: string;
|
|
347
|
+
|
|
348
|
+
session_id: string;
|
|
349
|
+
|
|
350
|
+
stream_name: string;
|
|
351
|
+
|
|
352
|
+
bucket: RecordingBucket;
|
|
353
|
+
|
|
354
|
+
s3_key: string;
|
|
355
|
+
|
|
356
|
+
init_key: string;
|
|
357
|
+
|
|
358
|
+
manifest_key: string;
|
|
359
|
+
|
|
360
|
+
expires_at: string | null;
|
|
361
|
+
|
|
362
|
+
lifecycle: RecordingLifecycle;
|
|
363
|
+
|
|
364
|
+
retention: string | null;
|
|
365
|
+
|
|
366
|
+
size_bytes: number | null;
|
|
367
|
+
|
|
368
|
+
duration_s: number | null;
|
|
369
|
+
|
|
370
|
+
status: RecordingStatus;
|
|
371
|
+
|
|
372
|
+
created_at: string;
|
|
373
|
+
|
|
374
|
+
updated_at: string;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
declare function isPendingRecording(recording: Pick<Recording, 'status'>): boolean;
|
|
378
|
+
|
|
379
|
+
interface RecordingsAccessor {
|
|
380
|
+
|
|
381
|
+
list(sessionId?: string): Promise<Recording[]>;
|
|
382
|
+
|
|
383
|
+
get(id: string): Promise<Recording>;
|
|
384
|
+
|
|
385
|
+
retain(id: string, duration: string): Promise<Recording>;
|
|
386
|
+
|
|
387
|
+
pin(id: string): Promise<Recording>;
|
|
388
|
+
|
|
389
|
+
unpin(id: string): Promise<Recording>;
|
|
390
|
+
|
|
391
|
+
permanent(id: string): Promise<Recording>;
|
|
392
|
+
|
|
393
|
+
delete(id: string): Promise<Recording>;
|
|
394
|
+
}
|
|
395
|
+
|
|
273
396
|
interface AppOptions {
|
|
274
397
|
|
|
275
398
|
baseUrl: string;
|
|
@@ -283,6 +406,8 @@ interface AppOptions {
|
|
|
283
406
|
getAccessToken?: (options?: AccessTokenOptions) => string | null | undefined | Promise<string | null | undefined>;
|
|
284
407
|
|
|
285
408
|
authProvider?: string;
|
|
409
|
+
|
|
410
|
+
functionsUrl?: string;
|
|
286
411
|
}
|
|
287
412
|
interface AccessTokenOptions {
|
|
288
413
|
forceRefresh?: boolean;
|
|
@@ -302,6 +427,8 @@ interface AttachOptions {
|
|
|
302
427
|
getAccessToken?: (options?: AccessTokenOptions) => string | null | undefined | Promise<string | null | undefined>;
|
|
303
428
|
|
|
304
429
|
authProvider?: string;
|
|
430
|
+
|
|
431
|
+
functionsUrl?: string;
|
|
305
432
|
}
|
|
306
433
|
|
|
307
434
|
interface App {
|
|
@@ -351,13 +478,7 @@ interface TransportConnection {
|
|
|
351
478
|
|
|
352
479
|
iceServers?: RTCIceServer[];
|
|
353
480
|
}
|
|
354
|
-
|
|
355
|
-
declare function encodeDocSyncFrame(docKey: string, payload: Uint8Array): Uint8Array;
|
|
356
|
-
|
|
357
|
-
declare function decodeDocSyncFrame(frame: Uint8Array): {
|
|
358
|
-
docKey: string;
|
|
359
|
-
payload: Uint8Array;
|
|
360
|
-
} | null;
|
|
481
|
+
declare function streamDataLabel(name: string): string;
|
|
361
482
|
interface TransportEvents {
|
|
362
483
|
connected: () => void;
|
|
363
484
|
disconnected: () => void;
|
|
@@ -366,10 +487,6 @@ interface TransportEvents {
|
|
|
366
487
|
started: () => void;
|
|
367
488
|
audioTransportReady: () => void;
|
|
368
489
|
|
|
369
|
-
docSync: (docKey: string, payload: Uint8Array) => void;
|
|
370
|
-
|
|
371
|
-
docSyncReady: () => void;
|
|
372
|
-
|
|
373
490
|
stateChange: (state: TransportState) => void;
|
|
374
491
|
|
|
375
492
|
phase: (phase: SessionPhase) => void;
|
|
@@ -439,6 +556,16 @@ declare class TransportSession {
|
|
|
439
556
|
|
|
440
557
|
private _pendingStreamSubscribes;
|
|
441
558
|
|
|
559
|
+
private _streamDataHandlers;
|
|
560
|
+
|
|
561
|
+
private _dataProducers;
|
|
562
|
+
|
|
563
|
+
private _dataProducerPromises;
|
|
564
|
+
|
|
565
|
+
private _dataConsumers;
|
|
566
|
+
|
|
567
|
+
private _pendingDataProduce;
|
|
568
|
+
|
|
442
569
|
get consumerId(): string;
|
|
443
570
|
get state(): TransportState;
|
|
444
571
|
|
|
@@ -467,13 +594,17 @@ declare class TransportSession {
|
|
|
467
594
|
on<E extends keyof TransportEvents>(event: E, handler: TransportEvents[E]): () => void;
|
|
468
595
|
sendInput(data: Record<string, unknown>, sequence?: number): void;
|
|
469
596
|
|
|
470
|
-
|
|
597
|
+
onStreamData(name: string, handler: (payload: unknown) => void): () => void;
|
|
471
598
|
|
|
472
|
-
|
|
599
|
+
sendStreamData(name: string, payload: unknown, _options?: {
|
|
600
|
+
to?: string;
|
|
601
|
+
}): void;
|
|
602
|
+
|
|
603
|
+
private _ensureDataProducer;
|
|
473
604
|
|
|
474
|
-
|
|
605
|
+
private _dispatchStreamData;
|
|
475
606
|
|
|
476
|
-
private
|
|
607
|
+
private _streamNameFromLabel;
|
|
477
608
|
addTrack(track: MediaStreamTrack, name?: string): Promise<void>;
|
|
478
609
|
removeTrack(): void;
|
|
479
610
|
|
|
@@ -502,6 +633,8 @@ declare class TransportSession {
|
|
|
502
633
|
|
|
503
634
|
private _failoverRecvToTcp;
|
|
504
635
|
private _onCreateSendTransport;
|
|
636
|
+
|
|
637
|
+
private _onConsumeData;
|
|
505
638
|
private _onConsume;
|
|
506
639
|
private _mediaPollMs;
|
|
507
640
|
private _mediaStallTimeoutMs;
|
|
@@ -519,6 +652,8 @@ declare class TransportSession {
|
|
|
519
652
|
|
|
520
653
|
private _scheduleReconnectBudgetReset;
|
|
521
654
|
private _clearReconnectBudgetReset;
|
|
655
|
+
|
|
656
|
+
private _cleanupDataChannels;
|
|
522
657
|
private _cleanupMedia;
|
|
523
658
|
private _send;
|
|
524
659
|
private _setState;
|
|
@@ -528,4 +663,35 @@ declare class TransportSession {
|
|
|
528
663
|
private _emitError;
|
|
529
664
|
}
|
|
530
665
|
|
|
531
|
-
|
|
666
|
+
interface StreamDataTransport {
|
|
667
|
+
|
|
668
|
+
readonly consumerId: string;
|
|
669
|
+
|
|
670
|
+
onData(name: string, handler: (payload: unknown) => void): () => void;
|
|
671
|
+
|
|
672
|
+
sendData(name: string, payload: unknown, options?: {
|
|
673
|
+
to?: string;
|
|
674
|
+
}): void;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
declare class LoopbackStreamData implements StreamDataTransport {
|
|
678
|
+
readonly consumerId: string;
|
|
679
|
+
private _handlers;
|
|
680
|
+
constructor(consumerId?: string);
|
|
681
|
+
onData(name: string, handler: (payload: unknown) => void): () => void;
|
|
682
|
+
sendData(name: string, payload: unknown, options?: {
|
|
683
|
+
to?: string;
|
|
684
|
+
}): void;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
interface DataChannelTransport {
|
|
688
|
+
readonly consumerId: string;
|
|
689
|
+
onStreamData(name: string, handler: (payload: unknown) => void): () => void;
|
|
690
|
+
sendStreamData(name: string, payload: unknown, options?: {
|
|
691
|
+
to?: string;
|
|
692
|
+
}): void;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
declare function transportStreamData(transport: DataChannelTransport): StreamDataTransport;
|
|
696
|
+
|
|
697
|
+
export { type AccessTokenOptions as A, type SessionPhase as B, type ChannelEndpoint as C, DeferredChannelMultiplexer as D, type SessionPhaseName as E, type SessionStartOptions as F, type SessionStream as G, type SessionText as H, type Store as I, type StoreOptions as J, type StreamChunkOptions as K, type Layer as L, type MediaChunkBinding as M, type StreamDataTransport as N, type TransportSessionOptions as O, type Presence as P, type TransportState as Q, type Recording as R, type SceneContext as S, TransportSession as T, createPresence as U, createWebsocketDocConnector as V, deriveYjsServerUrl as W, isPendingRecording as X, mediaRecorderChunkSource as Y, streamDataLabel as Z, transportStreamData as _, type App as a, 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 SceneGraph as x, type Session as y, type SessionDocument as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@urun-sh/core",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Core transport and channel primitives for the urun TypeScript SDK",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -17,11 +17,21 @@
|
|
|
17
17
|
"exports": {
|
|
18
18
|
".": {
|
|
19
19
|
"types": "./dist/index.d.ts",
|
|
20
|
+
"browser": {
|
|
21
|
+
"types": "./dist/index.browser.d.ts",
|
|
22
|
+
"import": "./dist/index.browser.mjs",
|
|
23
|
+
"require": "./dist/index.browser.js"
|
|
24
|
+
},
|
|
20
25
|
"import": "./dist/index.mjs",
|
|
21
26
|
"require": "./dist/index.js"
|
|
22
27
|
},
|
|
23
28
|
"./internal": {
|
|
24
29
|
"types": "./dist/internal.d.ts",
|
|
30
|
+
"browser": {
|
|
31
|
+
"types": "./dist/internal.browser.d.ts",
|
|
32
|
+
"import": "./dist/internal.browser.mjs",
|
|
33
|
+
"require": "./dist/internal.browser.js"
|
|
34
|
+
},
|
|
25
35
|
"import": "./dist/internal.mjs",
|
|
26
36
|
"require": "./dist/internal.js"
|
|
27
37
|
},
|
|
@@ -59,7 +69,9 @@
|
|
|
59
69
|
},
|
|
60
70
|
"license": "MIT",
|
|
61
71
|
"dependencies": {
|
|
62
|
-
"
|
|
72
|
+
"y-protocols": "1.0.7",
|
|
73
|
+
"y-websocket": "3.0.0",
|
|
74
|
+
"yjs": "^13.6.31"
|
|
63
75
|
},
|
|
64
76
|
"optionalDependencies": {
|
|
65
77
|
"werift": "0.23.0",
|