@firebase/firestore 4.7.1-canary.629919ea7 → 4.7.1-canary.ff0475c41
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 +299 -299
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm2017.js +300 -300
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +3117 -3117
- 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 +305 -305
- package/dist/index.rn.js.map +1 -1
- package/dist/lite/index.browser.esm2017.js +2 -2
- package/dist/lite/index.browser.esm5.js +2 -2
- package/dist/lite/index.cjs.js +2 -2
- package/dist/lite/index.node.cjs.js +2 -2
- package/dist/lite/index.node.mjs +2 -2
- package/dist/lite/index.rn.esm2017.js +2 -2
- package/dist/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
|
|
12
|
+
const w = "@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 S = "10.13.1-canary.ff0475c41";
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
77
|
* @license
|
|
@@ -89,11 +89,11 @@ let b = "10.13.1-canary.629919ea7";
|
|
|
89
89
|
* See the License for the specific language governing permissions and
|
|
90
90
|
* limitations under the License.
|
|
91
91
|
*/
|
|
92
|
-
const
|
|
92
|
+
const b = 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 b.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
|
+
b.setLogLevel(e);
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
function __PRIVATE_logDebug(e, ...t) {
|
|
116
|
-
if (
|
|
116
|
+
if (b.logLevel <= logger.LogLevel.DEBUG) {
|
|
117
117
|
const n = t.map(__PRIVATE_argToString);
|
|
118
|
-
|
|
118
|
+
b.debug(`Firestore (${S}): ${e}`, ...n);
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
function __PRIVATE_logError(e, ...t) {
|
|
123
|
-
if (
|
|
123
|
+
if (b.logLevel <= logger.LogLevel.ERROR) {
|
|
124
124
|
const n = t.map(__PRIVATE_argToString);
|
|
125
|
-
|
|
125
|
+
b.error(`Firestore (${S}): ${e}`, ...n);
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
/**
|
|
130
130
|
* @internal
|
|
131
131
|
*/ function __PRIVATE_logWarn(e, ...t) {
|
|
132
|
-
if (
|
|
132
|
+
if (b.logLevel <= logger.LogLevel.WARN) {
|
|
133
133
|
const n = t.map(__PRIVATE_argToString);
|
|
134
|
-
|
|
134
|
+
b.warn(`Firestore (${S}): ${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 (${S}) 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 D = {
|
|
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(D.INVALID_ARGUMENT, "Timestamp nanoseconds out of range: " + t);
|
|
794
|
+
if (t >= 1e9) throw new FirestoreError(D.INVALID_ARGUMENT, "Timestamp nanoseconds out of range: " + t);
|
|
795
|
+
if (e < -62135596800) throw new FirestoreError(D.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(D.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(D.INVALID_ARGUMENT, `Invalid segment (${n}). Paths must not contain // in them.`);
|
|
1053
1053
|
// Strip leading and trailing 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 C = /^[_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 C = /^[_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(D.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(D.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(D.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(D.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 C = "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 !== D.FAILED_PRECONDITION || e.message !== C) 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(D.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(D.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(D.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 F = !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 F || (F = !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 M = [ "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 x = {}, O = [ "prefixPath", "collectionGroup", "readTime", "documentId" ], N = [ "prefixPath", "collectionGroup", "documentId" ], L = [ "collectionGroup", "readTime", "prefixPath", "documentId" ], B = [ "canonicalId", "targetId" ], k = [ "targetId", "path" ], q = [ "path", "targetId" ], Q = [ "collectionId", "parent" ], K = [ "indexId", "uid" ], $ = [ "uid", "sequenceNumber" ], U = [ "indexId", "uid", "arrayValue", "directionalValue", "orderedDocumentKey", "documentKey" ], W = [ "indexId", "uid", "orderedDocumentKey" ], G = [ "userId", "collectionPath", "documentId" ], z = [ "userId", "collectionPath", "largestBatchId" ], j = [ "userId", "collectionGroup", "largestBatchId" ], H = [ ...[ ...[ ...[ ...[ "mutationQueues", "mutations", "documentMutations", "remoteDocuments", "targets", "owner", "targetGlobal", "targetDocuments" ], "clientMetadata" ], "remoteDocumentGlobal" ], "collectionParents" ], "bundles", "namedQueries" ], J = [ ...H, "documentOverlays" ], Y = [ "mutationQueues", "mutations", "documentMutations", "remoteDocumentsV14", "targets", "owner", "targetGlobal", "targetDocuments", "clientMetadata", "remoteDocumentGlobal", "collectionParents", "bundles", "namedQueries", "documentOverlays" ], Z = Y, X = [ ...Z, "indexConfiguration", "indexState", "indexEntries" ], ee = X, te = [ ...X, "globals" ];
|
|
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
|
|
|
@@ -3403,9 +3403,9 @@ function __PRIVATE_valueCompare(e, t) {
|
|
|
3403
3403
|
|
|
3404
3404
|
case 11 /* TypeOrder.ObjectValue */ :
|
|
3405
3405
|
return function __PRIVATE_compareMaps(e, t) {
|
|
3406
|
-
if (e ===
|
|
3407
|
-
if (e ===
|
|
3408
|
-
if (t ===
|
|
3406
|
+
if (e === re.mapValue && t === re.mapValue) return 0;
|
|
3407
|
+
if (e === re.mapValue) return 1;
|
|
3408
|
+
if (t === re.mapValue) return -1;
|
|
3409
3409
|
const n = e.fields || {}, r = Object.keys(n), i = t.fields || {}, s = Object.keys(i);
|
|
3410
3410
|
// Even though MapValues are likely sorted correctly based on their insertion
|
|
3411
3411
|
// order (e.g. when received from the backend), local modifications can bring
|
|
@@ -3595,7 +3595,7 @@ function isArray(e) {
|
|
|
3595
3595
|
return "__max__" === (((e.mapValue || {}).fields || {}).__type__ || {}).stringValue;
|
|
3596
3596
|
}
|
|
3597
3597
|
|
|
3598
|
-
const
|
|
3598
|
+
const se = {
|
|
3599
3599
|
mapValue: {
|
|
3600
3600
|
fields: {
|
|
3601
3601
|
__type__: {
|
|
@@ -3609,7 +3609,7 @@ const oe = {
|
|
|
3609
3609
|
};
|
|
3610
3610
|
|
|
3611
3611
|
/** Returns the lowest value for the given value type (inclusive). */ function __PRIVATE_valuesGetLowerBound(e) {
|
|
3612
|
-
return "nullValue" in e ?
|
|
3612
|
+
return "nullValue" in e ? ie : "booleanValue" in e ? {
|
|
3613
3613
|
booleanValue: !1
|
|
3614
3614
|
} : "integerValue" in e || "doubleValue" in e ? {
|
|
3615
3615
|
doubleValue: NaN
|
|
@@ -3628,7 +3628,7 @@ const oe = {
|
|
|
3628
3628
|
}
|
|
3629
3629
|
} : "arrayValue" in e ? {
|
|
3630
3630
|
arrayValue: {}
|
|
3631
|
-
} : "mapValue" in e ? __PRIVATE_isVectorValue(e) ?
|
|
3631
|
+
} : "mapValue" in e ? __PRIVATE_isVectorValue(e) ? se : {
|
|
3632
3632
|
mapValue: {}
|
|
3633
3633
|
} : fail();
|
|
3634
3634
|
}
|
|
@@ -3653,9 +3653,9 @@ const oe = {
|
|
|
3653
3653
|
}
|
|
3654
3654
|
} : "geoPointValue" in e ? {
|
|
3655
3655
|
arrayValue: {}
|
|
3656
|
-
} : "arrayValue" in e ?
|
|
3656
|
+
} : "arrayValue" in e ? se : "mapValue" in e ? __PRIVATE_isVectorValue(e) ? {
|
|
3657
3657
|
mapValue: {}
|
|
3658
|
-
} :
|
|
3658
|
+
} : re : fail();
|
|
3659
3659
|
}
|
|
3660
3660
|
|
|
3661
3661
|
function __PRIVATE_lowerBoundCompare(e, t) {
|
|
@@ -4343,10 +4343,10 @@ function __PRIVATE_targetIsDocumentTarget(e) {
|
|
|
4343
4343
|
* the provided `fieldPath` (or the upper bound for an descending segment).
|
|
4344
4344
|
*/
|
|
4345
4345
|
function __PRIVATE_targetGetAscendingBound(e, t, n) {
|
|
4346
|
-
let r =
|
|
4346
|
+
let r = ie, i = !0;
|
|
4347
4347
|
// Process all filters to find a value for the current field segment
|
|
4348
4348
|
for (const n of __PRIVATE_targetGetFieldFiltersForPath(e, t)) {
|
|
4349
|
-
let e =
|
|
4349
|
+
let e = ie, t = !0;
|
|
4350
4350
|
switch (n.op) {
|
|
4351
4351
|
case "<" /* Operator.LESS_THAN */ :
|
|
4352
4352
|
case "<=" /* Operator.LESS_THAN_OR_EQUAL */ :
|
|
@@ -4365,7 +4365,7 @@ function __PRIVATE_targetGetAscendingBound(e, t, n) {
|
|
|
4365
4365
|
|
|
4366
4366
|
case "!=" /* Operator.NOT_EQUAL */ :
|
|
4367
4367
|
case "not-in" /* Operator.NOT_IN */ :
|
|
4368
|
-
e =
|
|
4368
|
+
e = ie;
|
|
4369
4369
|
// Remaining filters cannot be used as lower bounds.
|
|
4370
4370
|
}
|
|
4371
4371
|
__PRIVATE_lowerBoundCompare({
|
|
@@ -4401,10 +4401,10 @@ function __PRIVATE_targetGetAscendingBound(e, t, n) {
|
|
|
4401
4401
|
* Returns the value to use as the upper bound for ascending index segment at
|
|
4402
4402
|
* the provided `fieldPath` (or the lower bound for a descending segment).
|
|
4403
4403
|
*/ function __PRIVATE_targetGetDescendingBound(e, t, n) {
|
|
4404
|
-
let r =
|
|
4404
|
+
let r = re, i = !0;
|
|
4405
4405
|
// Process all filters to find a value for the current field segment
|
|
4406
4406
|
for (const n of __PRIVATE_targetGetFieldFiltersForPath(e, t)) {
|
|
4407
|
-
let e =
|
|
4407
|
+
let e = re, t = !0;
|
|
4408
4408
|
switch (n.op) {
|
|
4409
4409
|
case ">=" /* Operator.GREATER_THAN_OR_EQUAL */ :
|
|
4410
4410
|
case ">" /* Operator.GREATER_THAN */ :
|
|
@@ -4423,7 +4423,7 @@ function __PRIVATE_targetGetAscendingBound(e, t, n) {
|
|
|
4423
4423
|
|
|
4424
4424
|
case "!=" /* Operator.NOT_EQUAL */ :
|
|
4425
4425
|
case "not-in" /* Operator.NOT_IN */ :
|
|
4426
|
-
e =
|
|
4426
|
+
e = re;
|
|
4427
4427
|
// Remaining filters cannot be used as upper bounds.
|
|
4428
4428
|
}
|
|
4429
4429
|
__PRIVATE_upperBoundCompare({
|
|
@@ -4807,22 +4807,22 @@ function __PRIVATE_compareDocs(e, t, n) {
|
|
|
4807
4807
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4808
4808
|
* See the License for the specific language governing permissions and
|
|
4809
4809
|
* limitations under the License.
|
|
4810
|
-
*/ const
|
|
4810
|
+
*/ const oe = new SortedMap(DocumentKey.comparator);
|
|
4811
4811
|
|
|
4812
4812
|
function __PRIVATE_mutableDocumentMap() {
|
|
4813
|
-
return
|
|
4813
|
+
return oe;
|
|
4814
4814
|
}
|
|
4815
4815
|
|
|
4816
|
-
const
|
|
4816
|
+
const _e = new SortedMap(DocumentKey.comparator);
|
|
4817
4817
|
|
|
4818
4818
|
function documentMap(...e) {
|
|
4819
|
-
let t =
|
|
4819
|
+
let t = _e;
|
|
4820
4820
|
for (const n of e) t = t.insert(n.key, n);
|
|
4821
4821
|
return t;
|
|
4822
4822
|
}
|
|
4823
4823
|
|
|
4824
4824
|
function __PRIVATE_convertOverlayedDocumentMapToDocumentMap(e) {
|
|
4825
|
-
let t =
|
|
4825
|
+
let t = _e;
|
|
4826
4826
|
return e.forEach(((e, n) => t = t.insert(e, n.overlayedDocument))), t;
|
|
4827
4827
|
}
|
|
4828
4828
|
|
|
@@ -4838,20 +4838,20 @@ function __PRIVATE_newDocumentKeyMap() {
|
|
|
4838
4838
|
return new ObjectMap((e => e.toString()), ((e, t) => e.isEqual(t)));
|
|
4839
4839
|
}
|
|
4840
4840
|
|
|
4841
|
-
const
|
|
4841
|
+
const ae = new SortedMap(DocumentKey.comparator);
|
|
4842
4842
|
|
|
4843
|
-
const
|
|
4843
|
+
const ue = new SortedSet(DocumentKey.comparator);
|
|
4844
4844
|
|
|
4845
4845
|
function __PRIVATE_documentKeySet(...e) {
|
|
4846
|
-
let t =
|
|
4846
|
+
let t = ue;
|
|
4847
4847
|
for (const n of e) t = t.add(n);
|
|
4848
4848
|
return t;
|
|
4849
4849
|
}
|
|
4850
4850
|
|
|
4851
|
-
const
|
|
4851
|
+
const ce = new SortedSet(__PRIVATE_primitiveComparator);
|
|
4852
4852
|
|
|
4853
4853
|
function __PRIVATE_targetIdSet() {
|
|
4854
|
-
return
|
|
4854
|
+
return ce;
|
|
4855
4855
|
}
|
|
4856
4856
|
|
|
4857
4857
|
/**
|
|
@@ -5542,7 +5542,7 @@ class __PRIVATE_VerifyMutation extends Mutation {
|
|
|
5542
5542
|
*/ static from(e, t, n) {
|
|
5543
5543
|
__PRIVATE_hardAssert(e.mutations.length === n.length);
|
|
5544
5544
|
let r = function __PRIVATE_documentVersionMap() {
|
|
5545
|
-
return
|
|
5545
|
+
return ae;
|
|
5546
5546
|
}();
|
|
5547
5547
|
const i = e.mutations;
|
|
5548
5548
|
for (let e = 0; e < i.length; e++) r = r.insert(i[e].key, n[e].version);
|
|
@@ -5656,7 +5656,7 @@ class __PRIVATE_VerifyMutation extends Mutation {
|
|
|
5656
5656
|
* Important! The names of these identifiers matter because the string forms
|
|
5657
5657
|
* are used for reverse lookups from the webchannel stream. Do NOT change the
|
|
5658
5658
|
* names of these identifiers or change this into a const enum.
|
|
5659
|
-
*/ var
|
|
5659
|
+
*/ var le, he;
|
|
5660
5660
|
|
|
5661
5661
|
/**
|
|
5662
5662
|
* Determines whether an error code represents a permanent error when received
|
|
@@ -5669,29 +5669,29 @@ function __PRIVATE_isPermanentError(e) {
|
|
|
5669
5669
|
default:
|
|
5670
5670
|
return fail();
|
|
5671
5671
|
|
|
5672
|
-
case
|
|
5673
|
-
case
|
|
5674
|
-
case
|
|
5675
|
-
case
|
|
5676
|
-
case
|
|
5677
|
-
case
|
|
5672
|
+
case D.CANCELLED:
|
|
5673
|
+
case D.UNKNOWN:
|
|
5674
|
+
case D.DEADLINE_EXCEEDED:
|
|
5675
|
+
case D.RESOURCE_EXHAUSTED:
|
|
5676
|
+
case D.INTERNAL:
|
|
5677
|
+
case D.UNAVAILABLE:
|
|
5678
5678
|
// Unauthenticated means something went wrong with our token and we need
|
|
5679
5679
|
// to retry with new credentials which will happen automatically.
|
|
5680
|
-
case
|
|
5680
|
+
case D.UNAUTHENTICATED:
|
|
5681
5681
|
return !1;
|
|
5682
5682
|
|
|
5683
|
-
case
|
|
5684
|
-
case
|
|
5685
|
-
case
|
|
5686
|
-
case
|
|
5687
|
-
case
|
|
5683
|
+
case D.INVALID_ARGUMENT:
|
|
5684
|
+
case D.NOT_FOUND:
|
|
5685
|
+
case D.ALREADY_EXISTS:
|
|
5686
|
+
case D.PERMISSION_DENIED:
|
|
5687
|
+
case D.FAILED_PRECONDITION:
|
|
5688
5688
|
// Aborted might be retried in some scenarios, but that is dependent on
|
|
5689
5689
|
// the context and should handled individually by the calling code.
|
|
5690
5690
|
// See https://cloud.google.com/apis/design/errors.
|
|
5691
|
-
case
|
|
5692
|
-
case
|
|
5693
|
-
case
|
|
5694
|
-
case
|
|
5691
|
+
case D.ABORTED:
|
|
5692
|
+
case D.OUT_OF_RANGE:
|
|
5693
|
+
case D.UNIMPLEMENTED:
|
|
5694
|
+
case D.DATA_LOSS:
|
|
5695
5695
|
return !0;
|
|
5696
5696
|
}
|
|
5697
5697
|
}
|
|
@@ -5719,58 +5719,58 @@ function __PRIVATE_mapCodeFromRpcCode(e) {
|
|
|
5719
5719
|
if (void 0 === e)
|
|
5720
5720
|
// This shouldn't normally happen, but in certain error cases (like trying
|
|
5721
5721
|
// to send invalid proto messages) we may get an error with no GRPC code.
|
|
5722
|
-
return __PRIVATE_logError("GRPC error has no .code"),
|
|
5722
|
+
return __PRIVATE_logError("GRPC error has no .code"), D.UNKNOWN;
|
|
5723
5723
|
switch (e) {
|
|
5724
|
-
case
|
|
5725
|
-
return
|
|
5724
|
+
case le.OK:
|
|
5725
|
+
return D.OK;
|
|
5726
5726
|
|
|
5727
|
-
case
|
|
5728
|
-
return
|
|
5727
|
+
case le.CANCELLED:
|
|
5728
|
+
return D.CANCELLED;
|
|
5729
5729
|
|
|
5730
|
-
case
|
|
5731
|
-
return
|
|
5730
|
+
case le.UNKNOWN:
|
|
5731
|
+
return D.UNKNOWN;
|
|
5732
5732
|
|
|
5733
|
-
case
|
|
5734
|
-
return
|
|
5733
|
+
case le.DEADLINE_EXCEEDED:
|
|
5734
|
+
return D.DEADLINE_EXCEEDED;
|
|
5735
5735
|
|
|
5736
|
-
case
|
|
5737
|
-
return
|
|
5736
|
+
case le.RESOURCE_EXHAUSTED:
|
|
5737
|
+
return D.RESOURCE_EXHAUSTED;
|
|
5738
5738
|
|
|
5739
|
-
case
|
|
5740
|
-
return
|
|
5739
|
+
case le.INTERNAL:
|
|
5740
|
+
return D.INTERNAL;
|
|
5741
5741
|
|
|
5742
|
-
case
|
|
5743
|
-
return
|
|
5742
|
+
case le.UNAVAILABLE:
|
|
5743
|
+
return D.UNAVAILABLE;
|
|
5744
5744
|
|
|
5745
|
-
case
|
|
5746
|
-
return
|
|
5745
|
+
case le.UNAUTHENTICATED:
|
|
5746
|
+
return D.UNAUTHENTICATED;
|
|
5747
5747
|
|
|
5748
|
-
case
|
|
5749
|
-
return
|
|
5748
|
+
case le.INVALID_ARGUMENT:
|
|
5749
|
+
return D.INVALID_ARGUMENT;
|
|
5750
5750
|
|
|
5751
|
-
case
|
|
5752
|
-
return
|
|
5751
|
+
case le.NOT_FOUND:
|
|
5752
|
+
return D.NOT_FOUND;
|
|
5753
5753
|
|
|
5754
|
-
case
|
|
5755
|
-
return
|
|
5754
|
+
case le.ALREADY_EXISTS:
|
|
5755
|
+
return D.ALREADY_EXISTS;
|
|
5756
5756
|
|
|
5757
|
-
case
|
|
5758
|
-
return
|
|
5757
|
+
case le.PERMISSION_DENIED:
|
|
5758
|
+
return D.PERMISSION_DENIED;
|
|
5759
5759
|
|
|
5760
|
-
case
|
|
5761
|
-
return
|
|
5760
|
+
case le.FAILED_PRECONDITION:
|
|
5761
|
+
return D.FAILED_PRECONDITION;
|
|
5762
5762
|
|
|
5763
|
-
case
|
|
5764
|
-
return
|
|
5763
|
+
case le.ABORTED:
|
|
5764
|
+
return D.ABORTED;
|
|
5765
5765
|
|
|
5766
|
-
case
|
|
5767
|
-
return
|
|
5766
|
+
case le.OUT_OF_RANGE:
|
|
5767
|
+
return D.OUT_OF_RANGE;
|
|
5768
5768
|
|
|
5769
|
-
case
|
|
5770
|
-
return
|
|
5769
|
+
case le.UNIMPLEMENTED:
|
|
5770
|
+
return D.UNIMPLEMENTED;
|
|
5771
5771
|
|
|
5772
|
-
case
|
|
5773
|
-
return
|
|
5772
|
+
case le.DATA_LOSS:
|
|
5773
|
+
return D.DATA_LOSS;
|
|
5774
5774
|
|
|
5775
5775
|
default:
|
|
5776
5776
|
return fail();
|
|
@@ -5784,14 +5784,14 @@ function __PRIVATE_mapCodeFromRpcCode(e) {
|
|
|
5784
5784
|
* "UNKNOWN", etc.)
|
|
5785
5785
|
* @returns The equivalent Code. Non-matching responses are mapped to
|
|
5786
5786
|
* Code.UNKNOWN.
|
|
5787
|
-
*/ (
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5792
|
-
|
|
5793
|
-
|
|
5794
|
-
|
|
5787
|
+
*/ (he = le || (le = {}))[he.OK = 0] = "OK", he[he.CANCELLED = 1] = "CANCELLED",
|
|
5788
|
+
he[he.UNKNOWN = 2] = "UNKNOWN", he[he.INVALID_ARGUMENT = 3] = "INVALID_ARGUMENT",
|
|
5789
|
+
he[he.DEADLINE_EXCEEDED = 4] = "DEADLINE_EXCEEDED", he[he.NOT_FOUND = 5] = "NOT_FOUND",
|
|
5790
|
+
he[he.ALREADY_EXISTS = 6] = "ALREADY_EXISTS", he[he.PERMISSION_DENIED = 7] = "PERMISSION_DENIED",
|
|
5791
|
+
he[he.UNAUTHENTICATED = 16] = "UNAUTHENTICATED", he[he.RESOURCE_EXHAUSTED = 8] = "RESOURCE_EXHAUSTED",
|
|
5792
|
+
he[he.FAILED_PRECONDITION = 9] = "FAILED_PRECONDITION", he[he.ABORTED = 10] = "ABORTED",
|
|
5793
|
+
he[he.OUT_OF_RANGE = 11] = "OUT_OF_RANGE", he[he.UNIMPLEMENTED = 12] = "UNIMPLEMENTED",
|
|
5794
|
+
he[he.INTERNAL = 13] = "INTERNAL", he[he.UNAVAILABLE = 14] = "UNAVAILABLE", he[he.DATA_LOSS = 15] = "DATA_LOSS";
|
|
5795
5795
|
|
|
5796
5796
|
/**
|
|
5797
5797
|
* @license
|
|
@@ -5816,7 +5816,7 @@ Pe[Pe.INTERNAL = 13] = "INTERNAL", Pe[Pe.UNAVAILABLE = 14] = "UNAVAILABLE", Pe[P
|
|
|
5816
5816
|
* integration tests that have registered callbacks to be notified of events
|
|
5817
5817
|
* that happen during the test execution.
|
|
5818
5818
|
*/
|
|
5819
|
-
let
|
|
5819
|
+
let Pe = null;
|
|
5820
5820
|
|
|
5821
5821
|
/**
|
|
5822
5822
|
* Sets the value of the `testingHooksSpi` object.
|
|
@@ -5864,7 +5864,7 @@ function __PRIVATE_newTextEncoder() {
|
|
|
5864
5864
|
* See the License for the specific language governing permissions and
|
|
5865
5865
|
* limitations under the License.
|
|
5866
5866
|
*/
|
|
5867
|
-
const
|
|
5867
|
+
const Ie = new bloomBlob.Integer([ 4294967295, 4294967295 ], 0);
|
|
5868
5868
|
|
|
5869
5869
|
// Hash a string using md5 hashing algorithm.
|
|
5870
5870
|
function __PRIVATE_getMd5HashValue(e) {
|
|
@@ -5899,7 +5899,7 @@ class BloomFilter {
|
|
|
5899
5899
|
// Calculate hashed value h(i) = h1 + (i * h2).
|
|
5900
5900
|
let r = e.add(t.multiply(bloomBlob.Integer.fromNumber(n)));
|
|
5901
5901
|
// Wrap if hash value overflow 64bit.
|
|
5902
|
-
return 1 === r.compare(
|
|
5902
|
+
return 1 === r.compare(Ie) && (r = new bloomBlob.Integer([ r.getBits(0), r.getBits(1) ], 0)),
|
|
5903
5903
|
r.modulo(this.Te).toNumber();
|
|
5904
5904
|
}
|
|
5905
5905
|
// Return whether the bit on the given index in the bitmap is set to 1.
|
|
@@ -6317,7 +6317,7 @@ class __PRIVATE_WatchChangeAggregator {
|
|
|
6317
6317
|
const e = 2 /* BloomFilterApplicationStatus.FalsePositive */ === i ? "TargetPurposeExistenceFilterMismatchBloom" /* TargetPurpose.ExistenceFilterMismatchBloom */ : "TargetPurposeExistenceFilterMismatch" /* TargetPurpose.ExistenceFilterMismatch */;
|
|
6318
6318
|
this.Qe = this.Qe.insert(t, e);
|
|
6319
6319
|
}
|
|
6320
|
-
null ==
|
|
6320
|
+
null == Pe || Pe.et(function __PRIVATE_createExistenceFilterMismatchInfoForTestingHooks(e, t, n, r, i) {
|
|
6321
6321
|
var s, o, _, a, u, c;
|
|
6322
6322
|
const l = {
|
|
6323
6323
|
localCacheCount: e,
|
|
@@ -6533,13 +6533,13 @@ function __PRIVATE_snapshotChangesMap() {
|
|
|
6533
6533
|
return new SortedMap(DocumentKey.comparator);
|
|
6534
6534
|
}
|
|
6535
6535
|
|
|
6536
|
-
const
|
|
6536
|
+
const Te = (() => {
|
|
6537
6537
|
const e = {
|
|
6538
6538
|
asc: "ASCENDING",
|
|
6539
6539
|
desc: "DESCENDING"
|
|
6540
6540
|
};
|
|
6541
6541
|
return e;
|
|
6542
|
-
})(),
|
|
6542
|
+
})(), Ee = (() => {
|
|
6543
6543
|
const e = {
|
|
6544
6544
|
"<": "LESS_THAN",
|
|
6545
6545
|
"<=": "LESS_THAN_OR_EQUAL",
|
|
@@ -6553,7 +6553,7 @@ const Ee = (() => {
|
|
|
6553
6553
|
"array-contains-any": "ARRAY_CONTAINS_ANY"
|
|
6554
6554
|
};
|
|
6555
6555
|
return e;
|
|
6556
|
-
})(),
|
|
6556
|
+
})(), de = (() => {
|
|
6557
6557
|
const e = {
|
|
6558
6558
|
and: "AND",
|
|
6559
6559
|
or: "OR"
|
|
@@ -6655,8 +6655,8 @@ function __PRIVATE_toName(e, t) {
|
|
|
6655
6655
|
|
|
6656
6656
|
function fromName(e, t) {
|
|
6657
6657
|
const n = __PRIVATE_fromResourceName(t);
|
|
6658
|
-
if (n.get(1) !== e.databaseId.projectId) throw new FirestoreError(
|
|
6659
|
-
if (n.get(3) !== e.databaseId.database) throw new FirestoreError(
|
|
6658
|
+
if (n.get(1) !== e.databaseId.projectId) throw new FirestoreError(D.INVALID_ARGUMENT, "Tried to deserialize key from different project: " + n.get(1) + " vs " + e.databaseId.projectId);
|
|
6659
|
+
if (n.get(3) !== e.databaseId.database) throw new FirestoreError(D.INVALID_ARGUMENT, "Tried to deserialize key from different database: " + n.get(3) + " vs " + e.databaseId.database);
|
|
6660
6660
|
return new DocumentKey(__PRIVATE_extractLocalPathFromResourceName(n));
|
|
6661
6661
|
}
|
|
6662
6662
|
|
|
@@ -6730,7 +6730,7 @@ function __PRIVATE_fromWatchChange(e, t) {
|
|
|
6730
6730
|
// does not indicate that it extends Uint8Array.
|
|
6731
6731
|
t instanceof Buffer || t instanceof Uint8Array), ByteString.fromUint8Array(t || new Uint8Array));
|
|
6732
6732
|
}(e, t.targetChange.resumeToken), o = t.targetChange.cause, _ = o && function __PRIVATE_fromRpcStatus(e) {
|
|
6733
|
-
const t = void 0 === e.code ?
|
|
6733
|
+
const t = void 0 === e.code ? D.UNKNOWN : __PRIVATE_mapCodeFromRpcCode(e.code);
|
|
6734
6734
|
return new FirestoreError(t, e.message || "");
|
|
6735
6735
|
}(o);
|
|
6736
6736
|
n = new __PRIVATE_WatchTargetChange(r, i, s, _ || null);
|
|
@@ -7125,15 +7125,15 @@ function __PRIVATE_fromFilter(e) {
|
|
|
7125
7125
|
}
|
|
7126
7126
|
|
|
7127
7127
|
function __PRIVATE_toDirection(e) {
|
|
7128
|
-
return
|
|
7128
|
+
return Te[e];
|
|
7129
7129
|
}
|
|
7130
7130
|
|
|
7131
7131
|
function __PRIVATE_toOperatorName(e) {
|
|
7132
|
-
return
|
|
7132
|
+
return Ee[e];
|
|
7133
7133
|
}
|
|
7134
7134
|
|
|
7135
7135
|
function __PRIVATE_toCompositeOperatorName(e) {
|
|
7136
|
-
return
|
|
7136
|
+
return de[e];
|
|
7137
7137
|
}
|
|
7138
7138
|
|
|
7139
7139
|
function __PRIVATE_toFieldPathReference(e) {
|
|
@@ -8498,7 +8498,7 @@ function __PRIVATE_applyDistributionFieldAndCompositeFilters(e, t) {
|
|
|
8498
8498
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
8499
8499
|
* See the License for the specific language governing permissions and
|
|
8500
8500
|
* limitations under the License.
|
|
8501
|
-
*/ const
|
|
8501
|
+
*/ const Ae = new Uint8Array(0);
|
|
8502
8502
|
|
|
8503
8503
|
/**
|
|
8504
8504
|
* A persisted implementation of IndexManager.
|
|
@@ -8712,7 +8712,7 @@ class __PRIVATE_IndexedDbIndexManager {
|
|
|
8712
8712
|
// combined with the values from the query bounds.
|
|
8713
8713
|
const _ = (null != t ? t.length : 1) * Math.max(n.length, i.length), a = _ / (null != t ? t.length : 1), u = [];
|
|
8714
8714
|
for (let c = 0; c < _; ++c) {
|
|
8715
|
-
const _ = t ? this.dn(t[c / a]) :
|
|
8715
|
+
const _ = t ? this.dn(t[c / a]) : Ae, l = this.An(e, _, n[c % a], r), h = this.Rn(e, _, i[c % a], s), P = o.map((t => this.An(e, _, t,
|
|
8716
8716
|
/* inclusive= */ !0)));
|
|
8717
8717
|
u.push(...this.createRange(l, h, P));
|
|
8718
8718
|
}
|
|
@@ -8909,7 +8909,7 @@ class __PRIVATE_IndexedDbIndexManager {
|
|
|
8909
8909
|
if (null != i) {
|
|
8910
8910
|
const s = e.data.field(i.fieldPath);
|
|
8911
8911
|
if (isArray(s)) for (const i of s.arrayValue.values || []) n = n.add(new __PRIVATE_IndexEntry(t.indexId, e.key, this.dn(i), r));
|
|
8912
|
-
} else n = n.add(new __PRIVATE_IndexEntry(t.indexId, e.key,
|
|
8912
|
+
} else n = n.add(new __PRIVATE_IndexEntry(t.indexId, e.key, Ae, r));
|
|
8913
8913
|
return n;
|
|
8914
8914
|
}
|
|
8915
8915
|
/**
|
|
@@ -8984,7 +8984,7 @@ class __PRIVATE_IndexedDbIndexManager {
|
|
|
8984
8984
|
// If we encounter two bounds that will create an unmatchable key range,
|
|
8985
8985
|
// then we return an empty set of key ranges.
|
|
8986
8986
|
if (this.Cn(r[e], r[e + 1])) return [];
|
|
8987
|
-
const t = [ r[e].indexId, this.uid, r[e].arrayValue, r[e].directionalValue,
|
|
8987
|
+
const t = [ r[e].indexId, this.uid, r[e].arrayValue, r[e].directionalValue, Ae, [] ], n = [ r[e + 1].indexId, this.uid, r[e + 1].arrayValue, r[e + 1].directionalValue, Ae, [] ];
|
|
8988
8988
|
i.push(IDBKeyRange.bound(t, n));
|
|
8989
8989
|
}
|
|
8990
8990
|
return i;
|
|
@@ -9052,7 +9052,7 @@ function __PRIVATE_getMinOffsetFromFieldIndexes(e) {
|
|
|
9052
9052
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9053
9053
|
* See the License for the specific language governing permissions and
|
|
9054
9054
|
* limitations under the License.
|
|
9055
|
-
*/ const
|
|
9055
|
+
*/ const Re = {
|
|
9056
9056
|
didRun: !1,
|
|
9057
9057
|
sequenceNumbersCollected: 0,
|
|
9058
9058
|
targetsRemoved: 0,
|
|
@@ -9216,7 +9216,7 @@ class __PRIVATE_IndexedDbMutationQueue {
|
|
|
9216
9216
|
let c = new SortedSet(((e, t) => __PRIVATE_primitiveComparator(e.canonicalString(), t.canonicalString())));
|
|
9217
9217
|
for (const e of r) {
|
|
9218
9218
|
const t = __PRIVATE_newDbDocumentMutationKey(this.userId, e.key.path, o);
|
|
9219
|
-
c = c.add(e.key.path.popLast()), u.push(s.put(a)), u.push(i.put(t,
|
|
9219
|
+
c = c.add(e.key.path.popLast()), u.push(s.put(a)), u.push(i.put(t, x));
|
|
9220
9220
|
}
|
|
9221
9221
|
return c.forEach((t => {
|
|
9222
9222
|
u.push(this.indexManager.addToCollectionParentIndex(e, t));
|
|
@@ -9785,8 +9785,8 @@ class __PRIVATE_TargetIdGenerator {
|
|
|
9785
9785
|
}
|
|
9786
9786
|
collect(e, t) {
|
|
9787
9787
|
return -1 === this.params.cacheSizeCollectionThreshold ? (__PRIVATE_logDebug("LruGarbageCollector", "Garbage collection skipped; disabled"),
|
|
9788
|
-
PersistencePromise.resolve(
|
|
9789
|
-
|
|
9788
|
+
PersistencePromise.resolve(Re)) : 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}`),
|
|
9789
|
+
Re) : this.Xn(e, t)));
|
|
9790
9790
|
}
|
|
9791
9791
|
getCacheSize(e) {
|
|
9792
9792
|
return this.Jn.getCacheSize(e);
|
|
@@ -11577,7 +11577,7 @@ class __PRIVATE_MemoryLruDelegate {
|
|
|
11577
11577
|
e.createObjectStore("mutations", {
|
|
11578
11578
|
keyPath: "batchId",
|
|
11579
11579
|
autoIncrement: !0
|
|
11580
|
-
}).createIndex("userMutationsIndex",
|
|
11580
|
+
}).createIndex("userMutationsIndex", M, {
|
|
11581
11581
|
unique: !0
|
|
11582
11582
|
}), e.createObjectStore("documentMutations");
|
|
11583
11583
|
}
|
|
@@ -11622,7 +11622,7 @@ class __PRIVATE_MemoryLruDelegate {
|
|
|
11622
11622
|
e.createObjectStore("mutations", {
|
|
11623
11623
|
keyPath: "batchId",
|
|
11624
11624
|
autoIncrement: !0
|
|
11625
|
-
}).createIndex("userMutationsIndex",
|
|
11625
|
+
}).createIndex("userMutationsIndex", M, {
|
|
11626
11626
|
unique: !0
|
|
11627
11627
|
});
|
|
11628
11628
|
const r = t.store("mutations"), i = n.map((e => r.put(e)));
|
|
@@ -11659,19 +11659,19 @@ class __PRIVATE_MemoryLruDelegate {
|
|
|
11659
11659
|
}))), n < 12 && r >= 12 && (s = s.next((() => {
|
|
11660
11660
|
!function __PRIVATE_createDocumentOverlayStore(e) {
|
|
11661
11661
|
const t = e.createObjectStore("documentOverlays", {
|
|
11662
|
-
keyPath:
|
|
11662
|
+
keyPath: G
|
|
11663
11663
|
});
|
|
11664
|
-
t.createIndex("collectionPathOverlayIndex",
|
|
11664
|
+
t.createIndex("collectionPathOverlayIndex", z, {
|
|
11665
11665
|
unique: !1
|
|
11666
|
-
}), t.createIndex("collectionGroupOverlayIndex",
|
|
11666
|
+
}), t.createIndex("collectionGroupOverlayIndex", j, {
|
|
11667
11667
|
unique: !1
|
|
11668
11668
|
});
|
|
11669
11669
|
}(e);
|
|
11670
11670
|
}))), n < 13 && r >= 13 && (s = s.next((() => function __PRIVATE_createRemoteDocumentCache(e) {
|
|
11671
11671
|
const t = e.createObjectStore("remoteDocumentsV14", {
|
|
11672
|
-
keyPath:
|
|
11672
|
+
keyPath: O
|
|
11673
11673
|
});
|
|
11674
|
-
t.createIndex("documentKeyIndex",
|
|
11674
|
+
t.createIndex("documentKeyIndex", N), t.createIndex("collectionGroupIndex", L);
|
|
11675
11675
|
}(e))).next((() => this._i(e, i))).next((() => e.deleteObjectStore("remoteDocuments")))),
|
|
11676
11676
|
n < 14 && r >= 14 && (s = s.next((() => this.ai(e, i)))), n < 15 && r >= 15 && (s = s.next((() => function __PRIVATE_createFieldIndex(e) {
|
|
11677
11677
|
e.createObjectStore("indexConfiguration", {
|
|
@@ -11681,13 +11681,13 @@ class __PRIVATE_MemoryLruDelegate {
|
|
|
11681
11681
|
unique: !1
|
|
11682
11682
|
});
|
|
11683
11683
|
e.createObjectStore("indexState", {
|
|
11684
|
-
keyPath:
|
|
11685
|
-
}).createIndex("sequenceNumberIndex",
|
|
11684
|
+
keyPath: K
|
|
11685
|
+
}).createIndex("sequenceNumberIndex", $, {
|
|
11686
11686
|
unique: !1
|
|
11687
11687
|
});
|
|
11688
11688
|
e.createObjectStore("indexEntries", {
|
|
11689
|
-
keyPath:
|
|
11690
|
-
}).createIndex("documentKeyIndex",
|
|
11689
|
+
keyPath: U
|
|
11690
|
+
}).createIndex("documentKeyIndex", W, {
|
|
11691
11691
|
unique: !1
|
|
11692
11692
|
});
|
|
11693
11693
|
}(e)))), n < 16 && r >= 16 && (
|
|
@@ -11748,7 +11748,7 @@ class __PRIVATE_MemoryLruDelegate {
|
|
|
11748
11748
|
si(e, t) {
|
|
11749
11749
|
// Create the index.
|
|
11750
11750
|
e.createObjectStore("collectionParents", {
|
|
11751
|
-
keyPath:
|
|
11751
|
+
keyPath: Q
|
|
11752
11752
|
});
|
|
11753
11753
|
const n = t.store("collectionParents"), r = new __PRIVATE_MemoryCollectionParentIndex, addEntry = e => {
|
|
11754
11754
|
if (r.add(e)) {
|
|
@@ -11833,19 +11833,19 @@ class __PRIVATE_MemoryLruDelegate {
|
|
|
11833
11833
|
|
|
11834
11834
|
function __PRIVATE_createQueryCache(e) {
|
|
11835
11835
|
e.createObjectStore("targetDocuments", {
|
|
11836
|
-
keyPath:
|
|
11837
|
-
}).createIndex("documentTargetsIndex",
|
|
11836
|
+
keyPath: k
|
|
11837
|
+
}).createIndex("documentTargetsIndex", q, {
|
|
11838
11838
|
unique: !0
|
|
11839
11839
|
});
|
|
11840
11840
|
// NOTE: This is unique only because the TargetId is the suffix.
|
|
11841
11841
|
e.createObjectStore("targets", {
|
|
11842
11842
|
keyPath: "targetId"
|
|
11843
|
-
}).createIndex("queryTargetsIndex",
|
|
11843
|
+
}).createIndex("queryTargetsIndex", B, {
|
|
11844
11844
|
unique: !0
|
|
11845
11845
|
}), e.createObjectStore("targetGlobal");
|
|
11846
11846
|
}
|
|
11847
11847
|
|
|
11848
|
-
const
|
|
11848
|
+
const Ve = "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.";
|
|
11849
11849
|
|
|
11850
11850
|
/**
|
|
11851
11851
|
* Oldest acceptable age in milliseconds for client metadata before the client
|
|
@@ -11921,7 +11921,7 @@ class __PRIVATE_IndexedDbPersistence {
|
|
|
11921
11921
|
/** The last time we garbage collected the client metadata object store. */
|
|
11922
11922
|
this.Ei = Number.NEGATIVE_INFINITY,
|
|
11923
11923
|
/** A listener to notify on primary state changes. */
|
|
11924
|
-
this.di = e => Promise.resolve(), !__PRIVATE_IndexedDbPersistence.D()) throw new FirestoreError(
|
|
11924
|
+
this.di = e => Promise.resolve(), !__PRIVATE_IndexedDbPersistence.D()) throw new FirestoreError(D.UNIMPLEMENTED, "This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");
|
|
11925
11925
|
this.referenceDelegate = new __PRIVATE_IndexedDbLruDelegateImpl(this, r), this.Ai = t + "main",
|
|
11926
11926
|
this.serializer = new __PRIVATE_LocalSerializer(_), this.Ri = new __PRIVATE_SimpleDb(this.Ai, this.hi, new __PRIVATE_SchemaConverter(this.serializer)),
|
|
11927
11927
|
this.$r = new __PRIVATE_IndexedDbGlobalsCache, this.Ur = new __PRIVATE_IndexedDbTargetCache(this.referenceDelegate, this.serializer),
|
|
@@ -11941,7 +11941,7 @@ class __PRIVATE_IndexedDbPersistence {
|
|
|
11941
11941
|
if (!this.isPrimary && !this.allowTabSynchronization)
|
|
11942
11942
|
// Fail `start()` if `synchronizeTabs` is disabled and we cannot
|
|
11943
11943
|
// obtain the primary lease.
|
|
11944
|
-
throw new FirestoreError(
|
|
11944
|
+
throw new FirestoreError(D.FAILED_PRECONDITION, Ve);
|
|
11945
11945
|
return this.fi(), this.gi(), this.pi(), this.runTransaction("getHighestListenSequenceNumber", "readonly", (e => this.Ur.getHighestSequenceNumber(e)));
|
|
11946
11946
|
})).then((e => {
|
|
11947
11947
|
this.Qr = new __PRIVATE_ListenSequence(e, this.ci);
|
|
@@ -12083,7 +12083,7 @@ class __PRIVATE_IndexedDbPersistence {
|
|
|
12083
12083
|
// settings is not supported.
|
|
12084
12084
|
// TODO(b/114226234): Remove this check when `synchronizeTabs` can
|
|
12085
12085
|
// no longer be turned off.
|
|
12086
|
-
throw new FirestoreError(
|
|
12086
|
+
throw new FirestoreError(D.FAILED_PRECONDITION, Ve);
|
|
12087
12087
|
return !1;
|
|
12088
12088
|
}
|
|
12089
12089
|
}
|
|
@@ -12156,7 +12156,7 @@ class __PRIVATE_IndexedDbPersistence {
|
|
|
12156
12156
|
const r = "readonly" === t ? "readonly" : "readwrite", i =
|
|
12157
12157
|
/** Returns the object stores for the provided schema. */
|
|
12158
12158
|
function __PRIVATE_getObjectStores(e) {
|
|
12159
|
-
return 17 === e ?
|
|
12159
|
+
return 17 === e ? te : 16 === e ? ee : 15 === e ? X : 14 === e ? Z : 13 === e ? Y : 12 === e ? J : 11 === e ? H : void fail();
|
|
12160
12160
|
}(this.hi);
|
|
12161
12161
|
let s;
|
|
12162
12162
|
// Do all transactions as readwrite against all object stores, since we
|
|
@@ -12164,7 +12164,7 @@ class __PRIVATE_IndexedDbPersistence {
|
|
|
12164
12164
|
return this.Ri.runTransaction(e, r, i, (r => (s = new __PRIVATE_IndexedDbTransaction(r, this.Qr ? this.Qr.next() : __PRIVATE_ListenSequence.oe),
|
|
12165
12165
|
"readwrite-primary" === t ? this.wi(s).next((e => !!e || this.Si(s))).next((t => {
|
|
12166
12166
|
if (!t) throw __PRIVATE_logError(`Failed to obtain primary lease for action '${e}'.`),
|
|
12167
|
-
this.isPrimary = !1, this.ui.enqueueRetryable((() => this.di(!1))), new FirestoreError(
|
|
12167
|
+
this.isPrimary = !1, this.ui.enqueueRetryable((() => this.di(!1))), new FirestoreError(D.FAILED_PRECONDITION, C);
|
|
12168
12168
|
return n(s);
|
|
12169
12169
|
})).next((e => this.Di(s).next((() => e)))) : this.Ki(s).next((() => n(s)))))).then((e => (s.raiseOnCommittedEvent(),
|
|
12170
12170
|
e)));
|
|
@@ -12177,7 +12177,7 @@ class __PRIVATE_IndexedDbPersistence {
|
|
|
12177
12177
|
// be turned off.
|
|
12178
12178
|
Ki(e) {
|
|
12179
12179
|
return __PRIVATE_primaryClientStore(e).get("owner").next((e => {
|
|
12180
|
-
if (null !== e && this.Mi(e.leaseTimestampMs, 5e3) && !this.Ni(e.ownerId) && !this.vi(e) && !(this.li || this.allowTabSynchronization && e.allowTabSynchronization)) throw new FirestoreError(
|
|
12180
|
+
if (null !== e && this.Mi(e.leaseTimestampMs, 5e3) && !this.Ni(e.ownerId) && !this.vi(e) && !(this.li || this.allowTabSynchronization && e.allowTabSynchronization)) throw new FirestoreError(D.FAILED_PRECONDITION, Ve);
|
|
12181
12181
|
}));
|
|
12182
12182
|
}
|
|
12183
12183
|
/**
|
|
@@ -13676,7 +13676,7 @@ class __PRIVATE_BrowserConnectivityMonitor {
|
|
|
13676
13676
|
/**
|
|
13677
13677
|
* The value returned from the most recent invocation of
|
|
13678
13678
|
* `generateUniqueDebugId()`, or null if it has never been invoked.
|
|
13679
|
-
*/ let
|
|
13679
|
+
*/ let me = null;
|
|
13680
13680
|
|
|
13681
13681
|
/**
|
|
13682
13682
|
* Generates and returns an initial value for `lastUniqueDebugId`.
|
|
@@ -13701,9 +13701,9 @@ class __PRIVATE_BrowserConnectivityMonitor {
|
|
|
13701
13701
|
* @return the 10-character generated ID (e.g. "0xa1b2c3d4").
|
|
13702
13702
|
*/
|
|
13703
13703
|
function __PRIVATE_generateUniqueDebugId() {
|
|
13704
|
-
return null ===
|
|
13704
|
+
return null === me ? me = function __PRIVATE_generateInitialUniqueDebugId() {
|
|
13705
13705
|
return 268435456 + Math.round(2147483648 * Math.random());
|
|
13706
|
-
}() :
|
|
13706
|
+
}() : me++, "0x" + me.toString(16);
|
|
13707
13707
|
}
|
|
13708
13708
|
|
|
13709
13709
|
/**
|
|
@@ -13721,7 +13721,7 @@ function __PRIVATE_generateUniqueDebugId() {
|
|
|
13721
13721
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13722
13722
|
* See the License for the specific language governing permissions and
|
|
13723
13723
|
* limitations under the License.
|
|
13724
|
-
*/ const
|
|
13724
|
+
*/ const fe = {
|
|
13725
13725
|
BatchGetDocuments: "batchGet",
|
|
13726
13726
|
Commit: "commit",
|
|
13727
13727
|
RunQuery: "runQuery",
|
|
@@ -13805,7 +13805,7 @@ class __PRIVATE_StreamBridge {
|
|
|
13805
13805
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13806
13806
|
* See the License for the specific language governing permissions and
|
|
13807
13807
|
* limitations under the License.
|
|
13808
|
-
*/ const
|
|
13808
|
+
*/ const ge = "WebChannelConnection";
|
|
13809
13809
|
|
|
13810
13810
|
class __PRIVATE_WebChannelConnection extends
|
|
13811
13811
|
/**
|
|
@@ -13849,7 +13849,7 @@ class __PRIVATE_RestConnection {
|
|
|
13849
13849
|
// SDK_VERSION is updated to different value at runtime depending on the entry point,
|
|
13850
13850
|
// so we need to get its value when we need it in a function.
|
|
13851
13851
|
function __PRIVATE_getGoogApiClientValue() {
|
|
13852
|
-
return "gl-js/ fire/" +
|
|
13852
|
+
return "gl-js/ fire/" + S;
|
|
13853
13853
|
}(),
|
|
13854
13854
|
// Content-Type: text/plain will avoid preflight requests which might
|
|
13855
13855
|
// mess with CORS and redirects by proxies. If we add custom headers
|
|
@@ -13859,7 +13859,7 @@ class __PRIVATE_RestConnection {
|
|
|
13859
13859
|
t && t.headers.forEach(((t, n) => e[n] = t)), n && n.headers.forEach(((t, n) => e[n] = t));
|
|
13860
13860
|
}
|
|
13861
13861
|
xo(e, t) {
|
|
13862
|
-
const n =
|
|
13862
|
+
const n = fe[e];
|
|
13863
13863
|
return `${this.Do}/v1/${t}:${n}`;
|
|
13864
13864
|
}
|
|
13865
13865
|
/**
|
|
@@ -13883,17 +13883,17 @@ class __PRIVATE_RestConnection {
|
|
|
13883
13883
|
switch (_.getLastErrorCode()) {
|
|
13884
13884
|
case webchannelBlob.ErrorCode.NO_ERROR:
|
|
13885
13885
|
const t = _.getResponseJson();
|
|
13886
|
-
__PRIVATE_logDebug(
|
|
13886
|
+
__PRIVATE_logDebug(ge, `XHR for RPC '${e}' ${i} received:`, JSON.stringify(t)),
|
|
13887
13887
|
s(t);
|
|
13888
13888
|
break;
|
|
13889
13889
|
|
|
13890
13890
|
case webchannelBlob.ErrorCode.TIMEOUT:
|
|
13891
|
-
__PRIVATE_logDebug(
|
|
13891
|
+
__PRIVATE_logDebug(ge, `RPC '${e}' ${i} timed out`), o(new FirestoreError(D.DEADLINE_EXCEEDED, "Request time out"));
|
|
13892
13892
|
break;
|
|
13893
13893
|
|
|
13894
13894
|
case webchannelBlob.ErrorCode.HTTP_ERROR:
|
|
13895
13895
|
const n = _.getStatus();
|
|
13896
|
-
if (__PRIVATE_logDebug(
|
|
13896
|
+
if (__PRIVATE_logDebug(ge, `RPC '${e}' ${i} failed with status:`, n, "response text:", _.getResponseText()),
|
|
13897
13897
|
n > 0) {
|
|
13898
13898
|
let e = _.getResponseJson();
|
|
13899
13899
|
Array.isArray(e) && (e = e[0]);
|
|
@@ -13901,25 +13901,25 @@ class __PRIVATE_RestConnection {
|
|
|
13901
13901
|
if (t && t.status && t.message) {
|
|
13902
13902
|
const e = function __PRIVATE_mapCodeFromHttpResponseErrorStatus(e) {
|
|
13903
13903
|
const t = e.toLowerCase().replace(/_/g, "-");
|
|
13904
|
-
return Object.values(
|
|
13904
|
+
return Object.values(D).indexOf(t) >= 0 ? t : D.UNKNOWN;
|
|
13905
13905
|
}(t.status);
|
|
13906
13906
|
o(new FirestoreError(e, t.message));
|
|
13907
|
-
} else o(new FirestoreError(
|
|
13907
|
+
} else o(new FirestoreError(D.UNKNOWN, "Server responded with status " + _.getStatus()));
|
|
13908
13908
|
} else
|
|
13909
13909
|
// If we received an HTTP_ERROR but there's no status code,
|
|
13910
13910
|
// it's most probably a connection issue
|
|
13911
|
-
o(new FirestoreError(
|
|
13911
|
+
o(new FirestoreError(D.UNAVAILABLE, "Connection failed."));
|
|
13912
13912
|
break;
|
|
13913
13913
|
|
|
13914
13914
|
default:
|
|
13915
13915
|
fail();
|
|
13916
13916
|
}
|
|
13917
13917
|
} finally {
|
|
13918
|
-
__PRIVATE_logDebug(
|
|
13918
|
+
__PRIVATE_logDebug(ge, `RPC '${e}' ${i} completed.`);
|
|
13919
13919
|
}
|
|
13920
13920
|
}));
|
|
13921
13921
|
const a = JSON.stringify(r);
|
|
13922
|
-
__PRIVATE_logDebug(
|
|
13922
|
+
__PRIVATE_logDebug(ge, `RPC '${e}' ${i} sending request:`, r), _.send(t, "POST", a, n, 15);
|
|
13923
13923
|
}));
|
|
13924
13924
|
}
|
|
13925
13925
|
Bo(e, t, n) {
|
|
@@ -13947,7 +13947,7 @@ class __PRIVATE_RestConnection {
|
|
|
13947
13947
|
forceLongPolling: this.forceLongPolling,
|
|
13948
13948
|
detectBufferingProxy: this.autoDetectLongPolling
|
|
13949
13949
|
}, a = this.longPollingOptions.timeoutSeconds;
|
|
13950
|
-
void 0 !== a && (_.longPollingTimeout = Math.round(1e3 * a)), this.useFetchStreams && (_.
|
|
13950
|
+
void 0 !== a && (_.longPollingTimeout = Math.round(1e3 * a)), this.useFetchStreams && (_.useFetchStreams = !0),
|
|
13951
13951
|
this.Oo(_.initMessageHeaders, t, n),
|
|
13952
13952
|
// Sending the custom headers we just added to request.initMessageHeaders
|
|
13953
13953
|
// (Authorization, etc.) will trigger the browser to make a CORS preflight
|
|
@@ -13960,7 +13960,7 @@ class __PRIVATE_RestConnection {
|
|
|
13960
13960
|
// which is recognized by the webchannel backend.
|
|
13961
13961
|
_.encodeInitMessageHeaders = !0;
|
|
13962
13962
|
const u = i.join("");
|
|
13963
|
-
__PRIVATE_logDebug(
|
|
13963
|
+
__PRIVATE_logDebug(ge, `Creating RPC '${e}' stream ${r}: ${u}`, _);
|
|
13964
13964
|
const c = s.createWebChannel(u, _);
|
|
13965
13965
|
// WebChannel supports sending the first message with the handshake - saving
|
|
13966
13966
|
// a network round trip. However, it will have to call send in the same
|
|
@@ -13973,8 +13973,8 @@ class __PRIVATE_RestConnection {
|
|
|
13973
13973
|
// on a closed stream
|
|
13974
13974
|
const P = new __PRIVATE_StreamBridge({
|
|
13975
13975
|
Io: t => {
|
|
13976
|
-
h ? __PRIVATE_logDebug(
|
|
13977
|
-
c.open(), l = !0), __PRIVATE_logDebug(
|
|
13976
|
+
h ? __PRIVATE_logDebug(ge, `Not sending because RPC '${e}' stream ${r} is closed:`, t) : (l || (__PRIVATE_logDebug(ge, `Opening RPC '${e}' stream ${r} transport.`),
|
|
13977
|
+
c.open(), l = !0), __PRIVATE_logDebug(ge, `RPC '${e}' stream ${r} sending:`, t),
|
|
13978
13978
|
c.send(t));
|
|
13979
13979
|
},
|
|
13980
13980
|
To: () => c.close()
|
|
@@ -13996,13 +13996,13 @@ class __PRIVATE_RestConnection {
|
|
|
13996
13996
|
// Note that eventually this function could go away if we are confident
|
|
13997
13997
|
// enough the code is exception free.
|
|
13998
13998
|
return __PRIVATE_unguardedEventListen(c, webchannelBlob.WebChannel.EventType.OPEN, (() => {
|
|
13999
|
-
h || (__PRIVATE_logDebug(
|
|
13999
|
+
h || (__PRIVATE_logDebug(ge, `RPC '${e}' stream ${r} transport opened.`), P.yo());
|
|
14000
14000
|
})), __PRIVATE_unguardedEventListen(c, webchannelBlob.WebChannel.EventType.CLOSE, (() => {
|
|
14001
|
-
h || (h = !0, __PRIVATE_logDebug(
|
|
14001
|
+
h || (h = !0, __PRIVATE_logDebug(ge, `RPC '${e}' stream ${r} transport closed`),
|
|
14002
14002
|
P.So());
|
|
14003
14003
|
})), __PRIVATE_unguardedEventListen(c, webchannelBlob.WebChannel.EventType.ERROR, (t => {
|
|
14004
|
-
h || (h = !0, __PRIVATE_logWarn(
|
|
14005
|
-
P.So(new FirestoreError(
|
|
14004
|
+
h || (h = !0, __PRIVATE_logWarn(ge, `RPC '${e}' stream ${r} transport errored:`, t),
|
|
14005
|
+
P.So(new FirestoreError(D.UNAVAILABLE, "The operation could not be completed")));
|
|
14006
14006
|
})), __PRIVATE_unguardedEventListen(c, webchannelBlob.WebChannel.EventType.MESSAGE, (t => {
|
|
14007
14007
|
var n;
|
|
14008
14008
|
if (!h) {
|
|
@@ -14015,7 +14015,7 @@ class __PRIVATE_RestConnection {
|
|
|
14015
14015
|
// Use any because msgData.error is not typed.
|
|
14016
14016
|
const s = i, o = s.error || (null === (n = s[0]) || void 0 === n ? void 0 : n.error);
|
|
14017
14017
|
if (o) {
|
|
14018
|
-
__PRIVATE_logDebug(
|
|
14018
|
+
__PRIVATE_logDebug(ge, `RPC '${e}' stream ${r} received error:`, o);
|
|
14019
14019
|
// error.status will be a string like 'OK' or 'NOT_FOUND'.
|
|
14020
14020
|
const t = o.status;
|
|
14021
14021
|
let n =
|
|
@@ -14028,16 +14028,16 @@ class __PRIVATE_RestConnection {
|
|
|
14028
14028
|
function __PRIVATE_mapCodeFromRpcStatus(e) {
|
|
14029
14029
|
// lookup by string
|
|
14030
14030
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14031
|
-
const t =
|
|
14031
|
+
const t = le[e];
|
|
14032
14032
|
if (void 0 !== t) return __PRIVATE_mapCodeFromRpcCode(t);
|
|
14033
14033
|
}(t), i = o.message;
|
|
14034
|
-
void 0 === n && (n =
|
|
14034
|
+
void 0 === n && (n = D.INTERNAL, i = "Unknown error status: " + t + " with message " + o.message),
|
|
14035
14035
|
// Mark closed so no further events are propagated
|
|
14036
14036
|
h = !0, P.So(new FirestoreError(n, i)), c.close();
|
|
14037
|
-
} else __PRIVATE_logDebug(
|
|
14037
|
+
} else __PRIVATE_logDebug(ge, `RPC '${e}' stream ${r} received:`, i), P.bo(i);
|
|
14038
14038
|
}
|
|
14039
14039
|
})), __PRIVATE_unguardedEventListen(o, webchannelBlob.Event.STAT_EVENT, (t => {
|
|
14040
|
-
t.stat === webchannelBlob.Stat.PROXY ? __PRIVATE_logDebug(
|
|
14040
|
+
t.stat === webchannelBlob.Stat.PROXY ? __PRIVATE_logDebug(ge, `RPC '${e}' stream ${r} detected buffering proxy`) : t.stat === webchannelBlob.Stat.NOPROXY && __PRIVATE_logDebug(ge, `RPC '${e}' stream ${r} detected no buffering proxy`);
|
|
14041
14041
|
})), setTimeout((() => {
|
|
14042
14042
|
// Technically we could/should wait for the WebChannel opened event,
|
|
14043
14043
|
// but because we want to send the first message with the WebChannel
|
|
@@ -14365,10 +14365,10 @@ class __PRIVATE_PersistentStream {
|
|
|
14365
14365
|
// underlying stream), guaranteeing they won't execute.
|
|
14366
14366
|
this.Yo++, 4 /* PersistentStreamState.Error */ !== e ?
|
|
14367
14367
|
// If this is an intentional close ensure we don't delay our next connection attempt.
|
|
14368
|
-
this.t_.reset() : t && t.code ===
|
|
14368
|
+
this.t_.reset() : t && t.code === D.RESOURCE_EXHAUSTED ? (
|
|
14369
14369
|
// Log the error. (Probably either 'quota exceeded' or 'max queue length reached'.)
|
|
14370
14370
|
__PRIVATE_logError(t.toString()), __PRIVATE_logError("Using maximum backoff delay to prevent overloading the backend."),
|
|
14371
|
-
this.t_.Wo()) : t && t.code ===
|
|
14371
|
+
this.t_.Wo()) : t && t.code === D.UNAUTHENTICATED && 3 /* PersistentStreamState.Healthy */ !== this.state && (
|
|
14372
14372
|
// "unauthenticated" error means the token was rejected. This should rarely
|
|
14373
14373
|
// happen since both Auth and AppCheck ensure a sufficient TTL when we
|
|
14374
14374
|
// request a token. If a user manually resets their system clock this can
|
|
@@ -14404,7 +14404,7 @@ class __PRIVATE_PersistentStream {
|
|
|
14404
14404
|
this.P_(e, n);
|
|
14405
14405
|
}), (t => {
|
|
14406
14406
|
e((() => {
|
|
14407
|
-
const e = new FirestoreError(
|
|
14407
|
+
const e = new FirestoreError(D.UNKNOWN, "Fetching auth token failed: " + t.message);
|
|
14408
14408
|
return this.I_(e);
|
|
14409
14409
|
}));
|
|
14410
14410
|
}));
|
|
@@ -14623,18 +14623,18 @@ class __PRIVATE_DatastoreImpl extends class Datastore {} {
|
|
|
14623
14623
|
this.serializer = r, this.y_ = !1;
|
|
14624
14624
|
}
|
|
14625
14625
|
w_() {
|
|
14626
|
-
if (this.y_) throw new FirestoreError(
|
|
14626
|
+
if (this.y_) throw new FirestoreError(D.FAILED_PRECONDITION, "The client has already been terminated.");
|
|
14627
14627
|
}
|
|
14628
14628
|
/** Invokes the provided RPC with auth and AppCheck tokens. */ Mo(e, t, n, r) {
|
|
14629
14629
|
return this.w_(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([i, s]) => this.connection.Mo(e, __PRIVATE_toResourcePath(t, n), r, i, s))).catch((e => {
|
|
14630
|
-
throw "FirebaseError" === e.name ? (e.code ===
|
|
14631
|
-
this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(
|
|
14630
|
+
throw "FirebaseError" === e.name ? (e.code === D.UNAUTHENTICATED && (this.authCredentials.invalidateToken(),
|
|
14631
|
+
this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(D.UNKNOWN, e.toString());
|
|
14632
14632
|
}));
|
|
14633
14633
|
}
|
|
14634
14634
|
/** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ Lo(e, t, n, r, i) {
|
|
14635
14635
|
return this.w_(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([s, o]) => this.connection.Lo(e, __PRIVATE_toResourcePath(t, n), r, s, o, i))).catch((e => {
|
|
14636
|
-
throw "FirebaseError" === e.name ? (e.code ===
|
|
14637
|
-
this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(
|
|
14636
|
+
throw "FirebaseError" === e.name ? (e.code === D.UNAUTHENTICATED && (this.authCredentials.invalidateToken(),
|
|
14637
|
+
this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(D.UNKNOWN, e.toString());
|
|
14638
14638
|
}));
|
|
14639
14639
|
}
|
|
14640
14640
|
terminate() {
|
|
@@ -15078,7 +15078,7 @@ async function __PRIVATE_onWriteStreamClose(e, t) {
|
|
|
15078
15078
|
// Only handle permanent errors here. If it's transient, just let the retry
|
|
15079
15079
|
// logic kick in.
|
|
15080
15080
|
if (function __PRIVATE_isPermanentWriteError(e) {
|
|
15081
|
-
return __PRIVATE_isPermanentError(e) && e !==
|
|
15081
|
+
return __PRIVATE_isPermanentError(e) && e !== D.ABORTED;
|
|
15082
15082
|
}(t.code)) {
|
|
15083
15083
|
// This was a permanent error, the request itself was the problem
|
|
15084
15084
|
// so it's not going to succeed if we resend it.
|
|
@@ -15261,7 +15261,7 @@ class DelayedOperation {
|
|
|
15261
15261
|
* As long as the operation has not yet been run, calling cancel() provides a
|
|
15262
15262
|
* guarantee that the operation will not be run.
|
|
15263
15263
|
*/ cancel(e) {
|
|
15264
|
-
null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new FirestoreError(
|
|
15264
|
+
null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new FirestoreError(D.CANCELLED, "Operation cancelled" + (e ? ": " + e : ""))));
|
|
15265
15265
|
}
|
|
15266
15266
|
handleDelayElapsed() {
|
|
15267
15267
|
this.asyncQueue.enqueueAndForget((() => null !== this.timerHandle ? (this.clearTimeout(),
|
|
@@ -15277,7 +15277,7 @@ class DelayedOperation {
|
|
|
15277
15277
|
* Returns a FirestoreError that can be surfaced to the user if the provided
|
|
15278
15278
|
* error is an IndexedDbTransactionError. Re-throws the error otherwise.
|
|
15279
15279
|
*/ function __PRIVATE_wrapInUserErrorIfRecoverable(e, t) {
|
|
15280
|
-
if (__PRIVATE_logError("AsyncQueue", `${t}: ${e}`), __PRIVATE_isIndexedDbTransactionError(e)) return new FirestoreError(
|
|
15280
|
+
if (__PRIVATE_logError("AsyncQueue", `${t}: ${e}`), __PRIVATE_isIndexedDbTransactionError(e)) return new FirestoreError(D.UNAVAILABLE, `${t}: ${e}`);
|
|
15281
15281
|
throw e;
|
|
15282
15282
|
}
|
|
15283
15283
|
|
|
@@ -15507,7 +15507,7 @@ class __PRIVATE_EventManagerImpl {
|
|
|
15507
15507
|
}));
|
|
15508
15508
|
}
|
|
15509
15509
|
// Call all global snapshot listeners that have been set.
|
|
15510
|
-
(this, new FirestoreError(
|
|
15510
|
+
(this, new FirestoreError(D.ABORTED, "Firestore shutting down"));
|
|
15511
15511
|
}
|
|
15512
15512
|
}
|
|
15513
15513
|
|
|
@@ -15604,12 +15604,12 @@ function __PRIVATE_raiseSnapshotsInSyncEvent(e) {
|
|
|
15604
15604
|
}));
|
|
15605
15605
|
}
|
|
15606
15606
|
|
|
15607
|
-
var
|
|
15607
|
+
var pe, ye;
|
|
15608
15608
|
|
|
15609
15609
|
/** Listen to both cache and server changes */
|
|
15610
|
-
(
|
|
15610
|
+
(ye = pe || (pe = {})).ea = "default",
|
|
15611
15611
|
/** Listen to changes in cache only */
|
|
15612
|
-
|
|
15612
|
+
ye.Cache = "cache";
|
|
15613
15613
|
|
|
15614
15614
|
/**
|
|
15615
15615
|
* QueryListener takes a series of internal view snapshots and determines
|
|
@@ -15684,7 +15684,7 @@ class __PRIVATE_QueryListener {
|
|
|
15684
15684
|
this.na = !0, this.ta.next(e);
|
|
15685
15685
|
}
|
|
15686
15686
|
J_() {
|
|
15687
|
-
return this.options.source !==
|
|
15687
|
+
return this.options.source !== pe.Cache;
|
|
15688
15688
|
}
|
|
15689
15689
|
}
|
|
15690
15690
|
|
|
@@ -16652,7 +16652,7 @@ async function __PRIVATE_syncEngineHandleCredentialChange(e, t) {
|
|
|
16652
16652
|
function __PRIVATE_rejectOutstandingPendingWritesCallbacks(e, t) {
|
|
16653
16653
|
e.ka.forEach((e => {
|
|
16654
16654
|
e.forEach((e => {
|
|
16655
|
-
e.reject(new FirestoreError(
|
|
16655
|
+
e.reject(new FirestoreError(D.CANCELLED, t));
|
|
16656
16656
|
}));
|
|
16657
16657
|
})), e.ka.clear();
|
|
16658
16658
|
}(n, "'waitForPendingWrites' promise is rejected due to a user change."),
|
|
@@ -17081,7 +17081,7 @@ class __PRIVATE_LruGcMemoryOfflineComponentProvider extends MemoryOfflineCompone
|
|
|
17081
17081
|
}
|
|
17082
17082
|
createSharedClientState(e) {
|
|
17083
17083
|
const t = __PRIVATE_getWindow();
|
|
17084
|
-
if (!__PRIVATE_WebStorageSharedClientState.D(t)) throw new FirestoreError(
|
|
17084
|
+
if (!__PRIVATE_WebStorageSharedClientState.D(t)) throw new FirestoreError(D.UNIMPLEMENTED, "IndexedDB persistence is only available on platforms that support LocalStorage.");
|
|
17085
17085
|
const n = __PRIVATE_indexedDbStoragePrefix(e.databaseInfo.databaseId, e.databaseInfo.persistenceKey);
|
|
17086
17086
|
return new __PRIVATE_WebStorageSharedClientState(t, e.asyncQueue, n, e.clientId, e.initialUser);
|
|
17087
17087
|
}
|
|
@@ -17420,7 +17420,7 @@ class Transaction$2 {
|
|
|
17420
17420
|
this.writtenDocs = new Set;
|
|
17421
17421
|
}
|
|
17422
17422
|
async lookup(e) {
|
|
17423
|
-
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw this.lastTransactionError = new FirestoreError(
|
|
17423
|
+
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw this.lastTransactionError = new FirestoreError(D.INVALID_ARGUMENT, "Firestore transactions require all reads to be executed before all writes."),
|
|
17424
17424
|
this.lastTransactionError;
|
|
17425
17425
|
const t = await async function __PRIVATE_invokeBatchGetDocumentsRpc(e, t) {
|
|
17426
17426
|
const n = __PRIVATE_debugCast(e), r = {
|
|
@@ -17482,7 +17482,7 @@ class Transaction$2 {
|
|
|
17482
17482
|
if (n) {
|
|
17483
17483
|
if (!t.isEqual(n))
|
|
17484
17484
|
// This transaction will fail no matter what.
|
|
17485
|
-
throw new FirestoreError(
|
|
17485
|
+
throw new FirestoreError(D.ABORTED, "Document version changed between two reads.");
|
|
17486
17486
|
} else this.readVersions.set(e.key.toString(), t);
|
|
17487
17487
|
}
|
|
17488
17488
|
/**
|
|
@@ -17509,7 +17509,7 @@ class Transaction$2 {
|
|
|
17509
17509
|
// express that to the backend, we have to validate locally.
|
|
17510
17510
|
// Note: this can change once we can send separate verify writes in the
|
|
17511
17511
|
// transaction.
|
|
17512
|
-
throw new FirestoreError(
|
|
17512
|
+
throw new FirestoreError(D.INVALID_ARGUMENT, "Can't update a document that doesn't exist.");
|
|
17513
17513
|
// Document exists, base precondition on document update time.
|
|
17514
17514
|
return Precondition.updateTime(t);
|
|
17515
17515
|
}
|
|
@@ -17650,7 +17650,7 @@ class FirestoreClient {
|
|
|
17650
17650
|
* Checks that the client has not been terminated. Ensures that other methods on //
|
|
17651
17651
|
* this class cannot be called after the client is terminated. //
|
|
17652
17652
|
*/ verifyNotTerminated() {
|
|
17653
|
-
if (this.asyncQueue.isShuttingDown) throw new FirestoreError(
|
|
17653
|
+
if (this.asyncQueue.isShuttingDown) throw new FirestoreError(D.FAILED_PRECONDITION, "The client has already been terminated.");
|
|
17654
17654
|
}
|
|
17655
17655
|
terminate() {
|
|
17656
17656
|
this.asyncQueue.enterRestrictedMode();
|
|
@@ -17698,7 +17698,7 @@ async function __PRIVATE_setOnlineComponentProvider(e, t) {
|
|
|
17698
17698
|
* Decides whether the provided error allows us to gracefully disable
|
|
17699
17699
|
* persistence (as opposed to crashing the client).
|
|
17700
17700
|
*/ function __PRIVATE_canFallbackFromIndexedDbError(e) {
|
|
17701
|
-
return "FirebaseError" === e.name ? e.code ===
|
|
17701
|
+
return "FirebaseError" === e.name ? e.code === D.FAILED_PRECONDITION || e.code === D.UNIMPLEMENTED : !("undefined" != typeof DOMException && e instanceof DOMException) || (
|
|
17702
17702
|
// When the browser is out of quota we could get either quota exceeded
|
|
17703
17703
|
// or an aborted error depending on whether the error happened during
|
|
17704
17704
|
// schema migration.
|
|
@@ -17792,7 +17792,7 @@ async function __PRIVATE_getEventManager(e) {
|
|
|
17792
17792
|
const n = __PRIVATE_debugCast(e);
|
|
17793
17793
|
return n.persistence.runTransaction("read document", "readonly", (e => n.localDocuments.getDocument(e, t)));
|
|
17794
17794
|
}(e, t);
|
|
17795
|
-
r.isFoundDocument() ? n.resolve(r) : r.isNoDocument() ? n.resolve(null) : n.reject(new FirestoreError(
|
|
17795
|
+
r.isFoundDocument() ? n.resolve(r) : r.isNoDocument() ? n.resolve(null) : n.reject(new FirestoreError(D.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.)"));
|
|
17796
17796
|
} catch (e) {
|
|
17797
17797
|
const r = __PRIVATE_wrapInUserErrorIfRecoverable(e, `Failed to get document '${t} from cache`);
|
|
17798
17798
|
n.reject(r);
|
|
@@ -17821,7 +17821,7 @@ function __PRIVATE_firestoreClientGetDocumentViaSnapshotListener(e, t, n = {}) {
|
|
|
17821
17821
|
// the server so we can deliver that even when you're
|
|
17822
17822
|
// offline 2) Actually reject the Promise in the online case
|
|
17823
17823
|
// if the document doesn't exist.
|
|
17824
|
-
i.reject(new FirestoreError(
|
|
17824
|
+
i.reject(new FirestoreError(D.UNAVAILABLE, "Failed to get document because the client is offline.")) : _ && s.fromCache && r && "server" === r.source ? i.reject(new FirestoreError(D.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);
|
|
17825
17825
|
},
|
|
17826
17826
|
error: e => i.reject(e)
|
|
17827
17827
|
}), o = new __PRIVATE_QueryListener(__PRIVATE_newQueryForPath(n.path), s, {
|
|
@@ -17858,7 +17858,7 @@ function __PRIVATE_firestoreClientGetDocumentsViaSnapshotListener(e, t, n = {})
|
|
|
17858
17858
|
next: n => {
|
|
17859
17859
|
// Remove query first before passing event to user to avoid
|
|
17860
17860
|
// user actions affecting the now stale query.
|
|
17861
|
-
t.enqueueAndForget((() => __PRIVATE_eventManagerUnlisten(e, o))), n.fromCache && "server" === r.source ? i.reject(new FirestoreError(
|
|
17861
|
+
t.enqueueAndForget((() => __PRIVATE_eventManagerUnlisten(e, o))), n.fromCache && "server" === r.source ? i.reject(new FirestoreError(D.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);
|
|
17862
17862
|
},
|
|
17863
17863
|
error: e => i.reject(e)
|
|
17864
17864
|
}), o = new __PRIVATE_QueryListener(n, s, {
|
|
@@ -18096,7 +18096,7 @@ function __PRIVATE_cloneLongPollingOptions(e) {
|
|
|
18096
18096
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18097
18097
|
* See the License for the specific language governing permissions and
|
|
18098
18098
|
* limitations under the License.
|
|
18099
|
-
*/ const
|
|
18099
|
+
*/ const we = new Map;
|
|
18100
18100
|
|
|
18101
18101
|
/**
|
|
18102
18102
|
* An instance map that ensures only one Datastore exists per Firestore
|
|
@@ -18119,28 +18119,28 @@ function __PRIVATE_cloneLongPollingOptions(e) {
|
|
|
18119
18119
|
* limitations under the License.
|
|
18120
18120
|
*/
|
|
18121
18121
|
function __PRIVATE_validateNonEmptyArgument(e, t, n) {
|
|
18122
|
-
if (!n) throw new FirestoreError(
|
|
18122
|
+
if (!n) throw new FirestoreError(D.INVALID_ARGUMENT, `Function ${e}() cannot be called with an empty ${t}.`);
|
|
18123
18123
|
}
|
|
18124
18124
|
|
|
18125
18125
|
/**
|
|
18126
18126
|
* Validates that two boolean options are not set at the same time.
|
|
18127
18127
|
* @internal
|
|
18128
18128
|
*/ function __PRIVATE_validateIsNotUsedTogether(e, t, n, r) {
|
|
18129
|
-
if (!0 === t && !0 === r) throw new FirestoreError(
|
|
18129
|
+
if (!0 === t && !0 === r) throw new FirestoreError(D.INVALID_ARGUMENT, `${e} and ${n} cannot be used together.`);
|
|
18130
18130
|
}
|
|
18131
18131
|
|
|
18132
18132
|
/**
|
|
18133
18133
|
* Validates that `path` refers to a document (indicated by the fact it contains
|
|
18134
18134
|
* an even numbers of segments).
|
|
18135
18135
|
*/ function __PRIVATE_validateDocumentPath(e) {
|
|
18136
|
-
if (!DocumentKey.isDocumentKey(e)) throw new FirestoreError(
|
|
18136
|
+
if (!DocumentKey.isDocumentKey(e)) throw new FirestoreError(D.INVALID_ARGUMENT, `Invalid document reference. Document references must have an even number of segments, but ${e} has ${e.length}.`);
|
|
18137
18137
|
}
|
|
18138
18138
|
|
|
18139
18139
|
/**
|
|
18140
18140
|
* Validates that `path` refers to a collection (indicated by the fact it
|
|
18141
18141
|
* contains an odd numbers of segments).
|
|
18142
18142
|
*/ function __PRIVATE_validateCollectionPath(e) {
|
|
18143
|
-
if (DocumentKey.isDocumentKey(e)) throw new FirestoreError(
|
|
18143
|
+
if (DocumentKey.isDocumentKey(e)) throw new FirestoreError(D.INVALID_ARGUMENT, `Invalid collection reference. Collection references must have an odd number of segments, but ${e} has ${e.length}.`);
|
|
18144
18144
|
}
|
|
18145
18145
|
|
|
18146
18146
|
/**
|
|
@@ -18184,17 +18184,17 @@ t) {
|
|
|
18184
18184
|
// Unwrap Compat types
|
|
18185
18185
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18186
18186
|
e = e._delegate), !(e instanceof t)) {
|
|
18187
|
-
if (t.name === e.constructor.name) throw new FirestoreError(
|
|
18187
|
+
if (t.name === e.constructor.name) throw new FirestoreError(D.INVALID_ARGUMENT, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
|
|
18188
18188
|
{
|
|
18189
18189
|
const n = __PRIVATE_valueDescription(e);
|
|
18190
|
-
throw new FirestoreError(
|
|
18190
|
+
throw new FirestoreError(D.INVALID_ARGUMENT, `Expected type '${t.name}', but it was: ${n}`);
|
|
18191
18191
|
}
|
|
18192
18192
|
}
|
|
18193
18193
|
return e;
|
|
18194
18194
|
}
|
|
18195
18195
|
|
|
18196
18196
|
function __PRIVATE_validatePositiveNumber(e, t) {
|
|
18197
|
-
if (t <= 0) throw new FirestoreError(
|
|
18197
|
+
if (t <= 0) throw new FirestoreError(D.INVALID_ARGUMENT, `Function ${e}() requires a positive number, but it was: ${t}.`);
|
|
18198
18198
|
}
|
|
18199
18199
|
|
|
18200
18200
|
/**
|
|
@@ -18223,12 +18223,12 @@ class FirestoreSettingsImpl {
|
|
|
18223
18223
|
constructor(e) {
|
|
18224
18224
|
var t, n;
|
|
18225
18225
|
if (void 0 === e.host) {
|
|
18226
|
-
if (void 0 !== e.ssl) throw new FirestoreError(
|
|
18226
|
+
if (void 0 !== e.ssl) throw new FirestoreError(D.INVALID_ARGUMENT, "Can't provide ssl option if host option is not set");
|
|
18227
18227
|
this.host = "firestore.googleapis.com", this.ssl = true;
|
|
18228
18228
|
} else this.host = e.host, this.ssl = null === (t = e.ssl) || void 0 === t || t;
|
|
18229
18229
|
if (this.credentials = e.credentials, this.ignoreUndefinedProperties = !!e.ignoreUndefinedProperties,
|
|
18230
18230
|
this.localCache = e.localCache, void 0 === e.cacheSizeBytes) this.cacheSizeBytes = 41943040; else {
|
|
18231
|
-
if (-1 !== e.cacheSizeBytes && e.cacheSizeBytes < 1048576) throw new FirestoreError(
|
|
18231
|
+
if (-1 !== e.cacheSizeBytes && e.cacheSizeBytes < 1048576) throw new FirestoreError(D.INVALID_ARGUMENT, "cacheSizeBytes must be at least 1048576");
|
|
18232
18232
|
this.cacheSizeBytes = e.cacheSizeBytes;
|
|
18233
18233
|
}
|
|
18234
18234
|
__PRIVATE_validateIsNotUsedTogether("experimentalForceLongPolling", e.experimentalForceLongPolling, "experimentalAutoDetectLongPolling", e.experimentalAutoDetectLongPolling),
|
|
@@ -18240,9 +18240,9 @@ class FirestoreSettingsImpl {
|
|
|
18240
18240
|
this.experimentalLongPollingOptions = __PRIVATE_cloneLongPollingOptions(null !== (n = e.experimentalLongPollingOptions) && void 0 !== n ? n : {}),
|
|
18241
18241
|
function __PRIVATE_validateLongPollingOptions(e) {
|
|
18242
18242
|
if (void 0 !== e.timeoutSeconds) {
|
|
18243
|
-
if (isNaN(e.timeoutSeconds)) throw new FirestoreError(
|
|
18244
|
-
if (e.timeoutSeconds < 5) throw new FirestoreError(
|
|
18245
|
-
if (e.timeoutSeconds > 30) throw new FirestoreError(
|
|
18243
|
+
if (isNaN(e.timeoutSeconds)) throw new FirestoreError(D.INVALID_ARGUMENT, `invalid long polling timeout: ${e.timeoutSeconds} (must not be NaN)`);
|
|
18244
|
+
if (e.timeoutSeconds < 5) throw new FirestoreError(D.INVALID_ARGUMENT, `invalid long polling timeout: ${e.timeoutSeconds} (minimum allowed value is 5)`);
|
|
18245
|
+
if (e.timeoutSeconds > 30) throw new FirestoreError(D.INVALID_ARGUMENT, `invalid long polling timeout: ${e.timeoutSeconds} (maximum allowed value is 30)`);
|
|
18246
18246
|
}
|
|
18247
18247
|
}
|
|
18248
18248
|
/**
|
|
@@ -18289,7 +18289,7 @@ class Firestore$1 {
|
|
|
18289
18289
|
* The {@link @firebase/app#FirebaseApp} associated with this `Firestore` service
|
|
18290
18290
|
* instance.
|
|
18291
18291
|
*/ get app() {
|
|
18292
|
-
if (!this._app) throw new FirestoreError(
|
|
18292
|
+
if (!this._app) throw new FirestoreError(D.FAILED_PRECONDITION, "Firestore was not initialized using the Firebase SDK. 'app' is not available");
|
|
18293
18293
|
return this._app;
|
|
18294
18294
|
}
|
|
18295
18295
|
get _initialized() {
|
|
@@ -18299,7 +18299,7 @@ class Firestore$1 {
|
|
|
18299
18299
|
return void 0 !== this._terminateTask;
|
|
18300
18300
|
}
|
|
18301
18301
|
_setSettings(e) {
|
|
18302
|
-
if (this._settingsFrozen) throw new FirestoreError(
|
|
18302
|
+
if (this._settingsFrozen) throw new FirestoreError(D.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.");
|
|
18303
18303
|
this._settings = new FirestoreSettingsImpl(e), void 0 !== e.credentials && (this._authCredentials = function __PRIVATE_makeAuthCredentialsProvider(e) {
|
|
18304
18304
|
if (!e) return new __PRIVATE_EmptyAuthCredentialsProvider;
|
|
18305
18305
|
switch (e.type) {
|
|
@@ -18310,7 +18310,7 @@ class Firestore$1 {
|
|
|
18310
18310
|
return e.client;
|
|
18311
18311
|
|
|
18312
18312
|
default:
|
|
18313
|
-
throw new FirestoreError(
|
|
18313
|
+
throw new FirestoreError(D.INVALID_ARGUMENT, "makeAuthCredentialsProvider failed due to invalid credential type");
|
|
18314
18314
|
}
|
|
18315
18315
|
}(e.credentials));
|
|
18316
18316
|
}
|
|
@@ -18342,8 +18342,8 @@ class Firestore$1 {
|
|
|
18342
18342
|
* when the `Firestore` instance is terminated.
|
|
18343
18343
|
*/
|
|
18344
18344
|
return function __PRIVATE_removeComponents(e) {
|
|
18345
|
-
const t =
|
|
18346
|
-
t && (__PRIVATE_logDebug("ComponentProvider", "Removing Datastore"),
|
|
18345
|
+
const t = we.get(e);
|
|
18346
|
+
t && (__PRIVATE_logDebug("ComponentProvider", "Removing Datastore"), we.delete(e),
|
|
18347
18347
|
t.terminate());
|
|
18348
18348
|
}(this), Promise.resolve();
|
|
18349
18349
|
}
|
|
@@ -18375,7 +18375,7 @@ class Firestore$1 {
|
|
|
18375
18375
|
// invalid field "uid" and missing field "sub" / "user_id".)
|
|
18376
18376
|
t = util.createMockUserToken(r.mockUserToken, null === (i = e._app) || void 0 === i ? void 0 : i.options.projectId);
|
|
18377
18377
|
const s = r.mockUserToken.sub || r.mockUserToken.user_id;
|
|
18378
|
-
if (!s) throw new FirestoreError(
|
|
18378
|
+
if (!s) throw new FirestoreError(D.INVALID_ARGUMENT, "mockUserToken must contain 'sub' or 'user_id' field!");
|
|
18379
18379
|
n = new User(s);
|
|
18380
18380
|
}
|
|
18381
18381
|
e._authCredentials = new __PRIVATE_EmulatorAuthCredentialsProvider(new __PRIVATE_OAuthToken(t, n));
|
|
@@ -18495,7 +18495,7 @@ function collection(e, t, ...n) {
|
|
|
18495
18495
|
return __PRIVATE_validateCollectionPath(r), new CollectionReference(e, /* converter= */ null, r);
|
|
18496
18496
|
}
|
|
18497
18497
|
{
|
|
18498
|
-
if (!(e instanceof DocumentReference || e instanceof CollectionReference)) throw new FirestoreError(
|
|
18498
|
+
if (!(e instanceof DocumentReference || e instanceof CollectionReference)) throw new FirestoreError(D.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
18499
18499
|
const r = e._path.child(ResourcePath.fromString(t, ...n));
|
|
18500
18500
|
return __PRIVATE_validateCollectionPath(r), new CollectionReference(e.firestore,
|
|
18501
18501
|
/* converter= */ null, r);
|
|
@@ -18516,7 +18516,7 @@ function collection(e, t, ...n) {
|
|
|
18516
18516
|
* @returns The created `Query`.
|
|
18517
18517
|
*/ function collectionGroup(e, t) {
|
|
18518
18518
|
if (e = __PRIVATE_cast(e, Firestore$1), __PRIVATE_validateNonEmptyArgument("collectionGroup", "collection id", t),
|
|
18519
|
-
t.indexOf("/") >= 0) throw new FirestoreError(
|
|
18519
|
+
t.indexOf("/") >= 0) throw new FirestoreError(D.INVALID_ARGUMENT, `Invalid collection ID '${t}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
|
|
18520
18520
|
return new Query(e,
|
|
18521
18521
|
/* converter= */ null, function __PRIVATE_newQueryForCollectionGroup(e) {
|
|
18522
18522
|
return new __PRIVATE_QueryImpl(ResourcePath.emptyPath(), e);
|
|
@@ -18534,7 +18534,7 @@ function doc(e, t, ...n) {
|
|
|
18534
18534
|
/* converter= */ null, new DocumentKey(r));
|
|
18535
18535
|
}
|
|
18536
18536
|
{
|
|
18537
|
-
if (!(e instanceof DocumentReference || e instanceof CollectionReference)) throw new FirestoreError(
|
|
18537
|
+
if (!(e instanceof DocumentReference || e instanceof CollectionReference)) throw new FirestoreError(D.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
18538
18538
|
const r = e._path.child(ResourcePath.fromString(t, ...n));
|
|
18539
18539
|
return __PRIVATE_validateDocumentPath(r), new DocumentReference(e.firestore, e instanceof CollectionReference ? e.converter : null, new DocumentKey(r));
|
|
18540
18540
|
}
|
|
@@ -18895,7 +18895,7 @@ class LoadBundleTask {
|
|
|
18895
18895
|
* Constant used to indicate the LRU garbage collection should be disabled.
|
|
18896
18896
|
* Set this value as the `cacheSizeBytes` on the settings passed to the
|
|
18897
18897
|
* {@link Firestore} instance.
|
|
18898
|
-
*/ const
|
|
18898
|
+
*/ const Se = -1;
|
|
18899
18899
|
|
|
18900
18900
|
/**
|
|
18901
18901
|
* The Cloud Firestore service interface.
|
|
@@ -18939,10 +18939,10 @@ class LoadBundleTask {
|
|
|
18939
18939
|
identifier: n
|
|
18940
18940
|
}), i = r.getOptions(n);
|
|
18941
18941
|
if (util.deepEqual(i, t)) return e;
|
|
18942
|
-
throw new FirestoreError(
|
|
18942
|
+
throw new FirestoreError(D.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.");
|
|
18943
18943
|
}
|
|
18944
|
-
if (void 0 !== t.cacheSizeBytes && void 0 !== t.localCache) throw new FirestoreError(
|
|
18945
|
-
if (void 0 !== t.cacheSizeBytes && -1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new FirestoreError(
|
|
18944
|
+
if (void 0 !== t.cacheSizeBytes && void 0 !== t.localCache) throw new FirestoreError(D.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");
|
|
18945
|
+
if (void 0 !== t.cacheSizeBytes && -1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new FirestoreError(D.INVALID_ARGUMENT, "cacheSizeBytes must be at least 1048576");
|
|
18946
18946
|
return r.initialize({
|
|
18947
18947
|
options: t,
|
|
18948
18948
|
instanceIdentifier: n
|
|
@@ -19011,7 +19011,7 @@ function __PRIVATE_configureFirestore(e) {
|
|
|
19011
19011
|
*/ function enableIndexedDbPersistence(e, t) {
|
|
19012
19012
|
__PRIVATE_verifyNotInitialized(e = __PRIVATE_cast(e, Firestore));
|
|
19013
19013
|
const n = ensureFirestoreConfigured(e);
|
|
19014
|
-
if (n._uninitializedComponentsProvider) throw new FirestoreError(
|
|
19014
|
+
if (n._uninitializedComponentsProvider) throw new FirestoreError(D.FAILED_PRECONDITION, "SDK cache is already specified.");
|
|
19015
19015
|
__PRIVATE_logWarn("enableIndexedDbPersistence() will be deprecated in the future, you can use `FirestoreSettings.cache` instead.");
|
|
19016
19016
|
const r = e._freezeSettings(), i = new OnlineComponentProvider;
|
|
19017
19017
|
return __PRIVATE_setPersistenceProviders(n, i, new __PRIVATE_IndexedDbOfflineComponentProvider(i, r.cacheSizeBytes, null == t ? void 0 : t.forceOwnership));
|
|
@@ -19045,7 +19045,7 @@ function __PRIVATE_configureFirestore(e) {
|
|
|
19045
19045
|
*/ function enableMultiTabIndexedDbPersistence(e) {
|
|
19046
19046
|
__PRIVATE_verifyNotInitialized(e = __PRIVATE_cast(e, Firestore));
|
|
19047
19047
|
const t = ensureFirestoreConfigured(e);
|
|
19048
|
-
if (t._uninitializedComponentsProvider) throw new FirestoreError(
|
|
19048
|
+
if (t._uninitializedComponentsProvider) throw new FirestoreError(D.FAILED_PRECONDITION, "SDK cache is already specified.");
|
|
19049
19049
|
__PRIVATE_logWarn("enableMultiTabIndexedDbPersistence() will be deprecated in the future, you can use `FirestoreSettings.cache` instead.");
|
|
19050
19050
|
const n = e._freezeSettings(), r = new OnlineComponentProvider;
|
|
19051
19051
|
return __PRIVATE_setPersistenceProviders(t, r, new __PRIVATE_MultiTabOfflineComponentProvider(r, n.cacheSizeBytes));
|
|
@@ -19093,7 +19093,7 @@ function __PRIVATE_configureFirestore(e) {
|
|
|
19093
19093
|
* @returns A `Promise` that is resolved when the persistent storage is
|
|
19094
19094
|
* cleared. Otherwise, the promise is rejected with an error.
|
|
19095
19095
|
*/ function clearIndexedDbPersistence(e) {
|
|
19096
|
-
if (e._initialized && !e._terminated) throw new FirestoreError(
|
|
19096
|
+
if (e._initialized && !e._terminated) throw new FirestoreError(D.FAILED_PRECONDITION, "Persistence can only be cleared before a Firestore instance is initialized or after it is terminated.");
|
|
19097
19097
|
const t = new __PRIVATE_Deferred;
|
|
19098
19098
|
return e._queue.enqueueAndForgetEvenWhileRestricted((async () => {
|
|
19099
19099
|
try {
|
|
@@ -19207,7 +19207,7 @@ function __PRIVATE_configureFirestore(e) {
|
|
|
19207
19207
|
}
|
|
19208
19208
|
|
|
19209
19209
|
function __PRIVATE_verifyNotInitialized(e) {
|
|
19210
|
-
if (e._initialized || e._terminated) throw new FirestoreError(
|
|
19210
|
+
if (e._initialized || e._terminated) throw new FirestoreError(D.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.");
|
|
19211
19211
|
}
|
|
19212
19212
|
|
|
19213
19213
|
/**
|
|
@@ -19316,7 +19316,7 @@ class AggregateField {
|
|
|
19316
19316
|
try {
|
|
19317
19317
|
return new Bytes(ByteString.fromBase64String(e));
|
|
19318
19318
|
} catch (e) {
|
|
19319
|
-
throw new FirestoreError(
|
|
19319
|
+
throw new FirestoreError(D.INVALID_ARGUMENT, "Failed to construct data from Base64 string: " + e);
|
|
19320
19320
|
}
|
|
19321
19321
|
}
|
|
19322
19322
|
/**
|
|
@@ -19388,7 +19388,7 @@ class AggregateField {
|
|
|
19388
19388
|
* @param fieldNames - A list of field names.
|
|
19389
19389
|
*/
|
|
19390
19390
|
constructor(...e) {
|
|
19391
|
-
for (let t = 0; t < e.length; ++t) if (0 === e[t].length) throw new FirestoreError(
|
|
19391
|
+
for (let t = 0; t < e.length; ++t) if (0 === e[t].length) throw new FirestoreError(D.INVALID_ARGUMENT, "Invalid field name at argument $(i + 1). Field names must not be empty.");
|
|
19392
19392
|
this._internalPath = new FieldPath$1(e);
|
|
19393
19393
|
}
|
|
19394
19394
|
/**
|
|
@@ -19467,8 +19467,8 @@ class AggregateField {
|
|
|
19467
19467
|
* @param longitude - The longitude as number between -180 and 180.
|
|
19468
19468
|
*/
|
|
19469
19469
|
constructor(e, t) {
|
|
19470
|
-
if (!isFinite(e) || e < -90 || e > 90) throw new FirestoreError(
|
|
19471
|
-
if (!isFinite(t) || t < -180 || t > 180) throw new FirestoreError(
|
|
19470
|
+
if (!isFinite(e) || e < -90 || e > 90) throw new FirestoreError(D.INVALID_ARGUMENT, "Latitude must be a number between -90 and 90, but was: " + e);
|
|
19471
|
+
if (!isFinite(t) || t < -180 || t > 180) throw new FirestoreError(D.INVALID_ARGUMENT, "Longitude must be a number between -180 and 180, but was: " + t);
|
|
19472
19472
|
this._lat = e, this._long = t;
|
|
19473
19473
|
}
|
|
19474
19474
|
/**
|
|
@@ -19564,7 +19564,7 @@ class AggregateField {
|
|
|
19564
19564
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19565
19565
|
* See the License for the specific language governing permissions and
|
|
19566
19566
|
* limitations under the License.
|
|
19567
|
-
*/ const
|
|
19567
|
+
*/ const be = /^__.*__$/;
|
|
19568
19568
|
|
|
19569
19569
|
/** The result of parsing document data (e.g. for a setData call). */ class ParsedSetData {
|
|
19570
19570
|
constructor(e, t, n) {
|
|
@@ -19675,7 +19675,7 @@ function __PRIVATE_isWrite(e) {
|
|
|
19675
19675
|
}
|
|
19676
19676
|
vu(e) {
|
|
19677
19677
|
if (0 === e.length) throw this.Mu("Document fields must not be empty");
|
|
19678
|
-
if (__PRIVATE_isWrite(this.wu) &&
|
|
19678
|
+
if (__PRIVATE_isWrite(this.wu) && be.test(e)) throw this.Mu('Document fields cannot begin and end with "__"');
|
|
19679
19679
|
}
|
|
19680
19680
|
}
|
|
19681
19681
|
|
|
@@ -19712,7 +19712,7 @@ function __PRIVATE_newUserDataReader(e) {
|
|
|
19712
19712
|
const e = [];
|
|
19713
19713
|
for (const r of s.mergeFields) {
|
|
19714
19714
|
const i = __PRIVATE_fieldPathFromArgument$1(t, r, n);
|
|
19715
|
-
if (!o.contains(i)) throw new FirestoreError(
|
|
19715
|
+
if (!o.contains(i)) throw new FirestoreError(D.INVALID_ARGUMENT, `Field '${i}' is specified in your field mask but missing from your input data.`);
|
|
19716
19716
|
__PRIVATE_fieldMaskContains(e, i) || e.push(i);
|
|
19717
19717
|
}
|
|
19718
19718
|
a = new FieldMask(e), u = o.fieldTransforms.filter((e => a.covers(e.field)));
|
|
@@ -19829,7 +19829,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
|
|
|
19829
19829
|
|
|
19830
19830
|
/** Parse update data from a list of field/value arguments. */ function __PRIVATE_parseUpdateVarargs(e, t, n, r, i, s) {
|
|
19831
19831
|
const o = e.Nu(1 /* UserDataSource.Update */ , t, n), _ = [ __PRIVATE_fieldPathFromArgument$1(t, r, n) ], a = [ i ];
|
|
19832
|
-
if (s.length % 2 != 0) throw new FirestoreError(
|
|
19832
|
+
if (s.length % 2 != 0) throw new FirestoreError(D.INVALID_ARGUMENT, `Function ${t}() needs to be called with an even number of arguments that alternate between field names and values.`);
|
|
19833
19833
|
for (let e = 0; e < s.length; e += 2) _.push(__PRIVATE_fieldPathFromArgument$1(t, s[e])),
|
|
19834
19834
|
a.push(s[e + 1]);
|
|
19835
19835
|
const u = [], c = ObjectValue.empty();
|
|
@@ -20053,7 +20053,7 @@ function __PRIVATE_validatePlainObject(e, t, n) {
|
|
|
20053
20053
|
|
|
20054
20054
|
/**
|
|
20055
20055
|
* Matches any characters in a field path string that are reserved.
|
|
20056
|
-
*/ const
|
|
20056
|
+
*/ const De = new RegExp("[~\\*/\\[\\]]");
|
|
20057
20057
|
|
|
20058
20058
|
/**
|
|
20059
20059
|
* Wraps fromDotSeparatedString with an error message about the method that
|
|
@@ -20064,7 +20064,7 @@ function __PRIVATE_validatePlainObject(e, t, n) {
|
|
|
20064
20064
|
* @param targetDoc - The document against which the field path will be
|
|
20065
20065
|
* evaluated.
|
|
20066
20066
|
*/ function __PRIVATE_fieldPathFromDotSeparatedString(e, t, n) {
|
|
20067
|
-
if (t.search(
|
|
20067
|
+
if (t.search(De) >= 0) throw __PRIVATE_createError(`Invalid field path (${t}). Paths must not contain '~', '*', '/', '[', or ']'`, e,
|
|
20068
20068
|
/* hasConverter= */ !1,
|
|
20069
20069
|
/* path= */ void 0, n);
|
|
20070
20070
|
try {
|
|
@@ -20082,7 +20082,7 @@ function __PRIVATE_createError(e, t, n, r, i) {
|
|
|
20082
20082
|
n && (_ += " (via `toFirestore()`)"), _ += ". ";
|
|
20083
20083
|
let a = "";
|
|
20084
20084
|
return (s || o) && (a += " (found", s && (a += ` in field ${r}`), o && (a += ` in document ${i}`),
|
|
20085
|
-
a += ")"), new FirestoreError(
|
|
20085
|
+
a += ")"), new FirestoreError(D.INVALID_ARGUMENT, _ + e + a);
|
|
20086
20086
|
}
|
|
20087
20087
|
|
|
20088
20088
|
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function __PRIVATE_fieldMaskContains(e, t) {
|
|
@@ -20219,7 +20219,7 @@ function __PRIVATE_createError(e, t, n, r, i) {
|
|
|
20219
20219
|
* See the License for the specific language governing permissions and
|
|
20220
20220
|
* limitations under the License.
|
|
20221
20221
|
*/ function __PRIVATE_validateHasExplicitOrderByForLimitToLast(e) {
|
|
20222
|
-
if ("L" /* LimitType.Last */ === e.limitType && 0 === e.explicitOrderBy.length) throw new FirestoreError(
|
|
20222
|
+
if ("L" /* LimitType.Last */ === e.limitType && 0 === e.explicitOrderBy.length) throw new FirestoreError(D.UNIMPLEMENTED, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
20223
20223
|
}
|
|
20224
20224
|
|
|
20225
20225
|
/**
|
|
@@ -20240,7 +20240,7 @@ function query(e, t, ...n) {
|
|
|
20240
20240
|
let r = [];
|
|
20241
20241
|
t instanceof AppliableConstraint && r.push(t), r = r.concat(n), function __PRIVATE_validateQueryConstraintArray(e) {
|
|
20242
20242
|
const t = e.filter((e => e instanceof QueryCompositeFilterConstraint)).length, n = e.filter((e => e instanceof QueryFieldFilterConstraint)).length;
|
|
20243
|
-
if (t > 1 || t > 0 && n > 0) throw new FirestoreError(
|
|
20243
|
+
if (t > 1 || t > 0 && n > 0) throw new FirestoreError(D.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(...)))`.");
|
|
20244
20244
|
}
|
|
20245
20245
|
/**
|
|
20246
20246
|
* @license
|
|
@@ -20294,7 +20294,7 @@ function query(e, t, ...n) {
|
|
|
20294
20294
|
const t = __PRIVATE_newUserDataReader(e.firestore), n = function __PRIVATE_newQueryFilter(e, t, n, r, i, s, o) {
|
|
20295
20295
|
let _;
|
|
20296
20296
|
if (i.isKeyField()) {
|
|
20297
|
-
if ("array-contains" /* Operator.ARRAY_CONTAINS */ === s || "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ === s) throw new FirestoreError(
|
|
20297
|
+
if ("array-contains" /* Operator.ARRAY_CONTAINS */ === s || "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ === s) throw new FirestoreError(D.INVALID_ARGUMENT, `Invalid Query. You can't perform '${s}' queries on documentId().`);
|
|
20298
20298
|
if ("in" /* Operator.IN */ === s || "not-in" /* Operator.NOT_IN */ === s) {
|
|
20299
20299
|
__PRIVATE_validateDisjunctiveFilterElements(o, s);
|
|
20300
20300
|
const t = [];
|
|
@@ -20421,8 +20421,8 @@ function query(e, t, ...n) {
|
|
|
20421
20421
|
}
|
|
20422
20422
|
_apply(e) {
|
|
20423
20423
|
const t = function __PRIVATE_newQueryOrderBy(e, t, n) {
|
|
20424
|
-
if (null !== e.startAt) throw new FirestoreError(
|
|
20425
|
-
if (null !== e.endAt) throw new FirestoreError(
|
|
20424
|
+
if (null !== e.startAt) throw new FirestoreError(D.INVALID_ARGUMENT, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
|
|
20425
|
+
if (null !== e.endAt) throw new FirestoreError(D.INVALID_ARGUMENT, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
|
|
20426
20426
|
return new OrderBy(t, n);
|
|
20427
20427
|
}
|
|
20428
20428
|
/**
|
|
@@ -20580,7 +20580,7 @@ function endAt(...e) {
|
|
|
20580
20580
|
|
|
20581
20581
|
/** Helper function to create a bound from a document or fields */ function __PRIVATE_newQueryBoundFromDocOrFields(e, t, n, r) {
|
|
20582
20582
|
if (n[0] = util.getModularInstance(n[0]), n[0] instanceof DocumentSnapshot$1) return function __PRIVATE_newQueryBoundFromDocument(e, t, n, r, i) {
|
|
20583
|
-
if (!r) throw new FirestoreError(
|
|
20583
|
+
if (!r) throw new FirestoreError(D.NOT_FOUND, `Can't use a DocumentSnapshot that doesn't exist for ${n}().`);
|
|
20584
20584
|
const s = [];
|
|
20585
20585
|
// Because people expect to continue/end a query at the exact document
|
|
20586
20586
|
// provided, we need to use the implicit sort order rather than the explicit
|
|
@@ -20591,10 +20591,10 @@ function endAt(...e) {
|
|
|
20591
20591
|
// results.
|
|
20592
20592
|
for (const n of __PRIVATE_queryNormalizedOrderBy(e)) if (n.field.isKeyField()) s.push(__PRIVATE_refValue(t, r.key)); else {
|
|
20593
20593
|
const e = r.data.field(n.field);
|
|
20594
|
-
if (__PRIVATE_isServerTimestamp(e)) throw new FirestoreError(
|
|
20594
|
+
if (__PRIVATE_isServerTimestamp(e)) throw new FirestoreError(D.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.)');
|
|
20595
20595
|
if (null === e) {
|
|
20596
20596
|
const e = n.field.canonicalString();
|
|
20597
|
-
throw new FirestoreError(
|
|
20597
|
+
throw new FirestoreError(D.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.`);
|
|
20598
20598
|
}
|
|
20599
20599
|
s.push(e);
|
|
20600
20600
|
}
|
|
@@ -20608,15 +20608,15 @@ function endAt(...e) {
|
|
|
20608
20608
|
return function __PRIVATE_newQueryBoundFromFields(e, t, n, r, i, s) {
|
|
20609
20609
|
// Use explicit order by's because it has to match the query the user made
|
|
20610
20610
|
const o = e.explicitOrderBy;
|
|
20611
|
-
if (i.length > o.length) throw new FirestoreError(
|
|
20611
|
+
if (i.length > o.length) throw new FirestoreError(D.INVALID_ARGUMENT, `Too many arguments provided to ${r}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);
|
|
20612
20612
|
const _ = [];
|
|
20613
20613
|
for (let s = 0; s < i.length; s++) {
|
|
20614
20614
|
const a = i[s];
|
|
20615
20615
|
if (o[s].field.isKeyField()) {
|
|
20616
|
-
if ("string" != typeof a) throw new FirestoreError(
|
|
20617
|
-
if (!__PRIVATE_isCollectionGroupQuery(e) && -1 !== a.indexOf("/")) throw new FirestoreError(
|
|
20616
|
+
if ("string" != typeof a) throw new FirestoreError(D.INVALID_ARGUMENT, `Invalid query. Expected a string for document ID in ${r}(), but got a ${typeof a}`);
|
|
20617
|
+
if (!__PRIVATE_isCollectionGroupQuery(e) && -1 !== a.indexOf("/")) throw new FirestoreError(D.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.`);
|
|
20618
20618
|
const n = e.path.child(ResourcePath.fromString(a));
|
|
20619
|
-
if (!DocumentKey.isDocumentKey(n)) throw new FirestoreError(
|
|
20619
|
+
if (!DocumentKey.isDocumentKey(n)) throw new FirestoreError(D.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.`);
|
|
20620
20620
|
const i = new DocumentKey(n);
|
|
20621
20621
|
_.push(__PRIVATE_refValue(t, i));
|
|
20622
20622
|
} else {
|
|
@@ -20636,21 +20636,21 @@ function endAt(...e) {
|
|
|
20636
20636
|
|
|
20637
20637
|
function __PRIVATE_parseDocumentIdValue(e, t, n) {
|
|
20638
20638
|
if ("string" == typeof (n = util.getModularInstance(n))) {
|
|
20639
|
-
if ("" === n) throw new FirestoreError(
|
|
20640
|
-
if (!__PRIVATE_isCollectionGroupQuery(t) && -1 !== n.indexOf("/")) throw new FirestoreError(
|
|
20639
|
+
if ("" === n) throw new FirestoreError(D.INVALID_ARGUMENT, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
|
|
20640
|
+
if (!__PRIVATE_isCollectionGroupQuery(t) && -1 !== n.indexOf("/")) throw new FirestoreError(D.INVALID_ARGUMENT, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);
|
|
20641
20641
|
const r = t.path.child(ResourcePath.fromString(n));
|
|
20642
|
-
if (!DocumentKey.isDocumentKey(r)) throw new FirestoreError(
|
|
20642
|
+
if (!DocumentKey.isDocumentKey(r)) throw new FirestoreError(D.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}).`);
|
|
20643
20643
|
return __PRIVATE_refValue(e, new DocumentKey(r));
|
|
20644
20644
|
}
|
|
20645
20645
|
if (n instanceof DocumentReference) return __PRIVATE_refValue(e, n._key);
|
|
20646
|
-
throw new FirestoreError(
|
|
20646
|
+
throw new FirestoreError(D.INVALID_ARGUMENT, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${__PRIVATE_valueDescription(n)}.`);
|
|
20647
20647
|
}
|
|
20648
20648
|
|
|
20649
20649
|
/**
|
|
20650
20650
|
* Validates that the value passed into a disjunctive filter satisfies all
|
|
20651
20651
|
* array requirements.
|
|
20652
20652
|
*/ function __PRIVATE_validateDisjunctiveFilterElements(e, t) {
|
|
20653
|
-
if (!Array.isArray(e) || 0 === e.length) throw new FirestoreError(
|
|
20653
|
+
if (!Array.isArray(e) || 0 === e.length) throw new FirestoreError(D.INVALID_ARGUMENT, `Invalid Query. A non-empty array is required for '${t.toString()}' filters.`);
|
|
20654
20654
|
}
|
|
20655
20655
|
|
|
20656
20656
|
/**
|
|
@@ -20684,11 +20684,11 @@ function __PRIVATE_parseDocumentIdValue(e, t, n) {
|
|
|
20684
20684
|
}(t.op));
|
|
20685
20685
|
if (null !== n)
|
|
20686
20686
|
// Special case when it's a duplicate op to give a slightly clearer error message.
|
|
20687
|
-
throw n === t.op ? new FirestoreError(
|
|
20687
|
+
throw n === t.op ? new FirestoreError(D.INVALID_ARGUMENT, `Invalid query. You cannot use more than one '${t.op.toString()}' filter.`) : new FirestoreError(D.INVALID_ARGUMENT, `Invalid query. You cannot use '${t.op.toString()}' filters with '${n.toString()}' filters.`);
|
|
20688
20688
|
}
|
|
20689
20689
|
|
|
20690
20690
|
function __PRIVATE_validateQueryFilterConstraint(e, t) {
|
|
20691
|
-
if (!(t instanceof QueryFieldFilterConstraint || t instanceof QueryCompositeFilterConstraint)) throw new FirestoreError(
|
|
20691
|
+
if (!(t instanceof QueryFieldFilterConstraint || t instanceof QueryCompositeFilterConstraint)) throw new FirestoreError(D.INVALID_ARGUMENT, `Function ${e}() requires AppliableConstraints created with a call to 'where(...)', 'or(...)', or 'and(...)'.`);
|
|
20692
20692
|
}
|
|
20693
20693
|
|
|
20694
20694
|
class AbstractUserDataWriter {
|
|
@@ -21070,7 +21070,7 @@ class __PRIVATE_LiteUserDataWriter extends AbstractUserDataWriter {
|
|
|
21070
21070
|
* snapshot events.
|
|
21071
21071
|
*/ docChanges(e = {}) {
|
|
21072
21072
|
const t = !!e.includeMetadataChanges;
|
|
21073
|
-
if (t && this._snapshot.excludesMetadataChanges) throw new FirestoreError(
|
|
21073
|
+
if (t && this._snapshot.excludesMetadataChanges) throw new FirestoreError(D.INVALID_ARGUMENT, "To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");
|
|
21074
21074
|
return this._cachedChanges && this._cachedChangesIncludeMetadataChanges === t || (this._cachedChanges =
|
|
21075
21075
|
/** Calculates the array of `DocumentChange`s for a given `ViewSnapshot`. */
|
|
21076
21076
|
function __PRIVATE_changesFromSnapshot(e, t) {
|
|
@@ -21610,7 +21610,7 @@ class __PRIVATE_MultiTabManagerImpl {
|
|
|
21610
21610
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21611
21611
|
* See the License for the specific language governing permissions and
|
|
21612
21612
|
* limitations under the License.
|
|
21613
|
-
*/ const
|
|
21613
|
+
*/ const ve = {
|
|
21614
21614
|
maxAttempts: 5
|
|
21615
21615
|
};
|
|
21616
21616
|
|
|
@@ -21684,12 +21684,12 @@ class WriteBatch {
|
|
|
21684
21684
|
return this._verifyNotCommitted(), this._committed = !0, this._mutations.length > 0 ? this._commitHandler(this._mutations) : Promise.resolve();
|
|
21685
21685
|
}
|
|
21686
21686
|
_verifyNotCommitted() {
|
|
21687
|
-
if (this._committed) throw new FirestoreError(
|
|
21687
|
+
if (this._committed) throw new FirestoreError(D.FAILED_PRECONDITION, "A write batch can no longer be used after commit() has been called.");
|
|
21688
21688
|
}
|
|
21689
21689
|
}
|
|
21690
21690
|
|
|
21691
21691
|
function __PRIVATE_validateReference(e, t) {
|
|
21692
|
-
if ((e = util.getModularInstance(e)).firestore !== t) throw new FirestoreError(
|
|
21692
|
+
if ((e = util.getModularInstance(e)).firestore !== t) throw new FirestoreError(D.INVALID_ARGUMENT, "Provided document reference is from a different Firestore instance.");
|
|
21693
21693
|
return e;
|
|
21694
21694
|
}
|
|
21695
21695
|
|
|
@@ -21822,9 +21822,9 @@ class Transaction extends class Transaction$1 {
|
|
|
21822
21822
|
* rejected promise with the corresponding failure error is returned.
|
|
21823
21823
|
*/ function runTransaction(e, t, n) {
|
|
21824
21824
|
e = __PRIVATE_cast(e, Firestore);
|
|
21825
|
-
const r = Object.assign(Object.assign({},
|
|
21825
|
+
const r = Object.assign(Object.assign({}, ve), n);
|
|
21826
21826
|
!function __PRIVATE_validateTransactionOptions(e) {
|
|
21827
|
-
if (e.maxAttempts < 1) throw new FirestoreError(
|
|
21827
|
+
if (e.maxAttempts < 1) throw new FirestoreError(D.INVALID_ARGUMENT, "Max attempts must be at least 1");
|
|
21828
21828
|
}(r);
|
|
21829
21829
|
return function __PRIVATE_firestoreClientTransaction(e, t, n) {
|
|
21830
21830
|
const r = new __PRIVATE_Deferred;
|
|
@@ -21988,7 +21988,7 @@ class Transaction extends class Transaction$1 {
|
|
|
21988
21988
|
try {
|
|
21989
21989
|
return JSON.parse(e);
|
|
21990
21990
|
} catch (e) {
|
|
21991
|
-
throw new FirestoreError(
|
|
21991
|
+
throw new FirestoreError(D.INVALID_ARGUMENT, "Failed to parse JSON: " + (null == e ? void 0 : e.message));
|
|
21992
21992
|
}
|
|
21993
21993
|
}(e) : e, n = [];
|
|
21994
21994
|
if (Array.isArray(t.indexes)) for (const e of t.indexes) {
|
|
@@ -22005,7 +22005,7 @@ class Transaction extends class Transaction$1 {
|
|
|
22005
22005
|
}
|
|
22006
22006
|
|
|
22007
22007
|
function __PRIVATE_tryGetString(e, t) {
|
|
22008
|
-
if ("string" != typeof e[t]) throw new FirestoreError(
|
|
22008
|
+
if ("string" != typeof e[t]) throw new FirestoreError(D.INVALID_ARGUMENT, "Missing string value for: " + t);
|
|
22009
22009
|
return e[t];
|
|
22010
22010
|
}
|
|
22011
22011
|
|
|
@@ -22048,12 +22048,12 @@ function __PRIVATE_tryGetString(e, t) {
|
|
|
22048
22048
|
*/ function getPersistentCacheIndexManager(e) {
|
|
22049
22049
|
var t;
|
|
22050
22050
|
e = __PRIVATE_cast(e, Firestore);
|
|
22051
|
-
const n =
|
|
22051
|
+
const n = Ce.get(e);
|
|
22052
22052
|
if (n) return n;
|
|
22053
22053
|
const r = ensureFirestoreConfigured(e);
|
|
22054
22054
|
if ("persistent" !== (null === (t = r._uninitializedComponentsProvider) || void 0 === t ? void 0 : t._offlineKind)) return null;
|
|
22055
22055
|
const i = new PersistentCacheIndexManager(r);
|
|
22056
|
-
return
|
|
22056
|
+
return Ce.set(e, i), i;
|
|
22057
22057
|
}
|
|
22058
22058
|
|
|
22059
22059
|
/**
|
|
@@ -22096,7 +22096,7 @@ function __PRIVATE_setPersistentCacheIndexAutoCreationEnabled(e, t) {
|
|
|
22096
22096
|
* Use a `WeakMap` so that the mapping will be automatically dropped when the
|
|
22097
22097
|
* `Firestore` instance is garbage collected. This emulates a private member
|
|
22098
22098
|
* as described in https://goo.gle/454yvug.
|
|
22099
|
-
*/ const
|
|
22099
|
+
*/ const Ce = new WeakMap;
|
|
22100
22100
|
|
|
22101
22101
|
/**
|
|
22102
22102
|
* @license
|
|
@@ -22204,10 +22204,10 @@ function _internalQueryToProtoQueryTarget(e) {
|
|
|
22204
22204
|
this.ku = new Map;
|
|
22205
22205
|
}
|
|
22206
22206
|
static get instance() {
|
|
22207
|
-
return
|
|
22208
|
-
if (
|
|
22209
|
-
|
|
22210
|
-
}(
|
|
22207
|
+
return Fe || (Fe = new __PRIVATE_TestingHooksSpiImpl, function __PRIVATE_setTestingHooksSpi(e) {
|
|
22208
|
+
if (Pe) throw new Error("a TestingHooksSpi instance is already set");
|
|
22209
|
+
Pe = e;
|
|
22210
|
+
}(Fe)), Fe;
|
|
22211
22211
|
}
|
|
22212
22212
|
et(e) {
|
|
22213
22213
|
this.ku.forEach((t => t(e)));
|
|
@@ -22218,7 +22218,7 @@ function _internalQueryToProtoQueryTarget(e) {
|
|
|
22218
22218
|
}
|
|
22219
22219
|
}
|
|
22220
22220
|
|
|
22221
|
-
let
|
|
22221
|
+
let Fe = null;
|
|
22222
22222
|
|
|
22223
22223
|
/**
|
|
22224
22224
|
* Cloud Firestore
|
|
@@ -22226,25 +22226,25 @@ let Me = null;
|
|
|
22226
22226
|
* @packageDocumentation
|
|
22227
22227
|
*/ !function __PRIVATE_registerFirestore(e, t = !0) {
|
|
22228
22228
|
!function __PRIVATE_setSDKVersion(e) {
|
|
22229
|
-
|
|
22229
|
+
S = e;
|
|
22230
22230
|
}(app.SDK_VERSION), app._registerComponent(new component.Component("firestore", ((e, {instanceIdentifier: n, options: r}) => {
|
|
22231
22231
|
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) {
|
|
22232
|
-
if (!Object.prototype.hasOwnProperty.apply(e.options, [ "projectId" ])) throw new FirestoreError(
|
|
22232
|
+
if (!Object.prototype.hasOwnProperty.apply(e.options, [ "projectId" ])) throw new FirestoreError(D.INVALID_ARGUMENT, '"projectId" not provided in firebase.initializeApp.');
|
|
22233
22233
|
return new DatabaseId(e.options.projectId, t);
|
|
22234
22234
|
}(i, n), i);
|
|
22235
22235
|
return r = Object.assign({
|
|
22236
22236
|
useFetchStreams: t
|
|
22237
22237
|
}, r), s._setSettings(r), s;
|
|
22238
|
-
}), "PUBLIC").setMultipleInstances(!0)), app.registerVersion(
|
|
22238
|
+
}), "PUBLIC").setMultipleInstances(!0)), app.registerVersion(w, "4.7.1-canary.ff0475c41", e),
|
|
22239
22239
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
|
22240
|
-
app.registerVersion(
|
|
22240
|
+
app.registerVersion(w, "4.7.1-canary.ff0475c41", "cjs2017");
|
|
22241
22241
|
}();
|
|
22242
22242
|
|
|
22243
22243
|
exports.AbstractUserDataWriter = AbstractUserDataWriter;
|
|
22244
22244
|
exports.AggregateField = AggregateField;
|
|
22245
22245
|
exports.AggregateQuerySnapshot = AggregateQuerySnapshot;
|
|
22246
22246
|
exports.Bytes = Bytes;
|
|
22247
|
-
exports.CACHE_SIZE_UNLIMITED =
|
|
22247
|
+
exports.CACHE_SIZE_UNLIMITED = Se;
|
|
22248
22248
|
exports.CollectionReference = CollectionReference;
|
|
22249
22249
|
exports.DocumentReference = DocumentReference;
|
|
22250
22250
|
exports.DocumentSnapshot = DocumentSnapshot;
|