@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,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JUEL → FEEL translation for the subset where the two languages provably
|
|
3
|
+
* agree on non-null operands: variable paths, literals, comparisons, boolean
|
|
4
|
+
* connectives and arithmetic other than remainder.
|
|
5
|
+
*
|
|
6
|
+
* Everything else — method calls, `empty`, the ternary, indexing, `%`, the
|
|
7
|
+
* engine objects `execution` / `task` — is refused with a reason rather than
|
|
8
|
+
* guessed at. A refused expression becomes a `manual` migration finding.
|
|
9
|
+
*/
|
|
10
|
+
/** The outcome of {@link translateJuelToFeel}. `feel` carries no leading `=`. */
|
|
11
|
+
export type JuelToFeelResult = {
|
|
12
|
+
ok: true;
|
|
13
|
+
feel: string;
|
|
14
|
+
} | {
|
|
15
|
+
ok: false;
|
|
16
|
+
reason: string;
|
|
17
|
+
};
|
|
18
|
+
export interface JuelToFeelOptions {
|
|
19
|
+
/**
|
|
20
|
+
* The expression is a multi-instance completion condition, where Camunda 7's
|
|
21
|
+
* `nrOfInstances` / `nrOfActiveInstances` / `nrOfCompletedInstances` have
|
|
22
|
+
* direct Camunda 8 counterparts.
|
|
23
|
+
*/
|
|
24
|
+
multiInstance?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/** Whether a text contains a JUEL expression (`${…}` or `#{…}`) anywhere. */
|
|
27
|
+
export declare function containsJuel(text: string): boolean;
|
|
28
|
+
/** A FEEL string literal for `value`. */
|
|
29
|
+
export declare function feelString(value: string): string;
|
|
30
|
+
/** Whether `name` can be written as a bare FEEL variable name. */
|
|
31
|
+
export declare function isFeelName(name: string): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Translates one JUEL expression — the whole text must be a single `${…}` or
|
|
34
|
+
* `#{…}` — into FEEL.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* translateJuelToFeel("${order.total > 100 && approved}")
|
|
38
|
+
* // → { ok: true, feel: "order.total > 100 and approved" }
|
|
39
|
+
*/
|
|
40
|
+
export declare function translateJuelToFeel(expression: string, options?: JuelToFeelOptions): JuelToFeelResult;
|
|
41
|
+
//# sourceMappingURL=juel.d.ts.map
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
import { parseExpression } from "@bpmnkit/feel";
|
|
2
|
+
/** Whether a text contains a JUEL expression (`${…}` or `#{…}`) anywhere. */
|
|
3
|
+
export function containsJuel(text) {
|
|
4
|
+
return text.includes("${") || text.includes("#{");
|
|
5
|
+
}
|
|
6
|
+
/** A FEEL string literal for `value`. */
|
|
7
|
+
export function feelString(value) {
|
|
8
|
+
const escaped = value
|
|
9
|
+
.replace(/\\/g, "\\\\")
|
|
10
|
+
.replace(/"/g, '\\"')
|
|
11
|
+
.replace(/\n/g, "\\n")
|
|
12
|
+
.replace(/\r/g, "\\r")
|
|
13
|
+
.replace(/\t/g, "\\t");
|
|
14
|
+
return `"${escaped}"`;
|
|
15
|
+
}
|
|
16
|
+
const FEEL_NAME = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
17
|
+
/** Words FEEL reserves, which therefore cannot stand as a bare variable name. */
|
|
18
|
+
const FEEL_RESERVED = new Set([
|
|
19
|
+
"true",
|
|
20
|
+
"false",
|
|
21
|
+
"null",
|
|
22
|
+
"and",
|
|
23
|
+
"or",
|
|
24
|
+
"not",
|
|
25
|
+
"if",
|
|
26
|
+
"then",
|
|
27
|
+
"else",
|
|
28
|
+
"for",
|
|
29
|
+
"in",
|
|
30
|
+
"return",
|
|
31
|
+
"some",
|
|
32
|
+
"every",
|
|
33
|
+
"satisfies",
|
|
34
|
+
"between",
|
|
35
|
+
"instance",
|
|
36
|
+
"of",
|
|
37
|
+
"function",
|
|
38
|
+
]);
|
|
39
|
+
/** Objects the Camunda 7 engine injects into expressions; Camunda 8 has none of them. */
|
|
40
|
+
const C7_ENGINE_OBJECTS = new Set([
|
|
41
|
+
"execution",
|
|
42
|
+
"task",
|
|
43
|
+
"externalTask",
|
|
44
|
+
"authenticatedUserId",
|
|
45
|
+
"variableScope",
|
|
46
|
+
"connector",
|
|
47
|
+
"caseExecution",
|
|
48
|
+
"dateTime",
|
|
49
|
+
]);
|
|
50
|
+
const MULTI_INSTANCE_RENAMES = {
|
|
51
|
+
nrOfInstances: "numberOfInstances",
|
|
52
|
+
nrOfActiveInstances: "numberOfActiveInstances",
|
|
53
|
+
nrOfCompletedInstances: "numberOfCompletedInstances",
|
|
54
|
+
};
|
|
55
|
+
/** Whether `name` can be written as a bare FEEL variable name. */
|
|
56
|
+
export function isFeelName(name) {
|
|
57
|
+
return FEEL_NAME.test(name) && !FEEL_RESERVED.has(name);
|
|
58
|
+
}
|
|
59
|
+
class Refusal extends Error {
|
|
60
|
+
}
|
|
61
|
+
const OPERATORS = ["&&", "||", "==", "!=", "<=", ">=", "!", "<", ">", "+", "-", "*", "/", "%"];
|
|
62
|
+
const PUNCTUATION = new Set(["(", ")", ".", ",", "?", ":", "[", "]", "{", "}"]);
|
|
63
|
+
function lex(source) {
|
|
64
|
+
const tokens = [];
|
|
65
|
+
let i = 0;
|
|
66
|
+
while (i < source.length) {
|
|
67
|
+
const ch = source.charAt(i);
|
|
68
|
+
if (/\s/.test(ch)) {
|
|
69
|
+
i++;
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
if (/[0-9]/.test(ch)) {
|
|
73
|
+
const match = /^[0-9]+(\.[0-9]+)?/.exec(source.slice(i));
|
|
74
|
+
const text = match?.[0] ?? ch;
|
|
75
|
+
if (/^[eEdDfFlL.]/.test(source.charAt(i + text.length))) {
|
|
76
|
+
throw new Refusal(`numeric literal "${source.slice(i)}" has no exact FEEL form`);
|
|
77
|
+
}
|
|
78
|
+
tokens.push({ kind: "num", text });
|
|
79
|
+
i += text.length;
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
if (ch === "'" || ch === '"') {
|
|
83
|
+
let value = "";
|
|
84
|
+
let j = i + 1;
|
|
85
|
+
for (;;) {
|
|
86
|
+
if (j >= source.length)
|
|
87
|
+
throw new Refusal("unterminated string literal");
|
|
88
|
+
const c = source.charAt(j);
|
|
89
|
+
if (c === "\\") {
|
|
90
|
+
value += source.charAt(j + 1);
|
|
91
|
+
j += 2;
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
if (c === ch)
|
|
95
|
+
break;
|
|
96
|
+
value += c;
|
|
97
|
+
j++;
|
|
98
|
+
}
|
|
99
|
+
tokens.push({ kind: "str", value });
|
|
100
|
+
i = j + 1;
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
if (/[A-Za-z_$]/.test(ch)) {
|
|
104
|
+
const match = /^[A-Za-z_$][A-Za-z0-9_$]*/.exec(source.slice(i));
|
|
105
|
+
const text = match?.[0] ?? ch;
|
|
106
|
+
tokens.push({ kind: "id", text });
|
|
107
|
+
i += text.length;
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
const op = OPERATORS.find((candidate) => source.startsWith(candidate, i));
|
|
111
|
+
if (op !== undefined) {
|
|
112
|
+
tokens.push({ kind: "op", text: op });
|
|
113
|
+
i += op.length;
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
if (PUNCTUATION.has(ch)) {
|
|
117
|
+
tokens.push({ kind: "op", text: ch });
|
|
118
|
+
i++;
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
throw new Refusal(`unexpected character "${ch}"`);
|
|
122
|
+
}
|
|
123
|
+
return tokens;
|
|
124
|
+
}
|
|
125
|
+
// ---------------------------------------------------------------------------
|
|
126
|
+
// Parser — JUEL precedence, emitting FEEL with minimal parentheses
|
|
127
|
+
// ---------------------------------------------------------------------------
|
|
128
|
+
/** FEEL precedence of the node's outermost operator; higher binds tighter. */
|
|
129
|
+
const Prec = {
|
|
130
|
+
Or: 1,
|
|
131
|
+
And: 2,
|
|
132
|
+
Compare: 3,
|
|
133
|
+
Add: 4,
|
|
134
|
+
Mul: 5,
|
|
135
|
+
Unary: 6,
|
|
136
|
+
Atom: 7,
|
|
137
|
+
};
|
|
138
|
+
const COMPARISON = {
|
|
139
|
+
"==": "=",
|
|
140
|
+
eq: "=",
|
|
141
|
+
"!=": "!=",
|
|
142
|
+
ne: "!=",
|
|
143
|
+
"<": "<",
|
|
144
|
+
lt: "<",
|
|
145
|
+
">": ">",
|
|
146
|
+
gt: ">",
|
|
147
|
+
"<=": "<=",
|
|
148
|
+
le: "<=",
|
|
149
|
+
">=": ">=",
|
|
150
|
+
ge: ">=",
|
|
151
|
+
};
|
|
152
|
+
class JuelParser {
|
|
153
|
+
tokens;
|
|
154
|
+
options;
|
|
155
|
+
pos = 0;
|
|
156
|
+
constructor(tokens, options) {
|
|
157
|
+
this.tokens = tokens;
|
|
158
|
+
this.options = options;
|
|
159
|
+
}
|
|
160
|
+
parse() {
|
|
161
|
+
if (this.tokens.length === 0)
|
|
162
|
+
throw new Refusal("empty expression");
|
|
163
|
+
const result = this.or();
|
|
164
|
+
const rest = this.peek();
|
|
165
|
+
if (rest !== undefined)
|
|
166
|
+
throw new Refusal(`unsupported syntax at "${tokenText(rest)}"`);
|
|
167
|
+
return result;
|
|
168
|
+
}
|
|
169
|
+
peek() {
|
|
170
|
+
return this.tokens[this.pos];
|
|
171
|
+
}
|
|
172
|
+
/** Consumes the next token when it is one of `words` (operator or keyword). */
|
|
173
|
+
accept(...words) {
|
|
174
|
+
const token = this.peek();
|
|
175
|
+
if (token === undefined)
|
|
176
|
+
return undefined;
|
|
177
|
+
const text = token.kind === "op" || token.kind === "id" ? token.text : undefined;
|
|
178
|
+
if (text !== undefined && words.includes(text)) {
|
|
179
|
+
this.pos++;
|
|
180
|
+
return text;
|
|
181
|
+
}
|
|
182
|
+
return undefined;
|
|
183
|
+
}
|
|
184
|
+
binary(next, operators, prec, spell) {
|
|
185
|
+
let left = next();
|
|
186
|
+
for (;;) {
|
|
187
|
+
const op = this.accept(...operators);
|
|
188
|
+
if (op === undefined)
|
|
189
|
+
return left;
|
|
190
|
+
const right = next();
|
|
191
|
+
// FEEL comparisons do not chain, so a comparison operand of a comparison is always wrapped.
|
|
192
|
+
const leftText = left.prec < prec || (prec === Prec.Compare && left.prec === prec)
|
|
193
|
+
? `(${left.text})`
|
|
194
|
+
: left.text;
|
|
195
|
+
const rightText = right.prec <= prec ? `(${right.text})` : right.text;
|
|
196
|
+
left = { text: `${leftText} ${spell(op)} ${rightText}`, prec };
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
or() {
|
|
200
|
+
const result = this.binary(() => this.and(), ["||", "or"], Prec.Or, () => "or");
|
|
201
|
+
if (this.peek()?.kind === "op" && tokenText(this.peek()) === "?") {
|
|
202
|
+
throw new Refusal("the conditional operator ?: coerces its condition; rewrite as if-then-else");
|
|
203
|
+
}
|
|
204
|
+
return result;
|
|
205
|
+
}
|
|
206
|
+
and() {
|
|
207
|
+
return this.binary(() => this.equality(), ["&&", "and"], Prec.And, () => "and");
|
|
208
|
+
}
|
|
209
|
+
equality() {
|
|
210
|
+
return this.binary(() => this.relational(), ["==", "!=", "eq", "ne"], Prec.Compare, (op) => COMPARISON[op] ?? op);
|
|
211
|
+
}
|
|
212
|
+
relational() {
|
|
213
|
+
return this.binary(() => this.additive(), ["<", ">", "<=", ">=", "lt", "gt", "le", "ge"], Prec.Compare, (op) => COMPARISON[op] ?? op);
|
|
214
|
+
}
|
|
215
|
+
additive() {
|
|
216
|
+
return this.binary(() => this.multiplicative(), ["+", "-"], Prec.Add, (op) => op);
|
|
217
|
+
}
|
|
218
|
+
multiplicative() {
|
|
219
|
+
const result = this.binary(() => this.unary(), ["*", "/", "div"], Prec.Mul, (op) => (op === "div" ? "/" : op));
|
|
220
|
+
if (this.accept("%", "mod") !== undefined) {
|
|
221
|
+
throw new Refusal("remainder (%) has a different sign rule in FEEL's modulo()");
|
|
222
|
+
}
|
|
223
|
+
return result;
|
|
224
|
+
}
|
|
225
|
+
unary() {
|
|
226
|
+
if (this.accept("!", "not") !== undefined) {
|
|
227
|
+
const operand = this.unary();
|
|
228
|
+
return { text: `not(${operand.text})`, prec: Prec.Atom };
|
|
229
|
+
}
|
|
230
|
+
if (this.accept("-") !== undefined) {
|
|
231
|
+
const operand = this.unary();
|
|
232
|
+
const text = operand.prec <= Prec.Unary ? `(${operand.text})` : operand.text;
|
|
233
|
+
return { text: `-${text}`, prec: Prec.Unary };
|
|
234
|
+
}
|
|
235
|
+
if (this.accept("empty") !== undefined) {
|
|
236
|
+
throw new Refusal('"empty" is true for null, "" and empty collections alike');
|
|
237
|
+
}
|
|
238
|
+
return this.value();
|
|
239
|
+
}
|
|
240
|
+
value() {
|
|
241
|
+
const token = this.peek();
|
|
242
|
+
if (token === undefined)
|
|
243
|
+
throw new Refusal("expression ends early");
|
|
244
|
+
this.pos++;
|
|
245
|
+
if (token.kind === "num")
|
|
246
|
+
return { text: token.text, prec: Prec.Atom };
|
|
247
|
+
if (token.kind === "str")
|
|
248
|
+
return { text: feelString(token.value), prec: Prec.Atom };
|
|
249
|
+
if (token.kind === "op") {
|
|
250
|
+
if (token.text === "(") {
|
|
251
|
+
const inner = this.or();
|
|
252
|
+
if (this.accept(")") === undefined)
|
|
253
|
+
throw new Refusal("unbalanced parentheses");
|
|
254
|
+
return { text: `(${inner.text})`, prec: Prec.Atom };
|
|
255
|
+
}
|
|
256
|
+
throw new Refusal(`unsupported syntax at "${token.text}"`);
|
|
257
|
+
}
|
|
258
|
+
if (token.text === "true" || token.text === "false" || token.text === "null") {
|
|
259
|
+
return { text: token.text, prec: Prec.Atom };
|
|
260
|
+
}
|
|
261
|
+
const path = [this.name(token.text, true)];
|
|
262
|
+
for (;;) {
|
|
263
|
+
const next = this.peek();
|
|
264
|
+
if (next?.kind === "op" && next.text === "[") {
|
|
265
|
+
throw new Refusal("indexing ([…]) is zero-based in JUEL and one-based in FEEL");
|
|
266
|
+
}
|
|
267
|
+
if (next?.kind === "op" && next.text === "(") {
|
|
268
|
+
throw new Refusal(`method or function call "${path.join(".")}(…)" has no FEEL equivalent`);
|
|
269
|
+
}
|
|
270
|
+
if (this.accept(".") === undefined)
|
|
271
|
+
break;
|
|
272
|
+
const member = this.peek();
|
|
273
|
+
if (member?.kind !== "id")
|
|
274
|
+
throw new Refusal("a property name must follow '.'");
|
|
275
|
+
this.pos++;
|
|
276
|
+
path.push(this.name(member.text, false));
|
|
277
|
+
}
|
|
278
|
+
return { text: path.join("."), prec: Prec.Atom };
|
|
279
|
+
}
|
|
280
|
+
name(text, head) {
|
|
281
|
+
if (head && C7_ENGINE_OBJECTS.has(text)) {
|
|
282
|
+
throw new Refusal(`"${text}" is a Camunda 7 engine object with no Camunda 8 counterpart`);
|
|
283
|
+
}
|
|
284
|
+
if (head && text in MULTI_INSTANCE_RENAMES) {
|
|
285
|
+
const renamed = MULTI_INSTANCE_RENAMES[text];
|
|
286
|
+
if (this.options.multiInstance !== true || renamed === undefined) {
|
|
287
|
+
throw new Refusal(`"${text}" exists only in a multi-instance completion condition`);
|
|
288
|
+
}
|
|
289
|
+
return renamed;
|
|
290
|
+
}
|
|
291
|
+
if (!isFeelName(text))
|
|
292
|
+
throw new Refusal(`"${text}" is not a valid FEEL name`);
|
|
293
|
+
return text;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
function tokenText(token) {
|
|
297
|
+
if (token === undefined)
|
|
298
|
+
return "";
|
|
299
|
+
return token.kind === "str" ? token.value : token.text;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Translates one JUEL expression — the whole text must be a single `${…}` or
|
|
303
|
+
* `#{…}` — into FEEL.
|
|
304
|
+
*
|
|
305
|
+
* @example
|
|
306
|
+
* translateJuelToFeel("${order.total > 100 && approved}")
|
|
307
|
+
* // → { ok: true, feel: "order.total > 100 and approved" }
|
|
308
|
+
*/
|
|
309
|
+
export function translateJuelToFeel(expression, options = {}) {
|
|
310
|
+
const trimmed = expression.trim();
|
|
311
|
+
if (!/^[$#]\{[\s\S]*\}$/.test(trimmed)) {
|
|
312
|
+
return {
|
|
313
|
+
ok: false,
|
|
314
|
+
reason: containsJuel(trimmed)
|
|
315
|
+
? "text mixed with ${…} is string templating, which FEEL does not do implicitly"
|
|
316
|
+
: "not a JUEL expression",
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
try {
|
|
320
|
+
const emitted = new JuelParser(lex(trimmed.slice(2, -1)), options).parse();
|
|
321
|
+
const { errors } = parseExpression(emitted.text);
|
|
322
|
+
if (errors.length > 0) {
|
|
323
|
+
return { ok: false, reason: `translation is not valid FEEL: ${errors[0]?.message ?? ""}` };
|
|
324
|
+
}
|
|
325
|
+
return { ok: true, feel: emitted.text };
|
|
326
|
+
}
|
|
327
|
+
catch (error) {
|
|
328
|
+
if (error instanceof Refusal)
|
|
329
|
+
return { ok: false, reason: error.message };
|
|
330
|
+
throw error;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
//# sourceMappingURL=juel.js.map
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { BpmnDefinitions } from "../bpmn-model.js";
|
|
2
|
+
/**
|
|
3
|
+
* How much work a Camunda 7 construct leaves after conversion.
|
|
4
|
+
*
|
|
5
|
+
* - `convertible` — rewritten mechanically; the Camunda 8 model behaves the same.
|
|
6
|
+
* - `manual` — Camunda 8 has an equivalent, but a person has to supply or check
|
|
7
|
+
* it (a job worker to write, an expression to translate, a key to choose).
|
|
8
|
+
* - `unsupported` — Camunda 8 has no equivalent; the model or the surrounding
|
|
9
|
+
* system has to change.
|
|
10
|
+
*/
|
|
11
|
+
export type Camunda7Severity = "convertible" | "manual" | "unsupported";
|
|
12
|
+
/** One Camunda 7 construct and what migrating it takes. */
|
|
13
|
+
export interface Camunda7Finding {
|
|
14
|
+
/** The element carrying the construct — a flow element, flow, process or the definitions. */
|
|
15
|
+
elementId: string;
|
|
16
|
+
/** The BPMN type of that element, e.g. `serviceTask`, `sequenceFlow`, `process`. */
|
|
17
|
+
elementType: string;
|
|
18
|
+
/** The process the element belongs to; empty for document-level findings. */
|
|
19
|
+
processId: string;
|
|
20
|
+
/** The Camunda 7 construct, e.g. `camunda:class` or `camunda:inputOutput`. */
|
|
21
|
+
construct: string;
|
|
22
|
+
severity: Camunda7Severity;
|
|
23
|
+
message: string;
|
|
24
|
+
/** The Camunda 8 equivalent, or what to do instead. */
|
|
25
|
+
suggestion: string;
|
|
26
|
+
/**
|
|
27
|
+
* Whether {@link convertCamunda7} wrote a Camunda 8 equivalent. When it did,
|
|
28
|
+
* the Camunda 7 original was removed; when it did not, the original is kept
|
|
29
|
+
* verbatim (Camunda 8 ignores it) so nothing is lost.
|
|
30
|
+
*/
|
|
31
|
+
applied: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface Camunda7Report {
|
|
34
|
+
findings: Camunda7Finding[];
|
|
35
|
+
counts: Record<Camunda7Severity, number>;
|
|
36
|
+
total: number;
|
|
37
|
+
}
|
|
38
|
+
export interface Camunda7ConvertOptions {
|
|
39
|
+
/** Written as `modeler:executionPlatformVersion`. Default `"8.8.0"`. */
|
|
40
|
+
executionPlatformVersion?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Ignored. Kept for compatibility: earlier versions read `camunda:` attributes
|
|
43
|
+
* on multi-instance loops and event definitions from the source XML, because
|
|
44
|
+
* the parser dropped them. The parser now keeps them in `unknownAttributes`.
|
|
45
|
+
*/
|
|
46
|
+
sourceXml?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface Camunda7Conversion {
|
|
49
|
+
definitions: BpmnDefinitions;
|
|
50
|
+
report: Camunda7Report;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Converts a Camunda 7 model to Camunda 8, as far as that can be done
|
|
54
|
+
* mechanically, and reports what it could not do. The input is not modified.
|
|
55
|
+
*
|
|
56
|
+
* What cannot be converted stays in the output verbatim — Camunda 8 ignores
|
|
57
|
+
* `camunda:` content — and has a `manual` or `unsupported` finding saying why.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```typescript
|
|
61
|
+
* const { definitions, report } = convertCamunda7(Bpmn.parse(xml))
|
|
62
|
+
* for (const f of report.findings) console.log(f.severity, f.elementId, f.message)
|
|
63
|
+
* const c8Xml = Bpmn.export(definitions)
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export declare function convertCamunda7(definitions: BpmnDefinitions, options?: Camunda7ConvertOptions): Camunda7Conversion;
|
|
67
|
+
/**
|
|
68
|
+
* Reports what migrating a Camunda 7 model to Camunda 8 takes, element by
|
|
69
|
+
* element, without changing it. Same findings as {@link convertCamunda7}.
|
|
70
|
+
*/
|
|
71
|
+
export declare function analyzeCamunda7(definitions: BpmnDefinitions, options?: Pick<Camunda7ConvertOptions, "sourceXml">): Camunda7Report;
|
|
72
|
+
//# sourceMappingURL=migrate.d.ts.map
|