@dudousxd/nestjs-durable 0.36.0 → 0.37.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/dist/index.cjs +5 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.d.cts
CHANGED
|
@@ -129,6 +129,9 @@ interface WorkflowMeta {
|
|
|
129
129
|
maxSize: number;
|
|
130
130
|
within: string | number;
|
|
131
131
|
} | undefined;
|
|
132
|
+
/** Capabilities a live worker must advertise to run this workflow's turns (handshake §7.5). See
|
|
133
|
+
* `WorkflowOptions`. */
|
|
134
|
+
requires?: string[] | undefined;
|
|
132
135
|
}
|
|
133
136
|
interface WorkflowOptions {
|
|
134
137
|
name: string;
|
|
@@ -159,6 +162,14 @@ interface WorkflowOptions {
|
|
|
159
162
|
* runs that get stuck or loop forever. Omit for no limit.
|
|
160
163
|
*/
|
|
161
164
|
executionTimeout?: string | number;
|
|
165
|
+
/**
|
|
166
|
+
* Capabilities a live worker MUST advertise to run this workflow's turns (handshake design §7.5).
|
|
167
|
+
* Only meaningful for a group-served / remote workflow (an in-app worker or a cross-runtime body):
|
|
168
|
+
* the control-plane dispatches a turn only to a capability-capable + protocol-compatible worker, and
|
|
169
|
+
* if descriptors are published on its group but none qualifies the run parks `blocked` until the
|
|
170
|
+
* recovery poll finds one. Absent/empty = "runs anywhere" (a legacy fleet skips the guard, §7.7).
|
|
171
|
+
*/
|
|
172
|
+
requires?: string[];
|
|
162
173
|
/**
|
|
163
174
|
* Validate the workflow input at `start` against a **class-validator DTO** (the same
|
|
164
175
|
* `plainToInstance` + `validate` NestJS runs in controllers) — invalid input is rejected before any
|
|
@@ -266,6 +277,15 @@ interface StepOptions {
|
|
|
266
277
|
* `retries`). Omit to wait indefinitely.
|
|
267
278
|
*/
|
|
268
279
|
timeoutMs?: number;
|
|
280
|
+
/**
|
|
281
|
+
* Capabilities a live worker MUST advertise to run this step (handshake design §7.5). The
|
|
282
|
+
* control-plane routes the step only to workers whose descriptor advertises every name here; if
|
|
283
|
+
* descriptors are published on the step's group but none is capability-capable + protocol-compatible,
|
|
284
|
+
* the run parks `blocked` (never a silent hang) until the recovery poll finds one. Absent/empty =
|
|
285
|
+
* "runs anywhere" (the default — a legacy fleet publishing no descriptors skips the guard, §7.7). A
|
|
286
|
+
* per-call `ctx.step(ref, input, { requires })` overrides this.
|
|
287
|
+
*/
|
|
288
|
+
requires?: string[];
|
|
269
289
|
}
|
|
270
290
|
/**
|
|
271
291
|
* Marks a provider method as a durable step handler. An in-process transport (e.g. the
|
package/dist/index.d.ts
CHANGED
|
@@ -129,6 +129,9 @@ interface WorkflowMeta {
|
|
|
129
129
|
maxSize: number;
|
|
130
130
|
within: string | number;
|
|
131
131
|
} | undefined;
|
|
132
|
+
/** Capabilities a live worker must advertise to run this workflow's turns (handshake §7.5). See
|
|
133
|
+
* `WorkflowOptions`. */
|
|
134
|
+
requires?: string[] | undefined;
|
|
132
135
|
}
|
|
133
136
|
interface WorkflowOptions {
|
|
134
137
|
name: string;
|
|
@@ -159,6 +162,14 @@ interface WorkflowOptions {
|
|
|
159
162
|
* runs that get stuck or loop forever. Omit for no limit.
|
|
160
163
|
*/
|
|
161
164
|
executionTimeout?: string | number;
|
|
165
|
+
/**
|
|
166
|
+
* Capabilities a live worker MUST advertise to run this workflow's turns (handshake design §7.5).
|
|
167
|
+
* Only meaningful for a group-served / remote workflow (an in-app worker or a cross-runtime body):
|
|
168
|
+
* the control-plane dispatches a turn only to a capability-capable + protocol-compatible worker, and
|
|
169
|
+
* if descriptors are published on its group but none qualifies the run parks `blocked` until the
|
|
170
|
+
* recovery poll finds one. Absent/empty = "runs anywhere" (a legacy fleet skips the guard, §7.7).
|
|
171
|
+
*/
|
|
172
|
+
requires?: string[];
|
|
162
173
|
/**
|
|
163
174
|
* Validate the workflow input at `start` against a **class-validator DTO** (the same
|
|
164
175
|
* `plainToInstance` + `validate` NestJS runs in controllers) — invalid input is rejected before any
|
|
@@ -266,6 +277,15 @@ interface StepOptions {
|
|
|
266
277
|
* `retries`). Omit to wait indefinitely.
|
|
267
278
|
*/
|
|
268
279
|
timeoutMs?: number;
|
|
280
|
+
/**
|
|
281
|
+
* Capabilities a live worker MUST advertise to run this step (handshake design §7.5). The
|
|
282
|
+
* control-plane routes the step only to workers whose descriptor advertises every name here; if
|
|
283
|
+
* descriptors are published on the step's group but none is capability-capable + protocol-compatible,
|
|
284
|
+
* the run parks `blocked` (never a silent hang) until the recovery poll finds one. Absent/empty =
|
|
285
|
+
* "runs anywhere" (the default — a legacy fleet publishing no descriptors skips the guard, §7.7). A
|
|
286
|
+
* per-call `ctx.step(ref, input, { requires })` overrides this.
|
|
287
|
+
*/
|
|
288
|
+
requires?: string[];
|
|
269
289
|
}
|
|
270
290
|
/**
|
|
271
291
|
* Marks a provider method as a durable step handler. An in-process transport (e.g. the
|
package/dist/index.js
CHANGED
|
@@ -28,7 +28,8 @@ function Workflow(options) {
|
|
|
28
28
|
searchAttributes: options.searchAttributes,
|
|
29
29
|
onEvent: options.onEvent,
|
|
30
30
|
debounce: options.debounce,
|
|
31
|
-
batch: options.batch
|
|
31
|
+
batch: options.batch,
|
|
32
|
+
requires: options.requires
|
|
32
33
|
};
|
|
33
34
|
Reflect.defineMetadata(WORKFLOW_METADATA, meta, target);
|
|
34
35
|
Object.defineProperty(target, WORKFLOW_NAME_KEY, {
|
|
@@ -50,7 +51,8 @@ function stepConfigFrom(options) {
|
|
|
50
51
|
backoffMs: options.backoffMs,
|
|
51
52
|
backoffMaxMs: options.backoffMaxMs,
|
|
52
53
|
jitter: options.jitter,
|
|
53
|
-
timeoutMs: options.timeoutMs
|
|
54
|
+
timeoutMs: options.timeoutMs,
|
|
55
|
+
requires: options.requires
|
|
54
56
|
};
|
|
55
57
|
const hasAnyField = Object.values(config).some((value) => value !== void 0);
|
|
56
58
|
return hasAnyField ? config : void 0;
|
|
@@ -1553,6 +1555,7 @@ var WorkflowRegistrar = class {
|
|
|
1553
1555
|
tags: meta.tags,
|
|
1554
1556
|
singleton: meta.singleton,
|
|
1555
1557
|
executionTimeout: meta.executionTimeout,
|
|
1558
|
+
requires: meta.requires,
|
|
1556
1559
|
validateInput,
|
|
1557
1560
|
searchAttributesSchema: meta.searchAttributes,
|
|
1558
1561
|
onEvent: getOnEvents(meta, workflowCtor),
|