@uipath/maestro-builder-sdk 6.113.0 → 6.114.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/decompile.js +4 -2
- package/dist/merge.js +3 -2
- package/dist/node-placement.d.ts +37 -7
- package/dist/node-placement.js +48 -12
- 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/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';
|
|
@@ -477,7 +477,8 @@ function mergeFlowFindings(original, edited, options) {
|
|
|
477
477
|
// room, and store every added node's position where the original stores
|
|
478
478
|
// positions — see node-placement.ts. Root scope only: a
|
|
479
479
|
// subflow is taken from `edited` whole, layout included. ──
|
|
480
|
-
|
|
480
|
+
const editedNodes = [...(edited.nodes ?? []), ...Object.values(edited.subflows ?? {}).flatMap((sf) => sf?.nodes ?? [])];
|
|
481
|
+
placeAddedNodes(finalNodes, result.edges, positionStoreOf(original) && layoutNodesOf(result), (id) => !origNodes.has(id), unplacedRule(editedNodes));
|
|
481
482
|
// An added root node is where merge put it now, not where compile did: drop its
|
|
482
483
|
// mark. A subflow taken whole keeps compile's layout and its marks, so a later
|
|
483
484
|
// 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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/maestro-builder-sdk",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.114.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": "5597e702b2d95b80ff1e333d8cdfce8ca05b8601"
|
|
128
128
|
}
|