@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
@@ -33,7 +33,7 @@ var grpc__namespace = /*#__PURE__*/_interopNamespace(grpc);
33
33
  var protoLoader__namespace = /*#__PURE__*/_interopNamespace(protoLoader);
34
34
 
35
35
  const name = "@firebase/firestore";
36
- const version$1 = "3.4.8-canary.69baecadd";
36
+ const version$1 = "3.4.8-canary.6ceff4db0";
37
37
 
38
38
  /**
39
39
  * @license
@@ -86,7 +86,7 @@ User.GOOGLE_CREDENTIALS = new User('google-credentials-uid');
86
86
  User.FIRST_PARTY = new User('first-party-uid');
87
87
  User.MOCK_USER = new User('mock-user');
88
88
 
89
- const version = "9.7.0-canary.69baecadd";
89
+ const version = "9.7.0-canary.6ceff4db0";
90
90
 
91
91
  /**
92
92
  * @license
@@ -24054,18 +24054,18 @@ class Transaction$2 {
24054
24054
  * See the License for the specific language governing permissions and
24055
24055
  * limitations under the License.
24056
24056
  */
24057
- const DEFAULT_MAX_ATTEMPTS_COUNT = 5;
24058
24057
  /**
24059
24058
  * TransactionRunner encapsulates the logic needed to run and retry transactions
24060
24059
  * with backoff.
24061
24060
  */
24062
24061
  class TransactionRunner {
24063
- constructor(asyncQueue, datastore, updateFunction, deferred) {
24062
+ constructor(asyncQueue, datastore, options, updateFunction, deferred) {
24064
24063
  this.asyncQueue = asyncQueue;
24065
24064
  this.datastore = datastore;
24065
+ this.options = options;
24066
24066
  this.updateFunction = updateFunction;
24067
24067
  this.deferred = deferred;
24068
- this.attemptsRemaining = DEFAULT_MAX_ATTEMPTS_COUNT;
24068
+ this.attemptsRemaining = options.maxAttempts;
24069
24069
  this.backoff = new ExponentialBackoff(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
24070
24070
  }
24071
24071
  /** Runs the transaction and sets the result on deferred. */
@@ -24423,11 +24423,11 @@ function firestoreClientAddSnapshotsInSyncListener(client, observer) {
24423
24423
  * been committed. For this reason, it is required that all reads are
24424
24424
  * performed before any writes. Transactions must be performed while online.
24425
24425
  */
24426
- function firestoreClientTransaction(client, updateFunction) {
24426
+ function firestoreClientTransaction(client, updateFunction, options) {
24427
24427
  const deferred = new Deferred();
24428
24428
  client.asyncQueue.enqueueAndForget(async () => {
24429
24429
  const datastore = await getDatastore(client);
24430
- new TransactionRunner(client.asyncQueue, datastore, updateFunction, deferred).run();
24430
+ new TransactionRunner(client.asyncQueue, datastore, options, updateFunction, deferred).run();
24431
24431
  });
24432
24432
  return deferred.promise;
24433
24433
  }
@@ -27627,6 +27627,31 @@ function validateOrderByAndInequalityMatch(baseQuery, inequality, orderBy) {
27627
27627
  }
27628
27628
  }
27629
27629
 
27630
+ /**
27631
+ * @license
27632
+ * Copyright 2022 Google LLC
27633
+ *
27634
+ * Licensed under the Apache License, Version 2.0 (the "License");
27635
+ * you may not use this file except in compliance with the License.
27636
+ * You may obtain a copy of the License at
27637
+ *
27638
+ * http://www.apache.org/licenses/LICENSE-2.0
27639
+ *
27640
+ * Unless required by applicable law or agreed to in writing, software
27641
+ * distributed under the License is distributed on an "AS IS" BASIS,
27642
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
27643
+ * See the License for the specific language governing permissions and
27644
+ * limitations under the License.
27645
+ */
27646
+ const DEFAULT_TRANSACTION_OPTIONS = {
27647
+ maxAttempts: 5
27648
+ };
27649
+ function validateTransactionOptions(options) {
27650
+ if (options.maxAttempts < 1) {
27651
+ throw new FirestoreError(Code.INVALID_ARGUMENT, 'Max attempts must be at least 1');
27652
+ }
27653
+ }
27654
+
27630
27655
  /**
27631
27656
  * @license
27632
27657
  * Copyright 2020 Google LLC
@@ -28348,10 +28373,12 @@ class Transaction extends Transaction$1 {
28348
28373
  * `updateFunction `is returned here. Otherwise, if the transaction failed, a
28349
28374
  * rejected promise with the corresponding failure error is returned.
28350
28375
  */
28351
- function runTransaction(firestore, updateFunction) {
28376
+ function runTransaction(firestore, updateFunction, options) {
28352
28377
  firestore = cast(firestore, Firestore);
28378
+ const optionsWithDefaults = Object.assign(Object.assign({}, DEFAULT_TRANSACTION_OPTIONS), options);
28379
+ validateTransactionOptions(optionsWithDefaults);
28353
28380
  const client = ensureFirestoreConfigured(firestore);
28354
- return firestoreClientTransaction(client, internalTransaction => updateFunction(new Transaction(firestore, internalTransaction)));
28381
+ return firestoreClientTransaction(client, internalTransaction => updateFunction(new Transaction(firestore, internalTransaction)), optionsWithDefaults);
28355
28382
  }
28356
28383
 
28357
28384
  /**