@bpmnkit/core 1.14.0 → 1.15.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 +5 -4
- package/agent-cards/bpmn.md +86 -80
- package/builder-reference.md +26 -8
- package/dist/bpmn/auto-layout.js +61 -2
- package/dist/bpmn/bpmn-builder.d.ts +60 -12
- package/dist/bpmn/bpmn-builder.js +428 -30
- package/dist/bpmn/compact.d.ts +2 -0
- package/dist/bpmn/compact.js +10 -3
- package/dist/bpmn/make-room.d.ts +26 -0
- package/dist/bpmn/make-room.js +151 -0
- package/dist/bpmn/optimize/flow.js +8 -0
- package/dist/bpmn/place-new-shapes.d.ts +6 -1
- package/dist/bpmn/place-new-shapes.js +53 -2
- package/dist/bpmn/process-text.d.ts +7 -1
- package/dist/bpmn/process-text.js +60 -5
- package/dist/form/user-task-forms.d.ts +45 -0
- package/dist/form/user-task-forms.js +129 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +2 -0
- package/dist/layout/collaboration/message-labels.d.ts +25 -0
- package/dist/layout/collaboration/message-labels.js +108 -0
- package/dist/layout/collaboration/ordering.d.ts +5 -1
- package/dist/layout/collaboration/ordering.js +24 -9
- package/dist/layout/semantic/graph.js +3 -0
- package/dist/layout/semantic/place.js +49 -0
- package/llms.txt +1 -1
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @bpmnkit/core for agents
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Read this file and the one card for your task once (~2k tokens each; `casen agent-card <bpmn|dmn|form>` prints the same cards). The card is self-sufficient: do not read README.md (20 KB) and do not search `dist/*.d.ts`. BPMN: write a short spec with the Write tool and run one command, `casen build <spec> --deploy` (`@bpmnkit/cli`; `npx casen` if not on PATH); it writes the .bpmn and its forms, lints and deploys.
|
|
4
4
|
|
|
5
5
|
| You write | Read |
|
|
6
6
|
| --- | --- |
|
|
@@ -10,10 +10,11 @@ Do not read README.md (20 KB) or the .d.ts files first. Read the one card for yo
|
|
|
10
10
|
|
|
11
11
|
Rules that hold for all three:
|
|
12
12
|
|
|
13
|
-
-
|
|
14
|
-
- Edit an existing file
|
|
13
|
+
- New BPMN: a `casen build` text spec (one pool, or `## Pool` sections with lanes, message flows, data). DMN and forms: the builders (`Dmn`, `Form`). Never write a whole file by hand.
|
|
14
|
+
- Edit an existing BPMN file: an edit module, `casen build edit.mjs --edit order.bpmn` (layout kept). DMN/forms: the `export*Preserving` writers.
|
|
15
15
|
- `formId` and `decisionId` must equal the deployed form id and decision id exactly.
|
|
16
|
-
-
|
|
16
|
+
- One gate: `casen build` lints like c8ctl (bpmnlint + camunda-compat) and prints the rule's `.bpmnlintrc` key; a task-named command is the final word. Fix every error.
|
|
17
|
+
- Done = gate clean + deploy succeeds. Stop there and answer in one line: never hand-route DI or render images.
|
|
17
18
|
- Builder errors and check findings end with `agent-cards/<type>.md#traps`. Read that section.
|
|
18
19
|
|
|
19
20
|
The full API reference is `builder-reference.md` in this folder. Open it only when a card does not cover an option.
|
package/agent-cards/bpmn.md
CHANGED
|
@@ -1,94 +1,100 @@
|
|
|
1
1
|
# BPMN agent card
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
<!-- docspack: tags=agent-card,cheat-sheet,build-script,bpmn,process,create,write,script,builder -->
|
|
6
|
-
|
|
7
|
-
## Minimal BPMN build script: create, export, edit, validate
|
|
8
|
-
|
|
9
|
-
```ts
|
|
10
|
-
import { readFileSync, writeFileSync } from "node:fs"
|
|
11
|
-
import { Bpmn, exportPreserving, lintDiagram, placeNewShapes } from "@bpmnkit/core"
|
|
12
|
-
|
|
13
|
-
// 1. Create. The process id is the deploy key: same id = new version of that process.
|
|
14
|
-
const definitions = Bpmn.createProcess("order")
|
|
15
|
-
.name("Order")
|
|
16
|
-
.withAutoLayout()
|
|
17
|
-
.startEvent("received", { name: "Order received" })
|
|
18
|
-
.businessRuleTask("score", { name: "Score risk", decisionId: "risk", resultVariable: "risk" })
|
|
19
|
-
.exclusiveGateway("check", { name: "Risky?" })
|
|
20
|
-
.branch("yes", (b) =>
|
|
21
|
-
b
|
|
22
|
-
.condition('=risk = "high"')
|
|
23
|
-
.label("Yes")
|
|
24
|
-
.userTask("review", { name: "Review order", formId: "review-order", zeebeUserTask: true })
|
|
25
|
-
.connectTo("ship"),
|
|
26
|
-
)
|
|
27
|
-
.branch("no", (b) => b.defaultFlow().label("No").connectTo("ship"))
|
|
28
|
-
.serviceTask("ship", { name: "Ship order", taskType: "ship-order", retries: "3" })
|
|
29
|
-
.endEvent("done", { name: "Order shipped" })
|
|
30
|
-
.build()
|
|
31
|
-
|
|
32
|
-
// 2. Export.
|
|
33
|
-
writeFileSync("order.bpmn", Bpmn.export(definitions))
|
|
34
|
-
|
|
35
|
-
// 3. Edit an existing file: change the model, draw only the new elements, write with
|
|
36
|
-
// exportPreserving. Existing shapes keep their positions and the file its formatting.
|
|
37
|
-
const original = readFileSync("order.bpmn", "utf8")
|
|
38
|
-
const edited = Bpmn.continueProcess(Bpmn.parse(original), "order")
|
|
39
|
-
.insertAfter("ship")
|
|
40
|
-
.serviceTask("notify", { name: "Notify customer", taskType: "notify-customer" })
|
|
41
|
-
.build()
|
|
42
|
-
const ship = edited.processes[0]?.flowElements.find((e) => e.id === "ship")
|
|
43
|
-
if (ship) ship.name = "Ship parcel"
|
|
44
|
-
const { definitions: drawn, unplaced } = placeNewShapes(edited)
|
|
45
|
-
if (unplaced.length > 0) console.log("not drawn:", unplaced)
|
|
46
|
-
writeFileSync("order.bpmn", exportPreserving(original, drawn))
|
|
47
|
-
|
|
48
|
-
// 4. Validate: Camunda 8 deployability and modelling rules.
|
|
49
|
-
const report = lintDiagram(Bpmn.parse(readFileSync("order.bpmn", "utf8")))
|
|
50
|
-
for (const d of report.diagnostics.filter((d) => d.severity !== "info"))
|
|
51
|
-
console.log(`${d.severity} ${d.elementIds.join(",")}: ${d.message}`)
|
|
52
|
-
if (report.counts.error > 0) process.exit(1)
|
|
53
|
-
```
|
|
3
|
+
Self-sufficient (no `dist/*.d.ts` search). Do not plan in prose or read other docs: write the spec directly with the Write tool from the template that fits, run `casen build <spec>` once, fix what it reports.
|
|
54
4
|
|
|
55
|
-
`
|
|
5
|
+
`casen build` writes the laid-out `.bpmn` and a `.form` per user task, lints like c8ctl and, with `--deploy`, deploys them.
|
|
56
6
|
|
|
57
|
-
|
|
7
|
+
<!-- docspack: tags=agent-card,cheat-sheet,build,build-script,bpmn,process,create,write,script,builder,edit,casen-build,sub-process,annotation,conditional,text-spec,collaboration,pools,lanes,message-flow,data-object,form -->
|
|
58
8
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
- `scriptTask(id, { expression: "=a + b", resultVariable })`; `callActivity(id, { processId })`.
|
|
65
|
-
- Gateways: `.exclusiveGateway(id)` then `.branch(name, (b) => b.condition("=x > 1")...)`, one branch `b.defaultFlow()`; `.label(text)` sets the flow label. Merge with `.connectTo(id)` and declare that id after the last branch.
|
|
66
|
-
- Events take named options: `timerDuration: "PT1H"`, `messageName` + `correlationKey`, `errorCode`, `signalName`. `.withBoundary(id, { errorCode }, (b) => ...)` hangs a boundary on the previous task.
|
|
67
|
-
- `multiInstance: { collection: "=items", elementVariable: "item" }` on any task.
|
|
68
|
-
- Full method list: `packages/core/builder-reference.md` in `@bpmnkit/core`, or `npx bpmnkit-docs ask "<option>"`.
|
|
9
|
+
| Task | Write | Run |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
| New process, one pool | `order.txt` (template 1) | `casen build order.txt --deploy` |
|
|
12
|
+
| Pools, lanes, message flows, data | `shop.txt` (template 2) | `casen build shop.txt --deploy` |
|
|
13
|
+
| Change an existing `.bpmn` | `edit.mjs` (template 3) | `casen build edit.mjs --edit order.bpmn --deploy` |
|
|
69
14
|
|
|
70
|
-
|
|
15
|
+
- Success is one line: `✓ order.bpmn + 2 forms (…) · lint clean · process order, tasks 4, gateways 2, forms 2 · Camunda 8.10.0`. It is the proof: do not inspect the XML. Otherwise one `✖` line per problem: fix the spec, run again.
|
|
16
|
+
- After ✓: run the task's gate commands as given (one per Bash call), deploy the `.bpmn` plus the listed `.form` files, answer in one line. The layout is final: never move DI by hand or render images.
|
|
17
|
+
- Write files with the Write tool, not heredocs. `-o out.bpmn` sets the output. `.dmn`/`.form` files after the spec are linted and deployed with it.
|
|
18
|
+
- `--deploy` goes to `ZEEBE_REST_ADDRESS` (+ the `CAMUNDA_*` client variables), else the casen profile, else local Reebe. No `casen` on PATH? `npm i -D @bpmnkit/cli`, then `npx casen …`.
|
|
71
19
|
|
|
72
|
-
|
|
73
|
-
- **User tasks default to job-worker tasks**, which 8.10 deprecates. Pass `zeebeUserTask: true` for a Camunda user task.
|
|
74
|
-
- **Deploy ids.** The engine keys a process by its process id (`createProcess("order")`), a decision by its `<decision id>`, a form by its JSON `id`. File names and display names do not count. `formId` and `decisionId` must equal those ids exactly; by default they bind to the latest deployed version, so deploy the `.dmn` and `.form` before an instance reaches the task. Redeploying the same id makes a new version.
|
|
75
|
-
- **Reference a DMN decision by its decision id**, not the DMN `definitions` id, the file name or the decision name.
|
|
76
|
-
- **Edit with the preserving writer.** For an existing file, `Bpmn.parse` it (or `Bpmn.continueProcess(parsed, processId)`), change the model, run `placeNewShapes(edited)` so the new elements get shapes next to what they connect to, and write `exportPreserving(original, drawn)`. Existing shapes stay put; a pool, lane or sub-process only grows when the new shapes do not fit. Rebuilding with `withAutoLayout()`, `applyAutoLayout`, or `Bpmn.export` alone moves every shape and reformats the diff. `placeNewShapes` does not draw new lanes; it lists them in `unplaced`.
|
|
77
|
-
- FEEL in the builder starts with `=` (`"=amount > 1000"`); a value without `=` is a literal string.
|
|
78
|
-
- Unknown option names are silently dropped: `timer: { duration }` does nothing; use `timerDuration`.
|
|
20
|
+
## 1. One pool
|
|
79
21
|
|
|
80
|
-
|
|
22
|
+
```text
|
|
23
|
+
# Expense approval | id=expense
|
|
24
|
+
[start Expense submitted] > [user Review expense] > [xor Approved?]
|
|
25
|
+
Approved? >(Yes: approved = true) [service Pay expense] > [end Expense paid]
|
|
26
|
+
Approved? >(No: default) [user Rework expense] > Review expense
|
|
27
|
+
[boundary:error Payment failed | on=payExpense error=PAY_FAILED] > [send Notify submitter] > [end Submitter notified]
|
|
28
|
+
```
|
|
81
29
|
|
|
82
|
-
|
|
30
|
+
- `# Name | id=<process id>`: the process id is the deploy key. `camunda=8.8` for an older cluster (default 8.10).
|
|
31
|
+
- `a > b > c` is a path. Declare a node once: `[kind Name | attrs]`; its id is the name in camelCase (`[user Review expense]` is `reviewExpense`), or write `id[kind Name]`. Later write its id or its exact name. A path that stops gets an end event.
|
|
32
|
+
- Kinds: `start end task user service rule send receive script manual call sub xor and or eventgw catch throw boundary adhoc`. Triggers: `<event kind>:message|timer|condition|error|signal|escalation|terminate`, e.g. `start:timer`, `boundary:error`, `end:message`.
|
|
33
|
+
- Decision: `gw >(Label: FEEL condition) x` per branch, exactly one `gw >(Label: default) y`. Branches that meet are joined for you; parallel work: `and` split, `and` join.
|
|
34
|
+
- Forms: a user task without `fields=` gets a field per variable the next decisions read (`approved = true` → checkbox, `amount > 1000` → number, `risk = "low"` → select). `fields=key[:number|checkbox|textarea|date|select(a|b)],…` sets them; `form=<id>` links your own.
|
|
35
|
+
- Defaults: `job=` (service, send, message end) is the id kebab-cased (`pay-expense`); `msg=` is the name kebab-cased. Other attributes: `key=<FEEL>` (every message caught after the start) · `after=PT1H`, `every=R/PT1H`, `at=2026-01-31T09:00:00Z` (a timer start takes only a literal date; `catch:timer at==<FEEL>` a variable) · `cond=<FEEL>` (last) · `error=`, `signal=`, `escalation=` · `on=<task id>`, `nonint` (boundary) · `result=<var>` · `called=<process id>` · `each=<list var>` · `in.x=`, `out.x=` · `feel=<FEEL>` (script, last) · `retries=3`, `header.k=v` · `assignee=` `groups=a;b` `users=` `due=P2D` `priority=0-100`.
|
|
36
|
+
- A rule task calls `decision=<id>`, default its name kebab-cased (`[rule Assess risk]` calls `assess-risk`). Pass the `.dmn` too: `casen build order.txt risk.dmn --deploy`.
|
|
37
|
+
|
|
38
|
+
## 2. Pools, lanes, message flows, data
|
|
39
|
+
|
|
40
|
+
```text
|
|
41
|
+
# Order fulfilment
|
|
42
|
+
[annotation Orders ship within two days]
|
|
43
|
+
## Shop | id=shop
|
|
44
|
+
### Sales
|
|
45
|
+
[start:message Order placed] > [service Check stock] > [send Request payment]
|
|
46
|
+
Request payment > [catch Payment received | key=orderId] > [sub Pack order]
|
|
47
|
+
Pack order {
|
|
48
|
+
[start Packing started] > [user Pick item | each=items] > [user Box items] > [end Packed]
|
|
49
|
+
}
|
|
50
|
+
### Warehouse
|
|
51
|
+
Pack order > [user Ship order] > [end Order shipped]
|
|
52
|
+
Check stock ..> [store Stock DB]
|
|
53
|
+
Ship order ..> [object Packing slip]
|
|
54
|
+
[annotation Fragile items get extra padding] ..> Pack order
|
|
55
|
+
## Restock | id=restock
|
|
56
|
+
[start:condition Stock low | cond=stock < 10] > [service Reorder stock] > [end Stock reordered]
|
|
57
|
+
## Bank | blackbox
|
|
58
|
+
## Customer | blackbox
|
|
59
|
+
Customer ~> Order placed: Order
|
|
60
|
+
Request payment ~> Bank: Payment request
|
|
61
|
+
Bank ~> Payment received: Payment confirmed
|
|
62
|
+
```
|
|
83
63
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
64
|
+
- `## Name | id=<process id>` starts a pool with its own process; `## Name | blackbox` a partner pool (id: `id=` or the name kebab-cased).
|
|
65
|
+
- `### Lane`: nodes declared after it go in that lane; repeat a header to switch back.
|
|
66
|
+
- `a ~> b: label` is a message flow between nodes or pools (ids or names) of different pools. A plain `start` it reaches becomes a message start. A same-name `store` in several pools is one data store.
|
|
67
|
+
- `[object Name] ..> task`: the task reads it; `task ..> [store Name]`: it writes it. `objects` marks a collection.
|
|
68
|
+
- `[sub Name]`, then `Name {`, its paths (own start and end), `}`: an expanded sub-process. Bodies nest.
|
|
69
|
+
- `[annotation Text]`: on the collaboration before the first `##`; `[annotation Text] ..> task` links it. Ids are global across pools.
|
|
70
|
+
|
|
71
|
+
## 3. Edit an existing file
|
|
72
|
+
|
|
73
|
+
```js
|
|
74
|
+
// Insert a step after "reviewExpense" with an error path that loops back to it.
|
|
75
|
+
export default (kit, model) =>
|
|
76
|
+
kit.Bpmn.continueProcess(model, "expense")
|
|
77
|
+
.insertAfter("reviewExpense")
|
|
78
|
+
.serviceTask("validate", { name: "Validate receipt", taskType: "validate-receipt" })
|
|
79
|
+
.withBoundary("invalid", { name: "Receipt invalid", errorCode: "INVALID" }, (b) =>
|
|
80
|
+
b.userTask("fix", { name: "Fix receipt" }).connectTo("validate"),
|
|
81
|
+
)
|
|
88
82
|
```
|
|
89
83
|
|
|
90
|
-
|
|
84
|
+
`--edit order.bpmn` rewrites it in place: existing shapes and forms stay, shapes right of the insertion move only as needed, new user tasks get forms. `--camunda 8.10` sets `executionPlatformVersion`. `kit` is `@bpmnkit/core`, `model` the parsed file.
|
|
91
85
|
|
|
92
|
-
|
|
86
|
+
- `continueProcess(model, processId)`: `.insertAfter(id)` splices in after `id`; `.at(id)` continues from a node without outgoing flow.
|
|
87
|
+
- Steps: `serviceTask(id, { name, taskType })` · `userTask(id, { name, formId, assignee, candidateGroups })` · `intermediateCatchEvent(id, { name, messageName, correlationKey: "=orderId" })` or `{ timerDuration: "PT1H" }` · `endEvent(id, { name })` · `.connectTo(id)`.
|
|
88
|
+
- Decision: `.exclusiveGateway(id, { name }).branch("yes", (b) => b.condition("=x > 1").label("Yes")…).branch("no", (b) => b.defaultFlow().label("No")…)`. Boundary: `.withBoundary(id, { errorCode } | { timerDuration } | { messageName, correlationKey }, (b) => …)`.
|
|
89
|
+
- One attribute: change `model` and return it. Builder FEEL starts with `=`; text-spec conditions do not.
|
|
90
|
+
|
|
91
|
+
## Not in the text spec
|
|
92
|
+
|
|
93
|
+
Event sub-processes, transactions, compensation, groups, nested lanes: write `flow.mjs`, `export default (kit) => kit.Bpmn.createProcess("id")…` (pools: `createDiagram`; `.eventSubProcess(id, (b) => …)`, `.transaction(…)`), run `casen build flow.mjs`.
|
|
94
|
+
|
|
95
|
+
## Traps
|
|
93
96
|
|
|
94
|
-
A
|
|
97
|
+
- A finding reads `✖ order.bpmn pay: <message> [<rule id>, .bpmnlintrc "<key>"]`: the key is c8ctl's rule name. Fix the model; do not silence rules unless the task says so.
|
|
98
|
+
- `formId` and decision ids must equal the deployed form's and decision's ids. Generated forms already do; a hand-written `.form` next to the output is used instead.
|
|
99
|
+
- A message caught after the start needs `key=`; a message start does not. An `eventgw` is followed only by catch events.
|
|
100
|
+
- `casen build` refuses what Camunda 8 cannot deploy, one line per problem, `- <id>: <message> (zeebe/<rule>)`, and writes nothing.
|
package/builder-reference.md
CHANGED
|
@@ -71,6 +71,7 @@ Other:
|
|
|
71
71
|
- dataObjectReference(id: string, dataObjectRef: string, options?: DataElementOptions)
|
|
72
72
|
- dataStoreReference(id: string, dataStoreRef: string, options?: Pick<DataElementOptions, "name">)
|
|
73
73
|
- dataAssociation(activityId: string, dataRefId: string, direction: "input" | "output")
|
|
74
|
+
- inLane(id: string, options?: LaneOptions)
|
|
74
75
|
|
|
75
76
|
Only inside `.branch()` callbacks (BranchBuilder), applied to the flow leaving the gateway:
|
|
76
77
|
- condition(expression: string)
|
|
@@ -84,29 +85,46 @@ Not available inside callbacks (top-level only): at, insertAfter, withAutoLayout
|
|
|
84
85
|
|
|
85
86
|
`+El` = also accepts the ElementOptions fields; `+X` = also accepts X's fields.
|
|
86
87
|
|
|
87
|
-
- ElementOptions: name?: string; documentation?: string (Free-text documentation…)
|
|
88
|
+
- ElementOptions: name?: string; lane?: string (Lane of this node only,…); documentation?: string (Free-text documentation…)
|
|
88
89
|
- StartEventOptions +El: condition?: string (FEEL condition); timerDuration?: string (Timer duration (ISO 8601)); timerDate?: string (Timer date (ISO 8601)); timerCycle?: string (Timer cycle (ISO 8601)); messageName?: string (Message name); correlationKey?: string (FEEL expression correlating the…); formId?: string (Form to show when the process is…); isInterrupting?: boolean (Non-interrupting flag)
|
|
89
|
-
- EndEventOptions +El: errorCode?: string (Error code); messageName?: string; signalName?: string (Signal name); escalationCode?: string (Escalation code); taskType?: string (Job type of the worker that…)
|
|
90
|
-
- IntermediateThrowEventOptions +El: messageName?: string; signalName?: string; escalationCode?: string; compensation?: boolean (Emit a compensateEventDefinition); linkName?: string (Link name); taskType?: string
|
|
90
|
+
- EndEventOptions +El: errorCode?: string (Error code); messageName?: string; correlationKey?: string; signalName?: string (Signal name); escalationCode?: string (Escalation code); taskType?: string (Job type of the worker that…)
|
|
91
|
+
- IntermediateThrowEventOptions +El: messageName?: string; correlationKey?: string; signalName?: string; escalationCode?: string; compensation?: boolean (Emit a compensateEventDefinition); linkName?: string (Link name); taskType?: string
|
|
91
92
|
- IntermediateCatchEventOptions +El: timerDuration?: string; timerDate?: string; timerCycle?: string; messageName?: string; correlationKey?: string; signalName?: string; linkName?: string; condition?: string
|
|
92
93
|
- BoundaryEventOptions +El: attachedTo: string (ID of the activity this boundary…); cancelActivity?: boolean (Whether the host activity is…); errorCode?: string; timerDuration?: string; timerDate?: string; timerCycle?: string; messageName?: string; correlationKey?: string; signalName?: string; compensation?: boolean; condition?: string
|
|
93
|
-
- ServiceTaskOptions: multiInstance?: MultiInstanceOptions (Runs the activity once per item…); name: string; taskType: string; retries?: string (Number of retries…); ioMapping?: ioMapping shape (Input/output variable mappings); taskHeaders?: Record<string, string> (Task header key-value pairs); linkedResources?: ZeebeLinkedResource[] (Resources the task runs, e.g. an…); documentation?: string
|
|
94
|
+
- ServiceTaskOptions: lane?: string; multiInstance?: MultiInstanceOptions (Runs the activity once per item…); name: string; taskType: string; retries?: string (Number of retries…); ioMapping?: ioMapping shape (Input/output variable mappings); taskHeaders?: Record<string, string> (Task header key-value pairs); linkedResources?: ZeebeLinkedResource[] (Resources the task runs, e.g. an…); documentation?: string
|
|
94
95
|
- MultiInstanceOptions: isSequential?: boolean; collection?: string; elementVariable?: string; outputCollection?: string (Variable that collects each…); outputElement?: string (FEEL expression evaluated per…); completionCondition?: string
|
|
95
96
|
- RestConnectorConfig: name?: string; method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" (HTTP method…); url: string (Target URL); authentication?: {type: "noAuth"} | {type: "bearer"; token: string} (Authentication configuration); headers?: Record<string, string> | string (HTTP headers as key-value pairs…); body?: string (Request body); retries?: string; resultVariable?: string (Variable name to store the full…); resultExpression?: string (FEEL expression to extract values…)
|
|
96
|
-
- ScriptTaskOptions: multiInstance?: MultiInstanceOptions; name?: string; expression: string (FEEL expression for the script); resultVariable: string; documentation?: string
|
|
97
|
-
- UserTaskOptions: multiInstance?: MultiInstanceOptions; name?: string; formId?: string; externalReference?: string (External form URL…); embeddedForm?: {id: string; schema: string} (Embeds a Camunda Form: writes a…); ioMapping?: ioMapping shape; taskHeaders?: Record<string, string>; documentation?: string; assignee?: string (Static assignee…); candidateGroups?: string (Candidate groups, comma-separated…); candidateUsers?: string (Candidate users, comma-separated…); dueDate?: string (Due date); followUpDate?: string (Follow-up date); priority?: number (Task priority 0-100, default 50…)
|
|
97
|
+
- ScriptTaskOptions: lane?: string; multiInstance?: MultiInstanceOptions; name?: string; expression: string (FEEL expression for the script); resultVariable: string; documentation?: string
|
|
98
|
+
- UserTaskOptions: lane?: string; multiInstance?: MultiInstanceOptions; name?: string; formId?: string; externalReference?: string (External form URL…); embeddedForm?: {id: string; schema: string} (Embeds a Camunda Form: writes a…); ioMapping?: ioMapping shape; taskHeaders?: Record<string, string>; documentation?: string; assignee?: string (Static assignee…); candidateGroups?: string (Candidate groups, comma-separated…); candidateUsers?: string (Candidate users, comma-separated…); dueDate?: string (Due date); followUpDate?: string (Follow-up date); priority?: number (Task priority 0-100, default 50…)
|
|
98
99
|
- SendTaskOptions +MessageTaskOptions: taskType?: string
|
|
99
100
|
- MessageTaskOptions +El: multiInstance?: MultiInstanceOptions; messageName?: string; correlationKey?: string
|
|
100
|
-
- BusinessRuleTaskOptions: multiInstance?: MultiInstanceOptions; name?: string; taskType?: string; decisionId?: string (DMN decision ID to evaluate); resultVariable?: string; documentation?: string
|
|
101
|
-
- CallActivityOptions: multiInstance?: MultiInstanceOptions; name?: string; processId: string (Process ID to call); propagateAllChildVariables?: boolean (Whether to propagate all child…); propagateAllParentVariables?: boolean (Whether the child process…); bindingType?: "latest" | "deployment" | "versionTag" (How the called process version is…); versionTag?: string (Version tag of the called…); ioMapping?: ioMapping shape; documentation?: string
|
|
101
|
+
- BusinessRuleTaskOptions: lane?: string; multiInstance?: MultiInstanceOptions; name?: string; taskType?: string; decisionId?: string (DMN decision ID to evaluate); resultVariable?: string; documentation?: string
|
|
102
|
+
- CallActivityOptions: lane?: string; multiInstance?: MultiInstanceOptions; name?: string; processId: string (Process ID to call); propagateAllChildVariables?: boolean (Whether to propagate all child…); propagateAllParentVariables?: boolean (Whether the child process…); bindingType?: "latest" | "deployment" | "versionTag" (How the called process version is…); versionTag?: string (Version tag of the called…); ioMapping?: ioMapping shape; documentation?: string
|
|
102
103
|
- GatewayOptions +El: defaultFlow?: string (ID of the default sequence flow…)
|
|
103
104
|
- AdHocSubProcessOptions +El: activeElementsCollection?: string (FEEL expression for determining…); outputCollection?: string; outputElement?: string; taskDefinition?: {type: string; retries?: string} (Zeebe task definition…); ioMapping?: ioMapping shape; taskHeaders?: Record<string, string>; multiInstance?: MultiInstanceOptions; completionCondition?: string
|
|
104
105
|
- SubProcessOptions +El: multiInstance?: MultiInstanceOptions
|
|
105
106
|
- DataElementOptions: name?: string; isCollection?: boolean (Draws the collection…)
|
|
106
107
|
- AnnotateOptions: side?: "above" | "below" | "left" | "right" (Which side of the element…)
|
|
107
108
|
- BuildOptions: validate?: boolean (Refuse a Camunda 8 model Zeebe…); explicitJoins?: boolean (Refuse to infer join gateways, so…)
|
|
109
|
+
- LaneOptions: name?: string
|
|
108
110
|
- ioMapping shape = {inputs?: Array<{source: string; target: string}>; outputs?: Array<{source: string; target: string}>}
|
|
109
111
|
|
|
112
|
+
## DiagramBuilder (pools, message flows)
|
|
113
|
+
|
|
114
|
+
`Bpmn.createDiagram(id?)`: several processes in one file. `.build()` returns definitions; draw shapes with `applyAutoLayout(defs)` before `Bpmn.export`. Omit `processId` on `participant` for a black-box pool. No lane API yet.
|
|
115
|
+
|
|
116
|
+
- executionPlatformVersion(version: string)
|
|
117
|
+
- process(id: string, callback: (b: ProcessBuilder) => void)
|
|
118
|
+
- collaborationId(id: string)
|
|
119
|
+
- participant(id: string, options: ParticipantOptions)
|
|
120
|
+
- message(id: string, options: DiagramMessageOptions)
|
|
121
|
+
- messageFlow(id: string, options: MessageFlowOptions)
|
|
122
|
+
- build(options?: BuildGateOptions)
|
|
123
|
+
|
|
124
|
+
- ParticipantOptions: name?: string (Pool label); processId?: string (Id of the process this pool…)
|
|
125
|
+
- DiagramMessageOptions: name?: string; correlationKey?: string (FEEL expression Camunda 8…)
|
|
126
|
+
- MessageFlowOptions: source: string (Id of the participant, or of a…); target: string (Id of the participant, or of a…); name?: string; messageRef?: string (Id of a message declared with…)
|
|
127
|
+
|
|
110
128
|
## Examples
|
|
111
129
|
|
|
112
130
|
```typescript
|
package/dist/bpmn/auto-layout.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { associationWaypoints, packAnnotations } from "../layout/annotations.js";
|
|
2
2
|
import { alignPools } from "../layout/collaboration/alignment.js";
|
|
3
|
+
import { placeMessageFlowLabels } from "../layout/collaboration/message-labels.js";
|
|
3
4
|
import { orderPools } from "../layout/collaboration/ordering.js";
|
|
4
5
|
import { collapseCollinear } from "../layout/grid/grid-router.js";
|
|
5
6
|
import { layoutProcess } from "../layout/layout-engine.js";
|
|
@@ -7,6 +8,37 @@ import { repairRoutes } from "../layout/repair.js";
|
|
|
7
8
|
const POOL_HEADER = 30;
|
|
8
9
|
const LANE_HEADER = 30;
|
|
9
10
|
const PADDING = 20;
|
|
11
|
+
/**
|
|
12
|
+
* Lane bands grown to hold the annotations the packer put above or below them:
|
|
13
|
+
* the pool takes the bands' height, so an annotation outside them would hang
|
|
14
|
+
* over the pool's edge. The outermost band on that side grows.
|
|
15
|
+
*/
|
|
16
|
+
function stretchBands(bands, annotations) {
|
|
17
|
+
const out = bands.map((b) => ({ ...b, bounds: { ...b.bounds } }));
|
|
18
|
+
if (out.length === 0)
|
|
19
|
+
return out;
|
|
20
|
+
let top = Math.min(...out.map((b) => b.bounds.y));
|
|
21
|
+
let bottom = Math.max(...out.map((b) => b.bounds.y + b.bounds.height));
|
|
22
|
+
for (const a of annotations) {
|
|
23
|
+
const high = a.y - PADDING;
|
|
24
|
+
const low = a.y + a.height + PADDING;
|
|
25
|
+
if (low > bottom) {
|
|
26
|
+
for (const b of out)
|
|
27
|
+
if (b.bounds.y + b.bounds.height === bottom)
|
|
28
|
+
b.bounds.height += low - bottom;
|
|
29
|
+
bottom = low;
|
|
30
|
+
}
|
|
31
|
+
if (high < top) {
|
|
32
|
+
for (const b of out)
|
|
33
|
+
if (b.bounds.y === top) {
|
|
34
|
+
b.bounds.height += top - high;
|
|
35
|
+
b.bounds.y = high;
|
|
36
|
+
}
|
|
37
|
+
top = high;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return out;
|
|
41
|
+
}
|
|
10
42
|
const POOL_GAP = 30;
|
|
11
43
|
function contentBbox(nodes, extra) {
|
|
12
44
|
let minX = Number.POSITIVE_INFINITY;
|
|
@@ -168,6 +200,18 @@ function buildLaneShapes(lanes, nodes, dx, dy, poolY, poolHeaderWidth, laneConte
|
|
|
168
200
|
return shape;
|
|
169
201
|
});
|
|
170
202
|
}
|
|
203
|
+
/** Data associations drawn as association edges; only those with an id can have a DI edge. */
|
|
204
|
+
function dataAssociations(el, out) {
|
|
205
|
+
for (const a of el.dataInputAssociations ?? []) {
|
|
206
|
+
const source = a.sourceRefs[0];
|
|
207
|
+
if (a.id !== undefined && source !== undefined)
|
|
208
|
+
out.push({ id: a.id, sourceRef: source, targetRef: el.id, unknownAttributes: {} });
|
|
209
|
+
}
|
|
210
|
+
for (const a of el.dataOutputAssociations ?? []) {
|
|
211
|
+
if (a.id !== undefined && a.targetRef !== undefined)
|
|
212
|
+
out.push({ id: a.id, sourceRef: el.id, targetRef: a.targetRef, unknownAttributes: {} });
|
|
213
|
+
}
|
|
214
|
+
}
|
|
171
215
|
/**
|
|
172
216
|
* A view of `process` whose annotations and associations include those declared
|
|
173
217
|
* inside (nested) sub-processes. The builder stores them on the sub-process
|
|
@@ -180,6 +224,7 @@ function withNestedAnnotations(process) {
|
|
|
180
224
|
const walk = (elements) => {
|
|
181
225
|
for (const el of elements) {
|
|
182
226
|
const scope = el;
|
|
227
|
+
dataAssociations(el, associations);
|
|
183
228
|
if (scope.textAnnotations)
|
|
184
229
|
textAnnotations.push(...scope.textAnnotations);
|
|
185
230
|
if (scope.associations)
|
|
@@ -697,7 +742,7 @@ export function applyAutoLayout(defs, engine = "semantic", hints) {
|
|
|
697
742
|
}
|
|
698
743
|
}
|
|
699
744
|
const depths = depthIndex(layoutOf.values());
|
|
700
|
-
const order = orderPools(participantPools.length, poolLinks(collab, poolOwners(defs, collab), (id) => depths.get(id)));
|
|
745
|
+
const order = orderPools(participantPools.length, poolLinks(collab, poolOwners(defs, collab), (id) => depths.get(id)), new Set(participantPools.flatMap((pool, i) => (pool.process ? [] : [i]))));
|
|
701
746
|
for (const index of order) {
|
|
702
747
|
const pool = participantPools[index];
|
|
703
748
|
if (pool)
|
|
@@ -775,7 +820,7 @@ export function applyAutoLayout(defs, engine = "semantic", hints) {
|
|
|
775
820
|
// Engine lane bands already stack the content vertically, so the pool
|
|
776
821
|
// aligns to the band space rather than to the content bounding box —
|
|
777
822
|
// otherwise the shapes drift out of the lanes drawn around them.
|
|
778
|
-
const laneBands = hasLanes ? engineLanes : undefined;
|
|
823
|
+
const laneBands = hasLanes && engineLanes ? stretchBands(engineLanes, annBounds.values()) : undefined;
|
|
779
824
|
// Bands arrive outermost first and nested lanes overlap their parent, so the
|
|
780
825
|
// pool spans their extent rather than the first band or the sum of heights.
|
|
781
826
|
const bandTop = laneBands ? Math.min(...laneBands.map((lane) => lane.bounds.y)) : 0;
|
|
@@ -939,6 +984,20 @@ export function applyAutoLayout(defs, engine = "semantic", hints) {
|
|
|
939
984
|
}
|
|
940
985
|
const repair = routeRepair(defs);
|
|
941
986
|
repair(allShapes, allEdges);
|
|
987
|
+
if (collab && collab.messageFlows.length > 0) {
|
|
988
|
+
const pools = new Set(collab.participants.map((p) => p.id));
|
|
989
|
+
placeMessageFlowLabels({
|
|
990
|
+
shapes: allShapes,
|
|
991
|
+
edges: allEdges,
|
|
992
|
+
names: new Map(collab.messageFlows.flatMap((f) => f.name?.trim() ? [[f.id, f.name.trim()]] : [])),
|
|
993
|
+
containers: new Set([
|
|
994
|
+
...pools,
|
|
995
|
+
...defs.processes.flatMap((p) => (p.laneSet?.lanes ?? []).map((lane) => lane.id)),
|
|
996
|
+
...allShapes.filter((s) => s.isExpanded === true).map((s) => s.bpmnElement),
|
|
997
|
+
]),
|
|
998
|
+
pools,
|
|
999
|
+
});
|
|
1000
|
+
}
|
|
942
1001
|
for (const plane of rootPlanes)
|
|
943
1002
|
repair(plane.shapes, plane.edges);
|
|
944
1003
|
const planeBpmnElement = collab?.id ?? defs.processes[0]?.id ?? "plane";
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import type { GridHint, LayoutHints } from "../layout/types.js";
|
|
2
|
-
import type { BpmnAssociation, BpmnDefinitions, BpmnError, BpmnEscalation, BpmnFlowElement, BpmnMessage, BpmnSequenceFlow, BpmnSignal, BpmnTextAnnotation } from "./bpmn-model.js";
|
|
2
|
+
import type { BpmnAssociation, BpmnDefinitions, BpmnError, BpmnEscalation, BpmnFlowElement, BpmnLaneSet, BpmnMessage, BpmnSequenceFlow, BpmnSignal, BpmnTextAnnotation } from "./bpmn-model.js";
|
|
3
3
|
import type { RestConnectorConfig } from "./rest-connector.js";
|
|
4
4
|
import { type ZeebeLinkedResource, type ZeebeListener } from "./zeebe-extensions.js";
|
|
5
|
+
/** Options for {@link ProcessBuilder.inLane}. */
|
|
6
|
+
export interface LaneOptions {
|
|
7
|
+
/** Label shown on the lane; defaults to its id. */
|
|
8
|
+
name?: string;
|
|
9
|
+
}
|
|
5
10
|
/** Options shared by all element methods. */
|
|
6
11
|
export interface ElementOptions {
|
|
7
12
|
name?: string;
|
|
13
|
+
/** Lane of this node only, overriding the one `inLane()` set; declared on first use. */
|
|
14
|
+
lane?: string;
|
|
8
15
|
isForCompensation?: boolean;
|
|
9
16
|
/** Free-text documentation (`<bpmn:documentation>`). Used by the AI Agent connector as a tool description. */
|
|
10
17
|
documentation?: string;
|
|
@@ -75,6 +82,8 @@ export interface StartEventOptions extends ElementOptions {
|
|
|
75
82
|
}
|
|
76
83
|
/** Options for creating a service task. */
|
|
77
84
|
export interface ServiceTaskOptions {
|
|
85
|
+
/** Lane of this node only, overriding the one `inLane()` set; declared on first use. */
|
|
86
|
+
lane?: string;
|
|
78
87
|
/** Job-worker listeners on this element's lifecycle (`zeebe:executionListeners`). */
|
|
79
88
|
executionListeners?: ZeebeListener[];
|
|
80
89
|
/** Runs the activity once per item of a list. */
|
|
@@ -122,6 +131,8 @@ export interface ServiceTaskOptions {
|
|
|
122
131
|
}
|
|
123
132
|
/** Options for creating a script task. */
|
|
124
133
|
export interface ScriptTaskOptions {
|
|
134
|
+
/** Lane of this node only, overriding the one `inLane()` set; declared on first use. */
|
|
135
|
+
lane?: string;
|
|
125
136
|
/** Job-worker listeners on this element's lifecycle (`zeebe:executionListeners`). */
|
|
126
137
|
executionListeners?: ZeebeListener[];
|
|
127
138
|
/** Runs the activity once per item of a list. */
|
|
@@ -139,6 +150,8 @@ export interface ScriptTaskOptions {
|
|
|
139
150
|
}
|
|
140
151
|
/** Options for creating a user task. */
|
|
141
152
|
export interface UserTaskOptions {
|
|
153
|
+
/** Lane of this node only, overriding the one `inLane()` set; declared on first use. */
|
|
154
|
+
lane?: string;
|
|
142
155
|
/** Listeners on the user task's own lifecycle (`zeebe:taskListeners`); needs `zeebeUserTask`. */
|
|
143
156
|
taskListeners?: ZeebeListener[];
|
|
144
157
|
/** Job-worker listeners on this element's lifecycle (`zeebe:executionListeners`). */
|
|
@@ -210,6 +223,8 @@ export interface UserTaskOptions {
|
|
|
210
223
|
}
|
|
211
224
|
/** Options for creating a call activity. */
|
|
212
225
|
export interface CallActivityOptions {
|
|
226
|
+
/** Lane of this node only, overriding the one `inLane()` set; declared on first use. */
|
|
227
|
+
lane?: string;
|
|
213
228
|
/** Job-worker listeners on this element's lifecycle (`zeebe:executionListeners`). */
|
|
214
229
|
executionListeners?: ZeebeListener[];
|
|
215
230
|
/** Runs the activity once per item of a list. */
|
|
@@ -255,6 +270,8 @@ export interface CallActivityOptions {
|
|
|
255
270
|
}
|
|
256
271
|
/** Options for creating a business rule task. */
|
|
257
272
|
export interface BusinessRuleTaskOptions {
|
|
273
|
+
/** Lane of this node only, overriding the one `inLane()` set; declared on first use. */
|
|
274
|
+
lane?: string;
|
|
258
275
|
/** Job-worker listeners on this element's lifecycle (`zeebe:executionListeners`). */
|
|
259
276
|
executionListeners?: ZeebeListener[];
|
|
260
277
|
/** Runs the activity once per item of a list. */
|
|
@@ -374,6 +391,8 @@ export interface IntermediateCatchEventOptions extends ElementOptions {
|
|
|
374
391
|
export interface IntermediateThrowEventOptions extends ElementOptions {
|
|
375
392
|
/** Message name — creates a message throw event (aspirational). */
|
|
376
393
|
messageName?: string;
|
|
394
|
+
/** FEEL expression correlating the message (`zeebe:subscription`, written on the message). Camunda 8 lint expects one on a message throw event's message. */
|
|
395
|
+
correlationKey?: string;
|
|
377
396
|
/** Signal name — creates a signal throw event (aspirational). */
|
|
378
397
|
signalName?: string;
|
|
379
398
|
/** Escalation code — creates an escalation throw event (aspirational). */
|
|
@@ -402,6 +421,8 @@ export interface EndEventOptions extends ElementOptions {
|
|
|
402
421
|
errorRef?: string;
|
|
403
422
|
/** Message name — creates a message end event. */
|
|
404
423
|
messageName?: string;
|
|
424
|
+
/** FEEL expression correlating the message (`zeebe:subscription`, written on the message). Camunda 8 lint expects one on a message end event's message. */
|
|
425
|
+
correlationKey?: string;
|
|
405
426
|
/** Signal name — creates a signal end event. */
|
|
406
427
|
signalName?: string;
|
|
407
428
|
/** Escalation code — creates an escalation end event. */
|
|
@@ -534,6 +555,23 @@ export interface AnnotateOptions {
|
|
|
534
555
|
*/
|
|
535
556
|
side?: "above" | "below" | "left" | "right";
|
|
536
557
|
}
|
|
558
|
+
/**
|
|
559
|
+
* Lane bookkeeping shared by a process builder and its gateway branches (never by
|
|
560
|
+
* sub-process contents: nodes inside a sub-process are not lane members).
|
|
561
|
+
*/
|
|
562
|
+
declare class LaneState {
|
|
563
|
+
/** Lane id -> name, in first-use order (top to bottom). */
|
|
564
|
+
readonly names: Map<string, string | undefined>;
|
|
565
|
+
readonly membership: Map<string, string>;
|
|
566
|
+
current: string | undefined;
|
|
567
|
+
declare(id: string, name?: string): void;
|
|
568
|
+
enter(id: string, name?: string): void;
|
|
569
|
+
record(el: BpmnFlowElement): void;
|
|
570
|
+
/** Runs `fn`, then puts back the lane that was current before it. */
|
|
571
|
+
scoped(fn: () => void): void;
|
|
572
|
+
/** The process's lane set, or undefined when no lane was used. */
|
|
573
|
+
toLaneSet(processId: string, elements: BpmnFlowElement[], inferredFrom: number): BpmnLaneSet | undefined;
|
|
574
|
+
}
|
|
537
575
|
/**
|
|
538
576
|
* The root-level messages, errors, signals and escalations of one process.
|
|
539
577
|
*
|
|
@@ -550,12 +588,6 @@ interface RootDefinitions {
|
|
|
550
588
|
/** Shared by every nested builder, so hints reach the process's `build()`. */
|
|
551
589
|
layoutHints: Required<LayoutHints>;
|
|
552
590
|
}
|
|
553
|
-
/**
|
|
554
|
-
* Builder for a single named branch path from a gateway.
|
|
555
|
-
*
|
|
556
|
-
* Use `.condition(expr)` to set a FEEL condition on the outgoing sequence
|
|
557
|
-
* flow from the gateway, or `.defaultFlow()` to mark it as the default path.
|
|
558
|
-
*/
|
|
559
591
|
export declare class BranchBuilder {
|
|
560
592
|
/** @internal */
|
|
561
593
|
readonly _elements: BpmnFlowElement[];
|
|
@@ -568,6 +600,8 @@ export declare class BranchBuilder {
|
|
|
568
600
|
private lastNodeId;
|
|
569
601
|
private readonly gatewayId;
|
|
570
602
|
private readonly branchName;
|
|
603
|
+
/** False after a parallel or event-based gateway, whose outgoing flows Camunda lints as `superfluous-label` when named. */
|
|
604
|
+
private readonly nameFlow;
|
|
571
605
|
private isFirstElement;
|
|
572
606
|
private pendingCondition;
|
|
573
607
|
private pendingLabel;
|
|
@@ -589,8 +623,10 @@ export declare class BranchBuilder {
|
|
|
589
623
|
private readonly rootSignals;
|
|
590
624
|
private readonly rootEscalations;
|
|
591
625
|
private readonly rootLayoutHints;
|
|
626
|
+
/** Absent inside a sub-process, whose nodes are not lane members. */
|
|
627
|
+
private readonly lanes;
|
|
592
628
|
/** @internal */
|
|
593
|
-
constructor(gatewayId: string, branchName: string, rootErrors?: BpmnError[], rootMessages?: BpmnMessage[], rootSignals?: BpmnSignal[], rootEscalations?: BpmnEscalation[], rootLayoutHints?: Required<LayoutHints
|
|
629
|
+
constructor(gatewayId: string, branchName: string, rootErrors?: BpmnError[], rootMessages?: BpmnMessage[], rootSignals?: BpmnSignal[], rootEscalations?: BpmnEscalation[], rootLayoutHints?: Required<LayoutHints>, lanes?: LaneState, nameFlow?: boolean);
|
|
594
630
|
private roots;
|
|
595
631
|
/** Set a FEEL condition expression on this branch's outgoing sequence flow. */
|
|
596
632
|
condition(expression: string): this;
|
|
@@ -605,6 +641,8 @@ export declare class BranchBuilder {
|
|
|
605
641
|
defaultFlow(): this;
|
|
606
642
|
/** Keeps label() and flowId() out of the stable-id derivation; see stable-ids.ts. */
|
|
607
643
|
private registerFirstFlow;
|
|
644
|
+
/** Moves the rest of this branch (and branches nested in it) to a lane; undone when the branch ends. */
|
|
645
|
+
inLane(id: string, options?: LaneOptions): this;
|
|
608
646
|
private addElement;
|
|
609
647
|
/**
|
|
610
648
|
* Connect the current position to an existing or future element by ID.
|
|
@@ -839,6 +877,7 @@ export declare class ProcessBuilder {
|
|
|
839
877
|
private _pendingSpliceFlowId;
|
|
840
878
|
/** Flows the caller deliberately spliced, exempt from the rewiring guard. */
|
|
841
879
|
private readonly _splicedFlowIds;
|
|
880
|
+
private readonly lanes;
|
|
842
881
|
constructor(processId: string);
|
|
843
882
|
private roots;
|
|
844
883
|
/**
|
|
@@ -1152,12 +1191,21 @@ export declare class ProcessBuilder {
|
|
|
1152
1191
|
*/
|
|
1153
1192
|
private assertSourceTopologyIntact;
|
|
1154
1193
|
private validate;
|
|
1194
|
+
/**
|
|
1195
|
+
* Puts the nodes that follow in lane `id`, declaring it on first use (top to
|
|
1196
|
+
* bottom in first-use order); a later call may name it. Inside a `branch()`
|
|
1197
|
+
* callback it changes the lane for that branch only. Once any lane is used,
|
|
1198
|
+
* every top-level flow node needs one, or `build()` throws.
|
|
1199
|
+
*
|
|
1200
|
+
* @example
|
|
1201
|
+
* ```ts
|
|
1202
|
+
* Bpmn.createProcess("p").inLane("sales", { name: "Sales" }).startEvent("s")
|
|
1203
|
+
* .inLane("ops").serviceTask("t", { taskType: "x" }).endEvent("e").build()
|
|
1204
|
+
* ```
|
|
1205
|
+
*/
|
|
1206
|
+
inLane(id: string, options?: LaneOptions): this;
|
|
1155
1207
|
private addFlowElement;
|
|
1156
1208
|
}
|
|
1157
|
-
/**
|
|
1158
|
-
* Builder for a complete BPMN definitions document containing one or more processes.
|
|
1159
|
-
* Use `Bpmn.createDiagram(id?)` to obtain an instance.
|
|
1160
|
-
*/
|
|
1161
1209
|
export declare class DiagramBuilder {
|
|
1162
1210
|
private readonly _id;
|
|
1163
1211
|
private readonly _processes;
|