openrtc-tauri 2.0.0-rc.9 → 2.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 +8 -27
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/runtime/ipc.d.ts +1 -3
- package/dist/runtime/ipc.js +2 -34
- package/package.json +2 -2
- package/dist/runtime/TauriRuntimeAdapter.d.ts +0 -9
- package/dist/runtime/TauriRuntimeAdapter.js +0 -11
package/README.md
CHANGED
|
@@ -6,13 +6,10 @@ Use this package with `createNativeOpenRTC(...)` or a native IPC runtime in a
|
|
|
6
6
|
Tauri desktop or mobile application.
|
|
7
7
|
|
|
8
8
|
This package pairs with the first-party Rust crate `openrtc-tauri-plugin`. The
|
|
9
|
-
TypeScript bridge invokes the registered plugin command namespace
|
|
10
|
-
(`plugin:openrtc-tauri-plugin|...`)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
`fallbackToBareCommands: true` to `createTauriIpcBridge(...)`. Without the Rust
|
|
14
|
-
plugin, `OpenRTC.native(...)` fails closed by design instead of silently falling
|
|
15
|
-
back to the browser/WASM runtime.
|
|
9
|
+
TypeScript bridge invokes only the registered v2 plugin command namespace
|
|
10
|
+
(`plugin:openrtc-tauri-plugin|...`). It does not probe legacy plugin namespaces
|
|
11
|
+
or bare Tauri commands. Without the Rust plugin, `OpenRTC.native(...)` fails
|
|
12
|
+
closed by design instead of silently selecting another lifecycle owner.
|
|
16
13
|
|
|
17
14
|
## Install
|
|
18
15
|
|
|
@@ -26,7 +23,7 @@ In your Tauri Rust crate:
|
|
|
26
23
|
[dependencies]
|
|
27
24
|
# Use the published crate after the native release path is cut.
|
|
28
25
|
# Until then, workspace consumers may use a path dependency.
|
|
29
|
-
openrtc-tauri-plugin = "
|
|
26
|
+
openrtc-tauri-plugin = "2.0.0"
|
|
30
27
|
```
|
|
31
28
|
|
|
32
29
|
```rust
|
|
@@ -49,25 +46,9 @@ const client = createNativeOpenRTC({
|
|
|
49
46
|
}, createTauriIpcBridge());
|
|
50
47
|
```
|
|
51
48
|
|
|
52
|
-
The
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
For lower-level native runtime wiring:
|
|
57
|
-
|
|
58
|
-
```ts
|
|
59
|
-
import { TauriRuntimeAdapter } from 'openrtc-tauri';
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
If you are temporarily migrating an older host that still exposes bare Tauri
|
|
63
|
-
commands, make the exception explicit:
|
|
64
|
-
|
|
65
|
-
```ts
|
|
66
|
-
new TauriRuntimeAdapter({
|
|
67
|
-
apiKey: 'pk_live_...',
|
|
68
|
-
ipc: { fallbackToBareCommands: true },
|
|
69
|
-
});
|
|
70
|
-
```
|
|
49
|
+
The package root and `openrtc-tauri/ipc` expose the same lightweight v2 bridge.
|
|
50
|
+
Connection, authentication, capability, and retry behavior remains in the
|
|
51
|
+
OpenRTC 2.0 client and Rust plugin rather than a second Tauri adapter.
|
|
71
52
|
|
|
72
53
|
## Rust Plugin
|
|
73
54
|
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/runtime/ipc.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { PlutoIpcBridge } from 'openrtc/runtime';
|
|
2
2
|
export interface TauriIpcBridgeOptions {
|
|
3
|
-
commandNamespace?: string
|
|
4
|
-
fallbackCommandNamespaces?: string[];
|
|
5
|
-
fallbackToBareCommands?: boolean;
|
|
3
|
+
commandNamespace?: string;
|
|
6
4
|
}
|
|
7
5
|
export declare function createTauriIpcBridge(options?: TauriIpcBridgeOptions): PlutoIpcBridge;
|
package/dist/runtime/ipc.js
CHANGED
|
@@ -1,43 +1,11 @@
|
|
|
1
|
-
import { isNativeIpcCommandUnavailable } from 'openrtc/native';
|
|
2
1
|
const DEFAULT_COMMAND_NAMESPACE = 'plugin:openrtc-tauri-plugin|';
|
|
3
|
-
const LEGACY_COMMAND_NAMESPACE = 'plugin:openrtc|';
|
|
4
2
|
export function createTauriIpcBridge(options = {}) {
|
|
5
3
|
const commandNamespace = options.commandNamespace ?? DEFAULT_COMMAND_NAMESPACE;
|
|
6
|
-
const
|
|
7
|
-
(commandNamespace === DEFAULT_COMMAND_NAMESPACE ? [LEGACY_COMMAND_NAMESPACE] : []);
|
|
8
|
-
// Bare command fallback is opt-in so missing plugin/capability wiring fails
|
|
9
|
-
// with the namespaced command that Tauri apps must actually install.
|
|
10
|
-
const fallbackToBareCommands = options.fallbackToBareCommands ?? false;
|
|
11
|
-
const resolveCommand = (namespace, command) => namespace && !command.startsWith('plugin:') ? `${namespace}${command}` : command;
|
|
4
|
+
const resolveCommand = (command) => command.startsWith('plugin:') ? command : `${commandNamespace}${command}`;
|
|
12
5
|
return {
|
|
13
6
|
async invoke(command, args) {
|
|
14
7
|
const { invoke } = await import('@tauri-apps/api/core');
|
|
15
|
-
|
|
16
|
-
try {
|
|
17
|
-
return await invoke(nativeCommand, args);
|
|
18
|
-
}
|
|
19
|
-
catch (error) {
|
|
20
|
-
if (isNativeIpcCommandUnavailable(error)) {
|
|
21
|
-
for (const namespace of fallbackCommandNamespaces) {
|
|
22
|
-
const fallbackCommand = resolveCommand(namespace, command);
|
|
23
|
-
if (fallbackCommand === nativeCommand || fallbackCommand === command) {
|
|
24
|
-
continue;
|
|
25
|
-
}
|
|
26
|
-
try {
|
|
27
|
-
return await invoke(fallbackCommand, args);
|
|
28
|
-
}
|
|
29
|
-
catch (fallbackError) {
|
|
30
|
-
if (!isNativeIpcCommandUnavailable(fallbackError)) {
|
|
31
|
-
throw fallbackError;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
if (fallbackToBareCommands && nativeCommand !== command && isNativeIpcCommandUnavailable(error)) {
|
|
37
|
-
return invoke(command, args);
|
|
38
|
-
}
|
|
39
|
-
throw error;
|
|
40
|
-
}
|
|
8
|
+
return invoke(resolveCommand(command), args);
|
|
41
9
|
},
|
|
42
10
|
async listen(event, handler) {
|
|
43
11
|
const { listen } = await import('@tauri-apps/api/event');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openrtc-tauri",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"prepublishOnly": "pnpm run build && pnpm run test:import"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"openrtc": "2.0.0
|
|
32
|
+
"openrtc": "^2.0.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"@tauri-apps/api": "^2.0.0"
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { IpcRuntimeAdapter, type RuntimeClientOptions } from 'openrtc/runtime';
|
|
2
|
-
import { type TauriIpcBridgeOptions } from './ipc.js';
|
|
3
|
-
export interface TauriRuntimeAdapterOptions extends RuntimeClientOptions {
|
|
4
|
-
allowWasmFallback?: boolean;
|
|
5
|
-
ipc?: TauriIpcBridgeOptions;
|
|
6
|
-
}
|
|
7
|
-
export declare class TauriRuntimeAdapter extends IpcRuntimeAdapter {
|
|
8
|
-
constructor(options: TauriRuntimeAdapterOptions);
|
|
9
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { IpcRuntimeAdapter } from 'openrtc/runtime';
|
|
2
|
-
import { createTauriIpcBridge } from './ipc.js';
|
|
3
|
-
export class TauriRuntimeAdapter extends IpcRuntimeAdapter {
|
|
4
|
-
constructor(options) {
|
|
5
|
-
super({
|
|
6
|
-
...options,
|
|
7
|
-
bridge: createTauriIpcBridge(options.ipc),
|
|
8
|
-
allowWasmFallback: options.allowWasmFallback ?? false,
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
}
|