bpmnlint-plugin-camunda-compat 2.20.2 → 2.21.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 (52) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +39 -39
  3. package/index.js +224 -223
  4. package/package.json +53 -53
  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-task-headers.js +58 -58
  10. package/rules/camunda-cloud/element-type/config.js +66 -66
  11. package/rules/camunda-cloud/element-type/index.js +133 -133
  12. package/rules/camunda-cloud/error-reference.js +71 -71
  13. package/rules/camunda-cloud/escalation-boundary-event-attached-to-ref.js +48 -48
  14. package/rules/camunda-cloud/escalation-reference.js +66 -66
  15. package/rules/camunda-cloud/event-based-gateway-target.js +38 -38
  16. package/rules/camunda-cloud/executable-process.js +61 -61
  17. package/rules/camunda-cloud/feel.js +82 -82
  18. package/rules/camunda-cloud/implementation/config.js +16 -16
  19. package/rules/camunda-cloud/implementation/index.js +218 -218
  20. package/rules/camunda-cloud/inclusive-gateway.js +35 -35
  21. package/rules/camunda-cloud/link-event.js +142 -142
  22. package/rules/camunda-cloud/loop-characteristics.js +66 -66
  23. package/rules/camunda-cloud/message-reference.js +60 -60
  24. package/rules/camunda-cloud/no-candidate-users.js +38 -38
  25. package/rules/camunda-cloud/no-expression.js +173 -173
  26. package/rules/camunda-cloud/no-loop.js +145 -145
  27. package/rules/camunda-cloud/no-multiple-none-start-events.js +41 -41
  28. package/rules/camunda-cloud/no-propagate-all-parent-variables.js +44 -44
  29. package/rules/camunda-cloud/no-signal-event-sub-process.js +45 -45
  30. package/rules/camunda-cloud/no-task-schedule.js +18 -18
  31. package/rules/camunda-cloud/no-template.js +23 -23
  32. package/rules/camunda-cloud/no-zeebe-properties.js +18 -18
  33. package/rules/camunda-cloud/no-zeebe-user-task.js +27 -27
  34. package/rules/camunda-cloud/secrets.js +119 -119
  35. package/rules/camunda-cloud/sequence-flow-condition.js +56 -56
  36. package/rules/camunda-cloud/signal-reference.js +64 -64
  37. package/rules/camunda-cloud/start-event-form.js +97 -97
  38. package/rules/camunda-cloud/subscription.js +65 -65
  39. package/rules/camunda-cloud/task-schedule.js +67 -67
  40. package/rules/camunda-cloud/timer/config.js +46 -46
  41. package/rules/camunda-cloud/timer/index.js +183 -183
  42. package/rules/camunda-cloud/user-task-definition.js +24 -24
  43. package/rules/camunda-cloud/user-task-form.js +142 -142
  44. package/rules/camunda-cloud/wait-for-completion.js +46 -46
  45. package/rules/camunda-platform/history-time-to-live.js +19 -19
  46. package/rules/utils/cron.js +95 -95
  47. package/rules/utils/element.js +484 -484
  48. package/rules/utils/error-types.js +24 -24
  49. package/rules/utils/iso8601.js +52 -52
  50. package/rules/utils/reporter.js +37 -37
  51. package/rules/utils/rule.js +46 -46
  52. package/rules/utils/version.js +4 -4
