@firebase/firestore 4.3.1 → 4.3.2-20231027003707
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/firestore/test/integration/util/composite_index_test_helper.d.ts +2 -1
- package/dist/index.cjs.js +293 -292
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm2017.js +294 -293
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +3054 -3053
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +2 -2
- package/dist/index.node.mjs +2 -2
- package/dist/index.rn.js +299 -298
- package/dist/index.rn.js.map +1 -1
- package/dist/lite/firestore/test/integration/util/composite_index_test_helper.d.ts +2 -1
- package/dist/lite/index.browser.esm2017.js +2 -2
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +2 -2
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.cjs.js +2 -2
- package/dist/lite/index.cjs.js.map +1 -1
- package/dist/lite/index.node.cjs.js +2 -2
- package/dist/lite/index.node.mjs +2 -2
- package/dist/lite/index.rn.esm2017.js +2 -2
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/packages/firestore/test/integration/util/composite_index_test_helper.d.ts +2 -1
- package/dist/packages/firestore/dist/index.esm2017.d.ts +2 -2
- package/dist/packages/firestore/test/integration/util/composite_index_test_helper.d.ts +2 -1
- package/package.json +2 -2
package/dist/index.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, FetchXmlHttpFactory as y, WebChannel as w, Event as S, Stat as b } from "@firebase/webchannel-wrapper";
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const D = "@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 C = "10.5.2-20231027003707";
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* @license
|
|
@@ -88,11 +88,11 @@ let D = "10.5.1";
|
|
|
88
88
|
* See the License for the specific language governing permissions and
|
|
89
89
|
* limitations under the License.
|
|
90
90
|
*/
|
|
91
|
-
const
|
|
91
|
+
const v = 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 v.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
|
+
v.setLogLevel(e);
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
function __PRIVATE_logDebug(e, ...t) {
|
|
115
|
-
if (
|
|
115
|
+
if (v.logLevel <= _.DEBUG) {
|
|
116
116
|
const n = t.map(__PRIVATE_argToString);
|
|
117
|
-
|
|
117
|
+
v.debug(`Firestore (${C}): ${e}`, ...n);
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
function __PRIVATE_logError(e, ...t) {
|
|
122
|
-
if (
|
|
122
|
+
if (v.logLevel <= _.ERROR) {
|
|
123
123
|
const n = t.map(__PRIVATE_argToString);
|
|
124
|
-
|
|
124
|
+
v.error(`Firestore (${C}): ${e}`, ...n);
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
/**
|
|
129
129
|
* @internal
|
|
130
130
|
*/ function __PRIVATE_logWarn(e, ...t) {
|
|
131
|
-
if (
|
|
131
|
+
if (v.logLevel <= _.WARN) {
|
|
132
132
|
const n = t.map(__PRIVATE_argToString);
|
|
133
|
-
|
|
133
|
+
v.warn(`Firestore (${C}): ${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 (${C}) 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 F = {
|
|
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(F.INVALID_ARGUMENT, "Timestamp nanoseconds out of range: " + t);
|
|
793
|
+
if (t >= 1e9) throw new FirestoreError(F.INVALID_ARGUMENT, "Timestamp nanoseconds out of range: " + t);
|
|
794
|
+
if (e < -62135596800) throw new FirestoreError(F.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(F.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(F.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 M = /^[_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 F = /^[_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 M.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 F = /^[_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(F.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(F.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(F.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(F.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 x = "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 !== F.FAILED_PRECONDITION || e.message !== x) 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(F.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(F.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(F.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 O = !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 O || (O = !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 N = [ "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 B = {}, L = [ "prefixPath", "collectionGroup", "readTime", "documentId" ], k = [ "prefixPath", "collectionGroup", "documentId" ], q = [ "collectionGroup", "readTime", "prefixPath", "documentId" ], Q = [ "canonicalId", "targetId" ], K = [ "targetId", "path" ], $ = [ "path", "targetId" ], U = [ "collectionId", "parent" ], W = [ "indexId", "uid" ], G = [ "uid", "sequenceNumber" ], z = [ "indexId", "uid", "arrayValue", "directionalValue", "orderedDocumentKey", "documentKey" ], j = [ "indexId", "uid", "orderedDocumentKey" ], H = [ "userId", "collectionPath", "documentId" ], J = [ "userId", "collectionPath", "largestBatchId" ], Y = [ "userId", "collectionGroup", "largestBatchId" ], Z = [ ...[ ...[ ...[ ...[ "mutationQueues", "mutations", "documentMutations", "remoteDocuments", "targets", "owner", "targetGlobal", "targetDocuments" ], "clientMetadata" ], "remoteDocumentGlobal" ], "collectionParents" ], "bundles", "namedQueries" ], X = [ ...Z, "documentOverlays" ], ee = [ "mutationQueues", "mutations", "documentMutations", "remoteDocumentsV14", "targets", "owner", "targetGlobal", "targetDocuments", "clientMetadata", "remoteDocumentGlobal", "collectionParents", "bundles", "namedQueries", "documentOverlays" ], te = ee, ne = [ ...te, "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 re = 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 ne = 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 = re.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 ie = {
|
|
3247
3247
|
mapValue: {
|
|
3248
3248
|
fields: {
|
|
3249
3249
|
__type__: {
|
|
@@ -3251,7 +3251,7 @@ const re = {
|
|
|
3251
3251
|
}
|
|
3252
3252
|
}
|
|
3253
3253
|
}
|
|
3254
|
-
},
|
|
3254
|
+
}, se = {
|
|
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 === ie.mapValue && t === ie.mapValue) return 0;
|
|
3399
|
+
if (e === ie.mapValue) return 1;
|
|
3400
|
+
if (t === ie.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 ? se : "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 ? ie : 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 = se, 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 = se, 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 = se;
|
|
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 = ie, 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 = ie, 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 = ie;
|
|
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 oe = new SortedMap(DocumentKey.comparator);
|
|
4768
4768
|
|
|
4769
4769
|
function __PRIVATE_mutableDocumentMap() {
|
|
4770
|
-
return
|
|
4770
|
+
return oe;
|
|
4771
4771
|
}
|
|
4772
4772
|
|
|
4773
|
-
const
|
|
4773
|
+
const _e = new SortedMap(DocumentKey.comparator);
|
|
4774
4774
|
|
|
4775
4775
|
function documentMap(...e) {
|
|
4776
|
-
let t =
|
|
4776
|
+
let t = _e;
|
|
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 = _e;
|
|
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 ae = new SortedMap(DocumentKey.comparator);
|
|
4799
4799
|
|
|
4800
|
-
const
|
|
4800
|
+
const ue = new SortedSet(DocumentKey.comparator);
|
|
4801
4801
|
|
|
4802
4802
|
function __PRIVATE_documentKeySet(...e) {
|
|
4803
|
-
let t =
|
|
4803
|
+
let t = ue;
|
|
4804
4804
|
for (const n of e) t = t.add(n);
|
|
4805
4805
|
return t;
|
|
4806
4806
|
}
|
|
4807
4807
|
|
|
4808
|
-
const
|
|
4808
|
+
const ce = new SortedSet(__PRIVATE_primitiveComparator);
|
|
4809
4809
|
|
|
4810
4810
|
function __PRIVATE_targetIdSet() {
|
|
4811
|
-
return
|
|
4811
|
+
return ce;
|
|
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 ae;
|
|
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 le, he;
|
|
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 F.CANCELLED:
|
|
5630
|
+
case F.UNKNOWN:
|
|
5631
|
+
case F.DEADLINE_EXCEEDED:
|
|
5632
|
+
case F.RESOURCE_EXHAUSTED:
|
|
5633
|
+
case F.INTERNAL:
|
|
5634
|
+
case F.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 F.UNAUTHENTICATED:
|
|
5638
5638
|
return !1;
|
|
5639
5639
|
|
|
5640
|
-
case
|
|
5641
|
-
case
|
|
5642
|
-
case
|
|
5643
|
-
case
|
|
5644
|
-
case
|
|
5640
|
+
case F.INVALID_ARGUMENT:
|
|
5641
|
+
case F.NOT_FOUND:
|
|
5642
|
+
case F.ALREADY_EXISTS:
|
|
5643
|
+
case F.PERMISSION_DENIED:
|
|
5644
|
+
case F.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 F.ABORTED:
|
|
5649
|
+
case F.OUT_OF_RANGE:
|
|
5650
|
+
case F.UNIMPLEMENTED:
|
|
5651
|
+
case F.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"), F.UNKNOWN;
|
|
5680
5680
|
switch (e) {
|
|
5681
|
-
case
|
|
5682
|
-
return
|
|
5681
|
+
case le.OK:
|
|
5682
|
+
return F.OK;
|
|
5683
5683
|
|
|
5684
|
-
case
|
|
5685
|
-
return
|
|
5684
|
+
case le.CANCELLED:
|
|
5685
|
+
return F.CANCELLED;
|
|
5686
5686
|
|
|
5687
|
-
case
|
|
5688
|
-
return
|
|
5687
|
+
case le.UNKNOWN:
|
|
5688
|
+
return F.UNKNOWN;
|
|
5689
5689
|
|
|
5690
|
-
case
|
|
5691
|
-
return
|
|
5690
|
+
case le.DEADLINE_EXCEEDED:
|
|
5691
|
+
return F.DEADLINE_EXCEEDED;
|
|
5692
5692
|
|
|
5693
|
-
case
|
|
5694
|
-
return
|
|
5693
|
+
case le.RESOURCE_EXHAUSTED:
|
|
5694
|
+
return F.RESOURCE_EXHAUSTED;
|
|
5695
5695
|
|
|
5696
|
-
case
|
|
5697
|
-
return
|
|
5696
|
+
case le.INTERNAL:
|
|
5697
|
+
return F.INTERNAL;
|
|
5698
5698
|
|
|
5699
|
-
case
|
|
5700
|
-
return
|
|
5699
|
+
case le.UNAVAILABLE:
|
|
5700
|
+
return F.UNAVAILABLE;
|
|
5701
5701
|
|
|
5702
|
-
case
|
|
5703
|
-
return
|
|
5702
|
+
case le.UNAUTHENTICATED:
|
|
5703
|
+
return F.UNAUTHENTICATED;
|
|
5704
5704
|
|
|
5705
|
-
case
|
|
5706
|
-
return
|
|
5705
|
+
case le.INVALID_ARGUMENT:
|
|
5706
|
+
return F.INVALID_ARGUMENT;
|
|
5707
5707
|
|
|
5708
|
-
case
|
|
5709
|
-
return
|
|
5708
|
+
case le.NOT_FOUND:
|
|
5709
|
+
return F.NOT_FOUND;
|
|
5710
5710
|
|
|
5711
|
-
case
|
|
5712
|
-
return
|
|
5711
|
+
case le.ALREADY_EXISTS:
|
|
5712
|
+
return F.ALREADY_EXISTS;
|
|
5713
5713
|
|
|
5714
|
-
case
|
|
5715
|
-
return
|
|
5714
|
+
case le.PERMISSION_DENIED:
|
|
5715
|
+
return F.PERMISSION_DENIED;
|
|
5716
5716
|
|
|
5717
|
-
case
|
|
5718
|
-
return
|
|
5717
|
+
case le.FAILED_PRECONDITION:
|
|
5718
|
+
return F.FAILED_PRECONDITION;
|
|
5719
5719
|
|
|
5720
|
-
case
|
|
5721
|
-
return
|
|
5720
|
+
case le.ABORTED:
|
|
5721
|
+
return F.ABORTED;
|
|
5722
5722
|
|
|
5723
|
-
case
|
|
5724
|
-
return
|
|
5723
|
+
case le.OUT_OF_RANGE:
|
|
5724
|
+
return F.OUT_OF_RANGE;
|
|
5725
5725
|
|
|
5726
|
-
case
|
|
5727
|
-
return
|
|
5726
|
+
case le.UNIMPLEMENTED:
|
|
5727
|
+
return F.UNIMPLEMENTED;
|
|
5728
5728
|
|
|
5729
|
-
case
|
|
5730
|
-
return
|
|
5729
|
+
case le.DATA_LOSS:
|
|
5730
|
+
return F.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
|
+
*/ (he = le || (le = {}))[he.OK = 0] = "OK", he[he.CANCELLED = 1] = "CANCELLED",
|
|
5745
|
+
he[he.UNKNOWN = 2] = "UNKNOWN", he[he.INVALID_ARGUMENT = 3] = "INVALID_ARGUMENT",
|
|
5746
|
+
he[he.DEADLINE_EXCEEDED = 4] = "DEADLINE_EXCEEDED", he[he.NOT_FOUND = 5] = "NOT_FOUND",
|
|
5747
|
+
he[he.ALREADY_EXISTS = 6] = "ALREADY_EXISTS", he[he.PERMISSION_DENIED = 7] = "PERMISSION_DENIED",
|
|
5748
|
+
he[he.UNAUTHENTICATED = 16] = "UNAUTHENTICATED", he[he.RESOURCE_EXHAUSTED = 8] = "RESOURCE_EXHAUSTED",
|
|
5749
|
+
he[he.FAILED_PRECONDITION = 9] = "FAILED_PRECONDITION", he[he.ABORTED = 10] = "ABORTED",
|
|
5750
|
+
he[he.OUT_OF_RANGE = 11] = "OUT_OF_RANGE", he[he.UNIMPLEMENTED = 12] = "UNIMPLEMENTED",
|
|
5751
|
+
he[he.INTERNAL = 13] = "INTERNAL", he[he.UNAVAILABLE = 14] = "UNAVAILABLE", he[he.DATA_LOSS = 15] = "DATA_LOSS";
|
|
5752
5752
|
|
|
5753
5753
|
/**
|
|
5754
5754
|
* @license
|
|
@@ -5773,7 +5773,7 @@ le[le.INTERNAL = 13] = "INTERNAL", le[le.UNAVAILABLE = 14] = "UNAVAILABLE", le[l
|
|
|
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 Pe = 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 Ie = 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(Ie) && (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 == Pe || Pe.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 Te = (() => {
|
|
6494
6494
|
const e = {
|
|
6495
6495
|
asc: "ASCENDING",
|
|
6496
6496
|
desc: "DESCENDING"
|
|
6497
6497
|
};
|
|
6498
6498
|
return e;
|
|
6499
|
-
})(),
|
|
6499
|
+
})(), Ee = (() => {
|
|
6500
6500
|
const e = {
|
|
6501
6501
|
"<": "LESS_THAN",
|
|
6502
6502
|
"<=": "LESS_THAN_OR_EQUAL",
|
|
@@ -6510,7 +6510,7 @@ const Ie = (() => {
|
|
|
6510
6510
|
"array-contains-any": "ARRAY_CONTAINS_ANY"
|
|
6511
6511
|
};
|
|
6512
6512
|
return e;
|
|
6513
|
-
})(),
|
|
6513
|
+
})(), de = (() => {
|
|
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(F.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(F.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 ? F.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 Te[e];
|
|
7038
7038
|
}
|
|
7039
7039
|
|
|
7040
7040
|
function __PRIVATE_toOperatorName(e) {
|
|
7041
|
-
return
|
|
7041
|
+
return Ee[e];
|
|
7042
7042
|
}
|
|
7043
7043
|
|
|
7044
7044
|
function __PRIVATE_toCompositeOperatorName(e) {
|
|
7045
|
-
return
|
|
7045
|
+
return de[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 Ae = 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]) : Ae, 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, Ae, 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, Ae, [] ], n = [ r[e + 1].indexId, this.uid, r[e + 1].arrayValue, r[e + 1].directionalValue, Ae, [] ];
|
|
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 Re = {
|
|
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, B));
|
|
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(Re)) : this.getCacheSize(e).next((n => n < this.params.cacheSizeCollectionThreshold ? (__PRIVATE_logDebug("LruGarbageCollector", `Garbage collection skipped; Cache size ${n} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),
|
|
9654
|
+
Re) : 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", N, {
|
|
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", N, {
|
|
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: H
|
|
11496
11496
|
});
|
|
11497
|
-
t.createIndex("collectionPathOverlayIndex",
|
|
11497
|
+
t.createIndex("collectionPathOverlayIndex", J, {
|
|
11498
11498
|
unique: !1
|
|
11499
|
-
}), t.createIndex("collectionGroupOverlayIndex",
|
|
11499
|
+
}), t.createIndex("collectionGroupOverlayIndex", Y, {
|
|
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: L
|
|
11506
11506
|
});
|
|
11507
|
-
t.createIndex("documentKeyIndex",
|
|
11507
|
+
t.createIndex("documentKeyIndex", k), t.createIndex("collectionGroupIndex", q);
|
|
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: W
|
|
11518
|
+
}).createIndex("sequenceNumberIndex", G, {
|
|
11519
11519
|
unique: !1
|
|
11520
11520
|
});
|
|
11521
11521
|
e.createObjectStore("indexEntries", {
|
|
11522
|
-
keyPath:
|
|
11523
|
-
}).createIndex("documentKeyIndex",
|
|
11522
|
+
keyPath: z
|
|
11523
|
+
}).createIndex("documentKeyIndex", j, {
|
|
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: U
|
|
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: K
|
|
11658
|
+
}).createIndex("documentTargetsIndex", $, {
|
|
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 Ve = "Failed to obtain exclusive access to the persistence layer. To allow shared access, multi-tab synchronization has to be enabled in all tabs. If you are using `experimentalForceOwningTab:true`, make sure that only one tab has persistence enabled at any given time.";
|
|
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(F.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(F.FAILED_PRECONDITION, Ve);
|
|
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(F.FAILED_PRECONDITION, Ve);
|
|
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 ? ne : 14 === e ? te : 13 === e ? ee : 12 === e ? X : 11 === e ? Z : 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(F.FAILED_PRECONDITION, x);
|
|
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(F.FAILED_PRECONDITION, Ve);
|
|
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 me = 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 === me ? me = function __PRIVATE_generateInitialUniqueDebugId() {
|
|
13509
13509
|
return 268435456 + Math.round(2147483648 * Math.random());
|
|
13510
|
-
}() :
|
|
13510
|
+
}() : me++, "0x" + me.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 fe = {
|
|
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 ge = "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/" + C;
|
|
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 = fe[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(ge, `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(ge, `RPC '${e}' ${i} timed out`), o(new FirestoreError(F.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(ge, `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(F).indexOf(t) >= 0 ? t : F.UNKNOWN;
|
|
13696
13696
|
}(t.status);
|
|
13697
13697
|
o(new FirestoreError(e, t.message));
|
|
13698
|
-
} else o(new FirestoreError(
|
|
13698
|
+
} else o(new FirestoreError(F.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(F.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(ge, `RPC '${e}' ${i} completed.`);
|
|
13710
13710
|
}
|
|
13711
13711
|
}));
|
|
13712
13712
|
const a = JSON.stringify(r);
|
|
13713
|
-
__PRIVATE_logDebug(
|
|
13713
|
+
__PRIVATE_logDebug(ge, `RPC '${e}' ${i} sending request:`, r), _.send(t, "POST", a, n, 15);
|
|
13714
13714
|
}));
|
|
13715
13715
|
}
|
|
13716
13716
|
vo(e, t, n) {
|
|
@@ -13738,8 +13738,9 @@ 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
|
-
|
|
13741
|
+
void 0 !== a && (_.longPollingTimeout = Math.round(1e3 * a)), this.useFetchStreams && (
|
|
13742
|
+
// TODO(b/307942499): switch to `useFetchStreams` once WebChannel is fixed.
|
|
13743
|
+
_.xmlHttpFactory = new y({})), this.bo(_.initMessageHeaders, t, n),
|
|
13743
13744
|
// Sending the custom headers we just added to request.initMessageHeaders
|
|
13744
13745
|
// (Authorization, etc.) will trigger the browser to make a CORS preflight
|
|
13745
13746
|
// request because the XHR will no longer meet the criteria for a "simple"
|
|
@@ -13751,7 +13752,7 @@ class __PRIVATE_RestConnection {
|
|
|
13751
13752
|
// which is recognized by the webchannel backend.
|
|
13752
13753
|
_.encodeInitMessageHeaders = !0;
|
|
13753
13754
|
const u = i.join("");
|
|
13754
|
-
__PRIVATE_logDebug(
|
|
13755
|
+
__PRIVATE_logDebug(ge, `Creating RPC '${e}' stream ${r}: ${u}`, _);
|
|
13755
13756
|
const c = s.createWebChannel(u, _);
|
|
13756
13757
|
// WebChannel supports sending the first message with the handshake - saving
|
|
13757
13758
|
// a network round trip. However, it will have to call send in the same
|
|
@@ -13764,8 +13765,8 @@ class __PRIVATE_RestConnection {
|
|
|
13764
13765
|
// on a closed stream
|
|
13765
13766
|
const P = new __PRIVATE_StreamBridge({
|
|
13766
13767
|
co: t => {
|
|
13767
|
-
h ? __PRIVATE_logDebug(
|
|
13768
|
-
c.open(), l = !0), __PRIVATE_logDebug(
|
|
13768
|
+
h ? __PRIVATE_logDebug(ge, `Not sending because RPC '${e}' stream ${r} is closed:`, t) : (l || (__PRIVATE_logDebug(ge, `Opening RPC '${e}' stream ${r} transport.`),
|
|
13769
|
+
c.open(), l = !0), __PRIVATE_logDebug(ge, `RPC '${e}' stream ${r} sending:`, t),
|
|
13769
13770
|
c.send(t));
|
|
13770
13771
|
},
|
|
13771
13772
|
lo: () => c.close()
|
|
@@ -13786,15 +13787,15 @@ class __PRIVATE_RestConnection {
|
|
|
13786
13787
|
// exception and rethrow using a setTimeout so they become visible again.
|
|
13787
13788
|
// Note that eventually this function could go away if we are confident
|
|
13788
13789
|
// enough the code is exception free.
|
|
13789
|
-
return __PRIVATE_unguardedEventListen(c,
|
|
13790
|
-
h || __PRIVATE_logDebug(
|
|
13791
|
-
})), __PRIVATE_unguardedEventListen(c,
|
|
13792
|
-
h || (h = !0, __PRIVATE_logDebug(
|
|
13790
|
+
return __PRIVATE_unguardedEventListen(c, w.EventType.OPEN, (() => {
|
|
13791
|
+
h || __PRIVATE_logDebug(ge, `RPC '${e}' stream ${r} transport opened.`);
|
|
13792
|
+
})), __PRIVATE_unguardedEventListen(c, w.EventType.CLOSE, (() => {
|
|
13793
|
+
h || (h = !0, __PRIVATE_logDebug(ge, `RPC '${e}' stream ${r} transport closed`),
|
|
13793
13794
|
P.Ro());
|
|
13794
|
-
})), __PRIVATE_unguardedEventListen(c,
|
|
13795
|
-
h || (h = !0, __PRIVATE_logWarn(
|
|
13796
|
-
P.Ro(new FirestoreError(
|
|
13797
|
-
})), __PRIVATE_unguardedEventListen(c,
|
|
13795
|
+
})), __PRIVATE_unguardedEventListen(c, w.EventType.ERROR, (t => {
|
|
13796
|
+
h || (h = !0, __PRIVATE_logWarn(ge, `RPC '${e}' stream ${r} transport errored:`, t),
|
|
13797
|
+
P.Ro(new FirestoreError(F.UNAVAILABLE, "The operation could not be completed")));
|
|
13798
|
+
})), __PRIVATE_unguardedEventListen(c, w.EventType.MESSAGE, (t => {
|
|
13798
13799
|
var n;
|
|
13799
13800
|
if (!h) {
|
|
13800
13801
|
const i = t.data[0];
|
|
@@ -13806,7 +13807,7 @@ class __PRIVATE_RestConnection {
|
|
|
13806
13807
|
// Use any because msgData.error is not typed.
|
|
13807
13808
|
const s = i, o = s.error || (null === (n = s[0]) || void 0 === n ? void 0 : n.error);
|
|
13808
13809
|
if (o) {
|
|
13809
|
-
__PRIVATE_logDebug(
|
|
13810
|
+
__PRIVATE_logDebug(ge, `RPC '${e}' stream ${r} received error:`, o);
|
|
13810
13811
|
// error.status will be a string like 'OK' or 'NOT_FOUND'.
|
|
13811
13812
|
const t = o.status;
|
|
13812
13813
|
let n =
|
|
@@ -13819,16 +13820,16 @@ class __PRIVATE_RestConnection {
|
|
|
13819
13820
|
function __PRIVATE_mapCodeFromRpcStatus(e) {
|
|
13820
13821
|
// lookup by string
|
|
13821
13822
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13822
|
-
const t =
|
|
13823
|
+
const t = le[e];
|
|
13823
13824
|
if (void 0 !== t) return __PRIVATE_mapCodeFromRpcCode(t);
|
|
13824
13825
|
}(t), i = o.message;
|
|
13825
|
-
void 0 === n && (n =
|
|
13826
|
+
void 0 === n && (n = F.INTERNAL, i = "Unknown error status: " + t + " with message " + o.message),
|
|
13826
13827
|
// Mark closed so no further events are propagated
|
|
13827
13828
|
h = !0, P.Ro(new FirestoreError(n, i)), c.close();
|
|
13828
|
-
} else __PRIVATE_logDebug(
|
|
13829
|
+
} else __PRIVATE_logDebug(ge, `RPC '${e}' stream ${r} received:`, i), P.Vo(i);
|
|
13829
13830
|
}
|
|
13830
|
-
})), __PRIVATE_unguardedEventListen(o,
|
|
13831
|
-
t.stat ===
|
|
13831
|
+
})), __PRIVATE_unguardedEventListen(o, S.STAT_EVENT, (t => {
|
|
13832
|
+
t.stat === b.PROXY ? __PRIVATE_logDebug(ge, `RPC '${e}' stream ${r} detected buffering proxy`) : t.stat === b.NOPROXY && __PRIVATE_logDebug(ge, `RPC '${e}' stream ${r} detected no buffering proxy`);
|
|
13832
13833
|
})), setTimeout((() => {
|
|
13833
13834
|
// Technically we could/should wait for the WebChannel opened event,
|
|
13834
13835
|
// but because we want to send the first message with the WebChannel
|
|
@@ -14152,10 +14153,10 @@ class __PRIVATE_PersistentStream {
|
|
|
14152
14153
|
// underlying stream), guaranteeing they won't execute.
|
|
14153
14154
|
this.Uo++, 4 /* PersistentStreamState.Error */ !== e ?
|
|
14154
14155
|
// If this is an intentional close ensure we don't delay our next connection attempt.
|
|
14155
|
-
this.zo.reset() : t && t.code ===
|
|
14156
|
+
this.zo.reset() : t && t.code === F.RESOURCE_EXHAUSTED ? (
|
|
14156
14157
|
// Log the error. (Probably either 'quota exceeded' or 'max queue length reached'.)
|
|
14157
14158
|
__PRIVATE_logError(t.toString()), __PRIVATE_logError("Using maximum backoff delay to prevent overloading the backend."),
|
|
14158
|
-
this.zo.Lo()) : t && t.code ===
|
|
14159
|
+
this.zo.Lo()) : t && t.code === F.UNAUTHENTICATED && 3 /* PersistentStreamState.Healthy */ !== this.state && (
|
|
14159
14160
|
// "unauthenticated" error means the token was rejected. This should rarely
|
|
14160
14161
|
// happen since both Auth and AppCheck ensure a sufficient TTL when we
|
|
14161
14162
|
// request a token. If a user manually resets their system clock this can
|
|
@@ -14191,7 +14192,7 @@ class __PRIVATE_PersistentStream {
|
|
|
14191
14192
|
this.s_(e, n);
|
|
14192
14193
|
}), (t => {
|
|
14193
14194
|
e((() => {
|
|
14194
|
-
const e = new FirestoreError(
|
|
14195
|
+
const e = new FirestoreError(F.UNKNOWN, "Fetching auth token failed: " + t.message);
|
|
14195
14196
|
return this.o_(e);
|
|
14196
14197
|
}));
|
|
14197
14198
|
}));
|
|
@@ -14404,18 +14405,18 @@ class __PRIVATE_DatastoreImpl extends class Datastore {} {
|
|
|
14404
14405
|
this.serializer = r, this.d_ = !1;
|
|
14405
14406
|
}
|
|
14406
14407
|
A_() {
|
|
14407
|
-
if (this.d_) throw new FirestoreError(
|
|
14408
|
+
if (this.d_) throw new FirestoreError(F.FAILED_PRECONDITION, "The client has already been terminated.");
|
|
14408
14409
|
}
|
|
14409
14410
|
/** Invokes the provided RPC with auth and AppCheck tokens. */ wo(e, t, n) {
|
|
14410
14411
|
return this.A_(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, i]) => this.connection.wo(e, t, n, r, i))).catch((e => {
|
|
14411
|
-
throw "FirebaseError" === e.name ? (e.code ===
|
|
14412
|
-
this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(
|
|
14412
|
+
throw "FirebaseError" === e.name ? (e.code === F.UNAUTHENTICATED && (this.authCredentials.invalidateToken(),
|
|
14413
|
+
this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(F.UNKNOWN, e.toString());
|
|
14413
14414
|
}));
|
|
14414
14415
|
}
|
|
14415
14416
|
/** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ Co(e, t, n, r) {
|
|
14416
14417
|
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 => {
|
|
14417
|
-
throw "FirebaseError" === e.name ? (e.code ===
|
|
14418
|
-
this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(
|
|
14418
|
+
throw "FirebaseError" === e.name ? (e.code === F.UNAUTHENTICATED && (this.authCredentials.invalidateToken(),
|
|
14419
|
+
this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(F.UNKNOWN, e.toString());
|
|
14419
14420
|
}));
|
|
14420
14421
|
}
|
|
14421
14422
|
terminate() {
|
|
@@ -14905,7 +14906,7 @@ async function __PRIVATE_onWriteStreamClose(e, t) {
|
|
|
14905
14906
|
// Only handle permanent errors here. If it's transient, just let the retry
|
|
14906
14907
|
// logic kick in.
|
|
14907
14908
|
if (function __PRIVATE_isPermanentWriteError(e) {
|
|
14908
|
-
return __PRIVATE_isPermanentError(e) && e !==
|
|
14909
|
+
return __PRIVATE_isPermanentError(e) && e !== F.ABORTED;
|
|
14909
14910
|
}(t.code)) {
|
|
14910
14911
|
// This was a permanent error, the request itself was the problem
|
|
14911
14912
|
// so it's not going to succeed if we resend it.
|
|
@@ -15086,7 +15087,7 @@ class DelayedOperation {
|
|
|
15086
15087
|
* As long as the operation has not yet been run, calling cancel() provides a
|
|
15087
15088
|
* guarantee that the operation will not be run.
|
|
15088
15089
|
*/ cancel(e) {
|
|
15089
|
-
null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new FirestoreError(
|
|
15090
|
+
null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new FirestoreError(F.CANCELLED, "Operation cancelled" + (e ? ": " + e : ""))));
|
|
15090
15091
|
}
|
|
15091
15092
|
handleDelayElapsed() {
|
|
15092
15093
|
this.asyncQueue.enqueueAndForget((() => null !== this.timerHandle ? (this.clearTimeout(),
|
|
@@ -15102,7 +15103,7 @@ class DelayedOperation {
|
|
|
15102
15103
|
* Returns a FirestoreError that can be surfaced to the user if the provided
|
|
15103
15104
|
* error is an IndexedDbTransactionError. Re-throws the error otherwise.
|
|
15104
15105
|
*/ function __PRIVATE_wrapInUserErrorIfRecoverable(e, t) {
|
|
15105
|
-
if (__PRIVATE_logError("AsyncQueue", `${t}: ${e}`), __PRIVATE_isIndexedDbTransactionError(e)) return new FirestoreError(
|
|
15106
|
+
if (__PRIVATE_logError("AsyncQueue", `${t}: ${e}`), __PRIVATE_isIndexedDbTransactionError(e)) return new FirestoreError(F.UNAVAILABLE, `${t}: ${e}`);
|
|
15106
15107
|
throw e;
|
|
15107
15108
|
}
|
|
15108
15109
|
|
|
@@ -16382,7 +16383,7 @@ async function __PRIVATE_syncEngineHandleCredentialChange(e, t) {
|
|
|
16382
16383
|
function __PRIVATE_rejectOutstandingPendingWritesCallbacks(e, t) {
|
|
16383
16384
|
e.ba.forEach((e => {
|
|
16384
16385
|
e.forEach((e => {
|
|
16385
|
-
e.reject(new FirestoreError(
|
|
16386
|
+
e.reject(new FirestoreError(F.CANCELLED, t));
|
|
16386
16387
|
}));
|
|
16387
16388
|
})), e.ba.clear();
|
|
16388
16389
|
}(n, "'waitForPendingWrites' promise is rejected due to a user change."),
|
|
@@ -16811,7 +16812,7 @@ class __PRIVATE_LruGcMemoryOfflineComponentProvider extends MemoryOfflineCompone
|
|
|
16811
16812
|
}
|
|
16812
16813
|
createSharedClientState(e) {
|
|
16813
16814
|
const t = __PRIVATE_getWindow();
|
|
16814
|
-
if (!__PRIVATE_WebStorageSharedClientState.D(t)) throw new FirestoreError(
|
|
16815
|
+
if (!__PRIVATE_WebStorageSharedClientState.D(t)) throw new FirestoreError(F.UNIMPLEMENTED, "IndexedDB persistence is only available on platforms that support LocalStorage.");
|
|
16815
16816
|
const n = __PRIVATE_indexedDbStoragePrefix(e.databaseInfo.databaseId, e.databaseInfo.persistenceKey);
|
|
16816
16817
|
return new __PRIVATE_WebStorageSharedClientState(t, e.asyncQueue, n, e.clientId, e.initialUser);
|
|
16817
16818
|
}
|
|
@@ -17148,7 +17149,7 @@ class Transaction$2 {
|
|
|
17148
17149
|
this.writtenDocs = new Set;
|
|
17149
17150
|
}
|
|
17150
17151
|
async lookup(e) {
|
|
17151
|
-
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new FirestoreError(
|
|
17152
|
+
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new FirestoreError(F.INVALID_ARGUMENT, "Firestore transactions require all reads to be executed before all writes.");
|
|
17152
17153
|
const t = await async function __PRIVATE_invokeBatchGetDocumentsRpc(e, t) {
|
|
17153
17154
|
const n = __PRIVATE_debugCast(e), r = __PRIVATE_getEncodedDatabaseId(n.serializer) + "/documents", i = {
|
|
17154
17155
|
documents: t.map((e => __PRIVATE_toName(n.serializer, e)))
|
|
@@ -17209,7 +17210,7 @@ class Transaction$2 {
|
|
|
17209
17210
|
if (n) {
|
|
17210
17211
|
if (!t.isEqual(n))
|
|
17211
17212
|
// This transaction will fail no matter what.
|
|
17212
|
-
throw new FirestoreError(
|
|
17213
|
+
throw new FirestoreError(F.ABORTED, "Document version changed between two reads.");
|
|
17213
17214
|
} else this.readVersions.set(e.key.toString(), t);
|
|
17214
17215
|
}
|
|
17215
17216
|
/**
|
|
@@ -17236,7 +17237,7 @@ class Transaction$2 {
|
|
|
17236
17237
|
// express that to the backend, we have to validate locally.
|
|
17237
17238
|
// Note: this can change once we can send separate verify writes in the
|
|
17238
17239
|
// transaction.
|
|
17239
|
-
throw new FirestoreError(
|
|
17240
|
+
throw new FirestoreError(F.INVALID_ARGUMENT, "Can't update a document that doesn't exist.");
|
|
17240
17241
|
// Document exists, base precondition on document update time.
|
|
17241
17242
|
return Precondition.updateTime(t);
|
|
17242
17243
|
}
|
|
@@ -17377,7 +17378,7 @@ class FirestoreClient {
|
|
|
17377
17378
|
* Checks that the client has not been terminated. Ensures that other methods on //
|
|
17378
17379
|
* this class cannot be called after the client is terminated. //
|
|
17379
17380
|
*/ verifyNotTerminated() {
|
|
17380
|
-
if (this.asyncQueue.isShuttingDown) throw new FirestoreError(
|
|
17381
|
+
if (this.asyncQueue.isShuttingDown) throw new FirestoreError(F.FAILED_PRECONDITION, "The client has already been terminated.");
|
|
17381
17382
|
}
|
|
17382
17383
|
terminate() {
|
|
17383
17384
|
this.asyncQueue.enterRestrictedMode();
|
|
@@ -17427,7 +17428,7 @@ async function __PRIVATE_setOnlineComponentProvider(e, t) {
|
|
|
17427
17428
|
* Decides whether the provided error allows us to gracefully disable
|
|
17428
17429
|
* persistence (as opposed to crashing the client).
|
|
17429
17430
|
*/ function __PRIVATE_canFallbackFromIndexedDbError(e) {
|
|
17430
|
-
return "FirebaseError" === e.name ? e.code ===
|
|
17431
|
+
return "FirebaseError" === e.name ? e.code === F.FAILED_PRECONDITION || e.code === F.UNIMPLEMENTED : !("undefined" != typeof DOMException && e instanceof DOMException) || (
|
|
17431
17432
|
// When the browser is out of quota we could get either quota exceeded
|
|
17432
17433
|
// or an aborted error depending on whether the error happened during
|
|
17433
17434
|
// schema migration.
|
|
@@ -17519,7 +17520,7 @@ async function __PRIVATE_getEventManager(e) {
|
|
|
17519
17520
|
const n = __PRIVATE_debugCast(e);
|
|
17520
17521
|
return n.persistence.runTransaction("read document", "readonly", (e => n.localDocuments.getDocument(e, t)));
|
|
17521
17522
|
}(e, t);
|
|
17522
|
-
r.isFoundDocument() ? n.resolve(r) : r.isNoDocument() ? n.resolve(null) : n.reject(new FirestoreError(
|
|
17523
|
+
r.isFoundDocument() ? n.resolve(r) : r.isNoDocument() ? n.resolve(null) : n.reject(new FirestoreError(F.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.)"));
|
|
17523
17524
|
} catch (e) {
|
|
17524
17525
|
const r = __PRIVATE_wrapInUserErrorIfRecoverable(e, `Failed to get document '${t} from cache`);
|
|
17525
17526
|
n.reject(r);
|
|
@@ -17548,7 +17549,7 @@ function __PRIVATE_firestoreClientGetDocumentViaSnapshotListener(e, t, n = {}) {
|
|
|
17548
17549
|
// the server so we can deliver that even when you're
|
|
17549
17550
|
// offline 2) Actually reject the Promise in the online case
|
|
17550
17551
|
// if the document doesn't exist.
|
|
17551
|
-
i.reject(new FirestoreError(
|
|
17552
|
+
i.reject(new FirestoreError(F.UNAVAILABLE, "Failed to get document because the client is offline.")) : _ && s.fromCache && r && "server" === r.source ? i.reject(new FirestoreError(F.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);
|
|
17552
17553
|
},
|
|
17553
17554
|
error: e => i.reject(e)
|
|
17554
17555
|
}), o = new __PRIVATE_QueryListener(__PRIVATE_newQueryForPath(n.path), s, {
|
|
@@ -17585,7 +17586,7 @@ function __PRIVATE_firestoreClientGetDocumentsViaSnapshotListener(e, t, n = {})
|
|
|
17585
17586
|
next: n => {
|
|
17586
17587
|
// Remove query first before passing event to user to avoid
|
|
17587
17588
|
// user actions affecting the now stale query.
|
|
17588
|
-
t.enqueueAndForget((() => __PRIVATE_eventManagerUnlisten(e, o))), n.fromCache && "server" === r.source ? i.reject(new FirestoreError(
|
|
17589
|
+
t.enqueueAndForget((() => __PRIVATE_eventManagerUnlisten(e, o))), n.fromCache && "server" === r.source ? i.reject(new FirestoreError(F.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);
|
|
17589
17590
|
},
|
|
17590
17591
|
error: e => i.reject(e)
|
|
17591
17592
|
}), o = new __PRIVATE_QueryListener(n, s, {
|
|
@@ -17785,7 +17786,7 @@ function __PRIVATE_cloneLongPollingOptions(e) {
|
|
|
17785
17786
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17786
17787
|
* See the License for the specific language governing permissions and
|
|
17787
17788
|
* limitations under the License.
|
|
17788
|
-
*/ const
|
|
17789
|
+
*/ const pe = new Map;
|
|
17789
17790
|
|
|
17790
17791
|
/**
|
|
17791
17792
|
* An instance map that ensures only one Datastore exists per Firestore
|
|
@@ -17808,28 +17809,28 @@ function __PRIVATE_cloneLongPollingOptions(e) {
|
|
|
17808
17809
|
* limitations under the License.
|
|
17809
17810
|
*/
|
|
17810
17811
|
function __PRIVATE_validateNonEmptyArgument(e, t, n) {
|
|
17811
|
-
if (!n) throw new FirestoreError(
|
|
17812
|
+
if (!n) throw new FirestoreError(F.INVALID_ARGUMENT, `Function ${e}() cannot be called with an empty ${t}.`);
|
|
17812
17813
|
}
|
|
17813
17814
|
|
|
17814
17815
|
/**
|
|
17815
17816
|
* Validates that two boolean options are not set at the same time.
|
|
17816
17817
|
* @internal
|
|
17817
17818
|
*/ function __PRIVATE_validateIsNotUsedTogether(e, t, n, r) {
|
|
17818
|
-
if (!0 === t && !0 === r) throw new FirestoreError(
|
|
17819
|
+
if (!0 === t && !0 === r) throw new FirestoreError(F.INVALID_ARGUMENT, `${e} and ${n} cannot be used together.`);
|
|
17819
17820
|
}
|
|
17820
17821
|
|
|
17821
17822
|
/**
|
|
17822
17823
|
* Validates that `path` refers to a document (indicated by the fact it contains
|
|
17823
17824
|
* an even numbers of segments).
|
|
17824
17825
|
*/ function __PRIVATE_validateDocumentPath(e) {
|
|
17825
|
-
if (!DocumentKey.isDocumentKey(e)) throw new FirestoreError(
|
|
17826
|
+
if (!DocumentKey.isDocumentKey(e)) throw new FirestoreError(F.INVALID_ARGUMENT, `Invalid document reference. Document references must have an even number of segments, but ${e} has ${e.length}.`);
|
|
17826
17827
|
}
|
|
17827
17828
|
|
|
17828
17829
|
/**
|
|
17829
17830
|
* Validates that `path` refers to a collection (indicated by the fact it
|
|
17830
17831
|
* contains an odd numbers of segments).
|
|
17831
17832
|
*/ function __PRIVATE_validateCollectionPath(e) {
|
|
17832
|
-
if (DocumentKey.isDocumentKey(e)) throw new FirestoreError(
|
|
17833
|
+
if (DocumentKey.isDocumentKey(e)) throw new FirestoreError(F.INVALID_ARGUMENT, `Invalid collection reference. Collection references must have an odd number of segments, but ${e} has ${e.length}.`);
|
|
17833
17834
|
}
|
|
17834
17835
|
|
|
17835
17836
|
/**
|
|
@@ -17873,17 +17874,17 @@ t) {
|
|
|
17873
17874
|
// Unwrap Compat types
|
|
17874
17875
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17875
17876
|
e = e._delegate), !(e instanceof t)) {
|
|
17876
|
-
if (t.name === e.constructor.name) throw new FirestoreError(
|
|
17877
|
+
if (t.name === e.constructor.name) throw new FirestoreError(F.INVALID_ARGUMENT, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
|
|
17877
17878
|
{
|
|
17878
17879
|
const n = __PRIVATE_valueDescription(e);
|
|
17879
|
-
throw new FirestoreError(
|
|
17880
|
+
throw new FirestoreError(F.INVALID_ARGUMENT, `Expected type '${t.name}', but it was: ${n}`);
|
|
17880
17881
|
}
|
|
17881
17882
|
}
|
|
17882
17883
|
return e;
|
|
17883
17884
|
}
|
|
17884
17885
|
|
|
17885
17886
|
function __PRIVATE_validatePositiveNumber(e, t) {
|
|
17886
|
-
if (t <= 0) throw new FirestoreError(
|
|
17887
|
+
if (t <= 0) throw new FirestoreError(F.INVALID_ARGUMENT, `Function ${e}() requires a positive number, but it was: ${t}.`);
|
|
17887
17888
|
}
|
|
17888
17889
|
|
|
17889
17890
|
/**
|
|
@@ -17912,12 +17913,12 @@ class FirestoreSettingsImpl {
|
|
|
17912
17913
|
constructor(e) {
|
|
17913
17914
|
var t, n;
|
|
17914
17915
|
if (void 0 === e.host) {
|
|
17915
|
-
if (void 0 !== e.ssl) throw new FirestoreError(
|
|
17916
|
+
if (void 0 !== e.ssl) throw new FirestoreError(F.INVALID_ARGUMENT, "Can't provide ssl option if host option is not set");
|
|
17916
17917
|
this.host = "firestore.googleapis.com", this.ssl = true;
|
|
17917
17918
|
} else this.host = e.host, this.ssl = null === (t = e.ssl) || void 0 === t || t;
|
|
17918
17919
|
if (this.credentials = e.credentials, this.ignoreUndefinedProperties = !!e.ignoreUndefinedProperties,
|
|
17919
17920
|
this.localCache = e.localCache, void 0 === e.cacheSizeBytes) this.cacheSizeBytes = 41943040; else {
|
|
17920
|
-
if (-1 !== e.cacheSizeBytes && e.cacheSizeBytes < 1048576) throw new FirestoreError(
|
|
17921
|
+
if (-1 !== e.cacheSizeBytes && e.cacheSizeBytes < 1048576) throw new FirestoreError(F.INVALID_ARGUMENT, "cacheSizeBytes must be at least 1048576");
|
|
17921
17922
|
this.cacheSizeBytes = e.cacheSizeBytes;
|
|
17922
17923
|
}
|
|
17923
17924
|
__PRIVATE_validateIsNotUsedTogether("experimentalForceLongPolling", e.experimentalForceLongPolling, "experimentalAutoDetectLongPolling", e.experimentalAutoDetectLongPolling),
|
|
@@ -17929,9 +17930,9 @@ class FirestoreSettingsImpl {
|
|
|
17929
17930
|
this.experimentalLongPollingOptions = __PRIVATE_cloneLongPollingOptions(null !== (n = e.experimentalLongPollingOptions) && void 0 !== n ? n : {}),
|
|
17930
17931
|
function __PRIVATE_validateLongPollingOptions(e) {
|
|
17931
17932
|
if (void 0 !== e.timeoutSeconds) {
|
|
17932
|
-
if (isNaN(e.timeoutSeconds)) throw new FirestoreError(
|
|
17933
|
-
if (e.timeoutSeconds < 5) throw new FirestoreError(
|
|
17934
|
-
if (e.timeoutSeconds > 30) throw new FirestoreError(
|
|
17933
|
+
if (isNaN(e.timeoutSeconds)) throw new FirestoreError(F.INVALID_ARGUMENT, `invalid long polling timeout: ${e.timeoutSeconds} (must not be NaN)`);
|
|
17934
|
+
if (e.timeoutSeconds < 5) throw new FirestoreError(F.INVALID_ARGUMENT, `invalid long polling timeout: ${e.timeoutSeconds} (minimum allowed value is 5)`);
|
|
17935
|
+
if (e.timeoutSeconds > 30) throw new FirestoreError(F.INVALID_ARGUMENT, `invalid long polling timeout: ${e.timeoutSeconds} (maximum allowed value is 30)`);
|
|
17935
17936
|
}
|
|
17936
17937
|
}
|
|
17937
17938
|
/**
|
|
@@ -17978,7 +17979,7 @@ class Firestore$1 {
|
|
|
17978
17979
|
* The {@link @firebase/app#FirebaseApp} associated with this `Firestore` service
|
|
17979
17980
|
* instance.
|
|
17980
17981
|
*/ get app() {
|
|
17981
|
-
if (!this._app) throw new FirestoreError(
|
|
17982
|
+
if (!this._app) throw new FirestoreError(F.FAILED_PRECONDITION, "Firestore was not initialized using the Firebase SDK. 'app' is not available");
|
|
17982
17983
|
return this._app;
|
|
17983
17984
|
}
|
|
17984
17985
|
get _initialized() {
|
|
@@ -17988,7 +17989,7 @@ class Firestore$1 {
|
|
|
17988
17989
|
return void 0 !== this._terminateTask;
|
|
17989
17990
|
}
|
|
17990
17991
|
_setSettings(e) {
|
|
17991
|
-
if (this._settingsFrozen) throw new FirestoreError(
|
|
17992
|
+
if (this._settingsFrozen) throw new FirestoreError(F.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.");
|
|
17992
17993
|
this._settings = new FirestoreSettingsImpl(e), void 0 !== e.credentials && (this._authCredentials = function __PRIVATE_makeAuthCredentialsProvider(e) {
|
|
17993
17994
|
if (!e) return new __PRIVATE_EmptyAuthCredentialsProvider;
|
|
17994
17995
|
switch (e.type) {
|
|
@@ -17999,7 +18000,7 @@ class Firestore$1 {
|
|
|
17999
18000
|
return e.client;
|
|
18000
18001
|
|
|
18001
18002
|
default:
|
|
18002
|
-
throw new FirestoreError(
|
|
18003
|
+
throw new FirestoreError(F.INVALID_ARGUMENT, "makeAuthCredentialsProvider failed due to invalid credential type");
|
|
18003
18004
|
}
|
|
18004
18005
|
}(e.credentials));
|
|
18005
18006
|
}
|
|
@@ -18031,8 +18032,8 @@ class Firestore$1 {
|
|
|
18031
18032
|
* when the `Firestore` instance is terminated.
|
|
18032
18033
|
*/
|
|
18033
18034
|
return function __PRIVATE_removeComponents(e) {
|
|
18034
|
-
const t =
|
|
18035
|
-
t && (__PRIVATE_logDebug("ComponentProvider", "Removing Datastore"),
|
|
18035
|
+
const t = pe.get(e);
|
|
18036
|
+
t && (__PRIVATE_logDebug("ComponentProvider", "Removing Datastore"), pe.delete(e),
|
|
18036
18037
|
t.terminate());
|
|
18037
18038
|
}(this), Promise.resolve();
|
|
18038
18039
|
}
|
|
@@ -18064,7 +18065,7 @@ class Firestore$1 {
|
|
|
18064
18065
|
// invalid field "uid" and missing field "sub" / "user_id".)
|
|
18065
18066
|
t = I(r.mockUserToken, null === (i = e._app) || void 0 === i ? void 0 : i.options.projectId);
|
|
18066
18067
|
const s = r.mockUserToken.sub || r.mockUserToken.user_id;
|
|
18067
|
-
if (!s) throw new FirestoreError(
|
|
18068
|
+
if (!s) throw new FirestoreError(F.INVALID_ARGUMENT, "mockUserToken must contain 'sub' or 'user_id' field!");
|
|
18068
18069
|
n = new User(s);
|
|
18069
18070
|
}
|
|
18070
18071
|
e._authCredentials = new __PRIVATE_EmulatorAuthCredentialsProvider(new __PRIVATE_OAuthToken(t, n));
|
|
@@ -18184,7 +18185,7 @@ function collection(e, t, ...n) {
|
|
|
18184
18185
|
return __PRIVATE_validateCollectionPath(r), new CollectionReference(e, /* converter= */ null, r);
|
|
18185
18186
|
}
|
|
18186
18187
|
{
|
|
18187
|
-
if (!(e instanceof DocumentReference || e instanceof CollectionReference)) throw new FirestoreError(
|
|
18188
|
+
if (!(e instanceof DocumentReference || e instanceof CollectionReference)) throw new FirestoreError(F.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
18188
18189
|
const r = e._path.child(ResourcePath.fromString(t, ...n));
|
|
18189
18190
|
return __PRIVATE_validateCollectionPath(r), new CollectionReference(e.firestore,
|
|
18190
18191
|
/* converter= */ null, r);
|
|
@@ -18205,7 +18206,7 @@ function collection(e, t, ...n) {
|
|
|
18205
18206
|
* @returns The created `Query`.
|
|
18206
18207
|
*/ function collectionGroup(e, t) {
|
|
18207
18208
|
if (e = __PRIVATE_cast(e, Firestore$1), __PRIVATE_validateNonEmptyArgument("collectionGroup", "collection id", t),
|
|
18208
|
-
t.indexOf("/") >= 0) throw new FirestoreError(
|
|
18209
|
+
t.indexOf("/") >= 0) throw new FirestoreError(F.INVALID_ARGUMENT, `Invalid collection ID '${t}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
|
|
18209
18210
|
return new Query(e,
|
|
18210
18211
|
/* converter= */ null, function __PRIVATE_newQueryForCollectionGroup(e) {
|
|
18211
18212
|
return new __PRIVATE_QueryImpl(ResourcePath.emptyPath(), e);
|
|
@@ -18223,7 +18224,7 @@ function doc(e, t, ...n) {
|
|
|
18223
18224
|
/* converter= */ null, new DocumentKey(r));
|
|
18224
18225
|
}
|
|
18225
18226
|
{
|
|
18226
|
-
if (!(e instanceof DocumentReference || e instanceof CollectionReference)) throw new FirestoreError(
|
|
18227
|
+
if (!(e instanceof DocumentReference || e instanceof CollectionReference)) throw new FirestoreError(F.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
18227
18228
|
const r = e._path.child(ResourcePath.fromString(t, ...n));
|
|
18228
18229
|
return __PRIVATE_validateDocumentPath(r), new DocumentReference(e.firestore, e instanceof CollectionReference ? e.converter : null, new DocumentKey(r));
|
|
18229
18230
|
}
|
|
@@ -18583,7 +18584,7 @@ class LoadBundleTask {
|
|
|
18583
18584
|
* Constant used to indicate the LRU garbage collection should be disabled.
|
|
18584
18585
|
* Set this value as the `cacheSizeBytes` on the settings passed to the
|
|
18585
18586
|
* {@link Firestore} instance.
|
|
18586
|
-
*/ const
|
|
18587
|
+
*/ const ye = -1;
|
|
18587
18588
|
|
|
18588
18589
|
/**
|
|
18589
18590
|
* The Cloud Firestore service interface.
|
|
@@ -18627,10 +18628,10 @@ class LoadBundleTask {
|
|
|
18627
18628
|
identifier: n
|
|
18628
18629
|
}), i = r.getOptions(n);
|
|
18629
18630
|
if (E(i, t)) return e;
|
|
18630
|
-
throw new FirestoreError(
|
|
18631
|
+
throw new FirestoreError(F.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.");
|
|
18631
18632
|
}
|
|
18632
|
-
if (void 0 !== t.cacheSizeBytes && void 0 !== t.localCache) throw new FirestoreError(
|
|
18633
|
-
if (void 0 !== t.cacheSizeBytes && -1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new FirestoreError(
|
|
18633
|
+
if (void 0 !== t.cacheSizeBytes && void 0 !== t.localCache) throw new FirestoreError(F.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");
|
|
18634
|
+
if (void 0 !== t.cacheSizeBytes && -1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new FirestoreError(F.INVALID_ARGUMENT, "cacheSizeBytes must be at least 1048576");
|
|
18634
18635
|
return r.initialize({
|
|
18635
18636
|
options: t,
|
|
18636
18637
|
instanceIdentifier: n
|
|
@@ -18699,7 +18700,7 @@ function __PRIVATE_configureFirestore(e) {
|
|
|
18699
18700
|
*/ function enableIndexedDbPersistence(e, t) {
|
|
18700
18701
|
__PRIVATE_verifyNotInitialized(e = __PRIVATE_cast(e, Firestore));
|
|
18701
18702
|
const n = ensureFirestoreConfigured(e);
|
|
18702
|
-
if (n._uninitializedComponentsProvider) throw new FirestoreError(
|
|
18703
|
+
if (n._uninitializedComponentsProvider) throw new FirestoreError(F.FAILED_PRECONDITION, "SDK cache is already specified.");
|
|
18703
18704
|
__PRIVATE_logWarn("enableIndexedDbPersistence() will be deprecated in the future, you can use `FirestoreSettings.cache` instead.");
|
|
18704
18705
|
const r = e._freezeSettings(), i = new OnlineComponentProvider;
|
|
18705
18706
|
return __PRIVATE_setPersistenceProviders(n, i, new __PRIVATE_IndexedDbOfflineComponentProvider(i, r.cacheSizeBytes, null == t ? void 0 : t.forceOwnership));
|
|
@@ -18733,7 +18734,7 @@ function __PRIVATE_configureFirestore(e) {
|
|
|
18733
18734
|
*/ function enableMultiTabIndexedDbPersistence(e) {
|
|
18734
18735
|
__PRIVATE_verifyNotInitialized(e = __PRIVATE_cast(e, Firestore));
|
|
18735
18736
|
const t = ensureFirestoreConfigured(e);
|
|
18736
|
-
if (t._uninitializedComponentsProvider) throw new FirestoreError(
|
|
18737
|
+
if (t._uninitializedComponentsProvider) throw new FirestoreError(F.FAILED_PRECONDITION, "SDK cache is already specified.");
|
|
18737
18738
|
__PRIVATE_logWarn("enableMultiTabIndexedDbPersistence() will be deprecated in the future, you can use `FirestoreSettings.cache` instead.");
|
|
18738
18739
|
const n = e._freezeSettings(), r = new OnlineComponentProvider;
|
|
18739
18740
|
return __PRIVATE_setPersistenceProviders(t, r, new __PRIVATE_MultiTabOfflineComponentProvider(r, n.cacheSizeBytes));
|
|
@@ -18781,7 +18782,7 @@ function __PRIVATE_configureFirestore(e) {
|
|
|
18781
18782
|
* @returns A `Promise` that is resolved when the persistent storage is
|
|
18782
18783
|
* cleared. Otherwise, the promise is rejected with an error.
|
|
18783
18784
|
*/ function clearIndexedDbPersistence(e) {
|
|
18784
|
-
if (e._initialized && !e._terminated) throw new FirestoreError(
|
|
18785
|
+
if (e._initialized && !e._terminated) throw new FirestoreError(F.FAILED_PRECONDITION, "Persistence can only be cleared before a Firestore instance is initialized or after it is terminated.");
|
|
18785
18786
|
const t = new __PRIVATE_Deferred;
|
|
18786
18787
|
return e._queue.enqueueAndForgetEvenWhileRestricted((async () => {
|
|
18787
18788
|
try {
|
|
@@ -18895,7 +18896,7 @@ function __PRIVATE_configureFirestore(e) {
|
|
|
18895
18896
|
}
|
|
18896
18897
|
|
|
18897
18898
|
function __PRIVATE_verifyNotInitialized(e) {
|
|
18898
|
-
if (e._initialized || e._terminated) throw new FirestoreError(
|
|
18899
|
+
if (e._initialized || e._terminated) throw new FirestoreError(F.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.");
|
|
18899
18900
|
}
|
|
18900
18901
|
|
|
18901
18902
|
/**
|
|
@@ -19004,7 +19005,7 @@ class AggregateField {
|
|
|
19004
19005
|
try {
|
|
19005
19006
|
return new Bytes(ByteString.fromBase64String(e));
|
|
19006
19007
|
} catch (e) {
|
|
19007
|
-
throw new FirestoreError(
|
|
19008
|
+
throw new FirestoreError(F.INVALID_ARGUMENT, "Failed to construct data from Base64 string: " + e);
|
|
19008
19009
|
}
|
|
19009
19010
|
}
|
|
19010
19011
|
/**
|
|
@@ -19076,7 +19077,7 @@ class AggregateField {
|
|
|
19076
19077
|
* @param fieldNames - A list of field names.
|
|
19077
19078
|
*/
|
|
19078
19079
|
constructor(...e) {
|
|
19079
|
-
for (let t = 0; t < e.length; ++t) if (0 === e[t].length) throw new FirestoreError(
|
|
19080
|
+
for (let t = 0; t < e.length; ++t) if (0 === e[t].length) throw new FirestoreError(F.INVALID_ARGUMENT, "Invalid field name at argument $(i + 1). Field names must not be empty.");
|
|
19080
19081
|
this._internalPath = new FieldPath$1(e);
|
|
19081
19082
|
}
|
|
19082
19083
|
/**
|
|
@@ -19155,8 +19156,8 @@ class AggregateField {
|
|
|
19155
19156
|
* @param longitude - The longitude as number between -180 and 180.
|
|
19156
19157
|
*/
|
|
19157
19158
|
constructor(e, t) {
|
|
19158
|
-
if (!isFinite(e) || e < -90 || e > 90) throw new FirestoreError(
|
|
19159
|
-
if (!isFinite(t) || t < -180 || t > 180) throw new FirestoreError(
|
|
19159
|
+
if (!isFinite(e) || e < -90 || e > 90) throw new FirestoreError(F.INVALID_ARGUMENT, "Latitude must be a number between -90 and 90, but was: " + e);
|
|
19160
|
+
if (!isFinite(t) || t < -180 || t > 180) throw new FirestoreError(F.INVALID_ARGUMENT, "Longitude must be a number between -180 and 180, but was: " + t);
|
|
19160
19161
|
this._lat = e, this._long = t;
|
|
19161
19162
|
}
|
|
19162
19163
|
/**
|
|
@@ -19206,7 +19207,7 @@ class AggregateField {
|
|
|
19206
19207
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19207
19208
|
* See the License for the specific language governing permissions and
|
|
19208
19209
|
* limitations under the License.
|
|
19209
|
-
*/ const
|
|
19210
|
+
*/ const we = /^__.*__$/;
|
|
19210
19211
|
|
|
19211
19212
|
/** The result of parsing document data (e.g. for a setData call). */ class ParsedSetData {
|
|
19212
19213
|
constructor(e, t, n) {
|
|
@@ -19317,7 +19318,7 @@ function __PRIVATE_isWrite(e) {
|
|
|
19317
19318
|
}
|
|
19318
19319
|
Au(e) {
|
|
19319
19320
|
if (0 === e.length) throw this.mu("Document fields must not be empty");
|
|
19320
|
-
if (__PRIVATE_isWrite(this.Iu) &&
|
|
19321
|
+
if (__PRIVATE_isWrite(this.Iu) && we.test(e)) throw this.mu('Document fields cannot begin and end with "__"');
|
|
19321
19322
|
}
|
|
19322
19323
|
}
|
|
19323
19324
|
|
|
@@ -19354,7 +19355,7 @@ function __PRIVATE_newUserDataReader(e) {
|
|
|
19354
19355
|
const e = [];
|
|
19355
19356
|
for (const r of s.mergeFields) {
|
|
19356
19357
|
const i = __PRIVATE_fieldPathFromArgument$1(t, r, n);
|
|
19357
|
-
if (!o.contains(i)) throw new FirestoreError(
|
|
19358
|
+
if (!o.contains(i)) throw new FirestoreError(F.INVALID_ARGUMENT, `Field '${i}' is specified in your field mask but missing from your input data.`);
|
|
19358
19359
|
__PRIVATE_fieldMaskContains(e, i) || e.push(i);
|
|
19359
19360
|
}
|
|
19360
19361
|
a = new FieldMask(e), u = o.fieldTransforms.filter((e => a.covers(e.field)));
|
|
@@ -19474,7 +19475,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
|
|
|
19474
19475
|
|
|
19475
19476
|
/** Parse update data from a list of field/value arguments. */ function __PRIVATE_parseUpdateVarargs(e, t, n, r, i, s) {
|
|
19476
19477
|
const o = e.pu(1 /* UserDataSource.Update */ , t, n), _ = [ __PRIVATE_fieldPathFromArgument$1(t, r, n) ], a = [ i ];
|
|
19477
|
-
if (s.length % 2 != 0) throw new FirestoreError(
|
|
19478
|
+
if (s.length % 2 != 0) throw new FirestoreError(F.INVALID_ARGUMENT, `Function ${t}() needs to be called with an even number of arguments that alternate between field names and values.`);
|
|
19478
19479
|
for (let e = 0; e < s.length; e += 2) _.push(__PRIVATE_fieldPathFromArgument$1(t, s[e])),
|
|
19479
19480
|
a.push(s[e + 1]);
|
|
19480
19481
|
const u = [], c = ObjectValue.empty();
|
|
@@ -19675,7 +19676,7 @@ function __PRIVATE_validatePlainObject(e, t, n) {
|
|
|
19675
19676
|
|
|
19676
19677
|
/**
|
|
19677
19678
|
* Matches any characters in a field path string that are reserved.
|
|
19678
|
-
*/ const
|
|
19679
|
+
*/ const Se = new RegExp("[~\\*/\\[\\]]");
|
|
19679
19680
|
|
|
19680
19681
|
/**
|
|
19681
19682
|
* Wraps fromDotSeparatedString with an error message about the method that
|
|
@@ -19686,7 +19687,7 @@ function __PRIVATE_validatePlainObject(e, t, n) {
|
|
|
19686
19687
|
* @param targetDoc - The document against which the field path will be
|
|
19687
19688
|
* evaluated.
|
|
19688
19689
|
*/ function __PRIVATE_fieldPathFromDotSeparatedString(e, t, n) {
|
|
19689
|
-
if (t.search(
|
|
19690
|
+
if (t.search(Se) >= 0) throw __PRIVATE_createError(`Invalid field path (${t}). Paths must not contain '~', '*', '/', '[', or ']'`, e,
|
|
19690
19691
|
/* hasConverter= */ !1,
|
|
19691
19692
|
/* path= */ void 0, n);
|
|
19692
19693
|
try {
|
|
@@ -19704,7 +19705,7 @@ function __PRIVATE_createError(e, t, n, r, i) {
|
|
|
19704
19705
|
n && (_ += " (via `toFirestore()`)"), _ += ". ";
|
|
19705
19706
|
let a = "";
|
|
19706
19707
|
return (s || o) && (a += " (found", s && (a += ` in field ${r}`), o && (a += ` in document ${i}`),
|
|
19707
|
-
a += ")"), new FirestoreError(
|
|
19708
|
+
a += ")"), new FirestoreError(F.INVALID_ARGUMENT, _ + e + a);
|
|
19708
19709
|
}
|
|
19709
19710
|
|
|
19710
19711
|
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function __PRIVATE_fieldMaskContains(e, t) {
|
|
@@ -19841,7 +19842,7 @@ function __PRIVATE_createError(e, t, n, r, i) {
|
|
|
19841
19842
|
* See the License for the specific language governing permissions and
|
|
19842
19843
|
* limitations under the License.
|
|
19843
19844
|
*/ function __PRIVATE_validateHasExplicitOrderByForLimitToLast(e) {
|
|
19844
|
-
if ("L" /* LimitType.Last */ === e.limitType && 0 === e.explicitOrderBy.length) throw new FirestoreError(
|
|
19845
|
+
if ("L" /* LimitType.Last */ === e.limitType && 0 === e.explicitOrderBy.length) throw new FirestoreError(F.UNIMPLEMENTED, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
19845
19846
|
}
|
|
19846
19847
|
|
|
19847
19848
|
/**
|
|
@@ -19862,7 +19863,7 @@ function query(e, t, ...n) {
|
|
|
19862
19863
|
let r = [];
|
|
19863
19864
|
t instanceof AppliableConstraint && r.push(t), r = r.concat(n), function __PRIVATE_validateQueryConstraintArray(e) {
|
|
19864
19865
|
const t = e.filter((e => e instanceof QueryCompositeFilterConstraint)).length, n = e.filter((e => e instanceof QueryFieldFilterConstraint)).length;
|
|
19865
|
-
if (t > 1 || t > 0 && n > 0) throw new FirestoreError(
|
|
19866
|
+
if (t > 1 || t > 0 && n > 0) throw new FirestoreError(F.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(...)))`.");
|
|
19866
19867
|
}
|
|
19867
19868
|
/**
|
|
19868
19869
|
* @license
|
|
@@ -19916,7 +19917,7 @@ function query(e, t, ...n) {
|
|
|
19916
19917
|
const t = __PRIVATE_newUserDataReader(e.firestore), n = function __PRIVATE_newQueryFilter(e, t, n, r, i, s, o) {
|
|
19917
19918
|
let _;
|
|
19918
19919
|
if (i.isKeyField()) {
|
|
19919
|
-
if ("array-contains" /* Operator.ARRAY_CONTAINS */ === s || "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ === s) throw new FirestoreError(
|
|
19920
|
+
if ("array-contains" /* Operator.ARRAY_CONTAINS */ === s || "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ === s) throw new FirestoreError(F.INVALID_ARGUMENT, `Invalid Query. You can't perform '${s}' queries on documentId().`);
|
|
19920
19921
|
if ("in" /* Operator.IN */ === s || "not-in" /* Operator.NOT_IN */ === s) {
|
|
19921
19922
|
__PRIVATE_validateDisjunctiveFilterElements(o, s);
|
|
19922
19923
|
const t = [];
|
|
@@ -20043,8 +20044,8 @@ function query(e, t, ...n) {
|
|
|
20043
20044
|
}
|
|
20044
20045
|
_apply(e) {
|
|
20045
20046
|
const t = function __PRIVATE_newQueryOrderBy(e, t, n) {
|
|
20046
|
-
if (null !== e.startAt) throw new FirestoreError(
|
|
20047
|
-
if (null !== e.endAt) throw new FirestoreError(
|
|
20047
|
+
if (null !== e.startAt) throw new FirestoreError(F.INVALID_ARGUMENT, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
|
|
20048
|
+
if (null !== e.endAt) throw new FirestoreError(F.INVALID_ARGUMENT, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
|
|
20048
20049
|
return new OrderBy(t, n);
|
|
20049
20050
|
}
|
|
20050
20051
|
/**
|
|
@@ -20202,7 +20203,7 @@ function endAt(...e) {
|
|
|
20202
20203
|
|
|
20203
20204
|
/** Helper function to create a bound from a document or fields */ function __PRIVATE_newQueryBoundFromDocOrFields(e, t, n, r) {
|
|
20204
20205
|
if (n[0] = T(n[0]), n[0] instanceof DocumentSnapshot$1) return function __PRIVATE_newQueryBoundFromDocument(e, t, n, r, i) {
|
|
20205
|
-
if (!r) throw new FirestoreError(
|
|
20206
|
+
if (!r) throw new FirestoreError(F.NOT_FOUND, `Can't use a DocumentSnapshot that doesn't exist for ${n}().`);
|
|
20206
20207
|
const s = [];
|
|
20207
20208
|
// Because people expect to continue/end a query at the exact document
|
|
20208
20209
|
// provided, we need to use the implicit sort order rather than the explicit
|
|
@@ -20213,10 +20214,10 @@ function endAt(...e) {
|
|
|
20213
20214
|
// results.
|
|
20214
20215
|
for (const n of __PRIVATE_queryNormalizedOrderBy(e)) if (n.field.isKeyField()) s.push(__PRIVATE_refValue(t, r.key)); else {
|
|
20215
20216
|
const e = r.data.field(n.field);
|
|
20216
|
-
if (__PRIVATE_isServerTimestamp(e)) throw new FirestoreError(
|
|
20217
|
+
if (__PRIVATE_isServerTimestamp(e)) throw new FirestoreError(F.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.)');
|
|
20217
20218
|
if (null === e) {
|
|
20218
20219
|
const e = n.field.canonicalString();
|
|
20219
|
-
throw new FirestoreError(
|
|
20220
|
+
throw new FirestoreError(F.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.`);
|
|
20220
20221
|
}
|
|
20221
20222
|
s.push(e);
|
|
20222
20223
|
}
|
|
@@ -20230,15 +20231,15 @@ function endAt(...e) {
|
|
|
20230
20231
|
return function __PRIVATE_newQueryBoundFromFields(e, t, n, r, i, s) {
|
|
20231
20232
|
// Use explicit order by's because it has to match the query the user made
|
|
20232
20233
|
const o = e.explicitOrderBy;
|
|
20233
|
-
if (i.length > o.length) throw new FirestoreError(
|
|
20234
|
+
if (i.length > o.length) throw new FirestoreError(F.INVALID_ARGUMENT, `Too many arguments provided to ${r}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);
|
|
20234
20235
|
const _ = [];
|
|
20235
20236
|
for (let s = 0; s < i.length; s++) {
|
|
20236
20237
|
const a = i[s];
|
|
20237
20238
|
if (o[s].field.isKeyField()) {
|
|
20238
|
-
if ("string" != typeof a) throw new FirestoreError(
|
|
20239
|
-
if (!__PRIVATE_isCollectionGroupQuery(e) && -1 !== a.indexOf("/")) throw new FirestoreError(
|
|
20239
|
+
if ("string" != typeof a) throw new FirestoreError(F.INVALID_ARGUMENT, `Invalid query. Expected a string for document ID in ${r}(), but got a ${typeof a}`);
|
|
20240
|
+
if (!__PRIVATE_isCollectionGroupQuery(e) && -1 !== a.indexOf("/")) throw new FirestoreError(F.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.`);
|
|
20240
20241
|
const n = e.path.child(ResourcePath.fromString(a));
|
|
20241
|
-
if (!DocumentKey.isDocumentKey(n)) throw new FirestoreError(
|
|
20242
|
+
if (!DocumentKey.isDocumentKey(n)) throw new FirestoreError(F.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.`);
|
|
20242
20243
|
const i = new DocumentKey(n);
|
|
20243
20244
|
_.push(__PRIVATE_refValue(t, i));
|
|
20244
20245
|
} else {
|
|
@@ -20258,21 +20259,21 @@ function endAt(...e) {
|
|
|
20258
20259
|
|
|
20259
20260
|
function __PRIVATE_parseDocumentIdValue(e, t, n) {
|
|
20260
20261
|
if ("string" == typeof (n = T(n))) {
|
|
20261
|
-
if ("" === n) throw new FirestoreError(
|
|
20262
|
-
if (!__PRIVATE_isCollectionGroupQuery(t) && -1 !== n.indexOf("/")) throw new FirestoreError(
|
|
20262
|
+
if ("" === n) throw new FirestoreError(F.INVALID_ARGUMENT, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
|
|
20263
|
+
if (!__PRIVATE_isCollectionGroupQuery(t) && -1 !== n.indexOf("/")) throw new FirestoreError(F.INVALID_ARGUMENT, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);
|
|
20263
20264
|
const r = t.path.child(ResourcePath.fromString(n));
|
|
20264
|
-
if (!DocumentKey.isDocumentKey(r)) throw new FirestoreError(
|
|
20265
|
+
if (!DocumentKey.isDocumentKey(r)) throw new FirestoreError(F.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}).`);
|
|
20265
20266
|
return __PRIVATE_refValue(e, new DocumentKey(r));
|
|
20266
20267
|
}
|
|
20267
20268
|
if (n instanceof DocumentReference) return __PRIVATE_refValue(e, n._key);
|
|
20268
|
-
throw new FirestoreError(
|
|
20269
|
+
throw new FirestoreError(F.INVALID_ARGUMENT, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${__PRIVATE_valueDescription(n)}.`);
|
|
20269
20270
|
}
|
|
20270
20271
|
|
|
20271
20272
|
/**
|
|
20272
20273
|
* Validates that the value passed into a disjunctive filter satisfies all
|
|
20273
20274
|
* array requirements.
|
|
20274
20275
|
*/ function __PRIVATE_validateDisjunctiveFilterElements(e, t) {
|
|
20275
|
-
if (!Array.isArray(e) || 0 === e.length) throw new FirestoreError(
|
|
20276
|
+
if (!Array.isArray(e) || 0 === e.length) throw new FirestoreError(F.INVALID_ARGUMENT, `Invalid Query. A non-empty array is required for '${t.toString()}' filters.`);
|
|
20276
20277
|
}
|
|
20277
20278
|
|
|
20278
20279
|
/**
|
|
@@ -20306,11 +20307,11 @@ function __PRIVATE_parseDocumentIdValue(e, t, n) {
|
|
|
20306
20307
|
}(t.op));
|
|
20307
20308
|
if (null !== n)
|
|
20308
20309
|
// Special case when it's a duplicate op to give a slightly clearer error message.
|
|
20309
|
-
throw n === t.op ? new FirestoreError(
|
|
20310
|
+
throw n === t.op ? new FirestoreError(F.INVALID_ARGUMENT, `Invalid query. You cannot use more than one '${t.op.toString()}' filter.`) : new FirestoreError(F.INVALID_ARGUMENT, `Invalid query. You cannot use '${t.op.toString()}' filters with '${n.toString()}' filters.`);
|
|
20310
20311
|
}
|
|
20311
20312
|
|
|
20312
20313
|
function __PRIVATE_validateQueryFilterConstraint(e, t) {
|
|
20313
|
-
if (!(t instanceof QueryFieldFilterConstraint || t instanceof QueryCompositeFilterConstraint)) throw new FirestoreError(
|
|
20314
|
+
if (!(t instanceof QueryFieldFilterConstraint || t instanceof QueryCompositeFilterConstraint)) throw new FirestoreError(F.INVALID_ARGUMENT, `Function ${e}() requires AppliableConstraints created with a call to 'where(...)', 'or(...)', or 'and(...)'.`);
|
|
20314
20315
|
}
|
|
20315
20316
|
|
|
20316
20317
|
class AbstractUserDataWriter {
|
|
@@ -20682,7 +20683,7 @@ class __PRIVATE_LiteUserDataWriter extends AbstractUserDataWriter {
|
|
|
20682
20683
|
* snapshot events.
|
|
20683
20684
|
*/ docChanges(e = {}) {
|
|
20684
20685
|
const t = !!e.includeMetadataChanges;
|
|
20685
|
-
if (t && this._snapshot.excludesMetadataChanges) throw new FirestoreError(
|
|
20686
|
+
if (t && this._snapshot.excludesMetadataChanges) throw new FirestoreError(F.INVALID_ARGUMENT, "To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");
|
|
20686
20687
|
return this._cachedChanges && this._cachedChangesIncludeMetadataChanges === t || (this._cachedChanges =
|
|
20687
20688
|
/** Calculates the array of `DocumentChange`s for a given `ViewSnapshot`. */
|
|
20688
20689
|
function __PRIVATE_changesFromSnapshot(e, t) {
|
|
@@ -21238,7 +21239,7 @@ class __PRIVATE_MultiTabManagerImpl {
|
|
|
21238
21239
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21239
21240
|
* See the License for the specific language governing permissions and
|
|
21240
21241
|
* limitations under the License.
|
|
21241
|
-
*/ const
|
|
21242
|
+
*/ const be = {
|
|
21242
21243
|
maxAttempts: 5
|
|
21243
21244
|
};
|
|
21244
21245
|
|
|
@@ -21312,12 +21313,12 @@ class WriteBatch {
|
|
|
21312
21313
|
return this._verifyNotCommitted(), this._committed = !0, this._mutations.length > 0 ? this._commitHandler(this._mutations) : Promise.resolve();
|
|
21313
21314
|
}
|
|
21314
21315
|
_verifyNotCommitted() {
|
|
21315
|
-
if (this._committed) throw new FirestoreError(
|
|
21316
|
+
if (this._committed) throw new FirestoreError(F.FAILED_PRECONDITION, "A write batch can no longer be used after commit() has been called.");
|
|
21316
21317
|
}
|
|
21317
21318
|
}
|
|
21318
21319
|
|
|
21319
21320
|
function __PRIVATE_validateReference(e, t) {
|
|
21320
|
-
if ((e = T(e)).firestore !== t) throw new FirestoreError(
|
|
21321
|
+
if ((e = T(e)).firestore !== t) throw new FirestoreError(F.INVALID_ARGUMENT, "Provided document reference is from a different Firestore instance.");
|
|
21321
21322
|
return e;
|
|
21322
21323
|
}
|
|
21323
21324
|
|
|
@@ -21450,9 +21451,9 @@ class Transaction extends class Transaction$1 {
|
|
|
21450
21451
|
* rejected promise with the corresponding failure error is returned.
|
|
21451
21452
|
*/ function runTransaction(e, t, n) {
|
|
21452
21453
|
e = __PRIVATE_cast(e, Firestore);
|
|
21453
|
-
const r = Object.assign(Object.assign({},
|
|
21454
|
+
const r = Object.assign(Object.assign({}, be), n);
|
|
21454
21455
|
!function __PRIVATE_validateTransactionOptions(e) {
|
|
21455
|
-
if (e.maxAttempts < 1) throw new FirestoreError(
|
|
21456
|
+
if (e.maxAttempts < 1) throw new FirestoreError(F.INVALID_ARGUMENT, "Max attempts must be at least 1");
|
|
21456
21457
|
}(r);
|
|
21457
21458
|
return function __PRIVATE_firestoreClientTransaction(e, t, n) {
|
|
21458
21459
|
const r = new __PRIVATE_Deferred;
|
|
@@ -21606,7 +21607,7 @@ class Transaction extends class Transaction$1 {
|
|
|
21606
21607
|
try {
|
|
21607
21608
|
return JSON.parse(e);
|
|
21608
21609
|
} catch (e) {
|
|
21609
|
-
throw new FirestoreError(
|
|
21610
|
+
throw new FirestoreError(F.INVALID_ARGUMENT, "Failed to parse JSON: " + (null == e ? void 0 : e.message));
|
|
21610
21611
|
}
|
|
21611
21612
|
}(e) : e, n = [];
|
|
21612
21613
|
if (Array.isArray(t.indexes)) for (const e of t.indexes) {
|
|
@@ -21623,7 +21624,7 @@ class Transaction extends class Transaction$1 {
|
|
|
21623
21624
|
}
|
|
21624
21625
|
|
|
21625
21626
|
function __PRIVATE_tryGetString(e, t) {
|
|
21626
|
-
if ("string" != typeof e[t]) throw new FirestoreError(
|
|
21627
|
+
if ("string" != typeof e[t]) throw new FirestoreError(F.INVALID_ARGUMENT, "Missing string value for: " + t);
|
|
21627
21628
|
return e[t];
|
|
21628
21629
|
}
|
|
21629
21630
|
|
|
@@ -21666,12 +21667,12 @@ function __PRIVATE_tryGetString(e, t) {
|
|
|
21666
21667
|
*/ function getPersistentCacheIndexManager(e) {
|
|
21667
21668
|
var t;
|
|
21668
21669
|
e = __PRIVATE_cast(e, Firestore);
|
|
21669
|
-
const n =
|
|
21670
|
+
const n = De.get(e);
|
|
21670
21671
|
if (n) return n;
|
|
21671
21672
|
const r = ensureFirestoreConfigured(e);
|
|
21672
21673
|
if ("persistent" !== (null === (t = r._uninitializedComponentsProvider) || void 0 === t ? void 0 : t._offlineKind)) return null;
|
|
21673
21674
|
const i = new PersistentCacheIndexManager(r);
|
|
21674
|
-
return
|
|
21675
|
+
return De.set(e, i), i;
|
|
21675
21676
|
}
|
|
21676
21677
|
|
|
21677
21678
|
/**
|
|
@@ -21714,7 +21715,7 @@ function __PRIVATE_setPersistentCacheIndexAutoCreationEnabled(e, t) {
|
|
|
21714
21715
|
* Use a `WeakMap` so that the mapping will be automatically dropped when the
|
|
21715
21716
|
* `Firestore` instance is garbage collected. This emulates a private member
|
|
21716
21717
|
* as described in https://goo.gle/454yvug.
|
|
21717
|
-
*/ const
|
|
21718
|
+
*/ const De = new WeakMap;
|
|
21718
21719
|
|
|
21719
21720
|
/**
|
|
21720
21721
|
* @license
|
|
@@ -21767,10 +21768,10 @@ function __PRIVATE_setPersistentCacheIndexAutoCreationEnabled(e, t) {
|
|
|
21767
21768
|
this.Su = new Map;
|
|
21768
21769
|
}
|
|
21769
21770
|
static get instance() {
|
|
21770
|
-
return
|
|
21771
|
-
if (
|
|
21772
|
-
|
|
21773
|
-
}(
|
|
21771
|
+
return Ce || (Ce = new __PRIVATE_TestingHooksSpiImpl, function __PRIVATE_setTestingHooksSpi(e) {
|
|
21772
|
+
if (Pe) throw new Error("a TestingHooksSpi instance is already set");
|
|
21773
|
+
Pe = e;
|
|
21774
|
+
}(Ce)), Ce;
|
|
21774
21775
|
}
|
|
21775
21776
|
tt(e) {
|
|
21776
21777
|
this.Su.forEach((t => t(e)));
|
|
@@ -21781,7 +21782,7 @@ function __PRIVATE_setPersistentCacheIndexAutoCreationEnabled(e, t) {
|
|
|
21781
21782
|
}
|
|
21782
21783
|
}
|
|
21783
21784
|
|
|
21784
|
-
let
|
|
21785
|
+
let Ce = null;
|
|
21785
21786
|
|
|
21786
21787
|
/**
|
|
21787
21788
|
* @license
|
|
@@ -21800,19 +21801,19 @@ let De = null;
|
|
|
21800
21801
|
* limitations under the License.
|
|
21801
21802
|
*/ !function __PRIVATE_registerFirestore(e, t = !0) {
|
|
21802
21803
|
!function __PRIVATE_setSDKVersion(e) {
|
|
21803
|
-
|
|
21804
|
+
C = e;
|
|
21804
21805
|
}(i), n(new s("firestore", ((e, {instanceIdentifier: n, options: r}) => {
|
|
21805
21806
|
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) {
|
|
21806
|
-
if (!Object.prototype.hasOwnProperty.apply(e.options, [ "projectId" ])) throw new FirestoreError(
|
|
21807
|
+
if (!Object.prototype.hasOwnProperty.apply(e.options, [ "projectId" ])) throw new FirestoreError(F.INVALID_ARGUMENT, '"projectId" not provided in firebase.initializeApp.');
|
|
21807
21808
|
return new DatabaseId(e.options.projectId, t);
|
|
21808
21809
|
}(i, n), i);
|
|
21809
21810
|
return r = Object.assign({
|
|
21810
21811
|
useFetchStreams: t
|
|
21811
21812
|
}, r), s._setSettings(r), s;
|
|
21812
|
-
}), "PUBLIC").setMultipleInstances(!0)), r(
|
|
21813
|
+
}), "PUBLIC").setMultipleInstances(!0)), r(D, "4.3.2-20231027003707", e),
|
|
21813
21814
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
|
21814
|
-
r(
|
|
21815
|
+
r(D, "4.3.2-20231027003707", "esm2017");
|
|
21815
21816
|
}("rn", /* useFetchStreams= */ !1);
|
|
21816
21817
|
|
|
21817
|
-
export { AbstractUserDataWriter, AggregateField, AggregateQuerySnapshot, Bytes,
|
|
21818
|
+
export { AbstractUserDataWriter, AggregateField, AggregateQuerySnapshot, Bytes, ye 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 };
|
|
21818
21819
|
//# sourceMappingURL=index.rn.js.map
|