@bpmnkit/core 1.6.1 → 1.8.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.
Files changed (78) hide show
  1. package/AGENTS.md +19 -0
  2. package/README.md +2 -0
  3. package/agent-cards/bpmn.md +86 -0
  4. package/agent-cards/dmn.md +105 -0
  5. package/agent-cards/form.md +72 -0
  6. package/builder-reference.md +211 -0
  7. package/dist/bpmn/auto-layout.js +34 -5
  8. package/dist/bpmn/bpmn-builder.d.ts +127 -5
  9. package/dist/bpmn/bpmn-builder.js +270 -40
  10. package/dist/bpmn/bpmn-model.d.ts +2 -0
  11. package/dist/bpmn/bpmn-parser.js +8 -0
  12. package/dist/bpmn/bpmn-serializer.js +1 -1
  13. package/dist/bpmn/builder-coverage.js +4 -12
  14. package/dist/bpmn/camunda7/export.d.ts +25 -0
  15. package/dist/bpmn/camunda7/export.js +218 -0
  16. package/dist/bpmn/camunda7/migrate.d.ts +4 -1
  17. package/dist/bpmn/camunda7/migrate.js +4 -4
  18. package/dist/bpmn/compact.d.ts +21 -0
  19. package/dist/bpmn/compact.js +86 -1
  20. package/dist/bpmn/full-operations.js +338 -3
  21. package/dist/bpmn/index.d.ts +2 -0
  22. package/dist/bpmn/index.js +2 -0
  23. package/dist/bpmn/operations.d.ts +42 -1
  24. package/dist/bpmn/operations.js +12 -2
  25. package/dist/bpmn/optimize/deploy.js +14 -0
  26. package/dist/bpmn/optimize/index.d.ts +2 -0
  27. package/dist/bpmn/optimize/index.js +5 -0
  28. package/dist/bpmn/optimize/types.d.ts +7 -0
  29. package/dist/bpmn/stable-ids.d.ts +15 -0
  30. package/dist/bpmn/stable-ids.js +26 -0
  31. package/dist/bpmn/strip-camunda8.d.ts +22 -0
  32. package/dist/bpmn/strip-camunda8.js +55 -0
  33. package/dist/bpmn/svg.js +5 -6
  34. package/dist/bpmn/utils.js +151 -1
  35. package/dist/bpmn/zeebe-extensions.d.ts +59 -2
  36. package/dist/bpmn/zeebe-extensions.js +89 -1
  37. package/dist/check-finding.d.ts +19 -0
  38. package/dist/check-finding.js +5 -0
  39. package/dist/connectors/apply-element.d.ts +7 -3
  40. package/dist/connectors/apply-element.js +115 -4
  41. package/dist/connectors/apply-many.d.ts +5 -1
  42. package/dist/connectors/apply-many.js +5 -2
  43. package/dist/connectors/apply.d.ts +24 -3
  44. package/dist/connectors/apply.js +103 -3
  45. package/dist/connectors/catalog.js +5 -0
  46. package/dist/connectors/index.d.ts +1 -1
  47. package/dist/connectors/template-types.d.ts +30 -0
  48. package/dist/connectors/validate.js +33 -0
  49. package/dist/dmn/compact.js +14 -5
  50. package/dist/dmn/dmn-builder.js +3 -3
  51. package/dist/dmn/drd-builder.d.ts +53 -0
  52. package/dist/dmn/drd-builder.js +100 -0
  53. package/dist/dmn/index.d.ts +35 -0
  54. package/dist/dmn/index.js +36 -0
  55. package/dist/dmn/lint.d.ts +19 -0
  56. package/dist/dmn/lint.js +414 -0
  57. package/dist/form/form-builder.d.ts +9 -1
  58. package/dist/form/form-builder.js +34 -1
  59. package/dist/form/form-model.d.ts +7 -0
  60. package/dist/form/form-parser.js +22 -0
  61. package/dist/form/form-serializer.js +10 -0
  62. package/dist/form/index.d.ts +11 -2
  63. package/dist/form/index.js +10 -1
  64. package/dist/form/lint.d.ts +19 -0
  65. package/dist/form/lint.js +356 -0
  66. package/dist/index.d.ts +19 -5
  67. package/dist/index.js +12 -2
  68. package/dist/layout/annotations.d.ts +3 -1
  69. package/dist/layout/annotations.js +72 -14
  70. package/dist/layout/grid/edge-labels.d.ts +7 -1
  71. package/dist/layout/grid/edge-labels.js +62 -1
  72. package/dist/layout/semantic/index.js +78 -8
  73. package/dist/layout/semantic/place.d.ts +19 -4
  74. package/dist/layout/semantic/place.js +245 -29
  75. package/dist/layout/semantic/route.js +60 -12
  76. package/dist/layout/types.d.ts +2 -1
  77. package/llms.txt +9 -0
  78. package/package.json +6 -1
