bpmn-elk-layout 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +164 -0
- package/package.json +17 -5
package/README.md
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# bpmn-elk-layout
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/bpmn-elk-layout)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
Convert ELK-BPMN JSON to standard BPMN 2.0 XML with automatic layout calculation.
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
ELK-BPMN JSON (AI-generated) → elkjs layout → BPMN 2.0 XML (with DI) → bpmn.io/Camunda
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Features
|
|
13
|
+
|
|
14
|
+
- 🎯 **Automatic Layout** - No manual coordinate calculation needed
|
|
15
|
+
- 🔄 **Full BPMN 2.0 Support** - Events, tasks, gateways, subprocesses, swimlanes
|
|
16
|
+
- 📐 **Smart Edge Routing** - Clean perpendicular connections with no overlaps
|
|
17
|
+
- 🏊 **Swimlane Support** - Pools, lanes, and collaborations
|
|
18
|
+
- 🛠️ **CLI & Library** - Use programmatically or from command line
|
|
19
|
+
- 📦 **Dual Format** - Works in both Node.js and browser environments
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install bpmn-elk-layout
|
|
25
|
+
# or
|
|
26
|
+
yarn add bpmn-elk-layout
|
|
27
|
+
# or
|
|
28
|
+
pnpm add bpmn-elk-layout
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Quick Start
|
|
32
|
+
|
|
33
|
+
### As a Library
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
import { BpmnElkLayout } from 'bpmn-elk-layout';
|
|
37
|
+
|
|
38
|
+
const converter = new BpmnElkLayout();
|
|
39
|
+
|
|
40
|
+
// Convert to BPMN XML
|
|
41
|
+
const xml = await converter.to_bpmn(elkBpmnJson);
|
|
42
|
+
|
|
43
|
+
// Or get layouted JSON with coordinates
|
|
44
|
+
const layouted = await converter.to_json(elkBpmnJson);
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### CLI
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Convert to BPMN XML
|
|
51
|
+
npx bpmn-elk-layout convert input.json -f bpmn -o output.bpmn
|
|
52
|
+
|
|
53
|
+
# Convert to layouted JSON
|
|
54
|
+
npx bpmn-elk-layout convert input.json -f json -o output.json
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Input Format (ELK-BPMN JSON)
|
|
58
|
+
|
|
59
|
+
The input is standard ELK JSON extended with a `bpmn` field for BPMN semantics:
|
|
60
|
+
|
|
61
|
+
```json
|
|
62
|
+
{
|
|
63
|
+
"id": "definitions",
|
|
64
|
+
"children": [{
|
|
65
|
+
"id": "process_1",
|
|
66
|
+
"bpmn": { "type": "process", "name": "My Process" },
|
|
67
|
+
"children": [
|
|
68
|
+
{
|
|
69
|
+
"id": "start",
|
|
70
|
+
"bpmn": { "type": "startEvent", "name": "Start" }
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"id": "task_1",
|
|
74
|
+
"bpmn": { "type": "userTask", "name": "Review Request" }
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"id": "end",
|
|
78
|
+
"bpmn": { "type": "endEvent", "name": "End" }
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
"edges": [
|
|
82
|
+
{ "id": "flow_1", "sources": ["start"], "targets": ["task_1"] },
|
|
83
|
+
{ "id": "flow_2", "sources": ["task_1"], "targets": ["end"] }
|
|
84
|
+
]
|
|
85
|
+
}]
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## BPMN 2.0 Coverage
|
|
90
|
+
|
|
91
|
+
### Events
|
|
92
|
+
- Start/End/Intermediate events (catch & throw)
|
|
93
|
+
- Boundary events (interrupting & non-interrupting)
|
|
94
|
+
- Event definitions: None, Message, Timer, Error, Escalation, Cancel, Compensation, Conditional, Link, Signal, Terminate, Multiple, ParallelMultiple
|
|
95
|
+
|
|
96
|
+
### Activities
|
|
97
|
+
- Tasks: User, Service, Script, Business Rule, Send, Receive, Manual
|
|
98
|
+
- SubProcesses: Embedded, Event, Transaction, Ad-hoc
|
|
99
|
+
- Call Activity with parameter mapping
|
|
100
|
+
- Loop & Multi-instance (parallel/sequential)
|
|
101
|
+
|
|
102
|
+
### Gateways
|
|
103
|
+
- Exclusive, Parallel, Inclusive, Event-based, Complex
|
|
104
|
+
- Default flow support
|
|
105
|
+
|
|
106
|
+
### Data & Artifacts
|
|
107
|
+
- Data Object, Data Store, Data Input/Output
|
|
108
|
+
- Text Annotation, Group
|
|
109
|
+
- Data Association
|
|
110
|
+
|
|
111
|
+
### Swimlanes
|
|
112
|
+
- Participant/Pool (including black-box)
|
|
113
|
+
- Lane (with nesting support)
|
|
114
|
+
- Collaboration with Message Flows
|
|
115
|
+
|
|
116
|
+
## Node.js Usage
|
|
117
|
+
|
|
118
|
+
For Node.js environments with better performance using native ELK:
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
import { BpmnElkLayout } from 'bpmn-elk-layout/node';
|
|
122
|
+
|
|
123
|
+
const converter = new BpmnElkLayout();
|
|
124
|
+
const xml = await converter.to_bpmn(elkBpmnJson);
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## API Reference
|
|
128
|
+
|
|
129
|
+
### `BpmnElkLayout`
|
|
130
|
+
|
|
131
|
+
#### `to_bpmn(json: ElkBpmnGraph): Promise<string>`
|
|
132
|
+
|
|
133
|
+
Converts ELK-BPMN JSON to BPMN 2.0 XML string with diagram interchange (DI) information.
|
|
134
|
+
|
|
135
|
+
#### `to_json(json: ElkBpmnGraph): Promise<LayoutedGraph>`
|
|
136
|
+
|
|
137
|
+
Converts ELK-BPMN JSON to layouted JSON with calculated x, y coordinates.
|
|
138
|
+
|
|
139
|
+
## How It Works
|
|
140
|
+
|
|
141
|
+
1. **Parse** - Read ELK-BPMN JSON input
|
|
142
|
+
2. **Prepare** - Convert to ELK graph format with BPMN constraints
|
|
143
|
+
3. **Layout** - Run elkjs layout engine for automatic positioning
|
|
144
|
+
4. **Post-process** - Apply BPMN-specific adjustments (boundary events, lanes, etc.)
|
|
145
|
+
5. **Generate** - Output BPMN 2.0 XML with diagram information
|
|
146
|
+
|
|
147
|
+
## Dependencies
|
|
148
|
+
|
|
149
|
+
- [elkjs](https://github.com/kieler/elkjs) - Graph layout engine
|
|
150
|
+
- [bpmn-moddle](https://github.com/bpmn-io/bpmn-moddle) - BPMN XML serialization
|
|
151
|
+
|
|
152
|
+
## Requirements
|
|
153
|
+
|
|
154
|
+
- Node.js >= 18.0.0
|
|
155
|
+
|
|
156
|
+
## License
|
|
157
|
+
|
|
158
|
+
MIT
|
|
159
|
+
|
|
160
|
+
## Links
|
|
161
|
+
|
|
162
|
+
- [GitHub Repository](https://github.com/LcpMarvel/bpmn-elk-layout)
|
|
163
|
+
- [Issue Tracker](https://github.com/LcpMarvel/bpmn-elk-layout/issues)
|
|
164
|
+
- [ELK-BPMN JSON Schema](https://github.com/LcpMarvel/bpmn-elk-layout/blob/master/elk-bpmn-schema.json)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bpmn-elk-layout",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Convert ELK-BPMN JSON to BPMN 2.0 XML with automatic layout",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Convert ELK-BPMN JSON to BPMN 2.0 XML with automatic layout calculation. Supports all BPMN 2.0 elements including events, tasks, gateways, subprocesses, and swimlanes.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -49,17 +49,29 @@
|
|
|
49
49
|
},
|
|
50
50
|
"keywords": [
|
|
51
51
|
"bpmn",
|
|
52
|
+
"bpmn2",
|
|
53
|
+
"bpmn-io",
|
|
52
54
|
"elk",
|
|
55
|
+
"elkjs",
|
|
53
56
|
"layout",
|
|
57
|
+
"auto-layout",
|
|
54
58
|
"converter",
|
|
55
59
|
"workflow",
|
|
56
60
|
"process",
|
|
57
|
-
"diagram"
|
|
61
|
+
"diagram",
|
|
62
|
+
"graph",
|
|
63
|
+
"flowchart",
|
|
64
|
+
"camunda",
|
|
65
|
+
"process-automation"
|
|
58
66
|
],
|
|
59
|
-
"author": "",
|
|
67
|
+
"author": "LcpMarvel",
|
|
60
68
|
"license": "MIT",
|
|
61
69
|
"repository": {
|
|
62
70
|
"type": "git",
|
|
63
|
-
"url": ""
|
|
71
|
+
"url": "git+https://github.com/LcpMarvel/bpmn-elk-layout.git"
|
|
72
|
+
},
|
|
73
|
+
"homepage": "https://github.com/LcpMarvel/bpmn-elk-layout#readme",
|
|
74
|
+
"bugs": {
|
|
75
|
+
"url": "https://github.com/LcpMarvel/bpmn-elk-layout/issues"
|
|
64
76
|
}
|
|
65
77
|
}
|