@firebase/firestore 3.4.8-canary.69baecadd → 3.4.8-canary.6ceff4db0

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 +95 -71
  12. package/dist/index.esm2017.js.map +1 -1
  13. package/dist/index.esm5.js +105 -82
  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 +241 -217
  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 +180 -157
  32. package/dist/lite/index.browser.esm2017.js.map +1 -1
  33. package/dist/lite/index.browser.esm5.js +112 -110
  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 +204 -181
  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 +13 -13
  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 +30 -29
  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
@@ -4520,7 +4520,7 @@ export declare class _ResourcePath extends BasePath<_ResourcePath> {
4520
4520
  * `updateFunction `is returned here. Otherwise, if the transaction failed, a
4521
4521
  * rejected promise with the corresponding failure error is returned.
4522
4522
  */
4523
- export declare function runTransaction<T>(firestore: Firestore, updateFunction: (transaction: Transaction) => Promise<T>): Promise<T>;
4523
+ export declare function runTransaction<T>(firestore: Firestore, updateFunction: (transaction: Transaction) => Promise<T>, options?: TransactionOptions): Promise<T>;
4524
4524
 
4525
4525
  /**
4526
4526
  * Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
@@ -5647,6 +5647,30 @@ declare class Transaction_3 {
5647
5647
  private ensureCommitNotCalled;
5648
5648
  }
5649
5649
 
5650
+ /**
5651
+ * @license
5652
+ * Copyright 2022 Google LLC
5653
+ *
5654
+ * Licensed under the Apache License, Version 2.0 (the "License");
5655
+ * you may not use this file except in compliance with the License.
5656
+ * You may obtain a copy of the License at
5657
+ *
5658
+ * http://www.apache.org/licenses/LICENSE-2.0
5659
+ *
5660
+ * Unless required by applicable law or agreed to in writing, software
5661
+ * distributed under the License is distributed on an "AS IS" BASIS,
5662
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5663
+ * See the License for the specific language governing permissions and
5664
+ * limitations under the License.
5665
+ */
5666
+ /**
5667
+ * Options to customize transaction behavior.
5668
+ */
5669
+ export declare interface TransactionOptions {
5670
+ /** Maximum number of attempts to commit, after which transaction fails. Default is 5. */
5671
+ readonly maxAttempts?: number;
5672
+ }
5673
+
5650
5674
  /** Used to represent a field transform on a mutation. */
5651
5675
  declare class TransformOperation {
5652
5676
  private _;
@@ -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
+ }