bpmnlint-plugin-camunda-compat 2.33.1 → 2.34.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpmnlint-plugin-camunda-compat",
3
- "version": "2.33.1",
3
+ "version": "2.34.1",
4
4
  "description": "A bpmnlint plug-in for Camunda compatibility",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,27 +1,53 @@
1
- const { is, isAny } = require('bpmnlint-utils');
1
+ const { is } = require('bpmnlint-utils');
2
2
 
3
+ const {
4
+ ERROR_TYPES,
5
+ hasProperties
6
+ } = require('../utils/element');
3
7
  const { reportErrors } = require('../utils/reporter');
4
8
 
5
9
  const { skipInNonExecutableProcess } = require('../utils/rule');
10
+ const { greaterOrEqual } = require('../utils/version');
6
11
 
7
- module.exports = skipInNonExecutableProcess(function() {
12
+ const COMPLETION_ALLOWED_VERSION = '8.8';
13
+
14
+ module.exports = skipInNonExecutableProcess(function({ version }) {
8
15
  function check(node, reporter) {
9
16
  if (!is(node, 'bpmn:AdHocSubProcess')) {
10
17
  return;
11
18
  }
12
19
 
13
- // Ad-Hoc Sub-Process must contain at least one activity
14
- if (node.get('flowElements').some(isActivity)) {
15
- return;
20
+ const errors = [];
21
+
22
+ // ad-hoc sub-process must contain at least one activity
23
+ if (!node.get('flowElements').some(isActivity)) {
24
+ errors.push({
25
+ message: 'Element of type <bpmn:AdHocSubProcess> must contain at least one activity',
26
+ data: {
27
+ type: ERROR_TYPES.CHILD_ELEMENT_OF_TYPE_REQUIRED,
28
+ node,
29
+ parentNode: null,
30
+ requiredType: 'bpmn:Activity'
31
+ }
32
+ });
16
33
  }
17
34
 
18
- reportErrors(node, reporter, {
19
- message: 'Element of type <bpmn:AdHocSubProcess> must contain at least one activity',
20
- data: {
21
- node,
22
- parentNode: null
23
- }
24
- });
35
+ if (!greaterOrEqual(version, COMPLETION_ALLOWED_VERSION)) {
36
+ errors.push(...hasProperties(node, {
37
+ completionCondition: {
38
+ allowed: false,
39
+ allowedVersion: COMPLETION_ALLOWED_VERSION
40
+ },
41
+ cancelRemainingInstances: {
42
+ allowed: value => value !== false, // only allow true which is default value
43
+ allowedVersion: COMPLETION_ALLOWED_VERSION
44
+ }
45
+ }, node));
46
+ }
47
+
48
+ if (errors.length) {
49
+ reportErrors(node, reporter, errors);
50
+ }
25
51
  }
26
52
 
27
53
  return {
@@ -30,5 +56,5 @@ module.exports = skipInNonExecutableProcess(function() {
30
56
  });
31
57
 
32
58
  function isActivity(element) {
33
- return isAny(element, [ 'bpmn:Task', 'bpmn:SubProcess' ]);
34
- }
59
+ return is(element, 'bpmn:Activity');
60
+ }
@@ -15,7 +15,7 @@ const { skipInNonExecutableProcess } = require('../utils/rule');
15
15
  const { greaterOrEqual } = require('../utils/version');
16
16
  const { annotateRule } = require('../helper');
17
17
 
18
- const noErrorRefAllowedVersion = '8.2';
18
+ const NO_ERROR_REF_ALLOWED_VERSION = '8.2';
19
19
 
20
20
  module.exports = skipInNonExecutableProcess(function({ version }) {
21
21
  function check(node, reporter) {
@@ -69,5 +69,5 @@ module.exports = skipInNonExecutableProcess(function({ version }) {
69
69
  });
70
70
 
71
71
  function isNoErrorRefAllowed(node, version) {
72
- return is(node, 'bpmn:CatchEvent') && greaterOrEqual(version, noErrorRefAllowedVersion);
72
+ return is(node, 'bpmn:CatchEvent') && greaterOrEqual(version, NO_ERROR_REF_ALLOWED_VERSION);
73
73
  }
@@ -5,7 +5,6 @@ const {
5
5
 
6
6
  const {
7
7
  getEventDefinition,
8
- isAnyExactly
9
8
  } = require('../utils/element');
10
9
 
11
10
  const { ERROR_TYPES } = require('../utils/error-types');
@@ -28,7 +27,7 @@ module.exports = skipInNonExecutableProcess(function() {
28
27
 
29
28
  const attachedToRef = node.get('attachedToRef');
30
29
 
31
- if (attachedToRef && !isAnyExactly(attachedToRef, [ 'bpmn:CallActivity', 'bpmn:SubProcess' ])) {
30
+ if (attachedToRef && is(attachedToRef, 'bpmn:Task')) {
32
31
  reportErrors(node, reporter, {
33
32
  message: `Element of type <bpmn:BoundaryEvent> with event definition of type <bpmn:EscalationEventDefinition> is not allowed to be attached to element of type <${ attachedToRef.$type }>`,
34
33
  path: null,
@@ -7,7 +7,6 @@ const { reportErrors } = require('../utils/reporter');
7
7
 
8
8
  const { skipInNonExecutableProcess } = require('../utils/rule');
9
9
 
10
-
11
10
  module.exports = skipInNonExecutableProcess(function() {
12
11
  function check(node, reporter) {
13
12
  const executionListeners = findExtensionElement(node, 'zeebe:ExecutionListeners');
@@ -6,12 +6,12 @@ const { reportErrors } = require('../utils/reporter');
6
6
 
7
7
  const { skipInNonExecutableProcess } = require('../utils/rule');
8
8
 
9
- const allowedVersion = '8.6';
9
+ const ALLOWED_VERSION = '8.6';
10
10
 
11
11
  module.exports = skipInNonExecutableProcess(function() {
12
12
  function check(node, reporter) {
13
13
  if (is(node, 'bpmn:Process')) {
14
- const errors = hasNoExtensionElement(node, 'zeebe:VersionTag', node, allowedVersion);
14
+ const errors = hasNoExtensionElement(node, 'zeebe:VersionTag', node, ALLOWED_VERSION);
15
15
 
16
16
  if (errors && errors.length) {
17
17
  reportErrors(node, reporter, errors);
@@ -16,7 +16,7 @@ const { skipInNonExecutableProcess } = require('../utils/rule');
16
16
 
17
17
  const { greaterOrEqual } = require('../utils/version');
18
18
 
19
- const allowedVersion = '8.3';
19
+ const ALLOWED_VERSION = '8.3';
20
20
 
21
21
  module.exports = skipInNonExecutableProcess(function({ version }) {
22
22
  function check(node, reporter) {
@@ -25,8 +25,8 @@ module.exports = skipInNonExecutableProcess(function({ version }) {
25
25
  }
26
26
 
27
27
  // Camunda 8.2 and older
28
- if (!greaterOrEqual(version, allowedVersion)) {
29
- let errors = hasNoExtensionElement(node, 'zeebe:FormDefinition', node, allowedVersion);
28
+ if (!greaterOrEqual(version, ALLOWED_VERSION)) {
29
+ let errors = hasNoExtensionElement(node, 'zeebe:FormDefinition', node, ALLOWED_VERSION);
30
30
 
31
31
  if (errors.length) {
32
32
  reportErrors(node, reporter, errors);
@@ -9,7 +9,6 @@ const { reportErrors } = require('../utils/reporter');
9
9
 
10
10
  const { skipInNonExecutableProcess } = require('../utils/rule');
11
11
 
12
-
13
12
  module.exports = skipInNonExecutableProcess(function() {
14
13
  function check(node, reporter) {
15
14
  if (!is(node, 'bpmn:UserTask')) {
@@ -14,7 +14,7 @@ const { skipInNonExecutableProcess } = require('../utils/rule');
14
14
 
15
15
  const { greaterOrEqual } = require('../utils/version');
16
16
 
17
- const formIdAllowedVersions = {
17
+ const FORM_ID_ALLOWED_VERSIONS = {
18
18
  desktop: '8.4',
19
19
  web: '8.0'
20
20
  };
@@ -55,7 +55,7 @@ module.exports = skipInNonExecutableProcess(function({ modeler = 'desktop', vers
55
55
 
56
56
  let errors;
57
57
 
58
- const formIdAllowedVersion = formIdAllowedVersions[ modeler ];
58
+ const formIdAllowedVersion = FORM_ID_ALLOWED_VERSIONS[ modeler ];
59
59
 
60
60
  if (isFormIdAllowed(version, formIdAllowedVersion)) {
61
61
  errors = hasProperty(formDefinition, [
@@ -1,4 +1,5 @@
1
1
  module.exports.ERROR_TYPES = Object.freeze({
2
+ CHILD_ELEMENT_OF_TYPE_REQUIRED: 'camunda.childElementOfTypeRequired',
2
3
  CHILD_ELEMENT_TYPE_NOT_ALLOWED: 'camunda.childElementTypeNotAllowed',
3
4
  CONNECTORS_PROPERTY_VALUE_NOT_ALLOWED: 'camunda.connectors.propertyValueNotAllowed',
4
5
  ELEMENT_COLLAPSED_NOT_ALLOWED: 'camunda.elementCollapsedNotAllowed',