bpmnlint-plugin-camunda-compat 2.18.0 → 2.19.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 (50) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +39 -39
  3. package/index.js +221 -208
  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/duplicate-task-headers.js +58 -58
  8. package/rules/camunda-cloud/element-type/config.js +66 -66
  9. package/rules/camunda-cloud/element-type/index.js +133 -133
  10. package/rules/camunda-cloud/error-reference.js +71 -71
  11. package/rules/camunda-cloud/escalation-boundary-event-attached-to-ref.js +48 -48
  12. package/rules/camunda-cloud/escalation-reference.js +66 -66
  13. package/rules/camunda-cloud/event-based-gateway-target.js +38 -38
  14. package/rules/camunda-cloud/executable-process.js +61 -61
  15. package/rules/camunda-cloud/feel.js +82 -82
  16. package/rules/camunda-cloud/implementation/config.js +16 -16
  17. package/rules/camunda-cloud/implementation/index.js +218 -218
  18. package/rules/camunda-cloud/inclusive-gateway.js +35 -35
  19. package/rules/camunda-cloud/link-event.js +142 -142
  20. package/rules/camunda-cloud/loop-characteristics.js +66 -66
  21. package/rules/camunda-cloud/message-reference.js +60 -60
  22. package/rules/camunda-cloud/no-candidate-users.js +38 -38
  23. package/rules/camunda-cloud/no-expression.js +173 -173
  24. package/rules/camunda-cloud/no-loop.js +145 -145
  25. package/rules/camunda-cloud/no-multiple-none-start-events.js +41 -41
  26. package/rules/camunda-cloud/no-propagate-all-parent-variables.js +44 -44
  27. package/rules/camunda-cloud/no-signal-event-sub-process.js +45 -45
  28. package/rules/camunda-cloud/no-task-schedule.js +18 -18
  29. package/rules/camunda-cloud/no-template.js +23 -23
  30. package/rules/camunda-cloud/no-zeebe-properties.js +18 -18
  31. package/rules/camunda-cloud/no-zeebe-user-task.js +27 -27
  32. package/rules/camunda-cloud/secrets.js +119 -119
  33. package/rules/camunda-cloud/sequence-flow-condition.js +56 -56
  34. package/rules/camunda-cloud/signal-reference.js +64 -64
  35. package/rules/camunda-cloud/start-event-form.js +97 -97
  36. package/rules/camunda-cloud/subscription.js +65 -65
  37. package/rules/camunda-cloud/task-schedule.js +67 -67
  38. package/rules/camunda-cloud/timer/config.js +46 -46
  39. package/rules/camunda-cloud/timer/index.js +183 -183
  40. package/rules/camunda-cloud/user-task-definition.js +24 -24
  41. package/rules/camunda-cloud/user-task-form.js +142 -142
  42. package/rules/camunda-cloud/wait-for-completion.js +46 -46
  43. package/rules/camunda-platform/history-time-to-live.js +19 -19
  44. package/rules/utils/cron.js +95 -95
  45. package/rules/utils/element.js +484 -484
  46. package/rules/utils/error-types.js +23 -23
  47. package/rules/utils/iso8601.js +52 -52
  48. package/rules/utils/reporter.js +37 -37
  49. package/rules/utils/rule.js +46 -46
  50. package/rules/utils/version.js +4 -4
@@ -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
  };