bpmnlint-plugin-camunda-compat 0.18.0 → 0.20.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 +3 -1
- package/package.json +2 -2
- package/rules/element-type/config.js +4 -0
- package/rules/escalation-reference.js +53 -0
- package/rules/no-candidate-users.js +37 -0
- package/rules/no-expression.js +45 -7
package/index.js
CHANGED
@@ -10,6 +10,7 @@ const camundaCloud10Rules = {
|
|
10
10
|
'executable-process': 'error',
|
11
11
|
'loop-characteristics': 'error',
|
12
12
|
'message-reference': 'error',
|
13
|
+
'no-candidate-users': 'error',
|
13
14
|
'no-expression': [ 'error', { version: '1.0' } ],
|
14
15
|
'no-template': 'error',
|
15
16
|
'no-zeebe-properties': 'error',
|
@@ -62,9 +63,10 @@ const camundaCloud81Rules = {
|
|
62
63
|
};
|
63
64
|
|
64
65
|
const camundaCloud82Rules = {
|
65
|
-
...camundaCloud81Rules,
|
66
|
+
...omit(camundaCloud81Rules, 'no-candidate-users'),
|
66
67
|
'implementation': [ 'error', { version: '8.2' } ],
|
67
68
|
'element-type': [ 'error', { version: '8.2' } ],
|
69
|
+
'escalation-reference': 'error',
|
68
70
|
'no-expression': [ 'error', { version: '8.2' } ],
|
69
71
|
'timer': [ 'error', { version: '8.2' } ]
|
70
72
|
};
|
package/package.json
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
{
|
2
2
|
"name": "bpmnlint-plugin-camunda-compat",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.20.0",
|
4
4
|
"description": "A bpmnlint plug-in for Camunda Platform compatibility",
|
5
5
|
"main": "index.js",
|
6
6
|
"scripts": {
|
7
7
|
"all": "npm run lint && npm test",
|
8
8
|
"dev": "npm run test:watch",
|
9
9
|
"lint": "eslint .",
|
10
|
-
"test": "mocha test/**/*.spec.js",
|
10
|
+
"test": "mocha 'test/**/*.spec.js'",
|
11
11
|
"test:watch": "npm run test -- --watch"
|
12
12
|
},
|
13
13
|
"repository": {
|
@@ -2,6 +2,7 @@ module.exports = {
|
|
2
2
|
'bpmn:Association': '1.0',
|
3
3
|
'bpmn:BoundaryEvent': {
|
4
4
|
'bpmn:ErrorEventDefinition': '1.0',
|
5
|
+
'bpmn:EscalationEventDefinition': '8.2',
|
5
6
|
'bpmn:MessageEventDefinition': '1.0',
|
6
7
|
'bpmn:TimerEventDefinition': '1.0'
|
7
8
|
},
|
@@ -15,6 +16,7 @@ module.exports = {
|
|
15
16
|
'bpmn:EndEvent': {
|
16
17
|
'_': '1.0',
|
17
18
|
'bpmn:ErrorEventDefinition': '1.0',
|
19
|
+
'bpmn:EscalationEventDefinition': '8.2',
|
18
20
|
'bpmn:MessageEventDefinition': '1.2',
|
19
21
|
'bpmn:TerminateEventDefinition': '8.1'
|
20
22
|
},
|
@@ -29,6 +31,7 @@ module.exports = {
|
|
29
31
|
},
|
30
32
|
'bpmn:IntermediateThrowEvent': {
|
31
33
|
'_': '1.1',
|
34
|
+
'bpmn:EscalationEventDefinition': '8.2',
|
32
35
|
'bpmn:MessageEventDefinition': '1.2',
|
33
36
|
'bpmn:LinkEventDefinition': '8.2'
|
34
37
|
},
|
@@ -45,6 +48,7 @@ module.exports = {
|
|
45
48
|
'bpmn:StartEvent': {
|
46
49
|
'_': '1.0',
|
47
50
|
'bpmn:ErrorEventDefinition': '1.0',
|
51
|
+
'bpmn:EscalationEventDefinition': '8.2',
|
48
52
|
'bpmn:MessageEventDefinition': '1.0',
|
49
53
|
'bpmn:TimerEventDefinition': '1.0'
|
50
54
|
},
|
@@ -0,0 +1,53 @@
|
|
1
|
+
const {
|
2
|
+
is,
|
3
|
+
isAny
|
4
|
+
} = require('bpmnlint-utils');
|
5
|
+
|
6
|
+
const {
|
7
|
+
getEventDefinition,
|
8
|
+
hasProperties
|
9
|
+
} = require('./utils/element');
|
10
|
+
|
11
|
+
const { reportErrors } = require('./utils/reporter');
|
12
|
+
|
13
|
+
module.exports = function() {
|
14
|
+
function check(node, reporter) {
|
15
|
+
if (!isAny(node, [ 'bpmn:CatchEvent', 'bpmn:ThrowEvent' ])) {
|
16
|
+
return;
|
17
|
+
}
|
18
|
+
|
19
|
+
const eventDefinition = getEventDefinition(node);
|
20
|
+
|
21
|
+
if (!eventDefinition || !is(eventDefinition, 'bpmn:EscalationEventDefinition')) {
|
22
|
+
return;
|
23
|
+
}
|
24
|
+
|
25
|
+
let errors = hasProperties(eventDefinition, {
|
26
|
+
escalationRef: {
|
27
|
+
required: true
|
28
|
+
}
|
29
|
+
}, node);
|
30
|
+
|
31
|
+
if (errors && errors.length) {
|
32
|
+
reportErrors(node, reporter, errors);
|
33
|
+
|
34
|
+
return;
|
35
|
+
}
|
36
|
+
|
37
|
+
const escalationRef = eventDefinition.get('escalationRef');
|
38
|
+
|
39
|
+
errors = hasProperties(escalationRef, {
|
40
|
+
escalationCode: {
|
41
|
+
required: true
|
42
|
+
}
|
43
|
+
}, node);
|
44
|
+
|
45
|
+
if (errors && errors.length) {
|
46
|
+
reportErrors(node, reporter, errors);
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
return {
|
51
|
+
check
|
52
|
+
};
|
53
|
+
};
|
@@ -0,0 +1,37 @@
|
|
1
|
+
const { is } = require('bpmnlint-utils');
|
2
|
+
|
3
|
+
const {
|
4
|
+
findExtensionElement,
|
5
|
+
hasProperties
|
6
|
+
} = require('./utils/element');
|
7
|
+
|
8
|
+
const { reportErrors } = require('./utils/reporter');
|
9
|
+
|
10
|
+
module.exports = function() {
|
11
|
+
function check(node, reporter) {
|
12
|
+
if (!is(node, 'bpmn:UserTask')) {
|
13
|
+
return;
|
14
|
+
}
|
15
|
+
|
16
|
+
const assignmentDefinition = findExtensionElement(node, 'zeebe:AssignmentDefinition');
|
17
|
+
|
18
|
+
if (!assignmentDefinition) {
|
19
|
+
return;
|
20
|
+
}
|
21
|
+
|
22
|
+
const errors = hasProperties(assignmentDefinition, {
|
23
|
+
candidateUsers: {
|
24
|
+
allowed: false,
|
25
|
+
allowedVersion: '8.2'
|
26
|
+
}
|
27
|
+
}, node);
|
28
|
+
|
29
|
+
if (errors && errors.length) {
|
30
|
+
reportErrors(node, reporter, errors);
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
return {
|
35
|
+
check
|
36
|
+
};
|
37
|
+
};
|
package/rules/no-expression.js
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
const {
|
2
|
-
is
|
3
|
-
isAny
|
2
|
+
is
|
4
3
|
} = require('bpmnlint-utils');
|
5
4
|
|
6
5
|
const { getPath } = require('@bpmn-io/moddle-utils');
|
@@ -31,7 +30,10 @@ const handlersMap = {
|
|
31
30
|
'8.1': [
|
32
31
|
checkErrorCode
|
33
32
|
],
|
34
|
-
'8.2': [
|
33
|
+
'8.2': [
|
34
|
+
checkErrorCatchEvent,
|
35
|
+
checkEscalationCatchEvent
|
36
|
+
]
|
35
37
|
};
|
36
38
|
|
37
39
|
module.exports = noExpressionRule;
|
@@ -58,7 +60,7 @@ function checkForVersion(node, version) {
|
|
58
60
|
const handlers = handlersMap[version];
|
59
61
|
|
60
62
|
return handlers.reduce((errors, handler) => {
|
61
|
-
const handlerErrors = handler(node
|
63
|
+
const handlerErrors = handler(node) || [];
|
62
64
|
return errors.concat(handlerErrors);
|
63
65
|
}, []);
|
64
66
|
}
|
@@ -71,8 +73,12 @@ function noExpression(node, propertyName, parentNode, allowedVersion) {
|
|
71
73
|
return;
|
72
74
|
}
|
73
75
|
|
76
|
+
const errorMessage = allowedVersion ?
|
77
|
+
`Expression statement <${truncate(propertyValue)}> only supported by Camunda Platform ${allowedVersion} or newer` :
|
78
|
+
`Expression statement <${truncate(propertyValue)}> not supported`;
|
79
|
+
|
74
80
|
return {
|
75
|
-
message:
|
81
|
+
message: errorMessage,
|
76
82
|
path: path
|
77
83
|
? [ ...path, propertyName ]
|
78
84
|
: [ propertyName ],
|
@@ -91,7 +97,7 @@ function isExpression(value) {
|
|
91
97
|
}
|
92
98
|
|
93
99
|
function checkErrorCode(node) {
|
94
|
-
if (!
|
100
|
+
if (!is(node, 'bpmn:Event')) {
|
95
101
|
return;
|
96
102
|
}
|
97
103
|
|
@@ -107,7 +113,39 @@ function checkErrorCode(node) {
|
|
107
113
|
return;
|
108
114
|
}
|
109
115
|
|
110
|
-
|
116
|
+
if (is(node, 'bpmn:CatchEvent')) {
|
117
|
+
return noExpression(errorRef, 'errorCode', node, null);
|
118
|
+
} else {
|
119
|
+
return noExpression(errorRef, 'errorCode', node, '8.2');
|
120
|
+
}
|
121
|
+
}
|
122
|
+
|
123
|
+
function checkErrorCatchEvent(node) {
|
124
|
+
if (!is(node, 'bpmn:CatchEvent')) {
|
125
|
+
return;
|
126
|
+
}
|
127
|
+
|
128
|
+
return checkErrorCode(node);
|
129
|
+
}
|
130
|
+
|
131
|
+
function checkEscalationCatchEvent(node) {
|
132
|
+
if (!is(node, 'bpmn:CatchEvent')) {
|
133
|
+
return;
|
134
|
+
}
|
135
|
+
|
136
|
+
const eventDefinition = getEventDefinition(node);
|
137
|
+
|
138
|
+
if (!eventDefinition || !is(eventDefinition, 'bpmn:EscalationEventDefinition')) {
|
139
|
+
return;
|
140
|
+
}
|
141
|
+
|
142
|
+
const escalationRef = eventDefinition.get('escalationRef');
|
143
|
+
|
144
|
+
if (!escalationRef) {
|
145
|
+
return;
|
146
|
+
}
|
147
|
+
|
148
|
+
return noExpression(escalationRef, 'escalationCode', node, null);
|
111
149
|
}
|
112
150
|
|
113
151
|
function truncate(string, maxLength = 10) {
|