@@ -1,67 +1,67 @@
1
- const {
2
- is,
3
- isAny
4
- } = require('bpmnlint-utils');
5
-
6
- const {
7
- getEventDefinition,
8
- hasProperties
9
- } = require('../utils/element');
10
-
11
- const { reportErrors } = require('../utils/reporter');
12
-
13
- const { skipInNonExecutableProcess } = require('../utils/rule');
14
-
15
- module.exports = skipInNonExecutableProcess(function() {
16
- function check(node, reporter) {
17
- if (!isAny(node, [ 'bpmn:CatchEvent', 'bpmn:ThrowEvent' ])) {
18
- return;
19
- }
20
-
21
- const eventDefinition = getEventDefinition(node);
22
-
23
- if (!eventDefinition || !is(eventDefinition, 'bpmn:EscalationEventDefinition')) {
24
- return;
25
- }
26
-
27
- let errors = [];
28
-
29
- if (!isNoEscalationRefAllowed(node)) {
30
- errors = hasProperties(eventDefinition, {
31
- escalationRef: {
32
- required: true
33
- }
34
- }, node);
35
-
36
- if (errors.length) {
37
- reportErrors(node, reporter, errors);
38
-
39
- return;
40
- }
41
- }
42
-
43
- const escalationRef = eventDefinition.get('escalationRef');
44
-
45
- if (!escalationRef) {
46
- return;
47
- }
48
-
49
- errors = hasProperties(escalationRef, {
50
- escalationCode: {
51
- required: true
52
- }
53
- }, node);
54
-
55
- if (errors.length) {
56
- reportErrors(node, reporter, errors);
57
- }
58
- }
59
-
60
- return {
61
- check
62
- };
63
- });
64
-
65
- function isNoEscalationRefAllowed(node) {
66
- return isAny(node, [ 'bpmn:CatchEvent', 'bpmn:BoundaryEvent' ]);
1
+ const {
2
+ is,
3
+ isAny
4
+ } = require('bpmnlint-utils');
5
+
6
+ const {
7
+ getEventDefinition,
8
+ hasProperties
9
+ } = require('../utils/element');
10
+
11
+ const { reportErrors } = require('../utils/reporter');
12
+
13
+ const { skipInNonExecutableProcess } = require('../utils/rule');
14
+
15
+ module.exports = skipInNonExecutableProcess(function() {
16
+ function check(node, reporter) {
17
+ if (!isAny(node, [ 'bpmn:CatchEvent', 'bpmn:ThrowEvent' ])) {
18
+ return;
19
+ }
20
+
21
+ const eventDefinition = getEventDefinition(node);
22
+
23
+ if (!eventDefinition || !is(eventDefinition, 'bpmn:EscalationEventDefinition')) {
24
+ return;
25
+ }
26
+
27
+ let errors = [];
28
+
29
+ if (!isNoEscalationRefAllowed(node)) {
30
+ errors = hasProperties(eventDefinition, {
31
+ escalationRef: {
32
+ required: true
33
+ }
34
+ }, node);
35
+
36
+ if (errors.length) {
37
+ reportErrors(node, reporter, errors);
38
+
39
+ return;
40
+ }
41
+ }
42
+
43
+ const escalationRef = eventDefinition.get('escalationRef');
44
+
45
+ if (!escalationRef) {
46
+ return;
47
+ }
48
+
49
+ errors = hasProperties(escalationRef, {
50
+ escalationCode: {
51
+ required: true
52
+ }
53
+ }, node);
54
+
55
+ if (errors.length) {
56
+ reportErrors(node, reporter, errors);
57
+ }
58
+ }
59
+
60
+ return {
61
+ check
62
+ };
63
+ });
64
+
65
+ function isNoEscalationRefAllowed(node) {
66
+ return isAny(node, [ 'bpmn:CatchEvent', 'bpmn:BoundaryEvent' ]);
67
67
  }
@@ -1,39 +1,39 @@
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(node, reporter) {
11
- if (!is(node, 'bpmn:ReceiveTask')) {
12
- return;
13
- }
14
-
15
- // receive task as event-based gateway target is allowed by BPMN 2.0 but not
16
- // supported by Zeebe
17
- const error = node.get('incoming').some((sequenceFlow) => {
18
- const source = sequenceFlow.get('sourceRef');
19
-
20
- return is(source, 'bpmn:EventBasedGateway');
21
- });
22
-
23
- if (error) {
24
- reportErrors(node, reporter, {
25
- message: 'Element of type <bpmn:ReceiveTask> not allowed as event-based gateway target',
26
- path: null,
27
- data: {
28
- type: ERROR_TYPES.EVENT_BASED_GATEWAY_TARGET_NOT_ALLOWED,
29
- node,
30
- parentNode: null
31
- }
32
- });
33
- }
34
- }
35
-
36
- return {
37
- check
38
- };
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(node, reporter) {
11
+ if (!is(node, 'bpmn:ReceiveTask')) {
12
+ return;
13
+ }
14
+
15
+ // receive task as event-based gateway target is allowed by BPMN 2.0 but not
16
+ // supported by Zeebe
17
+ const error = node.get('incoming').some((sequenceFlow) => {
18
+ const source = sequenceFlow.get('sourceRef');
19
+
20
+ return is(source, 'bpmn:EventBasedGateway');
21
+ });
22
+
23
+ if (error) {
24
+ reportErrors(node, reporter, {
25
+ message: 'Element of type <bpmn:ReceiveTask> not allowed as event-based gateway target',
26
+ path: null,
27
+ data: {
28
+ type: ERROR_TYPES.EVENT_BASED_GATEWAY_TARGET_NOT_ALLOWED,
29
+ node,
30
+ parentNode: null
31
+ }
32
+ });
33
+ }
34
+ }
35
+
36
+ return {
37
+ check
38
+ };
39
39
  });
