bpmnlint-plugin-camunda-compat 2.26.0 → 2.26.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 (57) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +39 -39
  3. package/package.json +1 -1
  4. package/rules/camunda-cloud/called-element.js +42 -42
  5. package/rules/camunda-cloud/collapsed-subprocess.js +40 -40
  6. package/rules/camunda-cloud/connector-properties/config.js +90 -90
  7. package/rules/camunda-cloud/connector-properties/index.js +47 -47
  8. package/rules/camunda-cloud/duplicate-execution-listeners.js +33 -33
  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/execution-listener.js +34 -34
  18. package/rules/camunda-cloud/feel.js +85 -82
  19. package/rules/camunda-cloud/implementation/config.js +16 -16
  20. package/rules/camunda-cloud/implementation/index.js +218 -218
  21. package/rules/camunda-cloud/inclusive-gateway.js +35 -35
  22. package/rules/camunda-cloud/link-event.js +142 -142
  23. package/rules/camunda-cloud/loop-characteristics.js +66 -66
  24. package/rules/camunda-cloud/message-reference.js +60 -60
  25. package/rules/camunda-cloud/no-binding-type.js +43 -43
  26. package/rules/camunda-cloud/no-candidate-users.js +38 -38
  27. package/rules/camunda-cloud/no-execution-listeners.js +21 -21
  28. package/rules/camunda-cloud/no-expression.js +173 -173
  29. package/rules/camunda-cloud/no-loop.js +316 -316
  30. package/rules/camunda-cloud/no-multiple-none-start-events.js +41 -41
  31. package/rules/camunda-cloud/no-priority-definition.js +18 -18
  32. package/rules/camunda-cloud/no-propagate-all-parent-variables.js +44 -44
  33. package/rules/camunda-cloud/no-signal-event-sub-process.js +45 -45
  34. package/rules/camunda-cloud/no-task-schedule.js +18 -18
  35. package/rules/camunda-cloud/no-template.js +23 -23
  36. package/rules/camunda-cloud/no-zeebe-properties.js +18 -18
  37. package/rules/camunda-cloud/no-zeebe-user-task.js +27 -27
  38. package/rules/camunda-cloud/priority-definition.js +61 -61
  39. package/rules/camunda-cloud/secrets.js +119 -119
  40. package/rules/camunda-cloud/sequence-flow-condition.js +56 -56
  41. package/rules/camunda-cloud/signal-reference.js +64 -64
  42. package/rules/camunda-cloud/start-event-form.js +97 -97
  43. package/rules/camunda-cloud/subscription.js +65 -65
  44. package/rules/camunda-cloud/task-schedule.js +67 -67
  45. package/rules/camunda-cloud/timer/config.js +46 -46
  46. package/rules/camunda-cloud/timer/index.js +183 -183
  47. package/rules/camunda-cloud/user-task-definition.js +24 -24
  48. package/rules/camunda-cloud/user-task-form.js +142 -142
  49. package/rules/camunda-cloud/wait-for-completion.js +46 -46
  50. package/rules/camunda-platform/history-time-to-live.js +19 -19
  51. package/rules/utils/cron.js +95 -95
  52. package/rules/utils/element.js +533 -533
  53. package/rules/utils/error-types.js +25 -25
  54. package/rules/utils/iso8601.js +52 -52
  55. package/rules/utils/reporter.js +37 -37
  56. package/rules/utils/rule.js +46 -46
  57. package/rules/utils/version.js +4 -4
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2021-present bpmn.io Contributors
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021-present bpmn.io Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
21
  THE SOFTWARE.
