From 43ac9c6a0679a4dbd43cffdce71358069f434faf Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Wed, 15 May 2019 13:59:45 -0700 Subject: [PATCH] refactor(deprecation)!: remove deprecated getCollections() (#624) --- dev/src/index.ts | 13 ------------- dev/src/reference.ts | 12 ------------ dev/test/document.ts | 18 +++++++----------- dev/test/index.ts | 4 +--- dev/test/typescript.ts | 4 ---- types/firestore.d.ts | 19 ------------------- 6 files changed, 8 insertions(+), 62 deletions(-) diff --git a/dev/src/index.ts b/dev/src/index.ts index f85687853..545824901 100644 --- a/dev/src/index.ts +++ b/dev/src/index.ts @@ -812,19 +812,6 @@ export class Firestore { return rootDocument.listCollections(); } - /** - * Fetches the root collections that are associated with this Firestore - * database. - * - * @deprecated Use `.listCollections()`. - * - * @returns {Promise.>} A Promise that resolves - * with an array of CollectionReferences. - */ - getCollections() { - return this.listCollections(); - } - /** * Retrieves multiple documents from Firestore. * diff --git a/dev/src/reference.ts b/dev/src/reference.ts index f564aaa1f..e4b8cd68d 100644 --- a/dev/src/reference.ts +++ b/dev/src/reference.ts @@ -307,18 +307,6 @@ export class DocumentReference implements Serializable { }); } - /** - * Fetches the subcollections that are direct children of this document. - * - * @deprecated Use `.listCollections()`. - * - * @returns {Promise.>} A Promise that resolves - * with an array of CollectionReferences. - */ - getCollections(): Promise { - return this.listCollections(); - } - /** * Create a document with the provided object values. This will fail the write * if a document exists at its location. diff --git a/dev/test/document.ts b/dev/test/document.ts index a34202d53..dce473fc9 100644 --- a/dev/test/document.ts +++ b/dev/test/document.ts @@ -1952,17 +1952,13 @@ describe('listCollections() method', () => { }; return createInstance(overrides).then(firestore => { - // We are using `getCollections()` to ensure 100% code coverage - return ( - firestore - .doc('coll/doc') - // tslint:disable-next-line deprecation - .getCollections() - .then(collections => { - expect(collections[0].path).to.equal('coll/doc/first'); - expect(collections[1].path).to.equal('coll/doc/second'); - }) - ); + return firestore + .doc('coll/doc') + .listCollections() + .then(collections => { + expect(collections[0].path).to.equal('coll/doc/first'); + expect(collections[1].path).to.equal('coll/doc/second'); + }); }); }); }); diff --git a/dev/test/index.ts b/dev/test/index.ts index 88b66553b..c881967de 100644 --- a/dev/test/index.ts +++ b/dev/test/index.ts @@ -732,9 +732,7 @@ describe('listCollections() method', () => { }; return createInstance(overrides).then(firestore => { - // We are using `getCollections()` to ensure 100% code coverage - // tslint:disable-next-line deprecation - return firestore.getCollections().then(collections => { + return firestore.listCollections().then(collections => { expect(collections[0].path).to.equal('first'); expect(collections[1].path).to.equal('second'); }); diff --git a/dev/test/typescript.ts b/dev/test/typescript.ts index d63eac58f..e30ab855e 100644 --- a/dev/test/typescript.ts +++ b/dev/test/typescript.ts @@ -73,8 +73,6 @@ xdescribe('firestore.d.ts', () => { firestore .getAll(docRef1, docRef2, {fieldMask: ['foo', new FieldPath('foo')]}) .then((docs: DocumentSnapshot[]) => {}); - // tslint:disable-next-line deprecation - firestore.getCollections().then((collections: CollectionReference[]) => {}); firestore .listCollections() .then((collections: CollectionReference[]) => {}); @@ -154,8 +152,6 @@ xdescribe('firestore.d.ts', () => { const parent: CollectionReference = docRef.parent; const path: string = docRef.path; const subcollection: CollectionReference = docRef.collection('coll'); - // tslint:disable-next-line deprecation - docRef.getCollections().then((collections: CollectionReference[]) => {}); docRef.listCollections().then((collections: CollectionReference[]) => {}); docRef.get().then((snapshot: DocumentSnapshot) => {}); docRef diff --git a/types/firestore.d.ts b/types/firestore.d.ts index 208134cb1..a2931cab8 100644 --- a/types/firestore.d.ts +++ b/types/firestore.d.ts @@ -166,16 +166,6 @@ declare namespace FirebaseFirestore { getAll(...documentRefsOrReadOptions: Array): Promise; - /** - * Fetches the root collections that are associated with this Firestore - * database. - * - * @deprecated Use `.listCollections()`. - * - * @returns A Promise that resolves with an array of CollectionReferences. - */ - getCollections() : Promise; - /** * Fetches the root collections that are associated with this Firestore * database. @@ -571,15 +561,6 @@ declare namespace FirebaseFirestore { */ collection(collectionPath: string): CollectionReference; - /** - * Fetches the subcollections that are direct children of this document. - * - * @deprecated Use `.listCollections()`. - * - * @returns A Promise that resolves with an array of CollectionReferences. - */ - getCollections() : Promise; - /** * Fetches the subcollections that are direct children of this document. *