-
Notifications
You must be signed in to change notification settings - Fork 944
Add firestore-exp/firestore-lite docs #3843
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
|
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
Binary Size ReportAffected SDKs
Test Logs
|
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.
LG! There are some places where I think we need backticks for literals, or need to un-capitalize generic terms. Also, any place we can use present tense instead of "will," it is preferred.
Thanks!
* @param updateFunction The function to execute within the transaction context. | ||
* @return If the transaction completed successfully or was explicitly aborted | ||
* @return If the transaction completed successfully or was explicitly aborted | ||
* (the `updateFunction` returned a failed promise), the promise returned by the | ||
* updateFunction is returned here. Else, if the transaction failed, a rejected |
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.
Is this a literal?
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
* @param updateFunction The function to execute within the transaction context. | ||
* @return If the transaction completed successfully or was explicitly aborted | ||
* @return If the transaction completed successfully or was explicitly aborted | ||
* (the `updateFunction` returned a failed promise), the promise returned by the | ||
* updateFunction is returned here. Else, if the transaction failed, a rejected | ||
* promise with the corresponding failure error will be returned. |
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.
Suggest "is returned."
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
* @param updateFunction The function to execute within the transaction context. | ||
* @return If the transaction completed successfully or was explicitly aborted | ||
* @return If the transaction completed successfully or was explicitly aborted | ||
* (the `updateFunction` returned a failed promise), the promise returned by the | ||
* updateFunction is returned here. Else, if the transaction failed, a rejected |
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.
Suggest "Otherwise,"
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
/** | ||
* Called by the Firestore SDK to convert a custom model object of type T | ||
* into a plain Javascript object (suitable for writing directly to the | ||
* Firestore database). Used with {@link setData()}, {@link WriteBatch#set()} |
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.
Do you think we need the parens?
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 am hoping it looks nice in the final output, but I am not sure. A lot of the old code did this instead:
{@link setDoc setDoc()}
I hope this is the same as {@link setDoc()}
.
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.
Oh -- I meant "(suitable for....). Not a big deal though.
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.
Okay, got it. I do kind of prefer to leave the parenthesis as is. Otherwise, we have to add a conjunction of some sort which will make this part harder to parse.
* set(), get(), etc. on the returned DocumentReference instance, the | ||
* provided converter will convert between Firestore data and your custom | ||
* type U. | ||
* Applies a custom data converter to this DocumentReference, allowing you to |
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.
Literal? Here and below.
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
* | ||
* @param elements The elements to remove from the array. | ||
* @return The FieldValue sentinel for use in a call to `set()` or `update()`. | ||
* @return The FieldValue sentinel for use in a call to `setDoc()` or |
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.
Literal? Here and below.
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
@@ -29,7 +29,7 @@ export class Bytes { | |||
} | |||
|
|||
/** | |||
* Creates a new Blob from the given Base64 string, converting it to | |||
* Creates a new Bytes object from the given Base64 string, converting it to |
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.
Literal? Here and below.
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
* @param other The `DocumentSnapshot` to compare against. | ||
* @return true if this `DocumentSnapshot` is equal to the provided one. | ||
* @param left A snapshot to compare. | ||
* @param right A snapshot` to 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.
Typo backtick.
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
* by waiting for data from the server, but it may return cached data or fail | ||
* if you are offline and the server cannot be reached. This behavior can be | ||
* altered via the `GetOptions` parameter. | ||
* Note: getDoc() attempts to provide up-to-date data when possible by waiting |
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.
Literal?
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
* if you are offline and the server cannot be reached. This behavior can be | ||
* altered via the `GetOptions` parameter. | ||
* Reads the document referred to by this `DocumentReference` from cache. | ||
* Returns an error of the document is not currently cached. |
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.
Think this should be "if"
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
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
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 looking at this so quickly! Feedback addressed.
* by waiting for data from the server, but it may return cached data or fail | ||
* if you are offline and the server cannot be reached. This behavior can be | ||
* altered via the `GetOptions` parameter. | ||
* Note: getDoc() attempts to provide up-to-date data when possible by waiting |
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
* if you are offline and the server cannot be reached. This behavior can be | ||
* altered via the `GetOptions` parameter. | ||
* Reads the document referred to by this `DocumentReference` from cache. | ||
* Returns an error of the document is not currently cached. |
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
* @param other The `DocumentSnapshot` to compare against. | ||
* @return true if this `DocumentSnapshot` is equal to the provided one. | ||
* @param left A snapshot to compare. | ||
* @param right A snapshot` to 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.
Done
@@ -29,7 +29,7 @@ export class Bytes { | |||
} | |||
|
|||
/** | |||
* Creates a new Blob from the given Base64 string, converting it to | |||
* Creates a new Bytes object from the given Base64 string, converting it to |
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
* | ||
* @param elements The elements to remove from the array. | ||
* @return The FieldValue sentinel for use in a call to `set()` or `update()`. | ||
* @return The FieldValue sentinel for use in a call to `setDoc()` or |
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
@@ -1114,10 +1197,13 @@ export function refEqual<T>( | |||
} | |||
|
|||
/** | |||
* Returns true if this `Query` is equal to the provided one. | |||
* Returns true if the provided Queries point to the same collection and apply |
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.
/** | ||
* Called by the Firestore SDK to convert a custom model object of type T | ||
* into a plain Javascript object (suitable for writing directly to the | ||
* Firestore database). Used with {@link setData()}, {@link WriteBatch#set()} |
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 am hoping it looks nice in the final output, but I am not sure. A lot of the old code did this instead:
{@link setDoc setDoc()}
I hope this is the same as {@link setDoc()}
.
* @param updateFunction The function to execute within the transaction context. | ||
* @return If the transaction completed successfully or was explicitly aborted | ||
* @return If the transaction completed successfully or was explicitly aborted | ||
* (the `updateFunction` returned a failed promise), the promise returned by the | ||
* updateFunction is returned here. Else, if the transaction failed, a rejected |
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
* @param updateFunction The function to execute within the transaction context. | ||
* @return If the transaction completed successfully or was explicitly aborted | ||
* @return If the transaction completed successfully or was explicitly aborted | ||
* (the `updateFunction` returned a failed promise), the promise returned by the | ||
* updateFunction is returned here. Else, if the transaction failed, a rejected |
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
* @param updateFunction The function to execute within the transaction context. | ||
* @return If the transaction completed successfully or was explicitly aborted | ||
* @return If the transaction completed successfully or was explicitly aborted | ||
* (the `updateFunction` returned a failed promise), the promise returned by the | ||
* updateFunction is returned here. Else, if the transaction failed, a rejected | ||
* promise with the corresponding failure error will be returned. |
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
@@ -173,6 +174,17 @@ export class FirebaseFirestore | |||
} | |||
} | |||
|
|||
/** | |||
* Initializes a new instance of Cloud Firestore with the provided settings. | |||
* Can only be called before any other methods, including |
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 seems no longer to be a method. Isn't it a function?
This comment applies throughout.
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.
Very nice catch. Fixed here and everywhere.
* {@link getFirestore()}. If the custom settings are empty, this method is | ||
* equivalent to calling {@link getFirestore()}. | ||
* | ||
* @param app The {@link FirebaseApp} that the Firestore instance will be |
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.
Do we care about prepositions at the end of sentences? If so: The app with which the Firestore instance will be associated.
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 have no preference here. Fixed.
* {@link initializeFirestore()}, {@link getFirestore()} or | ||
* {@link clearIndexedDbPersistence()}. | ||
* | ||
* If this fails, enableIndexedDbPersistence() will reject the promise it |
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 enableIndexedDbPersistence be in backticks?
Same concern in the other methods of this type.
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 (three times)
* documents. | ||
* | ||
* Must be called while the firestore instance is not started (after the app is | ||
* shutdown or when the app is first initialized). On startup, this method must |
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.
"shutdown" should be two words or should possibly be "terminated" since terminate
is the function, not shutdown
.
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
/** | ||
* Disables network usage for this instance. It can be re-enabled via {@link | ||
* enableNetwork()}. While the network is disabled, any snapshot listeners, | ||
* getDoc() or getDocs() calls will return results from cache, and any write |
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 getDoc and getDocs be in backticks?
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
@@ -54,19 +63,25 @@ export class GeoPoint { | |||
} | |||
|
|||
/** | |||
* Returns the latitude of this geo point, a number between -90 and 90. | |||
* The latitude of this GeoPoint 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.
GeoPoint in backticks?
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
* calendar, represented as seconds and fractions of seconds at nanosecond | ||
* resolution in UTC Epoch time. | ||
* | ||
* It is encoded using the Proleptic Gregorian |
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.
Reflow text?
@@ -64,10 +108,24 @@ export class Timestamp { | |||
} | |||
} | |||
|
|||
/** | |||
* Convert a Timestamp to a JavaScript `Date` object. This conversion causes |
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 start with "Converts", not "Convert". Timestamp in backticks or make it lowercase like below.
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
toDate(): Date { | ||
return new Date(this.toMillis()); | ||
} | ||
|
||
/** | ||
* Convert a timestamp to a numeric timestamp (in milliseconds since epoch). |
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.
"Converts"
Also, the first "timestamp" should probably be Timestamp
since we're talking about both this type and "numeric timestamp" in the same sentence.
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
packages/firestore/src/util/log.ts
Outdated
* the following values: | ||
* | ||
* <ul> | ||
* <li><code>debug</code> for the most verbose logging level, primarily for |
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 these <code>
spans just be backticks?
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
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 thorough review! Feedback addressed.
@@ -173,6 +174,17 @@ export class FirebaseFirestore | |||
} | |||
} | |||
|
|||
/** | |||
* Initializes a new instance of Cloud Firestore with the provided settings. | |||
* Can only be called before any other methods, including |
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.
Very nice catch. Fixed here and everywhere.
* {@link getFirestore()}. If the custom settings are empty, this method is | ||
* equivalent to calling {@link getFirestore()}. | ||
* | ||
* @param app The {@link FirebaseApp} that the Firestore instance will be |
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 have no preference here. Fixed.
* {@link initializeFirestore()}, {@link getFirestore()} or | ||
* {@link clearIndexedDbPersistence()}. | ||
* | ||
* If this fails, enableIndexedDbPersistence() will reject the promise it |
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 (three times)
* documents. | ||
* | ||
* Must be called while the firestore instance is not started (after the app is | ||
* shutdown or when the app is first initialized). On startup, this method must |
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
/** | ||
* Disables network usage for this instance. It can be re-enabled via {@link | ||
* enableNetwork()}. While the network is disabled, any snapshot listeners, | ||
* getDoc() or getDocs() calls will return results from cache, and any write |
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
@@ -23,15 +23,24 @@ import { | |||
import { primitiveComparator } from '../util/misc'; | |||
|
|||
/** | |||
* Immutable class representing a geo point as latitude-longitude pair. | |||
* This class is directly exposed in the public API, including its constructor. | |||
* An immutable object representing a geo point in Firestore. The geo point |
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
@@ -54,19 +63,25 @@ export class GeoPoint { | |||
} | |||
|
|||
/** | |||
* Returns the latitude of this geo point, a number between -90 and 90. | |||
* The latitude of this GeoPoint 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.
Fixed
@@ -64,10 +108,24 @@ export class Timestamp { | |||
} | |||
} | |||
|
|||
/** | |||
* Convert a Timestamp to a JavaScript `Date` object. This conversion causes |
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
toDate(): Date { | ||
return new Date(this.toMillis()); | ||
} | ||
|
||
/** | ||
* Convert a timestamp to a numeric timestamp (in milliseconds since epoch). |
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
packages/firestore/src/util/log.ts
Outdated
* the following values: | ||
* | ||
* <ul> | ||
* <li><code>debug</code> for the most verbose logging level, primarily for |
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
Size Analysis ReportAffected ProductsNo changes between base commit (a6af7c2) and head commit (d63b572). Test Logs
|
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
* caching or see local modifications, please use the full Firestore SDK. | ||
* | ||
* @param reference The reference of the document to fetch. | ||
* @return A Promise resolved with a DocumentSnapshot containing the |
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.
Something is wrong with the DocumentSnapshot here. Too many spaces surrounding it and no backticks.
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
@@ -903,11 +903,11 @@ export function doc<T>( | |||
* All documents are directly fetched from the server, even if the document was | |||
* previously read or modified. Recent modifications are only reflected in the | |||
* retrieved `DocumentSnapshot` if they have already been applied by the | |||
* backend. If you like to use caching or see local modifications, please use | |||
* the full Firestore SDK. | |||
* backend. If the client is offline, the read fails. If you like to use |
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.
Extra space after period.
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
This is a diff against #3792, which copy pastes the existing docs. This PR modifies them for the Lite and firestore-exp SDK.