/**
 * Cloudflare D1 API
 *
 * Generated from Cloudflare TypeScript SDK.
 * DO NOT EDIT - regenerate with: bun scripts/generate.ts --service d1
 */
import * as Schema from "effect/Schema";
import type * as HttpClient from "effect/unstable/http/HttpClient";
import * as API from "../client/api.ts";
import type { Credentials } from "../credentials.ts";
import { type DefaultErrors } from "../errors.ts";
declare const DatabaseAlreadyExists_base: Schema.Class<DatabaseAlreadyExists, Schema.TaggedStruct<"DatabaseAlreadyExists", {
    readonly code: Schema.Number;
    readonly message: Schema.String;
}>, import("effect/Cause").YieldableError>;
export declare class DatabaseAlreadyExists extends DatabaseAlreadyExists_base {
}
declare const DatabaseNotFound_base: Schema.Class<DatabaseNotFound, Schema.TaggedStruct<"DatabaseNotFound", {
    readonly code: Schema.Number;
    readonly message: Schema.String;
}>, import("effect/Cause").YieldableError>;
export declare class DatabaseNotFound extends DatabaseNotFound_base {
}
declare const InternalError_base: Schema.Class<InternalError, Schema.TaggedStruct<"InternalError", {
    readonly code: Schema.Number;
    readonly message: Schema.String;
}>, import("effect/Cause").YieldableError>;
export declare class InternalError extends InternalError_base {
}
declare const InvalidObjectIdentifier_base: Schema.Class<InvalidObjectIdentifier, Schema.TaggedStruct<"InvalidObjectIdentifier", {
    readonly code: Schema.Number;
    readonly message: Schema.String;
}>, import("effect/Cause").YieldableError>;
export declare class InvalidObjectIdentifier extends InvalidObjectIdentifier_base {
}
declare const InvalidProperty_base: Schema.Class<InvalidProperty, Schema.TaggedStruct<"InvalidProperty", {
    readonly code: Schema.Number;
    readonly message: Schema.String;
}>, import("effect/Cause").YieldableError>;
export declare class InvalidProperty extends InvalidProperty_base {
}
declare const InvalidRequest_base: Schema.Class<InvalidRequest, Schema.TaggedStruct<"InvalidRequest", {
    readonly code: Schema.Number;
    readonly message: Schema.String;
}>, import("effect/Cause").YieldableError>;
export declare class InvalidRequest extends InvalidRequest_base {
}
declare const NoHistoryAvailable_base: Schema.Class<NoHistoryAvailable, Schema.TaggedStruct<"NoHistoryAvailable", {
    readonly code: Schema.Number;
    readonly message: Schema.String;
}>, import("effect/Cause").YieldableError>;
export declare class NoHistoryAvailable extends NoHistoryAvailable_base {
}
declare const TimestampTooOld_base: Schema.Class<TimestampTooOld, Schema.TaggedStruct<"TimestampTooOld", {
    readonly code: Schema.Number;
    readonly message: Schema.String;
}>, import("effect/Cause").YieldableError>;
export declare class TimestampTooOld extends TimestampTooOld_base {
}
declare const UnknownError_base: Schema.Class<UnknownError, Schema.TaggedStruct<"UnknownError", {
    readonly code: Schema.Number;
    readonly message: Schema.String;
}>, import("effect/Cause").YieldableError>;
export declare class UnknownError extends UnknownError_base {
}
export interface GetBookmarkDatabaseTimeTravelRequest {
    databaseId: string;
    /** Path param: Account identifier tag. */
    accountId: string;
    /** Query param: An optional ISO 8601 timestamp. If provided, returns the nearest available bookmark at or before this timestamp. If omitted, returns the current bookmark. */
    timestamp?: string;
}
export declare const GetBookmarkDatabaseTimeTravelRequest: Schema.Schema<GetBookmarkDatabaseTimeTravelRequest>;
export interface GetBookmarkDatabaseTimeTravelResponse {
    /** A bookmark representing a specific state of the database at a specific point in time. */
    bookmark?: string | null;
}
export declare const GetBookmarkDatabaseTimeTravelResponse: Schema.Schema<GetBookmarkDatabaseTimeTravelResponse>;
export type GetBookmarkDatabaseTimeTravelError = DefaultErrors | InvalidObjectIdentifier | NoHistoryAvailable | TimestampTooOld | DatabaseNotFound;
export declare const getBookmarkDatabaseTimeTravel: API.OperationMethod<GetBookmarkDatabaseTimeTravelRequest, GetBookmarkDatabaseTimeTravelResponse, GetBookmarkDatabaseTimeTravelError, Credentials | HttpClient.HttpClient>;
export interface ListDatabasesRequest {
    /** Path param: Account identifier tag. */
    accountId: string;
    page?: number;
    perPage?: number;
    /** Query param: a database name to search for. */
    name?: string;
}
export declare const ListDatabasesRequest: Schema.Schema<ListDatabasesRequest>;
export interface ListDatabasesResponse {
    result: {
        createdAt?: string | null;
        name?: string | null;
        uuid?: string | null;
        version?: string | null;
    }[];
    resultInfo?: {
        count?: number | null;
        page?: number | null;
        perPage?: number | null;
        totalCount?: number | null;
    } | null;
}
export declare const ListDatabasesResponse: Schema.Schema<ListDatabasesResponse>;
export type ListDatabasesError = DefaultErrors;
export declare const listDatabases: API.PaginatedOperationMethod<ListDatabasesRequest, ListDatabasesResponse, ListDatabasesError, Credentials | HttpClient.HttpClient>;
export interface GetDatabaseRequest {
    databaseId: string;
    /** Account identifier tag. */
    accountId: string;
}
export declare const GetDatabaseRequest: Schema.Schema<GetDatabaseRequest>;
export interface GetDatabaseResponse {
    /** Specifies the timestamp the resource was created as an ISO8601 string. */
    createdAt?: string | null;
    /** The D1 database's size, in bytes. */
    fileSize?: number | null;
    /** D1 database name. */
    name?: string | null;
    numTables?: number | null;
    /** Configuration for D1 read replication. */
    readReplication?: {
        mode: "auto" | "disabled";
    } | null;
    /** D1 database identifier (UUID). */
    uuid?: string | null;
    version?: string | null;
}
export declare const GetDatabaseResponse: Schema.Schema<GetDatabaseResponse>;
export type GetDatabaseError = DefaultErrors | InvalidObjectIdentifier | DatabaseNotFound | UnknownError;
export declare const getDatabase: API.OperationMethod<GetDatabaseRequest, GetDatabaseResponse, GetDatabaseError, Credentials | HttpClient.HttpClient>;
export interface CreateDatabaseRequest {
    /** Path param: Account identifier tag. */
    accountId: string;
    /** Body param: D1 database name. */
    name: string;
    /** Body param: Specify the location to restrict the D1 database to run and store data. If this option is present, the location hint is ignored. */
    jurisdiction?: "eu" | "fedramp";
    /** Body param: Specify the region to create the D1 primary, if available. If this option is omitted, the D1 will be created as close as possible to the current user. */
    primaryLocationHint?: "wnam" | "enam" | "weur" | "eeur" | "apac" | "oc";
}
export declare const CreateDatabaseRequest: Schema.Schema<CreateDatabaseRequest>;
export interface CreateDatabaseResponse {
    /** Specifies the timestamp the resource was created as an ISO8601 string. */
    createdAt?: string | null;
    /** The D1 database's size, in bytes. */
    fileSize?: number | null;
    /** D1 database name. */
    name?: string | null;
    numTables?: number | null;
    /** Configuration for D1 read replication. */
    readReplication?: {
        mode: "auto" | "disabled";
    } | null;
    /** D1 database identifier (UUID). */
    uuid?: string | null;
    version?: string | null;
}
export declare const CreateDatabaseResponse: Schema.Schema<CreateDatabaseResponse>;
export type CreateDatabaseError = DefaultErrors | InvalidObjectIdentifier | InvalidProperty | DatabaseAlreadyExists;
export declare const createDatabase: API.OperationMethod<CreateDatabaseRequest, CreateDatabaseResponse, CreateDatabaseError, Credentials | HttpClient.HttpClient>;
export interface UpdateDatabaseRequest {
    databaseId: string;
    /** Path param: Account identifier tag. */
    accountId: string;
    /** Body param: Configuration for D1 read replication. */
    readReplication: {
        mode: "auto" | "disabled";
    };
}
export declare const UpdateDatabaseRequest: Schema.Schema<UpdateDatabaseRequest>;
export interface UpdateDatabaseResponse {
    /** Specifies the timestamp the resource was created as an ISO8601 string. */
    createdAt?: string | null;
    /** The D1 database's size, in bytes. */
    fileSize?: number | null;
    /** D1 database name. */
    name?: string | null;
    numTables?: number | null;
    /** Configuration for D1 read replication. */
    readReplication?: {
        mode: "auto" | "disabled";
    } | null;
    /** D1 database identifier (UUID). */
    uuid?: string | null;
    version?: string | null;
}
export declare const UpdateDatabaseResponse: Schema.Schema<UpdateDatabaseResponse>;
export type UpdateDatabaseError = DefaultErrors | InvalidObjectIdentifier | InternalError | DatabaseNotFound;
export declare const updateDatabase: API.OperationMethod<UpdateDatabaseRequest, UpdateDatabaseResponse, UpdateDatabaseError, Credentials | HttpClient.HttpClient>;
export interface PatchDatabaseRequest {
    databaseId: string;
    /** Path param: Account identifier tag. */
    accountId: string;
    /** Body param: Configuration for D1 read replication. */
    readReplication?: {
        mode: "auto" | "disabled";
    };
}
export declare const PatchDatabaseRequest: Schema.Schema<PatchDatabaseRequest>;
export interface PatchDatabaseResponse {
    /** Specifies the timestamp the resource was created as an ISO8601 string. */
    createdAt?: string | null;
    /** The D1 database's size, in bytes. */
    fileSize?: number | null;
    /** D1 database name. */
    name?: string | null;
    numTables?: number | null;
    /** Configuration for D1 read replication. */
    readReplication?: {
        mode: "auto" | "disabled";
    } | null;
    /** D1 database identifier (UUID). */
    uuid?: string | null;
    version?: string | null;
}
export declare const PatchDatabaseResponse: Schema.Schema<PatchDatabaseResponse>;
export type PatchDatabaseError = DefaultErrors | InvalidObjectIdentifier | InternalError | DatabaseNotFound;
export declare const patchDatabase: API.OperationMethod<PatchDatabaseRequest, PatchDatabaseResponse, PatchDatabaseError, Credentials | HttpClient.HttpClient>;
export interface DeleteDatabaseRequest {
    databaseId: string;
    /** Account identifier tag. */
    accountId: string;
}
export declare const DeleteDatabaseRequest: Schema.Schema<DeleteDatabaseRequest>;
export type DeleteDatabaseResponse = unknown;
export declare const DeleteDatabaseResponse: Schema.Schema<DeleteDatabaseResponse>;
export type DeleteDatabaseError = DefaultErrors | InvalidObjectIdentifier | DatabaseNotFound | UnknownError;
export declare const deleteDatabase: API.OperationMethod<DeleteDatabaseRequest, DeleteDatabaseResponse, DeleteDatabaseError, Credentials | HttpClient.HttpClient>;
export interface ExportDatabaseRequest {
    databaseId: string;
    /** Path param: Account identifier tag. */
    accountId: string;
    /** Body param: Specifies that you will poll this endpoint until the export completes */
    outputFormat: "polling";
    /** Body param: To poll an in-progress export, provide the current bookmark (returned by your first polling response) */
    currentBookmark?: string;
    /** Body param: */
    dumpOptions?: {
        noData?: boolean;
        noSchema?: boolean;
        tables?: string[];
    };
}
export declare const ExportDatabaseRequest: Schema.Schema<ExportDatabaseRequest>;
export interface ExportDatabaseResponse {
    /** The current time-travel bookmark for your D1, used to poll for updates. Will not change for the duration of the export task. */
    atBookmark?: string | null;
    /** Only present when status = 'error'. Contains the error message. */
    error?: string | null;
    /** Logs since the last time you polled */
    messages?: string[] | null;
    /** Only present when status = 'complete' */
    result?: {
        filename?: string | null;
        signedUrl?: string | null;
    } | null;
    status?: "complete" | "error" | "active" | null;
    success?: boolean | null;
    type?: "export" | null;
}
export declare const ExportDatabaseResponse: Schema.Schema<ExportDatabaseResponse>;
export type ExportDatabaseError = DefaultErrors | InvalidObjectIdentifier | InvalidRequest | DatabaseNotFound;
export declare const exportDatabase: API.OperationMethod<ExportDatabaseRequest, ExportDatabaseResponse, ExportDatabaseError, Credentials | HttpClient.HttpClient>;
export interface ImportDatabaseRequest {
    databaseId: string;
    /** Path param: Account identifier tag. */
    accountId: string;
    /** Body param: Indicates you have a new SQL file to upload. */
    action: "init";
    /** Body param: Required when action is 'init' or 'ingest'. An md5 hash of the file you're uploading. Used to check if it already exists, and validate its contents before ingesting. */
    etag: string;
}
export declare const ImportDatabaseRequest: Schema.Schema<ImportDatabaseRequest>;
export interface ImportDatabaseResponse {
    /** The current time-travel bookmark for your D1, used to poll for updates. Will not change for the duration of the import. Only returned if an import process is currently running or recently finished. */
    atBookmark?: string | null;
    /** Only present when status = 'error'. Contains the error message that prevented the import from succeeding. */
    error?: string | null;
    /** Derived from the database ID and etag, to use in avoiding repeated uploads. Only returned when for the 'init' action. */
    filename?: string | null;
    /** Logs since the last time you polled */
    messages?: string[] | null;
    /** Only present when status = 'complete' */
    result?: {
        finalBookmark?: string | null;
        meta?: {
            changedDb?: boolean | null;
            changes?: number | null;
            duration?: number | null;
            lastRowId?: number | null;
            rowsRead?: number | null;
            rowsWritten?: number | null;
            servedByColo?: string | null;
            servedByPrimary?: boolean | null;
            servedByRegion?: "WNAM" | "ENAM" | "WEUR" | "EEUR" | "APAC" | "OC" | null;
            sizeAfter?: number | null;
            timings?: {
                sqlDurationMs?: number | null;
            } | null;
        } | null;
        numQueries?: number | null;
    } | null;
    status?: "complete" | "error" | null;
    success?: boolean | null;
    type?: "import" | null;
    /** The R2 presigned URL to use for uploading. Only returned when for the 'init' action. */
    uploadUrl?: string | null;
}
export declare const ImportDatabaseResponse: Schema.Schema<ImportDatabaseResponse>;
export type ImportDatabaseError = DefaultErrors | InvalidObjectIdentifier;
export declare const importDatabase: API.OperationMethod<ImportDatabaseRequest, ImportDatabaseResponse, ImportDatabaseError, Credentials | HttpClient.HttpClient>;
export interface QueryDatabaseRequest {
    databaseId: string;
    /** Path param: Account identifier tag. */
    accountId: string;
    /** Body param: Your SQL query. Supports multiple statements, joined by semicolons, which will be executed as a batch. */
    sql: string;
    /** Body param: */
    params?: string[];
}
export declare const QueryDatabaseRequest: Schema.Schema<QueryDatabaseRequest>;
export interface QueryDatabaseResponse {
    result: {
        meta?: {
            changedDb?: boolean | null;
            changes?: number | null;
            duration?: number | null;
            lastRowId?: number | null;
            rowsRead?: number | null;
            rowsWritten?: number | null;
            servedByColo?: string | null;
            servedByPrimary?: boolean | null;
            servedByRegion?: "WNAM" | "ENAM" | "WEUR" | "EEUR" | "APAC" | "OC" | null;
            sizeAfter?: number | null;
            timings?: {
                sqlDurationMs?: number | null;
            } | null;
        } | null;
        results?: unknown[] | null;
        success?: boolean | null;
    }[];
}
export declare const QueryDatabaseResponse: Schema.Schema<QueryDatabaseResponse>;
export type QueryDatabaseError = DefaultErrors;
export declare const queryDatabase: API.PaginatedOperationMethod<QueryDatabaseRequest, QueryDatabaseResponse, QueryDatabaseError, Credentials | HttpClient.HttpClient>;
export interface RawDatabaseRequest {
    databaseId: string;
    /** Path param: Account identifier tag. */
    accountId: string;
    /** Body param: Your SQL query. Supports multiple statements, joined by semicolons, which will be executed as a batch. */
    sql: string;
    /** Body param: */
    params?: string[];
}
export declare const RawDatabaseRequest: Schema.Schema<RawDatabaseRequest>;
export interface RawDatabaseResponse {
    result: {
        meta?: {
            changedDb?: boolean | null;
            changes?: number | null;
            duration?: number | null;
            lastRowId?: number | null;
            rowsRead?: number | null;
            rowsWritten?: number | null;
            servedByColo?: string | null;
            servedByPrimary?: boolean | null;
            servedByRegion?: "WNAM" | "ENAM" | "WEUR" | "EEUR" | "APAC" | "OC" | null;
            sizeAfter?: number | null;
            timings?: {
                sqlDurationMs?: number | null;
            } | null;
        } | null;
        results?: {
            columns?: string[] | null;
            rows?: (number | string)[][] | null;
        } | null;
        success?: boolean | null;
    }[];
}
export declare const RawDatabaseResponse: Schema.Schema<RawDatabaseResponse>;
export type RawDatabaseError = DefaultErrors;
export declare const rawDatabase: API.PaginatedOperationMethod<RawDatabaseRequest, RawDatabaseResponse, RawDatabaseError, Credentials | HttpClient.HttpClient>;
export interface RestoreDatabaseTimeTravelRequest {
    databaseId: string;
    /** Path param: Account identifier tag. */
    accountId: string;
    /** Query param: A bookmark to restore the database to. Required if `timestamp` is not provided. */
    bookmark?: string;
    /** Query param: An ISO 8601 timestamp to restore the database to. Required if `bookmark` is not provided. */
    timestamp?: string;
}
export declare const RestoreDatabaseTimeTravelRequest: Schema.Schema<RestoreDatabaseTimeTravelRequest>;
export interface RestoreDatabaseTimeTravelResponse {
    /** The new bookmark representing the state of the database after the restore operation. */
    bookmark?: string | null;
    /** A message describing the result of the restore operation. */
    message?: string | null;
    /** The bookmark representing the state of the database before the restore operation. Can be used to undo the restore if needed. */
    previousBookmark?: string | null;
}
export declare const RestoreDatabaseTimeTravelResponse: Schema.Schema<RestoreDatabaseTimeTravelResponse>;
export type RestoreDatabaseTimeTravelError = DefaultErrors | InvalidObjectIdentifier | NoHistoryAvailable | DatabaseNotFound | InvalidProperty;
export declare const restoreDatabaseTimeTravel: API.OperationMethod<RestoreDatabaseTimeTravelRequest, RestoreDatabaseTimeTravelResponse, RestoreDatabaseTimeTravelError, Credentials | HttpClient.HttpClient>;
export {};
//# sourceMappingURL=d1.d.ts.map