import { DBAdapter, DBTransactionAdapter } from "../db/adapter/index.mjs"; import { AsyncLocalStorage } from "node:async_hooks"; //#region src/context/transaction.d.ts type HookContext = { adapter: DBTransactionAdapter; pendingHooks: Array<() => Promise>; }; /** * This is for internal use only. Most users should use `getCurrentAdapter` instead. * * It is exposed for advanced use cases where you need direct access to the AsyncLocalStorage instance. */ declare const getCurrentDBAdapterAsyncLocalStorage: () => Promise>; declare const getCurrentAdapter: (fallback: DBTransactionAdapter) => Promise; declare const runWithAdapter: (adapter: DBAdapter, fn: () => R) => Promise; declare const runWithTransaction: (adapter: DBAdapter, fn: () => R) => Promise; /** * Queue a hook to be executed after the current transaction commits. * If not in a transaction, the hook will execute immediately. */ declare const queueAfterTransactionHook: (hook: () => Promise) => Promise; //#endregion export { getCurrentAdapter, getCurrentDBAdapterAsyncLocalStorage, queueAfterTransactionHook, runWithAdapter, runWithTransaction }; //# sourceMappingURL=transaction.d.mts.map