@uipath/maestro-builder-sdk 6.86.21 → 6.86.22

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.
@@ -2322,10 +2322,11 @@ function identityPreservation(plan) {
2322
2322
  name: row.name ?? '',
2323
2323
  ...(row.id ? { id: row.id } : {}),
2324
2324
  ...customRowLabel(row, plan),
2325
- // A form output's `originalVar` when the Designer spelled it as the variable, not the slot id,
2326
- // and a resource extract's when it names the variable an own-name row wrote first.
2327
- ...(typeof row.originalVar === 'string' && row.originalVar !== row.id
2328
- && (task.type === 'action' || (row.custom !== true && row.id !== undefined && row.id === row.var && ownEntry(TASK_KIND_METHOD, task.type)))
2325
+ // The row's `originalVar` when the Designer spelled it as something other than
2326
+ // the row's id, the spelling compile writes: the variable (`decision`), the
2327
+ // field's own default variable (`status` on a row that writes `intakeStatus`),
2328
+ // or the variable an own-name extract wrote first (`firstResults`).
2329
+ ...(typeof row.originalVar === 'string' && row.originalVar !== row.id && (row.custom !== true || task.type === 'action')
2329
2330
  ? { originalVar: row.originalVar } : {}),
2330
2331
  ...actionOutputShape(task, row),
2331
2332
  ...resourceRowShape(task, row, 'outputs'),
@@ -1356,6 +1356,83 @@ function applyPreservedIdentities(result, preservation) {
1356
1356
  });
1357
1357
  }
1358
1358
  };
1359
+ // Take a row's carried id, or report that another row holds it now (`false`);
1360
+ // a held id is tried again once every row has taken its own (`deferredClaims`).
1361
+ const claimRowId = (target, row, currentId) => {
1362
+ // A nested own-name row (`app_id: '=response.app_id'`, written bare since
1363
+ // builder-sdk#1241) whose carried id is not its variable is a row an
1364
+ // SDK 6.67.1-era plan wrote reassigned, with a root companion that
1365
+ // readers spell (`=vars.app_id`). It keeps that shape: the carried slot id
1366
+ // goes on the row, `var` stays, and the companion comes back. Decided
1367
+ // here, on identities `followRenames` has already paired, so a renamed
1368
+ // task or stage keeps it too.
1369
+ if (target && typeof row.id === 'string' && isCarriedNestedReassignment(target, row.id) && !heldOutputIds.has(row.id)) {
1370
+ reassignCarried(target, row.id);
1371
+ if (currentId !== undefined)
1372
+ heldOutputIds.delete(currentId);
1373
+ heldOutputIds.add(row.id);
1374
+ return true;
1375
+ }
1376
+ // An own-name row's id IS its variable's name (`emitTaskOutput`). A
1377
+ // preserved id that differs — an `o<hash>` slot from a plan an older
1378
+ // SDK wrote — would rename the variable out from under every
1379
+ // `=vars.<name>` reader, so the typed rule wins and the row migrates.
1380
+ // A Designer reassignment is different: its slot id is not one this SDK
1381
+ // mints (`{ id: 'invoiceData2', var: 'invoiceData' }`, `{ id:
1382
+ // 'outApproved', var: 'approved' }`), or it records its own `originalVar`
1383
+ // spelling. The row is the slot that writes the variable, not the
1384
+ // variable, and it keeps that shape.
1385
+ if (target && OWN_NAME_OUTPUT_ROWS.has(target) && row.id !== target.id) {
1386
+ if (typeof row.id !== 'string' || row.id === target.var || target.name !== row.name)
1387
+ return true;
1388
+ if (typeof row.originalVar !== 'string' && isSdkOutputSlotId(row.id, target.var))
1389
+ return true;
1390
+ if (heldOutputIds.has(row.id))
1391
+ return false;
1392
+ reassignCarried(target, row.id);
1393
+ if (typeof row.originalVar === 'string')
1394
+ target.originalVar = row.originalVar;
1395
+ if (currentId !== undefined)
1396
+ heldOutputIds.delete(currentId);
1397
+ heldOutputIds.add(row.id);
1398
+ return true;
1399
+ }
1400
+ if (target && typeof row.id === 'string' && row.id !== currentId && heldOutputIds.has(row.id))
1401
+ return false;
1402
+ // A reassigned row (slot id, `originalVar` the slot) whose carried id IS
1403
+ // its variable was saved in the own-name shape; see `ownNameRestored`.
1404
+ if (target && typeof row.id === 'string' && row.id === target.var && target.id !== target.var && target.originalVar === target.id)
1405
+ ownNameRestored.push(target);
1406
+ // Designer reassignment: { name: 'Action', value: 'decision' } keeps var 'decision', slot id 'action'.
1407
+ if (target && typeof row.id === 'string' && NAMED_ACTION_OUTPUT_ROWS.has(target) && row.id !== target.var) {
1408
+ reassignCarried(target, row.id);
1409
+ // The Designer's other spellings (`originalVar: 'decision'`, the variable, or the field's own name).
1410
+ if (typeof row.originalVar === 'string' && designerOriginalVar(row.originalVar, target))
1411
+ target.originalVar = row.originalVar;
1412
+ }
1413
+ else {
1414
+ takeRow(target, row.id, true);
1415
+ // The Designer's own `originalVar` spelling on a reassigned row (the
1416
+ // field's default variable, `status` on a row that writes
1417
+ // `intakeStatus`), while the row is still that output, reassigned.
1418
+ if (target && typeof row.originalVar === 'string' && target.name === row.name && designerOriginalVar(row.originalVar, target)
1419
+ && typeof row.id === 'string' && target.var !== row.id && typeof target.originalVar === 'string') {
1420
+ const spelling = row.originalVar;
1421
+ rowRenames.push(() => { if (target.id === row.id && target.originalVar === row.id)
1422
+ target.originalVar = spelling; });
1423
+ }
1424
+ }
1425
+ if (target && typeof row.id === 'string' && typeof currentId === 'string') {
1426
+ heldOutputIds.delete(currentId);
1427
+ heldOutputIds.add(row.id);
1428
+ }
1429
+ return true;
1430
+ };
1431
+ // Rows whose carried id another row held when they were reached. Example: a
1432
+ // later task's row was compiled as `invoiceNumber2` and carries
1433
+ // `invoiceNumber3`; the earlier task's row that carries `invoiceNumber2` gets it
1434
+ // once the later row has moved.
1435
+ const deferredClaims = [];
1359
1436
  // `actionRows`: the rows are an action task's form outputs, the only rows
