@dxos/plugin-automation 0.8.2-main.f11618f → 0.8.2-staging.7ac8446
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/{chunk-NGG4ICAQ.mjs → AutomationPanel-YAHFXQX6.mjs} +12 -13
- package/dist/lib/browser/AutomationPanel-YAHFXQX6.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-ND64CHOM.mjs → app-graph-builder-K3BIQFWW.mjs} +1 -42
- package/dist/lib/browser/app-graph-builder-K3BIQFWW.mjs.map +7 -0
- package/dist/lib/browser/chunk-MT3FZH4V.mjs +8 -0
- package/dist/lib/browser/chunk-MT3FZH4V.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +17 -23
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-4QQSJR4A.mjs +42 -0
- package/dist/lib/browser/react-surface-4QQSJR4A.mjs.map +7 -0
- package/dist/lib/node/{chunk-SRXHHBDE.cjs → AutomationPanel-ZKAMIU6O.cjs} +14 -19
- package/dist/lib/node/AutomationPanel-ZKAMIU6O.cjs.map +7 -0
- package/dist/lib/node/{app-graph-builder-TVFR6RXO.cjs → app-graph-builder-HO4FPGZ5.cjs} +4 -45
- package/dist/lib/node/app-graph-builder-HO4FPGZ5.cjs.map +7 -0
- package/dist/lib/node/{chunk-L5TWLPGA.cjs → chunk-AGJ6XTDN.cjs} +7 -16
- package/dist/lib/node/chunk-AGJ6XTDN.cjs.map +7 -0
- package/dist/lib/node/index.cjs +17 -23
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{react-surface-PCZCHIET.cjs → react-surface-52M54VWV.cjs} +12 -36
- package/dist/lib/node/react-surface-52M54VWV.cjs.map +7 -0
- package/dist/lib/node-esm/{chunk-HMYAQLGF.mjs → AutomationPanel-XF7YPSKM.mjs} +12 -13
- package/dist/lib/node-esm/AutomationPanel-XF7YPSKM.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-NYLOXWVV.mjs → app-graph-builder-XCJR33VS.mjs} +1 -42
- package/dist/lib/node-esm/app-graph-builder-XCJR33VS.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-OA75PSGH.mjs +10 -0
- package/dist/lib/node-esm/chunk-OA75PSGH.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +17 -23
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-surface-MGKM3OO3.mjs +43 -0
- package/dist/lib/node-esm/react-surface-MGKM3OO3.mjs.map +7 -0
- package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +0 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +3 -6
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/index.d.ts +0 -1
- package/dist/types/src/components/AutomationPanel/index.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -8
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +0 -8
- package/dist/types/src/translations.d.ts.map +1 -1
- package/package.json +24 -29
- package/src/AutomationPlugin.tsx +9 -4
- package/src/capabilities/app-graph-builder.ts +0 -31
- package/src/capabilities/index.ts +0 -1
- package/src/capabilities/react-surface.tsx +7 -31
- package/src/components/AutomationPanel/AutomationPanel.stories.tsx +4 -4
- package/src/components/AutomationPanel/AutomationPanel.tsx +63 -62
- package/src/components/AutomationPanel/index.ts +0 -2
- package/src/components/TriggerEditor/TriggerEditor.stories.tsx +3 -3
- package/src/components/index.ts +0 -3
- package/src/translations.ts +1 -10
- package/dist/lib/browser/AutomationContainer-KEQ5RNIW.mjs +0 -34
- package/dist/lib/browser/AutomationContainer-KEQ5RNIW.mjs.map +0 -7
- package/dist/lib/browser/AutomationPanel-G3OB6ELR.mjs +0 -11
- package/dist/lib/browser/AutomationPanel-G3OB6ELR.mjs.map +0 -7
- package/dist/lib/browser/FunctionsContainer-STXBW4CX.mjs +0 -33
- package/dist/lib/browser/FunctionsContainer-STXBW4CX.mjs.map +0 -7
- package/dist/lib/browser/FunctionsPanel-JJPLIAJW.mjs +0 -10
- package/dist/lib/browser/FunctionsPanel-JJPLIAJW.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-ND64CHOM.mjs.map +0 -7
- package/dist/lib/browser/chunk-65VL4EYS.mjs +0 -88
- package/dist/lib/browser/chunk-65VL4EYS.mjs.map +0 -7
- package/dist/lib/browser/chunk-FCLWFVFX.mjs +0 -39
- package/dist/lib/browser/chunk-FCLWFVFX.mjs.map +0 -7
- package/dist/lib/browser/chunk-NGG4ICAQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-QJPKWYTL.mjs +0 -14
- package/dist/lib/browser/chunk-QJPKWYTL.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-SNIAQ7V5.mjs +0 -78
- package/dist/lib/browser/intent-resolver-SNIAQ7V5.mjs.map +0 -7
- package/dist/lib/browser/react-surface-L22QIANU.mjs +0 -68
- package/dist/lib/browser/react-surface-L22QIANU.mjs.map +0 -7
- package/dist/lib/browser/types.mjs +0 -8
- package/dist/lib/browser/types.mjs.map +0 -7
- package/dist/lib/node/AutomationContainer-E5I76FPP.cjs +0 -62
- package/dist/lib/node/AutomationContainer-E5I76FPP.cjs.map +0 -7
- package/dist/lib/node/AutomationPanel-YLXAFJDP.cjs +0 -32
- package/dist/lib/node/AutomationPanel-YLXAFJDP.cjs.map +0 -7
- package/dist/lib/node/FunctionsContainer-3HCURMEB.cjs +0 -61
- package/dist/lib/node/FunctionsContainer-3HCURMEB.cjs.map +0 -7
- package/dist/lib/node/FunctionsPanel-SYIZHPGU.cjs +0 -31
- package/dist/lib/node/FunctionsPanel-SYIZHPGU.cjs.map +0 -7
- package/dist/lib/node/app-graph-builder-TVFR6RXO.cjs.map +0 -7
- package/dist/lib/node/chunk-BSK5SHTR.cjs +0 -116
- package/dist/lib/node/chunk-BSK5SHTR.cjs.map +0 -7
- package/dist/lib/node/chunk-L5TWLPGA.cjs.map +0 -7
- package/dist/lib/node/chunk-PSIJDHAX.cjs +0 -58
- package/dist/lib/node/chunk-PSIJDHAX.cjs.map +0 -7
- package/dist/lib/node/chunk-SRXHHBDE.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-A44BNFEG.cjs +0 -94
- package/dist/lib/node/intent-resolver-A44BNFEG.cjs.map +0 -7
- package/dist/lib/node/react-surface-PCZCHIET.cjs.map +0 -7
- package/dist/lib/node/types.cjs +0 -30
- package/dist/lib/node/types.cjs.map +0 -7
- package/dist/lib/node-esm/AutomationContainer-22PUFPSE.mjs +0 -35
- package/dist/lib/node-esm/AutomationContainer-22PUFPSE.mjs.map +0 -7
- package/dist/lib/node-esm/AutomationPanel-6UXIAJVS.mjs +0 -12
- package/dist/lib/node-esm/AutomationPanel-6UXIAJVS.mjs.map +0 -7
- package/dist/lib/node-esm/FunctionsContainer-XG5WVAN3.mjs +0 -34
- package/dist/lib/node-esm/FunctionsContainer-XG5WVAN3.mjs.map +0 -7
- package/dist/lib/node-esm/FunctionsPanel-J3QGUESH.mjs +0 -11
- package/dist/lib/node-esm/FunctionsPanel-J3QGUESH.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-NYLOXWVV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4UPGANGV.mjs +0 -89
- package/dist/lib/node-esm/chunk-4UPGANGV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HMYAQLGF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-TMMB5ETD.mjs +0 -16
- package/dist/lib/node-esm/chunk-TMMB5ETD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YYBCQXB2.mjs +0 -40
- package/dist/lib/node-esm/chunk-YYBCQXB2.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-JFLTVJ7D.mjs +0 -79
- package/dist/lib/node-esm/intent-resolver-JFLTVJ7D.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-VSO4NWC6.mjs +0 -69
- package/dist/lib/node-esm/react-surface-VSO4NWC6.mjs.map +0 -7
- package/dist/lib/node-esm/types.mjs +0 -9
- package/dist/lib/node-esm/types.mjs.map +0 -7
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/components/AutomationContainer.d.ts +0 -7
- package/dist/types/src/components/AutomationContainer.d.ts.map +0 -1
- package/dist/types/src/components/FunctionsContainer.d.ts +0 -7
- package/dist/types/src/components/FunctionsContainer.d.ts.map +0 -1
- package/dist/types/src/components/FunctionsPanel/FunctionsPanel.d.ts +0 -7
- package/dist/types/src/components/FunctionsPanel/FunctionsPanel.d.ts.map +0 -1
- package/dist/types/src/components/FunctionsPanel/index.d.ts +0 -4
- package/dist/types/src/components/FunctionsPanel/index.d.ts.map +0 -1
- package/dist/types/src/types.d.ts +0 -25
- package/dist/types/src/types.d.ts.map +0 -1
- package/src/capabilities/intent-resolver.ts +0 -76
- package/src/components/AutomationContainer.tsx +0 -31
- package/src/components/FunctionsContainer.tsx +0 -31
- package/src/components/FunctionsPanel/FunctionsPanel.tsx +0 -95
- package/src/components/FunctionsPanel/index.ts +0 -8
- package/src/types.ts +0 -32
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-automation",
|
|
3
|
-
"version": "0.8.2-
|
|
3
|
+
"version": "0.8.2-staging.7ac8446",
|
|
4
4
|
"description": "Prompt chain plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -13,11 +13,6 @@
|
|
|
13
13
|
"types": "./dist/types/src/index.d.ts",
|
|
14
14
|
"browser": "./dist/lib/browser/index.mjs",
|
|
15
15
|
"node": "./dist/lib/node-esm/index.mjs"
|
|
16
|
-
},
|
|
17
|
-
"./types": {
|
|
18
|
-
"types": "./dist/types/src/types.d.ts",
|
|
19
|
-
"browser": "./dist/lib/browser/types.mjs",
|
|
20
|
-
"node": "./dist/lib/node-esm/types.mjs"
|
|
21
16
|
}
|
|
22
17
|
},
|
|
23
18
|
"types": "dist/types/src/index.d.ts",
|
|
@@ -31,24 +26,24 @@
|
|
|
31
26
|
],
|
|
32
27
|
"dependencies": {
|
|
33
28
|
"@preact/signals-core": "^1.6.0",
|
|
34
|
-
"@dxos/
|
|
35
|
-
"@dxos/
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/functions": "0.8.2-
|
|
39
|
-
"@dxos/invariant": "0.8.2-
|
|
40
|
-
"@dxos/live-object": "0.8.2-
|
|
41
|
-
"@dxos/log": "0.8.2-
|
|
42
|
-
"@dxos/plugin-client": "0.8.2-
|
|
43
|
-
"@dxos/plugin-
|
|
44
|
-
"@dxos/plugin-
|
|
45
|
-
"@dxos/plugin-script": "0.8.2-
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/react-ui-form": "0.8.2-
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/react-ui-stack": "0.8.2-
|
|
51
|
-
"@dxos/
|
|
29
|
+
"@dxos/async": "0.8.2-staging.7ac8446",
|
|
30
|
+
"@dxos/app-framework": "0.8.2-staging.7ac8446",
|
|
31
|
+
"@dxos/conductor": "0.8.2-staging.7ac8446",
|
|
32
|
+
"@dxos/echo-schema": "0.8.2-staging.7ac8446",
|
|
33
|
+
"@dxos/functions": "0.8.2-staging.7ac8446",
|
|
34
|
+
"@dxos/invariant": "0.8.2-staging.7ac8446",
|
|
35
|
+
"@dxos/live-object": "0.8.2-staging.7ac8446",
|
|
36
|
+
"@dxos/log": "0.8.2-staging.7ac8446",
|
|
37
|
+
"@dxos/plugin-client": "0.8.2-staging.7ac8446",
|
|
38
|
+
"@dxos/plugin-deck": "0.8.2-staging.7ac8446",
|
|
39
|
+
"@dxos/plugin-graph": "0.8.2-staging.7ac8446",
|
|
40
|
+
"@dxos/plugin-script": "0.8.2-staging.7ac8446",
|
|
41
|
+
"@dxos/plugin-space": "0.8.2-staging.7ac8446",
|
|
42
|
+
"@dxos/react-client": "0.8.2-staging.7ac8446",
|
|
43
|
+
"@dxos/react-ui-form": "0.8.2-staging.7ac8446",
|
|
44
|
+
"@dxos/react-ui-list": "0.8.2-staging.7ac8446",
|
|
45
|
+
"@dxos/react-ui-stack": "0.8.2-staging.7ac8446",
|
|
46
|
+
"@dxos/util": "0.8.2-staging.7ac8446"
|
|
52
47
|
},
|
|
53
48
|
"devDependencies": {
|
|
54
49
|
"@types/react": "~18.2.0",
|
|
@@ -56,15 +51,15 @@
|
|
|
56
51
|
"react": "~18.2.0",
|
|
57
52
|
"react-dom": "~18.2.0",
|
|
58
53
|
"vite": "5.4.7",
|
|
59
|
-
"@dxos/react-ui": "0.8.2-
|
|
60
|
-
"@dxos/react-ui-theme": "0.8.2-
|
|
61
|
-
"@dxos/storybook-utils": "0.8.2-
|
|
54
|
+
"@dxos/react-ui": "0.8.2-staging.7ac8446",
|
|
55
|
+
"@dxos/react-ui-theme": "0.8.2-staging.7ac8446",
|
|
56
|
+
"@dxos/storybook-utils": "0.8.2-staging.7ac8446"
|
|
62
57
|
},
|
|
63
58
|
"peerDependencies": {
|
|
64
59
|
"react": "~18.2.0",
|
|
65
60
|
"react-dom": "~18.2.0",
|
|
66
|
-
"@dxos/react-ui": "0.8.2-
|
|
67
|
-
"@dxos/react-ui-theme": "0.8.2-
|
|
61
|
+
"@dxos/react-ui": "0.8.2-staging.7ac8446",
|
|
62
|
+
"@dxos/react-ui-theme": "0.8.2-staging.7ac8446"
|
|
68
63
|
},
|
|
69
64
|
"publishConfig": {
|
|
70
65
|
"access": "public"
|
package/src/AutomationPlugin.tsx
CHANGED
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
import { Capabilities, contributes, defineModule, definePlugin, Events } from '@dxos/app-framework';
|
|
6
6
|
import { FunctionType, FunctionTrigger } from '@dxos/functions/types';
|
|
7
7
|
import { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';
|
|
8
|
+
import { SpaceCapabilities, SpaceEvents } from '@dxos/plugin-space';
|
|
8
9
|
|
|
9
|
-
import { AppGraphBuilder,
|
|
10
|
+
import { AppGraphBuilder, ReactSurface } from './capabilities';
|
|
10
11
|
import { meta } from './meta';
|
|
11
12
|
import translations from './translations';
|
|
12
13
|
|
|
@@ -28,9 +29,13 @@ export const AutomationPlugin = () =>
|
|
|
28
29
|
activate: AppGraphBuilder,
|
|
29
30
|
}),
|
|
30
31
|
defineModule({
|
|
31
|
-
id: `${meta.id}/module/
|
|
32
|
-
activatesOn:
|
|
33
|
-
activate:
|
|
32
|
+
id: `${meta.id}/module/space-settings`,
|
|
33
|
+
activatesOn: SpaceEvents.SetupSettingsPanel,
|
|
34
|
+
activate: () =>
|
|
35
|
+
contributes(SpaceCapabilities.SettingsSection, {
|
|
36
|
+
id: 'automation',
|
|
37
|
+
label: ['automation panel label', { ns: meta.id }],
|
|
38
|
+
}),
|
|
34
39
|
}),
|
|
35
40
|
defineModule({
|
|
36
41
|
id: `${meta.id}/module/react-surface`,
|
|
@@ -8,42 +8,11 @@ import { ScriptType } from '@dxos/functions';
|
|
|
8
8
|
import { PLANK_COMPANION_TYPE, ATTENDABLE_PATH_SEPARATOR } from '@dxos/plugin-deck/types';
|
|
9
9
|
import { createExtension, type Node } from '@dxos/plugin-graph';
|
|
10
10
|
import { SCRIPT_PLUGIN } from '@dxos/plugin-script/types';
|
|
11
|
-
import { SPACE_PLUGIN } from '@dxos/plugin-space';
|
|
12
11
|
|
|
13
12
|
import { meta } from '../meta';
|
|
14
13
|
|
|
15
14
|
export default (context: PluginsContext) =>
|
|
16
15
|
contributes(Capabilities.AppGraphBuilder, [
|
|
17
|
-
createExtension({
|
|
18
|
-
id: `${meta.id}/space-settings-automation`,
|
|
19
|
-
filter: (node): node is Node<null> => node.type === `${SPACE_PLUGIN}/settings`,
|
|
20
|
-
connector: ({ node }) => [
|
|
21
|
-
{
|
|
22
|
-
id: `automation-${node.id}`,
|
|
23
|
-
type: `${meta.id}/space-settings-automation`,
|
|
24
|
-
data: `${meta.id}/space-settings-automation`,
|
|
25
|
-
properties: {
|
|
26
|
-
label: ['automation panel label', { ns: meta.id }],
|
|
27
|
-
icon: 'ph--lightning--regular',
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
],
|
|
31
|
-
}),
|
|
32
|
-
createExtension({
|
|
33
|
-
id: `${meta.id}/space-settings-functions`,
|
|
34
|
-
filter: (node): node is Node<null> => node.type === `${SPACE_PLUGIN}/settings`,
|
|
35
|
-
connector: ({ node }) => [
|
|
36
|
-
{
|
|
37
|
-
id: `functions-${node.id}`,
|
|
38
|
-
type: `${meta.id}/space-settings-functions`,
|
|
39
|
-
data: `${meta.id}/space-settings-functions`,
|
|
40
|
-
properties: {
|
|
41
|
-
label: ['functions panel label', { ns: meta.id }],
|
|
42
|
-
icon: 'ph--function--regular',
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
}),
|
|
47
16
|
createExtension({
|
|
48
17
|
id: `${SCRIPT_PLUGIN}/script-companion`,
|
|
49
18
|
filter: (node): node is Node<ScriptType> => isInstanceOf(ScriptType, node.data),
|
|
@@ -4,46 +4,22 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import { Capabilities, contributes, createSurface
|
|
7
|
+
import { Capabilities, contributes, createSurface } from '@dxos/app-framework';
|
|
8
8
|
import { isInstanceOf } from '@dxos/echo-schema';
|
|
9
9
|
import { ScriptType } from '@dxos/functions/types';
|
|
10
|
-
import { getSpace,
|
|
10
|
+
import { getSpace, isSpace, type Space } from '@dxos/react-client/echo';
|
|
11
11
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import { AutomationPanel } from '../components';
|
|
14
14
|
import { meta } from '../meta';
|
|
15
15
|
|
|
16
16
|
export default () =>
|
|
17
17
|
contributes(Capabilities.ReactSurface, [
|
|
18
18
|
createSurface({
|
|
19
|
-
id: `${meta.id}/
|
|
20
|
-
role: '
|
|
21
|
-
filter: (data): data is { subject:
|
|
22
|
-
component: () => {
|
|
23
|
-
const layout = useLayout();
|
|
24
|
-
const { spaceId } = parseId(layout.workspace);
|
|
25
|
-
const space = useSpace(spaceId);
|
|
26
|
-
if (!space || !spaceId) {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return <AutomationContainer space={space} />;
|
|
31
|
-
},
|
|
32
|
-
}),
|
|
33
|
-
createSurface({
|
|
34
|
-
id: `${meta.id}/space-settings-functions`,
|
|
35
|
-
role: 'article',
|
|
36
|
-
filter: (data): data is { subject: string } => data.subject === `${meta.id}/space-settings-functions`,
|
|
37
|
-
component: () => {
|
|
38
|
-
const layout = useLayout();
|
|
39
|
-
const { spaceId } = parseId(layout.workspace);
|
|
40
|
-
const space = useSpace(spaceId);
|
|
41
|
-
if (!space || !spaceId) {
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return <FunctionsContainer space={space} />;
|
|
46
|
-
},
|
|
19
|
+
id: `${meta.id}/automation`,
|
|
20
|
+
role: 'space-settings--automation',
|
|
21
|
+
filter: (data): data is { subject: Space } => isSpace(data.subject),
|
|
22
|
+
component: ({ data }) => <AutomationPanel space={data.subject} />,
|
|
47
23
|
}),
|
|
48
24
|
createSurface({
|
|
49
25
|
id: `${meta.id}/companion/automation`,
|
|
@@ -8,7 +8,7 @@ import { type Meta } from '@storybook/react';
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
|
|
10
10
|
import { FunctionType, FunctionTrigger } from '@dxos/functions/types';
|
|
11
|
-
import {
|
|
11
|
+
import { create, useSpaces } from '@dxos/react-client/echo';
|
|
12
12
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
13
13
|
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
14
14
|
|
|
@@ -21,7 +21,7 @@ const DefaultStory = () => {
|
|
|
21
21
|
const space = spaces[1];
|
|
22
22
|
|
|
23
23
|
return (
|
|
24
|
-
<div role='none' className='w-
|
|
24
|
+
<div role='none' className='flex w-[350px] border border-separator overflow-hidden'>
|
|
25
25
|
<AutomationPanel space={space} />
|
|
26
26
|
</div>
|
|
27
27
|
);
|
|
@@ -38,11 +38,11 @@ const meta: Meta = {
|
|
|
38
38
|
types: [FunctionType, FunctionTrigger],
|
|
39
39
|
onSpaceCreated: ({ space }) => {
|
|
40
40
|
for (const fn of functions) {
|
|
41
|
-
space.db.add(
|
|
41
|
+
space.db.add(create(FunctionType, fn));
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
}),
|
|
45
|
-
withLayout({ fullscreen: true, tooltips: true, classNames: 'flex
|
|
45
|
+
withLayout({ fullscreen: true, tooltips: true, classNames: 'flex justify-center m-2' }),
|
|
46
46
|
withTheme,
|
|
47
47
|
],
|
|
48
48
|
parameters: {
|
|
@@ -14,10 +14,11 @@ import {
|
|
|
14
14
|
ScriptType,
|
|
15
15
|
} from '@dxos/functions/types';
|
|
16
16
|
import { type Client, useClient } from '@dxos/react-client';
|
|
17
|
-
import {
|
|
17
|
+
import { create, Filter, useQuery, type Space, type ReactiveObject, getSpace } from '@dxos/react-client/echo';
|
|
18
18
|
import { Clipboard, IconButton, Input, Separator, useTranslation } from '@dxos/react-ui';
|
|
19
19
|
import { ControlItem, controlItemClasses } from '@dxos/react-ui-form';
|
|
20
20
|
import { List } from '@dxos/react-ui-list';
|
|
21
|
+
import { StackItem } from '@dxos/react-ui-stack';
|
|
21
22
|
import { ghostHover, mx } from '@dxos/react-ui-theme';
|
|
22
23
|
|
|
23
24
|
import { AUTOMATION_PLUGIN } from '../../meta';
|
|
@@ -27,20 +28,18 @@ const grid = 'grid grid-cols-[40px_1fr_32px] min-bs-[2.5rem]';
|
|
|
27
28
|
|
|
28
29
|
export type AutomationPanelProps = {
|
|
29
30
|
space: Space;
|
|
30
|
-
object?:
|
|
31
|
-
initialTrigger?: FunctionTriggerType;
|
|
32
|
-
onDone?: () => void;
|
|
31
|
+
object?: ReactiveObject<any>;
|
|
33
32
|
};
|
|
34
33
|
|
|
35
34
|
// TODO(burdon): Factor out common layout with ViewEditor.
|
|
36
|
-
export const AutomationPanel = ({ space, object
|
|
35
|
+
export const AutomationPanel = ({ space, object }: AutomationPanelProps) => {
|
|
37
36
|
const { t } = useTranslation(AUTOMATION_PLUGIN);
|
|
38
37
|
const client = useClient();
|
|
39
38
|
const triggers = useQuery(space, Filter.schema(FunctionTrigger));
|
|
40
39
|
const functions = useQuery(space, Filter.schema(FunctionType));
|
|
41
40
|
const scripts = useQuery(space, Filter.schema(ScriptType));
|
|
42
41
|
|
|
43
|
-
const [trigger, setTrigger] = useState<FunctionTriggerType
|
|
42
|
+
const [trigger, setTrigger] = useState<FunctionTriggerType>();
|
|
44
43
|
const [selected, setSelected] = useState<FunctionTrigger>();
|
|
45
44
|
|
|
46
45
|
const handleSelect = (trigger: FunctionTrigger) => {
|
|
@@ -50,7 +49,7 @@ export const AutomationPanel = ({ space, object, initialTrigger, onDone }: Autom
|
|
|
50
49
|
};
|
|
51
50
|
|
|
52
51
|
const handleAdd = () => {
|
|
53
|
-
setTrigger(
|
|
52
|
+
setTrigger(create(FunctionTriggerSchema, {}));
|
|
54
53
|
setSelected(undefined);
|
|
55
54
|
};
|
|
56
55
|
|
|
@@ -64,74 +63,76 @@ export const AutomationPanel = ({ space, object, initialTrigger, onDone }: Autom
|
|
|
64
63
|
if (selected) {
|
|
65
64
|
Object.assign(selected, trigger);
|
|
66
65
|
} else {
|
|
67
|
-
space.db.add(
|
|
66
|
+
space.db.add(create(FunctionTrigger, trigger));
|
|
68
67
|
}
|
|
69
68
|
|
|
70
69
|
setTrigger(undefined);
|
|
71
70
|
setSelected(undefined);
|
|
72
|
-
onDone?.();
|
|
73
71
|
};
|
|
74
72
|
|
|
75
73
|
const handleCancel: TriggerEditorProps['onCancel'] = () => {
|
|
76
74
|
setTrigger(undefined);
|
|
77
|
-
onDone?.();
|
|
78
75
|
};
|
|
79
76
|
|
|
80
77
|
return (
|
|
81
|
-
<
|
|
82
|
-
|
|
83
|
-
<
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
<
|
|
91
|
-
{triggers
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
<Input.Switch
|
|
101
|
-
checked={trigger.enabled}
|
|
102
|
-
onCheckedChange={(checked) => (trigger.enabled = checked)}
|
|
103
|
-
/>
|
|
104
|
-
</Input.Root>
|
|
105
|
-
|
|
106
|
-
<div className={'flex'}>
|
|
107
|
-
<List.ItemTitle
|
|
108
|
-
classNames='px-1 cursor-pointer w-0 shrink truncate'
|
|
109
|
-
onClick={() => handleSelect(trigger)}
|
|
78
|
+
<Clipboard.Provider>
|
|
79
|
+
<StackItem.Content classNames='block overflow-y-auto'>
|
|
80
|
+
<div className='flex flex-col w-full'>
|
|
81
|
+
{trigger ? (
|
|
82
|
+
<ControlItem title={t('trigger editor title')}>
|
|
83
|
+
<TriggerEditor space={space} trigger={trigger} onSave={handleSave} onCancel={handleCancel} />
|
|
84
|
+
</ControlItem>
|
|
85
|
+
) : (
|
|
86
|
+
<div role='none' className={controlItemClasses}>
|
|
87
|
+
<List.Root<FunctionTrigger> items={triggers} isItem={S.is(FunctionTrigger)} getId={(field) => field.id}>
|
|
88
|
+
{({ items: triggers }) => (
|
|
89
|
+
<div role='list' className='flex flex-col w-full'>
|
|
90
|
+
{triggers?.map((trigger) => {
|
|
91
|
+
const copyAction = getCopyAction(client, trigger);
|
|
92
|
+
return (
|
|
93
|
+
<List.Item<FunctionTrigger>
|
|
94
|
+
key={trigger.id}
|
|
95
|
+
item={trigger}
|
|
96
|
+
classNames={mx(grid, ghostHover, 'items-center', 'px-2')}
|
|
110
97
|
>
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
98
|
+
<Input.Root>
|
|
99
|
+
<Input.Switch
|
|
100
|
+
checked={trigger.enabled}
|
|
101
|
+
onCheckedChange={(checked) => (trigger.enabled = checked)}
|
|
102
|
+
/>
|
|
103
|
+
</Input.Root>
|
|
104
|
+
|
|
105
|
+
<div className={'flex'}>
|
|
106
|
+
<List.ItemTitle
|
|
107
|
+
classNames='px-1 cursor-pointer w-0 shrink truncate'
|
|
108
|
+
onClick={() => handleSelect(trigger)}
|
|
109
|
+
>
|
|
110
|
+
{getFunctionName(scripts, functions, trigger) ?? '∅'}
|
|
111
|
+
</List.ItemTitle>
|
|
112
|
+
|
|
113
|
+
{/* TODO: a better way to expose copy action */}
|
|
114
|
+
{copyAction && (
|
|
115
|
+
<Clipboard.IconButton
|
|
116
|
+
label={t(copyAction.translationKey)}
|
|
117
|
+
value={copyAction.contentProvider()}
|
|
118
|
+
/>
|
|
119
|
+
)}
|
|
120
|
+
</div>
|
|
121
|
+
|
|
122
|
+
<List.ItemDeleteButton onClick={() => handleDelete(trigger)} />
|
|
123
|
+
</List.Item>
|
|
124
|
+
);
|
|
125
|
+
})}
|
|
126
|
+
</div>
|
|
127
|
+
)}
|
|
128
|
+
</List.Root>
|
|
129
|
+
{triggers.length > 0 && <Separator classNames='mlb-4' />}
|
|
130
|
+
<IconButton icon='ph--plus--regular' label={t('new trigger label')} onClick={handleAdd} />
|
|
131
|
+
</div>
|
|
132
|
+
)}
|
|
132
133
|
</div>
|
|
133
|
-
|
|
134
|
-
</
|
|
134
|
+
</StackItem.Content>
|
|
135
|
+
</Clipboard.Provider>
|
|
135
136
|
);
|
|
136
137
|
};
|
|
137
138
|
|
|
@@ -8,7 +8,7 @@ import { type Meta } from '@storybook/react';
|
|
|
8
8
|
import React, { useEffect, useState } from 'react';
|
|
9
9
|
|
|
10
10
|
import { FunctionType, FunctionTrigger, TriggerKind } from '@dxos/functions/types';
|
|
11
|
-
import {
|
|
11
|
+
import { create } from '@dxos/live-object';
|
|
12
12
|
import { useSpaces } from '@dxos/react-client/echo';
|
|
13
13
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
14
14
|
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
@@ -26,7 +26,7 @@ const DefaultStory = () => {
|
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
const trigger = space.db.add(
|
|
29
|
+
const trigger = space.db.add(create(FunctionTrigger, { spec: { type: TriggerKind.Timer, cron: '' } }));
|
|
30
30
|
setTrigger(trigger);
|
|
31
31
|
}, [space]);
|
|
32
32
|
|
|
@@ -52,7 +52,7 @@ const meta: Meta = {
|
|
|
52
52
|
types: [FunctionType, FunctionTrigger],
|
|
53
53
|
onSpaceCreated: ({ space }) => {
|
|
54
54
|
for (const fn of functions) {
|
|
55
|
-
space.db.add(
|
|
55
|
+
space.db.add(create(FunctionType, fn));
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
58
|
}),
|
package/src/components/index.ts
CHANGED
|
@@ -6,7 +6,4 @@ import { lazy } from 'react';
|
|
|
6
6
|
|
|
7
7
|
export * from './TriggerEditor';
|
|
8
8
|
|
|
9
|
-
export const AutomationContainer = lazy(() => import('./AutomationContainer'));
|
|
10
9
|
export const AutomationPanel = lazy(() => import('./AutomationPanel'));
|
|
11
|
-
export const FunctionsContainer = lazy(() => import('./FunctionsContainer'));
|
|
12
|
-
export const FunctionsPanel = lazy(() => import('./FunctionsPanel'));
|
package/src/translations.ts
CHANGED
|
@@ -11,17 +11,8 @@ export default [
|
|
|
11
11
|
'plugin name': 'Automation',
|
|
12
12
|
'automation panel label': 'Automations',
|
|
13
13
|
'script automation label': 'Automation',
|
|
14
|
-
'automation verbose label': 'Manage automations',
|
|
15
|
-
'automation description': 'You can manage all the triggers which automate your space here.',
|
|
16
14
|
|
|
17
|
-
'
|
|
18
|
-
'functions verbose label': 'Manage deployed functions',
|
|
19
|
-
'functions description': 'You can manage all the functions deployed from your space on EDGE here.',
|
|
20
|
-
'function copy id': 'Copy Function ID',
|
|
21
|
-
'no functions found': 'No functions found',
|
|
22
|
-
'go to function source button label': 'Show function source',
|
|
23
|
-
|
|
24
|
-
'trigger editor title': 'Configure Trigger',
|
|
15
|
+
'trigger editor title': 'New Trigger',
|
|
25
16
|
'new trigger label': 'Add Trigger',
|
|
26
17
|
'trigger type timer': 'Timer',
|
|
27
18
|
'trigger type webhook': 'Webhook',
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AutomationPanel
|
|
3
|
-
} from "./chunk-NGG4ICAQ.mjs";
|
|
4
|
-
import "./chunk-FALBBJNO.mjs";
|
|
5
|
-
import {
|
|
6
|
-
AUTOMATION_PLUGIN
|
|
7
|
-
} from "./chunk-WKKQV4PC.mjs";
|
|
8
|
-
|
|
9
|
-
// packages/plugins/plugin-automation/src/components/AutomationContainer.tsx
|
|
10
|
-
import React from "react";
|
|
11
|
-
import { useTranslation } from "@dxos/react-ui";
|
|
12
|
-
import { ControlSection, ControlPage } from "@dxos/react-ui-form";
|
|
13
|
-
import { StackItem } from "@dxos/react-ui-stack";
|
|
14
|
-
var AutomationContainer = ({ space }) => {
|
|
15
|
-
const { t } = useTranslation(AUTOMATION_PLUGIN);
|
|
16
|
-
return /* @__PURE__ */ React.createElement(StackItem.Content, {
|
|
17
|
-
classNames: "block overflow-y-auto"
|
|
18
|
-
}, /* @__PURE__ */ React.createElement(ControlPage, null, /* @__PURE__ */ React.createElement(ControlSection, {
|
|
19
|
-
title: t("automation verbose label", {
|
|
20
|
-
ns: AUTOMATION_PLUGIN
|
|
21
|
-
}),
|
|
22
|
-
description: t("automation description", {
|
|
23
|
-
ns: AUTOMATION_PLUGIN
|
|
24
|
-
})
|
|
25
|
-
}, /* @__PURE__ */ React.createElement(AutomationPanel, {
|
|
26
|
-
space
|
|
27
|
-
}))));
|
|
28
|
-
};
|
|
29
|
-
var AutomationContainer_default = AutomationContainer;
|
|
30
|
-
export {
|
|
31
|
-
AutomationContainer,
|
|
32
|
-
AutomationContainer_default as default
|
|
33
|
-
};
|
|
34
|
-
//# sourceMappingURL=AutomationContainer-KEQ5RNIW.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/AutomationContainer.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type Space } from '@dxos/react-client/echo';\nimport { useTranslation } from '@dxos/react-ui';\nimport { ControlSection, ControlPage } from '@dxos/react-ui-form';\nimport { StackItem } from '@dxos/react-ui-stack';\n\nimport { AutomationPanel } from './AutomationPanel';\nimport { AUTOMATION_PLUGIN } from '../meta';\n\nexport const AutomationContainer = ({ space }: { space: Space }) => {\n const { t } = useTranslation(AUTOMATION_PLUGIN);\n return (\n <StackItem.Content classNames='block overflow-y-auto'>\n <ControlPage>\n <ControlSection\n title={t('automation verbose label', { ns: AUTOMATION_PLUGIN })}\n description={t('automation description', { ns: AUTOMATION_PLUGIN })}\n >\n <AutomationPanel space={space} />\n </ControlSection>\n </ControlPage>\n </StackItem.Content>\n );\n};\n\nexport default AutomationContainer;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;AAIA,OAAOA,WAAW;AAGlB,SAASC,sBAAsB;AAC/B,SAASC,gBAAgBC,mBAAmB;AAC5C,SAASC,iBAAiB;AAKnB,IAAMC,sBAAsB,CAAC,EAAEC,MAAK,MAAoB;AAC7D,QAAM,EAAEC,EAAC,IAAKC,eAAeC,iBAAAA;AAC7B,SACE,sBAAA,cAACC,UAAUC,SAAO;IAACC,YAAW;KAC5B,sBAAA,cAACC,aAAAA,MACC,sBAAA,cAACC,gBAAAA;IACCC,OAAOR,EAAE,4BAA4B;MAAES,IAAIP;IAAkB,CAAA;IAC7DQ,aAAaV,EAAE,0BAA0B;MAAES,IAAIP;IAAkB,CAAA;KAEjE,sBAAA,cAACS,iBAAAA;IAAgBZ;;AAK3B;AAEA,IAAA,8BAAeD;",
|
|
6
|
-
"names": ["React", "useTranslation", "ControlSection", "ControlPage", "StackItem", "AutomationContainer", "space", "t", "useTranslation", "AUTOMATION_PLUGIN", "StackItem", "Content", "classNames", "ControlPage", "ControlSection", "title", "ns", "description", "AutomationPanel"]
|
|
7
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AutomationPanel,
|
|
3
|
-
AutomationPanel_default
|
|
4
|
-
} from "./chunk-NGG4ICAQ.mjs";
|
|
5
|
-
import "./chunk-FALBBJNO.mjs";
|
|
6
|
-
import "./chunk-WKKQV4PC.mjs";
|
|
7
|
-
export {
|
|
8
|
-
AutomationPanel,
|
|
9
|
-
AutomationPanel_default as default
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=AutomationPanel-G3OB6ELR.mjs.map
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
FunctionsPanel
|
|
3
|
-
} from "./chunk-65VL4EYS.mjs";
|
|
4
|
-
import {
|
|
5
|
-
AUTOMATION_PLUGIN
|
|
6
|
-
} from "./chunk-WKKQV4PC.mjs";
|
|
7
|
-
|
|
8
|
-
// packages/plugins/plugin-automation/src/components/FunctionsContainer.tsx
|
|
9
|
-
import React from "react";
|
|
10
|
-
import { useTranslation } from "@dxos/react-ui";
|
|
11
|
-
import { ControlPage, ControlSection } from "@dxos/react-ui-form";
|
|
12
|
-
import { StackItem } from "@dxos/react-ui-stack";
|
|
13
|
-
var FunctionsContainer = ({ space }) => {
|
|
14
|
-
const { t } = useTranslation(AUTOMATION_PLUGIN);
|
|
15
|
-
return /* @__PURE__ */ React.createElement(StackItem.Content, {
|
|
16
|
-
classNames: "block overflow-y-auto"
|
|
17
|
-
}, /* @__PURE__ */ React.createElement(ControlPage, null, /* @__PURE__ */ React.createElement(ControlSection, {
|
|
18
|
-
title: t("functions verbose label", {
|
|
19
|
-
ns: AUTOMATION_PLUGIN
|
|
20
|
-
}),
|
|
21
|
-
description: t("functions description", {
|
|
22
|
-
ns: AUTOMATION_PLUGIN
|
|
23
|
-
})
|
|
24
|
-
}, /* @__PURE__ */ React.createElement(FunctionsPanel, {
|
|
25
|
-
space
|
|
26
|
-
}))));
|
|
27
|
-
};
|
|
28
|
-
var FunctionsContainer_default = FunctionsContainer;
|
|
29
|
-
export {
|
|
30
|
-
FunctionsContainer,
|
|
31
|
-
FunctionsContainer_default as default
|
|
32
|
-
};
|
|
33
|
-
//# sourceMappingURL=FunctionsContainer-STXBW4CX.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/FunctionsContainer.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type Space } from '@dxos/react-client/echo';\nimport { useTranslation } from '@dxos/react-ui';\nimport { ControlPage, ControlSection } from '@dxos/react-ui-form';\nimport { StackItem } from '@dxos/react-ui-stack';\n\nimport { FunctionsPanel } from './FunctionsPanel';\nimport { AUTOMATION_PLUGIN } from '../meta';\n\nexport const FunctionsContainer = ({ space }: { space: Space }) => {\n const { t } = useTranslation(AUTOMATION_PLUGIN);\n return (\n <StackItem.Content classNames='block overflow-y-auto'>\n <ControlPage>\n <ControlSection\n title={t('functions verbose label', { ns: AUTOMATION_PLUGIN })}\n description={t('functions description', { ns: AUTOMATION_PLUGIN })}\n >\n <FunctionsPanel space={space} />\n </ControlSection>\n </ControlPage>\n </StackItem.Content>\n );\n};\n\nexport default FunctionsContainer;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;AAIA,OAAOA,WAAW;AAGlB,SAASC,sBAAsB;AAC/B,SAASC,aAAaC,sBAAsB;AAC5C,SAASC,iBAAiB;AAKnB,IAAMC,qBAAqB,CAAC,EAAEC,MAAK,MAAoB;AAC5D,QAAM,EAAEC,EAAC,IAAKC,eAAeC,iBAAAA;AAC7B,SACE,sBAAA,cAACC,UAAUC,SAAO;IAACC,YAAW;KAC5B,sBAAA,cAACC,aAAAA,MACC,sBAAA,cAACC,gBAAAA;IACCC,OAAOR,EAAE,2BAA2B;MAAES,IAAIP;IAAkB,CAAA;IAC5DQ,aAAaV,EAAE,yBAAyB;MAAES,IAAIP;IAAkB,CAAA;KAEhE,sBAAA,cAACS,gBAAAA;IAAeZ;;AAK1B;AAEA,IAAA,6BAAeD;",
|
|
6
|
-
"names": ["React", "useTranslation", "ControlPage", "ControlSection", "StackItem", "FunctionsContainer", "space", "t", "useTranslation", "AUTOMATION_PLUGIN", "StackItem", "Content", "classNames", "ControlPage", "ControlSection", "title", "ns", "description", "FunctionsPanel"]
|
|
7
|
-
}
|