bpmnlint-plugin-camunda-compat 0.21.0 → 0.22.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/package.json +1 -1
- package/rules/error-reference.js +11 -3
- package/rules/utils/element.js +31 -23
package/package.json
CHANGED
package/rules/error-reference.js
CHANGED
@@ -12,12 +12,18 @@ const { reportErrors } = require('./utils/reporter');
|
|
12
12
|
|
13
13
|
const { skipInNonExecutableProcess } = require('./utils/rule');
|
14
14
|
|
15
|
-
|
15
|
+
const { greaterOrEqual } = require('./utils/version');
|
16
|
+
|
17
|
+
module.exports = skipInNonExecutableProcess(function({ version }) {
|
16
18
|
function check(node, reporter) {
|
17
19
|
if (!isAny(node, [ 'bpmn:CatchEvent', 'bpmn:ThrowEvent' ])) {
|
18
20
|
return;
|
19
21
|
}
|
20
22
|
|
23
|
+
if (is(node, 'bpmn:CatchEvent') && greaterOrEqual(version, '8.2')) {
|
24
|
+
return;
|
25
|
+
}
|
26
|
+
|
21
27
|
const eventDefinition = getEventDefinition(node);
|
22
28
|
|
23
29
|
if (!eventDefinition || !is(eventDefinition, 'bpmn:ErrorEventDefinition')) {
|
@@ -26,7 +32,8 @@ module.exports = skipInNonExecutableProcess(function() {
|
|
26
32
|
|
27
33
|
let errors = hasProperties(eventDefinition, {
|
28
34
|
errorRef: {
|
29
|
-
required: true
|
35
|
+
required: true,
|
36
|
+
allowedVersion: '8.2'
|
30
37
|
}
|
31
38
|
}, node);
|
32
39
|
|
@@ -40,7 +47,8 @@ module.exports = skipInNonExecutableProcess(function() {
|
|
40
47
|
|
41
48
|
errors = hasProperties(errorRef, {
|
42
49
|
errorCode: {
|
43
|
-
required: true
|
50
|
+
required: true,
|
51
|
+
allowedVersion: '8.2'
|
44
52
|
}
|
45
53
|
}, node);
|
46
54
|
|
package/rules/utils/element.js
CHANGED
@@ -145,16 +145,18 @@ module.exports.hasProperties = function(node, properties, parentNode = null) {
|
|
145
145
|
return [
|
146
146
|
...results,
|
147
147
|
{
|
148
|
-
message:
|
148
|
+
message: allowedVersion
|
149
|
+
? `Element of type <${ node.$type }> without property <${ propertyName }> only allowed by Camunda Platform ${ allowedVersion } or newer`
|
150
|
+
: `Element of type <${ node.$type }> must have property <${ propertyName }>`,
|
149
151
|
path: path
|
150
152
|
? [ ...path, propertyName ]
|
151
153
|
: [ propertyName ],
|
152
|
-
data: {
|
154
|
+
data: addAllowedVersion({
|
153
155
|
type: ERROR_TYPES.PROPERTY_REQUIRED,
|
154
156
|
node,
|
155
157
|
parentNode: parentNode == node ? null : parentNode,
|
156
158
|
requiredProperty: propertyName
|
157
|
-
}
|
159
|
+
}, allowedVersion)
|
158
160
|
}
|
159
161
|
];
|
160
162
|
}
|
@@ -200,14 +202,13 @@ module.exports.hasProperties = function(node, properties, parentNode = null) {
|
|
200
202
|
path: path
|
201
203
|
? [ ...path, propertyName ]
|
202
204
|
: [ propertyName ],
|
203
|
-
data: {
|
205
|
+
data: addAllowedVersion({
|
204
206
|
type: ERROR_TYPES.PROPERTY_TYPE_NOT_ALLOWED,
|
205
207
|
node,
|
206
208
|
parentNode: parentNode == node ? null : parentNode,
|
207
209
|
property: propertyName,
|
208
|
-
allowedPropertyType: propertyChecks.type
|
209
|
-
|
210
|
-
}
|
210
|
+
allowedPropertyType: propertyChecks.type
|
211
|
+
}, allowedVersion)
|
211
212
|
}
|
212
213
|
];
|
213
214
|
}
|
@@ -241,13 +242,12 @@ module.exports.hasProperties = function(node, properties, parentNode = null) {
|
|
241
242
|
path: path
|
242
243
|
? [ ...path, propertyName ]
|
243
244
|
: [ propertyName ],
|
244
|
-
data: {
|
245
|
+
data: addAllowedVersion({
|
245
246
|
type: ERROR_TYPES.PROPERTY_NOT_ALLOWED,
|
246
247
|
node,
|
247
248
|
parentNode: parentNode == node ? null : parentNode,
|
248
|
-
property: propertyName
|
249
|
-
|
250
|
-
}
|
249
|
+
property: propertyName
|
250
|
+
}, allowedVersion)
|
251
251
|
}
|
252
252
|
];
|
253
253
|
}
|
@@ -262,13 +262,12 @@ module.exports.hasProperties = function(node, properties, parentNode = null) {
|
|
262
262
|
path: path
|
263
263
|
? [ ...path, propertyName ]
|
264
264
|
: [ propertyName ],
|
265
|
-
data: {
|
265
|
+
data: addAllowedVersion({
|
266
266
|
type: ERROR_TYPES.PROPERTY_VALUE_NOT_ALLOWED,
|
267
267
|
node,
|
268
268
|
parentNode: parentNode == node ? null : parentNode,
|
269
|
-
property: propertyName
|
270
|
-
|
271
|
-
}
|
269
|
+
property: propertyName
|
270
|
+
}, allowedVersion)
|
272
271
|
}
|
273
272
|
];
|
274
273
|
}
|
@@ -344,13 +343,12 @@ module.exports.hasNoExtensionElement = function(node, type, parentNode = null, a
|
|
344
343
|
? `Extension element of type <${ type }> only allowed by Camunda Platform ${ allowedVersion }`
|
345
344
|
: `Extension element of type <${ type }> not allowed`,
|
346
345
|
path: getPath(extensionElement, parentNode),
|
347
|
-
data: {
|
346
|
+
data: addAllowedVersion({
|
348
347
|
type: ERROR_TYPES.EXTENSION_ELEMENT_NOT_ALLOWED,
|
349
348
|
node,
|
350
349
|
parentNode: parentNode == node ? null : parentNode,
|
351
|
-
extensionElement
|
352
|
-
|
353
|
-
}
|
350
|
+
extensionElement
|
351
|
+
}, allowedVersion)
|
354
352
|
}
|
355
353
|
];
|
356
354
|
}
|
@@ -407,13 +405,12 @@ module.exports.hasExpression = function(node, propertyName, check, parentNode =
|
|
407
405
|
path: path
|
408
406
|
? [ ...path, propertyName ]
|
409
407
|
: null,
|
410
|
-
data: {
|
408
|
+
data: addAllowedVersion({
|
411
409
|
type: ERROR_TYPES.EXPRESSION_VALUE_NOT_ALLOWED,
|
412
410
|
node: expression,
|
413
411
|
parentNode,
|
414
|
-
property: propertyName
|
415
|
-
|
416
|
-
}
|
412
|
+
property: propertyName
|
413
|
+
}, allowedVersion)
|
417
414
|
}
|
418
415
|
];
|
419
416
|
}
|
@@ -438,3 +435,14 @@ function truncate(string, maxLength = 10) {
|
|
438
435
|
|
439
436
|
return stringified.length > maxLength ? `${ stringified.slice(0, maxLength) }...` : stringified;
|
440
437
|
}
|
438
|
+
|
439
|
+
function addAllowedVersion(data, allowedVersion) {
|
440
|
+
if (!allowedVersion) {
|
441
|
+
return data;
|
442
|
+
}
|
443
|
+
|
444
|
+
return {
|
445
|
+
...data,
|
446
|
+
allowedVersion
|
447
|
+
};
|
448
|
+
}
|