@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.
Files changed (78) hide show
  1. package/AGENTS.md +19 -0
  2. package/README.md +2 -0
  3. package/agent-cards/bpmn.md +86 -0
  4. package/agent-cards/dmn.md +105 -0
  5. package/agent-cards/form.md +72 -0
  6. package/builder-reference.md +211 -0
  7. package/dist/bpmn/auto-layout.js +34 -5
  8. package/dist/bpmn/bpmn-builder.d.ts +127 -5
  9. package/dist/bpmn/bpmn-builder.js +270 -40
  10. package/dist/bpmn/bpmn-model.d.ts +2 -0
  11. package/dist/bpmn/bpmn-parser.js +8 -0
  12. package/dist/bpmn/bpmn-serializer.js +1 -1
  13. package/dist/bpmn/builder-coverage.js +4 -12
  14. package/dist/bpmn/camunda7/export.d.ts +25 -0
  15. package/dist/bpmn/camunda7/export.js +218 -0
  16. package/dist/bpmn/camunda7/migrate.d.ts +4 -1
  17. package/dist/bpmn/camunda7/migrate.js +4 -4
  18. package/dist/bpmn/compact.d.ts +21 -0
  19. package/dist/bpmn/compact.js +86 -1
  20. package/dist/bpmn/full-operations.js +338 -3
  21. package/dist/bpmn/index.d.ts +2 -0
  22. package/dist/bpmn/index.js +2 -0
  23. package/dist/bpmn/operations.d.ts +42 -1
  24. package/dist/bpmn/operations.js +12 -2
  25. package/dist/bpmn/optimize/deploy.js +14 -0
  26. package/dist/bpmn/optimize/index.d.ts +2 -0
  27. package/dist/bpmn/optimize/index.js +5 -0
  28. package/dist/bpmn/optimize/types.d.ts +7 -0
  29. package/dist/bpmn/stable-ids.d.ts +15 -0
  30. package/dist/bpmn/stable-ids.js +26 -0
  31. package/dist/bpmn/strip-camunda8.d.ts +22 -0
  32. package/dist/bpmn/strip-camunda8.js +55 -0
  33. package/dist/bpmn/svg.js +5 -6
  34. package/dist/bpmn/utils.js +151 -1
  35. package/dist/bpmn/zeebe-extensions.d.ts +59 -2
  36. package/dist/bpmn/zeebe-extensions.js +89 -1
  37. package/dist/check-finding.d.ts +19 -0
  38. package/dist/check-finding.js +5 -0
  39. package/dist/connectors/apply-element.d.ts +7 -3
  40. package/dist/connectors/apply-element.js +115 -4
  41. package/dist/connectors/apply-many.d.ts +5 -1
  42. package/dist/connectors/apply-many.js +5 -2
  43. package/dist/connectors/apply.d.ts +24 -3
  44. package/dist/connectors/apply.js +103 -3
  45. package/dist/connectors/catalog.js +5 -0
  46. package/dist/connectors/index.d.ts +1 -1
  47. package/dist/connectors/template-types.d.ts +30 -0
  48. package/dist/connectors/validate.js +33 -0
  49. package/dist/dmn/compact.js +14 -5
  50. package/dist/dmn/dmn-builder.js +3 -3
  51. package/dist/dmn/drd-builder.d.ts +53 -0
  52. package/dist/dmn/drd-builder.js +100 -0
  53. package/dist/dmn/index.d.ts +35 -0
  54. package/dist/dmn/index.js +36 -0
  55. package/dist/dmn/lint.d.ts +19 -0
  56. package/dist/dmn/lint.js +414 -0
  57. package/dist/form/form-builder.d.ts +9 -1
  58. package/dist/form/form-builder.js +34 -1
  59. package/dist/form/form-model.d.ts +7 -0
  60. package/dist/form/form-parser.js +22 -0
  61. package/dist/form/form-serializer.js +10 -0
  62. package/dist/form/index.d.ts +11 -2
  63. package/dist/form/index.js +10 -1
  64. package/dist/form/lint.d.ts +19 -0
  65. package/dist/form/lint.js +356 -0
  66. package/dist/index.d.ts +19 -5
  67. package/dist/index.js +12 -2
  68. package/dist/layout/annotations.d.ts +3 -1
  69. package/dist/layout/annotations.js +72 -14
  70. package/dist/layout/grid/edge-labels.d.ts +7 -1
  71. package/dist/layout/grid/edge-labels.js +62 -1
  72. package/dist/layout/semantic/index.js +78 -8
  73. package/dist/layout/semantic/place.d.ts +19 -4
  74. package/dist/layout/semantic/place.js +245 -29
  75. package/dist/layout/semantic/route.js +60 -12
  76. package/dist/layout/types.d.ts +2 -1
  77. package/llms.txt +9 -0
  78. package/package.json +6 -1
@@ -22,6 +22,16 @@ export function exportForm(form) {
22
22
  return JSON.stringify(obj, null, 2);
23
23
  }
