1717
1818import * as firestore from '../../' ;
1919
20- import { _getProvider } from '@firebase/app-exp' ;
21- import { FirebaseApp } from '@firebase/app-types-exp' ;
20+ import { _getProvider , _removeServiceInstance } from '@firebase/app-exp' ;
21+ import { FirebaseApp , _FirebaseService } from '@firebase/app-types-exp' ;
2222import { Provider } from '@firebase/component' ;
2323
2424import { Code , FirestoreError } from '../../../src/util/error' ;
@@ -42,12 +42,11 @@ import { Settings } from '../../';
4242const DEFAULT_HOST = 'firestore.googleapis.com' ;
4343const DEFAULT_SSL = true ;
4444
45- // TODO(firestorelite): Depend on FirebaseService once #3112 is merged
46-
4745/**
4846 * The root reference to the Firestore Lite database.
4947 */
50- export class Firestore implements firestore . FirebaseFirestore {
48+ export class Firestore
49+ implements firestore . FirebaseFirestore , _FirebaseService {
5150 readonly _databaseId : DatabaseId ;
5251 private readonly _firebaseApp : FirebaseApp ;
5352 private readonly _credentials : CredentialsProvider ;
@@ -120,6 +119,10 @@ export class Firestore implements firestore.FirebaseFirestore {
120119
121120 return new DatabaseId ( app . options . projectId ! ) ;
122121 }
122+
123+ delete ( ) : Promise < void > {
124+ return terminate ( this ) ;
125+ }
123126}
124127
125128export function initializeFirestore (
@@ -141,7 +144,7 @@ export function getFirestore(app: FirebaseApp): Firestore {
141144export function terminate (
142145 firestore : firestore . FirebaseFirestore
143146) : Promise < void > {
144- // TODO(firestorelite): Call _removeServiceInstance when available
147+ _removeServiceInstance ( firestore . app , 'firestore/lite' ) ;
145148 const firestoreClient = cast ( firestore , Firestore ) ;
146149 return firestoreClient
147150 . _getDatastore ( )
0 commit comments