bpmnlint-plugin-camunda-compat 2.25.0 → 2.26.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 (60) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +39 -39
  3. package/index.js +247 -245
  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 +18 -18
  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-version-tag.js +24 -49
  38. package/rules/camunda-cloud/no-zeebe-properties.js +18 -18
  39. package/rules/camunda-cloud/no-zeebe-user-task.js +27 -27
  40. package/rules/camunda-cloud/priority-definition.js +61 -61
  41. package/rules/camunda-cloud/secrets.js +119 -119
  42. package/rules/camunda-cloud/sequence-flow-condition.js +56 -56
  43. package/rules/camunda-cloud/signal-reference.js +64 -64
  44. package/rules/camunda-cloud/start-event-form.js +97 -97
  45. package/rules/camunda-cloud/subscription.js +65 -65
  46. package/rules/camunda-cloud/task-schedule.js +67 -67
  47. package/rules/camunda-cloud/timer/config.js +46 -46
  48. package/rules/camunda-cloud/timer/index.js +183 -183
  49. package/rules/camunda-cloud/user-task-definition.js +24 -24
  50. package/rules/camunda-cloud/user-task-form.js +142 -142
  51. package/rules/camunda-cloud/version-tag.js +58 -0
  52. package/rules/camunda-cloud/wait-for-completion.js +46 -46
  53. package/rules/camunda-platform/history-time-to-live.js +19 -19
  54. package/rules/utils/cron.js +95 -95
  55. package/rules/utils/element.js +533 -533
  56. package/rules/utils/error-types.js +25 -25
  57. package/rules/utils/iso8601.js +52 -52
  58. package/rules/utils/reporter.js +37 -37
  59. package/rules/utils/rule.js +46 -46
  60. package/rules/utils/version.js +4 -4
@@ -1,62 +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;
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
62
  }
