@uipath/maestro-builder-sdk 6.86.2 → 6.86.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.
@@ -122,7 +122,12 @@ export type BpmnNode = {
122
122
  name?: string;
123
123
  attachedTo: string;
124
124
  cancelActivity: boolean;
125
- event: EventDef;
125
+ /**
126
+ * Absent for a boundary with no event definition: a deployed process can carry
127
+ * one, and the builder keeps it as written. The platform never fires it, so
128
+ * `check` warns (BPMN_BOUNDARY_NO_EVENT).
129
+ */
130
+ event?: EventDef;
126
131
  /** A `uipath:activity` payload on the boundary — see {@link ExtensionPayload}. */
127
132
  payload?: ExtensionPayload;
128
133
  } | {
@@ -774,8 +779,13 @@ export interface ThrowOpts {
774
779
  /**
775
780
  * Options for `.boundaryEvent()`: the activity it attaches to, whether it
776
781
  * interrupts that activity, and the event definition — exactly one of
777
- * `message` / `timer` / `error` (checked in the order error, timer, message;
778
- * none at all is refused).
782
+ * `message` / `timer` / `error` (checked in the order error, timer, message).
783
+ *
784
+ * None at all writes a `bpmn:boundaryEvent` with no event definition. The platform
785
+ * never triggers such a boundary (the local engine treats it as a catch-all error
786
+ * boundary, which production does not), so `check` warns (BPMN_BOUNDARY_NO_EVENT); the builder
787
+ * still writes it, because deployed processes carry the shape and
788
+ * `uip maestro bpmn validate` accepts it, so a decompiled one has to compile back.
779
789
  */
780
790
  export interface BoundaryOpts {
781
791
  /** Display name the designer shows on the event. */
@@ -796,8 +796,6 @@ class ScopeBuilder {
796
796
  event = { type: 'timer', timer: normTimer(opts.timer) };
797
797
  else if (opts.message !== undefined)
798
798
  event = { type: 'message', messageRef: this._defs.messageRef(opts.message) };
799
- else
800
- throw new CompileRefusal('BPMN_BOUNDARY_NO_EVENT', `boundaryEvent "${id}" needs one of { message, timer, error }.`);
801
799
  return this.push({
802
800
  kind: 'boundaryEvent',
803
801
  id,
@@ -1360,6 +1360,22 @@ inEventSubProcess = false) {
1360
1360
  // An unknown target is the serializer's BOUNDARY_UNATTACHED.
1361
1361
  if (target && !isActivityNode(target))
1362
1362
  diags.push({ level: 'error', code: 'BOUNDARY_NOT_ACTIVITY', message: `Boundary event "${n.id}" must attach to an activity, not "${target.kind}".`, where: n.id });
1363
+ // No definition means the platform never triggers it: PO.BpmnEngine arms it as a
1364
+ // timer with no props, and its error routing only considers error boundaries. So
1365
+ // its path is dead in production. (The local engine still runs it as a catch-all
1366
+ // error boundary, a legacy V1-port behaviour — #1826.) A warning,
1367
+ // not an error: deployed processes carry the shape and `uip maestro bpmn
1368
+ // validate` accepts it, so refusing it would stop a brownfield process from
1369
+ // compiling back over an element the edit did not touch.
1370
+ if (n.event === undefined)
1371
+ diags.push({
1372
+ level: 'warning',
1373
+ code: 'BPMN_BOUNDARY_NO_EVENT',
1374
+ message: `Boundary event "${n.id}" has no event definition, so the platform never fires it and the path after it ` +
1375
+ 'never runs (the local engine runs it as a catch-all error boundary, so a local run can pass where ' +
1376
+ 'production does not). Give it one of `message`, `timer` or `error`, or remove it.',
1377
+ where: n.id,
1378
+ });
1363
1379
  }
1364
1380
  // A timer event definition needs one of duration/date/cycle.
1365
1381
  // An error START event only means something inside an event sub-process: that is
@@ -1338,6 +1338,20 @@ function labelKeptFlows(lift, into = new Set()) {
1338
1338
  function isEventSubProcess(el) {
1339
1339
  return el.$type === 'bpmn:SubProcess' && el.triggeredByEvent === true;
1340
1340
  }
1341
+ /**
1342
+ * Whether the builder, in a `sequence` scope, implies an edge OUT of this element to
1343
+ * the statement written after it — the mirror of `opensPath` in bpmn-sdk.ts. An end
1344
+ * event, a gateway, a boundary event and an event sub-process never do, so a flow
1345
+ * out of one of them must be written explicitly. A boundary the lift leaves flat (one
1346
+ * with no event definition, say) was implied anyway, and the recompile refused the
1347
+ * element after it with BPMN_SEQUENCE_NO_INCOMING.
1348
+ */
1349
+ function opensPathInSequence(el) {
1350
+ const kind = localName(el.$type);
1351
+ if (kind === 'endEvent' || kind === 'boundaryEvent' || kind.endsWith('Gateway'))
1352
+ return false;
1353
+ return !isEventSubProcess(el);
1354
+ }
1341
1355
  /** An element an arm may contain: something with one way in and one way out, or an end. */
1342
1356
  function isArmNode(el) {
1343
1357
  const kind = localName(el.$type);
@@ -1872,7 +1886,7 @@ function emitScopeNested(chain, container, depth, indent, summary, relabel, sequ
1872
1886
  // statement IS the successor, the edge may be relabelled (or already carries the
1873
1887
  // derived id), and it carries no label. Otherwise it is written here, before the
1874
1888
  // next statement, so the builder does not imply a second one beside it.
1875
- if (sequence && fresh && (relabel || derivableFlow(f)) && !labelledImpliedFlow([f], false))
1889
+ if (sequence && fresh && opensPathInSequence(el) && (relabel || derivableFlow(f)) && !labelledImpliedFlow([f], false))
1876
1890
  implyFlow(plan, f);
1877
1891
  else if (sequence)
1878
1892
  writeNow([f]);
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',
@@ -67,7 +67,7 @@ export declare const REFUSALS: {
67
67
  readonly BOUNDARY_UNATTACHED: "lowering";
68
68
  readonly BPMN_BINDING_READ_BEFORE_DECLARED: "lowering";
69
69
  readonly BPMN_BINDING_RESOURCE_KEY_CONFLICT: "lowering";
70
- readonly BPMN_BOUNDARY_NO_EVENT: "lowering";
70
+ readonly BPMN_BOUNDARY_NO_EVENT: "lint";
71
71
  readonly BPMN_BRANCH_EMPTY_ARMS: "lowering";
72
72
  readonly BPMN_BRANCH_NOWHERE_TO_GO: "lowering";
73
73
  readonly BPMN_BRANCH_NO_ARMS: "lowering";
@@ -116,7 +116,7 @@ export const REFUSALS = {
116
116
  BOUNDARY_UNATTACHED: 'lowering',
117
117
  BPMN_BINDING_READ_BEFORE_DECLARED: 'lowering',
118
118
  BPMN_BINDING_RESOURCE_KEY_CONFLICT: 'lowering',
119
- BPMN_BOUNDARY_NO_EVENT: 'lowering',
119
+ BPMN_BOUNDARY_NO_EVENT: 'lint',
120
120
  BPMN_BRANCH_EMPTY_ARMS: 'lowering',
121
121
  BPMN_BRANCH_NOWHERE_TO_GO: 'lowering',
122
122
  BPMN_BRANCH_NO_ARMS: 'lowering',
@@ -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
- /** Every first-level expression problem in a built flow, each stamped with its location. */
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 already stops `build()`.
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
- * Thrown by `build()` when the first-level expression check finds errors. Its
29
- * `message` lists every problem (so a runner that prints `err.message` shows them
30
- * all at once); `diagnostics` carries them structured for a caller that wants them.
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[];
@@ -1,20 +1,25 @@
1
1
  /**
2
2
  * flow-expr-check — the FLOW adapter over the shared, format-agnostic
3
- * `core/expr-check`. It is what `FlowBuilder.build()` runs, unconditionally,
4
- * before it hands back the model to be serialized: a cheap first-level check that
5
- * every `$vars.*` reference in an expression resolves to something the runtime
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
- * WHY IN build(), AND WHY IT THROWS. The full validation is `uip maestro flow
9
- * validate`, run after the `.flow` is written — richer, but a slower loop. This
10
- * catches the definite mistakes at the moment the SDK code runs, so a typo'd
11
- * reference fails HERE, with the node and a suggestion, instead of surviving into
12
- * a serialized `.flow` and surfacing three steps later. Because `build()`'s return
13
- * value IS what gets serialized, throwing is the only way to reliably stop a
14
- * broken model from being written — and since a `.flow.ts` file's default export
15
- * is `flow(…).build()`, the throw becomes a failed import that any runner (the
16
- * compile CLI's `.catch`, or a bare `node`) surfaces as a message + non-zero exit
17
- * with no file emitted.
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 YET — only expressions (`Expr` values). A script
27
- * body is a plain string carrying its own `$vars.*` references; checking those is
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, where, roots, out) {
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
- out.push({ ...d, where });
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, where, roots, out) {
136
+ function deepExprs(val, step, roots, out) {
127
137
  if (val instanceof Expr)
128
- return pushExpr(val, where, roots, out);
138
+ return pushExpr(val, step, roots, out);
129
139
  if (Array.isArray(val)) {
130
140
  for (const v of val)
131
- deepExprs(v, where, roots, out);
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, where, roots, out);
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}"`, roots, out);
205
+ pushExpr(v, s.options?.name ?? 'return', roots, out, `return "${k}"`);
196
206
  break;
197
207
  }
198
208
  }
199
209
  }
200
- /** Every first-level expression problem in a built flow, each stamped with its location. */
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 already stops `build()`.
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
- * Thrown by `build()` when the first-level expression check finds errors. Its
270
- * `message` lists every problem (so a runner that prints `err.message` shows them
271
- * all at once); `diagnostics` carries them structured for a caller that wants them.
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;
@@ -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
- * @throws FlowBuildError when an expression references something undeclared.
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
- * @throws FlowBuildError when an expression references something undeclared.
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
- // First-level validation, intrinsic to running the SDK: catch a definitely-
1335
- // broken expression HERE, before the model is serialized, rather than three
1336
- // steps later at `uip maestro flow validate`. Throws so nothing invalid is
1337
- // written; the deeper checks stay with the validate CLI. See flow-expr-check.
1338
- const errors = checkFlowExpressions(built).filter((d) => d.level === 'error');
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.2",
3
+ "version": "6.86.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",
@@ -103,5 +103,5 @@
103
103
  "@types/node": "^22.7.0",
104
104
  "esbuild": "^0.28.1"
105
105
  },
106
- "gitref": "cc066edcd1025c03c024ae3ffe2115cee3e87fc6"
106
+ "gitref": "63df9d1690c00f6a84b8760327ca2ab69deef72e"
107
107
  }