@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
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useMemo } from 'react';
|
|
6
|
+
|
|
7
|
+
import { Trigger } from '@dxos/compute';
|
|
8
|
+
import { type TriggersDispatcherStatus } from '@dxos/edge-client';
|
|
9
|
+
import { useTranslation } from '@dxos/react-ui';
|
|
10
|
+
import { mx } from '@dxos/ui-theme';
|
|
11
|
+
|
|
12
|
+
import { meta } from '#meta';
|
|
13
|
+
|
|
14
|
+
import { type EdgeTriggersDispatcherStatusState } from '../../hooks';
|
|
15
|
+
|
|
16
|
+
const formatTimestamp = (timestamp?: number): string | undefined =>
|
|
17
|
+
timestamp != null ? new Date(timestamp).toLocaleString() : undefined;
|
|
18
|
+
|
|
19
|
+
const formatRemaining = (remainingMs?: number): string | undefined => {
|
|
20
|
+
if (remainingMs == null) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
const totalSeconds = Math.max(0, Math.round(remainingMs / 1000));
|
|
24
|
+
if (totalSeconds < 60) {
|
|
25
|
+
return `${totalSeconds}s`;
|
|
26
|
+
}
|
|
27
|
+
const minutes = Math.floor(totalSeconds / 60);
|
|
28
|
+
const seconds = totalSeconds % 60;
|
|
29
|
+
return seconds > 0 ? `${minutes}m ${seconds}s` : `${minutes}m`;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type TriggerDispatcherSummaryProps = {
|
|
33
|
+
status: TriggersDispatcherStatus | undefined;
|
|
34
|
+
error: boolean;
|
|
35
|
+
loading: boolean;
|
|
36
|
+
/** Timer triggers shown in the list (used for registered count). */
|
|
37
|
+
timerTriggers: Trigger.Trigger[];
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const TriggerDispatcherSummary = ({ status, error, loading, timerTriggers }: TriggerDispatcherSummaryProps) => {
|
|
41
|
+
const { t } = useTranslation(meta.id);
|
|
42
|
+
|
|
43
|
+
if (loading && !status) {
|
|
44
|
+
return <div className='text-xs text-description px-2 pb-2'>{t('edge.trigger.status.loading.message')}</div>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (error && !status) {
|
|
48
|
+
return <div className='text-xs text-error-text px-2 pb-2'>{t('edge.trigger.status.unavailable.message')}</div>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (!status) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const enabledTimerCount = timerTriggers.filter((trigger) => trigger.enabled).length;
|
|
56
|
+
const registeredEnabledCount = timerTriggers.filter(
|
|
57
|
+
(trigger) => trigger.enabled && status.registeredTriggers.includes(trigger.id),
|
|
58
|
+
).length;
|
|
59
|
+
|
|
60
|
+
const lines = [
|
|
61
|
+
t('edge.trigger.status.dispatcher.label', {
|
|
62
|
+
state: status.isActive ? t('edge.trigger.status.active.label') : t('edge.trigger.status.inactive.label'),
|
|
63
|
+
}),
|
|
64
|
+
timerTriggers.length > 0 &&
|
|
65
|
+
t('edge.trigger.status.registered.count.label', {
|
|
66
|
+
registered: registeredEnabledCount,
|
|
67
|
+
total: enabledTimerCount,
|
|
68
|
+
}),
|
|
69
|
+
status.nextCronTaskRunTimestamp != null &&
|
|
70
|
+
t('edge.trigger.status.next.cron.label', { time: formatTimestamp(status.nextCronTaskRunTimestamp) }),
|
|
71
|
+
status.nextAlarmTimestamp != null &&
|
|
72
|
+
t('edge.trigger.status.next.alarm.label', { time: formatTimestamp(status.nextAlarmTimestamp) }),
|
|
73
|
+
status.remainingMs != null &&
|
|
74
|
+
t('edge.trigger.status.inactivity.label', { remaining: formatRemaining(status.remainingMs) }),
|
|
75
|
+
].filter((line): line is string => Boolean(line));
|
|
76
|
+
|
|
77
|
+
if (lines.length === 0) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<div className='flex flex-col gap-0.5 text-xs text-description px-2 pb-2'>
|
|
83
|
+
{lines.map((line) => (
|
|
84
|
+
<div key={line}>{line}</div>
|
|
85
|
+
))}
|
|
86
|
+
</div>
|
|
87
|
+
);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export type TriggerEdgeMetadataProps = {
|
|
91
|
+
trigger: Trigger.Trigger;
|
|
92
|
+
edgeStatus: Pick<EdgeTriggersDispatcherStatusState, 'status' | 'loading' | 'error'>;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const TriggerEdgeMetadata = ({ trigger, edgeStatus }: TriggerEdgeMetadataProps) => {
|
|
96
|
+
const { t } = useTranslation(meta.id);
|
|
97
|
+
const { status, loading, error } = edgeStatus;
|
|
98
|
+
|
|
99
|
+
const registration = useMemo(() => {
|
|
100
|
+
if (trigger.spec?.kind !== 'timer') {
|
|
101
|
+
return { kind: 'na' as const };
|
|
102
|
+
}
|
|
103
|
+
if (!status) {
|
|
104
|
+
return { kind: 'unknown' as const };
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
kind: 'cron' as const,
|
|
108
|
+
registered: status.registeredTriggers.includes(trigger.id),
|
|
109
|
+
};
|
|
110
|
+
}, [status, trigger.id, trigger.spec?.kind]);
|
|
111
|
+
|
|
112
|
+
if (loading && !status) {
|
|
113
|
+
return <div className='text-xs text-description ml-4 truncate'>{t('edge.trigger.status.loading.message')}</div>;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (error && !status) {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (!status) {
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (registration.kind === 'na') {
|
|
125
|
+
return <div className='text-xs text-description ml-4 truncate'>{t('edge.trigger.status.cron.na.label')}</div>;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const enabled = trigger.enabled ?? false;
|
|
129
|
+
const registered = registration.kind === 'cron' && registration.registered;
|
|
130
|
+
|
|
131
|
+
const label = registered ? t('edge.trigger.status.registered.label') : t('edge.trigger.status.not.registered.label');
|
|
132
|
+
|
|
133
|
+
const classNames = mx(
|
|
134
|
+
'text-xs ml-4 truncate',
|
|
135
|
+
registered ? 'text-success-text' : enabled ? 'text-warning-text' : 'text-description',
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
const detail = registration.kind === 'cron' && !enabled ? t('edge.trigger.status.disabled.detail.label') : undefined;
|
|
139
|
+
|
|
140
|
+
return (
|
|
141
|
+
<div className='flex flex-col gap-0.5 min-w-0'>
|
|
142
|
+
<div className={classNames}>
|
|
143
|
+
{label}
|
|
144
|
+
{detail && <span className='text-description'> · {detail}</span>}
|
|
145
|
+
</div>
|
|
146
|
+
</div>
|
|
147
|
+
);
|
|
148
|
+
};
|
|
@@ -6,17 +6,17 @@ import * as Schema from 'effect/Schema';
|
|
|
6
6
|
import React, { useCallback, useMemo } from 'react';
|
|
7
7
|
|
|
8
8
|
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
9
|
-
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { SpaceOperation } from '@dxos/plugin-space
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
9
|
+
import { LayoutOperation, getObjectPathFromObject } from '@dxos/app-toolkit';
|
|
10
|
+
import { Operation, Script } from '@dxos/compute';
|
|
11
|
+
import { Filter, Type } from '@dxos/echo';
|
|
12
|
+
import { SpaceOperation } from '@dxos/plugin-space';
|
|
13
|
+
import { type Space, useQuery } from '@dxos/react-client/echo';
|
|
14
|
+
import { IconButton, useTranslation } from '@dxos/react-ui';
|
|
15
15
|
import { Settings } from '@dxos/react-ui-form';
|
|
16
16
|
import { List } from '@dxos/react-ui-list';
|
|
17
17
|
import { ghostHover, mx } from '@dxos/ui-theme';
|
|
18
18
|
|
|
19
|
-
import { meta } from '
|
|
19
|
+
import { meta } from '#meta';
|
|
20
20
|
|
|
21
21
|
export type FunctionsPanelProps = {
|
|
22
22
|
space: Space;
|
|
@@ -24,7 +24,7 @@ export type FunctionsPanelProps = {
|
|
|
24
24
|
|
|
25
25
|
export const FunctionsPanel = ({ space }: FunctionsPanelProps) => {
|
|
26
26
|
const { t } = useTranslation(meta.id);
|
|
27
|
-
const functions = useQuery(space.db, Filter.type(
|
|
27
|
+
const functions = useQuery(space.db, Filter.type(Operation.PersistentOperation));
|
|
28
28
|
const scripts = useQuery(space.db, Filter.type(Script.Script));
|
|
29
29
|
const { invokePromise } = useOperationInvoker();
|
|
30
30
|
|
|
@@ -47,7 +47,7 @@ export const FunctionsPanel = ({ space }: FunctionsPanelProps) => {
|
|
|
47
47
|
);
|
|
48
48
|
|
|
49
49
|
const getScriptName = useCallback(
|
|
50
|
-
(func:
|
|
50
|
+
(func: Operation.PersistentOperation) => {
|
|
51
51
|
const script = functionToScriptMap[func.id];
|
|
52
52
|
return script?.name;
|
|
53
53
|
},
|
|
@@ -55,45 +55,55 @@ export const FunctionsPanel = ({ space }: FunctionsPanelProps) => {
|
|
|
55
55
|
);
|
|
56
56
|
|
|
57
57
|
const handleGoToScript = useCallback(
|
|
58
|
-
(func:
|
|
58
|
+
(func: Operation.PersistentOperation) => {
|
|
59
59
|
const script = functionToScriptMap[func.id];
|
|
60
60
|
if (script) {
|
|
61
|
-
void invokePromise(LayoutOperation.Open, { subject: [
|
|
61
|
+
void invokePromise(LayoutOperation.Open, { subject: [getObjectPathFromObject(script)] });
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
[functionToScriptMap, invokePromise],
|
|
65
65
|
);
|
|
66
66
|
|
|
67
67
|
const handleDelete = useCallback(
|
|
68
|
-
(func:
|
|
68
|
+
(func: Operation.PersistentOperation) => invokePromise(SpaceOperation.RemoveObjects, { objects: [func] }),
|
|
69
69
|
[invokePromise],
|
|
70
70
|
);
|
|
71
71
|
|
|
72
72
|
return (
|
|
73
|
-
<Settings.
|
|
73
|
+
<Settings.Panel>
|
|
74
74
|
{functions.length > 0 && (
|
|
75
|
-
<List.Root<
|
|
75
|
+
<List.Root<Operation.PersistentOperation>
|
|
76
|
+
items={functions}
|
|
77
|
+
isItem={Schema.is(Type.getSchema(Operation.PersistentOperation))}
|
|
78
|
+
getId={(func) => func.id}
|
|
79
|
+
>
|
|
76
80
|
{({ items }) => (
|
|
77
81
|
<div role='list' className='flex flex-col w-full'>
|
|
78
82
|
{items?.map((func) => (
|
|
79
|
-
<List.Item<
|
|
83
|
+
<List.Item<Operation.PersistentOperation>
|
|
80
84
|
key={func.id}
|
|
81
85
|
item={func}
|
|
82
|
-
classNames={mx(
|
|
86
|
+
classNames={mx(
|
|
87
|
+
'grid grid-cols-[1fr_min-content_auto] min-h-[2.5rem] min-h-[3rem] px-2 items-center',
|
|
88
|
+
ghostHover,
|
|
89
|
+
)}
|
|
83
90
|
>
|
|
84
91
|
<div className='flex flex-col truncate'>
|
|
85
92
|
<List.ItemTitle classNames='truncate'>{func.name}</List.ItemTitle>
|
|
86
|
-
{getScriptName(func) && (
|
|
87
|
-
<div className='text-xs text-description truncate'>{getScriptName(func)}</div>
|
|
88
|
-
)}
|
|
93
|
+
{getScriptName(func) && <p className='text-xs text-description truncate'>{getScriptName(func)}</p>}
|
|
89
94
|
</div>
|
|
90
|
-
{functionToScriptMap[func.id] && (
|
|
91
|
-
<
|
|
92
|
-
|
|
95
|
+
{(functionToScriptMap[func.id] && (
|
|
96
|
+
<IconButton
|
|
97
|
+
icon='ph--arrow-square-out--regular'
|
|
98
|
+
iconOnly
|
|
99
|
+
label={t('show-source-button.label')}
|
|
100
|
+
onClick={() => handleGoToScript(func)}
|
|
101
|
+
/>
|
|
102
|
+
)) || <div />}
|
|
93
103
|
<IconButton
|
|
94
|
-
iconOnly
|
|
95
104
|
icon='ph--trash--regular'
|
|
96
|
-
|
|
105
|
+
iconOnly
|
|
106
|
+
label={t('delete-function-button.label')}
|
|
97
107
|
onClick={() => handleDelete(func)}
|
|
98
108
|
/>
|
|
99
109
|
</List.Item>
|
|
@@ -102,8 +112,6 @@ export const FunctionsPanel = ({ space }: FunctionsPanelProps) => {
|
|
|
102
112
|
)}
|
|
103
113
|
</List.Root>
|
|
104
114
|
)}
|
|
105
|
-
|
|
106
|
-
{functions.length === 0 && <div className='text-center py-4 text-description'>{t('no functions found')}</div>}
|
|
107
|
-
</Settings.Container>
|
|
115
|
+
</Settings.Panel>
|
|
108
116
|
);
|
|
109
117
|
};
|
|
@@ -6,16 +6,18 @@ import * as Schema from 'effect/Schema';
|
|
|
6
6
|
import { useState } from 'react';
|
|
7
7
|
import React, { useCallback } from 'react';
|
|
8
8
|
|
|
9
|
-
import
|
|
9
|
+
import * as OperationModule from '@dxos/compute';
|
|
10
|
+
import { Context } from '@dxos/context';
|
|
11
|
+
import { Filter, Obj, Type } from '@dxos/echo';
|
|
10
12
|
import { getDeployedFunctions } from '@dxos/functions-runtime/edge';
|
|
11
13
|
import { useClient } from '@dxos/react-client';
|
|
12
|
-
import {
|
|
14
|
+
import { type Space, useQuery } from '@dxos/react-client/echo';
|
|
13
15
|
import { IconButton, useAsyncEffect, useTranslation } from '@dxos/react-ui';
|
|
14
16
|
import { Settings } from '@dxos/react-ui-form';
|
|
15
17
|
import { List } from '@dxos/react-ui-list';
|
|
16
18
|
import { ghostHover, mx } from '@dxos/ui-theme';
|
|
17
19
|
|
|
18
|
-
import { meta } from '
|
|
20
|
+
import { meta } from '#meta';
|
|
19
21
|
|
|
20
22
|
const grid = 'grid grid-cols-[1fr_1fr_auto] min-h-[2.5rem]';
|
|
21
23
|
|
|
@@ -26,17 +28,18 @@ type FunctionsRegistryProps = {
|
|
|
26
28
|
export const FunctionsRegistry = ({ space }: FunctionsRegistryProps) => {
|
|
27
29
|
const client = useClient();
|
|
28
30
|
const [loading, setLoading] = useState(true);
|
|
29
|
-
const [functions, setFunctions] = useState<
|
|
31
|
+
const [functions, setFunctions] = useState<OperationModule.Operation.PersistentOperation[]>([]);
|
|
30
32
|
const { t } = useTranslation(meta.id);
|
|
31
33
|
|
|
32
|
-
const dbFunctions = useQuery(space.db, Filter.type(
|
|
34
|
+
const dbFunctions = useQuery(space.db, Filter.type(OperationModule.Operation.PersistentOperation));
|
|
33
35
|
|
|
34
|
-
const state = (func:
|
|
35
|
-
const
|
|
36
|
+
const state = (func: OperationModule.Operation.PersistentOperation) => {
|
|
37
|
+
const funcKey = Obj.getMeta(func).key;
|
|
38
|
+
const dbFunction = dbFunctions.find((f) => Obj.getMeta(f).key === funcKey);
|
|
36
39
|
if (!dbFunction) {
|
|
37
40
|
return 'import';
|
|
38
41
|
}
|
|
39
|
-
if (dbFunction.version === func.version && dbFunction.updated === func.updated) {
|
|
42
|
+
if (Obj.getMeta(dbFunction).version === Obj.getMeta(func).version && dbFunction.updated === func.updated) {
|
|
40
43
|
return 'none';
|
|
41
44
|
}
|
|
42
45
|
return 'update';
|
|
@@ -44,42 +47,51 @@ export const FunctionsRegistry = ({ space }: FunctionsRegistryProps) => {
|
|
|
44
47
|
|
|
45
48
|
useAsyncEffect(async () => {
|
|
46
49
|
setLoading(true);
|
|
47
|
-
const functions = await getDeployedFunctions(client, true);
|
|
50
|
+
const functions = await getDeployedFunctions(Context.default(), client, true);
|
|
48
51
|
setFunctions(functions);
|
|
49
52
|
setLoading(false);
|
|
50
53
|
}, []);
|
|
51
54
|
|
|
52
55
|
const hanleImportOrUpdate = useCallback(
|
|
53
|
-
async (func:
|
|
54
|
-
const
|
|
56
|
+
async (func: OperationModule.Operation.PersistentOperation) => {
|
|
57
|
+
const funcKey = Obj.getMeta(func).key;
|
|
58
|
+
const functions = funcKey
|
|
59
|
+
? await space.db
|
|
60
|
+
.query(Filter.and(Filter.type(OperationModule.Operation.PersistentOperation), Filter.key(funcKey)))
|
|
61
|
+
.run()
|
|
62
|
+
: [];
|
|
55
63
|
const [existingFunc] = functions;
|
|
56
64
|
if (!existingFunc) {
|
|
57
65
|
space.db.add(func);
|
|
58
66
|
return;
|
|
59
67
|
}
|
|
60
|
-
|
|
68
|
+
OperationModule.Operation.setFrom(existingFunc, func);
|
|
61
69
|
},
|
|
62
70
|
[space],
|
|
63
71
|
);
|
|
64
72
|
|
|
65
73
|
return (
|
|
66
|
-
<Settings.
|
|
74
|
+
<Settings.Panel>
|
|
67
75
|
{functions.length > 0 && (
|
|
68
|
-
<List.Root<
|
|
76
|
+
<List.Root<OperationModule.Operation.PersistentOperation>
|
|
77
|
+
items={functions}
|
|
78
|
+
isItem={Schema.is(Type.getSchema(OperationModule.Operation.PersistentOperation))}
|
|
79
|
+
getId={(func) => func.id}
|
|
80
|
+
>
|
|
69
81
|
{({ items }) => (
|
|
70
82
|
<div role='list' className='flex flex-col w-full'>
|
|
71
83
|
{items?.map((func) => (
|
|
72
|
-
<List.Item<
|
|
84
|
+
<List.Item<OperationModule.Operation.PersistentOperation>
|
|
73
85
|
key={func.id}
|
|
74
86
|
item={func}
|
|
75
87
|
classNames={mx(grid, ghostHover, 'items-center', 'px-2', 'min-h-[3rem]')}
|
|
76
88
|
>
|
|
77
89
|
<div className='flex flex-col truncate'>
|
|
78
90
|
<List.ItemTitle classNames='truncate'>{func.name}</List.ItemTitle>
|
|
79
|
-
<div className='text-xs text-description truncate'>{func.key}</div>
|
|
91
|
+
<div className='text-xs text-description truncate'>{Obj.getMeta(func).key}</div>
|
|
80
92
|
</div>
|
|
81
93
|
<div className='flex flex-col truncate'>
|
|
82
|
-
<div className='text-xs text-description truncate'>{func.version}</div>
|
|
94
|
+
<div className='text-xs text-description truncate'>{Obj.getMeta(func).version}</div>
|
|
83
95
|
<div className='text-xs text-description truncate'>
|
|
84
96
|
{func.updated ? `Uploaded ${new Date(func.updated).toLocaleString()}` : ''}
|
|
85
97
|
</div>
|
|
@@ -89,7 +101,7 @@ export const FunctionsRegistry = ({ space }: FunctionsRegistryProps) => {
|
|
|
89
101
|
iconOnly
|
|
90
102
|
icon={state(func) === 'update' ? 'ph--arrows-clockwise--regular' : 'ph--download--regular'}
|
|
91
103
|
label={
|
|
92
|
-
state(func) === 'update' ? t('update
|
|
104
|
+
state(func) === 'update' ? t('update-function-button.label') : t('import-function-button.label')
|
|
93
105
|
}
|
|
94
106
|
disabled={state(func) === 'none'}
|
|
95
107
|
onClick={() => hanleImportOrUpdate(func)}
|
|
@@ -101,10 +113,7 @@ export const FunctionsRegistry = ({ space }: FunctionsRegistryProps) => {
|
|
|
101
113
|
</List.Root>
|
|
102
114
|
)}
|
|
103
115
|
|
|
104
|
-
{
|
|
105
|
-
|
|
106
|
-
)}
|
|
107
|
-
{loading && <div className='text-center py-4 text-gray-500'>{t('loading functions')}</div>}
|
|
108
|
-
</Settings.Container>
|
|
116
|
+
{loading && <div className='text-center py-4 text-gray-500'>{t('loading-functions.message')}</div>}
|
|
117
|
+
</Settings.Panel>
|
|
109
118
|
);
|
|
110
119
|
};
|
|
@@ -5,32 +5,28 @@
|
|
|
5
5
|
import type * as SchemaAST from 'effect/SchemaAST';
|
|
6
6
|
import React, { useCallback, useMemo } from 'react';
|
|
7
7
|
|
|
8
|
+
import { type Operation } from '@dxos/compute';
|
|
8
9
|
import { type Database, JsonSchema, Obj, Ref } from '@dxos/echo';
|
|
9
10
|
import { type JsonPath } from '@dxos/echo/internal';
|
|
10
|
-
import { type Function } from '@dxos/functions';
|
|
11
11
|
import { useOnTransition, useTranslation } from '@dxos/react-ui';
|
|
12
12
|
import { Form, type FormFieldStateProps, type FormRootProps, useFormValues } from '@dxos/react-ui-form';
|
|
13
13
|
|
|
14
|
-
import { meta } from '
|
|
14
|
+
import { meta } from '#meta';
|
|
15
|
+
|
|
16
|
+
import { findOperationByUri } from './util';
|
|
15
17
|
|
|
16
18
|
export type FunctionInputEditorProps = {
|
|
17
19
|
type: SchemaAST.AST;
|
|
18
|
-
functions:
|
|
20
|
+
functions: Operation.PersistentOperation[];
|
|
19
21
|
db?: Database.Database;
|
|
20
22
|
} & FormFieldStateProps;
|
|
21
23
|
|
|
22
24
|
export const FunctionInputEditor = ({ type, functions, db, getValue, onValueChange }: FunctionInputEditorProps) => {
|
|
23
25
|
const { t } = useTranslation(meta.id);
|
|
24
26
|
const selectedFunctionValue = useFormValues(FunctionInputEditor.displayName, ['function' as JsonPath]);
|
|
25
|
-
const selectedFunctionId = useMemo(() => {
|
|
26
|
-
if (Ref.isRef(selectedFunctionValue)) {
|
|
27
|
-
return selectedFunctionValue.dxn.toString().split('dxn:echo:@:').at(1);
|
|
28
|
-
}
|
|
29
|
-
}, [selectedFunctionValue]);
|
|
30
|
-
|
|
31
27
|
const selectedFunction = useMemo(
|
|
32
|
-
() =>
|
|
33
|
-
[functions,
|
|
28
|
+
() => (Ref.isRef(selectedFunctionValue) ? findOperationByUri(functions, selectedFunctionValue.uri) : undefined),
|
|
29
|
+
[functions, selectedFunctionValue],
|
|
34
30
|
);
|
|
35
31
|
|
|
36
32
|
useOnTransition(
|
|
@@ -41,7 +37,7 @@ export const FunctionInputEditor = ({ type, functions, db, getValue, onValueChan
|
|
|
41
37
|
return false;
|
|
42
38
|
}
|
|
43
39
|
|
|
44
|
-
return prevValue.
|
|
40
|
+
return prevValue.uri !== selectedFunctionValue.uri;
|
|
45
41
|
},
|
|
46
42
|
(currValue) => currValue !== undefined,
|
|
47
43
|
() => onValueChange(type, {}),
|
|
@@ -68,7 +64,7 @@ export const FunctionInputEditor = ({ type, functions, db, getValue, onValueChan
|
|
|
68
64
|
|
|
69
65
|
return (
|
|
70
66
|
<>
|
|
71
|
-
<Form.Label label={t('function
|
|
67
|
+
<Form.Label label={t('function-parameters.label')} asChild />
|
|
72
68
|
<Form.Root
|
|
73
69
|
key={selectedFunction.id}
|
|
74
70
|
schema={effectSchema}
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
+
import { Trigger } from '@dxos/compute';
|
|
7
8
|
import { Filter, Query } from '@dxos/echo';
|
|
8
|
-
import { Trigger } from '@dxos/functions';
|
|
9
9
|
import { useTranslation } from '@dxos/react-ui';
|
|
10
10
|
import { type FormFieldComponentProps, SelectField, useFormFieldState } from '@dxos/react-ui-form';
|
|
11
11
|
|
|
12
|
-
import { meta } from '
|
|
12
|
+
import { meta } from '#meta';
|
|
13
13
|
|
|
14
14
|
export type SpecSelectorProps = FormFieldComponentProps;
|
|
15
15
|
|
|
@@ -22,20 +22,15 @@ export const SpecSelector = (props: SpecSelectorProps) => {
|
|
|
22
22
|
const getDefaultTriggerSpec = (kind: string) => {
|
|
23
23
|
switch (kind) {
|
|
24
24
|
case 'timer':
|
|
25
|
-
return
|
|
25
|
+
return Trigger.specTimer('');
|
|
26
26
|
case 'subscription':
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
ast: Query.select(Filter.nothing()).ast,
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
case 'queue':
|
|
34
|
-
return { kind: 'queue', queue: 'dxn:queue:default' };
|
|
27
|
+
return Trigger.specSubscription(Query.select(Filter.nothing()));
|
|
28
|
+
case 'feed':
|
|
29
|
+
return { kind: 'feed' } satisfies Trigger.FeedSpec;
|
|
35
30
|
case 'email':
|
|
36
|
-
return
|
|
31
|
+
return Trigger.specEmail();
|
|
37
32
|
case 'webhook':
|
|
38
|
-
return
|
|
33
|
+
return Trigger.specWebhook();
|
|
39
34
|
default:
|
|
40
35
|
return undefined;
|
|
41
36
|
}
|
|
@@ -52,11 +47,20 @@ export const SpecSelector = (props: SpecSelectorProps) => {
|
|
|
52
47
|
[props.type, specProps],
|
|
53
48
|
);
|
|
54
49
|
|
|
50
|
+
const kindLabels: Record<string, string> = {
|
|
51
|
+
timer: t('trigger-type.timer.label'),
|
|
52
|
+
webhook: t('trigger-type.webhook.label'),
|
|
53
|
+
websocket: t('trigger-type.websocket.label'),
|
|
54
|
+
subscription: t('trigger-type.subscription.label'),
|
|
55
|
+
email: t('trigger-type.email.label'),
|
|
56
|
+
feed: t('trigger-type.feed.label'),
|
|
57
|
+
};
|
|
58
|
+
|
|
55
59
|
const options = useMemo(
|
|
56
60
|
() =>
|
|
57
61
|
Trigger.Kinds.map((kind) => ({
|
|
58
62
|
value: kind,
|
|
59
|
-
label:
|
|
63
|
+
label: kindLabels[kind],
|
|
60
64
|
})),
|
|
61
65
|
[t],
|
|
62
66
|
);
|
|
@@ -6,28 +6,28 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
|
6
6
|
import React, { useState } from 'react';
|
|
7
7
|
import { expect, userEvent, within } from 'storybook/test';
|
|
8
8
|
|
|
9
|
+
import { Operation, Trigger } from '@dxos/compute';
|
|
9
10
|
import { Filter, Obj, Ref, Tag, Type } from '@dxos/echo';
|
|
10
|
-
import { Function, Trigger } from '@dxos/functions';
|
|
11
11
|
import { invariant } from '@dxos/invariant';
|
|
12
|
-
import {
|
|
12
|
+
import { random } from '@dxos/random';
|
|
13
13
|
import { useQuery } from '@dxos/react-client/echo';
|
|
14
14
|
import { TestSchema, useClientStory, withClientProvider } from '@dxos/react-client/testing';
|
|
15
15
|
import { useAsyncEffect } from '@dxos/react-ui';
|
|
16
|
+
import { translations as formTranslations } from '@dxos/react-ui-form/translations';
|
|
16
17
|
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
17
|
-
import { translations as formTranslations } from '@dxos/react-ui-form';
|
|
18
18
|
import { Employer, Organization, Person, Pipeline } from '@dxos/types';
|
|
19
19
|
|
|
20
|
-
import { functions } from '
|
|
21
|
-
import { translations } from '
|
|
20
|
+
import { functions, registryFunctions } from '#testing';
|
|
21
|
+
import { translations } from '#translations';
|
|
22
22
|
|
|
23
23
|
import { TriggerEditor, type TriggerEditorProps } from './TriggerEditor';
|
|
24
24
|
|
|
25
25
|
const types = [
|
|
26
26
|
// TODO(burdon): Get label from annotation.
|
|
27
|
-
{ value: Organization.Organization
|
|
28
|
-
{ value: Person.Person
|
|
27
|
+
{ value: Type.getTypename(Organization.Organization), label: 'Organization' },
|
|
28
|
+
{ value: Type.getTypename(Person.Person), label: 'Person' },
|
|
29
29
|
{ value: Type.getTypename(Pipeline.Pipeline), label: 'Project' },
|
|
30
|
-
{ value: Employer.Employer
|
|
30
|
+
{ value: Type.getTypename(Employer.Employer), label: 'Employer' },
|
|
31
31
|
];
|
|
32
32
|
|
|
33
33
|
const DefaultStory = (props: Partial<TriggerEditorProps>) => {
|
|
@@ -40,13 +40,13 @@ const DefaultStory = (props: Partial<TriggerEditorProps>) => {
|
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
const functions = await space.db.query(Filter.type(
|
|
44
|
-
const fn = functions.find((fn) => fn.name === 'example.
|
|
43
|
+
const functions = await space.db.query(Filter.type(Operation.PersistentOperation)).run();
|
|
44
|
+
const fn = functions.find((fn) => fn.name === 'com.example.function.forex');
|
|
45
45
|
invariant(fn);
|
|
46
46
|
const trigger = space.db.add(
|
|
47
47
|
Trigger.make({
|
|
48
48
|
function: Ref.make(fn),
|
|
49
|
-
spec:
|
|
49
|
+
spec: Trigger.specWebhook(),
|
|
50
50
|
input: {
|
|
51
51
|
from: 'USD',
|
|
52
52
|
to: 'JPY',
|
|
@@ -82,23 +82,39 @@ const meta = {
|
|
|
82
82
|
withClientProvider({
|
|
83
83
|
createIdentity: true,
|
|
84
84
|
createSpace: true,
|
|
85
|
-
types: [Tag.Tag,
|
|
85
|
+
types: [Tag.Tag, Operation.PersistentOperation, Trigger.Trigger, TestSchema.ContactType],
|
|
86
86
|
onCreateSpace: ({ space }) => {
|
|
87
87
|
// Tags.
|
|
88
88
|
['Important', 'Investor', 'New'].forEach((label) => {
|
|
89
89
|
space.db.add(Tag.make({ label }));
|
|
90
90
|
});
|
|
91
91
|
|
|
92
|
-
// Functions.
|
|
92
|
+
// Functions in the local space.
|
|
93
93
|
functions.forEach((fn) => {
|
|
94
|
-
|
|
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
|
+
);
|
|
95
101
|
});
|
|
96
102
|
|
|
103
|
+
// Functions in the registry (simulate built-in / plugin-provided operations).
|
|
104
|
+
space.db.registry.add(
|
|
105
|
+
registryFunctions.map(({ key, version, ...data }) =>
|
|
106
|
+
Obj.make(Operation.PersistentOperation, {
|
|
107
|
+
[Obj.Meta]: { key, version: version ?? '0.1.0' },
|
|
108
|
+
...data,
|
|
109
|
+
}),
|
|
110
|
+
),
|
|
111
|
+
);
|
|
112
|
+
|
|
97
113
|
// Objects.
|
|
98
114
|
Array.from({ length: 10 }).map(() => {
|
|
99
115
|
return space.db.add(
|
|
100
116
|
Obj.make(TestSchema.ContactType, {
|
|
101
|
-
name:
|
|
117
|
+
name: random.person.fullName(),
|
|
102
118
|
identifiers: [],
|
|
103
119
|
}),
|
|
104
120
|
);
|
|
@@ -159,8 +175,10 @@ export const Spec: Story = {
|
|
|
159
175
|
await expect(combobox).not.toBeDisabled();
|
|
160
176
|
await expect(canvas.queryByLabelText('Method')).not.toBeInTheDocument();
|
|
161
177
|
|
|
162
|
-
//
|
|
163
|
-
|
|
164
|
-
await
|
|
178
|
+
// Feed — should show the Feed selector field (a Ref(Feed) combobox). The combobox
|
|
179
|
+
// isn't associated with its label, so match the field's <label> element directly.
|
|
180
|
+
await selectKind(combobox, 'f');
|
|
181
|
+
await expect(combobox).not.toBeDisabled();
|
|
182
|
+
await expect(await canvas.findByText('Feed', { selector: 'label' })).toBeInTheDocument();
|
|
165
183
|
},
|
|
166
184
|
};
|