bpmnlint-plugin-camunda-compat 2.23.0 → 2.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -20
- package/README.md +39 -39
- package/index.js +242 -237
- package/package.json +53 -53
- package/rules/camunda-cloud/called-element.js +42 -42
- package/rules/camunda-cloud/collapsed-subprocess.js +40 -40
- package/rules/camunda-cloud/connector-properties/config.js +90 -90
- package/rules/camunda-cloud/connector-properties/index.js +47 -47
- package/rules/camunda-cloud/duplicate-execution-listeners.js +33 -33
- package/rules/camunda-cloud/duplicate-task-headers.js +58 -58
- package/rules/camunda-cloud/element-type/config.js +66 -66
- package/rules/camunda-cloud/element-type/index.js +133 -133
- package/rules/camunda-cloud/error-reference.js +71 -71
- package/rules/camunda-cloud/escalation-boundary-event-attached-to-ref.js +48 -48
- package/rules/camunda-cloud/escalation-reference.js +66 -66
- package/rules/camunda-cloud/event-based-gateway-target.js +38 -38
- package/rules/camunda-cloud/executable-process.js +61 -61
- package/rules/camunda-cloud/execution-listener.js +34 -34
- package/rules/camunda-cloud/feel.js +82 -82
- package/rules/camunda-cloud/implementation/config.js +16 -16
- package/rules/camunda-cloud/implementation/index.js +218 -218
- package/rules/camunda-cloud/inclusive-gateway.js +35 -35
- package/rules/camunda-cloud/link-event.js +142 -142
- package/rules/camunda-cloud/loop-characteristics.js +66 -66
- package/rules/camunda-cloud/message-reference.js +60 -60
- package/rules/camunda-cloud/no-binding-type.js +43 -43
- package/rules/camunda-cloud/no-candidate-users.js +38 -38
- package/rules/camunda-cloud/no-execution-listeners.js +21 -21
- package/rules/camunda-cloud/no-expression.js +173 -173
- package/rules/camunda-cloud/no-loop.js +316 -316
- package/rules/camunda-cloud/no-multiple-none-start-events.js +41 -41
- package/rules/camunda-cloud/no-priority-definition.js +19 -0
- package/rules/camunda-cloud/no-propagate-all-parent-variables.js +44 -44
- package/rules/camunda-cloud/no-signal-event-sub-process.js +45 -45
- package/rules/camunda-cloud/no-task-schedule.js +18 -18
- package/rules/camunda-cloud/no-template.js +23 -23
- package/rules/camunda-cloud/no-zeebe-properties.js +18 -18
- package/rules/camunda-cloud/no-zeebe-user-task.js +27 -27
- package/rules/camunda-cloud/priority-definition.js +62 -0
- package/rules/camunda-cloud/secrets.js +119 -119
- package/rules/camunda-cloud/sequence-flow-condition.js +56 -56
- package/rules/camunda-cloud/signal-reference.js +64 -64
- package/rules/camunda-cloud/start-event-form.js +97 -97
- package/rules/camunda-cloud/subscription.js +65 -65
- package/rules/camunda-cloud/task-schedule.js +67 -67
- package/rules/camunda-cloud/timer/config.js +46 -46
- package/rules/camunda-cloud/timer/index.js +183 -183
- package/rules/camunda-cloud/user-task-definition.js +24 -24
- package/rules/camunda-cloud/user-task-form.js +142 -142
- package/rules/camunda-cloud/wait-for-completion.js +46 -46
- package/rules/camunda-platform/history-time-to-live.js +19 -19
- package/rules/utils/cron.js +95 -95
- package/rules/utils/element.js +533 -533
- package/rules/utils/error-types.js +25 -25
- package/rules/utils/iso8601.js +52 -52
- package/rules/utils/reporter.js +37 -37
- package/rules/utils/rule.js +46 -46
- package/rules/utils/version.js +4 -4
@@ -1,59 +1,59 @@
|
|
1
|
-
const {
|
2
|
-
is,
|
3
|
-
isAny
|
4
|
-
} = require('bpmnlint-utils');
|
5
|
-
|
6
|
-
const {
|
7
|
-
findExtensionElement,
|
8
|
-
getMessageEventDefinition,
|
9
|
-
hasDuplicatedPropertyValues
|
10
|
-
} = require('../utils/element');
|
11
|
-
|
12
|
-
const { reportErrors } = require('../utils/reporter');
|
13
|
-
|
14
|
-
const { skipInNonExecutableProcess } = require('../utils/rule');
|
15
|
-
|
16
|
-
module.exports = skipInNonExecutableProcess(function() {
|
17
|
-
function check(node, reporter) {
|
18
|
-
if (!is(node, 'bpmn:UserTask') && !isZeebeServiceTask(node)) {
|
19
|
-
return;
|
20
|
-
}
|
21
|
-
|
22
|
-
const taskHeaders = findExtensionElement(node, 'zeebe:TaskHeaders');
|
23
|
-
|
24
|
-
if (!taskHeaders) {
|
25
|
-
return;
|
26
|
-
}
|
27
|
-
|
28
|
-
const errors = hasDuplicatedPropertyValues(taskHeaders, 'values', 'key', node);
|
29
|
-
|
30
|
-
if (errors && errors.length) {
|
31
|
-
reportErrors(node, reporter, errors);
|
32
|
-
}
|
33
|
-
}
|
34
|
-
|
35
|
-
return {
|
36
|
-
check
|
37
|
-
};
|
38
|
-
});
|
39
|
-
|
40
|
-
// helpers //////////
|
41
|
-
|
42
|
-
function isZeebeServiceTask(element) {
|
43
|
-
if (is(element, 'zeebe:ZeebeServiceTask')) {
|
44
|
-
return true;
|
45
|
-
}
|
46
|
-
|
47
|
-
if (isAny(element, [
|
48
|
-
'bpmn:EndEvent',
|
49
|
-
'bpmn:IntermediateThrowEvent'
|
50
|
-
])) {
|
51
|
-
return getMessageEventDefinition(element);
|
52
|
-
}
|
53
|
-
|
54
|
-
if (is(element, 'bpmn:BusinessRuleTask')) {
|
55
|
-
return findExtensionElement(element, 'zeebe:TaskDefinition');
|
56
|
-
}
|
57
|
-
|
58
|
-
return false;
|
1
|
+
const {
|
2
|
+
is,
|
3
|
+
isAny
|
4
|
+
} = require('bpmnlint-utils');
|
5
|
+
|
6
|
+
const {
|
7
|
+
findExtensionElement,
|
8
|
+
getMessageEventDefinition,
|
9
|
+
hasDuplicatedPropertyValues
|
10
|
+
} = require('../utils/element');
|
11
|
+
|
12
|
+
const { reportErrors } = require('../utils/reporter');
|
13
|
+
|
14
|
+
const { skipInNonExecutableProcess } = require('../utils/rule');
|
15
|
+
|
16
|
+
module.exports = skipInNonExecutableProcess(function() {
|
17
|
+
function check(node, reporter) {
|
18
|
+
if (!is(node, 'bpmn:UserTask') && !isZeebeServiceTask(node)) {
|
19
|
+
return;
|
20
|
+
}
|
21
|
+
|
22
|
+
const taskHeaders = findExtensionElement(node, 'zeebe:TaskHeaders');
|
23
|
+
|
24
|
+
if (!taskHeaders) {
|
25
|
+
return;
|
26
|
+
}
|
27
|
+
|
28
|
+
const errors = hasDuplicatedPropertyValues(taskHeaders, 'values', 'key', node);
|
29
|
+
|
30
|
+
if (errors && errors.length) {
|
31
|
+
reportErrors(node, reporter, errors);
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
return {
|
36
|
+
check
|
37
|
+
};
|
38
|
+
});
|
39
|
+
|
40
|
+
// helpers //////////
|
41
|
+
|
42
|
+
function isZeebeServiceTask(element) {
|
43
|
+
if (is(element, 'zeebe:ZeebeServiceTask')) {
|
44
|
+
return true;
|
45
|
+
}
|
46
|
+
|
47
|
+
if (isAny(element, [
|
48
|
+
'bpmn:EndEvent',
|
49
|
+
'bpmn:IntermediateThrowEvent'
|
50
|
+
])) {
|
51
|
+
return getMessageEventDefinition(element);
|
52
|
+
}
|
53
|
+
|
54
|
+
if (is(element, 'bpmn:BusinessRuleTask')) {
|
55
|
+
return findExtensionElement(element, 'zeebe:TaskDefinition');
|
56
|
+
}
|
57
|
+
|
58
|
+
return false;
|
59
59
|
}
|
@@ -1,67 +1,67 @@
|
|
1
|
-
module.exports = {
|
2
|
-
'bpmn:Association': '1.0',
|
3
|
-
'bpmn:BoundaryEvent': {
|
4
|
-
'bpmn:CompensateEventDefinition': '8.5',
|
5
|
-
'bpmn:ErrorEventDefinition': '1.0',
|
6
|
-
'bpmn:EscalationEventDefinition': '8.2',
|
7
|
-
'bpmn:MessageEventDefinition': '1.0',
|
8
|
-
'bpmn:TimerEventDefinition': '1.0',
|
9
|
-
'bpmn:SignalEventDefinition': '8.3',
|
10
|
-
},
|
11
|
-
'bpmn:BusinessRuleTask': '1.1',
|
12
|
-
'bpmn:CallActivity': '1.0',
|
13
|
-
'bpmn:Collaboration': '1.0',
|
14
|
-
'bpmn:DataObject': '8.0',
|
15
|
-
'bpmn:DataObjectReference': '8.0',
|
16
|
-
'bpmn:DataStoreReference': '8.0',
|
17
|
-
'bpmn:Definitions': '1.0',
|
18
|
-
'bpmn:EndEvent': {
|
19
|
-
'_': '1.0',
|
20
|
-
'bpmn:CompensateEventDefinition': '8.5',
|
21
|
-
'bpmn:ErrorEventDefinition': '1.0',
|
22
|
-
'bpmn:EscalationEventDefinition': '8.2',
|
23
|
-
'bpmn:MessageEventDefinition': '1.2',
|
24
|
-
'bpmn:SignalEventDefinition': '8.3',
|
25
|
-
'bpmn:TerminateEventDefinition': '8.1'
|
26
|
-
},
|
27
|
-
'bpmn:EventBasedGateway': '1.0',
|
28
|
-
'bpmn:ExclusiveGateway': '1.0',
|
29
|
-
'bpmn:Group': '1.0',
|
30
|
-
'bpmn:InclusiveGateway': '8.1',
|
31
|
-
'bpmn:IntermediateCatchEvent': {
|
32
|
-
'bpmn:MessageEventDefinition': '1.0',
|
33
|
-
'bpmn:LinkEventDefinition': '8.2',
|
34
|
-
'bpmn:TimerEventDefinition': '1.0',
|
35
|
-
'bpmn:SignalEventDefinition': '8.3'
|
36
|
-
},
|
37
|
-
'bpmn:IntermediateThrowEvent': {
|
38
|
-
'_': '1.1',
|
39
|
-
'bpmn:CompensateEventDefinition': '8.5',
|
40
|
-
'bpmn:EscalationEventDefinition': '8.2',
|
41
|
-
'bpmn:LinkEventDefinition': '8.2',
|
42
|
-
'bpmn:MessageEventDefinition': '1.2',
|
43
|
-
'bpmn:SignalEventDefinition': '8.3'
|
44
|
-
},
|
45
|
-
'bpmn:ManualTask': '1.1',
|
46
|
-
'bpmn:MessageFlow': '1.0',
|
47
|
-
'bpmn:ParallelGateway': '1.0',
|
48
|
-
'bpmn:Participant': '1.0',
|
49
|
-
'bpmn:Process': '1.0',
|
50
|
-
'bpmn:ReceiveTask': '1.0',
|
51
|
-
'bpmn:ScriptTask': '1.1',
|
52
|
-
'bpmn:SendTask': '1.1',
|
53
|
-
'bpmn:SequenceFlow': '1.0',
|
54
|
-
'bpmn:ServiceTask': '1.0',
|
55
|
-
'bpmn:StartEvent': {
|
56
|
-
'_': '1.0',
|
57
|
-
'bpmn:ErrorEventDefinition': '1.0',
|
58
|
-
'bpmn:EscalationEventDefinition': '8.2',
|
59
|
-
'bpmn:MessageEventDefinition': '1.0',
|
60
|
-
'bpmn:SignalEventDefinition': '8.2',
|
61
|
-
'bpmn:TimerEventDefinition': '1.0'
|
62
|
-
},
|
63
|
-
'bpmn:SubProcess': '1.0',
|
64
|
-
'bpmn:Task': '8.2',
|
65
|
-
'bpmn:TextAnnotation': '1.0',
|
66
|
-
'bpmn:UserTask': '1.0'
|
1
|
+
module.exports = {
|
2
|
+
'bpmn:Association': '1.0',
|
3
|
+
'bpmn:BoundaryEvent': {
|
4
|
+
'bpmn:CompensateEventDefinition': '8.5',
|
5
|
+
'bpmn:ErrorEventDefinition': '1.0',
|
6
|
+
'bpmn:EscalationEventDefinition': '8.2',
|
7
|
+
'bpmn:MessageEventDefinition': '1.0',
|
8
|
+
'bpmn:TimerEventDefinition': '1.0',
|
9
|
+
'bpmn:SignalEventDefinition': '8.3',
|
10
|
+
},
|
11
|
+
'bpmn:BusinessRuleTask': '1.1',
|
12
|
+
'bpmn:CallActivity': '1.0',
|
13
|
+
'bpmn:Collaboration': '1.0',
|
14
|
+
'bpmn:DataObject': '8.0',
|
15
|
+
'bpmn:DataObjectReference': '8.0',
|
16
|
+
'bpmn:DataStoreReference': '8.0',
|
17
|
+
'bpmn:Definitions': '1.0',
|
18
|
+
'bpmn:EndEvent': {
|
19
|
+
'_': '1.0',
|
20
|
+
'bpmn:CompensateEventDefinition': '8.5',
|
21
|
+
'bpmn:ErrorEventDefinition': '1.0',
|
22
|
+
'bpmn:EscalationEventDefinition': '8.2',
|
23
|
+
'bpmn:MessageEventDefinition': '1.2',
|
24
|
+
'bpmn:SignalEventDefinition': '8.3',
|
25
|
+
'bpmn:TerminateEventDefinition': '8.1'
|
26
|
+
},
|
27
|
+
'bpmn:EventBasedGateway': '1.0',
|
28
|
+
'bpmn:ExclusiveGateway': '1.0',
|
29
|
+
'bpmn:Group': '1.0',
|
30
|
+
'bpmn:InclusiveGateway': '8.1',
|
31
|
+
'bpmn:IntermediateCatchEvent': {
|
32
|
+
'bpmn:MessageEventDefinition': '1.0',
|
33
|
+
'bpmn:LinkEventDefinition': '8.2',
|
34
|
+
'bpmn:TimerEventDefinition': '1.0',
|
35
|
+
'bpmn:SignalEventDefinition': '8.3'
|
36
|
+
},
|
37
|
+
'bpmn:IntermediateThrowEvent': {
|
38
|
+
'_': '1.1',
|
39
|
+
'bpmn:CompensateEventDefinition': '8.5',
|
40
|
+
'bpmn:EscalationEventDefinition': '8.2',
|
41
|
+
'bpmn:LinkEventDefinition': '8.2',
|
42
|
+
'bpmn:MessageEventDefinition': '1.2',
|
43
|
+
'bpmn:SignalEventDefinition': '8.3'
|
44
|
+
},
|
45
|
+
'bpmn:ManualTask': '1.1',
|
46
|
+
'bpmn:MessageFlow': '1.0',
|
47
|
+
'bpmn:ParallelGateway': '1.0',
|
48
|
+
'bpmn:Participant': '1.0',
|
49
|
+
'bpmn:Process': '1.0',
|
50
|
+
'bpmn:ReceiveTask': '1.0',
|
51
|
+
'bpmn:ScriptTask': '1.1',
|
52
|
+
'bpmn:SendTask': '1.1',
|
53
|
+
'bpmn:SequenceFlow': '1.0',
|
54
|
+
'bpmn:ServiceTask': '1.0',
|
55
|
+
'bpmn:StartEvent': {
|
56
|
+
'_': '1.0',
|
57
|
+
'bpmn:ErrorEventDefinition': '1.0',
|
58
|
+
'bpmn:EscalationEventDefinition': '8.2',
|
59
|
+
'bpmn:MessageEventDefinition': '1.0',
|
60
|
+
'bpmn:SignalEventDefinition': '8.2',
|
61
|
+
'bpmn:TimerEventDefinition': '1.0'
|
62
|
+
},
|
63
|
+
'bpmn:SubProcess': '1.0',
|
64
|
+
'bpmn:Task': '8.2',
|
65
|
+
'bpmn:TextAnnotation': '1.0',
|
66
|
+
'bpmn:UserTask': '1.0'
|
67
67
|
};
|
@@ -1,134 +1,134 @@
|
|
1
|
-
const { isString } = require('min-dash');
|
2
|
-
|
3
|
-
const { isAny } = require('bpmnlint-utils');
|
4
|
-
|
5
|
-
const config = require('./config');
|
6
|
-
|
7
|
-
const { greaterOrEqual } = require('../../utils/version');
|
8
|
-
|
9
|
-
const { getEventDefinition } = require('../../utils/element');
|
10
|
-
|
11
|
-
const { ERROR_TYPES } = require('../../utils/error-types');
|
12
|
-
|
13
|
-
const { reportErrors } = require('../../utils/reporter');
|
14
|
-
|
15
|
-
const { skipInNonExecutableProcess } = require('../../utils/rule');
|
16
|
-
|
17
|
-
module.exports = skipInNonExecutableProcess(function({ version }) {
|
18
|
-
function check(node, reporter) {
|
19
|
-
if (!isAny(node, [ 'bpmn:FlowElement', 'bpmn:FlowElementsContainer' ])) {
|
20
|
-
return;
|
21
|
-
}
|
22
|
-
|
23
|
-
const element = config[ node.$type ];
|
24
|
-
|
25
|
-
if (!element || (isString(element) && !greaterOrEqual(version, element))) {
|
26
|
-
|
27
|
-
// (1) Element not allowed
|
28
|
-
const allowedVersion = element || null;
|
29
|
-
|
30
|
-
let message = `Element of type <${ node.$type }> not allowed`;
|
31
|
-
|
32
|
-
let data = {
|
33
|
-
type: ERROR_TYPES.ELEMENT_TYPE_NOT_ALLOWED,
|
34
|
-
node,
|
35
|
-
parentNode: null
|
36
|
-
};
|
37
|
-
|
38
|
-
if (allowedVersion) {
|
39
|
-
message = `Element of type <${ node.$type }> only allowed by Camunda ${ allowedVersion } or newer`;
|
40
|
-
|
41
|
-
data = {
|
42
|
-
...data,
|
43
|
-
allowedVersion
|
44
|
-
};
|
45
|
-
}
|
46
|
-
|
47
|
-
const error = {
|
48
|
-
message,
|
49
|
-
path: null,
|
50
|
-
data
|
51
|
-
};
|
52
|
-
|
53
|
-
reportErrors(node, reporter, error);
|
54
|
-
|
55
|
-
return;
|
56
|
-
}
|
57
|
-
|
58
|
-
if (!isAny(node, [ 'bpmn:CatchEvent', 'bpmn:ThrowEvent' ])) {
|
59
|
-
return;
|
60
|
-
}
|
61
|
-
|
62
|
-
const eventDefinition = getEventDefinition(node);
|
63
|
-
|
64
|
-
if (eventDefinition) {
|
65
|
-
if (!element[ eventDefinition.$type ] || !greaterOrEqual(version, element[ eventDefinition.$type ])) {
|
66
|
-
|
67
|
-
// (2) Element with event definition not allowed
|
68
|
-
const allowedVersion = element[ eventDefinition.$type ] || null;
|
69
|
-
|
70
|
-
let message = `Element of type <${ node.$type }> with event definition of type <${ eventDefinition.$type }> not allowed`;
|
71
|
-
|
72
|
-
let data = {
|
73
|
-
type: ERROR_TYPES.ELEMENT_TYPE_NOT_ALLOWED,
|
74
|
-
node,
|
75
|
-
parentNode: null,
|
76
|
-
eventDefinition
|
77
|
-
};
|
78
|
-
|
79
|
-
if (allowedVersion) {
|
80
|
-
message = `Element of type <${ node.$type }> with event definition of type <${ eventDefinition.$type }> only allowed by Camunda ${ allowedVersion } or newer`;
|
81
|
-
|
82
|
-
data = {
|
83
|
-
...data,
|
84
|
-
allowedVersion
|
85
|
-
};
|
86
|
-
}
|
87
|
-
|
88
|
-
const error = {
|
89
|
-
message,
|
90
|
-
path: null,
|
91
|
-
data
|
92
|
-
};
|
93
|
-
|
94
|
-
reportErrors(node, reporter, error);
|
95
|
-
}
|
96
|
-
} else {
|
97
|
-
if (!element[ '_' ] || !greaterOrEqual(version, element[ '_' ])) {
|
98
|
-
|
99
|
-
// (3) Element without event definition not allowed
|
100
|
-
const allowedVersion = element[ '_' ] || null;
|
101
|
-
|
102
|
-
let message = `Element of type <${ node.$type }> with no event definition not allowed`;
|
103
|
-
|
104
|
-
let data = {
|
105
|
-
type: ERROR_TYPES.ELEMENT_TYPE_NOT_ALLOWED,
|
106
|
-
node,
|
107
|
-
parentNode: null,
|
108
|
-
eventDefinition
|
109
|
-
};
|
110
|
-
|
111
|
-
if (allowedVersion) {
|
112
|
-
message = `Element of type <${ node.$type }> with no event definition only allowed by Camunda ${ allowedVersion } or newer`;
|
113
|
-
|
114
|
-
data = {
|
115
|
-
...data,
|
116
|
-
allowedVersion
|
117
|
-
};
|
118
|
-
}
|
119
|
-
|
120
|
-
const error = {
|
121
|
-
message,
|
122
|
-
path: null,
|
123
|
-
data
|
124
|
-
};
|
125
|
-
|
126
|
-
reportErrors(node, reporter, error);
|
127
|
-
}
|
128
|
-
}
|
129
|
-
}
|
130
|
-
|
131
|
-
return {
|
132
|
-
check
|
133
|
-
};
|
1
|
+
const { isString } = require('min-dash');
|
2
|
+
|
3
|
+
const { isAny } = require('bpmnlint-utils');
|
4
|
+
|
5
|
+
const config = require('./config');
|
6
|
+
|
7
|
+
const { greaterOrEqual } = require('../../utils/version');
|
8
|
+
|
9
|
+
const { getEventDefinition } = require('../../utils/element');
|
10
|
+
|
11
|
+
const { ERROR_TYPES } = require('../../utils/error-types');
|
12
|
+
|
13
|
+
const { reportErrors } = require('../../utils/reporter');
|
14
|
+
|
15
|
+
const { skipInNonExecutableProcess } = require('../../utils/rule');
|
16
|
+
|
17
|
+
module.exports = skipInNonExecutableProcess(function({ version }) {
|
18
|
+
function check(node, reporter) {
|
19
|
+
if (!isAny(node, [ 'bpmn:FlowElement', 'bpmn:FlowElementsContainer' ])) {
|
20
|
+
return;
|
21
|
+
}
|
22
|
+
|
23
|
+
const element = config[ node.$type ];
|
24
|
+
|
25
|
+
if (!element || (isString(element) && !greaterOrEqual(version, element))) {
|
26
|
+
|
27
|
+
// (1) Element not allowed
|
28
|
+
const allowedVersion = element || null;
|
29
|
+
|
30
|
+
let message = `Element of type <${ node.$type }> not allowed`;
|
31
|
+
|
32
|
+
let data = {
|
33
|
+
type: ERROR_TYPES.ELEMENT_TYPE_NOT_ALLOWED,
|
34
|
+
node,
|
35
|
+
parentNode: null
|
36
|
+
};
|
37
|
+
|
38
|
+
if (allowedVersion) {
|
39
|
+
message = `Element of type <${ node.$type }> only allowed by Camunda ${ allowedVersion } or newer`;
|
40
|
+
|
41
|
+
data = {
|
42
|
+
...data,
|
43
|
+
allowedVersion
|
44
|
+
};
|
45
|
+
}
|
46
|
+
|
47
|
+
const error = {
|
48
|
+
message,
|
49
|
+
path: null,
|
50
|
+
data
|
51
|
+
};
|
52
|
+
|
53
|
+
reportErrors(node, reporter, error);
|
54
|
+
|
55
|
+
return;
|
56
|
+
}
|
57
|
+
|
58
|
+
if (!isAny(node, [ 'bpmn:CatchEvent', 'bpmn:ThrowEvent' ])) {
|
59
|
+
return;
|
60
|
+
}
|
61
|
+
|
62
|
+
const eventDefinition = getEventDefinition(node);
|
63
|
+
|
64
|
+
if (eventDefinition) {
|
65
|
+
if (!element[ eventDefinition.$type ] || !greaterOrEqual(version, element[ eventDefinition.$type ])) {
|
66
|
+
|
67
|
+
// (2) Element with event definition not allowed
|
68
|
+
const allowedVersion = element[ eventDefinition.$type ] || null;
|
69
|
+
|
70
|
+
let message = `Element of type <${ node.$type }> with event definition of type <${ eventDefinition.$type }> not allowed`;
|
71
|
+
|
72
|
+
let data = {
|
73
|
+
type: ERROR_TYPES.ELEMENT_TYPE_NOT_ALLOWED,
|
74
|
+
node,
|
75
|
+
parentNode: null,
|
76
|
+
eventDefinition
|
77
|
+
};
|
78
|
+
|
79
|
+
if (allowedVersion) {
|
80
|
+
message = `Element of type <${ node.$type }> with event definition of type <${ eventDefinition.$type }> only allowed by Camunda ${ allowedVersion } or newer`;
|
81
|
+
|
82
|
+
data = {
|
83
|
+
...data,
|
84
|
+
allowedVersion
|
85
|
+
};
|
86
|
+
}
|
87
|
+
|
88
|
+
const error = {
|
89
|
+
message,
|
90
|
+
path: null,
|
91
|
+
data
|
92
|
+
};
|
93
|
+
|
94
|
+
reportErrors(node, reporter, error);
|
95
|
+
}
|
96
|
+
} else {
|
97
|
+
if (!element[ '_' ] || !greaterOrEqual(version, element[ '_' ])) {
|
98
|
+
|
99
|
+
// (3) Element without event definition not allowed
|
100
|
+
const allowedVersion = element[ '_' ] || null;
|
101
|
+
|
102
|
+
let message = `Element of type <${ node.$type }> with no event definition not allowed`;
|
103
|
+
|
104
|
+
let data = {
|
105
|
+
type: ERROR_TYPES.ELEMENT_TYPE_NOT_ALLOWED,
|
106
|
+
node,
|
107
|
+
parentNode: null,
|
108
|
+
eventDefinition
|
109
|
+
};
|
110
|
+
|
111
|
+
if (allowedVersion) {
|
112
|
+
message = `Element of type <${ node.$type }> with no event definition only allowed by Camunda ${ allowedVersion } or newer`;
|
113
|
+
|
114
|
+
data = {
|
115
|
+
...data,
|
116
|
+
allowedVersion
|
117
|
+
};
|
118
|
+
}
|
119
|
+
|
120
|
+
const error = {
|
121
|
+
message,
|
122
|
+
path: null,
|
123
|
+
data
|
124
|
+
};
|
125
|
+
|
126
|
+
reportErrors(node, reporter, error);
|
127
|
+
}
|
128
|
+
}
|
129
|
+
}
|
130
|
+
|
131
|
+
return {
|
132
|
+
check
|
133
|
+
};
|
134
134
|
});
|
@@ -1,72 +1,72 @@
|
|
1
|
-
const {
|
2
|
-
is,
|
3
|
-
isAny
|
4
|
-
} = require('bpmnlint-utils');
|
5
|
-
|
6
|
-
const {
|
7
|
-
getEventDefinition,
|
8
|
-
hasProperties
|
9
|
-
} = require('../utils/element');
|
10
|
-
|
11
|
-
const { reportErrors } = require('../utils/reporter');
|
12
|
-
|
13
|
-
const { skipInNonExecutableProcess } = require('../utils/rule');
|
14
|
-
|
15
|
-
const { greaterOrEqual } = require('../utils/version');
|
16
|
-
|
17
|
-
const noErrorRefAllowedVersion = '8.2';
|
18
|
-
|
19
|
-
module.exports = skipInNonExecutableProcess(function({ version }) {
|
20
|
-
function check(node, reporter) {
|
21
|
-
if (!isAny(node, [ 'bpmn:CatchEvent', 'bpmn:ThrowEvent' ])) {
|
22
|
-
return;
|
23
|
-
}
|
24
|
-
|
25
|
-
const eventDefinition = getEventDefinition(node);
|
26
|
-
|
27
|
-
if (!eventDefinition || !is(eventDefinition, 'bpmn:ErrorEventDefinition')) {
|
28
|
-
return;
|
29
|
-
}
|
30
|
-
|
31
|
-
let errors = [];
|
32
|
-
|
33
|
-
if (!isNoErrorRefAllowed(node, version)) {
|
34
|
-
errors = hasProperties(eventDefinition, {
|
35
|
-
errorRef: {
|
36
|
-
required: true,
|
37
|
-
allowedVersion: '8.2'
|
38
|
-
}
|
39
|
-
}, node);
|
40
|
-
|
41
|
-
if (errors.length) {
|
42
|
-
reportErrors(node, reporter, errors);
|
43
|
-
|
44
|
-
return;
|
45
|
-
}
|
46
|
-
}
|
47
|
-
|
48
|
-
const errorRef = eventDefinition.get('errorRef');
|
49
|
-
|
50
|
-
if (!errorRef) {
|
51
|
-
return;
|
52
|
-
}
|
53
|
-
|
54
|
-
errors = hasProperties(errorRef, {
|
55
|
-
errorCode: {
|
56
|
-
required: true
|
57
|
-
}
|
58
|
-
}, node);
|
59
|
-
|
60
|
-
if (errors.length) {
|
61
|
-
reportErrors(node, reporter, errors);
|
62
|
-
}
|
63
|
-
}
|
64
|
-
|
65
|
-
return {
|
66
|
-
check
|
67
|
-
};
|
68
|
-
});
|
69
|
-
|
70
|
-
function isNoErrorRefAllowed(node, version) {
|
71
|
-
return is(node, 'bpmn:CatchEvent') && greaterOrEqual(version, noErrorRefAllowedVersion);
|
1
|
+
const {
|
2
|
+
is,
|
3
|
+
isAny
|
4
|
+
} = require('bpmnlint-utils');
|
5
|
+
|
6
|
+
const {
|
7
|
+
getEventDefinition,
|
8
|
+
hasProperties
|
9
|
+
} = require('../utils/element');
|
10
|
+
|
11
|
+
const { reportErrors } = require('../utils/reporter');
|
12
|
+
|
13
|
+
const { skipInNonExecutableProcess } = require('../utils/rule');
|
14
|
+
|
15
|
+
const { greaterOrEqual } = require('../utils/version');
|
16
|
+
|
17
|
+
const noErrorRefAllowedVersion = '8.2';
|
18
|
+
|
19
|
+
module.exports = skipInNonExecutableProcess(function({ version }) {
|
20
|
+
function check(node, reporter) {
|
21
|
+
if (!isAny(node, [ 'bpmn:CatchEvent', 'bpmn:ThrowEvent' ])) {
|
22
|
+
return;
|
23
|
+
}
|
24
|
+
|
25
|
+
const eventDefinition = getEventDefinition(node);
|
26
|
+
|
27
|
+
if (!eventDefinition || !is(eventDefinition, 'bpmn:ErrorEventDefinition')) {
|
28
|
+
return;
|
29
|
+
}
|
30
|
+
|
31
|
+
let errors = [];
|
32
|
+
|
33
|
+
if (!isNoErrorRefAllowed(node, version)) {
|
34
|
+
errors = hasProperties(eventDefinition, {
|
35
|
+
errorRef: {
|
36
|
+
required: true,
|
37
|
+
allowedVersion: '8.2'
|
38
|
+
}
|
39
|
+
}, node);
|
40
|
+
|
41
|
+
if (errors.length) {
|
42
|
+
reportErrors(node, reporter, errors);
|
43
|
+
|
44
|
+
return;
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
const errorRef = eventDefinition.get('errorRef');
|
49
|
+
|
50
|
+
if (!errorRef) {
|
51
|
+
return;
|
52
|
+
}
|
53
|
+
|
54
|
+
errors = hasProperties(errorRef, {
|
55
|
+
errorCode: {
|
56
|
+
required: true
|
57
|
+
}
|
58
|
+
}, node);
|
59
|
+
|
60
|
+
if (errors.length) {
|
61
|
+
reportErrors(node, reporter, errors);
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
return {
|
66
|
+
check
|
67
|
+
};
|
68
|
+
});
|
69
|
+
|
70
|
+
function isNoErrorRefAllowed(node, version) {
|
71
|
+
return is(node, 'bpmn:CatchEvent') && greaterOrEqual(version, noErrorRefAllowedVersion);
|
72
72
|
}
|