@antelopejs/dms-automation 0.2.7 → 0.3.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 (312) hide show
  1. package/README.md +46 -2
  2. package/dist/data/procedures-table.d.ts +38 -4
  3. package/dist/data/procedures-table.js +264 -82
  4. package/dist/data/procedures-table.js.map +1 -1
  5. package/dist/data/runs-table.d.ts +19 -3
  6. package/dist/data/runs-table.js +254 -19
  7. package/dist/data/runs-table.js.map +1 -1
  8. package/dist/db/index.d.ts +1 -2
  9. package/dist/db/index.js +1 -2
  10. package/dist/db/index.js.map +1 -1
  11. package/dist/db/models/automation_template.model.d.ts +16 -1
  12. package/dist/db/models/automation_template.model.js +31 -11
  13. package/dist/db/models/automation_template.model.js.map +1 -1
  14. package/dist/db/models/index.d.ts +1 -1
  15. package/dist/db/models/index.js +1 -1
  16. package/dist/db/models/procedure.model.d.ts +1 -0
  17. package/dist/db/models/procedure.model.js +7 -0
  18. package/dist/db/models/procedure.model.js.map +1 -1
  19. package/dist/db/models/procedure_run.model.d.ts +16 -9
  20. package/dist/db/models/procedure_run.model.js +96 -17
  21. package/dist/db/models/procedure_run.model.js.map +1 -1
  22. package/dist/db/models/stats.model.d.ts +60 -61
  23. package/dist/db/models/stats.model.js +189 -236
  24. package/dist/db/models/stats.model.js.map +1 -1
  25. package/dist/db/models/type_switch.model.d.ts +25 -0
  26. package/dist/db/models/type_switch.model.js +25 -0
  27. package/dist/db/models/type_switch.model.js.map +1 -0
  28. package/dist/db/tables/index.d.ts +1 -2
  29. package/dist/db/tables/index.js +1 -2
  30. package/dist/db/tables/index.js.map +1 -1
  31. package/dist/db/tables/procedure.table.d.ts +6 -0
  32. package/dist/db/tables/procedure.table.js +24 -0
  33. package/dist/db/tables/procedure.table.js.map +1 -1
  34. package/dist/db/tables/procedure_run.table.d.ts +15 -1
  35. package/dist/db/tables/procedure_run.table.js +54 -0
  36. package/dist/db/tables/procedure_run.table.js.map +1 -1
  37. package/dist/db/tables/type_switch.table.d.ts +8 -0
  38. package/dist/db/tables/{trigger_type_config.table.js → type_switch.table.js} +16 -15
  39. package/dist/db/tables/type_switch.table.js.map +1 -0
  40. package/dist/displays/index.d.ts +14 -0
  41. package/dist/displays/index.js +23 -0
  42. package/dist/displays/index.js.map +1 -0
  43. package/dist/index.d.ts +7 -0
  44. package/dist/index.js +8 -0
  45. package/dist/index.js.map +1 -1
  46. package/dist/pages/builder.d.ts +1 -1
  47. package/dist/pages/builder.js +10 -3
  48. package/dist/pages/builder.js.map +1 -1
  49. package/dist/pages/index.d.ts +2 -1
  50. package/dist/pages/index.js +2 -1
  51. package/dist/pages/index.js.map +1 -1
  52. package/dist/pages/library.d.ts +2 -1
  53. package/dist/pages/library.js +54 -4
  54. package/dist/pages/library.js.map +1 -1
  55. package/dist/pages/overview.d.ts +6 -1
  56. package/dist/pages/overview.js +121 -2
  57. package/dist/pages/overview.js.map +1 -1
  58. package/dist/pages/procedures.js +106 -16
  59. package/dist/pages/procedures.js.map +1 -1
  60. package/dist/pages/runs.d.ts +4 -1
  61. package/dist/pages/runs.js +109 -13
  62. package/dist/pages/runs.js.map +1 -1
  63. package/dist/pages/shared.d.ts +18 -0
  64. package/dist/pages/shared.js +238 -0
  65. package/dist/pages/shared.js.map +1 -0
  66. package/dist/pages/trace.d.ts +10 -0
  67. package/dist/pages/trace.js +41 -0
  68. package/dist/pages/trace.js.map +1 -0
  69. package/dist/realtime.d.ts +3 -0
  70. package/dist/realtime.js +14 -0
  71. package/dist/realtime.js.map +1 -0
  72. package/dist/routes/action-types.d.ts +2 -14
  73. package/dist/routes/action-types.js +2 -32
  74. package/dist/routes/action-types.js.map +1 -1
  75. package/dist/routes/deleteConfirm.d.ts +3 -0
  76. package/dist/routes/deleteConfirm.js +64 -0
  77. package/dist/routes/deleteConfirm.js.map +1 -0
  78. package/dist/routes/graphSchema.d.ts +3 -90
  79. package/dist/routes/graphSchema.js +36 -9
  80. package/dist/routes/graphSchema.js.map +1 -1
  81. package/dist/routes/index.d.ts +1 -0
  82. package/dist/routes/index.js +1 -0
  83. package/dist/routes/index.js.map +1 -1
  84. package/dist/routes/library.d.ts +40 -0
  85. package/dist/routes/library.js +147 -0
  86. package/dist/routes/library.js.map +1 -0
  87. package/dist/routes/procedureChecks.d.ts +16 -0
  88. package/dist/routes/procedureChecks.js +72 -0
  89. package/dist/routes/procedureChecks.js.map +1 -0
  90. package/dist/routes/procedureRuns.d.ts +21 -0
  91. package/dist/routes/procedureRuns.js +45 -0
  92. package/dist/routes/procedureRuns.js.map +1 -0
  93. package/dist/routes/procedureSchemas.d.ts +107 -0
  94. package/dist/routes/procedureSchemas.js +61 -0
  95. package/dist/routes/procedureSchemas.js.map +1 -0
  96. package/dist/routes/procedures.d.ts +125 -7
  97. package/dist/routes/procedures.js +363 -67
  98. package/dist/routes/procedures.js.map +1 -1
  99. package/dist/routes/requests.d.ts +15 -0
  100. package/dist/routes/requests.js +35 -0
  101. package/dist/routes/requests.js.map +1 -0
  102. package/dist/routes/runs.d.ts +107 -2
  103. package/dist/routes/runs.js +340 -37
  104. package/dist/routes/runs.js.map +1 -1
  105. package/dist/routes/stats.d.ts +19 -1
  106. package/dist/routes/stats.js +160 -4
  107. package/dist/routes/stats.js.map +1 -1
  108. package/dist/routes/templates.d.ts +6 -2
  109. package/dist/routes/templates.js +106 -36
  110. package/dist/routes/templates.js.map +1 -1
  111. package/dist/routes/trigger-types.d.ts +2 -15
  112. package/dist/routes/trigger-types.js +2 -32
  113. package/dist/routes/trigger-types.js.map +1 -1
  114. package/dist/routes/typeConfigShared.d.ts +7 -11
  115. package/dist/routes/typeConfigShared.js +25 -15
  116. package/dist/routes/typeConfigShared.js.map +1 -1
  117. package/dist/runtime/armErrors.d.ts +16 -0
  118. package/dist/runtime/armErrors.js +69 -0
  119. package/dist/runtime/armErrors.js.map +1 -0
  120. package/dist/runtime/boundRunLog.d.ts +24 -0
  121. package/dist/runtime/boundRunLog.js +202 -10
  122. package/dist/runtime/boundRunLog.js.map +1 -1
  123. package/dist/runtime/builtins/actions/http.d.ts +10 -1
  124. package/dist/runtime/builtins/actions/http.js +306 -19
  125. package/dist/runtime/builtins/actions/http.js.map +1 -1
  126. package/dist/runtime/builtins/actions/log.js +2 -2
  127. package/dist/runtime/builtins/actions/log.js.map +1 -1
  128. package/dist/runtime/builtins/data/boolean.d.ts +1 -0
  129. package/dist/runtime/builtins/data/boolean.js +18 -10
  130. package/dist/runtime/builtins/data/boolean.js.map +1 -1
  131. package/dist/runtime/builtins/data/compare.js +60 -11
  132. package/dist/runtime/builtins/data/compare.js.map +1 -1
  133. package/dist/runtime/builtins/data/constant.js +9 -12
  134. package/dist/runtime/builtins/data/constant.js.map +1 -1
  135. package/dist/runtime/builtins/data/json.js +4 -4
  136. package/dist/runtime/builtins/data/json.js.map +1 -1
  137. package/dist/runtime/builtins/data/math.js +44 -24
  138. package/dist/runtime/builtins/data/math.js.map +1 -1
  139. package/dist/runtime/builtins/data/object.js +10 -10
  140. package/dist/runtime/builtins/data/object.js.map +1 -1
  141. package/dist/runtime/builtins/data/string.js +31 -20
  142. package/dist/runtime/builtins/data/string.js.map +1 -1
  143. package/dist/runtime/builtins/nodes/action.js +4 -0
  144. package/dist/runtime/builtins/nodes/action.js.map +1 -1
  145. package/dist/runtime/builtins/nodes/delay.js +1 -1
  146. package/dist/runtime/builtins/nodes/delay.js.map +1 -1
  147. package/dist/runtime/builtins/nodes/forRange.d.ts +1 -1
  148. package/dist/runtime/builtins/nodes/forRange.js +10 -4
  149. package/dist/runtime/builtins/nodes/forRange.js.map +1 -1
  150. package/dist/runtime/builtins/nodes/if.js +2 -1
  151. package/dist/runtime/builtins/nodes/if.js.map +1 -1
  152. package/dist/runtime/builtins/nodes/parallel.js +9 -2
  153. package/dist/runtime/builtins/nodes/parallel.js.map +1 -1
  154. package/dist/runtime/builtins/nodes/retry.js +1 -1
  155. package/dist/runtime/builtins/nodes/retry.js.map +1 -1
  156. package/dist/runtime/builtins/nodes/setVariable.js +1 -3
  157. package/dist/runtime/builtins/nodes/setVariable.js.map +1 -1
  158. package/dist/runtime/builtins/triggers/cron.d.ts +3 -0
  159. package/dist/runtime/builtins/triggers/cron.js +21 -7
  160. package/dist/runtime/builtins/triggers/cron.js.map +1 -1
  161. package/dist/runtime/builtins/triggers/manual.js +2 -2
  162. package/dist/runtime/builtins/triggers/manual.js.map +1 -1
  163. package/dist/runtime/builtins/triggers/webhook.d.ts +14 -1
  164. package/dist/runtime/builtins/triggers/webhook.js +116 -30
  165. package/dist/runtime/builtins/triggers/webhook.js.map +1 -1
  166. package/dist/runtime/describe.d.ts +23 -0
  167. package/dist/runtime/describe.js +114 -0
  168. package/dist/runtime/describe.js.map +1 -0
  169. package/dist/runtime/executionResult.d.ts +1 -0
  170. package/dist/runtime/executor.js +82 -5
  171. package/dist/runtime/executor.js.map +1 -1
  172. package/dist/runtime/graphIssues.d.ts +20 -0
  173. package/dist/runtime/graphIssues.js +290 -0
  174. package/dist/runtime/graphIssues.js.map +1 -0
  175. package/dist/runtime/graphVersion.d.ts +2 -0
  176. package/dist/runtime/graphVersion.js +43 -0
  177. package/dist/runtime/graphVersion.js.map +1 -0
  178. package/dist/runtime/nodeKinds.d.ts +4 -4
  179. package/dist/runtime/nodeKinds.js +1 -2
  180. package/dist/runtime/nodeKinds.js.map +1 -1
  181. package/dist/runtime/registry.d.ts +2 -1
  182. package/dist/runtime/registry.js +1 -2
  183. package/dist/runtime/registry.js.map +1 -1
  184. package/dist/runtime/resolveInputs.d.ts +3 -1
  185. package/dist/runtime/resolveInputs.js +12 -2
  186. package/dist/runtime/resolveInputs.js.map +1 -1
  187. package/dist/runtime/resolveSubgraph.d.ts +12 -1
  188. package/dist/runtime/resolveSubgraph.js +36 -0
  189. package/dist/runtime/resolveSubgraph.js.map +1 -1
  190. package/dist/runtime/retention.d.ts +6 -0
  191. package/dist/runtime/retention.js +54 -0
  192. package/dist/runtime/retention.js.map +1 -0
  193. package/dist/runtime/runProcedure.d.ts +12 -0
  194. package/dist/runtime/runProcedure.js +130 -0
  195. package/dist/runtime/runProcedure.js.map +1 -0
  196. package/dist/runtime/schedule.d.ts +2 -0
  197. package/dist/runtime/schedule.js +139 -0
  198. package/dist/runtime/schedule.js.map +1 -0
  199. package/dist/runtime/subscriptions.d.ts +11 -1
  200. package/dist/runtime/subscriptions.js +91 -125
  201. package/dist/runtime/subscriptions.js.map +1 -1
  202. package/dist/runtime/subwalk.js +2 -3
  203. package/dist/runtime/subwalk.js.map +1 -1
  204. package/dist/runtime/templateUsages.d.ts +4 -0
  205. package/dist/runtime/templateUsages.js +102 -0
  206. package/dist/runtime/templateUsages.js.map +1 -0
  207. package/dist/runtime/topo.d.ts +1 -0
  208. package/dist/runtime/topo.js +23 -0
  209. package/dist/runtime/topo.js.map +1 -1
  210. package/dist/runtime/trace.d.ts +44 -0
  211. package/dist/runtime/trace.js +240 -0
  212. package/dist/runtime/trace.js.map +1 -0
  213. package/dist/runtime/typeSwitches.d.ts +3 -0
  214. package/dist/runtime/typeSwitches.js +27 -0
  215. package/dist/runtime/typeSwitches.js.map +1 -0
  216. package/dist/runtime/validate.d.ts +11 -0
  217. package/dist/runtime/validate.js +118 -61
  218. package/dist/runtime/validate.js.map +1 -1
  219. package/dist/runtime/webhookRoutes.d.ts +4 -0
  220. package/dist/runtime/webhookRoutes.js +68 -0
  221. package/dist/runtime/webhookRoutes.js.map +1 -0
  222. package/dist/runtime/withTimeout.d.ts +1 -0
  223. package/dist/runtime/withTimeout.js +17 -0
  224. package/dist/runtime/withTimeout.js.map +1 -0
  225. package/dist/runtime/wording.d.ts +10 -0
  226. package/dist/runtime/wording.js +118 -0
  227. package/dist/runtime/wording.js.map +1 -0
  228. package/dist/stats/health-banner.d.ts +13 -0
  229. package/dist/stats/health-banner.js +149 -0
  230. package/dist/stats/health-banner.js.map +1 -0
  231. package/dist/stats/health.d.ts +49 -0
  232. package/dist/stats/health.js +130 -0
  233. package/dist/stats/health.js.map +1 -0
  234. package/dist/stats/kpi.d.ts +21 -0
  235. package/dist/stats/kpi.js +101 -0
  236. package/dist/stats/kpi.js.map +1 -0
  237. package/dist/stats/overview.d.ts +94 -0
  238. package/dist/stats/overview.js +244 -0
  239. package/dist/stats/overview.js.map +1 -0
  240. package/dist/types/constants.d.ts +0 -1
  241. package/dist/types/constants.js +1 -2
  242. package/dist/types/constants.js.map +1 -1
  243. package/dist/types/runLog.d.ts +2 -0
  244. package/dist/types/runLog.js +4 -0
  245. package/dist/types/runLog.js.map +1 -1
  246. package/frontend-vue/app/components/AttentionList.vue +276 -0
  247. package/frontend-vue/app/components/Catalog/SchemaTable.vue +127 -0
  248. package/frontend-vue/app/components/Catalog.vue +457 -0
  249. package/frontend-vue/app/components/Editor/BottomDock.vue +188 -0
  250. package/frontend-vue/app/components/Editor/BuilderPalette.vue +101 -45
  251. package/frontend-vue/app/components/Editor/GraphCanvas.vue +818 -206
  252. package/frontend-vue/app/components/Editor/GroupPortEditor.vue +29 -18
  253. package/frontend-vue/app/components/Editor/JsonField.vue +3 -3
  254. package/frontend-vue/app/components/Editor/NewProcedureDialog.vue +108 -0
  255. package/frontend-vue/app/components/Editor/NodeInspector.vue +373 -101
  256. package/frontend-vue/app/components/Editor/ProcedureSwitcher.vue +147 -0
  257. package/frontend-vue/app/components/Editor/RunNowDialog.vue +145 -0
  258. package/frontend-vue/app/components/Editor/WiredField.vue +3 -3
  259. package/frontend-vue/app/components/Editor/nodes/GenericNode.vue +97 -91
  260. package/frontend-vue/app/components/Editor/nodes/GroupNode.vue +5 -6
  261. package/frontend-vue/app/components/Editor/nodes/GroupSentinel.vue +3 -2
  262. package/frontend-vue/app/components/Editor/nodes/styles.ts +14 -18
  263. package/frontend-vue/app/components/Editor.vue +1894 -705
  264. package/frontend-vue/app/components/IconPicker.vue +122 -0
  265. package/frontend-vue/app/components/LiveTopics.vue +20 -0
  266. package/frontend-vue/app/components/Run/RunCompare.vue +115 -0
  267. package/frontend-vue/app/components/Run/RunFailure.vue +54 -0
  268. package/frontend-vue/app/components/Run/RunLogList.vue +167 -0
  269. package/frontend-vue/app/components/Run/RunPathTaken.vue +139 -0
  270. package/frontend-vue/app/components/Run/RunPayload.vue +85 -0
  271. package/frontend-vue/app/components/Run/RunWaterfall.vue +374 -0
  272. package/frontend-vue/app/components/RunPeek.vue +132 -0
  273. package/frontend-vue/app/components/RunTrace.vue +462 -0
  274. package/frontend-vue/app/components/Templates.vue +382 -537
  275. package/frontend-vue/app/components/WebhookEndpoint.vue +81 -0
  276. package/frontend-vue/app/composables/useAutomationNodeKinds.ts +23 -6
  277. package/frontend-vue/app/composables/useAutomationRuns.ts +160 -25
  278. package/frontend-vue/app/composables/useGraphConnect.ts +103 -51
  279. package/frontend-vue/app/composables/useRunActions.ts +60 -0
  280. package/frontend-vue/app/plugins/cell-displays.ts +169 -0
  281. package/frontend-vue/app/utils/automation.ts +4 -36
  282. package/frontend-vue/app/utils/describe.ts +252 -0
  283. package/frontend-vue/app/utils/redactedHeaders.ts +31 -0
  284. package/frontend-vue/dms.frontend.build.ts +7 -0
  285. package/frontend-vue/dms.frontend.ts +7 -4
  286. package/frontend-vue/i18n/locales/dms-automation-en-GB.json +1149 -309
  287. package/frontend-vue/i18n/locales/dms-automation-fr-FR.json +1154 -314
  288. package/frontend-vue/package.json +1 -1
  289. package/package.json +7 -5
  290. package/dist/db/models/type_config.model.d.ts +0 -47
  291. package/dist/db/models/type_config.model.js +0 -51
  292. package/dist/db/models/type_config.model.js.map +0 -1
  293. package/dist/db/tables/action_type_config.table.d.ts +0 -7
  294. package/dist/db/tables/action_type_config.table.js +0 -35
  295. package/dist/db/tables/action_type_config.table.js.map +0 -1
  296. package/dist/db/tables/trigger_type_config.table.d.ts +0 -7
  297. package/dist/db/tables/trigger_type_config.table.js.map +0 -1
  298. package/frontend-vue/app/components/Actions.vue +0 -151
  299. package/frontend-vue/app/components/Catalog/TypeConfigForm.vue +0 -170
  300. package/frontend-vue/app/components/Catalog/TypeList.vue +0 -203
  301. package/frontend-vue/app/components/DataNodes.vue +0 -275
  302. package/frontend-vue/app/components/Editor/ProcedureList.vue +0 -156
  303. package/frontend-vue/app/components/Editor/RunsDrawer.vue +0 -312
  304. package/frontend-vue/app/components/Library.vue +0 -69
  305. package/frontend-vue/app/components/Overview.vue +0 -503
  306. package/frontend-vue/app/components/RunDetailDrawer.vue +0 -165
  307. package/frontend-vue/app/components/RunFireTree.vue +0 -170
  308. package/frontend-vue/app/components/RunTraceDrawer.vue +0 -59
  309. package/frontend-vue/app/components/RunsStats.vue +0 -126
  310. package/frontend-vue/app/components/RunsTimelineDisplay.vue +0 -287
  311. package/frontend-vue/app/components/Triggers.vue +0 -147
  312. package/frontend-vue/app/plugins/runs-timeline-display.client.ts +0 -16