1360
1437
  // whose identity may omit `_jsonSchema` / `elementId` or name another
1361
1438
  // `elementId` (#1636). On any other row those would remove or re-point a
@@ -1398,48 +1475,8 @@ function applyPreservedIdentities(result, preservation) {
1398
1475
  rowRenames.push(() => { if (target.body !== undefined)
1399
1476
  target.jsonSchema = structuredClone(target.body); });
1400
1477
  carryRowShape(target, row);
1401
- // A nested own-name row (`app_id: '=response.app_id'`, written bare since
1402
- // builder-sdk#1241) whose carried id is not its variable is a row an
1403
- // SDK 6.67.1-era plan wrote reassigned, with a root companion that
1404
- // readers spell (`=vars.app_id`). It keeps that shape: the carried slot id
1405
- // goes on the row, `var` stays, and the companion comes back. Decided
1406
- // here, on identities `followRenames` has already paired, so a renamed
1407
- // task or stage keeps it too.
1408
- if (target && typeof row.id === 'string' && isCarriedNestedReassignment(target, row.id) && !heldOutputIds.has(row.id)) {
1409
- reassignCarried(target, row.id);
1410
- heldOutputIds.delete(currentId);
1411
- heldOutputIds.add(row.id);
1412
- return;
1413
- }
1414
- // An own-name row's id IS its variable's name (`emitTaskOutput`). A
1415
- // preserved id that differs — an `o<hash>` slot from a plan an older
1416
- // SDK wrote — would rename the variable out from under every
1417
- // `=vars.<name>` reader, so the typed rule wins and the row migrates.
1418
- if (target && OWN_NAME_OUTPUT_ROWS.has(target) && row.id !== target.id)
1419
- return;
1420
- if (target && typeof row.id === 'string' && row.id !== currentId && heldOutputIds.has(row.id))
1421
- return;
1422
- // A reassigned row (slot id, `originalVar` the slot) whose carried id IS
1423
- // its variable was saved in the own-name shape; see `ownNameRestored`.
1424
- if (target && typeof row.id === 'string' && row.id === target.var && target.id !== target.var && target.originalVar === target.id)
1425
- ownNameRestored.push(target);
1426
- // Designer reassignment: { name: 'Action', value: 'decision' } keeps var 'decision', slot id 'action'.
1427
- if (target && typeof row.id === 'string' && NAMED_ACTION_OUTPUT_ROWS.has(target) && row.id !== target.var) {
1428
- reassignCarried(target, row.id);
1429
- // The Designer's other spellings: `originalVar: 'decision'`, only while
1430
- // the row still writes 'decision', and the field's own variable before
1431
- // the reassignment, `originalVar: 'Action'`, only while the row is still
1432
- // the 'Action' field.
1433
- if (row.originalVar === target.var || (row.originalVar !== undefined && row.originalVar === target.name))
1434
- target.originalVar = row.originalVar;
1435
- }
1436
- else {
1437
- takeRow(target, row.id, true);
1438
- }
1439
- if (target && typeof row.id === 'string' && typeof currentId === 'string') {
1440
- heldOutputIds.delete(currentId);
1441
- heldOutputIds.add(row.id);
1442
- }
1478
+ if (!claimRowId(target, row, currentId))
1479
+ deferredClaims.push(() => claimRowId(target, row, target.id));
1443
1480
  });
