@bpmnkit/core 1.0.0 → 1.2.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/README.md +30 -3
- package/dist/bpmn/agentic.js +3 -1
- package/dist/bpmn/auto-layout.js +184 -15
- package/dist/bpmn/bpmn-builder.js +69 -7
- package/dist/bpmn/bpmn-model.d.ts +78 -0
- package/dist/bpmn/bpmn-parser.js +195 -37
- package/dist/bpmn/bpmn-serializer.js +121 -72
- package/dist/bpmn/bpmnlint.d.ts +153 -0
- package/dist/bpmn/bpmnlint.js +364 -0
- package/dist/bpmn/camunda-compat-data.d.ts +165 -0
- package/dist/bpmn/camunda-compat-data.js +423 -0
- package/dist/bpmn/camunda-compat-feel.d.ts +68 -0
- package/dist/bpmn/camunda-compat-feel.js +338 -0
- package/dist/bpmn/camunda-compat.d.ts +120 -0
- package/dist/bpmn/camunda-compat.js +1677 -0
- package/dist/bpmn/camunda7/juel.d.ts +41 -0
- package/dist/bpmn/camunda7/juel.js +333 -0
- package/dist/bpmn/camunda7/migrate.d.ts +72 -0
- package/dist/bpmn/camunda7/migrate.js +1152 -0
- package/dist/bpmn/compact.d.ts +4 -0
- package/dist/bpmn/compact.js +80 -0
- package/dist/bpmn/full-operations.js +5 -2
- package/dist/bpmn/label-style.d.ts +51 -0
- package/dist/bpmn/label-style.js +116 -0
- package/dist/bpmn/lint.d.ts +23 -3
- package/dist/bpmn/lint.js +47 -10
- package/dist/bpmn/optimize/bpmnlint-rules.d.ts +31 -0
- package/dist/bpmn/optimize/bpmnlint-rules.js +916 -0
- package/dist/bpmn/optimize/deploy.d.ts +8 -2
- package/dist/bpmn/optimize/deploy.js +16 -3
- package/dist/bpmn/optimize/index.js +11 -2
- package/dist/bpmn/optimize/patterns.js +3 -0
- package/dist/bpmn/optimize/types.d.ts +14 -0
- package/dist/bpmn/optimize/variable-flow.js +4 -1
- package/dist/bpmn/process-delta.d.ts +88 -0
- package/dist/bpmn/process-delta.js +236 -0
- package/dist/bpmn/process-text-writer.d.ts +53 -0
- package/dist/bpmn/process-text-writer.js +193 -0
- package/dist/bpmn/process-text.d.ts +175 -0
- package/dist/bpmn/process-text.js +1255 -0
- package/dist/bpmn/process-types.d.ts +112 -0
- package/dist/bpmn/process-types.js +490 -0
- package/dist/bpmn/svg.js +51 -22
- package/dist/doc/docx.d.ts +20 -0
- package/dist/doc/docx.js +253 -0
- package/dist/doc/html.d.ts +21 -0
- package/dist/doc/html.js +303 -0
- package/dist/doc/index.d.ts +7 -0
- package/dist/doc/index.js +5 -0
- package/dist/doc/markdown.d.ts +11 -0
- package/dist/doc/markdown.js +160 -0
- package/dist/doc/model.d.ts +129 -0
- package/dist/doc/model.js +617 -0
- package/dist/doc/zip.d.ts +5 -0
- package/dist/doc/zip.js +75 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +11 -0
- package/dist/layout/annotations.d.ts +4 -2
- package/dist/layout/annotations.js +31 -2
- package/dist/layout/collaboration/ordering.d.ts +8 -0
- package/dist/layout/collaboration/ordering.js +57 -18
- package/dist/layout/orthogonal.d.ts +32 -0
- package/dist/layout/orthogonal.js +367 -0
- package/dist/layout/repair.d.ts +31 -0
- package/dist/layout/repair.js +220 -0
- package/dist/layout/semantic/route.js +45 -3
- package/dist/node/bpmnlint.d.ts +109 -0
- package/dist/node/bpmnlint.js +198 -0
- package/dist/node/index.d.ts +2 -0
- package/dist/node/index.js +1 -0
- package/dist/xml/xml-patch.d.ts +21 -0
- package/dist/xml/xml-patch.js +27 -1
- package/package.json +2 -2
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `.bpmnlintrc` compatibility — reading a bpmnlint configuration and applying
|
|
3
|
+
* it to BPMN Kit's own findings.
|
|
4
|
+
*
|
|
5
|
+
* Teams coming from bpmn.io keep their lint configuration in a `.bpmnlintrc`.
|
|
6
|
+
* This module reads that file's JSON, expands bpmnlint's built-in presets, and
|
|
7
|
+
* maps each bpmnlint rule onto the BPMN Kit findings that report the same
|
|
8
|
+
* problem, so the file's `off`/`warn`/`error`/`info` settings govern those
|
|
9
|
+
* findings. Rules BPMN Kit had no finding for, and the parts of rules its
|
|
10
|
+
* findings do not cover exactly, are implemented natively in
|
|
11
|
+
* `optimize/bpmnlint-rules.ts` and only run when the config enables them.
|
|
12
|
+
*
|
|
13
|
+
* Pure and dependency-free: nothing here touches the filesystem or loads
|
|
14
|
+
* bpmnlint itself. Finding the file and running real bpmnlint (for
|
|
15
|
+
* third-party `bpmnlint-plugin-*` rules) is `@bpmnkit/core/node`'s job.
|
|
16
|
+
*
|
|
17
|
+
* @packageDocumentation
|
|
18
|
+
*/
|
|
19
|
+
import { NATIVE_BPMNLINT_RULES, analyzeBpmnlintRules } from "./optimize/bpmnlint-rules.js";
|
|
20
|
+
/** bpmnlint's built-in presets, as of bpmnlint 11.14. */
|
|
21
|
+
const RULE_NAMES_ALL = [
|
|
22
|
+
"ad-hoc-sub-process",
|
|
23
|
+
"conditional-event",
|
|
24
|
+
"conditional-flows",
|
|
25
|
+
"end-event-required",
|
|
26
|
+
"event-based-gateway",
|
|
27
|
+
"event-sub-process-typed-start-event",
|
|
28
|
+
"fake-join",
|
|
29
|
+
"global",
|
|
30
|
+
"label-required",
|
|
31
|
+
"link-event",
|
|
32
|
+
"no-bpmndi",
|
|
33
|
+
"no-complex-gateway",
|
|
34
|
+
"no-disconnected",
|
|
35
|
+
"no-duplicate-sequence-flows",
|
|
36
|
+
"no-gateway-join-fork",
|
|
37
|
+
"no-implicit-end",
|
|
38
|
+
"no-implicit-split",
|
|
39
|
+
"no-implicit-start",
|
|
40
|
+
"no-inclusive-gateway",
|
|
41
|
+
"no-overlapping-elements",
|
|
42
|
+
"single-blank-start-event",
|
|
43
|
+
"single-event-definition",
|
|
44
|
+
"standard-size",
|
|
45
|
+
"start-event-required",
|
|
46
|
+
"sub-process-blank-start-event",
|
|
47
|
+
"superfluous-gateway",
|
|
48
|
+
"superfluous-label",
|
|
49
|
+
"superfluous-termination",
|
|
50
|
+
];
|
|
51
|
+
const PRESETS = {
|
|
52
|
+
all: Object.fromEntries(RULE_NAMES_ALL.map((name) => [name, "error"])),
|
|
53
|
+
correctness: {
|
|
54
|
+
"ad-hoc-sub-process": "error",
|
|
55
|
+
"conditional-event": "error",
|
|
56
|
+
"event-based-gateway": "error",
|
|
57
|
+
"event-sub-process-typed-start-event": "error",
|
|
58
|
+
"link-event": "error",
|
|
59
|
+
"no-duplicate-sequence-flows": "warn",
|
|
60
|
+
"sub-process-blank-start-event": "error",
|
|
61
|
+
"single-blank-start-event": "error",
|
|
62
|
+
},
|
|
63
|
+
recommended: {
|
|
64
|
+
"ad-hoc-sub-process": "error",
|
|
65
|
+
"conditional-flows": "error",
|
|
66
|
+
"end-event-required": "error",
|
|
67
|
+
"event-based-gateway": "error",
|
|
68
|
+
"event-sub-process-typed-start-event": "error",
|
|
69
|
+
"fake-join": "warn",
|
|
70
|
+
global: "warn",
|
|
71
|
+
"label-required": "error",
|
|
72
|
+
"link-event": "error",
|
|
73
|
+
"no-bpmndi": "error",
|
|
74
|
+
"no-complex-gateway": "error",
|
|
75
|
+
"no-disconnected": "error",
|
|
76
|
+
"no-duplicate-sequence-flows": "error",
|
|
77
|
+
"no-gateway-join-fork": "error",
|
|
78
|
+
"no-implicit-split": "error",
|
|
79
|
+
"no-implicit-end": "error",
|
|
80
|
+
"no-implicit-start": "error",
|
|
81
|
+
"no-inclusive-gateway": "warn",
|
|
82
|
+
"no-overlapping-elements": "warn",
|
|
83
|
+
"single-blank-start-event": "error",
|
|
84
|
+
"single-event-definition": "error",
|
|
85
|
+
"start-event-required": "error",
|
|
86
|
+
"sub-process-blank-start-event": "error",
|
|
87
|
+
"superfluous-gateway": "warn",
|
|
88
|
+
"superfluous-label": "warn",
|
|
89
|
+
"superfluous-termination": "warn",
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
const NUMERIC_SEVERITY = ["off", "warn", "error", "info"];
|
|
93
|
+
function configError(message) {
|
|
94
|
+
return new Error(`${message} See https://github.com/bpmn-io/bpmnlint#configuration for the file format.`);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Parses the text of a `.bpmnlintrc` file.
|
|
98
|
+
*
|
|
99
|
+
* @param text - The file's contents (JSON).
|
|
100
|
+
* @throws When the text is not JSON or does not have the shape bpmnlint expects.
|
|
101
|
+
*/
|
|
102
|
+
export function parseBpmnlintConfig(text) {
|
|
103
|
+
let value;
|
|
104
|
+
try {
|
|
105
|
+
value = JSON.parse(text);
|
|
106
|
+
}
|
|
107
|
+
catch (err) {
|
|
108
|
+
throw configError(`.bpmnlintrc is not valid JSON: ${err.message}.`);
|
|
109
|
+
}
|
|
110
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
111
|
+
throw configError(".bpmnlintrc must contain a JSON object.");
|
|
112
|
+
}
|
|
113
|
+
const raw = value;
|
|
114
|
+
const config = {};
|
|
115
|
+
if (raw.extends !== undefined) {
|
|
116
|
+
const list = Array.isArray(raw.extends) ? raw.extends : [raw.extends];
|
|
117
|
+
if (!list.every((entry) => typeof entry === "string")) {
|
|
118
|
+
throw configError('.bpmnlintrc "extends" must be a string or an array of strings.');
|
|
119
|
+
}
|
|
120
|
+
config.extends = typeof raw.extends === "string" ? raw.extends : list;
|
|
121
|
+
}
|
|
122
|
+
if (raw.rules !== undefined) {
|
|
123
|
+
if (typeof raw.rules !== "object" || raw.rules === null || Array.isArray(raw.rules)) {
|
|
124
|
+
throw configError('.bpmnlintrc "rules" must be an object of rule name → setting.');
|
|
125
|
+
}
|
|
126
|
+
const rules = {};
|
|
127
|
+
for (const [name, setting] of Object.entries(raw.rules)) {
|
|
128
|
+
parseRuleValue(name, setting);
|
|
129
|
+
rules[name] = setting;
|
|
130
|
+
}
|
|
131
|
+
config.rules = rules;
|
|
132
|
+
}
|
|
133
|
+
if (raw.moddleExtensions !== undefined) {
|
|
134
|
+
const ext = raw.moddleExtensions;
|
|
135
|
+
if (typeof ext !== "object" ||
|
|
136
|
+
ext === null ||
|
|
137
|
+
!Object.values(ext).every((v) => typeof v === "string")) {
|
|
138
|
+
throw configError('.bpmnlintrc "moddleExtensions" must map prefixes to module paths.');
|
|
139
|
+
}
|
|
140
|
+
config.moddleExtensions = ext;
|
|
141
|
+
}
|
|
142
|
+
return config;
|
|
143
|
+
}
|
|
144
|
+
/** Reads one rule setting, the way bpmnlint's `Linter#parseRuleValue` does. */
|
|
145
|
+
function parseRuleValue(name, value) {
|
|
146
|
+
const [level, options] = Array.isArray(value) ? [value[0], value[1]] : [value, undefined];
|
|
147
|
+
const normalised = typeof level === "string" ? level.toLowerCase() : level;
|
|
148
|
+
const severity = typeof normalised === "number" ? NUMERIC_SEVERITY[normalised] : normalised;
|
|
149
|
+
if (severity === undefined || !NUMERIC_SEVERITY.includes(severity)) {
|
|
150
|
+
throw configError(`.bpmnlintrc rule "${name}" has setting ${JSON.stringify(value)}; expected "off", "warn", "error", "info" (or 0–3), optionally as [level, options].`);
|
|
151
|
+
}
|
|
152
|
+
return options === undefined ? { severity } : { severity, options };
|
|
153
|
+
}
|
|
154
|
+
function unprefixPlugin(name) {
|
|
155
|
+
return name.startsWith("bpmnlint-plugin-") ? name.slice("bpmnlint-plugin-".length) : name;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Normalises a rule name the way bpmnlint does, so the same rule written two
|
|
159
|
+
* ways is one rule: `bpmnlint/label-required` → `label-required`,
|
|
160
|
+
* `bpmnlint-plugin-foo/bar` → `foo/bar`, `@scope/bpmnlint-plugin-foo/bar` →
|
|
161
|
+
* `@scope/foo/bar`.
|
|
162
|
+
*
|
|
163
|
+
* @param name - The rule name as written in the config.
|
|
164
|
+
*/
|
|
165
|
+
export function normalizeBpmnlintRuleName(name) {
|
|
166
|
+
const match = /^(?:(?:(@[^/]+)\/)?([^@/][^/]*)\/)?([^/]+)$/.exec(name);
|
|
167
|
+
if (match === null)
|
|
168
|
+
return name;
|
|
169
|
+
const [, scope, pkg, rule] = match;
|
|
170
|
+
if (pkg === undefined || pkg === "bpmnlint")
|
|
171
|
+
return rule;
|
|
172
|
+
return `${scope !== undefined ? `${scope}/` : ""}${unprefixPlugin(pkg)}/${rule}`;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Expands a config's `extends` and merges its rules into one effective setting
|
|
176
|
+
* per rule. Later entries win, and the file's own `rules` win over everything
|
|
177
|
+
* it extends — the order bpmnlint applies.
|
|
178
|
+
*
|
|
179
|
+
* `bpmnlint:recommended`, `bpmnlint:all` and `bpmnlint:correctness` expand to
|
|
180
|
+
* bpmnlint 11.14's presets. Plugin configs cannot be expanded without loading
|
|
181
|
+
* the plugin and are listed in `unresolvedExtends` instead.
|
|
182
|
+
*
|
|
183
|
+
* @param config - A parsed `.bpmnlintrc`.
|
|
184
|
+
*/
|
|
185
|
+
export function resolveBpmnlintConfig(config) {
|
|
186
|
+
const rules = {};
|
|
187
|
+
const unresolvedExtends = [];
|
|
188
|
+
const parents = config.extends === undefined
|
|
189
|
+
? []
|
|
190
|
+
: typeof config.extends === "string"
|
|
191
|
+
? [config.extends]
|
|
192
|
+
: config.extends;
|
|
193
|
+
for (const parent of parents) {
|
|
194
|
+
const preset = /^bpmnlint:(.+)$/.exec(parent)?.[1];
|
|
195
|
+
const presetRules = preset === undefined ? undefined : PRESETS[preset];
|
|
196
|
+
if (presetRules === undefined) {
|
|
197
|
+
unresolvedExtends.push(parent);
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
for (const [name, severity] of Object.entries(presetRules))
|
|
201
|
+
rules[name] = { severity };
|
|
202
|
+
}
|
|
203
|
+
for (const [name, value] of Object.entries(config.rules ?? {})) {
|
|
204
|
+
rules[normalizeBpmnlintRuleName(name)] = parseRuleValue(name, value);
|
|
205
|
+
}
|
|
206
|
+
return { rules, unresolvedExtends };
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Every bpmnlint built-in rule and the BPMN Kit findings standing in for it.
|
|
210
|
+
*
|
|
211
|
+
* The documentation table (`guides/bpmnlint`) is written from this — keep them
|
|
212
|
+
* in step.
|
|
213
|
+
*/
|
|
214
|
+
export const BPMNLINT_RULE_MAP = {
|
|
215
|
+
"ad-hoc-sub-process": { findings: ["flow/ad-hoc-start-end-event"], match: "exact" },
|
|
216
|
+
"conditional-event": { findings: ["flow/conditional-event-no-condition"], match: "exact" },
|
|
217
|
+
"conditional-flows": {
|
|
218
|
+
findings: ["feel/missing-condition"],
|
|
219
|
+
replaces: ["feel/empty-condition"],
|
|
220
|
+
match: "exact",
|
|
221
|
+
},
|
|
222
|
+
"end-event-required": {
|
|
223
|
+
findings: ["flow/no-end-event", "flow/sub-process-no-end-event"],
|
|
224
|
+
match: "exact",
|
|
225
|
+
},
|
|
226
|
+
"event-based-gateway": { findings: ["flow/event-gateway-invalid"], match: "exact" },
|
|
227
|
+
"event-sub-process-typed-start-event": {
|
|
228
|
+
findings: ["flow/event-sub-process-untyped-start"],
|
|
229
|
+
match: "exact",
|
|
230
|
+
},
|
|
231
|
+
"fake-join": { findings: ["flow/multi-incoming-task"], match: "exact" },
|
|
232
|
+
global: { findings: ["pattern/global-element"], match: "exact" },
|
|
233
|
+
"label-required": {
|
|
234
|
+
findings: ["naming/missing-label"],
|
|
235
|
+
replaces: [
|
|
236
|
+
"naming/unlabeled-task",
|
|
237
|
+
"naming/unlabeled-start-event",
|
|
238
|
+
"naming/unlabeled-end-event",
|
|
239
|
+
"naming/split-gateway-no-label",
|
|
240
|
+
"naming/missing-flow-condition",
|
|
241
|
+
],
|
|
242
|
+
match: "exact",
|
|
243
|
+
note: "Lanes are read from a process's first lane set, the one BPMN Kit models.",
|
|
244
|
+
},
|
|
245
|
+
"link-event": { findings: ["flow/link-event-mismatch"], match: "exact" },
|
|
246
|
+
"no-bpmndi": { findings: ["pattern/missing-di"], match: "exact" },
|
|
247
|
+
"no-complex-gateway": { findings: ["pattern/complex-gateway"], match: "exact" },
|
|
248
|
+
"no-disconnected": { findings: ["flow/disconnected"], match: "exact" },
|
|
249
|
+
"no-duplicate-sequence-flows": {
|
|
250
|
+
findings: ["flow/duplicate-sequence-flow"],
|
|
251
|
+
match: "exact",
|
|
252
|
+
note: "One finding per duplicate flow naming the flow, its source and its target, where bpmnlint reports the three separately.",
|
|
253
|
+
},
|
|
254
|
+
"no-gateway-join-fork": { findings: ["flow/mixed-gateway"], match: "exact" },
|
|
255
|
+
"no-implicit-end": {
|
|
256
|
+
findings: ["flow/implicit-end"],
|
|
257
|
+
replaces: ["flow/dead-end"],
|
|
258
|
+
match: "exact",
|
|
259
|
+
},
|
|
260
|
+
"no-implicit-split": { findings: ["flow/implicit-split"], match: "exact" },
|
|
261
|
+
"no-implicit-start": {
|
|
262
|
+
findings: ["flow/implicit-start"],
|
|
263
|
+
replaces: ["flow/unreachable"],
|
|
264
|
+
match: "exact",
|
|
265
|
+
},
|
|
266
|
+
"no-inclusive-gateway": { findings: ["pattern/inclusive-gateway"], match: "exact" },
|
|
267
|
+
"no-overlapping-elements": { findings: ["pattern/overlapping-elements"], match: "exact" },
|
|
268
|
+
"single-blank-start-event": { findings: ["flow/multiple-blank-start-events"], match: "exact" },
|
|
269
|
+
"single-event-definition": { findings: ["flow/multiple-event-definitions"], match: "exact" },
|
|
270
|
+
"standard-size": { findings: ["pattern/non-standard-size"], match: "exact" },
|
|
271
|
+
"start-event-required": {
|
|
272
|
+
findings: ["flow/no-start-event", "flow/sub-process-no-start-event"],
|
|
273
|
+
match: "exact",
|
|
274
|
+
},
|
|
275
|
+
"sub-process-blank-start-event": { findings: ["flow/sub-process-typed-start"], match: "exact" },
|
|
276
|
+
"superfluous-gateway": { findings: ["flow/redundant-gateway"], match: "exact" },
|
|
277
|
+
"superfluous-label": { findings: ["naming/superfluous-flow-label"], match: "exact" },
|
|
278
|
+
"superfluous-termination": { findings: ["flow/superfluous-termination"], match: "exact" },
|
|
279
|
+
};
|
|
280
|
+
const RULE_FOR_FINDING = new Map(Object.entries(BPMNLINT_RULE_MAP).flatMap(([rule, mapping]) => mapping.findings.map((finding) => [finding, rule])));
|
|
281
|
+
const RULE_REPLACING_FINDING = new Map(Object.entries(BPMNLINT_RULE_MAP).flatMap(([rule, mapping]) => (mapping.replaces ?? []).map((finding) => [finding, rule])));
|
|
282
|
+
/**
|
|
283
|
+
* The bpmnlint rule a BPMN Kit finding stands in for, if any.
|
|
284
|
+
*
|
|
285
|
+
* @param findingId - A finding id such as `flow/mixed-gateway`.
|
|
286
|
+
*/
|
|
287
|
+
export function bpmnlintRuleForFinding(findingId) {
|
|
288
|
+
return RULE_FOR_FINDING.get(findingId);
|
|
289
|
+
}
|
|
290
|
+
const SEVERITY = {
|
|
291
|
+
error: "error",
|
|
292
|
+
warn: "warning",
|
|
293
|
+
info: "info",
|
|
294
|
+
};
|
|
295
|
+
/**
|
|
296
|
+
* Applies a `.bpmnlintrc` to a set of BPMN Kit findings.
|
|
297
|
+
*
|
|
298
|
+
* - A finding that stands in for a configured rule takes that rule's
|
|
299
|
+
* severity, or is dropped when the rule is `off`, and carries the rule name
|
|
300
|
+
* in `bpmnlintRule`.
|
|
301
|
+
* - A finding a configured rule `replaces` is dropped: the rule's native
|
|
302
|
+
* finding reports the concern with bpmnlint's semantics instead.
|
|
303
|
+
* - Enabled rules BPMN Kit implements natively are run and their findings
|
|
304
|
+
* added.
|
|
305
|
+
* - Findings with no bpmnlint counterpart, and findings whose rule the config
|
|
306
|
+
* does not mention, keep BPMN Kit's defaults: the config overrides BPMN
|
|
307
|
+
* Kit's opinion where it has one, it does not switch BPMN Kit's other rules
|
|
308
|
+
* off.
|
|
309
|
+
* - Configured rules with no equivalent are returned in `unsupported`, never
|
|
310
|
+
* silently ignored.
|
|
311
|
+
*
|
|
312
|
+
* @param definitions - The model the findings were produced from.
|
|
313
|
+
* @param findings - Output of `optimize()` (or a filtered subset of it).
|
|
314
|
+
* @param config - A resolved `.bpmnlintrc`.
|
|
315
|
+
* @param options - See {@link ApplyBpmnlintOptions}.
|
|
316
|
+
*/
|
|
317
|
+
export function applyBpmnlintConfig(definitions, findings, config, options = {}) {
|
|
318
|
+
const delegated = options.delegated === true;
|
|
319
|
+
const result = [];
|
|
320
|
+
for (const finding of findings) {
|
|
321
|
+
const replacedBy = RULE_REPLACING_FINDING.get(finding.id);
|
|
322
|
+
if (replacedBy !== undefined && config.rules[replacedBy] !== undefined)
|
|
323
|
+
continue;
|
|
324
|
+
const rule = bpmnlintRuleForFinding(finding.id);
|
|
325
|
+
const setting = rule === undefined ? undefined : config.rules[rule];
|
|
326
|
+
if (rule === undefined || setting === undefined) {
|
|
327
|
+
result.push(finding);
|
|
328
|
+
continue;
|
|
329
|
+
}
|
|
330
|
+
if (delegated || setting.severity === "off")
|
|
331
|
+
continue;
|
|
332
|
+
result.push({ ...finding, severity: SEVERITY[setting.severity], bpmnlintRule: rule });
|
|
333
|
+
}
|
|
334
|
+
if (delegated)
|
|
335
|
+
return { findings: result, unsupported: [] };
|
|
336
|
+
const native = new Map();
|
|
337
|
+
const unsupported = config.unresolvedExtends.map((name) => ({
|
|
338
|
+
name,
|
|
339
|
+
reason: "unresolved-extends",
|
|
340
|
+
}));
|
|
341
|
+
for (const [rule, setting] of Object.entries(config.rules)) {
|
|
342
|
+
if (setting.severity === "off")
|
|
343
|
+
continue;
|
|
344
|
+
if (BPMNLINT_RULE_MAP[rule] === undefined) {
|
|
345
|
+
unsupported.push({
|
|
346
|
+
name: rule,
|
|
347
|
+
reason: rule.includes("/") ? "plugin-rule" : "unknown-rule",
|
|
348
|
+
severity: setting.severity,
|
|
349
|
+
});
|
|
350
|
+
continue;
|
|
351
|
+
}
|
|
352
|
+
if (NATIVE_BPMNLINT_RULES.includes(rule))
|
|
353
|
+
native.set(rule, setting.options);
|
|
354
|
+
}
|
|
355
|
+
for (const finding of analyzeBpmnlintRules(definitions, native, options.categories)) {
|
|
356
|
+
const rule = bpmnlintRuleForFinding(finding.id);
|
|
357
|
+
const setting = rule === undefined ? undefined : config.rules[rule];
|
|
358
|
+
if (rule === undefined || setting === undefined || setting.severity === "off")
|
|
359
|
+
continue;
|
|
360
|
+
result.push({ ...finding, severity: SEVERITY[setting.severity], bpmnlintRule: rule });
|
|
361
|
+
}
|
|
362
|
+
return { findings: result, unsupported };
|
|
363
|
+
}
|
|
364
|
+
//# sourceMappingURL=bpmnlint.js.map
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which BPMN constructs and Zeebe properties each Camunda 8 version supports —
|
|
3
|
+
* the data behind `analyzeCamundaCompat`.
|
|
4
|
+
*
|
|
5
|
+
* Taken from `bpmnlint-plugin-camunda-compat` 2.61.0 (MIT, © Camunda Services
|
|
6
|
+
* GmbH), the rule set Camunda Modeler lints with through `@camunda/linting`
|
|
7
|
+
* 3.57.0:
|
|
8
|
+
*
|
|
9
|
+
* - `index.js` — which rule each `camunda-cloud-X-Y` config enables;
|
|
10
|
+
* - `rules/camunda-cloud/element-type/config.js` — element and event
|
|
11
|
+
* definition support per version;
|
|
12
|
+
* - `rules/camunda-cloud/implementation/config.js` — which task implementation
|
|
13
|
+
* each element takes, from which version;
|
|
14
|
+
* - `rules/camunda-cloud/timer/config.js` — timer properties per event type;
|
|
15
|
+
* - `rules/camunda-cloud/connector-properties/config.js` — inbound connector
|
|
16
|
+
* properties per version;
|
|
17
|
+
* - the version constants inside the individual rules.
|
|
18
|
+
*
|
|
19
|
+
* The FEEL built-in table is from `@camunda/feel-builtins` 1.4.1, which the
|
|
20
|
+
* plugin's `feel-compatibility` rule reads.
|
|
21
|
+
*
|
|
22
|
+
* When the plugin moves, update the tables here and `CAMUNDA_COMPAT_PLUGIN_VERSION`
|
|
23
|
+
* together; nothing else in BPMN Kit hard-codes a Camunda version for these checks.
|
|
24
|
+
*
|
|
25
|
+
* @packageDocumentation
|
|
26
|
+
*/
|
|
27
|
+
/** The `bpmnlint-plugin-camunda-compat` release these tables were taken from. */
|
|
28
|
+
export declare const CAMUNDA_COMPAT_PLUGIN_VERSION = "2.61.0";
|
|
29
|
+
/**
|
|
30
|
+
* The Camunda 8 (and Camunda Cloud 1.x) versions the plugin ships a
|
|
31
|
+
* `camunda-cloud-X-Y` config for, oldest first.
|
|
32
|
+
*/
|
|
33
|
+
export declare const CAMUNDA_COMPAT_VERSIONS: readonly ["1.0", "1.1", "1.2", "1.3", "8.0", "8.1", "8.2", "8.3", "8.4", "8.5", "8.6", "8.7", "8.8", "8.9", "8.10"];
|
|
34
|
+
/** A version in `CAMUNDA_COMPAT_VERSIONS`. */
|
|
35
|
+
export type CamundaCompatVersion = (typeof CAMUNDA_COMPAT_VERSIONS)[number];
|
|
36
|
+
/** `_` stands for "no event definition". */
|
|
37
|
+
type EventSupport = Readonly<Record<string, CamundaCompatVersion>>;
|
|
38
|
+
/**
|
|
39
|
+
* First version supporting each element, keyed by BPMN type. Events map their
|
|
40
|
+
* event definition (or `_` for none) to a version instead. A flow element whose
|
|
41
|
+
* type is absent — `bpmn:ComplexGateway`, `bpmn:Transaction` — is supported by
|
|
42
|
+
* no version.
|
|
43
|
+
*/
|
|
44
|
+
export declare const ELEMENT_SUPPORT: Readonly<Record<string, CamundaCompatVersion | EventSupport>>;
|
|
45
|
+
/** The three ways Zeebe implements a task, as `zeebe:` extension element names. */
|
|
46
|
+
export type ImplementationKind = "calledDecision" | "script" | "taskDefinition";
|
|
47
|
+
/** First version each element accepts each implementation kind in. */
|
|
48
|
+
export declare const IMPLEMENTATION_SUPPORT: Readonly<Record<ImplementationKind, Readonly<Record<string, CamundaCompatVersion | EventSupport>>>>;
|
|
49
|
+
/** The timer properties of `bpmn:TimerEventDefinition`. */
|
|
50
|
+
export type TimerProperty = "timeCycle" | "timeDate" | "timeDuration";
|
|
51
|
+
/**
|
|
52
|
+
* First version each timer property is allowed in, per event type. `null`
|
|
53
|
+
* means never; the functions receive whether the event interrupts and whether
|
|
54
|
+
* it starts an event sub-process.
|
|
55
|
+
*/
|
|
56
|
+
export declare const TIMER_SUPPORT: Readonly<Record<string, Readonly<Record<TimerProperty, (interrupting: boolean, inEventSubProcess: boolean) => CamundaCompatVersion | null>>>>;
|
|
57
|
+
/** First version a timer cycle may be a cron expression rather than ISO 8601. */
|
|
58
|
+
export declare const CRON_TIMER_SINCE: CamundaCompatVersion;
|
|
59
|
+
/**
|
|
60
|
+
* First version each property-level feature is supported in — the version
|
|
61
|
+
* constants of the plugin's `no-*` rules, gathered in one place.
|
|
62
|
+
*/
|
|
63
|
+
export declare const FEATURE_SINCE: {
|
|
64
|
+
/** `zeebe:modelerTemplate`, an applied element template (`no-template`). */
|
|
65
|
+
readonly modelerTemplate: "8.0";
|
|
66
|
+
/** `zeebe:properties` on any element (`no-zeebe-properties`). */
|
|
67
|
+
readonly zeebeProperties: "8.1";
|
|
68
|
+
/** `candidateUsers` on `zeebe:assignmentDefinition` (`no-candidate-users`). */
|
|
69
|
+
readonly candidateUsers: "8.2";
|
|
70
|
+
/** `propagateAllParentVariables="false"` (`no-propagate-all-parent-variables`). */
|
|
71
|
+
readonly propagateAllParentVariablesFalse: "8.2";
|
|
72
|
+
/** `zeebe:taskSchedule` (`no-task-schedule`). */
|
|
73
|
+
readonly taskSchedule: "8.2";
|
|
74
|
+
/** A catch event without an `errorRef` (`error-reference`). */
|
|
75
|
+
readonly errorCatchWithoutRef: "8.2";
|
|
76
|
+
/** An error code expression on a throw event (`no-expression`). */
|
|
77
|
+
readonly errorCodeExpression: "8.2";
|
|
78
|
+
/** A form on a start event (`start-event-form`). */
|
|
79
|
+
readonly startEventForm: "8.3";
|
|
80
|
+
/** A signal start event inside a sub-process (`no-signal-event-sub-process`). */
|
|
81
|
+
readonly signalEventSubProcess: "8.3";
|
|
82
|
+
/** A collapsed sub-process (`collapsed-subprocess`). */
|
|
83
|
+
readonly collapsedSubProcess: "8.4";
|
|
84
|
+
/** `formId` on a job-worker user task, in Desktop Modeler (`user-task-form`). */
|
|
85
|
+
readonly userTaskFormId: "8.4";
|
|
86
|
+
/** `zeebe:userTask`, the Camunda user task (`no-zeebe-user-task`). */
|
|
87
|
+
readonly zeebeUserTask: "8.5";
|
|
88
|
+
/** `bindingType` other than `latest` (`no-binding-type`). */
|
|
89
|
+
readonly bindingType: "8.6";
|
|
90
|
+
/** `zeebe:executionListeners` (`no-execution-listeners`). */
|
|
91
|
+
readonly executionListeners: "8.6";
|
|
92
|
+
/** `zeebe:priorityDefinition` (`no-priority-definition`). */
|
|
93
|
+
readonly priorityDefinition: "8.6";
|
|
94
|
+
/** `zeebe:versionTag` on a process (`no-version-tag`). */
|
|
95
|
+
readonly versionTag: "8.6";
|
|
96
|
+
/** Completion condition and output collection on ad-hoc sub-processes (`ad-hoc-sub-process`). */
|
|
97
|
+
readonly adHocCompletion: "8.8";
|
|
98
|
+
/** `zeebe:taskListeners` (`no-task-listeners`). */
|
|
99
|
+
readonly taskListeners: "8.8";
|
|
100
|
+
/** A `zeebe:input` without `source` (`io-mapping`). */
|
|
101
|
+
readonly inputWithoutSource: "8.8";
|
|
102
|
+
/** `businessId` on `zeebe:calledElement` (`no-business-id`). */
|
|
103
|
+
readonly businessId: "8.10";
|
|
104
|
+
/** Headers on execution listeners (`no-execution-listener-headers`). */
|
|
105
|
+
readonly executionListenerHeaders: "8.10";
|
|
106
|
+
/** `beforeAll` execution listeners (`no-before-all-execution-listener`). */
|
|
107
|
+
readonly beforeAllExecutionListener: "8.10";
|
|
108
|
+
/** `cancel` execution listeners (`no-cancel-execution-listener`). */
|
|
109
|
+
readonly cancelExecutionListener: "8.10";
|
|
110
|
+
/** `zeebe:jobPriorityDefinition` (`no-job-priority-definition`). */
|
|
111
|
+
readonly jobPriorityDefinition: "8.10";
|
|
112
|
+
/** A FEEL expression as the version tag of a called decision (`version-tag`). */
|
|
113
|
+
readonly decisionVersionTagExpression: "8.10";
|
|
114
|
+
/** `camunda.secrets.NAME`, superseding `{{secrets.NAME}}` (`secrets`). */
|
|
115
|
+
readonly camundaSecrets: "8.10";
|
|
116
|
+
/** `zeebe:agentDefinition` marks an agentic ad-hoc sub-process (the agent rules). */
|
|
117
|
+
readonly agentDefinition: "8.10";
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* First version each Camunda FEEL built-in function is available in, for
|
|
121
|
+
* `feel-compatibility`. Functions every version has are absent.
|
|
122
|
+
*
|
|
123
|
+
* Taken from the `engines.camunda` ranges of `@camunda/feel-builtins` 1.4.1
|
|
124
|
+
* (MIT, © Camunda Services GmbH) — `camundaBuiltins` and
|
|
125
|
+
* `camundaReservedNameBuiltins` — the table the plugin 2.61.0 checks against.
|
|
126
|
+
* Every range there is `>=X.Y`.
|
|
127
|
+
*/
|
|
128
|
+
export declare const FEEL_BUILTIN_SINCE: Readonly<Record<string, CamundaCompatVersion>>;
|
|
129
|
+
/**
|
|
130
|
+
* Inbound connector properties (`zeebe:property` names) that need a newer
|
|
131
|
+
* Camunda version, and the `inbound.type` values of the connectors that take
|
|
132
|
+
* them — `rules/camunda-cloud/connector-properties/config.js` of the plugin.
|
|
133
|
+
*/
|
|
134
|
+
export declare const INBOUND_CONNECTOR_PROPERTY_SINCE: Readonly<Record<string, {
|
|
135
|
+
since: CamundaCompatVersion;
|
|
136
|
+
connectors: readonly string[];
|
|
137
|
+
}>>;
|
|
138
|
+
/** Whether BPMN Kit runs a plugin rule, and how closely. */
|
|
139
|
+
export type CamundaCompatCoverage = "implemented" | "partial" | "existing" | "not-implemented";
|
|
140
|
+
/** One `bpmnlint-plugin-camunda-compat` rule. */
|
|
141
|
+
export interface CamundaCompatRule {
|
|
142
|
+
/** The severity the plugin's configs give it. */
|
|
143
|
+
severity: "error" | "warn";
|
|
144
|
+
/** First config that enables it; absent for "every version". */
|
|
145
|
+
since?: CamundaCompatVersion;
|
|
146
|
+
/** First config that no longer enables it; absent for "still enabled". */
|
|
147
|
+
until?: CamundaCompatVersion;
|
|
148
|
+
/**
|
|
149
|
+
* - `implemented` — `analyzeCamundaCompat` reports it as `compat/<rule>`;
|
|
150
|
+
* - `partial` — reported, with the difference in `note`;
|
|
151
|
+
* - `existing` — another BPMN Kit finding (`equivalents`) reports the same problem;
|
|
152
|
+
* - `not-implemented` — not checked; `note` says why.
|
|
153
|
+
*/
|
|
154
|
+
coverage: CamundaCompatCoverage;
|
|
155
|
+
/** BPMN Kit findings outside `compat/*` that report the same problem. */
|
|
156
|
+
equivalents?: readonly string[];
|
|
157
|
+
note?: string;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Every rule of the plugin's `camunda-cloud-*` configs, with the versions it
|
|
161
|
+
* is enabled for — `index.js` of the plugin, as data.
|
|
162
|
+
*/
|
|
163
|
+
export declare const CAMUNDA_COMPAT_RULES: Readonly<Record<string, CamundaCompatRule>>;
|
|
164
|
+
export {};
|
|
165
|
+
//# sourceMappingURL=camunda-compat-data.d.ts.map
|