bpmnlint-plugin-camunda-compat 1.0.1 → 1.2.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/index.js CHANGED
@@ -7,6 +7,7 @@ const camundaCloud10Rules = withConfig({
7
7
  'duplicate-task-headers': 'error',
8
8
  'element-type': 'error',
9
9
  'error-reference': 'error',
10
+ 'event-based-gateway-target': 'error',
10
11
  'executable-process': 'error',
11
12
  'loop-characteristics': 'error',
12
13
  'message-reference': 'error',
@@ -47,6 +48,11 @@ const camundaCloud82Rules = withConfig({
47
48
  'task-schedule': 'error'
48
49
  }, { version: '8.2' });
49
50
 
51
+ const camundaCloud83Rules = withConfig({
52
+ ...camundaCloud82Rules,
53
+ 'signal-reference': 'error'
54
+ }, { version: '8.3' });
55
+
50
56
  const camundaPlatform719Rules = withConfig({
51
57
  'history-time-to-live': 'error'
52
58
  }, { platform: 'camunda-platform', version: '7.19' });
@@ -74,6 +80,9 @@ module.exports = {
74
80
  'camunda-cloud-8-2': {
75
81
  rules: camundaCloud82Rules
76
82
  },
83
+ 'camunda-cloud-8-3': {
84
+ rules: camundaCloud83Rules
85
+ },
77
86
  'camunda-platform-7-19': {
78
87
  rules: camundaPlatform719Rules
79
88
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpmnlint-plugin-camunda-compat",
3
- "version": "1.0.1",
3
+ "version": "1.2.0",
4
4
  "description": "A bpmnlint plug-in for Camunda Platform compatibility",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -18,6 +18,7 @@ module.exports = {
18
18
  'bpmn:ErrorEventDefinition': '1.0',
19
19
  'bpmn:EscalationEventDefinition': '8.2',
20
20
  'bpmn:MessageEventDefinition': '1.2',
21
+ 'bpmn:SignalEventDefinition': '8.3',
21
22
  'bpmn:TerminateEventDefinition': '8.1'
22
23
  },
23
24
  'bpmn:EventBasedGateway': '1.0',
@@ -26,14 +27,15 @@ module.exports = {
26
27
  'bpmn:InclusiveGateway': '8.1',
27
28
  'bpmn:IntermediateCatchEvent': {
28
29
  'bpmn:MessageEventDefinition': '1.0',
29
- 'bpmn:TimerEventDefinition': '1.0',
30
- 'bpmn:LinkEventDefinition': '8.2'
30
+ 'bpmn:LinkEventDefinition': '8.2',
31
+ 'bpmn:TimerEventDefinition': '1.0'
31
32
  },
32
33
  'bpmn:IntermediateThrowEvent': {
33
34
  '_': '1.1',
34
35
  'bpmn:EscalationEventDefinition': '8.2',
36
+ 'bpmn:LinkEventDefinition': '8.2',
35
37
  'bpmn:MessageEventDefinition': '1.2',
36
- 'bpmn:LinkEventDefinition': '8.2'
38
+ 'bpmn:SignalEventDefinition': '8.3'
37
39
  },
38
40
  'bpmn:ManualTask': '1.1',
39
41
  'bpmn:MessageFlow': '1.0',
@@ -0,0 +1,39 @@
1
+ const { is } = require('bpmnlint-utils');
2
+
3
+ const { ERROR_TYPES } = require('./utils/element');
4
+
5
+ const { reportErrors } = require('./utils/reporter');
6
+
7
+ const { skipInNonExecutableProcess } = require('./utils/rule');
8
+
9
+ module.exports = skipInNonExecutableProcess(function() {
10
+ function check(node, reporter) {
11
+ if (!is(node, 'bpmn:ReceiveTask')) {
12
+ return;
13
+ }
14
+
15
+ // receive task as event-based gateway target is allowed by BPMN 2.0 but not
16
+ // supported by Zeebe
17
+ const error = node.get('incoming').some((sequenceFlow) => {
18
+ const source = sequenceFlow.get('sourceRef');
19
+
20
+ return is(source, 'bpmn:EventBasedGateway');
21
+ });
22
+
23
+ if (error) {
24
+ reportErrors(node, reporter, {
25
+ message: 'Element of type <bpmn:ReceiveTask> not allowed as event-based gateway target',
26
+ path: null,
27
+ data: {
28
+ type: ERROR_TYPES.EVENT_BASED_GATEWAY_TARGET_NOT_ALLOWED,
29
+ node,
30
+ parentNode: null
31
+ }
32
+ });
33
+ }
34
+ }
35
+
36
+ return {
37
+ check
38
+ };
39
+ });
@@ -35,6 +35,10 @@ const handlersMap = {
35
35
  '8.2': [
36
36
  checkErrorCatchEvent,
37
37
  checkEscalationCatchEvent
38
+ ],
39
+ '8.3': [
40
+ checkErrorCatchEvent,
41
+ checkEscalationCatchEvent
38
42
  ]
39
43
  };
40
44
 
@@ -61,6 +65,10 @@ function noExpressionRule({ version }) {
61
65
  function checkForVersion(node, version) {
62
66
  const handlers = handlersMap[version];
63
67
 
68
+ if (!handlers) {
69
+ return [];
70
+ }
71
+
64
72
  return handlers.reduce((errors, handler) => {
65
73
  const handlerErrors = handler(node) || [];
66
74
  return errors.concat(handlerErrors);
@@ -1,6 +1,12 @@
1
- const { isAny } = require('bpmnlint-utils');
1
+ const {
2
+ is,
3
+ isAny
4
+ } = require('bpmnlint-utils');
2
5
 
3
- const { hasProperties } = require('./utils/element');
6
+ const {
7
+ ERROR_TYPES,
8
+ hasProperties
9
+ } = require('./utils/element');
4
10
 
5
11
  const { reportErrors } = require('./utils/reporter');
6
12
 
@@ -8,26 +14,40 @@ const { skipInNonExecutableProcess } = require('./utils/rule');
8
14
 
9
15
  module.exports = skipInNonExecutableProcess(function() {
10
16
  function check(node, reporter) {
11
- if (!isAny(node, [ 'bpmn:ExclusiveGateway', 'bpmn:InclusiveGateway' ])) {
12
- return;
13
- }
14
-
15
- const outgoing = node.get('outgoing');
16
-
17
- if (outgoing && outgoing.length > 1) {
18
- for (let sequenceFlow of outgoing) {
19
- if (node.get('default') !== sequenceFlow) {
20
- const errors = hasProperties(sequenceFlow, {
21
- conditionExpression: {
22
- required: true
17
+ if (isAny(node, [ 'bpmn:ExclusiveGateway', 'bpmn:InclusiveGateway' ])) {
18
+ const outgoing = node.get('outgoing');
19
+
20
+ if (outgoing && outgoing.length > 1) {
21
+ for (let sequenceFlow of outgoing) {
22
+ if (node.get('default') !== sequenceFlow) {
23
+ const errors = hasProperties(sequenceFlow, {
24
+ conditionExpression: {
25
+ required: true
26
+ }
27
+ }, sequenceFlow);
28
+
29
+ if (errors.length) {
30
+ reportErrors(sequenceFlow, reporter, errors);
23
31
  }
24
- }, sequenceFlow);
25
-
26
- if (errors.length) {
27
- reportErrors(sequenceFlow, reporter, errors);
28
32
  }
29
33
  }
30
34
  }
35
+ } else if (is(node, 'bpmn:SequenceFlow')) {
36
+ const source = node.get('sourceRef'),
37
+ conditionExpression = node.get('conditionExpression');
38
+
39
+ if (!isAny(source, [ 'bpmn:ExclusiveGateway', 'bpmn:InclusiveGateway' ]) && conditionExpression) {
40
+ reportErrors(node, reporter, {
41
+ message: 'Property <conditionExpression> only allowed if source is of type <bpmn:ExclusiveGateway> or <bpmn:InclusiveGateway>',
42
+ path: [ 'conditionExpression' ],
43
+ data: {
44
+ type: ERROR_TYPES.PROPERTY_NOT_ALLOWED,
45
+ node: node,
46
+ parentNode: null,
47
+ property: 'conditionExpression'
48
+ }
49
+ });
50
+ }
31
51
  }
32
52
  }
33
53
 
@@ -0,0 +1,59 @@
1
+ const {
2
+ is,
3
+ isAny
4
+ } = require('bpmnlint-utils');
5
+
6
+ const {
7
+ getEventDefinition,
8
+ hasProperties
9
+ } = require('./utils/element');
10
+
11
+ const { reportErrors } = require('./utils/reporter');
12
+
13
+ const { skipInNonExecutableProcess } = require('./utils/rule');
14
+
15
+ module.exports = skipInNonExecutableProcess(function() {
16
+ function check(node, reporter) {
17
+ if (!isAny(node, [ 'bpmn:StartEvent', 'bpmn:IntermediateThrowEvent', 'bpmn:EndEvent' ])) {
18
+ return;
19
+ }
20
+
21
+ const eventDefinition = getEventDefinition(node);
22
+
23
+ if (!eventDefinition || !is(eventDefinition, 'bpmn:SignalEventDefinition')) {
24
+ return;
25
+ }
26
+
27
+ let errors = hasProperties(eventDefinition, {
28
+ signalRef: {
29
+ required: true
30
+ }
31
+ }, node);
32
+
33
+ if (errors.length) {
34
+ reportErrors(node, reporter, errors);
35
+
36
+ return;
37
+ }
38
+
39
+ const signalRef = eventDefinition.get('signalRef');
40
+
41
+ if (!signalRef) {
42
+ return;
43
+ }
44
+
45
+ errors = hasProperties(signalRef, {
46
+ name: {
47
+ required: true
48
+ }
49
+ }, node);
50
+
51
+ if (errors.length) {
52
+ reportErrors(node, reporter, errors);
53
+ }
54
+ }
55
+
56
+ return {
57
+ check
58
+ };
59
+ });
@@ -2,6 +2,7 @@ module.exports.ERROR_TYPES = Object.freeze({
2
2
  ELEMENT_COLLAPSED_NOT_ALLOWED: 'camunda.elementCollapsedNotAllowed',
3
3
  CHILD_ELEMENT_TYPE_NOT_ALLOWED: 'camunda.childElementTypeNotAllowed',
4
4
  ELEMENT_TYPE_NOT_ALLOWED: 'camunda.elementTypeNotAllowed',
5
+ EVENT_BASED_GATEWAY_TARGET_NOT_ALLOWED: 'camunda.eventBasedGatewayTargetNotAllowed',
5
6
  EXPRESSION_NOT_ALLOWED: 'camunda.expressionNotAllowed',
6
7
  EXPRESSION_REQUIRED: 'camunda.expressionRequired',
7
8
  EXPRESSION_VALUE_NOT_ALLOWED: 'camunda.expressionValueNotAllowed',