openrtc 2.0.0-rc.2 → 2.0.0-rc.4

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.
Files changed (37) hide show
  1. package/dist/DelegatingRuntimeAdapter-BLNigcS4.d.ts +134 -0
  2. package/dist/{OpenRTCShared-ZQPu5LqL.d.ts → OpenRTCShared-BswnbjpG.d.ts} +3 -4
  3. package/dist/chunk-6OLYXEOG.js +1 -0
  4. package/dist/chunk-GHGHBGHY.js +1 -0
  5. package/dist/chunk-HXMHYSZF.js +1 -0
  6. package/dist/{chunk-IEQTFQ3Q.js → chunk-PRBVSCKN.js} +1 -1
  7. package/dist/{chunk-3USHQ7QW.js → chunk-XPEDISSU.js} +3 -3
  8. package/dist/factories-PLRICK7J.js +1 -0
  9. package/dist/index.d.ts +5 -5
  10. package/dist/index.js +1 -1
  11. package/dist/ipcFactory-MYHIVIM2.js +1 -0
  12. package/dist/native.d.ts +5 -5
  13. package/dist/native.js +1 -1
  14. package/dist/openrtc-UU4BBJLG.js +2 -0
  15. package/dist/openrtc_bg.wasm +0 -0
  16. package/dist/runtime/WasmRuntimeAdapter.d.ts +3 -3
  17. package/dist/runtime/WasmRuntimeAdapter.js +1 -1
  18. package/dist/runtime/device-status.d.ts +2 -2
  19. package/dist/runtime/index.d.ts +10 -25
  20. package/dist/runtime/index.js +1 -1
  21. package/dist/runtime/legacy.d.ts +3 -3
  22. package/dist/runtime/legacy.js +1 -1
  23. package/dist/runtime/tauri.d.ts +4 -4
  24. package/dist/{tauri-Cz9n17g8.d.ts → tauri-BgLgJoQA.d.ts} +2 -2
  25. package/dist/testing.d.ts +4 -4
  26. package/dist/testing.js +1 -1
  27. package/dist/transport/index.d.ts +2 -2
  28. package/dist/{types-BVJr065k.d.ts → types-BHePJWbM.d.ts} +1 -1
  29. package/dist/{types-DkgaCyqS.d.ts → types-D0pqNSOf.d.ts} +1 -1
  30. package/dist/{types-DNl4KHHY.d.ts → types-DzJ8-t1p.d.ts} +2 -2
  31. package/package.json +1 -1
  32. package/dist/DelegatingRuntimeAdapter-DqfHkjLy.d.ts +0 -373
  33. package/dist/chunk-6TAVJ46R.js +0 -1
  34. package/dist/chunk-GW7P3D54.js +0 -1
  35. package/dist/chunk-YQWQDTQ3.js +0 -2
  36. package/dist/factories-SIVMTIHJ.js +0 -1
  37. package/dist/ipcFactory-QY44OIKA.js +0 -1