@@ -1,62 +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;
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
62
  }
@@ -1,83 +1,83 @@
1
- const { isString } = require('min-dash');
2
-
3
- const { is } = require('bpmnlint-utils');
4
-
5
- const { lintExpression } = require('@bpmn-io/feel-lint');
6
-
7
- const { getPath } = require('@bpmn-io/moddle-utils');
8
-
9
- const { reportErrors } = require('../utils/reporter');
10
-
11
- const { ERROR_TYPES } = require('../utils/error-types');
12
-
13
- const { skipInNonExecutableProcess } = require('../utils/rule');
14
-
15
- module.exports = skipInNonExecutableProcess(function() {
16
- function check(node, reporter) {
17
- if (is(node, 'bpmn:Expression')) {
18
- return;
19
- }
20
-
21
- const parentNode = findFlowElement(node);
22
-
23
- if (!parentNode) {
24
- return;
25
- }
26
-
27
- const errors = [];
28
-
29
- Object.entries(node).forEach(([ propertyName, propertyValue ]) => {
30
- if (propertyValue && is(propertyValue, 'bpmn:Expression')) {
31
- propertyValue = propertyValue.get('body');
32
- }
33
-
34
- if (isFeelProperty([ propertyName, propertyValue ])) {
35
- const lintErrors = lintExpression(propertyValue.substring(1));
36
-
37
- // syntax error
38
- if (lintErrors.find(({ type }) => type === 'Syntax Error')) {
39
- const path = getPath(node, parentNode);
40
-
41
- errors.push(
42
- {
43
- message: `Property <${ propertyName }> is not a valid FEEL expression`,
44
- path: path
45
- ? [ ...path, propertyName ]
46
- : [ propertyName ],
47
- data: {
48
- type: ERROR_TYPES.FEEL_EXPRESSION_INVALID,
49
- node,
50
- parentNode,
51
- property: propertyName
52
- }
53
- }
54
- );
55
- }
56
- }
57
- });
58
-
59
- if (errors && errors.length) {
60
- reportErrors(parentNode, reporter, errors);
61
- }
62
- }
63
-
64
- return {
65
- check
66
- };
67
- });
68
-
69
- const isFeelProperty = ([ propertyName, value ]) => {
70
- return !isIgnoredProperty(propertyName) && isString(value) && value.startsWith('=');
71
- };
72
-
73
- const isIgnoredProperty = propertyName => {
74
- return propertyName.startsWith('$');
75
- };
76
-
77
- const findFlowElement = node => {
78
- while (node && !is(node, 'bpmn:FlowElement')) {
79
- node = node.$parent;
80
- }
81
-
82
- return node;
1
+ const { isString } = require('min-dash');
2
+
3
+ const { is } = require('bpmnlint-utils');
4
+
5
+ const { lintExpression } = require('@bpmn-io/feel-lint');
6
+
7
+ const { getPath } = require('@bpmn-io/moddle-utils');
8
+
9
+ const { reportErrors } = require('../utils/reporter');
10
+
11
+ const { ERROR_TYPES } = require('../utils/error-types');
12
+
13
+ const { skipInNonExecutableProcess } = require('../utils/rule');
14
+
15
+ module.exports = skipInNonExecutableProcess(function() {
16
+ function check(node, reporter) {
17
+ if (is(node, 'bpmn:Expression')) {
18
+ return;
19
+ }
20
+
21
+ const parentNode = findFlowElement(node);
22
+
23
+ if (!parentNode) {
24
+ return;
25
+ }
26
+
27
+ const errors = [];
28
+
29
+ Object.entries(node).forEach(([ propertyName, propertyValue ]) => {
30
+ if (propertyValue && is(propertyValue, 'bpmn:Expression')) {
31
+ propertyValue = propertyValue.get('body');
32
+ }
33
+
34
+ if (isFeelProperty([ propertyName, propertyValue ])) {
35
+ const lintErrors = lintExpression(propertyValue.substring(1));
36
+
37
+ // syntax error
38
+ if (lintErrors.find(({ type }) => type === 'Syntax Error')) {
39
+ const path = getPath(node, parentNode);
40
+
41
+ errors.push(
42
+ {
43
+ message: `Property <${ propertyName }> is not a valid FEEL expression`,
44
+ path: path
45
+ ? [ ...path, propertyName ]
46
+ : [ propertyName ],
47
+ data: {
48
+ type: ERROR_TYPES.FEEL_EXPRESSION_INVALID,
49
+ node,
50
+ parentNode,
51
+ property: propertyName
52
+ }
53
+ }
54
+ );
55
+ }
56
+ }
57
+ });
58
+
59
+ if (errors && errors.length) {
60
+ reportErrors(parentNode, reporter, errors);
61
+ }
62
+ }
63
+
64
+ return {
65
+ check
66
+ };
67
+ });
68
+
69
+ const isFeelProperty = ([ propertyName, value ]) => {
70
+ return !isIgnoredProperty(propertyName) && isString(value) && value.startsWith('=');
71
+ };
72
+
73
+ const isIgnoredProperty = propertyName => {
74
+ return propertyName.startsWith('$');
75
+ };
76
+
77
+ const findFlowElement = node => {
78
+ while (node && !is(node, 'bpmn:FlowElement')) {
79
+ node = node.$parent;
80
+ }
81
+
82
+ return node;
83
83
  };
@@ -1,17 +1,17 @@
1
- module.exports = {
2
- calledDecision: {
3
- 'bpmn:BusinessRuleTask': '1.3'
4
- },
5
- taskDefinition: {
6
- 'bpmn:BusinessRuleTask': '1.1',
7
- 'bpmn:IntermediateThrowEvent': {
8
- 'bpmn:MessageEventDefinition': '1.2'
9
- },
10
- 'bpmn:ScriptTask': '1.1',
11
- 'bpmn:SendTask': '1.1',
12
- 'bpmn:ServiceTask': '1.0'
13
- },
14
- script: {
15
- 'bpmn:ScriptTask': '8.2'
16
- }
1
+ module.exports = {
2
+ calledDecision: {
3
+ 'bpmn:BusinessRuleTask': '1.3'
4
+ },
5
+ taskDefinition: {
6
+ 'bpmn:BusinessRuleTask': '1.1',
7
+ 'bpmn:IntermediateThrowEvent': {
8
+ 'bpmn:MessageEventDefinition': '1.2'
9
+ },
10
+ 'bpmn:ScriptTask': '1.1',
11
+ 'bpmn:SendTask': '1.1',
12
+ 'bpmn:ServiceTask': '1.0'
13
+ },
14
+ script: {
15
+ 'bpmn:ScriptTask': '8.2'
16
+ }
17
17
  };