@dudousxd/nestjs-durable 0.48.0 → 0.48.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dudousxd/nestjs-durable",
3
- "version": "0.48.0",
3
+ "version": "0.48.1",
4
4
  "description": "Durable workflows for NestJS — module, decorators, discovery and boot recovery",
5
5
  "license": "MIT",
6
6
  "author": "Davide Carvalho",
@@ -67,12 +67,12 @@
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.11.0",
71
- "@dudousxd/nestjs-durable-core": "^0.79.0",
70
+ "@dudousxd/durable-worker": "0.11.2",
71
+ "@dudousxd/nestjs-durable-core": "^0.80.0",
72
72
  "@dudousxd/nestjs-durable-dashboard": "0.51.0",
73
- "@dudousxd/nestjs-durable-testing": "^0.18.0",
74
- "@dudousxd/nestjs-durable-transport-bullmq": "0.22.1",
75
- "@dudousxd/nestjs-durable-transport-event-emitter": "^0.5.1"
73
+ "@dudousxd/nestjs-durable-testing": "^0.19.0",
74
+ "@dudousxd/nestjs-durable-transport-bullmq": "0.22.3",
75
+ "@dudousxd/nestjs-durable-transport-event-emitter": "^0.5.2"
76
76
  },
77
77
  "module": "./dist/index.js",
78
78
  "exports": {
@@ -76,6 +76,10 @@ await app.listen(3000);
76
76
 
77
77
  `start` **enqueues** the run and returns immediately with `{ runId, status: 'pending' }` — a worker
78
78
  runs the body, so the HTTP handler never blocks. Pass the workflow **class** for a typed input.
79
+ Pass `opts.startAt` (epoch ms or a `Date`) to delay the start: the run is created `suspended` with
80
+ its `wakeAt` set (the same durable timer `ctx.sleep` parks on, resumed by the timer poller once
81
+ due), and `start` returns `{ runId, status: 'suspended' }` instead. A time that is not in the
82
+ future starts the run at once.
79
83
 
80
84
  ```ts
81
85
  import { WorkflowService } from '@dudousxd/nestjs-durable';
@@ -158,7 +162,7 @@ name automatically; there's no `groups`/`remoteByConvention` flag to opt into.
158
162
  ### 1. Expecting `start` to return the workflow's result
159
163
 
160
164
  ```ts
161
- // ✗ Wrong — `start` enqueues; `result` is { runId, status: 'pending' }, never the run output
165
+ // ✗ Wrong — `start` enqueues; `result` is { runId, status: 'pending' } (or 'suspended' with startAt), never the run output
162
166
  const result = await this.workflows.start(CheckoutWorkflow, order);
163
167
  return result.output; // undefined
164
168
 
@@ -167,7 +171,8 @@ const { runId } = await this.workflows.start(CheckoutWorkflow, order);
167
171
  return this.workflows.waitForRun(runId); // resolves once the run settles
168
172
  ```
169
173
 
170
- `start` creates the run as `'pending'` and a worker runs the body asynchronously; only `waitForRun`
174
+ `start` creates the run as `'pending'` (or `'suspended'` when `opts.startAt` is in the future)
175
+ and a worker runs the body asynchronously; only `waitForRun`
171
176
  resolves with the settled outcome. Source: packages/nestjs/src/workflow.service.ts.
172
177
 
173
178
  ### 2. Leaving `autoSchema` on in production
@@ -302,7 +302,7 @@ class InvalidLine extends FatalError {
302
302
 
303
303
  @OnError(InvalidLine) // or @OnError('invalid_line'); @OnError() catches anything else
304
304
  async invalid(ctx: WorkflowCtx, failure: OnErrorInput<Line>): Promise<LineResult> {
305
- await ctx.step(this.steps.recordDeadLetter, { line: failure.input, error: failure.error.message });
305
+ await ctx.step(this.steps.recordRejectedLine, { line: failure.input, error: failure.error.message });
306
306
  return { ok: 0, failed: 1 };
307
307
  }
308
308
  ```