@@ -0,0 +1,134 @@
1
+ import { D as DiscoveryMode, A as AuthMode, S as SignalingMode, C as ClientOptions, E as ExplicitFileDataSendParams, I as ISignalingBackend, R as RuntimeIdentity, a as RoomMember, b as Device, c as DeviceStatusSnapshot, P as PeerSessionSnapshot, d as ResolvedPeerIdentity, M as ManagedConnectionRecord, e as SignalingEnvelope, f as DeviceEvent, g as DesiredPeerProjection, h as SignalingSession, i as SessionEvent, L as LocalDeviceInfo, N as NativeManagedSessionStartResult, G as GrantScope, B as BackendPeerBiStream, j as BackendPeerUniStream, k as NativeConnectParams, l as NativeConnectResult, m as BackendConnectionState } from './types-BHePJWbM.js';
2
+ import { A as AuthContext } from './IEngineBridge-BbsT8hof.js';
3
+ import { R as RuntimeCapabilities } from './capabilities-YSskrE8H.js';
4
+
5
+ interface WasmBridgeOptions {
6
+ apiKey?: string;
7
+ discoveryMode?: DiscoveryMode;
8
+ space?: string;
9
+ spaceKey?: string;
10
+ authMode?: AuthMode;
11
+ signalingMode?: SignalingMode;
12
+ projectId?: string;
13
+ coordinationGateway?: ClientOptions['coordinationGateway'];
14
+ coordinationAvenueOverride?: ClientOptions['coordinationAvenueOverride'];
15
+ platformAttestationTokenProvider?: ClientOptions['platformAttestationTokenProvider'];
16
+ /** Internal host hint used by the provider-neutral gateway projection. */
17
+ coordinationPlatformType?: 'web' | 'desktop' | 'mobile';
18
+ storagePrefix?: string;
19
+ deviceIdPersistence?: 'persistent' | 'ephemeral';
20
+ endpointIdPersistence?: 'persistent' | 'ephemeral';
21
+ nodeIdPersistence?: 'persistent' | 'ephemeral';
22
+ localDeviceId?: string;
23
+ deviceName?: string;
24
+ turnCredentialsProvider?: () => Promise<{
25
+ iceServers?: RTCIceServer[];
26
+ } | null | undefined>;
27
+ applicationCrypto?: ExplicitFileDataSendParams['applicationCrypto'];
28
+ spaceAuth?: 'scoped-token';
29
+ }
30
+
31
+ declare abstract class DelegatingRuntimeAdapter implements ISignalingBackend {
32
+ protected readonly backend: ISignalingBackend;
33
+ protected constructor(backend: ISignalingBackend);
34
+ get currentUser(): RuntimeIdentity | null;
35
+ setAuthContext(context: AuthContext | null): Promise<void> | void;
36
+ signInAnonymously(): Promise<void>;
37
+ signInWithPluto(): Promise<void>;
38
+ signOut(): Promise<void>;
39
+ stopAuthScopedActivity(): Promise<void>;
40
+ usesCoordinationGateway(): boolean;
41
+ joinCoordinationRoom(roomId: string, nodeId: string, ticket: string): Promise<void>;
42
+ leaveCoordinationRoom(roomId: string): Promise<void>;
43
+ getCoordinationRoomMembers(roomId: string): Promise<RoomMember[]>;
44
+ watchCoordinationRoomMembers(roomId: string, callback: (members: RoomMember[]) => void): () => void;
45
+ getTurnCredentials(): Promise<any>;
46
+ updatePresence(localNodeId: string, ticketStr: string, isOnline: boolean, ttlMs: number, metadata?: string): Promise<void>;
47
+ refreshLivePresence(localNodeId: string, ticketStr: string, metadata?: string): Promise<void>;
48
+ setOffline(localNodeId: string): Promise<void>;
49
+ cleanupStaleDevices(): Promise<void>;
50
+ searchDevices(excludeNodeId?: string): Promise<Device[]>;
51
+ listDevicesWithStatus(): Promise<DeviceStatusSnapshot[]>;
52
+ getPeerSession(id: string): Promise<PeerSessionSnapshot | null>;
53
+ listPeerSessions(): Promise<PeerSessionSnapshot[]>;
54
+ waitForSettledPeer(id: string, timeoutMs?: number): Promise<PeerSessionSnapshot | null>;
55
+ resolvePeerIdentity(id: string): Promise<ResolvedPeerIdentity>;
56
+ resolvePeerConnectionRecords(id: string): Promise<ManagedConnectionRecord[]>;
57
+ updateDevice(deviceId: string, updates: {
58
+ deviceName?: string;
59
+ capabilities?: Device['capabilities'];
60
+ metadata?: string;
61
+ }): Promise<void>;
62
+ deleteDevice(deviceId: string): Promise<void>;
63
+ onDevicesChange(callback: (devices: Device[]) => void, excludeNodeId?: string): () => void;
64
+ onAuthChange(callback: (user: RuntimeIdentity | null) => void): () => void;
65
+ checkForSSOToken(): Promise<void>;
66
+ waitForAuth(): Promise<void>;
67
+ sendMessage(targetId: string, payload: string, state?: string, replyPayload?: string): Promise<string>;
68
+ pollMessages(targetId: string): Promise<SignalingEnvelope[]>;
69
+ watchFriendDevices(friendUserIds: string[], callback: (friendDevices: Map<string, Device[]>) => void): () => void;
70
+ updateFriendTicket(friendTicket: string | null): Promise<void>;
71
+ subscribeDevices(userId: string): Promise<ReadableStream<DeviceEvent[]>>;
72
+ startAutoConnect(userId: string, localDeviceId: string): void;
73
+ submitDesiredPeerProjection(revision: number, peers: DesiredPeerProjection[]): Promise<void>;
74
+ startPresenceLoop(userId: string, localNodeId: string, deviceName: string, ticket: string, metadata?: string): void;
75
+ createSession(session: SignalingSession): Promise<void>;
76
+ updateSession(sessionId: string, updateData: any): Promise<void>;
77
+ subscribeSessions(localDeviceId: string): Promise<ReadableStream<SessionEvent[]>>;
78
+ forceReconnectSnapshot(): void;
79
+ getLocalDeviceId(): Promise<string | null>;
80
+ getLocalDeviceInfo(): Promise<LocalDeviceInfo | null>;
81
+ updateLocalDeviceName(deviceName: string): Promise<LocalDeviceInfo | null>;
82
+ startManagedSessionNative(options: {
83
+ userId: string;
84
+ deviceName?: string;
85
+ localDeviceId?: string | null;
86
+ metadata?: string;
87
+ autoConnect?: boolean;
88
+ presence?: boolean;
89
+ }): Promise<NativeManagedSessionStartResult>;
90
+ notifyNetworkChange(options?: {
91
+ reason?: string;
92
+ }): Promise<unknown>;
93
+ getManagedNodeId(options?: {
94
+ initializeIfMissing?: boolean;
95
+ }): Promise<string | null>;
96
+ startPresenceLoopOnce(userId: string, localNodeId: string, deviceName: string, ticket: string, metadata?: string): Promise<void>;
97
+ startAutoConnectOnce(userId: string, localDeviceId: string): Promise<void>;
98
+ getEndpointTicket(): Promise<string>;
99
+ getEndpointTicketWithToken(scope: GrantScope, maxConnections: number): Promise<string | null>;
100
+ registerSessionToken(token: string, scope: GrantScope, maxConnections: number): Promise<void>;
101
+ revokeSessionTokensByScope(scope: GrantScope): Promise<string[]>;
102
+ openPeerBi(id: string, timeoutMs?: number): Promise<BackendPeerBiStream>;
103
+ incoming_streams(): Promise<ReadableStream<unknown>>;
104
+ is_current_transport_stable_id(endpointId: string, transportStableId: bigint): Promise<boolean>;
105
+ openPeerNativeBi(id: string, label: string, timeoutMs?: number): Promise<BackendPeerBiStream>;
106
+ openPeerBiTransportOnly(id: string, timeoutMs?: number): Promise<BackendPeerBiStream>;
107
+ openPeerUni(id: string, timeoutMs?: number): Promise<BackendPeerUniStream>;
108
+ connectToDevice(params: NativeConnectParams): Promise<NativeConnectResult>;
109
+ disconnectDevice(deviceId: string): Promise<void>;
110
+ setAutoConnectExcluded(deviceId: string, excluded: boolean): Promise<void>;
111
+ isConnected(nodeId: string): Promise<boolean>;
112
+ getConnectionStates(): Promise<BackendConnectionState[]>;
113
+ onConnectionStateChange(callback: (state: BackendConnectionState) => void): Promise<() => void> | (() => void);
114
+ /** @deprecated Use named channels or `openrtc-file-transfer`. */
115
+ sendExplicitFilePath(connectionId: string, filePath: string, transferId?: string): Promise<string>;
116
+ /** @deprecated Use named channels or `openrtc-file-transfer`. */
117
+ sendExplicitFileData(params: ExplicitFileDataSendParams): Promise<void>;
118
+ /** @deprecated Transfer history belongs to the consumer application. */
119
+ getTransferHistory(limit?: number): Promise<Array<[string, unknown]>>;
120
+ /** @deprecated Transfer history belongs to the consumer application. */
121
+ deleteTransferJob(jobId: string): Promise<void>;
122
+ getRuntimeCapabilities(): RuntimeCapabilities;
123
+ onIncomingNativeMessage(callback: (connectionId: string, remoteNodeId: string | null, message: any) => void): Promise<() => void>;
124
+ unwrap(): ISignalingBackend;
125
+ /**
126
+ * Forward setCoreClient() to the inner backend if it implements it. This
127
+ * lets the core Client inject a reference into backends (e.g. WasmBridge)
128
+ * that need to escalate transport-level dials into full Client.connect()
129
+ * handshakes.
130
+ */
131
+ setCoreClient(client: unknown): void;
132
+ }
133
+
134
+ export { DelegatingRuntimeAdapter as D, type WasmBridgeOptions as W };
@@ -1,6 +1,6 @@
1
- import { H as GrantScope, q as ISignalingBackend, Y as ConnectDeviceHooks, Z as ConnectDeviceOptions, _ as ConnectDeviceResult, u as ManagedConnectionRecord, m as PeerSessionSnapshot, v as ResolvedPeerIdentity, $ as AppLimits, N as NativeConnectParams, z as NativeConnectResult, E as ExplicitFileDataSendParams } from './types-BVJr065k.js';
1
+ import { G as GrantScope, I as ISignalingBackend, X as ConnectDeviceHooks, Y as ConnectDeviceOptions, Z as ConnectDeviceResult, M as ManagedConnectionRecord, P as PeerSessionSnapshot, d as ResolvedPeerIdentity, _ as AppLimits, k as NativeConnectParams, l as NativeConnectResult, E as ExplicitFileDataSendParams } from './types-BHePJWbM.js';
2
2
  import { A as AuthContext } from './IEngineBridge-BbsT8hof.js';
