@nanobpm/engine-wasm 0.4.0 → 0.6.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/README.md +112 -0
- package/{nanobpmn_engine.d.ts → lean/nanobpmn_engine.d.ts} +47 -5
- package/{nanobpmn_engine.js → lean/nanobpmn_engine.js} +145 -7
- package/lean/nanobpmn_engine_bg.wasm +0 -0
- package/{nanobpmn_engine_bg.wasm.d.ts → lean/nanobpmn_engine_bg.wasm.d.ts} +4 -1
- package/package.json +22 -12
- package/readmodel/nanobpmn_engine.d.ts +386 -0
- package/readmodel/nanobpmn_engine.js +1596 -0
- package/readmodel/nanobpmn_engine_bg.wasm +0 -0
- package/readmodel/nanobpmn_engine_bg.wasm.d.ts +57 -0
- package/nanobpmn_engine_bg.wasm +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# @nanobpm/engine-wasm
|
|
2
|
+
|
|
3
|
+
The nanobpmn engine (`engine-core`) compiled to **WebAssembly** for in-browser
|
|
4
|
+
BPMN execution. Deploy a diagram, start instances, activate/complete jobs, drive
|
|
5
|
+
the virtual clock, and read live snapshots/traces — all client-side, with no
|
|
6
|
+
gateway. It is the substrate for the [Bojtos](https://github.com/nanobpm/bojtos)
|
|
7
|
+
demo framework (ADR 0043) and the console test-run panel.
|
|
8
|
+
|
|
9
|
+
The package ships **two independent engines** from one install, selectable by
|
|
10
|
+
**import path**:
|
|
11
|
+
|
|
12
|
+
| Import | Engine | Wire size (brotli) | Use it for |
|
|
13
|
+
| --- | --- | ---: | --- |
|
|
14
|
+
| `@nanobpm/engine-wasm` | **lean** — primary state only | ~252 KB | demos, the modeler, debuggers, anything that reads via `snapshot()` / `events()` |
|
|
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
|
+
|
|
17
|
+
## Why two binaries (not a runtime toggle)
|
|
18
|
+
|
|
19
|
+
Each variant is its own `wasm-pack --target web` JS glue + `_bg.wasm`. A bundler
|
|
20
|
+
follows the static module graph, so it only emits the wasm for the subpath you
|
|
21
|
+
actually import — wasm **cannot** be tree-shaken out of a single fat build. So:
|
|
22
|
+
|
|
23
|
+
- Lean-only pages pay **zero** read-model weight (the +309 KB brotli never lands).
|
|
24
|
+
- You can `await import("@nanobpm/engine-wasm/readmodel")` to code-split the
|
|
25
|
+
heavy engine behind a runtime decision.
|
|
26
|
+
- You can even instantiate **both** on one page.
|
|
27
|
+
|
|
28
|
+
The read-model variant is the lean engine **plus** an in-memory wasm SQLite read
|
|
29
|
+
model (the same projection the gateway serves from), exposing the REST read
|
|
30
|
+
surface the lean engine lacks.
|
|
31
|
+
|
|
32
|
+
## Install
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
npm install @nanobpm/engine-wasm
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Usage — lean (default)
|
|
39
|
+
|
|
40
|
+
```js
|
|
41
|
+
import init, { TestEngine } from "@nanobpm/engine-wasm";
|
|
42
|
+
|
|
43
|
+
await init(); // instantiate the wasm module
|
|
44
|
+
const engine = new TestEngine();
|
|
45
|
+
|
|
46
|
+
engine.deploy(bpmnXml); // deploy a BPMN diagram
|
|
47
|
+
const handle = engine.createInstance("my-process", "{}");
|
|
48
|
+
const snap = JSON.parse(engine.snapshot()); // live primary state
|
|
49
|
+
const trace = JSON.parse(engine.events()); // the event log
|
|
50
|
+
engine.reset(); // back to a clean engine
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
The lean surface covers primary state and execution: `deploy`, `createInstance`,
|
|
54
|
+
`snapshot`, `events`, job ops (`activateJobs`, `completeJob`, `failJob`,
|
|
55
|
+
`updateRetries`, `throwError`), user-task ops (`completeUserTask`,
|
|
56
|
+
`assignUserTask`, …), messaging/signals, the virtual clock (`advanceTime`,
|
|
57
|
+
`tickNow`), and `reset`. It links **no** SQLite / read-model code.
|
|
58
|
+
|
|
59
|
+
## Usage — read-model
|
|
60
|
+
|
|
61
|
+
```js
|
|
62
|
+
import init, { TestEngine } from "@nanobpm/engine-wasm/readmodel";
|
|
63
|
+
|
|
64
|
+
await init();
|
|
65
|
+
const engine = new TestEngine();
|
|
66
|
+
|
|
67
|
+
engine.deploy(bpmnXml);
|
|
68
|
+
engine.createInstance("my-process", "{}");
|
|
69
|
+
|
|
70
|
+
// Same lean surface as above, PLUS the gateway's REST read channel:
|
|
71
|
+
const form = JSON.parse(engine.getFormByKey("2251799813685250"));
|
|
72
|
+
const open = JSON.parse(engine.searchUserTasks(JSON.stringify({ state: "CREATED" })));
|
|
73
|
+
const insts = JSON.parse(engine.searchProcessInstances("{}"));
|
|
74
|
+
const res = JSON.parse(engine.getResourceByKey("2251799813685251"));
|
|
75
|
+
const vars = JSON.parse(engine.searchVariables("{}"));
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Read methods (read-model subpath only)
|
|
79
|
+
|
|
80
|
+
Each returns the same JSON shapes the Camunda v2 REST surface returns; each
|
|
81
|
+
delegates to the in-memory read model, kept current after every command and
|
|
82
|
+
cleared by `reset()`.
|
|
83
|
+
|
|
84
|
+
- **`getFormByKey(formKey)`** → the latest deployed form for `formKey`
|
|
85
|
+
(`{ tenantId, formId, schema, version, formKey }`), or `null`.
|
|
86
|
+
Mirrors `GET /forms/{formKey}`.
|
|
87
|
+
- **`searchUserTasks(filterJson)`** → `{ items, page }`. Honours an optional
|
|
88
|
+
`{ state? }` filter (e.g. `"CREATED"`) through the read model.
|
|
89
|
+
Mirrors `POST /user-tasks/search`.
|
|
90
|
+
- **`searchProcessInstances(filterJson)`** → `{ items, page }`. Body is
|
|
91
|
+
shape-validated; filter/sort/page fields are not yet honoured (returns every
|
|
92
|
+
instance). Mirrors `POST /process-instances/search`.
|
|
93
|
+
- **`getResourceByKey(resourceKey)`** → the generic resource, or `null`.
|
|
94
|
+
Mirrors `GET /resources/{resourceKey}`.
|
|
95
|
+
- **`searchVariables(filterJson)`** → `{ items, page }`. Body is shape-validated;
|
|
96
|
+
long values are truncated with `isTruncated: true`.
|
|
97
|
+
Mirrors `POST /variables/search`.
|
|
98
|
+
|
|
99
|
+
## Choosing a subpath
|
|
100
|
+
|
|
101
|
+
- **Reach for lean** for demos, the modeler, debuggers/adapters, and anything
|
|
102
|
+
that only inspects `snapshot()` / `events()`. Keeping these paths lean is the
|
|
103
|
+
whole point of the split — the +309 KB brotli must never ship in a demo page.
|
|
104
|
+
- **Reach for `/readmodel`** when you need gateway read parity — full-surface app
|
|
105
|
+
testing in CI — instead of hand-rolling shadow read stores in JS/TS.
|
|
106
|
+
|
|
107
|
+
## References
|
|
108
|
+
|
|
109
|
+
- Epic [#796](https://github.com/Magikcraft/nano-bpm/issues/796) — the read
|
|
110
|
+
channel via a wasm SQLite read model (size table, toolchain note, downstream
|
|
111
|
+
consumers).
|
|
112
|
+
- ADR 0043 — Bojtos (the demo framework this engine backs).
|
|
@@ -83,11 +83,13 @@ export class TestEngine {
|
|
|
83
83
|
correlateMessage(message_name: string, correlation_key: string, variables_json: string): string;
|
|
84
84
|
/**
|
|
85
85
|
* Start a new instance of `process_id`, seeding it with the given variables
|
|
86
|
-
* (a JSON object string; pass `"{}"` or `""` for none).
|
|
87
|
-
*
|
|
88
|
-
*
|
|
86
|
+
* (a JSON object string; pass `"{}"` or `""` for none). `version` selects a
|
|
87
|
+
* specific process **version** number (Zeebe by-id semantics); pass
|
|
88
|
+
* `undefined`/`null` (or a non-positive value) for the latest version.
|
|
89
|
+
* Returns the post-run [`Snapshot`] with a top-level `created` field holding
|
|
90
|
+
* the new instance key.
|
|
89
91
|
*/
|
|
90
|
-
createInstance(process_id: string, variables_json: string): string;
|
|
92
|
+
createInstance(process_id: string, variables_json: string, version?: number | null): string;
|
|
91
93
|
/**
|
|
92
94
|
* Stop debugging, keeping the state the run produced. If the run is paused
|
|
93
95
|
* mid-command, that in-flight command is first **finished normally** (its
|
|
@@ -133,6 +135,34 @@ export class TestEngine {
|
|
|
133
135
|
* JS error carrying the parse/deploy failure message.
|
|
134
136
|
*/
|
|
135
137
|
deploy(xml: string): string;
|
|
138
|
+
/**
|
|
139
|
+
* Deploy a single `form-js` `.form` resource (the verbatim form-js JSON
|
|
140
|
+
* document). Mirrors the native deploy decomposition, which registers a
|
|
141
|
+
* `.form` resource as a [`Command::DeployForms`] (stored, not executed) so
|
|
142
|
+
* `getFormByKey` can serve its schema. The form-js document's `id` is the
|
|
143
|
+
* form identifier used for versioning/lookup — a body without a non-empty
|
|
144
|
+
* string `id` is a client error (native parity). The deploy resource name is
|
|
145
|
+
* derived as `<id>.form`.
|
|
146
|
+
*
|
|
147
|
+
* Returns a JSON object
|
|
148
|
+
* `{ "formKey": "...", "formId": "...", "version": N, "resourceName": "...", "snapshot": {...} }`
|
|
149
|
+
* on success, or throws a JS error carrying the parse/deploy failure message.
|
|
150
|
+
*/
|
|
151
|
+
deployForm(schema: string): string;
|
|
152
|
+
/**
|
|
153
|
+
* Deploy a single generic resource (any deployed file that is not a
|
|
154
|
+
* BPMN/DMN/form — e.g. a Markdown agent prompt) under `resource_name` with
|
|
155
|
+
* the given verbatim `content`. Mirrors the native deploy decomposition,
|
|
156
|
+
* which registers such a file as a [`Command::DeployGenericResources`]
|
|
157
|
+
* (stored, not executed) so `getResourceByKey` can serve its content. The
|
|
158
|
+
* `resource_id` is the filename (`resource_name`), matching Zeebe's default
|
|
159
|
+
* resource transformer.
|
|
160
|
+
*
|
|
161
|
+
* Returns a JSON object
|
|
162
|
+
* `{ "resourceKey": "...", "resourceId": "...", "version": N, "resourceName": "...", "snapshot": {...} }`
|
|
163
|
+
* on success, or throws a JS error carrying the deploy failure message.
|
|
164
|
+
*/
|
|
165
|
+
deployResource(resource_name: string, content: string): string;
|
|
136
166
|
/**
|
|
137
167
|
* The full ordered event log emitted so far, as a JSON array of
|
|
138
168
|
* `{ seq, now, type, ...payload }`. Useful for a step-through / trace view.
|
|
@@ -143,6 +173,15 @@ export class TestEngine {
|
|
|
143
173
|
* With no retries left this raises an incident (visible in the snapshot).
|
|
144
174
|
*/
|
|
145
175
|
failJob(job_key: string, retries: number, message: string): string;
|
|
176
|
+
/**
|
|
177
|
+
* Migrate a running process instance to a target process definition (Zeebe
|
|
178
|
+
* "migrate process instance"): re-point every active element instance at the
|
|
179
|
+
* mapped element of `target_process_definition_key` and re-home the instance.
|
|
180
|
+
* `mapping_instructions_json` is a JSON array of
|
|
181
|
+
* `{ sourceElementId: string, targetElementId: string }`. Returns the
|
|
182
|
+
* snapshot.
|
|
183
|
+
*/
|
|
184
|
+
migrate(instance_key: string, target_process_definition_key: string, mapping_instructions_json: string): string;
|
|
146
185
|
/**
|
|
147
186
|
* Modify a running process instance (Zeebe "modify process instance"): move
|
|
148
187
|
* tokens by terminating existing element instances and/or activating new
|
|
@@ -242,15 +281,18 @@ export interface InitOutput {
|
|
|
242
281
|
readonly testengine_completeJob: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
243
282
|
readonly testengine_completeUserTask: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
244
283
|
readonly testengine_correlateMessage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
245
|
-
readonly testengine_createInstance: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
284
|
+
readonly testengine_createInstance: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
246
285
|
readonly testengine_debugClear: (a: number) => void;
|
|
247
286
|
readonly testengine_debugCreateInstance: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
248
287
|
readonly testengine_debugIsPaused: (a: number) => number;
|
|
249
288
|
readonly testengine_debugResume: (a: number, b: number) => void;
|
|
250
289
|
readonly testengine_debugStep: (a: number, b: number) => void;
|
|
251
290
|
readonly testengine_deploy: (a: number, b: number, c: number, d: number) => void;
|
|
291
|
+
readonly testengine_deployForm: (a: number, b: number, c: number, d: number) => void;
|
|
292
|
+
readonly testengine_deployResource: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
252
293
|
readonly testengine_events: (a: number, b: number) => void;
|
|
253
294
|
readonly testengine_failJob: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
295
|
+
readonly testengine_migrate: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
254
296
|
readonly testengine_modify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
255
297
|
readonly testengine_new: () => number;
|
|
256
298
|
readonly testengine_now: (a: number) => number;
|
|
@@ -361,14 +361,17 @@ export class TestEngine {
|
|
|
361
361
|
}
|
|
362
362
|
/**
|
|
363
363
|
* Start a new instance of `process_id`, seeding it with the given variables
|
|
364
|
-
* (a JSON object string; pass `"{}"` or `""` for none).
|
|
365
|
-
*
|
|
366
|
-
*
|
|
364
|
+
* (a JSON object string; pass `"{}"` or `""` for none). `version` selects a
|
|
365
|
+
* specific process **version** number (Zeebe by-id semantics); pass
|
|
366
|
+
* `undefined`/`null` (or a non-positive value) for the latest version.
|
|
367
|
+
* Returns the post-run [`Snapshot`] with a top-level `created` field holding
|
|
368
|
+
* the new instance key.
|
|
367
369
|
* @param {string} process_id
|
|
368
370
|
* @param {string} variables_json
|
|
371
|
+
* @param {number | null} [version]
|
|
369
372
|
* @returns {string}
|
|
370
373
|
*/
|
|
371
|
-
createInstance(process_id, variables_json) {
|
|
374
|
+
createInstance(process_id, variables_json, version) {
|
|
372
375
|
let deferred4_0;
|
|
373
376
|
let deferred4_1;
|
|
374
377
|
try {
|
|
@@ -377,7 +380,7 @@ export class TestEngine {
|
|
|
377
380
|
const len0 = WASM_VECTOR_LEN;
|
|
378
381
|
const ptr1 = passStringToWasm0(variables_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
379
382
|
const len1 = WASM_VECTOR_LEN;
|
|
380
|
-
wasm.testengine_createInstance(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
383
|
+
wasm.testengine_createInstance(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, isLikeNone(version) ? Number.MAX_SAFE_INTEGER : (version) >> 0);
|
|
381
384
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
382
385
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
383
386
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -559,6 +562,91 @@ export class TestEngine {
|
|
|
559
562
|
wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
|
|
560
563
|
}
|
|
561
564
|
}
|
|
565
|
+
/**
|
|
566
|
+
* Deploy a single `form-js` `.form` resource (the verbatim form-js JSON
|
|
567
|
+
* document). Mirrors the native deploy decomposition, which registers a
|
|
568
|
+
* `.form` resource as a [`Command::DeployForms`] (stored, not executed) so
|
|
569
|
+
* `getFormByKey` can serve its schema. The form-js document's `id` is the
|
|
570
|
+
* form identifier used for versioning/lookup — a body without a non-empty
|
|
571
|
+
* string `id` is a client error (native parity). The deploy resource name is
|
|
572
|
+
* derived as `<id>.form`.
|
|
573
|
+
*
|
|
574
|
+
* Returns a JSON object
|
|
575
|
+
* `{ "formKey": "...", "formId": "...", "version": N, "resourceName": "...", "snapshot": {...} }`
|
|
576
|
+
* on success, or throws a JS error carrying the parse/deploy failure message.
|
|
577
|
+
* @param {string} schema
|
|
578
|
+
* @returns {string}
|
|
579
|
+
*/
|
|
580
|
+
deployForm(schema) {
|
|
581
|
+
let deferred3_0;
|
|
582
|
+
let deferred3_1;
|
|
583
|
+
try {
|
|
584
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
585
|
+
const ptr0 = passStringToWasm0(schema, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
586
|
+
const len0 = WASM_VECTOR_LEN;
|
|
587
|
+
wasm.testengine_deployForm(retptr, this.__wbg_ptr, ptr0, len0);
|
|
588
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
589
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
590
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
591
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
592
|
+
var ptr2 = r0;
|
|
593
|
+
var len2 = r1;
|
|
594
|
+
if (r3) {
|
|
595
|
+
ptr2 = 0; len2 = 0;
|
|
596
|
+
throw takeObject(r2);
|
|
597
|
+
}
|
|
598
|
+
deferred3_0 = ptr2;
|
|
599
|
+
deferred3_1 = len2;
|
|
600
|
+
return getStringFromWasm0(ptr2, len2);
|
|
601
|
+
} finally {
|
|
602
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
603
|
+
wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* Deploy a single generic resource (any deployed file that is not a
|
|
608
|
+
* BPMN/DMN/form — e.g. a Markdown agent prompt) under `resource_name` with
|
|
609
|
+
* the given verbatim `content`. Mirrors the native deploy decomposition,
|
|
610
|
+
* which registers such a file as a [`Command::DeployGenericResources`]
|
|
611
|
+
* (stored, not executed) so `getResourceByKey` can serve its content. The
|
|
612
|
+
* `resource_id` is the filename (`resource_name`), matching Zeebe's default
|
|
613
|
+
* resource transformer.
|
|
614
|
+
*
|
|
615
|
+
* Returns a JSON object
|
|
616
|
+
* `{ "resourceKey": "...", "resourceId": "...", "version": N, "resourceName": "...", "snapshot": {...} }`
|
|
617
|
+
* on success, or throws a JS error carrying the deploy failure message.
|
|
618
|
+
* @param {string} resource_name
|
|
619
|
+
* @param {string} content
|
|
620
|
+
* @returns {string}
|
|
621
|
+
*/
|
|
622
|
+
deployResource(resource_name, content) {
|
|
623
|
+
let deferred4_0;
|
|
624
|
+
let deferred4_1;
|
|
625
|
+
try {
|
|
626
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
627
|
+
const ptr0 = passStringToWasm0(resource_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
628
|
+
const len0 = WASM_VECTOR_LEN;
|
|
629
|
+
const ptr1 = passStringToWasm0(content, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
630
|
+
const len1 = WASM_VECTOR_LEN;
|
|
631
|
+
wasm.testengine_deployResource(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
632
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
633
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
634
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
635
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
636
|
+
var ptr3 = r0;
|
|
637
|
+
var len3 = r1;
|
|
638
|
+
if (r3) {
|
|
639
|
+
ptr3 = 0; len3 = 0;
|
|
640
|
+
throw takeObject(r2);
|
|
641
|
+
}
|
|
642
|
+
deferred4_0 = ptr3;
|
|
643
|
+
deferred4_1 = len3;
|
|
644
|
+
return getStringFromWasm0(ptr3, len3);
|
|
645
|
+
} finally {
|
|
646
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
647
|
+
wasm.__wbindgen_export3(deferred4_0, deferred4_1, 1);
|
|
648
|
+
}
|
|
649
|
+
}
|
|
562
650
|
/**
|
|
563
651
|
* The full ordered event log emitted so far, as a JSON array of
|
|
564
652
|
* `{ seq, now, type, ...payload }`. Useful for a step-through / trace view.
|
|
@@ -624,6 +712,48 @@ export class TestEngine {
|
|
|
624
712
|
wasm.__wbindgen_export3(deferred4_0, deferred4_1, 1);
|
|
625
713
|
}
|
|
626
714
|
}
|
|
715
|
+
/**
|
|
716
|
+
* Migrate a running process instance to a target process definition (Zeebe
|
|
717
|
+
* "migrate process instance"): re-point every active element instance at the
|
|
718
|
+
* mapped element of `target_process_definition_key` and re-home the instance.
|
|
719
|
+
* `mapping_instructions_json` is a JSON array of
|
|
720
|
+
* `{ sourceElementId: string, targetElementId: string }`. Returns the
|
|
721
|
+
* snapshot.
|
|
722
|
+
* @param {string} instance_key
|
|
723
|
+
* @param {string} target_process_definition_key
|
|
724
|
+
* @param {string} mapping_instructions_json
|
|
725
|
+
* @returns {string}
|
|
726
|
+
*/
|
|
727
|
+
migrate(instance_key, target_process_definition_key, mapping_instructions_json) {
|
|
728
|
+
let deferred5_0;
|
|
729
|
+
let deferred5_1;
|
|
730
|
+
try {
|
|
731
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
732
|
+
const ptr0 = passStringToWasm0(instance_key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
733
|
+
const len0 = WASM_VECTOR_LEN;
|
|
734
|
+
const ptr1 = passStringToWasm0(target_process_definition_key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
735
|
+
const len1 = WASM_VECTOR_LEN;
|
|
736
|
+
const ptr2 = passStringToWasm0(mapping_instructions_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
737
|
+
const len2 = WASM_VECTOR_LEN;
|
|
738
|
+
wasm.testengine_migrate(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
739
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
740
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
741
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
742
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
743
|
+
var ptr4 = r0;
|
|
744
|
+
var len4 = r1;
|
|
745
|
+
if (r3) {
|
|
746
|
+
ptr4 = 0; len4 = 0;
|
|
747
|
+
throw takeObject(r2);
|
|
748
|
+
}
|
|
749
|
+
deferred5_0 = ptr4;
|
|
750
|
+
deferred5_1 = len4;
|
|
751
|
+
return getStringFromWasm0(ptr4, len4);
|
|
752
|
+
} finally {
|
|
753
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
754
|
+
wasm.__wbindgen_export3(deferred5_0, deferred5_1, 1);
|
|
755
|
+
}
|
|
756
|
+
}
|
|
627
757
|
/**
|
|
628
758
|
* Modify a running process instance (Zeebe "modify process instance"): move
|
|
629
759
|
* tokens by terminating existing element instances and/or activating new
|
|
@@ -977,7 +1107,7 @@ if (Symbol.dispose) TestEngine.prototype[Symbol.dispose] = TestEngine.prototype.
|
|
|
977
1107
|
function __wbg_get_imports() {
|
|
978
1108
|
const import0 = {
|
|
979
1109
|
__proto__: null,
|
|
980
|
-
|
|
1110
|
+
__wbg___wbindgen_throw_bb96b2010945f0bc: function(arg0, arg1) {
|
|
981
1111
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
982
1112
|
},
|
|
983
1113
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
@@ -1041,6 +1171,10 @@ heap.push(undefined, null, true, false);
|
|
|
1041
1171
|
|
|
1042
1172
|
let heap_next = heap.length;
|
|
1043
1173
|
|
|
1174
|
+
function isLikeNone(x) {
|
|
1175
|
+
return x === undefined || x === null;
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1044
1178
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
1045
1179
|
if (realloc === undefined) {
|
|
1046
1180
|
const buf = cachedTextEncoder.encode(arg);
|
|
@@ -1125,11 +1259,15 @@ function __wbg_finalize_init(instance, module) {
|
|
|
1125
1259
|
|
|
1126
1260
|
async function __wbg_load(module, imports) {
|
|
1127
1261
|
if (typeof Response === 'function' && module instanceof Response) {
|
|
1262
|
+
if (!module.ok) {
|
|
1263
|
+
throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1128
1266
|
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
1129
1267
|
try {
|
|
1130
1268
|
return await WebAssembly.instantiateStreaming(module, imports);
|
|
1131
1269
|
} catch (e) {
|
|
1132
|
-
const validResponse =
|
|
1270
|
+
const validResponse = expectedResponseType(module.type);
|
|
1133
1271
|
|
|
1134
1272
|
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
1135
1273
|
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
Binary file
|
|
@@ -11,15 +11,18 @@ export const testengine_completeAgentJob: (a: number, b: number, c: number, d: n
|
|
|
11
11
|
export const testengine_completeJob: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
12
12
|
export const testengine_completeUserTask: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
13
13
|
export const testengine_correlateMessage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
14
|
-
export const testengine_createInstance: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
14
|
+
export const testengine_createInstance: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
15
15
|
export const testengine_debugClear: (a: number) => void;
|
|
16
16
|
export const testengine_debugCreateInstance: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
17
17
|
export const testengine_debugIsPaused: (a: number) => number;
|
|
18
18
|
export const testengine_debugResume: (a: number, b: number) => void;
|
|
19
19
|
export const testengine_debugStep: (a: number, b: number) => void;
|
|
20
20
|
export const testengine_deploy: (a: number, b: number, c: number, d: number) => void;
|
|
21
|
+
export const testengine_deployForm: (a: number, b: number, c: number, d: number) => void;
|
|
22
|
+
export const testengine_deployResource: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
21
23
|
export const testengine_events: (a: number, b: number) => void;
|
|
22
24
|
export const testengine_failJob: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
25
|
+
export const testengine_migrate: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
23
26
|
export const testengine_modify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
24
27
|
export const testengine_new: () => number;
|
|
25
28
|
export const testengine_now: (a: number) => number;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nanobpm/engine-wasm",
|
|
3
|
-
"version": "0.
|
|
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. The substrate for the Bojtos demo framework (ADR 0043) and the console test-run panel.",
|
|
3
|
+
"version": "0.6.0",
|
|
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",
|
|
7
7
|
"repository": {
|
|
@@ -9,21 +9,31 @@
|
|
|
9
9
|
"url": "https://github.com/Magikcraft/nano-bpm",
|
|
10
10
|
"directory": "engine-wasm/pkg"
|
|
11
11
|
},
|
|
12
|
-
"main": "./nanobpmn_engine.js",
|
|
13
|
-
"module": "./nanobpmn_engine.js",
|
|
14
|
-
"types": "./nanobpmn_engine.d.ts",
|
|
12
|
+
"main": "./lean/nanobpmn_engine.js",
|
|
13
|
+
"module": "./lean/nanobpmn_engine.js",
|
|
14
|
+
"types": "./lean/nanobpmn_engine.d.ts",
|
|
15
15
|
"exports": {
|
|
16
16
|
".": {
|
|
17
|
-
"types": "./nanobpmn_engine.d.ts",
|
|
18
|
-
"default": "./nanobpmn_engine.js"
|
|
17
|
+
"types": "./lean/nanobpmn_engine.d.ts",
|
|
18
|
+
"default": "./lean/nanobpmn_engine.js"
|
|
19
19
|
},
|
|
20
|
-
"./
|
|
20
|
+
"./readmodel": {
|
|
21
|
+
"types": "./readmodel/nanobpmn_engine.d.ts",
|
|
22
|
+
"default": "./readmodel/nanobpmn_engine.js"
|
|
23
|
+
},
|
|
24
|
+
"./lean/nanobpmn_engine_bg.wasm": "./lean/nanobpmn_engine_bg.wasm",
|
|
25
|
+
"./readmodel/nanobpmn_engine_bg.wasm": "./readmodel/nanobpmn_engine_bg.wasm"
|
|
21
26
|
},
|
|
22
27
|
"files": [
|
|
23
|
-
"nanobpmn_engine.js",
|
|
24
|
-
"nanobpmn_engine.d.ts",
|
|
25
|
-
"nanobpmn_engine_bg.wasm",
|
|
26
|
-
"nanobpmn_engine_bg.wasm.d.ts"
|
|
28
|
+
"lean/nanobpmn_engine.js",
|
|
29
|
+
"lean/nanobpmn_engine.d.ts",
|
|
30
|
+
"lean/nanobpmn_engine_bg.wasm",
|
|
31
|
+
"lean/nanobpmn_engine_bg.wasm.d.ts",
|
|
32
|
+
"readmodel/nanobpmn_engine.js",
|
|
33
|
+
"readmodel/nanobpmn_engine.d.ts",
|
|
34
|
+
"readmodel/nanobpmn_engine_bg.wasm",
|
|
35
|
+
"readmodel/nanobpmn_engine_bg.wasm.d.ts",
|
|
36
|
+
"README.md"
|
|
27
37
|
],
|
|
28
38
|
"sideEffects": [
|
|
29
39
|
"./snippets/*"
|