bpmnlint-plugin-camunda-compat 2.18.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 -208
  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 -66
  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 -46
  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,24 +1,24 @@
1
- module.exports.ERROR_TYPES = Object.freeze({
2
- CHILD_ELEMENT_TYPE_NOT_ALLOWED: 'camunda.childElementTypeNotAllowed',
3
- ELEMENT_COLLAPSED_NOT_ALLOWED: 'camunda.elementCollapsedNotAllowed',
4
- ELEMENT_MULTIPLE_NOT_ALLOWED: 'camunda.elementMultipleNotAllowed',
5
- ELEMENT_TYPE_NOT_ALLOWED: 'camunda.elementTypeNotAllowed',
6
- ELEMENT_PROPERTY_VALUE_DUPLICATED: 'camunda.elementPropertyValueDuplicated',
7
- EVENT_BASED_GATEWAY_TARGET_NOT_ALLOWED: 'camunda.eventBasedGatewayTargetNotAllowed',
8
- EXPRESSION_NOT_ALLOWED: 'camunda.expressionNotAllowed',
9
- EXPRESSION_REQUIRED: 'camunda.expressionRequired',
10
- EXPRESSION_VALUE_NOT_ALLOWED: 'camunda.expressionValueNotAllowed',
11
- EXTENSION_ELEMENT_NOT_ALLOWED: 'camunda.extensionElementNotAllowed',
12
- EXTENSION_ELEMENT_REQUIRED: 'camunda.extensionElementRequired',
13
- FEEL_EXPRESSION_INVALID: 'camunda.feelExpressionInvalid',
14
- LOOP_NOT_ALLOWED: 'camunda.loopNotAllowed',
15
- ATTACHED_TO_REF_ELEMENT_TYPE_NOT_ALLOWED: 'camunda.attachedToRefElementTypeNotAllowed',
16
- PROPERTY_DEPENDENT_REQUIRED: 'camunda.propertyDependentRequired',
17
- PROPERTY_NOT_ALLOWED: 'camunda.propertyNotAllowed',
18
- PROPERTY_REQUIRED: 'camunda.propertyRequired',
19
- PROPERTY_TYPE_NOT_ALLOWED: 'camunda.propertyTypeNotAllowed',
20
- PROPERTY_VALUE_DUPLICATED: 'camunda.propertyValueDuplicated',
21
- PROPERTY_VALUE_NOT_ALLOWED: 'camunda.propertyValueNotAllowed',
22
- PROPERTY_VALUE_REQUIRED: 'camunda.propertyValueRequired',
23
- SECRET_EXPRESSION_FORMAT_DEPRECATED: 'camunda.secretExpressionFormatDeprecated'
1
+ module.exports.ERROR_TYPES = Object.freeze({
2
+ CHILD_ELEMENT_TYPE_NOT_ALLOWED: 'camunda.childElementTypeNotAllowed',
3
+ ELEMENT_COLLAPSED_NOT_ALLOWED: 'camunda.elementCollapsedNotAllowed',
4
+ ELEMENT_MULTIPLE_NOT_ALLOWED: 'camunda.elementMultipleNotAllowed',
5
+ ELEMENT_TYPE_NOT_ALLOWED: 'camunda.elementTypeNotAllowed',
6
+ ELEMENT_PROPERTY_VALUE_DUPLICATED: 'camunda.elementPropertyValueDuplicated',
7
+ EVENT_BASED_GATEWAY_TARGET_NOT_ALLOWED: 'camunda.eventBasedGatewayTargetNotAllowed',
8
+ EXPRESSION_NOT_ALLOWED: 'camunda.expressionNotAllowed',
9
+ EXPRESSION_REQUIRED: 'camunda.expressionRequired',
10
+ EXPRESSION_VALUE_NOT_ALLOWED: 'camunda.expressionValueNotAllowed',
11
+ EXTENSION_ELEMENT_NOT_ALLOWED: 'camunda.extensionElementNotAllowed',
12
+ EXTENSION_ELEMENT_REQUIRED: 'camunda.extensionElementRequired',
13
+ FEEL_EXPRESSION_INVALID: 'camunda.feelExpressionInvalid',
14
+ LOOP_NOT_ALLOWED: 'camunda.loopNotAllowed',
15
+ ATTACHED_TO_REF_ELEMENT_TYPE_NOT_ALLOWED: 'camunda.attachedToRefElementTypeNotAllowed',
16
+ PROPERTY_DEPENDENT_REQUIRED: 'camunda.propertyDependentRequired',
17
+ PROPERTY_NOT_ALLOWED: 'camunda.propertyNotAllowed',
18
+ PROPERTY_REQUIRED: 'camunda.propertyRequired',
19
+ PROPERTY_TYPE_NOT_ALLOWED: 'camunda.propertyTypeNotAllowed',
20
+ PROPERTY_VALUE_DUPLICATED: 'camunda.propertyValueDuplicated',
21
+ PROPERTY_VALUE_NOT_ALLOWED: 'camunda.propertyValueNotAllowed',
22
+ PROPERTY_VALUE_REQUIRED: 'camunda.propertyValueRequired',
23
+ SECRET_EXPRESSION_FORMAT_DEPRECATED: 'camunda.secretExpressionFormatDeprecated'
24
24
  });
@@ -1,52 +1,52 @@
1
- const YEAR = '\\d{4}';
2
- const MONTH = '(?<month>0[1-9]|1[0-2])';
3
- const DAY = '(0[1-9]|[12][0-9]|3[01])';
4
- const DATE = `(?<date>${YEAR}-${MONTH}-${DAY})`;
5
- const HOUR = '(0[0-9]|1[0-9]|2[0-3])';
6
- const MINUTE = '[0-5][0-9]';
7
- const SECOND = '[0-5][0-9]';
8
- const ZONE_ID = '(\\[[^\\]]+\\])';
9
- const TIMEZONE = `(Z|([+-](0[0-9]|1[0-3]):[0-5][0-9]${ZONE_ID}?))`;
10
-
11
- const ISO_DATE = `${DATE}T${HOUR}:${MINUTE}:${SECOND}${TIMEZONE}`;
12
- const ISO_DATE_REGEX = new RegExp(`^${ISO_DATE}$`);
13
- const ISO_DURATION = 'P(?!$)(\\d+(\\.\\d+)?[Yy])?(\\d+(\\.\\d+)?[Mm])?(\\d+(\\.\\d+)?[Ww])?(\\d+(\\.\\d+)?[Dd])?(T(?!$)(\\d+(\\.\\d+)?[Hh])?(\\d+(\\.\\d+)?[Mm])?(\\d+(\\.\\d+)?[Ss])?)?$';
14
- const ISO_DURATION_REGEX = new RegExp(`^${ISO_DURATION}$`);
15
- const ISO_CYCLE = `R(-1|\\d+)?/(${ISO_DATE}/)?${ISO_DURATION}`;
16
- const ISO_CYCLE_REGEX = new RegExp(`^${ISO_CYCLE}$`);
17
-
18
- module.exports = {
19
- validateCycle,
20
- validateDate,
21
- validateDuration
22
- };
23
-
24
- function validateCycle(value) {
25
- return ISO_CYCLE_REGEX.test(value);
26
- }
27
-
28
- function validateDate(value) {
29
- const result = ISO_DATE_REGEX.exec(value);
30
-
31
- if (!result) {
32
- return false;
33
- }
34
-
35
- return isDateValid(result);
36
- }
37
-
38
- function validateDuration(value) {
39
- return ISO_DURATION_REGEX.test(value);
40
- }
41
-
42
- function isDateValid(result) {
43
- const {
44
- date,
45
- month
46
- } = result.groups;
47
-
48
- const dateParsedMonth = new Date(date).getMonth() + 1;
49
- const parsedMonth = Number.parseInt(month, 10);
50
-
51
- return dateParsedMonth === parsedMonth;
52
- }
1
+ const YEAR = '\\d{4}';
2
+ const MONTH = '(?<month>0[1-9]|1[0-2])';
3
+ const DAY = '(0[1-9]|[12][0-9]|3[01])';
4
+ const DATE = `(?<date>${YEAR}-${MONTH}-${DAY})`;
5
+ const HOUR = '(0[0-9]|1[0-9]|2[0-3])';
6
+ const MINUTE = '[0-5][0-9]';
7
+ const SECOND = '[0-5][0-9]';
8
+ const ZONE_ID = '(\\[[^\\]]+\\])';
9
+ const TIMEZONE = `(Z|([+-](0[0-9]|1[0-3]):[0-5][0-9]${ZONE_ID}?))`;
10
+
11
+ const ISO_DATE = `${DATE}T${HOUR}:${MINUTE}:${SECOND}${TIMEZONE}`;
12
+ const ISO_DATE_REGEX = new RegExp(`^${ISO_DATE}$`);
13
+ const ISO_DURATION = 'P(?!$)(\\d+(\\.\\d+)?[Yy])?(\\d+(\\.\\d+)?[Mm])?(\\d+(\\.\\d+)?[Ww])?(\\d+(\\.\\d+)?[Dd])?(T(?!$)(\\d+(\\.\\d+)?[Hh])?(\\d+(\\.\\d+)?[Mm])?(\\d+(\\.\\d+)?[Ss])?)?$';
14
+ const ISO_DURATION_REGEX = new RegExp(`^${ISO_DURATION}$`);
15
+ const ISO_CYCLE = `R(-1|\\d+)?/(${ISO_DATE}/)?${ISO_DURATION}`;
16
+ const ISO_CYCLE_REGEX = new RegExp(`^${ISO_CYCLE}$`);
17
+
18
+ module.exports = {
19
+ validateCycle,
20
+ validateDate,
21
+ validateDuration
22
+ };
23
+
24
+ function validateCycle(value) {
25
+ return ISO_CYCLE_REGEX.test(value);
26
+ }
27
+
28
+ function validateDate(value) {
29
+ const result = ISO_DATE_REGEX.exec(value);
30
+
31
+ if (!result) {
32
+ return false;
33
+ }
34
+
35
+ return isDateValid(result);
36
+ }
37
+
38
+ function validateDuration(value) {
39
+ return ISO_DURATION_REGEX.test(value);
40
+ }
41
+
42
+ function isDateValid(result) {
43
+ const {
44
+ date,
45
+ month
46
+ } = result.groups;
47
+
48
+ const dateParsedMonth = new Date(date).getMonth() + 1;
49
+ const parsedMonth = Number.parseInt(month, 10);
50
+
51
+ return dateParsedMonth === parsedMonth;
52
+ }
@@ -1,38 +1,38 @@
1
- const { is } = require('bpmnlint-utils');
2
-
3
- const { isArray } = require('min-dash');
4
-
5
- module.exports.reportErrors = function(node, reporter, errors) {
6
- if (!isArray(errors)) {
7
- errors = [ errors ];
8
- }
9
-
10
- errors.forEach(({ message, ...options }) => {
11
- const name = getName(node);
12
-
13
- if (name) {
14
- options = {
15
- ...options,
16
- name
17
- };
18
- }
19
-
20
- reporter.report(node.get('id'), message, options);
21
- });
22
- };
23
-
24
- function getName(node) {
25
- if (is(node, 'bpmn:TextAnnotation')) {
26
- return node.get('text');
27
- }
28
-
29
- if (is(node, 'bpmn:Group')) {
30
- const categoryValueRef = node.get('categoryValueRef');
31
-
32
- return categoryValueRef && categoryValueRef.get('value');
33
- }
34
-
35
- return node.get('name');
36
- }
37
-
1
+ const { is } = require('bpmnlint-utils');
2
+
3
+ const { isArray } = require('min-dash');
4
+
5
+ module.exports.reportErrors = function(node, reporter, errors) {
6
+ if (!isArray(errors)) {
7
+ errors = [ errors ];
8
+ }
9
+
10
+ errors.forEach(({ message, ...options }) => {
11
+ const name = getName(node);
12
+
13
+ if (name) {
14
+ options = {
15
+ ...options,
16
+ name
17
+ };
18
+ }
19
+
20
+ reporter.report(node.get('id'), message, options);
21
+ });
22
+ };
23
+
24
+ function getName(node) {
25
+ if (is(node, 'bpmn:TextAnnotation')) {
26
+ return node.get('text');
27
+ }
28
+
29
+ if (is(node, 'bpmn:Group')) {
30
+ const categoryValueRef = node.get('categoryValueRef');
31
+
32
+ return categoryValueRef && categoryValueRef.get('value');
33
+ }
34
+
35
+ return node.get('name');
36
+ }
37
+
38
38
  module.exports.getName = getName;
@@ -1,47 +1,47 @@
1
- const { is } = require('bpmnlint-utils');
2
-
3
- const { greaterOrEqual } = require('./version');
4
-
5
- function skipInNonExecutableProcess(ruleFactory) {
6
- return function(config = {}) {
7
- const rule = ruleFactory(config);
8
-
9
- const { version, platform = 'camunda-cloud' } = config;
10
-
11
- function check(node, reporter) {
12
- if (platform === 'camunda-cloud' && version && greaterOrEqual(version, '8.2') && isNonExecutableProcess(node)) {
13
- return false;
14
- }
15
-
16
- if (platform === 'camunda-platform' && isNonExecutableProcess(node)) {
17
- return false;
18
- }
19
-
20
- return rule.check(node, reporter);
21
- }
22
-
23
- return {
24
- ...rule,
25
- check
26
- };
27
- };
28
- }
29
-
30
- module.exports = {
31
- skipInNonExecutableProcess
32
- };
33
-
34
- function isNonExecutableProcess(node) {
35
- let process;
36
-
37
- if (is(node, 'bpmn:Process')) {
38
- process = node;
39
- }
40
-
41
- if (is(node, 'bpmndi:BPMNPlane')
42
- && is(node.get('bpmnElement'), 'bpmn:Process')) {
43
- process = node.get('bpmnElement');
44
- }
45
-
46
- return process && !process.get('isExecutable');
1
+ const { is } = require('bpmnlint-utils');
2
+
3
+ const { greaterOrEqual } = require('./version');
4
+
5
+ function skipInNonExecutableProcess(ruleFactory) {
6
+ return function(config = {}) {
7
+ const rule = ruleFactory(config);
8
+
9
+ const { version, platform = 'camunda-cloud' } = config;
10
+
11
+ function check(node, reporter) {
12
+ if (platform === 'camunda-cloud' && version && greaterOrEqual(version, '8.2') && isNonExecutableProcess(node)) {
13
+ return false;
14
+ }
15
+
16
+ if (platform === 'camunda-platform' && isNonExecutableProcess(node)) {
17
+ return false;
18
+ }
19
+
20
+ return rule.check(node, reporter);
21
+ }
22
+
23
+ return {
24
+ ...rule,
25
+ check
26
+ };
27
+ };
28
+ }
29
+
30
+ module.exports = {
31
+ skipInNonExecutableProcess
32
+ };
33
+
34
+ function isNonExecutableProcess(node) {
35
+ let process;
36
+
37
+ if (is(node, 'bpmn:Process')) {
38
+ process = node;
39
+ }
40
+
41
+ if (is(node, 'bpmndi:BPMNPlane')
42
+ && is(node.get('bpmnElement'), 'bpmn:Process')) {
43
+ process = node.get('bpmnElement');
44
+ }
45
+
46
+ return process && !process.get('isExecutable');
47
47
  }
@@ -1,5 +1,5 @@
1
- const cmp = require('semver-compare');
2
-
3
- module.exports.greaterOrEqual = function(a, b) {
4
- return cmp(a, b) !== -1;
1
+ const cmp = require('semver-compare');
2
+
3
+ module.exports.greaterOrEqual = function(a, b) {
4
+ return cmp(a, b) !== -1;
5
5
  };