@dudousxd/nestjs-durable 0.45.0 → 0.46.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dudousxd/nestjs-durable",
3
- "version": "0.45.0",
3
+ "version": "0.46.0",
4
4
  "description": "Durable workflows for NestJS — module, decorators, discovery and boot recovery",
5
5
  "license": "MIT",
6
6
  "author": "Davide Carvalho",
@@ -67,10 +67,10 @@
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.0",
71
- "@dudousxd/nestjs-durable-core": "^0.72.0",
72
- "@dudousxd/nestjs-durable-dashboard": "0.48.0",
73
- "@dudousxd/nestjs-durable-transport-bullmq": "0.21.0",
70
+ "@dudousxd/durable-worker": "0.10.2",
71
+ "@dudousxd/nestjs-durable-core": "^0.74.0",
72
+ "@dudousxd/nestjs-durable-dashboard": "0.49.0",
73
+ "@dudousxd/nestjs-durable-transport-bullmq": "0.21.1",
74
74
  "@dudousxd/nestjs-durable-transport-event-emitter": "^0.5.1"
75
75
  },
76
76
  "module": "./dist/index.js",
@@ -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).