bpmnlint-plugin-camunda-compat 2.20.1 → 2.21.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.
Files changed (52) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +39 -39
  3. package/index.js +224 -223
  4. package/package.json +53 -53
  5. package/rules/camunda-cloud/called-element.js +42 -42
  6. package/rules/camunda-cloud/collapsed-subprocess.js +40 -40
  7. package/rules/camunda-cloud/connector-properties/config.js +90 -93
  8. package/rules/camunda-cloud/connector-properties/index.js +47 -47
  9. package/rules/camunda-cloud/duplicate-task-headers.js +58 -58
  10. package/rules/camunda-cloud/element-type/config.js +66 -66
  11. package/rules/camunda-cloud/element-type/index.js +133 -133
  12. package/rules/camunda-cloud/error-reference.js +71 -71
  13. package/rules/camunda-cloud/escalation-boundary-event-attached-to-ref.js +48 -48
  14. package/rules/camunda-cloud/escalation-reference.js +66 -66
  15. package/rules/camunda-cloud/event-based-gateway-target.js +38 -38
  16. package/rules/camunda-cloud/executable-process.js +61 -61
  17. package/rules/camunda-cloud/feel.js +82 -82
  18. package/rules/camunda-cloud/implementation/config.js +16 -16
  19. package/rules/camunda-cloud/implementation/index.js +218 -218
  20. package/rules/camunda-cloud/inclusive-gateway.js +35 -35
  21. package/rules/camunda-cloud/link-event.js +142 -142
  22. package/rules/camunda-cloud/loop-characteristics.js +66 -66
  23. package/rules/camunda-cloud/message-reference.js +60 -60
  24. package/rules/camunda-cloud/no-candidate-users.js +38 -38
  25. package/rules/camunda-cloud/no-expression.js +173 -173
  26. package/rules/camunda-cloud/no-loop.js +145 -145
  27. package/rules/camunda-cloud/no-multiple-none-start-events.js +41 -41
  28. package/rules/camunda-cloud/no-propagate-all-parent-variables.js +44 -44
  29. package/rules/camunda-cloud/no-signal-event-sub-process.js +45 -45
  30. package/rules/camunda-cloud/no-task-schedule.js +18 -18
  31. package/rules/camunda-cloud/no-template.js +23 -23
  32. package/rules/camunda-cloud/no-zeebe-properties.js +18 -18
  33. package/rules/camunda-cloud/no-zeebe-user-task.js +27 -27
  34. package/rules/camunda-cloud/secrets.js +119 -119
  35. package/rules/camunda-cloud/sequence-flow-condition.js +56 -56
  36. package/rules/camunda-cloud/signal-reference.js +64 -64
  37. package/rules/camunda-cloud/start-event-form.js +97 -97
  38. package/rules/camunda-cloud/subscription.js +65 -65
  39. package/rules/camunda-cloud/task-schedule.js +67 -67
  40. package/rules/camunda-cloud/timer/config.js +46 -46
  41. package/rules/camunda-cloud/timer/index.js +183 -183
  42. package/rules/camunda-cloud/user-task-definition.js +24 -24
  43. package/rules/camunda-cloud/user-task-form.js +142 -142
  44. package/rules/camunda-cloud/wait-for-completion.js +46 -46
  45. package/rules/camunda-platform/history-time-to-live.js +19 -19
  46. package/rules/utils/cron.js +95 -95
  47. package/rules/utils/element.js +484 -484
  48. package/rules/utils/error-types.js +24 -24
  49. package/rules/utils/iso8601.js +52 -52
  50. package/rules/utils/reporter.js +37 -37
  51. package/rules/utils/rule.js +46 -46
  52. package/rules/utils/version.js +4 -4
@@ -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
  }
@@ -1,48 +1,48 @@
1
- const {
2
- is,
3
- isAny
4
- } = require('bpmnlint-utils');
5
-
6
- const {
7
- getEventDefinition,
8
- isAnyExactly
9
- } = 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() {
18
- function check(node, reporter) {
19
- if (!isAny(node, [ 'bpmn:CatchEvent', 'bpmn:ThrowEvent' ])) {
20
- return;
21
- }
22
-
23
- const eventDefinition = getEventDefinition(node);
24
-
25
- if (!eventDefinition || !is(eventDefinition, 'bpmn:EscalationEventDefinition')) {
26
- return;
27
- }
28
-
29
- const attachedToRef = node.get('attachedToRef');
30
-
31
- if (attachedToRef && !isAnyExactly(attachedToRef, [ 'bpmn:CallActivity', 'bpmn:SubProcess' ])) {
32
- reportErrors(node, reporter, {
33
- message: `Element of type <bpmn:BoundaryEvent> with event definition of type <bpmn:EscalationEventDefinition> is not allowed to be attached to element of type <${ attachedToRef.$type }>`,
34
- path: null,
35
- data: {
36
- type: ERROR_TYPES.ATTACHED_TO_REF_ELEMENT_TYPE_NOT_ALLOWED,
37
- node,
38
- parentNode: null,
39
- attachedToRef
40
- }
41
- });
42
- }
43
- }
44
-
45
- return {
46
- check
47
- };
48
- });
1
+ const {
2
+ is,
3
+ isAny
4
+ } = require('bpmnlint-utils');
5
+
6
+ const {
7
+ getEventDefinition,
8
+ isAnyExactly
9
+ } = 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() {
18
+ function check(node, reporter) {
19
+ if (!isAny(node, [ 'bpmn:CatchEvent', 'bpmn:ThrowEvent' ])) {
20
+ return;
21
+ }
22
+
23
+ const eventDefinition = getEventDefinition(node);
24
+
25
+ if (!eventDefinition || !is(eventDefinition, 'bpmn:EscalationEventDefinition')) {
26
+ return;
27
+ }
28
+
29
+ const attachedToRef = node.get('attachedToRef');
30
+
31
+ if (attachedToRef && !isAnyExactly(attachedToRef, [ 'bpmn:CallActivity', 'bpmn:SubProcess' ])) {
32
+ reportErrors(node, reporter, {
33
+ message: `Element of type <bpmn:BoundaryEvent> with event definition of type <bpmn:EscalationEventDefinition> is not allowed to be attached to element of type <${ attachedToRef.$type }>`,
34
+ path: null,
35
+ data: {
36
+ type: ERROR_TYPES.ATTACHED_TO_REF_ELEMENT_TYPE_NOT_ALLOWED,
37
+ node,
38
+ parentNode: null,
39
+ attachedToRef
40
+ }
41
+ });
42
+ }
43
+ }
44
+
45
+ return {
46
+ check
47
+ };
48
+ });