Class: PrismaStepLedger
Defined in: packages/workflow-engine/src/persistence/prisma/step-ledger.ts:87
Prisma-backed durable step ledger.
Implements
Constructors
Constructor
new PrismaStepLedger(
prisma,options?):PrismaStepLedger
Defined in: packages/workflow-engine/src/persistence/prisma/step-ledger.ts:90
Parameters
prisma
EnginePrismaClient
options?
PrismaStepLedgerOptions = {}
Returns
PrismaStepLedger
Methods
claim()
claim(
record):Promise<{created:boolean;record:StepRecord; }>
Defined in: packages/workflow-engine/src/persistence/prisma/step-ledger.ts:97
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/persistence/prisma/step-ledger.ts:200
Parameters
stageRecordId
string
Returns
Promise<void>
Implementation of
clearExcept()
clearExcept(
stageRecordId,keepStepIds):Promise<void>
Defined in: packages/workflow-engine/src/persistence/prisma/step-ledger.ts:204
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/persistence/prisma/step-ledger.ts:169
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/persistence/prisma/step-ledger.ts:150
Parameters
stageRecordId
string
stepId
string
Returns
Promise<StepRecord | null>
Implementation of
list()
list(
stageRecordId):Promise<StepRecord[]>
Defined in: packages/workflow-engine/src/persistence/prisma/step-ledger.ts:192
Parameters
stageRecordId
string
Returns
Promise<StepRecord[]>
Implementation of
update()
update(
stageRecordId,stepId,patch):Promise<StepRecord>
Defined in: packages/workflow-engine/src/persistence/prisma/step-ledger.ts:157
Parameters
stageRecordId
string
stepId
string
patch
StepRecordPatch
Returns
Promise<StepRecord>