@firebase/firestore 3.4.8-canary.5ce067663 → 3.4.8-canary.63caee2a5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/firestore/lite/index.d.ts +1 -0
  2. package/dist/firestore/src/api/transaction.d.ts +2 -1
  3. package/dist/firestore/src/api/transaction_options.d.ts +17 -0
  4. package/dist/firestore/src/api.d.ts +1 -0
  5. package/dist/firestore/src/core/firestore_client.d.ts +2 -1
  6. package/dist/firestore/src/core/transaction_options.d.ts +25 -0
  7. package/dist/firestore/src/core/transaction_runner.d.ts +3 -2
  8. package/dist/firestore/src/lite-api/transaction.d.ts +2 -1
  9. package/dist/firestore/src/lite-api/transaction_options.d.ts +23 -0
  10. package/dist/index.d.ts +24 -1
  11. package/dist/index.esm2017.js +224 -200
  12. package/dist/index.esm2017.js.map +1 -1
  13. package/dist/index.esm5.js +158 -135
  14. package/dist/index.esm5.js.map +1 -1
  15. package/dist/index.node.cjs.js +36 -9
  16. package/dist/index.node.cjs.js.map +1 -1
  17. package/dist/index.node.mjs +36 -9
  18. package/dist/index.node.mjs.map +1 -1
  19. package/dist/index.rn.js +95 -71
  20. package/dist/index.rn.js.map +1 -1
  21. package/dist/internal.d.ts +25 -1
  22. package/dist/lite/firestore/lite/index.d.ts +1 -0
  23. package/dist/lite/firestore/src/api/transaction.d.ts +2 -1
  24. package/dist/lite/firestore/src/api/transaction_options.d.ts +17 -0
  25. package/dist/lite/firestore/src/api.d.ts +1 -0
  26. package/dist/lite/firestore/src/core/firestore_client.d.ts +2 -1
  27. package/dist/lite/firestore/src/core/transaction_options.d.ts +25 -0
  28. package/dist/lite/firestore/src/core/transaction_runner.d.ts +3 -2
  29. package/dist/lite/firestore/src/lite-api/transaction.d.ts +2 -1
  30. package/dist/lite/firestore/src/lite-api/transaction_options.d.ts +23 -0
  31. package/dist/lite/index.browser.esm2017.js +246 -223
  32. package/dist/lite/index.browser.esm2017.js.map +1 -1
  33. package/dist/lite/index.browser.esm5.js +118 -116
  34. package/dist/lite/index.browser.esm5.js.map +1 -1
  35. package/dist/lite/index.d.ts +24 -1
  36. package/dist/lite/index.node.cjs.js +34 -7
  37. package/dist/lite/index.node.cjs.js.map +1 -1
  38. package/dist/lite/index.node.mjs +34 -7
  39. package/dist/lite/index.node.mjs.map +1 -1
  40. package/dist/lite/index.rn.esm2017.js +127 -104
  41. package/dist/lite/index.rn.esm2017.js.map +1 -1
  42. package/dist/lite/internal.d.ts +25 -1
  43. package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +28 -28
  44. package/dist/lite/packages/firestore/lite/index.d.ts +1 -0
  45. package/dist/lite/packages/firestore/src/api/transaction.d.ts +2 -1
  46. package/dist/lite/packages/firestore/src/api/transaction_options.d.ts +17 -0
  47. package/dist/lite/packages/firestore/src/api.d.ts +1 -0
  48. package/dist/lite/packages/firestore/src/core/firestore_client.d.ts +2 -1
  49. package/dist/lite/packages/firestore/src/core/transaction_options.d.ts +25 -0
  50. package/dist/lite/packages/firestore/src/core/transaction_runner.d.ts +3 -2
  51. package/dist/lite/packages/firestore/src/lite-api/transaction.d.ts +2 -1
  52. package/dist/lite/packages/firestore/src/lite-api/transaction_options.d.ts +23 -0
  53. package/dist/lite/private.d.ts +25 -1
  54. package/dist/packages/firestore/dist/index.esm2017.d.ts +37 -36
  55. package/dist/packages/firestore/lite/index.d.ts +1 -0
  56. package/dist/packages/firestore/src/api/transaction.d.ts +2 -1
  57. package/dist/packages/firestore/src/api/transaction_options.d.ts +17 -0
  58. package/dist/packages/firestore/src/api.d.ts +1 -0
  59. package/dist/packages/firestore/src/core/firestore_client.d.ts +2 -1
  60. package/dist/packages/firestore/src/core/transaction_options.d.ts +25 -0
  61. package/dist/packages/firestore/src/core/transaction_runner.d.ts +3 -2
  62. package/dist/packages/firestore/src/lite-api/transaction.d.ts +2 -1
  63. package/dist/packages/firestore/src/lite-api/transaction_options.d.ts +23 -0
  64. package/dist/private.d.ts +25 -1
  65. package/package.json +10 -10
