import type { ConnectionPool, IResult } from 'mssql';
import { entityKind } from "../entity.js";
import type { Logger } from "../logger.js";
import type { MsSqlDialect } from "../mssql-core/dialect.js";
import type { SelectedFieldsOrdered } from "../mssql-core/query-builders/select.types.js";
import { MsSqlSession, MsSqlTransaction, type MsSqlTransactionConfig, PreparedQuery, type PreparedQueryConfig, type PreparedQueryHKT, type PreparedQueryKind, type QueryResultHKT } from "../mssql-core/session.js";
import type { RelationalSchemaConfig, TablesRelationalConfig } from "../relations.js";
import { type Query, type SQL } from "../sql/sql.js";
import { type Assume } from "../utils.js";
import { AutoPool } from "./pool.js";
export type NodeMsSqlClient = Pick<ConnectionPool, 'request'> | AutoPool;
export type MsSqlQueryResult<T extends unknown | unknown[] = any> = IResult<T>;
export declare class NodeMsSqlPreparedQuery<T extends PreparedQueryConfig> extends PreparedQuery<T> {
    private client;
    private params;
    private logger;
    private fields;
    private customResultMapper?;
    static readonly [entityKind]: string;
    private rawQuery;
    constructor(client: NodeMsSqlClient, queryString: string, params: unknown[], logger: Logger, fields: SelectedFieldsOrdered | undefined, customResultMapper?: ((rows: unknown[][]) => T["execute"]) | undefined);
    execute(placeholderValues?: Record<string, unknown>): Promise<T['execute']>;
    iterator(placeholderValues?: Record<string, unknown>): AsyncGenerator<T['execute'] extends any[] ? T['execute'][number] : T['execute']>;
}
export interface NodeMsSqlSessionOptions {
    logger?: Logger;
}
export declare class NodeMsSqlSession<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends MsSqlSession<NodeMsSqlQueryResultHKT, NodeMsSqlPreparedQueryHKT, TFullSchema, TSchema> {
    private client;
    private schema;
    private options;
    static readonly [entityKind]: string;
    private logger;
    constructor(client: NodeMsSqlClient, dialect: MsSqlDialect, schema: RelationalSchemaConfig<TSchema> | undefined, options: NodeMsSqlSessionOptions);
    prepareQuery<T extends PreparedQueryConfig>(query: Query, fields: SelectedFieldsOrdered | undefined, customResultMapper?: (rows: unknown[][]) => T['execute']): PreparedQueryKind<NodeMsSqlPreparedQueryHKT, T>;
    all<T = unknown>(query: SQL): Promise<T[]>;
    transaction<T>(transaction: (tx: NodeMsSqlTransaction<TFullSchema, TSchema>) => Promise<T>, config?: MsSqlTransactionConfig): Promise<T>;
}
export declare class NodeMsSqlTransaction<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends MsSqlTransaction<NodeMsSqlQueryResultHKT, NodeMsSqlPreparedQueryHKT, TFullSchema, TSchema> {
    static readonly [entityKind]: string;
    transaction<T>(transaction: (tx: NodeMsSqlTransaction<TFullSchema, TSchema>) => Promise<T>): Promise<T>;
}
export interface NodeMsSqlQueryResultHKT extends QueryResultHKT {
    type: MsSqlQueryResult<this['row']>;
}
export interface NodeMsSqlPreparedQueryHKT extends PreparedQueryHKT {
    type: NodeMsSqlPreparedQuery<Assume<this['config'], PreparedQueryConfig>>;
}
