@uipath/maestro-builder-sdk 6.87.4 → 6.88.1

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.
@@ -72,8 +72,8 @@ export type EventDef = {
72
72
  } | {
73
73
  type: 'terminate';
74
74
  };
75
- /** The four gateway element kinds a {@link BpmnNode} can be. */
76
- export type GatewayKind = 'exclusiveGateway' | 'parallelGateway' | 'inclusiveGateway' | 'eventBasedGateway';
75
+ /** The five gateway element kinds a {@link BpmnNode} can be. */
76
+ export type GatewayKind = 'exclusiveGateway' | 'parallelGateway' | 'inclusiveGateway' | 'eventBasedGateway' | 'complexGateway';
77
77
  /** The four non-boundary event element kinds a {@link BpmnNode} can be. */
78
78
  export type EventKind = 'startEvent' | 'endEvent' | 'intermediateCatchEvent' | 'intermediateThrowEvent';
79
79
  /** Multi-instance loop over a collection (`uipath:loopCharacteristics`). */
@@ -813,11 +813,11 @@ export interface BoundaryOpts {
813
813
  /** A `uipath:activity` capturing the error payload — see {@link ExtensionPayload}. */
814
814
  payload?: ExtensionPayload;
815
815
  }
816
- /** Options for `.exclusiveGateway()` / `.inclusiveGateway()`. */
816
+ /** Options for `.exclusiveGateway()` / `.inclusiveGateway()` / `.complexGateway()`. */
817
817
  export interface GatewayOpts {
818
818
  /** Display name the designer shows on the gateway. */
819
819
  name?: string;
820
- /** Outgoing flow id taken when no condition matches (exclusive/inclusive). */
820
+ /** Outgoing flow id taken when no condition matches (exclusive/inclusive/complex). */
821
821
  default?: string;
822
822
  }
823
823
  /**
@@ -1740,13 +1740,19 @@ export interface ActivityNodeOpts extends ActivityOpts {
1740
1740
  entryPointId?: string | false;
1741
1741
  }
1742
1742
  /**
1743
- * The BPMN task elements that are legal with NO `uipath:*` payload.
1743
+ * The BPMN activity elements the builder can write with NO `uipath:*` payload.
1744
1744
  *
1745
- * All seven validate clean as bare elements — `uip maestro bpmn validate` accepts every
1746
- * one — so an artifact can legitimately contain them and the builder has to be able to
1747
- * say so. See {@link ScopeBuilder.plainTask}.
1745
+ * The seven task elements validate clean as bare elements — `uip maestro bpmn validate`
1746
+ * accepts every one — so an artifact can legitimately contain them and the builder has
1747
+ * to be able to say so. See {@link ScopeBuilder.plainTask}.
1748
+ *
1749
+ * `bpmn:callActivity` is different: it is here ONLY so an import that has one (the canvas
1750
+ * palette draws it bare) round-trips. A call activity with no payload invokes nothing, so
1751
+ * `validate` rejects it and `check` reports `CALL_ACTIVITY_NO_PAYLOAD`. To call a process,
1752
+ * use a call-activity type such as `Orchestrator.StartAgenticProcess` through `.activity()`,
1753
+ * with a process resource binding.
1748
1754
  */
1749
- export type PlainTaskElement = 'bpmn:task' | 'bpmn:userTask' | 'bpmn:serviceTask' | 'bpmn:sendTask' | 'bpmn:manualTask' | 'bpmn:businessRuleTask' | 'bpmn:receiveTask';
1755
+ export type PlainTaskElement = 'bpmn:callActivity' | 'bpmn:task' | 'bpmn:userTask' | 'bpmn:serviceTask' | 'bpmn:sendTask' | 'bpmn:manualTask' | 'bpmn:businessRuleTask' | 'bpmn:receiveTask';
1750
1756
  /** Options for `.plainTask()`. */
