bpmnlint 11.6.1 → 11.7.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/config/all.js +1 -0
- package/config/correctness.js +1 -0
- package/config/recommended.js +1 -0
- package/package.json +1 -1
- package/rules/event-based-gateway.js +45 -0
package/config/all.js
CHANGED
package/config/correctness.js
CHANGED
package/config/recommended.js
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const {
|
|
2
|
+
is
|
|
3
|
+
} = require('bpmnlint-utils');
|
|
4
|
+
|
|
5
|
+
const {
|
|
6
|
+
annotateRule
|
|
7
|
+
} = require('./helper');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A rule that checks, whether an event-based gateway:
|
|
12
|
+
* - has at least two outgoing sequence flows
|
|
13
|
+
* - the outgoing sequence flows are not conditional
|
|
14
|
+
*
|
|
15
|
+
* @type { import('../lib/types.js').RuleFactory }
|
|
16
|
+
*/
|
|
17
|
+
module.exports = function() {
|
|
18
|
+
|
|
19
|
+
function check(node, reporter) {
|
|
20
|
+
|
|
21
|
+
if (!is(node, 'bpmn:EventBasedGateway')) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const outgoing = node.outgoing || [];
|
|
26
|
+
|
|
27
|
+
if (outgoing.length < 2) {
|
|
28
|
+
reporter.report(node.id, 'An <Event-based Gateway> must have at least 2 outgoing <Sequence Flows>');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
outgoing.forEach((flow) => {
|
|
32
|
+
if (hasCondition(flow)) {
|
|
33
|
+
reporter.report(flow.id, 'A <Sequence Flow> outgoing from an <Event-based Gateway> must not be conditional');
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return annotateRule('event-based-gateway', {
|
|
39
|
+
check
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
function hasCondition(flow) {
|
|
44
|
+
return !!flow.conditionExpression;
|
|
45
|
+
}
|