bpmnlint-plugin-camunda-compat 0.6.2 → 0.7.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.
@@ -0,0 +1,186 @@
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: [
52
+
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',
75
+
76
+ // 1.1
77
+ 'bpmn:BusinessRuleTask',
78
+ 'bpmn:IntermediateThrowEvent',
79
+ 'bpmn:ManualTask',
80
+ 'bpmn:ScriptTask',
81
+ 'bpmn:SendTask'
82
+ ],
83
+ elementsNoEventDefinitionRequired: [
84
+
85
+ // 1.0
86
+ 'bpmn:EndEvent',
87
+ 'bpmn:StartEvent',
88
+
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: [
114
+
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',
137
+
138
+ // 1.1
139
+ 'bpmn:BusinessRuleTask',
140
+ 'bpmn:IntermediateThrowEvent',
141
+ 'bpmn:ManualTask',
142
+ 'bpmn:ScriptTask',
143
+ 'bpmn:SendTask'
144
+ ],
145
+ elementsNoEventDefinitionRequired: [
146
+
147
+ // 1.0
148
+ 'bpmn:EndEvent',
149
+ 'bpmn:StartEvent',
150
+
151
+ // 1.1
152
+ 'bpmn:IntermediateThrowEvent'
153
+ ],
154
+ eventDefinitions: {
155
+
156
+ // 1.1
157
+ 'bpmn:BoundaryEvent': [
158
+ 'bpmn:ErrorEventDefinition',
159
+ 'bpmn:MessageEventDefinition',
160
+ 'bpmn:TimerEventDefinition'
161
+ ],
162
+ 'bpmn:EndEvent': [
163
+
164
+ // 1.0
165
+ 'bpmn:ErrorEventDefinition',
166
+
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
+ ],
179
+
180
+ // 1.2
181
+ 'bpmn:IntermediateThrowEvent': [
182
+ 'bpmn:MessageEventDefinition'
183
+ ]
184
+ }
185
+ }
186
+ };
@@ -0,0 +1,86 @@
1
+ const { isAny } = require('bpmnlint-utils');
2
+
3
+ const {
4
+ isAnyExactly,
5
+ getEventDefinition
6
+ } = require('../utils/element');
7
+
8
+ const { ERROR_TYPES } = require('../utils/error-types');
9
+
10
+ const { reportErrors } = require('../utils/reporter');
11
+
12
+ module.exports = function(config) {
13
+ const {
14
+ elements,
15
+ elementsNoEventDefinitionRequired,
16
+ eventDefinitions
17
+ } = config;
18
+
19
+ function check(node, reporter) {
20
+ if (!isAny(node, [ 'bpmn:FlowElement', 'bpmn:FlowElementsContainer' ])) {
21
+ return;
22
+ }
23
+
24
+ if (!isAnyExactly(node, elements)) {
25
+ const error = {
26
+ message: `Element of type <${ node.$type }> not allowed`,
27
+ path: null,
28
+ error: {
29
+ type: ERROR_TYPES.ELEMENT_TYPE_NOT_ALLOWED,
30
+ node,
31
+ parentNode: null
32
+ }
33
+ };
34
+
35
+ reportErrors(node, reporter, error);
36
+
37
+ return;
38
+ }
39
+
40
+ const eventDefinition = getEventDefinition(node);
41
+
42
+ if (isAny(node, [ 'bpmn:CatchEvent', 'ThrowEvent' ]) && !eventDefinition && !elementsNoEventDefinitionRequired.includes(node.$type)) {
43
+ const error = {
44
+ message: `Element of type <${ node.$type }> must have property <eventDefinitions>`,
45
+ path: [ 'eventDefinitions' ],
46
+ error: {
47
+ type: ERROR_TYPES.PROPERTY_REQUIRED,
48
+ node,
49
+ parentNode: null,
50
+ requiredProperty: 'eventDefinitions'
51
+ }
52
+ };
53
+
54
+ reportErrors(node, reporter, error);
55
+
56
+ return;
57
+ }
58
+
59
+ if (!eventDefinition) {
60
+ return;
61
+ }
62
+
63
+ if (!eventDefinitions[ node.$type ] || !isAny(eventDefinition, eventDefinitions[ node.$type ])) {
64
+ const error = {
65
+ message: `Property of type <${ eventDefinition.$type }> not allowed`,
66
+ path: [
67
+ 'eventDefinitions',
68
+ 0
69
+ ],
70
+ error: {
71
+ type: ERROR_TYPES.PROPERTY_TYPE_NOT_ALLOWED,
72
+ node: node,
73
+ parentNode: null,
74
+ property: 'eventDefinitions',
75
+ requiredPropertyType: eventDefinitions[ node.$type ]
76
+ }
77
+ };
78
+
79
+ reportErrors(node, reporter, error);
80
+ }
81
+ }
82
+
83
+ return {
84
+ check
85
+ };
86
+ };