@camunda/linting 3.37.1 → 3.38.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 +21 -21
- package/README.md +75 -75
- package/assets/linting.css +37 -37
- package/lib/Linter.js +202 -202
- package/lib/Resolver.js +31 -31
- package/lib/compiled-config.js +7 -2
- package/lib/modeler/Linting.js +124 -124
- package/lib/modeler/LintingAnnotations.js +95 -95
- package/lib/modeler/OverlayComponent.js +60 -60
- package/lib/modeler/index.js +10 -10
- package/lib/plugins/bpmnLintPlugin.js +10 -10
- package/lib/plugins/index.js +4 -4
- package/lib/utils/error-messages.js +828 -828
- package/lib/utils/properties-panel.js +712 -712
- package/lib/utils/types.js +46 -46
- package/lib/utils/version.js +8 -8
- package/package.json +85 -85
|
@@ -1,713 +1,713 @@
|
|
|
1
|
-
import {
|
|
2
|
-
isArray,
|
|
3
|
-
isString
|
|
4
|
-
} from 'min-dash';
|
|
5
|
-
|
|
6
|
-
import { is } from 'bpmnlint-utils';
|
|
7
|
-
|
|
8
|
-
import { ERROR_TYPES } from 'bpmnlint-plugin-camunda-compat/rules/utils/error-types';
|
|
9
|
-
|
|
10
|
-
import { greaterOrEqual } from './version';
|
|
11
|
-
|
|
12
|
-
const TIMER_PROPERTIES = [
|
|
13
|
-
'timeDate',
|
|
14
|
-
'timeDuration',
|
|
15
|
-
'timeCycle'
|
|
16
|
-
];
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Get errors for a given element.
|
|
20
|
-
*
|
|
21
|
-
* @param {Object[]} reports
|
|
22
|
-
* @param {Object} element
|
|
23
|
-
*
|
|
24
|
-
* @returns {Object}
|
|
25
|
-
*/
|
|
26
|
-
export function getErrors(reports, element) {
|
|
27
|
-
return reports.reduce((errors, report) => {
|
|
28
|
-
const { category } = report;
|
|
29
|
-
|
|
30
|
-
if (!element
|
|
31
|
-
|| getBusinessObject(element).get('id') !== report.id
|
|
32
|
-
|| category !== 'error') {
|
|
33
|
-
return errors;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const ids = getEntryIds(report);
|
|
37
|
-
|
|
38
|
-
if (!ids.length) {
|
|
39
|
-
return errors;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
let { message } = report;
|
|
43
|
-
|
|
44
|
-
return {
|
|
45
|
-
...errors,
|
|
46
|
-
...ids.reduce((errors, id) => {
|
|
47
|
-
return {
|
|
48
|
-
...errors,
|
|
49
|
-
[ id ]: getErrorMessage(id, report) || message
|
|
50
|
-
};
|
|
51
|
-
}, {})
|
|
52
|
-
};
|
|
53
|
-
}, {});
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export function getEntryIds(report) {
|
|
57
|
-
const {
|
|
58
|
-
data = {},
|
|
59
|
-
id,
|
|
60
|
-
path,
|
|
61
|
-
propertiesPanel = {}
|
|
62
|
-
} = report;
|
|
63
|
-
|
|
64
|
-
if (propertiesPanel.entryIds) {
|
|
65
|
-
return propertiesPanel.entryIds;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (isPropertyError(data, 'isExecutable')) {
|
|
69
|
-
return [ 'isExecutable' ];
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (isExtensionElementRequiredError(data, 'zeebe:CalledDecision', 'bpmn:BusinessRuleTask')) {
|
|
73
|
-
return [ 'businessRuleImplementation' ];
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// script task
|
|
77
|
-
if (isExtensionElementRequiredError(data, 'zeebe:Script', 'bpmn:ScriptTask')) {
|
|
78
|
-
return [ 'scriptImplementation' ];
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if (isPropertyError(data, 'errorRef')) {
|
|
82
|
-
return [ 'errorRef' ];
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (isPropertyError(data, 'escalationRef')) {
|
|
86
|
-
return [ 'escalationRef' ];
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
if (isPropertyError(data, 'messageRef')) {
|
|
90
|
-
return [ 'messageRef' ];
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (isPropertyError(data, 'signalRef')) {
|
|
94
|
-
return [ 'signalRef' ];
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (isPropertyError(data, 'historyTimeToLive')) {
|
|
98
|
-
return [ 'historyTimeToLive' ];
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (isPropertyError(data, 'decisionId', 'zeebe:CalledDecision')) {
|
|
102
|
-
return [ 'decisionId' ];
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (isPropertyError(data, 'resultVariable')) {
|
|
106
|
-
return [ 'resultVariable' ];
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (isPropertyError(data, 'expression', 'zeebe:Script')) {
|
|
110
|
-
return [ 'scriptExpression' ];
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (isPropertyError(data, 'errorCode', 'bpmn:Error')) {
|
|
114
|
-
return [ 'errorCode' ];
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
if (isPropertyError(data, 'escalationCode', 'bpmn:Escalation')) {
|
|
118
|
-
return [ 'escalationCode' ];
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
if (isPropertyError(data, 'name', 'bpmn:Message')) {
|
|
122
|
-
return [ 'messageName' ];
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
if (isPropertyError(data, 'name', 'bpmn:Signal')) {
|
|
126
|
-
return [ 'signalName' ];
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
if (isExtensionElementRequiredError(data, 'zeebe:LoopCharacteristics', 'bpmn:MultiInstanceLoopCharacteristics')
|
|
130
|
-
|| isPropertyError(data, 'inputCollection', 'zeebe:LoopCharacteristics')) {
|
|
131
|
-
return [ 'multiInstance-inputCollection' ];
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
if (isPropertyDependentRequiredError(data, 'outputCollection', 'zeebe:LoopCharacteristics')) {
|
|
135
|
-
return [ 'multiInstance-outputCollection' ];
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
if (isPropertyDependentRequiredError(data, 'outputElement', 'zeebe:LoopCharacteristics')) {
|
|
139
|
-
return [ 'multiInstance-outputElement' ];
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
if (isExtensionElementRequiredError(data, 'zeebe:CalledElement', 'bpmn:CallActivity')
|
|
143
|
-
|| isPropertyError(data, 'processId', 'zeebe:CalledElement')) {
|
|
144
|
-
return [ 'targetProcessId' ];
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
if (isExtensionElementRequiredError(data, 'zeebe:TaskDefinition')
|
|
148
|
-
|| isPropertyError(data, 'type', 'zeebe:TaskDefinition')) {
|
|
149
|
-
return [ 'taskDefinitionType' ];
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
if (isPropertyError(data, 'retries', 'zeebe:TaskDefinition')) {
|
|
153
|
-
return [ 'taskDefinitionRetries' ];
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
if (isExtensionElementRequiredError(data, 'zeebe:Subscription')
|
|
157
|
-
|| isPropertyError(data, 'correlationKey', 'zeebe:Subscription')) {
|
|
158
|
-
return [ 'messageSubscriptionCorrelationKey' ];
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
if (isPropertyError(data, 'formKey', 'zeebe:FormDefinition')) {
|
|
162
|
-
return [ 'customFormKey' ];
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
if (isType(data, 'zeebe:FormDefinition')) {
|
|
166
|
-
const {
|
|
167
|
-
node,
|
|
168
|
-
requiredProperty
|
|
169
|
-
} = data;
|
|
170
|
-
|
|
171
|
-
if (isArray(requiredProperty)) {
|
|
172
|
-
if (requiredProperty.includes('formKey') && isEmptyString(node.get('formKey'))) {
|
|
173
|
-
return [ 'customFormKey' ];
|
|
174
|
-
} else if (requiredProperty.includes('formId') && isEmptyString(node.get('formId'))) {
|
|
175
|
-
return [ 'formId' ];
|
|
176
|
-
} else if (requiredProperty.includes('externalReference') && isEmptyString(node.get('externalReference'))) {
|
|
177
|
-
return [ 'externalReference' ];
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
if (isPropertyError(data, 'formId', 'zeebe:FormDefinition')) {
|
|
183
|
-
return [ 'formId' ];
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
if (isPropertyError(data, 'body', 'zeebe:UserTaskForm')) {
|
|
187
|
-
return [ 'formConfiguration' ];
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
if (isPropertyValueDuplicatedError(data, 'values', 'key', 'zeebe:TaskHeaders')) {
|
|
191
|
-
const {
|
|
192
|
-
node,
|
|
193
|
-
properties,
|
|
194
|
-
propertiesName
|
|
195
|
-
} = data;
|
|
196
|
-
|
|
197
|
-
return properties.map(property => {
|
|
198
|
-
const index = node.get(propertiesName).indexOf(property);
|
|
199
|
-
|
|
200
|
-
return `${ id }-header-${ index }-key`;
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
if (isExtensionElementNotAllowedError(data, 'zeebe:Properties')) {
|
|
205
|
-
const { extensionElement } = data;
|
|
206
|
-
|
|
207
|
-
return extensionElement.get('zeebe:properties').map((zeebeProperty, index) => {
|
|
208
|
-
return `${ id }-extensionProperty-${ index }-name`;
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
if (
|
|
213
|
-
isExtensionElementNotAllowedError(data, 'zeebe:UserTask') ||
|
|
214
|
-
isExtensionElementRequiredError(data, 'zeebe:UserTask')
|
|
215
|
-
) {
|
|
216
|
-
return [ 'userTaskImplementation' ];
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
if (isExtensionElementNotAllowedError(data, 'zeebe:FormDefinition', 'bpmn:StartEvent')) {
|
|
220
|
-
return [ 'formType' ];
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
if (isPropertyError(data, 'conditionExpression', 'bpmn:SequenceFlow')) {
|
|
225
|
-
return [ 'conditionExpression' ];
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
if (isPropertyError(data, 'completionCondition', 'bpmn:MultiInstanceLoopCharacteristics')) {
|
|
229
|
-
return [ 'multiInstance-completionCondition' ];
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
if (isPropertyError(data, 'completionCondition', 'bpmn:AdHocSubProcess')) {
|
|
233
|
-
return [ 'completionCondition' ];
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
if (isPropertyError(data, 'cancelRemainingInstances', 'bpmn:AdHocSubProcess')) {
|
|
237
|
-
return [ 'cancelRemainingInstances' ];
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
if (TIMER_PROPERTIES.some(property =>
|
|
241
|
-
isOneOfPropertiesRequiredError(data, property, 'bpmn:TimerEventDefinition'))
|
|
242
|
-
) {
|
|
243
|
-
return [ 'timerEventDefinitionType' ];
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
if (isExpressionRequiredError(data, 'timeCycle', 'bpmn:FormalExpression')
|
|
247
|
-
|| isExpressionRequiredError(data, 'timeDate', 'bpmn:FormalExpression')
|
|
248
|
-
|| isExpressionRequiredError(data, 'timeDuration', 'bpmn:FormalExpression')) {
|
|
249
|
-
return [ 'timerEventDefinitionValue' ];
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
if (isExpressionValueNotAllowedError(data, 'timeCycle', 'bpmn:FormalExpression')
|
|
253
|
-
|| isExpressionValueNotAllowedError(data, 'timeDate', 'bpmn:FormalExpression')
|
|
254
|
-
|| isExpressionValueNotAllowedError(data, 'timeDuration', 'bpmn:FormalExpression')) {
|
|
255
|
-
return [ 'timerEventDefinitionValue' ];
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
if (isPropertyError(data, 'timeCycle', 'bpmn:TimerEventDefinition')
|
|
259
|
-
|| isPropertyError(data, 'timeDate', 'bpmn:TimerEventDefinition')
|
|
260
|
-
|| isPropertyError(data, 'timeDuration', 'bpmn:TimerEventDefinition')) {
|
|
261
|
-
return [ 'timerEventDefinitionType' ];
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
const LIST_PROPERTIES = [
|
|
265
|
-
[ 'zeebe:Input', 'input' ],
|
|
266
|
-
[ 'zeebe:Output', 'output' ],
|
|
267
|
-
[ 'zeebe:Property', 'extensionProperty' ],
|
|
268
|
-
[ 'zeebe:Header', 'header' ]
|
|
269
|
-
];
|
|
270
|
-
|
|
271
|
-
for (const [ type, prefix ] of LIST_PROPERTIES) {
|
|
272
|
-
if (isType(data, type)
|
|
273
|
-
&& getPropertyName(data)) {
|
|
274
|
-
|
|
275
|
-
const index = path[ path.length - 2 ];
|
|
276
|
-
|
|
277
|
-
return [ `${ id }-${ prefix }-${ index }-${ getPropertyName(data) }` ];
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
if (isType(data, 'zeebe:LoopCharacteristics')) {
|
|
282
|
-
return [ `multiInstance-${getPropertyName(data)}` ];
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
if (isPropertyError(data, 'candidateUsers', 'zeebe:AssignmentDefinition')) {
|
|
286
|
-
return [ 'assignmentDefinitionCandidateUsers' ];
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
if (isPropertyError(data, 'historyTimeToLive', 'bpmn:Process')) {
|
|
290
|
-
return [ 'historyTimeToLive' ];
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
if (isExpressionValueNotAllowedError(data, 'dueDate', 'zeebe:TaskSchedule')) {
|
|
294
|
-
return [ 'taskScheduleDueDate' ];
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
if (isExpressionValueNotAllowedError(data, 'followUpDate', 'zeebe:TaskSchedule')) {
|
|
298
|
-
return [ 'taskScheduleFollowUpDate' ];
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
if (isExtensionElementNotAllowedError(data, 'zeebe:TaskSchedule', 'bpmn:UserTask')) {
|
|
302
|
-
const { extensionElement: taskSchedule } = data;
|
|
303
|
-
|
|
304
|
-
let ids = [];
|
|
305
|
-
|
|
306
|
-
if (taskSchedule.get('dueDate')) {
|
|
307
|
-
ids = [ ...ids, 'taskScheduleDueDate' ];
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
if (taskSchedule.get('followUpDate')) {
|
|
311
|
-
ids = [ ...ids, 'taskScheduleFollowUpDate' ];
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
return ids;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
if (isExpressionValueNotAllowedError(data, 'priority', 'zeebe:PriorityDefinition')
|
|
318
|
-
|| isExtensionElementNotAllowedError(data, 'zeebe:PriorityDefinition', 'bpmn:UserTask')) {
|
|
319
|
-
return [ 'priorityDefinitionPriority' ];
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
if (isPropertyError(data, 'propagateAllParentVariables', 'zeebe:CalledElement')) {
|
|
323
|
-
return [ 'propagateAllParentVariables' ];
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
if (isPropertyError(data, 'name', 'bpmn:LinkEventDefinition')
|
|
327
|
-
|| isElementPropertyValueDuplicated(data, 'name', 'bpmn:LinkEventDefinition')) {
|
|
328
|
-
return [ 'linkName' ];
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
if (isPropertyError(data, 'waitForCompletion', 'bpmn:CompensateEventDefinition')) {
|
|
332
|
-
return [ 'waitForCompletion' ];
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
if (isPropertyError(data, 'type', 'zeebe:ExecutionListener')) {
|
|
336
|
-
const index = path[ path.length - 2 ];
|
|
337
|
-
|
|
338
|
-
return [ `${id}-executionListener-${index}-listenerType` ];
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
if (isPropertyValuesDuplicatedError(data, 'zeebe:ExecutionListeners')) {
|
|
342
|
-
const { properties, propertiesName } = data;
|
|
343
|
-
|
|
344
|
-
return properties.map(property => {
|
|
345
|
-
const index = data.node.get(propertiesName).indexOf(property);
|
|
346
|
-
|
|
347
|
-
return `${ id }-executionListener-${ index }-listenerType`;
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
if (isPropertyError(data, 'type', 'zeebe:TaskListener')) {
|
|
352
|
-
const index = path[ path.length - 2 ];
|
|
353
|
-
|
|
354
|
-
return [ `${id}-taskListener-${index}-listenerType` ];
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
if (isPropertyError(data, 'bindingType')) {
|
|
358
|
-
return [ 'bindingType' ];
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
if (isPropertyError(data, 'versionTag') || isExtensionElementNotAllowedError(data, 'zeebe:VersionTag')) {
|
|
362
|
-
return [ 'versionTag' ];
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
return [];
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
export function getErrorMessage(id, report) {
|
|
369
|
-
const {
|
|
370
|
-
data = {},
|
|
371
|
-
executionPlatformVersion
|
|
372
|
-
} = report;
|
|
373
|
-
|
|
374
|
-
const {
|
|
375
|
-
type,
|
|
376
|
-
allowedVersion
|
|
377
|
-
} = data;
|
|
378
|
-
|
|
379
|
-
// adjust FEEL message
|
|
380
|
-
if (type === ERROR_TYPES.FEEL_EXPRESSION_INVALID) {
|
|
381
|
-
return 'Unparsable FEEL expression.';
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
if (type === ERROR_TYPES.EXPRESSION_NOT_ALLOWED) {
|
|
385
|
-
return 'Cannot be an expression.';
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
if (id === 'isExecutable') {
|
|
389
|
-
const { parentNode } = data;
|
|
390
|
-
|
|
391
|
-
if (parentNode && is(parentNode, 'bpmn:Participant')) {
|
|
392
|
-
return 'One process must be executable.';
|
|
393
|
-
} else {
|
|
394
|
-
return 'Process must be executable.';
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
if ([ 'businessRuleImplementation', 'scriptImplementation' ].includes(id)) {
|
|
399
|
-
return 'Implementation must be defined.';
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
if (id === 'errorRef') {
|
|
403
|
-
return 'Global error reference must be defined.';
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
if (id === 'escalationRef') {
|
|
407
|
-
return 'Global escalation reference must be defined.';
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
if (id === 'messageRef') {
|
|
411
|
-
return 'Global message reference must be defined.';
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
if (id === 'signalRef') {
|
|
415
|
-
return 'Global signal reference must be defined.';
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
if (id === 'decisionId') {
|
|
419
|
-
return 'Decision ID must be defined.';
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
if (id === 'scriptExpression') {
|
|
423
|
-
return 'FEEL expression must be defined.';
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
if (id === 'resultVariable') {
|
|
427
|
-
return 'Result variable must be defined.';
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
if (id === 'errorCode' && type === ERROR_TYPES.PROPERTY_REQUIRED) {
|
|
431
|
-
return 'Code must be defined.';
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
if (id === 'escalationCode' && type === ERROR_TYPES.PROPERTY_REQUIRED) {
|
|
435
|
-
return 'Code must be defined.';
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
if (id === 'messageName') {
|
|
439
|
-
return 'Name must be defined.';
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
if (id === 'signalName') {
|
|
443
|
-
return 'Name must be defined.';
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
if (id === 'multiInstance-inputCollection') {
|
|
447
|
-
return 'Input collection must be defined.';
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
if (id === 'multiInstance-outputCollection') {
|
|
451
|
-
return 'Output collection must be defined.';
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
if (id === 'multiInstance-outputElement') {
|
|
455
|
-
return 'Output element must be defined.';
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
if (id === 'completionCondition' && type === ERROR_TYPES.PROPERTY_NOT_ALLOWED) {
|
|
459
|
-
return getNotSupportedMessage('', allowedVersion);
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
if (id === 'cancelRemainingInstances' && type === ERROR_TYPES.PROPERTY_VALUE_NOT_ALLOWED) {
|
|
463
|
-
return 'Must be checked.';
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
if (id === 'targetProcessId') {
|
|
467
|
-
return 'Process ID must be defined.';
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
if (id === 'taskDefinitionType') {
|
|
471
|
-
return 'Type must be defined.';
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
if (id === 'timerEventDefinitionType' && type === ERROR_TYPES.PROPERTY_REQUIRED) {
|
|
475
|
-
return 'Type must be defined.';
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
if (id === 'messageSubscriptionCorrelationKey'
|
|
479
|
-
&& [
|
|
480
|
-
ERROR_TYPES.EXTENSION_ELEMENT_REQUIRED,
|
|
481
|
-
ERROR_TYPES.PROPERTY_REQUIRED
|
|
482
|
-
].includes(type)) {
|
|
483
|
-
return 'Subscription correlation key must be defined.';
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
if (id === 'customFormKey') {
|
|
487
|
-
return 'Form key must be defined.';
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
if (id === 'formId') {
|
|
491
|
-
if (type === ERROR_TYPES.PROPERTY_REQUIRED) {
|
|
492
|
-
return 'Form ID must be defined.';
|
|
493
|
-
} else if (type === ERROR_TYPES.PROPERTY_NOT_ALLOWED) {
|
|
494
|
-
return getNotSupportedMessage('Form ID', allowedVersion);
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
if (id === 'externalReference') {
|
|
499
|
-
return 'External reference must be defined.';
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
if (id === 'formConfiguration') {
|
|
503
|
-
return 'Form JSON configuration must be defined.';
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
if (/^.+-header-[0-9]+-key$/.test(id)) {
|
|
507
|
-
return 'Must be unique.';
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
if (/^.+-extensionProperty-[0-9]+-name$/.test(id)) {
|
|
511
|
-
return getNotSupportedMessage('', allowedVersion);
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
if (id === 'userTaskImplementation') {
|
|
515
|
-
if (type === ERROR_TYPES.EXTENSION_ELEMENT_NOT_ALLOWED) {
|
|
516
|
-
return getNotSupportedMessage('', allowedVersion);
|
|
517
|
-
} else if (type === ERROR_TYPES.EXTENSION_ELEMENT_REQUIRED) {
|
|
518
|
-
return getNotSupportedMessage('');
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
if (id === 'conditionExpression') {
|
|
523
|
-
return 'Condition expression must be defined.';
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
if (id === 'timerEventDefinitionType' && type === ERROR_TYPES.PROPERTY_NOT_ALLOWED) {
|
|
527
|
-
return getNotSupportedMessage('Type', allowedVersion);
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
if (id === 'timerEventDefinitionValue') {
|
|
531
|
-
if (type === ERROR_TYPES.EXPRESSION_REQUIRED) {
|
|
532
|
-
return 'Value must be defined.';
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
const { property } = data;
|
|
536
|
-
|
|
537
|
-
if (property === 'timeCycle') {
|
|
538
|
-
if (!greaterOrEqual(executionPlatformVersion, '8.1')) {
|
|
539
|
-
return 'Must be an expression, an ISO 8601 repeating interval, or a cron expression (cron only supported by Camunda 8.1 or newer).';
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
return 'Must be an expression, an ISO 8601 repeating interval, or a cron expression.';
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
if (property === 'timeDate') {
|
|
546
|
-
return 'Must be an expression, or an ISO 8601 date.';
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
if (property === 'timeDuration') {
|
|
550
|
-
return 'Must be an expression, or an ISO 8601 interval.';
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
if (id === 'assignmentDefinitionCandidateUsers') {
|
|
555
|
-
return getNotSupportedMessage('', allowedVersion);
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
if (id === 'taskScheduleDueDate') {
|
|
559
|
-
if (type === ERROR_TYPES.EXTENSION_ELEMENT_NOT_ALLOWED) {
|
|
560
|
-
return getNotSupportedMessage('', allowedVersion);
|
|
561
|
-
} else {
|
|
562
|
-
return 'Must be an ISO 8601 date.';
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
if (id === 'taskScheduleFollowUpDate') {
|
|
567
|
-
if (type === ERROR_TYPES.EXTENSION_ELEMENT_NOT_ALLOWED) {
|
|
568
|
-
return getNotSupportedMessage('', allowedVersion);
|
|
569
|
-
} else {
|
|
570
|
-
return 'Must be an ISO 8601 date.';
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
if (id === 'priorityDefinitionPriority') {
|
|
575
|
-
if (type === ERROR_TYPES.EXTENSION_ELEMENT_NOT_ALLOWED) {
|
|
576
|
-
return getNotSupportedMessage('', allowedVersion);
|
|
577
|
-
} else {
|
|
578
|
-
return 'Must be an expression, or an integer between 0 and 100.';
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
if (id === 'propagateAllParentVariables') {
|
|
583
|
-
return getNotSupportedMessage('', allowedVersion);
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
if (id === 'linkName') {
|
|
587
|
-
if (type === ERROR_TYPES.ELEMENT_PROPERTY_VALUE_DUPLICATED) {
|
|
588
|
-
return 'Must be unique.';
|
|
589
|
-
} else {
|
|
590
|
-
return 'Must be defined.';
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
if (id === 'waitForCompletion') {
|
|
595
|
-
return 'Must wait for completion.';
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
if (/^.+-executionListener-[0-9]+-listenerType$/.test(id)) {
|
|
599
|
-
if (type === ERROR_TYPES.PROPERTY_VALUES_DUPLICATED) {
|
|
600
|
-
return 'Must be unique.';
|
|
601
|
-
} else {
|
|
602
|
-
return 'Must be defined.';
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
if (/^.+-taskListener-[0-9]+-listenerType$/.test(id)) {
|
|
607
|
-
return 'Must be defined.';
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
if (id === 'bindingType') {
|
|
611
|
-
return getNotSupportedMessage('', allowedVersion);
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
if (id === 'versionTag') {
|
|
615
|
-
if (type === ERROR_TYPES.EXTENSION_ELEMENT_NOT_ALLOWED) {
|
|
616
|
-
return getNotSupportedMessage('', allowedVersion);
|
|
617
|
-
} else {
|
|
618
|
-
return 'Version tag must be defined.';
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
function isExtensionElementNotAllowedError(data, extensionElement, type) {
|
|
624
|
-
return data.type === ERROR_TYPES.EXTENSION_ELEMENT_NOT_ALLOWED
|
|
625
|
-
&& is(data.extensionElement, extensionElement)
|
|
626
|
-
&& (!type || is(data.node, type));
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
function isExtensionElementRequiredError(data, requiredExtensionElement, type) {
|
|
630
|
-
return data.type === ERROR_TYPES.EXTENSION_ELEMENT_REQUIRED
|
|
631
|
-
&& (isArray(data.requiredExtensionElement) && data.requiredExtensionElement.includes(requiredExtensionElement)
|
|
632
|
-
|| data.requiredExtensionElement === requiredExtensionElement)
|
|
633
|
-
&& (!type || is(data.node, type));
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
function isPropertyDependentRequiredError(data, dependentRequiredProperty, type) {
|
|
637
|
-
return data.type === ERROR_TYPES.PROPERTY_DEPENDENT_REQUIRED
|
|
638
|
-
&& data.dependentRequiredProperty === dependentRequiredProperty
|
|
639
|
-
&& (!type || is(data.node, type));
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
function isPropertyError(data, property, type) {
|
|
644
|
-
return getPropertyName(data) === property
|
|
645
|
-
&& (!type || is(data.node, type));
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
function getPropertyName(data) {
|
|
649
|
-
if (data.type === ERROR_TYPES.PROPERTY_REQUIRED) {
|
|
650
|
-
return data.requiredProperty;
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
return data.property;
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
function isType(data, type) {
|
|
657
|
-
return data.node && is(data.node, type);
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
function isOneOfPropertiesRequiredError(data, requiredProperty, type) {
|
|
661
|
-
return data.type === ERROR_TYPES.PROPERTY_REQUIRED
|
|
662
|
-
&& (isArray(data.requiredProperty) && data.requiredProperty.includes(requiredProperty))
|
|
663
|
-
&& (!type || is(data.node, type));
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
function isPropertyValueDuplicatedError(data, propertiesName, duplicatedProperty, type) {
|
|
667
|
-
return data.type === ERROR_TYPES.PROPERTY_VALUE_DUPLICATED
|
|
668
|
-
&& data.propertiesName === propertiesName
|
|
669
|
-
&& data.duplicatedProperty === duplicatedProperty
|
|
670
|
-
&& (!type || is(data.node, type));
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
function isPropertyValuesDuplicatedError(data, type) {
|
|
674
|
-
return data.type === ERROR_TYPES.PROPERTY_VALUES_DUPLICATED
|
|
675
|
-
&& (!type || is(data.node, type));
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
function isExpressionRequiredError(data, propertyName, type) {
|
|
679
|
-
return data.type === ERROR_TYPES.EXPRESSION_REQUIRED
|
|
680
|
-
&& data.property === propertyName
|
|
681
|
-
&& (!type || is(data.node, type));
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
function isExpressionValueNotAllowedError(data, propertyName, type) {
|
|
685
|
-
return data.type === ERROR_TYPES.EXPRESSION_VALUE_NOT_ALLOWED
|
|
686
|
-
&& data.property === propertyName
|
|
687
|
-
&& (!type || is(data.node, type));
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
function isElementPropertyValueDuplicated(data, propertyName, type) {
|
|
691
|
-
return data.type === ERROR_TYPES.ELEMENT_PROPERTY_VALUE_DUPLICATED
|
|
692
|
-
&& data.duplicatedProperty === propertyName
|
|
693
|
-
&& (!type || is(data.node, type));
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
function getBusinessObject(element) {
|
|
697
|
-
return element.businessObject || element;
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
function isEmptyString(value) {
|
|
701
|
-
return isString(value) && value.trim() === '';
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
function getNotSupportedMessage(property, allowedVersion) {
|
|
705
|
-
|
|
706
|
-
if (allowedVersion) {
|
|
707
|
-
return property ?
|
|
708
|
-
`${ property } is only supported by Camunda ${ allowedVersion } or newer.` :
|
|
709
|
-
`Only supported by Camunda ${ allowedVersion } or newer.`;
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
return property ? `${ property } is not supported.` : 'Not supported.';
|
|
1
|
+
import {
|
|
2
|
+
isArray,
|
|
3
|
+
isString
|
|
4
|
+
} from 'min-dash';
|
|
5
|
+
|
|
6
|
+
import { is } from 'bpmnlint-utils';
|
|
7
|
+
|
|
8
|
+
import { ERROR_TYPES } from 'bpmnlint-plugin-camunda-compat/rules/utils/error-types';
|
|
9
|
+
|
|
10
|
+
import { greaterOrEqual } from './version';
|
|
11
|
+
|
|
12
|
+
const TIMER_PROPERTIES = [
|
|
13
|
+
'timeDate',
|
|
14
|
+
'timeDuration',
|
|
15
|
+
'timeCycle'
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Get errors for a given element.
|
|
20
|
+
*
|
|
21
|
+
* @param {Object[]} reports
|
|
22
|
+
* @param {Object} element
|
|
23
|
+
*
|
|
24
|
+
* @returns {Object}
|
|
25
|
+
*/
|
|
26
|
+
export function getErrors(reports, element) {
|
|
27
|
+
return reports.reduce((errors, report) => {
|
|
28
|
+
const { category } = report;
|
|
29
|
+
|
|
30
|
+
if (!element
|
|
31
|
+
|| getBusinessObject(element).get('id') !== report.id
|
|
32
|
+
|| category !== 'error') {
|
|
33
|
+
return errors;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const ids = getEntryIds(report);
|
|
37
|
+
|
|
38
|
+
if (!ids.length) {
|
|
39
|
+
return errors;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
let { message } = report;
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
...errors,
|
|
46
|
+
...ids.reduce((errors, id) => {
|
|
47
|
+
return {
|
|
48
|
+
...errors,
|
|
49
|
+
[ id ]: getErrorMessage(id, report) || message
|
|
50
|
+
};
|
|
51
|
+
}, {})
|
|
52
|
+
};
|
|
53
|
+
}, {});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function getEntryIds(report) {
|
|
57
|
+
const {
|
|
58
|
+
data = {},
|
|
59
|
+
id,
|
|
60
|
+
path,
|
|
61
|
+
propertiesPanel = {}
|
|
62
|
+
} = report;
|
|
63
|
+
|
|
64
|
+
if (propertiesPanel.entryIds) {
|
|
65
|
+
return propertiesPanel.entryIds;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (isPropertyError(data, 'isExecutable')) {
|
|
69
|
+
return [ 'isExecutable' ];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (isExtensionElementRequiredError(data, 'zeebe:CalledDecision', 'bpmn:BusinessRuleTask')) {
|
|
73
|
+
return [ 'businessRuleImplementation' ];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// script task
|
|
77
|
+
if (isExtensionElementRequiredError(data, 'zeebe:Script', 'bpmn:ScriptTask')) {
|
|
78
|
+
return [ 'scriptImplementation' ];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (isPropertyError(data, 'errorRef')) {
|
|
82
|
+
return [ 'errorRef' ];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (isPropertyError(data, 'escalationRef')) {
|
|
86
|
+
return [ 'escalationRef' ];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (isPropertyError(data, 'messageRef')) {
|
|
90
|
+
return [ 'messageRef' ];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (isPropertyError(data, 'signalRef')) {
|
|
94
|
+
return [ 'signalRef' ];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (isPropertyError(data, 'historyTimeToLive')) {
|
|
98
|
+
return [ 'historyTimeToLive' ];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (isPropertyError(data, 'decisionId', 'zeebe:CalledDecision')) {
|
|
102
|
+
return [ 'decisionId' ];
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (isPropertyError(data, 'resultVariable')) {
|
|
106
|
+
return [ 'resultVariable' ];
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (isPropertyError(data, 'expression', 'zeebe:Script')) {
|
|
110
|
+
return [ 'scriptExpression' ];
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (isPropertyError(data, 'errorCode', 'bpmn:Error')) {
|
|
114
|
+
return [ 'errorCode' ];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (isPropertyError(data, 'escalationCode', 'bpmn:Escalation')) {
|
|
118
|
+
return [ 'escalationCode' ];
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (isPropertyError(data, 'name', 'bpmn:Message')) {
|
|
122
|
+
return [ 'messageName' ];
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (isPropertyError(data, 'name', 'bpmn:Signal')) {
|
|
126
|
+
return [ 'signalName' ];
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (isExtensionElementRequiredError(data, 'zeebe:LoopCharacteristics', 'bpmn:MultiInstanceLoopCharacteristics')
|
|
130
|
+
|| isPropertyError(data, 'inputCollection', 'zeebe:LoopCharacteristics')) {
|
|
131
|
+
return [ 'multiInstance-inputCollection' ];
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (isPropertyDependentRequiredError(data, 'outputCollection', 'zeebe:LoopCharacteristics')) {
|
|
135
|
+
return [ 'multiInstance-outputCollection' ];
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (isPropertyDependentRequiredError(data, 'outputElement', 'zeebe:LoopCharacteristics')) {
|
|
139
|
+
return [ 'multiInstance-outputElement' ];
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (isExtensionElementRequiredError(data, 'zeebe:CalledElement', 'bpmn:CallActivity')
|
|
143
|
+
|| isPropertyError(data, 'processId', 'zeebe:CalledElement')) {
|
|
144
|
+
return [ 'targetProcessId' ];
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (isExtensionElementRequiredError(data, 'zeebe:TaskDefinition')
|
|
148
|
+
|| isPropertyError(data, 'type', 'zeebe:TaskDefinition')) {
|
|
149
|
+
return [ 'taskDefinitionType' ];
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (isPropertyError(data, 'retries', 'zeebe:TaskDefinition')) {
|
|
153
|
+
return [ 'taskDefinitionRetries' ];
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (isExtensionElementRequiredError(data, 'zeebe:Subscription')
|
|
157
|
+
|| isPropertyError(data, 'correlationKey', 'zeebe:Subscription')) {
|
|
158
|
+
return [ 'messageSubscriptionCorrelationKey' ];
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (isPropertyError(data, 'formKey', 'zeebe:FormDefinition')) {
|
|
162
|
+
return [ 'customFormKey' ];
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (isType(data, 'zeebe:FormDefinition')) {
|
|
166
|
+
const {
|
|
167
|
+
node,
|
|
168
|
+
requiredProperty
|
|
169
|
+
} = data;
|
|
170
|
+
|
|
171
|
+
if (isArray(requiredProperty)) {
|
|
172
|
+
if (requiredProperty.includes('formKey') && isEmptyString(node.get('formKey'))) {
|
|
173
|
+
return [ 'customFormKey' ];
|
|
174
|
+
} else if (requiredProperty.includes('formId') && isEmptyString(node.get('formId'))) {
|
|
175
|
+
return [ 'formId' ];
|
|
176
|
+
} else if (requiredProperty.includes('externalReference') && isEmptyString(node.get('externalReference'))) {
|
|
177
|
+
return [ 'externalReference' ];
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (isPropertyError(data, 'formId', 'zeebe:FormDefinition')) {
|
|
183
|
+
return [ 'formId' ];
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (isPropertyError(data, 'body', 'zeebe:UserTaskForm')) {
|
|
187
|
+
return [ 'formConfiguration' ];
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (isPropertyValueDuplicatedError(data, 'values', 'key', 'zeebe:TaskHeaders')) {
|
|
191
|
+
const {
|
|
192
|
+
node,
|
|
193
|
+
properties,
|
|
194
|
+
propertiesName
|
|
195
|
+
} = data;
|
|
196
|
+
|
|
197
|
+
return properties.map(property => {
|
|
198
|
+
const index = node.get(propertiesName).indexOf(property);
|
|
199
|
+
|
|
200
|
+
return `${ id }-header-${ index }-key`;
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
if (isExtensionElementNotAllowedError(data, 'zeebe:Properties')) {
|
|
205
|
+
const { extensionElement } = data;
|
|
206
|
+
|
|
207
|
+
return extensionElement.get('zeebe:properties').map((zeebeProperty, index) => {
|
|
208
|
+
return `${ id }-extensionProperty-${ index }-name`;
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
if (
|
|
213
|
+
isExtensionElementNotAllowedError(data, 'zeebe:UserTask') ||
|
|
214
|
+
isExtensionElementRequiredError(data, 'zeebe:UserTask')
|
|
215
|
+
) {
|
|
216
|
+
return [ 'userTaskImplementation' ];
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
if (isExtensionElementNotAllowedError(data, 'zeebe:FormDefinition', 'bpmn:StartEvent')) {
|
|
220
|
+
return [ 'formType' ];
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
if (isPropertyError(data, 'conditionExpression', 'bpmn:SequenceFlow')) {
|
|
225
|
+
return [ 'conditionExpression' ];
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (isPropertyError(data, 'completionCondition', 'bpmn:MultiInstanceLoopCharacteristics')) {
|
|
229
|
+
return [ 'multiInstance-completionCondition' ];
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
if (isPropertyError(data, 'completionCondition', 'bpmn:AdHocSubProcess')) {
|
|
233
|
+
return [ 'completionCondition' ];
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if (isPropertyError(data, 'cancelRemainingInstances', 'bpmn:AdHocSubProcess')) {
|
|
237
|
+
return [ 'cancelRemainingInstances' ];
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
if (TIMER_PROPERTIES.some(property =>
|
|
241
|
+
isOneOfPropertiesRequiredError(data, property, 'bpmn:TimerEventDefinition'))
|
|
242
|
+
) {
|
|
243
|
+
return [ 'timerEventDefinitionType' ];
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
if (isExpressionRequiredError(data, 'timeCycle', 'bpmn:FormalExpression')
|
|
247
|
+
|| isExpressionRequiredError(data, 'timeDate', 'bpmn:FormalExpression')
|
|
248
|
+
|| isExpressionRequiredError(data, 'timeDuration', 'bpmn:FormalExpression')) {
|
|
249
|
+
return [ 'timerEventDefinitionValue' ];
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
if (isExpressionValueNotAllowedError(data, 'timeCycle', 'bpmn:FormalExpression')
|
|
253
|
+
|| isExpressionValueNotAllowedError(data, 'timeDate', 'bpmn:FormalExpression')
|
|
254
|
+
|| isExpressionValueNotAllowedError(data, 'timeDuration', 'bpmn:FormalExpression')) {
|
|
255
|
+
return [ 'timerEventDefinitionValue' ];
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
if (isPropertyError(data, 'timeCycle', 'bpmn:TimerEventDefinition')
|
|
259
|
+
|| isPropertyError(data, 'timeDate', 'bpmn:TimerEventDefinition')
|
|
260
|
+
|| isPropertyError(data, 'timeDuration', 'bpmn:TimerEventDefinition')) {
|
|
261
|
+
return [ 'timerEventDefinitionType' ];
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
const LIST_PROPERTIES = [
|
|
265
|
+
[ 'zeebe:Input', 'input' ],
|
|
266
|
+
[ 'zeebe:Output', 'output' ],
|
|
267
|
+
[ 'zeebe:Property', 'extensionProperty' ],
|
|
268
|
+
[ 'zeebe:Header', 'header' ]
|
|
269
|
+
];
|
|
270
|
+
|
|
271
|
+
for (const [ type, prefix ] of LIST_PROPERTIES) {
|
|
272
|
+
if (isType(data, type)
|
|
273
|
+
&& getPropertyName(data)) {
|
|
274
|
+
|
|
275
|
+
const index = path[ path.length - 2 ];
|
|
276
|
+
|
|
277
|
+
return [ `${ id }-${ prefix }-${ index }-${ getPropertyName(data) }` ];
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
if (isType(data, 'zeebe:LoopCharacteristics')) {
|
|
282
|
+
return [ `multiInstance-${getPropertyName(data)}` ];
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
if (isPropertyError(data, 'candidateUsers', 'zeebe:AssignmentDefinition')) {
|
|
286
|
+
return [ 'assignmentDefinitionCandidateUsers' ];
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
if (isPropertyError(data, 'historyTimeToLive', 'bpmn:Process')) {
|
|
290
|
+
return [ 'historyTimeToLive' ];
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
if (isExpressionValueNotAllowedError(data, 'dueDate', 'zeebe:TaskSchedule')) {
|
|
294
|
+
return [ 'taskScheduleDueDate' ];
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
if (isExpressionValueNotAllowedError(data, 'followUpDate', 'zeebe:TaskSchedule')) {
|
|
298
|
+
return [ 'taskScheduleFollowUpDate' ];
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
if (isExtensionElementNotAllowedError(data, 'zeebe:TaskSchedule', 'bpmn:UserTask')) {
|
|
302
|
+
const { extensionElement: taskSchedule } = data;
|
|
303
|
+
|
|
304
|
+
let ids = [];
|
|
305
|
+
|
|
306
|
+
if (taskSchedule.get('dueDate')) {
|
|
307
|
+
ids = [ ...ids, 'taskScheduleDueDate' ];
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
if (taskSchedule.get('followUpDate')) {
|
|
311
|
+
ids = [ ...ids, 'taskScheduleFollowUpDate' ];
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
return ids;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
if (isExpressionValueNotAllowedError(data, 'priority', 'zeebe:PriorityDefinition')
|
|
318
|
+
|| isExtensionElementNotAllowedError(data, 'zeebe:PriorityDefinition', 'bpmn:UserTask')) {
|
|
319
|
+
return [ 'priorityDefinitionPriority' ];
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
if (isPropertyError(data, 'propagateAllParentVariables', 'zeebe:CalledElement')) {
|
|
323
|
+
return [ 'propagateAllParentVariables' ];
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
if (isPropertyError(data, 'name', 'bpmn:LinkEventDefinition')
|
|
327
|
+
|| isElementPropertyValueDuplicated(data, 'name', 'bpmn:LinkEventDefinition')) {
|
|
328
|
+
return [ 'linkName' ];
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
if (isPropertyError(data, 'waitForCompletion', 'bpmn:CompensateEventDefinition')) {
|
|
332
|
+
return [ 'waitForCompletion' ];
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
if (isPropertyError(data, 'type', 'zeebe:ExecutionListener')) {
|
|
336
|
+
const index = path[ path.length - 2 ];
|
|
337
|
+
|
|
338
|
+
return [ `${id}-executionListener-${index}-listenerType` ];
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
if (isPropertyValuesDuplicatedError(data, 'zeebe:ExecutionListeners')) {
|
|
342
|
+
const { properties, propertiesName } = data;
|
|
343
|
+
|
|
344
|
+
return properties.map(property => {
|
|
345
|
+
const index = data.node.get(propertiesName).indexOf(property);
|
|
346
|
+
|
|
347
|
+
return `${ id }-executionListener-${ index }-listenerType`;
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
if (isPropertyError(data, 'type', 'zeebe:TaskListener')) {
|
|
352
|
+
const index = path[ path.length - 2 ];
|
|
353
|
+
|
|
354
|
+
return [ `${id}-taskListener-${index}-listenerType` ];
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
if (isPropertyError(data, 'bindingType')) {
|
|
358
|
+
return [ 'bindingType' ];
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
if (isPropertyError(data, 'versionTag') || isExtensionElementNotAllowedError(data, 'zeebe:VersionTag')) {
|
|
362
|
+
return [ 'versionTag' ];
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
return [];
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
export function getErrorMessage(id, report) {
|
|
369
|
+
const {
|
|
370
|
+
data = {},
|
|
371
|
+
executionPlatformVersion
|
|
372
|
+
} = report;
|
|
373
|
+
|
|
374
|
+
const {
|
|
375
|
+
type,
|
|
376
|
+
allowedVersion
|
|
377
|
+
} = data;
|
|
378
|
+
|
|
379
|
+
// adjust FEEL message
|
|
380
|
+
if (type === ERROR_TYPES.FEEL_EXPRESSION_INVALID) {
|
|
381
|
+
return 'Unparsable FEEL expression.';
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
if (type === ERROR_TYPES.EXPRESSION_NOT_ALLOWED) {
|
|
385
|
+
return 'Cannot be an expression.';
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
if (id === 'isExecutable') {
|
|
389
|
+
const { parentNode } = data;
|
|
390
|
+
|
|
391
|
+
if (parentNode && is(parentNode, 'bpmn:Participant')) {
|
|
392
|
+
return 'One process must be executable.';
|
|
393
|
+
} else {
|
|
394
|
+
return 'Process must be executable.';
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
if ([ 'businessRuleImplementation', 'scriptImplementation' ].includes(id)) {
|
|
399
|
+
return 'Implementation must be defined.';
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
if (id === 'errorRef') {
|
|
403
|
+
return 'Global error reference must be defined.';
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
if (id === 'escalationRef') {
|
|
407
|
+
return 'Global escalation reference must be defined.';
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
if (id === 'messageRef') {
|
|
411
|
+
return 'Global message reference must be defined.';
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
if (id === 'signalRef') {
|
|
415
|
+
return 'Global signal reference must be defined.';
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
if (id === 'decisionId') {
|
|
419
|
+
return 'Decision ID must be defined.';
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
if (id === 'scriptExpression') {
|
|
423
|
+
return 'FEEL expression must be defined.';
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
if (id === 'resultVariable') {
|
|
427
|
+
return 'Result variable must be defined.';
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
if (id === 'errorCode' && type === ERROR_TYPES.PROPERTY_REQUIRED) {
|
|
431
|
+
return 'Code must be defined.';
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
if (id === 'escalationCode' && type === ERROR_TYPES.PROPERTY_REQUIRED) {
|
|
435
|
+
return 'Code must be defined.';
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
if (id === 'messageName') {
|
|
439
|
+
return 'Name must be defined.';
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
if (id === 'signalName') {
|
|
443
|
+
return 'Name must be defined.';
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
if (id === 'multiInstance-inputCollection') {
|
|
447
|
+
return 'Input collection must be defined.';
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
if (id === 'multiInstance-outputCollection') {
|
|
451
|
+
return 'Output collection must be defined.';
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
if (id === 'multiInstance-outputElement') {
|
|
455
|
+
return 'Output element must be defined.';
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
if (id === 'completionCondition' && type === ERROR_TYPES.PROPERTY_NOT_ALLOWED) {
|
|
459
|
+
return getNotSupportedMessage('', allowedVersion);
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
if (id === 'cancelRemainingInstances' && type === ERROR_TYPES.PROPERTY_VALUE_NOT_ALLOWED) {
|
|
463
|
+
return 'Must be checked.';
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
if (id === 'targetProcessId') {
|
|
467
|
+
return 'Process ID must be defined.';
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
if (id === 'taskDefinitionType') {
|
|
471
|
+
return 'Type must be defined.';
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
if (id === 'timerEventDefinitionType' && type === ERROR_TYPES.PROPERTY_REQUIRED) {
|
|
475
|
+
return 'Type must be defined.';
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
if (id === 'messageSubscriptionCorrelationKey'
|
|
479
|
+
&& [
|
|
480
|
+
ERROR_TYPES.EXTENSION_ELEMENT_REQUIRED,
|
|
481
|
+
ERROR_TYPES.PROPERTY_REQUIRED
|
|
482
|
+
].includes(type)) {
|
|
483
|
+
return 'Subscription correlation key must be defined.';
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
if (id === 'customFormKey') {
|
|
487
|
+
return 'Form key must be defined.';
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
if (id === 'formId') {
|
|
491
|
+
if (type === ERROR_TYPES.PROPERTY_REQUIRED) {
|
|
492
|
+
return 'Form ID must be defined.';
|
|
493
|
+
} else if (type === ERROR_TYPES.PROPERTY_NOT_ALLOWED) {
|
|
494
|
+
return getNotSupportedMessage('Form ID', allowedVersion);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
if (id === 'externalReference') {
|
|
499
|
+
return 'External reference must be defined.';
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
if (id === 'formConfiguration') {
|
|
503
|
+
return 'Form JSON configuration must be defined.';
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
if (/^.+-header-[0-9]+-key$/.test(id)) {
|
|
507
|
+
return 'Must be unique.';
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
if (/^.+-extensionProperty-[0-9]+-name$/.test(id)) {
|
|
511
|
+
return getNotSupportedMessage('', allowedVersion);
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
if (id === 'userTaskImplementation') {
|
|
515
|
+
if (type === ERROR_TYPES.EXTENSION_ELEMENT_NOT_ALLOWED) {
|
|
516
|
+
return getNotSupportedMessage('', allowedVersion);
|
|
517
|
+
} else if (type === ERROR_TYPES.EXTENSION_ELEMENT_REQUIRED) {
|
|
518
|
+
return getNotSupportedMessage('');
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
if (id === 'conditionExpression') {
|
|
523
|
+
return 'Condition expression must be defined.';
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
if (id === 'timerEventDefinitionType' && type === ERROR_TYPES.PROPERTY_NOT_ALLOWED) {
|
|
527
|
+
return getNotSupportedMessage('Type', allowedVersion);
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
if (id === 'timerEventDefinitionValue') {
|
|
531
|
+
if (type === ERROR_TYPES.EXPRESSION_REQUIRED) {
|
|
532
|
+
return 'Value must be defined.';
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
const { property } = data;
|
|
536
|
+
|
|
537
|
+
if (property === 'timeCycle') {
|
|
538
|
+
if (!greaterOrEqual(executionPlatformVersion, '8.1')) {
|
|
539
|
+
return 'Must be an expression, an ISO 8601 repeating interval, or a cron expression (cron only supported by Camunda 8.1 or newer).';
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
return 'Must be an expression, an ISO 8601 repeating interval, or a cron expression.';
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
if (property === 'timeDate') {
|
|
546
|
+
return 'Must be an expression, or an ISO 8601 date.';
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
if (property === 'timeDuration') {
|
|
550
|
+
return 'Must be an expression, or an ISO 8601 interval.';
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
if (id === 'assignmentDefinitionCandidateUsers') {
|
|
555
|
+
return getNotSupportedMessage('', allowedVersion);
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
if (id === 'taskScheduleDueDate') {
|
|
559
|
+
if (type === ERROR_TYPES.EXTENSION_ELEMENT_NOT_ALLOWED) {
|
|
560
|
+
return getNotSupportedMessage('', allowedVersion);
|
|
561
|
+
} else {
|
|
562
|
+
return 'Must be an ISO 8601 date.';
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
if (id === 'taskScheduleFollowUpDate') {
|
|
567
|
+
if (type === ERROR_TYPES.EXTENSION_ELEMENT_NOT_ALLOWED) {
|
|
568
|
+
return getNotSupportedMessage('', allowedVersion);
|
|
569
|
+
} else {
|
|
570
|
+
return 'Must be an ISO 8601 date.';
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
if (id === 'priorityDefinitionPriority') {
|
|
575
|
+
if (type === ERROR_TYPES.EXTENSION_ELEMENT_NOT_ALLOWED) {
|
|
576
|
+
return getNotSupportedMessage('', allowedVersion);
|
|
577
|
+
} else {
|
|
578
|
+
return 'Must be an expression, or an integer between 0 and 100.';
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
if (id === 'propagateAllParentVariables') {
|
|
583
|
+
return getNotSupportedMessage('', allowedVersion);
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
if (id === 'linkName') {
|
|
587
|
+
if (type === ERROR_TYPES.ELEMENT_PROPERTY_VALUE_DUPLICATED) {
|
|
588
|
+
return 'Must be unique.';
|
|
589
|
+
} else {
|
|
590
|
+
return 'Must be defined.';
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
if (id === 'waitForCompletion') {
|
|
595
|
+
return 'Must wait for completion.';
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
if (/^.+-executionListener-[0-9]+-listenerType$/.test(id)) {
|
|
599
|
+
if (type === ERROR_TYPES.PROPERTY_VALUES_DUPLICATED) {
|
|
600
|
+
return 'Must be unique.';
|
|
601
|
+
} else {
|
|
602
|
+
return 'Must be defined.';
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
if (/^.+-taskListener-[0-9]+-listenerType$/.test(id)) {
|
|
607
|
+
return 'Must be defined.';
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
if (id === 'bindingType') {
|
|
611
|
+
return getNotSupportedMessage('', allowedVersion);
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
if (id === 'versionTag') {
|
|
615
|
+
if (type === ERROR_TYPES.EXTENSION_ELEMENT_NOT_ALLOWED) {
|
|
616
|
+
return getNotSupportedMessage('', allowedVersion);
|
|
617
|
+
} else {
|
|
618
|
+
return 'Version tag must be defined.';
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
function isExtensionElementNotAllowedError(data, extensionElement, type) {
|
|
624
|
+
return data.type === ERROR_TYPES.EXTENSION_ELEMENT_NOT_ALLOWED
|
|
625
|
+
&& is(data.extensionElement, extensionElement)
|
|
626
|
+
&& (!type || is(data.node, type));
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
function isExtensionElementRequiredError(data, requiredExtensionElement, type) {
|
|
630
|
+
return data.type === ERROR_TYPES.EXTENSION_ELEMENT_REQUIRED
|
|
631
|
+
&& (isArray(data.requiredExtensionElement) && data.requiredExtensionElement.includes(requiredExtensionElement)
|
|
632
|
+
|| data.requiredExtensionElement === requiredExtensionElement)
|
|
633
|
+
&& (!type || is(data.node, type));
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
function isPropertyDependentRequiredError(data, dependentRequiredProperty, type) {
|
|
637
|
+
return data.type === ERROR_TYPES.PROPERTY_DEPENDENT_REQUIRED
|
|
638
|
+
&& data.dependentRequiredProperty === dependentRequiredProperty
|
|
639
|
+
&& (!type || is(data.node, type));
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
|
|
643
|
+
function isPropertyError(data, property, type) {
|
|
644
|
+
return getPropertyName(data) === property
|
|
645
|
+
&& (!type || is(data.node, type));
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
function getPropertyName(data) {
|
|
649
|
+
if (data.type === ERROR_TYPES.PROPERTY_REQUIRED) {
|
|
650
|
+
return data.requiredProperty;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
return data.property;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
function isType(data, type) {
|
|
657
|
+
return data.node && is(data.node, type);
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
function isOneOfPropertiesRequiredError(data, requiredProperty, type) {
|
|
661
|
+
return data.type === ERROR_TYPES.PROPERTY_REQUIRED
|
|
662
|
+
&& (isArray(data.requiredProperty) && data.requiredProperty.includes(requiredProperty))
|
|
663
|
+
&& (!type || is(data.node, type));
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
function isPropertyValueDuplicatedError(data, propertiesName, duplicatedProperty, type) {
|
|
667
|
+
return data.type === ERROR_TYPES.PROPERTY_VALUE_DUPLICATED
|
|
668
|
+
&& data.propertiesName === propertiesName
|
|
669
|
+
&& data.duplicatedProperty === duplicatedProperty
|
|
670
|
+
&& (!type || is(data.node, type));
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
function isPropertyValuesDuplicatedError(data, type) {
|
|
674
|
+
return data.type === ERROR_TYPES.PROPERTY_VALUES_DUPLICATED
|
|
675
|
+
&& (!type || is(data.node, type));
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
function isExpressionRequiredError(data, propertyName, type) {
|
|
679
|
+
return data.type === ERROR_TYPES.EXPRESSION_REQUIRED
|
|
680
|
+
&& data.property === propertyName
|
|
681
|
+
&& (!type || is(data.node, type));
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
function isExpressionValueNotAllowedError(data, propertyName, type) {
|
|
685
|
+
return data.type === ERROR_TYPES.EXPRESSION_VALUE_NOT_ALLOWED
|
|
686
|
+
&& data.property === propertyName
|
|
687
|
+
&& (!type || is(data.node, type));
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
function isElementPropertyValueDuplicated(data, propertyName, type) {
|
|
691
|
+
return data.type === ERROR_TYPES.ELEMENT_PROPERTY_VALUE_DUPLICATED
|
|
692
|
+
&& data.duplicatedProperty === propertyName
|
|
693
|
+
&& (!type || is(data.node, type));
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
function getBusinessObject(element) {
|
|
697
|
+
return element.businessObject || element;
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
function isEmptyString(value) {
|
|
701
|
+
return isString(value) && value.trim() === '';
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
function getNotSupportedMessage(property, allowedVersion) {
|
|
705
|
+
|
|
706
|
+
if (allowedVersion) {
|
|
707
|
+
return property ?
|
|
708
|
+
`${ property } is only supported by Camunda ${ allowedVersion } or newer.` :
|
|
709
|
+
`Only supported by Camunda ${ allowedVersion } or newer.`;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
return property ? `${ property } is not supported.` : 'Not supported.';
|
|
713
713
|
}
|