@urun-sh/core 0.6.34 → 0.6.35

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.
@@ -50,6 +50,186 @@ interface WatchGenerationTickOptions {
50
50
 
51
51
  declare function watchGenerationTick(control: Pick<SessionDocument, 'get' | 'on'>, handler: (tick: GenerationTick) => void, options?: WatchGenerationTickOptions): () => void;
52
52
 
53
+ type SessionGatewayStatus = "allocated" | "pending" | "queued" | "rejected" | "failed" | "canceled"
54
+
55
+ | "paused"
56
+
57
+ | "redirect"
58
+
59
+ | "waiting_for_capacity"
60
+
61
+ | (string & {});
62
+ interface SessionGatewayResponse {
63
+ status?: SessionGatewayStatus;
64
+
65
+ location?: string;
66
+
67
+ session_api_base?: string;
68
+
69
+ serving_region?: string | null;
70
+ request_id?: string;
71
+ session_id?: string;
72
+ ws_url?: string;
73
+
74
+ ice_servers?: RTCIceServer[];
75
+ queued?: boolean;
76
+ retry_after_seconds?: number;
77
+
78
+ effective_max_queue_time_s?: number;
79
+ queue_position?: number;
80
+ queue_depth?: number;
81
+
82
+ runtime_state?: string;
83
+
84
+ runtime_reason?: string;
85
+
86
+ reason?: string;
87
+
88
+ decision_reason?: string;
89
+
90
+ provisioning_refusal_source?: string;
91
+
92
+ provisioning_refusal_message?: string;
93
+
94
+ runtime_wake?: unknown;
95
+
96
+ ends_at?: string;
97
+ error_code?: string;
98
+ error_message?: string;
99
+
100
+ message?: string;
101
+ error?: string;
102
+
103
+ balance_credits?: number;
104
+ }
105
+
106
+ interface AdmissionUpdate {
107
+
108
+ status: string;
109
+
110
+ requestId?: string;
111
+
112
+ sessionId?: string;
113
+
114
+ queue?: {
115
+ position: number;
116
+ depth: number;
117
+ };
118
+
119
+ runtime?: RuntimeAvailability;
120
+
121
+ reason?: string;
122
+
123
+ decisionReason?: string;
124
+
125
+ refusalSource?: string;
126
+
127
+ refusalMessage?: string;
128
+
129
+ region?: string | null;
130
+ }
131
+ interface AllocateSessionOptions {
132
+ baseUrl: string;
133
+ fallbackUrls?: readonly string[];
134
+ app: string;
135
+ functionName: string;
136
+ orgId: string;
137
+ jwt?: string;
138
+ getAccessToken?: (options?: AccessTokenOptions$1) => string | null | undefined | Promise<string | null | undefined>;
139
+ authProvider?: string;
140
+ idempotencyKey: string;
141
+
142
+ onAdmission?: (update: AdmissionUpdate) => void;
143
+
144
+
145
+ onRequest?: (handle: {
146
+ requestId: string;
147
+ baseUrl: string;
148
+ sessionId?: string;
149
+ }) => void;
150
+
151
+ sessionKey?: string;
152
+
153
+ concurrencyKey?: string;
154
+
155
+ label?: string;
156
+
157
+ priority?: "preempt";
158
+
159
+ sharedApp?: boolean;
160
+ }
161
+ interface AccessTokenOptions$1 {
162
+ forceRefresh?: boolean;
163
+ reason?: "initial" | "unauthorized" | "background";
164
+ }
165
+
166
+ interface SfuAttachCredential {
167
+
168
+ url: string;
169
+
170
+ token: string;
171
+
172
+ gen: number;
173
+ }
174
+ interface AllocatedSession {
175
+ baseUrl: string;
176
+ sessionId: string;
177
+ wsUrl: string;
178
+
179
+ endsAt: Date | null;
180
+
181
+ sfuAttach?: SfuAttachCredential;
182
+ response: SessionGatewayResponse;
183
+ }
184
+ interface ReleaseSessionBeaconOptions {
185
+ baseUrl: string;
186
+ requestId: string;
187
+
188
+ sessionId?: string;
189
+ orgId: string;
190
+
191
+ jwt?: string;
192
+ authProvider?: string;
193
+
194
+ reason?: string;
195
+ }
196
+
197
+ declare function releaseSessionBeacon(options: ReleaseSessionBeaconOptions): void;
198
+ declare function allocateSession(options: AllocateSessionOptions): Promise<AllocatedSession>;
199
+
200
+ interface SessionDirectoryRequestOptions {
201
+ baseUrl: string;
202
+ fallbackUrls?: readonly string[];
203
+ orgId: string;
204
+ jwt?: string;
205
+ getAccessToken?: AllocateSessionOptions["getAccessToken"];
206
+ authProvider?: string;
207
+ }
208
+
209
+ type SessionNameSource = "user" | "auto";
210
+ interface PrewakeOptions {
211
+ baseUrl: string;
212
+
213
+ app: string;
214
+
215
+ functionName: string;
216
+ orgId: string;
217
+ jwt?: string;
218
+ getAccessToken?: (options?: AccessTokenOptions$1) => string | null | undefined | Promise<string | null | undefined>;
219
+ authProvider?: string;
220
+ }
221
+ type PrewakeStatus = "warming" | "prebound" | "unknown-app" | "unavailable";
222
+ interface PrewakeResult {
223
+
224
+ status: PrewakeStatus;
225
+
226
+ expiresAt?: string;
227
+
228
+ warmCapable?: boolean;
229
+ }
230
+
231
+ declare function prewake(options: PrewakeOptions): Promise<PrewakeResult>;
232
+
53
233
  declare const DOC_SYNC_WIRE_CONTRACT_VERSION = 1;
54
234
  interface DocConnectionState {
55
235
 
@@ -97,6 +277,8 @@ interface WebsocketDocConnectorOptions {
97
277
 
98
278
  token?: string | DocTokenSupplier;
99
279
 
280
+ attach?: SfuAttachCredential;
281
+
100
282
  WebSocketPolyfill?: typeof WebSocket;
101
283
 
102
284
  maxBackoffTimeMs?: number;
@@ -291,6 +473,8 @@ interface TransportSessionOptions {
291
473
 
292
474
  iceServers?: RTCIceServer[];
293
475
 
476
+ sfuAttach?: SfuAttachCredential;
477
+
294
478
  mediaLiveness?: MediaLivenessOptions;
295
479
 
296
480
  audioPlayout?: AudioPlayoutOptions;
@@ -648,7 +832,7 @@ interface AppOptions {
648
832
 
649
833
  jwt?: string;
650
834
 
651
- getAccessToken?: (options?: AccessTokenOptions$1) => string | null | undefined | Promise<string | null | undefined>;
835
+ getAccessToken?: (options?: AccessTokenOptions) => string | null | undefined | Promise<string | null | undefined>;
652
836
 
653
837
  authProvider?: string;
654
838
 
@@ -672,7 +856,7 @@ interface AppOptions {
672
856
 
673
857
  sessionStats?: SessionStatsOptions;
674
858
  }
675
- interface AccessTokenOptions$1 {
859
+ interface AccessTokenOptions {
676
860
  forceRefresh?: boolean;
677
861
  reason?: 'initial' | 'unauthorized' | 'background';
678
862
  }
@@ -687,7 +871,7 @@ interface AttachOptions {
687
871
 
688
872
  jwt?: string;
689
873
 
690
- getAccessToken?: (options?: AccessTokenOptions$1) => string | null | undefined | Promise<string | null | undefined>;
874
+ getAccessToken?: (options?: AccessTokenOptions) => string | null | undefined | Promise<string | null | undefined>;
691
875
 
692
876
  authProvider?: string;
693
877
 
@@ -715,175 +899,6 @@ interface App {
715
899
  [fnName: string]: (args?: Record<string, unknown>, options?: StartSessionOptions) => Session;
716
900
  }
717
901
 
718
- type SessionGatewayStatus = "allocated" | "pending" | "queued" | "rejected" | "failed" | "canceled"
719
-
720
- | "paused"
721
-
722
- | "redirect"
723
-
724
- | "waiting_for_capacity"
725
-
726
- | (string & {});
727
- interface SessionGatewayResponse {
728
- status?: SessionGatewayStatus;
729
-
730
- location?: string;
731
-
732
- session_api_base?: string;
733
-
734
- serving_region?: string | null;
735
- request_id?: string;
736
- session_id?: string;
737
- ws_url?: string;
738
-
739
- ice_servers?: RTCIceServer[];
740
- queued?: boolean;
741
- retry_after_seconds?: number;
742
-
743
- effective_max_queue_time_s?: number;
744
- queue_position?: number;
745
- queue_depth?: number;
746
-
747
- runtime_state?: string;
748
-
749
- runtime_reason?: string;
750
-
751
- reason?: string;
752
-
753
- decision_reason?: string;
754
-
755
- provisioning_refusal_source?: string;
756
-
757
- provisioning_refusal_message?: string;
758
-
759
- runtime_wake?: unknown;
760
-
761
- ends_at?: string;
762
- error_code?: string;
763
- error_message?: string;
764
-
765
- message?: string;
766
- error?: string;
767
-
768
- balance_credits?: number;
769
- }
770
-
771
- interface AdmissionUpdate {
772
-
773
- status: string;
774
-
775
- requestId?: string;
776
-
777
- sessionId?: string;
778
-
779
- queue?: {
780
- position: number;
781
- depth: number;
782
- };
783
-
784
- runtime?: RuntimeAvailability;
785
-
786
- reason?: string;
787
-
788
- decisionReason?: string;
789
-
790
- refusalSource?: string;
791
-
792
- refusalMessage?: string;
793
-
794
- region?: string | null;
795
- }
796
- interface AllocateSessionOptions {
797
- baseUrl: string;
798
- fallbackUrls?: readonly string[];
799
- app: string;
800
- functionName: string;
801
- orgId: string;
802
- jwt?: string;
803
- getAccessToken?: (options?: AccessTokenOptions) => string | null | undefined | Promise<string | null | undefined>;
804
- authProvider?: string;
805
- idempotencyKey: string;
806
-
807
- onAdmission?: (update: AdmissionUpdate) => void;
808
-
809
-
810
- onRequest?: (handle: {
811
- requestId: string;
812
- baseUrl: string;
813
- sessionId?: string;
814
- }) => void;
815
-
816
- sessionKey?: string;
817
-
818
- concurrencyKey?: string;
819
-
820
- label?: string;
821
-
822
- priority?: "preempt";
823
-
824
- sharedApp?: boolean;
825
- }
826
- interface AccessTokenOptions {
827
- forceRefresh?: boolean;
828
- reason?: "initial" | "unauthorized" | "background";
829
- }
830
- interface AllocatedSession {
831
- baseUrl: string;
832
- sessionId: string;
833
- wsUrl: string;
834
-
835
- endsAt: Date | null;
836
- response: SessionGatewayResponse;
837
- }
838
- interface ReleaseSessionBeaconOptions {
839
- baseUrl: string;
840
- requestId: string;
841
-
842
- sessionId?: string;
843
- orgId: string;
844
-
845
- jwt?: string;
846
- authProvider?: string;
847
-
848
- reason?: string;
849
- }
850
-
851
- declare function releaseSessionBeacon(options: ReleaseSessionBeaconOptions): void;
852
- declare function allocateSession(options: AllocateSessionOptions): Promise<AllocatedSession>;
853
-
854
- interface SessionDirectoryRequestOptions {
855
- baseUrl: string;
856
- fallbackUrls?: readonly string[];
857
- orgId: string;
858
- jwt?: string;
859
- getAccessToken?: AllocateSessionOptions["getAccessToken"];
860
- authProvider?: string;
861
- }
862
-
863
- type SessionNameSource = "user" | "auto";
864
- interface PrewakeOptions {
865
- baseUrl: string;
866
-
867
- app: string;
868
-
869
- functionName: string;
870
- orgId: string;
871
- jwt?: string;
872
- getAccessToken?: (options?: AccessTokenOptions) => string | null | undefined | Promise<string | null | undefined>;
873
- authProvider?: string;
874
- }
875
- type PrewakeStatus = "warming" | "prebound" | "unknown-app" | "unavailable";
876
- interface PrewakeResult {
877
-
878
- status: PrewakeStatus;
879
-
880
- expiresAt?: string;
881
-
882
- warmCapable?: boolean;
883
- }
884
-
885
- declare function prewake(options: PrewakeOptions): Promise<PrewakeResult>;
886
-
887
902
  interface ChannelEndpoint {
888
903
  on(channel: string, handler: (data: ChannelMessage) => void): () => void;
889
904
  emit(channel: string, data: Record<string, unknown>): void;
@@ -1375,6 +1390,8 @@ interface TransportConnection {
1375
1390
 
1376
1391
  iceServers?: RTCIceServer[];
1377
1392
 
1393
+ sfuAttach?: SfuAttachCredential;
1394
+
1378
1395
  endsAt?: Date | null;
1379
1396
  }
1380
1397
  declare function streamDataLabel(name: string): string;
@@ -1558,7 +1575,7 @@ declare class TransportSession {
1558
1575
  private _streamNameOf;
1559
1576
  setAuth(options: Pick<TransportSessionOptions, 'orgId' | 'jwt' | 'authProvider'>): void;
1560
1577
  constructor(options?: TransportSessionOptions);
1561
- setConnection(options: Pick<TransportSessionOptions, 'url' | 'fallbackUrls' | 'sessionId' | 'iceServers'>): void;
1578
+ setConnection(options: Pick<TransportSessionOptions, 'url' | 'fallbackUrls' | 'sessionId' | 'iceServers' | 'sfuAttach'>): void;
1562
1579
  setConnectionResolver(resolveConnection: (() => Promise<TransportConnection>) | null): void;
1563
1580
 
1564
1581
  applyControlDocState(state: Record<string, unknown> | null | undefined): void;
@@ -1848,4 +1865,4 @@ declare function computeBackoffDelay(attempt: number, random?: () => number): nu
1848
1865
 
1849
1866
  declare function isRetryableSessionError(error: unknown): boolean;
1850
1867
 
1851
- export { type RecordingLifecycle as $, type AccessTokenOptions as A, BACKOFF_BASE_MS as B, type ChannelEndpoint as C, DERIVED_LEG_SEP as D, type DocTokenSupplier as E, GENERATION_TICK_MAX_EXTRAPOLATION_MS as F, GENERATION_TICK_EMIT_INTERVAL_MS as G, type GenerationTick as H, type InboundStatsSample as I, type MediaChunkSource as J, type MediaChunkSourceFactory as K, LoopbackStreamData as L, type MediaChunkBinding as M, type MediaRecorderChunkSourceOptions as N, type MediaSession as O, type NegotiatorDataLaneSeam as P, type NegotiatorOptions as Q, type PathHealthReporting as R, type PathLiveness as S, type Presence as T, type PresenceState as U, type PrewakeOptions as V, type PrewakeResult as W, type PrewakeStatus as X, type QuicStreamDataTransport as Y, type Recording as Z, type RecordingBucket as _, type AccessTokenOptions$1 as a, createWebsocketDocConnector as a$, type RecordingStatus as a0, type RecordingsAccessor as a1, type ReleaseSessionBeaconOptions as a2, type RequestOptions as a3, type RequestStreamOptions as a4, type RuntimeArtifact as a5, type RuntimeArtifactDownload as a6, type RuntimeArtifactsAccessor as a7, type RuntimeAvailability as a8, type RuntimeWakeDetail as a9, type StreamChunkOptions as aA, type StreamDataTransport as aB, type TransportEstablishedNotify as aC, TransportNegotiator as aD, type TransportOfferRequest as aE, type TransportOfferResponse as aF, TransportSession as aG, type TransportSessionOptions as aH, TransportSessionSignaling as aI, type TransportState as aJ, type VideoPlayoutOptions as aK, WT_CONTROL_FRAME_MAX as aL, WT_DATA_STREAM_VERSION as aM, type WatchGenerationTickOptions as aN, type WtAudioLaneSeam as aO, type WtAudioUplinkSeam as aP, WtControlDecoder as aQ, type WtControlMessage as aR, type WtDataEnvelope as aS, type WtDataLaneSink as aT, WtDataStreamParser as aU, WtDataUplinkSender as aV, type WtVideoUplinkSeam as aW, allocateSession as aX, computeBackoffDelay as aY, consumeWtDataStreams as aZ, createPresence as a_, type RuntimeWakeGolden as aa, type RuntimeWakeReasonCode as ab, SIGNALING_PROTOCOL_VERSION as ac, STREAM_END as ad, type Session as ae, type SessionDiagnostic as af, type SessionDirectoryRequestOptions as ag, type SessionDocument as ah, SessionDocumentImpl as ai, type SessionEndResult as aj, type SessionFailureKind as ak, type SessionNameSource as al, type SessionPhase as am, type SessionPhaseError as an, type SessionPhaseName as ao, type SessionStartOptions as ap, type SessionStatsOptions as aq, type SessionStatsSample as ar, type SessionStatus as as, type SessionStream as at, type SessionText as au, type SignalCarrier as av, type Signaling as aw, type StartSessionOptions as ax, type Store as ay, type StoreOptions as az, type ActivationEvent as b, decodeStreamEnvelope as b0, deriveYjsServerUrl as b1, derivedLegName as b2, derivedLegRole as b3, encodeStreamEnvelope as b4, encodeWtControlFrame as b5, isPendingRecording as b6, isRetryableSessionError as b7, mediaRecorderChunkSource as b8, parseDgramHeader as b9, prewake as ba, releaseSessionBeacon as bb, streamDataLabel as bc, transportStreamData as bd, watchGenerationTick as be, writeDgramHeader as bf, type ActivationState as c, type ActivitySignalMode as d, type AllocateSessionOptions as e, type AllocatedSession as f, type App as g, type AppOptions as h, type AttachOptions as i, type AudioPlayoutOptions as j, BACKOFF_MAX_ATTEMPTS as k, BACKOFF_MAX_MS as l, type ChannelMessage as m, ChannelMultiplexer as n, type ChannelName as o, type ChunkReadable as p, DGRAM_HEADER_BYTES as q, DOC_SYNC_WIRE_CONTRACT_VERSION as r, DeferredChannelMultiplexer as s, DeferredDocConnector as t, type DerivedLegRole as u, type DgramHeader as v, type DocConnection as w, type DocConnectionState as x, type DocConnector as y, type DocServerUrlResolver as z };
1868
+ export { type RecordingLifecycle as $, type AccessTokenOptions as A, BACKOFF_BASE_MS as B, type ChannelEndpoint as C, DERIVED_LEG_SEP as D, type DocTokenSupplier as E, GENERATION_TICK_MAX_EXTRAPOLATION_MS as F, GENERATION_TICK_EMIT_INTERVAL_MS as G, type GenerationTick as H, type InboundStatsSample as I, type MediaChunkSource as J, type MediaChunkSourceFactory as K, LoopbackStreamData as L, type MediaChunkBinding as M, type MediaRecorderChunkSourceOptions as N, type MediaSession as O, type NegotiatorDataLaneSeam as P, type NegotiatorOptions as Q, type PathHealthReporting as R, type PathLiveness as S, type Presence as T, type PresenceState as U, type PrewakeOptions as V, type PrewakeResult as W, type PrewakeStatus as X, type QuicStreamDataTransport as Y, type Recording as Z, type RecordingBucket as _, type AccessTokenOptions$1 as a, createPresence as a$, type RecordingStatus as a0, type RecordingsAccessor as a1, type ReleaseSessionBeaconOptions as a2, type RequestOptions as a3, type RequestStreamOptions as a4, type RuntimeArtifact as a5, type RuntimeArtifactDownload as a6, type RuntimeArtifactsAccessor as a7, type RuntimeAvailability as a8, type RuntimeWakeDetail as a9, type StoreOptions as aA, type StreamChunkOptions as aB, type StreamDataTransport as aC, type TransportEstablishedNotify as aD, TransportNegotiator as aE, type TransportOfferRequest as aF, type TransportOfferResponse as aG, TransportSession as aH, type TransportSessionOptions as aI, TransportSessionSignaling as aJ, type TransportState as aK, type VideoPlayoutOptions as aL, WT_CONTROL_FRAME_MAX as aM, WT_DATA_STREAM_VERSION as aN, type WatchGenerationTickOptions as aO, type WtAudioLaneSeam as aP, type WtAudioUplinkSeam as aQ, WtControlDecoder as aR, type WtControlMessage as aS, type WtDataEnvelope as aT, type WtDataLaneSink as aU, WtDataStreamParser as aV, WtDataUplinkSender as aW, type WtVideoUplinkSeam as aX, allocateSession as aY, computeBackoffDelay as aZ, consumeWtDataStreams as a_, type RuntimeWakeGolden as aa, type RuntimeWakeReasonCode as ab, SIGNALING_PROTOCOL_VERSION as ac, STREAM_END as ad, type Session as ae, type SessionDiagnostic as af, type SessionDirectoryRequestOptions as ag, type SessionDocument as ah, SessionDocumentImpl as ai, type SessionEndResult as aj, type SessionFailureKind as ak, type SessionNameSource as al, type SessionPhase as am, type SessionPhaseError as an, type SessionPhaseName as ao, type SessionStartOptions as ap, type SessionStatsOptions as aq, type SessionStatsSample as ar, type SessionStatus as as, type SessionStream as at, type SessionText as au, type SfuAttachCredential as av, type SignalCarrier as aw, type Signaling as ax, type StartSessionOptions as ay, type Store as az, type ActivationEvent as b, createWebsocketDocConnector as b0, decodeStreamEnvelope as b1, deriveYjsServerUrl as b2, derivedLegName as b3, derivedLegRole as b4, encodeStreamEnvelope as b5, encodeWtControlFrame as b6, isPendingRecording as b7, isRetryableSessionError as b8, mediaRecorderChunkSource as b9, parseDgramHeader as ba, prewake as bb, releaseSessionBeacon as bc, streamDataLabel as bd, transportStreamData as be, watchGenerationTick as bf, writeDgramHeader as bg, type ActivationState as c, type ActivitySignalMode as d, type AllocateSessionOptions as e, type AllocatedSession as f, type App as g, type AppOptions as h, type AttachOptions as i, type AudioPlayoutOptions as j, BACKOFF_MAX_ATTEMPTS as k, BACKOFF_MAX_MS as l, type ChannelMessage as m, ChannelMultiplexer as n, type ChannelName as o, type ChunkReadable as p, DGRAM_HEADER_BYTES as q, DOC_SYNC_WIRE_CONTRACT_VERSION as r, DeferredChannelMultiplexer as s, DeferredDocConnector as t, type DerivedLegRole as u, type DgramHeader as v, type DocConnection as w, type DocConnectionState as x, type DocConnector as y, type DocServerUrlResolver as z };