-
Notifications
You must be signed in to change notification settings - Fork 149
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
feat: Release Bundles #1365
feat: Release Bundles #1365
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1365 +/- ##
==========================================
- Coverage 98.51% 98.51% -0.01%
==========================================
Files 32 32
Lines 19444 19440 -4
Branches 1281 1371 +90
==========================================
- Hits 19156 19152 -4
Misses 284 284
Partials 4 4
Continue to review full report at Codecov.
|
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.
I would expect this PR to contain updates to types/firestore.d.ts. Can you double check what needs to be added there?
Added. Thanks for the reminder. |
types/firestore.d.ts
Outdated
* Creates a new `BundleBuilder` instance to package selected Firestore data into | ||
* a bundle. | ||
* | ||
* @param bundleId. The id of the bundle. When loaded on clients, client SDKs use this id |
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.
In the text part: s/id/ID here and everywhere (including the main sources)
Also drop the period after "bundleId".
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.
Done.
* @returns {BundleBuilder} This instance. | ||
*/ | ||
add(documentSnapshot: DocumentSnapshot): BundleBuilder; | ||
/** |
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.
Nit: Missing empty line.
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.
Done.
types/firestore.d.ts
Outdated
* @param {DocumentSnapshot=} documentSnapshot A document snapshot to add. | ||
* @returns {BundleBuilder} This instance. |
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.
This is TypeScript. You should drop the JSDoc type markers.
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.
Done.
types/firestore.d.ts
Outdated
* @param {string=} queryName The name of the query to add. | ||
* @param {QuerySnapshot=} querySnapshot A query snapshot to add to the bundle. | ||
* @returns {BundleBuilder} This instance. |
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.
Drop types.
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.
Done.
types/firestore.d.ts
Outdated
* @param {DocumentSnapshot=} documentSnapshot A document snapshot to add. | ||
* @returns {BundleBuilder} This instance. | ||
*/ | ||
add(documentSnapshot: DocumentSnapshot): BundleBuilder; |
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.
Should DocumentSnapshot
(and QuerySnapshot
) below be generic (for converter support)? Does the BundleBuilder respect the converters as it generates the Proto?
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.
All it does is call toDocumentProto()
on the snapshot, I don't think it is necessary to make it generic?
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.
There is actually no such thing as a non-generic DocumentSnapshot in our API. The DocumentSnapshot type defaults to DocumentSnapshot<DocumentData>
, which means that a custom type such as DocumentSnapshot<Foo>
cannot be passed. This should be:
add<T>(documentSnapshot: DocumentSnapshot<T>): BundleBuilder;
Same for QuerySnapshot.
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.
Done, thanks.
dev/src/bundle.ts
Outdated
@@ -42,7 +40,7 @@ export class BundleBuilder { | |||
// The latest read time among all bundled documents and queries. | |||
private latestReadTime = new Timestamp(0, 0); | |||
|
|||
constructor(private bundleId: string) {} | |||
constructor(public readonly bundleId: string) {} |
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.
The TS style guide recommends using only "readonly" instead of "public readonly" as they are equivalent.
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.
Done.
types/firestore.d.ts
Outdated
* a bundle. | ||
* | ||
* @param bundleId The ID of the bundle. When loaded on clients, client SDKs use this ID | ||
* and the timestamp associated with the built bundle to tell if it has been loaded already. |
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.
* and the timestamp associated with the built bundle to tell if it has been loaded already. | |
* and the timestamp associated with the bundle to tell if it has been loaded already. |
or:
* and bundle's timestamp associated to tell if the bundle has been loaded already.
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.
Done.
types/firestore.d.ts
Outdated
|
||
/** | ||
* Adds a Firestore document snapshot or query snapshot to the bundle. | ||
* Both the documents data and the query read time will be included in the bundle. |
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.
This comment should only apply to DocumentSnapshots.
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.
Fixed.
types/firestore.d.ts
Outdated
* Adds a Firestore document snapshot or query snapshot to the bundle. | ||
* Both the documents data and the query read time will be included in the bundle. | ||
* | ||
* @param documentSnapshot A document snapshot to add. |
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.
* @param documentSnapshot A document snapshot to add. | |
* @param documentSnapshot A `DocumentSnapshot` to add. |
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.
Done.
types/firestore.d.ts
Outdated
* @param {DocumentSnapshot=} documentSnapshot A document snapshot to add. | ||
* @returns {BundleBuilder} This instance. | ||
*/ | ||
add(documentSnapshot: DocumentSnapshot): BundleBuilder; |
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.
There is actually no such thing as a non-generic DocumentSnapshot in our API. The DocumentSnapshot type defaults to DocumentSnapshot<DocumentData>
, which means that a custom type such as DocumentSnapshot<Foo>
cannot be passed. This should be:
add<T>(documentSnapshot: DocumentSnapshot<T>): BundleBuilder;
Same for QuerySnapshot.
types/firestore.d.ts
Outdated
* Adds a Firestore document snapshot or query snapshot to the bundle. | ||
* Both the documents data and the query read time will be included in the bundle. |
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.
Please update to only refer to QuerySnapshots.
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.
Done.
types/firestore.d.ts
Outdated
add(queryName: string, querySnapshot: QuerySnapshot): BundleBuilder; | ||
|
||
/** | ||
* Builds the bundle into a `Buffer` instance. |
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.
Maybe:
* Builds the bundle into a `Buffer` instance. | |
* Builds the bundle and returns the result as a`Buffer` instance. |
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.
Done.
types/firestore.d.ts
Outdated
|
||
/** | ||
* Adds a Firestore document snapshot or query snapshot to the bundle. | ||
* Both the documents data and the query read time will be included in the bundle. | ||
* Adds a Firestore query snapshot to the bundle. Both the query data and the query read time |
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.
We are also adding the resulting documents, no?
s/query snapshot/QuerySnapshot
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.
Done.
types/firestore.d.ts
Outdated
@@ -1924,26 +1924,26 @@ declare namespace FirebaseFirestore { | |||
readonly bundleId: string; | |||
|
|||
/** | |||
* Adds a Firestore document snapshot or query snapshot to the bundle. | |||
* Both the documents data and the query read time will be included in the bundle. | |||
* Adds a Firestore document snapshot to the bundle. Both the documents data and the document |
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.
s/document snapshot/DocumentSnapshot
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.
Done.
PR to release bundles. Will merge when we decide to release.