bpmnlint-plugin-camunda-compat 2.23.0 → 2.24.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 (58) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +39 -39
  3. package/index.js +242 -237
  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 -90
  8. package/rules/camunda-cloud/connector-properties/index.js +47 -47
  9. package/rules/camunda-cloud/duplicate-execution-listeners.js +33 -33
  10. package/rules/camunda-cloud/duplicate-task-headers.js +58 -58
  11. package/rules/camunda-cloud/element-type/config.js +66 -66
  12. package/rules/camunda-cloud/element-type/index.js +133 -133
  13. package/rules/camunda-cloud/error-reference.js +71 -71
  14. package/rules/camunda-cloud/escalation-boundary-event-attached-to-ref.js +48 -48
  15. package/rules/camunda-cloud/escalation-reference.js +66 -66
  16. package/rules/camunda-cloud/event-based-gateway-target.js +38 -38
  17. package/rules/camunda-cloud/executable-process.js +61 -61
  18. package/rules/camunda-cloud/execution-listener.js +34 -34
  19. package/rules/camunda-cloud/feel.js +82 -82
  20. package/rules/camunda-cloud/implementation/config.js +16 -16
  21. package/rules/camunda-cloud/implementation/index.js +218 -218
  22. package/rules/camunda-cloud/inclusive-gateway.js +35 -35
  23. package/rules/camunda-cloud/link-event.js +142 -142
  24. package/rules/camunda-cloud/loop-characteristics.js +66 -66
  25. package/rules/camunda-cloud/message-reference.js +60 -60
  26. package/rules/camunda-cloud/no-binding-type.js +43 -43
  27. package/rules/camunda-cloud/no-candidate-users.js +38 -38
  28. package/rules/camunda-cloud/no-execution-listeners.js +21 -21
  29. package/rules/camunda-cloud/no-expression.js +173 -173
  30. package/rules/camunda-cloud/no-loop.js +316 -316
  31. package/rules/camunda-cloud/no-multiple-none-start-events.js +41 -41
  32. package/rules/camunda-cloud/no-priority-definition.js +19 -0
  33. package/rules/camunda-cloud/no-propagate-all-parent-variables.js +44 -44
  34. package/rules/camunda-cloud/no-signal-event-sub-process.js +45 -45
  35. package/rules/camunda-cloud/no-task-schedule.js +18 -18
  36. package/rules/camunda-cloud/no-template.js +23 -23
  37. package/rules/camunda-cloud/no-zeebe-properties.js +18 -18
  38. package/rules/camunda-cloud/no-zeebe-user-task.js +27 -27
  39. package/rules/camunda-cloud/priority-definition.js +62 -0
  40. package/rules/camunda-cloud/secrets.js +119 -119
  41. package/rules/camunda-cloud/sequence-flow-condition.js +56 -56
  42. package/rules/camunda-cloud/signal-reference.js +64 -64
  43. package/rules/camunda-cloud/start-event-form.js +97 -97
  44. package/rules/camunda-cloud/subscription.js +65 -65
  45. package/rules/camunda-cloud/task-schedule.js +67 -67
  46. package/rules/camunda-cloud/timer/config.js +46 -46
  47. package/rules/camunda-cloud/timer/index.js +183 -183
  48. package/rules/camunda-cloud/user-task-definition.js +24 -24
  49. package/rules/camunda-cloud/user-task-form.js +142 -142
  50. package/rules/camunda-cloud/wait-for-completion.js +46 -46
  51. package/rules/camunda-platform/history-time-to-live.js +19 -19
  52. package/rules/utils/cron.js +95 -95
  53. package/rules/utils/element.js +533 -533
  54. package/rules/utils/error-types.js +25 -25
  55. package/rules/utils/iso8601.js +52 -52
  56. package/rules/utils/reporter.js +37 -37
  57. package/rules/utils/rule.js +46 -46
  58. package/rules/utils/version.js +4 -4
