@antelopejs/dms-automation 0.0.1
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 +190 -0
- package/README.md +95 -0
- package/dist/cluster/bus.d.ts +17 -0
- package/dist/cluster/bus.js +82 -0
- package/dist/cluster/bus.js.map +1 -0
- package/dist/cluster/instance.d.ts +1 -0
- package/dist/cluster/instance.js +6 -0
- package/dist/cluster/instance.js.map +1 -0
- package/dist/cluster/leader.d.ts +7 -0
- package/dist/cluster/leader.js +123 -0
- package/dist/cluster/leader.js.map +1 -0
- package/dist/cluster/mode.d.ts +3 -0
- package/dist/cluster/mode.js +25 -0
- package/dist/cluster/mode.js.map +1 -0
- package/dist/data/procedures-table.d.ts +66 -0
- package/dist/data/procedures-table.js +271 -0
- package/dist/data/procedures-table.js.map +1 -0
- package/dist/data/runs-table.d.ts +23 -0
- package/dist/data/runs-table.js +125 -0
- package/dist/data/runs-table.js.map +1 -0
- package/dist/db/index.d.ts +7 -0
- package/dist/db/index.js +24 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/models/automation_template.model.d.ts +58 -0
- package/dist/db/models/automation_template.model.js +134 -0
- package/dist/db/models/automation_template.model.js.map +1 -0
- package/dist/db/models/index.d.ts +3 -0
- package/dist/db/models/index.js +20 -0
- package/dist/db/models/index.js.map +1 -0
- package/dist/db/models/procedure.model.d.ts +25 -0
- package/dist/db/models/procedure.model.js +28 -0
- package/dist/db/models/procedure.model.js.map +1 -0
- package/dist/db/models/procedure_run.model.d.ts +34 -0
- package/dist/db/models/procedure_run.model.js +39 -0
- package/dist/db/models/procedure_run.model.js.map +1 -0
- package/dist/db/models/stats.model.d.ts +73 -0
- package/dist/db/models/stats.model.js +267 -0
- package/dist/db/models/stats.model.js.map +1 -0
- package/dist/db/models/type_config.model.d.ts +47 -0
- package/dist/db/models/type_config.model.js +51 -0
- package/dist/db/models/type_config.model.js.map +1 -0
- package/dist/db/tables/action_type_config.table.d.ts +7 -0
- package/dist/db/tables/action_type_config.table.js +35 -0
- package/dist/db/tables/action_type_config.table.js.map +1 -0
- package/dist/db/tables/automation_template.table.d.ts +11 -0
- package/dist/db/tables/automation_template.table.js +52 -0
- package/dist/db/tables/automation_template.table.js.map +1 -0
- package/dist/db/tables/index.d.ts +5 -0
- package/dist/db/tables/index.js +22 -0
- package/dist/db/tables/index.js.map +1 -0
- package/dist/db/tables/procedure.table.d.ts +10 -0
- package/dist/db/tables/procedure.table.js +48 -0
- package/dist/db/tables/procedure.table.js.map +1 -0
- package/dist/db/tables/procedure_run.table.d.ts +13 -0
- package/dist/db/tables/procedure_run.table.js +57 -0
- package/dist/db/tables/procedure_run.table.js.map +1 -0
- package/dist/db/tables/trigger_type_config.table.d.ts +7 -0
- package/dist/db/tables/trigger_type_config.table.js +35 -0
- package/dist/db/tables/trigger_type_config.table.js.map +1 -0
- package/dist/implementations/dms-automation/index.d.ts +19 -0
- package/dist/implementations/dms-automation/index.js +50 -0
- package/dist/implementations/dms-automation/index.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +121 -0
- package/dist/index.js.map +1 -0
- package/dist/pages/builder.d.ts +10 -0
- package/dist/pages/builder.js +28 -0
- package/dist/pages/builder.js.map +1 -0
- package/dist/pages/category.d.ts +1 -0
- package/dist/pages/category.js +10 -0
- package/dist/pages/category.js.map +1 -0
- package/dist/pages/index.d.ts +6 -0
- package/dist/pages/index.js +9 -0
- package/dist/pages/index.js.map +1 -0
- package/dist/pages/library.d.ts +10 -0
- package/dist/pages/library.js +28 -0
- package/dist/pages/library.js.map +1 -0
- package/dist/pages/overview.d.ts +10 -0
- package/dist/pages/overview.js +28 -0
- package/dist/pages/overview.js.map +1 -0
- package/dist/pages/procedures.d.ts +10 -0
- package/dist/pages/procedures.js +72 -0
- package/dist/pages/procedures.js.map +1 -0
- package/dist/pages/runs.d.ts +11 -0
- package/dist/pages/runs.js +61 -0
- package/dist/pages/runs.js.map +1 -0
- package/dist/routes/action-types.d.ts +23 -0
- package/dist/routes/action-types.js +80 -0
- package/dist/routes/action-types.js.map +1 -0
- package/dist/routes/data-node-types.d.ts +6 -0
- package/dist/routes/data-node-types.js +36 -0
- package/dist/routes/data-node-types.js.map +1 -0
- package/dist/routes/graphSchema.d.ts +92 -0
- package/dist/routes/graphSchema.js +60 -0
- package/dist/routes/graphSchema.js.map +1 -0
- package/dist/routes/index.d.ts +8 -0
- package/dist/routes/index.js +11 -0
- package/dist/routes/index.js.map +1 -0
- package/dist/routes/node-kinds.d.ts +9 -0
- package/dist/routes/node-kinds.js +35 -0
- package/dist/routes/node-kinds.js.map +1 -0
- package/dist/routes/procedures.d.ts +23 -0
- package/dist/routes/procedures.js +181 -0
- package/dist/routes/procedures.js.map +1 -0
- package/dist/routes/runs.d.ts +7 -0
- package/dist/routes/runs.js +81 -0
- package/dist/routes/runs.js.map +1 -0
- package/dist/routes/stats.d.ts +6 -0
- package/dist/routes/stats.js +35 -0
- package/dist/routes/stats.js.map +1 -0
- package/dist/routes/templates.d.ts +20 -0
- package/dist/routes/templates.js +243 -0
- package/dist/routes/templates.js.map +1 -0
- package/dist/routes/trigger-types.d.ts +24 -0
- package/dist/routes/trigger-types.js +80 -0
- package/dist/routes/trigger-types.js.map +1 -0
- package/dist/routes/typeConfigShared.d.ts +22 -0
- package/dist/routes/typeConfigShared.js +37 -0
- package/dist/routes/typeConfigShared.js.map +1 -0
- package/dist/runtime/builtins/actions/http.d.ts +13 -0
- package/dist/runtime/builtins/actions/http.js +47 -0
- package/dist/runtime/builtins/actions/http.js.map +1 -0
- package/dist/runtime/builtins/actions/index.d.ts +2 -0
- package/dist/runtime/builtins/actions/index.js +7 -0
- package/dist/runtime/builtins/actions/index.js.map +1 -0
- package/dist/runtime/builtins/actions/log.d.ts +13 -0
- package/dist/runtime/builtins/actions/log.js +49 -0
- package/dist/runtime/builtins/actions/log.js.map +1 -0
- package/dist/runtime/builtins/data/boolean.d.ts +2 -0
- package/dist/runtime/builtins/data/boolean.js +39 -0
- package/dist/runtime/builtins/data/boolean.js.map +1 -0
- package/dist/runtime/builtins/data/compare.d.ts +2 -0
- package/dist/runtime/builtins/data/compare.js +29 -0
- package/dist/runtime/builtins/data/compare.js.map +1 -0
- package/dist/runtime/builtins/data/constant.d.ts +2 -0
- package/dist/runtime/builtins/data/constant.js +29 -0
- package/dist/runtime/builtins/data/constant.js.map +1 -0
- package/dist/runtime/builtins/data/index.d.ts +2 -0
- package/dist/runtime/builtins/data/index.js +20 -0
- package/dist/runtime/builtins/data/index.js.map +1 -0
- package/dist/runtime/builtins/data/json.d.ts +2 -0
- package/dist/runtime/builtins/data/json.js +46 -0
- package/dist/runtime/builtins/data/json.js.map +1 -0
- package/dist/runtime/builtins/data/math.d.ts +2 -0
- package/dist/runtime/builtins/data/math.js +53 -0
- package/dist/runtime/builtins/data/math.js.map +1 -0
- package/dist/runtime/builtins/data/object.d.ts +2 -0
- package/dist/runtime/builtins/data/object.js +121 -0
- package/dist/runtime/builtins/data/object.js.map +1 -0
- package/dist/runtime/builtins/data/string.d.ts +2 -0
- package/dist/runtime/builtins/data/string.js +143 -0
- package/dist/runtime/builtins/data/string.js.map +1 -0
- package/dist/runtime/builtins/index.d.ts +17 -0
- package/dist/runtime/builtins/index.js +24 -0
- package/dist/runtime/builtins/index.js.map +1 -0
- package/dist/runtime/builtins/nodes/action.d.ts +1 -0
- package/dist/runtime/builtins/nodes/action.js +36 -0
- package/dist/runtime/builtins/nodes/action.js.map +1 -0
- package/dist/runtime/builtins/nodes/data.d.ts +1 -0
- package/dist/runtime/builtins/nodes/data.js +28 -0
- package/dist/runtime/builtins/nodes/data.js.map +1 -0
- package/dist/runtime/builtins/nodes/delay.d.ts +1 -0
- package/dist/runtime/builtins/nodes/delay.js +41 -0
- package/dist/runtime/builtins/nodes/delay.js.map +1 -0
- package/dist/runtime/builtins/nodes/forRange.d.ts +1 -0
- package/dist/runtime/builtins/nodes/forRange.js +52 -0
- package/dist/runtime/builtins/nodes/forRange.js.map +1 -0
- package/dist/runtime/builtins/nodes/foreach.d.ts +1 -0
- package/dist/runtime/builtins/nodes/foreach.js +31 -0
- package/dist/runtime/builtins/nodes/foreach.js.map +1 -0
- package/dist/runtime/builtins/nodes/groupInput.d.ts +1 -0
- package/dist/runtime/builtins/nodes/groupInput.js +11 -0
- package/dist/runtime/builtins/nodes/groupInput.js.map +1 -0
- package/dist/runtime/builtins/nodes/groupOutput.d.ts +1 -0
- package/dist/runtime/builtins/nodes/groupOutput.js +11 -0
- package/dist/runtime/builtins/nodes/groupOutput.js.map +1 -0
- package/dist/runtime/builtins/nodes/if.d.ts +1 -0
- package/dist/runtime/builtins/nodes/if.js +23 -0
- package/dist/runtime/builtins/nodes/if.js.map +1 -0
- package/dist/runtime/builtins/nodes/parallel.d.ts +1 -0
- package/dist/runtime/builtins/nodes/parallel.js +34 -0
- package/dist/runtime/builtins/nodes/parallel.js.map +1 -0
- package/dist/runtime/builtins/nodes/retry.d.ts +1 -0
- package/dist/runtime/builtins/nodes/retry.js +46 -0
- package/dist/runtime/builtins/nodes/retry.js.map +1 -0
- package/dist/runtime/builtins/nodes/setVariable.d.ts +1 -0
- package/dist/runtime/builtins/nodes/setVariable.js +31 -0
- package/dist/runtime/builtins/nodes/setVariable.js.map +1 -0
- package/dist/runtime/builtins/nodes/switch.d.ts +1 -0
- package/dist/runtime/builtins/nodes/switch.js +33 -0
- package/dist/runtime/builtins/nodes/switch.js.map +1 -0
- package/dist/runtime/builtins/nodes/trigger.d.ts +1 -0
- package/dist/runtime/builtins/nodes/trigger.js +25 -0
- package/dist/runtime/builtins/nodes/trigger.js.map +1 -0
- package/dist/runtime/builtins/nodes/tryCatch.d.ts +1 -0
- package/dist/runtime/builtins/nodes/tryCatch.js +35 -0
- package/dist/runtime/builtins/nodes/tryCatch.js.map +1 -0
- package/dist/runtime/builtins/triggers/cron.d.ts +9 -0
- package/dist/runtime/builtins/triggers/cron.js +52 -0
- package/dist/runtime/builtins/triggers/cron.js.map +1 -0
- package/dist/runtime/builtins/triggers/index.d.ts +2 -0
- package/dist/runtime/builtins/triggers/index.js +12 -0
- package/dist/runtime/builtins/triggers/index.js.map +1 -0
- package/dist/runtime/builtins/triggers/manual.d.ts +3 -0
- package/dist/runtime/builtins/triggers/manual.js +20 -0
- package/dist/runtime/builtins/triggers/manual.js.map +1 -0
- package/dist/runtime/builtins/triggers/webhook.d.ts +14 -0
- package/dist/runtime/builtins/triggers/webhook.js +90 -0
- package/dist/runtime/builtins/triggers/webhook.js.map +1 -0
- package/dist/runtime/executionResult.d.ts +6 -0
- package/dist/runtime/executionResult.js +3 -0
- package/dist/runtime/executionResult.js.map +1 -0
- package/dist/runtime/executor.d.ts +9 -0
- package/dist/runtime/executor.js +300 -0
- package/dist/runtime/executor.js.map +1 -0
- package/dist/runtime/flatten.d.ts +3 -0
- package/dist/runtime/flatten.js +188 -0
- package/dist/runtime/flatten.js.map +1 -0
- package/dist/runtime/nodeKinds.d.ts +64 -0
- package/dist/runtime/nodeKinds.js +43 -0
- package/dist/runtime/nodeKinds.js.map +1 -0
- package/dist/runtime/reconcileDiff.d.ts +9 -0
- package/dist/runtime/reconcileDiff.js +26 -0
- package/dist/runtime/reconcileDiff.js.map +1 -0
- package/dist/runtime/registry.d.ts +19 -0
- package/dist/runtime/registry.js +47 -0
- package/dist/runtime/registry.js.map +1 -0
- package/dist/runtime/resolveInputs.d.ts +14 -0
- package/dist/runtime/resolveInputs.js +64 -0
- package/dist/runtime/resolveInputs.js.map +1 -0
- package/dist/runtime/resolveSubgraph.d.ts +7 -0
- package/dist/runtime/resolveSubgraph.js +15 -0
- package/dist/runtime/resolveSubgraph.js.map +1 -0
- package/dist/runtime/subscriptions.d.ts +16 -0
- package/dist/runtime/subscriptions.js +419 -0
- package/dist/runtime/subscriptions.js.map +1 -0
- package/dist/runtime/subwalk.d.ts +17 -0
- package/dist/runtime/subwalk.js +74 -0
- package/dist/runtime/subwalk.js.map +1 -0
- package/dist/runtime/topo.d.ts +3 -0
- package/dist/runtime/topo.js +75 -0
- package/dist/runtime/topo.js.map +1 -0
- package/dist/runtime/typeOrigin.d.ts +7 -0
- package/dist/runtime/typeOrigin.js +24 -0
- package/dist/runtime/typeOrigin.js.map +1 -0
- package/dist/runtime/validate.d.ts +10 -0
- package/dist/runtime/validate.js +185 -0
- package/dist/runtime/validate.js.map +1 -0
- package/dist/runtime/validateTemplate.d.ts +3 -0
- package/dist/runtime/validateTemplate.js +54 -0
- package/dist/runtime/validateTemplate.js.map +1 -0
- package/dist/types/constants.d.ts +6 -0
- package/dist/types/constants.js +10 -0
- package/dist/types/constants.js.map +1 -0
- package/dist/types/graph.d.ts +51 -0
- package/dist/types/graph.js +23 -0
- package/dist/types/graph.js.map +1 -0
- package/dist/types/pagination.d.ts +8 -0
- package/dist/types/pagination.js +3 -0
- package/dist/types/pagination.js.map +1 -0
- package/dist/types/runLog.d.ts +26 -0
- package/dist/types/runLog.js +3 -0
- package/dist/types/runLog.js.map +1 -0
- package/frontend-vue/.prettierignore +4 -0
- package/frontend-vue/app/components/Actions.vue +141 -0
- package/frontend-vue/app/components/Catalog/TypeConfigForm.vue +166 -0
- package/frontend-vue/app/components/Catalog/TypeList.vue +198 -0
- package/frontend-vue/app/components/DataNodes.vue +259 -0
- package/frontend-vue/app/components/Editor/BuilderPalette.vue +234 -0
- package/frontend-vue/app/components/Editor/GraphCanvas.vue +994 -0
- package/frontend-vue/app/components/Editor/GroupPortEditor.vue +289 -0
- package/frontend-vue/app/components/Editor/JsonField.vue +63 -0
- package/frontend-vue/app/components/Editor/NodeInspector.vue +356 -0
- package/frontend-vue/app/components/Editor/ProcedureList.vue +156 -0
- package/frontend-vue/app/components/Editor/RunsDrawer.vue +312 -0
- package/frontend-vue/app/components/Editor/WiredField.vue +42 -0
- package/frontend-vue/app/components/Editor/nodes/GenericNode.vue +161 -0
- package/frontend-vue/app/components/Editor/nodes/GroupInputNode.vue +19 -0
- package/frontend-vue/app/components/Editor/nodes/GroupNode.vue +200 -0
- package/frontend-vue/app/components/Editor/nodes/GroupOutputNode.vue +19 -0
- package/frontend-vue/app/components/Editor/nodes/GroupSentinel.vue +161 -0
- package/frontend-vue/app/components/Editor/nodes/styles.ts +53 -0
- package/frontend-vue/app/components/Editor.vue +2504 -0
- package/frontend-vue/app/components/Library.vue +67 -0
- package/frontend-vue/app/components/Overview.vue +503 -0
- package/frontend-vue/app/components/RunDetailDrawer.vue +165 -0
- package/frontend-vue/app/components/RunFireTree.vue +170 -0
- package/frontend-vue/app/components/RunTraceDrawer.vue +59 -0
- package/frontend-vue/app/components/RunsStats.vue +126 -0
- package/frontend-vue/app/components/RunsTimelineDisplay.vue +287 -0
- package/frontend-vue/app/components/Templates.vue +663 -0
- package/frontend-vue/app/components/Triggers.vue +137 -0
- package/frontend-vue/app/composables/useAutomationNodeKinds.ts +48 -0
- package/frontend-vue/app/composables/useAutomationRuns.ts +75 -0
- package/frontend-vue/app/composables/useGraphConnect.ts +542 -0
- package/frontend-vue/app/plugins/runs-timeline-display.client.ts +16 -0
- package/frontend-vue/app/utils/automation.ts +51 -0
- package/frontend-vue/dms.frontend.ts +26 -0
- package/frontend-vue/eslint.config.mjs +24 -0
- package/frontend-vue/i18n/locales/dms-automation-en-GB.json +369 -0
- package/frontend-vue/i18n/locales/dms-automation-fr-FR.json +369 -0
- package/frontend-vue/package.json +33 -0
- package/frontend-vue/pnpm-lock.yaml +6483 -0
- package/frontend-vue/pnpm-workspace.yaml +2 -0
- package/package.json +81 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { GraphNode, GroupPort, ProcedureGraph } from "../types/graph";
|
|
3
|
+
export declare const groupPortSchema: z.ZodType<GroupPort>;
|
|
4
|
+
export declare const triggerEdgeSchema: z.ZodObject<{
|
|
5
|
+
id: z.ZodString;
|
|
6
|
+
from: z.ZodObject<{
|
|
7
|
+
node: z.ZodString;
|
|
8
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
node: string;
|
|
11
|
+
branch?: string | undefined;
|
|
12
|
+
}, {
|
|
13
|
+
node: string;
|
|
14
|
+
branch?: string | undefined;
|
|
15
|
+
}>;
|
|
16
|
+
to: z.ZodObject<{
|
|
17
|
+
node: z.ZodString;
|
|
18
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
|
20
|
+
node: string;
|
|
21
|
+
branch?: string | undefined;
|
|
22
|
+
}, {
|
|
23
|
+
node: string;
|
|
24
|
+
branch?: string | undefined;
|
|
25
|
+
}>;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
id: string;
|
|
28
|
+
from: {
|
|
29
|
+
node: string;
|
|
30
|
+
branch?: string | undefined;
|
|
31
|
+
};
|
|
32
|
+
to: {
|
|
33
|
+
node: string;
|
|
34
|
+
branch?: string | undefined;
|
|
35
|
+
};
|
|
36
|
+
}, {
|
|
37
|
+
id: string;
|
|
38
|
+
from: {
|
|
39
|
+
node: string;
|
|
40
|
+
branch?: string | undefined;
|
|
41
|
+
};
|
|
42
|
+
to: {
|
|
43
|
+
node: string;
|
|
44
|
+
branch?: string | undefined;
|
|
45
|
+
};
|
|
46
|
+
}>;
|
|
47
|
+
export declare const dataEdgeSchema: z.ZodObject<{
|
|
48
|
+
id: z.ZodString;
|
|
49
|
+
from: z.ZodObject<{
|
|
50
|
+
node: z.ZodString;
|
|
51
|
+
port: z.ZodString;
|
|
52
|
+
}, "strip", z.ZodTypeAny, {
|
|
53
|
+
port: string;
|
|
54
|
+
node: string;
|
|
55
|
+
}, {
|
|
56
|
+
port: string;
|
|
57
|
+
node: string;
|
|
58
|
+
}>;
|
|
59
|
+
to: z.ZodObject<{
|
|
60
|
+
node: z.ZodString;
|
|
61
|
+
field: z.ZodString;
|
|
62
|
+
}, "strip", z.ZodTypeAny, {
|
|
63
|
+
node: string;
|
|
64
|
+
field: string;
|
|
65
|
+
}, {
|
|
66
|
+
node: string;
|
|
67
|
+
field: string;
|
|
68
|
+
}>;
|
|
69
|
+
}, "strip", z.ZodTypeAny, {
|
|
70
|
+
id: string;
|
|
71
|
+
from: {
|
|
72
|
+
port: string;
|
|
73
|
+
node: string;
|
|
74
|
+
};
|
|
75
|
+
to: {
|
|
76
|
+
node: string;
|
|
77
|
+
field: string;
|
|
78
|
+
};
|
|
79
|
+
}, {
|
|
80
|
+
id: string;
|
|
81
|
+
from: {
|
|
82
|
+
port: string;
|
|
83
|
+
node: string;
|
|
84
|
+
};
|
|
85
|
+
to: {
|
|
86
|
+
node: string;
|
|
87
|
+
field: string;
|
|
88
|
+
};
|
|
89
|
+
}>;
|
|
90
|
+
export declare const procedureGraphSchema: z.ZodType<ProcedureGraph>;
|
|
91
|
+
export declare const graphNodeSchema: z.ZodType<GraphNode>;
|
|
92
|
+
export declare function parseAndValidate<T>(schema: z.ZodType<T>, body: unknown, graphSelector: (data: T) => ProcedureGraph): T;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.graphNodeSchema = exports.procedureGraphSchema = exports.dataEdgeSchema = exports.triggerEdgeSchema = exports.groupPortSchema = void 0;
|
|
4
|
+
exports.parseAndValidate = parseAndValidate;
|
|
5
|
+
const interface_api_1 = require("@antelopejs/interface-api");
|
|
6
|
+
const zod_1 = require("zod");
|
|
7
|
+
const nodeKinds_1 = require("../runtime/nodeKinds");
|
|
8
|
+
const validate_1 = require("../runtime/validate");
|
|
9
|
+
const nodeKindSchema = (0, nodeKinds_1.nodeKindZodSchema)();
|
|
10
|
+
exports.groupPortSchema = zod_1.z.object({
|
|
11
|
+
name: zod_1.z.string().min(1),
|
|
12
|
+
kind: zod_1.z.enum(["data", "trigger"]),
|
|
13
|
+
direction: zod_1.z.enum(["in", "out"]),
|
|
14
|
+
schema: zod_1.z.record(zod_1.z.unknown()).optional(),
|
|
15
|
+
});
|
|
16
|
+
exports.triggerEdgeSchema = zod_1.z.object({
|
|
17
|
+
id: zod_1.z.string(),
|
|
18
|
+
from: zod_1.z.object({ node: zod_1.z.string(), branch: zod_1.z.string().optional() }),
|
|
19
|
+
to: zod_1.z.object({ node: zod_1.z.string(), branch: zod_1.z.string().optional() }),
|
|
20
|
+
});
|
|
21
|
+
exports.dataEdgeSchema = zod_1.z.object({
|
|
22
|
+
id: zod_1.z.string(),
|
|
23
|
+
from: zod_1.z.object({ node: zod_1.z.string(), port: zod_1.z.string() }),
|
|
24
|
+
to: zod_1.z.object({ node: zod_1.z.string(), field: zod_1.z.string() }),
|
|
25
|
+
});
|
|
26
|
+
exports.procedureGraphSchema = zod_1.z.lazy(() => zod_1.z.object({
|
|
27
|
+
nodes: zod_1.z.array(exports.graphNodeSchema),
|
|
28
|
+
triggerEdges: zod_1.z.array(exports.triggerEdgeSchema),
|
|
29
|
+
dataEdges: zod_1.z.array(exports.dataEdgeSchema),
|
|
30
|
+
}));
|
|
31
|
+
exports.graphNodeSchema = zod_1.z.lazy(() => zod_1.z
|
|
32
|
+
.object({
|
|
33
|
+
id: zod_1.z.string(),
|
|
34
|
+
kind: nodeKindSchema,
|
|
35
|
+
typeId: zod_1.z.string().optional(),
|
|
36
|
+
config: zod_1.z.record(zod_1.z.unknown()),
|
|
37
|
+
position: zod_1.z.object({ x: zod_1.z.number(), y: zod_1.z.number() }),
|
|
38
|
+
templateId: zod_1.z.string().optional(),
|
|
39
|
+
ports: zod_1.z.array(zod_1.z.lazy(() => exports.groupPortSchema)).optional(),
|
|
40
|
+
subgraph: exports.procedureGraphSchema.optional(),
|
|
41
|
+
})
|
|
42
|
+
.passthrough());
|
|
43
|
+
function parseAndValidate(schema, body, graphSelector) {
|
|
44
|
+
const parsed = schema.safeParse(body);
|
|
45
|
+
if (!parsed.success) {
|
|
46
|
+
throw new interface_api_1.HTTPResult(400, {
|
|
47
|
+
error: "invalid body",
|
|
48
|
+
issues: parsed.error.issues,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
const verdict = (0, validate_1.validateGraph)(graphSelector(parsed.data));
|
|
52
|
+
if (!verdict.ok) {
|
|
53
|
+
throw new interface_api_1.HTTPResult(400, {
|
|
54
|
+
error: "invalid graph",
|
|
55
|
+
issues: verdict.errors,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return parsed.data;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=graphSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphSchema.js","sourceRoot":"","sources":["../../src/routes/graphSchema.ts"],"names":[],"mappings":";;;AAoEA,4CAoBC;AAxFD,6DAAuD;AACvD,6BAAwB;AACxB,oDAAyD;AACzD,kDAAyE;AAWzE,MAAM,cAAc,GAAG,IAAA,6BAAiB,GAAE,CAAC;AAE9B,QAAA,eAAe,GAAyB,OAAC,CAAC,MAAM,CAAC;IAC5D,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,IAAI,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACjC,SAAS,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAChC,MAAM,EAAE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;CACzC,CAAC,CAAC;AAEU,QAAA,iBAAiB,GAAG,OAAC,CAAC,MAAM,CAAC;IACxC,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,OAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC;IAGnE,EAAE,EAAE,OAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,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,CAAC,QAAQ,EAAE;IACjC,KAAK,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,uBAAe,CAAC,CAAC,CAAC,QAAQ,EAAE;IACxD,QAAQ,EAAE,4BAAoB,CAAC,QAAQ,EAAE;CAC1C,CAAC;KAED,WAAW,EAAE,CACO,CAAC;AAQ1B,SAAgB,gBAAgB,CAC9B,MAAoB,EACpB,IAAa,EACb,aAA0C;IAE1C,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACtC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,0BAAU,CAAC,GAAG,EAAE;YACxB,KAAK,EAAE,cAAc;YACrB,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM;SAC5B,CAAC,CAAC;IACL,CAAC;IACD,MAAM,OAAO,GAAmB,IAAA,wBAAa,EAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1E,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC;QAChB,MAAM,IAAI,0BAAU,CAAC,GAAG,EAAE;YACxB,KAAK,EAAE,eAAe;YACtB,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
require("./procedures");
|
|
4
|
+
require("./trigger-types");
|
|
5
|
+
require("./action-types");
|
|
6
|
+
require("./data-node-types");
|
|
7
|
+
require("./node-kinds");
|
|
8
|
+
require("./runs");
|
|
9
|
+
require("./stats");
|
|
10
|
+
require("./templates");
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/routes/index.ts"],"names":[],"mappings":";;AAAA,wBAAsB;AACtB,2BAAyB;AACzB,0BAAwB;AACxB,6BAA2B;AAC3B,wBAAsB;AACtB,kBAAgB;AAChB,mBAAiB;AACjB,uBAAqB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { User } from "@antelopejs/interface-dms/auth/db";
|
|
2
|
+
declare const NodeKindsController_base: import("@antelopejs/interface-api").ControllerClass<object>;
|
|
3
|
+
export declare class NodeKindsController extends NodeKindsController_base {
|
|
4
|
+
list(_user: User): Promise<{
|
|
5
|
+
kind: string;
|
|
6
|
+
meta: import("../runtime/nodeKinds").NodeKindMeta;
|
|
7
|
+
}[]>;
|
|
8
|
+
}
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.NodeKindsController = void 0;
|
|
16
|
+
const interface_api_1 = require("@antelopejs/interface-api");
|
|
17
|
+
const auth_1 = require("@antelopejs/interface-dms/auth");
|
|
18
|
+
const nodeKinds_1 = require("../runtime/nodeKinds");
|
|
19
|
+
let NodeKindsController = class NodeKindsController extends (0, interface_api_1.Controller)("/api/automation/node-kinds") {
|
|
20
|
+
async list(_user) {
|
|
21
|
+
return nodeKinds_1.nodeKinds.listAll();
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
exports.NodeKindsController = NodeKindsController;
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, interface_api_1.Get)(""),
|
|
27
|
+
__param(0, (0, auth_1.AuthRawUser)()),
|
|
28
|
+
__metadata("design:type", Function),
|
|
29
|
+
__metadata("design:paramtypes", [Function]),
|
|
30
|
+
__metadata("design:returntype", Promise)
|
|
31
|
+
], NodeKindsController.prototype, "list", null);
|
|
32
|
+
exports.NodeKindsController = NodeKindsController = __decorate([
|
|
33
|
+
(0, auth_1.AuthOwnerOnly)()
|
|
34
|
+
], NodeKindsController);
|
|
35
|
+
//# sourceMappingURL=node-kinds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-kinds.js","sourceRoot":"","sources":["../../src/routes/node-kinds.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DAA4D;AAC5D,yDAA4E;AAE5E,oDAAiD;AAc1C,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,IAAA,0BAAU,EACjD,4BAA4B,CAC7B;IAEO,AAAN,KAAK,CAAC,IAAI,CAAgB,KAAW;QACnC,OAAO,qBAAS,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;CACF,CAAA;AAPY,kDAAmB;AAIxB;IADL,IAAA,mBAAG,EAAC,EAAE,CAAC;IACI,WAAA,IAAA,kBAAW,GAAE,CAAA;;;;+CAExB;8BANU,mBAAmB;IAD/B,IAAA,oBAAa,GAAE;GACH,mBAAmB,CAO/B"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { User } from "@antelopejs/interface-dms/auth/db";
|
|
2
|
+
declare const ProceduresController_base: import("@antelopejs/interface-api").ControllerClass<object>;
|
|
3
|
+
export declare class ProceduresController extends ProceduresController_base {
|
|
4
|
+
list(_user: User, page?: string, limit?: string): Promise<import("../types/pagination").Paginated<import("../db").Procedure>>;
|
|
5
|
+
summary(_user: User): Promise<{
|
|
6
|
+
results: import("../db/models/stats.model").ProcedureSummaryRow[];
|
|
7
|
+
}>;
|
|
8
|
+
getOne(_user: User, id: string): Promise<import("../db").Procedure>;
|
|
9
|
+
create(_user: User, body: unknown): Promise<{
|
|
10
|
+
_id: string;
|
|
11
|
+
}>;
|
|
12
|
+
update(_user: User, id: string, body: unknown): Promise<{
|
|
13
|
+
_id: string;
|
|
14
|
+
}>;
|
|
15
|
+
remove(_user: User, id: string): Promise<{
|
|
16
|
+
_id: string;
|
|
17
|
+
}>;
|
|
18
|
+
run(_user: User, id: string, body: unknown): Promise<{
|
|
19
|
+
runId: string;
|
|
20
|
+
}>;
|
|
21
|
+
runs(_user: User, id: string, page?: string, limit?: string): Promise<import("../db").ProcedureRun[]>;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.ProceduresController = void 0;
|
|
16
|
+
const interface_api_1 = require("@antelopejs/interface-api");
|
|
17
|
+
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
18
|
+
const guards_1 = require("@antelopejs/interface-dms/guards");
|
|
19
|
+
const auth_1 = require("@antelopejs/interface-dms/auth");
|
|
20
|
+
const zod_1 = require("zod");
|
|
21
|
+
const procedure_model_1 = require("../db/models/procedure.model");
|
|
22
|
+
const procedure_run_model_1 = require("../db/models/procedure_run.model");
|
|
23
|
+
const stats_model_1 = require("../db/models/stats.model");
|
|
24
|
+
const builder_1 = require("../pages/builder");
|
|
25
|
+
const procedures_1 = require("../pages/procedures");
|
|
26
|
+
const subscriptions_1 = require("../runtime/subscriptions");
|
|
27
|
+
const constants_1 = require("../types/constants");
|
|
28
|
+
const graphSchema_1 = require("./graphSchema");
|
|
29
|
+
const procedureBodySchema = zod_1.z.object({
|
|
30
|
+
name: zod_1.z.string().min(1),
|
|
31
|
+
description: zod_1.z.string().optional(),
|
|
32
|
+
enabled: zod_1.z.boolean(),
|
|
33
|
+
graph: graphSchema_1.procedureGraphSchema,
|
|
34
|
+
});
|
|
35
|
+
function parseProcedureBody(body) {
|
|
36
|
+
return (0, graphSchema_1.parseAndValidate)(procedureBodySchema, body, (d) => d.graph);
|
|
37
|
+
}
|
|
38
|
+
let ProceduresController = class ProceduresController extends (0, interface_api_1.Controller)("/api/automation/procedures") {
|
|
39
|
+
async list(_user, page, limit) {
|
|
40
|
+
const model = (0, interface_database_decorators_1.GetModel)(procedure_model_1.ProcedureModel, constants_1.DATABASE_NAME);
|
|
41
|
+
const pageNum = page ? Number(page) : 0;
|
|
42
|
+
const limitNum = limit ? Number(limit) : 20;
|
|
43
|
+
return await model.list({ page: pageNum, limit: limitNum });
|
|
44
|
+
}
|
|
45
|
+
async summary(_user) {
|
|
46
|
+
return { results: await (0, stats_model_1.getProceduresSummary)() };
|
|
47
|
+
}
|
|
48
|
+
async getOne(_user, id) {
|
|
49
|
+
const model = (0, interface_database_decorators_1.GetModel)(procedure_model_1.ProcedureModel, constants_1.DATABASE_NAME);
|
|
50
|
+
const procedure = await model.get(id);
|
|
51
|
+
if (!procedure) {
|
|
52
|
+
throw new interface_api_1.HTTPResult(404, { error: `procedure "${id}" not found` });
|
|
53
|
+
}
|
|
54
|
+
return procedure;
|
|
55
|
+
}
|
|
56
|
+
async create(_user, body) {
|
|
57
|
+
const data = parseProcedureBody(body);
|
|
58
|
+
const model = (0, interface_database_decorators_1.GetModel)(procedure_model_1.ProcedureModel, constants_1.DATABASE_NAME);
|
|
59
|
+
const now = new Date();
|
|
60
|
+
const ids = await model.insert({
|
|
61
|
+
name: data.name,
|
|
62
|
+
description: data.description ?? "",
|
|
63
|
+
enabled: data.enabled,
|
|
64
|
+
graph: JSON.stringify(data.graph),
|
|
65
|
+
created_at: now,
|
|
66
|
+
updated_at: now,
|
|
67
|
+
});
|
|
68
|
+
const id = ids[0];
|
|
69
|
+
if (!id) {
|
|
70
|
+
throw new interface_api_1.HTTPResult(500, { error: "procedure insert returned no id" });
|
|
71
|
+
}
|
|
72
|
+
await subscriptions_1.subscriptions.onProcedureChange(id);
|
|
73
|
+
return { _id: id };
|
|
74
|
+
}
|
|
75
|
+
async update(_user, id, body) {
|
|
76
|
+
const data = parseProcedureBody(body);
|
|
77
|
+
const model = (0, interface_database_decorators_1.GetModel)(procedure_model_1.ProcedureModel, constants_1.DATABASE_NAME);
|
|
78
|
+
const existing = await model.get(id);
|
|
79
|
+
if (!existing) {
|
|
80
|
+
throw new interface_api_1.HTTPResult(404, { error: `procedure "${id}" not found` });
|
|
81
|
+
}
|
|
82
|
+
await model.update(id, {
|
|
83
|
+
name: data.name,
|
|
84
|
+
description: data.description ?? "",
|
|
85
|
+
enabled: data.enabled,
|
|
86
|
+
graph: JSON.stringify(data.graph),
|
|
87
|
+
updated_at: new Date(),
|
|
88
|
+
});
|
|
89
|
+
await subscriptions_1.subscriptions.onProcedureChange(id);
|
|
90
|
+
return { _id: id };
|
|
91
|
+
}
|
|
92
|
+
async remove(_user, id) {
|
|
93
|
+
const model = (0, interface_database_decorators_1.GetModel)(procedure_model_1.ProcedureModel, constants_1.DATABASE_NAME);
|
|
94
|
+
await model.delete(id);
|
|
95
|
+
await subscriptions_1.subscriptions.onProcedureDelete(id);
|
|
96
|
+
return { _id: id };
|
|
97
|
+
}
|
|
98
|
+
async run(_user, id, body) {
|
|
99
|
+
const runId = await subscriptions_1.subscriptions.invokeManual(id, body);
|
|
100
|
+
return { runId };
|
|
101
|
+
}
|
|
102
|
+
async runs(_user, id, page, limit) {
|
|
103
|
+
const model = (0, interface_database_decorators_1.GetModel)(procedure_run_model_1.ProcedureRunModel, constants_1.DATABASE_NAME);
|
|
104
|
+
const pageNum = page ? Number(page) : 0;
|
|
105
|
+
const limitNum = limit ? Number(limit) : 20;
|
|
106
|
+
return await model.listByProcedure(id, pageNum, limitNum, true);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
exports.ProceduresController = ProceduresController;
|
|
110
|
+
__decorate([
|
|
111
|
+
(0, interface_api_1.Get)(""),
|
|
112
|
+
__param(0, (0, auth_1.AuthRawUser)()),
|
|
113
|
+
__param(1, (0, interface_api_1.Parameter)("page", "query")),
|
|
114
|
+
__param(2, (0, interface_api_1.Parameter)("limit", "query")),
|
|
115
|
+
__metadata("design:type", Function),
|
|
116
|
+
__metadata("design:paramtypes", [Function, String, String]),
|
|
117
|
+
__metadata("design:returntype", Promise)
|
|
118
|
+
], ProceduresController.prototype, "list", null);
|
|
119
|
+
__decorate([
|
|
120
|
+
(0, interface_api_1.Get)("/summary"),
|
|
121
|
+
__param(0, (0, guards_1.AuthUserWithPermission)(procedures_1.ProceduresPageController)),
|
|
122
|
+
__metadata("design:type", Function),
|
|
123
|
+
__metadata("design:paramtypes", [Function]),
|
|
124
|
+
__metadata("design:returntype", Promise)
|
|
125
|
+
], ProceduresController.prototype, "summary", null);
|
|
126
|
+
__decorate([
|
|
127
|
+
(0, interface_api_1.Get)("/:id"),
|
|
128
|
+
__param(0, (0, auth_1.AuthRawUser)()),
|
|
129
|
+
__param(1, (0, interface_api_1.Parameter)("id", "param")),
|
|
130
|
+
__metadata("design:type", Function),
|
|
131
|
+
__metadata("design:paramtypes", [Function, String]),
|
|
132
|
+
__metadata("design:returntype", Promise)
|
|
133
|
+
], ProceduresController.prototype, "getOne", null);
|
|
134
|
+
__decorate([
|
|
135
|
+
(0, interface_api_1.Post)(""),
|
|
136
|
+
__param(0, (0, guards_1.AuthUserWithPermission)(builder_1.BuilderPageController)),
|
|
137
|
+
__param(1, (0, interface_api_1.JSONBody)()),
|
|
138
|
+
__metadata("design:type", Function),
|
|
139
|
+
__metadata("design:paramtypes", [Function, Object]),
|
|
140
|
+
__metadata("design:returntype", Promise)
|
|
141
|
+
], ProceduresController.prototype, "create", null);
|
|
142
|
+
__decorate([
|
|
143
|
+
(0, interface_api_1.Put)("/:id"),
|
|
144
|
+
__param(0, (0, guards_1.AuthUserWithPermission)(builder_1.BuilderPageController)),
|
|
145
|
+
__param(1, (0, interface_api_1.Parameter)("id", "param")),
|
|
146
|
+
__param(2, (0, interface_api_1.JSONBody)()),
|
|
147
|
+
__metadata("design:type", Function),
|
|
148
|
+
__metadata("design:paramtypes", [Function, String, Object]),
|
|
149
|
+
__metadata("design:returntype", Promise)
|
|
150
|
+
], ProceduresController.prototype, "update", null);
|
|
151
|
+
__decorate([
|
|
152
|
+
(0, interface_api_1.Delete)("/:id"),
|
|
153
|
+
__param(0, (0, guards_1.AuthUserWithPermission)(builder_1.BuilderPageController)),
|
|
154
|
+
__param(1, (0, interface_api_1.Parameter)("id", "param")),
|
|
155
|
+
__metadata("design:type", Function),
|
|
156
|
+
__metadata("design:paramtypes", [Function, String]),
|
|
157
|
+
__metadata("design:returntype", Promise)
|
|
158
|
+
], ProceduresController.prototype, "remove", null);
|
|
159
|
+
__decorate([
|
|
160
|
+
(0, interface_api_1.Post)("/:id/run"),
|
|
161
|
+
__param(0, (0, guards_1.AuthUserWithPermission)(builder_1.BuilderPageController)),
|
|
162
|
+
__param(1, (0, interface_api_1.Parameter)("id", "param")),
|
|
163
|
+
__param(2, (0, interface_api_1.JSONBody)()),
|
|
164
|
+
__metadata("design:type", Function),
|
|
165
|
+
__metadata("design:paramtypes", [Function, String, Object]),
|
|
166
|
+
__metadata("design:returntype", Promise)
|
|
167
|
+
], ProceduresController.prototype, "run", null);
|
|
168
|
+
__decorate([
|
|
169
|
+
(0, interface_api_1.Get)("/:id/runs"),
|
|
170
|
+
__param(0, (0, auth_1.AuthRawUser)()),
|
|
171
|
+
__param(1, (0, interface_api_1.Parameter)("id", "param")),
|
|
172
|
+
__param(2, (0, interface_api_1.Parameter)("page", "query")),
|
|
173
|
+
__param(3, (0, interface_api_1.Parameter)("limit", "query")),
|
|
174
|
+
__metadata("design:type", Function),
|
|
175
|
+
__metadata("design:paramtypes", [Function, String, String, String]),
|
|
176
|
+
__metadata("design:returntype", Promise)
|
|
177
|
+
], ProceduresController.prototype, "runs", null);
|
|
178
|
+
exports.ProceduresController = ProceduresController = __decorate([
|
|
179
|
+
(0, auth_1.AuthOwnerOnly)()
|
|
180
|
+
], ProceduresController);
|
|
181
|
+
//# sourceMappingURL=procedures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"procedures.js","sourceRoot":"","sources":["../../src/routes/procedures.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DASmC;AACnC,6FAAqE;AACrE,6DAA0E;AAC1E,yDAA4E;AAE5E,6BAAwB;AACxB,kEAA8D;AAC9D,0EAAqE;AACrE,0DAAgE;AAChE,8CAAyD;AACzD,oDAA+D;AAC/D,4DAAyD;AACzD,kDAAmD;AAEnD,+CAAuE;AAEvE,M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AAO,CAAC,CAAA;IACxB,WAAA,IAAA,wBAAQ,GAAE,CAAA;;;;kDAiBZ;AAGK;IADL,IAAA,sBAAM,EAAC,MAAM,CAAC;IAEZ,WAAA,IAAA,+BAAsB,EAAC,+BAAqB,CAAC,CAAA;IAC7C,WAAA,IAAA,yBAAS,EAAC,IAAI,EAAE,OAAO,CAAC,CAAA;;;;kDAM1B;AAGK;IADL,IAAA,oBAAI,EAAC,UAAU,CAAC;IAEd,WAAA,IAAA,+BAAsB,EAAC,+BAAqB,CAAC,CAAA;IAC7C,WAAA,IAAA,yBAAS,EAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IACxB,WAAA,IAAA,wBAAQ,GAAE,CAAA;;;;+CAIZ;AAGK;IADL,IAAA,mBAAG,EAAC,WAAW,CAAC;IAEd,WAAA,IAAA,kBAAW,GAAE,CAAA;IACb,WAAA,IAAA,yBAAS,EAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IACxB,WAAA,IAAA,yBAAS,EAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC1B,WAAA,IAAA,yBAAS,EAAC,OAAO,EAAE,OAAO,CAAC,CAAA;;;;gDAO7B;+BAnHU,oBAAoB;IADhC,IAAA,oBAAa,GAAE;GACH,oBAAoB,CAoHhC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { User } from "@antelopejs/interface-dms/auth/db";
|
|
2
|
+
declare const RunsController_base: import("@antelopejs/interface-api").ControllerClass<object>;
|
|
3
|
+
export declare class RunsController extends RunsController_base {
|
|
4
|
+
list(_user: User, page?: string, limit?: string, procedureId?: string, status?: string, period?: string): Promise<import("../db").ProcedureRun[]>;
|
|
5
|
+
getOne(_user: User, id: string): Promise<import("../db").ProcedureRun>;
|
|
6
|
+
}
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.RunsController = void 0;
|
|
16
|
+
const interface_api_1 = require("@antelopejs/interface-api");
|
|
17
|
+
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
18
|
+
const auth_1 = require("@antelopejs/interface-dms/auth");
|
|
19
|
+
const procedure_run_model_1 = require("../db/models/procedure_run.model");
|
|
20
|
+
const constants_1 = require("../types/constants");
|
|
21
|
+
const MS_PER_UNIT = {
|
|
22
|
+
h: constants_1.MS_PER_HOUR,
|
|
23
|
+
d: constants_1.MS_PER_DAY,
|
|
24
|
+
};
|
|
25
|
+
function sinceFromPeriod(period) {
|
|
26
|
+
if (!period)
|
|
27
|
+
return undefined;
|
|
28
|
+
const m = /^(\d+)([hd])$/.exec(period);
|
|
29
|
+
if (!m)
|
|
30
|
+
return undefined;
|
|
31
|
+
const n = Number(m[1]);
|
|
32
|
+
const unit = m[2];
|
|
33
|
+
return new Date(Date.now() - n * MS_PER_UNIT[unit]);
|
|
34
|
+
}
|
|
35
|
+
let RunsController = class RunsController extends (0, interface_api_1.Controller)("/api/automation/runs") {
|
|
36
|
+
async list(_user, page, limit, procedureId, status, period) {
|
|
37
|
+
const model = (0, interface_database_decorators_1.GetModel)(procedure_run_model_1.ProcedureRunModel, constants_1.DATABASE_NAME);
|
|
38
|
+
const normalizedStatus = status === "ok" || status === "failed" ? status : undefined;
|
|
39
|
+
return model.listAll({
|
|
40
|
+
page: parseInt(page ?? "0", 10),
|
|
41
|
+
limit: parseInt(limit ?? "50", 10),
|
|
42
|
+
procedureId,
|
|
43
|
+
status: normalizedStatus,
|
|
44
|
+
since: sinceFromPeriod(period),
|
|
45
|
+
peek: true,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
async getOne(_user, id) {
|
|
49
|
+
const model = (0, interface_database_decorators_1.GetModel)(procedure_run_model_1.ProcedureRunModel, constants_1.DATABASE_NAME);
|
|
50
|
+
const run = await model.get(id);
|
|
51
|
+
if (!run) {
|
|
52
|
+
throw new interface_api_1.HTTPResult(404, { error: `run "${id}" not found` });
|
|
53
|
+
}
|
|
54
|
+
return run;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
exports.RunsController = RunsController;
|
|
58
|
+
__decorate([
|
|
59
|
+
(0, interface_api_1.Get)(""),
|
|
60
|
+
__param(0, (0, auth_1.AuthRawUser)()),
|
|
61
|
+
__param(1, (0, interface_api_1.Parameter)("page", "query")),
|
|
62
|
+
__param(2, (0, interface_api_1.Parameter)("limit", "query")),
|
|
63
|
+
__param(3, (0, interface_api_1.Parameter)("procedureId", "query")),
|
|
64
|
+
__param(4, (0, interface_api_1.Parameter)("status", "query")),
|
|
65
|
+
__param(5, (0, interface_api_1.Parameter)("period", "query")),
|
|
66
|
+
__metadata("design:type", Function),
|
|
67
|
+
__metadata("design:paramtypes", [Function, String, String, String, String, String]),
|
|
68
|
+
__metadata("design:returntype", Promise)
|
|
69
|
+
], RunsController.prototype, "list", null);
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, interface_api_1.Get)("/:id"),
|
|
72
|
+
__param(0, (0, auth_1.AuthRawUser)()),
|
|
73
|
+
__param(1, (0, interface_api_1.Parameter)("id", "param")),
|
|
74
|
+
__metadata("design:type", Function),
|
|
75
|
+
__metadata("design:paramtypes", [Function, String]),
|
|
76
|
+
__metadata("design:returntype", Promise)
|
|
77
|
+
], RunsController.prototype, "getOne", null);
|
|
78
|
+
exports.RunsController = RunsController = __decorate([
|
|
79
|
+
(0, auth_1.AuthOwnerOnly)()
|
|
80
|
+
], RunsController);
|
|
81
|
+
//# sourceMappingURL=runs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runs.js","sourceRoot":"","sources":["../../src/routes/runs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DAKmC;AACnC,6FAAqE;AACrE,yDAA4E;AAE5E,0EAAqE;AACrE,kDAA4E;AAG5E,MAAM,WAAW,GAA8B;IAC7C,CAAC,EAAE,uBAAW;IACd,CAAC,EAAE,sBAAU;CACd,CAAC;AAEF,SAAS,eAAe,CAAC,MAAe;IACtC,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IAC9B,MAAM,CAAC,GAAG,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACvC,IAAI,CAAC,CAAC;QAAE,OAAO,SAAS,CAAC;IACzB,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACvB,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,CAAc,CAAC;IAC/B,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;AACtD,CAAC;AAGM,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,IAAA,0BAAU,EAAC,sBAAsB,CAAC;IAM9D,AAAN,KAAK,CAAC,IAAI,CACO,KAAW,EACE,IAAa,EACZ,KAAc,EACR,WAAoB,EACzB,MAAe,EACf,MAAe;QAE7C,MAAM,KAAK,GAAG,IAAA,wC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AAS,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;;;;0CAc9B;AAGK;IADL,IAAA,mBAAG,EAAC,MAAM,CAAC;IAET,WAAA,IAAA,kBAAW,GAAE,CAAA;IACb,WAAA,IAAA,yBAAS,EAAC,IAAI,EAAE,OAAO,CAAC,CAAA;;;;4CAQ1B;yBAvCU,cAAc;IAD1B,IAAA,oBAAa,GAAE;GACH,cAAc,CAwC1B"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { User } from "@antelopejs/interface-dms/auth/db";
|
|
2
|
+
declare const StatsController_base: import("@antelopejs/interface-api").ControllerClass<object>;
|
|
3
|
+
export declare class StatsController extends StatsController_base {
|
|
4
|
+
snapshot(_user: User): Promise<import("../db/models/stats.model").StatsSnapshot>;
|
|
5
|
+
}
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.StatsController = void 0;
|
|
16
|
+
const interface_api_1 = require("@antelopejs/interface-api");
|
|
17
|
+
const auth_1 = require("@antelopejs/interface-dms/auth");
|
|
18
|
+
const stats_model_1 = require("../db/models/stats.model");
|
|
19
|
+
let StatsController = class StatsController extends (0, interface_api_1.Controller)("/api/automation/stats") {
|
|
20
|
+
async snapshot(_user) {
|
|
21
|
+
return await (0, stats_model_1.getStatsSnapshot)();
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
exports.StatsController = StatsController;
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, interface_api_1.Get)(""),
|
|
27
|
+
__param(0, (0, auth_1.AuthRawUser)()),
|
|
28
|
+
__metadata("design:type", Function),
|
|
29
|
+
__metadata("design:paramtypes", [Function]),
|
|
30
|
+
__metadata("design:returntype", Promise)
|
|
31
|
+
], StatsController.prototype, "snapshot", null);
|
|
32
|
+
exports.StatsController = StatsController = __decorate([
|
|
33
|
+
(0, auth_1.AuthOwnerOnly)()
|
|
34
|
+
], StatsController);
|
|
35
|
+
//# sourceMappingURL=stats.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stats.js","sourceRoot":"","sources":["../../src/routes/stats.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DAA4D;AAC5D,yDAA4E;AAE5E,0DAA4D;AAGrD,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,IAAA,0BAAU,EAAC,uBAAuB,CAAC;IAEhE,AAAN,KAAK,CAAC,QAAQ,CAAgB,KAAW;QACvC,OAAO,MAAM,IAAA,8BAAgB,GAAE,CAAC;IAClC,CAAC;CACF,CAAA;AALY,0CAAe;AAEpB;IADL,IAAA,mBAAG,EAAC,EAAE,CAAC;IACQ,WAAA,IAAA,kBAAW,GAAE,CAAA;;;;+CAE5B;0BAJU,eAAe;IAD3B,IAAA,oBAAa,GAAE;GACH,eAAe,CAK3B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { User } from "@antelopejs/interface-dms/auth/db";
|
|
2
|
+
import { type AutomationTemplateRow, type TemplateUsage } from "../db/models/automation_template.model";
|
|
3
|
+
import type { Paginated } from "../types/pagination";
|
|
4
|
+
interface TemplateWithUsage extends AutomationTemplateRow {
|
|
5
|
+
usageCount: number;
|
|
6
|
+
}
|
|
7
|
+
interface RemoveTemplateResult {
|
|
8
|
+
_id: string;
|
|
9
|
+
forked: number;
|
|
10
|
+
}
|
|
11
|
+
declare const TemplatesController_base: import("@antelopejs/interface-api").ControllerClass<object>;
|
|
12
|
+
export declare class TemplatesController extends TemplatesController_base {
|
|
13
|
+
list(_user: User, page?: string, limit?: string): Promise<Paginated<TemplateWithUsage>>;
|
|
14
|
+
getOne(_user: User, id: string): Promise<AutomationTemplateRow>;
|
|
15
|
+
create(_user: User, body: unknown): Promise<AutomationTemplateRow>;
|
|
16
|
+
update(_user: User, id: string, body: unknown): Promise<AutomationTemplateRow>;
|
|
17
|
+
remove(_user: User, id: string, force?: string): Promise<RemoveTemplateResult>;
|
|
18
|
+
usages(_user: User, id: string): Promise<TemplateUsage[]>;
|
|
19
|
+
}
|
|
20
|
+
export {};
|