3
- import { b as RuntimePeerState, c as RuntimeConnectionStateSnapshot, d as RuntimePeerReadinessSnapshot, e as RuntimePeerConnectOptions, C as Connection, f as RuntimeIncomingStream, a as RuntimeClientOptions, g as RuntimeAuthIdentity, h as RuntimeLocalDeviceInfo, i as RuntimeLocalDeviceProfile, j as RuntimeDevice, k as RuntimeManagedSessionOptions, l as RuntimeManagedSession, m as RuntimeDeviceStatusSnapshot, n as RuntimeDeviceConnectOptions, o as RuntimeSession, p as RuntimeJoinRoomOptions, q as RuntimeRoomMember, r as RuntimeConnectionTarget, s as RuntimeScopedChannelOptions, t as RuntimeScopedLogicalChannel, u as RuntimePeerStreamOptions, v as RuntimeRawConnection, R as RuntimeChannelDescriptor, w as RuntimePresenceLoopOptions, x as RuntimePeerHealth, y as RuntimeApplicationPayloadReadinessOptions, z as RuntimeConnectionEvent } from './types-DkgaCyqS.js';
3
+ import { b as RuntimePeerState, c as RuntimeConnectionStateSnapshot, d as RuntimePeerReadinessSnapshot, e as RuntimePeerConnectOptions, C as Connection, f as RuntimeIncomingStream, a as RuntimeClientOptions, g as RuntimeAuthIdentity, h as RuntimeLocalDeviceInfo, i as RuntimeLocalDeviceProfile, j as RuntimeDevice, k as RuntimeManagedSessionOptions, l as RuntimeManagedSession, m as RuntimeDeviceStatusSnapshot, n as RuntimeDeviceConnectOptions, o as RuntimeSession, p as RuntimeJoinRoomOptions, q as RuntimeRoomMember, r as RuntimeConnectionTarget, s as RuntimeScopedChannelOptions, t as RuntimeScopedLogicalChannel, u as RuntimePeerStreamOptions, v as RuntimeRawConnection, R as RuntimeChannelDescriptor, w as RuntimePresenceLoopOptions, x as RuntimePeerHealth, y as RuntimeApplicationPayloadReadinessOptions, z as RuntimeConnectionEvent } from './types-D0pqNSOf.js';
4
4
  import { R as RuntimeCapabilities, a as RuntimeCapabilityProfile } from './capabilities-YSskrE8H.js';
