@uipath/maestro-builder-sdk 6.113.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/auto-layout.js +7 -3
- package/dist/check.js +12 -1
- package/dist/core/refusals.d.ts +1 -1
- package/dist/core/refusals.js +1 -1
- package/dist/decompile.js +4 -2
- package/dist/merge.js +98 -2
- package/dist/node-placement.d.ts +37 -7
- package/dist/node-placement.js +48 -12
- package/dist/serialize.js +35 -10
- package/package.json +2 -2
package/dist/auto-layout.js
CHANGED
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
* one row, x = 256, 544, 832, … and all 96 × 96.
|
|
38
38
|
*/
|
|
39
39
|
import { STICKY_NOTE_TYPE } from './core/definitionless-node-types.js';
|
|
40
|
-
import { markCompilePlaced } from './node-placement.js';
|
|
40
|
+
import { PLACEHOLDER_FLAG, markCompilePlaced } from './node-placement.js';
|
|
41
41
|
import { CompileRefusal } from './core/compile-refusal.js';
|
|
42
42
|
import { DEFAULT_NODE_SIZE, defaultContainerFit, layoutRoot, snapToGrid, tidyContainer, } from './core/elk-layout.js';
|
|
43
43
|
/** Where the canvas puts a new flow's trigger (flow-core `DEFAULT_TRIGGER_POSITION`). */
|
|
@@ -140,9 +140,13 @@ export function applyCompiledGeometry(flow, author) {
|
|
|
140
140
|
const authored = scope.nodes.some((n) => n.type !== STICKY_NOTE_TYPE && author.placed.has(n.id));
|
|
141
141
|
if (authored) {
|
|
142
142
|
for (const n of scope.nodes) {
|
|
143
|
-
if (n.type === STICKY_NOTE_TYPE
|
|
143
|
+
if (n.type === STICKY_NOTE_TYPE)
|
|
144
144
|
continue;
|
|
145
|
-
|
|
145
|
+
if (!author.sized.has(n.id))
|
|
146
|
+
n.ui = { ...n.ui, size: sizeForShape(shapeOf(n)) };
|
|
147
|
+
// Left on the placeholder row: merge places it if the edit added it (#1993).
|
|
148
|
+
// `false` says the author placed it, and that this file marks every node.
|
|
149
|
+
n.ui = author.placed.has(n.id) ? { ...n.ui, [PLACEHOLDER_FLAG]: false } : markCompilePlaced(n.ui ?? {}, true);
|
|
146
150
|
}
|
|
147
151
|
}
|
|
148
152
|
else {
|
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/decompile.js
CHANGED
|
@@ -48,7 +48,7 @@ import { contributionPort, forwardFanOut } from './core/definition-handles.js';
|
|
|
48
48
|
import { STICKY_NOTE_TYPE } from './core/definitionless-node-types.js';
|
|
49
49
|
import { bindingValueRows, referencedBindingNames } from './core/contribution-bindings.js';
|
|
50
50
|
import { builtChainSource, chainStatements } from './core/builder-chain.js';
|
|
51
|
-
import { isMarkedPlaceholder } from './node-placement.js';
|
|
51
|
+
import { isMarkedPlaceholder, isPlaceholderRowMark } from './node-placement.js';
|
|
52
52
|
/**
|
|
53
53
|
* The trigger id of the flow currently being decompiled, so a reference through a
|
|
54
54
|
* RENAMED trigger is still recognized as `input('x')` rather than falling back to
|
|
@@ -2820,7 +2820,9 @@ function layoutSeg(flow, nodes, edges) {
|
|
|
2820
2820
|
if (renamed(n.id) || unspelled(n.id))
|
|
2821
2821
|
continue;
|
|
2822
2822
|
const ui = uiOf(n);
|
|
2823
|
-
|
|
2823
|
+
// A placeholder-row node comes back on the same row whatever the rest of the
|
|
2824
|
+
// scope is (#1993): leave it out.
|
|
2825
|
+
if ((compilePlacedScope && isMarkedPlaceholder(ui)) || isPlaceholderRowMark(ui))
|
|
2824
2826
|
continue;
|
|
2825
2827
|
const pos = ui.position;
|
|
2826
2828
|
if (!pos || typeof pos.x !== 'number' || typeof pos.y !== 'number')
|
package/dist/merge.js
CHANGED
|
@@ -93,7 +93,7 @@ import { jsonClone } from './core/json-clone.js';
|
|
|
93
93
|
import { isRecord } from './core/node-envelope.js';
|
|
94
94
|
import { DEFINITIONLESS_NODE_TYPES } from './core/definitionless-node-types.js';
|
|
95
95
|
import { MergeRefusedError, mergedFileFindings, roundTripFindings } from './merge-roundtrip.js';
|
|
96
|
-
import { placeAddedNodes, stripPlaceholderFlag } from './node-placement.js';
|
|
96
|
+
import { placeAddedNodes, stripPlaceholderFlag, unplacedRule } from './node-placement.js';
|
|
97
97
|
import { mergeAgentSidecars } from './merge-sidecars.js';
|
|
98
98
|
import { embeddedAgentFindings, isEmbeddedAgent, mergeEmbeddedAgentNode } from './merge-embedded-agent.js';
|
|
99
99
|
import { mergeObject, mergeVariables, stableJson } from './merge-variables.js';
|
|
@@ -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;
|
|
@@ -477,7 +559,21 @@ function mergeFlowFindings(original, edited, options) {
|
|
|
477
559
|
// room, and store every added node's position where the original stores
|
|
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 ?? [])];
|
|
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);
|
|
481
577
|
// An added root node is where merge put it now, not where compile did: drop its
|
|
482
578
|
// mark. A subflow taken whole keeps compile's layout and its marks, so a later
|
|
483
579
|
// decompile still leaves it to compile; an original node keeps the original's ui.
|
package/dist/node-placement.d.ts
CHANGED
|
@@ -6,7 +6,11 @@
|
|
|
6
6
|
* with positions), compile gives each node it leaves out a placeholder from its
|
|
7
7
|
* emission index, `x = 256 + 288 × index, y = 144` (`+160` inside a container).
|
|
8
8
|
* A scope with no `.layout()` node entries is laid out whole instead
|
|
9
|
-
* (`auto-layout.ts`).
|
|
9
|
+
* (`auto-layout.ts`). Compile marks each node it placed with its position in
|
|
10
|
+
* `ui.placeholder` ({@link PLACEHOLDER_FLAG}, #1993), and a node `.layout()` placed
|
|
11
|
+
* with `false`, so an author `at()` that lands on the same grid point is told apart;
|
|
12
|
+
* a file from an older SDK has no `placeholder` key and is read by its coordinates.
|
|
13
|
+
* Merge replaces the placeholder on each node the edit added:
|
|
10
14
|
*
|
|
11
15
|
* - right of its rightmost positioned predecessor in the same container, past
|
|
12
16
|
* its width, on that predecessor's row; when the node leads into another
|
|
@@ -64,14 +68,15 @@ export interface Point {
|
|
|
64
68
|
*/
|
|
65
69
|
export declare function placeholderPosition(index: number, nested: boolean): Point;
|
|
66
70
|
/**
|
|
67
|
-
* Whether `p` is
|
|
68
|
-
*
|
|
69
|
-
*
|
|
71
|
+
* Whether `p` is on compile's placeholder grid. Merge reads it only for an edited
|
|
72
|
+
* flow with no {@link PLACEHOLDER_FLAG} (an SDK older than the flag), where an author
|
|
73
|
+
* `.layout()` entry on the same grid point reads as a placeholder.
|
|
70
74
|
*/
|
|
71
75
|
export declare function isPlaceholderPosition(p: Point | undefined): boolean;
|
|
72
76
|
/**
|
|
73
77
|
* The `ui` key compile writes on a node whose position it chose itself: every node of a
|
|
74
|
-
* flow or subflow it laid out (no `.layout()` node entries, `auto-layout.ts`)
|
|
78
|
+
* flow or subflow it laid out (no `.layout()` node entries, `auto-layout.ts`), and each
|
|
79
|
+
* node a scope's `.layout()` leaves on the placeholder row (#1993). Its value
|
|
75
80
|
* is the position compile chose, so the mark holds only while the node is still there:
|
|
76
81
|
* Studio Web keeps unknown `ui` keys on save (flow-schema `extractLayout` persists "the
|
|
77
82
|
* full ui object (including unknown keys like zoom)"), and a drag changes `position` but
|
|
@@ -87,11 +92,36 @@ export declare const PLACEHOLDER_FLAG = "placeholder";
|
|
|
87
92
|
/** `ui` with {@link PLACEHOLDER_FLAG} set to its current position. */
|
|
88
93
|
export declare function markCompilePlaced<T extends {
|
|
89
94
|
position?: Point;
|
|
90
|
-
}>(ui: T): T;
|
|
95
|
+
}>(ui: T, onRow?: boolean): T;
|
|
96
|
+
/**
|
|
97
|
+
* Whether a holding mark is a placeholder-row mark (`row: true`): a node a scope's
|
|
98
|
+
* `.layout()` left out. Compile puts such a node back on the same row from the same
|
|
99
|
+
* source, so decompile can leave it out even when the scope's other nodes are the
|
|
100
|
+
* author's; a laid-out node it can leave out only while the whole scope is compile's.
|
|
101
|
+
*/
|
|
102
|
+
export declare function isPlaceholderRowMark(ui: unknown): boolean;
|
|
91
103
|
/** Whether a node's `ui` (layout entry over `node.ui`) still sits where compile put it. */
|
|
92
104
|
export declare function isMarkedPlaceholder(ui: unknown): boolean;
|
|
93
105
|
/** Remove {@link PLACEHOLDER_FLAG} from a node's `ui`, or a `layout.nodes` entry, in place. */
|
|
94
106
|
export declare function stripPlaceholderFlag(ui: unknown): void;
|
|
107
|
+
/**
|
|
108
|
+
* Which added nodes merge places: those whose {@link PLACEHOLDER_FLAG} mark holds.
|
|
109
|
+
* Compile writes the key on every node it emits, `false` on a node `.layout()` placed,
|
|
110
|
+
* so an edited flow with the key anywhere marks every node compile placed, whether
|
|
111
|
+
* merge compiled it or the author passes the `.flow` `flow compile` wrote. An edited
|
|
112
|
+
* flow with the key nowhere came from an SDK older than the mark: then a node is
|
|
113
|
+
* unplaced when it sits on the placeholder grid ({@link isPlaceholderPosition}).
|
|
114
|
+
*
|
|
115
|
+
* Example: `flow compile` of a decompiled source plus `audit: at(544, 144)` writes
|
|
116
|
+
* `placeholder: false` on `audit`, so a merge of that `.flow` keeps (544, 144), which
|
|
117
|
+
* is on the grid and moved before.
|
|
118
|
+
*
|
|
119
|
+
* @param nodes - Every node of the edited flow, every scope.
|
|
120
|
+
* @returns Whether a node (by its `ui`) is one compile placed and merge should place.
|
|
121
|
+
*/
|
|
122
|
+
export declare function unplacedRule(nodes: ReadonlyArray<{
|
|
123
|
+
ui?: unknown;
|
|
124
|
+
}>): (ui: unknown) => boolean;
|
|
95
125
|
/** A node's `ui` (or its `layout.nodes` entry): the fields placement reads. */
|
|
96
126
|
interface Ui {
|
|
97
127
|
position?: Point;
|
|
@@ -145,5 +175,5 @@ interface PlacedNode {
|
|
|
145
175
|
export declare function placeAddedNodes(nodes: PlacedNode[], edges: ReadonlyArray<{
|
|
146
176
|
sourceNodeId: string;
|
|
147
177
|
targetNodeId: string;
|
|
148
|
-
}>, layoutNodes: Record<string, Ui> | undefined, isAdded: (id: string) => boolean): void;
|
|
178
|
+
}>, layoutNodes: Record<string, Ui> | undefined, isAdded: (id: string) => boolean, isUnplaced?: (ui: unknown) => boolean): void;
|
|
149
179
|
export {};
|
package/dist/node-placement.js
CHANGED
|
@@ -6,7 +6,11 @@
|
|
|
6
6
|
* with positions), compile gives each node it leaves out a placeholder from its
|
|
7
7
|
* emission index, `x = 256 + 288 × index, y = 144` (`+160` inside a container).
|
|
8
8
|
* A scope with no `.layout()` node entries is laid out whole instead
|
|
9
|
-
* (`auto-layout.ts`).
|
|
9
|
+
* (`auto-layout.ts`). Compile marks each node it placed with its position in
|
|
10
|
+
* `ui.placeholder` ({@link PLACEHOLDER_FLAG}, #1993), and a node `.layout()` placed
|
|
11
|
+
* with `false`, so an author `at()` that lands on the same grid point is told apart;
|
|
12
|
+
* a file from an older SDK has no `placeholder` key and is read by its coordinates.
|
|
13
|
+
* Merge replaces the placeholder on each node the edit added:
|
|
10
14
|
*
|
|
11
15
|
* - right of its rightmost positioned predecessor in the same container, past
|
|
12
16
|
* its width, on that predecessor's row; when the node leads into another
|
|
@@ -82,9 +86,9 @@ export function placeholderPosition(index, nested) {
|
|
|
82
86
|
return { x: PLACEHOLDER.x0 + index * PLACEHOLDER.dx, y: PLACEHOLDER.y0 + (nested ? PLACEHOLDER.nestedDy : 0) };
|
|
83
87
|
}
|
|
84
88
|
/**
|
|
85
|
-
* Whether `p` is
|
|
86
|
-
*
|
|
87
|
-
*
|
|
89
|
+
* Whether `p` is on compile's placeholder grid. Merge reads it only for an edited
|
|
90
|
+
* flow with no {@link PLACEHOLDER_FLAG} (an SDK older than the flag), where an author
|
|
91
|
+
* `.layout()` entry on the same grid point reads as a placeholder.
|
|
88
92
|
*/
|
|
89
93
|
export function isPlaceholderPosition(p) {
|
|
90
94
|
if (!p)
|
|
@@ -94,7 +98,8 @@ export function isPlaceholderPosition(p) {
|
|
|
94
98
|
}
|
|
95
99
|
/**
|
|
96
100
|
* The `ui` key compile writes on a node whose position it chose itself: every node of a
|
|
97
|
-
* flow or subflow it laid out (no `.layout()` node entries, `auto-layout.ts`)
|
|
101
|
+
* flow or subflow it laid out (no `.layout()` node entries, `auto-layout.ts`), and each
|
|
102
|
+
* node a scope's `.layout()` leaves on the placeholder row (#1993). Its value
|
|
98
103
|
* is the position compile chose, so the mark holds only while the node is still there:
|
|
99
104
|
* Studio Web keeps unknown `ui` keys on save (flow-schema `extractLayout` persists "the
|
|
100
105
|
* full ui object (including unknown keys like zoom)"), and a drag changes `position` but
|
|
@@ -108,8 +113,19 @@ export function isPlaceholderPosition(p) {
|
|
|
108
113
|
*/
|
|
109
114
|
export const PLACEHOLDER_FLAG = 'placeholder';
|
|
110
115
|
/** `ui` with {@link PLACEHOLDER_FLAG} set to its current position. */
|
|
111
|
-
export function markCompilePlaced(ui) {
|
|
112
|
-
return ui.position ? { ...ui, [PLACEHOLDER_FLAG]: { x: ui.position.x, y: ui.position.y } } : ui;
|
|
116
|
+
export function markCompilePlaced(ui, onRow = false) {
|
|
117
|
+
return ui.position ? { ...ui, [PLACEHOLDER_FLAG]: { x: ui.position.x, y: ui.position.y, ...(onRow ? { row: true } : {}) } } : ui;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Whether a holding mark is a placeholder-row mark (`row: true`): a node a scope's
|
|
121
|
+
* `.layout()` left out. Compile puts such a node back on the same row from the same
|
|
122
|
+
* source, so decompile can leave it out even when the scope's other nodes are the
|
|
123
|
+
* author's; a laid-out node it can leave out only while the whole scope is compile's.
|
|
124
|
+
*/
|
|
125
|
+
export function isPlaceholderRowMark(ui) {
|
|
126
|
+
if (!isMarkedPlaceholder(ui))
|
|
127
|
+
return false;
|
|
128
|
+
return ui[PLACEHOLDER_FLAG].row === true;
|
|
113
129
|
}
|
|
114
130
|
/** Whether a node's `ui` (layout entry over `node.ui`) still sits where compile put it. */
|
|
115
131
|
export function isMarkedPlaceholder(ui) {
|
|
@@ -124,6 +140,27 @@ export function stripPlaceholderFlag(ui) {
|
|
|
124
140
|
if (ui && typeof ui === 'object')
|
|
125
141
|
delete ui[PLACEHOLDER_FLAG];
|
|
126
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* Which added nodes merge places: those whose {@link PLACEHOLDER_FLAG} mark holds.
|
|
145
|
+
* Compile writes the key on every node it emits, `false` on a node `.layout()` placed,
|
|
146
|
+
* so an edited flow with the key anywhere marks every node compile placed, whether
|
|
147
|
+
* merge compiled it or the author passes the `.flow` `flow compile` wrote. An edited
|
|
148
|
+
* flow with the key nowhere came from an SDK older than the mark: then a node is
|
|
149
|
+
* unplaced when it sits on the placeholder grid ({@link isPlaceholderPosition}).
|
|
150
|
+
*
|
|
151
|
+
* Example: `flow compile` of a decompiled source plus `audit: at(544, 144)` writes
|
|
152
|
+
* `placeholder: false` on `audit`, so a merge of that `.flow` keeps (544, 144), which
|
|
153
|
+
* is on the grid and moved before.
|
|
154
|
+
*
|
|
155
|
+
* @param nodes - Every node of the edited flow, every scope.
|
|
156
|
+
* @returns Whether a node (by its `ui`) is one compile placed and merge should place.
|
|
157
|
+
*/
|
|
158
|
+
export function unplacedRule(nodes) {
|
|
159
|
+
const marks = nodes.some((n) => !!n.ui && typeof n.ui === 'object' && PLACEHOLDER_FLAG in n.ui);
|
|
160
|
+
if (marks)
|
|
161
|
+
return isMarkedPlaceholder;
|
|
162
|
+
return (ui) => isPlaceholderPosition(ui?.position);
|
|
163
|
+
}
|
|
127
164
|
const overlaps = (a, b) => !(a.x + a.width + PADDING <= b.x || b.x + b.width + PADDING <= a.x
|
|
128
165
|
|| a.y + a.height + PADDING <= b.y || b.y + b.height + PADDING <= a.y);
|
|
129
166
|
/** Whether two boxes share a row: their vertical extents meet, padding included. */
|
|
@@ -198,15 +235,15 @@ var Blocked;
|
|
|
198
235
|
* @param layoutNodes - The merged file's `layout.nodes`, or undefined when the original keeps positions on `node.ui` (mutated).
|
|
199
236
|
* @param isAdded - Whether a node id is new in this merge.
|
|
200
237
|
*/
|
|
201
|
-
export function placeAddedNodes(nodes, edges, layoutNodes, isAdded) {
|
|
238
|
+
export function placeAddedNodes(nodes, edges, layoutNodes, isAdded, isUnplaced = (ui) => isPlaceholderPosition(ui?.position)) {
|
|
202
239
|
if (layoutNodes)
|
|
203
240
|
moveAddedUi(nodes, layoutNodes, isAdded);
|
|
204
|
-
const s = sceneOf(nodes, edges, layoutNodes, isAdded);
|
|
241
|
+
const s = sceneOf(nodes, edges, layoutNodes, isAdded, isUnplaced);
|
|
205
242
|
const before = new Map([...s.containers].map((id) => [id, bodyExtent(s, id, (o) => !isAdded(o.id))]));
|
|
206
243
|
placeInWaves(s);
|
|
207
244
|
fitContainers(s, before);
|
|
208
245
|
}
|
|
209
|
-
function sceneOf(nodes, edges, layoutNodes, isAdded) {
|
|
246
|
+
function sceneOf(nodes, edges, layoutNodes, isAdded, isUnplaced) {
|
|
210
247
|
const byId = new Map(nodes.map((n) => [n.id, n]));
|
|
211
248
|
const outOf = new Map();
|
|
212
249
|
const inOf = new Map();
|
|
@@ -233,8 +270,7 @@ function sceneOf(nodes, edges, layoutNodes, isAdded) {
|
|
|
233
270
|
notesOf: new Map(),
|
|
234
271
|
};
|
|
235
272
|
for (const n of nodes) {
|
|
236
|
-
|
|
237
|
-
if (isAdded(n.id) && n.type !== STICKY_NOTE_TYPE && (isMarkedPlaceholder(ui) || isPlaceholderPosition(ui?.position)))
|
|
273
|
+
if (isAdded(n.id) && n.type !== STICKY_NOTE_TYPE && isUnplaced(uiOf(s, n)))
|
|
238
274
|
s.pending.add(n.id);
|
|
239
275
|
}
|
|
240
276
|
// A pending node no edge path links to a positioned one in its container
|
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
|
}
|