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 CHANGED
@@ -2,6 +2,7 @@ const allRules = [
2
2
  'ad-hoc-sub-process',
3
3
  'conditional-flows',
4
4
  'end-event-required',
5
+ 'event-based-gateway',
5
6
  'event-sub-process-typed-start-event',
6
7
  'fake-join',
7
8
  'global',
@@ -1,6 +1,7 @@
1
1
  module.exports = {
2
2
  rules: {
3
3
  'ad-hoc-sub-process': 'error',
4
+ 'event-based-gateway': 'error',
4
5
  'event-sub-process-typed-start-event': 'error',
5
6
  'link-event': 'error',
6
7
  'no-duplicate-sequence-flows': 'warn',
@@ -3,6 +3,7 @@ module.exports = {
3
3
  'ad-hoc-sub-process': 'error',
4
4
  'conditional-flows': 'error',
5
5
  'end-event-required': 'error',
6
+ 'event-based-gateway': 'error',
6
7
  'event-sub-process-typed-start-event': 'error',
7
8
  'fake-join': 'warn',
8
9
  'global': 'warn',
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": "11.6.1",
4
+ "version": "11.7.1",
5
5
  "main": "lib/index.js",
6
6
  "keywords": [
7
7
  "bpmnlint",
@@ -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
+ }