bpmnlint-plugin-camunda-compat 2.36.0 → 2.37.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 (64) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +88 -39
  3. package/index.js +286 -286
  4. package/package.json +53 -53
  5. package/rules/camunda-cloud/ad-hoc-sub-process.js +60 -60
  6. package/rules/camunda-cloud/called-element.js +44 -44
  7. package/rules/camunda-cloud/collapsed-subprocess.js +40 -40
  8. package/rules/camunda-cloud/connector-properties/config.js +90 -90
  9. package/rules/camunda-cloud/connector-properties/index.js +47 -47
  10. package/rules/camunda-cloud/duplicate-execution-listeners.js +33 -33
  11. package/rules/camunda-cloud/duplicate-task-headers.js +58 -58
  12. package/rules/camunda-cloud/element-type/config.js +67 -67
  13. package/rules/camunda-cloud/element-type/index.js +135 -135
  14. package/rules/camunda-cloud/error-reference.js +72 -72
  15. package/rules/camunda-cloud/escalation-boundary-event-attached-to-ref.js +47 -47
  16. package/rules/camunda-cloud/escalation-reference.js +67 -67
  17. package/rules/camunda-cloud/event-based-gateway-target.js +38 -38
  18. package/rules/camunda-cloud/executable-process.js +61 -61
  19. package/rules/camunda-cloud/execution-listener.js +33 -33
  20. package/rules/camunda-cloud/feel.js +88 -86
  21. package/rules/camunda-cloud/implementation/config.js +19 -19
  22. package/rules/camunda-cloud/implementation/index.js +218 -218
  23. package/rules/camunda-cloud/inclusive-gateway.js +35 -35
  24. package/rules/camunda-cloud/link-event.js +142 -142
  25. package/rules/camunda-cloud/loop-characteristics.js +66 -66
  26. package/rules/camunda-cloud/message-reference.js +61 -61
  27. package/rules/camunda-cloud/no-binding-type.js +43 -43
  28. package/rules/camunda-cloud/no-candidate-users.js +38 -38
  29. package/rules/camunda-cloud/no-execution-listeners.js +21 -21
  30. package/rules/camunda-cloud/no-expression.js +173 -173
  31. package/rules/camunda-cloud/no-loop.js +316 -316
  32. package/rules/camunda-cloud/no-multiple-none-start-events.js +41 -41
  33. package/rules/camunda-cloud/no-priority-definition.js +18 -18
  34. package/rules/camunda-cloud/no-propagate-all-parent-variables.js +44 -44
  35. package/rules/camunda-cloud/no-signal-event-sub-process.js +45 -45
  36. package/rules/camunda-cloud/no-task-listeners.js +21 -21
  37. package/rules/camunda-cloud/no-task-schedule.js +18 -18
  38. package/rules/camunda-cloud/no-template.js +23 -23
  39. package/rules/camunda-cloud/no-version-tag.js +24 -24
  40. package/rules/camunda-cloud/no-zeebe-properties.js +18 -18
  41. package/rules/camunda-cloud/no-zeebe-user-task.js +27 -27
  42. package/rules/camunda-cloud/priority-definition.js +61 -61
  43. package/rules/camunda-cloud/secrets.js +119 -119
  44. package/rules/camunda-cloud/sequence-flow-condition.js +56 -56
  45. package/rules/camunda-cloud/signal-reference.js +64 -64
  46. package/rules/camunda-cloud/start-event-form.js +97 -97
  47. package/rules/camunda-cloud/subscription.js +65 -65
  48. package/rules/camunda-cloud/task-listener.js +39 -39
  49. package/rules/camunda-cloud/task-schedule.js +67 -67
  50. package/rules/camunda-cloud/timer/config.js +46 -46
  51. package/rules/camunda-cloud/timer/index.js +183 -183
  52. package/rules/camunda-cloud/user-task-definition.js +24 -24
  53. package/rules/camunda-cloud/user-task-form.js +142 -142
  54. package/rules/camunda-cloud/wait-for-completion.js +46 -46
  55. package/rules/camunda-cloud/zeebe-user-task.js +30 -30
  56. package/rules/camunda-platform/history-time-to-live.js +24 -24
  57. package/rules/helper.js +38 -38
  58. package/rules/utils/cron.js +95 -95
  59. package/rules/utils/element.js +533 -533
  60. package/rules/utils/error-types.js +26 -26
  61. package/rules/utils/iso8601.js +52 -52
  62. package/rules/utils/reporter.js +37 -37
  63. package/rules/utils/rule.js +46 -46
  64. package/rules/utils/version.js +4 -4
