Skip to content

Commit e0adfc9

Browse files
Address Gil's feedback
1 parent 41b26c5 commit e0adfc9

19 files changed

+211
-195
lines changed

packages/firestore/exp/src/api/database.ts

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,14 @@ export class FirebaseFirestore
176176

177177
/**
178178
* Initializes a new instance of Cloud Firestore with the provided settings.
179-
* Can only be called before any other methods, including
180-
* {@link getFirestore()}. If the custom settings are empty, this method is
179+
* Can only be called before any other function, including
180+
* {@link getFirestore()}. If the custom settings are empty, this function is
181181
* equivalent to calling {@link getFirestore()}.
182182
*
183-
* @param app The {@link FirebaseApp} that the Firestore instance will be
184-
* associated with.
185-
* @param settings A settings object to configure the Firestore instance.
186-
* @return A newly initialized Firestore instance.
183+
* @param app The {@link FirebaseApp} with which the `Firestore` instance will
184+
* be associated.
185+
* @param settings A settings object to configure the `Firestore` instance.
186+
* @return A newly initialized `Firestore` instance.
187187
*/
188188
export function initializeFirestore(
189189
app: FirebaseApp,
@@ -216,7 +216,7 @@ export function initializeFirestore(
216216
*
217217
* @param app The {@link FirebaseApp} instance that the returned Firestore
218218
* instance is associated with.
219-
* @return The Firestore instance of the provided app.
219+
* @return The `Firestore` instance of the provided app.
220220
*/
221221
export function getFirestore(app: FirebaseApp): FirebaseFirestore {
222222
return _getProvider(app, 'firestore-exp').getImmediate() as FirebaseFirestore;
@@ -225,12 +225,12 @@ export function getFirestore(app: FirebaseApp): FirebaseFirestore {
225225
/**
226226
* Attempts to enable persistent storage, if possible.
227227
*
228-
* Must be called before any other methods (other than
228+
* Must be called before any other functions (other than
229229
* {@link initializeFirestore()}, {@link getFirestore()} or
230230
* {@link clearIndexedDbPersistence()}.
231231
*
232-
* If this fails, enableIndexedDbPersistence() will reject the promise it
233-
* returns. Note that even after this failure, the firestore instance will
232+
* If this fails, `enableIndexedDbPersistence()` will reject the promise it
233+
* returns. Note that even after this failure, the `Firestore` instance will
234234
* remain usable, however offline persistence will be disabled.
235235
*
236236
* There are several reasons why this can fail, which can be identified by
@@ -240,7 +240,7 @@ export function getFirestore(app: FirebaseApp): FirebaseFirestore {
240240
* * unimplemented: The browser is incompatible with the offline
241241
* persistence implementation.
242242
*
243-
* @param firestore The Firestore instance to enable persistence for.
243+
* @param firestore The `Firestore` instance to enable persistence for.
244244
* @param persistenceSettings Optional settings object to configure persistence.
245245
* @return A promise that represents successfully enabling persistent storage.
246246
*/
@@ -283,8 +283,8 @@ export function enableIndexedDbPersistence(
283283
* shared execution of queries and latency-compensated local document updates
284284
* across all connected instances.
285285
*
286-
* If this fails, enableMultiTabIndexedDbPersistence() will reject the promise
287-
* it returns. Note that even after this failure, the firestore instance will
286+
* If this fails, `enableMultiTabIndexedDbPersistence()` will reject the promise
287+
* it returns. Note that even after this failure, the `Firestore` instance will
288288
* remain usable, however offline persistence will be disabled.
289289
*
290290
* There are several reasons why this can fail, which can be identified by
@@ -295,7 +295,7 @@ export function enableIndexedDbPersistence(
295295
* * unimplemented: The browser is incompatible with the offline
296296
* persistence implementation.
297297
*
298-
* @param firestore The Firestore instance to enable persistence for.
298+
* @param firestore The `Firestore` instance to enable persistence for.
299299
* @return A promise that represents successfully enabling persistent
300300
* storage.
301301
*/
@@ -334,20 +334,21 @@ export function enableMultiTabIndexedDbPersistence(
334334
* Clears the persistent storage. This includes pending writes and cached
335335
* documents.
336336
*
337-
* Must be called while the firestore instance is not started (after the app is
338-
* shutdown or when the app is first initialized). On startup, this method must
339-
* be called before other methods (other than {@link initializeFirestore()} or
340-
* {@link getFirestore()})). If the firestore instance is still running, the
341-
* promise will be rejected with the error code of `failed-precondition`.
337+
* Must be called while the `Firestore` instance is not started (after the app is
338+
* terminated or when the app is first initialized). On startup, this function
339+
* must be called before other functions (other than {@link
340+
* initializeFirestore()} or {@link getFirestore()})). If the `Firestore`
341+
* instance is still running, the promise will be rejected with the error code
342+
* of `failed-precondition`.
342343
*
343-
* Note: clearIndexedDbPersistence() is primarily intended to help write
344+
* Note: `clearIndexedDbPersistence()` is primarily intended to help write
344345
* reliable tests that use Cloud Firestore. It uses an efficient mechanism for
345346
* dropping existing data but does not attempt to securely overwrite or
346347
* otherwise make cached data unrecoverable. For applications that are sensitive
347348
* to the disclosure of cached data in between user sessions, we strongly
348349
* recommend not enabling persistence at all.
349350
*
350-
* @param firestore The Firestore instance to clear persistence for.
351+
* @param firestore The `Firestore` instance to clear persistence for.
351352
* @return A promise that is resolved when the persistent storage is
352353
* cleared. Otherwise, the promise is rejected with an error.
353354
*/
@@ -383,7 +384,7 @@ export function clearIndexedDbPersistence(
383384
* The returned Promise resolves immediately if there are no outstanding writes.
384385
* Otherwise, the Promise waits for all previously issued writes (including
385386
* those written in a previous app session), but it does not wait for writes
386-
* that were added after the method is called. If you want to wait for
387+
* that were added after the function is called. If you want to wait for
387388
* additional writes, call `waitForPendingWrites()` again.
388389
*
389390
* Any outstanding `waitForPendingWrites()` Promises are rejected during user
@@ -425,7 +426,7 @@ export function enableNetwork(firestore: FirebaseFirestore): Promise<void> {
425426
/**
426427
* Disables network usage for this instance. It can be re-enabled via {@link
427428
* enableNetwork()}. While the network is disabled, any snapshot listeners,
428-
* getDoc() or getDocs() calls will return results from cache, and any write
429+
* `getDoc()` or `getDocs()` calls will return results from cache, and any write
429430
* operations will be queued until the network is restored.
430431
*
431432
* @return A promise that is resolved once the network has been disabled.
@@ -444,8 +445,8 @@ export function disableNetwork(firestore: FirebaseFirestore): Promise<void> {
444445
/**
445446
* Terminates the provided Firestore instance.
446447
*
447-
* After calling `terminate()` only the `clearIndexedDbPersistence()` method may
448-
* be used. Any other method will throw a `FirestoreError`.
448+
* After calling `terminate()` only the `clearIndexedDbPersistence()` function
449+
* may be used. Any other function will throw a `FirestoreError`.
449450
*
450451
* To restart after termination, create a new instance of FirebaseFirestore with
451452
* {@link getFirestore()}.
@@ -456,9 +457,9 @@ export function disableNetwork(firestore: FirebaseFirestore): Promise<void> {
456457
* sending these writes to the server.
457458
*
458459
* Note: Under normal circumstances, calling `terminate()` is not required. This
459-
* method is useful only when you want to force this instance to release all of
460-
* its resources or in combination with `clearIndexedDbPersistence()` to ensure
461-
* that all local state is destroyed between test runs.
460+
* function is useful only when you want to force this instance to release all
461+
* of its resources or in combination with `clearIndexedDbPersistence()` to
462+
* ensure that all local state is destroyed between test runs.
462463
*
463464
* @return A promise that is resolved when the instance has been successfully
464465
* terminated.

packages/firestore/exp/src/api/reference.ts

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ export interface SnapshotListenOptions {
9898
* Note: `getDoc()` attempts to provide up-to-date data when possible by waiting
9999
* for data from the server, but it may return cached data or fail if you are
100100
* offline and the server cannot be reached. To specify this behavior, invoke
101-
* {@link getDocFromCache()} or @link getDocFromServer()}.
101+
* {@link getDocFromCache()} or {@link getDocFromServer()}.
102102
*
103103
* @param reference The reference of the document to fetch.
104-
* @return A Promise resolved with a DocumentSnapshot containing the
104+
* @return A Promise resolved with a `DocumentSnapshot` containing the
105105
* current document contents.
106106
*/
107107
export function getDoc<T>(
@@ -130,7 +130,7 @@ export function getDoc<T>(
130130
* Reads the document referred to by this `DocumentReference` from cache.
131131
* Returns an error if the document is not currently cached.
132132
*
133-
* @return A Promise resolved with a DocumentSnapshot containing the
133+
* @return A Promise resolved with a `DocumentSnapshot` containing the
134134
* current document contents.
135135
*/
136136
export function getDocFromCache<T>(
@@ -163,7 +163,7 @@ export function getDocFromCache<T>(
163163
* Reads the document referred to by this `DocumentReference` from the server.
164164
* Returns an error if the network is not available.
165165
*
166-
* @return A Promise resolved with a DocumentSnapshot containing the
166+
* @return A Promise resolved with a `DocumentSnapshot` containing the
167167
* current document contents.
168168
*/
169169
export function getDocFromServer<T>(
@@ -196,7 +196,7 @@ export function getDocFromServer<T>(
196196
* you are offline and the server cannot be reached. To specify this behavior,
197197
* invoke {@link getDocsFromCache()} or {@link getDocsFromServer()}.
198198
*
199-
* @return A Promise that will be resolved with the results of the Query.
199+
* @return A Promise that will be resolved with the results of the query.
200200
*/
201201
export function getDocs<T>(query: Query<T>): Promise<QuerySnapshot<T>> {
202202
const firestore = cast(query.firestore, FirebaseFirestore);
@@ -224,7 +224,7 @@ export function getDocs<T>(query: Query<T>): Promise<QuerySnapshot<T>> {
224224
* Executes the query and returns the results as a `QuerySnapshot` from cache.
225225
* Returns an error if the document is not currently cached.
226226
*
227-
* @return A Promise that will be resolved with the results of the Query.
227+
* @return A Promise that will be resolved with the results of the query.
228228
*/
229229
export function getDocsFromCache<T>(
230230
query: Query<T>
@@ -244,9 +244,9 @@ export function getDocsFromCache<T>(
244244

245245
/**
246246
* Executes the query and returns the results as a `QuerySnapshot` from the
247-
* server. Returns an error if the network is not available..
247+
* server. Returns an error if the network is not available.
248248
*
249-
* @return A Promise that will be resolved with the results of the Query.
249+
* @return A Promise that will be resolved with the results of the query.
250250
*/
251251
export function getDocsFromServer<T>(
252252
query: Query<T>
@@ -277,7 +277,7 @@ export function getDocsFromServer<T>(
277277
* @param reference A reference to the document to write.
278278
* @param data A map of the fields and values for the document.
279279
* @return A Promise resolved once the data has been successfully written
280-
* to the backend (Note that it won't resolve while you're offline).
280+
* to the backend (note that it won't resolve while you're offline).
281281
*/
282282
export function setDoc<T>(
283283
reference: DocumentReference<T>,
@@ -292,7 +292,7 @@ export function setDoc<T>(
292292
* @param data A map of the fields and values for the document.
293293
* @param options An object to configure the set behavior.
294294
* @return A Promise resolved once the data has been successfully written
295-
* to the backend (Note that it won't resolve while you're offline).
295+
* to the backend (note that it won't resolve while you're offline).
296296
*/
297297
export function setDoc<T>(
298298
reference: DocumentReference<T>,
@@ -336,7 +336,7 @@ export function setDoc<T>(
336336
* update the document. Fields can contain dots to reference nested fields
337337
* within the document.
338338
* @return A Promise resolved once the data has been successfully written
339-
* to the backend (Note that it won't resolve while you're offline).
339+
* to the backend (note that it won't resolve while you're offline).
340340
*/
341341
export function updateDoc(
342342
reference: DocumentReference<unknown>,
@@ -348,14 +348,14 @@ export function updateDoc(
348348
* not exist.
349349
*
350350
* Nested fields can be updated by providing dot-separated field path
351-
* strings or by providing FieldPath objects.
351+
* strings or by providing `FieldPath` objects.
352352
*
353353
* @param reference A reference to the document to update.
354354
* @param field The first field to update.
355355
* @param value The first value.
356356
* @param moreFieldsAndValues Additional key value pairs.
357357
* @return A Promise resolved once the data has been successfully written
358-
* to the backend (Note that it won't resolve while you're offline).
358+
* to the backend (note that it won't resolve while you're offline).
359359
*/
360360
export function updateDoc(
361361
reference: DocumentReference<unknown>,
@@ -408,7 +408,7 @@ export function updateDoc(
408408
*
409409
* @param reference A reference to the document to delete.
410410
* @return A Promise resolved once the document has been successfully
411-
* deleted from the backend (Note that it won't resolve while you're offline).
411+
* deleted from the backend (note that it won't resolve while you're offline).
412412
*/
413413
export function deleteDoc(
414414
reference: DocumentReference<unknown>
@@ -424,7 +424,7 @@ export function deleteDoc(
424424
* Add a new document to specified `CollectionReference` with the given data,
425425
* assigning it a document ID automatically.
426426
*
427-
* @param reference A reference to the Collection to add this document to.
427+
* @param reference A reference to the collection to add this document to.
428428
* @param data An Object containing the data for the new document.
429429
* @return A Promise resolved with a `DocumentReference` pointing to the
430430
* newly created document after it has been written to the backend (Note that it
@@ -461,7 +461,7 @@ export function addDoc<T>(
461461
// integration tests
462462

463463
/**
464-
* Attaches a listener for DocumentSnapshot events. You may either pass
464+
* Attaches a listener for `DocumentSnapshot` events. You may either pass
465465
* individual `onNext` and `onError` callbacks or pass a single observer
466466
* object with `next` and `error` callbacks.
467467
*
@@ -482,7 +482,7 @@ export function onSnapshot<T>(
482482
}
483483
): Unsubscribe;
484484
/**
485-
* Attaches a listener for DocumentSnapshot events. You may either pass
485+
* Attaches a listener for `DocumentSnapshot` events. You may either pass
486486
* individual `onNext` and `onError` callbacks or pass a single observer
487487
* object with `next` and `error` callbacks.
488488
*
@@ -505,7 +505,7 @@ export function onSnapshot<T>(
505505
}
506506
): Unsubscribe;
507507
/**
508-
* Attaches a listener for DocumentSnapshot events. You may either pass
508+
* Attaches a listener for `DocumentSnapshot` events. You may either pass
509509
* individual `onNext` and `onError` callbacks or pass a single observer
510510
* object with `next` and `error` callbacks.
511511
*
@@ -529,7 +529,7 @@ export function onSnapshot<T>(
529529
onCompletion?: () => void
530530
): Unsubscribe;
531531
/**
532-
* Attaches a listener for DocumentSnapshot events. You may either pass
532+
* Attaches a listener for `DocumentSnapshot` events. You may either pass
533533
* individual `onNext` and `onError` callbacks or pass a single observer
534534
* object with `next` and `error` callbacks.
535535
*
@@ -555,7 +555,7 @@ export function onSnapshot<T>(
555555
onCompletion?: () => void
556556
): Unsubscribe;
557557
/**
558-
* Attaches a listener for QuerySnapshot events. You may either pass
558+
* Attaches a listener for `QuerySnapshot` events. You may either pass
559559
* individual `onNext` and `onError` callbacks or pass a single observer
560560
* object with `next` and `error` callbacks. The listener can be cancelled by
561561
* calling the function that is returned when `onSnapshot` is called.
@@ -577,7 +577,7 @@ export function onSnapshot<T>(
577577
}
578578
): Unsubscribe;
579579
/**
580-
* Attaches a listener for QuerySnapshot events. You may either pass
580+
* Attaches a listener for `QuerySnapshot` events. You may either pass
581581
* individual `onNext` and `onError` callbacks or pass a single observer
582582
* object with `next` and `error` callbacks. The listener can be cancelled by
583583
* calling the function that is returned when `onSnapshot` is called.
@@ -601,7 +601,7 @@ export function onSnapshot<T>(
601601
}
602602
): Unsubscribe;
603603
/**
604-
* Attaches a listener for QuerySnapshot events. You may either pass
604+
* Attaches a listener for `QuerySnapshot` events. You may either pass
605605
* individual `onNext` and `onError` callbacks or pass a single observer
606606
* object with `next` and `error` callbacks. The listener can be cancelled by
607607
* calling the function that is returned when `onSnapshot` is called.
@@ -626,7 +626,7 @@ export function onSnapshot<T>(
626626
onCompletion?: () => void
627627
): Unsubscribe;
628628
/**
629-
* Attaches a listener for QuerySnapshot events. You may either pass
629+
* Attaches a listener for `QuerySnapshot` events. You may either pass
630630
* individual `onNext` and `onError` callbacks or pass a single observer
631631
* object with `next` and `error` callbacks. The listener can be cancelled by
632632
* calling the function that is returned when `onSnapshot` is called.

0 commit comments

Comments
 (0)