@bpmnkit/core 1.0.0 → 1.1.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 +25 -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/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/types.d.ts +14 -0
- package/dist/bpmn/optimize/variable-flow.js +4 -1
- 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 +16 -0
- package/dist/index.js +8 -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,338 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FEEL analysis for the Camunda-version compatibility rules that look inside
|
|
3
|
+
* expressions — `feel-compatibility`, `unresolvable-secret-reference` and
|
|
4
|
+
* `agent-fromai-contract`.
|
|
5
|
+
*
|
|
6
|
+
* `bpmnlint-plugin-camunda-compat` reads these from the lezer-feel syntax
|
|
7
|
+
* tree (through `@bpmn-io/feel-analyzer` for built-in calls). This module
|
|
8
|
+
* answers the same questions from `@bpmnkit/feel`'s AST, and names nodes by
|
|
9
|
+
* their lezer-feel type where a plugin message quotes one.
|
|
10
|
+
*
|
|
11
|
+
* @packageDocumentation
|
|
12
|
+
*/
|
|
13
|
+
import { parseExpression } from "@bpmnkit/feel";
|
|
14
|
+
/** Direct sub-expressions of a node, in source order. */
|
|
15
|
+
function feelChildren(node) {
|
|
16
|
+
switch (node.kind) {
|
|
17
|
+
case "list":
|
|
18
|
+
return node.items;
|
|
19
|
+
case "context":
|
|
20
|
+
return node.entries.map((e) => e.value);
|
|
21
|
+
case "range":
|
|
22
|
+
return [node.low, node.high];
|
|
23
|
+
case "unary-minus":
|
|
24
|
+
return [node.operand];
|
|
25
|
+
case "binary":
|
|
26
|
+
return [node.left, node.right];
|
|
27
|
+
case "path":
|
|
28
|
+
return [node.base];
|
|
29
|
+
case "filter":
|
|
30
|
+
return [node.base, node.condition];
|
|
31
|
+
case "call":
|
|
32
|
+
return node.args;
|
|
33
|
+
case "call-expr":
|
|
34
|
+
return [node.target, ...node.args];
|
|
35
|
+
case "call-named":
|
|
36
|
+
return node.args.map((a) => a.value);
|
|
37
|
+
case "if":
|
|
38
|
+
return [node.condition, node.then, node.else];
|
|
39
|
+
case "for":
|
|
40
|
+
return [...node.bindings.map((b) => b.domain), node.body];
|
|
41
|
+
case "some":
|
|
42
|
+
case "every":
|
|
43
|
+
return [...node.bindings.map((b) => b.domain), node.satisfies];
|
|
44
|
+
case "between":
|
|
45
|
+
return [node.value, node.low, node.high];
|
|
46
|
+
case "in-test":
|
|
47
|
+
return [node.value, node.test];
|
|
48
|
+
case "instance-of":
|
|
49
|
+
return [node.value];
|
|
50
|
+
case "function-def":
|
|
51
|
+
return [node.body];
|
|
52
|
+
case "unary-test-list":
|
|
53
|
+
case "unary-not":
|
|
54
|
+
return node.tests;
|
|
55
|
+
default:
|
|
56
|
+
return [];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/** Index of the `)` closing the `(` at `open`, skipping string literals and backtick names. */
|
|
60
|
+
function closingParen(src, open) {
|
|
61
|
+
let depth = 0;
|
|
62
|
+
for (let i = open; i < src.length; i++) {
|
|
63
|
+
const c = src[i];
|
|
64
|
+
if (c === '"' || c === "`") {
|
|
65
|
+
const quote = c;
|
|
66
|
+
for (i++; i < src.length && src[i] !== quote; i++)
|
|
67
|
+
if (src[i] === "\\")
|
|
68
|
+
i++;
|
|
69
|
+
}
|
|
70
|
+
else if (c === "(") {
|
|
71
|
+
depth++;
|
|
72
|
+
}
|
|
73
|
+
else if (c === ")") {
|
|
74
|
+
depth--;
|
|
75
|
+
if (depth === 0)
|
|
76
|
+
return i;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return -1;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Whether `node` is written in parentheses of its own. `@bpmnkit/feel` drops
|
|
83
|
+
* them, where lezer-feel keeps a `ParenthesizedExpression` node. `floor` is
|
|
84
|
+
* the index of a `(` that belongs to something else, a call's argument list.
|
|
85
|
+
*/
|
|
86
|
+
function parenthesized(src, node, floor = -1) {
|
|
87
|
+
let before = node.start - 1;
|
|
88
|
+
while (before >= 0 && /\s/.test(src[before]))
|
|
89
|
+
before--;
|
|
90
|
+
if (before <= floor || src[before] !== "(")
|
|
91
|
+
return false;
|
|
92
|
+
let after = node.end;
|
|
93
|
+
while (after < src.length && /\s/.test(src[after]))
|
|
94
|
+
after++;
|
|
95
|
+
return closingParen(src, before) === after;
|
|
96
|
+
}
|
|
97
|
+
function parse(expression) {
|
|
98
|
+
const { ast, errors } = parseExpression(expression);
|
|
99
|
+
return { ast, valid: errors.length === 0 && ast !== null };
|
|
100
|
+
}
|
|
101
|
+
// ---------------------------------------------------------------------------
|
|
102
|
+
// feel-compatibility
|
|
103
|
+
// ---------------------------------------------------------------------------
|
|
104
|
+
/**
|
|
105
|
+
* The built-in functions an expression calls, as `@bpmn-io/feel-analyzer`
|
|
106
|
+
* reports them to the plugin: a call counts as a built-in call only when the
|
|
107
|
+
* name is not bound by a context entry, function parameter or iteration
|
|
108
|
+
* variable around it — and a name called both ways counts as a user function.
|
|
109
|
+
*
|
|
110
|
+
* @param expression - FEEL without the leading `=`.
|
|
111
|
+
* @param builtins - The names to look for.
|
|
112
|
+
* @returns The built-ins called, sorted as the analyzer sorts them; `undefined`
|
|
113
|
+
* when the expression does not parse, which the `feel` rule reports.
|
|
114
|
+
*/
|
|
115
|
+
export function feelBuiltinCalls(expression, builtins) {
|
|
116
|
+
const { ast, valid } = parse(expression);
|
|
117
|
+
if (!valid || ast === null)
|
|
118
|
+
return undefined;
|
|
119
|
+
const types = new Map();
|
|
120
|
+
const scopes = [];
|
|
121
|
+
const record = (name) => {
|
|
122
|
+
const type = builtins.has(name) && !scopes.some((scope) => scope.has(name)) ? "builtin" : "user";
|
|
123
|
+
if (!types.has(name) || type === "user")
|
|
124
|
+
types.set(name, type);
|
|
125
|
+
};
|
|
126
|
+
const walk = (node) => {
|
|
127
|
+
switch (node.kind) {
|
|
128
|
+
case "context": {
|
|
129
|
+
const scope = new Set();
|
|
130
|
+
scopes.push(scope);
|
|
131
|
+
for (const entry of node.entries) {
|
|
132
|
+
walk(entry.value);
|
|
133
|
+
scope.add(entry.key);
|
|
134
|
+
}
|
|
135
|
+
scopes.pop();
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
case "function-def":
|
|
139
|
+
scopes.push(new Set(node.params));
|
|
140
|
+
walk(node.body);
|
|
141
|
+
scopes.pop();
|
|
142
|
+
return;
|
|
143
|
+
case "for":
|
|
144
|
+
case "some":
|
|
145
|
+
case "every":
|
|
146
|
+
for (const binding of node.bindings)
|
|
147
|
+
walk(binding.domain);
|
|
148
|
+
scopes.push(new Set(node.bindings.map((b) => b.name)));
|
|
149
|
+
walk(node.kind === "for" ? node.body : node.satisfies);
|
|
150
|
+
scopes.pop();
|
|
151
|
+
return;
|
|
152
|
+
case "call":
|
|
153
|
+
case "call-named":
|
|
154
|
+
record(node.callee);
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
for (const child of feelChildren(node))
|
|
158
|
+
walk(child);
|
|
159
|
+
};
|
|
160
|
+
walk(ast);
|
|
161
|
+
return [...types]
|
|
162
|
+
.filter(([, type]) => type === "builtin")
|
|
163
|
+
.map(([name]) => name)
|
|
164
|
+
.sort((a, b) => a.localeCompare(b));
|
|
165
|
+
}
|
|
166
|
+
// ---------------------------------------------------------------------------
|
|
167
|
+
// unresolvable-secret-reference
|
|
168
|
+
// ---------------------------------------------------------------------------
|
|
169
|
+
/** `camunda.secrets.<name>` anywhere in a string — the plugin's text check. */
|
|
170
|
+
export const SECRET_REFERENCE_LITERAL = /camunda\.secrets\.[\w-]+/;
|
|
171
|
+
/** Exactly `camunda.secrets.<name>`: not a longer path, and not the base of one. */
|
|
172
|
+
function isSecretReference(node, isPathBase) {
|
|
173
|
+
return (!isPathBase &&
|
|
174
|
+
node.kind === "path" &&
|
|
175
|
+
node.base.kind === "path" &&
|
|
176
|
+
node.base.key === "secrets" &&
|
|
177
|
+
node.base.base.kind === "name" &&
|
|
178
|
+
node.base.base.name === "camunda");
|
|
179
|
+
}
|
|
180
|
+
function containsSecretReference(node, isPathBase = false) {
|
|
181
|
+
if (isSecretReference(node, isPathBase))
|
|
182
|
+
return true;
|
|
183
|
+
return feelChildren(node).some((child) => containsSecretReference(child, node.kind === "path" && child === node.base));
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Finds the ways a FEEL expression writes a `camunda.secrets.<name>`
|
|
187
|
+
* reference that Camunda rejects at deployment, as the plugin's
|
|
188
|
+
* `findSecretReferenceViolations` does: in a string literal, or — looking down
|
|
189
|
+
* from the top through context entries and `if` branches only — inside a list
|
|
190
|
+
* or inside a context an `if` branch returns.
|
|
191
|
+
*
|
|
192
|
+
* @param expression - FEEL without the leading `=`.
|
|
193
|
+
*/
|
|
194
|
+
export function secretReferenceViolations(expression) {
|
|
195
|
+
const violations = { stringLiteral: false, insideList: false, insideIfBranchContext: false };
|
|
196
|
+
const { ast, valid } = parse(expression);
|
|
197
|
+
if (!valid || ast === null)
|
|
198
|
+
return violations;
|
|
199
|
+
const visit = (node) => {
|
|
200
|
+
if (node.kind === "string") {
|
|
201
|
+
const content = expression.slice(node.start + 1, node.end - 1);
|
|
202
|
+
if (SECRET_REFERENCE_LITERAL.test(content))
|
|
203
|
+
violations.stringLiteral = true;
|
|
204
|
+
}
|
|
205
|
+
for (const child of feelChildren(node))
|
|
206
|
+
visit(child);
|
|
207
|
+
};
|
|
208
|
+
visit(ast);
|
|
209
|
+
const containerKind = (node) => {
|
|
210
|
+
if (parenthesized(expression, node))
|
|
211
|
+
return undefined;
|
|
212
|
+
if (node.kind === "list")
|
|
213
|
+
return containsSecretReference(node) ? "list" : undefined;
|
|
214
|
+
if (node.kind === "context")
|
|
215
|
+
return containsSecretReference(node) ? "context" : undefined;
|
|
216
|
+
if (node.kind === "if")
|
|
217
|
+
return containerKind(node.then) ?? containerKind(node.else);
|
|
218
|
+
return undefined;
|
|
219
|
+
};
|
|
220
|
+
const referenceKind = (node) => {
|
|
221
|
+
if (node.kind === "context" && !parenthesized(expression, node)) {
|
|
222
|
+
for (const entry of node.entries) {
|
|
223
|
+
const kind = referenceKind(entry.value);
|
|
224
|
+
if (kind !== undefined)
|
|
225
|
+
return kind;
|
|
226
|
+
}
|
|
227
|
+
return undefined;
|
|
228
|
+
}
|
|
229
|
+
return containerKind(node);
|
|
230
|
+
};
|
|
231
|
+
const kind = referenceKind(ast);
|
|
232
|
+
if (kind === "list")
|
|
233
|
+
violations.insideList = true;
|
|
234
|
+
else if (kind === "context")
|
|
235
|
+
violations.insideIfBranchContext = true;
|
|
236
|
+
return violations;
|
|
237
|
+
}
|
|
238
|
+
/** `fromAi()`'s parameters, in the engine's order. */
|
|
239
|
+
const FROM_AI_PARAMETERS = ["value", "description", "type", "schema", "options"];
|
|
240
|
+
const ARITHMETIC = new Set(["+", "-", "*", "/", "**"]);
|
|
241
|
+
const TEMPORAL_CONSTRUCTORS = new Set(["date", "time", "date and time", "duration"]);
|
|
242
|
+
/** The lezer-feel node type an expression parses to there. */
|
|
243
|
+
function lezerType(node) {
|
|
244
|
+
switch (node.kind) {
|
|
245
|
+
case "number":
|
|
246
|
+
return "NumericLiteral";
|
|
247
|
+
case "unary-minus":
|
|
248
|
+
return node.operand.kind === "number" ? "NumericLiteral" : "ArithmeticExpression";
|
|
249
|
+
case "string":
|
|
250
|
+
return "StringLiteral";
|
|
251
|
+
case "boolean":
|
|
252
|
+
return "BooleanLiteral";
|
|
253
|
+
case "null":
|
|
254
|
+
return "null";
|
|
255
|
+
case "temporal":
|
|
256
|
+
return "DateTimeLiteral";
|
|
257
|
+
case "name":
|
|
258
|
+
return "VariableName";
|
|
259
|
+
case "path":
|
|
260
|
+
return "PathExpression";
|
|
261
|
+
case "filter":
|
|
262
|
+
return "FilterExpression";
|
|
263
|
+
case "call":
|
|
264
|
+
case "call-named":
|
|
265
|
+
return TEMPORAL_CONSTRUCTORS.has(node.callee) ? "DateTimeLiteral" : "FunctionInvocation";
|
|
266
|
+
case "call-expr":
|
|
267
|
+
return "FunctionInvocation";
|
|
268
|
+
case "list":
|
|
269
|
+
return "List";
|
|
270
|
+
case "context":
|
|
271
|
+
return "Context";
|
|
272
|
+
case "range":
|
|
273
|
+
return "SimplePositiveUnaryTest";
|
|
274
|
+
case "binary":
|
|
275
|
+
if (ARITHMETIC.has(node.op))
|
|
276
|
+
return "ArithmeticExpression";
|
|
277
|
+
if (node.op === "and")
|
|
278
|
+
return "Conjunction";
|
|
279
|
+
if (node.op === "or")
|
|
280
|
+
return "Disjunction";
|
|
281
|
+
return "Comparison";
|
|
282
|
+
case "between":
|
|
283
|
+
case "in-test":
|
|
284
|
+
return "Comparison";
|
|
285
|
+
case "instance-of":
|
|
286
|
+
return "InstanceOfExpression";
|
|
287
|
+
case "if":
|
|
288
|
+
return "IfExpression";
|
|
289
|
+
case "for":
|
|
290
|
+
return "ForExpression";
|
|
291
|
+
case "some":
|
|
292
|
+
case "every":
|
|
293
|
+
return "QuantifiedExpression";
|
|
294
|
+
case "function-def":
|
|
295
|
+
return "FunctionDefinition";
|
|
296
|
+
default:
|
|
297
|
+
return node.kind;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* The `fromAi()` calls in an expression, in any casing, outermost first — the
|
|
302
|
+
* plugin's `findFunctionInvocations` and `getArgs`.
|
|
303
|
+
*
|
|
304
|
+
* @param expression - FEEL without the leading `=`, trimmed.
|
|
305
|
+
*/
|
|
306
|
+
export function fromAiCalls(expression) {
|
|
307
|
+
const { ast } = parseExpression(expression);
|
|
308
|
+
if (ast === null)
|
|
309
|
+
return [];
|
|
310
|
+
const argument = (node, floor = -1) => ({
|
|
311
|
+
type: parenthesized(expression, node, floor) ? "ParenthesizedExpression" : lezerType(node),
|
|
312
|
+
text: expression.slice(node.start, node.end),
|
|
313
|
+
});
|
|
314
|
+
const calls = [];
|
|
315
|
+
const visit = (node) => {
|
|
316
|
+
if ((node.kind === "call" || node.kind === "call-named") && /^fromai$/i.test(node.callee)) {
|
|
317
|
+
const open = expression.indexOf("(", node.start);
|
|
318
|
+
const args = [];
|
|
319
|
+
if (node.kind === "call") {
|
|
320
|
+
for (const arg of node.args)
|
|
321
|
+
args.push(argument(arg, open));
|
|
322
|
+
}
|
|
323
|
+
else {
|
|
324
|
+
for (const { name, value } of node.args) {
|
|
325
|
+
const index = FROM_AI_PARAMETERS.indexOf(name);
|
|
326
|
+
if (index !== -1)
|
|
327
|
+
args[index] = argument(value);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
calls.push({ name: node.callee, args });
|
|
331
|
+
}
|
|
332
|
+
for (const child of feelChildren(node))
|
|
333
|
+
visit(child);
|
|
334
|
+
};
|
|
335
|
+
visit(ast);
|
|
336
|
+
return calls;
|
|
337
|
+
}
|
|
338
|
+
//# sourceMappingURL=camunda-compat-feel.js.map
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Camunda version compatibility — what Camunda Modeler reports through
|
|
3
|
+
* `@camunda/linting` when a diagram uses something the Camunda 8 version it
|
|
4
|
+
* targets cannot run, or leaves out a property that version requires.
|
|
5
|
+
*
|
|
6
|
+
* The target is read from `modeler:executionPlatformVersion` on
|
|
7
|
+
* `<bpmn:definitions>`, or pinned by a `.bpmnlintrc` that extends
|
|
8
|
+
* `plugin:camunda-compat/camunda-cloud-X-Y`. Which construct needs which
|
|
9
|
+
* version lives in `camunda-compat-data.ts`, taken from
|
|
10
|
+
* `bpmnlint-plugin-camunda-compat`; this module applies it. Findings are
|
|
11
|
+
* `compat/<plugin rule name>`, in the `deploy` category: they are deployability
|
|
12
|
+
* findings for the target version, and a new category would widen a union the
|
|
13
|
+
* 1.0 API returns.
|
|
14
|
+
*
|
|
15
|
+
* Problems an existing `deploy/*` (or `feel/*`) check already reports on the
|
|
16
|
+
* same element are left to that check — see `dedupeCamundaCompat`.
|
|
17
|
+
*
|
|
18
|
+
* @packageDocumentation
|
|
19
|
+
*/
|
|
20
|
+
import type { BpmnDefinitions } from "./bpmn-model.js";
|
|
21
|
+
import type { BpmnlintRuleSetting, ResolvedBpmnlintConfig, UnsupportedBpmnlintRule } from "./bpmnlint.js";
|
|
22
|
+
import { type CamundaCompatVersion } from "./camunda-compat-data.js";
|
|
23
|
+
import type { OptimizationFinding } from "./optimize/types.js";
|
|
24
|
+
/**
|
|
25
|
+
* Reduces a Camunda version to the `major.minor` the compatibility tables use:
|
|
26
|
+
* `"8.6.2"` → `"8.6"`. A Camunda 8 version newer than the tables is checked as
|
|
27
|
+
* the newest one they know, since later versions only lift restrictions.
|
|
28
|
+
*
|
|
29
|
+
* @param raw - A version such as `modeler:executionPlatformVersion` holds.
|
|
30
|
+
* @returns The table version, or `undefined` for anything that is not a
|
|
31
|
+
* Camunda Cloud 1.x or Camunda 8 version.
|
|
32
|
+
*/
|
|
33
|
+
export declare function normalizeCamundaVersion(raw: string | undefined): CamundaCompatVersion | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* The Camunda version a model targets, from `modeler:executionPlatform` (a
|
|
36
|
+
* Camunda Cloud / Camunda 8 platform) and `modeler:executionPlatformVersion`.
|
|
37
|
+
*
|
|
38
|
+
* @param definitions - The model to read.
|
|
39
|
+
* @returns The table version, or `undefined` when the model targets no
|
|
40
|
+
* Camunda 8 version — then no compatibility check runs, as in Modeler.
|
|
41
|
+
*/
|
|
42
|
+
export declare function targetCamundaVersion(definitions: BpmnDefinitions): CamundaCompatVersion | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Checks a model against the Camunda 8 version it targets, the way
|
|
45
|
+
* `bpmnlint-plugin-camunda-compat` does in Camunda Modeler.
|
|
46
|
+
*
|
|
47
|
+
* Reports each element, event definition, Zeebe extension or property the
|
|
48
|
+
* target version does not support, and each property that version requires
|
|
49
|
+
* but the model leaves out. From Camunda 8.2 on, processes not marked
|
|
50
|
+
* executable are skipped, as Modeler skips them.
|
|
51
|
+
*
|
|
52
|
+
* @param definitions - The model to check.
|
|
53
|
+
* @param version - The target, e.g. `"8.6"` or `"8.6.2"`. Defaults to the
|
|
54
|
+
* model's own `modeler:executionPlatformVersion`.
|
|
55
|
+
* @returns `compat/*` findings; none when there is no Camunda 8 target.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* const findings = analyzeCamundaCompat(Bpmn.parse(xml), "8.5");
|
|
60
|
+
* // compat/element-type: Ad-hoc sub-process "Tools" needs Camunda 8.7 or newer; ...
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export declare function analyzeCamundaCompat(definitions: BpmnDefinitions, version?: string): OptimizationFinding[];
|
|
64
|
+
/** Whether a finding comes from the Camunda-version compatibility check (`compat/…`). */
|
|
65
|
+
export declare function isCamundaCompatFinding(finding: Pick<OptimizationFinding, "id">): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Drops the compatibility findings another BPMN Kit check already reports on
|
|
68
|
+
* the same element — `compat/implementation` where `deploy/service-task-no-type`
|
|
69
|
+
* fired, and so on through each rule's `equivalents`. Keeps the existing
|
|
70
|
+
* finding: it is the one fixes and docs point at.
|
|
71
|
+
*
|
|
72
|
+
* @param findings - Every finding of one `optimize()` run.
|
|
73
|
+
*/
|
|
74
|
+
export declare function dedupeCamundaCompat(findings: readonly OptimizationFinding[]): OptimizationFinding[];
|
|
75
|
+
/** A `.bpmnlintrc`'s camunda-compat part, split off by {@link splitCamundaCompatConfig}. */
|
|
76
|
+
export interface CamundaCompatConfig {
|
|
77
|
+
/** The version a `plugin:camunda-compat/camunda-cloud-X-Y` extends pins, if any. */
|
|
78
|
+
version?: CamundaCompatVersion;
|
|
79
|
+
/** Plugin rule name (without `camunda-compat/`) → its effective setting. */
|
|
80
|
+
rules: Record<string, BpmnlintRuleSetting>;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Takes the `bpmnlint-plugin-camunda-compat` part out of a resolved
|
|
84
|
+
* `.bpmnlintrc`, so BPMN Kit's own compatibility check can stand in for it.
|
|
85
|
+
*
|
|
86
|
+
* - `extends: "plugin:camunda-compat/camunda-cloud-8-6"` (or the
|
|
87
|
+
* `bpmnlint-plugin-camunda-compat` spelling) pins the target to 8.6 and
|
|
88
|
+
* enables that config's rules at the plugin's severities; the last such
|
|
89
|
+
* entry wins. It also enables bpmnlint's `start-event-required`, as the
|
|
90
|
+
* plugin's configs do.
|
|
91
|
+
* - `camunda-compat/<rule>` entries under `rules` override those severities.
|
|
92
|
+
* - Everything else stays in `rest`, for `applyBpmnlintConfig`.
|
|
93
|
+
*
|
|
94
|
+
* @param config - A resolved `.bpmnlintrc`.
|
|
95
|
+
* @returns `compat` when the file mentions the plugin at all, and the rest.
|
|
96
|
+
*/
|
|
97
|
+
export declare function splitCamundaCompatConfig(config: ResolvedBpmnlintConfig): {
|
|
98
|
+
compat?: CamundaCompatConfig;
|
|
99
|
+
rest: ResolvedBpmnlintConfig;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Applies the camunda-compat part of a `.bpmnlintrc` to a set of findings.
|
|
103
|
+
*
|
|
104
|
+
* A finding a configured plugin rule governs — its `compat/<rule>` findings
|
|
105
|
+
* and the `equivalents` standing in for it — takes the rule's severity and
|
|
106
|
+
* name, or is dropped when the rule is `off`, or when real bpmnlint already
|
|
107
|
+
* ran it (`delegated`). Configured rules BPMN Kit does not check come back as
|
|
108
|
+
* `unsupported`.
|
|
109
|
+
*
|
|
110
|
+
* @param findings - Output of `optimize()`, possibly filtered.
|
|
111
|
+
* @param compat - From {@link splitCamundaCompatConfig}.
|
|
112
|
+
* @param options - `delegated`: the project's bpmnlint reported these rules.
|
|
113
|
+
*/
|
|
114
|
+
export declare function applyCamundaCompatConfig(findings: readonly OptimizationFinding[], compat: CamundaCompatConfig, options?: {
|
|
115
|
+
delegated?: boolean;
|
|
116
|
+
}): {
|
|
117
|
+
findings: OptimizationFinding[];
|
|
118
|
+
unsupported: UnsupportedBpmnlintRule[];
|
|
119
|
+
};
|
|
120
|
+
//# sourceMappingURL=camunda-compat.d.ts.map
|