Skip to content
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

chore: use public API types internally #1100

Merged
merged 3 commits into from
Jun 3, 2020

Conversation

schmidt-sebastian
Copy link
Contributor

@schmidt-sebastian schmidt-sebastian commented May 30, 2020

This PR updates the code to implement the interfaces for all public types, which should ensure that our API matches our types. It also removes the duplication that we had in types.ts, since w can directly depend on the interface types that are defined in our .d.ts file.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label May 30, 2020
@codecov
Copy link

codecov bot commented May 31, 2020

Codecov Report

Merging #1100 into node10 will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           node10    #1100      +/-   ##
==========================================
- Coverage   98.62%   98.61%   -0.02%     
==========================================
  Files          28       28              
  Lines       18141    17973     -168     
  Branches     1407     1405       -2     
==========================================
- Hits        17892    17724     -168     
  Misses        246      246              
  Partials        3        3              
Impacted Files Coverage Δ
dev/src/bulk-writer.ts 98.85% <100.00%> (+0.02%) ⬆️
dev/src/document-change.ts 100.00% <100.00%> (ø)
dev/src/document.ts 98.77% <100.00%> (+0.01%) ⬆️
dev/src/field-value.ts 97.06% <100.00%> (+0.01%) ⬆️
dev/src/geo-point.ts 99.13% <100.00%> (+0.01%) ⬆️
dev/src/index.ts 98.20% <100.00%> (+<0.01%) ⬆️
dev/src/path.ts 98.55% <100.00%> (+0.01%) ⬆️
dev/src/reference.ts 99.88% <100.00%> (+<0.01%) ⬆️
dev/src/serializer.ts 99.06% <100.00%> (+<0.01%) ⬆️
dev/src/timestamp.ts 100.00% <100.00%> (ø)
... and 7 more

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 1298c60...eacebbc. Read the comment docs.

Copy link

@thebrianchen thebrianchen left a comment

Choose a reason for hiding this comment

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

LGTM

I played around with adding some additional prefixes, feel free to include them or ignore: https://github.com/googleapis/nodejs-firestore/compare/mrschmidt/publicapitypes...bc/public-api?expand=1

@@ -122,13 +126,13 @@ class BulkCommitBatch {
set<T>(
documentRef: DocumentReference<T>,

Choose a reason for hiding this comment

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

I tried s/: DocumentReference/: firestore.DocumentReference, which resulted in working code even when BulkWriter is made public .

@@ -26,7 +28,7 @@ import api = google.firestore.v1;
*
* @class
*/
export class GeoPoint implements Serializable {
export class GeoPoint implements Serializable, firestore.GeoPoint {

Choose a reason for hiding this comment

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

change static:
static fromProto(proto: google.type.ILatLng): firestore.GeoPoint

@@ -34,7 +36,7 @@ import api = proto.google.firestore.v1;
*
* @class
*/
export class FieldValue {
export class FieldValue implements firestore.FieldValue {

Choose a reason for hiding this comment

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

You can use firestore.FieldValue in several places w/o breaking.

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 and the follow up changes. I imported part of your PR. I opted not to include the following:

  • Changes to the return types. I prefer the consistency of the current approach, as we return the internal API type everywhere.
  • I did not modify the public types. I think we should to that in an explicit PR.

@schmidt-sebastian schmidt-sebastian merged commit 632f0a8 into node10 Jun 3, 2020
@schmidt-sebastian schmidt-sebastian deleted the mrschmidt/publicapitypes branch June 3, 2020 16:32
schmidt-sebastian added a commit that referenced this pull request Jun 24, 2020
* fix!: mark v1beta1 client as deprecated (#937)

* feat!: use QueryDocumentSnapshot in FirestoreDataConverter (#965)

* deps: update to gts 2.x (#1013)

* chore!: update settings for Node 10 (#1019)

* deps: drop through2 (#1014)

* feat: support BigInt (#1016)

* fix: make update.sh work on Linux (#1043)

* fix: only use BigInt in BigInt system test (#1044)

* fix: make pbjs compile admin proto again (#1045)

* Add BulkWriter (#1055)

* docs: Add documentation for FirestoreDataConverter (#1059)

* chore: enforce return types (#1065)

* fix: add generic to Firestore.getAll() (#1066)

* chore: remove internal WriteOp (#1067)

* chore: add linter checks for it|describe.only (#1068)

* fix: handle terminate in BulkWriter (#1070)

* chore: run template copying last in synthtool (#1071)

* feat: Firestore Bundles implementation (#1078)

* feat: add support for set() with SetOptions when using FirestoreDataConverter (#1087)

* feat: Add totalDocuments and totalBytes to bundle metadata. (#1085)

* feat: Add totalDocuments and totalBytes to bundle metadata.

* fix: Better comment

* fix: Better testing.

* fix: Improve metadata testing.

* fix: incomplete expect in rate-limiter test (#1092)

* Remove BatchWrite proto, fix conformance tests

* chore: use public API types internally (#1100)

* feat: add Partition and BatchWrite protos (#1110)

* fix: remove GCF transaction fallback (#1112)

* fix: add BulkWriter integration tests, java backport changes, delete fix (#1117)

* chore: merge master (#1218)

* chore: add eslint check for console.log statements (#1229)

* fix: another attempt at fixing the flaky BulkWriter test (#1228)

* Fix comment

* Renames

* Test fix

* Fix unit tests

Co-authored-by: Brian Chen <chenbrian@google.com>
Co-authored-by: wu-hui <53845758+wu-hui@users.noreply.github.com>
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.

3 participants