@@ -1,5 +1,7 @@
1
1
  <script setup lang="ts">
2
- import { computed } from 'vue'
2
+ import { computed, ref, watch } from 'vue'
3
+ import type { TraceStep } from '../../composables/useAutomationRuns'
4
+ import { describeDateTime, describeDuration, prettyJson } from '../../utils/describe'
3
5
  import JsonField from './JsonField.vue'
4
6
  import type { NodeKindEntry } from '../../composables/useAutomationNodeKinds'
5
7
  import type {
@@ -19,8 +21,6 @@ const props = defineProps<{
19
21
  dataEdges: DataEdge[]
20
22
  triggerType: TriggerType | null
21
23
  actionType: ActionType | null
22
- triggerTypes: TriggerType[]
23
- actionTypes: ActionType[]
24
24
  dataNodeTypes: DataNodeType[]
25
25
  // Per-NodeKind metadata served by `/api/automation/node-kinds`. The
26
26
  // inspector reads each kind's optional `configSchema` to render its
@@ -28,6 +28,23 @@ const props = defineProps<{
28
28
  nodeKinds: NodeKindEntry[]
29
29
  // Read-only graphs (template-instance view) hide the delete button.
30
30
  readOnly?: boolean
31
+ /** The node's step in the run shown over the canvas, for the "Last run" tab. */
32
+ runStep?: TraceStep | null
33
+ /** Says which run that is ("Test run · just now", "Run 8f3a2c · 14:28"). */
34
+ runLabel?: string
35
+ /** Opens the trace of that run. */
36
+ runTraceUrl?: string
37
+ /** The problem the validator found on this node (`code` translated, `message` as fallback). */
38
+ issue?: {
39
+ severity: 'error' | 'warning'
40
+ message: string
41
+ code?: string
42
+ params?: Record<string, unknown>
43
+ } | null
44
+ /** How a node is named in the builder, for the "From …" of wired fields. */
45
+ nodeName?: (id: string) => string
46
+ /** The saved graph's triggers, with the next time a schedule fires. */
47
+ savedTriggers?: Array<{ nodeId: string; cron?: string; timeZone?: string; nextAt: string | null }>
31
48
  }>()
32
49
 
33
50
  const emit = defineEmits<{
@@ -42,8 +59,109 @@ const emit = defineEmits<{
42
59
  // removes the node and its edges from the current graph — the same outcome as
43
60
  // pressing Delete/Backspace on the canvas, surfaced for discoverability.
44
61
  (e: 'delete:node', payload: { id: string }): void
62
+ (e: 'duplicate:node', payload: { id: string }): void
63
+ (e: 'wrap:retry', payload: { id: string }): void
64
+ (e: 'close'): void
45
65
  }>()
46
66
 
67
+ type InspectorTab = 'settings' | 'run' | 'docs'
68
+ const tab = ref<InspectorTab>('settings')
69
+
70
+ // A node with a run to show opens on it; otherwise on its settings.
71
+ watch(
72
+ [() => props.node?.id, () => !!props.runStep],
73
+ ([, hasRun]) => {
74
+ tab.value = hasRun && props.runStep?.status === 'failed' ? 'run' : 'settings'
75
+ },
76
+ { immediate: true },
77
+ )
78
+
79
+ const tabs = computed(() => [
80
+ { label: t('dms_automation.editor.inspector.settings'), value: 'settings' },
81
+ ...(props.runStep
82
+ ? [{ label: props.runStep.status === 'failed' ? t('dms_automation.editor.inspector.runFailed') : t('dms_automation.editor.inspector.lastRun'), value: 'run' }]
83
+ : []),
84
+ { label: t('dms_automation.editor.inspector.docs'), value: 'docs' },
85
+ ])
86
+
87
+ // A group without a step name shows the name it was created with.
88
+ const label = computed({
89
+ get: () => {
90
+ const n = props.node as (GraphNode & { label?: string }) | null
91
+ return n?.label || (n?.kind === 'group' ? String(n.config?.name ?? '') : '')
92
+ },
93
+ set: (value: string) => {
94
+ if (!props.node) return
95
+ const next = { ...props.node, label: value.trim() ? value : undefined } as GraphNode
96
+ emit('update:node', next)
97
+ },
98
+ })
99
+
100
+ const canWrapInRetry = computed(() => {
101
+ const n = props.node
102
+ return !!n && !props.readOnly && n.kind === 'action'
103
+ })
104
+
105
+ // Built-in blocks without a type (If, Retry…) are described by this module.
106
+ const typeDescription = computed(() => {
107
+ const n = props.node
108
+ if (!n) return ''
109
+ const type = n.kind === 'trigger' ? props.triggerType : n.kind === 'action' ? props.actionType : dataNodeType.value
110
+ if (type?.description) return processI18n(type.description)
111
+ const key = `dms_automation.nodes.docs.${n.kind}`
112
+ return te(key) ? t(key) : ''
113
+ })
114
+
115
+ const kindUi = computed(() => props.nodeKinds.find((k) => k.kind === props.node?.kind)?.meta.ui)
116
+
117
+ function portsSchema(ports: Array<{ name: string; type?: string }>): JsonSchema {
118
+ return { properties: Object.fromEntries(ports.map((p) => [p.name, p.type ? { type: p.type } : {}])) }
119
+ }
120
+
121
+ // What the block reads: its type's fields, else its kind's data inputs and
122
+ // settings.
123
+ const inputSchema = computed<JsonSchema | null>(() => {
124
+ const n = props.node
125
+ if (!n || n.kind === 'trigger' || n.kind === 'action' || n.kind === 'data') return schema.value
126
+ const ui = kindUi.value
127
+ if (!ui) return null
128
+ const own = portsSchema(ui.staticDataIns)
129
+ return { properties: { ...own.properties, ...(ui.configSchema?.properties ?? {}) } }
130
+ })
131
+
132
+ const outputSchema = computed(() => {
133
+ const n = props.node
134
+ if (!n) return null
135
+ if (n.kind === 'trigger') return props.triggerType?.outputSchema ?? null
136
+ if (n.kind === 'action') return props.actionType?.outputSchema ?? null
137
+ if (n.kind === 'data') return dataNodeType.value?.outputSchema ?? null
138
+ return kindUi.value ? portsSchema(kindUi.value.staticDataOuts) : null
139
+ })
140
+
141
+ // The named ways out of a flow block (then / else, body, try / catch…).
142
+ const branches = computed(() => kindUi.value?.staticTriggerOuts ?? [])
143
+
144
+ // A template instance runs the template's steps and ports, edited in the
145
+ // template itself.
146
+ const templateId = computed(() => (props.node as (GraphNode & { templateId?: string }) | null)?.templateId)
147
+
148
+ const issueText = computed(() => {
149
+ const issue = props.issue
150
+ if (!issue) return ''
151
+ const key = `dms_automation.editor.problems.codes.${issue.code}`
152
+ if (!issue.code || !te(key)) return issue.message
153
+ // A setting's problem names it as the form above does.
154
+ const field = issue.params?.field
155
+ const prop = typeof field === 'string' ? schema.value?.properties?.[field] : undefined
156
+ return t(key, prop ? { ...issue.params, label: fieldLabel(String(field), prop) } : (issue.params ?? {}))
157
+ })
158
+
159
+ function unwrap(described: unknown): unknown {
160
+ if (!described || typeof described !== 'object') return described
161
+ if ('value' in described && 'type' in described) return (described as { value: unknown }).value
162
+ return Object.fromEntries(Object.entries(described as Record<string, unknown>).map(([k, v]) => [k, unwrap(v)]))
163
+ }
164
+
47
165
  // Sentinel nodes (the group's input/output handles) are auto-managed and
48
166
  // never user-deletable, mirroring the canvas keyboard-delete guard.
49
167
  const SENTINEL_KINDS: ReadonlySet<string> = new Set(['groupInput', 'groupOutput'])
@@ -144,6 +262,8 @@ const fields = computed<
144
262
  // Type names may be `$`-prefixed DMS i18n keys shipped in the declaring
145
263
  // module's locales; plain text is shown as written.
146
264
  const { processI18n } = useTranslation()
265
+ const { t, te } = useI18n()
266
+ const { dateTimeFormat } = useRegionalFormat()
147
267
  const typeName = (type: { name: string } | null | undefined) =>
148
268
  type ? processI18n(type.name) : undefined
149
269
 
@@ -153,9 +273,53 @@ const nodeTypeLabel = computed<string>(() => {
153
273
  if (n.kind === 'trigger') return typeName(props.triggerType) ?? n.typeId ?? 'Trigger'
154
274
  if (n.kind === 'action') return typeName(props.actionType) ?? n.typeId ?? 'Action'
155
275
  if (n.kind === 'data') return typeName(dataNodeType.value) ?? n.typeId ?? 'Data'
156
- return n.kind
276
+ if (n.kind === 'group') return t('dms_automation.nodes.role.group')
277
+ return kindUi.value?.label ?? n.kind
278
+ })
279
+
280
+ // A field is named by its schema title when that is a translation key, by
281
+ // this module's name for it, by its plain title, else by its key in words
282
+ // ("maxAttempts" → "Max attempts").
283
+ function fieldLabel(name: string, prop: JsonSchemaProperty): string {
284
+ if (prop.title?.startsWith('$')) return processI18n(prop.title)
285
+ const key = `dms_automation.editor.inspector.fields.${name}`
286
+ if (te(key)) return t(key)
287
+ if (prop.title) return prop.title
288
+ const words = name
289
+ .replace(/([a-z0-9])([A-Z])/g, '$1 $2')
290
+ .replace(/[_-]+/g, ' ')
291
+ .toLowerCase()
292
+ .replace(/\b(id|url)(s?)\b/g, (_, word: string, plural: string) => word.toUpperCase() + plural)
293
+ return words.charAt(0).toUpperCase() + words.slice(1)
294
+ }
295
+
296
+ // Under a schedule: when it fires next, in the server's time zone. The
297
+ // server works it out for the saved graph only.
298
+ const nextRunText = computed(() => {
299
+ const n = props.node
300
+ const cron = n?.config?.cron
301
+ if (!n || n.kind !== 'trigger' || typeof cron !== 'string' || !cron) return ''
302
+ const saved = props.savedTriggers?.find((tr) => tr.nodeId === n.id)
303
+ if (saved?.cron !== cron) return t('dms_automation.editor.inspector.nextRunAfterSave')
304
+ if (!saved.nextAt) return ''
305
+ return t('dms_automation.editor.inspector.nextRun', {
306
+ when: describeDateTime(saved.nextAt, dateTimeFormat, saved.timeZone),
307
+ zone: saved.timeZone ?? '',
308
+ })
157
309
  })
158
310
 
311
+ function isRequired(name: string): boolean {
312
+ return schema.value?.required?.includes(name) ?? false
313
+ }
314
+
315
+ // Descriptions mark code with backticks (`*/5 * * * *`).
316
+ function descriptionParts(text: string): Array<{ text: string; code: boolean }> {
317
+ return processI18n(text)
318
+ .split('`')
319
+ .map((part, i) => ({ text: part, code: i % 2 === 1 }))
320
+ .filter((part) => part.text !== '')
321
+ }
322
+
159
323
  function findIncoming(field: string): DataEdge | undefined {
160
324
  if (!props.node) return undefined
161
325
  const id = props.node.id
@@ -191,13 +355,15 @@ function asBool(v: unknown): boolean {
191
355
  return !!v
192
356
  }
193
357
 
194
- // Returns true if `prop.type` is `"string"` OR an array of types that includes
195
- // `"string"`. Used to render a plain string input instead of a JSON textarea
196
- // for multi-type fields like compare-node ports.
358
+ // Returns true if `prop.type` is `"string"` OR an array of scalar types that
359
+ // includes `"string"`. Used to render a plain string input instead of a JSON
360
+ // textarea for multi-type fields like compare-node ports. A type that also
361
+ // takes an object or an array (an HTTP body) keeps the JSON editor, which
362
+ // still accepts plain text.
197
363
  function isStringish(prop: JsonSchemaProperty): boolean {
198
364
  const t = prop.type
199
365
  if (t === 'string') return true
200
- if (Array.isArray(t) && t.includes('string')) return true
366
+ if (Array.isArray(t)) return t.includes('string') && !t.includes('object') && !t.includes('array')
201
367
  return false
202
368
  }
203
369
 
@@ -232,21 +398,97 @@ function onUnwire(field: string) {
232
398
  </script>
233
399
 
234
400
  <template>
235
- <UCard>
236
- <template #header>
237
- <div class="flex items-center gap-2">
238
- <UIcon name="i-ph-faders" class="size-4 text-primary" />
239
- <span class="text-sm font-semibold text-highlighted">
240
- {{ $t('dms_automation.editor.inspector.title') }}
241
- </span>
242
- </div>
243
- </template>
244
-
245
- <div v-if="!node" class="p-2 text-sm text-dimmed">
401
+ <div class="flex h-full min-h-0 flex-col">
402
+ <div v-if="!node" class="p-4 text-sm text-dimmed">
246
403
  {{ $t('dms_automation.editor.inspector.empty') }}
247
404
  </div>
248
405
 
249
- <div v-else class="flex flex-col gap-3">
406
+ <template v-else>
407
+ <div class="flex flex-col gap-1 border-b border-default px-4 pt-3 pb-2">
408
+ <div class="flex items-center gap-1">
409
+ <span class="truncate font-mono text-[10.5px] text-dimmed uppercase">{{ nodeTypeLabel }}</span>
410
+ <!-- The span gives the tooltip a plain element: DMS components load
411
+ asynchronously and can't be its trigger. -->
412
+ <UTooltip :text="$t('dms_automation.editor.inspector.copyId')">
413
+ <span class="-my-1.5 ms-auto inline-flex">
414
+ <DmsCopyButton :value="node.id" />
415
+ </span>
416
+ </UTooltip>
417
+ <UButton
418
+ size="xs"
419
+ variant="ghost"
420
+ color="neutral"
421
+ icon="i-ph-x"
422
+ class="-my-1.5"
423
+ :aria-label="$t('dms_automation.editor.closeInspector')"
424
+ @click="emit('close')"
425
+ />
426
+ </div>
427
+ <UInput
428
+ v-model.lazy="label"
429
+ size="sm"
430
+ variant="ghost"
431
+ :placeholder="nodeTypeLabel"
432
+ :disabled="readOnly"
433
+ :aria-label="$t('dms_automation.editor.inspector.stepName')"
434
+ class="-mx-2 font-medium"
435
+ />
436
+ <UTabs v-model="tab" :items="tabs" variant="link" size="xs" :content="false" class="-mb-2" />
437
+ </div>
438
+ <div
439
+ v-if="issue"
440
+ class="mx-4 mt-3 flex items-start gap-2 rounded-md px-2 py-1.5 text-xs"
441
+ :class="issue.severity === 'error' ? 'bg-error/10 text-error' : 'bg-warning/10 text-warning'"
442
+ >
443
+ <UIcon name="i-ph-warning" class="mt-0.5 size-3.5 shrink-0" />
444
+ {{ issueText }}
445
+ </div>
446
+
447
+ <div v-if="tab === 'run' && runStep" class="flex min-h-0 flex-1 flex-col gap-3 overflow-y-auto p-4">
448
+ <div class="flex items-center justify-between gap-2">
449
+ <DmsStatusPill
450
+ :tone="runStep.status === 'failed' ? 'error' : 'success'"
451
+ :label="runStep.status === 'failed' ? $t('dms_automation.runs.status.failed') : $t('dms_automation.runs.status.ok')"
452
+ size="sm"
453
+ />
454
+ <span class="font-mono text-xs text-muted">{{ describeDuration(runStep.durationMs) }}</span>
455
+ </div>
456
+ <p v-if="runLabel" class="text-xs text-muted">{{ runLabel }}</p>
457
+ <div class="flex flex-col gap-1">
458
+ <span class="font-mono text-[10.5px] text-dimmed uppercase">{{ $t('dms_automation.trace.input') }}</span>
459
+ <pre class="max-h-56 overflow-auto rounded-md bg-elevated p-2 font-mono text-xs break-all whitespace-pre-wrap text-toned">{{ prettyJson(unwrap(runStep.inputs)) || '—' }}</pre>
460
+ </div>
461
+ <div class="flex flex-col gap-1">
462
+ <span class="font-mono text-[10.5px] text-dimmed uppercase">
463
+ {{ runStep.status === 'failed' ? $t('dms_automation.trace.error') : $t('dms_automation.trace.output') }}
464
+ </span>
465
+ <pre
466
+ class="max-h-56 overflow-auto rounded-md bg-elevated p-2 font-mono text-xs break-all whitespace-pre-wrap"
467
+ :class="runStep.status === 'failed' ? 'text-error' : 'text-toned'"
468
+ >{{ runStep.status === 'failed' ? runStep.error : prettyJson(unwrap(runStep.output)) || '—' }}</pre>
469
+ </div>
470
+ <UButton v-if="runTraceUrl" size="xs" variant="ghost" color="neutral" trailing-icon="i-ph-arrow-up-right" :to="runTraceUrl" class="self-start">
471
+ {{ $t('dms_automation.trace.openFull') }}
472
+ </UButton>
473
+ </div>
474
+
475
+ <div v-else-if="tab === 'docs'" class="flex min-h-0 flex-1 flex-col gap-3 overflow-y-auto p-4">
476
+ <p class="text-sm text-toned">{{ typeDescription || $t('dms_automation.editor.inspector.noDocs') }}</p>
477
+ <div class="flex flex-col gap-1">
478
+ <span class="font-mono text-[10.5px] text-dimmed uppercase">{{ $t('dms_automation.library.inputs') }}</span>
479
+ <DmsAutomationSchemaTable :schema="inputSchema" />
480
+ </div>
481
+ <div v-if="branches.length" class="flex flex-col gap-1">
482
+ <span class="font-mono text-[10.5px] text-dimmed uppercase">{{ $t('dms_automation.editor.inspector.branches') }}</span>
483
+ <p class="font-mono text-xs text-toned">{{ branches.join(' · ') }}</p>
484
+ </div>
485
+ <div class="flex flex-col gap-1">
486
+ <span class="font-mono text-[10.5px] text-dimmed uppercase">{{ $t('dms_automation.library.outputs') }}</span>
487
+ <DmsAutomationSchemaTable :schema="outputSchema" />
488
+ </div>
489
+ </div>
490
+
491
+ <div v-else class="flex min-h-0 flex-1 flex-col gap-3 overflow-y-auto p-4">
250
492
  <UButton
251
493
  v-if="canEnterGroup"
252
494
  block
@@ -257,18 +499,12 @@ function onUnwire(field: string) {
257
499
  >
258
500
  {{ $t('dms_automation.editor.inspector.enterSubgraph') }}
259
501
  </UButton>
260
- <div>
261
- <div class="text-xs text-dimmed">
262
- {{ $t('dms_automation.editor.inspector.type') }}
263
- </div>
264
- <div class="text-sm text-highlighted">{{ nodeTypeLabel }}</div>
265
- </div>
266
- <div>
267
- <div class="text-xs text-dimmed">
268
- {{ $t('dms_automation.editor.inspector.nodeId') }}
269
- </div>
270
- <div class="truncate font-mono text-xs text-toned">{{ node.id }}</div>
271
- </div>
502
+
503
+ <DmsAutomationWebhookEndpoint
504
+ v-if="node.kind === 'trigger' && node.typeId === 'webhook' && typeof node.config.path === 'string' && node.config.path"
505
+ :path="node.config.path"
506
+ :method="typeof node.config.method === 'string' ? node.config.method : undefined"
507
+ />
272
508
 
273
509
  <div
274
510
  v-if="fields.length === 0 && node.kind !== 'group'"
@@ -277,86 +513,122 @@ function onUnwire(field: string) {
277
513
  {{ $t('dms_automation.editor.inspector.noFields') }}
278
514
  </div>
279
515
 
516
+ <div v-if="templateId" class="flex flex-col gap-1.5 rounded-md border border-default p-3">
517
+ <span class="text-xs text-muted">{{ $t('dms_automation.editor.inspector.templateInstance') }}</span>
518
+ <UButton
519
+ size="xs"
520
+ variant="soft"
521
+ color="neutral"
522
+ icon="i-ph-pencil-simple"
523
+ :to="`/modules/automation/builder?template=${templateId}`"
524
+ class="self-start"
525
+ >
526
+ {{ $t('dms_automation.editor.inspector.editTemplate') }}
527
+ </UButton>
528
+ </div>
529
+
280
530
  <!-- Group port editor — declared ports drive the sentinel handles
281
- inside the subgraph (see syncSentinels in Editor.vue). -->
531
+ inside the subgraph (see syncSentinels in Editor.vue). A
532
+ template instance shows the template's ports, read-only. -->
282
533
  <DmsAutomationGroupPortEditor
283
534
  v-if="node.kind === 'group'"
284
535
  :ports="groupPorts"
536
+ :read-only="readOnly || !!templateId"
285
537
  @ports:update="onGroupPortsUpdate"
286
538
  />
287
539
 
288
- <div
540
+ <DmsFieldRow
289
541
  v-for="f in fields"
290
542
  :key="f.name"
291
- class="flex flex-col gap-1"
543
+ layout="stack"
544
+ spacing="list"
545
+ :inset="false"
546
+ :label="fieldLabel(f.name, f.prop)"
547
+ :required="isRequired(f.name)"
548
+ :label-for="findIncoming(f.name) || isBoolish(f.prop) ? undefined : `inspector-${f.name}`"
292
549
  >
293
- <label class="text-xs font-medium text-highlighted">{{ f.prop.title || f.name }}</label>
294
-
295
- <template v-if="findIncoming(f.name)">
296
- <DmsAutomationEditorWiredField
297
- :field="f.name"
298
- :source="{
299
- node: findIncoming(f.name)!.from.node,
300
- port: findIncoming(f.name)!.from.port,
301
- }"
302
- :source-label="findIncoming(f.name)!.from.node"
303
- @unwire="onUnwire(f.name)"
304
- />
305
- </template>
306
-
307
- <template v-else>
308
- <USelect
309
- v-if="Array.isArray(f.prop.enum) && f.prop.enum.length > 0"
310
- :items="(f.prop.enum as unknown[]).map((v) => String(v))"
311
- :model-value="asString(getValue(f.name) ?? f.prop.default)"
312
- @update:model-value="(v: string) => emitUpdated(f.name, v)"
313
- />
314
- <UInput
315
- v-else-if="isStringish(f.prop)"
316
- :model-value="asString(getValue(f.name))"
317
- @update:model-value="(v: string | number) => emitUpdated(f.name, String(v))"
318
- />
319
- <UInput
320
- v-else-if="isNumberish(f.prop)"
321
- type="number"
322
- :model-value="asNumber(getValue(f.name))"
323
- @update:model-value="(v: string | number) => emitUpdated(f.name, asNumber(v))"
324
- />
325
- <USwitch
326
- v-else-if="isBoolish(f.prop)"
327
- :model-value="asBool(getValue(f.name))"
328
- @update:model-value="(v: boolean) => emitUpdated(f.name, v)"
329
- />
330
- <UTextarea
331
- v-else-if="f.prop.type === 'array'"
332
- :rows="3"
333
- :placeholder="$t('dms_automation.editor.inspector.arrayPlaceholder')"
334
- :model-value="arrayToText(getValue(f.name))"
335
- @update:model-value="(v: string | number) => emitUpdated(f.name, textToArray(String(v)))"
336
- />
337
- <JsonField
338
- v-else
339
- :model-value="getValue(f.name)"
340
- @update:model-value="(v: unknown) => emitUpdated(f.name, v)"
341
- />
550
+ <template v-if="f.prop.description" #details>
551
+ <p class="mt-0.5 text-[12.5px] leading-normal text-muted">
552
+ <template v-for="(part, i) in descriptionParts(f.prop.description)" :key="i">
553
+ <code v-if="part.code" class="rounded bg-elevated px-1 font-mono text-[11.5px] text-toned">{{ part.text }}</code>
554
+ <template v-else>{{ part.text }}</template>
555
+ </template>
556
+ </p>
342
557
  </template>
343
-
344
- <p v-if="f.prop.description" class="text-xs text-dimmed">
345
- {{ f.prop.description }}
346
- </p>
558
+ <DmsAutomationWiredField
559
+ v-if="findIncoming(f.name)"
560
+ :source="{
561
+ node: findIncoming(f.name)!.from.node,
562
+ port: findIncoming(f.name)!.from.port,
563
+ }"
564
+ :source-label="nodeName ? nodeName(findIncoming(f.name)!.from.node) : findIncoming(f.name)!.from.node"
565
+ @unwire="onUnwire(f.name)"
566
+ />
567
+ <DmsSelect
568
+ v-else-if="Array.isArray(f.prop.enum) && f.prop.enum.length > 0"
569
+ :id="`inspector-${f.name}`"
570
+ :items="(f.prop.enum as unknown[]).map((v) => String(v))"
571
+ :model-value="asString(getValue(f.name) ?? f.prop.default)"
572
+ class="w-full"
573
+ @update:model-value="(v: string) => emitUpdated(f.name, v)"
574
+ />
575
+ <DmsInputText
576
+ v-else-if="isStringish(f.prop)"
577
+ :id="`inspector-${f.name}`"
578
+ :model-value="asString(getValue(f.name))"
579
+ class="w-full"
580
+ @update:model-value="(v: string | number) => emitUpdated(f.name, String(v))"
581
+ />
582
+ <DmsInputNumber
583
+ v-else-if="isNumberish(f.prop)"
584
+ :id="`inspector-${f.name}`"
585
+ :model-value="asNumber(getValue(f.name))"
586
+ class="w-full"
587
+ @update:model-value="(v: number | null | undefined) => emitUpdated(f.name, asNumber(v))"
588
+ />
589
+ <DmsSwitch
590
+ v-else-if="isBoolish(f.prop)"
591
+ :model-value="asBool(getValue(f.name) ?? f.prop.default)"
592
+ @update:model-value="(v: boolean) => emitUpdated(f.name, v)"
593
+ />
594
+ <DmsTextarea
595
+ v-else-if="f.prop.type === 'array'"
596
+ :id="`inspector-${f.name}`"
597
+ :rows="3"
598
+ :placeholder="$t('dms_automation.editor.inspector.arrayPlaceholder')"
599
+ :model-value="arrayToText(getValue(f.name))"
600
+ class="w-full"
601
+ @update:model-value="(v: string | number) => emitUpdated(f.name, textToArray(String(v)))"
602
+ />
603
+ <JsonField
604
+ v-else
605
+ :model-value="getValue(f.name)"
606
+ @update:model-value="(v: unknown) => emitUpdated(f.name, v)"
607
+ />
608
+ <p v-if="f.name === 'cron' && nextRunText" class="text-xs text-muted">{{ nextRunText }}</p>
609
+ </DmsFieldRow>
610
+
611
+ <div v-if="canWrapInRetry" class="flex flex-col gap-1.5 rounded-md border border-default p-3">
612
+ <span class="text-xs font-medium text-highlighted">{{ $t('dms_automation.editor.inspector.ifItFails') }}</span>
613
+ <span class="text-xs text-muted">{{ $t('dms_automation.editor.inspector.ifItFailsHint') }}</span>
614
+ <UButton size="xs" variant="soft" color="neutral" icon="i-ph-arrow-counter-clockwise" class="self-start" @click="emit('wrap:retry', { id: node.id })">
615
+ {{ $t('dms_automation.editor.inspector.wrapInRetry') }}
616
+ </UButton>
617
+ </div>
618
+ <p v-if="node.kind === 'action' && node.typeId === 'http.request'" class="text-xs text-dimmed">
619
+ {{ $t('dms_automation.editor.inspector.credentialsHint') }}
620
+ </p>
621
+ <div v-if="canDelete" class="mt-1 flex gap-2">
622
+ <UTooltip :text="$t('dms_automation.editor.inspector.duplicate')" :kbds="['meta', 'd']">
623
+ <UButton size="sm" color="neutral" icon="i-ph-copy" variant="outline" @click="emit('duplicate:node', { id: node.id })">
624
+ {{ $t('dms_automation.editor.inspector.duplicate') }}
625
+ </UButton>
626
+ </UTooltip>
627
+ <UButton size="sm" color="error" icon="i-ph-trash" variant="soft" @click="emitDelete">
628
+ {{ $t('dms_automation.editor.inspector.deleteNode') }}
629
+ </UButton>
347
630
  </div>
348
-
349
- <UButton
350
- v-if="canDelete"
351
- block
352
- color="error"
353
- icon="i-ph-trash"
354
- variant="outline"
355
- class="mt-1"
356
- @click="emitDelete"
357
- >
358
- {{ $t('dms_automation.editor.inspector.deleteNode') }}
359
- </UButton>
360
631
  </div>
361
- </UCard>
632
+ </template>
633
+ </div>
362
634
  </template>