@aranzatech/diagrams-bpmn 0.2.14 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/README.md +34 -4
  2. package/dist/{catalog-xOMF2ifW.d.cts → catalog-DAGDhO-D.d.cts} +1 -1
  3. package/dist/{catalog-CK3_4cOb.d.ts → catalog-Q1QmKLDD.d.ts} +1 -1
  4. package/dist/{chunk-YUE5EM3W.js → chunk-334WN4JZ.js} +276 -107
  5. package/dist/chunk-334WN4JZ.js.map +1 -0
  6. package/dist/chunk-77L6O76M.js +3 -0
  7. package/dist/chunk-77L6O76M.js.map +1 -0
  8. package/dist/{chunk-QSMP34CT.js → chunk-CPFUQM6H.js} +80 -44
  9. package/dist/chunk-CPFUQM6H.js.map +1 -0
  10. package/dist/chunk-FFWJA5BV.js +163 -0
  11. package/dist/chunk-FFWJA5BV.js.map +1 -0
  12. package/dist/{chunk-FBTGIYZS.js → chunk-JEGYVEJO.js} +80 -3
  13. package/dist/{chunk-FBTGIYZS.js.map → chunk-JEGYVEJO.js.map} +1 -1
  14. package/dist/chunk-TB6V4S5N.js +104 -0
  15. package/dist/chunk-TB6V4S5N.js.map +1 -0
  16. package/dist/{chunk-IMW6RG6F.js → chunk-X54NHLBA.js} +43 -190
  17. package/dist/chunk-X54NHLBA.js.map +1 -0
  18. package/dist/{chunk-UAWLUDKC.js → chunk-YAYZW45I.js} +481 -26
  19. package/dist/chunk-YAYZW45I.js.map +1 -0
  20. package/dist/edges/index.cjs +78 -42
  21. package/dist/edges/index.cjs.map +1 -1
  22. package/dist/edges/index.js +1 -1
  23. package/dist/elements/index.cjs +78 -0
  24. package/dist/elements/index.cjs.map +1 -1
  25. package/dist/elements/index.d.cts +24 -5
  26. package/dist/elements/index.d.ts +24 -5
  27. package/dist/elements/index.js +1 -1
  28. package/dist/elk-QT7H4252.js +6 -0
  29. package/dist/elk-QT7H4252.js.map +1 -0
  30. package/dist/extensions/index.cjs +108 -0
  31. package/dist/extensions/index.cjs.map +1 -0
  32. package/dist/extensions/index.d.cts +145 -0
  33. package/dist/extensions/index.d.ts +145 -0
  34. package/dist/extensions/index.js +4 -0
  35. package/dist/extensions/index.js.map +1 -0
  36. package/dist/index.cjs +1067 -358
  37. package/dist/index.cjs.map +1 -1
  38. package/dist/index.d.cts +7 -5
  39. package/dist/index.d.ts +7 -5
  40. package/dist/index.js +7 -5
  41. package/dist/index.js.map +1 -1
  42. package/dist/layout/index.cjs +1396 -749
  43. package/dist/layout/index.cjs.map +1 -1
  44. package/dist/layout/index.d.cts +10 -4
  45. package/dist/layout/index.d.ts +10 -4
  46. package/dist/layout/index.js +543 -104
  47. package/dist/layout/index.js.map +1 -1
  48. package/dist/modeling/index.cjs +490 -23
  49. package/dist/modeling/index.cjs.map +1 -1
  50. package/dist/modeling/index.d.cts +81 -6
  51. package/dist/modeling/index.d.ts +81 -6
  52. package/dist/modeling/index.js +1 -1
  53. package/dist/nodes/index.cjs +42 -188
  54. package/dist/nodes/index.cjs.map +1 -1
  55. package/dist/nodes/index.d.cts +1 -1
  56. package/dist/nodes/index.d.ts +1 -1
  57. package/dist/nodes/index.js +1 -1
  58. package/dist/types-BX_o95GC.d.cts +40 -0
  59. package/dist/{types-y-ZbX-ff.d.cts → types-BYN4Zuee.d.cts} +15 -1
  60. package/dist/{types-y-ZbX-ff.d.ts → types-BYN4Zuee.d.ts} +15 -1
  61. package/dist/{types-jIDz306Y.d.cts → types-CggktCqr.d.cts} +4 -1
  62. package/dist/types-D7zel9dq.d.ts +40 -0
  63. package/dist/{types-DG5yPKld.d.ts → types-DmDODKlh.d.ts} +4 -1
  64. package/dist/validation/index.cjs +81 -125
  65. package/dist/validation/index.cjs.map +1 -1
  66. package/dist/validation/index.d.cts +22 -5
  67. package/dist/validation/index.d.ts +22 -5
  68. package/dist/validation/index.js +82 -126
  69. package/dist/validation/index.js.map +1 -1
  70. package/dist/xml/index.cjs +319 -49
  71. package/dist/xml/index.cjs.map +1 -1
  72. package/dist/xml/index.d.cts +5 -3
  73. package/dist/xml/index.d.ts +5 -3
  74. package/dist/xml/index.js +2 -1
  75. package/package.json +6 -1
  76. package/dist/chunk-IMW6RG6F.js.map +0 -1
  77. package/dist/chunk-QSMP34CT.js.map +0 -1
  78. package/dist/chunk-UAWLUDKC.js.map +0 -1
  79. package/dist/chunk-YUE5EM3W.js.map +0 -1
  80. package/dist/guards-C70uIY_O.d.cts +0 -16
  81. package/dist/guards-foB6XIfZ.d.ts +0 -16
