@firebase/firestore 3.11.0 → 3.12.0-20230511201449
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/CHANGELOG.md +13 -0
- package/dist/firestore/src/api/long_polling_options.d.ts +55 -0
- package/dist/firestore/src/api/settings.d.ts +16 -2
- package/dist/firestore/src/api.d.ts +1 -0
- package/dist/firestore/src/core/database_info.d.ts +4 -1
- package/dist/firestore/src/lite-api/settings.d.ts +3 -0
- package/dist/firestore/src/platform/browser/webchannel_connection.d.ts +1 -0
- package/dist/firestore/test/unit/api/long_polling_options.test.d.ts +17 -0
- package/dist/index.cjs.js +1222 -1181
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +61 -2
- package/dist/index.esm2017.js +1137 -1096
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +1041 -1021
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +71 -6
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +71 -6
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +868 -827
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +67 -3
- package/dist/lite/firestore/src/api/long_polling_options.d.ts +55 -0
- package/dist/lite/firestore/src/api/settings.d.ts +16 -2
- package/dist/lite/firestore/src/api.d.ts +1 -0
- package/dist/lite/firestore/src/core/database_info.d.ts +4 -1
- package/dist/lite/firestore/src/lite-api/settings.d.ts +3 -0
- package/dist/lite/firestore/src/platform/browser/webchannel_connection.d.ts +1 -0
- package/dist/lite/firestore/test/unit/api/long_polling_options.test.d.ts +17 -0
- package/dist/lite/index.browser.esm2017.js +756 -716
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +764 -745
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.cjs.js +756 -716
- package/dist/lite/index.cjs.js.map +1 -1
- package/dist/lite/index.node.cjs.js +71 -6
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +71 -6
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +763 -723
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +52 -1
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +127 -144
- package/dist/lite/packages/firestore/src/api/long_polling_options.d.ts +55 -0
- package/dist/lite/packages/firestore/src/api/settings.d.ts +16 -2
- package/dist/lite/packages/firestore/src/api.d.ts +1 -0
- package/dist/lite/packages/firestore/src/core/database_info.d.ts +4 -1
- package/dist/lite/packages/firestore/src/lite-api/settings.d.ts +3 -0
- package/dist/lite/packages/firestore/src/platform/browser/webchannel_connection.d.ts +1 -0
- package/dist/lite/packages/firestore/test/unit/api/long_polling_options.test.d.ts +17 -0
- package/dist/lite/private.d.ts +52 -1
- package/dist/packages/firestore/dist/index.esm2017.d.ts +275 -292
- package/dist/packages/firestore/src/api/long_polling_options.d.ts +55 -0
- package/dist/packages/firestore/src/api/settings.d.ts +16 -2
- package/dist/packages/firestore/src/api.d.ts +1 -0
- package/dist/packages/firestore/src/core/database_info.d.ts +4 -1
- package/dist/packages/firestore/src/lite-api/settings.d.ts +3 -0
- package/dist/packages/firestore/src/platform/browser/webchannel_connection.d.ts +1 -0
- package/dist/packages/firestore/test/unit/api/long_polling_options.test.d.ts +17 -0
- package/dist/private.d.ts +67 -3
- package/package.json +5 -5
|
@@ -63,7 +63,7 @@ d.MOCK_USER = new d("mock-user");
|
|
|
63
63
|
* See the License for the specific language governing permissions and
|
|
64
64
|
* limitations under the License.
|
|
65
65
|
*/
|
|
66
|
-
let w = "9.
|
|
66
|
+
let w = "9.22.0-20230511201449";
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* @license
|
|
@@ -218,7 +218,7 @@ e) {
|
|
|
218
218
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
219
219
|
* See the License for the specific language governing permissions and
|
|
220
220
|
* limitations under the License.
|
|
221
|
-
*/ const T = "ok", A = "cancelled", R = "unknown", P = "invalid-argument", V = "deadline-exceeded", $ = "not-found",
|
|
221
|
+
*/ const T = "ok", A = "cancelled", R = "unknown", P = "invalid-argument", V = "deadline-exceeded", $ = "not-found", N = "already-exists", D = "permission-denied", F = "unauthenticated", x = "resource-exhausted", S = "failed-precondition", q = "aborted", O = "out-of-range", k = "unimplemented", C = "internal", M = "unavailable", L = "data-loss";
|
|
222
222
|
|
|
223
223
|
/** An error returned by a Firestore operation. */ class U extends FirebaseError {
|
|
224
224
|
/** @hideconstructor */
|
|
@@ -441,12 +441,14 @@ class J {
|
|
|
441
441
|
* when using WebChannel as the network transport.
|
|
442
442
|
* @param autoDetectLongPolling - Whether to use the detectBufferingProxy
|
|
443
443
|
* option when using WebChannel as the network transport.
|
|
444
|
+
* @param longPollingOptions Options that configure long-polling.
|
|
444
445
|
* @param useFetchStreams Whether to use the Fetch API instead of
|
|
445
446
|
* XMLHTTPRequest
|
|
446
447
|
*/
|
|
447
|
-
constructor(t, e, n, r, s, i, o, u) {
|
|
448
|
+
constructor(t, e, n, r, s, i, o, u, c) {
|
|
448
449
|
this.databaseId = t, this.appId = e, this.persistenceKey = n, this.host = r, this.ssl = s,
|
|
449
|
-
this.forceLongPolling = i, this.autoDetectLongPolling = o, this.
|
|
450
|
+
this.forceLongPolling = i, this.autoDetectLongPolling = o, this.longPollingOptions = u,
|
|
451
|
+
this.useFetchStreams = c;
|
|
450
452
|
}
|
|
451
453
|
}
|
|
452
454
|
|
|
@@ -800,6 +802,34 @@ function at(t, e) {
|
|
|
800
802
|
if (e <= 0) throw new U(P, `Function ${t}() requires a positive number, but it was: ${e}.`);
|
|
801
803
|
}
|
|
802
804
|
|
|
805
|
+
/**
|
|
806
|
+
* @license
|
|
807
|
+
* Copyright 2023 Google LLC
|
|
808
|
+
*
|
|
809
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
810
|
+
* you may not use this file except in compliance with the License.
|
|
811
|
+
* You may obtain a copy of the License at
|
|
812
|
+
*
|
|
813
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
814
|
+
*
|
|
815
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
816
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
817
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
818
|
+
* See the License for the specific language governing permissions and
|
|
819
|
+
* limitations under the License.
|
|
820
|
+
*/
|
|
821
|
+
/**
|
|
822
|
+
* Compares two `ExperimentalLongPollingOptions` objects for equality.
|
|
823
|
+
*/
|
|
824
|
+
/**
|
|
825
|
+
* Creates and returns a new `ExperimentalLongPollingOptions` with the same
|
|
826
|
+
* option values as the given instance.
|
|
827
|
+
*/
|
|
828
|
+
function ht(t) {
|
|
829
|
+
const e = {};
|
|
830
|
+
return void 0 !== t.timeoutSeconds && (e.timeoutSeconds = t.timeoutSeconds), e;
|
|
831
|
+
}
|
|
832
|
+
|
|
803
833
|
/**
|
|
804
834
|
* @license
|
|
805
835
|
* Copyright 2023 Google LLC
|
|
@@ -819,7 +849,7 @@ function at(t, e) {
|
|
|
819
849
|
/**
|
|
820
850
|
* The value returned from the most recent invocation of
|
|
821
851
|
* `generateUniqueDebugId()`, or null if it has never been invoked.
|
|
822
|
-
*/ let
|
|
852
|
+
*/ let lt = null;
|
|
823
853
|
|
|
824
854
|
/**
|
|
825
855
|
* Generates and returns an initial value for `lastUniqueDebugId`.
|
|
@@ -843,9 +873,9 @@ function at(t, e) {
|
|
|
843
873
|
*
|
|
844
874
|
* @return the 10-character generated ID (e.g. "0xa1b2c3d4").
|
|
845
875
|
*/
|
|
846
|
-
function
|
|
847
|
-
return null ===
|
|
848
|
-
"0x" +
|
|
876
|
+
function ft() {
|
|
877
|
+
return null === lt ? lt = 268435456 + Math.round(2147483648 * Math.random()) : lt++,
|
|
878
|
+
"0x" + lt.toString(16);
|
|
849
879
|
}
|
|
850
880
|
|
|
851
881
|
/**
|
|
@@ -866,11 +896,11 @@ function lt() {
|
|
|
866
896
|
*/
|
|
867
897
|
/**
|
|
868
898
|
* Returns whether a variable is either undefined or null.
|
|
869
|
-
*/ function
|
|
899
|
+
*/ function dt(t) {
|
|
870
900
|
return null == t;
|
|
871
901
|
}
|
|
872
902
|
|
|
873
|
-
/** Returns whether the value represents -0. */ function
|
|
903
|
+
/** Returns whether the value represents -0. */ function wt(t) {
|
|
874
904
|
// Detect if the value is -0.0. Based on polyfill from
|
|
875
905
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
876
906
|
return 0 === t && 1 / t == -1 / 0;
|
|
@@ -896,7 +926,7 @@ function lt() {
|
|
|
896
926
|
* See the License for the specific language governing permissions and
|
|
897
927
|
* limitations under the License.
|
|
898
928
|
*/
|
|
899
|
-
const
|
|
929
|
+
const mt = {
|
|
900
930
|
BatchGetDocuments: "batchGet",
|
|
901
931
|
Commit: "commit",
|
|
902
932
|
RunQuery: "runQuery",
|
|
@@ -934,7 +964,7 @@ const wt = {
|
|
|
934
964
|
* are used for reverse lookups from the webchannel stream. Do NOT change the
|
|
935
965
|
* names of these identifiers or change this into a const enum.
|
|
936
966
|
*/
|
|
937
|
-
var
|
|
967
|
+
var pt, yt;
|
|
938
968
|
|
|
939
969
|
/**
|
|
940
970
|
* Converts an HTTP Status Code to the equivalent error code.
|
|
@@ -943,7 +973,7 @@ var mt, pt;
|
|
|
943
973
|
* @returns The equivalent Code. Unknown status codes are mapped to
|
|
944
974
|
* Code.UNKNOWN.
|
|
945
975
|
*/
|
|
946
|
-
function
|
|
976
|
+
function gt(t) {
|
|
947
977
|
if (void 0 === t) return g("RPC_ERROR", "HTTP error has no status"), R;
|
|
948
978
|
// The canonical error codes for Google APIs [1] specify mapping onto HTTP
|
|
949
979
|
// status codes but the mapping is not bijective. In each case of ambiguity
|
|
@@ -969,7 +999,7 @@ function yt(t) {
|
|
|
969
999
|
|
|
970
1000
|
case 403:
|
|
971
1001
|
// Forbidden
|
|
972
|
-
return
|
|
1002
|
+
return D;
|
|
973
1003
|
|
|
974
1004
|
case 404:
|
|
975
1005
|
// Not Found
|
|
@@ -1036,16 +1066,16 @@ function yt(t) {
|
|
|
1036
1066
|
/**
|
|
1037
1067
|
* A Rest-based connection that relies on the native HTTP stack
|
|
1038
1068
|
* (e.g. `fetch` or a polyfill).
|
|
1039
|
-
*/ (
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1069
|
+
*/ (yt = pt || (pt = {}))[yt.OK = 0] = "OK", yt[yt.CANCELLED = 1] = "CANCELLED",
|
|
1070
|
+
yt[yt.UNKNOWN = 2] = "UNKNOWN", yt[yt.INVALID_ARGUMENT = 3] = "INVALID_ARGUMENT",
|
|
1071
|
+
yt[yt.DEADLINE_EXCEEDED = 4] = "DEADLINE_EXCEEDED", yt[yt.NOT_FOUND = 5] = "NOT_FOUND",
|
|
1072
|
+
yt[yt.ALREADY_EXISTS = 6] = "ALREADY_EXISTS", yt[yt.PERMISSION_DENIED = 7] = "PERMISSION_DENIED",
|
|
1073
|
+
yt[yt.UNAUTHENTICATED = 16] = "UNAUTHENTICATED", yt[yt.RESOURCE_EXHAUSTED = 8] = "RESOURCE_EXHAUSTED",
|
|
1074
|
+
yt[yt.FAILED_PRECONDITION = 9] = "FAILED_PRECONDITION", yt[yt.ABORTED = 10] = "ABORTED",
|
|
1075
|
+
yt[yt.OUT_OF_RANGE = 11] = "OUT_OF_RANGE", yt[yt.UNIMPLEMENTED = 12] = "UNIMPLEMENTED",
|
|
1076
|
+
yt[yt.INTERNAL = 13] = "INTERNAL", yt[yt.UNAVAILABLE = 14] = "UNAVAILABLE", yt[yt.DATA_LOSS = 15] = "DATA_LOSS";
|
|
1047
1077
|
|
|
1048
|
-
class
|
|
1078
|
+
class _t extends
|
|
1049
1079
|
/**
|
|
1050
1080
|
* Base class for all Rest-based connections to the backend (WebChannel and
|
|
1051
1081
|
* HTTP).
|
|
@@ -1062,7 +1092,7 @@ class {
|
|
|
1062
1092
|
return !1;
|
|
1063
1093
|
}
|
|
1064
1094
|
v(t, e, n, r, s) {
|
|
1065
|
-
const i =
|
|
1095
|
+
const i = ft(), o = this.I(t, e);
|
|
1066
1096
|
y("RestConnection", `Sending RPC '${t}' ${i}:`, o, n);
|
|
1067
1097
|
const u = {};
|
|
1068
1098
|
return this.T(u, r, s), this.A(t, o, u, n).then((e => (y("RestConnection", `Received RPC '${t}' ${i}: `, e),
|
|
@@ -1089,7 +1119,7 @@ class {
|
|
|
1089
1119
|
e && e.headers.forEach(((e, n) => t[n] = e)), n && n.headers.forEach(((e, n) => t[n] = e));
|
|
1090
1120
|
}
|
|
1091
1121
|
I(t, e) {
|
|
1092
|
-
const n =
|
|
1122
|
+
const n = mt[t];
|
|
1093
1123
|
return `${this.m}/v1/${e}:${n}`;
|
|
1094
1124
|
}
|
|
1095
1125
|
} {
|
|
@@ -1115,13 +1145,13 @@ class {
|
|
|
1115
1145
|
});
|
|
1116
1146
|
} catch (t) {
|
|
1117
1147
|
const e = t;
|
|
1118
|
-
throw new U(
|
|
1148
|
+
throw new U(gt(e.status), "Request failed with error: " + e.statusText);
|
|
1119
1149
|
}
|
|
1120
1150
|
if (!o.ok) {
|
|
1121
1151
|
let t = await o.json();
|
|
1122
1152
|
Array.isArray(t) && (t = t[0]);
|
|
1123
1153
|
const e = null === (s = null == t ? void 0 : t.error) || void 0 === s ? void 0 : s.message;
|
|
1124
|
-
throw new U(
|
|
1154
|
+
throw new U(gt(o.status), `Request failed with error: ${null != e ? e : o.statusText}`);
|
|
1125
1155
|
}
|
|
1126
1156
|
return o.json();
|
|
1127
1157
|
}
|
|
@@ -1163,7 +1193,7 @@ class {
|
|
|
1163
1193
|
/**
|
|
1164
1194
|
* Concrete implementation of the Aggregate type.
|
|
1165
1195
|
*/
|
|
1166
|
-
class
|
|
1196
|
+
class vt {
|
|
1167
1197
|
constructor(t, e, n) {
|
|
1168
1198
|
this.alias = t, this.$ = e, this.fieldPath = n;
|
|
1169
1199
|
}
|
|
@@ -1189,7 +1219,7 @@ class _t {
|
|
|
1189
1219
|
* Generates `nBytes` of random bytes.
|
|
1190
1220
|
*
|
|
1191
1221
|
* If `nBytes < 0` , an error will be thrown.
|
|
1192
|
-
*/ function
|
|
1222
|
+
*/ function bt(t) {
|
|
1193
1223
|
// Polyfills for IE and WebWorker by using `self` and `msCrypto` when `crypto` is not available.
|
|
1194
1224
|
const e =
|
|
1195
1225
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -1215,14 +1245,14 @@ class _t {
|
|
|
1215
1245
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1216
1246
|
* See the License for the specific language governing permissions and
|
|
1217
1247
|
* limitations under the License.
|
|
1218
|
-
*/ class
|
|
1219
|
-
static
|
|
1248
|
+
*/ class Et {
|
|
1249
|
+
static N() {
|
|
1220
1250
|
// Alphanumeric characters
|
|
1221
1251
|
const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", e = Math.floor(256 / t.length) * t.length;
|
|
1222
1252
|
// The largest byte value that is a multiple of `char.length`.
|
|
1223
1253
|
let n = "";
|
|
1224
1254
|
for (;n.length < 20; ) {
|
|
1225
|
-
const r =
|
|
1255
|
+
const r = bt(40);
|
|
1226
1256
|
for (let s = 0; s < r.length; ++s)
|
|
1227
1257
|
// Only accept values that are [0, maxMultiple), this ensures they can
|
|
1228
1258
|
// be evenly mapped to indices of `chars` via a modulo operation.
|
|
@@ -1232,11 +1262,11 @@ class _t {
|
|
|
1232
1262
|
}
|
|
1233
1263
|
}
|
|
1234
1264
|
|
|
1235
|
-
function
|
|
1265
|
+
function It(t, e) {
|
|
1236
1266
|
return t < e ? -1 : t > e ? 1 : 0;
|
|
1237
1267
|
}
|
|
1238
1268
|
|
|
1239
|
-
/** Helper to compare arrays using isEqual(). */ function
|
|
1269
|
+
/** Helper to compare arrays using isEqual(). */ function Tt(t, e, n) {
|
|
1240
1270
|
return t.length === e.length && t.every(((t, r) => n(t, e[r])));
|
|
1241
1271
|
}
|
|
1242
1272
|
|
|
@@ -1255,13 +1285,13 @@ function Et(t, e) {
|
|
|
1255
1285
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1256
1286
|
* See the License for the specific language governing permissions and
|
|
1257
1287
|
* limitations under the License.
|
|
1258
|
-
*/ function
|
|
1288
|
+
*/ function At(t) {
|
|
1259
1289
|
let e = 0;
|
|
1260
1290
|
for (const n in t) Object.prototype.hasOwnProperty.call(t, n) && e++;
|
|
1261
1291
|
return e;
|
|
1262
1292
|
}
|
|
1263
1293
|
|
|
1264
|
-
function
|
|
1294
|
+
function Rt(t, e) {
|
|
1265
1295
|
for (const n in t) Object.prototype.hasOwnProperty.call(t, n) && e(n, t[n]);
|
|
1266
1296
|
}
|
|
1267
1297
|
|
|
@@ -1284,7 +1314,7 @@ function At(t, e) {
|
|
|
1284
1314
|
/**
|
|
1285
1315
|
* An error encountered while decoding base64 string.
|
|
1286
1316
|
*/
|
|
1287
|
-
class
|
|
1317
|
+
class Pt extends Error {
|
|
1288
1318
|
constructor() {
|
|
1289
1319
|
super(...arguments), this.name = "Base64DecodeError";
|
|
1290
1320
|
}
|
|
@@ -1332,7 +1362,7 @@ class Rt extends Error {
|
|
|
1332
1362
|
* before being sent as a proto.
|
|
1333
1363
|
* @internal
|
|
1334
1364
|
*/
|
|
1335
|
-
class
|
|
1365
|
+
class Vt {
|
|
1336
1366
|
constructor(t) {
|
|
1337
1367
|
this.binaryString = t;
|
|
1338
1368
|
}
|
|
@@ -1344,11 +1374,11 @@ class Pt {
|
|
|
1344
1374
|
// Check that `DOMException` is defined before using it to avoid
|
|
1345
1375
|
// "ReferenceError: Property 'DOMException' doesn't exist" in react-native.
|
|
1346
1376
|
// (https://github.com/firebase/firebase-js-sdk/issues/7115)
|
|
1347
|
-
throw "undefined" != typeof DOMException && t instanceof DOMException ? new
|
|
1377
|
+
throw "undefined" != typeof DOMException && t instanceof DOMException ? new Pt("Invalid base64 string: " + t) : t;
|
|
1348
1378
|
}
|
|
1349
1379
|
}
|
|
1350
1380
|
/** Converts a binary string to a Base64 encoded string. */ (t);
|
|
1351
|
-
return new
|
|
1381
|
+
return new Vt(e);
|
|
1352
1382
|
}
|
|
1353
1383
|
static fromUint8Array(t) {
|
|
1354
1384
|
// TODO(indexing); Remove the copy of the byte string here as this method
|
|
@@ -1365,7 +1395,7 @@ class Pt {
|
|
|
1365
1395
|
/**
|
|
1366
1396
|
* Helper function to convert a binary string to an Uint8Array.
|
|
1367
1397
|
*/ (t);
|
|
1368
|
-
return new
|
|
1398
|
+
return new Vt(e);
|
|
1369
1399
|
}
|
|
1370
1400
|
[Symbol.iterator]() {
|
|
1371
1401
|
let t = 0;
|
|
@@ -1412,21 +1442,21 @@ class Pt {
|
|
|
1412
1442
|
return 2 * this.binaryString.length;
|
|
1413
1443
|
}
|
|
1414
1444
|
compareTo(t) {
|
|
1415
|
-
return
|
|
1445
|
+
return It(this.binaryString, t.binaryString);
|
|
1416
1446
|
}
|
|
1417
1447
|
isEqual(t) {
|
|
1418
1448
|
return this.binaryString === t.binaryString;
|
|
1419
1449
|
}
|
|
1420
1450
|
}
|
|
1421
1451
|
|
|
1422
|
-
|
|
1452
|
+
Vt.EMPTY_BYTE_STRING = new Vt("");
|
|
1423
1453
|
|
|
1424
|
-
const
|
|
1454
|
+
const $t = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
1425
1455
|
|
|
1426
1456
|
/**
|
|
1427
1457
|
* Converts the possible Proto values for a timestamp value into a "seconds and
|
|
1428
1458
|
* nanos" representation.
|
|
1429
|
-
*/ function
|
|
1459
|
+
*/ function Nt(t) {
|
|
1430
1460
|
// The json interface (for the browser) will return an iso timestamp string,
|
|
1431
1461
|
// while the proto js library (for node) will return a
|
|
1432
1462
|
// google.protobuf.Timestamp instance.
|
|
@@ -1435,7 +1465,7 @@ const Vt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1435
1465
|
// (millis), so we do some custom parsing here.
|
|
1436
1466
|
// Parse the nanos right out of the string.
|
|
1437
1467
|
let e = 0;
|
|
1438
|
-
const n =
|
|
1468
|
+
const n = $t.exec(t);
|
|
1439
1469
|
if (E(!!n), n[1]) {
|
|
1440
1470
|
// Pad the fraction out to 9 digits (nanos).
|
|
1441
1471
|
let t = n[1];
|
|
@@ -1462,8 +1492,8 @@ const Vt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1462
1492
|
return "number" == typeof t ? t : "string" == typeof t ? Number(t) : 0;
|
|
1463
1493
|
}
|
|
1464
1494
|
|
|
1465
|
-
/** Converts the possible Proto types for Blobs into a ByteString. */ function
|
|
1466
|
-
return "string" == typeof t ?
|
|
1495
|
+
/** Converts the possible Proto types for Blobs into a ByteString. */ function Ft(t) {
|
|
1496
|
+
return "string" == typeof t ? Vt.fromBase64String(t) : Vt.fromUint8Array(t);
|
|
1467
1497
|
}
|
|
1468
1498
|
|
|
1469
1499
|
/**
|
|
@@ -1497,7 +1527,7 @@ const Vt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1497
1527
|
* For examples and further specifications, refer to the
|
|
1498
1528
|
* {@link https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto | Timestamp definition}.
|
|
1499
1529
|
*/
|
|
1500
|
-
class
|
|
1530
|
+
class xt {
|
|
1501
1531
|
/**
|
|
1502
1532
|
* Creates a new timestamp.
|
|
1503
1533
|
*
|
|
@@ -1529,7 +1559,7 @@ class Ft {
|
|
|
1529
1559
|
*
|
|
1530
1560
|
* @returns a new timestamp representing the current date.
|
|
1531
1561
|
*/ static now() {
|
|
1532
|
-
return
|
|
1562
|
+
return xt.fromMillis(Date.now());
|
|
1533
1563
|
}
|
|
1534
1564
|
/**
|
|
1535
1565
|
* Creates a new timestamp from the given date.
|
|
@@ -1538,7 +1568,7 @@ class Ft {
|
|
|
1538
1568
|
* @returns A new `Timestamp` representing the same point in time as the given
|
|
1539
1569
|
* date.
|
|
1540
1570
|
*/ static fromDate(t) {
|
|
1541
|
-
return
|
|
1571
|
+
return xt.fromMillis(t.getTime());
|
|
1542
1572
|
}
|
|
1543
1573
|
/**
|
|
1544
1574
|
* Creates a new timestamp from the given number of milliseconds.
|
|
@@ -1549,7 +1579,7 @@ class Ft {
|
|
|
1549
1579
|
* number of milliseconds.
|
|
1550
1580
|
*/ static fromMillis(t) {
|
|
1551
1581
|
const e = Math.floor(t / 1e3), n = Math.floor(1e6 * (t - 1e3 * e));
|
|
1552
|
-
return new
|
|
1582
|
+
return new xt(e, n);
|
|
1553
1583
|
}
|
|
1554
1584
|
/**
|
|
1555
1585
|
* Converts a `Timestamp` to a JavaScript `Date` object. This conversion
|
|
@@ -1571,7 +1601,7 @@ class Ft {
|
|
|
1571
1601
|
return 1e3 * this.seconds + this.nanoseconds / 1e6;
|
|
1572
1602
|
}
|
|
1573
1603
|
_compareTo(t) {
|
|
1574
|
-
return this.seconds === t.seconds ?
|
|
1604
|
+
return this.seconds === t.seconds ? It(this.nanoseconds, t.nanoseconds) : It(this.seconds, t.seconds);
|
|
1575
1605
|
}
|
|
1576
1606
|
/**
|
|
1577
1607
|
* Returns true if this `Timestamp` is equal to the provided one.
|
|
@@ -1641,7 +1671,7 @@ class Ft {
|
|
|
1641
1671
|
* FieldValueOptions to value().
|
|
1642
1672
|
* - With respect to other ServerTimestampValues, they sort by their
|
|
1643
1673
|
* localWriteTime.
|
|
1644
|
-
*/ function
|
|
1674
|
+
*/ function St(t) {
|
|
1645
1675
|
var e, n;
|
|
1646
1676
|
return "server_timestamp" === (null === (n = ((null === (e = null == t ? void 0 : t.mapValue) || void 0 === e ? void 0 : e.fields) || {}).__type__) || void 0 === n ? void 0 : n.stringValue);
|
|
1647
1677
|
}
|
|
@@ -1651,16 +1681,16 @@ class Ft {
|
|
|
1651
1681
|
*
|
|
1652
1682
|
* Preserving the previous values allows the user to display the last resoled
|
|
1653
1683
|
* value until the backend responds with the timestamp.
|
|
1654
|
-
*/ function
|
|
1684
|
+
*/ function qt(t) {
|
|
1655
1685
|
const e = t.mapValue.fields.__previous_value__;
|
|
1656
|
-
return
|
|
1686
|
+
return St(e) ? qt(e) : e;
|
|
1657
1687
|
}
|
|
1658
1688
|
|
|
1659
1689
|
/**
|
|
1660
1690
|
* Returns the local time at which this timestamp was first set.
|
|
1661
|
-
*/ function
|
|
1662
|
-
const e =
|
|
1663
|
-
return new
|
|
1691
|
+
*/ function Ot(t) {
|
|
1692
|
+
const e = Nt(t.mapValue.fields.__local_write_time__.timestampValue);
|
|
1693
|
+
return new xt(e.seconds, e.nanos);
|
|
1664
1694
|
}
|
|
1665
1695
|
|
|
1666
1696
|
/**
|
|
@@ -1678,7 +1708,7 @@ class Ft {
|
|
|
1678
1708
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1679
1709
|
* See the License for the specific language governing permissions and
|
|
1680
1710
|
* limitations under the License.
|
|
1681
|
-
*/ const
|
|
1711
|
+
*/ const kt = {
|
|
1682
1712
|
fields: {
|
|
1683
1713
|
__type__: {
|
|
1684
1714
|
stringValue: "__max__"
|
|
@@ -1687,8 +1717,8 @@ class Ft {
|
|
|
1687
1717
|
};
|
|
1688
1718
|
|
|
1689
1719
|
/** Extracts the backend's type order for the provided value. */
|
|
1690
|
-
function
|
|
1691
|
-
return "nullValue" in t ? 0 /* TypeOrder.NullValue */ : "booleanValue" in t ? 1 /* TypeOrder.BooleanValue */ : "integerValue" in t || "doubleValue" in t ? 2 /* TypeOrder.NumberValue */ : "timestampValue" in t ? 3 /* TypeOrder.TimestampValue */ : "stringValue" in t ? 5 /* TypeOrder.StringValue */ : "bytesValue" in t ? 6 /* TypeOrder.BlobValue */ : "referenceValue" in t ? 7 /* TypeOrder.RefValue */ : "geoPointValue" in t ? 8 /* TypeOrder.GeoPointValue */ : "arrayValue" in t ? 9 /* TypeOrder.ArrayValue */ : "mapValue" in t ?
|
|
1720
|
+
function Ct(t) {
|
|
1721
|
+
return "nullValue" in t ? 0 /* TypeOrder.NullValue */ : "booleanValue" in t ? 1 /* TypeOrder.BooleanValue */ : "integerValue" in t || "doubleValue" in t ? 2 /* TypeOrder.NumberValue */ : "timestampValue" in t ? 3 /* TypeOrder.TimestampValue */ : "stringValue" in t ? 5 /* TypeOrder.StringValue */ : "bytesValue" in t ? 6 /* TypeOrder.BlobValue */ : "referenceValue" in t ? 7 /* TypeOrder.RefValue */ : "geoPointValue" in t ? 8 /* TypeOrder.GeoPointValue */ : "arrayValue" in t ? 9 /* TypeOrder.ArrayValue */ : "mapValue" in t ? St(t) ? 4 /* TypeOrder.ServerTimestampValue */ :
|
|
1692
1722
|
/** Returns true if the Value represents the canonical {@link #MAX_VALUE} . */
|
|
1693
1723
|
function(t) {
|
|
1694
1724
|
return "__max__" === (((t.mapValue || {}).fields || {}).__type__ || {}).stringValue;
|
|
@@ -1725,10 +1755,10 @@ function kt(t) {
|
|
|
1725
1755
|
*/ (t) ? 9007199254740991 /* TypeOrder.MaxValue */ : 10 /* TypeOrder.ObjectValue */ : b();
|
|
1726
1756
|
}
|
|
1727
1757
|
|
|
1728
|
-
/** Tests `left` and `right` for equality based on the backend semantics. */ function
|
|
1758
|
+
/** Tests `left` and `right` for equality based on the backend semantics. */ function Mt(t, e) {
|
|
1729
1759
|
if (t === e) return !0;
|
|
1730
|
-
const n =
|
|
1731
|
-
if (n !==
|
|
1760
|
+
const n = Ct(t);
|
|
1761
|
+
if (n !== Ct(e)) return !1;
|
|
1732
1762
|
switch (n) {
|
|
1733
1763
|
case 0 /* TypeOrder.NullValue */ :
|
|
1734
1764
|
case 9007199254740991 /* TypeOrder.MaxValue */ :
|
|
@@ -1738,14 +1768,14 @@ function kt(t) {
|
|
|
1738
1768
|
return t.booleanValue === e.booleanValue;
|
|
1739
1769
|
|
|
1740
1770
|
case 4 /* TypeOrder.ServerTimestampValue */ :
|
|
1741
|
-
return
|
|
1771
|
+
return Ot(t).isEqual(Ot(e));
|
|
1742
1772
|
|
|
1743
1773
|
case 3 /* TypeOrder.TimestampValue */ :
|
|
1744
1774
|
return function(t, e) {
|
|
1745
1775
|
if ("string" == typeof t.timestampValue && "string" == typeof e.timestampValue && t.timestampValue.length === e.timestampValue.length)
|
|
1746
1776
|
// Use string equality for ISO 8601 timestamps
|
|
1747
1777
|
return t.timestampValue === e.timestampValue;
|
|
1748
|
-
const n =
|
|
1778
|
+
const n = Nt(t.timestampValue), r = Nt(e.timestampValue);
|
|
1749
1779
|
return n.seconds === r.seconds && n.nanos === r.nanos;
|
|
1750
1780
|
}(t, e);
|
|
1751
1781
|
|
|
@@ -1754,7 +1784,7 @@ function kt(t) {
|
|
|
1754
1784
|
|
|
1755
1785
|
case 6 /* TypeOrder.BlobValue */ :
|
|
1756
1786
|
return function(t, e) {
|
|
1757
|
-
return
|
|
1787
|
+
return Ft(t.bytesValue).isEqual(Ft(e.bytesValue));
|
|
1758
1788
|
}(t, e);
|
|
1759
1789
|
|
|
1760
1790
|
case 7 /* TypeOrder.RefValue */ :
|
|
@@ -1770,19 +1800,19 @@ function kt(t) {
|
|
|
1770
1800
|
if ("integerValue" in t && "integerValue" in e) return Dt(t.integerValue) === Dt(e.integerValue);
|
|
1771
1801
|
if ("doubleValue" in t && "doubleValue" in e) {
|
|
1772
1802
|
const n = Dt(t.doubleValue), r = Dt(e.doubleValue);
|
|
1773
|
-
return n === r ?
|
|
1803
|
+
return n === r ? wt(n) === wt(r) : isNaN(n) && isNaN(r);
|
|
1774
1804
|
}
|
|
1775
1805
|
return !1;
|
|
1776
1806
|
}(t, e);
|
|
1777
1807
|
|
|
1778
1808
|
case 9 /* TypeOrder.ArrayValue */ :
|
|
1779
|
-
return
|
|
1809
|
+
return Tt(t.arrayValue.values || [], e.arrayValue.values || [], Mt);
|
|
1780
1810
|
|
|
1781
1811
|
case 10 /* TypeOrder.ObjectValue */ :
|
|
1782
1812
|
return function(t, e) {
|
|
1783
1813
|
const n = t.mapValue.fields || {}, r = e.mapValue.fields || {};
|
|
1784
|
-
if (
|
|
1785
|
-
for (const t in n) if (n.hasOwnProperty(t) && (void 0 === r[t] || !
|
|
1814
|
+
if (At(n) !== At(r)) return !1;
|
|
1815
|
+
for (const t in n) if (n.hasOwnProperty(t) && (void 0 === r[t] || !Mt(n[t], r[t]))) return !1;
|
|
1786
1816
|
return !0;
|
|
1787
1817
|
}
|
|
1788
1818
|
/** Returns true if the ArrayValue contains the specified element. */ (t, e);
|
|
@@ -1792,21 +1822,21 @@ function kt(t) {
|
|
|
1792
1822
|
}
|
|
1793
1823
|
}
|
|
1794
1824
|
|
|
1795
|
-
function
|
|
1796
|
-
return void 0 !== (t.values || []).find((t =>
|
|
1825
|
+
function Lt(t, e) {
|
|
1826
|
+
return void 0 !== (t.values || []).find((t => Mt(t, e)));
|
|
1797
1827
|
}
|
|
1798
1828
|
|
|
1799
|
-
function
|
|
1829
|
+
function Ut(t, e) {
|
|
1800
1830
|
if (t === e) return 0;
|
|
1801
|
-
const n =
|
|
1802
|
-
if (n !== r) return
|
|
1831
|
+
const n = Ct(t), r = Ct(e);
|
|
1832
|
+
if (n !== r) return It(n, r);
|
|
1803
1833
|
switch (n) {
|
|
1804
1834
|
case 0 /* TypeOrder.NullValue */ :
|
|
1805
1835
|
case 9007199254740991 /* TypeOrder.MaxValue */ :
|
|
1806
1836
|
return 0;
|
|
1807
1837
|
|
|
1808
1838
|
case 1 /* TypeOrder.BooleanValue */ :
|
|
1809
|
-
return
|
|
1839
|
+
return It(t.booleanValue, e.booleanValue);
|
|
1810
1840
|
|
|
1811
1841
|
case 2 /* TypeOrder.NumberValue */ :
|
|
1812
1842
|
return function(t, e) {
|
|
@@ -1817,17 +1847,17 @@ function Lt(t, e) {
|
|
|
1817
1847
|
}(t, e);
|
|
1818
1848
|
|
|
1819
1849
|
case 3 /* TypeOrder.TimestampValue */ :
|
|
1820
|
-
return
|
|
1850
|
+
return jt(t.timestampValue, e.timestampValue);
|
|
1821
1851
|
|
|
1822
1852
|
case 4 /* TypeOrder.ServerTimestampValue */ :
|
|
1823
|
-
return
|
|
1853
|
+
return jt(Ot(t), Ot(e));
|
|
1824
1854
|
|
|
1825
1855
|
case 5 /* TypeOrder.StringValue */ :
|
|
1826
|
-
return
|
|
1856
|
+
return It(t.stringValue, e.stringValue);
|
|
1827
1857
|
|
|
1828
1858
|
case 6 /* TypeOrder.BlobValue */ :
|
|
1829
1859
|
return function(t, e) {
|
|
1830
|
-
const n =
|
|
1860
|
+
const n = Ft(t), r = Ft(e);
|
|
1831
1861
|
return n.compareTo(r);
|
|
1832
1862
|
}(t.bytesValue, e.bytesValue);
|
|
1833
1863
|
|
|
@@ -1835,34 +1865,34 @@ function Lt(t, e) {
|
|
|
1835
1865
|
return function(t, e) {
|
|
1836
1866
|
const n = t.split("/"), r = e.split("/");
|
|
1837
1867
|
for (let t = 0; t < n.length && t < r.length; t++) {
|
|
1838
|
-
const e =
|
|
1868
|
+
const e = It(n[t], r[t]);
|
|
1839
1869
|
if (0 !== e) return e;
|
|
1840
1870
|
}
|
|
1841
|
-
return
|
|
1871
|
+
return It(n.length, r.length);
|
|
1842
1872
|
}(t.referenceValue, e.referenceValue);
|
|
1843
1873
|
|
|
1844
1874
|
case 8 /* TypeOrder.GeoPointValue */ :
|
|
1845
1875
|
return function(t, e) {
|
|
1846
|
-
const n =
|
|
1876
|
+
const n = It(Dt(t.latitude), Dt(e.latitude));
|
|
1847
1877
|
if (0 !== n) return n;
|
|
1848
|
-
return
|
|
1878
|
+
return It(Dt(t.longitude), Dt(e.longitude));
|
|
1849
1879
|
}(t.geoPointValue, e.geoPointValue);
|
|
1850
1880
|
|
|
1851
1881
|
case 9 /* TypeOrder.ArrayValue */ :
|
|
1852
1882
|
return function(t, e) {
|
|
1853
1883
|
const n = t.values || [], r = e.values || [];
|
|
1854
1884
|
for (let t = 0; t < n.length && t < r.length; ++t) {
|
|
1855
|
-
const e =
|
|
1885
|
+
const e = Ut(n[t], r[t]);
|
|
1856
1886
|
if (e) return e;
|
|
1857
1887
|
}
|
|
1858
|
-
return
|
|
1888
|
+
return It(n.length, r.length);
|
|
1859
1889
|
}(t.arrayValue, e.arrayValue);
|
|
1860
1890
|
|
|
1861
1891
|
case 10 /* TypeOrder.ObjectValue */ :
|
|
1862
1892
|
return function(t, e) {
|
|
1863
|
-
if (t ===
|
|
1864
|
-
if (t ===
|
|
1865
|
-
if (e ===
|
|
1893
|
+
if (t === kt && e === kt) return 0;
|
|
1894
|
+
if (t === kt) return 1;
|
|
1895
|
+
if (e === kt) return -1;
|
|
1866
1896
|
const n = t.fields || {}, r = Object.keys(n), s = e.fields || {}, i = Object.keys(s);
|
|
1867
1897
|
// Even though MapValues are likely sorted correctly based on their insertion
|
|
1868
1898
|
// order (e.g. when received from the backend), local modifications can bring
|
|
@@ -1870,12 +1900,12 @@ function Lt(t, e) {
|
|
|
1870
1900
|
// canonical IDs are independent of insertion order.
|
|
1871
1901
|
r.sort(), i.sort();
|
|
1872
1902
|
for (let t = 0; t < r.length && t < i.length; ++t) {
|
|
1873
|
-
const e =
|
|
1903
|
+
const e = It(r[t], i[t]);
|
|
1874
1904
|
if (0 !== e) return e;
|
|
1875
|
-
const o =
|
|
1905
|
+
const o = Ut(n[r[t]], s[i[t]]);
|
|
1876
1906
|
if (0 !== o) return o;
|
|
1877
1907
|
}
|
|
1878
|
-
return
|
|
1908
|
+
return It(r.length, i.length);
|
|
1879
1909
|
}
|
|
1880
1910
|
/** Returns a reference value for the provided database and key. */ (t.mapValue, e.mapValue);
|
|
1881
1911
|
|
|
@@ -1884,35 +1914,35 @@ function Lt(t, e) {
|
|
|
1884
1914
|
}
|
|
1885
1915
|
}
|
|
1886
1916
|
|
|
1887
|
-
function
|
|
1888
|
-
if ("string" == typeof t && "string" == typeof e && t.length === e.length) return
|
|
1889
|
-
const n =
|
|
1890
|
-
return 0 !== s ? s :
|
|
1917
|
+
function jt(t, e) {
|
|
1918
|
+
if ("string" == typeof t && "string" == typeof e && t.length === e.length) return It(t, e);
|
|
1919
|
+
const n = Nt(t), r = Nt(e), s = It(n.seconds, r.seconds);
|
|
1920
|
+
return 0 !== s ? s : It(n.nanos, r.nanos);
|
|
1891
1921
|
}
|
|
1892
1922
|
|
|
1893
|
-
function
|
|
1923
|
+
function Bt(t, e) {
|
|
1894
1924
|
return {
|
|
1895
1925
|
referenceValue: `projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`
|
|
1896
1926
|
};
|
|
1897
1927
|
}
|
|
1898
1928
|
|
|
1899
|
-
/** Returns true if `value` is an ArrayValue. */ function
|
|
1929
|
+
/** Returns true if `value` is an ArrayValue. */ function Qt(t) {
|
|
1900
1930
|
return !!t && "arrayValue" in t;
|
|
1901
1931
|
}
|
|
1902
1932
|
|
|
1903
|
-
/** Returns true if `value` is a NullValue. */ function
|
|
1933
|
+
/** Returns true if `value` is a NullValue. */ function zt(t) {
|
|
1904
1934
|
return !!t && "nullValue" in t;
|
|
1905
1935
|
}
|
|
1906
1936
|
|
|
1907
|
-
/** Returns true if `value` is NaN. */ function
|
|
1937
|
+
/** Returns true if `value` is NaN. */ function Wt(t) {
|
|
1908
1938
|
return !!t && "doubleValue" in t && isNaN(Number(t.doubleValue));
|
|
1909
1939
|
}
|
|
1910
1940
|
|
|
1911
|
-
/** Returns true if `value` is a MapValue. */ function
|
|
1941
|
+
/** Returns true if `value` is a MapValue. */ function Gt(t) {
|
|
1912
1942
|
return !!t && "mapValue" in t;
|
|
1913
1943
|
}
|
|
1914
1944
|
|
|
1915
|
-
/** Creates a deep copy of `source`. */ function
|
|
1945
|
+
/** Creates a deep copy of `source`. */ function Kt(t) {
|
|
1916
1946
|
if (t.geoPointValue) return {
|
|
1917
1947
|
geoPointValue: Object.assign({}, t.geoPointValue)
|
|
1918
1948
|
};
|
|
@@ -1925,7 +1955,7 @@ function jt(t, e) {
|
|
|
1925
1955
|
fields: {}
|
|
1926
1956
|
}
|
|
1927
1957
|
};
|
|
1928
|
-
return
|
|
1958
|
+
return Rt(t.mapValue.fields, ((t, n) => e.mapValue.fields[t] = Kt(n))), e;
|
|
1929
1959
|
}
|
|
1930
1960
|
if (t.arrayValue) {
|
|
1931
1961
|
const e = {
|
|
@@ -1933,24 +1963,24 @@ function jt(t, e) {
|
|
|
1933
1963
|
values: []
|
|
1934
1964
|
}
|
|
1935
1965
|
};
|
|
1936
|
-
for (let n = 0; n < (t.arrayValue.values || []).length; ++n) e.arrayValue.values[n] =
|
|
1966
|
+
for (let n = 0; n < (t.arrayValue.values || []).length; ++n) e.arrayValue.values[n] = Kt(t.arrayValue.values[n]);
|
|
1937
1967
|
return e;
|
|
1938
1968
|
}
|
|
1939
1969
|
return Object.assign({}, t);
|
|
1940
1970
|
}
|
|
1941
1971
|
|
|
1942
|
-
class
|
|
1972
|
+
class Yt {
|
|
1943
1973
|
constructor(t, e) {
|
|
1944
1974
|
this.position = t, this.inclusive = e;
|
|
1945
1975
|
}
|
|
1946
1976
|
}
|
|
1947
1977
|
|
|
1948
|
-
function
|
|
1978
|
+
function Ht(t, e) {
|
|
1949
1979
|
if (null === t) return null === e;
|
|
1950
1980
|
if (null === e) return !1;
|
|
1951
1981
|
if (t.inclusive !== e.inclusive || t.position.length !== e.position.length) return !1;
|
|
1952
1982
|
for (let n = 0; n < t.position.length; n++) {
|
|
1953
|
-
if (!
|
|
1983
|
+
if (!Mt(t.position[n], e.position[n])) return !1;
|
|
1954
1984
|
}
|
|
1955
1985
|
return !0;
|
|
1956
1986
|
}
|
|
@@ -1970,24 +2000,24 @@ function Yt(t, e) {
|
|
|
1970
2000
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1971
2001
|
* See the License for the specific language governing permissions and
|
|
1972
2002
|
* limitations under the License.
|
|
1973
|
-
*/ class
|
|
2003
|
+
*/ class Jt {}
|
|
1974
2004
|
|
|
1975
|
-
class
|
|
2005
|
+
class Xt extends Jt {
|
|
1976
2006
|
constructor(t, e, n) {
|
|
1977
2007
|
super(), this.field = t, this.op = e, this.value = n;
|
|
1978
2008
|
}
|
|
1979
2009
|
/**
|
|
1980
2010
|
* Creates a filter based on the provided arguments.
|
|
1981
2011
|
*/ static create(t, e, n) {
|
|
1982
|
-
return t.isKeyField() ? "in" /* Operator.IN */ === e || "not-in" /* Operator.NOT_IN */ === e ? this.createKeyFieldInFilter(t, e, n) : new
|
|
2012
|
+
return t.isKeyField() ? "in" /* Operator.IN */ === e || "not-in" /* Operator.NOT_IN */ === e ? this.createKeyFieldInFilter(t, e, n) : new ee(t, e, n) : "array-contains" /* Operator.ARRAY_CONTAINS */ === e ? new ie(t, n) : "in" /* Operator.IN */ === e ? new oe(t, n) : "not-in" /* Operator.NOT_IN */ === e ? new ue(t, n) : "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ === e ? new ce(t, n) : new Xt(t, e, n);
|
|
1983
2013
|
}
|
|
1984
2014
|
static createKeyFieldInFilter(t, e, n) {
|
|
1985
|
-
return "in" /* Operator.IN */ === e ? new
|
|
2015
|
+
return "in" /* Operator.IN */ === e ? new ne(t, n) : new re(t, n);
|
|
1986
2016
|
}
|
|
1987
2017
|
matches(t) {
|
|
1988
2018
|
const e = t.data.field(this.field);
|
|
1989
2019
|
// Types do not have to match in NOT_EQUAL filters.
|
|
1990
|
-
return "!=" /* Operator.NOT_EQUAL */ === this.op ? null !== e && this.matchesComparison(
|
|
2020
|
+
return "!=" /* Operator.NOT_EQUAL */ === this.op ? null !== e && this.matchesComparison(Ut(e, this.value)) : null !== e && Ct(this.value) === Ct(e) && this.matchesComparison(Ut(e, this.value));
|
|
1991
2021
|
// Only compare types with matching backend order (such as double and int).
|
|
1992
2022
|
}
|
|
1993
2023
|
matchesComparison(t) {
|
|
@@ -2028,21 +2058,21 @@ class Jt extends Ht {
|
|
|
2028
2058
|
}
|
|
2029
2059
|
}
|
|
2030
2060
|
|
|
2031
|
-
class
|
|
2061
|
+
class Zt extends Jt {
|
|
2032
2062
|
constructor(t, e) {
|
|
2033
|
-
super(), this.filters = t, this.op = e, this.
|
|
2063
|
+
super(), this.filters = t, this.op = e, this.D = null;
|
|
2034
2064
|
}
|
|
2035
2065
|
/**
|
|
2036
2066
|
* Creates a filter based on the provided arguments.
|
|
2037
2067
|
*/ static create(t, e) {
|
|
2038
|
-
return new
|
|
2068
|
+
return new Zt(t, e);
|
|
2039
2069
|
}
|
|
2040
2070
|
matches(t) {
|
|
2041
2071
|
return "and" /* CompositeOperator.AND */ === this.op ? void 0 === this.filters.find((e => !e.matches(t))) : void 0 !== this.filters.find((e => e.matches(t)));
|
|
2042
2072
|
}
|
|
2043
2073
|
getFlattenedFilters() {
|
|
2044
|
-
return null !== this.
|
|
2045
|
-
this.
|
|
2074
|
+
return null !== this.D || (this.D = this.filters.reduce(((t, e) => t.concat(e.getFlattenedFilters())), [])),
|
|
2075
|
+
this.D;
|
|
2046
2076
|
}
|
|
2047
2077
|
// Returns a mutable copy of `this.filters`
|
|
2048
2078
|
getFilters() {
|
|
@@ -2061,19 +2091,19 @@ class Xt extends Ht {
|
|
|
2061
2091
|
}
|
|
2062
2092
|
}
|
|
2063
2093
|
|
|
2064
|
-
function
|
|
2065
|
-
return t instanceof
|
|
2066
|
-
return e instanceof
|
|
2067
|
-
}(t, e) : t instanceof
|
|
2068
|
-
if (e instanceof
|
|
2069
|
-
return t.filters.reduce(((t, n, r) => t &&
|
|
2094
|
+
function te(t, e) {
|
|
2095
|
+
return t instanceof Xt ? function(t, e) {
|
|
2096
|
+
return e instanceof Xt && t.op === e.op && t.field.isEqual(e.field) && Mt(t.value, e.value);
|
|
2097
|
+
}(t, e) : t instanceof Zt ? function(t, e) {
|
|
2098
|
+
if (e instanceof Zt && t.op === e.op && t.filters.length === e.filters.length) {
|
|
2099
|
+
return t.filters.reduce(((t, n, r) => t && te(n, e.filters[r])), !0);
|
|
2070
2100
|
}
|
|
2071
2101
|
return !1;
|
|
2072
2102
|
}
|
|
2073
2103
|
/** Filter that matches on key fields (i.e. '__name__'). */ (t, e) : void b();
|
|
2074
2104
|
}
|
|
2075
2105
|
|
|
2076
|
-
class
|
|
2106
|
+
class ee extends Xt {
|
|
2077
2107
|
constructor(t, e, n) {
|
|
2078
2108
|
super(t, e, n), this.key = rt.fromName(n.referenceValue);
|
|
2079
2109
|
}
|
|
@@ -2083,69 +2113,69 @@ class te extends Jt {
|
|
|
2083
2113
|
}
|
|
2084
2114
|
}
|
|
2085
2115
|
|
|
2086
|
-
/** Filter that matches on key fields within an array. */ class
|
|
2116
|
+
/** Filter that matches on key fields within an array. */ class ne extends Xt {
|
|
2087
2117
|
constructor(t, e) {
|
|
2088
|
-
super(t, "in" /* Operator.IN */ , e), this.keys =
|
|
2118
|
+
super(t, "in" /* Operator.IN */ , e), this.keys = se("in" /* Operator.IN */ , e);
|
|
2089
2119
|
}
|
|
2090
2120
|
matches(t) {
|
|
2091
2121
|
return this.keys.some((e => e.isEqual(t.key)));
|
|
2092
2122
|
}
|
|
2093
2123
|
}
|
|
2094
2124
|
|
|
2095
|
-
/** Filter that matches on key fields not present within an array. */ class
|
|
2125
|
+
/** Filter that matches on key fields not present within an array. */ class re extends Xt {
|
|
2096
2126
|
constructor(t, e) {
|
|
2097
|
-
super(t, "not-in" /* Operator.NOT_IN */ , e), this.keys =
|
|
2127
|
+
super(t, "not-in" /* Operator.NOT_IN */ , e), this.keys = se("not-in" /* Operator.NOT_IN */ , e);
|
|
2098
2128
|
}
|
|
2099
2129
|
matches(t) {
|
|
2100
2130
|
return !this.keys.some((e => e.isEqual(t.key)));
|
|
2101
2131
|
}
|
|
2102
2132
|
}
|
|
2103
2133
|
|
|
2104
|
-
function
|
|
2134
|
+
function se(t, e) {
|
|
2105
2135
|
var n;
|
|
2106
2136
|
return ((null === (n = e.arrayValue) || void 0 === n ? void 0 : n.values) || []).map((t => rt.fromName(t.referenceValue)));
|
|
2107
2137
|
}
|
|
2108
2138
|
|
|
2109
|
-
/** A Filter that implements the array-contains operator. */ class
|
|
2139
|
+
/** A Filter that implements the array-contains operator. */ class ie extends Xt {
|
|
2110
2140
|
constructor(t, e) {
|
|
2111
2141
|
super(t, "array-contains" /* Operator.ARRAY_CONTAINS */ , e);
|
|
2112
2142
|
}
|
|
2113
2143
|
matches(t) {
|
|
2114
2144
|
const e = t.data.field(this.field);
|
|
2115
|
-
return
|
|
2145
|
+
return Qt(e) && Lt(e.arrayValue, this.value);
|
|
2116
2146
|
}
|
|
2117
2147
|
}
|
|
2118
2148
|
|
|
2119
|
-
/** A Filter that implements the IN operator. */ class
|
|
2149
|
+
/** A Filter that implements the IN operator. */ class oe extends Xt {
|
|
2120
2150
|
constructor(t, e) {
|
|
2121
2151
|
super(t, "in" /* Operator.IN */ , e);
|
|
2122
2152
|
}
|
|
2123
2153
|
matches(t) {
|
|
2124
2154
|
const e = t.data.field(this.field);
|
|
2125
|
-
return null !== e &&
|
|
2155
|
+
return null !== e && Lt(this.value.arrayValue, e);
|
|
2126
2156
|
}
|
|
2127
2157
|
}
|
|
2128
2158
|
|
|
2129
|
-
/** A Filter that implements the not-in operator. */ class
|
|
2159
|
+
/** A Filter that implements the not-in operator. */ class ue extends Xt {
|
|
2130
2160
|
constructor(t, e) {
|
|
2131
2161
|
super(t, "not-in" /* Operator.NOT_IN */ , e);
|
|
2132
2162
|
}
|
|
2133
2163
|
matches(t) {
|
|
2134
|
-
if (
|
|
2164
|
+
if (Lt(this.value.arrayValue, {
|
|
2135
2165
|
nullValue: "NULL_VALUE"
|
|
2136
2166
|
})) return !1;
|
|
2137
2167
|
const e = t.data.field(this.field);
|
|
2138
|
-
return null !== e && !
|
|
2168
|
+
return null !== e && !Lt(this.value.arrayValue, e);
|
|
2139
2169
|
}
|
|
2140
2170
|
}
|
|
2141
2171
|
|
|
2142
|
-
/** A Filter that implements the array-contains-any operator. */ class
|
|
2172
|
+
/** A Filter that implements the array-contains-any operator. */ class ce extends Xt {
|
|
2143
2173
|
constructor(t, e) {
|
|
2144
2174
|
super(t, "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ , e);
|
|
2145
2175
|
}
|
|
2146
2176
|
matches(t) {
|
|
2147
2177
|
const e = t.data.field(this.field);
|
|
2148
|
-
return !(!
|
|
2178
|
+
return !(!Qt(e) || !e.arrayValue.values) && e.arrayValue.values.some((t => Lt(this.value.arrayValue, t)));
|
|
2149
2179
|
}
|
|
2150
2180
|
}
|
|
2151
2181
|
|
|
@@ -2167,13 +2197,13 @@ function re(t, e) {
|
|
|
2167
2197
|
*/
|
|
2168
2198
|
/**
|
|
2169
2199
|
* An ordering on a field, in some Direction. Direction defaults to ASCENDING.
|
|
2170
|
-
*/ class
|
|
2200
|
+
*/ class ae {
|
|
2171
2201
|
constructor(t, e = "asc" /* Direction.ASCENDING */) {
|
|
2172
2202
|
this.field = t, this.dir = e;
|
|
2173
2203
|
}
|
|
2174
2204
|
}
|
|
2175
2205
|
|
|
2176
|
-
function
|
|
2206
|
+
function he(t, e) {
|
|
2177
2207
|
return t.dir === e.dir && t.field.isEqual(e.field);
|
|
2178
2208
|
}
|
|
2179
2209
|
|
|
@@ -2196,18 +2226,18 @@ function ae(t, e) {
|
|
|
2196
2226
|
/**
|
|
2197
2227
|
* A version of a document in Firestore. This corresponds to the version
|
|
2198
2228
|
* timestamp, such as update_time or read_time.
|
|
2199
|
-
*/ class
|
|
2229
|
+
*/ class le {
|
|
2200
2230
|
constructor(t) {
|
|
2201
2231
|
this.timestamp = t;
|
|
2202
2232
|
}
|
|
2203
2233
|
static fromTimestamp(t) {
|
|
2204
|
-
return new
|
|
2234
|
+
return new le(t);
|
|
2205
2235
|
}
|
|
2206
2236
|
static min() {
|
|
2207
|
-
return new
|
|
2237
|
+
return new le(new xt(0, 0));
|
|
2208
2238
|
}
|
|
2209
2239
|
static max() {
|
|
2210
|
-
return new
|
|
2240
|
+
return new le(new xt(253402300799, 999999999));
|
|
2211
2241
|
}
|
|
2212
2242
|
compareTo(t) {
|
|
2213
2243
|
return this.timestamp._compareTo(t.timestamp);
|
|
@@ -2245,17 +2275,17 @@ function ae(t, e) {
|
|
|
2245
2275
|
*/
|
|
2246
2276
|
// An immutable sorted map implementation, based on a Left-leaning Red-Black
|
|
2247
2277
|
// tree.
|
|
2248
|
-
class
|
|
2278
|
+
class fe {
|
|
2249
2279
|
constructor(t, e) {
|
|
2250
|
-
this.comparator = t, this.root = e ||
|
|
2280
|
+
this.comparator = t, this.root = e || we.EMPTY;
|
|
2251
2281
|
}
|
|
2252
2282
|
// Returns a copy of the map, with the specified key/value added or replaced.
|
|
2253
2283
|
insert(t, e) {
|
|
2254
|
-
return new
|
|
2284
|
+
return new fe(this.comparator, this.root.insert(t, e, this.comparator).copy(null, null, we.BLACK, null, null));
|
|
2255
2285
|
}
|
|
2256
2286
|
// Returns a copy of the map, with the specified key removed.
|
|
2257
2287
|
remove(t) {
|
|
2258
|
-
return new
|
|
2288
|
+
return new fe(this.comparator, this.root.remove(t, this.comparator).copy(null, null, we.BLACK, null, null));
|
|
2259
2289
|
}
|
|
2260
2290
|
// Returns the value of the node with the given key, or null.
|
|
2261
2291
|
get(t) {
|
|
@@ -2321,22 +2351,22 @@ class le {
|
|
|
2321
2351
|
}
|
|
2322
2352
|
// Returns an iterator over the SortedMap.
|
|
2323
2353
|
getIterator() {
|
|
2324
|
-
return new
|
|
2354
|
+
return new de(this.root, null, this.comparator, !1);
|
|
2325
2355
|
}
|
|
2326
2356
|
getIteratorFrom(t) {
|
|
2327
|
-
return new
|
|
2357
|
+
return new de(this.root, t, this.comparator, !1);
|
|
2328
2358
|
}
|
|
2329
2359
|
getReverseIterator() {
|
|
2330
|
-
return new
|
|
2360
|
+
return new de(this.root, null, this.comparator, !0);
|
|
2331
2361
|
}
|
|
2332
2362
|
getReverseIteratorFrom(t) {
|
|
2333
|
-
return new
|
|
2363
|
+
return new de(this.root, t, this.comparator, !0);
|
|
2334
2364
|
}
|
|
2335
2365
|
}
|
|
2336
2366
|
|
|
2337
2367
|
// end SortedMap
|
|
2338
2368
|
// An iterator over an LLRBNode.
|
|
2339
|
-
class
|
|
2369
|
+
class de {
|
|
2340
2370
|
constructor(t, e, n, r) {
|
|
2341
2371
|
this.isReverse = r, this.nodeStack = [];
|
|
2342
2372
|
let s = 1;
|
|
@@ -2381,14 +2411,14 @@ class fe {
|
|
|
2381
2411
|
|
|
2382
2412
|
// end SortedMapIterator
|
|
2383
2413
|
// Represents a node in a Left-leaning Red-Black tree.
|
|
2384
|
-
class
|
|
2414
|
+
class we {
|
|
2385
2415
|
constructor(t, e, n, r, s) {
|
|
2386
|
-
this.key = t, this.value = e, this.color = null != n ? n :
|
|
2387
|
-
this.right = null != s ? s :
|
|
2416
|
+
this.key = t, this.value = e, this.color = null != n ? n : we.RED, this.left = null != r ? r : we.EMPTY,
|
|
2417
|
+
this.right = null != s ? s : we.EMPTY, this.size = this.left.size + 1 + this.right.size;
|
|
2388
2418
|
}
|
|
2389
2419
|
// Returns a copy of the current node, optionally replacing pieces of it.
|
|
2390
2420
|
copy(t, e, n, r, s) {
|
|
2391
|
-
return new
|
|
2421
|
+
return new we(null != t ? t : this.key, null != e ? e : this.value, null != n ? n : this.color, null != r ? r : this.left, null != s ? s : this.right);
|
|
2392
2422
|
}
|
|
2393
2423
|
isEmpty() {
|
|
2394
2424
|
return !1;
|
|
@@ -2427,7 +2457,7 @@ class de {
|
|
|
2427
2457
|
r.fixUp();
|
|
2428
2458
|
}
|
|
2429
2459
|
removeMin() {
|
|
2430
|
-
if (this.left.isEmpty()) return
|
|
2460
|
+
if (this.left.isEmpty()) return we.EMPTY;
|
|
2431
2461
|
let t = this;
|
|
2432
2462
|
return t.left.isRed() || t.left.left.isRed() || (t = t.moveRedLeft()), t = t.copy(null, null, null, t.left.removeMin(), null),
|
|
2433
2463
|
t.fixUp();
|
|
@@ -2439,7 +2469,7 @@ class de {
|
|
|
2439
2469
|
r = r.copy(null, null, null, r.left.remove(t, e), null); else {
|
|
2440
2470
|
if (r.left.isRed() && (r = r.rotateRight()), r.right.isEmpty() || r.right.isRed() || r.right.left.isRed() || (r = r.moveRedRight()),
|
|
2441
2471
|
0 === e(t, r.key)) {
|
|
2442
|
-
if (r.right.isEmpty()) return
|
|
2472
|
+
if (r.right.isEmpty()) return we.EMPTY;
|
|
2443
2473
|
n = r.right.min(), r = r.copy(n.key, n.value, null, null, r.right.removeMin());
|
|
2444
2474
|
}
|
|
2445
2475
|
r = r.copy(null, null, null, null, r.right.remove(t, e));
|
|
@@ -2465,11 +2495,11 @@ class de {
|
|
|
2465
2495
|
return t.left.left.isRed() && (t = t.rotateRight(), t = t.colorFlip()), t;
|
|
2466
2496
|
}
|
|
2467
2497
|
rotateLeft() {
|
|
2468
|
-
const t = this.copy(null, null,
|
|
2498
|
+
const t = this.copy(null, null, we.RED, null, this.right.left);
|
|
2469
2499
|
return this.right.copy(null, null, this.color, t, null);
|
|
2470
2500
|
}
|
|
2471
2501
|
rotateRight() {
|
|
2472
|
-
const t = this.copy(null, null,
|
|
2502
|
+
const t = this.copy(null, null, we.RED, this.left.right, null);
|
|
2473
2503
|
return this.left.copy(null, null, this.color, null, t);
|
|
2474
2504
|
}
|
|
2475
2505
|
colorFlip() {
|
|
@@ -2495,10 +2525,10 @@ class de {
|
|
|
2495
2525
|
// end LLRBNode
|
|
2496
2526
|
// Empty node is shared between all LLRB trees.
|
|
2497
2527
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2498
|
-
|
|
2528
|
+
we.EMPTY = null, we.RED = !0, we.BLACK = !1;
|
|
2499
2529
|
|
|
2500
2530
|
// end LLRBEmptyNode
|
|
2501
|
-
|
|
2531
|
+
we.EMPTY = new
|
|
2502
2532
|
// Represents an empty node (a leaf node in the Red-Black Tree).
|
|
2503
2533
|
class {
|
|
2504
2534
|
constructor() {
|
|
@@ -2525,7 +2555,7 @@ class {
|
|
|
2525
2555
|
}
|
|
2526
2556
|
// Returns a copy of the tree, with the specified key/value added.
|
|
2527
2557
|
insert(t, e, n) {
|
|
2528
|
-
return new
|
|
2558
|
+
return new we(t, e);
|
|
2529
2559
|
}
|
|
2530
2560
|
// Returns a copy of the tree, with the specified key removed.
|
|
2531
2561
|
remove(t, e) {
|
|
@@ -2581,9 +2611,9 @@ class {
|
|
|
2581
2611
|
* NOTE: if provided comparator returns 0 for two elements, we consider them to
|
|
2582
2612
|
* be equal!
|
|
2583
2613
|
*/
|
|
2584
|
-
class
|
|
2614
|
+
class me {
|
|
2585
2615
|
constructor(t) {
|
|
2586
|
-
this.comparator = t, this.data = new
|
|
2616
|
+
this.comparator = t, this.data = new fe(this.comparator);
|
|
2587
2617
|
}
|
|
2588
2618
|
has(t) {
|
|
2589
2619
|
return null !== this.data.get(t);
|
|
@@ -2624,10 +2654,10 @@ class we {
|
|
|
2624
2654
|
return e.hasNext() ? e.getNext().key : null;
|
|
2625
2655
|
}
|
|
2626
2656
|
getIterator() {
|
|
2627
|
-
return new
|
|
2657
|
+
return new pe(this.data.getIterator());
|
|
2628
2658
|
}
|
|
2629
2659
|
getIteratorFrom(t) {
|
|
2630
|
-
return new
|
|
2660
|
+
return new pe(this.data.getIteratorFrom(t));
|
|
2631
2661
|
}
|
|
2632
2662
|
/** Inserts or updates an element */ add(t) {
|
|
2633
2663
|
return this.copy(this.data.remove(t).insert(t, !0));
|
|
@@ -2646,7 +2676,7 @@ class we {
|
|
|
2646
2676
|
})), e;
|
|
2647
2677
|
}
|
|
2648
2678
|
isEqual(t) {
|
|
2649
|
-
if (!(t instanceof
|
|
2679
|
+
if (!(t instanceof me)) return !1;
|
|
2650
2680
|
if (this.size !== t.size) return !1;
|
|
2651
2681
|
const e = this.data.getIterator(), n = t.data.getIterator();
|
|
2652
2682
|
for (;e.hasNext(); ) {
|
|
@@ -2666,12 +2696,12 @@ class we {
|
|
|
2666
2696
|
return this.forEach((e => t.push(e))), "SortedSet(" + t.toString() + ")";
|
|
2667
2697
|
}
|
|
2668
2698
|
copy(t) {
|
|
2669
|
-
const e = new
|
|
2699
|
+
const e = new me(this.comparator);
|
|
2670
2700
|
return e.data = t, e;
|
|
2671
2701
|
}
|
|
2672
2702
|
}
|
|
2673
2703
|
|
|
2674
|
-
class
|
|
2704
|
+
class pe {
|
|
2675
2705
|
constructor(t) {
|
|
2676
2706
|
this.iter = t;
|
|
2677
2707
|
}
|
|
@@ -2708,7 +2738,7 @@ class me {
|
|
|
2708
2738
|
* foo.bar - Overwrites only the field bar of the object foo.
|
|
2709
2739
|
* If foo is not an object, foo is replaced with an object
|
|
2710
2740
|
* containing foo
|
|
2711
|
-
*/ class
|
|
2741
|
+
*/ class ye {
|
|
2712
2742
|
constructor(t) {
|
|
2713
2743
|
this.fields = t,
|
|
2714
2744
|
// TODO(dimond): validation of FieldMask
|
|
@@ -2716,16 +2746,16 @@ class me {
|
|
|
2716
2746
|
t.sort(nt.comparator);
|
|
2717
2747
|
}
|
|
2718
2748
|
static empty() {
|
|
2719
|
-
return new
|
|
2749
|
+
return new ye([]);
|
|
2720
2750
|
}
|
|
2721
2751
|
/**
|
|
2722
2752
|
* Returns a new FieldMask object that is the result of adding all the given
|
|
2723
2753
|
* fields paths to this field mask.
|
|
2724
2754
|
*/ unionWith(t) {
|
|
2725
|
-
let e = new
|
|
2755
|
+
let e = new me(nt.comparator);
|
|
2726
2756
|
for (const t of this.fields) e = e.add(t);
|
|
2727
2757
|
for (const n of t) e = e.add(n);
|
|
2728
|
-
return new
|
|
2758
|
+
return new ye(e.toArray());
|
|
2729
2759
|
}
|
|
2730
2760
|
/**
|
|
2731
2761
|
* Verifies that `fieldPath` is included by at least one field in this field
|
|
@@ -2737,7 +2767,7 @@ class me {
|
|
|
2737
2767
|
return !1;
|
|
2738
2768
|
}
|
|
2739
2769
|
isEqual(t) {
|
|
2740
|
-
return
|
|
2770
|
+
return Tt(this.fields, t.fields, ((t, e) => t.isEqual(e)));
|
|
2741
2771
|
}
|
|
2742
2772
|
}
|
|
2743
2773
|
|
|
@@ -2760,12 +2790,12 @@ class me {
|
|
|
2760
2790
|
/**
|
|
2761
2791
|
* An ObjectValue represents a MapValue in the Firestore Proto and offers the
|
|
2762
2792
|
* ability to add and remove fields (via the ObjectValueBuilder).
|
|
2763
|
-
*/ class
|
|
2793
|
+
*/ class ge {
|
|
2764
2794
|
constructor(t) {
|
|
2765
2795
|
this.value = t;
|
|
2766
2796
|
}
|
|
2767
2797
|
static empty() {
|
|
2768
|
-
return new
|
|
2798
|
+
return new ge({
|
|
2769
2799
|
mapValue: {}
|
|
2770
2800
|
});
|
|
2771
2801
|
}
|
|
@@ -2779,7 +2809,7 @@ class me {
|
|
|
2779
2809
|
{
|
|
2780
2810
|
let e = this.value;
|
|
2781
2811
|
for (let n = 0; n < t.length - 1; ++n) if (e = (e.mapValue.fields || {})[t.get(n)],
|
|
2782
|
-
!
|
|
2812
|
+
!Gt(e)) return null;
|
|
2783
2813
|
return e = (e.mapValue.fields || {})[t.lastSegment()], e || null;
|
|
2784
2814
|
}
|
|
2785
2815
|
}
|
|
@@ -2789,7 +2819,7 @@ class me {
|
|
|
2789
2819
|
* @param path - The field path to set.
|
|
2790
2820
|
* @param value - The value to set.
|
|
2791
2821
|
*/ set(t, e) {
|
|
2792
|
-
this.getFieldsMap(t.popLast())[t.lastSegment()] =
|
|
2822
|
+
this.getFieldsMap(t.popLast())[t.lastSegment()] = Kt(e);
|
|
2793
2823
|
}
|
|
2794
2824
|
/**
|
|
2795
2825
|
* Sets the provided fields to the provided values.
|
|
@@ -2803,7 +2833,7 @@ class me {
|
|
|
2803
2833
|
const t = this.getFieldsMap(e);
|
|
2804
2834
|
this.applyChanges(t, n, r), n = {}, r = [], e = s.popLast();
|
|
2805
2835
|
}
|
|
2806
|
-
t ? n[s.lastSegment()] =
|
|
2836
|
+
t ? n[s.lastSegment()] = Kt(t) : r.push(s.lastSegment());
|
|
2807
2837
|
}));
|
|
2808
2838
|
const s = this.getFieldsMap(e);
|
|
2809
2839
|
this.applyChanges(s, n, r);
|
|
@@ -2815,10 +2845,10 @@ class me {
|
|
|
2815
2845
|
* @param path - The field path to remove.
|
|
2816
2846
|
*/ delete(t) {
|
|
2817
2847
|
const e = this.field(t.popLast());
|
|
2818
|
-
|
|
2848
|
+
Gt(e) && e.mapValue.fields && delete e.mapValue.fields[t.lastSegment()];
|
|
2819
2849
|
}
|
|
2820
2850
|
isEqual(t) {
|
|
2821
|
-
return
|
|
2851
|
+
return Mt(this.value, t.value);
|
|
2822
2852
|
}
|
|
2823
2853
|
/**
|
|
2824
2854
|
* Returns the map that contains the leaf element of `path`. If the parent
|
|
@@ -2830,7 +2860,7 @@ class me {
|
|
|
2830
2860
|
});
|
|
2831
2861
|
for (let n = 0; n < t.length; ++n) {
|
|
2832
2862
|
let r = e.mapValue.fields[t.get(n)];
|
|
2833
|
-
|
|
2863
|
+
Gt(r) && r.mapValue.fields || (r = {
|
|
2834
2864
|
mapValue: {
|
|
2835
2865
|
fields: {}
|
|
2836
2866
|
}
|
|
@@ -2842,11 +2872,11 @@ class me {
|
|
|
2842
2872
|
* Modifies `fieldsMap` by adding, replacing or deleting the specified
|
|
2843
2873
|
* entries.
|
|
2844
2874
|
*/ applyChanges(t, e, n) {
|
|
2845
|
-
|
|
2875
|
+
Rt(e, ((e, n) => t[e] = n));
|
|
2846
2876
|
for (const e of n) delete t[e];
|
|
2847
2877
|
}
|
|
2848
2878
|
clone() {
|
|
2849
|
-
return new
|
|
2879
|
+
return new ge(Kt(this.value));
|
|
2850
2880
|
}
|
|
2851
2881
|
}
|
|
2852
2882
|
|
|
@@ -2875,7 +2905,7 @@ class me {
|
|
|
2875
2905
|
* not transition to one of these states even after all mutations have been
|
|
2876
2906
|
* applied, `isValidDocument()` returns false and the document should be removed
|
|
2877
2907
|
* from all views.
|
|
2878
|
-
*/ class
|
|
2908
|
+
*/ class _e {
|
|
2879
2909
|
constructor(t, e, n, r, s, i, o) {
|
|
2880
2910
|
this.key = t, this.documentType = e, this.version = n, this.readTime = r, this.createTime = s,
|
|
2881
2911
|
this.data = i, this.documentState = o;
|
|
@@ -2884,35 +2914,35 @@ class me {
|
|
|
2884
2914
|
* Creates a document with no known version or data, but which can serve as
|
|
2885
2915
|
* base document for mutations.
|
|
2886
2916
|
*/ static newInvalidDocument(t) {
|
|
2887
|
-
return new
|
|
2888
|
-
/* version */
|
|
2889
|
-
/* readTime */
|
|
2890
|
-
/* createTime */
|
|
2917
|
+
return new _e(t, 0 /* DocumentType.INVALID */ ,
|
|
2918
|
+
/* version */ le.min(),
|
|
2919
|
+
/* readTime */ le.min(),
|
|
2920
|
+
/* createTime */ le.min(), ge.empty(), 0 /* DocumentState.SYNCED */);
|
|
2891
2921
|
}
|
|
2892
2922
|
/**
|
|
2893
2923
|
* Creates a new document that is known to exist with the given data at the
|
|
2894
2924
|
* given version.
|
|
2895
2925
|
*/ static newFoundDocument(t, e, n, r) {
|
|
2896
|
-
return new
|
|
2926
|
+
return new _e(t, 1 /* DocumentType.FOUND_DOCUMENT */ ,
|
|
2897
2927
|
/* version */ e,
|
|
2898
|
-
/* readTime */
|
|
2928
|
+
/* readTime */ le.min(),
|
|
2899
2929
|
/* createTime */ n, r, 0 /* DocumentState.SYNCED */);
|
|
2900
2930
|
}
|
|
2901
2931
|
/** Creates a new document that is known to not exist at the given version. */ static newNoDocument(t, e) {
|
|
2902
|
-
return new
|
|
2932
|
+
return new _e(t, 2 /* DocumentType.NO_DOCUMENT */ ,
|
|
2903
2933
|
/* version */ e,
|
|
2904
|
-
/* readTime */
|
|
2905
|
-
/* createTime */
|
|
2934
|
+
/* readTime */ le.min(),
|
|
2935
|
+
/* createTime */ le.min(), ge.empty(), 0 /* DocumentState.SYNCED */);
|
|
2906
2936
|
}
|
|
2907
2937
|
/**
|
|
2908
2938
|
* Creates a new document that is known to exist at the given version but
|
|
2909
2939
|
* whose data is not known (e.g. a document that was updated without a known
|
|
2910
2940
|
* base document).
|
|
2911
2941
|
*/ static newUnknownDocument(t, e) {
|
|
2912
|
-
return new
|
|
2942
|
+
return new _e(t, 3 /* DocumentType.UNKNOWN_DOCUMENT */ ,
|
|
2913
2943
|
/* version */ e,
|
|
2914
|
-
/* readTime */
|
|
2915
|
-
/* createTime */
|
|
2944
|
+
/* readTime */ le.min(),
|
|
2945
|
+
/* createTime */ le.min(), ge.empty(), 2 /* DocumentState.HAS_COMMITTED_MUTATIONS */);
|
|
2916
2946
|
}
|
|
2917
2947
|
/**
|
|
2918
2948
|
* Changes the document type to indicate that it exists and that its version
|
|
@@ -2923,7 +2953,7 @@ class me {
|
|
|
2923
2953
|
// update from Watch or due to applying a local set mutation on top
|
|
2924
2954
|
// of a deleted document, our best guess about its createTime would be the
|
|
2925
2955
|
// version at which the document transitioned to a FOUND_DOCUMENT.
|
|
2926
|
-
return !this.createTime.isEqual(
|
|
2956
|
+
return !this.createTime.isEqual(le.min()) || 2 /* DocumentType.NO_DOCUMENT */ !== this.documentType && 0 /* DocumentType.INVALID */ !== this.documentType || (this.createTime = t),
|
|
2927
2957
|
this.version = t, this.documentType = 1 /* DocumentType.FOUND_DOCUMENT */ , this.data = e,
|
|
2928
2958
|
this.documentState = 0 /* DocumentState.SYNCED */ , this;
|
|
2929
2959
|
}
|
|
@@ -2932,7 +2962,7 @@ class me {
|
|
|
2932
2962
|
* version.
|
|
2933
2963
|
*/ convertToNoDocument(t) {
|
|
2934
2964
|
return this.version = t, this.documentType = 2 /* DocumentType.NO_DOCUMENT */ ,
|
|
2935
|
-
this.data =
|
|
2965
|
+
this.data = ge.empty(), this.documentState = 0 /* DocumentState.SYNCED */ , this;
|
|
2936
2966
|
}
|
|
2937
2967
|
/**
|
|
2938
2968
|
* Changes the document type to indicate that it exists at a given version but
|
|
@@ -2940,14 +2970,14 @@ class me {
|
|
|
2940
2970
|
* base document).
|
|
2941
2971
|
*/ convertToUnknownDocument(t) {
|
|
2942
2972
|
return this.version = t, this.documentType = 3 /* DocumentType.UNKNOWN_DOCUMENT */ ,
|
|
2943
|
-
this.data =
|
|
2973
|
+
this.data = ge.empty(), this.documentState = 2 /* DocumentState.HAS_COMMITTED_MUTATIONS */ ,
|
|
2944
2974
|
this;
|
|
2945
2975
|
}
|
|
2946
2976
|
setHasCommittedMutations() {
|
|
2947
2977
|
return this.documentState = 2 /* DocumentState.HAS_COMMITTED_MUTATIONS */ , this;
|
|
2948
2978
|
}
|
|
2949
2979
|
setHasLocalMutations() {
|
|
2950
|
-
return this.documentState = 1 /* DocumentState.HAS_LOCAL_MUTATIONS */ , this.version =
|
|
2980
|
+
return this.documentState = 1 /* DocumentState.HAS_LOCAL_MUTATIONS */ , this.version = le.min(),
|
|
2951
2981
|
this;
|
|
2952
2982
|
}
|
|
2953
2983
|
setReadTime(t) {
|
|
@@ -2975,10 +3005,10 @@ class me {
|
|
|
2975
3005
|
return 3 /* DocumentType.UNKNOWN_DOCUMENT */ === this.documentType;
|
|
2976
3006
|
}
|
|
2977
3007
|
isEqual(t) {
|
|
2978
|
-
return t instanceof
|
|
3008
|
+
return t instanceof _e && this.key.isEqual(t.key) && this.version.isEqual(t.version) && this.documentType === t.documentType && this.documentState === t.documentState && this.data.isEqual(t.data);
|
|
2979
3009
|
}
|
|
2980
3010
|
mutableCopy() {
|
|
2981
|
-
return new
|
|
3011
|
+
return new _e(this.key, this.documentType, this.version, this.readTime, this.createTime, this.data.clone(), this.documentState);
|
|
2982
3012
|
}
|
|
2983
3013
|
toString() {
|
|
2984
3014
|
return `Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`;
|
|
@@ -3002,7 +3032,7 @@ class me {
|
|
|
3002
3032
|
* limitations under the License.
|
|
3003
3033
|
*/
|
|
3004
3034
|
// Visible for testing
|
|
3005
|
-
class
|
|
3035
|
+
class ve {
|
|
3006
3036
|
constructor(t, e = null, n = [], r = [], s = null, i = null, o = null) {
|
|
3007
3037
|
this.path = t, this.collectionGroup = e, this.orderBy = n, this.filters = r, this.limit = s,
|
|
3008
3038
|
this.startAt = i, this.endAt = o, this.S = null;
|
|
@@ -3016,8 +3046,8 @@ class _e {
|
|
|
3016
3046
|
* NOTE: you should always construct `Target` from `Query.toTarget` instead of
|
|
3017
3047
|
* using this factory method, because `Query` provides an implicit `orderBy`
|
|
3018
3048
|
* property.
|
|
3019
|
-
*/ function
|
|
3020
|
-
return new
|
|
3049
|
+
*/ function be(t, e = null, n = [], r = [], s = null, i = null, o = null) {
|
|
3050
|
+
return new ve(t, e, n, r, s, i, o);
|
|
3021
3051
|
}
|
|
3022
3052
|
|
|
3023
3053
|
/**
|
|
@@ -3043,7 +3073,7 @@ class _e {
|
|
|
3043
3073
|
*
|
|
3044
3074
|
* Visible for testing.
|
|
3045
3075
|
*/
|
|
3046
|
-
class
|
|
3076
|
+
class Ee {
|
|
3047
3077
|
/**
|
|
3048
3078
|
* Initializes a Query with a path and optional additional query constraints.
|
|
3049
3079
|
* Path must currently be empty if this is a collection group query.
|
|
@@ -3056,11 +3086,11 @@ class be {
|
|
|
3056
3086
|
}
|
|
3057
3087
|
}
|
|
3058
3088
|
|
|
3059
|
-
/** Creates a new Query for a query that matches all documents at `path` */ function
|
|
3089
|
+
/** Creates a new Query for a query that matches all documents at `path` */ function Ie(t) {
|
|
3060
3090
|
return t.explicitOrderBy.length > 0 ? t.explicitOrderBy[0].field : null;
|
|
3061
3091
|
}
|
|
3062
3092
|
|
|
3063
|
-
function
|
|
3093
|
+
function Te(t) {
|
|
3064
3094
|
for (const e of t.filters) {
|
|
3065
3095
|
const t = e.getFirstInequalityField();
|
|
3066
3096
|
if (null !== t) return t;
|
|
@@ -3076,7 +3106,7 @@ function Ie(t) {
|
|
|
3076
3106
|
* Returns whether the query matches a collection group rather than a specific
|
|
3077
3107
|
* collection.
|
|
3078
3108
|
*/
|
|
3079
|
-
function
|
|
3109
|
+
function Ae(t) {
|
|
3080
3110
|
return null !== t.collectionGroup;
|
|
3081
3111
|
}
|
|
3082
3112
|
|
|
@@ -3084,23 +3114,23 @@ function Te(t) {
|
|
|
3084
3114
|
* Returns the implicit order by constraint that is used to execute the Query,
|
|
3085
3115
|
* which can be different from the order by constraints the user provided (e.g.
|
|
3086
3116
|
* the SDK and backend always orders by `__name__`).
|
|
3087
|
-
*/ function
|
|
3117
|
+
*/ function Re(t) {
|
|
3088
3118
|
const e = I(t);
|
|
3089
3119
|
if (null === e.q) {
|
|
3090
3120
|
e.q = [];
|
|
3091
|
-
const t =
|
|
3121
|
+
const t = Te(e), n = Ie(e);
|
|
3092
3122
|
if (null !== t && null === n)
|
|
3093
3123
|
// In order to implicitly add key ordering, we must also add the
|
|
3094
3124
|
// inequality filter field for it to be a valid query.
|
|
3095
3125
|
// Note that the default inequality field and key ordering is ascending.
|
|
3096
|
-
t.isKeyField() || e.q.push(new
|
|
3126
|
+
t.isKeyField() || e.q.push(new ae(t)), e.q.push(new ae(nt.keyField(), "asc" /* Direction.ASCENDING */)); else {
|
|
3097
3127
|
let t = !1;
|
|
3098
3128
|
for (const n of e.explicitOrderBy) e.q.push(n), n.field.isKeyField() && (t = !0);
|
|
3099
3129
|
if (!t) {
|
|
3100
3130
|
// The order of the implicit key ordering always matches the last
|
|
3101
3131
|
// explicit order by
|
|
3102
3132
|
const t = e.explicitOrderBy.length > 0 ? e.explicitOrderBy[e.explicitOrderBy.length - 1].dir : "asc" /* Direction.ASCENDING */;
|
|
3103
|
-
e.q.push(new
|
|
3133
|
+
e.q.push(new ae(nt.keyField(), t));
|
|
3104
3134
|
}
|
|
3105
3135
|
}
|
|
3106
3136
|
}
|
|
@@ -3109,38 +3139,38 @@ function Te(t) {
|
|
|
3109
3139
|
|
|
3110
3140
|
/**
|
|
3111
3141
|
* Converts this `Query` instance to it's corresponding `Target` representation.
|
|
3112
|
-
*/ function
|
|
3142
|
+
*/ function Pe(t) {
|
|
3113
3143
|
const e = I(t);
|
|
3114
|
-
if (!e.O) if ("F" /* LimitType.First */ === e.limitType) e.O =
|
|
3144
|
+
if (!e.O) if ("F" /* LimitType.First */ === e.limitType) e.O = be(e.path, e.collectionGroup, Re(e), e.filters, e.limit, e.startAt, e.endAt); else {
|
|
3115
3145
|
// Flip the orderBy directions since we want the last results
|
|
3116
3146
|
const t = [];
|
|
3117
|
-
for (const n of
|
|
3147
|
+
for (const n of Re(e)) {
|
|
3118
3148
|
const e = "desc" /* Direction.DESCENDING */ === n.dir ? "asc" /* Direction.ASCENDING */ : "desc" /* Direction.DESCENDING */;
|
|
3119
|
-
t.push(new
|
|
3149
|
+
t.push(new ae(n.field, e));
|
|
3120
3150
|
}
|
|
3121
3151
|
// We need to swap the cursors to match the now-flipped query ordering.
|
|
3122
|
-
const n = e.endAt ? new
|
|
3152
|
+
const n = e.endAt ? new Yt(e.endAt.position, e.endAt.inclusive) : null, r = e.startAt ? new Yt(e.startAt.position, e.startAt.inclusive) : null;
|
|
3123
3153
|
// Now return as a LimitType.First query.
|
|
3124
|
-
e.O =
|
|
3154
|
+
e.O = be(e.path, e.collectionGroup, t, e.filters, e.limit, n, r);
|
|
3125
3155
|
}
|
|
3126
3156
|
return e.O;
|
|
3127
3157
|
}
|
|
3128
3158
|
|
|
3129
|
-
function
|
|
3130
|
-
e.getFirstInequalityField(),
|
|
3159
|
+
function Ve(t, e) {
|
|
3160
|
+
e.getFirstInequalityField(), Te(t);
|
|
3131
3161
|
const n = t.filters.concat([ e ]);
|
|
3132
|
-
return new
|
|
3162
|
+
return new Ee(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
|
|
3133
3163
|
}
|
|
3134
3164
|
|
|
3135
|
-
function
|
|
3165
|
+
function $e(t, e) {
|
|
3136
3166
|
return function(t, e) {
|
|
3137
3167
|
if (t.limit !== e.limit) return !1;
|
|
3138
3168
|
if (t.orderBy.length !== e.orderBy.length) return !1;
|
|
3139
|
-
for (let n = 0; n < t.orderBy.length; n++) if (!
|
|
3169
|
+
for (let n = 0; n < t.orderBy.length; n++) if (!he(t.orderBy[n], e.orderBy[n])) return !1;
|
|
3140
3170
|
if (t.filters.length !== e.filters.length) return !1;
|
|
3141
|
-
for (let n = 0; n < t.filters.length; n++) if (!
|
|
3142
|
-
return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!
|
|
3143
|
-
}(
|
|
3171
|
+
for (let n = 0; n < t.filters.length; n++) if (!te(t.filters[n], e.filters[n])) return !1;
|
|
3172
|
+
return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!Ht(t.startAt, e.startAt) && Ht(t.endAt, e.endAt);
|
|
3173
|
+
}(Pe(t), Pe(e)) && t.limitType === e.limitType;
|
|
3144
3174
|
}
|
|
3145
3175
|
|
|
3146
3176
|
/**
|
|
@@ -3168,9 +3198,9 @@ function Ve(t, e) {
|
|
|
3168
3198
|
* The return value is an IntegerValue if it can safely represent the value,
|
|
3169
3199
|
* otherwise a DoubleValue is returned.
|
|
3170
3200
|
*/
|
|
3171
|
-
function
|
|
3201
|
+
function Ne(t, e) {
|
|
3172
3202
|
return function(t) {
|
|
3173
|
-
return "number" == typeof t && Number.isInteger(t) && !
|
|
3203
|
+
return "number" == typeof t && Number.isInteger(t) && !wt(t) && t <= Number.MAX_SAFE_INTEGER && t >= Number.MIN_SAFE_INTEGER;
|
|
3174
3204
|
}(e) ?
|
|
3175
3205
|
/**
|
|
3176
3206
|
* Returns an IntegerValue for `value`.
|
|
@@ -3192,7 +3222,7 @@ function $e(t, e) {
|
|
|
3192
3222
|
};
|
|
3193
3223
|
}
|
|
3194
3224
|
return {
|
|
3195
|
-
doubleValue:
|
|
3225
|
+
doubleValue: wt(e) ? "-0" : e
|
|
3196
3226
|
};
|
|
3197
3227
|
}(t, e);
|
|
3198
3228
|
}
|
|
@@ -3221,15 +3251,15 @@ function $e(t, e) {
|
|
|
3221
3251
|
}
|
|
3222
3252
|
}
|
|
3223
3253
|
|
|
3224
|
-
/** Transforms a value into a server-generated timestamp. */ class
|
|
3254
|
+
/** Transforms a value into a server-generated timestamp. */ class Fe extends De {}
|
|
3225
3255
|
|
|
3226
|
-
/** Transforms an array value via a union operation. */ class
|
|
3256
|
+
/** Transforms an array value via a union operation. */ class xe extends De {
|
|
3227
3257
|
constructor(t) {
|
|
3228
3258
|
super(), this.elements = t;
|
|
3229
3259
|
}
|
|
3230
3260
|
}
|
|
3231
3261
|
|
|
3232
|
-
/** Transforms an array value via a remove operation. */ class
|
|
3262
|
+
/** Transforms an array value via a remove operation. */ class Se extends De {
|
|
3233
3263
|
constructor(t) {
|
|
3234
3264
|
super(), this.elements = t;
|
|
3235
3265
|
}
|
|
@@ -3240,7 +3270,7 @@ function $e(t, e) {
|
|
|
3240
3270
|
* transforms. Converts all field values to integers or doubles, but unlike the
|
|
3241
3271
|
* backend does not cap integer values at 2^63. Instead, JavaScript number
|
|
3242
3272
|
* arithmetic is used and precision loss can occur for values greater than 2^53.
|
|
3243
|
-
*/ class
|
|
3273
|
+
*/ class qe extends De {
|
|
3244
3274
|
constructor(t, e) {
|
|
3245
3275
|
super(), this.serializer = t, this.k = e;
|
|
3246
3276
|
}
|
|
@@ -3262,7 +3292,7 @@ function $e(t, e) {
|
|
|
3262
3292
|
* See the License for the specific language governing permissions and
|
|
3263
3293
|
* limitations under the License.
|
|
3264
3294
|
*/
|
|
3265
|
-
/** A field path and the TransformOperation to perform upon it. */ class
|
|
3295
|
+
/** A field path and the TransformOperation to perform upon it. */ class Oe {
|
|
3266
3296
|
constructor(t, e) {
|
|
3267
3297
|
this.field = t, this.transform = e;
|
|
3268
3298
|
}
|
|
@@ -3272,18 +3302,18 @@ function $e(t, e) {
|
|
|
3272
3302
|
* Encodes a precondition for a mutation. This follows the model that the
|
|
3273
3303
|
* backend accepts with the special case of an explicit "empty" precondition
|
|
3274
3304
|
* (meaning no precondition).
|
|
3275
|
-
*/ class
|
|
3305
|
+
*/ class ke {
|
|
3276
3306
|
constructor(t, e) {
|
|
3277
3307
|
this.updateTime = t, this.exists = e;
|
|
3278
3308
|
}
|
|
3279
3309
|
/** Creates a new empty Precondition. */ static none() {
|
|
3280
|
-
return new
|
|
3310
|
+
return new ke;
|
|
3281
3311
|
}
|
|
3282
3312
|
/** Creates a new Precondition with an exists flag. */ static exists(t) {
|
|
3283
|
-
return new
|
|
3313
|
+
return new ke(void 0, t);
|
|
3284
3314
|
}
|
|
3285
3315
|
/** Creates a new Precondition based on a version a document exists at. */ static updateTime(t) {
|
|
3286
|
-
return new
|
|
3316
|
+
return new ke(t);
|
|
3287
3317
|
}
|
|
3288
3318
|
/** Returns whether this Precondition is empty. */ get isNone() {
|
|
3289
3319
|
return void 0 === this.updateTime && void 0 === this.exists;
|
|
@@ -3336,12 +3366,12 @@ function $e(t, e) {
|
|
|
3336
3366
|
* applyToLocalView() to implement the actual behavior of applying the mutation
|
|
3337
3367
|
* to some source document (see `setMutationApplyToRemoteDocument()` for an
|
|
3338
3368
|
* example).
|
|
3339
|
-
*/ class
|
|
3369
|
+
*/ class Ce {}
|
|
3340
3370
|
|
|
3341
3371
|
/**
|
|
3342
3372
|
* A mutation that creates or replaces the document at the given key with the
|
|
3343
3373
|
* object value contents.
|
|
3344
|
-
*/ class
|
|
3374
|
+
*/ class Me extends Ce {
|
|
3345
3375
|
constructor(t, e, n, r = []) {
|
|
3346
3376
|
super(), this.key = t, this.value = e, this.precondition = n, this.fieldTransforms = r,
|
|
3347
3377
|
this.type = 0 /* MutationType.Set */;
|
|
@@ -3363,7 +3393,7 @@ function $e(t, e) {
|
|
|
3363
3393
|
* is deleted.
|
|
3364
3394
|
* * When a field is not in the mask but is in the values, the values map is
|
|
3365
3395
|
* ignored.
|
|
3366
|
-
*/ class
|
|
3396
|
+
*/ class Le extends Ce {
|
|
3367
3397
|
constructor(t, e, n, r, s = []) {
|
|
3368
3398
|
super(), this.key = t, this.data = e, this.fieldMask = n, this.precondition = r,
|
|
3369
3399
|
this.fieldTransforms = s, this.type = 1 /* MutationType.Patch */;
|
|
@@ -3373,7 +3403,7 @@ function $e(t, e) {
|
|
|
3373
3403
|
}
|
|
3374
3404
|
}
|
|
3375
3405
|
|
|
3376
|
-
/** A mutation that deletes the document at the given key. */ class
|
|
3406
|
+
/** A mutation that deletes the document at the given key. */ class Ue extends Ce {
|
|
3377
3407
|
constructor(t, e) {
|
|
3378
3408
|
super(), this.key = t, this.precondition = e, this.type = 2 /* MutationType.Delete */ ,
|
|
3379
3409
|
this.fieldTransforms = [];
|
|
@@ -3389,7 +3419,7 @@ function $e(t, e) {
|
|
|
3389
3419
|
*
|
|
3390
3420
|
* The `verify` operation is only used in Transactions, and this class serves
|
|
3391
3421
|
* primarily to facilitate serialization into protos.
|
|
3392
|
-
*/ class
|
|
3422
|
+
*/ class je extends Ce {
|
|
3393
3423
|
constructor(t, e) {
|
|
3394
3424
|
super(), this.key = t, this.precondition = e, this.type = 3 /* MutationType.Verify */ ,
|
|
3395
3425
|
this.fieldTransforms = [];
|
|
@@ -3414,13 +3444,13 @@ function $e(t, e) {
|
|
|
3414
3444
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3415
3445
|
* See the License for the specific language governing permissions and
|
|
3416
3446
|
* limitations under the License.
|
|
3417
|
-
*/ const
|
|
3447
|
+
*/ const Be = (() => {
|
|
3418
3448
|
const t = {
|
|
3419
3449
|
asc: "ASCENDING",
|
|
3420
3450
|
desc: "DESCENDING"
|
|
3421
3451
|
};
|
|
3422
3452
|
return t;
|
|
3423
|
-
})(),
|
|
3453
|
+
})(), Qe = (() => {
|
|
3424
3454
|
const t = {
|
|
3425
3455
|
"<": "LESS_THAN",
|
|
3426
3456
|
"<=": "LESS_THAN_OR_EQUAL",
|
|
@@ -3434,7 +3464,7 @@ function $e(t, e) {
|
|
|
3434
3464
|
"array-contains-any": "ARRAY_CONTAINS_ANY"
|
|
3435
3465
|
};
|
|
3436
3466
|
return t;
|
|
3437
|
-
})(),
|
|
3467
|
+
})(), ze = (() => {
|
|
3438
3468
|
const t = {
|
|
3439
3469
|
and: "AND",
|
|
3440
3470
|
or: "OR"
|
|
@@ -3456,7 +3486,7 @@ function $e(t, e) {
|
|
|
3456
3486
|
* TODO(klimt): We can remove the databaseId argument if we keep the full
|
|
3457
3487
|
* resource name in documents.
|
|
3458
3488
|
*/
|
|
3459
|
-
class
|
|
3489
|
+
class We {
|
|
3460
3490
|
constructor(t, e) {
|
|
3461
3491
|
this.databaseId = t, this.useProto3Json = e;
|
|
3462
3492
|
}
|
|
@@ -3473,7 +3503,7 @@ class ze {
|
|
|
3473
3503
|
/**
|
|
3474
3504
|
* Returns a value for a Date that's appropriate to put into a proto.
|
|
3475
3505
|
*/
|
|
3476
|
-
function
|
|
3506
|
+
function Ge(t, e) {
|
|
3477
3507
|
if (t.useProto3Json) {
|
|
3478
3508
|
return `${new Date(1e3 * e.seconds).toISOString().replace(/\.\d*/, "").replace("Z", "")}.${("000000000" + e.nanoseconds).slice(-9)}Z`;
|
|
3479
3509
|
}
|
|
@@ -3488,35 +3518,35 @@ function We(t, e) {
|
|
|
3488
3518
|
*
|
|
3489
3519
|
* Visible for testing.
|
|
3490
3520
|
*/
|
|
3491
|
-
function
|
|
3521
|
+
function Ke(t, e) {
|
|
3492
3522
|
return t.useProto3Json ? e.toBase64() : e.toUint8Array();
|
|
3493
3523
|
}
|
|
3494
3524
|
|
|
3495
|
-
function
|
|
3496
|
-
return
|
|
3525
|
+
function Ye(t, e) {
|
|
3526
|
+
return Ge(t, e.toTimestamp());
|
|
3497
3527
|
}
|
|
3498
3528
|
|
|
3499
|
-
function
|
|
3500
|
-
return E(!!t),
|
|
3501
|
-
const e =
|
|
3502
|
-
return new
|
|
3529
|
+
function He(t) {
|
|
3530
|
+
return E(!!t), le.fromTimestamp(function(t) {
|
|
3531
|
+
const e = Nt(t);
|
|
3532
|
+
return new xt(e.seconds, e.nanos);
|
|
3503
3533
|
}(t));
|
|
3504
3534
|
}
|
|
3505
3535
|
|
|
3506
|
-
function
|
|
3536
|
+
function Je(t, e) {
|
|
3507
3537
|
return function(t) {
|
|
3508
3538
|
return new tt([ "projects", t.projectId, "databases", t.database ]);
|
|
3509
3539
|
}(t).child("documents").child(e).canonicalString();
|
|
3510
3540
|
}
|
|
3511
3541
|
|
|
3512
|
-
function
|
|
3513
|
-
return
|
|
3542
|
+
function Xe(t, e) {
|
|
3543
|
+
return Je(t.databaseId, e.path);
|
|
3514
3544
|
}
|
|
3515
3545
|
|
|
3516
|
-
function
|
|
3546
|
+
function Ze(t, e) {
|
|
3517
3547
|
const n = function(t) {
|
|
3518
3548
|
const e = tt.fromString(t);
|
|
3519
|
-
return E(
|
|
3549
|
+
return E(dn(e)), e;
|
|
3520
3550
|
}(e);
|
|
3521
3551
|
if (n.get(1) !== t.databaseId.projectId) throw new U(P, "Tried to deserialize key from different project: " + n.get(1) + " vs " + t.databaseId.projectId);
|
|
3522
3552
|
if (n.get(3) !== t.databaseId.database) throw new U(P, "Tried to deserialize key from different database: " + n.get(3) + " vs " + t.databaseId.database);
|
|
@@ -3524,98 +3554,98 @@ function Xe(t, e) {
|
|
|
3524
3554
|
var r;
|
|
3525
3555
|
/** Creates a Document proto from key and fields (but no create/update time) */}
|
|
3526
3556
|
|
|
3527
|
-
function
|
|
3528
|
-
return
|
|
3557
|
+
function tn(t, e) {
|
|
3558
|
+
return Je(t.databaseId, e);
|
|
3529
3559
|
}
|
|
3530
3560
|
|
|
3531
|
-
function
|
|
3561
|
+
function en(t) {
|
|
3532
3562
|
return new tt([ "projects", t.databaseId.projectId, "databases", t.databaseId.database ]).canonicalString();
|
|
3533
3563
|
}
|
|
3534
3564
|
|
|
3535
|
-
function
|
|
3565
|
+
function nn(t, e, n) {
|
|
3536
3566
|
return {
|
|
3537
|
-
name:
|
|
3567
|
+
name: Xe(t, e),
|
|
3538
3568
|
fields: n.value.mapValue.fields
|
|
3539
3569
|
};
|
|
3540
3570
|
}
|
|
3541
3571
|
|
|
3542
|
-
function
|
|
3572
|
+
function rn(t, e) {
|
|
3543
3573
|
return "found" in e ? function(t, e) {
|
|
3544
3574
|
E(!!e.found), e.found.name, e.found.updateTime;
|
|
3545
|
-
const n =
|
|
3575
|
+
const n = Ze(t, e.found.name), r = He(e.found.updateTime), s = e.found.createTime ? He(e.found.createTime) : le.min(), i = new ge({
|
|
3546
3576
|
mapValue: {
|
|
3547
3577
|
fields: e.found.fields
|
|
3548
3578
|
}
|
|
3549
3579
|
});
|
|
3550
|
-
return
|
|
3580
|
+
return _e.newFoundDocument(n, r, s, i);
|
|
3551
3581
|
}(t, e) : "missing" in e ? function(t, e) {
|
|
3552
3582
|
E(!!e.missing), E(!!e.readTime);
|
|
3553
|
-
const n =
|
|
3554
|
-
return
|
|
3583
|
+
const n = Ze(t, e.missing), r = He(e.readTime);
|
|
3584
|
+
return _e.newNoDocument(n, r);
|
|
3555
3585
|
}(t, e) : b();
|
|
3556
3586
|
}
|
|
3557
3587
|
|
|
3558
|
-
function
|
|
3588
|
+
function sn(t, e) {
|
|
3559
3589
|
let n;
|
|
3560
|
-
if (e instanceof
|
|
3561
|
-
update:
|
|
3590
|
+
if (e instanceof Me) n = {
|
|
3591
|
+
update: nn(t, e.key, e.value)
|
|
3592
|
+
}; else if (e instanceof Ue) n = {
|
|
3593
|
+
delete: Xe(t, e.key)
|
|
3562
3594
|
}; else if (e instanceof Le) n = {
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
update: en(t, e.key, e.data),
|
|
3566
|
-
updateMask: ln(e.fieldMask)
|
|
3595
|
+
update: nn(t, e.key, e.data),
|
|
3596
|
+
updateMask: fn(e.fieldMask)
|
|
3567
3597
|
}; else {
|
|
3568
|
-
if (!(e instanceof
|
|
3598
|
+
if (!(e instanceof je)) return b();
|
|
3569
3599
|
n = {
|
|
3570
|
-
verify:
|
|
3600
|
+
verify: Xe(t, e.key)
|
|
3571
3601
|
};
|
|
3572
3602
|
}
|
|
3573
3603
|
return e.fieldTransforms.length > 0 && (n.updateTransforms = e.fieldTransforms.map((t => function(t, e) {
|
|
3574
3604
|
const n = e.transform;
|
|
3575
|
-
if (n instanceof
|
|
3605
|
+
if (n instanceof Fe) return {
|
|
3576
3606
|
fieldPath: e.field.canonicalString(),
|
|
3577
3607
|
setToServerValue: "REQUEST_TIME"
|
|
3578
3608
|
};
|
|
3579
|
-
if (n instanceof
|
|
3609
|
+
if (n instanceof xe) return {
|
|
3580
3610
|
fieldPath: e.field.canonicalString(),
|
|
3581
3611
|
appendMissingElements: {
|
|
3582
3612
|
values: n.elements
|
|
3583
3613
|
}
|
|
3584
3614
|
};
|
|
3585
|
-
if (n instanceof
|
|
3615
|
+
if (n instanceof Se) return {
|
|
3586
3616
|
fieldPath: e.field.canonicalString(),
|
|
3587
3617
|
removeAllFromArray: {
|
|
3588
3618
|
values: n.elements
|
|
3589
3619
|
}
|
|
3590
3620
|
};
|
|
3591
|
-
if (n instanceof
|
|
3621
|
+
if (n instanceof qe) return {
|
|
3592
3622
|
fieldPath: e.field.canonicalString(),
|
|
3593
3623
|
increment: n.k
|
|
3594
3624
|
};
|
|
3595
3625
|
throw b();
|
|
3596
3626
|
}(0, t)))), e.precondition.isNone || (n.currentDocument = function(t, e) {
|
|
3597
3627
|
return void 0 !== e.updateTime ? {
|
|
3598
|
-
updateTime:
|
|
3628
|
+
updateTime: Ye(t, e.updateTime)
|
|
3599
3629
|
} : void 0 !== e.exists ? {
|
|
3600
3630
|
exists: e.exists
|
|
3601
3631
|
} : b();
|
|
3602
3632
|
}(t, e.precondition)), n;
|
|
3603
3633
|
}
|
|
3604
3634
|
|
|
3605
|
-
function
|
|
3635
|
+
function on(t, e) {
|
|
3606
3636
|
// Dissect the path into parent, collectionId, and optional key filter.
|
|
3607
3637
|
const n = {
|
|
3608
3638
|
structuredQuery: {}
|
|
3609
3639
|
}, r = e.path;
|
|
3610
|
-
null !== e.collectionGroup ? (n.parent =
|
|
3640
|
+
null !== e.collectionGroup ? (n.parent = tn(t, r), n.structuredQuery.from = [ {
|
|
3611
3641
|
collectionId: e.collectionGroup,
|
|
3612
3642
|
allDescendants: !0
|
|
3613
|
-
} ]) : (n.parent =
|
|
3643
|
+
} ]) : (n.parent = tn(t, r.popLast()), n.structuredQuery.from = [ {
|
|
3614
3644
|
collectionId: r.lastSegment()
|
|
3615
3645
|
} ]);
|
|
3616
3646
|
const s = function(t) {
|
|
3617
3647
|
if (0 === t.length) return;
|
|
3618
|
-
return
|
|
3648
|
+
return ln(Zt.create(t, "and" /* CompositeOperator.AND */));
|
|
3619
3649
|
}(e.filters);
|
|
3620
3650
|
s && (n.structuredQuery.where = s);
|
|
3621
3651
|
const i = function(t) {
|
|
@@ -3624,8 +3654,8 @@ function sn(t, e) {
|
|
|
3624
3654
|
// visible for testing
|
|
3625
3655
|
function(t) {
|
|
3626
3656
|
return {
|
|
3627
|
-
field:
|
|
3628
|
-
direction:
|
|
3657
|
+
field: hn(t.field),
|
|
3658
|
+
direction: un(t.dir)
|
|
3629
3659
|
};
|
|
3630
3660
|
}
|
|
3631
3661
|
// visible for testing
|
|
@@ -3633,7 +3663,7 @@ function sn(t, e) {
|
|
|
3633
3663
|
}(e.orderBy);
|
|
3634
3664
|
i && (n.structuredQuery.orderBy = i);
|
|
3635
3665
|
const o = function(t, e) {
|
|
3636
|
-
return t.useProto3Json ||
|
|
3666
|
+
return t.useProto3Json || dt(e) ? e : {
|
|
3637
3667
|
value: e
|
|
3638
3668
|
};
|
|
3639
3669
|
}(t, e.limit);
|
|
@@ -3651,81 +3681,81 @@ function sn(t, e) {
|
|
|
3651
3681
|
(e.endAt)), n;
|
|
3652
3682
|
}
|
|
3653
3683
|
|
|
3654
|
-
function on(t) {
|
|
3655
|
-
return je[t];
|
|
3656
|
-
}
|
|
3657
|
-
|
|
3658
|
-
// visible for testing
|
|
3659
3684
|
function un(t) {
|
|
3660
3685
|
return Be[t];
|
|
3661
3686
|
}
|
|
3662
3687
|
|
|
3688
|
+
// visible for testing
|
|
3663
3689
|
function cn(t) {
|
|
3664
3690
|
return Qe[t];
|
|
3665
3691
|
}
|
|
3666
3692
|
|
|
3667
3693
|
function an(t) {
|
|
3694
|
+
return ze[t];
|
|
3695
|
+
}
|
|
3696
|
+
|
|
3697
|
+
function hn(t) {
|
|
3668
3698
|
return {
|
|
3669
3699
|
fieldPath: t.canonicalString()
|
|
3670
3700
|
};
|
|
3671
3701
|
}
|
|
3672
3702
|
|
|
3673
|
-
function
|
|
3674
|
-
return t instanceof
|
|
3703
|
+
function ln(t) {
|
|
3704
|
+
return t instanceof Xt ? function(t) {
|
|
3675
3705
|
if ("==" /* Operator.EQUAL */ === t.op) {
|
|
3676
|
-
if (
|
|
3706
|
+
if (Wt(t.value)) return {
|
|
3677
3707
|
unaryFilter: {
|
|
3678
|
-
field:
|
|
3708
|
+
field: hn(t.field),
|
|
3679
3709
|
op: "IS_NAN"
|
|
3680
3710
|
}
|
|
3681
3711
|
};
|
|
3682
|
-
if (
|
|
3712
|
+
if (zt(t.value)) return {
|
|
3683
3713
|
unaryFilter: {
|
|
3684
|
-
field:
|
|
3714
|
+
field: hn(t.field),
|
|
3685
3715
|
op: "IS_NULL"
|
|
3686
3716
|
}
|
|
3687
3717
|
};
|
|
3688
3718
|
} else if ("!=" /* Operator.NOT_EQUAL */ === t.op) {
|
|
3689
|
-
if (
|
|
3719
|
+
if (Wt(t.value)) return {
|
|
3690
3720
|
unaryFilter: {
|
|
3691
|
-
field:
|
|
3721
|
+
field: hn(t.field),
|
|
3692
3722
|
op: "IS_NOT_NAN"
|
|
3693
3723
|
}
|
|
3694
3724
|
};
|
|
3695
|
-
if (
|
|
3725
|
+
if (zt(t.value)) return {
|
|
3696
3726
|
unaryFilter: {
|
|
3697
|
-
field:
|
|
3727
|
+
field: hn(t.field),
|
|
3698
3728
|
op: "IS_NOT_NULL"
|
|
3699
3729
|
}
|
|
3700
3730
|
};
|
|
3701
3731
|
}
|
|
3702
3732
|
return {
|
|
3703
3733
|
fieldFilter: {
|
|
3704
|
-
field:
|
|
3705
|
-
op:
|
|
3734
|
+
field: hn(t.field),
|
|
3735
|
+
op: cn(t.op),
|
|
3706
3736
|
value: t.value
|
|
3707
3737
|
}
|
|
3708
3738
|
};
|
|
3709
|
-
}(t) : t instanceof
|
|
3710
|
-
const e = t.getFilters().map((t =>
|
|
3739
|
+
}(t) : t instanceof Zt ? function(t) {
|
|
3740
|
+
const e = t.getFilters().map((t => ln(t)));
|
|
3711
3741
|
if (1 === e.length) return e[0];
|
|
3712
3742
|
return {
|
|
3713
3743
|
compositeFilter: {
|
|
3714
|
-
op:
|
|
3744
|
+
op: an(t.op),
|
|
3715
3745
|
filters: e
|
|
3716
3746
|
}
|
|
3717
3747
|
};
|
|
3718
3748
|
}(t) : b();
|
|
3719
3749
|
}
|
|
3720
3750
|
|
|
3721
|
-
function
|
|
3751
|
+
function fn(t) {
|
|
3722
3752
|
const e = [];
|
|
3723
3753
|
return t.fields.forEach((t => e.push(t.canonicalString()))), {
|
|
3724
3754
|
fieldPaths: e
|
|
3725
3755
|
};
|
|
3726
3756
|
}
|
|
3727
3757
|
|
|
3728
|
-
function
|
|
3758
|
+
function dn(t) {
|
|
3729
3759
|
// Resource names have at least 4 components (project ID, database ID)
|
|
3730
3760
|
return t.length >= 4 && "projects" === t.get(0) && "databases" === t.get(2);
|
|
3731
3761
|
}
|
|
@@ -3745,8 +3775,8 @@ function fn(t) {
|
|
|
3745
3775
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3746
3776
|
* See the License for the specific language governing permissions and
|
|
3747
3777
|
* limitations under the License.
|
|
3748
|
-
*/ function
|
|
3749
|
-
return new
|
|
3778
|
+
*/ function wn(t) {
|
|
3779
|
+
return new We(t, /* useProto3Json= */ !0);
|
|
3750
3780
|
}
|
|
3751
3781
|
|
|
3752
3782
|
/**
|
|
@@ -3774,7 +3804,7 @@ function fn(t) {
|
|
|
3774
3804
|
* base delay. This prevents clients from accidentally synchronizing their
|
|
3775
3805
|
* delays causing spikes of load to the backend.
|
|
3776
3806
|
*/
|
|
3777
|
-
class
|
|
3807
|
+
class mn {
|
|
3778
3808
|
constructor(
|
|
3779
3809
|
/**
|
|
3780
3810
|
* The AsyncQueue to run backoff operations on.
|
|
@@ -3872,7 +3902,7 @@ class wn {
|
|
|
3872
3902
|
* An implementation of Datastore that exposes additional state for internal
|
|
3873
3903
|
* consumption.
|
|
3874
3904
|
*/
|
|
3875
|
-
class
|
|
3905
|
+
class pn extends class {} {
|
|
3876
3906
|
constructor(t, e, n, r) {
|
|
3877
3907
|
super(), this.authCredentials = t, this.appCheckCredentials = e, this.connection = n,
|
|
3878
3908
|
this.serializer = r, this.J = !1;
|
|
@@ -3899,19 +3929,19 @@ class mn extends class {} {
|
|
|
3899
3929
|
|
|
3900
3930
|
// TODO(firestorexp): Make sure there is only one Datastore instance per
|
|
3901
3931
|
// firestore-exp client.
|
|
3902
|
-
async function
|
|
3903
|
-
const n = I(t), r =
|
|
3904
|
-
writes: e.map((t =>
|
|
3932
|
+
async function yn(t, e) {
|
|
3933
|
+
const n = I(t), r = en(n.serializer) + "/documents", s = {
|
|
3934
|
+
writes: e.map((t => sn(n.serializer, t)))
|
|
3905
3935
|
};
|
|
3906
3936
|
await n.v("Commit", r, s);
|
|
3907
3937
|
}
|
|
3908
3938
|
|
|
3909
|
-
async function
|
|
3910
|
-
const n = I(t), r =
|
|
3911
|
-
documents: e.map((t =>
|
|
3939
|
+
async function gn(t, e) {
|
|
3940
|
+
const n = I(t), r = en(n.serializer) + "/documents", s = {
|
|
3941
|
+
documents: e.map((t => Xe(n.serializer, t)))
|
|
3912
3942
|
}, i = await n.R("BatchGetDocuments", r, s, e.length), o = new Map;
|
|
3913
3943
|
i.forEach((t => {
|
|
3914
|
-
const e =
|
|
3944
|
+
const e = rn(n.serializer, t);
|
|
3915
3945
|
o.set(e.key.toString(), e);
|
|
3916
3946
|
}));
|
|
3917
3947
|
const u = [];
|
|
@@ -3921,24 +3951,24 @@ async function yn(t, e) {
|
|
|
3921
3951
|
})), u;
|
|
3922
3952
|
}
|
|
3923
3953
|
|
|
3924
|
-
async function
|
|
3925
|
-
const n = I(t), r =
|
|
3954
|
+
async function _n(t, e) {
|
|
3955
|
+
const n = I(t), r = on(n.serializer, Pe(e));
|
|
3926
3956
|
return (await n.R("RunQuery", r.parent, {
|
|
3927
3957
|
structuredQuery: r.structuredQuery
|
|
3928
3958
|
})).filter((t => !!t.document)).map((t => function(t, e, n) {
|
|
3929
|
-
const r =
|
|
3959
|
+
const r = Ze(t, e.name), s = He(e.updateTime), i = e.createTime ? He(e.createTime) : le.min(), o = new ge({
|
|
3930
3960
|
mapValue: {
|
|
3931
3961
|
fields: e.fields
|
|
3932
3962
|
}
|
|
3933
|
-
}), u =
|
|
3963
|
+
}), u = _e.newFoundDocument(r, s, i, o);
|
|
3934
3964
|
return n && u.setHasCommittedMutations(), n ? u.setHasCommittedMutations() : u;
|
|
3935
3965
|
}(n.serializer, t.document, void 0)));
|
|
3936
3966
|
}
|
|
3937
3967
|
|
|
3938
|
-
async function
|
|
3968
|
+
async function vn(t, e, n) {
|
|
3939
3969
|
var r;
|
|
3940
3970
|
const s = I(t), {request: i, Z: o} = function(t, e, n) {
|
|
3941
|
-
const r =
|
|
3971
|
+
const r = on(t, e), s = {}, i = [];
|
|
3942
3972
|
let o = 0;
|
|
3943
3973
|
return n.forEach((t => {
|
|
3944
3974
|
// Map all client-side aliases to a unique short-form
|
|
@@ -3951,12 +3981,12 @@ async function _n(t, e, n) {
|
|
|
3951
3981
|
}) : "avg" === t.$ ? i.push({
|
|
3952
3982
|
alias: e,
|
|
3953
3983
|
avg: {
|
|
3954
|
-
field:
|
|
3984
|
+
field: hn(t.fieldPath)
|
|
3955
3985
|
}
|
|
3956
3986
|
}) : "sum" === t.$ && i.push({
|
|
3957
3987
|
alias: e,
|
|
3958
3988
|
sum: {
|
|
3959
|
-
field:
|
|
3989
|
+
field: hn(t.fieldPath)
|
|
3960
3990
|
}
|
|
3961
3991
|
});
|
|
3962
3992
|
})), {
|
|
@@ -3969,7 +3999,7 @@ async function _n(t, e, n) {
|
|
|
3969
3999
|
},
|
|
3970
4000
|
Z: s
|
|
3971
4001
|
};
|
|
3972
|
-
}(s.serializer,
|
|
4002
|
+
}(s.serializer, Pe(e), n), u = i.parent;
|
|
3973
4003
|
s.connection.g || delete i.parent;
|
|
3974
4004
|
const c = (await s.R("RunAggregationQuery", u, i, /*expectedResponseCount=*/ 1)).filter((t => !!t.result));
|
|
3975
4005
|
// Omit RunAggregationQueryResponse that only contain readTimes.
|
|
@@ -3996,7 +4026,7 @@ async function _n(t, e, n) {
|
|
|
3996
4026
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3997
4027
|
* See the License for the specific language governing permissions and
|
|
3998
4028
|
* limitations under the License.
|
|
3999
|
-
*/ const
|
|
4029
|
+
*/ const bn = new Map;
|
|
4000
4030
|
|
|
4001
4031
|
/**
|
|
4002
4032
|
* An instance map that ensures only one Datastore exists per Firestore
|
|
@@ -4007,17 +4037,17 @@ async function _n(t, e, n) {
|
|
|
4007
4037
|
* instance. Callers must invoke removeComponents() when the Firestore
|
|
4008
4038
|
* instance is terminated.
|
|
4009
4039
|
*/
|
|
4010
|
-
function
|
|
4040
|
+
function En(t) {
|
|
4011
4041
|
if (t._terminated) throw new U(S, "The client has already been terminated.");
|
|
4012
|
-
if (!
|
|
4042
|
+
if (!bn.has(t)) {
|
|
4013
4043
|
y("ComponentProvider", "Initializing Datastore");
|
|
4014
4044
|
const i = function(t) {
|
|
4015
|
-
return new
|
|
4045
|
+
return new _t(t, fetch.bind(null));
|
|
4016
4046
|
}((e = t._databaseId, n = t.app.options.appId || "", r = t._persistenceKey, s = t._freezeSettings(),
|
|
4017
|
-
new J(e, n, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), o =
|
|
4018
|
-
return new
|
|
4047
|
+
new J(e, n, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, ht(s.experimentalLongPollingOptions), s.useFetchStreams))), o = wn(t._databaseId), u = function(t, e, n, r) {
|
|
4048
|
+
return new pn(t, e, n, r);
|
|
4019
4049
|
}(t._authCredentials, t._appCheckCredentials, i, o);
|
|
4020
|
-
|
|
4050
|
+
bn.set(t, u);
|
|
4021
4051
|
}
|
|
4022
4052
|
var e, n, r, s;
|
|
4023
4053
|
/**
|
|
@@ -4035,7 +4065,7 @@ function bn(t) {
|
|
|
4035
4065
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4036
4066
|
* See the License for the specific language governing permissions and
|
|
4037
4067
|
* limitations under the License.
|
|
4038
|
-
*/ return
|
|
4068
|
+
*/ return bn.get(t);
|
|
4039
4069
|
}
|
|
4040
4070
|
|
|
4041
4071
|
/**
|
|
@@ -4047,9 +4077,9 @@ function bn(t) {
|
|
|
4047
4077
|
* user-supplied `FirestoreSettings` object. This is a separate type so that
|
|
4048
4078
|
* defaults can be supplied and the value can be checked for equality.
|
|
4049
4079
|
*/
|
|
4050
|
-
class
|
|
4080
|
+
class In {
|
|
4051
4081
|
constructor(t) {
|
|
4052
|
-
var e;
|
|
4082
|
+
var e, n;
|
|
4053
4083
|
if (void 0 === t.host) {
|
|
4054
4084
|
if (void 0 !== t.ssl) throw new U(P, "Can't provide ssl option if host option is not set");
|
|
4055
4085
|
this.host = "firestore.googleapis.com", this.ssl = true;
|
|
@@ -4062,19 +4092,20 @@ class En {
|
|
|
4062
4092
|
!function(t, e, n, r) {
|
|
4063
4093
|
if (!0 === e && !0 === r) throw new U(P, `${t} and ${n} cannot be used together.`);
|
|
4064
4094
|
}("experimentalForceLongPolling", t.experimentalForceLongPolling, "experimentalAutoDetectLongPolling", t.experimentalAutoDetectLongPolling),
|
|
4065
|
-
this.experimentalForceLongPolling = !!t.experimentalForceLongPolling, this.experimentalForceLongPolling ? this.experimentalAutoDetectLongPolling = !1 : void 0 === t.experimentalAutoDetectLongPolling ? this.experimentalAutoDetectLongPolling =
|
|
4095
|
+
this.experimentalForceLongPolling = !!t.experimentalForceLongPolling, this.experimentalForceLongPolling ? this.experimentalAutoDetectLongPolling = !1 : void 0 === t.experimentalAutoDetectLongPolling ? this.experimentalAutoDetectLongPolling = true :
|
|
4066
4096
|
// For backwards compatibility, coerce the value to boolean even though
|
|
4067
4097
|
// the TypeScript compiler has narrowed the type to boolean already.
|
|
4068
4098
|
// noinspection PointlessBooleanExpressionJS
|
|
4069
4099
|
this.experimentalAutoDetectLongPolling = !!t.experimentalAutoDetectLongPolling,
|
|
4070
|
-
this.
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
}
|
|
4076
|
-
|
|
4077
|
-
|
|
4100
|
+
this.experimentalLongPollingOptions = ht(null !== (n = t.experimentalLongPollingOptions) && void 0 !== n ? n : {}),
|
|
4101
|
+
function(t) {
|
|
4102
|
+
if (void 0 !== t.timeoutSeconds) {
|
|
4103
|
+
if (isNaN(t.timeoutSeconds)) throw new U(P, `invalid long polling timeout: ${t.timeoutSeconds} (must not be NaN)`);
|
|
4104
|
+
if (t.timeoutSeconds < 5) throw new U(P, `invalid long polling timeout: ${t.timeoutSeconds} (minimum allowed value is 5)`);
|
|
4105
|
+
if (t.timeoutSeconds > 30) throw new U(P, `invalid long polling timeout: ${t.timeoutSeconds} (maximum allowed value is 30)`);
|
|
4106
|
+
}
|
|
4107
|
+
}
|
|
4108
|
+
/**
|
|
4078
4109
|
* @license
|
|
4079
4110
|
* Copyright 2020 Google LLC
|
|
4080
4111
|
*
|
|
@@ -4090,11 +4121,20 @@ class En {
|
|
|
4090
4121
|
* See the License for the specific language governing permissions and
|
|
4091
4122
|
* limitations under the License.
|
|
4092
4123
|
*/
|
|
4093
|
-
/**
|
|
4124
|
+
/**
|
|
4094
4125
|
* The Cloud Firestore service interface.
|
|
4095
4126
|
*
|
|
4096
4127
|
* Do not call this constructor directly. Instead, use {@link (getFirestore:1)}.
|
|
4097
|
-
*/
|
|
4128
|
+
*/ (this.experimentalLongPollingOptions), this.useFetchStreams = !!t.useFetchStreams;
|
|
4129
|
+
}
|
|
4130
|
+
isEqual(t) {
|
|
4131
|
+
return this.host === t.host && this.ssl === t.ssl && this.credentials === t.credentials && this.cacheSizeBytes === t.cacheSizeBytes && this.experimentalForceLongPolling === t.experimentalForceLongPolling && this.experimentalAutoDetectLongPolling === t.experimentalAutoDetectLongPolling && (e = this.experimentalLongPollingOptions,
|
|
4132
|
+
n = t.experimentalLongPollingOptions, e.timeoutSeconds === n.timeoutSeconds) && this.ignoreUndefinedProperties === t.ignoreUndefinedProperties && this.useFetchStreams === t.useFetchStreams;
|
|
4133
|
+
var e, n;
|
|
4134
|
+
}
|
|
4135
|
+
}
|
|
4136
|
+
|
|
4137
|
+
class Tn {
|
|
4098
4138
|
/** @hideconstructor */
|
|
4099
4139
|
constructor(t, e, n, r) {
|
|
4100
4140
|
this._authCredentials = t, this._appCheckCredentials = e, this._databaseId = n,
|
|
@@ -4102,7 +4142,7 @@ class En {
|
|
|
4102
4142
|
/**
|
|
4103
4143
|
* Whether it's a Firestore or Firestore Lite instance.
|
|
4104
4144
|
*/
|
|
4105
|
-
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new
|
|
4145
|
+
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new In({}),
|
|
4106
4146
|
this._settingsFrozen = !1;
|
|
4107
4147
|
}
|
|
4108
4148
|
/**
|
|
@@ -4120,7 +4160,7 @@ class En {
|
|
|
4120
4160
|
}
|
|
4121
4161
|
_setSettings(t) {
|
|
4122
4162
|
if (this._settingsFrozen) throw new U(S, "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.");
|
|
4123
|
-
this._settings = new
|
|
4163
|
+
this._settings = new In(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
|
|
4124
4164
|
if (!t) return new Q;
|
|
4125
4165
|
switch (t.type) {
|
|
4126
4166
|
case "firstParty":
|
|
@@ -4158,13 +4198,13 @@ class En {
|
|
|
4158
4198
|
* Only ever called once.
|
|
4159
4199
|
*/ _terminate() {
|
|
4160
4200
|
return function(t) {
|
|
4161
|
-
const e =
|
|
4162
|
-
e && (y("ComponentProvider", "Removing Datastore"),
|
|
4201
|
+
const e = bn.get(t);
|
|
4202
|
+
e && (y("ComponentProvider", "Removing Datastore"), bn.delete(t), e.terminate());
|
|
4163
4203
|
}(this), Promise.resolve();
|
|
4164
4204
|
}
|
|
4165
4205
|
}
|
|
4166
4206
|
|
|
4167
|
-
function
|
|
4207
|
+
function An(t, e, n) {
|
|
4168
4208
|
n || (n = "(default)");
|
|
4169
4209
|
const r = _getProvider(t, "firestore/lite");
|
|
4170
4210
|
if (r.isInitialized(n)) throw new U(S, "Firestore can only be initialized once per app.");
|
|
@@ -4174,13 +4214,13 @@ function Tn(t, e, n) {
|
|
|
4174
4214
|
});
|
|
4175
4215
|
}
|
|
4176
4216
|
|
|
4177
|
-
function
|
|
4217
|
+
function Rn(e, n) {
|
|
4178
4218
|
const r = "object" == typeof e ? e : getApp(), s = "string" == typeof e ? e : n || "(default)", i = _getProvider(r, "firestore/lite").getImmediate({
|
|
4179
4219
|
identifier: s
|
|
4180
4220
|
});
|
|
4181
4221
|
if (!i._initialized) {
|
|
4182
4222
|
const t = getDefaultEmulatorHostnameAndPort("firestore");
|
|
4183
|
-
t &&
|
|
4223
|
+
t && Pn(i, ...t);
|
|
4184
4224
|
}
|
|
4185
4225
|
return i;
|
|
4186
4226
|
}
|
|
@@ -4197,9 +4237,9 @@ function An(e, n) {
|
|
|
4197
4237
|
* @param port - the emulator port (ex: 9000).
|
|
4198
4238
|
* @param options.mockUserToken - the mock auth token to use for unit testing
|
|
4199
4239
|
* Security Rules.
|
|
4200
|
-
*/ function
|
|
4240
|
+
*/ function Pn(t, e, n, r = {}) {
|
|
4201
4241
|
var s;
|
|
4202
|
-
const i = (t = ct(t,
|
|
4242
|
+
const i = (t = ct(t, Tn))._getSettings();
|
|
4203
4243
|
if ("firestore.googleapis.com" !== i.host && i.host !== e && _("Host has been set in both settings() and useEmulator(), emulator host will be used"),
|
|
4204
4244
|
t._setSettings(Object.assign(Object.assign({}, i), {
|
|
4205
4245
|
host: `${e}:${n}`,
|
|
@@ -4237,8 +4277,8 @@ function An(e, n) {
|
|
|
4237
4277
|
* @param firestore - The `Firestore` instance to terminate.
|
|
4238
4278
|
* @returns A `Promise` that is resolved when the instance has been successfully
|
|
4239
4279
|
* terminated.
|
|
4240
|
-
*/ function
|
|
4241
|
-
return t = ct(t,
|
|
4280
|
+
*/ function Vn(t) {
|
|
4281
|
+
return t = ct(t, Tn), _removeServiceInstance(t.app, "firestore/lite"), t._delete();
|
|
4242
4282
|
}
|
|
4243
4283
|
|
|
4244
4284
|
/**
|
|
@@ -4277,7 +4317,7 @@ function An(e, n) {
|
|
|
4277
4317
|
* Represents an aggregation that can be performed by Firestore.
|
|
4278
4318
|
*/
|
|
4279
4319
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4280
|
-
class
|
|
4320
|
+
class $n {
|
|
4281
4321
|
/**
|
|
4282
4322
|
* Create a new AggregateField<T>
|
|
4283
4323
|
* @param _aggregateType Specifies the type of aggregation operation to perform.
|
|
@@ -4295,7 +4335,7 @@ class Vn {
|
|
|
4295
4335
|
|
|
4296
4336
|
/**
|
|
4297
4337
|
* The results of executing an aggregation query.
|
|
4298
|
-
*/ class
|
|
4338
|
+
*/ class Nn {
|
|
4299
4339
|
/** @hideconstructor */
|
|
4300
4340
|
constructor(t, e, n) {
|
|
4301
4341
|
this._userDataWriter = e, this._data = n,
|
|
@@ -4365,7 +4405,7 @@ class Vn {
|
|
|
4365
4405
|
/**
|
|
4366
4406
|
* The collection this `DocumentReference` belongs to.
|
|
4367
4407
|
*/ get parent() {
|
|
4368
|
-
return new
|
|
4408
|
+
return new xn(this.firestore, this.converter, this._key.path.popLast());
|
|
4369
4409
|
}
|
|
4370
4410
|
withConverter(t) {
|
|
4371
4411
|
return new Dn(this.firestore, t, this._key);
|
|
@@ -4375,7 +4415,7 @@ class Vn {
|
|
|
4375
4415
|
/**
|
|
4376
4416
|
* A `Query` refers to a query which you can read or listen to. You can also
|
|
4377
4417
|
* construct refined `Query` objects by adding filters and ordering.
|
|
4378
|
-
*/ class
|
|
4418
|
+
*/ class Fn {
|
|
4379
4419
|
// This is the lite version of the Query class in the main SDK.
|
|
4380
4420
|
/** @hideconstructor protected */
|
|
4381
4421
|
constructor(t,
|
|
@@ -4388,17 +4428,17 @@ class Vn {
|
|
|
4388
4428
|
this.type = "query", this.firestore = t;
|
|
4389
4429
|
}
|
|
4390
4430
|
withConverter(t) {
|
|
4391
|
-
return new
|
|
4431
|
+
return new Fn(this.firestore, t, this._query);
|
|
4392
4432
|
}
|
|
4393
4433
|
}
|
|
4394
4434
|
|
|
4395
4435
|
/**
|
|
4396
4436
|
* A `CollectionReference` object can be used for adding documents, getting
|
|
4397
4437
|
* document references, and querying for documents (using {@link (query:1)}).
|
|
4398
|
-
*/ class
|
|
4438
|
+
*/ class xn extends Fn {
|
|
4399
4439
|
/** @hideconstructor */
|
|
4400
4440
|
constructor(t, e, n) {
|
|
4401
|
-
super(t, e, new
|
|
4441
|
+
super(t, e, new Ee(n)), this._path = n,
|
|
4402
4442
|
/** The type of this Firestore reference. */
|
|
4403
4443
|
this.type = "collection";
|
|
4404
4444
|
}
|
|
@@ -4420,19 +4460,19 @@ class Vn {
|
|
|
4420
4460
|
/* converter= */ null, new rt(t));
|
|
4421
4461
|
}
|
|
4422
4462
|
withConverter(t) {
|
|
4423
|
-
return new
|
|
4463
|
+
return new xn(this.firestore, t, this._path);
|
|
4424
4464
|
}
|
|
4425
4465
|
}
|
|
4426
4466
|
|
|
4427
|
-
function
|
|
4428
|
-
if (t = getModularInstance(t), st("collection", "path", e), t instanceof
|
|
4467
|
+
function Sn(t, e, ...n) {
|
|
4468
|
+
if (t = getModularInstance(t), st("collection", "path", e), t instanceof Tn) {
|
|
4429
4469
|
const r = tt.fromString(e, ...n);
|
|
4430
|
-
return ot(r), new
|
|
4470
|
+
return ot(r), new xn(t, /* converter= */ null, r);
|
|
4431
4471
|
}
|
|
4432
4472
|
{
|
|
4433
|
-
if (!(t instanceof Dn || t instanceof
|
|
4473
|
+
if (!(t instanceof Dn || t instanceof xn)) throw new U(P, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
4434
4474
|
const r = t._path.child(tt.fromString(e, ...n));
|
|
4435
|
-
return ot(r), new
|
|
4475
|
+
return ot(r), new xn(t.firestore,
|
|
4436
4476
|
/* converter= */ null, r);
|
|
4437
4477
|
}
|
|
4438
4478
|
}
|
|
@@ -4449,27 +4489,27 @@ function xn(t, e, ...n) {
|
|
|
4449
4489
|
* collection or subcollection with this ID as the last segment of its path
|
|
4450
4490
|
* will be included. Cannot contain a slash.
|
|
4451
4491
|
* @returns The created `Query`.
|
|
4452
|
-
*/ function
|
|
4453
|
-
if (t = ct(t,
|
|
4454
|
-
return new
|
|
4492
|
+
*/ function qn(t, e) {
|
|
4493
|
+
if (t = ct(t, Tn), st("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new U(P, `Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
|
|
4494
|
+
return new Fn(t,
|
|
4455
4495
|
/* converter= */ null, function(t) {
|
|
4456
|
-
return new
|
|
4496
|
+
return new Ee(tt.emptyPath(), t);
|
|
4457
4497
|
}(e));
|
|
4458
4498
|
}
|
|
4459
4499
|
|
|
4460
|
-
function
|
|
4500
|
+
function On(t, e, ...n) {
|
|
4461
4501
|
if (t = getModularInstance(t),
|
|
4462
4502
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
4463
4503
|
// 'undefined' and 'null'.
|
|
4464
|
-
1 === arguments.length && (e =
|
|
4504
|
+
1 === arguments.length && (e = Et.N()), st("doc", "path", e), t instanceof Tn) {
|
|
4465
4505
|
const r = tt.fromString(e, ...n);
|
|
4466
4506
|
return it(r), new Dn(t,
|
|
4467
4507
|
/* converter= */ null, new rt(r));
|
|
4468
4508
|
}
|
|
4469
4509
|
{
|
|
4470
|
-
if (!(t instanceof Dn || t instanceof
|
|
4510
|
+
if (!(t instanceof Dn || t instanceof xn)) throw new U(P, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
4471
4511
|
const r = t._path.child(tt.fromString(e, ...n));
|
|
4472
|
-
return it(r), new Dn(t.firestore, t instanceof
|
|
4512
|
+
return it(r), new Dn(t.firestore, t instanceof xn ? t.converter : null, new rt(r));
|
|
4473
4513
|
}
|
|
4474
4514
|
}
|
|
4475
4515
|
|
|
@@ -4480,8 +4520,8 @@ function qn(t, e, ...n) {
|
|
|
4480
4520
|
* @param right - A reference to compare.
|
|
4481
4521
|
* @returns true if the references point to the same location in the same
|
|
4482
4522
|
* Firestore database.
|
|
4483
|
-
*/ function
|
|
4484
|
-
return t = getModularInstance(t), e = getModularInstance(e), (t instanceof Dn || t instanceof
|
|
4523
|
+
*/ function kn(t, e) {
|
|
4524
|
+
return t = getModularInstance(t), e = getModularInstance(e), (t instanceof Dn || t instanceof xn) && (e instanceof Dn || e instanceof xn) && (t.firestore === e.firestore && t.path === e.path && t.converter === e.converter);
|
|
4485
4525
|
}
|
|
4486
4526
|
|
|
4487
4527
|
/**
|
|
@@ -4492,8 +4532,8 @@ function qn(t, e, ...n) {
|
|
|
4492
4532
|
* @param right - A `Query` to compare.
|
|
4493
4533
|
* @returns true if the references point to the same location in the same
|
|
4494
4534
|
* Firestore database.
|
|
4495
|
-
*/ function
|
|
4496
|
-
return t = getModularInstance(t), e = getModularInstance(e), t instanceof
|
|
4535
|
+
*/ function Cn(t, e) {
|
|
4536
|
+
return t = getModularInstance(t), e = getModularInstance(e), t instanceof Fn && e instanceof Fn && (t.firestore === e.firestore && $e(t._query, e._query) && t.converter === e.converter);
|
|
4497
4537
|
}
|
|
4498
4538
|
|
|
4499
4539
|
/**
|
|
@@ -4514,7 +4554,7 @@ function qn(t, e, ...n) {
|
|
|
4514
4554
|
*/
|
|
4515
4555
|
/**
|
|
4516
4556
|
* An immutable object representing an array of bytes.
|
|
4517
|
-
*/ class
|
|
4557
|
+
*/ class Mn {
|
|
4518
4558
|
/** @hideconstructor */
|
|
4519
4559
|
constructor(t) {
|
|
4520
4560
|
this._byteString = t;
|
|
@@ -4526,7 +4566,7 @@ function qn(t, e, ...n) {
|
|
|
4526
4566
|
* @param base64 - The Base64 string used to create the `Bytes` object.
|
|
4527
4567
|
*/ static fromBase64String(t) {
|
|
4528
4568
|
try {
|
|
4529
|
-
return new
|
|
4569
|
+
return new Mn(Vt.fromBase64String(t));
|
|
4530
4570
|
} catch (t) {
|
|
4531
4571
|
throw new U(P, "Failed to construct data from Base64 string: " + t);
|
|
4532
4572
|
}
|
|
@@ -4536,7 +4576,7 @@ function qn(t, e, ...n) {
|
|
|
4536
4576
|
*
|
|
4537
4577
|
* @param array - The Uint8Array used to create the `Bytes` object.
|
|
4538
4578
|
*/ static fromUint8Array(t) {
|
|
4539
|
-
return new
|
|
4579
|
+
return new Mn(Vt.fromUint8Array(t));
|
|
4540
4580
|
}
|
|
4541
4581
|
/**
|
|
4542
4582
|
* Returns the underlying bytes as a Base64-encoded string.
|
|
@@ -4592,7 +4632,7 @@ function qn(t, e, ...n) {
|
|
|
4592
4632
|
*
|
|
4593
4633
|
* Create a `FieldPath` by providing field names. If more than one field
|
|
4594
4634
|
* name is provided, the path will point to a nested field in a document.
|
|
4595
|
-
*/ class
|
|
4635
|
+
*/ class Ln {
|
|
4596
4636
|
/**
|
|
4597
4637
|
* Creates a `FieldPath` from the provided field names. If more than one field
|
|
4598
4638
|
* name is provided, the path will point to a nested field in a document.
|
|
@@ -4616,8 +4656,8 @@ function qn(t, e, ...n) {
|
|
|
4616
4656
|
/**
|
|
4617
4657
|
* Returns a special sentinel `FieldPath` to refer to the ID of a document.
|
|
4618
4658
|
* It can be used in queries to sort or filter by the document ID.
|
|
4619
|
-
*/ function
|
|
4620
|
-
return new
|
|
4659
|
+
*/ function Un() {
|
|
4660
|
+
return new Ln("__name__");
|
|
4621
4661
|
}
|
|
4622
4662
|
|
|
4623
4663
|
/**
|
|
@@ -4639,7 +4679,7 @@ function qn(t, e, ...n) {
|
|
|
4639
4679
|
/**
|
|
4640
4680
|
* Sentinel values that can be used when writing document fields with `set()`
|
|
4641
4681
|
* or `update()`.
|
|
4642
|
-
*/ class
|
|
4682
|
+
*/ class jn {
|
|
4643
4683
|
/**
|
|
4644
4684
|
* @param _methodName - The public API endpoint that returns this class.
|
|
4645
4685
|
* @hideconstructor
|
|
@@ -4671,7 +4711,7 @@ function qn(t, e, ...n) {
|
|
|
4671
4711
|
*
|
|
4672
4712
|
* Latitude values are in the range of [-90, 90].
|
|
4673
4713
|
* Longitude values are in the range of [-180, 180].
|
|
4674
|
-
*/ class
|
|
4714
|
+
*/ class Bn {
|
|
4675
4715
|
/**
|
|
4676
4716
|
* Creates a new immutable `GeoPoint` object with the provided latitude and
|
|
4677
4717
|
* longitude values.
|
|
@@ -4711,7 +4751,7 @@ function qn(t, e, ...n) {
|
|
|
4711
4751
|
* Actually private to JS consumers of our API, so this function is prefixed
|
|
4712
4752
|
* with an underscore.
|
|
4713
4753
|
*/ _compareTo(t) {
|
|
4714
|
-
return
|
|
4754
|
+
return It(this._lat, t._lat) || It(this._long, t._long);
|
|
4715
4755
|
}
|
|
4716
4756
|
}
|
|
4717
4757
|
|
|
@@ -4730,29 +4770,29 @@ function qn(t, e, ...n) {
|
|
|
4730
4770
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4731
4771
|
* See the License for the specific language governing permissions and
|
|
4732
4772
|
* limitations under the License.
|
|
4733
|
-
*/ const
|
|
4773
|
+
*/ const Qn = /^__.*__$/;
|
|
4734
4774
|
|
|
4735
|
-
/** The result of parsing document data (e.g. for a setData call). */ class
|
|
4775
|
+
/** The result of parsing document data (e.g. for a setData call). */ class zn {
|
|
4736
4776
|
constructor(t, e, n) {
|
|
4737
4777
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
4738
4778
|
}
|
|
4739
4779
|
toMutation(t, e) {
|
|
4740
|
-
return null !== this.fieldMask ? new
|
|
4780
|
+
return null !== this.fieldMask ? new Le(t, this.data, this.fieldMask, e, this.fieldTransforms) : new Me(t, this.data, e, this.fieldTransforms);
|
|
4741
4781
|
}
|
|
4742
4782
|
}
|
|
4743
4783
|
|
|
4744
|
-
/** The result of parsing "update" data (i.e. for an updateData call). */ class
|
|
4784
|
+
/** The result of parsing "update" data (i.e. for an updateData call). */ class Wn {
|
|
4745
4785
|
constructor(t,
|
|
4746
4786
|
// The fieldMask does not include document transforms.
|
|
4747
4787
|
e, n) {
|
|
4748
4788
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
4749
4789
|
}
|
|
4750
4790
|
toMutation(t, e) {
|
|
4751
|
-
return new
|
|
4791
|
+
return new Le(t, this.data, this.fieldMask, e, this.fieldTransforms);
|
|
4752
4792
|
}
|
|
4753
4793
|
}
|
|
4754
4794
|
|
|
4755
|
-
function
|
|
4795
|
+
function Gn(t) {
|
|
4756
4796
|
switch (t) {
|
|
4757
4797
|
case 0 /* UserDataSource.Set */ :
|
|
4758
4798
|
// fall through
|
|
@@ -4770,7 +4810,7 @@ function Wn(t) {
|
|
|
4770
4810
|
}
|
|
4771
4811
|
}
|
|
4772
4812
|
|
|
4773
|
-
/** A "context" object passed around while parsing user data. */ class
|
|
4813
|
+
/** A "context" object passed around while parsing user data. */ class Kn {
|
|
4774
4814
|
/**
|
|
4775
4815
|
* Initializes a ParseContext with the given source and path.
|
|
4776
4816
|
*
|
|
@@ -4802,7 +4842,7 @@ function Wn(t) {
|
|
|
4802
4842
|
return this.settings.et;
|
|
4803
4843
|
}
|
|
4804
4844
|
/** Returns a new context with the specified settings overwritten. */ nt(t) {
|
|
4805
|
-
return new
|
|
4845
|
+
return new Kn(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.serializer, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
|
|
4806
4846
|
}
|
|
4807
4847
|
rt(t) {
|
|
4808
4848
|
var e;
|
|
@@ -4829,7 +4869,7 @@ function Wn(t) {
|
|
|
4829
4869
|
});
|
|
4830
4870
|
}
|
|
4831
4871
|
ct(t) {
|
|
4832
|
-
return
|
|
4872
|
+
return wr(t, this.settings.methodName, this.settings.at || !1, this.path, this.settings.ht);
|
|
4833
4873
|
}
|
|
4834
4874
|
/** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
|
|
4835
4875
|
return void 0 !== this.fieldMask.find((e => t.isPrefixOf(e))) || void 0 !== this.fieldTransforms.find((e => t.isPrefixOf(e.field)));
|
|
@@ -4841,19 +4881,19 @@ function Wn(t) {
|
|
|
4841
4881
|
}
|
|
4842
4882
|
it(t) {
|
|
4843
4883
|
if (0 === t.length) throw this.ct("Document fields must not be empty");
|
|
4844
|
-
if (
|
|
4884
|
+
if (Gn(this.et) && Qn.test(t)) throw this.ct('Document fields cannot begin and end with "__"');
|
|
4845
4885
|
}
|
|
4846
4886
|
}
|
|
4847
4887
|
|
|
4848
4888
|
/**
|
|
4849
4889
|
* Helper for parsing raw user input (provided via the API) into internal model
|
|
4850
4890
|
* classes.
|
|
4851
|
-
*/ class
|
|
4891
|
+
*/ class Yn {
|
|
4852
4892
|
constructor(t, e, n) {
|
|
4853
|
-
this.databaseId = t, this.ignoreUndefinedProperties = e, this.serializer = n ||
|
|
4893
|
+
this.databaseId = t, this.ignoreUndefinedProperties = e, this.serializer = n || wn(t);
|
|
4854
4894
|
}
|
|
4855
4895
|
/** Creates a new top-level parse context. */ lt(t, e, n, r = !1) {
|
|
4856
|
-
return new
|
|
4896
|
+
return new Kn({
|
|
4857
4897
|
et: t,
|
|
4858
4898
|
methodName: e,
|
|
4859
4899
|
ht: n,
|
|
@@ -4864,29 +4904,29 @@ function Wn(t) {
|
|
|
4864
4904
|
}
|
|
4865
4905
|
}
|
|
4866
4906
|
|
|
4867
|
-
function
|
|
4868
|
-
const e = t._freezeSettings(), n =
|
|
4869
|
-
return new
|
|
4907
|
+
function Hn(t) {
|
|
4908
|
+
const e = t._freezeSettings(), n = wn(t._databaseId);
|
|
4909
|
+
return new Yn(t._databaseId, !!e.ignoreUndefinedProperties, n);
|
|
4870
4910
|
}
|
|
4871
4911
|
|
|
4872
|
-
/** Parse document data from a set() call. */ function
|
|
4912
|
+
/** Parse document data from a set() call. */ function Jn(t, e, n, r, s, i = {}) {
|
|
4873
4913
|
const o = t.lt(i.merge || i.mergeFields ? 2 /* UserDataSource.MergeSet */ : 0 /* UserDataSource.Set */ , e, n, s);
|
|
4874
|
-
|
|
4875
|
-
const u =
|
|
4914
|
+
hr("Data must be an object, but it was:", o, r);
|
|
4915
|
+
const u = cr(r, o);
|
|
4876
4916
|
let c, a;
|
|
4877
|
-
if (i.merge) c = new
|
|
4917
|
+
if (i.merge) c = new ye(o.fieldMask), a = o.fieldTransforms; else if (i.mergeFields) {
|
|
4878
4918
|
const t = [];
|
|
4879
4919
|
for (const r of i.mergeFields) {
|
|
4880
|
-
const s =
|
|
4920
|
+
const s = lr(e, r, n);
|
|
4881
4921
|
if (!o.contains(s)) throw new U(P, `Field '${s}' is specified in your field mask but missing from your input data.`);
|
|
4882
|
-
|
|
4922
|
+
mr(t, s) || t.push(s);
|
|
4883
4923
|
}
|
|
4884
|
-
c = new
|
|
4924
|
+
c = new ye(t), a = o.fieldTransforms.filter((t => c.covers(t.field)));
|
|
4885
4925
|
} else c = null, a = o.fieldTransforms;
|
|
4886
|
-
return new
|
|
4926
|
+
return new zn(new ge(u), c, a);
|
|
4887
4927
|
}
|
|
4888
4928
|
|
|
4889
|
-
class
|
|
4929
|
+
class Xn extends jn {
|
|
4890
4930
|
_toFieldTransform(t) {
|
|
4891
4931
|
if (2 /* UserDataSource.MergeSet */ !== t.et) throw 1 /* UserDataSource.Update */ === t.et ? t.ct(`${this._methodName}() can only appear at the top level of your update data`) : t.ct(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);
|
|
4892
4932
|
// No transform to add for a delete, but we need to add it to our
|
|
@@ -4894,7 +4934,7 @@ class Jn extends Un {
|
|
|
4894
4934
|
return t.fieldMask.push(t.path), null;
|
|
4895
4935
|
}
|
|
4896
4936
|
isEqual(t) {
|
|
4897
|
-
return t instanceof
|
|
4937
|
+
return t instanceof Xn;
|
|
4898
4938
|
}
|
|
4899
4939
|
}
|
|
4900
4940
|
|
|
@@ -4913,8 +4953,8 @@ class Jn extends Un {
|
|
|
4913
4953
|
* context.
|
|
4914
4954
|
* @param context - The parent context.
|
|
4915
4955
|
* @param arrayElement - Whether or not the FieldValue has an array.
|
|
4916
|
-
*/ function
|
|
4917
|
-
return new
|
|
4956
|
+
*/ function Zn(t, e, n) {
|
|
4957
|
+
return new Kn({
|
|
4918
4958
|
et: 3 /* UserDataSource.Argument */ ,
|
|
4919
4959
|
ht: e.settings.ht,
|
|
4920
4960
|
methodName: t._methodName,
|
|
@@ -4922,23 +4962,23 @@ class Jn extends Un {
|
|
|
4922
4962
|
}, e.databaseId, e.serializer, e.ignoreUndefinedProperties);
|
|
4923
4963
|
}
|
|
4924
4964
|
|
|
4925
|
-
class
|
|
4965
|
+
class tr extends jn {
|
|
4926
4966
|
_toFieldTransform(t) {
|
|
4927
|
-
return new
|
|
4967
|
+
return new Oe(t.path, new Fe);
|
|
4928
4968
|
}
|
|
4929
4969
|
isEqual(t) {
|
|
4930
|
-
return t instanceof
|
|
4970
|
+
return t instanceof tr;
|
|
4931
4971
|
}
|
|
4932
4972
|
}
|
|
4933
4973
|
|
|
4934
|
-
class
|
|
4974
|
+
class er extends jn {
|
|
4935
4975
|
constructor(t, e) {
|
|
4936
4976
|
super(t), this.ft = e;
|
|
4937
4977
|
}
|
|
4938
4978
|
_toFieldTransform(t) {
|
|
4939
|
-
const e =
|
|
4940
|
-
/*array=*/ !0), n = this.ft.map((t =>
|
|
4941
|
-
return new
|
|
4979
|
+
const e = Zn(this, t,
|
|
4980
|
+
/*array=*/ !0), n = this.ft.map((t => ur(t, e))), r = new xe(n);
|
|
4981
|
+
return new Oe(t.path, r);
|
|
4942
4982
|
}
|
|
4943
4983
|
isEqual(t) {
|
|
4944
4984
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4946,14 +4986,14 @@ class tr extends Un {
|
|
|
4946
4986
|
}
|
|
4947
4987
|
}
|
|
4948
4988
|
|
|
4949
|
-
class
|
|
4989
|
+
class nr extends jn {
|
|
4950
4990
|
constructor(t, e) {
|
|
4951
4991
|
super(t), this.ft = e;
|
|
4952
4992
|
}
|
|
4953
4993
|
_toFieldTransform(t) {
|
|
4954
|
-
const e =
|
|
4955
|
-
/*array=*/ !0), n = this.ft.map((t =>
|
|
4956
|
-
return new
|
|
4994
|
+
const e = Zn(this, t,
|
|
4995
|
+
/*array=*/ !0), n = this.ft.map((t => ur(t, e))), r = new Se(n);
|
|
4996
|
+
return new Oe(t.path, r);
|
|
4957
4997
|
}
|
|
4958
4998
|
isEqual(t) {
|
|
4959
4999
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4961,13 +5001,13 @@ class er extends Un {
|
|
|
4961
5001
|
}
|
|
4962
5002
|
}
|
|
4963
5003
|
|
|
4964
|
-
class
|
|
5004
|
+
class rr extends jn {
|
|
4965
5005
|
constructor(t, e) {
|
|
4966
5006
|
super(t), this.dt = e;
|
|
4967
5007
|
}
|
|
4968
5008
|
_toFieldTransform(t) {
|
|
4969
|
-
const e = new
|
|
4970
|
-
return new
|
|
5009
|
+
const e = new qe(t.serializer, Ne(t.serializer, this.dt));
|
|
5010
|
+
return new Oe(t.path, e);
|
|
4971
5011
|
}
|
|
4972
5012
|
isEqual(t) {
|
|
4973
5013
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4975,50 +5015,50 @@ class nr extends Un {
|
|
|
4975
5015
|
}
|
|
4976
5016
|
}
|
|
4977
5017
|
|
|
4978
|
-
/** Parse update data from an update() call. */ function
|
|
5018
|
+
/** Parse update data from an update() call. */ function sr(t, e, n, r) {
|
|
4979
5019
|
const s = t.lt(1 /* UserDataSource.Update */ , e, n);
|
|
4980
|
-
|
|
4981
|
-
const i = [], o =
|
|
4982
|
-
|
|
4983
|
-
const u =
|
|
5020
|
+
hr("Data must be an object, but it was:", s, r);
|
|
5021
|
+
const i = [], o = ge.empty();
|
|
5022
|
+
Rt(r, ((t, r) => {
|
|
5023
|
+
const u = dr(e, t, n);
|
|
4984
5024
|
// For Compat types, we have to "extract" the underlying types before
|
|
4985
5025
|
// performing validation.
|
|
4986
5026
|
r = getModularInstance(r);
|
|
4987
5027
|
const c = s.ot(u);
|
|
4988
|
-
if (r instanceof
|
|
5028
|
+
if (r instanceof Xn)
|
|
4989
5029
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4990
5030
|
i.push(u); else {
|
|
4991
|
-
const t =
|
|
5031
|
+
const t = ur(r, c);
|
|
4992
5032
|
null != t && (i.push(u), o.set(u, t));
|
|
4993
5033
|
}
|
|
4994
5034
|
}));
|
|
4995
|
-
const u = new
|
|
4996
|
-
return new
|
|
5035
|
+
const u = new ye(i);
|
|
5036
|
+
return new Wn(o, u, s.fieldTransforms);
|
|
4997
5037
|
}
|
|
4998
5038
|
|
|
4999
|
-
/** Parse update data from a list of field/value arguments. */ function
|
|
5000
|
-
const o = t.lt(1 /* UserDataSource.Update */ , e, n), u = [
|
|
5039
|
+
/** Parse update data from a list of field/value arguments. */ function ir(t, e, n, r, s, i) {
|
|
5040
|
+
const o = t.lt(1 /* UserDataSource.Update */ , e, n), u = [ lr(e, r, n) ], c = [ s ];
|
|
5001
5041
|
if (i.length % 2 != 0) throw new U(P, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);
|
|
5002
|
-
for (let t = 0; t < i.length; t += 2) u.push(
|
|
5003
|
-
const a = [], h =
|
|
5042
|
+
for (let t = 0; t < i.length; t += 2) u.push(lr(e, i[t])), c.push(i[t + 1]);
|
|
5043
|
+
const a = [], h = ge.empty();
|
|
5004
5044
|
// We iterate in reverse order to pick the last value for a field if the
|
|
5005
5045
|
// user specified the field multiple times.
|
|
5006
|
-
for (let t = u.length - 1; t >= 0; --t) if (!
|
|
5046
|
+
for (let t = u.length - 1; t >= 0; --t) if (!mr(a, u[t])) {
|
|
5007
5047
|
const e = u[t];
|
|
5008
5048
|
let n = c[t];
|
|
5009
5049
|
// For Compat types, we have to "extract" the underlying types before
|
|
5010
5050
|
// performing validation.
|
|
5011
5051
|
n = getModularInstance(n);
|
|
5012
5052
|
const r = o.ot(e);
|
|
5013
|
-
if (n instanceof
|
|
5053
|
+
if (n instanceof Xn)
|
|
5014
5054
|
// Add it to the field mask, but don't add anything to updateData.
|
|
5015
5055
|
a.push(e); else {
|
|
5016
|
-
const t =
|
|
5056
|
+
const t = ur(n, r);
|
|
5017
5057
|
null != t && (a.push(e), h.set(e, t));
|
|
5018
5058
|
}
|
|
5019
5059
|
}
|
|
5020
|
-
const f = new
|
|
5021
|
-
return new
|
|
5060
|
+
const f = new ye(a);
|
|
5061
|
+
return new Wn(h, f, o.fieldTransforms);
|
|
5022
5062
|
}
|
|
5023
5063
|
|
|
5024
5064
|
/**
|
|
@@ -5027,8 +5067,8 @@ class nr extends Un {
|
|
|
5027
5067
|
*
|
|
5028
5068
|
* @param allowArrays - Whether the query value is an array that may directly
|
|
5029
5069
|
* contain additional arrays (e.g. the operand of an `in` query).
|
|
5030
|
-
*/ function
|
|
5031
|
-
return
|
|
5070
|
+
*/ function or(t, e, n, r = !1) {
|
|
5071
|
+
return ur(n, t.lt(r ? 4 /* UserDataSource.ArrayArgument */ : 3 /* UserDataSource.Argument */ , e));
|
|
5032
5072
|
}
|
|
5033
5073
|
|
|
5034
5074
|
/**
|
|
@@ -5039,12 +5079,12 @@ class nr extends Un {
|
|
|
5039
5079
|
* the source of the data being parsed, etc.
|
|
5040
5080
|
* @returns The parsed value, or null if the value was a FieldValue sentinel
|
|
5041
5081
|
* that should not be included in the resulting parsed data.
|
|
5042
|
-
*/ function
|
|
5043
|
-
if (
|
|
5082
|
+
*/ function ur(t, e) {
|
|
5083
|
+
if (ar(
|
|
5044
5084
|
// Unwrap the API type from the Compat SDK. This will return the API type
|
|
5045
5085
|
// from firestore-exp.
|
|
5046
|
-
t = getModularInstance(t))) return
|
|
5047
|
-
if (t instanceof
|
|
5086
|
+
t = getModularInstance(t))) return hr("Unsupported field value:", e, t), cr(t, e);
|
|
5087
|
+
if (t instanceof jn)
|
|
5048
5088
|
// FieldValues usually parse into transforms (except deleteField())
|
|
5049
5089
|
// in which case we do not want to include this field in our parsed data
|
|
5050
5090
|
// (as doing so will overwrite the field directly prior to the transform
|
|
@@ -5056,7 +5096,7 @@ class nr extends Un {
|
|
|
5056
5096
|
*/
|
|
5057
5097
|
return function(t, e) {
|
|
5058
5098
|
// Sentinels are only supported with writes, and not within arrays.
|
|
5059
|
-
if (!
|
|
5099
|
+
if (!Gn(e.et)) throw e.ct(`${t._methodName}() can only be used with update() and set()`);
|
|
5060
5100
|
if (!e.path) throw e.ct(`${t._methodName}() is not currently supported inside arrays`);
|
|
5061
5101
|
const n = t._toFieldTransform(e);
|
|
5062
5102
|
n && e.fieldTransforms.push(n);
|
|
@@ -5086,7 +5126,7 @@ class nr extends Un {
|
|
|
5086
5126
|
const n = [];
|
|
5087
5127
|
let r = 0;
|
|
5088
5128
|
for (const s of t) {
|
|
5089
|
-
let t =
|
|
5129
|
+
let t = ur(s, e.ut(r));
|
|
5090
5130
|
null == t && (
|
|
5091
5131
|
// Just include nulls in the array for fields being replaced with a
|
|
5092
5132
|
// sentinel.
|
|
@@ -5105,7 +5145,7 @@ class nr extends Un {
|
|
|
5105
5145
|
if (null === (t = getModularInstance(t))) return {
|
|
5106
5146
|
nullValue: "NULL_VALUE"
|
|
5107
5147
|
};
|
|
5108
|
-
if ("number" == typeof t) return
|
|
5148
|
+
if ("number" == typeof t) return Ne(e.serializer, t);
|
|
5109
5149
|
if ("boolean" == typeof t) return {
|
|
5110
5150
|
booleanValue: t
|
|
5111
5151
|
};
|
|
@@ -5113,34 +5153,34 @@ class nr extends Un {
|
|
|
5113
5153
|
stringValue: t
|
|
5114
5154
|
};
|
|
5115
5155
|
if (t instanceof Date) {
|
|
5116
|
-
const n =
|
|
5156
|
+
const n = xt.fromDate(t);
|
|
5117
5157
|
return {
|
|
5118
|
-
timestampValue:
|
|
5158
|
+
timestampValue: Ge(e.serializer, n)
|
|
5119
5159
|
};
|
|
5120
5160
|
}
|
|
5121
|
-
if (t instanceof
|
|
5161
|
+
if (t instanceof xt) {
|
|
5122
5162
|
// Firestore backend truncates precision down to microseconds. To ensure
|
|
5123
5163
|
// offline mode works the same with regards to truncation, perform the
|
|
5124
5164
|
// truncation immediately without waiting for the backend to do that.
|
|
5125
|
-
const n = new
|
|
5165
|
+
const n = new xt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
|
|
5126
5166
|
return {
|
|
5127
|
-
timestampValue:
|
|
5167
|
+
timestampValue: Ge(e.serializer, n)
|
|
5128
5168
|
};
|
|
5129
5169
|
}
|
|
5130
|
-
if (t instanceof
|
|
5170
|
+
if (t instanceof Bn) return {
|
|
5131
5171
|
geoPointValue: {
|
|
5132
5172
|
latitude: t.latitude,
|
|
5133
5173
|
longitude: t.longitude
|
|
5134
5174
|
}
|
|
5135
5175
|
};
|
|
5136
|
-
if (t instanceof
|
|
5137
|
-
bytesValue:
|
|
5176
|
+
if (t instanceof Mn) return {
|
|
5177
|
+
bytesValue: Ke(e.serializer, t._byteString)
|
|
5138
5178
|
};
|
|
5139
5179
|
if (t instanceof Dn) {
|
|
5140
5180
|
const n = e.databaseId, r = t.firestore._databaseId;
|
|
5141
5181
|
if (!r.isEqual(n)) throw e.ct(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);
|
|
5142
5182
|
return {
|
|
5143
|
-
referenceValue:
|
|
5183
|
+
referenceValue: Je(t.firestore._databaseId || e.databaseId, t._key.path)
|
|
5144
5184
|
};
|
|
5145
5185
|
}
|
|
5146
5186
|
throw e.ct(`Unsupported field value: ${ut(t)}`);
|
|
@@ -5154,13 +5194,13 @@ class nr extends Un {
|
|
|
5154
5194
|
*/ (t, e);
|
|
5155
5195
|
}
|
|
5156
5196
|
|
|
5157
|
-
function
|
|
5197
|
+
function cr(t, e) {
|
|
5158
5198
|
const n = {};
|
|
5159
5199
|
return !function(t) {
|
|
5160
5200
|
for (const e in t) if (Object.prototype.hasOwnProperty.call(t, e)) return !1;
|
|
5161
5201
|
return !0;
|
|
5162
|
-
}(t) ?
|
|
5163
|
-
const s =
|
|
5202
|
+
}(t) ? Rt(t, ((t, r) => {
|
|
5203
|
+
const s = ur(r, e.rt(t));
|
|
5164
5204
|
null != s && (n[t] = s);
|
|
5165
5205
|
})) :
|
|
5166
5206
|
// If we encounter an empty object, we explicitly add it to the update
|
|
@@ -5172,12 +5212,12 @@ function ur(t, e) {
|
|
|
5172
5212
|
};
|
|
5173
5213
|
}
|
|
5174
5214
|
|
|
5175
|
-
function
|
|
5176
|
-
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof
|
|
5215
|
+
function ar(t) {
|
|
5216
|
+
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof xt || t instanceof Bn || t instanceof Mn || t instanceof Dn || t instanceof jn);
|
|
5177
5217
|
}
|
|
5178
5218
|
|
|
5179
|
-
function
|
|
5180
|
-
if (!
|
|
5219
|
+
function hr(t, e, n) {
|
|
5220
|
+
if (!ar(n) || !function(t) {
|
|
5181
5221
|
return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
|
|
5182
5222
|
}(n)) {
|
|
5183
5223
|
const r = ut(n);
|
|
@@ -5187,20 +5227,20 @@ function ar(t, e, n) {
|
|
|
5187
5227
|
|
|
5188
5228
|
/**
|
|
5189
5229
|
* Helper that calls fromDotSeparatedString() but wraps any error thrown.
|
|
5190
|
-
*/ function
|
|
5230
|
+
*/ function lr(t, e, n) {
|
|
5191
5231
|
if ((
|
|
5192
5232
|
// If required, replace the FieldPath Compat class with with the firestore-exp
|
|
5193
5233
|
// FieldPath.
|
|
5194
|
-
e = getModularInstance(e)) instanceof
|
|
5195
|
-
if ("string" == typeof e) return
|
|
5196
|
-
throw
|
|
5234
|
+
e = getModularInstance(e)) instanceof Ln) return e._internalPath;
|
|
5235
|
+
if ("string" == typeof e) return dr(t, e);
|
|
5236
|
+
throw wr("Field path arguments must be of type string or ", t,
|
|
5197
5237
|
/* hasConverter= */ !1,
|
|
5198
5238
|
/* path= */ void 0, n);
|
|
5199
5239
|
}
|
|
5200
5240
|
|
|
5201
5241
|
/**
|
|
5202
5242
|
* Matches any characters in a field path string that are reserved.
|
|
5203
|
-
*/ const
|
|
5243
|
+
*/ const fr = new RegExp("[~\\*/\\[\\]]");
|
|
5204
5244
|
|
|
5205
5245
|
/**
|
|
5206
5246
|
* Wraps fromDotSeparatedString with an error message about the method that
|
|
@@ -5210,20 +5250,20 @@ function ar(t, e, n) {
|
|
|
5210
5250
|
* split on dots.
|
|
5211
5251
|
* @param targetDoc - The document against which the field path will be
|
|
5212
5252
|
* evaluated.
|
|
5213
|
-
*/ function
|
|
5214
|
-
if (e.search(
|
|
5253
|
+
*/ function dr(t, e, n) {
|
|
5254
|
+
if (e.search(fr) >= 0) throw wr(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`, t,
|
|
5215
5255
|
/* hasConverter= */ !1,
|
|
5216
5256
|
/* path= */ void 0, n);
|
|
5217
5257
|
try {
|
|
5218
|
-
return new
|
|
5258
|
+
return new Ln(...e.split("."))._internalPath;
|
|
5219
5259
|
} catch (r) {
|
|
5220
|
-
throw
|
|
5260
|
+
throw wr(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t,
|
|
5221
5261
|
/* hasConverter= */ !1,
|
|
5222
5262
|
/* path= */ void 0, n);
|
|
5223
5263
|
}
|
|
5224
5264
|
}
|
|
5225
5265
|
|
|
5226
|
-
function
|
|
5266
|
+
function wr(t, e, n, r, s) {
|
|
5227
5267
|
const i = r && !r.isEmpty(), o = void 0 !== s;
|
|
5228
5268
|
let u = `Function ${e}() called with invalid data`;
|
|
5229
5269
|
n && (u += " (via `toFirestore()`)"), u += ". ";
|
|
@@ -5232,7 +5272,7 @@ function dr(t, e, n, r, s) {
|
|
|
5232
5272
|
c += ")"), new U(P, u + t + c);
|
|
5233
5273
|
}
|
|
5234
5274
|
|
|
5235
|
-
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function
|
|
5275
|
+
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function mr(t, e) {
|
|
5236
5276
|
return t.some((t => t.isEqual(e)));
|
|
5237
5277
|
}
|
|
5238
5278
|
|
|
@@ -5260,7 +5300,7 @@ function dr(t, e, n, r, s) {
|
|
|
5260
5300
|
* For a `DocumentSnapshot` that points to a non-existing document, any data
|
|
5261
5301
|
* access will return 'undefined'. You can use the `exists()` method to
|
|
5262
5302
|
* explicitly verify a document's existence.
|
|
5263
|
-
*/ class
|
|
5303
|
+
*/ class pr {
|
|
5264
5304
|
// Note: This class is stripped down version of the DocumentSnapshot in
|
|
5265
5305
|
// the legacy SDK. The changes are:
|
|
5266
5306
|
// - No support for SnapshotMetadata.
|
|
@@ -5296,7 +5336,7 @@ function dr(t, e, n, r, s) {
|
|
|
5296
5336
|
if (this._converter) {
|
|
5297
5337
|
// We only want to use the converter and create a new DocumentSnapshot
|
|
5298
5338
|
// if a converter has been provided.
|
|
5299
|
-
const t = new
|
|
5339
|
+
const t = new yr(this._firestore, this._userDataWriter, this._key, this._document,
|
|
5300
5340
|
/* converter= */ null);
|
|
5301
5341
|
return this._converter.fromFirestore(t);
|
|
5302
5342
|
}
|
|
@@ -5316,7 +5356,7 @@ function dr(t, e, n, r, s) {
|
|
|
5316
5356
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5317
5357
|
get(t) {
|
|
5318
5358
|
if (this._document) {
|
|
5319
|
-
const e = this._document.data.field(
|
|
5359
|
+
const e = this._document.data.field(vr("DocumentSnapshot.get", t));
|
|
5320
5360
|
if (null !== e) return this._userDataWriter.convertValue(e);
|
|
5321
5361
|
}
|
|
5322
5362
|
}
|
|
@@ -5332,7 +5372,7 @@ function dr(t, e, n, r, s) {
|
|
|
5332
5372
|
* `DocumentSnapshot`. Since query results contain only existing documents, the
|
|
5333
5373
|
* `exists` property will always be true and `data()` will never return
|
|
5334
5374
|
* 'undefined'.
|
|
5335
|
-
*/ class
|
|
5375
|
+
*/ class yr extends pr {
|
|
5336
5376
|
/**
|
|
5337
5377
|
* Retrieves all fields in the document as an `Object`.
|
|
5338
5378
|
*
|
|
@@ -5350,7 +5390,7 @@ function dr(t, e, n, r, s) {
|
|
|
5350
5390
|
* array via the `docs` property or enumerated using the `forEach` method. The
|
|
5351
5391
|
* number of documents can be determined via the `empty` and `size`
|
|
5352
5392
|
* properties.
|
|
5353
|
-
*/ class
|
|
5393
|
+
*/ class gr {
|
|
5354
5394
|
/** @hideconstructor */
|
|
5355
5395
|
constructor(t, e) {
|
|
5356
5396
|
this._docs = e, this.query = t;
|
|
@@ -5381,14 +5421,14 @@ function dr(t, e, n, r, s) {
|
|
|
5381
5421
|
* @param left - A snapshot to compare.
|
|
5382
5422
|
* @param right - A snapshot to compare.
|
|
5383
5423
|
* @returns true if the snapshots are equal.
|
|
5384
|
-
*/ function
|
|
5385
|
-
return t = getModularInstance(t), e = getModularInstance(e), t instanceof
|
|
5424
|
+
*/ function _r(t, e) {
|
|
5425
|
+
return t = getModularInstance(t), e = getModularInstance(e), t instanceof pr && e instanceof pr ? t._firestore === e._firestore && t._key.isEqual(e._key) && (null === t._document ? null === e._document : t._document.isEqual(e._document)) && t._converter === e._converter : t instanceof gr && e instanceof gr && (Cn(t.query, e.query) && Tt(t.docs, e.docs, _r));
|
|
5386
5426
|
}
|
|
5387
5427
|
|
|
5388
5428
|
/**
|
|
5389
5429
|
* Helper that calls `fromDotSeparatedString()` but wraps any error thrown.
|
|
5390
|
-
*/ function
|
|
5391
|
-
return "string" == typeof e ?
|
|
5430
|
+
*/ function vr(t, e) {
|
|
5431
|
+
return "string" == typeof e ? dr(t, e) : e instanceof Ln ? e._internalPath : e._delegate._internalPath;
|
|
5392
5432
|
}
|
|
5393
5433
|
|
|
5394
5434
|
/**
|
|
@@ -5411,7 +5451,7 @@ function dr(t, e, n, r, s) {
|
|
|
5411
5451
|
* An `AppliableConstraint` is an abstraction of a constraint that can be applied
|
|
5412
5452
|
* to a Firestore query.
|
|
5413
5453
|
*/
|
|
5414
|
-
class
|
|
5454
|
+
class br {}
|
|
5415
5455
|
|
|
5416
5456
|
/**
|
|
5417
5457
|
* A `QueryConstraint` is used to narrow the set of documents returned by a
|
|
@@ -5420,12 +5460,12 @@ class vr {}
|
|
|
5420
5460
|
* (endBefore:1)}, {@link (endAt:1)}, {@link limit}, {@link limitToLast} and
|
|
5421
5461
|
* can then be passed to {@link (query:1)} to create a new query instance that
|
|
5422
5462
|
* also contains this `QueryConstraint`.
|
|
5423
|
-
*/ class
|
|
5463
|
+
*/ class Er extends br {}
|
|
5424
5464
|
|
|
5425
|
-
function
|
|
5465
|
+
function Ir(t, e, ...n) {
|
|
5426
5466
|
let r = [];
|
|
5427
|
-
e instanceof
|
|
5428
|
-
const e = t.filter((t => t instanceof
|
|
5467
|
+
e instanceof br && r.push(e), r = r.concat(n), function(t) {
|
|
5468
|
+
const e = t.filter((t => t instanceof Rr)).length, n = t.filter((t => t instanceof Tr)).length;
|
|
5429
5469
|
if (e > 1 || e > 0 && n > 0) throw new U(P, "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(...)))`.");
|
|
5430
5470
|
}
|
|
5431
5471
|
/**
|
|
@@ -5460,7 +5500,7 @@ function Er(t, e, ...n) {
|
|
|
5460
5500
|
* `QueryFieldFilterConstraint`s are created by invoking {@link where} and can then
|
|
5461
5501
|
* be passed to {@link (query:1)} to create a new query instance that also contains
|
|
5462
5502
|
* this `QueryFieldFilterConstraint`.
|
|
5463
|
-
*/ class
|
|
5503
|
+
*/ class Tr extends Er {
|
|
5464
5504
|
/**
|
|
5465
5505
|
* @internal
|
|
5466
5506
|
*/
|
|
@@ -5470,31 +5510,31 @@ function Er(t, e, ...n) {
|
|
|
5470
5510
|
this.type = "where";
|
|
5471
5511
|
}
|
|
5472
5512
|
static _create(t, e, n) {
|
|
5473
|
-
return new
|
|
5513
|
+
return new Tr(t, e, n);
|
|
5474
5514
|
}
|
|
5475
5515
|
_apply(t) {
|
|
5476
5516
|
const e = this._parse(t);
|
|
5477
|
-
return
|
|
5517
|
+
return Br(t._query, e), new Fn(t.firestore, t.converter, Ve(t._query, e));
|
|
5478
5518
|
}
|
|
5479
5519
|
_parse(t) {
|
|
5480
|
-
const e =
|
|
5520
|
+
const e = Hn(t.firestore), n = function(t, e, n, r, s, i, o) {
|
|
5481
5521
|
let u;
|
|
5482
5522
|
if (s.isKeyField()) {
|
|
5483
5523
|
if ("array-contains" /* Operator.ARRAY_CONTAINS */ === i || "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ === i) throw new U(P, `Invalid Query. You can't perform '${i}' queries on documentId().`);
|
|
5484
5524
|
if ("in" /* Operator.IN */ === i || "not-in" /* Operator.NOT_IN */ === i) {
|
|
5485
|
-
|
|
5525
|
+
jr(o, i);
|
|
5486
5526
|
const e = [];
|
|
5487
|
-
for (const n of o) e.push(
|
|
5527
|
+
for (const n of o) e.push(Ur(r, t, n));
|
|
5488
5528
|
u = {
|
|
5489
5529
|
arrayValue: {
|
|
5490
5530
|
values: e
|
|
5491
5531
|
}
|
|
5492
5532
|
};
|
|
5493
|
-
} else u =
|
|
5494
|
-
} else "in" /* Operator.IN */ !== i && "not-in" /* Operator.NOT_IN */ !== i && "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ !== i ||
|
|
5495
|
-
u =
|
|
5533
|
+
} else u = Ur(r, t, o);
|
|
5534
|
+
} else "in" /* Operator.IN */ !== i && "not-in" /* Operator.NOT_IN */ !== i && "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ !== i || jr(o, i),
|
|
5535
|
+
u = or(n, e, o,
|
|
5496
5536
|
/* allowArrays= */ "in" /* Operator.IN */ === i || "not-in" /* Operator.NOT_IN */ === i);
|
|
5497
|
-
return
|
|
5537
|
+
return Xt.create(s, i, u);
|
|
5498
5538
|
}(t._query, "where", e, t.firestore._databaseId, this._field, this._op, this._value);
|
|
5499
5539
|
return n;
|
|
5500
5540
|
}
|
|
@@ -5510,9 +5550,9 @@ function Er(t, e, ...n) {
|
|
|
5510
5550
|
* "<=", "!=").
|
|
5511
5551
|
* @param value - The value for comparison
|
|
5512
5552
|
* @returns The created {@link QueryFieldFilterConstraint}.
|
|
5513
|
-
*/ function
|
|
5514
|
-
const r = e, s =
|
|
5515
|
-
return
|
|
5553
|
+
*/ function Ar(t, e, n) {
|
|
5554
|
+
const r = e, s = vr("where", t);
|
|
5555
|
+
return Tr._create(s, r, n);
|
|
5516
5556
|
}
|
|
5517
5557
|
|
|
5518
5558
|
/**
|
|
@@ -5522,7 +5562,7 @@ function Er(t, e, ...n) {
|
|
|
5522
5562
|
* `QueryCompositeFilterConstraint`s are created by invoking {@link or} or
|
|
5523
5563
|
* {@link and} and can then be passed to {@link (query:1)} to create a new query
|
|
5524
5564
|
* instance that also contains the `QueryCompositeFilterConstraint`.
|
|
5525
|
-
*/ class
|
|
5565
|
+
*/ class Rr extends br {
|
|
5526
5566
|
/**
|
|
5527
5567
|
* @internal
|
|
5528
5568
|
*/
|
|
@@ -5532,22 +5572,22 @@ function Er(t, e, ...n) {
|
|
|
5532
5572
|
super(), this.type = t, this._queryConstraints = e;
|
|
5533
5573
|
}
|
|
5534
5574
|
static _create(t, e) {
|
|
5535
|
-
return new
|
|
5575
|
+
return new Rr(t, e);
|
|
5536
5576
|
}
|
|
5537
5577
|
_parse(t) {
|
|
5538
5578
|
const e = this._queryConstraints.map((e => e._parse(t))).filter((t => t.getFilters().length > 0));
|
|
5539
|
-
return 1 === e.length ? e[0] :
|
|
5579
|
+
return 1 === e.length ? e[0] : Zt.create(e, this._getOperator());
|
|
5540
5580
|
}
|
|
5541
5581
|
_apply(t) {
|
|
5542
5582
|
const e = this._parse(t);
|
|
5543
5583
|
return 0 === e.getFilters().length ? t : (function(t, e) {
|
|
5544
5584
|
let n = t;
|
|
5545
5585
|
const r = e.getFlattenedFilters();
|
|
5546
|
-
for (const t of r)
|
|
5586
|
+
for (const t of r) Br(n, t), n = Ve(n, t);
|
|
5547
5587
|
}
|
|
5548
5588
|
// Checks if any of the provided filter operators are included in the given list of filters and
|
|
5549
5589
|
// returns the first one that is, or null if none are.
|
|
5550
|
-
(t._query, e), new
|
|
5590
|
+
(t._query, e), new Fn(t.firestore, t.converter, Ve(t._query, e)));
|
|
5551
5591
|
}
|
|
5552
5592
|
_getQueryConstraints() {
|
|
5553
5593
|
return this._queryConstraints;
|
|
@@ -5566,9 +5606,9 @@ function Er(t, e, ...n) {
|
|
|
5566
5606
|
* {@link QueryFilterConstraint}s to perform a disjunction for. These must be
|
|
5567
5607
|
* created with calls to {@link where}, {@link or}, or {@link and}.
|
|
5568
5608
|
* @returns The newly created {@link QueryCompositeFilterConstraint}.
|
|
5569
|
-
*/ function
|
|
5609
|
+
*/ function Pr(...t) {
|
|
5570
5610
|
// Only support QueryFilterConstraints
|
|
5571
|
-
return t.forEach((t =>
|
|
5611
|
+
return t.forEach((t => zr("or", t))), Rr._create("or" /* CompositeOperator.OR */ , t);
|
|
5572
5612
|
}
|
|
5573
5613
|
|
|
5574
5614
|
/**
|
|
@@ -5580,9 +5620,9 @@ function Er(t, e, ...n) {
|
|
|
5580
5620
|
* {@link QueryFilterConstraint}s to perform a conjunction for. These must be
|
|
5581
5621
|
* created with calls to {@link where}, {@link or}, or {@link and}.
|
|
5582
5622
|
* @returns The newly created {@link QueryCompositeFilterConstraint}.
|
|
5583
|
-
*/ function
|
|
5623
|
+
*/ function Vr(...t) {
|
|
5584
5624
|
// Only support QueryFilterConstraints
|
|
5585
|
-
return t.forEach((t =>
|
|
5625
|
+
return t.forEach((t => zr("and", t))), Rr._create("and" /* CompositeOperator.AND */ , t);
|
|
5586
5626
|
}
|
|
5587
5627
|
|
|
5588
5628
|
/**
|
|
@@ -5593,7 +5633,7 @@ function Er(t, e, ...n) {
|
|
|
5593
5633
|
*
|
|
5594
5634
|
* Note: Documents that do not contain the orderBy field will not be present in
|
|
5595
5635
|
* the query result.
|
|
5596
|
-
*/ class
|
|
5636
|
+
*/ class $r extends Er {
|
|
5597
5637
|
/**
|
|
5598
5638
|
* @internal
|
|
5599
5639
|
*/
|
|
@@ -5603,18 +5643,18 @@ function Er(t, e, ...n) {
|
|
|
5603
5643
|
this.type = "orderBy";
|
|
5604
5644
|
}
|
|
5605
5645
|
static _create(t, e) {
|
|
5606
|
-
return new
|
|
5646
|
+
return new $r(t, e);
|
|
5607
5647
|
}
|
|
5608
5648
|
_apply(t) {
|
|
5609
5649
|
const e = function(t, e, n) {
|
|
5610
5650
|
if (null !== t.startAt) throw new U(P, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
|
|
5611
5651
|
if (null !== t.endAt) throw new U(P, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
|
|
5612
|
-
const r = new
|
|
5652
|
+
const r = new ae(e, n);
|
|
5613
5653
|
return function(t, e) {
|
|
5614
|
-
if (null ===
|
|
5654
|
+
if (null === Ie(t)) {
|
|
5615
5655
|
// This is the first order by. It must match any inequality.
|
|
5616
|
-
const n =
|
|
5617
|
-
null !== n &&
|
|
5656
|
+
const n = Te(t);
|
|
5657
|
+
null !== n && Qr(t, n, e.field);
|
|
5618
5658
|
}
|
|
5619
5659
|
}(t, r), r;
|
|
5620
5660
|
}
|
|
@@ -5629,10 +5669,10 @@ function Er(t, e, ...n) {
|
|
|
5629
5669
|
* of the query or if any of the fields in the order by are an uncommitted
|
|
5630
5670
|
* server timestamp.
|
|
5631
5671
|
*/ (t._query, this._field, this._direction);
|
|
5632
|
-
return new
|
|
5672
|
+
return new Fn(t.firestore, t.converter, function(t, e) {
|
|
5633
5673
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
5634
5674
|
const n = t.explicitOrderBy.concat([ e ]);
|
|
5635
|
-
return new
|
|
5675
|
+
return new Ee(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
|
|
5636
5676
|
}(t._query, e));
|
|
5637
5677
|
}
|
|
5638
5678
|
}
|
|
@@ -5648,9 +5688,9 @@ function Er(t, e, ...n) {
|
|
|
5648
5688
|
* @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
|
|
5649
5689
|
* not specified, order will be ascending.
|
|
5650
5690
|
* @returns The created {@link QueryOrderByConstraint}.
|
|
5651
|
-
*/ function
|
|
5652
|
-
const n = e, r =
|
|
5653
|
-
return
|
|
5691
|
+
*/ function Nr(t, e = "asc") {
|
|
5692
|
+
const n = e, r = vr("orderBy", t);
|
|
5693
|
+
return $r._create(r, n);
|
|
5654
5694
|
}
|
|
5655
5695
|
|
|
5656
5696
|
/**
|
|
@@ -5659,7 +5699,7 @@ function Er(t, e, ...n) {
|
|
|
5659
5699
|
* `QueryLimitConstraint`s are created by invoking {@link limit} or
|
|
5660
5700
|
* {@link limitToLast} and can then be passed to {@link (query:1)} to create a new
|
|
5661
5701
|
* query instance that also contains this `QueryLimitConstraint`.
|
|
5662
|
-
*/ class Dr extends
|
|
5702
|
+
*/ class Dr extends Er {
|
|
5663
5703
|
/**
|
|
5664
5704
|
* @internal
|
|
5665
5705
|
*/
|
|
@@ -5672,8 +5712,8 @@ function Er(t, e, ...n) {
|
|
|
5672
5712
|
return new Dr(t, e, n);
|
|
5673
5713
|
}
|
|
5674
5714
|
_apply(t) {
|
|
5675
|
-
return new
|
|
5676
|
-
return new
|
|
5715
|
+
return new Fn(t.firestore, t.converter, function(t, e, n) {
|
|
5716
|
+
return new Ee(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
|
|
5677
5717
|
}(t._query, this._limit, this._limitType));
|
|
5678
5718
|
}
|
|
5679
5719
|
}
|
|
@@ -5684,7 +5724,7 @@ function Er(t, e, ...n) {
|
|
|
5684
5724
|
*
|
|
5685
5725
|
* @param limit - The maximum number of items to return.
|
|
5686
5726
|
* @returns The created {@link QueryLimitConstraint}.
|
|
5687
|
-
*/ function
|
|
5727
|
+
*/ function Fr(t) {
|
|
5688
5728
|
return at("limit", t), Dr._create("limit", t, "F" /* LimitType.First */);
|
|
5689
5729
|
}
|
|
5690
5730
|
|
|
@@ -5697,7 +5737,7 @@ function Er(t, e, ...n) {
|
|
|
5697
5737
|
*
|
|
5698
5738
|
* @param limit - The maximum number of items to return.
|
|
5699
5739
|
* @returns The created {@link QueryLimitConstraint}.
|
|
5700
|
-
*/ function
|
|
5740
|
+
*/ function xr(t) {
|
|
5701
5741
|
return at("limitToLast", t), Dr._create("limitToLast", t, "L" /* LimitType.Last */);
|
|
5702
5742
|
}
|
|
5703
5743
|
|
|
@@ -5707,7 +5747,7 @@ function Er(t, e, ...n) {
|
|
|
5707
5747
|
* `QueryStartAtConstraint`s are created by invoking {@link (startAt:1)} or
|
|
5708
5748
|
* {@link (startAfter:1)} and can then be passed to {@link (query:1)} to create a
|
|
5709
5749
|
* new query instance that also contains this `QueryStartAtConstraint`.
|
|
5710
|
-
*/ class
|
|
5750
|
+
*/ class Sr extends Er {
|
|
5711
5751
|
/**
|
|
5712
5752
|
* @internal
|
|
5713
5753
|
*/
|
|
@@ -5717,23 +5757,23 @@ function Er(t, e, ...n) {
|
|
|
5717
5757
|
super(), this.type = t, this._docOrFields = e, this._inclusive = n;
|
|
5718
5758
|
}
|
|
5719
5759
|
static _create(t, e, n) {
|
|
5720
|
-
return new
|
|
5760
|
+
return new Sr(t, e, n);
|
|
5721
5761
|
}
|
|
5722
5762
|
_apply(t) {
|
|
5723
|
-
const e =
|
|
5724
|
-
return new
|
|
5725
|
-
return new
|
|
5763
|
+
const e = Lr(t, this.type, this._docOrFields, this._inclusive);
|
|
5764
|
+
return new Fn(t.firestore, t.converter, function(t, e) {
|
|
5765
|
+
return new Ee(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
|
|
5726
5766
|
}(t._query, e));
|
|
5727
5767
|
}
|
|
5728
5768
|
}
|
|
5729
5769
|
|
|
5730
|
-
function
|
|
5731
|
-
return
|
|
5770
|
+
function qr(...t) {
|
|
5771
|
+
return Sr._create("startAt", t,
|
|
5732
5772
|
/*inclusive=*/ !0);
|
|
5733
5773
|
}
|
|
5734
5774
|
|
|
5735
|
-
function
|
|
5736
|
-
return
|
|
5775
|
+
function Or(...t) {
|
|
5776
|
+
return Sr._create("startAfter", t,
|
|
5737
5777
|
/*inclusive=*/ !1);
|
|
5738
5778
|
}
|
|
5739
5779
|
|
|
@@ -5743,7 +5783,7 @@ function qr(...t) {
|
|
|
5743
5783
|
* `QueryEndAtConstraint`s are created by invoking {@link (endAt:1)} or
|
|
5744
5784
|
* {@link (endBefore:1)} and can then be passed to {@link (query:1)} to create a new
|
|
5745
5785
|
* query instance that also contains this `QueryEndAtConstraint`.
|
|
5746
|
-
*/ class
|
|
5786
|
+
*/ class kr extends Er {
|
|
5747
5787
|
/**
|
|
5748
5788
|
* @internal
|
|
5749
5789
|
*/
|
|
@@ -5753,28 +5793,28 @@ function qr(...t) {
|
|
|
5753
5793
|
super(), this.type = t, this._docOrFields = e, this._inclusive = n;
|
|
5754
5794
|
}
|
|
5755
5795
|
static _create(t, e, n) {
|
|
5756
|
-
return new
|
|
5796
|
+
return new kr(t, e, n);
|
|
5757
5797
|
}
|
|
5758
5798
|
_apply(t) {
|
|
5759
|
-
const e =
|
|
5760
|
-
return new
|
|
5761
|
-
return new
|
|
5799
|
+
const e = Lr(t, this.type, this._docOrFields, this._inclusive);
|
|
5800
|
+
return new Fn(t.firestore, t.converter, function(t, e) {
|
|
5801
|
+
return new Ee(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
|
|
5762
5802
|
}(t._query, e));
|
|
5763
5803
|
}
|
|
5764
5804
|
}
|
|
5765
5805
|
|
|
5766
|
-
function
|
|
5767
|
-
return
|
|
5806
|
+
function Cr(...t) {
|
|
5807
|
+
return kr._create("endBefore", t,
|
|
5768
5808
|
/*inclusive=*/ !1);
|
|
5769
5809
|
}
|
|
5770
5810
|
|
|
5771
|
-
function
|
|
5772
|
-
return
|
|
5811
|
+
function Mr(...t) {
|
|
5812
|
+
return kr._create("endAt", t,
|
|
5773
5813
|
/*inclusive=*/ !0);
|
|
5774
5814
|
}
|
|
5775
5815
|
|
|
5776
|
-
/** Helper function to create a bound from a document or fields */ function
|
|
5777
|
-
if (n[0] = getModularInstance(n[0]), n[0] instanceof
|
|
5816
|
+
/** Helper function to create a bound from a document or fields */ function Lr(t, e, n, r) {
|
|
5817
|
+
if (n[0] = getModularInstance(n[0]), n[0] instanceof pr) return function(t, e, n, r, s) {
|
|
5778
5818
|
if (!r) throw new U($, `Can't use a DocumentSnapshot that doesn't exist for ${n}().`);
|
|
5779
5819
|
const i = [];
|
|
5780
5820
|
// Because people expect to continue/end a query at the exact document
|
|
@@ -5784,22 +5824,22 @@ function Cr(...t) {
|
|
|
5784
5824
|
// the provided document. Without the key (by using the explicit sort
|
|
5785
5825
|
// orders), multiple documents could match the position, yielding duplicate
|
|
5786
5826
|
// results.
|
|
5787
|
-
for (const n of
|
|
5827
|
+
for (const n of Re(t)) if (n.field.isKeyField()) i.push(Bt(e, r.key)); else {
|
|
5788
5828
|
const t = r.data.field(n.field);
|
|
5789
|
-
if (
|
|
5829
|
+
if (St(t)) throw new U(P, '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.)');
|
|
5790
5830
|
if (null === t) {
|
|
5791
5831
|
const t = n.field.canonicalString();
|
|
5792
5832
|
throw new U(P, `Invalid query. You are trying to start or end a query using a document for which the field '${t}' (used as the orderBy) does not exist.`);
|
|
5793
5833
|
}
|
|
5794
5834
|
i.push(t);
|
|
5795
5835
|
}
|
|
5796
|
-
return new
|
|
5836
|
+
return new Yt(i, s);
|
|
5797
5837
|
}
|
|
5798
5838
|
/**
|
|
5799
5839
|
* Converts a list of field values to a `Bound` for the given query.
|
|
5800
5840
|
*/ (t._query, t.firestore._databaseId, e, n[0]._document, r);
|
|
5801
5841
|
{
|
|
5802
|
-
const s =
|
|
5842
|
+
const s = Hn(t.firestore);
|
|
5803
5843
|
return function(t, e, n, r, s, i) {
|
|
5804
5844
|
// Use explicit order by's because it has to match the query the user made
|
|
5805
5845
|
const o = t.explicitOrderBy;
|
|
@@ -5809,17 +5849,17 @@ function Cr(...t) {
|
|
|
5809
5849
|
const c = s[i];
|
|
5810
5850
|
if (o[i].field.isKeyField()) {
|
|
5811
5851
|
if ("string" != typeof c) throw new U(P, `Invalid query. Expected a string for document ID in ${r}(), but got a ${typeof c}`);
|
|
5812
|
-
if (!
|
|
5852
|
+
if (!Ae(t) && -1 !== c.indexOf("/")) throw new U(P, `Invalid query. When querying a collection and ordering by documentId(), the value passed to ${r}() must be a plain document ID, but '${c}' contains a slash.`);
|
|
5813
5853
|
const n = t.path.child(tt.fromString(c));
|
|
5814
5854
|
if (!rt.isDocumentKey(n)) throw new U(P, `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.`);
|
|
5815
5855
|
const s = new rt(n);
|
|
5816
|
-
u.push(
|
|
5856
|
+
u.push(Bt(e, s));
|
|
5817
5857
|
} else {
|
|
5818
|
-
const t =
|
|
5858
|
+
const t = or(n, r, c);
|
|
5819
5859
|
u.push(t);
|
|
5820
5860
|
}
|
|
5821
5861
|
}
|
|
5822
|
-
return new
|
|
5862
|
+
return new Yt(u, i);
|
|
5823
5863
|
}
|
|
5824
5864
|
/**
|
|
5825
5865
|
* Parses the given `documentIdValue` into a `ReferenceValue`, throwing
|
|
@@ -5829,22 +5869,22 @@ function Cr(...t) {
|
|
|
5829
5869
|
}
|
|
5830
5870
|
}
|
|
5831
5871
|
|
|
5832
|
-
function
|
|
5872
|
+
function Ur(t, e, n) {
|
|
5833
5873
|
if ("string" == typeof (n = getModularInstance(n))) {
|
|
5834
5874
|
if ("" === n) throw new U(P, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
|
|
5835
|
-
if (!
|
|
5875
|
+
if (!Ae(e) && -1 !== n.indexOf("/")) throw new U(P, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);
|
|
5836
5876
|
const r = e.path.child(tt.fromString(n));
|
|
5837
5877
|
if (!rt.isDocumentKey(r)) throw new U(P, `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}).`);
|
|
5838
|
-
return
|
|
5878
|
+
return Bt(t, new rt(r));
|
|
5839
5879
|
}
|
|
5840
|
-
if (n instanceof Dn) return
|
|
5880
|
+
if (n instanceof Dn) return Bt(t, n._key);
|
|
5841
5881
|
throw new U(P, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${ut(n)}.`);
|
|
5842
5882
|
}
|
|
5843
5883
|
|
|
5844
5884
|
/**
|
|
5845
5885
|
* Validates that the value passed into a disjunctive filter satisfies all
|
|
5846
5886
|
* array requirements.
|
|
5847
|
-
*/ function
|
|
5887
|
+
*/ function jr(t, e) {
|
|
5848
5888
|
if (!Array.isArray(t) || 0 === t.length) throw new U(P, `Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);
|
|
5849
5889
|
}
|
|
5850
5890
|
|
|
@@ -5857,12 +5897,12 @@ function Lr(t, e, n) {
|
|
|
5857
5897
|
* Operators in a query must adhere to the following set of rules:
|
|
5858
5898
|
* 1. Only one inequality per query.
|
|
5859
5899
|
* 2. `NOT_IN` cannot be used with array, disjunctive, or `NOT_EQUAL` operators.
|
|
5860
|
-
*/ function
|
|
5900
|
+
*/ function Br(t, e) {
|
|
5861
5901
|
if (e.isInequality()) {
|
|
5862
|
-
const n =
|
|
5902
|
+
const n = Te(t), r = e.field;
|
|
5863
5903
|
if (null !== n && !n.isEqual(r)) throw new U(P, `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()}'`);
|
|
5864
|
-
const s =
|
|
5865
|
-
null !== s &&
|
|
5904
|
+
const s = Ie(t);
|
|
5905
|
+
null !== s && Qr(t, r, s);
|
|
5866
5906
|
}
|
|
5867
5907
|
const n = function(t, e) {
|
|
5868
5908
|
for (const n of t) for (const t of n.getFlattenedFilters()) if (e.indexOf(t.op) >= 0) return t.op;
|
|
@@ -5888,12 +5928,12 @@ function Lr(t, e, n) {
|
|
|
5888
5928
|
throw n === e.op ? new U(P, `Invalid query. You cannot use more than one '${e.op.toString()}' filter.`) : new U(P, `Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`);
|
|
5889
5929
|
}
|
|
5890
5930
|
|
|
5891
|
-
function
|
|
5931
|
+
function Qr(t, e, n) {
|
|
5892
5932
|
if (!n.isEqual(e)) throw new U(P, `Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${e.toString()}' and so you must also use '${e.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${n.toString()}' instead.`);
|
|
5893
5933
|
}
|
|
5894
5934
|
|
|
5895
|
-
function
|
|
5896
|
-
if (!(e instanceof
|
|
5935
|
+
function zr(t, e) {
|
|
5936
|
+
if (!(e instanceof Tr || e instanceof Rr)) throw new U(P, `Function ${t}() requires AppliableConstraints created with a call to 'where(...)', 'or(...)', or 'and(...)'.`);
|
|
5897
5937
|
}
|
|
5898
5938
|
|
|
5899
5939
|
/**
|
|
@@ -5921,7 +5961,7 @@ function Qr(t, e) {
|
|
|
5921
5961
|
* their `set()` or fails due to invalid data originating from a `toFirestore()`
|
|
5922
5962
|
* call.
|
|
5923
5963
|
*/
|
|
5924
|
-
function
|
|
5964
|
+
function Wr(t, e, n) {
|
|
5925
5965
|
let r;
|
|
5926
5966
|
// Cast to `any` in order to satisfy the union type constraint on
|
|
5927
5967
|
// toFirestore().
|
|
@@ -5930,9 +5970,9 @@ function zr(t, e, n) {
|
|
|
5930
5970
|
r;
|
|
5931
5971
|
}
|
|
5932
5972
|
|
|
5933
|
-
class
|
|
5973
|
+
class Gr extends class {
|
|
5934
5974
|
convertValue(t, e = "none") {
|
|
5935
|
-
switch (
|
|
5975
|
+
switch (Ct(t)) {
|
|
5936
5976
|
case 0 /* TypeOrder.NullValue */ :
|
|
5937
5977
|
return null;
|
|
5938
5978
|
|
|
@@ -5952,7 +5992,7 @@ class Wr extends class {
|
|
|
5952
5992
|
return t.stringValue;
|
|
5953
5993
|
|
|
5954
5994
|
case 6 /* TypeOrder.BlobValue */ :
|
|
5955
|
-
return this.convertBytes(
|
|
5995
|
+
return this.convertBytes(Ft(t.bytesValue));
|
|
5956
5996
|
|
|
5957
5997
|
case 7 /* TypeOrder.RefValue */ :
|
|
5958
5998
|
return this.convertReference(t.referenceValue);
|
|
@@ -5977,12 +6017,12 @@ class Wr extends class {
|
|
|
5977
6017
|
* @internal
|
|
5978
6018
|
*/ convertObjectMap(t, e = "none") {
|
|
5979
6019
|
const n = {};
|
|
5980
|
-
return
|
|
6020
|
+
return Rt(t, ((t, r) => {
|
|
5981
6021
|
n[t] = this.convertValue(r, e);
|
|
5982
6022
|
})), n;
|
|
5983
6023
|
}
|
|
5984
6024
|
convertGeoPoint(t) {
|
|
5985
|
-
return new
|
|
6025
|
+
return new Bn(Dt(t.latitude), Dt(t.longitude));
|
|
5986
6026
|
}
|
|
5987
6027
|
convertArray(t, e) {
|
|
5988
6028
|
return (t.values || []).map((t => this.convertValue(t, e)));
|
|
@@ -5990,23 +6030,23 @@ class Wr extends class {
|
|
|
5990
6030
|
convertServerTimestamp(t, e) {
|
|
5991
6031
|
switch (e) {
|
|
5992
6032
|
case "previous":
|
|
5993
|
-
const n =
|
|
6033
|
+
const n = qt(t);
|
|
5994
6034
|
return null == n ? null : this.convertValue(n, e);
|
|
5995
6035
|
|
|
5996
6036
|
case "estimate":
|
|
5997
|
-
return this.convertTimestamp(
|
|
6037
|
+
return this.convertTimestamp(Ot(t));
|
|
5998
6038
|
|
|
5999
6039
|
default:
|
|
6000
6040
|
return null;
|
|
6001
6041
|
}
|
|
6002
6042
|
}
|
|
6003
6043
|
convertTimestamp(t) {
|
|
6004
|
-
const e =
|
|
6005
|
-
return new
|
|
6044
|
+
const e = Nt(t);
|
|
6045
|
+
return new xt(e.seconds, e.nanos);
|
|
6006
6046
|
}
|
|
6007
6047
|
convertDocumentKey(t, e) {
|
|
6008
6048
|
const n = tt.fromString(t);
|
|
6009
|
-
E(
|
|
6049
|
+
E(dn(n));
|
|
6010
6050
|
const r = new X(n.get(1), n.get(3)), s = new rt(n.popFirst(5));
|
|
6011
6051
|
return r.isEqual(e) ||
|
|
6012
6052
|
// TODO(b/64130202): Somehow support foreign references.
|
|
@@ -6018,7 +6058,7 @@ class Wr extends class {
|
|
|
6018
6058
|
super(), this.firestore = t;
|
|
6019
6059
|
}
|
|
6020
6060
|
convertBytes(t) {
|
|
6021
|
-
return new
|
|
6061
|
+
return new Mn(t);
|
|
6022
6062
|
}
|
|
6023
6063
|
convertReference(t) {
|
|
6024
6064
|
const e = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
@@ -6038,12 +6078,12 @@ class Wr extends class {
|
|
|
6038
6078
|
* @param reference - The reference of the document to fetch.
|
|
6039
6079
|
* @returns A Promise resolved with a `DocumentSnapshot` containing the current
|
|
6040
6080
|
* document contents.
|
|
6041
|
-
*/ function
|
|
6042
|
-
const e =
|
|
6043
|
-
return
|
|
6081
|
+
*/ function Kr(t) {
|
|
6082
|
+
const e = En((t = ct(t, Dn)).firestore), n = new Gr(t.firestore);
|
|
6083
|
+
return gn(e, [ t._key ]).then((e => {
|
|
6044
6084
|
E(1 === e.length);
|
|
6045
6085
|
const r = e[0];
|
|
6046
|
-
return new
|
|
6086
|
+
return new pr(t.firestore, n, t._key, r.isFoundDocument() ? r : null, t.converter);
|
|
6047
6087
|
}));
|
|
6048
6088
|
}
|
|
6049
6089
|
|
|
@@ -6058,33 +6098,33 @@ class Wr extends class {
|
|
|
6058
6098
|
*
|
|
6059
6099
|
* @param query - The `Query` to execute.
|
|
6060
6100
|
* @returns A Promise that will be resolved with the results of the query.
|
|
6061
|
-
*/ function
|
|
6101
|
+
*/ function Yr(t) {
|
|
6062
6102
|
!function(t) {
|
|
6063
6103
|
if ("L" /* LimitType.Last */ === t.limitType && 0 === t.explicitOrderBy.length) throw new U(k, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
6064
|
-
}((t = ct(t,
|
|
6065
|
-
const e =
|
|
6066
|
-
return
|
|
6067
|
-
const r = e.map((e => new
|
|
6104
|
+
}((t = ct(t, Fn))._query);
|
|
6105
|
+
const e = En(t.firestore), n = new Gr(t.firestore);
|
|
6106
|
+
return _n(e, t._query).then((e => {
|
|
6107
|
+
const r = e.map((e => new yr(t.firestore, n, e.key, e, t.converter)));
|
|
6068
6108
|
return "L" /* LimitType.Last */ === t._query.limitType &&
|
|
6069
6109
|
// Limit to last queries reverse the orderBy constraint that was
|
|
6070
6110
|
// specified by the user. As such, we need to reverse the order of the
|
|
6071
6111
|
// results to return the documents in the expected order.
|
|
6072
|
-
r.reverse(), new
|
|
6112
|
+
r.reverse(), new gr(t, r);
|
|
6073
6113
|
}));
|
|
6074
6114
|
}
|
|
6075
6115
|
|
|
6076
|
-
function
|
|
6077
|
-
const r =
|
|
6078
|
-
return
|
|
6116
|
+
function Hr(t, e, n) {
|
|
6117
|
+
const r = Wr((t = ct(t, Dn)).converter, e, n), s = Jn(Hn(t.firestore), "setDoc", t._key, r, null !== t.converter, n);
|
|
6118
|
+
return yn(En(t.firestore), [ s.toMutation(t._key, ke.none()) ]);
|
|
6079
6119
|
}
|
|
6080
6120
|
|
|
6081
|
-
function
|
|
6082
|
-
const s =
|
|
6121
|
+
function Jr(t, e, n, ...r) {
|
|
6122
|
+
const s = Hn((t = ct(t, Dn)).firestore);
|
|
6083
6123
|
// For Compat types, we have to "extract" the underlying types before
|
|
6084
6124
|
// performing validation.
|
|
6085
6125
|
let i;
|
|
6086
|
-
i = "string" == typeof (e = getModularInstance(e)) || e instanceof
|
|
6087
|
-
return
|
|
6126
|
+
i = "string" == typeof (e = getModularInstance(e)) || e instanceof Ln ? ir(s, "updateDoc", t._key, e, n, r) : sr(s, "updateDoc", t._key, e);
|
|
6127
|
+
return yn(En(t.firestore), [ i.toMutation(t._key, ke.exists(!0)) ]);
|
|
6088
6128
|
}
|
|
6089
6129
|
|
|
6090
6130
|
/**
|
|
@@ -6098,8 +6138,8 @@ function Hr(t, e, n, ...r) {
|
|
|
6098
6138
|
* @param reference - A reference to the document to delete.
|
|
6099
6139
|
* @returns A `Promise` resolved once the document has been successfully
|
|
6100
6140
|
* deleted from the backend.
|
|
6101
|
-
*/ function
|
|
6102
|
-
return
|
|
6141
|
+
*/ function Xr(t) {
|
|
6142
|
+
return yn(En((t = ct(t, Dn)).firestore), [ new Ue(t._key, ke.none()) ]);
|
|
6103
6143
|
}
|
|
6104
6144
|
|
|
6105
6145
|
/**
|
|
@@ -6116,9 +6156,9 @@ function Hr(t, e, n, ...r) {
|
|
|
6116
6156
|
* @throws Error - If the provided input is not a valid Firestore document.
|
|
6117
6157
|
* @returns A `Promise` resolved with a `DocumentReference` pointing to the
|
|
6118
6158
|
* newly created document after it has been written to the backend.
|
|
6119
|
-
*/ function
|
|
6120
|
-
const n =
|
|
6121
|
-
return
|
|
6159
|
+
*/ function Zr(t, e) {
|
|
6160
|
+
const n = On(t = ct(t, xn)), r = Wr(t.converter, e), s = Jn(Hn(t.firestore), "addDoc", n._key, r, null !== n.converter, {});
|
|
6161
|
+
return yn(En(t.firestore), [ s.toMutation(n._key, ke.exists(!1)) ]).then((() => n));
|
|
6122
6162
|
}
|
|
6123
6163
|
|
|
6124
6164
|
/**
|
|
@@ -6150,9 +6190,9 @@ function Hr(t, e, n, ...r) {
|
|
|
6150
6190
|
* @returns A Promise that will be resolved with the count; the count can be
|
|
6151
6191
|
* retrieved from `snapshot.data().count`, where `snapshot` is the
|
|
6152
6192
|
* `AggregateQuerySnapshot` to which the returned Promise resolves.
|
|
6153
|
-
*/ function
|
|
6154
|
-
return
|
|
6155
|
-
count:
|
|
6193
|
+
*/ function ts(t) {
|
|
6194
|
+
return es(t, {
|
|
6195
|
+
count: ss()
|
|
6156
6196
|
});
|
|
6157
6197
|
}
|
|
6158
6198
|
|
|
@@ -6182,16 +6222,16 @@ function Hr(t, e, n, ...r) {
|
|
|
6182
6222
|
* const averageScore: number | null = aggregateSnapshot.data().averageScore;
|
|
6183
6223
|
* ```
|
|
6184
6224
|
* @internal TODO (sum/avg) remove when public
|
|
6185
|
-
*/ function
|
|
6186
|
-
const n = ct(t.firestore,
|
|
6225
|
+
*/ function es(t, e) {
|
|
6226
|
+
const n = ct(t.firestore, Tn), r = En(n), s = function(t, e) {
|
|
6187
6227
|
const n = [];
|
|
6188
6228
|
for (const r in t) Object.prototype.hasOwnProperty.call(t, r) && n.push(e(t[r], r, t));
|
|
6189
6229
|
return n;
|
|
6190
|
-
}(e, ((t, e) => new
|
|
6230
|
+
}(e, ((t, e) => new vt(e, t._aggregateType, t._internalFieldPath)));
|
|
6191
6231
|
// Run the aggregation and convert the results
|
|
6192
|
-
return
|
|
6193
|
-
const r = new
|
|
6194
|
-
return new
|
|
6232
|
+
return vn(r, t._query, s).then((e => function(t, e, n) {
|
|
6233
|
+
const r = new Gr(t);
|
|
6234
|
+
return new Nn(e, r, n);
|
|
6195
6235
|
}
|
|
6196
6236
|
/**
|
|
6197
6237
|
* Create an AggregateField object that can be used to compute the sum of
|
|
@@ -6201,8 +6241,8 @@ function Hr(t, e, n, ...r) {
|
|
|
6201
6241
|
*/ (n, t, e)));
|
|
6202
6242
|
}
|
|
6203
6243
|
|
|
6204
|
-
function
|
|
6205
|
-
return new
|
|
6244
|
+
function ns(t) {
|
|
6245
|
+
return new $n("sum", lr("sum", t));
|
|
6206
6246
|
}
|
|
6207
6247
|
|
|
6208
6248
|
/**
|
|
@@ -6210,16 +6250,16 @@ function es(t) {
|
|
|
6210
6250
|
* a specified field over a range of documents in the result set of a query.
|
|
6211
6251
|
* @param field Specifies the field to average across the result set.
|
|
6212
6252
|
* @internal TODO (sum/avg) remove when public
|
|
6213
|
-
*/ function
|
|
6214
|
-
return new
|
|
6253
|
+
*/ function rs(t) {
|
|
6254
|
+
return new $n("avg", lr("average", t));
|
|
6215
6255
|
}
|
|
6216
6256
|
|
|
6217
6257
|
/**
|
|
6218
6258
|
* Create an AggregateField object that can be used to compute the count of
|
|
6219
6259
|
* documents in the result set of a query.
|
|
6220
6260
|
* @internal TODO (sum/avg) remove when public
|
|
6221
|
-
*/ function
|
|
6222
|
-
return new
|
|
6261
|
+
*/ function ss() {
|
|
6262
|
+
return new $n("count");
|
|
6223
6263
|
}
|
|
6224
6264
|
|
|
6225
6265
|
/**
|
|
@@ -6228,9 +6268,9 @@ function es(t) {
|
|
|
6228
6268
|
* @param left Compare this AggregateField to the `right`.
|
|
6229
6269
|
* @param right Compare this AggregateField to the `left`.
|
|
6230
6270
|
* @internal TODO (sum/avg) remove when public
|
|
6231
|
-
*/ function
|
|
6271
|
+
*/ function is(t, e) {
|
|
6232
6272
|
var n, r;
|
|
6233
|
-
return t instanceof
|
|
6273
|
+
return t instanceof $n && e instanceof $n && t._aggregateType === e._aggregateType && (null === (n = t._internalFieldPath) || void 0 === n ? void 0 : n.canonicalString()) === (null === (r = e._internalFieldPath) || void 0 === r ? void 0 : r.canonicalString());
|
|
6234
6274
|
}
|
|
6235
6275
|
|
|
6236
6276
|
/**
|
|
@@ -6244,8 +6284,8 @@ function es(t) {
|
|
|
6244
6284
|
*
|
|
6245
6285
|
* @returns `true` if the objects are "equal", as defined above, or `false`
|
|
6246
6286
|
* otherwise.
|
|
6247
|
-
*/ function
|
|
6248
|
-
return
|
|
6287
|
+
*/ function os(t, e) {
|
|
6288
|
+
return Cn(t.query, e.query) && deepEqual(t.data(), e.data());
|
|
6249
6289
|
}
|
|
6250
6290
|
|
|
6251
6291
|
/**
|
|
@@ -6267,15 +6307,15 @@ function es(t) {
|
|
|
6267
6307
|
/**
|
|
6268
6308
|
* Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or
|
|
6269
6309
|
* {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion.
|
|
6270
|
-
*/ function
|
|
6271
|
-
return new
|
|
6310
|
+
*/ function us() {
|
|
6311
|
+
return new Xn("deleteField");
|
|
6272
6312
|
}
|
|
6273
6313
|
|
|
6274
6314
|
/**
|
|
6275
6315
|
* Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
|
|
6276
6316
|
* include a server-generated timestamp in the written data.
|
|
6277
|
-
*/ function
|
|
6278
|
-
return new
|
|
6317
|
+
*/ function cs() {
|
|
6318
|
+
return new tr("serverTimestamp");
|
|
6279
6319
|
}
|
|
6280
6320
|
|
|
6281
6321
|
/**
|
|
@@ -6289,10 +6329,10 @@ function es(t) {
|
|
|
6289
6329
|
* @param elements - The elements to union into the array.
|
|
6290
6330
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
6291
6331
|
* `updateDoc()`.
|
|
6292
|
-
*/ function
|
|
6332
|
+
*/ function as(...t) {
|
|
6293
6333
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
6294
6334
|
// update() since we'd need the Firestore instance to do this.
|
|
6295
|
-
return new
|
|
6335
|
+
return new er("arrayUnion", t);
|
|
6296
6336
|
}
|
|
6297
6337
|
|
|
6298
6338
|
/**
|
|
@@ -6305,10 +6345,10 @@ function es(t) {
|
|
|
6305
6345
|
* @param elements - The elements to remove from the array.
|
|
6306
6346
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
6307
6347
|
* `updateDoc()`
|
|
6308
|
-
*/ function
|
|
6348
|
+
*/ function hs(...t) {
|
|
6309
6349
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
6310
6350
|
// update() since we'd need the Firestore instance to do this.
|
|
6311
|
-
return new
|
|
6351
|
+
return new nr("arrayRemove", t);
|
|
6312
6352
|
}
|
|
6313
6353
|
|
|
6314
6354
|
/**
|
|
@@ -6329,8 +6369,8 @@ function es(t) {
|
|
|
6329
6369
|
* @param n - The value to increment by.
|
|
6330
6370
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
6331
6371
|
* `updateDoc()`
|
|
6332
|
-
*/ function
|
|
6333
|
-
return new
|
|
6372
|
+
*/ function ls(t) {
|
|
6373
|
+
return new rr("increment", t);
|
|
6334
6374
|
}
|
|
6335
6375
|
|
|
6336
6376
|
/**
|
|
@@ -6356,25 +6396,25 @@ function es(t) {
|
|
|
6356
6396
|
* provides methods for adding writes to the write batch. None of the writes
|
|
6357
6397
|
* will be committed (or visible locally) until {@link WriteBatch.commit} is
|
|
6358
6398
|
* called.
|
|
6359
|
-
*/ class
|
|
6399
|
+
*/ class fs {
|
|
6360
6400
|
/** @hideconstructor */
|
|
6361
6401
|
constructor(t, e) {
|
|
6362
6402
|
this._firestore = t, this._commitHandler = e, this._mutations = [], this._committed = !1,
|
|
6363
|
-
this._dataReader =
|
|
6403
|
+
this._dataReader = Hn(t);
|
|
6364
6404
|
}
|
|
6365
6405
|
set(t, e, n) {
|
|
6366
6406
|
this._verifyNotCommitted();
|
|
6367
|
-
const r =
|
|
6368
|
-
return this._mutations.push(i.toMutation(r._key,
|
|
6407
|
+
const r = ds(t, this._firestore), s = Wr(r.converter, e, n), i = Jn(this._dataReader, "WriteBatch.set", r._key, s, null !== r.converter, n);
|
|
6408
|
+
return this._mutations.push(i.toMutation(r._key, ke.none())), this;
|
|
6369
6409
|
}
|
|
6370
6410
|
update(t, e, n, ...r) {
|
|
6371
6411
|
this._verifyNotCommitted();
|
|
6372
|
-
const s =
|
|
6412
|
+
const s = ds(t, this._firestore);
|
|
6373
6413
|
// For Compat types, we have to "extract" the underlying types before
|
|
6374
6414
|
// performing validation.
|
|
6375
6415
|
let i;
|
|
6376
|
-
return i = "string" == typeof (e = getModularInstance(e)) || e instanceof
|
|
6377
|
-
this._mutations.push(i.toMutation(s._key,
|
|
6416
|
+
return i = "string" == typeof (e = getModularInstance(e)) || e instanceof Ln ? ir(this._dataReader, "WriteBatch.update", s._key, e, n, r) : sr(this._dataReader, "WriteBatch.update", s._key, e),
|
|
6417
|
+
this._mutations.push(i.toMutation(s._key, ke.exists(!0))), this;
|
|
6378
6418
|
}
|
|
6379
6419
|
/**
|
|
6380
6420
|
* Deletes the document referred to by the provided {@link DocumentReference}.
|
|
@@ -6383,8 +6423,8 @@ function es(t) {
|
|
|
6383
6423
|
* @returns This `WriteBatch` instance. Used for chaining method calls.
|
|
6384
6424
|
*/ delete(t) {
|
|
6385
6425
|
this._verifyNotCommitted();
|
|
6386
|
-
const e =
|
|
6387
|
-
return this._mutations = this._mutations.concat(new
|
|
6426
|
+
const e = ds(t, this._firestore);
|
|
6427
|
+
return this._mutations = this._mutations.concat(new Ue(e._key, ke.none())), this;
|
|
6388
6428
|
}
|
|
6389
6429
|
/**
|
|
6390
6430
|
* Commits all of the writes in this write batch as a single atomic unit.
|
|
@@ -6405,7 +6445,7 @@ function es(t) {
|
|
|
6405
6445
|
}
|
|
6406
6446
|
}
|
|
6407
6447
|
|
|
6408
|
-
function
|
|
6448
|
+
function ds(t, e) {
|
|
6409
6449
|
if ((t = getModularInstance(t)).firestore !== e) throw new U(P, "Provided document reference is from a different Firestore instance.");
|
|
6410
6450
|
return t;
|
|
6411
6451
|
}
|
|
@@ -6422,9 +6462,9 @@ function fs(t, e) {
|
|
|
6422
6462
|
*
|
|
6423
6463
|
* @returns A `WriteBatch` that can be used to atomically execute multiple
|
|
6424
6464
|
* writes.
|
|
6425
|
-
*/ function
|
|
6426
|
-
const e =
|
|
6427
|
-
return new
|
|
6465
|
+
*/ function ws(t) {
|
|
6466
|
+
const e = En(t = ct(t, Tn));
|
|
6467
|
+
return new fs(t, (t => yn(e, t)));
|
|
6428
6468
|
}
|
|
6429
6469
|
|
|
6430
6470
|
/**
|
|
@@ -6446,7 +6486,7 @@ function fs(t, e) {
|
|
|
6446
6486
|
/**
|
|
6447
6487
|
* Internal transaction object responsible for accumulating the mutations to
|
|
6448
6488
|
* perform and the base versions for any documents read.
|
|
6449
|
-
*/ class
|
|
6489
|
+
*/ class ms {
|
|
6450
6490
|
constructor(t) {
|
|
6451
6491
|
this.datastore = t,
|
|
6452
6492
|
// The version of each document that was read during this transaction.
|
|
@@ -6466,7 +6506,7 @@ function fs(t, e) {
|
|
|
6466
6506
|
}
|
|
6467
6507
|
async lookup(t) {
|
|
6468
6508
|
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new U(P, "Firestore transactions require all reads to be executed before all writes.");
|
|
6469
|
-
const e = await
|
|
6509
|
+
const e = await gn(this.datastore, t);
|
|
6470
6510
|
return e.forEach((t => this.recordVersion(t))), e;
|
|
6471
6511
|
}
|
|
6472
6512
|
set(t, e) {
|
|
@@ -6481,7 +6521,7 @@ function fs(t, e) {
|
|
|
6481
6521
|
this.writtenDocs.add(t.toString());
|
|
6482
6522
|
}
|
|
6483
6523
|
delete(t) {
|
|
6484
|
-
this.write(new
|
|
6524
|
+
this.write(new Ue(t, this.precondition(t))), this.writtenDocs.add(t.toString());
|
|
6485
6525
|
}
|
|
6486
6526
|
async commit() {
|
|
6487
6527
|
if (this.ensureCommitNotCalled(), this.lastWriteError) throw this.lastWriteError;
|
|
@@ -6494,15 +6534,15 @@ function fs(t, e) {
|
|
|
6494
6534
|
// a `verify` operation.
|
|
6495
6535
|
t.forEach(((t, e) => {
|
|
6496
6536
|
const n = rt.fromPath(e);
|
|
6497
|
-
this.mutations.push(new
|
|
6498
|
-
})), await
|
|
6537
|
+
this.mutations.push(new je(n, this.precondition(n)));
|
|
6538
|
+
})), await yn(this.datastore, this.mutations), this.committed = !0;
|
|
6499
6539
|
}
|
|
6500
6540
|
recordVersion(t) {
|
|
6501
6541
|
let e;
|
|
6502
6542
|
if (t.isFoundDocument()) e = t.version; else {
|
|
6503
6543
|
if (!t.isNoDocument()) throw b();
|
|
6504
6544
|
// Represent a deleted doc using SnapshotVersion.min().
|
|
6505
|
-
e =
|
|
6545
|
+
e = le.min();
|
|
6506
6546
|
}
|
|
6507
6547
|
const n = this.readVersions.get(t.key.toString());
|
|
6508
6548
|
if (n) {
|
|
@@ -6516,7 +6556,7 @@ function fs(t, e) {
|
|
|
6516
6556
|
* as a precondition, or no precondition if it was not read.
|
|
6517
6557
|
*/ precondition(t) {
|
|
6518
6558
|
const e = this.readVersions.get(t.toString());
|
|
6519
|
-
return !this.writtenDocs.has(t.toString()) && e ? e.isEqual(
|
|
6559
|
+
return !this.writtenDocs.has(t.toString()) && e ? e.isEqual(le.min()) ? ke.exists(!1) : ke.updateTime(e) : ke.none();
|
|
6520
6560
|
}
|
|
6521
6561
|
/**
|
|
6522
6562
|
* Returns the precondition for a document if the operation is an update.
|
|
@@ -6525,7 +6565,7 @@ function fs(t, e) {
|
|
|
6525
6565
|
// The first time a document is written, we want to take into account the
|
|
6526
6566
|
// read time and existence
|
|
6527
6567
|
if (!this.writtenDocs.has(t.toString()) && e) {
|
|
6528
|
-
if (e.isEqual(
|
|
6568
|
+
if (e.isEqual(le.min()))
|
|
6529
6569
|
// The document doesn't exist, so fail the transaction.
|
|
6530
6570
|
// This has to be validated locally because you can't send a
|
|
6531
6571
|
// precondition that a document does not exist without changing the
|
|
@@ -6537,11 +6577,11 @@ function fs(t, e) {
|
|
|
6537
6577
|
// transaction.
|
|
6538
6578
|
throw new U(P, "Can't update a document that doesn't exist.");
|
|
6539
6579
|
// Document exists, base precondition on document update time.
|
|
6540
|
-
return
|
|
6580
|
+
return ke.updateTime(e);
|
|
6541
6581
|
}
|
|
6542
6582
|
// Document was not read, so we just use the preconditions for a blind
|
|
6543
6583
|
// update.
|
|
6544
|
-
return
|
|
6584
|
+
return ke.exists(!0);
|
|
6545
6585
|
}
|
|
6546
6586
|
write(t) {
|
|
6547
6587
|
this.ensureCommitNotCalled(), this.mutations.push(t);
|
|
@@ -6564,7 +6604,7 @@ function fs(t, e) {
|
|
|
6564
6604
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
6565
6605
|
* See the License for the specific language governing permissions and
|
|
6566
6606
|
* limitations under the License.
|
|
6567
|
-
*/ const
|
|
6607
|
+
*/ const ps = {
|
|
6568
6608
|
maxAttempts: 5
|
|
6569
6609
|
};
|
|
6570
6610
|
|
|
@@ -6588,17 +6628,17 @@ function fs(t, e) {
|
|
|
6588
6628
|
* TransactionRunner encapsulates the logic needed to run and retry transactions
|
|
6589
6629
|
* with backoff.
|
|
6590
6630
|
*/
|
|
6591
|
-
class
|
|
6631
|
+
class ys {
|
|
6592
6632
|
constructor(t, e, n, r, s) {
|
|
6593
6633
|
this.asyncQueue = t, this.datastore = e, this.options = n, this.updateFunction = r,
|
|
6594
|
-
this.deferred = s, this.wt = n.maxAttempts, this.yt = new
|
|
6634
|
+
this.deferred = s, this.wt = n.maxAttempts, this.yt = new mn(this.asyncQueue, "transaction_retry" /* TimerId.TransactionRetry */);
|
|
6595
6635
|
}
|
|
6596
6636
|
/** Runs the transaction and sets the result on deferred. */ run() {
|
|
6597
6637
|
this.wt -= 1, this.gt();
|
|
6598
6638
|
}
|
|
6599
6639
|
gt() {
|
|
6600
6640
|
this.yt.K((async () => {
|
|
6601
|
-
const t = new
|
|
6641
|
+
const t = new ms(this.datastore), e = this._t(t);
|
|
6602
6642
|
e && e.then((e => {
|
|
6603
6643
|
this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
|
|
6604
6644
|
this.deferred.resolve(e);
|
|
@@ -6613,7 +6653,7 @@ class ps {
|
|
|
6613
6653
|
_t(t) {
|
|
6614
6654
|
try {
|
|
6615
6655
|
const e = this.updateFunction(t);
|
|
6616
|
-
return !
|
|
6656
|
+
return !dt(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
|
|
6617
6657
|
null);
|
|
6618
6658
|
} catch (t) {
|
|
6619
6659
|
// Do not retry errors thrown by user provided updateFunction.
|
|
@@ -6654,8 +6694,8 @@ class ps {
|
|
|
6654
6694
|
|
|
6655
6695
|
case P:
|
|
6656
6696
|
case $:
|
|
6657
|
-
case D:
|
|
6658
6697
|
case N:
|
|
6698
|
+
case D:
|
|
6659
6699
|
case S:
|
|
6660
6700
|
// Aborted might be retried in some scenarios, but that is dependant on
|
|
6661
6701
|
// the context and should handled individually by the calling code.
|
|
@@ -6688,7 +6728,7 @@ class ps {
|
|
|
6688
6728
|
* See the License for the specific language governing permissions and
|
|
6689
6729
|
* limitations under the License.
|
|
6690
6730
|
*/
|
|
6691
|
-
/** The Platform's 'document' implementation or null if not available. */ function
|
|
6731
|
+
/** The Platform's 'document' implementation or null if not available. */ function gs() {
|
|
6692
6732
|
// `document` is not always available, e.g. in ReactNative and WebWorkers.
|
|
6693
6733
|
// eslint-disable-next-line no-restricted-globals
|
|
6694
6734
|
return "undefined" != typeof document ? document : null;
|
|
@@ -6720,7 +6760,7 @@ class ps {
|
|
|
6720
6760
|
* Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type
|
|
6721
6761
|
* in newer versions of TypeScript defines `finally`, which is not available in
|
|
6722
6762
|
* IE.
|
|
6723
|
-
*/ class
|
|
6763
|
+
*/ class _s {
|
|
6724
6764
|
constructor(t, e, n, r, s) {
|
|
6725
6765
|
this.asyncQueue = t, this.timerId = e, this.targetTimeMs = n, this.op = r, this.removalCallback = s,
|
|
6726
6766
|
this.deferred = new j, this.then = this.deferred.promise.then.bind(this.deferred.promise),
|
|
@@ -6743,7 +6783,7 @@ class ps {
|
|
|
6743
6783
|
* PORTING NOTE: This exists to prevent making removeDelayedOperation() and
|
|
6744
6784
|
* the DelayedOperation class public.
|
|
6745
6785
|
*/ static createAndSchedule(t, e, n, r, s) {
|
|
6746
|
-
const i = Date.now() + n, o = new
|
|
6786
|
+
const i = Date.now() + n, o = new _s(t, e, i, r, s);
|
|
6747
6787
|
return o.start(n), o;
|
|
6748
6788
|
}
|
|
6749
6789
|
/**
|
|
@@ -6792,7 +6832,7 @@ class ps {
|
|
|
6792
6832
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
6793
6833
|
* See the License for the specific language governing permissions and
|
|
6794
6834
|
* limitations under the License.
|
|
6795
|
-
*/ class
|
|
6835
|
+
*/ class vs {
|
|
6796
6836
|
constructor() {
|
|
6797
6837
|
// The last promise in the queue.
|
|
6798
6838
|
this.Et = Promise.resolve(),
|
|
@@ -6815,16 +6855,16 @@ class ps {
|
|
|
6815
6855
|
// List of TimerIds to fast-forward delays for.
|
|
6816
6856
|
this.$t = [],
|
|
6817
6857
|
// Backoff timer used to schedule retries for retryable operations
|
|
6818
|
-
this.yt = new
|
|
6858
|
+
this.yt = new mn(this, "async_queue_retry" /* TimerId.AsyncQueueRetry */),
|
|
6819
6859
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
6820
6860
|
// operations. Meant to speed up recovery when we regain file system access
|
|
6821
6861
|
// after page comes into foreground.
|
|
6822
|
-
this.
|
|
6823
|
-
const t =
|
|
6862
|
+
this.Nt = () => {
|
|
6863
|
+
const t = gs();
|
|
6824
6864
|
t && y("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.yt.H();
|
|
6825
6865
|
};
|
|
6826
|
-
const t =
|
|
6827
|
-
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.
|
|
6866
|
+
const t = gs();
|
|
6867
|
+
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Nt);
|
|
6828
6868
|
}
|
|
6829
6869
|
get isShuttingDown() {
|
|
6830
6870
|
return this.Tt;
|
|
@@ -6837,19 +6877,19 @@ class ps {
|
|
|
6837
6877
|
this.enqueue(t);
|
|
6838
6878
|
}
|
|
6839
6879
|
enqueueAndForgetEvenWhileRestricted(t) {
|
|
6840
|
-
this.
|
|
6880
|
+
this.Dt(),
|
|
6841
6881
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
6842
6882
|
this.Ft(t);
|
|
6843
6883
|
}
|
|
6844
6884
|
enterRestrictedMode(t) {
|
|
6845
6885
|
if (!this.Tt) {
|
|
6846
6886
|
this.Tt = !0, this.Vt = t || !1;
|
|
6847
|
-
const e =
|
|
6848
|
-
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.
|
|
6887
|
+
const e = gs();
|
|
6888
|
+
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Nt);
|
|
6849
6889
|
}
|
|
6850
6890
|
}
|
|
6851
6891
|
enqueue(t) {
|
|
6852
|
-
if (this.
|
|
6892
|
+
if (this.Dt(), this.Tt)
|
|
6853
6893
|
// Return a Promise which never resolves.
|
|
6854
6894
|
return new Promise((() => {}));
|
|
6855
6895
|
// Create a deferred Promise that we can return to the callee. This
|
|
@@ -6973,13 +7013,13 @@ class ps {
|
|
|
6973
7013
|
return this.Et = e, e;
|
|
6974
7014
|
}
|
|
6975
7015
|
enqueueAfterDelay(t, e, n) {
|
|
6976
|
-
this.
|
|
7016
|
+
this.Dt(),
|
|
6977
7017
|
// Fast-forward delays for timerIds that have been overriden.
|
|
6978
7018
|
this.$t.indexOf(t) > -1 && (e = 0);
|
|
6979
|
-
const r =
|
|
7019
|
+
const r = _s.createAndSchedule(this, t, e, n, (t => this.St(t)));
|
|
6980
7020
|
return this.At.push(r), r;
|
|
6981
7021
|
}
|
|
6982
|
-
|
|
7022
|
+
Dt() {
|
|
6983
7023
|
this.Rt && b();
|
|
6984
7024
|
}
|
|
6985
7025
|
verifyOperationInProgress() {}
|
|
@@ -7030,10 +7070,10 @@ class ps {
|
|
|
7030
7070
|
}
|
|
7031
7071
|
}
|
|
7032
7072
|
|
|
7033
|
-
class
|
|
7073
|
+
class bs {
|
|
7034
7074
|
/** @hideconstructor */
|
|
7035
7075
|
constructor(t, e) {
|
|
7036
|
-
this._firestore = t, this._transaction = e, this._dataReader =
|
|
7076
|
+
this._firestore = t, this._transaction = e, this._dataReader = Hn(t);
|
|
7037
7077
|
}
|
|
7038
7078
|
/**
|
|
7039
7079
|
* Reads the document referenced by the provided {@link DocumentReference}.
|
|
@@ -7041,25 +7081,25 @@ class vs {
|
|
|
7041
7081
|
* @param documentRef - A reference to the document to be read.
|
|
7042
7082
|
* @returns A `DocumentSnapshot` with the read data.
|
|
7043
7083
|
*/ get(t) {
|
|
7044
|
-
const e =
|
|
7084
|
+
const e = ds(t, this._firestore), n = new Gr(this._firestore);
|
|
7045
7085
|
return this._transaction.lookup([ e._key ]).then((t => {
|
|
7046
7086
|
if (!t || 1 !== t.length) return b();
|
|
7047
7087
|
const r = t[0];
|
|
7048
|
-
if (r.isFoundDocument()) return new
|
|
7049
|
-
if (r.isNoDocument()) return new
|
|
7088
|
+
if (r.isFoundDocument()) return new pr(this._firestore, n, r.key, r, e.converter);
|
|
7089
|
+
if (r.isNoDocument()) return new pr(this._firestore, n, e._key, null, e.converter);
|
|
7050
7090
|
throw b();
|
|
7051
7091
|
}));
|
|
7052
7092
|
}
|
|
7053
7093
|
set(t, e, n) {
|
|
7054
|
-
const r =
|
|
7094
|
+
const r = ds(t, this._firestore), s = Wr(r.converter, e, n), i = Jn(this._dataReader, "Transaction.set", r._key, s, null !== r.converter, n);
|
|
7055
7095
|
return this._transaction.set(r._key, i), this;
|
|
7056
7096
|
}
|
|
7057
7097
|
update(t, e, n, ...r) {
|
|
7058
|
-
const s =
|
|
7098
|
+
const s = ds(t, this._firestore);
|
|
7059
7099
|
// For Compat types, we have to "extract" the underlying types before
|
|
7060
7100
|
// performing validation.
|
|
7061
7101
|
let i;
|
|
7062
|
-
return i = "string" == typeof (e = getModularInstance(e)) || e instanceof
|
|
7102
|
+
return i = "string" == typeof (e = getModularInstance(e)) || e instanceof Ln ? ir(this._dataReader, "Transaction.update", s._key, e, n, r) : sr(this._dataReader, "Transaction.update", s._key, e),
|
|
7063
7103
|
this._transaction.update(s._key, i), this;
|
|
7064
7104
|
}
|
|
7065
7105
|
/**
|
|
@@ -7068,7 +7108,7 @@ class vs {
|
|
|
7068
7108
|
* @param documentRef - A reference to the document to be deleted.
|
|
7069
7109
|
* @returns This `Transaction` instance. Used for chaining method calls.
|
|
7070
7110
|
*/ delete(t) {
|
|
7071
|
-
const e =
|
|
7111
|
+
const e = ds(t, this._firestore);
|
|
7072
7112
|
return this._transaction.delete(e._key), this;
|
|
7073
7113
|
}
|
|
7074
7114
|
}
|
|
@@ -7091,13 +7131,13 @@ class vs {
|
|
|
7091
7131
|
* (the `updateFunction` returned a failed promise), the promise returned by the
|
|
7092
7132
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
7093
7133
|
* rejected promise with the corresponding failure error is returned.
|
|
7094
|
-
*/ function
|
|
7095
|
-
const r =
|
|
7134
|
+
*/ function Es(t, e, n) {
|
|
7135
|
+
const r = En(t = ct(t, Tn)), s = Object.assign(Object.assign({}, ps), n);
|
|
7096
7136
|
!function(t) {
|
|
7097
7137
|
if (t.maxAttempts < 1) throw new U(P, "Max attempts must be at least 1");
|
|
7098
7138
|
}(s);
|
|
7099
7139
|
const i = new j;
|
|
7100
|
-
return new
|
|
7140
|
+
return new ys(new vs, r, s, (n => e(new bs(t, n))), i).run(), i.promise;
|
|
7101
7141
|
}
|
|
7102
7142
|
|
|
7103
7143
|
/**
|
|
@@ -7110,7 +7150,7 @@ class vs {
|
|
|
7110
7150
|
*/ !function(t) {
|
|
7111
7151
|
w = t;
|
|
7112
7152
|
}(`${SDK_VERSION}_lite`), _registerComponent(new Component("firestore/lite", ((t, {instanceIdentifier: e, options: n}) => {
|
|
7113
|
-
const r = t.getProvider("app").getImmediate(), s = new
|
|
7153
|
+
const r = t.getProvider("app").getImmediate(), s = new Tn(new W(t.getProvider("auth-internal")), new H(t.getProvider("app-check-internal")), function(t, e) {
|
|
7114
7154
|
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new U(P, '"projectId" not provided in firebase.initializeApp.');
|
|
7115
7155
|
return new X(t.options.projectId, e);
|
|
7116
7156
|
}
|
|
@@ -7133,7 +7173,7 @@ class vs {
|
|
|
7133
7173
|
return n && s._setSettings(n), s;
|
|
7134
7174
|
}), "PUBLIC").setMultipleInstances(!0)),
|
|
7135
7175
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
7136
|
-
registerVersion("firestore-lite", "3.
|
|
7176
|
+
registerVersion("firestore-lite", "3.12.0-20230511201449", ""), registerVersion("firestore-lite", "3.12.0-20230511201449", "esm2017");
|
|
7137
7177
|
|
|
7138
|
-
export {
|
|
7178
|
+
export { $n as AggregateField, Nn as AggregateQuerySnapshot, Mn as Bytes, xn as CollectionReference, Dn as DocumentReference, pr as DocumentSnapshot, Ln as FieldPath, jn as FieldValue, Tn as Firestore, U as FirestoreError, Bn as GeoPoint, Fn as Query, Rr as QueryCompositeFilterConstraint, Er as QueryConstraint, yr as QueryDocumentSnapshot, kr as QueryEndAtConstraint, Tr as QueryFieldFilterConstraint, Dr as QueryLimitConstraint, $r as QueryOrderByConstraint, gr as QuerySnapshot, Sr as QueryStartAtConstraint, xt as Timestamp, bs as Transaction, fs as WriteBatch, Zr as addDoc, is as aggregateFieldEqual, os as aggregateQuerySnapshotEqual, Vr as and, hs as arrayRemove, as as arrayUnion, rs as average, Sn as collection, qn as collectionGroup, Pn as connectFirestoreEmulator, ss as count, Xr as deleteDoc, us as deleteField, On as doc, Un as documentId, Mr as endAt, Cr as endBefore, es as getAggregate, ts as getCount, Kr as getDoc, Yr as getDocs, Rn as getFirestore, ls as increment, An as initializeFirestore, Fr as limit, xr as limitToLast, Pr as or, Nr as orderBy, Ir as query, Cn as queryEqual, kn as refEqual, Es as runTransaction, cs as serverTimestamp, Hr as setDoc, p as setLogLevel, _r as snapshotEqual, Or as startAfter, qr as startAt, ns as sum, Vn as terminate, Jr as updateDoc, Ar as where, ws as writeBatch };
|
|
7139
7179
|
//# sourceMappingURL=index.browser.esm2017.js.map
|