From a3ac029efb68e9452c3407f9c6090d8f8c0bf522 Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Wed, 17 Oct 2018 09:19:08 -0700 Subject: [PATCH 1/2] Update docs --- dev/src/index.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/dev/src/index.ts b/dev/src/index.ts index b61466ae8..63b17fdcd 100644 --- a/dev/src/index.ts +++ b/dev/src/index.ts @@ -240,8 +240,15 @@ export class Firestore { * {@see https://cloud.google.com/docs/authentication} * @param {string=} settings.keyFilename Local file containing the Service * Account credentials. Can be omitted in environments that support - * `Application Default Credentials` - * {@see https://cloud.google.com/docs/authentication} + * `Application Default Credentials`. + * {@see https://cloud.google.com/docs/authentication}. If your credentials + * are not stored on disk, you can use `settings.credentials` to just provide + * the 'client_email' and 'private_key' of your service account. + * @param {{client_email:string, private_key:string}} settings.credentials Local file containing the Service + * Account credentials. Can be omitted in environments that support + * `Application Default Credentials`. + * {@see https://cloud.google.com/docs/authentication}. If your credentials + * are stored in a JSON file, you can load them using `settings.keyFilename`. * @param {boolean=} settings.timestampsInSnapshots Enables the use of * `Timestamp`s for timestamp fields in `DocumentSnapshots`.
* Currently, Firestore returns timestamp fields as `Date` but `Date` only From 1a2cf605970888cd7970cef1a85eb7db7386ff6f Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Wed, 17 Oct 2018 10:54:40 -0700 Subject: [PATCH 2/2] Add Credentials to JSDoc --- dev/src/index.ts | 31 ++++++++++++++++++------------- types/firestore.d.ts | 25 ++++++++++++++++++++----- 2 files changed, 38 insertions(+), 18 deletions(-) diff --git a/dev/src/index.ts b/dev/src/index.ts index 63b17fdcd..832ebb7fe 100644 --- a/dev/src/index.ts +++ b/dev/src/index.ts @@ -235,20 +235,25 @@ export class Firestore { /** * @param {Object=} settings [Configuration object](#/docs). - * @param {string=} settings.projectId The Firestore Project ID. Can be - * omitted in environments that support `Application Default Credentials` - * {@see https://cloud.google.com/docs/authentication} + * @param {string=} settings.projectId The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check the + * environment variable GCLOUD_PROJECT for your project ID. Can be omitted in + * environments that support + * {@link https://cloud.google.com/docs/authentication Application Default + * Credentials} * @param {string=} settings.keyFilename Local file containing the Service - * Account credentials. Can be omitted in environments that support - * `Application Default Credentials`. - * {@see https://cloud.google.com/docs/authentication}. If your credentials - * are not stored on disk, you can use `settings.credentials` to just provide - * the 'client_email' and 'private_key' of your service account. - * @param {{client_email:string, private_key:string}} settings.credentials Local file containing the Service - * Account credentials. Can be omitted in environments that support - * `Application Default Credentials`. - * {@see https://cloud.google.com/docs/authentication}. If your credentials - * are stored in a JSON file, you can load them using `settings.keyFilename`. + * Account credentials as downloaded from the Google Developers Console. Can + * be omitted in environments that support + * {@link https://cloud.google.com/docs/authentication Application Default + * Credentials}. To configure Firestore with custom credentials, use + * `settings.credentials` and provide the `client_email` and `private_key` of + * your service account. + * @param {{client_email:string=, private_key:string=}=} settings.credentials + * The `client_email` and `private_key` properties of the service account + * to use with your Firestore project. Can be omitted in environments that + * support {@link https://cloud.google.com/docs/authentication Application + * Default Credentials}. If your credentials are stored in a JSON file, you + * can specify a `keyFilename` instead. * @param {boolean=} settings.timestampsInSnapshots Enables the use of * `Timestamp`s for timestamp fields in `DocumentSnapshots`.
* Currently, Firestore returns timestamp fields as `Date` but `Date` only diff --git a/types/firestore.d.ts b/types/firestore.d.ts index 7f25b513e..8e4f996e0 100644 --- a/types/firestore.d.ts +++ b/types/firestore.d.ts @@ -44,18 +44,33 @@ declare namespace FirebaseFirestore { */ export interface Settings { /** - * The Firestore Project ID. Can be omitted in environments that support - * `Application Default Credentials` {@see https://cloud.google.com/docs/authentication} + * The project ID from the Google Developer's Console, e.g. + * 'grape-spaceship-123'. We will also check the environment variable + * GCLOUD_PROJECT for your project ID. Can be omitted in environments that + * support {@link https://cloud.google.com/docs/authentication Application + * Default Credentials} */ projectId?: string; /** - * Local file containing the Service Account credentials. Can be omitted - * in environments that support `Application Default Credentials` - * {@see https://cloud.google.com/docs/authentication} + * Local file containing the Service Account credentials as downloaded from + * the Google Developers Console. Can be omitted in environments that + * support {@link https://cloud.google.com/docs/authentication Application + * Default Credentials}. To configure Firestore with custom credentials, use + * the `credentials` property to provide the `client_email` and + * `private_key` of your service account. */ keyFilename?: string; + /** + * The 'client_email' and 'private_key' properties of the service account + * to use with your Firestore project. Can be omitted in environments that + * support {@link https://cloud.google.com/docs/authentication Application + * Default Credentials}. If your credentials are stored in a JSON file, you + * can specify a `keyFilename` instead. + */ + credentials?: {client_email?:string, private_key?:string}; + /** * Enables the use of `Timestamp`s for timestamp fields in * `DocumentSnapshot`s.