import { type ArrayOrValue } from '@dereekb/util'; import { type QueryConstraint } from 'firebase/firestore'; import { type FullFirestoreQueryConstraintHandlersMapping } from './../../common/firestore/query/constraint'; import { type FirestoreQueryConstraintFunctionsDriver, type FirestoreQueryDriver } from '../../common/firestore/driver/query'; import { type Query } from '../../common/firestore/types'; /** * Accumulates Firestore query constraints alongside the base query reference. * * Used internally by the client query driver to build up constraints before * combining them into a final query via the `firebase/firestore` `query()` function. */ export interface FirebaseFirestoreQueryBuilder { readonly query: Query; readonly constraints: QueryConstraint[]; } /** * Appends one or more `QueryConstraint` values to the builder, returning a new builder instance. * * @param builder - current query builder state * @param constraint - constraint(s) to append * @returns a new {@link FirebaseFirestoreQueryBuilder} with the added constraint(s) */ export declare function addConstraintToBuilder(builder: FirebaseFirestoreQueryBuilder, constraint: ArrayOrValue): FirebaseFirestoreQueryBuilder; /** * Maps each abstract {@link FirestoreQueryConstraintType} to its client-side `firebase/firestore` * implementation. The `FIRESTORE_OFFSET_QUERY_CONSTRAINT_TYPE` is `undefined` because Firestore * client SDK does not support offset-based pagination (server-only feature). */ export declare const FIRESTORE_CLIENT_QUERY_CONSTRAINT_HANDLER_MAPPING: FullFirestoreQueryConstraintHandlersMapping; /** * Creates a {@link FirestoreQueryConstraintFunctionsDriver} for the client `firebase/firestore` SDK. * * Converts abstract query constraints into `firebase/firestore` `QueryConstraint` objects * and composes them into an executable `Query`. * * @returns a {@link FirestoreQueryConstraintFunctionsDriver} backed by the `firebase/firestore` client SDK */ export declare function firebaseFirestoreQueryConstraintFunctionsDriver(): FirestoreQueryConstraintFunctionsDriver; /** * Creates the client-side {@link FirestoreQueryDriver} that executes queries, counts, and streams * using the `firebase/firestore` SDK. * * Note: Transactions are not supported for queries on the client; passing a `transaction` to `getDocs` * will throw an error. * * @returns a {@link FirestoreQueryDriver} backed by the `firebase/firestore` client SDK * * @example * ```ts * const queryDriver = firebaseFirestoreQueryDriver(); * // Used internally by firebaseFirestoreClientDrivers() * ``` */ export declare function firebaseFirestoreQueryDriver(): FirestoreQueryDriver;