@dudousxd/nestjs-durable 0.47.0 → 0.47.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.47.0",
3
+ "version": "0.47.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.4",
70
71
  "@dudousxd/nestjs-durable-core": "^0.78.0",
71
72
  "@dudousxd/nestjs-durable-dashboard": "0.50.0",
72
- "@dudousxd/nestjs-durable-transport-bullmq": "0.22.0",
73
- "@dudousxd/nestjs-durable-transport-event-emitter": "^0.5.1",
74
- "@dudousxd/durable-worker": "0.10.3"
73
+ "@dudousxd/nestjs-durable-transport-bullmq": "0.22.1",
74
+ "@dudousxd/nestjs-durable-transport-event-emitter": "^0.5.1"
75
75
  },
76
76
  "module": "./dist/index.js",
77
77
  "exports": {
@@ -116,6 +116,12 @@ DurableModule.forRootAsync({
116
116
  });
117
117
  ```
118
118
 
119
+ `BullMQTransport` has two concurrency knobs. `concurrency` (default `1`; a number, `'adaptive'`, or
120
+ `{ mode: 'adaptive', min, max, ... }`) is how many TASKS a worker runs at once from each step queue.
121
+ `resultConcurrency` (default `1`) is how many step RESULTS the engine side handles at once. Raise it
122
+ for wide fans; one run's results still resume it in order on an instance. A non-finite or sub-1
123
+ `resultConcurrency` falls back to `1`.
124
+
119
125
  ### Split API pods from worker pods
120
126
 
121
127
  `DurableModule.forRoot` is the ONE module; the role is inferred from which of `store`/`connection`
@@ -6,7 +6,8 @@ description: >
6
6
  always dispatched, always engine-scheduled. @Step()-decorated provider methods carry the routing
7
7
  identity (derived Class.method name, or an explicit override); a method reference dispatches a
8
8
  same-process/typed step, a string name dispatches a cross-runtime one (e.g. a Python worker). Covers
9
- retries/backoff and FatalError, Promise.all fan-out, sub-process log.sub/subProcess annotations
9
+ retries/backoff and FatalError, Promise.all fan-out, ctx.all over a @Step (step fans with
10
+ concurrency waves and waitAll/failFast), sub-process log.sub/subProcess annotations
10
11
  inside a @Step handler, ctx.child for cross-runtime sub-workflows, and constructor dependency
11
12
  injection inside a workflow class.
12
13
  license: MIT
@@ -149,6 +150,34 @@ Prefer it to `Promise.all` past a handful of steps: every result of a `Promise.a
149
150
  workflow, which makes a fan of N steps cost O(N²) checkpoint reads. Prefer it to a child-workflow
150
151
  `ctx.all` when each item is just a step: a child costs a whole run (row, turn, lease, signal).
151
152
 
153
+ How the step fan behaves (`AllStepsOptions`):
154
+
155
+ - `concurrency` sends strict waves of that many steps; the next wave goes out once the whole
156
+ previous wave has settled. It is part of the fan's identity, like `inputs` — don't change it under
157
+ an in-flight run. It must be a positive integer.
158
+ - `mode: 'waitAll'` (default) lets every step settle, then throws `GatherError` with every failed
159
+ index. `mode: 'failFast'` throws `GatherError` with the first failure, sends no further waves, and
160
+ does NOT cancel steps already in flight.
161
+ - A step only counts as failed once its retries (the `@Step` policy, or per-call `retries` /
162
+ `backoff`) are spent.
163
+ - Rejected: a `queue` option, and a `@Step` that declares `timeoutMs`.
164
+ - The steps share `parallelGroup` `steps:<firstSeq>:<size>[:failFast]`.
165
+
166
+ ```ts
167
+ import { GatherError } from '@dudousxd/nestjs-durable-core';
168
+
169
+ let failedAt: number | undefined;
170
+ try {
171
+ await ctx.all(this.lines.processLine, lines, { concurrency: 500, mode: 'failFast' });
172
+ } catch (err) {
173
+ if (!(err instanceof GatherError)) throw err;
174
+ failedAt = err.failures[0]?.index; // the first failed input's position
175
+ }
176
+ ```
177
+
178
+ For a wide fan over `BullMQTransport`, raise `resultConcurrency` (default 1) on the instances that
179
+ consume results; one run's results still resume it in order on an instance.
180
+
152
181
  ### Sub-process events inside a step
153
182
 
154
183
  For pure visibility *inside* one step's execution, the `@Step` handler's optional second argument