5
5
 
6
6
  /**
@@ -675,7 +675,6 @@ declare class RuntimeClient {
675
675
  type RuntimeAdapterWithAuth = ISignalingBackend & {
676
676
  setAuthContext?: (context: AuthContext | null) => Promise<void> | void;
677
677
  };
678
- type RuntimeFactoryOptions = RuntimeClientOptions;
679
678
  interface PlutoRuntimeAssembly<TBackend extends RuntimeAdapterWithAuth = RuntimeAdapterWithAuth> {
680
679
  runtime: RuntimeClient;
681
680
  identity: any;
@@ -942,4 +941,4 @@ interface OpenRTCClient extends RuntimeClient {
942
941
  readonly _assembly: PlutoRuntimeAssembly;
943
942
  }
944
943
 
945
- export { DriveGrantActorError as D, type OpenRTCPeerNamespace as O, type PlutoRuntimeAssembly as P, type RuntimeFactoryOptions as R, type OpenRTCChannelNamespace as a, type OpenRTCDiagnosticsNamespace as b, type OpenRTCDeviceNamespace as c, type OpenRTCClient as d, type PeerReconciliationStats as e, OPENRTC_RUNTIME_POLICY as f, RuntimeClient as g, type RuntimePolicySnapshot as h, type DriveGrantActorErrorKind as i, DriveGrantActorHandle as j, type DriveGrantActorHandleOptions as k, DriveGrantActorRegistry as l, type DriveGrantActorState as m, type DriveGrantClose as n, type DriveGrantDial as o, type DriveGrantConnectionKey as p, type DriveGrantLogicalChannelHandle as q, type DriveGrantPreferredTransport as r, getRuntimePolicy as s, driveGrantConnectionKey as t, driveGrantConnectionKeyToString as u };
944
+ export { DriveGrantActorError as D, type OpenRTCPeerNamespace as O, type PeerReconciliationStats as P, RuntimeClient as R, type OpenRTCChannelNamespace as a, type OpenRTCDiagnosticsNamespace as b, type OpenRTCDeviceNamespace as c, type OpenRTCClient as d, OPENRTC_RUNTIME_POLICY as e, type RuntimePolicySnapshot as f, type DriveGrantActorErrorKind as g, DriveGrantActorHandle as h, type DriveGrantActorHandleOptions as i, DriveGrantActorRegistry as j, type DriveGrantActorState as k, type DriveGrantClose as l, type DriveGrantDial as m, type DriveGrantConnectionKey as n, type DriveGrantLogicalChannelHandle as o, type DriveGrantPreferredTransport as p, getRuntimePolicy as q, driveGrantConnectionKey as r, driveGrantConnectionKeyToString as s };
@@ -0,0 +1 @@
1
+ import {a as a$1}from'./chunk-GHGHBGHY.js';import {a as a$2}from'./chunk-XPEDISSU.js';import {f}from'./chunk-F2XGNLXL.js';import {c}from'./chunk-RD3JEGGF.js';var s=false;function a(){s||(s=true,a$2(async()=>{let t=await import('./openrtc-UU4BBJLG.js');return {initWasm:t.default,WasmClient:t.WasmClient,start:t.start}}));}async function d(t){a();let e=c(t),{WasmBridge:i}=await import('./WasmBridge-2A22U7RU.js');return a$1(e,new i(e))}function y(t,e){let i=c(t);return a$1(i,new f({...i,bridge:e}))}export{d as a,y as b};
@@ -0,0 +1 @@
1
+ import {t}from'./chunk-XPEDISSU.js';import {b}from'./chunk-N26S7V4N.js';function v(i,d){let t$1=new t(i,d),a=i.spaceKey??i.space,l=(i.discoveryMode===void 0||i.discoveryMode==="space")&&typeof i.apiKey=="string"&&i.apiKey.trim().length>0&&typeof a=="string"&&a.trim().length>0,s={runtime:t$1,async setAuthContext(e){await t$1.setAuthContext(e);},async syncPlutoAuth(e){if(l)return;let n=b(),c=n.getCurrentUser(),r=(typeof e?.userId=="string"?e.userId.trim():"")||c?.uid||null;if(!r){await s.setAuthContext(null);return}let h=await n.getIdToken({forceRefresh:e?.forceRefresh??false}).catch(()=>null),m=n.getCurrentUser()?.refreshToken??null,g=n.getCurrentUser()?.stsTokenManager?.expirationTime??null;await s.setAuthContext({userId:r,token:h,refreshToken:m,tokenProvider:async y=>n.getIdToken({forceRefresh:y??false}),expiresAtMs:g});},bindPlutoAuthHost(){let e=b();return s.syncPlutoAuth({userId:e.getCurrentUser()?.uid??null,forceRefresh:false}),e.onIdTokenChanged(n=>{s.syncPlutoAuth({userId:n?.uid??null,forceRefresh:false});})},signInWithPluto:()=>t$1.signInWithPluto(),signOut:()=>t$1.signOut(),stopManagedSession:()=>t$1.stopManagedSession(),startManagedSession:e=>t$1.startManagedSession(e),onAuthChange:e=>t$1.onIdentityChange(e),getManagedNodeId:e=>t$1.getManagedNodeId(e),getRuntimeStatus:()=>t$1.getRuntimeStatus(),listDevicesWithStatus:()=>t$1.listDevicesWithStatus(),watchDevicesWithStatus:e=>t$1.watchDevicesWithStatus(e),connectDevice:(e,n)=>t$1.connectDevice(e,n),setAutoConnectExcluded:(e,n)=>t$1.setAutoConnectExcluded(e,n)};return Object.defineProperty(s,"identity",{get:()=>t$1.identity,enumerable:true}),s}export{v as a};
@@ -0,0 +1 @@
1
+ import {a}from'./chunk-GHGHBGHY.js';import {f}from'./chunk-F2XGNLXL.js';import {c}from'./chunk-RD3JEGGF.js';function s(i,r){let t=c(i);return a(t,new f({...t,bridge:r}))}export{s as a};
@@ -1 +1 @@
1
- import {b as b$1,a as a$2}from'./chunk-2QHDEGVX.js';import {a as a$3}from'./chunk-6TAVJ46R.js';import {b}from'./chunk-N4SX7C3W.js';import {a as a$1}from'./chunk-YQWQDTQ3.js';import {d}from'./chunk-K37WVIZL.js';import {a}from'./chunk-N26S7V4N.js';async function c(t){return a(b),b$1(await a$1(a$2(t)),"web")}c.native=function(t,a$1=d()){return a(b),b$1(a$3(a$2(t),a$1),"native")};export{c as a};
1
+ import {b as b$1,a as a$2}from'./chunk-2QHDEGVX.js';import {a as a$1}from'./chunk-6OLYXEOG.js';import {a as a$3}from'./chunk-HXMHYSZF.js';import {b}from'./chunk-N4SX7C3W.js';import {d}from'./chunk-K37WVIZL.js';import {a}from'./chunk-N26S7V4N.js';async function c(t){return a(b),b$1(await a$1(a$2(t)),"web")}c.native=function(t,a$1=d()){return a(b),b$1(a$3(a$2(t),a$1),"native")};export{c as a};