@bpmnkit/docspack 0.0.3 → 0.0.5

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 (38) hide show
  1. package/.llms/chunks/cli.diff.flags.md +46 -0
  2. package/.llms/chunks/cli.diff.md +43 -0
  3. package/.llms/chunks/cli.diff.the-same-diff-elsewhere.md +14 -0
  4. package/.llms/chunks/guides.building-processes.multi-instance.md +66 -0
  5. package/.llms/chunks/guides.drop.md +12 -0
  6. package/.llms/chunks/guides.drop.reviewing-it-together.md +45 -0
  7. package/.llms/chunks/guides.drop.running-your-own.md +21 -0
  8. package/.llms/chunks/guides.drop.sharing-a-file.md +42 -0
  9. package/.llms/chunks/guides.drop.what-drop-is-not.md +12 -0
  10. package/.llms/chunks/guides.vscode.commands.md +14 -0
  11. package/.llms/chunks/guides.vscode.installing.md +22 -0
  12. package/.llms/chunks/guides.vscode.md +13 -0
  13. package/.llms/chunks/guides.vscode.settings.md +19 -0
  14. package/.llms/chunks/guides.vscode.support.md +11 -0
  15. package/.llms/chunks/guides.vscode.what-it-does-a-feel-playground-on-your-selection.md +8 -0
  16. package/.llms/chunks/guides.vscode.what-it-does-a-visual-diff-in-source-control.md +11 -0
  17. package/.llms/chunks/guides.vscode.what-it-does-copy-the-diagram-as-text.md +8 -0
  18. package/.llms/chunks/guides.vscode.what-it-does-deploy-against-your-own-clusters.md +21 -0
  19. package/.llms/chunks/guides.vscode.what-it-does-editing-that-leaves-a-readable-diff.md +22 -0
  20. package/.llms/chunks/guides.vscode.what-it-does-findings-in-the-problems-panel.md +13 -0
  21. package/.llms/chunks/guides.vscode.what-it-does-preview-beside-the-source.md +12 -0
  22. package/.llms/chunks/guides.vscode.what-it-does-run-the-diagram-in-the-editor.md +9 -0
  23. package/.llms/chunks/packages.core.installation-ad-hoc-sub-processes-children-are-a-set-not-a-chain.md +42 -0
  24. package/.llms/chunks/packages.core.installation-compactify-definitions.md +9 -4
  25. package/.llms/chunks/packages.core.installation-createflowelement-id-type-options.md +7 -0
  26. package/.llms/chunks/packages.core.installation-diffdiagram-before-after.md +33 -0
  27. package/.llms/chunks/packages.core.installation-element-catalog.md +10 -0
  28. package/.llms/chunks/packages.core.installation-expand-compact.md +4 -0
  29. package/.llms/chunks/packages.core.installation-processbuilder-methods.md +15 -0
  30. package/.llms/chunks/packages.core.installation-retypeelement-element-type.md +20 -0
  31. package/.llms/chunks/packages.core.writing-files-bpmnkit-core-node-exportpreserving-original-definitions.md +51 -0
  32. package/.llms/chunks/packages.core.writing-files-bpmnkit-core-node-writebpmn-definitions-options.md +38 -0
  33. package/.llms/chunks/packages.core.writing-files-bpmnkit-core-node.md +0 -36
  34. package/.llms/manifest.json +438 -10
  35. package/README.md +2 -0
  36. package/dist/chunk.js +14 -4
  37. package/llms.txt +34 -6
  38. package/package.json +1 -1
@@ -11,5 +11,9 @@ const definitions = expand(compactDiagram);
11
11
  const xml = Bpmn.export(definitions);
