bpmnlint 11.0.0 → 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/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 +1 -1
- package/rules/ad-hoc-sub-process.js +45 -0
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
|
@@ -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
|
+
};
|