json-to-bpmn-xml 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 +49 -8
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -18,28 +18,69 @@ npm install json-to-bpmn-xml
|
|
|
18
18
|
## USAGE
|
|
19
19
|
|
|
20
20
|
```typescript
|
|
21
|
-
import { convert } from "json-to-bpmn-xml";
|
|
21
|
+
import { convert, type ProcessModel } from "json-to-bpmn-xml";
|
|
22
22
|
|
|
23
|
-
const model = {
|
|
23
|
+
const model: ProcessModel = {
|
|
24
24
|
id: "process_1",
|
|
25
25
|
name: "Simple Process",
|
|
26
26
|
nodes: [
|
|
27
27
|
{ id: "start", type: "start" },
|
|
28
28
|
{ id: "task1", type: "userTask", name: "Do something" },
|
|
29
|
-
{ id: "end", type: "end" }
|
|
29
|
+
{ id: "end", type: "end" },
|
|
30
30
|
],
|
|
31
31
|
edges: [
|
|
32
32
|
{ id: "e1", source: "start", target: "task1" },
|
|
33
|
-
{ id: "e2", source: "task1", target: "end" }
|
|
34
|
-
]
|
|
33
|
+
{ id: "e2", source: "task1", target: "end" },
|
|
34
|
+
],
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
const xml = await convert(model);
|
|
38
|
+
```
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
### OUTPUT
|
|
41
|
+
|
|
42
|
+
```xml
|
|
43
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
44
|
+
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="process_1_definitions" targetNamespace="http://bpmn.io/schema/bpmn" $attrs="[object Object]">
|
|
45
|
+
<bpmn:process id="process_1" name="Simple Process" isExecutable="false">
|
|
46
|
+
<bpmn:startEvent id="start">
|
|
47
|
+
<bpmn:outgoing>e1</bpmn:outgoing>
|
|
48
|
+
</bpmn:startEvent>
|
|
49
|
+
<bpmn:userTask id="task1" name="Do something">
|
|
50
|
+
<bpmn:incoming>e1</bpmn:incoming>
|
|
51
|
+
<bpmn:outgoing>e2</bpmn:outgoing>
|
|
52
|
+
</bpmn:userTask>
|
|
53
|
+
<bpmn:endEvent id="end">
|
|
54
|
+
<bpmn:incoming>e2</bpmn:incoming>
|
|
55
|
+
</bpmn:endEvent>
|
|
56
|
+
<bpmn:sequenceFlow id="e1" sourceRef="start" targetRef="task1"/>
|
|
57
|
+
<bpmn:sequenceFlow id="e2" sourceRef="task1" targetRef="end"/>
|
|
58
|
+
</bpmn:process>
|
|
59
|
+
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
|
|
60
|
+
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="process_1">
|
|
61
|
+
<bpmndi:BPMNShape id="start_di" bpmnElement="start">
|
|
62
|
+
<dc:Bounds x="12" y="34" width="36" height="36"/>
|
|
63
|
+
</bpmndi:BPMNShape>
|
|
64
|
+
<bpmndi:BPMNShape id="task1_di" bpmnElement="task1">
|
|
65
|
+
<dc:Bounds x="168" y="12" width="100" height="80"/>
|
|
66
|
+
</bpmndi:BPMNShape>
|
|
67
|
+
<bpmndi:BPMNShape id="end_di" bpmnElement="end">
|
|
68
|
+
<dc:Bounds x="388" y="34" width="36" height="36"/>
|
|
69
|
+
</bpmndi:BPMNShape>
|
|
70
|
+
<bpmndi:BPMNEdge id="e1_di" bpmnElement="e1">
|
|
71
|
+
<di:waypoint x="48" y="52"/>
|
|
72
|
+
<di:waypoint x="168" y="52"/>
|
|
73
|
+
</bpmndi:BPMNEdge>
|
|
74
|
+
<bpmndi:BPMNEdge id="e2_di" bpmnElement="e2">
|
|
75
|
+
<di:waypoint x="268" y="52"/>
|
|
76
|
+
<di:waypoint x="388" y="52"/>
|
|
77
|
+
</bpmndi:BPMNEdge>
|
|
78
|
+
</bpmndi:BPMNPlane>
|
|
79
|
+
</bpmndi:BPMNDiagram>
|
|
80
|
+
</bpmn:definitions>
|
|
40
81
|
```
|
|
41
82
|
|
|
42
|
-
## ProcessModel
|
|
83
|
+
## ProcessModel
|
|
43
84
|
|
|
44
85
|
```typescript
|
|
45
86
|
type ProcessModel = {
|
|
@@ -64,4 +105,4 @@ This library is built on top of [bpmn-moddle](https://github.com/bpmn-io/bpmn-mo
|
|
|
64
105
|
|
|
65
106
|
## License
|
|
66
107
|
|
|
67
|
-
Use under the terms of the [Apache-2.0](https://opensource.org/license/Apache-2.0).
|
|
108
|
+
Use under the terms of the [Apache-2.0](https://opensource.org/license/Apache-2.0).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "json-to-bpmn-xml",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "JSON to BPMN XML converter",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"bpmn-moddle": "^10.0.0",
|
|
31
31
|
"dagre": "^0.8.5",
|
|
32
32
|
"elkjs": "^0.11.1",
|
|
33
|
+
"json-to-bpmn-xml": "^1.0.0",
|
|
33
34
|
"xml-formatter": "^3.7.0"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
@@ -39,4 +40,4 @@
|
|
|
39
40
|
"typescript": "^6.0.3",
|
|
40
41
|
"vitest": "^4.1.9"
|
|
41
42
|
}
|
|
42
|
-
}
|
|
43
|
+
}
|