@dxos/plugin-automation 0.8.4-main.74a063c4e0 → 0.8.4-main.765dc60934
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/README.md +1 -1
- package/dist/lib/neutral/AutomationPanel-HI63JQ2X.mjs +11 -0
- package/dist/lib/neutral/AutomationPlugin.mjs +10 -0
- package/dist/lib/{browser/cli/index.mjs → neutral/AutomationPlugin.node.mjs} +102 -112
- package/dist/lib/neutral/AutomationPlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/AutomationSettings-LM5GSR4H.mjs +31 -0
- package/dist/lib/neutral/AutomationSettings-LM5GSR4H.mjs.map +7 -0
- package/dist/lib/neutral/FunctionsContainer-CEMKJIGV.mjs +38 -0
- package/dist/lib/neutral/FunctionsContainer-CEMKJIGV.mjs.map +7 -0
- package/dist/lib/neutral/FunctionsPanel-SVRKRUXZ.mjs +97 -0
- package/dist/lib/neutral/FunctionsPanel-SVRKRUXZ.mjs.map +7 -0
- package/dist/lib/neutral/FunctionsRegistry-7ITCFJCW.mjs +95 -0
- package/dist/lib/neutral/FunctionsRegistry-7ITCFJCW.mjs.map +7 -0
- package/dist/lib/neutral/TriggerSettings-XCHIZPOR.mjs +9 -0
- package/dist/lib/neutral/app-graph-builder-GDCGRYEP.mjs +75 -0
- package/dist/lib/neutral/app-graph-builder-GDCGRYEP.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +15 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/node.mjs +13 -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-6CKX6RIL.mjs +270 -0
- package/dist/lib/neutral/chunk-6CKX6RIL.mjs.map +7 -0
- package/dist/lib/neutral/chunk-ATECY555.mjs +20 -0
- package/dist/lib/neutral/chunk-ATECY555.mjs.map +7 -0
- package/dist/lib/neutral/chunk-CNFKEN7S.mjs +37 -0
- package/dist/lib/neutral/chunk-CNFKEN7S.mjs.map +7 -0
- package/dist/lib/neutral/chunk-DSCOLDT5.mjs +93 -0
- package/dist/lib/neutral/chunk-DSCOLDT5.mjs.map +7 -0
- package/dist/lib/neutral/chunk-K3C5ZTZA.mjs +285 -0
- package/dist/lib/neutral/chunk-K3C5ZTZA.mjs.map +7 -0
- package/dist/lib/neutral/chunk-M3TIHFXN.mjs +8 -0
- package/dist/lib/neutral/chunk-M3TIHFXN.mjs.map +7 -0
- package/dist/lib/neutral/chunk-YV7TKOVL.mjs +12 -0
- package/dist/lib/neutral/chunk-YV7TKOVL.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +16 -0
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/compute-runtime-D7MPZJ4R.mjs +222 -0
- package/dist/lib/neutral/compute-runtime-D7MPZJ4R.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +13 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/{browser/create-trigger-from-template-JPF5BFMX.mjs → neutral/create-trigger-from-template-7K3OYOHQ.mjs} +13 -22
- package/dist/lib/neutral/create-trigger-from-template-7K3OYOHQ.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +129 -0
- package/dist/lib/neutral/hooks/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +20 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +8 -0
- package/dist/lib/neutral/meta.mjs.map +7 -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/operations/index.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +16 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-3OGMAMKV.mjs +57 -0
- package/dist/lib/neutral/react-surface-3OGMAMKV.mjs.map +7 -0
- package/dist/lib/neutral/testing.mjs +8 -0
- package/dist/lib/neutral/testing.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +47 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +16 -0
- package/dist/lib/neutral/types/index.mjs.map +7 -0
- package/dist/types/src/AutomationPlugin.d.ts +1 -0
- package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
- package/dist/types/src/{cli/plugin.d.ts → AutomationPlugin.node.d.ts} +2 -1
- package/dist/types/src/AutomationPlugin.node.d.ts.map +1 -0
- package/dist/types/src/AutomationPlugin.test.d.ts +2 -0
- package/dist/types/src/AutomationPlugin.test.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/compute-runtime.d.ts +8 -0
- package/dist/types/src/capabilities/compute-runtime.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +2 -2
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/node.d.ts +4 -1
- package/dist/types/src/capabilities/node.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- 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 +1 -1
- 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 +7 -7
- package/dist/types/src/commands/trigger/index.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/list.d.ts.map +1 -0
- 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/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/{cli/commands → commands}/trigger/util.d.ts +4 -4
- 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 +32 -29
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +1 -1
- 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 +5 -5
- 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 +95 -90
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
- 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/FunctionsContainer/FunctionsContainer.d.ts +2 -4
- package/dist/types/src/containers/FunctionsContainer/FunctionsContainer.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/useComputeRuntime.d.ts +1 -0
- package/dist/types/src/hooks/useComputeRuntime.d.ts.map +1 -1
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts +1 -1
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +1 -1
- package/dist/types/src/hooks/useComputeRuntimeService.d.ts +14 -2
- package/dist/types/src/hooks/useComputeRuntimeService.d.ts.map +1 -1
- 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 +2 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/create-trigger-from-template.d.ts +3 -3
- package/dist/types/src/operations/create-trigger-from-template.d.ts.map +1 -1
- package/dist/types/src/operations/index.d.ts +1 -2
- package/dist/types/src/operations/index.d.ts.map +1 -1
- 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 +77 -77
- 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 +32 -30
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/AutomationCapabilities.d.ts +22 -0
- package/dist/types/src/types/AutomationCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/AutomationEvents.d.ts +3 -0
- package/dist/types/src/types/AutomationEvents.d.ts.map +1 -0
- package/dist/types/src/{operations/definitions.d.ts → types/AutomationOperation.d.ts} +5 -5
- package/dist/types/src/types/AutomationOperation.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +3 -2
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +113 -82
- package/src/AutomationPlugin.node.ts +29 -0
- package/src/AutomationPlugin.test.ts +27 -0
- package/src/AutomationPlugin.tsx +7 -7
- package/src/capabilities/app-graph-builder.ts +10 -6
- package/src/capabilities/compute-runtime.ts +218 -138
- package/src/capabilities/index.ts +1 -1
- package/src/capabilities/node.ts +6 -0
- package/src/capabilities/operation-handler.ts +1 -1
- package/src/capabilities/react-surface.tsx +6 -6
- package/src/{cli/commands → commands}/trigger/create/queue.ts +5 -9
- package/src/{cli/commands → commands}/trigger/create/subscription.ts +6 -10
- package/src/{cli/commands → commands}/trigger/create/timer.ts +2 -6
- package/src/{cli/commands → commands}/trigger/list.ts +5 -3
- package/src/{cli/commands → commands}/trigger/remove.ts +2 -3
- package/src/{cli/commands → commands}/trigger/update/queue.ts +13 -14
- package/src/{cli/commands → commands}/trigger/update/subscription.ts +9 -10
- package/src/{cli/commands → commands}/trigger/update/timer.ts +10 -11
- package/src/{cli/commands → commands}/trigger/util.ts +19 -16
- package/src/components/AutomationPanel/AutomationPanel.stories.tsx +9 -4
- package/src/components/AutomationPanel/AutomationPanel.tsx +40 -35
- package/src/components/FunctionsPanel/FunctionsPanel.tsx +4 -4
- package/src/components/FunctionsRegistry/FunctionsRegistry.tsx +14 -9
- package/src/components/TriggerEditor/FunctionInputEditor.tsx +1 -1
- package/src/components/TriggerEditor/SpecSelector.tsx +6 -11
- package/src/components/TriggerEditor/TriggerEditor.stories.tsx +12 -7
- package/src/components/TriggerEditor/TriggerEditor.tsx +8 -9
- package/src/containers/AutomationSettings/AutomationSettings.tsx +5 -2
- package/src/containers/FunctionsContainer/FunctionsContainer.tsx +3 -4
- package/src/containers/TriggerSettings/TriggerSettings.tsx +29 -7
- package/src/hooks/useComputeRuntime.ts +17 -3
- package/src/hooks/useComputeRuntimeCallback.ts +2 -3
- package/src/hooks/useComputeRuntimeService.ts +49 -9
- package/src/hooks/useTriggerRuntimeControls.ts +6 -3
- package/src/index.ts +2 -2
- package/src/meta.ts +2 -1
- package/src/operations/create-trigger-from-template.ts +51 -55
- package/src/operations/index.ts +1 -3
- package/src/plugin.ts +11 -0
- package/src/testing/test-functions.ts +6 -6
- package/src/testing.ts +7 -0
- package/src/translations.ts +8 -6
- package/src/types/AutomationCapabilities.ts +48 -0
- package/src/types/AutomationEvents.ts +11 -0
- package/src/{operations/definitions.ts → types/AutomationOperation.ts} +4 -2
- package/src/types/index.ts +4 -2
- package/dist/lib/browser/chunk-POEIL4RN.mjs +0 -44
- package/dist/lib/browser/chunk-POEIL4RN.mjs.map +0 -7
- package/dist/lib/browser/chunk-WQLEMRPU.mjs +0 -54
- package/dist/lib/browser/chunk-WQLEMRPU.mjs.map +0 -7
- package/dist/lib/browser/cli/index.mjs.map +0 -7
- package/dist/lib/browser/create-trigger-from-template-JPF5BFMX.mjs.map +0 -7
- package/dist/lib/browser/hooks/index.mjs +0 -85
- package/dist/lib/browser/hooks/index.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -90
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/operations/index.mjs +0 -14
- package/dist/lib/browser/operations/index.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -14
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
- package/dist/lib/node-esm/chunk-JWZAVQLF.mjs +0 -56
- package/dist/lib/node-esm/chunk-JWZAVQLF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SP3P4OUI.mjs +0 -45
- package/dist/lib/node-esm/chunk-SP3P4OUI.mjs.map +0 -7
- package/dist/lib/node-esm/cli/index.mjs +0 -1123
- package/dist/lib/node-esm/cli/index.mjs.map +0 -7
- package/dist/lib/node-esm/create-trigger-from-template-FT75A4SF.mjs +0 -78
- package/dist/lib/node-esm/create-trigger-from-template-FT75A4SF.mjs.map +0 -7
- package/dist/lib/node-esm/hooks/index.mjs +0 -86
- package/dist/lib/node-esm/hooks/index.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -91
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/operations/index.mjs +0 -15
- package/dist/lib/node-esm/operations/index.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -15
- 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.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/operations/definitions.d.ts.map +0 -1
- package/dist/types/src/types/capabilities.d.ts +0 -25
- 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/cli/index.ts +0 -5
- package/src/cli/plugin.ts +0 -23
- package/src/types/capabilities.ts +0 -56
- package/src/types/events.ts +0 -11
- /package/dist/lib/{browser/chunk-J5LGTIGS.mjs.map → neutral/AutomationPanel-HI63JQ2X.mjs.map} +0 -0
- /package/dist/lib/{browser/types/index.mjs.map → neutral/AutomationPlugin.mjs.map} +0 -0
- /package/dist/lib/{node-esm/chunk-HSLMI22Q.mjs.map → neutral/TriggerSettings-XCHIZPOR.mjs.map} +0 -0
- /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs +0 -0
- /package/dist/lib/{node-esm/types/index.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/types/src/{cli/commands → commands}/index.d.ts +0 -0
- /package/dist/types/src/{cli/commands → commands}/trigger/list.d.ts +0 -0
- /package/dist/types/src/{cli/commands → commands}/trigger/options.d.ts +0 -0
- /package/dist/types/src/{cli/commands → commands}/trigger/update/queue.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/options.ts +0 -0
- /package/src/{cli/commands → commands}/trigger/update/index.ts +0 -0
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import "
|
|
1
|
+
import "./chunk-J5LGTIGS.mjs";
|
|
2
2
|
|
|
3
|
-
// src/
|
|
3
|
+
// src/AutomationPlugin.node.ts
|
|
4
4
|
import { Plugin } from "@dxos/app-framework";
|
|
5
5
|
import { AppPlugin } from "@dxos/app-toolkit";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { Operation as Operation8, Trace, Trigger as Trigger10 } from "@dxos/compute";
|
|
7
|
+
import { ClientEvents } from "@dxos/plugin-client";
|
|
8
|
+
import { AppGraphBuilder, ComputeRuntime, OperationHandler } from "#capabilities";
|
|
8
9
|
import { meta } from "#meta";
|
|
9
10
|
import { AutomationEvents } from "#types";
|
|
10
11
|
|
|
11
|
-
// src/
|
|
12
|
+
// src/commands/trigger/index.ts
|
|
12
13
|
import * as Command11 from "@effect/cli/Command";
|
|
13
14
|
|
|
14
|
-
// src/
|
|
15
|
+
// src/commands/trigger/create/index.ts
|
|
15
16
|
import * as Command4 from "@effect/cli/Command";
|
|
16
17
|
|
|
17
|
-
// src/
|
|
18
|
+
// src/commands/trigger/create/queue.ts
|
|
18
19
|
import * as Command from "@effect/cli/Command";
|
|
19
20
|
import * as Options2 from "@effect/cli/Options";
|
|
20
21
|
import * as Prompt2 from "@effect/cli/Prompt";
|
|
@@ -25,11 +26,10 @@ import * as Option2 from "effect/Option";
|
|
|
25
26
|
import { CommandConfig } from "@dxos/cli-util";
|
|
26
27
|
import { flushAndSync, print, spaceLayer, withTypes } from "@dxos/cli-util";
|
|
27
28
|
import { Common } from "@dxos/cli-util";
|
|
29
|
+
import { Operation as Operation2, Trigger as Trigger2 } from "@dxos/compute";
|
|
28
30
|
import { Database as Database2, Filter as Filter2, JsonSchema, Ref as Ref2 } from "@dxos/echo";
|
|
29
|
-
import { Trigger as Trigger2 } from "@dxos/functions";
|
|
30
|
-
import { Operation as Operation2 } from "@dxos/operation";
|
|
31
31
|
|
|
32
|
-
// src/
|
|
32
|
+
// src/commands/trigger/options.ts
|
|
33
33
|
import * as Options from "@effect/cli/Options";
|
|
34
34
|
import * as Schema from "effect/Schema";
|
|
35
35
|
import { DXN } from "@dxos/keys";
|
|
@@ -50,7 +50,7 @@ var DXNSchema = Schema.String.pipe(Schema.transform(Schema.instanceOf(DXN), {
|
|
|
50
50
|
}));
|
|
51
51
|
var Queue = Options.text("queue").pipe(Options.withDescription("The DXN of the queue for the queue trigger."), Options.withSchema(DXNSchema));
|
|
52
52
|
|
|
53
|
-
// src/
|
|
53
|
+
// src/commands/trigger/util.ts
|
|
54
54
|
import * as Prompt from "@effect/cli/Prompt";
|
|
55
55
|
import * as Ansi from "@effect/printer-ansi/Ansi";
|
|
56
56
|
import * as Console from "effect/Console";
|
|
@@ -59,10 +59,9 @@ import * as Match from "effect/Match";
|
|
|
59
59
|
import * as Option from "effect/Option";
|
|
60
60
|
import * as SchemaAST from "effect/SchemaAST";
|
|
61
61
|
import { FormBuilder } from "@dxos/cli-util";
|
|
62
|
-
import {
|
|
62
|
+
import { Operation, Trigger } from "@dxos/compute";
|
|
63
|
+
import { Annotation, Database, Entity, Feed, Filter, Obj, Query, Ref, Type } from "@dxos/echo";
|
|
63
64
|
import { getProperties } from "@dxos/effect";
|
|
64
|
-
import { Trigger } from "@dxos/functions";
|
|
65
|
-
import { Operation } from "@dxos/operation";
|
|
66
65
|
import { FeedAnnotation } from "@dxos/schema";
|
|
67
66
|
var getTriggerRemoteStatus = (trigger2, remoteCronIds) => {
|
|
68
67
|
if (trigger2.spec?.kind !== "timer") {
|
|
@@ -74,7 +73,7 @@ var printTrigger = Effect.fn(function* (trigger2, remoteStatus) {
|
|
|
74
73
|
const fn6 = trigger2.function && (yield* Database.load(trigger2.function));
|
|
75
74
|
return FormBuilder.make({
|
|
76
75
|
title: trigger2.id
|
|
77
|
-
}).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", Obj.getDXN(fn6).toString())))), FormBuilder.nestedOption("spec", Option.fromNullable(trigger2.spec).pipe(Option.map(printSpec))), FormBuilder.build);
|
|
76
|
+
}).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.getDXN(fn6).toString())))), FormBuilder.nestedOption("spec", Option.fromNullable(trigger2.spec).pipe(Option.map(printSpec))), FormBuilder.build);
|
|
78
77
|
});
|
|
79
78
|
var printSpec = (spec) => {
|
|
80
79
|
switch (spec.kind) {
|
|
@@ -241,14 +240,14 @@ var selectFunction = Effect.fn(function* () {
|
|
|
241
240
|
return String(selected);
|
|
242
241
|
});
|
|
243
242
|
var selectTrigger = Effect.fn(function* (kind) {
|
|
244
|
-
const triggers = yield* Database.runQuery(Filter.type(Trigger.Trigger));
|
|
243
|
+
const triggers = yield* Database.runQuery(Query.select(Filter.type(Trigger.Trigger)).debugLabel("cli.trigger.selectTrigger"));
|
|
245
244
|
const filteredTriggers = kind ? triggers.filter((trigger2) => trigger2.spec?.kind === kind) : triggers;
|
|
246
245
|
if (filteredTriggers.length === 0) {
|
|
247
246
|
return yield* Effect.fail(new Error(kind ? `No ${kind} triggers available` : "No triggers available"));
|
|
248
247
|
}
|
|
249
248
|
const choices = yield* Effect.all(filteredTriggers.map((trigger2) => Effect.gen(function* () {
|
|
250
249
|
const fn6 = trigger2.function ? yield* Database.load(trigger2.function) : void 0;
|
|
251
|
-
const functionName = fn6 && Obj.instanceOf(Operation.PersistentOperation, fn6) ? fn6.name ?? fn6.key ?? fn6.id : void 0;
|
|
250
|
+
const functionName = fn6 && Obj.instanceOf(Operation.PersistentOperation, fn6) ? fn6.name ?? Obj.getMeta(fn6).key ?? fn6.id : void 0;
|
|
252
251
|
const title = functionName ?? trigger2.id;
|
|
253
252
|
const description = `${trigger2.enabled ? "enabled" : "disabled"} - ${trigger2.spec?.kind ?? "unknown"}`;
|
|
254
253
|
return {
|
|
@@ -263,7 +262,7 @@ var selectTrigger = Effect.fn(function* (kind) {
|
|
|
263
262
|
});
|
|
264
263
|
return String(selected);
|
|
265
264
|
});
|
|
266
|
-
var
|
|
265
|
+
var selectFeed = Effect.fn(function* () {
|
|
267
266
|
const schemas = yield* Database.runSchemaQuery({
|
|
268
267
|
location: [
|
|
269
268
|
"database",
|
|
@@ -277,7 +276,7 @@ var selectQueue = Effect.fn(function* () {
|
|
|
277
276
|
if (feedSchemas.length === 0) {
|
|
278
277
|
return yield* Effect.fail(new Error("No schemas with Feed annotation found"));
|
|
279
278
|
}
|
|
280
|
-
const
|
|
279
|
+
const feedChoices = [];
|
|
281
280
|
for (const schema of feedSchemas) {
|
|
282
281
|
yield* Effect.gen(function* () {
|
|
283
282
|
const typename = Type.getTypename(schema);
|
|
@@ -291,26 +290,26 @@ var selectQueue = Effect.fn(function* () {
|
|
|
291
290
|
if (!feedObj || !Obj.instanceOf(Feed.Feed, feedObj)) {
|
|
292
291
|
continue;
|
|
293
292
|
}
|
|
294
|
-
const
|
|
295
|
-
if (!
|
|
293
|
+
const feedDXN = Feed.getQueueDxn(feedObj);
|
|
294
|
+
if (!feedDXN) {
|
|
296
295
|
continue;
|
|
297
296
|
}
|
|
298
297
|
const label = Obj.getLabel(obj) ?? obj.id;
|
|
299
298
|
const description = Obj.getTypename(obj);
|
|
300
|
-
|
|
299
|
+
feedChoices.push({
|
|
301
300
|
title: label,
|
|
302
|
-
value:
|
|
301
|
+
value: feedDXN.toString(),
|
|
303
302
|
description
|
|
304
303
|
});
|
|
305
304
|
}
|
|
306
305
|
}).pipe(Effect.catchAll(() => Effect.void));
|
|
307
306
|
}
|
|
308
|
-
if (
|
|
307
|
+
if (feedChoices.length === 0) {
|
|
309
308
|
return yield* Effect.fail(new Error("No objects with queue properties found"));
|
|
310
309
|
}
|
|
311
310
|
const selected = yield* Prompt.select({
|
|
312
311
|
message: "Select a queue:",
|
|
313
|
-
choices:
|
|
312
|
+
choices: feedChoices
|
|
314
313
|
});
|
|
315
314
|
return String(selected);
|
|
316
315
|
});
|
|
@@ -318,7 +317,7 @@ var printTriggerRemoved = (id) => FormBuilder.make({
|
|
|
318
317
|
title: "Trigger removed"
|
|
319
318
|
}).pipe(FormBuilder.set("id", id), FormBuilder.build);
|
|
320
319
|
|
|
321
|
-
// src/
|
|
320
|
+
// src/commands/trigger/create/queue.ts
|
|
322
321
|
var queue = Command.make("queue", {
|
|
323
322
|
spaceId: Common.spaceId.pipe(Options2.optional),
|
|
324
323
|
enabled: Enabled,
|
|
@@ -336,8 +335,8 @@ var queue = Command.make("queue", {
|
|
|
336
335
|
if (!fn6) {
|
|
337
336
|
return yield* Effect2.fail(new Error(`Function not found: ${functionId}`));
|
|
338
337
|
}
|
|
339
|
-
const
|
|
340
|
-
onNone: () =>
|
|
338
|
+
const queueDXN = yield* Option2.match(options.queue, {
|
|
339
|
+
onNone: () => selectFeed(),
|
|
341
340
|
onSome: (dxn) => Effect2.succeed(dxn.toString())
|
|
342
341
|
});
|
|
343
342
|
const input = yield* Option2.match(options.input, {
|
|
@@ -354,10 +353,7 @@ var queue = Command.make("queue", {
|
|
|
354
353
|
const trigger2 = Trigger2.make({
|
|
355
354
|
function: Ref2.make(fn6),
|
|
356
355
|
enabled,
|
|
357
|
-
spec:
|
|
358
|
-
kind: "queue",
|
|
359
|
-
queue: queueDxn
|
|
360
|
-
},
|
|
356
|
+
spec: Trigger2.specQueue(queueDXN),
|
|
361
357
|
input
|
|
362
358
|
});
|
|
363
359
|
yield* Database2.add(trigger2);
|
|
@@ -371,7 +367,7 @@ var queue = Command.make("queue", {
|
|
|
371
367
|
});
|
|
372
368
|
})).pipe(Command.withDescription("Create a queue trigger."), Command.provide(({ spaceId }) => spaceLayer(spaceId, true)), Command.provideEffectDiscard(() => withTypes(Operation2.PersistentOperation, Trigger2.Trigger)));
|
|
373
369
|
|
|
374
|
-
// src/
|
|
370
|
+
// src/commands/trigger/create/subscription.ts
|
|
375
371
|
import * as Command2 from "@effect/cli/Command";
|
|
376
372
|
import * as Options3 from "@effect/cli/Options";
|
|
377
373
|
import * as Prompt3 from "@effect/cli/Prompt";
|
|
@@ -382,9 +378,8 @@ import * as Option3 from "effect/Option";
|
|
|
382
378
|
import { CommandConfig as CommandConfig2 } from "@dxos/cli-util";
|
|
383
379
|
import { flushAndSync as flushAndSync2, print as print2, spaceLayer as spaceLayer2, withTypes as withTypes2 } from "@dxos/cli-util";
|
|
384
380
|
import { Common as Common2 } from "@dxos/cli-util";
|
|
385
|
-
import {
|
|
386
|
-
import {
|
|
387
|
-
import { Operation as Operation3 } from "@dxos/operation";
|
|
381
|
+
import { Operation as Operation3, Trigger as Trigger3 } from "@dxos/compute";
|
|
382
|
+
import { Database as Database3, Filter as Filter3, JsonSchema as JsonSchema2, Query as Query2, Ref as Ref3 } from "@dxos/echo";
|
|
388
383
|
var subscription = Command2.make("subscription", {
|
|
389
384
|
spaceId: Common2.spaceId.pipe(Options3.optional),
|
|
390
385
|
enabled: Enabled,
|
|
@@ -410,7 +405,7 @@ var subscription = Command2.make("subscription", {
|
|
|
410
405
|
}).pipe(Prompt3.run),
|
|
411
406
|
onSome: (value2) => Effect3.succeed(value2)
|
|
412
407
|
});
|
|
413
|
-
const
|
|
408
|
+
const subscriptionQuery = Query2.select(Filter3.type(typename));
|
|
414
409
|
const deepOption = yield* Option3.match(options.deep, {
|
|
415
410
|
onNone: () => Prompt3.confirm({
|
|
416
411
|
message: "Watch changes to nested properties (deep)?",
|
|
@@ -448,13 +443,7 @@ var subscription = Command2.make("subscription", {
|
|
|
448
443
|
const trigger2 = Trigger3.make({
|
|
449
444
|
function: Ref3.make(fn6),
|
|
450
445
|
enabled,
|
|
451
|
-
spec:
|
|
452
|
-
kind: "subscription",
|
|
453
|
-
query: {
|
|
454
|
-
ast: queryAst
|
|
455
|
-
},
|
|
456
|
-
options: Object.keys(subscriptionOptions).length > 0 ? subscriptionOptions : void 0
|
|
457
|
-
},
|
|
446
|
+
spec: Trigger3.specSubscription(subscriptionQuery, Object.keys(subscriptionOptions).length > 0 ? subscriptionOptions : void 0),
|
|
458
447
|
input
|
|
459
448
|
});
|
|
460
449
|
yield* Database3.add(trigger2);
|
|
@@ -468,7 +457,7 @@ var subscription = Command2.make("subscription", {
|
|
|
468
457
|
});
|
|
469
458
|
})).pipe(Command2.withDescription("Create a subscription trigger."), Command2.provide(({ spaceId }) => spaceLayer2(spaceId, true)), Command2.provideEffectDiscard(() => withTypes2(Operation3.PersistentOperation, Trigger3.Trigger)));
|
|
470
459
|
|
|
471
|
-
// src/
|
|
460
|
+
// src/commands/trigger/create/timer.ts
|
|
472
461
|
import * as Command3 from "@effect/cli/Command";
|
|
473
462
|
import * as Options4 from "@effect/cli/Options";
|
|
474
463
|
import * as Prompt4 from "@effect/cli/Prompt";
|
|
@@ -479,9 +468,8 @@ import * as Option4 from "effect/Option";
|
|
|
479
468
|
import { CommandConfig as CommandConfig3 } from "@dxos/cli-util";
|
|
480
469
|
import { flushAndSync as flushAndSync3, print as print3, spaceLayer as spaceLayer3, withTypes as withTypes3 } from "@dxos/cli-util";
|
|
481
470
|
import { Common as Common3 } from "@dxos/cli-util";
|
|
471
|
+
import { Operation as Operation4, Trigger as Trigger4 } from "@dxos/compute";
|
|
482
472
|
import { Database as Database4, Filter as Filter4, JsonSchema as JsonSchema3, Ref as Ref4 } from "@dxos/echo";
|
|
483
|
-
import { Trigger as Trigger4 } from "@dxos/functions";
|
|
484
|
-
import { Operation as Operation4 } from "@dxos/operation";
|
|
485
473
|
var timer = Command3.make("timer", {
|
|
486
474
|
spaceId: Common3.spaceId.pipe(Options4.optional),
|
|
487
475
|
enabled: Enabled,
|
|
@@ -519,10 +507,7 @@ var timer = Command3.make("timer", {
|
|
|
519
507
|
const trigger2 = Trigger4.make({
|
|
520
508
|
function: Ref4.make(fn6),
|
|
521
509
|
enabled,
|
|
522
|
-
spec:
|
|
523
|
-
kind: "timer",
|
|
524
|
-
cron
|
|
525
|
-
},
|
|
510
|
+
spec: Trigger4.specTimer(cron),
|
|
526
511
|
input
|
|
527
512
|
});
|
|
528
513
|
yield* Database4.add(trigger2);
|
|
@@ -536,36 +521,33 @@ var timer = Command3.make("timer", {
|
|
|
536
521
|
});
|
|
537
522
|
})).pipe(Command3.withDescription("Create a timer trigger."), Command3.provide(({ spaceId }) => spaceLayer3(spaceId, true)), Command3.provideEffectDiscard(() => withTypes3(Operation4.PersistentOperation, Trigger4.Trigger)));
|
|
538
523
|
|
|
539
|
-
// src/
|
|
524
|
+
// src/commands/trigger/create/index.ts
|
|
540
525
|
var create = Command4.make("create").pipe(Command4.withDescription("Create a trigger."), Command4.withSubcommands([
|
|
541
526
|
subscription,
|
|
542
527
|
timer,
|
|
543
528
|
queue
|
|
544
529
|
]));
|
|
545
530
|
|
|
546
|
-
// src/
|
|
531
|
+
// src/commands/trigger/list.ts
|
|
547
532
|
import * as Command5 from "@effect/cli/Command";
|
|
548
533
|
import * as Options5 from "@effect/cli/Options";
|
|
549
534
|
import * as Console5 from "effect/Console";
|
|
550
535
|
import * as Effect5 from "effect/Effect";
|
|
551
536
|
import { CommandConfig as CommandConfig4, Common as Common4, printList, spaceIdWithDefault, spaceLayer as spaceLayer4 } from "@dxos/cli-util";
|
|
552
537
|
import { ClientService } from "@dxos/client";
|
|
538
|
+
import { Trigger as Trigger5 } from "@dxos/compute";
|
|
553
539
|
import { Context } from "@dxos/context";
|
|
554
|
-
import { Database as Database5, Filter as Filter5 } from "@dxos/echo";
|
|
555
|
-
|
|
556
|
-
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-automation/src/cli/commands/trigger/list.ts";
|
|
540
|
+
import { Database as Database5, Filter as Filter5, Query as Query3 } from "@dxos/echo";
|
|
541
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-automation/src/commands/trigger/list.ts";
|
|
557
542
|
var list = Command5.make("list", {
|
|
558
543
|
spaceId: Common4.spaceId.pipe(Options5.optional)
|
|
559
544
|
}, Effect5.fn(function* ({ spaceId: spaceIdOption }) {
|
|
560
545
|
const { json } = yield* CommandConfig4;
|
|
561
|
-
const triggers = yield* Database5.runQuery(Filter5.type(Trigger5.Trigger));
|
|
546
|
+
const triggers = yield* Database5.runQuery(Query3.select(Filter5.type(Trigger5.Trigger)).debugLabel("cli.trigger.list"));
|
|
562
547
|
const remoteCronIds = yield* Effect5.gen(function* () {
|
|
563
548
|
const client = yield* ClientService;
|
|
564
549
|
const spaceId = yield* spaceIdWithDefault(spaceIdOption);
|
|
565
|
-
const result = yield* Effect5.promise(() => client.edge.http.getCronTriggers(Context.default(void 0, {
|
|
566
|
-
F: __dxlog_file,
|
|
567
|
-
L: 33
|
|
568
|
-
}), spaceId)).pipe(Effect5.catchAll(() => Effect5.succeed({
|
|
550
|
+
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({
|
|
569
551
|
cronIds: []
|
|
570
552
|
})));
|
|
571
553
|
return result.cronIds;
|
|
@@ -589,16 +571,15 @@ var list = Command5.make("list", {
|
|
|
589
571
|
}
|
|
590
572
|
})).pipe(Command5.withDescription("List triggers configured on EDGE."), Command5.provide(({ spaceId }) => spaceLayer4(spaceId, true)));
|
|
591
573
|
|
|
592
|
-
// src/
|
|
574
|
+
// src/commands/trigger/remove.ts
|
|
593
575
|
import * as Command6 from "@effect/cli/Command";
|
|
594
576
|
import * as Options6 from "@effect/cli/Options";
|
|
595
577
|
import * as Console6 from "effect/Console";
|
|
596
578
|
import * as Effect6 from "effect/Effect";
|
|
597
579
|
import * as Option5 from "effect/Option";
|
|
598
580
|
import { CommandConfig as CommandConfig5, Common as Common5, print as print4, spaceLayer as spaceLayer5, withTypes as withTypes4 } from "@dxos/cli-util";
|
|
599
|
-
import {
|
|
600
|
-
import { Database as Database6 } from "@dxos/echo";
|
|
601
|
-
import { Trigger as Trigger6 } from "@dxos/functions";
|
|
581
|
+
import { Trigger as Trigger6 } from "@dxos/compute";
|
|
582
|
+
import { Database as Database6, DXN as DXN2 } from "@dxos/echo";
|
|
602
583
|
var remove = Command6.make("remove", {
|
|
603
584
|
spaceId: Common5.spaceId.pipe(Options6.optional),
|
|
604
585
|
id: TriggerId.pipe(Options6.optional)
|
|
@@ -621,10 +602,10 @@ var remove = Command6.make("remove", {
|
|
|
621
602
|
}
|
|
622
603
|
})).pipe(Command6.withDescription("Remove a trigger."), Command6.provide(({ spaceId }) => spaceLayer5(spaceId, true)), Command6.provideEffectDiscard(() => withTypes4(Trigger6.Trigger)));
|
|
623
604
|
|
|
624
|
-
// src/
|
|
605
|
+
// src/commands/trigger/update/index.ts
|
|
625
606
|
import * as Command10 from "@effect/cli/Command";
|
|
626
607
|
|
|
627
|
-
// src/
|
|
608
|
+
// src/commands/trigger/update/queue.ts
|
|
628
609
|
import * as Command7 from "@effect/cli/Command";
|
|
629
610
|
import * as Options7 from "@effect/cli/Options";
|
|
630
611
|
import * as Prompt5 from "@effect/cli/Prompt";
|
|
@@ -634,9 +615,8 @@ import * as Option6 from "effect/Option";
|
|
|
634
615
|
import { CommandConfig as CommandConfig6 } from "@dxos/cli-util";
|
|
635
616
|
import { flushAndSync as flushAndSync4, print as print5, spaceLayer as spaceLayer6, withTypes as withTypes5 } from "@dxos/cli-util";
|
|
636
617
|
import { Common as Common6 } from "@dxos/cli-util";
|
|
618
|
+
import { Operation as Operation5, Trigger as Trigger7 } from "@dxos/compute";
|
|
637
619
|
import { DXN as DXN3, Database as Database7, Filter as Filter6, JsonSchema as JsonSchema4, Obj as Obj2, Ref as Ref5 } from "@dxos/echo";
|
|
638
|
-
import { Trigger as Trigger7 } from "@dxos/functions";
|
|
639
|
-
import { Operation as Operation5 } from "@dxos/operation";
|
|
640
620
|
var queue2 = Command7.make("queue", {
|
|
641
621
|
spaceId: Common6.spaceId.pipe(Options7.optional),
|
|
642
622
|
id: TriggerId.pipe(Options7.optional),
|
|
@@ -691,8 +671,8 @@ var updateFunction = Effect7.fn(function* (trigger2, functionIdOption) {
|
|
|
691
671
|
if (!foundFn || !Obj2.instanceOf(Operation5.PersistentOperation, foundFn)) {
|
|
692
672
|
return yield* Effect7.fail(new Error(`Function not found: ${functionId}`));
|
|
693
673
|
}
|
|
694
|
-
Obj2.
|
|
695
|
-
|
|
674
|
+
Obj2.update(trigger2, (trigger3) => {
|
|
675
|
+
trigger3.function = Ref5.make(foundFn);
|
|
696
676
|
});
|
|
697
677
|
currentFn = foundFn;
|
|
698
678
|
}
|
|
@@ -713,13 +693,13 @@ var updateQueue = Effect7.fn(function* (trigger2, queueOption) {
|
|
|
713
693
|
onSome: () => Effect7.succeed(true)
|
|
714
694
|
});
|
|
715
695
|
if (shouldChangeQueue) {
|
|
716
|
-
const
|
|
717
|
-
onNone: () =>
|
|
696
|
+
const queueDXN = yield* Option6.match(queueOption, {
|
|
697
|
+
onNone: () => selectFeed(),
|
|
718
698
|
onSome: (dxn) => Effect7.succeed(dxn.toString())
|
|
719
699
|
});
|
|
720
|
-
Obj2.
|
|
721
|
-
if (
|
|
722
|
-
|
|
700
|
+
Obj2.update(trigger2, (trigger3) => {
|
|
701
|
+
if (trigger3.spec?.kind === "queue") {
|
|
702
|
+
trigger3.spec.queue = queueDXN;
|
|
723
703
|
}
|
|
724
704
|
});
|
|
725
705
|
}
|
|
@@ -742,8 +722,8 @@ var updateInput = Effect7.fn(function* (trigger2, fn6, inputOption) {
|
|
|
742
722
|
onNone: () => promptForSchemaInput(fn6.inputSchema ? JsonSchema4.toEffectSchema(fn6.inputSchema) : void 0, currentInput),
|
|
743
723
|
onSome: (value2) => Effect7.succeed(value2)
|
|
744
724
|
});
|
|
745
|
-
Obj2.
|
|
746
|
-
|
|
725
|
+
Obj2.update(trigger2, (trigger3) => {
|
|
726
|
+
trigger3.input = inputObj;
|
|
747
727
|
});
|
|
748
728
|
}
|
|
749
729
|
});
|
|
@@ -755,12 +735,12 @@ var updateEnabled = Effect7.fn(function* (trigger2, idOption, enabled) {
|
|
|
755
735
|
}).pipe(Prompt5.run),
|
|
756
736
|
onSome: () => Effect7.succeed(enabled)
|
|
757
737
|
});
|
|
758
|
-
Obj2.
|
|
759
|
-
|
|
738
|
+
Obj2.update(trigger2, (trigger3) => {
|
|
739
|
+
trigger3.enabled = enabledValue;
|
|
760
740
|
});
|
|
761
741
|
});
|
|
762
742
|
|
|
763
|
-
// src/
|
|
743
|
+
// src/commands/trigger/update/subscription.ts
|
|
764
744
|
import * as Command8 from "@effect/cli/Command";
|
|
765
745
|
import * as Options8 from "@effect/cli/Options";
|
|
766
746
|
import * as Prompt6 from "@effect/cli/Prompt";
|
|
@@ -771,9 +751,8 @@ import * as Option7 from "effect/Option";
|
|
|
771
751
|
import { CommandConfig as CommandConfig7 } from "@dxos/cli-util";
|
|
772
752
|
import { flushAndSync as flushAndSync5, print as print6, spaceLayer as spaceLayer7, withTypes as withTypes6 } from "@dxos/cli-util";
|
|
773
753
|
import { Common as Common7 } from "@dxos/cli-util";
|
|
774
|
-
import {
|
|
775
|
-
import {
|
|
776
|
-
import { Operation as Operation6 } from "@dxos/operation";
|
|
754
|
+
import { Operation as Operation6, Trigger as Trigger8 } from "@dxos/compute";
|
|
755
|
+
import { DXN as DXN4, Database as Database8, Filter as Filter7, JsonSchema as JsonSchema5, Obj as Obj3, Query as Query4, Ref as Ref6 } from "@dxos/echo";
|
|
777
756
|
var subscription2 = Command8.make("subscription", {
|
|
778
757
|
spaceId: Common7.spaceId.pipe(Options8.optional),
|
|
779
758
|
id: TriggerId.pipe(Options8.optional),
|
|
@@ -840,8 +819,8 @@ var updateFunction2 = Effect8.fn(function* (trigger2, functionIdOption) {
|
|
|
840
819
|
if (!foundFn || !Obj3.instanceOf(Operation6.PersistentOperation, foundFn)) {
|
|
841
820
|
return yield* Effect8.fail(new Error(`Function not found: ${functionId}`));
|
|
842
821
|
}
|
|
843
|
-
Obj3.
|
|
844
|
-
|
|
822
|
+
Obj3.update(trigger2, (trigger3) => {
|
|
823
|
+
trigger3.function = Ref6.make(foundFn);
|
|
845
824
|
});
|
|
846
825
|
currentFn = foundFn;
|
|
847
826
|
}
|
|
@@ -880,7 +859,7 @@ var updateSpec = Effect8.fn(function* (trigger2, typenameOption, deepOption, del
|
|
|
880
859
|
}).pipe(Prompt6.run),
|
|
881
860
|
onSome: (value2) => Effect8.succeed(value2)
|
|
882
861
|
});
|
|
883
|
-
const queryAst =
|
|
862
|
+
const queryAst = Query4.select(Filter7.type(typename)).ast;
|
|
884
863
|
const deepOptionValue = yield* Option7.match(deepOption, {
|
|
885
864
|
onNone: () => Prompt6.confirm({
|
|
886
865
|
message: "Watch changes to nested properties (deep)?",
|
|
@@ -905,8 +884,8 @@ var updateSpec = Effect8.fn(function* (trigger2, typenameOption, deepOption, del
|
|
|
905
884
|
if (Option7.isSome(delayOptionValue)) {
|
|
906
885
|
subscriptionOptions.delay = delayOptionValue.value;
|
|
907
886
|
}
|
|
908
|
-
Obj3.
|
|
909
|
-
const spec =
|
|
887
|
+
Obj3.update(trigger2, (trigger3) => {
|
|
888
|
+
const spec = trigger3.spec;
|
|
910
889
|
if (spec?.kind === "subscription") {
|
|
911
890
|
spec.query = {
|
|
912
891
|
ast: queryAst
|
|
@@ -934,8 +913,8 @@ var updateInput2 = Effect8.fn(function* (trigger2, fn6, inputOption) {
|
|
|
934
913
|
onNone: () => promptForSchemaInput(fn6.inputSchema ? JsonSchema5.toEffectSchema(fn6.inputSchema) : void 0, currentInput),
|
|
935
914
|
onSome: (value2) => Effect8.succeed(value2)
|
|
936
915
|
});
|
|
937
|
-
Obj3.
|
|
938
|
-
|
|
916
|
+
Obj3.update(trigger2, (trigger3) => {
|
|
917
|
+
trigger3.input = inputObj;
|
|
939
918
|
});
|
|
940
919
|
}
|
|
941
920
|
});
|
|
@@ -947,12 +926,12 @@ var updateEnabled2 = Effect8.fn(function* (trigger2, idOption, enabled) {
|
|
|
947
926
|
}).pipe(Prompt6.run),
|
|
948
927
|
onSome: () => Effect8.succeed(enabled)
|
|
949
928
|
});
|
|
950
|
-
Obj3.
|
|
951
|
-
|
|
929
|
+
Obj3.update(trigger2, (trigger3) => {
|
|
930
|
+
trigger3.enabled = enabledValue;
|
|
952
931
|
});
|
|
953
932
|
});
|
|
954
933
|
|
|
955
|
-
// src/
|
|
934
|
+
// src/commands/trigger/update/timer.ts
|
|
956
935
|
import * as Command9 from "@effect/cli/Command";
|
|
957
936
|
import * as Options9 from "@effect/cli/Options";
|
|
958
937
|
import * as Prompt7 from "@effect/cli/Prompt";
|
|
@@ -962,9 +941,8 @@ import * as Option8 from "effect/Option";
|
|
|
962
941
|
import { CommandConfig as CommandConfig8 } from "@dxos/cli-util";
|
|
963
942
|
import { flushAndSync as flushAndSync6, print as print7, spaceLayer as spaceLayer8, withTypes as withTypes7 } from "@dxos/cli-util";
|
|
964
943
|
import { Common as Common8 } from "@dxos/cli-util";
|
|
944
|
+
import { Operation as Operation7, Trigger as Trigger9 } from "@dxos/compute";
|
|
965
945
|
import { DXN as DXN5, Database as Database9, Filter as Filter8, JsonSchema as JsonSchema6, Obj as Obj4, Ref as Ref7 } from "@dxos/echo";
|
|
966
|
-
import { Trigger as Trigger9 } from "@dxos/functions";
|
|
967
|
-
import { Operation as Operation7 } from "@dxos/operation";
|
|
968
946
|
var timer2 = Command9.make("timer", {
|
|
969
947
|
spaceId: Common8.spaceId.pipe(Options9.optional),
|
|
970
948
|
id: TriggerId.pipe(Options9.optional),
|
|
@@ -1019,8 +997,8 @@ var updateFunction3 = Effect9.fn(function* (trigger2, functionIdOption) {
|
|
|
1019
997
|
if (!foundFn || !Obj4.instanceOf(Operation7.PersistentOperation, foundFn)) {
|
|
1020
998
|
return yield* Effect9.fail(new Error(`Function not found: ${functionId}`));
|
|
1021
999
|
}
|
|
1022
|
-
Obj4.
|
|
1023
|
-
|
|
1000
|
+
Obj4.update(trigger2, (trigger3) => {
|
|
1001
|
+
trigger3.function = Ref7.make(foundFn);
|
|
1024
1002
|
});
|
|
1025
1003
|
currentFn = foundFn;
|
|
1026
1004
|
}
|
|
@@ -1046,9 +1024,9 @@ var updateCron = Effect9.fn(function* (trigger2, cronOption) {
|
|
|
1046
1024
|
}).pipe(Prompt7.run),
|
|
1047
1025
|
onSome: (value2) => Effect9.succeed(value2)
|
|
1048
1026
|
});
|
|
1049
|
-
Obj4.
|
|
1050
|
-
if (
|
|
1051
|
-
|
|
1027
|
+
Obj4.update(trigger2, (trigger3) => {
|
|
1028
|
+
if (trigger3.spec?.kind === "timer") {
|
|
1029
|
+
trigger3.spec.cron = cron;
|
|
1052
1030
|
}
|
|
1053
1031
|
});
|
|
1054
1032
|
}
|
|
@@ -1071,8 +1049,8 @@ var updateInput3 = Effect9.fn(function* (trigger2, fn6, inputOption) {
|
|
|
1071
1049
|
onNone: () => promptForSchemaInput(fn6.inputSchema ? JsonSchema6.toEffectSchema(fn6.inputSchema) : void 0, currentInput),
|
|
1072
1050
|
onSome: (value2) => Effect9.succeed(value2)
|
|
1073
1051
|
});
|
|
1074
|
-
Obj4.
|
|
1075
|
-
|
|
1052
|
+
Obj4.update(trigger2, (trigger3) => {
|
|
1053
|
+
trigger3.input = inputObj;
|
|
1076
1054
|
});
|
|
1077
1055
|
}
|
|
1078
1056
|
});
|
|
@@ -1084,19 +1062,19 @@ var updateEnabled3 = Effect9.fn(function* (trigger2, idOption, enabled) {
|
|
|
1084
1062
|
}).pipe(Prompt7.run),
|
|
1085
1063
|
onSome: () => Effect9.succeed(enabled)
|
|
1086
1064
|
});
|
|
1087
|
-
Obj4.
|
|
1088
|
-
|
|
1065
|
+
Obj4.update(trigger2, (trigger3) => {
|
|
1066
|
+
trigger3.enabled = enabledValue;
|
|
1089
1067
|
});
|
|
1090
1068
|
});
|
|
1091
1069
|
|
|
1092
|
-
// src/
|
|
1070
|
+
// src/commands/trigger/update/index.ts
|
|
1093
1071
|
var update = Command10.make("update").pipe(Command10.withDescription("Update a trigger."), Command10.withSubcommands([
|
|
1094
1072
|
subscription2,
|
|
1095
1073
|
timer2,
|
|
1096
1074
|
queue2
|
|
1097
1075
|
]));
|
|
1098
1076
|
|
|
1099
|
-
// src/
|
|
1077
|
+
// src/commands/trigger/index.ts
|
|
1100
1078
|
var trigger = Command11.make("trigger").pipe(Command11.withDescription("Manage EDGE triggers."), Command11.withSubcommands([
|
|
1101
1079
|
create,
|
|
1102
1080
|
list,
|
|
@@ -1104,19 +1082,31 @@ var trigger = Command11.make("trigger").pipe(Command11.withDescription("Manage E
|
|
|
1104
1082
|
update
|
|
1105
1083
|
]));
|
|
1106
1084
|
|
|
1107
|
-
// src/
|
|
1108
|
-
var AutomationPlugin = Plugin.define(meta).pipe(AppPlugin.
|
|
1085
|
+
// src/AutomationPlugin.node.ts
|
|
1086
|
+
var AutomationPlugin = Plugin.define(meta).pipe(AppPlugin.addAppGraphModule({
|
|
1087
|
+
activate: AppGraphBuilder
|
|
1088
|
+
}), AppPlugin.addCommandModule({
|
|
1109
1089
|
commands: [
|
|
1110
1090
|
trigger
|
|
1111
1091
|
]
|
|
1092
|
+
}), AppPlugin.addOperationHandlerModule({
|
|
1093
|
+
activate: OperationHandler
|
|
1094
|
+
}), AppPlugin.addSchemaModule({
|
|
1095
|
+
schema: [
|
|
1096
|
+
Operation8.PersistentOperation,
|
|
1097
|
+
Trigger10.Trigger,
|
|
1098
|
+
Trace.Message
|
|
1099
|
+
]
|
|
1112
1100
|
}), Plugin.addModule({
|
|
1113
1101
|
activatesOn: ClientEvents.ClientReady,
|
|
1114
|
-
|
|
1102
|
+
firesAfterActivation: [
|
|
1115
1103
|
AutomationEvents.ComputeRuntimeReady
|
|
1116
1104
|
],
|
|
1117
1105
|
activate: ComputeRuntime
|
|
1118
1106
|
}), Plugin.make);
|
|
1107
|
+
var AutomationPlugin_node_default = AutomationPlugin;
|
|
1119
1108
|
export {
|
|
1120
|
-
AutomationPlugin
|
|
1109
|
+
AutomationPlugin,
|
|
1110
|
+
AutomationPlugin_node_default as default
|
|
1121
1111
|
};
|
|
1122
|
-
//# sourceMappingURL=
|
|
1112
|
+
//# sourceMappingURL=AutomationPlugin.node.mjs.map
|