@antelopejs/dms-automation 0.9.0 → 0.9.2

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 (62) hide show
  1. package/README.md +4 -4
  2. package/dist/cluster/leader.d.ts +2 -1
  3. package/dist/cluster/leader.js +78 -36
  4. package/dist/cluster/leader.js.map +1 -1
  5. package/dist/data/procedures-query.d.ts +1 -0
  6. package/dist/data/procedures-query.js +37 -0
  7. package/dist/data/procedures-query.js.map +1 -1
  8. package/dist/data/procedures-table.d.ts +1 -10
  9. package/dist/data/procedures-table.js +3 -16
  10. package/dist/data/procedures-table.js.map +1 -1
  11. package/dist/index.d.ts +0 -1
  12. package/dist/index.js +5 -3
  13. package/dist/index.js.map +1 -1
  14. package/dist/pages/procedures.js +1 -1
  15. package/dist/pages/procedures.js.map +1 -1
  16. package/dist/pages/runs.js +1 -1
  17. package/dist/pages/runs.js.map +1 -1
  18. package/dist/pages/shared.js +1 -2
  19. package/dist/pages/shared.js.map +1 -1
  20. package/dist/routes/procedureChecks.d.ts +1 -1
  21. package/dist/routes/procedureChecks.js +1 -3
  22. package/dist/routes/procedureChecks.js.map +1 -1
  23. package/dist/routes/procedureRuns.d.ts +1 -1
  24. package/dist/routes/procedureRuns.js +16 -5
  25. package/dist/routes/procedureRuns.js.map +1 -1
  26. package/dist/routes/procedures.js +6 -2
  27. package/dist/routes/procedures.js.map +1 -1
  28. package/dist/routes/runs.d.ts +1 -1
  29. package/dist/routes/runs.js +2 -2
  30. package/dist/routes/runs.js.map +1 -1
  31. package/dist/runtime/builtins/actions/log.js +3 -1
  32. package/dist/runtime/builtins/actions/log.js.map +1 -1
  33. package/dist/runtime/executor.js +3 -1
  34. package/dist/runtime/executor.js.map +1 -1
  35. package/dist/runtime/reconcile.js +9 -1
  36. package/dist/runtime/reconcile.js.map +1 -1
  37. package/dist/runtime/resolveInputs.js +8 -5
  38. package/dist/runtime/resolveInputs.js.map +1 -1
  39. package/dist/runtime/runProcedure.d.ts +2 -0
  40. package/dist/runtime/runProcedure.js +12 -0
  41. package/dist/runtime/runProcedure.js.map +1 -1
  42. package/dist/runtime/subscriptions.d.ts +1 -1
  43. package/dist/runtime/subscriptions.js +16 -18
  44. package/dist/runtime/subscriptions.js.map +1 -1
  45. package/dist/runtime/trace.js +4 -1
  46. package/dist/runtime/trace.js.map +1 -1
  47. package/dist/stats/overview.js +6 -5
  48. package/dist/stats/overview.js.map +1 -1
  49. package/frontend-vue/app/build/composables/editor/useDraftProblems.ts +14 -16
  50. package/frontend-vue/app/build/composables/editor/useRunOverlay.ts +6 -6
  51. package/frontend-vue/app/build/composables/graphCanvas/handles.ts +2 -2
  52. package/frontend-vue/app/build/composables/graphCanvas/nodeData.ts +3 -3
  53. package/frontend-vue/app/build/composables/graphCanvas/types.ts +2 -2
  54. package/frontend-vue/app/components/Catalog.vue +3 -3
  55. package/frontend-vue/app/components/Editor.vue +1 -1
  56. package/frontend-vue/app/components/Run/RunCompare.vue +3 -3
  57. package/frontend-vue/package.json +3 -3
  58. package/frontend-vue/pnpm-lock.yaml +149 -98
  59. package/frontend-vue/tests/inherited-keys.test.cjs +244 -0
  60. package/package.json +9 -9
  61. package/skills/dms-automation/SKILL.md +1 -1
  62. package/skills/dms-automation/cases.json +11 -0