@@ -15,7 +15,7 @@ declare function GatewayNode({ data, selected }: NodeProps): react_jsx_runtime.J
15
15
 
16
16
  declare function SubProcessNode({ data, selected }: NodeProps): react_jsx_runtime.JSX.Element;
17
17
 
18
- declare function PoolNode({ data, selected }: NodeProps): react_jsx_runtime.JSX.Element;
18
+ declare function PoolNode({ selected }: NodeProps): react_jsx_runtime.JSX.Element;
19
19
 
20
20
  declare function LaneNode({ data, selected }: NodeProps): react_jsx_runtime.JSX.Element;
21
21
 
@@ -15,7 +15,7 @@ declare function GatewayNode({ data, selected }: NodeProps): react_jsx_runtime.J
15
15
 
16
16
  declare function SubProcessNode({ data, selected }: NodeProps): react_jsx_runtime.JSX.Element;
17
17
 
18
- declare function PoolNode({ data, selected }: NodeProps): react_jsx_runtime.JSX.Element;
18
+ declare function PoolNode({ selected }: NodeProps): react_jsx_runtime.JSX.Element;
19
19
 
20
20
  declare function LaneNode({ data, selected }: NodeProps): react_jsx_runtime.JSX.Element;
21
21
 
@@ -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-IMW6RG6F.js';
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-X54NHLBA.js';
2
2
  import '../chunk-PDTXM32P.js';
3
3
  //# sourceMappingURL=index.js.map
4
4
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,40 @@
1
+ import { p as BpmnServiceTaskConfig, I as InlineDecisionTable, b as BpmnEdgeData, m as BpmnNodeData } from './types-BYN4Zuee.cjs';
2
+
3
+ type BpmnExecutionEngine = "flowable";
4
+ interface BpmnAranzaTaskExtensions {
5
+ priority?: "critical" | "high" | "medium" | "low";
6
+ owner?: string;
7
+ sla?: string;
8
+ connector?: string;
9
+ action?: string;
10
+ }
11
+ interface BpmnFlowableTaskExtensions {
12
+ flowableType?: string;
13
+ flowableDelegateExpression?: string;
14
+ decisionRef?: string;
15
+ formKey?: string;
16
+ candidateUsers?: string;
17
+ candidateGroups?: string;
18
+ dueDate?: string;
19
+ skipExpression?: string;
20
+ businessCalendarName?: string;
21
+ }
22
+ interface BpmnTaskExecutionExtensions extends BpmnAranzaTaskExtensions, BpmnFlowableTaskExtensions {
23
+ serviceConfig?: BpmnServiceTaskConfig;
24
+ inlineDecisionTable?: InlineDecisionTable;
25
+ }
26
+ interface BpmnMessageFlowExecutionExtensions {
27
+ payloadSchema?: string;
28
+ correlationKey?: string;
29
+ }
30
+ interface BpmnFlowableExportOptions {
31
+ enabled?: boolean;
32
+ backendUrlTemplate?: string;
33
+ serviceTaskConfigs?: Record<string, BpmnServiceTaskConfig | undefined>;
34
+ connectorResponseVariableName?: string;
35
+ decisionResponseVariableName?: string;
36
+ }
37
+ declare function getBpmnTaskExecutionExtensions(data: Pick<BpmnNodeData, "priority" | "owner" | "sla" | "connector" | "action" | "flowableType" | "flowableDelegateExpression" | "serviceConfig" | "decisionRef" | "inlineDecisionTable" | "formKey" | "candidateUsers" | "candidateGroups" | "dueDate" | "skipExpression" | "businessCalendarName">): BpmnTaskExecutionExtensions | undefined;
38
+ declare function getBpmnMessageFlowExecutionExtensions(data: Pick<BpmnEdgeData, "payloadSchema" | "correlationKey">): BpmnMessageFlowExecutionExtensions | undefined;
39
+
40
+ export { type BpmnAranzaTaskExtensions as B, type BpmnExecutionEngine as a, type BpmnFlowableExportOptions as b, type BpmnFlowableTaskExtensions as c, type BpmnMessageFlowExecutionExtensions as d, type BpmnTaskExecutionExtensions as e, getBpmnTaskExecutionExtensions as f, getBpmnMessageFlowExecutionExtensions as g };
@@ -35,6 +35,16 @@ interface BpmnProcessVariable {
35
35
  defaultValue?: string;
36
36
  description?: string;
37
37
  }
