mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-04-23 12:06:47 +08:00
[types] Export app, auth, database and firestore types
This commit is contained in:
60
lib/index.js
60
lib/index.js
@@ -3,6 +3,64 @@
|
||||
*/
|
||||
import firebase from './modules/core/firebase';
|
||||
|
||||
export default firebase;
|
||||
|
||||
/*
|
||||
* Export App types
|
||||
*/
|
||||
export type { default as App } from './modules/core/app';
|
||||
|
||||
/*
|
||||
* Export Auth types
|
||||
*/
|
||||
export type {
|
||||
ActionCodeInfo,
|
||||
ActionCodeSettings,
|
||||
AdditionalUserInfo,
|
||||
AuthCredential,
|
||||
UserCredential,
|
||||
UserInfo,
|
||||
UserMetadata,
|
||||
} from './modules/auth/types';
|
||||
export type {
|
||||
default as ConfirmationResult,
|
||||
} from './modules/auth/ConfirmationResult';
|
||||
export type { default as User } from './modules/auth/User';
|
||||
|
||||
export default firebase;
|
||||
/*
|
||||
* Export Database types
|
||||
*/
|
||||
export type { default as DataSnapshot } from './modules/database/DataSnapshot';
|
||||
export type { default as OnDisconnect } from './modules/database/OnDisconnect';
|
||||
export type { default as Reference } from './modules/database/Reference';
|
||||
export type { default as DataQuery } from './modules/database/Query';
|
||||
|
||||
/*
|
||||
* Export Firestore types
|
||||
*/
|
||||
export type {
|
||||
DocumentListenOptions,
|
||||
QueryListenOptions,
|
||||
SetOptions,
|
||||
SnapshotMetadata,
|
||||
} from './modules/firestore/types';
|
||||
export type {
|
||||
default as CollectionReference,
|
||||
} from './modules/firestore/CollectionReference';
|
||||
export type {
|
||||
default as DocumentChange,
|
||||
} from './modules/firestore/DocumentChange';
|
||||
export type {
|
||||
default as DocumentReference,
|
||||
} from './modules/firestore/DocumentReference';
|
||||
export type {
|
||||
default as DocumentSnapshot,
|
||||
} from './modules/firestore/DocumentSnapshot';
|
||||
export type { default as FieldPath } from './modules/firestore/FieldPath';
|
||||
export type { default as FieldValue } from './modules/firestore/FieldValue';
|
||||
export type { default as GeoPoint } from './modules/firestore/GeoPoint';
|
||||
export type { default as Query } from './modules/firestore/Query';
|
||||
export type {
|
||||
default as QuerySnapshot,
|
||||
} from './modules/firestore/QuerySnapshot';
|
||||
export type { default as WriteBatch } from './modules/firestore/WriteBatch';
|
||||
|
||||
@@ -19,7 +19,7 @@ import EventTypes, {
|
||||
RewardedVideoEventTypes,
|
||||
} from './EventTypes';
|
||||
|
||||
import type App from '../core/firebase-app';
|
||||
import type App from '../core/app';
|
||||
|
||||
type NativeEvent = {
|
||||
adUnit: string,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import ModuleBase from '../../utils/ModuleBase';
|
||||
import { getNativeModule } from '../../utils/native';
|
||||
|
||||
import type App from '../core/firebase-app';
|
||||
import type App from '../core/app';
|
||||
|
||||
const AlphaNumericUnderscore = /^[a-zA-Z0-9_]+$/;
|
||||
|
||||
|
||||
@@ -11,18 +11,10 @@ import type {
|
||||
AuthCredential,
|
||||
NativeUser,
|
||||
UserCredential,
|
||||
UserInfo,
|
||||
UserMetadata,
|
||||
} from './types';
|
||||
|
||||
type UserInfo = {
|
||||
displayName?: string,
|
||||
email?: string,
|
||||
phoneNumber?: string,
|
||||
photoURL?: string,
|
||||
providerId: string,
|
||||
uid: string,
|
||||
};
|
||||
|
||||
type UpdateProfile = {
|
||||
displayName?: string,
|
||||
photoURL?: string,
|
||||
|
||||
@@ -22,26 +22,19 @@ import FacebookAuthProvider from './providers/FacebookAuthProvider';
|
||||
import PhoneAuthListener from './PhoneAuthListener';
|
||||
|
||||
import type {
|
||||
ActionCodeInfo,
|
||||
ActionCodeSettings,
|
||||
AuthCredential,
|
||||
NativeUser,
|
||||
NativeUserCredential,
|
||||
UserCredential,
|
||||
} from './types';
|
||||
import type App from '../core/firebase-app';
|
||||
import type App from '../core/app';
|
||||
|
||||
type AuthState = {
|
||||
user?: NativeUser,
|
||||
};
|
||||
|
||||
type ActionCodeInfo = {
|
||||
data: {
|
||||
email?: string,
|
||||
fromEmail?: string,
|
||||
},
|
||||
operation: 'PASSWORD_RESET' | 'VERIFY_EMAIL' | 'RECOVER_EMAIL',
|
||||
};
|
||||
|
||||
const NATIVE_EVENTS = [
|
||||
'auth_state_changed',
|
||||
'auth_id_token_changed',
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
*/
|
||||
import type User from './User';
|
||||
|
||||
export type ActionCodeInfo = {
|
||||
data: {
|
||||
email?: string,
|
||||
fromEmail?: string,
|
||||
},
|
||||
operation: 'PASSWORD_RESET' | 'VERIFY_EMAIL' | 'RECOVER_EMAIL',
|
||||
};
|
||||
|
||||
export type ActionCodeSettings = {
|
||||
android: {
|
||||
installApp?: boolean,
|
||||
@@ -16,7 +24,7 @@ export type ActionCodeSettings = {
|
||||
url: string,
|
||||
};
|
||||
|
||||
type AdditionalUserInfo = {
|
||||
export type AdditionalUserInfo = {
|
||||
isNewUser: boolean,
|
||||
profile?: Object,
|
||||
providerId: string,
|
||||
|
||||
@@ -6,7 +6,7 @@ import { getLogger } from '../../utils/log';
|
||||
import ModuleBase from '../../utils/ModuleBase';
|
||||
import { getNativeModule } from '../../utils/native';
|
||||
|
||||
import type App from '../core/firebase-app';
|
||||
import type App from '../core/app';
|
||||
|
||||
type NativeValue = {
|
||||
stringValue?: string,
|
||||
|
||||
@@ -6,7 +6,7 @@ import { NativeModules } from 'react-native';
|
||||
|
||||
import APPS from '../../utils/apps';
|
||||
import INTERNALS from '../../utils/internals';
|
||||
import App from './firebase-app';
|
||||
import App from './app';
|
||||
import VERSION from '../../version';
|
||||
|
||||
// module imports
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import ModuleBase from '../../utils/ModuleBase';
|
||||
import { getNativeModule } from '../../utils/native';
|
||||
|
||||
import type App from '../core/firebase-app';
|
||||
import type App from '../core/app';
|
||||
import type { FirebaseError } from '../../types';
|
||||
|
||||
export const MODULE_NAME = 'RNFirebaseCrash';
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/**
|
||||
* @flow
|
||||
* Snapshot representation wrapper
|
||||
* DataSnapshot representation wrapper
|
||||
*/
|
||||
import { isObject, deepGet, deepExists } from './../../utils';
|
||||
import type Reference from './reference';
|
||||
import type Reference from './Reference';
|
||||
|
||||
/**
|
||||
* @class DataSnapshot
|
||||
* @link https://firebase.google.com/docs/reference/js/firebase.database.DataSnapshot
|
||||
*/
|
||||
export default class Snapshot {
|
||||
export default class DataSnapshot {
|
||||
ref: Reference;
|
||||
key: string;
|
||||
|
||||
@@ -50,10 +50,10 @@ export default class Snapshot {
|
||||
* @link https://firebase.google.com/docs/reference/js/firebase.database.DataSnapshot#forEach
|
||||
* @returns {Snapshot}
|
||||
*/
|
||||
child(path: string): Snapshot {
|
||||
child(path: string): DataSnapshot {
|
||||
const value = deepGet(this._value, path);
|
||||
const childRef = this.ref.child(path);
|
||||
return new Snapshot(childRef, {
|
||||
return new DataSnapshot(childRef, {
|
||||
value,
|
||||
key: childRef.key,
|
||||
exists: value !== null,
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
* @flow
|
||||
* Disconnect representation wrapper
|
||||
* OnDisconnect representation wrapper
|
||||
*/
|
||||
import { typeOf } from '../../utils';
|
||||
import { getNativeModule } from '../../utils/native';
|
||||
import type Database from './';
|
||||
import type Reference from './reference';
|
||||
import type Reference from './Reference';
|
||||
|
||||
/**
|
||||
* @url https://firebase.google.com/docs/reference/js/firebase.database.OnDisconnect
|
||||
* @class Disconnect
|
||||
* @class OmDisconnect
|
||||
*/
|
||||
export default class Disconnect {
|
||||
export default class OnDisconnect {
|
||||
_database: Database;
|
||||
ref: Reference;
|
||||
path: string;
|
||||
@@ -4,12 +4,12 @@
|
||||
*/
|
||||
import { NativeModules } from 'react-native';
|
||||
|
||||
import Reference from './reference';
|
||||
import Reference from './Reference';
|
||||
import TransactionHandler from './transaction';
|
||||
import ModuleBase from '../../utils/ModuleBase';
|
||||
import { getNativeModule } from '../../utils/native';
|
||||
|
||||
import type App from '../core/firebase-app';
|
||||
import type App from '../core/app';
|
||||
|
||||
const NATIVE_EVENTS = [
|
||||
'database_transaction_event',
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import ModuleBase from '../../../utils/ModuleBase';
|
||||
import { getNativeModule } from '../../../utils/native';
|
||||
|
||||
import type App from '../../core/firebase-app';
|
||||
import type App from '../../core/app';
|
||||
|
||||
export const MODULE_NAME = 'RNFirebaseCrashlytics';
|
||||
export const NAMESPACE = 'crashlytics';
|
||||
|
||||
@@ -8,17 +8,13 @@ import { firestoreAutoId } from '../../utils';
|
||||
|
||||
import type Firestore from './';
|
||||
import type {
|
||||
FirestoreQueryDirection,
|
||||
FirestoreQueryOperator,
|
||||
} from '../../types';
|
||||
QueryDirection,
|
||||
QueryListenOptions,
|
||||
QueryOperator,
|
||||
} from './types';
|
||||
import type FieldPath from './FieldPath';
|
||||
import type Path from './Path';
|
||||
import type {
|
||||
Observer,
|
||||
ObserverOnError,
|
||||
ObserverOnNext,
|
||||
QueryListenOptions,
|
||||
} from './Query';
|
||||
import type { Observer, ObserverOnError, ObserverOnNext } from './Query';
|
||||
import type QuerySnapshot from './QuerySnapshot';
|
||||
|
||||
/**
|
||||
@@ -95,10 +91,7 @@ export default class CollectionReference {
|
||||
);
|
||||
}
|
||||
|
||||
orderBy(
|
||||
fieldPath: string | FieldPath,
|
||||
directionStr?: FirestoreQueryDirection
|
||||
): Query {
|
||||
orderBy(fieldPath: string | FieldPath, directionStr?: QueryDirection): Query {
|
||||
return this._query.orderBy(fieldPath, directionStr);
|
||||
}
|
||||
|
||||
@@ -110,7 +103,7 @@ export default class CollectionReference {
|
||||
return this._query.startAt(snapshotOrVarArgs);
|
||||
}
|
||||
|
||||
where(fieldPath: string, opStr: FirestoreQueryOperator, value: any): Query {
|
||||
where(fieldPath: string, opStr: QueryOperator, value: any): Query {
|
||||
return this._query.where(fieldPath, opStr, value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import DocumentSnapshot from './DocumentSnapshot';
|
||||
|
||||
import type Firestore from './';
|
||||
import type { FirestoreNativeDocumentChange } from '../../types';
|
||||
import type { NativeDocumentChange } from './types';
|
||||
|
||||
/**
|
||||
* @class DocumentChange
|
||||
@@ -16,7 +16,7 @@ export default class DocumentChange {
|
||||
_oldIndex: number;
|
||||
_type: string;
|
||||
|
||||
constructor(firestore: Firestore, nativeData: FirestoreNativeDocumentChange) {
|
||||
constructor(firestore: Firestore, nativeData: NativeDocumentChange) {
|
||||
this._document = new DocumentSnapshot(firestore, nativeData.document);
|
||||
this._newIndex = nativeData.newIndex;
|
||||
this._oldIndex = nativeData.oldIndex;
|
||||
|
||||
@@ -14,15 +14,12 @@ import { getNativeModule } from '../../utils/native';
|
||||
|
||||
import type Firestore from './';
|
||||
import type {
|
||||
FirestoreNativeDocumentSnapshot,
|
||||
FirestoreWriteOptions,
|
||||
} from '../../types';
|
||||
DocumentListenOptions,
|
||||
NativeDocumentSnapshot,
|
||||
SetOptions,
|
||||
} from './types';
|
||||
import type Path from './Path';
|
||||
|
||||
type DocumentListenOptions = {
|
||||
includeMetadataChanges: boolean,
|
||||
};
|
||||
|
||||
type ObserverOnError = Object => void;
|
||||
type ObserverOnNext = DocumentSnapshot => void;
|
||||
|
||||
@@ -189,9 +186,7 @@ export default class DocumentReference {
|
||||
}
|
||||
const listenerId = firestoreAutoId();
|
||||
|
||||
const listener = (
|
||||
nativeDocumentSnapshot: FirestoreNativeDocumentSnapshot
|
||||
) => {
|
||||
const listener = (nativeDocumentSnapshot: NativeDocumentSnapshot) => {
|
||||
const documentSnapshot = new DocumentSnapshot(
|
||||
this.firestore,
|
||||
nativeDocumentSnapshot
|
||||
@@ -227,12 +222,12 @@ export default class DocumentReference {
|
||||
return this._offDocumentSnapshot.bind(this, listenerId, listener);
|
||||
}
|
||||
|
||||
set(data: Object, writeOptions?: FirestoreWriteOptions): Promise<void> {
|
||||
set(data: Object, options?: SetOptions): Promise<void> {
|
||||
const nativeData = buildNativeMap(data);
|
||||
return getNativeModule(this._firestore).documentSet(
|
||||
this.path,
|
||||
nativeData,
|
||||
writeOptions
|
||||
options
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,10 +9,7 @@ import { isObject } from '../../utils';
|
||||
import { parseNativeMap } from './utils/serialize';
|
||||
|
||||
import type Firestore from './';
|
||||
import type {
|
||||
FirestoreNativeDocumentSnapshot,
|
||||
FirestoreSnapshotMetadata,
|
||||
} from '../../types';
|
||||
import type { NativeDocumentSnapshot, SnapshotMetadata } from './types';
|
||||
|
||||
const extractFieldPathData = (data: Object | void, segments: string[]): any => {
|
||||
if (!data || !isObject(data)) {
|
||||
@@ -30,13 +27,10 @@ const extractFieldPathData = (data: Object | void, segments: string[]): any => {
|
||||
*/
|
||||
export default class DocumentSnapshot {
|
||||
_data: Object | void;
|
||||
_metadata: FirestoreSnapshotMetadata;
|
||||
_metadata: SnapshotMetadata;
|
||||
_ref: DocumentReference;
|
||||
|
||||
constructor(
|
||||
firestore: Firestore,
|
||||
nativeData: FirestoreNativeDocumentSnapshot
|
||||
) {
|
||||
constructor(firestore: Firestore, nativeData: NativeDocumentSnapshot) {
|
||||
this._data = parseNativeMap(firestore, nativeData.data);
|
||||
this._metadata = nativeData.metadata;
|
||||
this._ref = new DocumentReference(
|
||||
@@ -53,7 +47,7 @@ export default class DocumentSnapshot {
|
||||
return this._ref.id;
|
||||
}
|
||||
|
||||
get metadata(): FirestoreSnapshotMetadata {
|
||||
get metadata(): SnapshotMetadata {
|
||||
return this._metadata;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,20 +12,21 @@ import { firestoreAutoId, isFunction, isObject } from '../../utils';
|
||||
import { getNativeModule } from '../../utils/native';
|
||||
|
||||
import type Firestore from './';
|
||||
import type {
|
||||
FirestoreQueryDirection,
|
||||
FirestoreQueryOperator,
|
||||
} from '../../types';
|
||||
import type Path from './Path';
|
||||
import type {
|
||||
QueryDirection,
|
||||
QueryOperator,
|
||||
QueryListenOptions,
|
||||
} from './types';
|
||||
|
||||
const DIRECTIONS: { [FirestoreQueryDirection]: string } = {
|
||||
const DIRECTIONS: { [QueryDirection]: string } = {
|
||||
ASC: 'ASCENDING',
|
||||
asc: 'ASCENDING',
|
||||
DESC: 'DESCENDING',
|
||||
desc: 'DESCENDING',
|
||||
};
|
||||
|
||||
const OPERATORS: { [FirestoreQueryOperator]: string } = {
|
||||
const OPERATORS: { [QueryOperator]: string } = {
|
||||
'=': 'EQUAL',
|
||||
'==': 'EQUAL',
|
||||
'>': 'GREATER_THAN',
|
||||
@@ -58,11 +59,6 @@ type QueryOptions = {
|
||||
startAt?: any[],
|
||||
};
|
||||
|
||||
export type QueryListenOptions = {|
|
||||
includeDocumentMetadataChanges: boolean,
|
||||
includeQueryMetadataChanges: boolean,
|
||||
|};
|
||||
|
||||
export type ObserverOnError = Object => void;
|
||||
export type ObserverOnNext = QuerySnapshot => void;
|
||||
|
||||
@@ -320,7 +316,7 @@ export default class Query {
|
||||
|
||||
orderBy(
|
||||
fieldPath: string | FieldPath,
|
||||
directionStr?: FirestoreQueryDirection = 'asc'
|
||||
directionStr?: QueryDirection = 'asc'
|
||||
): Query {
|
||||
// TODO: Validation
|
||||
// validate.isFieldPath('fieldPath', fieldPath);
|
||||
@@ -379,7 +375,7 @@ export default class Query {
|
||||
|
||||
where(
|
||||
fieldPath: string | FieldPath,
|
||||
opStr: FirestoreQueryOperator,
|
||||
opStr: QueryOperator,
|
||||
value: any
|
||||
): Query {
|
||||
// TODO: Validation
|
||||
|
||||
@@ -7,16 +7,16 @@ import DocumentSnapshot from './DocumentSnapshot';
|
||||
|
||||
import type Firestore from './';
|
||||
import type {
|
||||
FirestoreNativeDocumentChange,
|
||||
FirestoreNativeDocumentSnapshot,
|
||||
FirestoreSnapshotMetadata,
|
||||
} from '../../types';
|
||||
NativeDocumentChange,
|
||||
NativeDocumentSnapshot,
|
||||
SnapshotMetadata,
|
||||
} from './types';
|
||||
import type Query from './Query';
|
||||
|
||||
type QuerySnapshotNativeData = {
|
||||
changes: FirestoreNativeDocumentChange[],
|
||||
documents: FirestoreNativeDocumentSnapshot[],
|
||||
metadata: FirestoreSnapshotMetadata,
|
||||
type NativeQuerySnapshot = {
|
||||
changes: NativeDocumentChange[],
|
||||
documents: NativeDocumentSnapshot[],
|
||||
metadata: SnapshotMetadata,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -25,13 +25,13 @@ type QuerySnapshotNativeData = {
|
||||
export default class QuerySnapshot {
|
||||
_changes: DocumentChange[];
|
||||
_docs: DocumentSnapshot[];
|
||||
_metadata: FirestoreSnapshotMetadata;
|
||||
_metadata: SnapshotMetadata;
|
||||
_query: Query;
|
||||
|
||||
constructor(
|
||||
firestore: Firestore,
|
||||
query: Query,
|
||||
nativeData: QuerySnapshotNativeData
|
||||
nativeData: NativeQuerySnapshot
|
||||
) {
|
||||
this._changes = nativeData.changes.map(
|
||||
change => new DocumentChange(firestore, change)
|
||||
@@ -55,7 +55,7 @@ export default class QuerySnapshot {
|
||||
return this._docs.length === 0;
|
||||
}
|
||||
|
||||
get metadata(): FirestoreSnapshotMetadata {
|
||||
get metadata(): SnapshotMetadata {
|
||||
return this._metadata;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import { getNativeModule } from '../../utils/native';
|
||||
|
||||
import type DocumentReference from './DocumentReference';
|
||||
import type Firestore from './';
|
||||
import type { FirestoreWriteOptions } from '../../types';
|
||||
import type { SetOptions } from './types';
|
||||
|
||||
type DocumentWrite = {
|
||||
data?: Object,
|
||||
@@ -47,19 +47,15 @@ export default class WriteBatch {
|
||||
return this;
|
||||
}
|
||||
|
||||
set(
|
||||
docRef: DocumentReference,
|
||||
data: Object,
|
||||
writeOptions?: FirestoreWriteOptions
|
||||
) {
|
||||
set(docRef: DocumentReference, data: Object, options?: SetOptions) {
|
||||
// TODO: Validation
|
||||
// validate.isDocumentReference('docRef', docRef);
|
||||
// validate.isDocument('data', data);
|
||||
// validate.isOptionalPrecondition('writeOptions', writeOptions);
|
||||
// validate.isOptionalPrecondition('options', writeOptions);
|
||||
const nativeData = buildNativeMap(data);
|
||||
this._writes.push({
|
||||
data: nativeData,
|
||||
options: writeOptions,
|
||||
options,
|
||||
path: docRef.path,
|
||||
type: 'SET',
|
||||
});
|
||||
|
||||
@@ -16,7 +16,7 @@ import WriteBatch from './WriteBatch';
|
||||
import INTERNALS from '../../utils/internals';
|
||||
|
||||
import type DocumentSnapshot from './DocumentSnapshot';
|
||||
import type App from '../core/firebase-app';
|
||||
import type App from '../core/app';
|
||||
import type QuerySnapshot from './QuerySnapshot';
|
||||
|
||||
type CollectionSyncEvent = {
|
||||
|
||||
54
lib/modules/firestore/types.js
Normal file
54
lib/modules/firestore/types.js
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* @flow
|
||||
*/
|
||||
|
||||
export type DocumentListenOptions = {
|
||||
includeMetadataChanges: boolean,
|
||||
};
|
||||
|
||||
export type QueryDirection = 'DESC' | 'desc' | 'ASC' | 'asc';
|
||||
|
||||
export type QueryListenOptions = {|
|
||||
includeDocumentMetadataChanges: boolean,
|
||||
includeQueryMetadataChanges: boolean,
|
||||
|};
|
||||
|
||||
export type QueryOperator = '<' | '<=' | '=' | '==' | '>' | '>=';
|
||||
|
||||
export type SetOptions = {
|
||||
merge?: boolean,
|
||||
};
|
||||
|
||||
export type SnapshotMetadata = {
|
||||
fromCache: boolean,
|
||||
hasPendingWrites: boolean,
|
||||
};
|
||||
|
||||
export type NativeDocumentChange = {
|
||||
document: NativeDocumentSnapshot,
|
||||
newIndex: number,
|
||||
oldIndex: number,
|
||||
type: string,
|
||||
};
|
||||
|
||||
export type NativeDocumentSnapshot = {
|
||||
data: { [string]: NativeTypeMap },
|
||||
metadata: SnapshotMetadata,
|
||||
path: string,
|
||||
};
|
||||
|
||||
export type NativeTypeMap = {
|
||||
type:
|
||||
| 'array'
|
||||
| 'boolean'
|
||||
| 'date'
|
||||
| 'documentid'
|
||||
| 'fieldvalue'
|
||||
| 'geopoint'
|
||||
| 'null'
|
||||
| 'number'
|
||||
| 'object'
|
||||
| 'reference'
|
||||
| 'string',
|
||||
value: any,
|
||||
};
|
||||
@@ -13,7 +13,7 @@ import Path from '../Path';
|
||||
import { typeOf } from '../../../utils';
|
||||
|
||||
import type Firestore from '../';
|
||||
import type { FirestoreTypeMap } from '../../../types';
|
||||
import type { NativeTypeMap } from '../types';
|
||||
|
||||
/*
|
||||
* Functions that build up the data needed to represent
|
||||
@@ -21,9 +21,7 @@ import type { FirestoreTypeMap } from '../../../types';
|
||||
* for transmission to the native side
|
||||
*/
|
||||
|
||||
export const buildNativeMap = (
|
||||
data: Object
|
||||
): { [string]: FirestoreTypeMap } => {
|
||||
export const buildNativeMap = (data: Object): { [string]: NativeTypeMap } => {
|
||||
const nativeData = {};
|
||||
if (data) {
|
||||
Object.keys(data).forEach(key => {
|
||||
@@ -36,7 +34,7 @@ export const buildNativeMap = (
|
||||
return nativeData;
|
||||
};
|
||||
|
||||
export const buildNativeArray = (array: Object[]): FirestoreTypeMap[] => {
|
||||
export const buildNativeArray = (array: Object[]): NativeTypeMap[] => {
|
||||
const nativeArray = [];
|
||||
if (array) {
|
||||
array.forEach(value => {
|
||||
@@ -49,7 +47,7 @@ export const buildNativeArray = (array: Object[]): FirestoreTypeMap[] => {
|
||||
return nativeArray;
|
||||
};
|
||||
|
||||
export const buildTypeMap = (value: any): FirestoreTypeMap | null => {
|
||||
export const buildTypeMap = (value: any): NativeTypeMap | null => {
|
||||
const type = typeOf(value);
|
||||
if (value === null || value === undefined) {
|
||||
return {
|
||||
@@ -117,7 +115,7 @@ export const buildTypeMap = (value: any): FirestoreTypeMap | null => {
|
||||
|
||||
export const parseNativeMap = (
|
||||
firestore: Firestore,
|
||||
nativeData: { [string]: FirestoreTypeMap }
|
||||
nativeData: { [string]: NativeTypeMap }
|
||||
): Object | void => {
|
||||
let data;
|
||||
if (nativeData) {
|
||||
@@ -131,7 +129,7 @@ export const parseNativeMap = (
|
||||
|
||||
const parseNativeArray = (
|
||||
firestore: Firestore,
|
||||
nativeArray: FirestoreTypeMap[]
|
||||
nativeArray: NativeTypeMap[]
|
||||
): any[] => {
|
||||
const array = [];
|
||||
if (nativeArray) {
|
||||
@@ -142,7 +140,7 @@ const parseNativeArray = (
|
||||
return array;
|
||||
};
|
||||
|
||||
const parseTypeMap = (firestore: Firestore, typeMap: FirestoreTypeMap): any => {
|
||||
const parseTypeMap = (firestore: Firestore, typeMap: NativeTypeMap): any => {
|
||||
const { type, value } = typeMap;
|
||||
if (type === 'null') {
|
||||
return null;
|
||||
|
||||
@@ -7,7 +7,7 @@ import ModuleBase from '../../utils/ModuleBase';
|
||||
import { areObjectKeysContainedInOther, isObject, isString } from '../../utils';
|
||||
import { getNativeModule } from '../../utils/native';
|
||||
|
||||
import type App from '../core/firebase-app';
|
||||
import type App from '../core/app';
|
||||
|
||||
const EVENT_TYPE = {
|
||||
Link: 'dynamic_link_received',
|
||||
|
||||
@@ -8,7 +8,7 @@ import ModuleBase from '../../utils/ModuleBase';
|
||||
import RemoteMessage from './RemoteMessage';
|
||||
import { getNativeModule } from '../../utils/native';
|
||||
|
||||
import type App from '../core/firebase-app';
|
||||
import type App from '../core/app';
|
||||
|
||||
const EVENT_TYPE = {
|
||||
RefreshToken: 'messaging_token_refreshed',
|
||||
|
||||
@@ -6,7 +6,7 @@ import Trace from './Trace';
|
||||
import ModuleBase from '../../utils/ModuleBase';
|
||||
import { getNativeModule } from '../../utils/native';
|
||||
|
||||
import type App from '../core/firebase-app';
|
||||
import type App from '../core/app';
|
||||
|
||||
export const MODULE_NAME = 'RNFirebasePerformance';
|
||||
export const NAMESPACE = 'perf';
|
||||
|
||||
@@ -10,7 +10,7 @@ import { getLogger } from '../../utils/log';
|
||||
import ModuleBase from '../../utils/ModuleBase';
|
||||
import { getNativeModule } from '../../utils/native';
|
||||
|
||||
import type App from '../core/firebase-app';
|
||||
import type App from '../core/app';
|
||||
|
||||
const FirebaseStorage = NativeModules.RNFirebaseStorage;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { NativeModules } from 'react-native';
|
||||
import INTERNALS from '../../utils/internals';
|
||||
import { isIOS } from '../../utils';
|
||||
import ModuleBase from '../../utils/ModuleBase';
|
||||
import type App from '../core/firebase-app';
|
||||
import type App from '../core/app';
|
||||
|
||||
const FirebaseCoreModule = NativeModules.RNFirebase;
|
||||
|
||||
|
||||
@@ -162,47 +162,6 @@ export type FirestoreModule = {
|
||||
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'
|
||||
| 'documentid'
|
||||
| 'fieldvalue'
|
||||
| 'geopoint'
|
||||
| 'null'
|
||||
| 'number'
|
||||
| 'object'
|
||||
| 'reference'
|
||||
| 'string',
|
||||
value: any,
|
||||
};
|
||||
|
||||
export type FirestoreWriteOptions = {
|
||||
merge?: boolean,
|
||||
};
|
||||
|
||||
/* Links types */
|
||||
|
||||
export type LinksModule = {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import { initialiseLogger } from './log';
|
||||
import { initialiseNativeModule } from './native';
|
||||
|
||||
import type App from '../modules/core/firebase-app';
|
||||
import type App from '../modules/core/app';
|
||||
import type { FirebaseModuleConfig, FirebaseNamespace } from '../types';
|
||||
|
||||
export default class ModuleBase {
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
import { NativeEventEmitter, NativeModules } from 'react-native';
|
||||
|
||||
import { SharedEventEmitter } from './events';
|
||||
import DatabaseSnapshot from '../modules/database/snapshot';
|
||||
import DatabaseReference from '../modules/database/reference';
|
||||
import DataSnapshot from '../modules/database/DataSnapshot';
|
||||
import DatabaseReference from '../modules/database/Reference';
|
||||
import { isString, nativeToJSError } from '../utils';
|
||||
|
||||
type Listener = DatabaseSnapshot => any;
|
||||
type Listener = DataSnapshot => any;
|
||||
|
||||
type Registration = {
|
||||
key: string,
|
||||
@@ -83,7 +83,7 @@ class SyncTree {
|
||||
// forward on to users .on(successCallback <-- listener
|
||||
return SharedEventEmitter.emit(
|
||||
eventRegistrationKey,
|
||||
new DatabaseSnapshot(registration.ref, snapshot),
|
||||
new DataSnapshot(registration.ref, snapshot),
|
||||
previousChildName
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @flow
|
||||
*/
|
||||
import { NativeModules } from 'react-native';
|
||||
import App from '../modules/core/firebase-app';
|
||||
import App from '../modules/core/app';
|
||||
import INTERNALS from './internals';
|
||||
import { isAndroid, isObject, isString } from './';
|
||||
|
||||
|
||||
@@ -7,44 +7,44 @@ PODS:
|
||||
- BoringSSL/Interface (9.2)
|
||||
- Crashlytics (3.9.3):
|
||||
- Fabric (~> 1.7.2)
|
||||
- Fabric (1.7.2)
|
||||
- Firebase/AdMob (4.8.1):
|
||||
- Fabric (1.7.3)
|
||||
- Firebase/AdMob (4.8.2):
|
||||
- Firebase/Core
|
||||
- Google-Mobile-Ads-SDK (= 7.27.0)
|
||||
- Firebase/Auth (4.8.1):
|
||||
- Firebase/Auth (4.8.2):
|
||||
- Firebase/Core
|
||||
- FirebaseAuth (= 4.4.2)
|
||||
- Firebase/Core (4.8.1):
|
||||
- FirebaseAnalytics (= 4.0.7)
|
||||
- Firebase/Core (4.8.2):
|
||||
- FirebaseAnalytics (= 4.0.9)
|
||||
- FirebaseCore (= 4.0.14)
|
||||
- Firebase/Crash (4.8.1):
|
||||
- Firebase/Crash (4.8.2):
|
||||
- Firebase/Core
|
||||
- FirebaseCrash (= 2.0.2)
|
||||
- Firebase/Database (4.8.1):
|
||||
- Firebase/Database (4.8.2):
|
||||
- Firebase/Core
|
||||
- FirebaseDatabase (= 4.1.4)
|
||||
- Firebase/DynamicLinks (4.8.1):
|
||||
- Firebase/DynamicLinks (4.8.2):
|
||||
- Firebase/Core
|
||||
- FirebaseDynamicLinks (= 2.3.2)
|
||||
- Firebase/Firestore (4.8.1):
|
||||
- Firebase/Firestore (4.8.2):
|
||||
- Firebase/Core
|
||||
- FirebaseFirestore (= 0.10.0)
|
||||
- Firebase/Messaging (4.8.1):
|
||||
- Firebase/Messaging (4.8.2):
|
||||
- Firebase/Core
|
||||
- FirebaseMessaging (= 2.0.8)
|
||||
- Firebase/Performance (4.8.1):
|
||||
- Firebase/Performance (4.8.2):
|
||||
- Firebase/Core
|
||||
- FirebasePerformance (= 1.1.1)
|
||||
- Firebase/RemoteConfig (4.8.1):
|
||||
- Firebase/RemoteConfig (4.8.2):
|
||||
- Firebase/Core
|
||||
- FirebaseRemoteConfig (= 2.1.1)
|
||||
- Firebase/Storage (4.8.1):
|
||||
- Firebase/Storage (4.8.2):
|
||||
- Firebase/Core
|
||||
- FirebaseStorage (= 2.1.2)
|
||||
- FirebaseABTesting (1.0.0):
|
||||
- FirebaseCore (~> 4.0)
|
||||
- Protobuf (~> 3.1)
|
||||
- FirebaseAnalytics (4.0.7):
|
||||
- FirebaseAnalytics (4.0.9):
|
||||
- FirebaseCore (~> 4.0)
|
||||
- FirebaseInstanceID (~> 2.0)
|
||||
- GoogleToolboxForMac/NSData+zlib (~> 2.1)
|
||||
@@ -114,26 +114,26 @@ PODS:
|
||||
- GoogleToolboxForMac/Defines (= 2.1.3)
|
||||
- GoogleToolboxForMac/NSString+URLArguments (= 2.1.3)
|
||||
- GoogleToolboxForMac/NSString+URLArguments (2.1.3)
|
||||
- gRPC (1.8.4):
|
||||
- gRPC-RxLibrary (= 1.8.4)
|
||||
- gRPC/Main (= 1.8.4)
|
||||
- gRPC-Core (1.8.4):
|
||||
- gRPC-Core/Implementation (= 1.8.4)
|
||||
- gRPC-Core/Interface (= 1.8.4)
|
||||
- gRPC-Core/Implementation (1.8.4):
|
||||
- gRPC (1.9.1):
|
||||
- gRPC-RxLibrary (= 1.9.1)
|
||||
- gRPC/Main (= 1.9.1)
|
||||
- gRPC-Core (1.9.1):
|
||||
- gRPC-Core/Implementation (= 1.9.1)
|
||||
- gRPC-Core/Interface (= 1.9.1)
|
||||
- gRPC-Core/Implementation (1.9.1):
|
||||
- BoringSSL (~> 9.0)
|
||||
- gRPC-Core/Interface (= 1.8.4)
|
||||
- gRPC-Core/Interface (= 1.9.1)
|
||||
- nanopb (~> 0.3)
|
||||
- gRPC-Core/Interface (1.8.4)
|
||||
- gRPC-ProtoRPC (1.8.4):
|
||||
- gRPC (= 1.8.4)
|
||||
- gRPC-RxLibrary (= 1.8.4)
|
||||
- gRPC-Core/Interface (1.9.1)
|
||||
- gRPC-ProtoRPC (1.9.1):
|
||||
- gRPC (= 1.9.1)
|
||||
- gRPC-RxLibrary (= 1.9.1)
|
||||
- Protobuf (~> 3.0)
|
||||
- gRPC-RxLibrary (1.8.4)
|
||||
- gRPC/Main (1.8.4):
|
||||
- gRPC-Core (= 1.8.4)
|
||||
- gRPC-RxLibrary (= 1.8.4)
|
||||
- GTMSessionFetcher/Core (1.1.12)
|
||||
- gRPC-RxLibrary (1.9.1)
|
||||
- gRPC/Main (1.9.1):
|
||||
- gRPC-Core (= 1.9.1)
|
||||
- gRPC-RxLibrary (= 1.9.1)
|
||||
- GTMSessionFetcher/Core (1.1.13)
|
||||
- leveldb-library (1.20)
|
||||
- nanopb (0.3.8):
|
||||
- nanopb/decode (= 0.3.8)
|
||||
@@ -164,7 +164,7 @@ PODS:
|
||||
- React/Core
|
||||
- React/fishhook
|
||||
- React/RCTBlob
|
||||
- RNFirebase (3.2.0):
|
||||
- RNFirebase (3.2.4):
|
||||
- React
|
||||
- yoga (0.52.0.React)
|
||||
|
||||
@@ -201,10 +201,10 @@ EXTERNAL SOURCES:
|
||||
SPEC CHECKSUMS:
|
||||
BoringSSL: f3d6b8ce199b9c450a8cfc14895d07a2627fc232
|
||||
Crashlytics: dbb07d01876c171c5ccbdf7826410380189e452c
|
||||
Fabric: 9cd6a848efcf1b8b07497e0b6a2e7d336353ba15
|
||||
Firebase: 2721056b8885eef90233b03f37be64358d35d262
|
||||
Fabric: bb495bb9a7a7677c6d03a1f8b83d95bc49b47e41
|
||||
Firebase: 7d3b8cd837ad9fcd391657734c0d56dab8e9a5a3
|
||||
FirebaseABTesting: d07d0ee833b842d5153549e4c7e2e2cb1c23a3f9
|
||||
FirebaseAnalytics: 617afa8c26b57a0c3f11361b248bc9e17bfd8dfd
|
||||
FirebaseAnalytics: 388b630c15713f5dbf364071f5f3d6077fb52f4e
|
||||
FirebaseAuth: bd2738c5c1e92b108ba5f7f7335908097a4e50bb
|
||||
FirebaseCore: 2e0b98fb2d64ca8140136beff15772bdd14d2dd7
|
||||
FirebaseCrash: cded0fc566c03651aea606a101bc156085f333ca
|
||||
@@ -219,16 +219,16 @@ SPEC CHECKSUMS:
|
||||
FirebaseSwizzlingUtilities: f1c49a5a372ac852c853722a5891a0a5e2344a6c
|
||||
Google-Mobile-Ads-SDK: 83f7f890e638ce8f1debd440ea363338c9f6be3b
|
||||
GoogleToolboxForMac: 2501e2ad72a52eb3dfe7bd9aee7dad11b858bd20
|
||||
gRPC: 572520c17b794362388d5c95396329592a3c199b
|
||||
gRPC-Core: af0d4f0a53735e335fccc815c50c0a03da695287
|
||||
gRPC-ProtoRPC: 6596fde8d27e0718d7de1de1dc99a951d832a809
|
||||
gRPC-RxLibrary: f6b1432a667c3354c7b345affed9886c0d4ff549
|
||||
GTMSessionFetcher: ebaa1f79a5366922c1735f1566901f50beba23b7
|
||||
gRPC: 58828d611419d49da19ad02a60679ffa10a10a87
|
||||
gRPC-Core: 66413bf1f2d038a6221bc7bfcbeeaa5a117cee29
|
||||
gRPC-ProtoRPC: f29e8b7445e0d3c0311678ab121e6c164da4ca5e
|
||||
gRPC-RxLibrary: 8e0067bfe8a054022c7a81470baace4f2f633b48
|
||||
GTMSessionFetcher: 5bb1eae636127de695590f50e7d248483eb891e6
|
||||
leveldb-library: '08cba283675b7ed2d99629a4bc5fd052cd2bb6a5'
|
||||
nanopb: 5601e6bca2dbf1ed831b519092ec110f66982ca3
|
||||
Protobuf: 8a9838fba8dae3389230e1b7f8c104aa32389c03
|
||||
React: 61a6bdf17a9ff16875c230e6ff278d9de274e16c
|
||||
RNFirebase: 22b1917fec663706907bc901ed665ac4f8b9bfd6
|
||||
RNFirebase: 011e47909cf54070f72d50b8d61eb7b347774d29
|
||||
yoga: 646606bf554d54a16711f35596178522fbc00480
|
||||
|
||||
PODFILE CHECKSUM: 67c98bcb203cb992da590bcab6f690f727653ca5
|
||||
|
||||
Reference in New Issue
Block a user