Skip to content

TransactionHooks

TransactionHooks = object

Defined in: packages/core/src/transaction-hooks.ts:17

Buffers transaction side effects and controls their lifecycle.

Side effects (notifications, observability, span cleanup) are buffered and only executed after the caller’s transaction commits.

createSavepoint(): TransactionHooksSavepoint

Defined in: packages/core/src/transaction-hooks.ts:32

Create a manual savepoint. Call rollback() to restore or release() to keep changes.

TransactionHooksSavepoint


delete(key): void

Defined in: packages/core/src/transaction-hooks.ts:28

Remove the hook for the given key.

symbol

void


get<T>(key): T

Defined in: packages/core/src/transaction-hooks.ts:24

Get the hook state for the given key. Throws HookNotRegisteredError if not found.

T

symbol

T


getOrInsert<T>(key, factory): T

Defined in: packages/core/src/transaction-hooks.ts:21

Get the hook state for the given key, creating it with factory if absent.

T

symbol

() => HookDefinition<T>

T


has(key): boolean

Defined in: packages/core/src/transaction-hooks.ts:26

Check whether a hook is registered for the given key.

symbol

boolean


set<T>(key, hook): void

Defined in: packages/core/src/transaction-hooks.ts:19

Register a hook with the given key.

T

symbol

HookDefinition<T>

void


withSavepoint<T>(fn): Promise<T>

Defined in: packages/core/src/transaction-hooks.ts:30

Run fn inside a savepoint. Auto-rollback on error, auto-release on success.

T

(transactionHooks) => T | Promise<T>

Promise<T>