@bpmnkit/core 1.6.1 → 1.8.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/AGENTS.md +19 -0
- package/README.md +2 -0
- package/agent-cards/bpmn.md +86 -0
- package/agent-cards/dmn.md +105 -0
- package/agent-cards/form.md +72 -0
- package/builder-reference.md +211 -0
- package/dist/bpmn/auto-layout.js +34 -5
- package/dist/bpmn/bpmn-builder.d.ts +127 -5
- package/dist/bpmn/bpmn-builder.js +270 -40
- package/dist/bpmn/bpmn-model.d.ts +2 -0
- package/dist/bpmn/bpmn-parser.js +8 -0
- package/dist/bpmn/bpmn-serializer.js +1 -1
- package/dist/bpmn/builder-coverage.js +4 -12
- package/dist/bpmn/camunda7/export.d.ts +25 -0
- package/dist/bpmn/camunda7/export.js +218 -0
- package/dist/bpmn/camunda7/migrate.d.ts +4 -1
- package/dist/bpmn/camunda7/migrate.js +4 -4
- package/dist/bpmn/compact.d.ts +21 -0
- package/dist/bpmn/compact.js +86 -1
- package/dist/bpmn/full-operations.js +338 -3
- package/dist/bpmn/index.d.ts +2 -0
- package/dist/bpmn/index.js +2 -0
- package/dist/bpmn/operations.d.ts +42 -1
- package/dist/bpmn/operations.js +12 -2
- package/dist/bpmn/optimize/deploy.js +14 -0
- package/dist/bpmn/optimize/index.d.ts +2 -0
- package/dist/bpmn/optimize/index.js +5 -0
- package/dist/bpmn/optimize/types.d.ts +7 -0
- package/dist/bpmn/stable-ids.d.ts +15 -0
- package/dist/bpmn/stable-ids.js +26 -0
- package/dist/bpmn/strip-camunda8.d.ts +22 -0
- package/dist/bpmn/strip-camunda8.js +55 -0
- package/dist/bpmn/svg.js +5 -6
- package/dist/bpmn/utils.js +151 -1
- package/dist/bpmn/zeebe-extensions.d.ts +59 -2
- package/dist/bpmn/zeebe-extensions.js +89 -1
- package/dist/check-finding.d.ts +19 -0
- package/dist/check-finding.js +5 -0
- package/dist/connectors/apply-element.d.ts +7 -3
- package/dist/connectors/apply-element.js +115 -4
- package/dist/connectors/apply-many.d.ts +5 -1
- package/dist/connectors/apply-many.js +5 -2
- package/dist/connectors/apply.d.ts +24 -3
- package/dist/connectors/apply.js +103 -3
- package/dist/connectors/catalog.js +5 -0
- package/dist/connectors/index.d.ts +1 -1
- package/dist/connectors/template-types.d.ts +30 -0
- package/dist/connectors/validate.js +33 -0
- package/dist/dmn/compact.js +14 -5
- package/dist/dmn/dmn-builder.js +3 -3
- package/dist/dmn/drd-builder.d.ts +53 -0
- package/dist/dmn/drd-builder.js +100 -0
- package/dist/dmn/index.d.ts +35 -0
- package/dist/dmn/index.js +36 -0
- package/dist/dmn/lint.d.ts +19 -0
- package/dist/dmn/lint.js +414 -0
- package/dist/form/form-builder.d.ts +9 -1
- package/dist/form/form-builder.js +34 -1
- package/dist/form/form-model.d.ts +7 -0
- package/dist/form/form-parser.js +22 -0
- package/dist/form/form-serializer.js +10 -0
- package/dist/form/index.d.ts +11 -2
- package/dist/form/index.js +10 -1
- package/dist/form/lint.d.ts +19 -0
- package/dist/form/lint.js +356 -0
- package/dist/index.d.ts +19 -5
- package/dist/index.js +12 -2
- package/dist/layout/annotations.d.ts +3 -1
- package/dist/layout/annotations.js +72 -14
- package/dist/layout/grid/edge-labels.d.ts +7 -1
- package/dist/layout/grid/edge-labels.js +62 -1
- package/dist/layout/semantic/index.js +78 -8
- package/dist/layout/semantic/place.d.ts +19 -4
- package/dist/layout/semantic/place.js +245 -29
- package/dist/layout/semantic/route.js +60 -12
- package/dist/layout/types.d.ts +2 -1
- package/llms.txt +9 -0
- package/package.json +6 -1
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const PREFIXES = ["zeebe", "modeler"];
|
|
2
|
+
const isVendor = (qname) => PREFIXES.some((p) => qname.startsWith(`${p}:`));
|
|
3
|
+
/**
|
|
4
|
+
* Returns a copy of `definitions` without Camunda 8 vendor content (`zeebe:*`
|
|
5
|
+
* extension elements and attributes, `modeler:*` attributes) so the export is
|
|
6
|
+
* plain BPMN, e.g. as a base for Camunda 7/Operaton. Opt-in and non-mutating;
|
|
7
|
+
* `camunda:*` and other vendors are left alone. Their `xmlns` declarations go
|
|
8
|
+
* too, unless some remaining content still uses the prefix.
|
|
9
|
+
*/
|
|
10
|
+
export function stripCamunda8(definitions) {
|
|
11
|
+
const copy = structuredClone(definitions);
|
|
12
|
+
const dropped = [];
|
|
13
|
+
const walk = (node, ownerId) => {
|
|
14
|
+
if (Array.isArray(node)) {
|
|
15
|
+
for (const item of node)
|
|
16
|
+
walk(item, ownerId);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (node === null || typeof node !== "object")
|
|
20
|
+
return;
|
|
21
|
+
const obj = node;
|
|
22
|
+
const id = typeof obj.id === "string" ? obj.id : ownerId;
|
|
23
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
24
|
+
if (key === "extensionElements" && Array.isArray(value)) {
|
|
25
|
+
obj[key] = value.filter((x) => {
|
|
26
|
+
if (typeof x.name !== "string" || !isVendor(x.name))
|
|
27
|
+
return true;
|
|
28
|
+
dropped.push({ elementId: id, kind: "extensionElement", name: x.name });
|
|
29
|
+
return false;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
else if (key === "unknownAttributes" && value && typeof value === "object") {
|
|
33
|
+
for (const a of Object.keys(value)) {
|
|
34
|
+
if (!isVendor(a))
|
|
35
|
+
continue;
|
|
36
|
+
delete value[a];
|
|
37
|
+
dropped.push({ elementId: id, kind: "attribute", name: a });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
for (const value of Object.values(obj))
|
|
42
|
+
walk(value, id);
|
|
43
|
+
};
|
|
44
|
+
walk(copy, "definitions");
|
|
45
|
+
// Namespaces last: only drop a declaration nothing left refers to.
|
|
46
|
+
const remaining = JSON.stringify({ ...copy, namespaces: undefined });
|
|
47
|
+
for (const prefix of PREFIXES) {
|
|
48
|
+
if (!(prefix in copy.namespaces) || remaining.includes(`"${prefix}:`))
|
|
49
|
+
continue;
|
|
50
|
+
delete copy.namespaces[prefix];
|
|
51
|
+
dropped.push({ elementId: "definitions", kind: "namespace", name: `xmlns:${prefix}` });
|
|
52
|
+
}
|
|
53
|
+
return { definitions: copy, dropped };
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=strip-camunda8.js.map
|
package/dist/bpmn/svg.js
CHANGED
|
@@ -121,7 +121,7 @@ export function exportSvg(defs, options) {
|
|
|
121
121
|
// Edge label
|
|
122
122
|
if (flow?.name && edge.label?.bounds) {
|
|
123
123
|
const { x, y, width, height } = edge.label.bounds;
|
|
124
|
-
edgeParts.push(labelSvg(flow.name, x + width / 2, y + height / 2, width
|
|
124
|
+
edgeParts.push(labelSvg(flow.name, x + width / 2, y + height / 2, width, t, false, fontOf(edge.label)));
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
// ── Shapes ────────────────────────────────────────────────────────────────
|
|
@@ -193,7 +193,7 @@ export function exportSvg(defs, options) {
|
|
|
193
193
|
width: 80,
|
|
194
194
|
height: 20,
|
|
195
195
|
};
|
|
196
|
-
labelParts.push(labelSvg(el.name, lb.x + lb.width / 2, lb.y + lb.height / 2, lb.width
|
|
196
|
+
labelParts.push(labelSvg(el.name, lb.x + lb.width / 2, lb.y + lb.height / 2, lb.width, t, true, font));
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
// ── Assemble SVG ──────────────────────────────────────────────────────────
|
|
@@ -511,10 +511,9 @@ function renderTask(el, width, height, t, options) {
|
|
|
511
511
|
out += labelSvg(el.name, width / 2, height / 2, width - 16, t, false, options?.font);
|
|
512
512
|
}
|
|
513
513
|
}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
type === "transaction") {
|
|
514
|
+
// The "+" marker means "contents elsewhere"; an expanded body shows them.
|
|
515
|
+
const container = type === "subProcess" || type === "eventSubProcess" || type === "transaction";
|
|
516
|
+
if ((container && !options?.expanded) || type === "adHocSubProcess") {
|
|
518
517
|
out += iconGroup(subProcessMarker(type), width / 2, height - 10, t);
|
|
519
518
|
}
|
|
520
519
|
return out;
|
package/dist/bpmn/utils.js
CHANGED
|
@@ -131,6 +131,24 @@ function findChildren(elements, tag) {
|
|
|
131
131
|
function findChild(elements, tag) {
|
|
132
132
|
return elements.find((c) => localName(c.name) === tag);
|
|
133
133
|
}
|
|
134
|
+
function readListeners(container, tag) {
|
|
135
|
+
return findChildren(container.children, tag).map((c) => {
|
|
136
|
+
const listener = {
|
|
137
|
+
eventType: c.attributes.eventType ?? "",
|
|
138
|
+
type: c.attributes.type ?? "",
|
|
139
|
+
};
|
|
140
|
+
if (c.attributes.retries !== undefined)
|
|
141
|
+
listener.retries = c.attributes.retries;
|
|
142
|
+
const headers = findChild(c.children, "taskHeaders");
|
|
143
|
+
if (headers) {
|
|
144
|
+
listener.headers = findChildren(headers.children, "header").map((h) => ({
|
|
145
|
+
key: h.attributes.key ?? "",
|
|
146
|
+
value: h.attributes.value ?? "",
|
|
147
|
+
}));
|
|
148
|
+
}
|
|
149
|
+
return listener;
|
|
150
|
+
});
|
|
151
|
+
}
|
|
134
152
|
/**
|
|
135
153
|
* Extracts Zeebe extension data from the raw `extensionElements` array of a
|
|
136
154
|
* flow element. This is the inverse of {@link zeebeExtensionsToXmlElements}.
|
|
@@ -191,13 +209,51 @@ export function getZeebeExtensions(extensionElements) {
|
|
|
191
209
|
}
|
|
192
210
|
const formDefEl = findChild(extensionElements, "formDefinition");
|
|
193
211
|
if (formDefEl) {
|
|
194
|
-
const
|
|
212
|
+
const { formId, formKey, externalReference, bindingType, versionTag } = formDefEl.attributes;
|
|
213
|
+
let formDefinition;
|
|
214
|
+
if (formKey !== undefined && formId === undefined)
|
|
215
|
+
formDefinition = { formKey };
|
|
216
|
+
else if (externalReference !== undefined && formId === undefined) {
|
|
217
|
+
formDefinition = { externalReference };
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
formDefinition = { formId: formId ?? "" };
|
|
221
|
+
if (bindingType === "latest" ||
|
|
222
|
+
bindingType === "deployment" ||
|
|
223
|
+
bindingType === "versionTag") {
|
|
224
|
+
formDefinition.bindingType = bindingType;
|
|
225
|
+
}
|
|
226
|
+
if (versionTag !== undefined)
|
|
227
|
+
formDefinition.versionTag = versionTag;
|
|
228
|
+
}
|
|
195
229
|
ext.formDefinition = formDefinition;
|
|
196
230
|
}
|
|
197
231
|
const agentDefEl = findChild(extensionElements, "agentDefinition");
|
|
198
232
|
if (agentDefEl) {
|
|
199
233
|
ext.agentDefinition = { agentType: agentDefEl.attributes.agentType ?? "" };
|
|
200
234
|
}
|
|
235
|
+
const linkedEl = findChild(extensionElements, "linkedResources");
|
|
236
|
+
if (linkedEl) {
|
|
237
|
+
const linked = linkedEl.children
|
|
238
|
+
.filter((c) => localName(c.name) === "linkedResource")
|
|
239
|
+
.map((c) => {
|
|
240
|
+
const { resourceType, resourceId, linkName, bindingType, versionTag } = c.attributes;
|
|
241
|
+
const r = {
|
|
242
|
+
resourceType: resourceType ?? "",
|
|
243
|
+
resourceId: resourceId ?? "",
|
|
244
|
+
linkName: linkName ?? "",
|
|
245
|
+
};
|
|
246
|
+
if (bindingType === "latest" ||
|
|
247
|
+
bindingType === "deployment" ||
|
|
248
|
+
bindingType === "versionTag")
|
|
249
|
+
r.bindingType = bindingType;
|
|
250
|
+
if (versionTag !== undefined)
|
|
251
|
+
r.versionTag = versionTag;
|
|
252
|
+
return r;
|
|
253
|
+
});
|
|
254
|
+
if (linked.length > 0)
|
|
255
|
+
ext.linkedResources = linked;
|
|
256
|
+
}
|
|
201
257
|
const calledDecEl = findChild(extensionElements, "calledDecision");
|
|
202
258
|
if (calledDecEl) {
|
|
203
259
|
const calledDecision = {
|
|
@@ -206,6 +262,100 @@ export function getZeebeExtensions(extensionElements) {
|
|
|
206
262
|
};
|
|
207
263
|
ext.calledDecision = calledDecision;
|
|
208
264
|
}
|
|
265
|
+
const calledElEl = findChild(extensionElements, "calledElement");
|
|
266
|
+
if (calledElEl) {
|
|
267
|
+
const a = calledElEl.attributes;
|
|
268
|
+
const calledElement = { processId: a.processId ?? "" };
|
|
269
|
+
if (a.propagateAllChildVariables !== undefined) {
|
|
270
|
+
calledElement.propagateAllChildVariables = a.propagateAllChildVariables === "true";
|
|
271
|
+
}
|
|
272
|
+
if (a.propagateAllParentVariables !== undefined) {
|
|
273
|
+
calledElement.propagateAllParentVariables = a.propagateAllParentVariables === "true";
|
|
274
|
+
}
|
|
275
|
+
if (a.bindingType === "latest" ||
|
|
276
|
+
a.bindingType === "deployment" ||
|
|
277
|
+
a.bindingType === "versionTag") {
|
|
278
|
+
calledElement.bindingType = a.bindingType;
|
|
279
|
+
}
|
|
280
|
+
if (a.versionTag !== undefined)
|
|
281
|
+
calledElement.versionTag = a.versionTag;
|
|
282
|
+
ext.calledElement = calledElement;
|
|
283
|
+
}
|
|
284
|
+
const adHocEl = findChild(extensionElements, "adHoc");
|
|
285
|
+
if (adHocEl) {
|
|
286
|
+
const { outputCollection, outputElement, activeElementsCollection } = adHocEl.attributes;
|
|
287
|
+
const adHoc = {};
|
|
288
|
+
if (outputCollection !== undefined)
|
|
289
|
+
adHoc.outputCollection = outputCollection;
|
|
290
|
+
if (outputElement !== undefined)
|
|
291
|
+
adHoc.outputElement = outputElement;
|
|
292
|
+
if (activeElementsCollection !== undefined) {
|
|
293
|
+
adHoc.activeElementsCollection = activeElementsCollection;
|
|
294
|
+
}
|
|
295
|
+
ext.adHoc = adHoc;
|
|
296
|
+
}
|
|
297
|
+
if (findChild(extensionElements, "userTask"))
|
|
298
|
+
ext.userTask = true;
|
|
299
|
+
const assignEl = findChild(extensionElements, "assignmentDefinition");
|
|
300
|
+
if (assignEl) {
|
|
301
|
+
const { assignee, candidateGroups, candidateUsers } = assignEl.attributes;
|
|
302
|
+
const assignmentDefinition = {};
|
|
303
|
+
if (assignee !== undefined)
|
|
304
|
+
assignmentDefinition.assignee = assignee;
|
|
305
|
+
if (candidateGroups !== undefined)
|
|
306
|
+
assignmentDefinition.candidateGroups = candidateGroups;
|
|
307
|
+
if (candidateUsers !== undefined)
|
|
308
|
+
assignmentDefinition.candidateUsers = candidateUsers;
|
|
309
|
+
ext.assignmentDefinition = assignmentDefinition;
|
|
310
|
+
}
|
|
311
|
+
const scheduleEl = findChild(extensionElements, "taskSchedule");
|
|
312
|
+
if (scheduleEl) {
|
|
313
|
+
const { dueDate, followUpDate } = scheduleEl.attributes;
|
|
314
|
+
const taskSchedule = {};
|
|
315
|
+
if (dueDate !== undefined)
|
|
316
|
+
taskSchedule.dueDate = dueDate;
|
|
317
|
+
if (followUpDate !== undefined)
|
|
318
|
+
taskSchedule.followUpDate = followUpDate;
|
|
319
|
+
ext.taskSchedule = taskSchedule;
|
|
320
|
+
}
|
|
321
|
+
const priorityEl = findChild(extensionElements, "priorityDefinition");
|
|
322
|
+
if (priorityEl) {
|
|
323
|
+
ext.priorityDefinition = { priority: priorityEl.attributes.priority ?? "" };
|
|
324
|
+
}
|
|
325
|
+
const subscriptionEl = findChild(extensionElements, "subscription");
|
|
326
|
+
if (subscriptionEl) {
|
|
327
|
+
ext.subscription = { correlationKey: subscriptionEl.attributes.correlationKey ?? "" };
|
|
328
|
+
}
|
|
329
|
+
const execListenersEl = findChild(extensionElements, "executionListeners");
|
|
330
|
+
if (execListenersEl) {
|
|
331
|
+
ext.executionListeners = readListeners(execListenersEl, "executionListener");
|
|
332
|
+
}
|
|
333
|
+
const taskListenersEl = findChild(extensionElements, "taskListeners");
|
|
334
|
+
if (taskListenersEl)
|
|
335
|
+
ext.taskListeners = readListeners(taskListenersEl, "taskListener");
|
|
336
|
+
// Anything we have no typed field for must survive a read-modify-write.
|
|
337
|
+
const unknownElements = extensionElements.filter((c) => !KNOWN_ZEEBE_ELEMENTS.has(localName(c.name)));
|
|
338
|
+
if (unknownElements.length > 0)
|
|
339
|
+
ext.unknownElements = unknownElements;
|
|
209
340
|
return ext;
|
|
210
341
|
}
|
|
342
|
+
const KNOWN_ZEEBE_ELEMENTS = new Set([
|
|
343
|
+
"taskDefinition",
|
|
344
|
+
"ioMapping",
|
|
345
|
+
"taskHeaders",
|
|
346
|
+
"properties",
|
|
347
|
+
"adHoc",
|
|
348
|
+
"agentDefinition",
|
|
349
|
+
"linkedResources",
|
|
350
|
+
"formDefinition",
|
|
351
|
+
"calledDecision",
|
|
352
|
+
"calledElement",
|
|
353
|
+
"userTask",
|
|
354
|
+
"assignmentDefinition",
|
|
355
|
+
"taskSchedule",
|
|
356
|
+
"priorityDefinition",
|
|
357
|
+
"subscription",
|
|
358
|
+
"executionListeners",
|
|
359
|
+
"taskListeners",
|
|
360
|
+
]);
|
|
211
361
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { XmlElement } from "../types/xml-element.js";
|
|
2
|
+
import type { BpmnConditionalEventDefinition } from "./bpmn-model.js";
|
|
2
3
|
/** Zeebe task definition extension. */
|
|
3
4
|
export interface ZeebeTaskDefinition {
|
|
4
5
|
type: string;
|
|
@@ -49,11 +50,29 @@ export interface ZeebeAdHoc {
|
|
|
49
50
|
export interface ZeebeAgentDefinition {
|
|
50
51
|
agentType: string;
|
|
51
52
|
}
|
|
53
|
+
/** One `zeebe:linkedResource` (e.g. the RPA script a service task runs). */
|
|
54
|
+
export interface ZeebeLinkedResource {
|
|
55
|
+
resourceType: string;
|
|
56
|
+
resourceId: string;
|
|
57
|
+
linkName: string;
|
|
58
|
+
bindingType?: "latest" | "deployment" | "versionTag";
|
|
59
|
+
versionTag?: string;
|
|
60
|
+
}
|
|
52
61
|
/** Zeebe form definition extension for user tasks. */
|
|
53
|
-
export
|
|
62
|
+
export type ZeebeFormDefinition = {
|
|
54
63
|
/** ID of the Camunda Form linked to this user task. */
|
|
55
64
|
formId: string;
|
|
56
|
-
|
|
65
|
+
/** What `formId` resolves against (`bindingType`, Camunda 8.6+ unless `latest`). */
|
|
66
|
+
bindingType?: "latest" | "deployment" | "versionTag";
|
|
67
|
+
/** Version tag of the form; only meaningful with `bindingType: "versionTag"`. */
|
|
68
|
+
versionTag?: string;
|
|
69
|
+
} | {
|
|
70
|
+
/** Embedded form (`camunda-forms:bpmn:<id>`) or a legacy form key. */
|
|
71
|
+
formKey: string;
|
|
72
|
+
} | {
|
|
73
|
+
/** External form URL, for a Camunda user task (`zeebe:userTask`). */
|
|
74
|
+
externalReference: string;
|
|
75
|
+
};
|
|
57
76
|
/** Zeebe called decision extension for business rule tasks. */
|
|
58
77
|
export interface ZeebeCalledDecision {
|
|
59
78
|
/** ID of the DMN decision to invoke. */
|
|
@@ -80,6 +99,31 @@ export interface ZeebePriorityDefinition {
|
|
|
80
99
|
export interface ZeebeSubscription {
|
|
81
100
|
correlationKey: string;
|
|
82
101
|
}
|
|
102
|
+
/** Zeebe called element extension for call activities (zeebe:calledElement). */
|
|
103
|
+
export interface ZeebeCalledElement {
|
|
104
|
+
/** ID of the process to call. */
|
|
105
|
+
processId: string;
|
|
106
|
+
/** Held as booleans; the XML attributes are the strings "true"/"false". */
|
|
107
|
+
propagateAllChildVariables?: boolean;
|
|
108
|
+
propagateAllParentVariables?: boolean;
|
|
109
|
+
bindingType?: "latest" | "deployment" | "versionTag";
|
|
110
|
+
/** Only meaningful with `bindingType: "versionTag"`. */
|
|
111
|
+
versionTag?: string;
|
|
112
|
+
}
|
|
113
|
+
/** A job-worker listener (`zeebe:executionListener` / `zeebe:taskListener`). */
|
|
114
|
+
export interface ZeebeListener {
|
|
115
|
+
/** Lifecycle event, such as `start`, `end` (execution) or `completing` (task). */
|
|
116
|
+
eventType: string;
|
|
117
|
+
/** Job type the listener's worker subscribes to. */
|
|
118
|
+
type: string;
|
|
119
|
+
retries?: string;
|
|
120
|
+
/**
|
|
121
|
+
* Listener headers (`zeebe:taskHeaders`). Read and written back so a
|
|
122
|
+
* read-modify-write of a diagram that has them does not drop them; the
|
|
123
|
+
* builder does not offer them.
|
|
124
|
+
*/
|
|
125
|
+
headers?: ZeebeTaskHeaderEntry[];
|
|
126
|
+
}
|
|
83
127
|
/** Collected Zeebe extensions on a service task. */
|
|
84
128
|
export interface ZeebeExtensions {
|
|
85
129
|
taskDefinition?: ZeebeTaskDefinition;
|
|
@@ -89,10 +133,14 @@ export interface ZeebeExtensions {
|
|
|
89
133
|
adHoc?: ZeebeAdHoc;
|
|
90
134
|
/** AI agent marker (zeebe:agentDefinition). */
|
|
91
135
|
agentDefinition?: ZeebeAgentDefinition;
|
|
136
|
+
/** Resources linked to a service task (zeebe:linkedResources). */
|
|
137
|
+
linkedResources?: ZeebeLinkedResource[];
|
|
92
138
|
/** Camunda Form linked to a user task (zeebe:formDefinition). */
|
|
93
139
|
formDefinition?: ZeebeFormDefinition;
|
|
94
140
|
/** DMN decision invoked by a business rule task (zeebe:calledDecision). */
|
|
95
141
|
calledDecision?: ZeebeCalledDecision;
|
|
142
|
+
/** Process invoked by a call activity (zeebe:calledElement). */
|
|
143
|
+
calledElement?: ZeebeCalledElement;
|
|
96
144
|
/** Marks this as a Camunda 8 native user task (zeebe:userTask). */
|
|
97
145
|
userTask?: true;
|
|
98
146
|
/** User task assignee/candidates (zeebe:assignmentDefinition). */
|
|
@@ -103,6 +151,10 @@ export interface ZeebeExtensions {
|
|
|
103
151
|
priorityDefinition?: ZeebePriorityDefinition;
|
|
104
152
|
/** Message correlation key for a message catch/boundary/receive element (zeebe:subscription). */
|
|
105
153
|
subscription?: ZeebeSubscription;
|
|
154
|
+
/** Execution listeners (zeebe:executionListeners). */
|
|
155
|
+
executionListeners?: ZeebeListener[];
|
|
156
|
+
/** User task listeners (zeebe:taskListeners). */
|
|
157
|
+
taskListeners?: ZeebeListener[];
|
|
106
158
|
/** Unrecognized extension elements preserved for roundtrip. */
|
|
107
159
|
unknownElements?: XmlElement[];
|
|
108
160
|
}
|
|
@@ -164,4 +216,9 @@ export declare function ensureZeebeExtension(owner: {
|
|
|
164
216
|
type: string;
|
|
165
217
|
extensionElements: XmlElement[];
|
|
166
218
|
}, extension: string): XmlElement;
|
|
219
|
+
/**
|
|
220
|
+
* A conditional event definition with a FEEL `condition` and, when `variableEvents`
|
|
221
|
+
* is given, a `zeebe:conditionalFilter` limiting which variable changes re-evaluate it.
|
|
222
|
+
*/
|
|
223
|
+
export declare function makeConditionalDefinition(condition: string, variableEvents?: readonly ("create" | "update")[]): BpmnConditionalEventDefinition;
|
|
167
224
|
//# sourceMappingURL=zeebe-extensions.d.ts.map
|
|
@@ -1,4 +1,31 @@
|
|
|
1
1
|
import { ZEEBE_PLACEMENT } from "./zeebe-placement.js";
|
|
2
|
+
function listenersToXml(container, child, listeners) {
|
|
3
|
+
return {
|
|
4
|
+
name: `zeebe:${container}`,
|
|
5
|
+
attributes: {},
|
|
6
|
+
children: listeners.map((l) => ({
|
|
7
|
+
name: `zeebe:${child}`,
|
|
8
|
+
attributes: {
|
|
9
|
+
eventType: l.eventType,
|
|
10
|
+
type: l.type,
|
|
11
|
+
...(l.retries !== undefined ? { retries: l.retries } : {}),
|
|
12
|
+
},
|
|
13
|
+
children: l.headers?.length
|
|
14
|
+
? [
|
|
15
|
+
{
|
|
16
|
+
name: "zeebe:taskHeaders",
|
|
17
|
+
attributes: {},
|
|
18
|
+
children: l.headers.map((h) => ({
|
|
19
|
+
name: "zeebe:header",
|
|
20
|
+
attributes: { key: h.key, value: h.value },
|
|
21
|
+
children: [],
|
|
22
|
+
})),
|
|
23
|
+
},
|
|
24
|
+
]
|
|
25
|
+
: [],
|
|
26
|
+
})),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
2
29
|
/** Convert Zeebe extensions to XmlElement array for the BPMN model. */
|
|
3
30
|
export function zeebeExtensionsToXmlElements(extensions) {
|
|
4
31
|
const elements = [];
|
|
@@ -79,13 +106,30 @@ export function zeebeExtensionsToXmlElements(extensions) {
|
|
|
79
106
|
children: [],
|
|
80
107
|
});
|
|
81
108
|
}
|
|
109
|
+
if (extensions.linkedResources?.length) {
|
|
110
|
+
elements.push({
|
|
111
|
+
name: "zeebe:linkedResources",
|
|
112
|
+
attributes: {},
|
|
113
|
+
children: extensions.linkedResources.map((r) => ({
|
|
114
|
+
name: "zeebe:linkedResource",
|
|
115
|
+
attributes: {
|
|
116
|
+
resourceType: r.resourceType,
|
|
117
|
+
resourceId: r.resourceId,
|
|
118
|
+
linkName: r.linkName,
|
|
119
|
+
...(r.bindingType !== undefined ? { bindingType: r.bindingType } : {}),
|
|
120
|
+
...(r.versionTag !== undefined ? { versionTag: r.versionTag } : {}),
|
|
121
|
+
},
|
|
122
|
+
children: [],
|
|
123
|
+
})),
|
|
124
|
+
});
|
|
125
|
+
}
|
|
82
126
|
if (extensions.userTask) {
|
|
83
127
|
elements.push({ name: "zeebe:userTask", attributes: {}, children: [] });
|
|
84
128
|
}
|
|
85
129
|
if (extensions.formDefinition) {
|
|
86
130
|
elements.push({
|
|
87
131
|
name: "zeebe:formDefinition",
|
|
88
|
-
attributes: {
|
|
132
|
+
attributes: { ...extensions.formDefinition },
|
|
89
133
|
children: [],
|
|
90
134
|
});
|
|
91
135
|
}
|
|
@@ -99,6 +143,22 @@ export function zeebeExtensionsToXmlElements(extensions) {
|
|
|
99
143
|
children: [],
|
|
100
144
|
});
|
|
101
145
|
}
|
|
146
|
+
if (extensions.calledElement) {
|
|
147
|
+
const { processId, propagateAllChildVariables, propagateAllParentVariables } = extensions.calledElement;
|
|
148
|
+
const { bindingType, versionTag } = extensions.calledElement;
|
|
149
|
+
const attrs = { processId };
|
|
150
|
+
if (propagateAllChildVariables !== undefined) {
|
|
151
|
+
attrs.propagateAllChildVariables = String(propagateAllChildVariables);
|
|
152
|
+
}
|
|
153
|
+
if (propagateAllParentVariables !== undefined) {
|
|
154
|
+
attrs.propagateAllParentVariables = String(propagateAllParentVariables);
|
|
155
|
+
}
|
|
156
|
+
if (bindingType !== undefined)
|
|
157
|
+
attrs.bindingType = bindingType;
|
|
158
|
+
if (versionTag !== undefined)
|
|
159
|
+
attrs.versionTag = versionTag;
|
|
160
|
+
elements.push({ name: "zeebe:calledElement", attributes: attrs, children: [] });
|
|
161
|
+
}
|
|
102
162
|
if (extensions.assignmentDefinition) {
|
|
103
163
|
const attrs = {};
|
|
104
164
|
const { assignee, candidateGroups, candidateUsers } = extensions.assignmentDefinition;
|
|
@@ -137,6 +197,12 @@ export function zeebeExtensionsToXmlElements(extensions) {
|
|
|
137
197
|
children: [],
|
|
138
198
|
});
|
|
139
199
|
}
|
|
200
|
+
if (extensions.executionListeners?.length) {
|
|
201
|
+
elements.push(listenersToXml("executionListeners", "executionListener", extensions.executionListeners));
|
|
202
|
+
}
|
|
203
|
+
if (extensions.taskListeners?.length) {
|
|
204
|
+
elements.push(listenersToXml("taskListeners", "taskListener", extensions.taskListeners));
|
|
205
|
+
}
|
|
140
206
|
if (extensions.unknownElements) {
|
|
141
207
|
elements.push(...extensions.unknownElements);
|
|
142
208
|
}
|
|
@@ -220,4 +286,26 @@ export function ensureZeebeExtension(owner, extension) {
|
|
|
220
286
|
owner.extensionElements.push(created);
|
|
221
287
|
return created;
|
|
222
288
|
}
|
|
289
|
+
/**
|
|
290
|
+
* A conditional event definition with a FEEL `condition` and, when `variableEvents`
|
|
291
|
+
* is given, a `zeebe:conditionalFilter` limiting which variable changes re-evaluate it.
|
|
292
|
+
*/
|
|
293
|
+
export function makeConditionalDefinition(condition, variableEvents) {
|
|
294
|
+
return {
|
|
295
|
+
type: "conditional",
|
|
296
|
+
condition,
|
|
297
|
+
conditionAttributes: { "xsi:type": "bpmn:tFormalExpression" },
|
|
298
|
+
...(variableEvents && variableEvents.length > 0
|
|
299
|
+
? {
|
|
300
|
+
extensionElements: [
|
|
301
|
+
{
|
|
302
|
+
name: "zeebe:conditionalFilter",
|
|
303
|
+
attributes: { variableEvents: variableEvents.join(",") },
|
|
304
|
+
children: [],
|
|
305
|
+
},
|
|
306
|
+
],
|
|
307
|
+
}
|
|
308
|
+
: {}),
|
|
309
|
+
};
|
|
310
|
+
}
|
|
223
311
|
//# sourceMappingURL=zeebe-extensions.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Appends the pointer to a card's trap list, so a fix loop learns where the rule is explained. */
|
|
2
|
+
export declare function withCardHint(findings: CheckFinding[], card: "bpmn" | "dmn" | "form"): CheckFinding[];
|
|
3
|
+
/** How bad a {@link CheckFinding} is. `error` means the resource will not deploy or run as written. */
|
|
4
|
+
export type CheckSeverity = "error" | "warning" | "info";
|
|
5
|
+
/**
|
|
6
|
+
* One problem in a DMN or form resource, shaped for an agent's fix loop:
|
|
7
|
+
* which rule fired, where, what is wrong and what to change.
|
|
8
|
+
*/
|
|
9
|
+
export interface CheckFinding {
|
|
10
|
+
/** Stable rule id, e.g. `dmn/unresolved-requirement` or `form/duplicate-key`. */
|
|
11
|
+
rule: string;
|
|
12
|
+
severity: CheckSeverity;
|
|
13
|
+
/** The element (DMN) or component (form) the finding is about, when there is one. */
|
|
14
|
+
elementId?: string;
|
|
15
|
+
message: string;
|
|
16
|
+
/** A concrete change that resolves the finding. */
|
|
17
|
+
fix: string;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=check-finding.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Appends the pointer to a card's trap list, so a fix loop learns where the rule is explained. */
|
|
2
|
+
export function withCardHint(findings, card) {
|
|
3
|
+
return findings.map((f) => ({ ...f, fix: `${f.fix} (agent-cards/${card}.md#traps)` }));
|
|
4
|
+
}
|
|
5
|
+
//# sourceMappingURL=check-finding.js.map
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* option reaches. This writes all of it onto an element that already exists.
|
|
9
9
|
*/
|
|
10
10
|
import type { BpmnDefinitions, BpmnFlowElement } from "../index.js";
|
|
11
|
-
import { type ApplyProblem } from "./apply.js";
|
|
11
|
+
import { type ApplyOptions, type ApplyProblem } from "./apply.js";
|
|
12
12
|
import type { ElementTemplate } from "./template-types.js";
|
|
13
13
|
/** The one `elementType.eventDefinition` this toolkit writes. */
|
|
14
14
|
export declare const APPLIED_EVENT_DEFINITION = "bpmn:MessageEventDefinition";
|
|
@@ -43,7 +43,9 @@ export declare function messageRefOf(element: BpmnFlowElement): string | undefin
|
|
|
43
43
|
* references, and is otherwise derived from the template and element ids,
|
|
44
44
|
* never from a clock or random source.
|
|
45
45
|
* - **Extensions.** `zeebe:taskDefinition`, `ioMapping`, `taskHeaders`,
|
|
46
|
-
* `properties`, `adHoc
|
|
46
|
+
* `properties`, `adHoc`, `linkedResources` and the task-level ones (`calledElement`,
|
|
47
|
+
* `calledDecision`, `userTask`, `formDefinition`, `assignmentDefinition`, `taskSchedule`,
|
|
48
|
+
* `priorityDefinition`, `script`) are replaced wholesale when the
|
|
47
49
|
* template declares a binding of that kind, in place, and left alone when it
|
|
48
50
|
* does not. `zeebe:modelerTemplate`, `…Version` and `…Icon` are stamped.
|
|
49
51
|
*
|
|
@@ -54,6 +56,8 @@ export declare function messageRefOf(element: BpmnFlowElement): string | undefin
|
|
|
54
56
|
* @param elementId - A flow element anywhere in its processes, sub-processes included.
|
|
55
57
|
* @param template - Any element template, bundled or a workspace's own.
|
|
56
58
|
* @param values - Keyed as in {@link applyElementTemplate}; `name` sets the element's name.
|
|
59
|
+
* @param options - `omitDefaults` leaves out properties carrying only the template's default;
|
|
60
|
+
* re-applying replaces the extensions wholesale, so an earlier apply's default does not survive.
|
|
57
61
|
*/
|
|
58
|
-
export declare function applyTemplateToElement(definitions: BpmnDefinitions, elementId: string, template: ElementTemplate, values?: Record<string, string
|
|
62
|
+
export declare function applyTemplateToElement(definitions: BpmnDefinitions, elementId: string, template: ElementTemplate, values?: Record<string, string>, options?: ApplyOptions): ApplyToElementResult;
|
|
59
63
|
//# sourceMappingURL=apply-element.d.ts.map
|