bpmnlint-plugin-camunda-compat 2.35.0 → 2.36.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 (64) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +39 -39
  3. package/index.js +286 -286
  4. package/package.json +53 -53
  5. package/rules/camunda-cloud/ad-hoc-sub-process.js +60 -60
  6. package/rules/camunda-cloud/called-element.js +44 -44
  7. package/rules/camunda-cloud/collapsed-subprocess.js +40 -40
  8. package/rules/camunda-cloud/connector-properties/config.js +90 -90
  9. package/rules/camunda-cloud/connector-properties/index.js +47 -47
  10. package/rules/camunda-cloud/duplicate-execution-listeners.js +33 -33
  11. package/rules/camunda-cloud/duplicate-task-headers.js +58 -58
  12. package/rules/camunda-cloud/element-type/config.js +67 -67
  13. package/rules/camunda-cloud/element-type/index.js +135 -135
  14. package/rules/camunda-cloud/error-reference.js +72 -72
  15. package/rules/camunda-cloud/escalation-boundary-event-attached-to-ref.js +47 -47
  16. package/rules/camunda-cloud/escalation-reference.js +67 -67
  17. package/rules/camunda-cloud/event-based-gateway-target.js +38 -38
  18. package/rules/camunda-cloud/executable-process.js +61 -61
  19. package/rules/camunda-cloud/execution-listener.js +33 -33
  20. package/rules/camunda-cloud/feel.js +86 -86
  21. package/rules/camunda-cloud/implementation/config.js +19 -19
  22. package/rules/camunda-cloud/implementation/index.js +218 -218
  23. package/rules/camunda-cloud/inclusive-gateway.js +35 -35
  24. package/rules/camunda-cloud/link-event.js +142 -142
  25. package/rules/camunda-cloud/loop-characteristics.js +66 -66
  26. package/rules/camunda-cloud/message-reference.js +61 -61
  27. package/rules/camunda-cloud/no-binding-type.js +43 -43
  28. package/rules/camunda-cloud/no-candidate-users.js +38 -38
  29. package/rules/camunda-cloud/no-execution-listeners.js +21 -21
  30. package/rules/camunda-cloud/no-expression.js +173 -173
  31. package/rules/camunda-cloud/no-loop.js +316 -316
  32. package/rules/camunda-cloud/no-multiple-none-start-events.js +41 -41
  33. package/rules/camunda-cloud/no-priority-definition.js +18 -18
  34. package/rules/camunda-cloud/no-propagate-all-parent-variables.js +44 -44
  35. package/rules/camunda-cloud/no-signal-event-sub-process.js +45 -45
  36. package/rules/camunda-cloud/no-task-listeners.js +21 -21
  37. package/rules/camunda-cloud/no-task-schedule.js +18 -18
  38. package/rules/camunda-cloud/no-template.js +23 -23
  39. package/rules/camunda-cloud/no-version-tag.js +24 -24
  40. package/rules/camunda-cloud/no-zeebe-properties.js +18 -18
  41. package/rules/camunda-cloud/no-zeebe-user-task.js +27 -27
  42. package/rules/camunda-cloud/priority-definition.js +61 -61
  43. package/rules/camunda-cloud/secrets.js +119 -119
  44. package/rules/camunda-cloud/sequence-flow-condition.js +56 -56
  45. package/rules/camunda-cloud/signal-reference.js +64 -64
  46. package/rules/camunda-cloud/start-event-form.js +97 -97
  47. package/rules/camunda-cloud/subscription.js +65 -65
  48. package/rules/camunda-cloud/task-listener.js +39 -39
  49. package/rules/camunda-cloud/task-schedule.js +67 -67
  50. package/rules/camunda-cloud/timer/config.js +46 -46
  51. package/rules/camunda-cloud/timer/index.js +183 -183
  52. package/rules/camunda-cloud/user-task-definition.js +24 -24
  53. package/rules/camunda-cloud/user-task-form.js +142 -142
  54. package/rules/camunda-cloud/wait-for-completion.js +46 -46
  55. package/rules/camunda-cloud/zeebe-user-task.js +30 -30
  56. package/rules/camunda-platform/history-time-to-live.js +24 -21
  57. package/rules/helper.js +38 -38
  58. package/rules/utils/cron.js +95 -95
  59. package/rules/utils/element.js +533 -533
  60. package/rules/utils/error-types.js +26 -26
  61. package/rules/utils/iso8601.js +52 -52
  62. package/rules/utils/reporter.js +37 -37
  63. package/rules/utils/rule.js +46 -46
  64. package/rules/utils/version.js +4 -4
