11import { Inject , Injectable , InjectionToken , NgZone , Optional , PLATFORM_ID } from '@angular/core' ;
22import { from , Observable , of } from 'rxjs' ;
3- import { AssociatedReference , CollectionReference , DocumentReference , PersistenceSettings , Query , QueryFn , QueryGroupFn , Settings } from './interfaces' ;
3+ import {
4+ AssociatedReference ,
5+ CollectionReference ,
6+ DocumentReference ,
7+ PersistenceSettings ,
8+ Query ,
9+ QueryFn ,
10+ QueryGroupFn ,
11+ Settings
12+ } from './interfaces' ;
413import { AngularFirestoreDocument } from './document/document' ;
514import { AngularFirestoreCollection } from './collection/collection' ;
615import { AngularFirestoreCollectionGroup } from './collection-group/collection-group' ;
7- import { FIREBASE_APP_NAME , FIREBASE_OPTIONS , FirebaseAppConfig , FirebaseOptions , ɵAngularFireSchedulers , ɵfirebaseAppFactory , ɵkeepUnstableUntilFirstFactory } from '@angular/fire' ;
16+ import {
17+ FIREBASE_APP_NAME ,
18+ FIREBASE_OPTIONS ,
19+ FirebaseAppConfig ,
20+ FirebaseOptions ,
21+ ɵAngularFireSchedulers ,
22+ ɵfirebaseAppFactory ,
23+ ɵkeepUnstableUntilFirstFactory
24+ } from '@angular/fire' ;
825import { isPlatformServer } from '@angular/common' ;
926import { firestore } from 'firebase/app' ;
1027import firebase from '@firebase/app' ;
@@ -15,7 +32,7 @@ import 'firebase/firestore';
1532 * The value of this token determines whether or not the firestore will have persistance enabled
1633 */
1734export const ENABLE_PERSISTENCE = new InjectionToken < boolean > ( 'angularfire2.enableFirestorePersistence' ) ;
18- export const PERSISTENCE_SETTINGS = new InjectionToken < PersistenceSettings | undefined > ( 'angularfire2.firestore.persistenceSettings' ) ;
35+ export const PERSISTENCE_SETTINGS = new InjectionToken < PersistenceSettings | undefined > ( 'angularfire2.firestore.persistenceSettings' ) ;
1936export const SETTINGS = new InjectionToken < Settings > ( 'angularfire2.firestore.settings' ) ;
2037
2138/**
@@ -107,13 +124,13 @@ export class AngularFirestore {
107124 */
108125 constructor (
109126 @Inject ( FIREBASE_OPTIONS ) options : FirebaseOptions ,
110- @Optional ( ) @Inject ( FIREBASE_APP_NAME ) nameOrConfig : string | FirebaseAppConfig | null | undefined ,
111- @Optional ( ) @Inject ( ENABLE_PERSISTENCE ) shouldEnablePersistence : boolean | null ,
112- @Optional ( ) @Inject ( SETTINGS ) settings : Settings | null ,
127+ @Optional ( ) @Inject ( FIREBASE_APP_NAME ) nameOrConfig : string | FirebaseAppConfig | null | undefined ,
128+ @Optional ( ) @Inject ( ENABLE_PERSISTENCE ) shouldEnablePersistence : boolean | null ,
129+ @Optional ( ) @Inject ( SETTINGS ) settings : Settings | null ,
113130 // tslint:disable-next-line:ban-types
114131 @Inject ( PLATFORM_ID ) platformId : Object ,
115132 zone : NgZone ,
116- @Optional ( ) @Inject ( PERSISTENCE_SETTINGS ) persistenceSettings : PersistenceSettings | null ,
133+ @Optional ( ) @Inject ( PERSISTENCE_SETTINGS ) persistenceSettings : PersistenceSettings | null
117134 ) {
118135 this . schedulers = new ɵAngularFireSchedulers ( zone ) ;
119136 this . keepUnstableUntilFirst = ɵkeepUnstableUntilFirstFactory ( this . schedulers , platformId ) ;
@@ -123,9 +140,13 @@ export class AngularFirestore {
123140 // INVESTIGATE this seems to be required because in the browser build registerFirestore is an Object?
124141 // seems like we're fighting ngcc. In the server firestore() isn't available, so I have to register
125142 // in the browser registerFirestore is not a function... maybe this is an underlying firebase-js-sdk issue
126- if ( registerFirestore ) { registerFirestore ( firebase ) ; }
143+ if ( registerFirestore ) {
144+ registerFirestore ( firebase ) ;
145+ }
127146 const firestore = app . firestore ( ) ;
128- if ( settings ) { firestore . settings ( settings ) ; }
147+ if ( settings ) {
148+ firestore . settings ( settings ) ;
149+ }
129150 return firestore ;
130151 } ) ;
131152
@@ -150,7 +171,7 @@ export class AngularFirestore {
150171 * CollectionReference and an optional query function to narrow the result
151172 * set.
152173 */
153- collection < T > ( path : string | CollectionReference , queryFn ?: QueryFn ) : AngularFirestoreCollection < T > ;
174+ collection < T > ( path : string | CollectionReference , queryFn ?: QueryFn ) : AngularFirestoreCollection < T > ;
154175 collection < T > ( pathOrRef : string | CollectionReference , queryFn ?: QueryFn ) : AngularFirestoreCollection < T > {
155176 let collectionRef : CollectionReference ;
156177 if ( typeof pathOrRef === 'string' ) {
@@ -180,6 +201,7 @@ export class AngularFirestore {
180201 * Collection reference and can be queried.
181202 */
182203 doc < T > ( path : string ) : AngularFirestoreDocument < T > ;
204+ // tslint:disable-next-line:unified-signatures
183205 doc < T > ( ref : DocumentReference ) : AngularFirestoreDocument < T > ;
184206 doc < T > ( pathOrRef : string | DocumentReference ) : AngularFirestoreDocument < T > {
185207 let ref : DocumentReference ;
0 commit comments