@@ -2110,7 +2110,7 @@ declare class ResourcePath extends BasePath<ResourcePath> {
2110
2110
  * `updateFunction `is returned here. Otherwise, if the transaction failed, a
2111
2111
  * rejected promise with the corresponding failure error is returned.
2112
2112
  */
2113
- export declare function runTransaction<T>(firestore: Firestore, updateFunction: (transaction: Transaction) => Promise<T>): Promise<T>;
2113
+ export declare function runTransaction<T>(firestore: Firestore, updateFunction: (transaction: Transaction) => Promise<T>, options?: TransactionOptions): Promise<T>;
2114
2114
 
2115
2115
  /**
2116
2116
  * Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
@@ -2615,6 +2615,30 @@ declare class Transaction_2 {
2615
2615
  private ensureCommitNotCalled;
2616
2616
  }
2617
2617
 
2618
+ /**
2619
+ * @license
2620
+ * Copyright 2022 Google LLC
2621
+ *
2622
+ * Licensed under the Apache License, Version 2.0 (the "License");
2623
+ * you may not use this file except in compliance with the License.
2624
+ * You may obtain a copy of the License at
2625
+ *
2626
+ * http://www.apache.org/licenses/LICENSE-2.0
2627
+ *
2628
+ * Unless required by applicable law or agreed to in writing, software
2629
+ * distributed under the License is distributed on an "AS IS" BASIS,
2630
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2631
+ * See the License for the specific language governing permissions and
2632
+ * limitations under the License.
2633
+ */
2634
+ /**
2635
+ * Options to customize transaction behavior.
2636
+ */
2637
+ export declare interface TransactionOptions {
2638
+ /** Maximum number of attempts to commit, after which transaction fails. Default is 5. */
2639
+ readonly maxAttempts?: number;
2640
+ }
2641
+
2618
2642
  /** Used to represent a field transform on a mutation. */
2619
2643
  declare class TransformOperation {
2620
2644
  private _;
@@ -243,7 +243,7 @@ declare class an {
243
243
  /**
244
244
  * Sentinel values that can be used when writing document fields with `set()`
245
245
  * or `update()`.
246
- */ declare class vn {
246
+ */ declare class bn {
247
247
  /**
248
248
  * @param _methodName - The public API endpoint that returns this class.
249
249
  * @hideconstructor
@@ -335,7 +335,7 @@ declare class an {
335
335
  *
336
336
  * Latitude values are in the range of [-90, 90].
337
337
  * Longitude values are in the range of [-180, 180].
338
- */ declare class bn {
338
+ */ declare class vn {
339
339
  /**
340
340
  * Creates a new immutable `GeoPoint` object with the provided latitude and
341
341
  * longitude values.
@@ -536,7 +536,7 @@ declare class gt {
536
536
  * to be compared using the `>`, `<=`, `>=` and `>` operators.
537
537
  */ valueOf(): string;
538
538
  }
539
- declare class Ur {
539
+ declare class kr {
540
540
  /** @hideconstructor */
541
541
  constructor(t: any, e: any);
542
542
  _firestore: any;
@@ -548,14 +548,14 @@ declare class Ur {
548
548
  * @param documentRef - A reference to the document to be read.
549
549
  * @returns A `DocumentSnapshot` with the read data.
550
550
  */ get(t: any): any;
551
- set(t: any, e: any, n: any): Ur;
552
- update(t: any, e: any, n: any, ...r: any[]): Ur;
551
+ set(t: any, e: any, n: any): kr;
552
+ update(t: any, e: any, n: any, ...r: any[]): kr;
553
553
  /**
554
554
  * Deletes the document referred to by the provided {@link DocumentReference}.
555
555
  *
556
556
  * @param documentRef - A reference to the document to be deleted.
557
557
  * @returns This `Transaction` instance. Used for chaining method calls.
558
- */ delete(t: any): Ur;
558
+ */ delete(t: any): kr;
559
559
  }
560
560
  /**
561
561
  * @license
@@ -624,7 +624,7 @@ declare class Ur {
624
624
  * @throws Error - If the provided input is not a valid Firestore document.
625
625
  * @returns A `Promise` resolved with a `DocumentReference` pointing to the
626
626
  * newly created document after it has been written to the backend.
627
- */ declare function Ar(t: any, e: any): Promise<an>;
627
+ */ declare function Ir(t: any, e: any): Promise<an>;
628
628
  /**
629
629
  * Returns a special value that can be used with {@link (setDoc:1)} or {@link
630
630
  * updateDoc:1} that tells the server to remove the given elements from any
@@ -635,7 +635,7 @@ declare class Ur {
635
635
  * @param elements - The elements to remove from the array.
636
636
  * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
637
637
  * `updateDoc()`
638
- */ declare function Dr(...t: any[]): xn;
638
+ */ declare function Dr(...t: any[]): Fn;
639
639
  /**
640
640
  * Returns a special value that can be used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link
641
641
  * @firebase/firestore/lite#(updateDoc:1)} that tells the server to union the given elements with any array
@@ -647,7 +647,7 @@ declare class Ur {
647
647
  * @param elements - The elements to union into the array.
648
648
  * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
649
649
  * `updateDoc()`.
650
- */ declare function Vr(...t: any[]): Fn;
650
+ */ declare function Vr(...t: any[]): xn;
651
651
  declare function fn(t: any, e: any, ...n: any[]): ln;
652
652
  /**
653
653
  * Creates and returns a new `Query` instance that includes all documents in the
@@ -684,7 +684,7 @@ declare function fn(t: any, e: any, ...n: any[]): ln;
684
684
  * @param reference - A reference to the document to delete.
685
685
  * @returns A `Promise` resolved once the document has been successfully
686
686
  * deleted from the backend.
687
- */ declare function Ir(t: any): Promise<void>;
687
+ */ declare function Ar(t: any): Promise<void>;
688
688
  /**
689
689
  * @license
690
690
  * Copyright 2020 Google LLC
@@ -724,7 +724,7 @@ declare function fr(...t: any[]): lr;
724
724
  * @param reference - The reference of the document to fetch.
725
725
  * @returns A Promise resolved with a `DocumentSnapshot` containing the current
726
726
  * document contents.
727
- */ declare function vr(t: any): Promise<Yn>;
727
+ */ declare function br(t: any): Promise<Yn>;
728
728
  /**
729
729
  * Executes the query and returns the results as a {@link QuerySnapshot}.
730
730
  *
@@ -736,7 +736,7 @@ declare function fr(...t: any[]): lr;
736
736
  *
737
737
  * @param query - The `Query` to execute.
738
738
  * @returns A Promise that will be resolved with the results of the query.
739
- */ declare function br(t: any): Promise<Kn>;
739
+ */ declare function vr(t: any): Promise<Kn>;
740
740
  /**
741
741
  * Returns the existing `Firestore` instance that is associated with the
742
742
  * provided {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
@@ -832,7 +832,7 @@ declare function sn(t: any, e: any): import("../../lite").Firestore;
832
832
  * (the `updateFunction` returned a failed promise), the promise returned by the
833
833
  * `updateFunction `is returned here. Otherwise, if the transaction failed, a
834
834
  * rejected promise with the corresponding failure error is returned.
835
- */ declare function kr(t: any, e: any): Promise<any>;
835
+ */ declare function jr(t: any, e: any, n: any): Promise<any>;
836
836
  /**
837
837
  * Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
838
838
  * include a server-generated timestamp in the written data.
@@ -904,7 +904,7 @@ declare function Tr(t: any, e: any, n: any, ...r: any[]): Promise<void>;
904
904
  *
905
905
  * @returns A `WriteBatch` that can be used to atomically execute multiple
906
906
  * writes.
907
- */ declare function Fr(t: any): $r;
907
+ */ declare function xr(t: any): $r;
908
908
  /**
909
909
  * A dot-separated path for navigating sub-objects within a document.
910
910
  * @internal
@@ -979,40 +979,40 @@ import { FirebaseError as c } from "@firebase/util/dist/src/errors";
979
979
  q: any;
980
980
  /** Creates a new top-level parse context. */ ht(t: any, e: any, n: any, r?: boolean): Rn;
981
981
  }
982
- declare class xn extends vn {
982
+ declare class Fn extends bn {
983
983
  constructor(t: any, e: any);
984
984
  lt: any;
985
- _toFieldTransform(t: any): ve;
985
+ _toFieldTransform(t: any): be;
986
986
  isEqual(t: any): boolean;
987
987
  }
988
- declare class Fn extends vn {
988
+ declare class xn extends bn {
989
989
  constructor(t: any, e: any);
990
990
  lt: any;
991
- _toFieldTransform(t: any): ve;
991
+ _toFieldTransform(t: any): be;
992
992
  isEqual(t: any): boolean;
993
993
  }
994
- declare class Nn extends vn {
994
+ declare class Nn extends bn {
995
995
  _toFieldTransform(t: any): null;
996
996
  isEqual(t: any): boolean;
997
997
  }
998
998
  declare class lr extends Zn {
999
999
  constructor(t: any, e: any, n: any);
1000
1000
  type: any;
1001
- bt: any;
1001
+ vt: any;
1002
1002
  Et: any;
1003
1003
  _apply(t: any): hn;
1004
1004
  }
1005
- declare class qn extends vn {
1005
+ declare class qn extends bn {
1006
1006
  constructor(t: any, e: any);
1007
1007
  ft: any;
1008
- _toFieldTransform(t: any): ve;
1008
+ _toFieldTransform(t: any): be;
1009
1009
  isEqual(t: any): boolean;
1010
1010
  }
1011
1011
  declare class ir extends Zn {
1012
1012
  constructor(t: any, e: any, n: any);
1013
1013
  type: any;
1014
1014
  gt: any;
1015
- vt: any;
1015
+ bt: any;
1016
1016
  _apply(t: any): hn;
1017
1017
  }
1018
1018
  declare class rr extends Zn {
@@ -1022,14 +1022,14 @@ declare class rr extends Zn {
1022
1022
  type: string;
1023
1023
  _apply(t: any): hn;
1024
1024
  }
1025
- declare class Sn extends vn {
1026
- _toFieldTransform(t: any): ve;
1025
+ declare class Sn extends bn {
1026
+ _toFieldTransform(t: any): be;
1027
1027
  isEqual(t: any): boolean;
1028
1028
  }
1029
1029
  declare class cr extends Zn {
1030
1030
  constructor(t: any, e: any, n: any);
1031
1031
  type: any;
1032
- bt: any;
1032
+ vt: any;
1033
1033
  Et: any;
1034
1034
  _apply(t: any): hn;
1035
1035
  }
@@ -1134,9 +1134,9 @@ declare class J {
1134
1134
  * See the License for the specific language governing permissions and
1135
1135
  * limitations under the License.
1136
1136
  */
1137
- /** A field path and the TransformOperation to perform upon it. */ declare class ve {
1137
+ /** A field path and the TransformOperation to perform upon it. */ declare class be {
1138
1138
  constructor(t: any, e: any);
1139
1139
  field: any;
1140
1140
  transform: any;
1141
1141
  }
1142
- export { gn as Bytes, ln as CollectionReference, an as DocumentReference, Yn as DocumentSnapshot, yn as FieldPath, vn as FieldValue, rn as Firestore, U as FirestoreError, bn as GeoPoint, hn as Query, Zn as QueryConstraint, Hn as QueryDocumentSnapshot, Kn as QuerySnapshot, gt as Timestamp, Ur as Transaction, $r as WriteBatch, Ar as addDoc, Dr as arrayRemove, Vr as arrayUnion, fn as collection, dn as collectionGroup, un as connectFirestoreEmulator, Ir as deleteDoc, Rr as deleteField, wn as doc, _n as documentId, dr as endAt, fr as endBefore, vr as getDoc, br as getDocs, on as getFirestore, Nr as increment, sn as initializeFirestore, or as limit, ur as limitToLast, sr as orderBy, tr as query, pn as queryEqual, mn as refEqual, kr as runTransaction, Pr as serverTimestamp, Er as setDoc, w as setLogLevel, Jn as snapshotEqual, hr as startAfter, ar as startAt, cn as terminate, Tr as updateDoc, nr as where, Fr as writeBatch };
1142
+ export { gn as Bytes, ln as CollectionReference, an as DocumentReference, Yn as DocumentSnapshot, yn as FieldPath, bn as FieldValue, rn as Firestore, U as FirestoreError, vn as GeoPoint, hn as Query, Zn as QueryConstraint, Hn as QueryDocumentSnapshot, Kn as QuerySnapshot, gt as Timestamp, kr as Transaction, $r as WriteBatch, Ir as addDoc, Dr as arrayRemove, Vr as arrayUnion, fn as collection, dn as collectionGroup, un as connectFirestoreEmulator, Ar as deleteDoc, Rr as deleteField, wn as doc, _n as documentId, dr as endAt, fr as endBefore, br as getDoc, vr as getDocs, on as getFirestore, Nr as increment, sn as initializeFirestore, or as limit, ur as limitToLast, sr as orderBy, tr as query, pn as queryEqual, mn as refEqual, jr as runTransaction, Pr as serverTimestamp, Er as setDoc, w as setLogLevel, Jn as snapshotEqual, hr as startAfter, ar as startAt, cn as terminate, Tr as updateDoc, nr as where, xr as writeBatch };
@@ -17,6 +17,7 @@ export { FieldValue } from '../src/lite-api/field_value';
17
17
  export { increment, arrayRemove, arrayUnion, serverTimestamp, deleteField } from '../src/lite-api/field_value_impl';
18
18
  export { FirestoreDataConverter, DocumentSnapshot, QueryDocumentSnapshot, QuerySnapshot, snapshotEqual } from '../src/lite-api/snapshot';
19
19
  export { WriteBatch, writeBatch } from '../src/lite-api/write_batch';
20
+ export { TransactionOptions } from '../src/lite-api/transaction_options';
20
21
  export { Transaction, runTransaction } from '../src/lite-api/transaction';
21
22
  export { setLogLevel, LogLevelString as LogLevel } from '../src/util/log';
22
23
  export { Bytes } from '../src/lite-api/bytes';
@@ -19,6 +19,7 @@ import { DocumentReference } from '../lite-api/reference';
19
19
  import { Transaction as LiteTransaction } from '../lite-api/transaction';
20
20
  import { Firestore } from './database';
21
21
  import { DocumentSnapshot } from './snapshot';
22
+ import { TransactionOptions } from './transaction_options';
22
23
  /**
23
24
  * A reference to a transaction.
24
25
  *
@@ -55,4 +56,4 @@ export declare class Transaction extends LiteTransaction {
55
56
  * `updateFunction `is returned here. Otherwise, if the transaction failed, a
56
57
  * rejected promise with the corresponding failure error is returned.
57
58
  */
58
- export declare function runTransaction<T>(firestore: Firestore, updateFunction: (transaction: Transaction) => Promise<T>): Promise<T>;
59
+ export declare function runTransaction<T>(firestore: Firestore, updateFunction: (transaction: Transaction) => Promise<T>, options?: TransactionOptions): Promise<T>;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ export { TransactionOptions } from '../lite-api/transaction_options';
@@ -22,6 +22,7 @@ export { DocumentChange, DocumentSnapshot, QueryDocumentSnapshot, QuerySnapshot,
22
22
  export { DocumentReference, CollectionReference, Query, doc, collection, collectionGroup, SetOptions, DocumentData, UpdateData, WithFieldValue, PartialWithFieldValue, refEqual, queryEqual } from './api/reference';
23
23
  export { endAt, endBefore, startAt, startAfter, limit, limitToLast, where, orderBy, query, QueryConstraint, QueryConstraintType, OrderByDirection, WhereFilterOp } from './api/filter';
24
24
  export { Unsubscribe, SnapshotListenOptions } from './api/reference_impl';
25
+ export { TransactionOptions } from './api/transaction_options';
25
26
  export { runTransaction, Transaction } from './api/transaction';
26
27
  export { getDoc, getDocFromCache, getDocFromServer, getDocs, getDocsFromCache, getDocsFromServer, onSnapshot, onSnapshotsInSync, setDoc, updateDoc, deleteDoc, addDoc, executeWrite } from './api/reference_impl';
27
28
  export { FieldValue } from './api/field_value';
@@ -30,6 +30,7 @@ import { EventManager, ListenOptions, Observer } from './event_manager';
30
30
  import { Query } from './query';
31
31
  import { SyncEngine } from './sync_engine';
32
32
  import { Transaction } from './transaction';
33
+ import { TransactionOptions } from './transaction_options';
33
34
  import { ViewSnapshot } from './view_snapshot';
34
35
  export declare const MAX_CONCURRENT_LIMBO_RESOLUTIONS = 100;
35
36
  /**
@@ -113,6 +114,6 @@ export declare function firestoreClientAddSnapshotsInSyncListener(client: Firest
113
114
  * been committed. For this reason, it is required that all reads are
114
115
  * performed before any writes. Transactions must be performed while online.
115
116
  */
116
- export declare function firestoreClientTransaction<T>(client: FirestoreClient, updateFunction: (transaction: Transaction) => Promise<T>): Promise<T>;
117
+ export declare function firestoreClientTransaction<T>(client: FirestoreClient, updateFunction: (transaction: Transaction) => Promise<T>, options: TransactionOptions): Promise<T>;
117
118
  export declare function firestoreClientLoadBundle(client: FirestoreClient, databaseId: DatabaseId, data: ReadableStream<Uint8Array> | ArrayBuffer | string, resultTask: LoadBundleTask): void;
118
119
  export declare function firestoreClientGetNamedQuery(client: FirestoreClient, queryName: string): Promise<NamedQuery | undefined>;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ export declare const DEFAULT_TRANSACTION_OPTIONS: TransactionOptions;
18
+ /**
19
+ * Options to customize transaction behavior.
20
+ */
21
+ export declare interface TransactionOptions {
22
+ /** Maximum number of attempts to commit, after which transaction fails. Default is 5. */
23
+ readonly maxAttempts: number;
24
+ }
25
+ export declare function validateTransactionOptions(options: TransactionOptions): void;
@@ -18,7 +18,7 @@ import { Datastore } from '../remote/datastore';
18
18
  import { AsyncQueue } from '../util/async_queue';
19
19
  import { Deferred } from '../util/promise';
20
20
  import { Transaction } from './transaction';
21
- export declare const DEFAULT_MAX_ATTEMPTS_COUNT = 5;
21
+ import { TransactionOptions } from './transaction_options';
22
22
  /**
23
23
  * TransactionRunner encapsulates the logic needed to run and retry transactions
24
24
  * with backoff.
@@ -26,11 +26,12 @@ export declare const DEFAULT_MAX_ATTEMPTS_COUNT = 5;
26
26
  export declare class TransactionRunner<T> {
27
27
  private readonly asyncQueue;
28
28
  private readonly datastore;
29
+ private readonly options;
29
30
  private readonly updateFunction;
30
31
  private readonly deferred;
31
32
  private attemptsRemaining;
32
33
  private backoff;
33
- constructor(asyncQueue: AsyncQueue, datastore: Datastore, updateFunction: (transaction: Transaction) => Promise<T>, deferred: Deferred<T>);
34
+ constructor(asyncQueue: AsyncQueue, datastore: Datastore, options: TransactionOptions, updateFunction: (transaction: Transaction) => Promise<T>, deferred: Deferred<T>);
34
35
  /** Runs the transaction and sets the result on deferred. */
35
36
  run(): void;
36
37
  private runWithBackOff;
@@ -19,6 +19,7 @@ import { Firestore } from './database';
19
19
  import { FieldPath } from './field_path';
20
20
  import { DocumentReference, PartialWithFieldValue, SetOptions, UpdateData, WithFieldValue } from './reference';
21
21
  import { DocumentSnapshot } from './snapshot';
22
+ import { TransactionOptions } from './transaction_options';
22
23
  /**
23
24
  * A reference to a transaction.
24
25
  *
@@ -116,4 +117,4 @@ export declare class Transaction {
116
117
  * `updateFunction `is returned here. Otherwise, if the transaction failed, a
117
118
  * rejected promise with the corresponding failure error is returned.
118
119
  */
119
- export declare function runTransaction<T>(firestore: Firestore, updateFunction: (transaction: Transaction) => Promise<T>): Promise<T>;
120
+ export declare function runTransaction<T>(firestore: Firestore, updateFunction: (transaction: Transaction) => Promise<T>, options?: TransactionOptions): Promise<T>;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * Options to customize transaction behavior.
19
+ */
20
+ export declare interface TransactionOptions {
21
+ /** Maximum number of attempts to commit, after which transaction fails. Default is 5. */
22
+ readonly maxAttempts?: number;
23
+ }
@@ -1970,7 +1970,7 @@ export declare function refEqual<T>(left: DocumentReference<T> | CollectionRefer
1970
1970
  * `updateFunction `is returned here. Otherwise, if the transaction failed, a
1971
1971
  * rejected promise with the corresponding failure error is returned.
1972
1972
  */
1973
- export declare function runTransaction<T>(firestore: Firestore, updateFunction: (transaction: Transaction) => Promise<T>): Promise<T>;
1973
+ export declare function runTransaction<T>(firestore: Firestore, updateFunction: (transaction: Transaction) => Promise<T>, options?: TransactionOptions): Promise<T>;
1974
1974
 
1975
1975
  /**
1976
1976
  * Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
@@ -2475,6 +2475,30 @@ declare class Transaction_2 {
2475
2475
  private ensureCommitNotCalled;
2476
2476
  }
2477
2477
 
2478
+ /**
2479
+ * @license
2480
+ * Copyright 2022 Google LLC
2481
+ *
2482
+ * Licensed under the Apache License, Version 2.0 (the "License");
2483
+ * you may not use this file except in compliance with the License.
2484
+ * You may obtain a copy of the License at
2485
+ *
2486
+ * http://www.apache.org/licenses/LICENSE-2.0
2487
+ *
2488
+ * Unless required by applicable law or agreed to in writing, software
2489
+ * distributed under the License is distributed on an "AS IS" BASIS,
2490
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2491
+ * See the License for the specific language governing permissions and
2492
+ * limitations under the License.
2493
+ */
2494
+ /**
2495
+ * Options to customize transaction behavior.
2496
+ */
2497
+ export declare interface TransactionOptions {
2498
+ /** Maximum number of attempts to commit, after which transaction fails. Default is 5. */
2499
+ readonly maxAttempts?: number;
2500
+ }
2501
+
2478
2502
  /** Used to represent a field transform on a mutation. */
2479
2503
  declare class TransformOperation {
2480
2504
  private _;