bpmnlint-plugin-camunda-compat 2.17.0 → 2.19.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 (50) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +39 -39
  3. package/index.js +221 -205
  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/duplicate-task-headers.js +58 -58
  8. package/rules/camunda-cloud/element-type/config.js +66 -63
  9. package/rules/camunda-cloud/element-type/index.js +133 -133
  10. package/rules/camunda-cloud/error-reference.js +71 -71
  11. package/rules/camunda-cloud/escalation-boundary-event-attached-to-ref.js +48 -48
  12. package/rules/camunda-cloud/escalation-reference.js +66 -66
  13. package/rules/camunda-cloud/event-based-gateway-target.js +38 -38
  14. package/rules/camunda-cloud/executable-process.js +61 -61
  15. package/rules/camunda-cloud/feel.js +82 -82
  16. package/rules/camunda-cloud/implementation/config.js +16 -16
  17. package/rules/camunda-cloud/implementation/index.js +218 -218
  18. package/rules/camunda-cloud/inclusive-gateway.js +35 -35
  19. package/rules/camunda-cloud/link-event.js +142 -142
  20. package/rules/camunda-cloud/loop-characteristics.js +66 -66
  21. package/rules/camunda-cloud/message-reference.js +60 -60
  22. package/rules/camunda-cloud/no-candidate-users.js +38 -38
  23. package/rules/camunda-cloud/no-expression.js +173 -173
  24. package/rules/camunda-cloud/no-loop.js +145 -145
  25. package/rules/camunda-cloud/no-multiple-none-start-events.js +41 -41
  26. package/rules/camunda-cloud/no-propagate-all-parent-variables.js +44 -44
  27. package/rules/camunda-cloud/no-signal-event-sub-process.js +45 -45
  28. package/rules/camunda-cloud/no-task-schedule.js +18 -18
  29. package/rules/camunda-cloud/no-template.js +23 -23
  30. package/rules/camunda-cloud/no-zeebe-properties.js +18 -18
  31. package/rules/camunda-cloud/no-zeebe-user-task.js +27 -27
  32. package/rules/camunda-cloud/secrets.js +119 -119
  33. package/rules/camunda-cloud/sequence-flow-condition.js +56 -56
  34. package/rules/camunda-cloud/signal-reference.js +64 -64
  35. package/rules/camunda-cloud/start-event-form.js +97 -97
  36. package/rules/camunda-cloud/subscription.js +65 -65
  37. package/rules/camunda-cloud/task-schedule.js +67 -67
  38. package/rules/camunda-cloud/timer/config.js +46 -46
  39. package/rules/camunda-cloud/timer/index.js +183 -183
  40. package/rules/camunda-cloud/user-task-definition.js +24 -24
  41. package/rules/camunda-cloud/user-task-form.js +142 -142
  42. package/rules/camunda-cloud/wait-for-completion.js +46 -0
  43. package/rules/camunda-platform/history-time-to-live.js +19 -19
  44. package/rules/utils/cron.js +95 -95
  45. package/rules/utils/element.js +484 -484
  46. package/rules/utils/error-types.js +23 -23
  47. package/rules/utils/iso8601.js +52 -52
  48. package/rules/utils/reporter.js +37 -37
  49. package/rules/utils/rule.js +46 -46
  50. package/rules/utils/version.js +4 -4
@@ -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
+ });
@@ -1,67 +1,67 @@
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
- module.exports = skipInNonExecutableProcess(function() {
16
- function check(node, reporter) {
17
- if (!isAny(node, [ 'bpmn:CatchEvent', 'bpmn:ThrowEvent' ])) {
18
- return;
19
- }
20
-
21
- const eventDefinition = getEventDefinition(node);
22
-
23
- if (!eventDefinition || !is(eventDefinition, 'bpmn:EscalationEventDefinition')) {
24
- return;
25
- }
26
-
27
- let errors = [];
28
-
29
- if (!isNoEscalationRefAllowed(node)) {
30
- errors = hasProperties(eventDefinition, {
31
- escalationRef: {
32
- required: true
33
- }
34
- }, node);
35
-
36
- if (errors.length) {
37
- reportErrors(node, reporter, errors);
38
-
39
- return;
40
- }
41
- }
42
-
43
- const escalationRef = eventDefinition.get('escalationRef');
44
-
45
- if (!escalationRef) {
46
- return;
47
- }
48
-
49
- errors = hasProperties(escalationRef, {
50
- escalationCode: {
51
- required: true
52
- }
53
- }, node);
54
-
55
- if (errors.length) {
56
- reportErrors(node, reporter, errors);
57
- }
58
- }
59
-
60
- return {
61
- check
62
- };
63
- });
64
-
65
- function isNoEscalationRefAllowed(node) {
66
- return isAny(node, [ 'bpmn:CatchEvent', 'bpmn:BoundaryEvent' ]);
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
+ module.exports = skipInNonExecutableProcess(function() {
16
+ function check(node, reporter) {
17
+ if (!isAny(node, [ 'bpmn:CatchEvent', 'bpmn:ThrowEvent' ])) {
18
+ return;
19
+ }
20
+
21
+ const eventDefinition = getEventDefinition(node);
22
+
23
+ if (!eventDefinition || !is(eventDefinition, 'bpmn:EscalationEventDefinition')) {
24
+ return;
25
+ }
26
+
27
+ let errors = [];
28
+
29
+ if (!isNoEscalationRefAllowed(node)) {
30
+ errors = hasProperties(eventDefinition, {
31
+ escalationRef: {
32
+ required: true
33
+ }
34
+ }, node);
35
+
36
+ if (errors.length) {
37
+ reportErrors(node, reporter, errors);
38
+
39
+ return;
40
+ }
41
+ }
42
+
43
+ const escalationRef = eventDefinition.get('escalationRef');
44
+
45
+ if (!escalationRef) {
46
+ return;
47
+ }
48
+
49
+ errors = hasProperties(escalationRef, {
50
+ escalationCode: {
51
+ required: true
52
+ }
53
+ }, node);
54
+
55
+ if (errors.length) {
56
+ reportErrors(node, reporter, errors);
57
+ }
58
+ }
59
+
60
+ return {
61
+ check
62
+ };
63
+ });
64
+
65
+ function isNoEscalationRefAllowed(node) {
66
+ return isAny(node, [ 'bpmn:CatchEvent', 'bpmn:BoundaryEvent' ]);
67
67
  }