2017-11-23 17:29:40 +00:00
|
|
|
/* @flow */
|
|
|
|
import type AdMob from '../modules/admob';
|
|
|
|
import { typeof statics as AdMobStatics } from '../modules/admob';
|
|
|
|
import type Analytics from '../modules/analytics';
|
|
|
|
import { typeof statics as AnalyticsStatics } from '../modules/analytics';
|
|
|
|
import type Auth from '../modules/auth';
|
|
|
|
import { typeof statics as AuthStatics } from '../modules/auth';
|
|
|
|
import type Config from '../modules/config';
|
|
|
|
import { typeof statics as ConfigStatics } from '../modules/config';
|
|
|
|
import type Crash from '../modules/crash';
|
|
|
|
import { typeof statics as CrashStatics } from '../modules/crash';
|
2017-12-06 17:25:17 +00:00
|
|
|
import type Crashlytics from '../modules/fabric/crashlytics';
|
|
|
|
import { typeof statics as CrashlyticsStatics } from '../modules/fabric/crashlytics';
|
2017-11-23 17:29:40 +00:00
|
|
|
import type Database from '../modules/database';
|
|
|
|
import { typeof statics as DatabaseStatics } from '../modules/database';
|
|
|
|
import type Firestore from '../modules/firestore';
|
|
|
|
import { typeof statics as FirestoreStatics } from '../modules/firestore';
|
|
|
|
import type Links from '../modules/links';
|
|
|
|
import { typeof statics as LinksStatics } from '../modules/links';
|
|
|
|
import type Messaging from '../modules/messaging';
|
|
|
|
import { typeof statics as MessagingStatics } from '../modules/messaging';
|
|
|
|
import type ModuleBase from '../utils/ModuleBase';
|
|
|
|
import type Performance from '../modules/perf';
|
|
|
|
import { typeof statics as PerformanceStatics } from '../modules/perf';
|
|
|
|
import type Storage from '../modules/storage';
|
|
|
|
import { typeof statics as StorageStatics } from '../modules/storage';
|
|
|
|
import type Utils from '../modules/utils';
|
|
|
|
import { typeof statics as UtilsStatics } from '../modules/utils';
|
|
|
|
|
|
|
|
/* Core types */
|
|
|
|
export type FirebaseError = {
|
|
|
|
message: string,
|
|
|
|
name: string,
|
|
|
|
code: string,
|
|
|
|
stack: string,
|
|
|
|
path: string,
|
|
|
|
details: string,
|
|
|
|
modifiers: string
|
|
|
|
}
|
|
|
|
|
|
|
|
export type FirebaseModule = $Subtype<ModuleBase>;
|
|
|
|
|
2017-12-06 17:25:17 +00:00
|
|
|
export type FirebaseModuleName = 'admob' | 'analytics' | 'auth' | 'config' | 'crash'
|
|
|
|
| 'crashlytics' | 'database' | 'firestore' | 'links' | 'messaging' | 'perf' | 'storage'
|
|
|
|
| 'utils';
|
2017-11-23 17:29:40 +00:00
|
|
|
|
|
|
|
export type FirebaseOptions = {
|
|
|
|
apiKey: string,
|
|
|
|
appId: string,
|
|
|
|
databaseURL: string,
|
|
|
|
messagingSenderId: string,
|
|
|
|
projectId: string,
|
|
|
|
storageBucket: string,
|
|
|
|
}
|
|
|
|
|
|
|
|
export type FirebaseModuleAndStatics<M: FirebaseModule, S: FirebaseStatics> = {
|
|
|
|
(): M,
|
|
|
|
nativeModuleExists: boolean,
|
|
|
|
} & S;
|
|
|
|
|
|
|
|
export type FirebaseStatics = $Subtype<Object>;
|
|
|
|
|
|
|
|
/* Admob types */
|
|
|
|
|
|
|
|
export type AdMobModule = {
|
|
|
|
(): AdMob,
|
|
|
|
nativeModuleExists: boolean,
|
|
|
|
} & AdMobStatics;
|
|
|
|
|
|
|
|
/* Analytics types */
|
|
|
|
|
|
|
|
export type AnalyticsModule = {
|
|
|
|
(): Analytics,
|
|
|
|
nativeModuleExists: boolean,
|
|
|
|
} & AnalyticsStatics;
|
|
|
|
|
|
|
|
/* Remote Config types */
|
|
|
|
|
|
|
|
export type ConfigModule = {
|
|
|
|
(): Config,
|
|
|
|
nativeModuleExists: boolean,
|
|
|
|
} & ConfigStatics;
|
|
|
|
|
|
|
|
export type AuthCredential = {
|
|
|
|
providerId: string,
|
|
|
|
token: string,
|
|
|
|
secret: string
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Auth types */
|
|
|
|
|
|
|
|
export type AuthModule = {
|
|
|
|
(): Auth,
|
|
|
|
nativeModuleExists: boolean,
|
|
|
|
} & AuthStatics;
|
|
|
|
|
2017-12-07 12:36:51 +00:00
|
|
|
export type ActionCodeSettings = {
|
|
|
|
android: {
|
|
|
|
installApp?: boolean,
|
|
|
|
minimumVersion?: string,
|
|
|
|
packageName: string,
|
|
|
|
},
|
|
|
|
handleCodeInApp?: boolean,
|
|
|
|
iOS: {
|
|
|
|
bundleId?: string,
|
|
|
|
},
|
|
|
|
url: string,
|
|
|
|
}
|
|
|
|
|
2017-11-23 17:29:40 +00:00
|
|
|
/* Crash types */
|
|
|
|
|
|
|
|
export type CrashModule = {
|
|
|
|
(): Crash,
|
|
|
|
nativeModuleExists: boolean,
|
|
|
|
} & CrashStatics;
|
|
|
|
|
|
|
|
/* Database types */
|
|
|
|
|
|
|
|
export type DatabaseModule = {
|
|
|
|
(): Database,
|
|
|
|
nativeModuleExists: boolean,
|
|
|
|
} & DatabaseStatics;
|
|
|
|
|
|
|
|
export type DatabaseModifier = {
|
2017-12-04 12:07:41 +00:00
|
|
|
id: string;
|
2017-11-23 17:29:40 +00:00
|
|
|
type: 'orderBy' | 'limit' | 'filter';
|
|
|
|
name?: string;
|
|
|
|
key?: string;
|
|
|
|
limit?: number;
|
|
|
|
value?: any;
|
|
|
|
valueType?: string;
|
|
|
|
}
|
|
|
|
|
2017-12-06 17:25:17 +00:00
|
|
|
/* Fabric types */
|
|
|
|
export type CrashlyticsModule = {
|
|
|
|
(): Crashlytics,
|
|
|
|
nativeModuleExists: boolean,
|
|
|
|
} & CrashlyticsStatics;
|
|
|
|
|
|
|
|
export type FabricModule = {
|
|
|
|
crashlytics: CrashlyticsModule,
|
|
|
|
}
|
|
|
|
|
2017-11-23 17:29:40 +00:00
|
|
|
/* Firestore types */
|
|
|
|
|
|
|
|
export type FirestoreModule = {
|
|
|
|
(): Firestore,
|
|
|
|
nativeModuleExists: boolean,
|
|
|
|
} & FirestoreStatics;
|
|
|
|
|
|
|
|
export type FirestoreNativeDocumentChange = {
|
|
|
|
document: FirestoreNativeDocumentSnapshot,
|
|
|
|
newIndex: number,
|
|
|
|
oldIndex: number,
|
|
|
|
type: string,
|
|
|
|
}
|
|
|
|
|
|
|
|
export type FirestoreNativeDocumentSnapshot = {
|
|
|
|
data: { [string]: FirestoreTypeMap },
|
|
|
|
metadata: FirestoreSnapshotMetadata,
|
|
|
|
path: string,
|
|
|
|
}
|
|
|
|
|
|
|
|
export type FirestoreSnapshotMetadata = {
|
|
|
|
fromCache: boolean,
|
|
|
|
hasPendingWrites: boolean,
|
|
|
|
}
|
|
|
|
|
|
|
|
export type FirestoreQueryDirection = 'DESC' | 'desc' | 'ASC' | 'asc';
|
|
|
|
export type FirestoreQueryOperator = '<' | '<=' | '=' | '==' | '>' | '>=';
|
|
|
|
|
|
|
|
export type FirestoreTypeMap = {
|
|
|
|
type: 'array' | 'boolean' | 'date' | 'fieldvalue' | 'geopoint' | 'null' | 'number' | 'object' | 'reference' | 'string',
|
|
|
|
value: any,
|
|
|
|
}
|
|
|
|
|
|
|
|
export type FirestoreWriteOptions = {
|
|
|
|
merge?: boolean,
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Links types */
|
|
|
|
|
|
|
|
export type LinksModule = {
|
|
|
|
(): Links,
|
|
|
|
nativeModuleExists: boolean,
|
|
|
|
} & LinksStatics;
|
|
|
|
|
|
|
|
/* Messaging types */
|
|
|
|
|
|
|
|
export type MessagingModule = {
|
|
|
|
(): Messaging,
|
|
|
|
nativeModuleExists: boolean,
|
|
|
|
} & MessagingStatics;
|
|
|
|
|
|
|
|
/* Performance types */
|
|
|
|
|
|
|
|
export type PerformanceModule = {
|
|
|
|
(): Performance,
|
|
|
|
nativeModuleExists: boolean,
|
|
|
|
} & PerformanceStatics;
|
|
|
|
|
|
|
|
/* Storage types */
|
|
|
|
|
|
|
|
export type StorageModule = {
|
|
|
|
(): Storage,
|
|
|
|
nativeModuleExists: boolean,
|
|
|
|
} & StorageStatics;
|
|
|
|
|
|
|
|
/* Utils types */
|
|
|
|
|
|
|
|
export type UtilsModule = {
|
|
|
|
(): Utils,
|
|
|
|
nativeModuleExists: boolean,
|
|
|
|
} & UtilsStatics;
|