@uipath/maestro-builder-sdk 6.124.2 → 6.124.4
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/api-index.md +22 -22
- package/dist/api-members.md +84 -81
- package/dist/case/connector-saved-context.d.ts +2 -1
- package/dist/case/connector-saved-context.js +7 -5
- package/dist/case/connector-saved-rows.d.ts +7 -3
- package/dist/case/connector-saved-rows.js +95 -12
- package/dist/case/serialize.d.ts +4 -3
- package/dist/case/serialize.js +44 -17
- package/dist/case/subscription.d.ts +21 -1
- package/dist/case/subscription.js +43 -1
- package/dist/core/input-reads.d.ts +18 -0
- package/dist/core/input-reads.js +51 -0
- package/dist/decompile.js +25 -44
- package/dist/flow-option-keys.js +3 -3
- package/dist/flow-sdk.d.ts +23 -0
- package/dist/merge-process-inputs.d.ts +3 -0
- package/dist/merge-process-inputs.js +86 -0
- package/dist/merge.js +17 -5
- package/dist/serialize.js +17 -1
- package/package.json +2 -2
package/dist/flow-sdk.d.ts
CHANGED
|
@@ -330,6 +330,19 @@ export interface StepOptions extends NodeOptions {
|
|
|
330
330
|
* for a Slack send saved with no connection.
|
|
331
331
|
*/
|
|
332
332
|
draft?: boolean;
|
|
333
|
+
/**
|
|
334
|
+
* Show the step's error handle without wiring a handler: the node's
|
|
335
|
+
* `inputs.errorHandlingEnabled`, which the canvas's error-handling toggle
|
|
336
|
+
* sets. `.onError(...)` sets it on its own, so this is only for a handle left
|
|
337
|
+
* unwired. Decompile prints it for such a node, so a recompile keeps the
|
|
338
|
+
* handle. Nothing routes there: with no `error` edge a failure still fails
|
|
339
|
+
* the run. Refused on a node type with no error port (ONERROR_NO_ERROR_PORT).
|
|
340
|
+
*
|
|
341
|
+
* ```ts
|
|
342
|
+
* .step('fetch', script(fetchInvoice), { errorHandlingEnabled: true })
|
|
343
|
+
* ```
|
|
344
|
+
*/
|
|
345
|
+
errorHandlingEnabled?: boolean;
|
|
333
346
|
}
|
|
334
347
|
/**
|
|
335
348
|
* The options of `.branch()`: the {@link NodeOptions}, plus `draft` for a
|
|
@@ -447,6 +460,11 @@ export interface LoopOptions extends NodeOptions {
|
|
|
447
460
|
* the body calls `b.break()`.
|
|
448
461
|
*/
|
|
449
462
|
breakEnabled?: boolean;
|
|
463
|
+
/**
|
|
464
|
+
* Show the loop's error handle without wiring a handler — set automatically
|
|
465
|
+
* by `.onError(...)` after the loop (see {@link StepOptions.errorHandlingEnabled}).
|
|
466
|
+
*/
|
|
467
|
+
errorHandlingEnabled?: boolean;
|
|
450
468
|
}
|
|
451
469
|
/**
|
|
452
470
|
* Do-while options. `limit` caps iterations; the platform
|
|
@@ -457,6 +475,11 @@ export interface DoWhileOptions extends NodeOptions {
|
|
|
457
475
|
limit?: number;
|
|
458
476
|
/** Show the break handle without wiring one — set automatically by `b.break()`. */
|
|
459
477
|
breakEnabled?: boolean;
|
|
478
|
+
/**
|
|
479
|
+
* Show the do-while's error handle without wiring a handler — set
|
|
480
|
+
* automatically by `.onError(...)` after it (see {@link StepOptions.errorHandlingEnabled}).
|
|
481
|
+
*/
|
|
482
|
+
errorHandlingEnabled?: boolean;
|
|
460
483
|
}
|
|
461
484
|
export type Step = {
|
|
462
485
|
kind: 'action';
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An edit's reads of a process-level flow input, in the file's spelling.
|
|
3
|
+
*
|
|
4
|
+
* Short version: a file can declare a flow input with no `triggerNodeId` (a
|
|
5
|
+
* "process-level" input) and read it bare, as `$vars.n`. The SDK source has no
|
|
6
|
+
* spelling for that, so decompile moves every read to the trigger's output,
|
|
7
|
+
* `$vars.start.output.n` (`bindProcessInputReads`), and compile stamps
|
|
8
|
+
* `triggerNodeId: "start"` on the input to match. Merge keeps the original's
|
|
9
|
+
* input as it was (the author did not change it), so the read an edit brought
|
|
10
|
+
* back must move back too:
|
|
11
|
+
*
|
|
12
|
+
* ```
|
|
13
|
+
* original "version": "=js:$vars.version" input: no triggerNodeId
|
|
14
|
+
* edited "version": "=js:($vars.start.output.version)" input: triggerNodeId "start"
|
|
15
|
+
* merged "version": "=js:($vars.version)" input: no triggerNodeId (kept)
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* Left at the trigger path, the merged read resolves to null at run time: the
|
|
19
|
+
* trigger's output carries only the inputs bound to it (`flow validate` warns
|
|
20
|
+
* "read via `$vars.start.output.version`, but it has no triggerNodeId").
|
|
21
|
+
*
|
|
22
|
+
* Only text merge took from the edit is rewritten: an added node, or the
|
|
23
|
+
* values of an edited node and of a variable-update list that differ from the
|
|
24
|
+
* original's. Whatever the original wrote stays as written. Root scope only: a
|
|
25
|
+
* subflow is either the original's whole or the edited compile's whole, its
|
|
26
|
+
* inputs included, and both agree with themselves.
|
|
27
|
+
*/
|
|
28
|
+
import { renameInputReads } from './core/input-reads.js';
|
|
29
|
+
import { isRecord } from './core/node-envelope.js';
|
|
30
|
+
import { stableJson } from './merge-variables.js';
|
|
31
|
+
/** `[trigger path, bare name]` per input the merged file keeps process-level and the edited compile bound to a trigger. */
|
|
32
|
+
function respelled(result, edited) {
|
|
33
|
+
const globalsOf = (f) => {
|
|
34
|
+
const g = f.variables?.globals;
|
|
35
|
+
return Array.isArray(g) ? g.filter(isRecord) : [];
|
|
36
|
+
};
|
|
37
|
+
const nodeIds = new Set((result.nodes ?? []).map((n) => n.id));
|
|
38
|
+
const bound = new Map(globalsOf(edited)
|
|
39
|
+
.filter((g) => g.direction === 'in' && typeof g.id === 'string' && typeof g.triggerNodeId === 'string' && g.triggerNodeId !== '')
|
|
40
|
+
.map((g) => [g.id, g.triggerNodeId]));
|
|
41
|
+
const out = [];
|
|
42
|
+
for (const g of globalsOf(result)) {
|
|
43
|
+
if (g.direction !== 'in' || typeof g.id !== 'string' || g.id === '' || nodeIds.has(g.id))
|
|
44
|
+
continue;
|
|
45
|
+
if (typeof g.triggerNodeId === 'string' && g.triggerNodeId !== '')
|
|
46
|
+
continue;
|
|
47
|
+
const trigger = bound.get(g.id);
|
|
48
|
+
if (trigger !== undefined)
|
|
49
|
+
out.push([`${trigger}.output.${g.id}`, g.id]);
|
|
50
|
+
}
|
|
51
|
+
return out;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* `merged` with `rename` applied to the parts that differ from `orig`, keyed
|
|
55
|
+
* as `renameInputReads` keys its code slots. A literal envelope, a `display`
|
|
56
|
+
* and a `ui` are data, as there.
|
|
57
|
+
*/
|
|
58
|
+
function inChangedParts(merged, orig, rename, key) {
|
|
59
|
+
if (stableJson(merged) === stableJson(orig))
|
|
60
|
+
return merged;
|
|
61
|
+
const atKey = (v) => (key === undefined ? rename(v) : rename({ [key]: v })[key]);
|
|
62
|
+
if (Array.isArray(merged) && Array.isArray(orig) && merged.length === orig.length) {
|
|
63
|
+
return merged.map((x, i) => inChangedParts(x, orig[i], rename, key));
|
|
64
|
+
}
|
|
65
|
+
if (isRecord(merged) && isRecord(orig) && merged.type !== 'literal' && !Array.isArray(merged) && !Array.isArray(orig)) {
|
|
66
|
+
return Object.fromEntries(Object.entries(merged).map(([k, v]) => [k,
|
|
67
|
+
k === 'display' || k === 'ui' ? v : inChangedParts(v, orig[k], rename, k)]));
|
|
68
|
+
}
|
|
69
|
+
return atKey(merged);
|
|
70
|
+
}
|
|
71
|
+
/** Move the edit's trigger-path reads of the file's process-level inputs back to `$vars.<name>`, in place. */
|
|
72
|
+
export function keepProcessInputReads(result, original, edited) {
|
|
73
|
+
const pairs = respelled(result, edited);
|
|
74
|
+
if (pairs.length === 0)
|
|
75
|
+
return;
|
|
76
|
+
const rename = (v) => pairs.reduce((x, [from, to]) => renameInputReads(x, from, to), v);
|
|
77
|
+
const origNodes = new Map((original.nodes ?? []).map((n) => [n.id, n]));
|
|
78
|
+
result.nodes = (result.nodes ?? []).map((n) => inChangedParts(n, origNodes.get(n.id), rename));
|
|
79
|
+
const vars = result.variables;
|
|
80
|
+
const updates = vars?.variableUpdates;
|
|
81
|
+
if (!isRecord(updates))
|
|
82
|
+
return;
|
|
83
|
+
const origUpdates = original.variables?.variableUpdates;
|
|
84
|
+
const before = isRecord(origUpdates) ? origUpdates : {};
|
|
85
|
+
vars.variableUpdates = Object.fromEntries(Object.entries(updates).map(([id, rows]) => [id, inChangedParts(rows, before[id], rename)]));
|
|
86
|
+
}
|
package/dist/merge.js
CHANGED
|
@@ -105,6 +105,7 @@ import { placeAddedNodes, stripPlaceholderFlag, unplacedRule } from './node-plac
|
|
|
105
105
|
import { mergeAgentSidecars } from './merge-sidecars.js';
|
|
106
106
|
import { embeddedAgentFindings, isEmbeddedAgent, mergeEmbeddedAgentNode } from './merge-embedded-agent.js';
|
|
107
107
|
import { mergeObject, mergeVariables, stableJson } from './merge-variables.js';
|
|
108
|
+
import { keepProcessInputReads } from './merge-process-inputs.js';
|
|
108
109
|
import { replaceSupersededOutputs } from './merge-superseded-outputs.js';
|
|
109
110
|
import { restoredConnectionMessage, withOriginalConnectionLabels } from './merge-baseline-connections.js';
|
|
110
111
|
import { byId, isKept, nodeUnchanged, subflowsTakenFromEdited } from './edit-scope.js';
|
|
@@ -118,13 +119,20 @@ export { MergeRefusedError } from './merge-roundtrip.js';
|
|
|
118
119
|
* `layout.nodes` entry, the merged file keeps that entry (it is carried over
|
|
119
120
|
* with the original's `layout`) and the edited node's compile placeholder `ui`
|
|
120
121
|
* is dropped, so the node has one position, not two.
|
|
122
|
+
*
|
|
123
|
+
* An original node with NO position (neither) keeps none: the edited node's
|
|
124
|
+
* `ui` is compile's placeholder (`isUnplaced`), an emission-index slot that
|
|
125
|
+
* moves whenever a step is added before the node, not a position the author
|
|
126
|
+
* gave it. Taking it wrote that slot, placeholder mark and all, onto a node the
|
|
127
|
+
* author never placed. A position the author set with `.layout()` is not a
|
|
128
|
+
* placeholder, so it is still taken.
|
|
121
129
|
*/
|
|
122
|
-
function withOriginalLayout(edited, orig, originalLayout) {
|
|
130
|
+
function withOriginalLayout(edited, orig, originalLayout, isUnplaced) {
|
|
123
131
|
if (!orig)
|
|
124
132
|
return edited;
|
|
125
133
|
if (orig.ui !== undefined)
|
|
126
134
|
return { ...edited, ui: jsonClone(orig.ui) };
|
|
127
|
-
if (originalLayout?.[orig.id] !== undefined) {
|
|
135
|
+
if (originalLayout?.[orig.id] !== undefined || (edited.ui !== undefined && isUnplaced(edited.ui))) {
|
|
128
136
|
const { ui: _placeholder, ...rest } = edited;
|
|
129
137
|
return rest;
|
|
130
138
|
}
|
|
@@ -464,6 +472,9 @@ function mergeFlowFindings(original, edited, options) {
|
|
|
464
472
|
const result = jsonClone(original);
|
|
465
473
|
const origNodes = byId(original.nodes);
|
|
466
474
|
const baseNodes = byId(options.baseline?.nodes);
|
|
475
|
+
// Which edited nodes sit where compile put them, not where an author did (node-placement.ts).
|
|
476
|
+
const editedNodes = [...(edited.nodes ?? []), ...Object.values(edited.subflows ?? {}).flatMap((sf) => sf?.nodes ?? [])];
|
|
477
|
+
const isUnplaced = unplacedRule(editedNodes);
|
|
467
478
|
// ── Nodes: the edited graph decides which nodes exist and in what order; the
|
|
468
479
|
// original decides their look (and, for untouched nodes, their content). ──
|
|
469
480
|
const finalNodes = [];
|
|
@@ -499,7 +510,7 @@ function mergeFlowFindings(original, edited, options) {
|
|
|
499
510
|
if (byField)
|
|
500
511
|
fieldwise.set(e.id, changedFrom(orig, taken));
|
|
501
512
|
const node = orig && base ? withDisplayEdits(taken, orig, e, base) : taken;
|
|
502
|
-
const placed = withOriginalSource(withOriginalLayout(node, orig, layoutNodesOf(original)), orig, base);
|
|
513
|
+
const placed = withOriginalSource(withOriginalLayout(node, orig, layoutNodesOf(original), isUnplaced), orig, base);
|
|
503
514
|
finalNodes.push(placed);
|
|
504
515
|
// Without a baseline every node lands here; count one as edited only
|
|
505
516
|
// when the merged node differs from the original.
|
|
@@ -579,6 +590,9 @@ function mergeFlowFindings(original, edited, options) {
|
|
|
579
590
|
delete result.variables;
|
|
580
591
|
else
|
|
581
592
|
result.variables = variables;
|
|
593
|
+
// An edit's reads of an input the file keeps process-level, back in the file's
|
|
594
|
+
// spelling: decompile moved them to the trigger's output (merge-process-inputs.ts).
|
|
595
|
+
keepProcessInputReads(result, original, edited);
|
|
582
596
|
// ── Edges: the edited graph's edges define the wiring, under the edited
|
|
583
597
|
// file's own ids. compile draws every edge id — root AND subflows — from
|
|
584
598
|
// one file-wide counter, so they are already unique. Renumbering the root
|
|
@@ -596,8 +610,6 @@ function mergeFlowFindings(original, edited, options) {
|
|
|
596
610
|
// room, and store every added node's position where the original stores
|
|
597
611
|
// positions — see node-placement.ts. Root scope only: a
|
|
598
612
|
// subflow is taken from `edited` whole, layout included. ──
|
|
599
|
-
const editedNodes = [...(edited.nodes ?? []), ...Object.values(edited.subflows ?? {}).flatMap((sf) => sf?.nodes ?? [])];
|
|
600
|
-
const isUnplaced = unplacedRule(editedNodes);
|
|
601
613
|
// ── Layout edits: a `.layout()` entry the author changed (edited differs from
|
|
602
614
|
// the baseline) is an edit like any other, so it lands on the original's node,
|
|
603
615
|
// root and every subflow, before added nodes are placed around it (#1994). ──
|
package/dist/serialize.js
CHANGED
|
@@ -3077,6 +3077,20 @@ function serializeFlow(built, opts, scopeLayout) {
|
|
|
3077
3077
|
throw new Error(`internal SDK error: label on "${step.name}": emitted node not found.`);
|
|
3078
3078
|
node.display = { ...(node.display ?? {}), label };
|
|
3079
3079
|
};
|
|
3080
|
+
/**
|
|
3081
|
+
* `{ errorHandlingEnabled: true }` (StepOptions.errorHandlingEnabled): the
|
|
3082
|
+
* error handle shown with nothing wired, the flag `.onError(...)` sets with
|
|
3083
|
+
* its edge. Refused like a handler on a node with no error port.
|
|
3084
|
+
*/
|
|
3085
|
+
const applyErrorHandle = (step, nodeId) => {
|
|
3086
|
+
if (step.options?.errorHandlingEnabled !== true)
|
|
3087
|
+
return;
|
|
3088
|
+
const node = nodeId ? scope.nodes.find((n) => n.id === nodeId) : undefined;
|
|
3089
|
+
if (!node)
|
|
3090
|
+
throw new Error(`internal SDK error: errorHandlingEnabled on "${step.name}": emitted node not found.`);
|
|
3091
|
+
refuseErrorEdgeWithoutPort(scope, node.id, step.name);
|
|
3092
|
+
node.inputs = { ...(node.inputs ?? {}), errorHandlingEnabled: true };
|
|
3093
|
+
};
|
|
3080
3094
|
for (const [stepIndex, step] of steps.entries()) {
|
|
3081
3095
|
// After a node whose exits are all templated, only its port lists may
|
|
3082
3096
|
// follow: nothing continues from it, so a step here would hang off no edge.
|
|
@@ -3092,7 +3106,7 @@ function serializeFlow(built, opts, scopeLayout) {
|
|
|
3092
3106
|
if (step.kind !== 'action')
|
|
3093
3107
|
refuseUnknownStepOptions(scope, step);
|
|
3094
3108
|
if (step.kind === 'action') {
|
|
3095
|
-
tails = emitStep(step, tails, scope, parentId, () => { applyUpdates(step); applyLabel(step); });
|
|
3109
|
+
tails = emitStep(step, tails, scope, parentId, () => { applyUpdates(step); applyLabel(step); applyErrorHandle(step, scope.stepNodeId.get(step.name)); });
|
|
3096
3110
|
refuseUnknownStepOptions(scope, step);
|
|
3097
3111
|
lastAction = step.name;
|
|
3098
3112
|
// A fan-out human task's `action: 'End'` outcomes end the run here: the
|
|
@@ -3419,6 +3433,7 @@ function serializeFlow(built, opts, scopeLayout) {
|
|
|
3419
3433
|
...(v24 || 'breakEnabled' in declared ? { breakEnabled: (o.breakEnabled ?? false) || usesBreak } : {}),
|
|
3420
3434
|
};
|
|
3421
3435
|
scope.nodes.push(node);
|
|
3436
|
+
applyErrorHandle(step, id);
|
|
3422
3437
|
for (const t of tails)
|
|
3423
3438
|
addEdge(scope, t, id);
|
|
3424
3439
|
const bodyPort = v24 ? 'start' : 'output';
|
|
@@ -3440,6 +3455,7 @@ function serializeFlow(built, opts, scopeLayout) {
|
|
|
3440
3455
|
breakEnabled: (o.breakEnabled ?? false) || usesBreak,
|
|
3441
3456
|
};
|
|
3442
3457
|
scope.nodes.push(node);
|
|
3458
|
+
applyErrorHandle(step, id);
|
|
3443
3459
|
for (const t of tails)
|
|
3444
3460
|
addEdge(scope, t, id);
|
|
3445
3461
|
const bodyTails = emit(step.body, [{ node: id, port: 'start' }], scope, id, { node: id, break: 'break', continue: 'continue' });
|
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.4",
|
|
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": "01e5f01259040b55ae22a4a59762834dfc0ea2e4"
|
|
131
131
|
}
|