@uipath/maestro-builder-sdk 6.124.4 → 6.124.5
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/decompile.js +65 -0
- package/dist/merge-variables.d.ts +35 -0
- package/dist/merge-variables.js +74 -0
- package/dist/merge.js +2 -2
- package/dist/migrate.d.ts +36 -0
- package/dist/migrate.js +1 -1
- package/package.json +2 -2
package/dist/decompile.js
CHANGED
|
@@ -2486,6 +2486,14 @@ function region(cursor, stop, scope, ipdom, ctx, refInto) {
|
|
|
2486
2486
|
flagDropped(node, ctx, segs);
|
|
2487
2487
|
return segs;
|
|
2488
2488
|
}
|
|
2489
|
+
// Arms that never meet, not every one of them ending: side lists off the one port.
|
|
2490
|
+
const sides = stopBehind === undefined ? sideListFanOut(node, stop, scope, ctx, ipdom, refInto) : undefined;
|
|
2491
|
+
if (sides) {
|
|
2492
|
+
segs.push(...sides.segs);
|
|
2493
|
+
cursor = sides.cursor;
|
|
2494
|
+
flagDropped(node, ctx, segs);
|
|
2495
|
+
continue;
|
|
2496
|
+
}
|
|
2489
2497
|
// Unstructured fan-out we can't fold — best-effort marker.
|
|
2490
2498
|
// No successor is walked: leave the edges unaccounted so `flagDropped` names each.
|
|
2491
2499
|
const why = stopBehind !== undefined ? terminateBehindStepWhy(stopBehind) : '';
|
|
@@ -2497,6 +2505,63 @@ function region(cursor, stop, scope, ipdom, ctx, refInto) {
|
|
|
2497
2505
|
}
|
|
2498
2506
|
return segs;
|
|
2499
2507
|
}
|
|
2508
|
+
/**
|
|
2509
|
+
* A fan-out whose arms never meet and do not all end, spelled as side lists off
|
|
2510
|
+
* the one port: every arm but the last is `.stepToList(<port>, …)`, and the walk
|
|
2511
|
+
* goes on down the last arm. For instance `prep@success -> a -> End` beside
|
|
2512
|
+
* `prep@success -> b` (b's path left open, which the canvas and the classic CLI
|
|
2513
|
+
* both write) is
|
|
2514
|
+
*
|
|
2515
|
+
* ```ts
|
|
2516
|
+
* .step('prep', …)
|
|
2517
|
+
* .stepToList('success', (p) => p.step('a', …).return({}))
|
|
2518
|
+
* .step('b', …)
|
|
2519
|
+
* ```
|
|
2520
|
+
*
|
|
2521
|
+
* which serialize writes back as the same two edges out of `prep@success`: a
|
|
2522
|
+
* side list leaves from the port the main path also continues from, and under
|
|
2523
|
+
* `.openTails()` (which decompile always emits) neither path gains an End.
|
|
2524
|
+
* There is no join to lose: the file has none, and `.parallel(...)` would add
|
|
2525
|
+
* one (a Merge waits for every arm, which this flow never did). An arm that
|
|
2526
|
+
* does reach a step of the last arm's path ends in `.stepToRef(...)`, the edge
|
|
2527
|
+
* the file has.
|
|
2528
|
+
*
|
|
2529
|
+
* `undefined`, so the caller keeps its marker, when the port has more than two
|
|
2530
|
+
* edges (a port takes one side list), when the edges leave more than one port, from a human task (whose ports a side list may not rewire), when
|
|
2531
|
+
* an arm goes straight into the enclosing loop's handle, or when an arm would
|
|
2532
|
+
* walk past the region's `stop` the last arm does not reach (the enclosing
|
|
2533
|
+
* construct emits that node).
|
|
2534
|
+
*/
|
|
2535
|
+
function sideListFanOut(node, stop, scope, ctx, ipdom, refInto) {
|
|
2536
|
+
const edges = scopeSuccEdges(ctx.graph, node.id, scope);
|
|
2537
|
+
// Exactly two: a port takes one side list (PORT_ALREADY_ROUTED), so a third arm
|
|
2538
|
+
// has nowhere to go and the fan-out keeps the marker.
|
|
2539
|
+
if (edges.length !== 2)
|
|
2540
|
+
return undefined;
|
|
2541
|
+
const port = edges[0].sourcePort;
|
|
2542
|
+
if (edges.some((e) => e.sourcePort !== port) || ctx.graph.primaryOutcomePort(node.id) !== undefined)
|
|
2543
|
+
return undefined;
|
|
2544
|
+
const main = edges[edges.length - 1];
|
|
2545
|
+
const mainReach = forwardReach([main.targetNodeId], scope, ctx.graph);
|
|
2546
|
+
for (const e of edges.slice(0, -1)) {
|
|
2547
|
+
// An arm straight into the enclosing container's handle is no side list.
|
|
2548
|
+
if (e.targetNodeId === ctx.breakInto)
|
|
2549
|
+
return undefined;
|
|
2550
|
+
const reach = forwardReach([e.targetNodeId], scope, ctx.graph);
|
|
2551
|
+
if (stop !== EXIT && reach.has(stop) && !mainReach.has(stop))
|
|
2552
|
+
return undefined;
|
|
2553
|
+
}
|
|
2554
|
+
// A side path may also hand control back to what the enclosing side path rejoins.
|
|
2555
|
+
const into = new Set([...mainReach, ...(refInto ?? [])]);
|
|
2556
|
+
const segs = [];
|
|
2557
|
+
for (const e of edges.slice(0, -1)) {
|
|
2558
|
+
const body = edgeRegion(e, EXIT, scope, ipdom, ctx, into);
|
|
2559
|
+
if (body.length === 0)
|
|
2560
|
+
return undefined;
|
|
2561
|
+
segs.push(`.stepToList(${tsLiteral(port)}, ${armCb('p', body)})`);
|
|
2562
|
+
}
|
|
2563
|
+
return { segs, cursor: follow(ctx.graph, node.id, main.targetNodeId) };
|
|
2564
|
+
}
|
|
2500
2565
|
/** A branch/switch node's arm labels (the designer edge text), when non-default. */
|
|
2501
2566
|
function armLabels(node) {
|
|
2502
2567
|
const i = node.inputs ?? {};
|
|
@@ -23,4 +23,39 @@ export declare function mergeVariables(original: Json, edited: Json, baseline: {
|
|
|
23
23
|
* author changed. Built from entries, so an own `__proto__` key stays a key.
|
|
24
24
|
*/
|
|
25
25
|
export declare function mergeObject(o: Obj, b: Obj, e: Obj, inner: (o: Json, b: Json, e: Json) => Json): Obj;
|
|
26
|
+
/** The fields of a node {@link withoutReturnRespellings} reads. */
|
|
27
|
+
interface EndLike {
|
|
28
|
+
id: string;
|
|
29
|
+
type: string;
|
|
30
|
+
outputs?: unknown;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The merged `variables` without the update rows that only re-spell what an
|
|
34
|
+
* End returns, where the original End returned it without one.
|
|
35
|
+
*
|
|
36
|
+
* Studio Web returns a Variable (an `inout` global) from an End through the
|
|
37
|
+
* End's output mapping alone, `outputs.<id>.source`, with no variable update.
|
|
38
|
+
* Compile writes a `.return({ items: … })` of a Variable as that mapping AND an
|
|
39
|
+
* update row with the same expression, and decompile reads either spelling as
|
|
40
|
+
* the same `.return`. So when the author edits what an End returns, the row is
|
|
41
|
+
* compile's spelling of the edit, not a second edit, and a file whose End had
|
|
42
|
+
* none keeps none.
|
|
43
|
+
*
|
|
44
|
+
* Example, the author changes what End `end` returns for Variable `items`:
|
|
45
|
+
*
|
|
46
|
+
* original end.outputs.items.source = $vars.items no rows
|
|
47
|
+
* edited end.outputs.items.source = ($vars.items) ?? null end: [items = ($vars.items) ?? null]
|
|
48
|
+
* merged end.outputs.items.source = ($vars.items) ?? null no rows
|
|
49
|
+
*
|
|
50
|
+
* A row is dropped only when all hold: the node is an End (or Terminate: a node
|
|
51
|
+
* whose `outputs.<id>.source` is its return mapping, `isOutputMappingNode`) the original has;
|
|
52
|
+
* the variable is a Variable; the row's expression is the End's mapping for it;
|
|
53
|
+
* and the original End wrote no row for it. A row for an Output, for a name
|
|
54
|
+
* that is no global, or with another expression is the author's (or the
|
|
55
|
+
* original's) and stays.
|
|
56
|
+
*/
|
|
57
|
+
export declare function withoutReturnRespellings(variables: Json, nodes: readonly EndLike[], original: {
|
|
58
|
+
nodes?: readonly EndLike[];
|
|
59
|
+
variables?: Json;
|
|
60
|
+
}): Json;
|
|
26
61
|
export {};
|
package/dist/merge-variables.js
CHANGED
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
*/
|
|
43
43
|
import { jsonClone } from './core/json-clone.js';
|
|
44
44
|
import { CONTAINER_KEYS } from './flow-variables.js';
|
|
45
|
+
import { isOutputMappingNode } from './migrate.js';
|
|
45
46
|
/** `jsonClone`, which also passes `undefined` (an absent section or key) through. */
|
|
46
47
|
const copy = (v) => (v === undefined ? v : jsonClone(v));
|
|
47
48
|
const isObj = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
@@ -368,3 +369,76 @@ function boundToGoneNode(entry, goneNodeIds) {
|
|
|
368
369
|
const nodeId = isObj(entry.binding) ? entry.binding.nodeId : undefined;
|
|
369
370
|
return typeof nodeId === 'string' && goneNodeIds.has(nodeId);
|
|
370
371
|
}
|
|
372
|
+
/** An expression's text in either End spelling, `"=js: x"` or `{ type: 'jsExpression', expression: 'x' }`. */
|
|
373
|
+
function jsBody(v) {
|
|
374
|
+
if (typeof v === 'string')
|
|
375
|
+
return v.startsWith('=js:') ? v.slice(4).trim() : undefined;
|
|
376
|
+
return isObj(v) && v.type === 'jsExpression' && typeof v.expression === 'string' ? v.expression.trim() : undefined;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* The merged `variables` without the update rows that only re-spell what an
|
|
380
|
+
* End returns, where the original End returned it without one.
|
|
381
|
+
*
|
|
382
|
+
* Studio Web returns a Variable (an `inout` global) from an End through the
|
|
383
|
+
* End's output mapping alone, `outputs.<id>.source`, with no variable update.
|
|
384
|
+
* Compile writes a `.return({ items: … })` of a Variable as that mapping AND an
|
|
385
|
+
* update row with the same expression, and decompile reads either spelling as
|
|
386
|
+
* the same `.return`. So when the author edits what an End returns, the row is
|
|
387
|
+
* compile's spelling of the edit, not a second edit, and a file whose End had
|
|
388
|
+
* none keeps none.
|
|
389
|
+
*
|
|
390
|
+
* Example, the author changes what End `end` returns for Variable `items`:
|
|
391
|
+
*
|
|
392
|
+
* original end.outputs.items.source = $vars.items no rows
|
|
393
|
+
* edited end.outputs.items.source = ($vars.items) ?? null end: [items = ($vars.items) ?? null]
|
|
394
|
+
* merged end.outputs.items.source = ($vars.items) ?? null no rows
|
|
395
|
+
*
|
|
396
|
+
* A row is dropped only when all hold: the node is an End (or Terminate: a node
|
|
397
|
+
* whose `outputs.<id>.source` is its return mapping, `isOutputMappingNode`) the original has;
|
|
398
|
+
* the variable is a Variable; the row's expression is the End's mapping for it;
|
|
399
|
+
* and the original End wrote no row for it. A row for an Output, for a name
|
|
400
|
+
* that is no global, or with another expression is the author's (or the
|
|
401
|
+
* original's) and stays.
|
|
402
|
+
*/
|
|
403
|
+
export function withoutReturnRespellings(variables, nodes, original) {
|
|
404
|
+
if (!isObj(variables) || !isObj(variables.variableUpdates))
|
|
405
|
+
return variables;
|
|
406
|
+
const updates = variables.variableUpdates;
|
|
407
|
+
const globals = Array.isArray(variables.globals) ? variables.globals : [];
|
|
408
|
+
const isVariable = (id) => globals.some((g) => isObj(g) && g.id === id && g.direction === 'inout');
|
|
409
|
+
const origEnds = new Set((original.nodes ?? []).filter((n) => isOutputMappingNode(n.type)).map((n) => n.id));
|
|
410
|
+
const origUpdates = isObj(original.variables) && isObj(original.variables.variableUpdates) ? original.variables.variableUpdates : {};
|
|
411
|
+
// Collected as entries and built with Object.fromEntries: a node id such as
|
|
412
|
+
// `__proto__` assigned onto a plain object would hit the prototype setter
|
|
413
|
+
// and vanish from the result.
|
|
414
|
+
const out = [];
|
|
415
|
+
let changed = false;
|
|
416
|
+
for (const [nodeId, rows] of Object.entries(updates)) {
|
|
417
|
+
const end = nodes.find((n) => n.id === nodeId && isOutputMappingNode(n.type));
|
|
418
|
+
if (!end || !origEnds.has(nodeId) || !Array.isArray(rows)) {
|
|
419
|
+
out.push([nodeId, rows]);
|
|
420
|
+
continue;
|
|
421
|
+
}
|
|
422
|
+
const origRows = has(origUpdates, nodeId) && Array.isArray(origUpdates[nodeId]) ? origUpdates[nodeId] : [];
|
|
423
|
+
const kept = rows.filter((r) => {
|
|
424
|
+
if (!isObj(r) || typeof r.variableId !== 'string')
|
|
425
|
+
return true;
|
|
426
|
+
const id = r.variableId;
|
|
427
|
+
if (!isVariable(id) || origRows.some((x) => isObj(x) && x.variableId === id))
|
|
428
|
+
return true;
|
|
429
|
+
const body = jsBody(r.expression);
|
|
430
|
+
const mapping = isObj(end.outputs) && isObj(end.outputs[id]) ? end.outputs[id].source : undefined;
|
|
431
|
+
return body === undefined || body !== jsBody(mapping);
|
|
432
|
+
});
|
|
433
|
+
if (kept.length !== rows.length)
|
|
434
|
+
changed = true;
|
|
435
|
+
if (kept.length)
|
|
436
|
+
out.push([nodeId, kept]);
|
|
437
|
+
}
|
|
438
|
+
if (!changed)
|
|
439
|
+
return variables;
|
|
440
|
+
// An original with no `variableUpdates` key keeps none when nothing is left.
|
|
441
|
+
if (out.length || (isObj(original.variables) && has(original.variables, 'variableUpdates')))
|
|
442
|
+
return { ...variables, variableUpdates: Object.fromEntries(out) };
|
|
443
|
+
return Object.fromEntries(Object.entries(variables).filter(([k]) => k !== 'variableUpdates'));
|
|
444
|
+
}
|
package/dist/merge.js
CHANGED
|
@@ -104,7 +104,7 @@ import { MergeRefusedError, mergedFileFindings, roundTripFindings } from './merg
|
|
|
104
104
|
import { placeAddedNodes, stripPlaceholderFlag, unplacedRule } from './node-placement.js';
|
|
105
105
|
import { mergeAgentSidecars } from './merge-sidecars.js';
|
|
106
106
|
import { embeddedAgentFindings, isEmbeddedAgent, mergeEmbeddedAgentNode } from './merge-embedded-agent.js';
|
|
107
|
-
import { mergeObject, mergeVariables, stableJson } from './merge-variables.js';
|
|
107
|
+
import { mergeObject, mergeVariables, stableJson, withoutReturnRespellings } from './merge-variables.js';
|
|
108
108
|
import { keepProcessInputReads } from './merge-process-inputs.js';
|
|
109
109
|
import { replaceSupersededOutputs } from './merge-superseded-outputs.js';
|
|
110
110
|
import { restoredConnectionMessage, withOriginalConnectionLabels } from './merge-baseline-connections.js';
|
|
@@ -585,7 +585,7 @@ function mergeFlowFindings(original, edited, options) {
|
|
|
585
585
|
if (layoutNodes)
|
|
586
586
|
for (const id of goneNodeIds)
|
|
587
587
|
delete layoutNodes[id];
|
|
588
|
-
const variables = mergeVariables(original.variables, edited.variables, options.baseline, goneNodeIds);
|
|
588
|
+
const variables = withoutReturnRespellings(mergeVariables(original.variables, edited.variables, options.baseline, goneNodeIds), finalNodes, original);
|
|
589
589
|
if (variables === undefined)
|
|
590
590
|
delete result.variables;
|
|
591
591
|
else
|
package/dist/migrate.d.ts
CHANGED
|
@@ -13,3 +13,39 @@ export declare function migrateToSchemaVersion(flow: any, target?: string): void
|
|
|
13
13
|
* now — the rename is the point, and callers that pass no target are unchanged.
|
|
14
14
|
*/
|
|
15
15
|
export declare function migrateTo16(flow: any): void;
|
|
16
|
+
/**
|
|
17
|
+
* Whether `type` is a node whose `outputs.<varId>.source` is an output MAPPING the
|
|
18
|
+
* author edits: the value assigned to a flow output variable when the run
|
|
19
|
+
* ends there. Only these keep the envelope on their output sources.
|
|
20
|
+
*
|
|
21
|
+
* **Why every other node's output `source` stays a plain string (MST-17759).**
|
|
22
|
+
* On a non-End node, `outputs.<k>.source` is the node type's own projection of
|
|
23
|
+
* its runtime result (`"=result.response"`, `"=Error"`), copied from the
|
|
24
|
+
* manifest's `outputDefinition`. The designer writes it as that plain string
|
|
25
|
+
* and never edits it: the manifest mappers spell it so
|
|
26
|
+
* (flow-workbench `packages/flow-core/src/manifest/mappers/connector.ts:317`,
|
|
27
|
+
* `data/queue-factory.ts:250`), and a designer-saved 1.9 file carries strings
|
|
28
|
+
* on every such node. The VS Code Maestro editor reads it as a string —
|
|
29
|
+
* `cleanSourceExpression(source)` calls `source.startsWith('=')`
|
|
30
|
+
* (`packages/canvas/src/utils/execution-data-transformer.ts:149`) — so the
|
|
31
|
+
* envelope this module used to write there crashed debug with
|
|
32
|
+
* `e.startsWith is not a function`.
|
|
33
|
+
*
|
|
34
|
+
* The envelope came from copying the OUTPUT of the platform's 1.2→1.3 file
|
|
35
|
+
* migration (`packages/migrations/src/migrations/v1.2-to-v1.3.ts`). Its doc
|
|
36
|
+
* comment scopes output wrapping to "End-node output mappings", but its loop
|
|
37
|
+
* wraps every node, so a migrated file is not the shape the designer writes.
|
|
38
|
+
*
|
|
39
|
+
* **Why End-type mappings keep the envelope.** The designer's End-node editor
|
|
40
|
+
* writes one. Each mapping row is bound to `outputs.<varId>.source`
|
|
41
|
+
* (`packages/canvas/src/components/properties-panel/contributors/end-node.ts:24`)
|
|
42
|
+
* and rendered by the expression `CodeEditorField`, whose default
|
|
43
|
+
* `valueFormat: 'expressionValue'` emits `{ type, expression, fieldType }` on
|
|
44
|
+
* every edit (`CodeEditorField.tsx:318-321`, `:786`); the End contributor sets
|
|
45
|
+
* no other `valueFormat`. Convert-to-subflow writes the same shape into the
|
|
46
|
+
* subflow's End nodes (`packages/canvas/src/utils/subflows/convert-to-subflow.ts:649-654`).
|
|
47
|
+
* flow-schema's `isEndNodeType` also counts `core.control.response`
|
|
48
|
+
* (`packages/flow-schema/src/validation/rules/helpers.ts:99`); the SDK does
|
|
49
|
+
* not emit that node, so it is not listed here.
|
|
50
|
+
*/
|
|
51
|
+
export declare function isOutputMappingNode(type: unknown): boolean;
|
package/dist/migrate.js
CHANGED
|
@@ -213,7 +213,7 @@ export function migrateTo16(flow) {
|
|
|
213
213
|
* (`packages/flow-schema/src/validation/rules/helpers.ts:99`); the SDK does
|
|
214
214
|
* not emit that node, so it is not listed here.
|
|
215
215
|
*/
|
|
216
|
-
function isOutputMappingNode(type) {
|
|
216
|
+
export function isOutputMappingNode(type) {
|
|
217
217
|
return type === 'core.control.end' || type === 'core.logic.terminate';
|
|
218
218
|
}
|
|
219
219
|
function wrapDynamicValues(flow) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/maestro-builder-sdk",
|
|
3
|
-
"version": "6.124.
|
|
3
|
+
"version": "6.124.5",
|
|
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",
|
|
@@ -127,5 +127,5 @@
|
|
|
127
127
|
"@types/node": "^22.7.0",
|
|
128
128
|
"esbuild": "^0.28.1"
|
|
129
129
|
},
|
|
130
|
-
"gitref": "
|
|
130
|
+
"gitref": "687f11905701ce1242f9d5e529882f9254529592"
|
|
131
131
|
}
|