@uipath/maestro-builder-sdk 6.120.21 → 6.120.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.
@@ -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';
@@ -1719,6 +1719,12 @@ function applyPreservedIdentities(result, preservation, warn) {
1719
1719
  if (target && actionRows && row.bodyCopies?.includes('jsonSchema'))
1720
1720
  rowRenames.push(() => { if (target.body !== undefined)
1721
1721
  target.jsonSchema = structuredClone(target.body); });
1722
+ // A resource output saved with its author's label (`label`) gets it back
1723
+ // while it still reads the saved source into the saved variable, before
1724
+ // its carried fields, which go only onto the row of the saved name.
1725
+ const label = row.label;
1726
+ if (target && !actionRows && label && target.source === label.source && target.var === label.var)
1727
+ target.name = row.name;
1722
1728
  carryRowShape(target, row);
1723
1729
  if (!claimRowId(target, row, currentId))
1724
1730
  deferredClaims.push({ target, row });
@@ -3357,7 +3363,7 @@ const OWN_NAME_OUTPUT_ROWS = new WeakSet();
3357
3363
  function emitTaskOutput(o, elementId, ids, seed, resolver) {
3358
3364
  if (o.custom)
3359
3365
  return emitCustomOutput(o, resolver);
3360
- const field = outputRowName(o.source);
3366
+ const field = outputRowName(o.source, o.var);
3361
3367
  // A reassigned row registers the readable companion once (declared vars take
3362
3368
  // precedence in the merge); an own-name row is the variable and registers none.
3363
3369
  const companion = () => {
@@ -4083,23 +4089,6 @@ function isOwnNameOutput(o) {
4083
4089
  // (builder-sdk#1241).
4084
4090
  return keepsOwnSourceName(o.var, o.source);
4085
4091
  }
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
4092
  /**
4104
4093
  * Whether variable `name` is the own name of the field `source` reads: the
4105
4094
  * path's last segment (`keepsOwnName`, `=response.app_id` into `app_id`), or,
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.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",
@@ -124,5 +124,5 @@
124
124
  "@types/node": "^22.7.0",
125
125
  "esbuild": "^0.28.1"
126
126
  },
127
- "gitref": "e6178daa6ae6b993efc27cf07a2ed1d9b21a9e23"
127
+ "gitref": "3631ba8b929fc9aa1c002841bb812003ee4c4d74"
128
128
  }