@dxos/plugin-automation 0.8.4-main.d05673bc65 → 0.8.4-main.dfabb4ec29
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/neutral/AutomationPanel-64U7W3SJ.mjs +11 -0
- package/dist/lib/neutral/AutomationPlugin.mjs +38 -0
- package/dist/lib/neutral/AutomationPlugin.mjs.map +7 -0
- package/dist/lib/{browser/cli/index.mjs → neutral/AutomationPlugin.node.mjs} +111 -113
- package/dist/lib/neutral/AutomationPlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/AutomationSettings-NNL2AVNT.mjs +31 -0
- package/dist/lib/neutral/AutomationSettings-NNL2AVNT.mjs.map +7 -0
- package/dist/lib/neutral/FunctionsContainer-CU2FVKZF.mjs +38 -0
- package/dist/lib/neutral/FunctionsContainer-CU2FVKZF.mjs.map +7 -0
- package/dist/lib/{browser/chunk-75XLBFAG.mjs → neutral/FunctionsPanel-GLCUBEDT.mjs} +20 -21
- package/dist/lib/neutral/FunctionsPanel-GLCUBEDT.mjs.map +7 -0
- package/dist/lib/{node-esm/chunk-6JVB3IHW.mjs → neutral/FunctionsRegistry-VRU4FBVH.mjs} +16 -19
- package/dist/lib/neutral/FunctionsRegistry-VRU4FBVH.mjs.map +7 -0
- package/dist/lib/neutral/TriggerSettings-XCHIZPOR.mjs +9 -0
- package/dist/lib/neutral/app-graph-builder-GDCGRYEP.mjs +75 -0
- package/dist/lib/neutral/app-graph-builder-GDCGRYEP.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-EL64ZPPN.mjs → neutral/chunk-ATECY555.mjs} +6 -3
- package/dist/lib/{browser/chunk-EL64ZPPN.mjs.map → neutral/chunk-ATECY555.mjs.map} +3 -3
- package/dist/lib/neutral/chunk-DSCOLDT5.mjs +93 -0
- package/dist/lib/neutral/chunk-DSCOLDT5.mjs.map +7 -0
- package/dist/lib/{browser/chunk-O23LHDEX.mjs → neutral/chunk-FKFFU54G.mjs} +22 -21
- package/dist/lib/neutral/chunk-FKFFU54G.mjs.map +7 -0
- package/dist/lib/neutral/chunk-GDNOJOAR.mjs +8 -0
- package/dist/lib/neutral/chunk-GDNOJOAR.mjs.map +7 -0
- package/dist/lib/neutral/chunk-IGGNE2XI.mjs +12 -0
- package/dist/lib/neutral/chunk-IGGNE2XI.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/{browser/chunk-BWEKRPFJ.mjs → neutral/chunk-N735CP33.mjs} +24 -33
- package/dist/lib/neutral/chunk-N735CP33.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +16 -0
- package/dist/lib/neutral/compute-runtime-2Q5MGOR6.mjs +220 -0
- package/dist/lib/neutral/compute-runtime-2Q5MGOR6.mjs.map +7 -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-5FT7O7OU.mjs +69 -0
- package/dist/lib/neutral/create-trigger-from-template-5FT7O7OU.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +129 -0
- package/dist/lib/neutral/hooks/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +20 -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/translations.mjs +47 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +16 -0
- package/dist/types/src/AutomationPlugin.d.ts +1 -0
- package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
- package/dist/types/src/{cli/plugin.d.ts → AutomationPlugin.node.d.ts} +2 -1
- 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/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/{compute-runtime/compute-runtime.d.ts → compute-runtime.d.ts} +9 -1
- package/dist/types/src/capabilities/compute-runtime.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +6 -4
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- 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.map +1 -0
- package/dist/types/src/commands/index.d.ts.map +1 -0
- package/dist/types/src/{cli/commands → commands}/trigger/create/index.d.ts +6 -6
- package/dist/types/src/commands/trigger/create/index.d.ts.map +1 -0
- package/dist/types/src/{cli/commands → commands}/trigger/create/queue.d.ts +1 -1
- package/dist/types/src/commands/trigger/create/queue.d.ts.map +1 -0
- package/dist/types/src/{cli/commands → commands}/trigger/create/subscription.d.ts +1 -1
- package/dist/types/src/commands/trigger/create/subscription.d.ts.map +1 -0
- package/dist/types/src/{cli/commands → commands}/trigger/create/timer.d.ts +1 -1
- package/dist/types/src/commands/trigger/create/timer.d.ts.map +1 -0
- package/dist/types/src/{cli/commands → commands}/trigger/index.d.ts +7 -7
- package/dist/types/src/commands/trigger/index.d.ts.map +1 -0
- package/dist/types/src/{cli/commands → commands}/trigger/list.d.ts +1 -1
- package/dist/types/src/commands/trigger/list.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/options.d.ts.map +1 -0
- package/dist/types/src/{cli/commands → commands}/trigger/remove.d.ts +1 -1
- package/dist/types/src/commands/trigger/remove.d.ts.map +1 -0
- package/dist/types/src/{cli/commands → commands}/trigger/update/index.d.ts +5 -5
- package/dist/types/src/commands/trigger/update/index.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/update/queue.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/update/subscription.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/update/timer.d.ts.map +1 -0
- package/dist/types/src/{cli/commands → commands}/trigger/util.d.ts +2 -2
- package/dist/types/src/commands/trigger/util.d.ts.map +1 -0
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts +32 -32
- 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.map +1 -1
- package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts +6 -6
- package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts +4 -4
- package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts +95 -93
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
- package/dist/types/src/containers/AutomationSettings/AutomationSettings.d.ts +3 -1
- package/dist/types/src/containers/AutomationSettings/AutomationSettings.d.ts.map +1 -1
- package/dist/types/src/containers/AutomationSettings/index.d.ts +1 -2
- package/dist/types/src/containers/AutomationSettings/index.d.ts.map +1 -1
- package/dist/types/src/containers/FunctionsContainer/FunctionsContainer.d.ts +2 -4
- package/dist/types/src/containers/FunctionsContainer/FunctionsContainer.d.ts.map +1 -1
- package/dist/types/src/containers/FunctionsContainer/index.d.ts +1 -2
- package/dist/types/src/containers/FunctionsContainer/index.d.ts.map +1 -1
- package/dist/types/src/containers/TriggerSettings/TriggerSettings.d.ts +3 -3
- package/dist/types/src/containers/TriggerSettings/TriggerSettings.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +2 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useComputeRuntime.d.ts +8 -0
- package/dist/types/src/hooks/useComputeRuntime.d.ts.map +1 -0
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts +1 -4
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +1 -1
- package/dist/types/src/hooks/useComputeRuntimeService.d.ts +17 -0
- package/dist/types/src/hooks/useComputeRuntimeService.d.ts.map +1 -0
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts +1 -1
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +0 -3
- package/dist/types/src/index.d.ts.map +1 -1
- 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 +78 -76
- package/dist/types/src/testing/test-functions.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +32 -33
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/AutomationCapabilities.d.ts +22 -0
- package/dist/types/src/types/AutomationCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/AutomationEvents.d.ts +3 -0
- package/dist/types/src/types/AutomationEvents.d.ts.map +1 -0
- 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 +3 -2
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +7 -28
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +115 -66
- package/src/AutomationPlugin.node.ts +29 -0
- package/src/AutomationPlugin.test.ts +27 -0
- package/src/AutomationPlugin.tsx +11 -9
- package/src/capabilities/app-graph-builder.ts +66 -0
- package/src/capabilities/compute-runtime.ts +325 -0
- package/src/capabilities/index.ts +10 -4
- package/src/capabilities/node.ts +13 -0
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/{react-surface/react-surface.tsx → react-surface.tsx} +17 -15
- package/src/{cli/commands → commands}/trigger/create/queue.ts +4 -7
- package/src/{cli/commands → commands}/trigger/create/subscription.ts +8 -11
- package/src/{cli/commands → commands}/trigger/create/timer.ts +4 -7
- package/src/{cli/commands → commands}/trigger/list.ts +7 -4
- package/src/{cli/commands → commands}/trigger/remove.ts +1 -1
- package/src/{cli/commands → commands}/trigger/update/queue.ts +16 -17
- package/src/{cli/commands → commands}/trigger/update/subscription.ts +15 -15
- package/src/{cli/commands → commands}/trigger/update/timer.ts +16 -16
- package/src/{cli/commands → commands}/trigger/util.ts +13 -7
- package/src/components/AutomationPanel/AutomationPanel.stories.tsx +6 -5
- package/src/components/AutomationPanel/AutomationPanel.tsx +51 -43
- package/src/components/FunctionsPanel/FunctionsPanel.tsx +31 -24
- package/src/components/FunctionsRegistry/FunctionsRegistry.tsx +22 -18
- package/src/components/TriggerEditor/FunctionInputEditor.tsx +4 -4
- package/src/components/TriggerEditor/SpecSelector.tsx +17 -13
- package/src/components/TriggerEditor/TriggerEditor.stories.tsx +13 -13
- package/src/components/TriggerEditor/TriggerEditor.tsx +8 -12
- package/src/containers/AutomationSettings/AutomationSettings.tsx +11 -7
- package/src/containers/AutomationSettings/index.ts +1 -3
- package/src/containers/FunctionsContainer/FunctionsContainer.tsx +11 -11
- package/src/containers/FunctionsContainer/index.ts +1 -3
- package/src/containers/TriggerSettings/TriggerSettings.tsx +32 -10
- package/src/hooks/index.ts +3 -0
- package/src/hooks/useComputeRuntime.ts +30 -0
- package/src/hooks/useComputeRuntimeCallback.ts +4 -39
- package/src/hooks/useComputeRuntimeService.ts +64 -0
- package/src/hooks/useTriggerRuntimeControls.ts +6 -3
- package/src/index.ts +0 -4
- package/src/meta.ts +2 -1
- package/src/operations/create-trigger-from-template.ts +72 -0
- package/src/operations/index.ts +7 -0
- package/src/plugin.ts +11 -0
- package/src/testing/test-functions.ts +6 -3
- package/src/translations.ts +38 -39
- package/src/types/AutomationCapabilities.ts +48 -0
- package/src/types/AutomationEvents.ts +11 -0
- package/src/types/AutomationOperation.ts +30 -0
- package/src/types/index.ts +4 -2
- package/src/types/schema.ts +2 -23
- package/dist/lib/browser/AutomationPanel-IGLIQY2N.mjs +0 -11
- package/dist/lib/browser/AutomationSettings-EDO3N5WI.mjs +0 -37
- package/dist/lib/browser/AutomationSettings-EDO3N5WI.mjs.map +0 -7
- package/dist/lib/browser/FunctionsContainer-R4ZMYSFJ.mjs +0 -43
- package/dist/lib/browser/FunctionsContainer-R4ZMYSFJ.mjs.map +0 -7
- package/dist/lib/browser/FunctionsPanel-NMA4RYJL.mjs +0 -10
- package/dist/lib/browser/FunctionsRegistry-TMKAEG5E.mjs +0 -10
- package/dist/lib/browser/TriggerSettings-56AIMOEC.mjs +0 -11
- package/dist/lib/browser/app-graph-builder-74ILZP25.mjs +0 -83
- package/dist/lib/browser/app-graph-builder-74ILZP25.mjs.map +0 -7
- package/dist/lib/browser/chunk-75XLBFAG.mjs.map +0 -7
- package/dist/lib/browser/chunk-BWEKRPFJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-FUVAC5EC.mjs +0 -96
- package/dist/lib/browser/chunk-FUVAC5EC.mjs.map +0 -7
- package/dist/lib/browser/chunk-GVHAETEQ.mjs +0 -83
- package/dist/lib/browser/chunk-GVHAETEQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-H2MV4XE6.mjs +0 -31
- package/dist/lib/browser/chunk-H2MV4XE6.mjs.map +0 -7
- package/dist/lib/browser/chunk-O23LHDEX.mjs.map +0 -7
- package/dist/lib/browser/chunk-OAZ2JYXV.mjs +0 -93
- package/dist/lib/browser/chunk-OAZ2JYXV.mjs.map +0 -7
- package/dist/lib/browser/chunk-Z7F7X2C5.mjs +0 -8
- package/dist/lib/browser/chunk-Z7F7X2C5.mjs.map +0 -7
- package/dist/lib/browser/cli/index.mjs.map +0 -7
- package/dist/lib/browser/compute-runtime-F3UMRKCL.mjs +0 -124
- package/dist/lib/browser/compute-runtime-F3UMRKCL.mjs.map +0 -7
- package/dist/lib/browser/hooks/index.mjs +0 -13
- package/dist/lib/browser/index.mjs +0 -123
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/operation-resolver-IRC2DZU7.mjs +0 -84
- package/dist/lib/browser/operation-resolver-IRC2DZU7.mjs.map +0 -7
- package/dist/lib/browser/react-surface-5MFPVWIN.mjs +0 -65
- package/dist/lib/browser/react-surface-5MFPVWIN.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -14
- package/dist/lib/node-esm/AutomationPanel-O2BCQA7P.mjs +0 -12
- package/dist/lib/node-esm/AutomationPanel-O2BCQA7P.mjs.map +0 -7
- package/dist/lib/node-esm/AutomationSettings-LJNRQUX7.mjs +0 -38
- package/dist/lib/node-esm/AutomationSettings-LJNRQUX7.mjs.map +0 -7
- package/dist/lib/node-esm/FunctionsContainer-GYRPQZM7.mjs +0 -44
- package/dist/lib/node-esm/FunctionsContainer-GYRPQZM7.mjs.map +0 -7
- package/dist/lib/node-esm/FunctionsPanel-DCXXLSVP.mjs +0 -11
- package/dist/lib/node-esm/FunctionsPanel-DCXXLSVP.mjs.map +0 -7
- package/dist/lib/node-esm/FunctionsRegistry-7WCHC64E.mjs +0 -11
- package/dist/lib/node-esm/FunctionsRegistry-7WCHC64E.mjs.map +0 -7
- package/dist/lib/node-esm/TriggerSettings-ONY5ZUKW.mjs +0 -12
- package/dist/lib/node-esm/TriggerSettings-ONY5ZUKW.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-VDXPOWCH.mjs +0 -84
- package/dist/lib/node-esm/app-graph-builder-VDXPOWCH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2UF55HSG.mjs +0 -94
- package/dist/lib/node-esm/chunk-2UF55HSG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6B4WZRVH.mjs +0 -84
- package/dist/lib/node-esm/chunk-6B4WZRVH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6JVB3IHW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FPXVLTEY.mjs +0 -270
- package/dist/lib/node-esm/chunk-FPXVLTEY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-JVUE5PMI.mjs +0 -32
- package/dist/lib/node-esm/chunk-JVUE5PMI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-K7T2MVB7.mjs +0 -98
- package/dist/lib/node-esm/chunk-K7T2MVB7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Q5JSKD6Z.mjs +0 -295
- package/dist/lib/node-esm/chunk-Q5JSKD6Z.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-R5YEWJCG.mjs +0 -10
- package/dist/lib/node-esm/chunk-R5YEWJCG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WC5AT7B3.mjs +0 -19
- package/dist/lib/node-esm/chunk-WC5AT7B3.mjs.map +0 -7
- package/dist/lib/node-esm/cli/index.mjs +0 -1116
- package/dist/lib/node-esm/cli/index.mjs.map +0 -7
- package/dist/lib/node-esm/compute-runtime-AMFVJMF2.mjs +0 -125
- package/dist/lib/node-esm/compute-runtime-AMFVJMF2.mjs.map +0 -7
- package/dist/lib/node-esm/hooks/index.mjs +0 -14
- package/dist/lib/node-esm/index.mjs +0 -124
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/operation-resolver-CBLQHL4N.mjs +0 -85
- package/dist/lib/node-esm/operation-resolver-CBLQHL4N.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-Z74AHU4T.mjs +0 -66
- package/dist/lib/node-esm/react-surface-Z74AHU4T.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -15
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +0 -3
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/compute-runtime/compute-runtime.d.ts.map +0 -1
- package/dist/types/src/capabilities/compute-runtime/index.d.ts +0 -3
- package/dist/types/src/capabilities/compute-runtime/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/cli/commands/index.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/create/index.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/create/queue.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/create/subscription.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/create/timer.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/index.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/list.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/options.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/remove.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/update/index.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/update/queue.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/update/subscription.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/update/timer.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/util.d.ts.map +0 -1
- package/dist/types/src/cli/index.d.ts +0 -2
- package/dist/types/src/cli/index.d.ts.map +0 -1
- package/dist/types/src/cli/plugin.d.ts.map +0 -1
- package/dist/types/src/types/capabilities.d.ts +0 -22
- package/dist/types/src/types/capabilities.d.ts.map +0 -1
- package/dist/types/src/types/events.d.ts +0 -5
- package/dist/types/src/types/events.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +0 -73
- package/src/capabilities/app-graph-builder/index.ts +0 -7
- package/src/capabilities/compute-runtime/compute-runtime.ts +0 -146
- package/src/capabilities/compute-runtime/index.ts +0 -7
- package/src/capabilities/operation-resolver/index.ts +0 -7
- package/src/capabilities/operation-resolver/operation-resolver.ts +0 -80
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/cli/index.ts +0 -5
- package/src/cli/plugin.ts +0 -24
- package/src/types/capabilities.ts +0 -43
- package/src/types/events.ts +0 -11
- /package/dist/lib/{browser/AutomationPanel-IGLIQY2N.mjs.map → neutral/AutomationPanel-64U7W3SJ.mjs.map} +0 -0
- /package/dist/lib/{browser/FunctionsPanel-NMA4RYJL.mjs.map → neutral/TriggerSettings-XCHIZPOR.mjs.map} +0 -0
- /package/dist/lib/{browser/FunctionsRegistry-TMKAEG5E.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/{browser/hooks → neutral/components}/index.mjs.map +0 -0
- /package/dist/lib/{browser/types → neutral}/index.mjs.map +0 -0
- /package/dist/lib/{browser/TriggerSettings-56AIMOEC.mjs.map → neutral/meta.mjs.map} +0 -0
- /package/dist/lib/{node-esm/hooks → neutral/operations}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm → neutral}/types/index.mjs.map +0 -0
- /package/dist/types/src/capabilities/{app-graph-builder/app-graph-builder.d.ts → app-graph-builder.d.ts} +0 -0
- /package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +0 -0
- /package/dist/types/src/{cli/commands → commands}/index.d.ts +0 -0
- /package/dist/types/src/{cli/commands → commands}/trigger/options.d.ts +0 -0
- /package/dist/types/src/{cli/commands → commands}/trigger/update/queue.d.ts +0 -0
- /package/dist/types/src/{cli/commands → commands}/trigger/update/subscription.d.ts +0 -0
- /package/dist/types/src/{cli/commands → commands}/trigger/update/timer.d.ts +0 -0
- /package/src/{cli/commands → commands}/index.ts +0 -0
- /package/src/{cli/commands → commands}/trigger/create/index.ts +0 -0
- /package/src/{cli/commands → commands}/trigger/index.ts +0 -0
- /package/src/{cli/commands → commands}/trigger/options.ts +0 -0
- /package/src/{cli/commands → commands}/trigger/update/index.ts +0 -0
|
@@ -6,7 +6,8 @@ import * as Schema from 'effect/Schema';
|
|
|
6
6
|
import { useState } from 'react';
|
|
7
7
|
import React, { useCallback } from 'react';
|
|
8
8
|
|
|
9
|
-
import
|
|
9
|
+
import * as OperationModule from '@dxos/compute';
|
|
10
|
+
import { Context } from '@dxos/context';
|
|
10
11
|
import { getDeployedFunctions } from '@dxos/functions-runtime/edge';
|
|
11
12
|
import { useClient } from '@dxos/react-client';
|
|
12
13
|
import { Filter, Query, type Space, useQuery } from '@dxos/react-client/echo';
|
|
@@ -15,7 +16,7 @@ import { Settings } from '@dxos/react-ui-form';
|
|
|
15
16
|
import { List } from '@dxos/react-ui-list';
|
|
16
17
|
import { ghostHover, mx } from '@dxos/ui-theme';
|
|
17
18
|
|
|
18
|
-
import { meta } from '
|
|
19
|
+
import { meta } from '#meta';
|
|
19
20
|
|
|
20
21
|
const grid = 'grid grid-cols-[1fr_1fr_auto] min-h-[2.5rem]';
|
|
21
22
|
|
|
@@ -26,12 +27,12 @@ type FunctionsRegistryProps = {
|
|
|
26
27
|
export const FunctionsRegistry = ({ space }: FunctionsRegistryProps) => {
|
|
27
28
|
const client = useClient();
|
|
28
29
|
const [loading, setLoading] = useState(true);
|
|
29
|
-
const [functions, setFunctions] = useState<
|
|
30
|
+
const [functions, setFunctions] = useState<OperationModule.Operation.PersistentOperation[]>([]);
|
|
30
31
|
const { t } = useTranslation(meta.id);
|
|
31
32
|
|
|
32
|
-
const dbFunctions = useQuery(space.db, Filter.type(
|
|
33
|
+
const dbFunctions = useQuery(space.db, Filter.type(OperationModule.Operation.PersistentOperation));
|
|
33
34
|
|
|
34
|
-
const state = (func:
|
|
35
|
+
const state = (func: OperationModule.Operation.PersistentOperation) => {
|
|
35
36
|
const dbFunction = dbFunctions.find((f) => f.key === func.key);
|
|
36
37
|
if (!dbFunction) {
|
|
37
38
|
return 'import';
|
|
@@ -44,32 +45,38 @@ export const FunctionsRegistry = ({ space }: FunctionsRegistryProps) => {
|
|
|
44
45
|
|
|
45
46
|
useAsyncEffect(async () => {
|
|
46
47
|
setLoading(true);
|
|
47
|
-
const functions = await getDeployedFunctions(client, true);
|
|
48
|
+
const functions = await getDeployedFunctions(Context.default(), client, true);
|
|
48
49
|
setFunctions(functions);
|
|
49
50
|
setLoading(false);
|
|
50
51
|
}, []);
|
|
51
52
|
|
|
52
53
|
const hanleImportOrUpdate = useCallback(
|
|
53
|
-
async (func:
|
|
54
|
-
const functions = await space.db
|
|
54
|
+
async (func: OperationModule.Operation.PersistentOperation) => {
|
|
55
|
+
const functions = await space.db
|
|
56
|
+
.query(Query.type(OperationModule.Operation.PersistentOperation, { key: func.key }))
|
|
57
|
+
.run();
|
|
55
58
|
const [existingFunc] = functions;
|
|
56
59
|
if (!existingFunc) {
|
|
57
60
|
space.db.add(func);
|
|
58
61
|
return;
|
|
59
62
|
}
|
|
60
|
-
|
|
63
|
+
OperationModule.Operation.setFrom(existingFunc, func);
|
|
61
64
|
},
|
|
62
65
|
[space],
|
|
63
66
|
);
|
|
64
67
|
|
|
65
68
|
return (
|
|
66
|
-
<Settings.
|
|
69
|
+
<Settings.Panel>
|
|
67
70
|
{functions.length > 0 && (
|
|
68
|
-
<List.Root<
|
|
71
|
+
<List.Root<OperationModule.Operation.PersistentOperation>
|
|
72
|
+
items={functions}
|
|
73
|
+
isItem={Schema.is(OperationModule.Operation.PersistentOperation)}
|
|
74
|
+
getId={(func) => func.id}
|
|
75
|
+
>
|
|
69
76
|
{({ items }) => (
|
|
70
77
|
<div role='list' className='flex flex-col w-full'>
|
|
71
78
|
{items?.map((func) => (
|
|
72
|
-
<List.Item<
|
|
79
|
+
<List.Item<OperationModule.Operation.PersistentOperation>
|
|
73
80
|
key={func.id}
|
|
74
81
|
item={func}
|
|
75
82
|
classNames={mx(grid, ghostHover, 'items-center', 'px-2', 'min-h-[3rem]')}
|
|
@@ -89,7 +96,7 @@ export const FunctionsRegistry = ({ space }: FunctionsRegistryProps) => {
|
|
|
89
96
|
iconOnly
|
|
90
97
|
icon={state(func) === 'update' ? 'ph--arrows-clockwise--regular' : 'ph--download--regular'}
|
|
91
98
|
label={
|
|
92
|
-
state(func) === 'update' ? t('update
|
|
99
|
+
state(func) === 'update' ? t('update-function-button.label') : t('import-function-button.label')
|
|
93
100
|
}
|
|
94
101
|
disabled={state(func) === 'none'}
|
|
95
102
|
onClick={() => hanleImportOrUpdate(func)}
|
|
@@ -101,10 +108,7 @@ export const FunctionsRegistry = ({ space }: FunctionsRegistryProps) => {
|
|
|
101
108
|
</List.Root>
|
|
102
109
|
)}
|
|
103
110
|
|
|
104
|
-
{
|
|
105
|
-
|
|
106
|
-
)}
|
|
107
|
-
{loading && <div className='text-center py-4 text-gray-500'>{t('loading functions')}</div>}
|
|
108
|
-
</Settings.Container>
|
|
111
|
+
{loading && <div className='text-center py-4 text-gray-500'>{t('loading-functions.message')}</div>}
|
|
112
|
+
</Settings.Panel>
|
|
109
113
|
);
|
|
110
114
|
};
|
|
@@ -5,17 +5,17 @@
|
|
|
5
5
|
import type * as SchemaAST from 'effect/SchemaAST';
|
|
6
6
|
import React, { useCallback, useMemo } from 'react';
|
|
7
7
|
|
|
8
|
+
import { type Operation } from '@dxos/compute';
|
|
8
9
|
import { type Database, JsonSchema, Obj, Ref } from '@dxos/echo';
|
|
9
10
|
import { type JsonPath } from '@dxos/echo/internal';
|
|
10
|
-
import { type Function } from '@dxos/functions';
|
|
11
11
|
import { useOnTransition, useTranslation } from '@dxos/react-ui';
|
|
12
12
|
import { Form, type FormFieldStateProps, type FormRootProps, useFormValues } from '@dxos/react-ui-form';
|
|
13
13
|
|
|
14
|
-
import { meta } from '
|
|
14
|
+
import { meta } from '#meta';
|
|
15
15
|
|
|
16
16
|
export type FunctionInputEditorProps = {
|
|
17
17
|
type: SchemaAST.AST;
|
|
18
|
-
functions:
|
|
18
|
+
functions: Operation.PersistentOperation[];
|
|
19
19
|
db?: Database.Database;
|
|
20
20
|
} & FormFieldStateProps;
|
|
21
21
|
|
|
@@ -68,7 +68,7 @@ export const FunctionInputEditor = ({ type, functions, db, getValue, onValueChan
|
|
|
68
68
|
|
|
69
69
|
return (
|
|
70
70
|
<>
|
|
71
|
-
<Form.Label label={t('function
|
|
71
|
+
<Form.Label label={t('function-parameters.label')} asChild />
|
|
72
72
|
<Form.Root
|
|
73
73
|
key={selectedFunction.id}
|
|
74
74
|
schema={effectSchema}
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
+
import { Trigger } from '@dxos/compute';
|
|
7
8
|
import { Filter, Query } from '@dxos/echo';
|
|
8
|
-
import { Trigger } from '@dxos/functions';
|
|
9
9
|
import { useTranslation } from '@dxos/react-ui';
|
|
10
10
|
import { type FormFieldComponentProps, SelectField, useFormFieldState } from '@dxos/react-ui-form';
|
|
11
11
|
|
|
12
|
-
import { meta } from '
|
|
12
|
+
import { meta } from '#meta';
|
|
13
13
|
|
|
14
14
|
export type SpecSelectorProps = FormFieldComponentProps;
|
|
15
15
|
|
|
@@ -22,20 +22,15 @@ export const SpecSelector = (props: SpecSelectorProps) => {
|
|
|
22
22
|
const getDefaultTriggerSpec = (kind: string) => {
|
|
23
23
|
switch (kind) {
|
|
24
24
|
case 'timer':
|
|
25
|
-
return
|
|
25
|
+
return Trigger.specTimer('');
|
|
26
26
|
case 'subscription':
|
|
27
|
-
return
|
|
28
|
-
kind: 'subscription',
|
|
29
|
-
query: {
|
|
30
|
-
ast: Query.select(Filter.nothing()).ast,
|
|
31
|
-
},
|
|
32
|
-
};
|
|
27
|
+
return Trigger.specSubscription(Query.select(Filter.nothing()));
|
|
33
28
|
case 'queue':
|
|
34
|
-
return
|
|
29
|
+
return Trigger.specQueue('dxn:queue:default');
|
|
35
30
|
case 'email':
|
|
36
|
-
return
|
|
31
|
+
return Trigger.specEmail();
|
|
37
32
|
case 'webhook':
|
|
38
|
-
return
|
|
33
|
+
return Trigger.specWebhook();
|
|
39
34
|
default:
|
|
40
35
|
return undefined;
|
|
41
36
|
}
|
|
@@ -52,11 +47,20 @@ export const SpecSelector = (props: SpecSelectorProps) => {
|
|
|
52
47
|
[props.type, specProps],
|
|
53
48
|
);
|
|
54
49
|
|
|
50
|
+
const kindLabels: Record<string, string> = {
|
|
51
|
+
timer: t('trigger-type.timer.label'),
|
|
52
|
+
webhook: t('trigger-type.webhook.label'),
|
|
53
|
+
websocket: t('trigger-type.websocket.label'),
|
|
54
|
+
subscription: t('trigger-type.subscription.label'),
|
|
55
|
+
email: t('trigger-type.email.label'),
|
|
56
|
+
queue: t('trigger-type.queue.label'),
|
|
57
|
+
};
|
|
58
|
+
|
|
55
59
|
const options = useMemo(
|
|
56
60
|
() =>
|
|
57
61
|
Trigger.Kinds.map((kind) => ({
|
|
58
62
|
value: kind,
|
|
59
|
-
label:
|
|
63
|
+
label: kindLabels[kind],
|
|
60
64
|
})),
|
|
61
65
|
[t],
|
|
62
66
|
);
|
|
@@ -6,19 +6,19 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
|
6
6
|
import React, { useState } from 'react';
|
|
7
7
|
import { expect, userEvent, within } from 'storybook/test';
|
|
8
8
|
|
|
9
|
+
import { Operation, Trigger } from '@dxos/compute';
|
|
9
10
|
import { Filter, Obj, Ref, Tag, Type } from '@dxos/echo';
|
|
10
|
-
import { Function, Trigger } from '@dxos/functions';
|
|
11
11
|
import { invariant } from '@dxos/invariant';
|
|
12
|
-
import {
|
|
12
|
+
import { random } from '@dxos/random';
|
|
13
13
|
import { useQuery } from '@dxos/react-client/echo';
|
|
14
14
|
import { TestSchema, useClientStory, withClientProvider } from '@dxos/react-client/testing';
|
|
15
15
|
import { useAsyncEffect } from '@dxos/react-ui';
|
|
16
|
+
import { translations as formTranslations } from '@dxos/react-ui-form/translations';
|
|
16
17
|
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
17
|
-
import { translations as formTranslations } from '@dxos/react-ui-form';
|
|
18
18
|
import { Employer, Organization, Person, Pipeline } from '@dxos/types';
|
|
19
19
|
|
|
20
|
-
import { functions } from '
|
|
21
|
-
import { translations } from '
|
|
20
|
+
import { functions } from '#testing';
|
|
21
|
+
import { translations } from '#translations';
|
|
22
22
|
|
|
23
23
|
import { TriggerEditor, type TriggerEditorProps } from './TriggerEditor';
|
|
24
24
|
|
|
@@ -40,13 +40,13 @@ const DefaultStory = (props: Partial<TriggerEditorProps>) => {
|
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
const functions = await space.db.query(Filter.type(
|
|
44
|
-
const fn = functions.find((fn) => fn.name === 'example.
|
|
43
|
+
const functions = await space.db.query(Filter.type(Operation.PersistentOperation)).run();
|
|
44
|
+
const fn = functions.find((fn) => fn.name === 'com.example.function.forex');
|
|
45
45
|
invariant(fn);
|
|
46
46
|
const trigger = space.db.add(
|
|
47
47
|
Trigger.make({
|
|
48
48
|
function: Ref.make(fn),
|
|
49
|
-
spec:
|
|
49
|
+
spec: Trigger.specWebhook(),
|
|
50
50
|
input: {
|
|
51
51
|
from: 'USD',
|
|
52
52
|
to: 'JPY',
|
|
@@ -82,7 +82,7 @@ const meta = {
|
|
|
82
82
|
withClientProvider({
|
|
83
83
|
createIdentity: true,
|
|
84
84
|
createSpace: true,
|
|
85
|
-
types: [Tag.Tag,
|
|
85
|
+
types: [Tag.Tag, Operation.PersistentOperation, Trigger.Trigger, TestSchema.ContactType],
|
|
86
86
|
onCreateSpace: ({ space }) => {
|
|
87
87
|
// Tags.
|
|
88
88
|
['Important', 'Investor', 'New'].forEach((label) => {
|
|
@@ -91,14 +91,14 @@ const meta = {
|
|
|
91
91
|
|
|
92
92
|
// Functions.
|
|
93
93
|
functions.forEach((fn) => {
|
|
94
|
-
space.db.add(
|
|
94
|
+
space.db.add(Obj.make(Operation.PersistentOperation, { ...fn, version: fn.version ?? '0.1.0' }));
|
|
95
95
|
});
|
|
96
96
|
|
|
97
97
|
// Objects.
|
|
98
98
|
Array.from({ length: 10 }).map(() => {
|
|
99
99
|
return space.db.add(
|
|
100
100
|
Obj.make(TestSchema.ContactType, {
|
|
101
|
-
name:
|
|
101
|
+
name: random.person.fullName(),
|
|
102
102
|
identifiers: [],
|
|
103
103
|
}),
|
|
104
104
|
);
|
|
@@ -159,8 +159,8 @@ export const Spec: Story = {
|
|
|
159
159
|
await expect(combobox).not.toBeDisabled();
|
|
160
160
|
await expect(canvas.queryByLabelText('Method')).not.toBeInTheDocument();
|
|
161
161
|
|
|
162
|
-
//
|
|
163
|
-
await selectKind(combobox, '
|
|
162
|
+
// Feed — should show DXN field (the queue address). DXN is a combobox, not an input, so use getByText.
|
|
163
|
+
await selectKind(combobox, 'f');
|
|
164
164
|
await expect(canvas.findByText('DXN')).resolves.toBeInTheDocument();
|
|
165
165
|
},
|
|
166
166
|
};
|
|
@@ -4,9 +4,9 @@
|
|
|
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
9
|
import { DXN, type Database, Entity, Feed, Obj, type Query } from '@dxos/echo';
|
|
9
|
-
import { Function, Script, Trigger } from '@dxos/functions';
|
|
10
10
|
import { Filter, Ref, 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';
|
|
@@ -36,17 +36,12 @@ export type TriggerEditorProps = {
|
|
|
36
36
|
Pick<FormRootProps<TriggerFormSchema>, 'onSave' | 'onCancel'>;
|
|
37
37
|
|
|
38
38
|
export const TriggerEditor = ({ db, types, tags, readonlySpec, trigger, ...formProps }: TriggerEditorProps) => {
|
|
39
|
-
const fieldMap = useCustomInputs({
|
|
40
|
-
db,
|
|
41
|
-
types,
|
|
42
|
-
tags,
|
|
43
|
-
readonlySpec,
|
|
44
|
-
});
|
|
39
|
+
const fieldMap = useCustomInputs({ db, types, tags, readonlySpec });
|
|
45
40
|
|
|
46
41
|
const handleValuesChanged = useCallback(
|
|
47
42
|
(newValues: Partial<TriggerFormSchema>) => {
|
|
48
|
-
Obj.
|
|
49
|
-
Object.assign(
|
|
43
|
+
Obj.update(trigger, (trigger) => {
|
|
44
|
+
Object.assign(trigger, newValues);
|
|
50
45
|
});
|
|
51
46
|
},
|
|
52
47
|
[trigger],
|
|
@@ -83,7 +78,7 @@ type UseCustomInputsProps = {
|
|
|
83
78
|
} & Pick<QueryFormProps, 'types' | 'tags'>;
|
|
84
79
|
|
|
85
80
|
const useCustomInputs = ({ db, readonlySpec, types, tags }: UseCustomInputsProps): FormFieldMap => {
|
|
86
|
-
const functions = useQuery(db, Filter.type(
|
|
81
|
+
const functions = useQuery(db, Filter.type(Operation.PersistentOperation));
|
|
87
82
|
const workflows = useQuery(db, Filter.type(ComputeGraph));
|
|
88
83
|
const scripts = useQuery(db, Filter.type(Script.Script));
|
|
89
84
|
const feeds = useQuery(db, Filter.type(Feed.Feed));
|
|
@@ -154,8 +149,9 @@ const getWorkflowOptions = (graphs: ComputeGraph[]) => {
|
|
|
154
149
|
return graphs.map((graph) => ({ label: `compute-${graph.id}`, value: `dxn:echo:@:${graph.id}` }));
|
|
155
150
|
};
|
|
156
151
|
|
|
157
|
-
const getFunctionOptions = (scripts: Script.Script[], functions:
|
|
158
|
-
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;
|
|
159
155
|
return functions.map((fn) => ({ label: getLabel(fn), value: `dxn:echo:@:${fn.id}` }));
|
|
160
156
|
};
|
|
161
157
|
|
|
@@ -4,24 +4,28 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
+
import { AppSurface } from '@dxos/app-toolkit/ui';
|
|
7
8
|
import { useTranslation } from '@dxos/react-ui';
|
|
8
9
|
import { Settings } from '@dxos/react-ui-form';
|
|
9
10
|
|
|
11
|
+
import { meta } from '#meta';
|
|
12
|
+
|
|
10
13
|
import { AutomationPanel, type AutomationPanelProps } from '../../components/AutomationPanel';
|
|
11
|
-
import { meta } from '../../meta';
|
|
12
14
|
import { TriggersSettings } from '../TriggerSettings';
|
|
13
15
|
|
|
14
|
-
export
|
|
16
|
+
export type AutomationSettingsProps = AppSurface.SpaceArticleProps<Omit<AutomationPanelProps, 'space'>>;
|
|
17
|
+
|
|
18
|
+
export const AutomationSettings = (props: AutomationSettingsProps) => {
|
|
15
19
|
const { t } = useTranslation(meta.id);
|
|
16
20
|
return (
|
|
17
|
-
<Settings.
|
|
21
|
+
<Settings.Viewport>
|
|
18
22
|
<Settings.Section
|
|
19
|
-
title={t('automation
|
|
20
|
-
description={t('automation
|
|
23
|
+
title={t('automation-verbose.label', { ns: meta.id })}
|
|
24
|
+
description={t('automation.description', { ns: meta.id })}
|
|
21
25
|
>
|
|
22
26
|
<AutomationPanel {...props} />
|
|
23
|
-
<TriggersSettings
|
|
27
|
+
<TriggersSettings space={props.space} />
|
|
24
28
|
</Settings.Section>
|
|
25
|
-
</Settings.
|
|
29
|
+
</Settings.Viewport>
|
|
26
30
|
);
|
|
27
31
|
};
|
|
@@ -4,30 +4,30 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { AppSurface } from '@dxos/app-toolkit/ui';
|
|
8
8
|
import { useTranslation } from '@dxos/react-ui';
|
|
9
9
|
import { Settings } from '@dxos/react-ui-form';
|
|
10
10
|
|
|
11
|
-
import {
|
|
12
|
-
import { FunctionsRegistry } from '../../components/FunctionsRegistry';
|
|
13
|
-
import { meta } from '../../meta';
|
|
11
|
+
import { meta } from '#meta';
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
import { FunctionsPanel, FunctionsRegistry } from '../../components';
|
|
14
|
+
|
|
15
|
+
export const FunctionsContainer = ({ space }: AppSurface.SpaceArticleProps) => {
|
|
16
16
|
const { t } = useTranslation(meta.id);
|
|
17
17
|
return (
|
|
18
|
-
<Settings.
|
|
18
|
+
<Settings.Viewport>
|
|
19
19
|
<Settings.Section
|
|
20
|
-
title={t('functions
|
|
21
|
-
description={t('functions
|
|
20
|
+
title={t('functions-verbose.label', { ns: meta.id })}
|
|
21
|
+
description={t('functions.description', { ns: meta.id })}
|
|
22
22
|
>
|
|
23
23
|
<FunctionsPanel space={space} />
|
|
24
24
|
</Settings.Section>
|
|
25
25
|
<Settings.Section
|
|
26
|
-
title={t('functions
|
|
27
|
-
description={t('functions
|
|
26
|
+
title={t('functions-registry-verbose.label', { ns: meta.id })}
|
|
27
|
+
description={t('functions-registry.description', { ns: meta.id })}
|
|
28
28
|
>
|
|
29
29
|
<FunctionsRegistry space={space} />
|
|
30
30
|
</Settings.Section>
|
|
31
|
-
</Settings.
|
|
31
|
+
</Settings.Viewport>
|
|
32
32
|
);
|
|
33
33
|
};
|
|
@@ -4,23 +4,45 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import { type
|
|
8
|
-
import {
|
|
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';
|
|
9
11
|
import { Settings } from '@dxos/react-ui-form';
|
|
10
12
|
|
|
11
|
-
import {
|
|
12
|
-
import { meta } from '../../meta';
|
|
13
|
+
import { meta } from '#meta';
|
|
13
14
|
|
|
14
|
-
export const TriggersSettings = ({
|
|
15
|
-
const { state, start, stop } = useTriggerRuntimeControls(db);
|
|
16
|
-
const isRunning = state?.enabled ?? false;
|
|
15
|
+
export const TriggersSettings = ({ space }: { space: Space }) => {
|
|
17
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
|
+
};
|
|
18
25
|
|
|
19
26
|
return (
|
|
20
27
|
<div className='grid grid-cols-1 md:grid-cols-[1fr_min-content]'>
|
|
21
|
-
<Settings.
|
|
22
|
-
<
|
|
23
|
-
|
|
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>
|
|
24
46
|
</div>
|
|
25
47
|
);
|
|
26
48
|
};
|
package/src/hooks/index.ts
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useEffect } from 'react';
|
|
6
|
+
|
|
7
|
+
import { useCapabilities } from '@dxos/app-framework/ui';
|
|
8
|
+
import { SpaceId } from '@dxos/keys';
|
|
9
|
+
import { log } from '@dxos/log';
|
|
10
|
+
|
|
11
|
+
import { AutomationCapabilities } from '../types';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Resolves the compute runtime for a space.
|
|
15
|
+
* Returns undefined if the AutomationPlugin is not loaded or spaceId is not provided.
|
|
16
|
+
*/
|
|
17
|
+
export const useComputeRuntime = (id: SpaceId | undefined): AutomationCapabilities.ComputeRuntime | undefined => {
|
|
18
|
+
const [computeRuntime] = useCapabilities(AutomationCapabilities.ComputeRuntime);
|
|
19
|
+
// One log per change of (capability availability, spaceId) so we can see when
|
|
20
|
+
// the React subscription actually observes the contributed runtime.
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
log('useComputeRuntime', { hasCapability: !!computeRuntime, spaceId: id });
|
|
23
|
+
}, [!!computeRuntime, id]);
|
|
24
|
+
|
|
25
|
+
if (!computeRuntime || id === undefined) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return computeRuntime.getRuntime(id);
|
|
30
|
+
};
|
|
@@ -2,17 +2,14 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import * as Cause from 'effect/Cause';
|
|
6
5
|
import * as Effect from 'effect/Effect';
|
|
7
|
-
import * as Exit from 'effect/Exit';
|
|
8
6
|
import { type DependencyList, useCallback } from 'react';
|
|
9
7
|
|
|
10
|
-
import { useCapability } from '@dxos/app-framework/ui';
|
|
11
8
|
import { type Key } from '@dxos/echo';
|
|
12
|
-
import { type FunctionDefinition, FunctionInvocationService, TracingService } from '@dxos/functions';
|
|
13
|
-
import { log } from '@dxos/log';
|
|
14
9
|
|
|
15
|
-
import { AutomationCapabilities } from '
|
|
10
|
+
import { AutomationCapabilities } from '#types';
|
|
11
|
+
|
|
12
|
+
import { useComputeRuntime } from './useComputeRuntime';
|
|
16
13
|
|
|
17
14
|
/**
|
|
18
15
|
* Create an effectful function that has access to compute services
|
|
@@ -23,8 +20,7 @@ export const useComputeRuntimeCallback = <T>(
|
|
|
23
20
|
fn: () => Effect.Effect<T, any, AutomationCapabilities.ComputeServices>,
|
|
24
21
|
deps?: DependencyList,
|
|
25
22
|
): (() => Promise<T>) => {
|
|
26
|
-
const
|
|
27
|
-
const runtime = id !== undefined ? computeRuntime.getRuntime(id) : undefined;
|
|
23
|
+
const runtime = useComputeRuntime(id);
|
|
28
24
|
|
|
29
25
|
return useCallback(() => {
|
|
30
26
|
if (!runtime) {
|
|
@@ -34,34 +30,3 @@ export const useComputeRuntimeCallback = <T>(
|
|
|
34
30
|
return runtime.runPromise(fn());
|
|
35
31
|
}, [runtime, ...(deps ?? [])]);
|
|
36
32
|
};
|
|
37
|
-
|
|
38
|
-
// TODO(wittjosiah): Function invoking should automatically be traced (DX-647).
|
|
39
|
-
export const invokeFunctionWithTracing = <I, O>(functionDef: FunctionDefinition<I, O>, inputData: I) =>
|
|
40
|
-
Effect.gen(function* () {
|
|
41
|
-
const tracer = yield* TracingService;
|
|
42
|
-
const trace = yield* tracer.traceInvocationStart({
|
|
43
|
-
target: undefined,
|
|
44
|
-
payload: {
|
|
45
|
-
data: {},
|
|
46
|
-
},
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
// Invoke the function.
|
|
50
|
-
const result = yield* FunctionInvocationService.invokeFunction(functionDef, inputData).pipe(
|
|
51
|
-
Effect.provide(trace.invocationTraceQueue ? TracingService.layerInvocation(trace) : TracingService.layerNoop),
|
|
52
|
-
Effect.exit,
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
if (Exit.isFailure(result)) {
|
|
56
|
-
const error = Cause.prettyErrors(result.cause)[0];
|
|
57
|
-
log.error(error.message, error.cause ?? error.stack);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
yield* tracer.traceInvocationEnd({
|
|
61
|
-
trace,
|
|
62
|
-
// TODO(dmaretskyi): Might miss errors.
|
|
63
|
-
exception: Exit.isFailure(result) ? Cause.prettyErrors(result.cause)[0] : undefined,
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
return result;
|
|
67
|
-
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Context from 'effect/Context';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import * as Exit from 'effect/Exit';
|
|
8
|
+
import { useEffect, useState } from 'react';
|
|
9
|
+
|
|
10
|
+
import { SpaceId } from '@dxos/keys';
|
|
11
|
+
import { log } from '@dxos/log';
|
|
12
|
+
|
|
13
|
+
import { useComputeRuntime } from './useComputeRuntime';
|
|
14
|
+
|
|
15
|
+
type ResolvedService<T extends Context.Tag<any, any>> = Context.Tag.Service<T> | undefined;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Resolves a service from the compute runtime for a given space.
|
|
19
|
+
*
|
|
20
|
+
* NOTE: Previously implemented via `use(useMemo(() => runtime.runPromiseExit(...)))`.
|
|
21
|
+
* React's `use()` is weird and unreliable in production builds — the Suspense
|
|
22
|
+
* boundary can stay pending indefinitely without the promise ever resolving
|
|
23
|
+
* from React's perspective (the runtime is built lazily on first invocation
|
|
24
|
+
* and one of its `acquire` steps can block). This `useState` + `useEffect`
|
|
25
|
+
* flavour avoids suspension entirely: the hook returns `undefined` while the
|
|
26
|
+
* service is being acquired or if acquisition fails / times out.
|
|
27
|
+
*/
|
|
28
|
+
export const useComputeRuntimeService = <T extends Context.Tag<any, any>>(
|
|
29
|
+
tag: T,
|
|
30
|
+
spaceId?: SpaceId,
|
|
31
|
+
): ResolvedService<T> => {
|
|
32
|
+
const runtime = useComputeRuntime(spaceId);
|
|
33
|
+
const [service, setService] = useState<ResolvedService<T>>(undefined);
|
|
34
|
+
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
setService(undefined);
|
|
37
|
+
if (!runtime) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
let cancelled = false;
|
|
41
|
+
void (async () => {
|
|
42
|
+
try {
|
|
43
|
+
const exit = await runtime.runPromiseExit(tag.pipe(Effect.timeout('30 seconds')));
|
|
44
|
+
if (cancelled) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (Exit.isSuccess(exit)) {
|
|
48
|
+
setService(exit.value);
|
|
49
|
+
} else {
|
|
50
|
+
log.warn('useComputeRuntimeService: failed to acquire service', { cause: exit.cause });
|
|
51
|
+
}
|
|
52
|
+
} catch (error) {
|
|
53
|
+
if (!cancelled) {
|
|
54
|
+
log.catch(error);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
})();
|
|
58
|
+
return () => {
|
|
59
|
+
cancelled = true;
|
|
60
|
+
};
|
|
61
|
+
}, [runtime, tag]);
|
|
62
|
+
|
|
63
|
+
return service;
|
|
64
|
+
};
|