@firebase/firestore 4.1.1-canary.cc77a2a19 → 4.1.2-20230822180558
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +290 -290
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm2017.js +291 -291
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +3025 -3025
- 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 +296 -296
- package/dist/index.rn.js.map +1 -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/packages/firestore/dist/index.esm2017.d.ts +2 -2
- package/package.json +9 -9
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 w = "@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 S = "10.3.0-20230822180558";
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* @license
|
|
@@ -88,11 +88,11 @@ let b = "10.2.0-canary.cc77a2a19";
|
|
|
88
88
|
* See the License for the specific language governing permissions and
|
|
89
89
|
* limitations under the License.
|
|
90
90
|
*/
|
|
91
|
-
const
|
|
91
|
+
const b = 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 b.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
|
+
b.setLogLevel(e);
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
function __PRIVATE_logDebug(e, ...t) {
|
|
115
|
-
if (
|
|
115
|
+
if (b.logLevel <= logger.LogLevel.DEBUG) {
|
|
116
116
|
const n = t.map(__PRIVATE_argToString);
|
|
117
|
-
|
|
117
|
+
b.debug(`Firestore (${S}): ${e}`, ...n);
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
function __PRIVATE_logError(e, ...t) {
|
|
122
|
-
if (
|
|
122
|
+
if (b.logLevel <= logger.LogLevel.ERROR) {
|
|
123
123
|
const n = t.map(__PRIVATE_argToString);
|
|
124
|
-
|
|
124
|
+
b.error(`Firestore (${S}): ${e}`, ...n);
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
/**
|
|
129
129
|
* @internal
|
|
130
130
|
*/ function __PRIVATE_logWarn(e, ...t) {
|
|
131
|
-
if (
|
|
131
|
+
if (b.logLevel <= logger.LogLevel.WARN) {
|
|
132
132
|
const n = t.map(__PRIVATE_argToString);
|
|
133
|
-
|
|
133
|
+
b.warn(`Firestore (${S}): ${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 (${S}) 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 D = {
|
|
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. */
|
|
@@ -783,11 +783,11 @@ class Timestamp {
|
|
|
783
783
|
* The fractions of a second at nanosecond resolution.*
|
|
784
784
|
*/
|
|
785
785
|
t) {
|
|
786
|
-
if (this.seconds = e, this.nanoseconds = t, t < 0) throw new FirestoreError(
|
|
787
|
-
if (t >= 1e9) throw new FirestoreError(
|
|
788
|
-
if (e < -62135596800) throw new FirestoreError(
|
|
786
|
+
if (this.seconds = e, this.nanoseconds = t, t < 0) throw new FirestoreError(D.INVALID_ARGUMENT, "Timestamp nanoseconds out of range: " + t);
|
|
787
|
+
if (t >= 1e9) throw new FirestoreError(D.INVALID_ARGUMENT, "Timestamp nanoseconds out of range: " + t);
|
|
788
|
+
if (e < -62135596800) throw new FirestoreError(D.INVALID_ARGUMENT, "Timestamp seconds out of range: " + e);
|
|
789
789
|
// This will break in the year 10,000.
|
|
790
|
-
if (e >= 253402300800) throw new FirestoreError(
|
|
790
|
+
if (e >= 253402300800) throw new FirestoreError(D.INVALID_ARGUMENT, "Timestamp seconds out of range: " + e);
|
|
791
791
|
}
|
|
792
792
|
/**
|
|
793
793
|
* Creates a new timestamp with the current date, with millisecond precision.
|
|
@@ -1035,7 +1035,7 @@ class BasePath {
|
|
|
1035
1035
|
// for legacy reasons and should not be used frequently).
|
|
1036
1036
|
const t = [];
|
|
1037
1037
|
for (const n of e) {
|
|
1038
|
-
if (n.indexOf("//") >= 0) throw new FirestoreError(
|
|
1038
|
+
if (n.indexOf("//") >= 0) throw new FirestoreError(D.INVALID_ARGUMENT, `Invalid segment (${n}). Paths must not contain // in them.`);
|
|
1039
1039
|
// Strip leading and traling slashed.
|
|
1040
1040
|
t.push(...n.split("/").filter((e => e.length > 0)));
|
|
1041
1041
|
}
|
|
@@ -1046,7 +1046,7 @@ class BasePath {
|
|
|
1046
1046
|
}
|
|
1047
1047
|
}
|
|
1048
1048
|
|
|
1049
|
-
const
|
|
1049
|
+
const v = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
1050
1050
|
|
|
1051
1051
|
/**
|
|
1052
1052
|
* A dot-separated path for navigating sub-objects within a document.
|
|
@@ -1059,7 +1059,7 @@ const C = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
|
1059
1059
|
* Returns true if the string could be used as a segment in a field path
|
|
1060
1060
|
* without escaping.
|
|
1061
1061
|
*/ static isValidIdentifier(e) {
|
|
1062
|
-
return
|
|
1062
|
+
return v.test(e);
|
|
1063
1063
|
}
|
|
1064
1064
|
canonicalString() {
|
|
1065
1065
|
return this.toArray().map((e => (e = e.replace(/\\/g, "\\\\").replace(/`/g, "\\`"),
|
|
@@ -1091,21 +1091,21 @@ const C = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
|
1091
1091
|
const t = [];
|
|
1092
1092
|
let n = "", r = 0;
|
|
1093
1093
|
const __PRIVATE_addCurrentSegment = () => {
|
|
1094
|
-
if (0 === n.length) throw new FirestoreError(
|
|
1094
|
+
if (0 === n.length) throw new FirestoreError(D.INVALID_ARGUMENT, `Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);
|
|
1095
1095
|
t.push(n), n = "";
|
|
1096
1096
|
};
|
|
1097
1097
|
let i = !1;
|
|
1098
1098
|
for (;r < e.length; ) {
|
|
1099
1099
|
const t = e[r];
|
|
1100
1100
|
if ("\\" === t) {
|
|
1101
|
-
if (r + 1 === e.length) throw new FirestoreError(
|
|
1101
|
+
if (r + 1 === e.length) throw new FirestoreError(D.INVALID_ARGUMENT, "Path has trailing escape character: " + e);
|
|
1102
1102
|
const t = e[r + 1];
|
|
1103
|
-
if ("\\" !== t && "." !== t && "`" !== t) throw new FirestoreError(
|
|
1103
|
+
if ("\\" !== t && "." !== t && "`" !== t) throw new FirestoreError(D.INVALID_ARGUMENT, "Path has invalid escape sequence: " + e);
|
|
1104
1104
|
n += t, r += 2;
|
|
1105
1105
|
} else "`" === t ? (i = !i, r++) : "." !== t || i ? (n += t, r++) : (__PRIVATE_addCurrentSegment(),
|
|
1106
1106
|
r++);
|
|
1107
1107
|
}
|
|
1108
|
-
if (__PRIVATE_addCurrentSegment(), i) throw new FirestoreError(
|
|
1108
|
+
if (__PRIVATE_addCurrentSegment(), i) throw new FirestoreError(D.INVALID_ARGUMENT, "Unterminated ` in path: " + e);
|
|
1109
1109
|
return new FieldPath$1(t);
|
|
1110
1110
|
}
|
|
1111
1111
|
static emptyPath() {
|
|
@@ -1357,7 +1357,7 @@ function __PRIVATE_indexOffsetComparator(e, t) {
|
|
|
1357
1357
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1358
1358
|
* See the License for the specific language governing permissions and
|
|
1359
1359
|
* limitations under the License.
|
|
1360
|
-
*/ const
|
|
1360
|
+
*/ const C = "The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";
|
|
1361
1361
|
|
|
1362
1362
|
/**
|
|
1363
1363
|
* A base class representing a persistence transaction, encapsulating both the
|
|
@@ -1404,7 +1404,7 @@ function __PRIVATE_indexOffsetComparator(e, t) {
|
|
|
1404
1404
|
* @param err - An error returned by a LocalStore operation.
|
|
1405
1405
|
* @returns A Promise that resolves after we recovered, or the original error.
|
|
1406
1406
|
*/ async function __PRIVATE_ignoreIfPrimaryLeaseLoss(e) {
|
|
1407
|
-
if (e.code !==
|
|
1407
|
+
if (e.code !== D.FAILED_PRECONDITION || e.message !== C) throw e;
|
|
1408
1408
|
__PRIVATE_logDebug("LocalStore", "Unexpectedly lost primary lease");
|
|
1409
1409
|
}
|
|
1410
1410
|
|
|
@@ -1715,7 +1715,7 @@ class __PRIVATE_SimpleDbTransaction {
|
|
|
1715
1715
|
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."));
|
|
1716
1716
|
}, r.onerror = t => {
|
|
1717
1717
|
const r = t.target.error;
|
|
1718
|
-
"VersionError" === r.name ? n(new FirestoreError(
|
|
1718
|
+
"VersionError" === r.name ? n(new FirestoreError(D.FAILED_PRECONDITION, "A newer version of the Firestore SDK was previously used and so the persisted data is not compatible with the version of the SDK you are now using. The SDK will operate with persistence disabled. If you need persistence, please re-upgrade to a newer version of the SDK or else clear the persisted IndexedDB data for your app to start fresh.")) : "InvalidStateError" === r.name ? n(new FirestoreError(D.FAILED_PRECONDITION, "Unable to open an IndexedDB connection. This could be due to running in a private browsing session on a browser whose private browsing sessions do not support IndexedDB: " + r)) : n(new __PRIVATE_IndexedDbTransactionError(e, r));
|
|
1719
1719
|
}, r.onupgradeneeded = e => {
|
|
1720
1720
|
__PRIVATE_logDebug("SimpleDb", 'Database "' + this.name + '" requires upgrade from version:', e.oldVersion);
|
|
1721
1721
|
const t = e.target.result;
|
|
@@ -1802,7 +1802,7 @@ class __PRIVATE_SimpleDbTransaction {
|
|
|
1802
1802
|
|
|
1803
1803
|
/** An error that wraps exceptions that thrown during IndexedDB execution. */ class __PRIVATE_IndexedDbTransactionError extends FirestoreError {
|
|
1804
1804
|
constructor(e, t) {
|
|
1805
|
-
super(
|
|
1805
|
+
super(D.UNAVAILABLE, `IndexedDB transaction '${e}' failed: ${t}`), this.name = "IndexedDbTransactionError";
|
|
1806
1806
|
}
|
|
1807
1807
|
}
|
|
1808
1808
|
|
|
@@ -1986,7 +1986,7 @@ class __PRIVATE_SimpleDbTransaction {
|
|
|
1986
1986
|
}
|
|
1987
1987
|
|
|
1988
1988
|
// Guard so we only report the error once.
|
|
1989
|
-
let
|
|
1989
|
+
let F = !1;
|
|
1990
1990
|
|
|
1991
1991
|
function __PRIVATE_checkForAndReportiOSError(e) {
|
|
1992
1992
|
const t = __PRIVATE_SimpleDb.D(util.getUA());
|
|
@@ -1995,7 +1995,7 @@ function __PRIVATE_checkForAndReportiOSError(e) {
|
|
|
1995
1995
|
if (e.message.indexOf(t) >= 0) {
|
|
1996
1996
|
// Wrap error in a more descriptive one.
|
|
1997
1997
|
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.`);
|
|
1998
|
-
return
|
|
1998
|
+
return F || (F = !0,
|
|
1999
1999
|
// Throw a global exception outside of this promise chain, for the user to
|
|
2000
2000
|
// potentially catch.
|
|
2001
2001
|
setTimeout((() => {
|
|
@@ -2247,7 +2247,7 @@ function __PRIVATE_encodeResourcePath(e) {
|
|
|
2247
2247
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2248
2248
|
* See the License for the specific language governing permissions and
|
|
2249
2249
|
* limitations under the License.
|
|
2250
|
-
*/ const
|
|
2250
|
+
*/ const M = [ "userId", "batchId" ];
|
|
2251
2251
|
|
|
2252
2252
|
/**
|
|
2253
2253
|
* @license
|
|
@@ -2292,7 +2292,7 @@ function __PRIVATE_newDbDocumentMutationPrefixForPath(e, t) {
|
|
|
2292
2292
|
* there is no useful information to store as the value. The raw (unencoded)
|
|
2293
2293
|
* path cannot be stored because IndexedDb doesn't store prototype
|
|
2294
2294
|
* information.
|
|
2295
|
-
*/ const
|
|
2295
|
+
*/ const x = {}, O = [ "prefixPath", "collectionGroup", "readTime", "documentId" ], N = [ "prefixPath", "collectionGroup", "documentId" ], B = [ "collectionGroup", "readTime", "prefixPath", "documentId" ], L = [ "canonicalId", "targetId" ], k = [ "targetId", "path" ], q = [ "path", "targetId" ], Q = [ "collectionId", "parent" ], K = [ "indexId", "uid" ], $ = [ "uid", "sequenceNumber" ], U = [ "indexId", "uid", "arrayValue", "directionalValue", "orderedDocumentKey", "documentKey" ], W = [ "indexId", "uid", "orderedDocumentKey" ], G = [ "userId", "collectionPath", "documentId" ], z = [ "userId", "collectionPath", "largestBatchId" ], j = [ "userId", "collectionGroup", "largestBatchId" ], H = [ ...[ ...[ ...[ ...[ "mutationQueues", "mutations", "documentMutations", "remoteDocuments", "targets", "owner", "targetGlobal", "targetDocuments" ], "clientMetadata" ], "remoteDocumentGlobal" ], "collectionParents" ], "bundles", "namedQueries" ], J = [ ...H, "documentOverlays" ], Y = [ "mutationQueues", "mutations", "documentMutations", "remoteDocumentsV14", "targets", "owner", "targetGlobal", "targetDocuments", "clientMetadata", "remoteDocumentGlobal", "collectionParents", "bundles", "namedQueries", "documentOverlays" ], Z = Y, X = [ ...Z, "indexConfiguration", "indexState", "indexEntries" ];
|
|
2296
2296
|
|
|
2297
2297
|
/**
|
|
2298
2298
|
* @license
|
|
@@ -3049,7 +3049,7 @@ function __PRIVATE_isBase64Available() {
|
|
|
3049
3049
|
|
|
3050
3050
|
ByteString.EMPTY_BYTE_STRING = new ByteString("");
|
|
3051
3051
|
|
|
3052
|
-
const
|
|
3052
|
+
const ee = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
3053
3053
|
|
|
3054
3054
|
/**
|
|
3055
3055
|
* Converts the possible Proto values for a timestamp value into a "seconds and
|
|
@@ -3063,7 +3063,7 @@ const te = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
3063
3063
|
// (millis), so we do some custom parsing here.
|
|
3064
3064
|
// Parse the nanos right out of the string.
|
|
3065
3065
|
let t = 0;
|
|
3066
|
-
const n =
|
|
3066
|
+
const n = ee.exec(e);
|
|
3067
3067
|
if (__PRIVATE_hardAssert(!!n), n[1]) {
|
|
3068
3068
|
// Pad the fraction out to 9 digits (nanos).
|
|
3069
3069
|
let e = n[1];
|
|
@@ -3230,7 +3230,7 @@ class DatabaseId {
|
|
|
3230
3230
|
* See the License for the specific language governing permissions and
|
|
3231
3231
|
* limitations under the License.
|
|
3232
3232
|
*/
|
|
3233
|
-
const
|
|
3233
|
+
const te = {
|
|
3234
3234
|
mapValue: {
|
|
3235
3235
|
fields: {
|
|
3236
3236
|
__type__: {
|
|
@@ -3238,7 +3238,7 @@ const ne = {
|
|
|
3238
3238
|
}
|
|
3239
3239
|
}
|
|
3240
3240
|
}
|
|
3241
|
-
},
|
|
3241
|
+
}, ne = {
|
|
3242
3242
|
nullValue: "NULL_VALUE"
|
|
3243
3243
|
};
|
|
3244
3244
|
|
|
@@ -3382,9 +3382,9 @@ function __PRIVATE_valueCompare(e, t) {
|
|
|
3382
3382
|
|
|
3383
3383
|
case 10 /* TypeOrder.ObjectValue */ :
|
|
3384
3384
|
return function __PRIVATE_compareMaps(e, t) {
|
|
3385
|
-
if (e ===
|
|
3386
|
-
if (e ===
|
|
3387
|
-
if (t ===
|
|
3385
|
+
if (e === te.mapValue && t === te.mapValue) return 0;
|
|
3386
|
+
if (e === te.mapValue) return 1;
|
|
3387
|
+
if (t === te.mapValue) return -1;
|
|
3388
3388
|
const n = e.fields || {}, r = Object.keys(n), i = t.fields || {}, s = Object.keys(i);
|
|
3389
3389
|
// Even though MapValues are likely sorted correctly based on their insertion
|
|
3390
3390
|
// order (e.g. when received from the backend), local modifications can bring
|
|
@@ -3560,7 +3560,7 @@ function isArray(e) {
|
|
|
3560
3560
|
}
|
|
3561
3561
|
|
|
3562
3562
|
/** Returns the lowest value for the given value type (inclusive). */ function __PRIVATE_valuesGetLowerBound(e) {
|
|
3563
|
-
return "nullValue" in e ?
|
|
3563
|
+
return "nullValue" in e ? ne : "booleanValue" in e ? {
|
|
3564
3564
|
booleanValue: !1
|
|
3565
3565
|
} : "integerValue" in e || "doubleValue" in e ? {
|
|
3566
3566
|
doubleValue: NaN
|
|
@@ -3606,7 +3606,7 @@ function isArray(e) {
|
|
|
3606
3606
|
arrayValue: {}
|
|
3607
3607
|
} : "arrayValue" in e ? {
|
|
3608
3608
|
mapValue: {}
|
|
3609
|
-
} : "mapValue" in e ?
|
|
3609
|
+
} : "mapValue" in e ? te : fail();
|
|
3610
3610
|
}
|
|
3611
3611
|
|
|
3612
3612
|
function __PRIVATE_lowerBoundCompare(e, t) {
|
|
@@ -4308,10 +4308,10 @@ function __PRIVATE_targetIsDocumentTarget(e) {
|
|
|
4308
4308
|
* the provided `fieldPath` (or the upper bound for an descending segment).
|
|
4309
4309
|
*/
|
|
4310
4310
|
function __PRIVATE_targetGetAscendingBound(e, t, n) {
|
|
4311
|
-
let r =
|
|
4311
|
+
let r = ne, i = !0;
|
|
4312
4312
|
// Process all filters to find a value for the current field segment
|
|
4313
4313
|
for (const n of __PRIVATE_targetGetFieldFiltersForPath(e, t)) {
|
|
4314
|
-
let e =
|
|
4314
|
+
let e = ne, t = !0;
|
|
4315
4315
|
switch (n.op) {
|
|
4316
4316
|
case "<" /* Operator.LESS_THAN */ :
|
|
4317
4317
|
case "<=" /* Operator.LESS_THAN_OR_EQUAL */ :
|
|
@@ -4330,7 +4330,7 @@ function __PRIVATE_targetGetAscendingBound(e, t, n) {
|
|
|
4330
4330
|
|
|
4331
4331
|
case "!=" /* Operator.NOT_EQUAL */ :
|
|
4332
4332
|
case "not-in" /* Operator.NOT_IN */ :
|
|
4333
|
-
e =
|
|
4333
|
+
e = ne;
|
|
4334
4334
|
// Remaining filters cannot be used as lower bounds.
|
|
4335
4335
|
}
|
|
4336
4336
|
__PRIVATE_lowerBoundCompare({
|
|
@@ -4366,10 +4366,10 @@ function __PRIVATE_targetGetAscendingBound(e, t, n) {
|
|
|
4366
4366
|
* Returns the value to use as the upper bound for ascending index segment at
|
|
4367
4367
|
* the provided `fieldPath` (or the lower bound for a descending segment).
|
|
4368
4368
|
*/ function __PRIVATE_targetGetDescendingBound(e, t, n) {
|
|
4369
|
-
let r =
|
|
4369
|
+
let r = te, i = !0;
|
|
4370
4370
|
// Process all filters to find a value for the current field segment
|
|
4371
4371
|
for (const n of __PRIVATE_targetGetFieldFiltersForPath(e, t)) {
|
|
4372
|
-
let e =
|
|
4372
|
+
let e = te, t = !0;
|
|
4373
4373
|
switch (n.op) {
|
|
4374
4374
|
case ">=" /* Operator.GREATER_THAN_OR_EQUAL */ :
|
|
4375
4375
|
case ">" /* Operator.GREATER_THAN */ :
|
|
@@ -4388,7 +4388,7 @@ function __PRIVATE_targetGetAscendingBound(e, t, n) {
|
|
|
4388
4388
|
|
|
4389
4389
|
case "!=" /* Operator.NOT_EQUAL */ :
|
|
4390
4390
|
case "not-in" /* Operator.NOT_IN */ :
|
|
4391
|
-
e =
|
|
4391
|
+
e = te;
|
|
4392
4392
|
// Remaining filters cannot be used as upper bounds.
|
|
4393
4393
|
}
|
|
4394
4394
|
__PRIVATE_upperBoundCompare({
|
|
@@ -4770,22 +4770,22 @@ function __PRIVATE_compareDocs(e, t, n) {
|
|
|
4770
4770
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4771
4771
|
* See the License for the specific language governing permissions and
|
|
4772
4772
|
* limitations under the License.
|
|
4773
|
-
*/ const
|
|
4773
|
+
*/ const re = new SortedMap(DocumentKey.comparator);
|
|
4774
4774
|
|
|
4775
4775
|
function __PRIVATE_mutableDocumentMap() {
|
|
4776
|
-
return
|
|
4776
|
+
return re;
|
|
4777
4777
|
}
|
|
4778
4778
|
|
|
4779
|
-
const
|
|
4779
|
+
const ie = new SortedMap(DocumentKey.comparator);
|
|
4780
4780
|
|
|
4781
4781
|
function documentMap(...e) {
|
|
4782
|
-
let t =
|
|
4782
|
+
let t = ie;
|
|
4783
4783
|
for (const n of e) t = t.insert(n.key, n);
|
|
4784
4784
|
return t;
|
|
4785
4785
|
}
|
|
4786
4786
|
|
|
4787
4787
|
function __PRIVATE_convertOverlayedDocumentMapToDocumentMap(e) {
|
|
4788
|
-
let t =
|
|
4788
|
+
let t = ie;
|
|
4789
4789
|
return e.forEach(((e, n) => t = t.insert(e, n.overlayedDocument))), t;
|
|
4790
4790
|
}
|
|
4791
4791
|
|
|
@@ -4801,20 +4801,20 @@ function __PRIVATE_newDocumentKeyMap() {
|
|
|
4801
4801
|
return new ObjectMap((e => e.toString()), ((e, t) => e.isEqual(t)));
|
|
4802
4802
|
}
|
|
4803
4803
|
|
|
4804
|
-
const
|
|
4804
|
+
const se = new SortedMap(DocumentKey.comparator);
|
|
4805
4805
|
|
|
4806
|
-
const
|
|
4806
|
+
const oe = new SortedSet(DocumentKey.comparator);
|
|
4807
4807
|
|
|
4808
4808
|
function __PRIVATE_documentKeySet(...e) {
|
|
4809
|
-
let t =
|
|
4809
|
+
let t = oe;
|
|
4810
4810
|
for (const n of e) t = t.add(n);
|
|
4811
4811
|
return t;
|
|
4812
4812
|
}
|
|
4813
4813
|
|
|
4814
|
-
const
|
|
4814
|
+
const _e = new SortedSet(__PRIVATE_primitiveComparator);
|
|
4815
4815
|
|
|
4816
4816
|
function __PRIVATE_targetIdSet() {
|
|
4817
|
-
return
|
|
4817
|
+
return _e;
|
|
4818
4818
|
}
|
|
4819
4819
|
|
|
4820
4820
|
/**
|
|
@@ -5505,7 +5505,7 @@ class __PRIVATE_VerifyMutation extends Mutation {
|
|
|
5505
5505
|
*/ static from(e, t, n) {
|
|
5506
5506
|
__PRIVATE_hardAssert(e.mutations.length === n.length);
|
|
5507
5507
|
let r = function __PRIVATE_documentVersionMap() {
|
|
5508
|
-
return
|
|
5508
|
+
return se;
|
|
5509
5509
|
}();
|
|
5510
5510
|
const i = e.mutations;
|
|
5511
5511
|
for (let e = 0; e < i.length; e++) r = r.insert(i[e].key, n[e].version);
|
|
@@ -5619,7 +5619,7 @@ class __PRIVATE_VerifyMutation extends Mutation {
|
|
|
5619
5619
|
* Important! The names of these identifiers matter because the string forms
|
|
5620
5620
|
* are used for reverse lookups from the webchannel stream. Do NOT change the
|
|
5621
5621
|
* names of these identifiers or change this into a const enum.
|
|
5622
|
-
*/ var
|
|
5622
|
+
*/ var ae, ue;
|
|
5623
5623
|
|
|
5624
5624
|
/**
|
|
5625
5625
|
* Determines whether an error code represents a permanent error when received
|
|
@@ -5632,29 +5632,29 @@ function __PRIVATE_isPermanentError(e) {
|
|
|
5632
5632
|
default:
|
|
5633
5633
|
return fail();
|
|
5634
5634
|
|
|
5635
|
-
case
|
|
5636
|
-
case
|
|
5637
|
-
case
|
|
5638
|
-
case
|
|
5639
|
-
case
|
|
5640
|
-
case
|
|
5635
|
+
case D.CANCELLED:
|
|
5636
|
+
case D.UNKNOWN:
|
|
5637
|
+
case D.DEADLINE_EXCEEDED:
|
|
5638
|
+
case D.RESOURCE_EXHAUSTED:
|
|
5639
|
+
case D.INTERNAL:
|
|
5640
|
+
case D.UNAVAILABLE:
|
|
5641
5641
|
// Unauthenticated means something went wrong with our token and we need
|
|
5642
5642
|
// to retry with new credentials which will happen automatically.
|
|
5643
|
-
case
|
|
5643
|
+
case D.UNAUTHENTICATED:
|
|
5644
5644
|
return !1;
|
|
5645
5645
|
|
|
5646
|
-
case
|
|
5647
|
-
case
|
|
5648
|
-
case
|
|
5649
|
-
case
|
|
5650
|
-
case
|
|
5646
|
+
case D.INVALID_ARGUMENT:
|
|
5647
|
+
case D.NOT_FOUND:
|
|
5648
|
+
case D.ALREADY_EXISTS:
|
|
5649
|
+
case D.PERMISSION_DENIED:
|
|
5650
|
+
case D.FAILED_PRECONDITION:
|
|
5651
5651
|
// Aborted might be retried in some scenarios, but that is dependant on
|
|
5652
5652
|
// the context and should handled individually by the calling code.
|
|
5653
5653
|
// See https://cloud.google.com/apis/design/errors.
|
|
5654
|
-
case
|
|
5655
|
-
case
|
|
5656
|
-
case
|
|
5657
|
-
case
|
|
5654
|
+
case D.ABORTED:
|
|
5655
|
+
case D.OUT_OF_RANGE:
|
|
5656
|
+
case D.UNIMPLEMENTED:
|
|
5657
|
+
case D.DATA_LOSS:
|
|
5658
5658
|
return !0;
|
|
5659
5659
|
}
|
|
5660
5660
|
}
|
|
@@ -5682,58 +5682,58 @@ function __PRIVATE_mapCodeFromRpcCode(e) {
|
|
|
5682
5682
|
if (void 0 === e)
|
|
5683
5683
|
// This shouldn't normally happen, but in certain error cases (like trying
|
|
5684
5684
|
// to send invalid proto messages) we may get an error with no GRPC code.
|
|
5685
|
-
return __PRIVATE_logError("GRPC error has no .code"),
|
|
5685
|
+
return __PRIVATE_logError("GRPC error has no .code"), D.UNKNOWN;
|
|
5686
5686
|
switch (e) {
|
|
5687
|
-
case
|
|
5688
|
-
return
|
|
5687
|
+
case ae.OK:
|
|
5688
|
+
return D.OK;
|
|
5689
5689
|
|
|
5690
|
-
case
|
|
5691
|
-
return
|
|
5690
|
+
case ae.CANCELLED:
|
|
5691
|
+
return D.CANCELLED;
|
|
5692
5692
|
|
|
5693
|
-
case
|
|
5694
|
-
return
|
|
5693
|
+
case ae.UNKNOWN:
|
|
5694
|
+
return D.UNKNOWN;
|
|
5695
5695
|
|
|
5696
|
-
case
|
|
5697
|
-
return
|
|
5696
|
+
case ae.DEADLINE_EXCEEDED:
|
|
5697
|
+
return D.DEADLINE_EXCEEDED;
|
|
5698
5698
|
|
|
5699
|
-
case
|
|
5700
|
-
return
|
|
5699
|
+
case ae.RESOURCE_EXHAUSTED:
|
|
5700
|
+
return D.RESOURCE_EXHAUSTED;
|
|
5701
5701
|
|
|
5702
|
-
case
|
|
5703
|
-
return
|
|
5702
|
+
case ae.INTERNAL:
|
|
5703
|
+
return D.INTERNAL;
|
|
5704
5704
|
|
|
5705
|
-
case
|
|
5706
|
-
return
|
|
5705
|
+
case ae.UNAVAILABLE:
|
|
5706
|
+
return D.UNAVAILABLE;
|
|
5707
5707
|
|
|
5708
|
-
case
|
|
5709
|
-
return
|
|
5708
|
+
case ae.UNAUTHENTICATED:
|
|
5709
|
+
return D.UNAUTHENTICATED;
|
|
5710
5710
|
|
|
5711
|
-
case
|
|
5712
|
-
return
|
|
5711
|
+
case ae.INVALID_ARGUMENT:
|
|
5712
|
+
return D.INVALID_ARGUMENT;
|
|
5713
5713
|
|
|
5714
|
-
case
|
|
5715
|
-
return
|
|
5714
|
+
case ae.NOT_FOUND:
|
|
5715
|
+
return D.NOT_FOUND;
|
|
5716
5716
|
|
|
5717
|
-
case
|
|
5718
|
-
return
|
|
5717
|
+
case ae.ALREADY_EXISTS:
|
|
5718
|
+
return D.ALREADY_EXISTS;
|
|
5719
5719
|
|
|
5720
|
-
case
|
|
5721
|
-
return
|
|
5720
|
+
case ae.PERMISSION_DENIED:
|
|
5721
|
+
return D.PERMISSION_DENIED;
|
|
5722
5722
|
|
|
5723
|
-
case
|
|
5724
|
-
return
|
|
5723
|
+
case ae.FAILED_PRECONDITION:
|
|
5724
|
+
return D.FAILED_PRECONDITION;
|
|
5725
5725
|
|
|
5726
|
-
case
|
|
5727
|
-
return
|
|
5726
|
+
case ae.ABORTED:
|
|
5727
|
+
return D.ABORTED;
|
|
5728
5728
|
|
|
5729
|
-
case
|
|
5730
|
-
return
|
|
5729
|
+
case ae.OUT_OF_RANGE:
|
|
5730
|
+
return D.OUT_OF_RANGE;
|
|
5731
5731
|
|
|
5732
|
-
case
|
|
5733
|
-
return
|
|
5732
|
+
case ae.UNIMPLEMENTED:
|
|
5733
|
+
return D.UNIMPLEMENTED;
|
|
5734
5734
|
|
|
5735
|
-
case
|
|
5736
|
-
return
|
|
5735
|
+
case ae.DATA_LOSS:
|
|
5736
|
+
return D.DATA_LOSS;
|
|
5737
5737
|
|
|
5738
5738
|
default:
|
|
5739
5739
|
return fail();
|
|
@@ -5747,14 +5747,14 @@ function __PRIVATE_mapCodeFromRpcCode(e) {
|
|
|
5747
5747
|
* "UNKNOWN", etc.)
|
|
5748
5748
|
* @returns The equivalent Code. Non-matching responses are mapped to
|
|
5749
5749
|
* Code.UNKNOWN.
|
|
5750
|
-
*/ (
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
|
|
5756
|
-
|
|
5757
|
-
|
|
5750
|
+
*/ (ue = ae || (ae = {}))[ue.OK = 0] = "OK", ue[ue.CANCELLED = 1] = "CANCELLED",
|
|
5751
|
+
ue[ue.UNKNOWN = 2] = "UNKNOWN", ue[ue.INVALID_ARGUMENT = 3] = "INVALID_ARGUMENT",
|
|
5752
|
+
ue[ue.DEADLINE_EXCEEDED = 4] = "DEADLINE_EXCEEDED", ue[ue.NOT_FOUND = 5] = "NOT_FOUND",
|
|
5753
|
+
ue[ue.ALREADY_EXISTS = 6] = "ALREADY_EXISTS", ue[ue.PERMISSION_DENIED = 7] = "PERMISSION_DENIED",
|
|
5754
|
+
ue[ue.UNAUTHENTICATED = 16] = "UNAUTHENTICATED", ue[ue.RESOURCE_EXHAUSTED = 8] = "RESOURCE_EXHAUSTED",
|
|
5755
|
+
ue[ue.FAILED_PRECONDITION = 9] = "FAILED_PRECONDITION", ue[ue.ABORTED = 10] = "ABORTED",
|
|
5756
|
+
ue[ue.OUT_OF_RANGE = 11] = "OUT_OF_RANGE", ue[ue.UNIMPLEMENTED = 12] = "UNIMPLEMENTED",
|
|
5757
|
+
ue[ue.INTERNAL = 13] = "INTERNAL", ue[ue.UNAVAILABLE = 14] = "UNAVAILABLE", ue[ue.DATA_LOSS = 15] = "DATA_LOSS";
|
|
5758
5758
|
|
|
5759
5759
|
/**
|
|
5760
5760
|
* @license
|
|
@@ -5779,7 +5779,7 @@ ce[ce.INTERNAL = 13] = "INTERNAL", ce[ce.UNAVAILABLE = 14] = "UNAVAILABLE", ce[c
|
|
|
5779
5779
|
* integration tests that have registered callbacks to be notified of events
|
|
5780
5780
|
* that happen during the test execution.
|
|
5781
5781
|
*/
|
|
5782
|
-
let
|
|
5782
|
+
let ce = null;
|
|
5783
5783
|
|
|
5784
5784
|
/**
|
|
5785
5785
|
* Sets the value of the `testingHooksSpi` object.
|
|
@@ -5827,7 +5827,7 @@ function __PRIVATE_newTextEncoder() {
|
|
|
5827
5827
|
* See the License for the specific language governing permissions and
|
|
5828
5828
|
* limitations under the License.
|
|
5829
5829
|
*/
|
|
5830
|
-
const
|
|
5830
|
+
const le = new webchannelWrapper.Integer([ 4294967295, 4294967295 ], 0);
|
|
5831
5831
|
|
|
5832
5832
|
// Hash a string using md5 hashing algorithm.
|
|
5833
5833
|
function __PRIVATE_getMd5HashValue(e) {
|
|
@@ -5862,7 +5862,7 @@ class BloomFilter {
|
|
|
5862
5862
|
// Calculate hashed value h(i) = h1 + (i * h2).
|
|
5863
5863
|
let r = e.add(t.multiply(webchannelWrapper.Integer.fromNumber(n)));
|
|
5864
5864
|
// Wrap if hash value overflow 64bit.
|
|
5865
|
-
return 1 === r.compare(
|
|
5865
|
+
return 1 === r.compare(le) && (r = new webchannelWrapper.Integer([ r.getBits(0), r.getBits(1) ], 0)),
|
|
5866
5866
|
r.modulo(this.Re).toNumber();
|
|
5867
5867
|
}
|
|
5868
5868
|
// Return whether the bit on the given index in the bitmap is set to 1.
|
|
@@ -6280,7 +6280,7 @@ class __PRIVATE_WatchChangeAggregator {
|
|
|
6280
6280
|
const e = 2 /* BloomFilterApplicationStatus.FalsePositive */ === i ? "TargetPurposeExistenceFilterMismatchBloom" /* TargetPurpose.ExistenceFilterMismatchBloom */ : "TargetPurposeExistenceFilterMismatch" /* TargetPurpose.ExistenceFilterMismatch */;
|
|
6281
6281
|
this.We = this.We.insert(t, e);
|
|
6282
6282
|
}
|
|
6283
|
-
null ==
|
|
6283
|
+
null == ce || ce.it(function __PRIVATE_createExistenceFilterMismatchInfoForTestingHooks(e, t, n, r, i) {
|
|
6284
6284
|
var s, o, _, a, u, c;
|
|
6285
6285
|
const l = {
|
|
6286
6286
|
localCacheCount: e,
|
|
@@ -6496,13 +6496,13 @@ function __PRIVATE_snapshotChangesMap() {
|
|
|
6496
6496
|
return new SortedMap(DocumentKey.comparator);
|
|
6497
6497
|
}
|
|
6498
6498
|
|
|
6499
|
-
const
|
|
6499
|
+
const he = (() => {
|
|
6500
6500
|
const e = {
|
|
6501
6501
|
asc: "ASCENDING",
|
|
6502
6502
|
desc: "DESCENDING"
|
|
6503
6503
|
};
|
|
6504
6504
|
return e;
|
|
6505
|
-
})(),
|
|
6505
|
+
})(), Pe = (() => {
|
|
6506
6506
|
const e = {
|
|
6507
6507
|
"<": "LESS_THAN",
|
|
6508
6508
|
"<=": "LESS_THAN_OR_EQUAL",
|
|
@@ -6516,7 +6516,7 @@ const Pe = (() => {
|
|
|
6516
6516
|
"array-contains-any": "ARRAY_CONTAINS_ANY"
|
|
6517
6517
|
};
|
|
6518
6518
|
return e;
|
|
6519
|
-
})(),
|
|
6519
|
+
})(), Ie = (() => {
|
|
6520
6520
|
const e = {
|
|
6521
6521
|
and: "AND",
|
|
6522
6522
|
or: "OR"
|
|
@@ -6613,8 +6613,8 @@ function __PRIVATE_toName(e, t) {
|
|
|
6613
6613
|
|
|
6614
6614
|
function fromName(e, t) {
|
|
6615
6615
|
const n = __PRIVATE_fromResourceName(t);
|
|
6616
|
-
if (n.get(1) !== e.databaseId.projectId) throw new FirestoreError(
|
|
6617
|
-
if (n.get(3) !== e.databaseId.database) throw new FirestoreError(
|
|
6616
|
+
if (n.get(1) !== e.databaseId.projectId) throw new FirestoreError(D.INVALID_ARGUMENT, "Tried to deserialize key from different project: " + n.get(1) + " vs " + e.databaseId.projectId);
|
|
6617
|
+
if (n.get(3) !== e.databaseId.database) throw new FirestoreError(D.INVALID_ARGUMENT, "Tried to deserialize key from different database: " + n.get(3) + " vs " + e.databaseId.database);
|
|
6618
6618
|
return new DocumentKey(__PRIVATE_extractLocalPathFromResourceName(n));
|
|
6619
6619
|
}
|
|
6620
6620
|
|
|
@@ -6684,7 +6684,7 @@ function __PRIVATE_fromWatchChange(e, t) {
|
|
|
6684
6684
|
ByteString.fromBase64String(t || "")) : (__PRIVATE_hardAssert(void 0 === t || t instanceof Uint8Array),
|
|
6685
6685
|
ByteString.fromUint8Array(t || new Uint8Array));
|
|
6686
6686
|
}(e, t.targetChange.resumeToken), o = t.targetChange.cause, _ = o && function __PRIVATE_fromRpcStatus(e) {
|
|
6687
|
-
const t = void 0 === e.code ?
|
|
6687
|
+
const t = void 0 === e.code ? D.UNKNOWN : __PRIVATE_mapCodeFromRpcCode(e.code);
|
|
6688
6688
|
return new FirestoreError(t, e.message || "");
|
|
6689
6689
|
}(o);
|
|
6690
6690
|
n = new __PRIVATE_WatchTargetChange(r, i, s, _ || null);
|
|
@@ -7040,15 +7040,15 @@ function __PRIVATE_fromFilter(e) {
|
|
|
7040
7040
|
}
|
|
7041
7041
|
|
|
7042
7042
|
function __PRIVATE_toDirection(e) {
|
|
7043
|
-
return
|
|
7043
|
+
return he[e];
|
|
7044
7044
|
}
|
|
7045
7045
|
|
|
7046
7046
|
function __PRIVATE_toOperatorName(e) {
|
|
7047
|
-
return
|
|
7047
|
+
return Pe[e];
|
|
7048
7048
|
}
|
|
7049
7049
|
|
|
7050
7050
|
function __PRIVATE_toCompositeOperatorName(e) {
|
|
7051
|
-
return
|
|
7051
|
+
return Ie[e];
|
|
7052
7052
|
}
|
|
7053
7053
|
|
|
7054
7054
|
function __PRIVATE_toFieldPathReference(e) {
|
|
@@ -8320,7 +8320,7 @@ function __PRIVATE_applyDistributionFieldAndCompositeFilters(e, t) {
|
|
|
8320
8320
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
8321
8321
|
* See the License for the specific language governing permissions and
|
|
8322
8322
|
* limitations under the License.
|
|
8323
|
-
*/ const
|
|
8323
|
+
*/ const Te = new Uint8Array(0);
|
|
8324
8324
|
|
|
8325
8325
|
/**
|
|
8326
8326
|
* A persisted implementation of IndexManager.
|
|
@@ -8522,7 +8522,7 @@ class __PRIVATE_IndexedDbIndexManager {
|
|
|
8522
8522
|
// combined with the values from the query bounds.
|
|
8523
8523
|
const _ = (null != t ? t.length : 1) * Math.max(n.length, i.length), a = _ / (null != t ? t.length : 1), u = [];
|
|
8524
8524
|
for (let c = 0; c < _; ++c) {
|
|
8525
|
-
const _ = t ? this.Tn(t[c / a]) :
|
|
8525
|
+
const _ = t ? this.Tn(t[c / a]) : Te, l = this.En(e, _, n[c % a], r), h = this.dn(e, _, i[c % a], s), P = o.map((t => this.En(e, _, t,
|
|
8526
8526
|
/* inclusive= */ !0)));
|
|
8527
8527
|
u.push(...this.createRange(l, h, P));
|
|
8528
8528
|
}
|
|
@@ -8719,7 +8719,7 @@ class __PRIVATE_IndexedDbIndexManager {
|
|
|
8719
8719
|
if (null != i) {
|
|
8720
8720
|
const s = e.data.field(i.fieldPath);
|
|
8721
8721
|
if (isArray(s)) for (const i of s.arrayValue.values || []) n = n.add(new __PRIVATE_IndexEntry(t.indexId, e.key, this.Tn(i), r));
|
|
8722
|
-
} else n = n.add(new __PRIVATE_IndexEntry(t.indexId, e.key,
|
|
8722
|
+
} else n = n.add(new __PRIVATE_IndexEntry(t.indexId, e.key, Te, r));
|
|
8723
8723
|
return n;
|
|
8724
8724
|
}
|
|
8725
8725
|
/**
|
|
@@ -8794,7 +8794,7 @@ class __PRIVATE_IndexedDbIndexManager {
|
|
|
8794
8794
|
// If we encounter two bounds that will create an unmatchable key range,
|
|
8795
8795
|
// then we return an empty set of key ranges.
|
|
8796
8796
|
if (this.Dn(r[e], r[e + 1])) return [];
|
|
8797
|
-
const t = [ r[e].indexId, this.uid, r[e].arrayValue, r[e].directionalValue,
|
|
8797
|
+
const t = [ r[e].indexId, this.uid, r[e].arrayValue, r[e].directionalValue, Te, [] ], n = [ r[e + 1].indexId, this.uid, r[e + 1].arrayValue, r[e + 1].directionalValue, Te, [] ];
|
|
8798
8798
|
i.push(IDBKeyRange.bound(t, n));
|
|
8799
8799
|
}
|
|
8800
8800
|
return i;
|
|
@@ -8862,7 +8862,7 @@ function __PRIVATE_getMinOffsetFromFieldIndexes(e) {
|
|
|
8862
8862
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
8863
8863
|
* See the License for the specific language governing permissions and
|
|
8864
8864
|
* limitations under the License.
|
|
8865
|
-
*/ const
|
|
8865
|
+
*/ const Ee = {
|
|
8866
8866
|
didRun: !1,
|
|
8867
8867
|
sequenceNumbersCollected: 0,
|
|
8868
8868
|
targetsRemoved: 0,
|
|
@@ -9026,7 +9026,7 @@ class __PRIVATE_IndexedDbMutationQueue {
|
|
|
9026
9026
|
let c = new SortedSet(((e, t) => __PRIVATE_primitiveComparator(e.canonicalString(), t.canonicalString())));
|
|
9027
9027
|
for (const e of r) {
|
|
9028
9028
|
const t = __PRIVATE_newDbDocumentMutationKey(this.userId, e.key.path, o);
|
|
9029
|
-
c = c.add(e.key.path.popLast()), u.push(s.put(a)), u.push(i.put(t,
|
|
9029
|
+
c = c.add(e.key.path.popLast()), u.push(s.put(a)), u.push(i.put(t, x));
|
|
9030
9030
|
}
|
|
9031
9031
|
return c.forEach((t => {
|
|
9032
9032
|
u.push(this.indexManager.addToCollectionParentIndex(e, t));
|
|
@@ -9595,8 +9595,8 @@ class __PRIVATE_TargetIdGenerator {
|
|
|
9595
9595
|
}
|
|
9596
9596
|
collect(e, t) {
|
|
9597
9597
|
return -1 === this.params.cacheSizeCollectionThreshold ? (__PRIVATE_logDebug("LruGarbageCollector", "Garbage collection skipped; disabled"),
|
|
9598
|
-
PersistencePromise.resolve(
|
|
9599
|
-
|
|
9598
|
+
PersistencePromise.resolve(Ee)) : 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}`),
|
|
9599
|
+
Ee) : this.Yn(e, t)));
|
|
9600
9600
|
}
|
|
9601
9601
|
getCacheSize(e) {
|
|
9602
9602
|
return this.jn.getCacheSize(e);
|
|
@@ -11352,7 +11352,7 @@ class __PRIVATE_MemoryLruDelegate {
|
|
|
11352
11352
|
e.createObjectStore("mutations", {
|
|
11353
11353
|
keyPath: "batchId",
|
|
11354
11354
|
autoIncrement: !0
|
|
11355
|
-
}).createIndex("userMutationsIndex",
|
|
11355
|
+
}).createIndex("userMutationsIndex", M, {
|
|
11356
11356
|
unique: !0
|
|
11357
11357
|
}), e.createObjectStore("documentMutations");
|
|
11358
11358
|
}
|
|
@@ -11397,7 +11397,7 @@ class __PRIVATE_MemoryLruDelegate {
|
|
|
11397
11397
|
e.createObjectStore("mutations", {
|
|
11398
11398
|
keyPath: "batchId",
|
|
11399
11399
|
autoIncrement: !0
|
|
11400
|
-
}).createIndex("userMutationsIndex",
|
|
11400
|
+
}).createIndex("userMutationsIndex", M, {
|
|
11401
11401
|
unique: !0
|
|
11402
11402
|
});
|
|
11403
11403
|
const r = t.store("mutations"), i = n.map((e => r.put(e)));
|
|
@@ -11434,19 +11434,19 @@ class __PRIVATE_MemoryLruDelegate {
|
|
|
11434
11434
|
}))), n < 12 && r >= 12 && (s = s.next((() => {
|
|
11435
11435
|
!function __PRIVATE_createDocumentOverlayStore(e) {
|
|
11436
11436
|
const t = e.createObjectStore("documentOverlays", {
|
|
11437
|
-
keyPath:
|
|
11437
|
+
keyPath: G
|
|
11438
11438
|
});
|
|
11439
|
-
t.createIndex("collectionPathOverlayIndex",
|
|
11439
|
+
t.createIndex("collectionPathOverlayIndex", z, {
|
|
11440
11440
|
unique: !1
|
|
11441
|
-
}), t.createIndex("collectionGroupOverlayIndex",
|
|
11441
|
+
}), t.createIndex("collectionGroupOverlayIndex", j, {
|
|
11442
11442
|
unique: !1
|
|
11443
11443
|
});
|
|
11444
11444
|
}(e);
|
|
11445
11445
|
}))), n < 13 && r >= 13 && (s = s.next((() => function __PRIVATE_createRemoteDocumentCache(e) {
|
|
11446
11446
|
const t = e.createObjectStore("remoteDocumentsV14", {
|
|
11447
|
-
keyPath:
|
|
11447
|
+
keyPath: O
|
|
11448
11448
|
});
|
|
11449
|
-
t.createIndex("documentKeyIndex",
|
|
11449
|
+
t.createIndex("documentKeyIndex", N), t.createIndex("collectionGroupIndex", B);
|
|
11450
11450
|
}(e))).next((() => this.ii(e, i))).next((() => e.deleteObjectStore("remoteDocuments")))),
|
|
11451
11451
|
n < 14 && r >= 14 && (s = s.next((() => this.si(e, i)))), n < 15 && r >= 15 && (s = s.next((() => function __PRIVATE_createFieldIndex(e) {
|
|
11452
11452
|
e.createObjectStore("indexConfiguration", {
|
|
@@ -11456,13 +11456,13 @@ class __PRIVATE_MemoryLruDelegate {
|
|
|
11456
11456
|
unique: !1
|
|
11457
11457
|
});
|
|
11458
11458
|
e.createObjectStore("indexState", {
|
|
11459
|
-
keyPath:
|
|
11460
|
-
}).createIndex("sequenceNumberIndex",
|
|
11459
|
+
keyPath: K
|
|
11460
|
+
}).createIndex("sequenceNumberIndex", $, {
|
|
11461
11461
|
unique: !1
|
|
11462
11462
|
});
|
|
11463
11463
|
e.createObjectStore("indexEntries", {
|
|
11464
|
-
keyPath:
|
|
11465
|
-
}).createIndex("documentKeyIndex",
|
|
11464
|
+
keyPath: U
|
|
11465
|
+
}).createIndex("documentKeyIndex", W, {
|
|
11466
11466
|
unique: !1
|
|
11467
11467
|
});
|
|
11468
11468
|
}(e)))), s;
|
|
@@ -11511,7 +11511,7 @@ class __PRIVATE_MemoryLruDelegate {
|
|
|
11511
11511
|
ni(e, t) {
|
|
11512
11512
|
// Create the index.
|
|
11513
11513
|
e.createObjectStore("collectionParents", {
|
|
11514
|
-
keyPath:
|
|
11514
|
+
keyPath: Q
|
|
11515
11515
|
});
|
|
11516
11516
|
const n = t.store("collectionParents"), r = new __PRIVATE_MemoryCollectionParentIndex, addEntry = e => {
|
|
11517
11517
|
if (r.add(e)) {
|
|
@@ -11596,19 +11596,19 @@ class __PRIVATE_MemoryLruDelegate {
|
|
|
11596
11596
|
|
|
11597
11597
|
function __PRIVATE_createQueryCache(e) {
|
|
11598
11598
|
e.createObjectStore("targetDocuments", {
|
|
11599
|
-
keyPath:
|
|
11600
|
-
}).createIndex("documentTargetsIndex",
|
|
11599
|
+
keyPath: k
|
|
11600
|
+
}).createIndex("documentTargetsIndex", q, {
|
|
11601
11601
|
unique: !0
|
|
11602
11602
|
});
|
|
11603
11603
|
// NOTE: This is unique only because the TargetId is the suffix.
|
|
11604
11604
|
e.createObjectStore("targets", {
|
|
11605
11605
|
keyPath: "targetId"
|
|
11606
|
-
}).createIndex("queryTargetsIndex",
|
|
11606
|
+
}).createIndex("queryTargetsIndex", L, {
|
|
11607
11607
|
unique: !0
|
|
11608
11608
|
}), e.createObjectStore("targetGlobal");
|
|
11609
11609
|
}
|
|
11610
11610
|
|
|
11611
|
-
const
|
|
11611
|
+
const de = "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.";
|
|
11612
11612
|
|
|
11613
11613
|
/**
|
|
11614
11614
|
* Oldest acceptable age in milliseconds for client metadata before the client
|
|
@@ -11684,7 +11684,7 @@ class __PRIVATE_IndexedDbPersistence {
|
|
|
11684
11684
|
/** The last time we garbage collected the client metadata object store. */
|
|
11685
11685
|
this.Pi = Number.NEGATIVE_INFINITY,
|
|
11686
11686
|
/** A listener to notify on primary state changes. */
|
|
11687
|
-
this.Ii = e => Promise.resolve(), !__PRIVATE_IndexedDbPersistence.v()) throw new FirestoreError(
|
|
11687
|
+
this.Ii = e => Promise.resolve(), !__PRIVATE_IndexedDbPersistence.v()) throw new FirestoreError(D.UNIMPLEMENTED, "This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");
|
|
11688
11688
|
this.referenceDelegate = new __PRIVATE_IndexedDbLruDelegateImpl(this, r), this.Ti = t + "main",
|
|
11689
11689
|
this.serializer = new __PRIVATE_LocalSerializer(_), this.Ei = new __PRIVATE_SimpleDb(this.Ti, this.ui, new __PRIVATE_SchemaConverter(this.serializer)),
|
|
11690
11690
|
this.Qr = new __PRIVATE_IndexedDbTargetCache(this.referenceDelegate, this.serializer),
|
|
@@ -11704,7 +11704,7 @@ class __PRIVATE_IndexedDbPersistence {
|
|
|
11704
11704
|
if (!this.isPrimary && !this.allowTabSynchronization)
|
|
11705
11705
|
// Fail `start()` if `synchronizeTabs` is disabled and we cannot
|
|
11706
11706
|
// obtain the primary lease.
|
|
11707
|
-
throw new FirestoreError(
|
|
11707
|
+
throw new FirestoreError(D.FAILED_PRECONDITION, de);
|
|
11708
11708
|
return this.Ri(), this.Vi(), this.mi(), this.runTransaction("getHighestListenSequenceNumber", "readonly", (e => this.Qr.getHighestSequenceNumber(e)));
|
|
11709
11709
|
})).then((e => {
|
|
11710
11710
|
this.kr = new __PRIVATE_ListenSequence(e, this._i);
|
|
@@ -11846,7 +11846,7 @@ class __PRIVATE_IndexedDbPersistence {
|
|
|
11846
11846
|
// settings is not supported.
|
|
11847
11847
|
// TODO(b/114226234): Remove this check when `synchronizeTabs` can
|
|
11848
11848
|
// no longer be turned off.
|
|
11849
|
-
throw new FirestoreError(
|
|
11849
|
+
throw new FirestoreError(D.FAILED_PRECONDITION, de);
|
|
11850
11850
|
return !1;
|
|
11851
11851
|
}
|
|
11852
11852
|
}
|
|
@@ -11916,7 +11916,7 @@ class __PRIVATE_IndexedDbPersistence {
|
|
|
11916
11916
|
const r = "readonly" === t ? "readonly" : "readwrite", i =
|
|
11917
11917
|
/** Returns the object stores for the provided schema. */
|
|
11918
11918
|
function __PRIVATE_getObjectStores(e) {
|
|
11919
|
-
return 15 === e ?
|
|
11919
|
+
return 15 === e ? X : 14 === e ? Z : 13 === e ? Y : 12 === e ? J : 11 === e ? H : void fail();
|
|
11920
11920
|
}(this.ui);
|
|
11921
11921
|
let s;
|
|
11922
11922
|
// Do all transactions as readwrite against all object stores, since we
|
|
@@ -11924,7 +11924,7 @@ class __PRIVATE_IndexedDbPersistence {
|
|
|
11924
11924
|
return this.Ei.runTransaction(e, r, i, (r => (s = new __PRIVATE_IndexedDbTransaction(r, this.kr ? this.kr.next() : __PRIVATE_ListenSequence.ae),
|
|
11925
11925
|
"readwrite-primary" === t ? this.gi(s).next((e => !!e || this.pi(s))).next((t => {
|
|
11926
11926
|
if (!t) throw __PRIVATE_logError(`Failed to obtain primary lease for action '${e}'.`),
|
|
11927
|
-
this.isPrimary = !1, this.oi.enqueueRetryable((() => this.Ii(!1))), new FirestoreError(
|
|
11927
|
+
this.isPrimary = !1, this.oi.enqueueRetryable((() => this.Ii(!1))), new FirestoreError(D.FAILED_PRECONDITION, C);
|
|
11928
11928
|
return n(s);
|
|
11929
11929
|
})).next((e => this.wi(s).next((() => e)))) : this.ki(s).next((() => n(s)))))).then((e => (s.raiseOnCommittedEvent(),
|
|
11930
11930
|
e)));
|
|
@@ -11937,7 +11937,7 @@ class __PRIVATE_IndexedDbPersistence {
|
|
|
11937
11937
|
// be turned off.
|
|
11938
11938
|
ki(e) {
|
|
11939
11939
|
return __PRIVATE_primaryClientStore(e).get("owner").next((e => {
|
|
11940
|
-
if (null !== e && this.vi(e.leaseTimestampMs, 5e3) && !this.Mi(e.ownerId) && !this.Si(e) && !(this.ai || this.allowTabSynchronization && e.allowTabSynchronization)) throw new FirestoreError(
|
|
11940
|
+
if (null !== e && this.vi(e.leaseTimestampMs, 5e3) && !this.Mi(e.ownerId) && !this.Si(e) && !(this.ai || this.allowTabSynchronization && e.allowTabSynchronization)) throw new FirestoreError(D.FAILED_PRECONDITION, de);
|
|
11941
11941
|
}));
|
|
11942
11942
|
}
|
|
11943
11943
|
/**
|
|
@@ -13356,7 +13356,7 @@ class __PRIVATE_BrowserConnectivityMonitor {
|
|
|
13356
13356
|
/**
|
|
13357
13357
|
* The value returned from the most recent invocation of
|
|
13358
13358
|
* `generateUniqueDebugId()`, or null if it has never been invoked.
|
|
13359
|
-
*/ let
|
|
13359
|
+
*/ let Ae = null;
|
|
13360
13360
|
|
|
13361
13361
|
/**
|
|
13362
13362
|
* Generates and returns an initial value for `lastUniqueDebugId`.
|
|
@@ -13381,9 +13381,9 @@ class __PRIVATE_BrowserConnectivityMonitor {
|
|
|
13381
13381
|
* @return the 10-character generated ID (e.g. "0xa1b2c3d4").
|
|
13382
13382
|
*/
|
|
13383
13383
|
function __PRIVATE_generateUniqueDebugId() {
|
|
13384
|
-
return null ===
|
|
13384
|
+
return null === Ae ? Ae = function __PRIVATE_generateInitialUniqueDebugId() {
|
|
13385
13385
|
return 268435456 + Math.round(2147483648 * Math.random());
|
|
13386
|
-
}() :
|
|
13386
|
+
}() : Ae++, "0x" + Ae.toString(16);
|
|
13387
13387
|
}
|
|
13388
13388
|
|
|
13389
13389
|
/**
|
|
@@ -13401,7 +13401,7 @@ function __PRIVATE_generateUniqueDebugId() {
|
|
|
13401
13401
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13402
13402
|
* See the License for the specific language governing permissions and
|
|
13403
13403
|
* limitations under the License.
|
|
13404
|
-
*/ const
|
|
13404
|
+
*/ const Re = {
|
|
13405
13405
|
BatchGetDocuments: "batchGet",
|
|
13406
13406
|
Commit: "commit",
|
|
13407
13407
|
RunQuery: "runQuery",
|
|
@@ -13479,7 +13479,7 @@ class __PRIVATE_StreamBridge {
|
|
|
13479
13479
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13480
13480
|
* See the License for the specific language governing permissions and
|
|
13481
13481
|
* limitations under the License.
|
|
13482
|
-
*/ const
|
|
13482
|
+
*/ const Ve = "WebChannelConnection";
|
|
13483
13483
|
|
|
13484
13484
|
class __PRIVATE_WebChannelConnection extends
|
|
13485
13485
|
/**
|
|
@@ -13523,7 +13523,7 @@ class __PRIVATE_RestConnection {
|
|
|
13523
13523
|
// SDK_VERSION is updated to different value at runtime depending on the entry point,
|
|
13524
13524
|
// so we need to get its value when we need it in a function.
|
|
13525
13525
|
function __PRIVATE_getGoogApiClientValue() {
|
|
13526
|
-
return "gl-js/ fire/" +
|
|
13526
|
+
return "gl-js/ fire/" + S;
|
|
13527
13527
|
}(),
|
|
13528
13528
|
// Content-Type: text/plain will avoid preflight requests which might
|
|
13529
13529
|
// mess with CORS and redirects by proxies. If we add custom headers
|
|
@@ -13533,7 +13533,7 @@ class __PRIVATE_RestConnection {
|
|
|
13533
13533
|
t && t.headers.forEach(((t, n) => e[n] = t)), n && n.headers.forEach(((t, n) => e[n] = t));
|
|
13534
13534
|
}
|
|
13535
13535
|
po(e, t) {
|
|
13536
|
-
const n =
|
|
13536
|
+
const n = Re[e];
|
|
13537
13537
|
return `${this.Ao}/v1/${t}:${n}`;
|
|
13538
13538
|
}
|
|
13539
13539
|
} {
|
|
@@ -13550,17 +13550,17 @@ class __PRIVATE_RestConnection {
|
|
|
13550
13550
|
switch (_.getLastErrorCode()) {
|
|
13551
13551
|
case webchannelWrapper.ErrorCode.NO_ERROR:
|
|
13552
13552
|
const t = _.getResponseJson();
|
|
13553
|
-
__PRIVATE_logDebug(
|
|
13553
|
+
__PRIVATE_logDebug(Ve, `XHR for RPC '${e}' ${i} received:`, JSON.stringify(t)),
|
|
13554
13554
|
s(t);
|
|
13555
13555
|
break;
|
|
13556
13556
|
|
|
13557
13557
|
case webchannelWrapper.ErrorCode.TIMEOUT:
|
|
13558
|
-
__PRIVATE_logDebug(
|
|
13558
|
+
__PRIVATE_logDebug(Ve, `RPC '${e}' ${i} timed out`), o(new FirestoreError(D.DEADLINE_EXCEEDED, "Request time out"));
|
|
13559
13559
|
break;
|
|
13560
13560
|
|
|
13561
13561
|
case webchannelWrapper.ErrorCode.HTTP_ERROR:
|
|
13562
13562
|
const n = _.getStatus();
|
|
13563
|
-
if (__PRIVATE_logDebug(
|
|
13563
|
+
if (__PRIVATE_logDebug(Ve, `RPC '${e}' ${i} failed with status:`, n, "response text:", _.getResponseText()),
|
|
13564
13564
|
n > 0) {
|
|
13565
13565
|
let e = _.getResponseJson();
|
|
13566
13566
|
Array.isArray(e) && (e = e[0]);
|
|
@@ -13568,25 +13568,25 @@ class __PRIVATE_RestConnection {
|
|
|
13568
13568
|
if (t && t.status && t.message) {
|
|
13569
13569
|
const e = function __PRIVATE_mapCodeFromHttpResponseErrorStatus(e) {
|
|
13570
13570
|
const t = e.toLowerCase().replace(/_/g, "-");
|
|
13571
|
-
return Object.values(
|
|
13571
|
+
return Object.values(D).indexOf(t) >= 0 ? t : D.UNKNOWN;
|
|
13572
13572
|
}(t.status);
|
|
13573
13573
|
o(new FirestoreError(e, t.message));
|
|
13574
|
-
} else o(new FirestoreError(
|
|
13574
|
+
} else o(new FirestoreError(D.UNKNOWN, "Server responded with status " + _.getStatus()));
|
|
13575
13575
|
} else
|
|
13576
13576
|
// If we received an HTTP_ERROR but there's no status code,
|
|
13577
13577
|
// it's most probably a connection issue
|
|
13578
|
-
o(new FirestoreError(
|
|
13578
|
+
o(new FirestoreError(D.UNAVAILABLE, "Connection failed."));
|
|
13579
13579
|
break;
|
|
13580
13580
|
|
|
13581
13581
|
default:
|
|
13582
13582
|
fail();
|
|
13583
13583
|
}
|
|
13584
13584
|
} finally {
|
|
13585
|
-
__PRIVATE_logDebug(
|
|
13585
|
+
__PRIVATE_logDebug(Ve, `RPC '${e}' ${i} completed.`);
|
|
13586
13586
|
}
|
|
13587
13587
|
}));
|
|
13588
13588
|
const a = JSON.stringify(r);
|
|
13589
|
-
__PRIVATE_logDebug(
|
|
13589
|
+
__PRIVATE_logDebug(Ve, `RPC '${e}' ${i} sending request:`, r), _.send(t, "POST", a, n, 15);
|
|
13590
13590
|
}));
|
|
13591
13591
|
}
|
|
13592
13592
|
bo(e, t, n) {
|
|
@@ -13614,7 +13614,7 @@ class __PRIVATE_RestConnection {
|
|
|
13614
13614
|
forceLongPolling: this.forceLongPolling,
|
|
13615
13615
|
detectBufferingProxy: this.autoDetectLongPolling
|
|
13616
13616
|
}, a = this.longPollingOptions.timeoutSeconds;
|
|
13617
|
-
void 0 !== a && (_.longPollingTimeout = Math.round(1e3 * a)), this.useFetchStreams && (_.
|
|
13617
|
+
void 0 !== a && (_.longPollingTimeout = Math.round(1e3 * a)), this.useFetchStreams && (_.useFetchStreams = !0),
|
|
13618
13618
|
this.yo(_.initMessageHeaders, t, n),
|
|
13619
13619
|
// Sending the custom headers we just added to request.initMessageHeaders
|
|
13620
13620
|
// (Authorization, etc.) will trigger the browser to make a CORS preflight
|
|
@@ -13627,7 +13627,7 @@ class __PRIVATE_RestConnection {
|
|
|
13627
13627
|
// which is recognized by the webchannel backend.
|
|
13628
13628
|
_.encodeInitMessageHeaders = !0;
|
|
13629
13629
|
const u = i.join("");
|
|
13630
|
-
__PRIVATE_logDebug(
|
|
13630
|
+
__PRIVATE_logDebug(Ve, `Creating RPC '${e}' stream ${r}: ${u}`, _);
|
|
13631
13631
|
const c = s.createWebChannel(u, _);
|
|
13632
13632
|
// WebChannel supports sending the first message with the handshake - saving
|
|
13633
13633
|
// a network round trip. However, it will have to call send in the same
|
|
@@ -13640,8 +13640,8 @@ class __PRIVATE_RestConnection {
|
|
|
13640
13640
|
// on a closed stream
|
|
13641
13641
|
const P = new __PRIVATE_StreamBridge({
|
|
13642
13642
|
_o: t => {
|
|
13643
|
-
h ? __PRIVATE_logDebug(
|
|
13644
|
-
c.open(), l = !0), __PRIVATE_logDebug(
|
|
13643
|
+
h ? __PRIVATE_logDebug(Ve, `Not sending because RPC '${e}' stream ${r} is closed:`, t) : (l || (__PRIVATE_logDebug(Ve, `Opening RPC '${e}' stream ${r} transport.`),
|
|
13644
|
+
c.open(), l = !0), __PRIVATE_logDebug(Ve, `RPC '${e}' stream ${r} sending:`, t),
|
|
13645
13645
|
c.send(t));
|
|
13646
13646
|
},
|
|
13647
13647
|
ao: () => c.close()
|
|
@@ -13663,13 +13663,13 @@ class __PRIVATE_RestConnection {
|
|
|
13663
13663
|
// Note that eventually this function could go away if we are confident
|
|
13664
13664
|
// enough the code is exception free.
|
|
13665
13665
|
return __PRIVATE_unguardedEventListen(c, webchannelWrapper.WebChannel.EventType.OPEN, (() => {
|
|
13666
|
-
h || __PRIVATE_logDebug(
|
|
13666
|
+
h || __PRIVATE_logDebug(Ve, `RPC '${e}' stream ${r} transport opened.`);
|
|
13667
13667
|
})), __PRIVATE_unguardedEventListen(c, webchannelWrapper.WebChannel.EventType.CLOSE, (() => {
|
|
13668
|
-
h || (h = !0, __PRIVATE_logDebug(
|
|
13668
|
+
h || (h = !0, __PRIVATE_logDebug(Ve, `RPC '${e}' stream ${r} transport closed`),
|
|
13669
13669
|
P.To());
|
|
13670
13670
|
})), __PRIVATE_unguardedEventListen(c, webchannelWrapper.WebChannel.EventType.ERROR, (t => {
|
|
13671
|
-
h || (h = !0, __PRIVATE_logWarn(
|
|
13672
|
-
P.To(new FirestoreError(
|
|
13671
|
+
h || (h = !0, __PRIVATE_logWarn(Ve, `RPC '${e}' stream ${r} transport errored:`, t),
|
|
13672
|
+
P.To(new FirestoreError(D.UNAVAILABLE, "The operation could not be completed")));
|
|
13673
13673
|
})), __PRIVATE_unguardedEventListen(c, webchannelWrapper.WebChannel.EventType.MESSAGE, (t => {
|
|
13674
13674
|
var n;
|
|
13675
13675
|
if (!h) {
|
|
@@ -13682,7 +13682,7 @@ class __PRIVATE_RestConnection {
|
|
|
13682
13682
|
// Use any because msgData.error is not typed.
|
|
13683
13683
|
const s = i, o = s.error || (null === (n = s[0]) || void 0 === n ? void 0 : n.error);
|
|
13684
13684
|
if (o) {
|
|
13685
|
-
__PRIVATE_logDebug(
|
|
13685
|
+
__PRIVATE_logDebug(Ve, `RPC '${e}' stream ${r} received error:`, o);
|
|
13686
13686
|
// error.status will be a string like 'OK' or 'NOT_FOUND'.
|
|
13687
13687
|
const t = o.status;
|
|
13688
13688
|
let n =
|
|
@@ -13695,16 +13695,16 @@ class __PRIVATE_RestConnection {
|
|
|
13695
13695
|
function __PRIVATE_mapCodeFromRpcStatus(e) {
|
|
13696
13696
|
// lookup by string
|
|
13697
13697
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13698
|
-
const t =
|
|
13698
|
+
const t = ae[e];
|
|
13699
13699
|
if (void 0 !== t) return __PRIVATE_mapCodeFromRpcCode(t);
|
|
13700
13700
|
}(t), i = o.message;
|
|
13701
|
-
void 0 === n && (n =
|
|
13701
|
+
void 0 === n && (n = D.INTERNAL, i = "Unknown error status: " + t + " with message " + o.message),
|
|
13702
13702
|
// Mark closed so no further events are propagated
|
|
13703
13703
|
h = !0, P.To(new FirestoreError(n, i)), c.close();
|
|
13704
|
-
} else __PRIVATE_logDebug(
|
|
13704
|
+
} else __PRIVATE_logDebug(Ve, `RPC '${e}' stream ${r} received:`, i), P.Eo(i);
|
|
13705
13705
|
}
|
|
13706
13706
|
})), __PRIVATE_unguardedEventListen(o, webchannelWrapper.Event.STAT_EVENT, (t => {
|
|
13707
|
-
t.stat === webchannelWrapper.Stat.PROXY ? __PRIVATE_logDebug(
|
|
13707
|
+
t.stat === webchannelWrapper.Stat.PROXY ? __PRIVATE_logDebug(Ve, `RPC '${e}' stream ${r} detected buffering proxy`) : t.stat === webchannelWrapper.Stat.NOPROXY && __PRIVATE_logDebug(Ve, `RPC '${e}' stream ${r} detected no buffering proxy`);
|
|
13708
13708
|
})), setTimeout((() => {
|
|
13709
13709
|
// Technically we could/should wait for the WebChannel opened event,
|
|
13710
13710
|
// but because we want to send the first message with the WebChannel
|
|
@@ -14028,10 +14028,10 @@ class __PRIVATE_PersistentStream {
|
|
|
14028
14028
|
// underlying stream), guaranteeing they won't execute.
|
|
14029
14029
|
this.Qo++, 4 /* PersistentStreamState.Error */ !== e ?
|
|
14030
14030
|
// If this is an intentional close ensure we don't delay our next connection attempt.
|
|
14031
|
-
this.Uo.reset() : t && t.code ===
|
|
14031
|
+
this.Uo.reset() : t && t.code === D.RESOURCE_EXHAUSTED ? (
|
|
14032
14032
|
// Log the error. (Probably either 'quota exceeded' or 'max queue length reached'.)
|
|
14033
14033
|
__PRIVATE_logError(t.toString()), __PRIVATE_logError("Using maximum backoff delay to prevent overloading the backend."),
|
|
14034
|
-
this.Uo.Oo()) : t && t.code ===
|
|
14034
|
+
this.Uo.Oo()) : t && t.code === D.UNAUTHENTICATED && 3 /* PersistentStreamState.Healthy */ !== this.state && (
|
|
14035
14035
|
// "unauthenticated" error means the token was rejected. This should rarely
|
|
14036
14036
|
// happen since both Auth and AppCheck ensure a sufficient TTL when we
|
|
14037
14037
|
// request a token. If a user manually resets their system clock this can
|
|
@@ -14067,7 +14067,7 @@ class __PRIVATE_PersistentStream {
|
|
|
14067
14067
|
this.n_(e, n);
|
|
14068
14068
|
}), (t => {
|
|
14069
14069
|
e((() => {
|
|
14070
|
-
const e = new FirestoreError(
|
|
14070
|
+
const e = new FirestoreError(D.UNKNOWN, "Fetching auth token failed: " + t.message);
|
|
14071
14071
|
return this.r_(e);
|
|
14072
14072
|
}));
|
|
14073
14073
|
}));
|
|
@@ -14280,18 +14280,18 @@ class __PRIVATE_DatastoreImpl extends class Datastore {} {
|
|
|
14280
14280
|
this.serializer = r, this.I_ = !1;
|
|
14281
14281
|
}
|
|
14282
14282
|
T_() {
|
|
14283
|
-
if (this.I_) throw new FirestoreError(
|
|
14283
|
+
if (this.I_) throw new FirestoreError(D.FAILED_PRECONDITION, "The client has already been terminated.");
|
|
14284
14284
|
}
|
|
14285
14285
|
/** Invokes the provided RPC with auth and AppCheck tokens. */ fo(e, t, n) {
|
|
14286
14286
|
return this.T_(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, i]) => this.connection.fo(e, t, n, r, i))).catch((e => {
|
|
14287
|
-
throw "FirebaseError" === e.name ? (e.code ===
|
|
14288
|
-
this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(
|
|
14287
|
+
throw "FirebaseError" === e.name ? (e.code === D.UNAUTHENTICATED && (this.authCredentials.invalidateToken(),
|
|
14288
|
+
this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(D.UNKNOWN, e.toString());
|
|
14289
14289
|
}));
|
|
14290
14290
|
}
|
|
14291
14291
|
/** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ So(e, t, n, r) {
|
|
14292
14292
|
return this.T_(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([i, s]) => this.connection.So(e, t, n, i, s, r))).catch((e => {
|
|
14293
|
-
throw "FirebaseError" === e.name ? (e.code ===
|
|
14294
|
-
this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(
|
|
14293
|
+
throw "FirebaseError" === e.name ? (e.code === D.UNAUTHENTICATED && (this.authCredentials.invalidateToken(),
|
|
14294
|
+
this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(D.UNKNOWN, e.toString());
|
|
14295
14295
|
}));
|
|
14296
14296
|
}
|
|
14297
14297
|
terminate() {
|
|
@@ -14781,7 +14781,7 @@ async function __PRIVATE_onWriteStreamClose(e, t) {
|
|
|
14781
14781
|
// Only handle permanent errors here. If it's transient, just let the retry
|
|
14782
14782
|
// logic kick in.
|
|
14783
14783
|
if (function __PRIVATE_isPermanentWriteError(e) {
|
|
14784
|
-
return __PRIVATE_isPermanentError(e) && e !==
|
|
14784
|
+
return __PRIVATE_isPermanentError(e) && e !== D.ABORTED;
|
|
14785
14785
|
}(t.code)) {
|
|
14786
14786
|
// This was a permanent error, the request itself was the problem
|
|
14787
14787
|
// so it's not going to succeed if we resend it.
|
|
@@ -14959,7 +14959,7 @@ class DelayedOperation {
|
|
|
14959
14959
|
* As long as the operation has not yet been run, calling cancel() provides a
|
|
14960
14960
|
* guarantee that the operation will not be run.
|
|
14961
14961
|
*/ cancel(e) {
|
|
14962
|
-
null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new FirestoreError(
|
|
14962
|
+
null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new FirestoreError(D.CANCELLED, "Operation cancelled" + (e ? ": " + e : ""))));
|
|
14963
14963
|
}
|
|
14964
14964
|
handleDelayElapsed() {
|
|
14965
14965
|
this.asyncQueue.enqueueAndForget((() => null !== this.timerHandle ? (this.clearTimeout(),
|
|
@@ -14975,7 +14975,7 @@ class DelayedOperation {
|
|
|
14975
14975
|
* Returns a FirestoreError that can be surfaced to the user if the provided
|
|
14976
14976
|
* error is an IndexedDbTransactionError. Re-throws the error otherwise.
|
|
14977
14977
|
*/ function __PRIVATE_wrapInUserErrorIfRecoverable(e, t) {
|
|
14978
|
-
if (__PRIVATE_logError("AsyncQueue", `${t}: ${e}`), __PRIVATE_isIndexedDbTransactionError(e)) return new FirestoreError(
|
|
14978
|
+
if (__PRIVATE_logError("AsyncQueue", `${t}: ${e}`), __PRIVATE_isIndexedDbTransactionError(e)) return new FirestoreError(D.UNAVAILABLE, `${t}: ${e}`);
|
|
14979
14979
|
throw e;
|
|
14980
14980
|
}
|
|
14981
14981
|
|
|
@@ -16255,7 +16255,7 @@ async function __PRIVATE_syncEngineHandleCredentialChange(e, t) {
|
|
|
16255
16255
|
function __PRIVATE_rejectOutstandingPendingWritesCallbacks(e, t) {
|
|
16256
16256
|
e.ya.forEach((e => {
|
|
16257
16257
|
e.forEach((e => {
|
|
16258
|
-
e.reject(new FirestoreError(
|
|
16258
|
+
e.reject(new FirestoreError(D.CANCELLED, t));
|
|
16259
16259
|
}));
|
|
16260
16260
|
})), e.ya.clear();
|
|
16261
16261
|
}(n, "'waitForPendingWrites' promise is rejected due to a user change."),
|
|
@@ -16684,7 +16684,7 @@ class __PRIVATE_LruGcMemoryOfflineComponentProvider extends MemoryOfflineCompone
|
|
|
16684
16684
|
}
|
|
16685
16685
|
createSharedClientState(e) {
|
|
16686
16686
|
const t = __PRIVATE_getWindow();
|
|
16687
|
-
if (!__PRIVATE_WebStorageSharedClientState.v(t)) throw new FirestoreError(
|
|
16687
|
+
if (!__PRIVATE_WebStorageSharedClientState.v(t)) throw new FirestoreError(D.UNIMPLEMENTED, "IndexedDB persistence is only available on platforms that support LocalStorage.");
|
|
16688
16688
|
const n = __PRIVATE_indexedDbStoragePrefix(e.databaseInfo.databaseId, e.databaseInfo.persistenceKey);
|
|
16689
16689
|
return new __PRIVATE_WebStorageSharedClientState(t, e.asyncQueue, n, e.clientId, e.initialUser);
|
|
16690
16690
|
}
|
|
@@ -17021,7 +17021,7 @@ class Transaction$2 {
|
|
|
17021
17021
|
this.writtenDocs = new Set;
|
|
17022
17022
|
}
|
|
17023
17023
|
async lookup(e) {
|
|
17024
|
-
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new FirestoreError(
|
|
17024
|
+
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new FirestoreError(D.INVALID_ARGUMENT, "Firestore transactions require all reads to be executed before all writes.");
|
|
17025
17025
|
const t = await async function __PRIVATE_invokeBatchGetDocumentsRpc(e, t) {
|
|
17026
17026
|
const n = __PRIVATE_debugCast(e), r = __PRIVATE_getEncodedDatabaseId(n.serializer) + "/documents", i = {
|
|
17027
17027
|
documents: t.map((e => __PRIVATE_toName(n.serializer, e)))
|
|
@@ -17082,7 +17082,7 @@ class Transaction$2 {
|
|
|
17082
17082
|
if (n) {
|
|
17083
17083
|
if (!t.isEqual(n))
|
|
17084
17084
|
// This transaction will fail no matter what.
|
|
17085
|
-
throw new FirestoreError(
|
|
17085
|
+
throw new FirestoreError(D.ABORTED, "Document version changed between two reads.");
|
|
17086
17086
|
} else this.readVersions.set(e.key.toString(), t);
|
|
17087
17087
|
}
|
|
17088
17088
|
/**
|
|
@@ -17109,7 +17109,7 @@ class Transaction$2 {
|
|
|
17109
17109
|
// express that to the backend, we have to validate locally.
|
|
17110
17110
|
// Note: this can change once we can send separate verify writes in the
|
|
17111
17111
|
// transaction.
|
|
17112
|
-
throw new FirestoreError(
|
|
17112
|
+
throw new FirestoreError(D.INVALID_ARGUMENT, "Can't update a document that doesn't exist.");
|
|
17113
17113
|
// Document exists, base precondition on document update time.
|
|
17114
17114
|
return Precondition.updateTime(t);
|
|
17115
17115
|
}
|
|
@@ -17250,7 +17250,7 @@ class FirestoreClient {
|
|
|
17250
17250
|
* Checks that the client has not been terminated. Ensures that other methods on //
|
|
17251
17251
|
* this class cannot be called after the client is terminated. //
|
|
17252
17252
|
*/ verifyNotTerminated() {
|
|
17253
|
-
if (this.asyncQueue.isShuttingDown) throw new FirestoreError(
|
|
17253
|
+
if (this.asyncQueue.isShuttingDown) throw new FirestoreError(D.FAILED_PRECONDITION, "The client has already been terminated.");
|
|
17254
17254
|
}
|
|
17255
17255
|
terminate() {
|
|
17256
17256
|
this.asyncQueue.enterRestrictedMode();
|
|
@@ -17300,7 +17300,7 @@ async function __PRIVATE_setOnlineComponentProvider(e, t) {
|
|
|
17300
17300
|
* Decides whether the provided error allows us to gracefully disable
|
|
17301
17301
|
* persistence (as opposed to crashing the client).
|
|
17302
17302
|
*/ function __PRIVATE_canFallbackFromIndexedDbError(e) {
|
|
17303
|
-
return "FirebaseError" === e.name ? e.code ===
|
|
17303
|
+
return "FirebaseError" === e.name ? e.code === D.FAILED_PRECONDITION || e.code === D.UNIMPLEMENTED : !("undefined" != typeof DOMException && e instanceof DOMException) || (
|
|
17304
17304
|
// When the browser is out of quota we could get either quota exceeded
|
|
17305
17305
|
// or an aborted error depending on whether the error happened during
|
|
17306
17306
|
// schema migration.
|
|
@@ -17392,7 +17392,7 @@ async function __PRIVATE_getEventManager(e) {
|
|
|
17392
17392
|
const n = __PRIVATE_debugCast(e);
|
|
17393
17393
|
return n.persistence.runTransaction("read document", "readonly", (e => n.localDocuments.getDocument(e, t)));
|
|
17394
17394
|
}(e, t);
|
|
17395
|
-
r.isFoundDocument() ? n.resolve(r) : r.isNoDocument() ? n.resolve(null) : n.reject(new FirestoreError(
|
|
17395
|
+
r.isFoundDocument() ? n.resolve(r) : r.isNoDocument() ? n.resolve(null) : n.reject(new FirestoreError(D.UNAVAILABLE, "Failed to get document from cache. (However, this document may exist on the server. Run again without setting 'source' in the GetOptions to attempt to retrieve the document from the server.)"));
|
|
17396
17396
|
} catch (e) {
|
|
17397
17397
|
const r = __PRIVATE_wrapInUserErrorIfRecoverable(e, `Failed to get document '${t} from cache`);
|
|
17398
17398
|
n.reject(r);
|
|
@@ -17421,7 +17421,7 @@ function __PRIVATE_firestoreClientGetDocumentViaSnapshotListener(e, t, n = {}) {
|
|
|
17421
17421
|
// the server so we can deliver that even when you're
|
|
17422
17422
|
// offline 2) Actually reject the Promise in the online case
|
|
17423
17423
|
// if the document doesn't exist.
|
|
17424
|
-
i.reject(new FirestoreError(
|
|
17424
|
+
i.reject(new FirestoreError(D.UNAVAILABLE, "Failed to get document because the client is offline.")) : _ && s.fromCache && r && "server" === r.source ? i.reject(new FirestoreError(D.UNAVAILABLE, 'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')) : i.resolve(s);
|
|
17425
17425
|
},
|
|
17426
17426
|
error: e => i.reject(e)
|
|
17427
17427
|
}), o = new __PRIVATE_QueryListener(__PRIVATE_newQueryForPath(n.path), s, {
|
|
@@ -17458,7 +17458,7 @@ function __PRIVATE_firestoreClientGetDocumentsViaSnapshotListener(e, t, n = {})
|
|
|
17458
17458
|
next: n => {
|
|
17459
17459
|
// Remove query first before passing event to user to avoid
|
|
17460
17460
|
// user actions affecting the now stale query.
|
|
17461
|
-
t.enqueueAndForget((() => __PRIVATE_eventManagerUnlisten(e, o))), n.fromCache && "server" === r.source ? i.reject(new FirestoreError(
|
|
17461
|
+
t.enqueueAndForget((() => __PRIVATE_eventManagerUnlisten(e, o))), n.fromCache && "server" === r.source ? i.reject(new FirestoreError(D.UNAVAILABLE, 'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')) : i.resolve(n);
|
|
17462
17462
|
},
|
|
17463
17463
|
error: e => i.reject(e)
|
|
17464
17464
|
}), o = new __PRIVATE_QueryListener(n, s, {
|
|
@@ -17645,7 +17645,7 @@ function __PRIVATE_cloneLongPollingOptions(e) {
|
|
|
17645
17645
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17646
17646
|
* See the License for the specific language governing permissions and
|
|
17647
17647
|
* limitations under the License.
|
|
17648
|
-
*/ const
|
|
17648
|
+
*/ const me = new Map;
|
|
17649
17649
|
|
|
17650
17650
|
/**
|
|
17651
17651
|
* An instance map that ensures only one Datastore exists per Firestore
|
|
@@ -17668,28 +17668,28 @@ function __PRIVATE_cloneLongPollingOptions(e) {
|
|
|
17668
17668
|
* limitations under the License.
|
|
17669
17669
|
*/
|
|
17670
17670
|
function __PRIVATE_validateNonEmptyArgument(e, t, n) {
|
|
17671
|
-
if (!n) throw new FirestoreError(
|
|
17671
|
+
if (!n) throw new FirestoreError(D.INVALID_ARGUMENT, `Function ${e}() cannot be called with an empty ${t}.`);
|
|
17672
17672
|
}
|
|
17673
17673
|
|
|
17674
17674
|
/**
|
|
17675
17675
|
* Validates that two boolean options are not set at the same time.
|
|
17676
17676
|
* @internal
|
|
17677
17677
|
*/ function __PRIVATE_validateIsNotUsedTogether(e, t, n, r) {
|
|
17678
|
-
if (!0 === t && !0 === r) throw new FirestoreError(
|
|
17678
|
+
if (!0 === t && !0 === r) throw new FirestoreError(D.INVALID_ARGUMENT, `${e} and ${n} cannot be used together.`);
|
|
17679
17679
|
}
|
|
17680
17680
|
|
|
17681
17681
|
/**
|
|
17682
17682
|
* Validates that `path` refers to a document (indicated by the fact it contains
|
|
17683
17683
|
* an even numbers of segments).
|
|
17684
17684
|
*/ function __PRIVATE_validateDocumentPath(e) {
|
|
17685
|
-
if (!DocumentKey.isDocumentKey(e)) throw new FirestoreError(
|
|
17685
|
+
if (!DocumentKey.isDocumentKey(e)) throw new FirestoreError(D.INVALID_ARGUMENT, `Invalid document reference. Document references must have an even number of segments, but ${e} has ${e.length}.`);
|
|
17686
17686
|
}
|
|
17687
17687
|
|
|
17688
17688
|
/**
|
|
17689
17689
|
* Validates that `path` refers to a collection (indicated by the fact it
|
|
17690
17690
|
* contains an odd numbers of segments).
|
|
17691
17691
|
*/ function __PRIVATE_validateCollectionPath(e) {
|
|
17692
|
-
if (DocumentKey.isDocumentKey(e)) throw new FirestoreError(
|
|
17692
|
+
if (DocumentKey.isDocumentKey(e)) throw new FirestoreError(D.INVALID_ARGUMENT, `Invalid collection reference. Collection references must have an odd number of segments, but ${e} has ${e.length}.`);
|
|
17693
17693
|
}
|
|
17694
17694
|
|
|
17695
17695
|
/**
|
|
@@ -17733,17 +17733,17 @@ t) {
|
|
|
17733
17733
|
// Unwrap Compat types
|
|
17734
17734
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17735
17735
|
e = e._delegate), !(e instanceof t)) {
|
|
17736
|
-
if (t.name === e.constructor.name) throw new FirestoreError(
|
|
17736
|
+
if (t.name === e.constructor.name) throw new FirestoreError(D.INVALID_ARGUMENT, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
|
|
17737
17737
|
{
|
|
17738
17738
|
const n = __PRIVATE_valueDescription(e);
|
|
17739
|
-
throw new FirestoreError(
|
|
17739
|
+
throw new FirestoreError(D.INVALID_ARGUMENT, `Expected type '${t.name}', but it was: ${n}`);
|
|
17740
17740
|
}
|
|
17741
17741
|
}
|
|
17742
17742
|
return e;
|
|
17743
17743
|
}
|
|
17744
17744
|
|
|
17745
17745
|
function __PRIVATE_validatePositiveNumber(e, t) {
|
|
17746
|
-
if (t <= 0) throw new FirestoreError(
|
|
17746
|
+
if (t <= 0) throw new FirestoreError(D.INVALID_ARGUMENT, `Function ${e}() requires a positive number, but it was: ${t}.`);
|
|
17747
17747
|
}
|
|
17748
17748
|
|
|
17749
17749
|
/**
|
|
@@ -17772,12 +17772,12 @@ class FirestoreSettingsImpl {
|
|
|
17772
17772
|
constructor(e) {
|
|
17773
17773
|
var t, n;
|
|
17774
17774
|
if (void 0 === e.host) {
|
|
17775
|
-
if (void 0 !== e.ssl) throw new FirestoreError(
|
|
17775
|
+
if (void 0 !== e.ssl) throw new FirestoreError(D.INVALID_ARGUMENT, "Can't provide ssl option if host option is not set");
|
|
17776
17776
|
this.host = "firestore.googleapis.com", this.ssl = true;
|
|
17777
17777
|
} else this.host = e.host, this.ssl = null === (t = e.ssl) || void 0 === t || t;
|
|
17778
17778
|
if (this.credentials = e.credentials, this.ignoreUndefinedProperties = !!e.ignoreUndefinedProperties,
|
|
17779
17779
|
this.localCache = e.localCache, void 0 === e.cacheSizeBytes) this.cacheSizeBytes = 41943040; else {
|
|
17780
|
-
if (-1 !== e.cacheSizeBytes && e.cacheSizeBytes < 1048576) throw new FirestoreError(
|
|
17780
|
+
if (-1 !== e.cacheSizeBytes && e.cacheSizeBytes < 1048576) throw new FirestoreError(D.INVALID_ARGUMENT, "cacheSizeBytes must be at least 1048576");
|
|
17781
17781
|
this.cacheSizeBytes = e.cacheSizeBytes;
|
|
17782
17782
|
}
|
|
17783
17783
|
__PRIVATE_validateIsNotUsedTogether("experimentalForceLongPolling", e.experimentalForceLongPolling, "experimentalAutoDetectLongPolling", e.experimentalAutoDetectLongPolling),
|
|
@@ -17789,9 +17789,9 @@ class FirestoreSettingsImpl {
|
|
|
17789
17789
|
this.experimentalLongPollingOptions = __PRIVATE_cloneLongPollingOptions(null !== (n = e.experimentalLongPollingOptions) && void 0 !== n ? n : {}),
|
|
17790
17790
|
function __PRIVATE_validateLongPollingOptions(e) {
|
|
17791
17791
|
if (void 0 !== e.timeoutSeconds) {
|
|
17792
|
-
if (isNaN(e.timeoutSeconds)) throw new FirestoreError(
|
|
17793
|
-
if (e.timeoutSeconds < 5) throw new FirestoreError(
|
|
17794
|
-
if (e.timeoutSeconds > 30) throw new FirestoreError(
|
|
17792
|
+
if (isNaN(e.timeoutSeconds)) throw new FirestoreError(D.INVALID_ARGUMENT, `invalid long polling timeout: ${e.timeoutSeconds} (must not be NaN)`);
|
|
17793
|
+
if (e.timeoutSeconds < 5) throw new FirestoreError(D.INVALID_ARGUMENT, `invalid long polling timeout: ${e.timeoutSeconds} (minimum allowed value is 5)`);
|
|
17794
|
+
if (e.timeoutSeconds > 30) throw new FirestoreError(D.INVALID_ARGUMENT, `invalid long polling timeout: ${e.timeoutSeconds} (maximum allowed value is 30)`);
|
|
17795
17795
|
}
|
|
17796
17796
|
}
|
|
17797
17797
|
/**
|
|
@@ -17838,7 +17838,7 @@ class Firestore$1 {
|
|
|
17838
17838
|
* The {@link @firebase/app#FirebaseApp} associated with this `Firestore` service
|
|
17839
17839
|
* instance.
|
|
17840
17840
|
*/ get app() {
|
|
17841
|
-
if (!this._app) throw new FirestoreError(
|
|
17841
|
+
if (!this._app) throw new FirestoreError(D.FAILED_PRECONDITION, "Firestore was not initialized using the Firebase SDK. 'app' is not available");
|
|
17842
17842
|
return this._app;
|
|
17843
17843
|
}
|
|
17844
17844
|
get _initialized() {
|
|
@@ -17848,7 +17848,7 @@ class Firestore$1 {
|
|
|
17848
17848
|
return void 0 !== this._terminateTask;
|
|
17849
17849
|
}
|
|
17850
17850
|
_setSettings(e) {
|
|
17851
|
-
if (this._settingsFrozen) throw new FirestoreError(
|
|
17851
|
+
if (this._settingsFrozen) throw new FirestoreError(D.FAILED_PRECONDITION, "Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");
|
|
17852
17852
|
this._settings = new FirestoreSettingsImpl(e), void 0 !== e.credentials && (this._authCredentials = function __PRIVATE_makeAuthCredentialsProvider(e) {
|
|
17853
17853
|
if (!e) return new __PRIVATE_EmptyAuthCredentialsProvider;
|
|
17854
17854
|
switch (e.type) {
|
|
@@ -17859,7 +17859,7 @@ class Firestore$1 {
|
|
|
17859
17859
|
return e.client;
|
|
17860
17860
|
|
|
17861
17861
|
default:
|
|
17862
|
-
throw new FirestoreError(
|
|
17862
|
+
throw new FirestoreError(D.INVALID_ARGUMENT, "makeAuthCredentialsProvider failed due to invalid credential type");
|
|
17863
17863
|
}
|
|
17864
17864
|
}(e.credentials));
|
|
17865
17865
|
}
|
|
@@ -17891,8 +17891,8 @@ class Firestore$1 {
|
|
|
17891
17891
|
* when the `Firestore` instance is terminated.
|
|
17892
17892
|
*/
|
|
17893
17893
|
return function __PRIVATE_removeComponents(e) {
|
|
17894
|
-
const t =
|
|
17895
|
-
t && (__PRIVATE_logDebug("ComponentProvider", "Removing Datastore"),
|
|
17894
|
+
const t = me.get(e);
|
|
17895
|
+
t && (__PRIVATE_logDebug("ComponentProvider", "Removing Datastore"), me.delete(e),
|
|
17896
17896
|
t.terminate());
|
|
17897
17897
|
}(this), Promise.resolve();
|
|
17898
17898
|
}
|
|
@@ -17924,7 +17924,7 @@ class Firestore$1 {
|
|
|
17924
17924
|
// invalid field "uid" and missing field "sub" / "user_id".)
|
|
17925
17925
|
t = util.createMockUserToken(r.mockUserToken, null === (i = e._app) || void 0 === i ? void 0 : i.options.projectId);
|
|
17926
17926
|
const s = r.mockUserToken.sub || r.mockUserToken.user_id;
|
|
17927
|
-
if (!s) throw new FirestoreError(
|
|
17927
|
+
if (!s) throw new FirestoreError(D.INVALID_ARGUMENT, "mockUserToken must contain 'sub' or 'user_id' field!");
|
|
17928
17928
|
n = new User(s);
|
|
17929
17929
|
}
|
|
17930
17930
|
e._authCredentials = new __PRIVATE_EmulatorAuthCredentialsProvider(new __PRIVATE_OAuthToken(t, n));
|
|
@@ -18044,7 +18044,7 @@ function collection(e, t, ...n) {
|
|
|
18044
18044
|
return __PRIVATE_validateCollectionPath(r), new CollectionReference(e, /* converter= */ null, r);
|
|
18045
18045
|
}
|
|
18046
18046
|
{
|
|
18047
|
-
if (!(e instanceof DocumentReference || e instanceof CollectionReference)) throw new FirestoreError(
|
|
18047
|
+
if (!(e instanceof DocumentReference || e instanceof CollectionReference)) throw new FirestoreError(D.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
18048
18048
|
const r = e._path.child(ResourcePath.fromString(t, ...n));
|
|
18049
18049
|
return __PRIVATE_validateCollectionPath(r), new CollectionReference(e.firestore,
|
|
18050
18050
|
/* converter= */ null, r);
|
|
@@ -18065,7 +18065,7 @@ function collection(e, t, ...n) {
|
|
|
18065
18065
|
* @returns The created `Query`.
|
|
18066
18066
|
*/ function collectionGroup(e, t) {
|
|
18067
18067
|
if (e = __PRIVATE_cast(e, Firestore$1), __PRIVATE_validateNonEmptyArgument("collectionGroup", "collection id", t),
|
|
18068
|
-
t.indexOf("/") >= 0) throw new FirestoreError(
|
|
18068
|
+
t.indexOf("/") >= 0) throw new FirestoreError(D.INVALID_ARGUMENT, `Invalid collection ID '${t}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
|
|
18069
18069
|
return new Query(e,
|
|
18070
18070
|
/* converter= */ null, function __PRIVATE_newQueryForCollectionGroup(e) {
|
|
18071
18071
|
return new __PRIVATE_QueryImpl(ResourcePath.emptyPath(), e);
|
|
@@ -18083,7 +18083,7 @@ function doc(e, t, ...n) {
|
|
|
18083
18083
|
/* converter= */ null, new DocumentKey(r));
|
|
18084
18084
|
}
|
|
18085
18085
|
{
|
|
18086
|
-
if (!(e instanceof DocumentReference || e instanceof CollectionReference)) throw new FirestoreError(
|
|
18086
|
+
if (!(e instanceof DocumentReference || e instanceof CollectionReference)) throw new FirestoreError(D.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
18087
18087
|
const r = e._path.child(ResourcePath.fromString(t, ...n));
|
|
18088
18088
|
return __PRIVATE_validateDocumentPath(r), new DocumentReference(e.firestore, e instanceof CollectionReference ? e.converter : null, new DocumentKey(r));
|
|
18089
18089
|
}
|
|
@@ -18443,7 +18443,7 @@ class LoadBundleTask {
|
|
|
18443
18443
|
* Constant used to indicate the LRU garbage collection should be disabled.
|
|
18444
18444
|
* Set this value as the `cacheSizeBytes` on the settings passed to the
|
|
18445
18445
|
* {@link Firestore} instance.
|
|
18446
|
-
*/ const
|
|
18446
|
+
*/ const fe = -1;
|
|
18447
18447
|
|
|
18448
18448
|
/**
|
|
18449
18449
|
* The Cloud Firestore service interface.
|
|
@@ -18487,10 +18487,10 @@ class LoadBundleTask {
|
|
|
18487
18487
|
identifier: n
|
|
18488
18488
|
}), i = r.getOptions(n);
|
|
18489
18489
|
if (util.deepEqual(i, t)) return e;
|
|
18490
|
-
throw new FirestoreError(
|
|
18490
|
+
throw new FirestoreError(D.FAILED_PRECONDITION, "initializeFirestore() has already been called with different options. To avoid this error, call initializeFirestore() with the same options as when it was originally called, or call getFirestore() to return the already initialized instance.");
|
|
18491
18491
|
}
|
|
18492
|
-
if (void 0 !== t.cacheSizeBytes && void 0 !== t.localCache) throw new FirestoreError(
|
|
18493
|
-
if (void 0 !== t.cacheSizeBytes && -1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new FirestoreError(
|
|
18492
|
+
if (void 0 !== t.cacheSizeBytes && void 0 !== t.localCache) throw new FirestoreError(D.INVALID_ARGUMENT, "cache and cacheSizeBytes cannot be specified at the same time as cacheSizeBytes willbe deprecated. Instead, specify the cache size in the cache object");
|
|
18493
|
+
if (void 0 !== t.cacheSizeBytes && -1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new FirestoreError(D.INVALID_ARGUMENT, "cacheSizeBytes must be at least 1048576");
|
|
18494
18494
|
return r.initialize({
|
|
18495
18495
|
options: t,
|
|
18496
18496
|
instanceIdentifier: n
|
|
@@ -18559,7 +18559,7 @@ function __PRIVATE_configureFirestore(e) {
|
|
|
18559
18559
|
*/ function enableIndexedDbPersistence(e, t) {
|
|
18560
18560
|
__PRIVATE_verifyNotInitialized(e = __PRIVATE_cast(e, Firestore));
|
|
18561
18561
|
const n = ensureFirestoreConfigured(e);
|
|
18562
|
-
if (n._uninitializedComponentsProvider) throw new FirestoreError(
|
|
18562
|
+
if (n._uninitializedComponentsProvider) throw new FirestoreError(D.FAILED_PRECONDITION, "SDK cache is already specified.");
|
|
18563
18563
|
__PRIVATE_logWarn("enableIndexedDbPersistence() will be deprecated in the future, you can use `FirestoreSettings.cache` instead.");
|
|
18564
18564
|
const r = e._freezeSettings(), i = new OnlineComponentProvider;
|
|
18565
18565
|
return __PRIVATE_setPersistenceProviders(n, i, new __PRIVATE_IndexedDbOfflineComponentProvider(i, r.cacheSizeBytes, null == t ? void 0 : t.forceOwnership));
|
|
@@ -18593,7 +18593,7 @@ function __PRIVATE_configureFirestore(e) {
|
|
|
18593
18593
|
*/ function enableMultiTabIndexedDbPersistence(e) {
|
|
18594
18594
|
__PRIVATE_verifyNotInitialized(e = __PRIVATE_cast(e, Firestore));
|
|
18595
18595
|
const t = ensureFirestoreConfigured(e);
|
|
18596
|
-
if (t._uninitializedComponentsProvider) throw new FirestoreError(
|
|
18596
|
+
if (t._uninitializedComponentsProvider) throw new FirestoreError(D.FAILED_PRECONDITION, "SDK cache is already specified.");
|
|
18597
18597
|
__PRIVATE_logWarn("enableMultiTabIndexedDbPersistence() will be deprecated in the future, you can use `FirestoreSettings.cache` instead.");
|
|
18598
18598
|
const n = e._freezeSettings(), r = new OnlineComponentProvider;
|
|
18599
18599
|
return __PRIVATE_setPersistenceProviders(t, r, new __PRIVATE_MultiTabOfflineComponentProvider(r, n.cacheSizeBytes));
|
|
@@ -18641,7 +18641,7 @@ function __PRIVATE_configureFirestore(e) {
|
|
|
18641
18641
|
* @returns A `Promise` that is resolved when the persistent storage is
|
|
18642
18642
|
* cleared. Otherwise, the promise is rejected with an error.
|
|
18643
18643
|
*/ function clearIndexedDbPersistence(e) {
|
|
18644
|
-
if (e._initialized && !e._terminated) throw new FirestoreError(
|
|
18644
|
+
if (e._initialized && !e._terminated) throw new FirestoreError(D.FAILED_PRECONDITION, "Persistence can only be cleared before a Firestore instance is initialized or after it is terminated.");
|
|
18645
18645
|
const t = new __PRIVATE_Deferred;
|
|
18646
18646
|
return e._queue.enqueueAndForgetEvenWhileRestricted((async () => {
|
|
18647
18647
|
try {
|
|
@@ -18755,7 +18755,7 @@ function __PRIVATE_configureFirestore(e) {
|
|
|
18755
18755
|
}
|
|
18756
18756
|
|
|
18757
18757
|
function __PRIVATE_verifyNotInitialized(e) {
|
|
18758
|
-
if (e._initialized || e._terminated) throw new FirestoreError(
|
|
18758
|
+
if (e._initialized || e._terminated) throw new FirestoreError(D.FAILED_PRECONDITION, "Firestore has already been started and persistence can no longer be enabled. You can only enable persistence before calling any other methods on a Firestore object.");
|
|
18759
18759
|
}
|
|
18760
18760
|
|
|
18761
18761
|
/**
|
|
@@ -18866,7 +18866,7 @@ class AggregateField {
|
|
|
18866
18866
|
try {
|
|
18867
18867
|
return new Bytes(ByteString.fromBase64String(e));
|
|
18868
18868
|
} catch (e) {
|
|
18869
|
-
throw new FirestoreError(
|
|
18869
|
+
throw new FirestoreError(D.INVALID_ARGUMENT, "Failed to construct data from Base64 string: " + e);
|
|
18870
18870
|
}
|
|
18871
18871
|
}
|
|
18872
18872
|
/**
|
|
@@ -18938,7 +18938,7 @@ class AggregateField {
|
|
|
18938
18938
|
* @param fieldNames - A list of field names.
|
|
18939
18939
|
*/
|
|
18940
18940
|
constructor(...e) {
|
|
18941
|
-
for (let t = 0; t < e.length; ++t) if (0 === e[t].length) throw new FirestoreError(
|
|
18941
|
+
for (let t = 0; t < e.length; ++t) if (0 === e[t].length) throw new FirestoreError(D.INVALID_ARGUMENT, "Invalid field name at argument $(i + 1). Field names must not be empty.");
|
|
18942
18942
|
this._internalPath = new FieldPath$1(e);
|
|
18943
18943
|
}
|
|
18944
18944
|
/**
|
|
@@ -19017,8 +19017,8 @@ class AggregateField {
|
|
|
19017
19017
|
* @param longitude - The longitude as number between -180 and 180.
|
|
19018
19018
|
*/
|
|
19019
19019
|
constructor(e, t) {
|
|
19020
|
-
if (!isFinite(e) || e < -90 || e > 90) throw new FirestoreError(
|
|
19021
|
-
if (!isFinite(t) || t < -180 || t > 180) throw new FirestoreError(
|
|
19020
|
+
if (!isFinite(e) || e < -90 || e > 90) throw new FirestoreError(D.INVALID_ARGUMENT, "Latitude must be a number between -90 and 90, but was: " + e);
|
|
19021
|
+
if (!isFinite(t) || t < -180 || t > 180) throw new FirestoreError(D.INVALID_ARGUMENT, "Longitude must be a number between -180 and 180, but was: " + t);
|
|
19022
19022
|
this._lat = e, this._long = t;
|
|
19023
19023
|
}
|
|
19024
19024
|
/**
|
|
@@ -19068,7 +19068,7 @@ class AggregateField {
|
|
|
19068
19068
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19069
19069
|
* See the License for the specific language governing permissions and
|
|
19070
19070
|
* limitations under the License.
|
|
19071
|
-
*/ const
|
|
19071
|
+
*/ const ge = /^__.*__$/;
|
|
19072
19072
|
|
|
19073
19073
|
/** The result of parsing document data (e.g. for a setData call). */ class ParsedSetData {
|
|
19074
19074
|
constructor(e, t, n) {
|
|
@@ -19179,7 +19179,7 @@ function __PRIVATE_isWrite(e) {
|
|
|
19179
19179
|
}
|
|
19180
19180
|
Tu(e) {
|
|
19181
19181
|
if (0 === e.length) throw this.Au("Document fields must not be empty");
|
|
19182
|
-
if (__PRIVATE_isWrite(this.lu) &&
|
|
19182
|
+
if (__PRIVATE_isWrite(this.lu) && ge.test(e)) throw this.Au('Document fields cannot begin and end with "__"');
|
|
19183
19183
|
}
|
|
19184
19184
|
}
|
|
19185
19185
|
|
|
@@ -19216,7 +19216,7 @@ function __PRIVATE_newUserDataReader(e) {
|
|
|
19216
19216
|
const e = [];
|
|
19217
19217
|
for (const r of s.mergeFields) {
|
|
19218
19218
|
const i = __PRIVATE_fieldPathFromArgument$1(t, r, n);
|
|
19219
|
-
if (!o.contains(i)) throw new FirestoreError(
|
|
19219
|
+
if (!o.contains(i)) throw new FirestoreError(D.INVALID_ARGUMENT, `Field '${i}' is specified in your field mask but missing from your input data.`);
|
|
19220
19220
|
__PRIVATE_fieldMaskContains(e, i) || e.push(i);
|
|
19221
19221
|
}
|
|
19222
19222
|
a = new FieldMask(e), u = o.fieldTransforms.filter((e => a.covers(e.field)));
|
|
@@ -19336,7 +19336,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
|
|
|
19336
19336
|
|
|
19337
19337
|
/** Parse update data from a list of field/value arguments. */ function __PRIVATE_parseUpdateVarargs(e, t, n, r, i, s) {
|
|
19338
19338
|
const o = e.mu(1 /* UserDataSource.Update */ , t, n), _ = [ __PRIVATE_fieldPathFromArgument$1(t, r, n) ], a = [ i ];
|
|
19339
|
-
if (s.length % 2 != 0) throw new FirestoreError(
|
|
19339
|
+
if (s.length % 2 != 0) throw new FirestoreError(D.INVALID_ARGUMENT, `Function ${t}() needs to be called with an even number of arguments that alternate between field names and values.`);
|
|
19340
19340
|
for (let e = 0; e < s.length; e += 2) _.push(__PRIVATE_fieldPathFromArgument$1(t, s[e])),
|
|
19341
19341
|
a.push(s[e + 1]);
|
|
19342
19342
|
const u = [], c = ObjectValue.empty();
|
|
@@ -19537,7 +19537,7 @@ function __PRIVATE_validatePlainObject(e, t, n) {
|
|
|
19537
19537
|
|
|
19538
19538
|
/**
|
|
19539
19539
|
* Matches any characters in a field path string that are reserved.
|
|
19540
|
-
*/ const
|
|
19540
|
+
*/ const pe = new RegExp("[~\\*/\\[\\]]");
|
|
19541
19541
|
|
|
19542
19542
|
/**
|
|
19543
19543
|
* Wraps fromDotSeparatedString with an error message about the method that
|
|
@@ -19548,7 +19548,7 @@ function __PRIVATE_validatePlainObject(e, t, n) {
|
|
|
19548
19548
|
* @param targetDoc - The document against which the field path will be
|
|
19549
19549
|
* evaluated.
|
|
19550
19550
|
*/ function __PRIVATE_fieldPathFromDotSeparatedString(e, t, n) {
|
|
19551
|
-
if (t.search(
|
|
19551
|
+
if (t.search(pe) >= 0) throw __PRIVATE_createError(`Invalid field path (${t}). Paths must not contain '~', '*', '/', '[', or ']'`, e,
|
|
19552
19552
|
/* hasConverter= */ !1,
|
|
19553
19553
|
/* path= */ void 0, n);
|
|
19554
19554
|
try {
|
|
@@ -19566,7 +19566,7 @@ function __PRIVATE_createError(e, t, n, r, i) {
|
|
|
19566
19566
|
n && (_ += " (via `toFirestore()`)"), _ += ". ";
|
|
19567
19567
|
let a = "";
|
|
19568
19568
|
return (s || o) && (a += " (found", s && (a += ` in field ${r}`), o && (a += ` in document ${i}`),
|
|
19569
|
-
a += ")"), new FirestoreError(
|
|
19569
|
+
a += ")"), new FirestoreError(D.INVALID_ARGUMENT, _ + e + a);
|
|
19570
19570
|
}
|
|
19571
19571
|
|
|
19572
19572
|
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function __PRIVATE_fieldMaskContains(e, t) {
|
|
@@ -19703,7 +19703,7 @@ function __PRIVATE_createError(e, t, n, r, i) {
|
|
|
19703
19703
|
* See the License for the specific language governing permissions and
|
|
19704
19704
|
* limitations under the License.
|
|
19705
19705
|
*/ function __PRIVATE_validateHasExplicitOrderByForLimitToLast(e) {
|
|
19706
|
-
if ("L" /* LimitType.Last */ === e.limitType && 0 === e.explicitOrderBy.length) throw new FirestoreError(
|
|
19706
|
+
if ("L" /* LimitType.Last */ === e.limitType && 0 === e.explicitOrderBy.length) throw new FirestoreError(D.UNIMPLEMENTED, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
19707
19707
|
}
|
|
19708
19708
|
|
|
19709
19709
|
/**
|
|
@@ -19724,7 +19724,7 @@ function query(e, t, ...n) {
|
|
|
19724
19724
|
let r = [];
|
|
19725
19725
|
t instanceof AppliableConstraint && r.push(t), r = r.concat(n), function __PRIVATE_validateQueryConstraintArray(e) {
|
|
19726
19726
|
const t = e.filter((e => e instanceof QueryCompositeFilterConstraint)).length, n = e.filter((e => e instanceof QueryFieldFilterConstraint)).length;
|
|
19727
|
-
if (t > 1 || t > 0 && n > 0) throw new FirestoreError(
|
|
19727
|
+
if (t > 1 || t > 0 && n > 0) throw new FirestoreError(D.INVALID_ARGUMENT, "InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.");
|
|
19728
19728
|
}
|
|
19729
19729
|
/**
|
|
19730
19730
|
* @license
|
|
@@ -19778,7 +19778,7 @@ function query(e, t, ...n) {
|
|
|
19778
19778
|
const t = __PRIVATE_newUserDataReader(e.firestore), n = function __PRIVATE_newQueryFilter(e, t, n, r, i, s, o) {
|
|
19779
19779
|
let _;
|
|
19780
19780
|
if (i.isKeyField()) {
|
|
19781
|
-
if ("array-contains" /* Operator.ARRAY_CONTAINS */ === s || "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ === s) throw new FirestoreError(
|
|
19781
|
+
if ("array-contains" /* Operator.ARRAY_CONTAINS */ === s || "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ === s) throw new FirestoreError(D.INVALID_ARGUMENT, `Invalid Query. You can't perform '${s}' queries on documentId().`);
|
|
19782
19782
|
if ("in" /* Operator.IN */ === s || "not-in" /* Operator.NOT_IN */ === s) {
|
|
19783
19783
|
__PRIVATE_validateDisjunctiveFilterElements(o, s);
|
|
19784
19784
|
const t = [];
|
|
@@ -19905,8 +19905,8 @@ function query(e, t, ...n) {
|
|
|
19905
19905
|
}
|
|
19906
19906
|
_apply(e) {
|
|
19907
19907
|
const t = function __PRIVATE_newQueryOrderBy(e, t, n) {
|
|
19908
|
-
if (null !== e.startAt) throw new FirestoreError(
|
|
19909
|
-
if (null !== e.endAt) throw new FirestoreError(
|
|
19908
|
+
if (null !== e.startAt) throw new FirestoreError(D.INVALID_ARGUMENT, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
|
|
19909
|
+
if (null !== e.endAt) throw new FirestoreError(D.INVALID_ARGUMENT, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
|
|
19910
19910
|
const r = new OrderBy(t, n);
|
|
19911
19911
|
return function __PRIVATE_validateNewOrderBy(e, t) {
|
|
19912
19912
|
if (null === __PRIVATE_getFirstOrderByField(e)) {
|
|
@@ -20071,7 +20071,7 @@ function endAt(...e) {
|
|
|
20071
20071
|
|
|
20072
20072
|
/** Helper function to create a bound from a document or fields */ function __PRIVATE_newQueryBoundFromDocOrFields(e, t, n, r) {
|
|
20073
20073
|
if (n[0] = util.getModularInstance(n[0]), n[0] instanceof DocumentSnapshot$1) return function __PRIVATE_newQueryBoundFromDocument(e, t, n, r, i) {
|
|
20074
|
-
if (!r) throw new FirestoreError(
|
|
20074
|
+
if (!r) throw new FirestoreError(D.NOT_FOUND, `Can't use a DocumentSnapshot that doesn't exist for ${n}().`);
|
|
20075
20075
|
const s = [];
|
|
20076
20076
|
// Because people expect to continue/end a query at the exact document
|
|
20077
20077
|
// provided, we need to use the implicit sort order rather than the explicit
|
|
@@ -20082,10 +20082,10 @@ function endAt(...e) {
|
|
|
20082
20082
|
// results.
|
|
20083
20083
|
for (const n of __PRIVATE_queryNormalizedOrderBy(e)) if (n.field.isKeyField()) s.push(__PRIVATE_refValue(t, r.key)); else {
|
|
20084
20084
|
const e = r.data.field(n.field);
|
|
20085
|
-
if (__PRIVATE_isServerTimestamp(e)) throw new FirestoreError(
|
|
20085
|
+
if (__PRIVATE_isServerTimestamp(e)) throw new FirestoreError(D.INVALID_ARGUMENT, 'Invalid query. You are trying to start or end a query using a document for which the field "' + n.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');
|
|
20086
20086
|
if (null === e) {
|
|
20087
20087
|
const e = n.field.canonicalString();
|
|
20088
|
-
throw new FirestoreError(
|
|
20088
|
+
throw new FirestoreError(D.INVALID_ARGUMENT, `Invalid query. You are trying to start or end a query using a document for which the field '${e}' (used as the orderBy) does not exist.`);
|
|
20089
20089
|
}
|
|
20090
20090
|
s.push(e);
|
|
20091
20091
|
}
|
|
@@ -20099,15 +20099,15 @@ function endAt(...e) {
|
|
|
20099
20099
|
return function __PRIVATE_newQueryBoundFromFields(e, t, n, r, i, s) {
|
|
20100
20100
|
// Use explicit order by's because it has to match the query the user made
|
|
20101
20101
|
const o = e.explicitOrderBy;
|
|
20102
|
-
if (i.length > o.length) throw new FirestoreError(
|
|
20102
|
+
if (i.length > o.length) throw new FirestoreError(D.INVALID_ARGUMENT, `Too many arguments provided to ${r}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);
|
|
20103
20103
|
const _ = [];
|
|
20104
20104
|
for (let s = 0; s < i.length; s++) {
|
|
20105
20105
|
const a = i[s];
|
|
20106
20106
|
if (o[s].field.isKeyField()) {
|
|
20107
|
-
if ("string" != typeof a) throw new FirestoreError(
|
|
20108
|
-
if (!__PRIVATE_isCollectionGroupQuery(e) && -1 !== a.indexOf("/")) throw new FirestoreError(
|
|
20107
|
+
if ("string" != typeof a) throw new FirestoreError(D.INVALID_ARGUMENT, `Invalid query. Expected a string for document ID in ${r}(), but got a ${typeof a}`);
|
|
20108
|
+
if (!__PRIVATE_isCollectionGroupQuery(e) && -1 !== a.indexOf("/")) throw new FirestoreError(D.INVALID_ARGUMENT, `Invalid query. When querying a collection and ordering by documentId(), the value passed to ${r}() must be a plain document ID, but '${a}' contains a slash.`);
|
|
20109
20109
|
const n = e.path.child(ResourcePath.fromString(a));
|
|
20110
|
-
if (!DocumentKey.isDocumentKey(n)) throw new FirestoreError(
|
|
20110
|
+
if (!DocumentKey.isDocumentKey(n)) throw new FirestoreError(D.INVALID_ARGUMENT, `Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${r}() must result in a valid document path, but '${n}' is not because it contains an odd number of segments.`);
|
|
20111
20111
|
const i = new DocumentKey(n);
|
|
20112
20112
|
_.push(__PRIVATE_refValue(t, i));
|
|
20113
20113
|
} else {
|
|
@@ -20127,21 +20127,21 @@ function endAt(...e) {
|
|
|
20127
20127
|
|
|
20128
20128
|
function __PRIVATE_parseDocumentIdValue(e, t, n) {
|
|
20129
20129
|
if ("string" == typeof (n = util.getModularInstance(n))) {
|
|
20130
|
-
if ("" === n) throw new FirestoreError(
|
|
20131
|
-
if (!__PRIVATE_isCollectionGroupQuery(t) && -1 !== n.indexOf("/")) throw new FirestoreError(
|
|
20130
|
+
if ("" === n) throw new FirestoreError(D.INVALID_ARGUMENT, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
|
|
20131
|
+
if (!__PRIVATE_isCollectionGroupQuery(t) && -1 !== n.indexOf("/")) throw new FirestoreError(D.INVALID_ARGUMENT, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);
|
|
20132
20132
|
const r = t.path.child(ResourcePath.fromString(n));
|
|
20133
|
-
if (!DocumentKey.isDocumentKey(r)) throw new FirestoreError(
|
|
20133
|
+
if (!DocumentKey.isDocumentKey(r)) throw new FirestoreError(D.INVALID_ARGUMENT, `Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);
|
|
20134
20134
|
return __PRIVATE_refValue(e, new DocumentKey(r));
|
|
20135
20135
|
}
|
|
20136
20136
|
if (n instanceof DocumentReference) return __PRIVATE_refValue(e, n._key);
|
|
20137
|
-
throw new FirestoreError(
|
|
20137
|
+
throw new FirestoreError(D.INVALID_ARGUMENT, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${__PRIVATE_valueDescription(n)}.`);
|
|
20138
20138
|
}
|
|
20139
20139
|
|
|
20140
20140
|
/**
|
|
20141
20141
|
* Validates that the value passed into a disjunctive filter satisfies all
|
|
20142
20142
|
* array requirements.
|
|
20143
20143
|
*/ function __PRIVATE_validateDisjunctiveFilterElements(e, t) {
|
|
20144
|
-
if (!Array.isArray(e) || 0 === e.length) throw new FirestoreError(
|
|
20144
|
+
if (!Array.isArray(e) || 0 === e.length) throw new FirestoreError(D.INVALID_ARGUMENT, `Invalid Query. A non-empty array is required for '${t.toString()}' filters.`);
|
|
20145
20145
|
}
|
|
20146
20146
|
|
|
20147
20147
|
/**
|
|
@@ -20156,7 +20156,7 @@ function __PRIVATE_parseDocumentIdValue(e, t, n) {
|
|
|
20156
20156
|
*/ function __PRIVATE_validateNewFieldFilter(e, t) {
|
|
20157
20157
|
if (t.isInequality()) {
|
|
20158
20158
|
const n = __PRIVATE_getInequalityFilterField(e), r = t.field;
|
|
20159
|
-
if (null !== n && !n.isEqual(r)) throw new FirestoreError(
|
|
20159
|
+
if (null !== n && !n.isEqual(r)) throw new FirestoreError(D.INVALID_ARGUMENT, `Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${n.toString()}' and '${r.toString()}'`);
|
|
20160
20160
|
const i = __PRIVATE_getFirstOrderByField(e);
|
|
20161
20161
|
null !== i && __PRIVATE_validateOrderByAndInequalityMatch(e, r, i);
|
|
20162
20162
|
}
|
|
@@ -20181,15 +20181,15 @@ function __PRIVATE_parseDocumentIdValue(e, t, n) {
|
|
|
20181
20181
|
}(t.op));
|
|
20182
20182
|
if (null !== n)
|
|
20183
20183
|
// Special case when it's a duplicate op to give a slightly clearer error message.
|
|
20184
|
-
throw n === t.op ? new FirestoreError(
|
|
20184
|
+
throw n === t.op ? new FirestoreError(D.INVALID_ARGUMENT, `Invalid query. You cannot use more than one '${t.op.toString()}' filter.`) : new FirestoreError(D.INVALID_ARGUMENT, `Invalid query. You cannot use '${t.op.toString()}' filters with '${n.toString()}' filters.`);
|
|
20185
20185
|
}
|
|
20186
20186
|
|
|
20187
20187
|
function __PRIVATE_validateOrderByAndInequalityMatch(e, t, n) {
|
|
20188
|
-
if (!n.isEqual(t)) throw new FirestoreError(
|
|
20188
|
+
if (!n.isEqual(t)) throw new FirestoreError(D.INVALID_ARGUMENT, `Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${t.toString()}' and so you must also use '${t.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${n.toString()}' instead.`);
|
|
20189
20189
|
}
|
|
20190
20190
|
|
|
20191
20191
|
function __PRIVATE_validateQueryFilterConstraint(e, t) {
|
|
20192
|
-
if (!(t instanceof QueryFieldFilterConstraint || t instanceof QueryCompositeFilterConstraint)) throw new FirestoreError(
|
|
20192
|
+
if (!(t instanceof QueryFieldFilterConstraint || t instanceof QueryCompositeFilterConstraint)) throw new FirestoreError(D.INVALID_ARGUMENT, `Function ${e}() requires AppliableConstraints created with a call to 'where(...)', 'or(...)', or 'and(...)'.`);
|
|
20193
20193
|
}
|
|
20194
20194
|
|
|
20195
20195
|
class AbstractUserDataWriter {
|
|
@@ -20565,7 +20565,7 @@ class __PRIVATE_LiteUserDataWriter extends AbstractUserDataWriter {
|
|
|
20565
20565
|
* snapshot events.
|
|
20566
20566
|
*/ docChanges(e = {}) {
|
|
20567
20567
|
const t = !!e.includeMetadataChanges;
|
|
20568
|
-
if (t && this._snapshot.excludesMetadataChanges) throw new FirestoreError(
|
|
20568
|
+
if (t && this._snapshot.excludesMetadataChanges) throw new FirestoreError(D.INVALID_ARGUMENT, "To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");
|
|
20569
20569
|
return this._cachedChanges && this._cachedChangesIncludeMetadataChanges === t || (this._cachedChanges =
|
|
20570
20570
|
/** Calculates the array of `DocumentChange`s for a given `ViewSnapshot`. */
|
|
20571
20571
|
function __PRIVATE_changesFromSnapshot(e, t) {
|
|
@@ -21123,7 +21123,7 @@ class __PRIVATE_MultiTabManagerImpl {
|
|
|
21123
21123
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21124
21124
|
* See the License for the specific language governing permissions and
|
|
21125
21125
|
* limitations under the License.
|
|
21126
|
-
*/ const
|
|
21126
|
+
*/ const ye = {
|
|
21127
21127
|
maxAttempts: 5
|
|
21128
21128
|
};
|
|
21129
21129
|
|
|
@@ -21197,12 +21197,12 @@ class WriteBatch {
|
|
|
21197
21197
|
return this._verifyNotCommitted(), this._committed = !0, this._mutations.length > 0 ? this._commitHandler(this._mutations) : Promise.resolve();
|
|
21198
21198
|
}
|
|
21199
21199
|
_verifyNotCommitted() {
|
|
21200
|
-
if (this._committed) throw new FirestoreError(
|
|
21200
|
+
if (this._committed) throw new FirestoreError(D.FAILED_PRECONDITION, "A write batch can no longer be used after commit() has been called.");
|
|
21201
21201
|
}
|
|
21202
21202
|
}
|
|
21203
21203
|
|
|
21204
21204
|
function __PRIVATE_validateReference(e, t) {
|
|
21205
|
-
if ((e = util.getModularInstance(e)).firestore !== t) throw new FirestoreError(
|
|
21205
|
+
if ((e = util.getModularInstance(e)).firestore !== t) throw new FirestoreError(D.INVALID_ARGUMENT, "Provided document reference is from a different Firestore instance.");
|
|
21206
21206
|
return e;
|
|
21207
21207
|
}
|
|
21208
21208
|
|
|
@@ -21335,9 +21335,9 @@ class Transaction extends class Transaction$1 {
|
|
|
21335
21335
|
* rejected promise with the corresponding failure error is returned.
|
|
21336
21336
|
*/ function runTransaction(e, t, n) {
|
|
21337
21337
|
e = __PRIVATE_cast(e, Firestore);
|
|
21338
|
-
const r = Object.assign(Object.assign({},
|
|
21338
|
+
const r = Object.assign(Object.assign({}, ye), n);
|
|
21339
21339
|
!function __PRIVATE_validateTransactionOptions(e) {
|
|
21340
|
-
if (e.maxAttempts < 1) throw new FirestoreError(
|
|
21340
|
+
if (e.maxAttempts < 1) throw new FirestoreError(D.INVALID_ARGUMENT, "Max attempts must be at least 1");
|
|
21341
21341
|
}(r);
|
|
21342
21342
|
return function __PRIVATE_firestoreClientTransaction(e, t, n) {
|
|
21343
21343
|
const r = new __PRIVATE_Deferred;
|
|
@@ -21491,7 +21491,7 @@ class Transaction extends class Transaction$1 {
|
|
|
21491
21491
|
try {
|
|
21492
21492
|
return JSON.parse(e);
|
|
21493
21493
|
} catch (e) {
|
|
21494
|
-
throw new FirestoreError(
|
|
21494
|
+
throw new FirestoreError(D.INVALID_ARGUMENT, "Failed to parse JSON: " + (null == e ? void 0 : e.message));
|
|
21495
21495
|
}
|
|
21496
21496
|
}(e) : e, n = [];
|
|
21497
21497
|
if (Array.isArray(t.indexes)) for (const e of t.indexes) {
|
|
@@ -21508,7 +21508,7 @@ class Transaction extends class Transaction$1 {
|
|
|
21508
21508
|
}
|
|
21509
21509
|
|
|
21510
21510
|
function __PRIVATE_tryGetString(e, t) {
|
|
21511
|
-
if ("string" != typeof e[t]) throw new FirestoreError(
|
|
21511
|
+
if ("string" != typeof e[t]) throw new FirestoreError(D.INVALID_ARGUMENT, "Missing string value for: " + t);
|
|
21512
21512
|
return e[t];
|
|
21513
21513
|
}
|
|
21514
21514
|
|
|
@@ -21563,10 +21563,10 @@ function __PRIVATE_tryGetString(e, t) {
|
|
|
21563
21563
|
this.pu = new Map;
|
|
21564
21564
|
}
|
|
21565
21565
|
static get instance() {
|
|
21566
|
-
return
|
|
21567
|
-
if (
|
|
21568
|
-
|
|
21569
|
-
}(
|
|
21566
|
+
return we || (we = new __PRIVATE_TestingHooksSpiImpl, function __PRIVATE_setTestingHooksSpi(e) {
|
|
21567
|
+
if (ce) throw new Error("a TestingHooksSpi instance is already set");
|
|
21568
|
+
ce = e;
|
|
21569
|
+
}(we)), we;
|
|
21570
21570
|
}
|
|
21571
21571
|
it(e) {
|
|
21572
21572
|
this.pu.forEach((t => t(e)));
|
|
@@ -21577,7 +21577,7 @@ function __PRIVATE_tryGetString(e, t) {
|
|
|
21577
21577
|
}
|
|
21578
21578
|
}
|
|
21579
21579
|
|
|
21580
|
-
let
|
|
21580
|
+
let we = null;
|
|
21581
21581
|
|
|
21582
21582
|
/**
|
|
21583
21583
|
* Cloud Firestore
|
|
@@ -21585,25 +21585,25 @@ let Se = null;
|
|
|
21585
21585
|
* @packageDocumentation
|
|
21586
21586
|
*/ !function __PRIVATE_registerFirestore(e, t = !0) {
|
|
21587
21587
|
!function __PRIVATE_setSDKVersion(e) {
|
|
21588
|
-
|
|
21588
|
+
S = e;
|
|
21589
21589
|
}(app.SDK_VERSION), app._registerComponent(new component.Component("firestore", ((e, {instanceIdentifier: n, options: r}) => {
|
|
21590
21590
|
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) {
|
|
21591
|
-
if (!Object.prototype.hasOwnProperty.apply(e.options, [ "projectId" ])) throw new FirestoreError(
|
|
21591
|
+
if (!Object.prototype.hasOwnProperty.apply(e.options, [ "projectId" ])) throw new FirestoreError(D.INVALID_ARGUMENT, '"projectId" not provided in firebase.initializeApp.');
|
|
21592
21592
|
return new DatabaseId(e.options.projectId, t);
|
|
21593
21593
|
}(i, n), i);
|
|
21594
21594
|
return r = Object.assign({
|
|
21595
21595
|
useFetchStreams: t
|
|
21596
21596
|
}, r), s._setSettings(r), s;
|
|
21597
|
-
}), "PUBLIC").setMultipleInstances(!0)), app.registerVersion(
|
|
21597
|
+
}), "PUBLIC").setMultipleInstances(!0)), app.registerVersion(w, "4.1.2-20230822180558", e),
|
|
21598
21598
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
|
21599
|
-
app.registerVersion(
|
|
21599
|
+
app.registerVersion(w, "4.1.2-20230822180558", "cjs2017");
|
|
21600
21600
|
}();
|
|
21601
21601
|
|
|
21602
21602
|
exports.AbstractUserDataWriter = AbstractUserDataWriter;
|
|
21603
21603
|
exports.AggregateField = AggregateField;
|
|
21604
21604
|
exports.AggregateQuerySnapshot = AggregateQuerySnapshot;
|
|
21605
21605
|
exports.Bytes = Bytes;
|
|
21606
|
-
exports.CACHE_SIZE_UNLIMITED =
|
|
21606
|
+
exports.CACHE_SIZE_UNLIMITED = fe;
|
|
21607
21607
|
exports.CollectionReference = CollectionReference;
|
|
21608
21608
|
exports.DocumentReference = DocumentReference;
|
|
21609
21609
|
exports.DocumentSnapshot = DocumentSnapshot;
|