@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.
- package/dist/firestore/lite/index.d.ts +1 -0
- package/dist/firestore/src/api/transaction.d.ts +2 -1
- package/dist/firestore/src/api/transaction_options.d.ts +17 -0
- package/dist/firestore/src/api.d.ts +1 -0
- package/dist/firestore/src/core/firestore_client.d.ts +2 -1
- package/dist/firestore/src/core/transaction_options.d.ts +25 -0
- package/dist/firestore/src/core/transaction_runner.d.ts +3 -2
- package/dist/firestore/src/lite-api/transaction.d.ts +2 -1
- package/dist/firestore/src/lite-api/transaction_options.d.ts +23 -0
- package/dist/index.d.ts +24 -1
- package/dist/index.esm2017.js +95 -71
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +105 -82
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +36 -9
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +36 -9
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +241 -217
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +25 -1
- package/dist/lite/firestore/lite/index.d.ts +1 -0
- package/dist/lite/firestore/src/api/transaction.d.ts +2 -1
- package/dist/lite/firestore/src/api/transaction_options.d.ts +17 -0
- package/dist/lite/firestore/src/api.d.ts +1 -0
- package/dist/lite/firestore/src/core/firestore_client.d.ts +2 -1
- package/dist/lite/firestore/src/core/transaction_options.d.ts +25 -0
- package/dist/lite/firestore/src/core/transaction_runner.d.ts +3 -2
- package/dist/lite/firestore/src/lite-api/transaction.d.ts +2 -1
- package/dist/lite/firestore/src/lite-api/transaction_options.d.ts +23 -0
- package/dist/lite/index.browser.esm2017.js +180 -157
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +112 -110
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.d.ts +24 -1
- package/dist/lite/index.node.cjs.js +34 -7
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +34 -7
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +204 -181
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +25 -1
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +13 -13
- package/dist/lite/packages/firestore/lite/index.d.ts +1 -0
- package/dist/lite/packages/firestore/src/api/transaction.d.ts +2 -1
- package/dist/lite/packages/firestore/src/api/transaction_options.d.ts +17 -0
- package/dist/lite/packages/firestore/src/api.d.ts +1 -0
- package/dist/lite/packages/firestore/src/core/firestore_client.d.ts +2 -1
- package/dist/lite/packages/firestore/src/core/transaction_options.d.ts +25 -0
- package/dist/lite/packages/firestore/src/core/transaction_runner.d.ts +3 -2
- package/dist/lite/packages/firestore/src/lite-api/transaction.d.ts +2 -1
- package/dist/lite/packages/firestore/src/lite-api/transaction_options.d.ts +23 -0
- package/dist/lite/private.d.ts +25 -1
- package/dist/packages/firestore/dist/index.esm2017.d.ts +30 -29
- package/dist/packages/firestore/lite/index.d.ts +1 -0
- package/dist/packages/firestore/src/api/transaction.d.ts +2 -1
- package/dist/packages/firestore/src/api/transaction_options.d.ts +17 -0
- package/dist/packages/firestore/src/api.d.ts +1 -0
- package/dist/packages/firestore/src/core/firestore_client.d.ts +2 -1
- package/dist/packages/firestore/src/core/transaction_options.d.ts +25 -0
- package/dist/packages/firestore/src/core/transaction_runner.d.ts +3 -2
- package/dist/packages/firestore/src/lite-api/transaction.d.ts +2 -1
- package/dist/packages/firestore/src/lite-api/transaction_options.d.ts +23 -0
- package/dist/private.d.ts +25 -1
- package/package.json +10 -10
package/dist/index.node.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import * as grpc from '@grpc/grpc-js';
|
|
|
8
8
|
import * as protoLoader from '@grpc/proto-loader';
|
|
9
9
|
|
|
10
10
|
const name = "@firebase/firestore";
|
|
11
|
-
const version$1 = "3.4.8-canary.
|
|
11
|
+
const version$1 = "3.4.8-canary.6ceff4db0";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @license
|
|
@@ -61,7 +61,7 @@ User.GOOGLE_CREDENTIALS = new User('google-credentials-uid');
|
|
|
61
61
|
User.FIRST_PARTY = new User('first-party-uid');
|
|
62
62
|
User.MOCK_USER = new User('mock-user');
|
|
63
63
|
|
|
64
|
-
const version = "9.7.0-canary.
|
|
64
|
+
const version = "9.7.0-canary.6ceff4db0";
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
67
|
* @license
|
|
@@ -24029,18 +24029,18 @@ class Transaction$2 {
|
|
|
24029
24029
|
* See the License for the specific language governing permissions and
|
|
24030
24030
|
* limitations under the License.
|
|
24031
24031
|
*/
|
|
24032
|
-
const DEFAULT_MAX_ATTEMPTS_COUNT = 5;
|
|
24033
24032
|
/**
|
|
24034
24033
|
* TransactionRunner encapsulates the logic needed to run and retry transactions
|
|
24035
24034
|
* with backoff.
|
|
24036
24035
|
*/
|
|
24037
24036
|
class TransactionRunner {
|
|
24038
|
-
constructor(asyncQueue, datastore, updateFunction, deferred) {
|
|
24037
|
+
constructor(asyncQueue, datastore, options, updateFunction, deferred) {
|
|
24039
24038
|
this.asyncQueue = asyncQueue;
|
|
24040
24039
|
this.datastore = datastore;
|
|
24040
|
+
this.options = options;
|
|
24041
24041
|
this.updateFunction = updateFunction;
|
|
24042
24042
|
this.deferred = deferred;
|
|
24043
|
-
this.attemptsRemaining =
|
|
24043
|
+
this.attemptsRemaining = options.maxAttempts;
|
|
24044
24044
|
this.backoff = new ExponentialBackoff(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
|
|
24045
24045
|
}
|
|
24046
24046
|
/** Runs the transaction and sets the result on deferred. */
|
|
@@ -24398,11 +24398,11 @@ function firestoreClientAddSnapshotsInSyncListener(client, observer) {
|
|
|
24398
24398
|
* been committed. For this reason, it is required that all reads are
|
|
24399
24399
|
* performed before any writes. Transactions must be performed while online.
|
|
24400
24400
|
*/
|
|
24401
|
-
function firestoreClientTransaction(client, updateFunction) {
|
|
24401
|
+
function firestoreClientTransaction(client, updateFunction, options) {
|
|
24402
24402
|
const deferred = new Deferred();
|
|
24403
24403
|
client.asyncQueue.enqueueAndForget(async () => {
|
|
24404
24404
|
const datastore = await getDatastore(client);
|
|
24405
|
-
new TransactionRunner(client.asyncQueue, datastore, updateFunction, deferred).run();
|
|
24405
|
+
new TransactionRunner(client.asyncQueue, datastore, options, updateFunction, deferred).run();
|
|
24406
24406
|
});
|
|
24407
24407
|
return deferred.promise;
|
|
24408
24408
|
}
|
|
@@ -27602,6 +27602,31 @@ function validateOrderByAndInequalityMatch(baseQuery, inequality, orderBy) {
|
|
|
27602
27602
|
}
|
|
27603
27603
|
}
|
|
27604
27604
|
|
|
27605
|
+
/**
|
|
27606
|
+
* @license
|
|
27607
|
+
* Copyright 2022 Google LLC
|
|
27608
|
+
*
|
|
27609
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
27610
|
+
* you may not use this file except in compliance with the License.
|
|
27611
|
+
* You may obtain a copy of the License at
|
|
27612
|
+
*
|
|
27613
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
27614
|
+
*
|
|
27615
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
27616
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
27617
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
27618
|
+
* See the License for the specific language governing permissions and
|
|
27619
|
+
* limitations under the License.
|
|
27620
|
+
*/
|
|
27621
|
+
const DEFAULT_TRANSACTION_OPTIONS = {
|
|
27622
|
+
maxAttempts: 5
|
|
27623
|
+
};
|
|
27624
|
+
function validateTransactionOptions(options) {
|
|
27625
|
+
if (options.maxAttempts < 1) {
|
|
27626
|
+
throw new FirestoreError(Code.INVALID_ARGUMENT, 'Max attempts must be at least 1');
|
|
27627
|
+
}
|
|
27628
|
+
}
|
|
27629
|
+
|
|
27605
27630
|
/**
|
|
27606
27631
|
* @license
|
|
27607
27632
|
* Copyright 2020 Google LLC
|
|
@@ -28323,10 +28348,12 @@ class Transaction extends Transaction$1 {
|
|
|
28323
28348
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
28324
28349
|
* rejected promise with the corresponding failure error is returned.
|
|
28325
28350
|
*/
|
|
28326
|
-
function runTransaction(firestore, updateFunction) {
|
|
28351
|
+
function runTransaction(firestore, updateFunction, options) {
|
|
28327
28352
|
firestore = cast(firestore, Firestore);
|
|
28353
|
+
const optionsWithDefaults = Object.assign(Object.assign({}, DEFAULT_TRANSACTION_OPTIONS), options);
|
|
28354
|
+
validateTransactionOptions(optionsWithDefaults);
|
|
28328
28355
|
const client = ensureFirestoreConfigured(firestore);
|
|
28329
|
-
return firestoreClientTransaction(client, internalTransaction => updateFunction(new Transaction(firestore, internalTransaction)));
|
|
28356
|
+
return firestoreClientTransaction(client, internalTransaction => updateFunction(new Transaction(firestore, internalTransaction)), optionsWithDefaults);
|
|
28330
28357
|
}
|
|
28331
28358
|
|
|
28332
28359
|
/**
|