import { AsyncLocalStorage } from "@better-auth/core/async_hooks"; //#region src/context/request-state.d.ts type RequestStateWeakMap = WeakMap; declare function getRequestStateAsyncLocalStorage(): Promise>; declare function hasRequestState(): Promise; declare function getCurrentRequestState(): Promise; declare function runWithRequestState(store: RequestStateWeakMap, fn: () => T): Promise; interface RequestState { get(): Promise; set(value: T): Promise; readonly ref: Readonly; } /** * Defines a request-scoped state with lazy initialization. * * @param initFn - A function that initializes the state. It is called the first time `get()` is invoked within each request context, and only once per context. * @returns A RequestState object with `get` and `set` methods, and a unique `ref` for debugging. * * @example * const userState = defineRequestState(() => ({ id: '', name: '' })); * // Later, within a request context: * const user = await userState.get(); */ declare function defineRequestState(initFn: () => T | Promise): RequestState; //#endregion export { RequestState, RequestStateWeakMap, defineRequestState, getCurrentRequestState, getRequestStateAsyncLocalStorage, hasRequestState, runWithRequestState }; //# sourceMappingURL=request-state.d.mts.map