bpmnlint-plugin-camunda-compat 0.22.0 → 0.24.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 +14 -2
- package/package.json +3 -2
- package/rules/history-time-to-live.js +31 -0
- package/rules/no-task-schedule.js +19 -0
- package/rules/no-zeebe-properties.js +0 -6
- package/rules/task-schedule.js +68 -0
- package/rules/utils/element.js +11 -7
- package/rules/utils/rule.js +6 -2
package/index.js
CHANGED
@@ -12,6 +12,7 @@ const camundaCloud10Rules = withConfig({
|
|
12
12
|
'message-reference': 'error',
|
13
13
|
'no-candidate-users': 'error',
|
14
14
|
'no-expression': 'error',
|
15
|
+
'no-task-schedule': 'error',
|
15
16
|
'no-template': 'error',
|
16
17
|
'no-zeebe-properties': 'error',
|
17
18
|
'sequence-flow-condition': 'error',
|
@@ -37,10 +38,18 @@ const camundaCloud81Rules = withConfig({
|
|
37
38
|
}, { version: '8.1' });
|
38
39
|
|
39
40
|
const camundaCloud82Rules = withConfig({
|
40
|
-
...omit(camundaCloud81Rules,
|
41
|
-
|
41
|
+
...omit(camundaCloud81Rules, [
|
42
|
+
'no-candidate-users',
|
43
|
+
'no-task-schedule'
|
44
|
+
]),
|
45
|
+
'escalation-reference': 'error',
|
46
|
+
'task-schedule': 'error'
|
42
47
|
}, { version: '8.2' });
|
43
48
|
|
49
|
+
const camundaPlatform719Rules = withConfig({
|
50
|
+
'history-time-to-live': 'error'
|
51
|
+
}, { platform: 'camunda-platform', version: '7.19' });
|
52
|
+
|
44
53
|
module.exports = {
|
45
54
|
configs: {
|
46
55
|
'camunda-cloud-1-0': {
|
@@ -63,6 +72,9 @@ module.exports = {
|
|
63
72
|
},
|
64
73
|
'camunda-cloud-8-2': {
|
65
74
|
rules: camundaCloud82Rules
|
75
|
+
},
|
76
|
+
'camunda-platform-7-19': {
|
77
|
+
rules: camundaPlatform719Rules
|
66
78
|
}
|
67
79
|
}
|
68
80
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "bpmnlint-plugin-camunda-compat",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.24.0",
|
4
4
|
"description": "A bpmnlint plug-in for Camunda Platform compatibility",
|
5
5
|
"main": "index.js",
|
6
6
|
"scripts": {
|
@@ -33,12 +33,13 @@
|
|
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.18.0"
|
37
37
|
},
|
38
38
|
"dependencies": {
|
39
39
|
"@bpmn-io/feel-lint": "^0.1.1",
|
40
40
|
"@bpmn-io/moddle-utils": "^0.1.0",
|
41
41
|
"bpmnlint-utils": "^1.0.2",
|
42
|
+
"camunda-bpmn-moddle": "^7.0.1",
|
42
43
|
"min-dash": "^3.8.1",
|
43
44
|
"semver-compare": "^1.0.0"
|
44
45
|
},
|
@@ -0,0 +1,31 @@
|
|
1
|
+
const { is } = require('bpmnlint-utils');
|
2
|
+
|
3
|
+
const { hasProperties } = 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
|
+
|
12
|
+
if (!is(node, 'bpmn:Process')) {
|
13
|
+
return;
|
14
|
+
}
|
15
|
+
|
16
|
+
let errors = hasProperties(node, {
|
17
|
+
'historyTimeToLive': {
|
18
|
+
required: true
|
19
|
+
}
|
20
|
+
}, node);
|
21
|
+
|
22
|
+
if (errors) {
|
23
|
+
reportErrors(node, reporter, errors);
|
24
|
+
}
|
25
|
+
return;
|
26
|
+
}
|
27
|
+
|
28
|
+
return {
|
29
|
+
check
|
30
|
+
};
|
31
|
+
});
|
@@ -0,0 +1,19 @@
|
|
1
|
+
const { hasNoExtensionElement } = require('./utils/element');
|
2
|
+
|
3
|
+
const { reportErrors } = require('./utils/reporter');
|
4
|
+
|
5
|
+
const { skipInNonExecutableProcess } = require('./utils/rule');
|
6
|
+
|
7
|
+
module.exports = skipInNonExecutableProcess(function() {
|
8
|
+
function check(node, reporter) {
|
9
|
+
const errors = hasNoExtensionElement(node, 'zeebe:TaskSchedule', node, '8.2');
|
10
|
+
|
11
|
+
if (errors && errors.length) {
|
12
|
+
reportErrors(node, reporter, errors);
|
13
|
+
}
|
14
|
+
}
|
15
|
+
|
16
|
+
return {
|
17
|
+
check
|
18
|
+
};
|
19
|
+
});
|
@@ -1,5 +1,3 @@
|
|
1
|
-
const { is } = require('bpmnlint-utils');
|
2
|
-
|
3
1
|
const { hasNoExtensionElement } = require('./utils/element');
|
4
2
|
|
5
3
|
const { reportErrors } = require('./utils/reporter');
|
@@ -8,10 +6,6 @@ const { skipInNonExecutableProcess } = require('./utils/rule');
|
|
8
6
|
|
9
7
|
module.exports = skipInNonExecutableProcess(function() {
|
10
8
|
function check(node, reporter) {
|
11
|
-
if (!is(node, 'zeebe:PropertiesHolder')) {
|
12
|
-
return;
|
13
|
-
}
|
14
|
-
|
15
9
|
const errors = hasNoExtensionElement(node, 'zeebe:Properties', node, '8.1');
|
16
10
|
|
17
11
|
if (errors && errors.length) {
|
@@ -0,0 +1,68 @@
|
|
1
|
+
const { is } = require('bpmnlint-utils');
|
2
|
+
|
3
|
+
const { isDefined } = require('min-dash');
|
4
|
+
|
5
|
+
const {
|
6
|
+
findExtensionElement,
|
7
|
+
hasExpression
|
8
|
+
} = require('./utils/element');
|
9
|
+
|
10
|
+
const { validateDate: validateISO8601Date } = require('./utils/iso8601');
|
11
|
+
|
12
|
+
const { reportErrors } = require('./utils/reporter');
|
13
|
+
|
14
|
+
const { skipInNonExecutableProcess } = require('./utils/rule');
|
15
|
+
|
16
|
+
module.exports = skipInNonExecutableProcess(function() {
|
17
|
+
function check(node, reporter) {
|
18
|
+
if (!is(node, 'bpmn:UserTask')) {
|
19
|
+
return;
|
20
|
+
}
|
21
|
+
|
22
|
+
const taskSchedule = findExtensionElement(node, 'zeebe:TaskSchedule');
|
23
|
+
|
24
|
+
if (!taskSchedule) {
|
25
|
+
return;
|
26
|
+
}
|
27
|
+
|
28
|
+
const dueDate = taskSchedule.get('dueDate');
|
29
|
+
|
30
|
+
let errors = [];
|
31
|
+
|
32
|
+
if (isDefined(dueDate)) {
|
33
|
+
errors = [
|
34
|
+
...errors,
|
35
|
+
...hasExpression(taskSchedule, 'dueDate', {
|
36
|
+
allowed: date => isValidDate(date)
|
37
|
+
}, node)
|
38
|
+
];
|
39
|
+
}
|
40
|
+
|
41
|
+
const followUpDate = taskSchedule.get('followUpDate');
|
42
|
+
|
43
|
+
if (isDefined(followUpDate)) {
|
44
|
+
errors = [
|
45
|
+
...errors,
|
46
|
+
...hasExpression(taskSchedule, 'followUpDate', {
|
47
|
+
allowed: date => isValidDate(date)
|
48
|
+
}, node)
|
49
|
+
];
|
50
|
+
}
|
51
|
+
|
52
|
+
if (errors.length) {
|
53
|
+
reportErrors(node, reporter, errors);
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
return {
|
58
|
+
check
|
59
|
+
};
|
60
|
+
});
|
61
|
+
|
62
|
+
function isValidDate(value) {
|
63
|
+
return isExpression(value) || validateISO8601Date(value);
|
64
|
+
}
|
65
|
+
|
66
|
+
function isExpression(value) {
|
67
|
+
return value.startsWith('=');
|
68
|
+
}
|
package/rules/utils/element.js
CHANGED
@@ -363,11 +363,15 @@ module.exports.hasExpression = function(node, propertyName, check, parentNode =
|
|
363
363
|
throw new Error('Expression not found');
|
364
364
|
}
|
365
365
|
|
366
|
-
|
366
|
+
let propertyValue = expression;
|
367
|
+
|
368
|
+
if (is(expression, 'bpmn:Expression')) {
|
369
|
+
propertyValue = expression.get('body');
|
370
|
+
}
|
367
371
|
|
368
372
|
const path = getPath(node, parentNode);
|
369
373
|
|
370
|
-
if (!
|
374
|
+
if (!propertyValue) {
|
371
375
|
if (check.required !== false) {
|
372
376
|
return [
|
373
377
|
{
|
@@ -377,7 +381,7 @@ module.exports.hasExpression = function(node, propertyName, check, parentNode =
|
|
377
381
|
: null,
|
378
382
|
data: {
|
379
383
|
type: ERROR_TYPES.EXPRESSION_REQUIRED,
|
380
|
-
node: expression,
|
384
|
+
node: is(expression, 'bpmn:Expression') ? expression : node,
|
381
385
|
parentNode,
|
382
386
|
property: propertyName
|
383
387
|
}
|
@@ -388,7 +392,7 @@ module.exports.hasExpression = function(node, propertyName, check, parentNode =
|
|
388
392
|
return [];
|
389
393
|
}
|
390
394
|
|
391
|
-
const allowed = check.allowed(
|
395
|
+
const allowed = check.allowed(propertyValue);
|
392
396
|
|
393
397
|
if (allowed !== true) {
|
394
398
|
let allowedVersion = null;
|
@@ -400,14 +404,14 @@ module.exports.hasExpression = function(node, propertyName, check, parentNode =
|
|
400
404
|
return [
|
401
405
|
{
|
402
406
|
message: allowedVersion
|
403
|
-
? `Expression value of <${
|
404
|
-
: `Expression value of <${
|
407
|
+
? `Expression value of <${ propertyValue }> only allowed by Camunda Platform ${ allowedVersion }`
|
408
|
+
: `Expression value of <${ propertyValue }> not allowed`,
|
405
409
|
path: path
|
406
410
|
? [ ...path, propertyName ]
|
407
411
|
: null,
|
408
412
|
data: addAllowedVersion({
|
409
413
|
type: ERROR_TYPES.EXPRESSION_VALUE_NOT_ALLOWED,
|
410
|
-
node: expression,
|
414
|
+
node: is(expression, 'bpmn:Expression') ? expression : node,
|
411
415
|
parentNode,
|
412
416
|
property: propertyName
|
413
417
|
}, allowedVersion)
|
package/rules/utils/rule.js
CHANGED
@@ -6,10 +6,14 @@ function skipInNonExecutableProcess(ruleFactory) {
|
|
6
6
|
return function(config = {}) {
|
7
7
|
const rule = ruleFactory(config);
|
8
8
|
|
9
|
-
const { version } = config;
|
9
|
+
const { version, platform = 'camunda-cloud' } = config;
|
10
10
|
|
11
11
|
function check(node, reporter) {
|
12
|
-
if (version && greaterOrEqual(version, '8.2') && isNonExecutableProcess(node)) {
|
12
|
+
if (platform === 'camunda-cloud' && version && greaterOrEqual(version, '8.2') && isNonExecutableProcess(node)) {
|
13
|
+
return false;
|
14
|
+
}
|
15
|
+
|
16
|
+
if (platform === 'camunda-platform' && isNonExecutableProcess(node)) {
|
13
17
|
return false;
|
14
18
|
}
|
15
19
|
|