Skip to main content

Class: IdempotencyManager

Defined in: src/idempotency/IdempotencyManager.ts:27

Enterprise Idempotency Engine for EntityTS. Guarantees that client retries, webhook dispatches, and duplicate mutation instructions never execute transactions twice.

Constructors​

Constructor​

new IdempotencyManager(adapter): IdempotencyManager

Defined in: src/idempotency/IdempotencyManager.ts:30

Parameters​

ParameterType
adapterIDbAdapter

Returns​

IdempotencyManager

Methods​

ensureSchema()​

ensureSchema(): Promise<void>

Defined in: src/idempotency/IdempotencyManager.ts:35

Automatically verifies and creates the __entityts_idempotency table if it does not yet exist.

Returns​

Promise<void>


execute()​

execute<T>(key, handler, options?): Promise<T>

Defined in: src/idempotency/IdempotencyManager.ts:107

Executes the transaction handler guarded by an idempotency key. If the key was already completed, returns the previously cached response immediately without re-executing. If the key is currently being processed concurrently, throws IdempotencyConflictException.

Type Parameters​

Type Parameter
T

Parameters​

ParameterTypeDescription
keystringThe unique idempotency key (e.g. UUID, order reference, header value).
handler() => Promise<T>Transactional callback to execute once.
options?IdempotencyOptionsIdempotency lock and TTL configurations.

Returns​

Promise<T>