@urun-sh/core 0.2.7 → 0.2.9

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.
@@ -1,10 +1,39 @@
1
- import { b as AppOptions, a as App$1, J as SessionPhase, Q as SessionStatus, A as AccessTokenOptions, x as RuntimeArtifact, y as RuntimeArtifactDownload, R as Recording, F as Session$1, C as ChannelEndpoint, Z as TransportSession, c as AttachOptions, u as RecordingsAccessor, z as RuntimeArtifactsAccessor, T as SessionStream$1, Y as StreamDataTransport, H as SessionDocumentImpl, X as StreamChunkOptions, g as ChunkReadable, P as Presence, j as DocConnector, v as RequestOptions, w as RequestStreamOptions, W as StoreOptions, V as Store, e as ChannelMultiplexer, I as SessionFailureKind } from './stream-data-B16nTnox.mjs';
2
- export { L as Layer, k as LayoutConfig, l as LayoutContext, M as MediaChunkBinding, n as MediaChunkSource, o as MediaChunkSourceFactory, p as MediaRecorderChunkSourceOptions, q as PresenceState, r as RecordingBucket, s as RecordingLifecycle, t as RecordingStatus, B as RuntimeAvailability, S as SceneContext, E as SceneGraph, G as SessionDocument, K as SessionPhaseError, N as SessionPhaseName, U as SessionText, $ as TransportState, a3 as isPendingRecording, a4 as mediaRecorderChunkSource } from './stream-data-B16nTnox.mjs';
1
+ import { b as AppOptions, a as App$1, K as SessionPhase, T as SessionStatus, O as SessionPhaseName, A as AccessTokenOptions$1, y as RuntimeArtifact, z as RuntimeArtifactDownload, R as Recording, G as Session$1, C as ChannelEndpoint, _ as TransportSession, c as AttachOptions, v as RecordingsAccessor, B as RuntimeArtifactsAccessor, U as SessionStream$1, Z as StreamDataTransport, I as SessionDocumentImpl, Y as StreamChunkOptions, g as ChunkReadable, P as Presence, k as DocConnector, w as RequestOptions, x as RequestStreamOptions, X as StoreOptions, W as Store, e as ChannelMultiplexer, J as SessionFailureKind } from './stream-data-DWu57atL.mjs';
2
+ export { L as Layer, l as LayoutConfig, m as LayoutContext, M as MediaChunkBinding, o as MediaChunkSource, p as MediaChunkSourceFactory, q as MediaRecorderChunkSourceOptions, r as PresenceState, s as RecordingBucket, t as RecordingLifecycle, u as RecordingStatus, E as RuntimeAvailability, S as SceneContext, F as SceneGraph, H as SessionDocument, N as SessionPhaseError, V as SessionText, a0 as TransportState, a4 as isPendingRecording, a5 as mediaRecorderChunkSource } from './stream-data-DWu57atL.mjs';
3
3
  import 'yjs';
4
4
  import 'y-protocols/awareness';
5
5
 
6
6
  declare function App(appId: string, options: AppOptions): App$1;
7
7
 
