@uipath/maestro-builder-sdk 6.98.0 → 6.99.0

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/check.js CHANGED
@@ -971,6 +971,23 @@ function checkFlow(built, ancestors, opts = {}) {
971
971
  });
972
972
  continue;
973
973
  }
974
+ // `$vars.start.output.<x>` inside a subflow, for an `x` the subflow does
975
+ // not declare as an input (#1969). A subflow body is its own scope: its
976
+ // `start` is the child's OWN Start node (serialize renames it to
977
+ // `<caller>Start`), and that node publishes exactly the child's declared
978
+ // inputs. So the read names nothing at run time, typically a parent input
979
+ // the author expected to be visible: `input('n')` or `$vars.start.output.n`
980
+ // written in the child as if it were the caller. A step of the caller is
981
+ // UNKNOWN_REF above; this is the one parent-scope read that `start` being
982
+ // declared in every scope let through.
983
+ if (ancestors.length > 0 && (name === 'start' || name === built.triggerId) && field === 'output'
984
+ && code.startsWith('$vars', m.index ?? 0)) {
985
+ const key = rest.split('.')[1];
986
+ if (key !== undefined && key !== '' && !inputNames.has(key)) {
987
+ diags.push(subflowParentScopeRead(built, ancestors, name, key, step));
988
+ continue;
989
+ }
990
+ }
974
991
  // `$vars.<input>` — a flow INPUT read by its bare name.
975
992
  //
976
993
  // Inputs, outputs and vars share one namespace in `variables.globals[]`,
@@ -1546,6 +1563,40 @@ function checkSubflow(step, child, inputs, parent, ancestors, diags) {
1546
1563
  }
1547
1564
  }
1548
1565
  }
1566
+ /**
1567
+ * SUBFLOW_PARENT_SCOPE_READ: a subflow body reads `$vars.<start>.output.<key>`
1568
+ * for a `key` that is not one of its own inputs (#1969). The child's Start
1569
+ * publishes only the child's inputs, so the read is empty on every run. When
1570
+ * `key` is an input of a calling flow, the message says so; the fix is the
1571
+ * same either way: declare it on the child and pass it in.
1572
+ *
1573
+ * ```ts
1574
+ * const child = flow('C').output({ r: types.number })
1575
+ * .step('s', script({ code: 'return $vars.start.output.n + 1;' })) // n is the PARENT's input
1576
+ * .return({ r: out('s') });
1577
+ * // fix: flow('C').input({ n: types.number })… and subflow(child, { n: input('n') })
1578
+ * ```
1579
+ */
1580
+ function subflowParentScopeRead(child, ancestors, root, key, step) {
1581
+ // The nearest calling flow that declares `key`, on its trigger or an entry point.
1582
+ const owner = [...ancestors].reverse().map((f) => ({
1583
+ f, input: [...f.inputs, ...(f.entryPoints ?? []).flatMap((ep) => ep.inputs)].find((i) => i.name === key),
1584
+ })).find((x) => x.input !== undefined);
1585
+ const type = owner?.input ? String(owner.input.type) : undefined;
1586
+ const whose = owner
1587
+ ? `"${key}" is an input of the calling flow "${owner.f.id}", not of this subflow`
1588
+ : `the subflow "${child.id}" declares no input "${key}"`;
1589
+ return {
1590
+ level: 'error',
1591
+ code: 'SUBFLOW_PARENT_SCOPE_READ',
1592
+ message: `"$vars.${root}.output.${key}" in "${step}" reads the subflow's own start, and ${whose}. A subflow `
1593
+ + `sees only the inputs it declares, so this read is empty at run time. Declare `
1594
+ + `.input({ ${key}: types.${type ?? '…'} }) on "${child.id}" and pass it from the subflow step: `
1595
+ + `subflow(…, { ${key}: input('${key}') }).`,
1596
+ step,
1597
+ suggestion: `{ ${key}: input('${key}') }`,
1598
+ };
1599
+ }
1549
1600
  /**
1550
1601
  * Diagnose a read of a subflow's output: `$vars.<step>.output.<childOutput>`.
1551
1602
  *
@@ -728,6 +728,7 @@ export declare const REFUSALS: {
728
728
  readonly SUBFLOW_NO_CHILD: "lint";
729
729
  readonly SUBFLOW_OUTPUT_NEVER_RETURNED: "lint";
730
730
  readonly SUBFLOW_OUTPUT_NO_FIELD: "lint";
731
+ readonly SUBFLOW_PARENT_SCOPE_READ: "lint";
731
732
  readonly SUBFLOW_UNKNOWN_INPUT: "lint";
732
733
  readonly SUBFLOW_UNKNOWN_OUTPUT: "lint";
733
734
  readonly SUPERFLUOUS_GATEWAY: "lint";
@@ -802,6 +802,7 @@ export const REFUSALS = {
802
802
  SUBFLOW_NO_CHILD: 'lint',
803
803
  SUBFLOW_OUTPUT_NEVER_RETURNED: 'lint',
804
804
  SUBFLOW_OUTPUT_NO_FIELD: 'lint',
805
+ SUBFLOW_PARENT_SCOPE_READ: 'lint',
805
806
  SUBFLOW_UNKNOWN_INPUT: 'lint',
806
807
  SUBFLOW_UNKNOWN_OUTPUT: 'lint',
807
808
  SUPERFLUOUS_GATEWAY: 'lint',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.98.0",
3
+ "version": "6.99.0",
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",
@@ -115,5 +115,5 @@
115
115
  "@types/node": "^22.7.0",
116
116
  "esbuild": "^0.28.1"
117
117
  },
118
- "gitref": "c34b7ab7eafff32159cf7ae8d651cbf7aa65465c"
118
+ "gitref": "a882a35fe0c0650eaf61789446cbcb6e5e245335"
119
119
  }