openrtc 1.0.6 → 1.0.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openrtc",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -1,120 +0,0 @@
1
- import { D as DiscoveryMode, A as AuthMode, S as SignalingMode, E as ExplicitFileDataSendParams, I as ISignalingBackend, c as RuntimeIdentity, d as Device, e as DeviceStatusSnapshot, P as PeerSessionSnapshot, R as ResolvedPeerIdentity, M as ManagedConnectionRecord, f as SignalingEnvelope, g as DeviceEvent, 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-BCkKK8dy.js';
2
- import { A as AuthContext } from './IEngineBridge-C7OT2CRv.js';
3
- import { R as RuntimeCapabilities } from './capabilities-C4Dqs_pB.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
- storagePrefix?: string;
14
- deviceIdPersistence?: 'persistent' | 'ephemeral';
15
- endpointIdPersistence?: 'persistent' | 'ephemeral';
16
- nodeIdPersistence?: 'persistent' | 'ephemeral';
17
- localDeviceId?: string;
18
- deviceName?: string;
19
- turnCredentialsProvider?: () => Promise<{
20
- iceServers?: RTCIceServer[];
21
- } | null | undefined>;
22
- applicationCrypto?: ExplicitFileDataSendParams['applicationCrypto'];
23
- spaceAuth?: 'scoped-token';
24
- }
25
-
26
- declare abstract class DelegatingRuntimeAdapter implements ISignalingBackend {
27
- protected readonly backend: ISignalingBackend;
28
- protected constructor(backend: ISignalingBackend);
29
- get currentUser(): RuntimeIdentity | null;
30
- setAuthContext(context: AuthContext | null): Promise<void> | void;
31
- signInAnonymously(): Promise<void>;
32
- signInWithPluto(): Promise<void>;
33
- signOut(): Promise<void>;
34
- stopAuthScopedActivity(): Promise<void>;
35
- getTurnCredentials(): Promise<any>;
36
- updatePresence(localNodeId: string, ticketStr: string, isOnline: boolean, ttlMs: number, metadata?: string): Promise<void>;
37
- refreshLivePresence(localNodeId: string, ticketStr: string, metadata?: string): Promise<void>;
38
- setOffline(localNodeId: string): Promise<void>;
39
- cleanupStaleDevices(): Promise<void>;
40
- searchDevices(excludeNodeId?: string): Promise<Device[]>;
41
- listDevicesWithStatus(): Promise<DeviceStatusSnapshot[]>;
42
- getPeerSession(id: string): Promise<PeerSessionSnapshot | null>;
43
- listPeerSessions(): Promise<PeerSessionSnapshot[]>;
44
- waitForSettledPeer(id: string, timeoutMs?: number): Promise<PeerSessionSnapshot | null>;
45
- resolvePeerIdentity(id: string): Promise<ResolvedPeerIdentity>;
46
- resolvePeerConnectionRecords(id: string): Promise<ManagedConnectionRecord[]>;
47
- updateDevice(deviceId: string, updates: {
48
- deviceName?: string;
49
- capabilities?: Device['capabilities'];
50
- metadata?: string;
51
- }): Promise<void>;
52
- deleteDevice(deviceId: string): Promise<void>;
53
- onDevicesChange(callback: (devices: Device[]) => void, excludeNodeId?: string): () => void;
54
- onAuthChange(callback: (user: RuntimeIdentity | null) => void): () => void;
55
- checkForSSOToken(): Promise<void>;
56
- waitForAuth(): Promise<void>;
57
- sendMessage(targetId: string, payload: string, state?: string, replyPayload?: string): Promise<string>;
58
- pollMessages(targetId: string): Promise<SignalingEnvelope[]>;
59
- subscribeDevices(userId: string): Promise<ReadableStream<DeviceEvent[]>>;
60
- startAutoConnect(userId: string, localDeviceId: string): void;
61
- startPresenceLoop(userId: string, localNodeId: string, deviceName: string, ticket: string, metadata?: string): void;
62
- createSession(session: SignalingSession): Promise<void>;
63
- updateSession(sessionId: string, updateData: any): Promise<void>;
64
- subscribeSessions(localDeviceId: string): Promise<ReadableStream<SessionEvent[]>>;
65
- forceReconnectSnapshot(): void;
66
- getLocalDeviceId(): Promise<string | null>;
67
- getLocalDeviceInfo(): Promise<LocalDeviceInfo | null>;
68
- updateLocalDeviceName(deviceName: string): Promise<LocalDeviceInfo | null>;
69
- startManagedSessionNative(options: {
70
- userId: string;
71
- deviceName?: string;
72
- localDeviceId?: string | null;
73
- metadata?: string;
74
- autoConnect?: boolean;
75
- presence?: boolean;
76
- }): Promise<NativeManagedSessionStartResult>;
77
- notifyNetworkChange(options?: {
78
- reason?: string;
79
- }): Promise<unknown>;
80
- getManagedNodeId(options?: {
81
- initializeIfMissing?: boolean;
82
- }): Promise<string | null>;
83
- startPresenceLoopOnce(userId: string, localNodeId: string, deviceName: string, ticket: string, metadata?: string): Promise<void>;
84
- startAutoConnectOnce(userId: string, localDeviceId: string): Promise<void>;
85
- getEndpointTicket(): Promise<string>;
86
- getEndpointTicketWithToken(scope: GrantScope, maxConnections: number): Promise<string | null>;
87
- registerSessionToken(token: string, scope: GrantScope, maxConnections: number): Promise<void>;
88
- revokeSessionTokensByScope(scope: GrantScope): Promise<string[]>;
89
- openPeerBi(id: string, timeoutMs?: number): Promise<BackendPeerBiStream>;
90
- incoming_streams(): Promise<ReadableStream<unknown>>;
91
- is_current_transport_stable_id(endpointId: string, transportStableId: bigint): Promise<boolean>;
92
- openPeerNativeBi(id: string, label: string, timeoutMs?: number): Promise<BackendPeerBiStream>;
93
- openPeerBiTransportOnly(id: string, timeoutMs?: number): Promise<BackendPeerBiStream>;
94
- openPeerUni(id: string, timeoutMs?: number): Promise<BackendPeerUniStream>;
95
- connectToDevice(params: NativeConnectParams): Promise<NativeConnectResult>;
96
- disconnectDevice(deviceId: string): Promise<void>;
97
- isConnected(nodeId: string): Promise<boolean>;
98
- getConnectionStates(): Promise<BackendConnectionState[]>;
99
- onConnectionStateChange(callback: (state: BackendConnectionState) => void): Promise<() => void> | (() => void);
100
- /** @deprecated Use named channels or `openrtc-file-transfer`. */
101
- sendExplicitFilePath(connectionId: string, filePath: string, transferId?: string): Promise<string>;
102
- /** @deprecated Use named channels or `openrtc-file-transfer`. */
103
- sendExplicitFileData(params: ExplicitFileDataSendParams): Promise<void>;
104
- /** @deprecated Transfer history belongs to the consumer application. */
105
- getTransferHistory(limit?: number): Promise<Array<[string, unknown]>>;
106
- /** @deprecated Transfer history belongs to the consumer application. */
107
- deleteTransferJob(jobId: string): Promise<void>;
108
- getRuntimeCapabilities(): RuntimeCapabilities;
109
- onIncomingNativeMessage(callback: (connectionId: string, remoteNodeId: string | null, message: any) => void): Promise<() => void>;
110
- unwrap(): ISignalingBackend;
111
- /**
112
- * Forward setCoreClient() to the inner backend if it implements it. This
113
- * lets the core Client inject a reference into backends (e.g. WasmBridge)
114
- * that need to escalate transport-level dials into full Client.connect()
115
- * handshakes.
116
- */
117
- setCoreClient(client: unknown): void;
118
- }
119
-
120
- export { DelegatingRuntimeAdapter as D, type WasmBridgeOptions as W };
@@ -1,249 +0,0 @@
1
- import { R as RuntimeClient, a as RuntimePolicySnapshot, P as PeerReconciliationStats, b as PlutoRuntimeAssembly } from './assembly-BH-ZekkH.js';
2
- import { C as ConnectDeviceResult, a as ConnectDeviceHooks, b as ConnectDeviceOptions, P as PeerSessionSnapshot, R as ResolvedPeerIdentity, G as GrantScope } from './types-BCkKK8dy.js';
3
- import { A as AuthContext } from './IEngineBridge-C7OT2CRv.js';
4
- import { a as RuntimeManagedSessionOptions, b as RuntimeManagedSession, c as RuntimeDevice, d as RuntimeDeviceStatusSnapshot, e as RuntimeDeviceConnectOptions, f as RuntimeLocalDeviceInfo, g as RuntimeLocalDeviceProfile, h as RuntimePeerState, i as RuntimePeerConnectOptions, C as Connection, j as RuntimePeerReadinessSnapshot, k as RuntimePeerHealth, l as RuntimeChannelDescriptor, m as RuntimePeerStreamOptions, n as RuntimeIncomingStream, o as RuntimeScopedChannelOptions, p as RuntimeScopedLogicalChannel, q as RuntimeJoinRoomOptions, r as RuntimeRoomMember, s as RuntimeConnectionStateSnapshot, t as RuntimeApplicationPayloadReadinessOptions, u as RuntimeConnectionEvent, v as RuntimeRawConnection } from './types-QMj23Nvm.js';
5
- import { R as RuntimeCapabilities, a as RuntimeCapabilityProfile } from './capabilities-C4Dqs_pB.js';
6
-
7
- type OpenRTCChannelConnectOptions = Omit<RuntimeScopedChannelOptions, 'scope' | 'deviceId' | 'ticket'> & {
8
- /**
9
- * Device selected from `client.devices.*`. Passing the device object lets
10
- * OpenRTC reuse its current ticket for native and ticket-gated routes.
11
- */
12
- device?: string | RuntimeDevice;
13
- deviceId?: string | null;
14
- ticket?: string;
15
- /**
16
- * Logical channel lifecycle scope. Most app channels should use the default
17
- * `session`; pass a custom scope only when you intentionally manage peer
18
- * lifecycle separately from the channel.
19
- */
20
- scope?: RuntimeScopedChannelOptions['scope'];
21
- };
22
- type OpenRTCDeviceSessionOptions = Omit<RuntimeManagedSessionOptions, 'platform'> & {
23
- /**
24
- * Runtime host for the managed user-device session. Normal apps can omit
25
- * this: `OpenRTC(...)` defaults to `web`, and `OpenRTC.native(...)` defaults
26
- * to `native`.
27
- */
28
- platform?: RuntimeManagedSessionOptions['platform'];
29
- };
30
- interface OpenRTCDeviceNamespace {
31
- startSession(options?: OpenRTCDeviceSessionOptions): Promise<RuntimeManagedSession>;
32
- stopSession(options?: {
33
- preserveBackendSession?: boolean;
34
- }): Promise<void>;
35
- list(): Promise<RuntimeDevice[]>;
36
- listWithStatus(): Promise<RuntimeDeviceStatusSnapshot[]>;
37
- watch(callback: (devices: RuntimeDevice[]) => void): () => void;
38
- watchWithStatus(callback: (devices: RuntimeDeviceStatusSnapshot[]) => void): () => void;
39
- connect(device: string | RuntimeDevice, options?: RuntimeDeviceConnectOptions): Promise<ConnectDeviceResult>;
40
- /**
41
- * @deprecated Use `devices.connect()`. Retry and route recovery are owned by
42
- * OpenRTC; legacy consumer-provided connection hooks are ignored.
43
- */
44
- connectWithRetry(device: string | RuntimeDevice, hooks: ConnectDeviceHooks, options: ConnectDeviceOptions): Promise<ConnectDeviceResult>;
45
- disconnect(deviceId: string): Promise<void>;
46
- update(deviceId: string, updates: {
47
- deviceName?: string;
48
- capabilities?: RuntimeDevice['capabilities'];
49
- metadata?: string;
50
- }): Promise<void>;
51
- delete(deviceId: string): Promise<void>;
52
- localId(): Promise<string | null>;
53
- localInfo(): Promise<RuntimeLocalDeviceInfo | null>;
54
- localProfile(options?: {
55
- deviceName?: string;
56
- localDeviceId?: string | null;
57
- platform?: 'native' | 'web';
58
- userId?: string | null;
59
- }): Promise<RuntimeLocalDeviceProfile>;
60
- updateLocalName(deviceName: string): Promise<RuntimeLocalDeviceInfo | null>;
61
- }
62
- interface OpenRTCPeerNamespace {
63
- watch(callback: (peers: RuntimePeerState[]) => void): () => void;
64
- watchLifecycle(callback: (peers: RuntimePeerState[]) => void): () => void;
65
- get(id: string): RuntimePeerState | undefined;
66
- listConnected(): RuntimePeerState[];
67
- connect(options: RuntimePeerConnectOptions): Promise<Connection>;
68
- disconnect(id: string, scope?: string): Promise<void>;
69
- forceDisconnect(id: string): Promise<void>;
70
- session(id: string): Promise<PeerSessionSnapshot | null>;
71
- sessions(): Promise<PeerSessionSnapshot[]>;
72
- waitConnected(id: string, timeoutMs?: number): Promise<PeerSessionSnapshot | null>;
73
- readiness(id: string, timeoutMs?: number): Promise<RuntimePeerReadinessSnapshot>;
74
- health(id: string): Promise<RuntimePeerHealth>;
75
- identity(id: string): Promise<ResolvedPeerIdentity>;
76
- addScope(id: string, scope?: string): RuntimePeerState | undefined;
77
- releaseScope(id: string, scope?: string): RuntimePeerState | undefined;
78
- scopes(id: string): string[];
79
- refresh(): Promise<RuntimePeerState[]>;
80
- }
81
- interface OpenRTCChannelNamespace {
82
- register(descriptor: RuntimeChannelDescriptor): void;
83
- unregister(channelId: string): void;
84
- list(): RuntimeChannelDescriptor[];
85
- openBi(id: string, channelId: string, options?: Omit<RuntimePeerStreamOptions, 'channelId'>): Promise<{
86
- connection: Connection;
87
- readable: ReadableStream<Uint8Array>;
88
- writable: WritableStream<Uint8Array>;
89
- }>;
90
- openUni(id: string, channelId: string, options?: Omit<RuntimePeerStreamOptions, 'channelId'>): Promise<{
91
- connection: Connection;
92
- writable: WritableStream<Uint8Array>;
93
- }>;
94
- onIncoming(callback: (stream: RuntimeIncomingStream) => boolean | void): () => void;
95
- onIncomingChannel(channelId: string, callback: (stream: RuntimeIncomingStream & {
96
- channel: NonNullable<RuntimeIncomingStream['channel']>;
97
- }) => boolean | void): () => void;
98
- connect(options: OpenRTCChannelConnectOptions): Promise<RuntimeScopedLogicalChannel>;
99
- connectScoped(options: RuntimeScopedChannelOptions): Promise<RuntimeScopedLogicalChannel>;
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
- }
118
- interface OpenRTCDiagnosticsNamespace {
119
- status(): Promise<{
120
- runtime: 'tauri' | 'browser' | 'unknown';
121
- wasmLoaded: boolean;
122
- localNodeId?: string;
123
- userId?: string;
124
- }>;
125
- policy(): RuntimePolicySnapshot;
126
- capabilities(): RuntimeCapabilities;
127
- capabilityProfile(): RuntimeCapabilityProfile;
128
- connectionStates(): Promise<RuntimeConnectionStateSnapshot[]>;
129
- onConnectionStateChange(callback: (state: RuntimeConnectionStateSnapshot) => void): Promise<() => void> | (() => void);
130
- connections(): Connection[];
131
- applicationReadyConnections(options?: RuntimeApplicationPayloadReadinessOptions): Connection[];
132
- onConnection(callback: (connection: Connection) => void): () => void;
133
- onDisconnection(callback: (connection: Connection) => void): () => void;
134
- onConnectionEvent(callback: (event: RuntimeConnectionEvent) => void): () => void;
135
- forceReconnectSnapshot(): void;
136
- peerReconciliation(): Readonly<PeerReconciliationStats>;
137
- }
138
- interface OpenRTCAdvancedNamespace {
139
- readonly runtime: RuntimeClient;
140
- readonly assembly: PlutoRuntimeAssembly;
141
- nodeId(): Promise<string>;
142
- nodeIdFromTicket(ticket: string): Promise<string | null>;
143
- endpointTicket(): Promise<string>;
144
- connectRaw(target: {
145
- ticket: string;
146
- timeoutMs?: number;
147
- }): Promise<RuntimeRawConnection>;
148
- openBi(nodeId: string): Promise<{
149
- readable: ReadableStream<Uint8Array>;
150
- writable: WritableStream<Uint8Array>;
151
- }>;
152
- openUni(nodeId: string): Promise<WritableStream<Uint8Array>>;
153
- isConnected(nodeId: string): Promise<boolean>;
154
- disconnectNode(nodeId: string): Promise<void>;
155
- setAutoConnectExcluded(deviceId: string, excluded: boolean): Promise<void>;
156
- notifyNetworkChange(reason?: string): Promise<void>;
157
- }
158
- /**
159
- * OpenRTCClient extends RuntimeClient with auth helpers that were
160
- * previously only available on PlutoRuntimeAssembly.
161
- *
162
- * This is the unified type returned by OpenRTC() and OpenRTC.native().
163
- */
164
- interface OpenRTCClient extends RuntimeClient {
165
- readonly devices: OpenRTCDeviceNamespace;
166
- readonly peers: OpenRTCPeerNamespace;
167
- readonly channels: OpenRTCChannelNamespace;
168
- readonly rooms: OpenRTCRoomNamespace;
169
- readonly tickets: OpenRTCTicketNamespace;
170
- readonly diagnostics: OpenRTCDiagnosticsNamespace;
171
- readonly advanced: OpenRTCAdvancedNamespace;
172
- /** @deprecated Use setAuth() instead */
173
- setAuthContext(context: AuthContext | null): Promise<void>;
174
- /** Set auth context for the runtime */
175
- setAuth(context: AuthContext | null): Promise<void>;
176
- /** Sync Pluto-hosted auth to the runtime */
177
- syncPlutoAuth(options?: {
178
- userId?: string | null;
179
- forceRefresh?: boolean;
180
- }): Promise<void>;
181
- /** Bind Pluto auth host to auto-sync on token changes */
182
- bindPlutoAuthHost(): () => void;
183
- /** Sign in via Pluto SSO */
184
- signIn(): Promise<void>;
185
- /** Sign out and clear auth context */
186
- signOut(): Promise<void>;
187
- /**
188
- * @deprecated Use `client.devices.startSession(...)` for the public
189
- * user-device avenue lifecycle. This top-level method remains for
190
- * RuntimeClient compatibility and advanced integrations.
191
- */
192
- startManagedSession(options: RuntimeManagedSessionOptions): Promise<RuntimeManagedSession>;
193
- /**
194
- * @deprecated Use `client.devices.stopSession(...)` for the public
195
- * user-device avenue lifecycle.
196
- */
197
- stopManagedSession(options?: {
198
- preserveBackendSession?: boolean;
199
- }): Promise<void>;
200
- /** @deprecated Use `client.rooms.create(...)`. */
201
- createRoom(roomId?: string): Promise<string>;
202
- /** @deprecated Use `client.rooms.join(...)`. */
203
- joinRoom(roomId: string, options?: RuntimeJoinRoomOptions): Promise<Connection[]>;
204
- /** @deprecated Use `client.rooms.leave(...)`. */
205
- leaveRoom(roomId: string): Promise<void>;
206
- /** @deprecated Use `client.rooms.watch(...)`. */
207
- watchRoom(roomId: string, callback: (members: RuntimeRoomMember[]) => void): () => void;
208
- /** @deprecated Use `client.rooms.members(...)`. */
209
- getRoomMembers(roomId: string): Promise<RuntimeRoomMember[]>;
210
- /** @deprecated Use `client.tickets.raw(...)`. */
211
- getInvite(): Promise<string>;
212
- /** @deprecated Use `client.tickets.raw(...)`. */
213
- getTicket(): Promise<string>;
214
- /** @deprecated Use `client.tickets.share(...)` or `client.tickets.grant(...)`. */
215
- getTicketWithToken(scope: GrantScope, maxConnections?: number): Promise<string>;
216
- /** @deprecated Use `client.tickets.revoke(...)`. */
217
- revokeTokensByScope(scope: GrantScope): Promise<string[]>;
218
- /** @deprecated Use `client.peers.connect(...)`. */
219
- connectPeer(options: RuntimePeerConnectOptions): Promise<Connection>;
220
- /** @deprecated Use `client.peers.connect(...)`. */
221
- connectTo(options: RuntimePeerConnectOptions): Promise<Connection>;
222
- /** @deprecated Use `client.peers.waitConnected(...)`. */
223
- waitForConnectedPeer(id: string, timeoutMs?: number): Promise<PeerSessionSnapshot | null>;
224
- /** @deprecated Use `client.channels.connect(...)`; use `client.channels.connectScoped(...)` only for custom lifecycle scopes. */
225
- connectScopedChannel(options: RuntimeScopedChannelOptions): Promise<RuntimeScopedLogicalChannel>;
226
- /** @deprecated Use `client.channels.openBi(...)`. */
227
- openPeerBi(id: string, options?: RuntimePeerStreamOptions): Promise<{
228
- connection: Connection;
229
- readable: ReadableStream<Uint8Array>;
230
- writable: WritableStream<Uint8Array>;
231
- }>;
232
- /** @deprecated Use `client.channels.openUni(...)`. */
233
- openPeerUni(id: string, options?: RuntimePeerStreamOptions): Promise<{
234
- connection: Connection;
235
- writable: WritableStream<Uint8Array>;
236
- }>;
237
- /**
238
- * Access to the underlying PlutoRuntimeAssembly for backward compatibility.
239
- * @deprecated Access methods directly on the client instead.
240
- */
241
- readonly runtime: RuntimeClient;
242
- /**
243
- * Access to the underlying PlutoRuntimeAssembly for backward compatibility.
244
- * @internal
245
- */
246
- readonly _assembly: PlutoRuntimeAssembly;
247
- }
248
-
249
- export type { OpenRTCClient as O, OpenRTCChannelConnectOptions as a, OpenRTCDeviceNamespace as b, OpenRTCDeviceSessionOptions as c, OpenRTCRoomNamespace as d, OpenRTCTicketNamespace as e };