@uipath/maestro-builder-sdk 6.120.9 → 6.120.10

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.
@@ -58,6 +58,20 @@ export declare function caseConnectorRowOwners(plan: Record<string, any>): Array
58
58
  * field. Else `undefined`.
59
59
  */
60
60
  export declare function savedConnectorRows(owner: string, bag: Record<string, any>, elementIds?: readonly string[]): PreservedConnectorRows | undefined;
61
+ /**
62
+ * The own output rows compile built that {@link applyConnectorRows} drops: on an
63
+ * element saved without that row (`Error` only, say), while it calls the same
64
+ * operation, and while {@link outputsBack} writes the saved rows back (the
65
+ * same {@link outputsDiverge} check). Compile numbered them like any other row
66
+ * (`response11`), so until they are dropped they hold an id a saved row may
67
+ * carry. Called before those claims settle, once the element ids are the plan's
68
+ * own; a claim left to settle only moves a row to its saved id, so a counterpart
69
+ * that matches here still matches when the rows go back. Where the two checks
70
+ * could still disagree (a root companion added after this call), this one says
71
+ * the rows diverge, so the id stays held: a dropped row then keeps its id
72
+ * unused, but no two rows hold one.
73
+ */
74
+ export declare function droppedConnectorOutputRows(result: Record<string, any>, entries: readonly PreservedConnectorRows[] | undefined): Array<Record<string, unknown>>;
61
75
  /**
62
76
  * Write each element's saved own rows back over the ones compile built, half
63
77
  * by half, while they still describe the element. Runs after the ids are
@@ -307,14 +307,24 @@ function sameOperation(bag, entry) {
307
307
  return OPERATION_ROWS.every((name) => !comparesContextRow(bag, name) || now[name] === entry.operation[name]);
308
308
  }
309
309
  /**
310
- * The saved outputs over the built ones: the saved own rows in saved order,
311
- * where compile put its first own row, around the rows compile writes for the
312
- * author; a built own row the element was saved without is dropped. Nothing,
313
- * when a saved row's counterpart writes another variable.
310
+ * A saved own row's counterpart among the built own rows: a built row that
311
+ * reads its source, one that also writes its variable when there is one, and
312
+ * of those the one with its id, else the last.
313
+ */
314
+ function counterpartOf(builtOwn, row) {
315
+ const reading = builtOwn.filter((candidate) => candidate.source === row.source);
316
+ const writing = reading.filter((candidate) => row.var !== undefined && candidate.var === row.var);
317
+ const pool = writing.length ? writing : reading;
318
+ return pool.find((candidate) => candidate.id === row.id) ?? pool.at(-1);
319
+ }
320
+ /**
321
+ * Whether the saved outputs no longer describe the built ones: a saved row's
322
+ * counterpart has another id, or writes another variable (and is not the own
323
+ * row the Designer reassigned to a case variable, `reassignedToCaseVariable`).
324
+ * Then {@link outputsBack} writes nothing back and every built row stays, so
325
+ * {@link droppedConnectorOutputRows} frees none of their ids.
314
326
  *
315
- * A saved row's counterpart is a built row that reads its source: one that
316
- * also writes its variable when there is one, and of those the one with its
317
- * id, else the last. An event trigger's `outputs`
327
+ * An event trigger's `outputs`
318
328
  * (`outputs: { responseRow: { source: '=response' } }`) compile writes as
319
329
  * extracts beside the trigger's own rows, with the same source and no id; the
320
330
  * Designer saves the trigger's own row reassigned instead (`{ id:
@@ -323,24 +333,27 @@ function sameOperation(bag, entry) {
323
333
  * counterpart, and having no id it says nothing about renumbering, so the
324
334
  * ids are compared only when the counterpart has one.
325
335
  */