@@ -1,184 +1,184 @@
1
- const { isNil } = require('min-dash');
2
-
3
- const {
4
- is
5
- } = require('bpmnlint-utils');
6
-
7
- const {
8
- elementType: elementTypeConfig,
9
- expressionType: expressionTypeConfig
10
- } = require('./config');
11
-
12
- const { greaterOrEqual } = require('../../utils/version');
13
-
14
- const {
15
- getEventDefinition,
16
- hasExpression,
17
- hasProperties,
18
- hasProperty
19
- } = require('../../utils/element');
20
-
21
- const { validateCronExpression } = require('../../utils/cron');
22
-
23
- const {
24
- validateCycle: validateISO8601Cycle,
25
- validateDate: validateISO8601Date,
26
- validateDuration: validateISO8601Duration
27
- } = require('../../utils/iso8601');
28
-
29
- const { reportErrors } = require('../../utils/reporter');
30
-
31
- const { skipInNonExecutableProcess } = require('../../utils/rule');
32
-
33
- module.exports = skipInNonExecutableProcess(function({ version }) {
34
- function check(node, reporter) {
35
- if (!is(node, 'bpmn:Event')) {
36
- return;
37
- }
38
-
39
- const eventDefinition = getEventDefinition(node);
40
-
41
- if (!eventDefinition || !is(eventDefinition, 'bpmn:TimerEventDefinition')) {
42
- return;
43
- }
44
-
45
- let errors = checkTimePropertyExists(eventDefinition, node, version);
46
-
47
- if (errors && errors.length) {
48
- reportErrors(node, reporter, errors);
49
-
50
- return;
51
- }
52
-
53
- errors = checkTimeProperty(eventDefinition, 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 checkTimePropertyExists(eventDefinition, node, version) {
66
- const timePropertyName = getTimePropertyName(eventDefinition);
67
-
68
- if (timePropertyName) {
69
- const allowedVersion = getAllowedVersionForTimeProperty(node, timePropertyName),
70
- allowed = isNil(allowedVersion) ? false : greaterOrEqual(version, allowedVersion);
71
-
72
- return hasProperties(eventDefinition, {
73
- [ timePropertyName ]: {
74
- allowed,
75
- allowedVersion
76
- }
77
- }, node);
78
- }
79
-
80
- return hasProperty(eventDefinition, getAllowedTimePropertiesForVersion(node, version), node);
81
- }
82
-
83
- function checkTimeProperty(eventDefinition, event, version) {
84
- const timeCycle = eventDefinition.get('timeCycle'),
85
- timeDate = eventDefinition.get('timeDate'),
86
- timeDuration = eventDefinition.get('timeDuration');
87
-
88
- if (timeCycle) {
89
- return hasExpression(eventDefinition, 'timeCycle', {
90
- allowed: cycle => validateCycle(cycle, version)
91
- }, event);
92
- } else if (timeDate) {
93
- return hasExpression(eventDefinition, 'timeDate', {
94
- allowed: date => validateDate(date, version)
95
- }, event);
96
- } else if (timeDuration) {
97
- return hasExpression(eventDefinition, 'timeDuration', {
98
- allowed: duration => validateDuration(duration, version)
99
- }, event);
100
- }
101
- }
102
-
103
-
104
-
105
- // helpers //////////
106
- function validateCycle(cycle, version) {
107
- if (validateExpression(cycle)) {
108
- return true;
109
- }
110
-
111
- if (validateISO8601Cycle(cycle)) {
112
- return greaterOrEqual(version, expressionTypeConfig.iso8601);
113
- }
114
-
115
- if (validateCronExpression(cycle)) {
116
- return greaterOrEqual(version, expressionTypeConfig.cron) || { allowedVersion: expressionTypeConfig.cron };
117
- }
118
- }
119
-
120
- function validateDate(date, version) {
121
- if (validateExpression(date)) {
122
- return true;
123
- }
124
-
125
- if (validateISO8601Date(date)) {
126
- return greaterOrEqual(version, expressionTypeConfig.iso8601);
127
- }
128
- }
129
-
130
- function validateDuration(duration, version) {
131
- if (validateExpression(duration)) {
132
- return true;
133
- }
134
-
135
- if (validateISO8601Duration(duration)) {
136
- return greaterOrEqual(version, expressionTypeConfig.iso8601);
137
- }
138
- }
139
-
140
- function validateExpression(text) {
141
- if (text.startsWith('=')) {
142
- return true;
143
- }
144
- }
145
-
146
- function getTimePropertyName(eventDefinition) {
147
- if (eventDefinition.get('timeCycle')) {
148
- return 'timeCycle';
149
- }
150
-
151
- if (eventDefinition.get('timeDate')) {
152
- return 'timeDate';
153
- }
154
-
155
- if (eventDefinition.get('timeDuration')) {
156
- return 'timeDuration';
157
- }
158
-
159
- return null;
160
- }
161
-
162
- function getAllowedTimePropertiesForVersion(element, version) {
163
- const config = elementTypeConfig[ element.$type ];
164
-
165
- return Object.keys(config).filter((property) => {
166
- const allowedVersion = config[ property ](isInterrupting(element), element.$parent);
167
-
168
- return allowedVersion && greaterOrEqual(version, allowedVersion);
169
- });
170
- }
171
-
172
- function getAllowedVersionForTimeProperty(element, property) {
173
- const config = elementTypeConfig[ element.$type ];
174
-
175
- return config[ property ](isInterrupting(element), element.$parent);
176
- }
177
-
178
- function isInterrupting(element) {
179
- if (is(element, 'bpmn:BoundaryEvent')) {
180
- return element.get('cancelActivity') !== false;
181
- }
182
-
183
- return element.get('isInterrupting') !== false;
1
+ const { isNil } = require('min-dash');
2
+
3
+ const {
4
+ is
5
+ } = require('bpmnlint-utils');
6
+
7
+ const {
8
+ elementType: elementTypeConfig,
9
+ expressionType: expressionTypeConfig
10
+ } = require('./config');
11
+
12
+ const { greaterOrEqual } = require('../../utils/version');
13
+
14
+ const {
15
+ getEventDefinition,
16
+ hasExpression,
17
+ hasProperties,
18
+ hasProperty
19
+ } = require('../../utils/element');
20
+
21
+ const { validateCronExpression } = require('../../utils/cron');
22
+
23
+ const {
24
+ validateCycle: validateISO8601Cycle,
25
+ validateDate: validateISO8601Date,
26
+ validateDuration: validateISO8601Duration
27
+ } = require('../../utils/iso8601');
28
+
29
+ const { reportErrors } = require('../../utils/reporter');
30
+
31
+ const { skipInNonExecutableProcess } = require('../../utils/rule');
32
+
33
+ module.exports = skipInNonExecutableProcess(function({ version }) {
34
+ function check(node, reporter) {
35
+ if (!is(node, 'bpmn:Event')) {
36
+ return;
37
+ }
38
+
39
+ const eventDefinition = getEventDefinition(node);
40
+
41
+ if (!eventDefinition || !is(eventDefinition, 'bpmn:TimerEventDefinition')) {
42
+ return;
43
+ }
44
+
45
+ let errors = checkTimePropertyExists(eventDefinition, node, version);
46
+
47
+ if (errors && errors.length) {
48
+ reportErrors(node, reporter, errors);
49
+
50
+ return;
51
+ }
52
+
53
+ errors = checkTimeProperty(eventDefinition, 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 checkTimePropertyExists(eventDefinition, node, version) {
66
+ const timePropertyName = getTimePropertyName(eventDefinition);
67
+
68
+ if (timePropertyName) {
69
+ const allowedVersion = getAllowedVersionForTimeProperty(node, timePropertyName),
70
+ allowed = isNil(allowedVersion) ? false : greaterOrEqual(version, allowedVersion);
71
+
72
+ return hasProperties(eventDefinition, {
73
+ [ timePropertyName ]: {
74
+ allowed,
75
+ allowedVersion
76
+ }
77
+ }, node);
78
+ }
79
+
80
+ return hasProperty(eventDefinition, getAllowedTimePropertiesForVersion(node, version), node);
81
+ }
82
+
83
+ function checkTimeProperty(eventDefinition, event, version) {
84
+ const timeCycle = eventDefinition.get('timeCycle'),
85
+ timeDate = eventDefinition.get('timeDate'),
86
+ timeDuration = eventDefinition.get('timeDuration');
87
+
88
+ if (timeCycle) {
89
+ return hasExpression(eventDefinition, 'timeCycle', {
90
+ allowed: cycle => validateCycle(cycle, version)
91
+ }, event);
92
+ } else if (timeDate) {
93
+ return hasExpression(eventDefinition, 'timeDate', {
94
+ allowed: date => validateDate(date, version)
95
+ }, event);
96
+ } else if (timeDuration) {
97
+ return hasExpression(eventDefinition, 'timeDuration', {
98
+ allowed: duration => validateDuration(duration, version)
99
+ }, event);
100
+ }
101
+ }
102
+
103
+
104
+
105
+ // helpers //////////
106
+ function validateCycle(cycle, version) {
107
+ if (validateExpression(cycle)) {
108
+ return true;
109
+ }
110
+
111
+ if (validateISO8601Cycle(cycle)) {
112
+ return greaterOrEqual(version, expressionTypeConfig.iso8601);
113
+ }
114
+
115
+ if (validateCronExpression(cycle)) {
116
+ return greaterOrEqual(version, expressionTypeConfig.cron) || { allowedVersion: expressionTypeConfig.cron };
117
+ }
118
+ }
119
+
120
+ function validateDate(date, version) {
121
+ if (validateExpression(date)) {
122
+ return true;
123
+ }
124
+
125
+ if (validateISO8601Date(date)) {
126
+ return greaterOrEqual(version, expressionTypeConfig.iso8601);
127
+ }
128
+ }
129
+
130
+ function validateDuration(duration, version) {
131
+ if (validateExpression(duration)) {
132
+ return true;
133
+ }
134
+
135
+ if (validateISO8601Duration(duration)) {
136
+ return greaterOrEqual(version, expressionTypeConfig.iso8601);
137
+ }
138
+ }
139
+
140
+ function validateExpression(text) {
141
+ if (text.startsWith('=')) {
142
+ return true;
143
+ }
144
+ }
145
+
146
+ function getTimePropertyName(eventDefinition) {
147
+ if (eventDefinition.get('timeCycle')) {
148
+ return 'timeCycle';
149
+ }
150
+
151
+ if (eventDefinition.get('timeDate')) {
152
+ return 'timeDate';
153
+ }
154
+
155
+ if (eventDefinition.get('timeDuration')) {
156
+ return 'timeDuration';
157
+ }
158
+
159
+ return null;
160
+ }
161
+
162
+ function getAllowedTimePropertiesForVersion(element, version) {
163
+ const config = elementTypeConfig[ element.$type ];
164
+
165
+ return Object.keys(config).filter((property) => {
166
+ const allowedVersion = config[ property ](isInterrupting(element), element.$parent);
167
+
168
+ return allowedVersion && greaterOrEqual(version, allowedVersion);
169
+ });
170
+ }
171
+
172
+ function getAllowedVersionForTimeProperty(element, property) {
173
+ const config = elementTypeConfig[ element.$type ];
174
+
175
+ return config[ property ](isInterrupting(element), element.$parent);
176
+ }
177
+
178
+ function isInterrupting(element) {
179
+ if (is(element, 'bpmn:BoundaryEvent')) {
180
+ return element.get('cancelActivity') !== false;
181
+ }
182
+
183
+ return element.get('isInterrupting') !== false;
184
184
  }
@@ -1,25 +1,25 @@
1
- const { is } = require('bpmnlint-utils');
2
-
3
- const { hasExtensionElement } = require('../utils/element');
4
-
5
- const { reportErrors } = require('../utils/reporter');
6
-
7
- const { skipInNonExecutableProcess } = require('../utils/rule');
8
-
9
- module.exports = skipInNonExecutableProcess(function() {
10
- function check(node, reporter) {
11
- if (!is(node, 'bpmn:UserTask')) {
12
- return;
13
- }
14
-
15
- let errors = hasExtensionElement(node, 'zeebe:FormDefinition', node);
16
-
17
- if (errors && errors.length) {
18
- reportErrors(node, reporter, errors);
19
- }
20
- }
21
-
22
- return {
23
- check
24
- };
1
+ const { is } = require('bpmnlint-utils');
2
+
3
+ const { hasExtensionElement } = require('../utils/element');
4
+
5
+ const { reportErrors } = require('../utils/reporter');
6
+
7
+ const { skipInNonExecutableProcess } = require('../utils/rule');
8
+
9
+ module.exports = skipInNonExecutableProcess(function() {
10
+ function check(node, reporter) {
11
+ if (!is(node, 'bpmn:UserTask')) {
12
+ return;
13
+ }
14
+
15
+ let errors = hasExtensionElement(node, 'zeebe:FormDefinition', node);
16
+
17
+ if (errors && errors.length) {
18
+ reportErrors(node, reporter, errors);
19
+ }
20
+ }
21
+
22
+ return {
23
+ check
24
+ };
25
25
  });