import type { DataSource, EntityManager } from 'typeorm'; /** * Runs the provided callback in a readonly database context backed by a slave query runner. * * If a readonly context is already active, the callback is reused within that context instead of * creating a new query runner. Starting a readonly context from inside a transaction is rejected * because it would break the current transactional guarantees. Within the callback, injected * TypeORM repositories automatically resolve against the active readonly manager, so repository * operations also use the readonly query runner without requiring manual rebinding. * * @template T * @param dataSource The TypeORM data source used to create the readonly query runner. * @param runInReadonly Async callback that receives the readonly entity manager for all database * access. Injected TypeORM repositories used inside this callback automatically participate in the * same readonly context. * @returns The value returned by `runInReadonly`. * @throws {Error} If called while a transaction context is active. * @throws {QueryRunnerProviderAlreadyReleasedError} If the current readonly context references a released query runner. */ export declare function readonly(dataSource: DataSource, runInReadonly: (entityManager: EntityManager) => Promise): Promise; export declare function createReadonlyManagerProxy(defaultManager: EntityManager): EntityManager;