@uipath/maestro-builder-sdk 6.50.1 → 6.50.2

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.
@@ -914,7 +914,10 @@ function producedVariableNames(plan) {
914
914
  continue;
915
915
  for (const lane of node.data?.tasks ?? [])
916
916
  for (const task of lane) {
917
- if (ownEntry(TASK_KIND_METHOD, task.type)) {
917
+ if (ownEntry(TASK_KIND_METHOD, task.type) || task.type === 'action') {
918
+ // An action form output (`{ name, value }`) produces its variable as a
919
+ // reference-task output does, so an older plan's root companion for it
920
+ // is not re-declared as a `.var()` (the recompile writes none).
918
921
  for (const row of task.data?.outputs ?? [])
919
922
  if (row.var)
920
923
  produced.add(row.var);
@@ -86,6 +86,7 @@ export function serialize(built, opts = {}) {
86
86
  ids,
87
87
  offlineBindingIds: new Map(),
88
88
  varCompanions: new Map(),
89
+ ownNameRows: new Map(),
89
90
  outputIds: new Set(),
90
91
  ownOutputVars: ownOutputVars(built),
91
92
  slaId: new Map(),
@@ -230,14 +231,26 @@ export function serialize(built, opts = {}) {
230
231
  throw new Error(problem.message);
231
232
  metadata.businessEvents = built.businessEvents.map(emitBusinessEvent);
232
233
  }
233
- // Variables: declared vars + the readable companions that task outputs bound
234
- // (collected during stage emission above). A declared var wins on a name clash.
234
+ // Variables: declared vars + the readable companions that REASSIGNED task
235
+ // outputs bound (collected during stage emission above). A declared var wins
236
+ // on a name clash. An own-name output (`id == var`) writes no root entry: like
237
+ // the Designer, the output row is itself the variable `=vars.<id>` reads.
235
238
  const variables = emitVariables(built.vars, ids, triggerNodeByRef);
236
239
  const inputOutputs = variables.inputOutputs;
237
240
  const declared = new Set(inputOutputs.map((e) => e.id));
238
241
  for (const [name, companion] of resolver.varCompanions)
239
242
  if (!declared.has(name))
240
243
  inputOutputs.push(companion);
244
+ // An own-name row that writes a variable which DOES have a root entry (a
245
+ // declared `.var()`, or a companion another, reassigned, writer needed) is the
246
+ // v1 skill's "controlled alias": `originalVar == id` tells the Designer the row
247
+ // feeds that existing variable, so it keeps the root entry instead of minting
248
+ // a second variable under the same name.
249
+ const rootIds = new Set(inputOutputs.map((e) => e.id));
250
+ for (const [name, rows] of resolver.ownNameRows)
251
+ if (rootIds.has(name))
252
+ for (const row of rows)
253
+ row.originalVar = row.id;
241
254
  const result = {
242
255
  id: caseId,
243
256
  name: built.name,
@@ -1164,7 +1177,11 @@ function emitActionField(f, outputElementId, resolver) {
1164
1177
  row.source = `=${f.name}`;
1165
1178
  row.target = `=${id}`;
1166
1179
  row.elementId = outputElementId;
1167
- if (resolver && !resolver.varCompanions.has(f.value)) {
1180
+ // `id == value`: the row is the variable (the Designer writes no root entry
1181
+ // for it). Only a suffixed, reassigned row needs the readable companion.
1182
+ if (resolver && id === f.value)
1183
+ addOwnNameRow(resolver, f.value, row);
1184
+ else if (resolver && !resolver.varCompanions.has(f.value)) {
1168
1185
  resolver.varCompanions.set(f.value, {
1169
1186
  id: f.value,
1170
1187
  name: f.value,
@@ -1209,18 +1226,24 @@ const OWN_NAME_OUTPUT_ROWS = new WeakSet();
1209
1226
  function emitTaskOutput(o, elementId, ids, seed, resolver) {
1210
1227
  const path = o.source.replace(/^=/, '');
1211
1228
  const field = path.split('.').pop() || o.source;
1212
- // Register the readable companion once (declared vars take precedence in the merge).
1213
- if (!resolver.varCompanions.has(o.var))
1214
- resolver.varCompanions.set(o.var, { id: o.var, name: o.var, type: o.type, elementId: 'root', custom: true });
1229
+ // A reassigned row registers the readable companion once (declared vars take
1230
+ // precedence in the merge); an own-name row is the variable and registers none.
1231
+ const companion = () => {
1232
+ if (!resolver.varCompanions.has(o.var))
1233
+ resolver.varCompanions.set(o.var, { id: o.var, name: o.var, type: o.type, elementId: 'root', custom: true });
1234
+ };
1215
1235
  if (isOwnNameOutput(o)) {
1216
1236
  const id = claimOutputId(resolver, o.var);
1217
1237
  if (id === o.var) {
1218
1238
  const row = { name: field, type: o.type, id, var: o.var, value: o.var, source: o.source, target: `=${id}`, elementId };
1219
1239
  OWN_NAME_OUTPUT_ROWS.add(row);
1240
+ addOwnNameRow(resolver, o.var, row);
1220
1241
  return row;
1221
1242
  }
1243
+ companion();
1222
1244
  return { name: field, type: o.type, id, var: o.var, originalVar: id, value: o.var, source: o.source, target: `=${id}`, elementId };
1223
1245
  }
1246
+ companion();
1224
1247
  const slot = claimOutputId(resolver, ids.make('o', 8, seed));
1225
1248
  return {
1226
1249
  name: field,
@@ -1600,6 +1623,14 @@ function connectorMetadata(rc, op, executionType) {
1600
1623
  function connectorOutputVar(resolver, base) {
1601
1624
  return claimOutputId(resolver, base);
1602
1625
  }
1626
+ /** Record an own-name row (`id == var`), the variable itself; see the variables merge in `serialize`. */
1627
+ function addOwnNameRow(resolver, name, row) {
1628
+ const rows = resolver.ownNameRows.get(name);
1629
+ if (rows)
1630
+ rows.push(row);
1631
+ else
1632
+ resolver.ownNameRows.set(name, [row]);
1633
+ }
1603
1634
  /**
1604
1635
  * Claim a task-output row id from the document-wide pool, the Designer's
1605
1636
  * uniqueness rule: the first claimant of `base` gets `base`, later ones get
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.50.1",
3
+ "version": "6.50.2",
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",
@@ -92,5 +92,5 @@
92
92
  "@types/node": "^22.7.0",
93
93
  "esbuild": "^0.28.1"
94
94
  },
95
- "gitref": "3b0f8b3f6e84465828936a6242656c563947c74d"
95
+ "gitref": "a0ed06f0dddc98064867948988de27e22e280501"
96
96
  }