'use client'; import { PgIdentifier } from "./pg-identifier.mjs"; import { z } from "zod"; //#region src/sql/database.d.ts declare const PostgresVersion: z.core.$ZodBranded; type PostgresVersion = z.infer; interface PostgresTransaction { /** * Exec a query and return the result as an array of objects. */ exec(query: string, params?: unknown[]): Promise; } /** * A shared interface for all postgres connections. * This is required to allow interop between pglite and regular postgres drivers */ interface Postgres extends PostgresTransaction { transaction(callback: (tx: PostgresTransaction) => Promise): Promise; cursor?(query: string, params?: unknown[], options?: { size?: number; }): AsyncGenerator; serverNum(): Promise; } type PostgresConnectionInput = { url: string; }; type PostgresFactory = (input: PostgresConnectionInput) => Postgres; declare const StageId: unique symbol; type PostgresStageId = number & { [StageId]: "StageId"; }; type PostgresStage = "Seq Scan" | "Limit" | "Bitmap Heap Scan" | "Bitmap Index Scan" | "Index Only Scan" | "Index Scan" | "BitmapOr"; type PostgresExplainStageCommon = { "Node Type": PostgresStage; "Node Id": PostgresStageId; Plans?: PostgresExplainStage[]; "Plan Width": number; "Total Cost": number; }; type PostgresExplainStage = (PostgresExplainStageCommon & { "Node Type": "Index Scan"; "Index Name": string; "Relation Name": string; Alias: string; "Rows Removed by Filter": number; }) | (PostgresExplainStageCommon & { "Node Type": "Seq Scan"; "Relation Name": string; Filter?: string; "Actual Rows": number; "Actual Loops": number; "Rows Removed by Filter": number; }) | (PostgresExplainStageCommon & { "Node Type": "Bitmap Heap Scan"; "Relation Name": string; Filter?: string; "Actual Rows": number; "Actual Loops": number; "Rows Removed by Filter": number; }) | (PostgresExplainStageCommon & { "Node Type": "Bitmap Index Scan"; "Index Name": string; Filter?: string; "Actual Rows": number; "Actual Loops": number; "Rows Removed by Filter": number; }) | (PostgresExplainStageCommon & { "Node Type": "Index Only Scan"; "Index Name": string; Filter?: string; "Actual Rows": number; "Actual Loops": number; "Rows Removed by Filter": number; }) | PostgresExplainStageCommon; /** Zod schema for PostgresExplainStage — validates common fields, passes through variant-specific ones. */ declare const PostgresExplainStageSchema: z.ZodType; type PostgresExplainResult = { "QUERY PLAN": { Plan: PostgresExplainStage; }[]; }; /** * Drops a disabled index. Rollsback if it fails for any reason * @returns Did dropping the index succeed? */ declare function dropIndex(tx: PostgresTransaction, index: PgIdentifier): Promise; //#endregion export { Postgres, PostgresConnectionInput, PostgresExplainResult, PostgresExplainStage, PostgresExplainStageCommon, PostgresExplainStageSchema, PostgresFactory, PostgresStage, PostgresStageId, PostgresTransaction, PostgresVersion, dropIndex }; //# sourceMappingURL=database.d.mts.map