bpmnlint-plugin-camunda-compat 0.14.1 → 0.15.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.
package/index.js CHANGED
@@ -7,10 +7,12 @@ const camundaCloud10Rules = {
7
7
  'duplicate-task-headers': 'error',
8
8
  'element-type': [ 'error', { version: '1.0' } ],
9
9
  'error-reference': 'error',
10
+ 'executable-process': 'error',
10
11
  'loop-characteristics': 'error',
11
12
  'message-reference': 'error',
12
13
  'no-template': 'error',
13
14
  'no-zeebe-properties': 'error',
15
+ 'sequence-flow-condition': 'error',
14
16
  'subscription': 'error',
15
17
  'timer': [ 'error', { version: '1.0' } ],
16
18
  'user-task-form': 'error',
@@ -53,6 +55,13 @@ const camundaCloud81Rules = {
53
55
  'timer': [ 'error', { version: '8.1' } ]
54
56
  };
55
57
 
58
+ const camundaCloud82Rules = {
59
+ ...camundaCloud81Rules,
60
+ 'called-decision-or-task-definition': [ 'error', { version: '8.2' } ],
61
+ 'element-type': [ 'error', { version: '8.2' } ],
62
+ 'timer': [ 'error', { version: '8.2' } ]
63
+ };
64
+
56
65
  module.exports = {
57
66
  configs: {
58
67
  'camunda-cloud-1-0': {
@@ -72,6 +81,9 @@ module.exports = {
72
81
  },
73
82
  'camunda-cloud-8-1': {
74
83
  rules: camundaCloud81Rules
84
+ },
85
+ 'camunda-cloud-8-2': {
86
+ rules: camundaCloud82Rules
75
87
  }
76
88
  }
77
89
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpmnlint-plugin-camunda-compat",
3
- "version": "0.14.1",
3
+ "version": "0.15.1",
4
4
  "description": "A bpmnlint plug-in for Camunda Platform compatibility",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -8,6 +8,9 @@ module.exports = {
8
8
  'bpmn:BusinessRuleTask': '1.1',
9
9
  'bpmn:CallActivity': '1.0',
10
10
  'bpmn:Collaboration': '1.0',
11
+ 'bpmn:DataObject': '8.0',
12
+ 'bpmn:DataObjectReference': '8.0',
13
+ 'bpmn:DataStoreReference': '8.0',
11
14
  'bpmn:Definitions': '1.0',
12
15
  'bpmn:EndEvent': {
13
16
  '_': '1.0',
@@ -44,6 +47,7 @@ module.exports = {
44
47
  'bpmn:TimerEventDefinition': '1.0'
45
48
  },
46
49
  'bpmn:SubProcess': '1.0',
50
+ 'bpmn:Task': '8.2',
47
51
  'bpmn:TextAnnotation': '1.0',
48
52
  'bpmn:UserTask': '1.0'
49
53
  };
@@ -0,0 +1,62 @@
1
+ const { is } = require('bpmnlint-utils');
2
+
3
+ const { hasProperties } = require('./utils/element');
4
+
5
+ const { reportErrors } = require('./utils/reporter');
6
+
7
+ module.exports = function() {
8
+ function check(node, reporter) {
9
+ if (!is(node, 'bpmn:Definitions')) {
10
+ return;
11
+ }
12
+
13
+ const rootElements = node.get('rootElements'),
14
+ collaboration = rootElements.find(rootElement => is(rootElement, 'bpmn:Collaboration')),
15
+ processes = rootElements.filter(rootElement => is(rootElement, 'bpmn:Process'));
16
+
17
+ let errors = [];
18
+
19
+ for (const process of processes) {
20
+ const parentNode = getParentNode(process, collaboration);
21
+
22
+ errors = [
23
+ ...errors,
24
+ ...hasProperties(process, {
25
+ isExecutable: {
26
+ value: true
27
+ }
28
+ }, parentNode)
29
+ ];
30
+ }
31
+
32
+ if (errors.length > processes.length - 1) {
33
+ errors.forEach(error => {
34
+ const { data } = error;
35
+
36
+ const { node: process } = data;
37
+
38
+ reportErrors(getParentNode(process, collaboration), reporter, error);
39
+ });
40
+ }
41
+ }
42
+
43
+ return {
44
+ check
45
+ };
46
+ };
47
+
48
+ function getParentNode(process, collaboration) {
49
+ if (!collaboration) {
50
+ return process;
51
+ }
52
+
53
+ const participants = collaboration.get('participants');
54
+
55
+ const participant = participants.find(participant => participant.get('processRef') === process);
56
+
57
+ if (participant) {
58
+ return participant;
59
+ }
60
+
61
+ return process;
62
+ }
@@ -1,6 +1,6 @@
1
1
  const { is } = require('bpmnlint-utils');
2
2
 
3
- const { hasProperties, ERROR_TYPES } = require('./utils/element');
3
+ const { ERROR_TYPES } = require('./utils/element');
4
4
 
5
5
  const { reportErrors } = require('./utils/reporter');
6
6
 
@@ -26,24 +26,6 @@ module.exports = function() {
26
26
 
27
27
  reportErrors(node, reporter, error);
28
28
  }
29
-
30
- const outgoing = node.get('outgoing');
31
-
32
- if (outgoing && outgoing.length > 1) {
33
- for (let sequenceFlow of outgoing) {
34
- if (node.get('default') !== sequenceFlow) {
35
- const errors = hasProperties(sequenceFlow, {
36
- conditionExpression: {
37
- required: true
38
- }
39
- }, sequenceFlow);
40
-
41
- if (errors.length) {
42
- reportErrors(sequenceFlow, reporter, errors);
43
- }
44
- }
45
- }
46
- }
47
29
  }
48
30
 
49
31
  return {
@@ -0,0 +1,35 @@
1
+ const { isAny } = require('bpmnlint-utils');
2
+
3
+ const { hasProperties } = require('./utils/element');
4
+
5
+ const { reportErrors } = require('./utils/reporter');
6
+
7
+ module.exports = function() {
8
+ function check(node, reporter) {
9
+ if (!isAny(node, [ 'bpmn:ExclusiveGateway', 'bpmn:InclusiveGateway' ])) {
10
+ return;
11
+ }
12
+
13
+ const outgoing = node.get('outgoing');
14
+
15
+ if (outgoing && outgoing.length > 1) {
16
+ for (let sequenceFlow of outgoing) {
17
+ if (node.get('default') !== sequenceFlow) {
18
+ const errors = hasProperties(sequenceFlow, {
19
+ conditionExpression: {
20
+ required: true
21
+ }
22
+ }, sequenceFlow);
23
+
24
+ if (errors.length) {
25
+ reportErrors(sequenceFlow, reporter, errors);
26
+ }
27
+ }
28
+ }
29
+ }
30
+ }
31
+
32
+ return {
33
+ check
34
+ };
35
+ };
@@ -212,6 +212,25 @@ module.exports.hasProperties = function(node, properties, parentNode = null) {
212
212
  ];
213
213
  }
214
214
 
215
+ if ('value' in propertyChecks && propertyChecks.value !== propertyValue) {
216
+ return [
217
+ ...results,
218
+ {
219
+ message: `Property <${ propertyName }> must have value of <${ propertyChecks.value }>`,
220
+ path: path
221
+ ? [ ...path, propertyName ]
222
+ : [ propertyName ],
223
+ data: {
224
+ type: ERROR_TYPES.PROPERTY_VALUE_REQUIRED,
225
+ node,
226
+ parentNode: parentNode == node ? null : parentNode,
227
+ property: propertyName,
228
+ requiredValue: propertyChecks.value
229
+ }
230
+ }
231
+ ];
232
+ }
233
+
215
234
  if (propertyChecks.allowed === false && isDefined(propertyValue) && !isNil(propertyValue)) {
216
235
  return [
217
236
  ...results,
@@ -11,5 +11,6 @@ module.exports.ERROR_TYPES = Object.freeze({
11
11
  PROPERTY_REQUIRED: 'camunda.propertyRequired',
12
12
  PROPERTY_TYPE_NOT_ALLOWED: 'camunda.propertyTypeNotAllowed',
13
13
  PROPERTY_VALUE_DUPLICATED: 'camunda.propertyValueDuplicated',
14
- PROPERTY_VALUE_NOT_ALLOWED: 'camunda.propertyValueNotAllowed'
14
+ PROPERTY_VALUE_NOT_ALLOWED: 'camunda.propertyValueNotAllowed',
15
+ PROPERTY_VALUE_REQUIRED: 'camunda.propertyValueRequired'
15
16
  });