@antelopejs/dms-automation 0.7.0 → 0.9.0

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 (275) hide show
  1. package/README.md +33 -22
  2. package/dist/cluster/bus.js +8 -6
  3. package/dist/cluster/bus.js.map +1 -1
  4. package/dist/cluster/leader.js.map +1 -1
  5. package/dist/data/procedures-query.d.ts +19 -0
  6. package/dist/data/procedures-query.js +105 -0
  7. package/dist/data/procedures-query.js.map +1 -0
  8. package/dist/data/procedures-table.d.ts +5 -20
  9. package/dist/data/procedures-table.js +10 -106
  10. package/dist/data/procedures-table.js.map +1 -1
  11. package/dist/data/runs-table.d.ts +3 -3
  12. package/dist/data/runs-table.js.map +1 -1
  13. package/dist/db/models/automation_template.model.d.ts +13 -13
  14. package/dist/db/models/automation_template.model.js +13 -14
  15. package/dist/db/models/automation_template.model.js.map +1 -1
  16. package/dist/db/models/procedure.model.d.ts +7 -5
  17. package/dist/db/models/procedure_run.model.d.ts +9 -6
  18. package/dist/db/models/procedure_run.model.js +8 -8
  19. package/dist/db/models/procedure_run.model.js.map +1 -1
  20. package/dist/db/models/stats.model.js.map +1 -1
  21. package/dist/db/models/type_switch.model.d.ts +7 -5
  22. package/dist/db/tables/procedure_run.table.d.ts +2 -1
  23. package/dist/db/tables/procedure_run.table.js.map +1 -1
  24. package/dist/implementations/dms-automation/index.d.ts +2 -2
  25. package/dist/implementations/dms-automation/index.js.map +1 -1
  26. package/dist/index.js.map +1 -1
  27. package/dist/pages/category.js.map +1 -1
  28. package/dist/pages/index.js.map +1 -1
  29. package/dist/pages/overview.js.map +1 -1
  30. package/dist/pages/procedures.js.map +1 -1
  31. package/dist/pages/runs.js.map +1 -1
  32. package/dist/pages/shared.js +1 -1
  33. package/dist/pages/shared.js.map +1 -1
  34. package/dist/realtime.d.ts +2 -1
  35. package/dist/realtime.js.map +1 -1
  36. package/dist/routes/action-types.d.ts +3 -2
  37. package/dist/routes/action-types.js.map +1 -1
  38. package/dist/routes/data-node-types.d.ts +1 -1
  39. package/dist/routes/deleteConfirm.js +4 -3
  40. package/dist/routes/deleteConfirm.js.map +1 -1
  41. package/dist/routes/graphSchema.d.ts +2 -1
  42. package/dist/routes/graphSchema.js +13 -10
  43. package/dist/routes/graphSchema.js.map +1 -1
  44. package/dist/routes/library.d.ts +12 -1
  45. package/dist/routes/library.js +38 -34
  46. package/dist/routes/library.js.map +1 -1
  47. package/dist/routes/procedureChecks.js +5 -5
  48. package/dist/routes/procedureChecks.js.map +1 -1
  49. package/dist/routes/procedureRuns.d.ts +3 -3
  50. package/dist/routes/procedureRuns.js +1 -1
  51. package/dist/routes/procedureRuns.js.map +1 -1
  52. package/dist/routes/procedureSchemas.d.ts +7 -6
  53. package/dist/routes/procedureSchemas.js +4 -2
  54. package/dist/routes/procedureSchemas.js.map +1 -1
  55. package/dist/routes/procedures.d.ts +15 -14
  56. package/dist/routes/procedures.js +2 -1
  57. package/dist/routes/procedures.js.map +1 -1
  58. package/dist/routes/requests.d.ts +12 -6
  59. package/dist/routes/requests.js +2 -1
  60. package/dist/routes/requests.js.map +1 -1
  61. package/dist/routes/runs.d.ts +9 -8
  62. package/dist/routes/runs.js +5 -3
  63. package/dist/routes/runs.js.map +1 -1
  64. package/dist/routes/stats.js.map +1 -1
  65. package/dist/routes/templates.d.ts +5 -4
  66. package/dist/routes/templates.js +2 -1
  67. package/dist/routes/templates.js.map +1 -1
  68. package/dist/routes/trigger-types.d.ts +3 -2
  69. package/dist/routes/trigger-types.js.map +1 -1
  70. package/dist/routes/typeConfigShared.d.ts +2 -1
  71. package/dist/routes/typeConfigShared.js.map +1 -1
  72. package/dist/routes/zodJson.d.ts +3 -0
  73. package/dist/routes/zodJson.js +21 -0
  74. package/dist/routes/zodJson.js.map +1 -0
  75. package/dist/runtime/armErrors.d.ts +0 -1
  76. package/dist/runtime/armErrors.js +5 -12
  77. package/dist/runtime/armErrors.js.map +1 -1
  78. package/dist/runtime/boundRunLog.d.ts +7 -5
  79. package/dist/runtime/boundRunLog.js +24 -20
  80. package/dist/runtime/boundRunLog.js.map +1 -1
  81. package/dist/runtime/builtins/actions/http.d.ts +7 -3
  82. package/dist/runtime/builtins/actions/http.js +33 -22
  83. package/dist/runtime/builtins/actions/http.js.map +1 -1
  84. package/dist/runtime/builtins/actions/log.d.ts +5 -4
  85. package/dist/runtime/builtins/actions/log.js.map +1 -1
  86. package/dist/runtime/builtins/data/boolean.d.ts +2 -1
  87. package/dist/runtime/builtins/data/boolean.js +4 -5
  88. package/dist/runtime/builtins/data/boolean.js.map +1 -1
  89. package/dist/runtime/builtins/data/compare.js +8 -10
  90. package/dist/runtime/builtins/data/compare.js.map +1 -1
  91. package/dist/runtime/builtins/data/constant.js +1 -1
  92. package/dist/runtime/builtins/data/constant.js.map +1 -1
  93. package/dist/runtime/builtins/data/json.js +4 -5
  94. package/dist/runtime/builtins/data/json.js.map +1 -1
  95. package/dist/runtime/builtins/data/math.js +4 -4
  96. package/dist/runtime/builtins/data/math.js.map +1 -1
  97. package/dist/runtime/builtins/data/object.js +27 -27
  98. package/dist/runtime/builtins/data/object.js.map +1 -1
  99. package/dist/runtime/builtins/data/string.js +13 -18
  100. package/dist/runtime/builtins/data/string.js.map +1 -1
  101. package/dist/runtime/builtins/nodes/action.js +16 -5
  102. package/dist/runtime/builtins/nodes/action.js.map +1 -1
  103. package/dist/runtime/builtins/nodes/data.js +2 -2
  104. package/dist/runtime/builtins/nodes/data.js.map +1 -1
  105. package/dist/runtime/builtins/nodes/delay.js +2 -2
  106. package/dist/runtime/builtins/nodes/delay.js.map +1 -1
  107. package/dist/runtime/builtins/nodes/forRange.js +2 -2
  108. package/dist/runtime/builtins/nodes/forRange.js.map +1 -1
  109. package/dist/runtime/builtins/nodes/foreach.js +2 -2
  110. package/dist/runtime/builtins/nodes/foreach.js.map +1 -1
  111. package/dist/runtime/builtins/nodes/groupInput.js +2 -2
  112. package/dist/runtime/builtins/nodes/groupInput.js.map +1 -1
  113. package/dist/runtime/builtins/nodes/groupOutput.js +2 -2
  114. package/dist/runtime/builtins/nodes/groupOutput.js.map +1 -1
  115. package/dist/runtime/builtins/nodes/if.js +2 -2
  116. package/dist/runtime/builtins/nodes/if.js.map +1 -1
  117. package/dist/runtime/builtins/nodes/parallel.js +2 -2
  118. package/dist/runtime/builtins/nodes/parallel.js.map +1 -1
  119. package/dist/runtime/builtins/nodes/retry.js +13 -5
  120. package/dist/runtime/builtins/nodes/retry.js.map +1 -1
  121. package/dist/runtime/builtins/nodes/setVariable.js +2 -2
  122. package/dist/runtime/builtins/nodes/setVariable.js.map +1 -1
  123. package/dist/runtime/builtins/nodes/switch.js +8 -3
  124. package/dist/runtime/builtins/nodes/switch.js.map +1 -1
  125. package/dist/runtime/builtins/nodes/trigger.js +2 -2
  126. package/dist/runtime/builtins/nodes/trigger.js.map +1 -1
  127. package/dist/runtime/builtins/nodes/tryCatch.js +2 -2
  128. package/dist/runtime/builtins/nodes/tryCatch.js.map +1 -1
  129. package/dist/runtime/builtins/triggers/cron.d.ts +4 -3
  130. package/dist/runtime/builtins/triggers/cron.js +5 -7
  131. package/dist/runtime/builtins/triggers/cron.js.map +1 -1
  132. package/dist/runtime/builtins/triggers/webhook.d.ts +11 -7
  133. package/dist/runtime/builtins/triggers/webhook.js +15 -12
  134. package/dist/runtime/builtins/triggers/webhook.js.map +1 -1
  135. package/dist/runtime/declaredProcedures.d.ts +2 -2
  136. package/dist/runtime/declaredProcedures.js +3 -2
  137. package/dist/runtime/declaredProcedures.js.map +1 -1
  138. package/dist/runtime/describe.d.ts +3 -1
  139. package/dist/runtime/describe.js +14 -13
  140. package/dist/runtime/describe.js.map +1 -1
  141. package/dist/runtime/executor.d.ts +2 -1
  142. package/dist/runtime/executor.js +18 -13
  143. package/dist/runtime/executor.js.map +1 -1
  144. package/dist/runtime/flatten.d.ts +1 -1
  145. package/dist/runtime/flatten.js +1 -1
  146. package/dist/runtime/flatten.js.map +1 -1
  147. package/dist/runtime/graphIssues.d.ts +2 -2
  148. package/dist/runtime/graphIssues.js +39 -32
  149. package/dist/runtime/graphIssues.js.map +1 -1
  150. package/dist/runtime/graphVersion.d.ts +1 -1
  151. package/dist/runtime/graphVersion.js +4 -3
  152. package/dist/runtime/graphVersion.js.map +1 -1
  153. package/dist/runtime/nodeKinds.d.ts +6 -5
  154. package/dist/runtime/nodeKinds.js.map +1 -1
  155. package/dist/runtime/reconcile.d.ts +3 -0
  156. package/dist/runtime/reconcile.js +178 -0
  157. package/dist/runtime/reconcile.js.map +1 -0
  158. package/dist/runtime/registry.d.ts +3 -3
  159. package/dist/runtime/resolveInputs.d.ts +13 -8
  160. package/dist/runtime/resolveInputs.js +18 -18
  161. package/dist/runtime/resolveInputs.js.map +1 -1
  162. package/dist/runtime/resolveSubgraph.js +4 -5
  163. package/dist/runtime/resolveSubgraph.js.map +1 -1
  164. package/dist/runtime/retention.js.map +1 -1
  165. package/dist/runtime/runProcedure.d.ts +3 -2
  166. package/dist/runtime/runProcedure.js +2 -1
  167. package/dist/runtime/runProcedure.js.map +1 -1
  168. package/dist/runtime/schedule.js +3 -0
  169. package/dist/runtime/schedule.js.map +1 -1
  170. package/dist/runtime/schemaProperties.d.ts +3 -0
  171. package/dist/runtime/schemaProperties.js +7 -0
  172. package/dist/runtime/schemaProperties.js.map +1 -0
  173. package/dist/runtime/serialQueue.d.ts +1 -1
  174. package/dist/runtime/serialQueue.js +4 -4
  175. package/dist/runtime/serialQueue.js.map +1 -1
  176. package/dist/runtime/sideEffects.d.ts +2 -2
  177. package/dist/runtime/subscriptions.d.ts +6 -4
  178. package/dist/runtime/subscriptions.js +21 -180
  179. package/dist/runtime/subscriptions.js.map +1 -1
  180. package/dist/runtime/subwalk.js.map +1 -1
  181. package/dist/runtime/templateCacheState.d.ts +6 -0
  182. package/dist/runtime/templateCacheState.js +10 -0
  183. package/dist/runtime/templateCacheState.js.map +1 -0
  184. package/dist/runtime/templateUsages.js +4 -5
  185. package/dist/runtime/templateUsages.js.map +1 -1
  186. package/dist/runtime/topo.js +2 -4
  187. package/dist/runtime/topo.js.map +1 -1
  188. package/dist/runtime/trace.d.ts +5 -2
  189. package/dist/runtime/trace.js +27 -17
  190. package/dist/runtime/trace.js.map +1 -1
  191. package/dist/runtime/triggerHandles.d.ts +4 -3
  192. package/dist/runtime/triggerHandles.js +9 -1
  193. package/dist/runtime/triggerHandles.js.map +1 -1
  194. package/dist/runtime/typeOrigin.js +12 -1
  195. package/dist/runtime/typeOrigin.js.map +1 -1
  196. package/dist/runtime/validate.js.map +1 -1
  197. package/dist/runtime/validateTemplate.js.map +1 -1
  198. package/dist/runtime/withTimeout.js.map +1 -1
  199. package/dist/runtime/wording.js +12 -8
  200. package/dist/runtime/wording.js.map +1 -1
  201. package/dist/stats/health-banner.js.map +1 -1
  202. package/dist/stats/health.js.map +1 -1
  203. package/dist/stats/kpi.js +1 -1
  204. package/dist/stats/kpi.js.map +1 -1
  205. package/dist/stats/overview.js +2 -1
  206. package/dist/stats/overview.js.map +1 -1
  207. package/dist/types/dataValue.d.ts +7 -0
  208. package/dist/types/dataValue.js +56 -0
  209. package/dist/types/dataValue.js.map +1 -0
  210. package/dist/types/graph.d.ts +19 -13
  211. package/dist/types/graph.js +8 -0
  212. package/dist/types/graph.js.map +1 -1
  213. package/dist/types/guards.d.ts +8 -0
  214. package/dist/types/guards.js +35 -0
  215. package/dist/types/guards.js.map +1 -0
  216. package/dist/types/runLog.d.ts +8 -7
  217. package/dist/types/runLog.js.map +1 -1
  218. package/frontend-vue/app/build/components/editor/EditorBanners.vue +120 -0
  219. package/frontend-vue/app/build/components/editor/EditorChoiceModal.vue +44 -0
  220. package/frontend-vue/app/build/components/editor/EditorForkModal.vue +51 -0
  221. package/frontend-vue/app/build/components/editor/EditorHeader.vue +146 -0
  222. package/frontend-vue/app/build/components/editor/EditorSaveTemplateModal.vue +105 -0
  223. package/frontend-vue/app/build/components/editor/NodeInspectorDocs.vue +28 -0
  224. package/frontend-vue/app/build/components/editor/NodeInspectorRun.vue +48 -0
  225. package/frontend-vue/app/build/composables/editor/useBuilderMount.ts +129 -0
  226. package/frontend-vue/app/build/composables/editor/useBuilderSave.ts +256 -0
  227. package/frontend-vue/app/build/composables/editor/useBuilderShortcuts.ts +270 -0
  228. package/frontend-vue/app/build/composables/editor/useDraftProblems.ts +288 -0
  229. package/frontend-vue/app/build/composables/editor/useEditorContext.ts +388 -0
  230. package/frontend-vue/app/build/composables/editor/useEditorLoad.ts +158 -0
  231. package/frontend-vue/app/build/composables/editor/useForkToLocal.ts +193 -0
  232. package/frontend-vue/app/build/composables/editor/useGraphHistory.ts +113 -0
  233. package/frontend-vue/app/build/composables/editor/useGroupEditing.ts +445 -0
  234. package/frontend-vue/app/build/composables/editor/usePalette.ts +41 -0
  235. package/frontend-vue/app/build/composables/editor/useProcedureActions.ts +96 -0
  236. package/frontend-vue/app/build/composables/editor/useRunOverlay.ts +466 -0
  237. package/frontend-vue/app/build/composables/editor/useSaveAsTemplate.ts +172 -0
  238. package/frontend-vue/app/build/composables/editor/useSavedTriggers.ts +100 -0
  239. package/frontend-vue/app/build/composables/editor/useSubgraphNavigation.ts +270 -0
  240. package/frontend-vue/app/build/composables/editor/useUnsavedGuards.ts +233 -0
  241. package/frontend-vue/app/build/composables/graphCanvas/connect.ts +273 -0
  242. package/frontend-vue/app/build/composables/graphCanvas/edgeEvents.ts +172 -0
  243. package/frontend-vue/app/build/composables/graphCanvas/edges.ts +55 -0
  244. package/frontend-vue/app/build/composables/graphCanvas/handles.ts +181 -0
  245. package/frontend-vue/app/build/composables/graphCanvas/linkMenu.ts +123 -0
  246. package/frontend-vue/app/build/composables/graphCanvas/nodeData.ts +222 -0
  247. package/frontend-vue/app/build/composables/graphCanvas/placement.ts +248 -0
  248. package/frontend-vue/app/build/composables/graphCanvas/selection.ts +150 -0
  249. package/frontend-vue/app/build/composables/graphCanvas/types.ts +188 -0
  250. package/frontend-vue/app/build/composables/graphCanvas/view.ts +230 -0
  251. package/frontend-vue/app/build/types/editor.ts +94 -0
  252. package/frontend-vue/app/build/utils/editor/apiErrors.ts +74 -0
  253. package/frontend-vue/app/build/utils/editor/graphShape.ts +68 -0
  254. package/frontend-vue/app/build/utils/editor/groupPlan.ts +322 -0
  255. package/frontend-vue/app/build/utils/editor/groupPorts.ts +210 -0
  256. package/frontend-vue/app/build/utils/editor/keyboard.ts +22 -0
  257. package/frontend-vue/app/build/utils/inspectorFields.ts +117 -0
  258. package/frontend-vue/app/build/utils/templates.ts +88 -0
  259. package/frontend-vue/app/components/AttentionList.vue +2 -6
  260. package/frontend-vue/app/components/Catalog.vue +2 -1
  261. package/frontend-vue/app/components/Editor/GraphCanvas.vue +78 -1337
  262. package/frontend-vue/app/components/Editor/NodeInspector.vue +31 -123
  263. package/frontend-vue/app/components/Editor.vue +134 -3484
  264. package/frontend-vue/app/components/Templates.vue +14 -84
  265. package/frontend-vue/build/backend-boundary.ts +122 -0
  266. package/frontend-vue/dms.frontend.build.ts +2 -0
  267. package/frontend-vue/eslint-rules/index.mjs +103 -0
  268. package/frontend-vue/eslint.config.mjs +15 -0
  269. package/frontend-vue/package.json +8 -5
  270. package/frontend-vue/pnpm-lock.yaml +168 -139
  271. package/frontend-vue/tests/api-error-presentation.test.cjs +254 -0
  272. package/frontend-vue/tests/helpers/setup.cjs +44 -0
  273. package/package.json +18 -15
  274. package/skills/dms-automation/SKILL.md +2 -2
  275. package/skills/dms-automation/cases.json +58 -0
