@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.
Files changed (305) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +95 -0
  3. package/dist/cluster/bus.d.ts +17 -0
  4. package/dist/cluster/bus.js +82 -0
  5. package/dist/cluster/bus.js.map +1 -0
  6. package/dist/cluster/instance.d.ts +1 -0
  7. package/dist/cluster/instance.js +6 -0
  8. package/dist/cluster/instance.js.map +1 -0
  9. package/dist/cluster/leader.d.ts +7 -0
  10. package/dist/cluster/leader.js +123 -0
  11. package/dist/cluster/leader.js.map +1 -0
  12. package/dist/cluster/mode.d.ts +3 -0
  13. package/dist/cluster/mode.js +25 -0
  14. package/dist/cluster/mode.js.map +1 -0
  15. package/dist/data/procedures-table.d.ts +66 -0
  16. package/dist/data/procedures-table.js +271 -0
  17. package/dist/data/procedures-table.js.map +1 -0
  18. package/dist/data/runs-table.d.ts +23 -0
  19. package/dist/data/runs-table.js +125 -0
  20. package/dist/data/runs-table.js.map +1 -0
  21. package/dist/db/index.d.ts +7 -0
  22. package/dist/db/index.js +24 -0
  23. package/dist/db/index.js.map +1 -0
  24. package/dist/db/models/automation_template.model.d.ts +58 -0
  25. package/dist/db/models/automation_template.model.js +134 -0
  26. package/dist/db/models/automation_template.model.js.map +1 -0
  27. package/dist/db/models/index.d.ts +3 -0
  28. package/dist/db/models/index.js +20 -0
  29. package/dist/db/models/index.js.map +1 -0
  30. package/dist/db/models/procedure.model.d.ts +25 -0
  31. package/dist/db/models/procedure.model.js +28 -0
  32. package/dist/db/models/procedure.model.js.map +1 -0
  33. package/dist/db/models/procedure_run.model.d.ts +34 -0
  34. package/dist/db/models/procedure_run.model.js +39 -0
  35. package/dist/db/models/procedure_run.model.js.map +1 -0
  36. package/dist/db/models/stats.model.d.ts +73 -0
  37. package/dist/db/models/stats.model.js +267 -0
  38. package/dist/db/models/stats.model.js.map +1 -0
  39. package/dist/db/models/type_config.model.d.ts +47 -0
  40. package/dist/db/models/type_config.model.js +51 -0
  41. package/dist/db/models/type_config.model.js.map +1 -0
  42. package/dist/db/tables/action_type_config.table.d.ts +7 -0
  43. package/dist/db/tables/action_type_config.table.js +35 -0
  44. package/dist/db/tables/action_type_config.table.js.map +1 -0
  45. package/dist/db/tables/automation_template.table.d.ts +11 -0
  46. package/dist/db/tables/automation_template.table.js +52 -0
  47. package/dist/db/tables/automation_template.table.js.map +1 -0
  48. package/dist/db/tables/index.d.ts +5 -0
  49. package/dist/db/tables/index.js +22 -0
  50. package/dist/db/tables/index.js.map +1 -0
  51. package/dist/db/tables/procedure.table.d.ts +10 -0
  52. package/dist/db/tables/procedure.table.js +48 -0
  53. package/dist/db/tables/procedure.table.js.map +1 -0
  54. package/dist/db/tables/procedure_run.table.d.ts +13 -0
  55. package/dist/db/tables/procedure_run.table.js +57 -0
  56. package/dist/db/tables/procedure_run.table.js.map +1 -0
  57. package/dist/db/tables/trigger_type_config.table.d.ts +7 -0
  58. package/dist/db/tables/trigger_type_config.table.js +35 -0
  59. package/dist/db/tables/trigger_type_config.table.js.map +1 -0
  60. package/dist/implementations/dms-automation/index.d.ts +19 -0
  61. package/dist/implementations/dms-automation/index.js +50 -0
  62. package/dist/implementations/dms-automation/index.js.map +1 -0
  63. package/dist/index.d.ts +14 -0
  64. package/dist/index.js +121 -0
  65. package/dist/index.js.map +1 -0
  66. package/dist/pages/builder.d.ts +10 -0
  67. package/dist/pages/builder.js +28 -0
  68. package/dist/pages/builder.js.map +1 -0
  69. package/dist/pages/category.d.ts +1 -0
  70. package/dist/pages/category.js +10 -0
  71. package/dist/pages/category.js.map +1 -0
  72. package/dist/pages/index.d.ts +6 -0
  73. package/dist/pages/index.js +9 -0
  74. package/dist/pages/index.js.map +1 -0
  75. package/dist/pages/library.d.ts +10 -0
  76. package/dist/pages/library.js +28 -0
  77. package/dist/pages/library.js.map +1 -0
  78. package/dist/pages/overview.d.ts +10 -0
  79. package/dist/pages/overview.js +28 -0
  80. package/dist/pages/overview.js.map +1 -0
  81. package/dist/pages/procedures.d.ts +10 -0
  82. package/dist/pages/procedures.js +72 -0
  83. package/dist/pages/procedures.js.map +1 -0
  84. package/dist/pages/runs.d.ts +11 -0
  85. package/dist/pages/runs.js +61 -0
  86. package/dist/pages/runs.js.map +1 -0
  87. package/dist/routes/action-types.d.ts +23 -0
  88. package/dist/routes/action-types.js +80 -0
  89. package/dist/routes/action-types.js.map +1 -0
  90. package/dist/routes/data-node-types.d.ts +6 -0
  91. package/dist/routes/data-node-types.js +36 -0
  92. package/dist/routes/data-node-types.js.map +1 -0
  93. package/dist/routes/graphSchema.d.ts +92 -0
  94. package/dist/routes/graphSchema.js +60 -0
  95. package/dist/routes/graphSchema.js.map +1 -0
  96. package/dist/routes/index.d.ts +8 -0
  97. package/dist/routes/index.js +11 -0
  98. package/dist/routes/index.js.map +1 -0
  99. package/dist/routes/node-kinds.d.ts +9 -0
  100. package/dist/routes/node-kinds.js +35 -0
  101. package/dist/routes/node-kinds.js.map +1 -0
  102. package/dist/routes/procedures.d.ts +23 -0
  103. package/dist/routes/procedures.js +181 -0
  104. package/dist/routes/procedures.js.map +1 -0
  105. package/dist/routes/runs.d.ts +7 -0
  106. package/dist/routes/runs.js +81 -0
  107. package/dist/routes/runs.js.map +1 -0
  108. package/dist/routes/stats.d.ts +6 -0
  109. package/dist/routes/stats.js +35 -0
  110. package/dist/routes/stats.js.map +1 -0
  111. package/dist/routes/templates.d.ts +20 -0
  112. package/dist/routes/templates.js +243 -0
  113. package/dist/routes/templates.js.map +1 -0
  114. package/dist/routes/trigger-types.d.ts +24 -0
  115. package/dist/routes/trigger-types.js +80 -0
  116. package/dist/routes/trigger-types.js.map +1 -0
  117. package/dist/routes/typeConfigShared.d.ts +22 -0
  118. package/dist/routes/typeConfigShared.js +37 -0
  119. package/dist/routes/typeConfigShared.js.map +1 -0
  120. package/dist/runtime/builtins/actions/http.d.ts +13 -0
  121. package/dist/runtime/builtins/actions/http.js +47 -0
  122. package/dist/runtime/builtins/actions/http.js.map +1 -0
  123. package/dist/runtime/builtins/actions/index.d.ts +2 -0
  124. package/dist/runtime/builtins/actions/index.js +7 -0
  125. package/dist/runtime/builtins/actions/index.js.map +1 -0
  126. package/dist/runtime/builtins/actions/log.d.ts +13 -0
  127. package/dist/runtime/builtins/actions/log.js +49 -0
  128. package/dist/runtime/builtins/actions/log.js.map +1 -0
  129. package/dist/runtime/builtins/data/boolean.d.ts +2 -0
  130. package/dist/runtime/builtins/data/boolean.js +39 -0
  131. package/dist/runtime/builtins/data/boolean.js.map +1 -0
  132. package/dist/runtime/builtins/data/compare.d.ts +2 -0
  133. package/dist/runtime/builtins/data/compare.js +29 -0
  134. package/dist/runtime/builtins/data/compare.js.map +1 -0
  135. package/dist/runtime/builtins/data/constant.d.ts +2 -0
  136. package/dist/runtime/builtins/data/constant.js +29 -0
  137. package/dist/runtime/builtins/data/constant.js.map +1 -0
  138. package/dist/runtime/builtins/data/index.d.ts +2 -0
  139. package/dist/runtime/builtins/data/index.js +20 -0
  140. package/dist/runtime/builtins/data/index.js.map +1 -0
  141. package/dist/runtime/builtins/data/json.d.ts +2 -0
  142. package/dist/runtime/builtins/data/json.js +46 -0
  143. package/dist/runtime/builtins/data/json.js.map +1 -0
  144. package/dist/runtime/builtins/data/math.d.ts +2 -0
  145. package/dist/runtime/builtins/data/math.js +53 -0
  146. package/dist/runtime/builtins/data/math.js.map +1 -0
  147. package/dist/runtime/builtins/data/object.d.ts +2 -0
  148. package/dist/runtime/builtins/data/object.js +121 -0
  149. package/dist/runtime/builtins/data/object.js.map +1 -0
  150. package/dist/runtime/builtins/data/string.d.ts +2 -0
  151. package/dist/runtime/builtins/data/string.js +143 -0
  152. package/dist/runtime/builtins/data/string.js.map +1 -0
  153. package/dist/runtime/builtins/index.d.ts +17 -0
  154. package/dist/runtime/builtins/index.js +24 -0
  155. package/dist/runtime/builtins/index.js.map +1 -0
  156. package/dist/runtime/builtins/nodes/action.d.ts +1 -0
  157. package/dist/runtime/builtins/nodes/action.js +36 -0
  158. package/dist/runtime/builtins/nodes/action.js.map +1 -0
  159. package/dist/runtime/builtins/nodes/data.d.ts +1 -0
  160. package/dist/runtime/builtins/nodes/data.js +28 -0
  161. package/dist/runtime/builtins/nodes/data.js.map +1 -0
  162. package/dist/runtime/builtins/nodes/delay.d.ts +1 -0
  163. package/dist/runtime/builtins/nodes/delay.js +41 -0
  164. package/dist/runtime/builtins/nodes/delay.js.map +1 -0
  165. package/dist/runtime/builtins/nodes/forRange.d.ts +1 -0
  166. package/dist/runtime/builtins/nodes/forRange.js +52 -0
  167. package/dist/runtime/builtins/nodes/forRange.js.map +1 -0
  168. package/dist/runtime/builtins/nodes/foreach.d.ts +1 -0
  169. package/dist/runtime/builtins/nodes/foreach.js +31 -0
  170. package/dist/runtime/builtins/nodes/foreach.js.map +1 -0
  171. package/dist/runtime/builtins/nodes/groupInput.d.ts +1 -0
  172. package/dist/runtime/builtins/nodes/groupInput.js +11 -0
  173. package/dist/runtime/builtins/nodes/groupInput.js.map +1 -0
  174. package/dist/runtime/builtins/nodes/groupOutput.d.ts +1 -0
  175. package/dist/runtime/builtins/nodes/groupOutput.js +11 -0
  176. package/dist/runtime/builtins/nodes/groupOutput.js.map +1 -0
  177. package/dist/runtime/builtins/nodes/if.d.ts +1 -0
  178. package/dist/runtime/builtins/nodes/if.js +23 -0
  179. package/dist/runtime/builtins/nodes/if.js.map +1 -0
  180. package/dist/runtime/builtins/nodes/parallel.d.ts +1 -0
  181. package/dist/runtime/builtins/nodes/parallel.js +34 -0
  182. package/dist/runtime/builtins/nodes/parallel.js.map +1 -0
  183. package/dist/runtime/builtins/nodes/retry.d.ts +1 -0
  184. package/dist/runtime/builtins/nodes/retry.js +46 -0
  185. package/dist/runtime/builtins/nodes/retry.js.map +1 -0
  186. package/dist/runtime/builtins/nodes/setVariable.d.ts +1 -0
  187. package/dist/runtime/builtins/nodes/setVariable.js +31 -0
  188. package/dist/runtime/builtins/nodes/setVariable.js.map +1 -0
  189. package/dist/runtime/builtins/nodes/switch.d.ts +1 -0
  190. package/dist/runtime/builtins/nodes/switch.js +33 -0
  191. package/dist/runtime/builtins/nodes/switch.js.map +1 -0
  192. package/dist/runtime/builtins/nodes/trigger.d.ts +1 -0
  193. package/dist/runtime/builtins/nodes/trigger.js +25 -0
  194. package/dist/runtime/builtins/nodes/trigger.js.map +1 -0
  195. package/dist/runtime/builtins/nodes/tryCatch.d.ts +1 -0
  196. package/dist/runtime/builtins/nodes/tryCatch.js +35 -0
  197. package/dist/runtime/builtins/nodes/tryCatch.js.map +1 -0
  198. package/dist/runtime/builtins/triggers/cron.d.ts +9 -0
  199. package/dist/runtime/builtins/triggers/cron.js +52 -0
  200. package/dist/runtime/builtins/triggers/cron.js.map +1 -0
  201. package/dist/runtime/builtins/triggers/index.d.ts +2 -0
  202. package/dist/runtime/builtins/triggers/index.js +12 -0
  203. package/dist/runtime/builtins/triggers/index.js.map +1 -0
  204. package/dist/runtime/builtins/triggers/manual.d.ts +3 -0
  205. package/dist/runtime/builtins/triggers/manual.js +20 -0
  206. package/dist/runtime/builtins/triggers/manual.js.map +1 -0
  207. package/dist/runtime/builtins/triggers/webhook.d.ts +14 -0
  208. package/dist/runtime/builtins/triggers/webhook.js +90 -0
  209. package/dist/runtime/builtins/triggers/webhook.js.map +1 -0
  210. package/dist/runtime/executionResult.d.ts +6 -0
  211. package/dist/runtime/executionResult.js +3 -0
  212. package/dist/runtime/executionResult.js.map +1 -0
  213. package/dist/runtime/executor.d.ts +9 -0
  214. package/dist/runtime/executor.js +300 -0
  215. package/dist/runtime/executor.js.map +1 -0
  216. package/dist/runtime/flatten.d.ts +3 -0
  217. package/dist/runtime/flatten.js +188 -0
  218. package/dist/runtime/flatten.js.map +1 -0
  219. package/dist/runtime/nodeKinds.d.ts +64 -0
  220. package/dist/runtime/nodeKinds.js +43 -0
  221. package/dist/runtime/nodeKinds.js.map +1 -0
  222. package/dist/runtime/reconcileDiff.d.ts +9 -0
  223. package/dist/runtime/reconcileDiff.js +26 -0
  224. package/dist/runtime/reconcileDiff.js.map +1 -0
  225. package/dist/runtime/registry.d.ts +19 -0
  226. package/dist/runtime/registry.js +47 -0
  227. package/dist/runtime/registry.js.map +1 -0
  228. package/dist/runtime/resolveInputs.d.ts +14 -0
  229. package/dist/runtime/resolveInputs.js +64 -0
  230. package/dist/runtime/resolveInputs.js.map +1 -0
  231. package/dist/runtime/resolveSubgraph.d.ts +7 -0
  232. package/dist/runtime/resolveSubgraph.js +15 -0
  233. package/dist/runtime/resolveSubgraph.js.map +1 -0
  234. package/dist/runtime/subscriptions.d.ts +16 -0
  235. package/dist/runtime/subscriptions.js +419 -0
  236. package/dist/runtime/subscriptions.js.map +1 -0
  237. package/dist/runtime/subwalk.d.ts +17 -0
  238. package/dist/runtime/subwalk.js +74 -0
  239. package/dist/runtime/subwalk.js.map +1 -0
  240. package/dist/runtime/topo.d.ts +3 -0
  241. package/dist/runtime/topo.js +75 -0
  242. package/dist/runtime/topo.js.map +1 -0
  243. package/dist/runtime/typeOrigin.d.ts +7 -0
  244. package/dist/runtime/typeOrigin.js +24 -0
  245. package/dist/runtime/typeOrigin.js.map +1 -0
  246. package/dist/runtime/validate.d.ts +10 -0
  247. package/dist/runtime/validate.js +185 -0
  248. package/dist/runtime/validate.js.map +1 -0
  249. package/dist/runtime/validateTemplate.d.ts +3 -0
  250. package/dist/runtime/validateTemplate.js +54 -0
  251. package/dist/runtime/validateTemplate.js.map +1 -0
  252. package/dist/types/constants.d.ts +6 -0
  253. package/dist/types/constants.js +10 -0
  254. package/dist/types/constants.js.map +1 -0
  255. package/dist/types/graph.d.ts +51 -0
  256. package/dist/types/graph.js +23 -0
  257. package/dist/types/graph.js.map +1 -0
  258. package/dist/types/pagination.d.ts +8 -0
  259. package/dist/types/pagination.js +3 -0
  260. package/dist/types/pagination.js.map +1 -0
  261. package/dist/types/runLog.d.ts +26 -0
  262. package/dist/types/runLog.js +3 -0
  263. package/dist/types/runLog.js.map +1 -0
  264. package/frontend-vue/.prettierignore +4 -0
  265. package/frontend-vue/app/components/Actions.vue +141 -0
  266. package/frontend-vue/app/components/Catalog/TypeConfigForm.vue +166 -0
  267. package/frontend-vue/app/components/Catalog/TypeList.vue +198 -0
  268. package/frontend-vue/app/components/DataNodes.vue +259 -0
  269. package/frontend-vue/app/components/Editor/BuilderPalette.vue +234 -0
  270. package/frontend-vue/app/components/Editor/GraphCanvas.vue +994 -0
  271. package/frontend-vue/app/components/Editor/GroupPortEditor.vue +289 -0
  272. package/frontend-vue/app/components/Editor/JsonField.vue +63 -0
  273. package/frontend-vue/app/components/Editor/NodeInspector.vue +356 -0
  274. package/frontend-vue/app/components/Editor/ProcedureList.vue +156 -0
  275. package/frontend-vue/app/components/Editor/RunsDrawer.vue +312 -0
  276. package/frontend-vue/app/components/Editor/WiredField.vue +42 -0
  277. package/frontend-vue/app/components/Editor/nodes/GenericNode.vue +161 -0
  278. package/frontend-vue/app/components/Editor/nodes/GroupInputNode.vue +19 -0
  279. package/frontend-vue/app/components/Editor/nodes/GroupNode.vue +200 -0
  280. package/frontend-vue/app/components/Editor/nodes/GroupOutputNode.vue +19 -0
  281. package/frontend-vue/app/components/Editor/nodes/GroupSentinel.vue +161 -0
  282. package/frontend-vue/app/components/Editor/nodes/styles.ts +53 -0
  283. package/frontend-vue/app/components/Editor.vue +2504 -0
  284. package/frontend-vue/app/components/Library.vue +67 -0
  285. package/frontend-vue/app/components/Overview.vue +503 -0
  286. package/frontend-vue/app/components/RunDetailDrawer.vue +165 -0
  287. package/frontend-vue/app/components/RunFireTree.vue +170 -0
  288. package/frontend-vue/app/components/RunTraceDrawer.vue +59 -0
  289. package/frontend-vue/app/components/RunsStats.vue +126 -0
  290. package/frontend-vue/app/components/RunsTimelineDisplay.vue +287 -0
  291. package/frontend-vue/app/components/Templates.vue +663 -0
  292. package/frontend-vue/app/components/Triggers.vue +137 -0
  293. package/frontend-vue/app/composables/useAutomationNodeKinds.ts +48 -0
  294. package/frontend-vue/app/composables/useAutomationRuns.ts +75 -0
  295. package/frontend-vue/app/composables/useGraphConnect.ts +542 -0
  296. package/frontend-vue/app/plugins/runs-timeline-display.client.ts +16 -0
  297. package/frontend-vue/app/utils/automation.ts +51 -0
  298. package/frontend-vue/dms.frontend.ts +26 -0
  299. package/frontend-vue/eslint.config.mjs +24 -0
  300. package/frontend-vue/i18n/locales/dms-automation-en-GB.json +369 -0
  301. package/frontend-vue/i18n/locales/dms-automation-fr-FR.json +369 -0
  302. package/frontend-vue/package.json +33 -0
  303. package/frontend-vue/pnpm-lock.yaml +6483 -0
  304. package/frontend-vue/pnpm-workspace.yaml +2 -0
  305. 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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C,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,8 @@
