@uipath/maestro-builder-sdk 6.94.5 → 6.95.0

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.
@@ -12,10 +12,11 @@ import { caseConnectorOwners, savedConnectorContext } from './connector-saved-co
12
12
  import { caseConnectorRowOwners, savedConnectorRows } from './connector-saved-rows.js';
13
13
  import { builtChainSource, chainStatements } from '../core/builder-chain.js';
14
14
  import { literalSource } from './literal.js';
15
+ import { customRowShape } from './custom-output-shape.js';
15
16
  import { ANY_ESCALATION_ID } from './rule-options.js';
16
17
  import { CASE_FORMAT_PROFILE, CASE_SCHEMA_VERSIONS } from './format-profile.js';
17
18
  import { EXTERNAL_TASK_CONTEXT, EXTERNAL_TASK_EVENT_CONTEXT, externalDescriptorRefusal, externalEventRefusal, externalServiceType, isExternalExecutionMode, libraryExecution } from './external.js';
18
- import { preserveSchemaVersion } from '../schema-version.js';
19
+ import { compareSchemaVersions, preserveSchemaVersion } from '../schema-version.js';
19
20
  import { ownEntry } from '../core/own-entry.js';
20
21
  import { EVENT_FILTER_OPERATORS, eventFilterExpressionOf, eventFilterFromTreeLeaf, eventFilterProblem, EXPRESSION_FILTER_OPERATORS, filterExprFromLeaf } from '../core/event-filters.js';
21
22
  import { CASE_FILTER_SPELLING, caseSubscriptionBody, caseSubscriptionOwners } from './subscription.js';
@@ -2465,6 +2466,30 @@ function unaliasedOwnNameRow(row, plan) {
2465
2466
  const root = [...(plan.variables?.inputOutputs ?? []), ...(plan.variables?.inputs ?? []), ...(plan.variables?.outputs ?? [])];
2466
2467
  return root.some((entry) => entry?.id === row.id) ? { noAlias: true } : {};
2467
2468
  }
2469
+ /**
2470
+ * A custom (`{ assign }`) output row's saved fields that compile does not
2471
+ * write as saved (`customRowShape`): its own `id`, an `elementId` other than
2472
+ * `root`, a `value` that is not its `source`, a json row's `body`, Designer
2473
+ * copies such as `displayName`. An action custom row's `originalVar` is
2474
+ * carried apart (the identity's `originalVar`).
2475
+ */
2476
+ function customRowIdentity(task, row, plan) {
2477
+ const carriedApart = new Set(task.type === 'action' ? ['originalVar'] : []);
2478
+ // Below V32.0.3 the platform re-derives a custom row's `elementId` on read
2479
+ // (the V32.0.2 -> V32.0.3 migration, from the variable the row assigns), so
2480
+ // the saved value is not what the reader sees, and compile writes a later
2481
+ // version, which the migration does not touch. Only a V32.0.3+ value is the
2482
+ // row's own.
2483
+ if (!customElementIdIsOwn(plan.version))
2484
+ carriedApart.add('elementId');
2485
+ const varRows = (task.data?.outputs ?? []).filter((other) => other?.custom === true && other.var === row.var).length;
2486
+ const shape = customRowShape(row, carriedApart, varRows);
2487
+ return shape ? { customRow: shape } : {};
2488
+ }
2489
+ /** Whether a plan declaring `version` keeps its custom rows' saved `elementId` on read (V32.0.3 and later). */
2490
+ function customElementIdIsOwn(version) {
2491
+ return typeof version === 'string' && /^\d+\.\d+\.\d+$/.test(version) && compareSchemaVersions(version, '32.0.3') >= 0;
2492
+ }
2468
2493
  function identityPreservation(plan) {
2469
2494
  const ambiguous = ambiguousSlaIds(plan);
2470
2495
  const conditionIdentity = (condition, _index, list) => conditionIdentityOf(condition, ambiguous, list);
@@ -2496,6 +2521,7 @@ function identityPreservation(plan) {
2496
2521
  ...unaliasedOwnNameRow(row, plan),
2497
2522
  ...actionOutputShape(task, row),
2498
2523
  ...resourceRowShape(task, row, 'outputs'),
2524
+ ...customRowIdentity(task, row, plan),
2499
2525
  })),