@@ -0,0 +1,244 @@
1
+ const assert = require("node:assert/strict");
2
+ const path = require("node:path");
3
+ const { after, beforeEach, test } = require("node:test");
4
+ const { FRONTEND } = require("../../tests/helpers/frontend.cjs");
5
+ const { clientComposable, componentSetup } = require("./helpers/setup.cjs");
6
+ const { computed, effectScope, ref } = require("vue");
7
+ const { useApiErrorPresenter } = clientComposable(
8
+ path.join(
9
+ FRONTEND,
10
+ "node_modules/@antelopejs/dms/frontend-vue/layers/dms-core/app/composables/useApiErrorPresenter.ts",
11
+ ),
12
+ );
13
+ const {
14
+ useRunOverlay,
15
+ } = require("../app/build/composables/editor/useRunOverlay.ts");
16
+ const {
17
+ useDraftProblems,
18
+ } = require("../app/build/composables/editor/useDraftProblems.ts");
19
+ const {
20
+ useCanvasNodes,
21
+ } = require("../app/build/composables/graphCanvas/nodeData.ts");
22
+ const {
23
+ useCanvasEdges,
24
+ } = require("../app/build/composables/graphCanvas/edges.ts");
25
+
26
+ /**
27
+ * Node and type ids a plain object answers for without owning them, and
28
+ * `__proto__`, which an assignment turns into a prototype.
29
+ */
30
+ const INHERITED_NAMES = [
31
+ "constructor",
32
+ "toString",
33
+ "hasOwnProperty",
34
+ "__proto__",
35
+ ];
36
+
37
+ /**
38
+ * The names a run step keeps whole: in a step id, `__` separates a group
39
+ * from the step inside it.
40
+ */
41
+ const STEP_NAMES = INHERITED_NAMES.filter((name) => !name.includes("__"));
42
+
43
+ const noop = () => {};
44
+ const key = (/** @type {string} */ k) => k;
45
+ const read = (/** @type {unknown} */ data) => ({
46
+ data: ref(data),
47
+ error: ref(null),
48
+ pending: ref(false),
49
+ refresh: noop,
50
+ });
51
+ let scope = effectScope();
52
+
53
+ beforeEach(() => {
54
+ scope.stop();
55
+ scope = effectScope();
56
+ Object.assign(globalThis, {
57
+ useApiErrorPresenter,
58
+ useToast: () => ({ add: noop }),
59
+ useDmsState: () => ref(new WeakMap()),
60
+ getPluginI18n: () => ({ i18n: { tm: () => ({}), rt: key } }),
61
+ useApiData: () => read(null),
62
+ useI18n: () => ({ t: key, te: () => false }),
63
+ useTranslation: () => ({ processI18n: key }),
64
+ useRegionalFormat: () => ({}),
65
+ });
66
+ });
67
+ after(() => scope.stop());
68
+
69
+ /** @param {string} id */
70
+ const group = (id) => ({
71
+ id,
72
+ kind: "group",
73
+ position: { x: 0, y: 0 },
74
+ ports: [],
75
+ });
76
+
77
+ /**
78
+ * The canvas of a graph of groups `ids`, chained in order, under the run
79
+ * that went through `ran` and the validator's warning on each of `warned`.
80
+ * @param {string[]} ids
81
+ * @param {{ ran?: string[]; warned?: string[] }} draft
82
+ */
83
+ function canvasOf(ids, { ran = [], warned = [] }) {
84
+ const graph = {
85
+ nodes: ids.map(group),
86
+ triggerEdges: ids.slice(1).map((id, i) => ({
87
+ id: `e${i}`,
88
+ from: { node: ids[i] },
89
+ to: { node: id },
90
+ })),
91
+ dataEdges: [],
92
+ };
93
+ const ctx = {
94
+ selected: ref({ _id: "p1", name: "Draft", graph }),
95
+ selectedId: ref("p1"),
96
+ editorMode: ref("procedure"),
97
+ props: { apiUrl: "/api/automation" },
98
+ t: key,
99
+ te: () => false,
100
+ processI18n: key,
101
+ dockTab: ref("problems"),
102
+ dockCollapsed: ref(true),
103
+ issues: ref(
104
+ warned.map((nodeId) => ({ nodeId, severity: "warning", message: "m" })),
105
+ ),
106
+ saveBlocked: ref(false),
107
+ savedSnapshot: ref(null),
108
+ testPayload: ref("{}"),
109
+ subgraphPath: ref([]),
110
+ overlayRun: ref({
111
+ trace: {
112
+ steps: ran.map((nodeId) => ({
113
+ nodeId,
114
+ status: "ok",
115
+ durationMs: 5,
116
+ })),
117
+ skipped: [],
118
+ },
119
+ }),
120
+ overlayIsTest: ref(false),
121
+ selectedNodeId: ref(null),
122
+ currentGraph: computed(() => graph),
123
+ procedures: ref([]),
124
+ templatePorts: ref([]),
125
+ draftTriggers: ref([]),
126
+ nodeKinds: ref([]),
127
+ triggerTypes: ref([]),
128
+ actionTypes: ref([]),
129
+ dataNodeTypes: ref([]),
130
+ };
131
+ return scope.run(() => {
132
+ const { runStates } = useRunOverlay(
133
+ ctx,
134
+ {},
135
+ {},
136
+ { selectedProcedureUrl: () => null },
137
+ {},
138
+ );
139
+ const { issuesByNode } = useDraftProblems(
140
+ ctx,
141
+ { pushHistory: noop },
142
+ { groupName: key },
143
+ );
144
+ const props = {
145
+ graph,
146
+ nodeKinds: [],
147
+ triggerTypes: [],
148
+ actionTypes: [],
149
+ dataNodeTypes: [],
150
+ runStates: runStates.value,
151
+ issues: issuesByNode.value,
152
+ };
153
+ const text = {
154
+ t: key,
155
+ te: () => false,
156
+ processI18n: key,
157
+ processText: key,
158
+ };
159
+ const { vfNodes, menuName } = useCanvasNodes(props, text);
160
+ const edges = useCanvasEdges(props, menuName);
161
+ return {
162
+ /** @param {string} id */
163
+ data: (id) => vfNodes.value.find((n) => n.id === id)?.data,
164
+ edgeClass: () => edges.value[0]?.class,
165
+ };
166
+ });
167
+ }
168
+
169
+ for (const name of STEP_NAMES) {
170
+ void test(`a node with the id ${name} shows its own run state`, () => {
171
+ const canvas = canvasOf([name], { ran: [name] });
172
+ assert.deepEqual(canvas.data(name)?.run, { status: "ok", durationMs: 5 });
173
+ });
174
+ }
175
+
176
+ for (const name of INHERITED_NAMES) {
177
+ void test(`a node with the id ${name} the run skipped shows no run state`, () => {
178
+ const canvas = canvasOf([name, "next"], { ran: ["next"] });
179
+ assert.equal(canvas.data(name)?.run, null);
180
+ assert.equal(canvas.edgeClass(), "edge-trigger edge-idle");
181
+ });
182
+
183
+ void test(`a node with the id ${name} shows its own warning`, () => {
184
+ const canvas = canvasOf([name], { warned: [name] });
185
+ assert.equal(canvas.data(name)?.issue?.severity, "warning");
186
+ assert.equal(canvas.data(name)?.issue?.message, "m");
187
+ });
188
+
189
+ void test(`a node with the id ${name} the validator passed shows no problem`, () => {
190
+ const canvas = canvasOf([name, "next"], { warned: ["next"] });
191
+ assert.equal(canvas.data(name)?.issue, null);
192
+ });
193
+
194
+ void test(`a step ${name} the last success never ran compares with nothing`, () => {
195
+ const { rows } = componentSetup("Run/RunCompare.vue", {
196
+ run: {
197
+ trace: {
198
+ steps: [
199
+ {
200
+ nodeId: name,
201
+ name: { nodeId: name },
202
+ status: "ok",
203
+ durationMs: 5,
204
+ },
205
+ ],
206
+ skipped: [],
207
+ },
208
+ graph: null,
209
+ lastSuccess: { stepDurations: JSON.parse('{"other":3}') },
210
+ },
211
+ traceUrl: "/t",
212
+ });
213
+ assert.deepEqual(
214
+ rows.value.map((row) => [row.nodeId, row.before, row.now]),
215
+ [
216
+ [name, null, 5],
217
+ ["other", 3, null],
218
+ ],
219
+ );
220
+ });
221
+ }
222
+
223
+ for (const name of INHERITED_NAMES) {
224
+ void test(`a catalog entry ${name} no procedure places counts no use`, () => {
225
+ Object.assign(globalThis, {
226
+ useApiData: (/** @type {string} */ url) =>
227
+ read(url.includes("/library/usage/") ? {} : [{ id: name, name }]),
228
+ useAuthFetch: () => ({ $authFetch: noop }),
229
+ useComposedText: () => ({ processText: key }),
230
+ useConfirm: () => ({ confirm: noop }),
231
+ useDmsRoute: () => ({ query: {} }),
232
+ useDmsRouter: () => ({ replace: noop }),
233
+ describeApiError: key,
234
+ });
235
+ const catalog = scope.run(() =>
236
+ componentSetup("Catalog.vue", {
237
+ kind: "triggers",
238
+ apiUrl: "/api/automation",
239
+ builderUrl: "/b",
240
+ }),
241
+ );
242
+ assert.equal(catalog.useCount(name), 0);
243
+ });
244
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antelopejs/dms-automation",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "description": "Visual automation builder for the AntelopeJS DMS: procedures as node graphs started by schedules, webhooks, manual runs or DMS events, with a trace for every run.",
5
5
  "keywords": [
6
6
  "antelopejs",
@@ -47,19 +47,19 @@
47
47
  "@antelopejs/interface-api-util": ">=0.3.0 <1.0.0",
48
48
  "@antelopejs/interface-core": ">=0.4.0 <1.0.0",
49
49
  "@antelopejs/interface-data-api": ">=0.6.0 <1.0.0",
50
- "@antelopejs/interface-database": ">=0.3.0 <1.0.0",
51
- "@antelopejs/interface-database-decorators": ">=0.2.0 <1.0.0",
52
- "@antelopejs/interface-dms": ">=0.12.0 <1.0.0",
53
- "@antelopejs/interface-dms-automation": ">=0.6.0 <0.7.0",
50
+ "@antelopejs/interface-database": ">=0.3.1 <1.0.0",
51
+ "@antelopejs/interface-database-decorators": ">=0.2.1 <1.0.0",
52
+ "@antelopejs/interface-dms": ">=0.13.0 <1.0.0",
53
+ "@antelopejs/interface-dms-automation": ">=0.6.1 <0.7.0",
54
54
  "defu": "^6.1.4",
55
55
  "node-cron": "^4.2.1",
56
56
  "zod": "^3.25.76"
57
57
  },
58
58
  "devDependencies": {
59
- "@antelopejs/core": "1.20.0",
60
- "@antelopejs/dms": ">=0.16.0 <1.0.0",
59
+ "@antelopejs/core": "1.21.0",
60
+ "@antelopejs/dms": ">=0.19.0 <1.0.0",
61
61
  "@antelopejs/dms-frontend": ">=0.10.0 <1.0.0",
62
- "@antelopejs/tooling-configs": ">=0.2.18 <1.0.0",
62
+ "@antelopejs/tooling-configs": ">=0.3.3 <1.0.0",
63
63
  "@types/node": "^24.0.0",
64
64
  "knip": "^6.34.0",
65
65
  "mongodb-memory-server-core": "^11.0.1",
@@ -92,7 +92,7 @@
92
92
  "test:runs-display": "pnpm run build && node --test tests/runs-display.test.cjs",
93
93
  "test:type-origin": "pnpm run build && node --test tests/type-origin.test.cjs",
94
94
  "test:type-display": "node --test tests/type-display.test.cjs",
95
- "test:unit": "pnpm run build && node --test tests/health.test.cjs tests/kpi.test.cjs tests/graph-issues.test.cjs tests/trace.test.cjs tests/schedule.test.cjs tests/pages.test.cjs tests/procedures-page.test.cjs tests/wording.test.cjs tests/health-banner.test.cjs tests/runtime-nodes.test.cjs tests/runs-api.test.cjs tests/run-detail.test.cjs tests/graph-connect.test.cjs tests/library.test.cjs tests/template-delete.test.cjs tests/frontend-lint-rules.test.cjs tests/overview.test.cjs tests/declared-procedures.test.cjs tests/trigger-rearm.test.cjs tests/module-departure.test.cjs tests/run-procedure.test.cjs tests/dry-run.test.cjs tests/test-run-confirm.test.cjs tests/confirm-from.test.cjs tests/backend-boundary.test.cjs",
95
+ "test:unit": "pnpm run build && node --test tests/health.test.cjs tests/kpi.test.cjs tests/graph-issues.test.cjs tests/trace.test.cjs tests/schedule.test.cjs tests/pages.test.cjs tests/procedures-page.test.cjs tests/wording.test.cjs tests/health-banner.test.cjs tests/runtime-nodes.test.cjs tests/runs-api.test.cjs tests/run-detail.test.cjs tests/graph-connect.test.cjs tests/library.test.cjs tests/template-delete.test.cjs tests/frontend-lint-rules.test.cjs tests/overview.test.cjs tests/declared-procedures.test.cjs tests/trigger-rearm.test.cjs tests/module-departure.test.cjs tests/run-procedure.test.cjs tests/dry-run.test.cjs tests/test-run-confirm.test.cjs tests/confirm-from.test.cjs tests/backend-boundary.test.cjs tests/leader-stop.test.cjs",
96
96
  "dev": "ajs project run -w -p playground",
97
97
  "lint": "oxlint && oxfmt --check . && cd frontend-vue && pnpm lint && antelopejs-check-interface-ranges",
98
98
  "typecheck": "pnpm --filter @antelopejs/interface-dms-automation typecheck && tsc --noEmit",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: dms-automation
3
- description: Operates the installed @antelopejs/dms-automation module of the AntelopeJS DMS (procedures as node graphs started by schedules, webhooks, manual runs or DMS events, with run history and traces under /modules/automation). Use when installing or configuring dms-automation (runs.retentionDays, runs.sensitiveNames, httpRequest.blockPrivateNetwork, cluster.driver), creating, importing or shipping a procedure as code, debugging a failing run, or choosing a trigger (table watch needs a MongoDB replica set). To declare new nodes from a module, use dms-automation-interface instead.
3
+ description: Operates the installed @antelopejs/dms-automation module of the AntelopeJS DMS (procedures as node graphs started by schedules, webhooks, manual runs or DMS events, with run history and traces under /modules/automation). Use when installing or configuring dms-automation (runs.retentionDays, runs.sensitiveNames, httpRequest.blockPrivateNetwork, cluster.driver), creating, importing or shipping a procedure as code, debugging a failing run, choosing a trigger (table watch needs a MongoDB replica set), or how the built-in triggers behave in a cluster (cron firing once). A module offering a new trigger type in the procedure editor, singleton or replicated included, or a new action or data node type, uses dms-automation-interface instead.
4
4
  icon: i-lucide-workflow
5
5
  category: automation
6
6
  tags: [automation, procedures, workflows, triggers, webhooks, cron]
@@ -53,6 +53,17 @@
53
53
  "acceptable": ["dms-module", "dms"],
54
54
  "avoid": ["dms-automation"]
55
55
  }
56
+ },
57
+ {
58
+ "id": "dms-automation-avoid-interface-cluster-cron",
59
+ "area": "modules",
60
+ "style": "clean",
61
+ "prompt": "Our nightly cron procedure ran three times last night on our 3-instance DMS cluster. Why, and how do I fix it?",
62
+ "expect": {
63
+ "skills": ["dms-automation"],
64
+ "acceptable": ["dms"],
65
+ "avoid": ["dms-automation-interface"]
66
+ }
56
67
  }
57
68
  ]
58
69
  }