bpmnlint-plugin-camunda-compat 2.11.1 → 2.13.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.
package/index.js
CHANGED
@@ -20,7 +20,7 @@ const camundaCloud10Rules = withConfig({
|
|
20
20
|
'no-template': 'error',
|
21
21
|
'no-zeebe-properties': 'error',
|
22
22
|
'sequence-flow-condition': 'error',
|
23
|
-
'start-form': 'error',
|
23
|
+
'start-event-form': 'error',
|
24
24
|
'subscription': 'error',
|
25
25
|
'timer': 'error',
|
26
26
|
'user-task-form': 'error',
|
@@ -56,15 +56,13 @@ const camundaCloud82Rules = withConfig({
|
|
56
56
|
}, { version: '8.2' });
|
57
57
|
|
58
58
|
const camundaCloud83Rules = withConfig({
|
59
|
-
...omit(camundaCloud82Rules,
|
60
|
-
'start-form',
|
61
|
-
'no-signal-event-sub-process'
|
62
|
-
]),
|
59
|
+
...omit(camundaCloud82Rules, 'no-signal-event-sub-process'),
|
63
60
|
'secrets': 'warn',
|
64
61
|
'signal-reference': 'error'
|
65
62
|
}, { version: '8.3' });
|
66
63
|
|
67
|
-
const camundaCloud84Rules = withConfig(
|
64
|
+
const camundaCloud84Rules = withConfig(
|
65
|
+
omit(camundaCloud83Rules, 'collapsed-subprocess'), { version: '8.4' });
|
68
66
|
|
69
67
|
const camundaPlatform719Rules = withConfig({
|
70
68
|
'history-time-to-live': 'error'
|
@@ -112,7 +110,7 @@ const rules = {
|
|
112
110
|
'secrets': './rules/camunda-cloud/secrets',
|
113
111
|
'sequence-flow-condition': './rules/camunda-cloud/sequence-flow-condition',
|
114
112
|
'signal-reference': './rules/camunda-cloud/signal-reference',
|
115
|
-
'start-form': './rules/camunda-cloud/start-form',
|
113
|
+
'start-event-form': './rules/camunda-cloud/start-event-form',
|
116
114
|
'subscription': './rules/camunda-cloud/subscription',
|
117
115
|
'task-schedule': './rules/camunda-cloud/task-schedule',
|
118
116
|
'timer': './rules/camunda-cloud/timer',
|
package/package.json
CHANGED
@@ -0,0 +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 allowedVersion = '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, allowedVersion)) {
|
29
|
+
let errors = hasNoExtensionElement(node, 'zeebe:FormDefinition', node, allowedVersion);
|
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
|
+
}
|
@@ -14,9 +14,12 @@ const { skipInNonExecutableProcess } = require('../utils/rule');
|
|
14
14
|
|
15
15
|
const { greaterOrEqual } = require('../utils/version');
|
16
16
|
|
17
|
-
const
|
17
|
+
const formIdAllowedVersions = {
|
18
|
+
desktop: '8.4',
|
19
|
+
web: '8.0'
|
20
|
+
};
|
18
21
|
|
19
|
-
module.exports = skipInNonExecutableProcess(function({ version }) {
|
22
|
+
module.exports = skipInNonExecutableProcess(function({ modeler = 'desktop', version }) {
|
20
23
|
function check(node, reporter) {
|
21
24
|
if (!is(node, 'bpmn:UserTask')) {
|
22
25
|
return;
|
@@ -30,16 +33,14 @@ module.exports = skipInNonExecutableProcess(function({ version }) {
|
|
30
33
|
|
31
34
|
let errors = [];
|
32
35
|
|
33
|
-
|
36
|
+
const formIdAllowedVersion = formIdAllowedVersions[ modeler ];
|
34
37
|
|
35
|
-
|
38
|
+
if (isFormIdAllowed(version, formIdAllowedVersion)) {
|
36
39
|
errors = hasProperty(formDefinition, [
|
37
40
|
'formKey',
|
38
41
|
'formId'
|
39
42
|
], node);
|
40
43
|
} else {
|
41
|
-
|
42
|
-
// Camunda 8.2 and older
|
43
44
|
errors = hasProperties(formDefinition, {
|
44
45
|
formId: {
|
45
46
|
allowed: false,
|
@@ -110,6 +111,6 @@ function findUserTaskForm(node, formKey) {
|
|
110
111
|
}
|
111
112
|
}
|
112
113
|
|
113
|
-
function isFormIdAllowed(version) {
|
114
|
+
function isFormIdAllowed(version, formIdAllowedVersion) {
|
114
115
|
return greaterOrEqual(version, formIdAllowedVersion);
|
115
116
|
}
|
@@ -1,29 +0,0 @@
|
|
1
|
-
const { is } = require('bpmnlint-utils');
|
2
|
-
|
3
|
-
const { hasNoExtensionElement } = require('../utils/element');
|
4
|
-
|
5
|
-
const { reportErrors } = require('../utils/reporter');
|
6
|
-
|
7
|
-
const { skipInNonExecutableProcess } = require('../utils/rule');
|
8
|
-
|
9
|
-
const { greaterOrEqual } = require('../utils/version');
|
10
|
-
|
11
|
-
const startFormAllowedVersion = '8.3';
|
12
|
-
|
13
|
-
module.exports = skipInNonExecutableProcess(function({ version }) {
|
14
|
-
function check(node, reporter) {
|
15
|
-
if (!is(node, 'bpmn:StartEvent') || greaterOrEqual(version, startFormAllowedVersion)) {
|
16
|
-
return;
|
17
|
-
}
|
18
|
-
|
19
|
-
let errors = hasNoExtensionElement(node, 'zeebe:FormDefinition', node, startFormAllowedVersion);
|
20
|
-
|
21
|
-
if (errors.length) {
|
22
|
-
reportErrors(node, reporter, errors);
|
23
|
-
}
|
24
|
-
}
|
25
|
-
|
26
|
-
return {
|
27
|
-
check
|
28
|
-
};
|
29
|
-
});
|