@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
|
@@ -1,25 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
ComputeRuntime
|
|
3
|
-
} from "../chunk-3P4R5WNC.mjs";
|
|
4
|
-
import {
|
|
5
|
-
AutomationEvents
|
|
6
|
-
} from "../chunk-WOBCY2FQ.mjs";
|
|
7
|
-
import {
|
|
8
|
-
meta
|
|
9
|
-
} from "../chunk-PZNBEKO5.mjs";
|
|
1
|
+
import "./chunk-J5LGTIGS.mjs";
|
|
10
2
|
|
|
11
|
-
// src/
|
|
12
|
-
import { Plugin } from "@dxos/app-framework";
|
|
3
|
+
// src/AutomationPlugin.node.ts
|
|
4
|
+
import { ActivationEvent, ActivationEvents, Plugin } from "@dxos/app-framework";
|
|
13
5
|
import { AppPlugin } from "@dxos/app-toolkit";
|
|
14
|
-
import {
|
|
6
|
+
import { Operation as Operation8, Trace, Trigger as Trigger10 } from "@dxos/compute";
|
|
7
|
+
import { ClientEvents } from "@dxos/plugin-client";
|
|
8
|
+
import { AppGraphBuilder, LayerSpecs, OperationHandler, RegistrySync, TriggerRuntimeController } from "#capabilities";
|
|
9
|
+
import { meta } from "#meta";
|
|
15
10
|
|
|
16
|
-
// src/
|
|
11
|
+
// src/commands/trigger/index.ts
|
|
17
12
|
import * as Command11 from "@effect/cli/Command";
|
|
18
13
|
|
|
19
|
-
// src/
|
|
14
|
+
// src/commands/trigger/create/index.ts
|
|
20
15
|
import * as Command4 from "@effect/cli/Command";
|
|
21
16
|
|
|
22
|
-
// src/
|
|
17
|
+
// src/commands/trigger/create/queue.ts
|
|
23
18
|
import * as Command from "@effect/cli/Command";
|
|
24
19
|
import * as Options2 from "@effect/cli/Options";
|
|
25
20
|
import * as Prompt2 from "@effect/cli/Prompt";
|
|
@@ -30,13 +25,12 @@ import * as Option2 from "effect/Option";
|
|
|
30
25
|
import { CommandConfig } from "@dxos/cli-util";
|
|
31
26
|
import { flushAndSync, print, spaceLayer, withTypes } from "@dxos/cli-util";
|
|
32
27
|
import { Common } from "@dxos/cli-util";
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
28
|
+
import { Operation as Operation2, Trigger as Trigger2 } from "@dxos/compute";
|
|
29
|
+
import { Database as Database2, Feed as FeedNs, Filter as Filter2, JsonSchema, Ref as Ref2 } from "@dxos/echo";
|
|
30
|
+
import { EID } from "@dxos/keys";
|
|
35
31
|
|
|
36
|
-
// src/
|
|
32
|
+
// src/commands/trigger/options.ts
|
|
37
33
|
import * as Options from "@effect/cli/Options";
|
|
38
|
-
import * as Schema from "effect/Schema";
|
|
39
|
-
import { DXN } from "@dxos/keys";
|
|
40
34
|
var TriggerId = Options.text("id").pipe(Options.withDescription("The id of the trigger."));
|
|
41
35
|
var Enabled = Options.boolean("enabled", {
|
|
42
36
|
ifPresent: true
|
|
@@ -48,13 +42,9 @@ var Deep = Options.boolean("deep", {
|
|
|
48
42
|
}).pipe(Options.withDescription("Watch changes to nested properties (not just creation)."));
|
|
49
43
|
var Delay = Options.integer("delay").pipe(Options.withDescription("Debounce changes with a delay in milliseconds."));
|
|
50
44
|
var Cron = Options.text("cron").pipe(Options.withDescription("The cron expression to use for the timer trigger."));
|
|
51
|
-
var
|
|
52
|
-
decode: (value2) => DXN.parse(value2),
|
|
53
|
-
encode: (value2) => value2.toString()
|
|
54
|
-
}));
|
|
55
|
-
var Queue = Options.text("queue").pipe(Options.withDescription("The DXN of the queue for the queue trigger."), Options.withSchema(DXNSchema));
|
|
45
|
+
var Feed = Options.text("feed").pipe(Options.withDescription("The EID of the feed for the feed trigger (echo://<spaceId>/<objectId>)."));
|
|
56
46
|
|
|
57
|
-
// src/
|
|
47
|
+
// src/commands/trigger/util.ts
|
|
58
48
|
import * as Prompt from "@effect/cli/Prompt";
|
|
59
49
|
import * as Ansi from "@effect/printer-ansi/Ansi";
|
|
60
50
|
import * as Console from "effect/Console";
|
|
@@ -63,10 +53,10 @@ import * as Match from "effect/Match";
|
|
|
63
53
|
import * as Option from "effect/Option";
|
|
64
54
|
import * as SchemaAST from "effect/SchemaAST";
|
|
65
55
|
import { FormBuilder } from "@dxos/cli-util";
|
|
66
|
-
import {
|
|
56
|
+
import { Operation, Trigger } from "@dxos/compute";
|
|
57
|
+
import { Annotation, Database, Entity, Feed as Feed2, Filter, Obj, Query, Ref, Scope, Type } from "@dxos/echo";
|
|
67
58
|
import { getProperties } from "@dxos/effect";
|
|
68
|
-
import {
|
|
69
|
-
import { QueueAnnotation } from "@dxos/schema";
|
|
59
|
+
import { FeedAnnotation } from "@dxos/schema";
|
|
70
60
|
var getTriggerRemoteStatus = (trigger2, remoteCronIds) => {
|
|
71
61
|
if (trigger2.spec?.kind !== "timer") {
|
|
72
62
|
return "n/a";
|
|
@@ -77,7 +67,7 @@ var printTrigger = Effect.fn(function* (trigger2, remoteStatus) {
|
|
|
77
67
|
const fn6 = trigger2.function && (yield* Database.load(trigger2.function));
|
|
78
68
|
return FormBuilder.make({
|
|
79
69
|
title: trigger2.id
|
|
80
|
-
}).pipe(FormBuilder.set("status", trigger2.enabled ? "enabled" : "disabled", trigger2.enabled ? Ansi.green : Ansi.blackBright), FormBuilder.option("kind", Option.fromNullable(trigger2.spec?.kind)), FormBuilder.option("remote", Option.fromNullable(remoteStatus), Match.type().pipe(Match.withReturnType(), Match.when("available", () => Ansi.green), Match.when("not available", () => Ansi.yellow), Match.when("n/a", () => Ansi.blackBright), Match.exhaustive)), FormBuilder.when(fn6, FormBuilder.nest("function", FormBuilder.make().pipe(FormBuilder.set("key", fn6.key), FormBuilder.set("dxn",
|
|
70
|
+
}).pipe(FormBuilder.set("status", trigger2.enabled ? "enabled" : "disabled", trigger2.enabled ? Ansi.green : Ansi.blackBright), FormBuilder.option("kind", Option.fromNullable(trigger2.spec?.kind)), FormBuilder.option("remote", Option.fromNullable(remoteStatus), Match.type().pipe(Match.withReturnType(), Match.when("available", () => Ansi.green), Match.when("not available", () => Ansi.yellow), Match.when("n/a", () => Ansi.blackBright), Match.exhaustive)), FormBuilder.when(fn6, FormBuilder.nest("function", FormBuilder.make().pipe(FormBuilder.set("key", Obj.getMeta(fn6).key), FormBuilder.set("dxn", Obj.getURI(fn6))))), FormBuilder.nestedOption("spec", Option.fromNullable(trigger2.spec).pipe(Option.map(printSpec))), FormBuilder.build);
|
|
81
71
|
});
|
|
82
72
|
var printSpec = (spec) => {
|
|
83
73
|
switch (spec.kind) {
|
|
@@ -87,8 +77,8 @@ var printSpec = (spec) => {
|
|
|
87
77
|
return printSubscription(spec);
|
|
88
78
|
case "webhook":
|
|
89
79
|
return printWebhook(spec);
|
|
90
|
-
case "
|
|
91
|
-
return
|
|
80
|
+
case "feed":
|
|
81
|
+
return printFeed(spec);
|
|
92
82
|
default:
|
|
93
83
|
return FormBuilder.make({}).pipe(FormBuilder.set("unknown", "Unknown spec type"));
|
|
94
84
|
}
|
|
@@ -96,7 +86,7 @@ var printSpec = (spec) => {
|
|
|
96
86
|
var printTimer = (spec) => FormBuilder.make({}).pipe(FormBuilder.set("cron", spec.cron));
|
|
97
87
|
var printSubscription = (spec) => FormBuilder.make({}).pipe(FormBuilder.set("query", spec.query?.raw ?? "[Query AST]"));
|
|
98
88
|
var printWebhook = (spec) => FormBuilder.make({}).pipe(FormBuilder.set("method", spec.method), FormBuilder.set("port", spec.port));
|
|
99
|
-
var
|
|
89
|
+
var printFeed = (spec) => FormBuilder.make({}).pipe(FormBuilder.set("feed", spec.feed ? spec.feed.uri.toString() : "(none)"));
|
|
100
90
|
var promptForSchemaInput = Effect.fn(function* (schema, defaults) {
|
|
101
91
|
if (!schema) {
|
|
102
92
|
return {};
|
|
@@ -229,7 +219,7 @@ var promptForSchemaInput = Effect.fn(function* (schema, defaults) {
|
|
|
229
219
|
return inputObj;
|
|
230
220
|
});
|
|
231
221
|
var selectFunction = Effect.fn(function* () {
|
|
232
|
-
const functions = yield* Database.runQuery(Filter.type(
|
|
222
|
+
const functions = yield* Database.runQuery(Filter.type(Operation.PersistentOperation));
|
|
233
223
|
if (functions.length === 0) {
|
|
234
224
|
return yield* Effect.fail(new Error("No functions available"));
|
|
235
225
|
}
|
|
@@ -244,14 +234,14 @@ var selectFunction = Effect.fn(function* () {
|
|
|
244
234
|
return String(selected);
|
|
245
235
|
});
|
|
246
236
|
var selectTrigger = Effect.fn(function* (kind) {
|
|
247
|
-
const triggers = yield* Database.runQuery(Filter.type(Trigger.Trigger));
|
|
237
|
+
const triggers = yield* Database.runQuery(Query.select(Filter.type(Trigger.Trigger)).debugLabel("cli.trigger.selectTrigger"));
|
|
248
238
|
const filteredTriggers = kind ? triggers.filter((trigger2) => trigger2.spec?.kind === kind) : triggers;
|
|
249
239
|
if (filteredTriggers.length === 0) {
|
|
250
240
|
return yield* Effect.fail(new Error(kind ? `No ${kind} triggers available` : "No triggers available"));
|
|
251
241
|
}
|
|
252
242
|
const choices = yield* Effect.all(filteredTriggers.map((trigger2) => Effect.gen(function* () {
|
|
253
243
|
const fn6 = trigger2.function ? yield* Database.load(trigger2.function) : void 0;
|
|
254
|
-
const functionName = fn6 && Obj.instanceOf(
|
|
244
|
+
const functionName = fn6 && Obj.instanceOf(Operation.PersistentOperation, fn6) ? fn6.name ?? Obj.getMeta(fn6).key ?? fn6.id : void 0;
|
|
255
245
|
const title = functionName ?? trigger2.id;
|
|
256
246
|
const description = `${trigger2.enabled ? "enabled" : "disabled"} - ${trigger2.spec?.kind ?? "unknown"}`;
|
|
257
247
|
return {
|
|
@@ -266,60 +256,59 @@ var selectTrigger = Effect.fn(function* (kind) {
|
|
|
266
256
|
});
|
|
267
257
|
return String(selected);
|
|
268
258
|
});
|
|
269
|
-
var
|
|
270
|
-
const schemas = yield* Database.
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
]
|
|
275
|
-
});
|
|
276
|
-
const queueSchemas = schemas.filter((schema) => {
|
|
277
|
-
const annotation = QueueAnnotation.get(schema);
|
|
259
|
+
var selectFeed = Effect.fn(function* () {
|
|
260
|
+
const schemas = yield* Database.runQuery(Query.select(Filter.type(Type.Type)).from(Scope.space(), Scope.registry()));
|
|
261
|
+
const feedSchemas = schemas.filter((type2) => {
|
|
262
|
+
const schema = Type.getSchema(type2);
|
|
263
|
+
const annotation = FeedAnnotation.get(schema);
|
|
278
264
|
return Option.isSome(annotation) && annotation.value === true;
|
|
279
265
|
});
|
|
280
|
-
if (
|
|
281
|
-
return yield* Effect.fail(new Error("No schemas with
|
|
266
|
+
if (feedSchemas.length === 0) {
|
|
267
|
+
return yield* Effect.fail(new Error("No schemas with Feed annotation found"));
|
|
282
268
|
}
|
|
283
|
-
const
|
|
284
|
-
for (const schema of
|
|
269
|
+
const feedChoices = [];
|
|
270
|
+
for (const schema of feedSchemas) {
|
|
285
271
|
yield* Effect.gen(function* () {
|
|
286
272
|
const typename = Type.getTypename(schema);
|
|
287
273
|
const objects = yield* Database.runQuery(Filter.type(typename));
|
|
288
274
|
for (const obj of objects) {
|
|
289
|
-
const
|
|
290
|
-
if (!
|
|
275
|
+
const feedRef = obj.feed;
|
|
276
|
+
if (!feedRef) {
|
|
277
|
+
continue;
|
|
278
|
+
}
|
|
279
|
+
const feedObj = yield* Effect.promise(() => feedRef.tryLoad());
|
|
280
|
+
if (!feedObj || !Obj.instanceOf(Feed2.Feed, feedObj)) {
|
|
291
281
|
continue;
|
|
292
282
|
}
|
|
293
|
-
const queueDxn = queueRef.dxn.toString();
|
|
294
283
|
const label = Obj.getLabel(obj) ?? obj.id;
|
|
295
284
|
const description = Obj.getTypename(obj);
|
|
296
|
-
|
|
285
|
+
feedChoices.push({
|
|
297
286
|
title: label,
|
|
298
|
-
value:
|
|
287
|
+
value: feedObj,
|
|
299
288
|
description
|
|
300
289
|
});
|
|
301
290
|
}
|
|
302
291
|
}).pipe(Effect.catchAll(() => Effect.void));
|
|
303
292
|
}
|
|
304
|
-
if (
|
|
305
|
-
return yield* Effect.fail(new Error("No objects with
|
|
293
|
+
if (feedChoices.length === 0) {
|
|
294
|
+
return yield* Effect.fail(new Error("No objects with feed properties found"));
|
|
306
295
|
}
|
|
307
296
|
const selected = yield* Prompt.select({
|
|
308
|
-
message: "Select a
|
|
309
|
-
choices:
|
|
297
|
+
message: "Select a feed:",
|
|
298
|
+
choices: feedChoices
|
|
310
299
|
});
|
|
311
|
-
return
|
|
300
|
+
return selected;
|
|
312
301
|
});
|
|
313
302
|
var printTriggerRemoved = (id) => FormBuilder.make({
|
|
314
303
|
title: "Trigger removed"
|
|
315
304
|
}).pipe(FormBuilder.set("id", id), FormBuilder.build);
|
|
316
305
|
|
|
317
|
-
// src/
|
|
318
|
-
var queue = Command.make("
|
|
306
|
+
// src/commands/trigger/create/queue.ts
|
|
307
|
+
var queue = Command.make("feed", {
|
|
319
308
|
spaceId: Common.spaceId.pipe(Options2.optional),
|
|
320
309
|
enabled: Enabled,
|
|
321
310
|
functionId: Common.functionId.pipe(Options2.optional),
|
|
322
|
-
|
|
311
|
+
feed: Feed.pipe(Options2.optional),
|
|
323
312
|
input: Input.pipe(Options2.optional)
|
|
324
313
|
}, (options) => Effect2.gen(function* () {
|
|
325
314
|
const { json } = yield* CommandConfig;
|
|
@@ -327,14 +316,14 @@ var queue = Command.make("queue", {
|
|
|
327
316
|
onNone: () => selectFunction(),
|
|
328
317
|
onSome: (id) => Effect2.succeed(id)
|
|
329
318
|
});
|
|
330
|
-
const functions = yield* Database2.runQuery(Filter2.type(
|
|
319
|
+
const functions = yield* Database2.runQuery(Filter2.type(Operation2.PersistentOperation));
|
|
331
320
|
const fn6 = functions.find((fn7) => fn7.id === functionId);
|
|
332
321
|
if (!fn6) {
|
|
333
322
|
return yield* Effect2.fail(new Error(`Function not found: ${functionId}`));
|
|
334
323
|
}
|
|
335
|
-
const
|
|
336
|
-
onNone: () =>
|
|
337
|
-
onSome: (
|
|
324
|
+
const feed = yield* Option2.match(options.feed, {
|
|
325
|
+
onNone: () => selectFeed(),
|
|
326
|
+
onSome: (uri) => Database2.resolve(EID.parse(uri), FeedNs.Feed)
|
|
338
327
|
});
|
|
339
328
|
const input = yield* Option2.match(options.input, {
|
|
340
329
|
onNone: () => promptForSchemaInput(fn6.inputSchema ? JsonSchema.toEffectSchema(fn6.inputSchema) : void 0),
|
|
@@ -350,10 +339,7 @@ var queue = Command.make("queue", {
|
|
|
350
339
|
const trigger2 = Trigger2.make({
|
|
351
340
|
function: Ref2.make(fn6),
|
|
352
341
|
enabled,
|
|
353
|
-
spec:
|
|
354
|
-
kind: "queue",
|
|
355
|
-
queue: queueDxn
|
|
356
|
-
},
|
|
342
|
+
spec: Trigger2.specFeed(feed),
|
|
357
343
|
input
|
|
358
344
|
});
|
|
359
345
|
yield* Database2.add(trigger2);
|
|
@@ -365,9 +351,9 @@ var queue = Command.make("queue", {
|
|
|
365
351
|
yield* flushAndSync({
|
|
366
352
|
indexes: true
|
|
367
353
|
});
|
|
368
|
-
})).pipe(Command.withDescription("Create a
|
|
354
|
+
})).pipe(Command.withDescription("Create a feed trigger."), Command.provide(({ spaceId }) => spaceLayer(spaceId, true)), Command.provideEffectDiscard(() => withTypes(Operation2.PersistentOperation, Trigger2.Trigger)));
|
|
369
355
|
|
|
370
|
-
// src/
|
|
356
|
+
// src/commands/trigger/create/subscription.ts
|
|
371
357
|
import * as Command2 from "@effect/cli/Command";
|
|
372
358
|
import * as Options3 from "@effect/cli/Options";
|
|
373
359
|
import * as Prompt3 from "@effect/cli/Prompt";
|
|
@@ -378,8 +364,8 @@ import * as Option3 from "effect/Option";
|
|
|
378
364
|
import { CommandConfig as CommandConfig2 } from "@dxos/cli-util";
|
|
379
365
|
import { flushAndSync as flushAndSync2, print as print2, spaceLayer as spaceLayer2, withTypes as withTypes2 } from "@dxos/cli-util";
|
|
380
366
|
import { Common as Common2 } from "@dxos/cli-util";
|
|
381
|
-
import {
|
|
382
|
-
import {
|
|
367
|
+
import { Operation as Operation3, Trigger as Trigger3 } from "@dxos/compute";
|
|
368
|
+
import { Database as Database3, Filter as Filter3, JsonSchema as JsonSchema2, Query as Query2, Ref as Ref3 } from "@dxos/echo";
|
|
383
369
|
var subscription = Command2.make("subscription", {
|
|
384
370
|
spaceId: Common2.spaceId.pipe(Options3.optional),
|
|
385
371
|
enabled: Enabled,
|
|
@@ -394,7 +380,7 @@ var subscription = Command2.make("subscription", {
|
|
|
394
380
|
onNone: () => selectFunction(),
|
|
395
381
|
onSome: (id) => Effect3.succeed(id)
|
|
396
382
|
});
|
|
397
|
-
const functions = yield* Database3.runQuery(Filter3.type(
|
|
383
|
+
const functions = yield* Database3.runQuery(Filter3.type(Operation3.PersistentOperation));
|
|
398
384
|
const fn6 = functions.find((fn7) => fn7.id === functionId);
|
|
399
385
|
if (!fn6) {
|
|
400
386
|
return yield* Effect3.fail(new Error(`Function not found: ${functionId}`));
|
|
@@ -405,7 +391,7 @@ var subscription = Command2.make("subscription", {
|
|
|
405
391
|
}).pipe(Prompt3.run),
|
|
406
392
|
onSome: (value2) => Effect3.succeed(value2)
|
|
407
393
|
});
|
|
408
|
-
const
|
|
394
|
+
const subscriptionQuery = Query2.select(Filter3.type(typename));
|
|
409
395
|
const deepOption = yield* Option3.match(options.deep, {
|
|
410
396
|
onNone: () => Prompt3.confirm({
|
|
411
397
|
message: "Watch changes to nested properties (deep)?",
|
|
@@ -443,13 +429,7 @@ var subscription = Command2.make("subscription", {
|
|
|
443
429
|
const trigger2 = Trigger3.make({
|
|
444
430
|
function: Ref3.make(fn6),
|
|
445
431
|
enabled,
|
|
446
|
-
spec:
|
|
447
|
-
kind: "subscription",
|
|
448
|
-
query: {
|
|
449
|
-
ast: queryAst
|
|
450
|
-
},
|
|
451
|
-
options: Object.keys(subscriptionOptions).length > 0 ? subscriptionOptions : void 0
|
|
452
|
-
},
|
|
432
|
+
spec: Trigger3.specSubscription(subscriptionQuery, Object.keys(subscriptionOptions).length > 0 ? subscriptionOptions : void 0),
|
|
453
433
|
input
|
|
454
434
|
});
|
|
455
435
|
yield* Database3.add(trigger2);
|
|
@@ -461,9 +441,9 @@ var subscription = Command2.make("subscription", {
|
|
|
461
441
|
yield* flushAndSync2({
|
|
462
442
|
indexes: true
|
|
463
443
|
});
|
|
464
|
-
})).pipe(Command2.withDescription("Create a subscription trigger."), Command2.provide(({ spaceId }) => spaceLayer2(spaceId, true)), Command2.provideEffectDiscard(() => withTypes2(
|
|
444
|
+
})).pipe(Command2.withDescription("Create a subscription trigger."), Command2.provide(({ spaceId }) => spaceLayer2(spaceId, true)), Command2.provideEffectDiscard(() => withTypes2(Operation3.PersistentOperation, Trigger3.Trigger)));
|
|
465
445
|
|
|
466
|
-
// src/
|
|
446
|
+
// src/commands/trigger/create/timer.ts
|
|
467
447
|
import * as Command3 from "@effect/cli/Command";
|
|
468
448
|
import * as Options4 from "@effect/cli/Options";
|
|
469
449
|
import * as Prompt4 from "@effect/cli/Prompt";
|
|
@@ -474,8 +454,8 @@ import * as Option4 from "effect/Option";
|
|
|
474
454
|
import { CommandConfig as CommandConfig3 } from "@dxos/cli-util";
|
|
475
455
|
import { flushAndSync as flushAndSync3, print as print3, spaceLayer as spaceLayer3, withTypes as withTypes3 } from "@dxos/cli-util";
|
|
476
456
|
import { Common as Common3 } from "@dxos/cli-util";
|
|
457
|
+
import { Operation as Operation4, Trigger as Trigger4 } from "@dxos/compute";
|
|
477
458
|
import { Database as Database4, Filter as Filter4, JsonSchema as JsonSchema3, Ref as Ref4 } from "@dxos/echo";
|
|
478
|
-
import { Function as Function4, Trigger as Trigger4 } from "@dxos/functions";
|
|
479
459
|
var timer = Command3.make("timer", {
|
|
480
460
|
spaceId: Common3.spaceId.pipe(Options4.optional),
|
|
481
461
|
enabled: Enabled,
|
|
@@ -488,7 +468,7 @@ var timer = Command3.make("timer", {
|
|
|
488
468
|
onNone: () => selectFunction(),
|
|
489
469
|
onSome: (id) => Effect4.succeed(id)
|
|
490
470
|
});
|
|
491
|
-
const functions = yield* Database4.runQuery(Filter4.type(
|
|
471
|
+
const functions = yield* Database4.runQuery(Filter4.type(Operation4.PersistentOperation));
|
|
492
472
|
const fn6 = functions.find((fn7) => fn7.id === functionId);
|
|
493
473
|
if (!fn6) {
|
|
494
474
|
return yield* Effect4.fail(new Error(`Function not found: ${functionId}`));
|
|
@@ -513,10 +493,7 @@ var timer = Command3.make("timer", {
|
|
|
513
493
|
const trigger2 = Trigger4.make({
|
|
514
494
|
function: Ref4.make(fn6),
|
|
515
495
|
enabled,
|
|
516
|
-
spec:
|
|
517
|
-
kind: "timer",
|
|
518
|
-
cron
|
|
519
|
-
},
|
|
496
|
+
spec: Trigger4.specTimer(cron),
|
|
520
497
|
input
|
|
521
498
|
});
|
|
522
499
|
yield* Database4.add(trigger2);
|
|
@@ -528,33 +505,35 @@ var timer = Command3.make("timer", {
|
|
|
528
505
|
yield* flushAndSync3({
|
|
529
506
|
indexes: true
|
|
530
507
|
});
|
|
531
|
-
})).pipe(Command3.withDescription("Create a timer trigger."), Command3.provide(({ spaceId }) => spaceLayer3(spaceId, true)), Command3.provideEffectDiscard(() => withTypes3(
|
|
508
|
+
})).pipe(Command3.withDescription("Create a timer trigger."), Command3.provide(({ spaceId }) => spaceLayer3(spaceId, true)), Command3.provideEffectDiscard(() => withTypes3(Operation4.PersistentOperation, Trigger4.Trigger)));
|
|
532
509
|
|
|
533
|
-
// src/
|
|
510
|
+
// src/commands/trigger/create/index.ts
|
|
534
511
|
var create = Command4.make("create").pipe(Command4.withDescription("Create a trigger."), Command4.withSubcommands([
|
|
535
512
|
subscription,
|
|
536
513
|
timer,
|
|
537
514
|
queue
|
|
538
515
|
]));
|
|
539
516
|
|
|
540
|
-
// src/
|
|
517
|
+
// src/commands/trigger/list.ts
|
|
541
518
|
import * as Command5 from "@effect/cli/Command";
|
|
542
519
|
import * as Options5 from "@effect/cli/Options";
|
|
543
520
|
import * as Console5 from "effect/Console";
|
|
544
521
|
import * as Effect5 from "effect/Effect";
|
|
545
522
|
import { CommandConfig as CommandConfig4, Common as Common4, printList, spaceIdWithDefault, spaceLayer as spaceLayer4 } from "@dxos/cli-util";
|
|
546
523
|
import { ClientService } from "@dxos/client";
|
|
547
|
-
import {
|
|
548
|
-
import {
|
|
524
|
+
import { Trigger as Trigger5 } from "@dxos/compute";
|
|
525
|
+
import { Context } from "@dxos/context";
|
|
526
|
+
import { Database as Database5, Filter as Filter5, Query as Query3 } from "@dxos/echo";
|
|
527
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-automation/src/commands/trigger/list.ts";
|
|
549
528
|
var list = Command5.make("list", {
|
|
550
529
|
spaceId: Common4.spaceId.pipe(Options5.optional)
|
|
551
530
|
}, Effect5.fn(function* ({ spaceId: spaceIdOption }) {
|
|
552
531
|
const { json } = yield* CommandConfig4;
|
|
553
|
-
const triggers = yield* Database5.runQuery(Filter5.type(Trigger5.Trigger));
|
|
532
|
+
const triggers = yield* Database5.runQuery(Query3.select(Filter5.type(Trigger5.Trigger)).debugLabel("cli.trigger.list"));
|
|
554
533
|
const remoteCronIds = yield* Effect5.gen(function* () {
|
|
555
534
|
const client = yield* ClientService;
|
|
556
535
|
const spaceId = yield* spaceIdWithDefault(spaceIdOption);
|
|
557
|
-
const result = yield* Effect5.promise(() => client.edge.http.getCronTriggers(spaceId)).pipe(Effect5.catchAll(() => Effect5.succeed({
|
|
536
|
+
const result = yield* Effect5.promise(() => client.edge.http.getCronTriggers(Context.default(void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 24 }), spaceId)).pipe(Effect5.catchAll(() => Effect5.succeed({
|
|
558
537
|
cronIds: []
|
|
559
538
|
})));
|
|
560
539
|
return result.cronIds;
|
|
@@ -578,16 +557,16 @@ var list = Command5.make("list", {
|
|
|
578
557
|
}
|
|
579
558
|
})).pipe(Command5.withDescription("List triggers configured on EDGE."), Command5.provide(({ spaceId }) => spaceLayer4(spaceId, true)));
|
|
580
559
|
|
|
581
|
-
// src/
|
|
560
|
+
// src/commands/trigger/remove.ts
|
|
582
561
|
import * as Command6 from "@effect/cli/Command";
|
|
583
562
|
import * as Options6 from "@effect/cli/Options";
|
|
584
563
|
import * as Console6 from "effect/Console";
|
|
585
564
|
import * as Effect6 from "effect/Effect";
|
|
586
565
|
import * as Option5 from "effect/Option";
|
|
587
566
|
import { CommandConfig as CommandConfig5, Common as Common5, print as print4, spaceLayer as spaceLayer5, withTypes as withTypes4 } from "@dxos/cli-util";
|
|
588
|
-
import {
|
|
589
|
-
import { Database as Database6 } from "@dxos/echo";
|
|
590
|
-
import {
|
|
567
|
+
import { Trigger as Trigger6 } from "@dxos/compute";
|
|
568
|
+
import { Database as Database6, Ref as Ref5 } from "@dxos/echo";
|
|
569
|
+
import { EID as EID2 } from "@dxos/keys";
|
|
591
570
|
var remove = Command6.make("remove", {
|
|
592
571
|
spaceId: Common5.spaceId.pipe(Options6.optional),
|
|
593
572
|
id: TriggerId.pipe(Options6.optional)
|
|
@@ -597,8 +576,10 @@ var remove = Command6.make("remove", {
|
|
|
597
576
|
onNone: () => selectTrigger(),
|
|
598
577
|
onSome: (id) => Effect6.succeed(id)
|
|
599
578
|
});
|
|
600
|
-
const dxn =
|
|
601
|
-
|
|
579
|
+
const dxn = EID2.make({
|
|
580
|
+
entityId: triggerId
|
|
581
|
+
});
|
|
582
|
+
const trigger2 = yield* Database6.resolve(Ref5.fromURI(dxn), Trigger6.Trigger);
|
|
602
583
|
yield* Database6.remove(trigger2);
|
|
603
584
|
if (json) {
|
|
604
585
|
yield* Console6.log(JSON.stringify({
|
|
@@ -610,10 +591,10 @@ var remove = Command6.make("remove", {
|
|
|
610
591
|
}
|
|
611
592
|
})).pipe(Command6.withDescription("Remove a trigger."), Command6.provide(({ spaceId }) => spaceLayer5(spaceId, true)), Command6.provideEffectDiscard(() => withTypes4(Trigger6.Trigger)));
|
|
612
593
|
|
|
613
|
-
// src/
|
|
594
|
+
// src/commands/trigger/update/index.ts
|
|
614
595
|
import * as Command10 from "@effect/cli/Command";
|
|
615
596
|
|
|
616
|
-
// src/
|
|
597
|
+
// src/commands/trigger/update/queue.ts
|
|
617
598
|
import * as Command7 from "@effect/cli/Command";
|
|
618
599
|
import * as Options7 from "@effect/cli/Options";
|
|
619
600
|
import * as Prompt5 from "@effect/cli/Prompt";
|
|
@@ -623,28 +604,31 @@ import * as Option6 from "effect/Option";
|
|
|
623
604
|
import { CommandConfig as CommandConfig6 } from "@dxos/cli-util";
|
|
624
605
|
import { flushAndSync as flushAndSync4, print as print5, spaceLayer as spaceLayer6, withTypes as withTypes5 } from "@dxos/cli-util";
|
|
625
606
|
import { Common as Common6 } from "@dxos/cli-util";
|
|
626
|
-
import {
|
|
627
|
-
import {
|
|
628
|
-
|
|
607
|
+
import { Operation as Operation5, Trigger as Trigger7 } from "@dxos/compute";
|
|
608
|
+
import { Database as Database7, Feed as FeedNs2, Filter as Filter6, JsonSchema as JsonSchema4, Obj as Obj2, Ref as Ref6 } from "@dxos/echo";
|
|
609
|
+
import { EID as EID3 } from "@dxos/keys";
|
|
610
|
+
var queue2 = Command7.make("feed", {
|
|
629
611
|
spaceId: Common6.spaceId.pipe(Options7.optional),
|
|
630
612
|
id: TriggerId.pipe(Options7.optional),
|
|
631
613
|
enabled: Enabled,
|
|
632
614
|
functionId: Common6.functionId.pipe(Options7.optional),
|
|
633
|
-
|
|
615
|
+
feed: Feed.pipe(Options7.optional),
|
|
634
616
|
input: Input.pipe(Options7.optional)
|
|
635
617
|
}, (options) => Effect7.gen(function* () {
|
|
636
618
|
const { json } = yield* CommandConfig6;
|
|
637
619
|
const triggerId = yield* Option6.match(options.id, {
|
|
638
|
-
onNone: () => selectTrigger("
|
|
620
|
+
onNone: () => selectTrigger("feed"),
|
|
639
621
|
onSome: (id) => Effect7.succeed(id)
|
|
640
622
|
});
|
|
641
|
-
const dxn =
|
|
623
|
+
const dxn = EID3.make({
|
|
624
|
+
entityId: triggerId
|
|
625
|
+
});
|
|
642
626
|
const trigger2 = yield* Database7.resolve(dxn, Trigger7.Trigger);
|
|
643
|
-
if (trigger2.spec?.kind !== "
|
|
627
|
+
if (trigger2.spec?.kind !== "feed") {
|
|
644
628
|
return yield* Effect7.fail(new Error(`Invalid trigger type: ${trigger2.spec?.kind}`));
|
|
645
629
|
}
|
|
646
630
|
const currentFn = yield* updateFunction(trigger2, options.functionId);
|
|
647
|
-
yield*
|
|
631
|
+
yield* updateFeed(trigger2, options.feed);
|
|
648
632
|
yield* updateInput(trigger2, currentFn, options.input);
|
|
649
633
|
yield* updateEnabled(trigger2, options.id, options.enabled);
|
|
650
634
|
if (json) {
|
|
@@ -655,10 +639,10 @@ var queue2 = Command7.make("queue", {
|
|
|
655
639
|
yield* flushAndSync4({
|
|
656
640
|
indexes: true
|
|
657
641
|
});
|
|
658
|
-
})).pipe(Command7.withDescription("Update a
|
|
642
|
+
})).pipe(Command7.withDescription("Update a feed trigger."), Command7.provide(({ spaceId }) => spaceLayer6(spaceId, true)), Command7.provideEffectDiscard(() => withTypes5(Operation5.PersistentOperation, Trigger7.Trigger)));
|
|
659
643
|
var updateFunction = Effect7.fn(function* (trigger2, functionIdOption) {
|
|
660
644
|
let currentFn = trigger2.function ? yield* Database7.load(trigger2.function) : void 0;
|
|
661
|
-
if (currentFn && !Obj2.instanceOf(
|
|
645
|
+
if (currentFn && !Obj2.instanceOf(Operation5.PersistentOperation, currentFn)) {
|
|
662
646
|
currentFn = void 0;
|
|
663
647
|
}
|
|
664
648
|
const currentFunctionName = currentFn ? currentFn.name ?? currentFn.id : void 0;
|
|
@@ -674,40 +658,40 @@ var updateFunction = Effect7.fn(function* (trigger2, functionIdOption) {
|
|
|
674
658
|
onNone: () => selectFunction(),
|
|
675
659
|
onSome: (id) => Effect7.succeed(id)
|
|
676
660
|
});
|
|
677
|
-
const functions = yield* Database7.runQuery(Filter6.type(
|
|
661
|
+
const functions = yield* Database7.runQuery(Filter6.type(Operation5.PersistentOperation));
|
|
678
662
|
const foundFn = functions.find((fn6) => fn6.id === functionId);
|
|
679
|
-
if (!foundFn || !Obj2.instanceOf(
|
|
663
|
+
if (!foundFn || !Obj2.instanceOf(Operation5.PersistentOperation, foundFn)) {
|
|
680
664
|
return yield* Effect7.fail(new Error(`Function not found: ${functionId}`));
|
|
681
665
|
}
|
|
682
|
-
Obj2.
|
|
683
|
-
|
|
666
|
+
Obj2.update(trigger2, (trigger3) => {
|
|
667
|
+
trigger3.function = Ref6.make(foundFn);
|
|
684
668
|
});
|
|
685
669
|
currentFn = foundFn;
|
|
686
670
|
}
|
|
687
671
|
if (!currentFn) {
|
|
688
|
-
const functionId = trigger2.function
|
|
672
|
+
const functionId = (trigger2.function ? trigger2.function.uri.toString() : void 0) ?? "unknown";
|
|
689
673
|
return yield* Effect7.fail(new Error(`Invalid reference for ${functionId}`));
|
|
690
674
|
}
|
|
691
675
|
return currentFn;
|
|
692
676
|
});
|
|
693
|
-
var
|
|
694
|
-
const
|
|
695
|
-
const
|
|
696
|
-
const
|
|
677
|
+
var updateFeed = Effect7.fn(function* (trigger2, feedOption) {
|
|
678
|
+
const currentFeed = trigger2.spec?.kind === "feed" ? trigger2.spec.feed : void 0;
|
|
679
|
+
const currentFeedStr = currentFeed ? currentFeed.uri.toString() : void 0;
|
|
680
|
+
const shouldChangeFeed = yield* Option6.match(feedOption, {
|
|
697
681
|
onNone: () => Prompt5.confirm({
|
|
698
|
-
message: `Change the
|
|
682
|
+
message: `Change the feed${currentFeedStr ? ` (current: ${currentFeedStr})` : ""}?`,
|
|
699
683
|
initial: false
|
|
700
684
|
}).pipe(Prompt5.run),
|
|
701
685
|
onSome: () => Effect7.succeed(true)
|
|
702
686
|
});
|
|
703
|
-
if (
|
|
704
|
-
const
|
|
705
|
-
onNone: () =>
|
|
706
|
-
onSome: (
|
|
687
|
+
if (shouldChangeFeed) {
|
|
688
|
+
const feed = yield* Option6.match(feedOption, {
|
|
689
|
+
onNone: () => selectFeed(),
|
|
690
|
+
onSome: (uri) => Database7.resolve(EID3.parse(uri), FeedNs2.Feed)
|
|
707
691
|
});
|
|
708
|
-
Obj2.
|
|
709
|
-
if (
|
|
710
|
-
|
|
692
|
+
Obj2.update(trigger2, (trigger3) => {
|
|
693
|
+
if (trigger3.spec?.kind === "feed") {
|
|
694
|
+
trigger3.spec.feed = Ref6.make(feed);
|
|
711
695
|
}
|
|
712
696
|
});
|
|
713
697
|
}
|
|
@@ -730,8 +714,8 @@ var updateInput = Effect7.fn(function* (trigger2, fn6, inputOption) {
|
|
|
730
714
|
onNone: () => promptForSchemaInput(fn6.inputSchema ? JsonSchema4.toEffectSchema(fn6.inputSchema) : void 0, currentInput),
|
|
731
715
|
onSome: (value2) => Effect7.succeed(value2)
|
|
732
716
|
});
|
|
733
|
-
Obj2.
|
|
734
|
-
|
|
717
|
+
Obj2.update(trigger2, (trigger3) => {
|
|
718
|
+
trigger3.input = inputObj;
|
|
735
719
|
});
|
|
736
720
|
}
|
|
737
721
|
});
|
|
@@ -743,12 +727,12 @@ var updateEnabled = Effect7.fn(function* (trigger2, idOption, enabled) {
|
|
|
743
727
|
}).pipe(Prompt5.run),
|
|
744
728
|
onSome: () => Effect7.succeed(enabled)
|
|
745
729
|
});
|
|
746
|
-
Obj2.
|
|
747
|
-
|
|
730
|
+
Obj2.update(trigger2, (trigger3) => {
|
|
731
|
+
trigger3.enabled = enabledValue;
|
|
748
732
|
});
|
|
749
733
|
});
|
|
750
734
|
|
|
751
|
-
// src/
|
|
735
|
+
// src/commands/trigger/update/subscription.ts
|
|
752
736
|
import * as Command8 from "@effect/cli/Command";
|
|
753
737
|
import * as Options8 from "@effect/cli/Options";
|
|
754
738
|
import * as Prompt6 from "@effect/cli/Prompt";
|
|
@@ -759,8 +743,9 @@ import * as Option7 from "effect/Option";
|
|
|
759
743
|
import { CommandConfig as CommandConfig7 } from "@dxos/cli-util";
|
|
760
744
|
import { flushAndSync as flushAndSync5, print as print6, spaceLayer as spaceLayer7, withTypes as withTypes6 } from "@dxos/cli-util";
|
|
761
745
|
import { Common as Common7 } from "@dxos/cli-util";
|
|
762
|
-
import {
|
|
763
|
-
import {
|
|
746
|
+
import { Operation as Operation6, Trigger as Trigger8 } from "@dxos/compute";
|
|
747
|
+
import { Database as Database8, Filter as Filter7, JsonSchema as JsonSchema5, Obj as Obj3, Query as Query4, Ref as Ref7 } from "@dxos/echo";
|
|
748
|
+
import { DXN, EID as EID4 } from "@dxos/keys";
|
|
764
749
|
var subscription2 = Command8.make("subscription", {
|
|
765
750
|
spaceId: Common7.spaceId.pipe(Options8.optional),
|
|
766
751
|
id: TriggerId.pipe(Options8.optional),
|
|
@@ -776,8 +761,10 @@ var subscription2 = Command8.make("subscription", {
|
|
|
776
761
|
onNone: () => selectTrigger("subscription"),
|
|
777
762
|
onSome: (id) => Effect8.succeed(id)
|
|
778
763
|
});
|
|
779
|
-
const dxn =
|
|
780
|
-
|
|
764
|
+
const dxn = EID4.make({
|
|
765
|
+
entityId: triggerId
|
|
766
|
+
});
|
|
767
|
+
const trigger2 = yield* Database8.resolve(Ref7.fromURI(dxn), Trigger8.Trigger);
|
|
781
768
|
if (trigger2.spec?.kind !== "subscription") {
|
|
782
769
|
return yield* Effect8.fail(new Error(`Invalid trigger type: ${trigger2.spec?.kind}`));
|
|
783
770
|
}
|
|
@@ -793,7 +780,7 @@ var subscription2 = Command8.make("subscription", {
|
|
|
793
780
|
yield* flushAndSync5({
|
|
794
781
|
indexes: true
|
|
795
782
|
});
|
|
796
|
-
})).pipe(Command8.withDescription("Update a subscription trigger."), Command8.provide(({ spaceId }) => spaceLayer7(spaceId, true)), Command8.provideEffectDiscard(() => withTypes6(
|
|
783
|
+
})).pipe(Command8.withDescription("Update a subscription trigger."), Command8.provide(({ spaceId }) => spaceLayer7(spaceId, true)), Command8.provideEffectDiscard(() => withTypes6(Operation6.PersistentOperation, Trigger8.Trigger)));
|
|
797
784
|
var extractCurrentTypename = (spec) => {
|
|
798
785
|
if (!spec?.query?.ast) {
|
|
799
786
|
return Option7.none();
|
|
@@ -802,11 +789,11 @@ var extractCurrentTypename = (spec) => {
|
|
|
802
789
|
type: "select"
|
|
803
790
|
}, (q) => Match2.value(q.filter).pipe(Match2.withReturnType(), Match2.when({
|
|
804
791
|
type: "object"
|
|
805
|
-
}, (f) => Option7.fromNullable(f.typename).pipe(Option7.flatMap((dxn) => Option7.fromNullable(
|
|
792
|
+
}, (f) => Option7.fromNullable(f.typename).pipe(Option7.flatMap((dxn) => Option7.fromNullable(DXN.isDXN(dxn) ? DXN.getName(dxn) : void 0)))), Match2.orElse(() => Option7.none()))), Match2.orElse(() => Option7.none()));
|
|
806
793
|
};
|
|
807
794
|
var updateFunction2 = Effect8.fn(function* (trigger2, functionIdOption) {
|
|
808
795
|
let currentFn = trigger2.function ? yield* Database8.load(trigger2.function) : void 0;
|
|
809
|
-
if (currentFn && !Obj3.instanceOf(
|
|
796
|
+
if (currentFn && !Obj3.instanceOf(Operation6.PersistentOperation, currentFn)) {
|
|
810
797
|
currentFn = void 0;
|
|
811
798
|
}
|
|
812
799
|
const currentFunctionName = currentFn ? currentFn.name ?? currentFn.id : void 0;
|
|
@@ -822,18 +809,18 @@ var updateFunction2 = Effect8.fn(function* (trigger2, functionIdOption) {
|
|
|
822
809
|
onNone: () => selectFunction(),
|
|
823
810
|
onSome: (id) => Effect8.succeed(id)
|
|
824
811
|
});
|
|
825
|
-
const functions = yield* Database8.runQuery(Filter7.type(
|
|
812
|
+
const functions = yield* Database8.runQuery(Filter7.type(Operation6.PersistentOperation));
|
|
826
813
|
const foundFn = functions.find((fn6) => fn6.id === functionId);
|
|
827
|
-
if (!foundFn || !Obj3.instanceOf(
|
|
814
|
+
if (!foundFn || !Obj3.instanceOf(Operation6.PersistentOperation, foundFn)) {
|
|
828
815
|
return yield* Effect8.fail(new Error(`Function not found: ${functionId}`));
|
|
829
816
|
}
|
|
830
|
-
Obj3.
|
|
831
|
-
|
|
817
|
+
Obj3.update(trigger2, (trigger3) => {
|
|
818
|
+
trigger3.function = Ref7.make(foundFn);
|
|
832
819
|
});
|
|
833
820
|
currentFn = foundFn;
|
|
834
821
|
}
|
|
835
822
|
if (!currentFn) {
|
|
836
|
-
const functionId = trigger2.function
|
|
823
|
+
const functionId = (trigger2.function ? EID4.getEntityId(EID4.tryParse(trigger2.function.uri)) : void 0) ?? "unknown";
|
|
837
824
|
return yield* Effect8.fail(new Error(`Invalid reference for ${functionId}`));
|
|
838
825
|
}
|
|
839
826
|
return currentFn;
|
|
@@ -867,7 +854,7 @@ var updateSpec = Effect8.fn(function* (trigger2, typenameOption, deepOption, del
|
|
|
867
854
|
}).pipe(Prompt6.run),
|
|
868
855
|
onSome: (value2) => Effect8.succeed(value2)
|
|
869
856
|
});
|
|
870
|
-
const queryAst =
|
|
857
|
+
const queryAst = Query4.select(Filter7.type(typename)).ast;
|
|
871
858
|
const deepOptionValue = yield* Option7.match(deepOption, {
|
|
872
859
|
onNone: () => Prompt6.confirm({
|
|
873
860
|
message: "Watch changes to nested properties (deep)?",
|
|
@@ -892,8 +879,8 @@ var updateSpec = Effect8.fn(function* (trigger2, typenameOption, deepOption, del
|
|
|
892
879
|
if (Option7.isSome(delayOptionValue)) {
|
|
893
880
|
subscriptionOptions.delay = delayOptionValue.value;
|
|
894
881
|
}
|
|
895
|
-
Obj3.
|
|
896
|
-
const spec =
|
|
882
|
+
Obj3.update(trigger2, (trigger3) => {
|
|
883
|
+
const spec = trigger3.spec;
|
|
897
884
|
if (spec?.kind === "subscription") {
|
|
898
885
|
spec.query = {
|
|
899
886
|
ast: queryAst
|
|
@@ -921,8 +908,8 @@ var updateInput2 = Effect8.fn(function* (trigger2, fn6, inputOption) {
|
|
|
921
908
|
onNone: () => promptForSchemaInput(fn6.inputSchema ? JsonSchema5.toEffectSchema(fn6.inputSchema) : void 0, currentInput),
|
|
922
909
|
onSome: (value2) => Effect8.succeed(value2)
|
|
923
910
|
});
|
|
924
|
-
Obj3.
|
|
925
|
-
|
|
911
|
+
Obj3.update(trigger2, (trigger3) => {
|
|
912
|
+
trigger3.input = inputObj;
|
|
926
913
|
});
|
|
927
914
|
}
|
|
928
915
|
});
|
|
@@ -934,12 +921,12 @@ var updateEnabled2 = Effect8.fn(function* (trigger2, idOption, enabled) {
|
|
|
934
921
|
}).pipe(Prompt6.run),
|
|
935
922
|
onSome: () => Effect8.succeed(enabled)
|
|
936
923
|
});
|
|
937
|
-
Obj3.
|
|
938
|
-
|
|
924
|
+
Obj3.update(trigger2, (trigger3) => {
|
|
925
|
+
trigger3.enabled = enabledValue;
|
|
939
926
|
});
|
|
940
927
|
});
|
|
941
928
|
|
|
942
|
-
// src/
|
|
929
|
+
// src/commands/trigger/update/timer.ts
|
|
943
930
|
import * as Command9 from "@effect/cli/Command";
|
|
944
931
|
import * as Options9 from "@effect/cli/Options";
|
|
945
932
|
import * as Prompt7 from "@effect/cli/Prompt";
|
|
@@ -949,8 +936,9 @@ import * as Option8 from "effect/Option";
|
|
|
949
936
|
import { CommandConfig as CommandConfig8 } from "@dxos/cli-util";
|
|
950
937
|
import { flushAndSync as flushAndSync6, print as print7, spaceLayer as spaceLayer8, withTypes as withTypes7 } from "@dxos/cli-util";
|
|
951
938
|
import { Common as Common8 } from "@dxos/cli-util";
|
|
952
|
-
import {
|
|
953
|
-
import {
|
|
939
|
+
import { Operation as Operation7, Trigger as Trigger9 } from "@dxos/compute";
|
|
940
|
+
import { Database as Database9, Filter as Filter8, JsonSchema as JsonSchema6, Obj as Obj4, Ref as Ref8 } from "@dxos/echo";
|
|
941
|
+
import { EID as EID5 } from "@dxos/keys";
|
|
954
942
|
var timer2 = Command9.make("timer", {
|
|
955
943
|
spaceId: Common8.spaceId.pipe(Options9.optional),
|
|
956
944
|
id: TriggerId.pipe(Options9.optional),
|
|
@@ -964,8 +952,10 @@ var timer2 = Command9.make("timer", {
|
|
|
964
952
|
onNone: () => selectTrigger("timer"),
|
|
965
953
|
onSome: (id) => Effect9.succeed(id)
|
|
966
954
|
});
|
|
967
|
-
const dxn =
|
|
968
|
-
|
|
955
|
+
const dxn = EID5.make({
|
|
956
|
+
entityId: triggerId
|
|
957
|
+
});
|
|
958
|
+
const trigger2 = yield* Database9.resolve(Ref8.fromURI(dxn), Trigger9.Trigger);
|
|
969
959
|
if (!trigger2.spec || trigger2.spec?.kind !== "timer") {
|
|
970
960
|
return yield* Effect9.fail(new Error(`Invalid trigger type: ${trigger2.spec?.kind}`));
|
|
971
961
|
}
|
|
@@ -981,10 +971,10 @@ var timer2 = Command9.make("timer", {
|
|
|
981
971
|
yield* flushAndSync6({
|
|
982
972
|
indexes: true
|
|
983
973
|
});
|
|
984
|
-
})).pipe(Command9.withDescription("Update a timer trigger."), Command9.provide(({ spaceId }) => spaceLayer8(spaceId, true)), Command9.provideEffectDiscard(() => withTypes7(
|
|
974
|
+
})).pipe(Command9.withDescription("Update a timer trigger."), Command9.provide(({ spaceId }) => spaceLayer8(spaceId, true)), Command9.provideEffectDiscard(() => withTypes7(Operation7.PersistentOperation, Trigger9.Trigger)));
|
|
985
975
|
var updateFunction3 = Effect9.fn(function* (trigger2, functionIdOption) {
|
|
986
976
|
let currentFn = trigger2.function ? yield* Database9.load(trigger2.function) : void 0;
|
|
987
|
-
if (currentFn && !Obj4.instanceOf(
|
|
977
|
+
if (currentFn && !Obj4.instanceOf(Operation7.PersistentOperation, currentFn)) {
|
|
988
978
|
currentFn = void 0;
|
|
989
979
|
}
|
|
990
980
|
const currentFunctionName = currentFn ? currentFn.name ?? currentFn.id : void 0;
|
|
@@ -1000,18 +990,18 @@ var updateFunction3 = Effect9.fn(function* (trigger2, functionIdOption) {
|
|
|
1000
990
|
onNone: () => selectFunction(),
|
|
1001
991
|
onSome: (id) => Effect9.succeed(id)
|
|
1002
992
|
});
|
|
1003
|
-
const functions = yield* Database9.runQuery(Filter8.type(
|
|
993
|
+
const functions = yield* Database9.runQuery(Filter8.type(Operation7.PersistentOperation));
|
|
1004
994
|
const foundFn = functions.find((fn6) => fn6.id === functionId);
|
|
1005
|
-
if (!foundFn || !Obj4.instanceOf(
|
|
995
|
+
if (!foundFn || !Obj4.instanceOf(Operation7.PersistentOperation, foundFn)) {
|
|
1006
996
|
return yield* Effect9.fail(new Error(`Function not found: ${functionId}`));
|
|
1007
997
|
}
|
|
1008
|
-
Obj4.
|
|
1009
|
-
|
|
998
|
+
Obj4.update(trigger2, (trigger3) => {
|
|
999
|
+
trigger3.function = Ref8.make(foundFn);
|
|
1010
1000
|
});
|
|
1011
1001
|
currentFn = foundFn;
|
|
1012
1002
|
}
|
|
1013
1003
|
if (!currentFn) {
|
|
1014
|
-
const functionId = trigger2.function
|
|
1004
|
+
const functionId = (trigger2.function ? EID5.getEntityId(EID5.tryParse(trigger2.function.uri)) : void 0) ?? "unknown";
|
|
1015
1005
|
return yield* Effect9.fail(new Error(`Invalid reference for ${functionId}`));
|
|
1016
1006
|
}
|
|
1017
1007
|
return currentFn;
|
|
@@ -1032,9 +1022,9 @@ var updateCron = Effect9.fn(function* (trigger2, cronOption) {
|
|
|
1032
1022
|
}).pipe(Prompt7.run),
|
|
1033
1023
|
onSome: (value2) => Effect9.succeed(value2)
|
|
1034
1024
|
});
|
|
1035
|
-
Obj4.
|
|
1036
|
-
if (
|
|
1037
|
-
|
|
1025
|
+
Obj4.update(trigger2, (trigger3) => {
|
|
1026
|
+
if (trigger3.spec?.kind === "timer") {
|
|
1027
|
+
trigger3.spec.cron = cron;
|
|
1038
1028
|
}
|
|
1039
1029
|
});
|
|
1040
1030
|
}
|
|
@@ -1057,8 +1047,8 @@ var updateInput3 = Effect9.fn(function* (trigger2, fn6, inputOption) {
|
|
|
1057
1047
|
onNone: () => promptForSchemaInput(fn6.inputSchema ? JsonSchema6.toEffectSchema(fn6.inputSchema) : void 0, currentInput),
|
|
1058
1048
|
onSome: (value2) => Effect9.succeed(value2)
|
|
1059
1049
|
});
|
|
1060
|
-
Obj4.
|
|
1061
|
-
|
|
1050
|
+
Obj4.update(trigger2, (trigger3) => {
|
|
1051
|
+
trigger3.input = inputObj;
|
|
1062
1052
|
});
|
|
1063
1053
|
}
|
|
1064
1054
|
});
|
|
@@ -1070,19 +1060,19 @@ var updateEnabled3 = Effect9.fn(function* (trigger2, idOption, enabled) {
|
|
|
1070
1060
|
}).pipe(Prompt7.run),
|
|
1071
1061
|
onSome: () => Effect9.succeed(enabled)
|
|
1072
1062
|
});
|
|
1073
|
-
Obj4.
|
|
1074
|
-
|
|
1063
|
+
Obj4.update(trigger2, (trigger3) => {
|
|
1064
|
+
trigger3.enabled = enabledValue;
|
|
1075
1065
|
});
|
|
1076
1066
|
});
|
|
1077
1067
|
|
|
1078
|
-
// src/
|
|
1068
|
+
// src/commands/trigger/update/index.ts
|
|
1079
1069
|
var update = Command10.make("update").pipe(Command10.withDescription("Update a trigger."), Command10.withSubcommands([
|
|
1080
1070
|
subscription2,
|
|
1081
1071
|
timer2,
|
|
1082
1072
|
queue2
|
|
1083
1073
|
]));
|
|
1084
1074
|
|
|
1085
|
-
// src/
|
|
1075
|
+
// src/commands/trigger/index.ts
|
|
1086
1076
|
var trigger = Command11.make("trigger").pipe(Command11.withDescription("Manage EDGE triggers."), Command11.withSubcommands([
|
|
1087
1077
|
create,
|
|
1088
1078
|
list,
|
|
@@ -1090,19 +1080,34 @@ var trigger = Command11.make("trigger").pipe(Command11.withDescription("Manage E
|
|
|
1090
1080
|
update
|
|
1091
1081
|
]));
|
|
1092
1082
|
|
|
1093
|
-
// src/
|
|
1094
|
-
var AutomationPlugin = Plugin.define(meta).pipe(AppPlugin.
|
|
1083
|
+
// src/AutomationPlugin.node.ts
|
|
1084
|
+
var AutomationPlugin = Plugin.define(meta).pipe(AppPlugin.addAppGraphModule({
|
|
1085
|
+
activate: AppGraphBuilder
|
|
1086
|
+
}), AppPlugin.addCommandModule({
|
|
1095
1087
|
commands: [
|
|
1096
1088
|
trigger
|
|
1097
1089
|
]
|
|
1090
|
+
}), AppPlugin.addOperationHandlerModule({
|
|
1091
|
+
activate: OperationHandler
|
|
1092
|
+
}), AppPlugin.addSchemaModule({
|
|
1093
|
+
schema: [
|
|
1094
|
+
Operation8.PersistentOperation,
|
|
1095
|
+
Trigger10.Trigger,
|
|
1096
|
+
Trace.Message
|
|
1097
|
+
]
|
|
1098
|
+
}), Plugin.addModule({
|
|
1099
|
+
activatesOn: ActivationEvents.SetupProcessManager,
|
|
1100
|
+
activate: LayerSpecs
|
|
1098
1101
|
}), Plugin.addModule({
|
|
1099
1102
|
activatesOn: ClientEvents.ClientReady,
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
activate:
|
|
1103
|
+
activate: RegistrySync
|
|
1104
|
+
}), Plugin.addModule({
|
|
1105
|
+
activatesOn: ActivationEvent.allOf(ActivationEvents.ProcessManagerReady, ClientEvents.SpacesReady),
|
|
1106
|
+
activate: TriggerRuntimeController
|
|
1104
1107
|
}), Plugin.make);
|
|
1108
|
+
var AutomationPlugin_node_default = AutomationPlugin;
|
|
1105
1109
|
export {
|
|
1106
|
-
AutomationPlugin
|
|
1110
|
+
AutomationPlugin,
|
|
1111
|
+
AutomationPlugin_node_default as default
|
|
1107
1112
|
};
|
|
1108
|
-
//# sourceMappingURL=
|
|
1113
|
+
//# sourceMappingURL=AutomationPlugin.node.mjs.map
|