@aranzatech/diagrams-bpmn 0.2.4 → 0.2.5
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.
- package/dist/{catalog-DIBySQqA.d.ts → catalog-CQtKEV7q.d.ts} +1 -1
- package/dist/{catalog-m8fHIiKH.d.cts → catalog-D2AcvrDO.d.cts} +1 -1
- package/dist/{chunk-33AR3PXF.js → chunk-ASZ3TFNQ.js} +228 -17
- package/dist/chunk-ASZ3TFNQ.js.map +1 -0
- package/dist/elements/index.d.cts +3 -3
- package/dist/elements/index.d.ts +3 -3
- package/dist/index.cjs +226 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/modeling/index.d.cts +3 -3
- package/dist/modeling/index.d.ts +3 -3
- package/dist/{types-BxjCV2oX.d.ts → types-CIBColRi.d.ts} +11 -2
- package/dist/{types-vVi5T7qj.d.cts → types-fDlPLIHd.d.cts} +11 -2
- package/dist/{types-DznxZxpV.d.cts → types-rWbKYrHH.d.cts} +61 -1
- package/dist/{types-DznxZxpV.d.ts → types-rWbKYrHH.d.ts} +61 -1
- package/dist/validation/index.d.cts +2 -2
- package/dist/validation/index.d.ts +2 -2
- package/dist/xml/index.cjs +226 -15
- package/dist/xml/index.cjs.map +1 -1
- package/dist/xml/index.d.cts +3 -2
- package/dist/xml/index.d.ts +3 -2
- package/dist/xml/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-33AR3PXF.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { f as BpmnElementType, d as BpmnElementMeta, e as BpmnElementSize } from './types-rWbKYrHH.js';
|
|
2
2
|
|
|
3
3
|
declare const BPMN_ELEMENT_CATALOG: Record<BpmnElementType, BpmnElementMeta>;
|
|
4
4
|
declare function getElementMeta(type: BpmnElementType): BpmnElementMeta;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { f as BpmnElementType, d as BpmnElementMeta, e as BpmnElementSize } from './types-rWbKYrHH.cjs';
|
|
2
2
|
|
|
3
3
|
declare const BPMN_ELEMENT_CATALOG: Record<BpmnElementType, BpmnElementMeta>;
|
|
4
4
|
declare function getElementMeta(type: BpmnElementType): BpmnElementMeta;
|
|
@@ -182,9 +182,84 @@ function extractLaneMembership(process) {
|
|
|
182
182
|
function extractTrigger(el) {
|
|
183
183
|
const defs = asElements(el.eventDefinitions);
|
|
184
184
|
if (defs.length === 0) return void 0;
|
|
185
|
-
if (defs.length > 1)
|
|
185
|
+
if (defs.length > 1) {
|
|
186
|
+
return defs.some((def) => def.$type === "bpmn:ParallelMultipleEventDefinition") ? "parallelMultiple" : "multiple";
|
|
187
|
+
}
|
|
186
188
|
return EVENT_DEF_TO_TRIGGER[defs[0].$type];
|
|
187
189
|
}
|
|
190
|
+
function parseVariableType(value) {
|
|
191
|
+
const text = asString(value) ?? "";
|
|
192
|
+
if (text.includes("int")) return "integer";
|
|
193
|
+
if (text.includes("boolean")) return "boolean";
|
|
194
|
+
if (text.includes("date")) return "date";
|
|
195
|
+
if (text.includes("array")) return "array";
|
|
196
|
+
if (text.includes("anyType")) return "object";
|
|
197
|
+
return "string";
|
|
198
|
+
}
|
|
199
|
+
function extractEventDefinition(el) {
|
|
200
|
+
const defs = asElements(el.eventDefinitions);
|
|
201
|
+
if (defs.length === 0) return void 0;
|
|
202
|
+
if (defs.length > 1) {
|
|
203
|
+
return {
|
|
204
|
+
type: defs.some((def2) => def2.$type === "bpmn:ParallelMultipleEventDefinition") ? "parallelMultiple" : "multiple"
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
const [def] = defs;
|
|
208
|
+
const type = EVENT_DEF_TO_TRIGGER[def.$type];
|
|
209
|
+
if (!type) return void 0;
|
|
210
|
+
const eventDefinition = {
|
|
211
|
+
type,
|
|
212
|
+
...asString(def.messageRef?.id) ? { messageRef: def.messageRef.id } : {},
|
|
213
|
+
...asString(def.signalRef?.id) ? { signalRef: def.signalRef.id } : {},
|
|
214
|
+
...asString(def.errorRef?.id) ? { errorRef: def.errorRef.id } : {},
|
|
215
|
+
...asString(def.escalationRef?.id) ? { escalationRef: def.escalationRef.id } : {},
|
|
216
|
+
...asString(def.condition?.body) ? { conditionExpression: def.condition.body } : {}
|
|
217
|
+
};
|
|
218
|
+
const timeDate = asString(def.timeDate?.body);
|
|
219
|
+
const timeDuration = asString(def.timeDuration?.body);
|
|
220
|
+
const timeCycle = asString(def.timeCycle?.body);
|
|
221
|
+
if (timeDate) eventDefinition.timer = { kind: "date", value: timeDate };
|
|
222
|
+
else if (timeCycle) eventDefinition.timer = { kind: "cycle", value: timeCycle };
|
|
223
|
+
else if (timeDuration) eventDefinition.timer = { kind: "duration", value: timeDuration };
|
|
224
|
+
if (type === "link") {
|
|
225
|
+
const linkName = asString(el.name) ?? asString(def.name);
|
|
226
|
+
if (linkName) eventDefinition.linkName = linkName;
|
|
227
|
+
}
|
|
228
|
+
return eventDefinition;
|
|
229
|
+
}
|
|
230
|
+
function extractDefinitions(rootElement) {
|
|
231
|
+
const definitions = {};
|
|
232
|
+
const rootElements = asElements(rootElement.rootElements);
|
|
233
|
+
const messages = rootElements.filter((element) => element.$type === "bpmn:Message" && asString(element.id)).map((message) => ({
|
|
234
|
+
id: message.id,
|
|
235
|
+
name: asString(message.name) ?? message.id
|
|
236
|
+
}));
|
|
237
|
+
if (messages.length > 0) definitions.messages = messages;
|
|
238
|
+
const signals = rootElements.filter((element) => element.$type === "bpmn:Signal" && asString(element.id)).map((signal) => ({
|
|
239
|
+
id: signal.id,
|
|
240
|
+
name: asString(signal.name) ?? signal.id
|
|
241
|
+
}));
|
|
242
|
+
if (signals.length > 0) definitions.signals = signals;
|
|
243
|
+
const errors = rootElements.filter((element) => element.$type === "bpmn:Error" && asString(element.id)).map((error) => ({
|
|
244
|
+
id: error.id,
|
|
245
|
+
name: asString(error.name) ?? error.id,
|
|
246
|
+
...asString(error.errorCode) ? { errorCode: error.errorCode } : {}
|
|
247
|
+
}));
|
|
248
|
+
if (errors.length > 0) definitions.errors = errors;
|
|
249
|
+
const escalations = rootElements.filter((element) => element.$type === "bpmn:Escalation" && asString(element.id)).map((escalation) => ({
|
|
250
|
+
id: escalation.id,
|
|
251
|
+
name: asString(escalation.name) ?? escalation.id,
|
|
252
|
+
...asString(escalation.escalationCode) ? { escalationCode: escalation.escalationCode } : {}
|
|
253
|
+
}));
|
|
254
|
+
if (escalations.length > 0) definitions.escalations = escalations;
|
|
255
|
+
const itemDefinitions = asElements(rootElement.itemDefinitions).filter((item) => asString(item.id)).map((item) => ({
|
|
256
|
+
id: String(item.id).replace(/_item$/, ""),
|
|
257
|
+
name: String(item.id).replace(/_item$/, ""),
|
|
258
|
+
type: parseVariableType(item.structureRef)
|
|
259
|
+
}));
|
|
260
|
+
if (itemDefinitions.length > 0) definitions.variables = itemDefinitions;
|
|
261
|
+
return Object.keys(definitions).length > 0 ? definitions : void 0;
|
|
262
|
+
}
|
|
188
263
|
function extractSubProcessVariant(el) {
|
|
189
264
|
if (el.$type === "bpmn:Transaction") return "transaction";
|
|
190
265
|
if (el.$type === "bpmn:AdHocSubProcess") return "adhoc";
|
|
@@ -225,6 +300,7 @@ function buildNode(el, elementType, parentId, ctx, nodes) {
|
|
|
225
300
|
const label = asString(el.name);
|
|
226
301
|
const documentation = extractDocumentation(el);
|
|
227
302
|
const trigger = extractTrigger(el);
|
|
303
|
+
const eventDefinition = extractEventDefinition(el);
|
|
228
304
|
const isNonInterrupting = el.cancelActivity === false;
|
|
229
305
|
const attachedToRef = el.attachedToRef?.id;
|
|
230
306
|
const data = {
|
|
@@ -232,8 +308,17 @@ function buildNode(el, elementType, parentId, ctx, nodes) {
|
|
|
232
308
|
...label ? { label } : {},
|
|
233
309
|
...documentation ? { documentation } : {},
|
|
234
310
|
...trigger ? { trigger } : {},
|
|
311
|
+
...eventDefinition ? { eventDefinition } : {},
|
|
235
312
|
...isNonInterrupting ? { isNonInterrupting: true } : {},
|
|
236
|
-
...
|
|
313
|
+
...elementType === "BoundaryEvent" ? { cancelActivity: el.cancelActivity !== false } : {},
|
|
314
|
+
...attachedToRef ? { attachedToRef } : {},
|
|
315
|
+
...eventDefinition?.timer ? { timer: eventDefinition.timer, timerExpression: eventDefinition.timer } : {},
|
|
316
|
+
...eventDefinition?.messageRef ? { messageRef: eventDefinition.messageRef } : {},
|
|
317
|
+
...eventDefinition?.signalRef ? { signalRef: eventDefinition.signalRef } : {},
|
|
318
|
+
...eventDefinition?.errorRef ? { errorRef: eventDefinition.errorRef } : {},
|
|
319
|
+
...eventDefinition?.escalationRef ? { escalationRef: eventDefinition.escalationRef } : {},
|
|
320
|
+
...eventDefinition?.conditionExpression ? { conditionExpression: eventDefinition.conditionExpression } : {},
|
|
321
|
+
...eventDefinition?.linkName ? { linkName: eventDefinition.linkName } : {}
|
|
237
322
|
};
|
|
238
323
|
if (elementType === "SubProcess" || elementType === "Transaction" || elementType === "EventSubProcess" || elementType === "AdHocSubProcess") {
|
|
239
324
|
const variant = extractSubProcessVariant(el);
|
|
@@ -383,10 +468,23 @@ async function parseBpmnXml(xml) {
|
|
|
383
468
|
};
|
|
384
469
|
return { ...edge, data };
|
|
385
470
|
});
|
|
471
|
+
const firstProcess = asElements(rootElement.rootElements).find((rootEl) => rootEl.$type === "bpmn:Process");
|
|
472
|
+
const importedDefinitions = extractDefinitions(rootElement);
|
|
473
|
+
const process = firstProcess ? (() => {
|
|
474
|
+
const importedProcess = {};
|
|
475
|
+
const processId = asString(firstProcess.id);
|
|
476
|
+
const documentation = extractDocumentation(firstProcess);
|
|
477
|
+
if (processId) importedProcess.processId = processId;
|
|
478
|
+
if (typeof firstProcess.isExecutable === "boolean") importedProcess.executable = firstProcess.isExecutable;
|
|
479
|
+
if (documentation) importedProcess.documentation = documentation;
|
|
480
|
+
if (importedDefinitions) importedProcess.definitions = importedDefinitions;
|
|
481
|
+
return importedProcess;
|
|
482
|
+
})() : importedDefinitions ? { definitions: importedDefinitions } : void 0;
|
|
386
483
|
return {
|
|
387
484
|
nodes: normalizeChildPositions(nodes, nodeIds),
|
|
388
485
|
edges: normalizedEdges,
|
|
389
|
-
warnings
|
|
486
|
+
warnings,
|
|
487
|
+
...process ? { process } : {}
|
|
390
488
|
};
|
|
391
489
|
}
|
|
392
490
|
function collectDefaultFlows(el, defaultFlowById) {
|
|
@@ -416,6 +514,99 @@ function uid(prefix, id) {
|
|
|
416
514
|
function asNodes(nodes, types) {
|
|
417
515
|
return nodes.filter((n) => types.includes(n.data.elementType));
|
|
418
516
|
}
|
|
517
|
+
function normalizeEventDefinition(data) {
|
|
518
|
+
const trigger = data.eventDefinition?.type ?? data.trigger;
|
|
519
|
+
if (!trigger || trigger === "none") return void 0;
|
|
520
|
+
const normalized = { type: trigger };
|
|
521
|
+
const timer = data.eventDefinition?.timer ?? data.timer ?? data.timerExpression;
|
|
522
|
+
const messageRef = data.eventDefinition?.messageRef ?? (typeof data.messageRef === "string" ? data.messageRef : void 0);
|
|
523
|
+
const signalRef = data.eventDefinition?.signalRef ?? (typeof data.signalRef === "string" ? data.signalRef : void 0);
|
|
524
|
+
const errorRef = data.eventDefinition?.errorRef ?? (typeof data.errorRef === "string" ? data.errorRef : void 0);
|
|
525
|
+
const escalationRef = data.eventDefinition?.escalationRef ?? (typeof data.escalationRef === "string" ? data.escalationRef : void 0);
|
|
526
|
+
const conditionExpression = data.eventDefinition?.conditionExpression ?? (typeof data.conditionExpression === "string" ? data.conditionExpression : void 0);
|
|
527
|
+
const linkName = data.eventDefinition?.linkName ?? (typeof data.linkName === "string" ? data.linkName : void 0);
|
|
528
|
+
if (timer) normalized.timer = timer;
|
|
529
|
+
if (messageRef) normalized.messageRef = messageRef;
|
|
530
|
+
if (signalRef) normalized.signalRef = signalRef;
|
|
531
|
+
if (errorRef) normalized.errorRef = errorRef;
|
|
532
|
+
if (escalationRef) normalized.escalationRef = escalationRef;
|
|
533
|
+
if (conditionExpression) normalized.conditionExpression = conditionExpression;
|
|
534
|
+
if (linkName) normalized.linkName = linkName;
|
|
535
|
+
return normalized;
|
|
536
|
+
}
|
|
537
|
+
function parseVariableType2(type) {
|
|
538
|
+
switch (type) {
|
|
539
|
+
case "integer":
|
|
540
|
+
return "xsd:int";
|
|
541
|
+
case "boolean":
|
|
542
|
+
return "xsd:boolean";
|
|
543
|
+
case "date":
|
|
544
|
+
return "xsd:dateTime";
|
|
545
|
+
case "object":
|
|
546
|
+
return "xsd:anyType";
|
|
547
|
+
case "array":
|
|
548
|
+
return "xsd:anyType";
|
|
549
|
+
default:
|
|
550
|
+
return "xsd:string";
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
function buildGlobalDefinitions(moddle, definitionsSet) {
|
|
554
|
+
if (!definitionsSet) return [];
|
|
555
|
+
const rootElements = [];
|
|
556
|
+
for (const message of definitionsSet.messages ?? []) {
|
|
557
|
+
rootElements.push(moddle.create("bpmn:Message", { id: message.id, name: message.name }));
|
|
558
|
+
}
|
|
559
|
+
for (const signal of definitionsSet.signals ?? []) {
|
|
560
|
+
rootElements.push(moddle.create("bpmn:Signal", { id: signal.id, name: signal.name }));
|
|
561
|
+
}
|
|
562
|
+
for (const error of definitionsSet.errors ?? []) {
|
|
563
|
+
rootElements.push(moddle.create("bpmn:Error", {
|
|
564
|
+
id: error.id,
|
|
565
|
+
name: error.name,
|
|
566
|
+
...error.errorCode ? { errorCode: error.errorCode } : {}
|
|
567
|
+
}));
|
|
568
|
+
}
|
|
569
|
+
for (const escalation of definitionsSet.escalations ?? []) {
|
|
570
|
+
rootElements.push(moddle.create("bpmn:Escalation", {
|
|
571
|
+
id: escalation.id,
|
|
572
|
+
name: escalation.name,
|
|
573
|
+
...escalation.escalationCode ? { escalationCode: escalation.escalationCode } : {}
|
|
574
|
+
}));
|
|
575
|
+
}
|
|
576
|
+
return rootElements;
|
|
577
|
+
}
|
|
578
|
+
function buildItemDefinitions(moddle, variables) {
|
|
579
|
+
return (variables ?? []).map(
|
|
580
|
+
(variable) => moddle.create("bpmn:ItemDefinition", {
|
|
581
|
+
id: `${variable.id}_item`,
|
|
582
|
+
itemKind: "Information",
|
|
583
|
+
structureRef: parseVariableType2(variable.type)
|
|
584
|
+
})
|
|
585
|
+
);
|
|
586
|
+
}
|
|
587
|
+
function buildEventDefinitions(moddle, node, eventDefinition) {
|
|
588
|
+
if (eventDefinition.type === "multiple" || eventDefinition.type === "parallelMultiple") {
|
|
589
|
+
return [];
|
|
590
|
+
}
|
|
591
|
+
const defType = TRIGGER_TO_EVENT_DEF[eventDefinition.type];
|
|
592
|
+
if (!defType) return [];
|
|
593
|
+
const attrs = { id: uid("EventDef", node.id) };
|
|
594
|
+
if (eventDefinition.messageRef) attrs.messageRef = { id: eventDefinition.messageRef };
|
|
595
|
+
if (eventDefinition.signalRef) attrs.signalRef = { id: eventDefinition.signalRef };
|
|
596
|
+
if (eventDefinition.errorRef) attrs.errorRef = { id: eventDefinition.errorRef };
|
|
597
|
+
if (eventDefinition.escalationRef) attrs.escalationRef = { id: eventDefinition.escalationRef };
|
|
598
|
+
if (eventDefinition.conditionExpression) {
|
|
599
|
+
attrs.condition = moddle.create("bpmn:FormalExpression", {
|
|
600
|
+
body: eventDefinition.conditionExpression
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
if (eventDefinition.timer?.value) {
|
|
604
|
+
attrs[eventDefinition.timer.kind === "date" ? "timeDate" : eventDefinition.timer.kind === "cycle" ? "timeCycle" : "timeDuration"] = moddle.create("bpmn:FormalExpression", {
|
|
605
|
+
body: eventDefinition.timer.value
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
return [moddle.create(defType, attrs)];
|
|
609
|
+
}
|
|
419
610
|
function buildSemanticModel(moddle, nodes, edges, opts) {
|
|
420
611
|
const defId = opts.id ?? "Definitions_1";
|
|
421
612
|
const defName = opts.name;
|
|
@@ -427,13 +618,19 @@ function buildSemanticModel(moddle, nodes, edges, opts) {
|
|
|
427
618
|
targetNamespace: "http://bpmn.io/schema/bpmn",
|
|
428
619
|
...defName ? { name: defName } : {}
|
|
429
620
|
});
|
|
430
|
-
const rootElements = [
|
|
621
|
+
const rootElements = [
|
|
622
|
+
...buildGlobalDefinitions(moddle, opts.process?.definitions)
|
|
623
|
+
];
|
|
624
|
+
const itemDefinitions = buildItemDefinitions(moddle, opts.process?.definitions?.variables);
|
|
625
|
+
if (itemDefinitions.length > 0) {
|
|
626
|
+
definitions.itemDefinitions = itemDefinitions;
|
|
627
|
+
}
|
|
431
628
|
if (isCollaboration) {
|
|
432
629
|
const participants = [];
|
|
433
630
|
const processes = [];
|
|
434
631
|
for (const pool of poolNodes) {
|
|
435
632
|
const processId = `Process_${pool.id}`;
|
|
436
|
-
const process = buildProcess(moddle, nodes, edges, pool.id, laneNodes, processId);
|
|
633
|
+
const process = buildProcess(moddle, nodes, edges, pool.id, laneNodes, processId, opts);
|
|
437
634
|
processes.push(process);
|
|
438
635
|
const participant = moddle.create("bpmn:Participant", {
|
|
439
636
|
id: pool.id,
|
|
@@ -467,13 +664,21 @@ function buildSemanticModel(moddle, nodes, edges, opts) {
|
|
|
467
664
|
});
|
|
468
665
|
rootElements.push(collaboration, ...processes);
|
|
469
666
|
} else {
|
|
470
|
-
const process = buildProcess(
|
|
667
|
+
const process = buildProcess(
|
|
668
|
+
moddle,
|
|
669
|
+
nodes,
|
|
670
|
+
edges,
|
|
671
|
+
void 0,
|
|
672
|
+
laneNodes,
|
|
673
|
+
opts.process?.processId ?? "Process_1",
|
|
674
|
+
opts
|
|
675
|
+
);
|
|
471
676
|
rootElements.push(process);
|
|
472
677
|
}
|
|
473
678
|
definitions.rootElements = rootElements;
|
|
474
679
|
return definitions;
|
|
475
680
|
}
|
|
476
|
-
function buildProcess(moddle, allNodes, allEdges, poolId, laneNodes, processId) {
|
|
681
|
+
function buildProcess(moddle, allNodes, allEdges, poolId, laneNodes, processId, opts) {
|
|
477
682
|
const subProcessIds = new Set(
|
|
478
683
|
allNodes.filter(
|
|
479
684
|
(n) => n.data.elementType === "SubProcess" || n.data.elementType === "Transaction" || n.data.elementType === "EventSubProcess" || n.data.elementType === "AdHocSubProcess"
|
|
@@ -523,9 +728,14 @@ function buildProcess(moddle, allNodes, allEdges, poolId, laneNodes, processId)
|
|
|
523
728
|
}
|
|
524
729
|
const process = moddle.create("bpmn:Process", {
|
|
525
730
|
id: processId,
|
|
526
|
-
isExecutable: true,
|
|
731
|
+
isExecutable: opts.process?.executable ?? true,
|
|
527
732
|
flowElements
|
|
528
733
|
});
|
|
734
|
+
if (opts.process?.documentation) {
|
|
735
|
+
process.documentation = [
|
|
736
|
+
moddle.create("bpmn:Documentation", { text: opts.process.documentation })
|
|
737
|
+
];
|
|
738
|
+
}
|
|
529
739
|
if (myLanes.length > 0) {
|
|
530
740
|
const laneElements = myLanes.map(
|
|
531
741
|
(l) => moddle.create("bpmn:Lane", {
|
|
@@ -542,7 +752,8 @@ function buildProcess(moddle, allNodes, allEdges, poolId, laneNodes, processId)
|
|
|
542
752
|
return process;
|
|
543
753
|
}
|
|
544
754
|
function buildFlowElement(moddle, node, allNodes, allEdges) {
|
|
545
|
-
const { elementType, label
|
|
755
|
+
const { elementType, label } = node.data;
|
|
756
|
+
const eventDefinition = normalizeEventDefinition(node.data);
|
|
546
757
|
if (elementType === "Pool" || elementType === "Lane") return null;
|
|
547
758
|
const moddleType = ELEMENT_TYPE_TO_MODDLE[elementType];
|
|
548
759
|
if (!moddleType) return null;
|
|
@@ -555,15 +766,15 @@ function buildFlowElement(moddle, node, allNodes, allEdges) {
|
|
|
555
766
|
moddle.create("bpmn:Documentation", { text: node.data.documentation })
|
|
556
767
|
];
|
|
557
768
|
}
|
|
558
|
-
if (
|
|
559
|
-
const
|
|
560
|
-
if (
|
|
561
|
-
|
|
562
|
-
}
|
|
769
|
+
if (eventDefinition) {
|
|
770
|
+
const eventDefinitions = buildEventDefinitions(moddle, node, eventDefinition);
|
|
771
|
+
if (eventDefinitions.length > 0) attrs.eventDefinitions = eventDefinitions;
|
|
772
|
+
if (eventDefinition.linkName) attrs.name = eventDefinition.linkName;
|
|
563
773
|
}
|
|
564
774
|
if (elementType === "BoundaryEvent") {
|
|
565
775
|
attrs.attachedToRef = { id: node.data.attachedToRef ?? node.parentId };
|
|
566
|
-
|
|
776
|
+
const interrupting = node.data.cancelActivity ?? !node.data.isNonInterrupting;
|
|
777
|
+
attrs.cancelActivity = interrupting;
|
|
567
778
|
}
|
|
568
779
|
const isSubProcess = elementType === "SubProcess" || elementType === "Transaction" || elementType === "EventSubProcess" || elementType === "AdHocSubProcess";
|
|
569
780
|
if (isSubProcess) {
|
|
@@ -712,5 +923,5 @@ async function serializeBpmnXml(nodes, edges, opts = {}) {
|
|
|
712
923
|
}
|
|
713
924
|
|
|
714
925
|
export { parseBpmnXml, serializeBpmnXml };
|
|
715
|
-
//# sourceMappingURL=chunk-
|
|
716
|
-
//# sourceMappingURL=chunk-
|
|
926
|
+
//# sourceMappingURL=chunk-ASZ3TFNQ.js.map
|
|
927
|
+
//# sourceMappingURL=chunk-ASZ3TFNQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/xml/mapper.ts","../src/xml/importer.ts","../src/xml/exporter.ts"],"names":["laneSet","def","parseVariableType","BpmnModdle"],"mappings":";;;;AAIO,IAAM,sBAAA,GAAsE;AAAA,EACjF,iBAAA,EAA6B,YAAA;AAAA,EAC7B,eAAA,EAA6B,UAAA;AAAA,EAC7B,6BAAA,EAA+B,wBAAA;AAAA,EAC/B,6BAAA,EAA+B,wBAAA;AAAA,EAC/B,oBAAA,EAA6B,eAAA;AAAA,EAC7B,WAAA,EAA6B,MAAA;AAAA,EAC7B,eAAA,EAA6B,UAAA;AAAA,EAC7B,kBAAA,EAA6B,aAAA;AAAA,EAC7B,iBAAA,EAA6B,YAAA;AAAA,EAC7B,iBAAA,EAA6B,YAAA;AAAA,EAC7B,uBAAA,EAA6B,kBAAA;AAAA,EAC7B,kBAAA,EAA6B,a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EAAQ,WAAA,EAAa,KAAA,EAAO,KAAK,CAAA;AAE7C,EAAA,MAAM,EAAE,GAAA,EAAI,GAAI,MAAM,MAAA,CAAO,MAAM,WAAA,EAAa;AAAA,IAC9C,MAAA,EAAQ,KAAK,MAAA,IAAU;AAAA,GACxB,CAAA;AAED,EAAA,OAAO,GAAA;AACT","file":"chunk-ASZ3TFNQ.js","sourcesContent":["import type { BpmnElementType, BpmnEdgeType, EventTrigger } from \"../elements/types\";\n\n// ─── BPMN moddle $type → our BpmnElementType ─────────────────────────────────\n\nexport const MODDLE_TO_ELEMENT_TYPE: Record<string, BpmnElementType | undefined> = {\n \"bpmn:StartEvent\": \"StartEvent\",\n \"bpmn:EndEvent\": \"EndEvent\",\n \"bpmn:IntermediateCatchEvent\": \"IntermediateCatchEvent\",\n \"bpmn:IntermediateThrowEvent\": \"IntermediateThrowEvent\",\n \"bpmn:BoundaryEvent\": \"BoundaryEvent\",\n \"bpmn:Task\": \"Task\",\n \"bpmn:UserTask\": \"UserTask\",\n \"bpmn:ServiceTask\": \"ServiceTask\",\n \"bpmn:ScriptTask\": \"ScriptTask\",\n \"bpmn:ManualTask\": \"ManualTask\",\n \"bpmn:BusinessRuleTask\": \"BusinessRuleTask\",\n \"bpmn:ReceiveTask\": \"ReceiveTask\",\n \"bpmn:SendTask\": \"SendTask\",\n \"bpmn:CallActivity\": \"CallActivity\",\n \"bpmn:ExclusiveGateway\": \"ExclusiveGateway\",\n \"bpmn:InclusiveGateway\": \"InclusiveGateway\",\n \"bpmn:ParallelGateway\": \"ParallelGateway\",\n \"bpmn:EventBasedGateway\": \"EventBasedGateway\",\n \"bpmn:ComplexGateway\": \"ComplexGateway\",\n \"bpmn:SubProcess\": \"SubProcess\",\n \"bpmn:AdHocSubProcess\": \"AdHocSubProcess\",\n \"bpmn:Transaction\": \"Transaction\",\n \"bpmn:TextAnnotation\": \"Annotation\",\n \"bpmn:Group\": \"Group\",\n \"bpmn:DataObject\": \"DataObject\",\n \"bpmn:DataObjectReference\": \"DataObjectReference\",\n \"bpmn:DataInput\": \"DataInput\",\n \"bpmn:DataOutput\": \"DataOutput\",\n \"bpmn:DataStore\": \"DataStore\",\n \"bpmn:DataStoreReference\": \"DataStoreReference\",\n \"bpmn:Conversation\": \"Conversation\",\n \"bpmn:SubConversation\": \"SubConversation\",\n \"bpmn:CallConversation\": \"CallConversation\",\n \"bpmn:ChoreographyTask\": \"ChoreographyTask\",\n \"bpmn:SubChoreography\": \"SubChoreography\",\n \"bpmn:CallChoreography\": \"CallChoreography\",\n \"bpmn:Lane\": \"Lane\",\n};\n\n// ─── Our BpmnElementType → canonical bpmn: type ──────────────────────────────\n\nexport const ELEMENT_TYPE_TO_MODDLE: Partial<Record<BpmnElementType, string>> = {\n StartEvent: \"bpmn:StartEvent\",\n EndEvent: \"bpmn:EndEvent\",\n IntermediateCatchEvent: \"bpmn:IntermediateCatchEvent\",\n IntermediateThrowEvent: \"bpmn:IntermediateThrowEvent\",\n BoundaryEvent: \"bpmn:BoundaryEvent\",\n Task: \"bpmn:Task\",\n UserTask: \"bpmn:UserTask\",\n ServiceTask: \"bpmn:ServiceTask\",\n ScriptTask: \"bpmn:ScriptTask\",\n ManualTask: \"bpmn:ManualTask\",\n BusinessRuleTask: \"bpmn:BusinessRuleTask\",\n ReceiveTask: \"bpmn:ReceiveTask\",\n SendTask: \"bpmn:SendTask\",\n CallActivity: \"bpmn:CallActivity\",\n ExclusiveGateway: \"bpmn:ExclusiveGateway\",\n InclusiveGateway: \"bpmn:InclusiveGateway\",\n ParallelGateway: \"bpmn:ParallelGateway\",\n EventBasedGateway: \"bpmn:EventBasedGateway\",\n ComplexGateway: \"bpmn:ComplexGateway\",\n SubProcess: \"bpmn:SubProcess\",\n Transaction: \"bpmn:Transaction\",\n EventSubProcess: \"bpmn:SubProcess\",\n AdHocSubProcess: \"bpmn:AdHocSubProcess\",\n Pool: \"bpmn:Participant\",\n Lane: \"bpmn:Lane\",\n Annotation: \"bpmn:TextAnnotation\",\n Group: \"bpmn:Group\",\n DataObject: \"bpmn:DataObject\",\n DataObjectReference: \"bpmn:DataObjectReference\",\n DataInput: \"bpmn:DataInput\",\n DataOutput: \"bpmn:DataOutput\",\n DataStore: \"bpmn:DataStore\",\n DataStoreReference: \"bpmn:DataStoreReference\",\n Conversation: \"bpmn:Conversation\",\n SubConversation: \"bpmn:SubConversation\",\n CallConversation: \"bpmn:CallConversation\",\n ChoreographyTask: \"bpmn:ChoreographyTask\",\n SubChoreography: \"bpmn:SubChoreography\",\n CallChoreography: \"bpmn:CallChoreography\",\n};\n\n// ─── Edge type mappings ───────────────────────────────────────────────────────\n\nexport const MODDLE_TO_EDGE_TYPE: Record<string, BpmnEdgeType | undefined> = {\n \"bpmn:SequenceFlow\": \"sequenceFlow\",\n \"bpmn:MessageFlow\": \"messageFlow\",\n \"bpmn:Association\": \"association\",\n \"bpmn:DataInputAssociation\": \"dataAssociation\",\n \"bpmn:DataOutputAssociation\": \"dataAssociation\",\n \"bpmn:ConversationLink\": \"conversationLink\",\n};\n\nexport const EDGE_TYPE_TO_MODDLE: Record<BpmnEdgeType, string> = {\n sequenceFlow: \"bpmn:SequenceFlow\",\n messageFlow: \"bpmn:MessageFlow\",\n association: \"bpmn:Association\",\n dataAssociation: \"bpmn:DataInputAssociation\",\n conversationLink:\"bpmn:ConversationLink\",\n};\n\n// ─── Event definition type → trigger ─────────────────────────────────────────\n\nexport const EVENT_DEF_TO_TRIGGER: Record<string, EventTrigger> = {\n \"bpmn:MessageEventDefinition\": \"message\",\n \"bpmn:TimerEventDefinition\": \"timer\",\n \"bpmn:EscalationEventDefinition\": \"escalation\",\n \"bpmn:ConditionalEventDefinition\": \"conditional\",\n \"bpmn:ErrorEventDefinition\": \"error\",\n \"bpmn:CancelEventDefinition\": \"cancel\",\n \"bpmn:CompensateEventDefinition\": \"compensation\",\n \"bpmn:SignalEventDefinition\": \"signal\",\n \"bpmn:LinkEventDefinition\": \"link\",\n \"bpmn:TerminateEventDefinition\": \"terminate\",\n};\n\nexport const TRIGGER_TO_EVENT_DEF: Partial<Record<EventTrigger, string>> = {\n message: \"bpmn:MessageEventDefinition\",\n timer: \"bpmn:TimerEventDefinition\",\n escalation: \"bpmn:EscalationEventDefinition\",\n conditional: \"bpmn:ConditionalEventDefinition\",\n error: \"bpmn:ErrorEventDefinition\",\n cancel: \"bpmn:CancelEventDefinition\",\n compensation: \"bpmn:CompensateEventDefinition\",\n signal: \"bpmn:SignalEventDefinition\",\n link: \"bpmn:LinkEventDefinition\",\n terminate: \"bpmn:TerminateEventDefinition\",\n};\n","import { BpmnModdle, type ModdleElement } from \"bpmn-moddle\";\nimport { BPMN_ELEMENT_CATALOG } from \"../elements/catalog\";\nimport type {\n BpmnElementType,\n BpmnEdgeType,\n BpmnNodeData,\n BpmnEdgeData,\n EventTrigger,\n SubProcessVariant,\n BpmnDefinitionsSet,\n BpmnEventDefinition,\n BpmnProcessVariable,\n} from \"../elements/types\";\nimport type { BpmnRFNode, BpmnRFEdge, BpmnImportResult } from \"./types\";\nimport {\n MODDLE_TO_ELEMENT_TYPE,\n MODDLE_TO_EDGE_TYPE,\n EVENT_DEF_TO_TRIGGER,\n} from \"./mapper\";\n\n// ─── Internal helpers ─────────────────────────────────────────────────────────\n\ninterface ShapeInfo {\n x: number;\n y: number;\n width: number;\n height: number;\n isExpanded?: boolean;\n}\n\ntype ShapeMap = Map<string, ShapeInfo>;\ntype WaypointMap = Map<string, Array<{ x: number; y: number }>>;\n\nfunction asElements(v: unknown): ModdleElement[] {\n return Array.isArray(v) ? (v as ModdleElement[]) : [];\n}\n\nfunction asString(v: unknown): string | undefined {\n return typeof v === \"string\" && v.trim() ? v.trim() : undefined;\n}\n\nfunction extractDocumentation(el: ModdleElement): string | undefined {\n const [doc] = asElements(el.documentation);\n return asString(doc?.text);\n}\n\n// ─── Extract BPMNDI shape/edge positions ─────────────────────────────────────\n\nfunction extractDiagramInfo(definitions: ModdleElement): {\n shapes: ShapeMap;\n waypoints: WaypointMap;\n} {\n const shapes: ShapeMap = new Map();\n const waypoints: WaypointMap = new Map();\n\n for (const diagram of asElements(definitions.diagrams)) {\n const plane = diagram.plane as ModdleElement | undefined;\n if (!plane) continue;\n\n for (const el of asElements(plane.planeElement)) {\n const bpmnEl = el.bpmnElement as ModdleElement | undefined;\n if (!bpmnEl?.id) continue;\n const id = bpmnEl.id as string;\n\n if (el.$type === \"bpmndi:BPMNShape\") {\n const b = el.bounds as { x: number; y: number; width: number; height: number } | undefined;\n if (b) {\n shapes.set(id, {\n x: b.x,\n y: b.y,\n width: b.width,\n height: b.height,\n ...(typeof el.isExpanded === \"boolean\" ? { isExpanded: el.isExpanded as boolean } : {}),\n });\n }\n } else if (el.$type === \"bpmndi:BPMNEdge\") {\n const pts = (el.waypoint ?? []) as Array<{ x: number; y: number }>;\n if (pts.length) waypoints.set(id, pts);\n }\n }\n }\n\n return { shapes, waypoints };\n}\n\n// ─── Lane membership (flowNodeId → laneId) ───────────────────────────────────\n\nfunction extractLaneMembership(process: ModdleElement): Map<string, string> {\n const map = new Map<string, string>();\n\n function walkLaneSet(laneSet: ModdleElement) {\n for (const lane of asElements(laneSet.lanes)) {\n const laneId = lane.id as string | undefined;\n if (!laneId) continue;\n for (const ref of asElements(lane.flowNodeRef)) {\n if (ref.id) map.set(ref.id as string, laneId);\n }\n const child = lane.childLaneSet as ModdleElement | undefined;\n if (child) walkLaneSet(child);\n }\n }\n\n const laneSet = process.laneSet as ModdleElement | undefined;\n if (laneSet) walkLaneSet(laneSet);\n return map;\n}\n\n// ─── Event trigger from eventDefinitions ─────────────────────────────────────\n\nfunction extractTrigger(el: ModdleElement): EventTrigger | undefined {\n const defs = asElements(el.eventDefinitions);\n if (defs.length === 0) return undefined;\n if (defs.length > 1) {\n return defs.some((def) => def.$type === \"bpmn:ParallelMultipleEventDefinition\")\n ? \"parallelMultiple\"\n : \"multiple\";\n }\n return EVENT_DEF_TO_TRIGGER[defs[0].$type];\n}\n\nfunction parseVariableType(value: unknown): BpmnProcessVariable[\"type\"] {\n const text = asString(value) ?? \"\";\n if (text.includes(\"int\")) return \"integer\";\n if (text.includes(\"boolean\")) return \"boolean\";\n if (text.includes(\"date\")) return \"date\";\n if (text.includes(\"array\")) return \"array\";\n if (text.includes(\"anyType\")) return \"object\";\n return \"string\";\n}\n\nfunction extractEventDefinition(el: ModdleElement): BpmnEventDefinition | undefined {\n const defs = asElements(el.eventDefinitions);\n if (defs.length === 0) return undefined;\n if (defs.length > 1) {\n return {\n type: defs.some((def) => def.$type === \"bpmn:ParallelMultipleEventDefinition\")\n ? \"parallelMultiple\"\n : \"multiple\",\n };\n }\n\n const [def] = defs;\n const type = EVENT_DEF_TO_TRIGGER[def.$type];\n if (!type) return undefined;\n\n const eventDefinition: BpmnEventDefinition = {\n type,\n ...(asString((def.messageRef as ModdleElement | undefined)?.id) ? { messageRef: (def.messageRef as ModdleElement).id as string } : {}),\n ...(asString((def.signalRef as ModdleElement | undefined)?.id) ? { signalRef: (def.signalRef as ModdleElement).id as string } : {}),\n ...(asString((def.errorRef as ModdleElement | undefined)?.id) ? { errorRef: (def.errorRef as ModdleElement).id as string } : {}),\n ...(asString((def.escalationRef as ModdleElement | undefined)?.id) ? { escalationRef: (def.escalationRef as ModdleElement).id as string } : {}),\n ...(asString((def.condition as ModdleElement | undefined)?.body) ? { conditionExpression: (def.condition as ModdleElement).body as string } : {}),\n };\n\n const timeDate = asString((def.timeDate as ModdleElement | undefined)?.body);\n const timeDuration = asString((def.timeDuration as ModdleElement | undefined)?.body);\n const timeCycle = asString((def.timeCycle as ModdleElement | undefined)?.body);\n if (timeDate) eventDefinition.timer = { kind: \"date\", value: timeDate };\n else if (timeCycle) eventDefinition.timer = { kind: \"cycle\", value: timeCycle };\n else if (timeDuration) eventDefinition.timer = { kind: \"duration\", value: timeDuration };\n\n if (type === \"link\") {\n const linkName = asString(el.name) ?? asString(def.name);\n if (linkName) eventDefinition.linkName = linkName;\n }\n\n return eventDefinition;\n}\n\nfunction extractDefinitions(rootElement: ModdleElement): BpmnDefinitionsSet | undefined {\n const definitions: BpmnDefinitionsSet = {};\n const rootElements = asElements(rootElement.rootElements);\n\n const messages = rootElements\n .filter((element) => element.$type === \"bpmn:Message\" && asString(element.id))\n .map((message) => ({\n id: message.id as string,\n name: asString(message.name) ?? message.id as string,\n }));\n if (messages.length > 0) definitions.messages = messages;\n\n const signals = rootElements\n .filter((element) => element.$type === \"bpmn:Signal\" && asString(element.id))\n .map((signal) => ({\n id: signal.id as string,\n name: asString(signal.name) ?? signal.id as string,\n }));\n if (signals.length > 0) definitions.signals = signals;\n\n const errors = rootElements\n .filter((element) => element.$type === \"bpmn:Error\" && asString(element.id))\n .map((error) => ({\n id: error.id as string,\n name: asString(error.name) ?? error.id as string,\n ...(asString(error.errorCode) ? { errorCode: error.errorCode as string } : {}),\n }));\n if (errors.length > 0) definitions.errors = errors;\n\n const escalations = rootElements\n .filter((element) => element.$type === \"bpmn:Escalation\" && asString(element.id))\n .map((escalation) => ({\n id: escalation.id as string,\n name: asString(escalation.name) ?? escalation.id as string,\n ...(asString(escalation.escalationCode) ? { escalationCode: escalation.escalationCode as string } : {}),\n }));\n if (escalations.length > 0) definitions.escalations = escalations;\n\n const itemDefinitions = asElements(rootElement.itemDefinitions)\n .filter((item) => asString(item.id))\n .map((item) => ({\n id: String(item.id).replace(/_item$/, \"\"),\n name: String(item.id).replace(/_item$/, \"\"),\n type: parseVariableType(item.structureRef),\n }));\n if (itemDefinitions.length > 0) definitions.variables = itemDefinitions;\n\n return Object.keys(definitions).length > 0 ? definitions : undefined;\n}\n\n// ─── SubProcessVariant from moddle type / properties ─────────────────────────\n\nfunction extractSubProcessVariant(el: ModdleElement): SubProcessVariant | undefined {\n if (el.$type === \"bpmn:Transaction\") return \"transaction\";\n if (el.$type === \"bpmn:AdHocSubProcess\") return \"adhoc\";\n if (el.$type === \"bpmn:SubProcess\" && el.triggeredByEvent === true) return \"event\";\n if (el.triggeredByEvent === true) return \"event\";\n return \"embedded\";\n}\n\n// ─── Walk a flowElements list, producing nodes and edges ─────────────────────\n\ninterface WalkContext {\n shapes: ShapeMap;\n waypoints: WaypointMap;\n laneMembership: Map<string, string>;\n warnings: string[];\n autoX: { value: number };\n}\n\nfunction walkFlowElements(\n elements: ModdleElement[],\n parentId: string | undefined,\n ctx: WalkContext,\n nodes: BpmnRFNode[],\n edges: BpmnRFEdge[],\n) {\n for (const el of elements) {\n const { $type, id } = el;\n if (!id) continue;\n\n const edgeType = MODDLE_TO_EDGE_TYPE[$type];\n if (edgeType !== undefined) {\n buildEdge(el, edgeType, ctx, edges);\n continue;\n }\n\n // Lane nodes are handled separately via laneMembership\n if ($type === \"bpmn:LaneSet\") continue;\n\n const elementType =\n $type === \"bpmn:SubProcess\" && el.triggeredByEvent === true\n ? \"EventSubProcess\"\n : MODDLE_TO_ELEMENT_TYPE[$type];\n if (!elementType) {\n ctx.warnings.push(`Unknown element type \"${$type}\" (id=${id as string}) — skipped.`);\n continue;\n }\n\n buildNode(el, elementType, parentId, ctx, nodes);\n\n // Recurse into subprocess children\n if ($type === \"bpmn:SubProcess\" || $type === \"bpmn:Transaction\" || $type === \"bpmn:AdHocSubProcess\") {\n const children = asElements(el.flowElements);\n const laneMembership = extractLaneMembership(el);\n walkFlowElements(children, id as string, { ...ctx, laneMembership }, nodes, edges);\n }\n }\n}\n\nfunction buildNode(\n el: ModdleElement,\n elementType: BpmnElementType,\n parentId: string | undefined,\n ctx: WalkContext,\n nodes: BpmnRFNode[],\n) {\n const id = el.id as string;\n const meta = BPMN_ELEMENT_CATALOG[elementType];\n const shape = ctx.shapes.get(id);\n\n // Position: use BPMNDI if available, otherwise auto-grid\n const x = shape?.x ?? ctx.autoX.value;\n const y = shape?.y ?? 100;\n if (!shape) ctx.autoX.value += (meta?.defaultWidth ?? 120) + 20;\n\n const label = asString(el.name);\n const documentation = extractDocumentation(el);\n const trigger = extractTrigger(el);\n const eventDefinition = extractEventDefinition(el);\n const isNonInterrupting = el.cancelActivity === false;\n const attachedToRef = (el.attachedToRef as ModdleElement | undefined)?.id as string | undefined;\n\n const data: BpmnNodeData = {\n elementType,\n ...(label ? { label } : {}),\n ...(documentation ? { documentation } : {}),\n ...(trigger ? { trigger } : {}),\n ...(eventDefinition ? { eventDefinition } : {}),\n ...(isNonInterrupting ? { isNonInterrupting: true } : {}),\n ...(elementType === \"BoundaryEvent\" ? { cancelActivity: el.cancelActivity !== false } : {}),\n ...(attachedToRef ? { attachedToRef } : {}),\n ...(eventDefinition?.timer ? { timer: eventDefinition.timer, timerExpression: eventDefinition.timer } : {}),\n ...(eventDefinition?.messageRef ? { messageRef: eventDefinition.messageRef } : {}),\n ...(eventDefinition?.signalRef ? { signalRef: eventDefinition.signalRef } : {}),\n ...(eventDefinition?.errorRef ? { errorRef: eventDefinition.errorRef } : {}),\n ...(eventDefinition?.escalationRef ? { escalationRef: eventDefinition.escalationRef } : {}),\n ...(eventDefinition?.conditionExpression ? { conditionExpression: eventDefinition.conditionExpression } : {}),\n ...(eventDefinition?.linkName ? { linkName: eventDefinition.linkName } : {}),\n };\n\n // SubProcess variant\n if (elementType === \"SubProcess\" || elementType === \"Transaction\" || elementType === \"EventSubProcess\" || elementType === \"AdHocSubProcess\") {\n const variant = extractSubProcessVariant(el);\n if (variant) data.subProcessVariant = variant;\n const isExpanded = shape?.isExpanded ?? true;\n data.isExpanded = isExpanded;\n }\n\n // Determine effective parentId: lane membership overrides process-level parent\n const laneId = ctx.laneMembership.get(id);\n const effectiveParentId = attachedToRef ?? laneId ?? parentId;\n\n const node: BpmnRFNode = {\n id,\n type: elementType,\n position: { x, y },\n data,\n width: shape?.width ?? meta?.defaultWidth,\n height: shape?.height ?? meta?.defaultHeight,\n ...(effectiveParentId ? { parentId: effectiveParentId } : {}),\n };\n\n nodes.push(node);\n}\n\nfunction buildEdge(\n el: ModdleElement,\n edgeType: BpmnEdgeType,\n ctx: WalkContext,\n edges: BpmnRFEdge[],\n) {\n const id = el.id as string;\n const source = (el.sourceRef as ModdleElement | undefined)?.id as string | undefined;\n const target = (el.targetRef as ModdleElement | undefined)?.id as string | undefined;\n\n if (!source || !target) {\n ctx.warnings.push(`Edge \"${id}\" missing source or target — skipped.`);\n return;\n }\n\n const label = asString(el.name);\n const documentation = extractDocumentation(el);\n const condExpr = el.conditionExpression as { body?: string } | undefined;\n\n const data: BpmnEdgeData = {\n edgeType,\n ...(label ? { label } : {}),\n ...(documentation ? { documentation } : {}),\n ...(condExpr?.body ? { conditionExpression: condExpr.body } : {}),\n };\n\n const waypoints = ctx.waypoints.get(id);\n if (waypoints?.length) data.routingPoints = waypoints;\n\n edges.push({ id, type: edgeType, source, target, data });\n}\n\n// ─── Handle Collaboration: Participants → Pool nodes ──────────────────────────\n\nfunction handleCollaboration(\n collaboration: ModdleElement,\n ctx: WalkContext,\n nodes: BpmnRFNode[],\n edges: BpmnRFEdge[],\n) {\n // Participants become Pool nodes\n for (const participant of asElements(collaboration.participants)) {\n const id = participant.id as string | undefined;\n if (!id) continue;\n const label = asString(participant.name);\n const shape = ctx.shapes.get(id);\n\n const poolNode: BpmnRFNode = {\n id,\n type: \"Pool\",\n position: { x: shape?.x ?? 0, y: shape?.y ?? 0 },\n data: { elementType: \"Pool\", ...(label ? { label } : {}) },\n width: shape?.width ?? 600,\n height: shape?.height ?? 200,\n };\n nodes.push(poolNode);\n\n // Walk the referenced process, assigning pool as parent\n const processRef = participant.processRef as ModdleElement | undefined;\n if (processRef) {\n const laneMembership = extractLaneMembership(processRef);\n walkFlowElements(\n asElements(processRef.flowElements),\n id,\n { ...ctx, laneMembership },\n nodes,\n edges,\n );\n\n // Add Lane nodes\n const laneSet = processRef.laneSet as ModdleElement | undefined;\n if (laneSet) {\n addLaneNodes(laneSet, id, ctx, nodes);\n }\n }\n }\n\n // Message flows\n for (const mf of asElements(collaboration.messageFlows)) {\n buildEdge(mf, \"messageFlow\", ctx, edges);\n }\n\n // Conversation links\n for (const cl of asElements(collaboration.conversationLinks)) {\n buildEdge(cl, \"conversationLink\", ctx, edges);\n }\n}\n\nfunction addLaneNodes(\n laneSet: ModdleElement,\n poolId: string,\n ctx: WalkContext,\n nodes: BpmnRFNode[],\n) {\n for (const lane of asElements(laneSet.lanes)) {\n const id = lane.id as string | undefined;\n if (!id) continue;\n const label = asString(lane.name);\n const shape = ctx.shapes.get(id);\n\n nodes.push({\n id,\n type: \"Lane\",\n position: { x: shape?.x ?? 30, y: shape?.y ?? 0 },\n data: { elementType: \"Lane\", ...(label ? { label } : {}) },\n width: shape?.width ?? 570,\n height: shape?.height ?? 120,\n parentId: poolId,\n });\n\n const child = lane.childLaneSet as ModdleElement | undefined;\n if (child) addLaneNodes(child, poolId, ctx, nodes);\n }\n}\n\n// ─── Public: parseBpmnXml ─────────────────────────────────────────────────────\n\nexport async function parseBpmnXml(xml: string): Promise<BpmnImportResult> {\n const moddle = new BpmnModdle();\n const warnings: string[] = [];\n\n let rootElement: ModdleElement;\n try {\n const result = await moddle.fromXML(xml);\n rootElement = result.rootElement;\n for (const w of result.warnings) warnings.push(w.message);\n } catch (err) {\n throw new Error(`Failed to parse BPMN XML: ${String(err)}`);\n }\n\n const nodes: BpmnRFNode[] = [];\n const edges: BpmnRFEdge[] = [];\n\n const { shapes, waypoints } = extractDiagramInfo(rootElement);\n const ctx: WalkContext = {\n shapes,\n waypoints,\n laneMembership: new Map(),\n warnings,\n autoX: { value: 50 },\n };\n\n for (const rootEl of asElements(rootElement.rootElements)) {\n if (rootEl.$type === \"bpmn:Collaboration\") {\n handleCollaboration(rootEl, ctx, nodes, edges);\n } else if (rootEl.$type === \"bpmn:Process\") {\n const laneMembership = extractLaneMembership(rootEl);\n const laneSet = rootEl.laneSet as ModdleElement | undefined;\n if (laneSet) addLaneNodes(laneSet, \"\", ctx, nodes);\n walkFlowElements(\n asElements(rootEl.flowElements),\n undefined,\n { ...ctx, laneMembership },\n nodes,\n edges,\n );\n }\n }\n\n const defaultFlowById = new Set<string>();\n const nodeIds = new Set(nodes.map((node) => node.id));\n for (const rootEl of asElements(rootElement.rootElements)) {\n collectDefaultFlows(rootEl, defaultFlowById);\n }\n\n const normalizedEdges: BpmnRFEdge[] = edges.map((edge) => {\n if (!defaultFlowById.has(edge.id)) return edge;\n const data: BpmnEdgeData = {\n edgeType: edge.data?.edgeType ?? (edge.type as BpmnEdgeType),\n ...(edge.data ?? {}),\n isDefault: true,\n };\n return { ...edge, data };\n });\n\n const firstProcess = asElements(rootElement.rootElements).find((rootEl) => rootEl.$type === \"bpmn:Process\");\n\n const importedDefinitions = extractDefinitions(rootElement);\n const process =\n firstProcess\n ? (() => {\n const importedProcess: NonNullable<BpmnImportResult[\"process\"]> = {};\n const processId = asString(firstProcess.id);\n const documentation = extractDocumentation(firstProcess);\n if (processId) importedProcess.processId = processId;\n if (typeof firstProcess.isExecutable === \"boolean\") importedProcess.executable = firstProcess.isExecutable as boolean;\n if (documentation) importedProcess.documentation = documentation;\n if (importedDefinitions) importedProcess.definitions = importedDefinitions;\n return importedProcess;\n })()\n : importedDefinitions\n ? { definitions: importedDefinitions }\n : undefined;\n\n return {\n nodes: normalizeChildPositions(nodes, nodeIds),\n edges: normalizedEdges,\n warnings,\n ...(process ? { process } : {}),\n };\n}\n\nfunction collectDefaultFlows(el: ModdleElement, defaultFlowById: Set<string>): void {\n const defaultRef = el.default as ModdleElement | undefined;\n if (defaultRef?.id) defaultFlowById.add(defaultRef.id as string);\n\n for (const child of asElements(el.rootElements)) collectDefaultFlows(child, defaultFlowById);\n for (const child of asElements(el.flowElements)) collectDefaultFlows(child, defaultFlowById);\n}\n\nfunction normalizeChildPositions(nodes: BpmnRFNode[], nodeIds: Set<string>): BpmnRFNode[] {\n const absoluteById = new Map(nodes.map((node) => [node.id, node.position]));\n\n return nodes.map((node) => {\n if (!node.parentId || !nodeIds.has(node.parentId)) return node;\n const parentPosition = absoluteById.get(node.parentId);\n if (!parentPosition) return node;\n\n return {\n ...node,\n position: {\n x: node.position.x - parentPosition.x,\n y: node.position.y - parentPosition.y,\n },\n };\n });\n}\n","import { BpmnModdle, type ModdleElement } from \"bpmn-moddle\";\nimport { BPMN_ELEMENT_CATALOG } from \"../elements/catalog\";\nimport type { BpmnRFNode, BpmnRFEdge, BpmnExportOptions } from \"./types\";\nimport type {\n BpmnDefinitionsSet,\n BpmnEventDefinition,\n BpmnNodeData,\n BpmnProcessVariable,\n} from \"../elements/types\";\nimport {\n ELEMENT_TYPE_TO_MODDLE,\n EDGE_TYPE_TO_MODDLE,\n TRIGGER_TO_EVENT_DEF,\n} from \"./mapper\";\n\n// ─── Helpers ──────────────────────────────────────────────────────────────────\n\nfunction uid(prefix: string, id: string): string {\n return `${prefix}_${id}`;\n}\n\nfunction asNodes(nodes: BpmnRFNode[], types: string[]): BpmnRFNode[] {\n return nodes.filter((n) => types.includes(n.data.elementType));\n}\n\nfunction normalizeEventDefinition(data: BpmnNodeData): BpmnEventDefinition | undefined {\n const trigger = data.eventDefinition?.type ?? data.trigger;\n if (!trigger || trigger === \"none\") return undefined;\n const normalized: BpmnEventDefinition = { type: trigger };\n const timer = data.eventDefinition?.timer ?? data.timer ?? data.timerExpression;\n const messageRef = data.eventDefinition?.messageRef ?? (typeof data.messageRef === \"string\" ? data.messageRef : undefined);\n const signalRef = data.eventDefinition?.signalRef ?? (typeof data.signalRef === \"string\" ? data.signalRef : undefined);\n const errorRef = data.eventDefinition?.errorRef ?? (typeof data.errorRef === \"string\" ? data.errorRef : undefined);\n const escalationRef = data.eventDefinition?.escalationRef ?? (typeof data.escalationRef === \"string\" ? data.escalationRef : undefined);\n const conditionExpression = data.eventDefinition?.conditionExpression ?? (typeof data.conditionExpression === \"string\" ? data.conditionExpression : undefined);\n const linkName = data.eventDefinition?.linkName ?? (typeof data.linkName === \"string\" ? data.linkName : undefined);\n\n if (timer) normalized.timer = timer;\n if (messageRef) normalized.messageRef = messageRef;\n if (signalRef) normalized.signalRef = signalRef;\n if (errorRef) normalized.errorRef = errorRef;\n if (escalationRef) normalized.escalationRef = escalationRef;\n if (conditionExpression) normalized.conditionExpression = conditionExpression;\n if (linkName) normalized.linkName = linkName;\n\n return normalized;\n}\n\nfunction parseVariableType(type: string | undefined): string {\n switch (type) {\n case \"integer\":\n return \"xsd:int\";\n case \"boolean\":\n return \"xsd:boolean\";\n case \"date\":\n return \"xsd:dateTime\";\n case \"object\":\n return \"xsd:anyType\";\n case \"array\":\n return \"xsd:anyType\";\n default:\n return \"xsd:string\";\n }\n}\n\nfunction buildGlobalDefinitions(moddle: BpmnModdle, definitionsSet?: BpmnDefinitionsSet): ModdleElement[] {\n if (!definitionsSet) return [];\n const rootElements: ModdleElement[] = [];\n\n for (const message of definitionsSet.messages ?? []) {\n rootElements.push(moddle.create(\"bpmn:Message\", { id: message.id, name: message.name }));\n }\n for (const signal of definitionsSet.signals ?? []) {\n rootElements.push(moddle.create(\"bpmn:Signal\", { id: signal.id, name: signal.name }));\n }\n for (const error of definitionsSet.errors ?? []) {\n rootElements.push(moddle.create(\"bpmn:Error\", {\n id: error.id,\n name: error.name,\n ...(error.errorCode ? { errorCode: error.errorCode } : {}),\n }));\n }\n for (const escalation of definitionsSet.escalations ?? []) {\n rootElements.push(moddle.create(\"bpmn:Escalation\", {\n id: escalation.id,\n name: escalation.name,\n ...(escalation.escalationCode ? { escalationCode: escalation.escalationCode } : {}),\n }));\n }\n\n return rootElements;\n}\n\nfunction buildItemDefinitions(moddle: BpmnModdle, variables?: BpmnProcessVariable[]): ModdleElement[] {\n return (variables ?? []).map((variable) =>\n moddle.create(\"bpmn:ItemDefinition\", {\n id: `${variable.id}_item`,\n itemKind: \"Information\",\n structureRef: parseVariableType(variable.type),\n }),\n );\n}\n\nfunction buildEventDefinitions(\n moddle: BpmnModdle,\n node: BpmnRFNode,\n eventDefinition: BpmnEventDefinition,\n): ModdleElement[] {\n if (eventDefinition.type === \"multiple\" || eventDefinition.type === \"parallelMultiple\") {\n return [];\n }\n const defType = TRIGGER_TO_EVENT_DEF[eventDefinition.type];\n if (!defType) return [];\n\n const attrs: Record<string, unknown> = { id: uid(\"EventDef\", node.id) };\n\n if (eventDefinition.messageRef) attrs.messageRef = { id: eventDefinition.messageRef };\n if (eventDefinition.signalRef) attrs.signalRef = { id: eventDefinition.signalRef };\n if (eventDefinition.errorRef) attrs.errorRef = { id: eventDefinition.errorRef };\n if (eventDefinition.escalationRef) attrs.escalationRef = { id: eventDefinition.escalationRef };\n if (eventDefinition.conditionExpression) {\n attrs.condition = moddle.create(\"bpmn:FormalExpression\", {\n body: eventDefinition.conditionExpression,\n });\n }\n if (eventDefinition.timer?.value) {\n attrs[eventDefinition.timer.kind === \"date\"\n ? \"timeDate\"\n : eventDefinition.timer.kind === \"cycle\"\n ? \"timeCycle\"\n : \"timeDuration\"] = moddle.create(\"bpmn:FormalExpression\", {\n body: eventDefinition.timer.value,\n });\n }\n\n return [moddle.create(defType, attrs)];\n}\n\n// ─── Build BPMN semantic model ────────────────────────────────────────────────\n\nfunction buildSemanticModel(\n moddle: BpmnModdle,\n nodes: BpmnRFNode[],\n edges: BpmnRFEdge[],\n opts: BpmnExportOptions,\n): ModdleElement {\n const defId = opts.id ?? \"Definitions_1\";\n const defName = opts.name;\n\n // Collect pool nodes → Collaboration + Participants\n const poolNodes = asNodes(nodes, [\"Pool\"]);\n const laneNodes = asNodes(nodes, [\"Lane\"]);\n const isCollaboration = poolNodes.length > 0;\n\n const definitions = moddle.create(\"bpmn:Definitions\", {\n id: defId,\n targetNamespace: \"http://bpmn.io/schema/bpmn\",\n ...(defName ? { name: defName } : {}),\n });\n // Flowable namespace: bpmn-moddle serializes xmlns:* from the element's own namespace map.\n // Injected via the moddle descriptor when a full Flowable extension is loaded.\n // For now, individual elements declare their own flowable:* attributes via $attrs.\n\n const rootElements: ModdleElement[] = [\n ...buildGlobalDefinitions(moddle, opts.process?.definitions),\n ];\n const itemDefinitions = buildItemDefinitions(moddle, opts.process?.definitions?.variables);\n if (itemDefinitions.length > 0) {\n (definitions as Record<string, unknown>).itemDefinitions = itemDefinitions;\n }\n\n if (isCollaboration) {\n const participants: ModdleElement[] = [];\n const processes: ModdleElement[] = [];\n\n for (const pool of poolNodes) {\n const processId = `Process_${pool.id}`;\n const process = buildProcess(moddle, nodes, edges, pool.id, laneNodes, processId, opts);\n processes.push(process);\n\n const participant = moddle.create(\"bpmn:Participant\", {\n id: pool.id,\n name: pool.data.label ?? \"\",\n processRef: process,\n });\n participants.push(participant);\n }\n\n // Message flows and conversation links belong to collaboration\n const messageFlowEdges = edges.filter((e) => e.data?.edgeType === \"messageFlow\");\n const conversationLinkEdges = edges.filter((e) => e.data?.edgeType === \"conversationLink\");\n\n const messageFlows = messageFlowEdges.map((e) =>\n moddle.create(\"bpmn:MessageFlow\", {\n id: e.id,\n name: e.data?.label ?? \"\",\n sourceRef: { id: e.source },\n targetRef: { id: e.target },\n }),\n );\n\n const conversationLinks = conversationLinkEdges.map((e) =>\n moddle.create(\"bpmn:ConversationLink\", {\n id: e.id,\n sourceRef: { id: e.source },\n targetRef: { id: e.target },\n }),\n );\n\n const collaboration = moddle.create(\"bpmn:Collaboration\", {\n id: `Collaboration_${defId}`,\n participants,\n messageFlows,\n conversationLinks,\n });\n\n rootElements.push(collaboration, ...processes);\n } else {\n // Single process — no collaboration\n const process = buildProcess(\n moddle,\n nodes,\n edges,\n undefined,\n laneNodes,\n opts.process?.processId ?? \"Process_1\",\n opts,\n );\n rootElements.push(process);\n }\n\n (definitions as Record<string, unknown>).rootElements = rootElements;\n return definitions;\n}\n\n// Build a bpmn:Process element containing flow nodes and sequence flows\nfunction buildProcess(\n moddle: BpmnModdle,\n allNodes: BpmnRFNode[],\n allEdges: BpmnRFEdge[],\n poolId: string | undefined,\n laneNodes: BpmnRFNode[],\n processId: string,\n opts: BpmnExportOptions,\n): ModdleElement {\n // Collect flow nodes that belong to this pool (or all if no pools)\n const subProcessIds = new Set(\n allNodes\n .filter((n) =>\n n.data.elementType === \"SubProcess\" ||\n n.data.elementType === \"Transaction\" ||\n n.data.elementType === \"EventSubProcess\" ||\n n.data.elementType === \"AdHocSubProcess\",\n )\n .map((n) => n.id),\n );\n const isInsideSubProcess = (node: BpmnRFNode) => {\n let parentId = node.parentId;\n while (parentId) {\n if (subProcessIds.has(parentId)) return true;\n parentId = allNodes.find((candidate) => candidate.id === parentId)?.parentId;\n }\n return false;\n };\n\n const belongsToPool = (node: BpmnRFNode): boolean => {\n let parentId = node.parentId;\n while (parentId) {\n if (parentId === poolId) return true;\n parentId = allNodes.find((candidate) => candidate.id === parentId)?.parentId;\n }\n return false;\n };\n\n const myNodes = (poolId\n ? allNodes.filter((n) => belongsToPool(n))\n : allNodes.filter((n) => n.data.elementType !== \"Pool\" && n.data.elementType !== \"Lane\"))\n .filter((n) => !isInsideSubProcess(n));\n\n const myLanes = laneNodes.filter((l) => (poolId ? l.parentId === poolId : true));\n\n // Build flow elements\n const flowElements: ModdleElement[] = [];\n\n for (const node of myNodes) {\n const el = buildFlowElement(moddle, node, allNodes, allEdges);\n if (el) flowElements.push(el);\n }\n\n // Sequence flows and associations\n const myNodeIds = new Set(myNodes.map((n) => n.id));\n const myEdges = allEdges.filter(\n (e) =>\n (e.data?.edgeType === \"sequenceFlow\" ||\n e.data?.edgeType === \"association\" ||\n e.data?.edgeType === \"dataAssociation\") &&\n myNodeIds.has(e.source) &&\n myNodeIds.has(e.target),\n );\n\n for (const edge of myEdges) {\n const edgeMeta = buildEdgeElement(moddle, edge);\n if (edgeMeta) flowElements.push(edgeMeta);\n }\n\n const elementById = new Map(\n flowElements\n .filter((element) => typeof element.id === \"string\")\n .map((element) => [element.id as string, element]),\n );\n for (const edge of myEdges) {\n if (!edge.data?.isDefault) continue;\n const sourceElement = elementById.get(edge.source);\n const edgeElement = elementById.get(edge.id);\n if (sourceElement && edgeElement) {\n (sourceElement as Record<string, unknown>).default = edgeElement;\n }\n }\n\n const process = moddle.create(\"bpmn:Process\", {\n id: processId,\n isExecutable: opts.process?.executable ?? true,\n flowElements,\n });\n\n if (opts.process?.documentation) {\n (process as Record<string, unknown>).documentation = [\n moddle.create(\"bpmn:Documentation\", { text: opts.process.documentation }),\n ];\n }\n\n // Lane set\n if (myLanes.length > 0) {\n const laneElements = myLanes.map((l) =>\n moddle.create(\"bpmn:Lane\", {\n id: l.id,\n name: l.data.label ?? \"\",\n flowNodeRef: myNodes\n .filter((n) => n.parentId === l.id)\n .map((n) => ({ id: n.id })),\n }),\n );\n (process as Record<string, unknown>).laneSet = moddle.create(\"bpmn:LaneSet\", {\n id: `LaneSet_${processId}`,\n lanes: laneElements,\n });\n }\n\n return process;\n}\n\nfunction buildFlowElement(\n moddle: BpmnModdle,\n node: BpmnRFNode,\n allNodes: BpmnRFNode[],\n allEdges: BpmnRFEdge[],\n): ModdleElement | null {\n const { elementType, label } = node.data;\n const eventDefinition = normalizeEventDefinition(node.data);\n\n // Pools and Lanes are handled in buildProcess / collaboration\n if (elementType === \"Pool\" || elementType === \"Lane\") return null;\n\n const moddleType = ELEMENT_TYPE_TO_MODDLE[elementType];\n if (!moddleType) return null;\n\n const attrs: Record<string, unknown> = {\n id: node.id,\n name: label ?? \"\",\n };\n\n if (node.data.documentation) {\n attrs.documentation = [\n moddle.create(\"bpmn:Documentation\", { text: node.data.documentation }),\n ];\n }\n\n // Event definitions\n if (eventDefinition) {\n const eventDefinitions = buildEventDefinitions(moddle, node, eventDefinition);\n if (eventDefinitions.length > 0) attrs.eventDefinitions = eventDefinitions;\n if (eventDefinition.linkName) attrs.name = eventDefinition.linkName;\n }\n\n if (elementType === \"BoundaryEvent\") {\n attrs.attachedToRef = { id: node.data.attachedToRef ?? node.parentId };\n const interrupting = node.data.cancelActivity ?? !node.data.isNonInterrupting;\n attrs.cancelActivity = interrupting;\n }\n\n const isSubProcess =\n elementType === \"SubProcess\" ||\n elementType === \"Transaction\" ||\n elementType === \"EventSubProcess\" ||\n elementType === \"AdHocSubProcess\";\n\n if (isSubProcess) {\n attrs.flowElements = buildNestedFlowElements(moddle, node, allNodes, allEdges);\n if (elementType === \"EventSubProcess\" || node.data.subProcessVariant === \"event\") {\n attrs.triggeredByEvent = true;\n }\n }\n\n const element = moddle.create(moddleType, attrs);\n\n return element;\n}\n\nfunction buildNestedFlowElements(\n moddle: BpmnModdle,\n parent: BpmnRFNode,\n allNodes: BpmnRFNode[],\n allEdges: BpmnRFEdge[],\n): ModdleElement[] {\n const childNodes = allNodes.filter((node) => node.parentId === parent.id);\n const childNodeIds = new Set(childNodes.map((node) => node.id));\n const flowElements: ModdleElement[] = [];\n\n for (const child of childNodes) {\n const element = buildFlowElement(moddle, child, allNodes, allEdges);\n if (element) flowElements.push(element);\n }\n\n for (const edge of allEdges) {\n if (!childNodeIds.has(edge.source) || !childNodeIds.has(edge.target)) continue;\n const element = buildEdgeElement(moddle, edge);\n if (element) flowElements.push(element);\n }\n\n return flowElements;\n}\n\nfunction buildEdgeElement(moddle: BpmnModdle, edge: BpmnRFEdge): ModdleElement | null {\n if (!edge.data) return null;\n const moddleType = EDGE_TYPE_TO_MODDLE[edge.data.edgeType];\n if (!moddleType) return null;\n\n const attrs: Record<string, unknown> = {\n id: edge.id,\n name: edge.data.label ?? \"\",\n sourceRef: { id: edge.source },\n targetRef: { id: edge.target },\n };\n\n if (edge.data.documentation) {\n attrs.documentation = [\n moddle.create(\"bpmn:Documentation\", { text: edge.data.documentation }),\n ];\n }\n\n if (edge.data.conditionExpression) {\n attrs.conditionExpression = moddle.create(\"bpmn:FormalExpression\", {\n body: edge.data.conditionExpression,\n });\n }\n\n return moddle.create(moddleType, attrs);\n}\n\n// ─── Build BPMNDI (diagram interchange / layout) ─────────────────────────────\n\nfunction buildBpmnDI(\n moddle: BpmnModdle,\n definitions: ModdleElement,\n nodes: BpmnRFNode[],\n edges: BpmnRFEdge[],\n): void {\n const shapes: ModdleElement[] = [];\n const edgeShapes: ModdleElement[] = [];\n\n const absolutePositionById = buildAbsolutePositionMap(nodes);\n\n for (const node of nodes) {\n const meta = BPMN_ELEMENT_CATALOG[node.data.elementType];\n const w = node.width ?? meta?.defaultWidth ?? 120;\n const h = node.height ?? meta?.defaultHeight ?? 60;\n\n const bounds = moddle.create(\"dc:Bounds\", {\n x: absolutePositionById.get(node.id)?.x ?? node.position.x,\n y: absolutePositionById.get(node.id)?.y ?? node.position.y,\n width: w,\n height: h,\n });\n\n const shape = moddle.create(\"bpmndi:BPMNShape\", {\n id: uid(\"BPMNShape\", node.id),\n bpmnElement: { id: node.id },\n bounds,\n });\n\n if (node.data.isExpanded !== undefined) {\n (shape as Record<string, unknown>).isExpanded = node.data.isExpanded;\n }\n\n shapes.push(shape);\n }\n\n for (const edge of edges) {\n const waypoints = resolveEdgeWaypoints(edge, nodes, absolutePositionById).map((p) =>\n moddle.create(\"dc:Point\", { x: p.x, y: p.y }),\n );\n\n edgeShapes.push(\n moddle.create(\"bpmndi:BPMNEdge\", {\n id: uid(\"BPMNEdge\", edge.id),\n bpmnElement: { id: edge.id },\n waypoint: waypoints,\n }),\n );\n }\n\n // Find the main process / collaboration element\n const rootEls = (definitions as Record<string, unknown>).rootElements as ModdleElement[] | undefined;\n const planeElement = rootEls?.[0];\n\n const plane = moddle.create(\"bpmndi:BPMNPlane\", {\n id: \"BPMNPlane_1\",\n bpmnElement: planeElement ?? { id: \"unknown\" },\n planeElement: [...shapes, ...edgeShapes],\n });\n\n const diagram = moddle.create(\"bpmndi:BPMNDiagram\", {\n id: \"BPMNDiagram_1\",\n plane,\n });\n\n (definitions as Record<string, unknown>).diagrams = [diagram];\n}\n\nfunction resolveEdgeWaypoints(\n edge: BpmnRFEdge,\n nodes: BpmnRFNode[],\n absolutePositionById: Map<string, { x: number; y: number }>,\n): Array<{ x: number; y: number }> {\n if (edge.data?.routingPoints && edge.data.routingPoints.length >= 2) {\n return edge.data.routingPoints;\n }\n\n const source = nodes.find((node) => node.id === edge.source);\n const target = nodes.find((node) => node.id === edge.target);\n if (!source || !target) return [];\n\n const sourceMeta = BPMN_ELEMENT_CATALOG[source.data.elementType];\n const targetMeta = BPMN_ELEMENT_CATALOG[target.data.elementType];\n const sourcePosition = absolutePositionById.get(source.id) ?? source.position;\n const targetPosition = absolutePositionById.get(target.id) ?? target.position;\n return [\n {\n x: sourcePosition.x + (source.width ?? sourceMeta.defaultWidth) / 2,\n y: sourcePosition.y + (source.height ?? sourceMeta.defaultHeight) / 2,\n },\n {\n x: targetPosition.x + (target.width ?? targetMeta.defaultWidth) / 2,\n y: targetPosition.y + (target.height ?? targetMeta.defaultHeight) / 2,\n },\n ];\n}\n\nfunction buildAbsolutePositionMap(nodes: BpmnRFNode[]): Map<string, { x: number; y: number }> {\n const nodeById = new Map(nodes.map((node) => [node.id, node]));\n const absoluteById = new Map<string, { x: number; y: number }>();\n\n function resolve(node: BpmnRFNode): { x: number; y: number } {\n const cached = absoluteById.get(node.id);\n if (cached) return cached;\n\n const parent = node.parentId ? nodeById.get(node.parentId) : undefined;\n const parentPosition = parent ? resolve(parent) : { x: 0, y: 0 };\n const absolute = {\n x: parentPosition.x + node.position.x,\n y: parentPosition.y + node.position.y,\n };\n absoluteById.set(node.id, absolute);\n return absolute;\n }\n\n for (const node of nodes) resolve(node);\n return absoluteById;\n}\n\n// ─── Public: serializeBpmnXml ─────────────────────────────────────────────────\n\nexport async function serializeBpmnXml(\n nodes: BpmnRFNode[],\n edges: BpmnRFEdge[],\n opts: BpmnExportOptions = {},\n): Promise<string> {\n const moddle = new BpmnModdle();\n\n const definitions = buildSemanticModel(moddle, nodes, edges, opts);\n buildBpmnDI(moddle, definitions, nodes, edges);\n\n const { xml } = await moddle.toXML(definitions, {\n format: opts.format ?? true,\n });\n\n return xml;\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { B as BPMN_ELEMENT_CATALOG, a as BPMN_RESIZABLE_ELEMENT_TYPES, g as getBpmnElementSize, b as getElementMeta, i as isBpmnElementResizable } from '../catalog-
|
|
2
|
-
import {
|
|
3
|
-
export { B as BpmnCategory, a as
|
|
1
|
+
export { B as BPMN_ELEMENT_CATALOG, a as BPMN_RESIZABLE_ELEMENT_TYPES, g as getBpmnElementSize, b as getElementMeta, i as isBpmnElementResizable } from '../catalog-D2AcvrDO.cjs';
|
|
2
|
+
import { f as BpmnElementType, k as BpmnHandlePolicy, n as BpmnOrientation } from '../types-rWbKYrHH.cjs';
|
|
3
|
+
export { B as BpmnCategory, a as BpmnDefinitionsSet, b as BpmnEdgeData, c as BpmnEdgeType, d as BpmnElementMeta, e as BpmnElementSize, g as BpmnErrorDefinition, h as BpmnEscalationDefinition, i as BpmnEventDefinition, j as BpmnEventSemantics, l as BpmnMessageDefinition, m as BpmnNodeData, o as BpmnProcessVariable, p as BpmnSignalDefinition, q as BpmnTimerDefinition, r as BpmnTimerKind, E as EventTrigger, S as SubProcessVariant, T as TaskMarker } from '../types-rWbKYrHH.cjs';
|
|
4
4
|
|
|
5
5
|
declare function isTaskType(type: BpmnElementType): boolean;
|
|
6
6
|
declare function isGatewayType(type: BpmnElementType): boolean;
|
package/dist/elements/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { B as BPMN_ELEMENT_CATALOG, a as BPMN_RESIZABLE_ELEMENT_TYPES, g as getBpmnElementSize, b as getElementMeta, i as isBpmnElementResizable } from '../catalog-
|
|
2
|
-
import {
|
|
3
|
-
export { B as BpmnCategory, a as
|
|
1
|
+
export { B as BPMN_ELEMENT_CATALOG, a as BPMN_RESIZABLE_ELEMENT_TYPES, g as getBpmnElementSize, b as getElementMeta, i as isBpmnElementResizable } from '../catalog-CQtKEV7q.js';
|
|
2
|
+
import { f as BpmnElementType, k as BpmnHandlePolicy, n as BpmnOrientation } from '../types-rWbKYrHH.js';
|
|
3
|
+
export { B as BpmnCategory, a as BpmnDefinitionsSet, b as BpmnEdgeData, c as BpmnEdgeType, d as BpmnElementMeta, e as BpmnElementSize, g as BpmnErrorDefinition, h as BpmnEscalationDefinition, i as BpmnEventDefinition, j as BpmnEventSemantics, l as BpmnMessageDefinition, m as BpmnNodeData, o as BpmnProcessVariable, p as BpmnSignalDefinition, q as BpmnTimerDefinition, r as BpmnTimerKind, E as EventTrigger, S as SubProcessVariant, T as TaskMarker } from '../types-rWbKYrHH.js';
|
|
4
4
|
|
|
5
5
|
declare function isTaskType(type: BpmnElementType): boolean;
|
|
6
6
|
declare function isGatewayType(type: BpmnElementType): boolean;
|