326
- function outputsBack(built, set, caseVariables) {
327
- const builtOwn = built.filter(isOwnOutput);
328
- const counterpartOf = (row) => {
329
- const reading = builtOwn.filter((candidate) => candidate.source === row.source);
330
- const writing = reading.filter((candidate) => row.var !== undefined && candidate.var === row.var);
331
- const pool = writing.length ? writing : reading;
332
- return pool.find((candidate) => candidate.id === row.id) ?? pool.at(-1);
333
- };
334
- for (const row of set.rows) {
335
- const counterpart = counterpartOf(row);
336
+ function outputsDiverge(builtOwn, set, caseVariables) {
337
+ return set.rows.some((row) => {
338
+ const counterpart = counterpartOf(builtOwn, row);
336
339
  if (!counterpart)
337
- continue;
340
+ return false;
338
341
  if (counterpart.id !== undefined && counterpart.id !== row.id)
339
- return undefined;
340
- if (row.var !== undefined && counterpart.var !== row.var && !reassignedToCaseVariable(row, counterpart, caseVariables))
341
- return undefined;
342
- }
343
- const own = set.rows.flatMap((row) => (counterpartOf(row) ? [structuredClone(row)] : []));
342
+ return true;
343
+ return row.var !== undefined && counterpart.var !== row.var && !reassignedToCaseVariable(row, counterpart, caseVariables);
344
+ });
345
+ }
346
+ /**
347
+ * The saved outputs over the built ones: the saved own rows in saved order,
348
+ * where compile put its first own row, around the rows compile writes for the
349
+ * author; a built own row the element was saved without is dropped. Nothing,
350
+ * when the saved rows no longer describe the built ones ({@link outputsDiverge}).
351
+ */
352
+ function outputsBack(built, set, caseVariables) {
353
+ const builtOwn = built.filter(isOwnOutput);
354
+ if (outputsDiverge(builtOwn, set, caseVariables))
355
+ return undefined;
356
+ const own = set.rows.flatMap((row) => (counterpartOf(builtOwn, row) ? [structuredClone(row)] : []));
344
357
  const firstOwn = built.findIndex(isOwnOutput);
345
358
  const others = built.filter((row) => !isOwnOutput(row));
346
359
  const at = firstOwn < 0 ? 0 : firstOwn;
@@ -390,6 +403,38 @@ function inputsBack(built, set) {
390
403
  }
391
404
  return structuredClone(set.rows);
392
405
  }
406
+ /**
407
+ * The own output rows compile built that {@link applyConnectorRows} drops: on an
408
+ * element saved without that row (`Error` only, say), while it calls the same
409
+ * operation, and while {@link outputsBack} writes the saved rows back (the
410
+ * same {@link outputsDiverge} check). Compile numbered them like any other row
411
+ * (`response11`), so until they are dropped they hold an id a saved row may
412
+ * carry. Called before those claims settle, once the element ids are the plan's
413
+ * own; a claim left to settle only moves a row to its saved id, so a counterpart
414
+ * that matches here still matches when the rows go back. Where the two checks
415
+ * could still disagree (a root companion added after this call), this one says
416
+ * the rows diverge, so the id stays held: a dropped row then keeps its id
417
+ * unused, but no two rows hold one.
418
+ */
419
+ export function droppedConnectorOutputRows(result, entries) {
420
+ if (!entries?.length)
421
+ return [];
422
+ const byOwner = new Map(entries.map((entry) => [entry.owner, entry]));
423
+ const caseVariables = caseVariableIds(result);
424
+ const out = [];
425
+ for (const { key, bag } of caseConnectorRowOwners(result)) {
426
+ const entry = byOwner.get(key);
427
+ if (!entry?.outputs || !sameOperation(bag, entry) || !Array.isArray(bag.outputs))
428
+ continue;
429
+ if (outputsDiverge(bag.outputs.filter(isOwnOutput), entry.outputs, caseVariables))
430
+ continue;
431
+ const saved = new Set(entry.outputs.rows.map((row) => row.source));
432
+ for (const row of bag.outputs)
433
+ if (isOwnOutput(row) && !saved.has(row.source))
434
+ out.push(row);
435
+ }
436
+ return out;
437
+ }
393
438
  /**
394
439
  * Write each element's saved own rows back over the ones compile built, half
395
440
  * by half, while they still describe the element. Runs after the ids are
@@ -17,7 +17,7 @@ import { buildConnectorInputs, nestConnectorBody, transportHttpMethod } from '..
17
17
  import { carriedConnectorFieldsRefusal, withCarriedFields } from '../core/carried-connector-fields.js';
18
18
  import { connectorTaskIdentity, sameConnectorOperation, withCurrentCaches, writeOptionalConfiguration } from './connector-saved-config.js';
19
19
  import { applyConnectorContexts } from './connector-saved-context.js';
20
- import { applyConnectorRows } from './connector-saved-rows.js';
20
+ import { applyConnectorRows, droppedConnectorOutputRows } from './connector-saved-rows.js';
21
21
  import { connectorActivityMetadata, connectorEventFilterTree, connectorEventMetadata } from '../core/connector-v2-metadata.js';
22
22
  import { EQUALS_EXPR_DIALECT } from '../core/connector-checks.js';
23
23
  import { bindingLabelRefusal, connectionStubMessage } from '../core/binding-messages.js';
@@ -1829,6 +1829,13 @@ function applyPreservedIdentities(result, preservation, warn) {
1829
1829
  }
1830
1830
  const metadata = result.metadata;
1831
1831
  takeConditions(metadata.caseExitRules, identities.caseExitRules);
1832
+ // A built own row the element was saved without is dropped later
1833
+ // (`applyConnectorRows`), so its id is free for a saved row that carries it.
1834
+ // Example: a connector task saved with only its `Error` row compiles with a
1835
+ // `response11` row too; the task saved with `response11` takes it back.
1836
+ for (const row of droppedConnectorOutputRows(result, preservation.connectorRows))
1837
+ if (typeof row.id === 'string')
1838
+ heldOutputIds.delete(row.id);
1832
1839
  settleDeferredClaims(deferredClaims, heldOutputIds, (target, row) => claimRowId(target, row, target.id));
1833
1840
  takeSlas(metadata.slaRules, identities.slaRules);
1834
1841
  restoreEmptyLists(metadata, identities.emptyLists, CASE_EMPTY_LISTS);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.120.9",
3
+ "version": "6.120.10",
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": "47f18663967be1967931c35b6637a3c334bd427f"
127
+ "gitref": "78fafbfe39362afad92df9f92d3dcb418118d84b"
128
128
  }