bpmn-moddle 9.0.2 → 9.0.3
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/LICENSE +20 -20
- package/README.md +72 -72
- package/dist/index.cjs +101 -102
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +101 -102
- package/dist/index.js.map +1 -1
- package/package.json +75 -75
- package/resources/bpmn/json/bpmn.json +2955 -2956
- package/resources/bpmn/xsd/BPMN20.xsd +36 -36
- package/resources/bpmn/xsd/BPMNDI.xsd +100 -100
- package/resources/bpmn/xsd/DC.xsd +29 -29
- package/resources/bpmn/xsd/DI.xsd +100 -100
- package/resources/bpmn/xsd/Semantic.xsd +1561 -1561
- package/dist/bpmn-moddle.umd.js +0 -7719
- package/dist/bpmn-moddle.umd.prod.js +0 -1
- package/dist/index.esm.js +0 -3747
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2014 camunda Services GmbH
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
|
13
|
-
all copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014 camunda Services GmbH
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
21
|
THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
# bpmn-moddle
|
|
2
|
-
|
|
3
|
-
[](https://github.com/bpmn-io/bpmn-moddle/actions?query=workflow%3ACI)
|
|
4
|
-
|
|
5
|
-
Read and write BPMN 2.0 diagram files in NodeJS and the browser.
|
|
6
|
-
|
|
7
|
-
__bpmn-moddle__ uses the [BPMN 2.0 meta-model](http://www.omg.org/spec/BPMN/2.0/) to validate the input and produce correct BPMN 2.0 XML.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
## Usage
|
|
11
|
-
|
|
12
|
-
Get the library via [npm package](https://www.npmjs.org/package/bpmn-moddle). Consume it in NodeJS, via UMD or bundle it using your favorite build tool.
|
|
13
|
-
|
|
14
|
-
```javascript
|
|
15
|
-
import BpmnModdle from 'bpmn-moddle';
|
|
16
|
-
|
|
17
|
-
const moddle = new BpmnModdle();
|
|
18
|
-
|
|
19
|
-
const xmlStr =
|
|
20
|
-
'<?xml version="1.0" encoding="UTF-8"?>' +
|
|
21
|
-
'<bpmn2:definitions xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" ' +
|
|
22
|
-
'id="empty-definitions" ' +
|
|
23
|
-
'targetNamespace="http://bpmn.io/schema/bpmn">' +
|
|
24
|
-
'</bpmn2:definitions>';
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const {
|
|
28
|
-
rootElement: definitions
|
|
29
|
-
} = await moddle.fromXML(xmlStr);
|
|
30
|
-
|
|
31
|
-
// update id attribute
|
|
32
|
-
definitions.set('id', 'NEW ID');
|
|
33
|
-
|
|
34
|
-
// add a root element
|
|
35
|
-
const bpmnProcess = moddle.create('bpmn:Process', { id: 'MyProcess_1' });
|
|
36
|
-
definitions.get('rootElements').push(bpmnProcess);
|
|
37
|
-
|
|
38
|
-
// xmlStrUpdated contains new id and the added process
|
|
39
|
-
const {
|
|
40
|
-
xml: xmlStrUpdated
|
|
41
|
-
} = await moddle.toXML(definitions);
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
## Resources
|
|
46
|
-
|
|
47
|
-
* [Issues](https://github.com/bpmn-io/bpmn-moddle/issues)
|
|
48
|
-
* [Examples](https://github.com/bpmn-io/bpmn-moddle/tree/master/test/spec/xml)
|
|
49
|
-
* [Changelog](./CHANGELOG.md)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
## Building the Project
|
|
53
|
-
|
|
54
|
-
The tests include XSD schema validation. They required you to have a Java SDK installed and exposed through the `JAVA_HOME` variable.
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
# execute the test
|
|
58
|
-
npm test
|
|
59
|
-
|
|
60
|
-
# perform a full build
|
|
61
|
-
npm run all
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
## Related
|
|
66
|
-
|
|
67
|
-
The library is built on top of [moddle](https://github.com/bpmn-io/moddle) and [moddle-xml](https://github.com/bpmn-io/moddle-xml).
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
## License
|
|
71
|
-
|
|
72
|
-
Use under the terms of the [MIT license](http://opensource.org/licenses/MIT).
|
|
1
|
+
# bpmn-moddle
|
|
2
|
+
|
|
3
|
+
[](https://github.com/bpmn-io/bpmn-moddle/actions?query=workflow%3ACI)
|
|
4
|
+
|
|
5
|
+
Read and write BPMN 2.0 diagram files in NodeJS and the browser.
|
|
6
|
+
|
|
7
|
+
__bpmn-moddle__ uses the [BPMN 2.0 meta-model](http://www.omg.org/spec/BPMN/2.0/) to validate the input and produce correct BPMN 2.0 XML.
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
Get the library via [npm package](https://www.npmjs.org/package/bpmn-moddle). Consume it in NodeJS, via UMD or bundle it using your favorite build tool.
|
|
13
|
+
|
|
14
|
+
```javascript
|
|
15
|
+
import BpmnModdle from 'bpmn-moddle';
|
|
16
|
+
|
|
17
|
+
const moddle = new BpmnModdle();
|
|
18
|
+
|
|
19
|
+
const xmlStr =
|
|
20
|
+
'<?xml version="1.0" encoding="UTF-8"?>' +
|
|
21
|
+
'<bpmn2:definitions xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" ' +
|
|
22
|
+
'id="empty-definitions" ' +
|
|
23
|
+
'targetNamespace="http://bpmn.io/schema/bpmn">' +
|
|
24
|
+
'</bpmn2:definitions>';
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
const {
|
|
28
|
+
rootElement: definitions
|
|
29
|
+
} = await moddle.fromXML(xmlStr);
|
|
30
|
+
|
|
31
|
+
// update id attribute
|
|
32
|
+
definitions.set('id', 'NEW ID');
|
|
33
|
+
|
|
34
|
+
// add a root element
|
|
35
|
+
const bpmnProcess = moddle.create('bpmn:Process', { id: 'MyProcess_1' });
|
|
36
|
+
definitions.get('rootElements').push(bpmnProcess);
|
|
37
|
+
|
|
38
|
+
// xmlStrUpdated contains new id and the added process
|
|
39
|
+
const {
|
|
40
|
+
xml: xmlStrUpdated
|
|
41
|
+
} = await moddle.toXML(definitions);
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
## Resources
|
|
46
|
+
|
|
47
|
+
* [Issues](https://github.com/bpmn-io/bpmn-moddle/issues)
|
|
48
|
+
* [Examples](https://github.com/bpmn-io/bpmn-moddle/tree/master/test/spec/xml)
|
|
49
|
+
* [Changelog](./CHANGELOG.md)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
## Building the Project
|
|
53
|
+
|
|
54
|
+
The tests include XSD schema validation. They required you to have a Java SDK installed and exposed through the `JAVA_HOME` variable.
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# execute the test
|
|
58
|
+
npm test
|
|
59
|
+
|
|
60
|
+
# perform a full build
|
|
61
|
+
npm run all
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
## Related
|
|
66
|
+
|
|
67
|
+
The library is built on top of [moddle](https://github.com/bpmn-io/moddle) and [moddle-xml](https://github.com/bpmn-io/moddle-xml).
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
## License
|
|
71
|
+
|
|
72
|
+
Use under the terms of the [MIT license](http://opensource.org/licenses/MIT).
|
package/dist/index.cjs
CHANGED
|
@@ -4,94 +4,94 @@ var minDash = require('min-dash');
|
|
|
4
4
|
var moddle = require('moddle');
|
|
5
5
|
var moddleXml = require('moddle-xml');
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* A sub class of {@link Moddle} with support for import and export of BPMN 2.0 xml files.
|
|
9
|
-
*
|
|
10
|
-
* @class BpmnModdle
|
|
11
|
-
* @extends Moddle
|
|
12
|
-
*
|
|
13
|
-
* @param {Object|Array} packages to use for instantiating the model
|
|
14
|
-
* @param {Object} [options] additional options to pass over
|
|
15
|
-
*/
|
|
16
|
-
function BpmnModdle(packages, options) {
|
|
17
|
-
moddle.Moddle.call(this, packages, options);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
BpmnModdle.prototype = Object.create(moddle.Moddle.prototype);
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* The fromXML result.
|
|
24
|
-
*
|
|
25
|
-
* @typedef {Object} ParseResult
|
|
26
|
-
*
|
|
27
|
-
* @property {ModdleElement} rootElement
|
|
28
|
-
* @property {Array<Object>} references
|
|
29
|
-
* @property {Array<Error>} warnings
|
|
30
|
-
* @property {Object} elementsById - a mapping containing each ID -> ModdleElement
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* The fromXML error.
|
|
35
|
-
*
|
|
36
|
-
* @typedef {Error} ParseError
|
|
37
|
-
*
|
|
38
|
-
* @property {Array<Error>} warnings
|
|
39
|
-
*/
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Instantiates a BPMN model tree from a given xml string.
|
|
43
|
-
*
|
|
44
|
-
* @param {String} xmlStr
|
|
45
|
-
* @param {String} [typeName='bpmn:Definitions'] name of the root element
|
|
46
|
-
* @param {Object} [options] options to pass to the underlying reader
|
|
47
|
-
*
|
|
48
|
-
* @returns {Promise<ParseResult, ParseError>}
|
|
49
|
-
*/
|
|
50
|
-
BpmnModdle.prototype.fromXML = function(xmlStr, typeName, options) {
|
|
51
|
-
|
|
52
|
-
if (!minDash.isString(typeName)) {
|
|
53
|
-
options = typeName;
|
|
54
|
-
typeName = 'bpmn:Definitions';
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
var reader = new moddleXml.Reader(minDash.assign({ model: this, lax: true }, options));
|
|
58
|
-
var rootHandler = reader.handler(typeName);
|
|
59
|
-
|
|
60
|
-
return reader.fromXML(xmlStr, rootHandler);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* The toXML result.
|
|
66
|
-
*
|
|
67
|
-
* @typedef {Object} SerializationResult
|
|
68
|
-
*
|
|
69
|
-
* @property {String} xml
|
|
70
|
-
*/
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Serializes a BPMN 2.0 object tree to XML.
|
|
74
|
-
*
|
|
75
|
-
* @param {String} element the root element, typically an instance of `bpmn:Definitions`
|
|
76
|
-
* @param {Object} [options] to pass to the underlying writer
|
|
77
|
-
*
|
|
78
|
-
* @returns {Promise<SerializationResult, Error>}
|
|
79
|
-
*/
|
|
80
|
-
BpmnModdle.prototype.toXML = function(element, options) {
|
|
81
|
-
|
|
82
|
-
var writer = new moddleXml.Writer(options);
|
|
83
|
-
|
|
84
|
-
return new Promise(function(resolve, reject) {
|
|
85
|
-
try {
|
|
86
|
-
var result = writer.toXML(element);
|
|
87
|
-
|
|
88
|
-
return resolve({
|
|
89
|
-
xml: result
|
|
90
|
-
});
|
|
91
|
-
} catch (err) {
|
|
92
|
-
return reject(err);
|
|
93
|
-
}
|
|
94
|
-
});
|
|
7
|
+
/**
|
|
8
|
+
* A sub class of {@link Moddle} with support for import and export of BPMN 2.0 xml files.
|
|
9
|
+
*
|
|
10
|
+
* @class BpmnModdle
|
|
11
|
+
* @extends Moddle
|
|
12
|
+
*
|
|
13
|
+
* @param {Object|Array} packages to use for instantiating the model
|
|
14
|
+
* @param {Object} [options] additional options to pass over
|
|
15
|
+
*/
|
|
16
|
+
function BpmnModdle(packages, options) {
|
|
17
|
+
moddle.Moddle.call(this, packages, options);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
BpmnModdle.prototype = Object.create(moddle.Moddle.prototype);
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The fromXML result.
|
|
24
|
+
*
|
|
25
|
+
* @typedef {Object} ParseResult
|
|
26
|
+
*
|
|
27
|
+
* @property {ModdleElement} rootElement
|
|
28
|
+
* @property {Array<Object>} references
|
|
29
|
+
* @property {Array<Error>} warnings
|
|
30
|
+
* @property {Object} elementsById - a mapping containing each ID -> ModdleElement
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The fromXML error.
|
|
35
|
+
*
|
|
36
|
+
* @typedef {Error} ParseError
|
|
37
|
+
*
|
|
38
|
+
* @property {Array<Error>} warnings
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Instantiates a BPMN model tree from a given xml string.
|
|
43
|
+
*
|
|
44
|
+
* @param {String} xmlStr
|
|
45
|
+
* @param {String} [typeName='bpmn:Definitions'] name of the root element
|
|
46
|
+
* @param {Object} [options] options to pass to the underlying reader
|
|
47
|
+
*
|
|
48
|
+
* @returns {Promise<ParseResult, ParseError>}
|
|
49
|
+
*/
|
|
50
|
+
BpmnModdle.prototype.fromXML = function(xmlStr, typeName, options) {
|
|
51
|
+
|
|
52
|
+
if (!minDash.isString(typeName)) {
|
|
53
|
+
options = typeName;
|
|
54
|
+
typeName = 'bpmn:Definitions';
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
var reader = new moddleXml.Reader(minDash.assign({ model: this, lax: true }, options));
|
|
58
|
+
var rootHandler = reader.handler(typeName);
|
|
59
|
+
|
|
60
|
+
return reader.fromXML(xmlStr, rootHandler);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The toXML result.
|
|
66
|
+
*
|
|
67
|
+
* @typedef {Object} SerializationResult
|
|
68
|
+
*
|
|
69
|
+
* @property {String} xml
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Serializes a BPMN 2.0 object tree to XML.
|
|
74
|
+
*
|
|
75
|
+
* @param {String} element the root element, typically an instance of `bpmn:Definitions`
|
|
76
|
+
* @param {Object} [options] to pass to the underlying writer
|
|
77
|
+
*
|
|
78
|
+
* @returns {Promise<SerializationResult, Error>}
|
|
79
|
+
*/
|
|
80
|
+
BpmnModdle.prototype.toXML = function(element, options) {
|
|
81
|
+
|
|
82
|
+
var writer = new moddleXml.Writer(options);
|
|
83
|
+
|
|
84
|
+
return new Promise(function(resolve, reject) {
|
|
85
|
+
try {
|
|
86
|
+
var result = writer.toXML(element);
|
|
87
|
+
|
|
88
|
+
return resolve({
|
|
89
|
+
xml: result
|
|
90
|
+
});
|
|
91
|
+
} catch (err) {
|
|
92
|
+
return reject(err);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
95
|
};
|
|
96
96
|
|
|
97
97
|
var name$5 = "BPMN20";
|
|
@@ -2695,7 +2695,6 @@ var types$5 = [
|
|
|
2695
2695
|
},
|
|
2696
2696
|
{
|
|
2697
2697
|
name: "cancelRemainingInstances",
|
|
2698
|
-
"default": true,
|
|
2699
2698
|
isAttr: true,
|
|
2700
2699
|
type: "Boolean"
|
|
2701
2700
|
}
|
|
@@ -3729,19 +3728,19 @@ var BpmnInColorPackage = {
|
|
|
3729
3728
|
associations: associations
|
|
3730
3729
|
};
|
|
3731
3730
|
|
|
3732
|
-
const packages = {
|
|
3733
|
-
bpmn: BpmnPackage,
|
|
3734
|
-
bpmndi: BpmnDiPackage,
|
|
3735
|
-
dc: DcPackage,
|
|
3736
|
-
di: DiPackage,
|
|
3737
|
-
bioc: BiocPackage,
|
|
3738
|
-
color: BpmnInColorPackage
|
|
3739
|
-
};
|
|
3740
|
-
|
|
3741
|
-
function SimpleBpmnModdle(additionalPackages, options) {
|
|
3742
|
-
const pks = minDash.assign({}, packages, additionalPackages);
|
|
3743
|
-
|
|
3744
|
-
return new BpmnModdle(pks, options);
|
|
3731
|
+
const packages = {
|
|
3732
|
+
bpmn: BpmnPackage,
|
|
3733
|
+
bpmndi: BpmnDiPackage,
|
|
3734
|
+
dc: DcPackage,
|
|
3735
|
+
di: DiPackage,
|
|
3736
|
+
bioc: BiocPackage,
|
|
3737
|
+
color: BpmnInColorPackage
|
|
3738
|
+
};
|
|
3739
|
+
|
|
3740
|
+
function SimpleBpmnModdle(additionalPackages, options) {
|
|
3741
|
+
const pks = minDash.assign({}, packages, additionalPackages);
|
|
3742
|
+
|
|
3743
|
+
return new BpmnModdle(pks, options);
|
|
3745
3744
|
}
|
|
3746
3745
|
|
|
3747
3746
|
module.exports = SimpleBpmnModdle;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../lib/bpmn-moddle.js","../lib/simple.js"],"sourcesContent":["import {\n isString,\n assign\n} from 'min-dash';\n\nimport {\n Moddle\n} from 'moddle';\n\nimport {\n Reader,\n Writer\n} from 'moddle-xml';\n\n\n/**\n * A sub class of {@link Moddle} with support for import and export of BPMN 2.0 xml files.\n *\n * @class BpmnModdle\n * @extends Moddle\n *\n * @param {Object|Array} packages to use for instantiating the model\n * @param {Object} [options] additional options to pass over\n */\nexport default function BpmnModdle(packages, options) {\n Moddle.call(this, packages, options);\n}\n\nBpmnModdle.prototype = Object.create(Moddle.prototype);\n\n/**\n * The fromXML result.\n *\n * @typedef {Object} ParseResult\n *\n * @property {ModdleElement} rootElement\n * @property {Array<Object>} references\n * @property {Array<Error>} warnings\n * @property {Object} elementsById - a mapping containing each ID -> ModdleElement\n */\n\n/**\n * The fromXML error.\n *\n * @typedef {Error} ParseError\n *\n * @property {Array<Error>} warnings\n */\n\n/**\n * Instantiates a BPMN model tree from a given xml string.\n *\n * @param {String} xmlStr\n * @param {String} [typeName='bpmn:Definitions'] name of the root element\n * @param {Object} [options] options to pass to the underlying reader\n *\n * @returns {Promise<ParseResult, ParseError>}\n */\nBpmnModdle.prototype.fromXML = function(xmlStr, typeName, options) {\n\n if (!isString(typeName)) {\n options = typeName;\n typeName = 'bpmn:Definitions';\n }\n\n var reader = new Reader(assign({ model: this, lax: true }, options));\n var rootHandler = reader.handler(typeName);\n\n return reader.fromXML(xmlStr, rootHandler);\n};\n\n\n/**\n * The toXML result.\n *\n * @typedef {Object} SerializationResult\n *\n * @property {String} xml\n */\n\n/**\n * Serializes a BPMN 2.0 object tree to XML.\n *\n * @param {String} element the root element, typically an instance of `bpmn:Definitions`\n * @param {Object} [options] to pass to the underlying writer\n *\n * @returns {Promise<SerializationResult, Error>}\n */\nBpmnModdle.prototype.toXML = function(element, options) {\n\n var writer = new Writer(options);\n\n return new Promise(function(resolve, reject) {\n try {\n var result = writer.toXML(element);\n\n return resolve({\n xml: result\n });\n } catch (err) {\n return reject(err);\n }\n });\n};\n","import {\n assign\n} from 'min-dash';\n\nimport BpmnModdle from './bpmn-moddle.js';\n\nimport BpmnPackage from '../resources/bpmn/json/bpmn.json' with { type: 'json' };\nimport BpmnDiPackage from '../resources/bpmn/json/bpmndi.json' with { type: 'json' };\nimport DcPackage from '../resources/bpmn/json/dc.json' with { type: 'json' };\nimport DiPackage from '../resources/bpmn/json/di.json' with { type: 'json' };\nimport BiocPackage from '../resources/bpmn-io/json/bioc.json' with { type: 'json' };\nimport BpmnInColorPackage from 'bpmn-in-color-moddle/resources/bpmn-in-color.json' with { type: 'json' };\n\nconst packages = {\n bpmn: BpmnPackage,\n bpmndi: BpmnDiPackage,\n dc: DcPackage,\n di: DiPackage,\n bioc: BiocPackage,\n color: BpmnInColorPackage\n};\n\nexport default function SimpleBpmnModdle(additionalPackages, options) {\n const pks = assign({}, packages, additionalPackages);\n\n return new BpmnModdle(pks, options);\n}\n"],"names":["Moddle","isString","Reader","assign","Writer"],"mappings":";;;;;;AAeA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAAS,UAAU,CAAC,QAAQ,EAAE,OAAO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AAG,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AACzC;AACA,MAAM,OAAO,OAAO,CAAC;AACrB,QAAQ,GAAG,EAAE,MAAM;AACnB,OAAO,CAAC,CAAC;AACT,KAAK,CAAC,OAAO,GAAG,EAAE;AAClB,MAAM,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;AACzB,KAAK;AACL,GAAG,CAAC,CAAC;AACL,CAAC
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../lib/bpmn-moddle.js","../lib/simple.js"],"sourcesContent":["import {\r\n isString,\r\n assign\r\n} from 'min-dash';\r\n\r\nimport {\r\n Moddle\r\n} from 'moddle';\r\n\r\nimport {\r\n Reader,\r\n Writer\r\n} from 'moddle-xml';\r\n\r\n\r\n/**\r\n * A sub class of {@link Moddle} with support for import and export of BPMN 2.0 xml files.\r\n *\r\n * @class BpmnModdle\r\n * @extends Moddle\r\n *\r\n * @param {Object|Array} packages to use for instantiating the model\r\n * @param {Object} [options] additional options to pass over\r\n */\r\nexport default function BpmnModdle(packages, options) {\r\n Moddle.call(this, packages, options);\r\n}\r\n\r\nBpmnModdle.prototype = Object.create(Moddle.prototype);\r\n\r\n/**\r\n * The fromXML result.\r\n *\r\n * @typedef {Object} ParseResult\r\n *\r\n * @property {ModdleElement} rootElement\r\n * @property {Array<Object>} references\r\n * @property {Array<Error>} warnings\r\n * @property {Object} elementsById - a mapping containing each ID -> ModdleElement\r\n */\r\n\r\n/**\r\n * The fromXML error.\r\n *\r\n * @typedef {Error} ParseError\r\n *\r\n * @property {Array<Error>} warnings\r\n */\r\n\r\n/**\r\n * Instantiates a BPMN model tree from a given xml string.\r\n *\r\n * @param {String} xmlStr\r\n * @param {String} [typeName='bpmn:Definitions'] name of the root element\r\n * @param {Object} [options] options to pass to the underlying reader\r\n *\r\n * @returns {Promise<ParseResult, ParseError>}\r\n */\r\nBpmnModdle.prototype.fromXML = function(xmlStr, typeName, options) {\r\n\r\n if (!isString(typeName)) {\r\n options = typeName;\r\n typeName = 'bpmn:Definitions';\r\n }\r\n\r\n var reader = new Reader(assign({ model: this, lax: true }, options));\r\n var rootHandler = reader.handler(typeName);\r\n\r\n return reader.fromXML(xmlStr, rootHandler);\r\n};\r\n\r\n\r\n/**\r\n * The toXML result.\r\n *\r\n * @typedef {Object} SerializationResult\r\n *\r\n * @property {String} xml\r\n */\r\n\r\n/**\r\n * Serializes a BPMN 2.0 object tree to XML.\r\n *\r\n * @param {String} element the root element, typically an instance of `bpmn:Definitions`\r\n * @param {Object} [options] to pass to the underlying writer\r\n *\r\n * @returns {Promise<SerializationResult, Error>}\r\n */\r\nBpmnModdle.prototype.toXML = function(element, options) {\r\n\r\n var writer = new Writer(options);\r\n\r\n return new Promise(function(resolve, reject) {\r\n try {\r\n var result = writer.toXML(element);\r\n\r\n return resolve({\r\n xml: result\r\n });\r\n } catch (err) {\r\n return reject(err);\r\n }\r\n });\r\n};\r\n","import {\r\n assign\r\n} from 'min-dash';\r\n\r\nimport BpmnModdle from './bpmn-moddle.js';\r\n\r\nimport BpmnPackage from '../resources/bpmn/json/bpmn.json' with { type: 'json' };\r\nimport BpmnDiPackage from '../resources/bpmn/json/bpmndi.json' with { type: 'json' };\r\nimport DcPackage from '../resources/bpmn/json/dc.json' with { type: 'json' };\r\nimport DiPackage from '../resources/bpmn/json/di.json' with { type: 'json' };\r\nimport BiocPackage from '../resources/bpmn-io/json/bioc.json' with { type: 'json' };\r\nimport BpmnInColorPackage from 'bpmn-in-color-moddle/resources/bpmn-in-color.json' with { type: 'json' };\r\n\r\nconst packages = {\r\n bpmn: BpmnPackage,\r\n bpmndi: BpmnDiPackage,\r\n dc: DcPackage,\r\n di: DiPackage,\r\n bioc: BiocPackage,\r\n color: BpmnInColorPackage\r\n};\r\n\r\nexport default function SimpleBpmnModdle(additionalPackages, options) {\r\n const pks = assign({}, packages, additionalPackages);\r\n\r\n return new BpmnModdle(pks, options);\r\n}\r\n"],"names":["Moddle","isString","Reader","assign","Writer"],"mappings":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