/// import { MetaType } from '../metaTypeCreator'; import { Firestore } from '../alias'; import { QueryConstraints } from '../queryConstraints'; import { QueryConstraintLimitation } from '../queryConstraintsLimitations'; import { CollectionReference } from './collection'; import { CollectionGroup } from './collectionGroup'; export interface Query { /** * The `Firestore` for the Firestore database (useful for performing * transactions, etc.). */ readonly firestore: Firestore; stream(): NodeJS.ReadableStream; /** * Creates and returns a new Query instance that applies a field mask to * the result and returns only the specified subset of fields. You can * specify a list of field paths to return, or use an empty list to only * return the references of matching documents. * * Queries that contain field masks cannot be listened to via `onSnapshot()` * listeners. * * This function returns a new (immutable) instance of the Query (rather * than modify the existing instance) to impose the field mask. * * @param field The field paths to return. * @return The created Query. */ select(...field: (keyof T['writeFlatten'])[]): Query; } export type GeneralQuery = Query | CollectionReference | CollectionGroup; export type QueryFunction = , QC extends QueryConstraints[]>(query: Q extends never ? Q : GeneralQuery, ...queryConstraints: QC extends never ? QC : QueryConstraintLimitation) => Query;