@@ -1,98 +1,98 @@
1
- const { is } = require('bpmnlint-utils');
2
-
3
- const {
4
- findExtensionElement,
5
- findExtensionElements,
6
- findParent,
7
- hasProperties,
8
- hasProperty
9
- } = require('../utils/element');
10
-
11
- const { hasNoExtensionElement } = require('../utils/element');
12
-
13
- const { reportErrors } = require('../utils/reporter');
14
-
15
- const { skipInNonExecutableProcess } = require('../utils/rule');
16
-
17
- const { greaterOrEqual } = require('../utils/version');
18
-
19
- const ALLOWED_VERSION = '8.3';
20
-
21
- module.exports = skipInNonExecutableProcess(function({ version }) {
22
- function check(node, reporter) {
23
- if (!is(node, 'bpmn:StartEvent')) {
24
- return;
25
- }
26
-
27
- // Camunda 8.2 and older
28
- if (!greaterOrEqual(version, ALLOWED_VERSION)) {
29
- let errors = hasNoExtensionElement(node, 'zeebe:FormDefinition', node, ALLOWED_VERSION);
30
-
31
- if (errors.length) {
32
- reportErrors(node, reporter, errors);
33
- }
34
-
35
- return;
36
- }
37
-
38
- // Camunda 8.3 and newer
39
- const formDefinition = findExtensionElement(node, 'zeebe:FormDefinition');
40
-
41
- if (!formDefinition) {
42
- return;
43
- }
44
-
45
- let errors = hasProperty(formDefinition, [
46
- 'formKey',
47
- 'formId'
48
- ], node);
49
-
50
- if (errors.length) {
51
- reportErrors(node, reporter, errors);
52
-
53
- return;
54
- }
55
-
56
- const formKey = formDefinition.get('formKey');
57
-
58
- const userTaskForm = findUserTaskForm(node, formKey);
59
-
60
- if (!userTaskForm) {
61
- return;
62
- }
63
-
64
- errors = hasProperties(userTaskForm, {
65
- body: {
66
- required: true
67
- }
68
- }, node);
69
-
70
- if (errors.length) {
71
- reportErrors(node, reporter, errors);
72
- }
73
- }
74
-
75
- return {
76
- check
77
- };
78
- });
79
-
80
- // helpers //////////
81
-
82
- function findUserTaskForm(node, formKey) {
83
- const process = findParent(node, 'bpmn:Process');
84
-
85
- if (!process) {
86
- return;
87
- }
88
-
89
- const userTaskForms = findExtensionElements(process, 'zeebe:UserTaskForm');
90
-
91
- if (userTaskForms && userTaskForms.length) {
92
- return userTaskForms.find(userTaskForm => {
93
- const id = userTaskForm.get('id');
94
-
95
- return `camunda-forms:bpmn:${ id }` === formKey;
96
- });
97
- }
1
+ const { is } = require('bpmnlint-utils');
2
+
3
+ const {
4
+ findExtensionElement,
5
+ findExtensionElements,
6
+ findParent,
7
+ hasProperties,
8
+ hasProperty
9
+ } = require('../utils/element');
10
+
11
+ const { hasNoExtensionElement } = require('../utils/element');
12
+
13
+ const { reportErrors } = require('../utils/reporter');
14
+
15
+ const { skipInNonExecutableProcess } = require('../utils/rule');
16
+
17
+ const { greaterOrEqual } = require('../utils/version');
18
+
19
+ const ALLOWED_VERSION = '8.3';
20
+
21
+ module.exports = skipInNonExecutableProcess(function({ version }) {
22
+ function check(node, reporter) {
23
+ if (!is(node, 'bpmn:StartEvent')) {
24
+ return;
25
+ }
26
+
27
+ // Camunda 8.2 and older
28
+ if (!greaterOrEqual(version, ALLOWED_VERSION)) {
29
+ let errors = hasNoExtensionElement(node, 'zeebe:FormDefinition', node, ALLOWED_VERSION);
30
+
31
+ if (errors.length) {
32
+ reportErrors(node, reporter, errors);
33
+ }
34
+
35
+ return;
36
+ }
37
+
38
+ // Camunda 8.3 and newer
39
+ const formDefinition = findExtensionElement(node, 'zeebe:FormDefinition');
40
+
41
+ if (!formDefinition) {
42
+ return;
43
+ }
44
+
45
+ let errors = hasProperty(formDefinition, [
46
+ 'formKey',
47
+ 'formId'
48
+ ], node);
49
+
50
+ if (errors.length) {
51
+ reportErrors(node, reporter, errors);
52
+
53
+ return;
54
+ }
55
+
56
+ const formKey = formDefinition.get('formKey');
57
+
58
+ const userTaskForm = findUserTaskForm(node, formKey);
59
+
60
+ if (!userTaskForm) {
61
+ return;
62
+ }
63
+
64
+ errors = hasProperties(userTaskForm, {
65
+ body: {
66
+ required: true
67
+ }
68
+ }, node);
69
+
70
+ if (errors.length) {
71
+ reportErrors(node, reporter, errors);
72
+ }
73
+ }
74
+
75
+ return {
76
+ check
77
+ };
78
+ });
79
+
80
+ // helpers //////////
81
+
82
+ function findUserTaskForm(node, formKey) {
83
+ const process = findParent(node, 'bpmn:Process');
84
+
85
+ if (!process) {
86
+ return;
87
+ }
88
+
89
+ const userTaskForms = findExtensionElements(process, 'zeebe:UserTaskForm');
90
+
91
+ if (userTaskForms && userTaskForms.length) {
92
+ return userTaskForms.find(userTaskForm => {
93
+ const id = userTaskForm.get('id');
94
+
95
+ return `camunda-forms:bpmn:${ id }` === formKey;
96
+ });
97
+ }
98
98
  }
@@ -1,66 +1,66 @@
1
- const {
2
- is,
3
- isAny
4
- } = require('bpmnlint-utils');
5
-
6
- const {
7
- findExtensionElement,
8
- getEventDefinition,
9
- hasExtensionElement,
10
- hasProperties
11
- } = require('../utils/element');
12
-
13
- const { reportErrors } = require('../utils/reporter');
14
-
15
- const { skipInNonExecutableProcess } = require('../utils/rule');
16
-
17
- module.exports = skipInNonExecutableProcess(function() {
18
- function check(node, reporter) {
19
- if (!isAny(node, [ 'bpmn:CatchEvent', 'bpmn:ThrowEvent', 'bpmn:ReceiveTask' ])
20
- || (is(node, 'bpmn:StartEvent') && !is(node.$parent, 'bpmn:SubProcess'))) {
21
- return;
22
- }
23
-
24
- let eventDefinitionOrReceiveTask = node;
25
-
26
- if (!is(node, 'bpmn:ReceiveTask')) {
27
- const eventDefinition = getEventDefinition(node);
28
-
29
- if (!eventDefinition || !is(eventDefinition, 'bpmn:MessageEventDefinition')) {
30
- return;
31
- }
32
-
33
- eventDefinitionOrReceiveTask = eventDefinition;
34
- }
35
-
36
- const messageRef = eventDefinitionOrReceiveTask.get('messageRef');
37
-
38
- if (!messageRef) {
39
- return;
40
- }
41
-
42
- let errors = hasExtensionElement(messageRef, 'zeebe:Subscription', node);
43
-
44
- if (errors && errors.length) {
45
- reportErrors(node, reporter, errors);
46
-
47
- return;
48
- }
49
-
50
- const subscription = findExtensionElement(messageRef, 'zeebe:Subscription');
51
-
52
- errors = hasProperties(subscription, {
53
- correlationKey: {
54
- required: true
55
- }
56
- }, node);
57
-
58
- if (errors && errors.length) {
59
- reportErrors(node, reporter, errors);
60
- }
61
- }
62
-
63
- return {
64
- check
65
- };
1
+ const {
2
+ is,
3
+ isAny
4
+ } = require('bpmnlint-utils');
5
+
6
+ const {
7
+ findExtensionElement,
8
+ getEventDefinition,
9
+ hasExtensionElement,
10
+ hasProperties
11
+ } = require('../utils/element');
12
+
13
+ const { reportErrors } = require('../utils/reporter');
14
+
15
+ const { skipInNonExecutableProcess } = require('../utils/rule');
16
+
17
+ module.exports = skipInNonExecutableProcess(function() {
18
+ function check(node, reporter) {
19
+ if (!isAny(node, [ 'bpmn:CatchEvent', 'bpmn:ThrowEvent', 'bpmn:ReceiveTask' ])
20
+ || (is(node, 'bpmn:StartEvent') && !is(node.$parent, 'bpmn:SubProcess'))) {
21
+ return;
22
+ }
23
+
24
+ let eventDefinitionOrReceiveTask = node;
25
+
26
+ if (!is(node, 'bpmn:ReceiveTask')) {
27
+ const eventDefinition = getEventDefinition(node);
28
+
29
+ if (!eventDefinition || !is(eventDefinition, 'bpmn:MessageEventDefinition')) {
30
+ return;
31
+ }
32
+
33
+ eventDefinitionOrReceiveTask = eventDefinition;
34
+ }
35
+
36
+ const messageRef = eventDefinitionOrReceiveTask.get('messageRef');
37
+
38
+ if (!messageRef) {
39
+ return;
40
+ }
41
+
42
+ let errors = hasExtensionElement(messageRef, 'zeebe:Subscription', node);
43
+
44
+ if (errors && errors.length) {
45
+ reportErrors(node, reporter, errors);
46
+
47
+ return;
48
+ }
49
+
50
+ const subscription = findExtensionElement(messageRef, 'zeebe:Subscription');
51
+
52
+ errors = hasProperties(subscription, {
53
+ correlationKey: {
54
+ required: true
55
+ }
56
+ }, node);
57
+
58
+ if (errors && errors.length) {
59
+ reportErrors(node, reporter, errors);
60
+ }
61
+ }
62
+
63
+ return {
64
+ check
65
+ };
66
66
  });
@@ -1,39 +1,39 @@
1
- const { is } = require('bpmnlint-utils');
2
-
3
- const {
4
- findExtensionElement,
5
- hasProperties
6
- } = require('../utils/element');
7
-
8
- const { reportErrors } = require('../utils/reporter');
9
-
10
- const { skipInNonExecutableProcess } = require('../utils/rule');
11
-
12
- module.exports = skipInNonExecutableProcess(function() {
13
- function check(node, reporter) {
14
- if (!is(node, 'bpmn:UserTask')) {
15
- return;
16
- }
17
-
18
- const taskListeners = findExtensionElement(node, 'zeebe:TaskListeners');
19
-
20
- if (!taskListeners) {
21
- return;
22
- }
23
-
24
- const listeners = taskListeners.get('listeners');
25
- const errors = listeners.flatMap(listener => hasProperties(listener, {
26
- type: {
27
- required: true
28
- }
29
- }, node));
30
-
31
- if (errors.length) {
32
- reportErrors(node, reporter, errors);
33
- }
34
- }
35
-
36
- return {
37
- check
38
- };
39
- });
1
+ const { is } = require('bpmnlint-utils');
2
+
3
+ const {
4
+ findExtensionElement,
5
+ hasProperties
6
+ } = require('../utils/element');
7
+
8
+ const { reportErrors } = require('../utils/reporter');
9
+
10
+ const { skipInNonExecutableProcess } = require('../utils/rule');
11
+
12
+ module.exports = skipInNonExecutableProcess(function() {
13
+ function check(node, reporter) {
14
+ if (!is(node, 'bpmn:UserTask')) {
15
+ return;
16
+ }
17
+
18
+ const taskListeners = findExtensionElement(node, 'zeebe:TaskListeners');
19
+
20
+ if (!taskListeners) {
21
+ return;
22
+ }
23
+
24
+ const listeners = taskListeners.get('listeners');
25
+ const errors = listeners.flatMap(listener => hasProperties(listener, {
26
+ type: {
27
+ required: true
28
+ }
29
+ }, node));
30
+
31
+ if (errors.length) {
32
+ reportErrors(node, reporter, errors);
33
+ }
34
+ }
35
+
36
+ return {
37
+ check
38
+ };
39
+ });
@@ -1,68 +1,68 @@
1
- const { is } = require('bpmnlint-utils');
2
-
3
- const { isDefined } = require('min-dash');
4
-
5
- const {
6
- findExtensionElement,
7
- hasExpression
8
- } = require('../utils/element');
9
-
10
- const { validateDate: validateISO8601Date } = require('../utils/iso8601');
11
-
12
- const { reportErrors } = require('../utils/reporter');
13
-
14
- const { skipInNonExecutableProcess } = require('../utils/rule');
15
-
16
- module.exports = skipInNonExecutableProcess(function() {
17
- function check(node, reporter) {
18
- if (!is(node, 'bpmn:UserTask')) {
19
- return;
20
- }
21
-
22
- const taskSchedule = findExtensionElement(node, 'zeebe:TaskSchedule');
23
-
24
- if (!taskSchedule) {
25
- return;
26
- }
27
-
28
- const dueDate = taskSchedule.get('dueDate');
29
-
30
- let errors = [];
31
-
32
- if (isDefined(dueDate)) {
33
- errors = [
34
- ...errors,
35
- ...hasExpression(taskSchedule, 'dueDate', {
36
- allowed: date => isValidDate(date)
37
- }, node)
38
- ];
39
- }
40
-
41
- const followUpDate = taskSchedule.get('followUpDate');
42
-
43
- if (isDefined(followUpDate)) {
44
- errors = [
45
- ...errors,
46
- ...hasExpression(taskSchedule, 'followUpDate', {
47
- allowed: date => isValidDate(date)
48
- }, node)
49
- ];
50
- }
51
-
52
- if (errors.length) {
53
- reportErrors(node, reporter, errors);
54
- }
55
- }
56
-
57
- return {
58
- check
59
- };
60
- });
61
-
62
- function isValidDate(value) {
63
- return isExpression(value) || validateISO8601Date(value);
64
- }
65
-
66
- function isExpression(value) {
67
- return value.startsWith('=');
1
+ const { is } = require('bpmnlint-utils');
2
+
3
+ const { isDefined } = require('min-dash');
4
+
5
+ const {
6
+ findExtensionElement,
7
+ hasExpression
8
+ } = require('../utils/element');
9
+
10
+ const { validateDate: validateISO8601Date } = require('../utils/iso8601');
11
+
12
+ const { reportErrors } = require('../utils/reporter');
13
+
14
+ const { skipInNonExecutableProcess } = require('../utils/rule');
15
+
16
+ module.exports = skipInNonExecutableProcess(function() {
17
+ function check(node, reporter) {
18
+ if (!is(node, 'bpmn:UserTask')) {
19
+ return;
20
+ }
21
+
22
+ const taskSchedule = findExtensionElement(node, 'zeebe:TaskSchedule');
23
+
24
+ if (!taskSchedule) {
25
+ return;
26
+ }
27
+
28
+ const dueDate = taskSchedule.get('dueDate');
29
+
30
+ let errors = [];
31
+
32
+ if (isDefined(dueDate)) {
33
+ errors = [
34
+ ...errors,
35
+ ...hasExpression(taskSchedule, 'dueDate', {
36
+ allowed: date => isValidDate(date)
37
+ }, node)
38
+ ];
39
+ }
40
+
41
+ const followUpDate = taskSchedule.get('followUpDate');
42
+
43
+ if (isDefined(followUpDate)) {
44
+ errors = [
45
+ ...errors,
46
+ ...hasExpression(taskSchedule, 'followUpDate', {
47
+ allowed: date => isValidDate(date)
48
+ }, node)
49
+ ];
50
+ }
51
+
52
+ if (errors.length) {
53
+ reportErrors(node, reporter, errors);
54
+ }
55
+ }
56
+
57
+ return {
58
+ check
59
+ };
60
+ });
61
+
62
+ function isValidDate(value) {
63
+ return isExpression(value) || validateISO8601Date(value);
64
+ }
65
+
66
+ function isExpression(value) {
67
+ return value.startsWith('=');
68
68
  }
@@ -1,47 +1,47 @@
1
- const { is } = require('bpmnlint-utils');
2
-
3
- module.exports = {
4
- expressionType: {
5
- 'cron': '8.1',
6
- 'iso8601': '1.0'
7
- },
8
- elementType: {
9
- 'bpmn:StartEvent': {
10
- 'timeCycle': (isInterrupting, parent) => {
11
- if (!isInterrupting || !isEventSubProcess(parent)) {
12
- return '1.0';
13
- }
14
-
15
- return null;
16
- },
17
- 'timeDate': () => '1.0',
18
- 'timeDuration': (_, parent) => {
19
- if (isEventSubProcess(parent)) {
20
- return '1.0';
21
- }
22
-
23
- return null;
24
- }
25
- },
26
- 'bpmn:BoundaryEvent': {
27
- 'timeCycle': (cancelActivity) => {
28
- if (!cancelActivity) {
29
- return '1.0';
30
- }
31
-
32
- return null;
33
- },
34
- 'timeDate': () => '8.3',
35
- 'timeDuration': () => '1.0'
36
- },
37
- 'bpmn:IntermediateCatchEvent': {
38
- 'timeCycle': () => null,
39
- 'timeDate': () => '8.3',
40
- 'timeDuration': () => '1.0'
41
- }
42
- }
43
- };
44
-
45
- function isEventSubProcess(element) {
46
- return is(element, 'bpmn:SubProcess') && element.get('triggeredByEvent') === true;
1
+ const { is } = require('bpmnlint-utils');
2
+
3
+ module.exports = {
4
+ expressionType: {
5
+ 'cron': '8.1',
6
+ 'iso8601': '1.0'
7
+ },
8
+ elementType: {
9
+ 'bpmn:StartEvent': {
10
+ 'timeCycle': (isInterrupting, parent) => {
11
+ if (!isInterrupting || !isEventSubProcess(parent)) {
12
+ return '1.0';
13
+ }
14
+
15
+ return null;
16
+ },
17
+ 'timeDate': () => '1.0',
18
+ 'timeDuration': (_, parent) => {
19
+ if (isEventSubProcess(parent)) {
20
+ return '1.0';
21
+ }
22
+
23
+ return null;
24
+ }
25
+ },
26
+ 'bpmn:BoundaryEvent': {
27
+ 'timeCycle': (cancelActivity) => {
28
+ if (!cancelActivity) {
29
+ return '1.0';
30
+ }
31
+
32
+ return null;
33
+ },
34
+ 'timeDate': () => '8.3',
35
+ 'timeDuration': () => '1.0'
36
+ },
37
+ 'bpmn:IntermediateCatchEvent': {
38
+ 'timeCycle': () => null,
39
+ 'timeDate': () => '8.3',
40
+ 'timeDuration': () => '1.0'
41
+ }
42
+ }
43
+ };
44
+
45
+ function isEventSubProcess(element) {
46
+ return is(element, 'bpmn:SubProcess') && element.get('triggeredByEvent') === true;
47
47
  }