@@ -0,0 +1,218 @@
1
+ import { CAMUNDA7_NS, MODELER_NS, ZEEBE_NS, } from "./migrate.js";
2
+ const isFeel = (value) => value?.trimStart().startsWith("=") === true;
3
+ function isOwner(value) {
4
+ if (typeof value !== "object" || value === null)
5
+ return false;
6
+ const o = value;
7
+ return typeof o.id === "string" && Array.isArray(o.extensionElements);
8
+ }
9
+ const isForeign = (name) => /^(zeebe|modeler)(:|$)/.test(name.replace(/^xmlns:/, ""));
10
+ /**
11
+ * Best-effort Camunda 8 → Camunda 7 / Operaton export. The input is not modified.
12
+ *
13
+ * Maps job types, I/O mappings, assignment, form keys, call activities and
14
+ * version tags to `camunda:` equivalents and removes every `zeebe:` and
15
+ * `modeler:` construct and namespace. FEEL is not translated to JUEL: it is
16
+ * kept raw with a `manual` finding. Connectors and Zeebe-only features are
17
+ * dropped with an `unsupported` finding.
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * const { definitions, findings } = convertCamunda8To7(Bpmn.parse(xml))
22
+ * const c7Xml = Bpmn.export(definitions)
23
+ * ```
24
+ */
25
+ export function convertCamunda8To7(definitions) {
26
+ const draft = structuredClone(definitions);
27
+ const findings = [];
28
+ let processId = "";
29
+ /** Type for owners the model does not tag, i.e. messages. */
30
+ let hint;
31
+ const add = (owner, construct, severity, message, suggestion, applied) => {
32
+ findings.push({
33
+ elementId: owner.id,
34
+ elementType: owner.type ?? hint ?? (owner.id === processId ? "process" : "element"),
35
+ processId,
36
+ construct,
37
+ severity,
38
+ message,
39
+ suggestion,
40
+ applied,
41
+ });
42
+ };
43
+ /** Writes `camunda:<name>`; a FEEL value is kept raw because Camunda 7 expects JUEL. */
44
+ const setAttr = (owner, name, value, from) => {
45
+ owner.unknownAttributes[`camunda:${name}`] = value;
46
+ if (isFeel(value)) {
47
+ add(owner, from, "manual", `FEEL expression "${value}" kept as-is; Camunda 7 evaluates JUEL.`, `Rewrite camunda:${name} as a JUEL expression such as \${...}.`, true);
48
+ }
49
+ };
50
+ const convertOwner = (owner) => {
51
+ const kept = [];
52
+ const inputOutput = [];
53
+ const camundaExt = [];
54
+ const take = (name) => owner.extensionElements.find((e) => e.name === `zeebe:${name}`);
55
+ const task = take("taskDefinition");
56
+ if (task) {
57
+ const type = task.attributes.type;
58
+ if (type !== undefined) {
59
+ owner.unknownAttributes["camunda:type"] = "external";
60
+ setAttr(owner, "topic", type, "zeebe:taskDefinition");
61
+ if (type.startsWith("io.camunda:") || owner.unknownAttributes["zeebe:modelerTemplate"]) {
62
+ add(owner, "connector", "unsupported", `Connector "${type}" has no Camunda 7 runtime; it becomes a plain external task.`, "Implement an external task worker for this topic.", false);
63
+ }
64
+ }
65
+ if (task.attributes.retries !== undefined) {
66
+ add(owner, "zeebe:taskDefinition retries", "manual", "Job retries are not exported.", "Set camunda:failedJobRetryTimeCycle if needed.", false);
67
+ }
68
+ }
69
+ const assignment = take("assignmentDefinition");
70
+ if (assignment) {
71
+ for (const key of ["assignee", "candidateUsers", "candidateGroups"]) {
72
+ const value = assignment.attributes[key];
73
+ if (value !== undefined)
74
+ setAttr(owner, key, value, "zeebe:assignmentDefinition");
75
+ }
76
+ }
77
+ const form = take("formDefinition");
78
+ if (form) {
79
+ if (form.attributes.formKey !== undefined) {
80
+ setAttr(owner, "formKey", form.attributes.formKey, "zeebe:formDefinition");
81
+ }
82
+ else {
83
+ add(owner, "zeebe:formDefinition", "unsupported", "Only formKey forms exist in Camunda 7; formId and external references are dropped.", "Link an embedded or generated form by camunda:formKey.", false);
84
+ }
85
+ }
86
+ const tag = take("versionTag");
87
+ if (tag?.attributes.value !== undefined) {
88
+ setAttr(owner, "versionTag", tag.attributes.value, "zeebe:versionTag");
89
+ }
90
+ const called = take("calledElement");
91
+ if (called) {
92
+ const target = called.attributes.processId;
93
+ if (target !== undefined) {
94
+ owner.unknownAttributes.calledElement = target;
95
+ if (isFeel(target)) {
96
+ add(owner, "zeebe:calledElement", "manual", `FEEL expression "${target}" kept as-is; Camunda 7 evaluates JUEL.`, "Rewrite calledElement as a JUEL expression.", true);
97
+ }
98
+ }
99
+ const binding = called.attributes.bindingType;
100
+ if (binding !== undefined) {
101
+ owner.unknownAttributes["camunda:calledElementBinding"] = binding;
102
+ }
103
+ if (called.attributes.versionTag !== undefined) {
104
+ owner.unknownAttributes["camunda:calledElementVersionTag"] = called.attributes.versionTag;
105
+ }
106
+ // Zeebe propagates both ways unless told not to.
107
+ if (called.attributes.propagateAllParentVariables !== "false") {
108
+ camundaExt.push({ name: "camunda:in", attributes: { variables: "all" }, children: [] });
109
+ }
110
+ if (called.attributes.propagateAllChildVariables !== "false") {
111
+ camundaExt.push({ name: "camunda:out", attributes: { variables: "all" }, children: [] });
112
+ }
113
+ }
114
+ const io = take("ioMapping");
115
+ if (io) {
116
+ for (const child of io.children) {
117
+ const source = child.attributes.source;
118
+ const target = child.attributes.target;
119
+ if (source === undefined || target === undefined)
120
+ continue;
121
+ const direction = child.name === "zeebe:output" ? "outputParameter" : "inputParameter";
122
+ inputOutput.push({
123
+ name: `camunda:${direction}`,
124
+ attributes: { name: target },
125
+ children: [],
126
+ text: source,
127
+ });
128
+ if (isFeel(source)) {
129
+ add(owner, `zeebe:${child.name.slice(6)}`, "manual", `FEEL expression "${source}" (to "${target}") kept as-is; Camunda 7 evaluates JUEL.`, "Rewrite the parameter as a JUEL expression.", true);
130
+ }
131
+ }
132
+ }
133
+ const subscription = take("subscription");
134
+ if (subscription) {
135
+ add(owner, "zeebe:subscription", "manual", "Camunda 7 does not subscribe messages by correlationKey; the key is dropped.", "Correlate with a business key or correlation variables when sending the message.", false);
136
+ }
137
+ for (const ext of owner.extensionElements) {
138
+ if (!ext.name.startsWith("zeebe:") && !ext.name.startsWith("modeler:")) {
139
+ kept.push(ext);
140
+ continue;
141
+ }
142
+ const handled = [
143
+ "taskDefinition",
144
+ "assignmentDefinition",
145
+ "formDefinition",
146
+ "versionTag",
147
+ "calledElement",
148
+ "ioMapping",
149
+ "subscription",
150
+ ];
151
+ if (handled.includes(ext.name.slice(ext.name.indexOf(":") + 1)))
152
+ continue;
153
+ add(owner, ext.name, "unsupported", `${ext.name} has no Camunda 7 equivalent and was dropped.`, "Reimplement the behavior in Camunda 7 or accept the difference.", false);
154
+ }
155
+ if (inputOutput.length > 0) {
156
+ camundaExt.push({ name: "camunda:inputOutput", attributes: {}, children: inputOutput });
157
+ }
158
+ owner.extensionElements = [...kept, ...camundaExt];
159
+ stripForeignAttrs(owner.unknownAttributes);
160
+ if (owner.unknownChildren) {
161
+ owner.unknownChildren = owner.unknownChildren.filter((c) => !isForeign(c.name));
162
+ }
163
+ };
164
+ const stripForeignAttrs = (attrs) => {
165
+ for (const key of Object.keys(attrs))
166
+ if (isForeign(key))
167
+ delete attrs[key];
168
+ };
169
+ const walk = (value) => {
170
+ if (Array.isArray(value)) {
171
+ for (const item of value)
172
+ walk(item);
173
+ return;
174
+ }
175
+ if (typeof value !== "object" || value === null)
176
+ return;
177
+ const record = value;
178
+ if (isOwner(record))
179
+ convertOwner(record);
180
+ else if (typeof record.unknownAttributes === "object" && record.unknownAttributes !== null) {
181
+ stripForeignAttrs(record.unknownAttributes);
182
+ }
183
+ const condition = record.conditionExpression;
184
+ if (isFeel(condition?.text)) {
185
+ add(record, "conditionExpression", "manual", `FEEL condition "${condition.text}" kept as-is; Camunda 7 evaluates JUEL.`, "Rewrite the condition as a JUEL expression.", true);
186
+ }
187
+ for (const [key, child] of Object.entries(record)) {
188
+ if (key !== "diagrams")
189
+ walk(child);
190
+ }
191
+ };
192
+ for (const message of draft.messages) {
193
+ processId = "";
194
+ const owner = message;
195
+ hint = "message";
196
+ owner.extensionElements ??= [];
197
+ convertOwner(owner);
198
+ hint = undefined;
199
+ }
200
+ for (const process of draft.processes) {
201
+ processId = process.id;
202
+ walk(process);
203
+ }
204
+ return { definitions: finish(draft), findings };
205
+ function finish(d) {
206
+ processId = "";
207
+ for (const [prefix, uri] of Object.entries(d.namespaces)) {
208
+ if (isForeign(prefix) || uri === ZEEBE_NS || uri === MODELER_NS)
209
+ delete d.namespaces[prefix];
210
+ }
211
+ stripForeignAttrs(d.unknownAttributes);
212
+ if (d.unknownChildren)
213
+ d.unknownChildren = d.unknownChildren.filter((c) => !isForeign(c.name));
214
+ d.namespaces.camunda ??= CAMUNDA7_NS;
215
+ return d;
216
+ }
217
+ }
218
+ //# sourceMappingURL=export.js.map
@@ -36,7 +36,7 @@ export interface Camunda7Report {
36
36
  total: number;
37
37
  }
