openrtc 0.2.0 → 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/LICENSE +92 -0
- package/README.md +51 -10
- package/dist/{DelegatingRuntimeAdapter-CjHzBEBA.d.ts → DelegatingRuntimeAdapter-BxOcVIx_.d.ts} +23 -2
- package/dist/{IpcRuntimeAdapter-CtckyMol.d.ts → IpcRuntimeAdapter-U5AEH0jn.d.ts} +6 -3
- package/dist/auth/index.js +1 -1
- package/dist/auth/internal.js +1 -1
- package/dist/chunk-7DN33VUQ.js +1 -0
- package/dist/chunk-BLOEZIFJ.js +1 -0
- package/dist/chunk-FQETZQPW.js +2 -0
- package/dist/chunk-IUHUYHNZ.js +1 -0
- package/dist/chunk-UBEE42VU.js +2 -0
- package/dist/chunk-UPO23UMZ.js +3 -0
- package/dist/chunk-WNJE3MJF.js +1 -0
- package/dist/{factories-CwZiIRg1.d.ts → framing-lxzHEuSr.d.ts} +71 -4
- package/dist/index.d.ts +109 -9
- package/dist/index.js +2 -2
- package/dist/openrtc_bg.wasm +0 -0
- package/dist/runtime/WasmRuntimeAdapter.d.ts +2 -2
- package/dist/runtime/WasmRuntimeAdapter.js +1 -1
- package/dist/runtime/index.d.ts +14 -7
- package/dist/runtime/index.js +1 -1
- package/dist/runtime/tauri.d.ts +3 -3
- package/dist/runtime/tauri.js +1 -1
- package/dist/transport/index.d.ts +1 -1
- package/dist/transport/index.js +1 -1
- package/dist/{types-DyCGvj9l.d.ts → types-D0fRvUbN.d.ts} +31 -10
- package/env/index.d.ts +64 -0
- package/env/index.mjs +230 -0
- package/package.json +19 -10
- package/dist/chunk-3VTF5RKW.js +0 -1
- package/dist/chunk-JXGKO7SX.js +0 -1
- package/dist/chunk-MFT6SOZ6.js +0 -3
- package/dist/chunk-SGZWR63E.js +0 -1
- package/dist/chunk-VARALO7G.js +0 -1
- package/dist/chunk-WOHFM6DI.js +0 -2
- package/dist/chunk-YHJOXD46.js +0 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,41 @@
|
|
|
1
|
-
import { R as RuntimeClientOptions, a as RuntimeClient, b as
|
|
2
|
-
export {
|
|
3
|
-
import { k as ConnectDeviceResult, l as ConnectDeviceHooks, m as ConnectDeviceOptions, P as PeerSessionSnapshot, c as ResolvedPeerIdentity, n as ProtocolName, o as ProtocolCapability, p as ProtocolCapabilityMap, q as ApplicationPayloadCrypto, r as ApplicationCryptoStreamTools, s as SpaceTokenProvider } from './types-
|
|
4
|
-
export { t as AppLimits, u as ApplicationCryptoBiStream, v as ApplicationPayloadReadinessOptions, w as ApplicationPayloadRouteOptions, x as ApplicationPayloadSendOptions, A as AuthMode,
|
|
5
|
-
import { R as RuntimeCapabilities, a as RuntimeCapabilityProfile, A as AuthContext } from './DelegatingRuntimeAdapter-
|
|
6
|
-
export { b as RuntimeAdapterKind } from './DelegatingRuntimeAdapter-
|
|
7
|
-
import { P as PlutoIpcBridge } from './IpcRuntimeAdapter-
|
|
1
|
+
import { R as RuntimeClientOptions, a as RuntimeClient, b as RuntimeManagedSessionOptions, c as RuntimeManagedSession, d as RuntimeDevice, e as RuntimeDeviceStatusSnapshot, f as RuntimeDeviceConnectOptions, g as RuntimeLocalDeviceInfo, h as RuntimeLocalDeviceProfile, i as RuntimePeerState, j as RuntimePeerConnectOptions, C as Connection, k as RuntimePeerReadinessSnapshot, l as RuntimePeerHealth, m as RuntimeChannelDescriptor, n as RuntimePeerStreamOptions, o as RuntimeIncomingStream, p as RuntimeScopedChannelOptions, q as RuntimeScopedLogicalChannel, r as RuntimeJoinRoomOptions, s as RuntimeRoomMember, t as RuntimePolicySnapshot, u as RuntimeConnectionStateSnapshot, v as RuntimeApplicationPayloadReadinessOptions, w as RuntimeConnectionEvent, P as PeerReconciliationStats, x as PlutoRuntimeAssembly, y as RuntimeRawConnection, I as ITransport } from './framing-lxzHEuSr.js';
|
|
2
|
+
export { z as ChannelDescriptor, A as ConnectionEvent, B as ConnectionTarget, D as DeviceProfile, E as IncomingStream, O as OPENRTC_RUNTIME_POLICY, F as PeerConnectOptions, G as PeerReadiness, H as PeerStreamOptions, J as PresenceLoopOptions, K as RawConnection, L as RuntimeAuthContext, M as RuntimeAuthIdentity, N as RuntimeAutoConnectPolicy, Q as RuntimeConnectionTarget, S as RuntimeDevicePresenceStatus, T as RuntimeDeviceStatus, U as RuntimeJsonFrameHandler, V as RuntimeLogicalChannelFraming, W as RuntimeManagedSessionKind, X as RuntimeManagedSessionPlatform, Y as RuntimePeerLifecycleStatus, Z as RuntimePeerScope, _ as RuntimePeerSessionSnapshot, $ as RuntimePresenceLoopOptions, a0 as RuntimePresencePolicy, a1 as RuntimeSession, a2 as RuntimeU32BEFrameHandler, a3 as RuntimeUiConnectionStatus, a4 as ScopedChannelOptions, a5 as ScopedLogicalChannel, a6 as ScopedSession, a7 as Session, a8 as SessionOptions, a9 as createRuntimeJsonFrameDecoder, aa as createRuntimeU32BEFrameDecoder, ab as decodeRuntimeJsonPayload, ac as encodeRuntimeJsonFrame, ad as encodeRuntimeJsonPayload, ae as encodeRuntimeU32BEFrame, af as getRuntimePolicy, ag as isRuntimeDeviceActive, ah as isRuntimeDeviceConnectable, ai as isRuntimeDeviceRoutable } from './framing-lxzHEuSr.js';
|
|
3
|
+
import { k as ConnectDeviceResult, l as ConnectDeviceHooks, m as ConnectDeviceOptions, P as PeerSessionSnapshot, c as ResolvedPeerIdentity, G as GrantScope, n as ProtocolName, o as ProtocolCapability, p as ProtocolCapabilityMap, q as ApplicationPayloadCrypto, r as ApplicationCryptoStreamTools, s as SpaceTokenProvider } from './types-D0fRvUbN.js';
|
|
4
|
+
export { t as AppLimits, u as ApplicationCryptoBiStream, v as ApplicationPayloadReadinessOptions, w as ApplicationPayloadRouteOptions, x as ApplicationPayloadSendOptions, A as AuthMode, y as DevicePresenceStatus, D as DiscoveryMode, z as ProtocolBaseName, F as ProtocolImplementationKind, H as ProtocolLocality, S as SignalingMode, J as SpaceAuthMode } from './types-D0fRvUbN.js';
|
|
5
|
+
import { R as RuntimeCapabilities, a as RuntimeCapabilityProfile, A as AuthContext } from './DelegatingRuntimeAdapter-BxOcVIx_.js';
|
|
6
|
+
export { b as RuntimeAdapterKind } from './DelegatingRuntimeAdapter-BxOcVIx_.js';
|
|
7
|
+
import { P as PlutoIpcBridge } from './IpcRuntimeAdapter-U5AEH0jn.js';
|
|
8
8
|
export { TRANSPORT_LABELS, isDirectIrohTransportLabel, isIndependentTransportLabel, isIrohBaseTransportLabel, isOptionalTransportLabel, isWebRtcTransportLabel, normalizeTransportLabel } from './transport/index.js';
|
|
9
9
|
import './runtime/WasmRuntimeAdapter.js';
|
|
10
10
|
|
|
11
|
+
type OpenRTCChannelConnectOptions = Omit<RuntimeScopedChannelOptions, 'scope' | 'deviceId' | 'ticket'> & {
|
|
12
|
+
/**
|
|
13
|
+
* Device selected from `client.devices.*`. Passing the device object lets
|
|
14
|
+
* OpenRTC reuse its current ticket for native and ticket-gated routes.
|
|
15
|
+
*/
|
|
16
|
+
device?: string | RuntimeDevice;
|
|
17
|
+
deviceId?: string | null;
|
|
18
|
+
ticket?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Logical channel lifecycle scope. Most app channels should use the default
|
|
21
|
+
* `session`; pass a custom scope only when you intentionally manage peer
|
|
22
|
+
* lifecycle separately from the channel.
|
|
23
|
+
*/
|
|
24
|
+
scope?: RuntimeScopedChannelOptions['scope'];
|
|
25
|
+
};
|
|
26
|
+
type OpenRTCDeviceSessionOptions = Omit<RuntimeManagedSessionOptions, 'platform'> & {
|
|
27
|
+
/**
|
|
28
|
+
* Runtime host for the managed user-device session. Normal apps can omit
|
|
29
|
+
* this: `OpenRTC(...)` defaults to `web`, and `OpenRTC.native(...)` defaults
|
|
30
|
+
* to `native`.
|
|
31
|
+
*/
|
|
32
|
+
platform?: RuntimeManagedSessionOptions['platform'];
|
|
33
|
+
};
|
|
11
34
|
interface OpenRTCDeviceNamespace {
|
|
35
|
+
startSession(options?: OpenRTCDeviceSessionOptions): Promise<RuntimeManagedSession>;
|
|
36
|
+
stopSession(options?: {
|
|
37
|
+
preserveBackendSession?: boolean;
|
|
38
|
+
}): Promise<void>;
|
|
12
39
|
list(): Promise<RuntimeDevice[]>;
|
|
13
40
|
listWithStatus(): Promise<RuntimeDeviceStatusSnapshot[]>;
|
|
14
41
|
watch(callback: (devices: RuntimeDevice[]) => void): () => void;
|
|
@@ -68,8 +95,26 @@ interface OpenRTCChannelNamespace {
|
|
|
68
95
|
onIncomingChannel(channelId: string, callback: (stream: RuntimeIncomingStream & {
|
|
69
96
|
channel: NonNullable<RuntimeIncomingStream['channel']>;
|
|
70
97
|
}) => boolean | void): () => void;
|
|
98
|
+
connect(options: OpenRTCChannelConnectOptions): Promise<RuntimeScopedLogicalChannel>;
|
|
71
99
|
connectScoped(options: RuntimeScopedChannelOptions): Promise<RuntimeScopedLogicalChannel>;
|
|
72
100
|
}
|
|
101
|
+
interface OpenRTCRoomNamespace {
|
|
102
|
+
create(roomId?: string): Promise<string>;
|
|
103
|
+
join(roomId: string, options?: RuntimeJoinRoomOptions): Promise<Connection[]>;
|
|
104
|
+
leave(roomId: string): Promise<void>;
|
|
105
|
+
watch(roomId: string, callback: (members: RuntimeRoomMember[]) => void): () => void;
|
|
106
|
+
members(roomId: string): Promise<RuntimeRoomMember[]>;
|
|
107
|
+
}
|
|
108
|
+
interface OpenRTCTicketNamespace {
|
|
109
|
+
raw(): Promise<string>;
|
|
110
|
+
share(options?: {
|
|
111
|
+
maxConnections?: number;
|
|
112
|
+
}): Promise<string>;
|
|
113
|
+
grant(scope: GrantScope, options?: {
|
|
114
|
+
maxConnections?: number;
|
|
115
|
+
}): Promise<string>;
|
|
116
|
+
revoke(scope: GrantScope): Promise<string[]>;
|
|
117
|
+
}
|
|
73
118
|
interface OpenRTCDiagnosticsNamespace {
|
|
74
119
|
status(): Promise<{
|
|
75
120
|
runtime: 'tauri' | 'browser' | 'unknown';
|
|
@@ -119,6 +164,8 @@ interface OpenRTCClient extends RuntimeClient {
|
|
|
119
164
|
readonly devices: OpenRTCDeviceNamespace;
|
|
120
165
|
readonly peers: OpenRTCPeerNamespace;
|
|
121
166
|
readonly channels: OpenRTCChannelNamespace;
|
|
167
|
+
readonly rooms: OpenRTCRoomNamespace;
|
|
168
|
+
readonly tickets: OpenRTCTicketNamespace;
|
|
122
169
|
readonly diagnostics: OpenRTCDiagnosticsNamespace;
|
|
123
170
|
readonly advanced: OpenRTCAdvancedNamespace;
|
|
124
171
|
/** @deprecated Use setAuth() instead */
|
|
@@ -136,6 +183,56 @@ interface OpenRTCClient extends RuntimeClient {
|
|
|
136
183
|
signIn(): Promise<void>;
|
|
137
184
|
/** Sign out and clear auth context */
|
|
138
185
|
signOut(): Promise<void>;
|
|
186
|
+
/**
|
|
187
|
+
* @deprecated Use `client.devices.startSession(...)` for the public
|
|
188
|
+
* user-device avenue lifecycle. This top-level method remains for
|
|
189
|
+
* RuntimeClient compatibility and advanced integrations.
|
|
190
|
+
*/
|
|
191
|
+
startManagedSession(options: RuntimeManagedSessionOptions): Promise<RuntimeManagedSession>;
|
|
192
|
+
/**
|
|
193
|
+
* @deprecated Use `client.devices.stopSession(...)` for the public
|
|
194
|
+
* user-device avenue lifecycle.
|
|
195
|
+
*/
|
|
196
|
+
stopManagedSession(options?: {
|
|
197
|
+
preserveBackendSession?: boolean;
|
|
198
|
+
}): Promise<void>;
|
|
199
|
+
/** @deprecated Use `client.rooms.create(...)`. */
|
|
200
|
+
createRoom(roomId?: string): Promise<string>;
|
|
201
|
+
/** @deprecated Use `client.rooms.join(...)`. */
|
|
202
|
+
joinRoom(roomId: string, options?: RuntimeJoinRoomOptions): Promise<Connection[]>;
|
|
203
|
+
/** @deprecated Use `client.rooms.leave(...)`. */
|
|
204
|
+
leaveRoom(roomId: string): Promise<void>;
|
|
205
|
+
/** @deprecated Use `client.rooms.watch(...)`. */
|
|
206
|
+
watchRoom(roomId: string, callback: (members: RuntimeRoomMember[]) => void): () => void;
|
|
207
|
+
/** @deprecated Use `client.rooms.members(...)`. */
|
|
208
|
+
getRoomMembers(roomId: string): Promise<RuntimeRoomMember[]>;
|
|
209
|
+
/** @deprecated Use `client.tickets.raw(...)`. */
|
|
210
|
+
getInvite(): Promise<string>;
|
|
211
|
+
/** @deprecated Use `client.tickets.raw(...)`. */
|
|
212
|
+
getTicket(): Promise<string>;
|
|
213
|
+
/** @deprecated Use `client.tickets.share(...)` or `client.tickets.grant(...)`. */
|
|
214
|
+
getTicketWithToken(scope: GrantScope, maxConnections?: number): Promise<string>;
|
|
215
|
+
/** @deprecated Use `client.tickets.revoke(...)`. */
|
|
216
|
+
revokeTokensByScope(scope: GrantScope): Promise<string[]>;
|
|
217
|
+
/** @deprecated Use `client.peers.connect(...)`. */
|
|
218
|
+
connectPeer(options: RuntimePeerConnectOptions): Promise<Connection>;
|
|
219
|
+
/** @deprecated Use `client.peers.connect(...)`. */
|
|
220
|
+
connectTo(options: RuntimePeerConnectOptions): Promise<Connection>;
|
|
221
|
+
/** @deprecated Use `client.peers.waitConnected(...)`. */
|
|
222
|
+
waitForConnectedPeer(id: string, timeoutMs?: number): Promise<PeerSessionSnapshot | null>;
|
|
223
|
+
/** @deprecated Use `client.channels.connect(...)`; use `client.channels.connectScoped(...)` only for custom lifecycle scopes. */
|
|
224
|
+
connectScopedChannel(options: RuntimeScopedChannelOptions): Promise<RuntimeScopedLogicalChannel>;
|
|
225
|
+
/** @deprecated Use `client.channels.openBi(...)`. */
|
|
226
|
+
openPeerBi(id: string, options?: RuntimePeerStreamOptions): Promise<{
|
|
227
|
+
connection: Connection;
|
|
228
|
+
readable: ReadableStream<Uint8Array>;
|
|
229
|
+
writable: WritableStream<Uint8Array>;
|
|
230
|
+
}>;
|
|
231
|
+
/** @deprecated Use `client.channels.openUni(...)`. */
|
|
232
|
+
openPeerUni(id: string, options?: RuntimePeerStreamOptions): Promise<{
|
|
233
|
+
connection: Connection;
|
|
234
|
+
writable: WritableStream<Uint8Array>;
|
|
235
|
+
}>;
|
|
139
236
|
/**
|
|
140
237
|
* Access to the underlying PlutoRuntimeAssembly for backward compatibility.
|
|
141
238
|
* @deprecated Access methods directly on the client instead.
|
|
@@ -153,7 +250,10 @@ interface OpenRTCClient extends RuntimeClient {
|
|
|
153
250
|
* @example
|
|
154
251
|
* ```typescript
|
|
155
252
|
* import { OpenRTC } from 'openrtc';
|
|
156
|
-
* const client = OpenRTC({
|
|
253
|
+
* const client = OpenRTC({
|
|
254
|
+
* apiKey: 'pk_live_...',
|
|
255
|
+
* authMode: 'anonymous',
|
|
256
|
+
* });
|
|
157
257
|
* await client.connect();
|
|
158
258
|
* ```
|
|
159
259
|
*/
|
|
@@ -251,4 +351,4 @@ declare const createSpaceTokenProvider: typeof createPublicSpaceTokenProvider;
|
|
|
251
351
|
type UpgradeState = 'none' | 'upgrading' | 'upgraded' | 'failed';
|
|
252
352
|
type OutboundMessage = string | object | ArrayBuffer | Uint8Array;
|
|
253
353
|
|
|
254
|
-
export { ApplicationCryptoStreamTools, type ApplicationKeyAgreementPayload, ApplicationPayloadCrypto, type EnableSpaceAuthResponse, KEY_AGREEMENT_ALGORITHM, KEY_AGREEMENT_PUBLIC_KEY_BYTES, type MintSpaceTokenRequest, type MintSpaceTokenResponse, OpenRTC, type OpenRTCClient, RuntimeClientOptions as OpenRTCOptions, type OutboundMessage, ProtocolCapability, ProtocolCapabilityMap, ProtocolName, RuntimeApplicationPayloadReadinessOptions, RuntimeCapabilities, RuntimeChannelDescriptor, RuntimeClientOptions, RuntimeConnectionEvent, RuntimeConnectionStateSnapshot, RuntimeDevice, RuntimeDeviceConnectOptions, RuntimeDeviceStatusSnapshot, RuntimeIncomingStream, RuntimeLocalDeviceInfo, RuntimeLocalDeviceProfile, RuntimePeerConnectOptions, RuntimePeerHealth, RuntimePeerReadinessSnapshot, RuntimePeerState, RuntimePeerStreamOptions, RuntimePolicySnapshot, RuntimeRawConnection, RuntimeScopedChannelOptions, RuntimeScopedLogicalChannel, SpaceTokenProvider, type UpgradeState, createApplicationCryptoStreamTools, createPublicSpaceTokenProvider, createSharedSecretApplicationCrypto, createSpaceTokenProvider, deriveApplicationCryptoKey, enableSpaceAuth, encodeApplicationKeyAgreementPayload, generateEphemeralKeyAgreement, getPreferredProtocolOrder, isApplicationEncryptedPayload, mintSpaceToken, sandboxSpaceKey, spaceToken };
|
|
354
|
+
export { ApplicationCryptoStreamTools, type ApplicationKeyAgreementPayload, ApplicationPayloadCrypto, type EnableSpaceAuthResponse, GrantScope, KEY_AGREEMENT_ALGORITHM, KEY_AGREEMENT_PUBLIC_KEY_BYTES, type MintSpaceTokenRequest, type MintSpaceTokenResponse, OpenRTC, type OpenRTCChannelConnectOptions, type OpenRTCClient, type OpenRTCDeviceNamespace, type OpenRTCDeviceSessionOptions, RuntimeClientOptions as OpenRTCOptions, type OpenRTCRoomNamespace, type OpenRTCTicketNamespace, type OutboundMessage, ProtocolCapability, ProtocolCapabilityMap, ProtocolName, RuntimeApplicationPayloadReadinessOptions, RuntimeCapabilities, RuntimeChannelDescriptor, RuntimeClientOptions, RuntimeConnectionEvent, RuntimeConnectionStateSnapshot, RuntimeDevice, RuntimeDeviceConnectOptions, RuntimeDeviceStatusSnapshot, RuntimeIncomingStream, RuntimeJoinRoomOptions, RuntimeLocalDeviceInfo, RuntimeLocalDeviceProfile, RuntimeManagedSession, RuntimeManagedSessionOptions, RuntimePeerConnectOptions, RuntimePeerHealth, RuntimePeerReadinessSnapshot, RuntimePeerState, RuntimePeerStreamOptions, RuntimePolicySnapshot, RuntimeRawConnection, RuntimeRoomMember, RuntimeScopedChannelOptions, RuntimeScopedLogicalChannel, SpaceTokenProvider, type UpgradeState, createApplicationCryptoStreamTools, createPublicSpaceTokenProvider, createSharedSecretApplicationCrypto, createSpaceTokenProvider, deriveApplicationCryptoKey, enableSpaceAuth, encodeApplicationKeyAgreementPayload, generateEphemeralKeyAgreement, getPreferredProtocolOrder, isApplicationEncryptedPayload, mintSpaceToken, sandboxSpaceKey, spaceToken };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export{
|
|
1
|
+
import {z,A}from'./chunk-UPO23UMZ.js';export{c as KEY_AGREEMENT_ALGORITHM,b as KEY_AGREEMENT_PUBLIC_KEY_BYTES,g as ScopedSession,v as createRuntimeJsonFrameDecoder,r as createRuntimeU32BEFrameDecoder,t as decodeRuntimeJsonPayload,e as deriveApplicationCryptoKey,f as encodeApplicationKeyAgreementPayload,u as encodeRuntimeJsonFrame,s as encodeRuntimeJsonPayload,q as encodeRuntimeU32BEFrame,d as generateEphemeralKeyAgreement,a as getPreferredProtocolOrder,B as isRuntimeDeviceActive,D as isRuntimeDeviceConnectable,C as isRuntimeDeviceRoutable}from'./chunk-UPO23UMZ.js';import'./chunk-IUHUYHNZ.js';import {g}from'./chunk-UBEE42VU.js';export{q as OPENRTC_RUNTIME_POLICY,h as createApplicationCryptoStreamTools,g as createSharedSecretApplicationCrypto,r as getRuntimePolicy,f as isApplicationEncryptedPayload}from'./chunk-WNJE3MJF.js';import {m}from'./chunk-FQETZQPW.js';export{a as TRANSPORT_LABELS,d as isDirectIrohTransportLabel,g as isIndependentTransportLabel,c as isIrohBaseTransportLabel,e as isOptionalTransportLabel,f as isWebRtcTransportLabel,b as normalizeTransportLabel}from'./chunk-BLOEZIFJ.js';function O(t){let i=m({...t});if("auth"in t&&!t.authMode){let n=t.auth;i.authMode=n==="none"?"anonymous":n;}if("identity"in t&&!t.nodeIdPersistence){let n=t.identity;i.nodeIdPersistence=n==="temporary"?"ephemeral":n;}return "namespace"in t&&!t.storagePrefix&&(i.storagePrefix=t.namespace),"privacy"in t&&t.strictMode===void 0&&(i.strictMode=!!t.privacy),i}function T(t,i){let n=t.runtime,r=Object.create(n),s=async e=>{if(typeof e!="string")return e;let a=(await n.listDevices()).find(d=>d.deviceId===e);if(!a)throw new Error(`OpenRTC device '${e}' is not currently discoverable.`);return a},c=async e=>({...e,localDeviceId:e?.localDeviceId??await n.getLocalDeviceId()??""}),p=async e=>{let{device:o,scope:a,...d}=e,g=d.deviceId??(typeof o=="string"?o:o?.deviceId)??null,y=d.ticket??(typeof o=="string"?void 0:o?.ticket);g&&!y&&(y=(await s(g).catch(()=>null))?.ticket);let P={...d,scope:a??"session"};return g&&(P.deviceId=g),y&&(P.ticket=y),P},l={list:()=>n.listDevices(),startSession:(e={})=>n.startManagedSession({...e,platform:e.platform??i}),stopSession:e=>n.stopManagedSession(e),listWithStatus:()=>n.listDevicesWithStatus(),watch:e=>n.watchDevices(e),watchWithStatus:e=>n.watchDevicesWithStatus(e),connect:async(e,o)=>n.connectDevice(await s(e),await c(o)),connectWithRetry:async(e,o,a)=>n.connectDeviceWithRetry(await s(e),o,a),disconnect:e=>n.disconnectDevice(e),update:(e,o)=>n.updateDevice(e,o),delete:e=>n.deleteDevice(e),localId:()=>n.getLocalDeviceId(),localInfo:()=>n.getLocalDeviceInfo(),localProfile:e=>n.getLocalDeviceProfile(e),updateLocalName:e=>n.updateLocalDeviceName(e)},u={watch:e=>n.watchPeerStates(e),watchLifecycle:e=>n.watchPeerLifecycle(e),get:e=>n.getPeerState(e),listConnected:()=>n.listConnectedPeers(),connect:e=>n.connectPeer(e),disconnect:(e,o)=>n.disconnectPeer(e,o),forceDisconnect:e=>n.forceDisconnectPeer(e),session:e=>n.getPeerSession(e),sessions:()=>n.listPeerSessions(),waitConnected:(e,o)=>n.waitForConnectedPeer(e,o),readiness:(e,o)=>n.getPeerReadiness(e,o),health:e=>n.getPeerHealth(e),identity:e=>n.resolvePeerIdentity(e),addScope:(e,o)=>n.addPeerScope(e,o),releaseScope:(e,o)=>n.releasePeerScope(e,o),scopes:e=>n.getPeerScopes(e),refresh:()=>n.refreshPeerSnapshot()},m={register:e=>n.registerChannel(e),unregister:e=>n.unregisterChannel(e),list:()=>n.listChannels(),openBi:(e,o,a)=>n.openPeerBi(e,{...a,channelId:o}),openUni:(e,o,a)=>n.openPeerUni(e,{...a,channelId:o}),onIncoming:e=>n.onIncomingStream(e),onIncomingChannel:(e,o)=>n.onIncomingChannelStream(e,a=>{if(a.channel)return o(a)}),connect:async e=>n.connectScopedChannel(await p(e)),connectScoped:e=>n.connectScopedChannel(e)},R={create:e=>n.createRoom(e),join:(e,o)=>n.joinRoom(e,o),leave:e=>n.leaveRoom(e),watch:(e,o)=>n.watchRoom(e,o),members:e=>n.getRoomMembers(e)},C={raw:()=>n.getInvite(),share:e=>n.getTicketWithToken("share",e?.maxConnections??1),grant:(e,o)=>n.getTicketWithToken(e,o?.maxConnections??0),revoke:e=>n.revokeTokensByScope(e)},A={status:()=>n.getRuntimeStatus(),policy:()=>n.getRuntimePolicy(),capabilities:()=>n.getRuntimeCapabilities(),capabilityProfile:()=>n.getCapabilityProfile(),connectionStates:()=>n.getConnectionStates(),onConnectionStateChange:e=>n.onConnectionStateChange(e),connections:()=>n.getConnections(),applicationReadyConnections:e=>n.getApplicationReadyConnections(e),onConnection:e=>n.onConnection(e),onDisconnection:e=>n.onDisconnection(e),onConnectionEvent:e=>n.onConnectionEvent(e),forceReconnectSnapshot:()=>n.forceReconnectSnapshot(),peerReconciliation:()=>n.getPeerReconciliationStats()},x={runtime:n,assembly:t,nodeId:()=>n.getNodeId(),nodeIdFromTicket:e=>n.getNodeIdFromTicket(e),endpointTicket:()=>n.getEndpointTicket(),connectRaw:e=>n.connectRaw(e),openBi:e=>n.openBi(e),openUni:e=>n.openUni(e),isConnected:e=>n.isConnected(e),disconnectNode:e=>n.disconnectNode(e),setAutoConnectExcluded:(e,o)=>n.setAutoConnectExcluded(e,o)};return Object.defineProperties(r,{devices:{get:()=>l,enumerable:true},peers:{get:()=>u,enumerable:true},channels:{get:()=>m,enumerable:true},rooms:{get:()=>R,enumerable:true},tickets:{get:()=>C,enumerable:true},diagnostics:{get:()=>A,enumerable:true},advanced:{get:()=>x,enumerable:true},setAuth:{value:e=>t.setAuthContext(e),enumerable:true,writable:true,configurable:true},setAuthContext:{value:e=>t.setAuthContext(e),enumerable:true,writable:true,configurable:true},syncPlutoAuth:{value:e=>t.syncPlutoAuth(e),enumerable:true,writable:true,configurable:true},bindPlutoAuthHost:{value:()=>t.bindPlutoAuthHost(),enumerable:true,writable:true,configurable:true},signIn:{value:()=>t.signInWithPluto(),enumerable:true,writable:true,configurable:true},signOut:{value:()=>t.signOut(),enumerable:true,writable:true,configurable:true},runtime:{get:()=>n,enumerable:false},_assembly:{get:()=>t,enumerable:false}}),r}function I(t){let i=O(t),n=z(i);return T(n,"web")}I.native=function(t,i){let n=O(t),r=i??g(),s=A(n,r);return T(s,"native")};var ie="https://api.openrtc.app";async function re(t,i,n){let r=t.replace(/\/$/,""),s=await fetch(`${r}/v1/spaces/${encodeURIComponent(n)}/scoped-auth`,{method:"POST",headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json"},body:"{}"}),c=await s.json().catch(()=>({}));if(!s.ok){let p=typeof c?.error=="string"?c.error:`enableSpaceAuth failed (${s.status})`;throw new Error(p)}return c}async function se(t,i,n){let r=await fetch(t,{method:"POST",headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json"},body:JSON.stringify(n)}),s=await r.json().catch(()=>({}));if(!r.ok){let c=typeof s?.error=="string"?s.error:`mintSpaceToken failed (${r.status})`;throw new Error(c)}if(typeof s?.token!="string"||!s.token.trim())throw new Error("mintSpaceToken response missing token");return s}function S(t){let i=t.apiKey.trim(),n=(t.spaceKey??t.space??"").trim(),r=k(t.sandboxAppId),s=(t.endpointUrl??ie).replace(/\/$/,""),c=t.memberIdStorageKey??`openrtc:space-member:${n}${r?`:sandbox:${r}`:""}`;return async()=>{if(!i||!n)throw new Error("spaceToken requires apiKey and space");let p=null;typeof sessionStorage<"u"?(p=sessionStorage.getItem(c),p||(p=globalThis.crypto?.randomUUID?.()??`member-${Date.now()}`,sessionStorage.setItem(c,p))):p=`member-${Date.now()}`;let l=await fetch(`${s}/v1SpacePublicTokens`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:i,spaceKey:n,memberId:p,...r?{sandboxAppId:r}:{}})}),{text:u,payload:m}=await ce(l);if(!l.ok){let C=typeof m?.error=="string"?m.error:u.trim()?u.trim().slice(0,240):`public space token mint failed (${l.status})`;throw new Error(C)}let R=typeof m?.token=="string"?m.token.trim():"";if(!R)throw new Error("public space token response missing token");return {customToken:R}}}function ae(t){if(!t.trim())return {};try{let i=JSON.parse(t);return i&&typeof i=="object"?i:{}}catch{return {}}}async function ce(t){let i=t.text;if(typeof i=="function"){let r=await i.call(t).catch(()=>"");return {text:r,payload:ae(r)}}let n=await t.json().catch(()=>({}));return {text:JSON.stringify(n),payload:n&&typeof n=="object"?n:{}}}function k(t){let i=t?.trim().toLowerCase()??"";if(!i)return "";if(!/^[a-z0-9][a-z0-9-]{0,47}$/.test(i))throw new Error("sandboxAppId must be 1-48 lowercase letters, numbers, or dashes.");return i}function pe(t,i){let n=t.trim(),r=k(i);return r?`${n}::sandbox::${r}`:n}var me=S,le=S;
|
|
2
|
+
export{I as OpenRTC,S as createPublicSpaceTokenProvider,le as createSpaceTokenProvider,re as enableSpaceAuth,se as mintSpaceToken,pe as sandboxSpaceKey,me as spaceToken};
|
package/dist/openrtc_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DelegatingRuntimeAdapter, W as WasmBridgeOptions } from '../DelegatingRuntimeAdapter-
|
|
2
|
-
import '../types-
|
|
1
|
+
import { D as DelegatingRuntimeAdapter, W as WasmBridgeOptions } from '../DelegatingRuntimeAdapter-BxOcVIx_.js';
|
|
2
|
+
import '../types-D0fRvUbN.js';
|
|
3
3
|
|
|
4
4
|
declare class WasmRuntimeAdapter extends DelegatingRuntimeAdapter {
|
|
5
5
|
constructor(options: WasmBridgeOptions);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as WasmRuntimeAdapter}from'../chunk-
|
|
1
|
+
export{a as WasmRuntimeAdapter}from'../chunk-IUHUYHNZ.js';import'../chunk-WNJE3MJF.js';import'../chunk-FQETZQPW.js';import'../chunk-BLOEZIFJ.js';
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { C as Connection, P as PeerReconciliationStats,
|
|
2
|
-
export {
|
|
3
|
-
import {
|
|
1
|
+
import { C as Connection, P as PeerReconciliationStats, Q as RuntimeConnectionTarget, y as RuntimeRawConnection } from '../framing-lxzHEuSr.js';
|
|
2
|
+
export { z as ChannelDescriptor, A as ConnectionEvent, B as ConnectionTarget, D as DeviceProfile, E as IncomingStream, O as OPENRTC_RUNTIME_POLICY, F as PeerConnectOptions, G as PeerReadiness, H as PeerStreamOptions, x as PlutoRuntimeAssembly, J as PresenceLoopOptions, K as RawConnection, v as RuntimeApplicationPayloadReadinessOptions, L as RuntimeAuthContext, M as RuntimeAuthIdentity, N as RuntimeAutoConnectPolicy, m as RuntimeChannelDescriptor, a as RuntimeClient, R as RuntimeClientOptions, w as RuntimeConnectionEvent, u as RuntimeConnectionStateSnapshot, d as RuntimeDevice, aj as RuntimeDeviceActiveOptions, f as RuntimeDeviceConnectOptions, S as RuntimeDevicePresenceStatus, T as RuntimeDeviceStatus, e as RuntimeDeviceStatusSnapshot, ak as RuntimeFactoryOptions, o as RuntimeIncomingStream, r as RuntimeJoinRoomOptions, al as RuntimeJsonFrameDecoderOptions, U as RuntimeJsonFrameHandler, g as RuntimeLocalDeviceInfo, h as RuntimeLocalDeviceProfile, V as RuntimeLogicalChannelFraming, c as RuntimeManagedSession, W as RuntimeManagedSessionKind, b as RuntimeManagedSessionOptions, X as RuntimeManagedSessionPlatform, j as RuntimePeerConnectOptions, l as RuntimePeerHealth, Y as RuntimePeerLifecycleStatus, k as RuntimePeerReadinessSnapshot, Z as RuntimePeerScope, _ as RuntimePeerSessionSnapshot, i as RuntimePeerState, n as RuntimePeerStreamOptions, t as RuntimePolicySnapshot, $ as RuntimePresenceLoopOptions, a0 as RuntimePresencePolicy, s as RuntimeRoomMember, p as RuntimeScopedChannelOptions, q as RuntimeScopedLogicalChannel, a1 as RuntimeSession, a2 as RuntimeU32BEFrameHandler, a3 as RuntimeUiConnectionStatus, a4 as ScopedChannelOptions, am as ScopedConnectionActorError, an as ScopedConnectionActorErrorKind, ao as ScopedConnectionActorHandle, ap as ScopedConnectionActorHandleOptions, aq as ScopedConnectionActorRegistry, ar as ScopedConnectionActorState, as as ScopedConnectionClose, at as ScopedConnectionDial, au as ScopedConnectionKey, a5 as ScopedLogicalChannel, av as ScopedLogicalChannelHandle, aw as ScopedPreferredTransport, ax as Session, ay as SessionOptions, az as concatRuntimeBytes, aA as createIpcClient, a9 as createRuntimeJsonFrameDecoder, aa as createRuntimeU32BEFrameDecoder, aB as createWasmClient, ab as decodeRuntimeJsonPayload, ac as encodeRuntimeJsonFrame, ad as encodeRuntimeJsonPayload, ae as encodeRuntimeU32BEFrame, af as getRuntimePolicy, ag as isRuntimeDeviceActive, ah as isRuntimeDeviceConnectable, ai as isRuntimeDeviceRoutable, aC as readRuntimeU32BE, aD as scopedConnectionKey, aE as scopedConnectionKeyToString } from '../framing-lxzHEuSr.js';
|
|
3
|
+
import { K as SignalingOptions, I as ISignalingBackend, R as RuntimeIdentity, d as SignalingEnvelope, f as SignalingSession, a as Device, j as BackendConnectionState, t as AppLimits, O as JoinRoomOptions, Q as RoomMember, T as IncomingStreamChannelMetadata, r as ApplicationCryptoStreamTools, U as RoomCreationMode, C as ClientOptions, q as ApplicationPayloadCrypto, D as DiscoveryMode, p as ProtocolCapabilityMap, V as ScanningLoopOptions, W as ScanningLoopHandle, l as ConnectDeviceHooks, m as ConnectDeviceOptions, k as ConnectDeviceResult, X as RuntimeBootstrapOptions, Y as RuntimeBootstrapResult, v as ApplicationPayloadReadinessOptions, Z as PeerState, _ as PeerScope, $ as PeerHealth, G as GrantScope, a0 as ChannelDescriptor, a1 as JoinRequest, i as NativeConnectResult } from '../types-D0fRvUbN.js';
|
|
4
4
|
import { FirebaseApp } from 'firebase/app';
|
|
5
|
-
import { R as RuntimeCapabilities } from '../DelegatingRuntimeAdapter-
|
|
6
|
-
export { B as BROWSER_WASM_RUNTIME_CAPABILITIES, N as NATIVE_IPC_RUNTIME_CAPABILITIES, b as RuntimeAdapterKind, a as RuntimeCapabilityProfile,
|
|
7
|
-
export { I as IpcRuntimeAdapter, a as IpcRuntimeAdapterOptions, P as NativeBridge, P as PlutoIpcBridge,
|
|
5
|
+
import { R as RuntimeCapabilities } from '../DelegatingRuntimeAdapter-BxOcVIx_.js';
|
|
6
|
+
export { B as BROWSER_WASM_RUNTIME_CAPABILITIES, N as NATIVE_IPC_RUNTIME_CAPABILITIES, c as NativeRuntimeStatusSnapshot, d as NativeRuntimeTransportFeatureStatus, b as RuntimeAdapterKind, a as RuntimeCapabilityProfile, e as cloneRuntimeCapabilities, r as runtimeCapabilitiesFromNativeStatus, f as runtimeCapabilityProfile } from '../DelegatingRuntimeAdapter-BxOcVIx_.js';
|
|
7
|
+
export { I as IpcRuntimeAdapter, a as IpcRuntimeAdapterOptions, P as NativeBridge, b as NativeIpcFailureKind, P as PlutoIpcBridge, c as PlutoIpcUnlisten, d as classifyNativeIpcFailure, i as isNativeIpcCommandUnavailable } from '../IpcRuntimeAdapter-U5AEH0jn.js';
|
|
8
8
|
export { WasmRuntimeAdapter } from './WasmRuntimeAdapter.js';
|
|
9
9
|
export { TauriRuntimeAdapter, TauriRuntimeAdapterOptions, createTauriIpcBridge } from './tauri.js';
|
|
10
10
|
|
|
@@ -320,9 +320,11 @@ declare class RoomManager {
|
|
|
320
320
|
private syncRtdbPresenceFromSignaling;
|
|
321
321
|
private usesDirectRoomBackend;
|
|
322
322
|
private get roomBackendTag();
|
|
323
|
+
private resolveRoomUserId;
|
|
323
324
|
private get appTag();
|
|
324
325
|
private invokeRoomCallable;
|
|
325
326
|
private isAlreadyExistsError;
|
|
327
|
+
private normalizeRoomId;
|
|
326
328
|
private getMembersInternal;
|
|
327
329
|
private parseMemberDocuments;
|
|
328
330
|
private parseRoomMemberDocument;
|
|
@@ -376,6 +378,7 @@ declare class Client {
|
|
|
376
378
|
set wasmClient(client: any);
|
|
377
379
|
get node(): any;
|
|
378
380
|
set node(node: any);
|
|
381
|
+
attachIncomingStreamSource(source: unknown, localNodeId: string): void;
|
|
379
382
|
getApplicationCrypto(connection?: Connection): ApplicationPayloadCrypto | undefined;
|
|
380
383
|
resolveApplicationCryptoForPeer(peerId?: string, connection?: Connection): ApplicationPayloadCrypto | undefined;
|
|
381
384
|
waitForApplicationCryptoForPeer(peerId?: string, timeoutMs?: number): Promise<ApplicationPayloadCrypto | undefined>;
|
|
@@ -427,6 +430,8 @@ declare class Client {
|
|
|
427
430
|
onMoQReady(cb: () => void): () => void;
|
|
428
431
|
onMoQFailed(cb: () => void): () => void;
|
|
429
432
|
onMoQObject(callback: (ns: string, name: string, obj: Uint8Array, meta: any) => void): () => void;
|
|
433
|
+
subscribeMoQPeer(connection: Connection): void;
|
|
434
|
+
subscribeMoQPeerNode(peerId: string, subscriptionKey?: string): void;
|
|
430
435
|
connect(ticket: string, timeoutMs?: number, expectedDeviceId?: string | null, channelId?: string, options?: {
|
|
431
436
|
admissionAlreadyPresented?: boolean;
|
|
432
437
|
approvedScope?: string | null;
|
|
@@ -492,7 +497,9 @@ declare class Client {
|
|
|
492
497
|
disconnectNode(nodeId: string): Promise<void>;
|
|
493
498
|
getLocalDeviceId(): Promise<string | null>;
|
|
494
499
|
acceptNativeMessage(connectionId: string | null, remoteNodeId: string | null, msg: any): Promise<boolean>;
|
|
495
|
-
startListening(
|
|
500
|
+
startListening(options?: {
|
|
501
|
+
startPresence?: boolean;
|
|
502
|
+
}): Promise<void>;
|
|
496
503
|
stopListening(): void;
|
|
497
504
|
forceReconnectSnapshot(): void;
|
|
498
505
|
wrapChannelWritable(writable: WritableStream<Uint8Array>, channelId: string, metadata?: Record<string, unknown> | null): WritableStream<Uint8Array>;
|
package/dist/runtime/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{y as RuntimeClient,h as RuntimeConnectionController,l as ScopedConnectionActorError,o as ScopedConnectionActorHandle,p as ScopedConnectionActorRegistry,k as clog,w as concatRuntimeBytes,j as correlationForDriveGrantScope,A as createIpcClient,v as createRuntimeJsonFrameDecoder,r as createRuntimeU32BEFrameDecoder,z as createWasmClient,t as decodeRuntimeJsonPayload,u as encodeRuntimeJsonFrame,s as encodeRuntimeJsonPayload,q as encodeRuntimeU32BEFrame,B as isRuntimeDeviceActive,D as isRuntimeDeviceConnectable,C as isRuntimeDeviceRoutable,x as readRuntimeU32BE,i as renderCorrelationFields,m as scopedConnectionKey,n as scopedConnectionKeyToString}from'../chunk-UPO23UMZ.js';export{a as WasmRuntimeAdapter}from'../chunk-IUHUYHNZ.js';export{b as TauriRuntimeAdapter,a as createTauriIpcBridge}from'../chunk-7DN33VUQ.js';export{h as IpcRuntimeAdapter,e as classifyNativeIpcFailure,f as isNativeIpcCommandUnavailable}from'../chunk-UBEE42VU.js';export{s as BROWSER_WASM_RUNTIME_CAPABILITIES,t as NATIVE_IPC_RUNTIME_CAPABILITIES,q as OPENRTC_RUNTIME_POLICY,u as cloneRuntimeCapabilities,r as getRuntimePolicy,i as logOpenRtcTeardownTrace,c as openRtcDebug,b as openRtcDebugEnabled,d as openRtcDebugInfo,e as openRtcDebugLog,v as runtimeCapabilitiesFromNativeStatus,w as runtimeCapabilityProfile}from'../chunk-WNJE3MJF.js';import'../chunk-FQETZQPW.js';import'../chunk-BLOEZIFJ.js';
|
package/dist/runtime/tauri.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { I as IpcRuntimeAdapter, N as NativeIpcBridgeOptions, P as PlutoIpcBridge } from '../IpcRuntimeAdapter-
|
|
2
|
-
import '../types-
|
|
3
|
-
import '../DelegatingRuntimeAdapter-
|
|
1
|
+
import { I as IpcRuntimeAdapter, N as NativeIpcBridgeOptions, P as PlutoIpcBridge } from '../IpcRuntimeAdapter-U5AEH0jn.js';
|
|
2
|
+
import '../types-D0fRvUbN.js';
|
|
3
|
+
import '../DelegatingRuntimeAdapter-BxOcVIx_.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @deprecated Native Tauri support now lives in the first-party `openrtc-tauri` package.
|
package/dist/runtime/tauri.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{b as TauriRuntimeAdapter,a as createTauriIpcBridge}from'../chunk-
|
|
1
|
+
export{b as TauriRuntimeAdapter,a as createTauriIpcBridge}from'../chunk-7DN33VUQ.js';import'../chunk-UBEE42VU.js';import'../chunk-WNJE3MJF.js';import'../chunk-FQETZQPW.js';import'../chunk-BLOEZIFJ.js';
|
package/dist/transport/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as TRANSPORT_LABELS,d as isDirectIrohTransportLabel,g as isIndependentTransportLabel,c as isIrohBaseTransportLabel,e as isOptionalTransportLabel,f as isWebRtcTransportLabel,b as normalizeTransportLabel}from'../chunk-
|
|
1
|
+
export{a as TRANSPORT_LABELS,d as isDirectIrohTransportLabel,g as isIndependentTransportLabel,c as isIrohBaseTransportLabel,e as isOptionalTransportLabel,f as isWebRtcTransportLabel,b as normalizeTransportLabel}from'../chunk-BLOEZIFJ.js';
|
|
@@ -53,6 +53,7 @@ type RoomCreationMode = 'client-open' | 'client-auth' | 'server-only';
|
|
|
53
53
|
type EndpointKind = 'device' | 'ephemeral';
|
|
54
54
|
type PeerLifecycleStatus = 'disconnected' | 'connecting' | 'connected' | 'failed' | 'closed';
|
|
55
55
|
type PeerHealth = 'unknown' | 'healthy' | 'suspect' | 'stale';
|
|
56
|
+
type DevicePresenceStatus = 'online' | 'idle' | 'offline';
|
|
56
57
|
type PeerLifecycleStage = 'discovered' | 'dialing' | 'base-connected' | 'admitted' | 'protocol-ready' | 'upgrading' | 'webrtc-ready' | 'degraded' | 'reconnecting' | 'closed';
|
|
57
58
|
type PeerBaseTransportState = 'unknown' | 'connecting' | 'connected' | 'degraded' | 'closed';
|
|
58
59
|
type PeerAdmissionState = 'unknown' | 'pending' | 'admitted' | 'rejected' | 'expired';
|
|
@@ -119,23 +120,30 @@ interface ClientOptions {
|
|
|
119
120
|
*/
|
|
120
121
|
apiKey?: string;
|
|
121
122
|
/**
|
|
122
|
-
* Discovery
|
|
123
|
-
* - 'space': Devices share a space and authenticate with scoped Firebase tokens.
|
|
124
|
-
* - 'user-scoped': Developer mints tokens for their users. Devices scoped per user.
|
|
123
|
+
* Discovery avenue for this runtime.
|
|
125
124
|
*
|
|
126
|
-
* Set
|
|
125
|
+
* Set this explicitly in new apps:
|
|
126
|
+
* - `space`: a small live shared namespace backed by scoped space tokens.
|
|
127
|
+
* - `user-scoped`: a signed-in user's durable owned-device roster.
|
|
128
|
+
*
|
|
129
|
+
* Rooms and ticket/share grants are separate layers. Do not use `space`
|
|
130
|
+
* as a generic account device list, and do not expect `user-scoped`
|
|
131
|
+
* discovery to show other users unless a room or explicit grant connects them.
|
|
127
132
|
*/
|
|
128
133
|
discoveryMode?: DiscoveryMode;
|
|
129
134
|
/**
|
|
130
|
-
* Shared space name for
|
|
131
|
-
*
|
|
135
|
+
* Shared space name for `space` discovery mode. Use this for lightweight
|
|
136
|
+
* lobbies, demos, cursors, and other live-only collaboration surfaces.
|
|
137
|
+
* This is the beginner-facing name for `spaceKey`; if both are set,
|
|
138
|
+
* `spaceKey` wins.
|
|
132
139
|
*/
|
|
133
140
|
space?: string;
|
|
134
141
|
/**
|
|
135
|
-
*
|
|
142
|
+
* Compatibility name for `space`. The SDK derives a namespace from
|
|
136
143
|
* apiKey + spaceKey, then authenticates with spaceTokenProvider.
|
|
137
144
|
*
|
|
138
|
-
*
|
|
145
|
+
* Prefer `space` in public app code. Only used when discoveryMode is
|
|
146
|
+
* `space`; ignored for user-scoped discovery.
|
|
139
147
|
*/
|
|
140
148
|
spaceKey?: string;
|
|
141
149
|
/**
|
|
@@ -202,7 +210,7 @@ interface ClientOptions {
|
|
|
202
210
|
/**
|
|
203
211
|
* Mints a namespace-scoped Firebase custom token for space discovery.
|
|
204
212
|
* Required when `discoveryMode` is `space` and `space`/`spaceKey` is set.
|
|
205
|
-
* Use `spaceToken` for browser demos.
|
|
213
|
+
* Use `spaceToken(...)` for browser demos and simple static sites.
|
|
206
214
|
*/
|
|
207
215
|
spaceTokenProvider?: SpaceTokenProvider;
|
|
208
216
|
}
|
|
@@ -211,6 +219,10 @@ interface Device {
|
|
|
211
219
|
deviceName: string;
|
|
212
220
|
online: boolean;
|
|
213
221
|
ticket: string;
|
|
222
|
+
presenceStatus?: DevicePresenceStatus;
|
|
223
|
+
presenceUpdatedAt?: number;
|
|
224
|
+
presenceExpiresAt?: number;
|
|
225
|
+
connectable?: boolean;
|
|
214
226
|
kind?: EndpointKind | string;
|
|
215
227
|
nodeId?: string;
|
|
216
228
|
platformType?: string;
|
|
@@ -438,6 +450,14 @@ interface ManagedDeviceConnectOptions {
|
|
|
438
450
|
onConnected?: (device: Device) => void | Promise<void>;
|
|
439
451
|
}
|
|
440
452
|
interface DeviceStatusSnapshot extends Device {
|
|
453
|
+
/**
|
|
454
|
+
* Presence/liveness for the roster entry. This is separate from
|
|
455
|
+
* `connectionStatus`, which describes the runtime route to the peer.
|
|
456
|
+
*/
|
|
457
|
+
presenceStatus: DevicePresenceStatus;
|
|
458
|
+
presenceUpdatedAt?: number;
|
|
459
|
+
presenceExpiresAt?: number;
|
|
460
|
+
connectable: boolean;
|
|
441
461
|
connectionStatus: PeerLifecycleStatus | 'online';
|
|
442
462
|
settledReady?: boolean;
|
|
443
463
|
readinessState?: string;
|
|
@@ -680,6 +700,7 @@ interface TransportContext {
|
|
|
680
700
|
priorities: ProtocolName[];
|
|
681
701
|
disableIrohFallback: boolean;
|
|
682
702
|
isMoQReady: () => boolean;
|
|
703
|
+
isMoQDataReady?: () => boolean;
|
|
683
704
|
runtimeFlow?: 'default' | 'ticket-only';
|
|
684
705
|
readerCloseStrategy?: 'cancel' | 'release-lock';
|
|
685
706
|
}
|
|
@@ -766,4 +787,4 @@ interface JoinRequest {
|
|
|
766
787
|
state: 'pending' | 'accepted' | 'rejected';
|
|
767
788
|
}
|
|
768
789
|
|
|
769
|
-
export type {
|
|
790
|
+
export type { PeerHealth as $, AuthMode as A, BackendPeerBiStream as B, ClientOptions as C, DiscoveryMode as D, ExplicitFileDataSendParams as E, ProtocolImplementationKind as F, GrantScope as G, ProtocolLocality as H, ISignalingBackend as I, SpaceAuthMode as J, SignalingOptions as K, LocalDeviceInfo as L, ManagedConnectionRecord as M, NativeManagedSessionStartResult as N, JoinRoomOptions as O, PeerSessionSnapshot as P, RoomMember as Q, RuntimeIdentity as R, SignalingMode as S, IncomingStreamChannelMetadata as T, RoomCreationMode as U, ScanningLoopOptions as V, ScanningLoopHandle as W, RuntimeBootstrapOptions as X, RuntimeBootstrapResult as Y, PeerState as Z, PeerScope as _, Device as a, ChannelDescriptor as a0, JoinRequest as a1, ConnectionOptions as a2, ManagedDeviceConnectOptions as a3, PeerLifecycleStatus as a4, DeviceStatusSnapshot as b, ResolvedPeerIdentity as c, SignalingEnvelope as d, DeviceEvent as e, SignalingSession as f, SessionEvent as g, BackendPeerUniStream as h, NativeConnectResult as i, BackendConnectionState as j, ConnectDeviceResult as k, ConnectDeviceHooks as l, ConnectDeviceOptions as m, ProtocolName as n, ProtocolCapability as o, ProtocolCapabilityMap as p, ApplicationPayloadCrypto as q, ApplicationCryptoStreamTools as r, SpaceTokenProvider as s, AppLimits as t, ApplicationCryptoBiStream as u, ApplicationPayloadReadinessOptions as v, ApplicationPayloadRouteOptions as w, ApplicationPayloadSendOptions as x, DevicePresenceStatus as y, ProtocolBaseName as z };
|
package/env/index.d.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/** Type declarations for the `openrtc/env` subpath (see index.mjs). */
|
|
2
|
+
|
|
3
|
+
export interface EmulatorStack {
|
|
4
|
+
readonly projectId: string;
|
|
5
|
+
readonly functions: number;
|
|
6
|
+
readonly firestore: number;
|
|
7
|
+
readonly auth: number;
|
|
8
|
+
readonly ui: number;
|
|
9
|
+
readonly hub: number;
|
|
10
|
+
readonly logging: number;
|
|
11
|
+
readonly eventarc: number;
|
|
12
|
+
readonly tasks: number;
|
|
13
|
+
readonly database?: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export declare const EMULATOR_STACKS: {
|
|
17
|
+
readonly identity: EmulatorStack;
|
|
18
|
+
readonly signaling: EmulatorStack;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export declare const SEEDED_INTEGRATION_IDENTITY: {
|
|
22
|
+
readonly appTag: string;
|
|
23
|
+
readonly secretKey: string;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export type EmulatorStackName = 'signaling' | 'identity';
|
|
27
|
+
|
|
28
|
+
export declare function emulatorEnv(stack?: EmulatorStackName): Readonly<Record<string, string>>;
|
|
29
|
+
|
|
30
|
+
export declare function emulatorFunctionsUrls(): {
|
|
31
|
+
readonly signaling: string;
|
|
32
|
+
readonly identity: string;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type OpenRtcEnvTier = 'local' | 'dev' | 'staging' | 'prod';
|
|
36
|
+
|
|
37
|
+
export interface ResolvedOpenRtcEnv {
|
|
38
|
+
readonly tier: OpenRtcEnvTier;
|
|
39
|
+
readonly emulated: boolean;
|
|
40
|
+
readonly env: Readonly<Record<string, string>>;
|
|
41
|
+
readonly functionsUrls: { readonly signaling: string; readonly identity: string };
|
|
42
|
+
readonly seededIdentity: { readonly appTag: string; readonly secretKey: string } | null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export declare function resolveOpenRtcEnv(tier?: OpenRtcEnvTier): ResolvedOpenRtcEnv;
|
|
46
|
+
|
|
47
|
+
export declare function allEmulatorPorts(): readonly number[];
|
|
48
|
+
|
|
49
|
+
export interface SeedEmulatorOptions {
|
|
50
|
+
readonly reset?: boolean;
|
|
51
|
+
readonly seedScript?: string;
|
|
52
|
+
readonly nodePath?: string;
|
|
53
|
+
readonly cwd?: string;
|
|
54
|
+
readonly env?: Readonly<Record<string, string>>;
|
|
55
|
+
readonly stdio?: 'inherit' | 'ignore' | 'pipe';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface SeedEmulatorResult {
|
|
59
|
+
readonly appTag: string;
|
|
60
|
+
readonly firestoreHost: string;
|
|
61
|
+
readonly seedScript: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export declare function seedEmulator(options?: SeedEmulatorOptions): Promise<SeedEmulatorResult>;
|