@dxos/plugin-automation 0.8.4-main.d05673bc65 → 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} +181 -183
- 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-75XLBFAG.mjs → neutral/FunctionsPanel-L32Z67B7.mjs} +22 -22
- package/dist/lib/neutral/FunctionsPanel-L32Z67B7.mjs.map +7 -0
- package/dist/lib/{browser/chunk-FUVAC5EC.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-BWEKRPFJ.mjs → neutral/chunk-RCBE37YU.mjs} +150 -76
- 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/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/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 +9 -30
- 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/react-surface.tsx → react-surface.tsx} +17 -15
- 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 +36 -30
- package/src/components/AutomationPanel/AutomationPanel.stories.tsx +12 -5
- package/src/components/AutomationPanel/AutomationPanel.tsx +119 -56
- package/src/components/AutomationPanel/TriggerEdgeMetadata.tsx +148 -0
- package/src/components/FunctionsPanel/FunctionsPanel.tsx +33 -25
- 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 +109 -31
- package/src/components/TriggerEditor/util.ts +51 -0
- package/src/containers/AutomationSettings/AutomationSettings.tsx +11 -7
- 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/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 +3 -24
- package/src/vite-env.d.ts +10 -0
- package/dist/lib/browser/AutomationPanel-IGLIQY2N.mjs +0 -11
- package/dist/lib/browser/AutomationSettings-EDO3N5WI.mjs +0 -37
- package/dist/lib/browser/AutomationSettings-EDO3N5WI.mjs.map +0 -7
- package/dist/lib/browser/FunctionsContainer-R4ZMYSFJ.mjs +0 -43
- package/dist/lib/browser/FunctionsContainer-R4ZMYSFJ.mjs.map +0 -7
- package/dist/lib/browser/FunctionsPanel-NMA4RYJL.mjs +0 -10
- package/dist/lib/browser/FunctionsRegistry-TMKAEG5E.mjs +0 -10
- package/dist/lib/browser/TriggerSettings-56AIMOEC.mjs +0 -11
- package/dist/lib/browser/app-graph-builder-74ILZP25.mjs +0 -83
- package/dist/lib/browser/app-graph-builder-74ILZP25.mjs.map +0 -7
- package/dist/lib/browser/chunk-75XLBFAG.mjs.map +0 -7
- package/dist/lib/browser/chunk-BWEKRPFJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-EL64ZPPN.mjs +0 -17
- package/dist/lib/browser/chunk-EL64ZPPN.mjs.map +0 -7
- package/dist/lib/browser/chunk-FUVAC5EC.mjs.map +0 -7
- package/dist/lib/browser/chunk-GVHAETEQ.mjs +0 -83
- package/dist/lib/browser/chunk-GVHAETEQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-H2MV4XE6.mjs +0 -31
- package/dist/lib/browser/chunk-H2MV4XE6.mjs.map +0 -7
- package/dist/lib/browser/chunk-O23LHDEX.mjs +0 -269
- package/dist/lib/browser/chunk-O23LHDEX.mjs.map +0 -7
- package/dist/lib/browser/chunk-OAZ2JYXV.mjs +0 -93
- package/dist/lib/browser/chunk-OAZ2JYXV.mjs.map +0 -7
- package/dist/lib/browser/chunk-Z7F7X2C5.mjs +0 -8
- package/dist/lib/browser/chunk-Z7F7X2C5.mjs.map +0 -7
- package/dist/lib/browser/cli/index.mjs.map +0 -7
- package/dist/lib/browser/compute-runtime-F3UMRKCL.mjs +0 -124
- package/dist/lib/browser/compute-runtime-F3UMRKCL.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-IRC2DZU7.mjs +0 -84
- package/dist/lib/browser/operation-resolver-IRC2DZU7.mjs.map +0 -7
- package/dist/lib/browser/react-surface-5MFPVWIN.mjs +0 -65
- package/dist/lib/browser/react-surface-5MFPVWIN.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -14
- package/dist/lib/node-esm/AutomationPanel-O2BCQA7P.mjs +0 -12
- package/dist/lib/node-esm/AutomationSettings-LJNRQUX7.mjs +0 -38
- package/dist/lib/node-esm/AutomationSettings-LJNRQUX7.mjs.map +0 -7
- package/dist/lib/node-esm/FunctionsContainer-GYRPQZM7.mjs +0 -44
- package/dist/lib/node-esm/FunctionsContainer-GYRPQZM7.mjs.map +0 -7
- package/dist/lib/node-esm/FunctionsPanel-DCXXLSVP.mjs +0 -11
- package/dist/lib/node-esm/FunctionsRegistry-7WCHC64E.mjs +0 -11
- package/dist/lib/node-esm/TriggerSettings-ONY5ZUKW.mjs +0 -12
- package/dist/lib/node-esm/TriggerSettings-ONY5ZUKW.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-VDXPOWCH.mjs +0 -84
- package/dist/lib/node-esm/app-graph-builder-VDXPOWCH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2UF55HSG.mjs +0 -94
- package/dist/lib/node-esm/chunk-2UF55HSG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6B4WZRVH.mjs +0 -84
- package/dist/lib/node-esm/chunk-6B4WZRVH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6JVB3IHW.mjs +0 -97
- package/dist/lib/node-esm/chunk-6JVB3IHW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FPXVLTEY.mjs +0 -270
- package/dist/lib/node-esm/chunk-FPXVLTEY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-JVUE5PMI.mjs +0 -32
- package/dist/lib/node-esm/chunk-JVUE5PMI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-K7T2MVB7.mjs +0 -98
- package/dist/lib/node-esm/chunk-K7T2MVB7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Q5JSKD6Z.mjs +0 -295
- package/dist/lib/node-esm/chunk-Q5JSKD6Z.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-R5YEWJCG.mjs +0 -10
- package/dist/lib/node-esm/chunk-R5YEWJCG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WC5AT7B3.mjs +0 -19
- package/dist/lib/node-esm/chunk-WC5AT7B3.mjs.map +0 -7
- package/dist/lib/node-esm/cli/index.mjs +0 -1116
- package/dist/lib/node-esm/cli/index.mjs.map +0 -7
- package/dist/lib/node-esm/compute-runtime-AMFVJMF2.mjs +0 -125
- package/dist/lib/node-esm/compute-runtime-AMFVJMF2.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-CBLQHL4N.mjs +0 -85
- package/dist/lib/node-esm/operation-resolver-CBLQHL4N.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-Z74AHU4T.mjs +0 -66
- package/dist/lib/node-esm/react-surface-Z74AHU4T.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 -73
- 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/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-IGLIQY2N.mjs.map → neutral/AutomationPanel-OKF2MDLO.mjs.map} +0 -0
- /package/dist/lib/{browser/FunctionsPanel-NMA4RYJL.mjs.map → neutral/AutomationPlugin.mjs.map} +0 -0
- /package/dist/lib/{browser/FunctionsRegistry-TMKAEG5E.mjs.map → neutral/TriggerSettings-XCHIZPOR.mjs.map} +0 -0
- /package/dist/lib/{browser/TriggerSettings-56AIMOEC.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/{browser/hooks → neutral/components}/index.mjs.map +0 -0
- /package/dist/lib/{browser/types → neutral/hooks}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/hooks → neutral}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/AutomationPanel-O2BCQA7P.mjs.map → neutral/meta.mjs.map} +0 -0
- /package/dist/lib/{node-esm/types → neutral/operations}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/FunctionsPanel-DCXXLSVP.mjs.map → neutral/testing.mjs.map} +0 -0
- /package/dist/lib/{node-esm/FunctionsRegistry-7WCHC64E.mjs.map → neutral/types/index.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-Z7F7X2C5.mjs";
|
|
4
|
-
import {
|
|
5
|
-
AutomationEvents
|
|
6
|
-
} from "../chunk-GVHAETEQ.mjs";
|
|
7
|
-
import {
|
|
8
|
-
meta
|
|
9
|
-
} from "../chunk-EL64ZPPN.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,9 +53,9 @@ 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 { Function, Trigger } from "@dxos/functions";
|
|
69
59
|
import { FeedAnnotation } from "@dxos/schema";
|
|
70
60
|
var getTriggerRemoteStatus = (trigger2, remoteCronIds) => {
|
|
71
61
|
if (trigger2.spec?.kind !== "timer") {
|
|
@@ -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,21 +256,17 @@ 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
|
-
"runtime"
|
|
274
|
-
]
|
|
275
|
-
});
|
|
276
|
-
const feedSchemas = schemas.filter((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);
|
|
277
263
|
const annotation = FeedAnnotation.get(schema);
|
|
278
264
|
return Option.isSome(annotation) && annotation.value === true;
|
|
279
265
|
});
|
|
280
266
|
if (feedSchemas.length === 0) {
|
|
281
267
|
return yield* Effect.fail(new Error("No schemas with Feed annotation found"));
|
|
282
268
|
}
|
|
283
|
-
const
|
|
269
|
+
const feedChoices = [];
|
|
284
270
|
for (const schema of feedSchemas) {
|
|
285
271
|
yield* Effect.gen(function* () {
|
|
286
272
|
const typename = Type.getTypename(schema);
|
|
@@ -291,42 +277,38 @@ var selectQueue = Effect.fn(function* () {
|
|
|
291
277
|
continue;
|
|
292
278
|
}
|
|
293
279
|
const feedObj = yield* Effect.promise(() => feedRef.tryLoad());
|
|
294
|
-
if (!feedObj || !Obj.instanceOf(
|
|
295
|
-
continue;
|
|
296
|
-
}
|
|
297
|
-
const queueDxn = Feed.getQueueDxn(feedObj);
|
|
298
|
-
if (!queueDxn) {
|
|
280
|
+
if (!feedObj || !Obj.instanceOf(Feed2.Feed, feedObj)) {
|
|
299
281
|
continue;
|
|
300
282
|
}
|
|
301
283
|
const label = Obj.getLabel(obj) ?? obj.id;
|
|
302
284
|
const description = Obj.getTypename(obj);
|
|
303
|
-
|
|
285
|
+
feedChoices.push({
|
|
304
286
|
title: label,
|
|
305
|
-
value:
|
|
287
|
+
value: feedObj,
|
|
306
288
|
description
|
|
307
289
|
});
|
|
308
290
|
}
|
|
309
291
|
}).pipe(Effect.catchAll(() => Effect.void));
|
|
310
292
|
}
|
|
311
|
-
if (
|
|
312
|
-
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"));
|
|
313
295
|
}
|
|
314
296
|
const selected = yield* Prompt.select({
|
|
315
|
-
message: "Select a
|
|
316
|
-
choices:
|
|
297
|
+
message: "Select a feed:",
|
|
298
|
+
choices: feedChoices
|
|
317
299
|
});
|
|
318
|
-
return
|
|
300
|
+
return selected;
|
|
319
301
|
});
|
|
320
302
|
var printTriggerRemoved = (id) => FormBuilder.make({
|
|
321
303
|
title: "Trigger removed"
|
|
322
304
|
}).pipe(FormBuilder.set("id", id), FormBuilder.build);
|
|
323
305
|
|
|
324
|
-
// src/
|
|
325
|
-
var queue = Command.make("
|
|
306
|
+
// src/commands/trigger/create/queue.ts
|
|
307
|
+
var queue = Command.make("feed", {
|
|
326
308
|
spaceId: Common.spaceId.pipe(Options2.optional),
|
|
327
309
|
enabled: Enabled,
|
|
328
310
|
functionId: Common.functionId.pipe(Options2.optional),
|
|
329
|
-
|
|
311
|
+
feed: Feed.pipe(Options2.optional),
|
|
330
312
|
input: Input.pipe(Options2.optional)
|
|
331
313
|
}, (options) => Effect2.gen(function* () {
|
|
332
314
|
const { json } = yield* CommandConfig;
|
|
@@ -334,14 +316,14 @@ var queue = Command.make("queue", {
|
|
|
334
316
|
onNone: () => selectFunction(),
|
|
335
317
|
onSome: (id) => Effect2.succeed(id)
|
|
336
318
|
});
|
|
337
|
-
const functions = yield* Database2.runQuery(Filter2.type(
|
|
319
|
+
const functions = yield* Database2.runQuery(Filter2.type(Operation2.PersistentOperation));
|
|
338
320
|
const fn6 = functions.find((fn7) => fn7.id === functionId);
|
|
339
321
|
if (!fn6) {
|
|
340
322
|
return yield* Effect2.fail(new Error(`Function not found: ${functionId}`));
|
|
341
323
|
}
|
|
342
|
-
const
|
|
343
|
-
onNone: () =>
|
|
344
|
-
onSome: (
|
|
324
|
+
const feed = yield* Option2.match(options.feed, {
|
|
325
|
+
onNone: () => selectFeed(),
|
|
326
|
+
onSome: (uri) => Database2.resolve(EID.parse(uri), FeedNs.Feed)
|
|
345
327
|
});
|
|
346
328
|
const input = yield* Option2.match(options.input, {
|
|
347
329
|
onNone: () => promptForSchemaInput(fn6.inputSchema ? JsonSchema.toEffectSchema(fn6.inputSchema) : void 0),
|
|
@@ -357,10 +339,7 @@ var queue = Command.make("queue", {
|
|
|
357
339
|
const trigger2 = Trigger2.make({
|
|
358
340
|
function: Ref2.make(fn6),
|
|
359
341
|
enabled,
|
|
360
|
-
spec:
|
|
361
|
-
kind: "queue",
|
|
362
|
-
queue: queueDxn
|
|
363
|
-
},
|
|
342
|
+
spec: Trigger2.specFeed(feed),
|
|
364
343
|
input
|
|
365
344
|
});
|
|
366
345
|
yield* Database2.add(trigger2);
|
|
@@ -372,9 +351,9 @@ var queue = Command.make("queue", {
|
|
|
372
351
|
yield* flushAndSync({
|
|
373
352
|
indexes: true
|
|
374
353
|
});
|
|
375
|
-
})).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)));
|
|
376
355
|
|
|
377
|
-
// src/
|
|
356
|
+
// src/commands/trigger/create/subscription.ts
|
|
378
357
|
import * as Command2 from "@effect/cli/Command";
|
|
379
358
|
import * as Options3 from "@effect/cli/Options";
|
|
380
359
|
import * as Prompt3 from "@effect/cli/Prompt";
|
|
@@ -385,8 +364,8 @@ import * as Option3 from "effect/Option";
|
|
|
385
364
|
import { CommandConfig as CommandConfig2 } from "@dxos/cli-util";
|
|
386
365
|
import { flushAndSync as flushAndSync2, print as print2, spaceLayer as spaceLayer2, withTypes as withTypes2 } from "@dxos/cli-util";
|
|
387
366
|
import { Common as Common2 } from "@dxos/cli-util";
|
|
388
|
-
import {
|
|
389
|
-
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";
|
|
390
369
|
var subscription = Command2.make("subscription", {
|
|
391
370
|
spaceId: Common2.spaceId.pipe(Options3.optional),
|
|
392
371
|
enabled: Enabled,
|
|
@@ -401,7 +380,7 @@ var subscription = Command2.make("subscription", {
|
|
|
401
380
|
onNone: () => selectFunction(),
|
|
402
381
|
onSome: (id) => Effect3.succeed(id)
|
|
403
382
|
});
|
|
404
|
-
const functions = yield* Database3.runQuery(Filter3.type(
|
|
383
|
+
const functions = yield* Database3.runQuery(Filter3.type(Operation3.PersistentOperation));
|
|
405
384
|
const fn6 = functions.find((fn7) => fn7.id === functionId);
|
|
406
385
|
if (!fn6) {
|
|
407
386
|
return yield* Effect3.fail(new Error(`Function not found: ${functionId}`));
|
|
@@ -412,7 +391,7 @@ var subscription = Command2.make("subscription", {
|
|
|
412
391
|
}).pipe(Prompt3.run),
|
|
413
392
|
onSome: (value2) => Effect3.succeed(value2)
|
|
414
393
|
});
|
|
415
|
-
const
|
|
394
|
+
const subscriptionQuery = Query2.select(Filter3.type(typename));
|
|
416
395
|
const deepOption = yield* Option3.match(options.deep, {
|
|
417
396
|
onNone: () => Prompt3.confirm({
|
|
418
397
|
message: "Watch changes to nested properties (deep)?",
|
|
@@ -450,13 +429,7 @@ var subscription = Command2.make("subscription", {
|
|
|
450
429
|
const trigger2 = Trigger3.make({
|
|
451
430
|
function: Ref3.make(fn6),
|
|
452
431
|
enabled,
|
|
453
|
-
spec:
|
|
454
|
-
kind: "subscription",
|
|
455
|
-
query: {
|
|
456
|
-
ast: queryAst
|
|
457
|
-
},
|
|
458
|
-
options: Object.keys(subscriptionOptions).length > 0 ? subscriptionOptions : void 0
|
|
459
|
-
},
|
|
432
|
+
spec: Trigger3.specSubscription(subscriptionQuery, Object.keys(subscriptionOptions).length > 0 ? subscriptionOptions : void 0),
|
|
460
433
|
input
|
|
461
434
|
});
|
|
462
435
|
yield* Database3.add(trigger2);
|
|
@@ -468,9 +441,9 @@ var subscription = Command2.make("subscription", {
|
|
|
468
441
|
yield* flushAndSync2({
|
|
469
442
|
indexes: true
|
|
470
443
|
});
|
|
471
|
-
})).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)));
|
|
472
445
|
|
|
473
|
-
// src/
|
|
446
|
+
// src/commands/trigger/create/timer.ts
|
|
474
447
|
import * as Command3 from "@effect/cli/Command";
|
|
475
448
|
import * as Options4 from "@effect/cli/Options";
|
|
476
449
|
import * as Prompt4 from "@effect/cli/Prompt";
|
|
@@ -481,8 +454,8 @@ import * as Option4 from "effect/Option";
|
|
|
481
454
|
import { CommandConfig as CommandConfig3 } from "@dxos/cli-util";
|
|
482
455
|
import { flushAndSync as flushAndSync3, print as print3, spaceLayer as spaceLayer3, withTypes as withTypes3 } from "@dxos/cli-util";
|
|
483
456
|
import { Common as Common3 } from "@dxos/cli-util";
|
|
457
|
+
import { Operation as Operation4, Trigger as Trigger4 } from "@dxos/compute";
|
|
484
458
|
import { Database as Database4, Filter as Filter4, JsonSchema as JsonSchema3, Ref as Ref4 } from "@dxos/echo";
|
|
485
|
-
import { Function as Function4, Trigger as Trigger4 } from "@dxos/functions";
|
|
486
459
|
var timer = Command3.make("timer", {
|
|
487
460
|
spaceId: Common3.spaceId.pipe(Options4.optional),
|
|
488
461
|
enabled: Enabled,
|
|
@@ -495,7 +468,7 @@ var timer = Command3.make("timer", {
|
|
|
495
468
|
onNone: () => selectFunction(),
|
|
496
469
|
onSome: (id) => Effect4.succeed(id)
|
|
497
470
|
});
|
|
498
|
-
const functions = yield* Database4.runQuery(Filter4.type(
|
|
471
|
+
const functions = yield* Database4.runQuery(Filter4.type(Operation4.PersistentOperation));
|
|
499
472
|
const fn6 = functions.find((fn7) => fn7.id === functionId);
|
|
500
473
|
if (!fn6) {
|
|
501
474
|
return yield* Effect4.fail(new Error(`Function not found: ${functionId}`));
|
|
@@ -520,10 +493,7 @@ var timer = Command3.make("timer", {
|
|
|
520
493
|
const trigger2 = Trigger4.make({
|
|
521
494
|
function: Ref4.make(fn6),
|
|
522
495
|
enabled,
|
|
523
|
-
spec:
|
|
524
|
-
kind: "timer",
|
|
525
|
-
cron
|
|
526
|
-
},
|
|
496
|
+
spec: Trigger4.specTimer(cron),
|
|
527
497
|
input
|
|
528
498
|
});
|
|
529
499
|
yield* Database4.add(trigger2);
|
|
@@ -535,33 +505,35 @@ var timer = Command3.make("timer", {
|
|
|
535
505
|
yield* flushAndSync3({
|
|
536
506
|
indexes: true
|
|
537
507
|
});
|
|
538
|
-
})).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)));
|
|
539
509
|
|
|
540
|
-
// src/
|
|
510
|
+
// src/commands/trigger/create/index.ts
|
|
541
511
|
var create = Command4.make("create").pipe(Command4.withDescription("Create a trigger."), Command4.withSubcommands([
|
|
542
512
|
subscription,
|
|
543
513
|
timer,
|
|
544
514
|
queue
|
|
545
515
|
]));
|
|
546
516
|
|
|
547
|
-
// src/
|
|
517
|
+
// src/commands/trigger/list.ts
|
|
548
518
|
import * as Command5 from "@effect/cli/Command";
|
|
549
519
|
import * as Options5 from "@effect/cli/Options";
|
|
550
520
|
import * as Console5 from "effect/Console";
|
|
551
521
|
import * as Effect5 from "effect/Effect";
|
|
552
522
|
import { CommandConfig as CommandConfig4, Common as Common4, printList, spaceIdWithDefault, spaceLayer as spaceLayer4 } from "@dxos/cli-util";
|
|
553
523
|
import { ClientService } from "@dxos/client";
|
|
554
|
-
import {
|
|
555
|
-
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";
|
|
556
528
|
var list = Command5.make("list", {
|
|
557
529
|
spaceId: Common4.spaceId.pipe(Options5.optional)
|
|
558
530
|
}, Effect5.fn(function* ({ spaceId: spaceIdOption }) {
|
|
559
531
|
const { json } = yield* CommandConfig4;
|
|
560
|
-
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"));
|
|
561
533
|
const remoteCronIds = yield* Effect5.gen(function* () {
|
|
562
534
|
const client = yield* ClientService;
|
|
563
535
|
const spaceId = yield* spaceIdWithDefault(spaceIdOption);
|
|
564
|
-
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({
|
|
565
537
|
cronIds: []
|
|
566
538
|
})));
|
|
567
539
|
return result.cronIds;
|
|
@@ -585,16 +557,16 @@ var list = Command5.make("list", {
|
|
|
585
557
|
}
|
|
586
558
|
})).pipe(Command5.withDescription("List triggers configured on EDGE."), Command5.provide(({ spaceId }) => spaceLayer4(spaceId, true)));
|
|
587
559
|
|
|
588
|
-
// src/
|
|
560
|
+
// src/commands/trigger/remove.ts
|
|
589
561
|
import * as Command6 from "@effect/cli/Command";
|
|
590
562
|
import * as Options6 from "@effect/cli/Options";
|
|
591
563
|
import * as Console6 from "effect/Console";
|
|
592
564
|
import * as Effect6 from "effect/Effect";
|
|
593
565
|
import * as Option5 from "effect/Option";
|
|
594
566
|
import { CommandConfig as CommandConfig5, Common as Common5, print as print4, spaceLayer as spaceLayer5, withTypes as withTypes4 } from "@dxos/cli-util";
|
|
595
|
-
import {
|
|
596
|
-
import { Database as Database6 } from "@dxos/echo";
|
|
597
|
-
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";
|
|
598
570
|
var remove = Command6.make("remove", {
|
|
599
571
|
spaceId: Common5.spaceId.pipe(Options6.optional),
|
|
600
572
|
id: TriggerId.pipe(Options6.optional)
|
|
@@ -604,8 +576,10 @@ var remove = Command6.make("remove", {
|
|
|
604
576
|
onNone: () => selectTrigger(),
|
|
605
577
|
onSome: (id) => Effect6.succeed(id)
|
|
606
578
|
});
|
|
607
|
-
const dxn =
|
|
608
|
-
|
|
579
|
+
const dxn = EID2.make({
|
|
580
|
+
entityId: triggerId
|
|
581
|
+
});
|
|
582
|
+
const trigger2 = yield* Database6.resolve(Ref5.fromURI(dxn), Trigger6.Trigger);
|
|
609
583
|
yield* Database6.remove(trigger2);
|
|
610
584
|
if (json) {
|
|
611
585
|
yield* Console6.log(JSON.stringify({
|
|
@@ -617,10 +591,10 @@ var remove = Command6.make("remove", {
|
|
|
617
591
|
}
|
|
618
592
|
})).pipe(Command6.withDescription("Remove a trigger."), Command6.provide(({ spaceId }) => spaceLayer5(spaceId, true)), Command6.provideEffectDiscard(() => withTypes4(Trigger6.Trigger)));
|
|
619
593
|
|
|
620
|
-
// src/
|
|
594
|
+
// src/commands/trigger/update/index.ts
|
|
621
595
|
import * as Command10 from "@effect/cli/Command";
|
|
622
596
|
|
|
623
|
-
// src/
|
|
597
|
+
// src/commands/trigger/update/queue.ts
|
|
624
598
|
import * as Command7 from "@effect/cli/Command";
|
|
625
599
|
import * as Options7 from "@effect/cli/Options";
|
|
626
600
|
import * as Prompt5 from "@effect/cli/Prompt";
|
|
@@ -630,28 +604,31 @@ import * as Option6 from "effect/Option";
|
|
|
630
604
|
import { CommandConfig as CommandConfig6 } from "@dxos/cli-util";
|
|
631
605
|
import { flushAndSync as flushAndSync4, print as print5, spaceLayer as spaceLayer6, withTypes as withTypes5 } from "@dxos/cli-util";
|
|
632
606
|
import { Common as Common6 } from "@dxos/cli-util";
|
|
633
|
-
import {
|
|
634
|
-
import {
|
|
635
|
-
|
|
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", {
|
|
636
611
|
spaceId: Common6.spaceId.pipe(Options7.optional),
|
|
637
612
|
id: TriggerId.pipe(Options7.optional),
|
|
638
613
|
enabled: Enabled,
|
|
639
614
|
functionId: Common6.functionId.pipe(Options7.optional),
|
|
640
|
-
|
|
615
|
+
feed: Feed.pipe(Options7.optional),
|
|
641
616
|
input: Input.pipe(Options7.optional)
|
|
642
617
|
}, (options) => Effect7.gen(function* () {
|
|
643
618
|
const { json } = yield* CommandConfig6;
|
|
644
619
|
const triggerId = yield* Option6.match(options.id, {
|
|
645
|
-
onNone: () => selectTrigger("
|
|
620
|
+
onNone: () => selectTrigger("feed"),
|
|
646
621
|
onSome: (id) => Effect7.succeed(id)
|
|
647
622
|
});
|
|
648
|
-
const dxn =
|
|
623
|
+
const dxn = EID3.make({
|
|
624
|
+
entityId: triggerId
|
|
625
|
+
});
|
|
649
626
|
const trigger2 = yield* Database7.resolve(dxn, Trigger7.Trigger);
|
|
650
|
-
if (trigger2.spec?.kind !== "
|
|
627
|
+
if (trigger2.spec?.kind !== "feed") {
|
|
651
628
|
return yield* Effect7.fail(new Error(`Invalid trigger type: ${trigger2.spec?.kind}`));
|
|
652
629
|
}
|
|
653
630
|
const currentFn = yield* updateFunction(trigger2, options.functionId);
|
|
654
|
-
yield*
|
|
631
|
+
yield* updateFeed(trigger2, options.feed);
|
|
655
632
|
yield* updateInput(trigger2, currentFn, options.input);
|
|
656
633
|
yield* updateEnabled(trigger2, options.id, options.enabled);
|
|
657
634
|
if (json) {
|
|
@@ -662,10 +639,10 @@ var queue2 = Command7.make("queue", {
|
|
|
662
639
|
yield* flushAndSync4({
|
|
663
640
|
indexes: true
|
|
664
641
|
});
|
|
665
|
-
})).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)));
|
|
666
643
|
var updateFunction = Effect7.fn(function* (trigger2, functionIdOption) {
|
|
667
644
|
let currentFn = trigger2.function ? yield* Database7.load(trigger2.function) : void 0;
|
|
668
|
-
if (currentFn && !Obj2.instanceOf(
|
|
645
|
+
if (currentFn && !Obj2.instanceOf(Operation5.PersistentOperation, currentFn)) {
|
|
669
646
|
currentFn = void 0;
|
|
670
647
|
}
|
|
671
648
|
const currentFunctionName = currentFn ? currentFn.name ?? currentFn.id : void 0;
|
|
@@ -681,40 +658,40 @@ var updateFunction = Effect7.fn(function* (trigger2, functionIdOption) {
|
|
|
681
658
|
onNone: () => selectFunction(),
|
|
682
659
|
onSome: (id) => Effect7.succeed(id)
|
|
683
660
|
});
|
|
684
|
-
const functions = yield* Database7.runQuery(Filter6.type(
|
|
661
|
+
const functions = yield* Database7.runQuery(Filter6.type(Operation5.PersistentOperation));
|
|
685
662
|
const foundFn = functions.find((fn6) => fn6.id === functionId);
|
|
686
|
-
if (!foundFn || !Obj2.instanceOf(
|
|
663
|
+
if (!foundFn || !Obj2.instanceOf(Operation5.PersistentOperation, foundFn)) {
|
|
687
664
|
return yield* Effect7.fail(new Error(`Function not found: ${functionId}`));
|
|
688
665
|
}
|
|
689
|
-
Obj2.
|
|
690
|
-
|
|
666
|
+
Obj2.update(trigger2, (trigger3) => {
|
|
667
|
+
trigger3.function = Ref6.make(foundFn);
|
|
691
668
|
});
|
|
692
669
|
currentFn = foundFn;
|
|
693
670
|
}
|
|
694
671
|
if (!currentFn) {
|
|
695
|
-
const functionId = trigger2.function
|
|
672
|
+
const functionId = (trigger2.function ? trigger2.function.uri.toString() : void 0) ?? "unknown";
|
|
696
673
|
return yield* Effect7.fail(new Error(`Invalid reference for ${functionId}`));
|
|
697
674
|
}
|
|
698
675
|
return currentFn;
|
|
699
676
|
});
|
|
700
|
-
var
|
|
701
|
-
const
|
|
702
|
-
const
|
|
703
|
-
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, {
|
|
704
681
|
onNone: () => Prompt5.confirm({
|
|
705
|
-
message: `Change the
|
|
682
|
+
message: `Change the feed${currentFeedStr ? ` (current: ${currentFeedStr})` : ""}?`,
|
|
706
683
|
initial: false
|
|
707
684
|
}).pipe(Prompt5.run),
|
|
708
685
|
onSome: () => Effect7.succeed(true)
|
|
709
686
|
});
|
|
710
|
-
if (
|
|
711
|
-
const
|
|
712
|
-
onNone: () =>
|
|
713
|
-
onSome: (
|
|
687
|
+
if (shouldChangeFeed) {
|
|
688
|
+
const feed = yield* Option6.match(feedOption, {
|
|
689
|
+
onNone: () => selectFeed(),
|
|
690
|
+
onSome: (uri) => Database7.resolve(EID3.parse(uri), FeedNs2.Feed)
|
|
714
691
|
});
|
|
715
|
-
Obj2.
|
|
716
|
-
if (
|
|
717
|
-
|
|
692
|
+
Obj2.update(trigger2, (trigger3) => {
|
|
693
|
+
if (trigger3.spec?.kind === "feed") {
|
|
694
|
+
trigger3.spec.feed = Ref6.make(feed);
|
|
718
695
|
}
|
|
719
696
|
});
|
|
720
697
|
}
|
|
@@ -737,8 +714,8 @@ var updateInput = Effect7.fn(function* (trigger2, fn6, inputOption) {
|
|
|
737
714
|
onNone: () => promptForSchemaInput(fn6.inputSchema ? JsonSchema4.toEffectSchema(fn6.inputSchema) : void 0, currentInput),
|
|
738
715
|
onSome: (value2) => Effect7.succeed(value2)
|
|
739
716
|
});
|
|
740
|
-
Obj2.
|
|
741
|
-
|
|
717
|
+
Obj2.update(trigger2, (trigger3) => {
|
|
718
|
+
trigger3.input = inputObj;
|
|
742
719
|
});
|
|
743
720
|
}
|
|
744
721
|
});
|
|
@@ -750,12 +727,12 @@ var updateEnabled = Effect7.fn(function* (trigger2, idOption, enabled) {
|
|
|
750
727
|
}).pipe(Prompt5.run),
|
|
751
728
|
onSome: () => Effect7.succeed(enabled)
|
|
752
729
|
});
|
|
753
|
-
Obj2.
|
|
754
|
-
|
|
730
|
+
Obj2.update(trigger2, (trigger3) => {
|
|
731
|
+
trigger3.enabled = enabledValue;
|
|
755
732
|
});
|
|
756
733
|
});
|
|
757
734
|
|
|
758
|
-
// src/
|
|
735
|
+
// src/commands/trigger/update/subscription.ts
|
|
759
736
|
import * as Command8 from "@effect/cli/Command";
|
|
760
737
|
import * as Options8 from "@effect/cli/Options";
|
|
761
738
|
import * as Prompt6 from "@effect/cli/Prompt";
|
|
@@ -766,8 +743,9 @@ import * as Option7 from "effect/Option";
|
|
|
766
743
|
import { CommandConfig as CommandConfig7 } from "@dxos/cli-util";
|
|
767
744
|
import { flushAndSync as flushAndSync5, print as print6, spaceLayer as spaceLayer7, withTypes as withTypes6 } from "@dxos/cli-util";
|
|
768
745
|
import { Common as Common7 } from "@dxos/cli-util";
|
|
769
|
-
import {
|
|
770
|
-
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";
|
|
771
749
|
var subscription2 = Command8.make("subscription", {
|
|
772
750
|
spaceId: Common7.spaceId.pipe(Options8.optional),
|
|
773
751
|
id: TriggerId.pipe(Options8.optional),
|
|
@@ -783,8 +761,10 @@ var subscription2 = Command8.make("subscription", {
|
|
|
783
761
|
onNone: () => selectTrigger("subscription"),
|
|
784
762
|
onSome: (id) => Effect8.succeed(id)
|
|
785
763
|
});
|
|
786
|
-
const dxn =
|
|
787
|
-
|
|
764
|
+
const dxn = EID4.make({
|
|
765
|
+
entityId: triggerId
|
|
766
|
+
});
|
|
767
|
+
const trigger2 = yield* Database8.resolve(Ref7.fromURI(dxn), Trigger8.Trigger);
|
|
788
768
|
if (trigger2.spec?.kind !== "subscription") {
|
|
789
769
|
return yield* Effect8.fail(new Error(`Invalid trigger type: ${trigger2.spec?.kind}`));
|
|
790
770
|
}
|
|
@@ -800,7 +780,7 @@ var subscription2 = Command8.make("subscription", {
|
|
|
800
780
|
yield* flushAndSync5({
|
|
801
781
|
indexes: true
|
|
802
782
|
});
|
|
803
|
-
})).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)));
|
|
804
784
|
var extractCurrentTypename = (spec) => {
|
|
805
785
|
if (!spec?.query?.ast) {
|
|
806
786
|
return Option7.none();
|
|
@@ -809,11 +789,11 @@ var extractCurrentTypename = (spec) => {
|
|
|
809
789
|
type: "select"
|
|
810
790
|
}, (q) => Match2.value(q.filter).pipe(Match2.withReturnType(), Match2.when({
|
|
811
791
|
type: "object"
|
|
812
|
-
}, (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()));
|
|
813
793
|
};
|
|
814
794
|
var updateFunction2 = Effect8.fn(function* (trigger2, functionIdOption) {
|
|
815
795
|
let currentFn = trigger2.function ? yield* Database8.load(trigger2.function) : void 0;
|
|
816
|
-
if (currentFn && !Obj3.instanceOf(
|
|
796
|
+
if (currentFn && !Obj3.instanceOf(Operation6.PersistentOperation, currentFn)) {
|
|
817
797
|
currentFn = void 0;
|
|
818
798
|
}
|
|
819
799
|
const currentFunctionName = currentFn ? currentFn.name ?? currentFn.id : void 0;
|
|
@@ -829,18 +809,18 @@ var updateFunction2 = Effect8.fn(function* (trigger2, functionIdOption) {
|
|
|
829
809
|
onNone: () => selectFunction(),
|
|
830
810
|
onSome: (id) => Effect8.succeed(id)
|
|
831
811
|
});
|
|
832
|
-
const functions = yield* Database8.runQuery(Filter7.type(
|
|
812
|
+
const functions = yield* Database8.runQuery(Filter7.type(Operation6.PersistentOperation));
|
|
833
813
|
const foundFn = functions.find((fn6) => fn6.id === functionId);
|
|
834
|
-
if (!foundFn || !Obj3.instanceOf(
|
|
814
|
+
if (!foundFn || !Obj3.instanceOf(Operation6.PersistentOperation, foundFn)) {
|
|
835
815
|
return yield* Effect8.fail(new Error(`Function not found: ${functionId}`));
|
|
836
816
|
}
|
|
837
|
-
Obj3.
|
|
838
|
-
|
|
817
|
+
Obj3.update(trigger2, (trigger3) => {
|
|
818
|
+
trigger3.function = Ref7.make(foundFn);
|
|
839
819
|
});
|
|
840
820
|
currentFn = foundFn;
|
|
841
821
|
}
|
|
842
822
|
if (!currentFn) {
|
|
843
|
-
const functionId = trigger2.function
|
|
823
|
+
const functionId = (trigger2.function ? EID4.getEntityId(EID4.tryParse(trigger2.function.uri)) : void 0) ?? "unknown";
|
|
844
824
|
return yield* Effect8.fail(new Error(`Invalid reference for ${functionId}`));
|
|
845
825
|
}
|
|
846
826
|
return currentFn;
|
|
@@ -874,7 +854,7 @@ var updateSpec = Effect8.fn(function* (trigger2, typenameOption, deepOption, del
|
|
|
874
854
|
}).pipe(Prompt6.run),
|
|
875
855
|
onSome: (value2) => Effect8.succeed(value2)
|
|
876
856
|
});
|
|
877
|
-
const queryAst =
|
|
857
|
+
const queryAst = Query4.select(Filter7.type(typename)).ast;
|
|
878
858
|
const deepOptionValue = yield* Option7.match(deepOption, {
|
|
879
859
|
onNone: () => Prompt6.confirm({
|
|
880
860
|
message: "Watch changes to nested properties (deep)?",
|
|
@@ -899,8 +879,8 @@ var updateSpec = Effect8.fn(function* (trigger2, typenameOption, deepOption, del
|
|
|
899
879
|
if (Option7.isSome(delayOptionValue)) {
|
|
900
880
|
subscriptionOptions.delay = delayOptionValue.value;
|
|
901
881
|
}
|
|
902
|
-
Obj3.
|
|
903
|
-
const spec =
|
|
882
|
+
Obj3.update(trigger2, (trigger3) => {
|
|
883
|
+
const spec = trigger3.spec;
|
|
904
884
|
if (spec?.kind === "subscription") {
|
|
905
885
|
spec.query = {
|
|
906
886
|
ast: queryAst
|
|
@@ -928,8 +908,8 @@ var updateInput2 = Effect8.fn(function* (trigger2, fn6, inputOption) {
|
|
|
928
908
|
onNone: () => promptForSchemaInput(fn6.inputSchema ? JsonSchema5.toEffectSchema(fn6.inputSchema) : void 0, currentInput),
|
|
929
909
|
onSome: (value2) => Effect8.succeed(value2)
|
|
930
910
|
});
|
|
931
|
-
Obj3.
|
|
932
|
-
|
|
911
|
+
Obj3.update(trigger2, (trigger3) => {
|
|
912
|
+
trigger3.input = inputObj;
|
|
933
913
|
});
|
|
934
914
|
}
|
|
935
915
|
});
|
|
@@ -941,12 +921,12 @@ var updateEnabled2 = Effect8.fn(function* (trigger2, idOption, enabled) {
|
|
|
941
921
|
}).pipe(Prompt6.run),
|
|
942
922
|
onSome: () => Effect8.succeed(enabled)
|
|
943
923
|
});
|
|
944
|
-
Obj3.
|
|
945
|
-
|
|
924
|
+
Obj3.update(trigger2, (trigger3) => {
|
|
925
|
+
trigger3.enabled = enabledValue;
|
|
946
926
|
});
|
|
947
927
|
});
|
|
948
928
|
|
|
949
|
-
// src/
|
|
929
|
+
// src/commands/trigger/update/timer.ts
|
|
950
930
|
import * as Command9 from "@effect/cli/Command";
|
|
951
931
|
import * as Options9 from "@effect/cli/Options";
|
|
952
932
|
import * as Prompt7 from "@effect/cli/Prompt";
|
|
@@ -956,8 +936,9 @@ import * as Option8 from "effect/Option";
|
|
|
956
936
|
import { CommandConfig as CommandConfig8 } from "@dxos/cli-util";
|
|
957
937
|
import { flushAndSync as flushAndSync6, print as print7, spaceLayer as spaceLayer8, withTypes as withTypes7 } from "@dxos/cli-util";
|
|
958
938
|
import { Common as Common8 } from "@dxos/cli-util";
|
|
959
|
-
import {
|
|
960
|
-
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";
|
|
961
942
|
var timer2 = Command9.make("timer", {
|
|
962
943
|
spaceId: Common8.spaceId.pipe(Options9.optional),
|
|
963
944
|
id: TriggerId.pipe(Options9.optional),
|
|
@@ -971,8 +952,10 @@ var timer2 = Command9.make("timer", {
|
|
|
971
952
|
onNone: () => selectTrigger("timer"),
|
|
972
953
|
onSome: (id) => Effect9.succeed(id)
|
|
973
954
|
});
|
|
974
|
-
const dxn =
|
|
975
|
-
|
|
955
|
+
const dxn = EID5.make({
|
|
956
|
+
entityId: triggerId
|
|
957
|
+
});
|
|
958
|
+
const trigger2 = yield* Database9.resolve(Ref8.fromURI(dxn), Trigger9.Trigger);
|
|
976
959
|
if (!trigger2.spec || trigger2.spec?.kind !== "timer") {
|
|
977
960
|
return yield* Effect9.fail(new Error(`Invalid trigger type: ${trigger2.spec?.kind}`));
|
|
978
961
|
}
|
|
@@ -988,10 +971,10 @@ var timer2 = Command9.make("timer", {
|
|
|
988
971
|
yield* flushAndSync6({
|
|
989
972
|
indexes: true
|
|
990
973
|
});
|
|
991
|
-
})).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)));
|
|
992
975
|
var updateFunction3 = Effect9.fn(function* (trigger2, functionIdOption) {
|
|
993
976
|
let currentFn = trigger2.function ? yield* Database9.load(trigger2.function) : void 0;
|
|
994
|
-
if (currentFn && !Obj4.instanceOf(
|
|
977
|
+
if (currentFn && !Obj4.instanceOf(Operation7.PersistentOperation, currentFn)) {
|
|
995
978
|
currentFn = void 0;
|
|
996
979
|
}
|
|
997
980
|
const currentFunctionName = currentFn ? currentFn.name ?? currentFn.id : void 0;
|
|
@@ -1007,18 +990,18 @@ var updateFunction3 = Effect9.fn(function* (trigger2, functionIdOption) {
|
|
|
1007
990
|
onNone: () => selectFunction(),
|
|
1008
991
|
onSome: (id) => Effect9.succeed(id)
|
|
1009
992
|
});
|
|
1010
|
-
const functions = yield* Database9.runQuery(Filter8.type(
|
|
993
|
+
const functions = yield* Database9.runQuery(Filter8.type(Operation7.PersistentOperation));
|
|
1011
994
|
const foundFn = functions.find((fn6) => fn6.id === functionId);
|
|
1012
|
-
if (!foundFn || !Obj4.instanceOf(
|
|
995
|
+
if (!foundFn || !Obj4.instanceOf(Operation7.PersistentOperation, foundFn)) {
|
|
1013
996
|
return yield* Effect9.fail(new Error(`Function not found: ${functionId}`));
|
|
1014
997
|
}
|
|
1015
|
-
Obj4.
|
|
1016
|
-
|
|
998
|
+
Obj4.update(trigger2, (trigger3) => {
|
|
999
|
+
trigger3.function = Ref8.make(foundFn);
|
|
1017
1000
|
});
|
|
1018
1001
|
currentFn = foundFn;
|
|
1019
1002
|
}
|
|
1020
1003
|
if (!currentFn) {
|
|
1021
|
-
const functionId = trigger2.function
|
|
1004
|
+
const functionId = (trigger2.function ? EID5.getEntityId(EID5.tryParse(trigger2.function.uri)) : void 0) ?? "unknown";
|
|
1022
1005
|
return yield* Effect9.fail(new Error(`Invalid reference for ${functionId}`));
|
|
1023
1006
|
}
|
|
1024
1007
|
return currentFn;
|
|
@@ -1039,9 +1022,9 @@ var updateCron = Effect9.fn(function* (trigger2, cronOption) {
|
|
|
1039
1022
|
}).pipe(Prompt7.run),
|
|
1040
1023
|
onSome: (value2) => Effect9.succeed(value2)
|
|
1041
1024
|
});
|
|
1042
|
-
Obj4.
|
|
1043
|
-
if (
|
|
1044
|
-
|
|
1025
|
+
Obj4.update(trigger2, (trigger3) => {
|
|
1026
|
+
if (trigger3.spec?.kind === "timer") {
|
|
1027
|
+
trigger3.spec.cron = cron;
|
|
1045
1028
|
}
|
|
1046
1029
|
});
|
|
1047
1030
|
}
|
|
@@ -1064,8 +1047,8 @@ var updateInput3 = Effect9.fn(function* (trigger2, fn6, inputOption) {
|
|
|
1064
1047
|
onNone: () => promptForSchemaInput(fn6.inputSchema ? JsonSchema6.toEffectSchema(fn6.inputSchema) : void 0, currentInput),
|
|
1065
1048
|
onSome: (value2) => Effect9.succeed(value2)
|
|
1066
1049
|
});
|
|
1067
|
-
Obj4.
|
|
1068
|
-
|
|
1050
|
+
Obj4.update(trigger2, (trigger3) => {
|
|
1051
|
+
trigger3.input = inputObj;
|
|
1069
1052
|
});
|
|
1070
1053
|
}
|
|
1071
1054
|
});
|
|
@@ -1077,19 +1060,19 @@ var updateEnabled3 = Effect9.fn(function* (trigger2, idOption, enabled) {
|
|
|
1077
1060
|
}).pipe(Prompt7.run),
|
|
1078
1061
|
onSome: () => Effect9.succeed(enabled)
|
|
1079
1062
|
});
|
|
1080
|
-
Obj4.
|
|
1081
|
-
|
|
1063
|
+
Obj4.update(trigger2, (trigger3) => {
|
|
1064
|
+
trigger3.enabled = enabledValue;
|
|
1082
1065
|
});
|
|
1083
1066
|
});
|
|
1084
1067
|
|
|
1085
|
-
// src/
|
|
1068
|
+
// src/commands/trigger/update/index.ts
|
|
1086
1069
|
var update = Command10.make("update").pipe(Command10.withDescription("Update a trigger."), Command10.withSubcommands([
|
|
1087
1070
|
subscription2,
|
|
1088
1071
|
timer2,
|
|
1089
1072
|
queue2
|
|
1090
1073
|
]));
|
|
1091
1074
|
|
|
1092
|
-
// src/
|
|
1075
|
+
// src/commands/trigger/index.ts
|
|
1093
1076
|
var trigger = Command11.make("trigger").pipe(Command11.withDescription("Manage EDGE triggers."), Command11.withSubcommands([
|
|
1094
1077
|
create,
|
|
1095
1078
|
list,
|
|
@@ -1097,19 +1080,34 @@ var trigger = Command11.make("trigger").pipe(Command11.withDescription("Manage E
|
|
|
1097
1080
|
update
|
|
1098
1081
|
]));
|
|
1099
1082
|
|
|
1100
|
-
// src/
|
|
1101
|
-
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({
|
|
1102
1087
|
commands: [
|
|
1103
1088
|
trigger
|
|
1104
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
|
|
1105
1101
|
}), Plugin.addModule({
|
|
1106
1102
|
activatesOn: ClientEvents.ClientReady,
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
activate:
|
|
1103
|
+
activate: RegistrySync
|
|
1104
|
+
}), Plugin.addModule({
|
|
1105
|
+
activatesOn: ActivationEvent.allOf(ActivationEvents.ProcessManagerReady, ClientEvents.SpacesReady),
|
|
1106
|
+
activate: TriggerRuntimeController
|
|
1111
1107
|
}), Plugin.make);
|
|
1108
|
+
var AutomationPlugin_node_default = AutomationPlugin;
|
|
1112
1109
|
export {
|
|
1113
|
-
AutomationPlugin
|
|
1110
|
+
AutomationPlugin,
|
|
1111
|
+
AutomationPlugin_node_default as default
|
|
1114
1112
|
};
|
|
1115
|
-
//# sourceMappingURL=
|
|
1113
|
+
//# sourceMappingURL=AutomationPlugin.node.mjs.map
|