1444
1481
  };
1445
1482
  const takeConditions = (current, wanted) => {
@@ -1561,6 +1598,12 @@ function applyPreservedIdentities(result, preservation) {
1561
1598
  }
1562
1599
  const metadata = result.metadata;
1563
1600
  takeConditions(metadata.caseExitRules, identities.caseExitRules);
1601
+ for (let pending = deferredClaims; pending.length;) {
1602
+ const next = pending.filter((claim) => !claim());
1603
+ if (next.length === pending.length)
1604
+ break;
1605
+ pending = next;
1606
+ }
1564
1607
  takeSlas(metadata.slaRules, identities.slaRules);
1565
1608
  restoreEmptyLists(metadata, identities.emptyLists, CASE_EMPTY_LISTS);
1566
1609
  restoreSlaIds();
@@ -2563,6 +2606,17 @@ function triggerOutputRows(nodes) {
2563
2606
  return nodes.flatMap((node) => node.type === 'uipath.case.trigger' ? (node.data?.inputs?.outputs ?? [])
2564
2607
  : node.type === 'case-management:Trigger' ? (node.data?.uipath?.outputs ?? []) : []);
2565
2608
  }
2609
+ /**
2610
+ * Whether a carried `originalVar` is one the Designer writes on `row`: the
2611
+ * variable the row writes (`decision`), or the field's own default variable,
2612
+ * spelled as the field (`companyNumber`, `decision`) or camelCased (`pdfCount`
2613
+ * for `pdf_count`). Any of these still holds while the row is the same output;
2614
+ * a variable spelling the row no longer writes does not.
2615
+ */
2616
+ function designerOriginalVar(originalVar, row) {
2617
+ const name = typeof row.name === 'string' ? row.name : undefined;
2618
+ return originalVar === row.var || (name !== undefined && (originalVar === name || originalVar === camelizeName(name)));
2619
+ }
2566
2620
  /** Every `outputs[]` row a rule's wait-for-connector bag carries, across a condition list. */
2567
2621
  function ruleOutputRows(conditions) {
2568
2622
  const bag = CASE_FORMAT_PROFILE.waitConnectorRuleBagField;
@@ -2579,6 +2633,23 @@ function planOutputRows(result, stages) {
2579
2633
  ...ruleOutputRows(result.metadata?.caseExitRules),
2580
2634
  ];
2581
2635
  }
2636
+ /**
2637
+ * The slot id `emitTaskOutput` mints for a reassigned output (`ozLtpBmNr`):
2638
+ * `o` and 8 base-62 characters (`IdGen.make('o', 8)`), with the numeric suffix
2639
+ * `claimOutputId` adds when it is taken.
2640
+ */
2641
+ const SDK_OUTPUT_SLOT_ID = /^o[A-Za-z0-9]{8}\d*$/;
2642
+ /**
2643
+ * Whether a carried output id is an SDK-minted slot (`SDK_OUTPUT_SLOT_ID`).
2644
+ * An id that is the row's variable plus a number (`orderNum2` into `orderNum`)
2645
+ * is the Designer's numbering, which the SDK never mints, even when it also
2646
+ * has the slot's shape.
2647
+ */
2648
+ function isSdkOutputSlotId(id, variable) {
2649
+ if (typeof variable === 'string' && id.length > variable.length && id.startsWith(variable) && /^\d+$/.test(id.slice(variable.length)))
2650
+ return false;
2651
+ return SDK_OUTPUT_SLOT_ID.test(id);
2652
+ }
2582
2653
  /** Action form output rows whose variable is the author's explicit `value`; see applyPreservedIdentities. */
2583
2654
  const NAMED_ACTION_OUTPUT_ROWS = new WeakSet();
2584
2655
  /** Rows `emitTaskOutput` wrote in the own-name shape (`id == var`); see applyPreservedIdentities. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.86.21",
3
+ "version": "6.86.22",
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": "e0ee81ffb8c846fe651e90f1d0e2d879ccde3306"
106
+ "gitref": "5f41a8dcaad179d995dfe163d6b72120b35a2690"
107
107
  }