12
12
  ```
13
13
 
14
+ Every element type the model knows expands to itself, data elements included. The switch is
15
+ exhaustive, so a new `BpmnElementType` fails the build here rather than silently arriving as a
16
+ `task` — which is how `dataObject`, `dataObjectReference` and `dataStoreReference` were lost.
17
+
14
18
  ---
15
19
  Source: https://bpmnkit.com/docs/packages/core
@@ -9,11 +9,20 @@ All builder methods return `this` for chaining.
9
9
  | `.serviceTask(id, options?)` | Add a service task |
10
10
  | `.userTask(id, options?)` | Add a user task |
11
11
  | `.scriptTask(id, options?)` | Add a script task |
12
+ | `.sendTask(id, options?)` | Add a send task |
13
+ | `.receiveTask(id, options?)` | Add a receive task |
14
+ | `.businessRuleTask(id, options?)` | Add a business rule task |
15
+ | `.manualTask(id, options?)` | Add a manual task — work done outside the engine, no job worker |
16
+ | `.task(id, options?)` | Add an abstract task with no Zeebe extensions |
12
17
  | `.exclusiveGateway(id, options?)` | Add an XOR gateway |
13
18
  | `.parallelGateway(id, options?)` | Add a parallel gateway |
14
19
  | `.inclusiveGateway(id, options?)` | Add an inclusive gateway |
15
20
  | `.eventBasedGateway(id, options?)` | Add an event-based gateway |
21
+ | `.complexGateway(id, options?)` | Add a complex gateway (aspirational — Zeebe does not execute these) |
16
22
  | `.subProcess(id, builder, options?)` | Add an embedded sub-process |
23
+ | `.adHocSubProcess(id, builder, options?)` | Add an ad-hoc sub-process — its children are **not** auto-chained, see below |
24
+ | `.eventSubProcess(id, builder, options?)` | Add an event sub-process (emits `subProcess triggeredByEvent="true"`) |
25
+ | `.transaction(id, builder, options?)` | Add a transaction sub-process (atomic scope) |
17
26
  | `.callActivity(id, options?)` | Add a call activity |
18
27
  | `.intermediateCatchEvent(id, options?)` | Add a catch event |
19
28
  | `.intermediateThrowEvent(id, options?)` | Add a throw event |
@@ -25,5 +34,11 @@ All builder methods return `this` for chaining.
25
34
  | `.withAutoLayout()` | Apply Sugiyama layout before building |
26
35
  | `.build(options?)` | Return the completed `BpmnDefinitions`. Pass `{ explicitJoins: true }` to refuse inferred join gateways — see below |
27
36
 
37
+ Every BPMN element type the model knows is reachable from a builder chain, except the three
38
+ data types (`dataObject`, `dataObjectReference`, `dataStoreReference`) — those are wired by
39
+ data associations rather than sequence flows, so the chain has nowhere to put them. A
40
+ compile-time table, `BUILDER_COVERAGE`, holds the SDK to that: adding an element type without
41
+ a builder method fails the build. Run `pnpm --filter @bpmnkit/core check:builder` to print it.
42
+
28
43
  ---
29
44
  Source: https://bpmnkit.com/docs/packages/core
@@ -0,0 +1,20 @@
1
+ # @bpmnkit/core — Installation — `retypeElement(element, type)`
2
+
3
+ Returns a copy of a flow element with a different `type`, keeping its id, name, documentation
4
+ and — crucially — its incoming and outgoing sequence flows. Use this to change a task's type
5
+ instead of removing and re-adding the element, which drops the wiring.
6
+
7
+ ```typescript
8
+ import { retypeElement } from "@bpmnkit/core";
9
+
10
+ const index = process.flowElements.findIndex((el) => el.id === "charge");
11
+ process.flowElements[index] = retypeElement(process.flowElements[index], "manualTask");
12
+ ```
13
+
14
+ Nested content is carried between container types, and a multi-instance marker between types
15
+ that both allow one. Zeebe extensions the new type cannot legally hold are dropped, using the
16
+ same placement table `ensureZeebeExtension` enforces — so a `serviceTask` retyped to
17
+ `manualTask` does not keep a job worker the engine would refuse.
18
+
19
+ ---
20
+ Source: https://bpmnkit.com/docs/packages/core
@@ -0,0 +1,51 @@
1
+ # @bpmnkit/core — Writing files — `@bpmnkit/core/node` — `exportPreserving(original, definitions)`
2
+
3
+ Writes a model back over the file it came from, changing as little as possible.
4
+
5
+ `Bpmn.export()` writes a model the way this toolkit writes models. That is the right output
6
+ for a new document and the wrong one for an existing file: the first visual edit reformats
7
+ every line, and the commit says "the whole diagram" when it means "a box moved".
8
+
9
+ Exported from `@bpmnkit/core` itself, not the `/node` subpath — it is string work, and the
10
+ caller owns the file:
11
+
12
+ ```typescript
13
+ import { readFile, writeFile } from "node:fs/promises";
14
+ import { Bpmn, exportPreserving } from "@bpmnkit/core";
15
+
16
+ const onDisk = await readFile("order.bpmn", "utf8");
17
+ const edited = Bpmn.parse(onDisk);
18
+ edited.processes[0].flowElements[0].name = "Validate Order";
19
+
20
+ await writeFile("order.bpmn", exportPreserving(onDisk, edited));
21
+ // Renaming one task changes one line, not the whole file.
22
+ ```
23
+
24
+ Indentation, attribute order, comments, the order children were written in, and attributes
25
+ left at their schema default all survive. Opening a file and writing it back unchanged leaves
26
+ it byte for byte.
27
+
28
+ Nothing about that is assumed, though. The model cannot represent the order a file writes its
29
+ children in — a process holds `flowElements` and `sequenceFlows` as separate lists — so each
30
+ strategy is tried, **the result is parsed back and compared against a plain write**, and the
31
+ first that reads the same is the one used. The plain write is the floor, so calling this is
32
+ never worse than not.
33
+
34
+ | Function | Takes | Returns |
35
+ | --- | --- | --- |
36
+ | `exportPreserving(original, definitions)` | the file's current text + a model | the new text |
37
+ | `exportPreservingResult(original, definitions)` | same | the text plus what it managed to keep |
38
+ | `preserveBpmnFormatting(original, updated)` | two documents as text | for a caller that already serialised, such as an editor's `exportXml()` |
39
+ | `exportDmnPreserving` / `preserveDmnFormatting` | DMN | the same treatment |
40
+ | `exportFormPreserving` / `preserveFormFormatting` | Camunda form JSON | indentation, key order and trailing newline |
41
+
42
+ This is what the [VS Code extension](/docs/guides/vscode) saves through, and what makes a
43
+ visual edit reviewable in a pull request.
44
+
45
+ Builder output is stable for the same reason: sequence-flow and root-definition ids are
46
+ derived from the model (`Flow_<source>_<target>`, `Message_<name>`, `Error_<code>`) rather
47
+ than randomly generated, so rebuilding an unchanged model produces the same file and the one
48
+ edge that changed is not buried in a diff of edges that did not.
49
+
50
+ ---
51
+ Source: https://bpmnkit.com/docs/packages/core
@@ -0,0 +1,38 @@
1
+ # @bpmnkit/core — Writing files — `@bpmnkit/core/node` — `writeBpmn(definitions, options)`
2
+
3
+ The only supported way to write a BPMN file, and the only one that checks what it wrote.
4
+ Before anything reaches disk it serialises the model, **parses the result back**, and compares
5
+ the semantic hashes. If they differ the write is refused and nothing is written.
6
+
7
+ ```typescript
8
+ import { writeBpmn } from "@bpmnkit/core/node";
9
+ import { WriteError, WriteVerificationError } from "@bpmnkit/core";
10
+
11
+ const result = await writeBpmn(definitions, {
12
+ output: "flow.bpmn",
13
+ force: false, // default — refuses rather than replace an existing file
14
+ layout: "preserve", // default — "auto" regenerates the diagram first
15
+ });
16
+
17
+ result.destination; // absolute path written
18
+ result.semanticHash; // the model's hash, verified after reading it back
19
+ result.outputSha256; // digest of the exact bytes on disk
20
+ result.changes; // what this write changed about the file it replaced
21
+ ```
22
+
23
+ The file appears complete or not at all: contents go to a temporary file in the destination's
24
+ own directory and are then linked or renamed into place, so an interrupted write cannot leave
25
+ a half-written model behind. Two concurrent writes to the same new path cannot both succeed.
26
+
27
+ `WriteVerificationError` carries a `changes` field naming the elements that diverged.
28
+ `WriteError` means the destination exists and `force` was not given, or the filesystem refused.
29
+
30
+ **What the check does not cover.** It compares the model in memory against the model read back
31
+ from the output, so it catches the serialiser losing something. It cannot catch the *parser*
32
+ having dropped something on the way in — content the parser never saw is absent from both
33
+ sides. That is what the round-trip corpus gate covers, and there is deliberately no option to
34
+ skip verification: turning it off would only ever be used to get past the bug it exists to
35
+ report. If you want unchecked serialisation, `Bpmn.export()` still returns a string.
36
+
37
+ ---
38
+ Source: https://bpmnkit.com/docs/packages/core
@@ -3,41 +3,5 @@
3
3
  Anything that touches the filesystem lives behind the `@bpmnkit/core/node` subpath, so
4
4
  importing `@bpmnkit/core` itself never pulls `node:` builtins into a browser bundle.
5
5
 
6
- ### `writeBpmn(definitions, options)`
7
-
8
- The only supported way to write a BPMN file, and the only one that checks what it wrote.
9
- Before anything reaches disk it serialises the model, **parses the result back**, and compares
10
- the semantic hashes. If they differ the write is refused and nothing is written.
11
-
12
- ```typescript
13
- import { writeBpmn } from "@bpmnkit/core/node";
14
- import { WriteError, WriteVerificationError } from "@bpmnkit/core";
15
-
16
- const result = await writeBpmn(definitions, {
17
- output: "flow.bpmn",
18
- force: false, // default — refuses rather than replace an existing file
19
- layout: "preserve", // default — "auto" regenerates the diagram first
20
- });
21
-
22
- result.destination; // absolute path written
23
- result.semanticHash; // the model's hash, verified after reading it back
24
- result.outputSha256; // digest of the exact bytes on disk
25
- result.changes; // what this write changed about the file it replaced
26
- ```
27
-
28
- The file appears complete or not at all: contents go to a temporary file in the destination's
29
- own directory and are then linked or renamed into place, so an interrupted write cannot leave
30
- a half-written model behind. Two concurrent writes to the same new path cannot both succeed.
31
-
32
- `WriteVerificationError` carries a `changes` field naming the elements that diverged.
33
- `WriteError` means the destination exists and `force` was not given, or the filesystem refused.
34
-
35
- **What the check does not cover.** It compares the model in memory against the model read back
36
- from the output, so it catches the serialiser losing something. It cannot catch the *parser*
37
- having dropped something on the way in — content the parser never saw is absent from both
38
- sides. That is what the round-trip corpus gate covers, and there is deliberately no option to
39
- skip verification: turning it off would only ever be used to get past the bug it exists to
40
- report. If you want unchecked serialisation, `Bpmn.export()` still returns a string.
41
-
42
6
  ---
43
7
  Source: https://bpmnkit.com/docs/packages/core