bpmnlint 11.10.0 → 11.11.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.
@@ -3,16 +3,37 @@ const { BpmnModdle } = require('bpmn-moddle');
3
3
 
4
4
  const { readFileSync } = require('node:fs');
5
5
 
6
+ /**
7
+ * @typedef { any } ModdleElement
8
+ *
9
+ * @typedef { {
10
+ * root: ModdleElement,
11
+ * moddle: BpmnModdle,
12
+ * warnings: any[]
13
+ * } } CreatedModdle
14
+ */
6
15
 
7
16
  /**
8
17
  * Create moddle instance.
9
18
  *
10
- * @param {String} xml the XML string
19
+ * @param {string} xml the XML string
20
+ * @param {string} [elementType]
21
+ * @param {Object} [moddleExtensions]
11
22
  *
12
- * @return {Promise<Object>}
23
+ * @return {Promise<CreatedModdle>}
13
24
  */
14
- async function createModdle(xml, elementType = 'bpmn:Definitions') {
15
- const moddle = new BpmnModdle();
25
+ async function createModdle(xml, elementType = 'bpmn:Definitions', moddleExtensions) {
26
+
27
+ if (typeof elementType !== 'string') {
28
+ moddleExtensions = elementType;
29
+ elementType = undefined;
30
+ }
31
+
32
+ if (typeof elementType === 'undefined') {
33
+ elementType = 'bpmn:Definitions';
34
+ }
35
+
36
+ const moddle = new BpmnModdle(moddleExtensions);
16
37
 
17
38
  const {
18
39
  rootElement: root,
@@ -22,6 +43,8 @@ async function createModdle(xml, elementType = 'bpmn:Definitions') {
22
43
  return {
23
44
  root,
24
45
  moddle,
46
+
47
+ // @ts-ignore-next-line "legacy"
25
48
  context: {
26
49
  warnings
27
50
  },
@@ -35,14 +58,16 @@ module.exports.createModdle = createModdle;
35
58
  /**
36
59
  * Return moddle instance, read from the given file.
37
60
  *
38
- * @param {String} filePath
61
+ * @param {string|URL} filePath
62
+ * @param {string} [elementType]
63
+ * @param {Object} [moddleExtensions]
39
64
  *
40
- * @return {Promise<Object>}
65
+ * @return {Promise<CreatedModdle>}
41
66
  */
42
- function readModdle(filePath) {
67
+ function readModdle(filePath, elementType, moddleExtensions) {
43
68
  const contents = readFileSync(filePath, 'utf8');
44
69
 
45
- return createModdle(contents);
70
+ return createModdle(contents, elementType, moddleExtensions);
46
71
  }
47
72
 
48
73
  module.exports.readModdle = readModdle;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bpmnlint",
3
3
  "description": "Validate your BPMN diagrams based on configurable lint rules",
4
- "version": "11.10.0",
4
+ "version": "11.11.0",
5
5
  "main": "lib/index.js",
6
6
  "keywords": [
7
7
  "bpmnlint",
@@ -31,7 +31,7 @@
31
31
  "lint": "eslint .",
32
32
  "lint:types": "tsc",
33
33
  "dev": "npm test -- --watch",
34
- "test": "mocha --exclude 'test/integration/*/**' 'test/**/*.*js'",
34
+ "test": "mocha --exclude \"test/integration/*/**\" \"test/**/*.*js\"",
35
35
  "test-coverage": "nyc --reporter=lcov --reporter=html npm test",
36
36
  "generate-docs-images": "npx @bpmn-io/bpmnlint-generate-docs-images ."
37
37
  },
@@ -51,7 +51,7 @@
51
51
  "tiny-glob": "^0.2.9"
52
52
  },
53
53
  "devDependencies": {
54
- "@bpmn-io/bpmnlint-generate-docs-images": "^1.1.0",
54
+ "@bpmn-io/bpmnlint-generate-docs-images": "^1.2.0",
55
55
  "@types/mocha": "^10.0.10",
56
56
  "chai": "^6.2.2",
57
57
  "eslint": "^9.39.2",
@@ -11,7 +11,6 @@ const {
11
11
  * A rule that ensures that an Ad Hoc Sub Process is valid according to the BPMN spec:
12
12
  *
13
13
  * - No start or end events
14
- * - Every intermediate event has an outgoing sequence flow
15
14
  *
16
15
  * @type { import('../lib/types.js').RuleFactory }
17
16
  */