8
+ interface AccessTokenOptions {
9
+ forceRefresh?: boolean;
10
+ reason?: 'initial' | 'unauthorized' | 'background';
11
+ }
12
+ interface PrewakeOptions {
13
+ baseUrl: string;
14
+
15
+ app: string;
16
+
17
+ functionName: string;
18
+ orgId: string;
19
+ jwt?: string;
20
+ getAccessToken?: (options?: AccessTokenOptions) => string | null | undefined | Promise<string | null | undefined>;
21
+ authProvider?: string;
22
+ }
23
+ type PrewakeStatus = 'warming' | 'prebound' | 'unknown-app' | 'unavailable';
24
+ interface PrewakeResult {
25
+
26
+ status: PrewakeStatus;
27
+
28
+ expiresAt?: string;
29
+
30
+ warmCapable?: boolean;
31
+ }
32
+
33
+ declare function prewake(options: PrewakeOptions): Promise<PrewakeResult>;
34
+
35
+ declare function isWakingPhase(phase: SessionPhase | SessionPhaseName | null | undefined): boolean;
36
+
8
37
  interface PhaseObservable {
9
38
 
10
39
  readonly phase: SessionPhase;
@@ -32,7 +61,7 @@ interface RuntimeArtifactsClientOptions {
32
61
  fallbackUrls?: readonly string[];
33
62
  orgId: string;
34
63
  jwt?: string;
35
- getAccessToken?: (options?: AccessTokenOptions) => string | null | undefined | Promise<string | null | undefined>;
64
+ getAccessToken?: (options?: AccessTokenOptions$1) => string | null | undefined | Promise<string | null | undefined>;
36
65
  authProvider?: string;
37
66
  }
38
67
  declare class RuntimeArtifactsError extends Error {
@@ -69,7 +98,7 @@ interface RecordingsClientOptions {
69
98
 
70
99
  jwt?: string;
71
100
 
72
- getAccessToken?: (options?: AccessTokenOptions) => string | null | undefined | Promise<string | null | undefined>;
101
+ getAccessToken?: (options?: AccessTokenOptions$1) => string | null | undefined | Promise<string | null | undefined>;
73
102
 
74
103
  authProvider?: string;
75
104
  }
@@ -227,6 +256,10 @@ declare class Session implements Session$1 {
227
256
  private _recordingsAccessor;
228
257
 
229
258
  private _artifactsAccessor;
259
+
260
+ private _recoveryHooks;
261
+
262
+ private _lifecycleUnsub;
230
263
  constructor(sessionId: string, multiplexer: ChannelEndpoint, transport: TransportSession, recordingsAuth?: RecordingsClientOptions, artifactsAuth?: RuntimeArtifactsClientOptions);
231
264
  private _wireControlDocIncarnation;
232
265
 
@@ -235,6 +268,8 @@ declare class Session implements Session$1 {
235
268
 
236
269
  get phase(): SessionPhase;
237
270
 
271
+ get endsAt(): Date | null;
272
+
238
273
  get status(): SessionStatus;
239
274
 
240
275
  onPhase(handler: (phase: SessionPhase) => void): () => void;
@@ -273,9 +308,17 @@ declare class Session implements Session$1 {
273
308
  requestStream(payload: unknown, options?: RequestStreamOptions): AsyncIterable<string>;
274
309
 
275
310
  complete(payload: unknown, options?: RequestStreamOptions): Promise<unknown>;
311
+
312
+ recover(): void;
313
+
314
+ onRecovery(hook: () => void): () => void;
276
315
  disconnect(): void;
277
316
  }
278
317
 
318
+ declare const FOREGROUND_COALESCE_MS = 250;
319
+
320
+ declare function observePageLifecycle(onForeground: () => void): () => void;
321
+
279
322
  declare function createStore(options: StoreOptions): Store & {
280
323
  _getInternals(): {
281
324
  multiplexer: ChannelMultiplexer;
@@ -359,4 +402,49 @@ declare class SessionAllocationError extends Error {
359
402
  });
360
403
  }
361
404
 
362
- export { App, App$1 as AppInterface, AppOptions, AttachOptions, ChunkReadable, DEFAULT_DOC_SYNC_TIMEOUT_MS, DEFAULT_WHEN_LIVE_TIMEOUT_MS, InvalidDurationError, PermanentLockedError, type PhaseObservable, PinRequiresActiveTempError, Presence, Recording, RecordingNotFoundError, RecordingsAccessor, RecordingsClient, type RecordingsClientOptions, RecordingsError, RecordingsUnauthorizedError, RequestAbortError, RequestCancelledError, RequestDocSyncError, RequestError, RequestOptions, RequestStreamOptions, RequestTimeoutError, RetainNotTempError, type RetentionIntent, RuntimeArtifact, RuntimeArtifactDownload, RuntimeArtifactNotFoundError, RuntimeArtifactsAccessor, RuntimeArtifactsClient, type RuntimeArtifactsClientOptions, RuntimeArtifactsError, RuntimeArtifactsUnauthorizedError, Session, SessionAllocationError, SessionFailedError, SessionFailureKind, Session$1 as SessionInterface, SessionPhase, SessionStatus, SessionStream$1 as SessionStream, Store, StoreOptions, StreamChunkOptions, StreamDirectionConflict, type VideoStreamOptions, type WhenLiveOptions, createRecordingsClient, createRuntimeArtifactsClient, createStore, describeSessionFailure, describeSessionPhase, isDurationString, normalizeRetention, sessionFailureFromMediaError, videoStream, whenLive };
405
+ type CaptureKind = 'audio' | 'video';
406
+ type GetUserMedia = (constraints: MediaStreamConstraints) => Promise<MediaStream>;
407
+
408
+ declare class CaptureUnavailableError extends Error {
409
+ constructor();
410
+ }
411
+
412
+ interface CaptureClaim {
413
+ readonly kind: CaptureKind;
414
+
415
+ readonly track: MediaStreamTrack | null;
416
+
417
+ readonly stream: MediaStream | null;
418
+
419
+ update(constraints: MediaTrackConstraints): Promise<MediaStreamTrack>;
420
+
421
+ release(): void;
422
+
423
+ onTrack(listener: (track: MediaStreamTrack, stream: MediaStream) => void): () => void;
424
+
425
+ onLost(listener: (error: Error) => void): () => void;
426
+ }
427
+ interface CaptureControllerOptions {
428
+
429
+ getUserMedia?: GetUserMedia;
430
+ }
431
+
432
+ declare class CaptureController {
433
+ private readonly claims;
434
+ private readonly injectedGetUserMedia?;
435
+ private queue;
436
+ constructor(options?: CaptureControllerOptions);
437
+
438
+ claim(kind: CaptureKind, constraints: MediaTrackConstraints): Promise<CaptureClaim>;
439
+
440
+ idle(): Promise<void>;
441
+ private enqueue;
442
+ private resolveGetUserMedia;
443
+
444
+ private converge;
445
+ private createState;
446
+ }
447
+
448
+ declare function sharedCaptureController(): CaptureController;
449
+
450
+ export { App, App$1 as AppInterface, AppOptions, AttachOptions, type CaptureClaim, CaptureController, type CaptureControllerOptions, type CaptureKind, CaptureUnavailableError, ChunkReadable, DEFAULT_DOC_SYNC_TIMEOUT_MS, DEFAULT_WHEN_LIVE_TIMEOUT_MS, FOREGROUND_COALESCE_MS, InvalidDurationError, PermanentLockedError, type PhaseObservable, PinRequiresActiveTempError, Presence, type PrewakeOptions, type PrewakeResult, type PrewakeStatus, Recording, RecordingNotFoundError, RecordingsAccessor, RecordingsClient, type RecordingsClientOptions, RecordingsError, RecordingsUnauthorizedError, RequestAbortError, RequestCancelledError, RequestDocSyncError, RequestError, RequestOptions, RequestStreamOptions, RequestTimeoutError, RetainNotTempError, type RetentionIntent, RuntimeArtifact, RuntimeArtifactDownload, RuntimeArtifactNotFoundError, RuntimeArtifactsAccessor, RuntimeArtifactsClient, type RuntimeArtifactsClientOptions, RuntimeArtifactsError, RuntimeArtifactsUnauthorizedError, Session, SessionAllocationError, SessionFailedError, SessionFailureKind, Session$1 as SessionInterface, SessionPhase, SessionPhaseName, SessionStatus, SessionStream$1 as SessionStream, Store, StoreOptions, StreamChunkOptions, StreamDirectionConflict, type VideoStreamOptions, type WhenLiveOptions, createRecordingsClient, createRuntimeArtifactsClient, createStore, describeSessionFailure, describeSessionPhase, isDurationString, isWakingPhase, normalizeRetention, observePageLifecycle, prewake, sessionFailureFromMediaError, sharedCaptureController, videoStream, whenLive };
@@ -1,10 +1,39 @@
1
- import { b as AppOptions, a as App$1, J as SessionPhase, Q as SessionStatus, A as AccessTokenOptions, x as RuntimeArtifact, y as RuntimeArtifactDownload, R as Recording, F as Session$1, C as ChannelEndpoint, Z as TransportSession, c as AttachOptions, u as RecordingsAccessor, z as RuntimeArtifactsAccessor, T as SessionStream$1, Y as StreamDataTransport, H as SessionDocumentImpl, X as StreamChunkOptions, g as ChunkReadable, P as Presence, j as DocConnector, v as RequestOptions, w as RequestStreamOptions, W as StoreOptions, V as Store, e as ChannelMultiplexer, I as SessionFailureKind } from './stream-data-B16nTnox.js';
2
- export { L as Layer, k as LayoutConfig, l as LayoutContext, M as MediaChunkBinding, n as MediaChunkSource, o as MediaChunkSourceFactory, p as MediaRecorderChunkSourceOptions, q as PresenceState, r as RecordingBucket, s as RecordingLifecycle, t as RecordingStatus, B as RuntimeAvailability, S as SceneContext, E as SceneGraph, G as SessionDocument, K as SessionPhaseError, N as SessionPhaseName, U as SessionText, $ as TransportState, a3 as isPendingRecording, a4 as mediaRecorderChunkSource } from './stream-data-B16nTnox.js';
1
+ import { b as AppOptions, a as App$1, K as SessionPhase, T as SessionStatus, O as SessionPhaseName, A as AccessTokenOptions$1, y as RuntimeArtifact, z as RuntimeArtifactDownload, R as Recording, G as Session$1, C as ChannelEndpoint, _ as TransportSession, c as AttachOptions, v as RecordingsAccessor, B as RuntimeArtifactsAccessor, U as SessionStream$1, Z as StreamDataTransport, I as SessionDocumentImpl, Y as StreamChunkOptions, g as ChunkReadable, P as Presence, k as DocConnector, w as RequestOptions, x as RequestStreamOptions, X as StoreOptions, W as Store, e as ChannelMultiplexer, J as SessionFailureKind } from './stream-data-DWu57atL.js';
2
+ export { L as Layer, l as LayoutConfig, m as LayoutContext, M as MediaChunkBinding, o as MediaChunkSource, p as MediaChunkSourceFactory, q as MediaRecorderChunkSourceOptions, r as PresenceState, s as RecordingBucket, t as RecordingLifecycle, u as RecordingStatus, E as RuntimeAvailability, S as SceneContext, F as SceneGraph, H as SessionDocument, N as SessionPhaseError, V as SessionText, a0 as TransportState, a4 as isPendingRecording, a5 as mediaRecorderChunkSource } from './stream-data-DWu57atL.js';
3
3
  import 'yjs';
4
4
  import 'y-protocols/awareness';
5
5
 
6
6
  declare function App(appId: string, options: AppOptions): App$1;
7
7
 
8
+ interface AccessTokenOptions {
9
+ forceRefresh?: boolean;
10
+ reason?: 'initial' | 'unauthorized' | 'background';
11
+ }
12
+ interface PrewakeOptions {
13
+ baseUrl: string;
14
+
15
+ app: string;
16
+
17
+ functionName: string;
18
+ orgId: string;
19
+ jwt?: string;
20
+ getAccessToken?: (options?: AccessTokenOptions) => string | null | undefined | Promise<string | null | undefined>;
21
+ authProvider?: string;
22
+ }
23
+ type PrewakeStatus = 'warming' | 'prebound' | 'unknown-app' | 'unavailable';
24
+ interface PrewakeResult {
25
+
26
+ status: PrewakeStatus;
27
+
28
+ expiresAt?: string;
29
+
30
+ warmCapable?: boolean;
31
+ }
32
+
33
+ declare function prewake(options: PrewakeOptions): Promise<PrewakeResult>;
34
+
35
+ declare function isWakingPhase(phase: SessionPhase | SessionPhaseName | null | undefined): boolean;
36
+
8
37
  interface PhaseObservable {
9
38
 
10
39
  readonly phase: SessionPhase;
@@ -32,7 +61,7 @@ interface RuntimeArtifactsClientOptions {
32
61
  fallbackUrls?: readonly string[];
33
62
  orgId: string;
34
63
  jwt?: string;
35
- getAccessToken?: (options?: AccessTokenOptions) => string | null | undefined | Promise<string | null | undefined>;
64
+ getAccessToken?: (options?: AccessTokenOptions$1) => string | null | undefined | Promise<string | null | undefined>;
36
65
  authProvider?: string;
37
66
  }
38
67
  declare class RuntimeArtifactsError extends Error {
@@ -69,7 +98,7 @@ interface RecordingsClientOptions {
69
98
 
70
99
  jwt?: string;
71
100
 
72
- getAccessToken?: (options?: AccessTokenOptions) => string | null | undefined | Promise<string | null | undefined>;
101
+ getAccessToken?: (options?: AccessTokenOptions$1) => string | null | undefined | Promise<string | null | undefined>;
73
102
 
74
103
  authProvider?: string;
75
104
  }
@@ -227,6 +256,10 @@ declare class Session implements Session$1 {
227
256
  private _recordingsAccessor;
228
257
 
229
258
  private _artifactsAccessor;
259
+
260
+ private _recoveryHooks;
261
+
262
+ private _lifecycleUnsub;
230
263
  constructor(sessionId: string, multiplexer: ChannelEndpoint, transport: TransportSession, recordingsAuth?: RecordingsClientOptions, artifactsAuth?: RuntimeArtifactsClientOptions);
231
264
  private _wireControlDocIncarnation;
232
265
 
@@ -235,6 +268,8 @@ declare class Session implements Session$1 {
235
268
 
236
269
  get phase(): SessionPhase;
237
270
 
271
+ get endsAt(): Date | null;
272
+
238
273
  get status(): SessionStatus;
239
274
 
240
275
  onPhase(handler: (phase: SessionPhase) => void): () => void;
@@ -273,9 +308,17 @@ declare class Session implements Session$1 {
273
308
  requestStream(payload: unknown, options?: RequestStreamOptions): AsyncIterable<string>;
274
309
 
275
310
  complete(payload: unknown, options?: RequestStreamOptions): Promise<unknown>;
311
+
312
+ recover(): void;
313
+
314
+ onRecovery(hook: () => void): () => void;
276
315
  disconnect(): void;
277
316
  }
278
317
 
318
+ declare const FOREGROUND_COALESCE_MS = 250;
319
+
320
+ declare function observePageLifecycle(onForeground: () => void): () => void;
321
+
279
322
  declare function createStore(options: StoreOptions): Store & {
280
323
  _getInternals(): {
281
324
  multiplexer: ChannelMultiplexer;
@@ -359,4 +402,49 @@ declare class SessionAllocationError extends Error {
359
402
  });
360
403
  }
361
404
 
362
- export { App, App$1 as AppInterface, AppOptions, AttachOptions, ChunkReadable, DEFAULT_DOC_SYNC_TIMEOUT_MS, DEFAULT_WHEN_LIVE_TIMEOUT_MS, InvalidDurationError, PermanentLockedError, type PhaseObservable, PinRequiresActiveTempError, Presence, Recording, RecordingNotFoundError, RecordingsAccessor, RecordingsClient, type RecordingsClientOptions, RecordingsError, RecordingsUnauthorizedError, RequestAbortError, RequestCancelledError, RequestDocSyncError, RequestError, RequestOptions, RequestStreamOptions, RequestTimeoutError, RetainNotTempError, type RetentionIntent, RuntimeArtifact, RuntimeArtifactDownload, RuntimeArtifactNotFoundError, RuntimeArtifactsAccessor, RuntimeArtifactsClient, type RuntimeArtifactsClientOptions, RuntimeArtifactsError, RuntimeArtifactsUnauthorizedError, Session, SessionAllocationError, SessionFailedError, SessionFailureKind, Session$1 as SessionInterface, SessionPhase, SessionStatus, SessionStream$1 as SessionStream, Store, StoreOptions, StreamChunkOptions, StreamDirectionConflict, type VideoStreamOptions, type WhenLiveOptions, createRecordingsClient, createRuntimeArtifactsClient, createStore, describeSessionFailure, describeSessionPhase, isDurationString, normalizeRetention, sessionFailureFromMediaError, videoStream, whenLive };
405
+ type CaptureKind = 'audio' | 'video';
406
+ type GetUserMedia = (constraints: MediaStreamConstraints) => Promise<MediaStream>;
407
+
408
+ declare class CaptureUnavailableError extends Error {
409
+ constructor();
410
+ }
411
+
412
+ interface CaptureClaim {
413
+ readonly kind: CaptureKind;
414
+
415
+ readonly track: MediaStreamTrack | null;
416
+
417
+ readonly stream: MediaStream | null;
418
+
419
+ update(constraints: MediaTrackConstraints): Promise<MediaStreamTrack>;
420
+
421
+ release(): void;
422
+
423
+ onTrack(listener: (track: MediaStreamTrack, stream: MediaStream) => void): () => void;
424
+
425
+ onLost(listener: (error: Error) => void): () => void;
426
+ }
427
+ interface CaptureControllerOptions {
428
+
429
+ getUserMedia?: GetUserMedia;
430
+ }
431
+
432
+ declare class CaptureController {
433
+ private readonly claims;
434
+ private readonly injectedGetUserMedia?;
435
+ private queue;
436
+ constructor(options?: CaptureControllerOptions);
437
+
438
+ claim(kind: CaptureKind, constraints: MediaTrackConstraints): Promise<CaptureClaim>;
439
+
440
+ idle(): Promise<void>;
441
+ private enqueue;
442
+ private resolveGetUserMedia;
443
+
444
+ private converge;
445
+ private createState;
446
+ }
447
+
448
+ declare function sharedCaptureController(): CaptureController;
449
+
450
+ export { App, App$1 as AppInterface, AppOptions, AttachOptions, type CaptureClaim, CaptureController, type CaptureControllerOptions, type CaptureKind, CaptureUnavailableError, ChunkReadable, DEFAULT_DOC_SYNC_TIMEOUT_MS, DEFAULT_WHEN_LIVE_TIMEOUT_MS, FOREGROUND_COALESCE_MS, InvalidDurationError, PermanentLockedError, type PhaseObservable, PinRequiresActiveTempError, Presence, type PrewakeOptions, type PrewakeResult, type PrewakeStatus, Recording, RecordingNotFoundError, RecordingsAccessor, RecordingsClient, type RecordingsClientOptions, RecordingsError, RecordingsUnauthorizedError, RequestAbortError, RequestCancelledError, RequestDocSyncError, RequestError, RequestOptions, RequestStreamOptions, RequestTimeoutError, RetainNotTempError, type RetentionIntent, RuntimeArtifact, RuntimeArtifactDownload, RuntimeArtifactNotFoundError, RuntimeArtifactsAccessor, RuntimeArtifactsClient, type RuntimeArtifactsClientOptions, RuntimeArtifactsError, RuntimeArtifactsUnauthorizedError, Session, SessionAllocationError, SessionFailedError, SessionFailureKind, Session$1 as SessionInterface, SessionPhase, SessionPhaseName, SessionStatus, SessionStream$1 as SessionStream, Store, StoreOptions, StreamChunkOptions, StreamDirectionConflict, type VideoStreamOptions, type WhenLiveOptions, createRecordingsClient, createRuntimeArtifactsClient, createStore, describeSessionFailure, describeSessionPhase, isDurationString, isWakingPhase, normalizeRetention, observePageLifecycle, prewake, sessionFailureFromMediaError, sharedCaptureController, videoStream, whenLive };