@firebase/firestore 4.6.2-dataconnect-preview.877f8b7d0 → 4.6.2
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/index.cjs.js +294 -294
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm2017.js +294 -294
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +3082 -3082
- 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 +294 -294
- package/dist/index.rn.js.map +1 -1
- package/dist/lite/index.browser.esm2017.js +152 -153
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +904 -905
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.cjs.js +152 -153
- 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 +152 -153
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/packages/firestore/dist/index.esm2017.d.ts +2 -2
- package/package.json +9 -9
package/dist/index.cjs.js
CHANGED
|
@@ -9,7 +9,7 @@ var util = require('@firebase/util');
|
|
|
9
9
|
var bloomBlob = require('@firebase/webchannel-wrapper/bloom-blob');
|
|
10
10
|
var webchannelBlob = require('@firebase/webchannel-wrapper/webchannel-blob');
|
|
11
11
|
|
|
12
|
-
const S = "@firebase/firestore"
|
|
12
|
+
const S = "@firebase/firestore";
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @license
|
|
@@ -71,7 +71,7 @@ User.MOCK_USER = new User("mock-user");
|
|
|
71
71
|
* See the License for the specific language governing permissions and
|
|
72
72
|
* limitations under the License.
|
|
73
73
|
*/
|
|
74
|
-
let
|
|
74
|
+
let b = "10.12.0";
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
77
|
* @license
|
|
@@ -89,11 +89,11 @@ let D = "10.12.0-dataconnect-preview.877f8b7d0";
|
|
|
89
89
|
* See the License for the specific language governing permissions and
|
|
90
90
|
* limitations under the License.
|
|
91
91
|
*/
|
|
92
|
-
const
|
|
92
|
+
const D = new logger.Logger("@firebase/firestore");
|
|
93
93
|
|
|
94
94
|
// Helper methods are needed because variables can't be exported as read/write
|
|
95
95
|
function __PRIVATE_getLogLevel() {
|
|
96
|
-
return
|
|
96
|
+
return D.logLevel;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
/**
|
|
@@ -109,29 +109,29 @@ function __PRIVATE_getLogLevel() {
|
|
|
109
109
|
* <li><code>`silent` to turn off logging.</li>
|
|
110
110
|
* </ul>
|
|
111
111
|
*/ function setLogLevel(e) {
|
|
112
|
-
|
|
112
|
+
D.setLogLevel(e);
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
function __PRIVATE_logDebug(e, ...t) {
|
|
116
|
-
if (
|
|
116
|
+
if (D.logLevel <= logger.LogLevel.DEBUG) {
|
|
117
117
|
const n = t.map(__PRIVATE_argToString);
|
|
118
|
-
|
|
118
|
+
D.debug(`Firestore (${b}): ${e}`, ...n);
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
function __PRIVATE_logError(e, ...t) {
|
|
123
|
-
if (
|
|
123
|
+
if (D.logLevel <= logger.LogLevel.ERROR) {
|
|
124
124
|
const n = t.map(__PRIVATE_argToString);
|
|
125
|
-
|
|
125
|
+
D.error(`Firestore (${b}): ${e}`, ...n);
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
/**
|
|
130
130
|
* @internal
|
|
131
131
|
*/ function __PRIVATE_logWarn(e, ...t) {
|
|
132
|
-
if (
|
|
132
|
+
if (D.logLevel <= logger.LogLevel.WARN) {
|
|
133
133
|
const n = t.map(__PRIVATE_argToString);
|
|
134
|
-
|
|
134
|
+
D.warn(`Firestore (${b}): ${e}`, ...n);
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
|
|
@@ -192,7 +192,7 @@ function __PRIVATE_logError(e, ...t) {
|
|
|
192
192
|
*/ function fail(e = "Unexpected state") {
|
|
193
193
|
// Log the failure in addition to throw an exception, just in case the
|
|
194
194
|
// exception is swallowed.
|
|
195
|
-
const t = `FIRESTORE (${
|
|
195
|
+
const t = `FIRESTORE (${b}) INTERNAL ASSERTION FAILED: ` + e;
|
|
196
196
|
// NOTE: We don't use FirestoreError here because these are internal failures
|
|
197
197
|
// that cannot be handled by the user. (Also it would create a circular
|
|
198
198
|
// dependency between the error and assert modules which doesn't work.)
|
|
@@ -245,7 +245,7 @@ t) {
|
|
|
245
245
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
246
246
|
* See the License for the specific language governing permissions and
|
|
247
247
|
* limitations under the License.
|
|
248
|
-
*/ const
|
|
248
|
+
*/ const C = {
|
|
249
249
|
// Causes are copied from:
|
|
250
250
|
// https://github.com/grpc/grpc/blob/bceec94ea4fc5f0085d81235d8e1c06798dc341a/include/grpc%2B%2B/impl/codegen/status_code_enum.h
|
|
251
251
|
/** Not an error; returned on success. */
|
|
@@ -790,11 +790,11 @@ class Timestamp {
|
|
|
790
790
|
* The fractions of a second at nanosecond resolution.*
|
|
791
791
|
*/
|
|
792
792
|
t) {
|
|
793
|
-
if (this.seconds = e, this.nanoseconds = t, t < 0) throw new FirestoreError(
|
|
794
|
-
if (t >= 1e9) throw new FirestoreError(
|
|
795
|
-
if (e < -62135596800) throw new FirestoreError(
|
|
793
|
+
if (this.seconds = e, this.nanoseconds = t, t < 0) throw new FirestoreError(C.INVALID_ARGUMENT, "Timestamp nanoseconds out of range: " + t);
|
|
794
|
+
if (t >= 1e9) throw new FirestoreError(C.INVALID_ARGUMENT, "Timestamp nanoseconds out of range: " + t);
|
|
795
|
+
if (e < -62135596800) throw new FirestoreError(C.INVALID_ARGUMENT, "Timestamp seconds out of range: " + e);
|
|
796
796
|
// This will break in the year 10,000.
|
|
797
|
-
if (e >= 253402300800) throw new FirestoreError(
|
|
797
|
+
if (e >= 253402300800) throw new FirestoreError(C.INVALID_ARGUMENT, "Timestamp seconds out of range: " + e);
|
|
798
798
|
}
|
|
799
799
|
/**
|
|
800
800
|
* Creates a new timestamp with the current date, with millisecond precision.
|
|
@@ -1049,7 +1049,7 @@ class BasePath {
|
|
|
1049
1049
|
// for legacy reasons and should not be used frequently).
|
|
1050
1050
|
const t = [];
|
|
1051
1051
|
for (const n of e) {
|
|
1052
|
-
if (n.indexOf("//") >= 0) throw new FirestoreError(
|
|
1052
|
+
if (n.indexOf("//") >= 0) throw new FirestoreError(C.INVALID_ARGUMENT, `Invalid segment (${n}). Paths must not contain // in them.`);
|
|
1053
1053
|
// Strip leading and traling slashed.
|
|
1054
1054
|
t.push(...n.split("/").filter((e => e.length > 0)));
|
|
1055
1055
|
}
|
|
@@ -1060,7 +1060,7 @@ class BasePath {
|
|
|
1060
1060
|
}
|
|
1061
1061
|
}
|
|
1062
1062
|
|
|
1063
|
-
const
|
|
1063
|
+
const v = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
1064
1064
|
|
|
1065
1065
|
/**
|
|
1066
1066
|
* A dot-separated path for navigating sub-objects within a document.
|
|
@@ -1073,7 +1073,7 @@ const F = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
|
1073
1073
|
* Returns true if the string could be used as a segment in a field path
|
|
1074
1074
|
* without escaping.
|
|
1075
1075
|
*/ static isValidIdentifier(e) {
|
|
1076
|
-
return
|
|
1076
|
+
return v.test(e);
|
|
1077
1077
|
}
|
|
1078
1078
|
canonicalString() {
|
|
1079
1079
|
return this.toArray().map((e => (e = e.replace(/\\/g, "\\\\").replace(/`/g, "\\`"),
|
|
@@ -1105,21 +1105,21 @@ const F = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
|
1105
1105
|
const t = [];
|
|
1106
1106
|
let n = "", r = 0;
|
|
1107
1107
|
const __PRIVATE_addCurrentSegment = () => {
|
|
1108
|
-
if (0 === n.length) throw new FirestoreError(
|
|
1108
|
+
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 '..'`);
|
|
1109
1109
|
t.push(n), n = "";
|
|
1110
1110
|
};
|
|
1111
1111
|
let i = !1;
|
|
1112
1112
|
for (;r < e.length; ) {
|
|
1113
1113
|
const t = e[r];
|
|
1114
1114
|
if ("\\" === t) {
|
|
1115
|
-
if (r + 1 === e.length) throw new FirestoreError(
|
|
1115
|
+
if (r + 1 === e.length) throw new FirestoreError(C.INVALID_ARGUMENT, "Path has trailing escape character: " + e);
|
|
1116
1116
|
const t = e[r + 1];
|
|
1117
|
-
if ("\\" !== t && "." !== t && "`" !== t) throw new FirestoreError(
|
|
1117
|
+
if ("\\" !== t && "." !== t && "`" !== t) throw new FirestoreError(C.INVALID_ARGUMENT, "Path has invalid escape sequence: " + e);
|
|
1118
1118
|
n += t, r += 2;
|
|
1119
1119
|
} else "`" === t ? (i = !i, r++) : "." !== t || i ? (n += t, r++) : (__PRIVATE_addCurrentSegment(),
|
|
1120
1120
|
r++);
|
|
1121
1121
|
}
|
|
1122
|
-
if (__PRIVATE_addCurrentSegment(), i) throw new FirestoreError(
|
|
1122
|
+
if (__PRIVATE_addCurrentSegment(), i) throw new FirestoreError(C.INVALID_ARGUMENT, "Unterminated ` in path: " + e);
|
|
1123
1123
|
return new FieldPath$1(t);
|
|
1124
1124
|
}
|
|
1125
1125
|
static emptyPath() {
|
|
@@ -1371,7 +1371,7 @@ function __PRIVATE_indexOffsetComparator(e, t) {
|
|
|
1371
1371
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1372
1372
|
* See the License for the specific language governing permissions and
|
|
1373
1373
|
* limitations under the License.
|
|
1374
|
-
*/ const
|
|
1374
|
+
*/ const F = "The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";
|
|
1375
1375
|
|
|
1376
1376
|
/**
|
|
1377
1377
|
* A base class representing a persistence transaction, encapsulating both the
|
|
@@ -1418,7 +1418,7 @@ function __PRIVATE_indexOffsetComparator(e, t) {
|
|
|
1418
1418
|
* @param err - An error returned by a LocalStore operation.
|
|
1419
1419
|
* @returns A Promise that resolves after we recovered, or the original error.
|
|
1420
1420
|
*/ async function __PRIVATE_ignoreIfPrimaryLeaseLoss(e) {
|
|
1421
|
-
if (e.code !==
|
|
1421
|
+
if (e.code !== C.FAILED_PRECONDITION || e.message !== F) throw e;
|
|
1422
1422
|
__PRIVATE_logDebug("LocalStore", "Unexpectedly lost primary lease");
|
|
1423
1423
|
}
|
|
1424
1424
|
|
|
@@ -1723,7 +1723,7 @@ class __PRIVATE_SimpleDbTransaction {
|
|
|
1723
1723
|
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."));
|
|
1724
1724
|
}, r.onerror = t => {
|
|
1725
1725
|
const r = t.target.error;
|
|
1726
|
-
"VersionError" === r.name ? n(new FirestoreError(
|
|
1726
|
+
"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));
|
|
1727
1727
|
}, r.onupgradeneeded = e => {
|
|
1728
1728
|
__PRIVATE_logDebug("SimpleDb", 'Database "' + this.name + '" requires upgrade from version:', e.oldVersion);
|
|
1729
1729
|
const t = e.target.result;
|
|
@@ -1815,7 +1815,7 @@ class __PRIVATE_SimpleDbTransaction {
|
|
|
1815
1815
|
|
|
1816
1816
|
/** An error that wraps exceptions that thrown during IndexedDB execution. */ class __PRIVATE_IndexedDbTransactionError extends FirestoreError {
|
|
1817
1817
|
constructor(e, t) {
|
|
1818
|
-
super(
|
|
1818
|
+
super(C.UNAVAILABLE, `IndexedDB transaction '${e}' failed: ${t}`), this.name = "IndexedDbTransactionError";
|
|
1819
1819
|
}
|
|
1820
1820
|
}
|
|
1821
1821
|
|
|
@@ -1999,7 +1999,7 @@ class __PRIVATE_SimpleDbTransaction {
|
|
|
1999
1999
|
}
|
|
2000
2000
|
|
|
2001
2001
|
// Guard so we only report the error once.
|
|
2002
|
-
let
|
|
2002
|
+
let M = !1;
|
|
2003
2003
|
|
|
2004
2004
|
function __PRIVATE_checkForAndReportiOSError(e) {
|
|
2005
2005
|
const t = __PRIVATE_SimpleDb.S(util.getUA());
|
|
@@ -2008,7 +2008,7 @@ function __PRIVATE_checkForAndReportiOSError(e) {
|
|
|
2008
2008
|
if (e.message.indexOf(t) >= 0) {
|
|
2009
2009
|
// Wrap error in a more descriptive one.
|
|
2010
2010
|
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.`);
|
|
2011
|
-
return
|
|
2011
|
+
return M || (M = !0,
|
|
2012
2012
|
// Throw a global exception outside of this promise chain, for the user to
|
|
2013
2013
|
// potentially catch.
|
|
2014
2014
|
setTimeout((() => {
|
|
@@ -2260,7 +2260,7 @@ function __PRIVATE_encodeResourcePath(e) {
|
|
|
2260
2260
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2261
2261
|
* See the License for the specific language governing permissions and
|
|
2262
2262
|
* limitations under the License.
|
|
2263
|
-
*/ const
|
|
2263
|
+
*/ const x = [ "userId", "batchId" ];
|
|
2264
2264
|
|
|
2265
2265
|
/**
|
|
2266
2266
|
* @license
|
|
@@ -2305,7 +2305,7 @@ function __PRIVATE_newDbDocumentMutationPrefixForPath(e, t) {
|
|
|
2305
2305
|
* there is no useful information to store as the value. The raw (unencoded)
|
|
2306
2306
|
* path cannot be stored because IndexedDb doesn't store prototype
|
|
2307
2307
|
* information.
|
|
2308
|
-
*/ const
|
|
2308
|
+
*/ const O = {}, N = [ "prefixPath", "collectionGroup", "readTime", "documentId" ], L = [ "prefixPath", "collectionGroup", "documentId" ], B = [ "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" ], te = ee;
|
|
2309
2309
|
|
|
2310
2310
|
/**
|
|
2311
2311
|
* @license
|
|
@@ -3068,7 +3068,7 @@ function __PRIVATE_isBase64Available() {
|
|
|
3068
3068
|
|
|
3069
3069
|
ByteString.EMPTY_BYTE_STRING = new ByteString("");
|
|
3070
3070
|
|
|
3071
|
-
const
|
|
3071
|
+
const ne = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
3072
3072
|
|
|
3073
3073
|
/**
|
|
3074
3074
|
* Converts the possible Proto values for a timestamp value into a "seconds and
|
|
@@ -3082,7 +3082,7 @@ const re = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
3082
3082
|
// (millis), so we do some custom parsing here.
|
|
3083
3083
|
// Parse the nanos right out of the string.
|
|
3084
3084
|
let t = 0;
|
|
3085
|
-
const n =
|
|
3085
|
+
const n = ne.exec(e);
|
|
3086
3086
|
if (__PRIVATE_hardAssert(!!n), n[1]) {
|
|
3087
3087
|
// Pad the fraction out to 9 digits (nanos).
|
|
3088
3088
|
let e = n[1];
|
|
@@ -3249,7 +3249,7 @@ class DatabaseId {
|
|
|
3249
3249
|
* See the License for the specific language governing permissions and
|
|
3250
3250
|
* limitations under the License.
|
|
3251
3251
|
*/
|
|
3252
|
-
const
|
|
3252
|
+
const re = {
|
|
3253
3253
|
mapValue: {
|
|
3254
3254
|
fields: {
|
|
3255
3255
|
__type__: {
|
|
@@ -3257,7 +3257,7 @@ const ie = {
|
|
|
3257
3257
|
}
|
|
3258
3258
|
}
|
|
3259
3259
|
}
|
|
3260
|
-
},
|
|
3260
|
+
}, ie = {
|
|
3261
3261
|
nullValue: "NULL_VALUE"
|
|
3262
3262
|
};
|
|
3263
3263
|
|
|
@@ -3401,9 +3401,9 @@ function __PRIVATE_valueCompare(e, t) {
|
|
|
3401
3401
|
|
|
3402
3402
|
case 10 /* TypeOrder.ObjectValue */ :
|
|
3403
3403
|
return function __PRIVATE_compareMaps(e, t) {
|
|
3404
|
-
if (e ===
|
|
3405
|
-
if (e ===
|
|
3406
|
-
if (t ===
|
|
3404
|
+
if (e === re.mapValue && t === re.mapValue) return 0;
|
|
3405
|
+
if (e === re.mapValue) return 1;
|
|
3406
|
+
if (t === re.mapValue) return -1;
|
|
3407
3407
|
const n = e.fields || {}, r = Object.keys(n), i = t.fields || {}, s = Object.keys(i);
|
|
3408
3408
|
// Even though MapValues are likely sorted correctly based on their insertion
|
|
3409
3409
|
// order (e.g. when received from the backend), local modifications can bring
|
|
@@ -3579,7 +3579,7 @@ function isArray(e) {
|
|
|
3579
3579
|
}
|
|
3580
3580
|
|
|
3581
3581
|
/** Returns the lowest value for the given value type (inclusive). */ function __PRIVATE_valuesGetLowerBound(e) {
|
|
3582
|
-
return "nullValue" in e ?
|
|
3582
|
+
return "nullValue" in e ? ie : "booleanValue" in e ? {
|
|
3583
3583
|
booleanValue: !1
|
|
3584
3584
|
} : "integerValue" in e || "doubleValue" in e ? {
|
|
3585
3585
|
doubleValue: NaN
|
|
@@ -3625,7 +3625,7 @@ function isArray(e) {
|
|
|
3625
3625
|
arrayValue: {}
|
|
3626
3626
|
} : "arrayValue" in e ? {
|
|
3627
3627
|
mapValue: {}
|
|
3628
|
-
} : "mapValue" in e ?
|
|
3628
|
+
} : "mapValue" in e ? re : fail();
|
|
3629
3629
|
}
|
|
3630
3630
|
|
|
3631
3631
|
function __PRIVATE_lowerBoundCompare(e, t) {
|
|
@@ -4313,10 +4313,10 @@ function __PRIVATE_targetIsDocumentTarget(e) {
|
|
|
4313
4313
|
* the provided `fieldPath` (or the upper bound for an descending segment).
|
|
4314
4314
|
*/
|
|
4315
4315
|
function __PRIVATE_targetGetAscendingBound(e, t, n) {
|
|
4316
|
-
let r =
|
|
4316
|
+
let r = ie, i = !0;
|
|
4317
4317
|
// Process all filters to find a value for the current field segment
|
|
4318
4318
|
for (const n of __PRIVATE_targetGetFieldFiltersForPath(e, t)) {
|
|
4319
|
-
let e =
|
|
4319
|
+
let e = ie, t = !0;
|
|
4320
4320
|
switch (n.op) {
|
|
4321
4321
|
case "<" /* Operator.LESS_THAN */ :
|
|
4322
4322
|
case "<=" /* Operator.LESS_THAN_OR_EQUAL */ :
|
|
@@ -4335,7 +4335,7 @@ function __PRIVATE_targetGetAscendingBound(e, t, n) {
|
|
|
4335
4335
|
|
|
4336
4336
|
case "!=" /* Operator.NOT_EQUAL */ :
|
|
4337
4337
|
case "not-in" /* Operator.NOT_IN */ :
|
|
4338
|
-
e =
|
|
4338
|
+
e = ie;
|
|
4339
4339
|
// Remaining filters cannot be used as lower bounds.
|
|
4340
4340
|
}
|
|
4341
4341
|
__PRIVATE_lowerBoundCompare({
|
|
@@ -4371,10 +4371,10 @@ function __PRIVATE_targetGetAscendingBound(e, t, n) {
|
|
|
4371
4371
|
* Returns the value to use as the upper bound for ascending index segment at
|
|
4372
4372
|
* the provided `fieldPath` (or the lower bound for a descending segment).
|
|
4373
4373
|
*/ function __PRIVATE_targetGetDescendingBound(e, t, n) {
|
|
4374
|
-
let r =
|
|
4374
|
+
let r = re, i = !0;
|
|
4375
4375
|
// Process all filters to find a value for the current field segment
|
|
4376
4376
|
for (const n of __PRIVATE_targetGetFieldFiltersForPath(e, t)) {
|
|
4377
|
-
let e =
|
|
4377
|
+
let e = re, t = !0;
|
|
4378
4378
|
switch (n.op) {
|
|
4379
4379
|
case ">=" /* Operator.GREATER_THAN_OR_EQUAL */ :
|
|
4380
4380
|
case ">" /* Operator.GREATER_THAN */ :
|
|
@@ -4393,7 +4393,7 @@ function __PRIVATE_targetGetAscendingBound(e, t, n) {
|
|
|
4393
4393
|
|
|
4394
4394
|
case "!=" /* Operator.NOT_EQUAL */ :
|
|
4395
4395
|
case "not-in" /* Operator.NOT_IN */ :
|
|
4396
|
-
e =
|
|
4396
|
+
e = re;
|
|
4397
4397
|
// Remaining filters cannot be used as upper bounds.
|
|
4398
4398
|
}
|
|
4399
4399
|
__PRIVATE_upperBoundCompare({
|
|
@@ -4777,22 +4777,22 @@ function __PRIVATE_compareDocs(e, t, n) {
|
|
|
4777
4777
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4778
4778
|
* See the License for the specific language governing permissions and
|
|
4779
4779
|
* limitations under the License.
|
|
4780
|
-
*/ const
|
|
4780
|
+
*/ const se = new SortedMap(DocumentKey.comparator);
|
|
4781
4781
|
|
|
4782
4782
|
function __PRIVATE_mutableDocumentMap() {
|
|
4783
|
-
return
|
|
4783
|
+
return se;
|
|
4784
4784
|
}
|
|
4785
4785
|
|
|
4786
|
-
const
|
|
4786
|
+
const oe = new SortedMap(DocumentKey.comparator);
|
|
4787
4787
|
|
|
4788
4788
|
function documentMap(...e) {
|
|
4789
|
-
let t =
|
|
4789
|
+
let t = oe;
|
|
4790
4790
|
for (const n of e) t = t.insert(n.key, n);
|
|
4791
4791
|
return t;
|
|
4792
4792
|
}
|
|
4793
4793
|
|
|
4794
4794
|
function __PRIVATE_convertOverlayedDocumentMapToDocumentMap(e) {
|
|
4795
|
-
let t =
|
|
4795
|
+
let t = oe;
|
|
4796
4796
|
return e.forEach(((e, n) => t = t.insert(e, n.overlayedDocument))), t;
|
|
4797
4797
|
}
|
|
4798
4798
|
|
|
@@ -4808,20 +4808,20 @@ function __PRIVATE_newDocumentKeyMap() {
|
|
|
4808
4808
|
return new ObjectMap((e => e.toString()), ((e, t) => e.isEqual(t)));
|
|
4809
4809
|
}
|
|
4810
4810
|
|
|
4811
|
-
const
|
|
4811
|
+
const _e = new SortedMap(DocumentKey.comparator);
|
|
4812
4812
|
|
|
4813
|
-
const
|
|
4813
|
+
const ae = new SortedSet(DocumentKey.comparator);
|
|
4814
4814
|
|
|
4815
4815
|
function __PRIVATE_documentKeySet(...e) {
|
|
4816
|
-
let t =
|
|
4816
|
+
let t = ae;
|
|
4817
4817
|
for (const n of e) t = t.add(n);
|
|
4818
4818
|
return t;
|
|
4819
4819
|
}
|
|
4820
4820
|
|
|
4821
|
-
const
|
|
4821
|
+
const ue = new SortedSet(__PRIVATE_primitiveComparator);
|
|
4822
4822
|
|
|
4823
4823
|
function __PRIVATE_targetIdSet() {
|
|
4824
|
-
return
|
|
4824
|
+
return ue;
|
|
4825
4825
|
}
|
|
4826
4826
|
|
|
4827
4827
|
/**
|
|
@@ -5512,7 +5512,7 @@ class __PRIVATE_VerifyMutation extends Mutation {
|
|
|
5512
5512
|
*/ static from(e, t, n) {
|
|
5513
5513
|
__PRIVATE_hardAssert(e.mutations.length === n.length);
|
|
5514
5514
|
let r = function __PRIVATE_documentVersionMap() {
|
|
5515
|
-
return
|
|
5515
|
+
return _e;
|
|
5516
5516
|
}();
|
|
5517
5517
|
const i = e.mutations;
|
|
5518
5518
|
for (let e = 0; e < i.length; e++) r = r.insert(i[e].key, n[e].version);
|
|
@@ -5626,7 +5626,7 @@ class __PRIVATE_VerifyMutation extends Mutation {
|
|
|
5626
5626
|
* Important! The names of these identifiers matter because the string forms
|
|
5627
5627
|
* are used for reverse lookups from the webchannel stream. Do NOT change the
|
|
5628
5628
|
* names of these identifiers or change this into a const enum.
|
|
5629
|
-
*/ var
|
|
5629
|
+
*/ var ce, le;
|
|
5630
5630
|
|
|
5631
5631
|
/**
|
|
5632
5632
|
* Determines whether an error code represents a permanent error when received
|
|
@@ -5639,29 +5639,29 @@ function __PRIVATE_isPermanentError(e) {
|
|
|
5639
5639
|
default:
|
|
5640
5640
|
return fail();
|
|
5641
5641
|
|
|
5642
|
-
case
|
|
5643
|
-
case
|
|
5644
|
-
case
|
|
5645
|
-
case
|
|
5646
|
-
case
|
|
5647
|
-
case
|
|
5642
|
+
case C.CANCELLED:
|
|
5643
|
+
case C.UNKNOWN:
|
|
5644
|
+
case C.DEADLINE_EXCEEDED:
|
|
5645
|
+
case C.RESOURCE_EXHAUSTED:
|
|
5646
|
+
case C.INTERNAL:
|
|
5647
|
+
case C.UNAVAILABLE:
|
|
5648
5648
|
// Unauthenticated means something went wrong with our token and we need
|
|
5649
5649
|
// to retry with new credentials which will happen automatically.
|
|
5650
|
-
case
|
|
5650
|
+
case C.UNAUTHENTICATED:
|
|
5651
5651
|
return !1;
|
|
5652
5652
|
|
|
5653
|
-
case
|
|
5654
|
-
case
|
|
5655
|
-
case
|
|
5656
|
-
case
|
|
5657
|
-
case
|
|
5653
|
+
case C.INVALID_ARGUMENT:
|
|
5654
|
+
case C.NOT_FOUND:
|
|
5655
|
+
case C.ALREADY_EXISTS:
|
|
5656
|
+
case C.PERMISSION_DENIED:
|
|
5657
|
+
case C.FAILED_PRECONDITION:
|
|
5658
5658
|
// Aborted might be retried in some scenarios, but that is dependant on
|
|
5659
5659
|
// the context and should handled individually by the calling code.
|
|
5660
5660
|
// See https://cloud.google.com/apis/design/errors.
|
|
5661
|
-
case
|
|
5662
|
-
case
|
|
5663
|
-
case
|
|
5664
|
-
case
|
|
5661
|
+
case C.ABORTED:
|
|
5662
|
+
case C.OUT_OF_RANGE:
|
|
5663
|
+
case C.UNIMPLEMENTED:
|
|
5664
|
+
case C.DATA_LOSS:
|
|
5665
5665
|
return !0;
|
|
5666
5666
|
}
|
|
5667
5667
|
}
|
|
@@ -5689,58 +5689,58 @@ function __PRIVATE_mapCodeFromRpcCode(e) {
|
|
|
5689
5689
|
if (void 0 === e)
|
|
5690
5690
|
// This shouldn't normally happen, but in certain error cases (like trying
|
|
5691
5691
|
// to send invalid proto messages) we may get an error with no GRPC code.
|
|
5692
|
-
return __PRIVATE_logError("GRPC error has no .code"),
|
|
5692
|
+
return __PRIVATE_logError("GRPC error has no .code"), C.UNKNOWN;
|
|
5693
5693
|
switch (e) {
|
|
5694
|
-
case
|
|
5695
|
-
return
|
|
5694
|
+
case ce.OK:
|
|
5695
|
+
return C.OK;
|
|
5696
5696
|
|
|
5697
|
-
case
|
|
5698
|
-
return
|
|
5697
|
+
case ce.CANCELLED:
|
|
5698
|
+
return C.CANCELLED;
|
|
5699
5699
|
|
|
5700
|
-
case
|
|
5701
|
-
return
|
|
5700
|
+
case ce.UNKNOWN:
|
|
5701
|
+
return C.UNKNOWN;
|
|
5702
5702
|
|
|
5703
|
-
case
|
|
5704
|
-
return
|
|
5703
|
+
case ce.DEADLINE_EXCEEDED:
|
|
5704
|
+
return C.DEADLINE_EXCEEDED;
|
|
5705
5705
|
|
|
5706
|
-
case
|
|
5707
|
-
return
|
|
5706
|
+
case ce.RESOURCE_EXHAUSTED:
|
|
5707
|
+
return C.RESOURCE_EXHAUSTED;
|
|
5708
5708
|
|
|
5709
|
-
case
|
|
5710
|
-
return
|
|
5709
|
+
case ce.INTERNAL:
|
|
5710
|
+
return C.INTERNAL;
|
|
5711
5711
|
|
|
5712
|
-
case
|
|
5713
|
-
return
|
|
5712
|
+
case ce.UNAVAILABLE:
|
|
5713
|
+
return C.UNAVAILABLE;
|
|
5714
5714
|
|
|
5715
|
-
case
|
|
5716
|
-
return
|
|
5715
|
+
case ce.UNAUTHENTICATED:
|
|
5716
|
+
return C.UNAUTHENTICATED;
|
|
5717
5717
|
|
|
5718
|
-
case
|
|
5719
|
-
return
|
|
5718
|
+
case ce.INVALID_ARGUMENT:
|
|
5719
|
+
return C.INVALID_ARGUMENT;
|
|
5720
5720
|
|
|
5721
|
-
case
|
|
5722
|
-
return
|
|
5721
|
+
case ce.NOT_FOUND:
|
|
5722
|
+
return C.NOT_FOUND;
|
|
5723
5723
|
|
|
5724
|
-
case
|
|
5725
|
-
return
|
|
5724
|
+
case ce.ALREADY_EXISTS:
|
|
5725
|
+
return C.ALREADY_EXISTS;
|
|
5726
5726
|
|
|
5727
|
-
case
|
|
5728
|
-
return
|
|
5727
|
+
case ce.PERMISSION_DENIED:
|
|
5728
|
+
return C.PERMISSION_DENIED;
|
|
5729
5729
|
|
|
5730
|
-
case
|
|
5731
|
-
return
|
|
5730
|
+
case ce.FAILED_PRECONDITION:
|
|
5731
|
+
return C.FAILED_PRECONDITION;
|
|
5732
5732
|
|
|
5733
|
-
case
|
|
5734
|
-
return
|
|
5733
|
+
case ce.ABORTED:
|
|
5734
|
+
return C.ABORTED;
|
|
5735
5735
|
|
|
5736
|
-
case
|
|
5737
|
-
return
|
|
5736
|
+
case ce.OUT_OF_RANGE:
|
|
5737
|
+
return C.OUT_OF_RANGE;
|
|
5738
5738
|
|
|
5739
|
-
case
|
|
5740
|
-
return
|
|
5739
|
+
case ce.UNIMPLEMENTED:
|
|
5740
|
+
return C.UNIMPLEMENTED;
|
|
5741
5741
|
|
|
5742
|
-
case
|
|
5743
|
-
return
|
|
5742
|
+
case ce.DATA_LOSS:
|
|
5743
|
+
return C.DATA_LOSS;
|
|
5744
5744
|
|
|
5745
5745
|
default:
|
|
5746
5746
|
return fail();
|
|
@@ -5754,14 +5754,14 @@ function __PRIVATE_mapCodeFromRpcCode(e) {
|
|
|
5754
5754
|
* "UNKNOWN", etc.)
|
|
5755
5755
|
* @returns The equivalent Code. Non-matching responses are mapped to
|
|
5756
5756
|
* Code.UNKNOWN.
|
|
5757
|
-
*/ (
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
|
|
5757
|
+
*/ (le = ce || (ce = {}))[le.OK = 0] = "OK", le[le.CANCELLED = 1] = "CANCELLED",
|
|
5758
|
+
le[le.UNKNOWN = 2] = "UNKNOWN", le[le.INVALID_ARGUMENT = 3] = "INVALID_ARGUMENT",
|
|
5759
|
+
le[le.DEADLINE_EXCEEDED = 4] = "DEADLINE_EXCEEDED", le[le.NOT_FOUND = 5] = "NOT_FOUND",
|
|
5760
|
+
le[le.ALREADY_EXISTS = 6] = "ALREADY_EXISTS", le[le.PERMISSION_DENIED = 7] = "PERMISSION_DENIED",
|
|
5761
|
+
le[le.UNAUTHENTICATED = 16] = "UNAUTHENTICATED", le[le.RESOURCE_EXHAUSTED = 8] = "RESOURCE_EXHAUSTED",
|
|
5762
|
+
le[le.FAILED_PRECONDITION = 9] = "FAILED_PRECONDITION", le[le.ABORTED = 10] = "ABORTED",
|
|
5763
|
+
le[le.OUT_OF_RANGE = 11] = "OUT_OF_RANGE", le[le.UNIMPLEMENTED = 12] = "UNIMPLEMENTED",
|
|
5764
|
+
le[le.INTERNAL = 13] = "INTERNAL", le[le.UNAVAILABLE = 14] = "UNAVAILABLE", le[le.DATA_LOSS = 15] = "DATA_LOSS";
|
|
5765
5765
|
|
|
5766
5766
|
/**
|
|
5767
5767
|
* @license
|
|
@@ -5786,7 +5786,7 @@ he[he.INTERNAL = 13] = "INTERNAL", he[he.UNAVAILABLE = 14] = "UNAVAILABLE", he[h
|
|
|
5786
5786
|
* integration tests that have registered callbacks to be notified of events
|
|
5787
5787
|
* that happen during the test execution.
|
|
5788
5788
|
*/
|
|
5789
|
-
let
|
|
5789
|
+
let he = null;
|
|
5790
5790
|
|
|
5791
5791
|
/**
|
|
5792
5792
|
* Sets the value of the `testingHooksSpi` object.
|
|
@@ -5834,7 +5834,7 @@ function __PRIVATE_newTextEncoder() {
|
|
|
5834
5834
|
* See the License for the specific language governing permissions and
|
|
5835
5835
|
* limitations under the License.
|
|
5836
5836
|
*/
|
|
5837
|
-
const
|
|
5837
|
+
const Pe = new bloomBlob.Integer([ 4294967295, 4294967295 ], 0);
|
|
5838
5838
|
|
|
5839
5839
|
// Hash a string using md5 hashing algorithm.
|
|
5840
5840
|
function __PRIVATE_getMd5HashValue(e) {
|
|
@@ -5869,7 +5869,7 @@ class BloomFilter {
|
|
|
5869
5869
|
// Calculate hashed value h(i) = h1 + (i * h2).
|
|
5870
5870
|
let r = e.add(t.multiply(bloomBlob.Integer.fromNumber(n)));
|
|
5871
5871
|
// Wrap if hash value overflow 64bit.
|
|
5872
|
-
return 1 === r.compare(
|
|
5872
|
+
return 1 === r.compare(Pe) && (r = new bloomBlob.Integer([ r.getBits(0), r.getBits(1) ], 0)),
|
|
5873
5873
|
r.modulo(this.Te).toNumber();
|
|
5874
5874
|
}
|
|
5875
5875
|
// Return whether the bit on the given index in the bitmap is set to 1.
|
|
@@ -6287,7 +6287,7 @@ class __PRIVATE_WatchChangeAggregator {
|
|
|
6287
6287
|
const e = 2 /* BloomFilterApplicationStatus.FalsePositive */ === i ? "TargetPurposeExistenceFilterMismatchBloom" /* TargetPurpose.ExistenceFilterMismatchBloom */ : "TargetPurposeExistenceFilterMismatch" /* TargetPurpose.ExistenceFilterMismatch */;
|
|
6288
6288
|
this.Qe = this.Qe.insert(t, e);
|
|
6289
6289
|
}
|
|
6290
|
-
null ==
|
|
6290
|
+
null == he || he.et(function __PRIVATE_createExistenceFilterMismatchInfoForTestingHooks(e, t, n, r, i) {
|
|
6291
6291
|
var s, o, _, a, u, c;
|
|
6292
6292
|
const l = {
|
|
6293
6293
|
localCacheCount: e,
|
|
@@ -6503,13 +6503,13 @@ function __PRIVATE_snapshotChangesMap() {
|
|
|
6503
6503
|
return new SortedMap(DocumentKey.comparator);
|
|
6504
6504
|
}
|
|
6505
6505
|
|
|
6506
|
-
const
|
|
6506
|
+
const Ie = (() => {
|
|
6507
6507
|
const e = {
|
|
6508
6508
|
asc: "ASCENDING",
|
|
6509
6509
|
desc: "DESCENDING"
|
|
6510
6510
|
};
|
|
6511
6511
|
return e;
|
|
6512
|
-
})(),
|
|
6512
|
+
})(), Te = (() => {
|
|
6513
6513
|
const e = {
|
|
6514
6514
|
"<": "LESS_THAN",
|
|
6515
6515
|
"<=": "LESS_THAN_OR_EQUAL",
|
|
@@ -6523,7 +6523,7 @@ const Te = (() => {
|
|
|
6523
6523
|
"array-contains-any": "ARRAY_CONTAINS_ANY"
|
|
6524
6524
|
};
|
|
6525
6525
|
return e;
|
|
6526
|
-
})(),
|
|
6526
|
+
})(), Ee = (() => {
|
|
6527
6527
|
const e = {
|
|
6528
6528
|
and: "AND",
|
|
6529
6529
|
or: "OR"
|
|
@@ -6625,8 +6625,8 @@ function __PRIVATE_toName(e, t) {
|
|
|
6625
6625
|
|
|
6626
6626
|
function fromName(e, t) {
|
|
6627
6627
|
const n = __PRIVATE_fromResourceName(t);
|
|
6628
|
-
if (n.get(1) !== e.databaseId.projectId) throw new FirestoreError(
|
|
6629
|
-
if (n.get(3) !== e.databaseId.database) throw new FirestoreError(
|
|
6628
|
+
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);
|
|
6629
|
+
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);
|
|
6630
6630
|
return new DocumentKey(__PRIVATE_extractLocalPathFromResourceName(n));
|
|
6631
6631
|
}
|
|
6632
6632
|
|
|
@@ -6700,7 +6700,7 @@ function __PRIVATE_fromWatchChange(e, t) {
|
|
|
6700
6700
|
// does not indicate that it extends Uint8Array.
|
|
6701
6701
|
t instanceof Buffer || t instanceof Uint8Array), ByteString.fromUint8Array(t || new Uint8Array));
|
|
6702
6702
|
}(e, t.targetChange.resumeToken), o = t.targetChange.cause, _ = o && function __PRIVATE_fromRpcStatus(e) {
|
|
6703
|
-
const t = void 0 === e.code ?
|
|
6703
|
+
const t = void 0 === e.code ? C.UNKNOWN : __PRIVATE_mapCodeFromRpcCode(e.code);
|
|
6704
6704
|
return new FirestoreError(t, e.message || "");
|
|
6705
6705
|
}(o);
|
|
6706
6706
|
n = new __PRIVATE_WatchTargetChange(r, i, s, _ || null);
|
|
@@ -7095,15 +7095,15 @@ function __PRIVATE_fromFilter(e) {
|
|
|
7095
7095
|
}
|
|
7096
7096
|
|
|
7097
7097
|
function __PRIVATE_toDirection(e) {
|
|
7098
|
-
return
|
|
7098
|
+
return Ie[e];
|
|
7099
7099
|
}
|
|
7100
7100
|
|
|
7101
7101
|
function __PRIVATE_toOperatorName(e) {
|
|
7102
|
-
return
|
|
7102
|
+
return Te[e];
|
|
7103
7103
|
}
|
|
7104
7104
|
|
|
7105
7105
|
function __PRIVATE_toCompositeOperatorName(e) {
|
|
7106
|
-
return
|
|
7106
|
+
return Ee[e];
|
|
7107
7107
|
}
|
|
7108
7108
|
|
|
7109
7109
|
function __PRIVATE_toFieldPathReference(e) {
|
|
@@ -8425,7 +8425,7 @@ function __PRIVATE_applyDistributionFieldAndCompositeFilters(e, t) {
|
|
|
8425
8425
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
8426
8426
|
* See the License for the specific language governing permissions and
|
|
8427
8427
|
* limitations under the License.
|
|
8428
|
-
*/ const
|
|
8428
|
+
*/ const de = new Uint8Array(0);
|
|
8429
8429
|
|
|
8430
8430
|
/**
|
|
8431
8431
|
* A persisted implementation of IndexManager.
|
|
@@ -8639,7 +8639,7 @@ class __PRIVATE_IndexedDbIndexManager {
|
|
|
8639
8639
|
// combined with the values from the query bounds.
|
|
8640
8640
|
const _ = (null != t ? t.length : 1) * Math.max(n.length, i.length), a = _ / (null != t ? t.length : 1), u = [];
|
|
8641
8641
|
for (let c = 0; c < _; ++c) {
|
|
8642
|
-
const _ = t ? this.Tn(t[c / a]) :
|
|
8642
|
+
const _ = t ? this.Tn(t[c / a]) : de, l = this.En(e, _, n[c % a], r), h = this.dn(e, _, i[c % a], s), P = o.map((t => this.En(e, _, t,
|
|
8643
8643
|
/* inclusive= */ !0)));
|
|
8644
8644
|
u.push(...this.createRange(l, h, P));
|
|
8645
8645
|
}
|
|
@@ -8836,7 +8836,7 @@ class __PRIVATE_IndexedDbIndexManager {
|
|
|
8836
8836
|
if (null != i) {
|
|
8837
8837
|
const s = e.data.field(i.fieldPath);
|
|
8838
8838
|
if (isArray(s)) for (const i of s.arrayValue.values || []) n = n.add(new __PRIVATE_IndexEntry(t.indexId, e.key, this.Tn(i), r));
|
|
8839
|
-
} else n = n.add(new __PRIVATE_IndexEntry(t.indexId, e.key,
|
|
8839
|
+
} else n = n.add(new __PRIVATE_IndexEntry(t.indexId, e.key, de, r));
|
|
8840
8840
|
return n;
|
|
8841
8841
|
}
|
|
8842
8842
|
/**
|
|
@@ -8911,7 +8911,7 @@ class __PRIVATE_IndexedDbIndexManager {
|
|
|
8911
8911
|
// If we encounter two bounds that will create an unmatchable key range,
|
|
8912
8912
|
// then we return an empty set of key ranges.
|
|
8913
8913
|
if (this.Dn(r[e], r[e + 1])) return [];
|
|
8914
|
-
const t = [ r[e].indexId, this.uid, r[e].arrayValue, r[e].directionalValue,
|
|
8914
|
+
const t = [ r[e].indexId, this.uid, r[e].arrayValue, r[e].directionalValue, de, [] ], n = [ r[e + 1].indexId, this.uid, r[e + 1].arrayValue, r[e + 1].directionalValue, de, [] ];
|
|
8915
8915
|
i.push(IDBKeyRange.bound(t, n));
|
|
8916
8916
|
}
|
|
8917
8917
|
return i;
|
|
@@ -8979,7 +8979,7 @@ function __PRIVATE_getMinOffsetFromFieldIndexes(e) {
|
|
|
8979
8979
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
8980
8980
|
* See the License for the specific language governing permissions and
|
|
8981
8981
|
* limitations under the License.
|
|
8982
|
-
*/ const
|
|
8982
|
+
*/ const Ae = {
|
|
8983
8983
|
didRun: !1,
|
|
8984
8984
|
sequenceNumbersCollected: 0,
|
|
8985
8985
|
targetsRemoved: 0,
|
|
@@ -9143,7 +9143,7 @@ class __PRIVATE_IndexedDbMutationQueue {
|
|
|
9143
9143
|
let c = new SortedSet(((e, t) => __PRIVATE_primitiveComparator(e.canonicalString(), t.canonicalString())));
|
|
9144
9144
|
for (const e of r) {
|
|
9145
9145
|
const t = __PRIVATE_newDbDocumentMutationKey(this.userId, e.key.path, o);
|
|
9146
|
-
c = c.add(e.key.path.popLast()), u.push(s.put(a)), u.push(i.put(t,
|
|
9146
|
+
c = c.add(e.key.path.popLast()), u.push(s.put(a)), u.push(i.put(t, O));
|
|
9147
9147
|
}
|
|
9148
9148
|
return c.forEach((t => {
|
|
9149
9149
|
u.push(this.indexManager.addToCollectionParentIndex(e, t));
|
|
@@ -9712,8 +9712,8 @@ class __PRIVATE_TargetIdGenerator {
|
|
|
9712
9712
|
}
|
|
9713
9713
|
collect(e, t) {
|
|
9714
9714
|
return -1 === this.params.cacheSizeCollectionThreshold ? (__PRIVATE_logDebug("LruGarbageCollector", "Garbage collection skipped; disabled"),
|
|
9715
|
-
PersistencePromise.resolve(
|
|
9716
|
-
|
|
9715
|
+
PersistencePromise.resolve(Ae)) : 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}`),
|
|
9716
|
+
Ae) : this.Yn(e, t)));
|
|
9717
9717
|
}
|
|
9718
9718
|
getCacheSize(e) {
|
|
9719
9719
|
return this.jn.getCacheSize(e);
|
|
@@ -11473,7 +11473,7 @@ class __PRIVATE_MemoryLruDelegate {
|
|
|
11473
11473
|
e.createObjectStore("mutations", {
|
|
11474
11474
|
keyPath: "batchId",
|
|
11475
11475
|
autoIncrement: !0
|
|
11476
|
-
}).createIndex("userMutationsIndex",
|
|
11476
|
+
}).createIndex("userMutationsIndex", x, {
|
|
11477
11477
|
unique: !0
|
|
11478
11478
|
}), e.createObjectStore("documentMutations");
|
|
11479
11479
|
}
|
|
@@ -11518,7 +11518,7 @@ class __PRIVATE_MemoryLruDelegate {
|
|
|
11518
11518
|
e.createObjectStore("mutations", {
|
|
11519
11519
|
keyPath: "batchId",
|
|
11520
11520
|
autoIncrement: !0
|
|
11521
|
-
}).createIndex("userMutationsIndex",
|
|
11521
|
+
}).createIndex("userMutationsIndex", x, {
|
|
11522
11522
|
unique: !0
|
|
11523
11523
|
});
|
|
11524
11524
|
const r = t.store("mutations"), i = n.map((e => r.put(e)));
|
|
@@ -11555,19 +11555,19 @@ class __PRIVATE_MemoryLruDelegate {
|
|
|
11555
11555
|
}))), n < 12 && r >= 12 && (s = s.next((() => {
|
|
11556
11556
|
!function __PRIVATE_createDocumentOverlayStore(e) {
|
|
11557
11557
|
const t = e.createObjectStore("documentOverlays", {
|
|
11558
|
-
keyPath:
|
|
11558
|
+
keyPath: z
|
|
11559
11559
|
});
|
|
11560
|
-
t.createIndex("collectionPathOverlayIndex",
|
|
11560
|
+
t.createIndex("collectionPathOverlayIndex", j, {
|
|
11561
11561
|
unique: !1
|
|
11562
|
-
}), t.createIndex("collectionGroupOverlayIndex",
|
|
11562
|
+
}), t.createIndex("collectionGroupOverlayIndex", H, {
|
|
11563
11563
|
unique: !1
|
|
11564
11564
|
});
|
|
11565
11565
|
}(e);
|
|
11566
11566
|
}))), n < 13 && r >= 13 && (s = s.next((() => function __PRIVATE_createRemoteDocumentCache(e) {
|
|
11567
11567
|
const t = e.createObjectStore("remoteDocumentsV14", {
|
|
11568
|
-
keyPath:
|
|
11568
|
+
keyPath: N
|
|
11569
11569
|
});
|
|
11570
|
-
t.createIndex("documentKeyIndex",
|
|
11570
|
+
t.createIndex("documentKeyIndex", L), t.createIndex("collectionGroupIndex", B);
|
|
11571
11571
|
}(e))).next((() => this.ii(e, i))).next((() => e.deleteObjectStore("remoteDocuments")))),
|
|
11572
11572
|
n < 14 && r >= 14 && (s = s.next((() => this.si(e, i)))), n < 15 && r >= 15 && (s = s.next((() => function __PRIVATE_createFieldIndex(e) {
|
|
11573
11573
|
e.createObjectStore("indexConfiguration", {
|
|
@@ -11577,13 +11577,13 @@ class __PRIVATE_MemoryLruDelegate {
|
|
|
11577
11577
|
unique: !1
|
|
11578
11578
|
});
|
|
11579
11579
|
e.createObjectStore("indexState", {
|
|
11580
|
-
keyPath:
|
|
11581
|
-
}).createIndex("sequenceNumberIndex",
|
|
11580
|
+
keyPath: $
|
|
11581
|
+
}).createIndex("sequenceNumberIndex", U, {
|
|
11582
11582
|
unique: !1
|
|
11583
11583
|
});
|
|
11584
11584
|
e.createObjectStore("indexEntries", {
|
|
11585
|
-
keyPath:
|
|
11586
|
-
}).createIndex("documentKeyIndex",
|
|
11585
|
+
keyPath: W
|
|
11586
|
+
}).createIndex("documentKeyIndex", G, {
|
|
11587
11587
|
unique: !1
|
|
11588
11588
|
});
|
|
11589
11589
|
}(e)))), n < 16 && r >= 16 && (
|
|
@@ -11638,7 +11638,7 @@ class __PRIVATE_MemoryLruDelegate {
|
|
|
11638
11638
|
ni(e, t) {
|
|
11639
11639
|
// Create the index.
|
|
11640
11640
|
e.createObjectStore("collectionParents", {
|
|
11641
|
-
keyPath:
|
|
11641
|
+
keyPath: K
|
|
11642
11642
|
});
|
|
11643
11643
|
const n = t.store("collectionParents"), r = new __PRIVATE_MemoryCollectionParentIndex, addEntry = e => {
|
|
11644
11644
|
if (r.add(e)) {
|
|
@@ -11723,19 +11723,19 @@ class __PRIVATE_MemoryLruDelegate {
|
|
|
11723
11723
|
|
|
11724
11724
|
function __PRIVATE_createQueryCache(e) {
|
|
11725
11725
|
e.createObjectStore("targetDocuments", {
|
|
11726
|
-
keyPath:
|
|
11727
|
-
}).createIndex("documentTargetsIndex",
|
|
11726
|
+
keyPath: q
|
|
11727
|
+
}).createIndex("documentTargetsIndex", Q, {
|
|
11728
11728
|
unique: !0
|
|
11729
11729
|
});
|
|
11730
11730
|
// NOTE: This is unique only because the TargetId is the suffix.
|
|
11731
11731
|
e.createObjectStore("targets", {
|
|
11732
11732
|
keyPath: "targetId"
|
|
11733
|
-
}).createIndex("queryTargetsIndex",
|
|
11733
|
+
}).createIndex("queryTargetsIndex", k, {
|
|
11734
11734
|
unique: !0
|
|
11735
11735
|
}), e.createObjectStore("targetGlobal");
|
|
11736
11736
|
}
|
|
11737
11737
|
|
|
11738
|
-
const
|
|
11738
|
+
const Re = "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.";
|
|
11739
11739
|
|
|
11740
11740
|
/**
|
|
11741
11741
|
* Oldest acceptable age in milliseconds for client metadata before the client
|
|
@@ -11811,7 +11811,7 @@ class __PRIVATE_IndexedDbPersistence {
|
|
|
11811
11811
|
/** The last time we garbage collected the client metadata object store. */
|
|
11812
11812
|
this.Pi = Number.NEGATIVE_INFINITY,
|
|
11813
11813
|
/** A listener to notify on primary state changes. */
|
|
11814
|
-
this.Ii = e => Promise.resolve(), !__PRIVATE_IndexedDbPersistence.D()) throw new FirestoreError(
|
|
11814
|
+
this.Ii = 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.");
|
|
11815
11815
|
this.referenceDelegate = new __PRIVATE_IndexedDbLruDelegateImpl(this, r), this.Ti = t + "main",
|
|
11816
11816
|
this.serializer = new __PRIVATE_LocalSerializer(_), this.Ei = new __PRIVATE_SimpleDb(this.Ti, this.ui, new __PRIVATE_SchemaConverter(this.serializer)),
|
|
11817
11817
|
this.Qr = new __PRIVATE_IndexedDbTargetCache(this.referenceDelegate, this.serializer),
|
|
@@ -11831,7 +11831,7 @@ class __PRIVATE_IndexedDbPersistence {
|
|
|
11831
11831
|
if (!this.isPrimary && !this.allowTabSynchronization)
|
|
11832
11832
|
// Fail `start()` if `synchronizeTabs` is disabled and we cannot
|
|
11833
11833
|
// obtain the primary lease.
|
|
11834
|
-
throw new FirestoreError(
|
|
11834
|
+
throw new FirestoreError(C.FAILED_PRECONDITION, Re);
|
|
11835
11835
|
return this.Ri(), this.Vi(), this.mi(), this.runTransaction("getHighestListenSequenceNumber", "readonly", (e => this.Qr.getHighestSequenceNumber(e)));
|
|
11836
11836
|
})).then((e => {
|
|
11837
11837
|
this.kr = new __PRIVATE_ListenSequence(e, this._i);
|
|
@@ -11973,7 +11973,7 @@ class __PRIVATE_IndexedDbPersistence {
|
|
|
11973
11973
|
// settings is not supported.
|
|
11974
11974
|
// TODO(b/114226234): Remove this check when `synchronizeTabs` can
|
|
11975
11975
|
// no longer be turned off.
|
|
11976
|
-
throw new FirestoreError(
|
|
11976
|
+
throw new FirestoreError(C.FAILED_PRECONDITION, Re);
|
|
11977
11977
|
return !1;
|
|
11978
11978
|
}
|
|
11979
11979
|
}
|
|
@@ -12043,7 +12043,7 @@ class __PRIVATE_IndexedDbPersistence {
|
|
|
12043
12043
|
const r = "readonly" === t ? "readonly" : "readwrite", i =
|
|
12044
12044
|
/** Returns the object stores for the provided schema. */
|
|
12045
12045
|
function __PRIVATE_getObjectStores(e) {
|
|
12046
|
-
return 16 === e ?
|
|
12046
|
+
return 16 === e ? te : 15 === e ? ee : 14 === e ? X : 13 === e ? Z : 12 === e ? Y : 11 === e ? J : void fail();
|
|
12047
12047
|
}(this.ui);
|
|
12048
12048
|
let s;
|
|
12049
12049
|
// Do all transactions as readwrite against all object stores, since we
|
|
@@ -12051,7 +12051,7 @@ class __PRIVATE_IndexedDbPersistence {
|
|
|
12051
12051
|
return this.Ei.runTransaction(e, r, i, (r => (s = new __PRIVATE_IndexedDbTransaction(r, this.kr ? this.kr.next() : __PRIVATE_ListenSequence.oe),
|
|
12052
12052
|
"readwrite-primary" === t ? this.gi(s).next((e => !!e || this.pi(s))).next((t => {
|
|
12053
12053
|
if (!t) throw __PRIVATE_logError(`Failed to obtain primary lease for action '${e}'.`),
|
|
12054
|
-
this.isPrimary = !1, this.oi.enqueueRetryable((() => this.Ii(!1))), new FirestoreError(
|
|
12054
|
+
this.isPrimary = !1, this.oi.enqueueRetryable((() => this.Ii(!1))), new FirestoreError(C.FAILED_PRECONDITION, F);
|
|
12055
12055
|
return n(s);
|
|
12056
12056
|
})).next((e => this.wi(s).next((() => e)))) : this.ki(s).next((() => n(s)))))).then((e => (s.raiseOnCommittedEvent(),
|
|
12057
12057
|
e)));
|
|
@@ -12064,7 +12064,7 @@ class __PRIVATE_IndexedDbPersistence {
|
|
|
12064
12064
|
// be turned off.
|
|
12065
12065
|
ki(e) {
|
|
12066
12066
|
return __PRIVATE_primaryClientStore(e).get("owner").next((e => {
|
|
12067
|
-
if (null !== e && this.Ci(e.leaseTimestampMs, 5e3) && !this.Mi(e.ownerId) && !this.Si(e) && !(this.ai || this.allowTabSynchronization && e.allowTabSynchronization)) throw new FirestoreError(
|
|
12067
|
+
if (null !== e && this.Ci(e.leaseTimestampMs, 5e3) && !this.Mi(e.ownerId) && !this.Si(e) && !(this.ai || this.allowTabSynchronization && e.allowTabSynchronization)) throw new FirestoreError(C.FAILED_PRECONDITION, Re);
|
|
12068
12068
|
}));
|
|
12069
12069
|
}
|
|
12070
12070
|
/**
|
|
@@ -13561,7 +13561,7 @@ class __PRIVATE_BrowserConnectivityMonitor {
|
|
|
13561
13561
|
/**
|
|
13562
13562
|
* The value returned from the most recent invocation of
|
|
13563
13563
|
* `generateUniqueDebugId()`, or null if it has never been invoked.
|
|
13564
|
-
*/ let
|
|
13564
|
+
*/ let Ve = null;
|
|
13565
13565
|
|
|
13566
13566
|
/**
|
|
13567
13567
|
* Generates and returns an initial value for `lastUniqueDebugId`.
|
|
@@ -13586,9 +13586,9 @@ class __PRIVATE_BrowserConnectivityMonitor {
|
|
|
13586
13586
|
* @return the 10-character generated ID (e.g. "0xa1b2c3d4").
|
|
13587
13587
|
*/
|
|
13588
13588
|
function __PRIVATE_generateUniqueDebugId() {
|
|
13589
|
-
return null ===
|
|
13589
|
+
return null === Ve ? Ve = function __PRIVATE_generateInitialUniqueDebugId() {
|
|
13590
13590
|
return 268435456 + Math.round(2147483648 * Math.random());
|
|
13591
|
-
}() :
|
|
13591
|
+
}() : Ve++, "0x" + Ve.toString(16);
|
|
13592
13592
|
}
|
|
13593
13593
|
|
|
13594
13594
|
/**
|
|
@@ -13606,7 +13606,7 @@ function __PRIVATE_generateUniqueDebugId() {
|
|
|
13606
13606
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13607
13607
|
* See the License for the specific language governing permissions and
|
|
13608
13608
|
* limitations under the License.
|
|
13609
|
-
*/ const
|
|
13609
|
+
*/ const me = {
|
|
13610
13610
|
BatchGetDocuments: "batchGet",
|
|
13611
13611
|
Commit: "commit",
|
|
13612
13612
|
RunQuery: "runQuery",
|
|
@@ -13690,7 +13690,7 @@ class __PRIVATE_StreamBridge {
|
|
|
13690
13690
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13691
13691
|
* See the License for the specific language governing permissions and
|
|
13692
13692
|
* limitations under the License.
|
|
13693
|
-
*/ const
|
|
13693
|
+
*/ const fe = "WebChannelConnection";
|
|
13694
13694
|
|
|
13695
13695
|
class __PRIVATE_WebChannelConnection extends
|
|
13696
13696
|
/**
|
|
@@ -13734,7 +13734,7 @@ class __PRIVATE_RestConnection {
|
|
|
13734
13734
|
// SDK_VERSION is updated to different value at runtime depending on the entry point,
|
|
13735
13735
|
// so we need to get its value when we need it in a function.
|
|
13736
13736
|
function __PRIVATE_getGoogApiClientValue() {
|
|
13737
|
-
return "gl-js/ fire/" +
|
|
13737
|
+
return "gl-js/ fire/" + b;
|
|
13738
13738
|
}(),
|
|
13739
13739
|
// Content-Type: text/plain will avoid preflight requests which might
|
|
13740
13740
|
// mess with CORS and redirects by proxies. If we add custom headers
|
|
@@ -13744,7 +13744,7 @@ class __PRIVATE_RestConnection {
|
|
|
13744
13744
|
t && t.headers.forEach(((t, n) => e[n] = t)), n && n.headers.forEach(((t, n) => e[n] = t));
|
|
13745
13745
|
}
|
|
13746
13746
|
vo(e, t) {
|
|
13747
|
-
const n =
|
|
13747
|
+
const n = me[e];
|
|
13748
13748
|
return `${this.wo}/v1/${t}:${n}`;
|
|
13749
13749
|
}
|
|
13750
13750
|
/**
|
|
@@ -13768,17 +13768,17 @@ class __PRIVATE_RestConnection {
|
|
|
13768
13768
|
switch (_.getLastErrorCode()) {
|
|
13769
13769
|
case webchannelBlob.ErrorCode.NO_ERROR:
|
|
13770
13770
|
const t = _.getResponseJson();
|
|
13771
|
-
__PRIVATE_logDebug(
|
|
13771
|
+
__PRIVATE_logDebug(fe, `XHR for RPC '${e}' ${i} received:`, JSON.stringify(t)),
|
|
13772
13772
|
s(t);
|
|
13773
13773
|
break;
|
|
13774
13774
|
|
|
13775
13775
|
case webchannelBlob.ErrorCode.TIMEOUT:
|
|
13776
|
-
__PRIVATE_logDebug(
|
|
13776
|
+
__PRIVATE_logDebug(fe, `RPC '${e}' ${i} timed out`), o(new FirestoreError(C.DEADLINE_EXCEEDED, "Request time out"));
|
|
13777
13777
|
break;
|
|
13778
13778
|
|
|
13779
13779
|
case webchannelBlob.ErrorCode.HTTP_ERROR:
|
|
13780
13780
|
const n = _.getStatus();
|
|
13781
|
-
if (__PRIVATE_logDebug(
|
|
13781
|
+
if (__PRIVATE_logDebug(fe, `RPC '${e}' ${i} failed with status:`, n, "response text:", _.getResponseText()),
|
|
13782
13782
|
n > 0) {
|
|
13783
13783
|
let e = _.getResponseJson();
|
|
13784
13784
|
Array.isArray(e) && (e = e[0]);
|
|
@@ -13786,25 +13786,25 @@ class __PRIVATE_RestConnection {
|
|
|
13786
13786
|
if (t && t.status && t.message) {
|
|
13787
13787
|
const e = function __PRIVATE_mapCodeFromHttpResponseErrorStatus(e) {
|
|
13788
13788
|
const t = e.toLowerCase().replace(/_/g, "-");
|
|
13789
|
-
return Object.values(
|
|
13789
|
+
return Object.values(C).indexOf(t) >= 0 ? t : C.UNKNOWN;
|
|
13790
13790
|
}(t.status);
|
|
13791
13791
|
o(new FirestoreError(e, t.message));
|
|
13792
|
-
} else o(new FirestoreError(
|
|
13792
|
+
} else o(new FirestoreError(C.UNKNOWN, "Server responded with status " + _.getStatus()));
|
|
13793
13793
|
} else
|
|
13794
13794
|
// If we received an HTTP_ERROR but there's no status code,
|
|
13795
13795
|
// it's most probably a connection issue
|
|
13796
|
-
o(new FirestoreError(
|
|
13796
|
+
o(new FirestoreError(C.UNAVAILABLE, "Connection failed."));
|
|
13797
13797
|
break;
|
|
13798
13798
|
|
|
13799
13799
|
default:
|
|
13800
13800
|
fail();
|
|
13801
13801
|
}
|
|
13802
13802
|
} finally {
|
|
13803
|
-
__PRIVATE_logDebug(
|
|
13803
|
+
__PRIVATE_logDebug(fe, `RPC '${e}' ${i} completed.`);
|
|
13804
13804
|
}
|
|
13805
13805
|
}));
|
|
13806
13806
|
const a = JSON.stringify(r);
|
|
13807
|
-
__PRIVATE_logDebug(
|
|
13807
|
+
__PRIVATE_logDebug(fe, `RPC '${e}' ${i} sending request:`, r), _.send(t, "POST", a, n, 15);
|
|
13808
13808
|
}));
|
|
13809
13809
|
}
|
|
13810
13810
|
Oo(e, t, n) {
|
|
@@ -13845,7 +13845,7 @@ class __PRIVATE_RestConnection {
|
|
|
13845
13845
|
// which is recognized by the webchannel backend.
|
|
13846
13846
|
_.encodeInitMessageHeaders = !0;
|
|
13847
13847
|
const u = i.join("");
|
|
13848
|
-
__PRIVATE_logDebug(
|
|
13848
|
+
__PRIVATE_logDebug(fe, `Creating RPC '${e}' stream ${r}: ${u}`, _);
|
|
13849
13849
|
const c = s.createWebChannel(u, _);
|
|
13850
13850
|
// WebChannel supports sending the first message with the handshake - saving
|
|
13851
13851
|
// a network round trip. However, it will have to call send in the same
|
|
@@ -13858,8 +13858,8 @@ class __PRIVATE_RestConnection {
|
|
|
13858
13858
|
// on a closed stream
|
|
13859
13859
|
const P = new __PRIVATE_StreamBridge({
|
|
13860
13860
|
lo: t => {
|
|
13861
|
-
h ? __PRIVATE_logDebug(
|
|
13862
|
-
c.open(), l = !0), __PRIVATE_logDebug(
|
|
13861
|
+
h ? __PRIVATE_logDebug(fe, `Not sending because RPC '${e}' stream ${r} is closed:`, t) : (l || (__PRIVATE_logDebug(fe, `Opening RPC '${e}' stream ${r} transport.`),
|
|
13862
|
+
c.open(), l = !0), __PRIVATE_logDebug(fe, `RPC '${e}' stream ${r} sending:`, t),
|
|
13863
13863
|
c.send(t));
|
|
13864
13864
|
},
|
|
13865
13865
|
ho: () => c.close()
|
|
@@ -13881,13 +13881,13 @@ class __PRIVATE_RestConnection {
|
|
|
13881
13881
|
// Note that eventually this function could go away if we are confident
|
|
13882
13882
|
// enough the code is exception free.
|
|
13883
13883
|
return __PRIVATE_unguardedEventListen(c, webchannelBlob.WebChannel.EventType.OPEN, (() => {
|
|
13884
|
-
h || (__PRIVATE_logDebug(
|
|
13884
|
+
h || (__PRIVATE_logDebug(fe, `RPC '${e}' stream ${r} transport opened.`), P.mo());
|
|
13885
13885
|
})), __PRIVATE_unguardedEventListen(c, webchannelBlob.WebChannel.EventType.CLOSE, (() => {
|
|
13886
|
-
h || (h = !0, __PRIVATE_logDebug(
|
|
13886
|
+
h || (h = !0, __PRIVATE_logDebug(fe, `RPC '${e}' stream ${r} transport closed`),
|
|
13887
13887
|
P.po());
|
|
13888
13888
|
})), __PRIVATE_unguardedEventListen(c, webchannelBlob.WebChannel.EventType.ERROR, (t => {
|
|
13889
|
-
h || (h = !0, __PRIVATE_logWarn(
|
|
13890
|
-
P.po(new FirestoreError(
|
|
13889
|
+
h || (h = !0, __PRIVATE_logWarn(fe, `RPC '${e}' stream ${r} transport errored:`, t),
|
|
13890
|
+
P.po(new FirestoreError(C.UNAVAILABLE, "The operation could not be completed")));
|
|
13891
13891
|
})), __PRIVATE_unguardedEventListen(c, webchannelBlob.WebChannel.EventType.MESSAGE, (t => {
|
|
13892
13892
|
var n;
|
|
13893
13893
|
if (!h) {
|
|
@@ -13900,7 +13900,7 @@ class __PRIVATE_RestConnection {
|
|
|
13900
13900
|
// Use any because msgData.error is not typed.
|
|
13901
13901
|
const s = i, o = s.error || (null === (n = s[0]) || void 0 === n ? void 0 : n.error);
|
|
13902
13902
|
if (o) {
|
|
13903
|
-
__PRIVATE_logDebug(
|
|
13903
|
+
__PRIVATE_logDebug(fe, `RPC '${e}' stream ${r} received error:`, o);
|
|
13904
13904
|
// error.status will be a string like 'OK' or 'NOT_FOUND'.
|
|
13905
13905
|
const t = o.status;
|
|
13906
13906
|
let n =
|
|
@@ -13913,16 +13913,16 @@ class __PRIVATE_RestConnection {
|
|
|
13913
13913
|
function __PRIVATE_mapCodeFromRpcStatus(e) {
|
|
13914
13914
|
// lookup by string
|
|
13915
13915
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13916
|
-
const t =
|
|
13916
|
+
const t = ce[e];
|
|
13917
13917
|
if (void 0 !== t) return __PRIVATE_mapCodeFromRpcCode(t);
|
|
13918
13918
|
}(t), i = o.message;
|
|
13919
|
-
void 0 === n && (n =
|
|
13919
|
+
void 0 === n && (n = C.INTERNAL, i = "Unknown error status: " + t + " with message " + o.message),
|
|
13920
13920
|
// Mark closed so no further events are propagated
|
|
13921
13921
|
h = !0, P.po(new FirestoreError(n, i)), c.close();
|
|
13922
|
-
} else __PRIVATE_logDebug(
|
|
13922
|
+
} else __PRIVATE_logDebug(fe, `RPC '${e}' stream ${r} received:`, i), P.yo(i);
|
|
13923
13923
|
}
|
|
13924
13924
|
})), __PRIVATE_unguardedEventListen(o, webchannelBlob.Event.STAT_EVENT, (t => {
|
|
13925
|
-
t.stat === webchannelBlob.Stat.PROXY ? __PRIVATE_logDebug(
|
|
13925
|
+
t.stat === webchannelBlob.Stat.PROXY ? __PRIVATE_logDebug(fe, `RPC '${e}' stream ${r} detected buffering proxy`) : t.stat === webchannelBlob.Stat.NOPROXY && __PRIVATE_logDebug(fe, `RPC '${e}' stream ${r} detected no buffering proxy`);
|
|
13926
13926
|
})), setTimeout((() => {
|
|
13927
13927
|
// Technically we could/should wait for the WebChannel opened event,
|
|
13928
13928
|
// but because we want to send the first message with the WebChannel
|
|
@@ -14246,10 +14246,10 @@ class __PRIVATE_PersistentStream {
|
|
|
14246
14246
|
// underlying stream), guaranteeing they won't execute.
|
|
14247
14247
|
this.jo++, 4 /* PersistentStreamState.Error */ !== e ?
|
|
14248
14248
|
// If this is an intentional close ensure we don't delay our next connection attempt.
|
|
14249
|
-
this.Yo.reset() : t && t.code ===
|
|
14249
|
+
this.Yo.reset() : t && t.code === C.RESOURCE_EXHAUSTED ? (
|
|
14250
14250
|
// Log the error. (Probably either 'quota exceeded' or 'max queue length reached'.)
|
|
14251
14251
|
__PRIVATE_logError(t.toString()), __PRIVATE_logError("Using maximum backoff delay to prevent overloading the backend."),
|
|
14252
|
-
this.Yo.Ko()) : t && t.code ===
|
|
14252
|
+
this.Yo.Ko()) : t && t.code === C.UNAUTHENTICATED && 3 /* PersistentStreamState.Healthy */ !== this.state && (
|
|
14253
14253
|
// "unauthenticated" error means the token was rejected. This should rarely
|
|
14254
14254
|
// happen since both Auth and AppCheck ensure a sufficient TTL when we
|
|
14255
14255
|
// request a token. If a user manually resets their system clock this can
|
|
@@ -14285,7 +14285,7 @@ class __PRIVATE_PersistentStream {
|
|
|
14285
14285
|
this.u_(e, n);
|
|
14286
14286
|
}), (t => {
|
|
14287
14287
|
e((() => {
|
|
14288
|
-
const e = new FirestoreError(
|
|
14288
|
+
const e = new FirestoreError(C.UNKNOWN, "Fetching auth token failed: " + t.message);
|
|
14289
14289
|
return this.c_(e);
|
|
14290
14290
|
}));
|
|
14291
14291
|
}));
|
|
@@ -14500,18 +14500,18 @@ class __PRIVATE_DatastoreImpl extends class Datastore {} {
|
|
|
14500
14500
|
this.serializer = r, this.m_ = !1;
|
|
14501
14501
|
}
|
|
14502
14502
|
f_() {
|
|
14503
|
-
if (this.m_) throw new FirestoreError(
|
|
14503
|
+
if (this.m_) throw new FirestoreError(C.FAILED_PRECONDITION, "The client has already been terminated.");
|
|
14504
14504
|
}
|
|
14505
14505
|
/** Invokes the provided RPC with auth and AppCheck tokens. */ Co(e, t, n, r) {
|
|
14506
14506
|
return this.f_(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([i, s]) => this.connection.Co(e, __PRIVATE_toResourcePath(t, n), r, i, s))).catch((e => {
|
|
14507
|
-
throw "FirebaseError" === e.name ? (e.code ===
|
|
14508
|
-
this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(
|
|
14507
|
+
throw "FirebaseError" === e.name ? (e.code === C.UNAUTHENTICATED && (this.authCredentials.invalidateToken(),
|
|
14508
|
+
this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(C.UNKNOWN, e.toString());
|
|
14509
14509
|
}));
|
|
14510
14510
|
}
|
|
14511
14511
|
/** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ xo(e, t, n, r, i) {
|
|
14512
14512
|
return this.f_(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([s, o]) => this.connection.xo(e, __PRIVATE_toResourcePath(t, n), r, s, o, i))).catch((e => {
|
|
14513
|
-
throw "FirebaseError" === e.name ? (e.code ===
|
|
14514
|
-
this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(
|
|
14513
|
+
throw "FirebaseError" === e.name ? (e.code === C.UNAUTHENTICATED && (this.authCredentials.invalidateToken(),
|
|
14514
|
+
this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(C.UNKNOWN, e.toString());
|
|
14515
14515
|
}));
|
|
14516
14516
|
}
|
|
14517
14517
|
terminate() {
|
|
@@ -14955,7 +14955,7 @@ async function __PRIVATE_onWriteStreamClose(e, t) {
|
|
|
14955
14955
|
// Only handle permanent errors here. If it's transient, just let the retry
|
|
14956
14956
|
// logic kick in.
|
|
14957
14957
|
if (function __PRIVATE_isPermanentWriteError(e) {
|
|
14958
|
-
return __PRIVATE_isPermanentError(e) && e !==
|
|
14958
|
+
return __PRIVATE_isPermanentError(e) && e !== C.ABORTED;
|
|
14959
14959
|
}(t.code)) {
|
|
14960
14960
|
// This was a permanent error, the request itself was the problem
|
|
14961
14961
|
// so it's not going to succeed if we resend it.
|
|
@@ -15138,7 +15138,7 @@ class DelayedOperation {
|
|
|
15138
15138
|
* As long as the operation has not yet been run, calling cancel() provides a
|
|
15139
15139
|
* guarantee that the operation will not be run.
|
|
15140
15140
|
*/ cancel(e) {
|
|
15141
|
-
null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new FirestoreError(
|
|
15141
|
+
null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new FirestoreError(C.CANCELLED, "Operation cancelled" + (e ? ": " + e : ""))));
|
|
15142
15142
|
}
|
|
15143
15143
|
handleDelayElapsed() {
|
|
15144
15144
|
this.asyncQueue.enqueueAndForget((() => null !== this.timerHandle ? (this.clearTimeout(),
|
|
@@ -15154,7 +15154,7 @@ class DelayedOperation {
|
|
|
15154
15154
|
* Returns a FirestoreError that can be surfaced to the user if the provided
|
|
15155
15155
|
* error is an IndexedDbTransactionError. Re-throws the error otherwise.
|
|
15156
15156
|
*/ function __PRIVATE_wrapInUserErrorIfRecoverable(e, t) {
|
|
15157
|
-
if (__PRIVATE_logError("AsyncQueue", `${t}: ${e}`), __PRIVATE_isIndexedDbTransactionError(e)) return new FirestoreError(
|
|
15157
|
+
if (__PRIVATE_logError("AsyncQueue", `${t}: ${e}`), __PRIVATE_isIndexedDbTransactionError(e)) return new FirestoreError(C.UNAVAILABLE, `${t}: ${e}`);
|
|
15158
15158
|
throw e;
|
|
15159
15159
|
}
|
|
15160
15160
|
|
|
@@ -15467,12 +15467,12 @@ function __PRIVATE_raiseSnapshotsInSyncEvent(e) {
|
|
|
15467
15467
|
}));
|
|
15468
15468
|
}
|
|
15469
15469
|
|
|
15470
|
-
var
|
|
15470
|
+
var ge, pe;
|
|
15471
15471
|
|
|
15472
15472
|
/** Listen to both cache and server changes */
|
|
15473
|
-
(
|
|
15473
|
+
(pe = ge || (ge = {})).J_ = "default",
|
|
15474
15474
|
/** Listen to changes in cache only */
|
|
15475
|
-
|
|
15475
|
+
pe.Cache = "cache";
|
|
15476
15476
|
|
|
15477
15477
|
/**
|
|
15478
15478
|
* QueryListener takes a series of internal view snapshots and determines
|
|
@@ -15547,7 +15547,7 @@ class __PRIVATE_QueryListener {
|
|
|
15547
15547
|
this.Z_ = !0, this.Y_.next(e);
|
|
15548
15548
|
}
|
|
15549
15549
|
G_() {
|
|
15550
|
-
return this.options.source !==
|
|
15550
|
+
return this.options.source !== ge.Cache;
|
|
15551
15551
|
}
|
|
15552
15552
|
}
|
|
15553
15553
|
|
|
@@ -16509,7 +16509,7 @@ async function __PRIVATE_syncEngineHandleCredentialChange(e, t) {
|
|
|
16509
16509
|
function __PRIVATE_rejectOutstandingPendingWritesCallbacks(e, t) {
|
|
16510
16510
|
e.Oa.forEach((e => {
|
|
16511
16511
|
e.forEach((e => {
|
|
16512
|
-
e.reject(new FirestoreError(
|
|
16512
|
+
e.reject(new FirestoreError(C.CANCELLED, t));
|
|
16513
16513
|
}));
|
|
16514
16514
|
})), e.Oa.clear();
|
|
16515
16515
|
}(n, "'waitForPendingWrites' promise is rejected due to a user change."),
|
|
@@ -16938,7 +16938,7 @@ class __PRIVATE_LruGcMemoryOfflineComponentProvider extends MemoryOfflineCompone
|
|
|
16938
16938
|
}
|
|
16939
16939
|
createSharedClientState(e) {
|
|
16940
16940
|
const t = __PRIVATE_getWindow();
|
|
16941
|
-
if (!__PRIVATE_WebStorageSharedClientState.D(t)) throw new FirestoreError(
|
|
16941
|
+
if (!__PRIVATE_WebStorageSharedClientState.D(t)) throw new FirestoreError(C.UNIMPLEMENTED, "IndexedDB persistence is only available on platforms that support LocalStorage.");
|
|
16942
16942
|
const n = __PRIVATE_indexedDbStoragePrefix(e.databaseInfo.databaseId, e.databaseInfo.persistenceKey);
|
|
16943
16943
|
return new __PRIVATE_WebStorageSharedClientState(t, e.asyncQueue, n, e.clientId, e.initialUser);
|
|
16944
16944
|
}
|
|
@@ -17276,7 +17276,7 @@ class Transaction$2 {
|
|
|
17276
17276
|
this.writtenDocs = new Set;
|
|
17277
17277
|
}
|
|
17278
17278
|
async lookup(e) {
|
|
17279
|
-
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw this.lastTransactionError = new FirestoreError(
|
|
17279
|
+
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw this.lastTransactionError = new FirestoreError(C.INVALID_ARGUMENT, "Firestore transactions require all reads to be executed before all writes."),
|
|
17280
17280
|
this.lastTransactionError;
|
|
17281
17281
|
const t = await async function __PRIVATE_invokeBatchGetDocumentsRpc(e, t) {
|
|
17282
17282
|
const n = __PRIVATE_debugCast(e), r = {
|
|
@@ -17338,7 +17338,7 @@ class Transaction$2 {
|
|
|
17338
17338
|
if (n) {
|
|
17339
17339
|
if (!t.isEqual(n))
|
|
17340
17340
|
// This transaction will fail no matter what.
|
|
17341
|
-
throw new FirestoreError(
|
|
17341
|
+
throw new FirestoreError(C.ABORTED, "Document version changed between two reads.");
|
|
17342
17342
|
} else this.readVersions.set(e.key.toString(), t);
|
|
17343
17343
|
}
|
|
17344
17344
|
/**
|
|
@@ -17365,7 +17365,7 @@ class Transaction$2 {
|
|
|
17365
17365
|
// express that to the backend, we have to validate locally.
|
|
17366
17366
|
// Note: this can change once we can send separate verify writes in the
|
|
17367
17367
|
// transaction.
|
|
17368
|
-
throw new FirestoreError(
|
|
17368
|
+
throw new FirestoreError(C.INVALID_ARGUMENT, "Can't update a document that doesn't exist.");
|
|
17369
17369
|
// Document exists, base precondition on document update time.
|
|
17370
17370
|
return Precondition.updateTime(t);
|
|
17371
17371
|
}
|
|
@@ -17506,7 +17506,7 @@ class FirestoreClient {
|
|
|
17506
17506
|
* Checks that the client has not been terminated. Ensures that other methods on //
|
|
17507
17507
|
* this class cannot be called after the client is terminated. //
|
|
17508
17508
|
*/ verifyNotTerminated() {
|
|
17509
|
-
if (this.asyncQueue.isShuttingDown) throw new FirestoreError(
|
|
17509
|
+
if (this.asyncQueue.isShuttingDown) throw new FirestoreError(C.FAILED_PRECONDITION, "The client has already been terminated.");
|
|
17510
17510
|
}
|
|
17511
17511
|
terminate() {
|
|
17512
17512
|
this.asyncQueue.enterRestrictedMode();
|
|
@@ -17554,7 +17554,7 @@ async function __PRIVATE_setOnlineComponentProvider(e, t) {
|
|
|
17554
17554
|
* Decides whether the provided error allows us to gracefully disable
|
|
17555
17555
|
* persistence (as opposed to crashing the client).
|
|
17556
17556
|
*/ function __PRIVATE_canFallbackFromIndexedDbError(e) {
|
|
17557
|
-
return "FirebaseError" === e.name ? e.code ===
|
|
17557
|
+
return "FirebaseError" === e.name ? e.code === C.FAILED_PRECONDITION || e.code === C.UNIMPLEMENTED : !("undefined" != typeof DOMException && e instanceof DOMException) || (
|
|
17558
17558
|
// When the browser is out of quota we could get either quota exceeded
|
|
17559
17559
|
// or an aborted error depending on whether the error happened during
|
|
17560
17560
|
// schema migration.
|
|
@@ -17648,7 +17648,7 @@ async function __PRIVATE_getEventManager(e) {
|
|
|
17648
17648
|
const n = __PRIVATE_debugCast(e);
|
|
17649
17649
|
return n.persistence.runTransaction("read document", "readonly", (e => n.localDocuments.getDocument(e, t)));
|
|
17650
17650
|
}(e, t);
|
|
17651
|
-
r.isFoundDocument() ? n.resolve(r) : r.isNoDocument() ? n.resolve(null) : n.reject(new FirestoreError(
|
|
17651
|
+
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.)"));
|
|
17652
17652
|
} catch (e) {
|
|
17653
17653
|
const r = __PRIVATE_wrapInUserErrorIfRecoverable(e, `Failed to get document '${t} from cache`);
|
|
17654
17654
|
n.reject(r);
|
|
@@ -17677,7 +17677,7 @@ function __PRIVATE_firestoreClientGetDocumentViaSnapshotListener(e, t, n = {}) {
|
|
|
17677
17677
|
// the server so we can deliver that even when you're
|
|
17678
17678
|
// offline 2) Actually reject the Promise in the online case
|
|
17679
17679
|
// if the document doesn't exist.
|
|
17680
|
-
i.reject(new FirestoreError(
|
|
17680
|
+
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);
|
|
17681
17681
|
},
|
|
17682
17682
|
error: e => i.reject(e)
|
|
17683
17683
|
}), o = new __PRIVATE_QueryListener(__PRIVATE_newQueryForPath(n.path), s, {
|
|
@@ -17714,7 +17714,7 @@ function __PRIVATE_firestoreClientGetDocumentsViaSnapshotListener(e, t, n = {})
|
|
|
17714
17714
|
next: n => {
|
|
17715
17715
|
// Remove query first before passing event to user to avoid
|
|
17716
17716
|
// user actions affecting the now stale query.
|
|
17717
|
-
t.enqueueAndForget((() => __PRIVATE_eventManagerUnlisten(e, o))), n.fromCache && "server" === r.source ? i.reject(new FirestoreError(
|
|
17717
|
+
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);
|
|
17718
17718
|
},
|
|
17719
17719
|
error: e => i.reject(e)
|
|
17720
17720
|
}), o = new __PRIVATE_QueryListener(n, s, {
|
|
@@ -17943,7 +17943,7 @@ function __PRIVATE_cloneLongPollingOptions(e) {
|
|
|
17943
17943
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17944
17944
|
* See the License for the specific language governing permissions and
|
|
17945
17945
|
* limitations under the License.
|
|
17946
|
-
*/ const
|
|
17946
|
+
*/ const ye = new Map;
|
|
17947
17947
|
|
|
17948
17948
|
/**
|
|
17949
17949
|
* An instance map that ensures only one Datastore exists per Firestore
|
|
@@ -17966,28 +17966,28 @@ function __PRIVATE_cloneLongPollingOptions(e) {
|
|
|
17966
17966
|
* limitations under the License.
|
|
17967
17967
|
*/
|
|
17968
17968
|
function __PRIVATE_validateNonEmptyArgument(e, t, n) {
|
|
17969
|
-
if (!n) throw new FirestoreError(
|
|
17969
|
+
if (!n) throw new FirestoreError(C.INVALID_ARGUMENT, `Function ${e}() cannot be called with an empty ${t}.`);
|
|
17970
17970
|
}
|
|
17971
17971
|
|
|
17972
17972
|
/**
|
|
17973
17973
|
* Validates that two boolean options are not set at the same time.
|
|
17974
17974
|
* @internal
|
|
17975
17975
|
*/ function __PRIVATE_validateIsNotUsedTogether(e, t, n, r) {
|
|
17976
|
-
if (!0 === t && !0 === r) throw new FirestoreError(
|
|
17976
|
+
if (!0 === t && !0 === r) throw new FirestoreError(C.INVALID_ARGUMENT, `${e} and ${n} cannot be used together.`);
|
|
17977
17977
|
}
|
|
17978
17978
|
|
|
17979
17979
|
/**
|
|
17980
17980
|
* Validates that `path` refers to a document (indicated by the fact it contains
|
|
17981
17981
|
* an even numbers of segments).
|
|
17982
17982
|
*/ function __PRIVATE_validateDocumentPath(e) {
|
|
17983
|
-
if (!DocumentKey.isDocumentKey(e)) throw new FirestoreError(
|
|
17983
|
+
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}.`);
|
|
17984
17984
|
}
|
|
17985
17985
|
|
|
17986
17986
|
/**
|
|
17987
17987
|
* Validates that `path` refers to a collection (indicated by the fact it
|
|
17988
17988
|
* contains an odd numbers of segments).
|
|
17989
17989
|
*/ function __PRIVATE_validateCollectionPath(e) {
|
|
17990
|
-
if (DocumentKey.isDocumentKey(e)) throw new FirestoreError(
|
|
17990
|
+
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}.`);
|
|
17991
17991
|
}
|
|
17992
17992
|
|
|
17993
17993
|
/**
|
|
@@ -18031,17 +18031,17 @@ t) {
|
|
|
18031
18031
|
// Unwrap Compat types
|
|
18032
18032
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18033
18033
|
e = e._delegate), !(e instanceof t)) {
|
|
18034
|
-
if (t.name === e.constructor.name) throw new FirestoreError(
|
|
18034
|
+
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?");
|
|
18035
18035
|
{
|
|
18036
18036
|
const n = __PRIVATE_valueDescription(e);
|
|
18037
|
-
throw new FirestoreError(
|
|
18037
|
+
throw new FirestoreError(C.INVALID_ARGUMENT, `Expected type '${t.name}', but it was: ${n}`);
|
|
18038
18038
|
}
|
|
18039
18039
|
}
|
|
18040
18040
|
return e;
|
|
18041
18041
|
}
|
|
18042
18042
|
|
|
18043
18043
|
function __PRIVATE_validatePositiveNumber(e, t) {
|
|
18044
|
-
if (t <= 0) throw new FirestoreError(
|
|
18044
|
+
if (t <= 0) throw new FirestoreError(C.INVALID_ARGUMENT, `Function ${e}() requires a positive number, but it was: ${t}.`);
|
|
18045
18045
|
}
|
|
18046
18046
|
|
|
18047
18047
|
/**
|
|
@@ -18070,12 +18070,12 @@ class FirestoreSettingsImpl {
|
|
|
18070
18070
|
constructor(e) {
|
|
18071
18071
|
var t, n;
|
|
18072
18072
|
if (void 0 === e.host) {
|
|
18073
|
-
if (void 0 !== e.ssl) throw new FirestoreError(
|
|
18073
|
+
if (void 0 !== e.ssl) throw new FirestoreError(C.INVALID_ARGUMENT, "Can't provide ssl option if host option is not set");
|
|
18074
18074
|
this.host = "firestore.googleapis.com", this.ssl = true;
|
|
18075
18075
|
} else this.host = e.host, this.ssl = null === (t = e.ssl) || void 0 === t || t;
|
|
18076
18076
|
if (this.credentials = e.credentials, this.ignoreUndefinedProperties = !!e.ignoreUndefinedProperties,
|
|
18077
18077
|
this.localCache = e.localCache, void 0 === e.cacheSizeBytes) this.cacheSizeBytes = 41943040; else {
|
|
18078
|
-
if (-1 !== e.cacheSizeBytes && e.cacheSizeBytes < 1048576) throw new FirestoreError(
|
|
18078
|
+
if (-1 !== e.cacheSizeBytes && e.cacheSizeBytes < 1048576) throw new FirestoreError(C.INVALID_ARGUMENT, "cacheSizeBytes must be at least 1048576");
|
|
18079
18079
|
this.cacheSizeBytes = e.cacheSizeBytes;
|
|
18080
18080
|
}
|
|
18081
18081
|
__PRIVATE_validateIsNotUsedTogether("experimentalForceLongPolling", e.experimentalForceLongPolling, "experimentalAutoDetectLongPolling", e.experimentalAutoDetectLongPolling),
|
|
@@ -18087,9 +18087,9 @@ class FirestoreSettingsImpl {
|
|
|
18087
18087
|
this.experimentalLongPollingOptions = __PRIVATE_cloneLongPollingOptions(null !== (n = e.experimentalLongPollingOptions) && void 0 !== n ? n : {}),
|
|
18088
18088
|
function __PRIVATE_validateLongPollingOptions(e) {
|
|
18089
18089
|
if (void 0 !== e.timeoutSeconds) {
|
|
18090
|
-
if (isNaN(e.timeoutSeconds)) throw new FirestoreError(
|
|
18091
|
-
if (e.timeoutSeconds < 5) throw new FirestoreError(
|
|
18092
|
-
if (e.timeoutSeconds > 30) throw new FirestoreError(
|
|
18090
|
+
if (isNaN(e.timeoutSeconds)) throw new FirestoreError(C.INVALID_ARGUMENT, `invalid long polling timeout: ${e.timeoutSeconds} (must not be NaN)`);
|
|
18091
|
+
if (e.timeoutSeconds < 5) throw new FirestoreError(C.INVALID_ARGUMENT, `invalid long polling timeout: ${e.timeoutSeconds} (minimum allowed value is 5)`);
|
|
18092
|
+
if (e.timeoutSeconds > 30) throw new FirestoreError(C.INVALID_ARGUMENT, `invalid long polling timeout: ${e.timeoutSeconds} (maximum allowed value is 30)`);
|
|
18093
18093
|
}
|
|
18094
18094
|
}
|
|
18095
18095
|
/**
|
|
@@ -18136,7 +18136,7 @@ class Firestore$1 {
|
|
|
18136
18136
|
* The {@link @firebase/app#FirebaseApp} associated with this `Firestore` service
|
|
18137
18137
|
* instance.
|
|
18138
18138
|
*/ get app() {
|
|
18139
|
-
if (!this._app) throw new FirestoreError(
|
|
18139
|
+
if (!this._app) throw new FirestoreError(C.FAILED_PRECONDITION, "Firestore was not initialized using the Firebase SDK. 'app' is not available");
|
|
18140
18140
|
return this._app;
|
|
18141
18141
|
}
|
|
18142
18142
|
get _initialized() {
|
|
@@ -18146,7 +18146,7 @@ class Firestore$1 {
|
|
|
18146
18146
|
return void 0 !== this._terminateTask;
|
|
18147
18147
|
}
|
|
18148
18148
|
_setSettings(e) {
|
|
18149
|
-
if (this._settingsFrozen) throw new FirestoreError(
|
|
18149
|
+
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.");
|
|
18150
18150
|
this._settings = new FirestoreSettingsImpl(e), void 0 !== e.credentials && (this._authCredentials = function __PRIVATE_makeAuthCredentialsProvider(e) {
|
|
18151
18151
|
if (!e) return new __PRIVATE_EmptyAuthCredentialsProvider;
|
|
18152
18152
|
switch (e.type) {
|
|
@@ -18157,7 +18157,7 @@ class Firestore$1 {
|
|
|
18157
18157
|
return e.client;
|
|
18158
18158
|
|
|
18159
18159
|
default:
|
|
18160
|
-
throw new FirestoreError(
|
|
18160
|
+
throw new FirestoreError(C.INVALID_ARGUMENT, "makeAuthCredentialsProvider failed due to invalid credential type");
|
|
18161
18161
|
}
|
|
18162
18162
|
}(e.credentials));
|
|
18163
18163
|
}
|
|
@@ -18189,8 +18189,8 @@ class Firestore$1 {
|
|
|
18189
18189
|
* when the `Firestore` instance is terminated.
|
|
18190
18190
|
*/
|
|
18191
18191
|
return function __PRIVATE_removeComponents(e) {
|
|
18192
|
-
const t =
|
|
18193
|
-
t && (__PRIVATE_logDebug("ComponentProvider", "Removing Datastore"),
|
|
18192
|
+
const t = ye.get(e);
|
|
18193
|
+
t && (__PRIVATE_logDebug("ComponentProvider", "Removing Datastore"), ye.delete(e),
|
|
18194
18194
|
t.terminate());
|
|
18195
18195
|
}(this), Promise.resolve();
|
|
18196
18196
|
}
|
|
@@ -18222,7 +18222,7 @@ class Firestore$1 {
|
|
|
18222
18222
|
// invalid field "uid" and missing field "sub" / "user_id".)
|
|
18223
18223
|
t = util.createMockUserToken(r.mockUserToken, null === (i = e._app) || void 0 === i ? void 0 : i.options.projectId);
|
|
18224
18224
|
const s = r.mockUserToken.sub || r.mockUserToken.user_id;
|
|
18225
|
-
if (!s) throw new FirestoreError(
|
|
18225
|
+
if (!s) throw new FirestoreError(C.INVALID_ARGUMENT, "mockUserToken must contain 'sub' or 'user_id' field!");
|
|
18226
18226
|
n = new User(s);
|
|
18227
18227
|
}
|
|
18228
18228
|
e._authCredentials = new __PRIVATE_EmulatorAuthCredentialsProvider(new __PRIVATE_OAuthToken(t, n));
|
|
@@ -18342,7 +18342,7 @@ function collection(e, t, ...n) {
|
|
|
18342
18342
|
return __PRIVATE_validateCollectionPath(r), new CollectionReference(e, /* converter= */ null, r);
|
|
18343
18343
|
}
|
|
18344
18344
|
{
|
|
18345
|
-
if (!(e instanceof DocumentReference || e instanceof CollectionReference)) throw new FirestoreError(
|
|
18345
|
+
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");
|
|
18346
18346
|
const r = e._path.child(ResourcePath.fromString(t, ...n));
|
|
18347
18347
|
return __PRIVATE_validateCollectionPath(r), new CollectionReference(e.firestore,
|
|
18348
18348
|
/* converter= */ null, r);
|
|
@@ -18363,7 +18363,7 @@ function collection(e, t, ...n) {
|
|
|
18363
18363
|
* @returns The created `Query`.
|
|
18364
18364
|
*/ function collectionGroup(e, t) {
|
|
18365
18365
|
if (e = __PRIVATE_cast(e, Firestore$1), __PRIVATE_validateNonEmptyArgument("collectionGroup", "collection id", t),
|
|
18366
|
-
t.indexOf("/") >= 0) throw new FirestoreError(
|
|
18366
|
+
t.indexOf("/") >= 0) throw new FirestoreError(C.INVALID_ARGUMENT, `Invalid collection ID '${t}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
|
|
18367
18367
|
return new Query(e,
|
|
18368
18368
|
/* converter= */ null, function __PRIVATE_newQueryForCollectionGroup(e) {
|
|
18369
18369
|
return new __PRIVATE_QueryImpl(ResourcePath.emptyPath(), e);
|
|
@@ -18381,7 +18381,7 @@ function doc(e, t, ...n) {
|
|
|
18381
18381
|
/* converter= */ null, new DocumentKey(r));
|
|
18382
18382
|
}
|
|
18383
18383
|
{
|
|
18384
|
-
if (!(e instanceof DocumentReference || e instanceof CollectionReference)) throw new FirestoreError(
|
|
18384
|
+
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");
|
|
18385
18385
|
const r = e._path.child(ResourcePath.fromString(t, ...n));
|
|
18386
18386
|
return __PRIVATE_validateDocumentPath(r), new DocumentReference(e.firestore, e instanceof CollectionReference ? e.converter : null, new DocumentKey(r));
|
|
18387
18387
|
}
|
|
@@ -18741,7 +18741,7 @@ class LoadBundleTask {
|
|
|
18741
18741
|
* Constant used to indicate the LRU garbage collection should be disabled.
|
|
18742
18742
|
* Set this value as the `cacheSizeBytes` on the settings passed to the
|
|
18743
18743
|
* {@link Firestore} instance.
|
|
18744
|
-
*/ const
|
|
18744
|
+
*/ const we = -1;
|
|
18745
18745
|
|
|
18746
18746
|
/**
|
|
18747
18747
|
* The Cloud Firestore service interface.
|
|
@@ -18785,10 +18785,10 @@ class LoadBundleTask {
|
|
|
18785
18785
|
identifier: n
|
|
18786
18786
|
}), i = r.getOptions(n);
|
|
18787
18787
|
if (util.deepEqual(i, t)) return e;
|
|
18788
|
-
throw new FirestoreError(
|
|
18788
|
+
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.");
|
|
18789
18789
|
}
|
|
18790
|
-
if (void 0 !== t.cacheSizeBytes && void 0 !== t.localCache) throw new FirestoreError(
|
|
18791
|
-
if (void 0 !== t.cacheSizeBytes && -1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new FirestoreError(
|
|
18790
|
+
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");
|
|
18791
|
+
if (void 0 !== t.cacheSizeBytes && -1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new FirestoreError(C.INVALID_ARGUMENT, "cacheSizeBytes must be at least 1048576");
|
|
18792
18792
|
return r.initialize({
|
|
18793
18793
|
options: t,
|
|
18794
18794
|
instanceIdentifier: n
|
|
@@ -18857,7 +18857,7 @@ function __PRIVATE_configureFirestore(e) {
|
|
|
18857
18857
|
*/ function enableIndexedDbPersistence(e, t) {
|
|
18858
18858
|
__PRIVATE_verifyNotInitialized(e = __PRIVATE_cast(e, Firestore));
|
|
18859
18859
|
const n = ensureFirestoreConfigured(e);
|
|
18860
|
-
if (n._uninitializedComponentsProvider) throw new FirestoreError(
|
|
18860
|
+
if (n._uninitializedComponentsProvider) throw new FirestoreError(C.FAILED_PRECONDITION, "SDK cache is already specified.");
|
|
18861
18861
|
__PRIVATE_logWarn("enableIndexedDbPersistence() will be deprecated in the future, you can use `FirestoreSettings.cache` instead.");
|
|
18862
18862
|
const r = e._freezeSettings(), i = new OnlineComponentProvider;
|
|
18863
18863
|
return __PRIVATE_setPersistenceProviders(n, i, new __PRIVATE_IndexedDbOfflineComponentProvider(i, r.cacheSizeBytes, null == t ? void 0 : t.forceOwnership));
|
|
@@ -18891,7 +18891,7 @@ function __PRIVATE_configureFirestore(e) {
|
|
|
18891
18891
|
*/ function enableMultiTabIndexedDbPersistence(e) {
|
|
18892
18892
|
__PRIVATE_verifyNotInitialized(e = __PRIVATE_cast(e, Firestore));
|
|
18893
18893
|
const t = ensureFirestoreConfigured(e);
|
|
18894
|
-
if (t._uninitializedComponentsProvider) throw new FirestoreError(
|
|
18894
|
+
if (t._uninitializedComponentsProvider) throw new FirestoreError(C.FAILED_PRECONDITION, "SDK cache is already specified.");
|
|
18895
18895
|
__PRIVATE_logWarn("enableMultiTabIndexedDbPersistence() will be deprecated in the future, you can use `FirestoreSettings.cache` instead.");
|
|
18896
18896
|
const n = e._freezeSettings(), r = new OnlineComponentProvider;
|
|
18897
18897
|
return __PRIVATE_setPersistenceProviders(t, r, new __PRIVATE_MultiTabOfflineComponentProvider(r, n.cacheSizeBytes));
|
|
@@ -18939,7 +18939,7 @@ function __PRIVATE_configureFirestore(e) {
|
|
|
18939
18939
|
* @returns A `Promise` that is resolved when the persistent storage is
|
|
18940
18940
|
* cleared. Otherwise, the promise is rejected with an error.
|
|
18941
18941
|
*/ function clearIndexedDbPersistence(e) {
|
|
18942
|
-
if (e._initialized && !e._terminated) throw new FirestoreError(
|
|
18942
|
+
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.");
|
|
18943
18943
|
const t = new __PRIVATE_Deferred;
|
|
18944
18944
|
return e._queue.enqueueAndForgetEvenWhileRestricted((async () => {
|
|
18945
18945
|
try {
|
|
@@ -19053,7 +19053,7 @@ function __PRIVATE_configureFirestore(e) {
|
|
|
19053
19053
|
}
|
|
19054
19054
|
|
|
19055
19055
|
function __PRIVATE_verifyNotInitialized(e) {
|
|
19056
|
-
if (e._initialized || e._terminated) throw new FirestoreError(
|
|
19056
|
+
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.");
|
|
19057
19057
|
}
|
|
19058
19058
|
|
|
19059
19059
|
/**
|
|
@@ -19162,7 +19162,7 @@ class AggregateField {
|
|
|
19162
19162
|
try {
|
|
19163
19163
|
return new Bytes(ByteString.fromBase64String(e));
|
|
19164
19164
|
} catch (e) {
|
|
19165
|
-
throw new FirestoreError(
|
|
19165
|
+
throw new FirestoreError(C.INVALID_ARGUMENT, "Failed to construct data from Base64 string: " + e);
|
|
19166
19166
|
}
|
|
19167
19167
|
}
|
|
19168
19168
|
/**
|
|
@@ -19234,7 +19234,7 @@ class AggregateField {
|
|
|
19234
19234
|
* @param fieldNames - A list of field names.
|
|
19235
19235
|
*/
|
|
19236
19236
|
constructor(...e) {
|
|
19237
|
-
for (let t = 0; t < e.length; ++t) if (0 === e[t].length) throw new FirestoreError(
|
|
19237
|
+
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.");
|
|
19238
19238
|
this._internalPath = new FieldPath$1(e);
|
|
19239
19239
|
}
|
|
19240
19240
|
/**
|
|
@@ -19313,8 +19313,8 @@ class AggregateField {
|
|
|
19313
19313
|
* @param longitude - The longitude as number between -180 and 180.
|
|
19314
19314
|
*/
|
|
19315
19315
|
constructor(e, t) {
|
|
19316
|
-
if (!isFinite(e) || e < -90 || e > 90) throw new FirestoreError(
|
|
19317
|
-
if (!isFinite(t) || t < -180 || t > 180) throw new FirestoreError(
|
|
19316
|
+
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);
|
|
19317
|
+
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);
|
|
19318
19318
|
this._lat = e, this._long = t;
|
|
19319
19319
|
}
|
|
19320
19320
|
/**
|
|
@@ -19364,7 +19364,7 @@ class AggregateField {
|
|
|
19364
19364
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19365
19365
|
* See the License for the specific language governing permissions and
|
|
19366
19366
|
* limitations under the License.
|
|
19367
|
-
*/ const
|
|
19367
|
+
*/ const Se = /^__.*__$/;
|
|
19368
19368
|
|
|
19369
19369
|
/** The result of parsing document data (e.g. for a setData call). */ class ParsedSetData {
|
|
19370
19370
|
constructor(e, t, n) {
|
|
@@ -19475,7 +19475,7 @@ function __PRIVATE_isWrite(e) {
|
|
|
19475
19475
|
}
|
|
19476
19476
|
wu(e) {
|
|
19477
19477
|
if (0 === e.length) throw this.Du("Document fields must not be empty");
|
|
19478
|
-
if (__PRIVATE_isWrite(this.fu) &&
|
|
19478
|
+
if (__PRIVATE_isWrite(this.fu) && Se.test(e)) throw this.Du('Document fields cannot begin and end with "__"');
|
|
19479
19479
|
}
|
|
19480
19480
|
}
|
|
19481
19481
|
|
|
@@ -19512,7 +19512,7 @@ function __PRIVATE_newUserDataReader(e) {
|
|
|
19512
19512
|
const e = [];
|
|
19513
19513
|
for (const r of s.mergeFields) {
|
|
19514
19514
|
const i = __PRIVATE_fieldPathFromArgument$1(t, r, n);
|
|
19515
|
-
if (!o.contains(i)) throw new FirestoreError(
|
|
19515
|
+
if (!o.contains(i)) throw new FirestoreError(C.INVALID_ARGUMENT, `Field '${i}' is specified in your field mask but missing from your input data.`);
|
|
19516
19516
|
__PRIVATE_fieldMaskContains(e, i) || e.push(i);
|
|
19517
19517
|
}
|
|
19518
19518
|
a = new FieldMask(e), u = o.fieldTransforms.filter((e => a.covers(e.field)));
|
|
@@ -19629,7 +19629,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
|
|
|
19629
19629
|
|
|
19630
19630
|
/** Parse update data from a list of field/value arguments. */ function __PRIVATE_parseUpdateVarargs(e, t, n, r, i, s) {
|
|
19631
19631
|
const o = e.Fu(1 /* UserDataSource.Update */ , t, n), _ = [ __PRIVATE_fieldPathFromArgument$1(t, r, n) ], a = [ i ];
|
|
19632
|
-
if (s.length % 2 != 0) throw new FirestoreError(
|
|
19632
|
+
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.`);
|
|
19633
19633
|
for (let e = 0; e < s.length; e += 2) _.push(__PRIVATE_fieldPathFromArgument$1(t, s[e])),
|
|
19634
19634
|
a.push(s[e + 1]);
|
|
19635
19635
|
const u = [], c = ObjectValue.empty();
|
|
@@ -19830,7 +19830,7 @@ function __PRIVATE_validatePlainObject(e, t, n) {
|
|
|
19830
19830
|
|
|
19831
19831
|
/**
|
|
19832
19832
|
* Matches any characters in a field path string that are reserved.
|
|
19833
|
-
*/ const
|
|
19833
|
+
*/ const be = new RegExp("[~\\*/\\[\\]]");
|
|
19834
19834
|
|
|
19835
19835
|
/**
|
|
19836
19836
|
* Wraps fromDotSeparatedString with an error message about the method that
|
|
@@ -19841,7 +19841,7 @@ function __PRIVATE_validatePlainObject(e, t, n) {
|
|
|
19841
19841
|
* @param targetDoc - The document against which the field path will be
|
|
19842
19842
|
* evaluated.
|
|
19843
19843
|
*/ function __PRIVATE_fieldPathFromDotSeparatedString(e, t, n) {
|
|
19844
|
-
if (t.search(
|
|
19844
|
+
if (t.search(be) >= 0) throw __PRIVATE_createError(`Invalid field path (${t}). Paths must not contain '~', '*', '/', '[', or ']'`, e,
|
|
19845
19845
|
/* hasConverter= */ !1,
|
|
19846
19846
|
/* path= */ void 0, n);
|
|
19847
19847
|
try {
|
|
@@ -19859,7 +19859,7 @@ function __PRIVATE_createError(e, t, n, r, i) {
|
|
|
19859
19859
|
n && (_ += " (via `toFirestore()`)"), _ += ". ";
|
|
19860
19860
|
let a = "";
|
|
19861
19861
|
return (s || o) && (a += " (found", s && (a += ` in field ${r}`), o && (a += ` in document ${i}`),
|
|
19862
|
-
a += ")"), new FirestoreError(
|
|
19862
|
+
a += ")"), new FirestoreError(C.INVALID_ARGUMENT, _ + e + a);
|
|
19863
19863
|
}
|
|
19864
19864
|
|
|
19865
19865
|
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function __PRIVATE_fieldMaskContains(e, t) {
|
|
@@ -19996,7 +19996,7 @@ function __PRIVATE_createError(e, t, n, r, i) {
|
|
|
19996
19996
|
* See the License for the specific language governing permissions and
|
|
19997
19997
|
* limitations under the License.
|
|
19998
19998
|
*/ function __PRIVATE_validateHasExplicitOrderByForLimitToLast(e) {
|
|
19999
|
-
if ("L" /* LimitType.Last */ === e.limitType && 0 === e.explicitOrderBy.length) throw new FirestoreError(
|
|
19999
|
+
if ("L" /* LimitType.Last */ === e.limitType && 0 === e.explicitOrderBy.length) throw new FirestoreError(C.UNIMPLEMENTED, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
20000
20000
|
}
|
|
20001
20001
|
|
|
20002
20002
|
/**
|
|
@@ -20017,7 +20017,7 @@ function query(e, t, ...n) {
|
|
|
20017
20017
|
let r = [];
|
|
20018
20018
|
t instanceof AppliableConstraint && r.push(t), r = r.concat(n), function __PRIVATE_validateQueryConstraintArray(e) {
|
|
20019
20019
|
const t = e.filter((e => e instanceof QueryCompositeFilterConstraint)).length, n = e.filter((e => e instanceof QueryFieldFilterConstraint)).length;
|
|
20020
|
-
if (t > 1 || t > 0 && n > 0) throw new FirestoreError(
|
|
20020
|
+
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(...)))`.");
|
|
20021
20021
|
}
|
|
20022
20022
|
/**
|
|
20023
20023
|
* @license
|
|
@@ -20071,7 +20071,7 @@ function query(e, t, ...n) {
|
|
|
20071
20071
|
const t = __PRIVATE_newUserDataReader(e.firestore), n = function __PRIVATE_newQueryFilter(e, t, n, r, i, s, o) {
|
|
20072
20072
|
let _;
|
|
20073
20073
|
if (i.isKeyField()) {
|
|
20074
|
-
if ("array-contains" /* Operator.ARRAY_CONTAINS */ === s || "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ === s) throw new FirestoreError(
|
|
20074
|
+
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().`);
|
|
20075
20075
|
if ("in" /* Operator.IN */ === s || "not-in" /* Operator.NOT_IN */ === s) {
|
|
20076
20076
|
__PRIVATE_validateDisjunctiveFilterElements(o, s);
|
|
20077
20077
|
const t = [];
|
|
@@ -20198,8 +20198,8 @@ function query(e, t, ...n) {
|
|
|
20198
20198
|
}
|
|
20199
20199
|
_apply(e) {
|
|
20200
20200
|
const t = function __PRIVATE_newQueryOrderBy(e, t, n) {
|
|
20201
|
-
if (null !== e.startAt) throw new FirestoreError(
|
|
20202
|
-
if (null !== e.endAt) throw new FirestoreError(
|
|
20201
|
+
if (null !== e.startAt) throw new FirestoreError(C.INVALID_ARGUMENT, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
|
|
20202
|
+
if (null !== e.endAt) throw new FirestoreError(C.INVALID_ARGUMENT, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
|
|
20203
20203
|
return new OrderBy(t, n);
|
|
20204
20204
|
}
|
|
20205
20205
|
/**
|
|
@@ -20357,7 +20357,7 @@ function endAt(...e) {
|
|
|
20357
20357
|
|
|
20358
20358
|
/** Helper function to create a bound from a document or fields */ function __PRIVATE_newQueryBoundFromDocOrFields(e, t, n, r) {
|
|
20359
20359
|
if (n[0] = util.getModularInstance(n[0]), n[0] instanceof DocumentSnapshot$1) return function __PRIVATE_newQueryBoundFromDocument(e, t, n, r, i) {
|
|
20360
|
-
if (!r) throw new FirestoreError(
|
|
20360
|
+
if (!r) throw new FirestoreError(C.NOT_FOUND, `Can't use a DocumentSnapshot that doesn't exist for ${n}().`);
|
|
20361
20361
|
const s = [];
|
|
20362
20362
|
// Because people expect to continue/end a query at the exact document
|
|
20363
20363
|
// provided, we need to use the implicit sort order rather than the explicit
|
|
@@ -20368,10 +20368,10 @@ function endAt(...e) {
|
|
|
20368
20368
|
// results.
|
|
20369
20369
|
for (const n of __PRIVATE_queryNormalizedOrderBy(e)) if (n.field.isKeyField()) s.push(__PRIVATE_refValue(t, r.key)); else {
|
|
20370
20370
|
const e = r.data.field(n.field);
|
|
20371
|
-
if (__PRIVATE_isServerTimestamp(e)) throw new FirestoreError(
|
|
20371
|
+
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.)');
|
|
20372
20372
|
if (null === e) {
|
|
20373
20373
|
const e = n.field.canonicalString();
|
|
20374
|
-
throw new FirestoreError(
|
|
20374
|
+
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.`);
|
|
20375
20375
|
}
|
|
20376
20376
|
s.push(e);
|
|
20377
20377
|
}
|
|
@@ -20385,15 +20385,15 @@ function endAt(...e) {
|
|
|
20385
20385
|
return function __PRIVATE_newQueryBoundFromFields(e, t, n, r, i, s) {
|
|
20386
20386
|
// Use explicit order by's because it has to match the query the user made
|
|
20387
20387
|
const o = e.explicitOrderBy;
|
|
20388
|
-
if (i.length > o.length) throw new FirestoreError(
|
|
20388
|
+
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`);
|
|
20389
20389
|
const _ = [];
|
|
20390
20390
|
for (let s = 0; s < i.length; s++) {
|
|
20391
20391
|
const a = i[s];
|
|
20392
20392
|
if (o[s].field.isKeyField()) {
|
|
20393
|
-
if ("string" != typeof a) throw new FirestoreError(
|
|
20394
|
-
if (!__PRIVATE_isCollectionGroupQuery(e) && -1 !== a.indexOf("/")) throw new FirestoreError(
|
|
20393
|
+
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}`);
|
|
20394
|
+
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.`);
|
|
20395
20395
|
const n = e.path.child(ResourcePath.fromString(a));
|
|
20396
|
-
if (!DocumentKey.isDocumentKey(n)) throw new FirestoreError(
|
|
20396
|
+
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.`);
|
|
20397
20397
|
const i = new DocumentKey(n);
|
|
20398
20398
|
_.push(__PRIVATE_refValue(t, i));
|
|
20399
20399
|
} else {
|
|
@@ -20413,21 +20413,21 @@ function endAt(...e) {
|
|
|
20413
20413
|
|
|
20414
20414
|
function __PRIVATE_parseDocumentIdValue(e, t, n) {
|
|
20415
20415
|
if ("string" == typeof (n = util.getModularInstance(n))) {
|
|
20416
|
-
if ("" === n) throw new FirestoreError(
|
|
20417
|
-
if (!__PRIVATE_isCollectionGroupQuery(t) && -1 !== n.indexOf("/")) throw new FirestoreError(
|
|
20416
|
+
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.");
|
|
20417
|
+
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.`);
|
|
20418
20418
|
const r = t.path.child(ResourcePath.fromString(n));
|
|
20419
|
-
if (!DocumentKey.isDocumentKey(r)) throw new FirestoreError(
|
|
20419
|
+
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}).`);
|
|
20420
20420
|
return __PRIVATE_refValue(e, new DocumentKey(r));
|
|
20421
20421
|
}
|
|
20422
20422
|
if (n instanceof DocumentReference) return __PRIVATE_refValue(e, n._key);
|
|
20423
|
-
throw new FirestoreError(
|
|
20423
|
+
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)}.`);
|
|
20424
20424
|
}
|
|
20425
20425
|
|
|
20426
20426
|
/**
|
|
20427
20427
|
* Validates that the value passed into a disjunctive filter satisfies all
|
|
20428
20428
|
* array requirements.
|
|
20429
20429
|
*/ function __PRIVATE_validateDisjunctiveFilterElements(e, t) {
|
|
20430
|
-
if (!Array.isArray(e) || 0 === e.length) throw new FirestoreError(
|
|
20430
|
+
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.`);
|
|
20431
20431
|
}
|
|
20432
20432
|
|
|
20433
20433
|
/**
|
|
@@ -20461,11 +20461,11 @@ function __PRIVATE_parseDocumentIdValue(e, t, n) {
|
|
|
20461
20461
|
}(t.op));
|
|
20462
20462
|
if (null !== n)
|
|
20463
20463
|
// Special case when it's a duplicate op to give a slightly clearer error message.
|
|
20464
|
-
throw n === t.op ? new FirestoreError(
|
|
20464
|
+
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.`);
|
|
20465
20465
|
}
|
|
20466
20466
|
|
|
20467
20467
|
function __PRIVATE_validateQueryFilterConstraint(e, t) {
|
|
20468
|
-
if (!(t instanceof QueryFieldFilterConstraint || t instanceof QueryCompositeFilterConstraint)) throw new FirestoreError(
|
|
20468
|
+
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(...)'.`);
|
|
20469
20469
|
}
|
|
20470
20470
|
|
|
20471
20471
|
class AbstractUserDataWriter {
|
|
@@ -20837,7 +20837,7 @@ class __PRIVATE_LiteUserDataWriter extends AbstractUserDataWriter {
|
|
|
20837
20837
|
* snapshot events.
|
|
20838
20838
|
*/ docChanges(e = {}) {
|
|
20839
20839
|
const t = !!e.includeMetadataChanges;
|
|
20840
|
-
if (t && this._snapshot.excludesMetadataChanges) throw new FirestoreError(
|
|
20840
|
+
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().");
|
|
20841
20841
|
return this._cachedChanges && this._cachedChangesIncludeMetadataChanges === t || (this._cachedChanges =
|
|
20842
20842
|
/** Calculates the array of `DocumentChange`s for a given `ViewSnapshot`. */
|
|
20843
20843
|
function __PRIVATE_changesFromSnapshot(e, t) {
|
|
@@ -21377,7 +21377,7 @@ class __PRIVATE_MultiTabManagerImpl {
|
|
|
21377
21377
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21378
21378
|
* See the License for the specific language governing permissions and
|
|
21379
21379
|
* limitations under the License.
|
|
21380
|
-
*/ const
|
|
21380
|
+
*/ const De = {
|
|
21381
21381
|
maxAttempts: 5
|
|
21382
21382
|
};
|
|
21383
21383
|
|
|
@@ -21451,12 +21451,12 @@ class WriteBatch {
|
|
|
21451
21451
|
return this._verifyNotCommitted(), this._committed = !0, this._mutations.length > 0 ? this._commitHandler(this._mutations) : Promise.resolve();
|
|
21452
21452
|
}
|
|
21453
21453
|
_verifyNotCommitted() {
|
|
21454
|
-
if (this._committed) throw new FirestoreError(
|
|
21454
|
+
if (this._committed) throw new FirestoreError(C.FAILED_PRECONDITION, "A write batch can no longer be used after commit() has been called.");
|
|
21455
21455
|
}
|
|
21456
21456
|
}
|
|
21457
21457
|
|
|
21458
21458
|
function __PRIVATE_validateReference(e, t) {
|
|
21459
|
-
if ((e = util.getModularInstance(e)).firestore !== t) throw new FirestoreError(
|
|
21459
|
+
if ((e = util.getModularInstance(e)).firestore !== t) throw new FirestoreError(C.INVALID_ARGUMENT, "Provided document reference is from a different Firestore instance.");
|
|
21460
21460
|
return e;
|
|
21461
21461
|
}
|
|
21462
21462
|
|
|
@@ -21589,9 +21589,9 @@ class Transaction extends class Transaction$1 {
|
|
|
21589
21589
|
* rejected promise with the corresponding failure error is returned.
|
|
21590
21590
|
*/ function runTransaction(e, t, n) {
|
|
21591
21591
|
e = __PRIVATE_cast(e, Firestore);
|
|
21592
|
-
const r = Object.assign(Object.assign({},
|
|
21592
|
+
const r = Object.assign(Object.assign({}, De), n);
|
|
21593
21593
|
!function __PRIVATE_validateTransactionOptions(e) {
|
|
21594
|
-
if (e.maxAttempts < 1) throw new FirestoreError(
|
|
21594
|
+
if (e.maxAttempts < 1) throw new FirestoreError(C.INVALID_ARGUMENT, "Max attempts must be at least 1");
|
|
21595
21595
|
}(r);
|
|
21596
21596
|
return function __PRIVATE_firestoreClientTransaction(e, t, n) {
|
|
21597
21597
|
const r = new __PRIVATE_Deferred;
|
|
@@ -21745,7 +21745,7 @@ class Transaction extends class Transaction$1 {
|
|
|
21745
21745
|
try {
|
|
21746
21746
|
return JSON.parse(e);
|
|
21747
21747
|
} catch (e) {
|
|
21748
|
-
throw new FirestoreError(
|
|
21748
|
+
throw new FirestoreError(C.INVALID_ARGUMENT, "Failed to parse JSON: " + (null == e ? void 0 : e.message));
|
|
21749
21749
|
}
|
|
21750
21750
|
}(e) : e, n = [];
|
|
21751
21751
|
if (Array.isArray(t.indexes)) for (const e of t.indexes) {
|
|
@@ -21762,7 +21762,7 @@ class Transaction extends class Transaction$1 {
|
|
|
21762
21762
|
}
|
|
21763
21763
|
|
|
21764
21764
|
function __PRIVATE_tryGetString(e, t) {
|
|
21765
|
-
if ("string" != typeof e[t]) throw new FirestoreError(
|
|
21765
|
+
if ("string" != typeof e[t]) throw new FirestoreError(C.INVALID_ARGUMENT, "Missing string value for: " + t);
|
|
21766
21766
|
return e[t];
|
|
21767
21767
|
}
|
|
21768
21768
|
|
|
@@ -21805,12 +21805,12 @@ function __PRIVATE_tryGetString(e, t) {
|
|
|
21805
21805
|
*/ function getPersistentCacheIndexManager(e) {
|
|
21806
21806
|
var t;
|
|
21807
21807
|
e = __PRIVATE_cast(e, Firestore);
|
|
21808
|
-
const n =
|
|
21808
|
+
const n = Ce.get(e);
|
|
21809
21809
|
if (n) return n;
|
|
21810
21810
|
const r = ensureFirestoreConfigured(e);
|
|
21811
21811
|
if ("persistent" !== (null === (t = r._uninitializedComponentsProvider) || void 0 === t ? void 0 : t._offlineKind)) return null;
|
|
21812
21812
|
const i = new PersistentCacheIndexManager(r);
|
|
21813
|
-
return
|
|
21813
|
+
return Ce.set(e, i), i;
|
|
21814
21814
|
}
|
|
21815
21815
|
|
|
21816
21816
|
/**
|
|
@@ -21853,7 +21853,7 @@ function __PRIVATE_setPersistentCacheIndexAutoCreationEnabled(e, t) {
|
|
|
21853
21853
|
* Use a `WeakMap` so that the mapping will be automatically dropped when the
|
|
21854
21854
|
* `Firestore` instance is garbage collected. This emulates a private member
|
|
21855
21855
|
* as described in https://goo.gle/454yvug.
|
|
21856
|
-
*/ const
|
|
21856
|
+
*/ const Ce = new WeakMap;
|
|
21857
21857
|
|
|
21858
21858
|
/**
|
|
21859
21859
|
* @license
|
|
@@ -21961,10 +21961,10 @@ function _internalQueryToProtoQueryTarget(e) {
|
|
|
21961
21961
|
this.Ou = new Map;
|
|
21962
21962
|
}
|
|
21963
21963
|
static get instance() {
|
|
21964
|
-
return
|
|
21965
|
-
if (
|
|
21966
|
-
|
|
21967
|
-
}(
|
|
21964
|
+
return ve || (ve = new __PRIVATE_TestingHooksSpiImpl, function __PRIVATE_setTestingHooksSpi(e) {
|
|
21965
|
+
if (he) throw new Error("a TestingHooksSpi instance is already set");
|
|
21966
|
+
he = e;
|
|
21967
|
+
}(ve)), ve;
|
|
21968
21968
|
}
|
|
21969
21969
|
et(e) {
|
|
21970
21970
|
this.Ou.forEach((t => t(e)));
|
|
@@ -21975,7 +21975,7 @@ function _internalQueryToProtoQueryTarget(e) {
|
|
|
21975
21975
|
}
|
|
21976
21976
|
}
|
|
21977
21977
|
|
|
21978
|
-
let
|
|
21978
|
+
let ve = null;
|
|
21979
21979
|
|
|
21980
21980
|
/**
|
|
21981
21981
|
* Cloud Firestore
|
|
@@ -21983,25 +21983,25 @@ let Fe = null;
|
|
|
21983
21983
|
* @packageDocumentation
|
|
21984
21984
|
*/ !function __PRIVATE_registerFirestore(e, t = !0) {
|
|
21985
21985
|
!function __PRIVATE_setSDKVersion(e) {
|
|
21986
|
-
|
|
21986
|
+
b = e;
|
|
21987
21987
|
}(app.SDK_VERSION), app._registerComponent(new component.Component("firestore", ((e, {instanceIdentifier: n, options: r}) => {
|
|
21988
21988
|
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) {
|
|
21989
|
-
if (!Object.prototype.hasOwnProperty.apply(e.options, [ "projectId" ])) throw new FirestoreError(
|
|
21989
|
+
if (!Object.prototype.hasOwnProperty.apply(e.options, [ "projectId" ])) throw new FirestoreError(C.INVALID_ARGUMENT, '"projectId" not provided in firebase.initializeApp.');
|
|
21990
21990
|
return new DatabaseId(e.options.projectId, t);
|
|
21991
21991
|
}(i, n), i);
|
|
21992
21992
|
return r = Object.assign({
|
|
21993
21993
|
useFetchStreams: t
|
|
21994
21994
|
}, r), s._setSettings(r), s;
|
|
21995
|
-
}), "PUBLIC").setMultipleInstances(!0)), app.registerVersion(S,
|
|
21995
|
+
}), "PUBLIC").setMultipleInstances(!0)), app.registerVersion(S, "4.6.2", e),
|
|
21996
21996
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
|
21997
|
-
app.registerVersion(S,
|
|
21997
|
+
app.registerVersion(S, "4.6.2", "cjs2017");
|
|
21998
21998
|
}();
|
|
21999
21999
|
|
|
22000
22000
|
exports.AbstractUserDataWriter = AbstractUserDataWriter;
|
|
22001
22001
|
exports.AggregateField = AggregateField;
|
|
22002
22002
|
exports.AggregateQuerySnapshot = AggregateQuerySnapshot;
|
|
22003
22003
|
exports.Bytes = Bytes;
|
|
22004
|
-
exports.CACHE_SIZE_UNLIMITED =
|
|
22004
|
+
exports.CACHE_SIZE_UNLIMITED = we;
|
|
22005
22005
|
exports.CollectionReference = CollectionReference;
|
|
22006
22006
|
exports.DocumentReference = DocumentReference;
|
|
22007
22007
|
exports.DocumentSnapshot = DocumentSnapshot;
|