2500
2526
  ...emptyIoLists(task),
2501
2527
  ...carriedResource(task, plan),
@@ -2,6 +2,7 @@ import { type PreservedConnectorContext } from './connector-saved-context.js';
2
2
  import { type PreservedConnectorRows } from './connector-saved-rows.js';
3
3
  import type { BuiltCase } from './case-sdk.js';
4
4
  import type { ReadEventFilter } from '../core/event-filters.js';
5
+ import { type CustomRowShape } from './custom-output-shape.js';
5
6
  import { Bindings } from '../core/bindings.js';
6
7
  import type { BindingsView } from '../core/binding-messages.js';
7
8
  import { type PreservedResourceWire } from './resource-wire.js';
@@ -220,7 +221,10 @@ interface StageIdentity {
220
221
  }>;
221
222
  /** `originalVar` only when it is not the row's `id` (the serializer's own spelling). `elementId` when an action form output names another element than its task. `fields` as on an input. `omit`: the fields an action form output (`target`, `_jsonSchema`, `elementId`) or a resource extract (`target`) was saved without that compile writes. `target`: which of the row's variables its saved `target` names when that is not its id (`=<var>` or `=<originalVar>`; compile writes `=<id>`). `bodyCopies`: the extra copies of its `body` an action form output was saved with (`jsonSchema`), which compile writes back from the body. */
222
223
  /** `var` and `custom: true`: a custom row whose label (`name`) is not the name of the variable it assigns. */
223
- /** `noAlias: true`: an own-name row saved with no `originalVar` beside a root variable of its id, which compile writes as the alias `originalVar: <id>`. */
224
+ /**
225
+ * `noAlias: true`: an own-name row saved with no `originalVar` beside a root variable of its id, which compile writes as the alias `originalVar: <id>`.
226
+ * `customRow`: a custom (`{ assign }`) row's saved fields compile does not write as saved (`customRowShape`).
227
+ */
224
228
  outputs?: PreservedOutputRow[];
225
229
  /** The io lists a task saved empty (`inputs: []`), which compile writes only when it has a row there. */
226
230
  emptyIo?: Array<'inputs' | 'outputs'>;
@@ -312,6 +316,7 @@ export interface PreservedOutputRow {
312
316
  var?: string;
313
317
  custom?: true;
314
318
  noAlias?: true;
319
+ customRow?: CustomRowShape;
315
320
  }
316
321
  export interface CaseJsonPreservation {
317
322
  /** Unknown document-root fields. */
@@ -1,6 +1,7 @@
1
1
  import { connectorContextErrors } from './connector-saved-context.js';
2
2
  import { connectorRowErrors } from './connector-saved-rows.js';
3
3
  import { stableId } from '../core/stable-id.js';
4
+ import { customRowShapeErrors } from './custom-output-shape.js';
4
5
  import { Bindings } from '../core/bindings.js';
5
6
  import { bindingIdCandidates, offlineBindingLabel } from './ids.js';
6
7
  import { resourceBindingSeed, resourceWireError } from './resource-wire.js';
@@ -376,6 +377,11 @@ export function caseJsonPreservationErrors(payload) {
376
377
  errors.push(`task "${task.name}" ${side} "${row.name}" omits "${String(field)}", which is not an omittable field`);
377
378
  }
378
379
  }
380
+ for (const stage of payload.identities?.stages ?? [])
381
+ for (const task of (stage.tasks ?? []).flat())
382
+ for (const row of task.outputs ?? [])
383
+ if (row.customRow !== undefined)
384
+ errors.push(...customRowShapeErrors(`task "${task.name}" output "${row.name}"`, row.customRow));
379
385
  for (const id of payload.omitTaskDisplayNames ?? [])
380
386
  if (typeof id !== 'string' || id === '')
381
387
  errors.push('omitted task displayName ids must be non-empty strings');
