bpmnlint-plugin-camunda-compat 2.20.2 → 2.21.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 (52) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +39 -39
  3. package/index.js +224 -223
  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-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/feel.js +82 -82
  18. package/rules/camunda-cloud/implementation/config.js +16 -16
  19. package/rules/camunda-cloud/implementation/index.js +218 -218
  20. package/rules/camunda-cloud/inclusive-gateway.js +35 -35
  21. package/rules/camunda-cloud/link-event.js +142 -142
  22. package/rules/camunda-cloud/loop-characteristics.js +66 -66
  23. package/rules/camunda-cloud/message-reference.js +60 -60
  24. package/rules/camunda-cloud/no-candidate-users.js +38 -38
  25. package/rules/camunda-cloud/no-expression.js +173 -173
  26. package/rules/camunda-cloud/no-loop.js +316 -145
  27. package/rules/camunda-cloud/no-multiple-none-start-events.js +41 -41
  28. package/rules/camunda-cloud/no-propagate-all-parent-variables.js +44 -44
  29. package/rules/camunda-cloud/no-signal-event-sub-process.js +45 -45
  30. package/rules/camunda-cloud/no-task-schedule.js +18 -18
  31. package/rules/camunda-cloud/no-template.js +23 -23
  32. package/rules/camunda-cloud/no-zeebe-properties.js +18 -18
  33. package/rules/camunda-cloud/no-zeebe-user-task.js +27 -27
  34. package/rules/camunda-cloud/secrets.js +119 -119
  35. package/rules/camunda-cloud/sequence-flow-condition.js +56 -56
  36. package/rules/camunda-cloud/signal-reference.js +64 -64
  37. package/rules/camunda-cloud/start-event-form.js +97 -97
  38. package/rules/camunda-cloud/subscription.js +65 -65
  39. package/rules/camunda-cloud/task-schedule.js +67 -67
  40. package/rules/camunda-cloud/timer/config.js +46 -46
  41. package/rules/camunda-cloud/timer/index.js +183 -183
  42. package/rules/camunda-cloud/user-task-definition.js +24 -24
  43. package/rules/camunda-cloud/user-task-form.js +142 -142
  44. package/rules/camunda-cloud/wait-for-completion.js +46 -46
  45. package/rules/camunda-platform/history-time-to-live.js +19 -19
  46. package/rules/utils/cron.js +95 -95
  47. package/rules/utils/element.js +484 -484
  48. package/rules/utils/error-types.js +24 -24
  49. package/rules/utils/iso8601.js +52 -52
  50. package/rules/utils/reporter.js +37 -37
  51. package/rules/utils/rule.js +46 -46
  52. package/rules/utils/version.js +4 -4
@@ -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
+ });
@@ -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
  });