@uipath/maestro-builder-sdk 6.120.22 → 6.120.24

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.
@@ -70,8 +70,13 @@ export declare function savedConnectorRows(owner: string, bag: Record<string, an
70
70
  * could still disagree (a root companion added after this call), this one says
71
71
  * the rows diverge, so the id stays held: a dropped row then keeps its id
72
72
  * unused, but no two rows hold one.
73
+ *
74
+ * `finalVar` reads a built row's variable as it will be once the claims made so
75
+ * far are applied. A claim moves a row's id at once and its `var` later, so
76
+ * the built `Error` row `{ id: 'error15', var: 'Error11' }` that took its saved
77
+ * id still writes `error15`, the saved row's variable, and does not diverge.
73
78
  */
74
- export declare function droppedConnectorOutputRows(result: Record<string, any>, entries: readonly PreservedConnectorRows[] | undefined): Array<Record<string, unknown>>;
79
+ export declare function droppedConnectorOutputRows(result: Record<string, any>, entries: readonly PreservedConnectorRows[] | undefined, finalVar?: (row: Record<string, unknown>) => unknown): Array<Record<string, unknown>>;
75
80
  /**
76
81
  * Write each element's saved own rows back over the ones compile built, half
77
82
  * by half, while they still describe the element. Runs after the ids are
@@ -432,8 +432,13 @@ function inputsBack(built, set) {
432
432
  * could still disagree (a root companion added after this call), this one says
433
433
  * the rows diverge, so the id stays held: a dropped row then keeps its id
434
434
  * unused, but no two rows hold one.
435
+ *
436
+ * `finalVar` reads a built row's variable as it will be once the claims made so
437
+ * far are applied. A claim moves a row's id at once and its `var` later, so
438
+ * the built `Error` row `{ id: 'error15', var: 'Error11' }` that took its saved
439
+ * id still writes `error15`, the saved row's variable, and does not diverge.
435
440
  */
436
- export function droppedConnectorOutputRows(result, entries) {
441
+ export function droppedConnectorOutputRows(result, entries, finalVar = (row) => row.var) {
437
442
  if (!entries?.length)
438
443
  return [];
439
444
  const byOwner = new Map(entries.map((entry) => [entry.owner, entry]));
@@ -443,7 +448,9 @@ export function droppedConnectorOutputRows(result, entries) {
443
448
  const entry = byOwner.get(key);
444
449
  if (!entry?.outputs || !sameOperation(bag, entry) || !Array.isArray(bag.outputs))
445
450
  continue;
446
- if (outputsDiverge(bag.outputs.filter(isOwnOutput), entry.outputs, caseVariables))
451
+ // Each built own row as it will read once its queued renames run.
452
+ const builtOwn = bag.outputs.filter(isOwnOutput).map((row) => ({ ...row, var: finalVar(row) }));
453
+ if (outputsDiverge(builtOwn, entry.outputs, caseVariables))
447
454
  continue;
448
455
  const saved = new Set(entry.outputs.rows.map((row) => row.source));
449
456
  for (const row of bag.outputs)
@@ -2723,6 +2723,21 @@ function unaliasedOwnNameRow(row, plan) {
2723
2723
  const root = [...(plan.variables?.inputOutputs ?? []), ...(plan.variables?.inputs ?? []), ...(plan.variables?.outputs ?? [])];
2724
2724
  return root.some((entry) => entry?.id === row.id) ? { noAlias: true } : {};
2725
2725
  }
2726
+ /**
2727
+ * An own-name output (`id == var`) saved as the controlled alias
2728
+ * (`originalVar: <id>`) while no root variable has its id. Compile writes the
2729
+ * alias only beside a root variable of that id (serialize's variables merge),
2730
+ * so it writes this row bare. Recorded as `originalVar: <id>`, so compile
2731
+ * writes the saved spelling back. For example a process output `{ id:
2732
+ * 'region', var: 'region', originalVar: 'region' }` in a plan whose
2733
+ * `variables` declare no `region`. The mirror of {@link unaliasedOwnNameRow}.
2734
+ */
2735
+ function rootlessAliasRow(row, plan) {
2736
+ if (row.custom === true || typeof row.id !== 'string' || row.id !== row.var || row.originalVar !== row.id)
2737
+ return {};
2738
+ const root = [...(plan.variables?.inputOutputs ?? []), ...(plan.variables?.inputs ?? []), ...(plan.variables?.outputs ?? [])];
2739
+ return root.some((entry) => entry?.id === row.id) ? {} : { originalVar: row.id };
2740
+ }
2726
2741
  /**
2727
2742
  * A custom (`{ assign }`) output row's saved fields that compile does not
2728
2743
  * write as saved (`customRowShape`): its own `id`, an `elementId` other than
@@ -2812,6 +2827,7 @@ function identityPreservation(plan) {
2812
2827
  // or the variable an own-name extract wrote first (`firstResults`).
2813
2828
  ...(typeof row.originalVar === 'string' && row.originalVar !== row.id && (row.custom !== true || task.type === 'action')
2814
2829
  ? { originalVar: row.originalVar } : {}),
2830
+ ...rootlessAliasRow(row, plan),
2815
2831
  ...unaliasedOwnNameRow(row, plan),
2816
2832
  ...actionOutputShape(task, row),
2817
2833
  ...resourceRowShape(task, row, 'outputs'),
@@ -278,7 +278,7 @@ interface StageIdentity {
278
278
  omit?: string[];
279
279
  taskElementId?: true;
280
280
  }>;
281
- /** `originalVar` only when it is not the row's `id` (the serializer's own spelling). `elementId` when an action form output names another element than its task. `fields` as on an input. `omit`: the fields an action form output (`target`, `_jsonSchema`, `elementId`) or a resource extract (`target`) was saved without that compile writes. `target`: which of the row's variables its saved `target` names when that is not its id (`=<var>` or `=<originalVar>`; compile writes `=<id>`). `bodyCopies`: the extra copies of its `body` an action form output was saved with (`jsonSchema`), which compile writes back from the body. */
281
+ /** `originalVar` only when it is not the row's `id` (the serializer's own spelling), or when it is the `id` of an own-name row with no root variable of that id, which compile writes with none. `elementId` when an action form output names another element than its task. `fields` as on an input. `omit`: the fields an action form output (`target`, `_jsonSchema`, `elementId`) or a resource extract (`target`) was saved without that compile writes. `target`: which of the row's variables its saved `target` names when that is not its id (`=<var>` or `=<originalVar>`; compile writes `=<id>`). `bodyCopies`: the extra copies of its `body` an action form output was saved with (`jsonSchema`), which compile writes back from the body. */
282
282
  /** `var` and `custom: true`: a custom row whose label (`name`) is not the name of the variable it assigns. */
283
283
  /**
284
284
  * `noAlias: true`: an own-name row saved with no `originalVar` beside a root variable of its id, which compile writes as the alias `originalVar: <id>`.
@@ -1479,11 +1479,27 @@ function applyPreservedIdentities(result, preservation, warn) {
1479
1479
  const rowRenames = [];
1480
1480
  // Output `target` spellings (`carryRowShape`), applied once every row id is final.
1481
1481
  const targetSpellings = [];
1482
+ // The variable renames `takeRow` has queued per row, in order: the row's id
1483
+ // moves at once, its `var` only when `rowRenames` run. `finalVar` reads a
1484
+ // row's variable as it will be then, for checks made before.
1485
+ const pendingVarRenames = new WeakMap();
1486
+ const finalVar = (row) => {
1487
+ let variable = row.var;
1488
+ for (const [was, wanted] of pendingVarRenames.get(row) ?? [])
1489
+ if (variable === was)
1490
+ variable = wanted;
1491
+ return variable;
1492
+ };
1482
1493
  const takeRow = (row, wanted, output) => {
1483
1494
  if (!row || !wanted || typeof row.id !== 'string' || row.id === wanted)
1484
1495
  return;
1485
1496
  const was = row.id;
1486
1497
  row.id = wanted;
1498
+ const queued = pendingVarRenames.get(row);
1499
+ if (queued)
1500
+ queued.push([was, wanted]);
1501
+ else
1502
+ pendingVarRenames.set(row, [[was, wanted]]);
1487
1503
  rowRenames.push(() => {
1488
1504
  if (row.var === was)
1489
1505
  row.var = wanted;
@@ -1576,12 +1592,17 @@ function applyPreservedIdentities(result, preservation, warn) {
1576
1592
  // - An output whose `target` names its variable, or the one it wrote before
1577
1593
  // a reassignment, rather than its id gets that spelling back from the
1578
1594
  // row's final names: `{ var: 'status', target: '=status' }`.
1595
+ // - An own-name row saved as the alias of its own id (`originalVar: <id>`)
1596
+ // with no root variable of that id gets the alias back while it still
1597
+ // has that id and compile wrote it bare (`rootlessAliasRow`).
1579
1598
  if (wanted.target || wanted.originalVar !== undefined) {
1580
1599
  const field = wanted.target;
1581
1600
  targetSpellings.push(() => {
1582
1601
  if (wanted.originalVar !== undefined && row.id === row.var && wanted.originalVar !== row.id
1583
1602
  && (row.originalVar === undefined || row.originalVar === row.id))
1584
1603
  row.originalVar = wanted.originalVar;
1604
+ else if (wanted.originalVar !== undefined && row.id === row.var && wanted.originalVar === row.id && row.originalVar === undefined)
1605
+ row.originalVar = row.id;
1585
1606
  if (field && typeof row.target === 'string' && typeof row[field] === 'string' && row[field])
1586
1607
  row.target = `=${row[field]}`;
1587
1608
  });
@@ -1941,7 +1962,9 @@ function applyPreservedIdentities(result, preservation, warn) {
1941
1962
  // (`applyConnectorRows`), so its id is free for a saved row that carries it.
1942
1963
  // Example: a connector task saved with only its `Error` row compiles with a
1943
1964
  // `response11` row too; the task saved with `response11` takes it back.
1944
- for (const row of droppedConnectorOutputRows(result, preservation.connectorRows))
1965
+ // The rows' variables are read as `rowRenames` will leave them: a built
1966
+ // `Error11` row that took its saved id `error15` writes `error15`.
1967
+ for (const row of droppedConnectorOutputRows(result, preservation.connectorRows, finalVar))
1945
1968
  if (typeof row.id === 'string')
1946
1969
  heldOutputIds.delete(row.id);
1947
1970
  settleDeferredClaims(deferredClaims, heldOutputIds, (target, row) => claimRowId(target, row, target.id));
package/dist/decompile.js CHANGED
@@ -1047,8 +1047,13 @@ function resolveTemplateBindings(def, node) {
1047
1047
  }
1048
1048
  /** Best-effort placeholder for a node type the reverse-map does not yet cover. */
1049
1049
  function unsupportedSpec(node, imp, o) {
1050
- // The file's own definition for this node — the manifest the platform served.
1051
- const def = runDefs.get(`${node.type}@${node.typeVersion}`) ?? runDefs.get(node.type);
1050
+ // The file's own definition for this node — the manifest the platform served —
1051
+ // else the SDK's bundled core definition at the node's exact version, as
1052
+ // `definitionLabel` reads it. A file that carries no `definitions[]` (an older
1053
+ // save) still names a core type this SDK ships, so it stays a rawNode of
1054
+ // that type instead of becoming a mock.
1055
+ const key = `${node.type}@${node.typeVersion}`;
1056
+ const def = runDefs.get(key) ?? BUNDLED_DEFINITIONS[key] ?? runDefs.get(node.type);
1052
1057
  if (def !== undefined) {
1053
1058
  // A node type this SDK has no factory for is still expressible: `rawNode`
1054
1059
  // carries the definition verbatim, so the node keeps its TYPE, its VERSION
@@ -2192,15 +2197,16 @@ function region(cursor, stop, scope, ipdom, ctx, refInto) {
2192
2197
  cursor = fork.next.cursor;
2193
2198
  continue;
2194
2199
  }
2195
- // A merge node with one edge in and at most one out is a pass-through
2196
- // (or a dead end) the designer left in place (a join whose arms were
2197
- // later removed). The layout names it, so it is kept: it falls through
2198
- // to the regular step path below and comes back as the raw node of its
2199
- // own definition (#1310). Skipping it dropped the node, and compile then
2200
- // refused the `.layout()` key. A bare merge with several edges in (a
2201
- // join whose fork was not detected) is still skipped — best effort.
2202
- const ins = ctx.graph.inEdges(node.id).filter((e) => scope.has(e.sourceNodeId));
2203
- if (outs.length > 1 || ins.length !== 1) {
2200
+ // Any other merge node with at most one `output` edge is a step on the
2201
+ // path: a pass-through or a dead end the designer left in place (#1310),
2202
+ // or the join of a `.branch` / `.switch` whose arms the designer drew
2203
+ // back together through it. It falls through to the regular step path
2204
+ // below and comes back as the raw node of its own definition; serialize
2205
+ // wires every arm tail into it, so each in-edge comes back too. Skipping
2206
+ // it dropped the node and rewired its in-edges straight to its
2207
+ // successor. Only a merge with several outs that no `.parallel` spells
2208
+ // (no joinable ipdom) is still skipped — best effort.
2209
+ if (outs.length > 1) {
2204
2210
  const next = continueOn(node, 'output', ctx, refInto);
2205
2211
  if (next.brk || next.cont) {
2206
2212
  segs.push(next.brk ? '.break()' : '.continue()');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.120.22",
3
+ "version": "6.120.24",
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",
@@ -124,5 +124,5 @@
124
124
  "@types/node": "^22.7.0",
125
125
  "esbuild": "^0.28.1"
126
126
  },
127
- "gitref": "3631ba8b929fc9aa1c002841bb812003ee4c4d74"
127
+ "gitref": "fa9d7fa6d274cb05bdcc5cb9d4ce176c1d77a5fa"
128
128
  }