bpmnlint-plugin-camunda-compat 2.21.1 → 2.23.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/LICENSE +20 -20
- package/README.md +39 -39
- package/index.js +237 -224
- package/package.json +53 -53
- package/rules/camunda-cloud/called-element.js +42 -42
- package/rules/camunda-cloud/collapsed-subprocess.js +40 -40
- package/rules/camunda-cloud/connector-properties/config.js +90 -90
- package/rules/camunda-cloud/connector-properties/index.js +47 -47
- package/rules/camunda-cloud/duplicate-execution-listeners.js +33 -0
- package/rules/camunda-cloud/duplicate-task-headers.js +58 -58
- package/rules/camunda-cloud/element-type/config.js +66 -66
- package/rules/camunda-cloud/element-type/index.js +133 -133
- package/rules/camunda-cloud/error-reference.js +71 -71
- package/rules/camunda-cloud/escalation-boundary-event-attached-to-ref.js +48 -48
- package/rules/camunda-cloud/escalation-reference.js +66 -66
- package/rules/camunda-cloud/event-based-gateway-target.js +38 -38
- package/rules/camunda-cloud/executable-process.js +61 -61
- package/rules/camunda-cloud/execution-listener.js +34 -0
- package/rules/camunda-cloud/feel.js +82 -82
- package/rules/camunda-cloud/implementation/config.js +16 -16
- package/rules/camunda-cloud/implementation/index.js +218 -218
- package/rules/camunda-cloud/inclusive-gateway.js +35 -35
- package/rules/camunda-cloud/link-event.js +142 -142
- package/rules/camunda-cloud/loop-characteristics.js +66 -66
- package/rules/camunda-cloud/message-reference.js +60 -60
- package/rules/camunda-cloud/no-binding-type.js +44 -0
- package/rules/camunda-cloud/no-candidate-users.js +38 -38
- package/rules/camunda-cloud/no-execution-listeners.js +21 -0
- package/rules/camunda-cloud/no-expression.js +173 -173
- package/rules/camunda-cloud/no-loop.js +316 -316
- package/rules/camunda-cloud/no-multiple-none-start-events.js +41 -41
- package/rules/camunda-cloud/no-propagate-all-parent-variables.js +44 -44
- package/rules/camunda-cloud/no-signal-event-sub-process.js +45 -45
- package/rules/camunda-cloud/no-task-schedule.js +18 -18
- package/rules/camunda-cloud/no-template.js +23 -23
- package/rules/camunda-cloud/no-zeebe-properties.js +18 -18
- package/rules/camunda-cloud/no-zeebe-user-task.js +27 -27
- package/rules/camunda-cloud/secrets.js +119 -119
- package/rules/camunda-cloud/sequence-flow-condition.js +56 -56
- package/rules/camunda-cloud/signal-reference.js +64 -64
- package/rules/camunda-cloud/start-event-form.js +97 -97
- package/rules/camunda-cloud/subscription.js +65 -65
- package/rules/camunda-cloud/task-schedule.js +67 -67
- package/rules/camunda-cloud/timer/config.js +46 -46
- package/rules/camunda-cloud/timer/index.js +183 -183
- package/rules/camunda-cloud/user-task-definition.js +24 -24
- package/rules/camunda-cloud/user-task-form.js +142 -142
- package/rules/camunda-cloud/wait-for-completion.js +46 -46
- package/rules/camunda-platform/history-time-to-live.js +19 -19
- package/rules/utils/cron.js +95 -95
- package/rules/utils/element.js +533 -484
- package/rules/utils/error-types.js +25 -24
- package/rules/utils/iso8601.js +52 -52
- package/rules/utils/reporter.js +37 -37
- package/rules/utils/rule.js +46 -46
- package/rules/utils/version.js +4 -4
@@ -1,184 +1,184 @@
|
|
1
|
-
const { isNil } = require('min-dash');
|
2
|
-
|
3
|
-
const {
|
4
|
-
is
|
5
|
-
} = require('bpmnlint-utils');
|
6
|
-
|
7
|
-
const {
|
8
|
-
elementType: elementTypeConfig,
|
9
|
-
expressionType: expressionTypeConfig
|
10
|
-
} = require('./config');
|
11
|
-
|
12
|
-
const { greaterOrEqual } = require('../../utils/version');
|
13
|
-
|
14
|
-
const {
|
15
|
-
getEventDefinition,
|
16
|
-
hasExpression,
|
17
|
-
hasProperties,
|
18
|
-
hasProperty
|
19
|
-
} = require('../../utils/element');
|
20
|
-
|
21
|
-
const { validateCronExpression } = require('../../utils/cron');
|
22
|
-
|
23
|
-
const {
|
24
|
-
validateCycle: validateISO8601Cycle,
|
25
|
-
validateDate: validateISO8601Date,
|
26
|
-
validateDuration: validateISO8601Duration
|
27
|
-
} = require('../../utils/iso8601');
|
28
|
-
|
29
|
-
const { reportErrors } = require('../../utils/reporter');
|
30
|
-
|
31
|
-
const { skipInNonExecutableProcess } = require('../../utils/rule');
|
32
|
-
|
33
|
-
module.exports = skipInNonExecutableProcess(function({ version }) {
|
34
|
-
function check(node, reporter) {
|
35
|
-
if (!is(node, 'bpmn:Event')) {
|
36
|
-
return;
|
37
|
-
}
|
38
|
-
|
39
|
-
const eventDefinition = getEventDefinition(node);
|
40
|
-
|
41
|
-
if (!eventDefinition || !is(eventDefinition, 'bpmn:TimerEventDefinition')) {
|
42
|
-
return;
|
43
|
-
}
|
44
|
-
|
45
|
-
let errors = checkTimePropertyExists(eventDefinition, node, version);
|
46
|
-
|
47
|
-
if (errors && errors.length) {
|
48
|
-
reportErrors(node, reporter, errors);
|
49
|
-
|
50
|
-
return;
|
51
|
-
}
|
52
|
-
|
53
|
-
errors = checkTimeProperty(eventDefinition, node, version);
|
54
|
-
|
55
|
-
if (errors && errors.length) {
|
56
|
-
reportErrors(node, reporter, errors);
|
57
|
-
}
|
58
|
-
}
|
59
|
-
|
60
|
-
return {
|
61
|
-
check
|
62
|
-
};
|
63
|
-
});
|
64
|
-
|
65
|
-
function checkTimePropertyExists(eventDefinition, node, version) {
|
66
|
-
const timePropertyName = getTimePropertyName(eventDefinition);
|
67
|
-
|
68
|
-
if (timePropertyName) {
|
69
|
-
const allowedVersion = getAllowedVersionForTimeProperty(node, timePropertyName),
|
70
|
-
allowed = isNil(allowedVersion) ? false : greaterOrEqual(version, allowedVersion);
|
71
|
-
|
72
|
-
return hasProperties(eventDefinition, {
|
73
|
-
[ timePropertyName ]: {
|
74
|
-
allowed,
|
75
|
-
allowedVersion
|
76
|
-
}
|
77
|
-
}, node);
|
78
|
-
}
|
79
|
-
|
80
|
-
return hasProperty(eventDefinition, getAllowedTimePropertiesForVersion(node, version), node);
|
81
|
-
}
|
82
|
-
|
83
|
-
function checkTimeProperty(eventDefinition, event, version) {
|
84
|
-
const timeCycle = eventDefinition.get('timeCycle'),
|
85
|
-
timeDate = eventDefinition.get('timeDate'),
|
86
|
-
timeDuration = eventDefinition.get('timeDuration');
|
87
|
-
|
88
|
-
if (timeCycle) {
|
89
|
-
return hasExpression(eventDefinition, 'timeCycle', {
|
90
|
-
allowed: cycle => validateCycle(cycle, version)
|
91
|
-
}, event);
|
92
|
-
} else if (timeDate) {
|
93
|
-
return hasExpression(eventDefinition, 'timeDate', {
|
94
|
-
allowed: date => validateDate(date, version)
|
95
|
-
}, event);
|
96
|
-
} else if (timeDuration) {
|
97
|
-
return hasExpression(eventDefinition, 'timeDuration', {
|
98
|
-
allowed: duration => validateDuration(duration, version)
|
99
|
-
}, event);
|
100
|
-
}
|
101
|
-
}
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
// helpers //////////
|
106
|
-
function validateCycle(cycle, version) {
|
107
|
-
if (validateExpression(cycle)) {
|
108
|
-
return true;
|
109
|
-
}
|
110
|
-
|
111
|
-
if (validateISO8601Cycle(cycle)) {
|
112
|
-
return greaterOrEqual(version, expressionTypeConfig.iso8601);
|
113
|
-
}
|
114
|
-
|
115
|
-
if (validateCronExpression(cycle)) {
|
116
|
-
return greaterOrEqual(version, expressionTypeConfig.cron) || { allowedVersion: expressionTypeConfig.cron };
|
117
|
-
}
|
118
|
-
}
|
119
|
-
|
120
|
-
function validateDate(date, version) {
|
121
|
-
if (validateExpression(date)) {
|
122
|
-
return true;
|
123
|
-
}
|
124
|
-
|
125
|
-
if (validateISO8601Date(date)) {
|
126
|
-
return greaterOrEqual(version, expressionTypeConfig.iso8601);
|
127
|
-
}
|
128
|
-
}
|
129
|
-
|
130
|
-
function validateDuration(duration, version) {
|
131
|
-
if (validateExpression(duration)) {
|
132
|
-
return true;
|
133
|
-
}
|
134
|
-
|
135
|
-
if (validateISO8601Duration(duration)) {
|
136
|
-
return greaterOrEqual(version, expressionTypeConfig.iso8601);
|
137
|
-
}
|
138
|
-
}
|
139
|
-
|
140
|
-
function validateExpression(text) {
|
141
|
-
if (text.startsWith('=')) {
|
142
|
-
return true;
|
143
|
-
}
|
144
|
-
}
|
145
|
-
|
146
|
-
function getTimePropertyName(eventDefinition) {
|
147
|
-
if (eventDefinition.get('timeCycle')) {
|
148
|
-
return 'timeCycle';
|
149
|
-
}
|
150
|
-
|
151
|
-
if (eventDefinition.get('timeDate')) {
|
152
|
-
return 'timeDate';
|
153
|
-
}
|
154
|
-
|
155
|
-
if (eventDefinition.get('timeDuration')) {
|
156
|
-
return 'timeDuration';
|
157
|
-
}
|
158
|
-
|
159
|
-
return null;
|
160
|
-
}
|
161
|
-
|
162
|
-
function getAllowedTimePropertiesForVersion(element, version) {
|
163
|
-
const config = elementTypeConfig[ element.$type ];
|
164
|
-
|
165
|
-
return Object.keys(config).filter((property) => {
|
166
|
-
const allowedVersion = config[ property ](isInterrupting(element), element.$parent);
|
167
|
-
|
168
|
-
return allowedVersion && greaterOrEqual(version, allowedVersion);
|
169
|
-
});
|
170
|
-
}
|
171
|
-
|
172
|
-
function getAllowedVersionForTimeProperty(element, property) {
|
173
|
-
const config = elementTypeConfig[ element.$type ];
|
174
|
-
|
175
|
-
return config[ property ](isInterrupting(element), element.$parent);
|
176
|
-
}
|
177
|
-
|
178
|
-
function isInterrupting(element) {
|
179
|
-
if (is(element, 'bpmn:BoundaryEvent')) {
|
180
|
-
return element.get('cancelActivity') !== false;
|
181
|
-
}
|
182
|
-
|
183
|
-
return element.get('isInterrupting') !== false;
|
1
|
+
const { isNil } = require('min-dash');
|
2
|
+
|
3
|
+
const {
|
4
|
+
is
|
5
|
+
} = require('bpmnlint-utils');
|
6
|
+
|
7
|
+
const {
|
8
|
+
elementType: elementTypeConfig,
|
9
|
+
expressionType: expressionTypeConfig
|
10
|
+
} = require('./config');
|
11
|
+
|
12
|
+
const { greaterOrEqual } = require('../../utils/version');
|
13
|
+
|
14
|
+
const {
|
15
|
+
getEventDefinition,
|
16
|
+
hasExpression,
|
17
|
+
hasProperties,
|
18
|
+
hasProperty
|
19
|
+
} = require('../../utils/element');
|
20
|
+
|
21
|
+
const { validateCronExpression } = require('../../utils/cron');
|
22
|
+
|
23
|
+
const {
|
24
|
+
validateCycle: validateISO8601Cycle,
|
25
|
+
validateDate: validateISO8601Date,
|
26
|
+
validateDuration: validateISO8601Duration
|
27
|
+
} = require('../../utils/iso8601');
|
28
|
+
|
29
|
+
const { reportErrors } = require('../../utils/reporter');
|
30
|
+
|
31
|
+
const { skipInNonExecutableProcess } = require('../../utils/rule');
|
32
|
+
|
33
|
+
module.exports = skipInNonExecutableProcess(function({ version }) {
|
34
|
+
function check(node, reporter) {
|
35
|
+
if (!is(node, 'bpmn:Event')) {
|
36
|
+
return;
|
37
|
+
}
|
38
|
+
|
39
|
+
const eventDefinition = getEventDefinition(node);
|
40
|
+
|
41
|
+
if (!eventDefinition || !is(eventDefinition, 'bpmn:TimerEventDefinition')) {
|
42
|
+
return;
|
43
|
+
}
|
44
|
+
|
45
|
+
let errors = checkTimePropertyExists(eventDefinition, node, version);
|
46
|
+
|
47
|
+
if (errors && errors.length) {
|
48
|
+
reportErrors(node, reporter, errors);
|
49
|
+
|
50
|
+
return;
|
51
|
+
}
|
52
|
+
|
53
|
+
errors = checkTimeProperty(eventDefinition, node, version);
|
54
|
+
|
55
|
+
if (errors && errors.length) {
|
56
|
+
reportErrors(node, reporter, errors);
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
return {
|
61
|
+
check
|
62
|
+
};
|
63
|
+
});
|
64
|
+
|
65
|
+
function checkTimePropertyExists(eventDefinition, node, version) {
|
66
|
+
const timePropertyName = getTimePropertyName(eventDefinition);
|
67
|
+
|
68
|
+
if (timePropertyName) {
|
69
|
+
const allowedVersion = getAllowedVersionForTimeProperty(node, timePropertyName),
|
70
|
+
allowed = isNil(allowedVersion) ? false : greaterOrEqual(version, allowedVersion);
|
71
|
+
|
72
|
+
return hasProperties(eventDefinition, {
|
73
|
+
[ timePropertyName ]: {
|
74
|
+
allowed,
|
75
|
+
allowedVersion
|
76
|
+
}
|
77
|
+
}, node);
|
78
|
+
}
|
79
|
+
|
80
|
+
return hasProperty(eventDefinition, getAllowedTimePropertiesForVersion(node, version), node);
|
81
|
+
}
|
82
|
+
|
83
|
+
function checkTimeProperty(eventDefinition, event, version) {
|
84
|
+
const timeCycle = eventDefinition.get('timeCycle'),
|
85
|
+
timeDate = eventDefinition.get('timeDate'),
|
86
|
+
timeDuration = eventDefinition.get('timeDuration');
|
87
|
+
|
88
|
+
if (timeCycle) {
|
89
|
+
return hasExpression(eventDefinition, 'timeCycle', {
|
90
|
+
allowed: cycle => validateCycle(cycle, version)
|
91
|
+
}, event);
|
92
|
+
} else if (timeDate) {
|
93
|
+
return hasExpression(eventDefinition, 'timeDate', {
|
94
|
+
allowed: date => validateDate(date, version)
|
95
|
+
}, event);
|
96
|
+
} else if (timeDuration) {
|
97
|
+
return hasExpression(eventDefinition, 'timeDuration', {
|
98
|
+
allowed: duration => validateDuration(duration, version)
|
99
|
+
}, event);
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
// helpers //////////
|
106
|
+
function validateCycle(cycle, version) {
|
107
|
+
if (validateExpression(cycle)) {
|
108
|
+
return true;
|
109
|
+
}
|
110
|
+
|
111
|
+
if (validateISO8601Cycle(cycle)) {
|
112
|
+
return greaterOrEqual(version, expressionTypeConfig.iso8601);
|
113
|
+
}
|
114
|
+
|
115
|
+
if (validateCronExpression(cycle)) {
|
116
|
+
return greaterOrEqual(version, expressionTypeConfig.cron) || { allowedVersion: expressionTypeConfig.cron };
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
function validateDate(date, version) {
|
121
|
+
if (validateExpression(date)) {
|
122
|
+
return true;
|
123
|
+
}
|
124
|
+
|
125
|
+
if (validateISO8601Date(date)) {
|
126
|
+
return greaterOrEqual(version, expressionTypeConfig.iso8601);
|
127
|
+
}
|
128
|
+
}
|
129
|
+
|
130
|
+
function validateDuration(duration, version) {
|
131
|
+
if (validateExpression(duration)) {
|
132
|
+
return true;
|
133
|
+
}
|
134
|
+
|
135
|
+
if (validateISO8601Duration(duration)) {
|
136
|
+
return greaterOrEqual(version, expressionTypeConfig.iso8601);
|
137
|
+
}
|
138
|
+
}
|
139
|
+
|
140
|
+
function validateExpression(text) {
|
141
|
+
if (text.startsWith('=')) {
|
142
|
+
return true;
|
143
|
+
}
|
144
|
+
}
|
145
|
+
|
146
|
+
function getTimePropertyName(eventDefinition) {
|
147
|
+
if (eventDefinition.get('timeCycle')) {
|
148
|
+
return 'timeCycle';
|
149
|
+
}
|
150
|
+
|
151
|
+
if (eventDefinition.get('timeDate')) {
|
152
|
+
return 'timeDate';
|
153
|
+
}
|
154
|
+
|
155
|
+
if (eventDefinition.get('timeDuration')) {
|
156
|
+
return 'timeDuration';
|
157
|
+
}
|
158
|
+
|
159
|
+
return null;
|
160
|
+
}
|
161
|
+
|
162
|
+
function getAllowedTimePropertiesForVersion(element, version) {
|
163
|
+
const config = elementTypeConfig[ element.$type ];
|
164
|
+
|
165
|
+
return Object.keys(config).filter((property) => {
|
166
|
+
const allowedVersion = config[ property ](isInterrupting(element), element.$parent);
|
167
|
+
|
168
|
+
return allowedVersion && greaterOrEqual(version, allowedVersion);
|
169
|
+
});
|
170
|
+
}
|
171
|
+
|
172
|
+
function getAllowedVersionForTimeProperty(element, property) {
|
173
|
+
const config = elementTypeConfig[ element.$type ];
|
174
|
+
|
175
|
+
return config[ property ](isInterrupting(element), element.$parent);
|
176
|
+
}
|
177
|
+
|
178
|
+
function isInterrupting(element) {
|
179
|
+
if (is(element, 'bpmn:BoundaryEvent')) {
|
180
|
+
return element.get('cancelActivity') !== false;
|
181
|
+
}
|
182
|
+
|
183
|
+
return element.get('isInterrupting') !== false;
|
184
184
|
}
|
@@ -1,25 +1,25 @@
|
|
1
|
-
const { is } = require('bpmnlint-utils');
|
2
|
-
|
3
|
-
const { hasExtensionElement } = 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:UserTask')) {
|
12
|
-
return;
|
13
|
-
}
|
14
|
-
|
15
|
-
let errors = hasExtensionElement(node, 'zeebe:FormDefinition', node);
|
16
|
-
|
17
|
-
if (errors && errors.length) {
|
18
|
-
reportErrors(node, reporter, errors);
|
19
|
-
}
|
20
|
-
}
|
21
|
-
|
22
|
-
return {
|
23
|
-
check
|
24
|
-
};
|
1
|
+
const { is } = require('bpmnlint-utils');
|
2
|
+
|
3
|
+
const { hasExtensionElement } = 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:UserTask')) {
|
12
|
+
return;
|
13
|
+
}
|
14
|
+
|
15
|
+
let errors = hasExtensionElement(node, 'zeebe:FormDefinition', node);
|
16
|
+
|
17
|
+
if (errors && errors.length) {
|
18
|
+
reportErrors(node, reporter, errors);
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
return {
|
23
|
+
check
|
24
|
+
};
|
25
25
|
});
|