bpmnlint-plugin-camunda-compat 0.24.0 → 1.0.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 +1 -0
- package/package.json +1 -1
- package/rules/element-type/config.js +1 -0
- package/rules/element-type/index.js +59 -29
- package/rules/error-reference.js +1 -2
- package/rules/loop-characteristics.js +2 -2
- package/rules/no-expression.js +21 -13
- package/rules/no-signal-event-sub-process.js +45 -0
- package/rules/utils/element.js +6 -6
- package/rules/utils/error-types.js +2 -1
package/index.js
CHANGED
package/package.json
CHANGED
@@ -27,17 +27,27 @@ module.exports = skipInNonExecutableProcess(function({ version }) {
|
|
27
27
|
// (1) Element not allowed
|
28
28
|
const allowedVersion = element || null;
|
29
29
|
|
30
|
+
let message = `Element of type <${ node.$type }> not allowed`;
|
31
|
+
|
32
|
+
let data = {
|
33
|
+
type: ERROR_TYPES.ELEMENT_TYPE_NOT_ALLOWED,
|
34
|
+
node,
|
35
|
+
parentNode: null
|
36
|
+
};
|
37
|
+
|
38
|
+
if (allowedVersion) {
|
39
|
+
message = `Element of type <${ node.$type }> only allowed by Camunda Platform ${ allowedVersion } or newer`;
|
40
|
+
|
41
|
+
data = {
|
42
|
+
...data,
|
43
|
+
allowedVersion
|
44
|
+
};
|
45
|
+
}
|
46
|
+
|
30
47
|
const error = {
|
31
|
-
message
|
32
|
-
? `Element of type <${ node.$type }> only allowed by Camunda Platform ${ allowedVersion } or newer`
|
33
|
-
: `Element of type <${ node.$type }> not allowed`,
|
48
|
+
message,
|
34
49
|
path: null,
|
35
|
-
data
|
36
|
-
type: ERROR_TYPES.ELEMENT_TYPE_NOT_ALLOWED,
|
37
|
-
node,
|
38
|
-
parentNode: null,
|
39
|
-
allowedVersion
|
40
|
-
}
|
50
|
+
data
|
41
51
|
};
|
42
52
|
|
43
53
|
reportErrors(node, reporter, error);
|
@@ -57,18 +67,28 @@ module.exports = skipInNonExecutableProcess(function({ version }) {
|
|
57
67
|
// (2) Element with event definition not allowed
|
58
68
|
const allowedVersion = element[ eventDefinition.$type ] || null;
|
59
69
|
|
70
|
+
let message = `Element of type <${ node.$type }> with event definition of type <${ eventDefinition.$type }> not allowed`;
|
71
|
+
|
72
|
+
let data = {
|
73
|
+
type: ERROR_TYPES.ELEMENT_TYPE_NOT_ALLOWED,
|
74
|
+
node,
|
75
|
+
parentNode: null,
|
76
|
+
eventDefinition
|
77
|
+
};
|
78
|
+
|
79
|
+
if (allowedVersion) {
|
80
|
+
message = `Element of type <${ node.$type }> with event definition of type <${ eventDefinition.$type }> only allowed by Camunda Platform ${ allowedVersion } or newer`;
|
81
|
+
|
82
|
+
data = {
|
83
|
+
...data,
|
84
|
+
allowedVersion
|
85
|
+
};
|
86
|
+
}
|
87
|
+
|
60
88
|
const error = {
|
61
|
-
message
|
62
|
-
? `Element of type <${ node.$type }> with event definition of type <${ eventDefinition.$type }> only allowed by Camunda Platform ${ allowedVersion } or newer`
|
63
|
-
: `Element of type <${ node.$type }> with event definition of type <${ eventDefinition.$type }> not allowed`,
|
89
|
+
message,
|
64
90
|
path: null,
|
65
|
-
data
|
66
|
-
type: ERROR_TYPES.ELEMENT_TYPE_NOT_ALLOWED,
|
67
|
-
node,
|
68
|
-
parentNode: null,
|
69
|
-
eventDefinition,
|
70
|
-
allowedVersion
|
71
|
-
}
|
91
|
+
data
|
72
92
|
};
|
73
93
|
|
74
94
|
reportErrors(node, reporter, error);
|
@@ -79,18 +99,28 @@ module.exports = skipInNonExecutableProcess(function({ version }) {
|
|
79
99
|
// (3) Element without event definition not allowed
|
80
100
|
const allowedVersion = element[ '_' ] || null;
|
81
101
|
|
102
|
+
let message = `Element of type <${ node.$type }> with no event definition not allowed`;
|
103
|
+
|
104
|
+
let data = {
|
105
|
+
type: ERROR_TYPES.ELEMENT_TYPE_NOT_ALLOWED,
|
106
|
+
node,
|
107
|
+
parentNode: null,
|
108
|
+
eventDefinition
|
109
|
+
};
|
110
|
+
|
111
|
+
if (allowedVersion) {
|
112
|
+
message = `Element of type <${ node.$type }> with no event definition only allowed by Camunda Platform ${ allowedVersion } or newer`;
|
113
|
+
|
114
|
+
data = {
|
115
|
+
...data,
|
116
|
+
allowedVersion
|
117
|
+
};
|
118
|
+
}
|
119
|
+
|
82
120
|
const error = {
|
83
|
-
message
|
84
|
-
? `Element of type <${ node.$type }> with no event definition only allowed by Camunda Platform ${ allowedVersion } or newer`
|
85
|
-
: `Element of type <${ node.$type }> with no event definition not allowed`,
|
121
|
+
message,
|
86
122
|
path: null,
|
87
|
-
data
|
88
|
-
type: ERROR_TYPES.ELEMENT_TYPE_NOT_ALLOWED,
|
89
|
-
node,
|
90
|
-
parentNode: null,
|
91
|
-
eventDefinition,
|
92
|
-
allowedVersion
|
93
|
-
}
|
123
|
+
data
|
94
124
|
};
|
95
125
|
|
96
126
|
reportErrors(node, reporter, error);
|
package/rules/error-reference.js
CHANGED
@@ -49,10 +49,10 @@ module.exports = skipInNonExecutableProcess(function() {
|
|
49
49
|
required: true
|
50
50
|
},
|
51
51
|
outputCollection: {
|
52
|
-
|
52
|
+
dependentRequired: 'outputElement'
|
53
53
|
},
|
54
54
|
outputElement: {
|
55
|
-
|
55
|
+
dependentRequired: 'outputCollection'
|
56
56
|
}
|
57
57
|
}, node);
|
58
58
|
|
package/rules/no-expression.js
CHANGED
@@ -68,29 +68,37 @@ function checkForVersion(node, version) {
|
|
68
68
|
}
|
69
69
|
|
70
70
|
function noExpression(node, propertyName, parentNode, allowedVersion) {
|
71
|
-
const
|
72
|
-
|
71
|
+
const path = getPath(node, parentNode),
|
72
|
+
propertyValue = node.get(propertyName);
|
73
73
|
|
74
74
|
if (!isExpression(propertyValue)) {
|
75
75
|
return;
|
76
76
|
}
|
77
77
|
|
78
|
-
|
79
|
-
|
80
|
-
|
78
|
+
let message = `Expression statement <${truncate(propertyValue)}> not supported`;
|
79
|
+
|
80
|
+
let data = {
|
81
|
+
type: ERROR_TYPES.EXPRESSION_NOT_ALLOWED,
|
82
|
+
node,
|
83
|
+
parentNode: parentNode == node ? null : parentNode,
|
84
|
+
property: propertyName
|
85
|
+
};
|
86
|
+
|
87
|
+
if (allowedVersion) {
|
88
|
+
message = `Expression statement <${truncate(propertyValue)}> only supported by Camunda Platform ${allowedVersion} or newer`;
|
89
|
+
|
90
|
+
data = {
|
91
|
+
...data,
|
92
|
+
allowedVersion
|
93
|
+
};
|
94
|
+
}
|
81
95
|
|
82
96
|
return {
|
83
|
-
message
|
97
|
+
message,
|
84
98
|
path: path
|
85
99
|
? [ ...path, propertyName ]
|
86
100
|
: [ propertyName ],
|
87
|
-
data
|
88
|
-
type: ERROR_TYPES.EXPRESSION_NOT_ALLOWED,
|
89
|
-
node,
|
90
|
-
parentNode: parentNode == node ? null : parentNode,
|
91
|
-
property: propertyName,
|
92
|
-
allowedVersion
|
93
|
-
}
|
101
|
+
data
|
94
102
|
};
|
95
103
|
}
|
96
104
|
|
@@ -0,0 +1,45 @@
|
|
1
|
+
const { is } = require('bpmnlint-utils');
|
2
|
+
|
3
|
+
const { reportErrors } = require('./utils/reporter');
|
4
|
+
|
5
|
+
const { getEventDefinition } = require('./utils/element');
|
6
|
+
|
7
|
+
const { ERROR_TYPES } = require('./utils/error-types');
|
8
|
+
|
9
|
+
const { skipInNonExecutableProcess } = require('./utils/rule');
|
10
|
+
|
11
|
+
module.exports = skipInNonExecutableProcess(function() {
|
12
|
+
function check(node, reporter) {
|
13
|
+
if (!is(node, 'bpmn:StartEvent')) {
|
14
|
+
return;
|
15
|
+
}
|
16
|
+
|
17
|
+
const eventDefinition = getEventDefinition(node);
|
18
|
+
|
19
|
+
if (!eventDefinition || !is(eventDefinition, 'bpmn:SignalEventDefinition')) {
|
20
|
+
return;
|
21
|
+
}
|
22
|
+
|
23
|
+
const { $parent: parent } = node;
|
24
|
+
|
25
|
+
if (parent && is(parent, 'bpmn:SubProcess')) {
|
26
|
+
const error = {
|
27
|
+
message: 'Element of type <bpmn:StartEvent> with event definition of type <bpmn:SignalEventDefinition> not allowed as child of <bpmn:SubProcess>',
|
28
|
+
path: null,
|
29
|
+
data: {
|
30
|
+
type: ERROR_TYPES.CHILD_ELEMENT_TYPE_NOT_ALLOWED,
|
31
|
+
node,
|
32
|
+
parentNode: null,
|
33
|
+
eventDefinition,
|
34
|
+
parent
|
35
|
+
}
|
36
|
+
};
|
37
|
+
|
38
|
+
reportErrors(node, reporter, error);
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
return {
|
43
|
+
check
|
44
|
+
};
|
45
|
+
});
|
package/rules/utils/element.js
CHANGED
@@ -161,23 +161,23 @@ module.exports.hasProperties = function(node, properties, parentNode = null) {
|
|
161
161
|
];
|
162
162
|
}
|
163
163
|
|
164
|
-
if (propertyChecks.
|
165
|
-
const dependency = node.get(propertyChecks.
|
164
|
+
if (propertyChecks.dependentRequired) {
|
165
|
+
const dependency = node.get(propertyChecks.dependentRequired);
|
166
166
|
|
167
167
|
if (dependency && !propertyValue) {
|
168
168
|
return [
|
169
169
|
...results,
|
170
170
|
{
|
171
|
-
message: `Element of type <${ node.$type }> must have property <${ propertyName }> if it has property <${ propertyChecks.
|
171
|
+
message: `Element of type <${ node.$type }> must have property <${ propertyName }> if it has property <${ propertyChecks.dependentRequired }>`,
|
172
172
|
path: path
|
173
173
|
? [ ...path, propertyName ]
|
174
174
|
: [ propertyName ],
|
175
175
|
data: {
|
176
|
-
type: ERROR_TYPES.
|
176
|
+
type: ERROR_TYPES.PROPERTY_DEPENDENT_REQUIRED,
|
177
177
|
node,
|
178
178
|
parentNode: parentNode == node ? null : parentNode,
|
179
|
-
property: propertyChecks.
|
180
|
-
|
179
|
+
property: propertyChecks.dependentRequired,
|
180
|
+
dependentRequiredProperty: propertyName
|
181
181
|
}
|
182
182
|
}
|
183
183
|
];
|
@@ -1,5 +1,6 @@
|
|
1
1
|
module.exports.ERROR_TYPES = Object.freeze({
|
2
2
|
ELEMENT_COLLAPSED_NOT_ALLOWED: 'camunda.elementCollapsedNotAllowed',
|
3
|
+
CHILD_ELEMENT_TYPE_NOT_ALLOWED: 'camunda.childElementTypeNotAllowed',
|
3
4
|
ELEMENT_TYPE_NOT_ALLOWED: 'camunda.elementTypeNotAllowed',
|
4
5
|
EXPRESSION_NOT_ALLOWED: 'camunda.expressionNotAllowed',
|
5
6
|
EXPRESSION_REQUIRED: 'camunda.expressionRequired',
|
@@ -7,7 +8,7 @@ module.exports.ERROR_TYPES = Object.freeze({
|
|
7
8
|
EXTENSION_ELEMENT_NOT_ALLOWED: 'camunda.extensionElementNotAllowed',
|
8
9
|
EXTENSION_ELEMENT_REQUIRED: 'camunda.extensionElementRequired',
|
9
10
|
FEEL_EXPRESSION_INVALID: 'camunda.feelExpressionInvalid',
|
10
|
-
|
11
|
+
PROPERTY_DEPENDENT_REQUIRED: 'camunda.propertyDependentRequired',
|
11
12
|
PROPERTY_NOT_ALLOWED: 'camunda.propertyNotAllowed',
|
12
13
|
PROPERTY_REQUIRED: 'camunda.propertyRequired',
|
13
14
|
PROPERTY_TYPE_NOT_ALLOWED: 'camunda.propertyTypeNotAllowed',
|