-
Notifications
You must be signed in to change notification settings - Fork 160
Add settings() method #257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
d2f6f32 to
dd08813
Compare
dd08813 to
39b0073
Compare
Codecov Report
@@ Coverage Diff @@
## master #257 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 12 12
Lines 2119 2137 +18
Branches 458 461 +3
=====================================
+ Hits 2119 2137 +18
Continue to review full report at Codecov.
|
|
Assigning this to @hiranya911 via this very comment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly good. Just a few nits.
src/index.js
Outdated
| * @type {Object} | ||
| */ | ||
| this._initalizationOptions = options; | ||
| this._initalizationOptions = settings; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/index.js
Outdated
| * Specifies custom settings to be used to configure the `Firestore` | ||
| * instance. Can only be invoked once and before any other Firestore method. | ||
| * | ||
| * If settings are provided via both `settings()` and the Firestore |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| validate.isOptionalBoolean( | ||
| 'settings.timestampsInSnapshots', settings.timestampsInSnapshots); | ||
|
|
||
| if (this._clientInitialized) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| }); | ||
| }); | ||
|
|
||
| it('validates project ID is string', function() { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
531eb06 to
56ad597
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review. Feedback addressed.
src/index.js
Outdated
| * @type {Object} | ||
| */ | ||
| this._initalizationOptions = options; | ||
| this._initalizationOptions = settings; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/index.js
Outdated
| * Specifies custom settings to be used to configure the `Firestore` | ||
| * instance. Can only be invoked once and before any other Firestore method. | ||
| * | ||
| * If settings are provided via both `settings()` and the Firestore |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| validate.isOptionalBoolean( | ||
| 'settings.timestampsInSnapshots', settings.timestampsInSnapshots); | ||
|
|
||
| if (this._clientInitialized) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| }); | ||
| }); | ||
|
|
||
| it('validates project ID is string', function() { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
30c1809 to
e9f798a
Compare
e9f798a to
b7dbce5
Compare
8261cd1 to
1820e50
Compare
|
FYI: The tests that validate the handling of invalid constructor parameters ended up causing unhandled errors in the Node process, as the GCLOUD libraries throw an unhandled error when no credentials are present. I tried to work around this in the tests, but eventually just provided the "fake-credentials.json" as a GOOGLE_APPLICATION_DEFAULT_CREDENTIAL via the |
1820e50 to
8fe88ee
Compare
8fe88ee to
60d0a8c
Compare
|
Adding @mikelehen for OWNERS. |
This adds a Firestore.settings() method similar to what the Web SDK has. The settings provided in this method will be merged with the settings provided at construction time. The settings() method can only be called once before any other operations.
With this PR, it will be possible to enable
timestampsInSnapshotswithout any further API changes.