@antelopejs/dms-automation 0.9.1 → 0.9.3
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.
- package/README.md +2 -2
- package/dist/cluster/leader.d.ts +2 -1
- package/dist/cluster/leader.js +78 -36
- package/dist/cluster/leader.js.map +1 -1
- package/dist/db/models/stats.model.js +24 -1
- package/dist/db/models/stats.model.js.map +1 -1
- package/dist/db/models/type_switch.model.js +6 -3
- package/dist/db/models/type_switch.model.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +8 -4
- package/dist/index.js.map +1 -1
- package/dist/pages/procedures.js +1 -1
- package/dist/pages/procedures.js.map +1 -1
- package/dist/pages/runs.js +1 -1
- package/dist/pages/runs.js.map +1 -1
- package/dist/pages/shared.js +1 -2
- package/dist/pages/shared.js.map +1 -1
- package/dist/routes/procedureChecks.d.ts +1 -1
- package/dist/routes/procedureChecks.js +1 -3
- package/dist/routes/procedureChecks.js.map +1 -1
- package/dist/routes/procedureRuns.d.ts +1 -1
- package/dist/routes/procedureRuns.js +16 -5
- package/dist/routes/procedureRuns.js.map +1 -1
- package/dist/routes/procedures.js +6 -2
- package/dist/routes/procedures.js.map +1 -1
- package/dist/routes/runs.d.ts +18 -21
- package/dist/routes/runs.js +5 -4
- package/dist/routes/runs.js.map +1 -1
- package/dist/runtime/builtins/actions/log.js +3 -1
- package/dist/runtime/builtins/actions/log.js.map +1 -1
- package/dist/runtime/builtins/nodes/foreach.js +2 -1
- package/dist/runtime/builtins/nodes/foreach.js.map +1 -1
- package/dist/runtime/executor.js +3 -1
- package/dist/runtime/executor.js.map +1 -1
- package/dist/runtime/reconcile.js +9 -1
- package/dist/runtime/reconcile.js.map +1 -1
- package/dist/runtime/resolveInputs.js +8 -5
- package/dist/runtime/resolveInputs.js.map +1 -1
- package/dist/runtime/runProcedure.d.ts +2 -0
- package/dist/runtime/runProcedure.js +12 -0
- package/dist/runtime/runProcedure.js.map +1 -1
- package/dist/runtime/subscriptions.d.ts +2 -1
- package/dist/runtime/subscriptions.js +19 -18
- package/dist/runtime/subscriptions.js.map +1 -1
- package/dist/runtime/trace.js +4 -1
- package/dist/runtime/trace.js.map +1 -1
- package/dist/stats/overview.js +6 -5
- package/dist/stats/overview.js.map +1 -1
- package/frontend-vue/app/build/composables/editor/useDraftProblems.ts +14 -16
- package/frontend-vue/app/build/composables/editor/useRunOverlay.ts +6 -6
- package/frontend-vue/app/build/composables/graphCanvas/handles.ts +2 -2
- package/frontend-vue/app/build/composables/graphCanvas/nodeData.ts +3 -3
- package/frontend-vue/app/build/composables/graphCanvas/types.ts +2 -2
- package/frontend-vue/app/components/Catalog.vue +3 -3
- package/frontend-vue/app/components/Editor.vue +1 -1
- package/frontend-vue/app/components/Run/RunCompare.vue +3 -3
- package/frontend-vue/package.json +1 -1
- package/frontend-vue/pnpm-lock.yaml +114 -94
- package/frontend-vue/tests/inherited-keys.test.cjs +244 -0
- package/package.json +4 -4
|
@@ -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.
|
|
3
|
+
"version": "0.9.3",
|
|
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",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@antelopejs/interface-data-api": ">=0.6.0 <1.0.0",
|
|
50
50
|
"@antelopejs/interface-database": ">=0.3.1 <1.0.0",
|
|
51
51
|
"@antelopejs/interface-database-decorators": ">=0.2.1 <1.0.0",
|
|
52
|
-
"@antelopejs/interface-dms": ">=0.
|
|
52
|
+
"@antelopejs/interface-dms": ">=0.13.0 <1.0.0",
|
|
53
53
|
"@antelopejs/interface-dms-automation": ">=0.6.1 <0.7.0",
|
|
54
54
|
"defu": "^6.1.4",
|
|
55
55
|
"node-cron": "^4.2.1",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@antelopejs/core": "1.21.0",
|
|
60
|
-
"@antelopejs/dms": ">=0.
|
|
60
|
+
"@antelopejs/dms": ">=0.19.0 <1.0.0",
|
|
61
61
|
"@antelopejs/dms-frontend": ">=0.10.0 <1.0.0",
|
|
62
62
|
"@antelopejs/tooling-configs": ">=0.3.3 <1.0.0",
|
|
63
63
|
"@types/node": "^24.0.0",
|
|
@@ -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",
|