bpmnlint-plugin-camunda-compat 2.9.1 → 2.11.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.
package/index.js CHANGED
@@ -64,6 +64,8 @@ const camundaCloud83Rules = withConfig({
64
64
  'signal-reference': 'error'
65
65
  }, { version: '8.3' });
66
66
 
67
+ const camundaCloud84Rules = withConfig(camundaCloud83Rules, { version: '8.4' });
68
+
67
69
  const camundaPlatform719Rules = withConfig({
68
70
  'history-time-to-live': 'error'
69
71
  }, {
@@ -76,6 +78,11 @@ const camundaPlatform720Rules = withConfig(camundaPlatform719Rules, {
76
78
  version: '7.20'
77
79
  });
78
80
 
81
+ const camundaPlatform721Rules = withConfig(camundaPlatform720Rules, {
82
+ platform: 'camunda-platform',
83
+ version: '7.21'
84
+ });
85
+
79
86
  const rules = {
80
87
  'element-type': './rules/camunda-cloud/element-type',
81
88
  'called-element': './rules/camunda-cloud/called-element',
@@ -138,12 +145,18 @@ module.exports = {
138
145
  'camunda-cloud-8-3': {
139
146
  rules: camundaCloud83Rules
140
147
  },
148
+ 'camunda-cloud-8-4': {
149
+ rules: camundaCloud84Rules
150
+ },
141
151
  'camunda-platform-7-19': {
142
152
  rules: camundaPlatform719Rules
143
153
  },
144
154
  'camunda-platform-7-20': {
145
155
  rules: camundaPlatform720Rules
146
156
  },
157
+ 'camunda-platform-7-21': {
158
+ rules: camundaPlatform721Rules
159
+ },
147
160
  'all': {
148
161
  rules: Object.keys(rules).reduce((allRules, rule) => {
149
162
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpmnlint-plugin-camunda-compat",
3
- "version": "2.9.1",
3
+ "version": "2.11.0",
4
4
  "description": "A bpmnlint plug-in for Camunda compatibility",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -24,23 +24,23 @@
24
24
  },
25
25
  "license": "MIT",
26
26
  "devDependencies": {
27
- "bpmn-moddle": "^7.1.3",
28
- "bpmnlint": "^9.0.0",
29
- "chai": "^4.3.6",
30
- "eslint": "^8.23.0",
31
- "eslint-plugin-bpmn-io": "^0.14.1",
32
- "mocha": "^10.0.0",
33
- "modeler-moddle": "^0.1.0",
34
- "sinon": "^14.0.0",
27
+ "bpmn-moddle": "^8.0.1",
28
+ "bpmnlint": "^9.2.0",
29
+ "camunda-bpmn-moddle": "^7.0.1",
30
+ "chai": "^4.3.10",
31
+ "eslint": "^8.51.0",
32
+ "eslint-plugin-bpmn-io": "^1.0.0",
33
+ "mocha": "^10.2.0",
34
+ "modeler-moddle": "^0.2.0",
35
+ "sinon": "^16.1.0",
35
36
  "sinon-chai": "^3.7.0",
36
37
  "zeebe-bpmn-moddle": "^1.0.0"
37
38
  },
38
39
  "dependencies": {
39
40
  "@bpmn-io/feel-lint": "^1.0.0",
40
- "@bpmn-io/moddle-utils": "^0.1.0",
41
+ "@bpmn-io/moddle-utils": "^0.2.1",
41
42
  "bpmnlint-utils": "^1.0.2",
42
- "camunda-bpmn-moddle": "^7.0.1",
43
- "min-dash": "^3.8.1",
43
+ "min-dash": "^4.1.1",
44
44
  "semver-compare": "^1.0.0"
45
45
  },
46
46
  "files": [
@@ -4,14 +4,19 @@ const {
4
4
  findExtensionElement,
5
5
  findExtensionElements,
6
6
  findParent,
7
- hasProperties
7
+ hasProperties,
8
+ hasProperty
8
9
  } = require('../utils/element');
9
10
 
10
11
  const { reportErrors } = require('../utils/reporter');
11
12
 
12
13
  const { skipInNonExecutableProcess } = require('../utils/rule');
13
14
 
14
- module.exports = skipInNonExecutableProcess(function() {
15
+ const { greaterOrEqual } = require('../utils/version');
16
+
17
+ const formIdAllowedVersion = '8.3';
18
+
19
+ module.exports = skipInNonExecutableProcess(function({ version }) {
15
20
  function check(node, reporter) {
16
21
  if (!is(node, 'bpmn:UserTask')) {
17
22
  return;
@@ -23,13 +28,39 @@ module.exports = skipInNonExecutableProcess(function() {
23
28
  return;
24
29
  }
25
30
 
26
- let errors = hasProperties(formDefinition, {
27
- formKey: {
28
- required: true
31
+ let errors = [];
32
+
33
+ if (isFormIdAllowed(version)) {
34
+
35
+ // Camunda 8.3 and newer
36
+ errors = hasProperty(formDefinition, [
37
+ 'formKey',
38
+ 'formId'
39
+ ], node);
40
+ } else {
41
+
42
+ // Camunda 8.2 and older
43
+ errors = hasProperties(formDefinition, {
44
+ formId: {
45
+ allowed: false,
46
+ allowedVersion: formIdAllowedVersion
47
+ }
48
+ }, node);
49
+
50
+ if (errors.length) {
51
+ reportErrors(node, reporter, errors);
52
+
53
+ return;
29
54
  }
30
- }, node);
31
55
 
32
- if (errors && errors.length) {
56
+ errors = hasProperties(formDefinition, {
57
+ formKey: {
58
+ required: true
59
+ }
60
+ }, node);
61
+ }
62
+
63
+ if (errors.length) {
33
64
  reportErrors(node, reporter, errors);
34
65
 
35
66
  return;
@@ -49,7 +80,7 @@ module.exports = skipInNonExecutableProcess(function() {
49
80
  }
50
81
  }, node);
51
82
 
52
- if (errors && errors.length) {
83
+ if (errors.length) {
53
84
  reportErrors(node, reporter, errors);
54
85
  }
55
86
  }
@@ -77,4 +108,8 @@ function findUserTaskForm(node, formKey) {
77
108
  return `camunda-forms:bpmn:${ id }` === formKey;
78
109
  });
79
110
  }
111
+ }
112
+
113
+ function isFormIdAllowed(version) {
114
+ return greaterOrEqual(version, formIdAllowedVersion);
80
115
  }