bpmnlint-plugin-camunda-compat 2.17.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 -205
  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 -63
  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 -0
  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,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
  });
@@ -1,98 +1,98 @@
1
- const { is } = require('bpmnlint-utils');
2
-
3
- const {
4
- findExtensionElement,
5
- findExtensionElements,
6
- findParent,
7
- hasProperties,
8
- hasProperty
9
- } = require('../utils/element');
10
-
11
- const { hasNoExtensionElement } = require('../utils/element');
12
-
13
- const { reportErrors } = require('../utils/reporter');
14
-
15
- const { skipInNonExecutableProcess } = require('../utils/rule');
16
-
17
- const { greaterOrEqual } = require('../utils/version');
18
-
19
- const allowedVersion = '8.3';
20
-
21
- module.exports = skipInNonExecutableProcess(function({ version }) {
22
- function check(node, reporter) {
23
- if (!is(node, 'bpmn:StartEvent')) {
24
- return;
25
- }
26
-
27
- // Camunda 8.2 and older
28
- if (!greaterOrEqual(version, allowedVersion)) {
29
- let errors = hasNoExtensionElement(node, 'zeebe:FormDefinition', node, allowedVersion);
30
-
31
- if (errors.length) {
32
- reportErrors(node, reporter, errors);
33
- }
34
-
35
- return;
36
- }
37
-
38
- // Camunda 8.3 and newer
39
- const formDefinition = findExtensionElement(node, 'zeebe:FormDefinition');
40
-
41
- if (!formDefinition) {
42
- return;
43
- }
44
-
45
- let errors = hasProperty(formDefinition, [
46
- 'formKey',
47
- 'formId'
48
- ], node);
49
-
50
- if (errors.length) {
51
- reportErrors(node, reporter, errors);
52
-
53
- return;
54
- }
55
-
56
- const formKey = formDefinition.get('formKey');
57
-
58
- const userTaskForm = findUserTaskForm(node, formKey);
59
-
60
- if (!userTaskForm) {
61
- return;
62
- }
63
-
64
- errors = hasProperties(userTaskForm, {
65
- body: {
66
- required: true
67
- }
68
- }, node);
69
-
70
- if (errors.length) {
71
- reportErrors(node, reporter, errors);
72
- }
73
- }
74
-
75
- return {
76
- check
77
- };
78
- });
79
-
80
- // helpers //////////
81
-
82
- function findUserTaskForm(node, formKey) {
83
- const process = findParent(node, 'bpmn:Process');
84
-
85
- if (!process) {
86
- return;
87
- }
88
-
89
- const userTaskForms = findExtensionElements(process, 'zeebe:UserTaskForm');
90
-
91
- if (userTaskForms && userTaskForms.length) {
92
- return userTaskForms.find(userTaskForm => {
93
- const id = userTaskForm.get('id');
94
-
95
- return `camunda-forms:bpmn:${ id }` === formKey;
96
- });
97
- }
1
+ const { is } = require('bpmnlint-utils');
2
+
3
+ const {
4
+ findExtensionElement,
5
+ findExtensionElements,
6
+ findParent,
7
+ hasProperties,
8
+ hasProperty
9
+ } = require('../utils/element');
10
+
11
+ const { hasNoExtensionElement } = require('../utils/element');
12
+
13
+ const { reportErrors } = require('../utils/reporter');
14
+
15
+ const { skipInNonExecutableProcess } = require('../utils/rule');
16
+
17
+ const { greaterOrEqual } = require('../utils/version');
18
+
19
+ const allowedVersion = '8.3';
20
+
21
+ module.exports = skipInNonExecutableProcess(function({ version }) {
22
+ function check(node, reporter) {
23
+ if (!is(node, 'bpmn:StartEvent')) {
24
+ return;
25
+ }
26
+
27
+ // Camunda 8.2 and older
28
+ if (!greaterOrEqual(version, allowedVersion)) {
29
+ let errors = hasNoExtensionElement(node, 'zeebe:FormDefinition', node, allowedVersion);
30
+
31
+ if (errors.length) {
32
+ reportErrors(node, reporter, errors);
33
+ }
34
+
35
+ return;
36
+ }
37
+
38
+ // Camunda 8.3 and newer
39
+ const formDefinition = findExtensionElement(node, 'zeebe:FormDefinition');
40
+
41
+ if (!formDefinition) {
42
+ return;
43
+ }
44
+
45
+ let errors = hasProperty(formDefinition, [
46
+ 'formKey',
47
+ 'formId'
48
+ ], node);
49
+
50
+ if (errors.length) {
51
+ reportErrors(node, reporter, errors);
52
+
53
+ return;
54
+ }
55
+
56
+ const formKey = formDefinition.get('formKey');
57
+
58
+ const userTaskForm = findUserTaskForm(node, formKey);
59
+
60
+ if (!userTaskForm) {
61
+ return;
62
+ }
63
+
64
+ errors = hasProperties(userTaskForm, {
65
+ body: {
66
+ required: true
67
+ }
68
+ }, node);
69
+
70
+ if (errors.length) {
71
+ reportErrors(node, reporter, errors);
72
+ }
73
+ }
74
+
75
+ return {
76
+ check
77
+ };
78
+ });
79
+
80
+ // helpers //////////
81
+
82
+ function findUserTaskForm(node, formKey) {
83
+ const process = findParent(node, 'bpmn:Process');
84
+
85
+ if (!process) {
86
+ return;
87
+ }
88
+
89
+ const userTaskForms = findExtensionElements(process, 'zeebe:UserTaskForm');
90
+
91
+ if (userTaskForms && userTaskForms.length) {
92
+ return userTaskForms.find(userTaskForm => {
93
+ const id = userTaskForm.get('id');
94
+
95
+ return `camunda-forms:bpmn:${ id }` === formKey;
96
+ });
97
+ }
98
98
  }