import type { FirebaseApp } from "firebase/app"; import type { Auth, Dependencies, EmailAuthCredential, Persistence, ReactNativeAsyncStorage, User, UserCredential } from "firebase/auth"; import type { CollectionReference, DocumentData, DocumentReference, Firestore, Query } from "firebase/firestore"; import type { BaseDocument, DocumentModelInstance, GenericObject, ICollectionRepository, IGetDocumentsOptions, IUseCollection, IUseCollectionValue, IUseCount, IUseCountValue, IUseDocument, IUseDocumentValue, IUseFirestore } from "./database/firestore/types"; import type { ISignIn, UserState } from "./auth/types"; import type { Messaging } from "firebase/messaging"; import type { IAppNotificationsContext } from "./messaging/types"; import type { Functions } from "firebase/functions"; import type { FirebaseStorage } from "firebase/storage"; import type { StorageFile, UploadResult } from "./storage/types"; export interface FirebombOptions { /** * use this to enable Firebase Auth * @default true */ useAuth?: boolean, /** * */ authSettings?: Dependencies, /** * use this to enable Firebase Analytics */ useAnalytics?: boolean, /** * use this to enable Firebase Realtime Database */ useRealtimeDB?: boolean, /** * use this to enable Firebase Firestore * @default true */ useFirestore?: boolean, /** * use this to enable Firebase Functions */ useFunctions?: boolean, /** * use this to enable Firebase Cloud Messaging */ useMessaging?: boolean, /** * use this to enable Firebase Storage */ useStorage?: boolean, } export interface WebModule { /** * Initialize Firebomb * @param options FirebombOptions */ init(options: FirebombOptions): void, getApp(): FirebaseApp, getApps(): FirebaseApp[], AuthProvider: ({ children }: { children: any }) => React.JSX.Element, useAuth: () => UserState, getAuth: (app?: FirebaseApp) => Auth | null, getCurrentUser: () => User | null; getEmailAuthCredential: (password: string) => EmailAuthCredential, getReactNativePersistence: (storage: ReactNativeAsyncStorage) => Persistence, getTenant: () => string | null, getToken: () => Promise, sendPasswordResetEmail: (email: string, url: string) => Promise, setTenant: (tenant: string) => void, signIn: (params: ISignIn) => Promise, signOut: () => Promise, createModel: (collection: string, schema: Partial, data?: GenericObject) => DocumentModelInstance, createRepository: (name: string, schema: GenericObject) => (new () => ICollectionRepository), deleteDocument: (collection: string, document: string) => Promise, deleteDocuments: (collection: string, documents: string[]) => Promise, FirestoreProvider: ({ children }: { children: any }) => React.JSX.Element, generateQuery: (collection: string, options?: IGetDocumentsOptions) => Query, getDocument: (collection: string, documentId: string) => Promise, getDocumentRef: (collection: string, documentId: string, databaseId?: string) => DocumentReference, getDocuments: (collection: string, options?: IGetDocumentsOptions) => Promise, getCollectionRef: (collection: string, databaseId?: string) => CollectionReference, getFirestore: () => Firestore | null, decrement: (collection: string, documentId: string, field: string | number) => Promise, increment: (collection: string, documentId: string, field: string | number) => Promise, toggle: (collection: string, documentId: string, field: string | number) => Promise, useCollection: (params: IUseCollection) => IUseCollectionValue, useCount: (props: IUseCount) => IUseCountValue, useDocument: (params: IUseDocument) => IUseDocumentValue, useFirestore: () => IUseFirestore, getStorage: (app?: FirebaseApp) => FirebaseStorage | null, uploadFile: (file: StorageFile, pathname: string) => Promise, uploadFiles: (files: StorageFile[], pathname: string, shouldSeparatePath?: boolean) => Promise<{ files: string[], filePaths: string[] } | UploadResult[]>, uploadUserPhoto: (blobFile: Blob, withoutDownloadLink?: boolean) => Promise, getFunctions: (app?: FirebaseApp) => Functions | null, callFunction: (name: string, payload: object) => Promise; getMessaging: (app?: FirebaseApp) => Messaging, AppNotificationsProvider: ({ children }: { children: any }) => React.JSX.Element, useAppNotifications: () => IAppNotificationsContext, } export type { BaseDocument, DocumentModelInstance, GenericObject, ICollectionRepository, IGetDocumentsOptions, IUseCollection, IUseCollectionValue, IUseCount, IUseCountValue, IUseDocument, IUseDocumentValue, IUseFirestore, ISignIn, UserState, }