bpmnlint-plugin-camunda-compat 2.16.0 → 2.18.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
@@ -19,6 +19,7 @@ const camundaCloud10Rules = withConfig({
19
19
  'no-task-schedule': 'error',
20
20
  'no-template': 'error',
21
21
  'no-zeebe-properties': 'error',
22
+ 'no-zeebe-user-task': 'error',
22
23
  'sequence-flow-condition': 'error',
23
24
  'start-event-form': 'error',
24
25
  'subscription': 'error',
@@ -65,6 +66,14 @@ const camundaCloud83Rules = withConfig({
65
66
  const camundaCloud84Rules = withConfig(
66
67
  omit(camundaCloud83Rules, 'collapsed-subprocess'), { version: '8.4' });
67
68
 
69
+ const camundaCloud85Rules = withConfig({
70
+ ...omit(camundaCloud83Rules, [
71
+ 'collapsed-subprocess',
72
+ 'no-zeebe-user-task'
73
+ ]),
74
+ 'wait-for-completion': 'error'
75
+ }, { version: '8.5' });
76
+
68
77
  const camundaPlatform719Rules = withConfig({
69
78
  'history-time-to-live': 'info'
70
79
  }, {
@@ -108,6 +117,7 @@ const rules = {
108
117
  'no-task-schedule': './rules/camunda-cloud/no-task-schedule',
109
118
  'no-template': './rules/camunda-cloud/no-template',
110
119
  'no-zeebe-properties': './rules/camunda-cloud/no-zeebe-properties',
120
+ 'no-zeebe-user-task': './rules/camunda-cloud/no-zeebe-user-task',
111
121
  'secrets': './rules/camunda-cloud/secrets',
112
122
  'sequence-flow-condition': './rules/camunda-cloud/sequence-flow-condition',
113
123
  'signal-reference': './rules/camunda-cloud/signal-reference',
@@ -116,7 +126,8 @@ const rules = {
116
126
  'task-schedule': './rules/camunda-cloud/task-schedule',
117
127
  'timer': './rules/camunda-cloud/timer',
118
128
  'user-task-definition': './rules/camunda-cloud/user-task-definition',
119
- 'user-task-form': './rules/camunda-cloud/user-task-form'
129
+ 'user-task-form': './rules/camunda-cloud/user-task-form',
130
+ 'wait-for-completion': './rules/camunda-cloud/wait-for-completion'
120
131
  };
121
132
 
122
133
  const configs = {
@@ -147,6 +158,9 @@ const configs = {
147
158
  'camunda-cloud-8-4': {
148
159
  rules: camundaCloud84Rules
149
160
  },
161
+ 'camunda-cloud-8-5': {
162
+ rules: camundaCloud85Rules
163
+ },
150
164
  'camunda-platform-7-19': {
151
165
  rules: camundaPlatform719Rules
152
166
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpmnlint-plugin-camunda-compat",
3
- "version": "2.16.0",
3
+ "version": "2.18.0",
4
4
  "description": "A bpmnlint plug-in for Camunda compatibility",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,6 +1,7 @@
1
1
  module.exports = {
2
2
  'bpmn:Association': '1.0',
3
3
  'bpmn:BoundaryEvent': {
4
+ 'bpmn:CompensateEventDefinition': '8.5',
4
5
  'bpmn:ErrorEventDefinition': '1.0',
5
6
  'bpmn:EscalationEventDefinition': '8.2',
6
7
  'bpmn:MessageEventDefinition': '1.0',
@@ -16,6 +17,7 @@ module.exports = {
16
17
  'bpmn:Definitions': '1.0',
17
18
  'bpmn:EndEvent': {
18
19
  '_': '1.0',
20
+ 'bpmn:CompensateEventDefinition': '8.5',
19
21
  'bpmn:ErrorEventDefinition': '1.0',
20
22
  'bpmn:EscalationEventDefinition': '8.2',
21
23
  'bpmn:MessageEventDefinition': '1.2',
@@ -34,6 +36,7 @@ module.exports = {
34
36
  },
35
37
  'bpmn:IntermediateThrowEvent': {
36
38
  '_': '1.1',
39
+ 'bpmn:CompensateEventDefinition': '8.5',
37
40
  'bpmn:EscalationEventDefinition': '8.2',
38
41
  'bpmn:LinkEventDefinition': '8.2',
39
42
  'bpmn:MessageEventDefinition': '1.2',
@@ -0,0 +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
+ });
@@ -19,6 +19,8 @@ const formIdAllowedVersions = {
19
19
  web: '8.0'
20
20
  };
21
21
 
22
+ const ZEEBE_USER_TASK_VERSION = '8.5';
23
+
22
24
  module.exports = skipInNonExecutableProcess(function({ modeler = 'desktop', version }) {
23
25
  function check(node, reporter) {
24
26
  if (!is(node, 'bpmn:UserTask')) {
@@ -31,7 +33,27 @@ module.exports = skipInNonExecutableProcess(function({ modeler = 'desktop', vers
31
33
  return;
32
34
  }
33
35
 
34
- let errors = [];
36
+ // handle Zebee User Task
37
+ if (isZeebeUserTask(node)) {
38
+
39
+ // handled by no-zeebe-user-task rule
40
+ if (!greaterOrEqual(version, ZEEBE_USER_TASK_VERSION)) {
41
+ return;
42
+ }
43
+
44
+ const errors = hasProperty(formDefinition, [
45
+ 'externalReference',
46
+ 'formId'
47
+ ], node) || [];
48
+
49
+ if (errors.length) {
50
+ reportErrors(node, reporter, errors);
51
+ }
52
+
53
+ return;
54
+ }
55
+
56
+ let errors;
35
57
 
36
58
  const formIdAllowedVersion = formIdAllowedVersions[ modeler ];
37
59
 
@@ -113,4 +135,8 @@ function findUserTaskForm(node, formKey) {
113
135
 
114
136
  function isFormIdAllowed(version, formIdAllowedVersion) {
115
137
  return greaterOrEqual(version, formIdAllowedVersion);
116
- }
138
+ }
139
+
140
+ function isZeebeUserTask(node) {
141
+ return !!findExtensionElement(node, 'zeebe:UserTask');
142
+ }
@@ -0,0 +1,46 @@
1
+ const {
2
+ is
3
+ } = require('bpmnlint-utils');
4
+
5
+ const {
6
+ getEventDefinition,
7
+ hasProperties
8
+ } = require('../utils/element');
9
+
10
+ const { reportErrors } = require('../utils/reporter');
11
+
12
+ const { skipInNonExecutableProcess } = require('../utils/rule');
13
+
14
+ module.exports = skipInNonExecutableProcess(waitForCompletion);
15
+
16
+ /**
17
+ * Make sure that wait for completion is NOT set to false.
18
+ */
19
+ function waitForCompletion() {
20
+ function check(node, reporter) {
21
+ if (!is(node, 'bpmn:ThrowEvent')) {
22
+ return;
23
+ }
24
+
25
+ const eventDefinition = getEventDefinition(node);
26
+
27
+ if (!eventDefinition || !is(eventDefinition, 'bpmn:CompensateEventDefinition')) {
28
+ return;
29
+ }
30
+
31
+ const errors = hasProperties(eventDefinition, {
32
+ waitForCompletion: {
33
+ value: true
34
+ }
35
+ }, node);
36
+
37
+ if (errors && errors.length) {
38
+ reportErrors(node, reporter, errors);
39
+ }
40
+ }
41
+
42
+
43
+ return {
44
+ check
45
+ };
46
+ }