@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
@@ -1,22 +1,33 @@
1
1
  import type { GridHint, LayoutHints } from "../layout/types.js";
2
2
  import type { BpmnAssociation, BpmnDefinitions, BpmnError, BpmnEscalation, BpmnFlowElement, BpmnMessage, BpmnSequenceFlow, BpmnSignal, BpmnTextAnnotation } from "./bpmn-model.js";
3
3
  import type { RestConnectorConfig } from "./rest-connector.js";
4
+ import { type ZeebeLinkedResource, type ZeebeListener } from "./zeebe-extensions.js";
4
5
  /** Options shared by all element methods. */
5
6
  export interface ElementOptions {
6
7
  name?: string;
7
8
  isForCompensation?: boolean;
8
9
  /** Free-text documentation (`<bpmn:documentation>`). Used by the AI Agent connector as a tool description. */
9
10
  documentation?: string;
11
+ /** Job-worker listeners on this element's lifecycle (`zeebe:executionListeners`). */
12
+ executionListeners?: ZeebeListener[];
10
13
  }
11
14
  /** Options for send/receive task elements. */
12
15
  export interface MessageTaskOptions extends ElementOptions {
16
+ /** Runs the activity once per item of a list. */
17
+ multiInstance?: MultiInstanceOptions;
13
18
  /** Message name — generates or reuses a root <bpmn:message> and sets messageRef. */
14
19
  messageName?: string;
15
20
  /** FEEL expression correlating this message to a specific process instance (`zeebe:subscription`). */
16
21
  correlationKey?: string;
17
22
  }
23
+ /** Variable change that re-evaluates a conditional event's condition. */
24
+ export type ConditionVariableEvent = "create" | "update";
18
25
  /** Options for creating a start event. */
