Transaction
Transaction:
object
Defined in: Core/Transaction.ts:67
Type Declaration
Section titled “Type Declaration”make: <
In>() =>Transaction<In,Record<never,never>,never,never> =makeTransaction
Creates an empty, initialized Transaction ready to accumulate steps.
Creates an empty, initialized Transaction ready to accumulate steps.
Type Parameters
Section titled “Type Parameters”In = void
The initial payload supplied to Transaction.run. Defaults to void.
Returns
Section titled “Returns”Transaction<In, Record<never, never>, never, never>
Transaction.step for appending sequential steps to the transaction.
Example
Section titled “Example”Transaction.step for appending sequential steps to the transaction.
Example
Section titled “Example”run: {(
options?): <Acc,E,EUndo>(transaction) =>Result<Failure<E,EUndo>,Acc>; <In>(input,options?): <Acc,E,EUndo>(transaction) =>Result<Failure<E,EUndo>,Acc>; } =runTransaction
Executes a Transaction, returning an infallible lazy Task.Result.
Steps run sequentially. If all steps succeed, returns Ok(Acc) containing all step outputs.
If any step fails, times out, or is aborted, completed steps are undone in reverse (LIFO) order
and returns Err(Transaction.Failure).
Call Signature
Section titled “Call Signature”(
options?): <Acc,E,EUndo>(transaction) =>Result<Failure<E,EUndo>,Acc>
Executes a zero-input Transaction with optional run options.
Parameters
Section titled “Parameters”options?
Section titled “options?”RunOptions<unknown, unknown>
Returns
Section titled “Returns”<Acc, E, EUndo>(transaction) => Result<Failure<E, EUndo>, Acc>
Call Signature
Section titled “Call Signature”<
In>(input,options?): <Acc,E,EUndo>(transaction) =>Result<Failure<E,EUndo>,Acc>
Executes a parameterized Transaction with input and optional run options.
Type Parameters
Section titled “Type Parameters”In
Parameters
Section titled “Parameters”In
options?
Section titled “options?”RunOptions<unknown, unknown>
Returns
Section titled “Returns”<Acc, E, EUndo>(transaction) => Result<Failure<E, EUndo>, Acc>
Transaction.step for configuring transactional steps with compensating undo actions.
Example
Section titled “Example”step: <
In,Acc,Id,Out,E2,EUndo2,ETimeout>(config) => <E1,EUndo1>(transaction) =>Transaction<In,Acc&{ readonly [K in string]: Out },E2|ETimeout|E1,EUndo2|EUndo1>
Appends a step to a Transaction with an optional compensating undo action.
The step receives an accumulated context containing the initial input and all outputs
from preceding steps. An optional compensating undo action can be defined to reverse
external mutations if this or any subsequent step fails.
Appends a step to a Transaction.
The step receives an accumulated context containing the initial input and all outputs
from preceding steps. An optional compensating undo action can be defined to reverse
any external mutations if this or any subsequent step fails.
Supports optional retry and timeout resilience policies on forward execution.
Type Parameters
Section titled “Type Parameters”In = void
Acc extends Record<string, unknown> = Record<never, never>
Id extends string = string
Out = unknown
E2 = never
EUndo2
Section titled “EUndo2”EUndo2 = never
ETimeout
Section titled “ETimeout”ETimeout = never
Parameters
Section titled “Parameters”config
Section titled “config”StepConfig<In, Acc, Id, Out, E2, EUndo2, ETimeout>
Returns
Section titled “Returns”<E1, EUndo1>(transaction) => Transaction<In, Acc & { readonly [K in string]: Out }, E2 | ETimeout | E1, EUndo2 | EUndo1>
Transaction.run for executing the compiled transaction.
Example
Section titled “Example”Transaction.run for executing the compiled transaction.