@dudousxd/nestjs-durable-core 0.81.0 → 0.82.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 +285 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +191 -14
- package/dist/index.d.ts +191 -14
- package/dist/index.js +282 -25
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1285,8 +1285,15 @@ interface StateStore {
|
|
|
1285
1285
|
* acquired — so concurrent engine instances never recover the same run twice.
|
|
1286
1286
|
*/
|
|
1287
1287
|
tryLockRun(runId: string, owner: string, leaseUntilMs: number, nowMs: number): Promise<boolean>;
|
|
1288
|
-
/**
|
|
1289
|
-
|
|
1288
|
+
/**
|
|
1289
|
+
* Release a run's recovery lease so another instance can pick it up (e.g. once it suspends).
|
|
1290
|
+
*
|
|
1291
|
+
* `owner`, when given, makes the release owner-scoped: clear the lease ONLY if `owner` still holds
|
|
1292
|
+
* it, so an instance releasing a lease it may have lost (a drain that timed out) never frees the
|
|
1293
|
+
* lease another instance took over. Without it the release is unconditional. A store that ignores
|
|
1294
|
+
* the argument stays correct, only less precise in that race.
|
|
1295
|
+
*/
|
|
1296
|
+
releaseRunLock(runId: string, owner?: string): Promise<void>;
|
|
1290
1297
|
/**
|
|
1291
1298
|
* Extend a run's lease to `leaseUntilMs`, but ONLY if `owner` still holds it — so a live worker
|
|
1292
1299
|
* heartbeating its long run keeps the lease, while a dead worker's lease still expires and gets
|
|
@@ -4003,6 +4010,60 @@ declare class ScheduleClient {
|
|
|
4003
4010
|
private write;
|
|
4004
4011
|
}
|
|
4005
4012
|
|
|
4013
|
+
/** Default idle threshold for a stranded run: 15 minutes. */
|
|
4014
|
+
declare const DEFAULT_STALLED_AFTER_MS: number;
|
|
4015
|
+
/** The oldest unresolved remote step of a run — the lost-dispatch signature when it is old. */
|
|
4016
|
+
interface StalePendingStep {
|
|
4017
|
+
seq: number;
|
|
4018
|
+
name: string;
|
|
4019
|
+
/** How many times this step has been (re-)dispatched. A lost dispatch typically sits at 1. */
|
|
4020
|
+
attempts: number;
|
|
4021
|
+
/** Milliseconds since the step was enqueued to the transport. */
|
|
4022
|
+
ageMs: number;
|
|
4023
|
+
/**
|
|
4024
|
+
* The step's lease (`wakeAt`, epoch ms) when it has one: a step with a `timeoutMs`, a heartbeat
|
|
4025
|
+
* renewing it, or `remoteRedispatchMs`. `null` when nothing is leasing the step.
|
|
4026
|
+
*/
|
|
4027
|
+
leaseUntil: number | null;
|
|
4028
|
+
}
|
|
4029
|
+
/** What an `engine.onStalled` listener (and {@link findStalledRuns}) receives: a stranded run and why. */
|
|
4030
|
+
interface StalledRunInfo {
|
|
4031
|
+
run: WorkflowRun;
|
|
4032
|
+
/** Milliseconds since the run's last activity (`updatedAt`). */
|
|
4033
|
+
ageMs: number;
|
|
4034
|
+
/** Suspended with NO wake timer — nothing will re-drive it (the `reconcileMs: 0` hazard). */
|
|
4035
|
+
wakeForever: boolean;
|
|
4036
|
+
/** The oldest pending remote step with no live lease, when that is the stranding signature. */
|
|
4037
|
+
stalePending: StalePendingStep | null;
|
|
4038
|
+
}
|
|
4039
|
+
/** Options for {@link findStalledRuns}. */
|
|
4040
|
+
interface FindStalledRunsOptions {
|
|
4041
|
+
/** Idle threshold in ms. Default {@link DEFAULT_STALLED_AFTER_MS}. */
|
|
4042
|
+
thresholdMs?: number | undefined;
|
|
4043
|
+
/** Max candidate runs inspected (newest first). Default 1000. */
|
|
4044
|
+
scan?: number | undefined;
|
|
4045
|
+
/** Evaluate as of this time (epoch ms). Default `Date.now()`. */
|
|
4046
|
+
now?: number | undefined;
|
|
4047
|
+
/** Only runs in this namespace. Omit for every namespace. */
|
|
4048
|
+
namespace?: string | undefined;
|
|
4049
|
+
}
|
|
4050
|
+
/**
|
|
4051
|
+
* The stranded runs in a store right now — the query behind `engine.sweepStalled`/`onStalled`,
|
|
4052
|
+
* `engine.listStalledRuns` and the CLI's `durable inspect --stale`. Works on a bare store, so an
|
|
4053
|
+
* ops script or a CLI can run it without an engine.
|
|
4054
|
+
*
|
|
4055
|
+
* A `running`/`suspended` run qualifies when it has been untouched for `thresholdMs` AND either:
|
|
4056
|
+
*
|
|
4057
|
+
* - it is suspended with NO wake timer (`wakeForever`): nothing will ever re-drive it; or
|
|
4058
|
+
* - its oldest pending REMOTE step is older than the threshold and has no lease in the future
|
|
4059
|
+
* (`stalePending`): the dispatch was most likely lost.
|
|
4060
|
+
*
|
|
4061
|
+
* Healthy long work is excluded: a long `ctx.sleep` has a future `wakeAt` and no pending step, and a
|
|
4062
|
+
* remote step with a `timeoutMs`, a heartbeat or `remoteRedispatchMs` carries a future lease. Issues
|
|
4063
|
+
* one `listCheckpoints` per idle candidate, bounded by `scan`: an operator read, not a hot path.
|
|
4064
|
+
*/
|
|
4065
|
+
declare function findStalledRuns(store: Pick<StateStore, 'listRuns' | 'listCheckpoints'>, options?: FindStalledRunsOptions): Promise<StalledRunInfo[]>;
|
|
4066
|
+
|
|
4006
4067
|
type WorkflowFn = (ctx: InternalWorkflowCtx, input: unknown) => Promise<unknown>;
|
|
4007
4068
|
/**
|
|
4008
4069
|
* Options for {@link WorkflowEngine.start}.
|
|
@@ -4179,6 +4240,14 @@ interface WorkflowEngineDeps {
|
|
|
4179
4240
|
* for a genuinely-orphaned run. Default 5min; set `0` to disable (the prior wake-forever behavior).
|
|
4180
4241
|
*/
|
|
4181
4242
|
reconcileMs?: number | undefined;
|
|
4243
|
+
/**
|
|
4244
|
+
* How long an in-flight run must sit untouched, with the stranded signature (a wake-forever
|
|
4245
|
+
* suspension, or an old pending remote step with no live lease), before the
|
|
4246
|
+
* {@link WorkflowEngine.onStalled} listeners are notified. Default 900 000 (15 min); floored at
|
|
4247
|
+
* 60 000. The sweep ({@link WorkflowEngine.sweepStalled}) only does work when a listener is
|
|
4248
|
+
* registered.
|
|
4249
|
+
*/
|
|
4250
|
+
stalledAfterMs?: number | undefined;
|
|
4182
4251
|
/**
|
|
4183
4252
|
* The most due timers one {@link WorkflowEngine.resumeDueTimers} pass loads and drives, most
|
|
4184
4253
|
* overdue first. Every driving instance runs that pass each tick, so a wave of thousands of due
|
|
@@ -4286,6 +4355,15 @@ interface WorkflowEngineDeps {
|
|
|
4286
4355
|
*/
|
|
4287
4356
|
runDispatcher?: RunDispatcher | undefined;
|
|
4288
4357
|
}
|
|
4358
|
+
/** Options for {@link WorkflowEngine.listStalledRuns}. */
|
|
4359
|
+
interface ListStalledRunsOptions {
|
|
4360
|
+
/** Idle threshold in ms. Defaults to the engine's `stalledAfterMs` (15 min). */
|
|
4361
|
+
thresholdMs?: number | undefined;
|
|
4362
|
+
/** Max candidate runs inspected (newest first). Default 1000. */
|
|
4363
|
+
scan?: number | undefined;
|
|
4364
|
+
/** Evaluate as of this clock time. Defaults to the engine clock. */
|
|
4365
|
+
now?: number | undefined;
|
|
4366
|
+
}
|
|
4289
4367
|
/**
|
|
4290
4368
|
* The orchestrator. Owns workflow state and replays runs deterministically: each step's
|
|
4291
4369
|
* result is checkpointed, so on resume a completed step returns its saved output instead of
|
|
@@ -4410,6 +4488,18 @@ declare class WorkflowEngine {
|
|
|
4410
4488
|
private readonly stepQueue;
|
|
4411
4489
|
/** Executions currently in flight, so a graceful shutdown can wait for them to settle. */
|
|
4412
4490
|
private readonly inflight;
|
|
4491
|
+
/**
|
|
4492
|
+
* The run lease of each execution in flight on THIS instance, by run id — renewed while it runs
|
|
4493
|
+
* and checked by every settle (the zombie fence, see {@link ExecutionLease}). Also what `drain()`
|
|
4494
|
+
* releases when its budget runs out.
|
|
4495
|
+
*/
|
|
4496
|
+
private readonly executionLeases;
|
|
4497
|
+
/** Pager hooks for stranded runs (see {@link onStalled}). */
|
|
4498
|
+
private readonly stalledListeners;
|
|
4499
|
+
/** Runs already paged about, by id → the `updatedAt` of the paged episode (see {@link sweepStalled}). */
|
|
4500
|
+
private readonly notifiedStalled;
|
|
4501
|
+
private lastStalledSweepAt;
|
|
4502
|
+
private readonly stalledAfterMs;
|
|
4413
4503
|
private draining;
|
|
4414
4504
|
/** Wait already spent on this shutdown before `drain()` (see `beginDrain`). */
|
|
4415
4505
|
private drainSpentMs;
|
|
@@ -4575,6 +4665,33 @@ declare class WorkflowEngine {
|
|
|
4575
4665
|
* Returns an unsubscribe function.
|
|
4576
4666
|
*/
|
|
4577
4667
|
onDead(listener: (run: WorkflowRun) => void): () => void;
|
|
4668
|
+
/**
|
|
4669
|
+
* Register a pager hook for STRANDED runs: an in-flight run untouched past `stalledAfterMs` that is
|
|
4670
|
+
* either suspended with NO wake timer (wake-forever: nothing will ever re-drive it) or parked on an
|
|
4671
|
+
* old pending remote step with no live lease (dispatched and, most likely, lost). The timer poller
|
|
4672
|
+
* sweeps for these ({@link sweepStalled}, throttled to one pass a minute) and notifies each episode
|
|
4673
|
+
* ONCE per instance: a run is paged again only after it makes progress and strands again. Wire your
|
|
4674
|
+
* alerting here like {@link onDead}. A listener that throws never breaks the sweep. Returns an
|
|
4675
|
+
* unsubscribe function.
|
|
4676
|
+
*/
|
|
4677
|
+
onStalled(listener: (info: StalledRunInfo) => void): () => void;
|
|
4678
|
+
/**
|
|
4679
|
+
* Detect stranded in-flight runs and notify the {@link onStalled} listeners. Self-throttled to one
|
|
4680
|
+
* pass a minute, skipped while draining, and a no-op without listeners — call it every tick (the
|
|
4681
|
+
* NestJS timer poller does). Scoped to this engine's `namespace` (an operator engine with no
|
|
4682
|
+
* namespace sweeps every namespace). Returns the runs notified THIS pass.
|
|
4683
|
+
*/
|
|
4684
|
+
sweepStalled(now?: number): Promise<StalledRunInfo[]>;
|
|
4685
|
+
/**
|
|
4686
|
+
* The stranded runs right now, without notifying anyone: the query behind {@link sweepStalled} and
|
|
4687
|
+
* the CLI's `durable inspect --stale`. A `running`/`suspended` run qualifies when it has been
|
|
4688
|
+
* untouched for `thresholdMs` (default `stalledAfterMs`) AND either it is suspended with no wake
|
|
4689
|
+
* timer, or its oldest pending remote step is older than the threshold with no lease in the future
|
|
4690
|
+
* (a step with a `timeoutMs`, a heartbeat or `remoteRedispatchMs` keeps a lease; a long
|
|
4691
|
+
* `ctx.sleep` has a future `wakeAt`; neither is stranded). Scans up to `scan` candidates (default
|
|
4692
|
+
* 1000), newest first, in this engine's namespace.
|
|
4693
|
+
*/
|
|
4694
|
+
listStalledRuns(options?: ListStalledRunsOptions): Promise<StalledRunInfo[]>;
|
|
4578
4695
|
private notifyDead;
|
|
4579
4696
|
/** Emit a locally-produced lifecycle event: deliver to subscribers AND broadcast it on the
|
|
4580
4697
|
* control plane so other instances (e.g. a dashboard pod) can live-tail this run. */
|
|
@@ -4586,6 +4703,9 @@ declare class WorkflowEngine {
|
|
|
4586
4703
|
start<TInput>(workflow: string, input: TInput, runId: string, opts?: StartOptions): Promise<RunResult>;
|
|
4587
4704
|
/** Read a run's current persisted state (or null if unknown). A thin pass-through to the store. */
|
|
4588
4705
|
getRun(runId: string): Promise<WorkflowRun | null>;
|
|
4706
|
+
/** A run's full checkpoint timeline, ordered by seq. A thin pass-through to the store (it is what
|
|
4707
|
+
* the testing kit's `captureHistory` reads, next to {@link getRun}). */
|
|
4708
|
+
listCheckpoints(runId: string): Promise<StepCheckpoint[]>;
|
|
4589
4709
|
/**
|
|
4590
4710
|
* Re-execute a run's body (replaying its checkpoints). This is the EXPLICIT entry point: besides
|
|
4591
4711
|
* driving a live run, it re-drives a `failed` run — the manual retry (prefer {@link requeue}, which
|
|
@@ -4737,6 +4857,16 @@ declare class WorkflowEngine {
|
|
|
4737
4857
|
* for part of it waits only for the remainder. With nothing reported, the full `timeoutMs` applies.
|
|
4738
4858
|
*/
|
|
4739
4859
|
drain(timeoutMs?: number): Promise<void>;
|
|
4860
|
+
/**
|
|
4861
|
+
* The drain budget ran out with executions still in flight: release their recovery leases so
|
|
4862
|
+
* another instance re-drives those runs on its next recovery pass, instead of waiting out
|
|
4863
|
+
* `leaseMs` after this process exits. Each still-running turn is FENCED first, so whatever it
|
|
4864
|
+
* computes after this point is never written over the new owner's work (see settleRun). Its
|
|
4865
|
+
* completed steps are checkpointed, so the new owner replays them; a step still executing here
|
|
4866
|
+
* may run again there, exactly as after a crash. The release is owner-scoped where the store
|
|
4867
|
+
* supports it (only a lease this instance still holds is cleared). Best effort: never throws.
|
|
4868
|
+
*/
|
|
4869
|
+
private releaseInflightLeases;
|
|
4740
4870
|
/**
|
|
4741
4871
|
* Cancel in-flight runs that have outlived their workflow's `executionTimeout`. Call it from the
|
|
4742
4872
|
* timer poller alongside {@link resumeDueTimers}. A timed-out run is moved to `cancelled` with an
|
|
@@ -5281,6 +5411,26 @@ declare class WorkflowEngine {
|
|
|
5281
5411
|
private markStarted;
|
|
5282
5412
|
private singletonWaitResult;
|
|
5283
5413
|
private execute;
|
|
5414
|
+
/**
|
|
5415
|
+
* Renew `runId`'s lease for as long as this execution holds it, and register it in
|
|
5416
|
+
* {@link executionLeases} so settles can check the zombie fence and `drain()` can release it.
|
|
5417
|
+
*
|
|
5418
|
+
* A renewal that returns `false` means the lease is gone: this turn stalled past `leaseMs` and
|
|
5419
|
+
* another instance reclaimed the run, so this executor is now a zombie. It is FENCED (`lost`): its
|
|
5420
|
+
* settles degrade to an echo of the store's state instead of clobbering the new owner's writes, and
|
|
5421
|
+
* its own lease release is skipped (it would free the new owner's lease). A renewal that THROWS (a
|
|
5422
|
+
* transient store error) is not evidence of a takeover, so it stays swallowed and the next
|
|
5423
|
+
* interval retries. A lease this execution released on purpose (`handedOff`) is not renewed, and a
|
|
5424
|
+
* renewal resolving after the execution ended (`done`) fences nothing.
|
|
5425
|
+
*/
|
|
5426
|
+
private holdExecutionLease;
|
|
5427
|
+
/** Whether `runId`'s execution on this instance lost its lease (see {@link holdExecutionLease}). */
|
|
5428
|
+
private isFenced;
|
|
5429
|
+
/**
|
|
5430
|
+
* Mark `runId`'s lease as given away on purpose by its own execution (released mid-turn), so a
|
|
5431
|
+
* renewal that now fails is not read as a takeover.
|
|
5432
|
+
*/
|
|
5433
|
+
private handOffLease;
|
|
5284
5434
|
/**
|
|
5285
5435
|
* Advance a remote (cross-SDK) workflow one turn: hand its history to the executor (which dispatches
|
|
5286
5436
|
* a workflow task to the worker and awaits its replay) and apply the decision. Mirrors
|
|
@@ -5794,6 +5944,14 @@ declare class DurableWorkflow {
|
|
|
5794
5944
|
*/
|
|
5795
5945
|
declare function parseDuration(duration: string | number): number;
|
|
5796
5946
|
|
|
5947
|
+
/**
|
|
5948
|
+
* Format marker of a run-history replay fixture (`{ version, run, checkpoints }`). Written by the
|
|
5949
|
+
* testing kit's `serializeRunHistory` and the CLI's `durable export`, checked by `parseRunHistory`.
|
|
5950
|
+
* Lives in core so both writers (which already depend on core, not on each other) share one value.
|
|
5951
|
+
* Bump it only when the fixture shape changes incompatibly.
|
|
5952
|
+
*/
|
|
5953
|
+
declare const RUN_HISTORY_FIXTURE_VERSION = 1;
|
|
5954
|
+
|
|
5797
5955
|
/**
|
|
5798
5956
|
* Thrown inside a step to signal an unrecoverable failure: the engine will NOT retry it,
|
|
5799
5957
|
* regardless of the step's `retries` setting, and fails the run immediately. Use it for
|
|
@@ -6256,26 +6414,45 @@ interface PayloadCodec {
|
|
|
6256
6414
|
encode(value: unknown): unknown;
|
|
6257
6415
|
decode(value: unknown): unknown;
|
|
6258
6416
|
}
|
|
6417
|
+
/** What {@link CodecStateStore} runs through the codec. */
|
|
6418
|
+
interface CodecStateStoreOptions {
|
|
6419
|
+
/**
|
|
6420
|
+
* `'payloads'` (default, the historical behaviour): run/step `input` + `output` only (plus a
|
|
6421
|
+
* schedule's `input` and buffered signal/event payloads, which are always encoded). **Know what
|
|
6422
|
+
* that leaves in the clear**: step `events` (everything step code passes to `ctx.log` and every
|
|
6423
|
+
* sub-step outcome) and the structured step/run `error` (message, stack, details). A deployment
|
|
6424
|
+
* sold as "encrypted payloads" still leaks whatever its steps log or throw.
|
|
6425
|
+
*
|
|
6426
|
+
* `'extended'`: also encode step `events`, step `error` and run `error`. Searchable metadata (ids,
|
|
6427
|
+
* status, workflow, tags, search attributes, namespace, origin, timestamps) stays clear — it must
|
|
6428
|
+
* remain queryable. ONLY enable on a FRESH table, or with a codec whose `decode` recognizes its own
|
|
6429
|
+
* ciphertext and passes other values through: rows written before the switch hold those fields as
|
|
6430
|
+
* plaintext, and a decode that can't tell would garble them.
|
|
6431
|
+
*/
|
|
6432
|
+
coverage?: 'payloads' | 'extended';
|
|
6433
|
+
}
|
|
6259
6434
|
/**
|
|
6260
|
-
* A `StateStore` decorator that runs run/step **payloads**
|
|
6261
|
-
*
|
|
6262
|
-
*
|
|
6263
|
-
*
|
|
6435
|
+
* A `StateStore` decorator that runs run/step **payloads** through a {@link PayloadCodec} — encoded
|
|
6436
|
+
* on write, decoded on read — so they're never stored in the clear. Adapter-agnostic: wrap any
|
|
6437
|
+
* store. Searchable metadata (id, status, workflow, tags, timestamps) is left untouched so the
|
|
6438
|
+
* dashboard, queries, and recovery still work. See {@link CodecStateStoreOptions.coverage} for
|
|
6439
|
+
* exactly which fields are covered — the default covers `input`/`output` only.
|
|
6264
6440
|
*
|
|
6265
6441
|
* ```ts
|
|
6266
|
-
* const store = new CodecStateStore(new TypeOrmStateStore(ds), aesCodec);
|
|
6442
|
+
* const store = new CodecStateStore(new TypeOrmStateStore(ds), aesCodec, { coverage: 'extended' });
|
|
6267
6443
|
* ```
|
|
6268
6444
|
*/
|
|
6269
6445
|
declare class CodecStateStore implements StateStore {
|
|
6270
6446
|
private readonly inner;
|
|
6271
6447
|
private readonly codec;
|
|
6448
|
+
private readonly extended;
|
|
6272
6449
|
/** Atomic claims touch only searchable metadata and bypass payload encoding. */
|
|
6273
6450
|
readonly tryAdmitSingleton?: (runId: string, tag: string, workflow: string, limit: number, retryWakeAt?: number) => Promise<boolean>;
|
|
6274
6451
|
/**
|
|
6275
6452
|
* Forwarded verbatim — a facet cell counts `status`/`origin`, neither of which the codec touches
|
|
6276
|
-
* (it encodes payloads: input/output/error). Bound as a
|
|
6277
|
-
* actually aggregates, so `store.runFacets?.()` still
|
|
6278
|
-
* of resolving to a silently wrong empty result.
|
|
6453
|
+
* (it encodes payloads: input/output, plus events/error under `extended` coverage). Bound as a
|
|
6454
|
+
* PROPERTY, and only when the inner store actually aggregates, so `store.runFacets?.()` still
|
|
6455
|
+
* reports absence through the wrapper instead of resolving to a silently wrong empty result.
|
|
6279
6456
|
*/
|
|
6280
6457
|
readonly runFacets?: (query: RunFacetQuery) => Promise<RunFacetRow[]>;
|
|
6281
6458
|
/**
|
|
@@ -6329,7 +6506,7 @@ declare class CodecStateStore implements StateStore {
|
|
|
6329
6506
|
readonly updateSchedule?: (id: string, patch: Partial<Omit<ScheduleRecord, 'id' | 'createdAt'>>, expectedNextFireAt?: number | null) => Promise<boolean>;
|
|
6330
6507
|
readonly deleteSchedule?: (id: string) => Promise<boolean>;
|
|
6331
6508
|
readonly listSchedules?: (query: ScheduleQuery) => Promise<ScheduleRecord[]>;
|
|
6332
|
-
constructor(inner: StateStore, codec: PayloadCodec);
|
|
6509
|
+
constructor(inner: StateStore, codec: PayloadCodec, options?: CodecStateStoreOptions);
|
|
6333
6510
|
private enc;
|
|
6334
6511
|
private dec;
|
|
6335
6512
|
private encRun;
|
|
@@ -6355,7 +6532,7 @@ declare class CodecStateStore implements StateStore {
|
|
|
6355
6532
|
listPendingRuns(limit: number, namespace?: string): Promise<WorkflowRun[]>;
|
|
6356
6533
|
listDueTimers(nowMs: number, namespace?: string, limit?: number): Promise<WorkflowRun[]>;
|
|
6357
6534
|
tryLockRun(runId: string, owner: string, leaseUntilMs: number, nowMs: number): Promise<boolean>;
|
|
6358
|
-
releaseRunLock(runId: string): Promise<void>;
|
|
6535
|
+
releaseRunLock(runId: string, owner?: string): Promise<void>;
|
|
6359
6536
|
renewRunLock(runId: string, owner: string, leaseUntilMs: number): Promise<boolean>;
|
|
6360
6537
|
putSignalWaiter(waiter: SignalWaiter): Promise<void>;
|
|
6361
6538
|
takeSignalWaiter(token: string): Promise<SignalWaiter | null>;
|
|
@@ -6797,7 +6974,7 @@ declare class InMemoryStateStore implements StateStore {
|
|
|
6797
6974
|
listPendingRuns(limit: number, namespace?: string): Promise<WorkflowRun[]>;
|
|
6798
6975
|
listDueTimers(nowMs: number, namespace?: string, limit?: number): Promise<WorkflowRun[]>;
|
|
6799
6976
|
tryLockRun(runId: string, owner: string, leaseUntilMs: number, nowMs: number): Promise<boolean>;
|
|
6800
|
-
releaseRunLock(runId: string): Promise<void>;
|
|
6977
|
+
releaseRunLock(runId: string, owner?: string): Promise<void>;
|
|
6801
6978
|
renewRunLock(runId: string, owner: string, leaseUntilMs: number): Promise<boolean>;
|
|
6802
6979
|
putSignalWaiter(waiter: SignalWaiter): Promise<void>;
|
|
6803
6980
|
takeSignalWaiter(token: string): Promise<SignalWaiter | null>;
|
|
@@ -6940,4 +7117,4 @@ declare function singletonAdmissionDenialPatch(runs: WorkflowRun[], runId: strin
|
|
|
6940
7117
|
updatedAt: Date;
|
|
6941
7118
|
} | undefined;
|
|
6942
7119
|
|
|
6943
|
-
export { type AccumulatorHost, type Admission, type AdmissionBackend, type AdmissionItem, type AllOptions, type AllSettledOptions, type AllStepsOptions, type AllStepsSettledOptions, type AnnouncedWorkflow, type AnnouncementEvidence, type AttributeFilter, type AttributeOp, type AttributePredicateOperand, type AttributeValue, type BackoffStrategy, type BlockedDispatch, type BlockedResolution, CHILD_EDGE_PREFIXES, CONTROL_FLOW_SIGNAL, CURRENT_PROTOCOL_VERSION, type CapabilityRequirement, type CheckpointAggregatingStore, type CheckpointNameKind, type CheckpointQuery, type CheckpointStat, type ChildCallOptions, type ChildWait, CodecStateStore, type ConcurrencyConfig, ConcurrencyLimitError, type ConcurrencyQuota, ContinueAsNew, type ControlMessage, type ControlPlane, DEFAULT_CONCURRENCY_STATUSES, DEFAULT_PARTITION, DURABLE_OPTIONS, DURABLE_OPTIONS_CANONICAL, DURABLE_STEP_CONFIG, DURABLE_STEP_NAME, type Disagreement, type DispatchDiagnostics, type DispatchPlan, type DurableExecution, type DurableExecutionWrapper, type DurableTopology, type DurableWebhook, DurableWorkflow, type DynamicWorkflowCtx, ENGINE_MINTED_TAG_PREFIXES, ENTITY_WORKFLOW, EVENT_BUFFER_SCAN_LIMIT, EVENT_TOKEN_PREFIX, type EngineEvent, type EngineEventType, type EngineListener, Entities, type EntityConfig, type EntityHandler, type EntityHost, type EntityWorkflowHost, EventAccumulators, type EventBatchConfig, FAN_SUMMARY_FAILURES, type FanJoin, type FanPage, type FanPageQuery, type FanSummary, type FanWait, FatalError, GatherError, type GatherItemFailure, type GroupHealth, HANDOFF_SEQ_BASE, type Heartbeat, type HeartbeatSighting, type HeartbeatStatus, type HistoryEvent, InMemoryAdmissionBackend, InMemoryStateStore, InMemoryTransport, type InferSearchAttributes, LEGACY_V1_CAPABILITIES, LEGACY_V1_PROTOCOL, type MetricsCollector, type MetricsSnapshot, type NamedTransport, type NegotiateOptions, type NegotiationOutcome, type NegotiationReason, type NegotiationResult, NestedWorkflowCallError, NonDeterminismError, type OnErrorInput, type OnErrorRoute, type OwnedLeaseReclaim, type PartitionSighting, type PayloadCodec, type QueueConfig, QueueController, RUN_VALUE_FACET_LIMIT, RUN_VALUE_FACET_SCAN, type RawWorkerDescriptor, RemoteStepError, RemoteStepTimeout, type RemoteTask, RemoteWorkflowExecutor, RemoteWorkflowTimeout, type RetentionPolicy, type RoutableDispatch, type RoutableResolution, type RoutingResolution, type RunAttributeRow, type RunDetail, type RunDetailOptions, type RunDispatcher, type RunFacetQuery, type RunFacetRow, RunGateway, type RunListItem, type RunQuery, type RunReply, type RunReplyResult, type RunRequest, type RunRequestKind, type RunResult, type RunSchedulesOptions, type RunScope, type RunStatus, type RunValueAxis, type RunValueFacetOptions, type RunValueFacetOrder, type RunValueFacetRow, type RunWaiting, SINGLETON_ACTIVE_STATUSES, SINGLETON_ADMITTED_TAG, SINGLETON_RESERVED_TAGS, SINGLETON_TRACKED_TAG, STATE_STORE, STATE_STORE_CANONICAL, SUMMARY_CHILD_LIMIT, type ScalarAttributeFilter, ScheduleAlreadyExistsError, ScheduleClient, type ScheduleClientOptions, type ScheduleDescription, type ScheduleHost, type ScheduleListQuery, ScheduleNotFoundError, type ScheduleOptions, type ScheduleQuery, type ScheduleRecord, type ScheduledWorkflow, type SearchAttributes, type SearchAttributesSchema, type Settled, SignalTimeoutError, type SignalWaiter, type SingletonConfig, SingletonQueueFullError, StandardSchemaV1, 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 StepScope, type StepUndo, type StoreTransaction, type SubProcessHandle, TERMINAL_RUN_STATUSES, TRANSPORT, TRANSPORT_CANONICAL, type TenantEvent, type Transport, type UndoOf, type UpdateResult, type UpdateValidator, VERSION_UNDECLARED_TAG, WORKFLOW_NAME_KEY, type WireDates, type WorkerAdjust, type WorkerConcurrencyStatus, type WorkerDescriptor, type WorkerHeartbeat, type WorkerLifecycle, type WorkerStatus, type WorkflowAnnouncement, WorkflowBlocked, type WorkflowClass, type WorkflowCommand, type WorkflowCtx, type WorkflowDecision, type WorkflowDirectory, WorkflowEngine, type WorkflowEngineDeps, type WorkflowExecutor, type WorkflowHandler, type WorkflowInputOf, type WorkflowOutputOf, type WorkflowRef, type WorkflowRegistration, type WorkflowRun, type WorkflowStartClient, type WorkflowStepEvent, WorkflowSuspended, type WorkflowTask, aggregateAnnouncements, aggregatesCheckpoints, announcementsOf, applyAttributeQuery, assertConcurrency, assertRoutes, attributeColumnFor, attributeOperand, attributePredicateOperands, axisIsRunColumn, bindWorkflowClass, breakpointToken, buildWorkflowDirectory, canRoute, capableWorkers, checkpointNameKind, checkpointStatsOf, childIdsOf, classifyWaiterToken, clearDurableExecutionWrappers, clearTerminalSingletonAdmission, codeAndDetails, codeOf, collectMetrics, concurrencyTag, controlPlaneDescriptor, countRuns, coveredTokens, createStepLogger, currentStep, currentStepScope, currentWorkflowCtx, debug, describeWorker, descriptorHash, detailsOf, error, etagMatches, eventMatchOf, eventMatches, eventNameOf, eventPrefix, eventToken, facetOrigin, fanPageBounds, fanPageEtag, foldedCount, handoffHandlerId, handoffName, hasDurableExecutionWrappers, heartbeatStatus, indexWaitersByRun, info, isEngineMintedTag, isEventToken, isFailedMember, isLegacyDescriptor, isNonEmptyRunScope, isWorkflowControlFlowSignal, legacySingletonHolders, listSignalWaitersOfRuns, liveHandoff, log, matchesAttributes, mergeRunFacetRows, mergeRunValueFacetRows, missingCapabilities, negotiate, nextCronFireMs, normalizeAttributeRows, normalizeDescriptor, observedAnnouncements, onErrorRunId, pageFan, pageFanFromStore, parentRunIdOf, parseDuration, parseWebhookToken, partitionOfToken, planDispatch, poolNamespace, prevCronFireMs, queryCheckpointsOf, readSearchAttributes, requiredCapabilities, resolveConcurrency, resolveRouting, resolveRunWaiting, retiredHandoffName, routeFor, runDetailEtag, runDurableExecution, runInStepLogger, runInStepScope, runInWorkflowCtx, runOutsideWorkflowCtx, runSchedules, runStepHandler, runValueFacetsFromRuns, sanitizeQueueToken, scheduledRunId, singletonAdmissionDenialPatch, singletonAdmissionTags, sqlComparator, stepConfigOf, stepId, stepNameOf, sub, subEvent, subProcess, summarizeFan, summarizeRunFromStore, summarizeTimeline, tenantGroup, useDurableExecution, warn, withSingletonTracked, withoutSingletonMarkers, workflowName };
|
|
7120
|
+
export { type AccumulatorHost, type Admission, type AdmissionBackend, type AdmissionItem, type AllOptions, type AllSettledOptions, type AllStepsOptions, type AllStepsSettledOptions, type AnnouncedWorkflow, type AnnouncementEvidence, type AttributeFilter, type AttributeOp, type AttributePredicateOperand, type AttributeValue, type BackoffStrategy, type BlockedDispatch, type BlockedResolution, CHILD_EDGE_PREFIXES, CONTROL_FLOW_SIGNAL, CURRENT_PROTOCOL_VERSION, type CapabilityRequirement, type CheckpointAggregatingStore, type CheckpointNameKind, type CheckpointQuery, type CheckpointStat, type ChildCallOptions, type ChildWait, CodecStateStore, type CodecStateStoreOptions, type ConcurrencyConfig, ConcurrencyLimitError, type ConcurrencyQuota, ContinueAsNew, type ControlMessage, type ControlPlane, DEFAULT_CONCURRENCY_STATUSES, DEFAULT_PARTITION, DEFAULT_STALLED_AFTER_MS, DURABLE_OPTIONS, DURABLE_OPTIONS_CANONICAL, DURABLE_STEP_CONFIG, DURABLE_STEP_NAME, type Disagreement, type DispatchDiagnostics, type DispatchPlan, type DurableExecution, type DurableExecutionWrapper, type DurableTopology, type DurableWebhook, DurableWorkflow, type DynamicWorkflowCtx, ENGINE_MINTED_TAG_PREFIXES, ENTITY_WORKFLOW, EVENT_BUFFER_SCAN_LIMIT, EVENT_TOKEN_PREFIX, type EngineEvent, type EngineEventType, type EngineListener, Entities, type EntityConfig, type EntityHandler, type EntityHost, type EntityWorkflowHost, EventAccumulators, type EventBatchConfig, FAN_SUMMARY_FAILURES, type FanJoin, type FanPage, type FanPageQuery, type FanSummary, type FanWait, FatalError, type FindStalledRunsOptions, GatherError, type GatherItemFailure, type GroupHealth, HANDOFF_SEQ_BASE, type Heartbeat, type HeartbeatSighting, type HeartbeatStatus, type HistoryEvent, InMemoryAdmissionBackend, InMemoryStateStore, InMemoryTransport, type InferSearchAttributes, LEGACY_V1_CAPABILITIES, LEGACY_V1_PROTOCOL, type ListStalledRunsOptions, type MetricsCollector, type MetricsSnapshot, type NamedTransport, type NegotiateOptions, type NegotiationOutcome, type NegotiationReason, type NegotiationResult, NestedWorkflowCallError, NonDeterminismError, type OnErrorInput, type OnErrorRoute, type OwnedLeaseReclaim, type PartitionSighting, type PayloadCodec, type QueueConfig, QueueController, RUN_HISTORY_FIXTURE_VERSION, RUN_VALUE_FACET_LIMIT, RUN_VALUE_FACET_SCAN, type RawWorkerDescriptor, RemoteStepError, RemoteStepTimeout, type RemoteTask, RemoteWorkflowExecutor, RemoteWorkflowTimeout, type RetentionPolicy, type RoutableDispatch, type RoutableResolution, type RoutingResolution, type RunAttributeRow, type RunDetail, type RunDetailOptions, type RunDispatcher, type RunFacetQuery, type RunFacetRow, RunGateway, type RunListItem, type RunQuery, type RunReply, type RunReplyResult, type RunRequest, type RunRequestKind, type RunResult, type RunSchedulesOptions, type RunScope, type RunStatus, type RunValueAxis, type RunValueFacetOptions, type RunValueFacetOrder, type RunValueFacetRow, type RunWaiting, SINGLETON_ACTIVE_STATUSES, SINGLETON_ADMITTED_TAG, SINGLETON_RESERVED_TAGS, SINGLETON_TRACKED_TAG, STATE_STORE, STATE_STORE_CANONICAL, SUMMARY_CHILD_LIMIT, type ScalarAttributeFilter, ScheduleAlreadyExistsError, ScheduleClient, type ScheduleClientOptions, type ScheduleDescription, type ScheduleHost, type ScheduleListQuery, ScheduleNotFoundError, type ScheduleOptions, type ScheduleQuery, type ScheduleRecord, type ScheduledWorkflow, type SearchAttributes, type SearchAttributesSchema, type Settled, SignalTimeoutError, type SignalWaiter, type SingletonConfig, SingletonQueueFullError, type StalePendingStep, type StalledRunInfo, StandardSchemaV1, 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 StepScope, type StepUndo, type StoreTransaction, type SubProcessHandle, TERMINAL_RUN_STATUSES, TRANSPORT, TRANSPORT_CANONICAL, type TenantEvent, type Transport, type UndoOf, type UpdateResult, type UpdateValidator, VERSION_UNDECLARED_TAG, WORKFLOW_NAME_KEY, type WireDates, type WorkerAdjust, type WorkerConcurrencyStatus, type WorkerDescriptor, type WorkerHeartbeat, type WorkerLifecycle, type WorkerStatus, type WorkflowAnnouncement, WorkflowBlocked, type WorkflowClass, type WorkflowCommand, type WorkflowCtx, type WorkflowDecision, type WorkflowDirectory, WorkflowEngine, type WorkflowEngineDeps, type WorkflowExecutor, type WorkflowHandler, type WorkflowInputOf, type WorkflowOutputOf, type WorkflowRef, type WorkflowRegistration, type WorkflowRun, type WorkflowStartClient, type WorkflowStepEvent, WorkflowSuspended, type WorkflowTask, aggregateAnnouncements, aggregatesCheckpoints, announcementsOf, applyAttributeQuery, assertConcurrency, assertRoutes, attributeColumnFor, attributeOperand, attributePredicateOperands, axisIsRunColumn, bindWorkflowClass, breakpointToken, buildWorkflowDirectory, canRoute, capableWorkers, checkpointNameKind, checkpointStatsOf, childIdsOf, classifyWaiterToken, clearDurableExecutionWrappers, clearTerminalSingletonAdmission, codeAndDetails, codeOf, collectMetrics, concurrencyTag, controlPlaneDescriptor, countRuns, coveredTokens, createStepLogger, currentStep, currentStepScope, currentWorkflowCtx, debug, describeWorker, descriptorHash, detailsOf, error, etagMatches, eventMatchOf, eventMatches, eventNameOf, eventPrefix, eventToken, facetOrigin, fanPageBounds, fanPageEtag, findStalledRuns, foldedCount, handoffHandlerId, handoffName, hasDurableExecutionWrappers, heartbeatStatus, indexWaitersByRun, info, isEngineMintedTag, isEventToken, isFailedMember, isLegacyDescriptor, isNonEmptyRunScope, isWorkflowControlFlowSignal, legacySingletonHolders, listSignalWaitersOfRuns, liveHandoff, log, matchesAttributes, mergeRunFacetRows, mergeRunValueFacetRows, missingCapabilities, negotiate, nextCronFireMs, normalizeAttributeRows, normalizeDescriptor, observedAnnouncements, onErrorRunId, pageFan, pageFanFromStore, parentRunIdOf, parseDuration, parseWebhookToken, partitionOfToken, planDispatch, poolNamespace, prevCronFireMs, queryCheckpointsOf, readSearchAttributes, requiredCapabilities, resolveConcurrency, resolveRouting, resolveRunWaiting, retiredHandoffName, routeFor, runDetailEtag, runDurableExecution, runInStepLogger, runInStepScope, runInWorkflowCtx, runOutsideWorkflowCtx, runSchedules, runStepHandler, runValueFacetsFromRuns, sanitizeQueueToken, scheduledRunId, singletonAdmissionDenialPatch, singletonAdmissionTags, sqlComparator, stepConfigOf, stepId, stepNameOf, sub, subEvent, subProcess, summarizeFan, summarizeRunFromStore, summarizeTimeline, tenantGroup, useDurableExecution, warn, withSingletonTracked, withoutSingletonMarkers, workflowName };
|