bpmnlint-plugin-camunda-compat 2.26.0 → 2.26.1

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 (57) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +39 -39
  3. package/package.json +1 -1
  4. package/rules/camunda-cloud/called-element.js +42 -42
  5. package/rules/camunda-cloud/collapsed-subprocess.js +40 -40
  6. package/rules/camunda-cloud/connector-properties/config.js +90 -90
  7. package/rules/camunda-cloud/connector-properties/index.js +47 -47
  8. package/rules/camunda-cloud/duplicate-execution-listeners.js +33 -33
  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/execution-listener.js +34 -34
  18. package/rules/camunda-cloud/feel.js +85 -82
  19. package/rules/camunda-cloud/implementation/config.js +16 -16
  20. package/rules/camunda-cloud/implementation/index.js +218 -218
  21. package/rules/camunda-cloud/inclusive-gateway.js +35 -35
  22. package/rules/camunda-cloud/link-event.js +142 -142
  23. package/rules/camunda-cloud/loop-characteristics.js +66 -66
  24. package/rules/camunda-cloud/message-reference.js +60 -60
  25. package/rules/camunda-cloud/no-binding-type.js +43 -43
  26. package/rules/camunda-cloud/no-candidate-users.js +38 -38
  27. package/rules/camunda-cloud/no-execution-listeners.js +21 -21
  28. package/rules/camunda-cloud/no-expression.js +173 -173
  29. package/rules/camunda-cloud/no-loop.js +316 -316
  30. package/rules/camunda-cloud/no-multiple-none-start-events.js +41 -41
  31. package/rules/camunda-cloud/no-priority-definition.js +18 -18
  32. package/rules/camunda-cloud/no-propagate-all-parent-variables.js +44 -44
  33. package/rules/camunda-cloud/no-signal-event-sub-process.js +45 -45
  34. package/rules/camunda-cloud/no-task-schedule.js +18 -18
  35. package/rules/camunda-cloud/no-template.js +23 -23
  36. package/rules/camunda-cloud/no-zeebe-properties.js +18 -18
  37. package/rules/camunda-cloud/no-zeebe-user-task.js +27 -27
  38. package/rules/camunda-cloud/priority-definition.js +61 -61
  39. package/rules/camunda-cloud/secrets.js +119 -119
  40. package/rules/camunda-cloud/sequence-flow-condition.js +56 -56
  41. package/rules/camunda-cloud/signal-reference.js +64 -64
  42. package/rules/camunda-cloud/start-event-form.js +97 -97
  43. package/rules/camunda-cloud/subscription.js +65 -65
  44. package/rules/camunda-cloud/task-schedule.js +67 -67
  45. package/rules/camunda-cloud/timer/config.js +46 -46
  46. package/rules/camunda-cloud/timer/index.js +183 -183
  47. package/rules/camunda-cloud/user-task-definition.js +24 -24
  48. package/rules/camunda-cloud/user-task-form.js +142 -142
  49. package/rules/camunda-cloud/wait-for-completion.js +46 -46
  50. package/rules/camunda-platform/history-time-to-live.js +19 -19
  51. package/rules/utils/cron.js +95 -95
  52. package/rules/utils/element.js +533 -533
  53. package/rules/utils/error-types.js +25 -25
  54. package/rules/utils/iso8601.js +52 -52
  55. package/rules/utils/reporter.js +37 -37
  56. package/rules/utils/rule.js +46 -46
  57. package/rules/utils/version.js +4 -4
