@firebase/firestore 4.3.1-canary.f27baf423 → 4.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/firestore/test/integration/util/composite_index_test_helper.d.ts +1 -2
- package/dist/index.cjs.js +292 -293
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm2017.js +293 -294
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +3053 -3054
- 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 +298 -299
- package/dist/index.rn.js.map +1 -1
- package/dist/lite/firestore/test/integration/util/composite_index_test_helper.d.ts +1 -2
- package/dist/lite/index.browser.esm2017.js +2 -2
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +2 -2
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.cjs.js +2 -2
- package/dist/lite/index.cjs.js.map +1 -1
- package/dist/lite/index.node.cjs.js +2 -2
- package/dist/lite/index.node.mjs +2 -2
- package/dist/lite/index.rn.esm2017.js +2 -2
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/packages/firestore/test/integration/util/composite_index_test_helper.d.ts +1 -2
- package/dist/packages/firestore/dist/index.esm2017.d.ts +2 -2
- package/dist/packages/firestore/test/integration/util/composite_index_test_helper.d.ts +1 -2
- package/package.json +9 -9
package/dist/index.rn.js
CHANGED
|
@@ -6,9 +6,9 @@ import { Logger as o, LogLevel as _ } from "@firebase/logger";
|
|
|
6
6
|
|
|
7
7
|
import { FirebaseError as a, getUA as u, isIndexedDBAvailable as c, base64 as l, DecodeBase64StringError as h, isSafari as P, createMockUserToken as I, getModularInstance as T, deepEqual as E, getDefaultEmulatorHostnameAndPort as d } from "@firebase/util";
|
|
8
8
|
|
|
9
|
-
import { Integer as A, Md5 as R, XhrIo as V, EventType as m, ErrorCode as f, createWebChannelTransport as g, getStatEventTarget as p,
|
|
9
|
+
import { Integer as A, Md5 as R, XhrIo as V, EventType as m, ErrorCode as f, createWebChannelTransport as g, getStatEventTarget as p, WebChannel as y, Event as w, Stat as S } from "@firebase/webchannel-wrapper";
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const b = "@firebase/firestore";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @license
|
|
@@ -70,7 +70,7 @@ User.MOCK_USER = new User("mock-user");
|
|
|
70
70
|
* See the License for the specific language governing permissions and
|
|
71
71
|
* limitations under the License.
|
|
72
72
|
*/
|
|
73
|
-
let
|
|
73
|
+
let D = "10.5.1";
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* @license
|
|
@@ -88,11 +88,11 @@ let C = "10.5.1-canary.f27baf423";
|
|
|
88
88
|
* See the License for the specific language governing permissions and
|
|
89
89
|
* limitations under the License.
|
|
90
90
|
*/
|
|
91
|
-
const
|
|
91
|
+
const C = new o("@firebase/firestore");
|
|
92
92
|
|
|
93
93
|
// Helper methods are needed because variables can't be exported as read/write
|
|
94
94
|
function __PRIVATE_getLogLevel() {
|
|
95
|
-
return
|
|
95
|
+
return C.logLevel;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
/**
|
|
@@ -108,29 +108,29 @@ function __PRIVATE_getLogLevel() {
|
|
|
108
108
|
* <li><code>`silent` to turn off logging.</li>
|
|
109
109
|
* </ul>
|
|
110
110
|
*/ function setLogLevel(e) {
|
|
111
|
-
|
|
111
|
+
C.setLogLevel(e);
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
function __PRIVATE_logDebug(e, ...t) {
|
|
115
|
-
if (
|
|
115
|
+
if (C.logLevel <= _.DEBUG) {
|
|
116
116
|
const n = t.map(__PRIVATE_argToString);
|
|
117
|
-
|
|
117
|
+
C.debug(`Firestore (${D}): ${e}`, ...n);
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
function __PRIVATE_logError(e, ...t) {
|
|
122
|
-
if (
|
|
122
|
+
if (C.logLevel <= _.ERROR) {
|
|
123
123
|
const n = t.map(__PRIVATE_argToString);
|
|
124
|
-
|
|
124
|
+
C.error(`Firestore (${D}): ${e}`, ...n);
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
/**
|
|
129
129
|
* @internal
|
|
130
130
|
*/ function __PRIVATE_logWarn(e, ...t) {
|
|
131
|
-
if (
|
|
131
|
+
if (C.logLevel <= _.WARN) {
|
|
132
132
|
const n = t.map(__PRIVATE_argToString);
|
|
133
|
-
|
|
133
|
+
C.warn(`Firestore (${D}): ${e}`, ...n);
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
|
|
@@ -191,7 +191,7 @@ function __PRIVATE_logError(e, ...t) {
|
|
|
191
191
|
*/ function fail(e = "Unexpected state") {
|
|
192
192
|
// Log the failure in addition to throw an exception, just in case the
|
|
193
193
|
// exception is swallowed.
|
|
194
|
-
const t = `FIRESTORE (${
|
|
194
|
+
const t = `FIRESTORE (${D}) INTERNAL ASSERTION FAILED: ` + e;
|
|
195
195
|
// NOTE: We don't use FirestoreError here because these are internal failures
|
|
196
196
|
// that cannot be handled by the user. (Also it would create a circular
|
|
197
197
|
// dependency between the error and assert modules which doesn't work.)
|
|
@@ -244,7 +244,7 @@ t) {
|
|
|
244
244
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
245
245
|
* See the License for the specific language governing permissions and
|
|
246
246
|
* limitations under the License.
|
|
247
|
-
*/ const
|
|
247
|
+
*/ const v = {
|
|
248
248
|
// Causes are copied from:
|
|
249
249
|
// https://github.com/grpc/grpc/blob/bceec94ea4fc5f0085d81235d8e1c06798dc341a/include/grpc%2B%2B/impl/codegen/status_code_enum.h
|
|
250
250
|
/** Not an error; returned on success. */
|
|
@@ -789,11 +789,11 @@ class Timestamp {
|
|
|
789
789
|
* The fractions of a second at nanosecond resolution.*
|
|
790
790
|
*/
|
|
791
791
|
t) {
|
|
792
|
-
if (this.seconds = e, this.nanoseconds = t, t < 0) throw new FirestoreError(
|
|
793
|
-
if (t >= 1e9) throw new FirestoreError(
|
|
794
|
-
if (e < -62135596800) throw new FirestoreError(
|
|
792
|
+
if (this.seconds = e, this.nanoseconds = t, t < 0) throw new FirestoreError(v.INVALID_ARGUMENT, "Timestamp nanoseconds out of range: " + t);
|
|
793
|
+
if (t >= 1e9) throw new FirestoreError(v.INVALID_ARGUMENT, "Timestamp nanoseconds out of range: " + t);
|
|
794
|
+
if (e < -62135596800) throw new FirestoreError(v.INVALID_ARGUMENT, "Timestamp seconds out of range: " + e);
|
|
795
795
|
// This will break in the year 10,000.
|
|
796
|
-
if (e >= 253402300800) throw new FirestoreError(
|
|
796
|
+
if (e >= 253402300800) throw new FirestoreError(v.INVALID_ARGUMENT, "Timestamp seconds out of range: " + e);
|
|
797
797
|
}
|
|
798
798
|
/**
|
|
799
799
|
* Creates a new timestamp with the current date, with millisecond precision.
|
|
@@ -1041,7 +1041,7 @@ class BasePath {
|
|
|
1041
1041
|
// for legacy reasons and should not be used frequently).
|
|
1042
1042
|
const t = [];
|
|
1043
1043
|
for (const n of e) {
|
|
1044
|
-
if (n.indexOf("//") >= 0) throw new FirestoreError(
|
|
1044
|
+
if (n.indexOf("//") >= 0) throw new FirestoreError(v.INVALID_ARGUMENT, `Invalid segment (${n}). Paths must not contain // in them.`);
|
|
1045
1045
|
// Strip leading and traling slashed.
|
|
1046
1046
|
t.push(...n.split("/").filter((e => e.length > 0)));
|
|
1047
1047
|
}
|
|
@@ -1052,7 +1052,7 @@ class BasePath {
|
|
|
1052
1052
|
}
|
|
1053
1053
|
}
|
|
1054
1054
|
|
|
1055
|
-
const
|
|
1055
|
+
const F = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
1056
1056
|
|
|
1057
1057
|
/**
|
|
1058
1058
|
* A dot-separated path for navigating sub-objects within a document.
|
|
@@ -1065,7 +1065,7 @@ const M = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
|
1065
1065
|
* Returns true if the string could be used as a segment in a field path
|
|
1066
1066
|
* without escaping.
|
|
1067
1067
|
*/ static isValidIdentifier(e) {
|
|
1068
|
-
return
|
|
1068
|
+
return F.test(e);
|
|
1069
1069
|
}
|
|
1070
1070
|
canonicalString() {
|
|
1071
1071
|
return this.toArray().map((e => (e = e.replace(/\\/g, "\\\\").replace(/`/g, "\\`"),
|
|
@@ -1097,21 +1097,21 @@ const M = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
|
1097
1097
|
const t = [];
|
|
1098
1098
|
let n = "", r = 0;
|
|
1099
1099
|
const __PRIVATE_addCurrentSegment = () => {
|
|
1100
|
-
if (0 === n.length) throw new FirestoreError(
|
|
1100
|
+
if (0 === n.length) throw new FirestoreError(v.INVALID_ARGUMENT, `Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);
|
|
1101
1101
|
t.push(n), n = "";
|
|
1102
1102
|
};
|
|
1103
1103
|
let i = !1;
|
|
1104
1104
|
for (;r < e.length; ) {
|
|
1105
1105
|
const t = e[r];
|
|
1106
1106
|
if ("\\" === t) {
|
|
1107
|
-
if (r + 1 === e.length) throw new FirestoreError(
|
|
1107
|
+
if (r + 1 === e.length) throw new FirestoreError(v.INVALID_ARGUMENT, "Path has trailing escape character: " + e);
|
|
1108
1108
|
const t = e[r + 1];
|
|
1109
|
-
if ("\\" !== t && "." !== t && "`" !== t) throw new FirestoreError(
|
|
1109
|
+
if ("\\" !== t && "." !== t && "`" !== t) throw new FirestoreError(v.INVALID_ARGUMENT, "Path has invalid escape sequence: " + e);
|
|
1110
1110
|
n += t, r += 2;
|
|
1111
1111
|
} else "`" === t ? (i = !i, r++) : "." !== t || i ? (n += t, r++) : (__PRIVATE_addCurrentSegment(),
|
|
1112
1112
|
r++);
|
|
1113
1113
|
}
|
|
1114
|
-
if (__PRIVATE_addCurrentSegment(), i) throw new FirestoreError(
|
|
1114
|
+
if (__PRIVATE_addCurrentSegment(), i) throw new FirestoreError(v.INVALID_ARGUMENT, "Unterminated ` in path: " + e);
|
|
1115
1115
|
return new FieldPath$1(t);
|
|
1116
1116
|
}
|
|
1117
1117
|
static emptyPath() {
|
|
@@ -1363,7 +1363,7 @@ function __PRIVATE_indexOffsetComparator(e, t) {
|
|
|
1363
1363
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1364
1364
|
* See the License for the specific language governing permissions and
|
|
1365
1365
|
* limitations under the License.
|
|
1366
|
-
*/ const
|
|
1366
|
+
*/ const M = "The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";
|
|
1367
1367
|
|
|
1368
1368
|
/**
|
|
1369
1369
|
* A base class representing a persistence transaction, encapsulating both the
|
|
@@ -1410,7 +1410,7 @@ function __PRIVATE_indexOffsetComparator(e, t) {
|
|
|
1410
1410
|
* @param err - An error returned by a LocalStore operation.
|
|
1411
1411
|
* @returns A Promise that resolves after we recovered, or the original error.
|
|
1412
1412
|
*/ async function __PRIVATE_ignoreIfPrimaryLeaseLoss(e) {
|
|
1413
|
-
if (e.code !==
|
|
1413
|
+
if (e.code !== v.FAILED_PRECONDITION || e.message !== M) throw e;
|
|
1414
1414
|
__PRIVATE_logDebug("LocalStore", "Unexpectedly lost primary lease");
|
|
1415
1415
|
}
|
|
1416
1416
|
|
|
@@ -1721,7 +1721,7 @@ class __PRIVATE_SimpleDbTransaction {
|
|
|
1721
1721
|
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."));
|
|
1722
1722
|
}, r.onerror = t => {
|
|
1723
1723
|
const r = t.target.error;
|
|
1724
|
-
"VersionError" === r.name ? n(new FirestoreError(
|
|
1724
|
+
"VersionError" === r.name ? n(new FirestoreError(v.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(v.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));
|
|
1725
1725
|
}, r.onupgradeneeded = e => {
|
|
1726
1726
|
__PRIVATE_logDebug("SimpleDb", 'Database "' + this.name + '" requires upgrade from version:', e.oldVersion);
|
|
1727
1727
|
const t = e.target.result;
|
|
@@ -1808,7 +1808,7 @@ class __PRIVATE_SimpleDbTransaction {
|
|
|
1808
1808
|
|
|
1809
1809
|
/** An error that wraps exceptions that thrown during IndexedDB execution. */ class __PRIVATE_IndexedDbTransactionError extends FirestoreError {
|
|
1810
1810
|
constructor(e, t) {
|
|
1811
|
-
super(
|
|
1811
|
+
super(v.UNAVAILABLE, `IndexedDB transaction '${e}' failed: ${t}`), this.name = "IndexedDbTransactionError";
|
|
1812
1812
|
}
|
|
1813
1813
|
}
|
|
1814
1814
|
|
|
@@ -1992,7 +1992,7 @@ class __PRIVATE_SimpleDbTransaction {
|
|
|
1992
1992
|
}
|
|
1993
1993
|
|
|
1994
1994
|
// Guard so we only report the error once.
|
|
1995
|
-
let
|
|
1995
|
+
let x = !1;
|
|
1996
1996
|
|
|
1997
1997
|
function __PRIVATE_checkForAndReportiOSError(e) {
|
|
1998
1998
|
const t = __PRIVATE_SimpleDb.S(u());
|
|
@@ -2001,7 +2001,7 @@ function __PRIVATE_checkForAndReportiOSError(e) {
|
|
|
2001
2001
|
if (e.message.indexOf(t) >= 0) {
|
|
2002
2002
|
// Wrap error in a more descriptive one.
|
|
2003
2003
|
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.`);
|
|
2004
|
-
return
|
|
2004
|
+
return x || (x = !0,
|
|
2005
2005
|
// Throw a global exception outside of this promise chain, for the user to
|
|
2006
2006
|
// potentially catch.
|
|
2007
2007
|
setTimeout((() => {
|
|
@@ -2253,7 +2253,7 @@ function __PRIVATE_encodeResourcePath(e) {
|
|
|
2253
2253
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2254
2254
|
* See the License for the specific language governing permissions and
|
|
2255
2255
|
* limitations under the License.
|
|
2256
|
-
*/ const
|
|
2256
|
+
*/ const O = [ "userId", "batchId" ];
|
|
2257
2257
|
|
|
2258
2258
|
/**
|
|
2259
2259
|
* @license
|
|
@@ -2298,7 +2298,7 @@ function __PRIVATE_newDbDocumentMutationPrefixForPath(e, t) {
|
|
|
2298
2298
|
* there is no useful information to store as the value. The raw (unencoded)
|
|
2299
2299
|
* path cannot be stored because IndexedDb doesn't store prototype
|
|
2300
2300
|
* information.
|
|
2301
|
-
*/ const
|
|
2301
|
+
*/ const N = {}, B = [ "prefixPath", "collectionGroup", "readTime", "documentId" ], L = [ "prefixPath", "collectionGroup", "documentId" ], k = [ "collectionGroup", "readTime", "prefixPath", "documentId" ], q = [ "canonicalId", "targetId" ], Q = [ "targetId", "path" ], K = [ "path", "targetId" ], $ = [ "collectionId", "parent" ], U = [ "indexId", "uid" ], W = [ "uid", "sequenceNumber" ], G = [ "indexId", "uid", "arrayValue", "directionalValue", "orderedDocumentKey", "documentKey" ], z = [ "indexId", "uid", "orderedDocumentKey" ], j = [ "userId", "collectionPath", "documentId" ], H = [ "userId", "collectionPath", "largestBatchId" ], J = [ "userId", "collectionGroup", "largestBatchId" ], Y = [ ...[ ...[ ...[ ...[ "mutationQueues", "mutations", "documentMutations", "remoteDocuments", "targets", "owner", "targetGlobal", "targetDocuments" ], "clientMetadata" ], "remoteDocumentGlobal" ], "collectionParents" ], "bundles", "namedQueries" ], Z = [ ...Y, "documentOverlays" ], X = [ "mutationQueues", "mutations", "documentMutations", "remoteDocumentsV14", "targets", "owner", "targetGlobal", "targetDocuments", "clientMetadata", "remoteDocumentGlobal", "collectionParents", "bundles", "namedQueries", "documentOverlays" ], ee = X, te = [ ...ee, "indexConfiguration", "indexState", "indexEntries" ];
|
|
2302
2302
|
|
|
2303
2303
|
/**
|
|
2304
2304
|
* @license
|
|
@@ -3062,7 +3062,7 @@ function __PRIVATE_isBase64Available() {
|
|
|
3062
3062
|
|
|
3063
3063
|
ByteString.EMPTY_BYTE_STRING = new ByteString("");
|
|
3064
3064
|
|
|
3065
|
-
const
|
|
3065
|
+
const ne = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
3066
3066
|
|
|
3067
3067
|
/**
|
|
3068
3068
|
* Converts the possible Proto values for a timestamp value into a "seconds and
|
|
@@ -3076,7 +3076,7 @@ const re = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
3076
3076
|
// (millis), so we do some custom parsing here.
|
|
3077
3077
|
// Parse the nanos right out of the string.
|
|
3078
3078
|
let t = 0;
|
|
3079
|
-
const n =
|
|
3079
|
+
const n = ne.exec(e);
|
|
3080
3080
|
if (__PRIVATE_hardAssert(!!n), n[1]) {
|
|
3081
3081
|
// Pad the fraction out to 9 digits (nanos).
|
|
3082
3082
|
let e = n[1];
|
|
@@ -3243,7 +3243,7 @@ class DatabaseId {
|
|
|
3243
3243
|
* See the License for the specific language governing permissions and
|
|
3244
3244
|
* limitations under the License.
|
|
3245
3245
|
*/
|
|
3246
|
-
const
|
|
3246
|
+
const re = {
|
|
3247
3247
|
mapValue: {
|
|
3248
3248
|
fields: {
|
|
3249
3249
|
__type__: {
|
|
@@ -3251,7 +3251,7 @@ const ie = {
|
|
|
3251
3251
|
}
|
|
3252
3252
|
}
|
|
3253
3253
|
}
|
|
3254
|
-
},
|
|
3254
|
+
}, ie = {
|
|
3255
3255
|
nullValue: "NULL_VALUE"
|
|
3256
3256
|
};
|
|
3257
3257
|
|
|
@@ -3395,9 +3395,9 @@ function __PRIVATE_valueCompare(e, t) {
|
|
|
3395
3395
|
|
|
3396
3396
|
case 10 /* TypeOrder.ObjectValue */ :
|
|
3397
3397
|
return function __PRIVATE_compareMaps(e, t) {
|
|
3398
|
-
if (e ===
|
|
3399
|
-
if (e ===
|
|
3400
|
-
if (t ===
|
|
3398
|
+
if (e === re.mapValue && t === re.mapValue) return 0;
|
|
3399
|
+
if (e === re.mapValue) return 1;
|
|
3400
|
+
if (t === re.mapValue) return -1;
|
|
3401
3401
|
const n = e.fields || {}, r = Object.keys(n), i = t.fields || {}, s = Object.keys(i);
|
|
3402
3402
|
// Even though MapValues are likely sorted correctly based on their insertion
|
|
3403
3403
|
// order (e.g. when received from the backend), local modifications can bring
|
|
@@ -3573,7 +3573,7 @@ function isArray(e) {
|
|
|
3573
3573
|
}
|
|
3574
3574
|
|
|
3575
3575
|
/** Returns the lowest value for the given value type (inclusive). */ function __PRIVATE_valuesGetLowerBound(e) {
|
|
3576
|
-
return "nullValue" in e ?
|
|
3576
|
+
return "nullValue" in e ? ie : "booleanValue" in e ? {
|
|
3577
3577
|
booleanValue: !1
|
|
3578
3578
|
} : "integerValue" in e || "doubleValue" in e ? {
|
|
3579
3579
|
doubleValue: NaN
|
|
@@ -3619,7 +3619,7 @@ function isArray(e) {
|
|
|
3619
3619
|
arrayValue: {}
|
|
3620
3620
|
} : "arrayValue" in e ? {
|
|
3621
3621
|
mapValue: {}
|
|
3622
|
-
} : "mapValue" in e ?
|
|
3622
|
+
} : "mapValue" in e ? re : fail();
|
|
3623
3623
|
}
|
|
3624
3624
|
|
|
3625
3625
|
function __PRIVATE_lowerBoundCompare(e, t) {
|
|
@@ -4307,10 +4307,10 @@ function __PRIVATE_targetIsDocumentTarget(e) {
|
|
|
4307
4307
|
* the provided `fieldPath` (or the upper bound for an descending segment).
|
|
4308
4308
|
*/
|
|
4309
4309
|
function __PRIVATE_targetGetAscendingBound(e, t, n) {
|
|
4310
|
-
let r =
|
|
4310
|
+
let r = ie, i = !0;
|
|
4311
4311
|
// Process all filters to find a value for the current field segment
|
|
4312
4312
|
for (const n of __PRIVATE_targetGetFieldFiltersForPath(e, t)) {
|
|
4313
|
-
let e =
|
|
4313
|
+
let e = ie, t = !0;
|
|
4314
4314
|
switch (n.op) {
|
|
4315
4315
|
case "<" /* Operator.LESS_THAN */ :
|
|
4316
4316
|
case "<=" /* Operator.LESS_THAN_OR_EQUAL */ :
|
|
@@ -4329,7 +4329,7 @@ function __PRIVATE_targetGetAscendingBound(e, t, n) {
|
|
|
4329
4329
|
|
|
4330
4330
|
case "!=" /* Operator.NOT_EQUAL */ :
|
|
4331
4331
|
case "not-in" /* Operator.NOT_IN */ :
|
|
4332
|
-
e =
|
|
4332
|
+
e = ie;
|
|
4333
4333
|
// Remaining filters cannot be used as lower bounds.
|
|
4334
4334
|
}
|
|
4335
4335
|
__PRIVATE_lowerBoundCompare({
|
|
@@ -4365,10 +4365,10 @@ function __PRIVATE_targetGetAscendingBound(e, t, n) {
|
|
|
4365
4365
|
* Returns the value to use as the upper bound for ascending index segment at
|
|
4366
4366
|
* the provided `fieldPath` (or the lower bound for a descending segment).
|
|
4367
4367
|
*/ function __PRIVATE_targetGetDescendingBound(e, t, n) {
|
|
4368
|
-
let r =
|
|
4368
|
+
let r = re, i = !0;
|
|
4369
4369
|
// Process all filters to find a value for the current field segment
|
|
4370
4370
|
for (const n of __PRIVATE_targetGetFieldFiltersForPath(e, t)) {
|
|
4371
|
-
let e =
|
|
4371
|
+
let e = re, t = !0;
|
|
4372
4372
|
switch (n.op) {
|
|
4373
4373
|
case ">=" /* Operator.GREATER_THAN_OR_EQUAL */ :
|
|
4374
4374
|
case ">" /* Operator.GREATER_THAN */ :
|
|
@@ -4387,7 +4387,7 @@ function __PRIVATE_targetGetAscendingBound(e, t, n) {
|
|
|
4387
4387
|
|
|
4388
4388
|
case "!=" /* Operator.NOT_EQUAL */ :
|
|
4389
4389
|
case "not-in" /* Operator.NOT_IN */ :
|
|
4390
|
-
e =
|
|
4390
|
+
e = re;
|
|
4391
4391
|
// Remaining filters cannot be used as upper bounds.
|
|
4392
4392
|
}
|
|
4393
4393
|
__PRIVATE_upperBoundCompare({
|
|
@@ -4764,22 +4764,22 @@ function __PRIVATE_compareDocs(e, t, n) {
|
|
|
4764
4764
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4765
4765
|
* See the License for the specific language governing permissions and
|
|
4766
4766
|
* limitations under the License.
|
|
4767
|
-
*/ const
|
|
4767
|
+
*/ const se = new SortedMap(DocumentKey.comparator);
|
|
4768
4768
|
|
|
4769
4769
|
function __PRIVATE_mutableDocumentMap() {
|
|
4770
|
-
return
|
|
4770
|
+
return se;
|
|
4771
4771
|
}
|
|
4772
4772
|
|
|
4773
|
-
const
|
|
4773
|
+
const oe = new SortedMap(DocumentKey.comparator);
|
|
4774
4774
|
|
|
4775
4775
|
function documentMap(...e) {
|
|
4776
|
-
let t =
|
|
4776
|
+
let t = oe;
|
|
4777
4777
|
for (const n of e) t = t.insert(n.key, n);
|
|
4778
4778
|
return t;
|
|
4779
4779
|
}
|
|
4780
4780
|
|
|
4781
4781
|
function __PRIVATE_convertOverlayedDocumentMapToDocumentMap(e) {
|
|
4782
|
-
let t =
|
|
4782
|
+
let t = oe;
|
|
4783
4783
|
return e.forEach(((e, n) => t = t.insert(e, n.overlayedDocument))), t;
|
|
4784
4784
|
}
|
|
4785
4785
|
|
|
@@ -4795,20 +4795,20 @@ function __PRIVATE_newDocumentKeyMap() {
|
|
|
4795
4795
|
return new ObjectMap((e => e.toString()), ((e, t) => e.isEqual(t)));
|
|
4796
4796
|
}
|
|
4797
4797
|
|
|
4798
|
-
const
|
|
4798
|
+
const _e = new SortedMap(DocumentKey.comparator);
|
|
4799
4799
|
|
|
4800
|
-
const
|
|
4800
|
+
const ae = new SortedSet(DocumentKey.comparator);
|
|
4801
4801
|
|
|
4802
4802
|
function __PRIVATE_documentKeySet(...e) {
|
|
4803
|
-
let t =
|
|
4803
|
+
let t = ae;
|
|
4804
4804
|
for (const n of e) t = t.add(n);
|
|
4805
4805
|
return t;
|
|
4806
4806
|
}
|
|
4807
4807
|
|
|
4808
|
-
const
|
|
4808
|
+
const ue = new SortedSet(__PRIVATE_primitiveComparator);
|
|
4809
4809
|
|
|
4810
4810
|
function __PRIVATE_targetIdSet() {
|
|
4811
|
-
return
|
|
4811
|
+
return ue;
|
|
4812
4812
|
}
|
|
4813
4813
|
|
|
4814
4814
|
/**
|
|
@@ -5499,7 +5499,7 @@ class __PRIVATE_VerifyMutation extends Mutation {
|
|
|
5499
5499
|
*/ static from(e, t, n) {
|
|
5500
5500
|
__PRIVATE_hardAssert(e.mutations.length === n.length);
|
|
5501
5501
|
let r = function __PRIVATE_documentVersionMap() {
|
|
5502
|
-
return
|
|
5502
|
+
return _e;
|
|
5503
5503
|
}();
|
|
5504
5504
|
const i = e.mutations;
|
|
5505
5505
|
for (let e = 0; e < i.length; e++) r = r.insert(i[e].key, n[e].version);
|
|
@@ -5613,7 +5613,7 @@ class __PRIVATE_VerifyMutation extends Mutation {
|
|
|
5613
5613
|
* Important! The names of these identifiers matter because the string forms
|
|
5614
5614
|
* are used for reverse lookups from the webchannel stream. Do NOT change the
|
|
5615
5615
|
* names of these identifiers or change this into a const enum.
|
|
5616
|
-
*/ var
|
|
5616
|
+
*/ var ce, le;
|
|
5617
5617
|
|
|
5618
5618
|
/**
|
|
5619
5619
|
* Determines whether an error code represents a permanent error when received
|
|
@@ -5626,29 +5626,29 @@ function __PRIVATE_isPermanentError(e) {
|
|
|
5626
5626
|
default:
|
|
5627
5627
|
return fail();
|
|
5628
5628
|
|
|
5629
|
-
case
|
|
5630
|
-
case
|
|
5631
|
-
case
|
|
5632
|
-
case
|
|
5633
|
-
case
|
|
5634
|
-
case
|
|
5629
|
+
case v.CANCELLED:
|
|
5630
|
+
case v.UNKNOWN:
|
|
5631
|
+
case v.DEADLINE_EXCEEDED:
|
|
5632
|
+
case v.RESOURCE_EXHAUSTED:
|
|
5633
|
+
case v.INTERNAL:
|
|
5634
|
+
case v.UNAVAILABLE:
|
|
5635
5635
|
// Unauthenticated means something went wrong with our token and we need
|
|
5636
5636
|
// to retry with new credentials which will happen automatically.
|
|
5637
|
-
case
|
|
5637
|
+
case v.UNAUTHENTICATED:
|
|
5638
5638
|
return !1;
|
|
5639
5639
|
|
|
5640
|
-
case
|
|
5641
|
-
case
|
|
5642
|
-
case
|
|
5643
|
-
case
|
|
5644
|
-
case
|
|
5640
|
+
case v.INVALID_ARGUMENT:
|
|
5641
|
+
case v.NOT_FOUND:
|
|
5642
|
+
case v.ALREADY_EXISTS:
|
|
5643
|
+
case v.PERMISSION_DENIED:
|
|
5644
|
+
case v.FAILED_PRECONDITION:
|
|
5645
5645
|
// Aborted might be retried in some scenarios, but that is dependant on
|
|
5646
5646
|
// the context and should handled individually by the calling code.
|
|
5647
5647
|
// See https://cloud.google.com/apis/design/errors.
|
|
5648
|
-
case
|
|
5649
|
-
case
|
|
5650
|
-
case
|
|
5651
|
-
case
|
|
5648
|
+
case v.ABORTED:
|
|
5649
|
+
case v.OUT_OF_RANGE:
|
|
5650
|
+
case v.UNIMPLEMENTED:
|
|
5651
|
+
case v.DATA_LOSS:
|
|
5652
5652
|
return !0;
|
|
5653
5653
|
}
|
|
5654
5654
|
}
|
|
@@ -5676,58 +5676,58 @@ function __PRIVATE_mapCodeFromRpcCode(e) {
|
|
|
5676
5676
|
if (void 0 === e)
|
|
5677
5677
|
// This shouldn't normally happen, but in certain error cases (like trying
|
|
5678
5678
|
// to send invalid proto messages) we may get an error with no GRPC code.
|
|
5679
|
-
return __PRIVATE_logError("GRPC error has no .code"),
|
|
5679
|
+
return __PRIVATE_logError("GRPC error has no .code"), v.UNKNOWN;
|
|
5680
5680
|
switch (e) {
|
|
5681
|
-
case
|
|
5682
|
-
return
|
|
5681
|
+
case ce.OK:
|
|
5682
|
+
return v.OK;
|
|
5683
5683
|
|
|
5684
|
-
case
|
|
5685
|
-
return
|
|
5684
|
+
case ce.CANCELLED:
|
|
5685
|
+
return v.CANCELLED;
|
|
5686
5686
|
|
|
5687
|
-
case
|
|
5688
|
-
return
|
|
5687
|
+
case ce.UNKNOWN:
|
|
5688
|
+
return v.UNKNOWN;
|
|
5689
5689
|
|
|
5690
|
-
case
|
|
5691
|
-
return
|
|
5690
|
+
case ce.DEADLINE_EXCEEDED:
|
|
5691
|
+
return v.DEADLINE_EXCEEDED;
|
|
5692
5692
|
|
|
5693
|
-
case
|
|
5694
|
-
return
|
|
5693
|
+
case ce.RESOURCE_EXHAUSTED:
|
|
5694
|
+
return v.RESOURCE_EXHAUSTED;
|
|
5695
5695
|
|
|
5696
|
-
case
|
|
5697
|
-
return
|
|
5696
|
+
case ce.INTERNAL:
|
|
5697
|
+
return v.INTERNAL;
|
|
5698
5698
|
|
|
5699
|
-
case
|
|
5700
|
-
return
|
|
5699
|
+
case ce.UNAVAILABLE:
|
|
5700
|
+
return v.UNAVAILABLE;
|
|
5701
5701
|
|
|
5702
|
-
case
|
|
5703
|
-
return
|
|
5702
|
+
case ce.UNAUTHENTICATED:
|
|
5703
|
+
return v.UNAUTHENTICATED;
|
|
5704
5704
|
|
|
5705
|
-
case
|
|
5706
|
-
return
|
|
5705
|
+
case ce.INVALID_ARGUMENT:
|
|
5706
|
+
return v.INVALID_ARGUMENT;
|
|
5707
5707
|
|
|
5708
|
-
case
|
|
5709
|
-
return
|
|
5708
|
+
case ce.NOT_FOUND:
|
|
5709
|
+
return v.NOT_FOUND;
|
|
5710
5710
|
|
|
5711
|
-
case
|
|
5712
|
-
return
|
|
5711
|
+
case ce.ALREADY_EXISTS:
|
|
5712
|
+
return v.ALREADY_EXISTS;
|
|
5713
5713
|
|
|
5714
|
-
case
|
|
5715
|
-
return
|
|
5714
|
+
case ce.PERMISSION_DENIED:
|
|
5715
|
+
return v.PERMISSION_DENIED;
|
|
5716
5716
|
|
|
5717
|
-
case
|
|
5718
|
-
return
|
|
5717
|
+
case ce.FAILED_PRECONDITION:
|
|
5718
|
+
return v.FAILED_PRECONDITION;
|
|
5719
5719
|
|
|
5720
|
-
case
|
|
5721
|
-
return
|
|
5720
|
+
case ce.ABORTED:
|
|
5721
|
+
return v.ABORTED;
|
|
5722
5722
|
|
|
5723
|
-
case
|
|
5724
|
-
return
|
|
5723
|
+
case ce.OUT_OF_RANGE:
|
|
5724
|
+
return v.OUT_OF_RANGE;
|
|
5725
5725
|
|
|
5726
|
-
case
|
|
5727
|
-
return
|
|
5726
|
+
case ce.UNIMPLEMENTED:
|
|
5727
|
+
return v.UNIMPLEMENTED;
|
|
5728
5728
|
|
|
5729
|
-
case
|
|
5730
|
-
return
|
|
5729
|
+
case ce.DATA_LOSS:
|
|
5730
|
+
return v.DATA_LOSS;
|
|
5731
5731
|
|
|
5732
5732
|
default:
|
|
5733
5733
|
return fail();
|
|
@@ -5741,14 +5741,14 @@ function __PRIVATE_mapCodeFromRpcCode(e) {
|
|
|
5741
5741
|
* "UNKNOWN", etc.)
|
|
5742
5742
|
* @returns The equivalent Code. Non-matching responses are mapped to
|
|
5743
5743
|
* Code.UNKNOWN.
|
|
5744
|
-
*/ (
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
-
|
|
5750
|
-
|
|
5751
|
-
|
|
5744
|
+
*/ (le = ce || (ce = {}))[le.OK = 0] = "OK", le[le.CANCELLED = 1] = "CANCELLED",
|
|
5745
|
+
le[le.UNKNOWN = 2] = "UNKNOWN", le[le.INVALID_ARGUMENT = 3] = "INVALID_ARGUMENT",
|
|
5746
|
+
le[le.DEADLINE_EXCEEDED = 4] = "DEADLINE_EXCEEDED", le[le.NOT_FOUND = 5] = "NOT_FOUND",
|
|
5747
|
+
le[le.ALREADY_EXISTS = 6] = "ALREADY_EXISTS", le[le.PERMISSION_DENIED = 7] = "PERMISSION_DENIED",
|
|
5748
|
+
le[le.UNAUTHENTICATED = 16] = "UNAUTHENTICATED", le[le.RESOURCE_EXHAUSTED = 8] = "RESOURCE_EXHAUSTED",
|
|
5749
|
+
le[le.FAILED_PRECONDITION = 9] = "FAILED_PRECONDITION", le[le.ABORTED = 10] = "ABORTED",
|
|
5750
|
+
le[le.OUT_OF_RANGE = 11] = "OUT_OF_RANGE", le[le.UNIMPLEMENTED = 12] = "UNIMPLEMENTED",
|
|
5751
|
+
le[le.INTERNAL = 13] = "INTERNAL", le[le.UNAVAILABLE = 14] = "UNAVAILABLE", le[le.DATA_LOSS = 15] = "DATA_LOSS";
|
|
5752
5752
|
|
|
5753
5753
|
/**
|
|
5754
5754
|
* @license
|
|
@@ -5773,7 +5773,7 @@ he[he.INTERNAL = 13] = "INTERNAL", he[he.UNAVAILABLE = 14] = "UNAVAILABLE", he[h
|
|
|
5773
5773
|
* integration tests that have registered callbacks to be notified of events
|
|
5774
5774
|
* that happen during the test execution.
|
|
5775
5775
|
*/
|
|
5776
|
-
let
|
|
5776
|
+
let he = null;
|
|
5777
5777
|
|
|
5778
5778
|
/**
|
|
5779
5779
|
* Sets the value of the `testingHooksSpi` object.
|
|
@@ -5821,7 +5821,7 @@ function __PRIVATE_newTextEncoder() {
|
|
|
5821
5821
|
* See the License for the specific language governing permissions and
|
|
5822
5822
|
* limitations under the License.
|
|
5823
5823
|
*/
|
|
5824
|
-
const
|
|
5824
|
+
const Pe = new A([ 4294967295, 4294967295 ], 0);
|
|
5825
5825
|
|
|
5826
5826
|
// Hash a string using md5 hashing algorithm.
|
|
5827
5827
|
function __PRIVATE_getMd5HashValue(e) {
|
|
@@ -5856,7 +5856,7 @@ class BloomFilter {
|
|
|
5856
5856
|
// Calculate hashed value h(i) = h1 + (i * h2).
|
|
5857
5857
|
let r = e.add(t.multiply(A.fromNumber(n)));
|
|
5858
5858
|
// Wrap if hash value overflow 64bit.
|
|
5859
|
-
return 1 === r.compare(
|
|
5859
|
+
return 1 === r.compare(Pe) && (r = new A([ r.getBits(0), r.getBits(1) ], 0)),
|
|
5860
5860
|
r.modulo(this.Ee).toNumber();
|
|
5861
5861
|
}
|
|
5862
5862
|
// Return whether the bit on the given index in the bitmap is set to 1.
|
|
@@ -6274,7 +6274,7 @@ class __PRIVATE_WatchChangeAggregator {
|
|
|
6274
6274
|
const e = 2 /* BloomFilterApplicationStatus.FalsePositive */ === i ? "TargetPurposeExistenceFilterMismatchBloom" /* TargetPurpose.ExistenceFilterMismatchBloom */ : "TargetPurposeExistenceFilterMismatch" /* TargetPurpose.ExistenceFilterMismatch */;
|
|
6275
6275
|
this.Ke = this.Ke.insert(t, e);
|
|
6276
6276
|
}
|
|
6277
|
-
null ==
|
|
6277
|
+
null == he || he.tt(function __PRIVATE_createExistenceFilterMismatchInfoForTestingHooks(e, t, n, r, i) {
|
|
6278
6278
|
var s, o, _, a, u, c;
|
|
6279
6279
|
const l = {
|
|
6280
6280
|
localCacheCount: e,
|
|
@@ -6490,13 +6490,13 @@ function __PRIVATE_snapshotChangesMap() {
|
|
|
6490
6490
|
return new SortedMap(DocumentKey.comparator);
|
|
6491
6491
|
}
|
|
6492
6492
|
|
|
6493
|
-
const
|
|
6493
|
+
const Ie = (() => {
|
|
6494
6494
|
const e = {
|
|
6495
6495
|
asc: "ASCENDING",
|
|
6496
6496
|
desc: "DESCENDING"
|
|
6497
6497
|
};
|
|
6498
6498
|
return e;
|
|
6499
|
-
})(),
|
|
6499
|
+
})(), Te = (() => {
|
|
6500
6500
|
const e = {
|
|
6501
6501
|
"<": "LESS_THAN",
|
|
6502
6502
|
"<=": "LESS_THAN_OR_EQUAL",
|
|
@@ -6510,7 +6510,7 @@ const Te = (() => {
|
|
|
6510
6510
|
"array-contains-any": "ARRAY_CONTAINS_ANY"
|
|
6511
6511
|
};
|
|
6512
6512
|
return e;
|
|
6513
|
-
})(),
|
|
6513
|
+
})(), Ee = (() => {
|
|
6514
6514
|
const e = {
|
|
6515
6515
|
and: "AND",
|
|
6516
6516
|
or: "OR"
|
|
@@ -6607,8 +6607,8 @@ function __PRIVATE_toName(e, t) {
|
|
|
6607
6607
|
|
|
6608
6608
|
function fromName(e, t) {
|
|
6609
6609
|
const n = __PRIVATE_fromResourceName(t);
|
|
6610
|
-
if (n.get(1) !== e.databaseId.projectId) throw new FirestoreError(
|
|
6611
|
-
if (n.get(3) !== e.databaseId.database) throw new FirestoreError(
|
|
6610
|
+
if (n.get(1) !== e.databaseId.projectId) throw new FirestoreError(v.INVALID_ARGUMENT, "Tried to deserialize key from different project: " + n.get(1) + " vs " + e.databaseId.projectId);
|
|
6611
|
+
if (n.get(3) !== e.databaseId.database) throw new FirestoreError(v.INVALID_ARGUMENT, "Tried to deserialize key from different database: " + n.get(3) + " vs " + e.databaseId.database);
|
|
6612
6612
|
return new DocumentKey(__PRIVATE_extractLocalPathFromResourceName(n));
|
|
6613
6613
|
}
|
|
6614
6614
|
|
|
@@ -6678,7 +6678,7 @@ function __PRIVATE_fromWatchChange(e, t) {
|
|
|
6678
6678
|
ByteString.fromBase64String(t || "")) : (__PRIVATE_hardAssert(void 0 === t || t instanceof Uint8Array),
|
|
6679
6679
|
ByteString.fromUint8Array(t || new Uint8Array));
|
|
6680
6680
|
}(e, t.targetChange.resumeToken), o = t.targetChange.cause, _ = o && function __PRIVATE_fromRpcStatus(e) {
|
|
6681
|
-
const t = void 0 === e.code ?
|
|
6681
|
+
const t = void 0 === e.code ? v.UNKNOWN : __PRIVATE_mapCodeFromRpcCode(e.code);
|
|
6682
6682
|
return new FirestoreError(t, e.message || "");
|
|
6683
6683
|
}(o);
|
|
6684
6684
|
n = new __PRIVATE_WatchTargetChange(r, i, s, _ || null);
|
|
@@ -7034,15 +7034,15 @@ function __PRIVATE_fromFilter(e) {
|
|
|
7034
7034
|
}
|
|
7035
7035
|
|
|
7036
7036
|
function __PRIVATE_toDirection(e) {
|
|
7037
|
-
return
|
|
7037
|
+
return Ie[e];
|
|
7038
7038
|
}
|
|
7039
7039
|
|
|
7040
7040
|
function __PRIVATE_toOperatorName(e) {
|
|
7041
|
-
return
|
|
7041
|
+
return Te[e];
|
|
7042
7042
|
}
|
|
7043
7043
|
|
|
7044
7044
|
function __PRIVATE_toCompositeOperatorName(e) {
|
|
7045
|
-
return
|
|
7045
|
+
return Ee[e];
|
|
7046
7046
|
}
|
|
7047
7047
|
|
|
7048
7048
|
function __PRIVATE_toFieldPathReference(e) {
|
|
@@ -8363,7 +8363,7 @@ function __PRIVATE_applyDistributionFieldAndCompositeFilters(e, t) {
|
|
|
8363
8363
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
8364
8364
|
* See the License for the specific language governing permissions and
|
|
8365
8365
|
* limitations under the License.
|
|
8366
|
-
*/ const
|
|
8366
|
+
*/ const de = new Uint8Array(0);
|
|
8367
8367
|
|
|
8368
8368
|
/**
|
|
8369
8369
|
* A persisted implementation of IndexManager.
|
|
@@ -8577,7 +8577,7 @@ class __PRIVATE_IndexedDbIndexManager {
|
|
|
8577
8577
|
// combined with the values from the query bounds.
|
|
8578
8578
|
const _ = (null != t ? t.length : 1) * Math.max(n.length, i.length), a = _ / (null != t ? t.length : 1), u = [];
|
|
8579
8579
|
for (let c = 0; c < _; ++c) {
|
|
8580
|
-
const _ = t ? this.In(t[c / a]) :
|
|
8580
|
+
const _ = t ? this.In(t[c / a]) : de, l = this.Tn(e, _, n[c % a], r), h = this.En(e, _, i[c % a], s), P = o.map((t => this.Tn(e, _, t,
|
|
8581
8581
|
/* inclusive= */ !0)));
|
|
8582
8582
|
u.push(...this.createRange(l, h, P));
|
|
8583
8583
|
}
|
|
@@ -8774,7 +8774,7 @@ class __PRIVATE_IndexedDbIndexManager {
|
|
|
8774
8774
|
if (null != i) {
|
|
8775
8775
|
const s = e.data.field(i.fieldPath);
|
|
8776
8776
|
if (isArray(s)) for (const i of s.arrayValue.values || []) n = n.add(new __PRIVATE_IndexEntry(t.indexId, e.key, this.In(i), r));
|
|
8777
|
-
} else n = n.add(new __PRIVATE_IndexEntry(t.indexId, e.key,
|
|
8777
|
+
} else n = n.add(new __PRIVATE_IndexEntry(t.indexId, e.key, de, r));
|
|
8778
8778
|
return n;
|
|
8779
8779
|
}
|
|
8780
8780
|
/**
|
|
@@ -8849,7 +8849,7 @@ class __PRIVATE_IndexedDbIndexManager {
|
|
|
8849
8849
|
// If we encounter two bounds that will create an unmatchable key range,
|
|
8850
8850
|
// then we return an empty set of key ranges.
|
|
8851
8851
|
if (this.bn(r[e], r[e + 1])) return [];
|
|
8852
|
-
const t = [ r[e].indexId, this.uid, r[e].arrayValue, r[e].directionalValue,
|
|
8852
|
+
const t = [ r[e].indexId, this.uid, r[e].arrayValue, r[e].directionalValue, de, [] ], n = [ r[e + 1].indexId, this.uid, r[e + 1].arrayValue, r[e + 1].directionalValue, de, [] ];
|
|
8853
8853
|
i.push(IDBKeyRange.bound(t, n));
|
|
8854
8854
|
}
|
|
8855
8855
|
return i;
|
|
@@ -8917,7 +8917,7 @@ function __PRIVATE_getMinOffsetFromFieldIndexes(e) {
|
|
|
8917
8917
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
8918
8918
|
* See the License for the specific language governing permissions and
|
|
8919
8919
|
* limitations under the License.
|
|
8920
|
-
*/ const
|
|
8920
|
+
*/ const Ae = {
|
|
8921
8921
|
didRun: !1,
|
|
8922
8922
|
sequenceNumbersCollected: 0,
|
|
8923
8923
|
targetsRemoved: 0,
|
|
@@ -9081,7 +9081,7 @@ class __PRIVATE_IndexedDbMutationQueue {
|
|
|
9081
9081
|
let c = new SortedSet(((e, t) => __PRIVATE_primitiveComparator(e.canonicalString(), t.canonicalString())));
|
|
9082
9082
|
for (const e of r) {
|
|
9083
9083
|
const t = __PRIVATE_newDbDocumentMutationKey(this.userId, e.key.path, o);
|
|
9084
|
-
c = c.add(e.key.path.popLast()), u.push(s.put(a)), u.push(i.put(t,
|
|
9084
|
+
c = c.add(e.key.path.popLast()), u.push(s.put(a)), u.push(i.put(t, N));
|
|
9085
9085
|
}
|
|
9086
9086
|
return c.forEach((t => {
|
|
9087
9087
|
u.push(this.indexManager.addToCollectionParentIndex(e, t));
|
|
@@ -9650,8 +9650,8 @@ class __PRIVATE_TargetIdGenerator {
|
|
|
9650
9650
|
}
|
|
9651
9651
|
collect(e, t) {
|
|
9652
9652
|
return -1 === this.params.cacheSizeCollectionThreshold ? (__PRIVATE_logDebug("LruGarbageCollector", "Garbage collection skipped; disabled"),
|
|
9653
|
-
PersistencePromise.resolve(
|
|
9654
|
-
|
|
9653
|
+
PersistencePromise.resolve(Ae)) : this.getCacheSize(e).next((n => n < this.params.cacheSizeCollectionThreshold ? (__PRIVATE_logDebug("LruGarbageCollector", `Garbage collection skipped; Cache size ${n} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),
|
|
9654
|
+
Ae) : this.Jn(e, t)));
|
|
9655
9655
|
}
|
|
9656
9656
|
getCacheSize(e) {
|
|
9657
9657
|
return this.zn.getCacheSize(e);
|
|
@@ -11410,7 +11410,7 @@ class __PRIVATE_MemoryLruDelegate {
|
|
|
11410
11410
|
e.createObjectStore("mutations", {
|
|
11411
11411
|
keyPath: "batchId",
|
|
11412
11412
|
autoIncrement: !0
|
|
11413
|
-
}).createIndex("userMutationsIndex",
|
|
11413
|
+
}).createIndex("userMutationsIndex", O, {
|
|
11414
11414
|
unique: !0
|
|
11415
11415
|
}), e.createObjectStore("documentMutations");
|
|
11416
11416
|
}
|
|
@@ -11455,7 +11455,7 @@ class __PRIVATE_MemoryLruDelegate {
|
|
|
11455
11455
|
e.createObjectStore("mutations", {
|
|
11456
11456
|
keyPath: "batchId",
|
|
11457
11457
|
autoIncrement: !0
|
|
11458
|
-
}).createIndex("userMutationsIndex",
|
|
11458
|
+
}).createIndex("userMutationsIndex", O, {
|
|
11459
11459
|
unique: !0
|
|
11460
11460
|
});
|
|
11461
11461
|
const r = t.store("mutations"), i = n.map((e => r.put(e)));
|
|
@@ -11492,19 +11492,19 @@ class __PRIVATE_MemoryLruDelegate {
|
|
|
11492
11492
|
}))), n < 12 && r >= 12 && (s = s.next((() => {
|
|
11493
11493
|
!function __PRIVATE_createDocumentOverlayStore(e) {
|
|
11494
11494
|
const t = e.createObjectStore("documentOverlays", {
|
|
11495
|
-
keyPath:
|
|
11495
|
+
keyPath: j
|
|
11496
11496
|
});
|
|
11497
|
-
t.createIndex("collectionPathOverlayIndex",
|
|
11497
|
+
t.createIndex("collectionPathOverlayIndex", H, {
|
|
11498
11498
|
unique: !1
|
|
11499
|
-
}), t.createIndex("collectionGroupOverlayIndex",
|
|
11499
|
+
}), t.createIndex("collectionGroupOverlayIndex", J, {
|
|
11500
11500
|
unique: !1
|
|
11501
11501
|
});
|
|
11502
11502
|
}(e);
|
|
11503
11503
|
}))), n < 13 && r >= 13 && (s = s.next((() => function __PRIVATE_createRemoteDocumentCache(e) {
|
|
11504
11504
|
const t = e.createObjectStore("remoteDocumentsV14", {
|
|
11505
|
-
keyPath:
|
|
11505
|
+
keyPath: B
|
|
11506
11506
|
});
|
|
11507
|
-
t.createIndex("documentKeyIndex",
|
|
11507
|
+
t.createIndex("documentKeyIndex", L), t.createIndex("collectionGroupIndex", k);
|
|
11508
11508
|
}(e))).next((() => this.ri(e, i))).next((() => e.deleteObjectStore("remoteDocuments")))),
|
|
11509
11509
|
n < 14 && r >= 14 && (s = s.next((() => this.ii(e, i)))), n < 15 && r >= 15 && (s = s.next((() => function __PRIVATE_createFieldIndex(e) {
|
|
11510
11510
|
e.createObjectStore("indexConfiguration", {
|
|
@@ -11514,13 +11514,13 @@ class __PRIVATE_MemoryLruDelegate {
|
|
|
11514
11514
|
unique: !1
|
|
11515
11515
|
});
|
|
11516
11516
|
e.createObjectStore("indexState", {
|
|
11517
|
-
keyPath:
|
|
11518
|
-
}).createIndex("sequenceNumberIndex",
|
|
11517
|
+
keyPath: U
|
|
11518
|
+
}).createIndex("sequenceNumberIndex", W, {
|
|
11519
11519
|
unique: !1
|
|
11520
11520
|
});
|
|
11521
11521
|
e.createObjectStore("indexEntries", {
|
|
11522
|
-
keyPath:
|
|
11523
|
-
}).createIndex("documentKeyIndex",
|
|
11522
|
+
keyPath: G
|
|
11523
|
+
}).createIndex("documentKeyIndex", z, {
|
|
11524
11524
|
unique: !1
|
|
11525
11525
|
});
|
|
11526
11526
|
}(e)))), s;
|
|
@@ -11569,7 +11569,7 @@ class __PRIVATE_MemoryLruDelegate {
|
|
|
11569
11569
|
ti(e, t) {
|
|
11570
11570
|
// Create the index.
|
|
11571
11571
|
e.createObjectStore("collectionParents", {
|
|
11572
|
-
keyPath:
|
|
11572
|
+
keyPath: $
|
|
11573
11573
|
});
|
|
11574
11574
|
const n = t.store("collectionParents"), r = new __PRIVATE_MemoryCollectionParentIndex, addEntry = e => {
|
|
11575
11575
|
if (r.add(e)) {
|
|
@@ -11654,19 +11654,19 @@ class __PRIVATE_MemoryLruDelegate {
|
|
|
11654
11654
|
|
|
11655
11655
|
function __PRIVATE_createQueryCache(e) {
|
|
11656
11656
|
e.createObjectStore("targetDocuments", {
|
|
11657
|
-
keyPath:
|
|
11658
|
-
}).createIndex("documentTargetsIndex",
|
|
11657
|
+
keyPath: Q
|
|
11658
|
+
}).createIndex("documentTargetsIndex", K, {
|
|
11659
11659
|
unique: !0
|
|
11660
11660
|
});
|
|
11661
11661
|
// NOTE: This is unique only because the TargetId is the suffix.
|
|
11662
11662
|
e.createObjectStore("targets", {
|
|
11663
11663
|
keyPath: "targetId"
|
|
11664
|
-
}).createIndex("queryTargetsIndex",
|
|
11664
|
+
}).createIndex("queryTargetsIndex", q, {
|
|
11665
11665
|
unique: !0
|
|
11666
11666
|
}), e.createObjectStore("targetGlobal");
|
|
11667
11667
|
}
|
|
11668
11668
|
|
|
11669
|
-
const
|
|
11669
|
+
const Re = "Failed to obtain exclusive access to the persistence layer. To allow shared access, multi-tab synchronization has to be enabled in all tabs. If you are using `experimentalForceOwningTab:true`, make sure that only one tab has persistence enabled at any given time.";
|
|
11670
11670
|
|
|
11671
11671
|
/**
|
|
11672
11672
|
* Oldest acceptable age in milliseconds for client metadata before the client
|
|
@@ -11742,7 +11742,7 @@ class __PRIVATE_IndexedDbPersistence {
|
|
|
11742
11742
|
/** The last time we garbage collected the client metadata object store. */
|
|
11743
11743
|
this.hi = Number.NEGATIVE_INFINITY,
|
|
11744
11744
|
/** A listener to notify on primary state changes. */
|
|
11745
|
-
this.Pi = e => Promise.resolve(), !__PRIVATE_IndexedDbPersistence.D()) throw new FirestoreError(
|
|
11745
|
+
this.Pi = e => Promise.resolve(), !__PRIVATE_IndexedDbPersistence.D()) throw new FirestoreError(v.UNIMPLEMENTED, "This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");
|
|
11746
11746
|
this.referenceDelegate = new __PRIVATE_IndexedDbLruDelegateImpl(this, r), this.Ii = t + "main",
|
|
11747
11747
|
this.serializer = new __PRIVATE_LocalSerializer(_), this.Ti = new __PRIVATE_SimpleDb(this.Ii, this.ai, new __PRIVATE_SchemaConverter(this.serializer)),
|
|
11748
11748
|
this.qr = new __PRIVATE_IndexedDbTargetCache(this.referenceDelegate, this.serializer),
|
|
@@ -11762,7 +11762,7 @@ class __PRIVATE_IndexedDbPersistence {
|
|
|
11762
11762
|
if (!this.isPrimary && !this.allowTabSynchronization)
|
|
11763
11763
|
// Fail `start()` if `synchronizeTabs` is disabled and we cannot
|
|
11764
11764
|
// obtain the primary lease.
|
|
11765
|
-
throw new FirestoreError(
|
|
11765
|
+
throw new FirestoreError(v.FAILED_PRECONDITION, Re);
|
|
11766
11766
|
return this.Ai(), this.Ri(), this.Vi(), this.runTransaction("getHighestListenSequenceNumber", "readonly", (e => this.qr.getHighestSequenceNumber(e)));
|
|
11767
11767
|
})).then((e => {
|
|
11768
11768
|
this.Lr = new __PRIVATE_ListenSequence(e, this.oi);
|
|
@@ -11904,7 +11904,7 @@ class __PRIVATE_IndexedDbPersistence {
|
|
|
11904
11904
|
// settings is not supported.
|
|
11905
11905
|
// TODO(b/114226234): Remove this check when `synchronizeTabs` can
|
|
11906
11906
|
// no longer be turned off.
|
|
11907
|
-
throw new FirestoreError(
|
|
11907
|
+
throw new FirestoreError(v.FAILED_PRECONDITION, Re);
|
|
11908
11908
|
return !1;
|
|
11909
11909
|
}
|
|
11910
11910
|
}
|
|
@@ -11974,7 +11974,7 @@ class __PRIVATE_IndexedDbPersistence {
|
|
|
11974
11974
|
const r = "readonly" === t ? "readonly" : "readwrite", i =
|
|
11975
11975
|
/** Returns the object stores for the provided schema. */
|
|
11976
11976
|
function __PRIVATE_getObjectStores(e) {
|
|
11977
|
-
return 15 === e ?
|
|
11977
|
+
return 15 === e ? te : 14 === e ? ee : 13 === e ? X : 12 === e ? Z : 11 === e ? Y : void fail();
|
|
11978
11978
|
}(this.ai);
|
|
11979
11979
|
let s;
|
|
11980
11980
|
// Do all transactions as readwrite against all object stores, since we
|
|
@@ -11982,7 +11982,7 @@ class __PRIVATE_IndexedDbPersistence {
|
|
|
11982
11982
|
return this.Ti.runTransaction(e, r, i, (r => (s = new __PRIVATE_IndexedDbTransaction(r, this.Lr ? this.Lr.next() : __PRIVATE_ListenSequence._e),
|
|
11983
11983
|
"readwrite-primary" === t ? this.fi(s).next((e => !!e || this.gi(s))).next((t => {
|
|
11984
11984
|
if (!t) throw __PRIVATE_logError(`Failed to obtain primary lease for action '${e}'.`),
|
|
11985
|
-
this.isPrimary = !1, this.si.enqueueRetryable((() => this.Pi(!1))), new FirestoreError(
|
|
11985
|
+
this.isPrimary = !1, this.si.enqueueRetryable((() => this.Pi(!1))), new FirestoreError(v.FAILED_PRECONDITION, M);
|
|
11986
11986
|
return n(s);
|
|
11987
11987
|
})).next((e => this.yi(s).next((() => e)))) : this.Li(s).next((() => n(s)))))).then((e => (s.raiseOnCommittedEvent(),
|
|
11988
11988
|
e)));
|
|
@@ -11995,7 +11995,7 @@ class __PRIVATE_IndexedDbPersistence {
|
|
|
11995
11995
|
// be turned off.
|
|
11996
11996
|
Li(e) {
|
|
11997
11997
|
return __PRIVATE_primaryClientStore(e).get("owner").next((e => {
|
|
11998
|
-
if (null !== e && this.Di(e.leaseTimestampMs, 5e3) && !this.Fi(e.ownerId) && !this.wi(e) && !(this._i || this.allowTabSynchronization && e.allowTabSynchronization)) throw new FirestoreError(
|
|
11998
|
+
if (null !== e && this.Di(e.leaseTimestampMs, 5e3) && !this.Fi(e.ownerId) && !this.wi(e) && !(this._i || this.allowTabSynchronization && e.allowTabSynchronization)) throw new FirestoreError(v.FAILED_PRECONDITION, Re);
|
|
11999
11999
|
}));
|
|
12000
12000
|
}
|
|
12001
12001
|
/**
|
|
@@ -13480,7 +13480,7 @@ class __PRIVATE_BrowserConnectivityMonitor {
|
|
|
13480
13480
|
/**
|
|
13481
13481
|
* The value returned from the most recent invocation of
|
|
13482
13482
|
* `generateUniqueDebugId()`, or null if it has never been invoked.
|
|
13483
|
-
*/ let
|
|
13483
|
+
*/ let Ve = null;
|
|
13484
13484
|
|
|
13485
13485
|
/**
|
|
13486
13486
|
* Generates and returns an initial value for `lastUniqueDebugId`.
|
|
@@ -13505,9 +13505,9 @@ class __PRIVATE_BrowserConnectivityMonitor {
|
|
|
13505
13505
|
* @return the 10-character generated ID (e.g. "0xa1b2c3d4").
|
|
13506
13506
|
*/
|
|
13507
13507
|
function __PRIVATE_generateUniqueDebugId() {
|
|
13508
|
-
return null ===
|
|
13508
|
+
return null === Ve ? Ve = function __PRIVATE_generateInitialUniqueDebugId() {
|
|
13509
13509
|
return 268435456 + Math.round(2147483648 * Math.random());
|
|
13510
|
-
}() :
|
|
13510
|
+
}() : Ve++, "0x" + Ve.toString(16);
|
|
13511
13511
|
}
|
|
13512
13512
|
|
|
13513
13513
|
/**
|
|
@@ -13525,7 +13525,7 @@ function __PRIVATE_generateUniqueDebugId() {
|
|
|
13525
13525
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13526
13526
|
* See the License for the specific language governing permissions and
|
|
13527
13527
|
* limitations under the License.
|
|
13528
|
-
*/ const
|
|
13528
|
+
*/ const me = {
|
|
13529
13529
|
BatchGetDocuments: "batchGet",
|
|
13530
13530
|
Commit: "commit",
|
|
13531
13531
|
RunQuery: "runQuery",
|
|
@@ -13603,7 +13603,7 @@ class __PRIVATE_StreamBridge {
|
|
|
13603
13603
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13604
13604
|
* See the License for the specific language governing permissions and
|
|
13605
13605
|
* limitations under the License.
|
|
13606
|
-
*/ const
|
|
13606
|
+
*/ const fe = "WebChannelConnection";
|
|
13607
13607
|
|
|
13608
13608
|
class __PRIVATE_WebChannelConnection extends
|
|
13609
13609
|
/**
|
|
@@ -13647,7 +13647,7 @@ class __PRIVATE_RestConnection {
|
|
|
13647
13647
|
// SDK_VERSION is updated to different value at runtime depending on the entry point,
|
|
13648
13648
|
// so we need to get its value when we need it in a function.
|
|
13649
13649
|
function __PRIVATE_getGoogApiClientValue() {
|
|
13650
|
-
return "gl-js/ fire/" +
|
|
13650
|
+
return "gl-js/ fire/" + D;
|
|
13651
13651
|
}(),
|
|
13652
13652
|
// Content-Type: text/plain will avoid preflight requests which might
|
|
13653
13653
|
// mess with CORS and redirects by proxies. If we add custom headers
|
|
@@ -13657,7 +13657,7 @@ class __PRIVATE_RestConnection {
|
|
|
13657
13657
|
t && t.headers.forEach(((t, n) => e[n] = t)), n && n.headers.forEach(((t, n) => e[n] = t));
|
|
13658
13658
|
}
|
|
13659
13659
|
So(e, t) {
|
|
13660
|
-
const n =
|
|
13660
|
+
const n = me[e];
|
|
13661
13661
|
return `${this.mo}/v1/${t}:${n}`;
|
|
13662
13662
|
}
|
|
13663
13663
|
} {
|
|
@@ -13674,17 +13674,17 @@ class __PRIVATE_RestConnection {
|
|
|
13674
13674
|
switch (_.getLastErrorCode()) {
|
|
13675
13675
|
case f.NO_ERROR:
|
|
13676
13676
|
const t = _.getResponseJson();
|
|
13677
|
-
__PRIVATE_logDebug(
|
|
13677
|
+
__PRIVATE_logDebug(fe, `XHR for RPC '${e}' ${i} received:`, JSON.stringify(t)),
|
|
13678
13678
|
s(t);
|
|
13679
13679
|
break;
|
|
13680
13680
|
|
|
13681
13681
|
case f.TIMEOUT:
|
|
13682
|
-
__PRIVATE_logDebug(
|
|
13682
|
+
__PRIVATE_logDebug(fe, `RPC '${e}' ${i} timed out`), o(new FirestoreError(v.DEADLINE_EXCEEDED, "Request time out"));
|
|
13683
13683
|
break;
|
|
13684
13684
|
|
|
13685
13685
|
case f.HTTP_ERROR:
|
|
13686
13686
|
const n = _.getStatus();
|
|
13687
|
-
if (__PRIVATE_logDebug(
|
|
13687
|
+
if (__PRIVATE_logDebug(fe, `RPC '${e}' ${i} failed with status:`, n, "response text:", _.getResponseText()),
|
|
13688
13688
|
n > 0) {
|
|
13689
13689
|
let e = _.getResponseJson();
|
|
13690
13690
|
Array.isArray(e) && (e = e[0]);
|
|
@@ -13692,25 +13692,25 @@ class __PRIVATE_RestConnection {
|
|
|
13692
13692
|
if (t && t.status && t.message) {
|
|
13693
13693
|
const e = function __PRIVATE_mapCodeFromHttpResponseErrorStatus(e) {
|
|
13694
13694
|
const t = e.toLowerCase().replace(/_/g, "-");
|
|
13695
|
-
return Object.values(
|
|
13695
|
+
return Object.values(v).indexOf(t) >= 0 ? t : v.UNKNOWN;
|
|
13696
13696
|
}(t.status);
|
|
13697
13697
|
o(new FirestoreError(e, t.message));
|
|
13698
|
-
} else o(new FirestoreError(
|
|
13698
|
+
} else o(new FirestoreError(v.UNKNOWN, "Server responded with status " + _.getStatus()));
|
|
13699
13699
|
} else
|
|
13700
13700
|
// If we received an HTTP_ERROR but there's no status code,
|
|
13701
13701
|
// it's most probably a connection issue
|
|
13702
|
-
o(new FirestoreError(
|
|
13702
|
+
o(new FirestoreError(v.UNAVAILABLE, "Connection failed."));
|
|
13703
13703
|
break;
|
|
13704
13704
|
|
|
13705
13705
|
default:
|
|
13706
13706
|
fail();
|
|
13707
13707
|
}
|
|
13708
13708
|
} finally {
|
|
13709
|
-
__PRIVATE_logDebug(
|
|
13709
|
+
__PRIVATE_logDebug(fe, `RPC '${e}' ${i} completed.`);
|
|
13710
13710
|
}
|
|
13711
13711
|
}));
|
|
13712
13712
|
const a = JSON.stringify(r);
|
|
13713
|
-
__PRIVATE_logDebug(
|
|
13713
|
+
__PRIVATE_logDebug(fe, `RPC '${e}' ${i} sending request:`, r), _.send(t, "POST", a, n, 15);
|
|
13714
13714
|
}));
|
|
13715
13715
|
}
|
|
13716
13716
|
vo(e, t, n) {
|
|
@@ -13738,9 +13738,8 @@ class __PRIVATE_RestConnection {
|
|
|
13738
13738
|
forceLongPolling: this.forceLongPolling,
|
|
13739
13739
|
detectBufferingProxy: this.autoDetectLongPolling
|
|
13740
13740
|
}, a = this.longPollingOptions.timeoutSeconds;
|
|
13741
|
-
void 0 !== a && (_.longPollingTimeout = Math.round(1e3 * a)), this.useFetchStreams && (
|
|
13742
|
-
|
|
13743
|
-
_.xmlHttpFactory = new y({})), this.bo(_.initMessageHeaders, t, n),
|
|
13741
|
+
void 0 !== a && (_.longPollingTimeout = Math.round(1e3 * a)), this.useFetchStreams && (_.useFetchStreams = !0),
|
|
13742
|
+
this.bo(_.initMessageHeaders, t, n),
|
|
13744
13743
|
// Sending the custom headers we just added to request.initMessageHeaders
|
|
13745
13744
|
// (Authorization, etc.) will trigger the browser to make a CORS preflight
|
|
13746
13745
|
// request because the XHR will no longer meet the criteria for a "simple"
|
|
@@ -13752,7 +13751,7 @@ class __PRIVATE_RestConnection {
|
|
|
13752
13751
|
// which is recognized by the webchannel backend.
|
|
13753
13752
|
_.encodeInitMessageHeaders = !0;
|
|
13754
13753
|
const u = i.join("");
|
|
13755
|
-
__PRIVATE_logDebug(
|
|
13754
|
+
__PRIVATE_logDebug(fe, `Creating RPC '${e}' stream ${r}: ${u}`, _);
|
|
13756
13755
|
const c = s.createWebChannel(u, _);
|
|
13757
13756
|
// WebChannel supports sending the first message with the handshake - saving
|
|
13758
13757
|
// a network round trip. However, it will have to call send in the same
|
|
@@ -13765,8 +13764,8 @@ class __PRIVATE_RestConnection {
|
|
|
13765
13764
|
// on a closed stream
|
|
13766
13765
|
const P = new __PRIVATE_StreamBridge({
|
|
13767
13766
|
co: t => {
|
|
13768
|
-
h ? __PRIVATE_logDebug(
|
|
13769
|
-
c.open(), l = !0), __PRIVATE_logDebug(
|
|
13767
|
+
h ? __PRIVATE_logDebug(fe, `Not sending because RPC '${e}' stream ${r} is closed:`, t) : (l || (__PRIVATE_logDebug(fe, `Opening RPC '${e}' stream ${r} transport.`),
|
|
13768
|
+
c.open(), l = !0), __PRIVATE_logDebug(fe, `RPC '${e}' stream ${r} sending:`, t),
|
|
13770
13769
|
c.send(t));
|
|
13771
13770
|
},
|
|
13772
13771
|
lo: () => c.close()
|
|
@@ -13787,15 +13786,15 @@ class __PRIVATE_RestConnection {
|
|
|
13787
13786
|
// exception and rethrow using a setTimeout so they become visible again.
|
|
13788
13787
|
// Note that eventually this function could go away if we are confident
|
|
13789
13788
|
// enough the code is exception free.
|
|
13790
|
-
return __PRIVATE_unguardedEventListen(c,
|
|
13791
|
-
h || __PRIVATE_logDebug(
|
|
13792
|
-
})), __PRIVATE_unguardedEventListen(c,
|
|
13793
|
-
h || (h = !0, __PRIVATE_logDebug(
|
|
13789
|
+
return __PRIVATE_unguardedEventListen(c, y.EventType.OPEN, (() => {
|
|
13790
|
+
h || __PRIVATE_logDebug(fe, `RPC '${e}' stream ${r} transport opened.`);
|
|
13791
|
+
})), __PRIVATE_unguardedEventListen(c, y.EventType.CLOSE, (() => {
|
|
13792
|
+
h || (h = !0, __PRIVATE_logDebug(fe, `RPC '${e}' stream ${r} transport closed`),
|
|
13794
13793
|
P.Ro());
|
|
13795
|
-
})), __PRIVATE_unguardedEventListen(c,
|
|
13796
|
-
h || (h = !0, __PRIVATE_logWarn(
|
|
13797
|
-
P.Ro(new FirestoreError(
|
|
13798
|
-
})), __PRIVATE_unguardedEventListen(c,
|
|
13794
|
+
})), __PRIVATE_unguardedEventListen(c, y.EventType.ERROR, (t => {
|
|
13795
|
+
h || (h = !0, __PRIVATE_logWarn(fe, `RPC '${e}' stream ${r} transport errored:`, t),
|
|
13796
|
+
P.Ro(new FirestoreError(v.UNAVAILABLE, "The operation could not be completed")));
|
|
13797
|
+
})), __PRIVATE_unguardedEventListen(c, y.EventType.MESSAGE, (t => {
|
|
13799
13798
|
var n;
|
|
13800
13799
|
if (!h) {
|
|
13801
13800
|
const i = t.data[0];
|
|
@@ -13807,7 +13806,7 @@ class __PRIVATE_RestConnection {
|
|
|
13807
13806
|
// Use any because msgData.error is not typed.
|
|
13808
13807
|
const s = i, o = s.error || (null === (n = s[0]) || void 0 === n ? void 0 : n.error);
|
|
13809
13808
|
if (o) {
|
|
13810
|
-
__PRIVATE_logDebug(
|
|
13809
|
+
__PRIVATE_logDebug(fe, `RPC '${e}' stream ${r} received error:`, o);
|
|
13811
13810
|
// error.status will be a string like 'OK' or 'NOT_FOUND'.
|
|
13812
13811
|
const t = o.status;
|
|
13813
13812
|
let n =
|
|
@@ -13820,16 +13819,16 @@ class __PRIVATE_RestConnection {
|
|
|
13820
13819
|
function __PRIVATE_mapCodeFromRpcStatus(e) {
|
|
13821
13820
|
// lookup by string
|
|
13822
13821
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13823
|
-
const t =
|
|
13822
|
+
const t = ce[e];
|
|
13824
13823
|
if (void 0 !== t) return __PRIVATE_mapCodeFromRpcCode(t);
|
|
13825
13824
|
}(t), i = o.message;
|
|
13826
|
-
void 0 === n && (n =
|
|
13825
|
+
void 0 === n && (n = v.INTERNAL, i = "Unknown error status: " + t + " with message " + o.message),
|
|
13827
13826
|
// Mark closed so no further events are propagated
|
|
13828
13827
|
h = !0, P.Ro(new FirestoreError(n, i)), c.close();
|
|
13829
|
-
} else __PRIVATE_logDebug(
|
|
13828
|
+
} else __PRIVATE_logDebug(fe, `RPC '${e}' stream ${r} received:`, i), P.Vo(i);
|
|
13830
13829
|
}
|
|
13831
|
-
})), __PRIVATE_unguardedEventListen(o,
|
|
13832
|
-
t.stat ===
|
|
13830
|
+
})), __PRIVATE_unguardedEventListen(o, w.STAT_EVENT, (t => {
|
|
13831
|
+
t.stat === S.PROXY ? __PRIVATE_logDebug(fe, `RPC '${e}' stream ${r} detected buffering proxy`) : t.stat === S.NOPROXY && __PRIVATE_logDebug(fe, `RPC '${e}' stream ${r} detected no buffering proxy`);
|
|
13833
13832
|
})), setTimeout((() => {
|
|
13834
13833
|
// Technically we could/should wait for the WebChannel opened event,
|
|
13835
13834
|
// but because we want to send the first message with the WebChannel
|
|
@@ -14153,10 +14152,10 @@ class __PRIVATE_PersistentStream {
|
|
|
14153
14152
|
// underlying stream), guaranteeing they won't execute.
|
|
14154
14153
|
this.Uo++, 4 /* PersistentStreamState.Error */ !== e ?
|
|
14155
14154
|
// If this is an intentional close ensure we don't delay our next connection attempt.
|
|
14156
|
-
this.zo.reset() : t && t.code ===
|
|
14155
|
+
this.zo.reset() : t && t.code === v.RESOURCE_EXHAUSTED ? (
|
|
14157
14156
|
// Log the error. (Probably either 'quota exceeded' or 'max queue length reached'.)
|
|
14158
14157
|
__PRIVATE_logError(t.toString()), __PRIVATE_logError("Using maximum backoff delay to prevent overloading the backend."),
|
|
14159
|
-
this.zo.Lo()) : t && t.code ===
|
|
14158
|
+
this.zo.Lo()) : t && t.code === v.UNAUTHENTICATED && 3 /* PersistentStreamState.Healthy */ !== this.state && (
|
|
14160
14159
|
// "unauthenticated" error means the token was rejected. This should rarely
|
|
14161
14160
|
// happen since both Auth and AppCheck ensure a sufficient TTL when we
|
|
14162
14161
|
// request a token. If a user manually resets their system clock this can
|
|
@@ -14192,7 +14191,7 @@ class __PRIVATE_PersistentStream {
|
|
|
14192
14191
|
this.s_(e, n);
|
|
14193
14192
|
}), (t => {
|
|
14194
14193
|
e((() => {
|
|
14195
|
-
const e = new FirestoreError(
|
|
14194
|
+
const e = new FirestoreError(v.UNKNOWN, "Fetching auth token failed: " + t.message);
|
|
14196
14195
|
return this.o_(e);
|
|
14197
14196
|
}));
|
|
14198
14197
|
}));
|
|
@@ -14405,18 +14404,18 @@ class __PRIVATE_DatastoreImpl extends class Datastore {} {
|
|
|
14405
14404
|
this.serializer = r, this.d_ = !1;
|
|
14406
14405
|
}
|
|
14407
14406
|
A_() {
|
|
14408
|
-
if (this.d_) throw new FirestoreError(
|
|
14407
|
+
if (this.d_) throw new FirestoreError(v.FAILED_PRECONDITION, "The client has already been terminated.");
|
|
14409
14408
|
}
|
|
14410
14409
|
/** Invokes the provided RPC with auth and AppCheck tokens. */ wo(e, t, n) {
|
|
14411
14410
|
return this.A_(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, i]) => this.connection.wo(e, t, n, r, i))).catch((e => {
|
|
14412
|
-
throw "FirebaseError" === e.name ? (e.code ===
|
|
14413
|
-
this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(
|
|
14411
|
+
throw "FirebaseError" === e.name ? (e.code === v.UNAUTHENTICATED && (this.authCredentials.invalidateToken(),
|
|
14412
|
+
this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(v.UNKNOWN, e.toString());
|
|
14414
14413
|
}));
|
|
14415
14414
|
}
|
|
14416
14415
|
/** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ Co(e, t, n, r) {
|
|
14417
14416
|
return this.A_(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([i, s]) => this.connection.Co(e, t, n, i, s, r))).catch((e => {
|
|
14418
|
-
throw "FirebaseError" === e.name ? (e.code ===
|
|
14419
|
-
this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(
|
|
14417
|
+
throw "FirebaseError" === e.name ? (e.code === v.UNAUTHENTICATED && (this.authCredentials.invalidateToken(),
|
|
14418
|
+
this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(v.UNKNOWN, e.toString());
|
|
14420
14419
|
}));
|
|
14421
14420
|
}
|
|
14422
14421
|
terminate() {
|
|
@@ -14906,7 +14905,7 @@ async function __PRIVATE_onWriteStreamClose(e, t) {
|
|
|
14906
14905
|
// Only handle permanent errors here. If it's transient, just let the retry
|
|
14907
14906
|
// logic kick in.
|
|
14908
14907
|
if (function __PRIVATE_isPermanentWriteError(e) {
|
|
14909
|
-
return __PRIVATE_isPermanentError(e) && e !==
|
|
14908
|
+
return __PRIVATE_isPermanentError(e) && e !== v.ABORTED;
|
|
14910
14909
|
}(t.code)) {
|
|
14911
14910
|
// This was a permanent error, the request itself was the problem
|
|
14912
14911
|
// so it's not going to succeed if we resend it.
|
|
@@ -15087,7 +15086,7 @@ class DelayedOperation {
|
|
|
15087
15086
|
* As long as the operation has not yet been run, calling cancel() provides a
|
|
15088
15087
|
* guarantee that the operation will not be run.
|
|
15089
15088
|
*/ cancel(e) {
|
|
15090
|
-
null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new FirestoreError(
|
|
15089
|
+
null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new FirestoreError(v.CANCELLED, "Operation cancelled" + (e ? ": " + e : ""))));
|
|
15091
15090
|
}
|
|
15092
15091
|
handleDelayElapsed() {
|
|
15093
15092
|
this.asyncQueue.enqueueAndForget((() => null !== this.timerHandle ? (this.clearTimeout(),
|
|
@@ -15103,7 +15102,7 @@ class DelayedOperation {
|
|
|
15103
15102
|
* Returns a FirestoreError that can be surfaced to the user if the provided
|
|
15104
15103
|
* error is an IndexedDbTransactionError. Re-throws the error otherwise.
|
|
15105
15104
|
*/ function __PRIVATE_wrapInUserErrorIfRecoverable(e, t) {
|
|
15106
|
-
if (__PRIVATE_logError("AsyncQueue", `${t}: ${e}`), __PRIVATE_isIndexedDbTransactionError(e)) return new FirestoreError(
|
|
15105
|
+
if (__PRIVATE_logError("AsyncQueue", `${t}: ${e}`), __PRIVATE_isIndexedDbTransactionError(e)) return new FirestoreError(v.UNAVAILABLE, `${t}: ${e}`);
|
|
15107
15106
|
throw e;
|
|
15108
15107
|
}
|
|
15109
15108
|
|
|
@@ -16383,7 +16382,7 @@ async function __PRIVATE_syncEngineHandleCredentialChange(e, t) {
|
|
|
16383
16382
|
function __PRIVATE_rejectOutstandingPendingWritesCallbacks(e, t) {
|
|
16384
16383
|
e.ba.forEach((e => {
|
|
16385
16384
|
e.forEach((e => {
|
|
16386
|
-
e.reject(new FirestoreError(
|
|
16385
|
+
e.reject(new FirestoreError(v.CANCELLED, t));
|
|
16387
16386
|
}));
|
|
16388
16387
|
})), e.ba.clear();
|
|
16389
16388
|
}(n, "'waitForPendingWrites' promise is rejected due to a user change."),
|
|
@@ -16812,7 +16811,7 @@ class __PRIVATE_LruGcMemoryOfflineComponentProvider extends MemoryOfflineCompone
|
|
|
16812
16811
|
}
|
|
16813
16812
|
createSharedClientState(e) {
|
|
16814
16813
|
const t = __PRIVATE_getWindow();
|
|
16815
|
-
if (!__PRIVATE_WebStorageSharedClientState.D(t)) throw new FirestoreError(
|
|
16814
|
+
if (!__PRIVATE_WebStorageSharedClientState.D(t)) throw new FirestoreError(v.UNIMPLEMENTED, "IndexedDB persistence is only available on platforms that support LocalStorage.");
|
|
16816
16815
|
const n = __PRIVATE_indexedDbStoragePrefix(e.databaseInfo.databaseId, e.databaseInfo.persistenceKey);
|
|
16817
16816
|
return new __PRIVATE_WebStorageSharedClientState(t, e.asyncQueue, n, e.clientId, e.initialUser);
|
|
16818
16817
|
}
|
|
@@ -17149,7 +17148,7 @@ class Transaction$2 {
|
|
|
17149
17148
|
this.writtenDocs = new Set;
|
|
17150
17149
|
}
|
|
17151
17150
|
async lookup(e) {
|
|
17152
|
-
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new FirestoreError(
|
|
17151
|
+
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new FirestoreError(v.INVALID_ARGUMENT, "Firestore transactions require all reads to be executed before all writes.");
|
|
17153
17152
|
const t = await async function __PRIVATE_invokeBatchGetDocumentsRpc(e, t) {
|
|
17154
17153
|
const n = __PRIVATE_debugCast(e), r = __PRIVATE_getEncodedDatabaseId(n.serializer) + "/documents", i = {
|
|
17155
17154
|
documents: t.map((e => __PRIVATE_toName(n.serializer, e)))
|
|
@@ -17210,7 +17209,7 @@ class Transaction$2 {
|
|
|
17210
17209
|
if (n) {
|
|
17211
17210
|
if (!t.isEqual(n))
|
|
17212
17211
|
// This transaction will fail no matter what.
|
|
17213
|
-
throw new FirestoreError(
|
|
17212
|
+
throw new FirestoreError(v.ABORTED, "Document version changed between two reads.");
|
|
17214
17213
|
} else this.readVersions.set(e.key.toString(), t);
|
|
17215
17214
|
}
|
|
17216
17215
|
/**
|
|
@@ -17237,7 +17236,7 @@ class Transaction$2 {
|
|
|
17237
17236
|
// express that to the backend, we have to validate locally.
|
|
17238
17237
|
// Note: this can change once we can send separate verify writes in the
|
|
17239
17238
|
// transaction.
|
|
17240
|
-
throw new FirestoreError(
|
|
17239
|
+
throw new FirestoreError(v.INVALID_ARGUMENT, "Can't update a document that doesn't exist.");
|
|
17241
17240
|
// Document exists, base precondition on document update time.
|
|
17242
17241
|
return Precondition.updateTime(t);
|
|
17243
17242
|
}
|
|
@@ -17378,7 +17377,7 @@ class FirestoreClient {
|
|
|
17378
17377
|
* Checks that the client has not been terminated. Ensures that other methods on //
|
|
17379
17378
|
* this class cannot be called after the client is terminated. //
|
|
17380
17379
|
*/ verifyNotTerminated() {
|
|
17381
|
-
if (this.asyncQueue.isShuttingDown) throw new FirestoreError(
|
|
17380
|
+
if (this.asyncQueue.isShuttingDown) throw new FirestoreError(v.FAILED_PRECONDITION, "The client has already been terminated.");
|
|
17382
17381
|
}
|
|
17383
17382
|
terminate() {
|
|
17384
17383
|
this.asyncQueue.enterRestrictedMode();
|
|
@@ -17428,7 +17427,7 @@ async function __PRIVATE_setOnlineComponentProvider(e, t) {
|
|
|
17428
17427
|
* Decides whether the provided error allows us to gracefully disable
|
|
17429
17428
|
* persistence (as opposed to crashing the client).
|
|
17430
17429
|
*/ function __PRIVATE_canFallbackFromIndexedDbError(e) {
|
|
17431
|
-
return "FirebaseError" === e.name ? e.code ===
|
|
17430
|
+
return "FirebaseError" === e.name ? e.code === v.FAILED_PRECONDITION || e.code === v.UNIMPLEMENTED : !("undefined" != typeof DOMException && e instanceof DOMException) || (
|
|
17432
17431
|
// When the browser is out of quota we could get either quota exceeded
|
|
17433
17432
|
// or an aborted error depending on whether the error happened during
|
|
17434
17433
|
// schema migration.
|
|
@@ -17520,7 +17519,7 @@ async function __PRIVATE_getEventManager(e) {
|
|
|
17520
17519
|
const n = __PRIVATE_debugCast(e);
|
|
17521
17520
|
return n.persistence.runTransaction("read document", "readonly", (e => n.localDocuments.getDocument(e, t)));
|
|
17522
17521
|
}(e, t);
|
|
17523
|
-
r.isFoundDocument() ? n.resolve(r) : r.isNoDocument() ? n.resolve(null) : n.reject(new FirestoreError(
|
|
17522
|
+
r.isFoundDocument() ? n.resolve(r) : r.isNoDocument() ? n.resolve(null) : n.reject(new FirestoreError(v.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.)"));
|
|
17524
17523
|
} catch (e) {
|
|
17525
17524
|
const r = __PRIVATE_wrapInUserErrorIfRecoverable(e, `Failed to get document '${t} from cache`);
|
|
17526
17525
|
n.reject(r);
|
|
@@ -17549,7 +17548,7 @@ function __PRIVATE_firestoreClientGetDocumentViaSnapshotListener(e, t, n = {}) {
|
|
|
17549
17548
|
// the server so we can deliver that even when you're
|
|
17550
17549
|
// offline 2) Actually reject the Promise in the online case
|
|
17551
17550
|
// if the document doesn't exist.
|
|
17552
|
-
i.reject(new FirestoreError(
|
|
17551
|
+
i.reject(new FirestoreError(v.UNAVAILABLE, "Failed to get document because the client is offline.")) : _ && s.fromCache && r && "server" === r.source ? i.reject(new FirestoreError(v.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);
|
|
17553
17552
|
},
|
|
17554
17553
|
error: e => i.reject(e)
|
|
17555
17554
|
}), o = new __PRIVATE_QueryListener(__PRIVATE_newQueryForPath(n.path), s, {
|
|
@@ -17586,7 +17585,7 @@ function __PRIVATE_firestoreClientGetDocumentsViaSnapshotListener(e, t, n = {})
|
|
|
17586
17585
|
next: n => {
|
|
17587
17586
|
// Remove query first before passing event to user to avoid
|
|
17588
17587
|
// user actions affecting the now stale query.
|
|
17589
|
-
t.enqueueAndForget((() => __PRIVATE_eventManagerUnlisten(e, o))), n.fromCache && "server" === r.source ? i.reject(new FirestoreError(
|
|
17588
|
+
t.enqueueAndForget((() => __PRIVATE_eventManagerUnlisten(e, o))), n.fromCache && "server" === r.source ? i.reject(new FirestoreError(v.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);
|
|
17590
17589
|
},
|
|
17591
17590
|
error: e => i.reject(e)
|
|
17592
17591
|
}), o = new __PRIVATE_QueryListener(n, s, {
|
|
@@ -17786,7 +17785,7 @@ function __PRIVATE_cloneLongPollingOptions(e) {
|
|
|
17786
17785
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17787
17786
|
* See the License for the specific language governing permissions and
|
|
17788
17787
|
* limitations under the License.
|
|
17789
|
-
*/ const
|
|
17788
|
+
*/ const ge = new Map;
|
|
17790
17789
|
|
|
17791
17790
|
/**
|
|
17792
17791
|
* An instance map that ensures only one Datastore exists per Firestore
|
|
@@ -17809,28 +17808,28 @@ function __PRIVATE_cloneLongPollingOptions(e) {
|
|
|
17809
17808
|
* limitations under the License.
|
|
17810
17809
|
*/
|
|
17811
17810
|
function __PRIVATE_validateNonEmptyArgument(e, t, n) {
|
|
17812
|
-
if (!n) throw new FirestoreError(
|
|
17811
|
+
if (!n) throw new FirestoreError(v.INVALID_ARGUMENT, `Function ${e}() cannot be called with an empty ${t}.`);
|
|
17813
17812
|
}
|
|
17814
17813
|
|
|
17815
17814
|
/**
|
|
17816
17815
|
* Validates that two boolean options are not set at the same time.
|
|
17817
17816
|
* @internal
|
|
17818
17817
|
*/ function __PRIVATE_validateIsNotUsedTogether(e, t, n, r) {
|
|
17819
|
-
if (!0 === t && !0 === r) throw new FirestoreError(
|
|
17818
|
+
if (!0 === t && !0 === r) throw new FirestoreError(v.INVALID_ARGUMENT, `${e} and ${n} cannot be used together.`);
|
|
17820
17819
|
}
|
|
17821
17820
|
|
|
17822
17821
|
/**
|
|
17823
17822
|
* Validates that `path` refers to a document (indicated by the fact it contains
|
|
17824
17823
|
* an even numbers of segments).
|
|
17825
17824
|
*/ function __PRIVATE_validateDocumentPath(e) {
|
|
17826
|
-
if (!DocumentKey.isDocumentKey(e)) throw new FirestoreError(
|
|
17825
|
+
if (!DocumentKey.isDocumentKey(e)) throw new FirestoreError(v.INVALID_ARGUMENT, `Invalid document reference. Document references must have an even number of segments, but ${e} has ${e.length}.`);
|
|
17827
17826
|
}
|
|
17828
17827
|
|
|
17829
17828
|
/**
|
|
17830
17829
|
* Validates that `path` refers to a collection (indicated by the fact it
|
|
17831
17830
|
* contains an odd numbers of segments).
|
|
17832
17831
|
*/ function __PRIVATE_validateCollectionPath(e) {
|
|
17833
|
-
if (DocumentKey.isDocumentKey(e)) throw new FirestoreError(
|
|
17832
|
+
if (DocumentKey.isDocumentKey(e)) throw new FirestoreError(v.INVALID_ARGUMENT, `Invalid collection reference. Collection references must have an odd number of segments, but ${e} has ${e.length}.`);
|
|
17834
17833
|
}
|
|
17835
17834
|
|
|
17836
17835
|
/**
|
|
@@ -17874,17 +17873,17 @@ t) {
|
|
|
17874
17873
|
// Unwrap Compat types
|
|
17875
17874
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17876
17875
|
e = e._delegate), !(e instanceof t)) {
|
|
17877
|
-
if (t.name === e.constructor.name) throw new FirestoreError(
|
|
17876
|
+
if (t.name === e.constructor.name) throw new FirestoreError(v.INVALID_ARGUMENT, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
|
|
17878
17877
|
{
|
|
17879
17878
|
const n = __PRIVATE_valueDescription(e);
|
|
17880
|
-
throw new FirestoreError(
|
|
17879
|
+
throw new FirestoreError(v.INVALID_ARGUMENT, `Expected type '${t.name}', but it was: ${n}`);
|
|
17881
17880
|
}
|
|
17882
17881
|
}
|
|
17883
17882
|
return e;
|
|
17884
17883
|
}
|
|
17885
17884
|
|
|
17886
17885
|
function __PRIVATE_validatePositiveNumber(e, t) {
|
|
17887
|
-
if (t <= 0) throw new FirestoreError(
|
|
17886
|
+
if (t <= 0) throw new FirestoreError(v.INVALID_ARGUMENT, `Function ${e}() requires a positive number, but it was: ${t}.`);
|
|
17888
17887
|
}
|
|
17889
17888
|
|
|
17890
17889
|
/**
|
|
@@ -17913,12 +17912,12 @@ class FirestoreSettingsImpl {
|
|
|
17913
17912
|
constructor(e) {
|
|
17914
17913
|
var t, n;
|
|
17915
17914
|
if (void 0 === e.host) {
|
|
17916
|
-
if (void 0 !== e.ssl) throw new FirestoreError(
|
|
17915
|
+
if (void 0 !== e.ssl) throw new FirestoreError(v.INVALID_ARGUMENT, "Can't provide ssl option if host option is not set");
|
|
17917
17916
|
this.host = "firestore.googleapis.com", this.ssl = true;
|
|
17918
17917
|
} else this.host = e.host, this.ssl = null === (t = e.ssl) || void 0 === t || t;
|
|
17919
17918
|
if (this.credentials = e.credentials, this.ignoreUndefinedProperties = !!e.ignoreUndefinedProperties,
|
|
17920
17919
|
this.localCache = e.localCache, void 0 === e.cacheSizeBytes) this.cacheSizeBytes = 41943040; else {
|
|
17921
|
-
if (-1 !== e.cacheSizeBytes && e.cacheSizeBytes < 1048576) throw new FirestoreError(
|
|
17920
|
+
if (-1 !== e.cacheSizeBytes && e.cacheSizeBytes < 1048576) throw new FirestoreError(v.INVALID_ARGUMENT, "cacheSizeBytes must be at least 1048576");
|
|
17922
17921
|
this.cacheSizeBytes = e.cacheSizeBytes;
|
|
17923
17922
|
}
|
|
17924
17923
|
__PRIVATE_validateIsNotUsedTogether("experimentalForceLongPolling", e.experimentalForceLongPolling, "experimentalAutoDetectLongPolling", e.experimentalAutoDetectLongPolling),
|
|
@@ -17930,9 +17929,9 @@ class FirestoreSettingsImpl {
|
|
|
17930
17929
|
this.experimentalLongPollingOptions = __PRIVATE_cloneLongPollingOptions(null !== (n = e.experimentalLongPollingOptions) && void 0 !== n ? n : {}),
|
|
17931
17930
|
function __PRIVATE_validateLongPollingOptions(e) {
|
|
17932
17931
|
if (void 0 !== e.timeoutSeconds) {
|
|
17933
|
-
if (isNaN(e.timeoutSeconds)) throw new FirestoreError(
|
|
17934
|
-
if (e.timeoutSeconds < 5) throw new FirestoreError(
|
|
17935
|
-
if (e.timeoutSeconds > 30) throw new FirestoreError(
|
|
17932
|
+
if (isNaN(e.timeoutSeconds)) throw new FirestoreError(v.INVALID_ARGUMENT, `invalid long polling timeout: ${e.timeoutSeconds} (must not be NaN)`);
|
|
17933
|
+
if (e.timeoutSeconds < 5) throw new FirestoreError(v.INVALID_ARGUMENT, `invalid long polling timeout: ${e.timeoutSeconds} (minimum allowed value is 5)`);
|
|
17934
|
+
if (e.timeoutSeconds > 30) throw new FirestoreError(v.INVALID_ARGUMENT, `invalid long polling timeout: ${e.timeoutSeconds} (maximum allowed value is 30)`);
|
|
17936
17935
|
}
|
|
17937
17936
|
}
|
|
17938
17937
|
/**
|
|
@@ -17979,7 +17978,7 @@ class Firestore$1 {
|
|
|
17979
17978
|
* The {@link @firebase/app#FirebaseApp} associated with this `Firestore` service
|
|
17980
17979
|
* instance.
|
|
17981
17980
|
*/ get app() {
|
|
17982
|
-
if (!this._app) throw new FirestoreError(
|
|
17981
|
+
if (!this._app) throw new FirestoreError(v.FAILED_PRECONDITION, "Firestore was not initialized using the Firebase SDK. 'app' is not available");
|
|
17983
17982
|
return this._app;
|
|
17984
17983
|
}
|
|
17985
17984
|
get _initialized() {
|
|
@@ -17989,7 +17988,7 @@ class Firestore$1 {
|
|
|
17989
17988
|
return void 0 !== this._terminateTask;
|
|
17990
17989
|
}
|
|
17991
17990
|
_setSettings(e) {
|
|
17992
|
-
if (this._settingsFrozen) throw new FirestoreError(
|
|
17991
|
+
if (this._settingsFrozen) throw new FirestoreError(v.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.");
|
|
17993
17992
|
this._settings = new FirestoreSettingsImpl(e), void 0 !== e.credentials && (this._authCredentials = function __PRIVATE_makeAuthCredentialsProvider(e) {
|
|
17994
17993
|
if (!e) return new __PRIVATE_EmptyAuthCredentialsProvider;
|
|
17995
17994
|
switch (e.type) {
|
|
@@ -18000,7 +17999,7 @@ class Firestore$1 {
|
|
|
18000
17999
|
return e.client;
|
|
18001
18000
|
|
|
18002
18001
|
default:
|
|
18003
|
-
throw new FirestoreError(
|
|
18002
|
+
throw new FirestoreError(v.INVALID_ARGUMENT, "makeAuthCredentialsProvider failed due to invalid credential type");
|
|
18004
18003
|
}
|
|
18005
18004
|
}(e.credentials));
|
|
18006
18005
|
}
|
|
@@ -18032,8 +18031,8 @@ class Firestore$1 {
|
|
|
18032
18031
|
* when the `Firestore` instance is terminated.
|
|
18033
18032
|
*/
|
|
18034
18033
|
return function __PRIVATE_removeComponents(e) {
|
|
18035
|
-
const t =
|
|
18036
|
-
t && (__PRIVATE_logDebug("ComponentProvider", "Removing Datastore"),
|
|
18034
|
+
const t = ge.get(e);
|
|
18035
|
+
t && (__PRIVATE_logDebug("ComponentProvider", "Removing Datastore"), ge.delete(e),
|
|
18037
18036
|
t.terminate());
|
|
18038
18037
|
}(this), Promise.resolve();
|
|
18039
18038
|
}
|
|
@@ -18065,7 +18064,7 @@ class Firestore$1 {
|
|
|
18065
18064
|
// invalid field "uid" and missing field "sub" / "user_id".)
|
|
18066
18065
|
t = I(r.mockUserToken, null === (i = e._app) || void 0 === i ? void 0 : i.options.projectId);
|
|
18067
18066
|
const s = r.mockUserToken.sub || r.mockUserToken.user_id;
|
|
18068
|
-
if (!s) throw new FirestoreError(
|
|
18067
|
+
if (!s) throw new FirestoreError(v.INVALID_ARGUMENT, "mockUserToken must contain 'sub' or 'user_id' field!");
|
|
18069
18068
|
n = new User(s);
|
|
18070
18069
|
}
|
|
18071
18070
|
e._authCredentials = new __PRIVATE_EmulatorAuthCredentialsProvider(new __PRIVATE_OAuthToken(t, n));
|
|
@@ -18185,7 +18184,7 @@ function collection(e, t, ...n) {
|
|
|
18185
18184
|
return __PRIVATE_validateCollectionPath(r), new CollectionReference(e, /* converter= */ null, r);
|
|
18186
18185
|
}
|
|
18187
18186
|
{
|
|
18188
|
-
if (!(e instanceof DocumentReference || e instanceof CollectionReference)) throw new FirestoreError(
|
|
18187
|
+
if (!(e instanceof DocumentReference || e instanceof CollectionReference)) throw new FirestoreError(v.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
18189
18188
|
const r = e._path.child(ResourcePath.fromString(t, ...n));
|
|
18190
18189
|
return __PRIVATE_validateCollectionPath(r), new CollectionReference(e.firestore,
|
|
18191
18190
|
/* converter= */ null, r);
|
|
@@ -18206,7 +18205,7 @@ function collection(e, t, ...n) {
|
|
|
18206
18205
|
* @returns The created `Query`.
|
|
18207
18206
|
*/ function collectionGroup(e, t) {
|
|
18208
18207
|
if (e = __PRIVATE_cast(e, Firestore$1), __PRIVATE_validateNonEmptyArgument("collectionGroup", "collection id", t),
|
|
18209
|
-
t.indexOf("/") >= 0) throw new FirestoreError(
|
|
18208
|
+
t.indexOf("/") >= 0) throw new FirestoreError(v.INVALID_ARGUMENT, `Invalid collection ID '${t}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
|
|
18210
18209
|
return new Query(e,
|
|
18211
18210
|
/* converter= */ null, function __PRIVATE_newQueryForCollectionGroup(e) {
|
|
18212
18211
|
return new __PRIVATE_QueryImpl(ResourcePath.emptyPath(), e);
|
|
@@ -18224,7 +18223,7 @@ function doc(e, t, ...n) {
|
|
|
18224
18223
|
/* converter= */ null, new DocumentKey(r));
|
|
18225
18224
|
}
|
|
18226
18225
|
{
|
|
18227
|
-
if (!(e instanceof DocumentReference || e instanceof CollectionReference)) throw new FirestoreError(
|
|
18226
|
+
if (!(e instanceof DocumentReference || e instanceof CollectionReference)) throw new FirestoreError(v.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
18228
18227
|
const r = e._path.child(ResourcePath.fromString(t, ...n));
|
|
18229
18228
|
return __PRIVATE_validateDocumentPath(r), new DocumentReference(e.firestore, e instanceof CollectionReference ? e.converter : null, new DocumentKey(r));
|
|
18230
18229
|
}
|
|
@@ -18584,7 +18583,7 @@ class LoadBundleTask {
|
|
|
18584
18583
|
* Constant used to indicate the LRU garbage collection should be disabled.
|
|
18585
18584
|
* Set this value as the `cacheSizeBytes` on the settings passed to the
|
|
18586
18585
|
* {@link Firestore} instance.
|
|
18587
|
-
*/ const
|
|
18586
|
+
*/ const pe = -1;
|
|
18588
18587
|
|
|
18589
18588
|
/**
|
|
18590
18589
|
* The Cloud Firestore service interface.
|
|
@@ -18628,10 +18627,10 @@ class LoadBundleTask {
|
|
|
18628
18627
|
identifier: n
|
|
18629
18628
|
}), i = r.getOptions(n);
|
|
18630
18629
|
if (E(i, t)) return e;
|
|
18631
|
-
throw new FirestoreError(
|
|
18630
|
+
throw new FirestoreError(v.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.");
|
|
18632
18631
|
}
|
|
18633
|
-
if (void 0 !== t.cacheSizeBytes && void 0 !== t.localCache) throw new FirestoreError(
|
|
18634
|
-
if (void 0 !== t.cacheSizeBytes && -1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new FirestoreError(
|
|
18632
|
+
if (void 0 !== t.cacheSizeBytes && void 0 !== t.localCache) throw new FirestoreError(v.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");
|
|
18633
|
+
if (void 0 !== t.cacheSizeBytes && -1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new FirestoreError(v.INVALID_ARGUMENT, "cacheSizeBytes must be at least 1048576");
|
|
18635
18634
|
return r.initialize({
|
|
18636
18635
|
options: t,
|
|
18637
18636
|
instanceIdentifier: n
|
|
@@ -18700,7 +18699,7 @@ function __PRIVATE_configureFirestore(e) {
|
|
|
18700
18699
|
*/ function enableIndexedDbPersistence(e, t) {
|
|
18701
18700
|
__PRIVATE_verifyNotInitialized(e = __PRIVATE_cast(e, Firestore));
|
|
18702
18701
|
const n = ensureFirestoreConfigured(e);
|
|
18703
|
-
if (n._uninitializedComponentsProvider) throw new FirestoreError(
|
|
18702
|
+
if (n._uninitializedComponentsProvider) throw new FirestoreError(v.FAILED_PRECONDITION, "SDK cache is already specified.");
|
|
18704
18703
|
__PRIVATE_logWarn("enableIndexedDbPersistence() will be deprecated in the future, you can use `FirestoreSettings.cache` instead.");
|
|
18705
18704
|
const r = e._freezeSettings(), i = new OnlineComponentProvider;
|
|
18706
18705
|
return __PRIVATE_setPersistenceProviders(n, i, new __PRIVATE_IndexedDbOfflineComponentProvider(i, r.cacheSizeBytes, null == t ? void 0 : t.forceOwnership));
|
|
@@ -18734,7 +18733,7 @@ function __PRIVATE_configureFirestore(e) {
|
|
|
18734
18733
|
*/ function enableMultiTabIndexedDbPersistence(e) {
|
|
18735
18734
|
__PRIVATE_verifyNotInitialized(e = __PRIVATE_cast(e, Firestore));
|
|
18736
18735
|
const t = ensureFirestoreConfigured(e);
|
|
18737
|
-
if (t._uninitializedComponentsProvider) throw new FirestoreError(
|
|
18736
|
+
if (t._uninitializedComponentsProvider) throw new FirestoreError(v.FAILED_PRECONDITION, "SDK cache is already specified.");
|
|
18738
18737
|
__PRIVATE_logWarn("enableMultiTabIndexedDbPersistence() will be deprecated in the future, you can use `FirestoreSettings.cache` instead.");
|
|
18739
18738
|
const n = e._freezeSettings(), r = new OnlineComponentProvider;
|
|
18740
18739
|
return __PRIVATE_setPersistenceProviders(t, r, new __PRIVATE_MultiTabOfflineComponentProvider(r, n.cacheSizeBytes));
|
|
@@ -18782,7 +18781,7 @@ function __PRIVATE_configureFirestore(e) {
|
|
|
18782
18781
|
* @returns A `Promise` that is resolved when the persistent storage is
|
|
18783
18782
|
* cleared. Otherwise, the promise is rejected with an error.
|
|
18784
18783
|
*/ function clearIndexedDbPersistence(e) {
|
|
18785
|
-
if (e._initialized && !e._terminated) throw new FirestoreError(
|
|
18784
|
+
if (e._initialized && !e._terminated) throw new FirestoreError(v.FAILED_PRECONDITION, "Persistence can only be cleared before a Firestore instance is initialized or after it is terminated.");
|
|
18786
18785
|
const t = new __PRIVATE_Deferred;
|
|
18787
18786
|
return e._queue.enqueueAndForgetEvenWhileRestricted((async () => {
|
|
18788
18787
|
try {
|
|
@@ -18896,7 +18895,7 @@ function __PRIVATE_configureFirestore(e) {
|
|
|
18896
18895
|
}
|
|
18897
18896
|
|
|
18898
18897
|
function __PRIVATE_verifyNotInitialized(e) {
|
|
18899
|
-
if (e._initialized || e._terminated) throw new FirestoreError(
|
|
18898
|
+
if (e._initialized || e._terminated) throw new FirestoreError(v.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.");
|
|
18900
18899
|
}
|
|
18901
18900
|
|
|
18902
18901
|
/**
|
|
@@ -19005,7 +19004,7 @@ class AggregateField {
|
|
|
19005
19004
|
try {
|
|
19006
19005
|
return new Bytes(ByteString.fromBase64String(e));
|
|
19007
19006
|
} catch (e) {
|
|
19008
|
-
throw new FirestoreError(
|
|
19007
|
+
throw new FirestoreError(v.INVALID_ARGUMENT, "Failed to construct data from Base64 string: " + e);
|
|
19009
19008
|
}
|
|
19010
19009
|
}
|
|
19011
19010
|
/**
|
|
@@ -19077,7 +19076,7 @@ class AggregateField {
|
|
|
19077
19076
|
* @param fieldNames - A list of field names.
|
|
19078
19077
|
*/
|
|
19079
19078
|
constructor(...e) {
|
|
19080
|
-
for (let t = 0; t < e.length; ++t) if (0 === e[t].length) throw new FirestoreError(
|
|
19079
|
+
for (let t = 0; t < e.length; ++t) if (0 === e[t].length) throw new FirestoreError(v.INVALID_ARGUMENT, "Invalid field name at argument $(i + 1). Field names must not be empty.");
|
|
19081
19080
|
this._internalPath = new FieldPath$1(e);
|
|
19082
19081
|
}
|
|
19083
19082
|
/**
|
|
@@ -19156,8 +19155,8 @@ class AggregateField {
|
|
|
19156
19155
|
* @param longitude - The longitude as number between -180 and 180.
|
|
19157
19156
|
*/
|
|
19158
19157
|
constructor(e, t) {
|
|
19159
|
-
if (!isFinite(e) || e < -90 || e > 90) throw new FirestoreError(
|
|
19160
|
-
if (!isFinite(t) || t < -180 || t > 180) throw new FirestoreError(
|
|
19158
|
+
if (!isFinite(e) || e < -90 || e > 90) throw new FirestoreError(v.INVALID_ARGUMENT, "Latitude must be a number between -90 and 90, but was: " + e);
|
|
19159
|
+
if (!isFinite(t) || t < -180 || t > 180) throw new FirestoreError(v.INVALID_ARGUMENT, "Longitude must be a number between -180 and 180, but was: " + t);
|
|
19161
19160
|
this._lat = e, this._long = t;
|
|
19162
19161
|
}
|
|
19163
19162
|
/**
|
|
@@ -19207,7 +19206,7 @@ class AggregateField {
|
|
|
19207
19206
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19208
19207
|
* See the License for the specific language governing permissions and
|
|
19209
19208
|
* limitations under the License.
|
|
19210
|
-
*/ const
|
|
19209
|
+
*/ const ye = /^__.*__$/;
|
|
19211
19210
|
|
|
19212
19211
|
/** The result of parsing document data (e.g. for a setData call). */ class ParsedSetData {
|
|
19213
19212
|
constructor(e, t, n) {
|
|
@@ -19318,7 +19317,7 @@ function __PRIVATE_isWrite(e) {
|
|
|
19318
19317
|
}
|
|
19319
19318
|
Au(e) {
|
|
19320
19319
|
if (0 === e.length) throw this.mu("Document fields must not be empty");
|
|
19321
|
-
if (__PRIVATE_isWrite(this.Iu) &&
|
|
19320
|
+
if (__PRIVATE_isWrite(this.Iu) && ye.test(e)) throw this.mu('Document fields cannot begin and end with "__"');
|
|
19322
19321
|
}
|
|
19323
19322
|
}
|
|
19324
19323
|
|
|
@@ -19355,7 +19354,7 @@ function __PRIVATE_newUserDataReader(e) {
|
|
|
19355
19354
|
const e = [];
|
|
19356
19355
|
for (const r of s.mergeFields) {
|
|
19357
19356
|
const i = __PRIVATE_fieldPathFromArgument$1(t, r, n);
|
|
19358
|
-
if (!o.contains(i)) throw new FirestoreError(
|
|
19357
|
+
if (!o.contains(i)) throw new FirestoreError(v.INVALID_ARGUMENT, `Field '${i}' is specified in your field mask but missing from your input data.`);
|
|
19359
19358
|
__PRIVATE_fieldMaskContains(e, i) || e.push(i);
|
|
19360
19359
|
}
|
|
19361
19360
|
a = new FieldMask(e), u = o.fieldTransforms.filter((e => a.covers(e.field)));
|
|
@@ -19475,7 +19474,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
|
|
|
19475
19474
|
|
|
19476
19475
|
/** Parse update data from a list of field/value arguments. */ function __PRIVATE_parseUpdateVarargs(e, t, n, r, i, s) {
|
|
19477
19476
|
const o = e.pu(1 /* UserDataSource.Update */ , t, n), _ = [ __PRIVATE_fieldPathFromArgument$1(t, r, n) ], a = [ i ];
|
|
19478
|
-
if (s.length % 2 != 0) throw new FirestoreError(
|
|
19477
|
+
if (s.length % 2 != 0) throw new FirestoreError(v.INVALID_ARGUMENT, `Function ${t}() needs to be called with an even number of arguments that alternate between field names and values.`);
|
|
19479
19478
|
for (let e = 0; e < s.length; e += 2) _.push(__PRIVATE_fieldPathFromArgument$1(t, s[e])),
|
|
19480
19479
|
a.push(s[e + 1]);
|
|
19481
19480
|
const u = [], c = ObjectValue.empty();
|
|
@@ -19676,7 +19675,7 @@ function __PRIVATE_validatePlainObject(e, t, n) {
|
|
|
19676
19675
|
|
|
19677
19676
|
/**
|
|
19678
19677
|
* Matches any characters in a field path string that are reserved.
|
|
19679
|
-
*/ const
|
|
19678
|
+
*/ const we = new RegExp("[~\\*/\\[\\]]");
|
|
19680
19679
|
|
|
19681
19680
|
/**
|
|
19682
19681
|
* Wraps fromDotSeparatedString with an error message about the method that
|
|
@@ -19687,7 +19686,7 @@ function __PRIVATE_validatePlainObject(e, t, n) {
|
|
|
19687
19686
|
* @param targetDoc - The document against which the field path will be
|
|
19688
19687
|
* evaluated.
|
|
19689
19688
|
*/ function __PRIVATE_fieldPathFromDotSeparatedString(e, t, n) {
|
|
19690
|
-
if (t.search(
|
|
19689
|
+
if (t.search(we) >= 0) throw __PRIVATE_createError(`Invalid field path (${t}). Paths must not contain '~', '*', '/', '[', or ']'`, e,
|
|
19691
19690
|
/* hasConverter= */ !1,
|
|
19692
19691
|
/* path= */ void 0, n);
|
|
19693
19692
|
try {
|
|
@@ -19705,7 +19704,7 @@ function __PRIVATE_createError(e, t, n, r, i) {
|
|
|
19705
19704
|
n && (_ += " (via `toFirestore()`)"), _ += ". ";
|
|
19706
19705
|
let a = "";
|
|
19707
19706
|
return (s || o) && (a += " (found", s && (a += ` in field ${r}`), o && (a += ` in document ${i}`),
|
|
19708
|
-
a += ")"), new FirestoreError(
|
|
19707
|
+
a += ")"), new FirestoreError(v.INVALID_ARGUMENT, _ + e + a);
|
|
19709
19708
|
}
|
|
19710
19709
|
|
|
19711
19710
|
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function __PRIVATE_fieldMaskContains(e, t) {
|
|
@@ -19842,7 +19841,7 @@ function __PRIVATE_createError(e, t, n, r, i) {
|
|
|
19842
19841
|
* See the License for the specific language governing permissions and
|
|
19843
19842
|
* limitations under the License.
|
|
19844
19843
|
*/ function __PRIVATE_validateHasExplicitOrderByForLimitToLast(e) {
|
|
19845
|
-
if ("L" /* LimitType.Last */ === e.limitType && 0 === e.explicitOrderBy.length) throw new FirestoreError(
|
|
19844
|
+
if ("L" /* LimitType.Last */ === e.limitType && 0 === e.explicitOrderBy.length) throw new FirestoreError(v.UNIMPLEMENTED, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
19846
19845
|
}
|
|
19847
19846
|
|
|
19848
19847
|
/**
|
|
@@ -19863,7 +19862,7 @@ function query(e, t, ...n) {
|
|
|
19863
19862
|
let r = [];
|
|
19864
19863
|
t instanceof AppliableConstraint && r.push(t), r = r.concat(n), function __PRIVATE_validateQueryConstraintArray(e) {
|
|
19865
19864
|
const t = e.filter((e => e instanceof QueryCompositeFilterConstraint)).length, n = e.filter((e => e instanceof QueryFieldFilterConstraint)).length;
|
|
19866
|
-
if (t > 1 || t > 0 && n > 0) throw new FirestoreError(
|
|
19865
|
+
if (t > 1 || t > 0 && n > 0) throw new FirestoreError(v.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(...)))`.");
|
|
19867
19866
|
}
|
|
19868
19867
|
/**
|
|
19869
19868
|
* @license
|
|
@@ -19917,7 +19916,7 @@ function query(e, t, ...n) {
|
|
|
19917
19916
|
const t = __PRIVATE_newUserDataReader(e.firestore), n = function __PRIVATE_newQueryFilter(e, t, n, r, i, s, o) {
|
|
19918
19917
|
let _;
|
|
19919
19918
|
if (i.isKeyField()) {
|
|
19920
|
-
if ("array-contains" /* Operator.ARRAY_CONTAINS */ === s || "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ === s) throw new FirestoreError(
|
|
19919
|
+
if ("array-contains" /* Operator.ARRAY_CONTAINS */ === s || "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ === s) throw new FirestoreError(v.INVALID_ARGUMENT, `Invalid Query. You can't perform '${s}' queries on documentId().`);
|
|
19921
19920
|
if ("in" /* Operator.IN */ === s || "not-in" /* Operator.NOT_IN */ === s) {
|
|
19922
19921
|
__PRIVATE_validateDisjunctiveFilterElements(o, s);
|
|
19923
19922
|
const t = [];
|
|
@@ -20044,8 +20043,8 @@ function query(e, t, ...n) {
|
|
|
20044
20043
|
}
|
|
20045
20044
|
_apply(e) {
|
|
20046
20045
|
const t = function __PRIVATE_newQueryOrderBy(e, t, n) {
|
|
20047
|
-
if (null !== e.startAt) throw new FirestoreError(
|
|
20048
|
-
if (null !== e.endAt) throw new FirestoreError(
|
|
20046
|
+
if (null !== e.startAt) throw new FirestoreError(v.INVALID_ARGUMENT, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
|
|
20047
|
+
if (null !== e.endAt) throw new FirestoreError(v.INVALID_ARGUMENT, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
|
|
20049
20048
|
return new OrderBy(t, n);
|
|
20050
20049
|
}
|
|
20051
20050
|
/**
|
|
@@ -20203,7 +20202,7 @@ function endAt(...e) {
|
|
|
20203
20202
|
|
|
20204
20203
|
/** Helper function to create a bound from a document or fields */ function __PRIVATE_newQueryBoundFromDocOrFields(e, t, n, r) {
|
|
20205
20204
|
if (n[0] = T(n[0]), n[0] instanceof DocumentSnapshot$1) return function __PRIVATE_newQueryBoundFromDocument(e, t, n, r, i) {
|
|
20206
|
-
if (!r) throw new FirestoreError(
|
|
20205
|
+
if (!r) throw new FirestoreError(v.NOT_FOUND, `Can't use a DocumentSnapshot that doesn't exist for ${n}().`);
|
|
20207
20206
|
const s = [];
|
|
20208
20207
|
// Because people expect to continue/end a query at the exact document
|
|
20209
20208
|
// provided, we need to use the implicit sort order rather than the explicit
|
|
@@ -20214,10 +20213,10 @@ function endAt(...e) {
|
|
|
20214
20213
|
// results.
|
|
20215
20214
|
for (const n of __PRIVATE_queryNormalizedOrderBy(e)) if (n.field.isKeyField()) s.push(__PRIVATE_refValue(t, r.key)); else {
|
|
20216
20215
|
const e = r.data.field(n.field);
|
|
20217
|
-
if (__PRIVATE_isServerTimestamp(e)) throw new FirestoreError(
|
|
20216
|
+
if (__PRIVATE_isServerTimestamp(e)) throw new FirestoreError(v.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.)');
|
|
20218
20217
|
if (null === e) {
|
|
20219
20218
|
const e = n.field.canonicalString();
|
|
20220
|
-
throw new FirestoreError(
|
|
20219
|
+
throw new FirestoreError(v.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.`);
|
|
20221
20220
|
}
|
|
20222
20221
|
s.push(e);
|
|
20223
20222
|
}
|
|
@@ -20231,15 +20230,15 @@ function endAt(...e) {
|
|
|
20231
20230
|
return function __PRIVATE_newQueryBoundFromFields(e, t, n, r, i, s) {
|
|
20232
20231
|
// Use explicit order by's because it has to match the query the user made
|
|
20233
20232
|
const o = e.explicitOrderBy;
|
|
20234
|
-
if (i.length > o.length) throw new FirestoreError(
|
|
20233
|
+
if (i.length > o.length) throw new FirestoreError(v.INVALID_ARGUMENT, `Too many arguments provided to ${r}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);
|
|
20235
20234
|
const _ = [];
|
|
20236
20235
|
for (let s = 0; s < i.length; s++) {
|
|
20237
20236
|
const a = i[s];
|
|
20238
20237
|
if (o[s].field.isKeyField()) {
|
|
20239
|
-
if ("string" != typeof a) throw new FirestoreError(
|
|
20240
|
-
if (!__PRIVATE_isCollectionGroupQuery(e) && -1 !== a.indexOf("/")) throw new FirestoreError(
|
|
20238
|
+
if ("string" != typeof a) throw new FirestoreError(v.INVALID_ARGUMENT, `Invalid query. Expected a string for document ID in ${r}(), but got a ${typeof a}`);
|
|
20239
|
+
if (!__PRIVATE_isCollectionGroupQuery(e) && -1 !== a.indexOf("/")) throw new FirestoreError(v.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.`);
|
|
20241
20240
|
const n = e.path.child(ResourcePath.fromString(a));
|
|
20242
|
-
if (!DocumentKey.isDocumentKey(n)) throw new FirestoreError(
|
|
20241
|
+
if (!DocumentKey.isDocumentKey(n)) throw new FirestoreError(v.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.`);
|
|
20243
20242
|
const i = new DocumentKey(n);
|
|
20244
20243
|
_.push(__PRIVATE_refValue(t, i));
|
|
20245
20244
|
} else {
|
|
@@ -20259,21 +20258,21 @@ function endAt(...e) {
|
|
|
20259
20258
|
|
|
20260
20259
|
function __PRIVATE_parseDocumentIdValue(e, t, n) {
|
|
20261
20260
|
if ("string" == typeof (n = T(n))) {
|
|
20262
|
-
if ("" === n) throw new FirestoreError(
|
|
20263
|
-
if (!__PRIVATE_isCollectionGroupQuery(t) && -1 !== n.indexOf("/")) throw new FirestoreError(
|
|
20261
|
+
if ("" === n) throw new FirestoreError(v.INVALID_ARGUMENT, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
|
|
20262
|
+
if (!__PRIVATE_isCollectionGroupQuery(t) && -1 !== n.indexOf("/")) throw new FirestoreError(v.INVALID_ARGUMENT, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);
|
|
20264
20263
|
const r = t.path.child(ResourcePath.fromString(n));
|
|
20265
|
-
if (!DocumentKey.isDocumentKey(r)) throw new FirestoreError(
|
|
20264
|
+
if (!DocumentKey.isDocumentKey(r)) throw new FirestoreError(v.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}).`);
|
|
20266
20265
|
return __PRIVATE_refValue(e, new DocumentKey(r));
|
|
20267
20266
|
}
|
|
20268
20267
|
if (n instanceof DocumentReference) return __PRIVATE_refValue(e, n._key);
|
|
20269
|
-
throw new FirestoreError(
|
|
20268
|
+
throw new FirestoreError(v.INVALID_ARGUMENT, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${__PRIVATE_valueDescription(n)}.`);
|
|
20270
20269
|
}
|
|
20271
20270
|
|
|
20272
20271
|
/**
|
|
20273
20272
|
* Validates that the value passed into a disjunctive filter satisfies all
|
|
20274
20273
|
* array requirements.
|
|
20275
20274
|
*/ function __PRIVATE_validateDisjunctiveFilterElements(e, t) {
|
|
20276
|
-
if (!Array.isArray(e) || 0 === e.length) throw new FirestoreError(
|
|
20275
|
+
if (!Array.isArray(e) || 0 === e.length) throw new FirestoreError(v.INVALID_ARGUMENT, `Invalid Query. A non-empty array is required for '${t.toString()}' filters.`);
|
|
20277
20276
|
}
|
|
20278
20277
|
|
|
20279
20278
|
/**
|
|
@@ -20307,11 +20306,11 @@ function __PRIVATE_parseDocumentIdValue(e, t, n) {
|
|
|
20307
20306
|
}(t.op));
|
|
20308
20307
|
if (null !== n)
|
|
20309
20308
|
// Special case when it's a duplicate op to give a slightly clearer error message.
|
|
20310
|
-
throw n === t.op ? new FirestoreError(
|
|
20309
|
+
throw n === t.op ? new FirestoreError(v.INVALID_ARGUMENT, `Invalid query. You cannot use more than one '${t.op.toString()}' filter.`) : new FirestoreError(v.INVALID_ARGUMENT, `Invalid query. You cannot use '${t.op.toString()}' filters with '${n.toString()}' filters.`);
|
|
20311
20310
|
}
|
|
20312
20311
|
|
|
20313
20312
|
function __PRIVATE_validateQueryFilterConstraint(e, t) {
|
|
20314
|
-
if (!(t instanceof QueryFieldFilterConstraint || t instanceof QueryCompositeFilterConstraint)) throw new FirestoreError(
|
|
20313
|
+
if (!(t instanceof QueryFieldFilterConstraint || t instanceof QueryCompositeFilterConstraint)) throw new FirestoreError(v.INVALID_ARGUMENT, `Function ${e}() requires AppliableConstraints created with a call to 'where(...)', 'or(...)', or 'and(...)'.`);
|
|
20315
20314
|
}
|
|
20316
20315
|
|
|
20317
20316
|
class AbstractUserDataWriter {
|
|
@@ -20683,7 +20682,7 @@ class __PRIVATE_LiteUserDataWriter extends AbstractUserDataWriter {
|
|
|
20683
20682
|
* snapshot events.
|
|
20684
20683
|
*/ docChanges(e = {}) {
|
|
20685
20684
|
const t = !!e.includeMetadataChanges;
|
|
20686
|
-
if (t && this._snapshot.excludesMetadataChanges) throw new FirestoreError(
|
|
20685
|
+
if (t && this._snapshot.excludesMetadataChanges) throw new FirestoreError(v.INVALID_ARGUMENT, "To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");
|
|
20687
20686
|
return this._cachedChanges && this._cachedChangesIncludeMetadataChanges === t || (this._cachedChanges =
|
|
20688
20687
|
/** Calculates the array of `DocumentChange`s for a given `ViewSnapshot`. */
|
|
20689
20688
|
function __PRIVATE_changesFromSnapshot(e, t) {
|
|
@@ -21239,7 +21238,7 @@ class __PRIVATE_MultiTabManagerImpl {
|
|
|
21239
21238
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21240
21239
|
* See the License for the specific language governing permissions and
|
|
21241
21240
|
* limitations under the License.
|
|
21242
|
-
*/ const
|
|
21241
|
+
*/ const Se = {
|
|
21243
21242
|
maxAttempts: 5
|
|
21244
21243
|
};
|
|
21245
21244
|
|
|
@@ -21313,12 +21312,12 @@ class WriteBatch {
|
|
|
21313
21312
|
return this._verifyNotCommitted(), this._committed = !0, this._mutations.length > 0 ? this._commitHandler(this._mutations) : Promise.resolve();
|
|
21314
21313
|
}
|
|
21315
21314
|
_verifyNotCommitted() {
|
|
21316
|
-
if (this._committed) throw new FirestoreError(
|
|
21315
|
+
if (this._committed) throw new FirestoreError(v.FAILED_PRECONDITION, "A write batch can no longer be used after commit() has been called.");
|
|
21317
21316
|
}
|
|
21318
21317
|
}
|
|
21319
21318
|
|
|
21320
21319
|
function __PRIVATE_validateReference(e, t) {
|
|
21321
|
-
if ((e = T(e)).firestore !== t) throw new FirestoreError(
|
|
21320
|
+
if ((e = T(e)).firestore !== t) throw new FirestoreError(v.INVALID_ARGUMENT, "Provided document reference is from a different Firestore instance.");
|
|
21322
21321
|
return e;
|
|
21323
21322
|
}
|
|
21324
21323
|
|
|
@@ -21451,9 +21450,9 @@ class Transaction extends class Transaction$1 {
|
|
|
21451
21450
|
* rejected promise with the corresponding failure error is returned.
|
|
21452
21451
|
*/ function runTransaction(e, t, n) {
|
|
21453
21452
|
e = __PRIVATE_cast(e, Firestore);
|
|
21454
|
-
const r = Object.assign(Object.assign({},
|
|
21453
|
+
const r = Object.assign(Object.assign({}, Se), n);
|
|
21455
21454
|
!function __PRIVATE_validateTransactionOptions(e) {
|
|
21456
|
-
if (e.maxAttempts < 1) throw new FirestoreError(
|
|
21455
|
+
if (e.maxAttempts < 1) throw new FirestoreError(v.INVALID_ARGUMENT, "Max attempts must be at least 1");
|
|
21457
21456
|
}(r);
|
|
21458
21457
|
return function __PRIVATE_firestoreClientTransaction(e, t, n) {
|
|
21459
21458
|
const r = new __PRIVATE_Deferred;
|
|
@@ -21607,7 +21606,7 @@ class Transaction extends class Transaction$1 {
|
|
|
21607
21606
|
try {
|
|
21608
21607
|
return JSON.parse(e);
|
|
21609
21608
|
} catch (e) {
|
|
21610
|
-
throw new FirestoreError(
|
|
21609
|
+
throw new FirestoreError(v.INVALID_ARGUMENT, "Failed to parse JSON: " + (null == e ? void 0 : e.message));
|
|
21611
21610
|
}
|
|
21612
21611
|
}(e) : e, n = [];
|
|
21613
21612
|
if (Array.isArray(t.indexes)) for (const e of t.indexes) {
|
|
@@ -21624,7 +21623,7 @@ class Transaction extends class Transaction$1 {
|
|
|
21624
21623
|
}
|
|
21625
21624
|
|
|
21626
21625
|
function __PRIVATE_tryGetString(e, t) {
|
|
21627
|
-
if ("string" != typeof e[t]) throw new FirestoreError(
|
|
21626
|
+
if ("string" != typeof e[t]) throw new FirestoreError(v.INVALID_ARGUMENT, "Missing string value for: " + t);
|
|
21628
21627
|
return e[t];
|
|
21629
21628
|
}
|
|
21630
21629
|
|
|
@@ -21667,12 +21666,12 @@ function __PRIVATE_tryGetString(e, t) {
|
|
|
21667
21666
|
*/ function getPersistentCacheIndexManager(e) {
|
|
21668
21667
|
var t;
|
|
21669
21668
|
e = __PRIVATE_cast(e, Firestore);
|
|
21670
|
-
const n =
|
|
21669
|
+
const n = be.get(e);
|
|
21671
21670
|
if (n) return n;
|
|
21672
21671
|
const r = ensureFirestoreConfigured(e);
|
|
21673
21672
|
if ("persistent" !== (null === (t = r._uninitializedComponentsProvider) || void 0 === t ? void 0 : t._offlineKind)) return null;
|
|
21674
21673
|
const i = new PersistentCacheIndexManager(r);
|
|
21675
|
-
return
|
|
21674
|
+
return be.set(e, i), i;
|
|
21676
21675
|
}
|
|
21677
21676
|
|
|
21678
21677
|
/**
|
|
@@ -21715,7 +21714,7 @@ function __PRIVATE_setPersistentCacheIndexAutoCreationEnabled(e, t) {
|
|
|
21715
21714
|
* Use a `WeakMap` so that the mapping will be automatically dropped when the
|
|
21716
21715
|
* `Firestore` instance is garbage collected. This emulates a private member
|
|
21717
21716
|
* as described in https://goo.gle/454yvug.
|
|
21718
|
-
*/ const
|
|
21717
|
+
*/ const be = new WeakMap;
|
|
21719
21718
|
|
|
21720
21719
|
/**
|
|
21721
21720
|
* @license
|
|
@@ -21768,10 +21767,10 @@ function __PRIVATE_setPersistentCacheIndexAutoCreationEnabled(e, t) {
|
|
|
21768
21767
|
this.Su = new Map;
|
|
21769
21768
|
}
|
|
21770
21769
|
static get instance() {
|
|
21771
|
-
return
|
|
21772
|
-
if (
|
|
21773
|
-
|
|
21774
|
-
}(
|
|
21770
|
+
return De || (De = new __PRIVATE_TestingHooksSpiImpl, function __PRIVATE_setTestingHooksSpi(e) {
|
|
21771
|
+
if (he) throw new Error("a TestingHooksSpi instance is already set");
|
|
21772
|
+
he = e;
|
|
21773
|
+
}(De)), De;
|
|
21775
21774
|
}
|
|
21776
21775
|
tt(e) {
|
|
21777
21776
|
this.Su.forEach((t => t(e)));
|
|
@@ -21782,7 +21781,7 @@ function __PRIVATE_setPersistentCacheIndexAutoCreationEnabled(e, t) {
|
|
|
21782
21781
|
}
|
|
21783
21782
|
}
|
|
21784
21783
|
|
|
21785
|
-
let
|
|
21784
|
+
let De = null;
|
|
21786
21785
|
|
|
21787
21786
|
/**
|
|
21788
21787
|
* @license
|
|
@@ -21801,19 +21800,19 @@ let Ce = null;
|
|
|
21801
21800
|
* limitations under the License.
|
|
21802
21801
|
*/ !function __PRIVATE_registerFirestore(e, t = !0) {
|
|
21803
21802
|
!function __PRIVATE_setSDKVersion(e) {
|
|
21804
|
-
|
|
21803
|
+
D = e;
|
|
21805
21804
|
}(i), n(new s("firestore", ((e, {instanceIdentifier: n, options: r}) => {
|
|
21806
21805
|
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) {
|
|
21807
|
-
if (!Object.prototype.hasOwnProperty.apply(e.options, [ "projectId" ])) throw new FirestoreError(
|
|
21806
|
+
if (!Object.prototype.hasOwnProperty.apply(e.options, [ "projectId" ])) throw new FirestoreError(v.INVALID_ARGUMENT, '"projectId" not provided in firebase.initializeApp.');
|
|
21808
21807
|
return new DatabaseId(e.options.projectId, t);
|
|
21809
21808
|
}(i, n), i);
|
|
21810
21809
|
return r = Object.assign({
|
|
21811
21810
|
useFetchStreams: t
|
|
21812
21811
|
}, r), s._setSettings(r), s;
|
|
21813
|
-
}), "PUBLIC").setMultipleInstances(!0)), r(
|
|
21812
|
+
}), "PUBLIC").setMultipleInstances(!0)), r(b, "4.3.1", e),
|
|
21814
21813
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
|
21815
|
-
r(
|
|
21814
|
+
r(b, "4.3.1", "esm2017");
|
|
21816
21815
|
}("rn", /* useFetchStreams= */ !1);
|
|
21817
21816
|
|
|
21818
|
-
export { AbstractUserDataWriter, AggregateField, AggregateQuerySnapshot, Bytes,
|
|
21817
|
+
export { AbstractUserDataWriter, AggregateField, AggregateQuerySnapshot, Bytes, pe as CACHE_SIZE_UNLIMITED, CollectionReference, DocumentReference, DocumentSnapshot, FieldPath, FieldValue, Firestore, FirestoreError, GeoPoint, LoadBundleTask, PersistentCacheIndexManager, Query, QueryCompositeFilterConstraint, QueryConstraint, QueryDocumentSnapshot, QueryEndAtConstraint, QueryFieldFilterConstraint, QueryLimitConstraint, QueryOrderByConstraint, QuerySnapshot, QueryStartAtConstraint, SnapshotMetadata, Timestamp, Transaction, WriteBatch, __PRIVATE_AutoId as _AutoId, ByteString as _ByteString, DatabaseId as _DatabaseId, DocumentKey as _DocumentKey, __PRIVATE_EmptyAppCheckTokenProvider as _EmptyAppCheckTokenProvider, __PRIVATE_EmptyAuthCredentialsProvider as _EmptyAuthCredentialsProvider, FieldPath$1 as _FieldPath, TestingHooks as _TestingHooks, __PRIVATE_cast as _cast, __PRIVATE_debugAssert as _debugAssert, __PRIVATE_isBase64Available as _isBase64Available, __PRIVATE_logWarn as _logWarn, __PRIVATE_validateIsNotUsedTogether as _validateIsNotUsedTogether, addDoc, aggregateFieldEqual, aggregateQuerySnapshotEqual, and, arrayRemove, arrayUnion, average, clearIndexedDbPersistence, collection, collectionGroup, connectFirestoreEmulator, count, deleteAllPersistentCacheIndexes, deleteDoc, deleteField, disableNetwork, disablePersistentCacheIndexAutoCreation, doc, documentId, enableIndexedDbPersistence, enableMultiTabIndexedDbPersistence, enableNetwork, enablePersistentCacheIndexAutoCreation, endAt, endBefore, ensureFirestoreConfigured, executeWrite, getAggregateFromServer, getCountFromServer, getDoc, getDocFromCache, getDocFromServer, getDocs, getDocsFromCache, getDocsFromServer, getFirestore, getPersistentCacheIndexManager, increment, initializeFirestore, limit, limitToLast, loadBundle, memoryEagerGarbageCollector, memoryLocalCache, memoryLruGarbageCollector, namedQuery, onSnapshot, onSnapshotsInSync, or, orderBy, persistentLocalCache, persistentMultipleTabManager, persistentSingleTabManager, query, queryEqual, refEqual, runTransaction, serverTimestamp, setDoc, setIndexConfiguration, setLogLevel, snapshotEqual, startAfter, startAt, sum, terminate, updateDoc, waitForPendingWrites, where, writeBatch };
|
|
21819
21818
|
//# sourceMappingURL=index.rn.js.map
|