@dxos/plugin-automation 0.8.4-main.c85a9c8dae → 0.8.4-main.d9fc60f731
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/PLUGIN.mdl +428 -0
- package/README.md +1 -1
- package/dist/lib/neutral/AutomationPanel-OKF2MDLO.mjs +12 -0
- package/dist/lib/neutral/AutomationPlugin.mjs +10 -0
- package/dist/lib/{browser/cli/index.mjs → neutral/AutomationPlugin.node.mjs} +191 -186
- 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-GQF5UFM6.mjs +32 -0
- package/dist/lib/neutral/AutomationSettings-GQF5UFM6.mjs.map +7 -0
- package/dist/lib/neutral/FunctionsContainer-YBTQGCL3.mjs +38 -0
- package/dist/lib/neutral/FunctionsContainer-YBTQGCL3.mjs.map +7 -0
- package/dist/lib/{browser/chunk-U55ZXRYM.mjs → neutral/FunctionsPanel-L32Z67B7.mjs} +24 -25
- package/dist/lib/neutral/FunctionsPanel-L32Z67B7.mjs.map +7 -0
- package/dist/lib/{browser/chunk-XFXYU645.mjs → neutral/FunctionsRegistry-RTCY3LXE.mjs} +24 -25
- 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-Q3LJLICE.mjs +75 -0
- package/dist/lib/neutral/app-graph-builder-Q3LJLICE.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +19 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/node.mjs +17 -0
- package/dist/lib/neutral/capabilities/node.mjs.map +7 -0
- package/dist/lib/neutral/chunk-2JP77CMN.mjs +42 -0
- package/dist/lib/neutral/chunk-2JP77CMN.mjs.map +7 -0
- package/dist/lib/neutral/chunk-7YWISQOZ.mjs +54 -0
- package/dist/lib/neutral/chunk-7YWISQOZ.mjs.map +7 -0
- package/dist/lib/neutral/chunk-C7H62AU3.mjs +435 -0
- package/dist/lib/neutral/chunk-C7H62AU3.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-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-LRVJEKMN.mjs +40 -0
- package/dist/lib/neutral/chunk-LRVJEKMN.mjs.map +7 -0
- package/dist/lib/neutral/chunk-MBIODLCB.mjs +12 -0
- package/dist/lib/neutral/chunk-MBIODLCB.mjs.map +7 -0
- package/dist/lib/neutral/chunk-NCCFEPBZ.mjs +76 -0
- package/dist/lib/neutral/chunk-NCCFEPBZ.mjs.map +7 -0
- package/dist/lib/{browser/chunk-ZNI2CGQP.mjs → neutral/chunk-RCBE37YU.mjs} +158 -60
- package/dist/lib/neutral/chunk-RCBE37YU.mjs.map +7 -0
- package/dist/lib/neutral/chunk-TJOQNSS5.mjs +8 -0
- package/dist/lib/neutral/chunk-TJOQNSS5.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-5YUHZOFA.mjs +68 -0
- package/dist/lib/neutral/create-trigger-from-template-5YUHZOFA.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-OXK75RDW.mjs +141 -0
- package/dist/lib/neutral/layer-specs-OXK75RDW.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +8 -0
- package/dist/lib/neutral/operation-handler-YXGYH5W5.mjs +13 -0
- package/dist/lib/neutral/operation-handler-YXGYH5W5.mjs.map +7 -0
- package/dist/lib/neutral/operations/index.mjs +8 -0
- package/dist/lib/neutral/plugin.mjs +16 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-FOOBGYNG.mjs +57 -0
- package/dist/lib/neutral/react-surface-FOOBGYNG.mjs.map +7 -0
- package/dist/lib/neutral/registry-sync-JYDDTBAE.mjs +82 -0
- package/dist/lib/neutral/registry-sync-JYDDTBAE.mjs.map +7 -0
- package/dist/lib/neutral/testing.mjs +8 -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 +1 -0
- package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
- package/dist/types/src/{cli/plugin.d.ts → AutomationPlugin.node.d.ts} +2 -1
- package/dist/types/src/AutomationPlugin.node.d.ts.map +1 -0
- package/dist/types/src/AutomationPlugin.test.d.ts +2 -0
- package/dist/types/src/AutomationPlugin.test.d.ts.map +1 -0
- package/dist/types/src/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.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +8 -4
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/layer-specs.d.ts +6 -0
- package/dist/types/src/capabilities/layer-specs.d.ts.map +1 -0
- package/dist/types/src/capabilities/node.d.ts +8 -0
- package/dist/types/src/capabilities/node.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/registry-sync.d.ts +21 -0
- package/dist/types/src/capabilities/registry-sync.d.ts.map +1 -0
- 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.map +1 -0
- package/dist/types/src/{cli/commands → commands}/trigger/create/index.d.ts +6 -6
- package/dist/types/src/commands/trigger/create/index.d.ts.map +1 -0
- package/dist/types/src/{cli/commands → commands}/trigger/create/queue.d.ts +2 -2
- package/dist/types/src/commands/trigger/create/queue.d.ts.map +1 -0
- package/dist/types/src/{cli/commands → commands}/trigger/create/subscription.d.ts +1 -1
- package/dist/types/src/commands/trigger/create/subscription.d.ts.map +1 -0
- package/dist/types/src/{cli/commands → commands}/trigger/create/timer.d.ts +1 -1
- package/dist/types/src/commands/trigger/create/timer.d.ts.map +1 -0
- package/dist/types/src/{cli/commands → commands}/trigger/index.d.ts +8 -8
- package/dist/types/src/commands/trigger/index.d.ts.map +1 -0
- package/dist/types/src/{cli/commands → commands}/trigger/list.d.ts +1 -1
- package/dist/types/src/commands/trigger/list.d.ts.map +1 -0
- package/dist/types/src/{cli/commands → commands}/trigger/options.d.ts +1 -2
- package/dist/types/src/commands/trigger/options.d.ts.map +1 -0
- package/dist/types/src/{cli/commands → commands}/trigger/remove.d.ts +1 -1
- package/dist/types/src/commands/trigger/remove.d.ts.map +1 -0
- package/dist/types/src/{cli/commands → commands}/trigger/update/index.d.ts +5 -5
- package/dist/types/src/commands/trigger/update/index.d.ts.map +1 -0
- package/dist/types/src/{cli/commands → commands}/trigger/update/queue.d.ts +2 -3
- package/dist/types/src/commands/trigger/update/queue.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/update/subscription.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/update/timer.d.ts.map +1 -0
- package/dist/types/src/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 +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts +45 -32
- 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.map +1 -1
- package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts +6 -6
- package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts +4 -4
- package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts +109 -93
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/util.d.ts +14 -0
- package/dist/types/src/components/TriggerEditor/util.d.ts.map +1 -0
- package/dist/types/src/containers/AutomationSettings/AutomationSettings.d.ts +3 -1
- package/dist/types/src/containers/AutomationSettings/AutomationSettings.d.ts.map +1 -1
- package/dist/types/src/containers/AutomationSettings/index.d.ts +1 -2
- package/dist/types/src/containers/AutomationSettings/index.d.ts.map +1 -1
- package/dist/types/src/containers/FunctionsContainer/FunctionsContainer.d.ts +2 -4
- package/dist/types/src/containers/FunctionsContainer/FunctionsContainer.d.ts.map +1 -1
- package/dist/types/src/containers/FunctionsContainer/index.d.ts +1 -2
- package/dist/types/src/containers/FunctionsContainer/index.d.ts.map +1 -1
- package/dist/types/src/containers/TriggerSettings/TriggerSettings.d.ts +3 -3
- package/dist/types/src/containers/TriggerSettings/TriggerSettings.d.ts.map +1 -1
- package/dist/types/src/containers/TriggerSettings/index.d.ts +2 -2
- package/dist/types/src/containers/TriggerSettings/index.d.ts.map +1 -1
- 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 +1 -1
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +0 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/create-trigger-from-template.d.ts +5 -0
- package/dist/types/src/operations/create-trigger-from-template.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +3 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/testing/test-functions.d.ts +162 -46
- 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 -33
- 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 -2
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +11 -32
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +124 -75
- package/src/AutomationPlugin.node.ts +35 -0
- package/src/AutomationPlugin.test.ts +27 -0
- package/src/AutomationPlugin.tsx +33 -11
- package/src/AutomationPlugin.workerd.ts +18 -0
- package/src/capabilities/app-graph-builder.ts +66 -0
- package/src/capabilities/index.ts +15 -4
- package/src/capabilities/layer-specs.ts +197 -0
- package/src/capabilities/node.ts +18 -0
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +59 -0
- package/src/capabilities/registry-sync.ts +110 -0
- package/src/capabilities/trigger-runtime-controller.test.ts +103 -0
- package/src/capabilities/trigger-runtime-controller.ts +126 -0
- package/src/{cli/commands → commands}/trigger/create/queue.ts +14 -16
- package/src/{cli/commands → commands}/trigger/create/subscription.ts +8 -11
- package/src/{cli/commands → commands}/trigger/create/timer.ts +4 -7
- package/src/{cli/commands → commands}/trigger/list.ts +7 -4
- package/src/{cli/commands → commands}/trigger/options.ts +3 -15
- package/src/{cli/commands → commands}/trigger/remove.ts +5 -5
- package/src/{cli/commands → commands}/trigger/update/queue.ts +39 -43
- package/src/{cli/commands → commands}/trigger/update/subscription.ts +22 -21
- package/src/{cli/commands → commands}/trigger/update/timer.ts +22 -20
- package/src/{cli/commands → commands}/trigger/util.ts +53 -38
- package/src/components/AutomationPanel/AutomationPanel.stories.tsx +12 -5
- package/src/components/AutomationPanel/AutomationPanel.tsx +120 -58
- package/src/components/AutomationPanel/TriggerEdgeMetadata.tsx +148 -0
- package/src/components/FunctionsPanel/FunctionsPanel.tsx +35 -27
- package/src/components/FunctionsRegistry/FunctionsRegistry.tsx +32 -23
- package/src/components/TriggerEditor/FunctionInputEditor.tsx +9 -13
- package/src/components/TriggerEditor/SpecSelector.tsx +18 -14
- package/src/components/TriggerEditor/TriggerEditor.stories.tsx +36 -18
- package/src/components/TriggerEditor/TriggerEditor.tsx +120 -25
- package/src/components/TriggerEditor/util.ts +51 -0
- package/src/containers/AutomationSettings/AutomationSettings.tsx +12 -8
- package/src/containers/AutomationSettings/index.ts +1 -3
- package/src/containers/FunctionsContainer/FunctionsContainer.tsx +11 -11
- package/src/containers/FunctionsContainer/index.ts +1 -3
- package/src/containers/TriggerSettings/TriggerSettings.tsx +32 -10
- package/src/containers/TriggerSettings/index.ts +2 -3
- package/src/hooks/index.ts +2 -1
- package/src/hooks/useEdgeTriggersDispatcherStatus.ts +78 -0
- package/src/hooks/useTriggerRuntimeControls.ts +13 -8
- package/src/index.ts +0 -4
- package/src/meta.ts +27 -7
- 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 +38 -4
- package/src/testing.ts +7 -0
- package/src/translations.ts +52 -39
- package/src/types/AutomationOperation.ts +39 -0
- package/src/types/index.ts +2 -2
- package/src/types/schema.ts +4 -25
- package/src/vite-env.d.ts +10 -0
- package/dist/lib/browser/AutomationPanel-EHRSV2DL.mjs +0 -11
- package/dist/lib/browser/AutomationSettings-TJYG77L6.mjs +0 -37
- package/dist/lib/browser/AutomationSettings-TJYG77L6.mjs.map +0 -7
- package/dist/lib/browser/FunctionsContainer-XHEQSNNO.mjs +0 -43
- package/dist/lib/browser/FunctionsContainer-XHEQSNNO.mjs.map +0 -7
- package/dist/lib/browser/FunctionsPanel-5WPUZGRB.mjs +0 -10
- package/dist/lib/browser/FunctionsRegistry-XRXIZRLL.mjs +0 -10
- package/dist/lib/browser/TriggerSettings-HUQT53SV.mjs +0 -13
- package/dist/lib/browser/TriggerSettings-HUQT53SV.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-HLARI3VW.mjs +0 -85
- package/dist/lib/browser/app-graph-builder-HLARI3VW.mjs.map +0 -7
- package/dist/lib/browser/chunk-3P4R5WNC.mjs +0 -8
- package/dist/lib/browser/chunk-3P4R5WNC.mjs.map +0 -7
- package/dist/lib/browser/chunk-4EY2KMCM.mjs +0 -272
- package/dist/lib/browser/chunk-4EY2KMCM.mjs.map +0 -7
- package/dist/lib/browser/chunk-PZNBEKO5.mjs +0 -17
- package/dist/lib/browser/chunk-PZNBEKO5.mjs.map +0 -7
- package/dist/lib/browser/chunk-QPG3AKFX.mjs +0 -93
- package/dist/lib/browser/chunk-QPG3AKFX.mjs.map +0 -7
- package/dist/lib/browser/chunk-SEG5OCGB.mjs +0 -31
- package/dist/lib/browser/chunk-SEG5OCGB.mjs.map +0 -7
- package/dist/lib/browser/chunk-U55ZXRYM.mjs.map +0 -7
- package/dist/lib/browser/chunk-WOBCY2FQ.mjs +0 -83
- package/dist/lib/browser/chunk-WOBCY2FQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-XFXYU645.mjs.map +0 -7
- package/dist/lib/browser/chunk-ZNI2CGQP.mjs.map +0 -7
- package/dist/lib/browser/cli/index.mjs.map +0 -7
- package/dist/lib/browser/compute-runtime-L2RVWXY2.mjs +0 -124
- package/dist/lib/browser/compute-runtime-L2RVWXY2.mjs.map +0 -7
- package/dist/lib/browser/hooks/index.mjs +0 -13
- package/dist/lib/browser/index.mjs +0 -123
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/operation-resolver-2U6ZQVXR.mjs +0 -83
- package/dist/lib/browser/operation-resolver-2U6ZQVXR.mjs.map +0 -7
- package/dist/lib/browser/react-surface-U6FAYV42.mjs +0 -69
- package/dist/lib/browser/react-surface-U6FAYV42.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -14
- package/dist/lib/node-esm/AutomationPanel-F7MPUR7U.mjs +0 -12
- package/dist/lib/node-esm/AutomationSettings-5AHJMILI.mjs +0 -38
- package/dist/lib/node-esm/AutomationSettings-5AHJMILI.mjs.map +0 -7
- package/dist/lib/node-esm/FunctionsContainer-U5UVRKVT.mjs +0 -44
- package/dist/lib/node-esm/FunctionsContainer-U5UVRKVT.mjs.map +0 -7
- package/dist/lib/node-esm/FunctionsPanel-UFL5LT2R.mjs +0 -11
- package/dist/lib/node-esm/FunctionsRegistry-574OBZ5T.mjs +0 -11
- package/dist/lib/node-esm/TriggerSettings-RDIJHUKK.mjs +0 -14
- package/dist/lib/node-esm/TriggerSettings-RDIJHUKK.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-Z2TMQHVX.mjs +0 -86
- package/dist/lib/node-esm/app-graph-builder-Z2TMQHVX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2X564LII.mjs +0 -10
- package/dist/lib/node-esm/chunk-2X564LII.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-34HGM46Z.mjs +0 -32
- package/dist/lib/node-esm/chunk-34HGM46Z.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4DK33JDH.mjs +0 -84
- package/dist/lib/node-esm/chunk-4DK33JDH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-5FXNN3MV.mjs +0 -19
- package/dist/lib/node-esm/chunk-5FXNN3MV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7AIKTEAX.mjs +0 -273
- package/dist/lib/node-esm/chunk-7AIKTEAX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CMZ4NKSK.mjs +0 -271
- package/dist/lib/node-esm/chunk-CMZ4NKSK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GXFQR3KI.mjs +0 -99
- package/dist/lib/node-esm/chunk-GXFQR3KI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QNPYY3XZ.mjs +0 -94
- package/dist/lib/node-esm/chunk-QNPYY3XZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RTEXGGBX.mjs +0 -97
- package/dist/lib/node-esm/chunk-RTEXGGBX.mjs.map +0 -7
- package/dist/lib/node-esm/cli/index.mjs +0 -1109
- package/dist/lib/node-esm/cli/index.mjs.map +0 -7
- package/dist/lib/node-esm/compute-runtime-XD6A5Q7Q.mjs +0 -125
- package/dist/lib/node-esm/compute-runtime-XD6A5Q7Q.mjs.map +0 -7
- package/dist/lib/node-esm/hooks/index.mjs +0 -14
- package/dist/lib/node-esm/index.mjs +0 -124
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/operation-resolver-XWJGBHJZ.mjs +0 -84
- package/dist/lib/node-esm/operation-resolver-XWJGBHJZ.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-BVNHCWQ7.mjs +0 -70
- package/dist/lib/node-esm/react-surface-BVNHCWQ7.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -15
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +0 -3
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/compute-runtime/compute-runtime.d.ts +0 -6
- package/dist/types/src/capabilities/compute-runtime/compute-runtime.d.ts.map +0 -1
- package/dist/types/src/capabilities/compute-runtime/index.d.ts +0 -3
- package/dist/types/src/capabilities/compute-runtime/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/cli/commands/index.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/create/index.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/create/queue.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/create/subscription.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/create/timer.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/index.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/list.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/options.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/remove.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/update/index.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/update/queue.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/update/subscription.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/update/timer.d.ts.map +0 -1
- package/dist/types/src/cli/commands/trigger/util.d.ts +0 -46
- package/dist/types/src/cli/commands/trigger/util.d.ts.map +0 -1
- package/dist/types/src/cli/index.d.ts +0 -2
- package/dist/types/src/cli/index.d.ts.map +0 -1
- package/dist/types/src/cli/plugin.d.ts.map +0 -1
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts +0 -12
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +0 -1
- package/dist/types/src/types/capabilities.d.ts +0 -22
- package/dist/types/src/types/capabilities.d.ts.map +0 -1
- package/dist/types/src/types/events.d.ts +0 -5
- package/dist/types/src/types/events.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +0 -72
- package/src/capabilities/app-graph-builder/index.ts +0 -7
- package/src/capabilities/compute-runtime/compute-runtime.ts +0 -146
- package/src/capabilities/compute-runtime/index.ts +0 -7
- package/src/capabilities/operation-resolver/index.ts +0 -7
- package/src/capabilities/operation-resolver/operation-resolver.ts +0 -80
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/react-surface/react-surface.tsx +0 -61
- package/src/cli/index.ts +0 -5
- package/src/cli/plugin.ts +0 -24
- package/src/hooks/useComputeRuntimeCallback.ts +0 -67
- package/src/types/capabilities.ts +0 -43
- package/src/types/events.ts +0 -11
- /package/dist/lib/{browser/AutomationPanel-EHRSV2DL.mjs.map → neutral/AutomationPanel-OKF2MDLO.mjs.map} +0 -0
- /package/dist/lib/{browser/FunctionsPanel-5WPUZGRB.mjs.map → neutral/AutomationPlugin.mjs.map} +0 -0
- /package/dist/lib/{browser/FunctionsRegistry-XRXIZRLL.mjs.map → neutral/TriggerSettings-XCHIZPOR.mjs.map} +0 -0
- /package/dist/lib/{browser/hooks/index.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/{browser/types → neutral/components}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm → neutral}/hooks/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/types → neutral}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/AutomationPanel-F7MPUR7U.mjs.map → neutral/meta.mjs.map} +0 -0
- /package/dist/lib/{node-esm/FunctionsPanel-UFL5LT2R.mjs.map → neutral/operations/index.mjs.map} +0 -0
- /package/dist/lib/{node-esm/FunctionsRegistry-574OBZ5T.mjs.map → neutral/testing.mjs.map} +0 -0
- /package/dist/types/src/capabilities/{app-graph-builder/app-graph-builder.d.ts → app-graph-builder.d.ts} +0 -0
- /package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +0 -0
- /package/dist/types/src/{cli/commands → commands}/index.d.ts +0 -0
- /package/dist/types/src/{cli/commands → commands}/trigger/update/subscription.d.ts +0 -0
- /package/dist/types/src/{cli/commands → commands}/trigger/update/timer.d.ts +0 -0
- /package/src/{cli/commands → commands}/index.ts +0 -0
- /package/src/{cli/commands → commands}/trigger/create/index.ts +0 -0
- /package/src/{cli/commands → commands}/trigger/index.ts +0 -0
- /package/src/{cli/commands → commands}/trigger/update/index.ts +0 -0
|
@@ -12,10 +12,11 @@ import type * as Schema from 'effect/Schema';
|
|
|
12
12
|
import * as SchemaAST from 'effect/SchemaAST';
|
|
13
13
|
|
|
14
14
|
import { FormBuilder } from '@dxos/cli-util';
|
|
15
|
-
import {
|
|
15
|
+
import { Operation, Trigger } from '@dxos/compute';
|
|
16
|
+
// eslint-disable-next-line unused-imports/no-unused-imports
|
|
17
|
+
import { Annotation, Database, Entity, Feed, Filter, Obj, Query, type QueryAST, Ref, Scope, Type } from '@dxos/echo';
|
|
16
18
|
import { getProperties } from '@dxos/effect';
|
|
17
|
-
import {
|
|
18
|
-
import { QueueAnnotation } from '@dxos/schema';
|
|
19
|
+
import { FeedAnnotation } from '@dxos/schema';
|
|
19
20
|
|
|
20
21
|
export type TriggerRemoteStatus = 'available' | 'not available' | 'n/a';
|
|
21
22
|
|
|
@@ -60,7 +61,10 @@ export const printTrigger = Effect.fn(function* (trigger: Trigger.Trigger, remot
|
|
|
60
61
|
fn,
|
|
61
62
|
FormBuilder.nest(
|
|
62
63
|
'function',
|
|
63
|
-
FormBuilder.make().pipe(
|
|
64
|
+
FormBuilder.make().pipe(
|
|
65
|
+
FormBuilder.set('key', Obj.getMeta(fn as Operation.PersistentOperation).key),
|
|
66
|
+
FormBuilder.set('dxn', Obj.getURI(fn as Obj.Unknown)),
|
|
67
|
+
),
|
|
64
68
|
),
|
|
65
69
|
),
|
|
66
70
|
FormBuilder.nestedOption('spec', Option.fromNullable(trigger.spec).pipe(Option.map(printSpec))),
|
|
@@ -76,8 +80,8 @@ const printSpec = <T extends Trigger.Spec>(spec: T): FormBuilder.FormBuilder =>
|
|
|
76
80
|
return printSubscription(spec);
|
|
77
81
|
case 'webhook':
|
|
78
82
|
return printWebhook(spec);
|
|
79
|
-
case '
|
|
80
|
-
return
|
|
83
|
+
case 'feed':
|
|
84
|
+
return printFeed(spec);
|
|
81
85
|
default:
|
|
82
86
|
return FormBuilder.make({}).pipe(FormBuilder.set('unknown', 'Unknown spec type'));
|
|
83
87
|
}
|
|
@@ -91,7 +95,8 @@ const printSubscription = (spec: Trigger.SubscriptionSpec) =>
|
|
|
91
95
|
const printWebhook = (spec: Trigger.WebhookSpec) =>
|
|
92
96
|
FormBuilder.make({}).pipe(FormBuilder.set('method', spec.method), FormBuilder.set('port', spec.port));
|
|
93
97
|
|
|
94
|
-
const
|
|
98
|
+
const printFeed = (spec: Trigger.FeedSpec) =>
|
|
99
|
+
FormBuilder.make({}).pipe(FormBuilder.set('feed', spec.feed ? spec.feed.uri.toString() : '(none)'));
|
|
95
100
|
|
|
96
101
|
/**
|
|
97
102
|
* Prompts for input values based on an Effect schema.
|
|
@@ -272,7 +277,7 @@ export const promptForSchemaInput = Effect.fn(function* (
|
|
|
272
277
|
* Queries the database for functions and prompts the user to select one.
|
|
273
278
|
*/
|
|
274
279
|
export const selectFunction = Effect.fn(function* () {
|
|
275
|
-
const functions = yield* Database.runQuery(Filter.type(
|
|
280
|
+
const functions = yield* Database.runQuery(Filter.type(Operation.PersistentOperation));
|
|
276
281
|
|
|
277
282
|
if (functions.length === 0) {
|
|
278
283
|
return yield* Effect.fail(new Error('No functions available'));
|
|
@@ -280,7 +285,7 @@ export const selectFunction = Effect.fn(function* () {
|
|
|
280
285
|
|
|
281
286
|
const selected = yield* Prompt.select({
|
|
282
287
|
message: 'Select a function:',
|
|
283
|
-
choices: functions.map((fn:
|
|
288
|
+
choices: functions.map((fn: Operation.PersistentOperation) => ({
|
|
284
289
|
title: fn.name ?? fn.id,
|
|
285
290
|
value: fn.id,
|
|
286
291
|
description: fn.description,
|
|
@@ -296,7 +301,9 @@ export const selectFunction = Effect.fn(function* () {
|
|
|
296
301
|
* Queries the database for triggers and prompts the user to select one.
|
|
297
302
|
*/
|
|
298
303
|
export const selectTrigger = Effect.fn(function* (kind?: Trigger.Kind) {
|
|
299
|
-
const triggers = yield* Database.runQuery(
|
|
304
|
+
const triggers = yield* Database.runQuery(
|
|
305
|
+
Query.select(Filter.type(Trigger.Trigger)).debugLabel('cli.trigger.selectTrigger'),
|
|
306
|
+
);
|
|
300
307
|
const filteredTriggers = kind ? triggers.filter((trigger) => trigger.spec?.kind === kind) : triggers;
|
|
301
308
|
|
|
302
309
|
if (filteredTriggers.length === 0) {
|
|
@@ -307,7 +314,10 @@ export const selectTrigger = Effect.fn(function* (kind?: Trigger.Kind) {
|
|
|
307
314
|
filteredTriggers.map((trigger) =>
|
|
308
315
|
Effect.gen(function* () {
|
|
309
316
|
const fn = trigger.function ? yield* Database.load(trigger.function) : undefined;
|
|
310
|
-
const functionName =
|
|
317
|
+
const functionName =
|
|
318
|
+
fn && Obj.instanceOf(Operation.PersistentOperation, fn)
|
|
319
|
+
? (fn.name ?? Obj.getMeta(fn).key ?? fn.id)
|
|
320
|
+
: undefined;
|
|
311
321
|
const title = functionName ?? trigger.id;
|
|
312
322
|
const description = `${trigger.enabled ? 'enabled' : 'disabled'} - ${trigger.spec?.kind ?? 'unknown'}`;
|
|
313
323
|
|
|
@@ -329,63 +339,68 @@ export const selectTrigger = Effect.fn(function* (kind?: Trigger.Kind) {
|
|
|
329
339
|
});
|
|
330
340
|
|
|
331
341
|
/**
|
|
332
|
-
* Selects a
|
|
333
|
-
* Queries schemas with
|
|
334
|
-
* and
|
|
342
|
+
* Selects a feed interactively from available feeds in the database.
|
|
343
|
+
* Queries schemas with FeedAnnotation, then queries objects of those types,
|
|
344
|
+
* and returns the chosen Feed object.
|
|
335
345
|
*/
|
|
336
|
-
export const
|
|
337
|
-
// Query schema registry for schemas with
|
|
338
|
-
const schemas = yield* Database.
|
|
339
|
-
|
|
340
|
-
// Filter schemas that have
|
|
341
|
-
const
|
|
342
|
-
const
|
|
346
|
+
export const selectFeed = Effect.fn(function* () {
|
|
347
|
+
// Query schema registry for schemas with FeedAnnotation.
|
|
348
|
+
const schemas = yield* Database.runQuery(Query.select(Filter.type(Type.Type)).from(Scope.space(), Scope.registry()));
|
|
349
|
+
|
|
350
|
+
// Filter schemas that have FeedAnnotation.
|
|
351
|
+
const feedSchemas = schemas.filter((type) => {
|
|
352
|
+
const schema = Type.getSchema(type);
|
|
353
|
+
const annotation = FeedAnnotation.get(schema);
|
|
343
354
|
return Option.isSome(annotation) && annotation.value === true;
|
|
344
355
|
});
|
|
345
356
|
|
|
346
|
-
if (
|
|
347
|
-
return yield* Effect.fail(new Error('No schemas with
|
|
357
|
+
if (feedSchemas.length === 0) {
|
|
358
|
+
return yield* Effect.fail(new Error('No schemas with Feed annotation found'));
|
|
348
359
|
}
|
|
349
360
|
|
|
350
|
-
// Collect all objects
|
|
351
|
-
const
|
|
361
|
+
// Collect all Feed objects referenced by host objects.
|
|
362
|
+
const feedChoices: Array<{ title: string; value: Feed.Feed; description?: string }> = [];
|
|
352
363
|
|
|
353
|
-
// Process each schema,
|
|
354
|
-
for (const schema of
|
|
364
|
+
// Process each feed schema, resolving the Feed object reference.
|
|
365
|
+
for (const schema of feedSchemas) {
|
|
355
366
|
yield* Effect.gen(function* () {
|
|
356
367
|
const typename = Type.getTypename(schema);
|
|
357
368
|
const objects = yield* Database.runQuery(Filter.type(typename));
|
|
358
369
|
|
|
359
370
|
for (const obj of objects) {
|
|
360
|
-
// Access the
|
|
361
|
-
const
|
|
362
|
-
if (!
|
|
371
|
+
// Access the feed property (which is a Ref<Feed>).
|
|
372
|
+
const feedRef = (obj as any).feed as Ref.Ref<any> | undefined;
|
|
373
|
+
if (!feedRef) {
|
|
374
|
+
continue;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
const feedObj = yield* Effect.promise(() => feedRef.tryLoad());
|
|
378
|
+
if (!feedObj || !Obj.instanceOf(Feed.Feed, feedObj)) {
|
|
363
379
|
continue;
|
|
364
380
|
}
|
|
365
381
|
|
|
366
|
-
const queueDxn = queueRef.dxn.toString();
|
|
367
382
|
const label = Obj.getLabel(obj) ?? obj.id;
|
|
368
383
|
const description = Obj.getTypename(obj);
|
|
369
384
|
|
|
370
|
-
|
|
385
|
+
feedChoices.push({
|
|
371
386
|
title: label,
|
|
372
|
-
value:
|
|
387
|
+
value: feedObj,
|
|
373
388
|
description,
|
|
374
389
|
});
|
|
375
390
|
}
|
|
376
391
|
}).pipe(Effect.catchAll(() => Effect.void));
|
|
377
392
|
}
|
|
378
393
|
|
|
379
|
-
if (
|
|
380
|
-
return yield* Effect.fail(new Error('No objects with
|
|
394
|
+
if (feedChoices.length === 0) {
|
|
395
|
+
return yield* Effect.fail(new Error('No objects with feed properties found'));
|
|
381
396
|
}
|
|
382
397
|
|
|
383
398
|
const selected = yield* Prompt.select({
|
|
384
|
-
message: 'Select a
|
|
385
|
-
choices:
|
|
399
|
+
message: 'Select a feed:',
|
|
400
|
+
choices: feedChoices,
|
|
386
401
|
});
|
|
387
402
|
|
|
388
|
-
return
|
|
403
|
+
return selected as Feed.Feed;
|
|
389
404
|
});
|
|
390
405
|
|
|
391
406
|
/**
|
|
@@ -5,13 +5,14 @@
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { Operation, Trigger } from '@dxos/compute';
|
|
9
|
+
import { Obj } from '@dxos/echo';
|
|
9
10
|
import { useSpaces } from '@dxos/react-client/echo';
|
|
10
11
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
11
12
|
import { withTheme } from '@dxos/react-ui/testing';
|
|
12
13
|
|
|
13
|
-
import { functions } from '
|
|
14
|
-
import { translations } from '
|
|
14
|
+
import { functions } from '#testing';
|
|
15
|
+
import { translations } from '#translations';
|
|
15
16
|
|
|
16
17
|
import { AutomationPanel } from './AutomationPanel';
|
|
17
18
|
|
|
@@ -35,10 +36,16 @@ const meta = {
|
|
|
35
36
|
withClientProvider({
|
|
36
37
|
createIdentity: true,
|
|
37
38
|
createSpace: true,
|
|
38
|
-
types: [
|
|
39
|
+
types: [Operation.PersistentOperation, Trigger.Trigger],
|
|
39
40
|
onCreateSpace: ({ space }) => {
|
|
40
41
|
for (const fn of functions) {
|
|
41
|
-
|
|
42
|
+
const { key, version, ...data } = fn;
|
|
43
|
+
space.db.add(
|
|
44
|
+
Obj.make(Operation.PersistentOperation, {
|
|
45
|
+
[Obj.Meta]: { key, version: version ?? '0.1.0' },
|
|
46
|
+
...data,
|
|
47
|
+
}),
|
|
48
|
+
);
|
|
42
49
|
}
|
|
43
50
|
},
|
|
44
51
|
}),
|
|
@@ -3,16 +3,21 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import * as Array from 'effect/Array';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
6
7
|
import * as EFn from 'effect/Function';
|
|
7
8
|
import * as Match from 'effect/Match';
|
|
8
9
|
import * as Schema from 'effect/Schema';
|
|
9
10
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
10
11
|
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
12
|
+
import { useProcessManagerRuntime } from '@dxos/app-framework/ui';
|
|
13
|
+
import { useTypeOptions } from '@dxos/app-toolkit/ui';
|
|
14
|
+
import { type ComputeEnvironment } from '@dxos/client-protocol';
|
|
15
|
+
import { Operation, Script, ServiceResolver, Trigger, TriggerEvent } from '@dxos/compute';
|
|
16
|
+
import { Context } from '@dxos/context';
|
|
17
|
+
import { Filter, Obj, Query, Tag, Type } from '@dxos/echo';
|
|
18
|
+
import { KEY_FEED_CURSOR, TriggerDispatcher } from '@dxos/functions-runtime';
|
|
14
19
|
import { FunctionsServiceClient } from '@dxos/functions-runtime/edge';
|
|
15
|
-
import {
|
|
20
|
+
import { log } from '@dxos/log';
|
|
16
21
|
import { type Client, useClient } from '@dxos/react-client';
|
|
17
22
|
import { type Space, useObject, useQuery } from '@dxos/react-client/echo';
|
|
18
23
|
import { Clipboard, IconButton, type IconButtonProps, Input, Separator, useTranslation } from '@dxos/react-ui';
|
|
@@ -22,8 +27,11 @@ import { Pipeline } from '@dxos/types';
|
|
|
22
27
|
import { ghostHover, mx } from '@dxos/ui-theme';
|
|
23
28
|
import { isNonNullable } from '@dxos/util';
|
|
24
29
|
|
|
25
|
-
import { meta } from '
|
|
30
|
+
import { meta } from '#meta';
|
|
31
|
+
|
|
32
|
+
import { type EdgeTriggersDispatcherStatusState, useEdgeTriggersDispatcherStatus } from '../../hooks';
|
|
26
33
|
import { TriggerEditor, type TriggerEditorProps } from '../TriggerEditor';
|
|
34
|
+
import { TriggerDispatcherSummary, TriggerEdgeMetadata } from './TriggerEdgeMetadata';
|
|
27
35
|
|
|
28
36
|
const grid = 'grid grid-cols-[40px_1fr_32px_32px] min-h-[2.5rem]';
|
|
29
37
|
|
|
@@ -38,19 +46,25 @@ export type AutomationPanelProps = {
|
|
|
38
46
|
export const AutomationPanel = ({ space, object, initialTrigger, onDone }: AutomationPanelProps) => {
|
|
39
47
|
const { t } = useTranslation(meta.id);
|
|
40
48
|
const client = useClient();
|
|
49
|
+
const processManagerRuntime = useProcessManagerRuntime();
|
|
50
|
+
const [properties] = useObject(space.properties);
|
|
51
|
+
const computeEnvironment = properties.computeEnvironment ?? 'local';
|
|
52
|
+
const edgeDispatcherStatus = useEdgeTriggersDispatcherStatus(space.id, computeEnvironment === 'edge');
|
|
41
53
|
const functionsServiceClient = useMemo(() => FunctionsServiceClient.fromClient(client), [client]);
|
|
42
|
-
const functions = useQuery(space.db, Filter.type(
|
|
43
|
-
const triggers = useQuery(
|
|
54
|
+
const functions = useQuery(space.db, Filter.type(Operation.PersistentOperation));
|
|
55
|
+
const triggers = useQuery(
|
|
56
|
+
space.db,
|
|
57
|
+
Query.select(Filter.type(Trigger.Trigger)).debugLabel('plugin-automation.AutomationPanel'),
|
|
58
|
+
);
|
|
44
59
|
const filteredTriggers = useMemo(() => {
|
|
45
60
|
return object ? triggers.filter(triggerMatch(object)) : triggers;
|
|
46
61
|
}, [object, triggers]);
|
|
47
62
|
const tags = useQuery(space.db, Filter.type(Tag.Tag));
|
|
48
63
|
const types = useTypeOptions({
|
|
49
|
-
space,
|
|
64
|
+
db: space.db,
|
|
50
65
|
annotation: {
|
|
51
66
|
location: ['database', 'runtime'],
|
|
52
67
|
kind: ['user'],
|
|
53
|
-
registered: ['registered'],
|
|
54
68
|
},
|
|
55
69
|
});
|
|
56
70
|
|
|
@@ -75,8 +89,8 @@ export const AutomationPanel = ({ space, object, initialTrigger, onDone }: Autom
|
|
|
75
89
|
|
|
76
90
|
const handleSave: TriggerEditorProps['onSave'] = (trigger) => {
|
|
77
91
|
if (selected) {
|
|
78
|
-
Obj.
|
|
79
|
-
Object.assign(
|
|
92
|
+
Obj.update(selected, (selected) => {
|
|
93
|
+
Object.assign(selected, trigger);
|
|
80
94
|
});
|
|
81
95
|
} else {
|
|
82
96
|
space.db.add(Trigger.make(trigger));
|
|
@@ -93,19 +107,44 @@ export const AutomationPanel = ({ space, object, initialTrigger, onDone }: Autom
|
|
|
93
107
|
};
|
|
94
108
|
|
|
95
109
|
const handleForceRunTrigger = async (trigger: Trigger.Trigger) => {
|
|
96
|
-
|
|
110
|
+
if (computeEnvironment === 'disabled') {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (computeEnvironment === 'local') {
|
|
115
|
+
try {
|
|
116
|
+
await processManagerRuntime.runPromise(
|
|
117
|
+
Effect.gen(function* () {
|
|
118
|
+
const dispatcher = yield* TriggerDispatcher;
|
|
119
|
+
yield* dispatcher.invokeTrigger({
|
|
120
|
+
trigger,
|
|
121
|
+
event: { tick: Date.now() } satisfies TriggerEvent.TimerEvent,
|
|
122
|
+
});
|
|
123
|
+
}).pipe(Effect.provide(ServiceResolver.provide({ space: space.id }, TriggerDispatcher))),
|
|
124
|
+
);
|
|
125
|
+
} catch (error) {
|
|
126
|
+
log.catch(error);
|
|
127
|
+
}
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
try {
|
|
132
|
+
await functionsServiceClient.forceRunCronTrigger(Context.default(), space.id, trigger.id);
|
|
133
|
+
} catch (error) {
|
|
134
|
+
log.catch(error);
|
|
135
|
+
}
|
|
97
136
|
};
|
|
98
137
|
|
|
99
138
|
const handleResetCursor = async (trigger: Trigger.Trigger) => {
|
|
100
|
-
Obj.
|
|
101
|
-
Obj.deleteKeys(
|
|
139
|
+
Obj.update(trigger, (trigger) => {
|
|
140
|
+
Obj.deleteKeys(trigger, KEY_FEED_CURSOR);
|
|
102
141
|
});
|
|
103
142
|
await space.db.flush({ indexes: true });
|
|
104
143
|
};
|
|
105
144
|
|
|
106
145
|
if (trigger) {
|
|
107
146
|
return (
|
|
108
|
-
<Settings.Item title={t('trigger
|
|
147
|
+
<Settings.Item title={t('trigger-editor.title')} description={t('trigger-editor.description')}>
|
|
109
148
|
<TriggerEditor
|
|
110
149
|
db={space.db}
|
|
111
150
|
trigger={trigger}
|
|
@@ -120,47 +159,64 @@ export const AutomationPanel = ({ space, object, initialTrigger, onDone }: Autom
|
|
|
120
159
|
}
|
|
121
160
|
|
|
122
161
|
return (
|
|
123
|
-
<Settings.
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
162
|
+
<Settings.Panel>
|
|
163
|
+
<Clipboard.Provider>
|
|
164
|
+
{computeEnvironment === 'edge' && (
|
|
165
|
+
<TriggerDispatcherSummary
|
|
166
|
+
status={edgeDispatcherStatus.status}
|
|
167
|
+
error={edgeDispatcherStatus.error}
|
|
168
|
+
loading={edgeDispatcherStatus.loading}
|
|
169
|
+
timerTriggers={filteredTriggers.filter((trigger) => trigger.spec?.kind === 'timer')}
|
|
170
|
+
/>
|
|
171
|
+
)}
|
|
172
|
+
|
|
173
|
+
{filteredTriggers.length > 0 && (
|
|
174
|
+
<List.Root<Trigger.Trigger>
|
|
175
|
+
items={filteredTriggers}
|
|
176
|
+
isItem={Schema.is(Type.getSchema(Trigger.Trigger))}
|
|
177
|
+
getId={(field) => field.id}
|
|
178
|
+
>
|
|
179
|
+
{({ items: filteredTriggers }) => (
|
|
180
|
+
<div role='list' className='flex flex-col w-full'>
|
|
181
|
+
{filteredTriggers?.map((trigger) => (
|
|
182
|
+
<TriggerListItem
|
|
183
|
+
key={trigger.id}
|
|
184
|
+
trigger={trigger}
|
|
185
|
+
functions={functions}
|
|
186
|
+
computeEnvironment={computeEnvironment}
|
|
187
|
+
edgeDispatcherStatus={edgeDispatcherStatus}
|
|
188
|
+
onSelect={handleSelect}
|
|
189
|
+
onDelete={handleDelete}
|
|
190
|
+
onResetCursor={handleResetCursor}
|
|
191
|
+
onForceRun={handleForceRunTrigger}
|
|
192
|
+
/>
|
|
193
|
+
))}
|
|
194
|
+
</div>
|
|
195
|
+
)}
|
|
196
|
+
</List.Root>
|
|
197
|
+
)}
|
|
147
198
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
199
|
+
{filteredTriggers.length > 0 && <Separator classNames='my-4' />}
|
|
200
|
+
<IconButton icon='ph--plus--regular' label={t('new-trigger.label')} onClick={handleAdd} />
|
|
201
|
+
</Clipboard.Provider>
|
|
202
|
+
</Settings.Panel>
|
|
151
203
|
);
|
|
152
204
|
};
|
|
153
205
|
|
|
154
206
|
const TriggerListItem = ({
|
|
155
207
|
trigger,
|
|
156
208
|
functions,
|
|
209
|
+
computeEnvironment,
|
|
210
|
+
edgeDispatcherStatus,
|
|
157
211
|
onSelect,
|
|
158
212
|
onDelete,
|
|
159
213
|
onResetCursor,
|
|
160
214
|
onForceRun,
|
|
161
215
|
}: {
|
|
162
216
|
trigger: Trigger.Trigger;
|
|
163
|
-
functions:
|
|
217
|
+
functions: Operation.PersistentOperation[];
|
|
218
|
+
computeEnvironment: ComputeEnvironment;
|
|
219
|
+
edgeDispatcherStatus?: EdgeTriggersDispatcherStatusState;
|
|
164
220
|
onSelect?: (trigger: Trigger.Trigger) => void;
|
|
165
221
|
onDelete?: (trigger: Trigger.Trigger) => void;
|
|
166
222
|
onResetCursor?: (trigger: Trigger.Trigger) => void;
|
|
@@ -169,7 +225,7 @@ const TriggerListItem = ({
|
|
|
169
225
|
const client = useClient();
|
|
170
226
|
const copyAction = getCopyAction(client, trigger);
|
|
171
227
|
const { t } = useTranslation(meta.id);
|
|
172
|
-
const cursor = Obj.getKeys(trigger,
|
|
228
|
+
const cursor = Obj.getKeys(trigger, KEY_FEED_CURSOR).at(0)?.id;
|
|
173
229
|
const [snapshot, updateTrigger] = useObject(trigger);
|
|
174
230
|
|
|
175
231
|
const enabled = snapshot.enabled ?? false;
|
|
@@ -198,14 +254,14 @@ const TriggerListItem = ({
|
|
|
198
254
|
const actionProps = useMemo<IconButtonProps | undefined>(() => {
|
|
199
255
|
if (trigger.spec?.kind === 'timer' && onForceRun) {
|
|
200
256
|
return {
|
|
201
|
-
disabled: !enabled ||
|
|
257
|
+
disabled: !enabled || computeEnvironment === 'disabled',
|
|
202
258
|
icon: 'ph--play--regular',
|
|
203
259
|
label: 'Force run',
|
|
204
260
|
onClick: handleForceRun,
|
|
205
261
|
};
|
|
206
262
|
}
|
|
207
263
|
|
|
208
|
-
if (trigger.spec?.kind === '
|
|
264
|
+
if (trigger.spec?.kind === 'feed' && onResetCursor) {
|
|
209
265
|
return {
|
|
210
266
|
disabled: !cursor,
|
|
211
267
|
icon: 'ph--arrow-clockwise--regular',
|
|
@@ -213,7 +269,7 @@ const TriggerListItem = ({
|
|
|
213
269
|
onClick: handleResetCursor,
|
|
214
270
|
};
|
|
215
271
|
}
|
|
216
|
-
}, [enabled, trigger.spec?.kind, handleForceRun]);
|
|
272
|
+
}, [computeEnvironment, enabled, trigger.spec?.kind, handleForceRun, onResetCursor]);
|
|
217
273
|
|
|
218
274
|
return (
|
|
219
275
|
<List.Item<Obj.Snapshot<Trigger.Trigger>>
|
|
@@ -225,18 +281,24 @@ const TriggerListItem = ({
|
|
|
225
281
|
<Input.Switch checked={enabled} onCheckedChange={onEnabledChange} />
|
|
226
282
|
</Input.Root>
|
|
227
283
|
|
|
228
|
-
<div className=
|
|
229
|
-
<
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
284
|
+
<div className='flex flex-col min-w-0'>
|
|
285
|
+
<div className='flex'>
|
|
286
|
+
<List.ItemTitle classNames='px-1 cursor-pointer w-0 shrink truncate' onClick={handleSelect}>
|
|
287
|
+
{getFunctionName(functions, trigger) ?? '∅'}
|
|
288
|
+
</List.ItemTitle>
|
|
289
|
+
|
|
290
|
+
{copyAction && (
|
|
291
|
+
<Clipboard.IconButton label={t(copyAction.translationKey)} value={copyAction.contentProvider()} />
|
|
292
|
+
)}
|
|
293
|
+
</div>
|
|
233
294
|
|
|
234
|
-
{
|
|
235
|
-
|
|
295
|
+
{cursor && <div className='text-xs text-description truncate ml-4'>Position: {cursor}</div>}
|
|
296
|
+
{computeEnvironment === 'edge' && edgeDispatcherStatus && (
|
|
297
|
+
<TriggerEdgeMetadata trigger={trigger} edgeStatus={edgeDispatcherStatus} />
|
|
236
298
|
)}
|
|
237
299
|
</div>
|
|
238
300
|
|
|
239
|
-
{actionProps ? <List.
|
|
301
|
+
{actionProps ? <List.ItemIconButton {...actionProps} autoHide={false} /> : <div />}
|
|
240
302
|
|
|
241
303
|
{onDelete && <List.ItemDeleteButton onClick={handleDelete} />}
|
|
242
304
|
</List.Item>
|
|
@@ -269,17 +331,17 @@ const getWebhookUrl = (client: Client, trigger: Trigger.Trigger) => {
|
|
|
269
331
|
return new URL(`/webhook/${spaceId}:${trigger.id}`, edgeUrl).toString();
|
|
270
332
|
};
|
|
271
333
|
|
|
272
|
-
const getFunctionName = (functions:
|
|
334
|
+
const getFunctionName = (functions: Operation.PersistentOperation[], trigger: Trigger.Trigger) => {
|
|
273
335
|
// TODO(wittjosiah): Truncation should be done in the UI.
|
|
274
336
|
// Warning that the List component is currently a can of worms.
|
|
275
|
-
const shortId = trigger.function && `${trigger.function.
|
|
337
|
+
const shortId = trigger.function && `${trigger.function.uri.slice(0, 16)}…`;
|
|
276
338
|
const functionObject = functions.find((fn) => fn === trigger.function?.target);
|
|
277
339
|
return functionObject?.name ?? shortId;
|
|
278
340
|
};
|
|
279
341
|
|
|
280
342
|
const scriptMatch = (script: Script.Script) => (trigger: Trigger.Trigger) => {
|
|
281
343
|
const fn = trigger.function?.target;
|
|
282
|
-
if (!Obj.instanceOf(
|
|
344
|
+
if (!Obj.instanceOf(Operation.PersistentOperation, fn)) {
|
|
283
345
|
return false;
|
|
284
346
|
}
|
|
285
347
|
|