@uipath/maestro-builder-sdk 6.120.14 → 6.120.15

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.
@@ -266,6 +266,12 @@ type Preservation = {
266
266
  fields: Record<string, unknown>;
267
267
  keys: string[];
268
268
  }>;
269
+ strayTriggerRows?: Array<{
270
+ trigger: string;
271
+ index: number;
272
+ row: Record<string, unknown>;
273
+ dangling?: true;
274
+ }>;
269
275
  omitMetadata?: Array<'caseAppEnabled' | 'caseIdentifierType' | 'publishVersion' | 'intsvcActivityConfig'>;
270
276
  publishVersion?: number;
271
277
  nodeFields?: Record<string, Record<string, unknown>>;
@@ -2061,6 +2061,45 @@ function bridgeFields(plan) {
2061
2061
  return [{ slot: input.id, trigger: node.id, fields, keys: Object.keys(row) }];
2062
2062
  });
2063
2063
  }
2064
+ /**
2065
+ * The rows of a manual or timer trigger's `outputs` that are not an In-arg
2066
+ * bridge compile writes, each with the trigger's id and its index there.
2067
+ * Compile writes such a trigger's outputs as exactly one bridge row per In-arg
2068
+ * bound to it (`{ source: "=vars.<slot>" }`), and its source (`manualTrigger()`,
2069
+ * `timerTrigger()`) has no outputs to declare. A Studio Web plan can hold
2070
+ * others: a stale bridge whose slot the In-arg no longer has, or a second row
2071
+ * reading the same slot. Without this they were dropped on the round trip.
2072
+ * An event trigger's other rows are its declared `outputs` instead.
2073
+ *
2074
+ * A row whose source is not the slot of one of the trigger's In-args (or has no
2075
+ * source) is recorded `dangling: true`: compile restores it as is. A row that
2076
+ * reads a live In-arg slot is restored only while that slot is still an In-arg
2077
+ * of the trigger, so an edit that deletes or renames the In-arg drops it.
2078
+ *
2079
+ * Example: In-arg `PRODUCER` on slot `vNew` and the trigger row `{ name:
2080
+ * "PRODUCER", source: "=vars.vOld", var: "producer" }` records `{ trigger,
2081
+ * index: 1, row, dangling: true }` (and `PRODUCER` is also an unbridged In-arg).
2082
+ */
2083
+ function strayTriggerRows(plan) {
2084
+ return (plan.nodes ?? []).filter(isTrigger).flatMap((node) => {
2085
+ const bag = triggerData(node).bag;
2086
+ if (typeof node.id !== 'string' || !Array.isArray(bag?.outputs) || bag.serviceType === 'Intsvc.EventTrigger')
2087
+ return [];
2088
+ const slots = new Set((plan.variables?.inputs ?? [])
2089
+ .filter((input) => input.elementId === node.id && typeof input.id === 'string')
2090
+ .map((input) => `=vars.${input.id}`));
2091
+ const bridged = new Set();
2092
+ return bag.outputs.flatMap((row, index) => {
2093
+ const source = typeof row?.source === 'string' ? row.source : undefined;
2094
+ if (source !== undefined && slots.has(source) && !bridged.has(source)) {
2095
+ bridged.add(source);
2096
+ return [];
2097
+ }
2098
+ const dangling = source === undefined || !slots.has(source);
2099
+ return [{ trigger: node.id, index, row: row, ...(dangling ? { dangling: true } : {}) }];
2100
+ });
2101
+ });
2102
+ }
2064
2103
  function emitVariables(out, depth, plan, triggerNameById, triggerIsTimer) {
2065
2104
  const variables = plan.variables ?? {};
2066
2105
  const produced = producedVariableNames(plan);
@@ -3321,6 +3360,9 @@ export function collectPreservation(plan) {
3321
3360
  const bridged = bridgeFields(plan);
3322
3361
  if (bridged.length)
3323
3362
  preservation.bridgeFields = bridged;
3363
+ const stray = strayTriggerRows(plan);
3364
+ if (stray.length)
3365
+ preservation.strayTriggerRows = stray;
3324
3366
  if (Object.keys(variableFields).length)
3325
3367
  preservation.variableFields = variableFields;
3326
3368
  if (Object.keys(legacyVariableDefaults).length)
@@ -444,6 +444,21 @@ export interface CaseJsonPreservation {
444
444
  fields: Record<string, unknown>;
445
445
  keys: string[];
446
446
  }>;
447
+ /**
448
+ * Rows of a manual or timer trigger's `outputs` that are not a bridge row
449
+ * compile writes (a stale bridge whose slot is gone, a second row reading a
450
+ * slot), verbatim, with the trigger's id and the row's index. `dangling`
451
+ * marks a row whose source named no In-arg slot of the trigger at decompile.
452
+ * Compile puts each back at its index while the trigger is still in the
453
+ * plan, and a row that is not `dangling` only while its source slot is still
454
+ * an In-arg of that trigger (an edit that deletes or renames it drops the row).
455
+ */
456
+ strayTriggerRows?: Array<{
457
+ trigger: string;
458
+ index: number;
459
+ row: Record<string, unknown>;
460
+ dangling?: true;
461
+ }>;
447
462
  /**
448
463
  * Opaque V30 layout side-car. Decompile folds a node's inline
449
464
  * {@link CASE_NODE_LAYOUT_FIELDS} into it, the platform's disk form.
@@ -369,6 +369,12 @@ export function caseJsonPreservationErrors(payload) {
369
369
  && !['name', 'type', 'source', 'var'].some((key) => Object.prototype.hasOwnProperty.call(entry.fields, key))
370
370
  && Array.isArray(entry.keys) && entry.keys.every((key) => typeof key === 'string'))))
371
371
  errors.push('preserved "bridgeFields" must be an array of { slot, trigger, fields, keys } carrying no compiled bridge field');
372
+ if (payload.strayTriggerRows !== undefined
373
+ && (!Array.isArray(payload.strayTriggerRows) || !payload.strayTriggerRows.every((entry) => entry !== null && typeof entry === 'object'
374
+ && typeof entry.trigger === 'string' && entry.trigger !== '' && Number.isInteger(entry.index) && entry.index >= 0
375
+ && entry.row !== null && typeof entry.row === 'object' && !Array.isArray(entry.row)
376
+ && (entry.dangling === undefined || entry.dangling === true))))
377
+ errors.push('preserved "strayTriggerRows" must be an array of { trigger, index, row, dangling? } with a non-empty trigger id, an index >= 0, an object row and dangling absent or true');
372
378
  if (payload.legacyTriggerIds !== undefined
373
379
  && (!Array.isArray(payload.legacyTriggerIds) || !payload.legacyTriggerIds.every((id) => typeof id === 'string')))
374
380
  errors.push('preserved "legacyTriggerIds" must be an array of trigger id strings');
@@ -722,6 +722,25 @@ export function applyPreservation(result, preservation, options = {}) {
722
722
  ordered[key] = merged[key];
723
723
  rows[at] = ordered;
724
724
  }
725
+ // A manual or timer trigger's rows that are not a bridge compile writes, back
726
+ // at their saved index, while the trigger is still in the plan. A row that
727
+ // read a live In-arg slot comes back only while that slot is still an In-arg
728
+ // of the trigger: an edit that deletes or renames the In-arg drops it instead
729
+ // of leaving a dangling bridge. One already dangling at decompile comes back.
730
+ for (const { trigger, index, row, dangling } of [...(preservation.strayTriggerRows ?? [])].sort((a, b) => a.index - b.index)) {
731
+ const node = result.nodes.find((candidate) => candidate.id === trigger);
732
+ if (!node)
733
+ continue;
734
+ if (dangling !== true && !(variables.inputs ?? []).some((input) => input.elementId === trigger
735
+ && typeof input.id === 'string' && row.source === `=vars.${input.id}`))
736
+ continue;
737
+ const data = (node.data ??= {});
738
+ const bag = (data[CASE_FORMAT_PROFILE.triggerBagField] ??= {});
739
+ if (bag.serviceType === 'Intsvc.EventTrigger')
740
+ continue;
741
+ const outputs = Array.isArray(bag.outputs) ? bag.outputs : (bag.outputs = []);
742
+ outputs.splice(Math.min(index, outputs.length), 0, structuredClone(row));
743
+ }
725
744
  for (const name of preservation.omitInputDefaults ?? []) {
726
745
  const row = (variables.inputs ?? []).find((candidate) => candidate.name === name);
727
746
  if (row?.default === '')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.120.14",
3
+ "version": "6.120.15",
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": "b126ca0f2e2b557042de4037b6241d75c08e5265"
127
+ "gitref": "d8e9380893de16cc624003c948360cd9f3f82c3a"
128
128
  }