@@ -1,39 +1,39 @@
1
- const { is } = require('bpmnlint-utils');
2
-
3
- const {
4
- findExtensionElement,
5
- hasProperties
6
- } = require('../utils/element');
7
-
8
- const { reportErrors } = require('../utils/reporter');
9
-
10
- const { skipInNonExecutableProcess } = require('../utils/rule');
11
-
12
- module.exports = skipInNonExecutableProcess(function() {
13
- function check(node, reporter) {
14
- if (!is(node, 'bpmn:UserTask')) {
15
- return;
16
- }
17
-
18
- const assignmentDefinition = findExtensionElement(node, 'zeebe:AssignmentDefinition');
19
-
20
- if (!assignmentDefinition) {
21
- return;
22
- }
23
-
24
- const errors = hasProperties(assignmentDefinition, {
25
- candidateUsers: {
26
- allowed: false,
27
- allowedVersion: '8.2'
28
- }
29
- }, node);
30
-
31
- if (errors && errors.length) {
32
- reportErrors(node, reporter, errors);
33
- }
34
- }
35
-
36
- return {
37
- check
38
- };
1
+ const { is } = require('bpmnlint-utils');
2
+
3
+ const {
4
+ findExtensionElement,
5
+ hasProperties
6
+ } = require('../utils/element');
7
+
8
+ const { reportErrors } = require('../utils/reporter');
9
+
10
+ const { skipInNonExecutableProcess } = require('../utils/rule');
11
+
12
+ module.exports = skipInNonExecutableProcess(function() {
13
+ function check(node, reporter) {
14
+ if (!is(node, 'bpmn:UserTask')) {
15
+ return;
16
+ }
17
+
18
+ const assignmentDefinition = findExtensionElement(node, 'zeebe:AssignmentDefinition');
19
+
20
+ if (!assignmentDefinition) {
21
+ return;
22
+ }
23
+
24
+ const errors = hasProperties(assignmentDefinition, {
25
+ candidateUsers: {
26
+ allowed: false,
27
+ allowedVersion: '8.2'
28
+ }
29
+ }, node);
30
+
31
+ if (errors && errors.length) {
32
+ reportErrors(node, reporter, errors);
33
+ }
34
+ }
35
+
36
+ return {
37
+ check
38
+ };
39
39
  });
@@ -1,21 +1,21 @@
1
- const { reportErrors } = require('../utils/reporter');
2
-
3
- const { skipInNonExecutableProcess } = require('../utils/rule');
4
-
5
- const { hasNoExtensionElement } = require('../utils/element');
6
-
7
- const ALLOWED_VERSION = '8.6';
8
-
9
- module.exports = skipInNonExecutableProcess(function() {
10
- function check(node, reporter) {
11
- const errors = hasNoExtensionElement(node, 'zeebe:ExecutionListeners', node, ALLOWED_VERSION);
12
-
13
- if (errors && errors.length) {
14
- reportErrors(node, reporter, errors);
15
- }
16
- }
17
-
18
- return {
19
- check
20
- };
21
- });
1
+ const { reportErrors } = require('../utils/reporter');
2
+
3
+ const { skipInNonExecutableProcess } = require('../utils/rule');
4
+
5
+ const { hasNoExtensionElement } = require('../utils/element');
6
+
7
+ const ALLOWED_VERSION = '8.6';
8
+
9
+ module.exports = skipInNonExecutableProcess(function() {
10
+ function check(node, reporter) {
11
+ const errors = hasNoExtensionElement(node, 'zeebe:ExecutionListeners', node, ALLOWED_VERSION);
12
+
13
+ if (errors && errors.length) {
14
+ reportErrors(node, reporter, errors);
15
+ }
16
+ }
17
+
18
+ return {
19
+ check
20
+ };
21
+ });
@@ -1,173 +1,173 @@
1
- const {
2
- is
3
- } = require('bpmnlint-utils');
4
-
5
- const { getPath } = require('@bpmn-io/moddle-utils');
6
-
7
- const {
8
- ERROR_TYPES,
9
- getEventDefinition
10
- } = require('../utils/element');
11
-
12
- const { reportErrors } = require('../utils/reporter');
13
-
14
- const { skipInNonExecutableProcess } = require('../utils/rule');
15
-
16
- const handlersMap = {
17
- '1.0': [
18
- checkErrorCode
19
- ],
20
- '1.1': [
21
- checkErrorCode
22
- ],
23
- '1.2': [
24
- checkErrorCode
25
- ],
26
- '1.3': [
27
- checkErrorCode
28
- ],
29
- '8.0': [
30
- checkErrorCode
31
- ],
32
- '8.1': [
33
- checkErrorCode
34
- ],
35
- '8.2': [
36
- checkErrorCatchEvent,
37
- checkEscalationCatchEvent
38
- ],
39
- '8.3': [
40
- checkErrorCatchEvent,
41
- checkEscalationCatchEvent
42
- ]
43
- };
44
-
45
- module.exports = skipInNonExecutableProcess(noExpressionRule);
46
-
47
- /**
48
- * Make sure that certain properties do not contain expressions in older versions.
49
- * @param {{ version: string }} config
50
- */
51
- function noExpressionRule({ version }) {
52
- function check(node, reporter) {
53
- const errors = checkForVersion(node, version);
54
-
55
- if (errors && errors.length) {
56
- reportErrors(node, reporter, errors);
57
- }
58
- }
59
-
60
- return {
61
- check
62
- };
63
- }
64
-
65
- function checkForVersion(node, version) {
66
- const handlers = handlersMap[version];
67
-
68
- if (!handlers) {
69
- return [];
70
- }
71
-
72
- return handlers.reduce((errors, handler) => {
73
- const handlerErrors = handler(node) || [];
74
- return errors.concat(handlerErrors);
75
- }, []);
76
- }
77
-
78
- function noExpression(node, propertyName, parentNode, allowedVersion) {
79
- const path = getPath(node, parentNode),
80
- propertyValue = node.get(propertyName);
81
-
82
- if (!isExpression(propertyValue)) {
83
- return;
84
- }
85
-
86
- let message = `Expression statement <${ truncate(propertyValue) }> not supported`;
87
-
88
- let data = {
89
- type: ERROR_TYPES.EXPRESSION_NOT_ALLOWED,
90
- node,
91
- parentNode: parentNode == node ? null : parentNode,
92
- property: propertyName
93
- };
94
-
95
- if (allowedVersion) {
96
- message = `Expression statement <${ truncate(propertyValue) }> only supported by Camunda ${allowedVersion} or newer`;
97
-
98
- data = {
99
- ...data,
100
- allowedVersion
101
- };
102
- }
103
-
104
- return {
105
- message,
106
- path: path
107
- ? [ ...path, propertyName ]
108
- : [ propertyName ],
109
- data
110
- };
111
- }
112
-
113
- function isExpression(value) {
114
- return value && value.startsWith('=');
115
- }
116
-
117
- function checkErrorCode(node) {
118
- if (!is(node, 'bpmn:Event')) {
119
- return;
120
- }
121
-
122
- const eventDefinition = getEventDefinition(node);
123
-
124
- if (!eventDefinition || !is(eventDefinition, 'bpmn:ErrorEventDefinition')) {
125
- return;
126
- }
127
-
128
- const errorRef = eventDefinition.get('errorRef');
129
-
130
- if (!errorRef) {
131
- return;
132
- }
133
-
134
- if (is(node, 'bpmn:CatchEvent')) {
135
- return noExpression(errorRef, 'errorCode', node, null);
136
- } else {
137
- return noExpression(errorRef, 'errorCode', node, '8.2');
138
- }
139
- }
140
-
141
- function checkErrorCatchEvent(node) {
142
- if (!is(node, 'bpmn:CatchEvent')) {
143
- return;
144
- }
145
-
146
- return checkErrorCode(node);
147
- }
148
-
149
- function checkEscalationCatchEvent(node) {
150
- if (!is(node, 'bpmn:CatchEvent')) {
151
- return;
152
- }
153
-
154
- const eventDefinition = getEventDefinition(node);
155
-
156
- if (!eventDefinition || !is(eventDefinition, 'bpmn:EscalationEventDefinition')) {
157
- return;
158
- }
159
-
160
- const escalationRef = eventDefinition.get('escalationRef');
161
-
162
- if (!escalationRef) {
163
- return;
164
- }
165
-
166
- return noExpression(escalationRef, 'escalationCode', node, null);
167
- }
168
-
169
- function truncate(string, maxLength = 10) {
170
- const stringified = `${ string }`;
171
-
172
- return stringified.length > maxLength ? `${ stringified.slice(0, maxLength) }...` : stringified;
173
- }
1
+ const {
2
+ is
3
+ } = require('bpmnlint-utils');
4
+
5
+ const { getPath } = require('@bpmn-io/moddle-utils');
6
+
7
+ const {
8
+ ERROR_TYPES,
9
+ getEventDefinition
10
+ } = require('../utils/element');
11
+
12
+ const { reportErrors } = require('../utils/reporter');
13
+
14
+ const { skipInNonExecutableProcess } = require('../utils/rule');
15
+
16
+ const handlersMap = {
17
+ '1.0': [
18
+ checkErrorCode
19
+ ],
20
+ '1.1': [
21
+ checkErrorCode
22
+ ],
23
+ '1.2': [
24
+ checkErrorCode
25
+ ],
26
+ '1.3': [
27
+ checkErrorCode
28
+ ],
29
+ '8.0': [
30
+ checkErrorCode
31
+ ],
32
+ '8.1': [
33
+ checkErrorCode
34
+ ],
35
+ '8.2': [
36
+ checkErrorCatchEvent,
37
+ checkEscalationCatchEvent
38
+ ],
39
+ '8.3': [
40
+ checkErrorCatchEvent,
41
+ checkEscalationCatchEvent
42
+ ]
43
+ };
44
+
45
+ module.exports = skipInNonExecutableProcess(noExpressionRule);
46
+
47
+ /**
48
+ * Make sure that certain properties do not contain expressions in older versions.
49
+ * @param {{ version: string }} config
50
+ */
51
+ function noExpressionRule({ version }) {
52
+ function check(node, reporter) {
53
+ const errors = checkForVersion(node, version);
54
+
55
+ if (errors && errors.length) {
56
+ reportErrors(node, reporter, errors);
57
+ }
58
+ }
59
+
60
+ return {
61
+ check
62
+ };
63
+ }
64
+
65
+ function checkForVersion(node, version) {
66
+ const handlers = handlersMap[version];
67
+
68
+ if (!handlers) {
69
+ return [];
70
+ }
71
+
72
+ return handlers.reduce((errors, handler) => {
73
+ const handlerErrors = handler(node) || [];
74
+ return errors.concat(handlerErrors);
75
+ }, []);
76
+ }
77
+
78
+ function noExpression(node, propertyName, parentNode, allowedVersion) {
79
+ const path = getPath(node, parentNode),
80
+ propertyValue = node.get(propertyName);
81
+
82
+ if (!isExpression(propertyValue)) {
83
+ return;
84
+ }
85
+
86
+ let message = `Expression statement <${ truncate(propertyValue) }> not supported`;
87
+
88
+ let data = {
89
+ type: ERROR_TYPES.EXPRESSION_NOT_ALLOWED,
90
+ node,
91
+ parentNode: parentNode == node ? null : parentNode,
92
+ property: propertyName
93
+ };
94
+
95
+ if (allowedVersion) {
96
+ message = `Expression statement <${ truncate(propertyValue) }> only supported by Camunda ${allowedVersion} or newer`;
97
+
98
+ data = {
99
+ ...data,
100
+ allowedVersion
101
+ };
102
+ }
103
+
104
+ return {
105
+ message,
106
+ path: path
107
+ ? [ ...path, propertyName ]
108
+ : [ propertyName ],
109
+ data
110
+ };
111
+ }
112
+
113
+ function isExpression(value) {
114
+ return value && value.startsWith('=');
115
+ }
116
+
117
+ function checkErrorCode(node) {
118
+ if (!is(node, 'bpmn:Event')) {
119
+ return;
120
+ }
121
+
122
+ const eventDefinition = getEventDefinition(node);
123
+
124
+ if (!eventDefinition || !is(eventDefinition, 'bpmn:ErrorEventDefinition')) {
125
+ return;
126
+ }
127
+
128
+ const errorRef = eventDefinition.get('errorRef');
129
+
130
+ if (!errorRef) {
131
+ return;
132
+ }
133
+
134
+ if (is(node, 'bpmn:CatchEvent')) {
135
+ return noExpression(errorRef, 'errorCode', node, null);
136
+ } else {
137
+ return noExpression(errorRef, 'errorCode', node, '8.2');
138
+ }
139
+ }
140
+
141
+ function checkErrorCatchEvent(node) {
142
+ if (!is(node, 'bpmn:CatchEvent')) {
143
+ return;
144
+ }
145
+
146
+ return checkErrorCode(node);
147
+ }
148
+
149
+ function checkEscalationCatchEvent(node) {
150
+ if (!is(node, 'bpmn:CatchEvent')) {
151
+ return;
152
+ }
153
+
154
+ const eventDefinition = getEventDefinition(node);
155
+
156
+ if (!eventDefinition || !is(eventDefinition, 'bpmn:EscalationEventDefinition')) {
157
+ return;
158
+ }
159
+
160
+ const escalationRef = eventDefinition.get('escalationRef');
161
+
162
+ if (!escalationRef) {
163
+ return;
164
+ }
165
+
166
+ return noExpression(escalationRef, 'escalationCode', node, null);
167
+ }
168
+
169
+ function truncate(string, maxLength = 10) {
170
+ const stringified = `${ string }`;
171
+
172
+ return stringified.length > maxLength ? `${ stringified.slice(0, maxLength) }...` : stringified;
173
+ }