@@ -1,41 +1,41 @@
1
- const { is } = require('bpmnlint-utils');
2
-
3
- const { reportErrors } = require('../utils/reporter');
4
-
5
- const { ERROR_TYPES } = require('../utils/element');
6
-
7
- const { skipInNonExecutableProcess } = require('../utils/rule');
8
-
9
- module.exports = skipInNonExecutableProcess(function() {
10
- function check(node, reporter) {
11
- if (!is(node, 'bpmn:Process')) {
12
- return;
13
- }
14
-
15
- const flowElements = node.get('flowElements') || [];
16
-
17
- const noneStartEvents = flowElements.filter(flowElement => {
18
- return is(flowElement, 'bpmn:StartEvent') && !flowElement.get('eventDefinitions').length;
19
- });
20
-
21
- if (noneStartEvents.length <= 1) {
22
- return;
23
- }
24
-
25
- noneStartEvents.forEach(startEvent => {
26
- reportErrors(startEvent, reporter, {
27
- message: 'Multiple elements of type <bpmn:StartEvent> with no event definition not allowed as children of <bpmn:Process>',
28
- path: null,
29
- data: {
30
- type: ERROR_TYPES.ELEMENT_MULTIPLE_NOT_ALLOWED,
31
- node: startEvent,
32
- parent: null
33
- }
34
- });
35
- });
36
- }
37
-
38
- return {
39
- check
40
- };
41
- });
1
+ const { is } = require('bpmnlint-utils');
2
+
3
+ const { reportErrors } = require('../utils/reporter');
4
+
5
+ const { ERROR_TYPES } = require('../utils/element');
6
+
7
+ const { skipInNonExecutableProcess } = require('../utils/rule');
8
+
9
+ module.exports = skipInNonExecutableProcess(function() {
10
+ function check(node, reporter) {
11
+ if (!is(node, 'bpmn:Process')) {
12
+ return;
13
+ }
14
+
15
+ const flowElements = node.get('flowElements') || [];
16
+
17
+ const noneStartEvents = flowElements.filter(flowElement => {
18
+ return is(flowElement, 'bpmn:StartEvent') && !flowElement.get('eventDefinitions').length;
19
+ });
20
+
21
+ if (noneStartEvents.length <= 1) {
22
+ return;
23
+ }
24
+
25
+ noneStartEvents.forEach(startEvent => {
26
+ reportErrors(startEvent, reporter, {
27
+ message: 'Multiple elements of type <bpmn:StartEvent> with no event definition not allowed as children of <bpmn:Process>',
28
+ path: null,
29
+ data: {
30
+ type: ERROR_TYPES.ELEMENT_MULTIPLE_NOT_ALLOWED,
31
+ node: startEvent,
32
+ parent: null
33
+ }
34
+ });
35
+ });
36
+ }
37
+
38
+ return {
39
+ check
40
+ };
41
+ });
@@ -0,0 +1,19 @@
1
+ const { hasNoExtensionElement } = require('../utils/element');
2
+
3
+ const { reportErrors } = require('../utils/reporter');
4
+
5
+ const { skipInNonExecutableProcess } = require('../utils/rule');
6
+
7
+ module.exports = skipInNonExecutableProcess(function() {
8
+ function check(node, reporter) {
9
+ const errors = hasNoExtensionElement(node, 'zeebe:PriorityDefinition', node, '8.6');
10
+
11
+ if (errors && errors.length) {
12
+ reportErrors(node, reporter, errors);
13
+ }
14
+ }
15
+
16
+ return {
17
+ check
18
+ };
19
+ });
@@ -1,45 +1,45 @@
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:CallActivity')) {
15
- return;
16
- }
17
-
18
- const calledElement = findExtensionElement(node, 'zeebe:CalledElement');
19
-
20
- if (!calledElement) {
21
- return;
22
- }
23
-
24
- const errors = hasProperties(calledElement, {
25
- propagateAllParentVariables: {
26
- allowed: function(value) {
27
-
28
- // `propergateAllParentVariables` is not recognized by Camunda 8.1 and older
29
- // setting it to `true` is therefore allowed for all versions
30
- // setting it to `false` is only allowed for Camunda 8.2 and newer
31
- return value;
32
- },
33
- allowedVersion: '8.2'
34
- }
35
- }, node);
36
-
37
- if (errors && errors.length) {
38
- reportErrors(node, reporter, errors);
39
- }
40
- }
41
-
42
- return {
43
- check
44
- };
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:CallActivity')) {
15
+ return;
16
+ }
17
+
18
+ const calledElement = findExtensionElement(node, 'zeebe:CalledElement');
19
+
20
+ if (!calledElement) {
21
+ return;
22
+ }
23
+
24
+ const errors = hasProperties(calledElement, {
25
+ propagateAllParentVariables: {
26
+ allowed: function(value) {
27
+
28
+ // `propergateAllParentVariables` is not recognized by Camunda 8.1 and older
29
+ // setting it to `true` is therefore allowed for all versions
30
+ // setting it to `false` is only allowed for Camunda 8.2 and newer
31
+ return value;
32
+ },
33
+ allowedVersion: '8.2'
34
+ }
35
+ }, node);
36
+
37
+ if (errors && errors.length) {
38
+ reportErrors(node, reporter, errors);
39
+ }
40
+ }
41
+
42
+ return {
43
+ check
44
+ };
45
45
  });