package/README.md CHANGED
@@ -1,39 +1,39 @@
1
- # bpmnlint-plugin-camunda-compat
2
-
3
- [![CI](https://github.com/camunda/bpmnlint-plugin-camunda-compat/workflows/CI/badge.svg)](https://github.com/camunda/bpmnlint-plugin-camunda-compat/actions?query=workflow%3ACI)
4
-
5
- A [bpmnlint](https://github.com/bpmn-io/bpmnlint) plug-in that checks whether a given BPMN process can be executed with [Camunda](https://camunda.com/).
6
-
7
-
8
- ## Usage
9
-
10
- Add configuration corresponding to your execution platform and version to your [`.bpmnlintrc` configuration](https://github.com/bpmn-io/bpmnlint#configuration):
11
-
12
- ```json
13
- {
14
- "extends": [
15
- "bpmnlint:recommended",
16
- "plugin:camunda-compat/camunda-cloud-8-0"
17
- ],
18
- "rules": {
19
- "camunda-compat/timer": "off"
20
- }
21
- }
22
- ```
23
-
24
- Use [`@camunda/linting`](https://github.com/camunda/linting) to configure the linter dynamically based on the [execution platform and version](https://github.com/camunda/modeler-moddle).
25
-
26
-
27
- ## Resources
28
-
29
- * [Issues](https://github.com/camunda/bpmnlint-plugin-camunda-compat/issues)
30
-
31
-
32
- ## Related
33
-
34
- * BPMN coverage for [Camunda 8](https://docs.camunda.io/docs/reference/bpmn-processes/bpmn-coverage/) and [Camunda 7](https://docs.camunda.org/manual/latest/reference/bpmn20/)
35
-
36
-
37
- ## License
38
-
39
- MIT
1
+ # bpmnlint-plugin-camunda-compat
2
+
3
+ [![CI](https://github.com/camunda/bpmnlint-plugin-camunda-compat/workflows/CI/badge.svg)](https://github.com/camunda/bpmnlint-plugin-camunda-compat/actions?query=workflow%3ACI)
4
+
5
+ A [bpmnlint](https://github.com/bpmn-io/bpmnlint) plug-in that checks whether a given BPMN process can be executed with [Camunda](https://camunda.com/).
6
+
7
+
8
+ ## Usage
9
+
10
+ Add configuration corresponding to your execution platform and version to your [`.bpmnlintrc` configuration](https://github.com/bpmn-io/bpmnlint#configuration):
11
+
12
+ ```json
13
+ {
14
+ "extends": [
15
+ "bpmnlint:recommended",
16
+ "plugin:camunda-compat/camunda-cloud-8-0"
17
+ ],
18
+ "rules": {
19
+ "camunda-compat/timer": "off"
20
+ }
21
+ }
22
+ ```
23
+
24
+ Use [`@camunda/linting`](https://github.com/camunda/linting) to configure the linter dynamically based on the [execution platform and version](https://github.com/camunda/modeler-moddle).
25
+
26
+
27
+ ## Resources
28
+
29
+ * [Issues](https://github.com/camunda/bpmnlint-plugin-camunda-compat/issues)
30
+
31
+
32
+ ## Related
33
+
34
+ * BPMN coverage for [Camunda 8](https://docs.camunda.io/docs/reference/bpmn-processes/bpmn-coverage/) and [Camunda 7](https://docs.camunda.org/manual/latest/reference/bpmn20/)
35
+
36
+
37
+ ## License
38
+
39
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpmnlint-plugin-camunda-compat",
3
- "version": "2.26.0",
3
+ "version": "2.26.1",
4
4
  "description": "A bpmnlint plug-in for Camunda compatibility",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,43 +1,43 @@
1
- const { is } = require('bpmnlint-utils');
2
-
3
- const {
4
- findExtensionElement,
5
- hasExtensionElement,
6
- hasProperties
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:CallActivity')) {
16
- return;
17
- }
18
-
19
- let errors = hasExtensionElement(node, 'zeebe:CalledElement', node);
20
-
21
- if (errors && errors.length) {
22
- reportErrors(node, reporter, errors);
23
-
24
- return;
25
- }
26
-
27
- const calledElement = findExtensionElement(node, 'zeebe:CalledElement');
28
-
29
- errors = hasProperties(calledElement, {
30
- processId: {
31
- required: true
32
- }
33
- }, node);
34
-
35
- if (errors && errors.length) {
36
- reportErrors(node, reporter, errors);
37
- }
38
- }
39
-
40
- return {
41
- check
42
- };
1
+ const { is } = require('bpmnlint-utils');
2
+
3
+ const {
4
+ findExtensionElement,
5
+ hasExtensionElement,
6
+ hasProperties
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:CallActivity')) {
16
+ return;
17
+ }
18
+
19
+ let errors = hasExtensionElement(node, 'zeebe:CalledElement', node);
20
+
21
+ if (errors && errors.length) {
22
+ reportErrors(node, reporter, errors);
23
+
24
+ return;
25
+ }
26
+
27
+ const calledElement = findExtensionElement(node, 'zeebe:CalledElement');
28
+
29
+ errors = hasProperties(calledElement, {
30
+ processId: {
31
+ required: true
32
+ }
33
+ }, node);
34
+
35
+ if (errors && errors.length) {
36
+ reportErrors(node, reporter, errors);
37
+ }
38
+ }
39
+
40
+ return {
41
+ check
42
+ };
43
43
  });
@@ -1,40 +1,40 @@
1
- const { is } = require('bpmnlint-utils');
2
-
3
- const { ERROR_TYPES } = require('../utils/element');
4
-
5
- const { reportErrors } = require('../utils/reporter');
6
-
7
- const { skipInNonExecutableProcess } = require('../utils/rule');
8
-
9
- module.exports = skipInNonExecutableProcess(function() {
10
- function check(di, reporter) {
11
-
12
- if (!isCollapsedSubProcess(di)) {
13
- return;
14
- }
15
-
16
- const node = di.bpmnElement;
17
-
18
- const error = {
19
- message: `A <${ node.$type }> must be expanded`,
20
- data: {
21
- type: ERROR_TYPES.ELEMENT_COLLAPSED_NOT_ALLOWED,
22
- node: node,
23
- parentNode: null,
24
- allowedVersion: '8.4'
25
- }
26
- };
27
-
28
- reportErrors(node, reporter, error);
29
- }
30
-
31
- return {
32
- check
33
- };
34
- });
35
-
36
- function isCollapsedSubProcess(di) {
37
- return is(di, 'bpmndi:BPMNShape') &&
38
- is(di.get('bpmnElement'), 'bpmn:SubProcess') &&
39
- di.get('isExpanded') !== true;
40
- }
1
+ const { is } = require('bpmnlint-utils');
2
+
3
+ const { ERROR_TYPES } = require('../utils/element');
4
+
5
+ const { reportErrors } = require('../utils/reporter');
6
+
7
+ const { skipInNonExecutableProcess } = require('../utils/rule');
8
+
9
+ module.exports = skipInNonExecutableProcess(function() {
10
+ function check(di, reporter) {
11
+
12
+ if (!isCollapsedSubProcess(di)) {
13
+ return;
14
+ }
15
+
16
+ const node = di.bpmnElement;
17
+
18
+ const error = {
19
+ message: `A <${ node.$type }> must be expanded`,
20
+ data: {
21
+ type: ERROR_TYPES.ELEMENT_COLLAPSED_NOT_ALLOWED,
22
+ node: node,
23
+ parentNode: null,
24
+ allowedVersion: '8.4'
25
+ }
26
+ };
27
+
28
+ reportErrors(node, reporter, error);
29
+ }
30
+
31
+ return {
32
+ check
33
+ };
34
+ });
35
+
36
+ function isCollapsedSubProcess(di) {
37
+ return is(di, 'bpmndi:BPMNShape') &&
38
+ is(di.get('bpmnElement'), 'bpmn:SubProcess') &&
39
+ di.get('isExpanded') !== true;
40
+ }
@@ -1,91 +1,91 @@
1
- const { getPath } = require('@bpmn-io/moddle-utils');
2
-
3
- const { findExtensionElement } = require('../../utils/element');
4
-
5
- const { ERROR_TYPES } = require('../../utils/error-types');
6
-
7
- const INBOUND_CONNECTOR_PROPERTY = 'inbound.type';
8
-
9
- module.exports = {
10
- messageTtl: {
11
- version: '8.6',
12
- getError: (node) => getInboundConnectorError(node, 'messageTtl', '8.6'),
13
- getProperty: (node) => getZeebeProperty(node, 'messageTtl'),
14
- isConnector: (node) => isInboundConnector(node, [
15
- 'io.camunda:webhook:1',
16
- 'io.camunda:connector-rabbitmq-inbound:1',
17
- 'io.camunda:http-polling:1',
18
- 'io.camunda:connector-kafka-inbound:1',
19
- 'io.camunda:slack-webhook:1',
20
- 'io.camunda:aws-sqs-inbound:1',
21
- 'io.camunda:aws-sns-webhook:1'
22
- ])
23
- },
24
- consumeUnmatchedEvents: {
25
- version: '8.6',
26
- getError: (node) => getInboundConnectorError(node, 'consumeUnmatchedEvents', '8.6'),
27
- getProperty: (node) => getZeebeProperty(node, 'consumeUnmatchedEvents'),
28
- isConnector: (node) => isInboundConnector(node, [
29
- 'io.camunda:webhook:1',
30
- 'io.camunda:connector-rabbitmq-inbound:1',
31
- 'io.camunda:http-polling:1',
32
- 'io.camunda:connector-kafka-inbound:1',
33
- 'io.camunda:slack-webhook:1',
34
- 'io.camunda:aws-sqs-inbound:1',
35
- 'io.camunda:aws-sns-webhook:1'
36
- ])
37
- },
38
- deduplicationModeManualFlag: {
39
- version: '8.6',
40
- getError: (node) => getInboundConnectorError(node, 'deduplicationModeManualFlag', '8.6'),
41
- getProperty: (node) => getZeebeProperty(node, 'deduplicationModeManualFlag'),
42
- isConnector: (node) => isInboundConnector(node, [
43
- 'io.camunda:connector-rabbitmq-inbound:1',
44
- 'io.camunda:http-polling:1',
45
- 'io.camunda:connector-kafka-inbound:1',
46
- 'io.camunda:aws-sqs-inbound:1'
47
- ])
48
- }
49
- };
50
-
51
- function isInboundConnector(node, names) {
52
- const zeebeProperty = getZeebeProperty(node, INBOUND_CONNECTOR_PROPERTY);
53
-
54
- return zeebeProperty && names.includes(zeebeProperty.get('value'));
55
- }
56
-
57
- function getZeebeProperty(node, propertyName) {
58
- const zeebeProperties = findExtensionElement(node, 'zeebe:Properties');
59
-
60
- if (!zeebeProperties) {
61
- return false;
62
- }
63
-
64
- return zeebeProperties.get('properties').find(property => {
65
- return property.get('name') === propertyName;
66
- });
67
- }
68
-
69
- function getInboundConnectorError(node, propertyName, allowedVersion) {
70
- const property = getZeebeProperty(node, propertyName);
71
-
72
- const connectorProperty = getZeebeProperty(node, INBOUND_CONNECTOR_PROPERTY);
73
-
74
- const path = getPath(property, node);
75
-
76
- return {
77
- message: `Connector property <name> with value <${ propertyName }> only allowed by Camunda ${ allowedVersion } or newer.`,
78
- path: path ? [ ...path, 'name' ] : [ 'name' ],
79
- data: {
80
- type: ERROR_TYPES.CONNECTORS_PROPERTY_VALUE_NOT_ALLOWED,
81
- node: property,
82
- parentNode: node,
83
- property: 'name',
84
- allowedVersion,
85
- connectorProperty: {
86
- node: connectorProperty,
87
- properties: [ 'name', 'value' ]
88
- }
89
- }
90
- };
1
+ const { getPath } = require('@bpmn-io/moddle-utils');
2
+
3
+ const { findExtensionElement } = require('../../utils/element');
4
+
5
+ const { ERROR_TYPES } = require('../../utils/error-types');
6
+
7
+ const INBOUND_CONNECTOR_PROPERTY = 'inbound.type';
8
+
9
+ module.exports = {
10
+ messageTtl: {
11
+ version: '8.6',
12
+ getError: (node) => getInboundConnectorError(node, 'messageTtl', '8.6'),
13
+ getProperty: (node) => getZeebeProperty(node, 'messageTtl'),
14
+ isConnector: (node) => isInboundConnector(node, [
15
+ 'io.camunda:webhook:1',
16
+ 'io.camunda:connector-rabbitmq-inbound:1',
17
+ 'io.camunda:http-polling:1',
18
+ 'io.camunda:connector-kafka-inbound:1',
19
+ 'io.camunda:slack-webhook:1',
20
+ 'io.camunda:aws-sqs-inbound:1',
21
+ 'io.camunda:aws-sns-webhook:1'
22
+ ])
23
+ },
24
+ consumeUnmatchedEvents: {
25
+ version: '8.6',
26
+ getError: (node) => getInboundConnectorError(node, 'consumeUnmatchedEvents', '8.6'),
27
+ getProperty: (node) => getZeebeProperty(node, 'consumeUnmatchedEvents'),
28
+ isConnector: (node) => isInboundConnector(node, [
29
+ 'io.camunda:webhook:1',
30
+ 'io.camunda:connector-rabbitmq-inbound:1',
31
+ 'io.camunda:http-polling:1',
32
+ 'io.camunda:connector-kafka-inbound:1',
33
+ 'io.camunda:slack-webhook:1',
34
+ 'io.camunda:aws-sqs-inbound:1',
35
+ 'io.camunda:aws-sns-webhook:1'
36
+ ])
37
+ },
38
+ deduplicationModeManualFlag: {
39
+ version: '8.6',
40
+ getError: (node) => getInboundConnectorError(node, 'deduplicationModeManualFlag', '8.6'),
41
+ getProperty: (node) => getZeebeProperty(node, 'deduplicationModeManualFlag'),
42
+ isConnector: (node) => isInboundConnector(node, [
43
+ 'io.camunda:connector-rabbitmq-inbound:1',
44
+ 'io.camunda:http-polling:1',
45
+ 'io.camunda:connector-kafka-inbound:1',
46
+ 'io.camunda:aws-sqs-inbound:1'
47
+ ])
48
+ }
49
+ };
50
+
51
+ function isInboundConnector(node, names) {
52
+ const zeebeProperty = getZeebeProperty(node, INBOUND_CONNECTOR_PROPERTY);
53
+
54
+ return zeebeProperty && names.includes(zeebeProperty.get('value'));
55
+ }
56
+
57
+ function getZeebeProperty(node, propertyName) {
58
+ const zeebeProperties = findExtensionElement(node, 'zeebe:Properties');
59
+
60
+ if (!zeebeProperties) {
61
+ return false;
62
+ }
63
+
64
+ return zeebeProperties.get('properties').find(property => {
65
+ return property.get('name') === propertyName;
66
+ });
67
+ }
68
+
69
+ function getInboundConnectorError(node, propertyName, allowedVersion) {
70
+ const property = getZeebeProperty(node, propertyName);
71
+
72
+ const connectorProperty = getZeebeProperty(node, INBOUND_CONNECTOR_PROPERTY);
73
+
74
+ const path = getPath(property, node);
75
+
76
+ return {
77
+ message: `Connector property <name> with value <${ propertyName }> only allowed by Camunda ${ allowedVersion } or newer.`,
78
+ path: path ? [ ...path, 'name' ] : [ 'name' ],
79
+ data: {
80
+ type: ERROR_TYPES.CONNECTORS_PROPERTY_VALUE_NOT_ALLOWED,
81
+ node: property,
82
+ parentNode: node,
83
+ property: 'name',
84
+ allowedVersion,
85
+ connectorProperty: {
86
+ node: connectorProperty,
87
+ properties: [ 'name', 'value' ]
88
+ }
89
+ }
90
+ };
91
91
  }
@@ -1,47 +1,47 @@
1
- const { isAny } = require('bpmnlint-utils');
2
-
3
- const config = require('./config');
4
-
5
- const { reportErrors } = require('../../utils/reporter');
6
-
7
- const { skipInNonExecutableProcess } = require('../../utils/rule');
8
-
9
- const { greaterOrEqual } = require('../../utils/version');
10
-
11
- module.exports = skipInNonExecutableProcess(function({ version }) {
12
- function check(node, reporter) {
13
- if (!isAny(node, [ 'bpmn:FlowElement', 'bpmn:FlowElementsContainer' ])) {
14
- return;
15
- }
16
-
17
- const errors = Object.entries(config).reduce((errors, [ propertyName, {
18
- getError,
19
- getProperty,
20
- isConnector,
21
- version: allowedVersion
22
- } ]) => {
23
- if (greaterOrEqual(version, allowedVersion) || !isConnector(node)) {
24
- return errors;
25
- }
26
-
27
- const property = getProperty(node);
28
-
29
- if (property) {
30
- return [
31
- ...errors,
32
- getError(node)
33
- ];
34
- }
35
-
36
- return errors;
37
- }, []);
38
-
39
- if (errors.length) {
40
- reportErrors(node, reporter, errors);
41
- }
42
- }
43
-
44
- return {
45
- check
46
- };
47
- });
1
+ const { isAny } = require('bpmnlint-utils');
2
+
3
+ const config = require('./config');
4
+
5
+ const { reportErrors } = require('../../utils/reporter');
6
+
7
+ const { skipInNonExecutableProcess } = require('../../utils/rule');
8
+
9
+ const { greaterOrEqual } = require('../../utils/version');
10
+
11
+ module.exports = skipInNonExecutableProcess(function({ version }) {
12
+ function check(node, reporter) {
13
+ if (!isAny(node, [ 'bpmn:FlowElement', 'bpmn:FlowElementsContainer' ])) {
14
+ return;
15
+ }
16
+
17
+ const errors = Object.entries(config).reduce((errors, [ propertyName, {
18
+ getError,
19
+ getProperty,
20
+ isConnector,
21
+ version: allowedVersion
22
+ } ]) => {
23
+ if (greaterOrEqual(version, allowedVersion) || !isConnector(node)) {
24
+ return errors;
25
+ }
26
+
27
+ const property = getProperty(node);
28
+
29
+ if (property) {
30
+ return [
31
+ ...errors,
32
+ getError(node)
33
+ ];
34
+ }
35
+
36
+ return errors;
37
+ }, []);
38
+
39
+ if (errors.length) {
40
+ reportErrors(node, reporter, errors);
41
+ }
42
+ }
43
+
44
+ return {
45
+ check
46
+ };
47
+ });
@@ -1,33 +1,33 @@
1
- const {
2
- findExtensionElement,
3
- hasDuplicatedPropertiesValues
4
- } = require('../utils/element');
5
-
6
- const { reportErrors } = require('../utils/reporter');
7
-
8
- const { skipInNonExecutableProcess } = require('../utils/rule');
9
-
10
- module.exports = skipInNonExecutableProcess(function() {
11
- function check(node, reporter) {
12
- const executionListeners = findExtensionElement(node, 'zeebe:ExecutionListeners');
13
-
14
- if (!executionListeners) {
15
- return;
16
- }
17
-
18
- const errors = hasDuplicatedExecutionListeners(executionListeners, node);
19
-
20
- if (errors && errors.length) {
21
- reportErrors(node, reporter, errors);
22
- }
23
- }
24
-
25
- return {
26
- check
27
- };
28
- });
29
-
30
- // helpers //////////
31
- function hasDuplicatedExecutionListeners(executionListeners, parentNode = null) {
32
- return hasDuplicatedPropertiesValues(executionListeners, 'listeners', [ 'eventType', 'type' ], parentNode);
33
- }
1
+ const {
2
+ findExtensionElement,
3
+ hasDuplicatedPropertiesValues
4
+ } = require('../utils/element');
5
+
6
+ const { reportErrors } = require('../utils/reporter');
7
+
8
+ const { skipInNonExecutableProcess } = require('../utils/rule');
9
+
10
+ module.exports = skipInNonExecutableProcess(function() {
11
+ function check(node, reporter) {
12
+ const executionListeners = findExtensionElement(node, 'zeebe:ExecutionListeners');
13
+
14
+ if (!executionListeners) {
15
+ return;
16
+ }
17
+
18
+ const errors = hasDuplicatedExecutionListeners(executionListeners, node);
19
+
20
+ if (errors && errors.length) {
21
+ reportErrors(node, reporter, errors);
22
+ }
23
+ }
24
+
25
+ return {
26
+ check
27
+ };
28
+ });
29
+
30
+ // helpers //////////
31
+ function hasDuplicatedExecutionListeners(executionListeners, parentNode = null) {
32
+ return hasDuplicatedPropertiesValues(executionListeners, 'listeners', [ 'eventType', 'type' ], parentNode);
33
+ }