@antelopejs/dms-automation 0.6.0 → 0.8.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 (262) hide show
  1. package/README.md +21 -7
  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 -16
  9. package/dist/data/procedures-table.js +12 -101
  10. package/dist/data/procedures-table.js.map +1 -1
  11. package/dist/data/runs-table.js +0 -5
  12. package/dist/data/runs-table.js.map +1 -1
  13. package/dist/db/models/automation_template.model.d.ts +2 -4
  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_run.model.js.map +1 -1
  17. package/dist/db/models/stats.model.js.map +1 -1
  18. package/dist/db/tables/procedure.table.d.ts +0 -1
  19. package/dist/db/tables/procedure.table.js +0 -4
  20. package/dist/db/tables/procedure.table.js.map +1 -1
  21. package/dist/db/tables/procedure_run.table.d.ts +2 -1
  22. package/dist/db/tables/procedure_run.table.js.map +1 -1
  23. package/dist/implementations/dms-automation/index.js.map +1 -1
  24. package/dist/index.js.map +1 -1
  25. package/dist/pages/category.js.map +1 -1
  26. package/dist/pages/index.js.map +1 -1
  27. package/dist/pages/overview.js.map +1 -1
  28. package/dist/pages/procedures.js.map +1 -1
  29. package/dist/pages/runs.js.map +1 -1
  30. package/dist/pages/shared.js +1 -1
  31. package/dist/pages/shared.js.map +1 -1
  32. package/dist/realtime.d.ts +2 -1
  33. package/dist/realtime.js.map +1 -1
  34. package/dist/routes/action-types.d.ts +2 -1
  35. package/dist/routes/action-types.js.map +1 -1
  36. package/dist/routes/deleteConfirm.js +4 -3
  37. package/dist/routes/deleteConfirm.js.map +1 -1
  38. package/dist/routes/graphSchema.d.ts +2 -1
  39. package/dist/routes/graphSchema.js +8 -7
  40. package/dist/routes/graphSchema.js.map +1 -1
  41. package/dist/routes/procedureChecks.js +5 -5
  42. package/dist/routes/procedureChecks.js.map +1 -1
  43. package/dist/routes/procedureRuns.d.ts +2 -2
  44. package/dist/routes/procedureRuns.js +1 -1
  45. package/dist/routes/procedureRuns.js.map +1 -1
  46. package/dist/routes/procedures.d.ts +14 -15
  47. package/dist/routes/procedures.js +2 -1
  48. package/dist/routes/procedures.js.map +1 -1
  49. package/dist/routes/requests.d.ts +11 -5
  50. package/dist/routes/requests.js.map +1 -1
  51. package/dist/routes/runs.d.ts +7 -7
  52. package/dist/routes/runs.js +5 -3
  53. package/dist/routes/runs.js.map +1 -1
  54. package/dist/routes/stats.js.map +1 -1
  55. package/dist/routes/templates.d.ts +3 -2
  56. package/dist/routes/templates.js +2 -1
  57. package/dist/routes/templates.js.map +1 -1
  58. package/dist/routes/trigger-types.d.ts +2 -1
  59. package/dist/routes/trigger-types.js.map +1 -1
  60. package/dist/routes/typeConfigShared.d.ts +2 -1
  61. package/dist/routes/typeConfigShared.js.map +1 -1
  62. package/dist/runtime/armErrors.d.ts +0 -1
  63. package/dist/runtime/armErrors.js +0 -7
  64. package/dist/runtime/armErrors.js.map +1 -1
  65. package/dist/runtime/boundRunLog.d.ts +1 -0
  66. package/dist/runtime/boundRunLog.js +11 -11
  67. package/dist/runtime/boundRunLog.js.map +1 -1
  68. package/dist/runtime/builtins/actions/http.js +16 -9
  69. package/dist/runtime/builtins/actions/http.js.map +1 -1
  70. package/dist/runtime/builtins/actions/log.js.map +1 -1
  71. package/dist/runtime/builtins/data/boolean.js +4 -5
  72. package/dist/runtime/builtins/data/boolean.js.map +1 -1
  73. package/dist/runtime/builtins/data/compare.js +8 -10
  74. package/dist/runtime/builtins/data/compare.js.map +1 -1
  75. package/dist/runtime/builtins/data/constant.js +1 -1
  76. package/dist/runtime/builtins/data/constant.js.map +1 -1
  77. package/dist/runtime/builtins/data/json.js +4 -5
  78. package/dist/runtime/builtins/data/json.js.map +1 -1
  79. package/dist/runtime/builtins/data/math.js +4 -4
  80. package/dist/runtime/builtins/data/math.js.map +1 -1
  81. package/dist/runtime/builtins/data/object.js +12 -17
  82. package/dist/runtime/builtins/data/object.js.map +1 -1
  83. package/dist/runtime/builtins/data/string.js +13 -18
  84. package/dist/runtime/builtins/data/string.js.map +1 -1
  85. package/dist/runtime/builtins/nodes/action.js +5 -2
  86. package/dist/runtime/builtins/nodes/action.js.map +1 -1
  87. package/dist/runtime/builtins/nodes/data.js +2 -2
  88. package/dist/runtime/builtins/nodes/data.js.map +1 -1
  89. package/dist/runtime/builtins/nodes/delay.js +2 -2
  90. package/dist/runtime/builtins/nodes/delay.js.map +1 -1
  91. package/dist/runtime/builtins/nodes/forRange.js +2 -2
  92. package/dist/runtime/builtins/nodes/forRange.js.map +1 -1
  93. package/dist/runtime/builtins/nodes/foreach.js +2 -2
  94. package/dist/runtime/builtins/nodes/foreach.js.map +1 -1
  95. package/dist/runtime/builtins/nodes/groupInput.js +2 -2
  96. package/dist/runtime/builtins/nodes/groupInput.js.map +1 -1
  97. package/dist/runtime/builtins/nodes/groupOutput.js +2 -2
  98. package/dist/runtime/builtins/nodes/groupOutput.js.map +1 -1
  99. package/dist/runtime/builtins/nodes/if.js +2 -2
  100. package/dist/runtime/builtins/nodes/if.js.map +1 -1
  101. package/dist/runtime/builtins/nodes/parallel.js +2 -2
  102. package/dist/runtime/builtins/nodes/parallel.js.map +1 -1
  103. package/dist/runtime/builtins/nodes/retry.js +5 -6
  104. package/dist/runtime/builtins/nodes/retry.js.map +1 -1
  105. package/dist/runtime/builtins/nodes/setVariable.js +2 -2
  106. package/dist/runtime/builtins/nodes/setVariable.js.map +1 -1
  107. package/dist/runtime/builtins/nodes/switch.js +2 -2
  108. package/dist/runtime/builtins/nodes/switch.js.map +1 -1
  109. package/dist/runtime/builtins/nodes/trigger.js +2 -2
  110. package/dist/runtime/builtins/nodes/trigger.js.map +1 -1
  111. package/dist/runtime/builtins/nodes/tryCatch.js +2 -4
  112. package/dist/runtime/builtins/nodes/tryCatch.js.map +1 -1
  113. package/dist/runtime/builtins/triggers/cron.d.ts +2 -1
  114. package/dist/runtime/builtins/triggers/cron.js +5 -7
  115. package/dist/runtime/builtins/triggers/cron.js.map +1 -1
  116. package/dist/runtime/builtins/triggers/webhook.d.ts +6 -5
  117. package/dist/runtime/builtins/triggers/webhook.js +9 -6
  118. package/dist/runtime/builtins/triggers/webhook.js.map +1 -1
  119. package/dist/runtime/declaredProcedures.d.ts +2 -2
  120. package/dist/runtime/declaredProcedures.js +17 -92
  121. package/dist/runtime/declaredProcedures.js.map +1 -1
  122. package/dist/runtime/describe.js +11 -10
  123. package/dist/runtime/describe.js.map +1 -1
  124. package/dist/runtime/executionResult.d.ts +1 -1
  125. package/dist/runtime/executor.js +12 -38
  126. package/dist/runtime/executor.js.map +1 -1
  127. package/dist/runtime/flatten.d.ts +1 -1
  128. package/dist/runtime/flatten.js +1 -1
  129. package/dist/runtime/flatten.js.map +1 -1
  130. package/dist/runtime/graphIssues.js +24 -22
  131. package/dist/runtime/graphIssues.js.map +1 -1
  132. package/dist/runtime/graphVersion.d.ts +1 -1
  133. package/dist/runtime/graphVersion.js +2 -1
  134. package/dist/runtime/graphVersion.js.map +1 -1
  135. package/dist/runtime/nodeKinds.d.ts +3 -2
  136. package/dist/runtime/nodeKinds.js.map +1 -1
  137. package/dist/runtime/reconcile.d.ts +3 -0
  138. package/dist/runtime/reconcile.js +178 -0
  139. package/dist/runtime/reconcile.js.map +1 -0
  140. package/dist/runtime/registry.d.ts +0 -7
  141. package/dist/runtime/registry.js +3 -24
  142. package/dist/runtime/registry.js.map +1 -1
  143. package/dist/runtime/resolveInputs.d.ts +4 -2
  144. package/dist/runtime/resolveInputs.js +13 -12
  145. package/dist/runtime/resolveInputs.js.map +1 -1
  146. package/dist/runtime/resolveSubgraph.js +4 -5
  147. package/dist/runtime/resolveSubgraph.js.map +1 -1
  148. package/dist/runtime/retention.js.map +1 -1
  149. package/dist/runtime/runProcedure.d.ts +1 -1
  150. package/dist/runtime/runProcedure.js +2 -1
  151. package/dist/runtime/runProcedure.js.map +1 -1
  152. package/dist/runtime/schedule.js +3 -0
  153. package/dist/runtime/schedule.js.map +1 -1
  154. package/dist/runtime/schemaProperties.d.ts +11 -0
  155. package/dist/runtime/schemaProperties.js +7 -0
  156. package/dist/runtime/schemaProperties.js.map +1 -0
  157. package/dist/runtime/serialQueue.d.ts +1 -1
  158. package/dist/runtime/serialQueue.js +4 -4
  159. package/dist/runtime/serialQueue.js.map +1 -1
  160. package/dist/runtime/subscriptions.js +21 -183
  161. package/dist/runtime/subscriptions.js.map +1 -1
  162. package/dist/runtime/subwalk.js.map +1 -1
  163. package/dist/runtime/templateCacheState.d.ts +6 -0
  164. package/dist/runtime/templateCacheState.js +10 -0
  165. package/dist/runtime/templateCacheState.js.map +1 -0
  166. package/dist/runtime/templateUsages.js +4 -5
  167. package/dist/runtime/templateUsages.js.map +1 -1
  168. package/dist/runtime/topo.js +2 -4
  169. package/dist/runtime/topo.js.map +1 -1
  170. package/dist/runtime/trace.js +12 -9
  171. package/dist/runtime/trace.js.map +1 -1
  172. package/dist/runtime/triggerHandles.d.ts +3 -0
  173. package/dist/runtime/triggerHandles.js +8 -3
  174. package/dist/runtime/triggerHandles.js.map +1 -1
  175. package/dist/runtime/typeOrigin.js +12 -1
  176. package/dist/runtime/typeOrigin.js.map +1 -1
  177. package/dist/runtime/validate.js.map +1 -1
  178. package/dist/runtime/validateTemplate.js.map +1 -1
  179. package/dist/runtime/withTimeout.js.map +1 -1
  180. package/dist/runtime/wording.js +12 -8
  181. package/dist/runtime/wording.js.map +1 -1
  182. package/dist/stats/health-banner.js.map +1 -1
  183. package/dist/stats/health.js +2 -3
  184. package/dist/stats/health.js.map +1 -1
  185. package/dist/stats/kpi.js +1 -1
  186. package/dist/stats/kpi.js.map +1 -1
  187. package/dist/stats/overview.js +2 -1
  188. package/dist/stats/overview.js.map +1 -1
  189. package/dist/types/dataValue.d.ts +8 -0
  190. package/dist/types/dataValue.js +36 -0
  191. package/dist/types/dataValue.js.map +1 -0
  192. package/dist/types/graph.d.ts +8 -1
  193. package/dist/types/graph.js +8 -0
  194. package/dist/types/graph.js.map +1 -1
  195. package/dist/types/guards.d.ts +8 -0
  196. package/dist/types/guards.js +35 -0
  197. package/dist/types/guards.js.map +1 -0
  198. package/frontend-vue/app/build/components/editor/EditorBanners.vue +120 -0
  199. package/frontend-vue/app/build/components/editor/EditorChoiceModal.vue +44 -0
  200. package/frontend-vue/app/build/components/editor/EditorForkModal.vue +51 -0
  201. package/frontend-vue/app/build/components/editor/EditorHeader.vue +146 -0
  202. package/frontend-vue/app/build/components/editor/EditorSaveTemplateModal.vue +105 -0
  203. package/frontend-vue/app/build/components/editor/NodeInspectorDocs.vue +28 -0
  204. package/frontend-vue/app/build/components/editor/NodeInspectorRun.vue +48 -0
  205. package/frontend-vue/app/build/composables/editor/useBuilderMount.ts +129 -0
  206. package/frontend-vue/app/build/composables/editor/useBuilderSave.ts +256 -0
  207. package/frontend-vue/app/build/composables/editor/useBuilderShortcuts.ts +270 -0
  208. package/frontend-vue/app/build/composables/editor/useDraftProblems.ts +288 -0
  209. package/frontend-vue/app/build/composables/editor/useEditorContext.ts +388 -0
  210. package/frontend-vue/app/build/composables/editor/useEditorLoad.ts +158 -0
  211. package/frontend-vue/app/build/composables/editor/useForkToLocal.ts +193 -0
  212. package/frontend-vue/app/build/composables/editor/useGraphHistory.ts +113 -0
  213. package/frontend-vue/app/build/composables/editor/useGroupEditing.ts +445 -0
  214. package/frontend-vue/app/build/composables/editor/usePalette.ts +41 -0
  215. package/frontend-vue/app/build/composables/editor/useProcedureActions.ts +96 -0
  216. package/frontend-vue/app/build/composables/editor/useRunOverlay.ts +466 -0
  217. package/frontend-vue/app/build/composables/editor/useSaveAsTemplate.ts +172 -0
  218. package/frontend-vue/app/build/composables/editor/useSavedTriggers.ts +100 -0
  219. package/frontend-vue/app/build/composables/editor/useSubgraphNavigation.ts +270 -0
  220. package/frontend-vue/app/build/composables/editor/useUnsavedGuards.ts +233 -0
  221. package/frontend-vue/app/build/composables/graphCanvas/connect.ts +273 -0
  222. package/frontend-vue/app/build/composables/graphCanvas/edgeEvents.ts +172 -0
  223. package/frontend-vue/app/build/composables/graphCanvas/edges.ts +55 -0
  224. package/frontend-vue/app/build/composables/graphCanvas/handles.ts +181 -0
  225. package/frontend-vue/app/build/composables/graphCanvas/linkMenu.ts +123 -0
  226. package/frontend-vue/app/build/composables/graphCanvas/nodeData.ts +222 -0
  227. package/frontend-vue/app/build/composables/graphCanvas/placement.ts +248 -0
  228. package/frontend-vue/app/build/composables/graphCanvas/selection.ts +150 -0
  229. package/frontend-vue/app/build/composables/graphCanvas/types.ts +188 -0
  230. package/frontend-vue/app/build/composables/graphCanvas/view.ts +230 -0
  231. package/frontend-vue/app/build/types/editor.ts +94 -0
  232. package/frontend-vue/app/build/utils/editor/apiErrors.ts +74 -0
  233. package/frontend-vue/app/build/utils/editor/graphShape.ts +68 -0
  234. package/frontend-vue/app/build/utils/editor/groupPlan.ts +322 -0
  235. package/frontend-vue/app/build/utils/editor/groupPorts.ts +210 -0
  236. package/frontend-vue/app/build/utils/editor/keyboard.ts +22 -0
  237. package/frontend-vue/app/build/utils/inspectorFields.ts +117 -0
  238. package/frontend-vue/app/build/utils/templates.ts +88 -0
  239. package/frontend-vue/app/components/AttentionList.vue +2 -6
  240. package/frontend-vue/app/components/Catalog.vue +2 -1
  241. package/frontend-vue/app/components/Editor/BottomDock.vue +0 -3
  242. package/frontend-vue/app/components/Editor/GraphCanvas.vue +78 -1337
  243. package/frontend-vue/app/components/Editor/NodeInspector.vue +31 -123
  244. package/frontend-vue/app/components/Editor.vue +134 -3490
  245. package/frontend-vue/app/components/Templates.vue +14 -84
  246. package/frontend-vue/app/composables/useAutomationRuns.ts +2 -2
  247. package/frontend-vue/build/backend-boundary.ts +122 -0
  248. package/frontend-vue/dms.frontend.build.ts +2 -0
  249. package/frontend-vue/eslint-rules/index.mjs +103 -0
  250. package/frontend-vue/eslint.config.mjs +15 -0
  251. package/frontend-vue/i18n/locales/dms-automation-en-GB.json +0 -3
  252. package/frontend-vue/i18n/locales/dms-automation-fr-FR.json +0 -3
  253. package/frontend-vue/package.json +7 -4
  254. package/frontend-vue/pnpm-lock.yaml +98 -68
  255. package/frontend-vue/tests/api-error-presentation.test.cjs +257 -0
  256. package/frontend-vue/tests/helpers/setup.cjs +44 -0
  257. package/package.json +10 -10
  258. package/skills/dms-automation/SKILL.md +4 -4
  259. package/skills/dms-automation/cases.json +58 -0
  260. package/dist/runtime/departed.d.ts +0 -6
  261. package/dist/runtime/departed.js +0 -38
  262. package/dist/runtime/departed.js.map +0 -1
