import { Span } from '@opentelemetry/api'; import { InstrumentationConfig } from '@opentelemetry/instrumentation'; export interface FirebaseOptions { [key: string]: any; apiKey?: string; authDomain?: string; databaseURL?: string; projectId?: string; storageBucket?: string; messagingSenderId?: string; appId?: string; measurementId?: string; } export interface FirebaseApp { name: string; options: FirebaseOptions; automaticDataCollectionEnabled: boolean; delete(): Promise; } export interface DocumentData { [field: string]: any; } export type WithFieldValue = T; export type PartialWithFieldValue = Partial; export interface SetOptions { merge?: boolean; mergeFields?: (string | number | symbol)[]; } export interface DocumentReference { id: string; firestore: { app: FirebaseApp; settings: FirestoreSettings; useEmulator: (host: string, port: number) => void; toJSON: () => { app: FirebaseApp; settings: FirestoreSettings; }; }; type: 'collection' | 'document' | string; path: string; parent: CollectionReference; } export interface CollectionReference { id: string; firestore: { app: FirebaseApp; settings: FirestoreSettings; useEmulator: (host: string, port: number) => void; toJSON: () => { app: FirebaseApp; settings: FirestoreSettings; }; }; type: string; path: string; parent: DocumentReference | null; } export interface QuerySnapshot { docs: Array>; size: number; empty: boolean; } export interface FirestoreSettings { host?: string; ssl?: boolean; ignoreUndefinedProperties?: boolean; cacheSizeBytes?: number; experimentalForceLongPolling?: boolean; experimentalAutoDetectLongPolling?: boolean; useFetchStreams?: boolean; } /** * Firebase Auto Instrumentation */ export interface FirebaseInstrumentationConfig extends InstrumentationConfig { firestoreSpanCreationHook?: FirestoreSpanCreationHook; functions?: FunctionsConfig; } export interface FunctionsConfig { requestHook?: RequestHook; responseHook?: ResponseHook; errorHook?: ErrorHook; } export type RequestHook = (span: Span) => void; export type ResponseHook = (span: Span, error?: unknown) => void; export type ErrorHook = (span: Span, error?: unknown) => Promise | void; export interface FirestoreSpanCreationHook { (span: Span): void; } export type GetDocsType = (query: CollectionReference) => Promise>; export type SetDocType = ((reference: DocumentReference, data: WithFieldValue) => Promise) & ((reference: DocumentReference, data: PartialWithFieldValue, options: SetOptions) => Promise); export type AddDocType = (reference: CollectionReference, data: WithFieldValue) => Promise>; export type DeleteDocType = (reference: DocumentReference) => Promise; export type OverloadedParameters = T extends { (...args: infer A1): unknown; (...args: infer A2): unknown; } ? A1 | A2 : T extends (...args: infer A) => unknown ? A : unknown; /** * A bare minimum of how Cloud Functions for Firebase (v2) are defined. */ export type FirebaseFunctions = ((handler: () => Promise | unknown) => (...args: unknown[]) => Promise | unknown) | ((documentOrOptions: string | string[] | Record, handler: () => Promise | unknown) => (...args: unknown[]) => Promise | unknown); export type AvailableFirebaseFunctions = { onRequest: FirebaseFunctions; onCall: FirebaseFunctions; onDocumentCreated: FirebaseFunctions; onDocumentUpdated: FirebaseFunctions; onDocumentDeleted: FirebaseFunctions; onDocumentWritten: FirebaseFunctions; onDocumentCreatedWithAuthContext: FirebaseFunctions; onDocumentUpdatedWithAuthContext: FirebaseFunctions; onDocumentDeletedWithAuthContext: FirebaseFunctions; onDocumentWrittenWithAuthContext: FirebaseFunctions; onSchedule: FirebaseFunctions; onObjectFinalized: FirebaseFunctions; onObjectArchived: FirebaseFunctions; onObjectDeleted: FirebaseFunctions; onObjectMetadataUpdated: FirebaseFunctions; }; //# sourceMappingURL=types.d.ts.map