@lvce-editor/api 8.51.0 → 8.53.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/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { activate } from './parts/Activation/Activation.ts';
|
|
2
|
-
export { getAccessToken } from './parts/Authentication/Authentication.ts';
|
|
2
|
+
export { getAccessToken, type GetAccessTokenOptions } from './parts/Authentication/Authentication.ts';
|
|
3
3
|
export { createElectronWebContentsView } from './parts/ElectronWebContentsView/ElectronWebContentsView.ts';
|
|
4
4
|
export { executeCommand } from './parts/ExecuteCommand/ExecuteCommand.ts';
|
|
5
5
|
export { showQuickPick } from './parts/QuickPick/QuickPick.ts';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ExtensionManagementWorker } from '@lvce-editor/rpc-registry';
|
|
2
|
-
export const getAccessToken = () => {
|
|
3
|
-
return ExtensionManagementWorker.invoke('Extensions.getAccessToken');
|
|
2
|
+
export const getAccessToken = (options = {}) => {
|
|
3
|
+
return ExtensionManagementWorker.invoke('Extensions.getAccessToken', options);
|
|
4
4
|
};
|
package/dist/parts/Rpc/Rpc.d.ts
CHANGED
|
@@ -5,8 +5,9 @@ export interface CreateRpcOptions {
|
|
|
5
5
|
readonly url: string;
|
|
6
6
|
}
|
|
7
7
|
export interface CreateNodeRpcOptions {
|
|
8
|
+
readonly id?: string;
|
|
8
9
|
readonly name?: string;
|
|
9
|
-
readonly path
|
|
10
|
+
readonly path?: string;
|
|
10
11
|
}
|
|
11
12
|
export declare const createRpc: ({ commandMap, name, url }: CreateRpcOptions) => Promise<Rpc>;
|
|
12
|
-
export declare const createNodeRpc: (
|
|
13
|
+
export declare const createNodeRpc: (options: CreateNodeRpcOptions) => Promise<Rpc>;
|
package/dist/parts/Rpc/Rpc.js
CHANGED
|
@@ -17,14 +17,24 @@ const createMessagePortRpc = async (commandMap, send) => {
|
|
|
17
17
|
export const createRpc = async ({ commandMap = {}, name = '', url }) => {
|
|
18
18
|
return createMessagePortRpc(commandMap, (port) => sendMessagePortToWebWorker(port, name, url));
|
|
19
19
|
};
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
const resolveNodeRpcOptions = async ({ id, name = '', path }) => {
|
|
21
|
+
if (id) {
|
|
22
|
+
return ExtensionManagementWorker.invoke('Extensions.getNodeRpcInfo', id);
|
|
23
|
+
}
|
|
24
|
+
if (path) {
|
|
25
|
+
return { name, path };
|
|
26
|
+
}
|
|
27
|
+
throw new TypeError('createNodeRpc requires an id or path');
|
|
28
|
+
};
|
|
29
|
+
export const createNodeRpc = async (options) => {
|
|
30
|
+
const { name, path } = await resolveNodeRpcOptions(options);
|
|
31
|
+
const rpcId = await ExtensionManagementWorker.invoke('Extensions.executeCommand', 'ExtensionNodeRpc.create', name, path);
|
|
22
32
|
const invoke = (method, ...params) => {
|
|
23
|
-
return ExtensionManagementWorker.invoke('Extensions.executeCommand', 'ExtensionNodeRpc.invoke',
|
|
33
|
+
return ExtensionManagementWorker.invoke('Extensions.executeCommand', 'ExtensionNodeRpc.invoke', rpcId, method, ...params);
|
|
24
34
|
};
|
|
25
35
|
return {
|
|
26
36
|
async dispose() {
|
|
27
|
-
await ExtensionManagementWorker.invoke('Extensions.executeCommand', 'ExtensionNodeRpc.dispose',
|
|
37
|
+
await ExtensionManagementWorker.invoke('Extensions.executeCommand', 'ExtensionNodeRpc.dispose', rpcId);
|
|
28
38
|
},
|
|
29
39
|
invoke,
|
|
30
40
|
invokeAndTransfer: invoke,
|