@uipath/maestro-builder-sdk 6.120.21 → 6.120.23

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)
@@ -21,7 +21,7 @@ import { compareSchemaVersions, preserveSchemaVersion } from '../schema-version.
21
21
  import { ownEntry } from '../core/own-entry.js';
22
22
  import { eventFilterExpressionOf, eventFilterFromTreeLeaf, eventFilterJmes, eventFilterOperator, eventFilterProblem, EXPRESSION_FILTER_OPERATORS, filterExprFromLeaf } from '../core/event-filters.js';
23
23
  import { CASE_FILTER_SPELLING, caseSubscriptionBody, caseSubscriptionOwners } from './subscription.js';
24
- import { CASE_NODE_CANVAS_FIELDS, CASE_NODE_LAYOUT_FIELDS, isTypedInputField, isUnrestorableSlotId, planElementIds, PRESERVED_STAGE_DATA_KEYS, PRESERVED_TRIGGER_DATA_KEYS, RESOURCE_INPUT_WRITTEN, RESOURCE_OUTPUT_WRITTEN, CASE_EMPTY_LISTS, STAGE_EMPTY_LISTS, TASK_EMPTY_LISTS, taskFingerprint, PRESERVED_ACTION_DATA_KEYS, TYPED_TRIGGER_DISPLAY_KEYS, } from './preserve.js';
24
+ import { CASE_NODE_CANVAS_FIELDS, CASE_NODE_LAYOUT_FIELDS, isTypedInputField, isUnrestorableSlotId, planElementIds, PRESERVED_STAGE_DATA_KEYS, PRESERVED_TRIGGER_DATA_KEYS, RESOURCE_INPUT_WRITTEN, RESOURCE_OUTPUT_WRITTEN, outputRowName, CASE_EMPTY_LISTS, STAGE_EMPTY_LISTS, TASK_EMPTY_LISTS, taskFingerprint, PRESERVED_ACTION_DATA_KEYS, TYPED_TRIGGER_DISPLAY_KEYS, } from './preserve.js';
25
25
  import { stableId } from '../core/stable-id.js';
26
26
  import { ACTION_CONTEXT_COPIES, ACTION_PASSTHROUGH_SETTINGS } from './action-settings.js';
27
27
  import { resourceIdentity, SOLUTION_FOLDER } from './resource-identity.js';
@@ -1498,6 +1498,21 @@ function resourceOutputValue(task, row) {
1498
1498
  return {};
1499
1499
  return row.value === undefined || row.value === row.var ? {} : { value: { value: structuredClone(row.value), var: row.var } };
1500
1500
  }
