@dxos/plugin-automation 0.8.4-main.7ace549 → 0.8.4-main.8baae0fced
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/LICENSE +102 -5
- package/README.md +1 -1
- package/dist/lib/neutral/AutomationPanel-GQCS4EPU.mjs +11 -0
- package/dist/lib/neutral/AutomationPlugin.mjs +10 -0
- package/dist/lib/neutral/AutomationPlugin.node.mjs +1111 -0
- package/dist/lib/neutral/AutomationPlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/AutomationPlugin.workerd.mjs +23 -0
- package/dist/lib/neutral/AutomationPlugin.workerd.mjs.map +7 -0
- package/dist/lib/neutral/AutomationSettings-F6AZQV74.mjs +31 -0
- package/dist/lib/neutral/AutomationSettings-F6AZQV74.mjs.map +7 -0
- package/dist/lib/neutral/FunctionsContainer-2ETGQQR2.mjs +38 -0
- package/dist/lib/neutral/FunctionsContainer-2ETGQQR2.mjs.map +7 -0
- package/dist/lib/neutral/FunctionsPanel-SVRKRUXZ.mjs +97 -0
- package/dist/lib/neutral/FunctionsPanel-SVRKRUXZ.mjs.map +7 -0
- package/dist/lib/neutral/FunctionsRegistry-7ITCFJCW.mjs +95 -0
- package/dist/lib/neutral/FunctionsRegistry-7ITCFJCW.mjs.map +7 -0
- package/dist/lib/neutral/TriggerSettings-XCHIZPOR.mjs +9 -0
- package/dist/lib/neutral/app-graph-builder-4QOUKY5L.mjs +75 -0
- package/dist/lib/neutral/app-graph-builder-4QOUKY5L.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +15 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/node.mjs +13 -0
- package/dist/lib/neutral/capabilities/node.mjs.map +7 -0
- package/dist/lib/neutral/chunk-2JP77CMN.mjs +42 -0
- package/dist/lib/neutral/chunk-2JP77CMN.mjs.map +7 -0
- package/dist/lib/{browser/chunk-LZQFZO3B.mjs → neutral/chunk-4ETZEEYR.mjs} +8 -4
- package/dist/lib/neutral/chunk-4ETZEEYR.mjs.map +7 -0
- package/dist/lib/neutral/chunk-EIIPEUUP.mjs +303 -0
- package/dist/lib/neutral/chunk-EIIPEUUP.mjs.map +7 -0
- package/dist/lib/neutral/chunk-HRUXURVS.mjs +12 -0
- package/dist/lib/neutral/chunk-HRUXURVS.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-K3C5ZTZA.mjs +285 -0
- package/dist/lib/neutral/chunk-K3C5ZTZA.mjs.map +7 -0
- package/dist/lib/neutral/chunk-VCWVO3JE.mjs +8 -0
- package/dist/lib/neutral/chunk-VCWVO3JE.mjs.map +7 -0
- package/dist/lib/neutral/chunk-VRGWNUVV.mjs +36 -0
- package/dist/lib/neutral/chunk-VRGWNUVV.mjs.map +7 -0
- package/dist/lib/neutral/chunk-YA2ZTSOH.mjs +73 -0
- package/dist/lib/neutral/chunk-YA2ZTSOH.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +16 -0
- package/dist/lib/neutral/containers/index.mjs +13 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/create-trigger-from-template-XAJWHKO2.mjs +68 -0
- package/dist/lib/neutral/create-trigger-from-template-XAJWHKO2.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +47 -0
- package/dist/lib/neutral/hooks/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +16 -0
- package/dist/lib/neutral/layer-specs-XLG75KLY.mjs +161 -0
- package/dist/lib/neutral/layer-specs-XLG75KLY.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +8 -0
- package/dist/lib/neutral/operation-handler-YXGYH5W5.mjs +13 -0
- package/dist/lib/neutral/operation-handler-YXGYH5W5.mjs.map +7 -0
- package/dist/lib/neutral/operations/index.mjs +8 -0
- package/dist/lib/neutral/plugin.mjs +16 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-3OGMAMKV.mjs +57 -0
- package/dist/lib/neutral/react-surface-3OGMAMKV.mjs.map +7 -0
- package/dist/lib/neutral/testing.mjs +8 -0
- package/dist/lib/neutral/testing.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +47 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +12 -0
- package/dist/lib/neutral/types/index.mjs.map +7 -0
- package/dist/types/src/AutomationPlugin.d.ts +3 -1
- package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
- package/dist/types/src/AutomationPlugin.node.d.ts +4 -0
- package/dist/types/src/AutomationPlugin.node.d.ts.map +1 -0
- package/dist/types/src/AutomationPlugin.test.d.ts +2 -0
- package/dist/types/src/AutomationPlugin.test.d.ts.map +1 -0
- package/dist/types/src/AutomationPlugin.workerd.d.ts +4 -0
- package/dist/types/src/AutomationPlugin.workerd.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +4 -2
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +6 -5
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/layer-specs.d.ts +5 -0
- package/dist/types/src/capabilities/layer-specs.d.ts.map +1 -0
- package/dist/types/src/capabilities/node.d.ts +6 -0
- package/dist/types/src/capabilities/node.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/commands/index.d.ts +2 -0
- package/dist/types/src/commands/index.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/create/index.d.ts +25 -0
- package/dist/types/src/commands/trigger/create/index.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/create/queue.d.ts +13 -0
- package/dist/types/src/commands/trigger/create/queue.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/create/subscription.d.ts +15 -0
- package/dist/types/src/commands/trigger/create/subscription.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/create/timer.d.ts +13 -0
- package/dist/types/src/commands/trigger/create/timer.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/index.d.ts +57 -0
- package/dist/types/src/commands/trigger/index.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/list.d.ts +7 -0
- package/dist/types/src/commands/trigger/list.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/options.d.ts +11 -0
- package/dist/types/src/commands/trigger/options.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/remove.d.ts +8 -0
- package/dist/types/src/commands/trigger/remove.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/update/index.d.ts +28 -0
- package/dist/types/src/commands/trigger/update/index.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/update/queue.d.ts +12 -0
- package/dist/types/src/commands/trigger/update/queue.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/update/subscription.d.ts +13 -0
- package/dist/types/src/commands/trigger/update/subscription.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/update/timer.d.ts +11 -0
- package/dist/types/src/commands/trigger/update/timer.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/util.d.ts +46 -0
- package/dist/types/src/commands/trigger/util.d.ts.map +1 -0
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +5 -6
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts +32 -30
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/index.d.ts.map +1 -1
- package/dist/types/src/components/FunctionsPanel/FunctionsPanel.d.ts.map +1 -1
- package/dist/types/src/components/FunctionsPanel/index.d.ts.map +1 -1
- package/dist/types/src/components/FunctionsRegistry/FunctionsRegistry.d.ts.map +1 -1
- package/dist/types/src/components/FunctionsRegistry/index.d.ts +3 -1
- package/dist/types/src/components/FunctionsRegistry/index.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts +12 -9
- package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts +6 -3
- package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +8 -7
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts +104 -32
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +3 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/AutomationSettings/AutomationSettings.d.ts +6 -0
- package/dist/types/src/containers/AutomationSettings/AutomationSettings.d.ts.map +1 -0
- package/dist/types/src/containers/AutomationSettings/index.d.ts +2 -0
- package/dist/types/src/containers/AutomationSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/FunctionsContainer/FunctionsContainer.d.ts +4 -0
- package/dist/types/src/containers/FunctionsContainer/FunctionsContainer.d.ts.map +1 -0
- package/dist/types/src/containers/FunctionsContainer/index.d.ts +2 -0
- package/dist/types/src/containers/FunctionsContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/TriggerSettings/TriggerSettings.d.ts.map +1 -0
- package/dist/types/src/containers/TriggerSettings/index.d.ts +3 -0
- package/dist/types/src/containers/TriggerSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +5 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +0 -1
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts +5 -4
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -5
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/create-trigger-from-template.d.ts +5 -0
- package/dist/types/src/operations/create-trigger-from-template.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +3 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/testing/test-functions.d.ts +204 -2
- package/dist/types/src/testing/test-functions.d.ts.map +1 -1
- package/dist/types/src/testing.d.ts +2 -0
- package/dist/types/src/testing.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +32 -31
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/AutomationOperation.d.ts +19 -0
- package/dist/types/src/types/AutomationOperation.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +1 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +11 -3
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +144 -70
- package/src/AutomationPlugin.node.ts +28 -0
- package/src/AutomationPlugin.test.ts +27 -0
- package/src/AutomationPlugin.tsx +20 -38
- package/src/AutomationPlugin.workerd.ts +18 -0
- package/src/capabilities/app-graph-builder.ts +59 -80
- package/src/capabilities/index.ts +9 -7
- package/src/capabilities/layer-specs.ts +231 -0
- package/src/capabilities/node.ts +13 -0
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +49 -46
- package/src/commands/index.ts +5 -0
- package/src/commands/trigger/create/index.ts +14 -0
- package/src/commands/trigger/create/queue.ts +86 -0
- package/src/commands/trigger/create/subscription.ts +125 -0
- package/src/commands/trigger/create/timer.ts +90 -0
- package/src/commands/trigger/index.ts +16 -0
- package/src/commands/trigger/list.ts +70 -0
- package/src/commands/trigger/options.ts +59 -0
- package/src/commands/trigger/remove.ts +44 -0
- package/src/commands/trigger/update/index.ts +14 -0
- package/src/commands/trigger/update/queue.ts +194 -0
- package/src/commands/trigger/update/subscription.ts +278 -0
- package/src/commands/trigger/update/timer.ts +193 -0
- package/src/commands/trigger/util.ts +412 -0
- package/src/components/AutomationPanel/AutomationPanel.stories.tsx +15 -8
- package/src/components/AutomationPanel/AutomationPanel.tsx +214 -83
- package/src/components/FunctionsPanel/FunctionsPanel.tsx +43 -42
- package/src/components/FunctionsRegistry/FunctionsRegistry.tsx +38 -46
- package/src/components/FunctionsRegistry/index.ts +4 -1
- package/src/components/TriggerEditor/FunctionInputEditor.tsx +34 -33
- package/src/components/TriggerEditor/SpecSelector.tsx +25 -19
- package/src/components/TriggerEditor/TriggerEditor.stories.tsx +86 -35
- package/src/components/TriggerEditor/TriggerEditor.tsx +88 -47
- package/src/components/index.ts +1 -2
- package/src/containers/AutomationSettings/AutomationSettings.tsx +31 -0
- package/src/containers/AutomationSettings/index.ts +5 -0
- package/src/containers/FunctionsContainer/FunctionsContainer.tsx +33 -0
- package/src/containers/FunctionsContainer/index.ts +5 -0
- package/src/containers/TriggerSettings/TriggerSettings.tsx +48 -0
- package/src/containers/TriggerSettings/index.ts +6 -0
- package/src/containers/index.ts +9 -0
- package/src/hooks/index.ts +1 -1
- package/src/hooks/useTriggerRuntimeControls.ts +38 -19
- package/src/index.ts +1 -6
- package/src/meta.ts +6 -4
- package/src/operations/create-trigger-from-template.ts +71 -0
- package/src/operations/index.ts +7 -0
- package/src/plugin.ts +11 -0
- package/src/testing/test-functions.ts +11 -8
- package/src/testing.ts +7 -0
- package/src/translations.ts +39 -36
- package/src/types/AutomationOperation.ts +30 -0
- package/src/types/index.ts +2 -0
- package/src/types/schema.ts +5 -5
- package/dist/lib/browser/AutomationPanel-M4M77L4V.mjs +0 -11
- package/dist/lib/browser/AutomationSettings-4HCI6KJR.mjs +0 -68
- package/dist/lib/browser/AutomationSettings-4HCI6KJR.mjs.map +0 -7
- package/dist/lib/browser/FunctionsContainer-CDVBRQCT.mjs +0 -144
- package/dist/lib/browser/FunctionsContainer-CDVBRQCT.mjs.map +0 -7
- package/dist/lib/browser/FunctionsPanel-CRW6SJUN.mjs +0 -10
- package/dist/lib/browser/app-graph-builder-W7LLC6XW.mjs +0 -81
- package/dist/lib/browser/app-graph-builder-W7LLC6XW.mjs.map +0 -7
- package/dist/lib/browser/chunk-4MBM6C6A.mjs +0 -100
- package/dist/lib/browser/chunk-4MBM6C6A.mjs.map +0 -7
- package/dist/lib/browser/chunk-7W6QMY3L.mjs +0 -267
- package/dist/lib/browser/chunk-7W6QMY3L.mjs.map +0 -7
- package/dist/lib/browser/chunk-CZVA5NMD.mjs +0 -14
- package/dist/lib/browser/chunk-CZVA5NMD.mjs.map +0 -7
- package/dist/lib/browser/chunk-LZQFZO3B.mjs.map +0 -7
- package/dist/lib/browser/chunk-T6ZESHDY.mjs +0 -191
- package/dist/lib/browser/chunk-T6ZESHDY.mjs.map +0 -7
- package/dist/lib/browser/chunk-TWWFNOIR.mjs +0 -109
- package/dist/lib/browser/chunk-TWWFNOIR.mjs.map +0 -7
- package/dist/lib/browser/chunk-XAKZ4ANY.mjs +0 -15
- package/dist/lib/browser/chunk-XAKZ4ANY.mjs.map +0 -7
- package/dist/lib/browser/chunk-YBPJCY3F.mjs +0 -38
- package/dist/lib/browser/chunk-YBPJCY3F.mjs.map +0 -7
- package/dist/lib/browser/compute-runtime-B4XJVY4Y.mjs +0 -113
- package/dist/lib/browser/compute-runtime-B4XJVY4Y.mjs.map +0 -7
- package/dist/lib/browser/hooks/index.mjs +0 -13
- package/dist/lib/browser/index.mjs +0 -130
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-5HR7M7T6.mjs +0 -77
- package/dist/lib/browser/intent-resolver-5HR7M7T6.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/react-surface-TKU2EQ5A.mjs +0 -64
- package/dist/lib/browser/react-surface-TKU2EQ5A.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -8
- package/dist/lib/node-esm/AutomationPanel-F5CTC6AT.mjs +0 -12
- package/dist/lib/node-esm/AutomationSettings-BQLJIFRT.mjs +0 -69
- package/dist/lib/node-esm/AutomationSettings-BQLJIFRT.mjs.map +0 -7
- package/dist/lib/node-esm/FunctionsContainer-ZHHJPQAZ.mjs +0 -145
- package/dist/lib/node-esm/FunctionsContainer-ZHHJPQAZ.mjs.map +0 -7
- package/dist/lib/node-esm/FunctionsPanel-RVVCS6VH.mjs +0 -11
- package/dist/lib/node-esm/app-graph-builder-SLQOO7GH.mjs +0 -82
- package/dist/lib/node-esm/app-graph-builder-SLQOO7GH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3IYSC75Z.mjs +0 -16
- package/dist/lib/node-esm/chunk-3IYSC75Z.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7B6NAAI6.mjs +0 -101
- package/dist/lib/node-esm/chunk-7B6NAAI6.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CEVIVRTY.mjs +0 -19
- package/dist/lib/node-esm/chunk-CEVIVRTY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CF2SWXPW.mjs +0 -268
- package/dist/lib/node-esm/chunk-CF2SWXPW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ECJKIUBO.mjs +0 -39
- package/dist/lib/node-esm/chunk-ECJKIUBO.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-F76XVENA.mjs +0 -192
- package/dist/lib/node-esm/chunk-F76XVENA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KB7NFEYY.mjs +0 -16
- package/dist/lib/node-esm/chunk-KB7NFEYY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RVK52XGK.mjs +0 -110
- package/dist/lib/node-esm/chunk-RVK52XGK.mjs.map +0 -7
- package/dist/lib/node-esm/compute-runtime-JUWTQXOV.mjs +0 -114
- package/dist/lib/node-esm/compute-runtime-JUWTQXOV.mjs.map +0 -7
- package/dist/lib/node-esm/hooks/index.mjs +0 -14
- package/dist/lib/node-esm/index.mjs +0 -131
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-KDRYB5BC.mjs +0 -78
- package/dist/lib/node-esm/intent-resolver-KDRYB5BC.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/react-surface-7QROSEGH.mjs +0 -65
- package/dist/lib/node-esm/react-surface-7QROSEGH.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -9
- package/dist/types/src/capabilities/capabilities.d.ts +0 -20
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/compute-runtime.d.ts +0 -5
- package/dist/types/src/capabilities/compute-runtime.d.ts.map +0 -1
- 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/AutomationSettings.d.ts +0 -5
- package/dist/types/src/components/AutomationSettings.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/TriggerSettings.d.ts.map +0 -1
- package/dist/types/src/events.d.ts +0 -4
- package/dist/types/src/events.d.ts.map +0 -1
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts +0 -12
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +0 -1
- package/src/capabilities/capabilities.ts +0 -41
- package/src/capabilities/compute-runtime.ts +0 -129
- package/src/capabilities/intent-resolver.ts +0 -72
- package/src/components/AutomationSettings.tsx +0 -30
- package/src/components/FunctionsContainer.tsx +0 -36
- package/src/components/TriggerSettings.tsx +0 -25
- package/src/events.ts +0 -11
- package/src/hooks/useComputeRuntimeCallback.ts +0 -68
- /package/dist/lib/{browser/AutomationPanel-M4M77L4V.mjs.map → neutral/AutomationPanel-GQCS4EPU.mjs.map} +0 -0
- /package/dist/lib/{browser/FunctionsPanel-CRW6SJUN.mjs.map → neutral/AutomationPlugin.mjs.map} +0 -0
- /package/dist/lib/{browser/hooks/index.mjs.map → neutral/TriggerSettings-XCHIZPOR.mjs.map} +0 -0
- /package/dist/lib/{browser/types/index.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/{node-esm/hooks → neutral/components}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/types → neutral}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/AutomationPanel-F5CTC6AT.mjs.map → neutral/meta.mjs.map} +0 -0
- /package/dist/lib/{node-esm/FunctionsPanel-RVVCS6VH.mjs.map → neutral/operations/index.mjs.map} +0 -0
- /package/dist/types/src/{components → containers/TriggerSettings}/TriggerSettings.d.ts +0 -0
|
@@ -4,60 +4,87 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
+
import { Operation, Script, Trigger } from '@dxos/compute';
|
|
7
8
|
import { ComputeGraph } from '@dxos/conductor';
|
|
8
|
-
import { DXN, type Query } from '@dxos/echo';
|
|
9
|
-
import {
|
|
10
|
-
import { Filter, Ref, type Space, useQuery } from '@dxos/react-client/echo';
|
|
9
|
+
import { type Database, DXN, Entity, Feed, Filter, Obj, type Query, Ref } from '@dxos/echo';
|
|
10
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
11
11
|
import { Input } from '@dxos/react-ui';
|
|
12
12
|
import { QueryForm, type QueryFormProps } from '@dxos/react-ui-components';
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
import {
|
|
14
|
+
type ExcludeId,
|
|
15
|
+
Form,
|
|
16
|
+
FormFieldLabel,
|
|
17
|
+
type FormFieldMap,
|
|
18
|
+
type FormRootProps,
|
|
19
|
+
SelectField,
|
|
20
|
+
omitId,
|
|
21
|
+
} from '@dxos/react-ui-form';
|
|
22
|
+
|
|
23
|
+
import { FunctionInputEditor } from './FunctionInputEditor';
|
|
16
24
|
import { SpecSelector } from './SpecSelector';
|
|
17
25
|
|
|
26
|
+
type TriggerFormSchema = ExcludeId<typeof Trigger.Trigger>;
|
|
27
|
+
|
|
18
28
|
export type TriggerEditorProps = {
|
|
19
|
-
|
|
29
|
+
db: Database.Database;
|
|
20
30
|
trigger: Trigger.Trigger;
|
|
21
31
|
// TODO(wittjosiah): This needs to apply to whole spec but currently only applies to spec.kind & spec.query.
|
|
22
32
|
readonlySpec?: boolean;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
} &
|
|
34
|
+
// prettier-ignore
|
|
35
|
+
Pick<QueryFormProps, 'types' | 'tags'> &
|
|
36
|
+
Pick<FormRootProps<TriggerFormSchema>, 'onSave' | 'onCancel'>;
|
|
37
|
+
|
|
38
|
+
export const TriggerEditor = ({ db, types, tags, readonlySpec, trigger, ...formProps }: TriggerEditorProps) => {
|
|
39
|
+
const fieldMap = useCustomInputs({ db, types, tags, readonlySpec });
|
|
40
|
+
|
|
41
|
+
const handleValuesChanged = useCallback(
|
|
42
|
+
(newValues: Partial<TriggerFormSchema>) => {
|
|
43
|
+
Obj.update(trigger, (trigger) => {
|
|
44
|
+
Object.assign(trigger, newValues);
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
[trigger],
|
|
48
|
+
);
|
|
31
49
|
|
|
32
|
-
const
|
|
33
|
-
const
|
|
50
|
+
const triggerSchema = useMemo(() => omitId(Trigger.Trigger), []);
|
|
51
|
+
const defaultValues = useMemo(() => {
|
|
52
|
+
const { id: _, ...values } = trigger;
|
|
53
|
+
return values;
|
|
54
|
+
}, [trigger]);
|
|
34
55
|
|
|
35
56
|
return (
|
|
36
|
-
<Form
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
schema={
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
57
|
+
<Form.Root<TriggerFormSchema>
|
|
58
|
+
{...formProps}
|
|
59
|
+
db={db}
|
|
60
|
+
schema={triggerSchema}
|
|
61
|
+
defaultValues={defaultValues}
|
|
62
|
+
fieldMap={fieldMap}
|
|
63
|
+
onValuesChanged={handleValuesChanged}
|
|
64
|
+
>
|
|
65
|
+
<Form.Viewport>
|
|
66
|
+
<Form.Content>
|
|
67
|
+
<Form.FieldSet />
|
|
68
|
+
<Form.Actions />
|
|
69
|
+
</Form.Content>
|
|
70
|
+
</Form.Viewport>
|
|
71
|
+
</Form.Root>
|
|
45
72
|
);
|
|
46
73
|
};
|
|
47
74
|
|
|
48
75
|
type UseCustomInputsProps = {
|
|
49
|
-
|
|
76
|
+
db: Database.Database;
|
|
50
77
|
readonlySpec?: boolean;
|
|
51
|
-
onQueryRefOptions: FunctionInputEditorProps['onQueryRefOptions'];
|
|
52
78
|
} & Pick<QueryFormProps, 'types' | 'tags'>;
|
|
53
79
|
|
|
54
|
-
const useCustomInputs = ({
|
|
55
|
-
const functions = useQuery(
|
|
56
|
-
const workflows = useQuery(
|
|
57
|
-
const scripts = useQuery(
|
|
80
|
+
const useCustomInputs = ({ db, readonlySpec, types, tags }: UseCustomInputsProps): FormFieldMap => {
|
|
81
|
+
const functions = useQuery(db, Filter.type(Operation.PersistentOperation));
|
|
82
|
+
const workflows = useQuery(db, Filter.type(ComputeGraph));
|
|
83
|
+
const scripts = useQuery(db, Filter.type(Script.Script));
|
|
84
|
+
const feeds = useQuery(db, Filter.type(Feed.Feed));
|
|
58
85
|
|
|
59
86
|
return useMemo(
|
|
60
|
-
():
|
|
87
|
+
(): FormFieldMap => ({
|
|
61
88
|
// Function selector.
|
|
62
89
|
['function' satisfies keyof Trigger.Trigger]: (props) => {
|
|
63
90
|
const getValue = useCallback(() => {
|
|
@@ -73,14 +100,14 @@ const useCustomInputs = ({ space, readonlySpec, types, tags, onQueryRefOptions }
|
|
|
73
100
|
const dxn = DXN.parse(dxnString);
|
|
74
101
|
if (dxn) {
|
|
75
102
|
const ref = Ref.fromDXN(dxn);
|
|
76
|
-
props.onValueChange(
|
|
103
|
+
props.onValueChange(props.type, ref);
|
|
77
104
|
}
|
|
78
105
|
},
|
|
79
|
-
[props.onValueChange],
|
|
106
|
+
[props.type, props.onValueChange],
|
|
80
107
|
);
|
|
81
108
|
|
|
82
109
|
return (
|
|
83
|
-
<
|
|
110
|
+
<SelectField
|
|
84
111
|
{...props}
|
|
85
112
|
getValue={getValue as any}
|
|
86
113
|
onValueChange={handleOnValueChange}
|
|
@@ -90,30 +117,31 @@ const useCustomInputs = ({ space, readonlySpec, types, tags, onQueryRefOptions }
|
|
|
90
117
|
},
|
|
91
118
|
|
|
92
119
|
// Spec selector.
|
|
93
|
-
|
|
120
|
+
'spec.kind': (props) => <SpecSelector {...props} readonly={readonlySpec} />,
|
|
121
|
+
|
|
122
|
+
// Queue feed selector with parent labels.
|
|
123
|
+
'spec.queue': (props) => <SelectField {...props} options={getFeedQueueOptions(feeds)} />,
|
|
94
124
|
|
|
95
125
|
// TODO(wittjosiah): Copied from ViewEditor.
|
|
96
126
|
// Query input editor.
|
|
97
|
-
|
|
127
|
+
'spec.query': (props) => {
|
|
98
128
|
const handleChange = useCallback(
|
|
99
|
-
(query: Query.Any) => props.onValueChange(
|
|
100
|
-
[props.onValueChange],
|
|
129
|
+
(query: Query.Any) => props.onValueChange(props.type, { ast: query.ast }),
|
|
130
|
+
[props.type, props.onValueChange],
|
|
101
131
|
);
|
|
102
132
|
|
|
103
133
|
return (
|
|
104
134
|
<Input.Root>
|
|
105
|
-
<
|
|
135
|
+
<FormFieldLabel label={props.label} asChild />
|
|
106
136
|
<QueryForm initialQuery={(props.getValue() as any).ast} types={types} tags={tags} onChange={handleChange} />
|
|
107
137
|
</Input.Root>
|
|
108
138
|
);
|
|
109
139
|
},
|
|
110
140
|
|
|
111
141
|
// Function input editor.
|
|
112
|
-
|
|
113
|
-
<FunctionInputEditor {...props} functions={functions} onQueryRefOptions={onQueryRefOptions} />
|
|
114
|
-
),
|
|
142
|
+
input: (props) => <FunctionInputEditor {...props} functions={functions} db={db} />,
|
|
115
143
|
}),
|
|
116
|
-
[workflows, scripts, functions, readonlySpec],
|
|
144
|
+
[workflows, scripts, functions, feeds, readonlySpec],
|
|
117
145
|
);
|
|
118
146
|
};
|
|
119
147
|
|
|
@@ -121,7 +149,20 @@ const getWorkflowOptions = (graphs: ComputeGraph[]) => {
|
|
|
121
149
|
return graphs.map((graph) => ({ label: `compute-${graph.id}`, value: `dxn:echo:@:${graph.id}` }));
|
|
122
150
|
};
|
|
123
151
|
|
|
124
|
-
const getFunctionOptions = (scripts: Script.Script[], functions:
|
|
125
|
-
const getLabel = (fn:
|
|
152
|
+
const getFunctionOptions = (scripts: Script.Script[], functions: Operation.PersistentOperation[]) => {
|
|
153
|
+
const getLabel = (fn: Operation.PersistentOperation) =>
|
|
154
|
+
scripts.find((s) => fn.source?.target?.id === s.id)?.name ?? fn.name;
|
|
126
155
|
return functions.map((fn) => ({ label: getLabel(fn), value: `dxn:echo:@:${fn.id}` }));
|
|
127
156
|
};
|
|
157
|
+
|
|
158
|
+
const getFeedQueueOptions = (feeds: Feed.Feed[]) => {
|
|
159
|
+
return feeds.flatMap((feed) => {
|
|
160
|
+
const queueDXN = Feed.getQueueDxn(feed);
|
|
161
|
+
if (!queueDXN) {
|
|
162
|
+
return [];
|
|
163
|
+
}
|
|
164
|
+
const parent = Obj.getParent(feed);
|
|
165
|
+
const label = parent ? Entity.getLabel(parent) : Entity.getLabel(feed);
|
|
166
|
+
return [{ label: label ?? feed.id, value: queueDXN.toString() }];
|
|
167
|
+
});
|
|
168
|
+
};
|
package/src/components/index.ts
CHANGED
|
@@ -7,6 +7,5 @@ import { lazy } from 'react';
|
|
|
7
7
|
export * from './TriggerEditor';
|
|
8
8
|
|
|
9
9
|
export const AutomationPanel = lazy(() => import('./AutomationPanel'));
|
|
10
|
-
export const AutomationSettings = lazy(() => import('./AutomationSettings'));
|
|
11
|
-
export const FunctionsContainer = lazy(() => import('./FunctionsContainer'));
|
|
12
10
|
export const FunctionsPanel = lazy(() => import('./FunctionsPanel'));
|
|
11
|
+
export const FunctionsRegistry = lazy(() => import('./FunctionsRegistry'));
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { AppSurface } from '@dxos/app-toolkit/ui';
|
|
8
|
+
import { useTranslation } from '@dxos/react-ui';
|
|
9
|
+
import { Settings } from '@dxos/react-ui-form';
|
|
10
|
+
|
|
11
|
+
import { meta } from '#meta';
|
|
12
|
+
|
|
13
|
+
import { AutomationPanel, type AutomationPanelProps } from '../../components/AutomationPanel';
|
|
14
|
+
import { TriggersSettings } from '../TriggerSettings';
|
|
15
|
+
|
|
16
|
+
export type AutomationSettingsProps = AppSurface.SpaceArticleProps<Omit<AutomationPanelProps, 'space'>>;
|
|
17
|
+
|
|
18
|
+
export const AutomationSettings = (props: AutomationSettingsProps) => {
|
|
19
|
+
const { t } = useTranslation(meta.id);
|
|
20
|
+
return (
|
|
21
|
+
<Settings.Viewport>
|
|
22
|
+
<Settings.Section
|
|
23
|
+
title={t('automation-verbose.label', { ns: meta.id })}
|
|
24
|
+
description={t('automation.description', { ns: meta.id })}
|
|
25
|
+
>
|
|
26
|
+
<AutomationPanel {...props} />
|
|
27
|
+
<TriggersSettings space={props.space} />
|
|
28
|
+
</Settings.Section>
|
|
29
|
+
</Settings.Viewport>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { AppSurface } from '@dxos/app-toolkit/ui';
|
|
8
|
+
import { useTranslation } from '@dxos/react-ui';
|
|
9
|
+
import { Settings } from '@dxos/react-ui-form';
|
|
10
|
+
|
|
11
|
+
import { meta } from '#meta';
|
|
12
|
+
|
|
13
|
+
import { FunctionsPanel, FunctionsRegistry } from '../../components';
|
|
14
|
+
|
|
15
|
+
export const FunctionsContainer = ({ space }: AppSurface.SpaceArticleProps) => {
|
|
16
|
+
const { t } = useTranslation(meta.id);
|
|
17
|
+
return (
|
|
18
|
+
<Settings.Viewport>
|
|
19
|
+
<Settings.Section
|
|
20
|
+
title={t('functions-verbose.label', { ns: meta.id })}
|
|
21
|
+
description={t('functions.description', { ns: meta.id })}
|
|
22
|
+
>
|
|
23
|
+
<FunctionsPanel space={space} />
|
|
24
|
+
</Settings.Section>
|
|
25
|
+
<Settings.Section
|
|
26
|
+
title={t('functions-registry-verbose.label', { ns: meta.id })}
|
|
27
|
+
description={t('functions-registry.description', { ns: meta.id })}
|
|
28
|
+
>
|
|
29
|
+
<FunctionsRegistry space={space} />
|
|
30
|
+
</Settings.Section>
|
|
31
|
+
</Settings.Viewport>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { type ComputeEnvironment } from '@dxos/client-protocol';
|
|
8
|
+
import { useObject } from '@dxos/echo-react';
|
|
9
|
+
import { type Space } from '@dxos/react-client/echo';
|
|
10
|
+
import { DropdownMenu, IconButton, useTranslation } from '@dxos/react-ui';
|
|
11
|
+
import { Settings } from '@dxos/react-ui-form';
|
|
12
|
+
|
|
13
|
+
import { meta } from '#meta';
|
|
14
|
+
|
|
15
|
+
export const TriggersSettings = ({ space }: { space: Space }) => {
|
|
16
|
+
const { t } = useTranslation(meta.id);
|
|
17
|
+
const [properties, changeProperties] = useObject(space.properties);
|
|
18
|
+
const selected = properties.computeEnvironment ?? 'local';
|
|
19
|
+
|
|
20
|
+
const handleUpdate = (option: ComputeEnvironment) => {
|
|
21
|
+
changeProperties((draft) => {
|
|
22
|
+
draft.computeEnvironment = option;
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<div className='grid grid-cols-1 md:grid-cols-[1fr_min-content]'>
|
|
28
|
+
<Settings.Item title={t('runtime.label')} description={t('runtime.description')}>
|
|
29
|
+
<DropdownMenu.Root>
|
|
30
|
+
<DropdownMenu.Trigger asChild>
|
|
31
|
+
<IconButton iconEnd icon='ph--caret-down--regular' size={4} label={t(`runtime.${selected}.label`)} />
|
|
32
|
+
</DropdownMenu.Trigger>
|
|
33
|
+
<DropdownMenu.Portal>
|
|
34
|
+
<DropdownMenu.Content side='bottom'>
|
|
35
|
+
<DropdownMenu.Viewport>
|
|
36
|
+
<DropdownMenu.Item onClick={() => handleUpdate('disabled')}>
|
|
37
|
+
{t(`runtime.disabled.label`)}
|
|
38
|
+
</DropdownMenu.Item>
|
|
39
|
+
<DropdownMenu.Item onClick={() => handleUpdate('local')}>{t(`runtime.local.label`)}</DropdownMenu.Item>
|
|
40
|
+
<DropdownMenu.Item onClick={() => handleUpdate('edge')}>{t(`runtime.edge.label`)}</DropdownMenu.Item>
|
|
41
|
+
</DropdownMenu.Viewport>
|
|
42
|
+
</DropdownMenu.Content>
|
|
43
|
+
</DropdownMenu.Portal>
|
|
44
|
+
</DropdownMenu.Root>
|
|
45
|
+
</Settings.Item>
|
|
46
|
+
</div>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type ComponentType, lazy } from 'react';
|
|
6
|
+
|
|
7
|
+
export const AutomationSettings: ComponentType<any> = lazy(() => import('./AutomationSettings'));
|
|
8
|
+
export const FunctionsContainer: ComponentType<any> = lazy(() => import('./FunctionsContainer'));
|
|
9
|
+
export const TriggerSettings: ComponentType<any> = lazy(() => import('./TriggerSettings'));
|
package/src/hooks/index.ts
CHANGED
|
@@ -2,51 +2,70 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Atom, useAtomValue } from '@effect-atom/atom-react';
|
|
6
|
+
import type * as Context from 'effect/Context';
|
|
5
7
|
import * as Effect from 'effect/Effect';
|
|
8
|
+
import { useEffect, useState } from 'react';
|
|
6
9
|
|
|
7
|
-
import {
|
|
8
|
-
import { Trigger } from '@dxos/
|
|
9
|
-
import {
|
|
10
|
-
import { type
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
import { useComputeRuntimeCallback } from './useComputeRuntimeCallback';
|
|
10
|
+
import { useSpaceCallback } from '@dxos/app-framework/ui';
|
|
11
|
+
import { Trigger } from '@dxos/compute';
|
|
12
|
+
import { type Database, Filter, Query } from '@dxos/echo';
|
|
13
|
+
import { TriggerDispatcher, type TriggerDispatcherState } from '@dxos/functions-runtime';
|
|
14
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
14
15
|
|
|
15
16
|
interface TriggerRuntimeControls {
|
|
16
17
|
triggers: Trigger.Trigger[];
|
|
17
|
-
|
|
18
|
+
|
|
19
|
+
state: TriggerDispatcherState | undefined;
|
|
20
|
+
|
|
18
21
|
start: () => void;
|
|
19
22
|
stop: () => void;
|
|
20
23
|
}
|
|
21
24
|
|
|
22
|
-
export const useTriggerRuntimeControls = (
|
|
23
|
-
const triggers = useQuery(
|
|
25
|
+
export const useTriggerRuntimeControls = (db: Database.Database | undefined): TriggerRuntimeControls => {
|
|
26
|
+
const triggers = useQuery(
|
|
27
|
+
db,
|
|
28
|
+
Query.select(Filter.type(Trigger.Trigger)).debugLabel('plugin-automation.useTriggerRuntimeControls'),
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const [dispatcher, setDispatcher] = useState<Context.Tag.Service<TriggerDispatcher> | undefined>(undefined);
|
|
24
32
|
|
|
25
|
-
const
|
|
26
|
-
|
|
33
|
+
const init = useSpaceCallback(
|
|
34
|
+
db?.spaceId,
|
|
35
|
+
[TriggerDispatcher],
|
|
36
|
+
Effect.fnUntraced(function* () {
|
|
37
|
+
const dispatcher = yield* TriggerDispatcher;
|
|
38
|
+
setDispatcher(dispatcher);
|
|
39
|
+
}),
|
|
27
40
|
);
|
|
28
41
|
|
|
29
|
-
|
|
30
|
-
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
void init();
|
|
44
|
+
}, []);
|
|
45
|
+
|
|
46
|
+
const state = useAtomValue(dispatcher?.state ?? Atom.make(undefined));
|
|
47
|
+
|
|
48
|
+
const start = useSpaceCallback(
|
|
49
|
+
db?.spaceId,
|
|
50
|
+
[TriggerDispatcher],
|
|
31
51
|
Effect.fnUntraced(function* () {
|
|
32
52
|
const dispatcher = yield* TriggerDispatcher;
|
|
33
53
|
yield* dispatcher.start();
|
|
34
|
-
setIsRunningState(true);
|
|
35
54
|
}),
|
|
36
55
|
);
|
|
37
56
|
|
|
38
|
-
const stop =
|
|
39
|
-
|
|
57
|
+
const stop = useSpaceCallback(
|
|
58
|
+
db?.spaceId,
|
|
59
|
+
[TriggerDispatcher],
|
|
40
60
|
Effect.fnUntraced(function* () {
|
|
41
61
|
const dispatcher = yield* TriggerDispatcher;
|
|
42
62
|
yield* dispatcher.stop();
|
|
43
|
-
setIsRunningState(false);
|
|
44
63
|
}),
|
|
45
64
|
);
|
|
46
65
|
|
|
47
66
|
return {
|
|
48
67
|
triggers,
|
|
49
|
-
|
|
68
|
+
state,
|
|
50
69
|
start: () => void start(),
|
|
51
70
|
stop: () => void stop(),
|
|
52
71
|
};
|
package/src/index.ts
CHANGED
|
@@ -2,10 +2,5 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
export { AutomationCapabilities } from './capabilities';
|
|
6
|
-
export * from './components';
|
|
7
5
|
export * from './meta';
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './hooks';
|
|
10
|
-
|
|
11
|
-
export * from './AutomationPlugin';
|
|
6
|
+
export * from './types';
|
package/src/meta.ts
CHANGED
|
@@ -2,16 +2,18 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Plugin } from '@dxos/app-framework';
|
|
6
6
|
import { trim } from '@dxos/util';
|
|
7
7
|
|
|
8
|
-
export const meta:
|
|
9
|
-
id: 'dxos.
|
|
8
|
+
export const meta: Plugin.Meta = {
|
|
9
|
+
id: 'org.dxos.plugin.automation',
|
|
10
10
|
name: 'Automation',
|
|
11
|
+
author: 'DXOS',
|
|
11
12
|
description: trim`
|
|
12
13
|
Workflow automation engine that triggers custom actions based on object events and conditions.
|
|
13
14
|
Create automated pipelines that respond to changes and streamline repetitive tasks.
|
|
14
15
|
`,
|
|
15
|
-
icon: 'ph--
|
|
16
|
+
icon: 'ph--atom--regular',
|
|
16
17
|
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-automation',
|
|
18
|
+
tags: ['system'],
|
|
17
19
|
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { LayoutOperation, getSpacePath } from '@dxos/app-toolkit';
|
|
8
|
+
import { Operation, Script, Trigger } from '@dxos/compute';
|
|
9
|
+
import { Filter, Obj, Ref } from '@dxos/echo';
|
|
10
|
+
import { type DXN } from '@dxos/keys';
|
|
11
|
+
import { SpaceOperation } from '@dxos/plugin-space';
|
|
12
|
+
|
|
13
|
+
import { meta } from '#meta';
|
|
14
|
+
|
|
15
|
+
import { AutomationOperation } from '../types';
|
|
16
|
+
|
|
17
|
+
const handler: Operation.WithHandler<typeof AutomationOperation.CreateTriggerFromTemplate> =
|
|
18
|
+
AutomationOperation.CreateTriggerFromTemplate.pipe(
|
|
19
|
+
Operation.withHandler(
|
|
20
|
+
Effect.fnUntraced(function* ({ db, template, enabled = false, scriptName, input }) {
|
|
21
|
+
const trigger = Trigger.make({ enabled, input });
|
|
22
|
+
|
|
23
|
+
// TODO(wittjosiah): Factor out function lookup by script name?
|
|
24
|
+
if (scriptName) {
|
|
25
|
+
const scripts = yield* Effect.promise(() => db.query(Filter.type(Script.Script, { name: scriptName })).run());
|
|
26
|
+
const [script] = scripts;
|
|
27
|
+
if (script) {
|
|
28
|
+
const functions = yield* Effect.promise(() =>
|
|
29
|
+
db.query(Filter.type(Operation.PersistentOperation, { source: Ref.make(script) })).run(),
|
|
30
|
+
);
|
|
31
|
+
const [fn] = functions;
|
|
32
|
+
if (fn) {
|
|
33
|
+
Obj.update(trigger, (trigger) => {
|
|
34
|
+
trigger.function = Ref.make(fn);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
switch (template.type) {
|
|
41
|
+
case 'timer': {
|
|
42
|
+
Obj.update(trigger, (trigger) => {
|
|
43
|
+
trigger.spec = Trigger.specTimer(template.cron);
|
|
44
|
+
});
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
case 'queue': {
|
|
48
|
+
Obj.update(trigger, (trigger) => {
|
|
49
|
+
trigger.spec = Trigger.specQueue((template.queueDXN as DXN).toString());
|
|
50
|
+
});
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
default: {
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
yield* Operation.invoke(SpaceOperation.AddObject, {
|
|
59
|
+
object: trigger,
|
|
60
|
+
target: db,
|
|
61
|
+
hidden: true,
|
|
62
|
+
});
|
|
63
|
+
yield* Operation.invoke(LayoutOperation.Open, {
|
|
64
|
+
subject: [`${getSpacePath(db.spaceId)}/settings/${meta.id}.automations`],
|
|
65
|
+
workspace: getSpacePath(db.spaceId),
|
|
66
|
+
});
|
|
67
|
+
}),
|
|
68
|
+
),
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
export default handler;
|
package/src/plugin.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
import { meta } from './meta';
|
|
8
|
+
|
|
9
|
+
export const AutomationPlugin = Plugin.lazy(meta, () => import('#plugin'));
|
|
10
|
+
|
|
11
|
+
export { AutomationOperationHandlerSet } from './operations';
|
|
@@ -5,13 +5,14 @@
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
7
|
import { TestSchema } from '@dxos/client/testing';
|
|
8
|
-
import {
|
|
8
|
+
import { JsonSchema, Ref } from '@dxos/echo';
|
|
9
9
|
|
|
10
10
|
export const functions = [
|
|
11
11
|
{
|
|
12
|
-
|
|
12
|
+
key: 'com.example.function.chess',
|
|
13
|
+
name: 'com.example.function.chess',
|
|
13
14
|
version: '0.1.0',
|
|
14
|
-
inputSchema:
|
|
15
|
+
inputSchema: JsonSchema.toJsonSchema(
|
|
15
16
|
Schema.Struct({
|
|
16
17
|
level: Schema.Number.annotations({
|
|
17
18
|
title: 'Level',
|
|
@@ -20,10 +21,11 @@ export const functions = [
|
|
|
20
21
|
),
|
|
21
22
|
},
|
|
22
23
|
{
|
|
23
|
-
|
|
24
|
+
key: 'com.example.function.forex',
|
|
25
|
+
name: 'com.example.function.forex',
|
|
24
26
|
version: '0.1.0',
|
|
25
27
|
binding: 'FOREX',
|
|
26
|
-
inputSchema:
|
|
28
|
+
inputSchema: JsonSchema.toJsonSchema(
|
|
27
29
|
Schema.Struct({
|
|
28
30
|
from: Schema.String.annotations({ title: 'Currency from' }),
|
|
29
31
|
to: Schema.String.annotations({ title: 'Currency to' }),
|
|
@@ -31,11 +33,12 @@ export const functions = [
|
|
|
31
33
|
),
|
|
32
34
|
},
|
|
33
35
|
{
|
|
34
|
-
|
|
36
|
+
key: 'com.example.function.ping-contact',
|
|
37
|
+
name: 'com.example.function.ping-contact',
|
|
35
38
|
version: '0.0.1',
|
|
36
|
-
inputSchema:
|
|
39
|
+
inputSchema: JsonSchema.toJsonSchema(
|
|
37
40
|
Schema.Struct({
|
|
38
|
-
contact:
|
|
41
|
+
contact: Ref.Ref(TestSchema.ContactType).annotations({ title: 'Contact' }),
|
|
39
42
|
}),
|
|
40
43
|
),
|
|
41
44
|
},
|