import { entityKind } from "drizzle-orm/entity";
import { PgAsyncDatabase } from "drizzle-orm/pg-core/async/db";
import type { DrizzlePgConfig } from "drizzle-orm/pg-core/utils";
import type { AnyRelations, EmptyRelations } from "drizzle-orm/relations";
import { PgwasmError } from "../errors";
import type { Pgwasm } from "../interface";
import { type PgwasmQueryResultHKT } from "./session";
export declare class PgwasmDatabase<TRelations extends AnyRelations = EmptyRelations> extends PgAsyncDatabase<PgwasmQueryResultHKT, TRelations> {
    static readonly [entityKind]: string;
}
/**
 * Whether to use JIT row mappers: only when asked for (`jit: true`) and `new Function` works here. JIT
 * mappers are compiled with it, and a strict content security policy (an MV3 extension page's) makes it
 * throw; the driver then falls back to the premade mappers instead of failing every query.
 */
export declare function jitMappersUsable(requested: boolean | undefined): boolean;
/** drizzle's object form: its config, with the pgwasm database as `client`. */
export type PgwasmDrizzleConfig<TRelations extends AnyRelations = EmptyRelations, TClient extends Pgwasm = Pgwasm> = DrizzlePgConfig<TRelations> & {
    client: TClient;
};
/** The form of a `drizzle()` call that would have the driver open its own database. */
export type UnsupportedDrizzleForm = "connection" | "connection string" | "no client";
/**
 * A `drizzle()` call without a pgwasm database: `drizzle({ connection })`, `drizzle("…")`, `drizzle()`, or a
 * `client` that is not a pgwasm database. The driver never opens its own database: create one with
 * `createPgwasm()` and pass it in.
 */
export declare class UnsupportedDrizzleConfigError extends PgwasmError {
    name: string;
    readonly form: UnsupportedDrizzleForm;
    constructor(form: UnsupportedDrizzleForm);
}
/**
 * A Drizzle database over a pgwasm database: `drizzle(pg, config)`, or drizzle's object form
 * `drizzle({ client: pg, ...config })`, which is the same thing. The driver never opens its own database, so
 * the forms that would (`{ connection }`, a connection string) are not accepted; at runtime they throw
 * {@link UnsupportedDrizzleConfigError}.
 */
export declare function drizzle<TRelations extends AnyRelations = EmptyRelations, TClient extends Pgwasm = Pgwasm>(client: TClient, config?: DrizzlePgConfig<TRelations>): PgwasmDatabase<TRelations> & {
    $client: TClient;
};
export declare namespace drizzle {
    var mock: <TRelations extends AnyRelations = EmptyRelations>(config?: DrizzlePgConfig<TRelations>) => PgwasmDatabase<TRelations> & {
        $client: "$client is not available on drizzle.mock()";
    };
}
export declare function drizzle<TRelations extends AnyRelations = EmptyRelations, TClient extends Pgwasm = Pgwasm>(config: PgwasmDrizzleConfig<TRelations, TClient>): PgwasmDatabase<TRelations> & {
    $client: TClient;
};
//# sourceMappingURL=driver.d.ts.map