@uipath/maestro-builder-sdk 6.122.8 → 6.122.10
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 +78 -77
- package/dist/api-members.md +357 -354
- package/dist/bpmn/bpmn-sdk.d.ts +48 -4
- package/dist/bpmn/bpmn-sdk.js +43 -5
- package/dist/bpmn/decompile.js +96 -2
- package/dist/bpmn/serialize.js +37 -2
- package/dist/bpmn/task-elements.d.ts +2 -0
- package/dist/bpmn/task-elements.js +4 -0
- package/dist/bpmn/typed-node.d.ts +2 -0
- package/dist/bpmn/typed-node.js +2 -1
- package/dist/bpmn-api.md +23 -7
- package/dist/core/js-code-spans.d.ts +0 -19
- package/dist/core/js-code-spans.js +94 -7
- package/dist/core/refusals.d.ts +1 -0
- package/dist/core/refusals.js +1 -0
- package/dist/decompile.js +85 -1
- package/package.json +2 -2
package/dist/bpmn-api.md
CHANGED
|
@@ -160,6 +160,8 @@ What every boundary handler on an ActivityBuilder accepts — `.onError()`, `.on
|
|
|
160
160
|
|
|
161
161
|
Options for `.startEvent()`.
|
|
162
162
|
|
|
163
|
+
Extends `VariableUpdatesOpts` — its fields and methods apply here too.
|
|
164
|
+
|
|
163
165
|
- `StartOpts.name?: string` — Display name the designer shows on the event.
|
|
164
166
|
- `StartOpts.message?: MessageLike` — Start when this message arrives — declares/reuses a definitions-level `bpmn:message`; `NO_MESSAGE` for none — see…
|
|
165
167
|
- `StartOpts.error?: ErrorLike` — Catch an error — an INTERRUPTING error start event (`bpmn:errorEventDefinition`), declaring/reusing a definitions-level…
|
|
@@ -173,6 +175,8 @@ Options for `.startEvent()`.
|
|
|
173
175
|
|
|
174
176
|
Options for `.endEvent()`.
|
|
175
177
|
|
|
178
|
+
Extends `VariableUpdatesOpts` — its fields and methods apply here too.
|
|
179
|
+
|
|
176
180
|
- `EndOpts.name?: string` — Display name the designer shows on the event.
|
|
177
181
|
- `EndOpts.terminate?: boolean` — End as a TERMINATE event — abort the whole process instance, not just this path.
|
|
178
182
|
- `EndOpts.message?: MessageLike` — End by throwing this message — declares/reuses a definitions-level `bpmn:message`; `NO_MESSAGE` for none — see…
|
|
@@ -399,6 +403,7 @@ Extends `ActivityOpts` — its fields and methods apply here too.
|
|
|
399
403
|
- `ActivityNodeOpts.inputs?: Record<string, unknown>` — The payload, shaped by the type's `inputPattern`.
|
|
400
404
|
- `ActivityNodeOpts.inputRows?: TypedInputRow[]` — The payload rows spelled out, replacing `inputs` — see TypedInputRow.
|
|
401
405
|
- `ActivityNodeOpts.spec?: RegistryTypeSpec` — The type's emission spec, supplied inline — the escape hatch for a registry type the committed snapshot does not carry…
|
|
406
|
+
- `ActivityNodeOpts.element?: PlainTaskElement` — The task element to write instead of the registry's, spelled as the XML is (`bpmn:serviceTask`).
|
|
402
407
|
- `ActivityNodeOpts.outputVar?: string` — Variable the type's own output lands in.
|
|
403
408
|
- `ActivityNodeOpts.outputs?: Record<string, string>` — Extra output rows: variable id → `=`-expression against the node's result.
|
|
404
409
|
- `ActivityNodeOpts.outputRows?: TypedOutputRow[]` — The output rows spelled out, replacing `outputVar` and `outputs`.
|
|
@@ -471,10 +476,19 @@ Options for `.var()` / `.input()` / `.output()`.
|
|
|
471
476
|
- `VarOpts.internal?: boolean` — The product's `internal="true"` flag: the platform owns this declaration, not the author — `internalCustomInstanceId`…
|
|
472
477
|
- `VarOpts.subType?: string` — A refinement of `type` the designer carries, e.g. `subType="object"` on a `jsonSchema` variable that holds an object…
|
|
473
478
|
|
|
479
|
+
### `VariableUpdatesOpts`
|
|
480
|
+
|
|
481
|
+
Variable updates on a node: the product's trailing `uipath:mapping` (`BPMN.Variables`, every row `custom="true"`) that…
|
|
482
|
+
|
|
483
|
+
- `VariableUpdatesOpts.updates?: Record<string, string>` — variable id -> the `=`-expression assigned to it after the node runs.
|
|
484
|
+
- `VariableUpdatesOpts.updateRows?: TypedOutputRow[]` — The update rows spelled out, in document order: what an import writes, so each row's own `type` and attributes survive.
|
|
485
|
+
|
|
474
486
|
### `ActivityOpts`
|
|
475
487
|
|
|
476
488
|
What every ACTIVITY accepts, on top of its own options — a script task, a variable task, a connector task, a…
|
|
477
489
|
|
|
490
|
+
Extends `VariableUpdatesOpts` — its fields and methods apply here too.
|
|
491
|
+
|
|
478
492
|
- `ActivityOpts.tags?: Record<string, string>` — `uipath:tags` on the activity — key/value pairs the designer carries alongside the node, as a SIBLING of its payload.
|
|
479
493
|
- `ActivityOpts.retry?: RetrySpec` — Retry the activity when it fails — see RetrySpec.
|
|
480
494
|
- `ActivityOpts.loop?: LoopSpec` — Run it once per item of a collection — see LoopSpec.
|
|
@@ -611,7 +625,7 @@ The built in-memory process graph `.build()` returns — the IR `serialize()` wa
|
|
|
611
625
|
|
|
612
626
|
One node in the built graph — a discriminated union with one arm per BPMN element kind, which the serializer walks into…
|
|
613
627
|
|
|
614
|
-
- `type BpmnNode` —
|
|
628
|
+
- `type BpmnNode` — 2799 characters; read it in the declaration ([`api-index.md`](api-index.md) has the span).
|
|
615
629
|
|
|
616
630
|
### `BpmnFlow`
|
|
617
631
|
|
|
@@ -878,6 +892,8 @@ The five gateway element kinds a BpmnNode can be.
|
|
|
878
892
|
|
|
879
893
|
The fields every activity arm of BpmnNode carries — the built form of ActivityOpts.
|
|
880
894
|
|
|
895
|
+
Extends `VariableUpdatesOpts` — its fields and methods apply here too.
|
|
896
|
+
|
|
881
897
|
- `ActivityNodeFields.tags?: Record<string, string>` — `uipath:tags` on the node — see ActivityOpts.tags.
|
|
882
898
|
- `ActivityNodeFields.retry?: RetrySpec` — Retry policy (`uipath:retry`).
|
|
883
899
|
- `ActivityNodeFields.loop?: LoopSpec` — Multi-instance loop (`bpmn:multiInstanceLoopCharacteristics` + `uipath:loopCharacteristics`).
|
|
@@ -952,6 +968,12 @@ One extension type's emission spec.
|
|
|
952
968
|
- `RegistryTypeSpec.bindingPattern: string`
|
|
953
969
|
- `RegistryTypeSpec.placements?: Record<string, { element: string | null; eventDefinition: string | null }>` — The registry's `Placements`: where the canvas offers the type, by placement name (`Activity`, `StartEvent`,…
|
|
954
970
|
|
|
971
|
+
### `PlainTaskElement`
|
|
972
|
+
|
|
973
|
+
The BPMN activity elements the builder can write with NO `uipath:*` payload.
|
|
974
|
+
|
|
975
|
+
- `type PlainTaskElement` — 181 characters; read it in the declaration ([`api-index.md`](api-index.md) has the span).
|
|
976
|
+
|
|
955
977
|
### `EventFilter`
|
|
956
978
|
|
|
957
979
|
One filter condition on the event payload.
|
|
@@ -960,12 +982,6 @@ Also takes every field of `({ contains: string; } | { startsWith: string; } | {
|
|
|
960
982
|
|
|
961
983
|
- `EventFilter.field: string`
|
|
962
984
|
|
|
963
|
-
### `PlainTaskElement`
|
|
964
|
-
|
|
965
|
-
The BPMN activity elements the builder can write with NO `uipath:*` payload.
|
|
966
|
-
|
|
967
|
-
- `type PlainTaskElement` — 181 characters; read it in the declaration ([`api-index.md`](api-index.md) has the span).
|
|
968
|
-
|
|
969
985
|
### `VarDirection`
|
|
970
986
|
|
|
971
987
|
How a variable is exposed: `'input'` (read-only entry input), `'output'` (a return value), or `'inputOutput'` (a mutable…
|
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The parts of a JavaScript expression or script body that are code.
|
|
3
|
-
*
|
|
4
|
-
* Short version: `$vars.summary` inside a quoted string is text, not a read.
|
|
5
|
-
* A rewrite that renames `$vars.<name>` (a step's node id, an output's backing
|
|
6
|
-
* Variable, #1092) must leave string literals, comments and regex literals
|
|
7
|
-
* alone, or it changes what the flow does:
|
|
8
|
-
*
|
|
9
|
-
* ```js
|
|
10
|
-
* return "$vars.summary" + $vars.summary;
|
|
11
|
-
* // ^^^^^^^^^^^^^^^ text: kept ^^^^^^^^^^^^^ code: renamed
|
|
12
|
-
* ```
|
|
13
|
-
*
|
|
14
|
-
* A template literal's text is kept too, and its `${…}` holes are code.
|
|
15
|
-
*
|
|
16
|
-
* This is a scanner, not a parser. It tells a regex literal from a division by
|
|
17
|
-
* the character before the `/` (the usual heuristic), so `return /"/` is read
|
|
18
|
-
* as a division. Nothing in a flow's expressions depends on that case.
|
|
19
|
-
*/
|
|
20
1
|
/**
|
|
21
2
|
* `text` with `fn` applied to each run of code, and every string, template
|
|
22
3
|
* text, comment and regex literal copied as written.
|
|
@@ -13,17 +13,86 @@
|
|
|
13
13
|
*
|
|
14
14
|
* A template literal's text is kept too, and its `${…}` holes are code.
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
16
|
+
* The spans come from a parse (acorn, as the BPMN and Case checks read
|
|
17
|
+
* JavaScript), so a `/` is a regex or a division exactly as the language says:
|
|
18
|
+
* `if (x) /re/.test(s)` and `return /re/` open a regex, `πreturn / 2` and
|
|
19
|
+
* `obj. return / 2` divide. Text that parses neither as a script body nor as an
|
|
20
|
+
* expression (a fragment, a typo) falls back to {@link scanJsCode}, a scanner
|
|
21
|
+
* that judges a `/` by the token before it.
|
|
19
22
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
import { parse } from 'acorn';
|
|
24
|
+
/** Non-code `[start, end)` spans of `text` from a parse, or undefined when it parses neither as a script body nor as an expression. */
|
|
25
|
+
function literalSpans(text) {
|
|
26
|
+
// An expression that is not a statement (`{ "a": 1 }`) parses inside parentheses.
|
|
27
|
+
for (const [prefix, suffix] of [['', ''], ['(', '\n)']]) {
|
|
28
|
+
const spans = [];
|
|
29
|
+
const src = prefix + text + suffix;
|
|
30
|
+
const at = (start, end) => {
|
|
31
|
+
const from = Math.max(start - prefix.length, 0);
|
|
32
|
+
const to = Math.min(end - prefix.length, text.length);
|
|
33
|
+
if (to > from)
|
|
34
|
+
spans.push([from, to]);
|
|
35
|
+
};
|
|
36
|
+
try {
|
|
37
|
+
parse(src, {
|
|
38
|
+
ecmaVersion: 'latest', sourceType: 'script',
|
|
39
|
+
allowReturnOutsideFunction: true, allowAwaitOutsideFunction: true,
|
|
40
|
+
onToken: (t) => {
|
|
41
|
+
const label = t.type.label;
|
|
42
|
+
if (label === 'string' || label === 'regexp' || label === 'template' || label === 'invalidTemplate')
|
|
43
|
+
at(t.start, t.end);
|
|
44
|
+
},
|
|
45
|
+
onComment: (_block, _text, start, end) => at(start, end),
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
return spans.sort((a, b) => a[0] - b[0]);
|
|
52
|
+
}
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
22
55
|
/**
|
|
23
56
|
* `text` with `fn` applied to each run of code, and every string, template
|
|
24
57
|
* text, comment and regex literal copied as written.
|
|
25
58
|
*/
|
|
26
59
|
export function mapJsCode(text, fn) {
|
|
60
|
+
// Every literal and comment opens with one of these: text with none is all code, and needs no parse.
|
|
61
|
+
if (!/["'`/]/.test(text))
|
|
62
|
+
return fn(text);
|
|
63
|
+
const spans = literalSpans(text);
|
|
64
|
+
if (spans === undefined)
|
|
65
|
+
return scanJsCode(text, fn);
|
|
66
|
+
let out = '';
|
|
67
|
+
let i = 0;
|
|
68
|
+
for (const [from, to] of spans) {
|
|
69
|
+
if (from < i)
|
|
70
|
+
continue;
|
|
71
|
+
if (from > i)
|
|
72
|
+
out += fn(text.slice(i, from));
|
|
73
|
+
out += text.slice(from, to);
|
|
74
|
+
i = to;
|
|
75
|
+
}
|
|
76
|
+
if (i < text.length)
|
|
77
|
+
out += fn(text.slice(i));
|
|
78
|
+
return out;
|
|
79
|
+
}
|
|
80
|
+
/** Characters after which a `/` starts a regex literal, not a division. */
|
|
81
|
+
const REGEX_AFTER = new Set('(,=:[!&|?{};+-*%<>~^'.split(''));
|
|
82
|
+
/** Keywords after which a `/` starts a regex literal: what follows them is an operand. */
|
|
83
|
+
const REGEX_AFTER_KEYWORD = new Set([
|
|
84
|
+
'return', 'typeof', 'instanceof', 'in', 'of', 'new', 'delete', 'void', 'throw', 'case', 'do', 'else', 'yield', 'await',
|
|
85
|
+
]);
|
|
86
|
+
/** A character of an identifier or a number: a word token. */
|
|
87
|
+
const IDENT = /[\p{ID_Continue}$\u200c\u200d]/u;
|
|
88
|
+
/**
|
|
89
|
+
* {@link mapJsCode} for text that does not parse: a scanner, not a parser. It
|
|
90
|
+
* tells a regex literal from a division by the token before the `/`, across
|
|
91
|
+
* whitespace and comments: a punctuator, or a keyword that leaves an operand
|
|
92
|
+
* position (`return /"/`). A member name spelled like a keyword
|
|
93
|
+
* (`x.return / 2`) is an operand, so its `/` divides.
|
|
94
|
+
*/
|
|
95
|
+
function scanJsCode(text, fn) {
|
|
27
96
|
let out = '';
|
|
28
97
|
const n = text.length;
|
|
29
98
|
const flushCode = (from, to) => { if (to > from)
|
|
@@ -66,21 +135,36 @@ export function mapJsCode(text, fn) {
|
|
|
66
135
|
const scanCode = (i, inHole) => {
|
|
67
136
|
let start = i;
|
|
68
137
|
let depth = 0;
|
|
138
|
+
// The token before the next one, across whitespace and comments: `prev` is
|
|
139
|
+
// its last character; `keyword` says it is a REGEX_AFTER_KEYWORD word that
|
|
140
|
+
// is not a member name (`x.return`, `x?. return`).
|
|
69
141
|
let prev = '';
|
|
142
|
+
let keyword = false;
|
|
70
143
|
while (i < n) {
|
|
71
144
|
const c = text[i];
|
|
145
|
+
if (IDENT.test(c)) {
|
|
146
|
+
let j = i + 1;
|
|
147
|
+
while (j < n && IDENT.test(text[j]))
|
|
148
|
+
j++;
|
|
149
|
+
keyword = prev !== '.' && REGEX_AFTER_KEYWORD.has(text.slice(i, j));
|
|
150
|
+
prev = text[j - 1];
|
|
151
|
+
i = j;
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
72
154
|
if (c === '"' || c === "'") {
|
|
73
155
|
flushCode(start, i);
|
|
74
156
|
const j = endQuoted(i, c);
|
|
75
157
|
out += text.slice(i, j);
|
|
76
158
|
i = start = j;
|
|
77
159
|
prev = c;
|
|
160
|
+
keyword = false;
|
|
78
161
|
continue;
|
|
79
162
|
}
|
|
80
163
|
if (c === '`') {
|
|
81
164
|
flushCode(start, i);
|
|
82
165
|
i = start = scanTemplate(i);
|
|
83
166
|
prev = c;
|
|
167
|
+
keyword = false;
|
|
84
168
|
continue;
|
|
85
169
|
}
|
|
86
170
|
if (c === '/' && (text[i + 1] === '/' || text[i + 1] === '*')) {
|
|
@@ -91,12 +175,13 @@ export function mapJsCode(text, fn) {
|
|
|
91
175
|
i = start = j;
|
|
92
176
|
continue;
|
|
93
177
|
}
|
|
94
|
-
if (c === '/' && (prev === '' || REGEX_AFTER.has(prev))) {
|
|
178
|
+
if (c === '/' && (prev === '' || REGEX_AFTER.has(prev) || keyword)) {
|
|
95
179
|
flushCode(start, i);
|
|
96
180
|
const j = endRegex(i);
|
|
97
181
|
out += text.slice(i, j);
|
|
98
182
|
i = start = j;
|
|
99
183
|
prev = '/';
|
|
184
|
+
keyword = false;
|
|
100
185
|
continue;
|
|
101
186
|
}
|
|
102
187
|
if (inHole) {
|
|
@@ -110,8 +195,10 @@ export function mapJsCode(text, fn) {
|
|
|
110
195
|
depth--;
|
|
111
196
|
}
|
|
112
197
|
}
|
|
113
|
-
if (!/\s/.test(c))
|
|
198
|
+
if (!/\s/.test(c)) {
|
|
114
199
|
prev = c;
|
|
200
|
+
keyword = false;
|
|
201
|
+
}
|
|
115
202
|
i++;
|
|
116
203
|
}
|
|
117
204
|
flushCode(start, i);
|
package/dist/core/refusals.d.ts
CHANGED
|
@@ -66,6 +66,7 @@ export declare const REFUSALS: {
|
|
|
66
66
|
readonly BINDING_UNDECLARED: "draft";
|
|
67
67
|
readonly BOUNDARY_NOT_ACTIVITY: "lint";
|
|
68
68
|
readonly BOUNDARY_UNATTACHED: "lowering";
|
|
69
|
+
readonly BPMN_ACTIVITY_ELEMENT_INVALID: "lowering";
|
|
69
70
|
readonly BPMN_ACTIVITY_SCRIPT_TASK_TYPE: "lowering";
|
|
70
71
|
readonly BPMN_BINDING_READ_BEFORE_DECLARED: "lowering";
|
|
71
72
|
readonly BPMN_BINDING_RESOURCE_KEY_CONFLICT: "lowering";
|
package/dist/core/refusals.js
CHANGED
|
@@ -115,6 +115,7 @@ export const REFUSALS = {
|
|
|
115
115
|
BINDING_UNDECLARED: 'draft',
|
|
116
116
|
BOUNDARY_NOT_ACTIVITY: 'lint',
|
|
117
117
|
BOUNDARY_UNATTACHED: 'lowering',
|
|
118
|
+
BPMN_ACTIVITY_ELEMENT_INVALID: 'lowering',
|
|
118
119
|
BPMN_ACTIVITY_SCRIPT_TASK_TYPE: 'lowering',
|
|
119
120
|
BPMN_BINDING_READ_BEFORE_DECLARED: 'lowering',
|
|
120
121
|
BPMN_BINDING_RESOURCE_KEY_CONFLICT: 'lowering',
|
package/dist/decompile.js
CHANGED
|
@@ -3064,6 +3064,8 @@ function renameVarRoot(v, from, to) {
|
|
|
3064
3064
|
const inCode = (js) => mapJsCode(js, (code) => code.replace(re, () => `$vars.${to}`));
|
|
3065
3065
|
const walk = (x, key) => {
|
|
3066
3066
|
if (typeof x === 'string') {
|
|
3067
|
+
if (!x.includes(`$vars.${from}`))
|
|
3068
|
+
return x;
|
|
3067
3069
|
if (x.startsWith('=js:'))
|
|
3068
3070
|
return '=js:' + inCode(x.slice(4));
|
|
3069
3071
|
if (x.startsWith('$vars.') || (key !== undefined && RAW_JS_FIELDS.has(key)))
|
|
@@ -3126,8 +3128,90 @@ function foldOutputBacking(flow) {
|
|
|
3126
3128
|
}
|
|
3127
3129
|
return out;
|
|
3128
3130
|
}
|
|
3131
|
+
/**
|
|
3132
|
+
* Read a flow input the file left process-level (an `in` global with no
|
|
3133
|
+
* `triggerNodeId`) through the trigger compile will bind it to.
|
|
3134
|
+
*
|
|
3135
|
+
* `.input()` declares a trigger-scoped input: compile stamps `triggerNodeId`
|
|
3136
|
+
* on every one it writes (the root trigger, or a subflow body's own Start), and
|
|
3137
|
+
* the runtime then surfaces it only as `$vars.<trigger>.output.<name>`. The
|
|
3138
|
+
* source has no spelling for a process-level input, so a bare `$vars.<name>`
|
|
3139
|
+
* read of one must move to the trigger's output with it, or the recompiled
|
|
3140
|
+
* file reads null under any trigger but a manual one (`flow validate` refuses
|
|
3141
|
+
* it). A read that is the whole value already came back as `input('<name>')`;
|
|
3142
|
+
* one inside a larger expression (`$vars.n * 4`) or a script kept the bare
|
|
3143
|
+
* spelling, so a no-edit round trip changed what the flow reads.
|
|
3144
|
+
*
|
|
3145
|
+
* Rewritten in code spans of code slots only (`renameInputReads`), in the
|
|
3146
|
+
* nodes and the variable updates, before anything is printed: the whole-value reads then
|
|
3147
|
+
* print as `input('<name>')` as before, and the rest as the trigger-output
|
|
3148
|
+
* path. A name a node of the scope also has is that node's (validate reads it
|
|
3149
|
+
* so too) and is left alone. Applied to each subflow body against its own
|
|
3150
|
+
* Start.
|
|
3151
|
+
*/
|
|
3152
|
+
function bindProcessInputReads(flow) {
|
|
3153
|
+
const subflows = flow.subflows
|
|
3154
|
+
? Object.fromEntries(Object.entries(flow.subflows).map(([k, c]) => [k, bindProcessInputReads(c)]))
|
|
3155
|
+
: undefined;
|
|
3156
|
+
let out = subflows ? { ...flow, subflows } : flow;
|
|
3157
|
+
const globals = Array.isArray(flow.variables?.globals) ? flow.variables.globals : [];
|
|
3158
|
+
const nodes = Array.isArray(flow.nodes) ? flow.nodes : [];
|
|
3159
|
+
const nodeIds = new Set(nodes.map((n) => n.id));
|
|
3160
|
+
const unscoped = globals.filter((g) => g.direction === 'in' && typeof g.id === 'string' && g.id !== ''
|
|
3161
|
+
&& (g.triggerNodeId === undefined || g.triggerNodeId === '') && !nodeIds.has(g.id));
|
|
3162
|
+
if (unscoped.length === 0)
|
|
3163
|
+
return out;
|
|
3164
|
+
// The default root, chosen as `decompile` chooses the one `.input()` binds to.
|
|
3165
|
+
const targets = new Set((flow.edges ?? []).map((e) => e.targetNodeId));
|
|
3166
|
+
const roots = nodes.filter((n) => typeof n.type === 'string' && isTrigger(n.type) && !targets.has(n.id));
|
|
3167
|
+
const trigger = roots.find((n) => (n.inputs ?? {}).isDefaultEntryPoint === true)
|
|
3168
|
+
?? roots.find((n) => n.id === DEFAULT_TRIGGER_ID)
|
|
3169
|
+
?? roots[0];
|
|
3170
|
+
if (trigger === undefined)
|
|
3171
|
+
return out;
|
|
3172
|
+
let rewritten = out.nodes;
|
|
3173
|
+
let updates = out.variables?.variableUpdates;
|
|
3174
|
+
for (const g of unscoped) {
|
|
3175
|
+
rewritten = renameInputReads(rewritten, g.id, `${trigger.id}.output.${g.id}`);
|
|
3176
|
+
updates = renameInputReads(updates, g.id, `${trigger.id}.output.${g.id}`);
|
|
3177
|
+
}
|
|
3178
|
+
out = { ...out, nodes: rewritten, variables: { ...out.variables, ...(updates !== undefined ? { variableUpdates: updates } : {}) } };
|
|
3179
|
+
return out;
|
|
3180
|
+
}
|
|
3181
|
+
/**
|
|
3182
|
+
* `renameVarRoot`, held to the slots that hold code: a `=js:` value anywhere,
|
|
3183
|
+
* and a value under a `RAW_JS_FIELDS` key or an output's `source`. A label, a
|
|
3184
|
+
* description or any other text that happens to start `$vars.` is data, and so
|
|
3185
|
+
* is a literal envelope and everything under a node's `display` and `ui`.
|
|
3186
|
+
*/
|
|
3187
|
+
function renameInputReads(v, from, to) {
|
|
3188
|
+
const re = new RegExp(`\\$vars\\.${escapeRegExp(from)}(?![A-Za-z0-9_$])`, 'g');
|
|
3189
|
+
// a function: `$&` in `to` is data
|
|
3190
|
+
const inCode = (js) => mapJsCode(js, (code) => code.replace(re, () => `$vars.${to}`));
|
|
3191
|
+
const walk = (x, key) => {
|
|
3192
|
+
if (typeof x === 'string') {
|
|
3193
|
+
if (!x.includes(`$vars.${from}`))
|
|
3194
|
+
return x;
|
|
3195
|
+
if (x.startsWith('=js:'))
|
|
3196
|
+
return '=js:' + inCode(x.slice(4));
|
|
3197
|
+
if (key !== undefined && (RAW_JS_FIELDS.has(key) || key === 'source'))
|
|
3198
|
+
return inCode(x);
|
|
3199
|
+
return x;
|
|
3200
|
+
}
|
|
3201
|
+
if (Array.isArray(x))
|
|
3202
|
+
return x.map((y) => walk(y, key));
|
|
3203
|
+
if (x && typeof x === 'object') {
|
|
3204
|
+
// A literal envelope's `expression` is its text, not code.
|
|
3205
|
+
if (x.type === 'literal')
|
|
3206
|
+
return x;
|
|
3207
|
+
return Object.fromEntries(Object.entries(x).map(([k, y]) => [k, k === 'display' || k === 'ui' ? y : walk(y, k)]));
|
|
3208
|
+
}
|
|
3209
|
+
return x;
|
|
3210
|
+
};
|
|
3211
|
+
return walk(v);
|
|
3212
|
+
}
|
|
3129
3213
|
export function decompile(flow, options = {}) {
|
|
3130
|
-
flow = foldOutputBacking(flow);
|
|
3214
|
+
flow = bindProcessInputReads(foldOutputBacking(flow));
|
|
3131
3215
|
runScripts = options.scripts ?? defaultScripts();
|
|
3132
3216
|
runModuleFunctions = [];
|
|
3133
3217
|
runFunctionNames = new Map();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/maestro-builder-sdk",
|
|
3
|
-
"version": "6.122.
|
|
3
|
+
"version": "6.122.10",
|
|
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",
|
|
@@ -126,5 +126,5 @@
|
|
|
126
126
|
"@types/node": "^22.7.0",
|
|
127
127
|
"esbuild": "^0.28.1"
|
|
128
128
|
},
|
|
129
|
-
"gitref": "
|
|
129
|
+
"gitref": "3464553851157aa8f62eb57613f8be59527aaf5d"
|
|
130
130
|
}
|