import type { TableFixture } from '../types'; /** Supported connection reuse strategies exposed by the provider. */ export type ConnectionStrategy = 'shared' | 'perTest'; /** Minimum subset of a connection required by the provider. */ export type TestkitConnection = { query(sql: string, values?: unknown[]): Promise; }; /** Custom hook invoked after a shared scenario to reset session state. */ export type ConnectionResetHook = (connection: TConnection) => Promise | void; /** * Options that determine how the shared connection is cleaned up between scenarios. */ export type ConnectionResetOption = 'transaction' | 'none' | ConnectionResetHook; /** * Configuration required to construct a `TestkitProvider`. */ export interface CreateTestkitProviderOptions { connectionFactory: () => Promise; resourceFactory: (connection: TConnection, fixtures: TableFixture[]) => Promise | TResource; strategy?: ConnectionStrategy; reset?: ConnectionResetOption; releaseResource?: (resource: TResource) => Promise | void; disposeConnection?: (connection: TConnection) => Promise | void; } type PerTestAccessor = { withRepositoryFixture(fixtures: TableFixture[], callback: (resource: TResource) => Promise | Result): Promise; }; /** * Manages connection recycling for ZTD repositories by wiring fixtures into * shared or per-test sessions. */ export declare class TestkitProvider { private readonly options; private sharedConnectionPromise?; private sharedConnection?; private closed; private sharedQueue; private readonly releaseResource; private readonly disposeConnection; constructor(options: CreateTestkitProviderOptions); withRepositoryFixture(fixtures: TableFixture[], callback: (resource: TResource) => Promise | Result, overrides?: { strategy?: ConnectionStrategy; }): Promise; perTest(): PerTestAccessor; close(): Promise; private runWithSharedConnection; private runWithPerTestConnection; private beginTransactionIfNeeded; private executeReset; private ensureSharedConnection; private ensureNotClosed; } /** * Instantiates a `TestkitProvider` with the given configuration. */ export declare function createTestkitProvider(options: CreateTestkitProviderOptions): Promise>; export {};