@dxos/plugin-automation 0.8.4-main.e8ec1fe → 0.8.4-main.effb148878
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-OS3ZWYJK.mjs +12 -0
- package/dist/lib/neutral/AutomationPlugin.mjs +10 -0
- package/dist/lib/neutral/AutomationPlugin.node.mjs +1118 -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-CAFY3J7H.mjs +32 -0
- package/dist/lib/neutral/AutomationSettings-CAFY3J7H.mjs.map +7 -0
- package/dist/lib/neutral/FunctionsContainer-V5AM45ZI.mjs +38 -0
- package/dist/lib/neutral/FunctionsContainer-V5AM45ZI.mjs.map +7 -0
- package/dist/lib/neutral/FunctionsPanel-L32Z67B7.mjs +97 -0
- package/dist/lib/neutral/FunctionsPanel-L32Z67B7.mjs.map +7 -0
- package/dist/lib/neutral/FunctionsRegistry-RTCY3LXE.mjs +95 -0
- package/dist/lib/neutral/FunctionsRegistry-RTCY3LXE.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 +17 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/node.mjs +15 -0
- package/dist/lib/neutral/capabilities/node.mjs.map +7 -0
- package/dist/lib/neutral/chunk-2H6X4VQY.mjs +435 -0
- package/dist/lib/neutral/chunk-2H6X4VQY.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/neutral/chunk-33VXVTV4.mjs +38 -0
- package/dist/lib/neutral/chunk-33VXVTV4.mjs.map +7 -0
- package/dist/lib/neutral/chunk-ARUHHM4Q.mjs +12 -0
- package/dist/lib/neutral/chunk-ARUHHM4Q.mjs.map +7 -0
- package/dist/lib/neutral/chunk-CMM3AFHR.mjs +111 -0
- package/dist/lib/neutral/chunk-CMM3AFHR.mjs.map +7 -0
- package/dist/lib/neutral/chunk-EBSOLOP6.mjs +8 -0
- package/dist/lib/neutral/chunk-EBSOLOP6.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-KV7RZLFS.mjs +344 -0
- package/dist/lib/neutral/chunk-KV7RZLFS.mjs.map +7 -0
- package/dist/lib/neutral/chunk-QLBA6Y46.mjs +39 -0
- package/dist/lib/neutral/chunk-QLBA6Y46.mjs.map +7 -0
- package/dist/lib/neutral/chunk-XC5EPVE3.mjs +76 -0
- package/dist/lib/neutral/chunk-XC5EPVE3.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-IOQZDDSH.mjs +68 -0
- package/dist/lib/neutral/create-trigger-from-template-IOQZDDSH.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +10 -0
- package/dist/lib/neutral/index.mjs +16 -0
- package/dist/lib/neutral/layer-specs-B22CIT3U.mjs +160 -0
- package/dist/lib/neutral/layer-specs-B22CIT3U.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/operations/index.mjs.map +7 -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 +60 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/trigger-runtime-controller-BOEJYGWC.mjs +77 -0
- package/dist/lib/neutral/trigger-runtime-controller-BOEJYGWC.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 +7 -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 +7 -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/capabilities/trigger-runtime-controller.d.ts +5 -0
- package/dist/types/src/capabilities/trigger-runtime-controller.d.ts.map +1 -0
- package/dist/types/src/capabilities/trigger-runtime-controller.test.d.ts +2 -0
- package/dist/types/src/capabilities/trigger-runtime-controller.test.d.ts.map +1 -0
- 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 +10 -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 +11 -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 +85 -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 +45 -30
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/TriggerEdgeMetadata.d.ts +18 -0
- package/dist/types/src/components/AutomationPanel/TriggerEdgeMetadata.d.ts.map +1 -0
- 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 +118 -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 +1 -1
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useEdgeTriggersDispatcherStatus.d.ts +13 -0
- package/dist/types/src/hooks/useEdgeTriggersDispatcherStatus.d.ts.map +1 -0
- 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 -3
- 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 +45 -31
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/AutomationOperation.d.ts +21 -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 +13 -5
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +145 -70
- package/src/AutomationPlugin.node.ts +32 -0
- package/src/AutomationPlugin.test.ts +27 -0
- package/src/AutomationPlugin.tsx +24 -38
- package/src/AutomationPlugin.workerd.ts +18 -0
- package/src/capabilities/app-graph-builder.ts +59 -80
- package/src/capabilities/index.ts +13 -7
- package/src/capabilities/layer-specs.ts +230 -0
- package/src/capabilities/node.ts +17 -0
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +49 -46
- package/src/capabilities/trigger-runtime-controller.test.ts +103 -0
- package/src/capabilities/trigger-runtime-controller.ts +126 -0
- package/src/commands/index.ts +5 -0
- package/src/commands/trigger/create/index.ts +14 -0
- package/src/commands/trigger/create/queue.ts +87 -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 +47 -0
- package/src/commands/trigger/remove.ts +45 -0
- package/src/commands/trigger/update/index.ts +14 -0
- package/src/commands/trigger/update/queue.ts +191 -0
- package/src/commands/trigger/update/subscription.ts +279 -0
- package/src/commands/trigger/update/timer.ts +195 -0
- package/src/commands/trigger/util.ts +410 -0
- package/src/components/AutomationPanel/AutomationPanel.stories.tsx +15 -8
- package/src/components/AutomationPanel/AutomationPanel.tsx +245 -86
- package/src/components/AutomationPanel/TriggerEdgeMetadata.tsx +148 -0
- package/src/components/FunctionsPanel/FunctionsPanel.tsx +43 -42
- package/src/components/FunctionsRegistry/FunctionsRegistry.tsx +38 -54
- package/src/components/FunctionsRegistry/index.ts +4 -1
- package/src/components/TriggerEditor/FunctionInputEditor.tsx +36 -35
- package/src/components/TriggerEditor/SpecSelector.tsx +26 -20
- package/src/components/TriggerEditor/TriggerEditor.stories.tsx +92 -39
- package/src/components/TriggerEditor/TriggerEditor.tsx +171 -54
- 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 +2 -1
- package/src/hooks/useEdgeTriggersDispatcherStatus.ts +78 -0
- package/src/hooks/useTriggerRuntimeControls.ts +38 -19
- package/src/index.ts +1 -6
- package/src/meta.ts +25 -6
- package/src/operations/create-trigger-from-template.ts +70 -0
- package/src/operations/index.ts +7 -0
- package/src/plugin.ts +11 -0
- package/src/testing/test-functions.ts +12 -9
- package/src/testing.ts +7 -0
- package/src/translations.ts +53 -36
- package/src/types/AutomationOperation.ts +39 -0
- package/src/types/index.ts +2 -0
- package/src/types/schema.ts +6 -6
- package/dist/lib/browser/AutomationPanel-7OECLR5N.mjs +0 -11
- package/dist/lib/browser/AutomationSettings-KCZISXI6.mjs +0 -68
- package/dist/lib/browser/AutomationSettings-KCZISXI6.mjs.map +0 -7
- package/dist/lib/browser/FunctionsContainer-MIWEISRR.mjs +0 -151
- package/dist/lib/browser/FunctionsContainer-MIWEISRR.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-EPEXQP45.mjs +0 -14
- package/dist/lib/browser/chunk-EPEXQP45.mjs.map +0 -7
- package/dist/lib/browser/chunk-JW7XSPYW.mjs +0 -267
- package/dist/lib/browser/chunk-JW7XSPYW.mjs.map +0 -7
- package/dist/lib/browser/chunk-LZQFZO3B.mjs +0 -17
- package/dist/lib/browser/chunk-LZQFZO3B.mjs.map +0 -7
- package/dist/lib/browser/chunk-NAPXRXTY.mjs +0 -100
- package/dist/lib/browser/chunk-NAPXRXTY.mjs.map +0 -7
- package/dist/lib/browser/chunk-QKFBHAGN.mjs +0 -184
- package/dist/lib/browser/chunk-QKFBHAGN.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-EIQTHJFZ.mjs +0 -113
- package/dist/lib/browser/compute-runtime-EIQTHJFZ.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-YQW7WCFW.mjs +0 -64
- package/dist/lib/browser/react-surface-YQW7WCFW.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -8
- package/dist/lib/node-esm/AutomationPanel-HCVFNHGQ.mjs +0 -12
- package/dist/lib/node-esm/AutomationSettings-UUUPVNUJ.mjs +0 -69
- package/dist/lib/node-esm/AutomationSettings-UUUPVNUJ.mjs.map +0 -7
- package/dist/lib/node-esm/FunctionsContainer-6OB3JN5O.mjs +0 -152
- package/dist/lib/node-esm/FunctionsContainer-6OB3JN5O.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-6YRKST6M.mjs +0 -185
- package/dist/lib/node-esm/chunk-6YRKST6M.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-CPP35BE6.mjs +0 -16
- package/dist/lib/node-esm/chunk-CPP35BE6.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-KB7NFEYY.mjs +0 -16
- package/dist/lib/node-esm/chunk-KB7NFEYY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-PICJ2REN.mjs +0 -101
- package/dist/lib/node-esm/chunk-PICJ2REN.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/chunk-W76WUTZY.mjs +0 -268
- package/dist/lib/node-esm/chunk-W76WUTZY.mjs.map +0 -7
- package/dist/lib/node-esm/compute-runtime-URROOC34.mjs +0 -114
- package/dist/lib/node-esm/compute-runtime-URROOC34.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-NNHYNBO6.mjs +0 -65
- package/dist/lib/node-esm/react-surface-NNHYNBO6.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 -127
- 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-7OECLR5N.mjs.map → neutral/AutomationPanel-OS3ZWYJK.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/hooks}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/AutomationPanel-HCVFNHGQ.mjs.map → neutral/index.mjs.map} +0 -0
- /package/dist/lib/{node-esm/FunctionsPanel-RVVCS6VH.mjs.map → neutral/meta.mjs.map} +0 -0
- /package/dist/types/src/{components → containers/TriggerSettings}/TriggerSettings.d.ts +0 -0
|
@@ -5,20 +5,18 @@
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
import React, { useCallback, useMemo } from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
8
|
+
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
9
|
+
import { LayoutOperation, getObjectPathFromObject } from '@dxos/app-toolkit';
|
|
10
|
+
import { Operation, Script } from '@dxos/compute';
|
|
11
|
+
import { Filter, Type } from '@dxos/echo';
|
|
12
|
+
import { SpaceOperation } from '@dxos/plugin-space';
|
|
13
|
+
import { type Space, useQuery } from '@dxos/react-client/echo';
|
|
14
|
+
import { IconButton, useTranslation } from '@dxos/react-ui';
|
|
15
|
+
import { Settings } from '@dxos/react-ui-form';
|
|
16
16
|
import { List } from '@dxos/react-ui-list';
|
|
17
|
-
import { ghostHover, mx } from '@dxos/
|
|
17
|
+
import { ghostHover, mx } from '@dxos/ui-theme';
|
|
18
18
|
|
|
19
|
-
import { meta } from '
|
|
20
|
-
|
|
21
|
-
const grid = 'grid grid-cols-[1fr_auto] min-bs-[2.5rem]';
|
|
19
|
+
import { meta } from '#meta';
|
|
22
20
|
|
|
23
21
|
export type FunctionsPanelProps = {
|
|
24
22
|
space: Space;
|
|
@@ -26,9 +24,9 @@ export type FunctionsPanelProps = {
|
|
|
26
24
|
|
|
27
25
|
export const FunctionsPanel = ({ space }: FunctionsPanelProps) => {
|
|
28
26
|
const { t } = useTranslation(meta.id);
|
|
29
|
-
const functions = useQuery(space, Filter.type(
|
|
30
|
-
const scripts = useQuery(space, Filter.type(Script.Script));
|
|
31
|
-
const {
|
|
27
|
+
const functions = useQuery(space.db, Filter.type(Operation.PersistentOperation));
|
|
28
|
+
const scripts = useQuery(space.db, Filter.type(Script.Script));
|
|
29
|
+
const { invokePromise } = useOperationInvoker();
|
|
32
30
|
|
|
33
31
|
const functionToScriptMap = useMemo(
|
|
34
32
|
() =>
|
|
@@ -49,7 +47,7 @@ export const FunctionsPanel = ({ space }: FunctionsPanelProps) => {
|
|
|
49
47
|
);
|
|
50
48
|
|
|
51
49
|
const getScriptName = useCallback(
|
|
52
|
-
(func:
|
|
50
|
+
(func: Operation.PersistentOperation) => {
|
|
53
51
|
const script = functionToScriptMap[func.id];
|
|
54
52
|
return script?.name;
|
|
55
53
|
},
|
|
@@ -57,50 +55,55 @@ export const FunctionsPanel = ({ space }: FunctionsPanelProps) => {
|
|
|
57
55
|
);
|
|
58
56
|
|
|
59
57
|
const handleGoToScript = useCallback(
|
|
60
|
-
(func:
|
|
58
|
+
(func: Operation.PersistentOperation) => {
|
|
61
59
|
const script = functionToScriptMap[func.id];
|
|
62
60
|
if (script) {
|
|
63
|
-
void
|
|
64
|
-
createIntent(LayoutAction.Open, {
|
|
65
|
-
part: 'main',
|
|
66
|
-
subject: [Obj.getDXN(script).toString()],
|
|
67
|
-
}),
|
|
68
|
-
);
|
|
61
|
+
void invokePromise(LayoutOperation.Open, { subject: [getObjectPathFromObject(script)] });
|
|
69
62
|
}
|
|
70
63
|
},
|
|
71
|
-
[functionToScriptMap,
|
|
64
|
+
[functionToScriptMap, invokePromise],
|
|
72
65
|
);
|
|
73
66
|
|
|
74
67
|
const handleDelete = useCallback(
|
|
75
|
-
(func:
|
|
76
|
-
[
|
|
68
|
+
(func: Operation.PersistentOperation) => invokePromise(SpaceOperation.RemoveObjects, { objects: [func] }),
|
|
69
|
+
[invokePromise],
|
|
77
70
|
);
|
|
78
71
|
|
|
79
72
|
return (
|
|
80
|
-
<
|
|
73
|
+
<Settings.Panel>
|
|
81
74
|
{functions.length > 0 && (
|
|
82
|
-
<List.Root<
|
|
75
|
+
<List.Root<Operation.PersistentOperation>
|
|
76
|
+
items={functions}
|
|
77
|
+
isItem={Schema.is(Type.getSchema(Operation.PersistentOperation))}
|
|
78
|
+
getId={(func) => func.id}
|
|
79
|
+
>
|
|
83
80
|
{({ items }) => (
|
|
84
|
-
<div role='list' className='flex flex-col
|
|
81
|
+
<div role='list' className='flex flex-col w-full'>
|
|
85
82
|
{items?.map((func) => (
|
|
86
|
-
<List.Item<
|
|
83
|
+
<List.Item<Operation.PersistentOperation>
|
|
87
84
|
key={func.id}
|
|
88
85
|
item={func}
|
|
89
|
-
classNames={mx(
|
|
86
|
+
classNames={mx(
|
|
87
|
+
'grid grid-cols-[1fr_min-content_auto] min-h-[2.5rem] min-h-[3rem] px-2 items-center',
|
|
88
|
+
ghostHover,
|
|
89
|
+
)}
|
|
90
90
|
>
|
|
91
91
|
<div className='flex flex-col truncate'>
|
|
92
92
|
<List.ItemTitle classNames='truncate'>{func.name}</List.ItemTitle>
|
|
93
|
-
{getScriptName(func) && (
|
|
94
|
-
<div className='text-xs text-description truncate'>{getScriptName(func)}</div>
|
|
95
|
-
)}
|
|
93
|
+
{getScriptName(func) && <p className='text-xs text-description truncate'>{getScriptName(func)}</p>}
|
|
96
94
|
</div>
|
|
97
|
-
{functionToScriptMap[func.id] && (
|
|
98
|
-
<
|
|
99
|
-
|
|
95
|
+
{(functionToScriptMap[func.id] && (
|
|
96
|
+
<IconButton
|
|
97
|
+
icon='ph--arrow-square-out--regular'
|
|
98
|
+
iconOnly
|
|
99
|
+
label={t('show-source-button.label')}
|
|
100
|
+
onClick={() => handleGoToScript(func)}
|
|
101
|
+
/>
|
|
102
|
+
)) || <div />}
|
|
100
103
|
<IconButton
|
|
101
|
-
iconOnly
|
|
102
104
|
icon='ph--trash--regular'
|
|
103
|
-
|
|
105
|
+
iconOnly
|
|
106
|
+
label={t('delete-function-button.label')}
|
|
104
107
|
onClick={() => handleDelete(func)}
|
|
105
108
|
/>
|
|
106
109
|
</List.Item>
|
|
@@ -109,8 +112,6 @@ export const FunctionsPanel = ({ space }: FunctionsPanelProps) => {
|
|
|
109
112
|
)}
|
|
110
113
|
</List.Root>
|
|
111
114
|
)}
|
|
112
|
-
|
|
113
|
-
{functions.length === 0 && <div className='text-center plb-4 text-gray-500'>{t('no functions found')}</div>}
|
|
114
|
-
</div>
|
|
115
|
+
</Settings.Panel>
|
|
115
116
|
);
|
|
116
117
|
};
|
|
@@ -2,27 +2,24 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import * as Array from 'effect/Array';
|
|
6
|
-
import * as EffectFunction from 'effect/Function';
|
|
7
|
-
import * as Order from 'effect/Order';
|
|
8
5
|
import * as Schema from 'effect/Schema';
|
|
9
6
|
import { useState } from 'react';
|
|
10
7
|
import React, { useCallback } from 'react';
|
|
11
8
|
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
9
|
+
import * as OperationModule from '@dxos/compute';
|
|
10
|
+
import { Context } from '@dxos/context';
|
|
11
|
+
import { Filter, Obj, Type } from '@dxos/echo';
|
|
14
12
|
import { getDeployedFunctions } from '@dxos/functions-runtime/edge';
|
|
15
13
|
import { useClient } from '@dxos/react-client';
|
|
16
|
-
import {
|
|
17
|
-
import { useAsyncEffect } from '@dxos/react-ui';
|
|
18
|
-
import {
|
|
19
|
-
import { controlItemClasses } from '@dxos/react-ui-form';
|
|
14
|
+
import { type Space, useQuery } from '@dxos/react-client/echo';
|
|
15
|
+
import { IconButton, useAsyncEffect, useTranslation } from '@dxos/react-ui';
|
|
16
|
+
import { Settings } from '@dxos/react-ui-form';
|
|
20
17
|
import { List } from '@dxos/react-ui-list';
|
|
21
|
-
import { ghostHover, mx } from '@dxos/
|
|
18
|
+
import { ghostHover, mx } from '@dxos/ui-theme';
|
|
22
19
|
|
|
23
|
-
import { meta } from '
|
|
20
|
+
import { meta } from '#meta';
|
|
24
21
|
|
|
25
|
-
const grid = 'grid grid-cols-[1fr_1fr_auto] min-
|
|
22
|
+
const grid = 'grid grid-cols-[1fr_1fr_auto] min-h-[2.5rem]';
|
|
26
23
|
|
|
27
24
|
type FunctionsRegistryProps = {
|
|
28
25
|
space: Space;
|
|
@@ -31,17 +28,18 @@ type FunctionsRegistryProps = {
|
|
|
31
28
|
export const FunctionsRegistry = ({ space }: FunctionsRegistryProps) => {
|
|
32
29
|
const client = useClient();
|
|
33
30
|
const [loading, setLoading] = useState(true);
|
|
34
|
-
const [functions, setFunctions] = useState<
|
|
31
|
+
const [functions, setFunctions] = useState<OperationModule.Operation.PersistentOperation[]>([]);
|
|
35
32
|
const { t } = useTranslation(meta.id);
|
|
36
33
|
|
|
37
|
-
const dbFunctions = useQuery(space, Filter.type(
|
|
34
|
+
const dbFunctions = useQuery(space.db, Filter.type(OperationModule.Operation.PersistentOperation));
|
|
38
35
|
|
|
39
|
-
const state = (func:
|
|
40
|
-
const
|
|
36
|
+
const state = (func: OperationModule.Operation.PersistentOperation) => {
|
|
37
|
+
const funcKey = Obj.getMeta(func).key;
|
|
38
|
+
const dbFunction = dbFunctions.find((f) => Obj.getMeta(f).key === funcKey);
|
|
41
39
|
if (!dbFunction) {
|
|
42
40
|
return 'import';
|
|
43
41
|
}
|
|
44
|
-
if (dbFunction.version === func.version && dbFunction.updated === func.updated) {
|
|
42
|
+
if (Obj.getMeta(dbFunction).version === Obj.getMeta(func).version && dbFunction.updated === func.updated) {
|
|
45
43
|
return 'none';
|
|
46
44
|
}
|
|
47
45
|
return 'update';
|
|
@@ -49,62 +47,51 @@ export const FunctionsRegistry = ({ space }: FunctionsRegistryProps) => {
|
|
|
49
47
|
|
|
50
48
|
useAsyncEffect(async () => {
|
|
51
49
|
setLoading(true);
|
|
52
|
-
const functions = await getDeployedFunctions(client);
|
|
50
|
+
const functions = await getDeployedFunctions(Context.default(), client, true);
|
|
53
51
|
setFunctions(functions);
|
|
54
52
|
setLoading(false);
|
|
55
53
|
}, []);
|
|
56
54
|
|
|
57
|
-
const dedupedFunctions = EffectFunction.pipe(
|
|
58
|
-
functions,
|
|
59
|
-
Array.filter((_) => _.key !== undefined),
|
|
60
|
-
Array.sort(Order.reverse(Order.mapInput(Order.string, (_: Function.Function) => _.updated ?? ''))),
|
|
61
|
-
Array.dedupeWith((self, that) => self.key === that.key),
|
|
62
|
-
Array.sort(Order.mapInput(Order.string, (_: Function.Function) => _.key ?? '')),
|
|
63
|
-
);
|
|
64
|
-
|
|
65
55
|
const hanleImportOrUpdate = useCallback(
|
|
66
|
-
async (func:
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
56
|
+
async (func: OperationModule.Operation.PersistentOperation) => {
|
|
57
|
+
const funcKey = Obj.getMeta(func).key;
|
|
58
|
+
const functions = funcKey
|
|
59
|
+
? await space.db
|
|
60
|
+
.query(Filter.and(Filter.type(OperationModule.Operation.PersistentOperation), Filter.key(funcKey)))
|
|
61
|
+
.run()
|
|
62
|
+
: [];
|
|
63
|
+
const [existingFunc] = functions;
|
|
70
64
|
if (!existingFunc) {
|
|
71
65
|
space.db.add(func);
|
|
72
66
|
return;
|
|
73
67
|
}
|
|
74
|
-
existingFunc
|
|
75
|
-
existingFunc.updated = func.updated;
|
|
76
|
-
existingFunc.name = func.name;
|
|
77
|
-
existingFunc.description = func.description;
|
|
78
|
-
// TODO(dmaretskyi): A workaround for an ECHO bug.
|
|
79
|
-
existingFunc.inputSchema = JSON.parse(JSON.stringify(func.inputSchema));
|
|
80
|
-
existingFunc.outputSchema = JSON.parse(JSON.stringify(func.outputSchema));
|
|
81
|
-
Obj.getMeta(existingFunc).keys = JSON.parse(JSON.stringify(Obj.getMeta(func).keys));
|
|
68
|
+
OperationModule.Operation.setFrom(existingFunc, func);
|
|
82
69
|
},
|
|
83
70
|
[space],
|
|
84
71
|
);
|
|
85
72
|
|
|
86
73
|
return (
|
|
87
|
-
<
|
|
88
|
-
{
|
|
89
|
-
<List.Root<
|
|
90
|
-
items={
|
|
91
|
-
isItem={Schema.is(
|
|
74
|
+
<Settings.Panel>
|
|
75
|
+
{functions.length > 0 && (
|
|
76
|
+
<List.Root<OperationModule.Operation.PersistentOperation>
|
|
77
|
+
items={functions}
|
|
78
|
+
isItem={Schema.is(Type.getSchema(OperationModule.Operation.PersistentOperation))}
|
|
92
79
|
getId={(func) => func.id}
|
|
93
80
|
>
|
|
94
81
|
{({ items }) => (
|
|
95
|
-
<div role='list' className='flex flex-col
|
|
82
|
+
<div role='list' className='flex flex-col w-full'>
|
|
96
83
|
{items?.map((func) => (
|
|
97
|
-
<List.Item<
|
|
84
|
+
<List.Item<OperationModule.Operation.PersistentOperation>
|
|
98
85
|
key={func.id}
|
|
99
86
|
item={func}
|
|
100
|
-
classNames={mx(grid, ghostHover, 'items-center', '
|
|
87
|
+
classNames={mx(grid, ghostHover, 'items-center', 'px-2', 'min-h-[3rem]')}
|
|
101
88
|
>
|
|
102
89
|
<div className='flex flex-col truncate'>
|
|
103
90
|
<List.ItemTitle classNames='truncate'>{func.name}</List.ItemTitle>
|
|
104
|
-
<div className='text-xs text-description truncate'>{func.key}</div>
|
|
91
|
+
<div className='text-xs text-description truncate'>{Obj.getMeta(func).key}</div>
|
|
105
92
|
</div>
|
|
106
93
|
<div className='flex flex-col truncate'>
|
|
107
|
-
<div className='text-xs text-description truncate'>{func.version}</div>
|
|
94
|
+
<div className='text-xs text-description truncate'>{Obj.getMeta(func).version}</div>
|
|
108
95
|
<div className='text-xs text-description truncate'>
|
|
109
96
|
{func.updated ? `Uploaded ${new Date(func.updated).toLocaleString()}` : ''}
|
|
110
97
|
</div>
|
|
@@ -114,7 +101,7 @@ export const FunctionsRegistry = ({ space }: FunctionsRegistryProps) => {
|
|
|
114
101
|
iconOnly
|
|
115
102
|
icon={state(func) === 'update' ? 'ph--arrows-clockwise--regular' : 'ph--download--regular'}
|
|
116
103
|
label={
|
|
117
|
-
state(func) === 'update' ? t('update
|
|
104
|
+
state(func) === 'update' ? t('update-function-button.label') : t('import-function-button.label')
|
|
118
105
|
}
|
|
119
106
|
disabled={state(func) === 'none'}
|
|
120
107
|
onClick={() => hanleImportOrUpdate(func)}
|
|
@@ -126,10 +113,7 @@ export const FunctionsRegistry = ({ space }: FunctionsRegistryProps) => {
|
|
|
126
113
|
</List.Root>
|
|
127
114
|
)}
|
|
128
115
|
|
|
129
|
-
{
|
|
130
|
-
|
|
131
|
-
)}
|
|
132
|
-
{loading && <div className='text-center plb-4 text-gray-500'>{t('loading functions')}</div>}
|
|
133
|
-
</div>
|
|
116
|
+
{loading && <div className='text-center py-4 text-gray-500'>{t('loading-functions.message')}</div>}
|
|
117
|
+
</Settings.Panel>
|
|
134
118
|
);
|
|
135
119
|
};
|
|
@@ -2,32 +2,29 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import type * as SchemaAST from 'effect/SchemaAST';
|
|
5
6
|
import React, { useCallback, useMemo } from 'react';
|
|
6
7
|
|
|
7
|
-
import {
|
|
8
|
+
import { type Operation } from '@dxos/compute';
|
|
9
|
+
import { type Database, JsonSchema, Obj, Ref } from '@dxos/echo';
|
|
8
10
|
import { type JsonPath } from '@dxos/echo/internal';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
11
|
+
import { useOnTransition, useTranslation } from '@dxos/react-ui';
|
|
12
|
+
import { Form, type FormFieldStateProps, type FormRootProps, useFormValues } from '@dxos/react-ui-form';
|
|
13
|
+
|
|
14
|
+
import { meta } from '#meta';
|
|
12
15
|
|
|
13
16
|
export type FunctionInputEditorProps = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
type: SchemaAST.AST;
|
|
18
|
+
functions: Operation.PersistentOperation[];
|
|
19
|
+
db?: Database.Database;
|
|
20
|
+
} & FormFieldStateProps;
|
|
17
21
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export const FunctionInputEditor = ({
|
|
22
|
-
functions,
|
|
23
|
-
getValue,
|
|
24
|
-
onValueChange,
|
|
25
|
-
onQueryRefOptions,
|
|
26
|
-
}: FunctionInputEditorProps) => {
|
|
27
|
-
const selectedFunctionValue = useFormValues(['function' as JsonPath]);
|
|
22
|
+
export const FunctionInputEditor = ({ type, functions, db, getValue, onValueChange }: FunctionInputEditorProps) => {
|
|
23
|
+
const { t } = useTranslation(meta.id);
|
|
24
|
+
const selectedFunctionValue = useFormValues(FunctionInputEditor.displayName, ['function' as JsonPath]);
|
|
28
25
|
const selectedFunctionId = useMemo(() => {
|
|
29
26
|
if (Ref.isRef(selectedFunctionValue)) {
|
|
30
|
-
return selectedFunctionValue.
|
|
27
|
+
return selectedFunctionValue.uri.split('dxn:echo:@:').at(1);
|
|
31
28
|
}
|
|
32
29
|
}, [selectedFunctionValue]);
|
|
33
30
|
|
|
@@ -44,23 +41,25 @@ export const FunctionInputEditor = ({
|
|
|
44
41
|
return false;
|
|
45
42
|
}
|
|
46
43
|
|
|
47
|
-
return prevValue.
|
|
44
|
+
return prevValue.uri !== selectedFunctionValue.uri;
|
|
48
45
|
},
|
|
49
46
|
(currValue) => currValue !== undefined,
|
|
50
|
-
() => onValueChange(
|
|
47
|
+
() => onValueChange(type, {}),
|
|
51
48
|
);
|
|
52
49
|
|
|
53
50
|
const inputSchema = useMemo(() => selectedFunction?.inputSchema, [selectedFunction]);
|
|
54
|
-
const effectSchema = useMemo(() => (inputSchema ?
|
|
51
|
+
const effectSchema = useMemo(() => (inputSchema ? JsonSchema.toEffectSchema(inputSchema) : undefined), [inputSchema]);
|
|
55
52
|
const propertyCount = inputSchema?.properties ? Object.keys(inputSchema.properties).length : 0;
|
|
53
|
+
const defaultValues = useMemo(() => {
|
|
54
|
+
const raw = getValue() ?? {};
|
|
55
|
+
return Obj.isObject(raw) ? { ...Obj.getSnapshot(raw) } : { ...raw };
|
|
56
|
+
}, [getValue]);
|
|
56
57
|
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
(values: any) => {
|
|
61
|
-
onValueChange('object', values);
|
|
58
|
+
const handleValuesChanged = useCallback<NonNullable<FormRootProps['onValuesChanged']>>(
|
|
59
|
+
(values) => {
|
|
60
|
+
onValueChange(type, values);
|
|
62
61
|
},
|
|
63
|
-
[onValueChange],
|
|
62
|
+
[type, onValueChange],
|
|
64
63
|
);
|
|
65
64
|
|
|
66
65
|
if (selectedFunction === undefined || effectSchema === undefined || propertyCount === 0) {
|
|
@@ -69,16 +68,18 @@ export const FunctionInputEditor = ({
|
|
|
69
68
|
|
|
70
69
|
return (
|
|
71
70
|
<>
|
|
72
|
-
<
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
<Form
|
|
71
|
+
<Form.Label label={t('function-parameters.label')} asChild />
|
|
72
|
+
<Form.Root
|
|
73
|
+
key={selectedFunction.id}
|
|
76
74
|
schema={effectSchema}
|
|
77
|
-
|
|
75
|
+
defaultValues={defaultValues}
|
|
76
|
+
db={db}
|
|
78
77
|
onValuesChanged={handleValuesChanged}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
>
|
|
79
|
+
<Form.FieldSet />
|
|
80
|
+
</Form.Root>
|
|
82
81
|
</>
|
|
83
82
|
);
|
|
84
83
|
};
|
|
84
|
+
|
|
85
|
+
FunctionInputEditor.displayName = 'AutomationTrigger.FunctionInputEditor';
|
|
@@ -4,38 +4,33 @@
|
|
|
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
|
-
import { type
|
|
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
|
-
export type SpecSelectorProps =
|
|
14
|
+
export type SpecSelectorProps = FormFieldComponentProps;
|
|
15
15
|
|
|
16
16
|
export const SpecSelector = (props: SpecSelectorProps) => {
|
|
17
17
|
const { t } = useTranslation(meta.id);
|
|
18
|
-
const specProps =
|
|
18
|
+
const specProps = useFormFieldState(SpecSelector.displayName, ['spec' satisfies keyof Trigger.Trigger]);
|
|
19
19
|
|
|
20
20
|
const handleTypeChange = useCallback(
|
|
21
21
|
(_type: any, value: string): Trigger.Spec | undefined => {
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
ast: Query.select(Filter.nothing()).ast,
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
case 'queue':
|
|
34
|
-
return { kind: 'queue', queue: 'dxn:' };
|
|
27
|
+
return Trigger.specSubscription(Query.select(Filter.nothing()));
|
|
28
|
+
case 'feed':
|
|
29
|
+
return { kind: 'feed' } satisfies Trigger.FeedSpec;
|
|
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
|
}
|
|
@@ -47,19 +42,30 @@ export const SpecSelector = (props: SpecSelectorProps) => {
|
|
|
47
42
|
}
|
|
48
43
|
|
|
49
44
|
// Update the entire spec object, not just the `spec.kind`.
|
|
50
|
-
specProps.onValueChange(
|
|
45
|
+
specProps.onValueChange(props.type, defaultSpec);
|
|
51
46
|
},
|
|
52
|
-
[specProps],
|
|
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
|
+
feed: t('trigger-type.feed.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
|
);
|
|
63
67
|
|
|
64
|
-
return <
|
|
68
|
+
return <SelectField {...props} options={options} onValueChange={handleTypeChange} />;
|
|
65
69
|
};
|
|
70
|
+
|
|
71
|
+
SpecSelector.displayName = 'Form.SpecSelector';
|