24
24
  function serializeComponent(component) {
25
+ const out = serializeKnownComponent(component);
26
+ if (component.conditional !== undefined)
27
+ out.conditional = { ...component.conditional };
28
+ for (const [key, value] of Object.entries(component.extraProps ?? {})) {
29
+ if (!(key in out))
30
+ out[key] = value;
31
+ }
32
+ return out;
33
+ }
34
+ function serializeKnownComponent(component) {
25
35
  // Use the type discriminant, casting where TypeScript can't narrow through FormUnknownComponent
26
36
  const type = component.type;
27
37
  switch (type) {
@@ -1,4 +1,4 @@
1
- export type { FormComponent, FormButtonComponent, FormCheckboxComponent, FormChecklistComponent, FormDatetimeComponent, FormDefinition, FormDocumentPreviewComponent, FormDynamicListComponent, FormExporter, FormExpressionComponent, FormFilepickerComponent, FormGroupComponent, FormHtmlComponent, FormIframeComponent, FormImageComponent, FormLayout, FormLayoutInput, FormNumberComponent, FormRadioComponent, FormSelectComponent, FormSeparatorComponent, FormSpacerComponent, FormTableComponent, FormTaglistComponent, FormTextAreaComponent, FormTextComponent, FormTextFieldComponent, FormUnknownComponent, FormValidation, FormValueOption, } from "./form-model.js";
1
+ export type { FormComponent, FormButtonComponent, FormCheckboxComponent, FormChecklistComponent, FormDatetimeComponent, FormDefinition, FormDocumentPreviewComponent, FormDynamicListComponent, FormExporter, FormExpressionComponent, FormFilepickerComponent, FormGroupComponent, FormHtmlComponent, FormIframeComponent, FormImageComponent, FormConditional, FormLayout, FormLayoutInput, FormNumberComponent, FormRadioComponent, FormSelectComponent, FormSeparatorComponent, FormSpacerComponent, FormTableComponent, FormTaglistComponent, FormTextAreaComponent, FormTextComponent, FormTextFieldComponent, FormUnknownComponent, FormValidation, FormValueOption, } from "./form-model.js";
2
2
  export { parseForm } from "./form-parser.js";
3
3
  export { exportForm } from "./form-serializer.js";
4
4
  export { FormBuilder, GroupBuilder } from "./form-builder.js";
@@ -9,7 +9,16 @@ import { compactifyForm } from "./compact.js";
9
9
  import type { CompactForm } from "./compact.js";
10
10
  import { FormBuilder } from "./form-builder.js";
11
11
  import type { FormDefinition } from "./form-model.js";
12
- /** Top-level Form namespace providing create, parse, and export entry points. */
12
+ /**
13
+ * Top-level Form namespace providing create, parse, and export entry points.
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * const form = Form.create("review-order").textfield("Note", "note").build()
18
+ * ```
19
+ *
20
+ * @see node_modules/@bpmnkit/core/agent-cards/form.md — runnable script and traps (~1k tokens)
21
+ */
13
22
  export declare const Form: {
14
23
  /** Creates a new form using a fluent builder. */
15
24
  readonly create: (id?: string) => FormBuilder;
@@ -7,7 +7,16 @@ import { compactifyForm, expandForm } from "./compact.js";
7
7
  import { FormBuilder } from "./form-builder.js";
8
8
  import { parseForm } from "./form-parser.js";
9
9
  import { exportForm } from "./form-serializer.js";
10
- /** Top-level Form namespace providing create, parse, and export entry points. */
10
+ /**
11
+ * Top-level Form namespace providing create, parse, and export entry points.
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * const form = Form.create("review-order").textfield("Note", "note").build()
16
+ * ```
17
+ *
18
+ * @see node_modules/@bpmnkit/core/agent-cards/form.md — runnable script and traps (~1k tokens)
19
+ */
11
20
  export const Form = {
12
21
  /** Creates a new form using a fluent builder. */
13
22
  create(id) {
@@ -0,0 +1,19 @@
1
+ import { type CheckFinding } from "../check-finding.js";
2
+ /**
3
+ * Checks a Camunda form (form-js JSON schema) for what Zeebe deploys without
4
+ * complaint but Tasklist then fails on: invalid schema shape, duplicate
5
+ * component ids or keys, input fields bound to no variable, and FEEL in
6
+ * conditions and expressions that does not parse.
7
+ *
8
+ * Works on the raw JSON rather than `Form.parse`, so every problem in the
9
+ * document is reported instead of only the first one the parser throws on.
10
+ *
11
+ * @param json - The form's JSON text.
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * for (const f of lintForm(json)) console.log(`${f.rule} [${f.elementId}] ${f.message} — ${f.fix}`)
16
+ * ```
17
+ */
18
+ export declare function lintForm(json: string): CheckFinding[];
19
+ //# sourceMappingURL=lint.d.ts.map
@@ -0,0 +1,356 @@
1
+ import { parseExpression } from "@bpmnkit/feel";
2
+ import { withCardHint } from "../check-finding.js";
3
+ /** form-js component types (form-js 1.x, as Camunda Tasklist renders them). */
4
+ const KNOWN_TYPES = new Set([
5
+ "text",
6
+ "textfield",
7
+ "textarea",
8
+ "number",
9
+ "datetime",
10
+ "select",
11
+ "radio",
12
+ "checkbox",
13
+ "checklist",
14
+ "taglist",
15
+ "button",
16
+ "group",
17
+ "dynamiclist",
18
+ "iframe",
19
+ "image",
20
+ "table",
21
+ "html",
22
+ "separator",
23
+ "spacer",
24
+ "expression",
25
+ "filepicker",
26
+ "documentPreview",
27
+ ]);
28
+ /** Components that bind a value to a process variable, and so need a `key`. */
29
+ const KEYED_TYPES = new Set([
30
+ "textfield",
31
+ "textarea",
32
+ "number",
33
+ "datetime",
34
+ "select",
35
+ "radio",
36
+ "checkbox",
37
+ "checklist",
38
+ "taglist",
39
+ "expression",
40
+ "filepicker",
41
+ ]);
42
+ /** Components that choose from a list of options. */
43
+ const OPTION_TYPES = new Set(["select", "radio", "checklist", "taglist"]);
44
+ /** Containers whose `path` opens a nested data scope for the keys inside them. */
45
+ const SCOPED_CONTAINERS = new Set(["group", "dynamiclist"]);
46
+ const KEY_PATTERN = /^[A-Za-z_$][\w$]*(\.[A-Za-z_$][\w$]*)*$/;
47
+ /** Properties that are not expressions even though a value may happen to start with `=`. */
48
+ const NON_FEEL_KEYS = new Set(["components", "id", "type", "key", "path", "values"]);
49
+ function isObject(value) {
50
+ return typeof value === "object" && value !== null && !Array.isArray(value);
51
+ }
52
+ /**
53
+ * Checks a Camunda form (form-js JSON schema) for what Zeebe deploys without
54
+ * complaint but Tasklist then fails on: invalid schema shape, duplicate
55
+ * component ids or keys, input fields bound to no variable, and FEEL in
56
+ * conditions and expressions that does not parse.
57
+ *
58
+ * Works on the raw JSON rather than `Form.parse`, so every problem in the
59
+ * document is reported instead of only the first one the parser throws on.
60
+ *
61
+ * @param json - The form's JSON text.
62
+ *
63
+ * @example
64
+ * ```typescript
65
+ * for (const f of lintForm(json)) console.log(`${f.rule} [${f.elementId}] ${f.message} — ${f.fix}`)
66
+ * ```
67
+ */
68
+ export function lintForm(json) {
69
+ return withCardHint(lintFormFindings(json), "form");
70
+ }
71
+ function lintFormFindings(json) {
72
+ let root;
73
+ try {
74
+ root = JSON.parse(json);
75
+ }
76
+ catch (err) {
77
+ return [
78
+ {
79
+ rule: "form/invalid-json",
80
+ severity: "error",
81
+ message: `The form is not valid JSON: ${err.message}`,
82
+ fix: "Fix the JSON syntax (trailing commas, unquoted keys and single quotes are not allowed).",
83
+ },
84
+ ];
85
+ }
86
+ if (!isObject(root)) {
87
+ return [
88
+ {
89
+ rule: "form/invalid-schema",
90
+ severity: "error",
91
+ message: "The form's top level is not a JSON object.",
92
+ fix: 'Write the form as { "id": "…", "type": "default", "components": [ … ] }.',
93
+ },
94
+ ];
95
+ }
96
+ const findings = [];
97
+ if (typeof root.id !== "string" || root.id === "") {
98
+ findings.push({
99
+ rule: "form/missing-id",
100
+ severity: "error",
101
+ message: "The form has no id.",
102
+ fix: 'Add a top-level "id" — a user task links the form by it (zeebe:formDefinition formId).',
103
+ });
104
+ }
105
+ if (root.type !== "default") {
106
+ findings.push({
107
+ rule: "form/invalid-schema",
108
+ severity: "error",
109
+ message: `The form's top-level "type" is ${JSON.stringify(root.type)}, not "default".`,
110
+ fix: 'Set "type": "default".',
111
+ });
112
+ }
113
+ if (root.schemaVersion !== undefined && typeof root.schemaVersion !== "number") {
114
+ findings.push({
115
+ rule: "form/invalid-schema",
116
+ severity: "warning",
117
+ message: `"schemaVersion" is ${JSON.stringify(root.schemaVersion)}, not a number.`,
118
+ fix: 'Set "schemaVersion" to a number, e.g. 16, or remove it.',
119
+ });
120
+ }
121
+ if (!Array.isArray(root.components)) {
122
+ findings.push({
123
+ rule: "form/invalid-schema",
124
+ severity: "error",
125
+ message: 'The form has no "components" array.',
126
+ fix: 'Add "components": [ … ] with the form\'s fields.',
127
+ });
128
+ return findings;
129
+ }
130
+ const walk = { findings, ids: new Map(), keys: new Map() };
131
+ if (typeof root.id === "string")
132
+ walk.ids.set(root.id, "the form");
133
+ walkComponents(root.components, "", "components", walk);
134
+ return findings;
135
+ }
136
+ function walkComponents(components, scope, path, w) {
137
+ components.forEach((component, index) => {
138
+ const at = `${path}[${index}]`;
139
+ if (!isObject(component)) {
140
+ w.findings.push({
141
+ rule: "form/invalid-schema",
142
+ severity: "error",
143
+ message: `${at} is not an object.`,
144
+ fix: 'Write each component as { "id": "…", "type": "…", … }.',
145
+ });
146
+ return;
147
+ }
148
+ checkComponent(component, scope, at, w);
149
+ });
150
+ }
151
+ function checkComponent(c, scope, at, w) {
152
+ const id = typeof c.id === "string" && c.id !== "" ? c.id : undefined;
153
+ const where = id !== undefined ? { elementId: id } : {};
154
+ const label = id !== undefined ? `Component "${id}"` : at;
155
+ const type = typeof c.type === "string" ? c.type : undefined;
156
+ if (type === undefined) {
157
+ w.findings.push({
158
+ rule: "form/invalid-schema",
159
+ severity: "error",
160
+ ...where,
161
+ message: `${label} has no "type".`,
162
+ fix: `Set "type" to one of ${[...KNOWN_TYPES].join(", ")}.`,
163
+ });
164
+ }
165
+ else if (!KNOWN_TYPES.has(type)) {
166
+ w.findings.push({
167
+ rule: "form/unknown-type",
168
+ severity: "warning",
169
+ ...where,
170
+ message: `${label} has type "${type}", which form-js does not provide.`,
171
+ fix: `Use one of ${[...KNOWN_TYPES].join(", ")} — unless "${type}" is a custom component registered in your Tasklist.`,
172
+ });
173
+ }
174
+ if (id === undefined) {
175
+ w.findings.push({
176
+ rule: "form/missing-id",
177
+ severity: "error",
178
+ message: `${at}${type !== undefined ? ` (${type})` : ""} has no id.`,
179
+ fix: 'Give every component a unique "id", e.g. "Field_amount".',
180
+ });
181
+ }
182
+ else if (w.ids.has(id)) {
183
+ w.findings.push({
184
+ rule: "form/duplicate-id",
185
+ severity: "error",
186
+ elementId: id,
187
+ message: `The id "${id}" is used by ${w.ids.get(id)} and by ${at}.`,
188
+ fix: "Give each component its own id.",
189
+ });
190
+ }
191
+ else {
192
+ w.ids.set(id, at);
193
+ }
194
+ if (type !== undefined && KEYED_TYPES.has(type))
195
+ checkKey(c, type, scope, label, where, w);
196
+ if (type !== undefined && OPTION_TYPES.has(type)) {
197
+ const hasValues = Array.isArray(c.values) && c.values.length > 0;
198
+ const hasSource = typeof c.valuesKey === "string" || typeof c.valuesExpression === "string";
199
+ if (!hasValues && !hasSource) {
200
+ w.findings.push({
201
+ rule: "form/missing-options",
202
+ severity: "error",
203
+ ...where,
204
+ message: `${label} (${type}) has no options.`,
205
+ fix: 'Add "values": [{ "label": "…", "value": "…" }], or take them from a variable with "valuesKey" or "valuesExpression".',
206
+ });
207
+ }
208
+ }
209
+ if (type === "expression" && (typeof c.expression !== "string" || c.expression.trim() === "")) {
210
+ w.findings.push({
211
+ rule: "form/missing-expression",
212
+ severity: "error",
213
+ ...where,
214
+ message: `${label} is an expression field with no "expression".`,
215
+ fix: 'Set "expression" to a FEEL expression starting with "=", e.g. "=amount * 1.2".',
216
+ });
217
+ }
218
+ if (type === "button" &&
219
+ c.action !== undefined &&
220
+ c.action !== "submit" &&
221
+ c.action !== "reset") {
222
+ w.findings.push({
223
+ rule: "form/invalid-schema",
224
+ severity: "error",
225
+ ...where,
226
+ message: `${label} has button action ${JSON.stringify(c.action)}.`,
227
+ fix: 'Use "action": "submit" or "reset".',
228
+ });
229
+ }
230
+ checkConditional(c, label, where, w);
231
+ checkValidation(c, label, where, w);
232
+ checkFeelProperties(c, "", label, where, w);
233
+ if (Array.isArray(c.components)) {
234
+ const path = typeof c.path === "string" && c.path !== "" ? c.path : undefined;
235
+ const nested = type !== undefined && SCOPED_CONTAINERS.has(type) && path !== undefined
236
+ ? scope === ""
237
+ ? path
238
+ : `${scope}.${path}`
239
+ : scope;
240
+ walkComponents(c.components, nested, `${at}.components`, w);
241
+ }
242
+ }
243
+ function checkKey(c, type, scope, label, where, w) {
244
+ const key = c.key;
245
+ if (typeof key !== "string" || key === "") {
246
+ // An expression field may compute a value without binding it.
247
+ if (type === "expression")
248
+ return;
249
+ w.findings.push({
250
+ rule: "form/missing-key",
251
+ severity: "error",
252
+ ...where,
253
+ message: `${label} (${type}) is not bound to a variable — it has no "key".`,
254
+ fix: 'Set "key" to the process variable the field reads and writes, e.g. "amount".',
255
+ });
256
+ return;
257
+ }
258
+ if (!KEY_PATTERN.test(key)) {
259
+ w.findings.push({
260
+ rule: "form/invalid-key",
261
+ severity: "error",
262
+ ...where,
263
+ message: `${label} has key "${key}", which is not a variable name or dotted path.`,
264
+ fix: "Use letters, digits, `_` and `$`, not starting with a digit; separate nested names with dots.",
265
+ });
266
+ }
267
+ const keys = w.keys.get(scope) ?? new Set();
268
+ w.keys.set(scope, keys);
269
+ if (keys.has(key)) {
270
+ w.findings.push({
271
+ rule: "form/duplicate-key",
272
+ severity: "error",
273
+ ...where,
274
+ message: `${label} binds key "${key}"${scope === "" ? "" : ` (in "${scope}")`}, which another field already binds.`,
275
+ fix: "Give each field its own key; two fields on one key overwrite each other's value on submit.",
276
+ });
277
+ }
278
+ keys.add(key);
279
+ }
280
+ function checkConditional(c, label, where, w) {
281
+ if (!isObject(c.conditional))
282
+ return;
283
+ const hide = c.conditional.hide;
284
+ if (typeof hide === "string" && hide.trim() !== "" && !hide.trim().startsWith("=")) {
285
+ w.findings.push({
286
+ rule: "form/conditional-not-feel",
287
+ severity: "warning",
288
+ ...where,
289
+ message: `${label}'s conditional.hide is "${hide}", which is not an expression.`,
290
+ fix: `Prefix it with "=" to make it FEEL, e.g. "=${hide.trim()}".`,
291
+ });
292
+ }
293
+ }
294
+ function checkValidation(c, label, where, w) {
295
+ if (!isObject(c.validate))
296
+ return;
297
+ const v = c.validate;
298
+ if (typeof v.pattern === "string") {
299
+ try {
300
+ new RegExp(v.pattern);
301
+ }
302
+ catch (err) {
303
+ w.findings.push({
304
+ rule: "form/invalid-validation",
305
+ severity: "error",
306
+ ...where,
307
+ message: `${label}'s validate.pattern is not a valid regular expression: ${err.message}`,
308
+ fix: "Fix the pattern; backslashes must be doubled in JSON (`\\\\d`).",
309
+ });
310
+ }
311
+ }
312
+ for (const [lo, hi] of [
313
+ ["min", "max"],
314
+ ["minLength", "maxLength"],
315
+ ]) {
316
+ const a = v[lo];
317
+ const b = v[hi];
318
+ if (typeof a === "number" && typeof b === "number" && a > b) {
319
+ w.findings.push({
320
+ rule: "form/invalid-validation",
321
+ severity: "error",
322
+ ...where,
323
+ message: `${label} has validate.${lo} ${a} greater than validate.${hi} ${b}; no value can pass.`,
324
+ fix: `Swap them, or lower ${lo} below ${hi}.`,
325
+ });
326
+ }
327
+ }
328
+ }
329
+ /** Parses every string property that form-js reads as FEEL (one starting with `=`). */
330
+ function checkFeelProperties(value, prefix, label, where, w) {
331
+ for (const [key, v] of Object.entries(value)) {
332
+ if (prefix === "" && NON_FEEL_KEYS.has(key))
333
+ continue;
334
+ const prop = prefix === "" ? key : `${prefix}.${key}`;
335
+ if (typeof v === "string") {
336
+ const trimmed = v.trim();
337
+ if (!trimmed.startsWith("="))
338
+ continue;
339
+ const { errors } = parseExpression(trimmed.slice(1));
340
+ const first = errors[0];
341
+ if (first === undefined)
342
+ continue;
343
+ w.findings.push({
344
+ rule: "form/feel-syntax",
345
+ severity: "error",
346
+ ...where,
347
+ message: `${label}'s ${prop} is not valid FEEL: ${first.message} in \`${trimmed}\`.`,
348
+ fix: "Fix the FEEL after the `=`; strings need double quotes, and `and`/`or` join conditions.",
349
+ });
350
+ }
351
+ else if (isObject(v)) {
352
+ checkFeelProperties(v, prop, label, where, w);
353
+ }
354
+ }
355
+ }
356
+ //# sourceMappingURL=lint.js.map
package/dist/index.d.ts CHANGED
@@ -1,8 +1,16 @@
1
+ /**
2
+ * @packageDocumentation
3
+ * BPMN 2.0, DMN and Camunda Form SDK. **Agents: read
4
+ * `node_modules/@bpmnkit/core/AGENTS.md`, then the one card for your type
5
+ * (`agent-cards/bpmn.md`, `dmn.md` or `form.md`, ~1k tokens each) instead of the README.**
6
+ */
1
7
  export { BpmnSdkError, ParseError, ValidationError, WriteError, WriteVerificationError, } from "./errors.js";
2
8
  export type { ErrorCode } from "./errors.js";
3
9
  export { isBpmnActivity, isBpmnAdHocSubProcess, isBpmnBoundaryEvent, isBpmnBusinessRuleTask, isBpmnCallActivity, isBpmnComplexGateway, isBpmnDataObject, isBpmnDataObjectReference, isBpmnDataStoreReference, isBpmnEndEvent, isBpmnEvent, isBpmnEventBasedGateway, isBpmnEventSubProcess, isBpmnExclusiveGateway, isBpmnGateway, isBpmnInclusiveGateway, isBpmnIntermediateCatchEvent, isBpmnIntermediateThrowEvent, isBpmnManualTask, isBpmnParallelGateway, isBpmnReceiveTask, isBpmnScriptTask, isBpmnSendTask, isBpmnServiceTask, isBpmnStartEvent, isBpmnSubProcess, isBpmnTask, isBpmnTransaction, isBpmnUserTask, } from "./bpmn/type-guards.js";
4
10
  export { findElement, findElementInProcess, findProcess, findSequenceFlow, getAllElements, getElementType, getZeebeExtensions, } from "./bpmn/utils.js";
5
11
  export { Bpmn, SAMPLE_BPMN_XML } from "./bpmn/index.js";
12
+ export { stripCamunda8 } from "./bpmn/strip-camunda8.js";
13
+ export type { DroppedCamunda8Item, StripCamunda8Result } from "./bpmn/strip-camunda8.js";
6
14
  export { applyAutoLayout } from "./bpmn/auto-layout.js";
7
15
  export { diffSemantics, projectSemantics, semanticHash } from "./bpmn/semantic-hash.js";
8
16
  export type { JsonValue, SemanticDiff, SemanticProjection } from "./bpmn/semantic-hash.js";
@@ -27,21 +35,25 @@ export { checkDiCompleteness } from "./bpmn/di-check.js";
27
35
  export type { DiCompleteness } from "./bpmn/di-check.js";
28
36
  export { planeForElement, listPlaneElementIds } from "./bpmn/di-planes.js";
29
37
  export { DiagramBuilder, ProcessBuilder } from "./bpmn/bpmn-builder.js";
30
- export type { BranchBuilder, BuildOptions, MessageFlowOptions, ParticipantOptions, DiagramMessageOptions, SubProcessContentBuilder, ServiceTaskOptions, ScriptTaskOptions, UserTaskOptions, CallActivityOptions, BusinessRuleTaskOptions, ElementOptions, GatewayOptions, MultiInstanceOptions, SubProcessOptions, StartEventOptions, IntermediateCatchEventOptions, IntermediateThrowEventOptions, EndEventOptions, BoundaryEventOptions, AdHocSubProcessOptions, AnnotateOptions, } from "./bpmn/bpmn-builder.js";
38
+ export type { BranchBuilder, BuildOptions, MessageFlowOptions, ParticipantOptions, DiagramMessageOptions, SubProcessContentBuilder, ServiceTaskOptions, ScriptTaskOptions, UserTaskOptions, CallActivityOptions, BusinessRuleTaskOptions, ElementOptions, GatewayOptions, MultiInstanceOptions, SubProcessOptions, StartEventOptions, IntermediateCatchEventOptions, IntermediateThrowEventOptions, EndEventOptions, BoundaryEventOptions, ConditionVariableEvent, AdHocSubProcessOptions, AnnotateOptions, } from "./bpmn/bpmn-builder.js";
31
39
  export type { BpmnDefinitions, BpmnProcess, BpmnFlowNode, BpmnFlowElement, BpmnSequenceFlow, BpmnBoundaryEvent, BpmnElementType, BpmnStartEvent, BpmnEndEvent, BpmnIntermediateCatchEvent, BpmnIntermediateThrowEvent, BpmnTask, BpmnServiceTask, BpmnScriptTask, BpmnUserTask, BpmnSendTask, BpmnReceiveTask, BpmnBusinessRuleTask, BpmnManualTask, BpmnCallActivity, BpmnSubProcess, BpmnAdHocSubProcess, BpmnEventSubProcess, BpmnTransaction, BpmnExclusiveGateway, BpmnParallelGateway, BpmnInclusiveGateway, BpmnEventBasedGateway, BpmnComplexGateway, BpmnCollaboration, BpmnParticipant, BpmnMessageFlow, BpmnLane, BpmnLaneSet, BpmnError, BpmnEscalation, BpmnMessage, BpmnSignal, BpmnTextAnnotation, BpmnAssociation, BpmnGroup, BpmnDataObject, BpmnDataObjectReference, BpmnDataStoreReference, BpmnConditionExpression, BpmnEventDefinition, BpmnTimerEventDefinition, BpmnErrorEventDefinition, BpmnEscalationEventDefinition, BpmnMessageEventDefinition, BpmnSignalEventDefinition, BpmnConditionalEventDefinition, BpmnLinkEventDefinition, BpmnCancelEventDefinition, BpmnTerminateEventDefinition, BpmnCompensateEventDefinition, BpmnMultiInstanceLoopCharacteristics, BpmnDiagram, BpmnDiPlane, BpmnDiShape, BpmnDiEdge, BpmnDiLabel, BpmnBounds, BpmnWaypoint, } from "./bpmn/bpmn-model.js";
32
40
  export type { RestConnectorConfig, RestAuthentication, HttpMethod, } from "./bpmn/rest-connector.js";
33
- export type { ZeebeExtensions, ZeebeTaskDefinition, ZeebeIoMapping, ZeebeIoMappingEntry, ZeebeTaskHeaders, ZeebeTaskHeaderEntry, ZeebeProperties, ZeebePropertyEntry, ZeebeFormDefinition, ZeebeCalledDecision, ZeebeAssignmentDefinition, ZeebeTaskSchedule, ZeebePriorityDefinition, ZeebeSubscription, ZeebeAgentDefinition, } from "./bpmn/zeebe-extensions.js";
41
+ export type { ZeebeExtensions, ZeebeTaskDefinition, ZeebeIoMapping, ZeebeIoMappingEntry, ZeebeTaskHeaders, ZeebeTaskHeaderEntry, ZeebeProperties, ZeebePropertyEntry, ZeebeFormDefinition, ZeebeCalledDecision, ZeebeLinkedResource, ZeebeCalledElement, ZeebeAssignmentDefinition, ZeebeTaskSchedule, ZeebePriorityDefinition, ZeebeSubscription, ZeebeAgentDefinition, } from "./bpmn/zeebe-extensions.js";
34
42
  export { assertZeebePlacement, bpmnElementName, ensureZeebeExtension, isZeebePlacementAllowed, ZeebePlacementError, zeebeExtensionsToXmlElements, } from "./bpmn/zeebe-extensions.js";
35
43
  export { ZEEBE_PLACEMENT } from "./bpmn/zeebe-placement.js";
36
44
  export { buildAiAgentSubProcess, AI_AGENT_JOB_WORKER_TASK_TYPE, AI_AGENT_DEFAULT_OUTPUT_ELEMENT, } from "./bpmn/agentic.js";
37
45
  export type { AiAgentOptions, AiAgentModelConfig, AiAgentToolSpec, AiAgentToolParam, AiAgentToolParamType, AiAgentBuild, } from "./bpmn/agentic.js";
38
- export { Dmn, layoutDmn, benchmarkDmnLayout, compactifyDmn, expandDmn } from "./dmn/index.js";
46
+ export { Dmn, drgId, layoutDmn, benchmarkDmnLayout, compactifyDmn, expandDmn } from "./dmn/index.js";
39
47
  export type { DmnBenchmarkResult, DmnElementPosition, CompactDmn, CompactDmnDecision, CompactDmnInput, CompactDmnOutput, CompactDmnRule, } from "./dmn/index.js";
40
48
  export { Form, compactifyForm, expandForm } from "./form/index.js";
49
+ export { lintForm } from "./form/lint.js";
50
+ export { lintDmn } from "./dmn/lint.js";
51
+ export type { CheckFinding, CheckSeverity } from "./check-finding.js";
41
52
  export type { CompactForm, CompactFormField } from "./form/index.js";
42
53
  export { FormBuilder, GroupBuilder } from "./form/form-builder.js";
43
54
  export type { TextFieldOptions, SelectOptions, RadioOptions, CheckboxOptions, ChecklistOptions, GroupOptions, } from "./form/form-builder.js";
44
- export type { FormComponent, FormCheckboxComponent, FormChecklistComponent, FormDefinition, FormExporter, FormGroupComponent, FormLayout, FormLayoutInput, FormRadioComponent, FormSelectComponent, FormTextAreaComponent, FormTextComponent, FormTextFieldComponent, FormValidation, FormValueOption, FormNumberComponent, FormDatetimeComponent, FormButtonComponent, FormTaglistComponent, FormTableComponent, FormImageComponent, FormDynamicListComponent, FormIframeComponent, FormSeparatorComponent, FormSpacerComponent, FormDocumentPreviewComponent, FormHtmlComponent, FormExpressionComponent, FormFilepickerComponent, FormUnknownComponent, } from "./form/form-model.js";
55
+ export type { FormComponent, FormCheckboxComponent, FormChecklistComponent, FormDefinition, FormExporter, FormGroupComponent, FormConditional, FormLayout, FormLayoutInput, FormRadioComponent, FormSelectComponent, FormTextAreaComponent, FormTextComponent, FormTextFieldComponent, FormValidation, FormValueOption, FormNumberComponent, FormDatetimeComponent, FormButtonComponent, FormTaglistComponent, FormTableComponent, FormImageComponent, FormDynamicListComponent, FormIframeComponent, FormSeparatorComponent, FormSpacerComponent, FormDocumentPreviewComponent, FormHtmlComponent, FormExpressionComponent, FormFilepickerComponent, FormUnknownComponent, } from "./form/form-model.js";
56
+ export type { DecisionHandle, DrdBuilder, DrdDecisionOptions, DrgId, DrgRef, InputDataHandle, } from "./dmn/drd-builder.js";
45
57
  export type { DecisionTableBuilder, InputOptions, OutputOptions, RuleOptions, } from "./dmn/dmn-builder.js";
46
58
  export type { DmnDefinitions, DmnDecision, DmnDecisionTable, DmnInput, DmnOutput, DmnRule, DmnInputEntry, DmnOutputEntry, DmnDiagram, DmnDiagramShape, DmnDiagramEdge, DmnWaypoint, DmnTypeRef, DmnAggregation, HitPolicy, DmnInformationRequirement, DmnKnowledgeRequirement, DmnAuthorityRequirement, DmnInputData, DmnKnowledgeSource, DmnBusinessKnowledgeModel, DmnTextAnnotation, DmnAssociation, } from "./dmn/dmn-model.js";
47
59
  export type { XmlElement } from "./types/xml-element.js";
@@ -55,7 +67,7 @@ export { readDiColor, writeDiColor, BIOC_NS, COLOR_NS } from "./bpmn/di-color.js
55
67
  export type { DiColor } from "./bpmn/di-color.js";
56
68
  export { collectLabelStyles, labelFontCss, resolveLabelFont } from "./bpmn/label-style.js";
57
69
  export type { BpmnLabelFont, LabelFontCss } from "./bpmn/label-style.js";
58
- export { optimize } from "./bpmn/optimize/index.js";
70
+ export { optimize, USER_TASK_FORM_RULE } from "./bpmn/optimize/index.js";
59
71
  export { renderStoryHtml } from "./bpmn/story.js";
60
72
  export type { StoryRenderOptions } from "./bpmn/story.js";
61
73
  export { analyzeVariableFlow, extractFeelIdentifiers } from "./bpmn/optimize/variable-flow.js";
@@ -87,6 +99,8 @@ export type { ApplyBpmnOperationsOptions, ApplyBpmnOperationsResult, OperationPr
87
99
  export { buildValidationDmn, findValidationStructure, getValidationInputNames, insertValidationStructure, removeValidationStructure, validationDecisionId, } from "./bpmn/input-validation.js";
88
100
  export type { InputVariableDef, ValidationStructure, ValidationVariableType, } from "./bpmn/input-validation.js";
89
101
  export { analyzeCamunda7, convertCamunda7 } from "./bpmn/camunda7/migrate.js";
102
+ export { convertCamunda8To7 } from "./bpmn/camunda7/export.js";
103
+ export type { Camunda8ExportFinding, Camunda8To7Conversion } from "./bpmn/camunda7/export.js";
90
104
  export type { Camunda7Conversion, Camunda7ConvertOptions, Camunda7Finding, Camunda7Report, Camunda7Severity, } from "./bpmn/camunda7/migrate.js";
91
105
  export { translateJuelToFeel } from "./bpmn/camunda7/juel.js";
92
106
  export type { JuelToFeelOptions, JuelToFeelResult } from "./bpmn/camunda7/juel.js";
package/dist/index.js CHANGED
@@ -1,7 +1,14 @@
1
+ /**
2
+ * @packageDocumentation
3
+ * BPMN 2.0, DMN and Camunda Form SDK. **Agents: read
4
+ * `node_modules/@bpmnkit/core/AGENTS.md`, then the one card for your type
5
+ * (`agent-cards/bpmn.md`, `dmn.md` or `form.md`, ~1k tokens each) instead of the README.**
6
+ */
1
7
  export { BpmnSdkError, ParseError, ValidationError, WriteError, WriteVerificationError, } from "./errors.js";
2
8
  export { isBpmnActivity, isBpmnAdHocSubProcess, isBpmnBoundaryEvent, isBpmnBusinessRuleTask, isBpmnCallActivity, isBpmnComplexGateway, isBpmnDataObject, isBpmnDataObjectReference, isBpmnDataStoreReference, isBpmnEndEvent, isBpmnEvent, isBpmnEventBasedGateway, isBpmnEventSubProcess, isBpmnExclusiveGateway, isBpmnGateway, isBpmnInclusiveGateway, isBpmnIntermediateCatchEvent, isBpmnIntermediateThrowEvent, isBpmnManualTask, isBpmnParallelGateway, isBpmnReceiveTask, isBpmnScriptTask, isBpmnSendTask, isBpmnServiceTask, isBpmnStartEvent, isBpmnSubProcess, isBpmnTask, isBpmnTransaction, isBpmnUserTask, } from "./bpmn/type-guards.js";
3
9
  export { findElement, findElementInProcess, findProcess, findSequenceFlow, getAllElements, getElementType, getZeebeExtensions, } from "./bpmn/utils.js";
4
10
  export { Bpmn, SAMPLE_BPMN_XML } from "./bpmn/index.js";
11
+ export { stripCamunda8 } from "./bpmn/strip-camunda8.js";
5
12
  export { applyAutoLayout } from "./bpmn/auto-layout.js";
6
13
  export { diffSemantics, projectSemantics, semanticHash } from "./bpmn/semantic-hash.js";
7
14
  export { extractProcessContract, generateProcessTypes } from "./bpmn/process-types.js";
@@ -20,8 +27,10 @@ export { DiagramBuilder, ProcessBuilder } from "./bpmn/bpmn-builder.js";
20
27
  export { assertZeebePlacement, bpmnElementName, ensureZeebeExtension, isZeebePlacementAllowed, ZeebePlacementError, zeebeExtensionsToXmlElements, } from "./bpmn/zeebe-extensions.js";
21
28
  export { ZEEBE_PLACEMENT } from "./bpmn/zeebe-placement.js";
22
29
  export { buildAiAgentSubProcess, AI_AGENT_JOB_WORKER_TASK_TYPE, AI_AGENT_DEFAULT_OUTPUT_ELEMENT, } from "./bpmn/agentic.js";
23
- export { Dmn, layoutDmn, benchmarkDmnLayout, compactifyDmn, expandDmn } from "./dmn/index.js";
30
+ export { Dmn, drgId, layoutDmn, benchmarkDmnLayout, compactifyDmn, expandDmn } from "./dmn/index.js";
24
31
  export { Form, compactifyForm, expandForm } from "./form/index.js";
32
+ export { lintForm } from "./form/lint.js";
33
+ export { lintDmn } from "./dmn/lint.js";
25
34
  export { FormBuilder, GroupBuilder } from "./form/form-builder.js";
26
35
  export { generateId, resetIdCounter } from "./types/id-generator.js";
27
36
  export { parseXml, parseXmlSpans, preserveFormatting, preserveFormattingVerified, serializeXml, } from "./xml/index.js";
@@ -29,7 +38,7 @@ export { parseJsonSpans, preserveJsonFormatting } from "./json/index.js";
29
38
  export { exportFormPreserving, preserveFormFormatting } from "./form/preserving-writer.js";
30
39
  export { readDiColor, writeDiColor, BIOC_NS, COLOR_NS } from "./bpmn/di-color.js";
31
40
  export { collectLabelStyles, labelFontCss, resolveLabelFont } from "./bpmn/label-style.js";
32
- export { optimize } from "./bpmn/optimize/index.js";
41
+ export { optimize, USER_TASK_FORM_RULE } from "./bpmn/optimize/index.js";
33
42
  export { renderStoryHtml } from "./bpmn/story.js";
34
43
  export { analyzeVariableFlow, extractFeelIdentifiers } from "./bpmn/optimize/variable-flow.js";
35
44
  export { layoutProcess, layoutFlowNodes } from "./layout/index.js";
@@ -47,6 +56,7 @@ export { applyOperations } from "./bpmn/operations.js";
47
56
  export { applyBpmnOperations, reconcileCompact, OperationError } from "./bpmn/full-operations.js";
48
57
  export { buildValidationDmn, findValidationStructure, getValidationInputNames, insertValidationStructure, removeValidationStructure, validationDecisionId, } from "./bpmn/input-validation.js";
49
58
  export { analyzeCamunda7, convertCamunda7 } from "./bpmn/camunda7/migrate.js";
59
+ export { convertCamunda8To7 } from "./bpmn/camunda7/export.js";
50
60
  export { translateJuelToFeel } from "./bpmn/camunda7/juel.js";
51
61
  export { exportSvg } from "./bpmn/svg.js";
52
62
  export { buildProcessDocumentation, documentationToDocx, documentationToHtml, documentationToMarkdown, renderDocumentationDocx, renderDocumentationHtml, renderDocumentationMarkdown, } from "./doc/index.js";
@@ -6,6 +6,8 @@
6
6
  */
7
7
  import type { BpmnProcess } from "../bpmn/bpmn-model.js";
8
8
  import type { Bounds, LayoutEdge, LayoutNode, Waypoint } from "./types.js";
9
+ /** Side of the linked element an annotation is placed on. */
10
+ export type AnnotationSide = "above" | "below" | "left" | "right";
9
11
  /**
10
12
  * Sizes and packs text annotations around their linked elements without
11
13
  * overlapping each other or any other layout node (incl. node labels).
@@ -19,7 +21,7 @@ export declare function packAnnotations(process: BpmnProcess, layoutNodes: Layou
19
21
  /** Routed connections: an annotation box must not sit on top of one. */
20
22
  layoutEdges?: LayoutEdge[],
21
23
  /** Sides the author asked for, by annotation id. */
22
- sides?: ReadonlyMap<string, "above" | "below">): Map<string, Bounds>;
24
+ sides?: ReadonlyMap<string, AnnotationSide>): Map<string, Bounds>;
23
25
  /**
24
26
  * Edge-to-edge, clamped association waypoints between a linked element and
25
27
  * its annotation. Port of `chooseWaypoints` (tmp/01-annotation-layouting.cjs:365-389).