bpmnlint-plugin-camunda-compat 0.16.0 → 0.17.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
@@ -1,7 +1,7 @@
|
|
1
1
|
const { omit } = require('min-dash');
|
2
2
|
|
3
3
|
const camundaCloud10Rules = {
|
4
|
-
'
|
4
|
+
'implementation': [ 'error', { version: '1.0' } ],
|
5
5
|
'called-element': 'error',
|
6
6
|
'collapsed-subprocess': 'error',
|
7
7
|
'duplicate-task-headers': 'error',
|
@@ -21,35 +21,35 @@ const camundaCloud10Rules = {
|
|
21
21
|
|
22
22
|
const camundaCloud11Rules = {
|
23
23
|
...camundaCloud10Rules,
|
24
|
-
'
|
24
|
+
'implementation': [ 'error', { version: '1.1' } ],
|
25
25
|
'element-type': [ 'error', { version: '1.1' } ],
|
26
26
|
'timer': [ 'error', { version: '1.1' } ]
|
27
27
|
};
|
28
28
|
|
29
29
|
const camundaCloud12Rules = {
|
30
30
|
...camundaCloud11Rules,
|
31
|
-
'
|
31
|
+
'implementation': [ 'error', { version: '1.2' } ],
|
32
32
|
'element-type': [ 'error', { version: '1.2' } ],
|
33
33
|
'timer': [ 'error', { version: '1.2' } ]
|
34
34
|
};
|
35
35
|
|
36
36
|
const camundaCloud13Rules = {
|
37
37
|
...camundaCloud12Rules,
|
38
|
-
'
|
38
|
+
'implementation': [ 'error', { version: '1.3' } ],
|
39
39
|
'element-type': [ 'error', { version: '1.3' } ],
|
40
40
|
'timer': [ 'error', { version: '1.3' } ]
|
41
41
|
};
|
42
42
|
|
43
43
|
const camundaCloud80Rules = {
|
44
44
|
...omit(camundaCloud13Rules, 'no-template'),
|
45
|
-
'
|
45
|
+
'implementation': [ 'error', { version: '8.0' } ],
|
46
46
|
'element-type': [ 'error', { version: '8.0' } ],
|
47
47
|
'timer': [ 'error', { version: '8.0' } ]
|
48
48
|
};
|
49
49
|
|
50
50
|
const camundaCloud81Rules = {
|
51
51
|
...omit(camundaCloud80Rules, 'no-zeebe-properties'),
|
52
|
-
'
|
52
|
+
'implementation': [ 'error', { version: '8.1' } ],
|
53
53
|
'element-type': [ 'error', { version: '8.1' } ],
|
54
54
|
'inclusive-gateway': 'error',
|
55
55
|
'timer': [ 'error', { version: '8.1' } ]
|
@@ -57,7 +57,7 @@ const camundaCloud81Rules = {
|
|
57
57
|
|
58
58
|
const camundaCloud82Rules = {
|
59
59
|
...camundaCloud81Rules,
|
60
|
-
'
|
60
|
+
'implementation': [ 'error', { version: '8.2' } ],
|
61
61
|
'element-type': [ 'error', { version: '8.2' } ],
|
62
62
|
'timer': [ 'error', { version: '8.2' } ]
|
63
63
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "bpmnlint-plugin-camunda-compat",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.17.0",
|
4
4
|
"description": "A bpmnlint plug-in for Camunda Platform compatibility",
|
5
5
|
"main": "index.js",
|
6
6
|
"scripts": {
|
@@ -33,7 +33,7 @@
|
|
33
33
|
"modeler-moddle": "^0.1.0",
|
34
34
|
"sinon": "^14.0.0",
|
35
35
|
"sinon-chai": "^3.7.0",
|
36
|
-
"zeebe-bpmn-moddle": "^0.
|
36
|
+
"zeebe-bpmn-moddle": "^0.17.0"
|
37
37
|
},
|
38
38
|
"dependencies": {
|
39
39
|
"@bpmn-io/feel-lint": "^0.1.1",
|
@@ -5,10 +5,13 @@ module.exports = {
|
|
5
5
|
taskDefinition: {
|
6
6
|
'bpmn:BusinessRuleTask': '1.1',
|
7
7
|
'bpmn:IntermediateThrowEvent': {
|
8
|
-
'bpmn:MessageEventDefinition': '1.2'
|
8
|
+
'bpmn:MessageEventDefinition': '1.2'
|
9
9
|
},
|
10
10
|
'bpmn:ScriptTask': '1.1',
|
11
11
|
'bpmn:SendTask': '1.1',
|
12
12
|
'bpmn:ServiceTask': '1.0'
|
13
|
+
},
|
14
|
+
script: {
|
15
|
+
'bpmn:ScriptTask': '8.2'
|
13
16
|
}
|
14
17
|
};
|
@@ -22,10 +22,12 @@ const { ERROR_TYPES } = require('../utils/error-types');
|
|
22
22
|
module.exports = function({ version }) {
|
23
23
|
function check(node, reporter) {
|
24
24
|
const calledDecisionConfig = config.calledDecision[ node.$type ];
|
25
|
+
const scriptConfig = config.script[ node.$type ];
|
25
26
|
const taskDefinitionConfig = config.taskDefinition[ node.$type ];
|
26
27
|
|
27
28
|
if (
|
28
29
|
(!calledDecisionConfig || (isString(calledDecisionConfig) && !greaterOrEqual(version, calledDecisionConfig)))
|
30
|
+
&& (!scriptConfig || (isString(scriptConfig) && !greaterOrEqual(version, scriptConfig)))
|
29
31
|
&& (!taskDefinitionConfig || (isString(taskDefinitionConfig) && !greaterOrEqual(version, taskDefinitionConfig)))) {
|
30
32
|
return;
|
31
33
|
}
|
@@ -37,9 +39,10 @@ module.exports = function({ version }) {
|
|
37
39
|
let errors;
|
38
40
|
|
39
41
|
const calledDecision = findExtensionElement(node, 'zeebe:CalledDecision'),
|
42
|
+
script = findExtensionElement(node, 'zeebe:Script'),
|
40
43
|
taskDefinition = findExtensionElement(node, 'zeebe:TaskDefinition');
|
41
44
|
|
42
|
-
if (calledDecision && !taskDefinition) {
|
45
|
+
if (calledDecision && !script && !taskDefinition) {
|
43
46
|
|
44
47
|
if (!isCalledDecisionAllowed(node, version)) {
|
45
48
|
const allowedVersion = getAllowedVersion(calledDecisionConfig, node);
|
@@ -77,7 +80,45 @@ module.exports = function({ version }) {
|
|
77
80
|
}
|
78
81
|
}
|
79
82
|
|
80
|
-
if (!calledDecision && taskDefinition) {
|
83
|
+
if (!calledDecision && script && !taskDefinition) {
|
84
|
+
|
85
|
+
if (!isScriptAllowed(node, version)) {
|
86
|
+
const allowedVersion = getAllowedVersion(scriptConfig, node);
|
87
|
+
|
88
|
+
reportErrors(node, reporter, {
|
89
|
+
message: allowedVersion
|
90
|
+
? `Extension element of type <zeebe:Script> only allowed by Camunda Platform ${ allowedVersion } or newer`
|
91
|
+
: 'Extension element of type <zeebe:Script> not allowed',
|
92
|
+
path: getPath(script, node),
|
93
|
+
data: {
|
94
|
+
type: ERROR_TYPES.EXTENSION_ELEMENT_NOT_ALLOWED,
|
95
|
+
node,
|
96
|
+
parentNode: null,
|
97
|
+
extensionElement: script,
|
98
|
+
allowedVersion
|
99
|
+
}
|
100
|
+
});
|
101
|
+
|
102
|
+
return;
|
103
|
+
}
|
104
|
+
|
105
|
+
errors = hasProperties(script, {
|
106
|
+
expression: {
|
107
|
+
required: true
|
108
|
+
},
|
109
|
+
resultVariable: {
|
110
|
+
required: true
|
111
|
+
}
|
112
|
+
}, node);
|
113
|
+
|
114
|
+
if (errors && errors.length) {
|
115
|
+
reportErrors(node, reporter, errors);
|
116
|
+
|
117
|
+
return;
|
118
|
+
}
|
119
|
+
}
|
120
|
+
|
121
|
+
if (!calledDecision && !script && taskDefinition) {
|
81
122
|
|
82
123
|
if (!isTaskDefinitionAllowed(node, version)) {
|
83
124
|
const allowedVersion = getAllowedVersion(taskDefinitionConfig, node);
|
@@ -110,15 +151,18 @@ module.exports = function({ version }) {
|
|
110
151
|
}
|
111
152
|
}
|
112
153
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
154
|
+
const allowedTypes = [
|
155
|
+
isCalledDecisionAllowed(node, version) ? 'zeebe:CalledDecision' : false,
|
156
|
+
isScriptAllowed(node, version) ? 'zeebe:Script' : false,
|
157
|
+
isTaskDefinitionAllowed(node, version) ? 'zeebe:TaskDefinition' : false
|
158
|
+
].filter(isAllowed => isAllowed);
|
159
|
+
|
160
|
+
if (allowedTypes.length === 0) {
|
161
|
+
return;
|
162
|
+
} else if (allowedTypes.length === 1) {
|
163
|
+
errors = hasExtensionElement(node, allowedTypes[0], node);
|
164
|
+
} else {
|
165
|
+
errors = hasExtensionElement(node, allowedTypes, node);
|
122
166
|
}
|
123
167
|
|
124
168
|
if (errors && errors.length) {
|
@@ -136,7 +180,17 @@ module.exports = function({ version }) {
|
|
136
180
|
function isCalledDecisionAllowed(node, version) {
|
137
181
|
const { calledDecision } = config;
|
138
182
|
|
139
|
-
|
183
|
+
const allowedVersion = getAllowedVersion(calledDecision[ node.$type ], node);
|
184
|
+
|
185
|
+
return calledDecision[ node.$type ] && greaterOrEqual(version, allowedVersion);
|
186
|
+
}
|
187
|
+
|
188
|
+
function isScriptAllowed(node, version) {
|
189
|
+
const { script } = config;
|
190
|
+
|
191
|
+
const allowedVersion = getAllowedVersion(script[ node.$type ], node);
|
192
|
+
|
193
|
+
return allowedVersion && greaterOrEqual(version, allowedVersion);
|
140
194
|
}
|
141
195
|
|
142
196
|
function isTaskDefinitionAllowed(node, version) {
|
@@ -159,4 +213,4 @@ function getAllowedVersion(config, node) {
|
|
159
213
|
const eventDefinition = getEventDefinition(node);
|
160
214
|
|
161
215
|
return eventDefinition && config[ eventDefinition.$type ];
|
162
|
-
}
|
216
|
+
}
|