// Type definitions for Flamelink JavaScript SDK import * as firebase from 'firebase'; // Global export outside of module loader environment export as namespace flamelink; // Export for build systems (module loaders) export = flamelink; declare function flamelink(conf?: flamelink.FlamelinkConfig): flamelink.App; declare namespace flamelink { interface ConfigOption1 { env?: string; locale?: string; isAdminApp?: boolean; firebaseApp: any; } interface ConfigOption2 { env?: string; locale?: string; isAdminApp?: boolean; apiKey: string; authDomain: string; databaseURL: string; storageBucket: string; projectId: string; messagingSenderId?: string | number; } export type FlamelinkConfig = ConfigOption1 | ConfigOption2; interface content { ref(ref: string | string[]): firebase.database.Reference; getRaw(schemaKey: string, entryKey: string | number, options?: object): Promise; getRaw(schemaKey: string, options?: object): Promise; get(schemaKey: string, entryKey: string | number, options?: object): Promise; get(schemaKey: string, options?: object): Promise; getByFieldRaw(schemaKey: string, field: string, value: any, options?: object): Promise; getByField(schemaKey: string, field: string, value: any, options?: object): Promise; subscribeRaw(schemaKey: string, callbackFn: (error: any, result: any) => any): Promise; subscribeRaw(schemaKey: string, options: object, callbackFn: (error: any, result: any) => any): Promise; subscribeRaw(schemaKey: string, entryKey: string, callbackFn: (error: any, result: any) => any): Promise; subscribeRaw(schemaKey: string, entryKey: string, options: object, callbackFn: (error: any, result: any) => any): Promise; subscribe(schemaKey: string, callbackFn: (error: any, result: any) => any): Promise; subscribe(schemaKey: string, options: object, callbackFn: (error: any, result: any) => any): Promise; subscribe(schemaKey: string, entryKey: string, callbackFn: (error: any, result: any) => any): Promise; subscribe(schemaKey: string, entryKey: string, options: object, callbackFn: (error: any, result: any) => any): Promise; unsubscribe(schemaKey: string, entryKey?: string, event?: string): Promise; set(schemaKey: string, entryKey: string, payload: object | null): Promise; set(schemaKey: string, payload: object | null): Promise; update(schemaKey: string, entryKey: string | number, payload: object | null): Promise; update(schemaKey: string, payload: object | null): Promise; remove(schemaKey: string, entryKey: string | number): Promise; transaction(schemaKey: string, entryKey: string | number, updateFn: () => any, callbackFn?: () => any): any; } interface nav { ref(ref: string): firebase.database.Reference; getRaw(navigationKey?: string, options?: object): Promise; getRaw(options: object): Promise; get(navigationKey?: string, options?: object): Promise; get(options: object): Promise; getItemsRaw(navigationKey: string, options?: object): Promise; getItems(navigationKey: string, options?: object): Promise; subscribeRaw(callbackFn: (error: any, result: any) => any): Promise; subscribeRaw(navigationKey: string, callbackFn: (error: any, result: any) => any): Promise; subscribeRaw(options: object, callbackFn: (error: any, result: any) => any): Promise; subscribeRaw(navigationKey: string, options: any, callbackFn: (error: any, result: any) => any): Promise; subscribe(callbackFn: (error: any, result: any) => any): Promise; subscribe(navigationKey: string, callbackFn: (error: any, result: any) => any): Promise; subscribe(options: any, callbackFn: (error: any, result: any) => any): Promise; subscribe(navigationKey: string, options: any, callbackFn: (error: any, result: any) => any): Promise; unsubscribe(navigationKey: string, event?: string): Promise; set(navigationKey: string, payload: object | null): Promise; update(navigationKey: string, payload: object | null): Promise; remove(navigationKey: string): Promise; transaction(navigationKey: string, updateFn: () => any, callbackFn?: () => any): any; } interface schemas { ref(ref: string): firebase.database.Reference; getRaw(options?: object): Promise; getRaw(schemaKey?: string, options?: object): Promise; get(options?: object): Promise; get(schemaKey?: string, options?: object): Promise; getFieldsRaw(options?: object): Promise; getFieldsRaw(schemaKey?: string, options?: object): Promise; getFields(options?: object): Promise; getFields(schemaKey?: string, options?: object): Promise; subscribeRaw(callbackFn: (error: any, result: any) => any): Promise; subscribeRaw(schemaKey: string, callbackFn: (error: any, result: any) => any): Promise; subscribeRaw(options: any, callbackFn: (error: any, result: any) => any): Promise; subscribeRaw(schemaKey: string, options: any, callbackFn: (error: any, result: any) => any): Promise; subscribe(callbackFn: (error: any, result: any) => any): Promise; subscribe(schemaKey: string, callbackFn: (error: any, result: any) => any): Promise; subscribe(options: any, callbackFn: (error: any, result: any) => any): Promise; subscribe(schemaKey: string, options: any, callbackFn: (error: any, result: any) => any): Promise; unsubscribe(schemaKey: string, event?: string): Promise; set(schemaKey: string, payload: object | null): Promise; update(schemaKey: string, payload: object | null): Promise; remove(schemaKey: string): Promise; transaction(schemaKey: string, updateFn: () => any, callbackFn?: () => any): any; } interface storage { // _getFolderId(folderName?: string, fallback?: string): string; // _getFolderIdFromOptions(options?: object): Promise; // _setFile(payload?: any): Promise; // _createSizedImage(file: File, filename: string, options?: object): Promise; ref(filename: string, options?: object): firebase.storage.Reference; folderRef(folderID: string | number): firebase.database.Reference; fileRef(fileId: string | number): firebase.database.Reference; mediaRef(mediaRef?: string): firebase.database.Reference; getRaw(options?: object): Promise; getRaw(mediaRef?: string, options?: object): Promise; get(options?: object): Promise; get(mediaRef: string, options?: object): Promise; subscribeRaw(callbackFn: (error: any, result: any) => any): Promise; subscribeRaw(mediaKey: string, callbackFn: (error: any, result: any) => any): Promise; subscribeRaw(options: any, callbackFn: (error: any, result: any) => any): Promise; subscribeRaw(mediaKey: string, options: any, callbackFn: (error: any, result: any) => any): Promise; subscribe(callbackFn: (error: any, result: any) => any): Promise; subscribe(mediaKey: string, callbackFn: (error: any, result: any) => any): Promise; subscribe(options: any, callbackFn: (error: any, result: any) => any): Promise; subscribe(mediaKey: string, options: any, callbackFn: (error: any, result: any) => any): Promise; unsubscribe(mediaKey: string, event?: string): Promise; getFoldersRaw(options?: object): Promise; getFolders(options?: object): Promise; getFileRaw(fileId: string, options?: object): Promise; getFile(fileId: string, options?: object): Promise; getFilesRaw(options?: object): Promise; getFiles(options?: object): Promise; getURL(fileId: string, options?: object): Promise; getMetadata(fileId: string | number, options?: object): Promise; updateMetadata(fileId: string | number, payload?: object): Promise; deleteFile(fileId: string | number, options?: object): Promise; upload(fileData: string | File | Blob | Uint8Array, options?: object): any; } interface settings { ref(ref: string): firebase.database.Reference; getRaw(options?: object): Promise; getRaw(settingsKey: string, options?: object): Promise; get(options?: object): Promise; get(settingsKey: string, options?: object): Promise; setLocale(locale?: string): Promise; getLocale(): Promise; setEnvironment(environment?: string): Promise; getEnvironment(): Promise; getImageSizes(options?: object): Promise; getDefaultPermissionsGroup(options?: object): Promise; getGlobals(options?: object): Promise; } export interface App { name: string; firebaseApp: firebase.app.App; databaseService: firebase.database.Database; storageService: firebase.storage.Storage; authService: firebase.auth.Auth; firestoreService: firebase.firestore.Firestore; // setLocale(locale?: string): Promise; // setEnv(env?: string): Promise; // getLocale(): Promise; // getEnv(): Promise; content: content; nav: nav; schemas: schemas; storage: storage; settings: settings; } export const VERSION: string; }