@@ -1,119 +1,119 @@
1
- const { isString } = require('min-dash');
2
-
3
- const { is } = require('bpmnlint-utils');
4
-
5
- const { getPath } = require('@bpmn-io/moddle-utils');
6
-
7
- const {
8
- findExtensionElement,
9
- getEventDefinition
10
- } = require('../utils/element');
11
-
12
- const { ERROR_TYPES } = require('../utils/error-types');
13
-
14
- const { reportErrors } = require('../utils/reporter');
15
-
16
- const { skipInNonExecutableProcess } = require('../utils/rule');
17
-
18
- module.exports = skipInNonExecutableProcess(function() {
19
- function check(node, reporter) {
20
- const errors = [
21
- validateIoMapping,
22
- validateProperties,
23
- validateSubscription
24
- ].reduce((errors, validationFunction) => {
25
- return [
26
- ...errors,
27
- ...validationFunction(node)
28
- ];
29
- }, []);
30
-
31
- if (errors.length) {
32
- reportErrors(node, reporter, errors);
33
- }
34
- }
35
-
36
- return {
37
- check
38
- };
39
- });
40
-
41
- function validateIoMapping(node) {
42
- const ioMapping = findExtensionElement(node, 'zeebe:IoMapping');
43
-
44
- if (!ioMapping) {
45
- return [];
46
- }
47
-
48
- return ioMapping.get('inputParameters')
49
- .filter(inputParameter => !isValidSecret(inputParameter.get('source')))
50
- .map(inputParameter => getReport('source', inputParameter, node));
51
- }
52
-
53
- function validateProperties(node) {
54
- const properties = findExtensionElement(node, 'zeebe:Properties');
55
-
56
- if (!properties) {
57
- return [];
58
- }
59
-
60
- return (properties.get('properties'))
61
- .filter(property => !isValidSecret(property.get('value')))
62
- .map(property => getReport('value', property, node));
63
- }
64
-
65
- function validateSubscription(node) {
66
- let message;
67
-
68
- if (is(node, 'bpmn:ReceiveTask')) {
69
- message = node.get('messageRef');
70
- } else {
71
- const messageEventDefinition = getEventDefinition(node, 'bpmn:MessageEventDefinition');
72
-
73
- if (!messageEventDefinition) {
74
- return [];
75
- }
76
-
77
- message = messageEventDefinition.get('messageRef');
78
- }
79
-
80
- if (!message) {
81
- return [];
82
- }
83
-
84
- const subscription = findExtensionElement(message, 'zeebe:Subscription');
85
-
86
- if (!subscription) {
87
- return [];
88
- }
89
-
90
- const correlationKey = subscription.get('correlationKey');
91
-
92
- return isValidSecret(correlationKey)
93
- ? []
94
- : [ getReport('correlationKey', subscription, node) ];
95
- }
96
-
97
- function getReport(propertyName, node, parentNode) {
98
- const path = getPath(node, parentNode);
99
-
100
- return {
101
- message: `Property <${ propertyName }> uses deprecated secret expression format`,
102
- path: path
103
- ? [ ...getPath(node, parentNode), propertyName ]
104
- : [ propertyName ],
105
- data: {
106
- type: ERROR_TYPES.SECRET_EXPRESSION_FORMAT_DEPRECATED,
107
- node,
108
- parentNode: parentNode,
109
- property: propertyName
110
- }
111
- };
112
- }
113
-
114
- function isValidSecret(value) {
115
- return !value
116
- || !isString(value)
117
- || !value.includes('secrets.')
118
- || /{{\s*secrets\.[\w-]+\s*}}/.test(value);
119
- }
1
+ const { isString } = require('min-dash');
2
+
3
+ const { is } = require('bpmnlint-utils');
4
+
5
+ const { getPath } = require('@bpmn-io/moddle-utils');
6
+
7
+ const {
8
+ findExtensionElement,
9
+ getEventDefinition
10
+ } = require('../utils/element');
11
+
12
+ const { ERROR_TYPES } = require('../utils/error-types');
13
+
14
+ const { reportErrors } = require('../utils/reporter');
15
+
16
+ const { skipInNonExecutableProcess } = require('../utils/rule');
17
+
18
+ module.exports = skipInNonExecutableProcess(function() {
19
+ function check(node, reporter) {
20
+ const errors = [
21
+ validateIoMapping,
22
+ validateProperties,
23
+ validateSubscription
24
+ ].reduce((errors, validationFunction) => {
25
+ return [
26
+ ...errors,
27
+ ...validationFunction(node)
28
+ ];
29
+ }, []);
30
+
31
+ if (errors.length) {
32
+ reportErrors(node, reporter, errors);
33
+ }
34
+ }
35
+
36
+ return {
37
+ check
38
+ };
39
+ });
40
+
41
+ function validateIoMapping(node) {
42
+ const ioMapping = findExtensionElement(node, 'zeebe:IoMapping');
43
+
44
+ if (!ioMapping) {
45
+ return [];
46
+ }
47
+
48
+ return ioMapping.get('inputParameters')
49
+ .filter(inputParameter => !isValidSecret(inputParameter.get('source')))
50
+ .map(inputParameter => getReport('source', inputParameter, node));
51
+ }
52
+
53
+ function validateProperties(node) {
54
+ const properties = findExtensionElement(node, 'zeebe:Properties');
55
+
56
+ if (!properties) {
57
+ return [];
58
+ }
59
+
60
+ return (properties.get('properties'))
61
+ .filter(property => !isValidSecret(property.get('value')))
62
+ .map(property => getReport('value', property, node));
63
+ }
64
+
65
+ function validateSubscription(node) {
66
+ let message;
67
+
68
+ if (is(node, 'bpmn:ReceiveTask')) {
69
+ message = node.get('messageRef');
70
+ } else {
71
+ const messageEventDefinition = getEventDefinition(node, 'bpmn:MessageEventDefinition');
72
+
73
+ if (!messageEventDefinition) {
74
+ return [];
75
+ }
76
+
77
+ message = messageEventDefinition.get('messageRef');
78
+ }
79
+
80
+ if (!message) {
81
+ return [];
82
+ }
83
+
84
+ const subscription = findExtensionElement(message, 'zeebe:Subscription');
85
+
86
+ if (!subscription) {
87
+ return [];
88
+ }
89
+
90
+ const correlationKey = subscription.get('correlationKey');
91
+
92
+ return isValidSecret(correlationKey)
93
+ ? []
94
+ : [ getReport('correlationKey', subscription, node) ];
95
+ }
96
+
97
+ function getReport(propertyName, node, parentNode) {
98
+ const path = getPath(node, parentNode);
99
+
100
+ return {
101
+ message: `Property <${ propertyName }> uses deprecated secret expression format`,
102
+ path: path
103
+ ? [ ...getPath(node, parentNode), propertyName ]
104
+ : [ propertyName ],
105
+ data: {
106
+ type: ERROR_TYPES.SECRET_EXPRESSION_FORMAT_DEPRECATED,
107
+ node,
108
+ parentNode: parentNode,
109
+ property: propertyName
110
+ }
111
+ };
112
+ }
113
+
114
+ function isValidSecret(value) {
115
+ return !value
116
+ || !isString(value)
117
+ || !value.includes('secrets.')
118
+ || /{{\s*secrets\.[\w-]+\s*}}/.test(value);
119
+ }
@@ -1,57 +1,57 @@
1
- const {
2
- is,
3
- isAny
4
- } = require('bpmnlint-utils');
5
-
6
- const {
7
- ERROR_TYPES,
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:ExclusiveGateway', 'bpmn:InclusiveGateway' ])) {
18
- const outgoing = node.get('outgoing');
19
-
20
- if (outgoing && outgoing.length > 1) {
21
- for (let sequenceFlow of outgoing) {
22
- if (node.get('default') !== sequenceFlow) {
23
- const errors = hasProperties(sequenceFlow, {
24
- conditionExpression: {
25
- required: true
26
- }
27
- }, sequenceFlow);
28
-
29
- if (errors.length) {
30
- reportErrors(sequenceFlow, reporter, errors);
31
- }
32
- }
33
- }
34
- }
35
- } else if (is(node, 'bpmn:SequenceFlow')) {
36
- const source = node.get('sourceRef'),
37
- conditionExpression = node.get('conditionExpression');
38
-
39
- if (!isAny(source, [ 'bpmn:ExclusiveGateway', 'bpmn:InclusiveGateway' ]) && conditionExpression) {
40
- reportErrors(node, reporter, {
41
- message: 'Property <conditionExpression> only allowed if source is of type <bpmn:ExclusiveGateway> or <bpmn:InclusiveGateway>',
42
- path: [ 'conditionExpression' ],
43
- data: {
44
- type: ERROR_TYPES.PROPERTY_NOT_ALLOWED,
45
- node: node,
46
- parentNode: null,
47
- property: 'conditionExpression'
48
- }
49
- });
50
- }
51
- }
52
- }
53
-
54
- return {
55
- check
56
- };
1
+ const {
2
+ is,
3
+ isAny
4
+ } = require('bpmnlint-utils');
5
+
6
+ const {
7
+ ERROR_TYPES,
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:ExclusiveGateway', 'bpmn:InclusiveGateway' ])) {
18
+ const outgoing = node.get('outgoing');
19
+
20
+ if (outgoing && outgoing.length > 1) {
21
+ for (let sequenceFlow of outgoing) {
22
+ if (node.get('default') !== sequenceFlow) {
23
+ const errors = hasProperties(sequenceFlow, {
24
+ conditionExpression: {
25
+ required: true
26
+ }
27
+ }, sequenceFlow);
28
+
29
+ if (errors.length) {
30
+ reportErrors(sequenceFlow, reporter, errors);
31
+ }
32
+ }
33
+ }
34
+ }
35
+ } else if (is(node, 'bpmn:SequenceFlow')) {
36
+ const source = node.get('sourceRef'),
37
+ conditionExpression = node.get('conditionExpression');
38
+
39
+ if (!isAny(source, [ 'bpmn:ExclusiveGateway', 'bpmn:InclusiveGateway' ]) && conditionExpression) {
40
+ reportErrors(node, reporter, {
41
+ message: 'Property <conditionExpression> only allowed if source is of type <bpmn:ExclusiveGateway> or <bpmn:InclusiveGateway>',
42
+ path: [ 'conditionExpression' ],
43
+ data: {
44
+ type: ERROR_TYPES.PROPERTY_NOT_ALLOWED,
45
+ node: node,
46
+ parentNode: null,
47
+ property: 'conditionExpression'
48
+ }
49
+ });
50
+ }
51
+ }
52
+ }
53
+
54
+ return {
55
+ check
56
+ };
57
57
  });