38
38
  export interface Camunda7ConvertOptions {
39
- /** Written as `modeler:executionPlatformVersion`. Default `"8.8.0"`. */
39
+ /** Written as `modeler:executionPlatformVersion`. Default `"8.10.0"`. */
40
40
  executionPlatformVersion?: string;
41
41
  /**
42
42
  * Ignored. Kept for compatibility: earlier versions read `camunda:` attributes
@@ -49,6 +49,9 @@ export interface Camunda7Conversion {
49
49
  definitions: BpmnDefinitions;
50
50
  report: Camunda7Report;
51
51
  }
52
+ export declare const CAMUNDA7_NS = "http://camunda.org/schema/1.0/bpmn";
53
+ export declare const ZEEBE_NS = "http://camunda.org/schema/zeebe/1.0";
54
+ export declare const MODELER_NS = "http://camunda.org/schema/modeler/1.0";
52
55
  /**
53
56
  * Converts a Camunda 7 model to Camunda 8, as far as that can be done
54
57
  * mechanically, and reports what it could not do. The input is not modified.
@@ -3,10 +3,10 @@ import { ValidationError } from "../../errors.js";
3
3
  import { detectExecutionPlatform } from "../lint.js";
4
4
  import { bpmnElementName, isZeebePlacementAllowed } from "../zeebe-extensions.js";
5
5
  import { containsJuel, feelString, isFeelName, translateJuelToFeel } from "./juel.js";
6
- const CAMUNDA7_NS = "http://camunda.org/schema/1.0/bpmn";
7
- const ZEEBE_NS = "http://camunda.org/schema/zeebe/1.0";
8
- const MODELER_NS = "http://camunda.org/schema/modeler/1.0";
9
- const DEFAULT_PLATFORM_VERSION = "8.8.0";
6
+ export const CAMUNDA7_NS = "http://camunda.org/schema/1.0/bpmn";
7
+ export const ZEEBE_NS = "http://camunda.org/schema/zeebe/1.0";
8
+ export const MODELER_NS = "http://camunda.org/schema/modeler/1.0";
9
+ const DEFAULT_PLATFORM_VERSION = "8.10.0";
10
10
  /** The event definitions and loop of a flow element, which carry attributes of their own. */
11
11
  function nestedHolders(owner) {
12
12
  const holders = [];
@@ -44,6 +44,20 @@ export interface CompactElement {
44
44
  calledProcess?: string;
45
45
  /** Linked form ID (userTask: zeebe:formDefinition.formId) */
46
46
  formId?: string;
47
+ /** userTask: who the task is assigned to (`zeebe:assignmentDefinition`); FEEL with `=`. */
48
+ assignee?: string;
49
+ /** userTask: comma-separated candidate groups, or a FEEL list expression. */
50
+ candidateGroups?: string;
51
+ /** userTask: comma-separated candidate users, or a FEEL list expression. */
52
+ candidateUsers?: string;
53
+ /** userTask: due date (`zeebe:taskSchedule`), ISO 8601 or FEEL. */
54
+ dueDate?: string;
55
+ /** userTask: follow-up date (`zeebe:taskSchedule`), ISO 8601 or FEEL. */
56
+ followUpDate?: string;
57
+ /** userTask: priority 0–100 (`zeebe:priorityDefinition`), or a FEEL expression. */
58
+ priority?: number | string;
59
+ /** Zeebe extension properties (`zeebe:properties`, name→value). */
60
+ properties?: Record<string, string>;
47
61
  /** Linked decision ID (businessRuleTask: zeebe:calledDecision.decisionId) */
48
62
  decisionId?: string;
49
63
  /**
@@ -80,9 +94,16 @@ export interface CompactElement {
80
94
  collection: string;
81
95
  element?: string;
82
96
  sequential?: boolean;
97
+ /** Variable collecting each instance's `outputElement`. */
98
+ outputCollection?: string;
99
+ outputElement?: string;
100
+ /** FEEL expression that ends the loop early. */
101
+ completionCondition?: string;
83
102
  };
84
103
  /** A timer event's ISO 8601 duration (`PT5M`): how long it waits once reached. */
85
104
  timerDuration?: string;
105
+ /** A conditional event's FEEL condition (Camunda 8.9+). */
106
+ condition?: string;
86
107
  }
87
108
  /** A sequence flow in compact form. */
88
109
  export interface CompactFlow {
@@ -3,6 +3,8 @@ import { layoutProcess } from "../layout/index.js";
3
3
  import { assertBpmnDefinitions, assertCompactDiagram } from "./argument-guards.js";
4
4
  import { addAnnotationShapes } from "./auto-layout.js";
5
5
  import { restConnectorTaskType } from "./rest-connector.js";
6
+ import { assignEventDefinitionIds } from "./stable-ids.js";
7
+ import { makeConditionalDefinition } from "./zeebe-extensions.js";
6
8
  // ── Default flows ────────────────────────────────────────────────────────────
7
9
  /**
8
10
  * The gateway types that carry a `bpmn:default`. No other element in this model
@@ -78,6 +80,29 @@ function compactifyElement(el) {
78
80
  const formId = findAttr(ext, "zeebe:formDefinition", "formId");
79
81
  if (formId)
80
82
  result.formId = formId;
83
+ for (const key of ["assignee", "candidateGroups", "candidateUsers"]) {
84
+ const value = findAttr(ext, "zeebe:assignmentDefinition", key);
85
+ if (value)
86
+ result[key] = value;
87
+ }
88
+ for (const key of ["dueDate", "followUpDate"]) {
89
+ const value = findAttr(ext, "zeebe:taskSchedule", key);
90
+ if (value)
91
+ result[key] = value;
92
+ }
93
+ const priority = findAttr(ext, "zeebe:priorityDefinition", "priority");
94
+ if (priority)
95
+ result.priority = /^\d+$/.test(priority) ? Number(priority) : priority;
96
+ const propertiesEl = ext.find((e) => e.name === "zeebe:properties");
97
+ if (propertiesEl && propertiesEl.children.length > 0) {
98
+ const properties = {};
99
+ for (const child of propertiesEl.children) {
100
+ const { name, value } = child.attributes;
101
+ if (name !== undefined)
102
+ properties[name] = value ?? "";
103
+ }
104
+ result.properties = properties;
105
+ }
81
106
  const decisionId = findAttr(ext, "zeebe:calledDecision", "decisionId");
82
107
  const script = findAttr(ext, "zeebe:script", "expression");
83
108
  if (decisionId) {
@@ -139,6 +164,8 @@ function compactifyElement(el) {
139
164
  result.eventType = def?.type;
140
165
  if (def?.type === "timer" && def.timeDuration)
141
166
  result.timerDuration = def.timeDuration;
167
+ if (def?.type === "conditional" && def.condition !== undefined)
168
+ result.condition = def.condition;
142
169
  }
143
170
  const loop = "loopCharacteristics" in el ? el.loopCharacteristics : undefined;
144
171
  const zeebeLoop = loop?.extensionElements.find((x) => x.name === "zeebe:loopCharacteristics");
@@ -149,6 +176,12 @@ function compactifyElement(el) {
149
176
  result.multiInstance.element = zeebeLoop.attributes.inputElement;
150
177
  if (loop.isSequential)
151
178
  result.multiInstance.sequential = true;
179
+ if (zeebeLoop.attributes.outputCollection)
180
+ result.multiInstance.outputCollection = zeebeLoop.attributes.outputCollection;
181
+ if (zeebeLoop.attributes.outputElement)
182
+ result.multiInstance.outputElement = zeebeLoop.attributes.outputElement;
183
+ if (loop.completionCondition?.text)
184
+ result.multiInstance.completionCondition = loop.completionCondition.text;
152
185
  }
153
186
  if (el.type === "boundaryEvent") {
154
187
  result.attachedTo = el.attachedToRef;
@@ -373,6 +406,11 @@ function zeebeConfig(el) {
373
406
  }
374
407
  return { inputs, headers };
375
408
  }
409
+ /** The given attributes without the unset ones, or `undefined` if none is set. */
410
+ function definedAttributes(attributes) {
411
+ const set = Object.entries(attributes).filter((entry) => entry[1] !== undefined);
412
+ return set.length > 0 ? Object.fromEntries(set) : undefined;
413
+ }
376
414
  export function makeExtensions(el) {
377
415
  const ext = [];
378
416
  const { inputs, headers } = zeebeConfig(el);
@@ -403,6 +441,35 @@ export function makeExtensions(el) {
403
441
  if (el.formId) {
404
442
  ext.push({ name: "zeebe:formDefinition", attributes: { formId: el.formId }, children: [] });
405
443
  }
444
+ const assignment = definedAttributes({
445
+ assignee: el.assignee,
446
+ candidateGroups: el.candidateGroups,
447
+ candidateUsers: el.candidateUsers,
448
+ });
449
+ if (assignment) {
450
+ ext.push({ name: "zeebe:assignmentDefinition", attributes: assignment, children: [] });
451
+ }
452
+ const schedule = definedAttributes({ dueDate: el.dueDate, followUpDate: el.followUpDate });
453
+ if (schedule)
454
+ ext.push({ name: "zeebe:taskSchedule", attributes: schedule, children: [] });
455
+ if (el.priority !== undefined) {
456
+ ext.push({
457
+ name: "zeebe:priorityDefinition",
458
+ attributes: { priority: String(el.priority) },
459
+ children: [],
460
+ });
461
+ }
462
+ if (el.properties && Object.keys(el.properties).length > 0) {
463
+ ext.push({
464
+ name: "zeebe:properties",
465
+ attributes: {},
466
+ children: Object.entries(el.properties).map(([name, value]) => ({
467
+ name: "zeebe:property",
468
+ attributes: { name, value },
469
+ children: [],
470
+ })),
471
+ });
472
+ }
406
473
  if (el.decisionId) {
407
474
  ext.push({
408
475
  name: "zeebe:calledDecision",
@@ -503,18 +570,36 @@ defaultFlow) {
503
570
  unknownAttributes: templateAttributes(el),
504
571
  };
505
572
  const made = el.eventType ? makeEventDef(el.eventType) : undefined;
506
- const eventDef = made?.type === "timer" && el.timerDuration ? { ...made, timeDuration: el.timerDuration } : made;
573
+ const eventDef = made?.type === "timer" && el.timerDuration
574
+ ? { ...made, timeDuration: el.timerDuration }
575
+ : made?.type === "conditional" && el.condition !== undefined
576
+ ? makeConditionalDefinition(el.condition)
577
+ : made;
507
578
  const eventDefs = eventDef ? [eventDef] : [];
579
+ // Zeebe rejects an id-less definition at deploy time; the builder derives the same ids.
580
+ assignEventDefinitionIds(el.id, eventDefs);
508
581
  const subContent = buildSubContent(el.children);
509
582
  const loop = el.multiInstance && {
510
583
  loopCharacteristics: {
511
584
  isSequential: el.multiInstance.sequential || undefined,
585
+ completionCondition: el.multiInstance.completionCondition
586
+ ? {
587
+ text: el.multiInstance.completionCondition,
588
+ attributes: { "xsi:type": "bpmn:tFormalExpression" },
589
+ }
590
+ : undefined,
512
591
  extensionElements: [
513
592
  {
514
593
  name: "zeebe:loopCharacteristics",
515
594
  attributes: {
516
595
  inputCollection: el.multiInstance.collection,
517
596
  ...(el.multiInstance.element ? { inputElement: el.multiInstance.element } : {}),
597
+ ...(el.multiInstance.outputCollection
598
+ ? { outputCollection: el.multiInstance.outputCollection }
599
+ : {}),
600
+ ...(el.multiInstance.outputElement
601
+ ? { outputElement: el.multiInstance.outputElement }
602
+ : {}),
518
603
  },
519
604
  children: [],
520
605
  },