UNPKG

@magnetarjs/plugin-firestore

Version:
25 lines (24 loc) 1.17 kB
import type { MagnetarPlugin } from '@magnetarjs/types'; import type { BatchSync, FirestorePluginOptions as PluginOptions } from '@magnetarjs/utils-firestore'; import type { Firestore } from 'firebase/firestore'; export type FirestorePluginOptions = PluginOptions<Firestore>; export type { FirestoreModuleConfig } from '@magnetarjs/utils-firestore'; /** A map with the `collectionPath` as key and a `BatchSync` instance as value */ export type BatchSyncMap = Map<string, BatchSync>; /** * It's required to pass the Firestore instance to make sure there are not two separate instances running which can cause issues. * As long as Firebase is initialized before you pass it, you can just import and pass it like so: * @example * ```js * import { initializeApp } from 'firebase/app' * import { getFirestore } from 'firebase/firestore' * import { CreatePlugin as FirestorePlugin } from '@magnetarjs/firestore' * * const firebaseApp = initializeApp({ }) // pass config * const db = getFirestore(firebaseApp) * * // initialise plugin * const remote = FirestorePlugin({ db }) * ``` */ export declare const CreatePlugin: MagnetarPlugin<FirestorePluginOptions>;