import { QuerySnapshot as QuerySnapshotOrig, SnapshotMetadata, SnapshotListenOptions } from "firebase/firestore"; import Query from "./Query"; import Entity from "./Entity"; import { _IQuerySnapshot, _ICollection, DocumentChange } from "./types"; /** * A wrapper around the Firestore QuerySnapshot class. */ export default class QuerySnapshot// eslint-disable-next-line @typescript-eslint/indent implements _IQuerySnapshot { /** * @hidden */ private _Entity; /** * @hidden */ private _collection; /** * @hidden */ private _nativeSnapshot; /** * @hidden */ private _docs; /** * @hidden */ private _query; /** * Creates a query snapshot from firestore snapshot. * @param nativeSnapshot The native query snapshot. * @param Entity The entity to represention. * @param collection The collection for the entity. * @param query The query which was run. */ constructor(nativeSnapshot: QuerySnapshotOrig, Entity: new () => T, collection: _ICollection, query: Query); /** * The docs in the snapshot. */ get docs(): T[]; /** * The number of docs in the snapshot. */ get size(): number; /** * Whether or not the snapshot is empty. */ get empty(): boolean; /** * The snapshot metadata. */ get metadata(): SnapshotMetadata; /** * The query which resulted in the snapshot. */ get query(): Query; /** * Executes a callback function on the snapshot docs. * @param callback The function to run on each doc. */ forEach(callback: (doc: T, index: number) => void): void; /** * Returns an array of the document changes since the last snapshot. * @param opts Options to control what type of changes to include in the results. */ docChanges(opts?: SnapshotListenOptions): DocumentChange[]; /** * Helper function to deserialize snapshot value. * @hidden */ private deserializeValue; }