import { ExtractContext, InitialQueryBuilder, QueryBuilder } from './builder/index.js'; import { Context, InferResultType, RootObjectResultConstraint, RootQueryBuilder, RootQueryFn } from './builder/types.js'; /** * Configuration options for queryOnce */ export interface QueryOnceConfig { /** * Query builder function that defines the query */ query: ((q: InitialQueryBuilder) => QueryBuilder & RootObjectResultConstraint) | (QueryBuilder & RootObjectResultConstraint); } /** * Executes a one-shot query and returns the results as an array. * * This function creates a live query collection, preloads it, extracts the results, * and automatically cleans up the collection. It's ideal for: * - AI/LLM context building * - Data export * - Background processing * - Testing * * @param queryFn - A function that receives the query builder and returns a query * @returns A promise that resolves to an array of query results * * @example * ```typescript * // Basic query * const users = await queryOnce((q) => * q.from({ user: usersCollection }) * ) * * // With filtering and projection * const activeUserNames = await queryOnce((q) => * q.from({ user: usersCollection }) * .where(({ user }) => eq(user.active, true)) * .select(({ user }) => ({ name: user.name })) * ) * ``` */ export declare function queryOnce QueryBuilder, TQuery extends QueryBuilder = ReturnType>(queryFn: TQueryFn & RootQueryFn): Promise>>; /** * Executes a one-shot query using a configuration object. * * @param config - Configuration object with the query function * @returns A promise that resolves to an array of query results * * @example * ```typescript * const recentOrders = await queryOnce({ * query: (q) => * q.from({ order: ordersCollection }) * .orderBy(({ order }) => desc(order.createdAt)) * .limit(100), * }) * ``` */ export declare function queryOnce>(config: QueryOnceConfig> & { query: RootQueryFn | RootQueryBuilder; }): Promise>>;