@firebase/firestore 4.3.1 → 4.3.2-20231027003707
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/test/integration/util/composite_index_test_helper.d.ts +2 -1
- package/dist/index.cjs.js +293 -292
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm2017.js +294 -293
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +3054 -3053
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +2 -2
- package/dist/index.node.mjs +2 -2
- package/dist/index.rn.js +299 -298
- package/dist/index.rn.js.map +1 -1
- package/dist/lite/firestore/test/integration/util/composite_index_test_helper.d.ts +2 -1
- package/dist/lite/index.browser.esm2017.js +2 -2
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +2 -2
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.cjs.js +2 -2
- package/dist/lite/index.cjs.js.map +1 -1
- package/dist/lite/index.node.cjs.js +2 -2
- package/dist/lite/index.node.mjs +2 -2
- package/dist/lite/index.rn.esm2017.js +2 -2
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/packages/firestore/test/integration/util/composite_index_test_helper.d.ts +2 -1
- package/dist/packages/firestore/dist/index.esm2017.d.ts +2 -2
- package/dist/packages/firestore/test/integration/util/composite_index_test_helper.d.ts +2 -1
- package/package.json +2 -2
package/dist/index.esm2017.js
CHANGED
|
@@ -2,9 +2,9 @@ import { _registerComponent, registerVersion, _getProvider, getApp, _removeServi
|
|
|
2
2
|
import { Component } from '@firebase/component';
|
|
3
3
|
import { Logger, LogLevel } from '@firebase/logger';
|
|
4
4
|
import { FirebaseError, createMockUserToken, getModularInstance, deepEqual, getDefaultEmulatorHostnameAndPort, getUA, isIndexedDBAvailable, isSafari } from '@firebase/util';
|
|
5
|
-
import { Integer, XhrIo, EventType, ErrorCode, createWebChannelTransport, getStatEventTarget, WebChannel, Event, Stat, Md5 } from '@firebase/webchannel-wrapper';
|
|
5
|
+
import { Integer, XhrIo, EventType, ErrorCode, createWebChannelTransport, getStatEventTarget, FetchXmlHttpFactory, WebChannel, Event, Stat, Md5 } from '@firebase/webchannel-wrapper';
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const S = "@firebase/firestore";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @license
|
|
@@ -66,7 +66,7 @@ User.MOCK_USER = new User("mock-user");
|
|
|
66
66
|
* See the License for the specific language governing permissions and
|
|
67
67
|
* limitations under the License.
|
|
68
68
|
*/
|
|
69
|
-
let
|
|
69
|
+
let b = "10.5.2-20231027003707";
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* @license
|
|
@@ -84,11 +84,11 @@ let S = "10.5.1";
|
|
|
84
84
|
* See the License for the specific language governing permissions and
|
|
85
85
|
* limitations under the License.
|
|
86
86
|
*/
|
|
87
|
-
const
|
|
87
|
+
const D = new Logger("@firebase/firestore");
|
|
88
88
|
|
|
89
89
|
// Helper methods are needed because variables can't be exported as read/write
|
|
90
90
|
function __PRIVATE_getLogLevel() {
|
|
91
|
-
return
|
|
91
|
+
return D.logLevel;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
/**
|
|
@@ -104,29 +104,29 @@ function __PRIVATE_getLogLevel() {
|
|
|
104
104
|
* <li><code>`silent` to turn off logging.</li>
|
|
105
105
|
* </ul>
|
|
106
106
|
*/ function setLogLevel(e) {
|
|
107
|
-
|
|
107
|
+
D.setLogLevel(e);
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
function __PRIVATE_logDebug(e, ...t) {
|
|
111
|
-
if (
|
|
111
|
+
if (D.logLevel <= LogLevel.DEBUG) {
|
|
112
112
|
const n = t.map(__PRIVATE_argToString);
|
|
113
|
-
|
|
113
|
+
D.debug(`Firestore (${b}): ${e}`, ...n);
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
function __PRIVATE_logError(e, ...t) {
|
|
118
|
-
if (
|
|
118
|
+
if (D.logLevel <= LogLevel.ERROR) {
|
|
119
119
|
const n = t.map(__PRIVATE_argToString);
|
|
120
|
-
|
|
120
|
+
D.error(`Firestore (${b}): ${e}`, ...n);
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
/**
|
|
125
125
|
* @internal
|
|
126
126
|
*/ function __PRIVATE_logWarn(e, ...t) {
|
|
127
|
-
if (
|
|
127
|
+
if (D.logLevel <= LogLevel.WARN) {
|
|
128
128
|
const n = t.map(__PRIVATE_argToString);
|
|
129
|
-
|
|
129
|
+
D.warn(`Firestore (${b}): ${e}`, ...n);
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
|
|
@@ -187,7 +187,7 @@ function __PRIVATE_logError(e, ...t) {
|
|
|
187
187
|
*/ function fail(e = "Unexpected state") {
|
|
188
188
|
// Log the failure in addition to throw an exception, just in case the
|
|
189
189
|
// exception is swallowed.
|
|
190
|
-
const t = `FIRESTORE (${
|
|
190
|
+
const t = `FIRESTORE (${b}) INTERNAL ASSERTION FAILED: ` + e;
|
|
191
191
|
// NOTE: We don't use FirestoreError here because these are internal failures
|
|
192
192
|
// that cannot be handled by the user. (Also it would create a circular
|
|
193
193
|
// dependency between the error and assert modules which doesn't work.)
|
|
@@ -240,7 +240,7 @@ t) {
|
|
|
240
240
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
241
241
|
* See the License for the specific language governing permissions and
|
|
242
242
|
* limitations under the License.
|
|
243
|
-
*/ const
|
|
243
|
+
*/ const C = {
|
|
244
244
|
// Causes are copied from:
|
|
245
245
|
// https://github.com/grpc/grpc/blob/bceec94ea4fc5f0085d81235d8e1c06798dc341a/include/grpc%2B%2B/impl/codegen/status_code_enum.h
|
|
246
246
|
/** Not an error; returned on success. */
|
|
@@ -785,11 +785,11 @@ class Timestamp {
|
|
|
785
785
|
* The fractions of a second at nanosecond resolution.*
|
|
786
786
|
*/
|
|
787
787
|
t) {
|
|
788
|
-
if (this.seconds = e, this.nanoseconds = t, t < 0) throw new FirestoreError(
|
|
789
|
-
if (t >= 1e9) throw new FirestoreError(
|
|
790
|
-
if (e < -62135596800) throw new FirestoreError(
|
|
788
|
+
if (this.seconds = e, this.nanoseconds = t, t < 0) throw new FirestoreError(C.INVALID_ARGUMENT, "Timestamp nanoseconds out of range: " + t);
|
|
789
|
+
if (t >= 1e9) throw new FirestoreError(C.INVALID_ARGUMENT, "Timestamp nanoseconds out of range: " + t);
|
|
790
|
+
if (e < -62135596800) throw new FirestoreError(C.INVALID_ARGUMENT, "Timestamp seconds out of range: " + e);
|
|
791
791
|
// This will break in the year 10,000.
|
|
792
|
-
if (e >= 253402300800) throw new FirestoreError(
|
|
792
|
+
if (e >= 253402300800) throw new FirestoreError(C.INVALID_ARGUMENT, "Timestamp seconds out of range: " + e);
|
|
793
793
|
}
|
|
794
794
|
/**
|
|
795
795
|
* Creates a new timestamp with the current date, with millisecond precision.
|
|
@@ -1037,7 +1037,7 @@ class BasePath {
|
|
|
1037
1037
|
// for legacy reasons and should not be used frequently).
|
|
1038
1038
|
const t = [];
|
|
1039
1039
|
for (const n of e) {
|
|
1040
|
-
if (n.indexOf("//") >= 0) throw new FirestoreError(
|
|
1040
|
+
if (n.indexOf("//") >= 0) throw new FirestoreError(C.INVALID_ARGUMENT, `Invalid segment (${n}). Paths must not contain // in them.`);
|
|
1041
1041
|
// Strip leading and traling slashed.
|
|
1042
1042
|
t.push(...n.split("/").filter((e => e.length > 0)));
|
|
1043
1043
|
}
|
|
@@ -1048,7 +1048,7 @@ class BasePath {
|
|
|
1048
1048
|
}
|
|
1049
1049
|
}
|
|
1050
1050
|
|
|
1051
|
-
const
|
|
1051
|
+
const v = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
1052
1052
|
|
|
1053
1053
|
/**
|
|
1054
1054
|
* A dot-separated path for navigating sub-objects within a document.
|
|
@@ -1061,7 +1061,7 @@ const C = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
|
1061
1061
|
* Returns true if the string could be used as a segment in a field path
|
|
1062
1062
|
* without escaping.
|
|
1063
1063
|
*/ static isValidIdentifier(e) {
|
|
1064
|
-
return
|
|
1064
|
+
return v.test(e);
|
|
1065
1065
|
}
|
|
1066
1066
|
canonicalString() {
|
|
1067
1067
|
return this.toArray().map((e => (e = e.replace(/\\/g, "\\\\").replace(/`/g, "\\`"),
|
|
@@ -1093,21 +1093,21 @@ const C = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
|
1093
1093
|
const t = [];
|
|
1094
1094
|
let n = "", r = 0;
|
|
1095
1095
|
const __PRIVATE_addCurrentSegment = () => {
|
|
1096
|
-
if (0 === n.length) throw new FirestoreError(
|
|
1096
|
+
if (0 === n.length) throw new FirestoreError(C.INVALID_ARGUMENT, `Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);
|
|
1097
1097
|
t.push(n), n = "";
|
|
1098
1098
|
};
|
|
1099
1099
|
let i = !1;
|
|
1100
1100
|
for (;r < e.length; ) {
|
|
1101
1101
|
const t = e[r];
|
|
1102
1102
|
if ("\\" === t) {
|
|
1103
|
-
if (r + 1 === e.length) throw new FirestoreError(
|
|
1103
|
+
if (r + 1 === e.length) throw new FirestoreError(C.INVALID_ARGUMENT, "Path has trailing escape character: " + e);
|
|
1104
1104
|
const t = e[r + 1];
|
|
1105
|
-
if ("\\" !== t && "." !== t && "`" !== t) throw new FirestoreError(
|
|
1105
|
+
if ("\\" !== t && "." !== t && "`" !== t) throw new FirestoreError(C.INVALID_ARGUMENT, "Path has invalid escape sequence: " + e);
|
|
1106
1106
|
n += t, r += 2;
|
|
1107
1107
|
} else "`" === t ? (i = !i, r++) : "." !== t || i ? (n += t, r++) : (__PRIVATE_addCurrentSegment(),
|
|
1108
1108
|
r++);
|
|
1109
1109
|
}
|
|
1110
|
-
if (__PRIVATE_addCurrentSegment(), i) throw new FirestoreError(
|
|
1110
|
+
if (__PRIVATE_addCurrentSegment(), i) throw new FirestoreError(C.INVALID_ARGUMENT, "Unterminated ` in path: " + e);
|
|
1111
1111
|
return new FieldPath$1(t);
|
|
1112
1112
|
}
|
|
1113
1113
|
static emptyPath() {
|
|
@@ -1359,7 +1359,7 @@ function __PRIVATE_indexOffsetComparator(e, t) {
|
|
|
1359
1359
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1360
1360
|
* See the License for the specific language governing permissions and
|
|
1361
1361
|
* limitations under the License.
|
|
1362
|
-
*/ const
|
|
1362
|
+
*/ const F = "The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";
|
|
1363
1363
|
|
|
1364
1364
|
/**
|
|
1365
1365
|
* A base class representing a persistence transaction, encapsulating both the
|
|
@@ -1406,7 +1406,7 @@ function __PRIVATE_indexOffsetComparator(e, t) {
|
|
|
1406
1406
|
* @param err - An error returned by a LocalStore operation.
|
|
1407
1407
|
* @returns A Promise that resolves after we recovered, or the original error.
|
|
1408
1408
|
*/ async function __PRIVATE_ignoreIfPrimaryLeaseLoss(e) {
|
|
1409
|
-
if (e.code !==
|
|
1409
|
+
if (e.code !== C.FAILED_PRECONDITION || e.message !== F) throw e;
|
|
1410
1410
|
__PRIVATE_logDebug("LocalStore", "Unexpectedly lost primary lease");
|
|
1411
1411
|
}
|
|
1412
1412
|
|
|
@@ -1717,7 +1717,7 @@ class __PRIVATE_SimpleDbTransaction {
|
|
|
1717
1717
|
n(new __PRIVATE_IndexedDbTransactionError(e, "Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed."));
|
|
1718
1718
|
}, r.onerror = t => {
|
|
1719
1719
|
const r = t.target.error;
|
|
1720
|
-
"VersionError" === r.name ? n(new FirestoreError(
|
|
1720
|
+
"VersionError" === r.name ? n(new FirestoreError(C.FAILED_PRECONDITION, "A newer version of the Firestore SDK was previously used and so the persisted data is not compatible with the version of the SDK you are now using. The SDK will operate with persistence disabled. If you need persistence, please re-upgrade to a newer version of the SDK or else clear the persisted IndexedDB data for your app to start fresh.")) : "InvalidStateError" === r.name ? n(new FirestoreError(C.FAILED_PRECONDITION, "Unable to open an IndexedDB connection. This could be due to running in a private browsing session on a browser whose private browsing sessions do not support IndexedDB: " + r)) : n(new __PRIVATE_IndexedDbTransactionError(e, r));
|
|
1721
1721
|
}, r.onupgradeneeded = e => {
|
|
1722
1722
|
__PRIVATE_logDebug("SimpleDb", 'Database "' + this.name + '" requires upgrade from version:', e.oldVersion);
|
|
1723
1723
|
const t = e.target.result;
|
|
@@ -1804,7 +1804,7 @@ class __PRIVATE_SimpleDbTransaction {
|
|
|
1804
1804
|
|
|
1805
1805
|
/** An error that wraps exceptions that thrown during IndexedDB execution. */ class __PRIVATE_IndexedDbTransactionError extends FirestoreError {
|
|
1806
1806
|
constructor(e, t) {
|
|
1807
|
-
super(
|
|
1807
|
+
super(C.UNAVAILABLE, `IndexedDB transaction '${e}' failed: ${t}`), this.name = "IndexedDbTransactionError";
|
|
1808
1808
|
}
|
|
1809
1809
|
}
|
|
1810
1810
|
|
|
@@ -1988,7 +1988,7 @@ class __PRIVATE_SimpleDbTransaction {
|
|
|
1988
1988
|
}
|
|
1989
1989
|
|
|
1990
1990
|
// Guard so we only report the error once.
|
|
1991
|
-
let
|
|
1991
|
+
let M = !1;
|
|
1992
1992
|
|
|
1993
1993
|
function __PRIVATE_checkForAndReportiOSError(e) {
|
|
1994
1994
|
const t = __PRIVATE_SimpleDb.S(getUA());
|
|
@@ -1997,7 +1997,7 @@ function __PRIVATE_checkForAndReportiOSError(e) {
|
|
|
1997
1997
|
if (e.message.indexOf(t) >= 0) {
|
|
1998
1998
|
// Wrap error in a more descriptive one.
|
|
1999
1999
|
const e = new FirestoreError("internal", `IOS_INDEXEDDB_BUG1: IndexedDb has thrown '${t}'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.`);
|
|
2000
|
-
return
|
|
2000
|
+
return M || (M = !0,
|
|
2001
2001
|
// Throw a global exception outside of this promise chain, for the user to
|
|
2002
2002
|
// potentially catch.
|
|
2003
2003
|
setTimeout((() => {
|
|
@@ -2249,7 +2249,7 @@ function __PRIVATE_encodeResourcePath(e) {
|
|
|
2249
2249
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2250
2250
|
* See the License for the specific language governing permissions and
|
|
2251
2251
|
* limitations under the License.
|
|
2252
|
-
*/ const
|
|
2252
|
+
*/ const x = [ "userId", "batchId" ];
|
|
2253
2253
|
|
|
2254
2254
|
/**
|
|
2255
2255
|
* @license
|
|
@@ -2294,7 +2294,7 @@ function __PRIVATE_newDbDocumentMutationPrefixForPath(e, t) {
|
|
|
2294
2294
|
* there is no useful information to store as the value. The raw (unencoded)
|
|
2295
2295
|
* path cannot be stored because IndexedDb doesn't store prototype
|
|
2296
2296
|
* information.
|
|
2297
|
-
*/ const
|
|
2297
|
+
*/ const O = {}, N = [ "prefixPath", "collectionGroup", "readTime", "documentId" ], B = [ "prefixPath", "collectionGroup", "documentId" ], L = [ "collectionGroup", "readTime", "prefixPath", "documentId" ], k = [ "canonicalId", "targetId" ], q = [ "targetId", "path" ], Q = [ "path", "targetId" ], K = [ "collectionId", "parent" ], $ = [ "indexId", "uid" ], U = [ "uid", "sequenceNumber" ], W = [ "indexId", "uid", "arrayValue", "directionalValue", "orderedDocumentKey", "documentKey" ], G = [ "indexId", "uid", "orderedDocumentKey" ], z = [ "userId", "collectionPath", "documentId" ], j = [ "userId", "collectionPath", "largestBatchId" ], H = [ "userId", "collectionGroup", "largestBatchId" ], J = [ ...[ ...[ ...[ ...[ "mutationQueues", "mutations", "documentMutations", "remoteDocuments", "targets", "owner", "targetGlobal", "targetDocuments" ], "clientMetadata" ], "remoteDocumentGlobal" ], "collectionParents" ], "bundles", "namedQueries" ], Y = [ ...J, "documentOverlays" ], Z = [ "mutationQueues", "mutations", "documentMutations", "remoteDocumentsV14", "targets", "owner", "targetGlobal", "targetDocuments", "clientMetadata", "remoteDocumentGlobal", "collectionParents", "bundles", "namedQueries", "documentOverlays" ], X = Z, ee = [ ...X, "indexConfiguration", "indexState", "indexEntries" ];
|
|
2298
2298
|
|
|
2299
2299
|
/**
|
|
2300
2300
|
* @license
|
|
@@ -3051,7 +3051,7 @@ function __PRIVATE_isBase64Available() {
|
|
|
3051
3051
|
|
|
3052
3052
|
ByteString.EMPTY_BYTE_STRING = new ByteString("");
|
|
3053
3053
|
|
|
3054
|
-
const
|
|
3054
|
+
const te = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
3055
3055
|
|
|
3056
3056
|
/**
|
|
3057
3057
|
* Converts the possible Proto values for a timestamp value into a "seconds and
|
|
@@ -3065,7 +3065,7 @@ const ee = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
3065
3065
|
// (millis), so we do some custom parsing here.
|
|
3066
3066
|
// Parse the nanos right out of the string.
|
|
3067
3067
|
let t = 0;
|
|
3068
|
-
const n =
|
|
3068
|
+
const n = te.exec(e);
|
|
3069
3069
|
if (__PRIVATE_hardAssert(!!n), n[1]) {
|
|
3070
3070
|
// Pad the fraction out to 9 digits (nanos).
|
|
3071
3071
|
let e = n[1];
|
|
@@ -3232,7 +3232,7 @@ class DatabaseId {
|
|
|
3232
3232
|
* See the License for the specific language governing permissions and
|
|
3233
3233
|
* limitations under the License.
|
|
3234
3234
|
*/
|
|
3235
|
-
const
|
|
3235
|
+
const ne = {
|
|
3236
3236
|
mapValue: {
|
|
3237
3237
|
fields: {
|
|
3238
3238
|
__type__: {
|
|
@@ -3240,7 +3240,7 @@ const te = {
|
|
|
3240
3240
|
}
|
|
3241
3241
|
}
|
|
3242
3242
|
}
|
|
3243
|
-
},
|
|
3243
|
+
}, re = {
|
|
3244
3244
|
nullValue: "NULL_VALUE"
|
|
3245
3245
|
};
|
|
3246
3246
|
|
|
@@ -3384,9 +3384,9 @@ function __PRIVATE_valueCompare(e, t) {
|
|
|
3384
3384
|
|
|
3385
3385
|
case 10 /* TypeOrder.ObjectValue */ :
|
|
3386
3386
|
return function __PRIVATE_compareMaps(e, t) {
|
|
3387
|
-
if (e ===
|
|
3388
|
-
if (e ===
|
|
3389
|
-
if (t ===
|
|
3387
|
+
if (e === ne.mapValue && t === ne.mapValue) return 0;
|
|
3388
|
+
if (e === ne.mapValue) return 1;
|
|
3389
|
+
if (t === ne.mapValue) return -1;
|
|
3390
3390
|
const n = e.fields || {}, r = Object.keys(n), i = t.fields || {}, s = Object.keys(i);
|
|
3391
3391
|
// Even though MapValues are likely sorted correctly based on their insertion
|
|
3392
3392
|
// order (e.g. when received from the backend), local modifications can bring
|
|
@@ -3562,7 +3562,7 @@ function isArray(e) {
|
|
|
3562
3562
|
}
|
|
3563
3563
|
|
|
3564
3564
|
/** Returns the lowest value for the given value type (inclusive). */ function __PRIVATE_valuesGetLowerBound(e) {
|
|
3565
|
-
return "nullValue" in e ?
|
|
3565
|
+
return "nullValue" in e ? re : "booleanValue" in e ? {
|
|
3566
3566
|
booleanValue: !1
|
|
3567
3567
|
} : "integerValue" in e || "doubleValue" in e ? {
|
|
3568
3568
|
doubleValue: NaN
|
|
@@ -3608,7 +3608,7 @@ function isArray(e) {
|
|
|
3608
3608
|
arrayValue: {}
|
|
3609
3609
|
} : "arrayValue" in e ? {
|
|
3610
3610
|
mapValue: {}
|
|
3611
|
-
} : "mapValue" in e ?
|
|
3611
|
+
} : "mapValue" in e ? ne : fail();
|
|
3612
3612
|
}
|
|
3613
3613
|
|
|
3614
3614
|
function __PRIVATE_lowerBoundCompare(e, t) {
|
|
@@ -4296,10 +4296,10 @@ function __PRIVATE_targetIsDocumentTarget(e) {
|
|
|
4296
4296
|
* the provided `fieldPath` (or the upper bound for an descending segment).
|
|
4297
4297
|
*/
|
|
4298
4298
|
function __PRIVATE_targetGetAscendingBound(e, t, n) {
|
|
4299
|
-
let r =
|
|
4299
|
+
let r = re, i = !0;
|
|
4300
4300
|
// Process all filters to find a value for the current field segment
|
|
4301
4301
|
for (const n of __PRIVATE_targetGetFieldFiltersForPath(e, t)) {
|
|
4302
|
-
let e =
|
|
4302
|
+
let e = re, t = !0;
|
|
4303
4303
|
switch (n.op) {
|
|
4304
4304
|
case "<" /* Operator.LESS_THAN */ :
|
|
4305
4305
|
case "<=" /* Operator.LESS_THAN_OR_EQUAL */ :
|
|
@@ -4318,7 +4318,7 @@ function __PRIVATE_targetGetAscendingBound(e, t, n) {
|
|
|
4318
4318
|
|
|
4319
4319
|
case "!=" /* Operator.NOT_EQUAL */ :
|
|
4320
4320
|
case "not-in" /* Operator.NOT_IN */ :
|
|
4321
|
-
e =
|
|
4321
|
+
e = re;
|
|
4322
4322
|
// Remaining filters cannot be used as lower bounds.
|
|
4323
4323
|
}
|
|
4324
4324
|
__PRIVATE_lowerBoundCompare({
|
|
@@ -4354,10 +4354,10 @@ function __PRIVATE_targetGetAscendingBound(e, t, n) {
|
|
|
4354
4354
|
* Returns the value to use as the upper bound for ascending index segment at
|
|
4355
4355
|
* the provided `fieldPath` (or the lower bound for a descending segment).
|
|
4356
4356
|
*/ function __PRIVATE_targetGetDescendingBound(e, t, n) {
|
|
4357
|
-
let r =
|
|
4357
|
+
let r = ne, i = !0;
|
|
4358
4358
|
// Process all filters to find a value for the current field segment
|
|
4359
4359
|
for (const n of __PRIVATE_targetGetFieldFiltersForPath(e, t)) {
|
|
4360
|
-
let e =
|
|
4360
|
+
let e = ne, t = !0;
|
|
4361
4361
|
switch (n.op) {
|
|
4362
4362
|
case ">=" /* Operator.GREATER_THAN_OR_EQUAL */ :
|
|
4363
4363
|
case ">" /* Operator.GREATER_THAN */ :
|
|
@@ -4376,7 +4376,7 @@ function __PRIVATE_targetGetAscendingBound(e, t, n) {
|
|
|
4376
4376
|
|
|
4377
4377
|
case "!=" /* Operator.NOT_EQUAL */ :
|
|
4378
4378
|
case "not-in" /* Operator.NOT_IN */ :
|
|
4379
|
-
e =
|
|
4379
|
+
e = ne;
|
|
4380
4380
|
// Remaining filters cannot be used as upper bounds.
|
|
4381
4381
|
}
|
|
4382
4382
|
__PRIVATE_upperBoundCompare({
|
|
@@ -4753,22 +4753,22 @@ function __PRIVATE_compareDocs(e, t, n) {
|
|
|
4753
4753
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4754
4754
|
* See the License for the specific language governing permissions and
|
|
4755
4755
|
* limitations under the License.
|
|
4756
|
-
*/ const
|
|
4756
|
+
*/ const ie = new SortedMap(DocumentKey.comparator);
|
|
4757
4757
|
|
|
4758
4758
|
function __PRIVATE_mutableDocumentMap() {
|
|
4759
|
-
return
|
|
4759
|
+
return ie;
|
|
4760
4760
|
}
|
|
4761
4761
|
|
|
4762
|
-
const
|
|
4762
|
+
const se = new SortedMap(DocumentKey.comparator);
|
|
4763
4763
|
|
|
4764
4764
|
function documentMap(...e) {
|
|
4765
|
-
let t =
|
|
4765
|
+
let t = se;
|
|
4766
4766
|
for (const n of e) t = t.insert(n.key, n);
|
|
4767
4767
|
return t;
|
|
4768
4768
|
}
|
|
4769
4769
|
|
|
4770
4770
|
function __PRIVATE_convertOverlayedDocumentMapToDocumentMap(e) {
|
|
4771
|
-
let t =
|
|
4771
|
+
let t = se;
|
|
4772
4772
|
return e.forEach(((e, n) => t = t.insert(e, n.overlayedDocument))), t;
|
|
4773
4773
|
}
|
|
4774
4774
|
|
|
@@ -4784,20 +4784,20 @@ function __PRIVATE_newDocumentKeyMap() {
|
|
|
4784
4784
|
return new ObjectMap((e => e.toString()), ((e, t) => e.isEqual(t)));
|
|
4785
4785
|
}
|
|
4786
4786
|
|
|
4787
|
-
const
|
|
4787
|
+
const oe = new SortedMap(DocumentKey.comparator);
|
|
4788
4788
|
|
|
4789
|
-
const
|
|
4789
|
+
const _e = new SortedSet(DocumentKey.comparator);
|
|
4790
4790
|
|
|
4791
4791
|
function __PRIVATE_documentKeySet(...e) {
|
|
4792
|
-
let t =
|
|
4792
|
+
let t = _e;
|
|
4793
4793
|
for (const n of e) t = t.add(n);
|
|
4794
4794
|
return t;
|
|
4795
4795
|
}
|
|
4796
4796
|
|
|
4797
|
-
const
|
|
4797
|
+
const ae = new SortedSet(__PRIVATE_primitiveComparator);
|
|
4798
4798
|
|
|
4799
4799
|
function __PRIVATE_targetIdSet() {
|
|
4800
|
-
return
|
|
4800
|
+
return ae;
|
|
4801
4801
|
}
|
|
4802
4802
|
|
|
4803
4803
|
/**
|
|
@@ -5488,7 +5488,7 @@ class __PRIVATE_VerifyMutation extends Mutation {
|
|
|
5488
5488
|
*/ static from(e, t, n) {
|
|
5489
5489
|
__PRIVATE_hardAssert(e.mutations.length === n.length);
|
|
5490
5490
|
let r = function __PRIVATE_documentVersionMap() {
|
|
5491
|
-
return
|
|
5491
|
+
return oe;
|
|
5492
5492
|
}();
|
|
5493
5493
|
const i = e.mutations;
|
|
5494
5494
|
for (let e = 0; e < i.length; e++) r = r.insert(i[e].key, n[e].version);
|
|
@@ -5602,7 +5602,7 @@ class __PRIVATE_VerifyMutation extends Mutation {
|
|
|
5602
5602
|
* Important! The names of these identifiers matter because the string forms
|
|
5603
5603
|
* are used for reverse lookups from the webchannel stream. Do NOT change the
|
|
5604
5604
|
* names of these identifiers or change this into a const enum.
|
|
5605
|
-
*/ var
|
|
5605
|
+
*/ var ue, ce;
|
|
5606
5606
|
|
|
5607
5607
|
/**
|
|
5608
5608
|
* Determines whether an error code represents a permanent error when received
|
|
@@ -5615,29 +5615,29 @@ function __PRIVATE_isPermanentError(e) {
|
|
|
5615
5615
|
default:
|
|
5616
5616
|
return fail();
|
|
5617
5617
|
|
|
5618
|
-
case
|
|
5619
|
-
case
|
|
5620
|
-
case
|
|
5621
|
-
case
|
|
5622
|
-
case
|
|
5623
|
-
case
|
|
5618
|
+
case C.CANCELLED:
|
|
5619
|
+
case C.UNKNOWN:
|
|
5620
|
+
case C.DEADLINE_EXCEEDED:
|
|
5621
|
+
case C.RESOURCE_EXHAUSTED:
|
|
5622
|
+
case C.INTERNAL:
|
|
5623
|
+
case C.UNAVAILABLE:
|
|
5624
5624
|
// Unauthenticated means something went wrong with our token and we need
|
|
5625
5625
|
// to retry with new credentials which will happen automatically.
|
|
5626
|
-
case
|
|
5626
|
+
case C.UNAUTHENTICATED:
|
|
5627
5627
|
return !1;
|
|
5628
5628
|
|
|
5629
|
-
case
|
|
5630
|
-
case
|
|
5631
|
-
case
|
|
5632
|
-
case
|
|
5633
|
-
case
|
|
5629
|
+
case C.INVALID_ARGUMENT:
|
|
5630
|
+
case C.NOT_FOUND:
|
|
5631
|
+
case C.ALREADY_EXISTS:
|
|
5632
|
+
case C.PERMISSION_DENIED:
|
|
5633
|
+
case C.FAILED_PRECONDITION:
|
|
5634
5634
|
// Aborted might be retried in some scenarios, but that is dependant on
|
|
5635
5635
|
// the context and should handled individually by the calling code.
|
|
5636
5636
|
// See https://cloud.google.com/apis/design/errors.
|
|
5637
|
-
case
|
|
5638
|
-
case
|
|
5639
|
-
case
|
|
5640
|
-
case
|
|
5637
|
+
case C.ABORTED:
|
|
5638
|
+
case C.OUT_OF_RANGE:
|
|
5639
|
+
case C.UNIMPLEMENTED:
|
|
5640
|
+
case C.DATA_LOSS:
|
|
5641
5641
|
return !0;
|
|
5642
5642
|
}
|
|
5643
5643
|
}
|
|
@@ -5665,58 +5665,58 @@ function __PRIVATE_mapCodeFromRpcCode(e) {
|
|
|
5665
5665
|
if (void 0 === e)
|
|
5666
5666
|
// This shouldn't normally happen, but in certain error cases (like trying
|
|
5667
5667
|
// to send invalid proto messages) we may get an error with no GRPC code.
|
|
5668
|
-
return __PRIVATE_logError("GRPC error has no .code"),
|
|
5668
|
+
return __PRIVATE_logError("GRPC error has no .code"), C.UNKNOWN;
|
|
5669
5669
|
switch (e) {
|
|
5670
|
-
case
|
|
5671
|
-
return
|
|
5670
|
+
case ue.OK:
|
|
5671
|
+
return C.OK;
|
|
5672
5672
|
|
|
5673
|
-
case
|
|
5674
|
-
return
|
|
5673
|
+
case ue.CANCELLED:
|
|
5674
|
+
return C.CANCELLED;
|
|
5675
5675
|
|
|
5676
|
-
case
|
|
5677
|
-
return
|
|
5676
|
+
case ue.UNKNOWN:
|
|
5677
|
+
return C.UNKNOWN;
|
|
5678
5678
|
|
|
5679
|
-
case
|
|
5680
|
-
return
|
|
5679
|
+
case ue.DEADLINE_EXCEEDED:
|
|
5680
|
+
return C.DEADLINE_EXCEEDED;
|
|
5681
5681
|
|
|
5682
|
-
case
|
|
5683
|
-
return
|
|
5682
|
+
case ue.RESOURCE_EXHAUSTED:
|
|
5683
|
+
return C.RESOURCE_EXHAUSTED;
|
|
5684
5684
|
|
|
5685
|
-
case
|
|
5686
|
-
return
|
|
5685
|
+
case ue.INTERNAL:
|
|
5686
|
+
return C.INTERNAL;
|
|
5687
5687
|
|
|
5688
|
-
case
|
|
5689
|
-
return
|
|
5688
|
+
case ue.UNAVAILABLE:
|
|
5689
|
+
return C.UNAVAILABLE;
|
|
5690
5690
|
|
|
5691
|
-
case
|
|
5692
|
-
return
|
|
5691
|
+
case ue.UNAUTHENTICATED:
|
|
5692
|
+
return C.UNAUTHENTICATED;
|
|
5693
5693
|
|
|
5694
|
-
case
|
|
5695
|
-
return
|
|
5694
|
+
case ue.INVALID_ARGUMENT:
|
|
5695
|
+
return C.INVALID_ARGUMENT;
|
|
5696
5696
|
|
|
5697
|
-
case
|
|
5698
|
-
return
|
|
5697
|
+
case ue.NOT_FOUND:
|
|
5698
|
+
return C.NOT_FOUND;
|
|
5699
5699
|
|
|
5700
|
-
case
|
|
5701
|
-
return
|
|
5700
|
+
case ue.ALREADY_EXISTS:
|
|
5701
|
+
return C.ALREADY_EXISTS;
|
|
5702
5702
|
|
|
5703
|
-
case
|
|
5704
|
-
return
|
|
5703
|
+
case ue.PERMISSION_DENIED:
|
|
5704
|
+
return C.PERMISSION_DENIED;
|
|
5705
5705
|
|
|
5706
|
-
case
|
|
5707
|
-
return
|
|
5706
|
+
case ue.FAILED_PRECONDITION:
|
|
5707
|
+
return C.FAILED_PRECONDITION;
|
|
5708
5708
|
|
|
5709
|
-
case
|
|
5710
|
-
return
|
|
5709
|
+
case ue.ABORTED:
|
|
5710
|
+
return C.ABORTED;
|
|
5711
5711
|
|
|
5712
|
-
case
|
|
5713
|
-
return
|
|
5712
|
+
case ue.OUT_OF_RANGE:
|
|
5713
|
+
return C.OUT_OF_RANGE;
|
|
5714
5714
|
|
|
5715
|
-
case
|
|
5716
|
-
return
|
|
5715
|
+
case ue.UNIMPLEMENTED:
|
|
5716
|
+
return C.UNIMPLEMENTED;
|
|
5717
5717
|
|
|
5718
|
-
case
|
|
5719
|
-
return
|
|
5718
|
+
case ue.DATA_LOSS:
|
|
5719
|
+
return C.DATA_LOSS;
|
|
5720
5720
|
|
|
5721
5721
|
default:
|
|
5722
5722
|
return fail();
|
|
@@ -5730,14 +5730,14 @@ function __PRIVATE_mapCodeFromRpcCode(e) {
|
|
|
5730
5730
|
* "UNKNOWN", etc.)
|
|
5731
5731
|
* @returns The equivalent Code. Non-matching responses are mapped to
|
|
5732
5732
|
* Code.UNKNOWN.
|
|
5733
|
-
*/ (
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
|
|
5733
|
+
*/ (ce = ue || (ue = {}))[ce.OK = 0] = "OK", ce[ce.CANCELLED = 1] = "CANCELLED",
|
|
5734
|
+
ce[ce.UNKNOWN = 2] = "UNKNOWN", ce[ce.INVALID_ARGUMENT = 3] = "INVALID_ARGUMENT",
|
|
5735
|
+
ce[ce.DEADLINE_EXCEEDED = 4] = "DEADLINE_EXCEEDED", ce[ce.NOT_FOUND = 5] = "NOT_FOUND",
|
|
5736
|
+
ce[ce.ALREADY_EXISTS = 6] = "ALREADY_EXISTS", ce[ce.PERMISSION_DENIED = 7] = "PERMISSION_DENIED",
|
|
5737
|
+
ce[ce.UNAUTHENTICATED = 16] = "UNAUTHENTICATED", ce[ce.RESOURCE_EXHAUSTED = 8] = "RESOURCE_EXHAUSTED",
|
|
5738
|
+
ce[ce.FAILED_PRECONDITION = 9] = "FAILED_PRECONDITION", ce[ce.ABORTED = 10] = "ABORTED",
|
|
5739
|
+
ce[ce.OUT_OF_RANGE = 11] = "OUT_OF_RANGE", ce[ce.UNIMPLEMENTED = 12] = "UNIMPLEMENTED",
|
|
5740
|
+
ce[ce.INTERNAL = 13] = "INTERNAL", ce[ce.UNAVAILABLE = 14] = "UNAVAILABLE", ce[ce.DATA_LOSS = 15] = "DATA_LOSS";
|
|
5741
5741
|
|
|
5742
5742
|
/**
|
|
5743
5743
|
* @license
|
|
@@ -5762,7 +5762,7 @@ ue[ue.INTERNAL = 13] = "INTERNAL", ue[ue.UNAVAILABLE = 14] = "UNAVAILABLE", ue[u
|
|
|
5762
5762
|
* integration tests that have registered callbacks to be notified of events
|
|
5763
5763
|
* that happen during the test execution.
|
|
5764
5764
|
*/
|
|
5765
|
-
let
|
|
5765
|
+
let le = null;
|
|
5766
5766
|
|
|
5767
5767
|
/**
|
|
5768
5768
|
* Sets the value of the `testingHooksSpi` object.
|
|
@@ -5810,7 +5810,7 @@ function __PRIVATE_newTextEncoder() {
|
|
|
5810
5810
|
* See the License for the specific language governing permissions and
|
|
5811
5811
|
* limitations under the License.
|
|
5812
5812
|
*/
|
|
5813
|
-
const
|
|
5813
|
+
const he = new Integer([ 4294967295, 4294967295 ], 0);
|
|
5814
5814
|
|
|
5815
5815
|
// Hash a string using md5 hashing algorithm.
|
|
5816
5816
|
function __PRIVATE_getMd5HashValue(e) {
|
|
@@ -5845,7 +5845,7 @@ class BloomFilter {
|
|
|
5845
5845
|
// Calculate hashed value h(i) = h1 + (i * h2).
|
|
5846
5846
|
let r = e.add(t.multiply(Integer.fromNumber(n)));
|
|
5847
5847
|
// Wrap if hash value overflow 64bit.
|
|
5848
|
-
return 1 === r.compare(
|
|
5848
|
+
return 1 === r.compare(he) && (r = new Integer([ r.getBits(0), r.getBits(1) ], 0)),
|
|
5849
5849
|
r.modulo(this.Ee).toNumber();
|
|
5850
5850
|
}
|
|
5851
5851
|
// Return whether the bit on the given index in the bitmap is set to 1.
|
|
@@ -6263,7 +6263,7 @@ class __PRIVATE_WatchChangeAggregator {
|
|
|
6263
6263
|
const e = 2 /* BloomFilterApplicationStatus.FalsePositive */ === i ? "TargetPurposeExistenceFilterMismatchBloom" /* TargetPurpose.ExistenceFilterMismatchBloom */ : "TargetPurposeExistenceFilterMismatch" /* TargetPurpose.ExistenceFilterMismatch */;
|
|
6264
6264
|
this.Ke = this.Ke.insert(t, e);
|
|
6265
6265
|
}
|
|
6266
|
-
null ==
|
|
6266
|
+
null == le || le.tt(function __PRIVATE_createExistenceFilterMismatchInfoForTestingHooks(e, t, n, r, i) {
|
|
6267
6267
|
var s, o, _, a, u, c;
|
|
6268
6268
|
const l = {
|
|
6269
6269
|
localCacheCount: e,
|
|
@@ -6479,13 +6479,13 @@ function __PRIVATE_snapshotChangesMap() {
|
|
|
6479
6479
|
return new SortedMap(DocumentKey.comparator);
|
|
6480
6480
|
}
|
|
6481
6481
|
|
|
6482
|
-
const
|
|
6482
|
+
const Pe = (() => {
|
|
6483
6483
|
const e = {
|
|
6484
6484
|
asc: "ASCENDING",
|
|
6485
6485
|
desc: "DESCENDING"
|
|
6486
6486
|
};
|
|
6487
6487
|
return e;
|
|
6488
|
-
})(),
|
|
6488
|
+
})(), Ie = (() => {
|
|
6489
6489
|
const e = {
|
|
6490
6490
|
"<": "LESS_THAN",
|
|
6491
6491
|
"<=": "LESS_THAN_OR_EQUAL",
|
|
@@ -6499,7 +6499,7 @@ const he = (() => {
|
|
|
6499
6499
|
"array-contains-any": "ARRAY_CONTAINS_ANY"
|
|
6500
6500
|
};
|
|
6501
6501
|
return e;
|
|
6502
|
-
})(),
|
|
6502
|
+
})(), Te = (() => {
|
|
6503
6503
|
const e = {
|
|
6504
6504
|
and: "AND",
|
|
6505
6505
|
or: "OR"
|
|
@@ -6596,8 +6596,8 @@ function __PRIVATE_toName(e, t) {
|
|
|
6596
6596
|
|
|
6597
6597
|
function fromName(e, t) {
|
|
6598
6598
|
const n = __PRIVATE_fromResourceName(t);
|
|
6599
|
-
if (n.get(1) !== e.databaseId.projectId) throw new FirestoreError(
|
|
6600
|
-
if (n.get(3) !== e.databaseId.database) throw new FirestoreError(
|
|
6599
|
+
if (n.get(1) !== e.databaseId.projectId) throw new FirestoreError(C.INVALID_ARGUMENT, "Tried to deserialize key from different project: " + n.get(1) + " vs " + e.databaseId.projectId);
|
|
6600
|
+
if (n.get(3) !== e.databaseId.database) throw new FirestoreError(C.INVALID_ARGUMENT, "Tried to deserialize key from different database: " + n.get(3) + " vs " + e.databaseId.database);
|
|
6601
6601
|
return new DocumentKey(__PRIVATE_extractLocalPathFromResourceName(n));
|
|
6602
6602
|
}
|
|
6603
6603
|
|
|
@@ -6667,7 +6667,7 @@ function __PRIVATE_fromWatchChange(e, t) {
|
|
|
6667
6667
|
ByteString.fromBase64String(t || "")) : (__PRIVATE_hardAssert(void 0 === t || t instanceof Uint8Array),
|
|
6668
6668
|
ByteString.fromUint8Array(t || new Uint8Array));
|
|
6669
6669
|
}(e, t.targetChange.resumeToken), o = t.targetChange.cause, _ = o && function __PRIVATE_fromRpcStatus(e) {
|
|
6670
|
-
const t = void 0 === e.code ?
|
|
6670
|
+
const t = void 0 === e.code ? C.UNKNOWN : __PRIVATE_mapCodeFromRpcCode(e.code);
|
|
6671
6671
|
return new FirestoreError(t, e.message || "");
|
|
6672
6672
|
}(o);
|
|
6673
6673
|
n = new __PRIVATE_WatchTargetChange(r, i, s, _ || null);
|
|
@@ -7023,15 +7023,15 @@ function __PRIVATE_fromFilter(e) {
|
|
|
7023
7023
|
}
|
|
7024
7024
|
|
|
7025
7025
|
function __PRIVATE_toDirection(e) {
|
|
7026
|
-
return
|
|
7026
|
+
return Pe[e];
|
|
7027
7027
|
}
|
|
7028
7028
|
|
|
7029
7029
|
function __PRIVATE_toOperatorName(e) {
|
|
7030
|
-
return
|
|
7030
|
+
return Ie[e];
|
|
7031
7031
|
}
|
|
7032
7032
|
|
|
7033
7033
|
function __PRIVATE_toCompositeOperatorName(e) {
|
|
7034
|
-
return
|
|
7034
|
+
return Te[e];
|
|
7035
7035
|
}
|
|
7036
7036
|
|
|
7037
7037
|
function __PRIVATE_toFieldPathReference(e) {
|
|
@@ -8352,7 +8352,7 @@ function __PRIVATE_applyDistributionFieldAndCompositeFilters(e, t) {
|
|
|
8352
8352
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
8353
8353
|
* See the License for the specific language governing permissions and
|
|
8354
8354
|
* limitations under the License.
|
|
8355
|
-
*/ const
|
|
8355
|
+
*/ const Ee = new Uint8Array(0);
|
|
8356
8356
|
|
|
8357
8357
|
/**
|
|
8358
8358
|
* A persisted implementation of IndexManager.
|
|
@@ -8566,7 +8566,7 @@ class __PRIVATE_IndexedDbIndexManager {
|
|
|
8566
8566
|
// combined with the values from the query bounds.
|
|
8567
8567
|
const _ = (null != t ? t.length : 1) * Math.max(n.length, i.length), a = _ / (null != t ? t.length : 1), u = [];
|
|
8568
8568
|
for (let c = 0; c < _; ++c) {
|
|
8569
|
-
const _ = t ? this.In(t[c / a]) :
|
|
8569
|
+
const _ = t ? this.In(t[c / a]) : Ee, l = this.Tn(e, _, n[c % a], r), h = this.En(e, _, i[c % a], s), P = o.map((t => this.Tn(e, _, t,
|
|
8570
8570
|
/* inclusive= */ !0)));
|
|
8571
8571
|
u.push(...this.createRange(l, h, P));
|
|
8572
8572
|
}
|
|
@@ -8763,7 +8763,7 @@ class __PRIVATE_IndexedDbIndexManager {
|
|
|
8763
8763
|
if (null != i) {
|
|
8764
8764
|
const s = e.data.field(i.fieldPath);
|
|
8765
8765
|
if (isArray(s)) for (const i of s.arrayValue.values || []) n = n.add(new __PRIVATE_IndexEntry(t.indexId, e.key, this.In(i), r));
|
|
8766
|
-
} else n = n.add(new __PRIVATE_IndexEntry(t.indexId, e.key,
|
|
8766
|
+
} else n = n.add(new __PRIVATE_IndexEntry(t.indexId, e.key, Ee, r));
|
|
8767
8767
|
return n;
|
|
8768
8768
|
}
|
|
8769
8769
|
/**
|
|
@@ -8838,7 +8838,7 @@ class __PRIVATE_IndexedDbIndexManager {
|
|
|
8838
8838
|
// If we encounter two bounds that will create an unmatchable key range,
|
|
8839
8839
|
// then we return an empty set of key ranges.
|
|
8840
8840
|
if (this.bn(r[e], r[e + 1])) return [];
|
|
8841
|
-
const t = [ r[e].indexId, this.uid, r[e].arrayValue, r[e].directionalValue,
|
|
8841
|
+
const t = [ r[e].indexId, this.uid, r[e].arrayValue, r[e].directionalValue, Ee, [] ], n = [ r[e + 1].indexId, this.uid, r[e + 1].arrayValue, r[e + 1].directionalValue, Ee, [] ];
|
|
8842
8842
|
i.push(IDBKeyRange.bound(t, n));
|
|
8843
8843
|
}
|
|
8844
8844
|
return i;
|
|
@@ -8906,7 +8906,7 @@ function __PRIVATE_getMinOffsetFromFieldIndexes(e) {
|
|
|
8906
8906
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
8907
8907
|
* See the License for the specific language governing permissions and
|
|
8908
8908
|
* limitations under the License.
|
|
8909
|
-
*/ const
|
|
8909
|
+
*/ const de = {
|
|
8910
8910
|
didRun: !1,
|
|
8911
8911
|
sequenceNumbersCollected: 0,
|
|
8912
8912
|
targetsRemoved: 0,
|
|
@@ -9070,7 +9070,7 @@ class __PRIVATE_IndexedDbMutationQueue {
|
|
|
9070
9070
|
let c = new SortedSet(((e, t) => __PRIVATE_primitiveComparator(e.canonicalString(), t.canonicalString())));
|
|
9071
9071
|
for (const e of r) {
|
|
9072
9072
|
const t = __PRIVATE_newDbDocumentMutationKey(this.userId, e.key.path, o);
|
|
9073
|
-
c = c.add(e.key.path.popLast()), u.push(s.put(a)), u.push(i.put(t,
|
|
9073
|
+
c = c.add(e.key.path.popLast()), u.push(s.put(a)), u.push(i.put(t, O));
|
|
9074
9074
|
}
|
|
9075
9075
|
return c.forEach((t => {
|
|
9076
9076
|
u.push(this.indexManager.addToCollectionParentIndex(e, t));
|
|
@@ -9639,8 +9639,8 @@ class __PRIVATE_TargetIdGenerator {
|
|
|
9639
9639
|
}
|
|
9640
9640
|
collect(e, t) {
|
|
9641
9641
|
return -1 === this.params.cacheSizeCollectionThreshold ? (__PRIVATE_logDebug("LruGarbageCollector", "Garbage collection skipped; disabled"),
|
|
9642
|
-
PersistencePromise.resolve(
|
|
9643
|
-
|
|
9642
|
+
PersistencePromise.resolve(de)) : this.getCacheSize(e).next((n => n < this.params.cacheSizeCollectionThreshold ? (__PRIVATE_logDebug("LruGarbageCollector", `Garbage collection skipped; Cache size ${n} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),
|
|
9643
|
+
de) : this.Jn(e, t)));
|
|
9644
9644
|
}
|
|
9645
9645
|
getCacheSize(e) {
|
|
9646
9646
|
return this.zn.getCacheSize(e);
|
|
@@ -11399,7 +11399,7 @@ class __PRIVATE_MemoryLruDelegate {
|
|
|
11399
11399
|
e.createObjectStore("mutations", {
|
|
11400
11400
|
keyPath: "batchId",
|
|
11401
11401
|
autoIncrement: !0
|
|
11402
|
-
}).createIndex("userMutationsIndex",
|
|
11402
|
+
}).createIndex("userMutationsIndex", x, {
|
|
11403
11403
|
unique: !0
|
|
11404
11404
|
}), e.createObjectStore("documentMutations");
|
|
11405
11405
|
}
|
|
@@ -11444,7 +11444,7 @@ class __PRIVATE_MemoryLruDelegate {
|
|
|
11444
11444
|
e.createObjectStore("mutations", {
|
|
11445
11445
|
keyPath: "batchId",
|
|
11446
11446
|
autoIncrement: !0
|
|
11447
|
-
}).createIndex("userMutationsIndex",
|
|
11447
|
+
}).createIndex("userMutationsIndex", x, {
|
|
11448
11448
|
unique: !0
|
|
11449
11449
|
});
|
|
11450
11450
|
const r = t.store("mutations"), i = n.map((e => r.put(e)));
|
|
@@ -11481,19 +11481,19 @@ class __PRIVATE_MemoryLruDelegate {
|
|
|
11481
11481
|
}))), n < 12 && r >= 12 && (s = s.next((() => {
|
|
11482
11482
|
!function __PRIVATE_createDocumentOverlayStore(e) {
|
|
11483
11483
|
const t = e.createObjectStore("documentOverlays", {
|
|
11484
|
-
keyPath:
|
|
11484
|
+
keyPath: z
|
|
11485
11485
|
});
|
|
11486
|
-
t.createIndex("collectionPathOverlayIndex",
|
|
11486
|
+
t.createIndex("collectionPathOverlayIndex", j, {
|
|
11487
11487
|
unique: !1
|
|
11488
|
-
}), t.createIndex("collectionGroupOverlayIndex",
|
|
11488
|
+
}), t.createIndex("collectionGroupOverlayIndex", H, {
|
|
11489
11489
|
unique: !1
|
|
11490
11490
|
});
|
|
11491
11491
|
}(e);
|
|
11492
11492
|
}))), n < 13 && r >= 13 && (s = s.next((() => function __PRIVATE_createRemoteDocumentCache(e) {
|
|
11493
11493
|
const t = e.createObjectStore("remoteDocumentsV14", {
|
|
11494
|
-
keyPath:
|
|
11494
|
+
keyPath: N
|
|
11495
11495
|
});
|
|
11496
|
-
t.createIndex("documentKeyIndex",
|
|
11496
|
+
t.createIndex("documentKeyIndex", B), t.createIndex("collectionGroupIndex", L);
|
|
11497
11497
|
}(e))).next((() => this.ri(e, i))).next((() => e.deleteObjectStore("remoteDocuments")))),
|
|
11498
11498
|
n < 14 && r >= 14 && (s = s.next((() => this.ii(e, i)))), n < 15 && r >= 15 && (s = s.next((() => function __PRIVATE_createFieldIndex(e) {
|
|
11499
11499
|
e.createObjectStore("indexConfiguration", {
|
|
@@ -11503,13 +11503,13 @@ class __PRIVATE_MemoryLruDelegate {
|
|
|
11503
11503
|
unique: !1
|
|
11504
11504
|
});
|
|
11505
11505
|
e.createObjectStore("indexState", {
|
|
11506
|
-
keyPath:
|
|
11507
|
-
}).createIndex("sequenceNumberIndex",
|
|
11506
|
+
keyPath: $
|
|
11507
|
+
}).createIndex("sequenceNumberIndex", U, {
|
|
11508
11508
|
unique: !1
|
|
11509
11509
|
});
|
|
11510
11510
|
e.createObjectStore("indexEntries", {
|
|
11511
|
-
keyPath:
|
|
11512
|
-
}).createIndex("documentKeyIndex",
|
|
11511
|
+
keyPath: W
|
|
11512
|
+
}).createIndex("documentKeyIndex", G, {
|
|
11513
11513
|
unique: !1
|
|
11514
11514
|
});
|
|
11515
11515
|
}(e)))), s;
|
|
@@ -11558,7 +11558,7 @@ class __PRIVATE_MemoryLruDelegate {
|
|
|
11558
11558
|
ti(e, t) {
|
|
11559
11559
|
// Create the index.
|
|
11560
11560
|
e.createObjectStore("collectionParents", {
|
|
11561
|
-
keyPath:
|
|
11561
|
+
keyPath: K
|
|
11562
11562
|
});
|
|
11563
11563
|
const n = t.store("collectionParents"), r = new __PRIVATE_MemoryCollectionParentIndex, addEntry = e => {
|
|
11564
11564
|
if (r.add(e)) {
|
|
@@ -11643,19 +11643,19 @@ class __PRIVATE_MemoryLruDelegate {
|
|
|
11643
11643
|
|
|
11644
11644
|
function __PRIVATE_createQueryCache(e) {
|
|
11645
11645
|
e.createObjectStore("targetDocuments", {
|
|
11646
|
-
keyPath:
|
|
11647
|
-
}).createIndex("documentTargetsIndex",
|
|
11646
|
+
keyPath: q
|
|
11647
|
+
}).createIndex("documentTargetsIndex", Q, {
|
|
11648
11648
|
unique: !0
|
|
11649
11649
|
});
|
|
11650
11650
|
// NOTE: This is unique only because the TargetId is the suffix.
|
|
11651
11651
|
e.createObjectStore("targets", {
|
|
11652
11652
|
keyPath: "targetId"
|
|
11653
|
-
}).createIndex("queryTargetsIndex",
|
|
11653
|
+
}).createIndex("queryTargetsIndex", k, {
|
|
11654
11654
|
unique: !0
|
|
11655
11655
|
}), e.createObjectStore("targetGlobal");
|
|
11656
11656
|
}
|
|
11657
11657
|
|
|
11658
|
-
const
|
|
11658
|
+
const Ae = "Failed to obtain exclusive access to the persistence layer. To allow shared access, multi-tab synchronization has to be enabled in all tabs. If you are using `experimentalForceOwningTab:true`, make sure that only one tab has persistence enabled at any given time.";
|
|
11659
11659
|
|
|
11660
11660
|
/**
|
|
11661
11661
|
* Oldest acceptable age in milliseconds for client metadata before the client
|
|
@@ -11731,7 +11731,7 @@ class __PRIVATE_IndexedDbPersistence {
|
|
|
11731
11731
|
/** The last time we garbage collected the client metadata object store. */
|
|
11732
11732
|
this.hi = Number.NEGATIVE_INFINITY,
|
|
11733
11733
|
/** A listener to notify on primary state changes. */
|
|
11734
|
-
this.Pi = e => Promise.resolve(), !__PRIVATE_IndexedDbPersistence.D()) throw new FirestoreError(
|
|
11734
|
+
this.Pi = e => Promise.resolve(), !__PRIVATE_IndexedDbPersistence.D()) throw new FirestoreError(C.UNIMPLEMENTED, "This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");
|
|
11735
11735
|
this.referenceDelegate = new __PRIVATE_IndexedDbLruDelegateImpl(this, r), this.Ii = t + "main",
|
|
11736
11736
|
this.serializer = new __PRIVATE_LocalSerializer(_), this.Ti = new __PRIVATE_SimpleDb(this.Ii, this.ai, new __PRIVATE_SchemaConverter(this.serializer)),
|
|
11737
11737
|
this.qr = new __PRIVATE_IndexedDbTargetCache(this.referenceDelegate, this.serializer),
|
|
@@ -11751,7 +11751,7 @@ class __PRIVATE_IndexedDbPersistence {
|
|
|
11751
11751
|
if (!this.isPrimary && !this.allowTabSynchronization)
|
|
11752
11752
|
// Fail `start()` if `synchronizeTabs` is disabled and we cannot
|
|
11753
11753
|
// obtain the primary lease.
|
|
11754
|
-
throw new FirestoreError(
|
|
11754
|
+
throw new FirestoreError(C.FAILED_PRECONDITION, Ae);
|
|
11755
11755
|
return this.Ai(), this.Ri(), this.Vi(), this.runTransaction("getHighestListenSequenceNumber", "readonly", (e => this.qr.getHighestSequenceNumber(e)));
|
|
11756
11756
|
})).then((e => {
|
|
11757
11757
|
this.Lr = new __PRIVATE_ListenSequence(e, this.oi);
|
|
@@ -11893,7 +11893,7 @@ class __PRIVATE_IndexedDbPersistence {
|
|
|
11893
11893
|
// settings is not supported.
|
|
11894
11894
|
// TODO(b/114226234): Remove this check when `synchronizeTabs` can
|
|
11895
11895
|
// no longer be turned off.
|
|
11896
|
-
throw new FirestoreError(
|
|
11896
|
+
throw new FirestoreError(C.FAILED_PRECONDITION, Ae);
|
|
11897
11897
|
return !1;
|
|
11898
11898
|
}
|
|
11899
11899
|
}
|
|
@@ -11963,7 +11963,7 @@ class __PRIVATE_IndexedDbPersistence {
|
|
|
11963
11963
|
const r = "readonly" === t ? "readonly" : "readwrite", i =
|
|
11964
11964
|
/** Returns the object stores for the provided schema. */
|
|
11965
11965
|
function __PRIVATE_getObjectStores(e) {
|
|
11966
|
-
return 15 === e ?
|
|
11966
|
+
return 15 === e ? ee : 14 === e ? X : 13 === e ? Z : 12 === e ? Y : 11 === e ? J : void fail();
|
|
11967
11967
|
}(this.ai);
|
|
11968
11968
|
let s;
|
|
11969
11969
|
// Do all transactions as readwrite against all object stores, since we
|
|
@@ -11971,7 +11971,7 @@ class __PRIVATE_IndexedDbPersistence {
|
|
|
11971
11971
|
return this.Ti.runTransaction(e, r, i, (r => (s = new __PRIVATE_IndexedDbTransaction(r, this.Lr ? this.Lr.next() : __PRIVATE_ListenSequence._e),
|
|
11972
11972
|
"readwrite-primary" === t ? this.fi(s).next((e => !!e || this.gi(s))).next((t => {
|
|
11973
11973
|
if (!t) throw __PRIVATE_logError(`Failed to obtain primary lease for action '${e}'.`),
|
|
11974
|
-
this.isPrimary = !1, this.si.enqueueRetryable((() => this.Pi(!1))), new FirestoreError(
|
|
11974
|
+
this.isPrimary = !1, this.si.enqueueRetryable((() => this.Pi(!1))), new FirestoreError(C.FAILED_PRECONDITION, F);
|
|
11975
11975
|
return n(s);
|
|
11976
11976
|
})).next((e => this.yi(s).next((() => e)))) : this.Li(s).next((() => n(s)))))).then((e => (s.raiseOnCommittedEvent(),
|
|
11977
11977
|
e)));
|
|
@@ -11984,7 +11984,7 @@ class __PRIVATE_IndexedDbPersistence {
|
|
|
11984
11984
|
// be turned off.
|
|
11985
11985
|
Li(e) {
|
|
11986
11986
|
return __PRIVATE_primaryClientStore(e).get("owner").next((e => {
|
|
11987
|
-
if (null !== e && this.Di(e.leaseTimestampMs, 5e3) && !this.Fi(e.ownerId) && !this.wi(e) && !(this._i || this.allowTabSynchronization && e.allowTabSynchronization)) throw new FirestoreError(
|
|
11987
|
+
if (null !== e && this.Di(e.leaseTimestampMs, 5e3) && !this.Fi(e.ownerId) && !this.wi(e) && !(this._i || this.allowTabSynchronization && e.allowTabSynchronization)) throw new FirestoreError(C.FAILED_PRECONDITION, Ae);
|
|
11988
11988
|
}));
|
|
11989
11989
|
}
|
|
11990
11990
|
/**
|
|
@@ -13469,7 +13469,7 @@ class __PRIVATE_BrowserConnectivityMonitor {
|
|
|
13469
13469
|
/**
|
|
13470
13470
|
* The value returned from the most recent invocation of
|
|
13471
13471
|
* `generateUniqueDebugId()`, or null if it has never been invoked.
|
|
13472
|
-
*/ let
|
|
13472
|
+
*/ let Re = null;
|
|
13473
13473
|
|
|
13474
13474
|
/**
|
|
13475
13475
|
* Generates and returns an initial value for `lastUniqueDebugId`.
|
|
@@ -13494,9 +13494,9 @@ class __PRIVATE_BrowserConnectivityMonitor {
|
|
|
13494
13494
|
* @return the 10-character generated ID (e.g. "0xa1b2c3d4").
|
|
13495
13495
|
*/
|
|
13496
13496
|
function __PRIVATE_generateUniqueDebugId() {
|
|
13497
|
-
return null ===
|
|
13497
|
+
return null === Re ? Re = function __PRIVATE_generateInitialUniqueDebugId() {
|
|
13498
13498
|
return 268435456 + Math.round(2147483648 * Math.random());
|
|
13499
|
-
}() :
|
|
13499
|
+
}() : Re++, "0x" + Re.toString(16);
|
|
13500
13500
|
}
|
|
13501
13501
|
|
|
13502
13502
|
/**
|
|
@@ -13514,7 +13514,7 @@ function __PRIVATE_generateUniqueDebugId() {
|
|
|
13514
13514
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13515
13515
|
* See the License for the specific language governing permissions and
|
|
13516
13516
|
* limitations under the License.
|
|
13517
|
-
*/ const
|
|
13517
|
+
*/ const Ve = {
|
|
13518
13518
|
BatchGetDocuments: "batchGet",
|
|
13519
13519
|
Commit: "commit",
|
|
13520
13520
|
RunQuery: "runQuery",
|
|
@@ -13592,7 +13592,7 @@ class __PRIVATE_StreamBridge {
|
|
|
13592
13592
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13593
13593
|
* See the License for the specific language governing permissions and
|
|
13594
13594
|
* limitations under the License.
|
|
13595
|
-
*/ const
|
|
13595
|
+
*/ const me = "WebChannelConnection";
|
|
13596
13596
|
|
|
13597
13597
|
class __PRIVATE_WebChannelConnection extends
|
|
13598
13598
|
/**
|
|
@@ -13636,7 +13636,7 @@ class __PRIVATE_RestConnection {
|
|
|
13636
13636
|
// SDK_VERSION is updated to different value at runtime depending on the entry point,
|
|
13637
13637
|
// so we need to get its value when we need it in a function.
|
|
13638
13638
|
function __PRIVATE_getGoogApiClientValue() {
|
|
13639
|
-
return "gl-js/ fire/" +
|
|
13639
|
+
return "gl-js/ fire/" + b;
|
|
13640
13640
|
}(),
|
|
13641
13641
|
// Content-Type: text/plain will avoid preflight requests which might
|
|
13642
13642
|
// mess with CORS and redirects by proxies. If we add custom headers
|
|
@@ -13646,7 +13646,7 @@ class __PRIVATE_RestConnection {
|
|
|
13646
13646
|
t && t.headers.forEach(((t, n) => e[n] = t)), n && n.headers.forEach(((t, n) => e[n] = t));
|
|
13647
13647
|
}
|
|
13648
13648
|
So(e, t) {
|
|
13649
|
-
const n =
|
|
13649
|
+
const n = Ve[e];
|
|
13650
13650
|
return `${this.mo}/v1/${t}:${n}`;
|
|
13651
13651
|
}
|
|
13652
13652
|
} {
|
|
@@ -13663,17 +13663,17 @@ class __PRIVATE_RestConnection {
|
|
|
13663
13663
|
switch (_.getLastErrorCode()) {
|
|
13664
13664
|
case ErrorCode.NO_ERROR:
|
|
13665
13665
|
const t = _.getResponseJson();
|
|
13666
|
-
__PRIVATE_logDebug(
|
|
13666
|
+
__PRIVATE_logDebug(me, `XHR for RPC '${e}' ${i} received:`, JSON.stringify(t)),
|
|
13667
13667
|
s(t);
|
|
13668
13668
|
break;
|
|
13669
13669
|
|
|
13670
13670
|
case ErrorCode.TIMEOUT:
|
|
13671
|
-
__PRIVATE_logDebug(
|
|
13671
|
+
__PRIVATE_logDebug(me, `RPC '${e}' ${i} timed out`), o(new FirestoreError(C.DEADLINE_EXCEEDED, "Request time out"));
|
|
13672
13672
|
break;
|
|
13673
13673
|
|
|
13674
13674
|
case ErrorCode.HTTP_ERROR:
|
|
13675
13675
|
const n = _.getStatus();
|
|
13676
|
-
if (__PRIVATE_logDebug(
|
|
13676
|
+
if (__PRIVATE_logDebug(me, `RPC '${e}' ${i} failed with status:`, n, "response text:", _.getResponseText()),
|
|
13677
13677
|
n > 0) {
|
|
13678
13678
|
let e = _.getResponseJson();
|
|
13679
13679
|
Array.isArray(e) && (e = e[0]);
|
|
@@ -13681,25 +13681,25 @@ class __PRIVATE_RestConnection {
|
|
|
13681
13681
|
if (t && t.status && t.message) {
|
|
13682
13682
|
const e = function __PRIVATE_mapCodeFromHttpResponseErrorStatus(e) {
|
|
13683
13683
|
const t = e.toLowerCase().replace(/_/g, "-");
|
|
13684
|
-
return Object.values(
|
|
13684
|
+
return Object.values(C).indexOf(t) >= 0 ? t : C.UNKNOWN;
|
|
13685
13685
|
}(t.status);
|
|
13686
13686
|
o(new FirestoreError(e, t.message));
|
|
13687
|
-
} else o(new FirestoreError(
|
|
13687
|
+
} else o(new FirestoreError(C.UNKNOWN, "Server responded with status " + _.getStatus()));
|
|
13688
13688
|
} else
|
|
13689
13689
|
// If we received an HTTP_ERROR but there's no status code,
|
|
13690
13690
|
// it's most probably a connection issue
|
|
13691
|
-
o(new FirestoreError(
|
|
13691
|
+
o(new FirestoreError(C.UNAVAILABLE, "Connection failed."));
|
|
13692
13692
|
break;
|
|
13693
13693
|
|
|
13694
13694
|
default:
|
|
13695
13695
|
fail();
|
|
13696
13696
|
}
|
|
13697
13697
|
} finally {
|
|
13698
|
-
__PRIVATE_logDebug(
|
|
13698
|
+
__PRIVATE_logDebug(me, `RPC '${e}' ${i} completed.`);
|
|
13699
13699
|
}
|
|
13700
13700
|
}));
|
|
13701
13701
|
const a = JSON.stringify(r);
|
|
13702
|
-
__PRIVATE_logDebug(
|
|
13702
|
+
__PRIVATE_logDebug(me, `RPC '${e}' ${i} sending request:`, r), _.send(t, "POST", a, n, 15);
|
|
13703
13703
|
}));
|
|
13704
13704
|
}
|
|
13705
13705
|
vo(e, t, n) {
|
|
@@ -13727,8 +13727,9 @@ class __PRIVATE_RestConnection {
|
|
|
13727
13727
|
forceLongPolling: this.forceLongPolling,
|
|
13728
13728
|
detectBufferingProxy: this.autoDetectLongPolling
|
|
13729
13729
|
}, a = this.longPollingOptions.timeoutSeconds;
|
|
13730
|
-
void 0 !== a && (_.longPollingTimeout = Math.round(1e3 * a)), this.useFetchStreams && (
|
|
13731
|
-
|
|
13730
|
+
void 0 !== a && (_.longPollingTimeout = Math.round(1e3 * a)), this.useFetchStreams && (
|
|
13731
|
+
// TODO(b/307942499): switch to `useFetchStreams` once WebChannel is fixed.
|
|
13732
|
+
_.xmlHttpFactory = new FetchXmlHttpFactory({})), this.bo(_.initMessageHeaders, t, n),
|
|
13732
13733
|
// Sending the custom headers we just added to request.initMessageHeaders
|
|
13733
13734
|
// (Authorization, etc.) will trigger the browser to make a CORS preflight
|
|
13734
13735
|
// request because the XHR will no longer meet the criteria for a "simple"
|
|
@@ -13740,7 +13741,7 @@ class __PRIVATE_RestConnection {
|
|
|
13740
13741
|
// which is recognized by the webchannel backend.
|
|
13741
13742
|
_.encodeInitMessageHeaders = !0;
|
|
13742
13743
|
const u = i.join("");
|
|
13743
|
-
__PRIVATE_logDebug(
|
|
13744
|
+
__PRIVATE_logDebug(me, `Creating RPC '${e}' stream ${r}: ${u}`, _);
|
|
13744
13745
|
const c = s.createWebChannel(u, _);
|
|
13745
13746
|
// WebChannel supports sending the first message with the handshake - saving
|
|
13746
13747
|
// a network round trip. However, it will have to call send in the same
|
|
@@ -13753,8 +13754,8 @@ class __PRIVATE_RestConnection {
|
|
|
13753
13754
|
// on a closed stream
|
|
13754
13755
|
const P = new __PRIVATE_StreamBridge({
|
|
13755
13756
|
co: t => {
|
|
13756
|
-
h ? __PRIVATE_logDebug(
|
|
13757
|
-
c.open(), l = !0), __PRIVATE_logDebug(
|
|
13757
|
+
h ? __PRIVATE_logDebug(me, `Not sending because RPC '${e}' stream ${r} is closed:`, t) : (l || (__PRIVATE_logDebug(me, `Opening RPC '${e}' stream ${r} transport.`),
|
|
13758
|
+
c.open(), l = !0), __PRIVATE_logDebug(me, `RPC '${e}' stream ${r} sending:`, t),
|
|
13758
13759
|
c.send(t));
|
|
13759
13760
|
},
|
|
13760
13761
|
lo: () => c.close()
|
|
@@ -13776,13 +13777,13 @@ class __PRIVATE_RestConnection {
|
|
|
13776
13777
|
// Note that eventually this function could go away if we are confident
|
|
13777
13778
|
// enough the code is exception free.
|
|
13778
13779
|
return __PRIVATE_unguardedEventListen(c, WebChannel.EventType.OPEN, (() => {
|
|
13779
|
-
h || __PRIVATE_logDebug(
|
|
13780
|
+
h || __PRIVATE_logDebug(me, `RPC '${e}' stream ${r} transport opened.`);
|
|
13780
13781
|
})), __PRIVATE_unguardedEventListen(c, WebChannel.EventType.CLOSE, (() => {
|
|
13781
|
-
h || (h = !0, __PRIVATE_logDebug(
|
|
13782
|
+
h || (h = !0, __PRIVATE_logDebug(me, `RPC '${e}' stream ${r} transport closed`),
|
|
13782
13783
|
P.Ro());
|
|
13783
13784
|
})), __PRIVATE_unguardedEventListen(c, WebChannel.EventType.ERROR, (t => {
|
|
13784
|
-
h || (h = !0, __PRIVATE_logWarn(
|
|
13785
|
-
P.Ro(new FirestoreError(
|
|
13785
|
+
h || (h = !0, __PRIVATE_logWarn(me, `RPC '${e}' stream ${r} transport errored:`, t),
|
|
13786
|
+
P.Ro(new FirestoreError(C.UNAVAILABLE, "The operation could not be completed")));
|
|
13786
13787
|
})), __PRIVATE_unguardedEventListen(c, WebChannel.EventType.MESSAGE, (t => {
|
|
13787
13788
|
var n;
|
|
13788
13789
|
if (!h) {
|
|
@@ -13795,7 +13796,7 @@ class __PRIVATE_RestConnection {
|
|
|
13795
13796
|
// Use any because msgData.error is not typed.
|
|
13796
13797
|
const s = i, o = s.error || (null === (n = s[0]) || void 0 === n ? void 0 : n.error);
|
|
13797
13798
|
if (o) {
|
|
13798
|
-
__PRIVATE_logDebug(
|
|
13799
|
+
__PRIVATE_logDebug(me, `RPC '${e}' stream ${r} received error:`, o);
|
|
13799
13800
|
// error.status will be a string like 'OK' or 'NOT_FOUND'.
|
|
13800
13801
|
const t = o.status;
|
|
13801
13802
|
let n =
|
|
@@ -13808,16 +13809,16 @@ class __PRIVATE_RestConnection {
|
|
|
13808
13809
|
function __PRIVATE_mapCodeFromRpcStatus(e) {
|
|
13809
13810
|
// lookup by string
|
|
13810
13811
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13811
|
-
const t =
|
|
13812
|
+
const t = ue[e];
|
|
13812
13813
|
if (void 0 !== t) return __PRIVATE_mapCodeFromRpcCode(t);
|
|
13813
13814
|
}(t), i = o.message;
|
|
13814
|
-
void 0 === n && (n =
|
|
13815
|
+
void 0 === n && (n = C.INTERNAL, i = "Unknown error status: " + t + " with message " + o.message),
|
|
13815
13816
|
// Mark closed so no further events are propagated
|
|
13816
13817
|
h = !0, P.Ro(new FirestoreError(n, i)), c.close();
|
|
13817
|
-
} else __PRIVATE_logDebug(
|
|
13818
|
+
} else __PRIVATE_logDebug(me, `RPC '${e}' stream ${r} received:`, i), P.Vo(i);
|
|
13818
13819
|
}
|
|
13819
13820
|
})), __PRIVATE_unguardedEventListen(o, Event.STAT_EVENT, (t => {
|
|
13820
|
-
t.stat === Stat.PROXY ? __PRIVATE_logDebug(
|
|
13821
|
+
t.stat === Stat.PROXY ? __PRIVATE_logDebug(me, `RPC '${e}' stream ${r} detected buffering proxy`) : t.stat === Stat.NOPROXY && __PRIVATE_logDebug(me, `RPC '${e}' stream ${r} detected no buffering proxy`);
|
|
13821
13822
|
})), setTimeout((() => {
|
|
13822
13823
|
// Technically we could/should wait for the WebChannel opened event,
|
|
13823
13824
|
// but because we want to send the first message with the WebChannel
|
|
@@ -14141,10 +14142,10 @@ class __PRIVATE_PersistentStream {
|
|
|
14141
14142
|
// underlying stream), guaranteeing they won't execute.
|
|
14142
14143
|
this.Uo++, 4 /* PersistentStreamState.Error */ !== e ?
|
|
14143
14144
|
// If this is an intentional close ensure we don't delay our next connection attempt.
|
|
14144
|
-
this.zo.reset() : t && t.code ===
|
|
14145
|
+
this.zo.reset() : t && t.code === C.RESOURCE_EXHAUSTED ? (
|
|
14145
14146
|
// Log the error. (Probably either 'quota exceeded' or 'max queue length reached'.)
|
|
14146
14147
|
__PRIVATE_logError(t.toString()), __PRIVATE_logError("Using maximum backoff delay to prevent overloading the backend."),
|
|
14147
|
-
this.zo.Lo()) : t && t.code ===
|
|
14148
|
+
this.zo.Lo()) : t && t.code === C.UNAUTHENTICATED && 3 /* PersistentStreamState.Healthy */ !== this.state && (
|
|
14148
14149
|
// "unauthenticated" error means the token was rejected. This should rarely
|
|
14149
14150
|
// happen since both Auth and AppCheck ensure a sufficient TTL when we
|
|
14150
14151
|
// request a token. If a user manually resets their system clock this can
|
|
@@ -14180,7 +14181,7 @@ class __PRIVATE_PersistentStream {
|
|
|
14180
14181
|
this.s_(e, n);
|
|
14181
14182
|
}), (t => {
|
|
14182
14183
|
e((() => {
|
|
14183
|
-
const e = new FirestoreError(
|
|
14184
|
+
const e = new FirestoreError(C.UNKNOWN, "Fetching auth token failed: " + t.message);
|
|
14184
14185
|
return this.o_(e);
|
|
14185
14186
|
}));
|
|
14186
14187
|
}));
|
|
@@ -14393,18 +14394,18 @@ class __PRIVATE_DatastoreImpl extends class Datastore {} {
|
|
|
14393
14394
|
this.serializer = r, this.d_ = !1;
|
|
14394
14395
|
}
|
|
14395
14396
|
A_() {
|
|
14396
|
-
if (this.d_) throw new FirestoreError(
|
|
14397
|
+
if (this.d_) throw new FirestoreError(C.FAILED_PRECONDITION, "The client has already been terminated.");
|
|
14397
14398
|
}
|
|
14398
14399
|
/** Invokes the provided RPC with auth and AppCheck tokens. */ wo(e, t, n) {
|
|
14399
14400
|
return this.A_(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, i]) => this.connection.wo(e, t, n, r, i))).catch((e => {
|
|
14400
|
-
throw "FirebaseError" === e.name ? (e.code ===
|
|
14401
|
-
this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(
|
|
14401
|
+
throw "FirebaseError" === e.name ? (e.code === C.UNAUTHENTICATED && (this.authCredentials.invalidateToken(),
|
|
14402
|
+
this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(C.UNKNOWN, e.toString());
|
|
14402
14403
|
}));
|
|
14403
14404
|
}
|
|
14404
14405
|
/** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ Co(e, t, n, r) {
|
|
14405
14406
|
return this.A_(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([i, s]) => this.connection.Co(e, t, n, i, s, r))).catch((e => {
|
|
14406
|
-
throw "FirebaseError" === e.name ? (e.code ===
|
|
14407
|
-
this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(
|
|
14407
|
+
throw "FirebaseError" === e.name ? (e.code === C.UNAUTHENTICATED && (this.authCredentials.invalidateToken(),
|
|
14408
|
+
this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(C.UNKNOWN, e.toString());
|
|
14408
14409
|
}));
|
|
14409
14410
|
}
|
|
14410
14411
|
terminate() {
|
|
@@ -14894,7 +14895,7 @@ async function __PRIVATE_onWriteStreamClose(e, t) {
|
|
|
14894
14895
|
// Only handle permanent errors here. If it's transient, just let the retry
|
|
14895
14896
|
// logic kick in.
|
|
14896
14897
|
if (function __PRIVATE_isPermanentWriteError(e) {
|
|
14897
|
-
return __PRIVATE_isPermanentError(e) && e !==
|
|
14898
|
+
return __PRIVATE_isPermanentError(e) && e !== C.ABORTED;
|
|
14898
14899
|
}(t.code)) {
|
|
14899
14900
|
// This was a permanent error, the request itself was the problem
|
|
14900
14901
|
// so it's not going to succeed if we resend it.
|
|
@@ -15075,7 +15076,7 @@ class DelayedOperation {
|
|
|
15075
15076
|
* As long as the operation has not yet been run, calling cancel() provides a
|
|
15076
15077
|
* guarantee that the operation will not be run.
|
|
15077
15078
|
*/ cancel(e) {
|
|
15078
|
-
null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new FirestoreError(
|
|
15079
|
+
null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new FirestoreError(C.CANCELLED, "Operation cancelled" + (e ? ": " + e : ""))));
|
|
15079
15080
|
}
|
|
15080
15081
|
handleDelayElapsed() {
|
|
15081
15082
|
this.asyncQueue.enqueueAndForget((() => null !== this.timerHandle ? (this.clearTimeout(),
|
|
@@ -15091,7 +15092,7 @@ class DelayedOperation {
|
|
|
15091
15092
|
* Returns a FirestoreError that can be surfaced to the user if the provided
|
|
15092
15093
|
* error is an IndexedDbTransactionError. Re-throws the error otherwise.
|
|
15093
15094
|
*/ function __PRIVATE_wrapInUserErrorIfRecoverable(e, t) {
|
|
15094
|
-
if (__PRIVATE_logError("AsyncQueue", `${t}: ${e}`), __PRIVATE_isIndexedDbTransactionError(e)) return new FirestoreError(
|
|
15095
|
+
if (__PRIVATE_logError("AsyncQueue", `${t}: ${e}`), __PRIVATE_isIndexedDbTransactionError(e)) return new FirestoreError(C.UNAVAILABLE, `${t}: ${e}`);
|
|
15095
15096
|
throw e;
|
|
15096
15097
|
}
|
|
15097
15098
|
|
|
@@ -16371,7 +16372,7 @@ async function __PRIVATE_syncEngineHandleCredentialChange(e, t) {
|
|
|
16371
16372
|
function __PRIVATE_rejectOutstandingPendingWritesCallbacks(e, t) {
|
|
16372
16373
|
e.ba.forEach((e => {
|
|
16373
16374
|
e.forEach((e => {
|
|
16374
|
-
e.reject(new FirestoreError(
|
|
16375
|
+
e.reject(new FirestoreError(C.CANCELLED, t));
|
|
16375
16376
|
}));
|
|
16376
16377
|
})), e.ba.clear();
|
|
16377
16378
|
}(n, "'waitForPendingWrites' promise is rejected due to a user change."),
|
|
@@ -16800,7 +16801,7 @@ class __PRIVATE_LruGcMemoryOfflineComponentProvider extends MemoryOfflineCompone
|
|
|
16800
16801
|
}
|
|
16801
16802
|
createSharedClientState(e) {
|
|
16802
16803
|
const t = __PRIVATE_getWindow();
|
|
16803
|
-
if (!__PRIVATE_WebStorageSharedClientState.D(t)) throw new FirestoreError(
|
|
16804
|
+
if (!__PRIVATE_WebStorageSharedClientState.D(t)) throw new FirestoreError(C.UNIMPLEMENTED, "IndexedDB persistence is only available on platforms that support LocalStorage.");
|
|
16804
16805
|
const n = __PRIVATE_indexedDbStoragePrefix(e.databaseInfo.databaseId, e.databaseInfo.persistenceKey);
|
|
16805
16806
|
return new __PRIVATE_WebStorageSharedClientState(t, e.asyncQueue, n, e.clientId, e.initialUser);
|
|
16806
16807
|
}
|
|
@@ -17137,7 +17138,7 @@ class Transaction$2 {
|
|
|
17137
17138
|
this.writtenDocs = new Set;
|
|
17138
17139
|
}
|
|
17139
17140
|
async lookup(e) {
|
|
17140
|
-
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new FirestoreError(
|
|
17141
|
+
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new FirestoreError(C.INVALID_ARGUMENT, "Firestore transactions require all reads to be executed before all writes.");
|
|
17141
17142
|
const t = await async function __PRIVATE_invokeBatchGetDocumentsRpc(e, t) {
|
|
17142
17143
|
const n = __PRIVATE_debugCast(e), r = __PRIVATE_getEncodedDatabaseId(n.serializer) + "/documents", i = {
|
|
17143
17144
|
documents: t.map((e => __PRIVATE_toName(n.serializer, e)))
|
|
@@ -17198,7 +17199,7 @@ class Transaction$2 {
|
|
|
17198
17199
|
if (n) {
|
|
17199
17200
|
if (!t.isEqual(n))
|
|
17200
17201
|
// This transaction will fail no matter what.
|
|
17201
|
-
throw new FirestoreError(
|
|
17202
|
+
throw new FirestoreError(C.ABORTED, "Document version changed between two reads.");
|
|
17202
17203
|
} else this.readVersions.set(e.key.toString(), t);
|
|
17203
17204
|
}
|
|
17204
17205
|
/**
|
|
@@ -17225,7 +17226,7 @@ class Transaction$2 {
|
|
|
17225
17226
|
// express that to the backend, we have to validate locally.
|
|
17226
17227
|
// Note: this can change once we can send separate verify writes in the
|
|
17227
17228
|
// transaction.
|
|
17228
|
-
throw new FirestoreError(
|
|
17229
|
+
throw new FirestoreError(C.INVALID_ARGUMENT, "Can't update a document that doesn't exist.");
|
|
17229
17230
|
// Document exists, base precondition on document update time.
|
|
17230
17231
|
return Precondition.updateTime(t);
|
|
17231
17232
|
}
|
|
@@ -17366,7 +17367,7 @@ class FirestoreClient {
|
|
|
17366
17367
|
* Checks that the client has not been terminated. Ensures that other methods on //
|
|
17367
17368
|
* this class cannot be called after the client is terminated. //
|
|
17368
17369
|
*/ verifyNotTerminated() {
|
|
17369
|
-
if (this.asyncQueue.isShuttingDown) throw new FirestoreError(
|
|
17370
|
+
if (this.asyncQueue.isShuttingDown) throw new FirestoreError(C.FAILED_PRECONDITION, "The client has already been terminated.");
|
|
17370
17371
|
}
|
|
17371
17372
|
terminate() {
|
|
17372
17373
|
this.asyncQueue.enterRestrictedMode();
|
|
@@ -17416,7 +17417,7 @@ async function __PRIVATE_setOnlineComponentProvider(e, t) {
|
|
|
17416
17417
|
* Decides whether the provided error allows us to gracefully disable
|
|
17417
17418
|
* persistence (as opposed to crashing the client).
|
|
17418
17419
|
*/ function __PRIVATE_canFallbackFromIndexedDbError(e) {
|
|
17419
|
-
return "FirebaseError" === e.name ? e.code ===
|
|
17420
|
+
return "FirebaseError" === e.name ? e.code === C.FAILED_PRECONDITION || e.code === C.UNIMPLEMENTED : !("undefined" != typeof DOMException && e instanceof DOMException) || (
|
|
17420
17421
|
// When the browser is out of quota we could get either quota exceeded
|
|
17421
17422
|
// or an aborted error depending on whether the error happened during
|
|
17422
17423
|
// schema migration.
|
|
@@ -17508,7 +17509,7 @@ async function __PRIVATE_getEventManager(e) {
|
|
|
17508
17509
|
const n = __PRIVATE_debugCast(e);
|
|
17509
17510
|
return n.persistence.runTransaction("read document", "readonly", (e => n.localDocuments.getDocument(e, t)));
|
|
17510
17511
|
}(e, t);
|
|
17511
|
-
r.isFoundDocument() ? n.resolve(r) : r.isNoDocument() ? n.resolve(null) : n.reject(new FirestoreError(
|
|
17512
|
+
r.isFoundDocument() ? n.resolve(r) : r.isNoDocument() ? n.resolve(null) : n.reject(new FirestoreError(C.UNAVAILABLE, "Failed to get document from cache. (However, this document may exist on the server. Run again without setting 'source' in the GetOptions to attempt to retrieve the document from the server.)"));
|
|
17512
17513
|
} catch (e) {
|
|
17513
17514
|
const r = __PRIVATE_wrapInUserErrorIfRecoverable(e, `Failed to get document '${t} from cache`);
|
|
17514
17515
|
n.reject(r);
|
|
@@ -17537,7 +17538,7 @@ function __PRIVATE_firestoreClientGetDocumentViaSnapshotListener(e, t, n = {}) {
|
|
|
17537
17538
|
// the server so we can deliver that even when you're
|
|
17538
17539
|
// offline 2) Actually reject the Promise in the online case
|
|
17539
17540
|
// if the document doesn't exist.
|
|
17540
|
-
i.reject(new FirestoreError(
|
|
17541
|
+
i.reject(new FirestoreError(C.UNAVAILABLE, "Failed to get document because the client is offline.")) : _ && s.fromCache && r && "server" === r.source ? i.reject(new FirestoreError(C.UNAVAILABLE, 'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')) : i.resolve(s);
|
|
17541
17542
|
},
|
|
17542
17543
|
error: e => i.reject(e)
|
|
17543
17544
|
}), o = new __PRIVATE_QueryListener(__PRIVATE_newQueryForPath(n.path), s, {
|
|
@@ -17574,7 +17575,7 @@ function __PRIVATE_firestoreClientGetDocumentsViaSnapshotListener(e, t, n = {})
|
|
|
17574
17575
|
next: n => {
|
|
17575
17576
|
// Remove query first before passing event to user to avoid
|
|
17576
17577
|
// user actions affecting the now stale query.
|
|
17577
|
-
t.enqueueAndForget((() => __PRIVATE_eventManagerUnlisten(e, o))), n.fromCache && "server" === r.source ? i.reject(new FirestoreError(
|
|
17578
|
+
t.enqueueAndForget((() => __PRIVATE_eventManagerUnlisten(e, o))), n.fromCache && "server" === r.source ? i.reject(new FirestoreError(C.UNAVAILABLE, 'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')) : i.resolve(n);
|
|
17578
17579
|
},
|
|
17579
17580
|
error: e => i.reject(e)
|
|
17580
17581
|
}), o = new __PRIVATE_QueryListener(n, s, {
|
|
@@ -17774,7 +17775,7 @@ function __PRIVATE_cloneLongPollingOptions(e) {
|
|
|
17774
17775
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17775
17776
|
* See the License for the specific language governing permissions and
|
|
17776
17777
|
* limitations under the License.
|
|
17777
|
-
*/ const
|
|
17778
|
+
*/ const fe = new Map;
|
|
17778
17779
|
|
|
17779
17780
|
/**
|
|
17780
17781
|
* An instance map that ensures only one Datastore exists per Firestore
|
|
@@ -17797,28 +17798,28 @@ function __PRIVATE_cloneLongPollingOptions(e) {
|
|
|
17797
17798
|
* limitations under the License.
|
|
17798
17799
|
*/
|
|
17799
17800
|
function __PRIVATE_validateNonEmptyArgument(e, t, n) {
|
|
17800
|
-
if (!n) throw new FirestoreError(
|
|
17801
|
+
if (!n) throw new FirestoreError(C.INVALID_ARGUMENT, `Function ${e}() cannot be called with an empty ${t}.`);
|
|
17801
17802
|
}
|
|
17802
17803
|
|
|
17803
17804
|
/**
|
|
17804
17805
|
* Validates that two boolean options are not set at the same time.
|
|
17805
17806
|
* @internal
|
|
17806
17807
|
*/ function __PRIVATE_validateIsNotUsedTogether(e, t, n, r) {
|
|
17807
|
-
if (!0 === t && !0 === r) throw new FirestoreError(
|
|
17808
|
+
if (!0 === t && !0 === r) throw new FirestoreError(C.INVALID_ARGUMENT, `${e} and ${n} cannot be used together.`);
|
|
17808
17809
|
}
|
|
17809
17810
|
|
|
17810
17811
|
/**
|
|
17811
17812
|
* Validates that `path` refers to a document (indicated by the fact it contains
|
|
17812
17813
|
* an even numbers of segments).
|
|
17813
17814
|
*/ function __PRIVATE_validateDocumentPath(e) {
|
|
17814
|
-
if (!DocumentKey.isDocumentKey(e)) throw new FirestoreError(
|
|
17815
|
+
if (!DocumentKey.isDocumentKey(e)) throw new FirestoreError(C.INVALID_ARGUMENT, `Invalid document reference. Document references must have an even number of segments, but ${e} has ${e.length}.`);
|
|
17815
17816
|
}
|
|
17816
17817
|
|
|
17817
17818
|
/**
|
|
17818
17819
|
* Validates that `path` refers to a collection (indicated by the fact it
|
|
17819
17820
|
* contains an odd numbers of segments).
|
|
17820
17821
|
*/ function __PRIVATE_validateCollectionPath(e) {
|
|
17821
|
-
if (DocumentKey.isDocumentKey(e)) throw new FirestoreError(
|
|
17822
|
+
if (DocumentKey.isDocumentKey(e)) throw new FirestoreError(C.INVALID_ARGUMENT, `Invalid collection reference. Collection references must have an odd number of segments, but ${e} has ${e.length}.`);
|
|
17822
17823
|
}
|
|
17823
17824
|
|
|
17824
17825
|
/**
|
|
@@ -17862,17 +17863,17 @@ t) {
|
|
|
17862
17863
|
// Unwrap Compat types
|
|
17863
17864
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17864
17865
|
e = e._delegate), !(e instanceof t)) {
|
|
17865
|
-
if (t.name === e.constructor.name) throw new FirestoreError(
|
|
17866
|
+
if (t.name === e.constructor.name) throw new FirestoreError(C.INVALID_ARGUMENT, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
|
|
17866
17867
|
{
|
|
17867
17868
|
const n = __PRIVATE_valueDescription(e);
|
|
17868
|
-
throw new FirestoreError(
|
|
17869
|
+
throw new FirestoreError(C.INVALID_ARGUMENT, `Expected type '${t.name}', but it was: ${n}`);
|
|
17869
17870
|
}
|
|
17870
17871
|
}
|
|
17871
17872
|
return e;
|
|
17872
17873
|
}
|
|
17873
17874
|
|
|
17874
17875
|
function __PRIVATE_validatePositiveNumber(e, t) {
|
|
17875
|
-
if (t <= 0) throw new FirestoreError(
|
|
17876
|
+
if (t <= 0) throw new FirestoreError(C.INVALID_ARGUMENT, `Function ${e}() requires a positive number, but it was: ${t}.`);
|
|
17876
17877
|
}
|
|
17877
17878
|
|
|
17878
17879
|
/**
|
|
@@ -17901,12 +17902,12 @@ class FirestoreSettingsImpl {
|
|
|
17901
17902
|
constructor(e) {
|
|
17902
17903
|
var t, n;
|
|
17903
17904
|
if (void 0 === e.host) {
|
|
17904
|
-
if (void 0 !== e.ssl) throw new FirestoreError(
|
|
17905
|
+
if (void 0 !== e.ssl) throw new FirestoreError(C.INVALID_ARGUMENT, "Can't provide ssl option if host option is not set");
|
|
17905
17906
|
this.host = "firestore.googleapis.com", this.ssl = true;
|
|
17906
17907
|
} else this.host = e.host, this.ssl = null === (t = e.ssl) || void 0 === t || t;
|
|
17907
17908
|
if (this.credentials = e.credentials, this.ignoreUndefinedProperties = !!e.ignoreUndefinedProperties,
|
|
17908
17909
|
this.localCache = e.localCache, void 0 === e.cacheSizeBytes) this.cacheSizeBytes = 41943040; else {
|
|
17909
|
-
if (-1 !== e.cacheSizeBytes && e.cacheSizeBytes < 1048576) throw new FirestoreError(
|
|
17910
|
+
if (-1 !== e.cacheSizeBytes && e.cacheSizeBytes < 1048576) throw new FirestoreError(C.INVALID_ARGUMENT, "cacheSizeBytes must be at least 1048576");
|
|
17910
17911
|
this.cacheSizeBytes = e.cacheSizeBytes;
|
|
17911
17912
|
}
|
|
17912
17913
|
__PRIVATE_validateIsNotUsedTogether("experimentalForceLongPolling", e.experimentalForceLongPolling, "experimentalAutoDetectLongPolling", e.experimentalAutoDetectLongPolling),
|
|
@@ -17918,9 +17919,9 @@ class FirestoreSettingsImpl {
|
|
|
17918
17919
|
this.experimentalLongPollingOptions = __PRIVATE_cloneLongPollingOptions(null !== (n = e.experimentalLongPollingOptions) && void 0 !== n ? n : {}),
|
|
17919
17920
|
function __PRIVATE_validateLongPollingOptions(e) {
|
|
17920
17921
|
if (void 0 !== e.timeoutSeconds) {
|
|
17921
|
-
if (isNaN(e.timeoutSeconds)) throw new FirestoreError(
|
|
17922
|
-
if (e.timeoutSeconds < 5) throw new FirestoreError(
|
|
17923
|
-
if (e.timeoutSeconds > 30) throw new FirestoreError(
|
|
17922
|
+
if (isNaN(e.timeoutSeconds)) throw new FirestoreError(C.INVALID_ARGUMENT, `invalid long polling timeout: ${e.timeoutSeconds} (must not be NaN)`);
|
|
17923
|
+
if (e.timeoutSeconds < 5) throw new FirestoreError(C.INVALID_ARGUMENT, `invalid long polling timeout: ${e.timeoutSeconds} (minimum allowed value is 5)`);
|
|
17924
|
+
if (e.timeoutSeconds > 30) throw new FirestoreError(C.INVALID_ARGUMENT, `invalid long polling timeout: ${e.timeoutSeconds} (maximum allowed value is 30)`);
|
|
17924
17925
|
}
|
|
17925
17926
|
}
|
|
17926
17927
|
/**
|
|
@@ -17967,7 +17968,7 @@ class Firestore$1 {
|
|
|
17967
17968
|
* The {@link @firebase/app#FirebaseApp} associated with this `Firestore` service
|
|
17968
17969
|
* instance.
|
|
17969
17970
|
*/ get app() {
|
|
17970
|
-
if (!this._app) throw new FirestoreError(
|
|
17971
|
+
if (!this._app) throw new FirestoreError(C.FAILED_PRECONDITION, "Firestore was not initialized using the Firebase SDK. 'app' is not available");
|
|
17971
17972
|
return this._app;
|
|
17972
17973
|
}
|
|
17973
17974
|
get _initialized() {
|
|
@@ -17977,7 +17978,7 @@ class Firestore$1 {
|
|
|
17977
17978
|
return void 0 !== this._terminateTask;
|
|
17978
17979
|
}
|
|
17979
17980
|
_setSettings(e) {
|
|
17980
|
-
if (this._settingsFrozen) throw new FirestoreError(
|
|
17981
|
+
if (this._settingsFrozen) throw new FirestoreError(C.FAILED_PRECONDITION, "Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");
|
|
17981
17982
|
this._settings = new FirestoreSettingsImpl(e), void 0 !== e.credentials && (this._authCredentials = function __PRIVATE_makeAuthCredentialsProvider(e) {
|
|
17982
17983
|
if (!e) return new __PRIVATE_EmptyAuthCredentialsProvider;
|
|
17983
17984
|
switch (e.type) {
|
|
@@ -17988,7 +17989,7 @@ class Firestore$1 {
|
|
|
17988
17989
|
return e.client;
|
|
17989
17990
|
|
|
17990
17991
|
default:
|
|
17991
|
-
throw new FirestoreError(
|
|
17992
|
+
throw new FirestoreError(C.INVALID_ARGUMENT, "makeAuthCredentialsProvider failed due to invalid credential type");
|
|
17992
17993
|
}
|
|
17993
17994
|
}(e.credentials));
|
|
17994
17995
|
}
|
|
@@ -18020,8 +18021,8 @@ class Firestore$1 {
|
|
|
18020
18021
|
* when the `Firestore` instance is terminated.
|
|
18021
18022
|
*/
|
|
18022
18023
|
return function __PRIVATE_removeComponents(e) {
|
|
18023
|
-
const t =
|
|
18024
|
-
t && (__PRIVATE_logDebug("ComponentProvider", "Removing Datastore"),
|
|
18024
|
+
const t = fe.get(e);
|
|
18025
|
+
t && (__PRIVATE_logDebug("ComponentProvider", "Removing Datastore"), fe.delete(e),
|
|
18025
18026
|
t.terminate());
|
|
18026
18027
|
}(this), Promise.resolve();
|
|
18027
18028
|
}
|
|
@@ -18053,7 +18054,7 @@ class Firestore$1 {
|
|
|
18053
18054
|
// invalid field "uid" and missing field "sub" / "user_id".)
|
|
18054
18055
|
t = createMockUserToken(r.mockUserToken, null === (i = e._app) || void 0 === i ? void 0 : i.options.projectId);
|
|
18055
18056
|
const s = r.mockUserToken.sub || r.mockUserToken.user_id;
|
|
18056
|
-
if (!s) throw new FirestoreError(
|
|
18057
|
+
if (!s) throw new FirestoreError(C.INVALID_ARGUMENT, "mockUserToken must contain 'sub' or 'user_id' field!");
|
|
18057
18058
|
n = new User(s);
|
|
18058
18059
|
}
|
|
18059
18060
|
e._authCredentials = new __PRIVATE_EmulatorAuthCredentialsProvider(new __PRIVATE_OAuthToken(t, n));
|
|
@@ -18173,7 +18174,7 @@ function collection(e, t, ...n) {
|
|
|
18173
18174
|
return __PRIVATE_validateCollectionPath(r), new CollectionReference(e, /* converter= */ null, r);
|
|
18174
18175
|
}
|
|
18175
18176
|
{
|
|
18176
|
-
if (!(e instanceof DocumentReference || e instanceof CollectionReference)) throw new FirestoreError(
|
|
18177
|
+
if (!(e instanceof DocumentReference || e instanceof CollectionReference)) throw new FirestoreError(C.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
18177
18178
|
const r = e._path.child(ResourcePath.fromString(t, ...n));
|
|
18178
18179
|
return __PRIVATE_validateCollectionPath(r), new CollectionReference(e.firestore,
|
|
18179
18180
|
/* converter= */ null, r);
|
|
@@ -18194,7 +18195,7 @@ function collection(e, t, ...n) {
|
|
|
18194
18195
|
* @returns The created `Query`.
|
|
18195
18196
|
*/ function collectionGroup(e, t) {
|
|
18196
18197
|
if (e = __PRIVATE_cast(e, Firestore$1), __PRIVATE_validateNonEmptyArgument("collectionGroup", "collection id", t),
|
|
18197
|
-
t.indexOf("/") >= 0) throw new FirestoreError(
|
|
18198
|
+
t.indexOf("/") >= 0) throw new FirestoreError(C.INVALID_ARGUMENT, `Invalid collection ID '${t}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
|
|
18198
18199
|
return new Query(e,
|
|
18199
18200
|
/* converter= */ null, function __PRIVATE_newQueryForCollectionGroup(e) {
|
|
18200
18201
|
return new __PRIVATE_QueryImpl(ResourcePath.emptyPath(), e);
|
|
@@ -18212,7 +18213,7 @@ function doc(e, t, ...n) {
|
|
|
18212
18213
|
/* converter= */ null, new DocumentKey(r));
|
|
18213
18214
|
}
|
|
18214
18215
|
{
|
|
18215
|
-
if (!(e instanceof DocumentReference || e instanceof CollectionReference)) throw new FirestoreError(
|
|
18216
|
+
if (!(e instanceof DocumentReference || e instanceof CollectionReference)) throw new FirestoreError(C.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
18216
18217
|
const r = e._path.child(ResourcePath.fromString(t, ...n));
|
|
18217
18218
|
return __PRIVATE_validateDocumentPath(r), new DocumentReference(e.firestore, e instanceof CollectionReference ? e.converter : null, new DocumentKey(r));
|
|
18218
18219
|
}
|
|
@@ -18572,7 +18573,7 @@ class LoadBundleTask {
|
|
|
18572
18573
|
* Constant used to indicate the LRU garbage collection should be disabled.
|
|
18573
18574
|
* Set this value as the `cacheSizeBytes` on the settings passed to the
|
|
18574
18575
|
* {@link Firestore} instance.
|
|
18575
|
-
*/ const
|
|
18576
|
+
*/ const ge = -1;
|
|
18576
18577
|
|
|
18577
18578
|
/**
|
|
18578
18579
|
* The Cloud Firestore service interface.
|
|
@@ -18616,10 +18617,10 @@ class LoadBundleTask {
|
|
|
18616
18617
|
identifier: n
|
|
18617
18618
|
}), i = r.getOptions(n);
|
|
18618
18619
|
if (deepEqual(i, t)) return e;
|
|
18619
|
-
throw new FirestoreError(
|
|
18620
|
+
throw new FirestoreError(C.FAILED_PRECONDITION, "initializeFirestore() has already been called with different options. To avoid this error, call initializeFirestore() with the same options as when it was originally called, or call getFirestore() to return the already initialized instance.");
|
|
18620
18621
|
}
|
|
18621
|
-
if (void 0 !== t.cacheSizeBytes && void 0 !== t.localCache) throw new FirestoreError(
|
|
18622
|
-
if (void 0 !== t.cacheSizeBytes && -1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new FirestoreError(
|
|
18622
|
+
if (void 0 !== t.cacheSizeBytes && void 0 !== t.localCache) throw new FirestoreError(C.INVALID_ARGUMENT, "cache and cacheSizeBytes cannot be specified at the same time as cacheSizeBytes willbe deprecated. Instead, specify the cache size in the cache object");
|
|
18623
|
+
if (void 0 !== t.cacheSizeBytes && -1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new FirestoreError(C.INVALID_ARGUMENT, "cacheSizeBytes must be at least 1048576");
|
|
18623
18624
|
return r.initialize({
|
|
18624
18625
|
options: t,
|
|
18625
18626
|
instanceIdentifier: n
|
|
@@ -18688,7 +18689,7 @@ function __PRIVATE_configureFirestore(e) {
|
|
|
18688
18689
|
*/ function enableIndexedDbPersistence(e, t) {
|
|
18689
18690
|
__PRIVATE_verifyNotInitialized(e = __PRIVATE_cast(e, Firestore));
|
|
18690
18691
|
const n = ensureFirestoreConfigured(e);
|
|
18691
|
-
if (n._uninitializedComponentsProvider) throw new FirestoreError(
|
|
18692
|
+
if (n._uninitializedComponentsProvider) throw new FirestoreError(C.FAILED_PRECONDITION, "SDK cache is already specified.");
|
|
18692
18693
|
__PRIVATE_logWarn("enableIndexedDbPersistence() will be deprecated in the future, you can use `FirestoreSettings.cache` instead.");
|
|
18693
18694
|
const r = e._freezeSettings(), i = new OnlineComponentProvider;
|
|
18694
18695
|
return __PRIVATE_setPersistenceProviders(n, i, new __PRIVATE_IndexedDbOfflineComponentProvider(i, r.cacheSizeBytes, null == t ? void 0 : t.forceOwnership));
|
|
@@ -18722,7 +18723,7 @@ function __PRIVATE_configureFirestore(e) {
|
|
|
18722
18723
|
*/ function enableMultiTabIndexedDbPersistence(e) {
|
|
18723
18724
|
__PRIVATE_verifyNotInitialized(e = __PRIVATE_cast(e, Firestore));
|
|
18724
18725
|
const t = ensureFirestoreConfigured(e);
|
|
18725
|
-
if (t._uninitializedComponentsProvider) throw new FirestoreError(
|
|
18726
|
+
if (t._uninitializedComponentsProvider) throw new FirestoreError(C.FAILED_PRECONDITION, "SDK cache is already specified.");
|
|
18726
18727
|
__PRIVATE_logWarn("enableMultiTabIndexedDbPersistence() will be deprecated in the future, you can use `FirestoreSettings.cache` instead.");
|
|
18727
18728
|
const n = e._freezeSettings(), r = new OnlineComponentProvider;
|
|
18728
18729
|
return __PRIVATE_setPersistenceProviders(t, r, new __PRIVATE_MultiTabOfflineComponentProvider(r, n.cacheSizeBytes));
|
|
@@ -18770,7 +18771,7 @@ function __PRIVATE_configureFirestore(e) {
|
|
|
18770
18771
|
* @returns A `Promise` that is resolved when the persistent storage is
|
|
18771
18772
|
* cleared. Otherwise, the promise is rejected with an error.
|
|
18772
18773
|
*/ function clearIndexedDbPersistence(e) {
|
|
18773
|
-
if (e._initialized && !e._terminated) throw new FirestoreError(
|
|
18774
|
+
if (e._initialized && !e._terminated) throw new FirestoreError(C.FAILED_PRECONDITION, "Persistence can only be cleared before a Firestore instance is initialized or after it is terminated.");
|
|
18774
18775
|
const t = new __PRIVATE_Deferred;
|
|
18775
18776
|
return e._queue.enqueueAndForgetEvenWhileRestricted((async () => {
|
|
18776
18777
|
try {
|
|
@@ -18884,7 +18885,7 @@ function __PRIVATE_configureFirestore(e) {
|
|
|
18884
18885
|
}
|
|
18885
18886
|
|
|
18886
18887
|
function __PRIVATE_verifyNotInitialized(e) {
|
|
18887
|
-
if (e._initialized || e._terminated) throw new FirestoreError(
|
|
18888
|
+
if (e._initialized || e._terminated) throw new FirestoreError(C.FAILED_PRECONDITION, "Firestore has already been started and persistence can no longer be enabled. You can only enable persistence before calling any other methods on a Firestore object.");
|
|
18888
18889
|
}
|
|
18889
18890
|
|
|
18890
18891
|
/**
|
|
@@ -18993,7 +18994,7 @@ class AggregateField {
|
|
|
18993
18994
|
try {
|
|
18994
18995
|
return new Bytes(ByteString.fromBase64String(e));
|
|
18995
18996
|
} catch (e) {
|
|
18996
|
-
throw new FirestoreError(
|
|
18997
|
+
throw new FirestoreError(C.INVALID_ARGUMENT, "Failed to construct data from Base64 string: " + e);
|
|
18997
18998
|
}
|
|
18998
18999
|
}
|
|
18999
19000
|
/**
|
|
@@ -19065,7 +19066,7 @@ class AggregateField {
|
|
|
19065
19066
|
* @param fieldNames - A list of field names.
|
|
19066
19067
|
*/
|
|
19067
19068
|
constructor(...e) {
|
|
19068
|
-
for (let t = 0; t < e.length; ++t) if (0 === e[t].length) throw new FirestoreError(
|
|
19069
|
+
for (let t = 0; t < e.length; ++t) if (0 === e[t].length) throw new FirestoreError(C.INVALID_ARGUMENT, "Invalid field name at argument $(i + 1). Field names must not be empty.");
|
|
19069
19070
|
this._internalPath = new FieldPath$1(e);
|
|
19070
19071
|
}
|
|
19071
19072
|
/**
|
|
@@ -19144,8 +19145,8 @@ class AggregateField {
|
|
|
19144
19145
|
* @param longitude - The longitude as number between -180 and 180.
|
|
19145
19146
|
*/
|
|
19146
19147
|
constructor(e, t) {
|
|
19147
|
-
if (!isFinite(e) || e < -90 || e > 90) throw new FirestoreError(
|
|
19148
|
-
if (!isFinite(t) || t < -180 || t > 180) throw new FirestoreError(
|
|
19148
|
+
if (!isFinite(e) || e < -90 || e > 90) throw new FirestoreError(C.INVALID_ARGUMENT, "Latitude must be a number between -90 and 90, but was: " + e);
|
|
19149
|
+
if (!isFinite(t) || t < -180 || t > 180) throw new FirestoreError(C.INVALID_ARGUMENT, "Longitude must be a number between -180 and 180, but was: " + t);
|
|
19149
19150
|
this._lat = e, this._long = t;
|
|
19150
19151
|
}
|
|
19151
19152
|
/**
|
|
@@ -19195,7 +19196,7 @@ class AggregateField {
|
|
|
19195
19196
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19196
19197
|
* See the License for the specific language governing permissions and
|
|
19197
19198
|
* limitations under the License.
|
|
19198
|
-
*/ const
|
|
19199
|
+
*/ const pe = /^__.*__$/;
|
|
19199
19200
|
|
|
19200
19201
|
/** The result of parsing document data (e.g. for a setData call). */ class ParsedSetData {
|
|
19201
19202
|
constructor(e, t, n) {
|
|
@@ -19306,7 +19307,7 @@ function __PRIVATE_isWrite(e) {
|
|
|
19306
19307
|
}
|
|
19307
19308
|
Au(e) {
|
|
19308
19309
|
if (0 === e.length) throw this.mu("Document fields must not be empty");
|
|
19309
|
-
if (__PRIVATE_isWrite(this.Iu) &&
|
|
19310
|
+
if (__PRIVATE_isWrite(this.Iu) && pe.test(e)) throw this.mu('Document fields cannot begin and end with "__"');
|
|
19310
19311
|
}
|
|
19311
19312
|
}
|
|
19312
19313
|
|
|
@@ -19343,7 +19344,7 @@ function __PRIVATE_newUserDataReader(e) {
|
|
|
19343
19344
|
const e = [];
|
|
19344
19345
|
for (const r of s.mergeFields) {
|
|
19345
19346
|
const i = __PRIVATE_fieldPathFromArgument$1(t, r, n);
|
|
19346
|
-
if (!o.contains(i)) throw new FirestoreError(
|
|
19347
|
+
if (!o.contains(i)) throw new FirestoreError(C.INVALID_ARGUMENT, `Field '${i}' is specified in your field mask but missing from your input data.`);
|
|
19347
19348
|
__PRIVATE_fieldMaskContains(e, i) || e.push(i);
|
|
19348
19349
|
}
|
|
19349
19350
|
a = new FieldMask(e), u = o.fieldTransforms.filter((e => a.covers(e.field)));
|
|
@@ -19463,7 +19464,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
|
|
|
19463
19464
|
|
|
19464
19465
|
/** Parse update data from a list of field/value arguments. */ function __PRIVATE_parseUpdateVarargs(e, t, n, r, i, s) {
|
|
19465
19466
|
const o = e.pu(1 /* UserDataSource.Update */ , t, n), _ = [ __PRIVATE_fieldPathFromArgument$1(t, r, n) ], a = [ i ];
|
|
19466
|
-
if (s.length % 2 != 0) throw new FirestoreError(
|
|
19467
|
+
if (s.length % 2 != 0) throw new FirestoreError(C.INVALID_ARGUMENT, `Function ${t}() needs to be called with an even number of arguments that alternate between field names and values.`);
|
|
19467
19468
|
for (let e = 0; e < s.length; e += 2) _.push(__PRIVATE_fieldPathFromArgument$1(t, s[e])),
|
|
19468
19469
|
a.push(s[e + 1]);
|
|
19469
19470
|
const u = [], c = ObjectValue.empty();
|
|
@@ -19664,7 +19665,7 @@ function __PRIVATE_validatePlainObject(e, t, n) {
|
|
|
19664
19665
|
|
|
19665
19666
|
/**
|
|
19666
19667
|
* Matches any characters in a field path string that are reserved.
|
|
19667
|
-
*/ const
|
|
19668
|
+
*/ const ye = new RegExp("[~\\*/\\[\\]]");
|
|
19668
19669
|
|
|
19669
19670
|
/**
|
|
19670
19671
|
* Wraps fromDotSeparatedString with an error message about the method that
|
|
@@ -19675,7 +19676,7 @@ function __PRIVATE_validatePlainObject(e, t, n) {
|
|
|
19675
19676
|
* @param targetDoc - The document against which the field path will be
|
|
19676
19677
|
* evaluated.
|
|
19677
19678
|
*/ function __PRIVATE_fieldPathFromDotSeparatedString(e, t, n) {
|
|
19678
|
-
if (t.search(
|
|
19679
|
+
if (t.search(ye) >= 0) throw __PRIVATE_createError(`Invalid field path (${t}). Paths must not contain '~', '*', '/', '[', or ']'`, e,
|
|
19679
19680
|
/* hasConverter= */ !1,
|
|
19680
19681
|
/* path= */ void 0, n);
|
|
19681
19682
|
try {
|
|
@@ -19693,7 +19694,7 @@ function __PRIVATE_createError(e, t, n, r, i) {
|
|
|
19693
19694
|
n && (_ += " (via `toFirestore()`)"), _ += ". ";
|
|
19694
19695
|
let a = "";
|
|
19695
19696
|
return (s || o) && (a += " (found", s && (a += ` in field ${r}`), o && (a += ` in document ${i}`),
|
|
19696
|
-
a += ")"), new FirestoreError(
|
|
19697
|
+
a += ")"), new FirestoreError(C.INVALID_ARGUMENT, _ + e + a);
|
|
19697
19698
|
}
|
|
19698
19699
|
|
|
19699
19700
|
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function __PRIVATE_fieldMaskContains(e, t) {
|
|
@@ -19830,7 +19831,7 @@ function __PRIVATE_createError(e, t, n, r, i) {
|
|
|
19830
19831
|
* See the License for the specific language governing permissions and
|
|
19831
19832
|
* limitations under the License.
|
|
19832
19833
|
*/ function __PRIVATE_validateHasExplicitOrderByForLimitToLast(e) {
|
|
19833
|
-
if ("L" /* LimitType.Last */ === e.limitType && 0 === e.explicitOrderBy.length) throw new FirestoreError(
|
|
19834
|
+
if ("L" /* LimitType.Last */ === e.limitType && 0 === e.explicitOrderBy.length) throw new FirestoreError(C.UNIMPLEMENTED, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
19834
19835
|
}
|
|
19835
19836
|
|
|
19836
19837
|
/**
|
|
@@ -19851,7 +19852,7 @@ function query(e, t, ...n) {
|
|
|
19851
19852
|
let r = [];
|
|
19852
19853
|
t instanceof AppliableConstraint && r.push(t), r = r.concat(n), function __PRIVATE_validateQueryConstraintArray(e) {
|
|
19853
19854
|
const t = e.filter((e => e instanceof QueryCompositeFilterConstraint)).length, n = e.filter((e => e instanceof QueryFieldFilterConstraint)).length;
|
|
19854
|
-
if (t > 1 || t > 0 && n > 0) throw new FirestoreError(
|
|
19855
|
+
if (t > 1 || t > 0 && n > 0) throw new FirestoreError(C.INVALID_ARGUMENT, "InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.");
|
|
19855
19856
|
}
|
|
19856
19857
|
/**
|
|
19857
19858
|
* @license
|
|
@@ -19905,7 +19906,7 @@ function query(e, t, ...n) {
|
|
|
19905
19906
|
const t = __PRIVATE_newUserDataReader(e.firestore), n = function __PRIVATE_newQueryFilter(e, t, n, r, i, s, o) {
|
|
19906
19907
|
let _;
|
|
19907
19908
|
if (i.isKeyField()) {
|
|
19908
|
-
if ("array-contains" /* Operator.ARRAY_CONTAINS */ === s || "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ === s) throw new FirestoreError(
|
|
19909
|
+
if ("array-contains" /* Operator.ARRAY_CONTAINS */ === s || "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ === s) throw new FirestoreError(C.INVALID_ARGUMENT, `Invalid Query. You can't perform '${s}' queries on documentId().`);
|
|
19909
19910
|
if ("in" /* Operator.IN */ === s || "not-in" /* Operator.NOT_IN */ === s) {
|
|
19910
19911
|
__PRIVATE_validateDisjunctiveFilterElements(o, s);
|
|
19911
19912
|
const t = [];
|
|
@@ -20032,8 +20033,8 @@ function query(e, t, ...n) {
|
|
|
20032
20033
|
}
|
|
20033
20034
|
_apply(e) {
|
|
20034
20035
|
const t = function __PRIVATE_newQueryOrderBy(e, t, n) {
|
|
20035
|
-
if (null !== e.startAt) throw new FirestoreError(
|
|
20036
|
-
if (null !== e.endAt) throw new FirestoreError(
|
|
20036
|
+
if (null !== e.startAt) throw new FirestoreError(C.INVALID_ARGUMENT, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
|
|
20037
|
+
if (null !== e.endAt) throw new FirestoreError(C.INVALID_ARGUMENT, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
|
|
20037
20038
|
return new OrderBy(t, n);
|
|
20038
20039
|
}
|
|
20039
20040
|
/**
|
|
@@ -20191,7 +20192,7 @@ function endAt(...e) {
|
|
|
20191
20192
|
|
|
20192
20193
|
/** Helper function to create a bound from a document or fields */ function __PRIVATE_newQueryBoundFromDocOrFields(e, t, n, r) {
|
|
20193
20194
|
if (n[0] = getModularInstance(n[0]), n[0] instanceof DocumentSnapshot$1) return function __PRIVATE_newQueryBoundFromDocument(e, t, n, r, i) {
|
|
20194
|
-
if (!r) throw new FirestoreError(
|
|
20195
|
+
if (!r) throw new FirestoreError(C.NOT_FOUND, `Can't use a DocumentSnapshot that doesn't exist for ${n}().`);
|
|
20195
20196
|
const s = [];
|
|
20196
20197
|
// Because people expect to continue/end a query at the exact document
|
|
20197
20198
|
// provided, we need to use the implicit sort order rather than the explicit
|
|
@@ -20202,10 +20203,10 @@ function endAt(...e) {
|
|
|
20202
20203
|
// results.
|
|
20203
20204
|
for (const n of __PRIVATE_queryNormalizedOrderBy(e)) if (n.field.isKeyField()) s.push(__PRIVATE_refValue(t, r.key)); else {
|
|
20204
20205
|
const e = r.data.field(n.field);
|
|
20205
|
-
if (__PRIVATE_isServerTimestamp(e)) throw new FirestoreError(
|
|
20206
|
+
if (__PRIVATE_isServerTimestamp(e)) throw new FirestoreError(C.INVALID_ARGUMENT, 'Invalid query. You are trying to start or end a query using a document for which the field "' + n.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');
|
|
20206
20207
|
if (null === e) {
|
|
20207
20208
|
const e = n.field.canonicalString();
|
|
20208
|
-
throw new FirestoreError(
|
|
20209
|
+
throw new FirestoreError(C.INVALID_ARGUMENT, `Invalid query. You are trying to start or end a query using a document for which the field '${e}' (used as the orderBy) does not exist.`);
|
|
20209
20210
|
}
|
|
20210
20211
|
s.push(e);
|
|
20211
20212
|
}
|
|
@@ -20219,15 +20220,15 @@ function endAt(...e) {
|
|
|
20219
20220
|
return function __PRIVATE_newQueryBoundFromFields(e, t, n, r, i, s) {
|
|
20220
20221
|
// Use explicit order by's because it has to match the query the user made
|
|
20221
20222
|
const o = e.explicitOrderBy;
|
|
20222
|
-
if (i.length > o.length) throw new FirestoreError(
|
|
20223
|
+
if (i.length > o.length) throw new FirestoreError(C.INVALID_ARGUMENT, `Too many arguments provided to ${r}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);
|
|
20223
20224
|
const _ = [];
|
|
20224
20225
|
for (let s = 0; s < i.length; s++) {
|
|
20225
20226
|
const a = i[s];
|
|
20226
20227
|
if (o[s].field.isKeyField()) {
|
|
20227
|
-
if ("string" != typeof a) throw new FirestoreError(
|
|
20228
|
-
if (!__PRIVATE_isCollectionGroupQuery(e) && -1 !== a.indexOf("/")) throw new FirestoreError(
|
|
20228
|
+
if ("string" != typeof a) throw new FirestoreError(C.INVALID_ARGUMENT, `Invalid query. Expected a string for document ID in ${r}(), but got a ${typeof a}`);
|
|
20229
|
+
if (!__PRIVATE_isCollectionGroupQuery(e) && -1 !== a.indexOf("/")) throw new FirestoreError(C.INVALID_ARGUMENT, `Invalid query. When querying a collection and ordering by documentId(), the value passed to ${r}() must be a plain document ID, but '${a}' contains a slash.`);
|
|
20229
20230
|
const n = e.path.child(ResourcePath.fromString(a));
|
|
20230
|
-
if (!DocumentKey.isDocumentKey(n)) throw new FirestoreError(
|
|
20231
|
+
if (!DocumentKey.isDocumentKey(n)) throw new FirestoreError(C.INVALID_ARGUMENT, `Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${r}() must result in a valid document path, but '${n}' is not because it contains an odd number of segments.`);
|
|
20231
20232
|
const i = new DocumentKey(n);
|
|
20232
20233
|
_.push(__PRIVATE_refValue(t, i));
|
|
20233
20234
|
} else {
|
|
@@ -20247,21 +20248,21 @@ function endAt(...e) {
|
|
|
20247
20248
|
|
|
20248
20249
|
function __PRIVATE_parseDocumentIdValue(e, t, n) {
|
|
20249
20250
|
if ("string" == typeof (n = getModularInstance(n))) {
|
|
20250
|
-
if ("" === n) throw new FirestoreError(
|
|
20251
|
-
if (!__PRIVATE_isCollectionGroupQuery(t) && -1 !== n.indexOf("/")) throw new FirestoreError(
|
|
20251
|
+
if ("" === n) throw new FirestoreError(C.INVALID_ARGUMENT, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
|
|
20252
|
+
if (!__PRIVATE_isCollectionGroupQuery(t) && -1 !== n.indexOf("/")) throw new FirestoreError(C.INVALID_ARGUMENT, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);
|
|
20252
20253
|
const r = t.path.child(ResourcePath.fromString(n));
|
|
20253
|
-
if (!DocumentKey.isDocumentKey(r)) throw new FirestoreError(
|
|
20254
|
+
if (!DocumentKey.isDocumentKey(r)) throw new FirestoreError(C.INVALID_ARGUMENT, `Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);
|
|
20254
20255
|
return __PRIVATE_refValue(e, new DocumentKey(r));
|
|
20255
20256
|
}
|
|
20256
20257
|
if (n instanceof DocumentReference) return __PRIVATE_refValue(e, n._key);
|
|
20257
|
-
throw new FirestoreError(
|
|
20258
|
+
throw new FirestoreError(C.INVALID_ARGUMENT, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${__PRIVATE_valueDescription(n)}.`);
|
|
20258
20259
|
}
|
|
20259
20260
|
|
|
20260
20261
|
/**
|
|
20261
20262
|
* Validates that the value passed into a disjunctive filter satisfies all
|
|
20262
20263
|
* array requirements.
|
|
20263
20264
|
*/ function __PRIVATE_validateDisjunctiveFilterElements(e, t) {
|
|
20264
|
-
if (!Array.isArray(e) || 0 === e.length) throw new FirestoreError(
|
|
20265
|
+
if (!Array.isArray(e) || 0 === e.length) throw new FirestoreError(C.INVALID_ARGUMENT, `Invalid Query. A non-empty array is required for '${t.toString()}' filters.`);
|
|
20265
20266
|
}
|
|
20266
20267
|
|
|
20267
20268
|
/**
|
|
@@ -20295,11 +20296,11 @@ function __PRIVATE_parseDocumentIdValue(e, t, n) {
|
|
|
20295
20296
|
}(t.op));
|
|
20296
20297
|
if (null !== n)
|
|
20297
20298
|
// Special case when it's a duplicate op to give a slightly clearer error message.
|
|
20298
|
-
throw n === t.op ? new FirestoreError(
|
|
20299
|
+
throw n === t.op ? new FirestoreError(C.INVALID_ARGUMENT, `Invalid query. You cannot use more than one '${t.op.toString()}' filter.`) : new FirestoreError(C.INVALID_ARGUMENT, `Invalid query. You cannot use '${t.op.toString()}' filters with '${n.toString()}' filters.`);
|
|
20299
20300
|
}
|
|
20300
20301
|
|
|
20301
20302
|
function __PRIVATE_validateQueryFilterConstraint(e, t) {
|
|
20302
|
-
if (!(t instanceof QueryFieldFilterConstraint || t instanceof QueryCompositeFilterConstraint)) throw new FirestoreError(
|
|
20303
|
+
if (!(t instanceof QueryFieldFilterConstraint || t instanceof QueryCompositeFilterConstraint)) throw new FirestoreError(C.INVALID_ARGUMENT, `Function ${e}() requires AppliableConstraints created with a call to 'where(...)', 'or(...)', or 'and(...)'.`);
|
|
20303
20304
|
}
|
|
20304
20305
|
|
|
20305
20306
|
class AbstractUserDataWriter {
|
|
@@ -20671,7 +20672,7 @@ class __PRIVATE_LiteUserDataWriter extends AbstractUserDataWriter {
|
|
|
20671
20672
|
* snapshot events.
|
|
20672
20673
|
*/ docChanges(e = {}) {
|
|
20673
20674
|
const t = !!e.includeMetadataChanges;
|
|
20674
|
-
if (t && this._snapshot.excludesMetadataChanges) throw new FirestoreError(
|
|
20675
|
+
if (t && this._snapshot.excludesMetadataChanges) throw new FirestoreError(C.INVALID_ARGUMENT, "To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");
|
|
20675
20676
|
return this._cachedChanges && this._cachedChangesIncludeMetadataChanges === t || (this._cachedChanges =
|
|
20676
20677
|
/** Calculates the array of `DocumentChange`s for a given `ViewSnapshot`. */
|
|
20677
20678
|
function __PRIVATE_changesFromSnapshot(e, t) {
|
|
@@ -21227,7 +21228,7 @@ class __PRIVATE_MultiTabManagerImpl {
|
|
|
21227
21228
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21228
21229
|
* See the License for the specific language governing permissions and
|
|
21229
21230
|
* limitations under the License.
|
|
21230
|
-
*/ const
|
|
21231
|
+
*/ const we = {
|
|
21231
21232
|
maxAttempts: 5
|
|
21232
21233
|
};
|
|
21233
21234
|
|
|
@@ -21301,12 +21302,12 @@ class WriteBatch {
|
|
|
21301
21302
|
return this._verifyNotCommitted(), this._committed = !0, this._mutations.length > 0 ? this._commitHandler(this._mutations) : Promise.resolve();
|
|
21302
21303
|
}
|
|
21303
21304
|
_verifyNotCommitted() {
|
|
21304
|
-
if (this._committed) throw new FirestoreError(
|
|
21305
|
+
if (this._committed) throw new FirestoreError(C.FAILED_PRECONDITION, "A write batch can no longer be used after commit() has been called.");
|
|
21305
21306
|
}
|
|
21306
21307
|
}
|
|
21307
21308
|
|
|
21308
21309
|
function __PRIVATE_validateReference(e, t) {
|
|
21309
|
-
if ((e = getModularInstance(e)).firestore !== t) throw new FirestoreError(
|
|
21310
|
+
if ((e = getModularInstance(e)).firestore !== t) throw new FirestoreError(C.INVALID_ARGUMENT, "Provided document reference is from a different Firestore instance.");
|
|
21310
21311
|
return e;
|
|
21311
21312
|
}
|
|
21312
21313
|
|
|
@@ -21439,9 +21440,9 @@ class Transaction extends class Transaction$1 {
|
|
|
21439
21440
|
* rejected promise with the corresponding failure error is returned.
|
|
21440
21441
|
*/ function runTransaction(e, t, n) {
|
|
21441
21442
|
e = __PRIVATE_cast(e, Firestore);
|
|
21442
|
-
const r = Object.assign(Object.assign({},
|
|
21443
|
+
const r = Object.assign(Object.assign({}, we), n);
|
|
21443
21444
|
!function __PRIVATE_validateTransactionOptions(e) {
|
|
21444
|
-
if (e.maxAttempts < 1) throw new FirestoreError(
|
|
21445
|
+
if (e.maxAttempts < 1) throw new FirestoreError(C.INVALID_ARGUMENT, "Max attempts must be at least 1");
|
|
21445
21446
|
}(r);
|
|
21446
21447
|
return function __PRIVATE_firestoreClientTransaction(e, t, n) {
|
|
21447
21448
|
const r = new __PRIVATE_Deferred;
|
|
@@ -21595,7 +21596,7 @@ class Transaction extends class Transaction$1 {
|
|
|
21595
21596
|
try {
|
|
21596
21597
|
return JSON.parse(e);
|
|
21597
21598
|
} catch (e) {
|
|
21598
|
-
throw new FirestoreError(
|
|
21599
|
+
throw new FirestoreError(C.INVALID_ARGUMENT, "Failed to parse JSON: " + (null == e ? void 0 : e.message));
|
|
21599
21600
|
}
|
|
21600
21601
|
}(e) : e, n = [];
|
|
21601
21602
|
if (Array.isArray(t.indexes)) for (const e of t.indexes) {
|
|
@@ -21612,7 +21613,7 @@ class Transaction extends class Transaction$1 {
|
|
|
21612
21613
|
}
|
|
21613
21614
|
|
|
21614
21615
|
function __PRIVATE_tryGetString(e, t) {
|
|
21615
|
-
if ("string" != typeof e[t]) throw new FirestoreError(
|
|
21616
|
+
if ("string" != typeof e[t]) throw new FirestoreError(C.INVALID_ARGUMENT, "Missing string value for: " + t);
|
|
21616
21617
|
return e[t];
|
|
21617
21618
|
}
|
|
21618
21619
|
|
|
@@ -21655,12 +21656,12 @@ function __PRIVATE_tryGetString(e, t) {
|
|
|
21655
21656
|
*/ function getPersistentCacheIndexManager(e) {
|
|
21656
21657
|
var t;
|
|
21657
21658
|
e = __PRIVATE_cast(e, Firestore);
|
|
21658
|
-
const n =
|
|
21659
|
+
const n = Se.get(e);
|
|
21659
21660
|
if (n) return n;
|
|
21660
21661
|
const r = ensureFirestoreConfigured(e);
|
|
21661
21662
|
if ("persistent" !== (null === (t = r._uninitializedComponentsProvider) || void 0 === t ? void 0 : t._offlineKind)) return null;
|
|
21662
21663
|
const i = new PersistentCacheIndexManager(r);
|
|
21663
|
-
return
|
|
21664
|
+
return Se.set(e, i), i;
|
|
21664
21665
|
}
|
|
21665
21666
|
|
|
21666
21667
|
/**
|
|
@@ -21703,7 +21704,7 @@ function __PRIVATE_setPersistentCacheIndexAutoCreationEnabled(e, t) {
|
|
|
21703
21704
|
* Use a `WeakMap` so that the mapping will be automatically dropped when the
|
|
21704
21705
|
* `Firestore` instance is garbage collected. This emulates a private member
|
|
21705
21706
|
* as described in https://goo.gle/454yvug.
|
|
21706
|
-
*/ const
|
|
21707
|
+
*/ const Se = new WeakMap;
|
|
21707
21708
|
|
|
21708
21709
|
/**
|
|
21709
21710
|
* @license
|
|
@@ -21756,10 +21757,10 @@ function __PRIVATE_setPersistentCacheIndexAutoCreationEnabled(e, t) {
|
|
|
21756
21757
|
this.Su = new Map;
|
|
21757
21758
|
}
|
|
21758
21759
|
static get instance() {
|
|
21759
|
-
return
|
|
21760
|
-
if (
|
|
21761
|
-
|
|
21762
|
-
}(
|
|
21760
|
+
return be || (be = new __PRIVATE_TestingHooksSpiImpl, function __PRIVATE_setTestingHooksSpi(e) {
|
|
21761
|
+
if (le) throw new Error("a TestingHooksSpi instance is already set");
|
|
21762
|
+
le = e;
|
|
21763
|
+
}(be)), be;
|
|
21763
21764
|
}
|
|
21764
21765
|
tt(e) {
|
|
21765
21766
|
this.Su.forEach((t => t(e)));
|
|
@@ -21770,7 +21771,7 @@ function __PRIVATE_setPersistentCacheIndexAutoCreationEnabled(e, t) {
|
|
|
21770
21771
|
}
|
|
21771
21772
|
}
|
|
21772
21773
|
|
|
21773
|
-
let
|
|
21774
|
+
let be = null;
|
|
21774
21775
|
|
|
21775
21776
|
/**
|
|
21776
21777
|
* Cloud Firestore
|
|
@@ -21778,19 +21779,19 @@ let Se = null;
|
|
|
21778
21779
|
* @packageDocumentation
|
|
21779
21780
|
*/ !function __PRIVATE_registerFirestore(e, t = !0) {
|
|
21780
21781
|
!function __PRIVATE_setSDKVersion(e) {
|
|
21781
|
-
|
|
21782
|
+
b = e;
|
|
21782
21783
|
}(SDK_VERSION), _registerComponent(new Component("firestore", ((e, {instanceIdentifier: n, options: r}) => {
|
|
21783
21784
|
const i = e.getProvider("app").getImmediate(), s = new Firestore(new __PRIVATE_FirebaseAuthCredentialsProvider(e.getProvider("auth-internal")), new __PRIVATE_FirebaseAppCheckTokenProvider(e.getProvider("app-check-internal")), function __PRIVATE_databaseIdFromApp(e, t) {
|
|
21784
|
-
if (!Object.prototype.hasOwnProperty.apply(e.options, [ "projectId" ])) throw new FirestoreError(
|
|
21785
|
+
if (!Object.prototype.hasOwnProperty.apply(e.options, [ "projectId" ])) throw new FirestoreError(C.INVALID_ARGUMENT, '"projectId" not provided in firebase.initializeApp.');
|
|
21785
21786
|
return new DatabaseId(e.options.projectId, t);
|
|
21786
21787
|
}(i, n), i);
|
|
21787
21788
|
return r = Object.assign({
|
|
21788
21789
|
useFetchStreams: t
|
|
21789
21790
|
}, r), s._setSettings(r), s;
|
|
21790
|
-
}), "PUBLIC").setMultipleInstances(!0)), registerVersion(
|
|
21791
|
+
}), "PUBLIC").setMultipleInstances(!0)), registerVersion(S, "4.3.2-20231027003707", e),
|
|
21791
21792
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
|
21792
|
-
registerVersion(
|
|
21793
|
+
registerVersion(S, "4.3.2-20231027003707", "esm2017");
|
|
21793
21794
|
}();
|
|
21794
21795
|
|
|
21795
|
-
export { AbstractUserDataWriter, AggregateField, AggregateQuerySnapshot, Bytes,
|
|
21796
|
+
export { AbstractUserDataWriter, AggregateField, AggregateQuerySnapshot, Bytes, ge as CACHE_SIZE_UNLIMITED, CollectionReference, DocumentReference, DocumentSnapshot, FieldPath, FieldValue, Firestore, FirestoreError, GeoPoint, LoadBundleTask, PersistentCacheIndexManager, Query, QueryCompositeFilterConstraint, QueryConstraint, QueryDocumentSnapshot, QueryEndAtConstraint, QueryFieldFilterConstraint, QueryLimitConstraint, QueryOrderByConstraint, QuerySnapshot, QueryStartAtConstraint, SnapshotMetadata, Timestamp, Transaction, WriteBatch, __PRIVATE_AutoId as _AutoId, ByteString as _ByteString, DatabaseId as _DatabaseId, DocumentKey as _DocumentKey, __PRIVATE_EmptyAppCheckTokenProvider as _EmptyAppCheckTokenProvider, __PRIVATE_EmptyAuthCredentialsProvider as _EmptyAuthCredentialsProvider, FieldPath$1 as _FieldPath, TestingHooks as _TestingHooks, __PRIVATE_cast as _cast, __PRIVATE_debugAssert as _debugAssert, __PRIVATE_isBase64Available as _isBase64Available, __PRIVATE_logWarn as _logWarn, __PRIVATE_validateIsNotUsedTogether as _validateIsNotUsedTogether, addDoc, aggregateFieldEqual, aggregateQuerySnapshotEqual, and, arrayRemove, arrayUnion, average, clearIndexedDbPersistence, collection, collectionGroup, connectFirestoreEmulator, count, deleteAllPersistentCacheIndexes, deleteDoc, deleteField, disableNetwork, disablePersistentCacheIndexAutoCreation, doc, documentId, enableIndexedDbPersistence, enableMultiTabIndexedDbPersistence, enableNetwork, enablePersistentCacheIndexAutoCreation, endAt, endBefore, ensureFirestoreConfigured, executeWrite, getAggregateFromServer, getCountFromServer, getDoc, getDocFromCache, getDocFromServer, getDocs, getDocsFromCache, getDocsFromServer, getFirestore, getPersistentCacheIndexManager, increment, initializeFirestore, limit, limitToLast, loadBundle, memoryEagerGarbageCollector, memoryLocalCache, memoryLruGarbageCollector, namedQuery, onSnapshot, onSnapshotsInSync, or, orderBy, persistentLocalCache, persistentMultipleTabManager, persistentSingleTabManager, query, queryEqual, refEqual, runTransaction, serverTimestamp, setDoc, setIndexConfiguration, setLogLevel, snapshotEqual, startAfter, startAt, sum, terminate, updateDoc, waitForPendingWrites, where, writeBatch };
|
|
21796
21797
|
//# sourceMappingURL=index.esm2017.js.map
|