bpmnlint-plugin-camunda-compat 1.1.0 → 1.2.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
@@ -7,6 +7,7 @@ const camundaCloud10Rules = withConfig({
|
|
7
7
|
'duplicate-task-headers': 'error',
|
8
8
|
'element-type': 'error',
|
9
9
|
'error-reference': 'error',
|
10
|
+
'event-based-gateway-target': 'error',
|
10
11
|
'executable-process': 'error',
|
11
12
|
'loop-characteristics': 'error',
|
12
13
|
'message-reference': 'error',
|
package/package.json
CHANGED
@@ -0,0 +1,39 @@
|
|
1
|
+
const { is } = require('bpmnlint-utils');
|
2
|
+
|
3
|
+
const { ERROR_TYPES } = 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
|
+
if (!is(node, 'bpmn:ReceiveTask')) {
|
12
|
+
return;
|
13
|
+
}
|
14
|
+
|
15
|
+
// receive task as event-based gateway target is allowed by BPMN 2.0 but not
|
16
|
+
// supported by Zeebe
|
17
|
+
const error = node.get('incoming').some((sequenceFlow) => {
|
18
|
+
const source = sequenceFlow.get('sourceRef');
|
19
|
+
|
20
|
+
return is(source, 'bpmn:EventBasedGateway');
|
21
|
+
});
|
22
|
+
|
23
|
+
if (error) {
|
24
|
+
reportErrors(node, reporter, {
|
25
|
+
message: 'Element of type <bpmn:ReceiveTask> not allowed as event-based gateway target',
|
26
|
+
path: null,
|
27
|
+
data: {
|
28
|
+
type: ERROR_TYPES.EVENT_BASED_GATEWAY_TARGET_NOT_ALLOWED,
|
29
|
+
node,
|
30
|
+
parentNode: null
|
31
|
+
}
|
32
|
+
});
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
return {
|
37
|
+
check
|
38
|
+
};
|
39
|
+
});
|
@@ -1,6 +1,12 @@
|
|
1
|
-
const {
|
1
|
+
const {
|
2
|
+
is,
|
3
|
+
isAny
|
4
|
+
} = require('bpmnlint-utils');
|
2
5
|
|
3
|
-
const {
|
6
|
+
const {
|
7
|
+
ERROR_TYPES,
|
8
|
+
hasProperties
|
9
|
+
} = require('./utils/element');
|
4
10
|
|
5
11
|
const { reportErrors } = require('./utils/reporter');
|
6
12
|
|
@@ -8,26 +14,40 @@ const { skipInNonExecutableProcess } = require('./utils/rule');
|
|
8
14
|
|
9
15
|
module.exports = skipInNonExecutableProcess(function() {
|
10
16
|
function check(node, reporter) {
|
11
|
-
if (
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
17
|
+
if (isAny(node, [ 'bpmn:ExclusiveGateway', 'bpmn:InclusiveGateway' ])) {
|
18
|
+
const outgoing = node.get('outgoing');
|
19
|
+
|
20
|
+
if (outgoing && outgoing.length > 1) {
|
21
|
+
for (let sequenceFlow of outgoing) {
|
22
|
+
if (node.get('default') !== sequenceFlow) {
|
23
|
+
const errors = hasProperties(sequenceFlow, {
|
24
|
+
conditionExpression: {
|
25
|
+
required: true
|
26
|
+
}
|
27
|
+
}, sequenceFlow);
|
28
|
+
|
29
|
+
if (errors.length) {
|
30
|
+
reportErrors(sequenceFlow, reporter, errors);
|
23
31
|
}
|
24
|
-
}, sequenceFlow);
|
25
|
-
|
26
|
-
if (errors.length) {
|
27
|
-
reportErrors(sequenceFlow, reporter, errors);
|
28
32
|
}
|
29
33
|
}
|
30
34
|
}
|
35
|
+
} else if (is(node, 'bpmn:SequenceFlow')) {
|
36
|
+
const source = node.get('sourceRef'),
|
37
|
+
conditionExpression = node.get('conditionExpression');
|
38
|
+
|
39
|
+
if (!isAny(source, [ 'bpmn:ExclusiveGateway', 'bpmn:InclusiveGateway' ]) && conditionExpression) {
|
40
|
+
reportErrors(node, reporter, {
|
41
|
+
message: 'Property <conditionExpression> only allowed if source is of type <bpmn:ExclusiveGateway> or <bpmn:InclusiveGateway>',
|
42
|
+
path: [ 'conditionExpression' ],
|
43
|
+
data: {
|
44
|
+
type: ERROR_TYPES.PROPERTY_NOT_ALLOWED,
|
45
|
+
node: node,
|
46
|
+
parentNode: null,
|
47
|
+
property: 'conditionExpression'
|
48
|
+
}
|
49
|
+
});
|
50
|
+
}
|
31
51
|
}
|
32
52
|
}
|
33
53
|
|
@@ -2,6 +2,7 @@ module.exports.ERROR_TYPES = Object.freeze({
|
|
2
2
|
ELEMENT_COLLAPSED_NOT_ALLOWED: 'camunda.elementCollapsedNotAllowed',
|
3
3
|
CHILD_ELEMENT_TYPE_NOT_ALLOWED: 'camunda.childElementTypeNotAllowed',
|
4
4
|
ELEMENT_TYPE_NOT_ALLOWED: 'camunda.elementTypeNotAllowed',
|
5
|
+
EVENT_BASED_GATEWAY_TARGET_NOT_ALLOWED: 'camunda.eventBasedGatewayTargetNotAllowed',
|
5
6
|
EXPRESSION_NOT_ALLOWED: 'camunda.expressionNotAllowed',
|
6
7
|
EXPRESSION_REQUIRED: 'camunda.expressionRequired',
|
7
8
|
EXPRESSION_VALUE_NOT_ALLOWED: 'camunda.expressionValueNotAllowed',
|