@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
|
@@ -4,48 +4,49 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React, { useState } from 'react';
|
|
7
|
+
import { expect, userEvent, within } from 'storybook/test';
|
|
7
8
|
|
|
9
|
+
import { Operation, Trigger } from '@dxos/compute';
|
|
8
10
|
import { Filter, Obj, Ref, Tag, Type } from '@dxos/echo';
|
|
9
|
-
import { Function } from '@dxos/functions';
|
|
10
|
-
import { 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
|
-
import {
|
|
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 { Employer, Organization, Person,
|
|
18
|
+
import { Employer, Organization, Person, Pipeline } from '@dxos/types';
|
|
18
19
|
|
|
19
|
-
import { functions } from '
|
|
20
|
-
import { translations } from '
|
|
20
|
+
import { functions } from '#testing';
|
|
21
|
+
import { translations } from '#translations';
|
|
21
22
|
|
|
22
23
|
import { TriggerEditor, type TriggerEditorProps } from './TriggerEditor';
|
|
23
24
|
|
|
24
25
|
const types = [
|
|
25
26
|
// TODO(burdon): Get label from annotation.
|
|
26
|
-
{ value: Organization.Organization
|
|
27
|
-
{ value: Person.Person
|
|
28
|
-
{ value: Type.getTypename(
|
|
29
|
-
{ value: Employer.Employer
|
|
27
|
+
{ value: Type.getTypename(Organization.Organization), label: 'Organization' },
|
|
28
|
+
{ value: Type.getTypename(Person.Person), label: 'Person' },
|
|
29
|
+
{ value: Type.getTypename(Pipeline.Pipeline), label: 'Project' },
|
|
30
|
+
{ value: Type.getTypename(Employer.Employer), label: 'Employer' },
|
|
30
31
|
];
|
|
31
32
|
|
|
32
33
|
const DefaultStory = (props: Partial<TriggerEditorProps>) => {
|
|
33
|
-
const { space } =
|
|
34
|
+
const { space } = useClientStory();
|
|
34
35
|
const [trigger, setTrigger] = useState<Trigger.Trigger>();
|
|
35
|
-
const tags = useQuery(space, Filter.type(Tag.Tag));
|
|
36
|
+
const tags = useQuery(space?.db, Filter.type(Tag.Tag));
|
|
36
37
|
|
|
37
38
|
useAsyncEffect(async () => {
|
|
38
39
|
if (!space) {
|
|
39
40
|
return;
|
|
40
41
|
}
|
|
41
42
|
|
|
42
|
-
const
|
|
43
|
-
const fn =
|
|
43
|
+
const functions = await space.db.query(Filter.type(Operation.PersistentOperation)).run();
|
|
44
|
+
const fn = functions.find((fn) => fn.name === 'com.example.function.forex');
|
|
44
45
|
invariant(fn);
|
|
45
46
|
const trigger = space.db.add(
|
|
46
47
|
Trigger.make({
|
|
47
48
|
function: Ref.make(fn),
|
|
48
|
-
spec:
|
|
49
|
+
spec: Trigger.specWebhook(),
|
|
49
50
|
input: {
|
|
50
51
|
from: 'USD',
|
|
51
52
|
to: 'JPY',
|
|
@@ -60,42 +61,50 @@ const DefaultStory = (props: Partial<TriggerEditorProps>) => {
|
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
return (
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
/>
|
|
72
|
-
</div>
|
|
64
|
+
<TriggerEditor
|
|
65
|
+
db={space.db}
|
|
66
|
+
trigger={trigger}
|
|
67
|
+
types={types}
|
|
68
|
+
tags={tags}
|
|
69
|
+
onSave={(values) => console.log('on save', values)}
|
|
70
|
+
{...props}
|
|
71
|
+
/>
|
|
73
72
|
);
|
|
74
73
|
};
|
|
75
74
|
|
|
76
75
|
const meta = {
|
|
77
|
-
title: 'plugins/plugin-automation/TriggerEditor',
|
|
76
|
+
title: 'plugins/plugin-automation/components/TriggerEditor',
|
|
78
77
|
component: TriggerEditor as any,
|
|
79
78
|
render: DefaultStory,
|
|
80
79
|
decorators: [
|
|
81
|
-
withTheme,
|
|
82
|
-
withLayout({
|
|
80
|
+
withTheme(),
|
|
81
|
+
withLayout({ layout: 'column' }),
|
|
83
82
|
withClientProvider({
|
|
84
83
|
createIdentity: true,
|
|
85
84
|
createSpace: true,
|
|
86
|
-
types: [Tag.Tag,
|
|
85
|
+
types: [Tag.Tag, Operation.PersistentOperation, Trigger.Trigger, TestSchema.ContactType],
|
|
87
86
|
onCreateSpace: ({ space }) => {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
// Tags.
|
|
88
|
+
['Important', 'Investor', 'New'].forEach((label) => {
|
|
89
|
+
space.db.add(Tag.make({ label }));
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
// Functions.
|
|
93
|
+
functions.forEach((fn) => {
|
|
94
|
+
const { key, version, ...data } = fn;
|
|
95
|
+
space.db.add(
|
|
96
|
+
Obj.make(Operation.PersistentOperation, {
|
|
97
|
+
[Obj.Meta]: { key, version: version ?? '0.1.0' },
|
|
98
|
+
...data,
|
|
99
|
+
}),
|
|
100
|
+
);
|
|
101
|
+
});
|
|
91
102
|
|
|
92
|
-
|
|
93
|
-
space.db.add(Function.make(fn));
|
|
94
|
-
}
|
|
103
|
+
// Objects.
|
|
95
104
|
Array.from({ length: 10 }).map(() => {
|
|
96
105
|
return space.db.add(
|
|
97
|
-
Obj.make(ContactType, {
|
|
98
|
-
name:
|
|
106
|
+
Obj.make(TestSchema.ContactType, {
|
|
107
|
+
name: random.person.fullName(),
|
|
99
108
|
identifiers: [],
|
|
100
109
|
}),
|
|
101
110
|
);
|
|
@@ -104,7 +113,8 @@ const meta = {
|
|
|
104
113
|
}),
|
|
105
114
|
],
|
|
106
115
|
parameters: {
|
|
107
|
-
|
|
116
|
+
layout: 'fullscreen',
|
|
117
|
+
translations: [...formTranslations, ...translations],
|
|
108
118
|
},
|
|
109
119
|
} satisfies Meta<typeof DefaultStory>;
|
|
110
120
|
|
|
@@ -119,3 +129,46 @@ export const ReadonlySpec: Story = {
|
|
|
119
129
|
readonlySpec: true,
|
|
120
130
|
},
|
|
121
131
|
};
|
|
132
|
+
|
|
133
|
+
export const Spec: Story = {
|
|
134
|
+
play: async ({ canvasElement }) => {
|
|
135
|
+
const canvas = within(canvasElement);
|
|
136
|
+
const webhookText = await canvas.findByText('Webhook', {}, { timeout: 10_000 });
|
|
137
|
+
const combobox = webhookText.closest('[role="combobox"]') as HTMLElement;
|
|
138
|
+
await expect(combobox).not.toBeDisabled();
|
|
139
|
+
|
|
140
|
+
// Helper to switch to a kind via keyboard.
|
|
141
|
+
// TODO(wittjosiah): Radix Select in popper mode doesn't close on click.
|
|
142
|
+
// Use keyboard navigation: open, type first letter to jump, Enter to select.
|
|
143
|
+
const selectKind = async (combobox: HTMLElement, firstLetter: string) => {
|
|
144
|
+
combobox.focus();
|
|
145
|
+
await userEvent.keyboard('{Enter}');
|
|
146
|
+
await userEvent.keyboard(firstLetter);
|
|
147
|
+
await userEvent.keyboard('{Enter}');
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
// Timer — should show "Cron" field.
|
|
151
|
+
await selectKind(combobox, 't');
|
|
152
|
+
await expect(canvas.findByLabelText('Cron')).resolves.toBeInTheDocument();
|
|
153
|
+
|
|
154
|
+
// Email — no extra fields; Cron should be gone.
|
|
155
|
+
await selectKind(combobox, 'e');
|
|
156
|
+
await expect(combobox).not.toBeDisabled();
|
|
157
|
+
await expect(canvas.queryByLabelText('Cron')).not.toBeInTheDocument();
|
|
158
|
+
|
|
159
|
+
// Webhook — should show "Method" field.
|
|
160
|
+
await selectKind(combobox, 'w');
|
|
161
|
+
await expect(canvas.findByLabelText('Method')).resolves.toBeInTheDocument();
|
|
162
|
+
|
|
163
|
+
// Subscription — should show query editor.
|
|
164
|
+
await selectKind(combobox, 's');
|
|
165
|
+
await expect(combobox).not.toBeDisabled();
|
|
166
|
+
await expect(canvas.queryByLabelText('Method')).not.toBeInTheDocument();
|
|
167
|
+
|
|
168
|
+
// Feed — should show the Feed selector field (a Ref(Feed) combobox). The combobox
|
|
169
|
+
// isn't associated with its label, so match the field's <label> element directly.
|
|
170
|
+
await selectKind(combobox, 'f');
|
|
171
|
+
await expect(combobox).not.toBeDisabled();
|
|
172
|
+
await expect(await canvas.findByText('Feed', { selector: 'label' })).toBeInTheDocument();
|
|
173
|
+
},
|
|
174
|
+
};
|
|
@@ -2,85 +2,114 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import * as Option from 'effect/Option';
|
|
6
|
+
import * as Record from 'effect/Record';
|
|
5
7
|
import React, { useCallback, useMemo } from 'react';
|
|
6
8
|
|
|
9
|
+
import { Operation, Script, Trigger } from '@dxos/compute';
|
|
7
10
|
import { ComputeGraph } from '@dxos/conductor';
|
|
8
|
-
import { type Query, Type } from '@dxos/echo';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
+
import { Annotation, type Database, Entity, Feed, Filter, Obj, type Query, Ref, Type } from '@dxos/echo';
|
|
12
|
+
import { EchoURI } from '@dxos/keys';
|
|
13
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
11
14
|
import { Input } from '@dxos/react-ui';
|
|
12
15
|
import { QueryForm, type QueryFormProps } from '@dxos/react-ui-components';
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
import {
|
|
17
|
+
type ExcludeId,
|
|
18
|
+
Form,
|
|
19
|
+
FormFieldLabel,
|
|
20
|
+
type FormFieldMap,
|
|
21
|
+
type FormRootProps,
|
|
22
|
+
SelectField,
|
|
23
|
+
omitId,
|
|
24
|
+
} from '@dxos/react-ui-form';
|
|
25
|
+
|
|
26
|
+
import { FunctionInputEditor } from './FunctionInputEditor';
|
|
16
27
|
import { SpecSelector } from './SpecSelector';
|
|
17
28
|
|
|
29
|
+
type TriggerFormSchema = ExcludeId<typeof Trigger.Trigger>;
|
|
30
|
+
|
|
18
31
|
export type TriggerEditorProps = {
|
|
19
|
-
|
|
32
|
+
db: Database.Database;
|
|
20
33
|
trigger: Trigger.Trigger;
|
|
21
34
|
// TODO(wittjosiah): This needs to apply to whole spec but currently only applies to spec.kind & spec.query.
|
|
22
35
|
readonlySpec?: boolean;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
36
|
+
} &
|
|
37
|
+
// prettier-ignore
|
|
38
|
+
Pick<QueryFormProps, 'types' | 'tags'> &
|
|
39
|
+
Pick<FormRootProps<TriggerFormSchema>, 'onSave' | 'onCancel'>;
|
|
40
|
+
|
|
41
|
+
export const TriggerEditor = ({ db, types, tags, readonlySpec, trigger, ...formProps }: TriggerEditorProps) => {
|
|
42
|
+
const fieldMap = useCustomInputs({ db, types, tags, readonlySpec });
|
|
43
|
+
|
|
44
|
+
const handleValuesChanged = useCallback(
|
|
45
|
+
(newValues: Partial<TriggerFormSchema>) => {
|
|
46
|
+
Obj.update(trigger, (trigger) => {
|
|
47
|
+
Object.assign(trigger, newValues);
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
[trigger],
|
|
51
|
+
);
|
|
31
52
|
|
|
32
|
-
const
|
|
33
|
-
const
|
|
53
|
+
const triggerSchema = useMemo(() => omitId(Trigger.Trigger), []);
|
|
54
|
+
const defaultValues = useMemo(() => {
|
|
55
|
+
const { id: _, ...values } = trigger;
|
|
56
|
+
return values;
|
|
57
|
+
}, [trigger]);
|
|
34
58
|
|
|
35
59
|
return (
|
|
36
|
-
<Form
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
schema={
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
60
|
+
<Form.Root<TriggerFormSchema>
|
|
61
|
+
{...formProps}
|
|
62
|
+
db={db}
|
|
63
|
+
schema={triggerSchema}
|
|
64
|
+
defaultValues={defaultValues}
|
|
65
|
+
fieldMap={fieldMap}
|
|
66
|
+
onValuesChanged={handleValuesChanged}
|
|
67
|
+
>
|
|
68
|
+
<Form.Viewport>
|
|
69
|
+
<Form.Content>
|
|
70
|
+
<Form.FieldSet />
|
|
71
|
+
<Form.Actions />
|
|
72
|
+
</Form.Content>
|
|
73
|
+
</Form.Viewport>
|
|
74
|
+
</Form.Root>
|
|
45
75
|
);
|
|
46
76
|
};
|
|
47
77
|
|
|
48
78
|
type UseCustomInputsProps = {
|
|
49
|
-
|
|
79
|
+
db: Database.Database;
|
|
50
80
|
readonlySpec?: boolean;
|
|
51
|
-
onQueryRefOptions: FunctionInputEditorProps['onQueryRefOptions'];
|
|
52
81
|
} & Pick<QueryFormProps, 'types' | 'tags'>;
|
|
53
82
|
|
|
54
|
-
const useCustomInputs = ({
|
|
55
|
-
const functions = useQuery(
|
|
56
|
-
const workflows = useQuery(
|
|
57
|
-
const scripts = useQuery(
|
|
83
|
+
const useCustomInputs = ({ db, readonlySpec, types, tags }: UseCustomInputsProps): FormFieldMap => {
|
|
84
|
+
const functions = useQuery(db, Filter.type(Operation.PersistentOperation));
|
|
85
|
+
const workflows = useQuery(db, Filter.type(ComputeGraph));
|
|
86
|
+
const scripts = useQuery(db, Filter.type(Script.Script));
|
|
87
|
+
const feeds = useQuery(db, Filter.type(Feed.Feed));
|
|
58
88
|
|
|
59
89
|
return useMemo(
|
|
60
|
-
():
|
|
90
|
+
(): FormFieldMap => ({
|
|
61
91
|
// Function selector.
|
|
62
92
|
['function' satisfies keyof Trigger.Trigger]: (props) => {
|
|
63
93
|
const getValue = useCallback(() => {
|
|
64
94
|
const formValue = props.getValue();
|
|
65
95
|
if (Ref.isRef(formValue)) {
|
|
66
|
-
return formValue.
|
|
96
|
+
return formValue.uri;
|
|
67
97
|
}
|
|
68
98
|
return undefined;
|
|
69
99
|
}, [props]);
|
|
70
100
|
|
|
71
101
|
const handleOnValueChange = useCallback(
|
|
72
|
-
(_type: any,
|
|
73
|
-
const
|
|
74
|
-
if (
|
|
75
|
-
|
|
76
|
-
props.onValueChange('object', ref);
|
|
102
|
+
(_type: any, uriString: string) => {
|
|
103
|
+
const uri = EchoURI.tryParse(uriString);
|
|
104
|
+
if (uri) {
|
|
105
|
+
props.onValueChange(props.type, Ref.fromURI(uri));
|
|
77
106
|
}
|
|
78
107
|
},
|
|
79
|
-
[props.onValueChange],
|
|
108
|
+
[props.type, props.onValueChange],
|
|
80
109
|
);
|
|
81
110
|
|
|
82
111
|
return (
|
|
83
|
-
<
|
|
112
|
+
<SelectField
|
|
84
113
|
{...props}
|
|
85
114
|
getValue={getValue as any}
|
|
86
115
|
onValueChange={handleOnValueChange}
|
|
@@ -90,38 +119,126 @@ const useCustomInputs = ({ space, readonlySpec, types, tags, onQueryRefOptions }
|
|
|
90
119
|
},
|
|
91
120
|
|
|
92
121
|
// Spec selector.
|
|
93
|
-
|
|
122
|
+
'spec.kind': (props) => <SpecSelector {...props} readonly={readonlySpec} />,
|
|
123
|
+
|
|
124
|
+
// Feed selector with parent labels.
|
|
125
|
+
'spec.feed': (props) => {
|
|
126
|
+
const getValue = useCallback(() => {
|
|
127
|
+
const formValue = props.getValue();
|
|
128
|
+
if (Ref.isRef(formValue)) {
|
|
129
|
+
return formValue.uri.toString() as string;
|
|
130
|
+
}
|
|
131
|
+
return undefined;
|
|
132
|
+
}, [props]);
|
|
133
|
+
|
|
134
|
+
const handleOnValueChange = useCallback(
|
|
135
|
+
(_type: any, dxnString: string) => {
|
|
136
|
+
const uri = EchoURI.tryParse(dxnString);
|
|
137
|
+
if (uri) {
|
|
138
|
+
props.onValueChange(props.type, Ref.fromURI(uri));
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
[props.type, props.onValueChange],
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
<SelectField
|
|
146
|
+
{...props}
|
|
147
|
+
getValue={getValue as any}
|
|
148
|
+
onValueChange={handleOnValueChange}
|
|
149
|
+
options={getFeedOptions(feeds)}
|
|
150
|
+
/>
|
|
151
|
+
);
|
|
152
|
+
},
|
|
94
153
|
|
|
95
154
|
// TODO(wittjosiah): Copied from ViewEditor.
|
|
96
155
|
// Query input editor.
|
|
97
|
-
|
|
156
|
+
'spec.query': (props) => {
|
|
98
157
|
const handleChange = useCallback(
|
|
99
|
-
(query: Query.Any) => props.onValueChange(
|
|
100
|
-
[props.onValueChange],
|
|
158
|
+
(query: Query.Any) => props.onValueChange(props.type, { ast: query.ast }),
|
|
159
|
+
[props.type, props.onValueChange],
|
|
101
160
|
);
|
|
102
161
|
|
|
103
162
|
return (
|
|
104
163
|
<Input.Root>
|
|
105
|
-
<
|
|
164
|
+
<FormFieldLabel label={props.label} asChild />
|
|
106
165
|
<QueryForm initialQuery={(props.getValue() as any).ast} types={types} tags={tags} onChange={handleChange} />
|
|
107
166
|
</Input.Root>
|
|
108
167
|
);
|
|
109
168
|
},
|
|
110
169
|
|
|
111
170
|
// Function input editor.
|
|
112
|
-
|
|
113
|
-
<FunctionInputEditor {...props} functions={functions} onQueryRefOptions={onQueryRefOptions} />
|
|
114
|
-
),
|
|
171
|
+
input: (props) => <FunctionInputEditor {...props} functions={functions} db={db} />,
|
|
115
172
|
}),
|
|
116
|
-
[workflows, scripts, functions, readonlySpec],
|
|
173
|
+
[workflows, scripts, functions, feeds, readonlySpec],
|
|
117
174
|
);
|
|
118
175
|
};
|
|
119
176
|
|
|
177
|
+
const getObjectIconProps = (object: Entity.Unknown): { icon?: string; iconHue?: string } => {
|
|
178
|
+
const type = Entity.getType(object);
|
|
179
|
+
const schema = type ? Type.getSchema(type) : undefined;
|
|
180
|
+
const annotation = schema ? Option.getOrUndefined(Annotation.IconAnnotation.get(schema)) : undefined;
|
|
181
|
+
return annotation ? { icon: annotation.icon, iconHue: annotation.hue } : {};
|
|
182
|
+
};
|
|
183
|
+
|
|
120
184
|
const getWorkflowOptions = (graphs: ComputeGraph[]) => {
|
|
121
|
-
return graphs.map((graph) => ({
|
|
185
|
+
return graphs.map((graph) => ({
|
|
186
|
+
label: `compute-${graph.id}`,
|
|
187
|
+
value: Obj.getURI(graph),
|
|
188
|
+
...getObjectIconProps(graph),
|
|
189
|
+
}));
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
const getFunctionOptions = (scripts: Script.Script[], functions: Operation.PersistentOperation[]) => {
|
|
193
|
+
const getLabel = (fn: Operation.PersistentOperation) =>
|
|
194
|
+
scripts.find((s) => fn.source?.target?.id === s.id)?.name ?? fn.name;
|
|
195
|
+
return functions.map((fn) => {
|
|
196
|
+
const { icon: schemaIcon, iconHue } = getObjectIconProps(fn);
|
|
197
|
+
return {
|
|
198
|
+
label: getLabel(fn),
|
|
199
|
+
value: Obj.getURI(fn),
|
|
200
|
+
icon: fn.icon ?? schemaIcon,
|
|
201
|
+
iconHue,
|
|
202
|
+
};
|
|
203
|
+
});
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
const getFeedDisplayName = (feed: Feed.Feed): string =>
|
|
207
|
+
Entity.getLabel(feed) ?? feed.name ?? Entity.getTypename(feed) ?? 'Feed';
|
|
208
|
+
|
|
209
|
+
const computeRefRole = (entity: Feed.Feed): string | undefined => {
|
|
210
|
+
const parent = Obj.getParent(entity);
|
|
211
|
+
if (!parent) {
|
|
212
|
+
return undefined;
|
|
213
|
+
}
|
|
214
|
+
for (const key of Record.keys(parent)) {
|
|
215
|
+
if (Ref.isRef(parent[key]) && parent[key].target?.id === entity.id) {
|
|
216
|
+
return `$.${key}`;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
return undefined;
|
|
122
220
|
};
|
|
123
221
|
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
222
|
+
const getFeedOptions = (feeds: Feed.Feed[]) => {
|
|
223
|
+
return feeds.map((feed) => {
|
|
224
|
+
const parent = Obj.getParent(feed);
|
|
225
|
+
const displayObject = parent ?? feed;
|
|
226
|
+
const role = computeRefRole(feed);
|
|
227
|
+
|
|
228
|
+
if (parent) {
|
|
229
|
+
return {
|
|
230
|
+
label: Entity.getLabel(parent) ?? Entity.getTypename(parent) ?? 'Parent',
|
|
231
|
+
secondaryLabel: role ?? getFeedDisplayName(feed),
|
|
232
|
+
value: Obj.getURI(feed),
|
|
233
|
+
...getObjectIconProps(displayObject),
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return {
|
|
238
|
+
label: getFeedDisplayName(feed),
|
|
239
|
+
secondaryLabel: role,
|
|
240
|
+
value: Obj.getURI(feed),
|
|
241
|
+
...getObjectIconProps(displayObject),
|
|
242
|
+
};
|
|
243
|
+
});
|
|
127
244
|
};
|
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'));
|