@dxos/plugin-script 0.6.14-staging.e15392e → 0.7.1-staging.599df14
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/lib/browser/{AutomationPanel-MDPZ5WAC.mjs → AutomationPanel-RYJJQ5QX.mjs} +5 -5
- package/dist/lib/browser/{ScriptContainer-B3CPWXRE.mjs → ScriptContainer-RLBVHRCW.mjs} +24 -21
- package/dist/lib/browser/ScriptContainer-RLBVHRCW.mjs.map +7 -0
- package/dist/lib/browser/{chunk-G6H56WFS.mjs → chunk-4UTRJLQ3.mjs} +11 -3
- package/dist/lib/browser/chunk-4UTRJLQ3.mjs.map +7 -0
- package/dist/lib/browser/{chunk-KHNN3F7J.mjs → chunk-5GGRYRS4.mjs} +5 -5
- package/dist/lib/browser/{chunk-KHNN3F7J.mjs.map → chunk-5GGRYRS4.mjs.map} +2 -2
- package/dist/lib/browser/{chunk-SGQHRB4P.mjs → chunk-C7VBULMK.mjs} +4 -3
- package/dist/lib/browser/{chunk-SGQHRB4P.mjs.map → chunk-C7VBULMK.mjs.map} +3 -3
- package/dist/lib/browser/{chunk-G66MXS4T.mjs → chunk-NCZUJKJE.mjs} +6 -18
- package/dist/lib/browser/chunk-NCZUJKJE.mjs.map +7 -0
- package/dist/lib/browser/{chunk-KXVQPS4Y.mjs → chunk-VEW5BERN.mjs} +8 -6
- package/dist/lib/browser/chunk-VEW5BERN.mjs.map +7 -0
- package/dist/lib/browser/edge/index.mjs +1 -1
- package/dist/lib/browser/index.mjs +106 -13
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -1
- package/dist/lib/browser/types/index.mjs +2 -2
- package/dist/lib/node/{AutomationPanel-SANUE5X4.cjs → AutomationPanel-3B5AGQQV.cjs} +15 -15
- package/dist/lib/node/{ScriptContainer-BV7HMUY5.cjs → ScriptContainer-7VX44TH6.cjs} +40 -37
- package/dist/lib/node/ScriptContainer-7VX44TH6.cjs.map +7 -0
- package/dist/lib/node/{chunk-EJC55SDD.cjs → chunk-6LYX73ZT.cjs} +7 -6
- package/dist/lib/node/chunk-6LYX73ZT.cjs.map +7 -0
- package/dist/lib/node/{chunk-JWKMTYYH.cjs → chunk-BJ4WIWCP.cjs} +9 -21
- package/dist/lib/node/chunk-BJ4WIWCP.cjs.map +7 -0
- package/dist/lib/node/{chunk-ACLCRWDB.cjs → chunk-WPP65EYS.cjs} +14 -6
- package/dist/lib/node/chunk-WPP65EYS.cjs.map +7 -0
- package/dist/lib/node/{chunk-25PQE7FL.cjs → chunk-XJOH225K.cjs} +10 -8
- package/dist/lib/node/chunk-XJOH225K.cjs.map +7 -0
- package/dist/lib/node/{chunk-FY5KKL5N.cjs → chunk-XS6GEYYH.cjs} +8 -8
- package/dist/lib/node/{chunk-FY5KKL5N.cjs.map → chunk-XS6GEYYH.cjs.map} +2 -2
- package/dist/lib/node/edge/index.cjs +10 -10
- package/dist/lib/node/edge/index.cjs.map +1 -1
- package/dist/lib/node/index.cjs +123 -34
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.cjs +3 -3
- package/dist/lib/node/meta.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/types/index.cjs +5 -5
- package/dist/lib/node/types/index.cjs.map +1 -1
- package/dist/lib/node-esm/{AutomationPanel-H2IKE53E.mjs → AutomationPanel-EEGLOILM.mjs} +5 -5
- package/dist/lib/node-esm/{ScriptContainer-HSIOGVP3.mjs → ScriptContainer-NGYXDSLQ.mjs} +24 -21
- package/dist/lib/node-esm/ScriptContainer-NGYXDSLQ.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-LDLNTVAK.mjs → chunk-4SRPREUK.mjs} +11 -3
- package/dist/lib/node-esm/chunk-4SRPREUK.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-3QHVR4VV.mjs → chunk-DXWSRDEN.mjs} +6 -18
- package/dist/lib/node-esm/chunk-DXWSRDEN.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-7EDYDVQH.mjs → chunk-P7ULFJ4T.mjs} +8 -6
- package/dist/lib/node-esm/chunk-P7ULFJ4T.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-GO7HYFM5.mjs → chunk-SLTZMY34.mjs} +4 -3
- package/dist/lib/node-esm/{chunk-GO7HYFM5.mjs.map → chunk-SLTZMY34.mjs.map} +3 -3
- package/dist/lib/node-esm/{chunk-QMTTZYLF.mjs → chunk-V74XKPLC.mjs} +5 -5
- package/dist/lib/node-esm/{chunk-QMTTZYLF.mjs.map → chunk-V74XKPLC.mjs.map} +2 -2
- package/dist/lib/node-esm/edge/index.mjs +1 -1
- package/dist/lib/node-esm/index.mjs +106 -13
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/meta.mjs +1 -1
- package/dist/lib/node-esm/types/index.mjs +2 -2
- package/dist/types/src/ScriptPlugin.d.ts.map +1 -1
- package/dist/types/src/bundler/bundler.d.ts.map +1 -1
- package/dist/types/src/components/DebugPanel/DebugPanel.d.ts +1 -4
- package/dist/types/src/components/DebugPanel/DebugPanel.d.ts.map +1 -1
- package/dist/types/src/components/ScriptEditor.d.ts.map +1 -1
- package/dist/types/src/components/ScriptSettingsPanel.d.ts +7 -0
- package/dist/types/src/components/ScriptSettingsPanel.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/edge/functions.d.ts +4 -1
- package/dist/types/src/edge/functions.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +5 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +1 -1
- package/dist/types/src/types/{script.d.ts → schema.d.ts} +4 -2
- package/dist/types/src/types/schema.d.ts.map +1 -0
- package/package.json +37 -37
- package/src/ScriptPlugin.tsx +10 -2
- package/src/bundler/bundler.ts +4 -0
- package/src/components/DebugPanel/DebugPanel.tsx +2 -29
- package/src/components/ScriptEditor.tsx +10 -18
- package/src/components/ScriptSettings/ScriptSettings.tsx +3 -3
- package/src/components/ScriptSettingsPanel.tsx +105 -0
- package/src/components/index.ts +1 -0
- package/src/edge/functions.ts +4 -1
- package/src/meta.ts +2 -1
- package/src/translations.ts +5 -0
- package/src/types/index.ts +1 -1
- package/src/types/{script.ts → schema.ts} +12 -6
- package/dist/lib/browser/ScriptContainer-B3CPWXRE.mjs.map +0 -7
- package/dist/lib/browser/chunk-G66MXS4T.mjs.map +0 -7
- package/dist/lib/browser/chunk-G6H56WFS.mjs.map +0 -7
- package/dist/lib/browser/chunk-KXVQPS4Y.mjs.map +0 -7
- package/dist/lib/node/ScriptContainer-BV7HMUY5.cjs.map +0 -7
- package/dist/lib/node/chunk-25PQE7FL.cjs.map +0 -7
- package/dist/lib/node/chunk-ACLCRWDB.cjs.map +0 -7
- package/dist/lib/node/chunk-EJC55SDD.cjs.map +0 -7
- package/dist/lib/node/chunk-JWKMTYYH.cjs.map +0 -7
- package/dist/lib/node-esm/ScriptContainer-HSIOGVP3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3QHVR4VV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7EDYDVQH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-LDLNTVAK.mjs.map +0 -7
- package/dist/types/src/types/script.d.ts.map +0 -1
- /package/dist/lib/browser/{AutomationPanel-MDPZ5WAC.mjs.map → AutomationPanel-RYJJQ5QX.mjs.map} +0 -0
- /package/dist/lib/node/{AutomationPanel-SANUE5X4.cjs.map → AutomationPanel-3B5AGQQV.cjs.map} +0 -0
- /package/dist/lib/node-esm/{AutomationPanel-H2IKE53E.mjs.map → AutomationPanel-EEGLOILM.mjs.map} +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type ScriptType } from '../types';
|
|
3
|
+
export type ScriptSettingsPanelProps = {
|
|
4
|
+
script: ScriptType;
|
|
5
|
+
};
|
|
6
|
+
export declare const ScriptSettingsPanel: ({ script }: ScriptSettingsPanelProps) => React.JSX.Element;
|
|
7
|
+
//# sourceMappingURL=ScriptSettingsPanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScriptSettingsPanel.d.ts","sourceRoot":"","sources":["../../../../src/components/ScriptSettingsPanel.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAQ7D,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAEzD,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,EAAE,UAAU,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,mBAAmB,eAAgB,wBAAwB,sBAsFvE,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './ScriptSettings';
|
|
2
|
+
export * from './ScriptSettingsPanel';
|
|
2
3
|
export declare const AutomationPanel: import("react").LazyExoticComponent<({ subject }: import("./AutomationPanel").AutomationPanelProps) => import("react").JSX.Element>;
|
|
3
4
|
export declare const ScriptContainer: import("react").LazyExoticComponent<({ script, ...props }: import("./ScriptEditor").ScriptEditorProps) => import("react").JSX.Element>;
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAMA,cAAc,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAMA,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AAEtC,eAAO,MAAM,eAAe,qIAA0C,CAAC;AACvE,eAAO,MAAM,eAAe,wIAA0C,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type DID } from 'iso-did/types';
|
|
2
2
|
import { type Config } from '@dxos/client';
|
|
3
3
|
import { type Halo } from '@dxos/client-protocol';
|
|
4
|
-
import { type ObjectMeta } from '@dxos/echo-schema';
|
|
4
|
+
import { type JsonSchemaType, type ObjectMeta } from '@dxos/echo-schema';
|
|
5
5
|
import type { SpaceId } from '@dxos/keys';
|
|
6
6
|
export declare const USERFUNCTIONS_PRESET_META_KEY = "dxos.org/service/function-preset";
|
|
7
7
|
export type UserFunctionUploadResult = {
|
|
@@ -9,6 +9,9 @@ export type UserFunctionUploadResult = {
|
|
|
9
9
|
errorMessage?: string;
|
|
10
10
|
functionId?: string;
|
|
11
11
|
functionVersionNumber?: number;
|
|
12
|
+
meta: {
|
|
13
|
+
inputSchema?: JsonSchemaType;
|
|
14
|
+
};
|
|
12
15
|
};
|
|
13
16
|
export type UploadWorkerProps = {
|
|
14
17
|
clientConfig: Config;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../../../src/edge/functions.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../../../src/edge/functions.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEzE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAS1C,eAAO,MAAM,6BAA6B,qCAAqC,CAAC;AAIhF,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,IAAI,EAAE;QACJ,WAAW,CAAC,EAAE,cAAc,CAAC;KAC9B,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,GAAG,CAAC;IACd,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC;AAeF,eAAO,MAAM,oBAAoB,uFAQ9B,iBAAiB,sCAwBnB,CAAC;AAEF,eAAO,MAAM,4BAA4B,SAAU,UAAU,uBAE5D,CAAC;AAEF,eAAO,MAAM,4BAA4B,SAAU,UAAU,eAAe,MAAM,SASjF,CAAC;AAoCF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,gBAAgB,gBAAiB,MAAM,WAAW,MAAM,YAAW,iBAAiB,WAUhG,CAAC"}
|
package/dist/types/src/meta.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,aAAa,2BAA2B,CAAC
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,aAAa,2BAA2B,CAAC;;;;;;;;;AAEtD,wBAOuB"}
|
|
@@ -15,6 +15,11 @@ declare const _default: {
|
|
|
15
15
|
'toggle details label': string;
|
|
16
16
|
'authenticate action label': string;
|
|
17
17
|
'authenticate button label': string;
|
|
18
|
+
'name label': string;
|
|
19
|
+
'remote function settings heading': string;
|
|
20
|
+
'function url label': string;
|
|
21
|
+
'function binding label': string;
|
|
22
|
+
'function binding placeholder': string;
|
|
18
23
|
};
|
|
19
24
|
};
|
|
20
25
|
}[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAMA,wBA0BE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ref, S } from '@dxos/echo-schema';
|
|
1
|
+
import { JsonSchemaType, ref, S } from '@dxos/echo-schema';
|
|
2
2
|
declare const ScriptType_base: import("@dxos/echo-schema").AbstractTypedObject<{
|
|
3
3
|
name?: string | undefined;
|
|
4
4
|
description?: string | undefined;
|
|
@@ -41,6 +41,7 @@ declare const FunctionType_base: import("@dxos/echo-schema").AbstractTypedObject
|
|
|
41
41
|
}>;
|
|
42
42
|
version: number;
|
|
43
43
|
binding?: string | undefined;
|
|
44
|
+
inputSchema?: JsonSchemaType | undefined;
|
|
44
45
|
} & {
|
|
45
46
|
id: string;
|
|
46
47
|
}, S.Struct.Encoded<{
|
|
@@ -59,6 +60,7 @@ declare const FunctionType_base: import("@dxos/echo-schema").AbstractTypedObject
|
|
|
59
60
|
} & {
|
|
60
61
|
id: string;
|
|
61
62
|
}>>;
|
|
63
|
+
inputSchema: S.optional<S.Schema<JsonSchemaType, JsonSchemaType, never>>;
|
|
62
64
|
}>>;
|
|
63
65
|
/**
|
|
64
66
|
* Function deployment.
|
|
@@ -66,4 +68,4 @@ declare const FunctionType_base: import("@dxos/echo-schema").AbstractTypedObject
|
|
|
66
68
|
export declare class FunctionType extends FunctionType_base {
|
|
67
69
|
}
|
|
68
70
|
export {};
|
|
69
|
-
//# sourceMappingURL=
|
|
71
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/types/schema.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC,EAAe,MAAM,mBAAmB,CAAC;;;;;;;;;;;;;;;;;;;;;;AAGxE;;GAEG;AACH,qBAAa,UAAW,SAAQ,eAW9B;CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEL;;GAEG;AACH,qBAAa,YAAa,SAAQ,iBAahC;CAAG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-script",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1-staging.599df14",
|
|
4
4
|
"description": "Braneframe notebook plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@codemirror/state": "^6.4.1",
|
|
56
56
|
"@codemirror/theme-one-dark": "^6.1.2",
|
|
57
57
|
"@codemirror/view": "^6.34.1",
|
|
58
|
-
"@effect/schema": "^0.75.
|
|
58
|
+
"@effect/schema": "^0.75.5",
|
|
59
59
|
"@lezer/common": "^1.2.2",
|
|
60
60
|
"@preact/signals-core": "^1.6.0",
|
|
61
61
|
"@typescript/vfs": "^1.6.0",
|
|
@@ -67,32 +67,32 @@
|
|
|
67
67
|
"prettier": "^3.2.4",
|
|
68
68
|
"react-syntax-highlighter": "^15.5.0",
|
|
69
69
|
"typescript": "^5.6.2",
|
|
70
|
-
"@dxos/app-framework": "0.
|
|
71
|
-
"@dxos/async": "0.
|
|
72
|
-
"@dxos/client": "0.
|
|
73
|
-
"@dxos/client-protocol": "0.
|
|
74
|
-
"@dxos/
|
|
75
|
-
"@dxos/
|
|
76
|
-
"@dxos/
|
|
77
|
-
"@dxos/
|
|
78
|
-
"@dxos/
|
|
79
|
-
"@dxos/
|
|
80
|
-
"@dxos/plugin-
|
|
81
|
-
"@dxos/plugin-
|
|
82
|
-
"@dxos/plugin-graph": "0.
|
|
83
|
-
"@dxos/plugin-markdown": "0.
|
|
84
|
-
"@dxos/plugin-space": "0.
|
|
85
|
-
"@dxos/plugin-stack": "0.
|
|
86
|
-
"@dxos/plugin-theme": "0.
|
|
87
|
-
"@dxos/
|
|
88
|
-
"@dxos/react-
|
|
89
|
-
"@dxos/
|
|
90
|
-
"@dxos/react-ui-
|
|
91
|
-
"@dxos/react-ui-
|
|
92
|
-
"@dxos/react-ui-syntax-highlighter": "0.
|
|
93
|
-
"@dxos/rpc": "0.
|
|
94
|
-
"@dxos/rpc-tunnel": "0.
|
|
95
|
-
"@dxos/util": "0.
|
|
70
|
+
"@dxos/app-framework": "0.7.1-staging.599df14",
|
|
71
|
+
"@dxos/async": "0.7.1-staging.599df14",
|
|
72
|
+
"@dxos/client": "0.7.1-staging.599df14",
|
|
73
|
+
"@dxos/client-protocol": "0.7.1-staging.599df14",
|
|
74
|
+
"@dxos/debug": "0.7.1-staging.599df14",
|
|
75
|
+
"@dxos/echo-schema": "0.7.1-staging.599df14",
|
|
76
|
+
"@dxos/crypto": "0.7.1-staging.599df14",
|
|
77
|
+
"@dxos/invariant": "0.7.1-staging.599df14",
|
|
78
|
+
"@dxos/keys": "0.7.1-staging.599df14",
|
|
79
|
+
"@dxos/log": "0.7.1-staging.599df14",
|
|
80
|
+
"@dxos/plugin-explorer": "0.7.1-staging.599df14",
|
|
81
|
+
"@dxos/plugin-client": "0.7.1-staging.599df14",
|
|
82
|
+
"@dxos/plugin-graph": "0.7.1-staging.599df14",
|
|
83
|
+
"@dxos/plugin-markdown": "0.7.1-staging.599df14",
|
|
84
|
+
"@dxos/plugin-space": "0.7.1-staging.599df14",
|
|
85
|
+
"@dxos/plugin-stack": "0.7.1-staging.599df14",
|
|
86
|
+
"@dxos/plugin-theme": "0.7.1-staging.599df14",
|
|
87
|
+
"@dxos/protocols": "0.7.1-staging.599df14",
|
|
88
|
+
"@dxos/react-client": "0.7.1-staging.599df14",
|
|
89
|
+
"@dxos/react-ui-attention": "0.7.1-staging.599df14",
|
|
90
|
+
"@dxos/react-ui-editor": "0.7.1-staging.599df14",
|
|
91
|
+
"@dxos/react-ui-form": "0.7.1-staging.599df14",
|
|
92
|
+
"@dxos/react-ui-syntax-highlighter": "0.7.1-staging.599df14",
|
|
93
|
+
"@dxos/rpc": "0.7.1-staging.599df14",
|
|
94
|
+
"@dxos/rpc-tunnel": "0.7.1-staging.599df14",
|
|
95
|
+
"@dxos/util": "0.7.1-staging.599df14"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
98
|
"@phosphor-icons/react": "^2.1.5",
|
|
@@ -102,20 +102,20 @@
|
|
|
102
102
|
"react": "~18.2.0",
|
|
103
103
|
"react-dom": "~18.2.0",
|
|
104
104
|
"vite": "5.4.7",
|
|
105
|
-
"@dxos/
|
|
106
|
-
"@dxos/
|
|
107
|
-
"@dxos/
|
|
108
|
-
"@dxos/react-ui": "0.
|
|
109
|
-
"@dxos/react-ui-theme": "0.
|
|
110
|
-
"@dxos/storybook-utils": "0.
|
|
105
|
+
"@dxos/random": "0.7.1-staging.599df14",
|
|
106
|
+
"@dxos/react-ui": "0.7.1-staging.599df14",
|
|
107
|
+
"@dxos/echo-generator": "0.7.1-staging.599df14",
|
|
108
|
+
"@dxos/react-ui-mosaic": "0.7.1-staging.599df14",
|
|
109
|
+
"@dxos/react-ui-theme": "0.7.1-staging.599df14",
|
|
110
|
+
"@dxos/storybook-utils": "0.7.1-staging.599df14"
|
|
111
111
|
},
|
|
112
112
|
"peerDependencies": {
|
|
113
113
|
"@phosphor-icons/react": "^2.1.5",
|
|
114
114
|
"react": "~18.2.0",
|
|
115
115
|
"react-dom": "~18.2.0",
|
|
116
|
-
"@dxos/react-ui": "0.
|
|
117
|
-
"@dxos/react-ui-
|
|
118
|
-
"@dxos/react-ui-
|
|
116
|
+
"@dxos/react-ui": "0.7.1-staging.599df14",
|
|
117
|
+
"@dxos/react-ui-theme": "0.7.1-staging.599df14",
|
|
118
|
+
"@dxos/react-ui-mosaic": "0.7.1-staging.599df14"
|
|
119
119
|
},
|
|
120
120
|
"publishConfig": {
|
|
121
121
|
"access": "public"
|
package/src/ScriptPlugin.tsx
CHANGED
|
@@ -16,7 +16,7 @@ import { loadObjectReferences } from '@dxos/react-client/echo';
|
|
|
16
16
|
|
|
17
17
|
import { initializeBundler } from './bundler';
|
|
18
18
|
import { Compiler } from './compiler';
|
|
19
|
-
import { AutomationPanel, ScriptContainer, ScriptSettings } from './components';
|
|
19
|
+
import { AutomationPanel, ScriptContainer, ScriptSettings, ScriptSettingsPanel } from './components';
|
|
20
20
|
import meta, { SCRIPT_PLUGIN } from './meta';
|
|
21
21
|
import { templates } from './templates';
|
|
22
22
|
import translations from './translations';
|
|
@@ -122,12 +122,20 @@ export const ScriptPlugin = (): PluginDefinition<ScriptPluginProvides> => {
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
case 'complementary--automation': {
|
|
125
|
-
if (data.
|
|
125
|
+
if (data.subject instanceof ScriptType) {
|
|
126
126
|
return {
|
|
127
127
|
node: <AutomationPanel subject={data.subject as any} />,
|
|
128
128
|
disposition: 'hoist',
|
|
129
129
|
};
|
|
130
130
|
}
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
case 'complementary--settings': {
|
|
135
|
+
if (data.subject instanceof ScriptType) {
|
|
136
|
+
return <ScriptSettingsPanel script={data.subject} />;
|
|
137
|
+
}
|
|
138
|
+
break;
|
|
131
139
|
}
|
|
132
140
|
}
|
|
133
141
|
|
package/src/bundler/bundler.ts
CHANGED
|
@@ -78,6 +78,10 @@ export class Bundler {
|
|
|
78
78
|
return { path, external: true };
|
|
79
79
|
});
|
|
80
80
|
|
|
81
|
+
build.onResolve({ filter: /^dxos:functions$/ }, ({ path }) => {
|
|
82
|
+
return { path: './runtime.js', external: true };
|
|
83
|
+
});
|
|
84
|
+
|
|
81
85
|
build.onResolve({ filter: /^memory:/ }, ({ path }) => {
|
|
82
86
|
return { path: path.split(':')[1], namespace: 'memory' };
|
|
83
87
|
});
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import React, { useEffect, useRef, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { log } from '@dxos/log';
|
|
8
|
-
import { Avatar, Icon, Input, type ThemedClassName, Toolbar,
|
|
8
|
+
import { Avatar, Icon, Input, type ThemedClassName, Toolbar, useTranslation } from '@dxos/react-ui';
|
|
9
9
|
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
10
10
|
import { mx } from '@dxos/react-ui-theme';
|
|
11
11
|
|
|
@@ -20,26 +20,11 @@ type Message = { type: 'request' | 'response'; text?: string; data?: any; error?
|
|
|
20
20
|
|
|
21
21
|
export type DebugPanelProps = ThemedClassName<{
|
|
22
22
|
functionUrl?: string;
|
|
23
|
-
binding?: string;
|
|
24
|
-
onBindingChange?: (binding: string) => void;
|
|
25
|
-
showBindingConfig?: boolean;
|
|
26
23
|
}>;
|
|
27
24
|
|
|
28
|
-
export const DebugPanel = ({
|
|
29
|
-
classNames,
|
|
30
|
-
functionUrl,
|
|
31
|
-
binding: _binding,
|
|
32
|
-
onBindingChange,
|
|
33
|
-
showBindingConfig = false,
|
|
34
|
-
}: DebugPanelProps) => {
|
|
25
|
+
export const DebugPanel = ({ classNames, functionUrl }: DebugPanelProps) => {
|
|
35
26
|
const { t } = useTranslation(SCRIPT_PLUGIN);
|
|
36
27
|
|
|
37
|
-
const bindingInputRef = useRef<HTMLInputElement>(null);
|
|
38
|
-
const [binding, setBinding] = useControlledValue(_binding ?? '');
|
|
39
|
-
const handleBlur = () => {
|
|
40
|
-
onBindingChange?.(binding);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
28
|
const inputRef = useRef<HTMLInputElement>(null);
|
|
44
29
|
const [input, setInput] = useState('');
|
|
45
30
|
const [result, setResult] = useState('');
|
|
@@ -190,18 +175,6 @@ export const DebugPanel = ({
|
|
|
190
175
|
onKeyDown={(ev) => ev.key === 'Enter' && handleRequest(input)}
|
|
191
176
|
/>
|
|
192
177
|
</Input.Root>
|
|
193
|
-
{showBindingConfig && (
|
|
194
|
-
<Input.Root>
|
|
195
|
-
<Input.TextInput
|
|
196
|
-
ref={bindingInputRef}
|
|
197
|
-
classNames='!w-[10rem]'
|
|
198
|
-
placeholder={t('binding placeholder')}
|
|
199
|
-
value={binding}
|
|
200
|
-
onChange={(ev) => setBinding(ev.target.value.toUpperCase())}
|
|
201
|
-
onBlur={handleBlur}
|
|
202
|
-
/>
|
|
203
|
-
</Input.Root>
|
|
204
|
-
)}
|
|
205
178
|
<Toolbar.Button onClick={() => handleRequest(input)}>
|
|
206
179
|
<Icon icon='ph--play--regular' size={4} />
|
|
207
180
|
</Toolbar.Button>
|
|
@@ -72,13 +72,6 @@ export const ScriptEditor = ({ classNames, script, env }: ScriptEditorProps) =>
|
|
|
72
72
|
const existingFunctionUrl = fn && getUserFunctionUrlInMetadata(getMeta(fn));
|
|
73
73
|
const [error, setError] = useState<string>();
|
|
74
74
|
|
|
75
|
-
const handleBindingChange = useCallback(
|
|
76
|
-
(binding: string) => {
|
|
77
|
-
fn.binding = binding;
|
|
78
|
-
},
|
|
79
|
-
[fn],
|
|
80
|
-
);
|
|
81
|
-
|
|
82
75
|
const handleFormat = useCallback(async () => {
|
|
83
76
|
if (!script.source) {
|
|
84
77
|
return;
|
|
@@ -130,7 +123,7 @@ export const ScriptEditor = ({ classNames, script, env }: ScriptEditorProps) =>
|
|
|
130
123
|
throw buildResult.error;
|
|
131
124
|
}
|
|
132
125
|
|
|
133
|
-
const { result, functionId, functionVersionNumber, errorMessage } = await uploadWorkerFunction({
|
|
126
|
+
const { result, functionId, functionVersionNumber, errorMessage, meta } = await uploadWorkerFunction({
|
|
134
127
|
clientConfig: client.config,
|
|
135
128
|
halo: client.halo,
|
|
136
129
|
ownerDid,
|
|
@@ -148,9 +141,15 @@ export const ScriptEditor = ({ classNames, script, env }: ScriptEditorProps) =>
|
|
|
148
141
|
|
|
149
142
|
const deployedFunction =
|
|
150
143
|
fn ?? space.db.add(create(FunctionType, { version: functionVersionNumber, source: script }));
|
|
151
|
-
const meta = getMeta(deployedFunction);
|
|
152
144
|
script.changed = false;
|
|
153
|
-
|
|
145
|
+
|
|
146
|
+
if (meta.inputSchema) {
|
|
147
|
+
deployedFunction.inputSchema = meta.inputSchema;
|
|
148
|
+
} else {
|
|
149
|
+
log.verbose('no input schema in function metadata', { functionId });
|
|
150
|
+
}
|
|
151
|
+
setUserFunctionUrlInMetadata(getMeta(deployedFunction), `/${ownerDid}/${functionId}`);
|
|
152
|
+
|
|
154
153
|
setView('split');
|
|
155
154
|
} catch (err: any) {
|
|
156
155
|
log.catch(err);
|
|
@@ -192,14 +191,7 @@ export const ScriptEditor = ({ classNames, script, env }: ScriptEditorProps) =>
|
|
|
192
191
|
/>
|
|
193
192
|
)}
|
|
194
193
|
|
|
195
|
-
{view !== 'editor' &&
|
|
196
|
-
<DebugPanel
|
|
197
|
-
functionUrl={functionUrl}
|
|
198
|
-
showBindingConfig
|
|
199
|
-
binding={fn?.binding}
|
|
200
|
-
onBindingChange={handleBindingChange}
|
|
201
|
-
/>
|
|
202
|
-
)}
|
|
194
|
+
{view !== 'editor' && <DebugPanel functionUrl={functionUrl} />}
|
|
203
195
|
</div>
|
|
204
196
|
);
|
|
205
197
|
};
|
|
@@ -7,7 +7,7 @@ import React from 'react';
|
|
|
7
7
|
import { type Credential } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
8
8
|
import { useClient } from '@dxos/react-client';
|
|
9
9
|
import { Button, useTranslation } from '@dxos/react-ui';
|
|
10
|
-
import {
|
|
10
|
+
import { DeprecatedFormInput } from '@dxos/react-ui-form';
|
|
11
11
|
|
|
12
12
|
import { SCRIPT_PLUGIN } from '../../meta';
|
|
13
13
|
import { type ScriptSettingsProps } from '../../types';
|
|
@@ -39,9 +39,9 @@ export const ScriptSettings = ({ settings }: { settings: ScriptSettingsProps })
|
|
|
39
39
|
|
|
40
40
|
return (
|
|
41
41
|
<>
|
|
42
|
-
<
|
|
42
|
+
<DeprecatedFormInput label={t('authenticate action label')}>
|
|
43
43
|
<Button onClick={handleAuthenticate}>{t('authenticate button label')}</Button>
|
|
44
|
-
</
|
|
44
|
+
</DeprecatedFormInput>
|
|
45
45
|
</>
|
|
46
46
|
);
|
|
47
47
|
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { type ChangeEvent, useCallback } from 'react';
|
|
6
|
+
|
|
7
|
+
import { useClient } from '@dxos/react-client';
|
|
8
|
+
import { Filter, getMeta, getSpace, useQuery } from '@dxos/react-client/echo';
|
|
9
|
+
import { Button, Icon, Input, useControlledValue, useTranslation } from '@dxos/react-ui';
|
|
10
|
+
|
|
11
|
+
import { getInvocationUrl, getUserFunctionUrlInMetadata } from '../edge';
|
|
12
|
+
import { SCRIPT_PLUGIN } from '../meta';
|
|
13
|
+
import { FunctionType, type ScriptType } from '../types';
|
|
14
|
+
|
|
15
|
+
export type ScriptSettingsPanelProps = {
|
|
16
|
+
script: ScriptType;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const ScriptSettingsPanel = ({ script }: ScriptSettingsPanelProps) => {
|
|
20
|
+
const { t } = useTranslation(SCRIPT_PLUGIN);
|
|
21
|
+
const client = useClient();
|
|
22
|
+
const space = getSpace(script);
|
|
23
|
+
// TODO(dmaretskyi): Parametric query.
|
|
24
|
+
const [fn] = useQuery(
|
|
25
|
+
space,
|
|
26
|
+
Filter.schema(FunctionType, (fn) => fn.source === script),
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const handleNameChange = useCallback(
|
|
30
|
+
(event: ChangeEvent<HTMLInputElement>) => {
|
|
31
|
+
script.name = event.target.value;
|
|
32
|
+
},
|
|
33
|
+
[script],
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
const [binding, setBinding] = useControlledValue(fn?.binding ?? '');
|
|
37
|
+
const handleBindingChange = useCallback(
|
|
38
|
+
(event: ChangeEvent<HTMLInputElement>) => {
|
|
39
|
+
setBinding(event.target.value);
|
|
40
|
+
},
|
|
41
|
+
[setBinding],
|
|
42
|
+
);
|
|
43
|
+
const handleBindingBlur = useCallback(() => {
|
|
44
|
+
fn.binding = binding;
|
|
45
|
+
}, [fn, binding]);
|
|
46
|
+
|
|
47
|
+
const functionPath = fn && getUserFunctionUrlInMetadata(getMeta(fn));
|
|
48
|
+
const functionUrl =
|
|
49
|
+
functionPath &&
|
|
50
|
+
getInvocationUrl(functionPath, client.config.values.runtime?.services?.edge?.url ?? '', {
|
|
51
|
+
spaceId: space?.id,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// TODO(wittjosiah): Use ClipboardProvider.
|
|
55
|
+
const handleCopy = useCallback(() => functionUrl && navigator.clipboard.writeText(functionUrl), [functionUrl]);
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<div role='form' className='flex flex-col w-full p-2 gap-4'>
|
|
59
|
+
<Input.Root>
|
|
60
|
+
<div role='none' className='flex flex-col gap-1'>
|
|
61
|
+
<Input.Label>{t('name label')}</Input.Label>
|
|
62
|
+
<Input.TextInput
|
|
63
|
+
placeholder={t('object title placeholder')}
|
|
64
|
+
value={script.name ?? ''}
|
|
65
|
+
onChange={handleNameChange}
|
|
66
|
+
/>
|
|
67
|
+
</div>
|
|
68
|
+
</Input.Root>
|
|
69
|
+
{fn && (
|
|
70
|
+
<>
|
|
71
|
+
<hr className='border-separator' />
|
|
72
|
+
<h2>{t('remote function settings heading')}</h2>
|
|
73
|
+
<Input.Root>
|
|
74
|
+
<div role='none' className='flex flex-col gap-1'>
|
|
75
|
+
<Input.Label>{t('function url label')}</Input.Label>
|
|
76
|
+
<div role='none' className='flex gap-1'>
|
|
77
|
+
<Input.TextInput
|
|
78
|
+
disabled
|
|
79
|
+
value={functionUrl}
|
|
80
|
+
onChange={(event) => {
|
|
81
|
+
fn.name = event.target.value;
|
|
82
|
+
}}
|
|
83
|
+
/>
|
|
84
|
+
<Button onClick={handleCopy}>
|
|
85
|
+
<Icon icon='ph--copy--regular' size={4} />
|
|
86
|
+
</Button>
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
</Input.Root>
|
|
90
|
+
<Input.Root>
|
|
91
|
+
<div role='none' className='flex flex-col gap-1'>
|
|
92
|
+
<Input.Label>{t('function binding label')}</Input.Label>
|
|
93
|
+
<Input.TextInput
|
|
94
|
+
placeholder={t('function binding placeholder')}
|
|
95
|
+
value={binding}
|
|
96
|
+
onChange={handleBindingChange}
|
|
97
|
+
onBlur={handleBindingBlur}
|
|
98
|
+
/>
|
|
99
|
+
</div>
|
|
100
|
+
</Input.Root>
|
|
101
|
+
</>
|
|
102
|
+
)}
|
|
103
|
+
</div>
|
|
104
|
+
);
|
|
105
|
+
};
|
package/src/components/index.ts
CHANGED
package/src/edge/functions.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { type DID } from 'iso-did/types';
|
|
|
7
7
|
import { Trigger } from '@dxos/async';
|
|
8
8
|
import { type Config } from '@dxos/client';
|
|
9
9
|
import { type Halo } from '@dxos/client-protocol';
|
|
10
|
-
import { type ObjectMeta } from '@dxos/echo-schema';
|
|
10
|
+
import { type JsonSchemaType, type ObjectMeta } from '@dxos/echo-schema';
|
|
11
11
|
import { invariant } from '@dxos/invariant';
|
|
12
12
|
import type { SpaceId } from '@dxos/keys';
|
|
13
13
|
import { log } from '@dxos/log';
|
|
@@ -27,6 +27,9 @@ export type UserFunctionUploadResult = {
|
|
|
27
27
|
errorMessage?: string;
|
|
28
28
|
functionId?: string;
|
|
29
29
|
functionVersionNumber?: number;
|
|
30
|
+
meta: {
|
|
31
|
+
inputSchema?: JsonSchemaType;
|
|
32
|
+
};
|
|
30
33
|
};
|
|
31
34
|
|
|
32
35
|
export type UploadWorkerProps = {
|
package/src/meta.ts
CHANGED
|
@@ -10,6 +10,7 @@ export default {
|
|
|
10
10
|
id: SCRIPT_PLUGIN,
|
|
11
11
|
name: 'Scripts',
|
|
12
12
|
description: 'Distributed functions.',
|
|
13
|
-
tags: ['experimental'],
|
|
14
13
|
icon: 'ph--code--regular',
|
|
14
|
+
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/experimental/plugin-explorer',
|
|
15
|
+
tags: ['experimental'],
|
|
15
16
|
} satisfies PluginMeta;
|
package/src/translations.ts
CHANGED
|
@@ -22,6 +22,11 @@ export default [
|
|
|
22
22
|
'toggle details label': 'Toggle details panel',
|
|
23
23
|
'authenticate action label': 'Authenticate functions service',
|
|
24
24
|
'authenticate button label': 'Authenticate',
|
|
25
|
+
'name label': 'Name',
|
|
26
|
+
'remote function settings heading': 'Remote Function',
|
|
27
|
+
'function url label': 'Invocation URL',
|
|
28
|
+
'function binding label': 'Function binding',
|
|
29
|
+
'function binding placeholder': 'BINDING',
|
|
25
30
|
},
|
|
26
31
|
},
|
|
27
32
|
},
|
package/src/types/index.ts
CHANGED
|
@@ -2,20 +2,21 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { ref, S, TypedObject } from '@dxos/echo-schema';
|
|
5
|
+
import { JsonSchemaType, ref, S, TypedObject } from '@dxos/echo-schema';
|
|
6
6
|
import { TextType } from '@dxos/plugin-markdown/types';
|
|
7
7
|
|
|
8
|
-
// TODO(burdon): Which is the outer type? I.e., in the navbar?
|
|
9
|
-
|
|
10
8
|
/**
|
|
11
9
|
* Source script.
|
|
12
10
|
*/
|
|
13
|
-
export class ScriptType extends TypedObject({
|
|
11
|
+
export class ScriptType extends TypedObject({
|
|
12
|
+
typename: 'dxos.org/type/Script',
|
|
13
|
+
version: '0.1.0',
|
|
14
|
+
})({
|
|
14
15
|
// TODO(burdon): Change to URI?
|
|
15
16
|
name: S.optional(S.String),
|
|
16
17
|
description: S.optional(S.String),
|
|
17
18
|
source: ref(TextType),
|
|
18
|
-
// TODO(burdon): Change to
|
|
19
|
+
// TODO(burdon): Change to hash of deployed content.
|
|
19
20
|
// Whether source has changed since last deploy.
|
|
20
21
|
changed: S.optional(S.Boolean),
|
|
21
22
|
}) {}
|
|
@@ -23,7 +24,11 @@ export class ScriptType extends TypedObject({ typename: 'dxos.org/type/Script',
|
|
|
23
24
|
/**
|
|
24
25
|
* Function deployment.
|
|
25
26
|
*/
|
|
26
|
-
export class FunctionType extends TypedObject({
|
|
27
|
+
export class FunctionType extends TypedObject({
|
|
28
|
+
typename: 'dxos.org/type/Function',
|
|
29
|
+
version: '0.1.0',
|
|
30
|
+
})({
|
|
31
|
+
// TODO(burdon): Change to id?
|
|
27
32
|
name: S.optional(S.String),
|
|
28
33
|
version: S.Number,
|
|
29
34
|
// Local binding to a function name.
|
|
@@ -31,4 +36,5 @@ export class FunctionType extends TypedObject({ typename: 'dxos.org/type/Functio
|
|
|
31
36
|
binding: S.optional(S.String),
|
|
32
37
|
// Reference to a source script if it exists within ECHO.
|
|
33
38
|
source: S.optional(ref(ScriptType)),
|
|
39
|
+
inputSchema: S.optional(JsonSchemaType),
|
|
34
40
|
}) {}
|