@dxos/plugin-automation 0.8.4-main.a4bbb77 → 0.8.4-main.ae835ea
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-LBXJDM6Z.mjs +11 -0
- package/dist/lib/browser/{AutomationSettings-6XLG2PCK.mjs → AutomationSettings-IIEI5D2K.mjs} +6 -7
- package/dist/lib/{node-esm/AutomationSettings-4IW7RGMN.mjs.map → browser/AutomationSettings-IIEI5D2K.mjs.map} +1 -1
- package/dist/lib/browser/{FunctionsContainer-BQ6VBDIG.mjs → FunctionsContainer-IZTCGNJZ.mjs} +3 -3
- package/dist/lib/browser/{FunctionsPanel-QBTOFFNU.mjs → FunctionsPanel-HFCK3JRB.mjs} +3 -3
- package/dist/lib/browser/{app-graph-builder-6TP6ZNYG.mjs → app-graph-builder-7VKA2GS3.mjs} +8 -7
- package/dist/lib/browser/app-graph-builder-7VKA2GS3.mjs.map +7 -0
- package/dist/lib/browser/{chunk-M2WQCY2T.mjs → chunk-CVYJM6OO.mjs} +19 -6
- package/dist/lib/browser/chunk-CVYJM6OO.mjs.map +7 -0
- package/dist/lib/browser/{chunk-EAQL33PI.mjs → chunk-FHSN7G4H.mjs} +22 -9
- package/dist/lib/browser/chunk-FHSN7G4H.mjs.map +7 -0
- package/dist/lib/browser/{chunk-ZTXBAXUT.mjs → chunk-GCGHLQM2.mjs} +2 -2
- package/dist/lib/browser/chunk-GCGHLQM2.mjs.map +7 -0
- package/dist/lib/browser/{chunk-IN2YC7NY.mjs → chunk-JW7XSPYW.mjs} +57 -20
- package/dist/lib/browser/chunk-JW7XSPYW.mjs.map +7 -0
- package/dist/lib/browser/{chunk-LNMCGQC2.mjs → chunk-K5YNWESC.mjs} +60 -20
- package/dist/lib/browser/chunk-K5YNWESC.mjs.map +7 -0
- package/dist/lib/browser/chunk-LZQFZO3B.mjs +17 -0
- package/dist/lib/browser/chunk-LZQFZO3B.mjs.map +7 -0
- package/dist/lib/browser/{chunk-U66KBK53.mjs → chunk-XXZNGORC.mjs} +5 -5
- package/dist/lib/browser/{chunk-F4K5EMWL.mjs → chunk-YBPJCY3F.mjs} +3 -3
- package/dist/lib/browser/chunk-YBPJCY3F.mjs.map +7 -0
- package/dist/lib/browser/{compute-runtime-OFQPXD5I.mjs → compute-runtime-PFYRMGN2.mjs} +27 -71
- package/dist/lib/browser/compute-runtime-PFYRMGN2.mjs.map +7 -0
- package/dist/lib/browser/hooks/index.mjs +3 -4
- package/dist/lib/browser/index.mjs +26 -10
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/{intent-resolver-JXVWRAAH.mjs → intent-resolver-5HR7M7T6.mjs} +8 -8
- package/dist/lib/browser/intent-resolver-5HR7M7T6.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-NG3MJCDH.mjs → react-surface-WPMY3EX2.mjs} +5 -6
- package/dist/lib/browser/react-surface-WPMY3EX2.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +2 -2
- package/dist/lib/node-esm/{AutomationPanel-WMVR3IST.mjs → AutomationPanel-NVEIUIZP.mjs} +4 -4
- package/dist/lib/node-esm/{AutomationSettings-4IW7RGMN.mjs → AutomationSettings-VIIEPI2P.mjs} +6 -7
- package/dist/lib/node-esm/{FunctionsContainer-LHUUOLA5.mjs → FunctionsContainer-KKRCIXGB.mjs} +3 -3
- package/dist/lib/node-esm/{FunctionsPanel-SHTQIMDV.mjs → FunctionsPanel-74ELGR7P.mjs} +3 -3
- package/dist/lib/node-esm/{app-graph-builder-3A2NIPR5.mjs → app-graph-builder-RTOFJNFV.mjs} +8 -7
- package/dist/lib/node-esm/app-graph-builder-RTOFJNFV.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-DSEZPWSO.mjs → chunk-3BJ6BR3E.mjs} +19 -6
- package/dist/lib/node-esm/chunk-3BJ6BR3E.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-5MQJPJR2.mjs → chunk-CEVIVRTY.mjs} +6 -2
- package/dist/lib/node-esm/chunk-CEVIVRTY.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-CEWZ2CDM.mjs → chunk-ECJKIUBO.mjs} +3 -3
- package/dist/lib/node-esm/chunk-ECJKIUBO.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-PBULJE4B.mjs → chunk-JOCKHLFT.mjs} +22 -9
- package/dist/lib/node-esm/chunk-JOCKHLFT.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-B6O6UBS7.mjs → chunk-MRYKW5TM.mjs} +2 -2
- package/dist/lib/node-esm/chunk-MRYKW5TM.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-2L2X4JMP.mjs → chunk-U5Q2NI7H.mjs} +5 -5
- package/dist/lib/node-esm/{chunk-N7NES6SZ.mjs → chunk-W76WUTZY.mjs} +57 -20
- package/dist/lib/node-esm/chunk-W76WUTZY.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-MN5S5J4O.mjs → chunk-Y7PJXFCJ.mjs} +60 -20
- package/dist/lib/node-esm/chunk-Y7PJXFCJ.mjs.map +7 -0
- package/dist/lib/node-esm/{compute-runtime-W5UJNSQY.mjs → compute-runtime-IXCSD3W7.mjs} +27 -71
- package/dist/lib/node-esm/compute-runtime-IXCSD3W7.mjs.map +7 -0
- package/dist/lib/node-esm/hooks/index.mjs +3 -4
- package/dist/lib/node-esm/index.mjs +26 -10
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/{intent-resolver-ROEBZXSS.mjs → intent-resolver-KDRYB5BC.mjs} +8 -8
- package/dist/lib/node-esm/intent-resolver-KDRYB5BC.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-A4KTYX6Z.mjs → react-surface-Y2BBJV2I.mjs} +5 -6
- package/dist/lib/node-esm/react-surface-Y2BBJV2I.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +2 -2
- 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/capabilities.d.ts +3 -2
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/compute-runtime.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 +2 -2
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts +1 -0
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +1 -1
- package/dist/types/src/components/FunctionsPanel/FunctionsPanel.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts +2 -2
- package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +7 -5
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts +4 -2
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
- package/dist/types/src/events.d.ts +4 -0
- package/dist/types/src/events.d.ts.map +1 -0
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts +1 -1
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +1 -1
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts +2 -2
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +1 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +1 -1
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +33 -31
- package/src/AutomationPlugin.tsx +4 -2
- package/src/capabilities/app-graph-builder.ts +7 -6
- package/src/capabilities/capabilities.ts +3 -2
- package/src/capabilities/compute-runtime.ts +7 -5
- package/src/capabilities/intent-resolver.ts +5 -5
- package/src/capabilities/react-surface.tsx +2 -3
- package/src/components/AutomationPanel/AutomationPanel.stories.tsx +3 -4
- package/src/components/AutomationPanel/AutomationPanel.tsx +91 -28
- package/src/components/FunctionsPanel/FunctionsPanel.tsx +22 -10
- package/src/components/TriggerEditor/FunctionInputEditor.tsx +10 -4
- package/src/components/TriggerEditor/SpecSelector.tsx +12 -6
- package/src/components/TriggerEditor/TriggerEditor.stories.tsx +58 -17
- package/src/components/TriggerEditor/TriggerEditor.tsx +44 -18
- package/src/events.ts +11 -0
- package/src/hooks/useComputeRuntimeCallback.ts +3 -1
- package/src/hooks/useTriggerRuntimeControls.ts +4 -4
- package/src/index.ts +2 -0
- package/src/meta.ts +5 -2
- package/src/testing/test-functions.ts +1 -1
- package/src/translations.ts +1 -0
- package/src/types/schema.ts +1 -1
- package/dist/lib/browser/AutomationPanel-4QA5G3ZY.mjs +0 -11
- package/dist/lib/browser/app-graph-builder-6TP6ZNYG.mjs.map +0 -7
- package/dist/lib/browser/chunk-BDJPBZGC.mjs +0 -14
- package/dist/lib/browser/chunk-BDJPBZGC.mjs.map +0 -7
- package/dist/lib/browser/chunk-EAQL33PI.mjs.map +0 -7
- package/dist/lib/browser/chunk-F4K5EMWL.mjs.map +0 -7
- package/dist/lib/browser/chunk-IN2YC7NY.mjs.map +0 -7
- package/dist/lib/browser/chunk-LNMCGQC2.mjs.map +0 -7
- package/dist/lib/browser/chunk-M2WQCY2T.mjs.map +0 -7
- package/dist/lib/browser/chunk-WWURMV25.mjs +0 -13
- package/dist/lib/browser/chunk-WWURMV25.mjs.map +0 -7
- package/dist/lib/browser/chunk-ZTXBAXUT.mjs.map +0 -7
- package/dist/lib/browser/compute-runtime-OFQPXD5I.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-JXVWRAAH.mjs.map +0 -7
- package/dist/lib/browser/react-surface-NG3MJCDH.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-3A2NIPR5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-5MQJPJR2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-B6O6UBS7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CEWZ2CDM.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-DSEZPWSO.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MN5S5J4O.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-N7NES6SZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-PBULJE4B.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UTZIMYCX.mjs +0 -16
- package/dist/lib/node-esm/chunk-UTZIMYCX.mjs.map +0 -7
- package/dist/lib/node-esm/compute-runtime-W5UJNSQY.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-ROEBZXSS.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-A4KTYX6Z.mjs.map +0 -7
- /package/dist/lib/browser/{AutomationPanel-4QA5G3ZY.mjs.map → AutomationPanel-LBXJDM6Z.mjs.map} +0 -0
- /package/dist/lib/browser/{FunctionsContainer-BQ6VBDIG.mjs.map → FunctionsContainer-IZTCGNJZ.mjs.map} +0 -0
- /package/dist/lib/browser/{FunctionsPanel-QBTOFFNU.mjs.map → FunctionsPanel-HFCK3JRB.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-U66KBK53.mjs.map → chunk-XXZNGORC.mjs.map} +0 -0
- /package/dist/lib/node-esm/{AutomationPanel-WMVR3IST.mjs.map → AutomationPanel-NVEIUIZP.mjs.map} +0 -0
- /package/dist/lib/{browser/AutomationSettings-6XLG2PCK.mjs.map → node-esm/AutomationSettings-VIIEPI2P.mjs.map} +0 -0
- /package/dist/lib/node-esm/{FunctionsContainer-LHUUOLA5.mjs.map → FunctionsContainer-KKRCIXGB.mjs.map} +0 -0
- /package/dist/lib/node-esm/{FunctionsPanel-SHTQIMDV.mjs.map → FunctionsPanel-74ELGR7P.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-2L2X4JMP.mjs.map → chunk-U5Q2NI7H.mjs.map} +0 -0
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Filter, Query } from '@dxos/echo';
|
|
8
|
+
import { Trigger } from '@dxos/functions';
|
|
8
9
|
import { useTranslation } from '@dxos/react-ui';
|
|
9
10
|
import { type InputProps, SelectInput, useInputProps } from '@dxos/react-ui-form';
|
|
10
11
|
|
|
@@ -14,18 +15,23 @@ export type SpecSelectorProps = InputProps;
|
|
|
14
15
|
|
|
15
16
|
export const SpecSelector = (props: SpecSelectorProps) => {
|
|
16
17
|
const { t } = useTranslation(meta.id);
|
|
17
|
-
const specProps = useInputProps(['spec' satisfies keyof
|
|
18
|
+
const specProps = useInputProps(['spec' satisfies keyof Trigger.Trigger]);
|
|
18
19
|
|
|
19
20
|
const handleTypeChange = useCallback(
|
|
20
|
-
(_type: any, value: string):
|
|
21
|
+
(_type: any, value: string): Trigger.Spec | undefined => {
|
|
21
22
|
const getDefaultTriggerSpec = (kind: string) => {
|
|
22
23
|
switch (kind) {
|
|
23
24
|
case 'timer':
|
|
24
25
|
return { kind: 'timer', cron: '' };
|
|
25
26
|
case 'subscription':
|
|
26
|
-
return {
|
|
27
|
+
return {
|
|
28
|
+
kind: 'subscription',
|
|
29
|
+
query: {
|
|
30
|
+
ast: Query.select(Filter.nothing()).ast,
|
|
31
|
+
},
|
|
32
|
+
};
|
|
27
33
|
case 'queue':
|
|
28
|
-
return { kind: 'queue', queue: '' };
|
|
34
|
+
return { kind: 'queue', queue: 'dxn:' };
|
|
29
35
|
case 'email':
|
|
30
36
|
return { kind: 'email' };
|
|
31
37
|
case 'webhook':
|
|
@@ -48,7 +54,7 @@ export const SpecSelector = (props: SpecSelectorProps) => {
|
|
|
48
54
|
|
|
49
55
|
const options = useMemo(
|
|
50
56
|
() =>
|
|
51
|
-
|
|
57
|
+
Trigger.Kinds.map((kind) => ({
|
|
52
58
|
value: kind,
|
|
53
59
|
label: t(`trigger type ${kind}`),
|
|
54
60
|
})),
|
|
@@ -3,30 +3,54 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
-
import React, {
|
|
6
|
+
import React, { useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import { Obj } from '@dxos/echo';
|
|
9
|
-
import {
|
|
8
|
+
import { Filter, Obj, Ref, Tag, Type } from '@dxos/echo';
|
|
9
|
+
import { Function, Trigger } from '@dxos/functions';
|
|
10
|
+
import { invariant } from '@dxos/invariant';
|
|
10
11
|
import { faker } from '@dxos/random';
|
|
11
|
-
import {
|
|
12
|
-
import { ContactType, withClientProvider } from '@dxos/react-client/testing';
|
|
13
|
-
import {
|
|
12
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
13
|
+
import { ContactType, useClientProvider, withClientProvider } from '@dxos/react-client/testing';
|
|
14
|
+
import { useAsyncEffect } from '@dxos/react-ui';
|
|
15
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
16
|
+
import { DataType } from '@dxos/schema';
|
|
14
17
|
|
|
15
18
|
import { functions } from '../../testing';
|
|
16
19
|
import { translations } from '../../translations';
|
|
17
20
|
|
|
18
|
-
import { TriggerEditor } from './TriggerEditor';
|
|
21
|
+
import { TriggerEditor, type TriggerEditorProps } from './TriggerEditor';
|
|
19
22
|
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
const types = [
|
|
24
|
+
// TODO(burdon): Get label from annotation.
|
|
25
|
+
{ value: Type.getTypename(DataType.Organization), label: 'Organization' },
|
|
26
|
+
{ value: Type.getTypename(DataType.Person), label: 'Person' },
|
|
27
|
+
{ value: Type.getTypename(DataType.Project), label: 'Project' },
|
|
28
|
+
{ value: Type.getTypename(DataType.Employer), label: 'Employer' },
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
const DefaultStory = (props: Partial<TriggerEditorProps>) => {
|
|
32
|
+
const { space } = useClientProvider();
|
|
33
|
+
const [trigger, setTrigger] = useState<Trigger.Trigger>();
|
|
34
|
+
const tags = useQuery(space, Filter.type(Tag.Tag));
|
|
35
|
+
|
|
36
|
+
useAsyncEffect(async () => {
|
|
25
37
|
if (!space) {
|
|
26
38
|
return;
|
|
27
39
|
}
|
|
28
40
|
|
|
29
|
-
const
|
|
41
|
+
const result = await space.db.query(Filter.type(Function.Function)).run();
|
|
42
|
+
const fn = result.objects.find((fn) => fn.name === 'example.com/function/forex');
|
|
43
|
+
invariant(fn);
|
|
44
|
+
const trigger = space.db.add(
|
|
45
|
+
Trigger.make({
|
|
46
|
+
function: Ref.make(fn),
|
|
47
|
+
spec: { kind: 'webhook' },
|
|
48
|
+
input: {
|
|
49
|
+
from: 'USD',
|
|
50
|
+
to: 'JPY',
|
|
51
|
+
},
|
|
52
|
+
}),
|
|
53
|
+
);
|
|
30
54
|
setTrigger(trigger);
|
|
31
55
|
}, [space]);
|
|
32
56
|
|
|
@@ -36,7 +60,14 @@ const DefaultStory = () => {
|
|
|
36
60
|
|
|
37
61
|
return (
|
|
38
62
|
<div role='none' className='w-[32rem] bs-fit border border-separator rounded-sm'>
|
|
39
|
-
<TriggerEditor
|
|
63
|
+
<TriggerEditor
|
|
64
|
+
space={space}
|
|
65
|
+
trigger={trigger}
|
|
66
|
+
types={types}
|
|
67
|
+
tags={tags}
|
|
68
|
+
onSave={(values) => console.log('on save', values)}
|
|
69
|
+
{...props}
|
|
70
|
+
/>
|
|
40
71
|
</div>
|
|
41
72
|
);
|
|
42
73
|
};
|
|
@@ -47,13 +78,18 @@ const meta = {
|
|
|
47
78
|
render: DefaultStory,
|
|
48
79
|
decorators: [
|
|
49
80
|
withTheme,
|
|
81
|
+
withLayout({ container: 'column' }),
|
|
50
82
|
withClientProvider({
|
|
51
83
|
createIdentity: true,
|
|
52
84
|
createSpace: true,
|
|
53
|
-
types: [
|
|
85
|
+
types: [Tag.Tag, Function.Function, Trigger.Trigger, ContactType],
|
|
54
86
|
onCreateSpace: ({ space }) => {
|
|
87
|
+
space.db.add(Tag.make({ label: 'Important' }));
|
|
88
|
+
space.db.add(Tag.make({ label: 'Investor' }));
|
|
89
|
+
space.db.add(Tag.make({ label: 'New' }));
|
|
90
|
+
|
|
55
91
|
for (const fn of functions) {
|
|
56
|
-
space.db.add(
|
|
92
|
+
space.db.add(Function.make(fn));
|
|
57
93
|
}
|
|
58
94
|
Array.from({ length: 10 }).map(() => {
|
|
59
95
|
return space.db.add(
|
|
@@ -67,7 +103,6 @@ const meta = {
|
|
|
67
103
|
}),
|
|
68
104
|
],
|
|
69
105
|
parameters: {
|
|
70
|
-
layout: 'column',
|
|
71
106
|
translations,
|
|
72
107
|
},
|
|
73
108
|
} satisfies Meta<typeof DefaultStory>;
|
|
@@ -77,3 +112,9 @@ export default meta;
|
|
|
77
112
|
type Story = StoryObj<typeof meta>;
|
|
78
113
|
|
|
79
114
|
export const Default: Story = {};
|
|
115
|
+
|
|
116
|
+
export const ReadonlySpec: Story = {
|
|
117
|
+
args: {
|
|
118
|
+
readonlySpec: true,
|
|
119
|
+
},
|
|
120
|
+
};
|
|
@@ -5,34 +5,38 @@
|
|
|
5
5
|
import React, { useCallback, useMemo } from 'react';
|
|
6
6
|
|
|
7
7
|
import { ComputeGraph } from '@dxos/conductor';
|
|
8
|
-
import { Type } from '@dxos/echo';
|
|
9
|
-
import {
|
|
8
|
+
import { type Query, Type } from '@dxos/echo';
|
|
9
|
+
import { Function, Script, Trigger } from '@dxos/functions';
|
|
10
10
|
import { Filter, Ref, type Space, useQuery } from '@dxos/react-client/echo';
|
|
11
|
-
import {
|
|
11
|
+
import { Input } from '@dxos/react-ui';
|
|
12
|
+
import { QueryForm, type QueryFormProps } from '@dxos/react-ui-components';
|
|
13
|
+
import { type CustomInputMap, Form, InputHeader, SelectInput, useRefQueryLookupHandler } from '@dxos/react-ui-form';
|
|
12
14
|
|
|
13
15
|
import { FunctionInputEditor, type FunctionInputEditorProps } from './FunctionInputEditor';
|
|
14
16
|
import { SpecSelector } from './SpecSelector';
|
|
15
17
|
|
|
16
18
|
export type TriggerEditorProps = {
|
|
17
19
|
space: Space;
|
|
18
|
-
trigger:
|
|
19
|
-
|
|
20
|
+
trigger: Trigger.Trigger;
|
|
21
|
+
// TODO(wittjosiah): This needs to apply to whole spec but currently only applies to spec.kind & spec.query.
|
|
22
|
+
readonlySpec?: boolean;
|
|
23
|
+
onSave?: (trigger: Omit<Trigger.Trigger, 'id'>) => void;
|
|
20
24
|
onCancel?: () => void;
|
|
21
|
-
}
|
|
25
|
+
} & Pick<QueryFormProps, 'types' | 'tags'>;
|
|
22
26
|
|
|
23
|
-
export const TriggerEditor = ({ space, trigger, onSave, onCancel }: TriggerEditorProps) => {
|
|
24
|
-
const handleSave = (values:
|
|
27
|
+
export const TriggerEditor = ({ space, trigger, readonlySpec, types, tags, onSave, onCancel }: TriggerEditorProps) => {
|
|
28
|
+
const handleSave = ({ id: _, ...values }: Trigger.Trigger) => {
|
|
25
29
|
onSave?.(values);
|
|
26
30
|
};
|
|
27
31
|
|
|
28
32
|
const handleRefQueryLookup = useRefQueryLookupHandler({ space });
|
|
29
|
-
const Custom = useCustomInputs(space, handleRefQueryLookup);
|
|
33
|
+
const Custom = useCustomInputs({ space, readonlySpec, types, tags, onQueryRefOptions: handleRefQueryLookup });
|
|
30
34
|
|
|
31
35
|
return (
|
|
32
36
|
<Form
|
|
33
37
|
outerSpacing={false}
|
|
34
38
|
Custom={Custom}
|
|
35
|
-
schema={
|
|
39
|
+
schema={Trigger.Trigger}
|
|
36
40
|
values={trigger}
|
|
37
41
|
onSave={handleSave}
|
|
38
42
|
onCancel={onCancel}
|
|
@@ -41,15 +45,21 @@ export const TriggerEditor = ({ space, trigger, onSave, onCancel }: TriggerEdito
|
|
|
41
45
|
);
|
|
42
46
|
};
|
|
43
47
|
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
type UseCustomInputsProps = {
|
|
49
|
+
space: Space;
|
|
50
|
+
readonlySpec?: boolean;
|
|
51
|
+
onQueryRefOptions: FunctionInputEditorProps['onQueryRefOptions'];
|
|
52
|
+
} & Pick<QueryFormProps, 'types' | 'tags'>;
|
|
53
|
+
|
|
54
|
+
const useCustomInputs = ({ space, readonlySpec, types, tags, onQueryRefOptions }: UseCustomInputsProps) => {
|
|
55
|
+
const functions = useQuery(space, Filter.type(Function.Function));
|
|
46
56
|
const workflows = useQuery(space, Filter.type(ComputeGraph));
|
|
47
|
-
const scripts = useQuery(space, Filter.type(
|
|
57
|
+
const scripts = useQuery(space, Filter.type(Script.Script));
|
|
48
58
|
|
|
49
59
|
return useMemo(
|
|
50
60
|
(): CustomInputMap => ({
|
|
51
61
|
// Function selector.
|
|
52
|
-
['function' satisfies keyof
|
|
62
|
+
['function' satisfies keyof Trigger.Trigger]: (props) => {
|
|
53
63
|
const getValue = useCallback(() => {
|
|
54
64
|
const formValue = props.getValue();
|
|
55
65
|
if (Ref.isRef(formValue)) {
|
|
@@ -80,14 +90,30 @@ const useCustomInputs = (space: Space, onQueryRefOptions: FunctionInputEditorPro
|
|
|
80
90
|
},
|
|
81
91
|
|
|
82
92
|
// Spec selector.
|
|
83
|
-
['spec.kind' as const]: SpecSelector
|
|
93
|
+
['spec.kind' as const]: (props) => <SpecSelector {...props} readonly={readonlySpec ? 'disabled-input' : false} />,
|
|
94
|
+
|
|
95
|
+
// TODO(wittjosiah): Copied from ViewEditor.
|
|
96
|
+
// Query input editor.
|
|
97
|
+
['spec.query' as const]: (props) => {
|
|
98
|
+
const handleChange = useCallback(
|
|
99
|
+
(query: Query.Any) => props.onValueChange('object', { ast: query.ast }),
|
|
100
|
+
[props.onValueChange],
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
<Input.Root>
|
|
105
|
+
<InputHeader label={props.label} />
|
|
106
|
+
<QueryForm initialQuery={(props.getValue() as any).ast} types={types} tags={tags} onChange={handleChange} />
|
|
107
|
+
</Input.Root>
|
|
108
|
+
);
|
|
109
|
+
},
|
|
84
110
|
|
|
85
111
|
// Function input editor.
|
|
86
112
|
['input' as const]: (props) => (
|
|
87
113
|
<FunctionInputEditor {...props} functions={functions} onQueryRefOptions={onQueryRefOptions} />
|
|
88
114
|
),
|
|
89
115
|
}),
|
|
90
|
-
[workflows, scripts, functions],
|
|
116
|
+
[workflows, scripts, functions, readonlySpec],
|
|
91
117
|
);
|
|
92
118
|
};
|
|
93
119
|
|
|
@@ -95,7 +121,7 @@ const getWorkflowOptions = (graphs: ComputeGraph[]) => {
|
|
|
95
121
|
return graphs.map((graph) => ({ label: `compute-${graph.id}`, value: `dxn:echo:@:${graph.id}` }));
|
|
96
122
|
};
|
|
97
123
|
|
|
98
|
-
const getFunctionOptions = (scripts:
|
|
99
|
-
const getLabel = (fn:
|
|
124
|
+
const getFunctionOptions = (scripts: Script.Script[], functions: Function.Function[]) => {
|
|
125
|
+
const getLabel = (fn: Function.Function) => scripts.find((s) => fn.source?.target?.id === s.id)?.name ?? fn.name;
|
|
100
126
|
return functions.map((fn) => ({ label: getLabel(fn), value: `dxn:echo:@:${fn.id}` }));
|
|
101
127
|
};
|
package/src/events.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { defineEvent } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
import { meta } from './meta';
|
|
8
|
+
|
|
9
|
+
export namespace AutomationEvents {
|
|
10
|
+
export const ComputeRuntimeReady = defineEvent(`${meta.id}/event/compute-runtime-ready`);
|
|
11
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import type
|
|
5
|
+
import type * as Effect from 'effect/Effect';
|
|
6
6
|
import { useCallback } from 'react';
|
|
7
7
|
|
|
8
8
|
import { useCapability } from '@dxos/app-framework';
|
|
@@ -13,6 +13,7 @@ import { AutomationCapabilities } from '../capabilities';
|
|
|
13
13
|
/**
|
|
14
14
|
* Create an effectful function that has access to compute services
|
|
15
15
|
*/
|
|
16
|
+
// TODO(burdon): Factor out (figure out cross-plugin capabilities dependencies).
|
|
16
17
|
export const useComputeRuntimeCallback = <T>(
|
|
17
18
|
space: Space | undefined,
|
|
18
19
|
fn: () => Effect.Effect<T, any, AutomationCapabilities.ComputeServices>,
|
|
@@ -25,6 +26,7 @@ export const useComputeRuntimeCallback = <T>(
|
|
|
25
26
|
if (!runtime) {
|
|
26
27
|
throw new TypeError('Space not provided to useComputeRuntimeCallback');
|
|
27
28
|
}
|
|
29
|
+
|
|
28
30
|
return runtime.runPromise(fn());
|
|
29
31
|
}, [runtime, ...(deps ?? [])]);
|
|
30
32
|
};
|
|
@@ -2,24 +2,24 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
7
|
import { Filter } from '@dxos/echo';
|
|
8
|
-
import {
|
|
8
|
+
import { Trigger, TriggerDispatcher } from '@dxos/functions';
|
|
9
9
|
import { type Space, useQuery } from '@dxos/react-client/echo';
|
|
10
10
|
import { useAsyncState } from '@dxos/react-ui';
|
|
11
11
|
|
|
12
12
|
import { useComputeRuntimeCallback } from './useComputeRuntimeCallback';
|
|
13
13
|
|
|
14
14
|
interface TriggerRuntimeControls {
|
|
15
|
-
triggers:
|
|
15
|
+
triggers: Trigger.Trigger[];
|
|
16
16
|
isRunning: boolean;
|
|
17
17
|
start: () => void;
|
|
18
18
|
stop: () => void;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export const useTriggerRuntimeControls = (space: Space | undefined): TriggerRuntimeControls => {
|
|
22
|
-
const triggers = useQuery(space, Filter.type(
|
|
22
|
+
const triggers = useQuery(space, Filter.type(Trigger.Trigger));
|
|
23
23
|
|
|
24
24
|
const [isRunningState, setIsRunningState] = useAsyncState(
|
|
25
25
|
useComputeRuntimeCallback(space, () => TriggerDispatcher.pipe(Effect.map((t) => t.running))),
|
package/src/index.ts
CHANGED
package/src/meta.ts
CHANGED
|
@@ -3,12 +3,15 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type PluginMeta } from '@dxos/app-framework';
|
|
6
|
+
import { trim } from '@dxos/util';
|
|
6
7
|
|
|
7
8
|
export const meta: PluginMeta = {
|
|
8
9
|
id: 'dxos.org/plugin/automation',
|
|
9
10
|
name: 'Automation',
|
|
10
|
-
description:
|
|
11
|
-
|
|
11
|
+
description: trim`
|
|
12
|
+
Workflow automation engine that triggers custom actions based on object events and conditions.
|
|
13
|
+
Create automated pipelines that respond to changes and streamline repetitive tasks.
|
|
14
|
+
`,
|
|
12
15
|
icon: 'ph--robot--regular',
|
|
13
16
|
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-automation',
|
|
14
17
|
};
|
package/src/translations.ts
CHANGED
|
@@ -26,6 +26,7 @@ export const translations = [
|
|
|
26
26
|
'function copy id': 'Copy Function ID',
|
|
27
27
|
'no functions found': 'No functions found',
|
|
28
28
|
'go to function source button label': 'Show function source',
|
|
29
|
+
'delete function button label': 'Delete function',
|
|
29
30
|
|
|
30
31
|
'trigger editor title': 'Configure Trigger',
|
|
31
32
|
'new trigger label': 'Add Trigger',
|
package/src/types/schema.ts
CHANGED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AutomationPanel,
|
|
3
|
-
AutomationPanel_default
|
|
4
|
-
} from "./chunk-LNMCGQC2.mjs";
|
|
5
|
-
import "./chunk-IN2YC7NY.mjs";
|
|
6
|
-
import "./chunk-WWURMV25.mjs";
|
|
7
|
-
export {
|
|
8
|
-
AutomationPanel,
|
|
9
|
-
AutomationPanel_default as default
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=AutomationPanel-4QA5G3ZY.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/app-graph-builder.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Rx } from '@effect-rx/rx-react';\nimport { Option, pipe } from 'effect';\n\nimport { Capabilities, type PluginContext, contributes } from '@dxos/app-framework';\nimport { Obj } from '@dxos/echo';\nimport { ScriptType } from '@dxos/functions';\nimport { ATTENDABLE_PATH_SEPARATOR, PLANK_COMPANION_TYPE } from '@dxos/plugin-deck/types';\nimport { createExtension } from '@dxos/plugin-graph';\nimport { meta as spaceMeta } from '@dxos/plugin-space';\n\nimport { meta } from '../meta';\n\nexport default (context: PluginContext) =>\n contributes(Capabilities.AppGraphBuilder, [\n createExtension({\n id: `${meta.id}/space-settings-automation`,\n connector: (node) =>\n Rx.make((get) =>\n pipe(\n get(node),\n Option.flatMap((node) => (node.type === `${spaceMeta.id}/settings` ? Option.some(node) : Option.none())),\n Option.map((node) => [\n {\n id: `automation-${node.id}`,\n type: `${meta.id}/space-settings-automation`,\n data: `${meta.id}/space-settings-automation`,\n properties: {\n label: ['automation panel label', { ns: meta.id }],\n icon: 'ph--lightning--regular',\n },\n },\n ]),\n Option.getOrElse(() => []),\n ),\n ),\n }),\n createExtension({\n id: `${meta.id}/space-settings-functions`,\n connector: (node) =>\n Rx.make((get) =>\n pipe(\n get(node),\n Option.flatMap((node) => (node.type === `${spaceMeta.id}/settings` ? Option.some(node) : Option.none())),\n Option.map((node) => [\n {\n id: `functions-${node.id}`,\n type: `${meta.id}/space-settings-functions`,\n data: `${meta.id}/space-settings-functions`,\n properties: {\n label: ['functions panel label', { ns: meta.id }],\n icon: 'ph--function--regular',\n },\n },\n ]),\n Option.getOrElse(() => []),\n ),\n ),\n }),\n createExtension({\n id: `${meta.id}/script-companion`,\n connector: (node) =>\n Rx.make((get) =>\n pipe(\n get(node),\n Option.flatMap((node) => (Obj.instanceOf(ScriptType, node.data) ? Option.some(node) : Option.none())),\n Option.map((node) => [\n {\n id: [node.id, 'automation'].join(ATTENDABLE_PATH_SEPARATOR),\n type: PLANK_COMPANION_TYPE,\n data: 'automation',\n properties: {\n label: ['script automation label', { ns: meta.id }],\n icon: 'ph--lightning--regular',\n disposition: 'hidden',\n },\n },\n ]),\n Option.getOrElse(() => []),\n ),\n ),\n }),\n ]);\n"],
|
|
5
|
-
"mappings": ";;;;;AAIA,SAASA,UAAU;AACnB,SAASC,QAAQC,YAAY;AAE7B,SAASC,cAAkCC,mBAAmB;AAC9D,SAASC,WAAW;AACpB,SAASC,kBAAkB;AAC3B,SAASC,2BAA2BC,4BAA4B;AAChE,SAASC,uBAAuB;AAChC,SAASC,QAAQC,iBAAiB;AAIlC,IAAA,6BAAe,CAACC,YACdC,YAAYC,aAAaC,iBAAiB;EACxCC,gBAAgB;IACdC,IAAI,GAAGC,KAAKD,EAAE;IACdE,WAAW,CAACC,SACVC,GAAGC,KAAK,CAACC,QACPC,KACED,IAAIH,IAAAA,GACJK,OAAOC,QAAQ,CAACN,UAAUA,MAAKO,SAAS,GAAGC,UAAUX,EAAE,cAAcQ,OAAOI,KAAKT,KAAAA,IAAQK,OAAOK,KAAI,CAAA,GACpGL,OAAOM,IAAI,CAACX,UAAS;MACnB;QACEH,IAAI,cAAcG,MAAKH,EAAE;QACzBU,MAAM,GAAGT,KAAKD,EAAE;QAChBe,MAAM,GAAGd,KAAKD,EAAE;QAChBgB,YAAY;UACVC,OAAO;YAAC;YAA0B;cAAEC,IAAIjB,KAAKD;YAAG;;UAChDmB,MAAM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ABLE_PATH_SEPARATOR", "PLANK_COMPANION_TYPE", "createExtension", "meta", "spaceMeta", "context", "contributes", "Capabilities", "AppGraphBuilder", "createExtension", "id", "meta", "connector", "node", "Rx", "make", "get", "pipe", "Option", "flatMap", "type", "spaceMeta", "some", "none", "map", "data", "properties", "label", "ns", "icon", "getOrElse", "Obj", "instanceOf", "ScriptType", "join", "ATTENDABLE_PATH_SEPARATOR", "PLANK_COMPANION_TYPE", "disposition"]
|
|
7
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// src/capabilities/index.ts
|
|
2
|
-
import { lazy } from "@dxos/app-framework";
|
|
3
|
-
var AppGraphBuilder = lazy(() => import("./app-graph-builder-6TP6ZNYG.mjs"));
|
|
4
|
-
var ComputeRuntime = lazy(() => import("./compute-runtime-OFQPXD5I.mjs"));
|
|
5
|
-
var IntentResolver = lazy(() => import("./intent-resolver-JXVWRAAH.mjs"));
|
|
6
|
-
var ReactSurface = lazy(() => import("./react-surface-NG3MJCDH.mjs"));
|
|
7
|
-
|
|
8
|
-
export {
|
|
9
|
-
AppGraphBuilder,
|
|
10
|
-
ComputeRuntime,
|
|
11
|
-
IntentResolver,
|
|
12
|
-
ReactSurface
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=chunk-BDJPBZGC.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/index.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { lazy } from '@dxos/app-framework';\n\nexport const AppGraphBuilder = lazy(() => import('./app-graph-builder'));\nexport const ComputeRuntime = lazy(() => import('./compute-runtime'));\nexport const IntentResolver = lazy(() => import('./intent-resolver'));\nexport const ReactSurface = lazy(() => import('./react-surface'));\n\nexport * from './capabilities';\n"],
|
|
5
|
-
"mappings": ";AAIA,SAASA,YAAY;AAEd,IAAMC,kBAAkBC,KAAK,MAAM,OAAO,kCAAA,CAAA;AAC1C,IAAMC,iBAAiBD,KAAK,MAAM,OAAO,gCAAA,CAAA;AACzC,IAAME,iBAAiBF,KAAK,MAAM,OAAO,gCAAA,CAAA;AACzC,IAAMG,eAAeH,KAAK,MAAM,OAAO,8BAAA,CAAA;",
|
|
6
|
-
"names": ["lazy", "AppGraphBuilder", "lazy", "ComputeRuntime", "IntentResolver", "ReactSurface"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/FunctionsPanel/FunctionsPanel.tsx", "../../../src/components/FunctionsPanel/index.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Schema } from 'effect';\nimport React, { useCallback, useMemo } from 'react';\n\nimport { LayoutAction, createIntent, useIntentDispatcher } from '@dxos/app-framework';\nimport { FunctionType, ScriptType } from '@dxos/functions';\nimport { Filter, type Space, fullyQualifiedId, useQuery } from '@dxos/react-client/echo';\nimport { Button, useTranslation } from '@dxos/react-ui';\nimport { controlItemClasses } from '@dxos/react-ui-form';\nimport { List } from '@dxos/react-ui-list';\nimport { ghostHover, mx } from '@dxos/react-ui-theme';\n\nimport { meta } from '../../meta';\n\nconst grid = 'grid grid-cols-[1fr_auto] min-bs-[2.5rem]';\n\nexport type FunctionsPanelProps = {\n space: Space;\n};\n\nexport const FunctionsPanel = ({ space }: FunctionsPanelProps) => {\n const { t } = useTranslation(meta.id);\n const functions = useQuery(space, Filter.type(FunctionType));\n const scripts = useQuery(space, Filter.type(ScriptType));\n const { dispatchPromise: dispatch } = useIntentDispatcher();\n\n const functionToScriptMap = useMemo(\n () =>\n functions.reduce(\n (map, func) => {\n const scriptId = func.source?.target?.id;\n if (scriptId) {\n const script = scripts.find((s) => s.id === scriptId);\n if (script) {\n map[func.id] = script;\n }\n }\n return map;\n },\n {} as Record<string, ScriptType>,\n ),\n [functions, scripts],\n );\n\n const getScriptName = useCallback(\n (func: FunctionType) => {\n const script = functionToScriptMap[func.id];\n return script?.name;\n },\n [functionToScriptMap],\n );\n\n const handleGoToScript = useCallback(\n (func: FunctionType) => {\n const script = functionToScriptMap[func.id];\n if (script) {\n void dispatch(createIntent(LayoutAction.Open, { part: 'main', subject: [fullyQualifiedId(script)] }));\n }\n },\n [functionToScriptMap, dispatch],\n );\n\n return (\n <div role='none' className={mx(controlItemClasses)}>\n {functions.length > 0 && (\n <List.Root<FunctionType> items={functions} isItem={Schema.is(FunctionType)} getId={(func) => func.id}>\n {({ items }) => (\n <div role='list' className='flex flex-col w-full'>\n {items?.map((func) => (\n <List.Item<FunctionType>\n key={func.id}\n item={func}\n classNames={mx(grid, ghostHover, 'items-center', 'pli-2', 'min-bs-[3rem]')}\n >\n <div className='flex flex-col truncate'>\n <List.ItemTitle classNames='truncate'>{func.name}</List.ItemTitle>\n {getScriptName(func) && (\n <div className='text-xs text-description truncate'>{getScriptName(func)}</div>\n )}\n </div>\n {functionToScriptMap[func.id] && (\n <Button onClick={() => handleGoToScript(func)}>{t('go to function source button label')}</Button>\n )}\n </List.Item>\n ))}\n </div>\n )}\n </List.Root>\n )}\n\n {functions.length === 0 && <div className='text-center plb-4 text-gray-500'>{t('no functions found')}</div>}\n </div>\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { FunctionsPanel } from './FunctionsPanel';\n\nexport * from './FunctionsPanel';\nexport default FunctionsPanel;\n"],
|
|
5
|
-
"mappings": ";;;;;;AAIA,SAASA,cAAc;AACvB,OAAOC,SAASC,aAAaC,eAAe;AAE5C,SAASC,cAAcC,cAAcC,2BAA2B;AAChE,SAASC,cAAcC,kBAAkB;AACzC,SAASC,QAAoBC,kBAAkBC,gBAAgB;AAC/D,SAASC,QAAQC,sBAAsB;AACvC,SAASC,0BAA0B;AACnC,SAASC,YAAY;AACrB,SAASC,YAAYC,UAAU;AAI/B,IAAMC,OAAO;AAMN,IAAMC,iBAAiB,CAAC,EAAEC,M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AAAA;MAAIC,MAAK;MAAOC,WAAU;OACxBM,OAAO1B,IAAI,CAACC,SACX,sBAAA,cAACuB,KAAKO,MAAI;MACRC,KAAK/B,KAAKf;MACV+C,MAAMhC;MACNiC,YAAYb,GAAGzC,MAAMuD,YAAY,gBAAgB,SAAS,eAAA;OAE1D,sBAAA,cAACjB,OAAAA;MAAIE,WAAU;OACb,sBAAA,cAACI,KAAKY,WAAS;MAACF,YAAW;OAAYjC,KAAKS,IAAI,GAC/CF,cAAcP,IAAAA,KACb,sBAAA,cAACiB,OAAAA;MAAIE,WAAU;OAAqCZ,cAAcP,IAAAA,CAAAA,CAAAA,GAGrEJ,oBAAoBI,KAAKf,EAAE,KAC1B,sBAAA,cAACmD,QAAAA;MAAOC,SAAS,MAAM3B,iBAAiBV,IAAAA;OAAQlB,EAAE,oCAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAS/DI,UAAUoC,WAAW,KAAK,sBAAA,cAACL,OAAAA;MAAIE,WAAU;OAAmCrC,EAAE,oBAAA,CAAA,CAAA;;;;AAGrF;;;ACzFA,IAAA,yBAAewD;",
|
|
6
|
-
"names": ["Schema", "React", "useCallback", "useMemo", "LayoutAction", "createIntent", "useIntentDispatcher", "FunctionType", "ScriptType", "Filter", "fullyQualifiedId", "useQuery", "Button", "useTranslation", "controlItemClasses", "List", "ghostHover", "mx", "grid", "FunctionsPanel", "space", "t", "useTranslation", "meta", "id", "functions", "useQuery", "Filter", "type", "FunctionType", "scripts", "ScriptType", "dispatchPromise", "dispatch", "useIntentDispatcher", "functionToScriptMap", "useMemo", "reduce", "map", "func", "scriptId", "source", "target", "script", "find", "s", "getScriptName", "useCallback", "name", "handleGoToScript", "createIntent", "LayoutAction", "Open", "part", "subject", "fullyQualifiedId", "div", "role", "className", "mx", "controlItemClasses", "length", "List", "Root", "items", "isItem", "Schema", "is", "getId", "Item", "key", "item", "classNames", "ghostHover", "ItemTitle", "Button", "onClick", "FunctionsPanel"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types/schema.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { SpaceSchema } from '@dxos/react-client/echo';\n\nimport { meta } from '../meta';\n\nconst TriggerTemplate = Schema.Union(\n Schema.Struct({ type: Schema.Literal('timer'), cron: Schema.String }),\n Schema.Struct({ type: Schema.Literal('queue'), queueDXN: Schema.Any }),\n);\n\nexport namespace AutomationAction {\n export class CreateTriggerFromTemplate extends Schema.TaggedClass<CreateTriggerFromTemplate>()(\n `${meta.id}/action/create-trigger-from-template`,\n {\n input: Schema.Struct({\n space: SpaceSchema,\n template: TriggerTemplate,\n enabled: Schema.optional(Schema.Boolean),\n // TODO(wittjosiah): Improve how this lookup is done.\n scriptName: Schema.optional(Schema.String),\n input: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Any })),\n }),\n output: Schema.Void,\n },\n ) {}\n}\n"],
|
|
5
|
-
"mappings": ";;;;;AAIA,SAASA,cAAc;AAEvB,SAASC,mBAAmB;AAI5B,IAAMC,kBAAkBC,OAAOC,MAC7BD,OAAOE,OAAO;EAAEC,MAAMH,OAAOI,QAAQ,OAAA;EAAUC,MAAML,OAAOM;AAAO,CAAA,GACnEN,OAAOE,OAAO;EAAEC,MAAMH,OAAOI,QAAQ,OAAA;EAAUG,UAAUP,OAAOQ;AAAI,CAAA,CAAA;UAGrDC,mBAAAA;EACR,MAAMC,kCAAkCV,OAAOW,YAAW,EAC/D,GAAGC,KAAKC,EAAE,wCACV;IACEC,OAAOd,OAAOE,OAAO;MACnBa,OAAOC;MACPC,UAAUlB;MACVmB,SAASlB,OAAOmB,SAASnB,OAAOoB,OAAO;;MAEvCC,YAAYrB,OAAOmB,SAASnB,OAAOM,MAAM;MACzCQ,OAAOd,OAAOmB,SAASnB,OAAOsB,OAAO;QAAEC,KAAKvB,OAAOM;QAAQkB,OAAOxB,OAAOQ;MAAI,CAAA,CAAA;IAC/E,CAAA;IACAiB,QAAQzB,OAAO0B;EACjB,CAAA,EAAA;EACC;oBAbUhB,4BAAAA;AAcf,GAfiBD,qBAAAA,mBAAAA,CAAAA,EAAAA;;",
|
|
6
|
-
"names": ["Schema", "SpaceSchema", "TriggerTemplate", "Schema", "Union", "Struct", "type", "Literal", "cron", "String", "queueDXN", "Any", "AutomationAction", "CreateTriggerFromTemplate", "TaggedClass", "meta", "id", "input", "space", "SpaceSchema", "template", "enabled", "optional", "Boolean", "scriptName", "Record", "key", "value", "output", "Void"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/TriggerEditor/TriggerEditor.tsx", "../../../src/components/TriggerEditor/FunctionInputEditor.tsx", "../../../src/components/TriggerEditor/SpecSelector.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { useCallback, useMemo } from 'react';\n\nimport { ComputeGraph } from '@dxos/conductor';\nimport { Type } from '@dxos/echo';\nimport { FunctionTrigger, FunctionType, ScriptType } from '@dxos/functions';\nimport { Filter, Ref, type Space, useQuery } from '@dxos/react-client/echo';\nimport { type CustomInputMap, Form, SelectInput, useRefQueryLookupHandler } from '@dxos/react-ui-form';\n\nimport { FunctionInputEditor, type FunctionInputEditorProps } from './FunctionInputEditor';\nimport { SpecSelector } from './SpecSelector';\n\nexport type TriggerEditorProps = {\n space: Space;\n trigger: FunctionTrigger;\n onSave?: (trigger: Omit<FunctionTrigger, 'id'>) => void;\n onCancel?: () => void;\n};\n\nexport const TriggerEditor = ({ space, trigger, onSave, onCancel }: TriggerEditorProps) => {\n const handleSave = (values: FunctionTrigger) => {\n onSave?.(values);\n };\n\n const handleRefQueryLookup = useRefQueryLookupHandler({ space });\n const Custom = useCustomInputs(space, handleRefQueryLookup);\n\n return (\n <Form\n outerSpacing={false}\n Custom={Custom}\n schema={FunctionTrigger}\n values={trigger}\n onSave={handleSave}\n onCancel={onCancel}\n onQueryRefOptions={handleRefQueryLookup}\n />\n );\n};\n\nconst useCustomInputs = (space: Space, onQueryRefOptions: FunctionInputEditorProps['onQueryRefOptions']) => {\n const functions = useQuery(space, Filter.type(FunctionType));\n const workflows = useQuery(space, Filter.type(ComputeGraph));\n const scripts = useQuery(space, Filter.type(ScriptType));\n\n return useMemo(\n (): CustomInputMap => ({\n // Function selector.\n ['function' satisfies keyof FunctionTrigger]: (props) => {\n const getValue = useCallback(() => {\n const formValue = props.getValue();\n if (Ref.isRef(formValue)) {\n return formValue.dxn.toString() as string;\n }\n return undefined;\n }, [props]);\n\n const handleOnValueChange = useCallback(\n (_type: any, dxnString: string) => {\n const dxn = Type.DXN.parse(dxnString);\n if (dxn) {\n const ref = Ref.fromDXN(dxn);\n props.onValueChange('object', ref);\n }\n },\n [props.onValueChange],\n );\n\n return (\n <SelectInput\n {...props}\n getValue={getValue as any}\n onValueChange={handleOnValueChange}\n options={getWorkflowOptions(workflows).concat(getFunctionOptions(scripts, functions))}\n />\n );\n },\n\n // Spec selector.\n ['spec.kind' as const]: SpecSelector,\n\n // Function input editor.\n ['input' as const]: (props) => (\n <FunctionInputEditor {...props} functions={functions} onQueryRefOptions={onQueryRefOptions} />\n ),\n }),\n [workflows, scripts, functions],\n );\n};\n\nconst getWorkflowOptions = (graphs: ComputeGraph[]) => {\n return graphs.map((graph) => ({ label: `compute-${graph.id}`, value: `dxn:echo:@:${graph.id}` }));\n};\n\nconst getFunctionOptions = (scripts: ScriptType[], functions: FunctionType[]) => {\n const getLabel = (fn: FunctionType) => scripts.find((s) => fn.source?.target?.id === s.id)?.name ?? fn.name;\n return functions.map((fn) => ({ label: getLabel(fn), value: `dxn:echo:@:${fn.id}` }));\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { useCallback, useMemo } from 'react';\n\nimport { Ref, Type } from '@dxos/echo';\nimport { type JsonPath } from '@dxos/echo-schema';\nimport { type FunctionType } from '@dxos/functions';\nimport { useOnTransition } from '@dxos/react-ui';\nimport { Form, type FormInputStateProps, type QueryRefOptions, useFormValues } from '@dxos/react-ui-form';\n\nexport type FunctionInputEditorProps = {\n functions: FunctionType[];\n onQueryRefOptions: QueryRefOptions;\n} & FormInputStateProps;\n\n/**\n * Editor component for function input parameters.\n */\nexport const FunctionInputEditor = ({\n functions,\n getValue,\n onValueChange,\n onQueryRefOptions,\n}: FunctionInputEditorProps) => {\n const selectedFunctionValue = useFormValues(['function' as JsonPath]);\n const selectedFunctionId = useMemo(() => {\n if (Ref.isRef(selectedFunctionValue)) {\n return selectedFunctionValue.dxn.toString().split('dxn:echo:@:').at(1);\n }\n }, [selectedFunctionValue]);\n\n const selectedFunction = useMemo(\n () => functions.find((fn) => fn.id === selectedFunctionId),\n [functions, selectedFunctionId],\n );\n\n useOnTransition(\n // Clear function parameter input when the function changes.\n selectedFunctionValue,\n (prevValue) => prevValue !== undefined && prevValue !== selectedFunctionValue,\n (currValue) => currValue !== undefined,\n () => onValueChange('object', {}),\n );\n\n const inputSchema = useMemo(() => selectedFunction?.inputSchema, [selectedFunction]);\n const effectSchema = useMemo(() => (inputSchema ? Type.toEffectSchema(inputSchema) : undefined), [inputSchema]);\n const propertyCount = inputSchema?.properties ? Object.keys(inputSchema.properties).length : 0;\n\n const values = useMemo(() => getValue() ?? {}, [getValue]);\n\n const handleValuesChanged = useCallback(\n (values: any) => {\n onValueChange('object', values);\n },\n [onValueChange],\n );\n\n if (selectedFunction === undefined || effectSchema === undefined || propertyCount === 0) {\n return null;\n }\n\n return (\n <>\n <h3 className='text-md'>Function parameters</h3>\n {/* TODO(ZaymonFC): Try using <FormFields /> internal component for this nesting.\n This would allow errors to flow up to the root context. */}\n <Form\n schema={effectSchema}\n values={values}\n onValuesChanged={handleValuesChanged}\n onQueryRefOptions={onQueryRefOptions}\n outerSpacing={false}\n />\n </>\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { useCallback, useMemo } from 'react';\n\nimport { type FunctionTrigger, TriggerKinds, type TriggerType } from '@dxos/functions';\nimport { useTranslation } from '@dxos/react-ui';\nimport { type InputProps, SelectInput, useInputProps } from '@dxos/react-ui-form';\n\nimport { meta } from '../../meta';\n\nexport type SpecSelectorProps = InputProps;\n\nexport const SpecSelector = (props: SpecSelectorProps) => {\n const { t } = useTranslation(meta.id);\n const specProps = useInputProps(['spec' satisfies keyof FunctionTrigger]);\n\n const handleTypeChange = useCallback(\n (_type: any, value: string): TriggerType | undefined => {\n const getDefaultTriggerSpec = (kind: string) => {\n switch (kind) {\n case 'timer':\n return { kind: 'timer', cron: '' };\n case 'subscription':\n return { kind: 'subscription', filter: {} };\n case 'queue':\n return { kind: 'queue', queue: '' };\n case 'email':\n return { kind: 'email' };\n case 'webhook':\n return { kind: 'webhook' };\n default:\n return undefined;\n }\n };\n\n const defaultSpec = getDefaultTriggerSpec(value);\n if (!defaultSpec) {\n return;\n }\n\n // Update the entire spec object, not just the `spec.kind`.\n specProps.onValueChange('object', defaultSpec);\n },\n [specProps],\n );\n\n const options = useMemo(\n () =>\n TriggerKinds.map((kind) => ({\n value: kind,\n label: t(`trigger type ${kind}`),\n })),\n [t],\n );\n\n return <SelectInput {...props} options={options} onValueChange={handleTypeChange} />;\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;AAIA,OAAOA,UAASC,eAAAA,cAAaC,WAAAA,gBAAe;AAE5C,SAASC,oBAAoB;AAC7B,SAASC,QAAAA,aAAY;AACrB,SAASC,iBAAiBC,cAAcC,kBAAkB;AAC1D,SAASC,QAAQC,OAAAA,MAAiBC,gBAAgB;AAClD,SAA8BC,QAAAA,OAAMC,eAAAA,cAAaC,gCAAgC;;;;ACNjF,OAAOC,SAASC,aAAaC,eAAe;AAE5C,SAASC,KAAKC,YAAY;AAG1B,SAASC,uBAAuB;AAChC,SAASC,MAAsDC,qBAAqB;AAU7E,IAAMC,sBAAsB,CAAC,EAClCC,WAC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C,IAAI,CAACC,WAAW;IAAEC,OAAO,WAAWD,MAAME,EAAE;IAAIC,OAAO,cAAcH,MAAME,EAAE;EAAG,EAAA;AAChG;AAEA,IAAMP,qBAAqB,CAACzB,SAAuBP,cAAAA;AACjD,QAAMyC,WAAW,CAACC,OAAqBnC,QAAQoC,KAAK,CAACC,MAAMF,GAAGG,QAAQC,QAAQP,OAAOK,EAAEL,EAAE,GAAGQ,QAAQL,GAAGK;AACvG,SAAO/C,UAAUoC,IAAI,CAACM,QAAQ;IAAEJ,OAAOG,SAASC,EAAAA;IAAKF,OAAO,cAAcE,GAAGH,EAAE;EAAG,EAAA;AACpF;",
|
|
6
|
-
"names": ["React", "useCallback", "useMemo", "ComputeGraph", "Type", "FunctionTrigger", "FunctionType", "ScriptType", "Filter", "Ref", "useQuery", "Form", "SelectInput", "useRefQueryLookupHandler", "React", "useCallback", "useMemo", "Ref", "Type", "useOnTransition", "Form", "useFormValues", "FunctionInputEditor", "functions", "getValue", "onValueChange", "onQueryRefOptions", "selectedFunctionValue", "useFormValues", "selectedFunctionId", "useMemo", "Ref", "isRef", "dxn", "toString", "split", "at", "selectedFunction", "find", "fn", "id", "useOnTransition", "prevValue", "undefined", "currValue", "inputSchema", "effectSchema", "Type", "toEffectSchema", "propertyCount", "properties", "Object", "keys", "length", "values", "handleValuesChanged", "useCallback", "h3", "className", "Form", "schema", "onValuesChanged", "outerSpacing", "React", "useCallback", "useMemo", "TriggerKinds", "useTranslation", "SelectInput", "useInputProps", "SpecSelector", "props", "t", "useTranslation", "meta", "id", "specProps", "useInputProps", "handleTypeChange", "useCallback", "_type", "value", "getDefaultTriggerSpec", "kind", "cron", "filter", "queue", "undefined", "defaultSpec", "onValueChange", "options", "useMemo", "TriggerKinds", "map", "label", "React", "SelectInput", "TriggerEditor", "space", "trigger", "onSave", "onCancel", "handleSave", "values", "handleRefQueryLookup", "useRefQueryLookupHandler", "Custom", "useCustomInputs", "React", "Form", "outerSpacing", "schema", "FunctionTrigger", "onQueryRefOptions", "functions", "useQuery", "Filter", "type", "FunctionType", "workflows", "ComputeGraph", "scripts", "ScriptType", "useMemo", "props", "getValue", "useCallback", "formValue", "Ref", "isRef", "dxn", "toString", "undefined", "handleOnValueChange", "_type", "dxnString", "Type", "DXN", "parse", "ref", "fromDXN", "onValueChange", "SelectInput", "options", "getWorkflowOptions", "concat", "getFunctionOptions", "SpecSelector", "FunctionInputEditor", "graphs", "map", "graph", "label", "id", "value", "getLabel", "fn", "find", "s", "source", "target", "name"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/AutomationPanel/AutomationPanel.tsx", "../../../src/components/AutomationPanel/index.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Schema } from 'effect';\nimport React, { useState } from 'react';\n\nimport { Filter, Obj } from '@dxos/echo';\nimport { FunctionTrigger, FunctionType, ScriptType } from '@dxos/functions';\nimport { type Client, useClient } from '@dxos/react-client';\nimport { type Space, getSpace, useQuery } from '@dxos/react-client/echo';\nimport { Clipboard, IconButton, Input, Separator, type ThemedClassName, useTranslation } from '@dxos/react-ui';\nimport { ControlItem, controlItemClasses } from '@dxos/react-ui-form';\nimport { List } from '@dxos/react-ui-list';\nimport { ghostHover, mx } from '@dxos/react-ui-theme';\n\nimport { meta } from '../../meta';\nimport { TriggerEditor, type TriggerEditorProps } from '../TriggerEditor';\n\nconst grid = 'grid grid-cols-[40px_1fr_32px] min-bs-[2.5rem]';\n\nexport type AutomationPanelProps = ThemedClassName<{\n space: Space;\n object?: Obj.Any;\n initialTrigger?: FunctionTrigger;\n onDone?: () => void;\n}>;\n\n// TODO(burdon): Factor out common layout with ViewEditor.\nexport const AutomationPanel = ({ classNames, space, object, initialTrigger, onDone }: AutomationPanelProps) => {\n const { t } = useTranslation(meta.id);\n const client = useClient();\n const triggers = useQuery(space, Filter.type(FunctionTrigger));\n const functions = useQuery(space, Filter.type(FunctionType));\n const scripts = useQuery(space, Filter.type(ScriptType));\n\n const [trigger, setTrigger] = useState<FunctionTrigger | undefined>(initialTrigger);\n const [selected, setSelected] = useState<FunctionTrigger>();\n\n const handleSelect = (trigger: FunctionTrigger) => {\n setTrigger(trigger);\n setSelected(trigger);\n };\n\n const handleAdd = () => {\n setTrigger(Obj.make(FunctionTrigger, {}));\n setSelected(undefined);\n };\n\n const handleDelete = (trigger: FunctionTrigger) => {\n space.db.remove(trigger);\n setTrigger(undefined);\n setSelected(undefined);\n };\n\n const handleSave: TriggerEditorProps['onSave'] = (trigger) => {\n if (selected) {\n Object.assign(selected, trigger);\n } else {\n space.db.add(Obj.make(FunctionTrigger, trigger));\n }\n\n setTrigger(undefined);\n setSelected(undefined);\n onDone?.();\n };\n\n const handleCancel: TriggerEditorProps['onCancel'] = () => {\n setTrigger(undefined);\n onDone?.();\n };\n\n if (trigger) {\n return (\n <ControlItem title={t('trigger editor title')}>\n <TriggerEditor space={space} trigger={trigger} onSave={handleSave} onCancel={handleCancel} />\n </ControlItem>\n );\n }\n\n return (\n <div className={mx(controlItemClasses, classNames)}>\n {triggers.length > 0 && (\n <List.Root<FunctionTrigger> items={triggers} isItem={Schema.is(FunctionTrigger)} getId={(field) => field.id}>\n {({ items: triggers }) => (\n <div role='list' className='flex flex-col w-full'>\n {triggers?.map((trigger) => {\n const copyAction = getCopyAction(client, trigger);\n return (\n <List.Item<FunctionTrigger>\n key={trigger.id}\n item={trigger}\n classNames={mx(grid, ghostHover, 'items-center', 'px-2')}\n >\n <Input.Root>\n <Input.Switch\n checked={trigger.enabled}\n onCheckedChange={(checked) => (trigger.enabled = checked)}\n />\n </Input.Root>\n\n <div className={'flex'}>\n <List.ItemTitle\n classNames='px-1 cursor-pointer w-0 shrink truncate'\n onClick={() => handleSelect(trigger)}\n >\n {getFunctionName(scripts, functions, trigger) ?? '∅'}\n </List.ItemTitle>\n\n {/* TODO: a better way to expose copy action */}\n {copyAction && (\n <Clipboard.IconButton\n label={t(copyAction.translationKey)}\n value={copyAction.contentProvider()}\n />\n )}\n </div>\n\n <List.ItemDeleteButton onClick={() => handleDelete(trigger)} />\n </List.Item>\n );\n })}\n </div>\n )}\n </List.Root>\n )}\n {triggers.length > 0 && <Separator classNames='mlb-4' />}\n <IconButton icon='ph--plus--regular' label={t('new trigger label')} onClick={handleAdd} />\n </div>\n );\n};\n\nconst getCopyAction = (client: Client, trigger: FunctionTrigger | undefined) => {\n if (trigger?.spec?.kind === 'email') {\n return { translationKey: 'trigger copy email', contentProvider: () => `${getSpace(trigger)!.id}@dxos.network` };\n }\n\n if (trigger?.spec?.kind === 'webhook') {\n return { translationKey: 'trigger copy url', contentProvider: () => getWebhookUrl(client, trigger) };\n }\n\n return undefined;\n};\n\nconst getWebhookUrl = (client: Client, trigger: FunctionTrigger) => {\n const spaceId = getSpace(trigger)!.id;\n const edgeUrl = new URL(client.config.values.runtime!.services!.edge!.url!);\n const isSecure = edgeUrl.protocol.startsWith('https') || edgeUrl.protocol.startsWith('wss');\n edgeUrl.protocol = isSecure ? 'https' : 'http';\n return new URL(`/webhook/${spaceId}:${trigger.id}`, edgeUrl).toString();\n};\n\nconst getFunctionName = (scripts: ScriptType[], functions: FunctionType[], trigger: FunctionTrigger) => {\n // TODO(wittjosiah): Truncation should be done in the UI.\n // Warning that the List component is currently a can of worms.\n const shortId = trigger.function && `${trigger.function.dxn.toString().slice(0, 16)}…`;\n const functionObject = functions.find((fn) => fn === trigger.function?.target);\n return functionObject?.name ?? shortId;\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { AutomationPanel } from './AutomationPanel';\n\nexport * from './AutomationPanel';\n\nexport default AutomationPanel;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;AAIA,SAASA,cAAc;AACvB,OAAOC,SAASC,gBAAgB;AAEhC,SAASC,QAAQC,WAAW;AAC5B,SAASC,iBAAiBC,cAAcC,kBAAkB;AAC1D,SAAsBC,iBAAiB;AACvC,SA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obj", "FunctionTrigger", "FunctionType", "ScriptType", "useClient", "getSpace", "useQuery", "Clipboard", "IconButton", "Input", "Separator", "useTranslation", "ControlItem", "controlItemClasses", "List", "ghostHover", "mx", "grid", "AutomationPanel", "classNames", "space", "object", "initialTrigger", "onDone", "t", "useTranslation", "meta", "id", "client", "useClient", "triggers", "useQuery", "Filter", "type", "FunctionTrigger", "functions", "FunctionType", "scripts", "ScriptType", "trigger", "setTrigger", "useState", "selected", "setSelected", "handleSelect", "handleAdd", "Obj", "make", "undefined", "handleDelete", "db", "remove", "handleSave", "Object", "assign", "add", "handleCancel", "ControlItem", "title", "TriggerEditor", "onSave", "onCancel", "div", "className", "mx", "controlItemClasses", "length", "List", "Root", "items", "isItem", "Schema", "is", "getId", "field", "role", "map", "copyAction", "getCopyAction", "Item", "key", "item", "ghostHover", "Input", "Switch", "checked", "enabled", "onCheckedChange", "ItemTitle", "onClick", "getFunctionName", "Clipboard", "IconButton", "label", "translationKey", "value", "contentProvider", "ItemDeleteButton", "Separator", "icon", "spec", "kind", "getSpace", "getWebhookUrl", "spaceId", "edgeUrl", "URL", "config", "values", "runtime", "services", "edge", "url", "isSecure", "protocol", "startsWith", "toString", "shortId", "function", "dxn", "slice", "functionObject", "find", "fn", "target", "name", "AutomationPanel"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/hooks/useComputeRuntimeCallback.ts", "../../../src/hooks/useTriggerRuntimeControls.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport type { Effect } from 'effect';\nimport { useCallback } from 'react';\n\nimport { useCapability } from '@dxos/app-framework';\nimport type { Space } from '@dxos/react-client/echo';\n\nimport { AutomationCapabilities } from '../capabilities';\n\n/**\n * Create an effectful function that has access to compute services\n */\nexport const useComputeRuntimeCallback = <T>(\n space: Space | undefined,\n fn: () => Effect.Effect<T, any, AutomationCapabilities.ComputeServices>,\n deps?: React.DependencyList,\n): (() => Promise<T>) => {\n const computeRuntime = useCapability(AutomationCapabilities.ComputeRuntime);\n const runtime = space !== undefined ? computeRuntime.getRuntime(space.id) : undefined;\n\n return useCallback(() => {\n if (!runtime) {\n throw new TypeError('Space not provided to useComputeRuntimeCallback');\n }\n return runtime.runPromise(fn());\n }, [runtime, ...(deps ?? [])]);\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Effect } from 'effect';\n\nimport { Filter } from '@dxos/echo';\nimport { FunctionTrigger, TriggerDispatcher } from '@dxos/functions';\nimport { type Space, useQuery } from '@dxos/react-client/echo';\nimport { useAsyncState } from '@dxos/react-ui';\n\nimport { useComputeRuntimeCallback } from './useComputeRuntimeCallback';\n\ninterface TriggerRuntimeControls {\n triggers: FunctionTrigger[];\n isRunning: boolean;\n start: () => void;\n stop: () => void;\n}\n\nexport const useTriggerRuntimeControls = (space: Space | undefined): TriggerRuntimeControls => {\n const triggers = useQuery(space, Filter.type(FunctionTrigger));\n\n const [isRunningState, setIsRunningState] = useAsyncState(\n useComputeRuntimeCallback(space, () => TriggerDispatcher.pipe(Effect.map((t) => t.running))),\n );\n\n const start = useComputeRuntimeCallback(\n space,\n Effect.fnUntraced(function* () {\n const dispatcher = yield* TriggerDispatcher;\n yield* dispatcher.start();\n setIsRunningState(true);\n }),\n );\n\n const stop = useComputeRuntimeCallback(\n space,\n Effect.fnUntraced(function* () {\n const dispatcher = yield* TriggerDispatcher;\n yield* dispatcher.stop();\n setIsRunningState(false);\n }),\n );\n\n return {\n triggers,\n isRunning: isRunningState ?? false,\n start: () => void start(),\n stop: () => void stop(),\n };\n};\n"],
|
|
5
|
-
"mappings": ";;;;;AAKA,SAASA,mBAAmB;AAE5B,SAASC,qBAAqB;AAQvB,IAAMC,4BAA4B,CACvCC,OACAC,IACAC,SAAAA;AAEA,QAAMC,iBAAiBC,cAAcC,uBAAuBC,cAAc;AAC1E,QAAMC,UAAUP,UAAUQ,SAAYL,eAAeM,WAAWT,MAAMU,EAAE,IAAIF;AAE5E,SAAOG,YAAY,MAAA;AACjB,QAAI,CAACJ,SAAS;AACZ,YAAM,IAAIK,UAAU,iDAAA;IACtB;AACA,WAAOL,QAAQM,WAAWZ,GAAAA,CAAAA;EAC5B,GAAG;IAACM;OAAaL,QAAQ,CAAA;GAAI;AAC/B;;;ACzBA,SAASY,cAAc;AAEvB,SAASC,cAAc;AACvB,SAASC,iBAAiBC,yBAAyB;AACnD,SAAqBC,gBAAgB;AACrC,SAASC,qBAAqB;AAWvB,IAAMC,4BAA4B,CAACC,UAAAA;AACxC,QAAMC,WAAWC,SAASF,OAAOG,OAAOC,KAAKC,eAAAA,CAAAA;AAE7C,QAAM,CAACC,gBAAgBC,iBAAAA,IAAqBC,cAC1CC,0BAA0BT,OAAO,MAAMU,kBAAkBC,KAAKC,OAAOC,IAAI,CAACC,MAAMA,EAAEC,OAAO,CAAA,CAAA,CAAA;AAG3F,QAAMC,QAAQP,0BACZT,OACAY,OAAOK,WAAW,aAAA;AAChB,UAAMC,aAAa,OAAOR;AAC1B,WAAOQ,WAAWF,MAAK;AACvBT,sBAAkB,IAAA;EACpB,CAAA,CAAA;AAGF,QAAMY,OAAOV,0BACXT,OACAY,OAAOK,WAAW,aAAA;AAChB,UAAMC,aAAa,OAAOR;AAC1B,WAAOQ,WAAWC,KAAI;AACtBZ,sBAAkB,KAAA;EACpB,CAAA,CAAA;AAGF,SAAO;IACLN;IACAmB,WAAWd,kBAAkB;IAC7BU,OAAO,MAAM,KAAKA,MAAAA;IAClBG,MAAM,MAAM,KAAKA,KAAAA;EACnB;AACF;",
|
|
6
|
-
"names": ["useCallback", "useCapability", "useComputeRuntimeCallback", "space", "fn", "deps", "computeRuntime", "useCapability", "AutomationCapabilities", "ComputeRuntime", "runtime", "undefined", "getRuntime", "id", "useCallback", "TypeError", "runPromise", "Effect", "Filter", "FunctionTrigger", "TriggerDispatcher", "useQuery", "useAsyncState", "useTriggerRuntimeControls", "space", "triggers", "useQuery", "Filter", "type", "FunctionTrigger", "isRunningState", "setIsRunningState", "useAsyncState", "useComputeRuntimeCallback", "TriggerDispatcher", "pipe", "Effect", "map", "t", "running", "start", "fnUntraced", "dispatcher", "stop", "isRunning"]
|
|
7
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// src/meta.ts
|
|
2
|
-
var meta = {
|
|
3
|
-
id: "dxos.org/plugin/automation",
|
|
4
|
-
name: "Automation",
|
|
5
|
-
description: "The Automation tab allows you to trigger pre-defined workflows related to the element you are interacting with inside of Composer.",
|
|
6
|
-
icon: "ph--robot--regular",
|
|
7
|
-
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-automation"
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export {
|
|
11
|
-
meta
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=chunk-WWURMV25.mjs.map
|