Skip to content

Conversation

@schmidt-sebastian
Copy link
Contributor

@schmidt-sebastian schmidt-sebastian commented Jul 12, 2018

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 timestampsInSnapshots without any further API changes.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jul 12, 2018
@codecov
Copy link

codecov bot commented Jul 12, 2018

Codecov Report

Merging #257 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #257   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          12     12           
  Lines        2119   2137   +18     
  Branches      458    461    +3     
=====================================
+ Hits         2119   2137   +18
Impacted Files Coverage Δ
src/index.js 100% <100%> (ø) ⬆️
src/validate.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4b853af...60d0a8c. Read the comment docs.

@schmidt-sebastian
Copy link
Contributor Author

Assigning this to @hiranya911 via this very comment.

Copy link

@hiranya911 hiranya911 left a 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.

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.

validate.isOptionalBoolean(
'settings.timestampsInSnapshots', settings.timestampsInSnapshots);

if (this._clientInitialized) {

This comment was marked as spam.

This comment was marked as spam.

});
});

it('validates project ID is string', function() {

This comment was marked as spam.

This comment was marked as spam.

Copy link
Contributor Author

@schmidt-sebastian schmidt-sebastian left a 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.

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.

validate.isOptionalBoolean(
'settings.timestampsInSnapshots', settings.timestampsInSnapshots);

if (this._clientInitialized) {

This comment was marked as spam.

});
});

it('validates project ID is string', function() {

This comment was marked as spam.

Copy link

@hiranya911 hiranya911 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@schmidt-sebastian schmidt-sebastian changed the base branch from initrefactor to master July 13, 2018 00:39
@schmidt-sebastian schmidt-sebastian force-pushed the settings branch 7 times, most recently from 8261cd1 to 1820e50 Compare July 13, 2018 16:24
@schmidt-sebastian
Copy link
Contributor Author

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 package.json.

@schmidt-sebastian
Copy link
Contributor Author

Adding @mikelehen for OWNERS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants