import type { LogLevel } from '@rocicorp/logger';
import type { ReadonlyJSONValue } from '../../../shared/src/json.ts';
import type { MaybePromise } from '../../../shared/src/types.ts';
import { type TransformResponseMessage } from '../../../zero-protocol/src/custom-queries.ts';
import type { Schema } from '../../../zero-types/src/schema.ts';
import type { AnyQuery } from '../../../zql/src/query/query.ts';
/**
 * Invokes the callback `cb` for each query in the request or JSON body.
 * The callback should return a Query or Promise<Query> that is the transformed result.
 *
 * This function will call `cb` in parallel for each query found in the request.
 *
 * If you need to limit concurrency, you can use a library like `p-limit` to wrap the `cb` function.
 * @deprecated Use {@linkcode handleQueryRequest} instead.
 */
export declare function handleGetQueriesRequest<S extends Schema>(cb: (name: string, args: readonly ReadonlyJSONValue[]) => MaybePromise<{
    query: AnyQuery;
} | AnyQuery>, schema: S, requestOrJsonBody: Request | ReadonlyJSONValue, logLevel?: LogLevel): Promise<TransformResponseMessage>;
/**
 * Invokes the callback `cb` for each query in the request or JSON body.
 * The callback should return a Query or Promise<Query> that is the transformed result.
 *
 * This function will call `cb` in parallel for each query found in the request.
 *
 * If you need to limit concurrency, you can use a library like `p-limit` to wrap the `cb` function.
 * @deprecated Use {@linkcode handleQueryRequest} instead.
 */
export declare function handleTransformRequest<S extends Schema>(cb: (name: string, args: readonly ReadonlyJSONValue[]) => MaybePromise<{
    query: AnyQuery;
} | AnyQuery>, schema: S, requestOrJsonBody: Request | ReadonlyJSONValue, logLevel?: LogLevel): Promise<TransformResponseMessage>;
/**
 * Processes a transform request by invoking the provided callback for each query.
 * The callback should return a Query that is the transformed result.
 *
 * This function will call `transformQuery` in parallel for each query found in the request.
 *
 * @param transformQuery - Callback function that takes a query name and args, and returns a Query
 * @param schema - The Zero schema
 * @param requestOrJsonBody - Either a Request object or the JSON body directly
 * @param logLevel - Logging level (defaults to 'info')
 * @returns A Promise that resolves to a TransformResponseMessage
 */
export declare function handleQueryRequest<S extends Schema>(transformQuery: TransformQueryFunction, schema: S, requestOrJsonBody: Request | ReadonlyJSONValue, logLevel?: LogLevel): Promise<["transformed", ({
    message?: string | undefined;
    details?: ReadonlyJSONValue | undefined;
    error: "app";
    id: string;
    name: string;
} | {
    details?: ReadonlyJSONValue | undefined;
    error: "parse";
    id: string;
    name: string;
    message: string;
} | {
    id: string;
    name: string;
    ast: import("../../../zero-protocol/src/ast.ts").AST;
})[]] | ["transformFailed", {
    details?: ReadonlyJSONValue | undefined;
    message: string;
    kind: "TransformFailed";
    queryIDs: string[];
    origin: "server";
    reason: "parse" | "database" | "internal";
} | {
    details?: ReadonlyJSONValue | undefined;
    bodyPreview?: string | undefined;
    message: string;
    kind: "TransformFailed";
    queryIDs: string[];
    origin: "zeroCache";
    reason: "http";
    status: number;
} | {
    details?: ReadonlyJSONValue | undefined;
    message: string;
    kind: "TransformFailed";
    queryIDs: string[];
    origin: "zeroCache";
    reason: "parse" | "internal" | "timeout";
}]>;
/**
 * A function that transforms a query by name and arguments into a Query object.
 *
 * @param name - The name of the query (can be dot-separated for nested queries)
 * @param args - The arguments to pass to the query (can be undefined)
 * @returns A Query object
 */
export type TransformQueryFunction = (name: string, args: ReadonlyJSONValue | undefined) => AnyQuery;
//# sourceMappingURL=process-queries.d.ts.map