19
26
  export interface StartEventOptions extends ElementOptions {
27
+ /** FEEL condition — creates a conditional start event (Camunda 8.9+). */
28
+ condition?: string;
29
+ /** Variable events that re-evaluate `condition` (`zeebe:conditionalFilter`); default is both. */
30
+ conditionVariableEvents?: ConditionVariableEvent[];
20
31
  /** Timer duration (ISO 8601) — creates a timer start event. */
21
32
  timerDuration?: string;
22
33
  /** Timer date (ISO 8601) — creates a timer start event. */
@@ -50,6 +61,10 @@ export interface StartEventOptions extends ElementOptions {
50
61
  }
51
62
  /** Options for creating a service task. */
52
63
  export interface ServiceTaskOptions {
64
+ /** Job-worker listeners on this element's lifecycle (`zeebe:executionListeners`). */
65
+ executionListeners?: ZeebeListener[];
66
+ /** Runs the activity once per item of a list. */
67
+ multiInstance?: MultiInstanceOptions;
53
68
  /** Display name (required for BPMN canvas visibility). */
54
69
  name: string;
55
70
  /** Zeebe job type for this task. */
@@ -78,6 +93,8 @@ export interface ServiceTaskOptions {
78
93
  agentDefinition?: {
79
94
  agentType: string;
80
95
  };
96
+ /** Resources the task runs, e.g. an RPA script (`zeebe:linkedResources`). */
97
+ linkedResources?: ZeebeLinkedResource[];
81
98
  /** Zeebe modeler template ID. */
82
99
  modelerTemplate?: string;
83
100
  /** Zeebe modeler template version. */
@@ -91,6 +108,10 @@ export interface ServiceTaskOptions {
91
108
  }
92
109
  /** Options for creating a script task. */
93
110
  export interface ScriptTaskOptions {
111
+ /** Job-worker listeners on this element's lifecycle (`zeebe:executionListeners`). */
112
+ executionListeners?: ZeebeListener[];
113
+ /** Runs the activity once per item of a list. */
114
+ multiInstance?: MultiInstanceOptions;
94
115
  /** Display name. */
95
116
  name?: string;
96
117
  /** FEEL expression for the script. */
@@ -104,10 +125,32 @@ export interface ScriptTaskOptions {
104
125
  }
105
126
  /** Options for creating a user task. */
106
127
  export interface UserTaskOptions {
128
+ /** Listeners on the user task's own lifecycle (`zeebe:taskListeners`); needs `zeebeUserTask`. */
129
+ taskListeners?: ZeebeListener[];
130
+ /** Job-worker listeners on this element's lifecycle (`zeebe:executionListeners`). */
131
+ executionListeners?: ZeebeListener[];
132
+ /** Runs the activity once per item of a list. */
133
+ multiInstance?: MultiInstanceOptions;
107
134
  /** Display name. */
108
135
  name?: string;
109
136
  /** Form key or form reference. */
110
137
  formId?: string;
138
+ /** Legacy form key (`zeebe:formDefinition formKey`), e.g. `camunda-forms:bpmn:<id>`. */
139
+ formKey?: string;
140
+ /** External form URL (`zeebe:formDefinition externalReference`); for a `zeebeUserTask`. */
141
+ externalReference?: string;
142
+ /** What `formId` resolves against; anything but `latest` needs Camunda 8.6+. */
143
+ formBindingType?: "latest" | "deployment" | "versionTag";
144
+ /** Version tag of the form; use with `formBindingType: "versionTag"`. */
145
+ formVersionTag?: string;
146
+ /**
147
+ * Embeds a Camunda Form: writes a process-level `zeebe:userTaskForm` holding `schema`
148
+ * (the form's JSON) and links it with `formKey="camunda-forms:bpmn:<id>"`.
149
+ */
150
+ embeddedForm?: {
151
+ id: string;
152
+ schema: string;
153
+ };
111
154
  /** Emit <zeebe:userTask /> to mark as a Camunda 8 native user task. */
112
155
  zeebeUserTask?: boolean;
113
156
  /** Input/output variable mappings. */
@@ -153,12 +196,44 @@ export interface UserTaskOptions {
153
196
  }
154
197
  /** Options for creating a call activity. */
155
198
  export interface CallActivityOptions {
199
+ /** Job-worker listeners on this element's lifecycle (`zeebe:executionListeners`). */
200
+ executionListeners?: ZeebeListener[];
201
+ /** Runs the activity once per item of a list. */
202
+ multiInstance?: MultiInstanceOptions;
156
203
  /** Display name. */
157
204
  name?: string;
158
205
  /** Process ID to call. */
159
206
  processId: string;
160
- /** Whether to propagate all child variables. */
207
+ /** Whether to propagate all child variables back to the parent on completion. */
161
208
  propagateAllChildVariables?: boolean;
209
+ /**
210
+ * Whether the child process receives all parent variables (default true in the engine).
211
+ * Set `false` to pass only `ioMapping` inputs; `false` needs Camunda 8.2+.
212
+ */
213
+ propagateAllParentVariables?: boolean;
214
+ /**
215
+ * How the called process version is resolved: the `latest` deployed version, the version
216
+ * deployed together with this process (`deployment`), or by `versionTag`. Needs Camunda 8.6+.
217
+ */
218
+ bindingType?: "latest" | "deployment" | "versionTag";
219
+ /** Version tag of the called process; only meaningful with `bindingType: "versionTag"`. */
220
+ versionTag?: string;
221
+ /** Input/output variable mappings between parent and child scope. */
222
+ ioMapping?: {
223
+ inputs?: Array<{
224
+ source: string;
225
+ target: string;
226
+ }>;
227
+ outputs?: Array<{
228
+ source: string;
229
+ target: string;
230
+ }>;
231
+ };
232
+ /** Zeebe property key-value pairs (`zeebe:properties`/`zeebe:property`). */
233
+ zeebeProperties?: Array<{
234
+ name: string;
235
+ value: string;
236
+ }>;
162
237
  /** Mark this activity as a compensation handler. */
163
238
  isForCompensation?: boolean;
164
239
  /** Free-text documentation (`<bpmn:documentation>`). */
@@ -166,6 +241,10 @@ export interface CallActivityOptions {
166
241
  }
167
242
  /** Options for creating a business rule task. */
168
243
  export interface BusinessRuleTaskOptions {
244
+ /** Job-worker listeners on this element's lifecycle (`zeebe:executionListeners`). */
245
+ executionListeners?: ZeebeListener[];
246
+ /** Runs the activity once per item of a list. */
247
+ multiInstance?: MultiInstanceOptions;
169
248
  /** Display name. */
170
249
  name?: string;
171
250
  /** Zeebe job type. */
@@ -240,6 +319,10 @@ export interface IntermediateCatchEventOptions extends ElementOptions {
240
319
  * connected from the current position.
241
320
  */
242
321
  linkName?: string;
322
+ /** FEEL condition — creates a conditional catch event (Camunda 8.9+). */
323
+ condition?: string;
324
+ /** Variable events that re-evaluate `condition` (`zeebe:conditionalFilter`); default is both. */
325
+ conditionVariableEvents?: ConditionVariableEvent[];
243
326
  }
244
327
  /** Options for an intermediate throw event. */
245
328
  export interface IntermediateThrowEventOptions extends ElementOptions {
@@ -297,12 +380,20 @@ export interface BoundaryEventOptions extends ElementOptions {
297
380
  signalName?: string;
298
381
  /** Creates a compensation boundary event. */
299
382
  compensation?: boolean;
383
+ /** FEEL condition — creates a conditional boundary event (Camunda 8.9+). */
384
+ condition?: string;
385
+ /** Variable events that re-evaluate `condition` (`zeebe:conditionalFilter`); default is both. */
386
+ conditionVariableEvents?: ConditionVariableEvent[];
300
387
  }
301
388
  /** Multi-instance loop configuration. */
302
389
  export interface MultiInstanceOptions {
303
390
  isSequential?: boolean;
304
391
  collection?: string;
305
392
  elementVariable?: string;
393
+ /** Variable that collects each instance's output element (`zeebe:loopCharacteristics`). */
394
+ outputCollection?: string;
395
+ /** FEEL expression evaluated per instance and appended to `outputCollection`. */
396
+ outputElement?: string;
306
397
  completionCondition?: string;
307
398
  }
308
399
  /** Options for sub-process elements. */
@@ -372,13 +463,20 @@ export interface AdHocSubProcessOptions extends ElementOptions {
372
463
  */
373
464
  toolGrid?: GridHint;
374
465
  }
466
+ /** Options for `dataObject()` / `dataObjectReference()`. */
467
+ export interface DataElementOptions {
468
+ name?: string;
469
+ /** Draws the collection (parallel-bars) marker. */
470
+ isCollection?: boolean;
471
+ }
375
472
  /** Options for `annotate()`. */
376
473
  export interface AnnotateOptions {
377
474
  /**
378
475
  * Which side of the element `withAutoLayout()` puts the annotation on,
379
- * instead of the side it would choose. Layout only; not written to the XML.
476
+ * instead of the side it would choose. `"left"` / `"right"` put it beside
477
+ * the element, preferably level with its centre. Layout only; not written to the XML.
380
478
  */
381
- side?: "above" | "below";
479
+ side?: "above" | "below" | "left" | "right";
382
480
  }
383
481
  /**
384
482
  * The root-level messages, errors, signals and escalations of one process.
@@ -461,6 +559,14 @@ export declare class BranchBuilder {
461
559
  get _lastNodeId(): string | undefined;
462
560
  /** @internal – Open ends of nested branches that have not yet been connected. */
463
561
  get _openBranchEnds(): string[];
562
+ /** Declares a data object. Link it to an activity via a `dataObjectReference()`. */
563
+ dataObject(id: string, options?: DataElementOptions): this;
564
+ /** Draws a reference to the data object `dataObjectRef`. */
565
+ dataObjectReference(id: string, dataObjectRef: string, options?: DataElementOptions): this;
566
+ /** Draws a reference to the data store `dataStoreRef`. */
567
+ dataStoreReference(id: string, dataStoreRef: string, options?: Pick<DataElementOptions, "name">): this;
568
+ /** Links an activity to a data reference: `input` reads it, `output` writes it. */
569
+ dataAssociation(activityId: string, dataRefId: string, direction: "input" | "output"): this;
464
570
  /** Attach a text annotation to the element at the current cursor position. */
465
571
  textAnnotation(text: string): this;
466
572
  /** Attach a text annotation to an element by explicit ID. */
@@ -593,6 +699,14 @@ export declare class SubProcessContentBuilder {
593
699
  inclusiveGateway(id: string, options?: GatewayOptions): this;
594
700
  eventBasedGateway(id: string, options?: ElementOptions): this;
595
701
  complexGateway(id: string, options?: GatewayOptions): this;
702
+ /** Declares a data object. Link it to an activity via a `dataObjectReference()`. */
703
+ dataObject(id: string, options?: DataElementOptions): this;
704
+ /** Draws a reference to the data object `dataObjectRef`. */
705
+ dataObjectReference(id: string, dataObjectRef: string, options?: DataElementOptions): this;
706
+ /** Draws a reference to the data store `dataStoreRef`. */
707
+ dataStoreReference(id: string, dataStoreRef: string, options?: Pick<DataElementOptions, "name">): this;
708
+ /** Links an activity to a data reference: `input` reads it, `output` writes it. */
709
+ dataAssociation(activityId: string, dataRefId: string, direction: "input" | "output"): this;
596
710
  /** Attach a text annotation to the element at the current cursor position. */
597
711
  textAnnotation(text: string): this;
598
712
  /** Attach a text annotation to an element by explicit ID. */
@@ -727,7 +841,7 @@ export declare class ProcessBuilder {
727
841
  private resolvePendingSplice;
728
842
  /** Enable auto-layout: `build()` will run the layout engine and populate diagram interchange data. */
729
843
  withAutoLayout(): this;
730
- /** Set the Camunda execution platform version stamped into the BPMN definitions. Defaults to `"8.9.0"`. */
844
+ /** Set the Camunda execution platform version stamped into the BPMN definitions. Defaults to `"8.10.0"`. */
731
845
  executionPlatformVersion(version: string): this;
732
846
  /** Set process-wide defaults applied to subsequently added elements. */
733
847
  defaults(options: {
@@ -906,6 +1020,14 @@ export declare class ProcessBuilder {
906
1020
  transaction(id: string, content: (b: SubProcessContentBuilder) => void, options?: SubProcessOptions): this;
907
1021
  /** Add an event sub-process. Triggered by its start event — no incoming or outgoing sequence flows. */
908
1022
  eventSubProcess(id: string, content: (b: SubProcessContentBuilder) => void, options?: ElementOptions): this;
1023
+ /** Declares a data object. Link it to an activity via a `dataObjectReference()`. */
1024
+ dataObject(id: string, options?: DataElementOptions): this;
1025
+ /** Draws a reference to the data object `dataObjectRef`. */
1026
+ dataObjectReference(id: string, dataObjectRef: string, options?: DataElementOptions): this;
1027
+ /** Draws a reference to the data store `dataStoreRef`. */
1028
+ dataStoreReference(id: string, dataStoreRef: string, options?: Pick<DataElementOptions, "name">): this;
1029
+ /** Links an activity to a data reference: `input` reads it, `output` writes it. */
1030
+ dataAssociation(activityId: string, dataRefId: string, direction: "input" | "output"): this;
909
1031
  /** Attach a text annotation to the element at the current cursor position. */
910
1032
  textAnnotation(text: string): this;
911
1033
  /** Attach a text annotation to any flow element by explicit ID. */
@@ -975,7 +1097,7 @@ export declare class DiagramBuilder {
975
1097
  private _collaborationId;
976
1098
  private _executionPlatformVersion;
977
1099
  constructor(id: string);
978
- /** Set the Camunda execution platform version stamped into the BPMN definitions. Defaults to `"8.9.0"`. */
1100
+ /** Set the Camunda execution platform version stamped into the BPMN definitions. Defaults to `"8.10.0"`. */
979
1101
  executionPlatformVersion(version: string): this;
980
1102
  process(id: string, callback: (b: ProcessBuilder) => void): this;
981
1103
  /** Renames the collaboration element. Defaults to `"Collaboration_1"`. */