Skip to content

Commit 9a66285

Browse files
Reduce diff
1 parent f1d4745 commit 9a66285

File tree

10 files changed

+354
-67
lines changed

10 files changed

+354
-67
lines changed

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

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -361,15 +361,17 @@ export function clearIndexedDbPersistence(
361361
}
362362

363363
/**
364-
* Waits until all currently pending writes for the active user have been acknowledged by the
365-
* backend.
364+
* Waits until all currently pending writes for the active user have been
365+
* acknowledged by the backend.
366366
*
367-
* The returned Promise resolves immediately if there are no outstanding writes. Otherwise, the
368-
* Promise waits for all previously issued writes (including those written in a previous app
369-
* session), but it does not wait for writes that were added after the method is called. If you
370-
* want to wait for additional writes, call `waitForPendingWrites()` again.
367+
* The returned Promise resolves immediately if there are no outstanding writes.
368+
* Otherwise, the Promise waits for all previously issued writes (including
369+
* those written in a previous app session), but it does not wait for writes
370+
* that were added after the method is called. If you want to wait for
371+
* additional writes, call `waitForPendingWrites()` again.
371372
*
372-
* Any outstanding `waitForPendingWrites()` Promises are rejected during user changes.
373+
* Any outstanding `waitForPendingWrites()` Promises are rejected during user
374+
* changes.
373375
*
374376
* @return A Promise which resolves when all currently pending writes have been
375377
* acknowledged by the backend.
@@ -413,8 +415,7 @@ export function enableNetwork(firestore: FirebaseFirestore): Promise<void> {
413415
* results from cache, and any write operations will be queued until the network
414416
* is restored.
415417
*
416-
* @return A promise that is resolved once the network has been
417-
* disabled.
418+
* @return A promise that is resolved once the network has been disabled.
418419
*/
419420
export function disableNetwork(firestore: FirebaseFirestore): Promise<void> {
420421
firestore._verifyNotTerminated();
@@ -430,22 +431,24 @@ export function disableNetwork(firestore: FirebaseFirestore): Promise<void> {
430431
/**
431432
* Terminates this Firestore instance.
432433
*
433-
* After calling `terminate()` only the `clearPersistence()` method may be used. Any other method
434-
* will throw a `FirestoreError`.
434+
* After calling `terminate()` only the `clearPersistence()` method may be used.
435+
* Any other method will throw a `FirestoreError`.
435436
*
436437
* To restart after termination, create a new instance of FirebaseFirestore with
437438
* `firebase.firestore()`.
438439
*
439-
* Termination does not cancel any pending writes, and any promises that are awaiting a response
440-
* from the server will not be resolved. If you have persistence enabled, the next time you
441-
* start this instance, it will resume sending these writes to the server.
440+
* Termination does not cancel any pending writes, and any promises that are
441+
* awaiting a response from the server will not be resolved. If you have
442+
* persistence enabled, the next time you start this instance, it will resume
443+
* sending these writes to the server.
442444
*
443445
* Note: Under normal circumstances, calling `terminate()` is not required. This
444-
* method is useful only when you want to force this instance to release all of its resources or
445-
* in combination with `clearPersistence()` to ensure that all local state is destroyed
446-
* between test runs.
446+
* method is useful only when you want to force this instance to release all of
447+
* its resources or in combination with `clearPersistence()` to ensure that all
448+
* local state is destroyed between test runs.
447449
*
448-
* @return A promise that is resolved when the instance has been successfully terminated.
450+
* @return A promise that is resolved when the instance has been successfully
451+
* terminated.
449452
*/
450453
export function terminate(firestore: FirebaseFirestore): Promise<void> {
451454
_removeServiceInstance(firestore.app, 'firestore-exp');

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

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,11 @@ export class Transaction extends LiteTransaction {
8181
* `FieldValue.arrayUnion()`, `FieldValue.arrayRemove()`, or
8282
* `FieldValue.increment()` inside a transaction counts as an additional write.
8383
*
84-
* @param updateFunction
85-
* The function to execute within the transaction context.
86-
*
87-
* @return
88-
* If the transaction completed successfully or was explicitly aborted
89-
* (the `updateFunction` returned a failed promise),
90-
* the promise returned by the updateFunction is returned here. Else, if the
91-
* transaction failed, a rejected promise with the corresponding failure
92-
* error will be returned.
84+
* @param updateFunction The function to execute within the transaction context.
85+
* @return If the transaction completed successfully or was explicitly aborted
86+
* (the `updateFunction` returned a failed promise), the promise returned by the
87+
* updateFunction is returned here. Else, if the transaction failed, a rejected
88+
* promise with the corresponding failure error will be returned.
9389
*/
9490
export function runTransaction<T>(
9591
firestore: FirebaseFirestore,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ import { executeWrite } from './reference';
2626
* `FieldValue.arrayUnion()`, `FieldValue.arrayRemove()`, or
2727
* `FieldValue.increment()` inside a WriteBatch counts as an additional write.
2828
*
29-
* @return
30-
* A `WriteBatch` that can be used to atomically execute multiple writes.
29+
* @return A `WriteBatch` that can be used to atomically execute multiple
30+
* writes.
3131
*/
3232
export function writeBatch(firestore: FirebaseFirestore): WriteBatch {
3333
firestore._verifyNotTerminated();

packages/firestore/lite/src/api/bytes.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ export class Bytes {
3232
* Creates a new Blob from the given Base64 string, converting it to
3333
* bytes.
3434
*
35-
* @param base64
36-
* The Base64 string used to create the Blob object.
35+
* @param base64 The Base64 string used to create the Blob object.
3736
*/
3837
static fromBase64String(base64: string): Bytes {
3938
try {
@@ -49,8 +48,7 @@ export class Bytes {
4948
/**
5049
* Creates a new Blob from the given Uint8Array.
5150
*
52-
* @param array
53-
* The Uint8Array used to create the Blob object.
51+
* @param array The Uint8Array used to create the Blob object.
5452
*/
5553
static fromUint8Array(array: Uint8Array): Bytes {
5654
return new Bytes(ByteString.fromUint8Array(array));
@@ -59,8 +57,7 @@ export class Bytes {
5957
/**
6058
* Returns the bytes of a Blob as a Base64-encoded string.
6159
*
62-
* @return
63-
* The Base64-encoded string created from the Blob object.
60+
* @return The Base64-encoded string created from the Blob object.
6461
*/
6562
toBase64(): string {
6663
return this._byteString.toBase64();
@@ -69,8 +66,7 @@ export class Bytes {
6966
/**
7067
* Returns the bytes of a Blob in a new Uint8Array.
7168
*
72-
* @return
73-
* The Uint8Array created from the Blob object.
69+
* @return The Uint8Array created from the Blob object.
7470
*/
7571
toUint8Array(): Uint8Array {
7672
return this._byteString.toUint8Array();

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,28 @@ export function getFirestore(app: FirebaseApp): FirebaseFirestore {
152152
).getImmediate() as FirebaseFirestore;
153153
}
154154

155+
/**
156+
* Terminates this Firestore instance.
157+
*
158+
* After calling `terminate()` only the `clearPersistence()` method may be used.
159+
* Any other method will throw a `FirestoreError`.
160+
*
161+
* To restart after termination, create a new instance of FirebaseFirestore with
162+
* `firebase.firestore()`.
163+
*
164+
* Termination does not cancel any pending writes, and any promises that are
165+
* awaiting a response from the server will not be resolved. If you have
166+
* persistence enabled, the next time you start this instance, it will resume
167+
* sending these writes to the server.
168+
*
169+
* Note: Under normal circumstances, calling `terminate()` is not required. This
170+
* method is useful only when you want to force this instance to release all of
171+
* its resources or in combination with `clearPersistence()` to ensure that all
172+
* local state is destroyed between test runs.
173+
*
174+
* @return A promise that is resolved when the instance has been successfully
175+
* terminated.
176+
*/
155177
export function terminate(firestore: FirebaseFirestore): Promise<void> {
156178
_removeServiceInstance(firestore.app, 'firestore/lite');
157179
return firestore._delete();

packages/firestore/lite/src/api/field_value.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ export function serverTimestamp(): FieldValue {
5656
}
5757

5858
/**
59-
* Returns a special value that can be used with `set()` or `update()` that tells
60-
* the server to union the given elements with any array value that already
61-
* exists on the server. Each specified element that doesn't already exist in
62-
* the array will be added to the end. If the field being modified is not
63-
* already an array it will be overwritten with an array containing exactly
59+
* Returns a special value that can be used with `set()` or `update()` that
60+
* tells the server to union the given elements with any array value that
61+
* already exists on the server. Each specified element that doesn't already
62+
* exist in the array will be added to the end. If the field being modified is
63+
* not already an array it will be overwritten with an array containing exactly
6464
* the specified elements.
6565
*
6666
* @param elements The elements to union into the array.
@@ -74,11 +74,11 @@ export function arrayUnion(...elements: unknown[]): FieldValue {
7474
}
7575

7676
/**
77-
* Returns a special value that can be used with `set()` or `update()` that tells
78-
* the server to remove the given elements from any array value that already
79-
* exists on the server. All instances of each element specified will be
80-
* removed from the array. If the field being modified is not already an
81-
* array it will be overwritten with an empty array.
77+
* Returns a special value that can be used with `set()` or `update()` that
78+
* tells the server to remove the given elements from any array value that
79+
* already exists on the server. All instances of each element specified will be
80+
* removed from the array. If the field being modified is not already an array
81+
* it will be overwritten with an empty array.
8282
*
8383
* @param elements The elements to remove from the array.
8484
* @return The FieldValue sentinel for use in a call to `set()` or `update()`.
@@ -91,15 +91,15 @@ export function arrayRemove(...elements: unknown[]): FieldValue {
9191
}
9292

9393
/**
94-
* Returns a special value that can be used with `set()` or `update()` that tells
95-
* the server to increment the field's current value by the given value.
94+
* Returns a special value that can be used with `set()` or `update()` that
95+
* tells the server to increment the field's current value by the given value.
9696
*
97-
* If either the operand or the current field value uses floating point precision,
98-
* all arithmetic follows IEEE 754 semantics. If both values are integers,
99-
* values outside of JavaScript's safe number range (`Number.MIN_SAFE_INTEGER` to
100-
* `Number.MAX_SAFE_INTEGER`) are also subject to precision loss. Furthermore,
101-
* once processed by the Firestore backend, all integer operations are capped
102-
* between -2^63 and 2^63-1.
97+
* If either the operand or the current field value uses floating point
98+
* precision, all arithmetic follows IEEE 754 semantics. If both values are
99+
* integers, values outside of JavaScript's safe number range
100+
* (`Number.MIN_SAFE_INTEGER` to `Number.MAX_SAFE_INTEGER`) are also subject to
101+
* precision loss. Furthermore, once processed by the Firestore backend, all
102+
* integer operations are capped between -2^63 and 2^63-1.
103103
*
104104
* If the current field value is not of type `number`, or if the field does not
105105
* yet exist, the transformation sets the field to the given value.

0 commit comments

Comments
 (0)