@dxos/plugin-automation 0.8.4-main.7ace549 → 0.8.4-main.937b3ca
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/dist/lib/browser/AutomationPanel-FAS6ADCW.mjs +11 -0
- package/dist/lib/browser/AutomationSettings-XN2OIYWL.mjs +56 -0
- package/dist/lib/browser/AutomationSettings-XN2OIYWL.mjs.map +7 -0
- package/dist/lib/browser/FunctionsContainer-6QLC7JP4.mjs +129 -0
- package/dist/lib/browser/FunctionsContainer-6QLC7JP4.mjs.map +7 -0
- package/dist/lib/browser/{FunctionsPanel-CRW6SJUN.mjs → FunctionsPanel-ZX4J75UM.mjs} +3 -3
- package/dist/lib/browser/app-graph-builder-LAQMEBMH.mjs +84 -0
- package/dist/lib/browser/app-graph-builder-LAQMEBMH.mjs.map +7 -0
- package/dist/lib/browser/{chunk-CZVA5NMD.mjs → chunk-54PANILA.mjs} +5 -5
- package/dist/lib/browser/chunk-BFUIVUQH.mjs +102 -0
- package/dist/lib/browser/chunk-BFUIVUQH.mjs.map +7 -0
- package/dist/lib/browser/chunk-BKFQBKYO.mjs +8 -0
- package/dist/lib/browser/chunk-BKFQBKYO.mjs.map +7 -0
- package/dist/lib/browser/chunk-JOXPQ27I.mjs +83 -0
- package/dist/lib/browser/chunk-JOXPQ27I.mjs.map +7 -0
- package/dist/lib/browser/{chunk-LZQFZO3B.mjs → chunk-PZNBEKO5.mjs} +1 -1
- package/dist/lib/browser/chunk-PZNBEKO5.mjs.map +7 -0
- package/dist/lib/browser/chunk-QW3EM35H.mjs +248 -0
- package/dist/lib/browser/chunk-QW3EM35H.mjs.map +7 -0
- package/dist/lib/browser/{chunk-4MBM6C6A.mjs → chunk-RAF2FJST.mjs} +14 -28
- package/dist/lib/browser/chunk-RAF2FJST.mjs.map +7 -0
- package/dist/lib/browser/chunk-YWLEY2FD.mjs +200 -0
- package/dist/lib/browser/chunk-YWLEY2FD.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +1107 -0
- package/dist/lib/browser/cli/index.mjs.map +7 -0
- package/dist/lib/browser/compute-runtime-WTWLQ67J.mjs +114 -0
- package/dist/lib/browser/compute-runtime-WTWLQ67J.mjs.map +7 -0
- package/dist/lib/browser/hooks/index.mjs +3 -3
- package/dist/lib/browser/index.mjs +49 -57
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-Q3MWOR7K.mjs +82 -0
- package/dist/lib/browser/operation-resolver-Q3MWOR7K.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-TKU2EQ5A.mjs → react-surface-EV3AC62F.mjs} +12 -11
- package/dist/lib/browser/react-surface-EV3AC62F.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +10 -4
- package/dist/lib/node-esm/{AutomationPanel-F5CTC6AT.mjs → AutomationPanel-B7NAGDFA.mjs} +4 -4
- package/dist/lib/node-esm/AutomationSettings-M5PMZJ6P.mjs +57 -0
- package/dist/lib/node-esm/AutomationSettings-M5PMZJ6P.mjs.map +7 -0
- package/dist/lib/node-esm/FunctionsContainer-J4O2ULWR.mjs +130 -0
- package/dist/lib/node-esm/FunctionsContainer-J4O2ULWR.mjs.map +7 -0
- package/dist/lib/node-esm/{FunctionsPanel-RVVCS6VH.mjs → FunctionsPanel-SS6GIVNU.mjs} +3 -3
- package/dist/lib/node-esm/app-graph-builder-4UCMXHYY.mjs +85 -0
- package/dist/lib/node-esm/app-graph-builder-4UCMXHYY.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-2CKVH7JC.mjs +201 -0
- package/dist/lib/node-esm/chunk-2CKVH7JC.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-CEVIVRTY.mjs → chunk-5FXNN3MV.mjs} +1 -1
- package/dist/lib/node-esm/chunk-5FXNN3MV.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-3IYSC75Z.mjs → chunk-7QRUPEHH.mjs} +5 -5
- package/dist/lib/node-esm/{chunk-7B6NAAI6.mjs → chunk-HQLVREIX.mjs} +14 -28
- package/dist/lib/node-esm/chunk-HQLVREIX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-K7GCM342.mjs +10 -0
- package/dist/lib/node-esm/chunk-K7GCM342.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-KWKWOGS5.mjs +103 -0
- package/dist/lib/node-esm/chunk-KWKWOGS5.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-LJAXQ6CX.mjs +249 -0
- package/dist/lib/node-esm/chunk-LJAXQ6CX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-RX52VKI2.mjs +84 -0
- package/dist/lib/node-esm/chunk-RX52VKI2.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +1108 -0
- package/dist/lib/node-esm/cli/index.mjs.map +7 -0
- package/dist/lib/node-esm/compute-runtime-ZHROOBLY.mjs +115 -0
- package/dist/lib/node-esm/compute-runtime-ZHROOBLY.mjs.map +7 -0
- package/dist/lib/node-esm/hooks/index.mjs +3 -3
- package/dist/lib/node-esm/index.mjs +49 -57
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operation-resolver-R5GA4YNO.mjs +83 -0
- package/dist/lib/node-esm/operation-resolver-R5GA4YNO.mjs.map +7 -0
- package/dist/lib/node-esm/{react-surface-7QROSEGH.mjs → react-surface-S6VZJCEZ.mjs} +12 -11
- package/dist/lib/node-esm/react-surface-S6VZJCEZ.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +10 -4
- package/dist/types/src/AutomationPlugin.d.ts +2 -1
- package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/compute-runtime/compute-runtime.d.ts +6 -0
- package/dist/types/src/capabilities/compute-runtime/compute-runtime.d.ts.map +1 -0
- package/dist/types/src/capabilities/compute-runtime/index.d.ts +3 -0
- package/dist/types/src/capabilities/compute-runtime/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +4 -5
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/cli/commands/index.d.ts +2 -0
- package/dist/types/src/cli/commands/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/create/index.d.ts +25 -0
- package/dist/types/src/cli/commands/trigger/create/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/create/queue.d.ts +13 -0
- package/dist/types/src/cli/commands/trigger/create/queue.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/create/subscription.d.ts +15 -0
- package/dist/types/src/cli/commands/trigger/create/subscription.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/create/timer.d.ts +13 -0
- package/dist/types/src/cli/commands/trigger/create/timer.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/index.d.ts +57 -0
- package/dist/types/src/cli/commands/trigger/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/list.d.ts +7 -0
- package/dist/types/src/cli/commands/trigger/list.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/options.d.ts +11 -0
- package/dist/types/src/cli/commands/trigger/options.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/remove.d.ts +8 -0
- package/dist/types/src/cli/commands/trigger/remove.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/update/index.d.ts +28 -0
- package/dist/types/src/cli/commands/trigger/update/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/update/queue.d.ts +12 -0
- package/dist/types/src/cli/commands/trigger/update/queue.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/update/subscription.d.ts +13 -0
- package/dist/types/src/cli/commands/trigger/update/subscription.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/update/timer.d.ts +11 -0
- package/dist/types/src/cli/commands/trigger/update/timer.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/util.d.ts +46 -0
- package/dist/types/src/cli/commands/trigger/util.d.ts.map +1 -0
- package/dist/types/src/cli/index.d.ts +2 -0
- package/dist/types/src/cli/index.d.ts.map +1 -0
- package/dist/types/src/cli/plugin.d.ts +3 -0
- package/dist/types/src/cli/plugin.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 +1 -0
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +1 -1
- package/dist/types/src/components/FunctionsPanel/FunctionsPanel.d.ts.map +1 -1
- package/dist/types/src/components/FunctionsRegistry/FunctionsRegistry.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts +10 -7
- package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts +6 -3
- package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +7 -6
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts +70 -2
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TriggerSettings.d.ts +3 -3
- package/dist/types/src/components/TriggerSettings.d.ts.map +1 -1
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts +6 -6
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +1 -1
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts +2 -2
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +1 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +22 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/events.d.ts +5 -0
- package/dist/types/src/types/events.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +2 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +30 -1
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +61 -49
- package/src/AutomationPlugin.tsx +13 -33
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +71 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/{compute-runtime.ts → compute-runtime/compute-runtime.ts} +48 -44
- package/src/capabilities/compute-runtime/index.ts +7 -0
- package/src/capabilities/index.ts +4 -8
- package/src/capabilities/operation-resolver/index.ts +7 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +79 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +60 -0
- package/src/cli/commands/index.ts +5 -0
- package/src/cli/commands/trigger/create/index.ts +14 -0
- package/src/cli/commands/trigger/create/queue.ts +89 -0
- package/src/cli/commands/trigger/create/subscription.ts +128 -0
- package/src/cli/commands/trigger/create/timer.ts +93 -0
- package/src/cli/commands/trigger/index.ts +16 -0
- package/src/cli/commands/trigger/list.ts +67 -0
- package/src/cli/commands/trigger/options.ts +59 -0
- package/src/cli/commands/trigger/remove.ts +45 -0
- package/src/cli/commands/trigger/update/index.ts +14 -0
- package/src/cli/commands/trigger/update/queue.ts +195 -0
- package/src/cli/commands/trigger/update/subscription.ts +278 -0
- package/src/cli/commands/trigger/update/timer.ts +193 -0
- package/src/cli/commands/trigger/util.ts +395 -0
- package/src/cli/index.ts +5 -0
- package/src/cli/plugin.ts +23 -0
- package/src/components/AutomationPanel/AutomationPanel.tsx +33 -12
- package/src/components/AutomationSettings.tsx +1 -1
- package/src/components/FunctionsPanel/FunctionsPanel.tsx +11 -16
- package/src/components/FunctionsRegistry/FunctionsRegistry.tsx +8 -24
- package/src/components/TriggerEditor/FunctionInputEditor.tsx +23 -31
- package/src/components/TriggerEditor/SpecSelector.tsx +8 -6
- package/src/components/TriggerEditor/TriggerEditor.stories.tsx +27 -24
- package/src/components/TriggerEditor/TriggerEditor.tsx +55 -42
- package/src/components/TriggerSettings.tsx +3 -3
- package/src/hooks/useComputeRuntimeCallback.ts +9 -10
- package/src/hooks/useTriggerRuntimeControls.ts +7 -7
- package/src/index.ts +1 -2
- package/src/meta.ts +2 -2
- package/src/translations.ts +2 -0
- package/src/{capabilities → types}/capabilities.ts +8 -7
- package/src/types/events.ts +11 -0
- package/src/types/index.ts +2 -0
- package/src/types/schema.ts +23 -2
- package/dist/lib/browser/AutomationPanel-M4M77L4V.mjs +0 -11
- package/dist/lib/browser/AutomationSettings-4HCI6KJR.mjs +0 -68
- package/dist/lib/browser/AutomationSettings-4HCI6KJR.mjs.map +0 -7
- package/dist/lib/browser/FunctionsContainer-CDVBRQCT.mjs +0 -144
- package/dist/lib/browser/FunctionsContainer-CDVBRQCT.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-W7LLC6XW.mjs +0 -81
- package/dist/lib/browser/app-graph-builder-W7LLC6XW.mjs.map +0 -7
- package/dist/lib/browser/chunk-4MBM6C6A.mjs.map +0 -7
- package/dist/lib/browser/chunk-7W6QMY3L.mjs +0 -267
- package/dist/lib/browser/chunk-7W6QMY3L.mjs.map +0 -7
- package/dist/lib/browser/chunk-LZQFZO3B.mjs.map +0 -7
- package/dist/lib/browser/chunk-T6ZESHDY.mjs +0 -191
- package/dist/lib/browser/chunk-T6ZESHDY.mjs.map +0 -7
- package/dist/lib/browser/chunk-TWWFNOIR.mjs +0 -109
- package/dist/lib/browser/chunk-TWWFNOIR.mjs.map +0 -7
- package/dist/lib/browser/chunk-XAKZ4ANY.mjs +0 -15
- package/dist/lib/browser/chunk-XAKZ4ANY.mjs.map +0 -7
- package/dist/lib/browser/chunk-YBPJCY3F.mjs +0 -38
- package/dist/lib/browser/chunk-YBPJCY3F.mjs.map +0 -7
- package/dist/lib/browser/compute-runtime-B4XJVY4Y.mjs +0 -113
- package/dist/lib/browser/compute-runtime-B4XJVY4Y.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-5HR7M7T6.mjs +0 -77
- package/dist/lib/browser/intent-resolver-5HR7M7T6.mjs.map +0 -7
- package/dist/lib/browser/react-surface-TKU2EQ5A.mjs.map +0 -7
- package/dist/lib/node-esm/AutomationSettings-BQLJIFRT.mjs +0 -69
- package/dist/lib/node-esm/AutomationSettings-BQLJIFRT.mjs.map +0 -7
- package/dist/lib/node-esm/FunctionsContainer-ZHHJPQAZ.mjs +0 -145
- package/dist/lib/node-esm/FunctionsContainer-ZHHJPQAZ.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-SLQOO7GH.mjs +0 -82
- package/dist/lib/node-esm/app-graph-builder-SLQOO7GH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7B6NAAI6.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CEVIVRTY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CF2SWXPW.mjs +0 -268
- package/dist/lib/node-esm/chunk-CF2SWXPW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ECJKIUBO.mjs +0 -39
- package/dist/lib/node-esm/chunk-ECJKIUBO.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-F76XVENA.mjs +0 -192
- package/dist/lib/node-esm/chunk-F76XVENA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KB7NFEYY.mjs +0 -16
- package/dist/lib/node-esm/chunk-KB7NFEYY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RVK52XGK.mjs +0 -110
- package/dist/lib/node-esm/chunk-RVK52XGK.mjs.map +0 -7
- package/dist/lib/node-esm/compute-runtime-JUWTQXOV.mjs +0 -114
- package/dist/lib/node-esm/compute-runtime-JUWTQXOV.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-KDRYB5BC.mjs +0 -78
- package/dist/lib/node-esm/intent-resolver-KDRYB5BC.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-7QROSEGH.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -20
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/compute-runtime.d.ts +0 -5
- package/dist/types/src/capabilities/compute-runtime.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/events.d.ts +0 -4
- package/dist/types/src/events.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -87
- package/src/capabilities/intent-resolver.ts +0 -72
- package/src/capabilities/react-surface.tsx +0 -56
- package/src/events.ts +0 -11
- /package/dist/lib/browser/{AutomationPanel-M4M77L4V.mjs.map → AutomationPanel-FAS6ADCW.mjs.map} +0 -0
- /package/dist/lib/browser/{FunctionsPanel-CRW6SJUN.mjs.map → FunctionsPanel-ZX4J75UM.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-CZVA5NMD.mjs.map → chunk-54PANILA.mjs.map} +0 -0
- /package/dist/lib/node-esm/{AutomationPanel-F5CTC6AT.mjs.map → AutomationPanel-B7NAGDFA.mjs.map} +0 -0
- /package/dist/lib/node-esm/{FunctionsPanel-RVVCS6VH.mjs.map → FunctionsPanel-SS6GIVNU.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-3IYSC75Z.mjs.map → chunk-7QRUPEHH.mjs.map} +0 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Command from '@effect/cli/Command';
|
|
6
|
+
import * as Options from '@effect/cli/Options';
|
|
7
|
+
import * as Prompt from '@effect/cli/Prompt';
|
|
8
|
+
import * as Console from 'effect/Console';
|
|
9
|
+
import * as Effect from 'effect/Effect';
|
|
10
|
+
import * as HashMap from 'effect/HashMap';
|
|
11
|
+
import * as Option from 'effect/Option';
|
|
12
|
+
|
|
13
|
+
import { CommandConfig } from '@dxos/cli-util';
|
|
14
|
+
import { flushAndSync, print, spaceLayer, withTypes } from '@dxos/cli-util';
|
|
15
|
+
import { Common } from '@dxos/cli-util';
|
|
16
|
+
import { Database, Filter, Ref, Type } from '@dxos/echo';
|
|
17
|
+
import { Function, Trigger } from '@dxos/functions';
|
|
18
|
+
|
|
19
|
+
import { Enabled, Input, Queue } from '../options';
|
|
20
|
+
import { printTrigger, promptForSchemaInput, selectFunction, selectQueue } from '../util';
|
|
21
|
+
|
|
22
|
+
export const queue = Command.make(
|
|
23
|
+
'queue',
|
|
24
|
+
{
|
|
25
|
+
spaceId: Common.spaceId.pipe(Options.optional),
|
|
26
|
+
enabled: Enabled,
|
|
27
|
+
functionId: Common.functionId.pipe(Options.optional),
|
|
28
|
+
queue: Queue.pipe(Options.optional),
|
|
29
|
+
input: Input.pipe(Options.optional),
|
|
30
|
+
},
|
|
31
|
+
(options) =>
|
|
32
|
+
Effect.gen(function* () {
|
|
33
|
+
const { json } = yield* CommandConfig;
|
|
34
|
+
|
|
35
|
+
const functionId = yield* Option.match(options.functionId, {
|
|
36
|
+
onNone: () => selectFunction(),
|
|
37
|
+
onSome: (id) => Effect.succeed(id),
|
|
38
|
+
});
|
|
39
|
+
const functions = yield* Database.Service.runQuery(Filter.type(Function.Function));
|
|
40
|
+
const fn = functions.find((fn) => fn.id === functionId);
|
|
41
|
+
if (!fn) {
|
|
42
|
+
return yield* Effect.fail(new Error(`Function not found: ${functionId}`));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const queueDxn = yield* Option.match(options.queue, {
|
|
46
|
+
onNone: () => selectQueue(),
|
|
47
|
+
onSome: (dxn) => Effect.succeed(dxn.toString()),
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const input = yield* Option.match(options.input, {
|
|
51
|
+
onNone: () => promptForSchemaInput(fn.inputSchema ? Type.toEffectSchema(fn.inputSchema) : undefined),
|
|
52
|
+
onSome: (value) => Effect.succeed(Object.fromEntries(HashMap.toEntries(value))),
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// Always prompt for enabled if functionId is not provided.
|
|
56
|
+
const enabled = yield* Option.match(options.functionId, {
|
|
57
|
+
onNone: () =>
|
|
58
|
+
Prompt.confirm({
|
|
59
|
+
message: 'Enable the trigger?',
|
|
60
|
+
initial: true,
|
|
61
|
+
}).pipe(Prompt.run),
|
|
62
|
+
onSome: () => Effect.succeed(options.enabled),
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const trigger = Trigger.make({
|
|
66
|
+
function: Ref.make(fn),
|
|
67
|
+
enabled,
|
|
68
|
+
spec: {
|
|
69
|
+
kind: 'queue',
|
|
70
|
+
queue: queueDxn,
|
|
71
|
+
},
|
|
72
|
+
input,
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
yield* Database.Service.add(trigger);
|
|
76
|
+
|
|
77
|
+
if (json) {
|
|
78
|
+
yield* Console.log(JSON.stringify(trigger, null, 2));
|
|
79
|
+
} else {
|
|
80
|
+
yield* Console.log(print(yield* printTrigger(trigger)));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
yield* flushAndSync({ indexes: true });
|
|
84
|
+
}),
|
|
85
|
+
).pipe(
|
|
86
|
+
Command.withDescription('Create a queue trigger.'),
|
|
87
|
+
Command.provide(({ spaceId }) => spaceLayer(spaceId, true)),
|
|
88
|
+
Command.provideEffectDiscard(() => withTypes(Function.Function, Trigger.Trigger)),
|
|
89
|
+
);
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Command from '@effect/cli/Command';
|
|
6
|
+
import * as Options from '@effect/cli/Options';
|
|
7
|
+
import * as Prompt from '@effect/cli/Prompt';
|
|
8
|
+
import * as Console from 'effect/Console';
|
|
9
|
+
import * as Effect from 'effect/Effect';
|
|
10
|
+
import * as HashMap from 'effect/HashMap';
|
|
11
|
+
import * as Option from 'effect/Option';
|
|
12
|
+
|
|
13
|
+
import { CommandConfig } from '@dxos/cli-util';
|
|
14
|
+
import { flushAndSync, print, spaceLayer, withTypes } from '@dxos/cli-util';
|
|
15
|
+
import { Common } from '@dxos/cli-util';
|
|
16
|
+
import { Database, Filter, Query, Ref, Type } from '@dxos/echo';
|
|
17
|
+
import { Function, Trigger } from '@dxos/functions';
|
|
18
|
+
|
|
19
|
+
import { Deep, Delay, Enabled, Input, Typename } from '../options';
|
|
20
|
+
import { printTrigger, promptForSchemaInput, selectFunction } from '../util';
|
|
21
|
+
|
|
22
|
+
export const subscription = Command.make(
|
|
23
|
+
'subscription',
|
|
24
|
+
{
|
|
25
|
+
spaceId: Common.spaceId.pipe(Options.optional),
|
|
26
|
+
enabled: Enabled,
|
|
27
|
+
functionId: Common.functionId.pipe(Options.optional),
|
|
28
|
+
typename: Typename.pipe(Options.optional),
|
|
29
|
+
deep: Deep.pipe(Options.optional),
|
|
30
|
+
delay: Delay.pipe(Options.optional),
|
|
31
|
+
input: Input.pipe(Options.optional),
|
|
32
|
+
},
|
|
33
|
+
(options) =>
|
|
34
|
+
Effect.gen(function* () {
|
|
35
|
+
const { json } = yield* CommandConfig;
|
|
36
|
+
|
|
37
|
+
const functionId = yield* Option.match(options.functionId, {
|
|
38
|
+
onNone: () => selectFunction(),
|
|
39
|
+
onSome: (id) => Effect.succeed(id),
|
|
40
|
+
});
|
|
41
|
+
const functions = yield* Database.Service.runQuery(Filter.type(Function.Function));
|
|
42
|
+
const fn = functions.find((fn) => fn.id === functionId);
|
|
43
|
+
if (!fn) {
|
|
44
|
+
return yield* Effect.fail(new Error(`Function not found: ${functionId}`));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const typename = yield* Option.match(options.typename, {
|
|
48
|
+
onNone: () =>
|
|
49
|
+
Prompt.text({
|
|
50
|
+
message: 'Enter type name:',
|
|
51
|
+
}).pipe(Prompt.run),
|
|
52
|
+
onSome: (value) => Effect.succeed(value),
|
|
53
|
+
});
|
|
54
|
+
const queryAst = Query.select(Filter.type(typename)).ast;
|
|
55
|
+
|
|
56
|
+
const deepOption = yield* Option.match(options.deep, {
|
|
57
|
+
onNone: () =>
|
|
58
|
+
Prompt.confirm({
|
|
59
|
+
message: 'Watch changes to nested properties (deep)?',
|
|
60
|
+
initial: false,
|
|
61
|
+
}).pipe(
|
|
62
|
+
Prompt.run,
|
|
63
|
+
Effect.map((value) => (value ? Option.some(value) : Option.none())),
|
|
64
|
+
),
|
|
65
|
+
onSome: () => Effect.succeed(Option.some(true)),
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
const delayOption = yield* Option.match(options.delay, {
|
|
69
|
+
onNone: () =>
|
|
70
|
+
Effect.gen(function* () {
|
|
71
|
+
const delayStr = yield* Prompt.text({
|
|
72
|
+
message: 'Debounce delay in milliseconds (optional, press Enter to skip):',
|
|
73
|
+
}).pipe(Prompt.run);
|
|
74
|
+
return delayStr === '' ? Option.none<number>() : Option.some(parseInt(delayStr, 10));
|
|
75
|
+
}),
|
|
76
|
+
onSome: (value) => Effect.succeed(Option.some(value)),
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
const subscriptionOptions: { deep?: boolean; delay?: number } = {};
|
|
80
|
+
if (Option.isSome(deepOption)) {
|
|
81
|
+
subscriptionOptions.deep = deepOption.value;
|
|
82
|
+
}
|
|
83
|
+
if (Option.isSome(delayOption)) {
|
|
84
|
+
subscriptionOptions.delay = delayOption.value;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const input = yield* Option.match(options.input, {
|
|
88
|
+
onNone: () => promptForSchemaInput(fn.inputSchema ? Type.toEffectSchema(fn.inputSchema) : undefined),
|
|
89
|
+
onSome: (value) => Effect.succeed(Object.fromEntries(HashMap.toEntries(value))),
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
// Always prompt for enabled if functionId is not provided.
|
|
93
|
+
const enabled = yield* Option.match(options.functionId, {
|
|
94
|
+
onNone: () =>
|
|
95
|
+
Prompt.confirm({
|
|
96
|
+
message: 'Enable the trigger?',
|
|
97
|
+
initial: true,
|
|
98
|
+
}).pipe(Prompt.run),
|
|
99
|
+
onSome: () => Effect.succeed(options.enabled),
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
const trigger = Trigger.make({
|
|
103
|
+
function: Ref.make(fn),
|
|
104
|
+
enabled,
|
|
105
|
+
spec: {
|
|
106
|
+
kind: 'subscription',
|
|
107
|
+
query: {
|
|
108
|
+
ast: queryAst,
|
|
109
|
+
},
|
|
110
|
+
options: Object.keys(subscriptionOptions).length > 0 ? subscriptionOptions : undefined,
|
|
111
|
+
},
|
|
112
|
+
input,
|
|
113
|
+
});
|
|
114
|
+
yield* Database.Service.add(trigger);
|
|
115
|
+
|
|
116
|
+
if (json) {
|
|
117
|
+
yield* Console.log(JSON.stringify(trigger, null, 2));
|
|
118
|
+
} else {
|
|
119
|
+
yield* Console.log(print(yield* printTrigger(trigger)));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
yield* flushAndSync({ indexes: true });
|
|
123
|
+
}),
|
|
124
|
+
).pipe(
|
|
125
|
+
Command.withDescription('Create a subscription trigger.'),
|
|
126
|
+
Command.provide(({ spaceId }) => spaceLayer(spaceId, true)),
|
|
127
|
+
Command.provideEffectDiscard(() => withTypes(Function.Function, Trigger.Trigger)),
|
|
128
|
+
);
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Command from '@effect/cli/Command';
|
|
6
|
+
import * as Options from '@effect/cli/Options';
|
|
7
|
+
import * as Prompt from '@effect/cli/Prompt';
|
|
8
|
+
import * as Console from 'effect/Console';
|
|
9
|
+
import * as Effect from 'effect/Effect';
|
|
10
|
+
import * as HashMap from 'effect/HashMap';
|
|
11
|
+
import * as Option from 'effect/Option';
|
|
12
|
+
|
|
13
|
+
import { CommandConfig } from '@dxos/cli-util';
|
|
14
|
+
import { flushAndSync, print, spaceLayer, withTypes } from '@dxos/cli-util';
|
|
15
|
+
import { Common } from '@dxos/cli-util';
|
|
16
|
+
import { Database, Filter, Ref, Type } from '@dxos/echo';
|
|
17
|
+
import { Function, Trigger } from '@dxos/functions';
|
|
18
|
+
|
|
19
|
+
import { Cron, Enabled, Input } from '../options';
|
|
20
|
+
import { printTrigger, promptForSchemaInput, selectFunction } from '../util';
|
|
21
|
+
|
|
22
|
+
// trigger create timer --cron "0 0 * * *" --functionId <functionId>
|
|
23
|
+
export const timer = Command.make(
|
|
24
|
+
'timer',
|
|
25
|
+
{
|
|
26
|
+
spaceId: Common.spaceId.pipe(Options.optional),
|
|
27
|
+
enabled: Enabled,
|
|
28
|
+
functionId: Common.functionId.pipe(Options.optional),
|
|
29
|
+
cron: Cron.pipe(Options.optional),
|
|
30
|
+
input: Input.pipe(Options.optional),
|
|
31
|
+
},
|
|
32
|
+
(options) =>
|
|
33
|
+
Effect.gen(function* () {
|
|
34
|
+
const { json } = yield* CommandConfig;
|
|
35
|
+
|
|
36
|
+
const functionId = yield* Option.match(options.functionId, {
|
|
37
|
+
onNone: () => selectFunction(),
|
|
38
|
+
onSome: (id) => Effect.succeed(id),
|
|
39
|
+
});
|
|
40
|
+
const functions = yield* Database.Service.runQuery(Filter.type(Function.Function));
|
|
41
|
+
const fn = functions.find((fn) => fn.id === functionId);
|
|
42
|
+
if (!fn) {
|
|
43
|
+
return yield* Effect.fail(new Error(`Function not found: ${functionId}`));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const cron = yield* Option.match(options.cron, {
|
|
47
|
+
onNone: () =>
|
|
48
|
+
Prompt.text({
|
|
49
|
+
message: 'Enter cron expression:',
|
|
50
|
+
}).pipe(Prompt.run),
|
|
51
|
+
onSome: (value) => Effect.succeed(value),
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const input = yield* Option.match(options.input, {
|
|
55
|
+
onNone: () => promptForSchemaInput(fn.inputSchema ? Type.toEffectSchema(fn.inputSchema) : undefined),
|
|
56
|
+
onSome: (value) => Effect.succeed(Object.fromEntries(HashMap.toEntries(value))),
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// Always prompt for enabled if functionId is not provided.
|
|
60
|
+
const enabled = yield* Option.match(options.functionId, {
|
|
61
|
+
onNone: () =>
|
|
62
|
+
Prompt.confirm({
|
|
63
|
+
message: 'Enable the trigger?',
|
|
64
|
+
initial: true,
|
|
65
|
+
}).pipe(Prompt.run),
|
|
66
|
+
onSome: () => Effect.succeed(options.enabled),
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const trigger = Trigger.make({
|
|
70
|
+
function: Ref.make(fn),
|
|
71
|
+
enabled,
|
|
72
|
+
spec: {
|
|
73
|
+
kind: 'timer',
|
|
74
|
+
cron,
|
|
75
|
+
},
|
|
76
|
+
input,
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
yield* Database.Service.add(trigger);
|
|
80
|
+
|
|
81
|
+
if (json) {
|
|
82
|
+
yield* Console.log(JSON.stringify(trigger, null, 2));
|
|
83
|
+
} else {
|
|
84
|
+
yield* Console.log(print(yield* printTrigger(trigger)));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
yield* flushAndSync({ indexes: true });
|
|
88
|
+
}),
|
|
89
|
+
).pipe(
|
|
90
|
+
Command.withDescription('Create a timer trigger.'),
|
|
91
|
+
Command.provide(({ spaceId }) => spaceLayer(spaceId, true)),
|
|
92
|
+
Command.provideEffectDiscard(() => withTypes(Function.Function, Trigger.Trigger)),
|
|
93
|
+
);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Command from '@effect/cli/Command';
|
|
6
|
+
|
|
7
|
+
import { create } from './create';
|
|
8
|
+
import { list } from './list';
|
|
9
|
+
import { remove } from './remove';
|
|
10
|
+
import { update } from './update';
|
|
11
|
+
|
|
12
|
+
// TODO(wittjosiah): Rename to automation to align with Composer?
|
|
13
|
+
export const trigger = Command.make('trigger').pipe(
|
|
14
|
+
Command.withDescription('Manage EDGE triggers.'),
|
|
15
|
+
Command.withSubcommands([create, list, remove, update]),
|
|
16
|
+
);
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Command from '@effect/cli/Command';
|
|
6
|
+
import * as Options from '@effect/cli/Options';
|
|
7
|
+
import * as Console from 'effect/Console';
|
|
8
|
+
import * as Effect from 'effect/Effect';
|
|
9
|
+
|
|
10
|
+
import { CommandConfig, Common, printList, spaceIdWithDefault, spaceLayer } from '@dxos/cli-util';
|
|
11
|
+
import { ClientService } from '@dxos/client';
|
|
12
|
+
import { Database, Filter } from '@dxos/echo';
|
|
13
|
+
import { Trigger } from '@dxos/functions';
|
|
14
|
+
|
|
15
|
+
import { getTriggerRemoteStatus, printTrigger } from './util';
|
|
16
|
+
|
|
17
|
+
export const list = Command.make(
|
|
18
|
+
'list',
|
|
19
|
+
{
|
|
20
|
+
spaceId: Common.spaceId.pipe(Options.optional),
|
|
21
|
+
},
|
|
22
|
+
Effect.fn(function* ({ spaceId: spaceIdOption }) {
|
|
23
|
+
const { json } = yield* CommandConfig;
|
|
24
|
+
|
|
25
|
+
// Fetch local triggers
|
|
26
|
+
const triggers = yield* Database.Service.runQuery(Filter.type(Trigger.Trigger));
|
|
27
|
+
|
|
28
|
+
// Fetch remote cron triggers to check availability
|
|
29
|
+
const remoteCronIds = yield* Effect.gen(function* () {
|
|
30
|
+
const client = yield* ClientService;
|
|
31
|
+
const spaceId = yield* spaceIdWithDefault(spaceIdOption);
|
|
32
|
+
const result = yield* Effect.promise(() => client.edge.getCronTriggers(spaceId)).pipe(
|
|
33
|
+
Effect.catchAll(() => Effect.succeed({ cronIds: [] })),
|
|
34
|
+
);
|
|
35
|
+
return result.cronIds;
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// Determine remote status for each trigger
|
|
39
|
+
const triggersWithStatus = triggers.map((trigger) => ({
|
|
40
|
+
trigger,
|
|
41
|
+
remoteStatus: getTriggerRemoteStatus(trigger, remoteCronIds),
|
|
42
|
+
}));
|
|
43
|
+
|
|
44
|
+
// Print triggers
|
|
45
|
+
if (json) {
|
|
46
|
+
yield* Console.log(
|
|
47
|
+
JSON.stringify(
|
|
48
|
+
triggersWithStatus.map(({ trigger, remoteStatus }) => ({ ...trigger, remoteStatus })),
|
|
49
|
+
null,
|
|
50
|
+
2,
|
|
51
|
+
),
|
|
52
|
+
);
|
|
53
|
+
} else {
|
|
54
|
+
if (triggersWithStatus.length === 0) {
|
|
55
|
+
yield* Console.log('No triggers found.');
|
|
56
|
+
} else {
|
|
57
|
+
const items = yield* Effect.all(
|
|
58
|
+
triggersWithStatus.map(({ trigger, remoteStatus }) => printTrigger(trigger, remoteStatus)),
|
|
59
|
+
);
|
|
60
|
+
yield* Console.log(printList(items));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}),
|
|
64
|
+
).pipe(
|
|
65
|
+
Command.withDescription('List triggers configured on EDGE.'),
|
|
66
|
+
Command.provide(({ spaceId }) => spaceLayer(spaceId, true)),
|
|
67
|
+
);
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Options from '@effect/cli/Options';
|
|
6
|
+
import * as Schema from 'effect/Schema';
|
|
7
|
+
|
|
8
|
+
import { DXN } from '@dxos/keys';
|
|
9
|
+
|
|
10
|
+
export const TriggerId = Options.text('id').pipe(Options.withDescription('The id of the trigger.'));
|
|
11
|
+
|
|
12
|
+
export const Enabled = Options.boolean('enabled', { ifPresent: true }).pipe(
|
|
13
|
+
Options.withDescription('Whether the trigger is enabled.'),
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
export const Input = Options.keyValueMap('input').pipe(
|
|
17
|
+
Options.withDescription("Input data to pass to the function. Must match the function's input schema."),
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
//
|
|
21
|
+
// Subscription
|
|
22
|
+
//
|
|
23
|
+
|
|
24
|
+
export const Typename = Options.text('typename').pipe(
|
|
25
|
+
Options.withDescription('The type name to query for the subscription trigger.'),
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
export const Deep = Options.boolean('deep', { ifPresent: true }).pipe(
|
|
29
|
+
Options.withDescription('Watch changes to nested properties (not just creation).'),
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
export const Delay = Options.integer('delay').pipe(
|
|
33
|
+
Options.withDescription('Debounce changes with a delay in milliseconds.'),
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
//
|
|
37
|
+
// Timer
|
|
38
|
+
//
|
|
39
|
+
|
|
40
|
+
export const Cron = Options.text('cron').pipe(
|
|
41
|
+
Options.withDescription('The cron expression to use for the timer trigger.'),
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
//
|
|
45
|
+
// Queue
|
|
46
|
+
//
|
|
47
|
+
|
|
48
|
+
// TODO(dmaretskyi): Extract
|
|
49
|
+
const DXNSchema = Schema.String.pipe(
|
|
50
|
+
Schema.transform(Schema.instanceOf(DXN), {
|
|
51
|
+
decode: (value: string) => DXN.parse(value),
|
|
52
|
+
encode: (value: DXN) => value.toString(),
|
|
53
|
+
}),
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
export const Queue = Options.text('queue').pipe(
|
|
57
|
+
Options.withDescription('The DXN of the queue for the queue trigger.'),
|
|
58
|
+
Options.withSchema(DXNSchema),
|
|
59
|
+
);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Command from '@effect/cli/Command';
|
|
6
|
+
import * as Options from '@effect/cli/Options';
|
|
7
|
+
import * as Console from 'effect/Console';
|
|
8
|
+
import * as Effect from 'effect/Effect';
|
|
9
|
+
import * as Option from 'effect/Option';
|
|
10
|
+
|
|
11
|
+
import { CommandConfig, Common, print, spaceLayer, withTypes } from '@dxos/cli-util';
|
|
12
|
+
import { DXN } from '@dxos/echo';
|
|
13
|
+
import { Database } from '@dxos/echo';
|
|
14
|
+
import { Trigger } from '@dxos/functions';
|
|
15
|
+
|
|
16
|
+
import { TriggerId } from './options';
|
|
17
|
+
import { printTriggerRemoved, selectTrigger } from './util';
|
|
18
|
+
|
|
19
|
+
export const remove = Command.make(
|
|
20
|
+
'remove',
|
|
21
|
+
{
|
|
22
|
+
spaceId: Common.spaceId.pipe(Options.optional),
|
|
23
|
+
id: TriggerId.pipe(Options.optional),
|
|
24
|
+
},
|
|
25
|
+
(options) =>
|
|
26
|
+
Effect.gen(function* () {
|
|
27
|
+
const { json } = yield* CommandConfig;
|
|
28
|
+
const triggerId = yield* Option.match(options.id, {
|
|
29
|
+
onNone: () => selectTrigger(),
|
|
30
|
+
onSome: (id) => Effect.succeed(id),
|
|
31
|
+
});
|
|
32
|
+
const dxn = DXN.fromLocalObjectId(triggerId);
|
|
33
|
+
const trigger = yield* Database.Service.resolve(dxn, Trigger.Trigger);
|
|
34
|
+
yield* Database.Service.remove(trigger);
|
|
35
|
+
if (json) {
|
|
36
|
+
yield* Console.log(JSON.stringify({ id: trigger.id, removed: true }, null, 2));
|
|
37
|
+
} else {
|
|
38
|
+
yield* Console.log(print(printTriggerRemoved(trigger.id)));
|
|
39
|
+
}
|
|
40
|
+
}),
|
|
41
|
+
).pipe(
|
|
42
|
+
Command.withDescription('Remove a trigger.'),
|
|
43
|
+
Command.provide(({ spaceId }) => spaceLayer(spaceId, true)),
|
|
44
|
+
Command.provideEffectDiscard(() => withTypes(Trigger.Trigger)),
|
|
45
|
+
);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Command from '@effect/cli/Command';
|
|
6
|
+
|
|
7
|
+
import { queue } from './queue';
|
|
8
|
+
import { subscription } from './subscription';
|
|
9
|
+
import { timer } from './timer';
|
|
10
|
+
|
|
11
|
+
export const update = Command.make('update').pipe(
|
|
12
|
+
Command.withDescription('Update a trigger.'),
|
|
13
|
+
Command.withSubcommands([subscription, timer, queue]),
|
|
14
|
+
);
|