@@ -47,6 +47,7 @@ import { DOCUMENT_EXTRACTION_NAME, DOCUMENT_EXTRACTION_RESOURCE, DOCUMENT_EXTRAC
47
47
  import { HTTP_REQUEST_CONNECTION_NAME, HTTP_REQUEST_IMPLICIT_BINDING_ID, HTTP_REQUEST_IMPLICIT_CONNECTION, HTTP_REQUEST_SERVICE_TYPE, httpRequestBody, httpRequestContext, httpRequestInputs, httpRequestOutputMappings, httpRequestOutputs, httpRequestRefusal, writeHttpRequestMetadata, } from './http-request.js';
48
48
  import { connectorPlaceholderData, connectorPlaceholderKindOf, isConnectorPlaceholder } from './connector-placeholder.js';
49
49
  import { lowerTaskOutputRefs, planTaskOutputs, resolveInPlan, unresolvedTaskOutputRef } from './task-output-ref.js';
50
+ import { applyCustomRowShape } from './custom-output-shape.js';
50
51
  /** The ids a serialize pass hashed from element ids, by the document it returned. */
51
52
  const ELEMENT_SEEDED_IDS = new WeakMap();
52
53
  /** The subscriptions a serialize pass wrote, by the document it returned. */
@@ -1365,6 +1366,8 @@ function applyPreservedIdentities(result, preservation, warn) {
1365
1366
  if (!carriedCompanions.has(row.var))
1366
1367
  carriedCompanions.set(row.var, { id: row.var, name: row.var, type: row.type, elementId: 'root', custom: true });
1367
1368
  };
1369
+ // Tasks whose custom rows carry a saved shape (`customRowShape`).
1370
+ const customRowShapes = [];
1368
1371
  const nodes = result.nodes;
1369
1372
  const stages = nodes.filter((node) => String(node.type).endsWith('Stage'));
1370
1373
  const bagField = CASE_FORMAT_PROFILE.waitConnectorRuleBagField;
@@ -1693,6 +1696,10 @@ function applyPreservedIdentities(result, preservation, warn) {
1693
1696
  // resource, even when the payload names none. An action task's `omit`
1694
1697
  // is its form row's (#1636), which names no resource.
1695
1698
  const isAction = task?.type === 'action';
1699
+ // A custom row's saved fields (`customRowShape`), put back once every id is final.
1700
+ const shapes = (taskIdentity.outputs ?? []).flatMap((row) => (row.customRow ? [row.customRow] : []));
1701
+ if (task && shapes.length)
1702
+ customRowShapes.push({ task, shapes });
1696
1703
  takeOutputRows(task?.data?.outputs ?? [], (taskIdentity.outputs ?? [])
1697
1704
  .map((row) => ({ ...row, ...(!isAction && !resourceKept ? { fields: undefined, omit: undefined } : {}) })), isAction);
1698
1705
  // Only on the kind the lists were saved on (`emptyIoType`; a payload from
@@ -1825,6 +1832,26 @@ function applyPreservedIdentities(result, preservation, warn) {
1825
1832
  settleOwnNameRows(result, stages, ownNameRestored, identities);
1826
1833
  for (const spell of targetSpellings)
1827
1834
  spell();
1835
+ // Each shape goes to the compiled custom row that assigns its variable, the
1836
+ // n-th shape of a variable to the n-th such row of the task.
1837
+ if (customRowShapes.length) {
1838
+ const held = new Set(planOutputRows(result, stages).map((row) => row?.id).filter((id) => typeof id === 'string'));
1839
+ for (const { task, shapes } of customRowShapes) {
1840
+ const rows = (task.data?.outputs ?? []).filter((row) => row?.custom === true);
1841
+ const seen = new Map();
1842
+ for (const shape of shapes) {
1843
+ const n = seen.get(shape.var) ?? 0;
1844
+ seen.set(shape.var, n + 1);
1845
+ const onVar = rows.filter((candidate) => candidate.var === shape.var);
1846
+ const row = onVar[n];
1847
+ if (!row)
1848
+ continue;
1849
+ applyCustomRowShape(row, shape, (id) => !held.has(id), onVar.length);
1850
+ if (typeof row.id === 'string')
1851
+ held.add(row.id);
1852
+ }
1853
+ }
1854
+ }
1828
1855
  // An id hashed from a generated element id is re-minted from the preserved one,
1829
1856
  // wherever it is spelled, including inside a `=jsonString:` configuration.
1830
1857
  const reseeded = new Map();
@@ -76,11 +76,26 @@ export function registerBpmnCommands(program) {
76
76
  });
77
77
  family
78
78
  .command('merge')
79
- .description('Merge an edited process with its original BPMN artifact.')
80
- .argument('<edited>', 'edited .bpmn path')
79
+ .description('Merge an edited process with its original BPMN artifact. Given the edited .bpmn.ts source, merge compiles it, '
80
+ + 'derives the baseline from --original (decompile, then compile) in memory, and writes the result over '
81
+ + '--original unless -o is given, so no intermediate .bpmn is needed. The source must carry the '
82
+ + '`// @decompiled-from` stamp `bpmn decompile` writes: merge refuses, writing nothing, when --original changed '
83
+ + 'since the decompile or the stamp is missing, and derives the baseline with the decompile options it records.')
84
+ .argument('<edited>', 'edited .bpmn path, or the edited .bpmn.ts source')
81
85
  .option('--original <file>', '(required) original .bpmn path, the artifact to merge into')
82
- .option('-o, --output <file>', 'merged output path')
83
- .option('--baseline <file>', 'compiled pristine decompile')
86
+ .option('-o, --output <file>', 'merged output path (default: merged.bpmn; for an edited .bpmn.ts, --original itself)')
87
+ .option('--baseline <file>', 'compiled pristine decompile (derived from --original when <edited> is a .bpmn.ts)')
88
+ // For an edited .bpmn.ts: how the original was decompiled. The source's stamp
89
+ // records it, so these are never needed; one that disagrees with the stamp is refused …
90
+ .option('--style <style>', 'edited .bpmn.ts: the decompile style, nested or explicit (read from the stamp; refused if it disagrees)')
91
+ .option('--connectors <mode>', 'edited .bpmn.ts: lift or verbatim, as it was decompiled (read from the stamp; refused if it disagrees)')
92
+ .option('--keep-flow-ids', 'edited .bpmn.ts: it was decompiled with --keep-flow-ids (read from the stamp; refused if it disagrees)')
93
+ .option('--keep-unused-bindings', 'edited .bpmn.ts: it was decompiled with --keep-unused-bindings (read from the stamp; refused if it disagrees)')
94
+ // … and compile's inputs, which both in-memory compiles use.
95
+ .option('--library <dir>', 'edited .bpmn.ts: connector library directory')
96
+ .option('--connectors-local <dir>', 'edited .bpmn.ts: connection-resolved connector overlay')
97
+ .option('--bindings <file>', 'edited .bpmn.ts: bindings.json path')
98
+ .option('--resources <file>', 'edited .bpmn.ts: resource ledger that registry prepare writes (default .flow-sdk/resources.json)')
84
99
  .allowExcessArguments()
85
100
  .action(async (_edited, options, command) => {
86
101
  const pair = namedOrLegacySecond(command, {
@@ -93,6 +108,16 @@ export function registerBpmnCommands(program) {
93
108
  const argv = [original, edited];
94
109
  addValue(argv, '-o', options.output);
95
110
  addValue(argv, '--baseline', options.baseline);
111
+ addValue(argv, '--style', options.style);
112
+ addValue(argv, '--connectors', options.connectors);
113
+ if (options.keepFlowIds)
114
+ argv.push('--keep-flow-ids');
115
+ if (options.keepUnusedBindings)
116
+ argv.push('--keep-unused-bindings');
117
+ addValue(argv, '--library', options.library);
118
+ addValue(argv, '--connectors-local', options.connectorsLocal);
119
+ addValue(argv, '--bindings', options.bindings);
120
+ addValue(argv, '--resources', options.resources);
96
121
  await invoke('bpmn merge', () => import('../../bpmn/merge-cli.js'), argv);
97
122
  });
98
123
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.94.5",
3
+ "version": "6.95.0",
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",
@@ -74,7 +74,8 @@
74
74
  "merge-original-option",
75
75
  "prepare-action-option",
76
76
  "json-result",
77
- "prepare-resource"
77
+ "prepare-resource",
78
+ "bpmn-merge-source"
78
79
  ],
79
80
  "files": [
80
81
  "dist",
@@ -111,5 +112,5 @@
111
112
  "@types/node": "^22.7.0",
112
113
  "esbuild": "^0.28.1"
113
114
  },
114
- "gitref": "cd181b53225fc8818b6867e28ea609b46e8cfdfc"
115
+ "gitref": "13b0485c8d353f4129c4b6d192b1432c5f9fc0b2"
115
116
  }