@dudousxd/nestjs-durable 0.44.0 → 0.45.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/dist/index.cjs +20 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +30 -5
- package/dist/index.d.ts +30 -5
- package/dist/index.js +20 -4
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
- package/skills/durable-determinism/SKILL.md +23 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dudousxd/nestjs-durable",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.45.1",
|
|
4
4
|
"description": "Durable workflows for NestJS — module, decorators, discovery and boot recovery",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Davide Carvalho",
|
|
@@ -67,11 +67,11 @@
|
|
|
67
67
|
"tsup": "8.3.5",
|
|
68
68
|
"@dudousxd/nestjs-diagnostics": "0.5.0",
|
|
69
69
|
"@tanstack/intent": "0.4.0",
|
|
70
|
-
"@dudousxd/durable-worker": "0.10.
|
|
71
|
-
"@dudousxd/nestjs-durable-
|
|
72
|
-
"@dudousxd/nestjs-durable-
|
|
73
|
-
"@dudousxd/nestjs-durable-
|
|
74
|
-
"@dudousxd/nestjs-durable-transport-
|
|
70
|
+
"@dudousxd/durable-worker": "0.10.1",
|
|
71
|
+
"@dudousxd/nestjs-durable-core": "^0.73.0",
|
|
72
|
+
"@dudousxd/nestjs-durable-dashboard": "0.48.0",
|
|
73
|
+
"@dudousxd/nestjs-durable-transport-bullmq": "0.21.0",
|
|
74
|
+
"@dudousxd/nestjs-durable-transport-event-emitter": "^0.5.1"
|
|
75
75
|
},
|
|
76
76
|
"module": "./dist/index.js",
|
|
77
77
|
"exports": {
|
|
@@ -156,3 +156,26 @@ async charge(input: { orderId: string; amountCents: number }) {
|
|
|
156
156
|
The engine guarantees *logical* exactly-once, but a crash after the worker ran and before its
|
|
157
157
|
checkpoint was written can physically re-run the step — dedupe on something stable in the input.
|
|
158
158
|
Source: website/content/docs/concepts/durability.mdx ("Idempotency").
|
|
159
|
+
|
|
160
|
+
### 4. Calling a ctx primitive from inside a step body
|
|
161
|
+
|
|
162
|
+
```ts
|
|
163
|
+
// ✗ Wrong — the step body starts a child through the ambient ctx. The step replays from its
|
|
164
|
+
// checkpoint WITHOUT re-running its body, so the child's journal position is never claimed again.
|
|
165
|
+
await ctx.localStep('plan', async () => {
|
|
166
|
+
const plan = await this.planner.plan(input);
|
|
167
|
+
await ExecutePlanWorkflow.start(plan); // → NestedWorkflowCallError at this line
|
|
168
|
+
return plan;
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
// ✓ Correct — the step computes, the BODY orchestrates.
|
|
172
|
+
const plan = await ctx.localStep('plan', () => this.planner.plan(input));
|
|
173
|
+
await ExecutePlanWorkflow.start(plan);
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Any primitive (`ctx.startChild`/`child`/`step`/`sleep`/`waitForSignal`/`sideEffect`/…, and the
|
|
177
|
+
`MyWorkflow.start()`/`.execute()` statics) called inside a `ctx.localStep`/`ctx.transaction`/
|
|
178
|
+
`ctx.sideEffect`/`ctx.now` body throws `NestedWorkflowCallError` (a `FatalError`) at the call site.
|
|
179
|
+
A dispatched `@Step` handler never sees the workflow ctx, so `MyWorkflow.start()` there starts a
|
|
180
|
+
top-level run. Source: packages/core/src/errors.ts (`NestedWorkflowCallError`),
|
|
181
|
+
packages/core/src/workflow-ctx.ts (the guard).
|