Skip to content

Documents for @litert/idempotency / Types / IExecutorOptions

Interface: IExecutorOptions<TArgs, TResult, TError>

Defined in: src/lib/Types.ts:295

The options for the executors with idempotency protection.

Type Parameters

TArgs

TArgs extends unknown[]

TResult

TResult

TError

TError = Error

Properties

beforeWaiting?

optional beforeWaiting: IExecutionBeforeWaitCallback<TArgs, TResult, TError>

Defined in: src/lib/Types.ts:333

An optional function to be called before waiting for an idempotency record to complete.

This is especially useful when the operation is already in progress, and you want to perform some actions (e.g. check if the args are the same as the previous call) before waiting.

Default

ts
() => {} // do nothing by default

createContext?

optional createContext: ICreateContext<TArgs>

Defined in: src/lib/Types.ts:323

An optional function to create a context for the idempotency record.

Default

ts
() => ({})

isFailureStorable?

optional isFailureStorable: ICheckFailureStorable<TError>

Defined in: src/lib/Types.ts:316

An optional function to determine if a failure result should be stored.

Param

The result of the operation, which can be either a successful result or an error.

Returns

true if the failure result should be stored, false otherwise.

Default

ts
() => true // Store all failure results by default

manager

manager: IManager<TResult, TError>

Defined in: src/lib/Types.ts:300

The storage adapter for managing idempotency records


operation

operation: IOperationCallback<TArgs, TResult>

Defined in: src/lib/Types.ts:305

The actual operation to be executed with idempotency protection