Skip to content

Commit 04874c9

Browse files
Integrate with app-exp (#3276)
1 parent 8846f61 commit 04874c9

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

packages/firestore/exp/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export interface FirestoreDataConverter<T> {
6969

7070
export class FirebaseFirestore {
7171
private constructor();
72+
readonly app: FirebaseApp;
7273
}
7374

7475
export function initializeFirestore(

packages/firestore/lite/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export interface FirestoreDataConverter<T> {
5050

5151
export class FirebaseFirestore {
5252
private constructor();
53+
readonly app: FirebaseApp;
5354
}
5455

5556
export function initializeFirestore(

packages/firestore/lite/src/api/database.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
import * 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';
2222
import { Provider } from '@firebase/component';
2323

2424
import { Code, FirestoreError } from '../../../src/util/error';
@@ -42,12 +42,11 @@ import { Settings } from '../../';
4242
const DEFAULT_HOST = 'firestore.googleapis.com';
4343
const 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

125128
export function initializeFirestore(
@@ -141,7 +144,7 @@ export function getFirestore(app: FirebaseApp): Firestore {
141144
export 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

Comments
 (0)