@@ -0,0 +1,117 @@
1
+ import type {
2
+ DataNodeType,
3
+ JsonSchema,
4
+ JsonSchemaProperty,
5
+ } from "../../composables/useGraphConnect";
6
+
7
+ export function portsSchema(
8
+ ports: Array<{ name: string; type?: string }>,
9
+ ): JsonSchema {
10
+ return {
11
+ properties: Object.fromEntries(
12
+ ports.map((p) => [p.name, p.type ? { type: p.type } : {}]),
13
+ ),
14
+ };
15
+ }
16
+
17
+ export function asString(v: unknown): string {
18
+ if (v === undefined || v === null) return "";
19
+ if (typeof v === "string") return v;
20
+ return String(v);
21
+ }
22
+
23
+ export function asNumber(v: unknown): number | undefined {
24
+ if (v === undefined || v === null || v === "") return undefined;
25
+ const n = Number(v);
26
+ return Number.isNaN(n) ? undefined : n;
27
+ }
28
+
29
+ export function asBool(v: unknown): boolean {
30
+ return !!v;
31
+ }
32
+
33
+ // Returns true if `prop.type` is `"string"` OR an array of scalar types that
34
+ // includes `"string"`. Used to render a plain string input instead of a JSON
35
+ // textarea for multi-type fields like compare-node ports. A type that also
36
+ // takes an object or an array (an HTTP body) keeps the JSON editor, which
37
+ // still accepts plain text.
38
+ export function isStringish(prop: JsonSchemaProperty): boolean {
39
+ const t = prop.type;
40
+ if (t === "string") return true;
41
+ if (Array.isArray(t))
42
+ return (
43
+ t.includes("string") && !t.includes("object") && !t.includes("array")
44
+ );
45
+ return false;
46
+ }
47
+
48
+ export function isNumberish(prop: JsonSchemaProperty): boolean {
49
+ const t = prop.type;
50
+ if (t === "number" || t === "integer") return true;
51
+ if (
52
+ Array.isArray(t) &&
53
+ (t.includes("number") || t.includes("integer")) &&
54
+ !t.includes("string")
55
+ )
56
+ return true;
57
+ return false;
58
+ }
59
+
60
+ export function isBoolish(prop: JsonSchemaProperty): boolean {
61
+ const t = prop.type;
62
+ if (t === "boolean") return true;
63
+ if (
64
+ Array.isArray(t) &&
65
+ t.includes("boolean") &&
66
+ !t.includes("string") &&
67
+ !t.includes("number")
68
+ )
69
+ return true;
70
+ return false;
71
+ }
72
+
73
+ export function arrayToText(v: unknown): string {
74
+ if (Array.isArray(v)) return v.map((x) => String(x)).join("\n");
75
+ if (typeof v === "string") return v;
76
+ return "";
77
+ }
78
+
79
+ export function textToArray(s: string): string[] {
80
+ return s
81
+ .split("\n")
82
+ .map((x) => x.trim())
83
+ .filter((x) => x.length > 0);
84
+ }
85
+
86
+ /**
87
+ * A data node's form: its input schema (wired-port fields) merged with its
88
+ * config schema (in-place config fields, e.g. a constant's value). The config
89
+ * schema wins on key collisions; a node declaring only one schema is unaffected.
90
+ */
91
+ export function dataNodeSchema(t: DataNodeType): JsonSchema | null {
92
+ if (!t.configSchema) return t.inputSchema ?? null;
93
+ return {
94
+ type: "object",
95
+ properties: {
96
+ ...(t.inputSchema?.properties ?? {}),
97
+ ...(t.configSchema.properties ?? {}),
98
+ },
99
+ required: [
100
+ ...(t.inputSchema?.required ?? []),
101
+ ...(t.configSchema.required ?? []),
102
+ ],
103
+ };
104
+ }
105
+
106
+ /** A field key in words: "maxAttempts" becomes "Max attempts". */
107
+ export function nameInWords(name: string): string {
108
+ const words = name
109
+ .replace(/([a-z0-9])([A-Z])/g, "$1 $2")
110
+ .replace(/[_-]+/g, " ")
111
+ .toLowerCase()
112
+ .replace(
113
+ /\b(id|url)(s?)\b/g,
114
+ (_, word: string, plural: string) => word.toUpperCase() + plural,
115
+ );
116
+ return words.charAt(0).toUpperCase() + words.slice(1);
117
+ }
@@ -0,0 +1,88 @@
1
+ export interface JsonSchema {
2
+ type?: string | string[];
3
+ [key: string]: unknown;
4
+ }
5
+
6
+ export interface TemplatePort {
7
+ name: string;
8
+ kind: "data" | "trigger";
9
+ direction: "in" | "out";
10
+ schema?: JsonSchema;
11
+ }
12
+
13
+ export interface TemplateRow {
14
+ _id: string;
15
+ name: string;
16
+ description: string;
17
+ icon: string;
18
+ ports: TemplatePort[];
19
+ subgraph: unknown;
20
+ usageCount?: number;
21
+ updated_at?: string;
22
+ }
23
+
24
+ export interface TemplateUsage {
25
+ procedureId: string;
26
+ nodeId: string;
27
+ groupPath: string[];
28
+ }
29
+
30
+ export interface TemplateNesting {
31
+ templateId: string;
32
+ nodeId: string;
33
+ groupPath: string[];
34
+ }
35
+
36
+ export interface TemplateUsages {
37
+ procedures: TemplateUsage[];
38
+ templates: TemplateNesting[];
39
+ }
40
+
41
+ export interface ProcedureSummary {
42
+ procedureId: string;
43
+ name: string;
44
+ status: "failing" | "degraded" | "healthy" | "paused" | "draft";
45
+ }
46
+
47
+ export interface UsageRow {
48
+ kind: "procedure" | "template";
49
+ id: string;
50
+ first: TemplateUsage | TemplateNesting;
51
+ count: number;
52
+ }
53
+
54
+ /** One line per procedure or template placing it, with how many times. */
55
+ export function usageRowsOf(usages: TemplateUsages): UsageRow[] {
56
+ const rows = new Map<string, UsageRow>();
57
+ for (const usage of usages.procedures) {
58
+ const row = rows.get(`p:${usage.procedureId}`);
59
+ if (row) row.count++;
60
+ else
61
+ rows.set(`p:${usage.procedureId}`, {
62
+ kind: "procedure",
63
+ id: usage.procedureId,
64
+ first: usage,
65
+ count: 1,
66
+ });
67
+ }
68
+ for (const nesting of usages.templates) {
69
+ const row = rows.get(`t:${nesting.templateId}`);
70
+ if (row) row.count++;
71
+ else
72
+ rows.set(`t:${nesting.templateId}`, {
73
+ kind: "template",
74
+ id: nesting.templateId,
75
+ first: nesting,
76
+ count: 1,
77
+ });
78
+ }
79
+ return [...rows.values()];
80
+ }
81
+
82
+ export function schemaTypeOf(p: TemplatePort): string {
83
+ if (p.kind !== "data") return "—";
84
+ const type = p.schema?.type;
85
+ if (typeof type === "string") return type;
86
+ if (Array.isArray(type)) return type.join(" | ");
87
+ return "any";
88
+ }
@@ -46,6 +46,7 @@ const { processI18n } = useTranslation()
46
46
  const { t, te } = useI18n()