@@ -1,65 +1,65 @@
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, [
18
- 'bpmn:StartEvent',
19
- 'bpmn:IntermediateThrowEvent',
20
- 'bpmn:IntermediateCatchEvent',
21
- 'bpmn:EndEvent',
22
- 'bpmn:BoundaryEvent'
23
- ])) {
24
- return;
25
- }
26
-
27
- const eventDefinition = getEventDefinition(node);
28
-
29
- if (!eventDefinition || !is(eventDefinition, 'bpmn:SignalEventDefinition')) {
30
- return;
31
- }
32
-
33
- let errors = hasProperties(eventDefinition, {
34
- signalRef: {
35
- required: true
36
- }
37
- }, node);
38
-
39
- if (errors.length) {
40
- reportErrors(node, reporter, errors);
41
-
42
- return;
43
- }
44
-
45
- const signalRef = eventDefinition.get('signalRef');
46
-
47
- if (!signalRef) {
48
- return;
49
- }
50
-
51
- errors = hasProperties(signalRef, {
52
- name: {
53
- required: true
54
- }
55
- }, node);
56
-
57
- if (errors.length) {
58
- reportErrors(node, reporter, errors);
59
- }
60
- }
61
-
62
- return {
63
- check
64
- };
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, [
18
+ 'bpmn:StartEvent',
19
+ 'bpmn:IntermediateThrowEvent',
20
+ 'bpmn:IntermediateCatchEvent',
21
+ 'bpmn:EndEvent',
22
+ 'bpmn:BoundaryEvent'
23
+ ])) {
24
+ return;
25
+ }
26
+
27
+ const eventDefinition = getEventDefinition(node);
28
+
29
+ if (!eventDefinition || !is(eventDefinition, 'bpmn:SignalEventDefinition')) {
30
+ return;
31
+ }
32
+
33
+ let errors = hasProperties(eventDefinition, {
34
+ signalRef: {
35
+ required: true
36
+ }
37
+ }, node);
38
+
39
+ if (errors.length) {
40
+ reportErrors(node, reporter, errors);
41
+
42
+ return;
43
+ }
44
+
45
+ const signalRef = eventDefinition.get('signalRef');
46
+
47
+ if (!signalRef) {
48
+ return;
49
+ }
50
+
51
+ errors = hasProperties(signalRef, {
52
+ name: {
53
+ required: true
54
+ }
55
+ }, node);
56
+
57
+ if (errors.length) {
58
+ reportErrors(node, reporter, errors);
59
+ }
60
+ }
61
+
62
+ return {
63
+ check
64
+ };
65
65
  });