@uipath/maestro-builder-sdk 6.120.13 → 6.120.14

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.
@@ -260,6 +260,12 @@ type Preservation = {
260
260
  trigger: string;
261
261
  companion?: string;
262
262
  }>;
263
+ bridgeFields?: Array<{
264
+ slot: string;
265
+ trigger: string;
266
+ fields: Record<string, unknown>;
267
+ keys: string[];
268
+ }>;
263
269
  omitMetadata?: Array<'caseAppEnabled' | 'caseIdentifierType' | 'publishVersion' | 'intsvcActivityConfig'>;
264
270
  publishVersion?: number;
265
271
  nodeFields?: Record<string, Record<string, unknown>>;
@@ -2036,6 +2036,31 @@ function triggerlessInArgs(plan) {
2036
2036
  return [{ name: input.name, elementId: input.elementId, trigger, ...(companion !== undefined ? { companion } : {}) }];
2037
2037
  });
2038
2038
  }
2039
+ /** The fields compile writes on a bridge row (`appendTriggerBridge` in serialize.ts). */
2040
+ const BRIDGE_ROW_FIELDS = new Set(['name', 'type', 'source', 'var']);
2041
+ /**
2042
+ * Each In-arg bridge row that carries a field compile does not write (Studio
2043
+ * Web saves an array In-arg's bridge with the In-arg's `subType`), keyed by the
2044
+ * In-arg's slot id and its trigger, with the row's key order.
2045
+ *
2046
+ * Example: `{ name: "Items", type: "array", subType: "string", source: "=vars.vX", var: "items" }`
2047
+ * records `{ slot: "vX", trigger: "trigger_1", fields: { subType: "string" }, keys: [...] }`.
2048
+ */
2049
+ function bridgeFields(plan) {
2050
+ const triggers = new Map((plan.nodes ?? []).filter(isTrigger).map((node) => [node.id, node]));
2051
+ return (plan.variables?.inputs ?? []).flatMap((input) => {
2052
+ const node = typeof input.elementId === 'string' ? triggers.get(input.elementId) : undefined;
2053
+ if (!node || typeof node.id !== 'string' || typeof input.id !== 'string')
2054
+ return [];
2055
+ const row = (triggerData(node).bag?.outputs ?? []).find((candidate) => candidate?.source === `=vars.${input.id}`);
2056
+ if (!row)
2057
+ return [];
2058
+ const fields = Object.fromEntries(Object.entries(row).filter(([key]) => !BRIDGE_ROW_FIELDS.has(key)));
2059
+ if (!Object.keys(fields).length)
2060
+ return [];
2061
+ return [{ slot: input.id, trigger: node.id, fields, keys: Object.keys(row) }];
2062
+ });
2063
+ }
2039
2064
  function emitVariables(out, depth, plan, triggerNameById, triggerIsTimer) {
2040
2065
  const variables = plan.variables ?? {};
2041
2066
  const produced = producedVariableNames(plan);
@@ -3293,6 +3318,9 @@ export function collectPreservation(plan) {
3293
3318
  const triggerless = triggerlessInArgs(plan);
3294
3319
  if (triggerless.length)
3295
3320
  preservation.triggerlessInArgs = triggerless;
3321
+ const bridged = bridgeFields(plan);
3322
+ if (bridged.length)
3323
+ preservation.bridgeFields = bridged;
3296
3324
  if (Object.keys(variableFields).length)
3297
3325
  preservation.variableFields = variableFields;
3298
3326
  if (Object.keys(legacyVariableDefaults).length)
@@ -432,6 +432,18 @@ export interface CaseJsonPreservation {
432
432
  trigger: string;
433
433
  companion?: string;
434
434
  }>;
435
+ /**
436
+ * In-arg bridge rows that carried fields compile does not write (an array
437
+ * In-arg's `subType`), keyed by the In-arg's slot id and trigger, with the
438
+ * row's key order. Compile puts the fields back on that In-arg's bridge row
439
+ * only while the In-arg is still bound to that trigger.
440
+ */
441
+ bridgeFields?: Array<{
442
+ slot: string;
443
+ trigger: string;
444
+ fields: Record<string, unknown>;
445
+ keys: string[];
446
+ }>;
435
447
  /**
436
448
  * Opaque V30 layout side-car. Decompile folds a node's inline
437
449
  * {@link CASE_NODE_LAYOUT_FIELDS} into it, the platform's disk form.
@@ -362,6 +362,13 @@ export function caseJsonPreservationErrors(payload) {
362
362
  && (entry.companion === undefined || (typeof entry.companion === 'string' && entry.companion !== ''))
363
363
  && Object.keys(entry).every((key) => ['name', 'elementId', 'trigger', 'companion'].includes(key)))))
364
364
  errors.push('preserved "triggerlessInArgs" must be an array of { name, elementId, trigger, companion? } with non-empty strings, elementId not the trigger');
365
+ if (payload.bridgeFields !== undefined
366
+ && (!Array.isArray(payload.bridgeFields) || !payload.bridgeFields.every((entry) => entry !== null && typeof entry === 'object'
367
+ && typeof entry.slot === 'string' && entry.slot !== '' && typeof entry.trigger === 'string' && entry.trigger !== ''
368
+ && entry.fields !== null && typeof entry.fields === 'object' && !Array.isArray(entry.fields)
369
+ && !['name', 'type', 'source', 'var'].some((key) => Object.prototype.hasOwnProperty.call(entry.fields, key))
370
+ && Array.isArray(entry.keys) && entry.keys.every((key) => typeof key === 'string'))))
371
+ errors.push('preserved "bridgeFields" must be an array of { slot, trigger, fields, keys } carrying no compiled bridge field');
365
372
  if (payload.legacyTriggerIds !== undefined
366
373
  && (!Array.isArray(payload.legacyTriggerIds) || !payload.legacyTriggerIds.every((id) => typeof id === 'string')))
367
374
  errors.push('preserved "legacyTriggerIds" must be an array of trigger id strings');
@@ -704,6 +704,24 @@ export function applyPreservation(result, preservation, options = {}) {
704
704
  delete node.data[CASE_FORMAT_PROFILE.triggerBagField];
705
705
  }
706
706
  restoreTriggerlessInArgs(result, preservation.triggerlessInArgs);
707
+ // A bridge row's Designer-saved fields (an array In-arg's `subType`), in the
708
+ // row's saved key order, while the In-arg is still bound to that trigger.
709
+ for (const { slot, trigger, fields, keys } of preservation.bridgeFields ?? []) {
710
+ const input = (variables.inputs ?? []).find((candidate) => candidate.id === slot);
711
+ if (!input || input.elementId !== trigger)
712
+ continue;
713
+ const node = result.nodes.find((candidate) => candidate.id === trigger);
714
+ const rows = node?.data?.[CASE_FORMAT_PROFILE.triggerBagField]?.outputs;
715
+ const at = Array.isArray(rows) ? rows.findIndex((row) => row?.source === `=vars.${slot}`) : -1;
716
+ if (at < 0)
717
+ continue;
718
+ const merged = { ...rows[at], ...fields };
719
+ const ordered = {};
720
+ for (const key of [...keys, ...Object.keys(merged)])
721
+ if (key in merged && !(key in ordered))
722
+ ordered[key] = merged[key];
723
+ rows[at] = ordered;
724
+ }
707
725
  for (const name of preservation.omitInputDefaults ?? []) {
708
726
  const row = (variables.inputs ?? []).find((candidate) => candidate.name === name);
709
727
  if (row?.default === '')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.120.13",
3
+ "version": "6.120.14",
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": "265277b8bbf1f2fb15a625631533026b7a7ca33c"
127
+ "gitref": "b126ca0f2e2b557042de4037b6241d75c08e5265"
128
128
  }