Class: InMemoryStepLedger
Defined in: packages/workflow-engine/src/testing/in-memory-step-ledger.ts:41
Map-backed StepLedger for tests and local design spikes.
Implements
Constructors
Constructor
new InMemoryStepLedger(
options?):InMemoryStepLedger
Defined in: packages/workflow-engine/src/testing/in-memory-step-ledger.ts:45
Parameters
options?
InMemoryStepLedgerOptions = {}
Returns
InMemoryStepLedger
Methods
claim()
claim(
record):Promise<{created:boolean;record:StepRecord; }>
Defined in: packages/workflow-engine/src/testing/in-memory-step-ledger.ts:49
Insert-if-absent. Existing records win conflicts without throwing.
Parameters
record
Omit<StepRecord, "createdAt" | "updatedAt">
Returns
Promise<{ created: boolean; record: StepRecord; }>
Implementation of
clear()
clear(
stageRecordId):Promise<void>
Defined in: packages/workflow-engine/src/testing/in-memory-step-ledger.ts:148
Parameters
stageRecordId
string
Returns
Promise<void>
Implementation of
clearExcept()
clearExcept(
stageRecordId,keepStepIds):Promise<void>
Defined in: packages/workflow-engine/src/testing/in-memory-step-ledger.ts:154
Delete every row of a stage record except the named steps.
Optional so an existing implementation keeps compiling. Re-running a
terminally failed stage needs it, and so does a run.redrive that
resumes a stage and keeps its completed steps: the rows must go so nothing stale
replays, but a row naming an external effect that may still be live —
an AI map's batch submit, holding the handle and external key of a
batch a provider is still processing and still billing — must survive,
or the effect is orphaned with no record anywhere. A ledger that does
not implement this falls back to clear, and the kernel logs the
external keys it is about to drop so they remain findable.
Parameters
stageRecordId
string
keepStepIds
string[]
Returns
Promise<void>
Implementation of
compareAndSet()
compareAndSet(
stageRecordId,stepId,expected,patch):Promise<{applied:boolean;record:StepRecord|null; }>
Defined in: packages/workflow-engine/src/testing/in-memory-step-ledger.ts:121
Atomically apply patch only when the record's current status and
attempt equal expected. Returns whether the write applied and the
record as it stands afterwards (null when the step does not exist).
Used to re-claim expired leases, retry failed attempts, time out waits
and complete signals without two workers both winning.
Parameters
stageRecordId
string
stepId
string
expected
StepRecordExpectation
patch
StepRecordPatch
Returns
Promise<{ applied: boolean; record: StepRecord | null; }>
Implementation of
get()
get(
stageRecordId,stepId):Promise<StepRecord|null>
Defined in: packages/workflow-engine/src/testing/in-memory-step-ledger.ts:82
Parameters
stageRecordId
string
stepId
string
Returns
Promise<StepRecord | null>
Implementation of
list()
list(
stageRecordId):Promise<StepRecord[]>
Defined in: packages/workflow-engine/src/testing/in-memory-step-ledger.ts:141
Parameters
stageRecordId
string
Returns
Promise<StepRecord[]>
Implementation of
update()
update(
stageRecordId,stepId,patch):Promise<StepRecord>
Defined in: packages/workflow-engine/src/testing/in-memory-step-ledger.ts:87
Parameters
stageRecordId
string
stepId
string
patch
StepRecordPatch
Returns
Promise<StepRecord>