@@ -2,6 +2,14 @@
2
2
  import { computed, nextTick, ref, useTemplateRef, watch } from 'vue'
3
3
  import { isIconName } from './IconPicker.vue'
4
4
  import { queryString } from '../utils/automation'
5
+ import {
6
+ schemaTypeOf,
7
+ usageRowsOf,
8
+ type ProcedureSummary,
9
+ type TemplateRow,
10
+ type TemplateUsage,
11
+ type TemplateUsages,
12
+ } from '../build/utils/templates'
5
13
 
6
14
  // The library's templates: reusable groups other procedures place as linked
7
15
  // blocks. The detail edits the name, icon and description, lists the ports
@@ -9,52 +17,6 @@ import { queryString } from '../utils/automation'
9
17
  // other templates; deleting forks every usage into a local group so they keep
10
18
  // working. The picked template is kept in the URL (`?template=`).
11
19
 
12
- interface JsonSchema {
13
- type?: string | string[]
14
- [key: string]: unknown
15
- }
16
-
17
- interface TemplatePort {
18
- name: string
19
- kind: 'data' | 'trigger'
20
- direction: 'in' | 'out'
21
- schema?: JsonSchema
22
- }
23
-
24
- interface TemplateRow {
25
- _id: string
26
- name: string
27
- description: string
28
- icon: string
29
- ports: TemplatePort[]
30
- subgraph: unknown
31
- usageCount?: number
32
- updated_at?: string
33
- }
34
-
35
- interface TemplateUsage {
36
- procedureId: string
37
- nodeId: string
38
- groupPath: string[]
39
- }
40
-
41
- interface TemplateNesting {
42
- templateId: string
43
- nodeId: string
44
- groupPath: string[]
45
- }
46
-
47
- interface TemplateUsages {
48
- procedures: TemplateUsage[]
49
- templates: TemplateNesting[]
50
- }
51
-
52
- interface ProcedureSummary {
53
- procedureId: string
54
- name: string
55
- status: 'failing' | 'degraded' | 'healthy' | 'paused' | 'draft'
56
- }
57
-
58
20
  const props = defineProps<{
59
21
  apiUrl: string
60
22
  builderUrl: string
@@ -74,6 +36,7 @@ const { $authFetch } = useAuthFetch()
74
36
  const route = useDmsRoute()
75
37
  const router = useDmsRouter()
76
38
  const toast = useToast()
39
+ const { presentError } = useApiErrorPresenter()
77
40
  const { t } = useI18n()
78
41
  const { confirm } = useConfirm()
79
42
 
@@ -181,20 +144,7 @@ function backToList() {
181
144
  }
182
145
 
183
146
  /** One line per procedure or template placing it, with how many times. */
184
- const usageRows = computed(() => {
185
- const rows = new Map<string, { kind: 'procedure' | 'template'; id: string; first: TemplateUsage | TemplateNesting; count: number }>()
186
- for (const usage of usages.value.procedures) {
187
- const row = rows.get(`p:${usage.procedureId}`)
188
- if (row) row.count++
189
- else rows.set(`p:${usage.procedureId}`, { kind: 'procedure', id: usage.procedureId, first: usage, count: 1 })
190
- }
191
- for (const nesting of usages.value.templates) {
192
- const row = rows.get(`t:${nesting.templateId}`)
193
- if (row) row.count++
194
- else rows.set(`t:${nesting.templateId}`, { kind: 'template', id: nesting.templateId, first: nesting, count: 1 })
195
- }
196
- return [...rows.values()]
197
- })
147
+ const usageRows = computed(() => usageRowsOf(usages.value))
198
148
 
199
149
  const NAME_ID = 'template-name'
200
150
  const NAME_MAX = 200
@@ -205,8 +155,6 @@ watch(formName, () => fieldErrors.clear('name'))
205
155
 
206
156
  interface RefusalBody {
207
157
  code?: string
208
- error?: string
209
- issues?: { path?: (string | number)[]; message?: string }[]
210
158
  }
211
159
 
212
160
  /** The `code` a refused request answered with, if any. */
@@ -214,13 +162,6 @@ function errorCode(e: unknown): string | undefined {
214
162
  return (e as { data?: RefusalBody }).data?.code
215
163
  }
216
164
 
217
- /** What the server said was wrong, rather than the request's raw status line. */
218
- function errorMessage(e: unknown): string {
219
- const body = (e as { data?: RefusalBody }).data
220
- const issues = body?.issues?.map((i) => (i.path?.length ? `${i.path.join('.')}: ${i.message}` : i.message)).filter(Boolean)
221
- return issues?.length ? issues.join(' · ') : (body?.error ?? describeApiError(e))
222
- }
223
-
224
165
  async function onSave() {
225
166
  const s = selected.value
226
167
  if (!s) return
@@ -247,7 +188,7 @@ async function onSave() {
247
188
  await fieldErrors.setError('name', t('dms_automation.templates.nameTaken'))
248
189
  return
249
190
  }
250
- toast.add({ title: t('dms_automation.templates.saveError'), description: errorMessage(e), color: 'error', icon: 'i-ph-warning' })
191
+ presentError(e, { fallbackKey: 'dms_automation.templates.saveError' })
251
192
  } finally {
252
193
  saving.value = false
253
194
  }
@@ -269,7 +210,7 @@ async function onDelete() {
269
210
  await usagesRead.refresh()
270
211
  const fresh = usagesRead.data.value
271
212
  if (usagesRead.error.value || !fresh) {
272
- toast.add({ title: t('dms_automation.templates.deleteError'), description: errorMessage(usagesRead.error.value), color: 'error', icon: 'i-ph-warning' })
213
+ presentError(usagesRead.error.value, { fallbackKey: 'dms_automation.templates.deleteError' })
273
214
  return
274
215
  }
275
216
  const count = fresh.procedures.length + fresh.templates.length
@@ -285,11 +226,8 @@ async function onDelete() {
285
226
  await $authFetch(`${props.apiUrl}/templates/${s._id}?force=1`, { method: 'DELETE' })
286
227
  } catch (e) {
287
228
  const kept = errorCode(e) === 'fork-incomplete'
288
- toast.add({
289
- title: kept ? t('dms_automation.templates.forkIncomplete') : t('dms_automation.templates.deleteError'),
290
- description: kept ? t('dms_automation.templates.forkIncompleteHint') : errorMessage(e),
291
- color: 'error',
292
- icon: 'i-ph-warning',
229
+ presentError(e, {
230
+ fallbackKey: kept ? 'dms_automation.templates.forkIncompleteHint' : 'dms_automation.templates.deleteError',
293
231
  })
294
232
  await usagesRead.refresh()
295
233
  return
@@ -311,14 +249,6 @@ function ownersOf(found: TemplateUsages): string {
311
249
  ].filter(Boolean)
312
250
  return parts.length === 2 ? t('dms_automation.templates.ownersAnd', { first: parts[0], second: parts[1] }) : parts[0]!
313
251
  }
314
-
315
- function schemaTypeOf(p: TemplatePort): string {
316
- if (p.kind !== 'data') return '—'
317
- const type = p.schema?.type
318
- if (typeof type === 'string') return type
319
- if (Array.isArray(type)) return type.join(' | ')
320
- return 'any'
321
- }
322
252
  </script>
323
253
 
324
254
  <template>
@@ -109,7 +109,7 @@ export interface RunDetail {
109
109
  procedureId: string;
110
110
  startedAt: string;
111
111
  endedAt?: string | null;
112
- status: "ok" | "failed" | "cancelled";
112
+ status: "ok" | "failed";
113
113
  errorMessage?: string | null;
114
114
  triggerNodeId: string;
115
115
  triggerPayload?: string;
@@ -156,7 +156,7 @@ export interface RunDetail {
156
156
  /** What `POST /runs/:id/rerun` answers: the new run and how it ended. */
157
157
  export interface RerunResult {
158
158
  runId: string;
159
- status?: "ok" | "failed" | "cancelled";
159
+ status?: "ok" | "failed";
160
160
  /** An i18n key (with `$`) to show when the new run failed. */
161
161
  warning?: string;
162
162
  }
@@ -0,0 +1,122 @@
1
+ import { existsSync, readFileSync, realpathSync } from "node:fs";
2
+ import { dirname, isAbsolute, join, relative, sep } from "node:path";
3
+ import type { DmsVitePluginEntry } from "#dms/frontend-build";
4
+
5
+ type VitePlugin = Extract<DmsVitePluginEntry, { name: string }>;
6
+
7
+ const BACKEND_PACKAGE = "@antelopejs/dms-automation";
8
+ const BACKEND_SOURCE = "src";
9
+ const QUERY_OR_HASH = /[?#].*$/;
10
+
11
+ const backendRoots = new Map<string, string | null>();
12
+
13
+ /** Whether a parsed manifest names its package. */
14
+ function isNamedManifest(value: unknown): value is { name: string } {
15
+ return (
16
+ typeof value === "object" &&
17
+ value !== null &&
18
+ "name" in value &&
19
+ typeof value.name === "string"
20
+ );
21
+ }
22
+
23
+ /** The package name a `package.json` declares, or `undefined`. */
24
+ function packageName(manifest: string): string | undefined {
25
+ try {
26
+ const parsed: unknown = JSON.parse(readFileSync(manifest, "utf8"));
27
+ return isNamedManifest(parsed) ? parsed.name : undefined;
28
+ } catch {
29
+ return undefined;
30
+ }
31
+ }
32
+
33
+ /** The directory of the backend package that holds `directory`, or null. */
34
+ function backendRoot(directory: string): string | null {
35
+ const known = backendRoots.get(directory);
36
+ if (known !== undefined) {
37
+ return known;
38
+ }
39
+ const manifest = join(directory, "package.json");
40
+ const parent = dirname(directory);
41
+ let root: string | null = null;
42
+ if (existsSync(manifest)) {
43
+ root = packageName(manifest) === BACKEND_PACKAGE ? directory : null;
44
+ } else if (parent !== directory) {
45
+ root = backendRoot(parent);
46
+ }
47
+ backendRoots.set(directory, root);
48
+ return root;
49
+ }
50
+
51
+ /**
52
+ * The real path of a resolved module id when it lies under the `src`
53
+ * directory of the backend package, or `undefined`. The package that owns the
54
+ * file decides, not a path, so the answer is the same in the repository and in
55
+ * the build workspace. Virtual ids and ids that are not files are ignored.
56
+ */
57
+ function backendSourceFile(id: string): string | undefined {
58
+ const path = id.replace(QUERY_OR_HASH, "");
59
+ if (!isAbsolute(path)) {
60
+ return undefined;
61
+ }
62
+ let real: string;
63
+ try {
64
+ real = realpathSync(path);
65
+ } catch {
66
+ return undefined;
67
+ }
68
+ const root = backendRoot(dirname(real));
69
+ if (root === null) {
70
+ return undefined;
71
+ }
72
+ return relative(root, real).split(sep)[0] === BACKEND_SOURCE
73
+ ? real
74
+ : undefined;
75
+ }
76
+
77
+ /**
78
+ * Fails the build and the dev server when a module of the frontend resolves to
79
+ * a file under the `src` of the backend package: the browser reaches the
80
+ * backend only through its HTTP interface. It checks what the whole resolution
81
+ * chain returns, an id marked external included, so an alias is seen through
82
+ * and a symlink the resolver returns is followed to its real path, and it runs
83
+ * before the other plugins (`enforce: "pre"`). Vite builds workers with their
84
+ * own plugin list, so the plugin adds itself there too.
85
+ *
86
+ * antelopejs-sync writes this file from `@antelopejs/tooling-configs` and
87
+ * restores it on every run: change the plugin in the pack, not here.
88
+ */
89
+ export function backendBoundary(): VitePlugin {
90
+ return {
91
+ ...boundaryCheck(),
92
+ config: () => ({ worker: { plugins: () => [boundaryCheck()] } }),
93
+ };
94
+ }
95
+
96
+ /** The check alone, as a worker build runs it. */
97
+ function boundaryCheck(): VitePlugin {
98
+ return {
99
+ name: `${BACKEND_PACKAGE}:backend-boundary`,
100
+ enforce: "pre",
101
+ async resolveId(source, importer, options) {
102
+ const resolved = await this.resolve(source, importer, {
103
+ ...options,
104
+ skipSelf: true,
105
+ });
106
+ if (resolved === null) {
107
+ return resolved;
108
+ }
109
+ const file = backendSourceFile(resolved.id);
110
+ if (file === undefined) {
111
+ return resolved;
112
+ }
113
+ const from =
114
+ importer === undefined
115
+ ? "an entry point"
116
+ : importer.replace(QUERY_OR_HASH, "");
117
+ return this.error(
118
+ `Backend boundary: ${from} imports ${file}, which is under the src of ${BACKEND_PACKAGE}. The frontend reaches the backend only through its HTTP interface.`,
119
+ );
120
+ },
121
+ };
122
+ }
@@ -1,7 +1,9 @@
1
1
  import { defineDmsFrontendBuild } from "#dms/frontend-build";
2
+ import { backendBoundary } from "./build/backend-boundary.ts";
2
3
 
3
4
  // The layer's public helpers, auto-imported in its own components: nothing is
4
5
  // auto-imported from a module that does not list its folders here.
5
6
  export default defineDmsFrontendBuild((build) => {
6
7
  build.registerAutoImports(["app/composables", "app/utils"]);
8
+ build.registerVitePlugins(() => [backendBoundary()]);
7
9
  });
@@ -0,0 +1,103 @@
1
+ const BLANK = /^\s*$/;
2
+ const ROW_TOKEN = /\{\{[^}]*\}\}/g;
3
+ const BARE_BRACES = /\{[^}]*\}/;
4
+
5
+ /**
6
+ * The end of what precedes `element` in its parent: the previous sibling that
7
+ * is not blank text, or the parent's start tag.
8
+ */
9
+ function precedingEnd(element) {
10
+ const siblings = element.parent.children;
11
+ const index = siblings.indexOf(element);
12
+ const previous = siblings
13
+ .slice(0, index)
14
+ .reverse()
15
+ .find((node) => !(node.type === "VText" && BLANK.test(node.value)));
16
+ return previous ? previous.range[1] : element.parent.startTag.range[1];
17
+ }
18
+
19
+ /**
20
+ * A comment between the branches of a `v-if` chain hydrates with a mismatch:
21
+ * the development compiler moves it into the next branch, which then renders
22
+ * as a fragment, while the server's production compile drops it and renders
23
+ * the bare element.
24
+ */
25
+ const noCommentBeforeElse = {
26
+ meta: {
27
+ type: "problem",
28
+ schema: [],
29
+ messages: {
30
+ misplaced:
31
+ "A template comment before `v-else-if` or `v-else` hydrates with a mismatch. Put it inside the branch's element, or into the script.",
32
+ },
33
+ },
34
+ create(context) {
35
+ const { defineTemplateBodyVisitor } = context.sourceCode.parserServices;
36
+ if (!defineTemplateBodyVisitor) return {};
37
+ const comments = context.sourceCode.ast.templateBody?.comments ?? [];
38
+ return defineTemplateBodyVisitor({
39
+ VElement(element) {
40
+ const continues = element.startTag.attributes.some(
41
+ (attribute) =>
42
+ attribute.directive &&
43
+ (attribute.key.name.name === "else" ||
44
+ attribute.key.name.name === "else-if"),
45
+ );
46
+ if (!continues) return;
47
+ const from = precedingEnd(element);
48
+ for (const comment of comments) {
49
+ if (comment.range[0] >= from && comment.range[1] <= element.range[0])
50
+ context.report({ loc: comment.loc, messageId: "misplaced" });
51
+ }
52
+ },
53
+ });
54
+ },
55
+ };
56
+
57
+ /** The `confirmFrom` call a node makes, if it does. */
58
+ function isConfirmFromCall(node) {
59
+ const { callee } = node;
60
+ return (
61
+ (callee.type === "Identifier" && callee.name === "confirmFrom") ||
62
+ (callee.type === "MemberExpression" &&
63
+ !callee.computed &&
64
+ callee.property.name === "confirmFrom")
65
+ );
66
+ }
67
+
68
+ /**
69
+ * The host's `confirmFrom(url, ...)` fills only the `{{row.X}}` tokens of the
70
+ * URL from its `params`. Any other token (`{id}`) reaches the API as it is,
71
+ * `%7Bid%7D`, and the dialog never opens.
72
+ */
73
+ const confirmFromRowTokens = {
74
+ meta: {
75
+ type: "problem",
76
+ schema: [],
77
+ messages: {
78
+ bareToken:
79
+ "`confirmFrom` fills only `{{row.X}}` tokens: write the fill-in of this URL as one, or interpolate it.",
80
+ },
81
+ },
82
+ create(context) {
83
+ const check = (node) => {
84
+ const [url] = node.arguments;
85
+ if (!isConfirmFromCall(node) || url?.type !== "TemplateLiteral") return;
86
+ const text = url.quasis.map((part) => part.value.raw).join("");
87
+ if (BARE_BRACES.test(text.replace(ROW_TOKEN, "")))
88
+ context.report({ node: url, messageId: "bareToken" });
89
+ };
90
+ const { defineTemplateBodyVisitor } = context.sourceCode.parserServices;
91
+ const script = { CallExpression: check };
92
+ return defineTemplateBodyVisitor
93
+ ? defineTemplateBodyVisitor(script, script)
94
+ : script;
95
+ },
96
+ };
97
+
98
+ export default {
99
+ rules: {
100
+ "no-comment-before-else": noCommentBeforeElse,
101
+ "confirm-from-row-tokens": confirmFromRowTokens,
102
+ },
103
+ };
@@ -2,11 +2,16 @@ import eslint from "@eslint/js";
2
2
  import ts from "typescript-eslint";
3
3
  import vue from "eslint-plugin-vue";
4
4
  import globals from "globals";
5
+ import automation from "./eslint-rules/index.mjs";
5
6
 
6
7
  export default ts.config(
7
8
  { ignores: ["dist/**", "node_modules/**"] },
8
9
  eslint.configs.recommended,
9
10
  ...vue.configs["flat/essential"],
11
+ {
12
+ files: ["tests/**/*.cjs"],
13
+ languageOptions: { globals: globals.node },
14
+ },
10
15
  {
11
16
  files: ["**/*.{ts,vue}"],
12
17
  languageOptions: {
@@ -21,4 +26,14 @@ export default ts.config(
21
26
  },
22
27
  },
23
28
  { files: ["**/*.ts"], languageOptions: { parser: ts.parser } },
29
+ {
30
+ files: ["app/**/*.{ts,vue}"],
31
+ plugins: { automation },
32
+ rules: { "automation/confirm-from-row-tokens": "error" },
33
+ },
34
+ {
35
+ files: ["app/**/*.vue"],
36
+ plugins: { automation },
37
+ rules: { "automation/no-comment-before-else": "error" },
38
+ },
24
39
  );
@@ -108,7 +108,6 @@
108
108
  "nameRequired": "Give it a name to save it.",
109
109
  "runFailed": "{name} failed",
110
110
  "runFailedAt": "{name} failed at {step}",
111
- "runCancelled": "{name} was cancelled",
112
111
  "runSucceeded": "{name} ran successfully",
113
112
  "showBlocks": "Show blocks",
114
113
  "stale": {
@@ -159,7 +158,6 @@
159
158
  "testingHint": "Its steps show here when the test ends.",
160
159
  "again": "Run again",
161
160
  "exit": "Exit debug",
162
- "cancelled": "Cancelled · {duration}",
163
161
  "failed": "Failed · {duration}",
164
162
  "failedAt": "Failed at {step} · {duration}",
165
163
  "passed": "Succeeded · {duration}",
@@ -836,7 +834,6 @@
836
834
  "rerunWithPayload": "Re-run with this payload",
837
835
  "retentionHint": "Runs are kept 30 days",
838
836
  "status": {
839
- "cancelled": "Cancelled",
840
837
  "failed": "Failed",
841
838
  "ok": "Succeeded"
842
839
  },
@@ -108,7 +108,6 @@
108
108
  "nameRequired": "Donnez-lui un nom pour l’enregistrer.",
109
109
  "runFailed": "{name} a échoué",
110
110
  "runFailedAt": "{name} a échoué à l’étape {step}",
111
- "runCancelled": "{name} a été annulée",
112
111
  "runSucceeded": "{name} s’est exécutée avec succès",
113
112
  "showBlocks": "Afficher les blocs",
114
113
  "stale": {
@@ -159,7 +158,6 @@
159
158
  "testingHint": "Ses étapes s’affichent ici à la fin du test.",
160
159
  "again": "Relancer",
161
160
  "exit": "Quitter le débogage",
162
- "cancelled": "Annulée · {duration}",
163
161
  "failed": "Échec · {duration}",
164
162
  "failedAt": "Échec à {step} · {duration}",
165
163
  "passed": "Réussie · {duration}",
@@ -836,7 +834,6 @@
836
834
  "rerunWithPayload": "Relancer avec cette charge utile",
837
835
  "retentionHint": "Les exécutions sont conservées 30 jours",
838
836
  "status": {
839
- "cancelled": "Annulée",
840
837
  "failed": "En échec",
841
838
  "ok": "Réussie"
842
839
  },
@@ -8,7 +8,8 @@
8
8
  "build": "pnpm --dir \"${DMS_FRONTEND_WORKSPACE:?Set DMS_FRONTEND_WORKSPACE to the generated Inertia workspace}\" build",
9
9
  "typecheck": "pnpm --dir \"${DMS_FRONTEND_WORKSPACE:?Set DMS_FRONTEND_WORKSPACE to the generated Inertia workspace}\" typecheck",
10
10
  "format": "prettier --write .",
11
- "lint": "eslint . --max-warnings=3",
11
+ "test": "node --test tests/*.test.cjs",
12
+ "lint": "eslint . --max-warnings=3 && node node_modules/@antelopejs/dms/frontend-vue/scripts/check-api-error-presentation.mjs app",
12
13
  "lint:fix": "eslint . --fix"
13
14
  },
14
15
  "dependencies": {
@@ -16,8 +17,8 @@
16
17
  "vue": "^3.5.18"
17
18
  },
18
19
  "devDependencies": {
19
- "@antelopejs/dms": ">=0.10.0 <1.0.0",
20
- "@antelopejs/dms-frontend": ">=0.8.0 <0.9.0",
20
+ "@antelopejs/dms": ">=0.13.1 <1.0.0",
21
+ "@antelopejs/dms-frontend": ">=0.9.2 <0.10.0",
21
22
  "@antelopejs/tooling-configs": ">=0.0.9 <1.0.0",
22
23
  "@eslint/js": "^9.0.0",
23
24
  "@nuxt/ui": "4.10.0",
@@ -28,10 +29,12 @@
28
29
  "prettier-plugin-tailwindcss": "^0.6.11",
29
30
  "typescript": "^5.8.2",
30
31
  "typescript-eslint": "^8.0.0",
32
+ "vite": "^8.3.4",
33
+ "vue-eslint-parser": "^10.3.0",
31
34
  "vue-tsc": "^3.1.1"
32
35
  },
33
36
  "engines": {
34
- "@antelopejs/dms-frontend": ">=0.8.0 <0.9.0"
37
+ "@antelopejs/dms-frontend": ">=0.9.2 <0.10.0"
35
38
  },
36
39
  "packageManager": "pnpm@10.6.5"
37
40
  }