/**
 * Cloudflare D1 client implementation for Effect SQL, backed by a Workers `D1Database` binding.
 *
 * This module adapts a Cloudflare D1 database binding into both the
 * D1-specific `D1Client` service and the generic Effect `SqlClient` service.
 * It uses the SQLite statement compiler, caches prepared statements, maps D1
 * failures to `SqlError`, and provides direct or config-backed layers.
 * Transactions, streaming queries, and `updateValues` are not supported by this
 * driver.
 *
 * @stability unstable
 * @since 4.0.0
 */
import type { D1Database } from "@cloudflare/workers-types";
import * as Config from "effect/Config";
import * as Context from "effect/Context";
import * as Duration from "effect/Duration";
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
import * as Reactivity from "effect/reactivity/Reactivity";
import type * as Scope from "effect/Scope";
import * as Client from "effect/sql/SqlClient";
import { SqlError } from "effect/sql/SqlError";
import * as Statement from "effect/sql/Statement";
/**
 * Unique runtime identifier used to tag `D1Client` values.
 *
 * @stability unstable
 * @category type IDs
 * @since 4.0.0
 */
export declare const TypeId: TypeId;
/**
 * Type-level literal for the `D1Client` runtime identifier.
 *
 * @stability unstable
 * @category type IDs
 * @since 4.0.0
 */
export type TypeId = "~@effect/sql-d1/D1Client";
/**
 * Cloudflare D1 SQL client service, extending `SqlClient` with its D1 configuration and no `updateValues` support.
 *
 * @stability unstable
 * @category services
 * @since 4.0.0
 */
export interface D1Client extends Client.SqlClient {
    readonly [TypeId]: TypeId;
    readonly config: D1ClientConfig;
    /**
     * Executes SQL statements as a single atomic D1 batch and returns their row results in order.
     *
     * **When to use**
     *
     * Use when you have a fixed collection of statements that should run in one
     * request and roll back together if any statement fails.
     *
     * **Gotchas**
     *
     * Each statement uses the query and result name transformations from the
     * client that created it. Mixing clients can produce differently shaped row
     * results within the same batch.
     *
     * @since 4.0.0
     */
    readonly batch: <const Statements extends ReadonlyArray<Statement.Statement<any>>>(statements: Statements) => Effect.Effect<{
        readonly [K in keyof Statements]: Effect.Success<Statements[K]>;
    }, SqlError>;
    /** Not supported in d1 */
    readonly updateValues: never;
}
/**
 * Service tag for the Cloudflare D1 SQL client.
 *
 * **When to use**
 *
 * Use to access or provide a Cloudflare D1 SQL client through the Effect
 * context.
 *
 * @stability unstable
 * @category services
 * @since 4.0.0
 */
export declare const D1Client: Context.Service<D1Client, D1Client>;
/**
 * Configuration for a Cloudflare D1 client, including the `D1Database`, prepared statement cache settings, span attributes, and query/result name transforms.
 *
 * @stability unstable
 * @category models
 * @since 4.0.0
 */
export interface D1ClientConfig {
    readonly db: D1Database;
    readonly prepareCacheSize?: number | undefined;
    readonly prepareCacheTTL?: Duration.Input | undefined;
    readonly spanAttributes?: Record<string, unknown> | undefined;
    readonly transformResultNames?: ((str: string) => string) | undefined;
    readonly transformQueryNames?: ((str: string) => string) | undefined;
}
/**
 * Creates a scoped Cloudflare D1 SQL client. Prepared statements are cached, while transactions and streaming queries are not supported by this driver.
 *
 * @stability unstable
 * @category constructors
 * @since 4.0.0
 */
export declare const make: (options: D1ClientConfig) => Effect.Effect<D1Client, never, Scope.Scope | Reactivity.Reactivity>;
/**
 * Creates a layer from a `Config`-wrapped D1 client configuration, providing both `D1Client` and `SqlClient`.
 *
 * @stability unstable
 * @category layers
 * @since 4.0.0
 */
export declare const layerConfig: (config: Config.Wrap<D1ClientConfig>) => Layer.Layer<D1Client | Client.SqlClient, Config.ConfigError>;
/**
 * Creates a layer from a concrete D1 client configuration, providing both `D1Client` and `SqlClient`.
 *
 * @stability unstable
 * @category layers
 * @since 4.0.0
 */
export declare const layer: (config: D1ClientConfig) => Layer.Layer<D1Client | Client.SqlClient, Config.ConfigError>;
//# sourceMappingURL=D1Client.d.ts.map