effect-cloudflare-webrtc 0.0.0-stage → 0.0.0
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/README.md +439 -2
- package/dist/AudioSink-BybkMP2y.d.ts +54 -0
- package/dist/Readable-CJPSx6Uq.js +65 -0
- package/dist/Readable-CJPSx6Uq.js.map +1 -0
- package/dist/Realtime-B5OIHlLR.d.ts +129 -0
- package/dist/Realtime-B6TjV8su.js +195 -0
- package/dist/Realtime-B6TjV8su.js.map +1 -0
- package/dist/RealtimeClient-Bl0Tun5r.js +2488 -0
- package/dist/RealtimeClient-Bl0Tun5r.js.map +1 -0
- package/dist/RealtimeClient-ESFO5vfF.d.ts +412 -0
- package/dist/RealtimeClient-K7oKgsB9.d.ts +1000 -0
- package/dist/chunk-pbuEa-1d.js +13 -0
- package/dist/client/index.d.ts +275 -0
- package/dist/client/index.js +493 -0
- package/dist/client/index.js.map +1 -0
- package/dist/effect/client/index.d.ts +434 -0
- package/dist/effect/client/index.js +2 -0
- package/dist/effect/server/index.d.ts +2 -0
- package/dist/effect/server/index.js +2 -0
- package/dist/react/index.d.ts +44 -0
- package/dist/react/index.js +107 -0
- package/dist/react/index.js.map +1 -0
- package/dist/server/index.d.ts +23 -0
- package/dist/server/index.js +12 -0
- package/dist/server/index.js.map +1 -0
- package/package.json +92 -4
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
import {
|
|
2
|
+
$ as TransformFailed,
|
|
3
|
+
A as MediaDevicesBackend,
|
|
4
|
+
B as MediaAccessError,
|
|
5
|
+
C as RemoteReceptionStats,
|
|
6
|
+
D as TransportStats,
|
|
7
|
+
E as StatsOptions,
|
|
8
|
+
F as ApiError,
|
|
9
|
+
G as PushError,
|
|
10
|
+
H as PeerConnectionFailed,
|
|
11
|
+
I as ApiInvalidResponse,
|
|
12
|
+
J as SessionFailed,
|
|
13
|
+
K as SenderError,
|
|
14
|
+
L as ApiResponseError,
|
|
15
|
+
M as SafePermissionState,
|
|
16
|
+
N as devices,
|
|
17
|
+
O as TrackMetadata,
|
|
18
|
+
P as ApiAuthRedirect,
|
|
19
|
+
Q as TransceiverNotFound,
|
|
20
|
+
R as ApiTransportError,
|
|
21
|
+
S as ReceivedTrackStats,
|
|
22
|
+
T as SentTrackStats,
|
|
23
|
+
U as PeerConnectionFailedReason,
|
|
24
|
+
V as NegotiationOutcomeUnknown,
|
|
25
|
+
W as PullError,
|
|
26
|
+
X as SourceError,
|
|
27
|
+
Y as SinkError,
|
|
28
|
+
Z as TrackError,
|
|
29
|
+
_ as RetrySchedule,
|
|
30
|
+
a as PushState,
|
|
31
|
+
at as DeviceReference,
|
|
32
|
+
b as ConnectionStats,
|
|
33
|
+
c as SessionState,
|
|
34
|
+
d as TransceiverEvent,
|
|
35
|
+
et as DevicePreferences,
|
|
36
|
+
f as ApiHistoryEntry,
|
|
37
|
+
g as RealtimeConfig,
|
|
38
|
+
h as sessionTokenHeader,
|
|
39
|
+
i as PushOptions,
|
|
40
|
+
it as DeviceFailure,
|
|
41
|
+
j as PermissionKind,
|
|
42
|
+
k as MediaDevices,
|
|
43
|
+
l as pullStream,
|
|
44
|
+
m as SessionAuth,
|
|
45
|
+
n as PullState,
|
|
46
|
+
nt as PreferenceStorage,
|
|
47
|
+
o as PushedTrack,
|
|
48
|
+
p as RealtimeApi,
|
|
49
|
+
q as SessionError,
|
|
50
|
+
r as PulledTrack,
|
|
51
|
+
rt as Subscribable,
|
|
52
|
+
s as RealtimeClient,
|
|
53
|
+
t as PullOptions,
|
|
54
|
+
tt as DeviceRanking,
|
|
55
|
+
u as pushStream,
|
|
56
|
+
v as defaultRetrySchedule,
|
|
57
|
+
w as SentStreamStats,
|
|
58
|
+
x as QualityLimitationReason,
|
|
59
|
+
y as PeerConnections,
|
|
60
|
+
z as DevicesExhausted
|
|
61
|
+
} from "../../RealtimeClient-K7oKgsB9.js";
|
|
62
|
+
import {
|
|
63
|
+
n as AudioSinkElement,
|
|
64
|
+
r as AudioSinkOptions,
|
|
65
|
+
t as AudioSink
|
|
66
|
+
} from "../../AudioSink-BybkMP2y.js";
|
|
67
|
+
import * as Effect from "effect/Effect";
|
|
68
|
+
import * as Scope from "effect/Scope";
|
|
69
|
+
import * as Stream from "effect/Stream";
|
|
70
|
+
//#region src/effect/client/ResilientTrack.d.ts
|
|
71
|
+
interface ResilientTrackOptions {
|
|
72
|
+
readonly kind: "audioinput" | "videoinput";
|
|
73
|
+
/**
|
|
74
|
+
* The devices in the sequence in which they are tried. Default: the
|
|
75
|
+
* device list of the browser.
|
|
76
|
+
*/
|
|
77
|
+
readonly devicePriority?: Stream.Stream<ReadonlyArray<MediaDeviceInfo>>;
|
|
78
|
+
/**
|
|
79
|
+
* `deviceId` and `groupId` are not permitted, because each device is
|
|
80
|
+
* tried until one gives a healthy track.
|
|
81
|
+
*/
|
|
82
|
+
readonly constraints?: Omit<MediaTrackConstraints, "deviceId" | "groupId">;
|
|
83
|
+
readonly priorityReason?: (device: MediaDeviceInfo) => Effect.Effect<string>;
|
|
84
|
+
readonly onStableDevice?: (device: MediaDeviceInfo) => Effect.Effect<void>;
|
|
85
|
+
/** Called for each device that gives a track that is not healthy. */
|
|
86
|
+
readonly onDeviceFailure?: (device: MediaDeviceInfo) => Effect.Effect<void>;
|
|
87
|
+
/**
|
|
88
|
+
* Called with the device that the browser selected, when the
|
|
89
|
+
* request had no device. This occurs before the permission is given.
|
|
90
|
+
*/
|
|
91
|
+
readonly onUnconstrainedDeviceSelection?: (
|
|
92
|
+
device: MediaDeviceInfo
|
|
93
|
+
) => Effect.Effect<void>;
|
|
94
|
+
}
|
|
95
|
+
/** A track is healthy when it is live and not muted. */
|
|
96
|
+
declare const trackIsHealthy: (track: MediaStreamTrack) => boolean;
|
|
97
|
+
/**
|
|
98
|
+
* A track from the first device of the list that gives a healthy track.
|
|
99
|
+
*
|
|
100
|
+
* - A device that is not found, is in use, or gives a track that is not
|
|
101
|
+
* healthy is skipped.
|
|
102
|
+
* - When the track ends, the next device is tried.
|
|
103
|
+
* - When the track becomes muted, or is not healthy when the page becomes
|
|
104
|
+
* visible, the same device is acquired again. After three reacquisitions
|
|
105
|
+
* in a row, the device is treated as failed.
|
|
106
|
+
* - When the list changes and its first device is not the active device,
|
|
107
|
+
* the devices are tried again from the top.
|
|
108
|
+
*
|
|
109
|
+
* The stream fails with `DevicesExhausted` when no device is left, and with
|
|
110
|
+
* `MediaAccessError` for all other browser errors, for example
|
|
111
|
+
* `NotAllowedError`.
|
|
112
|
+
*
|
|
113
|
+
* The stream is not shared. Each run acquires a device.
|
|
114
|
+
*/
|
|
115
|
+
declare const resilientTrack: (
|
|
116
|
+
options: ResilientTrackOptions
|
|
117
|
+
) => Stream.Stream<MediaStreamTrack, SourceError, MediaDevices>;
|
|
118
|
+
//#endregion
|
|
119
|
+
//#region src/effect/client/FallbackTracks.d.ts
|
|
120
|
+
/**
|
|
121
|
+
* An audio track that cannot be heard. It sends a small quantity of data,
|
|
122
|
+
* which lets a push complete while the microphone is muted.
|
|
123
|
+
*/
|
|
124
|
+
declare const inaudibleAudioTrack: Stream.Stream<MediaStreamTrack>;
|
|
125
|
+
/**
|
|
126
|
+
* A black video track of 1280x720. The canvas is drawn again each second,
|
|
127
|
+
* because a frame is sent only when the canvas changes.
|
|
128
|
+
*/
|
|
129
|
+
declare const blackVideoTrack: Stream.Stream<MediaStreamTrack>;
|
|
130
|
+
//#endregion
|
|
131
|
+
//#region src/effect/client/TrackSource.d.ts
|
|
132
|
+
/**
|
|
133
|
+
* Makes a new track from the content track, for example a background blur.
|
|
134
|
+
* The finalizers of its scope run when the track is replaced or released.
|
|
135
|
+
*/
|
|
136
|
+
type TrackTransform = (
|
|
137
|
+
track: MediaStreamTrack
|
|
138
|
+
) => Effect.Effect<MediaStreamTrack, unknown, Scope.Scope>;
|
|
139
|
+
interface TrackSource<E = never> {
|
|
140
|
+
/**
|
|
141
|
+
* The track to push. It is the content track while the source is enabled
|
|
142
|
+
* and the broadcast is started. In all other conditions it is the fallback
|
|
143
|
+
* track. It does not fail. All consumers share one content source.
|
|
144
|
+
*/
|
|
145
|
+
readonly broadcastTrack: Stream.Stream<MediaStreamTrack>;
|
|
146
|
+
/**
|
|
147
|
+
* The content track while the source is enabled, also when the broadcast
|
|
148
|
+
* is stopped. The fallback track while the source is disabled.
|
|
149
|
+
*/
|
|
150
|
+
readonly localMonitorTrack: Stream.Stream<MediaStreamTrack>;
|
|
151
|
+
/** When false, the content source is not acquired. */
|
|
152
|
+
readonly isEnabled: Subscribable<boolean>;
|
|
153
|
+
/** True while the content track is in the broadcast track. */
|
|
154
|
+
readonly isBroadcasting: Subscribable<boolean>;
|
|
155
|
+
readonly enable: Effect.Effect<void>;
|
|
156
|
+
/** Also stops the broadcast. */
|
|
157
|
+
readonly disable: Effect.Effect<void>;
|
|
158
|
+
readonly toggleEnabled: Effect.Effect<void>;
|
|
159
|
+
/** Also enables the source. */
|
|
160
|
+
readonly startBroadcasting: Effect.Effect<void>;
|
|
161
|
+
readonly stopBroadcasting: Effect.Effect<void>;
|
|
162
|
+
readonly toggleBroadcasting: Effect.Effect<void>;
|
|
163
|
+
/**
|
|
164
|
+
* Each error of the content source and of the transforms. An error
|
|
165
|
+
* also disables the source. No old error is given again.
|
|
166
|
+
*/
|
|
167
|
+
readonly errors: Stream.Stream<E | TransformFailed>;
|
|
168
|
+
/**
|
|
169
|
+
* Adds a transformation while the scope is open. The content source is
|
|
170
|
+
* not released when the transforms change.
|
|
171
|
+
*/
|
|
172
|
+
readonly addTransform: (
|
|
173
|
+
transform: TrackTransform
|
|
174
|
+
) => Effect.Effect<void, never, Scope.Scope>;
|
|
175
|
+
}
|
|
176
|
+
interface TrackSourceOptions<E, R> {
|
|
177
|
+
readonly explicit?: {
|
|
178
|
+
readonly ready: Effect.Effect<void>;
|
|
179
|
+
readonly failed: (error: E | TransformFailed) => Effect.Effect<void>;
|
|
180
|
+
};
|
|
181
|
+
/** The source of the content. It is run only while it is necessary. */
|
|
182
|
+
readonly contentTrack: Stream.Stream<MediaStreamTrack, E, R>;
|
|
183
|
+
/** The track that is sent while there is no content. */
|
|
184
|
+
readonly fallbackTrack: Stream.Stream<MediaStreamTrack>;
|
|
185
|
+
/** The broadcast is started at the start. Default: false. */
|
|
186
|
+
readonly broadcasting?: boolean;
|
|
187
|
+
/**
|
|
188
|
+
* Keeps the content source acquired while the source is enabled and the
|
|
189
|
+
* broadcast track has a consumer, also with the broadcast stopped. This
|
|
190
|
+
* makes the start of a broadcast immediate. Default: false.
|
|
191
|
+
*/
|
|
192
|
+
readonly keepSourceAlive?: boolean;
|
|
193
|
+
/** The source is enabled at the start. Default: true. */
|
|
194
|
+
readonly enabled?: boolean;
|
|
195
|
+
readonly transforms?: ReadonlyArray<TrackTransform>;
|
|
196
|
+
}
|
|
197
|
+
declare const TrackSource: {
|
|
198
|
+
make: <E = never, R = never>(
|
|
199
|
+
options: TrackSourceOptions<E, R>
|
|
200
|
+
) => Effect.Effect<TrackSource<E>, never, R | Scope.Scope>;
|
|
201
|
+
};
|
|
202
|
+
//#endregion
|
|
203
|
+
//#region src/effect/client/DeviceSource.d.ts
|
|
204
|
+
interface DeviceSourceOptions {
|
|
205
|
+
/** Whether to broadcast when acquired. Default: false. */
|
|
206
|
+
readonly broadcasting?: boolean;
|
|
207
|
+
readonly constraints?: Omit<MediaTrackConstraints, "deviceId" | "groupId">;
|
|
208
|
+
readonly transforms?: ReadonlyArray<TrackTransform>;
|
|
209
|
+
/**
|
|
210
|
+
* The track that is sent while there is no content. Default: an inaudible
|
|
211
|
+
* audio track for the microphone, a black video track for the camera.
|
|
212
|
+
*/
|
|
213
|
+
readonly fallbackTrack?: Stream.Stream<MediaStreamTrack>;
|
|
214
|
+
}
|
|
215
|
+
interface DeviceSource extends Omit<
|
|
216
|
+
TrackSource<SourceError>,
|
|
217
|
+
| "enable"
|
|
218
|
+
| "disable"
|
|
219
|
+
| "toggleEnabled"
|
|
220
|
+
| "isEnabled"
|
|
221
|
+
| "startBroadcasting"
|
|
222
|
+
| "toggleBroadcasting"
|
|
223
|
+
> {
|
|
224
|
+
/** Acquire this device if necessary and send its track. */
|
|
225
|
+
readonly startBroadcasting: Effect.Effect<
|
|
226
|
+
void,
|
|
227
|
+
SourceError | TransformFailed
|
|
228
|
+
>;
|
|
229
|
+
/** Turning on acquires if needed. Muting keeps the device acquired. */
|
|
230
|
+
readonly toggleBroadcasting: Effect.Effect<
|
|
231
|
+
void,
|
|
232
|
+
SourceError | TransformFailed
|
|
233
|
+
>;
|
|
234
|
+
/** Wait for capture without changing the broadcast preference. */
|
|
235
|
+
readonly acquire: Effect.Effect<void, SourceError | TransformFailed>;
|
|
236
|
+
/** Release capture and preserve the broadcast preference. */
|
|
237
|
+
readonly release: Effect.Effect<void>;
|
|
238
|
+
/** Waiting for the first usable track. */
|
|
239
|
+
readonly isAcquiring: Subscribable<boolean>;
|
|
240
|
+
/** Capture has produced a usable track, even if muted. */
|
|
241
|
+
readonly isAcquired: Subscribable<boolean>;
|
|
242
|
+
readonly permissionState: Subscribable<SafePermissionState>;
|
|
243
|
+
/** The devices of this kind. Use it for a device selector. */
|
|
244
|
+
readonly availableDevices: Subscribable<ReadonlyArray<MediaDeviceInfo>>;
|
|
245
|
+
/**
|
|
246
|
+
* Show this device in a device selector. It is the device identified by
|
|
247
|
+
* the captured track, or the first candidate if there is no match.
|
|
248
|
+
* It can differ from the saved preference and remains available while
|
|
249
|
+
* idle. An empty device list gives `undefined`.
|
|
250
|
+
*/
|
|
251
|
+
readonly activeDevice: Subscribable<MediaDeviceInfo | undefined>;
|
|
252
|
+
/**
|
|
253
|
+
* The preference is kept by `DevicePreferences`. When the preferred
|
|
254
|
+
* device is not available, the other devices are tried. When it becomes
|
|
255
|
+
* available, it is used.
|
|
256
|
+
*/
|
|
257
|
+
readonly setPreferredDevice: (device: MediaDeviceInfo) => Effect.Effect<void>;
|
|
258
|
+
/** Each device that gave a track that is not healthy. */
|
|
259
|
+
readonly deviceFailures: Stream.Stream<MediaDeviceInfo>;
|
|
260
|
+
}
|
|
261
|
+
declare const MicrophoneSource: {
|
|
262
|
+
make: (
|
|
263
|
+
options?: DeviceSourceOptions
|
|
264
|
+
) => Effect.Effect<
|
|
265
|
+
DeviceSource,
|
|
266
|
+
never,
|
|
267
|
+
Scope.Scope | MediaDevices | DevicePreferences
|
|
268
|
+
>;
|
|
269
|
+
};
|
|
270
|
+
declare const CameraSource: {
|
|
271
|
+
make: (
|
|
272
|
+
options?: DeviceSourceOptions
|
|
273
|
+
) => Effect.Effect<
|
|
274
|
+
DeviceSource,
|
|
275
|
+
never,
|
|
276
|
+
Scope.Scope | MediaDevices | DevicePreferences
|
|
277
|
+
>;
|
|
278
|
+
};
|
|
279
|
+
/** Acquire both idle devices in one request or control either device independently. */
|
|
280
|
+
declare const MediaSources: {
|
|
281
|
+
make: (options?: {
|
|
282
|
+
microphone?: DeviceSourceOptions;
|
|
283
|
+
camera?: DeviceSourceOptions;
|
|
284
|
+
}) => Effect.Effect<
|
|
285
|
+
{
|
|
286
|
+
microphone: DeviceSource;
|
|
287
|
+
camera: DeviceSource;
|
|
288
|
+
acquire: Effect.Effect<void, SourceError | TransformFailed, never>;
|
|
289
|
+
release: Effect.Effect<void, never, never>;
|
|
290
|
+
},
|
|
291
|
+
never,
|
|
292
|
+
Scope.Scope | MediaDevices | DevicePreferences
|
|
293
|
+
>;
|
|
294
|
+
};
|
|
295
|
+
//#endregion
|
|
296
|
+
//#region src/effect/client/ScreenShareSource.d.ts
|
|
297
|
+
interface ScreenShareTrackOptions {
|
|
298
|
+
readonly constraints?: MediaTrackConstraints;
|
|
299
|
+
/** The broadcast is started at the start. Default: false. */
|
|
300
|
+
readonly broadcasting?: boolean;
|
|
301
|
+
}
|
|
302
|
+
interface ScreenShareSourceOptions {
|
|
303
|
+
/** The source is enabled at the start. Default: false. */
|
|
304
|
+
readonly enabled?: boolean;
|
|
305
|
+
/**
|
|
306
|
+
* Keeps the screen share acquired while the broadcast is stopped.
|
|
307
|
+
* Default: false.
|
|
308
|
+
*/
|
|
309
|
+
readonly keepSourceAlive?: boolean;
|
|
310
|
+
/** `false` asks for no audio. Default: true. */
|
|
311
|
+
readonly audio?: boolean | ScreenShareTrackOptions;
|
|
312
|
+
readonly video?: boolean | ScreenShareTrackOptions;
|
|
313
|
+
/**
|
|
314
|
+
* The tracks that are sent while there is no content. Default: an
|
|
315
|
+
* inaudible audio track and a black video track.
|
|
316
|
+
*/
|
|
317
|
+
readonly fallbackTracks?: {
|
|
318
|
+
readonly audio?: Stream.Stream<MediaStreamTrack>;
|
|
319
|
+
readonly video?: Stream.Stream<MediaStreamTrack>;
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
/** One track of a screen share. The source flag is on the screen share. */
|
|
323
|
+
type ScreenShareTrack = Omit<
|
|
324
|
+
TrackSource<MediaAccessError>,
|
|
325
|
+
"isEnabled" | "enable" | "disable" | "toggleEnabled"
|
|
326
|
+
>;
|
|
327
|
+
interface ScreenShareSource {
|
|
328
|
+
readonly audio: ScreenShareTrack;
|
|
329
|
+
readonly video: ScreenShareTrack;
|
|
330
|
+
/**
|
|
331
|
+
* When false, the screen is not requested. It becomes false when the
|
|
332
|
+
* screen share ends and when the user cancels the browser prompt.
|
|
333
|
+
*/
|
|
334
|
+
readonly isEnabled: Subscribable<boolean>;
|
|
335
|
+
/** True when the audio or the video broadcasts. */
|
|
336
|
+
readonly isBroadcasting: Subscribable<boolean>;
|
|
337
|
+
readonly enable: Effect.Effect<void>;
|
|
338
|
+
/** Also stops the broadcast of the two tracks. */
|
|
339
|
+
readonly disable: Effect.Effect<void>;
|
|
340
|
+
readonly toggleEnabled: Effect.Effect<void>;
|
|
341
|
+
/** Starts the broadcast of the two tracks. Also enables the source. */
|
|
342
|
+
readonly startBroadcasting: Effect.Effect<void>;
|
|
343
|
+
readonly stopBroadcasting: Effect.Effect<void>;
|
|
344
|
+
/** Stops the two tracks if one of them is started. */
|
|
345
|
+
readonly toggleBroadcasting: Effect.Effect<void>;
|
|
346
|
+
}
|
|
347
|
+
declare const ScreenShareSource: {
|
|
348
|
+
make: (
|
|
349
|
+
options?: ScreenShareSourceOptions
|
|
350
|
+
) => Effect.Effect<ScreenShareSource, never, Scope.Scope | MediaDevices>;
|
|
351
|
+
};
|
|
352
|
+
//#endregion
|
|
353
|
+
export {
|
|
354
|
+
ApiAuthRedirect,
|
|
355
|
+
type ApiError,
|
|
356
|
+
type ApiHistoryEntry,
|
|
357
|
+
ApiInvalidResponse,
|
|
358
|
+
ApiResponseError,
|
|
359
|
+
ApiTransportError,
|
|
360
|
+
AudioSink,
|
|
361
|
+
type AudioSinkElement,
|
|
362
|
+
type AudioSinkOptions,
|
|
363
|
+
CameraSource,
|
|
364
|
+
type ConnectionStats,
|
|
365
|
+
type DeviceFailure,
|
|
366
|
+
DevicePreferences,
|
|
367
|
+
type DeviceRanking,
|
|
368
|
+
type DeviceReference,
|
|
369
|
+
type DeviceSource,
|
|
370
|
+
type DeviceSourceOptions,
|
|
371
|
+
DevicesExhausted,
|
|
372
|
+
MediaAccessError,
|
|
373
|
+
MediaDevices,
|
|
374
|
+
type MediaDevicesBackend,
|
|
375
|
+
MediaSources,
|
|
376
|
+
MicrophoneSource,
|
|
377
|
+
NegotiationOutcomeUnknown,
|
|
378
|
+
PeerConnectionFailed,
|
|
379
|
+
type PeerConnectionFailedReason,
|
|
380
|
+
PeerConnections,
|
|
381
|
+
type PermissionKind,
|
|
382
|
+
type PreferenceStorage,
|
|
383
|
+
type PullError,
|
|
384
|
+
type PullOptions,
|
|
385
|
+
type PullState,
|
|
386
|
+
type PulledTrack,
|
|
387
|
+
type PushError,
|
|
388
|
+
type PushOptions,
|
|
389
|
+
type PushState,
|
|
390
|
+
type PushedTrack,
|
|
391
|
+
type QualityLimitationReason,
|
|
392
|
+
RealtimeApi,
|
|
393
|
+
RealtimeClient,
|
|
394
|
+
type RealtimeConfig,
|
|
395
|
+
type ReceivedTrackStats,
|
|
396
|
+
type RemoteReceptionStats,
|
|
397
|
+
type ResilientTrackOptions,
|
|
398
|
+
type RetrySchedule,
|
|
399
|
+
type SafePermissionState,
|
|
400
|
+
ScreenShareSource,
|
|
401
|
+
type ScreenShareSourceOptions,
|
|
402
|
+
type ScreenShareTrack,
|
|
403
|
+
type ScreenShareTrackOptions,
|
|
404
|
+
SenderError,
|
|
405
|
+
type SentStreamStats,
|
|
406
|
+
type SentTrackStats,
|
|
407
|
+
type SessionAuth,
|
|
408
|
+
type SessionError,
|
|
409
|
+
SessionFailed,
|
|
410
|
+
type SessionState,
|
|
411
|
+
SinkError,
|
|
412
|
+
type SourceError,
|
|
413
|
+
type StatsOptions,
|
|
414
|
+
type Subscribable,
|
|
415
|
+
TrackError,
|
|
416
|
+
TrackMetadata,
|
|
417
|
+
TrackSource,
|
|
418
|
+
type TrackSourceOptions,
|
|
419
|
+
type TrackTransform,
|
|
420
|
+
type TransceiverEvent,
|
|
421
|
+
TransceiverNotFound,
|
|
422
|
+
TransformFailed,
|
|
423
|
+
type TransportStats,
|
|
424
|
+
blackVideoTrack,
|
|
425
|
+
defaultRetrySchedule,
|
|
426
|
+
devices,
|
|
427
|
+
inaudibleAudioTrack,
|
|
428
|
+
pullStream,
|
|
429
|
+
pushStream,
|
|
430
|
+
resilientTrack,
|
|
431
|
+
sessionTokenHeader,
|
|
432
|
+
trackIsHealthy
|
|
433
|
+
};
|
|
434
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { A as PeerConnectionFailed, C as ApiAuthRedirect, D as DevicesExhausted, E as ApiTransportError, F as TransceiverNotFound, I as TransformFailed, M as SessionFailed, N as SinkError, O as MediaAccessError, P as TrackError, S as devices, T as ApiResponseError, _ as TrackSource, a as RealtimeApi, c as defaultRetrySchedule, d as MediaSources, f as MicrophoneSource, g as inaudibleAudioTrack, h as blackVideoTrack, i as TrackMetadata, j as SenderError, k as NegotiationOutcomeUnknown, l as ScreenShareSource, m as trackIsHealthy, n as pullStream, o as sessionTokenHeader, p as resilientTrack, r as pushStream, s as PeerConnections, t as RealtimeClient, u as CameraSource, v as DevicePreferences, w as ApiInvalidResponse, x as MediaDevices, y as AudioSink } from "../../RealtimeClient-Bl0Tun5r.js";
|
|
2
|
+
export { ApiAuthRedirect, ApiInvalidResponse, ApiResponseError, ApiTransportError, AudioSink, CameraSource, DevicePreferences, DevicesExhausted, MediaAccessError, MediaDevices, MediaSources, MicrophoneSource, NegotiationOutcomeUnknown, PeerConnectionFailed, PeerConnections, RealtimeApi, RealtimeClient, ScreenShareSource, SenderError, SessionFailed, SinkError, TrackError, TrackMetadata, TrackSource, TransceiverNotFound, TransformFailed, blackVideoTrack, defaultRetrySchedule, devices, inaudibleAudioTrack, pullStream, pushStream, resilientTrack, sessionTokenHeader, trackIsHealthy };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {
|
|
2
|
+
P as Readable,
|
|
3
|
+
S as PushState,
|
|
4
|
+
b as PullState,
|
|
5
|
+
k as TrackMetadata,
|
|
6
|
+
r as RealtimeClient
|
|
7
|
+
} from "../RealtimeClient-ESFO5vfF.js";
|
|
8
|
+
|
|
9
|
+
//#region src/react/index.d.ts
|
|
10
|
+
/** The current value of a `Readable`. The component renders on each change. */
|
|
11
|
+
declare function useReadable<T>(readable: Readable<T>): T;
|
|
12
|
+
/**
|
|
13
|
+
* Pushes a track while the component is mounted. A new `source` value
|
|
14
|
+
* replaces the track with no new negotiation. New `sendEncodings` are
|
|
15
|
+
* applied to the sender.
|
|
16
|
+
*/
|
|
17
|
+
declare function usePushedTrack(
|
|
18
|
+
realtime: RealtimeClient,
|
|
19
|
+
source: MediaStreamTrack | Readable<MediaStreamTrack | undefined> | undefined,
|
|
20
|
+
options?: {
|
|
21
|
+
sendEncodings?: RTCRtpEncodingParameters[];
|
|
22
|
+
}
|
|
23
|
+
): {
|
|
24
|
+
metadata: TrackMetadata | undefined;
|
|
25
|
+
state: PushState;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Pulls a track while the component is mounted. New `metadata` pulls the
|
|
29
|
+
* new track. A new `preferredRid` changes the simulcast layer with no new
|
|
30
|
+
* track.
|
|
31
|
+
*/
|
|
32
|
+
declare function usePulledTrack(
|
|
33
|
+
realtime: RealtimeClient,
|
|
34
|
+
metadata: TrackMetadata | undefined,
|
|
35
|
+
options?: {
|
|
36
|
+
preferredRid?: string;
|
|
37
|
+
}
|
|
38
|
+
): {
|
|
39
|
+
track: MediaStreamTrack | undefined;
|
|
40
|
+
state: PullState;
|
|
41
|
+
};
|
|
42
|
+
//#endregion
|
|
43
|
+
export { usePulledTrack, usePushedTrack, useReadable };
|
|
44
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { n as isReadable, t as Store } from "../Readable-CJPSx6Uq.js";
|
|
2
|
+
import { useCallback, useEffect, useRef, useState, useSyncExternalStore } from "react";
|
|
3
|
+
//#region src/react/index.ts
|
|
4
|
+
/** The current value of a `Readable`. The component renders on each change. */
|
|
5
|
+
function useReadable(readable) {
|
|
6
|
+
return useSyncExternalStore(useCallback((onChange) => {
|
|
7
|
+
let subscribed = false;
|
|
8
|
+
const unsubscribe = readable.subscribe(() => {
|
|
9
|
+
if (subscribed) onChange();
|
|
10
|
+
});
|
|
11
|
+
subscribed = true;
|
|
12
|
+
return unsubscribe;
|
|
13
|
+
}, [readable]), readable.get, readable.get);
|
|
14
|
+
}
|
|
15
|
+
const noPushState = new Store({ _tag: "WaitingForTrack" });
|
|
16
|
+
const noPullState = new Store({ _tag: "WaitingForMetadata" });
|
|
17
|
+
const noMetadata = new Store(void 0);
|
|
18
|
+
const noTrack = new Store(void 0);
|
|
19
|
+
/**
|
|
20
|
+
* Pushes a track while the component is mounted. A new `source` value
|
|
21
|
+
* replaces the track with no new negotiation. New `sendEncodings` are
|
|
22
|
+
* applied to the sender.
|
|
23
|
+
*/
|
|
24
|
+
function usePushedTrack(realtime, source, options = {}) {
|
|
25
|
+
const [current] = useState(() => new Store(void 0));
|
|
26
|
+
const [pushed, setPushed] = useState();
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (isReadable(source)) return source.subscribe(current.set);
|
|
29
|
+
current.set(source);
|
|
30
|
+
}, [current, source]);
|
|
31
|
+
const encodings = JSON.stringify(options.sendEncodings ?? null);
|
|
32
|
+
const latestEncodings = useRef(options.sendEncodings);
|
|
33
|
+
latestEncodings.current = options.sendEncodings;
|
|
34
|
+
const appliedEncodings = useRef(encodings);
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
appliedEncodings.current = JSON.stringify(latestEncodings.current ?? null);
|
|
37
|
+
const handle = realtime.push(current, { sendEncodings: latestEncodings.current });
|
|
38
|
+
setPushed(handle);
|
|
39
|
+
return () => {
|
|
40
|
+
setPushed(void 0);
|
|
41
|
+
handle.close();
|
|
42
|
+
};
|
|
43
|
+
}, [realtime, current]);
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
if (pushed === void 0 || appliedEncodings.current === encodings) return;
|
|
46
|
+
const previous = appliedEncodings.current;
|
|
47
|
+
appliedEncodings.current = encodings;
|
|
48
|
+
pushed.setSendEncodings(latestEncodings.current ?? []).catch(() => {
|
|
49
|
+
if (appliedEncodings.current === encodings) appliedEncodings.current = previous;
|
|
50
|
+
});
|
|
51
|
+
}, [pushed, encodings]);
|
|
52
|
+
return {
|
|
53
|
+
metadata: useReadable(pushed?.metadata ?? noMetadata),
|
|
54
|
+
state: useReadable(pushed?.state ?? noPushState)
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Pulls a track while the component is mounted. New `metadata` pulls the
|
|
59
|
+
* new track. A new `preferredRid` changes the simulcast layer with no new
|
|
60
|
+
* track.
|
|
61
|
+
*/
|
|
62
|
+
function usePulledTrack(realtime, metadata, options = {}) {
|
|
63
|
+
const [target] = useState(() => new Store(void 0));
|
|
64
|
+
const [pulled, setPulled] = useState();
|
|
65
|
+
const sessionId = metadata?.sessionId;
|
|
66
|
+
const trackName = metadata?.trackName;
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
target.set(sessionId === void 0 || trackName === void 0 ? void 0 : {
|
|
69
|
+
sessionId,
|
|
70
|
+
trackName,
|
|
71
|
+
location: "remote"
|
|
72
|
+
});
|
|
73
|
+
}, [
|
|
74
|
+
target,
|
|
75
|
+
sessionId,
|
|
76
|
+
trackName
|
|
77
|
+
]);
|
|
78
|
+
const latestRid = useRef(options.preferredRid);
|
|
79
|
+
latestRid.current = options.preferredRid;
|
|
80
|
+
const appliedRid = useRef(latestRid.current ?? "");
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
appliedRid.current = latestRid.current ?? "";
|
|
83
|
+
const handle = realtime.pull(target, { preferredRid: latestRid.current });
|
|
84
|
+
setPulled(handle);
|
|
85
|
+
return () => {
|
|
86
|
+
setPulled(void 0);
|
|
87
|
+
handle.close();
|
|
88
|
+
};
|
|
89
|
+
}, [realtime, target]);
|
|
90
|
+
const nextRid = options.preferredRid ?? "";
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
if (pulled === void 0 || appliedRid.current === nextRid) return;
|
|
93
|
+
const previous = appliedRid.current;
|
|
94
|
+
appliedRid.current = nextRid;
|
|
95
|
+
pulled.setPreferredRid(nextRid).catch(() => {
|
|
96
|
+
if (appliedRid.current === nextRid) appliedRid.current = previous;
|
|
97
|
+
});
|
|
98
|
+
}, [pulled, nextRid]);
|
|
99
|
+
return {
|
|
100
|
+
track: useReadable(pulled?.track ?? noTrack),
|
|
101
|
+
state: useReadable(pulled?.state ?? noPullState)
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
//#endregion
|
|
105
|
+
export { usePulledTrack, usePushedTrack, useReadable };
|
|
106
|
+
|
|
107
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/react/index.ts"],"sourcesContent":["import {\n useCallback,\n useEffect,\n useRef,\n useState,\n useSyncExternalStore\n} from \"react\";\n\nimport { isReadable, Store } from \"../client/Readable\";\n\nimport type {\n RealtimeClient,\n PulledTrack,\n PushedTrack\n} from \"../client/RealtimeClient\";\nimport type { Readable } from \"../client/Readable\";\nimport type { PullState, PushState, TrackMetadata } from \"../client/types\";\n\n/** The current value of a `Readable`. The component renders on each change. */\nexport function useReadable<T>(readable: Readable<T>): T {\n const subscribe = useCallback(\n (onChange: () => void) => {\n // A `Readable` calls a new listener immediately. React reads the\n // value itself after it subscribes, so that call is not necessary.\n let subscribed = false;\n const unsubscribe = readable.subscribe(() => {\n if (subscribed) onChange();\n });\n subscribed = true;\n return unsubscribe;\n },\n [readable]\n );\n return useSyncExternalStore(subscribe, readable.get, readable.get);\n}\n\n// The values of a hook before its handle exists.\nconst noPushState = new Store<PushState>({ _tag: \"WaitingForTrack\" });\nconst noPullState = new Store<PullState>({ _tag: \"WaitingForMetadata\" });\nconst noMetadata = new Store<TrackMetadata | undefined>(undefined);\nconst noTrack = new Store<MediaStreamTrack | undefined>(undefined);\n\n/**\n * Pushes a track while the component is mounted. A new `source` value\n * replaces the track with no new negotiation. New `sendEncodings` are\n * applied to the sender.\n */\nexport function usePushedTrack(\n realtime: RealtimeClient,\n source: MediaStreamTrack | Readable<MediaStreamTrack | undefined> | undefined,\n options: { sendEncodings?: RTCRtpEncodingParameters[] } = {}\n): { metadata: TrackMetadata | undefined; state: PushState } {\n const [current] = useState(\n () => new Store<MediaStreamTrack | undefined>(undefined)\n );\n const [pushed, setPushed] = useState<PushedTrack>();\n\n useEffect(() => {\n if (isReadable(source)) return source.subscribe(current.set);\n current.set(source);\n return undefined;\n }, [current, source]);\n\n const encodings = JSON.stringify(options.sendEncodings ?? null);\n const latestEncodings = useRef(options.sendEncodings);\n latestEncodings.current = options.sendEncodings;\n const appliedEncodings = useRef(encodings);\n\n useEffect(() => {\n appliedEncodings.current = JSON.stringify(latestEncodings.current ?? null);\n const handle = realtime.push(current, {\n sendEncodings: latestEncodings.current\n });\n setPushed(handle);\n return () => {\n setPushed(undefined);\n void handle.close();\n };\n }, [realtime, current]);\n\n useEffect(() => {\n if (pushed === undefined || appliedEncodings.current === encodings) return;\n const previous = appliedEncodings.current;\n appliedEncodings.current = encodings;\n // The error is in the log of the client.\n pushed.setSendEncodings(latestEncodings.current ?? []).catch(() => {\n if (appliedEncodings.current === encodings) {\n appliedEncodings.current = previous;\n }\n });\n }, [pushed, encodings]);\n\n return {\n metadata: useReadable(pushed?.metadata ?? noMetadata),\n state: useReadable(pushed?.state ?? noPushState)\n };\n}\n\n/**\n * Pulls a track while the component is mounted. New `metadata` pulls the\n * new track. A new `preferredRid` changes the simulcast layer with no new\n * track.\n */\nexport function usePulledTrack(\n realtime: RealtimeClient,\n metadata: TrackMetadata | undefined,\n options: { preferredRid?: string } = {}\n): { track: MediaStreamTrack | undefined; state: PullState } {\n const [target] = useState(\n () => new Store<TrackMetadata | undefined>(undefined)\n );\n const [pulled, setPulled] = useState<PulledTrack>();\n\n const sessionId = metadata?.sessionId;\n const trackName = metadata?.trackName;\n useEffect(() => {\n target.set(\n sessionId === undefined || trackName === undefined\n ? undefined\n : { sessionId, trackName, location: \"remote\" }\n );\n }, [target, sessionId, trackName]);\n\n const latestRid = useRef(options.preferredRid);\n latestRid.current = options.preferredRid;\n const appliedRid = useRef(latestRid.current ?? \"\");\n\n useEffect(() => {\n appliedRid.current = latestRid.current ?? \"\";\n const handle = realtime.pull(target, {\n preferredRid: latestRid.current\n });\n setPulled(handle);\n return () => {\n setPulled(undefined);\n void handle.close();\n };\n }, [realtime, target]);\n\n const nextRid = options.preferredRid ?? \"\";\n useEffect(() => {\n if (pulled === undefined || appliedRid.current === nextRid) return;\n const previous = appliedRid.current;\n appliedRid.current = nextRid;\n // The error is in the log of the client.\n pulled.setPreferredRid(nextRid).catch(() => {\n if (appliedRid.current === nextRid) appliedRid.current = previous;\n });\n }, [pulled, nextRid]);\n\n return {\n track: useReadable(pulled?.track ?? noTrack),\n state: useReadable(pulled?.state ?? noPullState)\n };\n}\n"],"mappings":";;;;AAmBA,SAAgB,YAAe,UAA0B;AAcvD,QAAO,qBAbW,aACf,aAAyB;EAGxB,IAAI,aAAa;EACjB,MAAM,cAAc,SAAS,gBAAgB;AAC3C,OAAI,WAAY,WAAU;IAC1B;AACF,eAAa;AACb,SAAO;IAET,CAAC,SAAS,CAEyB,EAAE,SAAS,KAAK,SAAS,IAAI;;AAIpE,MAAM,cAAc,IAAI,MAAiB,EAAE,MAAM,mBAAmB,CAAC;AACrE,MAAM,cAAc,IAAI,MAAiB,EAAE,MAAM,sBAAsB,CAAC;AACxE,MAAM,aAAa,IAAI,MAAiC,KAAA,EAAU;AAClE,MAAM,UAAU,IAAI,MAAoC,KAAA,EAAU;;;;;;AAOlE,SAAgB,eACd,UACA,QACA,UAA0D,EAAE,EACD;CAC3D,MAAM,CAAC,WAAW,eACV,IAAI,MAAoC,KAAA,EAAU,CACzD;CACD,MAAM,CAAC,QAAQ,aAAa,UAAuB;AAEnD,iBAAgB;AACd,MAAI,WAAW,OAAO,CAAE,QAAO,OAAO,UAAU,QAAQ,IAAI;AAC5D,UAAQ,IAAI,OAAO;IAElB,CAAC,SAAS,OAAO,CAAC;CAErB,MAAM,YAAY,KAAK,UAAU,QAAQ,iBAAiB,KAAK;CAC/D,MAAM,kBAAkB,OAAO,QAAQ,cAAc;AACrD,iBAAgB,UAAU,QAAQ;CAClC,MAAM,mBAAmB,OAAO,UAAU;AAE1C,iBAAgB;AACd,mBAAiB,UAAU,KAAK,UAAU,gBAAgB,WAAW,KAAK;EAC1E,MAAM,SAAS,SAAS,KAAK,SAAS,EACpC,eAAe,gBAAgB,SAChC,CAAC;AACF,YAAU,OAAO;AACjB,eAAa;AACX,aAAU,KAAA,EAAU;AACf,UAAO,OAAO;;IAEpB,CAAC,UAAU,QAAQ,CAAC;AAEvB,iBAAgB;AACd,MAAI,WAAW,KAAA,KAAa,iBAAiB,YAAY,UAAW;EACpE,MAAM,WAAW,iBAAiB;AAClC,mBAAiB,UAAU;AAE3B,SAAO,iBAAiB,gBAAgB,WAAW,EAAE,CAAC,CAAC,YAAY;AACjE,OAAI,iBAAiB,YAAY,UAC/B,kBAAiB,UAAU;IAE7B;IACD,CAAC,QAAQ,UAAU,CAAC;AAEvB,QAAO;EACL,UAAU,YAAY,QAAQ,YAAY,WAAW;EACrD,OAAO,YAAY,QAAQ,SAAS,YAAY;EACjD;;;;;;;AAQH,SAAgB,eACd,UACA,UACA,UAAqC,EAAE,EACoB;CAC3D,MAAM,CAAC,UAAU,eACT,IAAI,MAAiC,KAAA,EAAU,CACtD;CACD,MAAM,CAAC,QAAQ,aAAa,UAAuB;CAEnD,MAAM,YAAY,UAAU;CAC5B,MAAM,YAAY,UAAU;AAC5B,iBAAgB;AACd,SAAO,IACL,cAAc,KAAA,KAAa,cAAc,KAAA,IACrC,KAAA,IACA;GAAE;GAAW;GAAW,UAAU;GAAU,CACjD;IACA;EAAC;EAAQ;EAAW;EAAU,CAAC;CAElC,MAAM,YAAY,OAAO,QAAQ,aAAa;AAC9C,WAAU,UAAU,QAAQ;CAC5B,MAAM,aAAa,OAAO,UAAU,WAAW,GAAG;AAElD,iBAAgB;AACd,aAAW,UAAU,UAAU,WAAW;EAC1C,MAAM,SAAS,SAAS,KAAK,QAAQ,EACnC,cAAc,UAAU,SACzB,CAAC;AACF,YAAU,OAAO;AACjB,eAAa;AACX,aAAU,KAAA,EAAU;AACf,UAAO,OAAO;;IAEpB,CAAC,UAAU,OAAO,CAAC;CAEtB,MAAM,UAAU,QAAQ,gBAAgB;AACxC,iBAAgB;AACd,MAAI,WAAW,KAAA,KAAa,WAAW,YAAY,QAAS;EAC5D,MAAM,WAAW,WAAW;AAC5B,aAAW,UAAU;AAErB,SAAO,gBAAgB,QAAQ,CAAC,YAAY;AAC1C,OAAI,WAAW,YAAY,QAAS,YAAW,UAAU;IACzD;IACD,CAAC,QAAQ,QAAQ,CAAC;AAErB,QAAO;EACL,OAAO,YAAY,QAAQ,SAAS,QAAQ;EAC5C,OAAO,YAAY,QAAQ,SAAS,YAAY;EACjD"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
i as sessionTokenInvalidCode,
|
|
3
|
+
n as RouteRealtimeRequestOptions$1,
|
|
4
|
+
r as sessionTokenHeader
|
|
5
|
+
} from "../Realtime-B5OIHlLR.js";
|
|
6
|
+
|
|
7
|
+
//#region src/server/routeRealtimeRequest.d.ts
|
|
8
|
+
interface RouteRealtimeRequestOptions extends RouteRealtimeRequestOptions$1 {
|
|
9
|
+
/** Replaces the global fetch. */
|
|
10
|
+
fetch?: typeof fetch;
|
|
11
|
+
}
|
|
12
|
+
declare function routeRealtimeRequest({
|
|
13
|
+
fetch: send,
|
|
14
|
+
...options
|
|
15
|
+
}: RouteRealtimeRequestOptions): Promise<Response>;
|
|
16
|
+
//#endregion
|
|
17
|
+
export {
|
|
18
|
+
type RouteRealtimeRequestOptions,
|
|
19
|
+
routeRealtimeRequest,
|
|
20
|
+
sessionTokenHeader,
|
|
21
|
+
sessionTokenInvalidCode
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { i as sessionTokenInvalidCode, n as routeRealtimeRequest$1, r as sessionTokenHeader } from "../Realtime-B6TjV8su.js";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as FetchHttpClient from "effect/http/FetchHttpClient";
|
|
4
|
+
import * as HttpClient from "effect/http/HttpClient";
|
|
5
|
+
//#region src/server/routeRealtimeRequest.ts
|
|
6
|
+
function routeRealtimeRequest({ fetch: send, ...options }) {
|
|
7
|
+
return routeRealtimeRequest$1(options).pipe(Effect.provide(FetchHttpClient.layer), Effect.provideService(FetchHttpClient.Fetch, send ?? globalThis.fetch), Effect.provideService(HttpClient.TracerPropagationEnabled, false), Effect.runPromise);
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { routeRealtimeRequest, sessionTokenHeader, sessionTokenInvalidCode };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["Realtime.routeRealtimeRequest"],"sources":["../../src/server/routeRealtimeRequest.ts"],"sourcesContent":["import * as Effect from \"effect/Effect\";\nimport * as FetchHttpClient from \"effect/http/FetchHttpClient\";\nimport * as HttpClient from \"effect/http/HttpClient\";\nimport * as Realtime from \"../effect/server/Realtime\";\n\nexport {\n sessionTokenHeader,\n sessionTokenInvalidCode,\n invalidPathCode,\n pathEscapesSession\n} from \"../effect/server/Realtime\";\n\nexport interface RouteRealtimeRequestOptions\n extends Realtime.RouteRealtimeRequestOptions {\n /** Replaces the global fetch. */\n fetch?: typeof fetch;\n}\n\nexport function routeRealtimeRequest({\n fetch: send,\n ...options\n}: RouteRealtimeRequestOptions): Promise<Response> {\n return Realtime.routeRealtimeRequest(options).pipe(\n Effect.provide(FetchHttpClient.layer),\n Effect.provideService(FetchHttpClient.Fetch, send ?? globalThis.fetch),\n Effect.provideService(HttpClient.TracerPropagationEnabled, false),\n Effect.runPromise\n );\n}\n"],"mappings":";;;;;AAkBA,SAAgB,qBAAqB,EACnC,OAAO,MACP,GAAG,WAC8C;AACjD,QAAOA,uBAA8B,QAAQ,CAAC,KAC5C,OAAO,QAAQ,gBAAgB,MAAM,EACrC,OAAO,eAAe,gBAAgB,OAAO,QAAQ,WAAW,MAAM,EACtE,OAAO,eAAe,WAAW,0BAA0B,MAAM,EACjE,OAAO,WACR"}
|