@@ -1,46 +1,46 @@
1
- const { is } = require('bpmnlint-utils');
2
-
3
- const { reportErrors } = require('../utils/reporter');
4
-
5
- const { getEventDefinition } = require('../utils/element');
6
-
7
- const { ERROR_TYPES } = require('../utils/error-types');
8
-
9
- const { skipInNonExecutableProcess } = require('../utils/rule');
10
-
11
- module.exports = skipInNonExecutableProcess(function() {
12
- function check(node, reporter) {
13
- if (!is(node, 'bpmn:StartEvent')) {
14
- return;
15
- }
16
-
17
- const eventDefinition = getEventDefinition(node);
18
-
19
- if (!eventDefinition || !is(eventDefinition, 'bpmn:SignalEventDefinition')) {
20
- return;
21
- }
22
-
23
- const { $parent: parent } = node;
24
-
25
- if (parent && is(parent, 'bpmn:SubProcess')) {
26
- const error = {
27
- message: 'Element of type <bpmn:StartEvent> with event definition of type <bpmn:SignalEventDefinition> not allowed as child of <bpmn:SubProcess>',
28
- path: null,
29
- data: {
30
- type: ERROR_TYPES.CHILD_ELEMENT_TYPE_NOT_ALLOWED,
31
- node,
32
- parentNode: null,
33
- eventDefinition,
34
- parent,
35
- allowedVersion: '8.3'
36
- }
37
- };
38
-
39
- reportErrors(node, reporter, error);
40
- }
41
- }
42
-
43
- return {
44
- check
45
- };
1
+ const { is } = require('bpmnlint-utils');
2
+
3
+ const { reportErrors } = require('../utils/reporter');
4
+
5
+ const { getEventDefinition } = require('../utils/element');
6
+
7
+ const { ERROR_TYPES } = require('../utils/error-types');
8
+
9
+ const { skipInNonExecutableProcess } = require('../utils/rule');
10
+
11
+ module.exports = skipInNonExecutableProcess(function() {
12
+ function check(node, reporter) {
13
+ if (!is(node, 'bpmn:StartEvent')) {
14
+ return;
15
+ }
16
+
17
+ const eventDefinition = getEventDefinition(node);
18
+
19
+ if (!eventDefinition || !is(eventDefinition, 'bpmn:SignalEventDefinition')) {
20
+ return;
21
+ }
22
+
23
+ const { $parent: parent } = node;
24
+
25
+ if (parent && is(parent, 'bpmn:SubProcess')) {
26
+ const error = {
27
+ message: 'Element of type <bpmn:StartEvent> with event definition of type <bpmn:SignalEventDefinition> not allowed as child of <bpmn:SubProcess>',
28
+ path: null,
29
+ data: {
30
+ type: ERROR_TYPES.CHILD_ELEMENT_TYPE_NOT_ALLOWED,
31
+ node,
32
+ parentNode: null,
33
+ eventDefinition,
34
+ parent,
35
+ allowedVersion: '8.3'
36
+ }
37
+ };
38
+
39
+ reportErrors(node, reporter, error);
40
+ }
41
+ }
42
+
43
+ return {
44
+ check
45
+ };
46
46
  });
@@ -1,19 +1,19 @@
1
- const { hasNoExtensionElement } = require('../utils/element');
2
-
3
- const { reportErrors } = require('../utils/reporter');
4
-
5
- const { skipInNonExecutableProcess } = require('../utils/rule');
6
-
7
- module.exports = skipInNonExecutableProcess(function() {
8
- function check(node, reporter) {
9
- const errors = hasNoExtensionElement(node, 'zeebe:TaskSchedule', node, '8.2');
10
-
11
- if (errors && errors.length) {
12
- reportErrors(node, reporter, errors);
13
- }
14
- }
15
-
16
- return {
17
- check
18
- };
1
+ const { hasNoExtensionElement } = require('../utils/element');
2
+
3
+ const { reportErrors } = require('../utils/reporter');
4
+
5
+ const { skipInNonExecutableProcess } = require('../utils/rule');
6
+
7
+ module.exports = skipInNonExecutableProcess(function() {
8
+ function check(node, reporter) {
9
+ const errors = hasNoExtensionElement(node, 'zeebe:TaskSchedule', node, '8.2');
10
+
11
+ if (errors && errors.length) {
12
+ reportErrors(node, reporter, errors);
13
+ }
14
+ }
15
+
16
+ return {
17
+ check
18
+ };
19
19
  });
@@ -1,24 +1,24 @@
1
- const { hasProperties } = require('../utils/element');
2
-
3
- const { reportErrors } = require('../utils/reporter');
4
-
5
- const { skipInNonExecutableProcess } = require('../utils/rule');
6
-
7
- module.exports = skipInNonExecutableProcess(function() {
8
- function check(node, reporter) {
9
- const errors = hasProperties(node, {
10
- modelerTemplate: {
11
- allowed: false,
12
- allowedVersion: '8.0'
13
- }
14
- }, node);
15
-
16
- if (errors && errors.length) {
17
- reportErrors(node, reporter, errors);
18
- }
19
- }
20
-
21
- return {
22
- check
23
- };
1
+ const { hasProperties } = require('../utils/element');
2
+
3
+ const { reportErrors } = require('../utils/reporter');
4
+
5
+ const { skipInNonExecutableProcess } = require('../utils/rule');
6
+
7
+ module.exports = skipInNonExecutableProcess(function() {
8
+ function check(node, reporter) {
9
+ const errors = hasProperties(node, {
10
+ modelerTemplate: {
11
+ allowed: false,
12
+ allowedVersion: '8.0'
13
+ }
14
+ }, node);
15
+
16
+ if (errors && errors.length) {
17
+ reportErrors(node, reporter, errors);
18
+ }
19
+ }
20
+
21
+ return {
22
+ check
23
+ };
24
24
  });
@@ -1,19 +1,19 @@
1
- const { hasNoExtensionElement } = require('../utils/element');
2
-
3
- const { reportErrors } = require('../utils/reporter');
4
-
5
- const { skipInNonExecutableProcess } = require('../utils/rule');
6
-
7
- module.exports = skipInNonExecutableProcess(function() {
8
- function check(node, reporter) {
9
- const errors = hasNoExtensionElement(node, 'zeebe:Properties', node, '8.1');
10
-
11
- if (errors && errors.length) {
12
- reportErrors(node, reporter, errors);
13
- }
14
- }
15
-
16
- return {
17
- check
18
- };
1
+ const { hasNoExtensionElement } = require('../utils/element');
2
+
3
+ const { reportErrors } = require('../utils/reporter');
4
+
5
+ const { skipInNonExecutableProcess } = require('../utils/rule');
6
+
7
+ module.exports = skipInNonExecutableProcess(function() {
8
+ function check(node, reporter) {
9
+ const errors = hasNoExtensionElement(node, 'zeebe:Properties', node, '8.1');
10
+
11
+ if (errors && errors.length) {
12
+ reportErrors(node, reporter, errors);
13
+ }
14
+ }
15
+
16
+ return {
17
+ check
18
+ };
19
19
  });
@@ -1,27 +1,27 @@
1
- const { is } = require('bpmnlint-utils');
2
-
3
- const { reportErrors } = require('../utils/reporter');
4
-
5
- const { skipInNonExecutableProcess } = require('../utils/rule');
6
-
7
- const { hasNoExtensionElement } = require('../utils/element');
8
-
9
- const ALLOWED_VERSION = '8.5';
10
-
11
- module.exports = skipInNonExecutableProcess(function() {
12
- function check(node, reporter) {
13
- if (!is(node, 'bpmn:UserTask')) {
14
- return;
15
- }
16
-
17
- const errors = hasNoExtensionElement(node, 'zeebe:UserTask', node, ALLOWED_VERSION);
18
-
19
- if (errors && errors.length) {
20
- reportErrors(node, reporter, errors);
21
- }
22
- }
23
-
24
- return {
25
- check
26
- };
27
- });
1
+ const { is } = require('bpmnlint-utils');
2
+
3
+ const { reportErrors } = require('../utils/reporter');
4
+
5
+ const { skipInNonExecutableProcess } = require('../utils/rule');
6
+
7
+ const { hasNoExtensionElement } = require('../utils/element');
8
+
9
+ const ALLOWED_VERSION = '8.5';
10
+
11
+ module.exports = skipInNonExecutableProcess(function() {
12
+ function check(node, reporter) {
13
+ if (!is(node, 'bpmn:UserTask')) {
14
+ return;
15
+ }
16
+
17
+ const errors = hasNoExtensionElement(node, 'zeebe:UserTask', node, ALLOWED_VERSION);
18
+
19
+ if (errors && errors.length) {
20
+ reportErrors(node, reporter, errors);
21
+ }
22
+ }
23
+
24
+ return {
25
+ check
26
+ };
27
+ });
@@ -0,0 +1,62 @@
1
+ const { is } = require('bpmnlint-utils');
2
+ const { isDefined } = require('min-dash');
3
+
4
+ const {
5
+ findExtensionElement,
6
+ hasExpression
7
+ } = require('../utils/element');
8
+
9
+ const { reportErrors } = require('../utils/reporter');
10
+
11
+ const { skipInNonExecutableProcess } = require('../utils/rule');
12
+
13
+ module.exports = skipInNonExecutableProcess(function() {
14
+ function check(node, reporter) {
15
+ if (!is(node, 'bpmn:UserTask')) {
16
+ return;
17
+ }
18
+
19
+ const priorityDefinition = findExtensionElement(node, 'zeebe:PriorityDefinition');
20
+
21
+ if (!priorityDefinition) {
22
+ return;
23
+ }
24
+
25
+ const priority = priorityDefinition.get('priority');
26
+
27
+ let errors = [];
28
+
29
+ if (isDefined(priority)) {
30
+ errors = [
31
+ ...errors,
32
+ ...hasExpression(priorityDefinition, 'priority', {
33
+ allowed: value => isValidPriority(value)
34
+ }, node)
35
+ ];
36
+ }
37
+
38
+ if (errors.length) {
39
+ reportErrors(node, reporter, errors);
40
+ }
41
+ }
42
+
43
+ return {
44
+ check
45
+ };
46
+ });
47
+
48
+ function isValidPriority(value) {
49
+ return isExpression(value) || isIntegerStringBetween(value, 0, 100);
50
+ }
51
+
52
+ function isExpression(value) {
53
+ return value.startsWith('=');
54
+ }
55
+
56
+ function isIntegerStringBetween(value, min, max) {
57
+ if (/^\d+$/.test(value)) {
58
+ const number = parseInt(value, 10);
59
+ return number >= min && number <= max;
60
+ }
61
+ return false;
62
+ }