@uipath/maestro-builder-sdk 6.86.1 → 6.86.3
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/README.md +7 -5
- package/dist/api-index.md +78 -78
- package/dist/api-members.md +341 -341
- package/dist/bpmn/bpmn-expr-check.js +15 -3
- package/dist/bpmn/bpmn-sdk.d.ts +8 -2
- package/dist/bpmn/check.js +9 -1
- package/dist/check.js +20 -1
- package/dist/flow-expr-check.d.ts +28 -5
- package/dist/flow-expr-check.js +57 -30
- package/dist/flow-sdk.d.ts +3 -1
- package/dist/flow-sdk.js +8 -9
- package/dist/serialize.js +20 -0
- package/package.json +2 -2
|
@@ -55,10 +55,22 @@ function checkExpr(expr, where, roots, out) {
|
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* Check every `=`-expression VALUE of a `field → expression` map (keys are targets).
|
|
60
|
+
*
|
|
61
|
+
* A value need not be a string. A script task's `inputs` are the keys of its `args`
|
|
62
|
+
* JSON body, and the designer nests objects there (`{"args":{"name":"=vars.x"}}`), so
|
|
63
|
+
* a nested value is walked for the `=`-strings inside it, as a connector's inputs are.
|
|
64
|
+
* Handing it to `checkExpr` as if it were a string is what crashed `build()` with
|
|
65
|
+
* `expr.replace is not a function` on six deployed processes.
|
|
66
|
+
*/
|
|
59
67
|
function checkExprValues(rec, where, roots, out) {
|
|
60
|
-
for (const v of Object.values(rec ?? {}))
|
|
61
|
-
|
|
68
|
+
for (const v of Object.values(rec ?? {})) {
|
|
69
|
+
if (typeof v === 'string')
|
|
70
|
+
checkExpr(v, where, roots, out);
|
|
71
|
+
else
|
|
72
|
+
deepExprStrings(v, where, roots, out);
|
|
73
|
+
}
|
|
62
74
|
}
|
|
63
75
|
/** Reach `=`-expression strings anywhere in a connector's (possibly nested) inputs. */
|
|
64
76
|
function deepExprStrings(val, where, roots, out) {
|
package/dist/bpmn/bpmn-sdk.d.ts
CHANGED
|
@@ -138,7 +138,8 @@ export type BpmnNode = {
|
|
|
138
138
|
scriptFormat: string;
|
|
139
139
|
/** The `uipath:scriptVersion` value — see {@link ScriptTaskOpts.scriptVersion}. */
|
|
140
140
|
scriptVersion: string;
|
|
141
|
-
inputs
|
|
141
|
+
/** The `args` keys after the envelope — see {@link ScriptTaskOpts.inputs}. */
|
|
142
|
+
inputs: Record<string, unknown>;
|
|
142
143
|
outputs: Record<string, string>;
|
|
143
144
|
/** The mapping's extension type — see {@link ScriptTaskOpts.type}. */
|
|
144
145
|
type: string;
|
|
@@ -929,8 +930,13 @@ export interface ScriptTaskOpts extends ActivityOpts {
|
|
|
929
930
|
* `"iterator[0]":"=iterator[0]"` to scope a loop body — and for a key the author
|
|
930
931
|
* knows the runtime reads. `vars` and `metadata` given here override the envelope's
|
|
931
932
|
* values, which is never useful but keeps a round trip byte-faithful.
|
|
933
|
+
*
|
|
934
|
+
* A value is any JSON value, not only a string: `args` is a JSON body, and the
|
|
935
|
+
* designer writes nested objects into it (`{"args":{"name":"=vars.Var_Name"}}`).
|
|
936
|
+
* Every `=`-string inside a nested value is an expression and is checked like a
|
|
937
|
+
* top-level one.
|
|
932
938
|
*/
|
|
933
|
-
inputs?: Record<string,
|
|
939
|
+
inputs?: Record<string, unknown>;
|
|
934
940
|
/**
|
|
935
941
|
* `uipath:output` rows: variable id → `=`-expression.
|
|
936
942
|
*
|
package/dist/bpmn/check.js
CHANGED
|
@@ -992,6 +992,14 @@ function isRuntimeDuration(v) {
|
|
|
992
992
|
}
|
|
993
993
|
/** The `args` keys the platform itself writes and injects — not an author's inputs. */
|
|
994
994
|
const SCRIPT_ENVELOPE_KEYS = new Set(['vars', 'metadata', 'iterator']);
|
|
995
|
+
/**
|
|
996
|
+
* What the SCRIPT_BARE_INPUT_REF message suggests reading instead of a bare `inputs`
|
|
997
|
+
* key: the key's expression without its `=`. An `args` value can be any JSON value
|
|
998
|
+
* (the designer nests objects there), so a non-string one is shown as JSON.
|
|
999
|
+
*/
|
|
1000
|
+
function bareInputHint(value) {
|
|
1001
|
+
return typeof value === 'string' ? value.replace(/^=/, '') : JSON.stringify(value);
|
|
1002
|
+
}
|
|
995
1003
|
/**
|
|
996
1004
|
* Whether a script body mentions `name` as a bare identifier — not after `.` (a property
|
|
997
1005
|
* read such as `vars.amount`), not inside a string or comment. The body is otherwise not
|
|
@@ -1045,7 +1053,7 @@ function checkActivityFields(n, diags) {
|
|
|
1045
1053
|
message: `Script task "${n.id}" reads ${bare.map((k) => `\`${k}\``).join(', ')} as a bare identifier, but the platform ` +
|
|
1046
1054
|
`injects only \`vars\`, \`metadata\` and \`iterator\` into a script's scope — on the cloud this faults with ` +
|
|
1047
1055
|
`\`${bare[0]} is not defined\` after check, compile and validate have all passed. ` +
|
|
1048
|
-
`Read the variable as \`vars.<id>\` (${bare.map((k) => `\`${n.inputs[k]
|
|
1056
|
+
`Read the variable as \`vars.<id>\` (${bare.map((k) => `\`${bareInputHint(n.inputs[k])}\``).join(', ')}) and drop the \`inputs\` entry.`,
|
|
1049
1057
|
where: n.id,
|
|
1050
1058
|
});
|
|
1051
1059
|
}
|
package/dist/check.js
CHANGED
|
@@ -3,7 +3,7 @@ import { FlowNode } from './core/node-classes.js';
|
|
|
3
3
|
import { definitionHasErrorPort } from './core/error-port.js';
|
|
4
4
|
import { bundledDefinition, resolveContributionDefinition, serialize } from './serialize.js';
|
|
5
5
|
import { checkEventResolution, checkEventSubscription, eventParamsFor, } from './core/event-checks.js';
|
|
6
|
-
import { checkCookedEscapes } from './flow-expr-check.js';
|
|
6
|
+
import { checkCookedEscapes, checkFlowExpressions } from './flow-expr-check.js';
|
|
7
7
|
import { FLOW_EXPR_DIALECT, checkBindingLabels, checkConnectorLookups as coreCheckConnectorLookups, checkConnectorResources as coreCheckConnectorResources, checkConnectorSchema as coreCheckConnectorSchema, } from './core/connector-checks.js';
|
|
8
8
|
import { nearestName } from './core/edit-distance.js';
|
|
9
9
|
import { escapeRegExp } from './core/escape-regexp.js';
|
|
@@ -983,6 +983,22 @@ function checkFlow(built, ancestors, opts = {}) {
|
|
|
983
983
|
flag(m[1], m[0], m[3]);
|
|
984
984
|
}
|
|
985
985
|
}
|
|
986
|
+
// An expression reading a name nothing declares (EXPR_UNDECLARED_REF). It is
|
|
987
|
+
// `lint`: `compile` writes the read as authored, so `check` is where it is
|
|
988
|
+
// found. The `lowering` expression codes (EXPR_SYNTAX) come from the
|
|
989
|
+
// serializer's collect mode instead, so they are not repeated here.
|
|
990
|
+
const exprReported = new Set();
|
|
991
|
+
for (const d of checkFlowExpressions(built)) {
|
|
992
|
+
if (d.level !== 'error' || refusalClass(d.code) !== 'lint')
|
|
993
|
+
continue;
|
|
994
|
+
diags.push({
|
|
995
|
+
level: 'error', code: d.code, message: `In ${d.where}: ${d.message}`,
|
|
996
|
+
...(d.step !== undefined ? { step: d.step } : {}),
|
|
997
|
+
...(d.suggestion ? { suggestion: d.suggestion } : {}),
|
|
998
|
+
});
|
|
999
|
+
if (d.step !== undefined && d.root !== undefined)
|
|
1000
|
+
exprReported.add(`${d.step}\n${d.root}`);
|
|
1001
|
+
}
|
|
986
1002
|
// Check $vars.<name>[.<field>] references resolve to a declared name or step.
|
|
987
1003
|
const inputNames = new Set(built.inputs.map((x) => x.name));
|
|
988
1004
|
for (const { js, step, errorSource } of exprs) {
|
|
@@ -999,6 +1015,9 @@ function checkFlow(built, ancestors, opts = {}) {
|
|
|
999
1015
|
// `?.` reads the same path as `.`, and the rules below parse the tail as `.a.b`.
|
|
1000
1016
|
const rest = m[3].replace(/\?\./g, '.');
|
|
1001
1017
|
if (!declared.has(name)) {
|
|
1018
|
+
// The same read EXPR_UNDECLARED_REF reported above: one finding, not two.
|
|
1019
|
+
if (exprReported.has(`${step}\n${name}`))
|
|
1020
|
+
continue;
|
|
1002
1021
|
const near = [...declared].find((d) => d.toLowerCase() === name.toLowerCase());
|
|
1003
1022
|
diags.push({
|
|
1004
1023
|
level: 'error',
|
|
@@ -4,8 +4,20 @@ import { CompileRefusal } from './core/compile-refusal.js';
|
|
|
4
4
|
/** A diagnostic plus the node / field it was found in. */
|
|
5
5
|
export interface LocatedDiagnostic extends ExprDiagnostic {
|
|
6
6
|
where: string;
|
|
7
|
+
/**
|
|
8
|
+
* The step the expression sits on, as `check` names it (a `.return()` is
|
|
9
|
+
* `return`, or its `{ name }`). `where` words it for a message:
|
|
10
|
+
* `step "notify"`, or `return "total"` for one `.return()` value.
|
|
11
|
+
*/
|
|
12
|
+
step?: string;
|
|
13
|
+
/** EXPR_UNDECLARED_REF: the root nothing declares (`x` in `$vars.x.y`). */
|
|
14
|
+
root?: string;
|
|
7
15
|
}
|
|
8
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Every first-level expression problem in a built flow's own scope, each
|
|
18
|
+
* stamped with its location. A subflow's child flow is not visited: it is a
|
|
19
|
+
* scope of its own, which `check` and the serializer visit separately.
|
|
20
|
+
*/
|
|
9
21
|
export declare function checkFlowExpressions(built: BuiltFlow): LocatedDiagnostic[];
|
|
10
22
|
/**
|
|
11
23
|
* Every `js` template escape that changed what its expression means
|
|
@@ -19,15 +31,26 @@ export declare function checkFlowExpressions(built: BuiltFlow): LocatedDiagnosti
|
|
|
19
31
|
* from the built flow, child flows included: a new position cannot be missed.
|
|
20
32
|
*
|
|
21
33
|
* Only `meaning` effects are reported here. An escape that breaks the parse is
|
|
22
|
-
* named by EXPR_SYNTAX, which
|
|
34
|
+
* named by EXPR_SYNTAX, which the serializer refuses.
|
|
23
35
|
*/
|
|
24
36
|
export declare function checkCookedEscapes(built: BuiltFlow): (LocatedDiagnostic & {
|
|
25
37
|
step?: string;
|
|
26
38
|
})[];
|
|
27
39
|
/**
|
|
28
|
-
*
|
|
29
|
-
* `
|
|
30
|
-
*
|
|
40
|
+
* The expression problems `compile` refuses: every error whose code is
|
|
41
|
+
* `lowering` (`EXPR_SYNTAX`). The serializer throws a {@link FlowBuildError} on
|
|
42
|
+
* them, or reports each one in collect mode.
|
|
43
|
+
*/
|
|
44
|
+
export declare function loweringExpressionErrors(built: BuiltFlow): LocatedDiagnostic[];
|
|
45
|
+
/**
|
|
46
|
+
* Thrown by `serialize()` (so by `compile`) when an expression in the flow
|
|
47
|
+
* cannot be written: today only `EXPR_SYNTAX`, an expression that is not valid
|
|
48
|
+
* JavaScript. Its `message` lists every such problem (so a runner that prints
|
|
49
|
+
* `err.message` shows them all at once); `diagnostics` carries them structured
|
|
50
|
+
* for a caller that wants them.
|
|
51
|
+
*
|
|
52
|
+
* `build()` no longer throws it: an undeclared reference (`EXPR_UNDECLARED_REF`)
|
|
53
|
+
* is `lint`, which `check` reports and `compile` writes as authored.
|
|
31
54
|
*/
|
|
32
55
|
export declare class FlowBuildError extends CompileRefusal {
|
|
33
56
|
readonly diagnostics: LocatedDiagnostic[];
|
package/dist/flow-expr-check.js
CHANGED
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* flow-expr-check — the FLOW adapter over the shared, format-agnostic
|
|
3
|
-
* `core/expr-check
|
|
4
|
-
*
|
|
5
|
-
* every
|
|
6
|
-
* will provide.
|
|
3
|
+
* `core/expr-check`: a cheap first-level check that every `$vars.*` reference
|
|
4
|
+
* in an expression resolves to something the runtime will provide, and that
|
|
5
|
+
* every expression parses.
|
|
7
6
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
7
|
+
* WHERE EACH FINDING IS ENFORCED. The two codes have different classes
|
|
8
|
+
* (`core/refusals.ts`, docs/CHECK_COMPILE_CONTRACT_DESIGN.md §3.1):
|
|
9
|
+
*
|
|
10
|
+
* - `EXPR_UNDECLARED_REF` is `lint`. The serializer can write the read
|
|
11
|
+
* exactly as authored, so `compile` writes it and `check` reports it
|
|
12
|
+
* (`check.ts`). A brownfield `.flow` that already reads a name nothing
|
|
13
|
+
* declares (the designer allows it) still decompiles, compiles and merges.
|
|
14
|
+
* For example `$vars.manualTrigger1` in a flow whose trigger is `start`
|
|
15
|
+
* compiles to the same `$vars.manualTrigger1`; `check` names it.
|
|
16
|
+
* - `EXPR_SYNTAX` is `lowering`: an expression that does not parse has no
|
|
17
|
+
* correct `.flow`, so the serializer refuses it (`FlowBuildError`) and
|
|
18
|
+
* `check` reports it through collect mode.
|
|
19
|
+
*
|
|
20
|
+
* `build()` runs neither: it only assembles the graph, so every path that loads
|
|
21
|
+
* a flow (`check`, `merge`, decompile's lift) can still read one that has these
|
|
22
|
+
* problems.
|
|
18
23
|
*
|
|
19
24
|
* WHY IT ONLY CHECKS REFERENCE ROOTS. The rule is conservative on purpose: it
|
|
20
25
|
* flags only what it can be CERTAIN is wrong — a root that names no declared
|
|
@@ -23,12 +28,12 @@
|
|
|
23
28
|
* wrong offline, so they stay with the `validate` CLI. A first-level check that
|
|
24
29
|
* cried wolf would be worse than none.
|
|
25
30
|
*
|
|
26
|
-
* SCRIPT BODIES ARE NOT CHECKED
|
|
27
|
-
* body
|
|
28
|
-
* the same mechanism and a natural next step, deliberately out of this first cut.
|
|
31
|
+
* SCRIPT BODIES ARE NOT CHECKED HERE — only expressions (`Expr` values). A
|
|
32
|
+
* script body's `$vars.*` reads are `check.ts`'s UNKNOWN_REF.
|
|
29
33
|
*/
|
|
30
34
|
import { Expr, cookedEscapesOf } from './core/expr.js';
|
|
31
|
-
import { checkExpression, cookedEscapeDiagnostics } from './core/expr-check.js';
|
|
35
|
+
import { checkExpression, cookedEscapeDiagnostics, extractRefs } from './core/expr-check.js';
|
|
36
|
+
import { refusalClass } from './core/refusals.js';
|
|
32
37
|
import { stepDeclaredVariables } from './flow-step-variables.js';
|
|
33
38
|
import { CompileRefusal } from './core/compile-refusal.js';
|
|
34
39
|
const NOUN = 'input, variable, or step';
|
|
@@ -114,26 +119,31 @@ function addStepNames(steps, roots) {
|
|
|
114
119
|
}
|
|
115
120
|
}
|
|
116
121
|
}
|
|
117
|
-
function pushExpr(e,
|
|
122
|
+
function pushExpr(e, step, roots, out, where = `step "${step}"`) {
|
|
118
123
|
if (e.literal)
|
|
119
124
|
return; // a literal carries no reference to resolve
|
|
125
|
+
// `checkExpression` reports one EXPR_UNDECLARED_REF per undeclared root, in
|
|
126
|
+
// the order `extractRefs` finds them: that order names each finding's root.
|
|
127
|
+
const undeclared = [...new Set(extractRefs(e.js).map((r) => r.root).filter((r) => !roots.has(r)))];
|
|
128
|
+
let i = 0;
|
|
120
129
|
// The cooked escapes ride along so an EXPR_SYNTAX error can name the one that broke the parse.
|
|
121
130
|
for (const d of checkExpression(e.js, { roots, noun: NOUN, syntax: 'javascript' }, cookedEscapesOf(e))) {
|
|
122
|
-
|
|
131
|
+
const root = d.code === 'EXPR_UNDECLARED_REF' ? undeclared[i++] : undefined;
|
|
132
|
+
out.push({ ...d, where, step, ...(root !== undefined ? { root } : {}) });
|
|
123
133
|
}
|
|
124
134
|
}
|
|
125
135
|
/** Reach `Expr`s nested anywhere in an action's inputs (connector/http/… inputs can be structured). */
|
|
126
|
-
function deepExprs(val,
|
|
136
|
+
function deepExprs(val, step, roots, out) {
|
|
127
137
|
if (val instanceof Expr)
|
|
128
|
-
return pushExpr(val,
|
|
138
|
+
return pushExpr(val, step, roots, out);
|
|
129
139
|
if (Array.isArray(val)) {
|
|
130
140
|
for (const v of val)
|
|
131
|
-
deepExprs(v,
|
|
141
|
+
deepExprs(v, step, roots, out);
|
|
132
142
|
return;
|
|
133
143
|
}
|
|
134
144
|
if (val && typeof val === 'object') {
|
|
135
145
|
for (const v of Object.values(val))
|
|
136
|
-
deepExprs(v,
|
|
146
|
+
deepExprs(v, step, roots, out);
|
|
137
147
|
}
|
|
138
148
|
}
|
|
139
149
|
function walk(steps, roots, out) {
|
|
@@ -192,12 +202,16 @@ function walk(steps, roots, out) {
|
|
|
192
202
|
break;
|
|
193
203
|
case 'return':
|
|
194
204
|
for (const [k, v] of Object.entries(s.values))
|
|
195
|
-
pushExpr(v, `return "${k}"
|
|
205
|
+
pushExpr(v, s.options?.name ?? 'return', roots, out, `return "${k}"`);
|
|
196
206
|
break;
|
|
197
207
|
}
|
|
198
208
|
}
|
|
199
209
|
}
|
|
200
|
-
/**
|
|
210
|
+
/**
|
|
211
|
+
* Every first-level expression problem in a built flow's own scope, each
|
|
212
|
+
* stamped with its location. A subflow's child flow is not visited: it is a
|
|
213
|
+
* scope of its own, which `check` and the serializer visit separately.
|
|
214
|
+
*/
|
|
201
215
|
export function checkFlowExpressions(built) {
|
|
202
216
|
const out = [];
|
|
203
217
|
const roots = globalRoots(built);
|
|
@@ -218,7 +232,7 @@ export function checkFlowExpressions(built) {
|
|
|
218
232
|
* from the built flow, child flows included: a new position cannot be missed.
|
|
219
233
|
*
|
|
220
234
|
* Only `meaning` effects are reported here. An escape that breaks the parse is
|
|
221
|
-
* named by EXPR_SYNTAX, which
|
|
235
|
+
* named by EXPR_SYNTAX, which the serializer refuses.
|
|
222
236
|
*/
|
|
223
237
|
export function checkCookedEscapes(built) {
|
|
224
238
|
const out = [];
|
|
@@ -266,9 +280,22 @@ export function checkCookedEscapes(built) {
|
|
|
266
280
|
return out;
|
|
267
281
|
}
|
|
268
282
|
/**
|
|
269
|
-
*
|
|
270
|
-
* `
|
|
271
|
-
*
|
|
283
|
+
* The expression problems `compile` refuses: every error whose code is
|
|
284
|
+
* `lowering` (`EXPR_SYNTAX`). The serializer throws a {@link FlowBuildError} on
|
|
285
|
+
* them, or reports each one in collect mode.
|
|
286
|
+
*/
|
|
287
|
+
export function loweringExpressionErrors(built) {
|
|
288
|
+
return checkFlowExpressions(built).filter((d) => d.level === 'error' && refusalClass(d.code) === 'lowering');
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Thrown by `serialize()` (so by `compile`) when an expression in the flow
|
|
292
|
+
* cannot be written: today only `EXPR_SYNTAX`, an expression that is not valid
|
|
293
|
+
* JavaScript. Its `message` lists every such problem (so a runner that prints
|
|
294
|
+
* `err.message` shows them all at once); `diagnostics` carries them structured
|
|
295
|
+
* for a caller that wants them.
|
|
296
|
+
*
|
|
297
|
+
* `build()` no longer throws it: an undeclared reference (`EXPR_UNDECLARED_REF`)
|
|
298
|
+
* is `lint`, which `check` reports and `compile` writes as authored.
|
|
272
299
|
*/
|
|
273
300
|
export class FlowBuildError extends CompileRefusal {
|
|
274
301
|
diagnostics;
|
package/dist/flow-sdk.d.ts
CHANGED
|
@@ -1634,7 +1634,9 @@ declare class FlowBuilder extends StepList {
|
|
|
1634
1634
|
* Finish the flow and return the graph the compiler serializes.
|
|
1635
1635
|
*
|
|
1636
1636
|
* @returns The built description — inputs, outputs, variables, trigger and steps.
|
|
1637
|
-
*
|
|
1637
|
+
* It is not checked: `check()` reports what is wrong with it (an expression
|
|
1638
|
+
* reading a name nothing declares, `EXPR_UNDECLARED_REF`), and `serialize()`
|
|
1639
|
+
* refuses what cannot be written (`EXPR_SYNTAX`, as a `FlowBuildError`).
|
|
1638
1640
|
*/
|
|
1639
1641
|
build(): BuiltFlow;
|
|
1640
1642
|
}
|
package/dist/flow-sdk.js
CHANGED
|
@@ -49,7 +49,6 @@ export * from './raw-node.js';
|
|
|
49
49
|
import { err as errRef, toExpr } from './core/expr.js';
|
|
50
50
|
import { FLOW_TYPE_NAMES, nonFlowTypeReplacement } from './flow-types.js';
|
|
51
51
|
import { builtinActionSpec, builtinTriggerSpec, subscriptionFrom } from './core/actions.js';
|
|
52
|
-
import { checkFlowExpressions, FlowBuildError } from './flow-expr-check.js';
|
|
53
52
|
import { FLOW_SCHEMA_VERSIONS } from './format-profile.js';
|
|
54
53
|
import { schemaVersionRefusal } from './schema-version.js';
|
|
55
54
|
import { indexCarriedDefinitions } from './core/carried-definitions.js';
|
|
@@ -1309,7 +1308,9 @@ class FlowBuilder extends StepList {
|
|
|
1309
1308
|
* Finish the flow and return the graph the compiler serializes.
|
|
1310
1309
|
*
|
|
1311
1310
|
* @returns The built description — inputs, outputs, variables, trigger and steps.
|
|
1312
|
-
*
|
|
1311
|
+
* It is not checked: `check()` reports what is wrong with it (an expression
|
|
1312
|
+
* reading a name nothing declares, `EXPR_UNDECLARED_REF`), and `serialize()`
|
|
1313
|
+
* refuses what cannot be written (`EXPR_SYNTAX`, as a `FlowBuildError`).
|
|
1313
1314
|
*/
|
|
1314
1315
|
build() {
|
|
1315
1316
|
const built = {
|
|
@@ -1331,13 +1332,11 @@ class FlowBuilder extends StepList {
|
|
|
1331
1332
|
...(this._triggerId !== undefined ? { triggerId: this._triggerId } : {}),
|
|
1332
1333
|
...(this._openTails ? { openTails: true } : {}),
|
|
1333
1334
|
};
|
|
1334
|
-
//
|
|
1335
|
-
//
|
|
1336
|
-
//
|
|
1337
|
-
//
|
|
1338
|
-
|
|
1339
|
-
if (errors.length)
|
|
1340
|
-
throw new FlowBuildError(built, errors);
|
|
1335
|
+
// No expression check here: every path that loads a flow (`check`, `merge`,
|
|
1336
|
+
// decompile's lift) builds it first, so a throw here hid the file's other
|
|
1337
|
+
// findings and kept a brownfield `.flow` from round-tripping. `check()`
|
|
1338
|
+
// reports EXPR_UNDECLARED_REF (lint); the serializer refuses EXPR_SYNTAX
|
|
1339
|
+
// (lowering). See flow-expr-check.
|
|
1341
1340
|
return built;
|
|
1342
1341
|
}
|
|
1343
1342
|
}
|
package/dist/serialize.js
CHANGED
|
@@ -23,6 +23,7 @@ import { endOutcomeRefusal, fanInRefusal, hitlEndHazards, hitlFanInto } from './
|
|
|
23
23
|
import { resolveVersionCarried } from './core/nodes/versioned.js';
|
|
24
24
|
import { indexCarriedDefinitions } from './core/carried-definitions.js';
|
|
25
25
|
import { sharedDefinition } from './core/shared-definition.js';
|
|
26
|
+
import { FlowBuildError, loweringExpressionErrors } from './flow-expr-check.js';
|
|
26
27
|
import { connectionConnectors } from './bindings-v2.js';
|
|
27
28
|
import { BindingRefusal, bindingLabelRefusal, connectionStubMessage } from './core/binding-messages.js';
|
|
28
29
|
import { OUTCOME_HANDLE_NODE_TYPES, assertHitlExitInvariant, hitlExitViolation } from './core/hitl-routing.js';
|
|
@@ -1940,6 +1941,7 @@ function serializeFlow(built, opts) {
|
|
|
1940
1941
|
const childForks = new Map();
|
|
1941
1942
|
const prefix = claimStepIds(scope, stepNamesOf(child.steps, [], childTerminates, childForks), `subflow "${nodeId}"`, `${nodeId}_`, childNodes.ends.map(safeNodeId), childTerminates, childForks);
|
|
1942
1943
|
claimEndIds(scope, childNodes, `subflow "${nodeId}"`, [], prefix);
|
|
1944
|
+
refuseExpressions(child, scope);
|
|
1943
1945
|
const startId = uid(scope, `${nodeId}Start`);
|
|
1944
1946
|
// A CHILD's inputs are published as the child's own start node, whose id is
|
|
1945
1947
|
// `<caller>Start` — not `start`. `input('x')` lowers eagerly to
|
|
@@ -2510,6 +2512,23 @@ function serializeFlow(built, opts) {
|
|
|
2510
2512
|
...(step !== undefined && subflowPath.length ? { subflows: [...subflowPath] } : {}),
|
|
2511
2513
|
});
|
|
2512
2514
|
}
|
|
2515
|
+
/**
|
|
2516
|
+
* Refuse every expression in `flow`'s own scope that cannot be written
|
|
2517
|
+
* (`loweringExpressionErrors`: `EXPR_SYNTAX`). Compile throws them all as one
|
|
2518
|
+
* `FlowBuildError`; collect mode reports each on its step and goes on, so
|
|
2519
|
+
* `check` lists them beside the file's other findings. An undeclared
|
|
2520
|
+
* reference is `lint` and is written as authored (`check` reports it).
|
|
2521
|
+
*/
|
|
2522
|
+
function refuseExpressions(flow, scope) {
|
|
2523
|
+
const errors = loweringExpressionErrors(flow);
|
|
2524
|
+
if (!errors.length)
|
|
2525
|
+
return;
|
|
2526
|
+
if (!opts.collect)
|
|
2527
|
+
throw new FlowBuildError(flow, errors);
|
|
2528
|
+
for (const d of errors) {
|
|
2529
|
+
record(new CompileRefusal(d.code, `In ${d.where}: ${d.message}`, d.suggestion), d.step, d.step !== undefined ? scope.stepNodeId.get(d.step) : undefined);
|
|
2530
|
+
}
|
|
2531
|
+
}
|
|
2513
2532
|
/**
|
|
2514
2533
|
* Refuse at a site past a step's own emission (an edge out of it, a port list
|
|
2515
2534
|
* on it, a join it feeds), on the step the refusal is about. Collect mode
|
|
@@ -3427,6 +3446,7 @@ function serializeFlow(built, opts) {
|
|
|
3427
3446
|
namedNodesOf(ep.steps, rootNodes, seenEnds);
|
|
3428
3447
|
claimEndIds(root, rootNodes, `flow "${built.id}"`, [built.triggerId ?? 'start', ...(built.entryPoints ?? []).map((ep) => ep.id)]);
|
|
3429
3448
|
}
|
|
3449
|
+
refuseExpressions(built, root);
|
|
3430
3450
|
const finalTails = emit(built.steps, [{ node: built.triggerId ?? 'start', port: 'output' }], root);
|
|
3431
3451
|
// The implicit End a flow falls off the bottom into still terminates the
|
|
3432
3452
|
// flow, so it maps the flow's outputs — each to itself, since no `.return`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/maestro-builder-sdk",
|
|
3
|
-
"version": "6.86.
|
|
3
|
+
"version": "6.86.3",
|
|
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",
|
|
@@ -103,5 +103,5 @@
|
|
|
103
103
|
"@types/node": "^22.7.0",
|
|
104
104
|
"esbuild": "^0.28.1"
|
|
105
105
|
},
|
|
106
|
-
"gitref": "
|
|
106
|
+
"gitref": "10ab9a305a9e66a2bd0b4ca2c5d477d90b8376f6"
|
|
107
107
|
}
|