@nanobpm/engine-wasm 0.6.0 → 0.7.1
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/README.md
CHANGED
|
@@ -13,6 +13,7 @@ The package ships **two independent engines** from one install, selectable by
|
|
|
13
13
|
| --- | --- | ---: | --- |
|
|
14
14
|
| `@nanobpm/engine-wasm` | **lean** — primary state only | ~252 KB | demos, the modeler, debuggers, anything that reads via `snapshot()` / `events()` |
|
|
15
15
|
| `@nanobpm/engine-wasm/readmodel` | **read-model** — lean surface **+** the gateway's C8-style REST read methods | ~561 KB | full-surface app testing in CI that wants gateway read parity |
|
|
16
|
+
| `@nanobpm/engine-wasm/readmodel-types` | **types only** — the DTOs the read-model `search*` / `get*ByKey` methods return | 0 KB (erased) | typing read-model query results in a consumer (e.g. `@nanobpm/bojtos-kit`) without hand-mirroring the shapes |
|
|
16
17
|
|
|
17
18
|
## Why two binaries (not a runtime toggle)
|
|
18
19
|
|
|
@@ -96,6 +97,27 @@ cleared by `reset()`.
|
|
|
96
97
|
long values are truncated with `isTruncated: true`.
|
|
97
98
|
Mirrors `POST /variables/search`.
|
|
98
99
|
|
|
100
|
+
### Typing the results — `@nanobpm/engine-wasm/readmodel-types`
|
|
101
|
+
|
|
102
|
+
The methods above hand off opaque JSON strings (the wasm boundary is strings), so
|
|
103
|
+
the subpath `@nanobpm/engine-wasm/readmodel-types` ships the **DTO types** for
|
|
104
|
+
those results — `UserTaskSearchQueryResult`, `ProcessInstanceSearchQueryResult`,
|
|
105
|
+
`VariableSearchQueryResult`, `FormResult`, `ResourceResult` — so a consumer can
|
|
106
|
+
type them without hand-mirroring the shapes:
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
import type { UserTaskSearchQueryResult } from "@nanobpm/engine-wasm/readmodel-types";
|
|
110
|
+
|
|
111
|
+
const open = JSON.parse(
|
|
112
|
+
engine.searchUserTasks(JSON.stringify({ state: "CREATED" })),
|
|
113
|
+
) as UserTaskSearchQueryResult;
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
These are **derived** from the single source of truth — the Camunda-parity REST
|
|
117
|
+
OpenAPI in `spec/` — by `engine-wasm/readmodel-types` (`@hey-api/openapi-ts`); a
|
|
118
|
+
CI drift guard regenerates and fails on any stale artifact. The subpath is
|
|
119
|
+
types-only (its runtime module is empty), so importing it adds zero wire weight.
|
|
120
|
+
|
|
99
121
|
## Choosing a subpath
|
|
100
122
|
|
|
101
123
|
- **Reach for lean** for demos, the modeler, debuggers/adapters, and anything
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nanobpm/engine-wasm",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "The nanobpmn engine (engine-core) compiled to WebAssembly for in-browser BPMN execution: deploy a diagram, start instances, activate/complete jobs, and read live snapshots/traces. Published as two subpath entrypoints — a lean baseline engine (default) and a read-model engine (the gateway's C8-style REST read surface). The substrate for the Bojtos demo framework (ADR 0043) and the console test-run panel.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
"types": "./readmodel/nanobpmn_engine.d.ts",
|
|
22
22
|
"default": "./readmodel/nanobpmn_engine.js"
|
|
23
23
|
},
|
|
24
|
+
"./readmodel-types": {
|
|
25
|
+
"types": "./readmodel-types/index.d.ts",
|
|
26
|
+
"default": "./readmodel-types/index.js"
|
|
27
|
+
},
|
|
24
28
|
"./lean/nanobpmn_engine_bg.wasm": "./lean/nanobpmn_engine_bg.wasm",
|
|
25
29
|
"./readmodel/nanobpmn_engine_bg.wasm": "./readmodel/nanobpmn_engine_bg.wasm"
|
|
26
30
|
},
|
|
@@ -33,6 +37,9 @@
|
|
|
33
37
|
"readmodel/nanobpmn_engine.d.ts",
|
|
34
38
|
"readmodel/nanobpmn_engine_bg.wasm",
|
|
35
39
|
"readmodel/nanobpmn_engine_bg.wasm.d.ts",
|
|
40
|
+
"readmodel-types/index.js",
|
|
41
|
+
"readmodel-types/index.d.ts",
|
|
42
|
+
"readmodel-types/types.gen.d.ts",
|
|
36
43
|
"README.md"
|
|
37
44
|
],
|
|
38
45
|
"sideEffects": [
|
|
Binary file
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Public surface of `@nanobpm/engine-wasm/readmodel-types`: the derived DTO
|
|
2
|
+
// types for the read-model engine's query results, so browser consumers
|
|
3
|
+
// (@nanobpm/bojtos-kit → the web-demo-framework) can type
|
|
4
|
+
// `searchUserTasks` / `searchProcessInstances` / `searchVariables` /
|
|
5
|
+
// `getFormByKey` / `getResourceByKey` without hand-mirroring the shapes.
|
|
6
|
+
//
|
|
7
|
+
// These are re-exported from the generated `types.gen.d.ts`, which is derived
|
|
8
|
+
// from the single source of truth — the Camunda-parity REST OpenAPI in `spec/`
|
|
9
|
+
// — via `engine-wasm/readmodel-types` (`npm run gen`). Do not hand-edit; a
|
|
10
|
+
// stale artifact fails CI (`npm run check` = regen + `git diff --exit-code`).
|
|
11
|
+
export type {
|
|
12
|
+
// `searchUserTasks(filter): UserTaskSearchQueryResult`
|
|
13
|
+
UserTaskSearchQueryResult,
|
|
14
|
+
UserTaskResult,
|
|
15
|
+
// `searchProcessInstances(filter): ProcessInstanceSearchQueryResult`
|
|
16
|
+
ProcessInstanceSearchQueryResult,
|
|
17
|
+
ProcessInstanceResult,
|
|
18
|
+
// `searchVariables(filter): VariableSearchQueryResult`
|
|
19
|
+
VariableSearchQueryResult,
|
|
20
|
+
VariableResult,
|
|
21
|
+
// `getFormByKey(key): FormResult | null`
|
|
22
|
+
FormResult,
|
|
23
|
+
// `getResourceByKey(key): ResourceResult | null`
|
|
24
|
+
ResourceResult,
|
|
25
|
+
// Shared search envelope (`{ items, page }`) the *SearchQueryResult types extend.
|
|
26
|
+
SearchQueryResponse,
|
|
27
|
+
SearchQueryPageResponse,
|
|
28
|
+
} from "./types.gen.js";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Runtime-empty: `@nanobpm/engine-wasm/readmodel-types` ships types only (the
|
|
2
|
+
// read-model DTOs are compile-time contracts; the actual JSON is minted by the
|
|
3
|
+
// wasm engine's `search*` / `get*ByKey` methods). This stub exists so the
|
|
4
|
+
// package subpath resolves under Node's `exports` map; all real declarations
|
|
5
|
+
// live in the sibling `index.d.ts` / `types.gen.d.ts`.
|
|
6
|
+
export {};
|