bpmnlint 10.3.1 → 11.1.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.
- package/README.md +2 -0
- package/config/all.js +1 -0
- package/config/recommended.js +1 -0
- package/lib/resolver/node-resolver.js +1 -14
- package/lib/test-rule.js +7 -4
- package/package.json +11 -12
- package/rules/ad-hoc-sub-process.js +45 -0
- package/rules/no-bpmndi.js +2 -2
- package/rules/no-overlapping-elements.js +9 -1
package/README.md
CHANGED
package/config/all.js
CHANGED
package/config/recommended.js
CHANGED
|
@@ -117,18 +117,5 @@ NodeResolver.prototype.normalizePkg = function(pkg) {
|
|
|
117
117
|
// helpers ////////////////////
|
|
118
118
|
|
|
119
119
|
function createScopedRequire(cwd) {
|
|
120
|
-
|
|
121
|
-
// shim createRequireFromPath for Node < 10.12
|
|
122
|
-
// shim createRequireFromPath for Node < 12.2.0
|
|
123
|
-
const createRequireFromPath = Module.createRequire || Module.createRequireFromPath || (filename => {
|
|
124
|
-
const mod = new Module(filename, null);
|
|
125
|
-
|
|
126
|
-
mod.filename = filename;
|
|
127
|
-
mod.paths = Module._nodeModulePaths(path.dirname(filename));
|
|
128
|
-
mod._compile('module.exports = require;', filename);
|
|
129
|
-
|
|
130
|
-
return mod.exports;
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
return createRequireFromPath(path.join(cwd, '__placeholder__.js'));
|
|
120
|
+
return Module.createRequire(path.join(cwd, '__placeholder__.js'));
|
|
134
121
|
}
|
package/lib/test-rule.js
CHANGED
|
@@ -2,7 +2,8 @@ const traverse = require('./traverse');
|
|
|
2
2
|
|
|
3
3
|
const {
|
|
4
4
|
isArray,
|
|
5
|
-
isObject
|
|
5
|
+
isObject,
|
|
6
|
+
isFunction
|
|
6
7
|
} = require('min-dash');
|
|
7
8
|
|
|
8
9
|
|
|
@@ -57,10 +58,12 @@ class Reporter {
|
|
|
57
58
|
module.exports = function testRule({ moddleRoot, rule }) {
|
|
58
59
|
const reporter = new Reporter({ rule, moddleRoot });
|
|
59
60
|
|
|
60
|
-
const check = rule.check;
|
|
61
|
+
const check = rule.check || {};
|
|
61
62
|
|
|
62
|
-
const
|
|
63
|
-
const
|
|
63
|
+
const leave = 'leave' in check ? check.leave : undefined;
|
|
64
|
+
const enter = 'enter' in check ? check.enter : (
|
|
65
|
+
isFunction(check) ? check : undefined
|
|
66
|
+
);
|
|
64
67
|
|
|
65
68
|
if (!enter && !leave) {
|
|
66
69
|
throw new Error('no check implemented');
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bpmnlint",
|
|
3
3
|
"description": "Validate your BPMN diagrams based on configurable lint rules",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "11.1.0",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"bpmnlint",
|
|
@@ -23,12 +23,12 @@
|
|
|
23
23
|
}
|
|
24
24
|
],
|
|
25
25
|
"engines": {
|
|
26
|
-
"node": ">=
|
|
26
|
+
"node": ">= 20"
|
|
27
27
|
},
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"scripts": {
|
|
30
30
|
"all": "run-s lint test-coverage",
|
|
31
|
-
"lint": "eslint .
|
|
31
|
+
"lint": "eslint .",
|
|
32
32
|
"dev": "npm test -- --watch",
|
|
33
33
|
"test": "mocha --exclude 'test/integration/*/**' 'test/**/*.*js'",
|
|
34
34
|
"test-coverage": "nyc --reporter=lcov --reporter=html npm test",
|
|
@@ -40,26 +40,25 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@bpmn-io/moddle-utils": "^0.2.1",
|
|
42
42
|
"ansi-colors": "^4.1.3",
|
|
43
|
-
"bpmn-moddle": "^
|
|
43
|
+
"bpmn-moddle": "^9.0.1",
|
|
44
44
|
"bpmnlint-utils": "^1.1.1",
|
|
45
45
|
"cli-table": "^0.3.11",
|
|
46
46
|
"color-support": "^1.1.3",
|
|
47
|
-
"min-dash": "^4.2.
|
|
47
|
+
"min-dash": "^4.2.2",
|
|
48
48
|
"mri": "^1.2.0",
|
|
49
49
|
"pluralize": "^7.0.0",
|
|
50
50
|
"tiny-glob": "^0.2.9"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@bpmn-io/bpmnlint-generate-docs-images": "^0.4.0",
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"eslint": "^
|
|
57
|
-
"
|
|
58
|
-
"execa": "^8.0.1",
|
|
54
|
+
"chai": "^4.5.0",
|
|
55
|
+
"eslint": "^9.17.0",
|
|
56
|
+
"eslint-plugin-bpmn-io": "^2.0.2",
|
|
57
|
+
"execa": "^9.5.2",
|
|
59
58
|
"install-local": "^3.0.1",
|
|
60
|
-
"mocha": "^
|
|
59
|
+
"mocha": "^11.0.1",
|
|
61
60
|
"npm-run-all": "^4.1.5",
|
|
62
|
-
"nyc": "^
|
|
61
|
+
"nyc": "^17.1.0",
|
|
63
62
|
"strip-indent": "^3.0.0"
|
|
64
63
|
},
|
|
65
64
|
"files": [
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const {
|
|
2
|
+
is,
|
|
3
|
+
isAny
|
|
4
|
+
} = require('bpmnlint-utils');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A rule that ensures that an Ad Hoc Sub Process is valid according to the BPMN spec:
|
|
8
|
+
*
|
|
9
|
+
* - No start or end events
|
|
10
|
+
* - Every intermediate event has an outgoing sequence flow
|
|
11
|
+
*/
|
|
12
|
+
module.exports = function() {
|
|
13
|
+
|
|
14
|
+
function check(node, reporter) {
|
|
15
|
+
|
|
16
|
+
if (!is(node, 'bpmn:AdHocSubProcess')) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const flowElements = node.flowElements || [];
|
|
21
|
+
|
|
22
|
+
flowElements.forEach(function(flowElement) {
|
|
23
|
+
|
|
24
|
+
if (is(flowElement, 'bpmn:StartEvent')) {
|
|
25
|
+
reporter.report(flowElement.id, 'A <Start Event> is not allowed in <Ad Hoc Sub Process>');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (is(flowElement, 'bpmn:EndEvent')) {
|
|
29
|
+
reporter.report(flowElement.id, 'An <End Event> is not allowed in <Ad Hoc Sub Process>');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (isAny(flowElement, [ 'bpmn:IntermediateCatchEvent', 'bpmn:IntermediateThrowEvent' ])) {
|
|
33
|
+
if (!flowElement.outgoing || flowElement.outgoing.length === 0) {
|
|
34
|
+
reporter.report(flowElement.id, 'An intermediate event inside <Ad Hoc Sub Process> must have an outgoing sequence flow');
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
check
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
};
|
package/rules/no-bpmndi.js
CHANGED
|
@@ -103,13 +103,13 @@ function getAllBpmnElements(rootElements) {
|
|
|
103
103
|
*/
|
|
104
104
|
function getAllDiBpmnReferences(definitionsNode) {
|
|
105
105
|
return flatten(
|
|
106
|
-
definitionsNode.diagrams.map((diagram) => {
|
|
106
|
+
definitionsNode.get('diagrams').map((diagram) => {
|
|
107
107
|
|
|
108
108
|
const diElements = diagram.plane.planeElement || [];
|
|
109
109
|
|
|
110
110
|
return diElements.map((element) => {
|
|
111
111
|
|
|
112
|
-
return element.bpmnElement
|
|
112
|
+
return element.bpmnElement?.id;
|
|
113
113
|
});
|
|
114
114
|
})
|
|
115
115
|
);
|
|
@@ -108,7 +108,15 @@ function checkElementsArray(elements, elementsToReport, diObjects) {
|
|
|
108
108
|
continue;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
const bounds1 = diObjects.get(element)?.bounds;
|
|
112
|
+
const bounds2 = diObjects.get(element2)?.bounds;
|
|
113
|
+
|
|
114
|
+
// ignore if an element doesn't have bounds
|
|
115
|
+
if (!bounds1 || !bounds2) {
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (isCollision(bounds1, bounds2)) {
|
|
112
120
|
elementsToReport.add(element);
|
|
113
121
|
elementsToReport.add(element2);
|
|
114
122
|
}
|