bpmnlint-plugin-camunda-compat 0.11.0 → 0.12.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
@@ -36,7 +36,11 @@ const camundaCloud13Rules = {
36
36
 
37
37
  const camundaCloud80Rules = omit(camundaCloud13Rules, 'no-template');
38
38
 
39
- const camundaCloud81Rules = omit(camundaCloud13Rules, 'no-zeebe-properties');
39
+ const camundaCloud81Rules = {
40
+ ...omit(camundaCloud80Rules, 'no-zeebe-properties'),
41
+ 'element-type': [ 'error', elementTypeConfig.camundaCloud81 ],
42
+ 'inclusive-gateway': 'error'
43
+ };
40
44
 
41
45
  module.exports = {
42
46
  configs: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpmnlint-plugin-camunda-compat",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "A bpmnlint plug-in for Camunda Platform compatibility",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,186 +1,121 @@
1
- module.exports = {
2
- camundaCloud10: {
3
- elements: [
4
- 'bpmn:Association',
5
- 'bpmn:BoundaryEvent',
6
- 'bpmn:CallActivity',
7
- 'bpmn:Collaboration',
8
- 'bpmn:Definitions',
9
- 'bpmn:EndEvent',
10
- 'bpmn:EventBasedGateway',
11
- 'bpmn:ExclusiveGateway',
12
- 'bpmn:Group',
13
- 'bpmn:IntermediateCatchEvent',
14
- 'bpmn:MessageFlow',
15
- 'bpmn:ParallelGateway',
16
- 'bpmn:Participant',
17
- 'bpmn:Process',
18
- 'bpmn:ReceiveTask',
19
- 'bpmn:SequenceFlow',
20
- 'bpmn:ServiceTask',
21
- 'bpmn:StartEvent',
22
- 'bpmn:SubProcess',
23
- 'bpmn:TextAnnotation',
24
- 'bpmn:UserTask'
25
- ],
26
- elementsNoEventDefinitionRequired: [
27
- 'bpmn:EndEvent',
28
- 'bpmn:StartEvent'
29
- ],
30
- eventDefinitions: {
31
- 'bpmn:BoundaryEvent': [
32
- 'bpmn:ErrorEventDefinition',
33
- 'bpmn:MessageEventDefinition',
34
- 'bpmn:TimerEventDefinition'
35
- ],
36
- 'bpmn:EndEvent': [
37
- 'bpmn:ErrorEventDefinition'
38
- ],
39
- 'bpmn:IntermediateCatchEvent': [
40
- 'bpmn:MessageEventDefinition',
41
- 'bpmn:TimerEventDefinition'
42
- ],
43
- 'bpmn:StartEvent': [
44
- 'bpmn:ErrorEventDefinition',
45
- 'bpmn:MessageEventDefinition',
46
- 'bpmn:TimerEventDefinition'
47
- ]
48
- }
49
- },
50
- camundaCloud11: {
51
- elements: [
1
+ const camundaCloud10Elements = [
2
+ 'bpmn:Association',
3
+ 'bpmn:BoundaryEvent',
4
+ 'bpmn:CallActivity',
5
+ 'bpmn:Collaboration',
6
+ 'bpmn:Definitions',
7
+ 'bpmn:EndEvent',
8
+ 'bpmn:EventBasedGateway',
9
+ 'bpmn:ExclusiveGateway',
10
+ 'bpmn:Group',
11
+ 'bpmn:IntermediateCatchEvent',
12
+ 'bpmn:MessageFlow',
13
+ 'bpmn:ParallelGateway',
14
+ 'bpmn:Participant',
15
+ 'bpmn:Process',
16
+ 'bpmn:ReceiveTask',
17
+ 'bpmn:SequenceFlow',
18
+ 'bpmn:ServiceTask',
19
+ 'bpmn:StartEvent',
20
+ 'bpmn:SubProcess',
21
+ 'bpmn:TextAnnotation',
22
+ 'bpmn:UserTask'
23
+ ];
52
24
 
53
- // 1.0
54
- 'bpmn:Association',
55
- 'bpmn:BoundaryEvent',
56
- 'bpmn:CallActivity',
57
- 'bpmn:Collaboration',
58
- 'bpmn:Definitions',
59
- 'bpmn:EndEvent',
60
- 'bpmn:EventBasedGateway',
61
- 'bpmn:ExclusiveGateway',
62
- 'bpmn:Group',
63
- 'bpmn:IntermediateCatchEvent',
64
- 'bpmn:MessageFlow',
65
- 'bpmn:ParallelGateway',
66
- 'bpmn:Participant',
67
- 'bpmn:Process',
68
- 'bpmn:ReceiveTask',
69
- 'bpmn:SequenceFlow',
70
- 'bpmn:ServiceTask',
71
- 'bpmn:StartEvent',
72
- 'bpmn:SubProcess',
73
- 'bpmn:TextAnnotation',
74
- 'bpmn:UserTask',
25
+ const camundaCloud11Elements = [
26
+ ...camundaCloud10Elements,
27
+ 'bpmn:BusinessRuleTask',
28
+ 'bpmn:IntermediateThrowEvent',
29
+ 'bpmn:ManualTask',
30
+ 'bpmn:ScriptTask',
31
+ 'bpmn:SendTask'
32
+ ];
75
33
 
76
- // 1.1
77
- 'bpmn:BusinessRuleTask',
78
- 'bpmn:IntermediateThrowEvent',
79
- 'bpmn:ManualTask',
80
- 'bpmn:ScriptTask',
81
- 'bpmn:SendTask'
82
- ],
83
- elementsNoEventDefinitionRequired: [
34
+ const camundaCloud12Elements = [
35
+ ...camundaCloud11Elements
36
+ ];
84
37
 
85
- // 1.0
86
- 'bpmn:EndEvent',
87
- 'bpmn:StartEvent',
38
+ const camundaCloud81Elements = [
39
+ ...camundaCloud12Elements,
40
+ 'bpmn:InclusiveGateway'
41
+ ];
88
42
 
89
- // 1.1
90
- 'bpmn:IntermediateThrowEvent'
91
- ],
92
- eventDefinitions: {
93
- 'bpmn:BoundaryEvent': [
94
- 'bpmn:ErrorEventDefinition',
95
- 'bpmn:MessageEventDefinition',
96
- 'bpmn:TimerEventDefinition'
97
- ],
98
- 'bpmn:EndEvent': [
99
- 'bpmn:ErrorEventDefinition'
100
- ],
101
- 'bpmn:IntermediateCatchEvent': [
102
- 'bpmn:MessageEventDefinition',
103
- 'bpmn:TimerEventDefinition'
104
- ],
105
- 'bpmn:StartEvent': [
106
- 'bpmn:ErrorEventDefinition',
107
- 'bpmn:MessageEventDefinition',
108
- 'bpmn:TimerEventDefinition'
109
- ]
110
- }
111
- },
112
- camundaCloud12: {
113
- elements: [
43
+ const camundaCloud10ElementsNoEventDefinitionRequired = [
44
+ 'bpmn:EndEvent',
45
+ 'bpmn:StartEvent'
46
+ ];
114
47
 
115
- // 1.0
116
- 'bpmn:Association',
117
- 'bpmn:BoundaryEvent',
118
- 'bpmn:CallActivity',
119
- 'bpmn:Collaboration',
120
- 'bpmn:Definitions',
121
- 'bpmn:EndEvent',
122
- 'bpmn:EventBasedGateway',
123
- 'bpmn:ExclusiveGateway',
124
- 'bpmn:Group',
125
- 'bpmn:IntermediateCatchEvent',
126
- 'bpmn:MessageFlow',
127
- 'bpmn:ParallelGateway',
128
- 'bpmn:Participant',
129
- 'bpmn:Process',
130
- 'bpmn:ReceiveTask',
131
- 'bpmn:SequenceFlow',
132
- 'bpmn:ServiceTask',
133
- 'bpmn:StartEvent',
134
- 'bpmn:SubProcess',
135
- 'bpmn:TextAnnotation',
136
- 'bpmn:UserTask',
48
+ const camundaCloud11ElementsNoEventDefinitionRequired = [
49
+ ...camundaCloud10ElementsNoEventDefinitionRequired,
50
+ 'bpmn:IntermediateThrowEvent'
51
+ ];
137
52
 
138
- // 1.1
139
- 'bpmn:BusinessRuleTask',
140
- 'bpmn:IntermediateThrowEvent',
141
- 'bpmn:ManualTask',
142
- 'bpmn:ScriptTask',
143
- 'bpmn:SendTask'
144
- ],
145
- elementsNoEventDefinitionRequired: [
53
+ const camundaCloud12ElementsNoEventDefinitionRequired = [
54
+ ...camundaCloud11ElementsNoEventDefinitionRequired
55
+ ];
146
56
 
147
- // 1.0
148
- 'bpmn:EndEvent',
149
- 'bpmn:StartEvent',
57
+ const camundaCloud81ElementsNoEventDefinitionRequired = [
58
+ ...camundaCloud12ElementsNoEventDefinitionRequired
59
+ ];
150
60
 
151
- // 1.1
152
- 'bpmn:IntermediateThrowEvent'
153
- ],
154
- eventDefinitions: {
61
+ const camundaCloud10EventDefinitions = {
62
+ 'bpmn:BoundaryEvent': [
63
+ 'bpmn:ErrorEventDefinition',
64
+ 'bpmn:MessageEventDefinition',
65
+ 'bpmn:TimerEventDefinition'
66
+ ],
67
+ 'bpmn:EndEvent': [
68
+ 'bpmn:ErrorEventDefinition'
69
+ ],
70
+ 'bpmn:IntermediateCatchEvent': [
71
+ 'bpmn:MessageEventDefinition',
72
+ 'bpmn:TimerEventDefinition'
73
+ ],
74
+ 'bpmn:StartEvent': [
75
+ 'bpmn:ErrorEventDefinition',
76
+ 'bpmn:MessageEventDefinition',
77
+ 'bpmn:TimerEventDefinition'
78
+ ]
79
+ };
155
80
 
156
- // 1.1
157
- 'bpmn:BoundaryEvent': [
158
- 'bpmn:ErrorEventDefinition',
159
- 'bpmn:MessageEventDefinition',
160
- 'bpmn:TimerEventDefinition'
161
- ],
162
- 'bpmn:EndEvent': [
81
+ const camundaCloud11EventDefinitions = {
82
+ ...camundaCloud10EventDefinitions
83
+ };
163
84
 
164
- // 1.0
165
- 'bpmn:ErrorEventDefinition',
85
+ const camundaCloud12EventDefinitions = {
86
+ ...camundaCloud11EventDefinitions,
87
+ 'bpmn:EndEvent': [
88
+ ...camundaCloud11EventDefinitions['bpmn:EndEvent'],
89
+ 'bpmn:MessageEventDefinition'
90
+ ],
91
+ 'bpmn:IntermediateThrowEvent': [
92
+ 'bpmn:MessageEventDefinition'
93
+ ]
94
+ };
166
95
 
167
- // 1.1
168
- 'bpmn:MessageEventDefinition'
169
- ],
170
- 'bpmn:IntermediateCatchEvent': [
171
- 'bpmn:MessageEventDefinition',
172
- 'bpmn:TimerEventDefinition'
173
- ],
174
- 'bpmn:StartEvent': [
175
- 'bpmn:ErrorEventDefinition',
176
- 'bpmn:MessageEventDefinition',
177
- 'bpmn:TimerEventDefinition'
178
- ],
96
+ const camundaCloud81EventDefinitions = {
97
+ ...camundaCloud12EventDefinitions
98
+ };
179
99
 
180
- // 1.2
181
- 'bpmn:IntermediateThrowEvent': [
182
- 'bpmn:MessageEventDefinition'
183
- ]
184
- }
100
+ module.exports = {
101
+ camundaCloud10: {
102
+ elements: camundaCloud10Elements,
103
+ elementsNoEventDefinitionRequired: camundaCloud10ElementsNoEventDefinitionRequired,
104
+ eventDefinitions: camundaCloud10EventDefinitions
105
+ },
106
+ camundaCloud11: {
107
+ elements: camundaCloud11Elements,
108
+ elementsNoEventDefinitionRequired: camundaCloud11ElementsNoEventDefinitionRequired,
109
+ eventDefinitions: camundaCloud11EventDefinitions
110
+ },
111
+ camundaCloud12: {
112
+ elements: camundaCloud12Elements,
113
+ elementsNoEventDefinitionRequired: camundaCloud12ElementsNoEventDefinitionRequired,
114
+ eventDefinitions: camundaCloud12EventDefinitions
115
+ },
116
+ camundaCloud81: {
117
+ elements: camundaCloud81Elements,
118
+ elementsNoEventDefinitionRequired: camundaCloud81ElementsNoEventDefinitionRequired,
119
+ eventDefinitions: camundaCloud81EventDefinitions
185
120
  }
186
121
  };
@@ -0,0 +1,52 @@
1
+ const { is } = require('bpmnlint-utils');
2
+
3
+ const { hasProperties, ERROR_TYPES } = require('./utils/element');
4
+
5
+ const { reportErrors } = require('./utils/reporter');
6
+
7
+ module.exports = function() {
8
+ function check(node, reporter) {
9
+ if (!is(node, 'bpmn:InclusiveGateway')) {
10
+ return;
11
+ }
12
+
13
+ const incoming = node.get('incoming');
14
+
15
+ if (incoming && incoming.length > 1) {
16
+ const error = {
17
+ message: `Element of type <${ node.$type }> must have one property <incoming> of type <bpmn:SequenceFlow>`,
18
+ path: [ 'incoming' ],
19
+ error: {
20
+ type: ERROR_TYPES.PROPERTY_NOT_ALLOWED,
21
+ node,
22
+ parentNode: null,
23
+ property: 'incoming'
24
+ }
25
+ };
26
+
27
+ reportErrors(node, reporter, error);
28
+ }
29
+
30
+ const outgoing = node.get('outgoing');
31
+
32
+ if (outgoing && outgoing.length > 1) {
33
+ for (let sequenceFlow of outgoing) {
34
+ if (node.get('default') !== sequenceFlow) {
35
+ const errors = hasProperties(sequenceFlow, {
36
+ conditionExpression: {
37
+ required: true
38
+ }
39
+ }, sequenceFlow);
40
+
41
+ if (errors.length) {
42
+ reportErrors(sequenceFlow, reporter, errors);
43
+ }
44
+ }
45
+ }
46
+ }
47
+ }
48
+
49
+ return {
50
+ check
51
+ };
52
+ };