bpmnlint 11.14.0 → 11.14.1
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/package.json +1 -1
- package/rules/no-bpmndi.js +10 -9
package/package.json
CHANGED
package/rules/no-bpmndi.js
CHANGED
|
@@ -35,12 +35,12 @@ module.exports = function() {
|
|
|
35
35
|
// (2) Filter BPMN elements without visual representation
|
|
36
36
|
const visualBpmnElements = bpmnElements.filter(hasVisualRepresentation);
|
|
37
37
|
|
|
38
|
-
// (3) Construct
|
|
39
|
-
const
|
|
38
|
+
// (3) Construct set of BPMNDI references
|
|
39
|
+
const referencedBpmnElementIds = getReferencedBpmnElementIds(node);
|
|
40
40
|
|
|
41
41
|
// (4) Report elements without BPMNDI
|
|
42
42
|
visualBpmnElements.forEach((element) => {
|
|
43
|
-
if (
|
|
43
|
+
if (!referencedBpmnElementIds.has(element.id)) {
|
|
44
44
|
reporter.report(element.id, 'Element is missing bpmndi');
|
|
45
45
|
}
|
|
46
46
|
});
|
|
@@ -105,16 +105,17 @@ function getAllBpmnElements(rootElements) {
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
/**
|
|
108
|
-
* Get all BPMN elements
|
|
108
|
+
* Get the ids of all BPMN elements referenced by BPMNDI elements
|
|
109
|
+
* within a bpmn:Definitions node
|
|
109
110
|
*
|
|
110
111
|
* @param {ModdleElement} definitionsNode - A moddleElement representing the
|
|
111
112
|
* bpmn:Definitions element
|
|
112
113
|
*
|
|
113
|
-
* @return {string
|
|
114
|
-
* this bpmn:Definitions node
|
|
114
|
+
* @return {Set<string>} ids of all BPMN elements referenced by BPMNDI
|
|
115
|
+
* elements part of this bpmn:Definitions node
|
|
115
116
|
*/
|
|
116
|
-
function
|
|
117
|
-
return flatten(
|
|
117
|
+
function getReferencedBpmnElementIds(definitionsNode) {
|
|
118
|
+
return new Set(flatten(
|
|
118
119
|
definitionsNode.get('diagrams').map((diagram) => {
|
|
119
120
|
|
|
120
121
|
const diElements = diagram.plane.planeElement || [];
|
|
@@ -124,7 +125,7 @@ function getAllDiBpmnReferences(definitionsNode) {
|
|
|
124
125
|
return element.bpmnElement?.id;
|
|
125
126
|
});
|
|
126
127
|
})
|
|
127
|
-
);
|
|
128
|
+
));
|
|
128
129
|
}
|
|
129
130
|
|
|
130
131
|
/**
|