bpmnlint-plugin-camunda-compat 2.3.0 → 2.5.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
@@ -14,10 +14,12 @@ const camundaCloud10Rules = withConfig({
|
|
14
14
|
'no-candidate-users': 'error',
|
15
15
|
'no-expression': 'error',
|
16
16
|
'no-multiple-none-start-events': 'error',
|
17
|
+
'no-propagate-all-parent-variables': 'error',
|
17
18
|
'no-task-schedule': 'error',
|
18
19
|
'no-template': 'error',
|
19
20
|
'no-zeebe-properties': 'error',
|
20
21
|
'sequence-flow-condition': 'error',
|
22
|
+
'start-form': 'error',
|
21
23
|
'subscription': 'error',
|
22
24
|
'timer': 'error',
|
23
25
|
'user-task-form': 'error',
|
@@ -31,7 +33,8 @@ const camundaCloud12Rules = withConfig(camundaCloud11Rules, { version: '1.2' });
|
|
31
33
|
const camundaCloud13Rules = withConfig(camundaCloud12Rules, { version: '1.3' });
|
32
34
|
|
33
35
|
const camundaCloud80Rules = withConfig({
|
34
|
-
...omit(camundaCloud13Rules, 'no-template')
|
36
|
+
...omit(camundaCloud13Rules, 'no-template'),
|
37
|
+
'secrets': 'error'
|
35
38
|
}, { version: '8.0' });
|
36
39
|
|
37
40
|
const camundaCloud81Rules = withConfig({
|
@@ -42,6 +45,7 @@ const camundaCloud81Rules = withConfig({
|
|
42
45
|
const camundaCloud82Rules = withConfig({
|
43
46
|
...omit(camundaCloud81Rules, [
|
44
47
|
'no-candidate-users',
|
48
|
+
'no-propagate-all-parent-variables',
|
45
49
|
'no-task-schedule'
|
46
50
|
]),
|
47
51
|
'escalation-boundary-event-attached-to-ref': 'error',
|
@@ -51,7 +55,9 @@ const camundaCloud82Rules = withConfig({
|
|
51
55
|
}, { version: '8.2' });
|
52
56
|
|
53
57
|
const camundaCloud83Rules = withConfig({
|
54
|
-
...camundaCloud82Rules,
|
58
|
+
...omit(camundaCloud82Rules, [
|
59
|
+
'start-form'
|
60
|
+
]),
|
55
61
|
'signal-reference': 'error'
|
56
62
|
}, { version: '8.3' });
|
57
63
|
|
@@ -86,12 +92,15 @@ const rules = {
|
|
86
92
|
'no-candidate-users': './rules/camunda-cloud/no-candidate-users',
|
87
93
|
'no-expression': './rules/camunda-cloud/no-expression',
|
88
94
|
'no-multiple-none-start-events': './rules/camunda-cloud/no-multiple-none-start-events',
|
95
|
+
'no-propagate-all-parent-variables': './rules/camunda-cloud/no-propagate-all-parent-variables',
|
89
96
|
'no-signal-event-sub-process': './rules/camunda-cloud/no-signal-event-sub-process',
|
90
97
|
'no-task-schedule': './rules/camunda-cloud/no-task-schedule',
|
91
98
|
'no-template': './rules/camunda-cloud/no-template',
|
92
99
|
'no-zeebe-properties': './rules/camunda-cloud/no-zeebe-properties',
|
100
|
+
'secrets': './rules/camunda-cloud/secrets',
|
93
101
|
'sequence-flow-condition': './rules/camunda-cloud/sequence-flow-condition',
|
94
102
|
'signal-reference': './rules/camunda-cloud/signal-reference',
|
103
|
+
'start-form': './rules/camunda-cloud/start-form',
|
95
104
|
'subscription': './rules/camunda-cloud/subscription',
|
96
105
|
'task-schedule': './rules/camunda-cloud/task-schedule',
|
97
106
|
'timer': './rules/camunda-cloud/timer',
|
package/package.json
CHANGED
@@ -0,0 +1,39 @@
|
|
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
|
+
const { skipInNonExecutableProcess } = require('../utils/rule');
|
11
|
+
|
12
|
+
module.exports = skipInNonExecutableProcess(function() {
|
13
|
+
function check(node, reporter) {
|
14
|
+
if (!is(node, 'bpmn:CallActivity')) {
|
15
|
+
return;
|
16
|
+
}
|
17
|
+
|
18
|
+
const calledElement = findExtensionElement(node, 'zeebe:CalledElement');
|
19
|
+
|
20
|
+
if (!calledElement) {
|
21
|
+
return;
|
22
|
+
}
|
23
|
+
|
24
|
+
const errors = hasProperties(calledElement, {
|
25
|
+
propagateAllParentVariables: {
|
26
|
+
allowed: false,
|
27
|
+
allowedVersion: '8.2'
|
28
|
+
}
|
29
|
+
}, node);
|
30
|
+
|
31
|
+
if (errors && errors.length) {
|
32
|
+
reportErrors(node, reporter, errors);
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
return {
|
37
|
+
check
|
38
|
+
};
|
39
|
+
});
|
@@ -0,0 +1,115 @@
|
|
1
|
+
const { isString } = require('min-dash');
|
2
|
+
|
3
|
+
const { is } = require('bpmnlint-utils');
|
4
|
+
|
5
|
+
const { getPath } = require('@bpmn-io/moddle-utils');
|
6
|
+
|
7
|
+
const {
|
8
|
+
findExtensionElement,
|
9
|
+
getEventDefinition
|
10
|
+
} = require('../utils/element');
|
11
|
+
|
12
|
+
const { ERROR_TYPES } = require('../utils/error-types');
|
13
|
+
|
14
|
+
const { reportErrors } = require('../utils/reporter');
|
15
|
+
|
16
|
+
const { skipInNonExecutableProcess } = require('../utils/rule');
|
17
|
+
|
18
|
+
module.exports = skipInNonExecutableProcess(function() {
|
19
|
+
function check(node, reporter) {
|
20
|
+
const errors = [
|
21
|
+
validateIoMapping,
|
22
|
+
validateProperties,
|
23
|
+
validateSubscription
|
24
|
+
].reduce((errors, validationFunction) => {
|
25
|
+
return [
|
26
|
+
...errors,
|
27
|
+
...validationFunction(node)
|
28
|
+
];
|
29
|
+
}, []);
|
30
|
+
|
31
|
+
if (errors.length) {
|
32
|
+
reportErrors(node, reporter, errors);
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
return {
|
37
|
+
check
|
38
|
+
};
|
39
|
+
});
|
40
|
+
|
41
|
+
function validateIoMapping(node) {
|
42
|
+
const ioMapping = findExtensionElement(node, 'zeebe:IoMapping');
|
43
|
+
|
44
|
+
if (!ioMapping) {
|
45
|
+
return [];
|
46
|
+
}
|
47
|
+
|
48
|
+
return ioMapping.get('inputParameters')
|
49
|
+
.filter(inputParameter => !isValidSecret(inputParameter.get('source')))
|
50
|
+
.map(inputParameter => getReport('source', inputParameter, node));
|
51
|
+
}
|
52
|
+
|
53
|
+
function validateProperties(node) {
|
54
|
+
const properties = findExtensionElement(node, 'zeebe:Properties');
|
55
|
+
|
56
|
+
if (!properties) {
|
57
|
+
return [];
|
58
|
+
}
|
59
|
+
|
60
|
+
return (properties.get('properties'))
|
61
|
+
.filter(property => !isValidSecret(property.get('value')))
|
62
|
+
.map(property => getReport('value', property, node));
|
63
|
+
}
|
64
|
+
|
65
|
+
function validateSubscription(node) {
|
66
|
+
let message;
|
67
|
+
|
68
|
+
if (is(node, 'bpmn:ReceiveTask')) {
|
69
|
+
message = node.get('messageRef');
|
70
|
+
} else {
|
71
|
+
const messageEventDefinition = getEventDefinition(node, 'bpmn:MessageEventDefinition');
|
72
|
+
|
73
|
+
if (!messageEventDefinition) {
|
74
|
+
return [];
|
75
|
+
}
|
76
|
+
|
77
|
+
message = messageEventDefinition.get('messageRef');
|
78
|
+
}
|
79
|
+
|
80
|
+
if (!message) {
|
81
|
+
return [];
|
82
|
+
}
|
83
|
+
|
84
|
+
const subscription = findExtensionElement(message, 'zeebe:Subscription');
|
85
|
+
|
86
|
+
if (!subscription) {
|
87
|
+
return [];
|
88
|
+
}
|
89
|
+
|
90
|
+
const correlationKey = subscription.get('correlationKey');
|
91
|
+
|
92
|
+
return isValidSecret(correlationKey)
|
93
|
+
? []
|
94
|
+
: [ getReport('correlationKey', subscription, node) ];
|
95
|
+
}
|
96
|
+
|
97
|
+
function getReport(propertyName, node, parentNode) {
|
98
|
+
return {
|
99
|
+
message: `Property <${ propertyName }> is not a valid secret`,
|
100
|
+
path: [ ...getPath(node, parentNode), propertyName ],
|
101
|
+
data: {
|
102
|
+
type: ERROR_TYPES.SECRET_EXPRESSION_INVALID,
|
103
|
+
node,
|
104
|
+
parentNode: parentNode,
|
105
|
+
property: propertyName
|
106
|
+
}
|
107
|
+
};
|
108
|
+
}
|
109
|
+
|
110
|
+
function isValidSecret(value) {
|
111
|
+
return !value
|
112
|
+
|| !isString(value)
|
113
|
+
|| !value.includes('secrets.')
|
114
|
+
|| /{{secrets\.[a-zA-Z0-9_]+}}/.test(value);
|
115
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
const { is } = require('bpmnlint-utils');
|
2
|
+
|
3
|
+
const { hasNoExtensionElement } = require('../utils/element');
|
4
|
+
|
5
|
+
const { reportErrors } = require('../utils/reporter');
|
6
|
+
|
7
|
+
const { skipInNonExecutableProcess } = require('../utils/rule');
|
8
|
+
|
9
|
+
const { greaterOrEqual } = require('../utils/version');
|
10
|
+
|
11
|
+
const startFormAllowedVersion = '8.3';
|
12
|
+
|
13
|
+
module.exports = skipInNonExecutableProcess(function({ version }) {
|
14
|
+
function check(node, reporter) {
|
15
|
+
if (!is(node, 'bpmn:StartEvent') || greaterOrEqual(version, startFormAllowedVersion)) {
|
16
|
+
return;
|
17
|
+
}
|
18
|
+
|
19
|
+
let errors = hasNoExtensionElement(node, 'zeebe:FormDefinition', node, startFormAllowedVersion);
|
20
|
+
|
21
|
+
if (errors.length) {
|
22
|
+
reportErrors(node, reporter, errors);
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
return {
|
27
|
+
check
|
28
|
+
};
|
29
|
+
});
|
@@ -17,5 +17,6 @@ module.exports.ERROR_TYPES = Object.freeze({
|
|
17
17
|
PROPERTY_TYPE_NOT_ALLOWED: 'camunda.propertyTypeNotAllowed',
|
18
18
|
PROPERTY_VALUE_DUPLICATED: 'camunda.propertyValueDuplicated',
|
19
19
|
PROPERTY_VALUE_NOT_ALLOWED: 'camunda.propertyValueNotAllowed',
|
20
|
-
PROPERTY_VALUE_REQUIRED: 'camunda.propertyValueRequired'
|
20
|
+
PROPERTY_VALUE_REQUIRED: 'camunda.propertyValueRequired',
|
21
|
+
SECRET_EXPRESSION_INVALID: 'camunda.secretExpressionInvalid'
|
21
22
|
});
|