38
+ interface BpmnServiceTaskConfig {
39
+ implementation?: "none" | "connector" | "http" | "webService";
40
+ connectorInstanceId?: string;
41
+ connectorId?: string;
42
+ connectorAction?: string;
43
+ connectorParams?: Record<string, string>;
44
+ httpMethod?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
45
+ endpoint?: string;
46
+ operationRef?: string;
47
+ }
38
48
  interface BpmnDefinitionsSet {
39
49
  messages?: BpmnMessageDefinition[];
40
50
  signals?: BpmnSignalDefinition[];
@@ -160,6 +170,8 @@ interface BpmnNodeData extends Record<string, unknown> {
160
170
  flowableType?: string;
161
171
  /** Flowable delegate expression for ServiceTask. */
162
172
  flowableDelegateExpression?: string;
173
+ /** Aranza service-task runtime configuration used for Flowable export. */
174
+ serviceConfig?: BpmnServiceTaskConfig;
163
175
  /** ScriptTask: scripting language (e.g. "javascript", "groovy"). */
164
176
  scriptFormat?: string;
165
177
  /** ScriptTask: script body. */
@@ -182,6 +194,8 @@ interface BpmnNodeData extends Record<string, unknown> {
182
194
  businessCalendarName?: string;
183
195
  /** DataObjectReference: id of the backing bpmn:DataObject element. */
184
196
  dataObjectRef?: string;
197
+ /** DataStoreReference: id of the backing bpmn:DataStore element. */
198
+ dataStoreRef?: string;
185
199
  /** AdHocSubProcess: FEEL expression that determines when the sub-process completes. */
186
200
  completionCondition?: string;
187
201
  /** Loop / multi-instance type: none | loop | sequentialMultiple | parallelMultiple. */
@@ -239,4 +253,4 @@ interface BpmnEdgeData extends Record<string, unknown> {
239
253
  correlationKey?: string;
240
254
  }
241
255
 
242
- export type { BpmnCategory as B, EventTrigger as E, InlineDecisionInput as I, 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, InlineDecisionOutput as s, InlineDecisionRule as t, InlineDecisionTable as u };
256
+ export type { BpmnCategory as B, EventTrigger as E, InlineDecisionTable as I, 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, BpmnServiceTaskConfig as p, BpmnSignalDefinition as q, BpmnTimerDefinition as r, BpmnTimerKind as s, InlineDecisionInput as t, InlineDecisionOutput as u, InlineDecisionRule as v };
@@ -35,6 +35,16 @@ interface BpmnProcessVariable {
35
35
  defaultValue?: string;
36
36
  description?: string;
37
37
  }
38
+ interface BpmnServiceTaskConfig {
39
+ implementation?: "none" | "connector" | "http" | "webService";
40
+ connectorInstanceId?: string;
41
+ connectorId?: string;
42
+ connectorAction?: string;
43
+ connectorParams?: Record<string, string>;
44
+ httpMethod?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
45
+ endpoint?: string;
46
+ operationRef?: string;
47
+ }
38
48
  interface BpmnDefinitionsSet {
39
49
  messages?: BpmnMessageDefinition[];
40
50
  signals?: BpmnSignalDefinition[];
@@ -160,6 +170,8 @@ interface BpmnNodeData extends Record<string, unknown> {
160
170
  flowableType?: string;
161
171
  /** Flowable delegate expression for ServiceTask. */
162
172
  flowableDelegateExpression?: string;
173
+ /** Aranza service-task runtime configuration used for Flowable export. */
174
+ serviceConfig?: BpmnServiceTaskConfig;
163
175
  /** ScriptTask: scripting language (e.g. "javascript", "groovy"). */
164
176
  scriptFormat?: string;
165
177
  /** ScriptTask: script body. */
@@ -182,6 +194,8 @@ interface BpmnNodeData extends Record<string, unknown> {
182
194
  businessCalendarName?: string;
183
195
  /** DataObjectReference: id of the backing bpmn:DataObject element. */
184
196
  dataObjectRef?: string;
197
+ /** DataStoreReference: id of the backing bpmn:DataStore element. */
198
+ dataStoreRef?: string;
185
199
  /** AdHocSubProcess: FEEL expression that determines when the sub-process completes. */
186
200
  completionCondition?: string;
187
201
  /** Loop / multi-instance type: none | loop | sequentialMultiple | parallelMultiple. */
@@ -239,4 +253,4 @@ interface BpmnEdgeData extends Record<string, unknown> {
239
253
  correlationKey?: string;
240
254
  }
241
255
 
242
- export type { BpmnCategory as B, EventTrigger as E, InlineDecisionInput as I, 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, InlineDecisionOutput as s, InlineDecisionRule as t, InlineDecisionTable as u };
256
+ export type { BpmnCategory as B, EventTrigger as E, InlineDecisionTable as I, 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, BpmnServiceTaskConfig as p, BpmnSignalDefinition as q, BpmnTimerDefinition as r, BpmnTimerKind as s, InlineDecisionInput as t, InlineDecisionOutput as u, InlineDecisionRule as v };
@@ -1,5 +1,6 @@
1
1
  import { Node, Edge } from '@xyflow/react';
2
- import { m as BpmnNodeData, b as BpmnEdgeData, a as BpmnDefinitionsSet } from './types-y-ZbX-ff.cjs';
2
+ import { m as BpmnNodeData, b as BpmnEdgeData, a as BpmnDefinitionsSet } from './types-BYN4Zuee.cjs';
3
+ import { b as BpmnFlowableExportOptions } from './types-BX_o95GC.cjs';
3
4
 
4
5
  type BpmnRFNode = Node<BpmnNodeData>;
5
6
  type BpmnRFEdge = Edge<BpmnEdgeData>;
@@ -24,6 +25,8 @@ interface BpmnExportOptions {
24
25
  format?: boolean;
25
26
  /** Optional process-level metadata and global definitions. */
26
27
  process?: BpmnProcessModel;
28
+ /** Optional Flowable-specific export enrichment. */
29
+ flowable?: BpmnFlowableExportOptions;
27
30
  }
28
31
 
29
32
  export type { BpmnExportOptions as B, BpmnImportResult as a, BpmnProcessModel as b, BpmnRFEdge as c, BpmnRFNode as d };
@@ -0,0 +1,40 @@
1
+ import { p as BpmnServiceTaskConfig, I as InlineDecisionTable, b as BpmnEdgeData, m as BpmnNodeData } from './types-BYN4Zuee.js';
2
+
3
+ type BpmnExecutionEngine = "flowable";
4
+ interface BpmnAranzaTaskExtensions {
5
+ priority?: "critical" | "high" | "medium" | "low";
6
+ owner?: string;
7
+ sla?: string;
8
+ connector?: string;
9
+ action?: string;
10
+ }
11
+ interface BpmnFlowableTaskExtensions {
12
+ flowableType?: string;
13
+ flowableDelegateExpression?: string;
14
+ decisionRef?: string;
15
+ formKey?: string;
16
+ candidateUsers?: string;
17
+ candidateGroups?: string;
18
+ dueDate?: string;
19
+ skipExpression?: string;
20
+ businessCalendarName?: string;
21
+ }
22
+ interface BpmnTaskExecutionExtensions extends BpmnAranzaTaskExtensions, BpmnFlowableTaskExtensions {
23
+ serviceConfig?: BpmnServiceTaskConfig;
24
+ inlineDecisionTable?: InlineDecisionTable;
25
+ }
26
+ interface BpmnMessageFlowExecutionExtensions {
27
+ payloadSchema?: string;
28
+ correlationKey?: string;
29
+ }
30
+ interface BpmnFlowableExportOptions {
31
+ enabled?: boolean;
32
+ backendUrlTemplate?: string;
33
+ serviceTaskConfigs?: Record<string, BpmnServiceTaskConfig | undefined>;
34
+ connectorResponseVariableName?: string;
35
+ decisionResponseVariableName?: string;
36
+ }
37
+ declare function getBpmnTaskExecutionExtensions(data: Pick<BpmnNodeData, "priority" | "owner" | "sla" | "connector" | "action" | "flowableType" | "flowableDelegateExpression" | "serviceConfig" | "decisionRef" | "inlineDecisionTable" | "formKey" | "candidateUsers" | "candidateGroups" | "dueDate" | "skipExpression" | "businessCalendarName">): BpmnTaskExecutionExtensions | undefined;
38
+ declare function getBpmnMessageFlowExecutionExtensions(data: Pick<BpmnEdgeData, "payloadSchema" | "correlationKey">): BpmnMessageFlowExecutionExtensions | undefined;
39
+
40
+ export { type BpmnAranzaTaskExtensions as B, type BpmnExecutionEngine as a, type BpmnFlowableExportOptions as b, type BpmnFlowableTaskExtensions as c, type BpmnMessageFlowExecutionExtensions as d, type BpmnTaskExecutionExtensions as e, getBpmnTaskExecutionExtensions as f, getBpmnMessageFlowExecutionExtensions as g };
@@ -1,5 +1,6 @@
1
1
  import { Node, Edge } from '@xyflow/react';
2
- import { m as BpmnNodeData, b as BpmnEdgeData, a as BpmnDefinitionsSet } from './types-y-ZbX-ff.js';
2
+ import { m as BpmnNodeData, b as BpmnEdgeData, a as BpmnDefinitionsSet } from './types-BYN4Zuee.js';
3
+ import { b as BpmnFlowableExportOptions } from './types-D7zel9dq.js';
3
4
 
4
5
  type BpmnRFNode = Node<BpmnNodeData>;
5
6
  type BpmnRFEdge = Edge<BpmnEdgeData>;
@@ -24,6 +25,8 @@ interface BpmnExportOptions {
24
25
  format?: boolean;
25
26
  /** Optional process-level metadata and global definitions. */
26
27
  process?: BpmnProcessModel;
28
+ /** Optional Flowable-specific export enrichment. */
29
+ flowable?: BpmnFlowableExportOptions;
27
30
  }
28
31
 
29
32
  export type { BpmnExportOptions as B, BpmnImportResult as a, BpmnProcessModel as b, BpmnRFEdge as c, BpmnRFNode as d };
@@ -624,18 +624,17 @@ function isDataType(type) {
624
624
  }
625
625
 
626
626
  // src/validation/index.ts
627
+ var hasWarnedAboutLegacyValidation = false;
628
+ function warnLegacyValidationOnce() {
629
+ if (hasWarnedAboutLegacyValidation) return;
630
+ hasWarnedAboutLegacyValidation = true;
631
+ console.warn(
632
+ "[@aranzatech/diagrams-bpmn/validation] validateBpmnDiagram is deprecated and now checks only structural editor invariants. Use @aranzatech/flowslint for full BPMN linting."
633
+ );
634
+ }
627
635
  function isFlowNode(type) {
628
636
  return isEventType(type) || isGatewayType(type) || type.includes("Task") || type === "CallActivity" || type === "SubProcess" || type === "Transaction" || type === "EventSubProcess" || type === "AdHocSubProcess" || type === "ChoreographyTask" || type === "SubChoreography" || type === "CallChoreography";
629
637
  }
630
- function isProcessNode(type) {
631
- return isFlowNode(type) && type !== "BoundaryEvent";
632
- }
633
- function isSubProcess(type) {
634
- return type === "SubProcess" || type === "Transaction" || type === "EventSubProcess" || type === "AdHocSubProcess";
635
- }
636
- function isCatchTarget(type) {
637
- return type === "IntermediateCatchEvent" || type === "ReceiveTask";
638
- }
639
638
  function poolAncestor(node, nodeById) {
640
639
  let current = node;
641
640
  const visited = /* @__PURE__ */ new Set();
@@ -647,18 +646,9 @@ function poolAncestor(node, nodeById) {
647
646
  }
648
647
  return void 0;
649
648
  }
650
- function countSequenceEdges(edges, nodeId, direction) {
651
- return edges.filter((edge) => {
652
- if (edge.data?.edgeType !== "sequenceFlow") return false;
653
- return direction === "in" ? edge.target === nodeId : edge.source === nodeId;
654
- }).length;
655
- }
656
649
  function sequenceEdges(edges) {
657
650
  return edges.filter((edge) => (edge.data?.edgeType ?? edge.type) === "sequenceFlow");
658
651
  }
659
- function sequenceOut(edges, nodeId) {
660
- return sequenceEdges(edges).filter((edge) => edge.source === nodeId);
661
- }
662
652
  function sequenceIn(edges, nodeId) {
663
653
  return sequenceEdges(edges).filter((edge) => edge.target === nodeId);
664
654
  }
@@ -672,23 +662,10 @@ function issue(code, severity, message, elementId, relatedElementIds) {
672
662
  ...relatedElementIds ? { relatedElementIds } : {}
673
663
  };
674
664
  }
675
- function validateBpmnDiagram(nodes, edges, options = {}) {
676
- const opts = {
677
- requireStartEvent: true,
678
- requireEndEvent: true,
679
- strictNames: false,
680
- ...options
681
- };
665
+ function validateBpmnDiagram(nodes, edges, _options = {}) {
666
+ warnLegacyValidationOnce();
682
667
  const issues = [];
683
668
  const nodeById = new Map(nodes.map((node) => [node.id, node]));
684
- const seqEdges = sequenceEdges(edges);
685
- const processNodes = nodes.filter((node) => isProcessNode(node.data.elementType));
686
- if (opts.requireStartEvent && !processNodes.some((node) => node.data.elementType === "StartEvent")) {
687
- issues.push(issue("bpmn/start-event-required", "error", "The diagram must contain at least one start event."));
688
- }
689
- if (opts.requireEndEvent && !processNodes.some((node) => node.data.elementType === "EndEvent")) {
690
- issues.push(issue("bpmn/end-event-required", "error", "The diagram must contain at least one end event."));
691
- }
692
669
  for (const edge of edges) {
693
670
  const edgeType = edge.data?.edgeType ?? edge.type;
694
671
  const source = nodeById.get(edge.source);
@@ -704,130 +681,109 @@ function validateBpmnDiagram(nodes, edges, options = {}) {
704
681
  continue;
705
682
  }
706
683
  if (edge.source === edge.target) {
707
- issues.push(issue("bpmn/no-self-loop", "error", "BPMN edges cannot connect an element to itself.", edge.id, [edge.source]));
684
+ issues.push(
685
+ issue(
686
+ "bpmn/no-self-loop",
687
+ "error",
688
+ "BPMN edges cannot connect an element to itself.",
689
+ edge.id,
690
+ [edge.source]
691
+ )
692
+ );
708
693
  }
709
694
  if (edgeType === "sequenceFlow") {
710
695
  if (!isFlowNode(source.data.elementType) || !isFlowNode(target.data.elementType) || isDataType(source.data.elementType) || isDataType(target.data.elementType)) {
711
- issues.push(issue("bpmn/sequence-flow-valid-endpoints", "error", "Sequence flows must connect BPMN flow nodes.", edge.id, [source.id, target.id]));
696
+ issues.push(
697
+ issue(
698
+ "bpmn/sequence-flow-valid-endpoints",
699
+ "error",
700
+ "Sequence flows must connect BPMN flow nodes.",
701
+ edge.id,
702
+ [source.id, target.id]
703
+ )
704
+ );
712
705
  }
713
706
  const sourcePool = poolAncestor(source, nodeById);
714
707
  const targetPool = poolAncestor(target, nodeById);
715
708
  if (sourcePool && targetPool && sourcePool !== targetPool) {
716
- issues.push(issue("bpmn/sequence-flow-no-cross-pool", "error", "Sequence flows cannot cross pools. Use message flow between participants.", edge.id, [source.id, target.id]));
709
+ issues.push(
710
+ issue(
711
+ "bpmn/sequence-flow-no-cross-pool",
712
+ "error",
713
+ "Sequence flows cannot cross pools. Use message flow between participants.",
714
+ edge.id,
715
+ [source.id, target.id]
716
+ )
717
+ );
717
718
  }
718
719
  }
719
720
  if (edgeType === "messageFlow") {
720
721
  const sourcePool = poolAncestor(source, nodeById);
721
722
  const targetPool = poolAncestor(target, nodeById);
722
723
  if (!sourcePool || !targetPool || sourcePool === targetPool) {
723
- issues.push(issue("bpmn/message-flow-valid-endpoints", "error", "Message flows must connect flow nodes in different pools.", edge.id, [source.id, target.id]));
724
+ issues.push(
725
+ issue(
726
+ "bpmn/message-flow-valid-endpoints",
727
+ "error",
728
+ "Message flows must connect flow nodes in different pools.",
729
+ edge.id,
730
+ [source.id, target.id]
731
+ )
732
+ );
724
733
  }
725
734
  if (!isFlowNode(source.data.elementType) || !isFlowNode(target.data.elementType)) {
726
- issues.push(issue("bpmn/message-flow-valid-endpoints", "error", "Message flows must connect BPMN flow nodes, not containers.", edge.id, [source.id, target.id]));
735
+ issues.push(
736
+ issue(
737
+ "bpmn/message-flow-valid-endpoints",
738
+ "error",
739
+ "Message flows must connect BPMN flow nodes, not containers.",
740
+ edge.id,
741
+ [source.id, target.id]
742
+ )
743
+ );
727
744
  }
728
745
  }
729
746
  if (edgeType === "dataAssociation") {
730
747
  const hasDataEndpoint = isDataType(source.data.elementType) || isDataType(target.data.elementType);
731
748
  const hasFlowEndpoint = isFlowNode(source.data.elementType) || isFlowNode(target.data.elementType);
732
749
  if (!hasDataEndpoint || !hasFlowEndpoint) {
733
- issues.push(issue("bpmn/data-association-valid-endpoints", "error", "Data associations must connect data elements with flow nodes.", edge.id, [source.id, target.id]));
750
+ issues.push(
751
+ issue(
752
+ "bpmn/data-association-valid-endpoints",
753
+ "error",
754
+ "Data associations must connect data elements with flow nodes.",
755
+ edge.id,
756
+ [source.id, target.id]
757
+ )
758
+ );
734
759
  }
735
760
  }
736
761
  }
737
- const duplicateSequenceKeys = /* @__PURE__ */ new Set();
738
- const reportedDuplicateKeys = /* @__PURE__ */ new Set();
739
- for (const edge of seqEdges) {
740
- const key = `${edge.source}->${edge.target}`;
741
- if (duplicateSequenceKeys.has(key) && !reportedDuplicateKeys.has(key)) {
742
- reportedDuplicateKeys.add(key);
743
- issues.push(issue("bpmn/no-duplicate-sequence-flow", "error", "Only one sequence flow is allowed between the same source and target.", edge.id, [edge.source, edge.target]));
744
- }
745
- duplicateSequenceKeys.add(key);
746
- }
747
762
  for (const node of nodes) {
748
763
  const type = node.data.elementType;
749
- const incoming = countSequenceEdges(edges, node.id, "in");
750
- const outgoing = countSequenceEdges(edges, node.id, "out");
751
- const meta = BPMN_ELEMENT_CATALOG[type];
752
- if (type === "StartEvent" && incoming > 0) {
753
- issues.push(issue("bpmn/start-event-no-incoming", "error", "Start events cannot have incoming sequence flows.", node.id));
754
- }
755
- if (type === "EndEvent") {
756
- if (outgoing > 0) issues.push(issue("bpmn/no-outgoing-from-end-event", "error", "End events cannot have outgoing sequence flows.", node.id));
757
- if (incoming === 0) issues.push(issue("bpmn/end-event-has-incoming", "error", "End events should have at least one incoming sequence flow.", node.id));
758
- }
759
- if ((type === "IntermediateCatchEvent" || type === "IntermediateThrowEvent") && (incoming === 0 || outgoing === 0)) {
760
- issues.push(issue("bpmn/intermediate-event-both-flows", "error", "Intermediate events should have both incoming and outgoing sequence flows.", node.id));
761
- }
762
764
  if (type === "BoundaryEvent") {
763
765
  const hostId = node.data.attachedToRef ?? node.parentId;
764
766
  const host = hostId ? nodeById.get(hostId) : void 0;
765
767
  if (!host || !BPMN_ELEMENT_CATALOG[host.data.elementType]?.acceptsBoundaryEvents) {
766
- issues.push(issue("bpmn/boundary-event-attached", "error", "Boundary events must be attached to an activity or subprocess.", node.id, hostId ? [hostId] : void 0));
768
+ issues.push(
769
+ issue(
770
+ "bpmn/boundary-event-attached",
771
+ "error",
772
+ "Boundary events must be attached to an activity or subprocess.",
773
+ node.id,
774
+ hostId ? [hostId] : void 0
775
+ )
776
+ );
767
777
  }
768
778
  if (sequenceIn(edges, node.id).length > 0) {
769
- issues.push(issue("bpmn/boundary-no-incoming", "error", "Boundary events cannot have incoming sequence flows.", node.id));
770
- }
771
- if (sequenceOut(edges, node.id).length === 0) {
772
- issues.push(issue("bpmn/boundary-has-outgoing", "warning", "Boundary events should define an outgoing exception path.", node.id));
773
- }
774
- }
775
- if (isGatewayType(type)) {
776
- if (incoming === 0) issues.push(issue("bpmn/gateway-has-incoming", "error", "Gateways should have at least one incoming sequence flow.", node.id));
777
- if (outgoing === 0) issues.push(issue("bpmn/gateway-has-outgoing", "error", "Gateways should have at least one outgoing sequence flow.", node.id));
778
- }
779
- if (type === "ExclusiveGateway" || type === "InclusiveGateway" || type === "ComplexGateway") {
780
- const outgoingEdges = sequenceOut(edges, node.id);
781
- const defaults = outgoingEdges.filter((edge) => edge.data?.isDefault);
782
- if (defaults.length > 1) {
783
- issues.push(issue("bpmn/gateway-single-default", "error", "Gateways can have at most one default sequence flow.", node.id, defaults.map((edge) => edge.id)));
784
- }
785
- if (outgoingEdges.length >= 2) {
786
- for (const edge of outgoingEdges) {
787
- if (!edge.data?.isDefault && !edge.data?.conditionExpression) {
788
- issues.push(issue("bpmn/gateway-condition", "error", "Conditional gateway branches should have a condition or be marked as default.", edge.id, [node.id, edge.target]));
789
- }
790
- }
791
- }
792
- }
793
- if (type === "EventBasedGateway") {
794
- const outgoingEdges = edges.filter((edge) => edge.data?.edgeType === "sequenceFlow" && edge.source === node.id);
795
- if (outgoingEdges.length < 2) {
796
- issues.push(issue("bpmn/event-based-gateway-min-outgoing", "error", "Event-based gateways should have at least two outgoing sequence flows.", node.id));
797
- }
798
- for (const edge of outgoingEdges) {
799
- const target = nodeById.get(edge.target);
800
- if (target && !isCatchTarget(target.data.elementType)) {
801
- issues.push(issue("bpmn/event-based-gateway-valid-targets", "error", "Event-based gateways must target catch events or receive tasks.", edge.id, [node.id, target.id]));
802
- }
803
- }
804
- }
805
- if (meta.maxIncoming !== void 0 && incoming > meta.maxIncoming) {
806
- issues.push(issue("bpmn/max-incoming", "error", `${type} cannot have more than ${meta.maxIncoming} incoming sequence flow(s).`, node.id));
807
- }
808
- if (meta.maxOutgoing !== void 0 && outgoing > meta.maxOutgoing) {
809
- issues.push(issue("bpmn/max-outgoing", "error", `${type} cannot have more than ${meta.maxOutgoing} outgoing sequence flow(s).`, node.id));
810
- }
811
- if (opts.strictNames && (type.includes("Task") || isGatewayType(type)) && !node.data.label) {
812
- issues.push(issue("bpmn/name-required", "warning", `${type} should have a label.`, node.id));
813
- }
814
- if (isSubProcess(type)) {
815
- const childNodes = nodes.filter((child) => child.parentId === node.id);
816
- if (childNodes.length > 0) {
817
- if (!childNodes.some((child) => child.data.elementType === "StartEvent")) {
818
- issues.push(issue("bpmn/subprocess-has-start-end", "error", "Expanded subprocesses should contain a start event.", node.id));
819
- }
820
- if (!childNodes.some((child) => child.data.elementType === "EndEvent")) {
821
- issues.push(issue("bpmn/subprocess-has-start-end", "error", "Expanded subprocesses should contain an end event.", node.id));
822
- }
823
- }
824
- if (type === "EventSubProcess") {
825
- const starts = childNodes.filter((child) => child.data.elementType === "StartEvent");
826
- for (const start of starts) {
827
- if (!start.data.trigger || start.data.trigger === "none") {
828
- issues.push(issue("bpmn/event-subprocess-triggered-start", "error", "Event subprocess start events must define an event trigger.", start.id, [node.id]));
829
- }
830
- }
779
+ issues.push(
780
+ issue(
781
+ "bpmn/boundary-no-incoming",
782
+ "error",
783
+ "Boundary events cannot have incoming sequence flows.",
784
+ node.id
785
+ )
786
+ );
831
787
  }
832
788
  }
833
789
  if (type === "Lane") {