@dxos/plugin-automation 0.8.4-main.ead640a → 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 +6 -7
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts +45 -28
- 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 +8 -0
- package/dist/types/src/components/FunctionsRegistry/FunctionsRegistry.d.ts.map +1 -0
- package/dist/types/src/components/FunctionsRegistry/index.d.ts +4 -0
- package/dist/types/src/components/FunctionsRegistry/index.d.ts.map +1 -0
- 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 +9 -8
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts +118 -30
- 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 +6 -5
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -4
- 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 -29
- 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 -68
- 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 -45
- 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 +13 -7
- package/src/components/AutomationPanel/AutomationPanel.tsx +260 -100
- package/src/components/AutomationPanel/TriggerEdgeMetadata.tsx +148 -0
- package/src/components/FunctionsPanel/FunctionsPanel.tsx +43 -35
- package/src/components/FunctionsRegistry/FunctionsRegistry.tsx +119 -0
- package/src/components/FunctionsRegistry/index.ts +8 -0
- package/src/components/TriggerEditor/FunctionInputEditor.tsx +36 -35
- package/src/components/TriggerEditor/SpecSelector.tsx +28 -22
- package/src/components/TriggerEditor/TriggerEditor.stories.tsx +94 -40
- package/src/components/TriggerEditor/TriggerEditor.tsx +173 -56
- 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 +39 -19
- package/src/index.ts +1 -5
- package/src/meta.ts +28 -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 -34
- 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-3PHA5FTJ.mjs +0 -11
- package/dist/lib/browser/AutomationSettings-OQERZHTG.mjs +0 -69
- package/dist/lib/browser/AutomationSettings-OQERZHTG.mjs.map +0 -7
- package/dist/lib/browser/FunctionsContainer-V3OM6BFC.mjs +0 -36
- package/dist/lib/browser/FunctionsContainer-V3OM6BFC.mjs.map +0 -7
- package/dist/lib/browser/FunctionsPanel-PTFCCUTB.mjs +0 -10
- package/dist/lib/browser/app-graph-builder-DV5HMFX4.mjs +0 -81
- package/dist/lib/browser/app-graph-builder-DV5HMFX4.mjs.map +0 -7
- package/dist/lib/browser/chunk-2AOFK5FW.mjs +0 -14
- package/dist/lib/browser/chunk-2AOFK5FW.mjs.map +0 -7
- package/dist/lib/browser/chunk-5ARH77PV.mjs +0 -15
- package/dist/lib/browser/chunk-5ARH77PV.mjs.map +0 -7
- package/dist/lib/browser/chunk-DK7R2HNC.mjs +0 -107
- package/dist/lib/browser/chunk-DK7R2HNC.mjs.map +0 -7
- package/dist/lib/browser/chunk-MVPRI3DB.mjs +0 -53
- package/dist/lib/browser/chunk-MVPRI3DB.mjs.map +0 -7
- package/dist/lib/browser/chunk-QACR4BJ7.mjs +0 -14
- package/dist/lib/browser/chunk-QACR4BJ7.mjs.map +0 -7
- package/dist/lib/browser/chunk-SUKAEYF3.mjs +0 -267
- package/dist/lib/browser/chunk-SUKAEYF3.mjs.map +0 -7
- package/dist/lib/browser/chunk-VGBZKM3O.mjs +0 -38
- package/dist/lib/browser/chunk-VGBZKM3O.mjs.map +0 -7
- package/dist/lib/browser/chunk-VL3KSDVL.mjs +0 -183
- package/dist/lib/browser/chunk-VL3KSDVL.mjs.map +0 -7
- package/dist/lib/browser/chunk-WWURMV25.mjs +0 -13
- package/dist/lib/browser/chunk-WWURMV25.mjs.map +0 -7
- package/dist/lib/browser/compute-runtime-YJREH6WP.mjs +0 -160
- package/dist/lib/browser/compute-runtime-YJREH6WP.mjs.map +0 -7
- package/dist/lib/browser/hooks/index.mjs +0 -12
- package/dist/lib/browser/index.mjs +0 -122
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-D2OHKQRR.mjs +0 -77
- package/dist/lib/browser/intent-resolver-D2OHKQRR.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/react-surface-POLPITTD.mjs +0 -63
- package/dist/lib/browser/react-surface-POLPITTD.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -8
- package/dist/lib/node-esm/AutomationPanel-EETYIR35.mjs +0 -12
- package/dist/lib/node-esm/AutomationSettings-MCB7HK3O.mjs +0 -70
- package/dist/lib/node-esm/AutomationSettings-MCB7HK3O.mjs.map +0 -7
- package/dist/lib/node-esm/FunctionsContainer-UGODP6YP.mjs +0 -37
- package/dist/lib/node-esm/FunctionsContainer-UGODP6YP.mjs.map +0 -7
- package/dist/lib/node-esm/FunctionsPanel-JQFBRVOC.mjs +0 -11
- package/dist/lib/node-esm/app-graph-builder-TR2WXPX2.mjs +0 -82
- package/dist/lib/node-esm/app-graph-builder-TR2WXPX2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-5MQJPJR2.mjs +0 -15
- package/dist/lib/node-esm/chunk-5MQJPJR2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-AKHETVIQ.mjs +0 -184
- package/dist/lib/node-esm/chunk-AKHETVIQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CJUI6AKX.mjs +0 -39
- package/dist/lib/node-esm/chunk-CJUI6AKX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-G72KHW5A.mjs +0 -108
- package/dist/lib/node-esm/chunk-G72KHW5A.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-J3XEBEIE.mjs +0 -268
- package/dist/lib/node-esm/chunk-J3XEBEIE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-LB7UQ4SK.mjs +0 -16
- package/dist/lib/node-esm/chunk-LB7UQ4SK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QCA543ZR.mjs +0 -54
- package/dist/lib/node-esm/chunk-QCA543ZR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-TXFXIA34.mjs +0 -16
- package/dist/lib/node-esm/chunk-TXFXIA34.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WHCSOUNN.mjs +0 -16
- package/dist/lib/node-esm/chunk-WHCSOUNN.mjs.map +0 -7
- package/dist/lib/node-esm/compute-runtime-CMEPAYND.mjs +0 -161
- package/dist/lib/node-esm/compute-runtime-CMEPAYND.mjs.map +0 -7
- package/dist/lib/node-esm/hooks/index.mjs +0 -13
- package/dist/lib/node-esm/index.mjs +0 -123
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-2LGBVXT5.mjs +0 -78
- package/dist/lib/node-esm/intent-resolver-2LGBVXT5.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/react-surface-5ULTTXAZ.mjs +0 -64
- package/dist/lib/node-esm/react-surface-5ULTTXAZ.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -9
- package/dist/types/src/capabilities/capabilities.d.ts +0 -19
- 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 -8
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +0 -1
- package/src/capabilities/capabilities.ts +0 -48
- package/src/capabilities/compute-runtime.ts +0 -138
- package/src/capabilities/intent-resolver.ts +0 -72
- package/src/components/AutomationSettings.tsx +0 -30
- package/src/components/FunctionsContainer.tsx +0 -29
- package/src/components/TriggerSettings.tsx +0 -25
- package/src/events.ts +0 -11
- package/src/hooks/useComputeRuntimeCallback.ts +0 -30
- /package/dist/lib/{browser/AutomationPanel-3PHA5FTJ.mjs.map → neutral/AutomationPanel-OS3ZWYJK.mjs.map} +0 -0
- /package/dist/lib/{browser/FunctionsPanel-PTFCCUTB.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-EETYIR35.mjs.map → neutral/index.mjs.map} +0 -0
- /package/dist/lib/{node-esm/FunctionsPanel-JQFBRVOC.mjs.map → neutral/meta.mjs.map} +0 -0
- /package/dist/types/src/{components → containers/TriggerSettings}/TriggerSettings.d.ts +0 -0
|
@@ -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
|
-
|
|
20
|
-
trigger:
|
|
32
|
+
db: Database.Database;
|
|
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
|
-
['function' satisfies keyof
|
|
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'));
|
package/src/hooks/index.ts
CHANGED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { Context } from '@dxos/context';
|
|
8
|
+
import { type TriggersDispatcherStatus } from '@dxos/edge-client';
|
|
9
|
+
import { FunctionsServiceClient } from '@dxos/functions-runtime/edge';
|
|
10
|
+
import { type SpaceId } from '@dxos/keys';
|
|
11
|
+
import { log } from '@dxos/log';
|
|
12
|
+
import { useClient } from '@dxos/react-client';
|
|
13
|
+
import { useIdentity } from '@dxos/react-client/halo';
|
|
14
|
+
|
|
15
|
+
const POLL_INTERVAL_MS = 5_000;
|
|
16
|
+
|
|
17
|
+
export type EdgeTriggersDispatcherStatusState = {
|
|
18
|
+
status: TriggersDispatcherStatus | undefined;
|
|
19
|
+
error: boolean;
|
|
20
|
+
loading: boolean;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Polls Edge TriggersDispatcher status for a space while enabled.
|
|
25
|
+
* Uses {@link FunctionsServiceClient} so requests are authenticated like other edge trigger calls.
|
|
26
|
+
*/
|
|
27
|
+
export const useEdgeTriggersDispatcherStatus = (
|
|
28
|
+
spaceId: SpaceId | undefined,
|
|
29
|
+
enabled: boolean,
|
|
30
|
+
): EdgeTriggersDispatcherStatusState => {
|
|
31
|
+
const client = useClient();
|
|
32
|
+
const identity = useIdentity();
|
|
33
|
+
const functionsServiceClient = useMemo(() => FunctionsServiceClient.fromClient(client), [client]);
|
|
34
|
+
const [status, setStatus] = useState<TriggersDispatcherStatus | undefined>();
|
|
35
|
+
const [error, setError] = useState(false);
|
|
36
|
+
const [loading, setLoading] = useState(false);
|
|
37
|
+
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (!enabled || !spaceId || !identity) {
|
|
40
|
+
setStatus(undefined);
|
|
41
|
+
setError(false);
|
|
42
|
+
setLoading(false);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
let cancelled = false;
|
|
47
|
+
|
|
48
|
+
const fetchStatus = async () => {
|
|
49
|
+
try {
|
|
50
|
+
setLoading(true);
|
|
51
|
+
const result = await functionsServiceClient.getTriggersDispatcherStatus(Context.default(), spaceId);
|
|
52
|
+
if (!cancelled) {
|
|
53
|
+
setStatus(result);
|
|
54
|
+
setError(false);
|
|
55
|
+
}
|
|
56
|
+
} catch (err) {
|
|
57
|
+
log.catch(err);
|
|
58
|
+
if (!cancelled) {
|
|
59
|
+
setError(true);
|
|
60
|
+
}
|
|
61
|
+
} finally {
|
|
62
|
+
if (!cancelled) {
|
|
63
|
+
setLoading(false);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
void fetchStatus();
|
|
69
|
+
const interval = setInterval(() => void fetchStatus(), POLL_INTERVAL_MS);
|
|
70
|
+
|
|
71
|
+
return () => {
|
|
72
|
+
cancelled = true;
|
|
73
|
+
clearInterval(interval);
|
|
74
|
+
};
|
|
75
|
+
}, [enabled, functionsServiceClient, identity, spaceId]);
|
|
76
|
+
|
|
77
|
+
return { status, error, loading };
|
|
78
|
+
};
|
|
@@ -2,50 +2,70 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Atom, useAtomValue } from '@effect-atom/atom-react';
|
|
6
|
+
import type * as Context from 'effect/Context';
|
|
5
7
|
import * as Effect from 'effect/Effect';
|
|
8
|
+
import { useEffect, useState } from 'react';
|
|
6
9
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { type
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
import { useComputeRuntimeCallback } from './useComputeRuntimeCallback';
|
|
10
|
+
import { useSpaceCallback } from '@dxos/app-framework/ui';
|
|
11
|
+
import { Trigger } from '@dxos/compute';
|
|
12
|
+
import { type Database, Filter, Query } from '@dxos/echo';
|
|
13
|
+
import { TriggerDispatcher, type TriggerDispatcherState } from '@dxos/functions-runtime';
|
|
14
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
13
15
|
|
|
14
16
|
interface TriggerRuntimeControls {
|
|
15
|
-
triggers:
|
|
16
|
-
|
|
17
|
+
triggers: Trigger.Trigger[];
|
|
18
|
+
|
|
19
|
+
state: TriggerDispatcherState | undefined;
|
|
20
|
+
|
|
17
21
|
start: () => void;
|
|
18
22
|
stop: () => void;
|
|
19
23
|
}
|
|
20
24
|
|
|
21
|
-
export const useTriggerRuntimeControls = (
|
|
22
|
-
const triggers = useQuery(
|
|
25
|
+
export const useTriggerRuntimeControls = (db: Database.Database | undefined): TriggerRuntimeControls => {
|
|
26
|
+
const triggers = useQuery(
|
|
27
|
+
db,
|
|
28
|
+
Query.select(Filter.type(Trigger.Trigger)).debugLabel('plugin-automation.useTriggerRuntimeControls'),
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const [dispatcher, setDispatcher] = useState<Context.Tag.Service<TriggerDispatcher> | undefined>(undefined);
|
|
23
32
|
|
|
24
|
-
const
|
|
25
|
-
|
|
33
|
+
const init = useSpaceCallback(
|
|
34
|
+
db?.spaceId,
|
|
35
|
+
[TriggerDispatcher],
|
|
36
|
+
Effect.fnUntraced(function* () {
|
|
37
|
+
const dispatcher = yield* TriggerDispatcher;
|
|
38
|
+
setDispatcher(dispatcher);
|
|
39
|
+
}),
|
|
26
40
|
);
|
|
27
41
|
|
|
28
|
-
|
|
29
|
-
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
void init();
|
|
44
|
+
}, []);
|
|
45
|
+
|
|
46
|
+
const state = useAtomValue(dispatcher?.state ?? Atom.make(undefined));
|
|
47
|
+
|
|
48
|
+
const start = useSpaceCallback(
|
|
49
|
+
db?.spaceId,
|
|
50
|
+
[TriggerDispatcher],
|
|
30
51
|
Effect.fnUntraced(function* () {
|
|
31
52
|
const dispatcher = yield* TriggerDispatcher;
|
|
32
53
|
yield* dispatcher.start();
|
|
33
|
-
setIsRunningState(true);
|
|
34
54
|
}),
|
|
35
55
|
);
|
|
36
56
|
|
|
37
|
-
const stop =
|
|
38
|
-
|
|
57
|
+
const stop = useSpaceCallback(
|
|
58
|
+
db?.spaceId,
|
|
59
|
+
[TriggerDispatcher],
|
|
39
60
|
Effect.fnUntraced(function* () {
|
|
40
61
|
const dispatcher = yield* TriggerDispatcher;
|
|
41
62
|
yield* dispatcher.stop();
|
|
42
|
-
setIsRunningState(false);
|
|
43
63
|
}),
|
|
44
64
|
);
|
|
45
65
|
|
|
46
66
|
return {
|
|
47
67
|
triggers,
|
|
48
|
-
|
|
68
|
+
state,
|
|
49
69
|
start: () => void start(),
|
|
50
70
|
stop: () => void stop(),
|
|
51
71
|
};
|
package/src/index.ts
CHANGED