@dudousxd/nestjs-durable-core 0.85.5 → 0.85.7
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 +1176 -635
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +160 -21
- package/dist/index.d.ts +160 -21
- package/dist/index.js +1176 -635
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1161,6 +1161,13 @@ interface OwnedLeaseReclaim {
|
|
|
1161
1161
|
/** Only leases expiring strictly before this epoch ms (the caller's boot time + `leaseMs`). */
|
|
1162
1162
|
lockedBefore: number;
|
|
1163
1163
|
}
|
|
1164
|
+
/** One buffered signal, as {@link StateStore.listBufferedSignals} returns it. */
|
|
1165
|
+
interface BufferedSignalRow {
|
|
1166
|
+
/** The store's row id (an auto-increment), as a string. Orders rows by insertion. */
|
|
1167
|
+
id: string;
|
|
1168
|
+
token: string;
|
|
1169
|
+
payload: unknown;
|
|
1170
|
+
}
|
|
1164
1171
|
interface StateStore {
|
|
1165
1172
|
/**
|
|
1166
1173
|
* Provision the tables/collections this store needs, idempotently. Called on boot when the
|
|
@@ -1235,11 +1242,28 @@ interface StateStore {
|
|
|
1235
1242
|
*/
|
|
1236
1243
|
deleteRuns?(runIds: string[]): Promise<void>;
|
|
1237
1244
|
getCheckpoint(runId: string, seq: number): Promise<StepCheckpoint | null>;
|
|
1245
|
+
/**
|
|
1246
|
+
* The run's checkpoints at `seqs`, in `seq` order; a seq with no checkpoint is left out, and an
|
|
1247
|
+
* empty `seqs` reads nothing. The engine reads a batch of one run's step results' checkpoints
|
|
1248
|
+
* through it, one call per batch.
|
|
1249
|
+
*
|
|
1250
|
+
* Optional: a store that omits it gets one {@link getCheckpoint} per seq.
|
|
1251
|
+
*/
|
|
1252
|
+
getCheckpoints?(runId: string, seqs: number[]): Promise<StepCheckpoint[]>;
|
|
1238
1253
|
/**
|
|
1239
1254
|
* Persist a checkpoint and advance the run atomically. Durable semantics depend on this
|
|
1240
1255
|
* being a single transaction; stores without transactions cannot give the strong guarantee.
|
|
1241
1256
|
*/
|
|
1242
1257
|
saveCheckpoint(checkpoint: StepCheckpoint): Promise<void>;
|
|
1258
|
+
/**
|
|
1259
|
+
* {@link saveCheckpoint} for many checkpoints in one call: each is written (inserted, or
|
|
1260
|
+
* overwriting the row at its `(runId, seq)`), in a few statements and one transaction, so a
|
|
1261
|
+
* rejection writes nothing. The entries name distinct rows. The engine writes a step fan's new
|
|
1262
|
+
* `pending` checkpoints through it before dispatching them.
|
|
1263
|
+
*
|
|
1264
|
+
* Optional: a store that omits it gets one {@link saveCheckpoint} per checkpoint.
|
|
1265
|
+
*/
|
|
1266
|
+
saveCheckpoints?(checkpoints: StepCheckpoint[]): Promise<void>;
|
|
1243
1267
|
/**
|
|
1244
1268
|
* Overwrite the checkpoint at `(runId, seq)` with `checkpoint`, but only while the stored row is
|
|
1245
1269
|
* still `pending`; resolves whether it wrote. The engine writes a dispatched step's row from two
|
|
@@ -1374,6 +1398,16 @@ interface StateStore {
|
|
|
1374
1398
|
takeBufferedSignal(token: string): Promise<{
|
|
1375
1399
|
payload: unknown;
|
|
1376
1400
|
} | null>;
|
|
1401
|
+
/**
|
|
1402
|
+
* A page of buffered signals whose token starts with `tokenPrefix`, in insertion (`id`) order,
|
|
1403
|
+
* starting after `afterId` (exclusive; `undefined` = from the start), at most `limit` rows. The
|
|
1404
|
+
* read behind the engine's sweep of buffered child completions nothing will consume
|
|
1405
|
+
* ({@link WorkflowEngine.sweepBufferedSignals}); pages by primary key, so it stays cheap on a large
|
|
1406
|
+
* table. Optional: without it (or {@link deleteBufferedSignals}) the sweep does nothing.
|
|
1407
|
+
*/
|
|
1408
|
+
listBufferedSignals?(tokenPrefix: string, afterId: string | undefined, limit: number): Promise<BufferedSignalRow[]>;
|
|
1409
|
+
/** Delete the buffered signals with these {@link BufferedSignalRow.id}s; unknown ids are ignored. */
|
|
1410
|
+
deleteBufferedSignals?(ids: string[]): Promise<void>;
|
|
1377
1411
|
/**
|
|
1378
1412
|
* Buffer a published event that matched NO live waiter, so a LATER `ctx.waitForEvent(name, { match })`
|
|
1379
1413
|
* still consumes it instead of it being silently dropped — the events analog of {@link bufferSignal}'s
|
|
@@ -2311,6 +2345,15 @@ interface RunConsumerOptions extends RunQueueOptions {
|
|
|
2311
2345
|
interface Transport {
|
|
2312
2346
|
/** engine → worker */
|
|
2313
2347
|
dispatch(task: RemoteTask): Promise<void>;
|
|
2348
|
+
/**
|
|
2349
|
+
* {@link dispatch} for many tasks in a few broker calls. Rejects if any task may not have been
|
|
2350
|
+
* dispatched (some may have been: the engine then dispatches the batch again one task at a time,
|
|
2351
|
+
* and a task delivered twice runs twice, as any redelivery does). The engine sends a step fan's
|
|
2352
|
+
* new steps through it.
|
|
2353
|
+
*
|
|
2354
|
+
* Optional: a transport that omits it gets one {@link dispatch} per task.
|
|
2355
|
+
*/
|
|
2356
|
+
dispatchMany?(tasks: RemoteTask[]): Promise<void>;
|
|
2314
2357
|
/** worker → engine: a step finished (ok or error). */
|
|
2315
2358
|
onResult(handler: (result: StepResult) => Promise<void>): void;
|
|
2316
2359
|
/** worker → engine: liveness signal for an in-flight long step. */
|
|
@@ -4662,6 +4705,23 @@ declare class WorkflowEngine {
|
|
|
4662
4705
|
private readonly wakeTurns;
|
|
4663
4706
|
/** Re-checks scheduled for runs whose wake found another instance's lease (see {@link execute}). */
|
|
4664
4707
|
private readonly leaseRetries;
|
|
4708
|
+
/**
|
|
4709
|
+
* Runs whose scheduled re-check resumes them whatever happened meanwhile. Without an entry the
|
|
4710
|
+
* re-check only stood for fan wakes kept as requests, and resumes the run only if a request is
|
|
4711
|
+
* still there: the turn that held the lease takes them once it ends (see {@link retryDroppedWake}).
|
|
4712
|
+
*/
|
|
4713
|
+
private readonly unconditionalRechecks;
|
|
4714
|
+
/** Runs a generic wake request was written for in the current re-check cycle (see {@link execute}). */
|
|
4715
|
+
private readonly genericWakeRequested;
|
|
4716
|
+
/** Why each run is being woken on this instance, until the turn that answers it starts. */
|
|
4717
|
+
private readonly wakeReasons;
|
|
4718
|
+
/**
|
|
4719
|
+
* The step fans each executing turn on this instance read with nothing in flight: first seq -> the
|
|
4720
|
+
* highest seq read. Written by {@link callRemoteAll}, read once the turn ends.
|
|
4721
|
+
*/
|
|
4722
|
+
private readonly turnSettledFans;
|
|
4723
|
+
/** The wake requests each executing turn on this instance serves (see {@link noteServedWakes}). */
|
|
4724
|
+
private readonly turnServedWakes;
|
|
4665
4725
|
/**
|
|
4666
4726
|
* Every run turn and child start this instance takes on itself, under one budget of
|
|
4667
4727
|
* {@link LOCAL_RUN_CONCURRENCY}: the runs it dispatches to itself, a fan's deferred child starts,
|
|
@@ -4689,6 +4749,10 @@ declare class WorkflowEngine {
|
|
|
4689
4749
|
/** Runs already paged about, by id → the `updatedAt` of the paged episode (see {@link sweepStalled}). */
|
|
4690
4750
|
private readonly notifiedStalled;
|
|
4691
4751
|
private lastStalledSweepAt;
|
|
4752
|
+
/** {@link sweepBufferedSignals}: the id the pass in progress resumes after, `undefined` between passes. */
|
|
4753
|
+
private bufferedSweepCursor;
|
|
4754
|
+
private bufferedSweepActive;
|
|
4755
|
+
private lastBufferedSweepEndedAt;
|
|
4692
4756
|
private readonly stalledAfterMs;
|
|
4693
4757
|
private draining;
|
|
4694
4758
|
/** Wait already spent on this shutdown before `drain()` (see `beginDrain`). */
|
|
@@ -4917,6 +4981,21 @@ declare class WorkflowEngine {
|
|
|
4917
4981
|
* Returns an unsubscribe function.
|
|
4918
4982
|
*/
|
|
4919
4983
|
onDead(listener: (run: WorkflowRun) => void): () => void;
|
|
4984
|
+
/**
|
|
4985
|
+
* Delete buffered child completions no parent will ever consume (see
|
|
4986
|
+
* `childCompletionNeedsBuffer`): those of root runs, of children whose parent already settled them
|
|
4987
|
+
* or is gone, or terminal for good. Such rows were written by earlier versions, which buffered every
|
|
4988
|
+
* completion that found no waiter, and nothing else ever removes them.
|
|
4989
|
+
*
|
|
4990
|
+
* Walks `durable_buffered_signals` by primary key, {@link BUFFERED_SWEEP_PAGE} rows at a time and
|
|
4991
|
+
* at most {@link BUFFERED_SWEEP_PAGES_PER_CALL} pages per call, so a large backlog drains over a
|
|
4992
|
+
* few timer ticks without a long query or a big delete. A pass that reaches the end of the table
|
|
4993
|
+
* rests {@link BUFFERED_SWEEP_REST_MS} before the next one. Call it every tick (the NestJS timer
|
|
4994
|
+
* poller does). Skipped while draining, on a namespaced engine (a buffered signal carries no
|
|
4995
|
+
* namespace, and a scoped read would report another tenant's parent as gone), and on a store
|
|
4996
|
+
* without `listBufferedSignals`/`deleteBufferedSignals`. Returns how many rows it deleted.
|
|
4997
|
+
*/
|
|
4998
|
+
sweepBufferedSignals(now?: number): Promise<number>;
|
|
4920
4999
|
/**
|
|
4921
5000
|
* Register a pager hook for STRANDED runs: an in-flight run untouched past `stalledAfterMs` that is
|
|
4922
5001
|
* either suspended with NO wake timer (wake-forever: nothing will ever re-drive it) or parked on an
|
|
@@ -4967,6 +5046,8 @@ declare class WorkflowEngine {
|
|
|
4967
5046
|
* terminal too.
|
|
4968
5047
|
*/
|
|
4969
5048
|
resume(runId: string): Promise<RunResult>;
|
|
5049
|
+
/** Record why `runId` is being woken: a step fan's barrier opening, or (`undefined`) anything else. */
|
|
5050
|
+
private noteWakeReason;
|
|
4970
5051
|
/**
|
|
4971
5052
|
* {@link resume} for every IMPLICIT wake-up — a delivered signal/child completion, a late step
|
|
4972
5053
|
* result, a due timer, a redelivered dispatch, a queue-slot wake. A `failed` run is terminal to
|
|
@@ -5502,14 +5583,6 @@ declare class WorkflowEngine {
|
|
|
5502
5583
|
* not buffered for a waiter that no longer exists.
|
|
5503
5584
|
*/
|
|
5504
5585
|
private deliverToParent;
|
|
5505
|
-
/**
|
|
5506
|
-
* Whether the parent of the child behind `token` (`child:<id>`) already holds `completion` as that
|
|
5507
|
-
* child's settled `signal:child:<id>` checkpoint: its own turn settled the child from the child's
|
|
5508
|
-
* row, so this notification is a duplicate. A different completion (a fix-and-replay run's success
|
|
5509
|
-
* for a child the parent saw fail) is not, and is buffered for the parent's retry. Only for a child
|
|
5510
|
-
* whose id the engine minted (its parent is derivable from it).
|
|
5511
|
-
*/
|
|
5512
|
-
private parentHoldsCompletion;
|
|
5513
5586
|
/**
|
|
5514
5587
|
* Deferred child start shared by the in-process ctx host and the remote `startChild` command.
|
|
5515
5588
|
* Deferred (microtask) so a fast child can't reentrantly resume a still-suspending parent. A start
|
|
@@ -5523,6 +5596,8 @@ declare class WorkflowEngine {
|
|
|
5523
5596
|
* correctly observes the failed start.
|
|
5524
5597
|
*/
|
|
5525
5598
|
private startChildDeferred;
|
|
5599
|
+
/** {@link startChildDeferred}: re-deliver the completion of a child `start` found finished. */
|
|
5600
|
+
private redeliverFinishedChild;
|
|
5526
5601
|
/**
|
|
5527
5602
|
* Cancel a run (e.g. from the dashboard). Returns null if the run does not exist. Pass
|
|
5528
5603
|
* `{ compensate: true }` to undo the saga first: the suspended run is resumed so its completed
|
|
@@ -5712,19 +5787,48 @@ declare class WorkflowEngine {
|
|
|
5712
5787
|
/**
|
|
5713
5788
|
* Keep a wake that found `runId`'s lease held by a turn executing elsewhere, durably, so that turn
|
|
5714
5789
|
* runs again once it ends instead of suspending on a snapshot that predates what the wake brought
|
|
5715
|
-
* (a signal, a child's completion). The request is a buffered
|
|
5716
|
-
* on
|
|
5790
|
+
* (a signal, a child's completion). The request is a buffered event under a name no workflow waits
|
|
5791
|
+
* on. It stays until a turn that started after it has settled: the holder looks at it after it
|
|
5792
|
+
* releases the lease ({@link honorWakeRequests}), and the turn that serves it drops it.
|
|
5717
5793
|
*
|
|
5718
5794
|
* Written first and looked at second, against a holder that releases first and looks second:
|
|
5719
5795
|
* whichever look runs last sees the other side's write. So when the run is no longer executing by
|
|
5720
|
-
* the time this re-reads it, the holder may have looked already, and this side
|
|
5721
|
-
*
|
|
5796
|
+
* the time this re-reads it, the holder may have looked already, and this side wakes the run
|
|
5797
|
+
* itself once the lease is free ({@link retryDroppedWake}). While the holder still runs, the run is
|
|
5798
|
+
* made due when the holder's lease runs out, so a holder that goes down before it settles leaves
|
|
5799
|
+
* the run to any instance's timer poll; a holder that settles sets the run's timer itself.
|
|
5722
5800
|
*/
|
|
5723
5801
|
private requestWakeAfterTurn;
|
|
5724
|
-
/**
|
|
5802
|
+
/**
|
|
5803
|
+
* After a turn that suspended released its lease: drop the wakes it served, and run again if a
|
|
5804
|
+
* wake was kept for it meanwhile, unless every such wake was a fan wake this turn already saw: it
|
|
5805
|
+
* read that fan with nothing in flight, at least as far as the batch that opened its barrier.
|
|
5806
|
+
* The run is made due before it is woken, so if this instance goes down before that turn runs,
|
|
5807
|
+
* the timer poll of another instance runs it once this instance's hold on it would have lapsed.
|
|
5808
|
+
*/
|
|
5725
5809
|
private honorWakeRequests;
|
|
5726
|
-
/**
|
|
5727
|
-
|
|
5810
|
+
/**
|
|
5811
|
+
* The wake requests kept for `runId`. With `legacy`, also those an older engine kept as buffered
|
|
5812
|
+
* signals, which are taken as they are read.
|
|
5813
|
+
*/
|
|
5814
|
+
private listWakeRequests;
|
|
5815
|
+
/** Delete `requests` (the ones kept as buffered events). */
|
|
5816
|
+
private dropWakeRequests;
|
|
5817
|
+
/**
|
|
5818
|
+
* Record, for the turn executing `runId` here, the wakes kept for the run so far. Called before the
|
|
5819
|
+
* turn reads the run's state, so the turn serves them: they are dropped once it has settled, and
|
|
5820
|
+
* until then stay for whoever runs the run next.
|
|
5821
|
+
*/
|
|
5822
|
+
private noteServedWakes;
|
|
5823
|
+
/**
|
|
5824
|
+
* Right after a turn of `runId` wrote its suspension, while it still holds the lease: if a wake
|
|
5825
|
+
* was kept for the run during the turn that the turn did not see, keep the run due when the lease
|
|
5826
|
+
* runs out. The suspension overwrote the timer the instance keeping the wake set, and this instance
|
|
5827
|
+
* may go down before it looks at the wake once it has released the lease.
|
|
5828
|
+
*/
|
|
5829
|
+
private keepDueForKeptWakes;
|
|
5830
|
+
/** Bring a suspended run's timer forward to `at` (never later than the one it has). */
|
|
5831
|
+
private makeDueBy;
|
|
5728
5832
|
/**
|
|
5729
5833
|
* A wake that found the run leased by another instance is dropped, and normally that is fine: the
|
|
5730
5834
|
* holder's turn either sees what the wake wrote, or re-checks once it releases the lease
|
|
@@ -6071,6 +6175,11 @@ declare class WorkflowEngine {
|
|
|
6071
6175
|
* capable+compatible worker has appeared, else re-parks with a fresh `wakeAt` (design §7.5). */
|
|
6072
6176
|
private dueBlockedRuns;
|
|
6073
6177
|
private callRemote;
|
|
6178
|
+
/**
|
|
6179
|
+
* Whether a `pending` step a turn just read only waits for its result: {@link callRemote} would
|
|
6180
|
+
* suspend on it without writing (no redispatch deadline to stamp, the one stamped not yet due).
|
|
6181
|
+
*/
|
|
6182
|
+
private stepIsWaiting;
|
|
6074
6183
|
/**
|
|
6075
6184
|
* `ctx.all` over a `@Step`: one durable step per input, dispatched together, joined once. The ctx
|
|
6076
6185
|
* reserves the whole position block up front, so replay re-derives the same seqs.
|
|
@@ -6083,7 +6192,11 @@ declare class WorkflowEngine {
|
|
|
6083
6192
|
* barrier ({@link stepFanStillRunning}) then wakes the parent once per wave, not once per result.
|
|
6084
6193
|
*/
|
|
6085
6194
|
private callRemoteAll;
|
|
6086
|
-
/**
|
|
6195
|
+
/**
|
|
6196
|
+
* Write the `pending` checkpoints of a step fan's new steps, then dispatch them: one
|
|
6197
|
+
* {@link StateStore.saveCheckpoints} call and one {@link TransportPool.dispatchMany} for the
|
|
6198
|
+
* batch, where the store and transport have them.
|
|
6199
|
+
*/
|
|
6087
6200
|
private sendStepFan;
|
|
6088
6201
|
/** Remember a step settled here, forgetting entries older than a lease so the map stays small. */
|
|
6089
6202
|
private noteSettledHere;
|
|
@@ -6098,6 +6211,12 @@ declare class WorkflowEngine {
|
|
|
6098
6211
|
* call rejecting means it wrote nothing, so the entries are then written one by one.
|
|
6099
6212
|
*/
|
|
6100
6213
|
private savePendingCheckpoints;
|
|
6214
|
+
/**
|
|
6215
|
+
* The checkpoints of one run at distinct `seqs`, each as its own outcome: one
|
|
6216
|
+
* {@link StateStore.getCheckpoints} call when the store has it, else one read each. The batch
|
|
6217
|
+
* call rejecting falls back to one read each, so a failing read fails only its own entry.
|
|
6218
|
+
*/
|
|
6219
|
+
private readCheckpoints;
|
|
6101
6220
|
/** Enqueue a remote step task to its worker group via the transport pool. Shared by the initial
|
|
6102
6221
|
* dispatch, the opt-in self-heal re-dispatch (see `remoteRedispatchMs`), and the explicit
|
|
6103
6222
|
* {@link redispatchPending}. Carries the current trace/context so a re-dispatch is traceable. */
|
|
@@ -6117,9 +6236,10 @@ declare class WorkflowEngine {
|
|
|
6117
6236
|
*
|
|
6118
6237
|
* Results of one run are settled in batches: the first starts a batch, and the ones that arrive
|
|
6119
6238
|
* while it is being written form the next. Under load a wide fan's results are written by one
|
|
6120
|
-
* {@link StateStore.saveCheckpointsIfPending} call per batch, and the fan's barrier is asked
|
|
6121
|
-
*
|
|
6122
|
-
* transport acknowledges nothing that is not durable yet.
|
|
6239
|
+
* {@link StateStore.saveCheckpointsIfPending} call per batch, and the fan's barrier is asked only
|
|
6240
|
+
* by a batch with no more of the fan's results queued behind it. A result resolves only once its
|
|
6241
|
+
* own write has committed, so the transport acknowledges nothing that is not durable yet. How
|
|
6242
|
+
* large a batch gets is bounded by how many results the transport hands over at once.
|
|
6123
6243
|
*/
|
|
6124
6244
|
private completeRemoteResult;
|
|
6125
6245
|
/** Settle `queue` (a run's queued results) batch by batch until it is empty, then retire it. */
|
|
@@ -6128,6 +6248,11 @@ declare class WorkflowEngine {
|
|
|
6128
6248
|
* Settle a batch of one run's step results. At most one of them resolves `true` (resume the run):
|
|
6129
6249
|
* that resume replays every write of the batch, so a second would only replay it again. A result
|
|
6130
6250
|
* whose read or write failed resolves its error, and the transport redelivers just that one.
|
|
6251
|
+
*
|
|
6252
|
+
* `queuedIn(from, to)` says whether a result for a seq in that range is already waiting for this
|
|
6253
|
+
* run's next batch on this instance. A fan with one waiting is not asked its barrier: that result
|
|
6254
|
+
* asks it once its own batch is written (as a settle, or as a redelivery of a settled step), so
|
|
6255
|
+
* under a backlog the barrier is read once per drained queue rather than once per batch.
|
|
6131
6256
|
*/
|
|
6132
6257
|
private completeRemoteResults;
|
|
6133
6258
|
/**
|
|
@@ -6142,7 +6267,8 @@ declare class WorkflowEngine {
|
|
|
6142
6267
|
* retry needs the parent to schedule it). Without it every result would replay the whole parent,
|
|
6143
6268
|
* which makes a fan of N steps cost O(N²) checkpoint reads. `barriers` holds the answer per fan
|
|
6144
6269
|
* for the rest of a batch. A barrier that cannot be read counts as open: a spare resume replays and
|
|
6145
|
-
* re-suspends, a lost one strands the run.
|
|
6270
|
+
* re-suspends, a lost one strands the run. A fan with a result waiting in `queuedIn` is left to
|
|
6271
|
+
* that result (see {@link completeRemoteResults}).
|
|
6146
6272
|
*/
|
|
6147
6273
|
private stepFanStillRunning;
|
|
6148
6274
|
/** How many steps of a step fan's seq range are still `pending`. */
|
|
@@ -6863,6 +6989,10 @@ declare class CodecStateStore implements StateStore {
|
|
|
6863
6989
|
readonly saveCheckpointIfPending?: (checkpoint: StepCheckpoint) => Promise<boolean>;
|
|
6864
6990
|
/** Encodes each checkpoint like {@link saveCheckpoint}. Bound only when the inner store has it. */
|
|
6865
6991
|
readonly saveCheckpointsIfPending?: (checkpoints: StepCheckpoint[]) => Promise<boolean[]>;
|
|
6992
|
+
/** Encodes each checkpoint written. Bound only when the inner store has it. */
|
|
6993
|
+
readonly saveCheckpoints?: (checkpoints: StepCheckpoint[]) => Promise<void>;
|
|
6994
|
+
/** Decodes each checkpoint read. Bound only when the inner store has it. */
|
|
6995
|
+
readonly getCheckpoints?: (runId: string, seqs: number[]) => Promise<StepCheckpoint[]>;
|
|
6866
6996
|
/** Forwarded verbatim — a count reads no payload. Bound only when the inner store has it. */
|
|
6867
6997
|
readonly countCheckpoints?: (runId: string, fromSeq: number, toSeq: number, statuses: StepCheckpoint['status'][]) => Promise<number>;
|
|
6868
6998
|
/** Forwarded verbatim — retention selects by status/updatedAt/scope, never by payload. Bound only
|
|
@@ -6885,6 +7015,10 @@ declare class CodecStateStore implements StateStore {
|
|
|
6885
7015
|
readonly compactCheckpoints?: (runId: string, fromSeq: number, toSeq: number, into: StepCheckpoint) => Promise<void>;
|
|
6886
7016
|
/** Decodes each run like {@link getRun}. Bound only when the inner store has it. */
|
|
6887
7017
|
readonly getRuns?: (runIds: string[]) => Promise<WorkflowRun[]>;
|
|
7018
|
+
/** Decodes each payload like {@link takeBufferedSignal}. Bound only when the inner store has it. */
|
|
7019
|
+
readonly listBufferedSignals?: (tokenPrefix: string, afterId: string | undefined, limit: number) => Promise<BufferedSignalRow[]>;
|
|
7020
|
+
/** Forwarded verbatim — deletes by row id. */
|
|
7021
|
+
readonly deleteBufferedSignals?: (ids: string[]) => Promise<void>;
|
|
6888
7022
|
/** Forwarded verbatim — a waiter carries no payload. */
|
|
6889
7023
|
readonly listSignalWaitersByRun?: (runIds: string[]) => Promise<SignalWaiter[]>;
|
|
6890
7024
|
/** Forwarded verbatim — a waiter carries no payload. */
|
|
@@ -7404,7 +7538,9 @@ declare class InMemoryStateStore implements StateStore {
|
|
|
7404
7538
|
deleteRuns(runIds: string[]): Promise<void>;
|
|
7405
7539
|
pruneTerminalRuns(policy: RetentionPolicy, nowMs: number, limit: number): Promise<number>;
|
|
7406
7540
|
getCheckpoint(runId: string, seq: number): Promise<StepCheckpoint | null>;
|
|
7541
|
+
getCheckpoints(runId: string, seqs: number[]): Promise<StepCheckpoint[]>;
|
|
7407
7542
|
saveCheckpoint(checkpoint: StepCheckpoint): Promise<void>;
|
|
7543
|
+
saveCheckpoints(checkpoints: StepCheckpoint[]): Promise<void>;
|
|
7408
7544
|
saveCheckpointIfPending(checkpoint: StepCheckpoint): Promise<boolean>;
|
|
7409
7545
|
saveCheckpointsIfPending(checkpoints: StepCheckpoint[]): Promise<boolean[]>;
|
|
7410
7546
|
listOrphanedRuns(nowMs: number, limit: number, namespace?: string, ownedBy?: OwnedLeaseReclaim): Promise<WorkflowRun[]>;
|
|
@@ -7427,10 +7563,13 @@ declare class InMemoryStateStore implements StateStore {
|
|
|
7427
7563
|
saveCheckpoint: (cp: StepCheckpoint) => Promise<void>;
|
|
7428
7564
|
}) => Promise<T>): Promise<T>;
|
|
7429
7565
|
private readonly bufferedSignals;
|
|
7566
|
+
private bufferedSignalSeq;
|
|
7430
7567
|
bufferSignal(token: string, payload: unknown): Promise<void>;
|
|
7431
7568
|
takeBufferedSignal(token: string): Promise<{
|
|
7432
7569
|
payload: unknown;
|
|
7433
7570
|
} | null>;
|
|
7571
|
+
listBufferedSignals(tokenPrefix: string, afterId: string | undefined, limit: number): Promise<BufferedSignalRow[]>;
|
|
7572
|
+
deleteBufferedSignals(ids: string[]): Promise<void>;
|
|
7434
7573
|
/** `id -> row`, so {@link removeBufferedEvent} can delete an exact row regardless of iteration
|
|
7435
7574
|
* order — mirrors the SQL stores' PK-by-id delete. */
|
|
7436
7575
|
private readonly bufferedEvents;
|
|
@@ -7574,4 +7713,4 @@ declare function singletonAdmissionDenialPatch(runs: WorkflowRun[], runId: strin
|
|
|
7574
7713
|
updatedAt: Date;
|
|
7575
7714
|
} | undefined;
|
|
7576
7715
|
|
|
7577
|
-
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, CORE_ORIGIN, 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, InMemoryRunQueue, 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 RunConsumerOptions, type RunDetail, type RunDetailOptions, type RunDispatch, type RunDispatcher, type RunFacetQuery, type RunFacetRow, RunGateway, type RunListItem, type RunQuery, type RunQueueOptions, 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 SchemaIssue, type SchemaValidationCode, SchemaValidationError, 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 TenantTokenSource, type TenantVerifier, type Transport, type UndoOf, type UpdateResult, type UpdateValidator, VERSION_UNDECLARED_TAG, type VerifiedTenant, 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, getRunsByIds, handoffHandlerId, handoffName, hasDurableExecutionWrappers, heartbeatStatus, hmacTenantVerifier, 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, readRunsByIds, readSearchAttributes, requiredCapabilities, resolveConcurrency, resolveRouting, resolveRunWaiting, resolveTenantToken, resolveWireTenant, retiredHandoffName, routeFor, runDetailEtag, runDurableExecution, runInStepLogger, runInStepScope, runInWorkflowCtx, runOutsideWorkflowCtx, runSchedules, runStepHandler, runValueFacetsFromRuns, sanitizeQueueToken, scheduleRunIdAt, scheduledRunId, signTenantToken, singletonAdmissionDenialPatch, singletonAdmissionTags, sqlComparator, stepConfigOf, stepId, stepNameOf, sub, subEvent, subProcess, summarizeFan, summarizeRunFromStore, summarizeTimeline, tenantGroup, useDurableExecution, warn, withSingletonTracked, withoutSingletonMarkers, workflowName };
|
|
7716
|
+
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, type BufferedSignalRow, CHILD_EDGE_PREFIXES, CONTROL_FLOW_SIGNAL, CORE_ORIGIN, 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, InMemoryRunQueue, 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 RunConsumerOptions, type RunDetail, type RunDetailOptions, type RunDispatch, type RunDispatcher, type RunFacetQuery, type RunFacetRow, RunGateway, type RunListItem, type RunQuery, type RunQueueOptions, 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 SchemaIssue, type SchemaValidationCode, SchemaValidationError, 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 TenantTokenSource, type TenantVerifier, type Transport, type UndoOf, type UpdateResult, type UpdateValidator, VERSION_UNDECLARED_TAG, type VerifiedTenant, 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, getRunsByIds, handoffHandlerId, handoffName, hasDurableExecutionWrappers, heartbeatStatus, hmacTenantVerifier, 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, readRunsByIds, readSearchAttributes, requiredCapabilities, resolveConcurrency, resolveRouting, resolveRunWaiting, resolveTenantToken, resolveWireTenant, retiredHandoffName, routeFor, runDetailEtag, runDurableExecution, runInStepLogger, runInStepScope, runInWorkflowCtx, runOutsideWorkflowCtx, runSchedules, runStepHandler, runValueFacetsFromRuns, sanitizeQueueToken, scheduleRunIdAt, scheduledRunId, signTenantToken, singletonAdmissionDenialPatch, singletonAdmissionTags, sqlComparator, stepConfigOf, stepId, stepNameOf, sub, subEvent, subProcess, summarizeFan, summarizeRunFromStore, summarizeTimeline, tenantGroup, useDurableExecution, warn, withSingletonTracked, withoutSingletonMarkers, workflowName };
|