@uipath/maestro-builder-sdk 6.44.0 → 6.44.1

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/merge.d.ts CHANGED
@@ -26,9 +26,11 @@
26
26
  * as decompile was faithful for every node (the common case).
27
27
  *
28
28
  * Layout, `metadata`, `solutionId`, `projectId`, `runtime` and `layout` are
29
- * preserved from the original; `subflows` and edges (with their ids) come from
30
- * `edited`; root `variables` merge as a delta per entry, like nodes
31
- * (merge-variables.ts); `definitions` and `bindings` are unioned
29
+ * preserved from the original, apart from the `layout.nodes` entries of
30
+ * removed nodes (dropped) and added nodes (node-placement.ts); `subflows` and
31
+ * edges (with their ids) come from `edited`; root `variables` merge as a
32
+ * delta per entry, like nodes (merge-variables.ts); `definitions` and
33
+ * `bindings` are unioned
32
34
  * (original wins on conflict, since the original's are the tenant-resolved
33
35
  * authority). A binding row's identity is what it binds, not its row id, and a
34
36
  * row the no-edit recompile minted only for nodes merge kept from the original
package/dist/merge.js CHANGED
@@ -26,9 +26,11 @@
26
26
  * as decompile was faithful for every node (the common case).
27
27
  *
28
28
  * Layout, `metadata`, `solutionId`, `projectId`, `runtime` and `layout` are
29
- * preserved from the original; `subflows` and edges (with their ids) come from
30
- * `edited`; root `variables` merge as a delta per entry, like nodes
31
- * (merge-variables.ts); `definitions` and `bindings` are unioned
29
+ * preserved from the original, apart from the `layout.nodes` entries of
30
+ * removed nodes (dropped) and added nodes (node-placement.ts); `subflows` and
31
+ * edges (with their ids) come from `edited`; root `variables` merge as a
32
+ * delta per entry, like nodes (merge-variables.ts); `definitions` and
33
+ * `bindings` are unioned
32
34
  * (original wins on conflict, since the original's are the tenant-resolved
33
35
  * authority). A binding row's identity is what it binds, not its row id, and a
34
36
  * row the no-edit recompile minted only for nodes merge kept from the original
@@ -261,6 +263,11 @@ function layoutNodesOf(f) {
261
263
  const nodes = f.layout?.nodes;
262
264
  return nodes && typeof nodes === 'object' && !Array.isArray(nodes) ? nodes : undefined;
263
265
  }
