/** * @fileoverview BrightDB transaction manager. * Manages transaction lifecycle with retry logic and timeout support. * Parallel to upstream's TransactionManager (which wraps Mongoose sessions). * * @module transactions/bright-db-transaction-manager */ import type { BrightDb } from '@brightchain/db'; import type { IClientSession } from '@digitaldefiance/suite-core-lib'; /** * Options for transaction execution. */ export interface BrightDbTransactionOptions { /** Transaction timeout in milliseconds */ timeoutMs?: number; /** Maximum number of retry attempts (default: 0 = no retries) */ maxRetries?: number; } /** * Manager for BrightDB transactions. * Wraps @brightchain/db's session-based transaction support. * * When `useTransactions` is false, the callback is executed directly * without a session (passthrough mode). */ export declare class BrightDbTransactionManager { private readonly db; private readonly useTransactions; constructor(db: BrightDb, useTransactions: boolean); /** * Executes a callback within a transaction. * * When transactions are enabled, creates a session, starts a transaction, * and commits on success or aborts on failure. Supports retry logic. * * When transactions are disabled, runs the callback directly with * `undefined` as the session parameter. * * @template T - Return type * @param callback - Function to execute, receives session or undefined * @param options - Transaction options (timeout, retries) * @returns Result of callback execution */ execute(callback: (session: IClientSession | undefined) => Promise, options?: BrightDbTransactionOptions): Promise; } //# sourceMappingURL=bright-db-transaction-manager.d.ts.map