1
+ import "./procedures";
2
+ import "./trigger-types";
3
+ import "./action-types";
4
+ import "./data-node-types";
5
+ import "./node-kinds";
6
+ import "./runs";
7
+ import "./stats";
8
+ import "./templates";
@@ -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 @@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B;AAGK;IADL,IAAA,oBAAI,EAAC,EAAE,CAAC;IAEN,WAAA,IAAA,+BAAsB,EAAC,+BAAqB,CAAC,CAAA;IAC7C,WAAA,IAAA,wBAAQ,GAAE,CAAA;;;;kDAmBZ;AAGK;IADL,IAAA,mBAAG,EAAC,MAAM,CAAC;IAET,WAAA,IAAA,+BAAsB,EAAC,+BAAqB,CAAC,CAAA;IAC7C,WAAA,IAAA,yBAAS,EAAC,IAAI,EAAE,OAAO,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":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,gBAAgB;YACxB,KAAK,EAAE,eAAe,CAAC,MAAM,CAAC;YAE9B,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;IACL,CAAC;IAGK,AAAN,KAAK,CAAC,MAAM,CACK,KAAW,EACA,EAAU;QAEpC,MAAM,KAAK,GAAG,IAAA,wCAAQ,EAAC,uCAAiB,EAAE,yBAAa,CAAC,CAAC;QACzD,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChC,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,MAAM,IAAI,0BAAU,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC,CAAC;QAChE,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF,CAAA;AAxCY,wCAAc;AAMnB;IALL,IAAA,mBAAG,EAAC,EAAE,CAAC;IAML,WAAA,IAAA,kBAAW,GAAE,CAAA;IACb,WAAA,IAAA,yBAAS,EAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC1B,WAAA,IAAA,yBAAS,EAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IAC3B,WAAA,IAAA,yBAAS,EAAC,aAAa,EAAE,OAAO,CAAC,CAAA;IACjC,WAAA,IAAA,yBAAS,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IAC5B,WAAA,IAAA,yBAAS,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 {};