@dxos/plugin-automation 0.6.14-main.8b352a0 → 0.6.14-staging.3e2eaca
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/{PromptContainer-RFMJXMUA.mjs → PromptContainer-3GUENQHE.mjs} +4 -4
- package/dist/lib/browser/{chunk-PSSWFA6A.mjs → chunk-2FOJUVYG.mjs} +3 -3
- package/dist/lib/browser/{chunk-GGA62V7D.mjs → chunk-J4SYTP4Y.mjs} +2 -2
- package/dist/lib/browser/{chunk-GGA62V7D.mjs.map → chunk-J4SYTP4Y.mjs.map} +2 -2
- package/dist/lib/browser/{chunk-3TNRXJTD.mjs → chunk-PQLGYMNY.mjs} +6 -2
- package/dist/lib/browser/{chunk-3TNRXJTD.mjs.map → chunk-PQLGYMNY.mjs.map} +3 -3
- package/dist/lib/browser/index.mjs +88 -44
- package/dist/lib/browser/index.mjs.map +3 -3
- 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/{PromptContainer-FRSY6FNL.cjs → PromptContainer-74ZRO4HK.cjs} +8 -8
- package/dist/lib/node/{chunk-E2H3AGKB.cjs → chunk-4TMTUB4X.cjs} +18 -18
- package/dist/lib/node/{chunk-UPPUTAPL.cjs → chunk-JSZ6PAYL.cjs} +9 -5
- package/dist/lib/node/{chunk-UPPUTAPL.cjs.map → chunk-JSZ6PAYL.cjs.map} +3 -3
- package/dist/lib/node/{chunk-N5IDAUFU.cjs → chunk-XS53UP75.cjs} +6 -6
- package/dist/lib/node/{chunk-N5IDAUFU.cjs.map → chunk-XS53UP75.cjs.map} +2 -2
- package/dist/lib/node/index.cjs +128 -84
- package/dist/lib/node/index.cjs.map +3 -3
- 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 +7 -7
- package/dist/lib/node/types/index.cjs.map +1 -1
- package/dist/lib/node-esm/{PromptContainer-4VHFPEQH.mjs → PromptContainer-5OK4GWIR.mjs} +4 -4
- package/dist/lib/node-esm/{chunk-UT6QKU6J.mjs → chunk-AAUSG7OA.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-UT6QKU6J.mjs.map → chunk-AAUSG7OA.mjs.map} +2 -2
- package/dist/lib/node-esm/{chunk-QAPWYK2P.mjs → chunk-B35UD3D7.mjs} +6 -2
- package/dist/lib/node-esm/{chunk-QAPWYK2P.mjs.map → chunk-B35UD3D7.mjs.map} +3 -3
- package/dist/lib/node-esm/{chunk-HFTXKLRR.mjs → chunk-FN6DOJZP.mjs} +3 -3
- package/dist/lib/node-esm/index.mjs +88 -44
- package/dist/lib/node-esm/index.mjs.map +3 -3
- 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/AutomationPlugin.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -0
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +14 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +2 -1
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/package.json +33 -31
- package/src/AutomationPlugin.tsx +10 -1
- package/src/components/AutomationPanel.tsx +2 -0
- package/src/components/TriggerEditor/TriggerEditor.tsx +59 -44
- package/src/meta.ts +3 -1
- package/src/translations.ts +16 -6
- package/src/types/types.ts +3 -1
- /package/dist/lib/browser/{PromptContainer-RFMJXMUA.mjs.map → PromptContainer-3GUENQHE.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-PSSWFA6A.mjs.map → chunk-2FOJUVYG.mjs.map} +0 -0
- /package/dist/lib/node/{PromptContainer-FRSY6FNL.cjs.map → PromptContainer-74ZRO4HK.cjs.map} +0 -0
- /package/dist/lib/node/{chunk-E2H3AGKB.cjs.map → chunk-4TMTUB4X.cjs.map} +0 -0
- /package/dist/lib/node-esm/{PromptContainer-4VHFPEQH.mjs.map → PromptContainer-5OK4GWIR.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-HFTXKLRR.mjs.map → chunk-FN6DOJZP.mjs.map} +0 -0
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,iBAAiB,+BAA+B,CAAC
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,iBAAiB,+BAA+B,CAAC;;;;;;;;;AAE9D,wBAOuB"}
|
|
@@ -10,6 +10,20 @@ declare const _default: {
|
|
|
10
10
|
'template placeholder': string;
|
|
11
11
|
'value placeholder': string;
|
|
12
12
|
'select preset template placeholder': string;
|
|
13
|
+
'open automation panel label': string;
|
|
14
|
+
'function select label': string;
|
|
15
|
+
'function select placeholder': string;
|
|
16
|
+
'function enabled': string;
|
|
17
|
+
'trigger select label': string;
|
|
18
|
+
'trigger select placeholder': string;
|
|
19
|
+
'trigger type subscription': string;
|
|
20
|
+
'trigger type timer': string;
|
|
21
|
+
'trigger type webhook': string;
|
|
22
|
+
'trigger type websocket': string;
|
|
23
|
+
'trigger filter': string;
|
|
24
|
+
'trigger cron': string;
|
|
25
|
+
'trigger method': string;
|
|
26
|
+
'trigger endpoint': string;
|
|
13
27
|
};
|
|
14
28
|
};
|
|
15
29
|
}[];
|
|
@@ -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,wBAiCE"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { GraphBuilderProvides, IntentResolverProvides, MetadataRecordsProvides, SurfaceProvides, TranslationsProvides } from '@dxos/app-framework';
|
|
2
2
|
import { type SchemaProvides } from '@dxos/plugin-client';
|
|
3
|
+
import { type PanelProvides } from '@dxos/plugin-deck/types';
|
|
3
4
|
export declare enum AutomationAction {
|
|
4
5
|
CREATE = "dxos.org/plugin/automation/action/create"
|
|
5
6
|
}
|
|
6
|
-
export type AutomationPluginProvides = SurfaceProvides & IntentResolverProvides & MetadataRecordsProvides & TranslationsProvides & GraphBuilderProvides & SchemaProvides;
|
|
7
|
+
export type AutomationPluginProvides = SurfaceProvides & IntentResolverProvides & MetadataRecordsProvides & TranslationsProvides & GraphBuilderProvides & SchemaProvides & PanelProvides;
|
|
7
8
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types/types.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACvB,eAAe,EACf,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types/types.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACvB,eAAe,EACf,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAM7D,oBAAY,gBAAgB;IAC1B,MAAM,6CAAgC;CACvC;AAED,MAAM,MAAM,wBAAwB,GAAG,eAAe,GACpD,sBAAsB,GACtB,uBAAuB,GACvB,oBAAoB,GACpB,oBAAoB,GACpB,cAAc,GACd,aAAa,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-automation",
|
|
3
|
-
"version": "0.6.14-
|
|
3
|
+
"version": "0.6.14-staging.3e2eaca",
|
|
4
4
|
"description": "Prompt chain plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -47,29 +47,31 @@
|
|
|
47
47
|
"@effect/schema": "^0.75.1",
|
|
48
48
|
"@preact/signals-core": "^1.6.0",
|
|
49
49
|
"lodash.get": "^4.4.2",
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/chain": "0.6.14-
|
|
53
|
-
"@dxos/context": "0.6.14-
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/echo-schema": "0.6.14-
|
|
56
|
-
"@dxos/
|
|
57
|
-
"@dxos/
|
|
58
|
-
"@dxos/keys": "0.6.14-
|
|
59
|
-
"@dxos/
|
|
60
|
-
"@dxos/
|
|
61
|
-
"@dxos/plugin-chess": "0.6.14-
|
|
62
|
-
"@dxos/plugin-
|
|
63
|
-
"@dxos/plugin-
|
|
64
|
-
"@dxos/plugin-
|
|
65
|
-
"@dxos/plugin-
|
|
66
|
-
"@dxos/plugin-
|
|
67
|
-
"@dxos/plugin-sketch": "0.6.14-
|
|
68
|
-
"@dxos/plugin-space": "0.6.14-
|
|
69
|
-
"@dxos/
|
|
70
|
-
"@dxos/
|
|
71
|
-
"@dxos/
|
|
72
|
-
"@dxos/
|
|
50
|
+
"@dxos/async": "0.6.14-staging.3e2eaca",
|
|
51
|
+
"@dxos/app-framework": "0.6.14-staging.3e2eaca",
|
|
52
|
+
"@dxos/chain": "0.6.14-staging.3e2eaca",
|
|
53
|
+
"@dxos/context": "0.6.14-staging.3e2eaca",
|
|
54
|
+
"@dxos/functions": "0.6.14-staging.3e2eaca",
|
|
55
|
+
"@dxos/echo-schema": "0.6.14-staging.3e2eaca",
|
|
56
|
+
"@dxos/invariant": "0.6.14-staging.3e2eaca",
|
|
57
|
+
"@dxos/echo-db": "0.6.14-staging.3e2eaca",
|
|
58
|
+
"@dxos/keys": "0.6.14-staging.3e2eaca",
|
|
59
|
+
"@dxos/plugin-deck": "0.6.14-staging.3e2eaca",
|
|
60
|
+
"@dxos/log": "0.6.14-staging.3e2eaca",
|
|
61
|
+
"@dxos/plugin-chess": "0.6.14-staging.3e2eaca",
|
|
62
|
+
"@dxos/plugin-client": "0.6.14-staging.3e2eaca",
|
|
63
|
+
"@dxos/plugin-inbox": "0.6.14-staging.3e2eaca",
|
|
64
|
+
"@dxos/plugin-graph": "0.6.14-staging.3e2eaca",
|
|
65
|
+
"@dxos/plugin-ipfs": "0.6.14-staging.3e2eaca",
|
|
66
|
+
"@dxos/plugin-markdown": "0.6.14-staging.3e2eaca",
|
|
67
|
+
"@dxos/plugin-sketch": "0.6.14-staging.3e2eaca",
|
|
68
|
+
"@dxos/plugin-space": "0.6.14-staging.3e2eaca",
|
|
69
|
+
"@dxos/plugin-stack": "0.6.14-staging.3e2eaca",
|
|
70
|
+
"@dxos/plugin-script": "0.6.14-staging.3e2eaca",
|
|
71
|
+
"@dxos/react-ui-data": "0.6.14-staging.3e2eaca",
|
|
72
|
+
"@dxos/react-client": "0.6.14-staging.3e2eaca",
|
|
73
|
+
"@dxos/react-ui-editor": "0.6.14-staging.3e2eaca",
|
|
74
|
+
"@dxos/util": "0.6.14-staging.3e2eaca"
|
|
73
75
|
},
|
|
74
76
|
"devDependencies": {
|
|
75
77
|
"@phosphor-icons/react": "^2.1.5",
|
|
@@ -79,18 +81,18 @@
|
|
|
79
81
|
"react": "~18.2.0",
|
|
80
82
|
"react-dom": "~18.2.0",
|
|
81
83
|
"vite": "5.4.7",
|
|
82
|
-
"@dxos/
|
|
83
|
-
"@dxos/
|
|
84
|
-
"@dxos/react-ui": "0.6.14-
|
|
85
|
-
"@dxos/storybook-utils": "0.6.14-
|
|
86
|
-
"@dxos/react-ui
|
|
84
|
+
"@dxos/echo-db": "0.6.14-staging.3e2eaca",
|
|
85
|
+
"@dxos/random": "0.6.14-staging.3e2eaca",
|
|
86
|
+
"@dxos/react-ui-theme": "0.6.14-staging.3e2eaca",
|
|
87
|
+
"@dxos/storybook-utils": "0.6.14-staging.3e2eaca",
|
|
88
|
+
"@dxos/react-ui": "0.6.14-staging.3e2eaca"
|
|
87
89
|
},
|
|
88
90
|
"peerDependencies": {
|
|
89
91
|
"@phosphor-icons/react": "^2.1.5",
|
|
90
92
|
"react": "~18.2.0",
|
|
91
93
|
"react-dom": "~18.2.0",
|
|
92
|
-
"@dxos/react-ui-theme": "0.6.14-
|
|
93
|
-
"@dxos/react-ui": "0.6.14-
|
|
94
|
+
"@dxos/react-ui-theme": "0.6.14-staging.3e2eaca",
|
|
95
|
+
"@dxos/react-ui": "0.6.14-staging.3e2eaca"
|
|
94
96
|
},
|
|
95
97
|
"publishConfig": {
|
|
96
98
|
"access": "public"
|
package/src/AutomationPlugin.tsx
CHANGED
|
@@ -37,6 +37,15 @@ export const AutomationPlugin = (): PluginDefinition<AutomationPluginProvides> =
|
|
|
37
37
|
echo: {
|
|
38
38
|
schema: [ChainType, ChainPromptType, FunctionDef, FunctionTrigger],
|
|
39
39
|
},
|
|
40
|
+
complementary: {
|
|
41
|
+
panels: [
|
|
42
|
+
{
|
|
43
|
+
id: 'automation',
|
|
44
|
+
label: ['open automation panel label', { ns: AUTOMATION_PLUGIN }],
|
|
45
|
+
icon: 'ph--flow-arrow--regular',
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
},
|
|
40
49
|
graph: {
|
|
41
50
|
builder: (plugins) => {
|
|
42
51
|
const clientPlugin = resolvePlugin(plugins, parseClientPlugin);
|
|
@@ -56,7 +65,7 @@ export const AutomationPlugin = (): PluginDefinition<AutomationPluginProvides> =
|
|
|
56
65
|
}
|
|
57
66
|
|
|
58
67
|
const type = 'orphan-settings-for-subject';
|
|
59
|
-
const icon = 'ph--
|
|
68
|
+
const icon = 'ph--flow-arrow--regular';
|
|
60
69
|
|
|
61
70
|
const [subjectId] = id.split('~');
|
|
62
71
|
const { spaceId, objectId } = parseId(subjectId);
|
|
@@ -20,22 +20,31 @@ import { log } from '@dxos/log';
|
|
|
20
20
|
import { ScriptType } from '@dxos/plugin-script/types';
|
|
21
21
|
import { useClient } from '@dxos/react-client';
|
|
22
22
|
import { Filter, type Space, useQuery } from '@dxos/react-client/echo';
|
|
23
|
-
import { Input, Select } from '@dxos/react-ui';
|
|
23
|
+
import { Input, Select, useTranslation } from '@dxos/react-ui';
|
|
24
24
|
import { distinctBy } from '@dxos/util';
|
|
25
25
|
|
|
26
26
|
import { InputRow } from './Form';
|
|
27
27
|
import { invokeFunction } from './invokation-handler';
|
|
28
28
|
import { getFunctionMetaExtension, state } from './meta';
|
|
29
|
+
import { AUTOMATION_PLUGIN } from '../../meta';
|
|
29
30
|
|
|
30
31
|
const triggerTypes: FunctionTriggerType[] = ['subscription', 'timer', 'webhook', 'websocket'];
|
|
31
32
|
|
|
32
33
|
const registerTriggersMutex = new Mutex();
|
|
33
34
|
|
|
34
35
|
export const TriggerEditor = ({ space, trigger }: { space: Space; trigger: FunctionTrigger }) => {
|
|
36
|
+
const { t } = useTranslation(AUTOMATION_PLUGIN);
|
|
35
37
|
const client = useClient();
|
|
36
38
|
const scripts = useQuery(space, Filter.schema(ScriptType));
|
|
37
39
|
const script = useMemo(() => scripts.find((script) => script.id === trigger.function), [trigger.function, scripts]);
|
|
38
40
|
|
|
41
|
+
const triggerLabels: Record<FunctionTriggerType, string> = {
|
|
42
|
+
subscription: t('trigger type subscription'),
|
|
43
|
+
timer: t('trigger type timer'),
|
|
44
|
+
webhook: t('trigger type webhook'),
|
|
45
|
+
websocket: t('trigger type websocket'),
|
|
46
|
+
};
|
|
47
|
+
|
|
39
48
|
// TODO(burdon): Factor out, creating context for plugin (runs outside of component).
|
|
40
49
|
const [registry] = useState(new Map<string, Context>());
|
|
41
50
|
const triggers = useQuery(space, Filter.schema(FunctionTrigger));
|
|
@@ -98,8 +107,8 @@ export const TriggerEditor = ({ space, trigger }: { space: Space; trigger: Funct
|
|
|
98
107
|
}, []);
|
|
99
108
|
|
|
100
109
|
useEffect(() => {
|
|
101
|
-
void space.db.
|
|
102
|
-
.
|
|
110
|
+
void space.db.schemaRegistry
|
|
111
|
+
.query()
|
|
103
112
|
.then((schemas) => {
|
|
104
113
|
// TODO(zan): We should solve double adding of stored schemas in the schema registry.
|
|
105
114
|
state.schemas = distinctBy([...state.schemas, ...schemas], (schema) => schema.typename).sort((a, b) =>
|
|
@@ -166,15 +175,15 @@ export const TriggerEditor = ({ space, trigger }: { space: Space; trigger: Funct
|
|
|
166
175
|
<div className='flex flex-col py-1'>
|
|
167
176
|
<table className='is-full table-fixed'>
|
|
168
177
|
<tbody>
|
|
169
|
-
<InputRow label='
|
|
178
|
+
<InputRow label={t('function select label')}>
|
|
170
179
|
<Select.Root value={script?.id} onValueChange={handleSelectFunction}>
|
|
171
|
-
<Select.TriggerButton placeholder={'
|
|
180
|
+
<Select.TriggerButton classNames='w-full' placeholder={t('function select placeholder')} />
|
|
172
181
|
<Select.Portal>
|
|
173
182
|
<Select.Content>
|
|
174
183
|
<Select.Viewport>
|
|
175
184
|
{scripts.map(({ id, name }) => (
|
|
176
185
|
<Select.Option key={id} value={id}>
|
|
177
|
-
{name ??
|
|
186
|
+
{name ?? id}
|
|
178
187
|
</Select.Option>
|
|
179
188
|
))}
|
|
180
189
|
</Select.Viewport>
|
|
@@ -189,15 +198,15 @@ export const TriggerEditor = ({ space, trigger }: { space: Space; trigger: Funct
|
|
|
189
198
|
</div>
|
|
190
199
|
</InputRow>
|
|
191
200
|
)}
|
|
192
|
-
<InputRow label='
|
|
201
|
+
<InputRow label={t('trigger select label')}>
|
|
193
202
|
<Select.Root value={trigger.spec?.type} onValueChange={handleSelectTriggerType}>
|
|
194
|
-
<Select.TriggerButton placeholder={'
|
|
203
|
+
<Select.TriggerButton placeholder={t('trigger select placeholder')} />
|
|
195
204
|
<Select.Portal>
|
|
196
205
|
<Select.Content>
|
|
197
206
|
<Select.Viewport>
|
|
198
207
|
{triggerTypes.map((trigger) => (
|
|
199
208
|
<Select.Option key={trigger} value={trigger}>
|
|
200
|
-
{trigger}
|
|
209
|
+
{triggerLabels[trigger]}
|
|
201
210
|
</Select.Option>
|
|
202
211
|
))}
|
|
203
212
|
</Select.Viewport>
|
|
@@ -208,7 +217,7 @@ export const TriggerEditor = ({ space, trigger }: { space: Space; trigger: Funct
|
|
|
208
217
|
</tbody>
|
|
209
218
|
<tbody>
|
|
210
219
|
{trigger.spec && <TriggerSpec space={space} spec={trigger.spec} />}
|
|
211
|
-
<InputRow label='
|
|
220
|
+
<InputRow label={t('function enabled')}>
|
|
212
221
|
{/* TODO(burdon): Hack to make the switch the same height as other controls. */}
|
|
213
222
|
<div className='flex items-center h-8'>
|
|
214
223
|
<Input.Switch checked={trigger.enabled} onCheckedChange={(checked) => (trigger.enabled = !!checked)} />
|
|
@@ -236,21 +245,19 @@ export const TriggerEditor = ({ space, trigger }: { space: Space; trigger: Funct
|
|
|
236
245
|
//
|
|
237
246
|
|
|
238
247
|
const TriggerSpecSubscription = ({ spec }: TriggerSpecProps<SubscriptionTrigger>) => {
|
|
248
|
+
const { t } = useTranslation(AUTOMATION_PLUGIN);
|
|
239
249
|
if (!spec.filter) {
|
|
240
250
|
return null;
|
|
241
251
|
}
|
|
242
252
|
|
|
243
|
-
const
|
|
253
|
+
const handleValueChange = (typename: string) => {
|
|
244
254
|
spec.filter = [{ type: typename }];
|
|
245
255
|
};
|
|
246
256
|
|
|
247
257
|
return (
|
|
248
258
|
<>
|
|
249
|
-
<InputRow label='
|
|
250
|
-
<Select.Root
|
|
251
|
-
value={spec.filter.length > 0 ? spec.filter[0].type : undefined}
|
|
252
|
-
onValueChange={handleSelectSchema}
|
|
253
|
-
>
|
|
259
|
+
<InputRow label={t('trigger filter')}>
|
|
260
|
+
<Select.Root value={spec.filter.length > 0 ? spec.filter[0].type : undefined} onValueChange={handleValueChange}>
|
|
254
261
|
<Select.TriggerButton classNames='w-full' placeholder={'Select type'} />
|
|
255
262
|
<Select.Portal>
|
|
256
263
|
<Select.Content>
|
|
@@ -269,38 +276,46 @@ const TriggerSpecSubscription = ({ spec }: TriggerSpecProps<SubscriptionTrigger>
|
|
|
269
276
|
);
|
|
270
277
|
};
|
|
271
278
|
|
|
272
|
-
const TriggerSpecTimer = ({ spec }: TriggerSpecProps<TimerTrigger>) =>
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
+
const TriggerSpecTimer = ({ spec }: TriggerSpecProps<TimerTrigger>) => {
|
|
280
|
+
const { t } = useTranslation(AUTOMATION_PLUGIN);
|
|
281
|
+
return (
|
|
282
|
+
<>
|
|
283
|
+
<InputRow label={t('trigger cron')}>
|
|
284
|
+
<Input.TextInput value={spec.cron} onChange={(event) => (spec.cron = event.target.value)} />
|
|
285
|
+
</InputRow>
|
|
286
|
+
</>
|
|
287
|
+
);
|
|
288
|
+
};
|
|
279
289
|
|
|
280
290
|
const methods = ['GET', 'POST'];
|
|
281
291
|
|
|
282
|
-
const TriggerSpecWebhook = ({ spec }: TriggerSpecProps<WebhookTrigger>) =>
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
<Select.
|
|
288
|
-
<Select.
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
292
|
+
const TriggerSpecWebhook = ({ spec }: TriggerSpecProps<WebhookTrigger>) => {
|
|
293
|
+
const { t } = useTranslation(AUTOMATION_PLUGIN);
|
|
294
|
+
return (
|
|
295
|
+
<>
|
|
296
|
+
<InputRow label={t('trigger method')}>
|
|
297
|
+
<Select.Root value={spec.method} onValueChange={(value) => (spec.method = value)}>
|
|
298
|
+
<Select.TriggerButton placeholder={'type'} />
|
|
299
|
+
<Select.Portal>
|
|
300
|
+
<Select.Content>
|
|
301
|
+
<Select.Viewport>
|
|
302
|
+
{methods.map((method) => (
|
|
303
|
+
<Select.Option key={method} value={method}>
|
|
304
|
+
{method}
|
|
305
|
+
</Select.Option>
|
|
306
|
+
))}
|
|
307
|
+
</Select.Viewport>
|
|
308
|
+
</Select.Content>
|
|
309
|
+
</Select.Portal>
|
|
310
|
+
</Select.Root>
|
|
311
|
+
</InputRow>
|
|
312
|
+
</>
|
|
313
|
+
);
|
|
314
|
+
};
|
|
302
315
|
|
|
303
316
|
const TriggerSpecWebsocket = ({ spec }: TriggerSpecProps<WebsocketTrigger>) => {
|
|
317
|
+
const { t } = useTranslation(AUTOMATION_PLUGIN);
|
|
318
|
+
|
|
304
319
|
const handleChangeInit: ChangeEventHandler<HTMLInputElement> = (event) => {
|
|
305
320
|
try {
|
|
306
321
|
spec.init = JSON.parse(event.target.value);
|
|
@@ -311,7 +326,7 @@ const TriggerSpecWebsocket = ({ spec }: TriggerSpecProps<WebsocketTrigger>) => {
|
|
|
311
326
|
|
|
312
327
|
return (
|
|
313
328
|
<>
|
|
314
|
-
<InputRow label='
|
|
329
|
+
<InputRow label={t('trigger method')}>
|
|
315
330
|
<Input.TextInput
|
|
316
331
|
value={spec.url}
|
|
317
332
|
onChange={(event) => (spec.url = event.target.value)}
|
package/src/meta.ts
CHANGED
|
@@ -10,5 +10,7 @@ export default {
|
|
|
10
10
|
id: AUTOMATION_PLUGIN,
|
|
11
11
|
name: 'Automation',
|
|
12
12
|
description: 'Automation workflows.',
|
|
13
|
-
icon: 'ph--
|
|
13
|
+
icon: 'ph--flow-arrow--regular',
|
|
14
|
+
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/experimental/plugin-automation',
|
|
15
|
+
tags: ['experimental'],
|
|
14
16
|
} satisfies PluginMeta;
|
package/src/translations.ts
CHANGED
|
@@ -17,13 +17,23 @@ export default [
|
|
|
17
17
|
'template placeholder': 'Enter template...',
|
|
18
18
|
'value placeholder': 'Enter value...',
|
|
19
19
|
'select preset template placeholder': 'Select preset',
|
|
20
|
+
'open automation panel label': 'Show Automations',
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
'function select label': 'Function',
|
|
23
|
+
'function select placeholder': 'Select function',
|
|
24
|
+
'function enabled': 'Enabled',
|
|
25
|
+
'trigger select label': 'Trigger',
|
|
26
|
+
'trigger select placeholder': 'Trigger type',
|
|
27
|
+
|
|
28
|
+
'trigger type subscription': 'Subscription',
|
|
29
|
+
'trigger type timer': 'Timer',
|
|
30
|
+
'trigger type webhook': 'Webhook',
|
|
31
|
+
'trigger type websocket': 'Websocket',
|
|
32
|
+
|
|
33
|
+
'trigger filter': 'Filter',
|
|
34
|
+
'trigger cron': 'Cron',
|
|
35
|
+
'trigger method': 'Method',
|
|
36
|
+
'trigger endpoint': 'Endpoint',
|
|
27
37
|
},
|
|
28
38
|
},
|
|
29
39
|
},
|
package/src/types/types.ts
CHANGED
|
@@ -10,6 +10,7 @@ import type {
|
|
|
10
10
|
TranslationsProvides,
|
|
11
11
|
} from '@dxos/app-framework';
|
|
12
12
|
import { type SchemaProvides } from '@dxos/plugin-client';
|
|
13
|
+
import { type PanelProvides } from '@dxos/plugin-deck/types';
|
|
13
14
|
|
|
14
15
|
import { AUTOMATION_PLUGIN } from '../meta';
|
|
15
16
|
|
|
@@ -24,4 +25,5 @@ export type AutomationPluginProvides = SurfaceProvides &
|
|
|
24
25
|
MetadataRecordsProvides &
|
|
25
26
|
TranslationsProvides &
|
|
26
27
|
GraphBuilderProvides &
|
|
27
|
-
SchemaProvides
|
|
28
|
+
SchemaProvides &
|
|
29
|
+
PanelProvides;
|
/package/dist/lib/browser/{PromptContainer-RFMJXMUA.mjs.map → PromptContainer-3GUENQHE.mjs.map}
RENAMED
|
File without changes
|
|
File without changes
|
/package/dist/lib/node/{PromptContainer-FRSY6FNL.cjs.map → PromptContainer-74ZRO4HK.cjs.map}
RENAMED
|
File without changes
|
|
File without changes
|
/package/dist/lib/node-esm/{PromptContainer-4VHFPEQH.mjs.map → PromptContainer-5OK4GWIR.mjs.map}
RENAMED
|
File without changes
|
|
File without changes
|