UNPKG

@magnetarjs/plugin-firestore-admin

Version:

Magnetar plugin firestore-admin

25 lines (24 loc) 1.18 kB
import type { MagnetarPlugin } from '@magnetarjs/types'; import { BatchSync, FirestorePluginOptions } from '@magnetarjs/utils-firestore'; import type { Firestore } from 'firebase-admin/firestore'; export type FirestoreAdminPluginOptions = FirestorePluginOptions<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-admin/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<FirestoreAdminPluginOptions>;