import { DataSourceDelegate, EntityCollection, FilterCombination, ResolvedEntityCollection } from "@firecms/core"; import { Firestore } from "@firebase/firestore"; import { FirebaseApp } from "@firebase/app"; import { FirestoreTextSearchControllerBuilder } from "../types/text_search"; /** * @group Firebase */ export interface FirestoreDataSourceProps { firebaseApp?: FirebaseApp; /** * You can use this controller to return a list of ids from a search index, given a * `path` and a `searchString`. */ textSearchControllerBuilder?: FirestoreTextSearchControllerBuilder; /** * Fallback to local text search if no text search controller is specified, * or if the controller does not support the given path. */ localTextSearchEnabled?: boolean; /** * Use this builder to indicate which indexes are available in your * Firestore database. This is used to allow filtering and sorting * for multiple fields in the CMS. */ firestoreIndexesBuilder?: FirestoreIndexesBuilder; } export type FirestoreIndexesBuilder = (params: { path: string; collection: EntityCollection; }) => FilterCombination[] | undefined; export type FirestoreDelegate = DataSourceDelegate & { initTextSearch: (props: { path: string; databaseId?: string; collection?: EntityCollection | ResolvedEntityCollection; }) => Promise; }; /** * Use this hook to build a {@link DataSource} based on Firestore * @param firebaseApp * @param textSearchControllerBuilder * @param collectionRegistry * @group Firebase */ export declare function useFirestoreDelegate({ firebaseApp, textSearchControllerBuilder, firestoreIndexesBuilder, localTextSearchEnabled }: FirestoreDataSourceProps): FirestoreDelegate; /** * Recursive function that converts Firestore data types into CMS or plain * JS types. * FireCMS uses Javascript dates internally instead of Firestore timestamps. * This makes it easier to interact with the rest of the libraries and * bindings. * Also, Firestore references are replaced with {@link EntityReference} * @param data * @group Firestore */ export declare function firestoreToCMSModel(data: any): any; export declare function cmsToFirestoreModel(data: any, firestore: Firestore, inArray?: boolean): any;