bpmnlint-plugin-camunda-compat 1.3.1 → 1.4.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 +12 -1
- package/package.json +1 -1
- package/rules/timer/index.js +43 -4
package/index.js
CHANGED
@@ -55,7 +55,15 @@ const camundaCloud83Rules = withConfig({
|
|
55
55
|
|
56
56
|
const camundaPlatform719Rules = withConfig({
|
57
57
|
'history-time-to-live': 'error'
|
58
|
-
}, {
|
58
|
+
}, {
|
59
|
+
platform: 'camunda-platform',
|
60
|
+
version: '7.19'
|
61
|
+
});
|
62
|
+
|
63
|
+
const camundaPlatform720Rules = withConfig(camundaPlatform719Rules, {
|
64
|
+
platform: 'camunda-platform',
|
65
|
+
version: '7.20'
|
66
|
+
});
|
59
67
|
|
60
68
|
module.exports = {
|
61
69
|
configs: {
|
@@ -85,6 +93,9 @@ module.exports = {
|
|
85
93
|
},
|
86
94
|
'camunda-platform-7-19': {
|
87
95
|
rules: camundaPlatform719Rules
|
96
|
+
},
|
97
|
+
'camunda-platform-7-20': {
|
98
|
+
rules: camundaPlatform720Rules
|
88
99
|
}
|
89
100
|
}
|
90
101
|
};
|
package/package.json
CHANGED
package/rules/timer/index.js
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
const { isNil } = require('min-dash');
|
2
|
+
|
1
3
|
const {
|
2
4
|
is
|
3
5
|
} = require('bpmnlint-utils');
|
@@ -12,6 +14,7 @@ const { greaterOrEqual } = require('../utils/version');
|
|
12
14
|
const {
|
13
15
|
getEventDefinition,
|
14
16
|
hasExpression,
|
17
|
+
hasProperties,
|
15
18
|
hasProperty
|
16
19
|
} = require('../utils/element');
|
17
20
|
|
@@ -60,7 +63,21 @@ module.exports = skipInNonExecutableProcess(function({ version }) {
|
|
60
63
|
});
|
61
64
|
|
62
65
|
function checkTimePropertyExists(eventDefinition, node, version) {
|
63
|
-
|
66
|
+
const timePropertyName = getTimePropertyName(eventDefinition);
|
67
|
+
|
68
|
+
if (timePropertyName) {
|
69
|
+
const allowedVersion = getAllowedVersionForTimeProperty(node, timePropertyName),
|
70
|
+
allowed = isNil(allowedVersion) ? false : greaterOrEqual(version, allowedVersion);
|
71
|
+
|
72
|
+
return hasProperties(eventDefinition, {
|
73
|
+
[ timePropertyName ]: {
|
74
|
+
allowed,
|
75
|
+
allowedVersion
|
76
|
+
}
|
77
|
+
}, node);
|
78
|
+
}
|
79
|
+
|
80
|
+
return hasProperty(eventDefinition, getAllowedTimePropertiesForVersion(node, version), node);
|
64
81
|
}
|
65
82
|
|
66
83
|
function checkTimeProperty(eventDefinition, event, version) {
|
@@ -126,16 +143,38 @@ function validateExpression(text) {
|
|
126
143
|
}
|
127
144
|
}
|
128
145
|
|
129
|
-
function
|
146
|
+
function getTimePropertyName(eventDefinition) {
|
147
|
+
if (eventDefinition.get('timeCycle')) {
|
148
|
+
return 'timeCycle';
|
149
|
+
}
|
150
|
+
|
151
|
+
if (eventDefinition.get('timeDate')) {
|
152
|
+
return 'timeDate';
|
153
|
+
}
|
154
|
+
|
155
|
+
if (eventDefinition.get('timeDuration')) {
|
156
|
+
return 'timeDuration';
|
157
|
+
}
|
158
|
+
|
159
|
+
return null;
|
160
|
+
}
|
161
|
+
|
162
|
+
function getAllowedTimePropertiesForVersion(element, version) {
|
130
163
|
const config = elementTypeConfig[ element.$type ];
|
131
164
|
|
132
165
|
return Object.keys(config).filter((property) => {
|
133
|
-
const
|
166
|
+
const allowedVersion = config[ property ](isInterrupting(element), element.$parent);
|
134
167
|
|
135
|
-
return
|
168
|
+
return allowedVersion && greaterOrEqual(version, allowedVersion);
|
136
169
|
});
|
137
170
|
}
|
138
171
|
|
172
|
+
function getAllowedVersionForTimeProperty(element, property) {
|
173
|
+
const config = elementTypeConfig[ element.$type ];
|
174
|
+
|
175
|
+
return config[ property ](isInterrupting(element), element.$parent);
|
176
|
+
}
|
177
|
+
|
139
178
|
function isInterrupting(element) {
|
140
179
|
if (is(element, 'bpmn:BoundaryEvent')) {
|
141
180
|
return element.get('cancelActivity') !== false;
|