47
47
  const { dateTimeFormat } = useRegionalFormat()
48
48
  const toast = useToast()
49
+ const { presentError } = useApiErrorPresenter()
49
50
 
50
51
  // Read like the DMS cards: over the page's period, on its refreshes, through
51
52
  // its Live / Pause.
@@ -108,12 +109,7 @@ interface Change {
108
109
  }
109
110
 
110
111
  function failed(e: unknown) {
111
- toast.add({
112
- title: processI18n('$dms_automation.common.actionFailed'),
113
- description: describeApiError(e),
114
- color: 'error',
115
- icon: 'i-ph-warning',
116
- })
112
+ presentError(e, { fallbackKey: 'dms_automation.common.actionFailed' })
117
113
  }
118
114
 
119
115
  /**
@@ -80,6 +80,7 @@ const { processI18n } = useTranslation()
80
80
  const { processText } = useComposedText()
81
81
  const { t, te } = useI18n()
82
82
  const toast = useToast()
83
+ const { presentError } = useApiErrorPresenter()
83
84
  const { confirm } = useConfirm()
84
85
  const route = useDmsRoute()
85
86
  const router = useDmsRouter()
@@ -256,7 +257,7 @@ async function setEnabled(enabled: boolean) {
256
257
  icon: 'i-ph-check-circle',
257
258
  })
258
259
  } catch (e) {
259
- toast.add({ title: t('dms_automation.common.actionFailed'), description: describeApiError(e), color: 'error', icon: 'i-ph-warning' })
260
+ presentError(e, { fallbackKey: 'dms_automation.common.actionFailed' })
260
261
  } finally {
261
262
  saving.value = false
262
263
  }