1751
1757
  export interface PlainTaskOpts extends ActivityOpts {
1752
1758
  /** Display name the designer shows. */
@@ -2419,15 +2425,30 @@ declare abstract class ScopeBuilder {
2419
2425
  */
2420
2426
  inclusiveGateway(id: string, opts?: GatewayOpts): this;
2421
2427
  /**
2422
- * An event-based gateway — the first of the events it leads to wins, and the rest are cancelled (`bpmn:eventBasedGateway`).
2423
- *
2424
- * @param id - The element id, unique in the process and used by `sequenceFlow`.
2425
- * @param opts - `name` for the gateway.
2426
- * @returns This builder, so calls chain.
2427
- */
2428
+ * An event-based gateway — the first of the events it leads to wins, and the rest are cancelled (`bpmn:eventBasedGateway`).
2429
+ *
2430
+ * @param id - The element id, unique in the process and used by `sequenceFlow`.
2431
+ * @param opts - `name` for the gateway.
2432
+ * @returns This builder, so calls chain.
2433
+ */
2428
2434
  eventBasedGateway(id: string, opts?: {
2429
2435
  name?: string;
2430
2436
  }): this;
2437
+ /**
2438
+ * A complex gateway (`bpmn:complexGateway`) — the element as the canvas palette draws
2439
+ * it, with no `activationCondition`.
2440
+ *
2441
+ * @remarks
2442
+ * The Maestro canvas offers it and `uip maestro bpmn validate` accepts it, so a real
2443
+ * process can contain one, and until this existed `bpmn-decompile` refused the whole
2444
+ * file. It is here so an imported process round-trips; the builder gives it no
2445
+ * semantics of its own, and its outgoing flows' conditions are written as authored.
2446
+ *
2447
+ * @param id - The element id, unique in the process and used by `sequenceFlow`.
2448
+ * @param opts - `name`, and the `default` flow taken when no condition matches.
2449
+ * @returns This builder, so calls chain.
2450
+ */
2451
+ complexGateway(id: string, opts?: GatewayOpts): this;
2431
2452
  /**
2432
2453
  * A script task (Jint JavaScript body + input/output mappings).
2433
2454
  *
@@ -2462,6 +2483,10 @@ declare abstract class ScopeBuilder {
2462
2483
  * work the process does not model — the shape a diagram-first tool writes before
2463
2484
  * anything is wired up.
2464
2485
  *
2486
+ * `element: 'bpmn:callActivity'` is a round-trip form only: `check` reports it as
2487
+ * `CALL_ACTIVITY_NO_PAYLOAD`, because a call activity with no payload invokes nothing and
2488
+ * `validate` rejects it. See {@link PlainTaskElement}.
2489
+ *
2465
2490
  * @param id - The element id, unique in the process and used by `sequenceFlow`.
2466
2491
  * @param opts - `name`, and which task `element` to emit (default `bpmn:task`).
2467
2492
  * @param body - Boundary events attached to this activity, declared on the {@link ActivityBuilder} it receives.
@@ -16,7 +16,7 @@ function normTimer(t) {
16
16
  }
17
17
  /** Every {@link PlainTaskElement}, for the run-time check in `.plainTask()`. */
18
18
  const PLAIN_TASK_ELEMENTS = new Set([
19
- 'bpmn:task', 'bpmn:userTask', 'bpmn:serviceTask', 'bpmn:sendTask', 'bpmn:manualTask', 'bpmn:businessRuleTask', 'bpmn:receiveTask',
19
+ 'bpmn:callActivity', 'bpmn:task', 'bpmn:userTask', 'bpmn:serviceTask', 'bpmn:sendTask', 'bpmn:manualTask', 'bpmn:businessRuleTask', 'bpmn:receiveTask',
20
20
  ]);
21
21
  /** Bookkeeping the nesting sugar shares across every scope of one process. */
22
22
  class SugarRegistry {
@@ -43,7 +43,7 @@ class SugarRegistry {
43
43
  this.processId = processId;
44
44
  }
45
45
  }
46
- const GATEWAY_NODE_KINDS = new Set(['exclusiveGateway', 'parallelGateway', 'inclusiveGateway', 'eventBasedGateway']);
46
+ const GATEWAY_NODE_KINDS = new Set(['exclusiveGateway', 'parallelGateway', 'inclusiveGateway', 'eventBasedGateway', 'complexGateway']);
47
47
  /**
48
48
  * Whether the node serializes to a start event — nothing may flow INTO it.
49
49
  *
@@ -842,15 +842,32 @@ class ScopeBuilder {
842
842
  return this.push({ kind: 'inclusiveGateway', id, name: opts.name, default: opts.default });
843
843
  }
844
844
  /**
845
- * An event-based gateway — the first of the events it leads to wins, and the rest are cancelled (`bpmn:eventBasedGateway`).
846
- *
847
- * @param id - The element id, unique in the process and used by `sequenceFlow`.
848
- * @param opts - `name` for the gateway.
849
- * @returns This builder, so calls chain.
850
- */
845
+ * An event-based gateway — the first of the events it leads to wins, and the rest are cancelled (`bpmn:eventBasedGateway`).
846
+ *
847
+ * @param id - The element id, unique in the process and used by `sequenceFlow`.
848
+ * @param opts - `name` for the gateway.
849
+ * @returns This builder, so calls chain.
850
+ */
851
851
  eventBasedGateway(id, opts = {}) {
852
852
  return this.push({ kind: 'eventBasedGateway', id, name: opts.name });
853
853
  }
854
+ /**
855
+ * A complex gateway (`bpmn:complexGateway`) — the element as the canvas palette draws
856
+ * it, with no `activationCondition`.
857
+ *
858
+ * @remarks
859
+ * The Maestro canvas offers it and `uip maestro bpmn validate` accepts it, so a real
860
+ * process can contain one, and until this existed `bpmn-decompile` refused the whole
861
+ * file. It is here so an imported process round-trips; the builder gives it no
862
+ * semantics of its own, and its outgoing flows' conditions are written as authored.
863
+ *
864
+ * @param id - The element id, unique in the process and used by `sequenceFlow`.
865
+ * @param opts - `name`, and the `default` flow taken when no condition matches.
866
+ * @returns This builder, so calls chain.
867
+ */
868
+ complexGateway(id, opts = {}) {
869
+ return this.push({ kind: 'complexGateway', id, name: opts.name, default: opts.default });
870
+ }
854
871
  // ── Tasks ──
855
872
  /**
856
873
  * A script task (Jint JavaScript body + input/output mappings).
@@ -915,6 +932,10 @@ class ScopeBuilder {
915
932
  * work the process does not model — the shape a diagram-first tool writes before
916
933
  * anything is wired up.
917
934
  *
935
+ * `element: 'bpmn:callActivity'` is a round-trip form only: `check` reports it as
936
+ * `CALL_ACTIVITY_NO_PAYLOAD`, because a call activity with no payload invokes nothing and
937
+ * `validate` rejects it. See {@link PlainTaskElement}.
938
+ *
918
939
  * @param id - The element id, unique in the process and used by `sequenceFlow`.
919
940
  * @param opts - `name`, and which task `element` to emit (default `bpmn:task`).
920
941
  * @param body - Boundary events attached to this activity, declared on the {@link ActivityBuilder} it receives.
@@ -20,7 +20,7 @@
20
20
  * `--no-types` skips it.
21
21
  */
22
22
  import { existsSync } from 'node:fs';
23
- import { printResult, reportDiagnostics, reportResult } from '../cli-result.js';
23
+ import { printResult, reportCompileRefusal, reportDiagnostics, reportResult } from '../cli-result.js';
24
24
  import { resolveBpmnFile, loadBuiltBpmn } from './load.js';
25
25
  import { check } from './check.js';
26
26
  import { sourceTypeDiagnostics } from './source-types.js';
@@ -78,12 +78,19 @@ export async function run(argv) {
78
78
  // A value of the wrong type usually crashes the build or the check before
79
79
  // either reports anything (`expr.startsWith is not a function`). The type
80
80
  // errors are the explanation, so they go out first, then the crash.
81
- if (!typeDiags.some((d) => d.level === 'error'))
81
+ if (typeDiags.some((d) => d.level === 'error')) {
82
+ report(typeDiags);
83
+ console.error(`check: the source also failed to run: ${error instanceof Error ? error.message : String(error)}`);
84
+ console.error(`check: ${typeDiags.filter((d) => d.level === 'error').length} type error(s); fix them first.`);
85
+ return 1;
86
+ }
87
+ // A refusal the builder throws while the source loads is a finding like any
88
+ // other, printed by its code (as `bpmn compile` prints it, #1720). Any other
89
+ // throw is a crash and propagates with its class.
90
+ if (built !== undefined)
82
91
  throw error;
83
- report(typeDiags);
84
- console.error(`check: the source also failed to run: ${error instanceof Error ? error.message : String(error)}`);
85
- console.error(`check: ${typeDiags.filter((d) => d.level === 'error').length} type error(s); fix them first.`);
86
- return 1;
92
+ printDiagnostics(typeDiags);
93
+ return reportCompileRefusal(error, { before: typeDiags, uncoded: 'propagate', verb: 'check' });
87
94
  }
88
95
  reportDiagnostics(diags);
89
96
  if (graph) {
@@ -65,7 +65,7 @@ const HITL_QUICK_SCHEMA_CONTEXT = new Set(['_schemaFileId', 'hitlSchemaId', '__h
65
65
  /** The bounds the platform puts on a human task's `Timer`, in MINUTES. */
66
66
  const MIN_TASK_TIMER_MINUTES = 15;
67
67
  const MAX_TASK_TIMER_MINUTES = 90 * 24 * 60;
68
- const GATEWAY_KINDS = new Set(['exclusiveGateway', 'parallelGateway', 'inclusiveGateway', 'eventBasedGateway']);
68
+ const GATEWAY_KINDS = new Set(['exclusiveGateway', 'parallelGateway', 'inclusiveGateway', 'eventBasedGateway', 'complexGateway']);
69
69
  /**
70
70
  * What a boundary event may attach to: every activity kind. Tied to the node union
71
71
  * rather than kept by hand. The `satisfies` clause fails the build when an activity
@@ -1273,16 +1273,31 @@ inEventSubProcess = false) {
1273
1273
  for (const n of nodes) {
1274
1274
  const outs = outgoing.get(n.id) ?? [];
1275
1275
  const ins = incomingCount.get(n.id) ?? 0;
1276
- // Exclusive/inclusive gateways: every non-default outgoing needs a condition —
1277
- // but only where the platform requires it. Its rule
1276
+ // A call activity with no payload invokes nothing. `.plainTask({ element:
1277
+ // 'bpmn:callActivity' })` exists so an import that has one (the canvas palette
1278
+ // draws it bare) round-trips; it is not an authoring form. The platform refuses it
1279
+ // (`validateCallActivityReferences`, @uipath/maestro-sdk project-validator), so
1280
+ // check says the same thing rather than passing a file validate rejects.
1281
+ if (n.kind === 'plainTask' && n.element === 'bpmn:callActivity') {
1282
+ diags.push({
1283
+ level: 'error',
1284
+ code: 'CALL_ACTIVITY_NO_PAYLOAD',
1285
+ message: `Call activity "${n.id}" has no uipath:activity payload, so it invokes nothing at run time. ` +
1286
+ 'Use a call-activity type (Orchestrator.StartAgenticProcess, … Orchestrator.StartFlowProcessAsync) ' +
1287
+ 'through .activity(), with a process resource binding.',
1288
+ where: n.id,
1289
+ });
1290
+ }
1291
+ // Exclusive, inclusive and complex gateways: every non-default outgoing needs a
1292
+ // condition — but only where the platform requires it. Its rule
1278
1293
  // (ConditionalFlowRule/validateConditionalSequenceFlow) fires for a
1279
1294
  // `bpmn:ExclusiveGateway` with MORE THAN ONE outgoing flow. A gateway with one
1280
1295
  // outgoing flow is a JOIN, and its single flow is unconditional by definition;
1281
1296
  // demanding a condition there refused a shape the platform validates and the
1282
- // runtime executes, leaving `default` as a misleading workaround. Inclusive
1283
- // gateways are outside the platform's rule, so an unconditioned branch there is
1284
- // a warning — suspicious, not invalid.
1285
- if (n.kind === 'exclusiveGateway' || n.kind === 'inclusiveGateway') {
1297
+ // runtime executes, leaving `default` as a misleading workaround. Inclusive and
1298
+ // complex gateways are outside the platform's rule, so an unconditioned branch
1299
+ // there is a warning — suspicious, not invalid.
1300
+ if (n.kind === 'exclusiveGateway' || n.kind === 'inclusiveGateway' || n.kind === 'complexGateway') {
1286
1301
  // A default naming no element or flow in this scope at all is the
1287
1302
  // serializer's BPMN_GATEWAY_DEFAULT_UNKNOWN (compile refuses it); this is
1288
1303
  // the other case, a flow or element that is not one of the gateway's own.
@@ -1328,9 +1343,9 @@ inEventSubProcess = false) {
1328
1343
  // ExclusiveGateway / ParallelGateway / InclusiveGateway at severity ERROR, so a
1329
1344
  // warning here told the author something the last rung would refuse — measured as a
1330
1345
  // `validate`-only row in the conformance ledger even though the code existed.
1331
- // An event-based gateway is outside the platform's rule and stays a warning.
1346
+ // Event-based and complex gateways are outside the platform's rule and stay a warning.
1332
1347
  if (GATEWAY_KINDS.has(n.kind) && ins === 1 && outs.length === 1) {
1333
- const platformRule = n.kind !== 'eventBasedGateway';
1348
+ const platformRule = n.kind !== 'eventBasedGateway' && n.kind !== 'complexGateway';
1334
1349
  diags.push({
1335
1350
  level: platformRule ? 'error' : 'warning',
1336
1351
  code: 'SUPERFLUOUS_GATEWAY',
@@ -17,7 +17,8 @@
17
17
  * docs/CHECK_COMPILE_CONTRACT_DESIGN.md D1, phase 8). It does not run `check()`'s
18
18
  * lint rules: run `bpmn check` first for those. It stops only when it cannot
19
19
  * write a correct `.bpmn`: a refusal the serializer throws, or a throw it has no
20
- * refusal for (COMPILE_FAILED), printed in `check`'s `✗ [CODE]` shape (and
20
+ * refusal for (COMPILE_FAILED), or a refusal the builder throws while the
21
+ * source loads, printed in `check`'s `✗ [CODE]` shape (and
21
22
  * `bpmn check` reports the same refusal, from the same code). The authoritative
22
23
  * deploy gate is `uip maestro bpmn validate`; `uip maestro bpmn format` lays the
23
24
  * diagram out.
@@ -46,7 +47,17 @@ export async function run(argv) {
46
47
  }
47
48
  const file = resolveBpmnFile(pos);
48
49
  ensureTypeScriptRuntime();
49
- const built = await loadBuiltBpmn(file);
50
+ let built;
51
+ try {
52
+ built = await loadBuiltBpmn(file);
53
+ }
54
+ catch (error) {
55
+ // The builder refuses while the source loads (a `trigger` start with no
56
+ // `timer`, two catch-all error boundaries on one task): printed by its code like a
57
+ // serializer refusal (#1720), not left to the `compile: <message>` fallback.
58
+ // Any other throw is a crash and propagates with its class.
59
+ return reportCompileRefusal(error, { uncoded: 'propagate' });
60
+ }
50
61
  // Connector service tasks resolve against the library, through the same helper
51
62
  // Flow and Case use — which also picks up the `connectors-local/` overlay that
52
63
  // `uip maestro registry prepare` writes. BPMN used to construct the library
@@ -288,6 +288,11 @@ function localName(type) {
288
288
  // module is not re-entered, which is the invariant this relies on. A per-call context
289
289
  // object is the right shape if that ever changes.
290
290
  let runLibrary;
291
+ /**
292
+ * The data elements this run left out — see `UNMODELLED_DATA`. Announced in the source
293
+ * header, so the omission is stated where the author reads the file.
294
+ */
295
+ let runUnmodelled = new Map();
291
296
  let runLiftPlans = new Map();
292
297
  let runLiftSkipped = [];
293
298
  let runLiftCalls = new Map();
@@ -1284,6 +1289,9 @@ function scopeGraph(container) {
1284
1289
  g.ins.set(t, [...(g.ins.get(t) ?? []), el]);
1285
1290
  continue;
1286
1291
  }
1292
+ // A data element is no node of the path; the nested walk must not see it (#1680).
1293
+ if (skipUnmodelled(el))
1294
+ continue;
1287
1295
  g.elements.push(el);
1288
1296
  g.byId.set(el.id, el);
1289
1297
  }
@@ -2078,7 +2086,33 @@ function emitEvent(chain, el, kind, payload, type) {
2078
2086
  ['payload', eventPayload],
2079
2087
  ]))})`);
2080
2088
  }
2089
+ /**
2090
+ * The BPMN data elements, which the builder does not model: a data object, a reference
2091
+ * to one, and a reference to a data store.
2092
+ *
2093
+ * They are not flow nodes — no sequence flow enters or leaves one, they are wired only by
2094
+ * the data associations inside the activities that read or write them — so leaving them
2095
+ * out changes no path through the process, and the local engine ignores them
2096
+ * (`local-engine/src/core/unsupported.ts` reports data objects as not modelled). So
2097
+ * decompile leaves them,
2098
+ * and the associations that point at them, to the original file: `bpmn merge` keeps
2099
+ * every element of the original that the round trip does not carry, with its shape,
2100
+ * and the source header names each one so a bare recompile's loss is stated, not silent.
2101
+ */
2102
+ const UNMODELLED_DATA = new Set(['bpmn:DataObject', 'bpmn:DataObjectReference', 'bpmn:DataStoreReference']);
2103
+ /**
2104
+ * Whether `el` is a data element, recording it for the header note when it is. Keyed by
2105
+ * id, so a scope read twice (a nested lift that falls back to flat) names it once.
2106
+ */
2107
+ function skipUnmodelled(el) {
2108
+ if (!UNMODELLED_DATA.has(el.$type))
2109
+ return false;
2110
+ runUnmodelled.set(el.id, `${el.$type} ${el.id}${el.name ? ` (${el.name})` : ''}`);
2111
+ return true;
2112
+ }
2081
2113
  function emitElement(chain, el, depth, indent) {
2114
+ if (skipUnmodelled(el))
2115
+ return;
2082
2116
  const kind = localName(el.$type);
2083
2117
  const payload = payloadOf(el);
2084
2118
  const type = extensionTypeOf(payload);
@@ -2148,6 +2182,20 @@ function emitElement(chain, el, depth, indent) {
2148
2182
  case 'eventBasedGateway':
2149
2183
  chain.add(`.${kind}(${tsText(el.id)}${optionalArg(opts([['name', el.name !== undefined ? tsText(el.name) : undefined]]))})`);
2150
2184
  return;
2185
+ // The canvas palette's complex gateway, which carries no activation condition. One
2186
+ // that does is refused by name rather than written without it: the condition is what
2187
+ // makes the gateway decide, and `.complexGateway()` has nowhere to put it.
2188
+ case 'complexGateway':
2189
+ if (el.activationCondition !== undefined) {
2190
+ throw new Error(`decompile: complex gateway "${el.id}" has an activationCondition, which .complexGateway() does not carry; ` +
2191
+ 'it is refused rather than written without it. The Maestro runtime does not read activationCondition, ' +
2192
+ 'so remove it from the source .bpmn and decompile again.');
2193
+ }
2194
+ chain.add(`.complexGateway(${tsText(el.id)}${optionalArg(opts([
2195
+ ['name', el.name !== undefined ? tsText(el.name) : undefined],
2196
+ ['default', el.default?.id !== undefined ? tsText(el.default.id) : undefined],
2197
+ ]))})`);
2198
+ return;
2151
2199
  // A task element with no `uipath:*` payload — an abstract task. All seven kinds are
2152
2200
  // legal bare and `validate` accepts every one, so they decompile through
2153
2201
  // `.plainTask()`, which is the only surface that emits a payload-free element.
@@ -2157,6 +2205,13 @@ function emitElement(chain, el, depth, indent) {
2157
2205
  // `BPMN.Variables` mapping, so the recompiled element GAINED a payload the original
2158
2206
  // never had — a silent change, in a file whose header promises the opposite. The
2159
2207
  // other six threw "has no builder equivalent", which was at least honest.
2208
+ //
2209
+ // A call activity with no payload is the bare element the canvas palette draws, and
2210
+ // comes through here too. A Maestro call activity that DOES something carries a
2211
+ // `uipath:*` payload and is a registry-typed node above. One naming a
2212
+ // `calledElement` (another engine's shape) is refused by name, since `.plainTask()`
2213
+ // has no attribute to write it to.
2214
+ case 'callActivity':
2160
2215
  case 'task':
2161
2216
  case 'userTask':
2162
2217
  case 'serviceTask':
@@ -2164,6 +2219,11 @@ function emitElement(chain, el, depth, indent) {
2164
2219
  case 'manualTask':
2165
2220
  case 'businessRuleTask':
2166
2221
  case 'receiveTask':
2222
+ if (el.calledElement !== undefined) {
2223
+ throw new Error(`decompile: call activity "${el.id}" names calledElement "${el.calledElement}" and carries no uipath payload; ` +
2224
+ '.plainTask() does not carry calledElement, so it is refused rather than written without it. ' +
2225
+ 'The platform ignores calledElement (validate says so), so remove it from the source .bpmn and decompile again.');
2226
+ }
2167
2227
  chain.add(`.plainTask(${tsText(el.id)}${optionalArg(opts([
2168
2228
  ['name', el.name !== undefined ? tsText(el.name) : undefined],
2169
2229
  // Only when it is not the default, so the common case stays terse. Spelled
@@ -2556,6 +2616,7 @@ export async function decompile(xml, options = {}) {
2556
2616
  // The connector lift, planned first: the variable block below needs to know which
2557
2617
  // tasks come back as `.connector()`, whose declarations derive as a connector's.
2558
2618
  runLibrary = options.library;
2619
+ runUnmodelled = new Map();
2559
2620
  runLiftPlans = new Map();
2560
2621
  runLiftSkipped = [];
2561
2622
  runLiftCalls = new Map();
@@ -2617,13 +2678,23 @@ export async function decompile(xml, options = {}) {
2617
2678
  }
2618
2679
  const importFrom = options.importSpecifier ?? './bpmn-sdk.js';
2619
2680
  const imported = ['bpmn', ...[...schemaPlan.imports].sort()].join(', ');
2681
+ const unmodelledNote = runUnmodelled.size
2682
+ ? `// DATA ELEMENTS LEFT TO THE ORIGINAL. The builder does not model BPMN data\n` +
2683
+ `// objects or data stores, and no sequence flow touches them, so this source\n` +
2684
+ `// does not carry them or the data associations that point at them.\n` +
2685
+ `// \`bpmn merge\` back into the original keeps them, with their shapes; a bare\n` +
2686
+ `// recompile drops them. Left out:\n` +
2687
+ [...runUnmodelled.values()].map((d) => `// - ${commentText(d)}\n`).join('') +
2688
+ '\n'
2689
+ : '';
2690
+ runUnmodelled = new Map();
2620
2691
  const imports = `import { ${imported} } from ${tsText(importFrom)};\n\n`;
2621
2692
  const nameCall = process.name !== undefined ? `${indent}.name(${tsText(process.name)})` : undefined;
2622
2693
  options.onConnectorLift?.({
2623
2694
  lifted: [...runLiftPlans.keys()],
2624
2695
  verbatim: runLiftSkipped,
2625
2696
  preamble: {
2626
- prefix: `${host.note}${imports}`,
2697
+ prefix: `${host.note}${unmodelledNote}${imports}`,
2627
2698
  head: `bpmn(${tsText(process.id)})`,
2628
2699
  calls: [...(nameCall !== undefined ? [nameCall] : []), ...chain.all.slice(0, preambleLines)],
2629
2700
  },
@@ -2639,7 +2710,7 @@ export async function decompile(xml, options = {}) {
2639
2710
  binding: 'processBuilder',
2640
2711
  indent,
2641
2712
  });
2642
- return `${host.note}${imports}${body}\n`;
2713
+ return `${host.note}${unmodelledNote}${imports}${body}\n`;
2643
2714
  }
2644
2715
  /**
2645
2716
  * Variable ids the serializer creates on its own from a node's output rows.
@@ -12,14 +12,14 @@
12
12
  * Read-only over the built IR; nothing here changes what `serialize` emits.
13
13
  */
14
14
  import { isStartLike } from './bpmn-sdk.js';
15
- const GATEWAYS = new Set(['exclusiveGateway', 'parallelGateway', 'inclusiveGateway', 'eventBasedGateway']);
15
+ const GATEWAYS = new Set(['exclusiveGateway', 'parallelGateway', 'inclusiveGateway', 'eventBasedGateway', 'complexGateway']);
16
16
  function entersOnItsOwn(n) {
17
17
  return isStartLike(n) || n.kind === 'boundaryEvent' || (n.kind === 'subProcess' && n.triggeredByEvent === true);
18
18
  }
19
19
  function scopeGraph(scope, nodes, flows) {
20
20
  const defaults = new Map();
21
21
  for (const n of nodes)
22
- if ((n.kind === 'exclusiveGateway' || n.kind === 'inclusiveGateway') && n.default)
22
+ if ((n.kind === 'exclusiveGateway' || n.kind === 'inclusiveGateway' || n.kind === 'complexGateway') && n.default)
23
23
  defaults.set(n.default, n.id);
24
24
  const incoming = new Map();
25
25
  for (const f of flows)
@@ -638,7 +638,7 @@ function buildScope(ctx, nodes, flows) {
638
638
  if (attached)
639
639
  el.attachedToRef = attached;
640
640
  }
641
- if ((n.kind === 'exclusiveGateway' || n.kind === 'inclusiveGateway') && n.default !== undefined) {
641
+ if ((n.kind === 'exclusiveGateway' || n.kind === 'inclusiveGateway' || n.kind === 'complexGateway') && n.default !== undefined) {
642
642
  const flow = ref(anyById, n.default, `gateway "${n.id}" default`, 'BPMN_GATEWAY_DEFAULT_UNKNOWN', n.id, n.id);
643
643
  if (flow)
644
644
  el.default = flow;
@@ -696,6 +696,7 @@ function standInElement(ctx, n) {
696
696
  case 'parallelGateway':
697
697
  case 'inclusiveGateway':
698
698
  case 'eventBasedGateway':
699
+ case 'complexGateway':
699
700
  return ctx.m.create(`bpmn:${cap(n.kind)}`, props);
700
701
  case 'boundaryEvent':
701
702
  return ctx.m.create('bpmn:BoundaryEvent', { ...props, cancelActivity: n.cancelActivity });
@@ -748,6 +749,7 @@ function createNode(ctx, n) {
748
749
  case 'parallelGateway':
749
750
  case 'inclusiveGateway':
750
751
  case 'eventBasedGateway':
752
+ case 'complexGateway':
751
753
  return m.create(`bpmn:${cap(n.kind)}`, { id: n.id, name: n.name });
752
754
  case 'scriptTask':
753
755
  return applyActivityFields(ctx, createScriptTask(ctx, n), n);
package/dist/bpmn-api.md CHANGED
@@ -65,6 +65,7 @@ The set of node/flow/variable methods common to the process root and every sub-p
65
65
  - `ScopeBuilder.parallelGateway(id: string, opts?: { name?: string; }): this` — A parallel gateway — every outgoing flow is taken, and a join waits for every incoming one (`bpmn:parallelGateway`).
66
66
  - `ScopeBuilder.inclusiveGateway(id: string, opts?: GatewayOpts): this` — An inclusive gateway — every outgoing flow whose condition holds is taken (`bpmn:inclusiveGateway`).
67
67
  - `ScopeBuilder.eventBasedGateway(id: string, opts?: { name?: string; }): this` — An event-based gateway — the first of the events it leads to wins, and the rest are cancelled…
68
+ - `ScopeBuilder.complexGateway(id: string, opts?: GatewayOpts): this` — A complex gateway (`bpmn:complexGateway`) — the element as the canvas palette draws it, with no `activationCondition`.
68
69
  - `ScopeBuilder.scriptTask(id: string, opts: ScriptTaskOpts, body?: ActivityBodyFn): this` — A script task (Jint JavaScript body + input/output mappings).
69
70
  - `ScopeBuilder.task(id: string, opts?: TaskOpts, body?: ActivityBodyFn): this` — A plain task that assigns variables (`BPMN.Variables`).
70
71
  - `ScopeBuilder.plainTask(id: string, opts?: PlainTaskOpts, body?: ActivityBodyFn): this` — A task element carrying NO `uipath:*` payload — an abstract task, in BPMN's terms.
@@ -203,10 +204,10 @@ Options for `.boundaryEvent()`: the activity it attaches to, whether it interrup
203
204
 
204
205
  ### `GatewayOpts`
205
206
 
206
- Options for `.exclusiveGateway()` / `.inclusiveGateway()`.
207
+ Options for `.exclusiveGateway()` / `.inclusiveGateway()` / `.complexGateway()`.
207
208
 
208
209
  - `GatewayOpts.name?: string` — Display name the designer shows on the gateway.
209
- - `GatewayOpts.default?: string` — Outgoing flow id taken when no condition matches (exclusive/inclusive).
210
+ - `GatewayOpts.default?: string` — Outgoing flow id taken when no condition matches (exclusive/inclusive/complex).
210
211
 
211
212
  ### `ScriptTaskOpts`
212
213
 
@@ -835,9 +836,9 @@ An extension payload carried by an element the payload does not describe.
835
836
 
836
837
  ### `GatewayKind`
837
838
 
838
- The four gateway element kinds a BpmnNode can be.
839
+ The five gateway element kinds a BpmnNode can be.
839
840
 
840
- - `type GatewayKind = 'exclusiveGateway' | 'parallelGateway' | 'inclusiveGateway' | 'eventBasedGateway'`
841
+ - `type GatewayKind = 'exclusiveGateway' | 'parallelGateway' | 'inclusiveGateway' | 'eventBasedGateway' | 'complexGateway'`
841
842
 
842
843
  ### `ActivityNodeFields`
843
844
 
@@ -926,9 +927,9 @@ Also takes every field of `({ contains: string; } | { startsWith: string; } | {
926
927
 
927
928
  ### `PlainTaskElement`
928
929
 
929
- The BPMN task elements that are legal with NO `uipath:*` payload.
930
+ The BPMN activity elements the builder can write with NO `uipath:*` payload.
930
931
 
931
- - `type PlainTaskElement = 'bpmn:task' | 'bpmn:userTask' | 'bpmn:serviceTask' | 'bpmn:sendTask' | 'bpmn:manualTask' | 'bpmn:businessRuleTask' | 'bpmn:receiveTask'`
932
+ - `type PlainTaskElement` — 181 characters; read it in the declaration ([`api-index.md`](api-index.md) has the span).
932
933
 
933
934
  ### `VarDirection`
934
935
 
@@ -76,10 +76,12 @@ export declare function refusalDiagnostic(error: unknown, uncoded?: 'COMPILE_FAI
76
76
  * has) and return exit code 1, with `not emitting`. A throw that is no refusal
77
77
  * ({@link refusalDiagnostic} gives `undefined`) is reported, then rethrown, so
78
78
  * it ends the run through the caller (exit 1, `--json` `error`). One copy for
79
- * Flow, Case and BPMN compile, so the three cannot drift.
79
+ * Flow, Case and BPMN compile, and for `bpmn check` on a load-time refusal
80
+ * (`verb: 'check'`, no `not emitting`), so they cannot drift.
80
81
  */
81
- export declare function reportCompileRefusal(error: unknown, { before, uncoded }?: {
82
+ export declare function reportCompileRefusal(error: unknown, { before, uncoded, verb }?: {
82
83
  before?: ReadonlyArray<ReportedDiagnostic>;
83
84
  uncoded?: 'COMPILE_FAILED' | 'propagate';
85
+ verb?: 'compile' | 'check';
84
86
  }): 1;
85
87
  export {};
@@ -116,9 +116,10 @@ export function refusalDiagnostic(error, uncoded = 'COMPILE_FAILED') {
116
116
  * has) and return exit code 1, with `not emitting`. A throw that is no refusal
117
117
  * ({@link refusalDiagnostic} gives `undefined`) is reported, then rethrown, so
118
118
  * it ends the run through the caller (exit 1, `--json` `error`). One copy for
119
- * Flow, Case and BPMN compile, so the three cannot drift.
119
+ * Flow, Case and BPMN compile, and for `bpmn check` on a load-time refusal
120
+ * (`verb: 'check'`, no `not emitting`), so they cannot drift.
120
121
  */
121
- export function reportCompileRefusal(error, { before = [], uncoded = 'COMPILE_FAILED' } = {}) {
122
+ export function reportCompileRefusal(error, { before = [], uncoded = 'COMPILE_FAILED', verb = 'compile' } = {}) {
122
123
  const refused = refusalDiagnostic(error, uncoded);
123
124
  if (!refused) {
124
125
  reportDiagnostics([...before, thrownDiagnostic(error)]);
@@ -126,6 +127,6 @@ export function reportCompileRefusal(error, { before = [], uncoded = 'COMPILE_FA
126
127
  }
127
128
  console.error(` ${diagnosticLine(refused)}`);
128
129
  reportDiagnostics([...before, refused]);
129
- console.error('compile: 1 error(s); not emitting.');
130
+ console.error(verb === 'check' ? 'check: 1 error(s).' : 'compile: 1 error(s); not emitting.');
130
131
  return 1;
131
132
  }
package/dist/cli-run.js CHANGED
@@ -22,6 +22,22 @@ function realOrAbsolute(path) {
22
22
  * would run a second time, on the CLI's argv.
23
23
  */
24
24
  const HOSTED_BY_CLI = Symbol.for('uipath.maestro-builder-sdk.cli-hosted');
25
+ /** JavaScript's own error classes: a throw of one is a crash, not a refusal. */
26
+ const CRASH_CLASSES = new Set(['TypeError', 'RangeError', 'ReferenceError', 'SyntaxError', 'EvalError', 'URIError']);
27
+ /**
28
+ * What a tool prints for a throw that ends it. A crash keeps its class and code
29
+ * the way Node prints them (`TypeError: x.replace is not a function`,
30
+ * `SyntaxError [ERR_INVALID_TYPESCRIPT_SYNTAX]: Expression expected`), so it
31
+ * cannot be read as a refusal; any other error prints its message alone, as before.
32
+ */
33
+ function thrownMessage(error) {
34
+ if (!(error instanceof Error))
35
+ return String(error);
36
+ if (!CRASH_CLASSES.has(error.name))
37
+ return error.message;
38
+ const code = error.code;
39
+ return `${error.name}${typeof code === 'string' && code ? ` [${code}]` : ''}: ${error.message}`;
40
+ }
25
41
  export function runWhenInvokedDirectly(moduleUrl, label, run) {
26
42
  if (globalThis[HOSTED_BY_CLI])
27
43
  return;
@@ -45,8 +61,7 @@ export function runWhenInvokedDirectly(moduleUrl, label, run) {
45
61
  process.exitCode = code;
46
62
  })
47
63
  .catch((error) => {
48
- const message = error instanceof Error ? error.message : String(error);
49
- console.error(`${label}: ${message}`);
64
+ console.error(`${label}: ${thrownMessage(error)}`);
50
65
  process.exitCode = 1;
51
66
  });
52
67
  }
@@ -147,6 +147,7 @@ export declare const REFUSALS: {
147
147
  readonly BUSINESS_RULE_EMPTY_DATA: "lint";
148
148
  readonly BUSINESS_RULE_OUTPUT_NAME: "lint";
149
149
  readonly BUSINESS_RULE_OUTPUT_SOURCE: "lint";
150
+ readonly CALL_ACTIVITY_NO_PAYLOAD: "lint";
150
151
  readonly CALL_NO_NUMBER: "lint";
151
152
  readonly CALL_NUMBER_NOT_E164: "lint";
152
153
  readonly CARRIED_DEFINITION_CONFLICT: "lowering";
@@ -240,6 +241,8 @@ export declare const REFUSALS: {
240
241
  readonly CONTRIBUTION_INVALID: "lowering";
241
242
  readonly CONVERSATION_NO_ID: "lint";
242
243
  readonly CONVERSATION_RANGE: "lint";
244
+ readonly CONVERSATION_TRIGGER_APPEARANCE_VERSION: "lowering";
245
+ readonly CONVERSATION_TRIGGER_DISPLAY_PROMPT_REQUIRED: "lint";
243
246
  readonly CONV_AGENT_CUSTOM_NO_ID: "lint";
244
247
  readonly CONV_AGENT_NO_MODEL: "lint";
245
248
  readonly CONV_AGENT_NO_PROMPT: "lint";
@@ -196,6 +196,7 @@ export const REFUSALS = {
196
196
  BUSINESS_RULE_EMPTY_DATA: 'lint',
197
197
  BUSINESS_RULE_OUTPUT_NAME: 'lint',
198
198
  BUSINESS_RULE_OUTPUT_SOURCE: 'lint',
199
+ CALL_ACTIVITY_NO_PAYLOAD: 'lint',
199
200
  CALL_NO_NUMBER: 'lint',
200
201
  CALL_NUMBER_NOT_E164: 'lint',
201
202
  CARRIED_DEFINITION_CONFLICT: 'lowering',
@@ -313,6 +314,8 @@ export const REFUSALS = {
313
314
  CONTRIBUTION_INVALID: 'lowering',
314
315
  CONVERSATION_NO_ID: 'lint',
315
316
  CONVERSATION_RANGE: 'lint',
317
+ CONVERSATION_TRIGGER_APPEARANCE_VERSION: 'lowering',
318
+ CONVERSATION_TRIGGER_DISPLAY_PROMPT_REQUIRED: 'lint',
316
319
  CONV_AGENT_CUSTOM_NO_ID: 'lint',
317
320
  CONV_AGENT_NO_MODEL: 'lint',
318
321
  CONV_AGENT_NO_PROMPT: 'lint',