@uipath/maestro-builder-sdk 6.114.0 → 6.115.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.
- package/dist/check.js +12 -1
- package/dist/core/refusals.d.ts +1 -1
- package/dist/core/refusals.js +1 -1
- package/dist/merge.js +96 -1
- package/dist/serialize.js +35 -10
- package/package.json +2 -2
package/dist/check.js
CHANGED
|
@@ -139,10 +139,14 @@ const OWN_NODE_ERRORS = new WeakSet();
|
|
|
139
139
|
*/
|
|
140
140
|
function serializerRefusals(built, compile, found) {
|
|
141
141
|
const collected = [];
|
|
142
|
+
const warned = [];
|
|
142
143
|
let flow;
|
|
143
144
|
let stoppedAt;
|
|
144
145
|
try {
|
|
145
|
-
|
|
146
|
+
// A stale `.layout()` key is the one serializer warning `check` repeats: compile
|
|
147
|
+
// drops the entry, and the author can only see that here (#1994).
|
|
148
|
+
flow = serialize(built, { ...compile, collect: (r) => collected.push(r), warn: (w) => { if (w.code === 'LAYOUT_UNKNOWN_KEY')
|
|
149
|
+
warned.push(w); } });
|
|
146
150
|
// Collection stopped: the refusal that stopped it is the last one reported.
|
|
147
151
|
const stop = collected[collected.length - 1];
|
|
148
152
|
if (flow === undefined && stop)
|
|
@@ -182,6 +186,13 @@ function serializerRefusals(built, compile, found) {
|
|
|
182
186
|
...(r.nodeId !== undefined ? { nodeId: r.nodeId } : {}),
|
|
183
187
|
});
|
|
184
188
|
}
|
|
189
|
+
for (const w of warned) {
|
|
190
|
+
const key = `${w.code}\n\n${w.message}`;
|
|
191
|
+
if (seen.has(key))
|
|
192
|
+
continue;
|
|
193
|
+
seen.add(key);
|
|
194
|
+
out.push({ level: 'warning', code: w.code, message: w.message });
|
|
195
|
+
}
|
|
185
196
|
return { diagnostics: out, flow, ...(stoppedAt ? { stoppedAt } : {}) };
|
|
186
197
|
}
|
|
187
198
|
/**
|
package/dist/core/refusals.d.ts
CHANGED
|
@@ -570,7 +570,7 @@ export declare const REFUSALS: {
|
|
|
570
570
|
readonly LAYOUT_AUTO_FAILED: "lowering";
|
|
571
571
|
readonly LAYOUT_EDGE_AMBIGUOUS: "lowering";
|
|
572
572
|
readonly LAYOUT_EDGE_KEY_FORM: "lowering";
|
|
573
|
-
readonly LAYOUT_UNKNOWN_KEY: "
|
|
573
|
+
readonly LAYOUT_UNKNOWN_KEY: "lint";
|
|
574
574
|
readonly LIBRARY_NOT_FOUND: "lowering";
|
|
575
575
|
readonly LIBRARY_REQUIRED: "lowering";
|
|
576
576
|
readonly LIST_OUTPUT_WRAPPER: "lint";
|
package/dist/core/refusals.js
CHANGED
|
@@ -646,7 +646,7 @@ export const REFUSALS = {
|
|
|
646
646
|
LAYOUT_AUTO_FAILED: 'lowering',
|
|
647
647
|
LAYOUT_EDGE_AMBIGUOUS: 'lowering',
|
|
648
648
|
LAYOUT_EDGE_KEY_FORM: 'lowering',
|
|
649
|
-
LAYOUT_UNKNOWN_KEY: '
|
|
649
|
+
LAYOUT_UNKNOWN_KEY: 'lint',
|
|
650
650
|
LIBRARY_NOT_FOUND: 'lowering',
|
|
651
651
|
LIBRARY_REQUIRED: 'lowering',
|
|
652
652
|
LIST_OUTPUT_WRAPPER: 'lint',
|
package/dist/merge.js
CHANGED
|
@@ -291,6 +291,88 @@ function keepOriginalSourcesInSubflows(original, subflows, baseline) {
|
|
|
291
291
|
nodes[i] = withOriginalSource(nodes[i], origNodes.get(nodes[i].id), baseNodes.get(nodes[i].id));
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
|
+
/** The `.layout()` fields a node entry carries. */
|
|
295
|
+
const LAYOUT_FIELDS = ['position', 'size', 'collapsed'];
|
|
296
|
+
/** A node's ui as the designer reads it: its `layout.nodes` entry over `node.ui`, field by field. */
|
|
297
|
+
function drawnUi(scope, n) {
|
|
298
|
+
if (!n)
|
|
299
|
+
return undefined;
|
|
300
|
+
const entry = layoutNodesOf(scope)?.[n.id];
|
|
301
|
+
const own = isRecord(n.ui) ? n.ui : undefined;
|
|
302
|
+
return entry || own ? { ...own, ...entry } : undefined;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Apply each `.layout()` field the author changed onto `into`'s node of the same id:
|
|
306
|
+
* a field whose edited value differs from the baseline's (the no-edit round trip) is
|
|
307
|
+
* the author's, and is written where `into` already keeps that node's field (its
|
|
308
|
+
* `layout.nodes` entry, else `node.ui`). A node compile left unplaced in the edit
|
|
309
|
+
* (`isUnplaced`) has no author layout, and a node the baseline lacks is added, so
|
|
310
|
+
* placement owns both. A scope whose source has no `.layout()` at all is all
|
|
311
|
+
* unplaced: merge's compiles keep the placeholder row there and flag every node
|
|
312
|
+
* (`SerializeOpts.autoLayout: false`), so compile's own layout of the edit is
|
|
313
|
+
* never read as an author move.
|
|
314
|
+
*
|
|
315
|
+
* Example: the decompiled source has `review: at(640, 144)`, the author writes
|
|
316
|
+
* `review: at(640, 304)`; the merged file's `layout.nodes.review.position` is
|
|
317
|
+
* `{ x: 640, y: 304 }`, and every other node keeps the original's.
|
|
318
|
+
*/
|
|
319
|
+
function applyLayoutEdits(into, edited, baseline, isUnplaced, originalEdges = []) {
|
|
320
|
+
const editedNodes = byId(edited?.nodes);
|
|
321
|
+
const baseNodes = byId(baseline?.nodes);
|
|
322
|
+
const moved = new Set();
|
|
323
|
+
const store = layoutNodesOf(into);
|
|
324
|
+
for (const n of into.nodes ?? []) {
|
|
325
|
+
const e = drawnUi(edited, editedNodes.get(n.id));
|
|
326
|
+
const b = drawnUi(baseline, baseNodes.get(n.id));
|
|
327
|
+
if (!e || !b || isUnplaced(e))
|
|
328
|
+
continue;
|
|
329
|
+
for (const field of LAYOUT_FIELDS) {
|
|
330
|
+
if (e[field] === undefined || sortedJson(e[field]) === sortedJson(b[field]))
|
|
331
|
+
continue;
|
|
332
|
+
const value = jsonClone(e[field]);
|
|
333
|
+
const entry = store?.[n.id];
|
|
334
|
+
if (isRecord(entry) && (field in entry || !(isRecord(n.ui) && field in n.ui)))
|
|
335
|
+
entry[field] = value;
|
|
336
|
+
else if (isRecord(n.ui))
|
|
337
|
+
n.ui[field] = value;
|
|
338
|
+
else if (store && Object.keys(store).length > 0)
|
|
339
|
+
store[n.id] = { ...(isRecord(entry) ? entry : {}), [field]: value };
|
|
340
|
+
else
|
|
341
|
+
n.ui = { [field]: value };
|
|
342
|
+
if (field === 'position')
|
|
343
|
+
moved.add(n.id);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
dropStaleRoutes(into, moved, originalEdges);
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Drop the stored route of every edge into or out of a node the author moved: its
|
|
350
|
+
* bends were drawn for the old position, and with no route the designer draws the
|
|
351
|
+
* edge afresh (as it does after a drag). Studio Web keeps routes in `layout.edges`,
|
|
352
|
+
* keyed by edge id; an SDK file may also carry them on the edge's `ui`.
|
|
353
|
+
*
|
|
354
|
+
* Example: `mark` moves from y 144 to 464; the original's route for `big -> mark`,
|
|
355
|
+
* bending at y 144, is dropped instead of drawing a dog-leg back to the old row.
|
|
356
|
+
*/
|
|
357
|
+
function dropStaleRoutes(scope, moved, originalEdges) {
|
|
358
|
+
if (moved.size === 0)
|
|
359
|
+
return;
|
|
360
|
+
const routes = scope.layout?.edges;
|
|
361
|
+
// The original's edge ids too: the route map is the original's, keyed by its ids.
|
|
362
|
+
for (const e of [...(scope.edges ?? []), ...originalEdges]) {
|
|
363
|
+
if (!moved.has(e.sourceNodeId) && !moved.has(e.targetNodeId))
|
|
364
|
+
continue;
|
|
365
|
+
if (isRecord(routes) && e.id !== undefined)
|
|
366
|
+
delete routes[e.id];
|
|
367
|
+
const ui = e.ui;
|
|
368
|
+
if (isRecord(ui)) {
|
|
369
|
+
delete ui.waypoints;
|
|
370
|
+
delete ui.routedWaypoints;
|
|
371
|
+
if (Object.keys(ui).length === 0)
|
|
372
|
+
delete e.ui;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
294
376
|
/** The original's `layout.nodes` map, when it has one. */
|
|
295
377
|
function layoutNodesOf(f) {
|
|
296
378
|
const nodes = f.layout?.nodes;
|
|
@@ -478,7 +560,20 @@ function mergeFlowFindings(original, edited, options) {
|
|
|
478
560
|
// positions — see node-placement.ts. Root scope only: a
|
|
479
561
|
// subflow is taken from `edited` whole, layout included. ──
|
|
480
562
|
const editedNodes = [...(edited.nodes ?? []), ...Object.values(edited.subflows ?? {}).flatMap((sf) => sf?.nodes ?? [])];
|
|
481
|
-
|
|
563
|
+
const isUnplaced = unplacedRule(editedNodes);
|
|
564
|
+
// ── Layout edits: a `.layout()` entry the author changed (edited differs from
|
|
565
|
+
// the baseline) is an edit like any other, so it lands on the original's node,
|
|
566
|
+
// root and every subflow, before added nodes are placed around it (#1994). ──
|
|
567
|
+
if (options.baseline) {
|
|
568
|
+
const scopes = [
|
|
569
|
+
[{ nodes: finalNodes, edges: result.edges, layout: result.layout }, edited, options.baseline, original.edges ?? []],
|
|
570
|
+
...Object.entries(result.subflows).map(([k, sf]) => [sf, edited.subflows?.[k],
|
|
571
|
+
options.baseline.subflows?.[k], original.subflows?.[k]?.edges ?? []]),
|
|
572
|
+
];
|
|
573
|
+
for (const [into, from, base, origEdges] of scopes)
|
|
574
|
+
applyLayoutEdits(into, from, base, isUnplaced, origEdges);
|
|
575
|
+
}
|
|
576
|
+
placeAddedNodes(finalNodes, result.edges, positionStoreOf(original) && layoutNodesOf(result), (id) => !origNodes.has(id), isUnplaced);
|
|
482
577
|
// An added root node is where merge put it now, not where compile did: drop its
|
|
483
578
|
// mark. A subflow taken whole keeps compile's layout and its marks, so a later
|
|
484
579
|
// decompile still leaves it to compile; an original node keeps the original's ui.
|
package/dist/serialize.js
CHANGED
|
@@ -330,23 +330,42 @@ function emitStickyNotes(built, scope, claimNoteId) {
|
|
|
330
330
|
* Apply an author `.layout()` to a finished scope (design §2.3): node entries
|
|
331
331
|
* mutate the emitted nodes' `ui` in place; edge entries resolve their
|
|
332
332
|
* `"from->to"` keys to real edge ids and are returned for the caller to attach
|
|
333
|
-
* as the persisted `layout.edges` section.
|
|
334
|
-
*
|
|
333
|
+
* as the persisted `layout.edges` section. A key that names no step, or an edge
|
|
334
|
+
* key that matches no edge, is dropped with a `LAYOUT_UNKNOWN_KEY` warning
|
|
335
|
+
* (#1994): it is a leftover of a removed or renamed step, and refusing the flow
|
|
336
|
+
* over it blocked every merge of such an edit. Example: `.layout({ nodes: { gone:
|
|
337
|
+
* at(640, 144) } })` after `gone` was deleted warns
|
|
338
|
+
* `flow "x".layout: "gone" names no step or node in this flow …` and compiles.
|
|
335
339
|
*/
|
|
336
|
-
function applyAuthorLayout(layout, scope, where, author) {
|
|
340
|
+
function applyAuthorLayout(layout, scope, where, author, warn) {
|
|
337
341
|
if (!layout)
|
|
338
342
|
return undefined;
|
|
343
|
+
// A key that names nothing is a leftover (the step was removed or renamed since
|
|
344
|
+
// the layout was written): it places nothing, so it is dropped with a warning
|
|
345
|
+
// rather than refusing the whole flow (#1994).
|
|
346
|
+
// A typo looks the same as a leftover, so the warning names the closest key that
|
|
347
|
+
// `.layout()` does not already place: `reveiw` -> "did you mean "review"?".
|
|
348
|
+
const named = new Set(Object.keys(layout.nodes ?? {}));
|
|
349
|
+
const keys = [...new Set([...scope.stepNodeId.keys(), ...(scope.noteNodeId?.keys() ?? []), ...scope.nodes.map((n) => String(n.id))])];
|
|
350
|
+
const stale = (message, key) => {
|
|
351
|
+
const near = key === undefined ? undefined : nearestName(key, keys.filter((k) => !named.has(k)));
|
|
352
|
+
const fix = near !== undefined
|
|
353
|
+
? `Did you mean "${near}"? Rename the entry to the step it places, or remove it if that step was deleted.`
|
|
354
|
+
: 'Rename the entry to the step it places, or remove it if that step was deleted.';
|
|
355
|
+
warn?.({ code: 'LAYOUT_UNKNOWN_KEY', message: `${where}.layout: ${message} Compile ignores the entry. ${fix}` });
|
|
356
|
+
return undefined;
|
|
357
|
+
};
|
|
339
358
|
const resolveId = (key) => {
|
|
340
359
|
const id = scope.stepNodeId.get(key)
|
|
341
360
|
?? scope.noteNodeId?.get(key)
|
|
342
361
|
?? (scope.nodes.some((n) => n.id === key) ? key : undefined);
|
|
343
|
-
|
|
344
|
-
throw new CompileRefusal('LAYOUT_UNKNOWN_KEY', `${where}.layout: "${key}" names no step or node in this flow. Layout keys are the flow's own step names (plus the trigger id and "end").`);
|
|
345
|
-
}
|
|
346
|
-
return id;
|
|
362
|
+
return id ?? stale(`"${key}" names no step or node in this flow (layout keys are the flow's own step names, plus the trigger id and "end").`, key);
|
|
347
363
|
};
|
|
348
364
|
for (const [key, nl] of Object.entries(layout.nodes ?? {})) {
|
|
349
|
-
const
|
|
365
|
+
const id = resolveId(key);
|
|
366
|
+
if (id === undefined)
|
|
367
|
+
continue;
|
|
368
|
+
const node = scope.nodes.find((n) => n.id === id);
|
|
350
369
|
node.ui = node.ui ?? {};
|
|
351
370
|
node.ui.position = { x: nl.position.x, y: nl.position.y };
|
|
352
371
|
author.placed.add(node.id);
|
|
@@ -365,7 +384,13 @@ function applyAuthorLayout(layout, scope, where, author) {
|
|
|
365
384
|
if (!m)
|
|
366
385
|
throw new CompileRefusal('LAYOUT_EDGE_KEY_FORM', `${where}.layout: edge key "${key}" must be "<fromStep>-><toStep>".`);
|
|
367
386
|
const [src, tgt] = [resolveId(m[1].trim()), resolveId(m[2].trim())];
|
|
387
|
+
if (src === undefined || tgt === undefined)
|
|
388
|
+
continue;
|
|
368
389
|
const matches = scope.edges.filter((e) => e.sourceNodeId === src && e.targetNodeId === tgt);
|
|
390
|
+
if (matches.length === 0) {
|
|
391
|
+
stale(`edge "${key}" matches no emitted edge.`);
|
|
392
|
+
continue;
|
|
393
|
+
}
|
|
369
394
|
if (matches.length !== 1) {
|
|
370
395
|
throw new CompileRefusal('LAYOUT_EDGE_AMBIGUOUS', `${where}.layout: edge "${key}" matches ${matches.length} emitted edges; expected exactly 1.`);
|
|
371
396
|
}
|
|
@@ -2017,7 +2042,7 @@ function serializeFlow(built, opts) {
|
|
|
2017
2042
|
assertHitlExitInvariant(scope.nodes, scope.edges, legacyCompletedNodes);
|
|
2018
2043
|
typeAgentInputSchemas(scope, globals);
|
|
2019
2044
|
emitStickyNotes(child, scope, claimNoteId);
|
|
2020
|
-
const layoutEdges = applyAuthorLayout(child.layout, scope, `subflow "${nodeId}"`, authorGeometry);
|
|
2045
|
+
const layoutEdges = applyAuthorLayout(child.layout, scope, `subflow "${nodeId}"`, authorGeometry, opts.warn);
|
|
2021
2046
|
assertNodeEnvelope(scope.nodes, `subflow "${nodeId}"`);
|
|
2022
2047
|
return {
|
|
2023
2048
|
nodes: scope.nodes,
|
|
@@ -3667,7 +3692,7 @@ function serializeFlow(built, opts) {
|
|
|
3667
3692
|
assertHitlExitInvariant(root.nodes, root.edges, legacyCompletedNodes);
|
|
3668
3693
|
typeAgentInputSchemas(root, globals);
|
|
3669
3694
|
emitStickyNotes(built, root, claimNoteId);
|
|
3670
|
-
const rootLayoutEdges = applyAuthorLayout(built.layout, root, `flow "${built.id}"`, authorGeometry);
|
|
3695
|
+
const rootLayoutEdges = applyAuthorLayout(built.layout, root, `flow "${built.id}"`, authorGeometry, opts.warn);
|
|
3671
3696
|
assertNodeEnvelope(root.nodes, `flow "${built.id}"`);
|
|
3672
3697
|
// The FILE-FORMAT version this document declares: the author's
|
|
3673
3698
|
// `.schemaVersion()` when they set one, else the profile's write floor. It is
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/maestro-builder-sdk",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.115.0",
|
|
4
4
|
"description": "Build UiPath Flow, Case, and BPMN artifacts by writing TypeScript.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://docs.uipath.com/maestro",
|
|
@@ -124,5 +124,5 @@
|
|
|
124
124
|
"@types/node": "^22.7.0",
|
|
125
125
|
"esbuild": "^0.28.1"
|
|
126
126
|
},
|
|
127
|
-
"gitref": "
|
|
127
|
+
"gitref": "9178cf04304e2d61325944652c1d11cea6868668"
|
|
128
128
|
}
|