@aranzatech/diagrams-bpmn 0.2.3 → 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/{chunk-H3YMTGFG.js → chunk-IMW6RG6F.js} +3 -3
- package/dist/{chunk-H3YMTGFG.js.map → chunk-IMW6RG6F.js.map} +1 -1
- package/dist/{chunk-ECTJRD7Z.js → chunk-O3NWJ5H7.js} +9 -18
- package/dist/chunk-O3NWJ5H7.js.map +1 -0
- package/dist/{chunk-KALSGH4D.js → chunk-PDTXM32P.js} +6 -6
- package/dist/chunk-PDTXM32P.js.map +1 -0
- package/dist/edges/index.cjs +6 -15
- package/dist/edges/index.cjs.map +1 -1
- package/dist/edges/index.js +2 -2
- package/dist/elements/index.d.cts +3 -3
- package/dist/elements/index.d.ts +3 -3
- package/dist/index.cjs +248 -46
- 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 +4 -4
- package/dist/modeling/index.d.cts +3 -3
- package/dist/modeling/index.d.ts +3 -3
- package/dist/nodes/index.cjs +16 -16
- package/dist/nodes/index.cjs.map +1 -1
- package/dist/nodes/index.js +2 -2
- package/dist/{types-vVi5T7qj.d.cts → types-CIBColRi.d.ts} +11 -2
- package/dist/{types-BxjCV2oX.d.ts → 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
- package/dist/chunk-ECTJRD7Z.js.map +0 -1
- package/dist/chunk-KALSGH4D.js.map +0 -1
package/dist/nodes/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AnnotationNode, BPMN_NODE_TYPES, BoundaryEventNode, CallChoreographyNode, CallConversationNode, ChoreographyTaskNode, ConversationNode, DataInputNode, DataObjectNode, DataObjectReferenceNode, DataOutputNode, DataStoreNode, DataStoreReferenceNode, EndEventNode, GatewayNode, GroupNode, IntermediateCatchEventNode, IntermediateThrowEventNode, LaneNode, PoolNode, StartEventNode, SubChoreographyNode, SubConversationNode, SubProcessNode, TaskNode } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { AnnotationNode, BPMN_NODE_TYPES, BoundaryEventNode, CallChoreographyNode, CallConversationNode, ChoreographyTaskNode, ConversationNode, DataInputNode, DataObjectNode, DataObjectReferenceNode, DataOutputNode, DataStoreNode, DataStoreReferenceNode, EndEventNode, GatewayNode, GroupNode, IntermediateCatchEventNode, IntermediateThrowEventNode, LaneNode, PoolNode, StartEventNode, SubChoreographyNode, SubConversationNode, SubProcessNode, TaskNode } from '../chunk-IMW6RG6F.js';
|
|
2
|
+
import '../chunk-PDTXM32P.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Node, Edge } from '@xyflow/react';
|
|
2
|
-
import {
|
|
2
|
+
import { m as BpmnNodeData, b as BpmnEdgeData, a as BpmnDefinitionsSet } from './types-rWbKYrHH.js';
|
|
3
3
|
|
|
4
4
|
type BpmnRFNode = Node<BpmnNodeData>;
|
|
5
5
|
type BpmnRFEdge = Edge<BpmnEdgeData>;
|
|
@@ -7,6 +7,13 @@ interface BpmnImportResult {
|
|
|
7
7
|
nodes: BpmnRFNode[];
|
|
8
8
|
edges: BpmnRFEdge[];
|
|
9
9
|
warnings: string[];
|
|
10
|
+
process?: BpmnProcessModel;
|
|
11
|
+
}
|
|
12
|
+
interface BpmnProcessModel {
|
|
13
|
+
processId?: string;
|
|
14
|
+
executable?: boolean;
|
|
15
|
+
documentation?: string;
|
|
16
|
+
definitions?: BpmnDefinitionsSet;
|
|
10
17
|
}
|
|
11
18
|
interface BpmnExportOptions {
|
|
12
19
|
/** Diagram name written into the XML. */
|
|
@@ -15,6 +22,8 @@ interface BpmnExportOptions {
|
|
|
15
22
|
id?: string;
|
|
16
23
|
/** Pretty-print the XML output. Defaults to true. */
|
|
17
24
|
format?: boolean;
|
|
25
|
+
/** Optional process-level metadata and global definitions. */
|
|
26
|
+
process?: BpmnProcessModel;
|
|
18
27
|
}
|
|
19
28
|
|
|
20
|
-
export type { BpmnExportOptions as B, BpmnImportResult as a,
|
|
29
|
+
export type { BpmnExportOptions as B, BpmnImportResult as a, BpmnProcessModel as b, BpmnRFEdge as c, BpmnRFNode as d };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Node, Edge } from '@xyflow/react';
|
|
2
|
-
import {
|
|
2
|
+
import { m as BpmnNodeData, b as BpmnEdgeData, a as BpmnDefinitionsSet } from './types-rWbKYrHH.cjs';
|
|
3
3
|
|
|
4
4
|
type BpmnRFNode = Node<BpmnNodeData>;
|
|
5
5
|
type BpmnRFEdge = Edge<BpmnEdgeData>;
|
|
@@ -7,6 +7,13 @@ interface BpmnImportResult {
|
|
|
7
7
|
nodes: BpmnRFNode[];
|
|
8
8
|
edges: BpmnRFEdge[];
|
|
9
9
|
warnings: string[];
|
|
10
|
+
process?: BpmnProcessModel;
|
|
11
|
+
}
|
|
12
|
+
interface BpmnProcessModel {
|
|
13
|
+
processId?: string;
|
|
14
|
+
executable?: boolean;
|
|
15
|
+
documentation?: string;
|
|
16
|
+
definitions?: BpmnDefinitionsSet;
|
|
10
17
|
}
|
|
11
18
|
interface BpmnExportOptions {
|
|
12
19
|
/** Diagram name written into the XML. */
|
|
@@ -15,6 +22,8 @@ interface BpmnExportOptions {
|
|
|
15
22
|
id?: string;
|
|
16
23
|
/** Pretty-print the XML output. Defaults to true. */
|
|
17
24
|
format?: boolean;
|
|
25
|
+
/** Optional process-level metadata and global definitions. */
|
|
26
|
+
process?: BpmnProcessModel;
|
|
18
27
|
}
|
|
19
28
|
|
|
20
|
-
export type { BpmnExportOptions as B, BpmnImportResult as a,
|
|
29
|
+
export type { BpmnExportOptions as B, BpmnImportResult as a, BpmnProcessModel as b, BpmnRFEdge as c, BpmnRFNode as d };
|
|
@@ -5,6 +5,53 @@ type BpmnEventSemantics = "start" | "intermediateCatch" | "intermediateThrow" |
|
|
|
5
5
|
type BpmnElementType = "StartEvent" | "EndEvent" | "IntermediateCatchEvent" | "IntermediateThrowEvent" | "BoundaryEvent" | "Task" | "UserTask" | "ServiceTask" | "ScriptTask" | "ManualTask" | "BusinessRuleTask" | "ReceiveTask" | "SendTask" | "CallActivity" | "ExclusiveGateway" | "InclusiveGateway" | "ParallelGateway" | "EventBasedGateway" | "ComplexGateway" | "SubProcess" | "Transaction" | "EventSubProcess" | "AdHocSubProcess" | "Pool" | "Lane" | "Annotation" | "Group" | "DataObject" | "DataObjectReference" | "DataInput" | "DataOutput" | "DataStore" | "DataStoreReference" | "Conversation" | "SubConversation" | "CallConversation" | "ChoreographyTask" | "SubChoreography" | "CallChoreography";
|
|
6
6
|
type BpmnEdgeType = "sequenceFlow" | "messageFlow" | "association" | "dataAssociation" | "conversationLink";
|
|
7
7
|
type EventTrigger = "none" | "message" | "timer" | "escalation" | "conditional" | "error" | "cancel" | "compensation" | "signal" | "link" | "terminate" | "multiple" | "parallelMultiple";
|
|
8
|
+
type BpmnTimerKind = "date" | "duration" | "cycle";
|
|
9
|
+
interface BpmnTimerDefinition {
|
|
10
|
+
kind: BpmnTimerKind;
|
|
11
|
+
value: string;
|
|
12
|
+
}
|
|
13
|
+
interface BpmnMessageDefinition {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
}
|
|
17
|
+
interface BpmnSignalDefinition {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
}
|
|
21
|
+
interface BpmnErrorDefinition {
|
|
22
|
+
id: string;
|
|
23
|
+
name: string;
|
|
24
|
+
errorCode?: string;
|
|
25
|
+
}
|
|
26
|
+
interface BpmnEscalationDefinition {
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
escalationCode?: string;
|
|
30
|
+
}
|
|
31
|
+
interface BpmnProcessVariable {
|
|
32
|
+
id: string;
|
|
33
|
+
name: string;
|
|
34
|
+
type: "string" | "integer" | "boolean" | "date" | "object" | "array";
|
|
35
|
+
defaultValue?: string;
|
|
36
|
+
description?: string;
|
|
37
|
+
}
|
|
38
|
+
interface BpmnDefinitionsSet {
|
|
39
|
+
messages?: BpmnMessageDefinition[];
|
|
40
|
+
signals?: BpmnSignalDefinition[];
|
|
41
|
+
errors?: BpmnErrorDefinition[];
|
|
42
|
+
escalations?: BpmnEscalationDefinition[];
|
|
43
|
+
variables?: BpmnProcessVariable[];
|
|
44
|
+
}
|
|
45
|
+
interface BpmnEventDefinition extends Record<string, unknown> {
|
|
46
|
+
type: EventTrigger;
|
|
47
|
+
timer?: BpmnTimerDefinition;
|
|
48
|
+
messageRef?: string;
|
|
49
|
+
signalRef?: string;
|
|
50
|
+
errorRef?: string;
|
|
51
|
+
escalationRef?: string;
|
|
52
|
+
conditionExpression?: string;
|
|
53
|
+
linkName?: string;
|
|
54
|
+
}
|
|
8
55
|
type TaskMarker = "loop" | "parallelMultiple" | "sequentialMultiple" | "compensation";
|
|
9
56
|
type SubProcessVariant = "embedded" | "event" | "transaction" | "adhoc";
|
|
10
57
|
interface BpmnElementMeta {
|
|
@@ -59,10 +106,23 @@ interface BpmnNodeData extends Record<string, unknown> {
|
|
|
59
106
|
};
|
|
60
107
|
/** Event trigger symbol rendered inside the event circle. */
|
|
61
108
|
trigger?: EventTrigger;
|
|
109
|
+
/** Unified event definition payload used for BPMN 2.0 serialization and UI. */
|
|
110
|
+
eventDefinition?: BpmnEventDefinition;
|
|
62
111
|
/** True for non-interrupting boundary events / event sub-process starts. */
|
|
63
112
|
isNonInterrupting?: boolean;
|
|
64
113
|
/** BoundaryEvent only: BPMN element id this boundary event is attached to. */
|
|
65
114
|
attachedToRef?: string;
|
|
115
|
+
/** Compatibility alias used by older Aranza editors. */
|
|
116
|
+
cancelActivity?: boolean;
|
|
117
|
+
/** Legacy flat event fields kept during migration to eventDefinition. */
|
|
118
|
+
timer?: BpmnTimerDefinition;
|
|
119
|
+
timerExpression?: BpmnTimerDefinition;
|
|
120
|
+
messageRef?: string;
|
|
121
|
+
signalRef?: string;
|
|
122
|
+
errorRef?: string;
|
|
123
|
+
escalationRef?: string;
|
|
124
|
+
conditionExpression?: string;
|
|
125
|
+
linkName?: string;
|
|
66
126
|
/** Raw BPMN documentation text. */
|
|
67
127
|
documentation?: string;
|
|
68
128
|
/** Task instance markers shown at the bottom of the task box. */
|
|
@@ -108,4 +168,4 @@ interface BpmnEdgeData extends Record<string, unknown> {
|
|
|
108
168
|
}>;
|
|
109
169
|
}
|
|
110
170
|
|
|
111
|
-
export type { BpmnCategory as B, EventTrigger as E, SubProcessVariant as S, TaskMarker as T,
|
|
171
|
+
export type { BpmnCategory as B, EventTrigger as E, SubProcessVariant as S, TaskMarker as T, BpmnDefinitionsSet as a, BpmnEdgeData as b, BpmnEdgeType as c, BpmnElementMeta as d, BpmnElementSize as e, BpmnElementType as f, BpmnErrorDefinition as g, BpmnEscalationDefinition as h, BpmnEventDefinition as i, BpmnEventSemantics as j, BpmnHandlePolicy as k, BpmnMessageDefinition as l, BpmnNodeData as m, BpmnOrientation as n, BpmnProcessVariable as o, BpmnSignalDefinition as p, BpmnTimerDefinition as q, BpmnTimerKind as r };
|
|
@@ -5,6 +5,53 @@ type BpmnEventSemantics = "start" | "intermediateCatch" | "intermediateThrow" |
|
|
|
5
5
|
type BpmnElementType = "StartEvent" | "EndEvent" | "IntermediateCatchEvent" | "IntermediateThrowEvent" | "BoundaryEvent" | "Task" | "UserTask" | "ServiceTask" | "ScriptTask" | "ManualTask" | "BusinessRuleTask" | "ReceiveTask" | "SendTask" | "CallActivity" | "ExclusiveGateway" | "InclusiveGateway" | "ParallelGateway" | "EventBasedGateway" | "ComplexGateway" | "SubProcess" | "Transaction" | "EventSubProcess" | "AdHocSubProcess" | "Pool" | "Lane" | "Annotation" | "Group" | "DataObject" | "DataObjectReference" | "DataInput" | "DataOutput" | "DataStore" | "DataStoreReference" | "Conversation" | "SubConversation" | "CallConversation" | "ChoreographyTask" | "SubChoreography" | "CallChoreography";
|
|
6
6
|
type BpmnEdgeType = "sequenceFlow" | "messageFlow" | "association" | "dataAssociation" | "conversationLink";
|
|
7
7
|
type EventTrigger = "none" | "message" | "timer" | "escalation" | "conditional" | "error" | "cancel" | "compensation" | "signal" | "link" | "terminate" | "multiple" | "parallelMultiple";
|
|
8
|
+
type BpmnTimerKind = "date" | "duration" | "cycle";
|
|
9
|
+
interface BpmnTimerDefinition {
|
|
10
|
+
kind: BpmnTimerKind;
|
|
11
|
+
value: string;
|
|
12
|
+
}
|
|
13
|
+
interface BpmnMessageDefinition {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
}
|
|
17
|
+
interface BpmnSignalDefinition {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
}
|
|
21
|
+
interface BpmnErrorDefinition {
|
|
22
|
+
id: string;
|
|
23
|
+
name: string;
|
|
24
|
+
errorCode?: string;
|
|
25
|
+
}
|
|
26
|
+
interface BpmnEscalationDefinition {
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
escalationCode?: string;
|
|
30
|
+
}
|
|
31
|
+
interface BpmnProcessVariable {
|
|
32
|
+
id: string;
|
|
33
|
+
name: string;
|
|
34
|
+
type: "string" | "integer" | "boolean" | "date" | "object" | "array";
|
|
35
|
+
defaultValue?: string;
|
|
36
|
+
description?: string;
|
|
37
|
+
}
|
|
38
|
+
interface BpmnDefinitionsSet {
|
|
39
|
+
messages?: BpmnMessageDefinition[];
|
|
40
|
+
signals?: BpmnSignalDefinition[];
|
|
41
|
+
errors?: BpmnErrorDefinition[];
|
|
42
|
+
escalations?: BpmnEscalationDefinition[];
|
|
43
|
+
variables?: BpmnProcessVariable[];
|
|
44
|
+
}
|
|
45
|
+
interface BpmnEventDefinition extends Record<string, unknown> {
|
|
46
|
+
type: EventTrigger;
|
|
47
|
+
timer?: BpmnTimerDefinition;
|
|
48
|
+
messageRef?: string;
|
|
49
|
+
signalRef?: string;
|
|
50
|
+
errorRef?: string;
|
|
51
|
+
escalationRef?: string;
|
|
52
|
+
conditionExpression?: string;
|
|
53
|
+
linkName?: string;
|
|
54
|
+
}
|
|
8
55
|
type TaskMarker = "loop" | "parallelMultiple" | "sequentialMultiple" | "compensation";
|
|
9
56
|
type SubProcessVariant = "embedded" | "event" | "transaction" | "adhoc";
|
|
10
57
|
interface BpmnElementMeta {
|
|
@@ -59,10 +106,23 @@ interface BpmnNodeData extends Record<string, unknown> {
|
|
|
59
106
|
};
|
|
60
107
|
/** Event trigger symbol rendered inside the event circle. */
|
|
61
108
|
trigger?: EventTrigger;
|
|
109
|
+
/** Unified event definition payload used for BPMN 2.0 serialization and UI. */
|
|
110
|
+
eventDefinition?: BpmnEventDefinition;
|
|
62
111
|
/** True for non-interrupting boundary events / event sub-process starts. */
|
|
63
112
|
isNonInterrupting?: boolean;
|
|
64
113
|
/** BoundaryEvent only: BPMN element id this boundary event is attached to. */
|
|
65
114
|
attachedToRef?: string;
|
|
115
|
+
/** Compatibility alias used by older Aranza editors. */
|
|
116
|
+
cancelActivity?: boolean;
|
|
117
|
+
/** Legacy flat event fields kept during migration to eventDefinition. */
|
|
118
|
+
timer?: BpmnTimerDefinition;
|
|
119
|
+
timerExpression?: BpmnTimerDefinition;
|
|
120
|
+
messageRef?: string;
|
|
121
|
+
signalRef?: string;
|
|
122
|
+
errorRef?: string;
|
|
123
|
+
escalationRef?: string;
|
|
124
|
+
conditionExpression?: string;
|
|
125
|
+
linkName?: string;
|
|
66
126
|
/** Raw BPMN documentation text. */
|
|
67
127
|
documentation?: string;
|
|
68
128
|
/** Task instance markers shown at the bottom of the task box. */
|
|
@@ -108,4 +168,4 @@ interface BpmnEdgeData extends Record<string, unknown> {
|
|
|
108
168
|
}>;
|
|
109
169
|
}
|
|
110
170
|
|
|
111
|
-
export type { BpmnCategory as B, EventTrigger as E, SubProcessVariant as S, TaskMarker as T,
|
|
171
|
+
export type { BpmnCategory as B, EventTrigger as E, SubProcessVariant as S, TaskMarker as T, BpmnDefinitionsSet as a, BpmnEdgeData as b, BpmnEdgeType as c, BpmnElementMeta as d, BpmnElementSize as e, BpmnElementType as f, BpmnErrorDefinition as g, BpmnEscalationDefinition as h, BpmnEventDefinition as i, BpmnEventSemantics as j, BpmnHandlePolicy as k, BpmnMessageDefinition as l, BpmnNodeData as m, BpmnOrientation as n, BpmnProcessVariable as o, BpmnSignalDefinition as p, BpmnTimerDefinition as q, BpmnTimerKind as r };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as BpmnRFNode, c as BpmnRFEdge } from '../types-fDlPLIHd.cjs';
|
|
2
2
|
import '@xyflow/react';
|
|
3
|
-
import '../types-
|
|
3
|
+
import '../types-rWbKYrHH.cjs';
|
|
4
4
|
|
|
5
5
|
type BpmnValidationSeverity = "error" | "warning" | "info";
|
|
6
6
|
interface BpmnValidationIssue {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as BpmnRFNode, c as BpmnRFEdge } from '../types-CIBColRi.js';
|
|
2
2
|
import '@xyflow/react';
|
|
3
|
-
import '../types-
|
|
3
|
+
import '../types-rWbKYrHH.js';
|
|
4
4
|
|
|
5
5
|
type BpmnValidationSeverity = "error" | "warning" | "info";
|
|
6
6
|
interface BpmnValidationIssue {
|
package/dist/xml/index.cjs
CHANGED
|
@@ -775,9 +775,84 @@ function extractLaneMembership(process) {
|
|
|
775
775
|
function extractTrigger(el) {
|
|
776
776
|
const defs = asElements(el.eventDefinitions);
|
|
777
777
|
if (defs.length === 0) return void 0;
|
|
778
|
-
if (defs.length > 1)
|
|
778
|
+
if (defs.length > 1) {
|
|
779
|
+
return defs.some((def) => def.$type === "bpmn:ParallelMultipleEventDefinition") ? "parallelMultiple" : "multiple";
|
|
780
|
+
}
|
|
779
781
|
return EVENT_DEF_TO_TRIGGER[defs[0].$type];
|
|
780
782
|
}
|
|
783
|
+
function parseVariableType(value) {
|
|
784
|
+
const text = asString(value) ?? "";
|
|
785
|
+
if (text.includes("int")) return "integer";
|
|
786
|
+
if (text.includes("boolean")) return "boolean";
|
|
787
|
+
if (text.includes("date")) return "date";
|
|
788
|
+
if (text.includes("array")) return "array";
|
|
789
|
+
if (text.includes("anyType")) return "object";
|
|
790
|
+
return "string";
|
|
791
|
+
}
|
|
792
|
+
function extractEventDefinition(el) {
|
|
793
|
+
const defs = asElements(el.eventDefinitions);
|
|
794
|
+
if (defs.length === 0) return void 0;
|
|
795
|
+
if (defs.length > 1) {
|
|
796
|
+
return {
|
|
797
|
+
type: defs.some((def2) => def2.$type === "bpmn:ParallelMultipleEventDefinition") ? "parallelMultiple" : "multiple"
|
|
798
|
+
};
|
|
799
|
+
}
|
|
800
|
+
const [def] = defs;
|
|
801
|
+
const type = EVENT_DEF_TO_TRIGGER[def.$type];
|
|
802
|
+
if (!type) return void 0;
|
|
803
|
+
const eventDefinition = {
|
|
804
|
+
type,
|
|
805
|
+
...asString(def.messageRef?.id) ? { messageRef: def.messageRef.id } : {},
|
|
806
|
+
...asString(def.signalRef?.id) ? { signalRef: def.signalRef.id } : {},
|
|
807
|
+
...asString(def.errorRef?.id) ? { errorRef: def.errorRef.id } : {},
|
|
808
|
+
...asString(def.escalationRef?.id) ? { escalationRef: def.escalationRef.id } : {},
|
|
809
|
+
...asString(def.condition?.body) ? { conditionExpression: def.condition.body } : {}
|
|
810
|
+
};
|
|
811
|
+
const timeDate = asString(def.timeDate?.body);
|
|
812
|
+
const timeDuration = asString(def.timeDuration?.body);
|
|
813
|
+
const timeCycle = asString(def.timeCycle?.body);
|
|
814
|
+
if (timeDate) eventDefinition.timer = { kind: "date", value: timeDate };
|
|
815
|
+
else if (timeCycle) eventDefinition.timer = { kind: "cycle", value: timeCycle };
|
|
816
|
+
else if (timeDuration) eventDefinition.timer = { kind: "duration", value: timeDuration };
|
|
817
|
+
if (type === "link") {
|
|
818
|
+
const linkName = asString(el.name) ?? asString(def.name);
|
|
819
|
+
if (linkName) eventDefinition.linkName = linkName;
|
|
820
|
+
}
|
|
821
|
+
return eventDefinition;
|
|
822
|
+
}
|
|
823
|
+
function extractDefinitions(rootElement) {
|
|
824
|
+
const definitions = {};
|
|
825
|
+
const rootElements = asElements(rootElement.rootElements);
|
|
826
|
+
const messages = rootElements.filter((element) => element.$type === "bpmn:Message" && asString(element.id)).map((message) => ({
|
|
827
|
+
id: message.id,
|
|
828
|
+
name: asString(message.name) ?? message.id
|
|
829
|
+
}));
|
|
830
|
+
if (messages.length > 0) definitions.messages = messages;
|
|
831
|
+
const signals = rootElements.filter((element) => element.$type === "bpmn:Signal" && asString(element.id)).map((signal) => ({
|
|
832
|
+
id: signal.id,
|
|
833
|
+
name: asString(signal.name) ?? signal.id
|
|
834
|
+
}));
|
|
835
|
+
if (signals.length > 0) definitions.signals = signals;
|
|
836
|
+
const errors = rootElements.filter((element) => element.$type === "bpmn:Error" && asString(element.id)).map((error) => ({
|
|
837
|
+
id: error.id,
|
|
838
|
+
name: asString(error.name) ?? error.id,
|
|
839
|
+
...asString(error.errorCode) ? { errorCode: error.errorCode } : {}
|
|
840
|
+
}));
|
|
841
|
+
if (errors.length > 0) definitions.errors = errors;
|
|
842
|
+
const escalations = rootElements.filter((element) => element.$type === "bpmn:Escalation" && asString(element.id)).map((escalation) => ({
|
|
843
|
+
id: escalation.id,
|
|
844
|
+
name: asString(escalation.name) ?? escalation.id,
|
|
845
|
+
...asString(escalation.escalationCode) ? { escalationCode: escalation.escalationCode } : {}
|
|
846
|
+
}));
|
|
847
|
+
if (escalations.length > 0) definitions.escalations = escalations;
|
|
848
|
+
const itemDefinitions = asElements(rootElement.itemDefinitions).filter((item) => asString(item.id)).map((item) => ({
|
|
849
|
+
id: String(item.id).replace(/_item$/, ""),
|
|
850
|
+
name: String(item.id).replace(/_item$/, ""),
|
|
851
|
+
type: parseVariableType(item.structureRef)
|
|
852
|
+
}));
|
|
853
|
+
if (itemDefinitions.length > 0) definitions.variables = itemDefinitions;
|
|
854
|
+
return Object.keys(definitions).length > 0 ? definitions : void 0;
|
|
855
|
+
}
|
|
781
856
|
function extractSubProcessVariant(el) {
|
|
782
857
|
if (el.$type === "bpmn:Transaction") return "transaction";
|
|
783
858
|
if (el.$type === "bpmn:AdHocSubProcess") return "adhoc";
|
|
@@ -818,6 +893,7 @@ function buildNode(el, elementType, parentId, ctx, nodes) {
|
|
|
818
893
|
const label = asString(el.name);
|
|
819
894
|
const documentation = extractDocumentation(el);
|
|
820
895
|
const trigger = extractTrigger(el);
|
|
896
|
+
const eventDefinition = extractEventDefinition(el);
|
|
821
897
|
const isNonInterrupting = el.cancelActivity === false;
|
|
822
898
|
const attachedToRef = el.attachedToRef?.id;
|
|
823
899
|
const data = {
|
|
@@ -825,8 +901,17 @@ function buildNode(el, elementType, parentId, ctx, nodes) {
|
|
|
825
901
|
...label ? { label } : {},
|
|
826
902
|
...documentation ? { documentation } : {},
|
|
827
903
|
...trigger ? { trigger } : {},
|
|
904
|
+
...eventDefinition ? { eventDefinition } : {},
|
|
828
905
|
...isNonInterrupting ? { isNonInterrupting: true } : {},
|
|
829
|
-
...
|
|
906
|
+
...elementType === "BoundaryEvent" ? { cancelActivity: el.cancelActivity !== false } : {},
|
|
907
|
+
...attachedToRef ? { attachedToRef } : {},
|
|
908
|
+
...eventDefinition?.timer ? { timer: eventDefinition.timer, timerExpression: eventDefinition.timer } : {},
|
|
909
|
+
...eventDefinition?.messageRef ? { messageRef: eventDefinition.messageRef } : {},
|
|
910
|
+
...eventDefinition?.signalRef ? { signalRef: eventDefinition.signalRef } : {},
|
|
911
|
+
...eventDefinition?.errorRef ? { errorRef: eventDefinition.errorRef } : {},
|
|
912
|
+
...eventDefinition?.escalationRef ? { escalationRef: eventDefinition.escalationRef } : {},
|
|
913
|
+
...eventDefinition?.conditionExpression ? { conditionExpression: eventDefinition.conditionExpression } : {},
|
|
914
|
+
...eventDefinition?.linkName ? { linkName: eventDefinition.linkName } : {}
|
|
830
915
|
};
|
|
831
916
|
if (elementType === "SubProcess" || elementType === "Transaction" || elementType === "EventSubProcess" || elementType === "AdHocSubProcess") {
|
|
832
917
|
const variant = extractSubProcessVariant(el);
|
|
@@ -976,10 +1061,23 @@ async function parseBpmnXml(xml) {
|
|
|
976
1061
|
};
|
|
977
1062
|
return { ...edge, data };
|
|
978
1063
|
});
|
|
1064
|
+
const firstProcess = asElements(rootElement.rootElements).find((rootEl) => rootEl.$type === "bpmn:Process");
|
|
1065
|
+
const importedDefinitions = extractDefinitions(rootElement);
|
|
1066
|
+
const process = firstProcess ? (() => {
|
|
1067
|
+
const importedProcess = {};
|
|
1068
|
+
const processId = asString(firstProcess.id);
|
|
1069
|
+
const documentation = extractDocumentation(firstProcess);
|
|
1070
|
+
if (processId) importedProcess.processId = processId;
|
|
1071
|
+
if (typeof firstProcess.isExecutable === "boolean") importedProcess.executable = firstProcess.isExecutable;
|
|
1072
|
+
if (documentation) importedProcess.documentation = documentation;
|
|
1073
|
+
if (importedDefinitions) importedProcess.definitions = importedDefinitions;
|
|
1074
|
+
return importedProcess;
|
|
1075
|
+
})() : importedDefinitions ? { definitions: importedDefinitions } : void 0;
|
|
979
1076
|
return {
|
|
980
1077
|
nodes: normalizeChildPositions(nodes, nodeIds),
|
|
981
1078
|
edges: normalizedEdges,
|
|
982
|
-
warnings
|
|
1079
|
+
warnings,
|
|
1080
|
+
...process ? { process } : {}
|
|
983
1081
|
};
|
|
984
1082
|
}
|
|
985
1083
|
function collectDefaultFlows(el, defaultFlowById) {
|
|
@@ -1009,6 +1107,99 @@ function uid(prefix, id) {
|
|
|
1009
1107
|
function asNodes(nodes, types) {
|
|
1010
1108
|
return nodes.filter((n) => types.includes(n.data.elementType));
|
|
1011
1109
|
}
|
|
1110
|
+
function normalizeEventDefinition(data) {
|
|
1111
|
+
const trigger = data.eventDefinition?.type ?? data.trigger;
|
|
1112
|
+
if (!trigger || trigger === "none") return void 0;
|
|
1113
|
+
const normalized = { type: trigger };
|
|
1114
|
+
const timer = data.eventDefinition?.timer ?? data.timer ?? data.timerExpression;
|
|
1115
|
+
const messageRef = data.eventDefinition?.messageRef ?? (typeof data.messageRef === "string" ? data.messageRef : void 0);
|
|
1116
|
+
const signalRef = data.eventDefinition?.signalRef ?? (typeof data.signalRef === "string" ? data.signalRef : void 0);
|
|
1117
|
+
const errorRef = data.eventDefinition?.errorRef ?? (typeof data.errorRef === "string" ? data.errorRef : void 0);
|
|
1118
|
+
const escalationRef = data.eventDefinition?.escalationRef ?? (typeof data.escalationRef === "string" ? data.escalationRef : void 0);
|
|
1119
|
+
const conditionExpression = data.eventDefinition?.conditionExpression ?? (typeof data.conditionExpression === "string" ? data.conditionExpression : void 0);
|
|
1120
|
+
const linkName = data.eventDefinition?.linkName ?? (typeof data.linkName === "string" ? data.linkName : void 0);
|
|
1121
|
+
if (timer) normalized.timer = timer;
|
|
1122
|
+
if (messageRef) normalized.messageRef = messageRef;
|
|
1123
|
+
if (signalRef) normalized.signalRef = signalRef;
|
|
1124
|
+
if (errorRef) normalized.errorRef = errorRef;
|
|
1125
|
+
if (escalationRef) normalized.escalationRef = escalationRef;
|
|
1126
|
+
if (conditionExpression) normalized.conditionExpression = conditionExpression;
|
|
1127
|
+
if (linkName) normalized.linkName = linkName;
|
|
1128
|
+
return normalized;
|
|
1129
|
+
}
|
|
1130
|
+
function parseVariableType2(type) {
|
|
1131
|
+
switch (type) {
|
|
1132
|
+
case "integer":
|
|
1133
|
+
return "xsd:int";
|
|
1134
|
+
case "boolean":
|
|
1135
|
+
return "xsd:boolean";
|
|
1136
|
+
case "date":
|
|
1137
|
+
return "xsd:dateTime";
|
|
1138
|
+
case "object":
|
|
1139
|
+
return "xsd:anyType";
|
|
1140
|
+
case "array":
|
|
1141
|
+
return "xsd:anyType";
|
|
1142
|
+
default:
|
|
1143
|
+
return "xsd:string";
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
function buildGlobalDefinitions(moddle, definitionsSet) {
|
|
1147
|
+
if (!definitionsSet) return [];
|
|
1148
|
+
const rootElements = [];
|
|
1149
|
+
for (const message of definitionsSet.messages ?? []) {
|
|
1150
|
+
rootElements.push(moddle.create("bpmn:Message", { id: message.id, name: message.name }));
|
|
1151
|
+
}
|
|
1152
|
+
for (const signal of definitionsSet.signals ?? []) {
|
|
1153
|
+
rootElements.push(moddle.create("bpmn:Signal", { id: signal.id, name: signal.name }));
|
|
1154
|
+
}
|
|
1155
|
+
for (const error of definitionsSet.errors ?? []) {
|
|
1156
|
+
rootElements.push(moddle.create("bpmn:Error", {
|
|
1157
|
+
id: error.id,
|
|
1158
|
+
name: error.name,
|
|
1159
|
+
...error.errorCode ? { errorCode: error.errorCode } : {}
|
|
1160
|
+
}));
|
|
1161
|
+
}
|
|
1162
|
+
for (const escalation of definitionsSet.escalations ?? []) {
|
|
1163
|
+
rootElements.push(moddle.create("bpmn:Escalation", {
|
|
1164
|
+
id: escalation.id,
|
|
1165
|
+
name: escalation.name,
|
|
1166
|
+
...escalation.escalationCode ? { escalationCode: escalation.escalationCode } : {}
|
|
1167
|
+
}));
|
|
1168
|
+
}
|
|
1169
|
+
return rootElements;
|
|
1170
|
+
}
|
|
1171
|
+
function buildItemDefinitions(moddle, variables) {
|
|
1172
|
+
return (variables ?? []).map(
|
|
1173
|
+
(variable) => moddle.create("bpmn:ItemDefinition", {
|
|
1174
|
+
id: `${variable.id}_item`,
|
|
1175
|
+
itemKind: "Information",
|
|
1176
|
+
structureRef: parseVariableType2(variable.type)
|
|
1177
|
+
})
|
|
1178
|
+
);
|
|
1179
|
+
}
|
|
1180
|
+
function buildEventDefinitions(moddle, node, eventDefinition) {
|
|
1181
|
+
if (eventDefinition.type === "multiple" || eventDefinition.type === "parallelMultiple") {
|
|
1182
|
+
return [];
|
|
1183
|
+
}
|
|
1184
|
+
const defType = TRIGGER_TO_EVENT_DEF[eventDefinition.type];
|
|
1185
|
+
if (!defType) return [];
|
|
1186
|
+
const attrs = { id: uid("EventDef", node.id) };
|
|
1187
|
+
if (eventDefinition.messageRef) attrs.messageRef = { id: eventDefinition.messageRef };
|
|
1188
|
+
if (eventDefinition.signalRef) attrs.signalRef = { id: eventDefinition.signalRef };
|
|
1189
|
+
if (eventDefinition.errorRef) attrs.errorRef = { id: eventDefinition.errorRef };
|
|
1190
|
+
if (eventDefinition.escalationRef) attrs.escalationRef = { id: eventDefinition.escalationRef };
|
|
1191
|
+
if (eventDefinition.conditionExpression) {
|
|
1192
|
+
attrs.condition = moddle.create("bpmn:FormalExpression", {
|
|
1193
|
+
body: eventDefinition.conditionExpression
|
|
1194
|
+
});
|
|
1195
|
+
}
|
|
1196
|
+
if (eventDefinition.timer?.value) {
|
|
1197
|
+
attrs[eventDefinition.timer.kind === "date" ? "timeDate" : eventDefinition.timer.kind === "cycle" ? "timeCycle" : "timeDuration"] = moddle.create("bpmn:FormalExpression", {
|
|
1198
|
+
body: eventDefinition.timer.value
|
|
1199
|
+
});
|
|
1200
|
+
}
|
|
1201
|
+
return [moddle.create(defType, attrs)];
|
|
1202
|
+
}
|
|
1012
1203
|
function buildSemanticModel(moddle, nodes, edges, opts) {
|
|
1013
1204
|
const defId = opts.id ?? "Definitions_1";
|
|
1014
1205
|
const defName = opts.name;
|
|
@@ -1020,13 +1211,19 @@ function buildSemanticModel(moddle, nodes, edges, opts) {
|
|
|
1020
1211
|
targetNamespace: "http://bpmn.io/schema/bpmn",
|
|
1021
1212
|
...defName ? { name: defName } : {}
|
|
1022
1213
|
});
|
|
1023
|
-
const rootElements = [
|
|
1214
|
+
const rootElements = [
|
|
1215
|
+
...buildGlobalDefinitions(moddle, opts.process?.definitions)
|
|
1216
|
+
];
|
|
1217
|
+
const itemDefinitions = buildItemDefinitions(moddle, opts.process?.definitions?.variables);
|
|
1218
|
+
if (itemDefinitions.length > 0) {
|
|
1219
|
+
definitions.itemDefinitions = itemDefinitions;
|
|
1220
|
+
}
|
|
1024
1221
|
if (isCollaboration) {
|
|
1025
1222
|
const participants = [];
|
|
1026
1223
|
const processes = [];
|
|
1027
1224
|
for (const pool of poolNodes) {
|
|
1028
1225
|
const processId = `Process_${pool.id}`;
|
|
1029
|
-
const process = buildProcess(moddle, nodes, edges, pool.id, laneNodes, processId);
|
|
1226
|
+
const process = buildProcess(moddle, nodes, edges, pool.id, laneNodes, processId, opts);
|
|
1030
1227
|
processes.push(process);
|
|
1031
1228
|
const participant = moddle.create("bpmn:Participant", {
|
|
1032
1229
|
id: pool.id,
|
|
@@ -1060,13 +1257,21 @@ function buildSemanticModel(moddle, nodes, edges, opts) {
|
|
|
1060
1257
|
});
|
|
1061
1258
|
rootElements.push(collaboration, ...processes);
|
|
1062
1259
|
} else {
|
|
1063
|
-
const process = buildProcess(
|
|
1260
|
+
const process = buildProcess(
|
|
1261
|
+
moddle,
|
|
1262
|
+
nodes,
|
|
1263
|
+
edges,
|
|
1264
|
+
void 0,
|
|
1265
|
+
laneNodes,
|
|
1266
|
+
opts.process?.processId ?? "Process_1",
|
|
1267
|
+
opts
|
|
1268
|
+
);
|
|
1064
1269
|
rootElements.push(process);
|
|
1065
1270
|
}
|
|
1066
1271
|
definitions.rootElements = rootElements;
|
|
1067
1272
|
return definitions;
|
|
1068
1273
|
}
|
|
1069
|
-
function buildProcess(moddle, allNodes, allEdges, poolId, laneNodes, processId) {
|
|
1274
|
+
function buildProcess(moddle, allNodes, allEdges, poolId, laneNodes, processId, opts) {
|
|
1070
1275
|
const subProcessIds = new Set(
|
|
1071
1276
|
allNodes.filter(
|
|
1072
1277
|
(n) => n.data.elementType === "SubProcess" || n.data.elementType === "Transaction" || n.data.elementType === "EventSubProcess" || n.data.elementType === "AdHocSubProcess"
|
|
@@ -1116,9 +1321,14 @@ function buildProcess(moddle, allNodes, allEdges, poolId, laneNodes, processId)
|
|
|
1116
1321
|
}
|
|
1117
1322
|
const process = moddle.create("bpmn:Process", {
|
|
1118
1323
|
id: processId,
|
|
1119
|
-
isExecutable: true,
|
|
1324
|
+
isExecutable: opts.process?.executable ?? true,
|
|
1120
1325
|
flowElements
|
|
1121
1326
|
});
|
|
1327
|
+
if (opts.process?.documentation) {
|
|
1328
|
+
process.documentation = [
|
|
1329
|
+
moddle.create("bpmn:Documentation", { text: opts.process.documentation })
|
|
1330
|
+
];
|
|
1331
|
+
}
|
|
1122
1332
|
if (myLanes.length > 0) {
|
|
1123
1333
|
const laneElements = myLanes.map(
|
|
1124
1334
|
(l) => moddle.create("bpmn:Lane", {
|
|
@@ -1135,7 +1345,8 @@ function buildProcess(moddle, allNodes, allEdges, poolId, laneNodes, processId)
|
|
|
1135
1345
|
return process;
|
|
1136
1346
|
}
|
|
1137
1347
|
function buildFlowElement(moddle, node, allNodes, allEdges) {
|
|
1138
|
-
const { elementType, label
|
|
1348
|
+
const { elementType, label } = node.data;
|
|
1349
|
+
const eventDefinition = normalizeEventDefinition(node.data);
|
|
1139
1350
|
if (elementType === "Pool" || elementType === "Lane") return null;
|
|
1140
1351
|
const moddleType = ELEMENT_TYPE_TO_MODDLE[elementType];
|
|
1141
1352
|
if (!moddleType) return null;
|
|
@@ -1148,15 +1359,15 @@ function buildFlowElement(moddle, node, allNodes, allEdges) {
|
|
|
1148
1359
|
moddle.create("bpmn:Documentation", { text: node.data.documentation })
|
|
1149
1360
|
];
|
|
1150
1361
|
}
|
|
1151
|
-
if (
|
|
1152
|
-
const
|
|
1153
|
-
if (
|
|
1154
|
-
|
|
1155
|
-
}
|
|
1362
|
+
if (eventDefinition) {
|
|
1363
|
+
const eventDefinitions = buildEventDefinitions(moddle, node, eventDefinition);
|
|
1364
|
+
if (eventDefinitions.length > 0) attrs.eventDefinitions = eventDefinitions;
|
|
1365
|
+
if (eventDefinition.linkName) attrs.name = eventDefinition.linkName;
|
|
1156
1366
|
}
|
|
1157
1367
|
if (elementType === "BoundaryEvent") {
|
|
1158
1368
|
attrs.attachedToRef = { id: node.data.attachedToRef ?? node.parentId };
|
|
1159
|
-
|
|
1369
|
+
const interrupting = node.data.cancelActivity ?? !node.data.isNonInterrupting;
|
|
1370
|
+
attrs.cancelActivity = interrupting;
|
|
1160
1371
|
}
|
|
1161
1372
|
const isSubProcess = elementType === "SubProcess" || elementType === "Transaction" || elementType === "EventSubProcess" || elementType === "AdHocSubProcess";
|
|
1162
1373
|
if (isSubProcess) {
|