bpmnlint-plugin-camunda-compat 2.26.1 → 2.28.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 (61) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +39 -39
  3. package/index.js +22 -1
  4. package/package.json +2 -2
  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 +85 -85
  20. package/rules/camunda-cloud/implementation/config.js +19 -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-listeners.js +21 -0
  36. package/rules/camunda-cloud/no-task-schedule.js +18 -18
  37. package/rules/camunda-cloud/no-template.js +23 -23
  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-listener.js +47 -0
  47. package/rules/camunda-cloud/task-schedule.js +67 -67
  48. package/rules/camunda-cloud/timer/config.js +46 -46
  49. package/rules/camunda-cloud/timer/index.js +183 -183
  50. package/rules/camunda-cloud/user-task-definition.js +24 -24
  51. package/rules/camunda-cloud/user-task-form.js +142 -142
  52. package/rules/camunda-cloud/wait-for-completion.js +46 -46
  53. package/rules/camunda-cloud/zeebe-user-task.js +25 -0
  54. package/rules/camunda-platform/history-time-to-live.js +19 -19
  55. package/rules/utils/cron.js +95 -95
  56. package/rules/utils/element.js +533 -533
  57. package/rules/utils/error-types.js +25 -25
  58. package/rules/utils/iso8601.js +52 -52
  59. package/rules/utils/reporter.js +37 -37
  60. package/rules/utils/rule.js +46 -46
  61. 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/index.js CHANGED
@@ -19,6 +19,7 @@ const camundaCloud10Rules = withConfig({
19
19
  'no-multiple-none-start-events': 'error',
20
20
  'no-priority-definition': 'error',
21
21
  'no-propagate-all-parent-variables': 'error',
22
+ 'no-task-listeners': 'error',
22
23
  'no-task-schedule': 'error',
23
24
  'no-template': 'error',
24
25
  'no-version-tag': 'error',
@@ -93,6 +94,12 @@ const camundaCloud86Rules = withConfig({
93
94
  'version-tag': 'error'
94
95
  }, { version: '8.6' });
95
96
 
97
+ const camundaCloud87Rules = withConfig({
98
+ ...omit(camundaCloud86Rules, [ 'no-task-listeners' ]),
99
+ 'zeebe-user-task': 'error',
100
+ 'task-listener': 'error'
101
+ }, { version: '8.7' });
102
+
96
103
  const camundaPlatform719Rules = withConfig({
97
104
  'history-time-to-live': 'info'
98
105
  }, {
@@ -115,6 +122,11 @@ const camundaPlatform722Rules = withConfig(camundaPlatform721Rules, {
115
122
  version: '7.22'
116
123
  });
117
124
 
125
+ const camundaPlatform723Rules = withConfig(camundaPlatform721Rules, {
126
+ platform: 'camunda-platform',
127
+ version: '7.23'
128
+ });
129
+
118
130
  const rules = {
119
131
  'element-type': './rules/camunda-cloud/element-type',
120
132
  'called-element': './rules/camunda-cloud/called-element',
@@ -145,6 +157,7 @@ const rules = {
145
157
  'no-propagate-all-parent-variables': './rules/camunda-cloud/no-propagate-all-parent-variables',
146
158
  'no-signal-event-sub-process': './rules/camunda-cloud/no-signal-event-sub-process',
147
159
  'no-task-schedule': './rules/camunda-cloud/no-task-schedule',
160
+ 'no-task-listeners': './rules/camunda-cloud/no-task-listeners',
148
161
  'no-template': './rules/camunda-cloud/no-template',
149
162
  'no-version-tag': './rules/camunda-cloud/no-version-tag',
150
163
  'no-zeebe-properties': './rules/camunda-cloud/no-zeebe-properties',
@@ -155,12 +168,14 @@ const rules = {
155
168
  'signal-reference': './rules/camunda-cloud/signal-reference',
156
169
  'start-event-form': './rules/camunda-cloud/start-event-form',
157
170
  'subscription': './rules/camunda-cloud/subscription',
171
+ 'task-listener': './rules/camunda-cloud/task-listener',
158
172
  'task-schedule': './rules/camunda-cloud/task-schedule',
159
173
  'timer': './rules/camunda-cloud/timer',
160
174
  'user-task-definition': './rules/camunda-cloud/user-task-definition',
161
175
  'user-task-form': './rules/camunda-cloud/user-task-form',
162
176
  'version-tag': './rules/camunda-cloud/version-tag',
163
- 'wait-for-completion': './rules/camunda-cloud/wait-for-completion'
177
+ 'wait-for-completion': './rules/camunda-cloud/wait-for-completion',
178
+ 'zeebe-user-task': './rules/camunda-cloud/zeebe-user-task'
164
179
  };
165
180
 
166
181
  const configs = {
@@ -197,6 +212,9 @@ const configs = {
197
212
  'camunda-cloud-8-6': {
198
213
  rules: camundaCloud86Rules
199
214
  },
215
+ 'camunda-cloud-8-7': {
216
+ rules: camundaCloud87Rules
217
+ },
200
218
  'camunda-platform-7-19': {
201
219
  rules: camundaPlatform719Rules
202
220
  },
@@ -208,6 +226,9 @@ const configs = {
208
226
  },
209
227
  'camunda-platform-7-22': {
210
228
  rules: camundaPlatform722Rules
229
+ },
230
+ 'camunda-platform-7-23': {
231
+ rules: camundaPlatform723Rules
211
232
  }
212
233
  };
213
234
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpmnlint-plugin-camunda-compat",
3
- "version": "2.26.1",
3
+ "version": "2.28.0",
4
4
  "description": "A bpmnlint plug-in for Camunda compatibility",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -34,7 +34,7 @@
34
34
  "modeler-moddle": "^0.2.0",
35
35
  "sinon": "^17.0.1",
36
36
  "sinon-chai": "^3.7.0",
37
- "zeebe-bpmn-moddle": "^1.6.0"
37
+ "zeebe-bpmn-moddle": "^1.7.0"
38
38
  },
39
39
  "dependencies": {
40
40
  "@bpmn-io/feel-lint": "^1.2.0",
@@ -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
+ });