266
+ /** The original's `layout.nodes` when it holds positions. An SDK compile writes `{}` there and keeps them on `node.ui`. */
267
+ function positionStoreOf(f) {
268
+ const nodes = layoutNodesOf(f);
269
+ return nodes && Object.keys(nodes).length > 0 ? nodes : undefined;
270
+ }
264
271
  export function mergeFlow(original, edited, options = {}) {
265
272
  const { result, findings } = mergeFlowFindings(original, edited, options);
266
273
  reportOrRefuse(findings, options);
@@ -374,12 +381,13 @@ function mergeFlowFindings(original, edited, options) {
374
381
  // one already taken elsewhere in the file, gets a fresh id, from ids unused
375
382
  // anywhere in the file. ──
376
383
  result.edges = withFileUniqueEdgeIds(edited.edges ?? [], subflowScopes);
377
- // ── Placement: a node the edit ADDED has only compile's placeholder, an
378
- // emission-index slot that can land on an original node. Put it next to
379
- // its predecessor, collision-free, in the store the
380
- // original uses — see node-placement.ts. Root scope only: a subflow is
381
- // taken from `edited` whole, layout included. ──
382
- placeAddedNodes(finalNodes, result.edges, layoutNodesOf(result), (id) => !origNodes.has(id));
384
+ // ── Placement: a node the edit ADDED has no original position. Unless the
385
+ // author set one, it has compile's placeholder, an emission-index slot
386
+ // that can land on an original node. Put it next to its predecessor,
387
+ // collision-free, and store every added node's position where the
388
+ // original stores positions — see node-placement.ts. Root scope only: a
389
+ // subflow is taken from `edited` whole, layout included. ──
390
+ placeAddedNodes(finalNodes, result.edges, positionStoreOf(original) && layoutNodesOf(result), (id) => !origNodes.has(id));
383
391
  // ── Definitions: the (type, version) pairs used by EVERY node in the file —
384
392
  // root and subflows — original winning on conflict (its defs are the
385
393
  // tenant-resolved authority). Selecting by root nodes only dropped the
@@ -398,7 +406,9 @@ function mergeFlowFindings(original, edited, options) {
398
406
  result.bindings = mergeBindings(original.bindings, edited.bindings);
399
407
  result.bindings = withoutRowsMintedForKeptNodes(result.bindings, original, edited, options.baseline, keptFromOriginal);
400
408
  // metadata / solutionId / projectId / layout / runtime were carried by the
401
- // initial clone of `original` and are intentionally left untouched.
409
+ // initial clone of `original` and are intentionally left untouched, apart
410
+ // from the `layout.nodes` entries of removed nodes (dropped above) and added
411
+ // nodes (placement).
402
412
  //
403
413
  // The declared file-format `version` follows the same delta rule the nodes
404
414
  // do. The original's wins by default, because a compile of an edited source
@@ -19,7 +19,7 @@
19
19
  * A child's position is relative to its container, as on the canvas.
20
20
  *
21
21
  * The position goes where the original stores positions: `layout.nodes[id]`
22
- * when it has a `layout.nodes` map, otherwise `node.ui`. Positions are read the
22
+ * when its `layout.nodes` has entries, otherwise `node.ui`. Positions are read the
23
23
  * way the designer reads them (flow-workbench `flow-schema`
24
24
  * `workflow-format-conversion.ts` `mergeLayout`): a `layout.nodes[id]` entry
25
25
  * wins over `node.ui`, field by field.
@@ -77,13 +77,14 @@ interface PlacedNode {
77
77
  * its placeholder, and placed nodes avoid it.
78
78
  *
79
79
  * Where the result is written follows the file: when the original stores
80
- * positions in `layout.nodes` (every canvas-saved file does), the position goes
81
- * there and the placeholder `node.ui` is dropped, so the file has one store;
82
- * otherwise `node.ui.position` is updated.
80
+ * positions in `layout.nodes` (every canvas-saved file does), every added
81
+ * node's `node.ui`, placed or not, sticky notes included, replaces its
82
+ * `layout.nodes` entry, so the node has one position; otherwise
83
+ * `node.ui.position` is updated.
83
84
  *
84
85
  * @param nodes - The merged root nodes (mutated).
85
86
  * @param edges - The merged root edges.
86
- * @param layoutNodes - The merged file's `layout.nodes`, or undefined when the original has none (mutated).
87
+ * @param layoutNodes - The merged file's `layout.nodes`, or undefined when the original keeps positions on `node.ui` (mutated).
87
88
  * @param isAdded - Whether a node id is new in this merge.
88
89
  */
89
90
  export declare function placeAddedNodes(nodes: PlacedNode[], edges: ReadonlyArray<{
@@ -19,7 +19,7 @@
19
19
  * A child's position is relative to its container, as on the canvas.
20
20
  *
21
21
  * The position goes where the original stores positions: `layout.nodes[id]`
22
- * when it has a `layout.nodes` map, otherwise `node.ui`. Positions are read the
22
+ * when its `layout.nodes` has entries, otherwise `node.ui`. Positions are read the
23
23
  * way the designer reads them (flow-workbench `flow-schema`
24
24
  * `workflow-format-conversion.ts` `mergeLayout`): a `layout.nodes[id]` entry
25
25
  * wins over `node.ui`, field by field.
@@ -83,6 +83,21 @@ function findFreePosition(candidate, size, others) {
83
83
  }
84
84
  return candidate;
85
85
  }
86
+ /**
87
+ * Move each added node's `ui` into `layoutNodes`, replacing any entry under its
88
+ * id: the original can hold an entry for an id it has no node for.
89
+ */
90
+ function moveAddedUi(nodes, layoutNodes, isAdded) {
91
+ for (const n of nodes) {
92
+ if (!isAdded(n.id))
93
+ continue;
94
+ if (n.ui === undefined)
95
+ delete layoutNodes[n.id];
96
+ else
97
+ layoutNodes[n.id] = n.ui;
98
+ delete n.ui;
99
+ }
100
+ }
86
101
  /**
87
102
  * Give each node the edit added a position next to its predecessor, in place.
88
103
  *
@@ -95,16 +110,19 @@ function findFreePosition(candidate, size, others) {
95
110
  * its placeholder, and placed nodes avoid it.
96
111
  *
97
112
  * Where the result is written follows the file: when the original stores
98
- * positions in `layout.nodes` (every canvas-saved file does), the position goes
99
- * there and the placeholder `node.ui` is dropped, so the file has one store;
100
- * otherwise `node.ui.position` is updated.
113
+ * positions in `layout.nodes` (every canvas-saved file does), every added
114
+ * node's `node.ui`, placed or not, sticky notes included, replaces its
115
+ * `layout.nodes` entry, so the node has one position; otherwise
116
+ * `node.ui.position` is updated.
101
117
  *
102
118
  * @param nodes - The merged root nodes (mutated).
103
119
  * @param edges - The merged root edges.
104
- * @param layoutNodes - The merged file's `layout.nodes`, or undefined when the original has none (mutated).
120
+ * @param layoutNodes - The merged file's `layout.nodes`, or undefined when the original keeps positions on `node.ui` (mutated).
105
121
  * @param isAdded - Whether a node id is new in this merge.
106
122
  */
107
123
  export function placeAddedNodes(nodes, edges, layoutNodes, isAdded) {
124
+ if (layoutNodes)
125
+ moveAddedUi(nodes, layoutNodes, isAdded);
108
126
  const byId = new Map(nodes.map((n) => [n.id, n]));
109
127
  const uiOf = (n) => {
110
128
  const entry = layoutNodes?.[n.id];
@@ -149,13 +167,10 @@ export function placeAddedNodes(nodes, edges, layoutNodes, isAdded) {
149
167
  .map((o) => ({ ...uiOf(o).position, ...sizeOf(o) }));
150
168
  const position = findFreePosition(candidate, sizeOf(n), others);
151
169
  const ui = { ...uiOf(n), position };
152
- if (layoutNodes) {
170
+ if (layoutNodes)
153
171
  layoutNodes[id] = ui;
154
- delete n.ui;
155
- }
156
- else {
172
+ else
157
173
  n.ui = ui;
158
- }
159
174
  pending.delete(id);
160
175
  progress = true;
161
176
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.44.0",
3
+ "version": "6.44.1",
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",
@@ -93,5 +93,5 @@
93
93
  "@types/node": "^22.7.0",
94
94
  "esbuild": "^0.28.1"
95
95
  },
96
- "gitref": "7075376040d8eb546745a5457c894dbc168448c8"
96
+ "gitref": "7e2a9339fd00189290ce2ac453aa52636426d6ce"
97
97
  }