1501
+ /**
1502
+ * A resource task output's saved `name` when it is not the one compile writes
1503
+ * (`outputRowName`): the author's label, carried with the `source` and `var`
1504
+ * it was saved beside (`label` on `PreservedOutputRow`). Example:
1505
+ * `{ name: 'ReworkCount', source: '=js:(vars.reworkCount || 0) + 1', var: 'reworkCount' }`,
1506
+ * which compile would name `reworkCount`. Without it the row came back under
1507
+ * compile's name and its carried `displayName` (keyed by the saved name) was lost.
1508
+ */
1509
+ function resourceOutputLabel(task, row) {
1510
+ if (!ownEntry(TASK_KIND_METHOD, task.type) || row.custom === true)
1511
+ return {};
1512
+ if (typeof row.name !== 'string' || typeof row.source !== 'string' || typeof row.var !== 'string')
1513
+ return {};
1514
+ return row.name === outputRowName(row.source, row.var) ? {} : { label: { source: row.source, var: row.var } };
1515
+ }
1501
1516
  function resourceRowShape(task, row, side) {
1502
1517
  if (!ownEntry(TASK_KIND_METHOD, task.type) || row.custom === true)
1503
1518
  return {};
@@ -2801,6 +2816,7 @@ function identityPreservation(plan) {
2801
2816
  ...actionOutputShape(task, row),
2802
2817
  ...resourceRowShape(task, row, 'outputs'),
2803
2818
  ...resourceOutputValue(task, row),
2819
+ ...resourceOutputLabel(task, row),
2804
2820
  ...customRowIdentity(task, row, plan),
2805
2821
  ...interleavedCustomSource(task, row),
2806
2822
  ...rowHoldsSavedTaskElementId(stage, task, row),
@@ -47,6 +47,24 @@ export declare const CASE_NODE_CANVAS_FIELDS: readonly ["selected", "dragging",
47
47
  */
48
48
  export declare const RESOURCE_INPUT_WRITTEN: ReadonlySet<string>;
49
49
  export declare const RESOURCE_OUTPUT_WRITTEN: ReadonlySet<string>;
50
+ /**
51
+ * The `name` compile writes on the task output row that reads `source` into
52
+ * `variable` (`emitTaskOutput`): a connector result field's path under
53
+ * `response` (`=response.CreatedBy.Id` is `CreatedBy.Id`), else the path's
54
+ * last segment (`=Decision.output` is `output`, `=APIOutput1` is
55
+ * `APIOutput1`). A `=js:` expression is no field path, so its row is named
56
+ * after the variable it writes: `reworkCount: '=js:(vars.reworkCount || 0) + 1'`
57
+ * is `reworkCount`, not the expression's text after its last dot.
58
+ *
59
+ * The Case Designer names a connector task's extract after the field's path
60
+ * in the response, so one task that reads `CreatedBy.Id`, `Id` and
61
+ * `UpdatedBy.Id` has three rows with three names. The last segment would name
62
+ * all three `Id`.
63
+ *
64
+ * Decompile reads this too: a saved row whose `name` is not this one carries
65
+ * it (`label` on `PreservedOutputRow`).
66
+ */
67
+ export declare function outputRowName(source: string, variable: string): string;
50
68
  /** Whether `.inputs()` types an input's `required` (a boolean) or `default` (a string, number, boolean or null). */
51
69
  export declare function isTypedInputField(key: 'required' | 'default', value: unknown): boolean;
52
70
  /**
@@ -372,6 +390,18 @@ export interface PreservedOutputRow {
372
390
  value: unknown;
373
391
  var: string;
374
392
  };
393
+ /**
394
+ * A resource task output saved with a `name` that is not the one compile
395
+ * writes (`outputRowName`), with the `source` and `var` it was saved beside.
396
+ * The row's label is the author's, which `.outputs()` has no slot for:
397
+ * `{ name: 'ReworkCount', source: '=js:(vars.reworkCount || 0) + 1', var: 'reworkCount' }`.
398
+ * Compile writes this entry's `name` back while the row still reads that
399
+ * source into that variable; an edit to either takes compile's name.
400
+ */
401
+ label?: {
402
+ source: string;
403
+ var: string;
404
+ };
375
405
  }
376
406
  /**
377
407
  * Non-authoring Case JSON lanes retained by decompile/recompile.
@@ -53,6 +53,31 @@ export const CASE_NODE_CANVAS_FIELDS = ['selected', 'dragging', 'extent'];
53
53
  */
54
54
  export const RESOURCE_INPUT_WRITTEN = new Set(['name', 'type', 'id', 'var', 'elementId', 'value', 'required', 'default']);
55
55
  export const RESOURCE_OUTPUT_WRITTEN = new Set(['name', 'type', 'id', 'var', 'originalVar', 'value', 'source', 'target', 'elementId']);
56
+ /**
57
+ * The `name` compile writes on the task output row that reads `source` into
58
+ * `variable` (`emitTaskOutput`): a connector result field's path under
59
+ * `response` (`=response.CreatedBy.Id` is `CreatedBy.Id`), else the path's
60
+ * last segment (`=Decision.output` is `output`, `=APIOutput1` is
61
+ * `APIOutput1`). A `=js:` expression is no field path, so its row is named
62
+ * after the variable it writes: `reworkCount: '=js:(vars.reworkCount || 0) + 1'`
63
+ * is `reworkCount`, not the expression's text after its last dot.
64
+ *
65
+ * The Case Designer names a connector task's extract after the field's path
66
+ * in the response, so one task that reads `CreatedBy.Id`, `Id` and
67
+ * `UpdatedBy.Id` has three rows with three names. The last segment would name
68
+ * all three `Id`.
69
+ *
70
+ * Decompile reads this too: a saved row whose `name` is not this one carries
71
+ * it (`label` on `PreservedOutputRow`).
72
+ */
73
+ export function outputRowName(source, variable) {
74
+ if (source.startsWith('=js:'))
75
+ return variable;
76
+ const path = source.replace(/^=/, '');
77
+ if (path.startsWith('response.') && path.length > 'response.'.length)
78
+ return path.slice('response.'.length);
79
+ return path.split('.').pop() || source;
80
+ }
56
81
  /** Whether `.inputs()` types an input's `required` (a boolean) or `default` (a string, number, boolean or null). */
57
82
  export function isTypedInputField(key, value) {
58
83
  if (key === 'required')
@@ -418,6 +443,8 @@ export function caseJsonPreservationErrors(payload) {
418
443
  errors.push(...customRowShapeErrors(`task "${task.name}" output "${row.name}"`, row.customRow));
419
444
  if (row.savedSource !== undefined && typeof row.savedSource !== 'string')
420
445
  errors.push(`task "${task.name}" output "${row.name}" savedSource must be a string`);
446
+ if (row.label !== undefined && (!row.label || typeof row.label !== 'object' || typeof row.label.source !== 'string' || typeof row.label.var !== 'string'))
447
+ errors.push(`task "${task.name}" output "${row.name}" label must be an object with "source" and "var" strings`);
421
448
  }
422
449
  for (const id of payload.omitTaskDisplayNames ?? [])
423
450
  if (typeof id !== 'string' || id === '')
@@ -9,7 +9,7 @@
9
9
  * name) are resolved here to the generated ids.
10
10
  */
11
11
  import { IdGen, offlineBindingSeed } from './ids.js';
12
- import { CASE_EMPTY_LISTS, isUnrestorableSlotId, METADATA_ABSENT_READING, planElementIds, STAGE_EMPTY_LISTS, TASK_EMPTY_LISTS, taskFingerprint } from './preserve.js';
12
+ import { CASE_EMPTY_LISTS, isUnrestorableSlotId, METADATA_ABSENT_READING, planElementIds, STAGE_EMPTY_LISTS, TASK_EMPTY_LISTS, taskFingerprint, outputRowName } from './preserve.js';
13
13
  import { v31TaskSets } from './task-sets.js';
14
14
  import { camelizeName, defaultActionOutputVar } from './action-output-var.js';
15
15
  import { ACTION_CONTEXT_COPIES, ACTION_FORM_KIND_CONTEXT, ACTION_PASSTHROUGH_SETTINGS } from './action-settings.js';
@@ -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;
@@ -1719,6 +1735,12 @@ function applyPreservedIdentities(result, preservation, warn) {
1719
1735
  if (target && actionRows && row.bodyCopies?.includes('jsonSchema'))
1720
1736
  rowRenames.push(() => { if (target.body !== undefined)
1721
1737
  target.jsonSchema = structuredClone(target.body); });
1738
+ // A resource output saved with its author's label (`label`) gets it back
1739
+ // while it still reads the saved source into the saved variable, before
1740
+ // its carried fields, which go only onto the row of the saved name.
1741
+ const label = row.label;
1742
+ if (target && !actionRows && label && target.source === label.source && target.var === label.var)
1743
+ target.name = row.name;
1722
1744
  carryRowShape(target, row);
1723
1745
  if (!claimRowId(target, row, currentId))
1724
1746
  deferredClaims.push({ target, row });
@@ -1935,7 +1957,9 @@ function applyPreservedIdentities(result, preservation, warn) {
1935
1957
  // (`applyConnectorRows`), so its id is free for a saved row that carries it.
1936
1958
  // Example: a connector task saved with only its `Error` row compiles with a
1937
1959
  // `response11` row too; the task saved with `response11` takes it back.
1938
- for (const row of droppedConnectorOutputRows(result, preservation.connectorRows))
1960
+ // The rows' variables are read as `rowRenames` will leave them: a built
1961
+ // `Error11` row that took its saved id `error15` writes `error15`.
1962
+ for (const row of droppedConnectorOutputRows(result, preservation.connectorRows, finalVar))
1939
1963
  if (typeof row.id === 'string')
1940
1964
  heldOutputIds.delete(row.id);
1941
1965
  settleDeferredClaims(deferredClaims, heldOutputIds, (target, row) => claimRowId(target, row, target.id));
@@ -3357,7 +3381,7 @@ const OWN_NAME_OUTPUT_ROWS = new WeakSet();
3357
3381
  function emitTaskOutput(o, elementId, ids, seed, resolver) {
3358
3382
  if (o.custom)
3359
3383
  return emitCustomOutput(o, resolver);
3360
- const field = outputRowName(o.source);
3384
+ const field = outputRowName(o.source, o.var);
3361
3385
  // A reassigned row registers the readable companion once (declared vars take
3362
3386
  // precedence in the merge); an own-name row is the variable and registers none.
3363
3387
  const companion = () => {
@@ -4083,23 +4107,6 @@ function isOwnNameOutput(o) {
4083
4107
  // (builder-sdk#1241).
4084
4108
  return keepsOwnSourceName(o.var, o.source);
4085
4109
  }
4086
- /**
4087
- * The `name` of the row that reads `source`: a connector result field's path
4088
- * under `response` (`=response.CreatedBy.Id` is `CreatedBy.Id`), else the
4089
- * path's last segment (`=Decision.output` is `output`, `=APIOutput1` is
4090
- * `APIOutput1`).
4091
- *
4092
- * The Case Designer names a connector task's extract after the field's path
4093
- * in the response, so one task that reads `CreatedBy.Id`, `Id` and
4094
- * `UpdatedBy.Id` has three rows with three names. The last segment would name
4095
- * all three `Id`.
4096
- */
4097
- function outputRowName(source) {
4098
- const path = source.replace(/^=/, '');
4099
- if (path.startsWith('response.') && path.length > 'response.'.length)
4100
- return path.slice('response.'.length);
4101
- return path.split('.').pop() || source;
4102
- }
4103
4110
  /**
4104
4111
  * Whether variable `name` is the own name of the field `source` reads: the
4105
4112
  * path's last segment (`keepsOwnName`, `=response.app_id` into `app_id`), or,
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.21",
3
+ "version": "6.120.23",
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": "e6178daa6ae6b993efc27cf07a2ed1d9b21a9e23"
127
+ "gitref": "e45eca9991259b8d4d10fede3a8c1c2e67ed6d0a"
128
128
  }