@dudousxd/nestjs-durable-core 0.46.0 → 0.47.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 +525 -184
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +218 -27
- package/dist/index.d.ts +218 -27
- package/dist/index.js +521 -184
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -161,12 +161,6 @@ declare class InMemoryAdmissionBackend implements AdmissionBackend {
|
|
|
161
161
|
release(queue: string, _slotId: string): Promise<void>;
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
/**
|
|
165
|
-
* Parse a human duration to milliseconds. Accepts a number (already ms) or a string like
|
|
166
|
-
* `'500ms'`, `'30s'`, `'15m'`, `'2h'`, `'7d'`, `'7 days'`.
|
|
167
|
-
*/
|
|
168
|
-
declare function parseDuration(duration: string | number): number;
|
|
169
|
-
|
|
170
164
|
/**
|
|
171
165
|
* Cross-package step-name stamp. The `@Step` decorator (`@dudousxd/nestjs-durable`) writes a
|
|
172
166
|
* method's derived routing name under this key; core's `ctx.step` reads it (via {@link stepNameOf})
|
|
@@ -1221,8 +1215,16 @@ interface DurableWebhook<TPayload = unknown> {
|
|
|
1221
1215
|
* build your own).
|
|
1222
1216
|
*/
|
|
1223
1217
|
readonly url?: string | undefined;
|
|
1224
|
-
/**
|
|
1225
|
-
|
|
1218
|
+
/**
|
|
1219
|
+
* Suspend until the callback arrives, then resume with its payload. Waits indefinitely by default —
|
|
1220
|
+
* no compute consumed. Pass `{ timeoutMs }` to bound the wait: if the deadline passes first the call
|
|
1221
|
+
* throws a `SignalTimeoutError` (catch it in the workflow to branch) — same timeout semantics as
|
|
1222
|
+
* {@link WorkflowCtx.waitForSignal}. The deadline is computed once (on the first call) and persisted,
|
|
1223
|
+
* so a replay reuses the recorded deadline rather than recomputing it from the current clock.
|
|
1224
|
+
*/
|
|
1225
|
+
wait(opts?: {
|
|
1226
|
+
timeoutMs?: number;
|
|
1227
|
+
}): Promise<TPayload>;
|
|
1226
1228
|
}
|
|
1227
1229
|
/**
|
|
1228
1230
|
* Options for a dispatched {@link WorkflowCtx.step} call. `retries`/`backoff`/`backoffMs`/
|
|
@@ -1263,6 +1265,25 @@ interface StepDispatchOpts {
|
|
|
1263
1265
|
* `retries`). Omit to wait indefinitely. Overrides the `@Step`-declared value. */
|
|
1264
1266
|
timeoutMs?: number;
|
|
1265
1267
|
}
|
|
1268
|
+
/** What a saga undo handler receives: the compensated step's original input and its result — the
|
|
1269
|
+
* ONE argument a compensation `@Step` is called with, so it's self-describing on the wire (a
|
|
1270
|
+
* Python worker sees `{ input, output }` with no side-channel lookup needed). */
|
|
1271
|
+
interface StepUndo<TInput, TOutput> {
|
|
1272
|
+
input: TInput;
|
|
1273
|
+
output: TOutput;
|
|
1274
|
+
}
|
|
1275
|
+
/**
|
|
1276
|
+
* Derive a `ctx.step` compensation handler's expected argument from the ORIGINAL step's method
|
|
1277
|
+
* type, so the ref form is compile-checked against the step it undoes:
|
|
1278
|
+
*
|
|
1279
|
+
* ```ts
|
|
1280
|
+
* async cancelBooking(undo: UndoOf<FlightService['book']>) { ... }
|
|
1281
|
+
* ```
|
|
1282
|
+
*
|
|
1283
|
+
* `...rest: never[]` pins this to a single-argument method (the shape every `@Step` handler has —
|
|
1284
|
+
* see {@link StepRef}); `Awaited<R>` unwraps a `Promise<TOutput>` return down to `TOutput`.
|
|
1285
|
+
*/
|
|
1286
|
+
type UndoOf<H> = H extends (input: infer I, ...rest: never[]) => infer R ? StepUndo<I, Awaited<R>> : never;
|
|
1266
1287
|
/**
|
|
1267
1288
|
* The context handed to a workflow function. Every interaction with the outside world goes
|
|
1268
1289
|
* through it so the engine can checkpoint — the workflow body itself stays deterministic.
|
|
@@ -1286,9 +1307,20 @@ interface WorkflowCtx {
|
|
|
1286
1307
|
*
|
|
1287
1308
|
* Both forms dispatch identically — a step runs on whatever worker serves that name and the run
|
|
1288
1309
|
* suspends (zero compute) until the result lands, then resumes with it (durable, replay-safe).
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1310
|
+
*
|
|
1311
|
+
* `opts.compensate` registers a SAGA UNDO for this call, dispatched (durably, in reverse order
|
|
1312
|
+
* with every other registered undo) if the run later fails or is cancelled with
|
|
1313
|
+
* `{ compensate: true }`. The undo is itself a normal `@Step` — pass its reference (compile-time
|
|
1314
|
+
* checked: it must accept `StepUndo<TInput, TOutput>` of THIS call, see {@link UndoOf}) or its
|
|
1315
|
+
* name for a cross-runtime undo handler. It runs on whatever worker serves that name, called with
|
|
1316
|
+
* the ONE `{ input, output }` envelope — never the original handler re-invoked in-process.
|
|
1317
|
+
*/
|
|
1318
|
+
step<TInput, TOutput>(handler: StepRef<TInput, TOutput>, input: TInput, opts?: StepDispatchOpts & {
|
|
1319
|
+
compensate?: StepRef<StepUndo<TInput, TOutput>, unknown> | string;
|
|
1320
|
+
}): Promise<TOutput>;
|
|
1321
|
+
step<TOutput = unknown, TInput = unknown>(name: string, input: TInput, opts?: StepDispatchOpts & {
|
|
1322
|
+
compensate?: StepRef<StepUndo<TInput, TOutput>, unknown> | string;
|
|
1323
|
+
}): Promise<TOutput>;
|
|
1292
1324
|
/**
|
|
1293
1325
|
* **Exactly-once** durable step for DB work: runs `fn` and writes the step's checkpoint in ONE
|
|
1294
1326
|
* store transaction, so the business write and the "done" marker commit atomically — a crash can
|
|
@@ -1380,9 +1412,12 @@ interface WorkflowCtx {
|
|
|
1380
1412
|
* placeholders share a `parallelGroup` tag so the dashboard renders the fan-out as one group.
|
|
1381
1413
|
*
|
|
1382
1414
|
* `mode` (default `waitAll`): `waitAll` waits for all then throws an aggregate {@link GatherError}
|
|
1383
|
-
* if any failed; `failFast` throws as soon as a failed child is seen
|
|
1384
|
-
*
|
|
1385
|
-
*
|
|
1415
|
+
* if any failed; `failFast` throws as soon as a failed child is seen, and requests cancellation of
|
|
1416
|
+
* every sibling that hasn't completed yet (best-effort, plain cancel — no saga undo; a sibling
|
|
1417
|
+
* mid-step only observes it at its next checkpoint, it isn't force-killed mid-synchronous-execution,
|
|
1418
|
+
* so a fast sibling can still slip through and complete). Empty `inputs` returns `[]` with no side
|
|
1419
|
+
* effects. The wait-all / fan-out counterpart to {@link child}; parity with the Python SDK's
|
|
1420
|
+
* `gather_children`.
|
|
1386
1421
|
*/
|
|
1387
1422
|
all<C extends WorkflowClass>(workflow: C, inputs: WorkflowInputOf<C>[], opts?: {
|
|
1388
1423
|
mode?: 'waitAll' | 'failFast';
|
|
@@ -1462,6 +1497,16 @@ interface WorkflowCtx {
|
|
|
1462
1497
|
* `ctx.upsertSearchAttributes(…)`).
|
|
1463
1498
|
*/
|
|
1464
1499
|
upsertSearchAttributes(attrs: SearchAttributes): Promise<void>;
|
|
1500
|
+
/**
|
|
1501
|
+
* Run a checkpointed step **in-process** — the escape hatch from the always-dispatched {@link step}
|
|
1502
|
+
* for work that must run inline in the workflow body. Like `step`, its result is a durable checkpoint
|
|
1503
|
+
* (returned, not re-run, on replay); unlike `step`, the body `fn` executes here rather than on a
|
|
1504
|
+
* worker, so it can carry an in-memory `compensate` callback for **sagas** — an undo the engine runs
|
|
1505
|
+
* in reverse if the run later fails (see [Sagas & compensation](/docs/reliability/sagas)). `fn`
|
|
1506
|
+
* receives a {@link StepLogger} for sub-process events. Prefer {@link step} for ordinary work; reach
|
|
1507
|
+
* for `localStep` when you need in-process execution or a compensation.
|
|
1508
|
+
*/
|
|
1509
|
+
localStep<TOutput>(name: string, fn: (log: StepLogger) => Promise<TOutput>, options?: StepOptions): Promise<TOutput>;
|
|
1465
1510
|
}
|
|
1466
1511
|
/** Result of executing or resuming a workflow run. */
|
|
1467
1512
|
interface RunResult {
|
|
@@ -1533,15 +1578,24 @@ interface StepInvocation {
|
|
|
1533
1578
|
type StepInterceptor = (invocation: StepInvocation, next: () => Promise<unknown>) => Promise<unknown>;
|
|
1534
1579
|
|
|
1535
1580
|
/**
|
|
1536
|
-
*
|
|
1537
|
-
*
|
|
1538
|
-
*
|
|
1539
|
-
* `createWorkflowCtx` result actually carries `localStep` at runtime; this type just names the wider
|
|
1540
|
-
* shape for the internal consumers that need it, without widening the public {@link WorkflowCtx}.
|
|
1581
|
+
* Run `fn` with `ctx` as the ambient workflow context. Engine-internal: wraps every execution of a
|
|
1582
|
+
* workflow body (first run and every replay), so ambient reads inside the body see the SAME ctx the
|
|
1583
|
+
* body received.
|
|
1541
1584
|
*/
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
}
|
|
1585
|
+
declare function runInWorkflowCtx<T>(ctx: WorkflowCtx, fn: () => T): T;
|
|
1586
|
+
/**
|
|
1587
|
+
* The {@link WorkflowCtx} of the workflow body currently executing on this async path — or
|
|
1588
|
+
* `undefined` outside one. Note a `@Step` HANDLER runs on a worker, off the body's path: it has no
|
|
1589
|
+
* ambient workflow context (by design — a handler is not the workflow body).
|
|
1590
|
+
*/
|
|
1591
|
+
declare function currentWorkflowCtx(): WorkflowCtx | undefined;
|
|
1592
|
+
|
|
1593
|
+
/**
|
|
1594
|
+
* Back-compat alias of {@link WorkflowCtx}. `localStep` — the checkpointed in-process step primitive
|
|
1595
|
+
* used for saga compensation — is now part of the public {@link WorkflowCtx}, so this type adds
|
|
1596
|
+
* nothing; it is kept only so internal consumers (the durable-entity runner) keep compiling.
|
|
1597
|
+
*/
|
|
1598
|
+
type InternalWorkflowCtx = WorkflowCtx;
|
|
1545
1599
|
|
|
1546
1600
|
/** One operation on a durable entity: mutate `state` in place and/or return a result. */
|
|
1547
1601
|
type EntityHandler<S = unknown> = (state: S, arg: unknown) => unknown | Promise<unknown>;
|
|
@@ -2107,6 +2161,7 @@ declare class WorkflowEngine {
|
|
|
2107
2161
|
*/
|
|
2108
2162
|
waitForRun(runId: string, opts?: {
|
|
2109
2163
|
timeoutMs?: number;
|
|
2164
|
+
until?: 'settled' | 'terminal';
|
|
2110
2165
|
}): Promise<RunResult>;
|
|
2111
2166
|
/**
|
|
2112
2167
|
* Resume each run only if this instance can acquire its recovery lease — so when several
|
|
@@ -2275,17 +2330,80 @@ declare class WorkflowEngine {
|
|
|
2275
2330
|
* Undo the registered saga compensations in reverse and settle the run `cancelled`. Shared by EVERY
|
|
2276
2331
|
* exit path of a run with a compensating cancel in flight — whether the resumed replay returned,
|
|
2277
2332
|
* suspended, hit continue-as-new, or threw — so a cancel is never lost just because the body didn't
|
|
2278
|
-
* stop at a suspension point.
|
|
2333
|
+
* stop at a suspension point.
|
|
2334
|
+
*
|
|
2335
|
+
* A dispatched compensation still in flight (or backing off a retry) needs the run to keep waiting:
|
|
2336
|
+
* unlike the failure path (which is fine going `suspended` — a resumable state no different from an
|
|
2337
|
+
* ordinary in-flight `ctx.step`), THIS run must stay `cancelling` — `engine.cancel`'s idempotent
|
|
2338
|
+
* re-check, `waitForRun`'s non-terminal treatment, and crash recovery (`recoverIncomplete` only
|
|
2339
|
+
* re-drives `running`/`cancelling` runs — a `cancelling` one with a free lease, whatever it's
|
|
2340
|
+
* internally waiting on) all key off that status. So on a pending unwind this returns WITHOUT
|
|
2341
|
+
* touching `status` (already `cancelling`, untouched since `engine.cancel` set it) — the in-memory
|
|
2342
|
+
* cancel flag stays too, re-derived from the status on any later re-drive regardless.
|
|
2279
2343
|
*/
|
|
2280
2344
|
private compensateAndCancel;
|
|
2281
2345
|
/** The run body, lease held + renewed by {@link execute}. */
|
|
2282
2346
|
private runExecution;
|
|
2283
2347
|
/**
|
|
2284
|
-
*
|
|
2285
|
-
*
|
|
2286
|
-
*
|
|
2348
|
+
* Undo every registered saga compensation in strict reverse order — the shared unwind both the
|
|
2349
|
+
* run-failure path (`runExecution`'s catch) and the compensating-cancel path
|
|
2350
|
+
* (`compensateAndCancel`) drive. Every entry, LOCAL or DISPATCHED, gets a NEGATIVE checkpoint seq
|
|
2351
|
+
* `-(k + 1)` for its position `k` (0, 1, 2… walking the stack in reverse) — reserved space that can
|
|
2352
|
+
* never collide with a body position (those start at 0), so a saga's undo trail composes onto the
|
|
2353
|
+
* run's ordinary checkpoint history with no store-schema change, and shows up in run detail exactly
|
|
2354
|
+
* like any other step. Deterministic because `compensations` is rebuilt identically on every replay
|
|
2355
|
+
* (see `workflow-ctx.ts`), so the same comp always lands on the same negative seq across a crash +
|
|
2356
|
+
* re-drive — the crash-safety this whole scheme rests on.
|
|
2357
|
+
*
|
|
2358
|
+
* A LOCAL entry runs in-process (`runCompensation`), which checkpoints its own outcome — completed,
|
|
2359
|
+
* or failed once `compensationRetries` are exhausted — so a crash mid-unwind SKIPS an
|
|
2360
|
+
* already-resolved one on the next pass instead of re-running it (and re-spending its retry budget)
|
|
2361
|
+
* from attempt 1. A DISPATCHED entry is an ordinary remote-step dispatch under the hood
|
|
2362
|
+
* (`dispatchCompensation`): when it needs the run to WAIT — freshly dispatched, still in flight, or
|
|
2363
|
+
* backing off a durable retry — this function returns that wait signal immediately (skipping every
|
|
2364
|
+
* comp after it in this pass); the CALLER decides how to represent "still unwinding" (see
|
|
2365
|
+
* `compensateAndCancel`'s doc comment for why that differs between the two callers). Either way, the
|
|
2366
|
+
* run resumes later exactly like any other dispatched step: `completeRemoteResult` completes the
|
|
2367
|
+
* negative-seq checkpoint and re-drives, the body replays and deterministically re-throws the same
|
|
2368
|
+
* exit it took before (the original failure, or the suspension `compensateAndCancel` resumed from),
|
|
2369
|
+
* this function runs again, the now-resolved comp is skipped, and the unwind continues from there.
|
|
2370
|
+
*
|
|
2371
|
+
* Returns `undefined` once every compensation has resolved — the caller then finalizes the run
|
|
2372
|
+
* (`failed` with the ORIGINAL body error, never masked by a comp outcome; or `cancelled`).
|
|
2373
|
+
*/
|
|
2374
|
+
private unwindCompensations;
|
|
2375
|
+
/**
|
|
2376
|
+
* Run one LOCAL saga compensation, retried up to `compensationRetries`, emitting a
|
|
2377
|
+
* `compensate:<step>` step event for its outcome so a stranded undo is visible. Never throws — a
|
|
2378
|
+
* permanently-failing compensation is skipped so it can't mask the original failure. Checkpoints
|
|
2379
|
+
* its outcome at `seq` (a negative unwind position reserved by {@link unwindCompensations}) so a
|
|
2380
|
+
* crash mid-unwind skips an already-resolved undo on a later pass instead of re-running it (and
|
|
2381
|
+
* re-spending its retry budget) from attempt 1 — the checkpoint is durability/visibility only; the
|
|
2382
|
+
* runtime retry-in-process-back-to-back semantics of `comp.fn()` are unchanged.
|
|
2287
2383
|
*/
|
|
2288
2384
|
private runCompensation;
|
|
2385
|
+
/**
|
|
2386
|
+
* Resolve (or advance) ONE dispatched saga compensation at its reserved negative `seq` — the undo
|
|
2387
|
+
* handler is an ordinary remote `@Step`, so this mirrors `callRemote`'s pending/failed/absent
|
|
2388
|
+
* branches (engine.ts's `callRemote`), minus the queue/admission and in-memory-`timeoutMs` paths
|
|
2389
|
+
* (V1: dispatch direct by name, always durable). Returns the wait signal when the run must pause for
|
|
2390
|
+
* this compensation (freshly dispatched, still in flight, or backing off before a durable retry);
|
|
2391
|
+
* `undefined` once it's resolved — completed (crash-safe skip), or retries exhausted/non-retryable
|
|
2392
|
+
* (already visible: `completeRemoteResult` emitted `step.failed` for `compensate:<name>` when that
|
|
2393
|
+
* checkpoint landed — never re-emitted here, and never allowed to block the rest of the unwind or
|
|
2394
|
+
* mask the run's original failure).
|
|
2395
|
+
*/
|
|
2396
|
+
private dispatchCompensation;
|
|
2397
|
+
/**
|
|
2398
|
+
* Dispatch (or re-dispatch, on a durable retry) one compensation's undo handler — mirrors
|
|
2399
|
+
* `callRemote`'s dispatch block (persist the `pending` checkpoint BEFORE handing off to the
|
|
2400
|
+
* transport, so a fast result always finds it to complete). Two DIFFERENT names are in play: the
|
|
2401
|
+
* checkpoint's `name` is `compensate:<originalStepName>` (what makes this undo show up on the run's
|
|
2402
|
+
* timeline, and what `completeRemoteResult` emits `step.completed`/`step.failed` under); the WIRE
|
|
2403
|
+
* task's `name` is the undo handler's OWN routing name (`def.name`) — a worker dispatches to the
|
|
2404
|
+
* `@Step` it registered, not to this saga-visibility label.
|
|
2405
|
+
*/
|
|
2406
|
+
private dispatchCompensationAttempt;
|
|
2289
2407
|
/** The seam handed to {@link createWorkflowCtx}: the authoring API reaches durability + lifecycle
|
|
2290
2408
|
* (checkpointing, dispatch, child start) through this, so the ctx primitives live in their own
|
|
2291
2409
|
* module and the engine stays the orchestrator. */
|
|
@@ -2365,6 +2483,79 @@ declare class RemoteStepError extends Error {
|
|
|
2365
2483
|
constructor(stepError?: StepError);
|
|
2366
2484
|
}
|
|
2367
2485
|
|
|
2486
|
+
/**
|
|
2487
|
+
* What the class-first statics need from whoever registered the workflow class: the engine, or a
|
|
2488
|
+
* store-less start facade (a tenant's `DurableStartClient`). `waitForRun` is optional — a facade
|
|
2489
|
+
* without a store cannot wait, so `execute` outside a workflow throws a clear error there.
|
|
2490
|
+
*/
|
|
2491
|
+
interface WorkflowStartClient {
|
|
2492
|
+
start(workflow: string, input: unknown, runId: string, opts?: StartOptions): Promise<RunResult>;
|
|
2493
|
+
waitForRun?(runId: string, opts?: {
|
|
2494
|
+
timeoutMs?: number;
|
|
2495
|
+
until?: 'settled' | 'terminal';
|
|
2496
|
+
}): Promise<RunResult>;
|
|
2497
|
+
}
|
|
2498
|
+
/**
|
|
2499
|
+
* Bind a `@Workflow` class to the client that can start it — called by the registrar for every
|
|
2500
|
+
* discovered workflow at boot. This is what lets `MyWorkflow.start()` resolve THE engine that
|
|
2501
|
+
* registered it, with no global engine singleton (two engines in one process each bind their own
|
|
2502
|
+
* classes).
|
|
2503
|
+
*/
|
|
2504
|
+
declare function bindWorkflowClass(ctor: Function, client: WorkflowStartClient): void;
|
|
2505
|
+
/**
|
|
2506
|
+
* Optional base class giving a `@Workflow` a **class-first API** — start it from anywhere without
|
|
2507
|
+
* injecting the engine or `WorkflowService`:
|
|
2508
|
+
*
|
|
2509
|
+
* ```ts
|
|
2510
|
+
* @Workflow({ name: 'checkout', version: '1' })
|
|
2511
|
+
* export class CheckoutWorkflow extends DurableWorkflow {
|
|
2512
|
+
* async run(ctx: WorkflowCtx, order: Order) { ... }
|
|
2513
|
+
* }
|
|
2514
|
+
*
|
|
2515
|
+
* const { runId } = await CheckoutWorkflow.start(order); // fire-and-forget, typed input
|
|
2516
|
+
* const result = await CheckoutWorkflow.execute(order); // run-and-await, typed output
|
|
2517
|
+
* ```
|
|
2518
|
+
*
|
|
2519
|
+
* Each method means the same thing everywhere; only the mechanism adapts to where you call it:
|
|
2520
|
+
*
|
|
2521
|
+
* - {@link DurableWorkflow.start | `start`} — **fire-and-forget**. Outside a workflow it is exactly
|
|
2522
|
+
* `engine.start` (enqueue, return `{ runId, status }` immediately). Inside a workflow body it
|
|
2523
|
+
* becomes `ctx.startChild` — checkpointed, replay-safe, parent-linked — same contract.
|
|
2524
|
+
* - {@link DurableWorkflow.execute | `execute`} — **run-and-await the typed output**. Inside a
|
|
2525
|
+
* workflow it is `ctx.child` (the parent suspends with zero compute and resumes with the result).
|
|
2526
|
+
* Outside it starts the run and waits until it settles terminally, resolving the output or
|
|
2527
|
+
* throwing `FatalError` when the run failed/cancelled/dead.
|
|
2528
|
+
*
|
|
2529
|
+
* Inside-ness is detected via the ambient workflow context the engine installs around every body
|
|
2530
|
+
* execution (see `ambient-ctx.ts`). A `@Step` handler runs on a worker, off the body's path — the
|
|
2531
|
+
* statics there start a TOP-LEVEL run, which is correct: a handler is not the workflow body.
|
|
2532
|
+
*/
|
|
2533
|
+
declare class DurableWorkflow {
|
|
2534
|
+
/**
|
|
2535
|
+
* Fire-and-forget start — `engine.start` outside a workflow, `ctx.startChild` (parent-linked)
|
|
2536
|
+
* inside one. `opts.id` pins the run id (outside) / child id (inside) for idempotent starts.
|
|
2537
|
+
*/
|
|
2538
|
+
static start<C extends WorkflowClass>(this: C, input: WorkflowInputOf<C>, opts?: {
|
|
2539
|
+
id?: string;
|
|
2540
|
+
} & StartOptions): Promise<RunResult>;
|
|
2541
|
+
/**
|
|
2542
|
+
* Run-and-await the typed output — `ctx.child` inside a workflow (suspends the parent, zero
|
|
2543
|
+
* compute); outside, starts the run and waits until it settles terminally. Throws `FatalError`
|
|
2544
|
+
* when the run does not complete. `opts.timeoutMs` bounds the OUTSIDE wait only (inside, a
|
|
2545
|
+
* suspended parent costs nothing — bound the child itself with `executionTimeout` instead).
|
|
2546
|
+
*/
|
|
2547
|
+
static execute<C extends WorkflowClass>(this: C, input: WorkflowInputOf<C>, opts?: {
|
|
2548
|
+
id?: string;
|
|
2549
|
+
timeoutMs?: number;
|
|
2550
|
+
} & StartOptions): Promise<WorkflowOutputOf<C>>;
|
|
2551
|
+
}
|
|
2552
|
+
|
|
2553
|
+
/**
|
|
2554
|
+
* Parse a human duration to milliseconds. Accepts a number (already ms) or a string like
|
|
2555
|
+
* `'500ms'`, `'30s'`, `'15m'`, `'2h'`, `'7d'`, `'7 days'`.
|
|
2556
|
+
*/
|
|
2557
|
+
declare function parseDuration(duration: string | number): number;
|
|
2558
|
+
|
|
2368
2559
|
/**
|
|
2369
2560
|
* Thrown inside a step to signal an unrecoverable failure: the engine will NOT retry it,
|
|
2370
2561
|
* regardless of the step's `retries` setting, and fails the run immediately. Use it for
|
|
@@ -2935,4 +3126,4 @@ declare class InMemoryTransport implements Transport, ControlPlane {
|
|
|
2935
3126
|
onControl(handler: (msg: ControlMessage) => void): void;
|
|
2936
3127
|
}
|
|
2937
3128
|
|
|
2938
|
-
export { type AccumulatorHost, type Admission, type AdmissionBackend, type AdmissionItem, type AttributeFilter, type AttributeOp, type BackoffStrategy, type ChildCallOptions, CodecStateStore, ContinueAsNew, type ControlMessage, type ControlPlane, DURABLE_OPTIONS, DURABLE_OPTIONS_CANONICAL, DURABLE_STEP_CONFIG, DURABLE_STEP_NAME, type DurableWebhook, type EngineEvent, type EngineEventType, type EngineListener, Entities, type EntityConfig, type EntityHandler, type EntityHost, EventAccumulators, type EventBatchConfig, FatalError, GatherError, type GroupHealth, type Heartbeat, type HistoryEvent, InMemoryAdmissionBackend, InMemoryStateStore, InMemoryTransport, type MetricsCollector, type MetricsSnapshot, type NamedTransport, NonDeterminismError, type PayloadCodec, type QueueConfig, QueueController, RemoteStepError, RemoteStepTimeout, type RemoteTask, RemoteWorkflowExecutor, RemoteWorkflowTimeout, type RetentionPolicy, type RunAttributeRow, type RunDetail, type RunDispatcher, type RunGateway, type RunQuery, type RunReply, type RunReplyResult, type RunRequest, type RunRequestKind, type RunResult, type RunSchedulesOptions, type RunStatus, STATE_STORE, STATE_STORE_CANONICAL, type ScheduledWorkflow, type SearchAttributes, SignalTimeoutError, type SignalWaiter, type SingletonConfig, SingletonQueueFullError, type StartOptions, type StartRunMessage, type StateStore, type StepCheckpoint, type StepConfig, type StepDef, type StepDispatchOpts, type StepError, type StepEvent, type StepHandler, type StepInterceptor, type StepInvocation, type StepKind, type StepLogger, type StepOptions, type StepRef, type StepResult, type StoreTransaction, type SubProcessHandle, TERMINAL_RUN_STATUSES, TRANSPORT, TRANSPORT_CANONICAL, type TenantEvent, type Transport, type UpdateResult, type UpdateValidator, WORKFLOW_NAME_KEY, type WorkerAdjust, type WorkerConcurrencyStatus, type WorkerHeartbeat, type WorkerStatus, type WorkflowClass, type WorkflowCommand, type WorkflowCtx, type WorkflowDecision, WorkflowEngine, type WorkflowEngineDeps, type WorkflowExecutor, type WorkflowInputOf, type WorkflowOutputOf, type WorkflowRef, type WorkflowRun, type WorkflowStepEvent, WorkflowSuspended, type WorkflowTask, applyAttributeQuery, attributeColumnFor, attributeOperand, breakpointToken, collectMetrics, createStepLogger, eventMatchOf, eventMatches, eventPrefix, eventToken, matchesAttributes, normalizeAttributeRows, parseDuration, prevCronFireMs, runSchedules, runStepHandler, sanitizeQueueToken, scheduledRunId, sqlComparator, stepConfigOf, stepId, stepNameOf, tenantGroup, workflowName };
|
|
3129
|
+
export { type AccumulatorHost, type Admission, type AdmissionBackend, type AdmissionItem, type AttributeFilter, type AttributeOp, type BackoffStrategy, type ChildCallOptions, CodecStateStore, ContinueAsNew, type ControlMessage, type ControlPlane, DURABLE_OPTIONS, DURABLE_OPTIONS_CANONICAL, DURABLE_STEP_CONFIG, DURABLE_STEP_NAME, type DurableWebhook, DurableWorkflow, type EngineEvent, type EngineEventType, type EngineListener, Entities, type EntityConfig, type EntityHandler, type EntityHost, EventAccumulators, type EventBatchConfig, FatalError, GatherError, type GroupHealth, type Heartbeat, type HistoryEvent, InMemoryAdmissionBackend, InMemoryStateStore, InMemoryTransport, type MetricsCollector, type MetricsSnapshot, type NamedTransport, NonDeterminismError, type PayloadCodec, type QueueConfig, QueueController, RemoteStepError, RemoteStepTimeout, type RemoteTask, RemoteWorkflowExecutor, RemoteWorkflowTimeout, type RetentionPolicy, type RunAttributeRow, type RunDetail, type RunDispatcher, type RunGateway, type RunQuery, type RunReply, type RunReplyResult, type RunRequest, type RunRequestKind, type RunResult, type RunSchedulesOptions, type RunStatus, STATE_STORE, STATE_STORE_CANONICAL, type ScheduledWorkflow, type SearchAttributes, SignalTimeoutError, type SignalWaiter, type SingletonConfig, SingletonQueueFullError, type StartOptions, type StartRunMessage, type StateStore, type StepCheckpoint, type StepConfig, type StepDef, type StepDispatchOpts, type StepError, type StepEvent, type StepHandler, type StepInterceptor, type StepInvocation, type StepKind, type StepLogger, type StepOptions, type StepRef, type StepResult, type StepUndo, type StoreTransaction, type SubProcessHandle, TERMINAL_RUN_STATUSES, TRANSPORT, TRANSPORT_CANONICAL, type TenantEvent, type Transport, type UndoOf, type UpdateResult, type UpdateValidator, WORKFLOW_NAME_KEY, type WorkerAdjust, type WorkerConcurrencyStatus, type WorkerHeartbeat, type WorkerStatus, type WorkflowClass, type WorkflowCommand, type WorkflowCtx, type WorkflowDecision, WorkflowEngine, type WorkflowEngineDeps, type WorkflowExecutor, type WorkflowInputOf, type WorkflowOutputOf, type WorkflowRef, type WorkflowRun, type WorkflowStartClient, type WorkflowStepEvent, WorkflowSuspended, type WorkflowTask, applyAttributeQuery, attributeColumnFor, attributeOperand, bindWorkflowClass, breakpointToken, collectMetrics, createStepLogger, currentWorkflowCtx, eventMatchOf, eventMatches, eventPrefix, eventToken, matchesAttributes, normalizeAttributeRows, parseDuration, prevCronFireMs, runInWorkflowCtx, runSchedules, runStepHandler, sanitizeQueueToken, scheduledRunId, sqlComparator, stepConfigOf, stepId, stepNameOf, tenantGroup, workflowName };
|