@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.cjs.js
CHANGED
|
@@ -8,7 +8,7 @@ var logger = require('@firebase/logger');
|
|
|
8
8
|
var util = require('@firebase/util');
|
|
9
9
|
var webchannelWrapper = require('@firebase/webchannel-wrapper');
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const S = "@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 b = "10.5.2-20231027003707";
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* @license
|
|
@@ -88,11 +88,11 @@ let S = "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 D = new logger.Logger("@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 D.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
|
+
D.setLogLevel(e);
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
function __PRIVATE_logDebug(e, ...t) {
|
|
115
|
-
if (
|
|
115
|
+
if (D.logLevel <= logger.LogLevel.DEBUG) {
|
|
116
116
|
const n = t.map(__PRIVATE_argToString);
|
|
117
|
-
|
|
117
|
+
D.debug(`Firestore (${b}): ${e}`, ...n);
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
function __PRIVATE_logError(e, ...t) {
|
|
122
|
-
if (
|
|
122
|
+
if (D.logLevel <= logger.LogLevel.ERROR) {
|
|
123
123
|
const n = t.map(__PRIVATE_argToString);
|
|
124
|
-
|
|
124
|
+
D.error(`Firestore (${b}): ${e}`, ...n);
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
/**
|
|
129
129
|
* @internal
|
|
130
130
|
*/ function __PRIVATE_logWarn(e, ...t) {
|
|
131
|
-
if (
|
|
131
|
+
if (D.logLevel <= logger.LogLevel.WARN) {
|
|
132
132
|
const n = t.map(__PRIVATE_argToString);
|
|
133
|
-
|
|
133
|
+
D.warn(`Firestore (${b}): ${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 (${b}) 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 C = {
|
|
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(C.INVALID_ARGUMENT, "Timestamp nanoseconds out of range: " + t);
|
|
793
|
+
if (t >= 1e9) throw new FirestoreError(C.INVALID_ARGUMENT, "Timestamp nanoseconds out of range: " + t);
|
|
794
|
+
if (e < -62135596800) throw new FirestoreError(C.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(C.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(C.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 v = /^[_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 C = /^[_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 v.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 C = /^[_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(C.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(C.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(C.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(C.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 F = "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 !== C.FAILED_PRECONDITION || e.message !== F) 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(C.FAILED_PRECONDITION, "A newer version of the Firestore SDK was previously used and so the persisted data is not compatible with the version of the SDK you are now using. The SDK will operate with persistence disabled. If you need persistence, please re-upgrade to a newer version of the SDK or else clear the persisted IndexedDB data for your app to start fresh.")) : "InvalidStateError" === r.name ? n(new FirestoreError(C.FAILED_PRECONDITION, "Unable to open an IndexedDB connection. This could be due to running in a private browsing session on a browser whose private browsing sessions do not support IndexedDB: " + r)) : n(new __PRIVATE_IndexedDbTransactionError(e, r));
|
|
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(C.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 M = !1;
|
|
1996
1996
|
|
|
1997
1997
|
function __PRIVATE_checkForAndReportiOSError(e) {
|
|
1998
1998
|
const t = __PRIVATE_SimpleDb.S(util.getUA());
|
|
@@ -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 M || (M = !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 x = [ "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 O = {}, N = [ "prefixPath", "collectionGroup", "readTime", "documentId" ], B = [ "prefixPath", "collectionGroup", "documentId" ], L = [ "collectionGroup", "readTime", "prefixPath", "documentId" ], k = [ "canonicalId", "targetId" ], q = [ "targetId", "path" ], Q = [ "path", "targetId" ], K = [ "collectionId", "parent" ], $ = [ "indexId", "uid" ], U = [ "uid", "sequenceNumber" ], W = [ "indexId", "uid", "arrayValue", "directionalValue", "orderedDocumentKey", "documentKey" ], G = [ "indexId", "uid", "orderedDocumentKey" ], z = [ "userId", "collectionPath", "documentId" ], j = [ "userId", "collectionPath", "largestBatchId" ], H = [ "userId", "collectionGroup", "largestBatchId" ], J = [ ...[ ...[ ...[ ...[ "mutationQueues", "mutations", "documentMutations", "remoteDocuments", "targets", "owner", "targetGlobal", "targetDocuments" ], "clientMetadata" ], "remoteDocumentGlobal" ], "collectionParents" ], "bundles", "namedQueries" ], Y = [ ...J, "documentOverlays" ], Z = [ "mutationQueues", "mutations", "documentMutations", "remoteDocumentsV14", "targets", "owner", "targetGlobal", "targetDocuments", "clientMetadata", "remoteDocumentGlobal", "collectionParents", "bundles", "namedQueries", "documentOverlays" ], X = Z, ee = [ ...X, "indexConfiguration", "indexState", "indexEntries" ];
|
|
2302
2302
|
|
|
2303
2303
|
/**
|
|
2304
2304
|
* @license
|
|
@@ -3055,7 +3055,7 @@ function __PRIVATE_isBase64Available() {
|
|
|
3055
3055
|
|
|
3056
3056
|
ByteString.EMPTY_BYTE_STRING = new ByteString("");
|
|
3057
3057
|
|
|
3058
|
-
const
|
|
3058
|
+
const te = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
3059
3059
|
|
|
3060
3060
|
/**
|
|
3061
3061
|
* Converts the possible Proto values for a timestamp value into a "seconds and
|
|
@@ -3069,7 +3069,7 @@ const ee = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
3069
3069
|
// (millis), so we do some custom parsing here.
|
|
3070
3070
|
// Parse the nanos right out of the string.
|
|
3071
3071
|
let t = 0;
|
|
3072
|
-
const n =
|
|
3072
|
+
const n = te.exec(e);
|
|
3073
3073
|
if (__PRIVATE_hardAssert(!!n), n[1]) {
|
|
3074
3074
|
// Pad the fraction out to 9 digits (nanos).
|
|
3075
3075
|
let e = n[1];
|
|
@@ -3236,7 +3236,7 @@ class DatabaseId {
|
|
|
3236
3236
|
* See the License for the specific language governing permissions and
|
|
3237
3237
|
* limitations under the License.
|
|
3238
3238
|
*/
|
|
3239
|
-
const
|
|
3239
|
+
const ne = {
|
|
3240
3240
|
mapValue: {
|
|
3241
3241
|
fields: {
|
|
3242
3242
|
__type__: {
|
|
@@ -3244,7 +3244,7 @@ const te = {
|
|
|
3244
3244
|
}
|
|
3245
3245
|
}
|
|
3246
3246
|
}
|
|
3247
|
-
},
|
|
3247
|
+
}, re = {
|
|
3248
3248
|
nullValue: "NULL_VALUE"
|
|
3249
3249
|
};
|
|
3250
3250
|
|
|
@@ -3388,9 +3388,9 @@ function __PRIVATE_valueCompare(e, t) {
|
|
|
3388
3388
|
|
|
3389
3389
|
case 10 /* TypeOrder.ObjectValue */ :
|
|
3390
3390
|
return function __PRIVATE_compareMaps(e, t) {
|
|
3391
|
-
if (e ===
|
|
3392
|
-
if (e ===
|
|
3393
|
-
if (t ===
|
|
3391
|
+
if (e === ne.mapValue && t === ne.mapValue) return 0;
|
|
3392
|
+
if (e === ne.mapValue) return 1;
|
|
3393
|
+
if (t === ne.mapValue) return -1;
|
|
3394
3394
|
const n = e.fields || {}, r = Object.keys(n), i = t.fields || {}, s = Object.keys(i);
|
|
3395
3395
|
// Even though MapValues are likely sorted correctly based on their insertion
|
|
3396
3396
|
// order (e.g. when received from the backend), local modifications can bring
|
|
@@ -3566,7 +3566,7 @@ function isArray(e) {
|
|
|
3566
3566
|
}
|
|
3567
3567
|
|
|
3568
3568
|
/** Returns the lowest value for the given value type (inclusive). */ function __PRIVATE_valuesGetLowerBound(e) {
|
|
3569
|
-
return "nullValue" in e ?
|
|
3569
|
+
return "nullValue" in e ? re : "booleanValue" in e ? {
|
|
3570
3570
|
booleanValue: !1
|
|
3571
3571
|
} : "integerValue" in e || "doubleValue" in e ? {
|
|
3572
3572
|
doubleValue: NaN
|
|
@@ -3612,7 +3612,7 @@ function isArray(e) {
|
|
|
3612
3612
|
arrayValue: {}
|
|
3613
3613
|
} : "arrayValue" in e ? {
|
|
3614
3614
|
mapValue: {}
|
|
3615
|
-
} : "mapValue" in e ?
|
|
3615
|
+
} : "mapValue" in e ? ne : fail();
|
|
3616
3616
|
}
|
|
3617
3617
|
|
|
3618
3618
|
function __PRIVATE_lowerBoundCompare(e, t) {
|
|
@@ -4300,10 +4300,10 @@ function __PRIVATE_targetIsDocumentTarget(e) {
|
|
|
4300
4300
|
* the provided `fieldPath` (or the upper bound for an descending segment).
|
|
4301
4301
|
*/
|
|
4302
4302
|
function __PRIVATE_targetGetAscendingBound(e, t, n) {
|
|
4303
|
-
let r =
|
|
4303
|
+
let r = re, i = !0;
|
|
4304
4304
|
// Process all filters to find a value for the current field segment
|
|
4305
4305
|
for (const n of __PRIVATE_targetGetFieldFiltersForPath(e, t)) {
|
|
4306
|
-
let e =
|
|
4306
|
+
let e = re, t = !0;
|
|
4307
4307
|
switch (n.op) {
|
|
4308
4308
|
case "<" /* Operator.LESS_THAN */ :
|
|
4309
4309
|
case "<=" /* Operator.LESS_THAN_OR_EQUAL */ :
|
|
@@ -4322,7 +4322,7 @@ function __PRIVATE_targetGetAscendingBound(e, t, n) {
|
|
|
4322
4322
|
|
|
4323
4323
|
case "!=" /* Operator.NOT_EQUAL */ :
|
|
4324
4324
|
case "not-in" /* Operator.NOT_IN */ :
|
|
4325
|
-
e =
|
|
4325
|
+
e = re;
|
|
4326
4326
|
// Remaining filters cannot be used as lower bounds.
|
|
4327
4327
|
}
|
|
4328
4328
|
__PRIVATE_lowerBoundCompare({
|
|
@@ -4358,10 +4358,10 @@ function __PRIVATE_targetGetAscendingBound(e, t, n) {
|
|
|
4358
4358
|
* Returns the value to use as the upper bound for ascending index segment at
|
|
4359
4359
|
* the provided `fieldPath` (or the lower bound for a descending segment).
|
|
4360
4360
|
*/ function __PRIVATE_targetGetDescendingBound(e, t, n) {
|
|
4361
|
-
let r =
|
|
4361
|
+
let r = ne, i = !0;
|
|
4362
4362
|
// Process all filters to find a value for the current field segment
|
|
4363
4363
|
for (const n of __PRIVATE_targetGetFieldFiltersForPath(e, t)) {
|
|
4364
|
-
let e =
|
|
4364
|
+
let e = ne, t = !0;
|
|
4365
4365
|
switch (n.op) {
|
|
4366
4366
|
case ">=" /* Operator.GREATER_THAN_OR_EQUAL */ :
|
|
4367
4367
|
case ">" /* Operator.GREATER_THAN */ :
|
|
@@ -4380,7 +4380,7 @@ function __PRIVATE_targetGetAscendingBound(e, t, n) {
|
|
|
4380
4380
|
|
|
4381
4381
|
case "!=" /* Operator.NOT_EQUAL */ :
|
|
4382
4382
|
case "not-in" /* Operator.NOT_IN */ :
|
|
4383
|
-
e =
|
|
4383
|
+
e = ne;
|
|
4384
4384
|
// Remaining filters cannot be used as upper bounds.
|
|
4385
4385
|
}
|
|
4386
4386
|
__PRIVATE_upperBoundCompare({
|
|
@@ -4757,22 +4757,22 @@ function __PRIVATE_compareDocs(e, t, n) {
|
|
|
4757
4757
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4758
4758
|
* See the License for the specific language governing permissions and
|
|
4759
4759
|
* limitations under the License.
|
|
4760
|
-
*/ const
|
|
4760
|
+
*/ const ie = new SortedMap(DocumentKey.comparator);
|
|
4761
4761
|
|
|
4762
4762
|
function __PRIVATE_mutableDocumentMap() {
|
|
4763
|
-
return
|
|
4763
|
+
return ie;
|
|
4764
4764
|
}
|
|
4765
4765
|
|
|
4766
|
-
const
|
|
4766
|
+
const se = new SortedMap(DocumentKey.comparator);
|
|
4767
4767
|
|
|
4768
4768
|
function documentMap(...e) {
|
|
4769
|
-
let t =
|
|
4769
|
+
let t = se;
|
|
4770
4770
|
for (const n of e) t = t.insert(n.key, n);
|
|
4771
4771
|
return t;
|
|
4772
4772
|
}
|
|
4773
4773
|
|
|
4774
4774
|
function __PRIVATE_convertOverlayedDocumentMapToDocumentMap(e) {
|
|
4775
|
-
let t =
|
|
4775
|
+
let t = se;
|
|
4776
4776
|
return e.forEach(((e, n) => t = t.insert(e, n.overlayedDocument))), t;
|
|
4777
4777
|
}
|
|
4778
4778
|
|
|
@@ -4788,20 +4788,20 @@ function __PRIVATE_newDocumentKeyMap() {
|
|
|
4788
4788
|
return new ObjectMap((e => e.toString()), ((e, t) => e.isEqual(t)));
|
|
4789
4789
|
}
|
|
4790
4790
|
|
|
4791
|
-
const
|
|
4791
|
+
const oe = new SortedMap(DocumentKey.comparator);
|
|
4792
4792
|
|
|
4793
|
-
const
|
|
4793
|
+
const _e = new SortedSet(DocumentKey.comparator);
|
|
4794
4794
|
|
|
4795
4795
|
function __PRIVATE_documentKeySet(...e) {
|
|
4796
|
-
let t =
|
|
4796
|
+
let t = _e;
|
|
4797
4797
|
for (const n of e) t = t.add(n);
|
|
4798
4798
|
return t;
|
|
4799
4799
|
}
|
|
4800
4800
|
|
|
4801
|
-
const
|
|
4801
|
+
const ae = new SortedSet(__PRIVATE_primitiveComparator);
|
|
4802
4802
|
|
|
4803
4803
|
function __PRIVATE_targetIdSet() {
|
|
4804
|
-
return
|
|
4804
|
+
return ae;
|
|
4805
4805
|
}
|
|
4806
4806
|
|
|
4807
4807
|
/**
|
|
@@ -5492,7 +5492,7 @@ class __PRIVATE_VerifyMutation extends Mutation {
|
|
|
5492
5492
|
*/ static from(e, t, n) {
|
|
5493
5493
|
__PRIVATE_hardAssert(e.mutations.length === n.length);
|
|
5494
5494
|
let r = function __PRIVATE_documentVersionMap() {
|
|
5495
|
-
return
|
|
5495
|
+
return oe;
|
|
5496
5496
|
}();
|
|
5497
5497
|
const i = e.mutations;
|
|
5498
5498
|
for (let e = 0; e < i.length; e++) r = r.insert(i[e].key, n[e].version);
|
|
@@ -5606,7 +5606,7 @@ class __PRIVATE_VerifyMutation extends Mutation {
|
|
|
5606
5606
|
* Important! The names of these identifiers matter because the string forms
|
|
5607
5607
|
* are used for reverse lookups from the webchannel stream. Do NOT change the
|
|
5608
5608
|
* names of these identifiers or change this into a const enum.
|
|
5609
|
-
*/ var
|
|
5609
|
+
*/ var ue, ce;
|
|
5610
5610
|
|
|
5611
5611
|
/**
|
|
5612
5612
|
* Determines whether an error code represents a permanent error when received
|
|
@@ -5619,29 +5619,29 @@ function __PRIVATE_isPermanentError(e) {
|
|
|
5619
5619
|
default:
|
|
5620
5620
|
return fail();
|
|
5621
5621
|
|
|
5622
|
-
case
|
|
5623
|
-
case
|
|
5624
|
-
case
|
|
5625
|
-
case
|
|
5626
|
-
case
|
|
5627
|
-
case
|
|
5622
|
+
case C.CANCELLED:
|
|
5623
|
+
case C.UNKNOWN:
|
|
5624
|
+
case C.DEADLINE_EXCEEDED:
|
|
5625
|
+
case C.RESOURCE_EXHAUSTED:
|
|
5626
|
+
case C.INTERNAL:
|
|
5627
|
+
case C.UNAVAILABLE:
|
|
5628
5628
|
// Unauthenticated means something went wrong with our token and we need
|
|
5629
5629
|
// to retry with new credentials which will happen automatically.
|
|
5630
|
-
case
|
|
5630
|
+
case C.UNAUTHENTICATED:
|
|
5631
5631
|
return !1;
|
|
5632
5632
|
|
|
5633
|
-
case
|
|
5634
|
-
case
|
|
5635
|
-
case
|
|
5636
|
-
case
|
|
5637
|
-
case
|
|
5633
|
+
case C.INVALID_ARGUMENT:
|
|
5634
|
+
case C.NOT_FOUND:
|
|
5635
|
+
case C.ALREADY_EXISTS:
|
|
5636
|
+
case C.PERMISSION_DENIED:
|
|
5637
|
+
case C.FAILED_PRECONDITION:
|
|
5638
5638
|
// Aborted might be retried in some scenarios, but that is dependant on
|
|
5639
5639
|
// the context and should handled individually by the calling code.
|
|
5640
5640
|
// See https://cloud.google.com/apis/design/errors.
|
|
5641
|
-
case
|
|
5642
|
-
case
|
|
5643
|
-
case
|
|
5644
|
-
case
|
|
5641
|
+
case C.ABORTED:
|
|
5642
|
+
case C.OUT_OF_RANGE:
|
|
5643
|
+
case C.UNIMPLEMENTED:
|
|
5644
|
+
case C.DATA_LOSS:
|
|
5645
5645
|
return !0;
|
|
5646
5646
|
}
|
|
5647
5647
|
}
|
|
@@ -5669,58 +5669,58 @@ function __PRIVATE_mapCodeFromRpcCode(e) {
|
|
|
5669
5669
|
if (void 0 === e)
|
|
5670
5670
|
// This shouldn't normally happen, but in certain error cases (like trying
|
|
5671
5671
|
// to send invalid proto messages) we may get an error with no GRPC code.
|
|
5672
|
-
return __PRIVATE_logError("GRPC error has no .code"),
|
|
5672
|
+
return __PRIVATE_logError("GRPC error has no .code"), C.UNKNOWN;
|
|
5673
5673
|
switch (e) {
|
|
5674
|
-
case
|
|
5675
|
-
return
|
|
5674
|
+
case ue.OK:
|
|
5675
|
+
return C.OK;
|
|
5676
5676
|
|
|
5677
|
-
case
|
|
5678
|
-
return
|
|
5677
|
+
case ue.CANCELLED:
|
|
5678
|
+
return C.CANCELLED;
|
|
5679
5679
|
|
|
5680
|
-
case
|
|
5681
|
-
return
|
|
5680
|
+
case ue.UNKNOWN:
|
|
5681
|
+
return C.UNKNOWN;
|
|
5682
5682
|
|
|
5683
|
-
case
|
|
5684
|
-
return
|
|
5683
|
+
case ue.DEADLINE_EXCEEDED:
|
|
5684
|
+
return C.DEADLINE_EXCEEDED;
|
|
5685
5685
|
|
|
5686
|
-
case
|
|
5687
|
-
return
|
|
5686
|
+
case ue.RESOURCE_EXHAUSTED:
|
|
5687
|
+
return C.RESOURCE_EXHAUSTED;
|
|
5688
5688
|
|
|
5689
|
-
case
|
|
5690
|
-
return
|
|
5689
|
+
case ue.INTERNAL:
|
|
5690
|
+
return C.INTERNAL;
|
|
5691
5691
|
|
|
5692
|
-
case
|
|
5693
|
-
return
|
|
5692
|
+
case ue.UNAVAILABLE:
|
|
5693
|
+
return C.UNAVAILABLE;
|
|
5694
5694
|
|
|
5695
|
-
case
|
|
5696
|
-
return
|
|
5695
|
+
case ue.UNAUTHENTICATED:
|
|
5696
|
+
return C.UNAUTHENTICATED;
|
|
5697
5697
|
|
|
5698
|
-
case
|
|
5699
|
-
return
|
|
5698
|
+
case ue.INVALID_ARGUMENT:
|
|
5699
|
+
return C.INVALID_ARGUMENT;
|
|
5700
5700
|
|
|
5701
|
-
case
|
|
5702
|
-
return
|
|
5701
|
+
case ue.NOT_FOUND:
|
|
5702
|
+
return C.NOT_FOUND;
|
|
5703
5703
|
|
|
5704
|
-
case
|
|
5705
|
-
return
|
|
5704
|
+
case ue.ALREADY_EXISTS:
|
|
5705
|
+
return C.ALREADY_EXISTS;
|
|
5706
5706
|
|
|
5707
|
-
case
|
|
5708
|
-
return
|
|
5707
|
+
case ue.PERMISSION_DENIED:
|
|
5708
|
+
return C.PERMISSION_DENIED;
|
|
5709
5709
|
|
|
5710
|
-
case
|
|
5711
|
-
return
|
|
5710
|
+
case ue.FAILED_PRECONDITION:
|
|
5711
|
+
return C.FAILED_PRECONDITION;
|
|
5712
5712
|
|
|
5713
|
-
case
|
|
5714
|
-
return
|
|
5713
|
+
case ue.ABORTED:
|
|
5714
|
+
return C.ABORTED;
|
|
5715
5715
|
|
|
5716
|
-
case
|
|
5717
|
-
return
|
|
5716
|
+
case ue.OUT_OF_RANGE:
|
|
5717
|
+
return C.OUT_OF_RANGE;
|
|
5718
5718
|
|
|
5719
|
-
case
|
|
5720
|
-
return
|
|
5719
|
+
case ue.UNIMPLEMENTED:
|
|
5720
|
+
return C.UNIMPLEMENTED;
|
|
5721
5721
|
|
|
5722
|
-
case
|
|
5723
|
-
return
|
|
5722
|
+
case ue.DATA_LOSS:
|
|
5723
|
+
return C.DATA_LOSS;
|
|
5724
5724
|
|
|
5725
5725
|
default:
|
|
5726
5726
|
return fail();
|
|
@@ -5734,14 +5734,14 @@ function __PRIVATE_mapCodeFromRpcCode(e) {
|
|
|
5734
5734
|
* "UNKNOWN", etc.)
|
|
5735
5735
|
* @returns The equivalent Code. Non-matching responses are mapped to
|
|
5736
5736
|
* Code.UNKNOWN.
|
|
5737
|
-
*/ (
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
5737
|
+
*/ (ce = ue || (ue = {}))[ce.OK = 0] = "OK", ce[ce.CANCELLED = 1] = "CANCELLED",
|
|
5738
|
+
ce[ce.UNKNOWN = 2] = "UNKNOWN", ce[ce.INVALID_ARGUMENT = 3] = "INVALID_ARGUMENT",
|
|
5739
|
+
ce[ce.DEADLINE_EXCEEDED = 4] = "DEADLINE_EXCEEDED", ce[ce.NOT_FOUND = 5] = "NOT_FOUND",
|
|
5740
|
+
ce[ce.ALREADY_EXISTS = 6] = "ALREADY_EXISTS", ce[ce.PERMISSION_DENIED = 7] = "PERMISSION_DENIED",
|
|
5741
|
+
ce[ce.UNAUTHENTICATED = 16] = "UNAUTHENTICATED", ce[ce.RESOURCE_EXHAUSTED = 8] = "RESOURCE_EXHAUSTED",
|
|
5742
|
+
ce[ce.FAILED_PRECONDITION = 9] = "FAILED_PRECONDITION", ce[ce.ABORTED = 10] = "ABORTED",
|
|
5743
|
+
ce[ce.OUT_OF_RANGE = 11] = "OUT_OF_RANGE", ce[ce.UNIMPLEMENTED = 12] = "UNIMPLEMENTED",
|
|
5744
|
+
ce[ce.INTERNAL = 13] = "INTERNAL", ce[ce.UNAVAILABLE = 14] = "UNAVAILABLE", ce[ce.DATA_LOSS = 15] = "DATA_LOSS";
|
|
5745
5745
|
|
|
5746
5746
|
/**
|
|
5747
5747
|
* @license
|
|
@@ -5766,7 +5766,7 @@ ue[ue.INTERNAL = 13] = "INTERNAL", ue[ue.UNAVAILABLE = 14] = "UNAVAILABLE", ue[u
|
|
|
5766
5766
|
* integration tests that have registered callbacks to be notified of events
|
|
5767
5767
|
* that happen during the test execution.
|
|
5768
5768
|
*/
|
|
5769
|
-
let
|
|
5769
|
+
let le = null;
|
|
5770
5770
|
|
|
5771
5771
|
/**
|
|
5772
5772
|
* Sets the value of the `testingHooksSpi` object.
|
|
@@ -5814,7 +5814,7 @@ function __PRIVATE_newTextEncoder() {
|
|
|
5814
5814
|
* See the License for the specific language governing permissions and
|
|
5815
5815
|
* limitations under the License.
|
|
5816
5816
|
*/
|
|
5817
|
-
const
|
|
5817
|
+
const he = new webchannelWrapper.Integer([ 4294967295, 4294967295 ], 0);
|
|
5818
5818
|
|
|
5819
5819
|
// Hash a string using md5 hashing algorithm.
|
|
5820
5820
|
function __PRIVATE_getMd5HashValue(e) {
|
|
@@ -5849,7 +5849,7 @@ class BloomFilter {
|
|
|
5849
5849
|
// Calculate hashed value h(i) = h1 + (i * h2).
|
|
5850
5850
|
let r = e.add(t.multiply(webchannelWrapper.Integer.fromNumber(n)));
|
|
5851
5851
|
// Wrap if hash value overflow 64bit.
|
|
5852
|
-
return 1 === r.compare(
|
|
5852
|
+
return 1 === r.compare(he) && (r = new webchannelWrapper.Integer([ r.getBits(0), r.getBits(1) ], 0)),
|
|
5853
5853
|
r.modulo(this.Ee).toNumber();
|
|
5854
5854
|
}
|
|
5855
5855
|
// Return whether the bit on the given index in the bitmap is set to 1.
|
|
@@ -6267,7 +6267,7 @@ class __PRIVATE_WatchChangeAggregator {
|
|
|
6267
6267
|
const e = 2 /* BloomFilterApplicationStatus.FalsePositive */ === i ? "TargetPurposeExistenceFilterMismatchBloom" /* TargetPurpose.ExistenceFilterMismatchBloom */ : "TargetPurposeExistenceFilterMismatch" /* TargetPurpose.ExistenceFilterMismatch */;
|
|
6268
6268
|
this.Ke = this.Ke.insert(t, e);
|
|
6269
6269
|
}
|
|
6270
|
-
null ==
|
|
6270
|
+
null == le || le.tt(function __PRIVATE_createExistenceFilterMismatchInfoForTestingHooks(e, t, n, r, i) {
|
|
6271
6271
|
var s, o, _, a, u, c;
|
|
6272
6272
|
const l = {
|
|
6273
6273
|
localCacheCount: e,
|
|
@@ -6483,13 +6483,13 @@ function __PRIVATE_snapshotChangesMap() {
|
|
|
6483
6483
|
return new SortedMap(DocumentKey.comparator);
|
|
6484
6484
|
}
|
|
6485
6485
|
|
|
6486
|
-
const
|
|
6486
|
+
const Pe = (() => {
|
|
6487
6487
|
const e = {
|
|
6488
6488
|
asc: "ASCENDING",
|
|
6489
6489
|
desc: "DESCENDING"
|
|
6490
6490
|
};
|
|
6491
6491
|
return e;
|
|
6492
|
-
})(),
|
|
6492
|
+
})(), Ie = (() => {
|
|
6493
6493
|
const e = {
|
|
6494
6494
|
"<": "LESS_THAN",
|
|
6495
6495
|
"<=": "LESS_THAN_OR_EQUAL",
|
|
@@ -6503,7 +6503,7 @@ const he = (() => {
|
|
|
6503
6503
|
"array-contains-any": "ARRAY_CONTAINS_ANY"
|
|
6504
6504
|
};
|
|
6505
6505
|
return e;
|
|
6506
|
-
})(),
|
|
6506
|
+
})(), Te = (() => {
|
|
6507
6507
|
const e = {
|
|
6508
6508
|
and: "AND",
|
|
6509
6509
|
or: "OR"
|
|
@@ -6600,8 +6600,8 @@ function __PRIVATE_toName(e, t) {
|
|
|
6600
6600
|
|
|
6601
6601
|
function fromName(e, t) {
|
|
6602
6602
|
const n = __PRIVATE_fromResourceName(t);
|
|
6603
|
-
if (n.get(1) !== e.databaseId.projectId) throw new FirestoreError(
|
|
6604
|
-
if (n.get(3) !== e.databaseId.database) throw new FirestoreError(
|
|
6603
|
+
if (n.get(1) !== e.databaseId.projectId) throw new FirestoreError(C.INVALID_ARGUMENT, "Tried to deserialize key from different project: " + n.get(1) + " vs " + e.databaseId.projectId);
|
|
6604
|
+
if (n.get(3) !== e.databaseId.database) throw new FirestoreError(C.INVALID_ARGUMENT, "Tried to deserialize key from different database: " + n.get(3) + " vs " + e.databaseId.database);
|
|
6605
6605
|
return new DocumentKey(__PRIVATE_extractLocalPathFromResourceName(n));
|
|
6606
6606
|
}
|
|
6607
6607
|
|
|
@@ -6671,7 +6671,7 @@ function __PRIVATE_fromWatchChange(e, t) {
|
|
|
6671
6671
|
ByteString.fromBase64String(t || "")) : (__PRIVATE_hardAssert(void 0 === t || t instanceof Uint8Array),
|
|
6672
6672
|
ByteString.fromUint8Array(t || new Uint8Array));
|
|
6673
6673
|
}(e, t.targetChange.resumeToken), o = t.targetChange.cause, _ = o && function __PRIVATE_fromRpcStatus(e) {
|
|
6674
|
-
const t = void 0 === e.code ?
|
|
6674
|
+
const t = void 0 === e.code ? C.UNKNOWN : __PRIVATE_mapCodeFromRpcCode(e.code);
|
|
6675
6675
|
return new FirestoreError(t, e.message || "");
|
|
6676
6676
|
}(o);
|
|
6677
6677
|
n = new __PRIVATE_WatchTargetChange(r, i, s, _ || null);
|
|
@@ -7027,15 +7027,15 @@ function __PRIVATE_fromFilter(e) {
|
|
|
7027
7027
|
}
|
|
7028
7028
|
|
|
7029
7029
|
function __PRIVATE_toDirection(e) {
|
|
7030
|
-
return
|
|
7030
|
+
return Pe[e];
|
|
7031
7031
|
}
|
|
7032
7032
|
|
|
7033
7033
|
function __PRIVATE_toOperatorName(e) {
|
|
7034
|
-
return
|
|
7034
|
+
return Ie[e];
|
|
7035
7035
|
}
|
|
7036
7036
|
|
|
7037
7037
|
function __PRIVATE_toCompositeOperatorName(e) {
|
|
7038
|
-
return
|
|
7038
|
+
return Te[e];
|
|
7039
7039
|
}
|
|
7040
7040
|
|
|
7041
7041
|
function __PRIVATE_toFieldPathReference(e) {
|
|
@@ -8356,7 +8356,7 @@ function __PRIVATE_applyDistributionFieldAndCompositeFilters(e, t) {
|
|
|
8356
8356
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
8357
8357
|
* See the License for the specific language governing permissions and
|
|
8358
8358
|
* limitations under the License.
|
|
8359
|
-
*/ const
|
|
8359
|
+
*/ const Ee = new Uint8Array(0);
|
|
8360
8360
|
|
|
8361
8361
|
/**
|
|
8362
8362
|
* A persisted implementation of IndexManager.
|
|
@@ -8570,7 +8570,7 @@ class __PRIVATE_IndexedDbIndexManager {
|
|
|
8570
8570
|
// combined with the values from the query bounds.
|
|
8571
8571
|
const _ = (null != t ? t.length : 1) * Math.max(n.length, i.length), a = _ / (null != t ? t.length : 1), u = [];
|
|
8572
8572
|
for (let c = 0; c < _; ++c) {
|
|
8573
|
-
const _ = t ? this.In(t[c / a]) :
|
|
8573
|
+
const _ = t ? this.In(t[c / a]) : Ee, l = this.Tn(e, _, n[c % a], r), h = this.En(e, _, i[c % a], s), P = o.map((t => this.Tn(e, _, t,
|
|
8574
8574
|
/* inclusive= */ !0)));
|
|
8575
8575
|
u.push(...this.createRange(l, h, P));
|
|
8576
8576
|
}
|
|
@@ -8767,7 +8767,7 @@ class __PRIVATE_IndexedDbIndexManager {
|
|
|
8767
8767
|
if (null != i) {
|
|
8768
8768
|
const s = e.data.field(i.fieldPath);
|
|
8769
8769
|
if (isArray(s)) for (const i of s.arrayValue.values || []) n = n.add(new __PRIVATE_IndexEntry(t.indexId, e.key, this.In(i), r));
|
|
8770
|
-
} else n = n.add(new __PRIVATE_IndexEntry(t.indexId, e.key,
|
|
8770
|
+
} else n = n.add(new __PRIVATE_IndexEntry(t.indexId, e.key, Ee, r));
|
|
8771
8771
|
return n;
|
|
8772
8772
|
}
|
|
8773
8773
|
/**
|
|
@@ -8842,7 +8842,7 @@ class __PRIVATE_IndexedDbIndexManager {
|
|
|
8842
8842
|
// If we encounter two bounds that will create an unmatchable key range,
|
|
8843
8843
|
// then we return an empty set of key ranges.
|
|
8844
8844
|
if (this.bn(r[e], r[e + 1])) return [];
|
|
8845
|
-
const t = [ r[e].indexId, this.uid, r[e].arrayValue, r[e].directionalValue,
|
|
8845
|
+
const t = [ r[e].indexId, this.uid, r[e].arrayValue, r[e].directionalValue, Ee, [] ], n = [ r[e + 1].indexId, this.uid, r[e + 1].arrayValue, r[e + 1].directionalValue, Ee, [] ];
|
|
8846
8846
|
i.push(IDBKeyRange.bound(t, n));
|
|
8847
8847
|
}
|
|
8848
8848
|
return i;
|
|
@@ -8910,7 +8910,7 @@ function __PRIVATE_getMinOffsetFromFieldIndexes(e) {
|
|
|
8910
8910
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
8911
8911
|
* See the License for the specific language governing permissions and
|
|
8912
8912
|
* limitations under the License.
|
|
8913
|
-
*/ const
|
|
8913
|
+
*/ const de = {
|
|
8914
8914
|
didRun: !1,
|
|
8915
8915
|
sequenceNumbersCollected: 0,
|
|
8916
8916
|
targetsRemoved: 0,
|
|
@@ -9074,7 +9074,7 @@ class __PRIVATE_IndexedDbMutationQueue {
|
|
|
9074
9074
|
let c = new SortedSet(((e, t) => __PRIVATE_primitiveComparator(e.canonicalString(), t.canonicalString())));
|
|
9075
9075
|
for (const e of r) {
|
|
9076
9076
|
const t = __PRIVATE_newDbDocumentMutationKey(this.userId, e.key.path, o);
|
|
9077
|
-
c = c.add(e.key.path.popLast()), u.push(s.put(a)), u.push(i.put(t,
|
|
9077
|
+
c = c.add(e.key.path.popLast()), u.push(s.put(a)), u.push(i.put(t, O));
|
|
9078
9078
|
}
|
|
9079
9079
|
return c.forEach((t => {
|
|
9080
9080
|
u.push(this.indexManager.addToCollectionParentIndex(e, t));
|
|
@@ -9643,8 +9643,8 @@ class __PRIVATE_TargetIdGenerator {
|
|
|
9643
9643
|
}
|
|
9644
9644
|
collect(e, t) {
|
|
9645
9645
|
return -1 === this.params.cacheSizeCollectionThreshold ? (__PRIVATE_logDebug("LruGarbageCollector", "Garbage collection skipped; disabled"),
|
|
9646
|
-
PersistencePromise.resolve(
|
|
9647
|
-
|
|
9646
|
+
PersistencePromise.resolve(de)) : this.getCacheSize(e).next((n => n < this.params.cacheSizeCollectionThreshold ? (__PRIVATE_logDebug("LruGarbageCollector", `Garbage collection skipped; Cache size ${n} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),
|
|
9647
|
+
de) : this.Jn(e, t)));
|
|
9648
9648
|
}
|
|
9649
9649
|
getCacheSize(e) {
|
|
9650
9650
|
return this.zn.getCacheSize(e);
|
|
@@ -11403,7 +11403,7 @@ class __PRIVATE_MemoryLruDelegate {
|
|
|
11403
11403
|
e.createObjectStore("mutations", {
|
|
11404
11404
|
keyPath: "batchId",
|
|
11405
11405
|
autoIncrement: !0
|
|
11406
|
-
}).createIndex("userMutationsIndex",
|
|
11406
|
+
}).createIndex("userMutationsIndex", x, {
|
|
11407
11407
|
unique: !0
|
|
11408
11408
|
}), e.createObjectStore("documentMutations");
|
|
11409
11409
|
}
|
|
@@ -11448,7 +11448,7 @@ class __PRIVATE_MemoryLruDelegate {
|
|
|
11448
11448
|
e.createObjectStore("mutations", {
|
|
11449
11449
|
keyPath: "batchId",
|
|
11450
11450
|
autoIncrement: !0
|
|
11451
|
-
}).createIndex("userMutationsIndex",
|
|
11451
|
+
}).createIndex("userMutationsIndex", x, {
|
|
11452
11452
|
unique: !0
|
|
11453
11453
|
});
|
|
11454
11454
|
const r = t.store("mutations"), i = n.map((e => r.put(e)));
|
|
@@ -11485,19 +11485,19 @@ class __PRIVATE_MemoryLruDelegate {
|
|
|
11485
11485
|
}))), n < 12 && r >= 12 && (s = s.next((() => {
|
|
11486
11486
|
!function __PRIVATE_createDocumentOverlayStore(e) {
|
|
11487
11487
|
const t = e.createObjectStore("documentOverlays", {
|
|
11488
|
-
keyPath:
|
|
11488
|
+
keyPath: z
|
|
11489
11489
|
});
|
|
11490
|
-
t.createIndex("collectionPathOverlayIndex",
|
|
11490
|
+
t.createIndex("collectionPathOverlayIndex", j, {
|
|
11491
11491
|
unique: !1
|
|
11492
|
-
}), t.createIndex("collectionGroupOverlayIndex",
|
|
11492
|
+
}), t.createIndex("collectionGroupOverlayIndex", H, {
|
|
11493
11493
|
unique: !1
|
|
11494
11494
|
});
|
|
11495
11495
|
}(e);
|
|
11496
11496
|
}))), n < 13 && r >= 13 && (s = s.next((() => function __PRIVATE_createRemoteDocumentCache(e) {
|
|
11497
11497
|
const t = e.createObjectStore("remoteDocumentsV14", {
|
|
11498
|
-
keyPath:
|
|
11498
|
+
keyPath: N
|
|
11499
11499
|
});
|
|
11500
|
-
t.createIndex("documentKeyIndex",
|
|
11500
|
+
t.createIndex("documentKeyIndex", B), t.createIndex("collectionGroupIndex", L);
|
|
11501
11501
|
}(e))).next((() => this.ri(e, i))).next((() => e.deleteObjectStore("remoteDocuments")))),
|
|
11502
11502
|
n < 14 && r >= 14 && (s = s.next((() => this.ii(e, i)))), n < 15 && r >= 15 && (s = s.next((() => function __PRIVATE_createFieldIndex(e) {
|
|
11503
11503
|
e.createObjectStore("indexConfiguration", {
|
|
@@ -11507,13 +11507,13 @@ class __PRIVATE_MemoryLruDelegate {
|
|
|
11507
11507
|
unique: !1
|
|
11508
11508
|
});
|
|
11509
11509
|
e.createObjectStore("indexState", {
|
|
11510
|
-
keyPath:
|
|
11511
|
-
}).createIndex("sequenceNumberIndex",
|
|
11510
|
+
keyPath: $
|
|
11511
|
+
}).createIndex("sequenceNumberIndex", U, {
|
|
11512
11512
|
unique: !1
|
|
11513
11513
|
});
|
|
11514
11514
|
e.createObjectStore("indexEntries", {
|
|
11515
|
-
keyPath:
|
|
11516
|
-
}).createIndex("documentKeyIndex",
|
|
11515
|
+
keyPath: W
|
|
11516
|
+
}).createIndex("documentKeyIndex", G, {
|
|
11517
11517
|
unique: !1
|
|
11518
11518
|
});
|
|
11519
11519
|
}(e)))), s;
|
|
@@ -11562,7 +11562,7 @@ class __PRIVATE_MemoryLruDelegate {
|
|
|
11562
11562
|
ti(e, t) {
|
|
11563
11563
|
// Create the index.
|
|
11564
11564
|
e.createObjectStore("collectionParents", {
|
|
11565
|
-
keyPath:
|
|
11565
|
+
keyPath: K
|
|
11566
11566
|
});
|
|
11567
11567
|
const n = t.store("collectionParents"), r = new __PRIVATE_MemoryCollectionParentIndex, addEntry = e => {
|
|
11568
11568
|
if (r.add(e)) {
|
|
@@ -11647,19 +11647,19 @@ class __PRIVATE_MemoryLruDelegate {
|
|
|
11647
11647
|
|
|
11648
11648
|
function __PRIVATE_createQueryCache(e) {
|
|
11649
11649
|
e.createObjectStore("targetDocuments", {
|
|
11650
|
-
keyPath:
|
|
11651
|
-
}).createIndex("documentTargetsIndex",
|
|
11650
|
+
keyPath: q
|
|
11651
|
+
}).createIndex("documentTargetsIndex", Q, {
|
|
11652
11652
|
unique: !0
|
|
11653
11653
|
});
|
|
11654
11654
|
// NOTE: This is unique only because the TargetId is the suffix.
|
|
11655
11655
|
e.createObjectStore("targets", {
|
|
11656
11656
|
keyPath: "targetId"
|
|
11657
|
-
}).createIndex("queryTargetsIndex",
|
|
11657
|
+
}).createIndex("queryTargetsIndex", k, {
|
|
11658
11658
|
unique: !0
|
|
11659
11659
|
}), e.createObjectStore("targetGlobal");
|
|
11660
11660
|
}
|
|
11661
11661
|
|
|
11662
|
-
const
|
|
11662
|
+
const Ae = "Failed to obtain exclusive access to the persistence layer. To allow shared access, multi-tab synchronization has to be enabled in all tabs. If you are using `experimentalForceOwningTab:true`, make sure that only one tab has persistence enabled at any given time.";
|
|
11663
11663
|
|
|
11664
11664
|
/**
|
|
11665
11665
|
* Oldest acceptable age in milliseconds for client metadata before the client
|
|
@@ -11735,7 +11735,7 @@ class __PRIVATE_IndexedDbPersistence {
|
|
|
11735
11735
|
/** The last time we garbage collected the client metadata object store. */
|
|
11736
11736
|
this.hi = Number.NEGATIVE_INFINITY,
|
|
11737
11737
|
/** A listener to notify on primary state changes. */
|
|
11738
|
-
this.Pi = e => Promise.resolve(), !__PRIVATE_IndexedDbPersistence.D()) throw new FirestoreError(
|
|
11738
|
+
this.Pi = e => Promise.resolve(), !__PRIVATE_IndexedDbPersistence.D()) throw new FirestoreError(C.UNIMPLEMENTED, "This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");
|
|
11739
11739
|
this.referenceDelegate = new __PRIVATE_IndexedDbLruDelegateImpl(this, r), this.Ii = t + "main",
|
|
11740
11740
|
this.serializer = new __PRIVATE_LocalSerializer(_), this.Ti = new __PRIVATE_SimpleDb(this.Ii, this.ai, new __PRIVATE_SchemaConverter(this.serializer)),
|
|
11741
11741
|
this.qr = new __PRIVATE_IndexedDbTargetCache(this.referenceDelegate, this.serializer),
|
|
@@ -11755,7 +11755,7 @@ class __PRIVATE_IndexedDbPersistence {
|
|
|
11755
11755
|
if (!this.isPrimary && !this.allowTabSynchronization)
|
|
11756
11756
|
// Fail `start()` if `synchronizeTabs` is disabled and we cannot
|
|
11757
11757
|
// obtain the primary lease.
|
|
11758
|
-
throw new FirestoreError(
|
|
11758
|
+
throw new FirestoreError(C.FAILED_PRECONDITION, Ae);
|
|
11759
11759
|
return this.Ai(), this.Ri(), this.Vi(), this.runTransaction("getHighestListenSequenceNumber", "readonly", (e => this.qr.getHighestSequenceNumber(e)));
|
|
11760
11760
|
})).then((e => {
|
|
11761
11761
|
this.Lr = new __PRIVATE_ListenSequence(e, this.oi);
|
|
@@ -11897,7 +11897,7 @@ class __PRIVATE_IndexedDbPersistence {
|
|
|
11897
11897
|
// settings is not supported.
|
|
11898
11898
|
// TODO(b/114226234): Remove this check when `synchronizeTabs` can
|
|
11899
11899
|
// no longer be turned off.
|
|
11900
|
-
throw new FirestoreError(
|
|
11900
|
+
throw new FirestoreError(C.FAILED_PRECONDITION, Ae);
|
|
11901
11901
|
return !1;
|
|
11902
11902
|
}
|
|
11903
11903
|
}
|
|
@@ -11967,7 +11967,7 @@ class __PRIVATE_IndexedDbPersistence {
|
|
|
11967
11967
|
const r = "readonly" === t ? "readonly" : "readwrite", i =
|
|
11968
11968
|
/** Returns the object stores for the provided schema. */
|
|
11969
11969
|
function __PRIVATE_getObjectStores(e) {
|
|
11970
|
-
return 15 === e ?
|
|
11970
|
+
return 15 === e ? ee : 14 === e ? X : 13 === e ? Z : 12 === e ? Y : 11 === e ? J : void fail();
|
|
11971
11971
|
}(this.ai);
|
|
11972
11972
|
let s;
|
|
11973
11973
|
// Do all transactions as readwrite against all object stores, since we
|
|
@@ -11975,7 +11975,7 @@ class __PRIVATE_IndexedDbPersistence {
|
|
|
11975
11975
|
return this.Ti.runTransaction(e, r, i, (r => (s = new __PRIVATE_IndexedDbTransaction(r, this.Lr ? this.Lr.next() : __PRIVATE_ListenSequence._e),
|
|
11976
11976
|
"readwrite-primary" === t ? this.fi(s).next((e => !!e || this.gi(s))).next((t => {
|
|
11977
11977
|
if (!t) throw __PRIVATE_logError(`Failed to obtain primary lease for action '${e}'.`),
|
|
11978
|
-
this.isPrimary = !1, this.si.enqueueRetryable((() => this.Pi(!1))), new FirestoreError(
|
|
11978
|
+
this.isPrimary = !1, this.si.enqueueRetryable((() => this.Pi(!1))), new FirestoreError(C.FAILED_PRECONDITION, F);
|
|
11979
11979
|
return n(s);
|
|
11980
11980
|
})).next((e => this.yi(s).next((() => e)))) : this.Li(s).next((() => n(s)))))).then((e => (s.raiseOnCommittedEvent(),
|
|
11981
11981
|
e)));
|
|
@@ -11988,7 +11988,7 @@ class __PRIVATE_IndexedDbPersistence {
|
|
|
11988
11988
|
// be turned off.
|
|
11989
11989
|
Li(e) {
|
|
11990
11990
|
return __PRIVATE_primaryClientStore(e).get("owner").next((e => {
|
|
11991
|
-
if (null !== e && this.Di(e.leaseTimestampMs, 5e3) && !this.Fi(e.ownerId) && !this.wi(e) && !(this._i || this.allowTabSynchronization && e.allowTabSynchronization)) throw new FirestoreError(
|
|
11991
|
+
if (null !== e && this.Di(e.leaseTimestampMs, 5e3) && !this.Fi(e.ownerId) && !this.wi(e) && !(this._i || this.allowTabSynchronization && e.allowTabSynchronization)) throw new FirestoreError(C.FAILED_PRECONDITION, Ae);
|
|
11992
11992
|
}));
|
|
11993
11993
|
}
|
|
11994
11994
|
/**
|
|
@@ -13473,7 +13473,7 @@ class __PRIVATE_BrowserConnectivityMonitor {
|
|
|
13473
13473
|
/**
|
|
13474
13474
|
* The value returned from the most recent invocation of
|
|
13475
13475
|
* `generateUniqueDebugId()`, or null if it has never been invoked.
|
|
13476
|
-
*/ let
|
|
13476
|
+
*/ let Re = null;
|
|
13477
13477
|
|
|
13478
13478
|
/**
|
|
13479
13479
|
* Generates and returns an initial value for `lastUniqueDebugId`.
|
|
@@ -13498,9 +13498,9 @@ class __PRIVATE_BrowserConnectivityMonitor {
|
|
|
13498
13498
|
* @return the 10-character generated ID (e.g. "0xa1b2c3d4").
|
|
13499
13499
|
*/
|
|
13500
13500
|
function __PRIVATE_generateUniqueDebugId() {
|
|
13501
|
-
return null ===
|
|
13501
|
+
return null === Re ? Re = function __PRIVATE_generateInitialUniqueDebugId() {
|
|
13502
13502
|
return 268435456 + Math.round(2147483648 * Math.random());
|
|
13503
|
-
}() :
|
|
13503
|
+
}() : Re++, "0x" + Re.toString(16);
|
|
13504
13504
|
}
|
|
13505
13505
|
|
|
13506
13506
|
/**
|
|
@@ -13518,7 +13518,7 @@ function __PRIVATE_generateUniqueDebugId() {
|
|
|
13518
13518
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13519
13519
|
* See the License for the specific language governing permissions and
|
|
13520
13520
|
* limitations under the License.
|
|
13521
|
-
*/ const
|
|
13521
|
+
*/ const Ve = {
|
|
13522
13522
|
BatchGetDocuments: "batchGet",
|
|
13523
13523
|
Commit: "commit",
|
|
13524
13524
|
RunQuery: "runQuery",
|
|
@@ -13596,7 +13596,7 @@ class __PRIVATE_StreamBridge {
|
|
|
13596
13596
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13597
13597
|
* See the License for the specific language governing permissions and
|
|
13598
13598
|
* limitations under the License.
|
|
13599
|
-
*/ const
|
|
13599
|
+
*/ const me = "WebChannelConnection";
|
|
13600
13600
|
|
|
13601
13601
|
class __PRIVATE_WebChannelConnection extends
|
|
13602
13602
|
/**
|
|
@@ -13640,7 +13640,7 @@ class __PRIVATE_RestConnection {
|
|
|
13640
13640
|
// SDK_VERSION is updated to different value at runtime depending on the entry point,
|
|
13641
13641
|
// so we need to get its value when we need it in a function.
|
|
13642
13642
|
function __PRIVATE_getGoogApiClientValue() {
|
|
13643
|
-
return "gl-js/ fire/" +
|
|
13643
|
+
return "gl-js/ fire/" + b;
|
|
13644
13644
|
}(),
|
|
13645
13645
|
// Content-Type: text/plain will avoid preflight requests which might
|
|
13646
13646
|
// mess with CORS and redirects by proxies. If we add custom headers
|
|
@@ -13650,7 +13650,7 @@ class __PRIVATE_RestConnection {
|
|
|
13650
13650
|
t && t.headers.forEach(((t, n) => e[n] = t)), n && n.headers.forEach(((t, n) => e[n] = t));
|
|
13651
13651
|
}
|
|
13652
13652
|
So(e, t) {
|
|
13653
|
-
const n =
|
|
13653
|
+
const n = Ve[e];
|
|
13654
13654
|
return `${this.mo}/v1/${t}:${n}`;
|
|
13655
13655
|
}
|
|
13656
13656
|
} {
|
|
@@ -13667,17 +13667,17 @@ class __PRIVATE_RestConnection {
|
|
|
13667
13667
|
switch (_.getLastErrorCode()) {
|
|
13668
13668
|
case webchannelWrapper.ErrorCode.NO_ERROR:
|
|
13669
13669
|
const t = _.getResponseJson();
|
|
13670
|
-
__PRIVATE_logDebug(
|
|
13670
|
+
__PRIVATE_logDebug(me, `XHR for RPC '${e}' ${i} received:`, JSON.stringify(t)),
|
|
13671
13671
|
s(t);
|
|
13672
13672
|
break;
|
|
13673
13673
|
|
|
13674
13674
|
case webchannelWrapper.ErrorCode.TIMEOUT:
|
|
13675
|
-
__PRIVATE_logDebug(
|
|
13675
|
+
__PRIVATE_logDebug(me, `RPC '${e}' ${i} timed out`), o(new FirestoreError(C.DEADLINE_EXCEEDED, "Request time out"));
|
|
13676
13676
|
break;
|
|
13677
13677
|
|
|
13678
13678
|
case webchannelWrapper.ErrorCode.HTTP_ERROR:
|
|
13679
13679
|
const n = _.getStatus();
|
|
13680
|
-
if (__PRIVATE_logDebug(
|
|
13680
|
+
if (__PRIVATE_logDebug(me, `RPC '${e}' ${i} failed with status:`, n, "response text:", _.getResponseText()),
|
|
13681
13681
|
n > 0) {
|
|
13682
13682
|
let e = _.getResponseJson();
|
|
13683
13683
|
Array.isArray(e) && (e = e[0]);
|
|
@@ -13685,25 +13685,25 @@ class __PRIVATE_RestConnection {
|
|
|
13685
13685
|
if (t && t.status && t.message) {
|
|
13686
13686
|
const e = function __PRIVATE_mapCodeFromHttpResponseErrorStatus(e) {
|
|
13687
13687
|
const t = e.toLowerCase().replace(/_/g, "-");
|
|
13688
|
-
return Object.values(
|
|
13688
|
+
return Object.values(C).indexOf(t) >= 0 ? t : C.UNKNOWN;
|
|
13689
13689
|
}(t.status);
|
|
13690
13690
|
o(new FirestoreError(e, t.message));
|
|
13691
|
-
} else o(new FirestoreError(
|
|
13691
|
+
} else o(new FirestoreError(C.UNKNOWN, "Server responded with status " + _.getStatus()));
|
|
13692
13692
|
} else
|
|
13693
13693
|
// If we received an HTTP_ERROR but there's no status code,
|
|
13694
13694
|
// it's most probably a connection issue
|
|
13695
|
-
o(new FirestoreError(
|
|
13695
|
+
o(new FirestoreError(C.UNAVAILABLE, "Connection failed."));
|
|
13696
13696
|
break;
|
|
13697
13697
|
|
|
13698
13698
|
default:
|
|
13699
13699
|
fail();
|
|
13700
13700
|
}
|
|
13701
13701
|
} finally {
|
|
13702
|
-
__PRIVATE_logDebug(
|
|
13702
|
+
__PRIVATE_logDebug(me, `RPC '${e}' ${i} completed.`);
|
|
13703
13703
|
}
|
|
13704
13704
|
}));
|
|
13705
13705
|
const a = JSON.stringify(r);
|
|
13706
|
-
__PRIVATE_logDebug(
|
|
13706
|
+
__PRIVATE_logDebug(me, `RPC '${e}' ${i} sending request:`, r), _.send(t, "POST", a, n, 15);
|
|
13707
13707
|
}));
|
|
13708
13708
|
}
|
|
13709
13709
|
vo(e, t, n) {
|
|
@@ -13731,8 +13731,9 @@ class __PRIVATE_RestConnection {
|
|
|
13731
13731
|
forceLongPolling: this.forceLongPolling,
|
|
13732
13732
|
detectBufferingProxy: this.autoDetectLongPolling
|
|
13733
13733
|
}, a = this.longPollingOptions.timeoutSeconds;
|
|
13734
|
-
void 0 !== a && (_.longPollingTimeout = Math.round(1e3 * a)), this.useFetchStreams && (
|
|
13735
|
-
|
|
13734
|
+
void 0 !== a && (_.longPollingTimeout = Math.round(1e3 * a)), this.useFetchStreams && (
|
|
13735
|
+
// TODO(b/307942499): switch to `useFetchStreams` once WebChannel is fixed.
|
|
13736
|
+
_.xmlHttpFactory = new webchannelWrapper.FetchXmlHttpFactory({})), this.bo(_.initMessageHeaders, t, n),
|
|
13736
13737
|
// Sending the custom headers we just added to request.initMessageHeaders
|
|
13737
13738
|
// (Authorization, etc.) will trigger the browser to make a CORS preflight
|
|
13738
13739
|
// request because the XHR will no longer meet the criteria for a "simple"
|
|
@@ -13744,7 +13745,7 @@ class __PRIVATE_RestConnection {
|
|
|
13744
13745
|
// which is recognized by the webchannel backend.
|
|
13745
13746
|
_.encodeInitMessageHeaders = !0;
|
|
13746
13747
|
const u = i.join("");
|
|
13747
|
-
__PRIVATE_logDebug(
|
|
13748
|
+
__PRIVATE_logDebug(me, `Creating RPC '${e}' stream ${r}: ${u}`, _);
|
|
13748
13749
|
const c = s.createWebChannel(u, _);
|
|
13749
13750
|
// WebChannel supports sending the first message with the handshake - saving
|
|
13750
13751
|
// a network round trip. However, it will have to call send in the same
|
|
@@ -13757,8 +13758,8 @@ class __PRIVATE_RestConnection {
|
|
|
13757
13758
|
// on a closed stream
|
|
13758
13759
|
const P = new __PRIVATE_StreamBridge({
|
|
13759
13760
|
co: t => {
|
|
13760
|
-
h ? __PRIVATE_logDebug(
|
|
13761
|
-
c.open(), l = !0), __PRIVATE_logDebug(
|
|
13761
|
+
h ? __PRIVATE_logDebug(me, `Not sending because RPC '${e}' stream ${r} is closed:`, t) : (l || (__PRIVATE_logDebug(me, `Opening RPC '${e}' stream ${r} transport.`),
|
|
13762
|
+
c.open(), l = !0), __PRIVATE_logDebug(me, `RPC '${e}' stream ${r} sending:`, t),
|
|
13762
13763
|
c.send(t));
|
|
13763
13764
|
},
|
|
13764
13765
|
lo: () => c.close()
|
|
@@ -13780,13 +13781,13 @@ class __PRIVATE_RestConnection {
|
|
|
13780
13781
|
// Note that eventually this function could go away if we are confident
|
|
13781
13782
|
// enough the code is exception free.
|
|
13782
13783
|
return __PRIVATE_unguardedEventListen(c, webchannelWrapper.WebChannel.EventType.OPEN, (() => {
|
|
13783
|
-
h || __PRIVATE_logDebug(
|
|
13784
|
+
h || __PRIVATE_logDebug(me, `RPC '${e}' stream ${r} transport opened.`);
|
|
13784
13785
|
})), __PRIVATE_unguardedEventListen(c, webchannelWrapper.WebChannel.EventType.CLOSE, (() => {
|
|
13785
|
-
h || (h = !0, __PRIVATE_logDebug(
|
|
13786
|
+
h || (h = !0, __PRIVATE_logDebug(me, `RPC '${e}' stream ${r} transport closed`),
|
|
13786
13787
|
P.Ro());
|
|
13787
13788
|
})), __PRIVATE_unguardedEventListen(c, webchannelWrapper.WebChannel.EventType.ERROR, (t => {
|
|
13788
|
-
h || (h = !0, __PRIVATE_logWarn(
|
|
13789
|
-
P.Ro(new FirestoreError(
|
|
13789
|
+
h || (h = !0, __PRIVATE_logWarn(me, `RPC '${e}' stream ${r} transport errored:`, t),
|
|
13790
|
+
P.Ro(new FirestoreError(C.UNAVAILABLE, "The operation could not be completed")));
|
|
13790
13791
|
})), __PRIVATE_unguardedEventListen(c, webchannelWrapper.WebChannel.EventType.MESSAGE, (t => {
|
|
13791
13792
|
var n;
|
|
13792
13793
|
if (!h) {
|
|
@@ -13799,7 +13800,7 @@ class __PRIVATE_RestConnection {
|
|
|
13799
13800
|
// Use any because msgData.error is not typed.
|
|
13800
13801
|
const s = i, o = s.error || (null === (n = s[0]) || void 0 === n ? void 0 : n.error);
|
|
13801
13802
|
if (o) {
|
|
13802
|
-
__PRIVATE_logDebug(
|
|
13803
|
+
__PRIVATE_logDebug(me, `RPC '${e}' stream ${r} received error:`, o);
|
|
13803
13804
|
// error.status will be a string like 'OK' or 'NOT_FOUND'.
|
|
13804
13805
|
const t = o.status;
|
|
13805
13806
|
let n =
|
|
@@ -13812,16 +13813,16 @@ class __PRIVATE_RestConnection {
|
|
|
13812
13813
|
function __PRIVATE_mapCodeFromRpcStatus(e) {
|
|
13813
13814
|
// lookup by string
|
|
13814
13815
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13815
|
-
const t =
|
|
13816
|
+
const t = ue[e];
|
|
13816
13817
|
if (void 0 !== t) return __PRIVATE_mapCodeFromRpcCode(t);
|
|
13817
13818
|
}(t), i = o.message;
|
|
13818
|
-
void 0 === n && (n =
|
|
13819
|
+
void 0 === n && (n = C.INTERNAL, i = "Unknown error status: " + t + " with message " + o.message),
|
|
13819
13820
|
// Mark closed so no further events are propagated
|
|
13820
13821
|
h = !0, P.Ro(new FirestoreError(n, i)), c.close();
|
|
13821
|
-
} else __PRIVATE_logDebug(
|
|
13822
|
+
} else __PRIVATE_logDebug(me, `RPC '${e}' stream ${r} received:`, i), P.Vo(i);
|
|
13822
13823
|
}
|
|
13823
13824
|
})), __PRIVATE_unguardedEventListen(o, webchannelWrapper.Event.STAT_EVENT, (t => {
|
|
13824
|
-
t.stat === webchannelWrapper.Stat.PROXY ? __PRIVATE_logDebug(
|
|
13825
|
+
t.stat === webchannelWrapper.Stat.PROXY ? __PRIVATE_logDebug(me, `RPC '${e}' stream ${r} detected buffering proxy`) : t.stat === webchannelWrapper.Stat.NOPROXY && __PRIVATE_logDebug(me, `RPC '${e}' stream ${r} detected no buffering proxy`);
|
|
13825
13826
|
})), setTimeout((() => {
|
|
13826
13827
|
// Technically we could/should wait for the WebChannel opened event,
|
|
13827
13828
|
// but because we want to send the first message with the WebChannel
|
|
@@ -14145,10 +14146,10 @@ class __PRIVATE_PersistentStream {
|
|
|
14145
14146
|
// underlying stream), guaranteeing they won't execute.
|
|
14146
14147
|
this.Uo++, 4 /* PersistentStreamState.Error */ !== e ?
|
|
14147
14148
|
// If this is an intentional close ensure we don't delay our next connection attempt.
|
|
14148
|
-
this.zo.reset() : t && t.code ===
|
|
14149
|
+
this.zo.reset() : t && t.code === C.RESOURCE_EXHAUSTED ? (
|
|
14149
14150
|
// Log the error. (Probably either 'quota exceeded' or 'max queue length reached'.)
|
|
14150
14151
|
__PRIVATE_logError(t.toString()), __PRIVATE_logError("Using maximum backoff delay to prevent overloading the backend."),
|
|
14151
|
-
this.zo.Lo()) : t && t.code ===
|
|
14152
|
+
this.zo.Lo()) : t && t.code === C.UNAUTHENTICATED && 3 /* PersistentStreamState.Healthy */ !== this.state && (
|
|
14152
14153
|
// "unauthenticated" error means the token was rejected. This should rarely
|
|
14153
14154
|
// happen since both Auth and AppCheck ensure a sufficient TTL when we
|
|
14154
14155
|
// request a token. If a user manually resets their system clock this can
|
|
@@ -14184,7 +14185,7 @@ class __PRIVATE_PersistentStream {
|
|
|
14184
14185
|
this.s_(e, n);
|
|
14185
14186
|
}), (t => {
|
|
14186
14187
|
e((() => {
|
|
14187
|
-
const e = new FirestoreError(
|
|
14188
|
+
const e = new FirestoreError(C.UNKNOWN, "Fetching auth token failed: " + t.message);
|
|
14188
14189
|
return this.o_(e);
|
|
14189
14190
|
}));
|
|
14190
14191
|
}));
|
|
@@ -14397,18 +14398,18 @@ class __PRIVATE_DatastoreImpl extends class Datastore {} {
|
|
|
14397
14398
|
this.serializer = r, this.d_ = !1;
|
|
14398
14399
|
}
|
|
14399
14400
|
A_() {
|
|
14400
|
-
if (this.d_) throw new FirestoreError(
|
|
14401
|
+
if (this.d_) throw new FirestoreError(C.FAILED_PRECONDITION, "The client has already been terminated.");
|
|
14401
14402
|
}
|
|
14402
14403
|
/** Invokes the provided RPC with auth and AppCheck tokens. */ wo(e, t, n) {
|
|
14403
14404
|
return this.A_(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, i]) => this.connection.wo(e, t, n, r, i))).catch((e => {
|
|
14404
|
-
throw "FirebaseError" === e.name ? (e.code ===
|
|
14405
|
-
this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(
|
|
14405
|
+
throw "FirebaseError" === e.name ? (e.code === C.UNAUTHENTICATED && (this.authCredentials.invalidateToken(),
|
|
14406
|
+
this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(C.UNKNOWN, e.toString());
|
|
14406
14407
|
}));
|
|
14407
14408
|
}
|
|
14408
14409
|
/** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ Co(e, t, n, r) {
|
|
14409
14410
|
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 => {
|
|
14410
|
-
throw "FirebaseError" === e.name ? (e.code ===
|
|
14411
|
-
this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(
|
|
14411
|
+
throw "FirebaseError" === e.name ? (e.code === C.UNAUTHENTICATED && (this.authCredentials.invalidateToken(),
|
|
14412
|
+
this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(C.UNKNOWN, e.toString());
|
|
14412
14413
|
}));
|
|
14413
14414
|
}
|
|
14414
14415
|
terminate() {
|
|
@@ -14898,7 +14899,7 @@ async function __PRIVATE_onWriteStreamClose(e, t) {
|
|
|
14898
14899
|
// Only handle permanent errors here. If it's transient, just let the retry
|
|
14899
14900
|
// logic kick in.
|
|
14900
14901
|
if (function __PRIVATE_isPermanentWriteError(e) {
|
|
14901
|
-
return __PRIVATE_isPermanentError(e) && e !==
|
|
14902
|
+
return __PRIVATE_isPermanentError(e) && e !== C.ABORTED;
|
|
14902
14903
|
}(t.code)) {
|
|
14903
14904
|
// This was a permanent error, the request itself was the problem
|
|
14904
14905
|
// so it's not going to succeed if we resend it.
|
|
@@ -15079,7 +15080,7 @@ class DelayedOperation {
|
|
|
15079
15080
|
* As long as the operation has not yet been run, calling cancel() provides a
|
|
15080
15081
|
* guarantee that the operation will not be run.
|
|
15081
15082
|
*/ cancel(e) {
|
|
15082
|
-
null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new FirestoreError(
|
|
15083
|
+
null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new FirestoreError(C.CANCELLED, "Operation cancelled" + (e ? ": " + e : ""))));
|
|
15083
15084
|
}
|
|
15084
15085
|
handleDelayElapsed() {
|
|
15085
15086
|
this.asyncQueue.enqueueAndForget((() => null !== this.timerHandle ? (this.clearTimeout(),
|
|
@@ -15095,7 +15096,7 @@ class DelayedOperation {
|
|
|
15095
15096
|
* Returns a FirestoreError that can be surfaced to the user if the provided
|
|
15096
15097
|
* error is an IndexedDbTransactionError. Re-throws the error otherwise.
|
|
15097
15098
|
*/ function __PRIVATE_wrapInUserErrorIfRecoverable(e, t) {
|
|
15098
|
-
if (__PRIVATE_logError("AsyncQueue", `${t}: ${e}`), __PRIVATE_isIndexedDbTransactionError(e)) return new FirestoreError(
|
|
15099
|
+
if (__PRIVATE_logError("AsyncQueue", `${t}: ${e}`), __PRIVATE_isIndexedDbTransactionError(e)) return new FirestoreError(C.UNAVAILABLE, `${t}: ${e}`);
|
|
15099
15100
|
throw e;
|
|
15100
15101
|
}
|
|
15101
15102
|
|
|
@@ -16375,7 +16376,7 @@ async function __PRIVATE_syncEngineHandleCredentialChange(e, t) {
|
|
|
16375
16376
|
function __PRIVATE_rejectOutstandingPendingWritesCallbacks(e, t) {
|
|
16376
16377
|
e.ba.forEach((e => {
|
|
16377
16378
|
e.forEach((e => {
|
|
16378
|
-
e.reject(new FirestoreError(
|
|
16379
|
+
e.reject(new FirestoreError(C.CANCELLED, t));
|
|
16379
16380
|
}));
|
|
16380
16381
|
})), e.ba.clear();
|
|
16381
16382
|
}(n, "'waitForPendingWrites' promise is rejected due to a user change."),
|
|
@@ -16804,7 +16805,7 @@ class __PRIVATE_LruGcMemoryOfflineComponentProvider extends MemoryOfflineCompone
|
|
|
16804
16805
|
}
|
|
16805
16806
|
createSharedClientState(e) {
|
|
16806
16807
|
const t = __PRIVATE_getWindow();
|
|
16807
|
-
if (!__PRIVATE_WebStorageSharedClientState.D(t)) throw new FirestoreError(
|
|
16808
|
+
if (!__PRIVATE_WebStorageSharedClientState.D(t)) throw new FirestoreError(C.UNIMPLEMENTED, "IndexedDB persistence is only available on platforms that support LocalStorage.");
|
|
16808
16809
|
const n = __PRIVATE_indexedDbStoragePrefix(e.databaseInfo.databaseId, e.databaseInfo.persistenceKey);
|
|
16809
16810
|
return new __PRIVATE_WebStorageSharedClientState(t, e.asyncQueue, n, e.clientId, e.initialUser);
|
|
16810
16811
|
}
|
|
@@ -17141,7 +17142,7 @@ class Transaction$2 {
|
|
|
17141
17142
|
this.writtenDocs = new Set;
|
|
17142
17143
|
}
|
|
17143
17144
|
async lookup(e) {
|
|
17144
|
-
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new FirestoreError(
|
|
17145
|
+
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new FirestoreError(C.INVALID_ARGUMENT, "Firestore transactions require all reads to be executed before all writes.");
|
|
17145
17146
|
const t = await async function __PRIVATE_invokeBatchGetDocumentsRpc(e, t) {
|
|
17146
17147
|
const n = __PRIVATE_debugCast(e), r = __PRIVATE_getEncodedDatabaseId(n.serializer) + "/documents", i = {
|
|
17147
17148
|
documents: t.map((e => __PRIVATE_toName(n.serializer, e)))
|
|
@@ -17202,7 +17203,7 @@ class Transaction$2 {
|
|
|
17202
17203
|
if (n) {
|
|
17203
17204
|
if (!t.isEqual(n))
|
|
17204
17205
|
// This transaction will fail no matter what.
|
|
17205
|
-
throw new FirestoreError(
|
|
17206
|
+
throw new FirestoreError(C.ABORTED, "Document version changed between two reads.");
|
|
17206
17207
|
} else this.readVersions.set(e.key.toString(), t);
|
|
17207
17208
|
}
|
|
17208
17209
|
/**
|
|
@@ -17229,7 +17230,7 @@ class Transaction$2 {
|
|
|
17229
17230
|
// express that to the backend, we have to validate locally.
|
|
17230
17231
|
// Note: this can change once we can send separate verify writes in the
|
|
17231
17232
|
// transaction.
|
|
17232
|
-
throw new FirestoreError(
|
|
17233
|
+
throw new FirestoreError(C.INVALID_ARGUMENT, "Can't update a document that doesn't exist.");
|
|
17233
17234
|
// Document exists, base precondition on document update time.
|
|
17234
17235
|
return Precondition.updateTime(t);
|
|
17235
17236
|
}
|
|
@@ -17370,7 +17371,7 @@ class FirestoreClient {
|
|
|
17370
17371
|
* Checks that the client has not been terminated. Ensures that other methods on //
|
|
17371
17372
|
* this class cannot be called after the client is terminated. //
|
|
17372
17373
|
*/ verifyNotTerminated() {
|
|
17373
|
-
if (this.asyncQueue.isShuttingDown) throw new FirestoreError(
|
|
17374
|
+
if (this.asyncQueue.isShuttingDown) throw new FirestoreError(C.FAILED_PRECONDITION, "The client has already been terminated.");
|
|
17374
17375
|
}
|
|
17375
17376
|
terminate() {
|
|
17376
17377
|
this.asyncQueue.enterRestrictedMode();
|
|
@@ -17420,7 +17421,7 @@ async function __PRIVATE_setOnlineComponentProvider(e, t) {
|
|
|
17420
17421
|
* Decides whether the provided error allows us to gracefully disable
|
|
17421
17422
|
* persistence (as opposed to crashing the client).
|
|
17422
17423
|
*/ function __PRIVATE_canFallbackFromIndexedDbError(e) {
|
|
17423
|
-
return "FirebaseError" === e.name ? e.code ===
|
|
17424
|
+
return "FirebaseError" === e.name ? e.code === C.FAILED_PRECONDITION || e.code === C.UNIMPLEMENTED : !("undefined" != typeof DOMException && e instanceof DOMException) || (
|
|
17424
17425
|
// When the browser is out of quota we could get either quota exceeded
|
|
17425
17426
|
// or an aborted error depending on whether the error happened during
|
|
17426
17427
|
// schema migration.
|
|
@@ -17512,7 +17513,7 @@ async function __PRIVATE_getEventManager(e) {
|
|
|
17512
17513
|
const n = __PRIVATE_debugCast(e);
|
|
17513
17514
|
return n.persistence.runTransaction("read document", "readonly", (e => n.localDocuments.getDocument(e, t)));
|
|
17514
17515
|
}(e, t);
|
|
17515
|
-
r.isFoundDocument() ? n.resolve(r) : r.isNoDocument() ? n.resolve(null) : n.reject(new FirestoreError(
|
|
17516
|
+
r.isFoundDocument() ? n.resolve(r) : r.isNoDocument() ? n.resolve(null) : n.reject(new FirestoreError(C.UNAVAILABLE, "Failed to get document from cache. (However, this document may exist on the server. Run again without setting 'source' in the GetOptions to attempt to retrieve the document from the server.)"));
|
|
17516
17517
|
} catch (e) {
|
|
17517
17518
|
const r = __PRIVATE_wrapInUserErrorIfRecoverable(e, `Failed to get document '${t} from cache`);
|
|
17518
17519
|
n.reject(r);
|
|
@@ -17541,7 +17542,7 @@ function __PRIVATE_firestoreClientGetDocumentViaSnapshotListener(e, t, n = {}) {
|
|
|
17541
17542
|
// the server so we can deliver that even when you're
|
|
17542
17543
|
// offline 2) Actually reject the Promise in the online case
|
|
17543
17544
|
// if the document doesn't exist.
|
|
17544
|
-
i.reject(new FirestoreError(
|
|
17545
|
+
i.reject(new FirestoreError(C.UNAVAILABLE, "Failed to get document because the client is offline.")) : _ && s.fromCache && r && "server" === r.source ? i.reject(new FirestoreError(C.UNAVAILABLE, 'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')) : i.resolve(s);
|
|
17545
17546
|
},
|
|
17546
17547
|
error: e => i.reject(e)
|
|
17547
17548
|
}), o = new __PRIVATE_QueryListener(__PRIVATE_newQueryForPath(n.path), s, {
|
|
@@ -17578,7 +17579,7 @@ function __PRIVATE_firestoreClientGetDocumentsViaSnapshotListener(e, t, n = {})
|
|
|
17578
17579
|
next: n => {
|
|
17579
17580
|
// Remove query first before passing event to user to avoid
|
|
17580
17581
|
// user actions affecting the now stale query.
|
|
17581
|
-
t.enqueueAndForget((() => __PRIVATE_eventManagerUnlisten(e, o))), n.fromCache && "server" === r.source ? i.reject(new FirestoreError(
|
|
17582
|
+
t.enqueueAndForget((() => __PRIVATE_eventManagerUnlisten(e, o))), n.fromCache && "server" === r.source ? i.reject(new FirestoreError(C.UNAVAILABLE, 'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')) : i.resolve(n);
|
|
17582
17583
|
},
|
|
17583
17584
|
error: e => i.reject(e)
|
|
17584
17585
|
}), o = new __PRIVATE_QueryListener(n, s, {
|
|
@@ -17778,7 +17779,7 @@ function __PRIVATE_cloneLongPollingOptions(e) {
|
|
|
17778
17779
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17779
17780
|
* See the License for the specific language governing permissions and
|
|
17780
17781
|
* limitations under the License.
|
|
17781
|
-
*/ const
|
|
17782
|
+
*/ const fe = new Map;
|
|
17782
17783
|
|
|
17783
17784
|
/**
|
|
17784
17785
|
* An instance map that ensures only one Datastore exists per Firestore
|
|
@@ -17801,28 +17802,28 @@ function __PRIVATE_cloneLongPollingOptions(e) {
|
|
|
17801
17802
|
* limitations under the License.
|
|
17802
17803
|
*/
|
|
17803
17804
|
function __PRIVATE_validateNonEmptyArgument(e, t, n) {
|
|
17804
|
-
if (!n) throw new FirestoreError(
|
|
17805
|
+
if (!n) throw new FirestoreError(C.INVALID_ARGUMENT, `Function ${e}() cannot be called with an empty ${t}.`);
|
|
17805
17806
|
}
|
|
17806
17807
|
|
|
17807
17808
|
/**
|
|
17808
17809
|
* Validates that two boolean options are not set at the same time.
|
|
17809
17810
|
* @internal
|
|
17810
17811
|
*/ function __PRIVATE_validateIsNotUsedTogether(e, t, n, r) {
|
|
17811
|
-
if (!0 === t && !0 === r) throw new FirestoreError(
|
|
17812
|
+
if (!0 === t && !0 === r) throw new FirestoreError(C.INVALID_ARGUMENT, `${e} and ${n} cannot be used together.`);
|
|
17812
17813
|
}
|
|
17813
17814
|
|
|
17814
17815
|
/**
|
|
17815
17816
|
* Validates that `path` refers to a document (indicated by the fact it contains
|
|
17816
17817
|
* an even numbers of segments).
|
|
17817
17818
|
*/ function __PRIVATE_validateDocumentPath(e) {
|
|
17818
|
-
if (!DocumentKey.isDocumentKey(e)) throw new FirestoreError(
|
|
17819
|
+
if (!DocumentKey.isDocumentKey(e)) throw new FirestoreError(C.INVALID_ARGUMENT, `Invalid document reference. Document references must have an even number of segments, but ${e} has ${e.length}.`);
|
|
17819
17820
|
}
|
|
17820
17821
|
|
|
17821
17822
|
/**
|
|
17822
17823
|
* Validates that `path` refers to a collection (indicated by the fact it
|
|
17823
17824
|
* contains an odd numbers of segments).
|
|
17824
17825
|
*/ function __PRIVATE_validateCollectionPath(e) {
|
|
17825
|
-
if (DocumentKey.isDocumentKey(e)) throw new FirestoreError(
|
|
17826
|
+
if (DocumentKey.isDocumentKey(e)) throw new FirestoreError(C.INVALID_ARGUMENT, `Invalid collection reference. Collection references must have an odd number of segments, but ${e} has ${e.length}.`);
|
|
17826
17827
|
}
|
|
17827
17828
|
|
|
17828
17829
|
/**
|
|
@@ -17866,17 +17867,17 @@ t) {
|
|
|
17866
17867
|
// Unwrap Compat types
|
|
17867
17868
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17868
17869
|
e = e._delegate), !(e instanceof t)) {
|
|
17869
|
-
if (t.name === e.constructor.name) throw new FirestoreError(
|
|
17870
|
+
if (t.name === e.constructor.name) throw new FirestoreError(C.INVALID_ARGUMENT, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
|
|
17870
17871
|
{
|
|
17871
17872
|
const n = __PRIVATE_valueDescription(e);
|
|
17872
|
-
throw new FirestoreError(
|
|
17873
|
+
throw new FirestoreError(C.INVALID_ARGUMENT, `Expected type '${t.name}', but it was: ${n}`);
|
|
17873
17874
|
}
|
|
17874
17875
|
}
|
|
17875
17876
|
return e;
|
|
17876
17877
|
}
|
|
17877
17878
|
|
|
17878
17879
|
function __PRIVATE_validatePositiveNumber(e, t) {
|
|
17879
|
-
if (t <= 0) throw new FirestoreError(
|
|
17880
|
+
if (t <= 0) throw new FirestoreError(C.INVALID_ARGUMENT, `Function ${e}() requires a positive number, but it was: ${t}.`);
|
|
17880
17881
|
}
|
|
17881
17882
|
|
|
17882
17883
|
/**
|
|
@@ -17905,12 +17906,12 @@ class FirestoreSettingsImpl {
|
|
|
17905
17906
|
constructor(e) {
|
|
17906
17907
|
var t, n;
|
|
17907
17908
|
if (void 0 === e.host) {
|
|
17908
|
-
if (void 0 !== e.ssl) throw new FirestoreError(
|
|
17909
|
+
if (void 0 !== e.ssl) throw new FirestoreError(C.INVALID_ARGUMENT, "Can't provide ssl option if host option is not set");
|
|
17909
17910
|
this.host = "firestore.googleapis.com", this.ssl = true;
|
|
17910
17911
|
} else this.host = e.host, this.ssl = null === (t = e.ssl) || void 0 === t || t;
|
|
17911
17912
|
if (this.credentials = e.credentials, this.ignoreUndefinedProperties = !!e.ignoreUndefinedProperties,
|
|
17912
17913
|
this.localCache = e.localCache, void 0 === e.cacheSizeBytes) this.cacheSizeBytes = 41943040; else {
|
|
17913
|
-
if (-1 !== e.cacheSizeBytes && e.cacheSizeBytes < 1048576) throw new FirestoreError(
|
|
17914
|
+
if (-1 !== e.cacheSizeBytes && e.cacheSizeBytes < 1048576) throw new FirestoreError(C.INVALID_ARGUMENT, "cacheSizeBytes must be at least 1048576");
|
|
17914
17915
|
this.cacheSizeBytes = e.cacheSizeBytes;
|
|
17915
17916
|
}
|
|
17916
17917
|
__PRIVATE_validateIsNotUsedTogether("experimentalForceLongPolling", e.experimentalForceLongPolling, "experimentalAutoDetectLongPolling", e.experimentalAutoDetectLongPolling),
|
|
@@ -17922,9 +17923,9 @@ class FirestoreSettingsImpl {
|
|
|
17922
17923
|
this.experimentalLongPollingOptions = __PRIVATE_cloneLongPollingOptions(null !== (n = e.experimentalLongPollingOptions) && void 0 !== n ? n : {}),
|
|
17923
17924
|
function __PRIVATE_validateLongPollingOptions(e) {
|
|
17924
17925
|
if (void 0 !== e.timeoutSeconds) {
|
|
17925
|
-
if (isNaN(e.timeoutSeconds)) throw new FirestoreError(
|
|
17926
|
-
if (e.timeoutSeconds < 5) throw new FirestoreError(
|
|
17927
|
-
if (e.timeoutSeconds > 30) throw new FirestoreError(
|
|
17926
|
+
if (isNaN(e.timeoutSeconds)) throw new FirestoreError(C.INVALID_ARGUMENT, `invalid long polling timeout: ${e.timeoutSeconds} (must not be NaN)`);
|
|
17927
|
+
if (e.timeoutSeconds < 5) throw new FirestoreError(C.INVALID_ARGUMENT, `invalid long polling timeout: ${e.timeoutSeconds} (minimum allowed value is 5)`);
|
|
17928
|
+
if (e.timeoutSeconds > 30) throw new FirestoreError(C.INVALID_ARGUMENT, `invalid long polling timeout: ${e.timeoutSeconds} (maximum allowed value is 30)`);
|
|
17928
17929
|
}
|
|
17929
17930
|
}
|
|
17930
17931
|
/**
|
|
@@ -17971,7 +17972,7 @@ class Firestore$1 {
|
|
|
17971
17972
|
* The {@link @firebase/app#FirebaseApp} associated with this `Firestore` service
|
|
17972
17973
|
* instance.
|
|
17973
17974
|
*/ get app() {
|
|
17974
|
-
if (!this._app) throw new FirestoreError(
|
|
17975
|
+
if (!this._app) throw new FirestoreError(C.FAILED_PRECONDITION, "Firestore was not initialized using the Firebase SDK. 'app' is not available");
|
|
17975
17976
|
return this._app;
|
|
17976
17977
|
}
|
|
17977
17978
|
get _initialized() {
|
|
@@ -17981,7 +17982,7 @@ class Firestore$1 {
|
|
|
17981
17982
|
return void 0 !== this._terminateTask;
|
|
17982
17983
|
}
|
|
17983
17984
|
_setSettings(e) {
|
|
17984
|
-
if (this._settingsFrozen) throw new FirestoreError(
|
|
17985
|
+
if (this._settingsFrozen) throw new FirestoreError(C.FAILED_PRECONDITION, "Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");
|
|
17985
17986
|
this._settings = new FirestoreSettingsImpl(e), void 0 !== e.credentials && (this._authCredentials = function __PRIVATE_makeAuthCredentialsProvider(e) {
|
|
17986
17987
|
if (!e) return new __PRIVATE_EmptyAuthCredentialsProvider;
|
|
17987
17988
|
switch (e.type) {
|
|
@@ -17992,7 +17993,7 @@ class Firestore$1 {
|
|
|
17992
17993
|
return e.client;
|
|
17993
17994
|
|
|
17994
17995
|
default:
|
|
17995
|
-
throw new FirestoreError(
|
|
17996
|
+
throw new FirestoreError(C.INVALID_ARGUMENT, "makeAuthCredentialsProvider failed due to invalid credential type");
|
|
17996
17997
|
}
|
|
17997
17998
|
}(e.credentials));
|
|
17998
17999
|
}
|
|
@@ -18024,8 +18025,8 @@ class Firestore$1 {
|
|
|
18024
18025
|
* when the `Firestore` instance is terminated.
|
|
18025
18026
|
*/
|
|
18026
18027
|
return function __PRIVATE_removeComponents(e) {
|
|
18027
|
-
const t =
|
|
18028
|
-
t && (__PRIVATE_logDebug("ComponentProvider", "Removing Datastore"),
|
|
18028
|
+
const t = fe.get(e);
|
|
18029
|
+
t && (__PRIVATE_logDebug("ComponentProvider", "Removing Datastore"), fe.delete(e),
|
|
18029
18030
|
t.terminate());
|
|
18030
18031
|
}(this), Promise.resolve();
|
|
18031
18032
|
}
|
|
@@ -18057,7 +18058,7 @@ class Firestore$1 {
|
|
|
18057
18058
|
// invalid field "uid" and missing field "sub" / "user_id".)
|
|
18058
18059
|
t = util.createMockUserToken(r.mockUserToken, null === (i = e._app) || void 0 === i ? void 0 : i.options.projectId);
|
|
18059
18060
|
const s = r.mockUserToken.sub || r.mockUserToken.user_id;
|
|
18060
|
-
if (!s) throw new FirestoreError(
|
|
18061
|
+
if (!s) throw new FirestoreError(C.INVALID_ARGUMENT, "mockUserToken must contain 'sub' or 'user_id' field!");
|
|
18061
18062
|
n = new User(s);
|
|
18062
18063
|
}
|
|
18063
18064
|
e._authCredentials = new __PRIVATE_EmulatorAuthCredentialsProvider(new __PRIVATE_OAuthToken(t, n));
|
|
@@ -18177,7 +18178,7 @@ function collection(e, t, ...n) {
|
|
|
18177
18178
|
return __PRIVATE_validateCollectionPath(r), new CollectionReference(e, /* converter= */ null, r);
|
|
18178
18179
|
}
|
|
18179
18180
|
{
|
|
18180
|
-
if (!(e instanceof DocumentReference || e instanceof CollectionReference)) throw new FirestoreError(
|
|
18181
|
+
if (!(e instanceof DocumentReference || e instanceof CollectionReference)) throw new FirestoreError(C.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
18181
18182
|
const r = e._path.child(ResourcePath.fromString(t, ...n));
|
|
18182
18183
|
return __PRIVATE_validateCollectionPath(r), new CollectionReference(e.firestore,
|
|
18183
18184
|
/* converter= */ null, r);
|
|
@@ -18198,7 +18199,7 @@ function collection(e, t, ...n) {
|
|
|
18198
18199
|
* @returns The created `Query`.
|
|
18199
18200
|
*/ function collectionGroup(e, t) {
|
|
18200
18201
|
if (e = __PRIVATE_cast(e, Firestore$1), __PRIVATE_validateNonEmptyArgument("collectionGroup", "collection id", t),
|
|
18201
|
-
t.indexOf("/") >= 0) throw new FirestoreError(
|
|
18202
|
+
t.indexOf("/") >= 0) throw new FirestoreError(C.INVALID_ARGUMENT, `Invalid collection ID '${t}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
|
|
18202
18203
|
return new Query(e,
|
|
18203
18204
|
/* converter= */ null, function __PRIVATE_newQueryForCollectionGroup(e) {
|
|
18204
18205
|
return new __PRIVATE_QueryImpl(ResourcePath.emptyPath(), e);
|
|
@@ -18216,7 +18217,7 @@ function doc(e, t, ...n) {
|
|
|
18216
18217
|
/* converter= */ null, new DocumentKey(r));
|
|
18217
18218
|
}
|
|
18218
18219
|
{
|
|
18219
|
-
if (!(e instanceof DocumentReference || e instanceof CollectionReference)) throw new FirestoreError(
|
|
18220
|
+
if (!(e instanceof DocumentReference || e instanceof CollectionReference)) throw new FirestoreError(C.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
18220
18221
|
const r = e._path.child(ResourcePath.fromString(t, ...n));
|
|
18221
18222
|
return __PRIVATE_validateDocumentPath(r), new DocumentReference(e.firestore, e instanceof CollectionReference ? e.converter : null, new DocumentKey(r));
|
|
18222
18223
|
}
|
|
@@ -18576,7 +18577,7 @@ class LoadBundleTask {
|
|
|
18576
18577
|
* Constant used to indicate the LRU garbage collection should be disabled.
|
|
18577
18578
|
* Set this value as the `cacheSizeBytes` on the settings passed to the
|
|
18578
18579
|
* {@link Firestore} instance.
|
|
18579
|
-
*/ const
|
|
18580
|
+
*/ const ge = -1;
|
|
18580
18581
|
|
|
18581
18582
|
/**
|
|
18582
18583
|
* The Cloud Firestore service interface.
|
|
@@ -18620,10 +18621,10 @@ class LoadBundleTask {
|
|
|
18620
18621
|
identifier: n
|
|
18621
18622
|
}), i = r.getOptions(n);
|
|
18622
18623
|
if (util.deepEqual(i, t)) return e;
|
|
18623
|
-
throw new FirestoreError(
|
|
18624
|
+
throw new FirestoreError(C.FAILED_PRECONDITION, "initializeFirestore() has already been called with different options. To avoid this error, call initializeFirestore() with the same options as when it was originally called, or call getFirestore() to return the already initialized instance.");
|
|
18624
18625
|
}
|
|
18625
|
-
if (void 0 !== t.cacheSizeBytes && void 0 !== t.localCache) throw new FirestoreError(
|
|
18626
|
-
if (void 0 !== t.cacheSizeBytes && -1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new FirestoreError(
|
|
18626
|
+
if (void 0 !== t.cacheSizeBytes && void 0 !== t.localCache) throw new FirestoreError(C.INVALID_ARGUMENT, "cache and cacheSizeBytes cannot be specified at the same time as cacheSizeBytes willbe deprecated. Instead, specify the cache size in the cache object");
|
|
18627
|
+
if (void 0 !== t.cacheSizeBytes && -1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new FirestoreError(C.INVALID_ARGUMENT, "cacheSizeBytes must be at least 1048576");
|
|
18627
18628
|
return r.initialize({
|
|
18628
18629
|
options: t,
|
|
18629
18630
|
instanceIdentifier: n
|
|
@@ -18692,7 +18693,7 @@ function __PRIVATE_configureFirestore(e) {
|
|
|
18692
18693
|
*/ function enableIndexedDbPersistence(e, t) {
|
|
18693
18694
|
__PRIVATE_verifyNotInitialized(e = __PRIVATE_cast(e, Firestore));
|
|
18694
18695
|
const n = ensureFirestoreConfigured(e);
|
|
18695
|
-
if (n._uninitializedComponentsProvider) throw new FirestoreError(
|
|
18696
|
+
if (n._uninitializedComponentsProvider) throw new FirestoreError(C.FAILED_PRECONDITION, "SDK cache is already specified.");
|
|
18696
18697
|
__PRIVATE_logWarn("enableIndexedDbPersistence() will be deprecated in the future, you can use `FirestoreSettings.cache` instead.");
|
|
18697
18698
|
const r = e._freezeSettings(), i = new OnlineComponentProvider;
|
|
18698
18699
|
return __PRIVATE_setPersistenceProviders(n, i, new __PRIVATE_IndexedDbOfflineComponentProvider(i, r.cacheSizeBytes, null == t ? void 0 : t.forceOwnership));
|
|
@@ -18726,7 +18727,7 @@ function __PRIVATE_configureFirestore(e) {
|
|
|
18726
18727
|
*/ function enableMultiTabIndexedDbPersistence(e) {
|
|
18727
18728
|
__PRIVATE_verifyNotInitialized(e = __PRIVATE_cast(e, Firestore));
|
|
18728
18729
|
const t = ensureFirestoreConfigured(e);
|
|
18729
|
-
if (t._uninitializedComponentsProvider) throw new FirestoreError(
|
|
18730
|
+
if (t._uninitializedComponentsProvider) throw new FirestoreError(C.FAILED_PRECONDITION, "SDK cache is already specified.");
|
|
18730
18731
|
__PRIVATE_logWarn("enableMultiTabIndexedDbPersistence() will be deprecated in the future, you can use `FirestoreSettings.cache` instead.");
|
|
18731
18732
|
const n = e._freezeSettings(), r = new OnlineComponentProvider;
|
|
18732
18733
|
return __PRIVATE_setPersistenceProviders(t, r, new __PRIVATE_MultiTabOfflineComponentProvider(r, n.cacheSizeBytes));
|
|
@@ -18774,7 +18775,7 @@ function __PRIVATE_configureFirestore(e) {
|
|
|
18774
18775
|
* @returns A `Promise` that is resolved when the persistent storage is
|
|
18775
18776
|
* cleared. Otherwise, the promise is rejected with an error.
|
|
18776
18777
|
*/ function clearIndexedDbPersistence(e) {
|
|
18777
|
-
if (e._initialized && !e._terminated) throw new FirestoreError(
|
|
18778
|
+
if (e._initialized && !e._terminated) throw new FirestoreError(C.FAILED_PRECONDITION, "Persistence can only be cleared before a Firestore instance is initialized or after it is terminated.");
|
|
18778
18779
|
const t = new __PRIVATE_Deferred;
|
|
18779
18780
|
return e._queue.enqueueAndForgetEvenWhileRestricted((async () => {
|
|
18780
18781
|
try {
|
|
@@ -18888,7 +18889,7 @@ function __PRIVATE_configureFirestore(e) {
|
|
|
18888
18889
|
}
|
|
18889
18890
|
|
|
18890
18891
|
function __PRIVATE_verifyNotInitialized(e) {
|
|
18891
|
-
if (e._initialized || e._terminated) throw new FirestoreError(
|
|
18892
|
+
if (e._initialized || e._terminated) throw new FirestoreError(C.FAILED_PRECONDITION, "Firestore has already been started and persistence can no longer be enabled. You can only enable persistence before calling any other methods on a Firestore object.");
|
|
18892
18893
|
}
|
|
18893
18894
|
|
|
18894
18895
|
/**
|
|
@@ -18997,7 +18998,7 @@ class AggregateField {
|
|
|
18997
18998
|
try {
|
|
18998
18999
|
return new Bytes(ByteString.fromBase64String(e));
|
|
18999
19000
|
} catch (e) {
|
|
19000
|
-
throw new FirestoreError(
|
|
19001
|
+
throw new FirestoreError(C.INVALID_ARGUMENT, "Failed to construct data from Base64 string: " + e);
|
|
19001
19002
|
}
|
|
19002
19003
|
}
|
|
19003
19004
|
/**
|
|
@@ -19069,7 +19070,7 @@ class AggregateField {
|
|
|
19069
19070
|
* @param fieldNames - A list of field names.
|
|
19070
19071
|
*/
|
|
19071
19072
|
constructor(...e) {
|
|
19072
|
-
for (let t = 0; t < e.length; ++t) if (0 === e[t].length) throw new FirestoreError(
|
|
19073
|
+
for (let t = 0; t < e.length; ++t) if (0 === e[t].length) throw new FirestoreError(C.INVALID_ARGUMENT, "Invalid field name at argument $(i + 1). Field names must not be empty.");
|
|
19073
19074
|
this._internalPath = new FieldPath$1(e);
|
|
19074
19075
|
}
|
|
19075
19076
|
/**
|
|
@@ -19148,8 +19149,8 @@ class AggregateField {
|
|
|
19148
19149
|
* @param longitude - The longitude as number between -180 and 180.
|
|
19149
19150
|
*/
|
|
19150
19151
|
constructor(e, t) {
|
|
19151
|
-
if (!isFinite(e) || e < -90 || e > 90) throw new FirestoreError(
|
|
19152
|
-
if (!isFinite(t) || t < -180 || t > 180) throw new FirestoreError(
|
|
19152
|
+
if (!isFinite(e) || e < -90 || e > 90) throw new FirestoreError(C.INVALID_ARGUMENT, "Latitude must be a number between -90 and 90, but was: " + e);
|
|
19153
|
+
if (!isFinite(t) || t < -180 || t > 180) throw new FirestoreError(C.INVALID_ARGUMENT, "Longitude must be a number between -180 and 180, but was: " + t);
|
|
19153
19154
|
this._lat = e, this._long = t;
|
|
19154
19155
|
}
|
|
19155
19156
|
/**
|
|
@@ -19199,7 +19200,7 @@ class AggregateField {
|
|
|
19199
19200
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19200
19201
|
* See the License for the specific language governing permissions and
|
|
19201
19202
|
* limitations under the License.
|
|
19202
|
-
*/ const
|
|
19203
|
+
*/ const pe = /^__.*__$/;
|
|
19203
19204
|
|
|
19204
19205
|
/** The result of parsing document data (e.g. for a setData call). */ class ParsedSetData {
|
|
19205
19206
|
constructor(e, t, n) {
|
|
@@ -19310,7 +19311,7 @@ function __PRIVATE_isWrite(e) {
|
|
|
19310
19311
|
}
|
|
19311
19312
|
Au(e) {
|
|
19312
19313
|
if (0 === e.length) throw this.mu("Document fields must not be empty");
|
|
19313
|
-
if (__PRIVATE_isWrite(this.Iu) &&
|
|
19314
|
+
if (__PRIVATE_isWrite(this.Iu) && pe.test(e)) throw this.mu('Document fields cannot begin and end with "__"');
|
|
19314
19315
|
}
|
|
19315
19316
|
}
|
|
19316
19317
|
|
|
@@ -19347,7 +19348,7 @@ function __PRIVATE_newUserDataReader(e) {
|
|
|
19347
19348
|
const e = [];
|
|
19348
19349
|
for (const r of s.mergeFields) {
|
|
19349
19350
|
const i = __PRIVATE_fieldPathFromArgument$1(t, r, n);
|
|
19350
|
-
if (!o.contains(i)) throw new FirestoreError(
|
|
19351
|
+
if (!o.contains(i)) throw new FirestoreError(C.INVALID_ARGUMENT, `Field '${i}' is specified in your field mask but missing from your input data.`);
|
|
19351
19352
|
__PRIVATE_fieldMaskContains(e, i) || e.push(i);
|
|
19352
19353
|
}
|
|
19353
19354
|
a = new FieldMask(e), u = o.fieldTransforms.filter((e => a.covers(e.field)));
|
|
@@ -19467,7 +19468,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
|
|
|
19467
19468
|
|
|
19468
19469
|
/** Parse update data from a list of field/value arguments. */ function __PRIVATE_parseUpdateVarargs(e, t, n, r, i, s) {
|
|
19469
19470
|
const o = e.pu(1 /* UserDataSource.Update */ , t, n), _ = [ __PRIVATE_fieldPathFromArgument$1(t, r, n) ], a = [ i ];
|
|
19470
|
-
if (s.length % 2 != 0) throw new FirestoreError(
|
|
19471
|
+
if (s.length % 2 != 0) throw new FirestoreError(C.INVALID_ARGUMENT, `Function ${t}() needs to be called with an even number of arguments that alternate between field names and values.`);
|
|
19471
19472
|
for (let e = 0; e < s.length; e += 2) _.push(__PRIVATE_fieldPathFromArgument$1(t, s[e])),
|
|
19472
19473
|
a.push(s[e + 1]);
|
|
19473
19474
|
const u = [], c = ObjectValue.empty();
|
|
@@ -19668,7 +19669,7 @@ function __PRIVATE_validatePlainObject(e, t, n) {
|
|
|
19668
19669
|
|
|
19669
19670
|
/**
|
|
19670
19671
|
* Matches any characters in a field path string that are reserved.
|
|
19671
|
-
*/ const
|
|
19672
|
+
*/ const ye = new RegExp("[~\\*/\\[\\]]");
|
|
19672
19673
|
|
|
19673
19674
|
/**
|
|
19674
19675
|
* Wraps fromDotSeparatedString with an error message about the method that
|
|
@@ -19679,7 +19680,7 @@ function __PRIVATE_validatePlainObject(e, t, n) {
|
|
|
19679
19680
|
* @param targetDoc - The document against which the field path will be
|
|
19680
19681
|
* evaluated.
|
|
19681
19682
|
*/ function __PRIVATE_fieldPathFromDotSeparatedString(e, t, n) {
|
|
19682
|
-
if (t.search(
|
|
19683
|
+
if (t.search(ye) >= 0) throw __PRIVATE_createError(`Invalid field path (${t}). Paths must not contain '~', '*', '/', '[', or ']'`, e,
|
|
19683
19684
|
/* hasConverter= */ !1,
|
|
19684
19685
|
/* path= */ void 0, n);
|
|
19685
19686
|
try {
|
|
@@ -19697,7 +19698,7 @@ function __PRIVATE_createError(e, t, n, r, i) {
|
|
|
19697
19698
|
n && (_ += " (via `toFirestore()`)"), _ += ". ";
|
|
19698
19699
|
let a = "";
|
|
19699
19700
|
return (s || o) && (a += " (found", s && (a += ` in field ${r}`), o && (a += ` in document ${i}`),
|
|
19700
|
-
a += ")"), new FirestoreError(
|
|
19701
|
+
a += ")"), new FirestoreError(C.INVALID_ARGUMENT, _ + e + a);
|
|
19701
19702
|
}
|
|
19702
19703
|
|
|
19703
19704
|
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function __PRIVATE_fieldMaskContains(e, t) {
|
|
@@ -19834,7 +19835,7 @@ function __PRIVATE_createError(e, t, n, r, i) {
|
|
|
19834
19835
|
* See the License for the specific language governing permissions and
|
|
19835
19836
|
* limitations under the License.
|
|
19836
19837
|
*/ function __PRIVATE_validateHasExplicitOrderByForLimitToLast(e) {
|
|
19837
|
-
if ("L" /* LimitType.Last */ === e.limitType && 0 === e.explicitOrderBy.length) throw new FirestoreError(
|
|
19838
|
+
if ("L" /* LimitType.Last */ === e.limitType && 0 === e.explicitOrderBy.length) throw new FirestoreError(C.UNIMPLEMENTED, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
19838
19839
|
}
|
|
19839
19840
|
|
|
19840
19841
|
/**
|
|
@@ -19855,7 +19856,7 @@ function query(e, t, ...n) {
|
|
|
19855
19856
|
let r = [];
|
|
19856
19857
|
t instanceof AppliableConstraint && r.push(t), r = r.concat(n), function __PRIVATE_validateQueryConstraintArray(e) {
|
|
19857
19858
|
const t = e.filter((e => e instanceof QueryCompositeFilterConstraint)).length, n = e.filter((e => e instanceof QueryFieldFilterConstraint)).length;
|
|
19858
|
-
if (t > 1 || t > 0 && n > 0) throw new FirestoreError(
|
|
19859
|
+
if (t > 1 || t > 0 && n > 0) throw new FirestoreError(C.INVALID_ARGUMENT, "InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.");
|
|
19859
19860
|
}
|
|
19860
19861
|
/**
|
|
19861
19862
|
* @license
|
|
@@ -19909,7 +19910,7 @@ function query(e, t, ...n) {
|
|
|
19909
19910
|
const t = __PRIVATE_newUserDataReader(e.firestore), n = function __PRIVATE_newQueryFilter(e, t, n, r, i, s, o) {
|
|
19910
19911
|
let _;
|
|
19911
19912
|
if (i.isKeyField()) {
|
|
19912
|
-
if ("array-contains" /* Operator.ARRAY_CONTAINS */ === s || "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ === s) throw new FirestoreError(
|
|
19913
|
+
if ("array-contains" /* Operator.ARRAY_CONTAINS */ === s || "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ === s) throw new FirestoreError(C.INVALID_ARGUMENT, `Invalid Query. You can't perform '${s}' queries on documentId().`);
|
|
19913
19914
|
if ("in" /* Operator.IN */ === s || "not-in" /* Operator.NOT_IN */ === s) {
|
|
19914
19915
|
__PRIVATE_validateDisjunctiveFilterElements(o, s);
|
|
19915
19916
|
const t = [];
|
|
@@ -20036,8 +20037,8 @@ function query(e, t, ...n) {
|
|
|
20036
20037
|
}
|
|
20037
20038
|
_apply(e) {
|
|
20038
20039
|
const t = function __PRIVATE_newQueryOrderBy(e, t, n) {
|
|
20039
|
-
if (null !== e.startAt) throw new FirestoreError(
|
|
20040
|
-
if (null !== e.endAt) throw new FirestoreError(
|
|
20040
|
+
if (null !== e.startAt) throw new FirestoreError(C.INVALID_ARGUMENT, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
|
|
20041
|
+
if (null !== e.endAt) throw new FirestoreError(C.INVALID_ARGUMENT, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
|
|
20041
20042
|
return new OrderBy(t, n);
|
|
20042
20043
|
}
|
|
20043
20044
|
/**
|
|
@@ -20195,7 +20196,7 @@ function endAt(...e) {
|
|
|
20195
20196
|
|
|
20196
20197
|
/** Helper function to create a bound from a document or fields */ function __PRIVATE_newQueryBoundFromDocOrFields(e, t, n, r) {
|
|
20197
20198
|
if (n[0] = util.getModularInstance(n[0]), n[0] instanceof DocumentSnapshot$1) return function __PRIVATE_newQueryBoundFromDocument(e, t, n, r, i) {
|
|
20198
|
-
if (!r) throw new FirestoreError(
|
|
20199
|
+
if (!r) throw new FirestoreError(C.NOT_FOUND, `Can't use a DocumentSnapshot that doesn't exist for ${n}().`);
|
|
20199
20200
|
const s = [];
|
|
20200
20201
|
// Because people expect to continue/end a query at the exact document
|
|
20201
20202
|
// provided, we need to use the implicit sort order rather than the explicit
|
|
@@ -20206,10 +20207,10 @@ function endAt(...e) {
|
|
|
20206
20207
|
// results.
|
|
20207
20208
|
for (const n of __PRIVATE_queryNormalizedOrderBy(e)) if (n.field.isKeyField()) s.push(__PRIVATE_refValue(t, r.key)); else {
|
|
20208
20209
|
const e = r.data.field(n.field);
|
|
20209
|
-
if (__PRIVATE_isServerTimestamp(e)) throw new FirestoreError(
|
|
20210
|
+
if (__PRIVATE_isServerTimestamp(e)) throw new FirestoreError(C.INVALID_ARGUMENT, 'Invalid query. You are trying to start or end a query using a document for which the field "' + n.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');
|
|
20210
20211
|
if (null === e) {
|
|
20211
20212
|
const e = n.field.canonicalString();
|
|
20212
|
-
throw new FirestoreError(
|
|
20213
|
+
throw new FirestoreError(C.INVALID_ARGUMENT, `Invalid query. You are trying to start or end a query using a document for which the field '${e}' (used as the orderBy) does not exist.`);
|
|
20213
20214
|
}
|
|
20214
20215
|
s.push(e);
|
|
20215
20216
|
}
|
|
@@ -20223,15 +20224,15 @@ function endAt(...e) {
|
|
|
20223
20224
|
return function __PRIVATE_newQueryBoundFromFields(e, t, n, r, i, s) {
|
|
20224
20225
|
// Use explicit order by's because it has to match the query the user made
|
|
20225
20226
|
const o = e.explicitOrderBy;
|
|
20226
|
-
if (i.length > o.length) throw new FirestoreError(
|
|
20227
|
+
if (i.length > o.length) throw new FirestoreError(C.INVALID_ARGUMENT, `Too many arguments provided to ${r}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);
|
|
20227
20228
|
const _ = [];
|
|
20228
20229
|
for (let s = 0; s < i.length; s++) {
|
|
20229
20230
|
const a = i[s];
|
|
20230
20231
|
if (o[s].field.isKeyField()) {
|
|
20231
|
-
if ("string" != typeof a) throw new FirestoreError(
|
|
20232
|
-
if (!__PRIVATE_isCollectionGroupQuery(e) && -1 !== a.indexOf("/")) throw new FirestoreError(
|
|
20232
|
+
if ("string" != typeof a) throw new FirestoreError(C.INVALID_ARGUMENT, `Invalid query. Expected a string for document ID in ${r}(), but got a ${typeof a}`);
|
|
20233
|
+
if (!__PRIVATE_isCollectionGroupQuery(e) && -1 !== a.indexOf("/")) throw new FirestoreError(C.INVALID_ARGUMENT, `Invalid query. When querying a collection and ordering by documentId(), the value passed to ${r}() must be a plain document ID, but '${a}' contains a slash.`);
|
|
20233
20234
|
const n = e.path.child(ResourcePath.fromString(a));
|
|
20234
|
-
if (!DocumentKey.isDocumentKey(n)) throw new FirestoreError(
|
|
20235
|
+
if (!DocumentKey.isDocumentKey(n)) throw new FirestoreError(C.INVALID_ARGUMENT, `Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${r}() must result in a valid document path, but '${n}' is not because it contains an odd number of segments.`);
|
|
20235
20236
|
const i = new DocumentKey(n);
|
|
20236
20237
|
_.push(__PRIVATE_refValue(t, i));
|
|
20237
20238
|
} else {
|
|
@@ -20251,21 +20252,21 @@ function endAt(...e) {
|
|
|
20251
20252
|
|
|
20252
20253
|
function __PRIVATE_parseDocumentIdValue(e, t, n) {
|
|
20253
20254
|
if ("string" == typeof (n = util.getModularInstance(n))) {
|
|
20254
|
-
if ("" === n) throw new FirestoreError(
|
|
20255
|
-
if (!__PRIVATE_isCollectionGroupQuery(t) && -1 !== n.indexOf("/")) throw new FirestoreError(
|
|
20255
|
+
if ("" === n) throw new FirestoreError(C.INVALID_ARGUMENT, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
|
|
20256
|
+
if (!__PRIVATE_isCollectionGroupQuery(t) && -1 !== n.indexOf("/")) throw new FirestoreError(C.INVALID_ARGUMENT, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);
|
|
20256
20257
|
const r = t.path.child(ResourcePath.fromString(n));
|
|
20257
|
-
if (!DocumentKey.isDocumentKey(r)) throw new FirestoreError(
|
|
20258
|
+
if (!DocumentKey.isDocumentKey(r)) throw new FirestoreError(C.INVALID_ARGUMENT, `Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);
|
|
20258
20259
|
return __PRIVATE_refValue(e, new DocumentKey(r));
|
|
20259
20260
|
}
|
|
20260
20261
|
if (n instanceof DocumentReference) return __PRIVATE_refValue(e, n._key);
|
|
20261
|
-
throw new FirestoreError(
|
|
20262
|
+
throw new FirestoreError(C.INVALID_ARGUMENT, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${__PRIVATE_valueDescription(n)}.`);
|
|
20262
20263
|
}
|
|
20263
20264
|
|
|
20264
20265
|
/**
|
|
20265
20266
|
* Validates that the value passed into a disjunctive filter satisfies all
|
|
20266
20267
|
* array requirements.
|
|
20267
20268
|
*/ function __PRIVATE_validateDisjunctiveFilterElements(e, t) {
|
|
20268
|
-
if (!Array.isArray(e) || 0 === e.length) throw new FirestoreError(
|
|
20269
|
+
if (!Array.isArray(e) || 0 === e.length) throw new FirestoreError(C.INVALID_ARGUMENT, `Invalid Query. A non-empty array is required for '${t.toString()}' filters.`);
|
|
20269
20270
|
}
|
|
20270
20271
|
|
|
20271
20272
|
/**
|
|
@@ -20299,11 +20300,11 @@ function __PRIVATE_parseDocumentIdValue(e, t, n) {
|
|
|
20299
20300
|
}(t.op));
|
|
20300
20301
|
if (null !== n)
|
|
20301
20302
|
// Special case when it's a duplicate op to give a slightly clearer error message.
|
|
20302
|
-
throw n === t.op ? new FirestoreError(
|
|
20303
|
+
throw n === t.op ? new FirestoreError(C.INVALID_ARGUMENT, `Invalid query. You cannot use more than one '${t.op.toString()}' filter.`) : new FirestoreError(C.INVALID_ARGUMENT, `Invalid query. You cannot use '${t.op.toString()}' filters with '${n.toString()}' filters.`);
|
|
20303
20304
|
}
|
|
20304
20305
|
|
|
20305
20306
|
function __PRIVATE_validateQueryFilterConstraint(e, t) {
|
|
20306
|
-
if (!(t instanceof QueryFieldFilterConstraint || t instanceof QueryCompositeFilterConstraint)) throw new FirestoreError(
|
|
20307
|
+
if (!(t instanceof QueryFieldFilterConstraint || t instanceof QueryCompositeFilterConstraint)) throw new FirestoreError(C.INVALID_ARGUMENT, `Function ${e}() requires AppliableConstraints created with a call to 'where(...)', 'or(...)', or 'and(...)'.`);
|
|
20307
20308
|
}
|
|
20308
20309
|
|
|
20309
20310
|
class AbstractUserDataWriter {
|
|
@@ -20675,7 +20676,7 @@ class __PRIVATE_LiteUserDataWriter extends AbstractUserDataWriter {
|
|
|
20675
20676
|
* snapshot events.
|
|
20676
20677
|
*/ docChanges(e = {}) {
|
|
20677
20678
|
const t = !!e.includeMetadataChanges;
|
|
20678
|
-
if (t && this._snapshot.excludesMetadataChanges) throw new FirestoreError(
|
|
20679
|
+
if (t && this._snapshot.excludesMetadataChanges) throw new FirestoreError(C.INVALID_ARGUMENT, "To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");
|
|
20679
20680
|
return this._cachedChanges && this._cachedChangesIncludeMetadataChanges === t || (this._cachedChanges =
|
|
20680
20681
|
/** Calculates the array of `DocumentChange`s for a given `ViewSnapshot`. */
|
|
20681
20682
|
function __PRIVATE_changesFromSnapshot(e, t) {
|
|
@@ -21231,7 +21232,7 @@ class __PRIVATE_MultiTabManagerImpl {
|
|
|
21231
21232
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21232
21233
|
* See the License for the specific language governing permissions and
|
|
21233
21234
|
* limitations under the License.
|
|
21234
|
-
*/ const
|
|
21235
|
+
*/ const we = {
|
|
21235
21236
|
maxAttempts: 5
|
|
21236
21237
|
};
|
|
21237
21238
|
|
|
@@ -21305,12 +21306,12 @@ class WriteBatch {
|
|
|
21305
21306
|
return this._verifyNotCommitted(), this._committed = !0, this._mutations.length > 0 ? this._commitHandler(this._mutations) : Promise.resolve();
|
|
21306
21307
|
}
|
|
21307
21308
|
_verifyNotCommitted() {
|
|
21308
|
-
if (this._committed) throw new FirestoreError(
|
|
21309
|
+
if (this._committed) throw new FirestoreError(C.FAILED_PRECONDITION, "A write batch can no longer be used after commit() has been called.");
|
|
21309
21310
|
}
|
|
21310
21311
|
}
|
|
21311
21312
|
|
|
21312
21313
|
function __PRIVATE_validateReference(e, t) {
|
|
21313
|
-
if ((e = util.getModularInstance(e)).firestore !== t) throw new FirestoreError(
|
|
21314
|
+
if ((e = util.getModularInstance(e)).firestore !== t) throw new FirestoreError(C.INVALID_ARGUMENT, "Provided document reference is from a different Firestore instance.");
|
|
21314
21315
|
return e;
|
|
21315
21316
|
}
|
|
21316
21317
|
|
|
@@ -21443,9 +21444,9 @@ class Transaction extends class Transaction$1 {
|
|
|
21443
21444
|
* rejected promise with the corresponding failure error is returned.
|
|
21444
21445
|
*/ function runTransaction(e, t, n) {
|
|
21445
21446
|
e = __PRIVATE_cast(e, Firestore);
|
|
21446
|
-
const r = Object.assign(Object.assign({},
|
|
21447
|
+
const r = Object.assign(Object.assign({}, we), n);
|
|
21447
21448
|
!function __PRIVATE_validateTransactionOptions(e) {
|
|
21448
|
-
if (e.maxAttempts < 1) throw new FirestoreError(
|
|
21449
|
+
if (e.maxAttempts < 1) throw new FirestoreError(C.INVALID_ARGUMENT, "Max attempts must be at least 1");
|
|
21449
21450
|
}(r);
|
|
21450
21451
|
return function __PRIVATE_firestoreClientTransaction(e, t, n) {
|
|
21451
21452
|
const r = new __PRIVATE_Deferred;
|
|
@@ -21599,7 +21600,7 @@ class Transaction extends class Transaction$1 {
|
|
|
21599
21600
|
try {
|
|
21600
21601
|
return JSON.parse(e);
|
|
21601
21602
|
} catch (e) {
|
|
21602
|
-
throw new FirestoreError(
|
|
21603
|
+
throw new FirestoreError(C.INVALID_ARGUMENT, "Failed to parse JSON: " + (null == e ? void 0 : e.message));
|
|
21603
21604
|
}
|
|
21604
21605
|
}(e) : e, n = [];
|
|
21605
21606
|
if (Array.isArray(t.indexes)) for (const e of t.indexes) {
|
|
@@ -21616,7 +21617,7 @@ class Transaction extends class Transaction$1 {
|
|
|
21616
21617
|
}
|
|
21617
21618
|
|
|
21618
21619
|
function __PRIVATE_tryGetString(e, t) {
|
|
21619
|
-
if ("string" != typeof e[t]) throw new FirestoreError(
|
|
21620
|
+
if ("string" != typeof e[t]) throw new FirestoreError(C.INVALID_ARGUMENT, "Missing string value for: " + t);
|
|
21620
21621
|
return e[t];
|
|
21621
21622
|
}
|
|
21622
21623
|
|
|
@@ -21659,12 +21660,12 @@ function __PRIVATE_tryGetString(e, t) {
|
|
|
21659
21660
|
*/ function getPersistentCacheIndexManager(e) {
|
|
21660
21661
|
var t;
|
|
21661
21662
|
e = __PRIVATE_cast(e, Firestore);
|
|
21662
|
-
const n =
|
|
21663
|
+
const n = Se.get(e);
|
|
21663
21664
|
if (n) return n;
|
|
21664
21665
|
const r = ensureFirestoreConfigured(e);
|
|
21665
21666
|
if ("persistent" !== (null === (t = r._uninitializedComponentsProvider) || void 0 === t ? void 0 : t._offlineKind)) return null;
|
|
21666
21667
|
const i = new PersistentCacheIndexManager(r);
|
|
21667
|
-
return
|
|
21668
|
+
return Se.set(e, i), i;
|
|
21668
21669
|
}
|
|
21669
21670
|
|
|
21670
21671
|
/**
|
|
@@ -21707,7 +21708,7 @@ function __PRIVATE_setPersistentCacheIndexAutoCreationEnabled(e, t) {
|
|
|
21707
21708
|
* Use a `WeakMap` so that the mapping will be automatically dropped when the
|
|
21708
21709
|
* `Firestore` instance is garbage collected. This emulates a private member
|
|
21709
21710
|
* as described in https://goo.gle/454yvug.
|
|
21710
|
-
*/ const
|
|
21711
|
+
*/ const Se = new WeakMap;
|
|
21711
21712
|
|
|
21712
21713
|
/**
|
|
21713
21714
|
* @license
|
|
@@ -21760,10 +21761,10 @@ function __PRIVATE_setPersistentCacheIndexAutoCreationEnabled(e, t) {
|
|
|
21760
21761
|
this.Su = new Map;
|
|
21761
21762
|
}
|
|
21762
21763
|
static get instance() {
|
|
21763
|
-
return
|
|
21764
|
-
if (
|
|
21765
|
-
|
|
21766
|
-
}(
|
|
21764
|
+
return be || (be = new __PRIVATE_TestingHooksSpiImpl, function __PRIVATE_setTestingHooksSpi(e) {
|
|
21765
|
+
if (le) throw new Error("a TestingHooksSpi instance is already set");
|
|
21766
|
+
le = e;
|
|
21767
|
+
}(be)), be;
|
|
21767
21768
|
}
|
|
21768
21769
|
tt(e) {
|
|
21769
21770
|
this.Su.forEach((t => t(e)));
|
|
@@ -21774,7 +21775,7 @@ function __PRIVATE_setPersistentCacheIndexAutoCreationEnabled(e, t) {
|
|
|
21774
21775
|
}
|
|
21775
21776
|
}
|
|
21776
21777
|
|
|
21777
|
-
let
|
|
21778
|
+
let be = null;
|
|
21778
21779
|
|
|
21779
21780
|
/**
|
|
21780
21781
|
* Cloud Firestore
|
|
@@ -21782,25 +21783,25 @@ let Se = null;
|
|
|
21782
21783
|
* @packageDocumentation
|
|
21783
21784
|
*/ !function __PRIVATE_registerFirestore(e, t = !0) {
|
|
21784
21785
|
!function __PRIVATE_setSDKVersion(e) {
|
|
21785
|
-
|
|
21786
|
+
b = e;
|
|
21786
21787
|
}(app.SDK_VERSION), app._registerComponent(new component.Component("firestore", ((e, {instanceIdentifier: n, options: r}) => {
|
|
21787
21788
|
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) {
|
|
21788
|
-
if (!Object.prototype.hasOwnProperty.apply(e.options, [ "projectId" ])) throw new FirestoreError(
|
|
21789
|
+
if (!Object.prototype.hasOwnProperty.apply(e.options, [ "projectId" ])) throw new FirestoreError(C.INVALID_ARGUMENT, '"projectId" not provided in firebase.initializeApp.');
|
|
21789
21790
|
return new DatabaseId(e.options.projectId, t);
|
|
21790
21791
|
}(i, n), i);
|
|
21791
21792
|
return r = Object.assign({
|
|
21792
21793
|
useFetchStreams: t
|
|
21793
21794
|
}, r), s._setSettings(r), s;
|
|
21794
|
-
}), "PUBLIC").setMultipleInstances(!0)), app.registerVersion(
|
|
21795
|
+
}), "PUBLIC").setMultipleInstances(!0)), app.registerVersion(S, "4.3.2-20231027003707", e),
|
|
21795
21796
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
|
21796
|
-
app.registerVersion(
|
|
21797
|
+
app.registerVersion(S, "4.3.2-20231027003707", "cjs2017");
|
|
21797
21798
|
}();
|
|
21798
21799
|
|
|
21799
21800
|
exports.AbstractUserDataWriter = AbstractUserDataWriter;
|
|
21800
21801
|
exports.AggregateField = AggregateField;
|
|
21801
21802
|
exports.AggregateQuerySnapshot = AggregateQuerySnapshot;
|
|
21802
21803
|
exports.Bytes = Bytes;
|
|
21803
|
-
exports.CACHE_SIZE_UNLIMITED =
|
|
21804
|
+
exports.CACHE_SIZE_UNLIMITED = ge;
|
|
21804
21805
|
exports.CollectionReference = CollectionReference;
|
|
21805
21806
|
exports.DocumentReference = DocumentReference;
|
|
21806
21807
|
exports.DocumentSnapshot = DocumentSnapshot;
|