@camunda/linting 3.41.0 → 3.43.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 +69 -64
- 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 +867 -861
- package/lib/utils/properties-panel.js +757 -757
- package/lib/utils/types.js +46 -46
- package/lib/utils/version.js +8 -8
- package/package.json +85 -85
|
@@ -1,861 +1,867 @@
|
|
|
1
|
-
import { ERROR_TYPES } from 'bpmnlint-plugin-camunda-compat/rules/utils/element';
|
|
2
|
-
|
|
3
|
-
import { is, isAny } from 'bpmnlint-utils';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
every,
|
|
7
|
-
isArray,
|
|
8
|
-
isString
|
|
9
|
-
} from 'min-dash';
|
|
10
|
-
|
|
11
|
-
import { getTypeString } from './types';
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
greaterOrEqual,
|
|
15
|
-
toSemverMinor
|
|
16
|
-
} from './version';
|
|
17
|
-
|
|
18
|
-
const TIMER_PROPERTIES = [
|
|
19
|
-
'timeCycle',
|
|
20
|
-
'timeDate',
|
|
21
|
-
'timeDuration'
|
|
22
|
-
];
|
|
23
|
-
|
|
24
|
-
const TIMER_PROPERTY_LABELS = {
|
|
25
|
-
timeCycle: 'Cycle',
|
|
26
|
-
timeDate: 'Date',
|
|
27
|
-
timeDuration: 'Duration'
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const executionPlatformLabels = {
|
|
31
|
-
'Camunda Cloud': {
|
|
32
|
-
'default': 'Camunda',
|
|
33
|
-
'1.0': 'Camunda 8 (Zeebe 1.0)',
|
|
34
|
-
'1.1': 'Camunda 8 (Zeebe 1.1)',
|
|
35
|
-
'1.2': 'Camunda 8 (Zeebe 1.2)',
|
|
36
|
-
'1.3': 'Camunda 8 (Zeebe 1.3)'
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export function getExecutionPlatformLabel(executionPlatform, executionPlatformVersion) {
|
|
41
|
-
const executionPlatformLabel = executionPlatformLabels[ executionPlatform ]
|
|
42
|
-
&& executionPlatformLabels[ executionPlatform ][ toSemverMinor(executionPlatformVersion) ];
|
|
43
|
-
|
|
44
|
-
if (executionPlatformLabel) {
|
|
45
|
-
return executionPlatformLabel;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (executionPlatformLabels[ executionPlatform ]
|
|
49
|
-
&& executionPlatformLabels[ executionPlatform ][ 'default' ]) {
|
|
50
|
-
executionPlatform = executionPlatformLabels[ executionPlatform ][ 'default' ];
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return `${ executionPlatform } ${ toSemverMinor(executionPlatformVersion) }`;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function getIndefiniteArticle(type, uppercase = true) {
|
|
57
|
-
if ([
|
|
58
|
-
'Ad',
|
|
59
|
-
'Error',
|
|
60
|
-
'Escalation',
|
|
61
|
-
'Event',
|
|
62
|
-
'Inclusive',
|
|
63
|
-
'Intermediate',
|
|
64
|
-
'Undefined'
|
|
65
|
-
].includes(type.split(' ')[ 0 ])) {
|
|
66
|
-
return uppercase ? 'An' : 'an';
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return uppercase ? 'A' : 'a';
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export function getErrorMessage(report, executionPlatform, executionPlatformVersion, modeler = 'desktop') {
|
|
73
|
-
const {
|
|
74
|
-
data,
|
|
75
|
-
message
|
|
76
|
-
} = report;
|
|
77
|
-
|
|
78
|
-
if (!data) {
|
|
79
|
-
return message;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const { type } = data;
|
|
83
|
-
|
|
84
|
-
if (type === ERROR_TYPES.CHILD_ELEMENT_TYPE_NOT_ALLOWED) {
|
|
85
|
-
return getChildElementTypeNotAllowedErrorMessage(report, executionPlatform, executionPlatformVersion);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
if (type === ERROR_TYPES.ELEMENT_COLLAPSED_NOT_ALLOWED) {
|
|
89
|
-
return getElementCollapsedNotAllowedErrorMessage(report, executionPlatform, executionPlatformVersion);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if (type === ERROR_TYPES.ELEMENT_PROPERTY_VALUE_DUPLICATED) {
|
|
93
|
-
return getElementPropertyValueDuplicatedErrorMessage(report);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
if (type === ERROR_TYPES.ELEMENT_TYPE_NOT_ALLOWED) {
|
|
97
|
-
return getElementTypeNotAllowedErrorMessage(report, executionPlatform, executionPlatformVersion);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (type === ERROR_TYPES.EXTENSION_ELEMENT_NOT_ALLOWED) {
|
|
101
|
-
return getExtensionElementNotAllowedErrorMessage(report, executionPlatform, executionPlatformVersion);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
if (type === ERROR_TYPES.EXTENSION_ELEMENT_REQUIRED) {
|
|
105
|
-
return getExtensionElementRequiredErrorMessage(report, executionPlatform, executionPlatformVersion);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
if (type === ERROR_TYPES.PROPERTY_DEPENDENT_REQUIRED) {
|
|
109
|
-
return getPropertyDependentRequiredErrorMessage(report);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
if (type === ERROR_TYPES.PROPERTY_NOT_ALLOWED) {
|
|
113
|
-
return getPropertyNotAllowedErrorMessage(report, executionPlatform, executionPlatformVersion, modeler);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if (type === ERROR_TYPES.PROPERTY_REQUIRED) {
|
|
117
|
-
return getPropertyRequiredErrorMessage(report, executionPlatform, executionPlatformVersion);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
if (type === ERROR_TYPES.PROPERTY_VALUE_DUPLICATED) {
|
|
121
|
-
return getPropertyValueDuplicatedErrorMessage(report);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
if (type === ERROR_TYPES.PROPERTY_VALUES_DUPLICATED) {
|
|
125
|
-
return getPropertyValuesDuplicatedErrorMessage(report);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
if (type == ERROR_TYPES.PROPERTY_VALUE_NOT_ALLOWED) {
|
|
129
|
-
return getPropertyValueNotAllowedErrorMessage(report, executionPlatform, executionPlatformVersion, modeler);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
if (type === ERROR_TYPES.PROPERTY_VALUE_REQUIRED) {
|
|
133
|
-
return getPropertyValueRequiredErrorMessage(report, executionPlatform, executionPlatformVersion);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
if (type === ERROR_TYPES.EXPRESSION_REQUIRED) {
|
|
137
|
-
return getExpressionRequiredErrorMessage(report);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
if (type === ERROR_TYPES.EXPRESSION_VALUE_NOT_ALLOWED) {
|
|
141
|
-
return getExpressionValueNotAllowedErrorMessage(report, executionPlatform, executionPlatformVersion);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
if (type === ERROR_TYPES.EXPRESSION_NOT_ALLOWED) {
|
|
145
|
-
return getExpressionNotAllowedErrorMessage(report);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
if (type === ERROR_TYPES.EVENT_BASED_GATEWAY_TARGET_NOT_ALLOWED) {
|
|
149
|
-
return getEventBasedGatewayTargetNotAllowedErrorMessage(report);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
if (type === ERROR_TYPES.SECRET_EXPRESSION_FORMAT_DEPRECATED) {
|
|
153
|
-
return getSecretExpressionFormatDeprecatedErrorMessage(report);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
if (type === ERROR_TYPES.LOOP_NOT_ALLOWED) {
|
|
157
|
-
return getLoopNotAllowedErrorMessage(report);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
if (type === ERROR_TYPES.ATTACHED_TO_REF_ELEMENT_TYPE_NOT_ALLOWED) {
|
|
161
|
-
return getAttachedToRefElementTypeNotAllowed(report);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
return message;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
function getChildElementTypeNotAllowedErrorMessage(report, executionPlatform, executionPlatformVersion) {
|
|
168
|
-
const { data } = report;
|
|
169
|
-
|
|
170
|
-
const {
|
|
171
|
-
allowedVersion,
|
|
172
|
-
node,
|
|
173
|
-
parent
|
|
174
|
-
} = data;
|
|
175
|
-
|
|
176
|
-
const typeString = getTypeString(node),
|
|
177
|
-
parentTypeString = getTypeString(parent);
|
|
178
|
-
|
|
179
|
-
return getSupportedMessage(
|
|
180
|
-
`${ getIndefiniteArticle(typeString) } <${ typeString }> in ${ getIndefiniteArticle(parentTypeString, false) } <${ parentTypeString }>`,
|
|
181
|
-
executionPlatform,
|
|
182
|
-
executionPlatformVersion,
|
|
183
|
-
allowedVersion
|
|
184
|
-
);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
function getElementCollapsedNotAllowedErrorMessage(report, executionPlatform, executionPlatformVersion) {
|
|
188
|
-
const {
|
|
189
|
-
data,
|
|
190
|
-
message
|
|
191
|
-
} = report;
|
|
192
|
-
|
|
193
|
-
const { allowedVersion, node } = data;
|
|
194
|
-
|
|
195
|
-
const typeString = getTypeString(node);
|
|
196
|
-
|
|
197
|
-
if (is(node, 'bpmn:SubProcess')) {
|
|
198
|
-
return getSupportedMessage(`A collapsed <${typeString}>`, executionPlatform, executionPlatformVersion, allowedVersion);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
return message;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
function getElementTypeNotAllowedErrorMessage(report, executionPlatform, executionPlatformVersion) {
|
|
205
|
-
const { data } = report;
|
|
206
|
-
|
|
207
|
-
const {
|
|
208
|
-
allowedVersion,
|
|
209
|
-
node
|
|
210
|
-
} = data;
|
|
211
|
-
|
|
212
|
-
const typeString = getTypeString(node);
|
|
213
|
-
|
|
214
|
-
return getSupportedMessage(`${ getIndefiniteArticle(typeString) } <${ typeString }>`, executionPlatform, executionPlatformVersion, allowedVersion);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
function getPropertyValueDuplicatedErrorMessage(report) {
|
|
218
|
-
const {
|
|
219
|
-
data,
|
|
220
|
-
message
|
|
221
|
-
} = report;
|
|
222
|
-
|
|
223
|
-
const {
|
|
224
|
-
node,
|
|
225
|
-
parentNode,
|
|
226
|
-
duplicatedPropertyValue,
|
|
227
|
-
properties
|
|
228
|
-
} = data;
|
|
229
|
-
|
|
230
|
-
const typeString = getTypeString(parentNode || node);
|
|
231
|
-
|
|
232
|
-
if (is(node, 'zeebe:TaskHeaders') && every(properties, property => is(property, 'zeebe:Header'))) {
|
|
233
|
-
return `${ getIndefiniteArticle(typeString) } <${ typeString }> with two or more <Headers> with the same <Key> (${ duplicatedPropertyValue }) is not supported`;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
return message;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
function getPropertyValuesDuplicatedErrorMessage(report) {
|
|
240
|
-
const {
|
|
241
|
-
data,
|
|
242
|
-
message
|
|
243
|
-
} = report;
|
|
244
|
-
|
|
245
|
-
const {
|
|
246
|
-
node,
|
|
247
|
-
parentNode,
|
|
248
|
-
duplicatedProperties,
|
|
249
|
-
properties
|
|
250
|
-
} = data;
|
|
251
|
-
|
|
252
|
-
const {
|
|
253
|
-
eventType,
|
|
254
|
-
type
|
|
255
|
-
} = duplicatedProperties;
|
|
256
|
-
|
|
257
|
-
const typeString = getTypeString(parentNode || node);
|
|
258
|
-
|
|
259
|
-
if (is(node, 'zeebe:ExecutionListeners') && every(properties, property => is(property, 'zeebe:ExecutionListener'))) {
|
|
260
|
-
return `${ getIndefiniteArticle(typeString) } <${ typeString }> with two or more <Execution Listeners> with the same <Event Type> (${ eventType }) and <Type> (${ type }) is not supported`;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
return message;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
function getPropertyValueRequiredErrorMessage(report, executionPlatform, executionPlatformVersion) {
|
|
267
|
-
const {
|
|
268
|
-
data,
|
|
269
|
-
message
|
|
270
|
-
} = report;
|
|
271
|
-
|
|
272
|
-
const {
|
|
273
|
-
allowedVersion,
|
|
274
|
-
node,
|
|
275
|
-
property,
|
|
276
|
-
parentNode
|
|
277
|
-
} = data;
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
return '
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
} =
|
|
369
|
-
|
|
370
|
-
const
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
return
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
if (is(node, 'zeebe:
|
|
578
|
-
return
|
|
579
|
-
}
|
|
580
|
-
if (is(node, 'zeebe:
|
|
581
|
-
return 'An <
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
} =
|
|
672
|
-
|
|
673
|
-
const
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
}
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
} =
|
|
693
|
-
|
|
694
|
-
const
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
} =
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
}
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
const {
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
} =
|
|
824
|
-
|
|
825
|
-
const
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
}
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
const {
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
}
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
}
|
|
1
|
+
import { ERROR_TYPES } from 'bpmnlint-plugin-camunda-compat/rules/utils/element';
|
|
2
|
+
|
|
3
|
+
import { is, isAny } from 'bpmnlint-utils';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
every,
|
|
7
|
+
isArray,
|
|
8
|
+
isString
|
|
9
|
+
} from 'min-dash';
|
|
10
|
+
|
|
11
|
+
import { getTypeString } from './types';
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
greaterOrEqual,
|
|
15
|
+
toSemverMinor
|
|
16
|
+
} from './version';
|
|
17
|
+
|
|
18
|
+
const TIMER_PROPERTIES = [
|
|
19
|
+
'timeCycle',
|
|
20
|
+
'timeDate',
|
|
21
|
+
'timeDuration'
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
const TIMER_PROPERTY_LABELS = {
|
|
25
|
+
timeCycle: 'Cycle',
|
|
26
|
+
timeDate: 'Date',
|
|
27
|
+
timeDuration: 'Duration'
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const executionPlatformLabels = {
|
|
31
|
+
'Camunda Cloud': {
|
|
32
|
+
'default': 'Camunda',
|
|
33
|
+
'1.0': 'Camunda 8 (Zeebe 1.0)',
|
|
34
|
+
'1.1': 'Camunda 8 (Zeebe 1.1)',
|
|
35
|
+
'1.2': 'Camunda 8 (Zeebe 1.2)',
|
|
36
|
+
'1.3': 'Camunda 8 (Zeebe 1.3)'
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export function getExecutionPlatformLabel(executionPlatform, executionPlatformVersion) {
|
|
41
|
+
const executionPlatformLabel = executionPlatformLabels[ executionPlatform ]
|
|
42
|
+
&& executionPlatformLabels[ executionPlatform ][ toSemverMinor(executionPlatformVersion) ];
|
|
43
|
+
|
|
44
|
+
if (executionPlatformLabel) {
|
|
45
|
+
return executionPlatformLabel;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (executionPlatformLabels[ executionPlatform ]
|
|
49
|
+
&& executionPlatformLabels[ executionPlatform ][ 'default' ]) {
|
|
50
|
+
executionPlatform = executionPlatformLabels[ executionPlatform ][ 'default' ];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return `${ executionPlatform } ${ toSemverMinor(executionPlatformVersion) }`;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function getIndefiniteArticle(type, uppercase = true) {
|
|
57
|
+
if ([
|
|
58
|
+
'Ad',
|
|
59
|
+
'Error',
|
|
60
|
+
'Escalation',
|
|
61
|
+
'Event',
|
|
62
|
+
'Inclusive',
|
|
63
|
+
'Intermediate',
|
|
64
|
+
'Undefined'
|
|
65
|
+
].includes(type.split(' ')[ 0 ])) {
|
|
66
|
+
return uppercase ? 'An' : 'an';
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return uppercase ? 'A' : 'a';
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function getErrorMessage(report, executionPlatform, executionPlatformVersion, modeler = 'desktop') {
|
|
73
|
+
const {
|
|
74
|
+
data,
|
|
75
|
+
message
|
|
76
|
+
} = report;
|
|
77
|
+
|
|
78
|
+
if (!data) {
|
|
79
|
+
return message;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const { type } = data;
|
|
83
|
+
|
|
84
|
+
if (type === ERROR_TYPES.CHILD_ELEMENT_TYPE_NOT_ALLOWED) {
|
|
85
|
+
return getChildElementTypeNotAllowedErrorMessage(report, executionPlatform, executionPlatformVersion);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (type === ERROR_TYPES.ELEMENT_COLLAPSED_NOT_ALLOWED) {
|
|
89
|
+
return getElementCollapsedNotAllowedErrorMessage(report, executionPlatform, executionPlatformVersion);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (type === ERROR_TYPES.ELEMENT_PROPERTY_VALUE_DUPLICATED) {
|
|
93
|
+
return getElementPropertyValueDuplicatedErrorMessage(report);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (type === ERROR_TYPES.ELEMENT_TYPE_NOT_ALLOWED) {
|
|
97
|
+
return getElementTypeNotAllowedErrorMessage(report, executionPlatform, executionPlatformVersion);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (type === ERROR_TYPES.EXTENSION_ELEMENT_NOT_ALLOWED) {
|
|
101
|
+
return getExtensionElementNotAllowedErrorMessage(report, executionPlatform, executionPlatformVersion);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (type === ERROR_TYPES.EXTENSION_ELEMENT_REQUIRED) {
|
|
105
|
+
return getExtensionElementRequiredErrorMessage(report, executionPlatform, executionPlatformVersion);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (type === ERROR_TYPES.PROPERTY_DEPENDENT_REQUIRED) {
|
|
109
|
+
return getPropertyDependentRequiredErrorMessage(report);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (type === ERROR_TYPES.PROPERTY_NOT_ALLOWED) {
|
|
113
|
+
return getPropertyNotAllowedErrorMessage(report, executionPlatform, executionPlatformVersion, modeler);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (type === ERROR_TYPES.PROPERTY_REQUIRED) {
|
|
117
|
+
return getPropertyRequiredErrorMessage(report, executionPlatform, executionPlatformVersion);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (type === ERROR_TYPES.PROPERTY_VALUE_DUPLICATED) {
|
|
121
|
+
return getPropertyValueDuplicatedErrorMessage(report);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (type === ERROR_TYPES.PROPERTY_VALUES_DUPLICATED) {
|
|
125
|
+
return getPropertyValuesDuplicatedErrorMessage(report);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (type == ERROR_TYPES.PROPERTY_VALUE_NOT_ALLOWED) {
|
|
129
|
+
return getPropertyValueNotAllowedErrorMessage(report, executionPlatform, executionPlatformVersion, modeler);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (type === ERROR_TYPES.PROPERTY_VALUE_REQUIRED) {
|
|
133
|
+
return getPropertyValueRequiredErrorMessage(report, executionPlatform, executionPlatformVersion);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (type === ERROR_TYPES.EXPRESSION_REQUIRED) {
|
|
137
|
+
return getExpressionRequiredErrorMessage(report);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (type === ERROR_TYPES.EXPRESSION_VALUE_NOT_ALLOWED) {
|
|
141
|
+
return getExpressionValueNotAllowedErrorMessage(report, executionPlatform, executionPlatformVersion);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (type === ERROR_TYPES.EXPRESSION_NOT_ALLOWED) {
|
|
145
|
+
return getExpressionNotAllowedErrorMessage(report);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (type === ERROR_TYPES.EVENT_BASED_GATEWAY_TARGET_NOT_ALLOWED) {
|
|
149
|
+
return getEventBasedGatewayTargetNotAllowedErrorMessage(report);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (type === ERROR_TYPES.SECRET_EXPRESSION_FORMAT_DEPRECATED) {
|
|
153
|
+
return getSecretExpressionFormatDeprecatedErrorMessage(report);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (type === ERROR_TYPES.LOOP_NOT_ALLOWED) {
|
|
157
|
+
return getLoopNotAllowedErrorMessage(report);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (type === ERROR_TYPES.ATTACHED_TO_REF_ELEMENT_TYPE_NOT_ALLOWED) {
|
|
161
|
+
return getAttachedToRefElementTypeNotAllowed(report);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return message;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function getChildElementTypeNotAllowedErrorMessage(report, executionPlatform, executionPlatformVersion) {
|
|
168
|
+
const { data } = report;
|
|
169
|
+
|
|
170
|
+
const {
|
|
171
|
+
allowedVersion,
|
|
172
|
+
node,
|
|
173
|
+
parent
|
|
174
|
+
} = data;
|
|
175
|
+
|
|
176
|
+
const typeString = getTypeString(node),
|
|
177
|
+
parentTypeString = getTypeString(parent);
|
|
178
|
+
|
|
179
|
+
return getSupportedMessage(
|
|
180
|
+
`${ getIndefiniteArticle(typeString) } <${ typeString }> in ${ getIndefiniteArticle(parentTypeString, false) } <${ parentTypeString }>`,
|
|
181
|
+
executionPlatform,
|
|
182
|
+
executionPlatformVersion,
|
|
183
|
+
allowedVersion
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function getElementCollapsedNotAllowedErrorMessage(report, executionPlatform, executionPlatformVersion) {
|
|
188
|
+
const {
|
|
189
|
+
data,
|
|
190
|
+
message
|
|
191
|
+
} = report;
|
|
192
|
+
|
|
193
|
+
const { allowedVersion, node } = data;
|
|
194
|
+
|
|
195
|
+
const typeString = getTypeString(node);
|
|
196
|
+
|
|
197
|
+
if (is(node, 'bpmn:SubProcess')) {
|
|
198
|
+
return getSupportedMessage(`A collapsed <${typeString}>`, executionPlatform, executionPlatformVersion, allowedVersion);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return message;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function getElementTypeNotAllowedErrorMessage(report, executionPlatform, executionPlatformVersion) {
|
|
205
|
+
const { data } = report;
|
|
206
|
+
|
|
207
|
+
const {
|
|
208
|
+
allowedVersion,
|
|
209
|
+
node
|
|
210
|
+
} = data;
|
|
211
|
+
|
|
212
|
+
const typeString = getTypeString(node);
|
|
213
|
+
|
|
214
|
+
return getSupportedMessage(`${ getIndefiniteArticle(typeString) } <${ typeString }>`, executionPlatform, executionPlatformVersion, allowedVersion);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function getPropertyValueDuplicatedErrorMessage(report) {
|
|
218
|
+
const {
|
|
219
|
+
data,
|
|
220
|
+
message
|
|
221
|
+
} = report;
|
|
222
|
+
|
|
223
|
+
const {
|
|
224
|
+
node,
|
|
225
|
+
parentNode,
|
|
226
|
+
duplicatedPropertyValue,
|
|
227
|
+
properties
|
|
228
|
+
} = data;
|
|
229
|
+
|
|
230
|
+
const typeString = getTypeString(parentNode || node);
|
|
231
|
+
|
|
232
|
+
if (is(node, 'zeebe:TaskHeaders') && every(properties, property => is(property, 'zeebe:Header'))) {
|
|
233
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> with two or more <Headers> with the same <Key> (${ duplicatedPropertyValue }) is not supported`;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return message;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function getPropertyValuesDuplicatedErrorMessage(report) {
|
|
240
|
+
const {
|
|
241
|
+
data,
|
|
242
|
+
message
|
|
243
|
+
} = report;
|
|
244
|
+
|
|
245
|
+
const {
|
|
246
|
+
node,
|
|
247
|
+
parentNode,
|
|
248
|
+
duplicatedProperties,
|
|
249
|
+
properties
|
|
250
|
+
} = data;
|
|
251
|
+
|
|
252
|
+
const {
|
|
253
|
+
eventType,
|
|
254
|
+
type
|
|
255
|
+
} = duplicatedProperties;
|
|
256
|
+
|
|
257
|
+
const typeString = getTypeString(parentNode || node);
|
|
258
|
+
|
|
259
|
+
if (is(node, 'zeebe:ExecutionListeners') && every(properties, property => is(property, 'zeebe:ExecutionListener'))) {
|
|
260
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> with two or more <Execution Listeners> with the same <Event Type> (${ eventType }) and <Type> (${ type }) is not supported`;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
return message;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function getPropertyValueRequiredErrorMessage(report, executionPlatform, executionPlatformVersion) {
|
|
267
|
+
const {
|
|
268
|
+
data,
|
|
269
|
+
message
|
|
270
|
+
} = report;
|
|
271
|
+
|
|
272
|
+
const {
|
|
273
|
+
allowedVersion,
|
|
274
|
+
node,
|
|
275
|
+
property,
|
|
276
|
+
parentNode
|
|
277
|
+
} = data;
|
|
278
|
+
|
|
279
|
+
const elementParent = node.$parent;
|
|
280
|
+
|
|
281
|
+
if (is(node, 'bpmn:Process') && property === 'isExecutable') {
|
|
282
|
+
if (parentNode && is(parentNode, 'bpmn:Participant')) {
|
|
283
|
+
return 'One <Process> must be <Executable>';
|
|
284
|
+
} else {
|
|
285
|
+
return 'A <Process> must be <Executable>';
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
const typeString = getTypeString(parentNode || node);
|
|
290
|
+
|
|
291
|
+
if (is(node, 'bpmn:CompensateEventDefinition') && property === 'waitForCompletion') {
|
|
292
|
+
return getSupportedMessage(`${ getIndefiniteArticle(typeString) } <${ typeString }> with <Wait for completion> disabled`, executionPlatform, executionPlatformVersion, allowedVersion);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
if (is(node, 'bpmn:StartEvent') && property === 'isInterrupting' && elementParent && is(elementParent, 'bpmn:SubProcess') && elementParent.get('triggeredByEvent')) {
|
|
296
|
+
return getSupportedMessage(`An interrupting <${getTypeString(node)}> in an <Event Sub Process> placed in an <Ad Hoc Sub Process>`, executionPlatform, executionPlatformVersion, allowedVersion);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
return message;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
function getExtensionElementNotAllowedErrorMessage(report, executionPlatform, executionPlatformVersion) {
|
|
303
|
+
const {
|
|
304
|
+
data,
|
|
305
|
+
message
|
|
306
|
+
} = report;
|
|
307
|
+
|
|
308
|
+
const {
|
|
309
|
+
allowedVersion,
|
|
310
|
+
node,
|
|
311
|
+
parentNode,
|
|
312
|
+
extensionElement
|
|
313
|
+
} = data;
|
|
314
|
+
|
|
315
|
+
const typeString = getTypeString(parentNode || node);
|
|
316
|
+
|
|
317
|
+
if (is(node, 'bpmn:BusinessRuleTask') && is(extensionElement, 'zeebe:CalledDecision')) {
|
|
318
|
+
return getSupportedMessage('A <Business Rule Task> with <Implementation: DMN decision>', executionPlatform, executionPlatformVersion, allowedVersion);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
if (is(extensionElement, 'zeebe:Properties')) {
|
|
322
|
+
return getSupportedMessage(`${ getIndefiniteArticle(typeString) } <${ typeString }> with <Extension properties>`, executionPlatform, executionPlatformVersion, allowedVersion);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
if (is(extensionElement, 'zeebe:UserTask')) {
|
|
326
|
+
return getSupportedMessage('A <User Task> with <Implementation: Camunda user task>', executionPlatform, executionPlatformVersion, allowedVersion);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
if (is(node, 'bpmn:ScriptTask') && is(extensionElement, 'zeebe:Script')) {
|
|
330
|
+
return getSupportedMessage('A <Script Task> with <Implementation: FEEL expression>', executionPlatform, executionPlatformVersion, allowedVersion);
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
if (is(node, 'bpmn:UserTask') && is(extensionElement, 'zeebe:TaskSchedule')) {
|
|
334
|
+
return getSupportedMessage('A <User Task> with <Due date> or <Follow up date>', executionPlatform, executionPlatformVersion, allowedVersion);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
if (is(node, 'bpmn:UserTask') && is(extensionElement, 'zeebe:PriorityDefinition')) {
|
|
338
|
+
return getSupportedMessage('A <User Task> with <Priority>', executionPlatform, executionPlatformVersion, allowedVersion);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
if (is(node, 'bpmn:StartEvent') && is(extensionElement, 'zeebe:FormDefinition')) {
|
|
342
|
+
return getSupportedMessage('A <Start Event> with <User Task Form>', executionPlatform, executionPlatformVersion, allowedVersion);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
if (is(extensionElement, 'zeebe:ExecutionListeners')) {
|
|
346
|
+
return getSupportedMessage(`${ getIndefiniteArticle(typeString) } <${ typeString }> with <Execution listeners>`, executionPlatform, executionPlatformVersion, allowedVersion);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
if (is(extensionElement, 'zeebe:TaskListeners')) {
|
|
350
|
+
return getSupportedMessage(`${ getIndefiniteArticle(typeString) } <${ typeString }> with <Task listeners>`, executionPlatform, executionPlatformVersion, allowedVersion);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
if (is(node, 'bpmn:Process') && is(extensionElement, 'zeebe:VersionTag')) {
|
|
354
|
+
return getSupportedMessage(`${ getIndefiniteArticle(typeString) } <${ typeString }> with <Version tag>`, executionPlatform, executionPlatformVersion, allowedVersion);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
if (is(node, 'bpmn:AdHocSubProcess') && is(extensionElement, 'zeebe:TaskDefinition')) {
|
|
358
|
+
return getSupportedMessage(`${ getIndefiniteArticle(typeString) } <${ typeString }> with <Implementation: Job worker>`, executionPlatform, executionPlatformVersion, allowedVersion);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
return message;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
function getExtensionElementRequiredErrorMessage(report, executionPlatform, executionPlatformVersion) {
|
|
365
|
+
const {
|
|
366
|
+
data,
|
|
367
|
+
message
|
|
368
|
+
} = report;
|
|
369
|
+
|
|
370
|
+
const {
|
|
371
|
+
node,
|
|
372
|
+
parentNode,
|
|
373
|
+
requiredExtensionElement
|
|
374
|
+
} = data;
|
|
375
|
+
|
|
376
|
+
const typeString = getTypeString(parentNode || node);
|
|
377
|
+
|
|
378
|
+
if (requiredExtensionElement === 'zeebe:CalledElement') {
|
|
379
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> must have a defined <Called element>`;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
if (requiredExtensionElement === 'zeebe:LoopCharacteristics') {
|
|
383
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Multi-instance marker> must have a defined <Input collection>`;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
if (requiredExtensionElement === 'zeebe:Subscription') {
|
|
387
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Message Reference> must have a defined <Subscription correlation key>`;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
if (requiredExtensionElement === 'zeebe:TaskDefinition') {
|
|
391
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> must have a <Task definition type>`;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
if (isArray(requiredExtensionElement) && requiredExtensionElement.includes('zeebe:CalledDecision')) {
|
|
395
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> must have a defined <Implementation>`;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
if (isArray(requiredExtensionElement) && requiredExtensionElement.includes('zeebe:Script')) {
|
|
399
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> must have a defined <Implementation>`;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
if (requiredExtensionElement === 'zeebe:FormDefinition') {
|
|
403
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> should have a defined <Form>`;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
if (requiredExtensionElement === 'zeebe:UserTask') {
|
|
407
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Implementation: Job worker> managed by Camunda is deprecated. Consider migrating to <Implementation: Camunda user task>.`;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
return message;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
function getPropertyDependentRequiredErrorMessage(report) {
|
|
414
|
+
const {
|
|
415
|
+
data,
|
|
416
|
+
message
|
|
417
|
+
} = report;
|
|
418
|
+
|
|
419
|
+
const {
|
|
420
|
+
node,
|
|
421
|
+
parentNode,
|
|
422
|
+
property,
|
|
423
|
+
dependentRequiredProperty
|
|
424
|
+
} = data;
|
|
425
|
+
|
|
426
|
+
const typeString = getTypeString(parentNode || node);
|
|
427
|
+
|
|
428
|
+
if (is(node, 'zeebe:LoopCharacteristics') && property === 'outputCollection' && dependentRequiredProperty === 'outputElement') {
|
|
429
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Multi-instance marker> and defined <Output collection> must have a defined <Output element>`;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
if (is(node, 'zeebe:LoopCharacteristics') && property === 'outputElement' && dependentRequiredProperty === 'outputCollection') {
|
|
433
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Multi-instance marker> and defined <Output element> must have a defined <Output collection>`;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
if (is(node, 'zeebe:AdHoc') && property === 'outputCollection' && dependentRequiredProperty === 'outputElement') {
|
|
437
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> with defined <Output collection> must have a defined <Output element>`;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
if (is(node, 'zeebe:AdHoc') && property === 'outputElement' && dependentRequiredProperty === 'outputCollection') {
|
|
441
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> with defined <Output element> must have a defined <Output collection>`;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
return message;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
function getPropertyNotAllowedErrorMessage(report, executionPlatform, executionPlatformVersion, modeler = 'desktop') {
|
|
448
|
+
const {
|
|
449
|
+
data,
|
|
450
|
+
message
|
|
451
|
+
} = report;
|
|
452
|
+
|
|
453
|
+
const {
|
|
454
|
+
allowedVersion,
|
|
455
|
+
node,
|
|
456
|
+
parentNode,
|
|
457
|
+
property
|
|
458
|
+
} = data;
|
|
459
|
+
|
|
460
|
+
const typeString = getTypeString(parentNode || node);
|
|
461
|
+
|
|
462
|
+
if (property === 'modelerTemplate') {
|
|
463
|
+
if (modeler === 'desktop') {
|
|
464
|
+
return getSupportedMessage(`${ getIndefiniteArticle(typeString) } <Template ${ typeString }>`, executionPlatform, executionPlatformVersion, allowedVersion);
|
|
465
|
+
} else if (modeler === 'web') {
|
|
466
|
+
return getSupportedMessage(`${ getIndefiniteArticle(typeString) } <Connector ${ typeString }>`, executionPlatform, executionPlatformVersion, allowedVersion);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
if (is(node, 'bpmn:InclusiveGateway') && property === 'incoming') {
|
|
471
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> with more than one incoming <Sequence Flow> is not supported by ${ getExecutionPlatformLabel(executionPlatform, executionPlatformVersion) }`;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
if (is(node, 'zeebe:AssignmentDefinition') && property === 'candidateUsers') {
|
|
475
|
+
return getSupportedMessage(`${ getIndefiniteArticle(typeString) } <${ typeString }> with <Candidate users>`, executionPlatform, executionPlatformVersion, allowedVersion);
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
if (is(node, 'bpmn:SequenceFlow') && property === 'conditionExpression') {
|
|
479
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Condition expression> is only supported if the source is an <Exclusive Gateway> or <Inclusive Gateway>`;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
if (is(node, 'bpmn:TimerEventDefinition') && TIMER_PROPERTIES.includes(property)) {
|
|
483
|
+
return getSupportedMessage(`${ getIndefiniteArticle(typeString) } <${ typeString }> with <${ TIMER_PROPERTY_LABELS[ property ] }>`, executionPlatform, executionPlatformVersion, allowedVersion);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
if (is(node, 'zeebe:FormDefinition') && property === 'formId') {
|
|
487
|
+
return getSupportedMessage(`${ getIndefiniteArticle(typeString) } <${ typeString }> with <Form type: Camunda form (linked)>`, executionPlatform, executionPlatformVersion, allowedVersion);
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
if (is(node, 'zeebe:AdHoc') && property === 'outputCollection') {
|
|
491
|
+
return getSupportedMessage(`${ getIndefiniteArticle(typeString) } <${ typeString }> with <Output collection>`, executionPlatform, executionPlatformVersion, allowedVersion);
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
if (is(node, 'zeebe:AdHoc') && property === 'outputElement') {
|
|
495
|
+
return getSupportedMessage(`${ getIndefiniteArticle(typeString) } <${ typeString }> with <Output element>`, executionPlatform, executionPlatformVersion, allowedVersion);
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
return message;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
function getPropertyRequiredErrorMessage(report, executionPlatform, executionPlatformVersion) {
|
|
503
|
+
const {
|
|
504
|
+
data,
|
|
505
|
+
message
|
|
506
|
+
} = report;
|
|
507
|
+
|
|
508
|
+
const {
|
|
509
|
+
allowedVersion,
|
|
510
|
+
node,
|
|
511
|
+
parentNode,
|
|
512
|
+
requiredProperty
|
|
513
|
+
} = data;
|
|
514
|
+
|
|
515
|
+
function isRequiredProperty(requiredPropertyToLookUp) {
|
|
516
|
+
return requiredProperty === requiredPropertyToLookUp || (isArray(requiredProperty) && requiredProperty.includes(requiredPropertyToLookUp));
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
const typeString = getTypeString(parentNode || node);
|
|
520
|
+
|
|
521
|
+
if (parentNode && is(parentNode, 'bpmn:BusinessRuleTask') && is(node, 'zeebe:CalledDecision') && requiredProperty === 'decisionId') {
|
|
522
|
+
return 'A <Business Rule Task> with <Implementation: DMN decision> must have a defined <Called decision ID>';
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
if (parentNode && is(parentNode, 'bpmn:BusinessRuleTask') && is(node, 'zeebe:CalledDecision') && requiredProperty === 'resultVariable') {
|
|
526
|
+
return 'A <Business Rule Task> with <Implementation: DMN decision> must have a defined <Result variable>';
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
if (parentNode && is(parentNode, 'bpmn:ScriptTask') && is(node, 'zeebe:Script') && requiredProperty === 'expression') {
|
|
530
|
+
return 'A <Script Task> with <Implementation: FEEL expression> must have a defined <FEEL expression>';
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
if (parentNode && is(parentNode, 'bpmn:ScriptTask') && is(node, 'zeebe:Script') && requiredProperty === 'resultVariable') {
|
|
534
|
+
return 'A <Script Task> with <Implementation: FEEL expression> must have a defined <Result variable>';
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
if (parentNode && isAny(parentNode, [ 'bpmn:BusinessRuleTask', 'bpmn:ScriptTask' ]) && is(node, 'zeebe:TaskDefinition') && requiredProperty === 'type') {
|
|
538
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Implementation: Job worker> must have a defined <Task definition type>`;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
if (is(node, 'zeebe:CalledElement') && requiredProperty === 'processId') {
|
|
542
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> must have a defined <Called element>`;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
if (is(node, 'bpmn:Error') && requiredProperty === 'errorCode') {
|
|
546
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Error Reference> must have a defined <Error code>`;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
if (is(node, 'bpmn:Escalation') && requiredProperty === 'escalationCode') {
|
|
550
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Escalation Reference> must have a defined <Escalation code>`;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
if (is(node, 'zeebe:LoopCharacteristics') && requiredProperty === 'inputCollection') {
|
|
554
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Multi-instance marker> must have a defined <Input collection>`;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
if (is(node, 'bpmn:Message') && requiredProperty === 'name') {
|
|
558
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Message Reference> must have a defined <Name>`;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
if (is(node, 'bpmn:Signal') && requiredProperty === 'name') {
|
|
562
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Signal Reference> must have a defined <Name>`;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
if (is(node, 'zeebe:Subscription') && requiredProperty === 'correlationKey') {
|
|
566
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Message Reference> must have a defined <Subscription correlation key>`;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
if (is(node, 'zeebe:TaskDefinition') && requiredProperty === 'type') {
|
|
570
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Implementation: Job worker> must have a defined <Task definition type>`;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
if (is(node, 'zeebe:ExecutionListener') && requiredProperty === 'type') {
|
|
574
|
+
return 'An <Execution Listener> must have a defined <Type>';
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
if (is(node, 'zeebe:Input') && requiredProperty === 'source') {
|
|
578
|
+
return `An <Input> must have a defined <Variable assignment value>. Empty variable assignments are only supported by Camunda ${allowedVersion} or newer`;
|
|
579
|
+
}
|
|
580
|
+
if (is(node, 'zeebe:Input') && requiredProperty === 'target') {
|
|
581
|
+
return 'An <Input> must have a defined <Local variable name>';
|
|
582
|
+
}
|
|
583
|
+
if (is(node, 'zeebe:Output') && requiredProperty === 'source') {
|
|
584
|
+
return 'An <Output> must have a defined <Variable assignment value>';
|
|
585
|
+
}
|
|
586
|
+
if (is(node, 'zeebe:Output') && requiredProperty === 'target') {
|
|
587
|
+
return 'An <Output> must have a defined <Process variable name>';
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
if (is(node, 'zeebe:TaskListener') && requiredProperty === 'type') {
|
|
591
|
+
return 'A <Task Listener> must have a defined <Type>';
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
if (requiredProperty === 'errorRef') {
|
|
595
|
+
|
|
596
|
+
if (parentNode && is(parentNode, 'bpmn:CatchEvent')) {
|
|
597
|
+
return getSupportedMessage(`${ getIndefiniteArticle(typeString) } <${ typeString }> without defined <Error Reference>`, executionPlatform, executionPlatformVersion, allowedVersion);
|
|
598
|
+
} else if (parentNode && is(parentNode, 'bpmn:ThrowEvent')) {
|
|
599
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> must have a defined <Error Reference>`;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
if (requiredProperty === 'messageRef') {
|
|
605
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> must have a defined <Message Reference>`;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
if (requiredProperty === 'signalRef') {
|
|
609
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> must have a defined <Signal Reference>`;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
if (is(node, 'zeebe:FormDefinition')
|
|
613
|
+
&& (
|
|
614
|
+
requiredProperty === 'formKey'
|
|
615
|
+
|| (isArray(requiredProperty) && requiredProperty.includes('formKey') && isEmptyString(node.get('formKey')))
|
|
616
|
+
)) {
|
|
617
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Form type: Custom form key> must have a defined <Form key>`;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
// Camunda User Task
|
|
621
|
+
if (is(node, 'zeebe:FormDefinition') && isZeebeUserTask(parentNode)) {
|
|
622
|
+
if (isRequiredProperty('externalReference') && isEmptyString(node.get('externalReference'))) {
|
|
623
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Form type: External reference> must have a defined <External reference>`;
|
|
624
|
+
} else if (isRequiredProperty('formId') && isEmptyString(node.get('formId'))) {
|
|
625
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Form type: Camunda Form> must have a defined <Form ID>`;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
if (is(node, 'zeebe:FormDefinition') && isRequiredProperty('formId') && isEmptyString(node.get('formId'))) {
|
|
630
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Form type: Camunda form (linked)> must have a defined <Form ID>`;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
if (is(node, 'zeebe:UserTaskForm') && requiredProperty === 'body') {
|
|
634
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Form type: Camunda form (embedded)> must have a defined <Form JSON configuration>`;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
if (is(node, 'bpmn:SequenceFlow') && requiredProperty === 'conditionExpression') {
|
|
638
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> must have a defined <Condition expression> or be the default <Sequence Flow>`;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
if (is(node, 'bpmn:TimerEventDefinition')
|
|
642
|
+
&& isArray(requiredProperty)
|
|
643
|
+
&& TIMER_PROPERTIES.some(property => requiredProperty.includes(property))
|
|
644
|
+
) {
|
|
645
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> must have a defined <Timer type>`;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
if (is(node, 'bpmn:Process') && requiredProperty === 'historyTimeToLive') {
|
|
649
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> must have a defined <History time to live>`;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
if (is(node, 'bpmn:LinkEventDefinition') && requiredProperty === 'name') {
|
|
653
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> must have a defined <Name>`;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
if (isAny(node, [
|
|
657
|
+
'zeebe:CalledDecision',
|
|
658
|
+
'zeebe:CalledElement',
|
|
659
|
+
'zeebe:FormDefinition'
|
|
660
|
+
]) && requiredProperty === 'versionTag') {
|
|
661
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> with <Binding: version tag> must have a defined <Version tag>`;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
return message;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
function getExpressionRequiredErrorMessage(report) {
|
|
668
|
+
const {
|
|
669
|
+
data,
|
|
670
|
+
message
|
|
671
|
+
} = report;
|
|
672
|
+
|
|
673
|
+
const {
|
|
674
|
+
node,
|
|
675
|
+
parentNode,
|
|
676
|
+
property
|
|
677
|
+
} = data;
|
|
678
|
+
|
|
679
|
+
const typeString = getTypeString(parentNode || node);
|
|
680
|
+
|
|
681
|
+
if (is(node, 'bpmn:FormalExpression') && TIMER_PROPERTIES.includes(property)) {
|
|
682
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> must have a defined <Timer value>`;
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
return message;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
function getExpressionValueNotAllowedErrorMessage(report, executionPlatform, executionPlatformVersion) {
|
|
689
|
+
const {
|
|
690
|
+
data,
|
|
691
|
+
message
|
|
692
|
+
} = report;
|
|
693
|
+
|
|
694
|
+
const {
|
|
695
|
+
node,
|
|
696
|
+
parentNode,
|
|
697
|
+
property
|
|
698
|
+
} = data;
|
|
699
|
+
|
|
700
|
+
const typeString = getTypeString(parentNode || node);
|
|
701
|
+
|
|
702
|
+
if (is(node, 'bpmn:FormalExpression') && property === 'timeCycle') {
|
|
703
|
+
if (!greaterOrEqual(executionPlatformVersion, '8.1')) {
|
|
704
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> <Time cycle> must be an expression, an ISO 8601 repeating interval, or a cron expression (cron only supported by Camunda 8.1 or newer)`;
|
|
705
|
+
} else {
|
|
706
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> <Time cycle> must be an expression, an ISO 8601 repeating interval, or a cron expression`;
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
if (is(node, 'bpmn:FormalExpression') && property === 'timeDate') {
|
|
711
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> <Time date> must be an expression, or an ISO 8601 date`;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
if (is(node, 'bpmn:FormalExpression') && property === 'timeDuration') {
|
|
715
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> <Time duration> must be an expression, or an ISO 8601 interval`;
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
if (is(node, 'zeebe:TaskSchedule') && property === 'dueDate') {
|
|
719
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> <Due date> must be an ISO 8601 date`;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
if (is(node, 'zeebe:TaskSchedule') && property === 'followUpDate') {
|
|
723
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> <Follow up date> must be an ISO 8601 date`;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
if (is(node, 'zeebe:PriorityDefinition') && property === 'priority') {
|
|
727
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> <Priority> must be an expression, or an integer between 0 and 100`;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
return message;
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
function getSupportedMessage(prefix, executionPlatform, executionPlatformVersion, allowedVersion) {
|
|
734
|
+
if (allowedVersion) {
|
|
735
|
+
return `${ prefix } is only supported by ${ getExecutionPlatformLabel(executionPlatform, allowedVersion) } or newer`;
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
return `${ prefix } is not supported by ${ getExecutionPlatformLabel(executionPlatform, executionPlatformVersion) }`;
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
function getExpressionNotAllowedErrorMessage(report) {
|
|
742
|
+
const {
|
|
743
|
+
data
|
|
744
|
+
} = report;
|
|
745
|
+
|
|
746
|
+
const {
|
|
747
|
+
node,
|
|
748
|
+
parentNode,
|
|
749
|
+
property
|
|
750
|
+
} = data;
|
|
751
|
+
|
|
752
|
+
if (is(node, 'bpmn:Escalation') && property === 'escalationCode' && is(parentNode, 'bpmn:CatchEvent')) {
|
|
753
|
+
return 'Escalation code used in a catch event must be a static value';
|
|
754
|
+
} else if (is(node, 'bpmn:Error') && property === 'errorCode' && is(parentNode, 'bpmn:CatchEvent')) {
|
|
755
|
+
return 'Error code used in a catch event must be a static value';
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
return report.message;
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
function getEventBasedGatewayTargetNotAllowedErrorMessage(report) {
|
|
762
|
+
const { data } = report;
|
|
763
|
+
|
|
764
|
+
const { node } = data;
|
|
765
|
+
|
|
766
|
+
if (is(node, 'bpmn:ReceiveTask')) {
|
|
767
|
+
return 'A <Receive Task> cannot be the target of an <Event-Based Gateway>';
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
return report.message;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
function getPropertyValueNotAllowedErrorMessage(report, executionPlatform, executionPlatformVersion, modeler = 'desktop') {
|
|
774
|
+
const {
|
|
775
|
+
data,
|
|
776
|
+
message
|
|
777
|
+
} = report;
|
|
778
|
+
|
|
779
|
+
const {
|
|
780
|
+
allowedVersion,
|
|
781
|
+
node,
|
|
782
|
+
parentNode,
|
|
783
|
+
property
|
|
784
|
+
} = data;
|
|
785
|
+
|
|
786
|
+
const typeString = getTypeString(parentNode || node);
|
|
787
|
+
|
|
788
|
+
if (is(node, 'zeebe:CalledElement') && property === 'propagateAllParentVariables') {
|
|
789
|
+
return getSupportedMessage(`${ getIndefiniteArticle(typeString) } <${ typeString }> with <Propagate all variables> disabled`, executionPlatform, executionPlatformVersion, allowedVersion);
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
if (isAny(node, [
|
|
793
|
+
'zeebe:CalledDecision',
|
|
794
|
+
'zeebe:CalledElement',
|
|
795
|
+
'zeebe:FormDefinition'
|
|
796
|
+
]) && property === 'bindingType') {
|
|
797
|
+
const bindingType = node.get('bindingType');
|
|
798
|
+
|
|
799
|
+
let bindingTypeString = bindingType;
|
|
800
|
+
|
|
801
|
+
if (bindingType === 'versionTag') {
|
|
802
|
+
bindingTypeString = 'version tag';
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
return getSupportedMessage(`${ getIndefiniteArticle(typeString) } <${ typeString }> with <Binding: ${ bindingTypeString }>`, executionPlatform, executionPlatformVersion, allowedVersion);
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
return message;
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
function getSecretExpressionFormatDeprecatedErrorMessage(report) {
|
|
812
|
+
const { data } = report;
|
|
813
|
+
|
|
814
|
+
const { property } = data;
|
|
815
|
+
|
|
816
|
+
return `Property <${ property }> uses deprecated secret expression format secrets.SECRET, use {{secrets.SECRET}} instead`;
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
function getElementPropertyValueDuplicatedErrorMessage(report) {
|
|
820
|
+
const {
|
|
821
|
+
data,
|
|
822
|
+
message
|
|
823
|
+
} = report;
|
|
824
|
+
|
|
825
|
+
const {
|
|
826
|
+
node,
|
|
827
|
+
parentNode,
|
|
828
|
+
duplicatedProperty
|
|
829
|
+
} = data;
|
|
830
|
+
|
|
831
|
+
const typeString = getTypeString(parentNode || node);
|
|
832
|
+
|
|
833
|
+
if (is(node, 'bpmn:LinkEventDefinition') && duplicatedProperty === 'name') {
|
|
834
|
+
return `${ getIndefiniteArticle(typeString) } <${ typeString }> must have a unique <Name>`;
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
return message;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
function getLoopNotAllowedErrorMessage(report) {
|
|
841
|
+
const { data } = report;
|
|
842
|
+
|
|
843
|
+
const { elements } = data;
|
|
844
|
+
|
|
845
|
+
return `A <Process> is not allowed to contain a straight-through processing loop: ${ elements.map(element => `<${ element }>`).join(', ') }`;
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
function getAttachedToRefElementTypeNotAllowed(report) {
|
|
849
|
+
const { data } = report;
|
|
850
|
+
|
|
851
|
+
const { node , attachedToRef } = data;
|
|
852
|
+
|
|
853
|
+
const nodeTypeString = getTypeString(node);
|
|
854
|
+
const attachedToTypeString = getTypeString(attachedToRef);
|
|
855
|
+
|
|
856
|
+
return `${ getIndefiniteArticle(nodeTypeString) } <${nodeTypeString}> is not allowed on ${ getIndefiniteArticle(attachedToTypeString, false) } <${attachedToTypeString}>`;
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
function isEmptyString(value) {
|
|
860
|
+
return isString(value) && value.trim() === '';
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
function isZeebeUserTask(node) {
|
|
864
|
+
return node.get('extensionElements').get('values').some(extensionElement => {
|
|
865
|
+
return is(extensionElement, 'zeebe:UserTask');
|
|
866
|
+
});
|
|
867
|
+
}
|