@bpmnkit/core 1.8.0 → 1.10.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/agent-cards/bpmn.md +4 -2
- package/builder-reference.md +11 -9
- package/dist/bpmn/auto-layout.js +82 -26
- package/dist/bpmn/bpmn-builder.d.ts +84 -7
- package/dist/bpmn/bpmn-builder.js +321 -76
- package/dist/bpmn/bpmn-model.d.ts +2 -0
- package/dist/bpmn/bpmn-parser.js +68 -76
- package/dist/bpmn/bpmn-serializer.js +60 -19
- package/dist/bpmn/bpmnlint.js +4 -69
- package/dist/bpmn/builder-rules.d.ts +20 -0
- package/dist/bpmn/builder-rules.js +120 -0
- package/dist/bpmn/camunda-compat-data.d.ts +10 -148
- package/dist/bpmn/camunda-compat-data.js +16 -407
- package/dist/bpmn/camunda-compat-feel.d.ts +3 -0
- package/dist/bpmn/camunda-compat-feel.js +1 -1
- package/dist/bpmn/camunda-compat.js +7 -6
- package/dist/bpmn/camunda7/export.js +4 -1
- package/dist/bpmn/camunda7/juel.js +2 -1
- package/dist/bpmn/camunda7/migrate.d.ts +23 -0
- package/dist/bpmn/camunda7/migrate.js +75 -3
- package/dist/bpmn/compact-stream.js +2 -1
- package/dist/bpmn/compact.d.ts +80 -4
- package/dist/bpmn/compact.js +220 -38
- package/dist/bpmn/feel-condition.d.ts +9 -0
- package/dist/bpmn/feel-condition.js +19 -0
- package/dist/bpmn/full-operations.js +31 -4
- package/dist/bpmn/index.d.ts +17 -1
- package/dist/bpmn/index.js +19 -25
- package/dist/bpmn/operations.d.ts +4 -4
- package/dist/bpmn/operations.js +14 -2
- package/dist/bpmn/optimize/bpmnlint-rules.js +7 -40
- package/dist/bpmn/optimize/index.js +15 -1
- package/dist/bpmn/optimize/tasks.js +12 -3
- package/dist/bpmn/process-delta.d.ts +18 -0
- package/dist/bpmn/process-delta.js +20 -2
- package/dist/bpmn/process-text-writer.js +27 -1
- package/dist/bpmn/process-text.d.ts +9 -3
- package/dist/bpmn/process-text.js +122 -16
- package/dist/bpmn/stable-ids.d.ts +2 -0
- package/dist/bpmn/stable-ids.js +8 -0
- package/dist/bpmn/xsd-guards.d.ts +8 -0
- package/dist/bpmn/xsd-guards.js +56 -0
- package/dist/bpmn/zeebe-extensions.js +2 -1
- package/dist/bpmn/zeebe-placement.js +6 -129
- package/dist/bpmn/zeebe-validate/context.d.ts +132 -0
- package/dist/bpmn/zeebe-validate/context.js +241 -0
- package/dist/bpmn/zeebe-validate/gate.d.ts +87 -0
- package/dist/bpmn/zeebe-validate/gate.js +492 -0
- package/dist/bpmn/zeebe-validate/index.d.ts +37 -0
- package/dist/bpmn/zeebe-validate/index.js +106 -0
- package/dist/bpmn/zeebe-validate/rules/events.d.ts +4 -0
- package/dist/bpmn/zeebe-validate/rules/events.js +580 -0
- package/dist/bpmn/zeebe-validate/rules/extensions.d.ts +4 -0
- package/dist/bpmn/zeebe-validate/rules/extensions.js +411 -0
- package/dist/bpmn/zeebe-validate/rules/gateways.d.ts +3 -0
- package/dist/bpmn/zeebe-validate/rules/gateways.js +296 -0
- package/dist/bpmn/zeebe-validate/rules/references.d.ts +3 -0
- package/dist/bpmn/zeebe-validate/rules/references.js +495 -0
- package/dist/bpmn/zeebe-validate/rules/structure.d.ts +3 -0
- package/dist/bpmn/zeebe-validate/rules/structure.js +629 -0
- package/dist/bpmn/zeebe-validate/rules/tasks.d.ts +4 -0
- package/dist/bpmn/zeebe-validate/rules/tasks.js +446 -0
- package/dist/bpmn/zeebe-validate/xml.d.ts +15 -0
- package/dist/bpmn/zeebe-validate/xml.js +1062 -0
- package/dist/bpmn/zeebe-validate/xsd.d.ts +19 -0
- package/dist/bpmn/zeebe-validate/xsd.js +350 -0
- package/dist/connectors/apply-element.d.ts +5 -2
- package/dist/connectors/apply-element.js +6 -0
- package/dist/connectors/apply-many.d.ts +9 -2
- package/dist/connectors/apply-many.js +17 -2
- package/dist/connectors/apply.d.ts +4 -2
- package/dist/connectors/deployability.d.ts +27 -0
- package/dist/connectors/deployability.js +41 -0
- package/dist/connectors/index.d.ts +1 -0
- package/dist/connectors/lines.d.ts +10 -0
- package/dist/connectors/lines.js +13 -4
- package/dist/dmn/dmn-model.d.ts +24 -4
- package/dist/dmn/dmn-parser.js +37 -3
- package/dist/dmn/dmn-serializer.js +48 -47
- package/dist/dmn/lint.js +4 -11
- package/dist/errors.d.ts +30 -1
- package/dist/errors.js +31 -0
- package/dist/form/form-model.d.ts +11 -0
- package/dist/form/form-parser.d.ts +1 -0
- package/dist/form/form-parser.js +48 -12
- package/dist/form/form-serializer.js +40 -17
- package/dist/form/lint.js +6 -40
- package/dist/generated/bpmn-elements.d.ts +5 -0
- package/dist/generated/bpmn-elements.js +151 -0
- package/dist/generated/camunda-compat-data.d.ts +148 -0
- package/dist/generated/camunda-compat-data.js +371 -0
- package/dist/generated/dmn-elements.d.ts +12 -0
- package/dist/generated/dmn-elements.js +45 -0
- package/dist/generated/form-elements.d.ts +5 -0
- package/dist/generated/form-elements.js +45 -0
- package/dist/generated/lint-rules.d.ts +17 -0
- package/dist/generated/lint-rules.js +116 -0
- package/dist/generated/zeebe-elements.d.ts +10 -0
- package/dist/generated/zeebe-elements.js +168 -0
- package/dist/generated/zeebe-rules.d.ts +25 -0
- package/dist/generated/zeebe-rules.js +202 -0
- package/dist/index.d.ts +11 -4
- package/dist/index.js +4 -1
- package/dist/layout/annotations.js +21 -1
- package/dist/layout/orthogonal.js +9 -3
- package/dist/plan/compile.d.ts +26 -1
- package/dist/plan/compile.js +48 -6
- package/dist/plan/merge.d.ts +2 -1
- package/dist/plan/merge.js +13 -5
- package/package.json +2 -2
|
@@ -15,8 +15,8 @@ export type ElementPatch = Partial<Omit<CompactElement, "multiInstance">> & {
|
|
|
15
15
|
* Names the `bpmn:message` / sets the error, escalation or signal the element's
|
|
16
16
|
* event definition references: they are written on that root element, created
|
|
17
17
|
* if the reference is missing. A root shared by several elements is reported
|
|
18
|
-
* rather than changed for all of them. `""` clears.
|
|
19
|
-
*
|
|
18
|
+
* rather than changed for all of them. `""` clears. On a compact diagram they
|
|
19
|
+
* are the element's fields of the same names, which `expand` writes.
|
|
20
20
|
*/
|
|
21
21
|
messageName?: string;
|
|
22
22
|
errorCode?: string;
|
|
@@ -28,8 +28,8 @@ export type ElementPatch = Partial<Omit<CompactElement, "multiInstance">> & {
|
|
|
28
28
|
/**
|
|
29
29
|
* The message correlation key (`zeebe:subscription`). It is written onto the
|
|
30
30
|
* `bpmn:message` the element references, where Camunda reads it, so every
|
|
31
|
-
* element sharing that message gets it.
|
|
32
|
-
*
|
|
31
|
+
* element sharing that message gets it. On a compact diagram it is the
|
|
32
|
+
* element's `correlationKey`.
|
|
33
33
|
*/
|
|
34
34
|
correlationKey?: string;
|
|
35
35
|
/**
|
package/dist/bpmn/operations.js
CHANGED
|
@@ -68,9 +68,21 @@ function applyOne(diagram, op) {
|
|
|
68
68
|
case "update": {
|
|
69
69
|
const found = findElementIn(process, op.id);
|
|
70
70
|
if (found) {
|
|
71
|
-
|
|
72
|
-
const { correlationKey: _messageLevel, messageName: _m, errorCode: _e, escalationCode: _x, signalName: _s, timerDate: _d, timerCycle: _c, multiInstance, ...patch } = op.patch;
|
|
71
|
+
const { multiInstance, ...patch } = op.patch;
|
|
73
72
|
Object.assign(found.element, patch);
|
|
73
|
+
// `""` clears a name or code, as it does on the full model
|
|
74
|
+
for (const key of [
|
|
75
|
+
"messageName",
|
|
76
|
+
"correlationKey",
|
|
77
|
+
"signalName",
|
|
78
|
+
"errorCode",
|
|
79
|
+
"escalationCode",
|
|
80
|
+
"timerDate",
|
|
81
|
+
"timerCycle",
|
|
82
|
+
]) {
|
|
83
|
+
if (found.element[key] === "")
|
|
84
|
+
delete found.element[key];
|
|
85
|
+
}
|
|
74
86
|
if (multiInstance?.collection === "")
|
|
75
87
|
found.element.multiInstance = undefined;
|
|
76
88
|
else if (multiInstance) {
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* of each scope rather than from the `<incoming>`/`<outgoing>` children, which
|
|
14
14
|
* hand-written and generated XML routinely omits.
|
|
15
15
|
*/
|
|
16
|
+
import { NATIVE_RULE_CATEGORIES, STANDARD_SIZE_DEFAULTS } from "../../generated/lint-rules.js";
|
|
16
17
|
function isSubContainer(el) {
|
|
17
18
|
return (el.type === "subProcess" ||
|
|
18
19
|
el.type === "adHocSubProcess" ||
|
|
@@ -137,7 +138,6 @@ function isBlank(name) {
|
|
|
137
138
|
const SUB_SCOPE_KINDS = new Set(["subProcess", "eventSubProcess", "transaction"]);
|
|
138
139
|
const RULES = {
|
|
139
140
|
"ad-hoc-sub-process": {
|
|
140
|
-
category: "flow",
|
|
141
141
|
check({ scopes }, report) {
|
|
142
142
|
for (const scope of scopes) {
|
|
143
143
|
if (scope.kind !== "adHocSubProcess")
|
|
@@ -151,7 +151,6 @@ const RULES = {
|
|
|
151
151
|
},
|
|
152
152
|
},
|
|
153
153
|
"conditional-event": {
|
|
154
|
-
category: "flow",
|
|
155
154
|
check({ scopes }, report) {
|
|
156
155
|
for (const scope of scopes) {
|
|
157
156
|
if (!scope.executable)
|
|
@@ -168,7 +167,6 @@ const RULES = {
|
|
|
168
167
|
// Stands in for `feel/empty-condition` while configured (see `replaces` in
|
|
169
168
|
// `../bpmnlint.ts`), so it shares that finding's category.
|
|
170
169
|
"conditional-flows": {
|
|
171
|
-
category: "feel",
|
|
172
170
|
check({ scopes }, report) {
|
|
173
171
|
for (const scope of scopes) {
|
|
174
172
|
for (const el of scope.container.flowElements) {
|
|
@@ -186,7 +184,6 @@ const RULES = {
|
|
|
186
184
|
},
|
|
187
185
|
},
|
|
188
186
|
"end-event-required": {
|
|
189
|
-
category: "flow",
|
|
190
187
|
check({ scopes }, report) {
|
|
191
188
|
// Top-level processes are covered by `flow/no-end-event`.
|
|
192
189
|
for (const scope of scopes) {
|
|
@@ -199,7 +196,6 @@ const RULES = {
|
|
|
199
196
|
},
|
|
200
197
|
},
|
|
201
198
|
"event-based-gateway": {
|
|
202
|
-
category: "flow",
|
|
203
199
|
check({ scopes }, report) {
|
|
204
200
|
for (const scope of scopes) {
|
|
205
201
|
for (const el of scope.container.flowElements) {
|
|
@@ -217,7 +213,6 @@ const RULES = {
|
|
|
217
213
|
},
|
|
218
214
|
},
|
|
219
215
|
"event-sub-process-typed-start-event": {
|
|
220
|
-
category: "flow",
|
|
221
216
|
check({ scopes }, report) {
|
|
222
217
|
for (const scope of scopes) {
|
|
223
218
|
if (!scope.eventSubProcess)
|
|
@@ -231,7 +226,6 @@ const RULES = {
|
|
|
231
226
|
},
|
|
232
227
|
},
|
|
233
228
|
"fake-join": {
|
|
234
|
-
category: "flow",
|
|
235
229
|
check({ scopes }, report) {
|
|
236
230
|
for (const scope of scopes) {
|
|
237
231
|
for (const el of scope.container.flowElements) {
|
|
@@ -249,7 +243,6 @@ const RULES = {
|
|
|
249
243
|
},
|
|
250
244
|
},
|
|
251
245
|
global: {
|
|
252
|
-
category: "pattern",
|
|
253
246
|
check({ defs, scopes }, report) {
|
|
254
247
|
const referenced = new Set();
|
|
255
248
|
for (const scope of scopes) {
|
|
@@ -299,7 +292,6 @@ const RULES = {
|
|
|
299
292
|
},
|
|
300
293
|
},
|
|
301
294
|
"label-required": {
|
|
302
|
-
category: "naming",
|
|
303
295
|
check({ defs, scopes }, report) {
|
|
304
296
|
const missing = (id, what, processId) => report("naming/missing-label", `${what} "${id}" has no label.`, "Name it, so the diagram says what it does or means.", processId, [id]);
|
|
305
297
|
for (const collaboration of defs.collaborations) {
|
|
@@ -339,7 +331,6 @@ const RULES = {
|
|
|
339
331
|
},
|
|
340
332
|
},
|
|
341
333
|
"link-event": {
|
|
342
|
-
category: "flow",
|
|
343
334
|
check({ scopes }, report) {
|
|
344
335
|
for (const scope of scopes) {
|
|
345
336
|
const links = scope.container.flowElements.flatMap((el) => {
|
|
@@ -380,7 +371,6 @@ const RULES = {
|
|
|
380
371
|
},
|
|
381
372
|
},
|
|
382
373
|
"no-bpmndi": {
|
|
383
|
-
category: "pattern",
|
|
384
374
|
check({ defs }, report) {
|
|
385
375
|
const drawn = new Set();
|
|
386
376
|
for (const diagram of defs.diagrams) {
|
|
@@ -435,13 +425,11 @@ const RULES = {
|
|
|
435
425
|
},
|
|
436
426
|
},
|
|
437
427
|
"no-complex-gateway": {
|
|
438
|
-
category: "pattern",
|
|
439
428
|
check({ scopes }, report) {
|
|
440
429
|
discouraged(scopes, report, "complexGateway", "pattern/complex-gateway", "complex gateway");
|
|
441
430
|
},
|
|
442
431
|
},
|
|
443
432
|
"no-disconnected": {
|
|
444
|
-
category: "flow",
|
|
445
433
|
check({ scopes }, report) {
|
|
446
434
|
for (const scope of scopes) {
|
|
447
435
|
if (scope.kind === "adHocSubProcess")
|
|
@@ -463,7 +451,6 @@ const RULES = {
|
|
|
463
451
|
},
|
|
464
452
|
},
|
|
465
453
|
"no-duplicate-sequence-flows": {
|
|
466
|
-
category: "flow",
|
|
467
454
|
check({ scopes }, report) {
|
|
468
455
|
for (const scope of scopes) {
|
|
469
456
|
const seen = new Set();
|
|
@@ -479,7 +466,6 @@ const RULES = {
|
|
|
479
466
|
},
|
|
480
467
|
},
|
|
481
468
|
"no-gateway-join-fork": {
|
|
482
|
-
category: "flow",
|
|
483
469
|
check({ scopes }, report) {
|
|
484
470
|
// `flow/mixed-gateway` from `optimize()` covers the top level.
|
|
485
471
|
for (const scope of scopes) {
|
|
@@ -498,7 +484,6 @@ const RULES = {
|
|
|
498
484
|
},
|
|
499
485
|
},
|
|
500
486
|
"no-implicit-end": {
|
|
501
|
-
category: "flow",
|
|
502
487
|
check({ defs, scopes }, report) {
|
|
503
488
|
const processes = new Map(defs.processes.map((p) => [p.id, p]));
|
|
504
489
|
for (const scope of scopes) {
|
|
@@ -527,7 +512,6 @@ const RULES = {
|
|
|
527
512
|
},
|
|
528
513
|
},
|
|
529
514
|
"no-implicit-start": {
|
|
530
|
-
category: "flow",
|
|
531
515
|
check({ scopes }, report) {
|
|
532
516
|
for (const scope of scopes) {
|
|
533
517
|
if (scope.kind === "adHocSubProcess")
|
|
@@ -549,7 +533,6 @@ const RULES = {
|
|
|
549
533
|
},
|
|
550
534
|
},
|
|
551
535
|
"no-implicit-split": {
|
|
552
|
-
category: "flow",
|
|
553
536
|
check({ scopes }, report) {
|
|
554
537
|
for (const scope of scopes) {
|
|
555
538
|
for (const el of scope.container.flowElements) {
|
|
@@ -565,19 +548,16 @@ const RULES = {
|
|
|
565
548
|
},
|
|
566
549
|
},
|
|
567
550
|
"no-inclusive-gateway": {
|
|
568
|
-
category: "pattern",
|
|
569
551
|
check({ scopes }, report) {
|
|
570
552
|
discouraged(scopes, report, "inclusiveGateway", "pattern/inclusive-gateway", "inclusive gateway");
|
|
571
553
|
},
|
|
572
554
|
},
|
|
573
555
|
"no-overlapping-elements": {
|
|
574
|
-
category: "pattern",
|
|
575
556
|
check({ defs }, report) {
|
|
576
557
|
checkOverlaps(defs, report);
|
|
577
558
|
},
|
|
578
559
|
},
|
|
579
560
|
"single-blank-start-event": {
|
|
580
|
-
category: "flow",
|
|
581
561
|
check({ scopes }, report) {
|
|
582
562
|
for (const scope of scopes) {
|
|
583
563
|
const blank = scope.container.flowElements.filter((el) => el.type === "startEvent" && el.eventDefinitions.length === 0);
|
|
@@ -589,7 +569,6 @@ const RULES = {
|
|
|
589
569
|
},
|
|
590
570
|
},
|
|
591
571
|
"single-event-definition": {
|
|
592
|
-
category: "flow",
|
|
593
572
|
check({ scopes }, report) {
|
|
594
573
|
for (const scope of scopes) {
|
|
595
574
|
for (const el of scope.container.flowElements) {
|
|
@@ -602,13 +581,11 @@ const RULES = {
|
|
|
602
581
|
},
|
|
603
582
|
},
|
|
604
583
|
"standard-size": {
|
|
605
|
-
category: "pattern",
|
|
606
584
|
check({ defs, options }, report) {
|
|
607
585
|
checkStandardSizes(defs, options, report);
|
|
608
586
|
},
|
|
609
587
|
},
|
|
610
588
|
"start-event-required": {
|
|
611
|
-
category: "flow",
|
|
612
589
|
check({ scopes }, report) {
|
|
613
590
|
// Top-level processes are covered by `flow/no-start-event`.
|
|
614
591
|
for (const scope of scopes) {
|
|
@@ -621,7 +598,6 @@ const RULES = {
|
|
|
621
598
|
},
|
|
622
599
|
},
|
|
623
600
|
"sub-process-blank-start-event": {
|
|
624
|
-
category: "flow",
|
|
625
601
|
check({ scopes }, report) {
|
|
626
602
|
for (const scope of scopes) {
|
|
627
603
|
if (scope.kind === "process" || scope.eventSubProcess)
|
|
@@ -635,7 +611,6 @@ const RULES = {
|
|
|
635
611
|
},
|
|
636
612
|
},
|
|
637
613
|
"superfluous-gateway": {
|
|
638
|
-
category: "flow",
|
|
639
614
|
check({ scopes }, report) {
|
|
640
615
|
// `flow/redundant-gateway` from `optimize()` covers the top level.
|
|
641
616
|
for (const scope of scopes) {
|
|
@@ -654,7 +629,6 @@ const RULES = {
|
|
|
654
629
|
},
|
|
655
630
|
},
|
|
656
631
|
"superfluous-label": {
|
|
657
|
-
category: "naming",
|
|
658
632
|
check({ scopes }, report) {
|
|
659
633
|
for (const scope of scopes) {
|
|
660
634
|
const byId = new Map(scope.container.flowElements.map((el) => [el.id, el]));
|
|
@@ -674,7 +648,6 @@ const RULES = {
|
|
|
674
648
|
},
|
|
675
649
|
},
|
|
676
650
|
"superfluous-termination": {
|
|
677
|
-
category: "flow",
|
|
678
651
|
check({ scopes }, report) {
|
|
679
652
|
for (const scope of scopes) {
|
|
680
653
|
if (scope.kind === "adHocSubProcess")
|
|
@@ -795,16 +768,7 @@ function checkOverlaps(defs, report) {
|
|
|
795
768
|
}
|
|
796
769
|
}
|
|
797
770
|
/** bpmn-js's default sizes, as bpmnlint copies them. Overridable per type. */
|
|
798
|
-
const DEFAULT_SIZES =
|
|
799
|
-
"bpmn:Task": { width: 100, height: 80 },
|
|
800
|
-
"bpmn:CallActivity": { width: 100, height: 80 },
|
|
801
|
-
"bpmn:SubProcess": { width: 100, height: 80 },
|
|
802
|
-
"bpmn:Gateway": { width: 50, height: 50 },
|
|
803
|
-
"bpmn:Event": { width: 36, height: 36 },
|
|
804
|
-
"bpmn:DataObjectReference": { width: 36, height: 50 },
|
|
805
|
-
"bpmn:DataStoreReference": { width: 50, height: 50 },
|
|
806
|
-
"bpmn:Participant": { width: 60, height: 60 },
|
|
807
|
-
};
|
|
771
|
+
const DEFAULT_SIZES = STANDARD_SIZE_DEFAULTS;
|
|
808
772
|
function sizeType(el) {
|
|
809
773
|
if (isSubContainer(el))
|
|
810
774
|
return "bpmn:SubProcess";
|
|
@@ -897,12 +861,15 @@ export function analyzeBpmnlintRules(defs, rules, categories) {
|
|
|
897
861
|
const rule = RULES[name];
|
|
898
862
|
if (rule === undefined)
|
|
899
863
|
continue;
|
|
900
|
-
|
|
864
|
+
const category = NATIVE_RULE_CATEGORIES[name];
|
|
865
|
+
if (category === undefined)
|
|
866
|
+
continue;
|
|
867
|
+
if (categories !== undefined && !categories.includes(category))
|
|
901
868
|
continue;
|
|
902
869
|
rule.check({ defs, scopes, options }, (id, message, suggestion, processId, elementIds) => {
|
|
903
870
|
findings.push({
|
|
904
871
|
id,
|
|
905
|
-
category
|
|
872
|
+
category,
|
|
906
873
|
severity: "warning",
|
|
907
874
|
message,
|
|
908
875
|
suggestion,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { analyzeCamundaCompat, dedupeCamundaCompat } from "../camunda-compat.js";
|
|
1
|
+
import { analyzeCamundaCompat, dedupeCamundaCompat, targetCamundaVersion, } from "../camunda-compat.js";
|
|
2
|
+
import { validateDeployable } from "../zeebe-validate/index.js";
|
|
2
3
|
import { analyzeAgentic } from "./agentic.js";
|
|
3
4
|
import { analyzeDeploy } from "./deploy.js";
|
|
4
5
|
import { analyzeFeelSyntax } from "./feel-syntax.js";
|
|
@@ -80,6 +81,19 @@ export function optimize(defs, options) {
|
|
|
80
81
|
findings = findings.filter((f) => f.id !== USER_TASK_FORM_RULE);
|
|
81
82
|
}
|
|
82
83
|
}
|
|
84
|
+
// Zeebe's own deploy rules (`zeebe/…`), recursive and version-aware. An element
|
|
85
|
+
// another deploy or FEEL syntax finding already marks as an error keeps that
|
|
86
|
+
// finding, which says more and may carry a fix; `validateDeployable` still
|
|
87
|
+
// reports everything.
|
|
88
|
+
if (resolved.categories.includes("deploy")) {
|
|
89
|
+
const errors = findings.filter((f) => (f.category === "deploy" || f.category === "feel-syntax") && f.severity === "error");
|
|
90
|
+
const flagged = new Set(errors.flatMap((f) => f.elementIds));
|
|
91
|
+
// Rules that say the same as an existing finding on another element.
|
|
92
|
+
const said = new Set(errors.map((f) => f.id));
|
|
93
|
+
const covered = (id) => id === "zeebe/executable-process" && said.has("deploy/process-not-executable");
|
|
94
|
+
const camundaVersion = resolved.camundaVersion ?? targetCamundaVersion(defs);
|
|
95
|
+
findings.push(...validateDeployable(defs, camundaVersion === undefined ? {} : { camundaVersion }).filter((f) => !covered(f.id) && !f.elementIds.some((id) => flagged.has(id))));
|
|
96
|
+
}
|
|
83
97
|
const byCategory = Object.fromEntries(ALL_CATEGORIES.map((c) => [c, findings.filter((f) => f.category === c).length]));
|
|
84
98
|
const bySeverity = Object.fromEntries(["info", "warning", "error"].map((s) => [
|
|
85
99
|
s,
|
|
@@ -150,7 +150,8 @@ function buildExtractedDefs(representative, newProcessId) {
|
|
|
150
150
|
};
|
|
151
151
|
const extractedProcess = {
|
|
152
152
|
id: newProcessId,
|
|
153
|
-
|
|
153
|
+
// The call activity that replaces the group calls this process, so it has to deploy.
|
|
154
|
+
isExecutable: true,
|
|
154
155
|
extensionElements: [],
|
|
155
156
|
flowElements: [startEvent, serviceTask, endEvent],
|
|
156
157
|
sequenceFlows: [
|
|
@@ -223,7 +224,14 @@ function buildExtractedDefs(representative, newProcessId) {
|
|
|
223
224
|
return {
|
|
224
225
|
id: generateId("Definitions"),
|
|
225
226
|
targetNamespace: "http://bpmn.io/schema/bpmn",
|
|
226
|
-
|
|
227
|
+
// Without them the serialized file is not well-formed XML (an unbound `bpmn:` prefix).
|
|
228
|
+
namespaces: {
|
|
229
|
+
bpmn: "http://www.omg.org/spec/BPMN/20100524/MODEL",
|
|
230
|
+
bpmndi: "http://www.omg.org/spec/BPMN/20100524/DI",
|
|
231
|
+
dc: "http://www.omg.org/spec/DD/20100524/DC",
|
|
232
|
+
di: "http://www.omg.org/spec/DD/20100524/DI",
|
|
233
|
+
zeebe: "http://camunda.org/schema/zeebe/1.0",
|
|
234
|
+
},
|
|
227
235
|
unknownAttributes: {},
|
|
228
236
|
errors: [],
|
|
229
237
|
escalations: [],
|
|
@@ -262,7 +270,8 @@ export function analyzeTasks(p, opts) {
|
|
|
262
270
|
const proc = findProcess(defs, processId);
|
|
263
271
|
if (!proc)
|
|
264
272
|
return { description: "Process not found" };
|
|
265
|
-
|
|
273
|
+
// Job types often hold ":" (connectors), which a BPMN id (an NCName) cannot.
|
|
274
|
+
const newProcessId = `Reusable_${taskType.replace(/[^\w.-]/g, "_")}_${generateId("proc")}`;
|
|
266
275
|
const generated = buildExtractedDefs(representative, newProcessId);
|
|
267
276
|
// Replace each task in the group with a call activity
|
|
268
277
|
for (const taskId of elementIds) {
|
|
@@ -55,6 +55,24 @@ export interface DeltaNode {
|
|
|
55
55
|
outputs?: Record<string, string>;
|
|
56
56
|
/** The ad-hoc sub-process the node lives in, from `inside=`. */
|
|
57
57
|
inside?: string;
|
|
58
|
+
/** A timer's ISO 8601 duration (`PT5M`), from `after=`. */
|
|
59
|
+
timerDuration?: string;
|
|
60
|
+
/** A timer's date, from `at=`. */
|
|
61
|
+
timerDate?: string;
|
|
62
|
+
/** A timer's cycle (`R/PT1H`), from `every=`. */
|
|
63
|
+
timerCycle?: string;
|
|
64
|
+
/** A call activity's called process id, from `called=`. */
|
|
65
|
+
calledProcess?: string;
|
|
66
|
+
/** The message name, from `msg=`. */
|
|
67
|
+
messageName?: string;
|
|
68
|
+
/** The FEEL correlation key with its leading `=`, from `key=`. */
|
|
69
|
+
correlationKey?: string;
|
|
70
|
+
/** The signal name, from `signal=`. */
|
|
71
|
+
signalName?: string;
|
|
72
|
+
/** The error code, from `error=`. */
|
|
73
|
+
errorCode?: string;
|
|
74
|
+
/** The escalation code, from `escalation=`. */
|
|
75
|
+
escalationCode?: string;
|
|
58
76
|
/** `nonint`: a non-interrupting boundary or start event. */
|
|
59
77
|
interrupting?: false;
|
|
60
78
|
line: number;
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* @packageDocumentation
|
|
17
17
|
*/
|
|
18
18
|
import { CONNECTOR_LINE, parseConnectorLine } from "./connector-line.js";
|
|
19
|
-
import {
|
|
19
|
+
import { DOC_LINE, NOTE_LINE, TRIGGERS, cycle, duration, edgeLabel, kindOf, splitFeel, splitMappings, tokenizePath, } from "./process-text.js";
|
|
20
20
|
/**
|
|
21
21
|
* Kind words the writer uses for element types the line format cannot create.
|
|
22
22
|
* A script may restate them on an existing node; it cannot declare a new one.
|
|
@@ -67,7 +67,7 @@ function readSpec(id, spec, line, problems) {
|
|
|
67
67
|
const space = head.search(/\s/);
|
|
68
68
|
const word = space < 0 ? head : head.slice(0, space);
|
|
69
69
|
const [kindWord = "", trigger] = word.toLowerCase().split(":");
|
|
70
|
-
const type =
|
|
70
|
+
const type = kindOf(kindWord) ?? (Object.hasOwn(FIXED_KINDS, kindWord) ? FIXED_KINDS[kindWord] : undefined);
|
|
71
71
|
if (type === undefined) {
|
|
72
72
|
// `review[Review application]`: no kind, so the whole head is the new name.
|
|
73
73
|
if (head)
|
|
@@ -112,6 +112,24 @@ function readSpec(id, spec, line, problems) {
|
|
|
112
112
|
node.inside = value;
|
|
113
113
|
else if (key === "nonint" && value === undefined)
|
|
114
114
|
node.interrupting = false;
|
|
115
|
+
else if (key === "after" && value && duration(value))
|
|
116
|
+
node.timerDuration = duration(value);
|
|
117
|
+
else if (key === "at" && value)
|
|
118
|
+
node.timerDate = value;
|
|
119
|
+
else if (key === "every" && value && cycle(value))
|
|
120
|
+
node.timerCycle = cycle(value);
|
|
121
|
+
else if (key === "called" && value)
|
|
122
|
+
node.calledProcess = value;
|
|
123
|
+
else if (key === "msg" && value)
|
|
124
|
+
node.messageName = value;
|
|
125
|
+
else if (key === "key" && value)
|
|
126
|
+
node.correlationKey = value.startsWith("=") ? value : `=${value}`;
|
|
127
|
+
else if (key === "signal" && value)
|
|
128
|
+
node.signalName = value;
|
|
129
|
+
else if (key === "error" && value)
|
|
130
|
+
node.errorCode = value;
|
|
131
|
+
else if (key === "escalation" && value)
|
|
132
|
+
node.escalationCode = value;
|
|
115
133
|
else
|
|
116
134
|
problems.push({ line, message: `unknown attribute "${attr}" on "${id}"; ignored` });
|
|
117
135
|
}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
import { assertBpmnDefinitions } from "./argument-guards.js";
|
|
19
19
|
import { compactify } from "./compact.js";
|
|
20
20
|
import { FIXED_KINDS } from "./process-delta.js";
|
|
21
|
-
import { KINDS, splitMappings } from "./process-text.js";
|
|
21
|
+
import { KINDS, cycle, duration, splitMappings } from "./process-text.js";
|
|
22
22
|
const KIND_WORDS = new Map([...Object.entries(KINDS), ...Object.entries(FIXED_KINDS)].map(([word, type]) => [type, word]));
|
|
23
23
|
/** Ids kept as they are: short, lowercase, and readable. */
|
|
24
24
|
const READABLE_ID = /^[a-z][a-z0-9_]{0,23}$/;
|
|
@@ -78,6 +78,10 @@ function aliasFor(element, taken) {
|
|
|
78
78
|
taken.add(alias);
|
|
79
79
|
return alias;
|
|
80
80
|
}
|
|
81
|
+
/** A value written as one attribute token reads back as itself: no space, separator, `=` or bracket. */
|
|
82
|
+
function token(value) {
|
|
83
|
+
return value !== undefined && /^[^\s,|=[\]]+$/.test(value);
|
|
84
|
+
}
|
|
81
85
|
function spec(element, host, container) {
|
|
82
86
|
const word = KIND_WORDS.get(element.type) ?? "task";
|
|
83
87
|
const trigger = element.eventType ? `:${element.eventType}` : "";
|
|
@@ -89,8 +93,30 @@ function spec(element, host, container) {
|
|
|
89
93
|
attrs.push(`inside=${container}`);
|
|
90
94
|
if (element.interrupting === false)
|
|
91
95
|
attrs.push("nonint");
|
|
96
|
+
// Only a duration that reads back as itself: a cycle or a FEEL expression would not
|
|
97
|
+
const after = element.timerDuration;
|
|
98
|
+
if (element.eventType === "timer" && after && duration(after) === after)
|
|
99
|
+
attrs.push(`after=${after}`);
|
|
100
|
+
if (element.eventType === "timer" && token(element.timerDate))
|
|
101
|
+
attrs.push(`at=${element.timerDate}`);
|
|
102
|
+
const every = element.timerCycle;
|
|
103
|
+
if (element.eventType === "timer" && token(every) && every && cycle(every) === every)
|
|
104
|
+
attrs.push(`every=${every}`);
|
|
92
105
|
if (element.jobType)
|
|
93
106
|
attrs.push(`job=${element.jobType}`);
|
|
107
|
+
if (element.calledProcess && token(element.calledProcess))
|
|
108
|
+
attrs.push(`called=${element.calledProcess}`);
|
|
109
|
+
if (token(element.messageName))
|
|
110
|
+
attrs.push(`msg=${element.messageName}`);
|
|
111
|
+
const key = element.correlationKey?.replace(/^\s*=\s*/, "");
|
|
112
|
+
if (token(key))
|
|
113
|
+
attrs.push(`key=${key}`);
|
|
114
|
+
if (token(element.signalName))
|
|
115
|
+
attrs.push(`signal=${element.signalName}`);
|
|
116
|
+
if (token(element.errorCode))
|
|
117
|
+
attrs.push(`error=${element.errorCode}`);
|
|
118
|
+
if (token(element.escalationCode))
|
|
119
|
+
attrs.push(`escalation=${element.escalationCode}`);
|
|
94
120
|
if (element.formId)
|
|
95
121
|
attrs.push(`form=${element.formId}`);
|
|
96
122
|
// Mapping values run to the next ` word=`, so they are written before result= and feel=
|
|
@@ -29,7 +29,7 @@ import { type ConnectorLine } from "./connector-line.js";
|
|
|
29
29
|
* It lives beside the parser so the two cannot drift: a test parses its example
|
|
30
30
|
* and expects no problems.
|
|
31
31
|
*/
|
|
32
|
-
export declare const PROCESS_TEXT_GUIDE = "Format \u2014 one path per line, nothing else:\n# Process name (first line; add \" | camunda=8.10\" to target a Camunda version)\na > b > c sequence flow\nid[kind Name] declare a node the first time it appears; afterwards write only id\ngw >(Label: condition) x conditional branch, condition in FEEL (amount > 1000, status = \"ok\")\ngw >(Label: default) y branch taken when no condition holds\nKinds: start end task user service rule (DMN decision) send receive script manual call xor and or eventgw catch (wait for message or timer) throw boundary adhoc (an AI agent that chooses among tools)\nEvents take a trigger: start:message end:error catch:timer boundary:error (timer message signal error escalation terminate conditional compensate cancel)\nAttributes after |: on=<task id> (required on boundary), nonint (non-interrupting), job=<job type>, each=<list variable> (once per item), after=<ISO duration> (timer), result=<variable>, feel=<FEEL expression> (last)\nAlso after |: form=<form id> (start, user), in.<name>=<FEEL> and out.<name>=<FEEL> map variables in and out of a step (value runs to the next word=; write comparisons with spaces: a = 1)\nAd-hoc: agent[adhoc Name] is a container with flows like any node; tool[service Name | inside=agent] has no flows of its own; note <id>: text annotates a node\ndoc <id>: text the element's documentation; for a tool inside an ad-hoc agent it is the description the agent chooses the tool by\nAd-hoc example:\nask[start Question asked] > agent[adhoc Answer with tools] > review[user Review answer] > done[end Answered]\nusers[service Look up users | inside=agent]\ndoc users: Returns the list of sample users\nnote agent: Picks a tool by its description\nRules:\n- One start event. Every node is on a path from it to an end event: never a node nothing leads to.\n- An xor has two or more branches: exactly one is (Label: default), each other has a FEEL condition.\n- A boundary starts its own line, on a task you declared, and leads to a task that handles it; never draw an arrow into a boundary.\n- A boundary leads only to the handling. What happens next when nothing fails follows the task itself (read > count), never the boundary.\n- A step that only works on process data (count, sum, filter, compare, pick, format a message) is a script task, never a service or plain task: its FEEL reads the variables earlier steps set with result=. read[service Read issues | result=issues] > count[script Count open issues | result=openCount feel=count(issues[state = \"open\"])]\n- Branches that meet again are joined automatically; join parallel branches with an and node.\n- Steps done at the same time start from an and node and meet at another. A deadline is a boundary:timer with after= on the task that may run late. A step done for every item of a list takes each=<list>; use it only when the description says every or each.\n\nExample:\n# Expense approval\nstart[start Expense submitted] > check[xor Amount over 1000?]\ncheck >(Yes: amount > 1000) review[user Review expense] > pay[service Pay expense] > done[end Expense paid]\ncheck >(No: default) auto[service Approve automatically] > pay\nfailed[boundary:error Payment failed | on=pay] > notify[send Notify submitter] > notice[end Payment failed]";
|
|
32
|
+
export declare const PROCESS_TEXT_GUIDE = "Format \u2014 one path per line, nothing else:\n# Process name (first line; add \" | camunda=8.10\" to target a Camunda version)\na > b > c sequence flow\nid[kind Name] declare a node the first time it appears; afterwards write only id\ngw >(Label: condition) x conditional branch, condition in FEEL (amount > 1000, status = \"ok\")\ngw >(Label: default) y branch taken when no condition holds\nKinds: start end task user service rule (DMN decision) send receive script manual call xor and or eventgw catch (wait for message or timer) throw boundary adhoc (an AI agent that chooses among tools)\nEvents take a trigger: start:message end:error catch:timer boundary:error (timer message signal error escalation terminate conditional compensate cancel)\nAttributes after |: on=<task id> (required on boundary), nonint (non-interrupting), job=<job type>, each=<list variable> (once per item), after=<ISO duration> (timer), result=<variable>, feel=<FEEL expression> (last)\nNames after |: msg=<message name> key=<FEEL> (key required where a message is waited for: catch, boundary, receive), signal=<name>, error=<code>, escalation=<code>, at=<ISO date-time> and every=<R/PT1H> (timers), called=<process id> (call)\nAlso after |: form=<form id> (start, user), in.<name>=<FEEL> and out.<name>=<FEEL> map variables in and out of a step (value runs to the next word=; write comparisons with spaces: a = 1)\nAd-hoc: agent[adhoc Name] is a container with flows like any node; tool[service Name | inside=agent] has no flows of its own; note <id>: text annotates a node\ndoc <id>: text the element's documentation; for a tool inside an ad-hoc agent it is the description the agent chooses the tool by\nAd-hoc example:\nask[start Question asked] > agent[adhoc Answer with tools] > review[user Review answer] > done[end Answered]\nusers[service Look up users | inside=agent]\ndoc users: Returns the list of sample users\nnote agent: Picks a tool by its description\nRules:\n- One start event. Every node is on a path from it to an end event: never a node nothing leads to.\n- An xor has two or more branches: exactly one is (Label: default), each other has a FEEL condition.\n- A boundary starts its own line, on a task you declared, and leads to a task that handles it; never draw an arrow into a boundary.\n- A boundary leads only to the handling. What happens next when nothing fails follows the task itself (read > count), never the boundary.\n- A step that only works on process data (count, sum, filter, compare, pick, format a message) is a script task, never a service or plain task: its FEEL reads the variables earlier steps set with result=. read[service Read issues | result=issues] > count[script Count open issues | result=openCount feel=count(issues[state = \"open\"])]\n- Branches that meet again are joined automatically; join parallel branches with an and node.\n- Steps done at the same time start from an and node and meet at another. A deadline is a boundary:timer with after= on the task that may run late. A step done for every item of a list takes each=<list>; use it only when the description says every or each.\n\nExample:\n# Expense approval\nstart[start Expense submitted] > check[xor Amount over 1000?]\ncheck >(Yes: amount > 1000) review[user Review expense] > pay[service Pay expense] > done[end Expense paid]\ncheck >(No: default) auto[service Approve automatically] > pay\nfailed[boundary:error Payment failed | on=pay] > notify[send Notify submitter] > notice[end Payment failed]";
|
|
33
33
|
/** A line, or part of one, that {@link parseProcessText} could not use. */
|
|
34
34
|
export interface ProcessTextProblem {
|
|
35
35
|
/** 1-based line number in the text. */
|
|
@@ -114,6 +114,11 @@ export declare function splitMappings(attrs: string): {
|
|
|
114
114
|
value: string;
|
|
115
115
|
}[];
|
|
116
116
|
};
|
|
117
|
+
/**
|
|
118
|
+
* The type a kind word names, or `undefined`. Own keys only: `KINDS["constructor"]`
|
|
119
|
+
* would find `Object.prototype`'s member and make a node whose type is a function.
|
|
120
|
+
*/
|
|
121
|
+
export declare function kindOf(word: string): BpmnElementType | undefined;
|
|
117
122
|
/** A path line split into its parts. */
|
|
118
123
|
export interface PathTokens {
|
|
119
124
|
/** The nodes in the order written, each with the bracket text it was declared with, if any. */
|
|
@@ -158,9 +163,10 @@ export declare function conditionOrLabel(edge: Pick<CompactFlow, "name" | "condi
|
|
|
158
163
|
problem?: string;
|
|
159
164
|
};
|
|
160
165
|
/**
|
|
161
|
-
*
|
|
162
|
-
*
|
|
166
|
+
* A timer cycle from `every=`: an ISO 8601 repeating interval (`R/PT1H`, `R3/PT10M`)
|
|
167
|
+
* as written, or a duration (`PT1H`, `1h`, `2 days`) repeated forever.
|
|
163
168
|
*/
|
|
169
|
+
export declare function cycle(text: string): string | undefined;
|
|
164
170
|
export declare function duration(text: string): string | undefined;
|
|
165
171
|
export declare function edgeLabel(label: string | undefined): Pick<CompactFlow, "name" | "condition" | "isDefault">;
|
|
166
172
|
/**
|