bpmnlint-plugin-camunda-compat 2.19.0 → 2.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
CHANGED
@@ -37,6 +37,7 @@ const camundaCloud13Rules = withConfig(camundaCloud12Rules, { version: '1.3' });
|
|
37
37
|
|
38
38
|
const camundaCloud80Rules = withConfig({
|
39
39
|
...omit(camundaCloud13Rules, 'no-template'),
|
40
|
+
'connector-properties': 'warn'
|
40
41
|
}, { version: '8.0' });
|
41
42
|
|
42
43
|
const camundaCloud81Rules = withConfig({
|
@@ -102,6 +103,7 @@ const rules = {
|
|
102
103
|
'element-type': './rules/camunda-cloud/element-type',
|
103
104
|
'called-element': './rules/camunda-cloud/called-element',
|
104
105
|
'collapsed-subprocess': './rules/camunda-cloud/collapsed-subprocess',
|
106
|
+
'connector-properties': './rules/camunda-cloud/connector-properties',
|
105
107
|
'duplicate-task-headers': './rules/camunda-cloud/duplicate-task-headers',
|
106
108
|
'error-reference': './rules/camunda-cloud/error-reference',
|
107
109
|
'escalation-boundary-event-attached-to-ref': './rules/camunda-cloud/escalation-boundary-event-attached-to-ref',
|
package/package.json
CHANGED
@@ -0,0 +1,93 @@
|
|
1
|
+
const { getPath } = require('@bpmn-io/moddle-utils');
|
2
|
+
|
3
|
+
const { findExtensionElement } = require('../../utils/element');
|
4
|
+
|
5
|
+
const { ERROR_TYPES } = require('../../utils/error-types');
|
6
|
+
|
7
|
+
const INBOUND_CONNECTOR_PROPERTY = 'inbound.type';
|
8
|
+
|
9
|
+
module.exports = {
|
10
|
+
messageTtl: {
|
11
|
+
version: '8.6',
|
12
|
+
getError: (node) => getInboundConnectorError(node, 'messageTtl', '8.6'),
|
13
|
+
getProperty: (node) => getZeebeProperty(node, 'messageTtl'),
|
14
|
+
isConnector: (node) => isInboundConnector(node, [
|
15
|
+
'io.camunda:webhook:1',
|
16
|
+
'io.camunda:connector-rabbitmq-inbound:1',
|
17
|
+
'io.camunda:http-polling:1',
|
18
|
+
'io.camunda:connector-kafka-inbound:1',
|
19
|
+
'io.camunda:slack-webhook:1',
|
20
|
+
'io.camunda:aws-sqs-inbound:1',
|
21
|
+
'io.camunda:aws-sns-webhook:1'
|
22
|
+
])
|
23
|
+
},
|
24
|
+
consumeUnmatchedEvents: {
|
25
|
+
version: '8.6',
|
26
|
+
getError: (node) => getInboundConnectorError(node, 'consumeUnmatchedEvents', '8.6'),
|
27
|
+
getProperty: (node) => getZeebeProperty(node, 'consumeUnmatchedEvents'),
|
28
|
+
isConnector: (node) => isInboundConnector(node, [
|
29
|
+
'io.camunda:webhook:1',
|
30
|
+
'io.camunda:connector-rabbitmq-inbound:1',
|
31
|
+
'io.camunda:http-polling:1',
|
32
|
+
'io.camunda:connector-kafka-inbound:1',
|
33
|
+
'io.camunda:slack-webhook:1',
|
34
|
+
'io.camunda:aws-sqs-inbound:1',
|
35
|
+
'io.camunda:aws-sns-webhook:1'
|
36
|
+
])
|
37
|
+
},
|
38
|
+
deduplicationModeManualFlag: {
|
39
|
+
version: '8.6',
|
40
|
+
getError: (node) => getInboundConnectorError(node, 'deduplicationModeManualFlag', '8.6'),
|
41
|
+
getProperty: (node) => getZeebeProperty(node, 'deduplicationModeManualFlag'),
|
42
|
+
isConnector: (node) => isInboundConnector(node, [
|
43
|
+
'io.camunda:connector-rabbitmq-inbound:1',
|
44
|
+
'io.camunda:http-polling:1',
|
45
|
+
'io.camunda:connector-kafka-inbound:1',
|
46
|
+
'io.camunda:aws-sqs-inbound:1'
|
47
|
+
])
|
48
|
+
}
|
49
|
+
};
|
50
|
+
|
51
|
+
function isInboundConnector(node, names) {
|
52
|
+
const zeebeProperty = getZeebeProperty(node, INBOUND_CONNECTOR_PROPERTY);
|
53
|
+
|
54
|
+
return zeebeProperty && names.includes(zeebeProperty.get('value'));
|
55
|
+
}
|
56
|
+
|
57
|
+
function getZeebeProperty(node, propertyName) {
|
58
|
+
const zeebeProperties = findExtensionElement(node, 'zeebe:Properties');
|
59
|
+
|
60
|
+
if (!zeebeProperties) {
|
61
|
+
return false;
|
62
|
+
}
|
63
|
+
|
64
|
+
return zeebeProperties.get('properties').find(property => {
|
65
|
+
return property.get('name') === propertyName;
|
66
|
+
});
|
67
|
+
}
|
68
|
+
|
69
|
+
function getInboundConnectorError(node, propertyName, allowedVersion) {
|
70
|
+
const property = getZeebeProperty(node, propertyName);
|
71
|
+
|
72
|
+
const connectorProperty = getZeebeProperty(node, INBOUND_CONNECTOR_PROPERTY);
|
73
|
+
|
74
|
+
const path = getPath(property, node);
|
75
|
+
|
76
|
+
return {
|
77
|
+
message: `Connector property <name> with value <${ propertyName }> only allowed by Camunda ${ allowedVersion } or newer.`,
|
78
|
+
path: path ? [ ...path, 'name' ] : [ 'name' ],
|
79
|
+
data: {
|
80
|
+
type: ERROR_TYPES.CONNECTORS_PROPERTY_VALUE_NOT_ALLOWED,
|
81
|
+
node: property,
|
82
|
+
parentNode: node,
|
83
|
+
property: 'name',
|
84
|
+
connectorProperty: {
|
85
|
+
type: connectorProperty,
|
86
|
+
properties: {
|
87
|
+
name: connectorProperty.get('name'),
|
88
|
+
value: connectorProperty.get('value')
|
89
|
+
}
|
90
|
+
}
|
91
|
+
}
|
92
|
+
};
|
93
|
+
}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
const { isAny } = require('bpmnlint-utils');
|
2
|
+
|
3
|
+
const config = require('./config');
|
4
|
+
|
5
|
+
const { reportErrors } = require('../../utils/reporter');
|
6
|
+
|
7
|
+
const { skipInNonExecutableProcess } = require('../../utils/rule');
|
8
|
+
|
9
|
+
const { greaterOrEqual } = require('../../utils/version');
|
10
|
+
|
11
|
+
module.exports = skipInNonExecutableProcess(function({ version }) {
|
12
|
+
function check(node, reporter) {
|
13
|
+
if (!isAny(node, [ 'bpmn:FlowElement', 'bpmn:FlowElementsContainer' ])) {
|
14
|
+
return;
|
15
|
+
}
|
16
|
+
|
17
|
+
const errors = Object.entries(config).reduce((errors, [ propertyName, {
|
18
|
+
getError,
|
19
|
+
getProperty,
|
20
|
+
isConnector,
|
21
|
+
version: allowedVersion
|
22
|
+
} ]) => {
|
23
|
+
if (greaterOrEqual(version, allowedVersion) || !isConnector(node)) {
|
24
|
+
return errors;
|
25
|
+
}
|
26
|
+
|
27
|
+
const property = getProperty(node);
|
28
|
+
|
29
|
+
if (property) {
|
30
|
+
return [
|
31
|
+
...errors,
|
32
|
+
getError(node)
|
33
|
+
];
|
34
|
+
}
|
35
|
+
|
36
|
+
return errors;
|
37
|
+
}, []);
|
38
|
+
|
39
|
+
if (errors.length) {
|
40
|
+
reportErrors(node, reporter, errors);
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
return {
|
45
|
+
check
|
46
|
+
};
|
47
|
+
});
|
@@ -1,5 +1,6 @@
|
|
1
1
|
module.exports.ERROR_TYPES = Object.freeze({
|
2
2
|
CHILD_ELEMENT_TYPE_NOT_ALLOWED: 'camunda.childElementTypeNotAllowed',
|
3
|
+
CONNECTORS_PROPERTY_VALUE_NOT_ALLOWED: 'camunda.connectors.propertyValueNotAllowed',
|
3
4
|
ELEMENT_COLLAPSED_NOT_ALLOWED: 'camunda.elementCollapsedNotAllowed',
|
4
5
|
ELEMENT_MULTIPLE_NOT_ALLOWED: 'camunda.elementMultipleNotAllowed',
|
5
6
|
ELEMENT_TYPE_NOT_ALLOWED: 'camunda.elementTypeNotAllowed',
|