@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
|
@@ -66,7 +66,7 @@ m.MOCK_USER = new m("mock-user");
|
|
|
66
66
|
* See the License for the specific language governing permissions and
|
|
67
67
|
* limitations under the License.
|
|
68
68
|
*/
|
|
69
|
-
let p = "9.
|
|
69
|
+
let p = "9.22.0-20230511201449";
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* @license
|
|
@@ -444,12 +444,14 @@ class Z {
|
|
|
444
444
|
* when using WebChannel as the network transport.
|
|
445
445
|
* @param autoDetectLongPolling - Whether to use the detectBufferingProxy
|
|
446
446
|
* option when using WebChannel as the network transport.
|
|
447
|
+
* @param longPollingOptions Options that configure long-polling.
|
|
447
448
|
* @param useFetchStreams Whether to use the Fetch API instead of
|
|
448
449
|
* XMLHTTPRequest
|
|
449
450
|
*/
|
|
450
|
-
constructor(t, e, n, r, s, i, o, u) {
|
|
451
|
+
constructor(t, e, n, r, s, i, o, u, c) {
|
|
451
452
|
this.databaseId = t, this.appId = e, this.persistenceKey = n, this.host = r, this.ssl = s,
|
|
452
|
-
this.forceLongPolling = i, this.autoDetectLongPolling = o, this.
|
|
453
|
+
this.forceLongPolling = i, this.autoDetectLongPolling = o, this.longPollingOptions = u,
|
|
454
|
+
this.useFetchStreams = c;
|
|
453
455
|
}
|
|
454
456
|
}
|
|
455
457
|
|
|
@@ -803,6 +805,34 @@ function lt(t, e) {
|
|
|
803
805
|
if (e <= 0) throw new B($, `Function ${t}() requires a positive number, but it was: ${e}.`);
|
|
804
806
|
}
|
|
805
807
|
|
|
808
|
+
/**
|
|
809
|
+
* @license
|
|
810
|
+
* Copyright 2023 Google LLC
|
|
811
|
+
*
|
|
812
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
813
|
+
* you may not use this file except in compliance with the License.
|
|
814
|
+
* You may obtain a copy of the License at
|
|
815
|
+
*
|
|
816
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
817
|
+
*
|
|
818
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
819
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
820
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
821
|
+
* See the License for the specific language governing permissions and
|
|
822
|
+
* limitations under the License.
|
|
823
|
+
*/
|
|
824
|
+
/**
|
|
825
|
+
* Compares two `ExperimentalLongPollingOptions` objects for equality.
|
|
826
|
+
*/
|
|
827
|
+
/**
|
|
828
|
+
* Creates and returns a new `ExperimentalLongPollingOptions` with the same
|
|
829
|
+
* option values as the given instance.
|
|
830
|
+
*/
|
|
831
|
+
function ft(t) {
|
|
832
|
+
const e = {};
|
|
833
|
+
return void 0 !== t.timeoutSeconds && (e.timeoutSeconds = t.timeoutSeconds), e;
|
|
834
|
+
}
|
|
835
|
+
|
|
806
836
|
/**
|
|
807
837
|
* @license
|
|
808
838
|
* Copyright 2023 Google LLC
|
|
@@ -822,7 +852,7 @@ function lt(t, e) {
|
|
|
822
852
|
/**
|
|
823
853
|
* The value returned from the most recent invocation of
|
|
824
854
|
* `generateUniqueDebugId()`, or null if it has never been invoked.
|
|
825
|
-
*/ let
|
|
855
|
+
*/ let dt = null;
|
|
826
856
|
|
|
827
857
|
/**
|
|
828
858
|
* Generates and returns an initial value for `lastUniqueDebugId`.
|
|
@@ -846,9 +876,9 @@ function lt(t, e) {
|
|
|
846
876
|
*
|
|
847
877
|
* @return the 10-character generated ID (e.g. "0xa1b2c3d4").
|
|
848
878
|
*/
|
|
849
|
-
function
|
|
850
|
-
return null ===
|
|
851
|
-
"0x" +
|
|
879
|
+
function wt() {
|
|
880
|
+
return null === dt ? dt = 268435456 + Math.round(2147483648 * Math.random()) : dt++,
|
|
881
|
+
"0x" + dt.toString(16);
|
|
852
882
|
}
|
|
853
883
|
|
|
854
884
|
/**
|
|
@@ -869,11 +899,11 @@ function dt() {
|
|
|
869
899
|
*/
|
|
870
900
|
/**
|
|
871
901
|
* Returns whether a variable is either undefined or null.
|
|
872
|
-
*/ function
|
|
902
|
+
*/ function mt(t) {
|
|
873
903
|
return null == t;
|
|
874
904
|
}
|
|
875
905
|
|
|
876
|
-
/** Returns whether the value represents -0. */ function
|
|
906
|
+
/** Returns whether the value represents -0. */ function pt(t) {
|
|
877
907
|
// Detect if the value is -0.0. Based on polyfill from
|
|
878
908
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
879
909
|
return 0 === t && 1 / t == -1 / 0;
|
|
@@ -899,7 +929,7 @@ function dt() {
|
|
|
899
929
|
* See the License for the specific language governing permissions and
|
|
900
930
|
* limitations under the License.
|
|
901
931
|
*/
|
|
902
|
-
const
|
|
932
|
+
const yt = {
|
|
903
933
|
BatchGetDocuments: "batchGet",
|
|
904
934
|
Commit: "commit",
|
|
905
935
|
RunQuery: "runQuery",
|
|
@@ -937,7 +967,7 @@ const pt = {
|
|
|
937
967
|
* are used for reverse lookups from the webchannel stream. Do NOT change the
|
|
938
968
|
* names of these identifiers or change this into a const enum.
|
|
939
969
|
*/
|
|
940
|
-
var
|
|
970
|
+
var gt, _t;
|
|
941
971
|
|
|
942
972
|
/**
|
|
943
973
|
* Converts an HTTP Status Code to the equivalent error code.
|
|
@@ -946,7 +976,7 @@ var yt, gt;
|
|
|
946
976
|
* @returns The equivalent Code. Unknown status codes are mapped to
|
|
947
977
|
* Code.UNKNOWN.
|
|
948
978
|
*/
|
|
949
|
-
function
|
|
979
|
+
function vt(t) {
|
|
950
980
|
if (void 0 === t) return v("RPC_ERROR", "HTTP error has no status"), V;
|
|
951
981
|
// The canonical error codes for Google APIs [1] specify mapping onto HTTP
|
|
952
982
|
// status codes but the mapping is not bijective. In each case of ambiguity
|
|
@@ -1039,16 +1069,16 @@ function _t(t) {
|
|
|
1039
1069
|
/**
|
|
1040
1070
|
* A Rest-based connection that relies on the native HTTP stack
|
|
1041
1071
|
* (e.g. `fetch` or a polyfill).
|
|
1042
|
-
*/ (
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1072
|
+
*/ (_t = gt || (gt = {}))[_t.OK = 0] = "OK", _t[_t.CANCELLED = 1] = "CANCELLED",
|
|
1073
|
+
_t[_t.UNKNOWN = 2] = "UNKNOWN", _t[_t.INVALID_ARGUMENT = 3] = "INVALID_ARGUMENT",
|
|
1074
|
+
_t[_t.DEADLINE_EXCEEDED = 4] = "DEADLINE_EXCEEDED", _t[_t.NOT_FOUND = 5] = "NOT_FOUND",
|
|
1075
|
+
_t[_t.ALREADY_EXISTS = 6] = "ALREADY_EXISTS", _t[_t.PERMISSION_DENIED = 7] = "PERMISSION_DENIED",
|
|
1076
|
+
_t[_t.UNAUTHENTICATED = 16] = "UNAUTHENTICATED", _t[_t.RESOURCE_EXHAUSTED = 8] = "RESOURCE_EXHAUSTED",
|
|
1077
|
+
_t[_t.FAILED_PRECONDITION = 9] = "FAILED_PRECONDITION", _t[_t.ABORTED = 10] = "ABORTED",
|
|
1078
|
+
_t[_t.OUT_OF_RANGE = 11] = "OUT_OF_RANGE", _t[_t.UNIMPLEMENTED = 12] = "UNIMPLEMENTED",
|
|
1079
|
+
_t[_t.INTERNAL = 13] = "INTERNAL", _t[_t.UNAVAILABLE = 14] = "UNAVAILABLE", _t[_t.DATA_LOSS = 15] = "DATA_LOSS";
|
|
1050
1080
|
|
|
1051
|
-
class
|
|
1081
|
+
class bt extends
|
|
1052
1082
|
/**
|
|
1053
1083
|
* Base class for all Rest-based connections to the backend (WebChannel and
|
|
1054
1084
|
* HTTP).
|
|
@@ -1065,7 +1095,7 @@ class {
|
|
|
1065
1095
|
return !1;
|
|
1066
1096
|
}
|
|
1067
1097
|
v(t, e, n, r, s) {
|
|
1068
|
-
const i =
|
|
1098
|
+
const i = wt(), o = this.I(t, e);
|
|
1069
1099
|
_("RestConnection", `Sending RPC '${t}' ${i}:`, o, n);
|
|
1070
1100
|
const u = {};
|
|
1071
1101
|
return this.A(u, r, s), this.T(t, o, u, n).then((e => (_("RestConnection", `Received RPC '${t}' ${i}: `, e),
|
|
@@ -1092,7 +1122,7 @@ class {
|
|
|
1092
1122
|
e && e.headers.forEach(((e, n) => t[n] = e)), n && n.headers.forEach(((e, n) => t[n] = e));
|
|
1093
1123
|
}
|
|
1094
1124
|
I(t, e) {
|
|
1095
|
-
const n =
|
|
1125
|
+
const n = yt[t];
|
|
1096
1126
|
return `${this.m}/v1/${e}:${n}`;
|
|
1097
1127
|
}
|
|
1098
1128
|
} {
|
|
@@ -1118,13 +1148,13 @@ class {
|
|
|
1118
1148
|
});
|
|
1119
1149
|
} catch (t) {
|
|
1120
1150
|
const e = t;
|
|
1121
|
-
throw new B(
|
|
1151
|
+
throw new B(vt(e.status), "Request failed with error: " + e.statusText);
|
|
1122
1152
|
}
|
|
1123
1153
|
if (!o.ok) {
|
|
1124
1154
|
let t = await o.json();
|
|
1125
1155
|
Array.isArray(t) && (t = t[0]);
|
|
1126
1156
|
const e = null === (s = null == t ? void 0 : t.error) || void 0 === s ? void 0 : s.message;
|
|
1127
|
-
throw new B(
|
|
1157
|
+
throw new B(vt(o.status), `Request failed with error: ${null != e ? e : o.statusText}`);
|
|
1128
1158
|
}
|
|
1129
1159
|
return o.json();
|
|
1130
1160
|
}
|
|
@@ -1166,7 +1196,7 @@ class {
|
|
|
1166
1196
|
/**
|
|
1167
1197
|
* Concrete implementation of the Aggregate type.
|
|
1168
1198
|
*/
|
|
1169
|
-
class
|
|
1199
|
+
class Et {
|
|
1170
1200
|
constructor(t, e, n) {
|
|
1171
1201
|
this.alias = t, this.$ = e, this.fieldPath = n;
|
|
1172
1202
|
}
|
|
@@ -1192,7 +1222,7 @@ class bt {
|
|
|
1192
1222
|
* Generates `nBytes` of random bytes.
|
|
1193
1223
|
*
|
|
1194
1224
|
* If `nBytes < 0` , an error will be thrown.
|
|
1195
|
-
*/ function
|
|
1225
|
+
*/ function It(t) {
|
|
1196
1226
|
// Polyfills for IE and WebWorker by using `self` and `msCrypto` when `crypto` is not available.
|
|
1197
1227
|
const e =
|
|
1198
1228
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -1218,14 +1248,14 @@ class bt {
|
|
|
1218
1248
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1219
1249
|
* See the License for the specific language governing permissions and
|
|
1220
1250
|
* limitations under the License.
|
|
1221
|
-
*/ class
|
|
1251
|
+
*/ class At {
|
|
1222
1252
|
static N() {
|
|
1223
1253
|
// Alphanumeric characters
|
|
1224
1254
|
const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", e = Math.floor(256 / t.length) * t.length;
|
|
1225
1255
|
// The largest byte value that is a multiple of `char.length`.
|
|
1226
1256
|
let n = "";
|
|
1227
1257
|
for (;n.length < 20; ) {
|
|
1228
|
-
const r =
|
|
1258
|
+
const r = It(40);
|
|
1229
1259
|
for (let s = 0; s < r.length; ++s)
|
|
1230
1260
|
// Only accept values that are [0, maxMultiple), this ensures they can
|
|
1231
1261
|
// be evenly mapped to indices of `chars` via a modulo operation.
|
|
@@ -1235,11 +1265,11 @@ class bt {
|
|
|
1235
1265
|
}
|
|
1236
1266
|
}
|
|
1237
1267
|
|
|
1238
|
-
function
|
|
1268
|
+
function Tt(t, e) {
|
|
1239
1269
|
return t < e ? -1 : t > e ? 1 : 0;
|
|
1240
1270
|
}
|
|
1241
1271
|
|
|
1242
|
-
/** Helper to compare arrays using isEqual(). */ function
|
|
1272
|
+
/** Helper to compare arrays using isEqual(). */ function Rt(t, e, n) {
|
|
1243
1273
|
return t.length === e.length && t.every(((t, r) => n(t, e[r])));
|
|
1244
1274
|
}
|
|
1245
1275
|
|
|
@@ -1258,13 +1288,13 @@ function At(t, e) {
|
|
|
1258
1288
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1259
1289
|
* See the License for the specific language governing permissions and
|
|
1260
1290
|
* limitations under the License.
|
|
1261
|
-
*/ function
|
|
1291
|
+
*/ function Pt(t) {
|
|
1262
1292
|
let e = 0;
|
|
1263
1293
|
for (const n in t) Object.prototype.hasOwnProperty.call(t, n) && e++;
|
|
1264
1294
|
return e;
|
|
1265
1295
|
}
|
|
1266
1296
|
|
|
1267
|
-
function
|
|
1297
|
+
function Vt(t, e) {
|
|
1268
1298
|
for (const n in t) Object.prototype.hasOwnProperty.call(t, n) && e(n, t[n]);
|
|
1269
1299
|
}
|
|
1270
1300
|
|
|
@@ -1287,7 +1317,7 @@ function Pt(t, e) {
|
|
|
1287
1317
|
/**
|
|
1288
1318
|
* An error encountered while decoding base64 string.
|
|
1289
1319
|
*/
|
|
1290
|
-
class
|
|
1320
|
+
class $t extends Error {
|
|
1291
1321
|
constructor() {
|
|
1292
1322
|
super(...arguments), this.name = "Base64DecodeError";
|
|
1293
1323
|
}
|
|
@@ -1312,7 +1342,7 @@ class Vt extends Error {
|
|
|
1312
1342
|
// WebSafe uses a different URL-encoding safe alphabet that doesn't match
|
|
1313
1343
|
// the encoding used on the backend.
|
|
1314
1344
|
/** Converts a Base64 encoded string to a binary string. */
|
|
1315
|
-
function
|
|
1345
|
+
function Nt(t) {
|
|
1316
1346
|
try {
|
|
1317
1347
|
return String.fromCharCode.apply(null,
|
|
1318
1348
|
// We use `decodeStringToByteArray()` instead of `decodeString()` since
|
|
@@ -1320,7 +1350,7 @@ function $t(t) {
|
|
|
1320
1350
|
// returned by `atob()`'s Latin1 representation.
|
|
1321
1351
|
a.decodeStringToByteArray(t, false));
|
|
1322
1352
|
} catch (t) {
|
|
1323
|
-
throw t instanceof h ? new
|
|
1353
|
+
throw t instanceof h ? new $t("Invalid base64 string: " + t) : t;
|
|
1324
1354
|
}
|
|
1325
1355
|
}
|
|
1326
1356
|
|
|
@@ -1350,13 +1380,13 @@ function $t(t) {
|
|
|
1350
1380
|
* before being sent as a proto.
|
|
1351
1381
|
* @internal
|
|
1352
1382
|
*/
|
|
1353
|
-
class
|
|
1383
|
+
class Dt {
|
|
1354
1384
|
constructor(t) {
|
|
1355
1385
|
this.binaryString = t;
|
|
1356
1386
|
}
|
|
1357
1387
|
static fromBase64String(t) {
|
|
1358
|
-
const e =
|
|
1359
|
-
return new
|
|
1388
|
+
const e = Nt(t);
|
|
1389
|
+
return new Dt(e);
|
|
1360
1390
|
}
|
|
1361
1391
|
static fromUint8Array(t) {
|
|
1362
1392
|
// TODO(indexing); Remove the copy of the byte string here as this method
|
|
@@ -1373,7 +1403,7 @@ class Nt {
|
|
|
1373
1403
|
/**
|
|
1374
1404
|
* Helper function to convert a binary string to an Uint8Array.
|
|
1375
1405
|
*/ (t);
|
|
1376
|
-
return new
|
|
1406
|
+
return new Dt(e);
|
|
1377
1407
|
}
|
|
1378
1408
|
[Symbol.iterator]() {
|
|
1379
1409
|
let t = 0;
|
|
@@ -1423,21 +1453,21 @@ class Nt {
|
|
|
1423
1453
|
return 2 * this.binaryString.length;
|
|
1424
1454
|
}
|
|
1425
1455
|
compareTo(t) {
|
|
1426
|
-
return
|
|
1456
|
+
return Tt(this.binaryString, t.binaryString);
|
|
1427
1457
|
}
|
|
1428
1458
|
isEqual(t) {
|
|
1429
1459
|
return this.binaryString === t.binaryString;
|
|
1430
1460
|
}
|
|
1431
1461
|
}
|
|
1432
1462
|
|
|
1433
|
-
|
|
1463
|
+
Dt.EMPTY_BYTE_STRING = new Dt("");
|
|
1434
1464
|
|
|
1435
|
-
const
|
|
1465
|
+
const Ft = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
1436
1466
|
|
|
1437
1467
|
/**
|
|
1438
1468
|
* Converts the possible Proto values for a timestamp value into a "seconds and
|
|
1439
1469
|
* nanos" representation.
|
|
1440
|
-
*/ function
|
|
1470
|
+
*/ function xt(t) {
|
|
1441
1471
|
// The json interface (for the browser) will return an iso timestamp string,
|
|
1442
1472
|
// while the proto js library (for node) will return a
|
|
1443
1473
|
// google.protobuf.Timestamp instance.
|
|
@@ -1446,7 +1476,7 @@ const Dt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1446
1476
|
// (millis), so we do some custom parsing here.
|
|
1447
1477
|
// Parse the nanos right out of the string.
|
|
1448
1478
|
let e = 0;
|
|
1449
|
-
const n =
|
|
1479
|
+
const n = Ft.exec(t);
|
|
1450
1480
|
if (A(!!n), n[1]) {
|
|
1451
1481
|
// Pad the fraction out to 9 digits (nanos).
|
|
1452
1482
|
let t = n[1];
|
|
@@ -1460,21 +1490,21 @@ const Dt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1460
1490
|
};
|
|
1461
1491
|
}
|
|
1462
1492
|
return {
|
|
1463
|
-
seconds:
|
|
1464
|
-
nanos:
|
|
1493
|
+
seconds: St(t.seconds),
|
|
1494
|
+
nanos: St(t.nanos)
|
|
1465
1495
|
};
|
|
1466
1496
|
}
|
|
1467
1497
|
|
|
1468
1498
|
/**
|
|
1469
1499
|
* Converts the possible Proto types for numbers into a JavaScript number.
|
|
1470
1500
|
* Returns 0 if the value is not numeric.
|
|
1471
|
-
*/ function
|
|
1501
|
+
*/ function St(t) {
|
|
1472
1502
|
// TODO(bjornick): Handle int64 greater than 53 bits.
|
|
1473
1503
|
return "number" == typeof t ? t : "string" == typeof t ? Number(t) : 0;
|
|
1474
1504
|
}
|
|
1475
1505
|
|
|
1476
|
-
/** Converts the possible Proto types for Blobs into a ByteString. */ function
|
|
1477
|
-
return "string" == typeof t ?
|
|
1506
|
+
/** Converts the possible Proto types for Blobs into a ByteString. */ function qt(t) {
|
|
1507
|
+
return "string" == typeof t ? Dt.fromBase64String(t) : Dt.fromUint8Array(t);
|
|
1478
1508
|
}
|
|
1479
1509
|
|
|
1480
1510
|
/**
|
|
@@ -1508,7 +1538,7 @@ const Dt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1508
1538
|
* For examples and further specifications, refer to the
|
|
1509
1539
|
* {@link https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto | Timestamp definition}.
|
|
1510
1540
|
*/
|
|
1511
|
-
class
|
|
1541
|
+
class Ot {
|
|
1512
1542
|
/**
|
|
1513
1543
|
* Creates a new timestamp.
|
|
1514
1544
|
*
|
|
@@ -1540,7 +1570,7 @@ class qt {
|
|
|
1540
1570
|
*
|
|
1541
1571
|
* @returns a new timestamp representing the current date.
|
|
1542
1572
|
*/ static now() {
|
|
1543
|
-
return
|
|
1573
|
+
return Ot.fromMillis(Date.now());
|
|
1544
1574
|
}
|
|
1545
1575
|
/**
|
|
1546
1576
|
* Creates a new timestamp from the given date.
|
|
@@ -1549,7 +1579,7 @@ class qt {
|
|
|
1549
1579
|
* @returns A new `Timestamp` representing the same point in time as the given
|
|
1550
1580
|
* date.
|
|
1551
1581
|
*/ static fromDate(t) {
|
|
1552
|
-
return
|
|
1582
|
+
return Ot.fromMillis(t.getTime());
|
|
1553
1583
|
}
|
|
1554
1584
|
/**
|
|
1555
1585
|
* Creates a new timestamp from the given number of milliseconds.
|
|
@@ -1560,7 +1590,7 @@ class qt {
|
|
|
1560
1590
|
* number of milliseconds.
|
|
1561
1591
|
*/ static fromMillis(t) {
|
|
1562
1592
|
const e = Math.floor(t / 1e3), n = Math.floor(1e6 * (t - 1e3 * e));
|
|
1563
|
-
return new
|
|
1593
|
+
return new Ot(e, n);
|
|
1564
1594
|
}
|
|
1565
1595
|
/**
|
|
1566
1596
|
* Converts a `Timestamp` to a JavaScript `Date` object. This conversion
|
|
@@ -1582,7 +1612,7 @@ class qt {
|
|
|
1582
1612
|
return 1e3 * this.seconds + this.nanoseconds / 1e6;
|
|
1583
1613
|
}
|
|
1584
1614
|
_compareTo(t) {
|
|
1585
|
-
return this.seconds === t.seconds ?
|
|
1615
|
+
return this.seconds === t.seconds ? Tt(this.nanoseconds, t.nanoseconds) : Tt(this.seconds, t.seconds);
|
|
1586
1616
|
}
|
|
1587
1617
|
/**
|
|
1588
1618
|
* Returns true if this `Timestamp` is equal to the provided one.
|
|
@@ -1652,7 +1682,7 @@ class qt {
|
|
|
1652
1682
|
* FieldValueOptions to value().
|
|
1653
1683
|
* - With respect to other ServerTimestampValues, they sort by their
|
|
1654
1684
|
* localWriteTime.
|
|
1655
|
-
*/ function
|
|
1685
|
+
*/ function kt(t) {
|
|
1656
1686
|
var e, n;
|
|
1657
1687
|
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);
|
|
1658
1688
|
}
|
|
@@ -1662,16 +1692,16 @@ class qt {
|
|
|
1662
1692
|
*
|
|
1663
1693
|
* Preserving the previous values allows the user to display the last resoled
|
|
1664
1694
|
* value until the backend responds with the timestamp.
|
|
1665
|
-
*/ function
|
|
1695
|
+
*/ function Ct(t) {
|
|
1666
1696
|
const e = t.mapValue.fields.__previous_value__;
|
|
1667
|
-
return
|
|
1697
|
+
return kt(e) ? Ct(e) : e;
|
|
1668
1698
|
}
|
|
1669
1699
|
|
|
1670
1700
|
/**
|
|
1671
1701
|
* Returns the local time at which this timestamp was first set.
|
|
1672
|
-
*/ function
|
|
1673
|
-
const e =
|
|
1674
|
-
return new
|
|
1702
|
+
*/ function Mt(t) {
|
|
1703
|
+
const e = xt(t.mapValue.fields.__local_write_time__.timestampValue);
|
|
1704
|
+
return new Ot(e.seconds, e.nanos);
|
|
1675
1705
|
}
|
|
1676
1706
|
|
|
1677
1707
|
/**
|
|
@@ -1689,7 +1719,7 @@ class qt {
|
|
|
1689
1719
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1690
1720
|
* See the License for the specific language governing permissions and
|
|
1691
1721
|
* limitations under the License.
|
|
1692
|
-
*/ const
|
|
1722
|
+
*/ const Lt = {
|
|
1693
1723
|
fields: {
|
|
1694
1724
|
__type__: {
|
|
1695
1725
|
stringValue: "__max__"
|
|
@@ -1698,8 +1728,8 @@ class qt {
|
|
|
1698
1728
|
};
|
|
1699
1729
|
|
|
1700
1730
|
/** Extracts the backend's type order for the provided value. */
|
|
1701
|
-
function
|
|
1702
|
-
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 ?
|
|
1731
|
+
function jt(t) {
|
|
1732
|
+
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 ? kt(t) ? 4 /* TypeOrder.ServerTimestampValue */ :
|
|
1703
1733
|
/** Returns true if the Value represents the canonical {@link #MAX_VALUE} . */
|
|
1704
1734
|
function(t) {
|
|
1705
1735
|
return "__max__" === (((t.mapValue || {}).fields || {}).__type__ || {}).stringValue;
|
|
@@ -1736,10 +1766,10 @@ function Lt(t) {
|
|
|
1736
1766
|
*/ (t) ? 9007199254740991 /* TypeOrder.MaxValue */ : 10 /* TypeOrder.ObjectValue */ : I();
|
|
1737
1767
|
}
|
|
1738
1768
|
|
|
1739
|
-
/** Tests `left` and `right` for equality based on the backend semantics. */ function
|
|
1769
|
+
/** Tests `left` and `right` for equality based on the backend semantics. */ function Ut(t, e) {
|
|
1740
1770
|
if (t === e) return !0;
|
|
1741
|
-
const n =
|
|
1742
|
-
if (n !==
|
|
1771
|
+
const n = jt(t);
|
|
1772
|
+
if (n !== jt(e)) return !1;
|
|
1743
1773
|
switch (n) {
|
|
1744
1774
|
case 0 /* TypeOrder.NullValue */ :
|
|
1745
1775
|
case 9007199254740991 /* TypeOrder.MaxValue */ :
|
|
@@ -1749,14 +1779,14 @@ function Lt(t) {
|
|
|
1749
1779
|
return t.booleanValue === e.booleanValue;
|
|
1750
1780
|
|
|
1751
1781
|
case 4 /* TypeOrder.ServerTimestampValue */ :
|
|
1752
|
-
return
|
|
1782
|
+
return Mt(t).isEqual(Mt(e));
|
|
1753
1783
|
|
|
1754
1784
|
case 3 /* TypeOrder.TimestampValue */ :
|
|
1755
1785
|
return function(t, e) {
|
|
1756
1786
|
if ("string" == typeof t.timestampValue && "string" == typeof e.timestampValue && t.timestampValue.length === e.timestampValue.length)
|
|
1757
1787
|
// Use string equality for ISO 8601 timestamps
|
|
1758
1788
|
return t.timestampValue === e.timestampValue;
|
|
1759
|
-
const n =
|
|
1789
|
+
const n = xt(t.timestampValue), r = xt(e.timestampValue);
|
|
1760
1790
|
return n.seconds === r.seconds && n.nanos === r.nanos;
|
|
1761
1791
|
}(t, e);
|
|
1762
1792
|
|
|
@@ -1765,7 +1795,7 @@ function Lt(t) {
|
|
|
1765
1795
|
|
|
1766
1796
|
case 6 /* TypeOrder.BlobValue */ :
|
|
1767
1797
|
return function(t, e) {
|
|
1768
|
-
return
|
|
1798
|
+
return qt(t.bytesValue).isEqual(qt(e.bytesValue));
|
|
1769
1799
|
}(t, e);
|
|
1770
1800
|
|
|
1771
1801
|
case 7 /* TypeOrder.RefValue */ :
|
|
@@ -1773,27 +1803,27 @@ function Lt(t) {
|
|
|
1773
1803
|
|
|
1774
1804
|
case 8 /* TypeOrder.GeoPointValue */ :
|
|
1775
1805
|
return function(t, e) {
|
|
1776
|
-
return
|
|
1806
|
+
return St(t.geoPointValue.latitude) === St(e.geoPointValue.latitude) && St(t.geoPointValue.longitude) === St(e.geoPointValue.longitude);
|
|
1777
1807
|
}(t, e);
|
|
1778
1808
|
|
|
1779
1809
|
case 2 /* TypeOrder.NumberValue */ :
|
|
1780
1810
|
return function(t, e) {
|
|
1781
|
-
if ("integerValue" in t && "integerValue" in e) return
|
|
1811
|
+
if ("integerValue" in t && "integerValue" in e) return St(t.integerValue) === St(e.integerValue);
|
|
1782
1812
|
if ("doubleValue" in t && "doubleValue" in e) {
|
|
1783
|
-
const n =
|
|
1784
|
-
return n === r ?
|
|
1813
|
+
const n = St(t.doubleValue), r = St(e.doubleValue);
|
|
1814
|
+
return n === r ? pt(n) === pt(r) : isNaN(n) && isNaN(r);
|
|
1785
1815
|
}
|
|
1786
1816
|
return !1;
|
|
1787
1817
|
}(t, e);
|
|
1788
1818
|
|
|
1789
1819
|
case 9 /* TypeOrder.ArrayValue */ :
|
|
1790
|
-
return
|
|
1820
|
+
return Rt(t.arrayValue.values || [], e.arrayValue.values || [], Ut);
|
|
1791
1821
|
|
|
1792
1822
|
case 10 /* TypeOrder.ObjectValue */ :
|
|
1793
1823
|
return function(t, e) {
|
|
1794
1824
|
const n = t.mapValue.fields || {}, r = e.mapValue.fields || {};
|
|
1795
|
-
if (
|
|
1796
|
-
for (const t in n) if (n.hasOwnProperty(t) && (void 0 === r[t] || !
|
|
1825
|
+
if (Pt(n) !== Pt(r)) return !1;
|
|
1826
|
+
for (const t in n) if (n.hasOwnProperty(t) && (void 0 === r[t] || !Ut(n[t], r[t]))) return !1;
|
|
1797
1827
|
return !0;
|
|
1798
1828
|
}
|
|
1799
1829
|
/** Returns true if the ArrayValue contains the specified element. */ (t, e);
|
|
@@ -1803,42 +1833,42 @@ function Lt(t) {
|
|
|
1803
1833
|
}
|
|
1804
1834
|
}
|
|
1805
1835
|
|
|
1806
|
-
function
|
|
1807
|
-
return void 0 !== (t.values || []).find((t =>
|
|
1836
|
+
function Bt(t, e) {
|
|
1837
|
+
return void 0 !== (t.values || []).find((t => Ut(t, e)));
|
|
1808
1838
|
}
|
|
1809
1839
|
|
|
1810
|
-
function
|
|
1840
|
+
function Qt(t, e) {
|
|
1811
1841
|
if (t === e) return 0;
|
|
1812
|
-
const n =
|
|
1813
|
-
if (n !== r) return
|
|
1842
|
+
const n = jt(t), r = jt(e);
|
|
1843
|
+
if (n !== r) return Tt(n, r);
|
|
1814
1844
|
switch (n) {
|
|
1815
1845
|
case 0 /* TypeOrder.NullValue */ :
|
|
1816
1846
|
case 9007199254740991 /* TypeOrder.MaxValue */ :
|
|
1817
1847
|
return 0;
|
|
1818
1848
|
|
|
1819
1849
|
case 1 /* TypeOrder.BooleanValue */ :
|
|
1820
|
-
return
|
|
1850
|
+
return Tt(t.booleanValue, e.booleanValue);
|
|
1821
1851
|
|
|
1822
1852
|
case 2 /* TypeOrder.NumberValue */ :
|
|
1823
1853
|
return function(t, e) {
|
|
1824
|
-
const n =
|
|
1854
|
+
const n = St(t.integerValue || t.doubleValue), r = St(e.integerValue || e.doubleValue);
|
|
1825
1855
|
return n < r ? -1 : n > r ? 1 : n === r ? 0 :
|
|
1826
1856
|
// one or both are NaN.
|
|
1827
1857
|
isNaN(n) ? isNaN(r) ? 0 : -1 : 1;
|
|
1828
1858
|
}(t, e);
|
|
1829
1859
|
|
|
1830
1860
|
case 3 /* TypeOrder.TimestampValue */ :
|
|
1831
|
-
return
|
|
1861
|
+
return zt(t.timestampValue, e.timestampValue);
|
|
1832
1862
|
|
|
1833
1863
|
case 4 /* TypeOrder.ServerTimestampValue */ :
|
|
1834
|
-
return
|
|
1864
|
+
return zt(Mt(t), Mt(e));
|
|
1835
1865
|
|
|
1836
1866
|
case 5 /* TypeOrder.StringValue */ :
|
|
1837
|
-
return
|
|
1867
|
+
return Tt(t.stringValue, e.stringValue);
|
|
1838
1868
|
|
|
1839
1869
|
case 6 /* TypeOrder.BlobValue */ :
|
|
1840
1870
|
return function(t, e) {
|
|
1841
|
-
const n =
|
|
1871
|
+
const n = qt(t), r = qt(e);
|
|
1842
1872
|
return n.compareTo(r);
|
|
1843
1873
|
}(t.bytesValue, e.bytesValue);
|
|
1844
1874
|
|
|
@@ -1846,34 +1876,34 @@ function Bt(t, e) {
|
|
|
1846
1876
|
return function(t, e) {
|
|
1847
1877
|
const n = t.split("/"), r = e.split("/");
|
|
1848
1878
|
for (let t = 0; t < n.length && t < r.length; t++) {
|
|
1849
|
-
const e =
|
|
1879
|
+
const e = Tt(n[t], r[t]);
|
|
1850
1880
|
if (0 !== e) return e;
|
|
1851
1881
|
}
|
|
1852
|
-
return
|
|
1882
|
+
return Tt(n.length, r.length);
|
|
1853
1883
|
}(t.referenceValue, e.referenceValue);
|
|
1854
1884
|
|
|
1855
1885
|
case 8 /* TypeOrder.GeoPointValue */ :
|
|
1856
1886
|
return function(t, e) {
|
|
1857
|
-
const n =
|
|
1887
|
+
const n = Tt(St(t.latitude), St(e.latitude));
|
|
1858
1888
|
if (0 !== n) return n;
|
|
1859
|
-
return
|
|
1889
|
+
return Tt(St(t.longitude), St(e.longitude));
|
|
1860
1890
|
}(t.geoPointValue, e.geoPointValue);
|
|
1861
1891
|
|
|
1862
1892
|
case 9 /* TypeOrder.ArrayValue */ :
|
|
1863
1893
|
return function(t, e) {
|
|
1864
1894
|
const n = t.values || [], r = e.values || [];
|
|
1865
1895
|
for (let t = 0; t < n.length && t < r.length; ++t) {
|
|
1866
|
-
const e =
|
|
1896
|
+
const e = Qt(n[t], r[t]);
|
|
1867
1897
|
if (e) return e;
|
|
1868
1898
|
}
|
|
1869
|
-
return
|
|
1899
|
+
return Tt(n.length, r.length);
|
|
1870
1900
|
}(t.arrayValue, e.arrayValue);
|
|
1871
1901
|
|
|
1872
1902
|
case 10 /* TypeOrder.ObjectValue */ :
|
|
1873
1903
|
return function(t, e) {
|
|
1874
|
-
if (t ===
|
|
1875
|
-
if (t ===
|
|
1876
|
-
if (e ===
|
|
1904
|
+
if (t === Lt && e === Lt) return 0;
|
|
1905
|
+
if (t === Lt) return 1;
|
|
1906
|
+
if (e === Lt) return -1;
|
|
1877
1907
|
const n = t.fields || {}, r = Object.keys(n), s = e.fields || {}, i = Object.keys(s);
|
|
1878
1908
|
// Even though MapValues are likely sorted correctly based on their insertion
|
|
1879
1909
|
// order (e.g. when received from the backend), local modifications can bring
|
|
@@ -1881,12 +1911,12 @@ function Bt(t, e) {
|
|
|
1881
1911
|
// canonical IDs are independent of insertion order.
|
|
1882
1912
|
r.sort(), i.sort();
|
|
1883
1913
|
for (let t = 0; t < r.length && t < i.length; ++t) {
|
|
1884
|
-
const e =
|
|
1914
|
+
const e = Tt(r[t], i[t]);
|
|
1885
1915
|
if (0 !== e) return e;
|
|
1886
|
-
const o =
|
|
1916
|
+
const o = Qt(n[r[t]], s[i[t]]);
|
|
1887
1917
|
if (0 !== o) return o;
|
|
1888
1918
|
}
|
|
1889
|
-
return
|
|
1919
|
+
return Tt(r.length, i.length);
|
|
1890
1920
|
}
|
|
1891
1921
|
/** Returns a reference value for the provided database and key. */ (t.mapValue, e.mapValue);
|
|
1892
1922
|
|
|
@@ -1895,35 +1925,35 @@ function Bt(t, e) {
|
|
|
1895
1925
|
}
|
|
1896
1926
|
}
|
|
1897
1927
|
|
|
1898
|
-
function
|
|
1899
|
-
if ("string" == typeof t && "string" == typeof e && t.length === e.length) return
|
|
1900
|
-
const n =
|
|
1901
|
-
return 0 !== s ? s :
|
|
1928
|
+
function zt(t, e) {
|
|
1929
|
+
if ("string" == typeof t && "string" == typeof e && t.length === e.length) return Tt(t, e);
|
|
1930
|
+
const n = xt(t), r = xt(e), s = Tt(n.seconds, r.seconds);
|
|
1931
|
+
return 0 !== s ? s : Tt(n.nanos, r.nanos);
|
|
1902
1932
|
}
|
|
1903
1933
|
|
|
1904
|
-
function
|
|
1934
|
+
function Wt(t, e) {
|
|
1905
1935
|
return {
|
|
1906
1936
|
referenceValue: `projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`
|
|
1907
1937
|
};
|
|
1908
1938
|
}
|
|
1909
1939
|
|
|
1910
|
-
/** Returns true if `value` is an ArrayValue. */ function
|
|
1940
|
+
/** Returns true if `value` is an ArrayValue. */ function Gt(t) {
|
|
1911
1941
|
return !!t && "arrayValue" in t;
|
|
1912
1942
|
}
|
|
1913
1943
|
|
|
1914
|
-
/** Returns true if `value` is a NullValue. */ function
|
|
1944
|
+
/** Returns true if `value` is a NullValue. */ function Kt(t) {
|
|
1915
1945
|
return !!t && "nullValue" in t;
|
|
1916
1946
|
}
|
|
1917
1947
|
|
|
1918
|
-
/** Returns true if `value` is NaN. */ function
|
|
1948
|
+
/** Returns true if `value` is NaN. */ function Yt(t) {
|
|
1919
1949
|
return !!t && "doubleValue" in t && isNaN(Number(t.doubleValue));
|
|
1920
1950
|
}
|
|
1921
1951
|
|
|
1922
|
-
/** Returns true if `value` is a MapValue. */ function
|
|
1952
|
+
/** Returns true if `value` is a MapValue. */ function Ht(t) {
|
|
1923
1953
|
return !!t && "mapValue" in t;
|
|
1924
1954
|
}
|
|
1925
1955
|
|
|
1926
|
-
/** Creates a deep copy of `source`. */ function
|
|
1956
|
+
/** Creates a deep copy of `source`. */ function Jt(t) {
|
|
1927
1957
|
if (t.geoPointValue) return {
|
|
1928
1958
|
geoPointValue: Object.assign({}, t.geoPointValue)
|
|
1929
1959
|
};
|
|
@@ -1936,7 +1966,7 @@ function zt(t, e) {
|
|
|
1936
1966
|
fields: {}
|
|
1937
1967
|
}
|
|
1938
1968
|
};
|
|
1939
|
-
return
|
|
1969
|
+
return Vt(t.mapValue.fields, ((t, n) => e.mapValue.fields[t] = Jt(n))), e;
|
|
1940
1970
|
}
|
|
1941
1971
|
if (t.arrayValue) {
|
|
1942
1972
|
const e = {
|
|
@@ -1944,24 +1974,24 @@ function zt(t, e) {
|
|
|
1944
1974
|
values: []
|
|
1945
1975
|
}
|
|
1946
1976
|
};
|
|
1947
|
-
for (let n = 0; n < (t.arrayValue.values || []).length; ++n) e.arrayValue.values[n] =
|
|
1977
|
+
for (let n = 0; n < (t.arrayValue.values || []).length; ++n) e.arrayValue.values[n] = Jt(t.arrayValue.values[n]);
|
|
1948
1978
|
return e;
|
|
1949
1979
|
}
|
|
1950
1980
|
return Object.assign({}, t);
|
|
1951
1981
|
}
|
|
1952
1982
|
|
|
1953
|
-
class
|
|
1983
|
+
class Xt {
|
|
1954
1984
|
constructor(t, e) {
|
|
1955
1985
|
this.position = t, this.inclusive = e;
|
|
1956
1986
|
}
|
|
1957
1987
|
}
|
|
1958
1988
|
|
|
1959
|
-
function
|
|
1989
|
+
function Zt(t, e) {
|
|
1960
1990
|
if (null === t) return null === e;
|
|
1961
1991
|
if (null === e) return !1;
|
|
1962
1992
|
if (t.inclusive !== e.inclusive || t.position.length !== e.position.length) return !1;
|
|
1963
1993
|
for (let n = 0; n < t.position.length; n++) {
|
|
1964
|
-
if (!
|
|
1994
|
+
if (!Ut(t.position[n], e.position[n])) return !1;
|
|
1965
1995
|
}
|
|
1966
1996
|
return !0;
|
|
1967
1997
|
}
|
|
@@ -1981,24 +2011,24 @@ function Xt(t, e) {
|
|
|
1981
2011
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1982
2012
|
* See the License for the specific language governing permissions and
|
|
1983
2013
|
* limitations under the License.
|
|
1984
|
-
*/ class
|
|
2014
|
+
*/ class te {}
|
|
1985
2015
|
|
|
1986
|
-
class
|
|
2016
|
+
class ee extends te {
|
|
1987
2017
|
constructor(t, e, n) {
|
|
1988
2018
|
super(), this.field = t, this.op = e, this.value = n;
|
|
1989
2019
|
}
|
|
1990
2020
|
/**
|
|
1991
2021
|
* Creates a filter based on the provided arguments.
|
|
1992
2022
|
*/ static create(t, e, n) {
|
|
1993
|
-
return t.isKeyField() ? "in" /* Operator.IN */ === e || "not-in" /* Operator.NOT_IN */ === e ? this.createKeyFieldInFilter(t, e, n) : new
|
|
2023
|
+
return t.isKeyField() ? "in" /* Operator.IN */ === e || "not-in" /* Operator.NOT_IN */ === e ? this.createKeyFieldInFilter(t, e, n) : new se(t, e, n) : "array-contains" /* Operator.ARRAY_CONTAINS */ === e ? new ce(t, n) : "in" /* Operator.IN */ === e ? new ae(t, n) : "not-in" /* Operator.NOT_IN */ === e ? new he(t, n) : "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ === e ? new le(t, n) : new ee(t, e, n);
|
|
1994
2024
|
}
|
|
1995
2025
|
static createKeyFieldInFilter(t, e, n) {
|
|
1996
|
-
return "in" /* Operator.IN */ === e ? new
|
|
2026
|
+
return "in" /* Operator.IN */ === e ? new ie(t, n) : new oe(t, n);
|
|
1997
2027
|
}
|
|
1998
2028
|
matches(t) {
|
|
1999
2029
|
const e = t.data.field(this.field);
|
|
2000
2030
|
// Types do not have to match in NOT_EQUAL filters.
|
|
2001
|
-
return "!=" /* Operator.NOT_EQUAL */ === this.op ? null !== e && this.matchesComparison(
|
|
2031
|
+
return "!=" /* Operator.NOT_EQUAL */ === this.op ? null !== e && this.matchesComparison(Qt(e, this.value)) : null !== e && jt(this.value) === jt(e) && this.matchesComparison(Qt(e, this.value));
|
|
2002
2032
|
// Only compare types with matching backend order (such as double and int).
|
|
2003
2033
|
}
|
|
2004
2034
|
matchesComparison(t) {
|
|
@@ -2039,14 +2069,14 @@ class te extends Zt {
|
|
|
2039
2069
|
}
|
|
2040
2070
|
}
|
|
2041
2071
|
|
|
2042
|
-
class
|
|
2072
|
+
class ne extends te {
|
|
2043
2073
|
constructor(t, e) {
|
|
2044
2074
|
super(), this.filters = t, this.op = e, this.D = null;
|
|
2045
2075
|
}
|
|
2046
2076
|
/**
|
|
2047
2077
|
* Creates a filter based on the provided arguments.
|
|
2048
2078
|
*/ static create(t, e) {
|
|
2049
|
-
return new
|
|
2079
|
+
return new ne(t, e);
|
|
2050
2080
|
}
|
|
2051
2081
|
matches(t) {
|
|
2052
2082
|
return "and" /* CompositeOperator.AND */ === this.op ? void 0 === this.filters.find((e => !e.matches(t))) : void 0 !== this.filters.find((e => e.matches(t)));
|
|
@@ -2072,19 +2102,19 @@ class ee extends Zt {
|
|
|
2072
2102
|
}
|
|
2073
2103
|
}
|
|
2074
2104
|
|
|
2075
|
-
function
|
|
2076
|
-
return t instanceof
|
|
2077
|
-
return e instanceof
|
|
2078
|
-
}(t, e) : t instanceof
|
|
2079
|
-
if (e instanceof
|
|
2080
|
-
return t.filters.reduce(((t, n, r) => t &&
|
|
2105
|
+
function re(t, e) {
|
|
2106
|
+
return t instanceof ee ? function(t, e) {
|
|
2107
|
+
return e instanceof ee && t.op === e.op && t.field.isEqual(e.field) && Ut(t.value, e.value);
|
|
2108
|
+
}(t, e) : t instanceof ne ? function(t, e) {
|
|
2109
|
+
if (e instanceof ne && t.op === e.op && t.filters.length === e.filters.length) {
|
|
2110
|
+
return t.filters.reduce(((t, n, r) => t && re(n, e.filters[r])), !0);
|
|
2081
2111
|
}
|
|
2082
2112
|
return !1;
|
|
2083
2113
|
}
|
|
2084
2114
|
/** Filter that matches on key fields (i.e. '__name__'). */ (t, e) : void I();
|
|
2085
2115
|
}
|
|
2086
2116
|
|
|
2087
|
-
class
|
|
2117
|
+
class se extends ee {
|
|
2088
2118
|
constructor(t, e, n) {
|
|
2089
2119
|
super(t, e, n), this.key = it.fromName(n.referenceValue);
|
|
2090
2120
|
}
|
|
@@ -2094,69 +2124,69 @@ class re extends te {
|
|
|
2094
2124
|
}
|
|
2095
2125
|
}
|
|
2096
2126
|
|
|
2097
|
-
/** Filter that matches on key fields within an array. */ class
|
|
2127
|
+
/** Filter that matches on key fields within an array. */ class ie extends ee {
|
|
2098
2128
|
constructor(t, e) {
|
|
2099
|
-
super(t, "in" /* Operator.IN */ , e), this.keys =
|
|
2129
|
+
super(t, "in" /* Operator.IN */ , e), this.keys = ue("in" /* Operator.IN */ , e);
|
|
2100
2130
|
}
|
|
2101
2131
|
matches(t) {
|
|
2102
2132
|
return this.keys.some((e => e.isEqual(t.key)));
|
|
2103
2133
|
}
|
|
2104
2134
|
}
|
|
2105
2135
|
|
|
2106
|
-
/** Filter that matches on key fields not present within an array. */ class
|
|
2136
|
+
/** Filter that matches on key fields not present within an array. */ class oe extends ee {
|
|
2107
2137
|
constructor(t, e) {
|
|
2108
|
-
super(t, "not-in" /* Operator.NOT_IN */ , e), this.keys =
|
|
2138
|
+
super(t, "not-in" /* Operator.NOT_IN */ , e), this.keys = ue("not-in" /* Operator.NOT_IN */ , e);
|
|
2109
2139
|
}
|
|
2110
2140
|
matches(t) {
|
|
2111
2141
|
return !this.keys.some((e => e.isEqual(t.key)));
|
|
2112
2142
|
}
|
|
2113
2143
|
}
|
|
2114
2144
|
|
|
2115
|
-
function
|
|
2145
|
+
function ue(t, e) {
|
|
2116
2146
|
var n;
|
|
2117
2147
|
return ((null === (n = e.arrayValue) || void 0 === n ? void 0 : n.values) || []).map((t => it.fromName(t.referenceValue)));
|
|
2118
2148
|
}
|
|
2119
2149
|
|
|
2120
|
-
/** A Filter that implements the array-contains operator. */ class
|
|
2150
|
+
/** A Filter that implements the array-contains operator. */ class ce extends ee {
|
|
2121
2151
|
constructor(t, e) {
|
|
2122
2152
|
super(t, "array-contains" /* Operator.ARRAY_CONTAINS */ , e);
|
|
2123
2153
|
}
|
|
2124
2154
|
matches(t) {
|
|
2125
2155
|
const e = t.data.field(this.field);
|
|
2126
|
-
return
|
|
2156
|
+
return Gt(e) && Bt(e.arrayValue, this.value);
|
|
2127
2157
|
}
|
|
2128
2158
|
}
|
|
2129
2159
|
|
|
2130
|
-
/** A Filter that implements the IN operator. */ class
|
|
2160
|
+
/** A Filter that implements the IN operator. */ class ae extends ee {
|
|
2131
2161
|
constructor(t, e) {
|
|
2132
2162
|
super(t, "in" /* Operator.IN */ , e);
|
|
2133
2163
|
}
|
|
2134
2164
|
matches(t) {
|
|
2135
2165
|
const e = t.data.field(this.field);
|
|
2136
|
-
return null !== e &&
|
|
2166
|
+
return null !== e && Bt(this.value.arrayValue, e);
|
|
2137
2167
|
}
|
|
2138
2168
|
}
|
|
2139
2169
|
|
|
2140
|
-
/** A Filter that implements the not-in operator. */ class
|
|
2170
|
+
/** A Filter that implements the not-in operator. */ class he extends ee {
|
|
2141
2171
|
constructor(t, e) {
|
|
2142
2172
|
super(t, "not-in" /* Operator.NOT_IN */ , e);
|
|
2143
2173
|
}
|
|
2144
2174
|
matches(t) {
|
|
2145
|
-
if (
|
|
2175
|
+
if (Bt(this.value.arrayValue, {
|
|
2146
2176
|
nullValue: "NULL_VALUE"
|
|
2147
2177
|
})) return !1;
|
|
2148
2178
|
const e = t.data.field(this.field);
|
|
2149
|
-
return null !== e && !
|
|
2179
|
+
return null !== e && !Bt(this.value.arrayValue, e);
|
|
2150
2180
|
}
|
|
2151
2181
|
}
|
|
2152
2182
|
|
|
2153
|
-
/** A Filter that implements the array-contains-any operator. */ class
|
|
2183
|
+
/** A Filter that implements the array-contains-any operator. */ class le extends ee {
|
|
2154
2184
|
constructor(t, e) {
|
|
2155
2185
|
super(t, "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ , e);
|
|
2156
2186
|
}
|
|
2157
2187
|
matches(t) {
|
|
2158
2188
|
const e = t.data.field(this.field);
|
|
2159
|
-
return !(!
|
|
2189
|
+
return !(!Gt(e) || !e.arrayValue.values) && e.arrayValue.values.some((t => Bt(this.value.arrayValue, t)));
|
|
2160
2190
|
}
|
|
2161
2191
|
}
|
|
2162
2192
|
|
|
@@ -2178,13 +2208,13 @@ function oe(t, e) {
|
|
|
2178
2208
|
*/
|
|
2179
2209
|
/**
|
|
2180
2210
|
* An ordering on a field, in some Direction. Direction defaults to ASCENDING.
|
|
2181
|
-
*/ class
|
|
2211
|
+
*/ class fe {
|
|
2182
2212
|
constructor(t, e = "asc" /* Direction.ASCENDING */) {
|
|
2183
2213
|
this.field = t, this.dir = e;
|
|
2184
2214
|
}
|
|
2185
2215
|
}
|
|
2186
2216
|
|
|
2187
|
-
function
|
|
2217
|
+
function de(t, e) {
|
|
2188
2218
|
return t.dir === e.dir && t.field.isEqual(e.field);
|
|
2189
2219
|
}
|
|
2190
2220
|
|
|
@@ -2207,18 +2237,18 @@ function fe(t, e) {
|
|
|
2207
2237
|
/**
|
|
2208
2238
|
* A version of a document in Firestore. This corresponds to the version
|
|
2209
2239
|
* timestamp, such as update_time or read_time.
|
|
2210
|
-
*/ class
|
|
2240
|
+
*/ class we {
|
|
2211
2241
|
constructor(t) {
|
|
2212
2242
|
this.timestamp = t;
|
|
2213
2243
|
}
|
|
2214
2244
|
static fromTimestamp(t) {
|
|
2215
|
-
return new
|
|
2245
|
+
return new we(t);
|
|
2216
2246
|
}
|
|
2217
2247
|
static min() {
|
|
2218
|
-
return new
|
|
2248
|
+
return new we(new Ot(0, 0));
|
|
2219
2249
|
}
|
|
2220
2250
|
static max() {
|
|
2221
|
-
return new
|
|
2251
|
+
return new we(new Ot(253402300799, 999999999));
|
|
2222
2252
|
}
|
|
2223
2253
|
compareTo(t) {
|
|
2224
2254
|
return this.timestamp._compareTo(t.timestamp);
|
|
@@ -2256,17 +2286,17 @@ function fe(t, e) {
|
|
|
2256
2286
|
*/
|
|
2257
2287
|
// An immutable sorted map implementation, based on a Left-leaning Red-Black
|
|
2258
2288
|
// tree.
|
|
2259
|
-
class
|
|
2289
|
+
class me {
|
|
2260
2290
|
constructor(t, e) {
|
|
2261
|
-
this.comparator = t, this.root = e ||
|
|
2291
|
+
this.comparator = t, this.root = e || ye.EMPTY;
|
|
2262
2292
|
}
|
|
2263
2293
|
// Returns a copy of the map, with the specified key/value added or replaced.
|
|
2264
2294
|
insert(t, e) {
|
|
2265
|
-
return new
|
|
2295
|
+
return new me(this.comparator, this.root.insert(t, e, this.comparator).copy(null, null, ye.BLACK, null, null));
|
|
2266
2296
|
}
|
|
2267
2297
|
// Returns a copy of the map, with the specified key removed.
|
|
2268
2298
|
remove(t) {
|
|
2269
|
-
return new
|
|
2299
|
+
return new me(this.comparator, this.root.remove(t, this.comparator).copy(null, null, ye.BLACK, null, null));
|
|
2270
2300
|
}
|
|
2271
2301
|
// Returns the value of the node with the given key, or null.
|
|
2272
2302
|
get(t) {
|
|
@@ -2332,22 +2362,22 @@ class we {
|
|
|
2332
2362
|
}
|
|
2333
2363
|
// Returns an iterator over the SortedMap.
|
|
2334
2364
|
getIterator() {
|
|
2335
|
-
return new
|
|
2365
|
+
return new pe(this.root, null, this.comparator, !1);
|
|
2336
2366
|
}
|
|
2337
2367
|
getIteratorFrom(t) {
|
|
2338
|
-
return new
|
|
2368
|
+
return new pe(this.root, t, this.comparator, !1);
|
|
2339
2369
|
}
|
|
2340
2370
|
getReverseIterator() {
|
|
2341
|
-
return new
|
|
2371
|
+
return new pe(this.root, null, this.comparator, !0);
|
|
2342
2372
|
}
|
|
2343
2373
|
getReverseIteratorFrom(t) {
|
|
2344
|
-
return new
|
|
2374
|
+
return new pe(this.root, t, this.comparator, !0);
|
|
2345
2375
|
}
|
|
2346
2376
|
}
|
|
2347
2377
|
|
|
2348
2378
|
// end SortedMap
|
|
2349
2379
|
// An iterator over an LLRBNode.
|
|
2350
|
-
class
|
|
2380
|
+
class pe {
|
|
2351
2381
|
constructor(t, e, n, r) {
|
|
2352
2382
|
this.isReverse = r, this.nodeStack = [];
|
|
2353
2383
|
let s = 1;
|
|
@@ -2392,14 +2422,14 @@ class me {
|
|
|
2392
2422
|
|
|
2393
2423
|
// end SortedMapIterator
|
|
2394
2424
|
// Represents a node in a Left-leaning Red-Black tree.
|
|
2395
|
-
class
|
|
2425
|
+
class ye {
|
|
2396
2426
|
constructor(t, e, n, r, s) {
|
|
2397
|
-
this.key = t, this.value = e, this.color = null != n ? n :
|
|
2398
|
-
this.right = null != s ? s :
|
|
2427
|
+
this.key = t, this.value = e, this.color = null != n ? n : ye.RED, this.left = null != r ? r : ye.EMPTY,
|
|
2428
|
+
this.right = null != s ? s : ye.EMPTY, this.size = this.left.size + 1 + this.right.size;
|
|
2399
2429
|
}
|
|
2400
2430
|
// Returns a copy of the current node, optionally replacing pieces of it.
|
|
2401
2431
|
copy(t, e, n, r, s) {
|
|
2402
|
-
return new
|
|
2432
|
+
return new ye(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);
|
|
2403
2433
|
}
|
|
2404
2434
|
isEmpty() {
|
|
2405
2435
|
return !1;
|
|
@@ -2438,7 +2468,7 @@ class pe {
|
|
|
2438
2468
|
r.fixUp();
|
|
2439
2469
|
}
|
|
2440
2470
|
removeMin() {
|
|
2441
|
-
if (this.left.isEmpty()) return
|
|
2471
|
+
if (this.left.isEmpty()) return ye.EMPTY;
|
|
2442
2472
|
let t = this;
|
|
2443
2473
|
return t.left.isRed() || t.left.left.isRed() || (t = t.moveRedLeft()), t = t.copy(null, null, null, t.left.removeMin(), null),
|
|
2444
2474
|
t.fixUp();
|
|
@@ -2450,7 +2480,7 @@ class pe {
|
|
|
2450
2480
|
r = r.copy(null, null, null, r.left.remove(t, e), null); else {
|
|
2451
2481
|
if (r.left.isRed() && (r = r.rotateRight()), r.right.isEmpty() || r.right.isRed() || r.right.left.isRed() || (r = r.moveRedRight()),
|
|
2452
2482
|
0 === e(t, r.key)) {
|
|
2453
|
-
if (r.right.isEmpty()) return
|
|
2483
|
+
if (r.right.isEmpty()) return ye.EMPTY;
|
|
2454
2484
|
n = r.right.min(), r = r.copy(n.key, n.value, null, null, r.right.removeMin());
|
|
2455
2485
|
}
|
|
2456
2486
|
r = r.copy(null, null, null, null, r.right.remove(t, e));
|
|
@@ -2476,11 +2506,11 @@ class pe {
|
|
|
2476
2506
|
return t.left.left.isRed() && (t = t.rotateRight(), t = t.colorFlip()), t;
|
|
2477
2507
|
}
|
|
2478
2508
|
rotateLeft() {
|
|
2479
|
-
const t = this.copy(null, null,
|
|
2509
|
+
const t = this.copy(null, null, ye.RED, null, this.right.left);
|
|
2480
2510
|
return this.right.copy(null, null, this.color, t, null);
|
|
2481
2511
|
}
|
|
2482
2512
|
rotateRight() {
|
|
2483
|
-
const t = this.copy(null, null,
|
|
2513
|
+
const t = this.copy(null, null, ye.RED, this.left.right, null);
|
|
2484
2514
|
return this.left.copy(null, null, this.color, null, t);
|
|
2485
2515
|
}
|
|
2486
2516
|
colorFlip() {
|
|
@@ -2506,10 +2536,10 @@ class pe {
|
|
|
2506
2536
|
// end LLRBNode
|
|
2507
2537
|
// Empty node is shared between all LLRB trees.
|
|
2508
2538
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2509
|
-
|
|
2539
|
+
ye.EMPTY = null, ye.RED = !0, ye.BLACK = !1;
|
|
2510
2540
|
|
|
2511
2541
|
// end LLRBEmptyNode
|
|
2512
|
-
|
|
2542
|
+
ye.EMPTY = new
|
|
2513
2543
|
// Represents an empty node (a leaf node in the Red-Black Tree).
|
|
2514
2544
|
class {
|
|
2515
2545
|
constructor() {
|
|
@@ -2536,7 +2566,7 @@ class {
|
|
|
2536
2566
|
}
|
|
2537
2567
|
// Returns a copy of the tree, with the specified key/value added.
|
|
2538
2568
|
insert(t, e, n) {
|
|
2539
|
-
return new
|
|
2569
|
+
return new ye(t, e);
|
|
2540
2570
|
}
|
|
2541
2571
|
// Returns a copy of the tree, with the specified key removed.
|
|
2542
2572
|
remove(t, e) {
|
|
@@ -2592,9 +2622,9 @@ class {
|
|
|
2592
2622
|
* NOTE: if provided comparator returns 0 for two elements, we consider them to
|
|
2593
2623
|
* be equal!
|
|
2594
2624
|
*/
|
|
2595
|
-
class
|
|
2625
|
+
class ge {
|
|
2596
2626
|
constructor(t) {
|
|
2597
|
-
this.comparator = t, this.data = new
|
|
2627
|
+
this.comparator = t, this.data = new me(this.comparator);
|
|
2598
2628
|
}
|
|
2599
2629
|
has(t) {
|
|
2600
2630
|
return null !== this.data.get(t);
|
|
@@ -2635,10 +2665,10 @@ class ye {
|
|
|
2635
2665
|
return e.hasNext() ? e.getNext().key : null;
|
|
2636
2666
|
}
|
|
2637
2667
|
getIterator() {
|
|
2638
|
-
return new
|
|
2668
|
+
return new _e(this.data.getIterator());
|
|
2639
2669
|
}
|
|
2640
2670
|
getIteratorFrom(t) {
|
|
2641
|
-
return new
|
|
2671
|
+
return new _e(this.data.getIteratorFrom(t));
|
|
2642
2672
|
}
|
|
2643
2673
|
/** Inserts or updates an element */ add(t) {
|
|
2644
2674
|
return this.copy(this.data.remove(t).insert(t, !0));
|
|
@@ -2657,7 +2687,7 @@ class ye {
|
|
|
2657
2687
|
})), e;
|
|
2658
2688
|
}
|
|
2659
2689
|
isEqual(t) {
|
|
2660
|
-
if (!(t instanceof
|
|
2690
|
+
if (!(t instanceof ge)) return !1;
|
|
2661
2691
|
if (this.size !== t.size) return !1;
|
|
2662
2692
|
const e = this.data.getIterator(), n = t.data.getIterator();
|
|
2663
2693
|
for (;e.hasNext(); ) {
|
|
@@ -2677,12 +2707,12 @@ class ye {
|
|
|
2677
2707
|
return this.forEach((e => t.push(e))), "SortedSet(" + t.toString() + ")";
|
|
2678
2708
|
}
|
|
2679
2709
|
copy(t) {
|
|
2680
|
-
const e = new
|
|
2710
|
+
const e = new ge(this.comparator);
|
|
2681
2711
|
return e.data = t, e;
|
|
2682
2712
|
}
|
|
2683
2713
|
}
|
|
2684
2714
|
|
|
2685
|
-
class
|
|
2715
|
+
class _e {
|
|
2686
2716
|
constructor(t) {
|
|
2687
2717
|
this.iter = t;
|
|
2688
2718
|
}
|
|
@@ -2719,7 +2749,7 @@ class ge {
|
|
|
2719
2749
|
* foo.bar - Overwrites only the field bar of the object foo.
|
|
2720
2750
|
* If foo is not an object, foo is replaced with an object
|
|
2721
2751
|
* containing foo
|
|
2722
|
-
*/ class
|
|
2752
|
+
*/ class ve {
|
|
2723
2753
|
constructor(t) {
|
|
2724
2754
|
this.fields = t,
|
|
2725
2755
|
// TODO(dimond): validation of FieldMask
|
|
@@ -2727,16 +2757,16 @@ class ge {
|
|
|
2727
2757
|
t.sort(st.comparator);
|
|
2728
2758
|
}
|
|
2729
2759
|
static empty() {
|
|
2730
|
-
return new
|
|
2760
|
+
return new ve([]);
|
|
2731
2761
|
}
|
|
2732
2762
|
/**
|
|
2733
2763
|
* Returns a new FieldMask object that is the result of adding all the given
|
|
2734
2764
|
* fields paths to this field mask.
|
|
2735
2765
|
*/ unionWith(t) {
|
|
2736
|
-
let e = new
|
|
2766
|
+
let e = new ge(st.comparator);
|
|
2737
2767
|
for (const t of this.fields) e = e.add(t);
|
|
2738
2768
|
for (const n of t) e = e.add(n);
|
|
2739
|
-
return new
|
|
2769
|
+
return new ve(e.toArray());
|
|
2740
2770
|
}
|
|
2741
2771
|
/**
|
|
2742
2772
|
* Verifies that `fieldPath` is included by at least one field in this field
|
|
@@ -2748,7 +2778,7 @@ class ge {
|
|
|
2748
2778
|
return !1;
|
|
2749
2779
|
}
|
|
2750
2780
|
isEqual(t) {
|
|
2751
|
-
return
|
|
2781
|
+
return Rt(this.fields, t.fields, ((t, e) => t.isEqual(e)));
|
|
2752
2782
|
}
|
|
2753
2783
|
}
|
|
2754
2784
|
|
|
@@ -2771,12 +2801,12 @@ class ge {
|
|
|
2771
2801
|
/**
|
|
2772
2802
|
* An ObjectValue represents a MapValue in the Firestore Proto and offers the
|
|
2773
2803
|
* ability to add and remove fields (via the ObjectValueBuilder).
|
|
2774
|
-
*/ class
|
|
2804
|
+
*/ class be {
|
|
2775
2805
|
constructor(t) {
|
|
2776
2806
|
this.value = t;
|
|
2777
2807
|
}
|
|
2778
2808
|
static empty() {
|
|
2779
|
-
return new
|
|
2809
|
+
return new be({
|
|
2780
2810
|
mapValue: {}
|
|
2781
2811
|
});
|
|
2782
2812
|
}
|
|
@@ -2790,7 +2820,7 @@ class ge {
|
|
|
2790
2820
|
{
|
|
2791
2821
|
let e = this.value;
|
|
2792
2822
|
for (let n = 0; n < t.length - 1; ++n) if (e = (e.mapValue.fields || {})[t.get(n)],
|
|
2793
|
-
!
|
|
2823
|
+
!Ht(e)) return null;
|
|
2794
2824
|
return e = (e.mapValue.fields || {})[t.lastSegment()], e || null;
|
|
2795
2825
|
}
|
|
2796
2826
|
}
|
|
@@ -2800,7 +2830,7 @@ class ge {
|
|
|
2800
2830
|
* @param path - The field path to set.
|
|
2801
2831
|
* @param value - The value to set.
|
|
2802
2832
|
*/ set(t, e) {
|
|
2803
|
-
this.getFieldsMap(t.popLast())[t.lastSegment()] =
|
|
2833
|
+
this.getFieldsMap(t.popLast())[t.lastSegment()] = Jt(e);
|
|
2804
2834
|
}
|
|
2805
2835
|
/**
|
|
2806
2836
|
* Sets the provided fields to the provided values.
|
|
@@ -2814,7 +2844,7 @@ class ge {
|
|
|
2814
2844
|
const t = this.getFieldsMap(e);
|
|
2815
2845
|
this.applyChanges(t, n, r), n = {}, r = [], e = s.popLast();
|
|
2816
2846
|
}
|
|
2817
|
-
t ? n[s.lastSegment()] =
|
|
2847
|
+
t ? n[s.lastSegment()] = Jt(t) : r.push(s.lastSegment());
|
|
2818
2848
|
}));
|
|
2819
2849
|
const s = this.getFieldsMap(e);
|
|
2820
2850
|
this.applyChanges(s, n, r);
|
|
@@ -2826,10 +2856,10 @@ class ge {
|
|
|
2826
2856
|
* @param path - The field path to remove.
|
|
2827
2857
|
*/ delete(t) {
|
|
2828
2858
|
const e = this.field(t.popLast());
|
|
2829
|
-
|
|
2859
|
+
Ht(e) && e.mapValue.fields && delete e.mapValue.fields[t.lastSegment()];
|
|
2830
2860
|
}
|
|
2831
2861
|
isEqual(t) {
|
|
2832
|
-
return
|
|
2862
|
+
return Ut(this.value, t.value);
|
|
2833
2863
|
}
|
|
2834
2864
|
/**
|
|
2835
2865
|
* Returns the map that contains the leaf element of `path`. If the parent
|
|
@@ -2841,7 +2871,7 @@ class ge {
|
|
|
2841
2871
|
});
|
|
2842
2872
|
for (let n = 0; n < t.length; ++n) {
|
|
2843
2873
|
let r = e.mapValue.fields[t.get(n)];
|
|
2844
|
-
|
|
2874
|
+
Ht(r) && r.mapValue.fields || (r = {
|
|
2845
2875
|
mapValue: {
|
|
2846
2876
|
fields: {}
|
|
2847
2877
|
}
|
|
@@ -2853,11 +2883,11 @@ class ge {
|
|
|
2853
2883
|
* Modifies `fieldsMap` by adding, replacing or deleting the specified
|
|
2854
2884
|
* entries.
|
|
2855
2885
|
*/ applyChanges(t, e, n) {
|
|
2856
|
-
|
|
2886
|
+
Vt(e, ((e, n) => t[e] = n));
|
|
2857
2887
|
for (const e of n) delete t[e];
|
|
2858
2888
|
}
|
|
2859
2889
|
clone() {
|
|
2860
|
-
return new
|
|
2890
|
+
return new be(Jt(this.value));
|
|
2861
2891
|
}
|
|
2862
2892
|
}
|
|
2863
2893
|
|
|
@@ -2886,7 +2916,7 @@ class ge {
|
|
|
2886
2916
|
* not transition to one of these states even after all mutations have been
|
|
2887
2917
|
* applied, `isValidDocument()` returns false and the document should be removed
|
|
2888
2918
|
* from all views.
|
|
2889
|
-
*/ class
|
|
2919
|
+
*/ class Ee {
|
|
2890
2920
|
constructor(t, e, n, r, s, i, o) {
|
|
2891
2921
|
this.key = t, this.documentType = e, this.version = n, this.readTime = r, this.createTime = s,
|
|
2892
2922
|
this.data = i, this.documentState = o;
|
|
@@ -2895,35 +2925,35 @@ class ge {
|
|
|
2895
2925
|
* Creates a document with no known version or data, but which can serve as
|
|
2896
2926
|
* base document for mutations.
|
|
2897
2927
|
*/ static newInvalidDocument(t) {
|
|
2898
|
-
return new
|
|
2899
|
-
/* version */
|
|
2900
|
-
/* readTime */
|
|
2901
|
-
/* createTime */
|
|
2928
|
+
return new Ee(t, 0 /* DocumentType.INVALID */ ,
|
|
2929
|
+
/* version */ we.min(),
|
|
2930
|
+
/* readTime */ we.min(),
|
|
2931
|
+
/* createTime */ we.min(), be.empty(), 0 /* DocumentState.SYNCED */);
|
|
2902
2932
|
}
|
|
2903
2933
|
/**
|
|
2904
2934
|
* Creates a new document that is known to exist with the given data at the
|
|
2905
2935
|
* given version.
|
|
2906
2936
|
*/ static newFoundDocument(t, e, n, r) {
|
|
2907
|
-
return new
|
|
2937
|
+
return new Ee(t, 1 /* DocumentType.FOUND_DOCUMENT */ ,
|
|
2908
2938
|
/* version */ e,
|
|
2909
|
-
/* readTime */
|
|
2939
|
+
/* readTime */ we.min(),
|
|
2910
2940
|
/* createTime */ n, r, 0 /* DocumentState.SYNCED */);
|
|
2911
2941
|
}
|
|
2912
2942
|
/** Creates a new document that is known to not exist at the given version. */ static newNoDocument(t, e) {
|
|
2913
|
-
return new
|
|
2943
|
+
return new Ee(t, 2 /* DocumentType.NO_DOCUMENT */ ,
|
|
2914
2944
|
/* version */ e,
|
|
2915
|
-
/* readTime */
|
|
2916
|
-
/* createTime */
|
|
2945
|
+
/* readTime */ we.min(),
|
|
2946
|
+
/* createTime */ we.min(), be.empty(), 0 /* DocumentState.SYNCED */);
|
|
2917
2947
|
}
|
|
2918
2948
|
/**
|
|
2919
2949
|
* Creates a new document that is known to exist at the given version but
|
|
2920
2950
|
* whose data is not known (e.g. a document that was updated without a known
|
|
2921
2951
|
* base document).
|
|
2922
2952
|
*/ static newUnknownDocument(t, e) {
|
|
2923
|
-
return new
|
|
2953
|
+
return new Ee(t, 3 /* DocumentType.UNKNOWN_DOCUMENT */ ,
|
|
2924
2954
|
/* version */ e,
|
|
2925
|
-
/* readTime */
|
|
2926
|
-
/* createTime */
|
|
2955
|
+
/* readTime */ we.min(),
|
|
2956
|
+
/* createTime */ we.min(), be.empty(), 2 /* DocumentState.HAS_COMMITTED_MUTATIONS */);
|
|
2927
2957
|
}
|
|
2928
2958
|
/**
|
|
2929
2959
|
* Changes the document type to indicate that it exists and that its version
|
|
@@ -2934,7 +2964,7 @@ class ge {
|
|
|
2934
2964
|
// update from Watch or due to applying a local set mutation on top
|
|
2935
2965
|
// of a deleted document, our best guess about its createTime would be the
|
|
2936
2966
|
// version at which the document transitioned to a FOUND_DOCUMENT.
|
|
2937
|
-
return !this.createTime.isEqual(
|
|
2967
|
+
return !this.createTime.isEqual(we.min()) || 2 /* DocumentType.NO_DOCUMENT */ !== this.documentType && 0 /* DocumentType.INVALID */ !== this.documentType || (this.createTime = t),
|
|
2938
2968
|
this.version = t, this.documentType = 1 /* DocumentType.FOUND_DOCUMENT */ , this.data = e,
|
|
2939
2969
|
this.documentState = 0 /* DocumentState.SYNCED */ , this;
|
|
2940
2970
|
}
|
|
@@ -2943,7 +2973,7 @@ class ge {
|
|
|
2943
2973
|
* version.
|
|
2944
2974
|
*/ convertToNoDocument(t) {
|
|
2945
2975
|
return this.version = t, this.documentType = 2 /* DocumentType.NO_DOCUMENT */ ,
|
|
2946
|
-
this.data =
|
|
2976
|
+
this.data = be.empty(), this.documentState = 0 /* DocumentState.SYNCED */ , this;
|
|
2947
2977
|
}
|
|
2948
2978
|
/**
|
|
2949
2979
|
* Changes the document type to indicate that it exists at a given version but
|
|
@@ -2951,14 +2981,14 @@ class ge {
|
|
|
2951
2981
|
* base document).
|
|
2952
2982
|
*/ convertToUnknownDocument(t) {
|
|
2953
2983
|
return this.version = t, this.documentType = 3 /* DocumentType.UNKNOWN_DOCUMENT */ ,
|
|
2954
|
-
this.data =
|
|
2984
|
+
this.data = be.empty(), this.documentState = 2 /* DocumentState.HAS_COMMITTED_MUTATIONS */ ,
|
|
2955
2985
|
this;
|
|
2956
2986
|
}
|
|
2957
2987
|
setHasCommittedMutations() {
|
|
2958
2988
|
return this.documentState = 2 /* DocumentState.HAS_COMMITTED_MUTATIONS */ , this;
|
|
2959
2989
|
}
|
|
2960
2990
|
setHasLocalMutations() {
|
|
2961
|
-
return this.documentState = 1 /* DocumentState.HAS_LOCAL_MUTATIONS */ , this.version =
|
|
2991
|
+
return this.documentState = 1 /* DocumentState.HAS_LOCAL_MUTATIONS */ , this.version = we.min(),
|
|
2962
2992
|
this;
|
|
2963
2993
|
}
|
|
2964
2994
|
setReadTime(t) {
|
|
@@ -2986,10 +3016,10 @@ class ge {
|
|
|
2986
3016
|
return 3 /* DocumentType.UNKNOWN_DOCUMENT */ === this.documentType;
|
|
2987
3017
|
}
|
|
2988
3018
|
isEqual(t) {
|
|
2989
|
-
return t instanceof
|
|
3019
|
+
return t instanceof Ee && this.key.isEqual(t.key) && this.version.isEqual(t.version) && this.documentType === t.documentType && this.documentState === t.documentState && this.data.isEqual(t.data);
|
|
2990
3020
|
}
|
|
2991
3021
|
mutableCopy() {
|
|
2992
|
-
return new
|
|
3022
|
+
return new Ee(this.key, this.documentType, this.version, this.readTime, this.createTime, this.data.clone(), this.documentState);
|
|
2993
3023
|
}
|
|
2994
3024
|
toString() {
|
|
2995
3025
|
return `Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`;
|
|
@@ -3013,7 +3043,7 @@ class ge {
|
|
|
3013
3043
|
* limitations under the License.
|
|
3014
3044
|
*/
|
|
3015
3045
|
// Visible for testing
|
|
3016
|
-
class
|
|
3046
|
+
class Ie {
|
|
3017
3047
|
constructor(t, e = null, n = [], r = [], s = null, i = null, o = null) {
|
|
3018
3048
|
this.path = t, this.collectionGroup = e, this.orderBy = n, this.filters = r, this.limit = s,
|
|
3019
3049
|
this.startAt = i, this.endAt = o, this.S = null;
|
|
@@ -3027,8 +3057,8 @@ class Ee {
|
|
|
3027
3057
|
* NOTE: you should always construct `Target` from `Query.toTarget` instead of
|
|
3028
3058
|
* using this factory method, because `Query` provides an implicit `orderBy`
|
|
3029
3059
|
* property.
|
|
3030
|
-
*/ function
|
|
3031
|
-
return new
|
|
3060
|
+
*/ function Ae(t, e = null, n = [], r = [], s = null, i = null, o = null) {
|
|
3061
|
+
return new Ie(t, e, n, r, s, i, o);
|
|
3032
3062
|
}
|
|
3033
3063
|
|
|
3034
3064
|
/**
|
|
@@ -3054,7 +3084,7 @@ class Ee {
|
|
|
3054
3084
|
*
|
|
3055
3085
|
* Visible for testing.
|
|
3056
3086
|
*/
|
|
3057
|
-
class
|
|
3087
|
+
class Te {
|
|
3058
3088
|
/**
|
|
3059
3089
|
* Initializes a Query with a path and optional additional query constraints.
|
|
3060
3090
|
* Path must currently be empty if this is a collection group query.
|
|
@@ -3067,11 +3097,11 @@ class Ae {
|
|
|
3067
3097
|
}
|
|
3068
3098
|
}
|
|
3069
3099
|
|
|
3070
|
-
/** Creates a new Query for a query that matches all documents at `path` */ function
|
|
3100
|
+
/** Creates a new Query for a query that matches all documents at `path` */ function Re(t) {
|
|
3071
3101
|
return t.explicitOrderBy.length > 0 ? t.explicitOrderBy[0].field : null;
|
|
3072
3102
|
}
|
|
3073
3103
|
|
|
3074
|
-
function
|
|
3104
|
+
function Pe(t) {
|
|
3075
3105
|
for (const e of t.filters) {
|
|
3076
3106
|
const t = e.getFirstInequalityField();
|
|
3077
3107
|
if (null !== t) return t;
|
|
@@ -3087,7 +3117,7 @@ function Re(t) {
|
|
|
3087
3117
|
* Returns whether the query matches a collection group rather than a specific
|
|
3088
3118
|
* collection.
|
|
3089
3119
|
*/
|
|
3090
|
-
function
|
|
3120
|
+
function Ve(t) {
|
|
3091
3121
|
return null !== t.collectionGroup;
|
|
3092
3122
|
}
|
|
3093
3123
|
|
|
@@ -3095,23 +3125,23 @@ function Pe(t) {
|
|
|
3095
3125
|
* Returns the implicit order by constraint that is used to execute the Query,
|
|
3096
3126
|
* which can be different from the order by constraints the user provided (e.g.
|
|
3097
3127
|
* the SDK and backend always orders by `__name__`).
|
|
3098
|
-
*/ function
|
|
3128
|
+
*/ function $e(t) {
|
|
3099
3129
|
const e = T(t);
|
|
3100
3130
|
if (null === e.q) {
|
|
3101
3131
|
e.q = [];
|
|
3102
|
-
const t =
|
|
3132
|
+
const t = Pe(e), n = Re(e);
|
|
3103
3133
|
if (null !== t && null === n)
|
|
3104
3134
|
// In order to implicitly add key ordering, we must also add the
|
|
3105
3135
|
// inequality filter field for it to be a valid query.
|
|
3106
3136
|
// Note that the default inequality field and key ordering is ascending.
|
|
3107
|
-
t.isKeyField() || e.q.push(new
|
|
3137
|
+
t.isKeyField() || e.q.push(new fe(t)), e.q.push(new fe(st.keyField(), "asc" /* Direction.ASCENDING */)); else {
|
|
3108
3138
|
let t = !1;
|
|
3109
3139
|
for (const n of e.explicitOrderBy) e.q.push(n), n.field.isKeyField() && (t = !0);
|
|
3110
3140
|
if (!t) {
|
|
3111
3141
|
// The order of the implicit key ordering always matches the last
|
|
3112
3142
|
// explicit order by
|
|
3113
3143
|
const t = e.explicitOrderBy.length > 0 ? e.explicitOrderBy[e.explicitOrderBy.length - 1].dir : "asc" /* Direction.ASCENDING */;
|
|
3114
|
-
e.q.push(new
|
|
3144
|
+
e.q.push(new fe(st.keyField(), t));
|
|
3115
3145
|
}
|
|
3116
3146
|
}
|
|
3117
3147
|
}
|
|
@@ -3120,38 +3150,38 @@ function Pe(t) {
|
|
|
3120
3150
|
|
|
3121
3151
|
/**
|
|
3122
3152
|
* Converts this `Query` instance to it's corresponding `Target` representation.
|
|
3123
|
-
*/ function
|
|
3153
|
+
*/ function Ne(t) {
|
|
3124
3154
|
const e = T(t);
|
|
3125
|
-
if (!e.O) if ("F" /* LimitType.First */ === e.limitType) e.O =
|
|
3155
|
+
if (!e.O) if ("F" /* LimitType.First */ === e.limitType) e.O = Ae(e.path, e.collectionGroup, $e(e), e.filters, e.limit, e.startAt, e.endAt); else {
|
|
3126
3156
|
// Flip the orderBy directions since we want the last results
|
|
3127
3157
|
const t = [];
|
|
3128
|
-
for (const n of
|
|
3158
|
+
for (const n of $e(e)) {
|
|
3129
3159
|
const e = "desc" /* Direction.DESCENDING */ === n.dir ? "asc" /* Direction.ASCENDING */ : "desc" /* Direction.DESCENDING */;
|
|
3130
|
-
t.push(new
|
|
3160
|
+
t.push(new fe(n.field, e));
|
|
3131
3161
|
}
|
|
3132
3162
|
// We need to swap the cursors to match the now-flipped query ordering.
|
|
3133
|
-
const n = e.endAt ? new
|
|
3163
|
+
const n = e.endAt ? new Xt(e.endAt.position, e.endAt.inclusive) : null, r = e.startAt ? new Xt(e.startAt.position, e.startAt.inclusive) : null;
|
|
3134
3164
|
// Now return as a LimitType.First query.
|
|
3135
|
-
e.O =
|
|
3165
|
+
e.O = Ae(e.path, e.collectionGroup, t, e.filters, e.limit, n, r);
|
|
3136
3166
|
}
|
|
3137
3167
|
return e.O;
|
|
3138
3168
|
}
|
|
3139
3169
|
|
|
3140
|
-
function
|
|
3141
|
-
e.getFirstInequalityField(),
|
|
3170
|
+
function De(t, e) {
|
|
3171
|
+
e.getFirstInequalityField(), Pe(t);
|
|
3142
3172
|
const n = t.filters.concat([ e ]);
|
|
3143
|
-
return new
|
|
3173
|
+
return new Te(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
|
|
3144
3174
|
}
|
|
3145
3175
|
|
|
3146
|
-
function
|
|
3176
|
+
function Fe(t, e) {
|
|
3147
3177
|
return function(t, e) {
|
|
3148
3178
|
if (t.limit !== e.limit) return !1;
|
|
3149
3179
|
if (t.orderBy.length !== e.orderBy.length) return !1;
|
|
3150
|
-
for (let n = 0; n < t.orderBy.length; n++) if (!
|
|
3180
|
+
for (let n = 0; n < t.orderBy.length; n++) if (!de(t.orderBy[n], e.orderBy[n])) return !1;
|
|
3151
3181
|
if (t.filters.length !== e.filters.length) return !1;
|
|
3152
|
-
for (let n = 0; n < t.filters.length; n++) if (!
|
|
3153
|
-
return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!
|
|
3154
|
-
}(
|
|
3182
|
+
for (let n = 0; n < t.filters.length; n++) if (!re(t.filters[n], e.filters[n])) return !1;
|
|
3183
|
+
return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!Zt(t.startAt, e.startAt) && Zt(t.endAt, e.endAt);
|
|
3184
|
+
}(Ne(t), Ne(e)) && t.limitType === e.limitType;
|
|
3155
3185
|
}
|
|
3156
3186
|
|
|
3157
3187
|
/**
|
|
@@ -3179,9 +3209,9 @@ function De(t, e) {
|
|
|
3179
3209
|
* The return value is an IntegerValue if it can safely represent the value,
|
|
3180
3210
|
* otherwise a DoubleValue is returned.
|
|
3181
3211
|
*/
|
|
3182
|
-
function
|
|
3212
|
+
function xe(t, e) {
|
|
3183
3213
|
return function(t) {
|
|
3184
|
-
return "number" == typeof t && Number.isInteger(t) && !
|
|
3214
|
+
return "number" == typeof t && Number.isInteger(t) && !pt(t) && t <= Number.MAX_SAFE_INTEGER && t >= Number.MIN_SAFE_INTEGER;
|
|
3185
3215
|
}(e) ?
|
|
3186
3216
|
/**
|
|
3187
3217
|
* Returns an IntegerValue for `value`.
|
|
@@ -3203,7 +3233,7 @@ function Fe(t, e) {
|
|
|
3203
3233
|
};
|
|
3204
3234
|
}
|
|
3205
3235
|
return {
|
|
3206
|
-
doubleValue:
|
|
3236
|
+
doubleValue: pt(e) ? "-0" : e
|
|
3207
3237
|
};
|
|
3208
3238
|
}(t, e);
|
|
3209
3239
|
}
|
|
@@ -3224,7 +3254,7 @@ function Fe(t, e) {
|
|
|
3224
3254
|
* See the License for the specific language governing permissions and
|
|
3225
3255
|
* limitations under the License.
|
|
3226
3256
|
*/
|
|
3227
|
-
/** Used to represent a field transform on a mutation. */ class
|
|
3257
|
+
/** Used to represent a field transform on a mutation. */ class Se {
|
|
3228
3258
|
constructor() {
|
|
3229
3259
|
// Make sure that the structural type of `TransformOperation` is unique.
|
|
3230
3260
|
// See https://github.com/microsoft/TypeScript/issues/5451
|
|
@@ -3232,15 +3262,15 @@ function Fe(t, e) {
|
|
|
3232
3262
|
}
|
|
3233
3263
|
}
|
|
3234
3264
|
|
|
3235
|
-
/** Transforms a value into a server-generated timestamp. */ class
|
|
3265
|
+
/** Transforms a value into a server-generated timestamp. */ class qe extends Se {}
|
|
3236
3266
|
|
|
3237
|
-
/** Transforms an array value via a union operation. */ class
|
|
3267
|
+
/** Transforms an array value via a union operation. */ class Oe extends Se {
|
|
3238
3268
|
constructor(t) {
|
|
3239
3269
|
super(), this.elements = t;
|
|
3240
3270
|
}
|
|
3241
3271
|
}
|
|
3242
3272
|
|
|
3243
|
-
/** Transforms an array value via a remove operation. */ class
|
|
3273
|
+
/** Transforms an array value via a remove operation. */ class ke extends Se {
|
|
3244
3274
|
constructor(t) {
|
|
3245
3275
|
super(), this.elements = t;
|
|
3246
3276
|
}
|
|
@@ -3251,7 +3281,7 @@ function Fe(t, e) {
|
|
|
3251
3281
|
* transforms. Converts all field values to integers or doubles, but unlike the
|
|
3252
3282
|
* backend does not cap integer values at 2^63. Instead, JavaScript number
|
|
3253
3283
|
* arithmetic is used and precision loss can occur for values greater than 2^53.
|
|
3254
|
-
*/ class
|
|
3284
|
+
*/ class Ce extends Se {
|
|
3255
3285
|
constructor(t, e) {
|
|
3256
3286
|
super(), this.serializer = t, this.k = e;
|
|
3257
3287
|
}
|
|
@@ -3273,7 +3303,7 @@ function Fe(t, e) {
|
|
|
3273
3303
|
* See the License for the specific language governing permissions and
|
|
3274
3304
|
* limitations under the License.
|
|
3275
3305
|
*/
|
|
3276
|
-
/** A field path and the TransformOperation to perform upon it. */ class
|
|
3306
|
+
/** A field path and the TransformOperation to perform upon it. */ class Me {
|
|
3277
3307
|
constructor(t, e) {
|
|
3278
3308
|
this.field = t, this.transform = e;
|
|
3279
3309
|
}
|
|
@@ -3283,18 +3313,18 @@ function Fe(t, e) {
|
|
|
3283
3313
|
* Encodes a precondition for a mutation. This follows the model that the
|
|
3284
3314
|
* backend accepts with the special case of an explicit "empty" precondition
|
|
3285
3315
|
* (meaning no precondition).
|
|
3286
|
-
*/ class
|
|
3316
|
+
*/ class Le {
|
|
3287
3317
|
constructor(t, e) {
|
|
3288
3318
|
this.updateTime = t, this.exists = e;
|
|
3289
3319
|
}
|
|
3290
3320
|
/** Creates a new empty Precondition. */ static none() {
|
|
3291
|
-
return new
|
|
3321
|
+
return new Le;
|
|
3292
3322
|
}
|
|
3293
3323
|
/** Creates a new Precondition with an exists flag. */ static exists(t) {
|
|
3294
|
-
return new
|
|
3324
|
+
return new Le(void 0, t);
|
|
3295
3325
|
}
|
|
3296
3326
|
/** Creates a new Precondition based on a version a document exists at. */ static updateTime(t) {
|
|
3297
|
-
return new
|
|
3327
|
+
return new Le(t);
|
|
3298
3328
|
}
|
|
3299
3329
|
/** Returns whether this Precondition is empty. */ get isNone() {
|
|
3300
3330
|
return void 0 === this.updateTime && void 0 === this.exists;
|
|
@@ -3347,12 +3377,12 @@ function Fe(t, e) {
|
|
|
3347
3377
|
* applyToLocalView() to implement the actual behavior of applying the mutation
|
|
3348
3378
|
* to some source document (see `setMutationApplyToRemoteDocument()` for an
|
|
3349
3379
|
* example).
|
|
3350
|
-
*/ class
|
|
3380
|
+
*/ class je {}
|
|
3351
3381
|
|
|
3352
3382
|
/**
|
|
3353
3383
|
* A mutation that creates or replaces the document at the given key with the
|
|
3354
3384
|
* object value contents.
|
|
3355
|
-
*/ class
|
|
3385
|
+
*/ class Ue extends je {
|
|
3356
3386
|
constructor(t, e, n, r = []) {
|
|
3357
3387
|
super(), this.key = t, this.value = e, this.precondition = n, this.fieldTransforms = r,
|
|
3358
3388
|
this.type = 0 /* MutationType.Set */;
|
|
@@ -3374,7 +3404,7 @@ function Fe(t, e) {
|
|
|
3374
3404
|
* is deleted.
|
|
3375
3405
|
* * When a field is not in the mask but is in the values, the values map is
|
|
3376
3406
|
* ignored.
|
|
3377
|
-
*/ class
|
|
3407
|
+
*/ class Be extends je {
|
|
3378
3408
|
constructor(t, e, n, r, s = []) {
|
|
3379
3409
|
super(), this.key = t, this.data = e, this.fieldMask = n, this.precondition = r,
|
|
3380
3410
|
this.fieldTransforms = s, this.type = 1 /* MutationType.Patch */;
|
|
@@ -3384,7 +3414,7 @@ function Fe(t, e) {
|
|
|
3384
3414
|
}
|
|
3385
3415
|
}
|
|
3386
3416
|
|
|
3387
|
-
/** A mutation that deletes the document at the given key. */ class
|
|
3417
|
+
/** A mutation that deletes the document at the given key. */ class Qe extends je {
|
|
3388
3418
|
constructor(t, e) {
|
|
3389
3419
|
super(), this.key = t, this.precondition = e, this.type = 2 /* MutationType.Delete */ ,
|
|
3390
3420
|
this.fieldTransforms = [];
|
|
@@ -3400,7 +3430,7 @@ function Fe(t, e) {
|
|
|
3400
3430
|
*
|
|
3401
3431
|
* The `verify` operation is only used in Transactions, and this class serves
|
|
3402
3432
|
* primarily to facilitate serialization into protos.
|
|
3403
|
-
*/ class
|
|
3433
|
+
*/ class ze extends je {
|
|
3404
3434
|
constructor(t, e) {
|
|
3405
3435
|
super(), this.key = t, this.precondition = e, this.type = 3 /* MutationType.Verify */ ,
|
|
3406
3436
|
this.fieldTransforms = [];
|
|
@@ -3425,13 +3455,13 @@ function Fe(t, e) {
|
|
|
3425
3455
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3426
3456
|
* See the License for the specific language governing permissions and
|
|
3427
3457
|
* limitations under the License.
|
|
3428
|
-
*/ const
|
|
3458
|
+
*/ const We = (() => {
|
|
3429
3459
|
const t = {
|
|
3430
3460
|
asc: "ASCENDING",
|
|
3431
3461
|
desc: "DESCENDING"
|
|
3432
3462
|
};
|
|
3433
3463
|
return t;
|
|
3434
|
-
})(),
|
|
3464
|
+
})(), Ge = (() => {
|
|
3435
3465
|
const t = {
|
|
3436
3466
|
"<": "LESS_THAN",
|
|
3437
3467
|
"<=": "LESS_THAN_OR_EQUAL",
|
|
@@ -3445,7 +3475,7 @@ function Fe(t, e) {
|
|
|
3445
3475
|
"array-contains-any": "ARRAY_CONTAINS_ANY"
|
|
3446
3476
|
};
|
|
3447
3477
|
return t;
|
|
3448
|
-
})(),
|
|
3478
|
+
})(), Ke = (() => {
|
|
3449
3479
|
const t = {
|
|
3450
3480
|
and: "AND",
|
|
3451
3481
|
or: "OR"
|
|
@@ -3467,7 +3497,7 @@ function Fe(t, e) {
|
|
|
3467
3497
|
* TODO(klimt): We can remove the databaseId argument if we keep the full
|
|
3468
3498
|
* resource name in documents.
|
|
3469
3499
|
*/
|
|
3470
|
-
class
|
|
3500
|
+
class Ye {
|
|
3471
3501
|
constructor(t, e) {
|
|
3472
3502
|
this.databaseId = t, this.useProto3Json = e;
|
|
3473
3503
|
}
|
|
@@ -3484,7 +3514,7 @@ class Ke {
|
|
|
3484
3514
|
/**
|
|
3485
3515
|
* Returns a value for a Date that's appropriate to put into a proto.
|
|
3486
3516
|
*/
|
|
3487
|
-
function
|
|
3517
|
+
function He(t, e) {
|
|
3488
3518
|
if (t.useProto3Json) {
|
|
3489
3519
|
return `${new Date(1e3 * e.seconds).toISOString().replace(/\.\d*/, "").replace("Z", "")}.${("000000000" + e.nanoseconds).slice(-9)}Z`;
|
|
3490
3520
|
}
|
|
@@ -3499,35 +3529,35 @@ function Ye(t, e) {
|
|
|
3499
3529
|
*
|
|
3500
3530
|
* Visible for testing.
|
|
3501
3531
|
*/
|
|
3502
|
-
function
|
|
3532
|
+
function Je(t, e) {
|
|
3503
3533
|
return t.useProto3Json ? e.toBase64() : e.toUint8Array();
|
|
3504
3534
|
}
|
|
3505
3535
|
|
|
3506
|
-
function
|
|
3507
|
-
return
|
|
3536
|
+
function Xe(t, e) {
|
|
3537
|
+
return He(t, e.toTimestamp());
|
|
3508
3538
|
}
|
|
3509
3539
|
|
|
3510
|
-
function
|
|
3511
|
-
return A(!!t),
|
|
3512
|
-
const e =
|
|
3513
|
-
return new
|
|
3540
|
+
function Ze(t) {
|
|
3541
|
+
return A(!!t), we.fromTimestamp(function(t) {
|
|
3542
|
+
const e = xt(t);
|
|
3543
|
+
return new Ot(e.seconds, e.nanos);
|
|
3514
3544
|
}(t));
|
|
3515
3545
|
}
|
|
3516
3546
|
|
|
3517
|
-
function
|
|
3547
|
+
function tn(t, e) {
|
|
3518
3548
|
return function(t) {
|
|
3519
3549
|
return new nt([ "projects", t.projectId, "databases", t.database ]);
|
|
3520
3550
|
}(t).child("documents").child(e).canonicalString();
|
|
3521
3551
|
}
|
|
3522
3552
|
|
|
3523
|
-
function
|
|
3524
|
-
return
|
|
3553
|
+
function en(t, e) {
|
|
3554
|
+
return tn(t.databaseId, e.path);
|
|
3525
3555
|
}
|
|
3526
3556
|
|
|
3527
|
-
function
|
|
3557
|
+
function nn(t, e) {
|
|
3528
3558
|
const n = function(t) {
|
|
3529
3559
|
const e = nt.fromString(t);
|
|
3530
|
-
return A(
|
|
3560
|
+
return A(pn(e)), e;
|
|
3531
3561
|
}(e);
|
|
3532
3562
|
if (n.get(1) !== t.databaseId.projectId) throw new B($, "Tried to deserialize key from different project: " + n.get(1) + " vs " + t.databaseId.projectId);
|
|
3533
3563
|
if (n.get(3) !== t.databaseId.database) throw new B($, "Tried to deserialize key from different database: " + n.get(3) + " vs " + t.databaseId.database);
|
|
@@ -3535,98 +3565,98 @@ function en(t, e) {
|
|
|
3535
3565
|
var r;
|
|
3536
3566
|
/** Creates a Document proto from key and fields (but no create/update time) */}
|
|
3537
3567
|
|
|
3538
|
-
function
|
|
3539
|
-
return
|
|
3568
|
+
function rn(t, e) {
|
|
3569
|
+
return tn(t.databaseId, e);
|
|
3540
3570
|
}
|
|
3541
3571
|
|
|
3542
|
-
function
|
|
3572
|
+
function sn(t) {
|
|
3543
3573
|
return new nt([ "projects", t.databaseId.projectId, "databases", t.databaseId.database ]).canonicalString();
|
|
3544
3574
|
}
|
|
3545
3575
|
|
|
3546
|
-
function
|
|
3576
|
+
function on(t, e, n) {
|
|
3547
3577
|
return {
|
|
3548
|
-
name:
|
|
3578
|
+
name: en(t, e),
|
|
3549
3579
|
fields: n.value.mapValue.fields
|
|
3550
3580
|
};
|
|
3551
3581
|
}
|
|
3552
3582
|
|
|
3553
|
-
function
|
|
3583
|
+
function un(t, e) {
|
|
3554
3584
|
return "found" in e ? function(t, e) {
|
|
3555
3585
|
A(!!e.found), e.found.name, e.found.updateTime;
|
|
3556
|
-
const n =
|
|
3586
|
+
const n = nn(t, e.found.name), r = Ze(e.found.updateTime), s = e.found.createTime ? Ze(e.found.createTime) : we.min(), i = new be({
|
|
3557
3587
|
mapValue: {
|
|
3558
3588
|
fields: e.found.fields
|
|
3559
3589
|
}
|
|
3560
3590
|
});
|
|
3561
|
-
return
|
|
3591
|
+
return Ee.newFoundDocument(n, r, s, i);
|
|
3562
3592
|
}(t, e) : "missing" in e ? function(t, e) {
|
|
3563
3593
|
A(!!e.missing), A(!!e.readTime);
|
|
3564
|
-
const n =
|
|
3565
|
-
return
|
|
3594
|
+
const n = nn(t, e.missing), r = Ze(e.readTime);
|
|
3595
|
+
return Ee.newNoDocument(n, r);
|
|
3566
3596
|
}(t, e) : I();
|
|
3567
3597
|
}
|
|
3568
3598
|
|
|
3569
|
-
function
|
|
3599
|
+
function cn(t, e) {
|
|
3570
3600
|
let n;
|
|
3571
|
-
if (e instanceof
|
|
3572
|
-
update:
|
|
3601
|
+
if (e instanceof Ue) n = {
|
|
3602
|
+
update: on(t, e.key, e.value)
|
|
3603
|
+
}; else if (e instanceof Qe) n = {
|
|
3604
|
+
delete: en(t, e.key)
|
|
3573
3605
|
}; else if (e instanceof Be) n = {
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
update: sn(t, e.key, e.data),
|
|
3577
|
-
updateMask: wn(e.fieldMask)
|
|
3606
|
+
update: on(t, e.key, e.data),
|
|
3607
|
+
updateMask: mn(e.fieldMask)
|
|
3578
3608
|
}; else {
|
|
3579
|
-
if (!(e instanceof
|
|
3609
|
+
if (!(e instanceof ze)) return I();
|
|
3580
3610
|
n = {
|
|
3581
|
-
verify:
|
|
3611
|
+
verify: en(t, e.key)
|
|
3582
3612
|
};
|
|
3583
3613
|
}
|
|
3584
3614
|
return e.fieldTransforms.length > 0 && (n.updateTransforms = e.fieldTransforms.map((t => function(t, e) {
|
|
3585
3615
|
const n = e.transform;
|
|
3586
|
-
if (n instanceof
|
|
3616
|
+
if (n instanceof qe) return {
|
|
3587
3617
|
fieldPath: e.field.canonicalString(),
|
|
3588
3618
|
setToServerValue: "REQUEST_TIME"
|
|
3589
3619
|
};
|
|
3590
|
-
if (n instanceof
|
|
3620
|
+
if (n instanceof Oe) return {
|
|
3591
3621
|
fieldPath: e.field.canonicalString(),
|
|
3592
3622
|
appendMissingElements: {
|
|
3593
3623
|
values: n.elements
|
|
3594
3624
|
}
|
|
3595
3625
|
};
|
|
3596
|
-
if (n instanceof
|
|
3626
|
+
if (n instanceof ke) return {
|
|
3597
3627
|
fieldPath: e.field.canonicalString(),
|
|
3598
3628
|
removeAllFromArray: {
|
|
3599
3629
|
values: n.elements
|
|
3600
3630
|
}
|
|
3601
3631
|
};
|
|
3602
|
-
if (n instanceof
|
|
3632
|
+
if (n instanceof Ce) return {
|
|
3603
3633
|
fieldPath: e.field.canonicalString(),
|
|
3604
3634
|
increment: n.k
|
|
3605
3635
|
};
|
|
3606
3636
|
throw I();
|
|
3607
3637
|
}(0, t)))), e.precondition.isNone || (n.currentDocument = function(t, e) {
|
|
3608
3638
|
return void 0 !== e.updateTime ? {
|
|
3609
|
-
updateTime:
|
|
3639
|
+
updateTime: Xe(t, e.updateTime)
|
|
3610
3640
|
} : void 0 !== e.exists ? {
|
|
3611
3641
|
exists: e.exists
|
|
3612
3642
|
} : I();
|
|
3613
3643
|
}(t, e.precondition)), n;
|
|
3614
3644
|
}
|
|
3615
3645
|
|
|
3616
|
-
function
|
|
3646
|
+
function an(t, e) {
|
|
3617
3647
|
// Dissect the path into parent, collectionId, and optional key filter.
|
|
3618
3648
|
const n = {
|
|
3619
3649
|
structuredQuery: {}
|
|
3620
3650
|
}, r = e.path;
|
|
3621
|
-
null !== e.collectionGroup ? (n.parent =
|
|
3651
|
+
null !== e.collectionGroup ? (n.parent = rn(t, r), n.structuredQuery.from = [ {
|
|
3622
3652
|
collectionId: e.collectionGroup,
|
|
3623
3653
|
allDescendants: !0
|
|
3624
|
-
} ]) : (n.parent =
|
|
3654
|
+
} ]) : (n.parent = rn(t, r.popLast()), n.structuredQuery.from = [ {
|
|
3625
3655
|
collectionId: r.lastSegment()
|
|
3626
3656
|
} ]);
|
|
3627
3657
|
const s = function(t) {
|
|
3628
3658
|
if (0 === t.length) return;
|
|
3629
|
-
return
|
|
3659
|
+
return wn(ne.create(t, "and" /* CompositeOperator.AND */));
|
|
3630
3660
|
}(e.filters);
|
|
3631
3661
|
s && (n.structuredQuery.where = s);
|
|
3632
3662
|
const i = function(t) {
|
|
@@ -3635,8 +3665,8 @@ function cn(t, e) {
|
|
|
3635
3665
|
// visible for testing
|
|
3636
3666
|
function(t) {
|
|
3637
3667
|
return {
|
|
3638
|
-
field:
|
|
3639
|
-
direction:
|
|
3668
|
+
field: dn(t.field),
|
|
3669
|
+
direction: hn(t.dir)
|
|
3640
3670
|
};
|
|
3641
3671
|
}
|
|
3642
3672
|
// visible for testing
|
|
@@ -3644,7 +3674,7 @@ function cn(t, e) {
|
|
|
3644
3674
|
}(e.orderBy);
|
|
3645
3675
|
i && (n.structuredQuery.orderBy = i);
|
|
3646
3676
|
const o = function(t, e) {
|
|
3647
|
-
return t.useProto3Json ||
|
|
3677
|
+
return t.useProto3Json || mt(e) ? e : {
|
|
3648
3678
|
value: e
|
|
3649
3679
|
};
|
|
3650
3680
|
}(t, e.limit);
|
|
@@ -3662,81 +3692,81 @@ function cn(t, e) {
|
|
|
3662
3692
|
(e.endAt)), n;
|
|
3663
3693
|
}
|
|
3664
3694
|
|
|
3665
|
-
function an(t) {
|
|
3666
|
-
return ze[t];
|
|
3667
|
-
}
|
|
3668
|
-
|
|
3669
|
-
// visible for testing
|
|
3670
3695
|
function hn(t) {
|
|
3671
3696
|
return We[t];
|
|
3672
3697
|
}
|
|
3673
3698
|
|
|
3699
|
+
// visible for testing
|
|
3674
3700
|
function ln(t) {
|
|
3675
3701
|
return Ge[t];
|
|
3676
3702
|
}
|
|
3677
3703
|
|
|
3678
3704
|
function fn(t) {
|
|
3705
|
+
return Ke[t];
|
|
3706
|
+
}
|
|
3707
|
+
|
|
3708
|
+
function dn(t) {
|
|
3679
3709
|
return {
|
|
3680
3710
|
fieldPath: t.canonicalString()
|
|
3681
3711
|
};
|
|
3682
3712
|
}
|
|
3683
3713
|
|
|
3684
|
-
function
|
|
3685
|
-
return t instanceof
|
|
3714
|
+
function wn(t) {
|
|
3715
|
+
return t instanceof ee ? function(t) {
|
|
3686
3716
|
if ("==" /* Operator.EQUAL */ === t.op) {
|
|
3687
|
-
if (
|
|
3717
|
+
if (Yt(t.value)) return {
|
|
3688
3718
|
unaryFilter: {
|
|
3689
|
-
field:
|
|
3719
|
+
field: dn(t.field),
|
|
3690
3720
|
op: "IS_NAN"
|
|
3691
3721
|
}
|
|
3692
3722
|
};
|
|
3693
|
-
if (
|
|
3723
|
+
if (Kt(t.value)) return {
|
|
3694
3724
|
unaryFilter: {
|
|
3695
|
-
field:
|
|
3725
|
+
field: dn(t.field),
|
|
3696
3726
|
op: "IS_NULL"
|
|
3697
3727
|
}
|
|
3698
3728
|
};
|
|
3699
3729
|
} else if ("!=" /* Operator.NOT_EQUAL */ === t.op) {
|
|
3700
|
-
if (
|
|
3730
|
+
if (Yt(t.value)) return {
|
|
3701
3731
|
unaryFilter: {
|
|
3702
|
-
field:
|
|
3732
|
+
field: dn(t.field),
|
|
3703
3733
|
op: "IS_NOT_NAN"
|
|
3704
3734
|
}
|
|
3705
3735
|
};
|
|
3706
|
-
if (
|
|
3736
|
+
if (Kt(t.value)) return {
|
|
3707
3737
|
unaryFilter: {
|
|
3708
|
-
field:
|
|
3738
|
+
field: dn(t.field),
|
|
3709
3739
|
op: "IS_NOT_NULL"
|
|
3710
3740
|
}
|
|
3711
3741
|
};
|
|
3712
3742
|
}
|
|
3713
3743
|
return {
|
|
3714
3744
|
fieldFilter: {
|
|
3715
|
-
field:
|
|
3716
|
-
op:
|
|
3745
|
+
field: dn(t.field),
|
|
3746
|
+
op: ln(t.op),
|
|
3717
3747
|
value: t.value
|
|
3718
3748
|
}
|
|
3719
3749
|
};
|
|
3720
|
-
}(t) : t instanceof
|
|
3721
|
-
const e = t.getFilters().map((t =>
|
|
3750
|
+
}(t) : t instanceof ne ? function(t) {
|
|
3751
|
+
const e = t.getFilters().map((t => wn(t)));
|
|
3722
3752
|
if (1 === e.length) return e[0];
|
|
3723
3753
|
return {
|
|
3724
3754
|
compositeFilter: {
|
|
3725
|
-
op:
|
|
3755
|
+
op: fn(t.op),
|
|
3726
3756
|
filters: e
|
|
3727
3757
|
}
|
|
3728
3758
|
};
|
|
3729
3759
|
}(t) : I();
|
|
3730
3760
|
}
|
|
3731
3761
|
|
|
3732
|
-
function
|
|
3762
|
+
function mn(t) {
|
|
3733
3763
|
const e = [];
|
|
3734
3764
|
return t.fields.forEach((t => e.push(t.canonicalString()))), {
|
|
3735
3765
|
fieldPaths: e
|
|
3736
3766
|
};
|
|
3737
3767
|
}
|
|
3738
3768
|
|
|
3739
|
-
function
|
|
3769
|
+
function pn(t) {
|
|
3740
3770
|
// Resource names have at least 4 components (project ID, database ID)
|
|
3741
3771
|
return t.length >= 4 && "projects" === t.get(0) && "databases" === t.get(2);
|
|
3742
3772
|
}
|
|
@@ -3756,8 +3786,8 @@ function mn(t) {
|
|
|
3756
3786
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3757
3787
|
* See the License for the specific language governing permissions and
|
|
3758
3788
|
* limitations under the License.
|
|
3759
|
-
*/ function
|
|
3760
|
-
return new
|
|
3789
|
+
*/ function yn(t) {
|
|
3790
|
+
return new Ye(t, /* useProto3Json= */ !0);
|
|
3761
3791
|
}
|
|
3762
3792
|
|
|
3763
3793
|
/**
|
|
@@ -3785,7 +3815,7 @@ function mn(t) {
|
|
|
3785
3815
|
* base delay. This prevents clients from accidentally synchronizing their
|
|
3786
3816
|
* delays causing spikes of load to the backend.
|
|
3787
3817
|
*/
|
|
3788
|
-
class
|
|
3818
|
+
class gn {
|
|
3789
3819
|
constructor(
|
|
3790
3820
|
/**
|
|
3791
3821
|
* The AsyncQueue to run backoff operations on.
|
|
@@ -3883,7 +3913,7 @@ class yn {
|
|
|
3883
3913
|
* An implementation of Datastore that exposes additional state for internal
|
|
3884
3914
|
* consumption.
|
|
3885
3915
|
*/
|
|
3886
|
-
class
|
|
3916
|
+
class _n extends class {} {
|
|
3887
3917
|
constructor(t, e, n, r) {
|
|
3888
3918
|
super(), this.authCredentials = t, this.appCheckCredentials = e, this.connection = n,
|
|
3889
3919
|
this.serializer = r, this.J = !1;
|
|
@@ -3910,19 +3940,19 @@ class gn extends class {} {
|
|
|
3910
3940
|
|
|
3911
3941
|
// TODO(firestorexp): Make sure there is only one Datastore instance per
|
|
3912
3942
|
// firestore-exp client.
|
|
3913
|
-
async function
|
|
3914
|
-
const n = T(t), r =
|
|
3915
|
-
writes: e.map((t =>
|
|
3943
|
+
async function vn(t, e) {
|
|
3944
|
+
const n = T(t), r = sn(n.serializer) + "/documents", s = {
|
|
3945
|
+
writes: e.map((t => cn(n.serializer, t)))
|
|
3916
3946
|
};
|
|
3917
3947
|
await n.v("Commit", r, s);
|
|
3918
3948
|
}
|
|
3919
3949
|
|
|
3920
|
-
async function
|
|
3921
|
-
const n = T(t), r =
|
|
3922
|
-
documents: e.map((t =>
|
|
3950
|
+
async function bn(t, e) {
|
|
3951
|
+
const n = T(t), r = sn(n.serializer) + "/documents", s = {
|
|
3952
|
+
documents: e.map((t => en(n.serializer, t)))
|
|
3923
3953
|
}, i = await n.R("BatchGetDocuments", r, s, e.length), o = new Map;
|
|
3924
3954
|
i.forEach((t => {
|
|
3925
|
-
const e =
|
|
3955
|
+
const e = un(n.serializer, t);
|
|
3926
3956
|
o.set(e.key.toString(), e);
|
|
3927
3957
|
}));
|
|
3928
3958
|
const u = [];
|
|
@@ -3932,24 +3962,24 @@ async function vn(t, e) {
|
|
|
3932
3962
|
})), u;
|
|
3933
3963
|
}
|
|
3934
3964
|
|
|
3935
|
-
async function
|
|
3936
|
-
const n = T(t), r =
|
|
3965
|
+
async function En(t, e) {
|
|
3966
|
+
const n = T(t), r = an(n.serializer, Ne(e));
|
|
3937
3967
|
return (await n.R("RunQuery", r.parent, {
|
|
3938
3968
|
structuredQuery: r.structuredQuery
|
|
3939
3969
|
})).filter((t => !!t.document)).map((t => function(t, e, n) {
|
|
3940
|
-
const r =
|
|
3970
|
+
const r = nn(t, e.name), s = Ze(e.updateTime), i = e.createTime ? Ze(e.createTime) : we.min(), o = new be({
|
|
3941
3971
|
mapValue: {
|
|
3942
3972
|
fields: e.fields
|
|
3943
3973
|
}
|
|
3944
|
-
}), u =
|
|
3974
|
+
}), u = Ee.newFoundDocument(r, s, i, o);
|
|
3945
3975
|
return n && u.setHasCommittedMutations(), n ? u.setHasCommittedMutations() : u;
|
|
3946
3976
|
}(n.serializer, t.document, void 0)));
|
|
3947
3977
|
}
|
|
3948
3978
|
|
|
3949
|
-
async function
|
|
3979
|
+
async function In(t, e, n) {
|
|
3950
3980
|
var r;
|
|
3951
3981
|
const s = T(t), {request: i, Z: o} = function(t, e, n) {
|
|
3952
|
-
const r =
|
|
3982
|
+
const r = an(t, e), s = {}, i = [];
|
|
3953
3983
|
let o = 0;
|
|
3954
3984
|
return n.forEach((t => {
|
|
3955
3985
|
// Map all client-side aliases to a unique short-form
|
|
@@ -3962,12 +3992,12 @@ async function En(t, e, n) {
|
|
|
3962
3992
|
}) : "avg" === t.$ ? i.push({
|
|
3963
3993
|
alias: e,
|
|
3964
3994
|
avg: {
|
|
3965
|
-
field:
|
|
3995
|
+
field: dn(t.fieldPath)
|
|
3966
3996
|
}
|
|
3967
3997
|
}) : "sum" === t.$ && i.push({
|
|
3968
3998
|
alias: e,
|
|
3969
3999
|
sum: {
|
|
3970
|
-
field:
|
|
4000
|
+
field: dn(t.fieldPath)
|
|
3971
4001
|
}
|
|
3972
4002
|
});
|
|
3973
4003
|
})), {
|
|
@@ -3980,7 +4010,7 @@ async function En(t, e, n) {
|
|
|
3980
4010
|
},
|
|
3981
4011
|
Z: s
|
|
3982
4012
|
};
|
|
3983
|
-
}(s.serializer,
|
|
4013
|
+
}(s.serializer, Ne(e), n), u = i.parent;
|
|
3984
4014
|
s.connection.g || delete i.parent;
|
|
3985
4015
|
const c = (await s.R("RunAggregationQuery", u, i, /*expectedResponseCount=*/ 1)).filter((t => !!t.result));
|
|
3986
4016
|
// Omit RunAggregationQueryResponse that only contain readTimes.
|
|
@@ -4007,7 +4037,7 @@ async function En(t, e, n) {
|
|
|
4007
4037
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4008
4038
|
* See the License for the specific language governing permissions and
|
|
4009
4039
|
* limitations under the License.
|
|
4010
|
-
*/ const
|
|
4040
|
+
*/ const An = new Map;
|
|
4011
4041
|
|
|
4012
4042
|
/**
|
|
4013
4043
|
* An instance map that ensures only one Datastore exists per Firestore
|
|
@@ -4018,17 +4048,17 @@ async function En(t, e, n) {
|
|
|
4018
4048
|
* instance. Callers must invoke removeComponents() when the Firestore
|
|
4019
4049
|
* instance is terminated.
|
|
4020
4050
|
*/
|
|
4021
|
-
function
|
|
4051
|
+
function Tn(t) {
|
|
4022
4052
|
if (t._terminated) throw new B(O, "The client has already been terminated.");
|
|
4023
|
-
if (!
|
|
4053
|
+
if (!An.has(t)) {
|
|
4024
4054
|
_("ComponentProvider", "Initializing Datastore");
|
|
4025
4055
|
const i = function(t) {
|
|
4026
|
-
return new
|
|
4056
|
+
return new bt(t, fetch.bind(null));
|
|
4027
4057
|
}((e = t._databaseId, n = t.app.options.appId || "", r = t._persistenceKey, s = t._freezeSettings(),
|
|
4028
|
-
new Z(e, n, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), o =
|
|
4029
|
-
return new
|
|
4058
|
+
new Z(e, n, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, ft(s.experimentalLongPollingOptions), s.useFetchStreams))), o = yn(t._databaseId), u = function(t, e, n, r) {
|
|
4059
|
+
return new _n(t, e, n, r);
|
|
4030
4060
|
}(t._authCredentials, t._appCheckCredentials, i, o);
|
|
4031
|
-
|
|
4061
|
+
An.set(t, u);
|
|
4032
4062
|
}
|
|
4033
4063
|
var e, n, r, s;
|
|
4034
4064
|
/**
|
|
@@ -4046,7 +4076,7 @@ function An(t) {
|
|
|
4046
4076
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4047
4077
|
* See the License for the specific language governing permissions and
|
|
4048
4078
|
* limitations under the License.
|
|
4049
|
-
*/ return
|
|
4079
|
+
*/ return An.get(t);
|
|
4050
4080
|
}
|
|
4051
4081
|
|
|
4052
4082
|
/**
|
|
@@ -4058,9 +4088,9 @@ function An(t) {
|
|
|
4058
4088
|
* user-supplied `FirestoreSettings` object. This is a separate type so that
|
|
4059
4089
|
* defaults can be supplied and the value can be checked for equality.
|
|
4060
4090
|
*/
|
|
4061
|
-
class
|
|
4091
|
+
class Rn {
|
|
4062
4092
|
constructor(t) {
|
|
4063
|
-
var e;
|
|
4093
|
+
var e, n;
|
|
4064
4094
|
if (void 0 === t.host) {
|
|
4065
4095
|
if (void 0 !== t.ssl) throw new B($, "Can't provide ssl option if host option is not set");
|
|
4066
4096
|
this.host = "firestore.googleapis.com", this.ssl = true;
|
|
@@ -4073,19 +4103,20 @@ class Tn {
|
|
|
4073
4103
|
!function(t, e, n, r) {
|
|
4074
4104
|
if (!0 === e && !0 === r) throw new B($, `${t} and ${n} cannot be used together.`);
|
|
4075
4105
|
}("experimentalForceLongPolling", t.experimentalForceLongPolling, "experimentalAutoDetectLongPolling", t.experimentalAutoDetectLongPolling),
|
|
4076
|
-
this.experimentalForceLongPolling = !!t.experimentalForceLongPolling, this.experimentalForceLongPolling ? this.experimentalAutoDetectLongPolling = !1 : void 0 === t.experimentalAutoDetectLongPolling ? this.experimentalAutoDetectLongPolling =
|
|
4106
|
+
this.experimentalForceLongPolling = !!t.experimentalForceLongPolling, this.experimentalForceLongPolling ? this.experimentalAutoDetectLongPolling = !1 : void 0 === t.experimentalAutoDetectLongPolling ? this.experimentalAutoDetectLongPolling = true :
|
|
4077
4107
|
// For backwards compatibility, coerce the value to boolean even though
|
|
4078
4108
|
// the TypeScript compiler has narrowed the type to boolean already.
|
|
4079
4109
|
// noinspection PointlessBooleanExpressionJS
|
|
4080
4110
|
this.experimentalAutoDetectLongPolling = !!t.experimentalAutoDetectLongPolling,
|
|
4081
|
-
this.
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
}
|
|
4087
|
-
|
|
4088
|
-
|
|
4111
|
+
this.experimentalLongPollingOptions = ft(null !== (n = t.experimentalLongPollingOptions) && void 0 !== n ? n : {}),
|
|
4112
|
+
function(t) {
|
|
4113
|
+
if (void 0 !== t.timeoutSeconds) {
|
|
4114
|
+
if (isNaN(t.timeoutSeconds)) throw new B($, `invalid long polling timeout: ${t.timeoutSeconds} (must not be NaN)`);
|
|
4115
|
+
if (t.timeoutSeconds < 5) throw new B($, `invalid long polling timeout: ${t.timeoutSeconds} (minimum allowed value is 5)`);
|
|
4116
|
+
if (t.timeoutSeconds > 30) throw new B($, `invalid long polling timeout: ${t.timeoutSeconds} (maximum allowed value is 30)`);
|
|
4117
|
+
}
|
|
4118
|
+
}
|
|
4119
|
+
/**
|
|
4089
4120
|
* @license
|
|
4090
4121
|
* Copyright 2020 Google LLC
|
|
4091
4122
|
*
|
|
@@ -4101,11 +4132,20 @@ class Tn {
|
|
|
4101
4132
|
* See the License for the specific language governing permissions and
|
|
4102
4133
|
* limitations under the License.
|
|
4103
4134
|
*/
|
|
4104
|
-
/**
|
|
4135
|
+
/**
|
|
4105
4136
|
* The Cloud Firestore service interface.
|
|
4106
4137
|
*
|
|
4107
4138
|
* Do not call this constructor directly. Instead, use {@link (getFirestore:1)}.
|
|
4108
|
-
*/
|
|
4139
|
+
*/ (this.experimentalLongPollingOptions), this.useFetchStreams = !!t.useFetchStreams;
|
|
4140
|
+
}
|
|
4141
|
+
isEqual(t) {
|
|
4142
|
+
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,
|
|
4143
|
+
n = t.experimentalLongPollingOptions, e.timeoutSeconds === n.timeoutSeconds) && this.ignoreUndefinedProperties === t.ignoreUndefinedProperties && this.useFetchStreams === t.useFetchStreams;
|
|
4144
|
+
var e, n;
|
|
4145
|
+
}
|
|
4146
|
+
}
|
|
4147
|
+
|
|
4148
|
+
class Pn {
|
|
4109
4149
|
/** @hideconstructor */
|
|
4110
4150
|
constructor(t, e, n, r) {
|
|
4111
4151
|
this._authCredentials = t, this._appCheckCredentials = e, this._databaseId = n,
|
|
@@ -4113,7 +4153,7 @@ class Tn {
|
|
|
4113
4153
|
/**
|
|
4114
4154
|
* Whether it's a Firestore or Firestore Lite instance.
|
|
4115
4155
|
*/
|
|
4116
|
-
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new
|
|
4156
|
+
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new Rn({}),
|
|
4117
4157
|
this._settingsFrozen = !1;
|
|
4118
4158
|
}
|
|
4119
4159
|
/**
|
|
@@ -4131,7 +4171,7 @@ class Tn {
|
|
|
4131
4171
|
}
|
|
4132
4172
|
_setSettings(t) {
|
|
4133
4173
|
if (this._settingsFrozen) throw new B(O, "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.");
|
|
4134
|
-
this._settings = new
|
|
4174
|
+
this._settings = new Rn(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
|
|
4135
4175
|
if (!t) return new W;
|
|
4136
4176
|
switch (t.type) {
|
|
4137
4177
|
case "firstParty":
|
|
@@ -4169,13 +4209,13 @@ class Tn {
|
|
|
4169
4209
|
* Only ever called once.
|
|
4170
4210
|
*/ _terminate() {
|
|
4171
4211
|
return function(t) {
|
|
4172
|
-
const e =
|
|
4173
|
-
e && (_("ComponentProvider", "Removing Datastore"),
|
|
4212
|
+
const e = An.get(t);
|
|
4213
|
+
e && (_("ComponentProvider", "Removing Datastore"), An.delete(t), e.terminate());
|
|
4174
4214
|
}(this), Promise.resolve();
|
|
4175
4215
|
}
|
|
4176
4216
|
}
|
|
4177
4217
|
|
|
4178
|
-
function
|
|
4218
|
+
function Vn(t, e, n) {
|
|
4179
4219
|
n || (n = "(default)");
|
|
4180
4220
|
const r = _getProvider(t, "firestore/lite");
|
|
4181
4221
|
if (r.isInitialized(n)) throw new B(O, "Firestore can only be initialized once per app.");
|
|
@@ -4185,13 +4225,13 @@ function Pn(t, e, n) {
|
|
|
4185
4225
|
});
|
|
4186
4226
|
}
|
|
4187
4227
|
|
|
4188
|
-
function
|
|
4228
|
+
function $n(e, n) {
|
|
4189
4229
|
const r = "object" == typeof e ? e : t(), s = "string" == typeof e ? e : n || "(default)", i = _getProvider(r, "firestore/lite").getImmediate({
|
|
4190
4230
|
identifier: s
|
|
4191
4231
|
});
|
|
4192
4232
|
if (!i._initialized) {
|
|
4193
4233
|
const t = l("firestore");
|
|
4194
|
-
t &&
|
|
4234
|
+
t && Nn(i, ...t);
|
|
4195
4235
|
}
|
|
4196
4236
|
return i;
|
|
4197
4237
|
}
|
|
@@ -4208,9 +4248,9 @@ function Vn(e, n) {
|
|
|
4208
4248
|
* @param port - the emulator port (ex: 9000).
|
|
4209
4249
|
* @param options.mockUserToken - the mock auth token to use for unit testing
|
|
4210
4250
|
* Security Rules.
|
|
4211
|
-
*/ function
|
|
4251
|
+
*/ function Nn(t, e, n, r = {}) {
|
|
4212
4252
|
var s;
|
|
4213
|
-
const i = (t = ht(t,
|
|
4253
|
+
const i = (t = ht(t, Pn))._getSettings();
|
|
4214
4254
|
if ("firestore.googleapis.com" !== i.host && i.host !== e && b("Host has been set in both settings() and useEmulator(), emulator host will be used"),
|
|
4215
4255
|
t._setSettings(Object.assign(Object.assign({}, i), {
|
|
4216
4256
|
host: `${e}:${n}`,
|
|
@@ -4248,8 +4288,8 @@ function Vn(e, n) {
|
|
|
4248
4288
|
* @param firestore - The `Firestore` instance to terminate.
|
|
4249
4289
|
* @returns A `Promise` that is resolved when the instance has been successfully
|
|
4250
4290
|
* terminated.
|
|
4251
|
-
*/ function
|
|
4252
|
-
return t = ht(t,
|
|
4291
|
+
*/ function Dn(t) {
|
|
4292
|
+
return t = ht(t, Pn), e(t.app, "firestore/lite"), t._delete();
|
|
4253
4293
|
}
|
|
4254
4294
|
|
|
4255
4295
|
/**
|
|
@@ -4288,7 +4328,7 @@ function Vn(e, n) {
|
|
|
4288
4328
|
* Represents an aggregation that can be performed by Firestore.
|
|
4289
4329
|
*/
|
|
4290
4330
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4291
|
-
class
|
|
4331
|
+
class Fn {
|
|
4292
4332
|
/**
|
|
4293
4333
|
* Create a new AggregateField<T>
|
|
4294
4334
|
* @param _aggregateType Specifies the type of aggregation operation to perform.
|
|
@@ -4306,7 +4346,7 @@ class Dn {
|
|
|
4306
4346
|
|
|
4307
4347
|
/**
|
|
4308
4348
|
* The results of executing an aggregation query.
|
|
4309
|
-
*/ class
|
|
4349
|
+
*/ class xn {
|
|
4310
4350
|
/** @hideconstructor */
|
|
4311
4351
|
constructor(t, e, n) {
|
|
4312
4352
|
this._userDataWriter = e, this._data = n,
|
|
@@ -4348,7 +4388,7 @@ class Dn {
|
|
|
4348
4388
|
* A `DocumentReference` refers to a document location in a Firestore database
|
|
4349
4389
|
* and can be used to write, read, or listen to the location. The document at
|
|
4350
4390
|
* the referenced location may or may not exist.
|
|
4351
|
-
*/ class
|
|
4391
|
+
*/ class Sn {
|
|
4352
4392
|
/** @hideconstructor */
|
|
4353
4393
|
constructor(t,
|
|
4354
4394
|
/**
|
|
@@ -4376,17 +4416,17 @@ class Dn {
|
|
|
4376
4416
|
/**
|
|
4377
4417
|
* The collection this `DocumentReference` belongs to.
|
|
4378
4418
|
*/ get parent() {
|
|
4379
|
-
return new
|
|
4419
|
+
return new On(this.firestore, this.converter, this._key.path.popLast());
|
|
4380
4420
|
}
|
|
4381
4421
|
withConverter(t) {
|
|
4382
|
-
return new
|
|
4422
|
+
return new Sn(this.firestore, t, this._key);
|
|
4383
4423
|
}
|
|
4384
4424
|
}
|
|
4385
4425
|
|
|
4386
4426
|
/**
|
|
4387
4427
|
* A `Query` refers to a query which you can read or listen to. You can also
|
|
4388
4428
|
* construct refined `Query` objects by adding filters and ordering.
|
|
4389
|
-
*/ class
|
|
4429
|
+
*/ class qn {
|
|
4390
4430
|
// This is the lite version of the Query class in the main SDK.
|
|
4391
4431
|
/** @hideconstructor protected */
|
|
4392
4432
|
constructor(t,
|
|
@@ -4399,17 +4439,17 @@ class Dn {
|
|
|
4399
4439
|
this.type = "query", this.firestore = t;
|
|
4400
4440
|
}
|
|
4401
4441
|
withConverter(t) {
|
|
4402
|
-
return new
|
|
4442
|
+
return new qn(this.firestore, t, this._query);
|
|
4403
4443
|
}
|
|
4404
4444
|
}
|
|
4405
4445
|
|
|
4406
4446
|
/**
|
|
4407
4447
|
* A `CollectionReference` object can be used for adding documents, getting
|
|
4408
4448
|
* document references, and querying for documents (using {@link (query:1)}).
|
|
4409
|
-
*/ class
|
|
4449
|
+
*/ class On extends qn {
|
|
4410
4450
|
/** @hideconstructor */
|
|
4411
4451
|
constructor(t, e, n) {
|
|
4412
|
-
super(t, e, new
|
|
4452
|
+
super(t, e, new Te(n)), this._path = n,
|
|
4413
4453
|
/** The type of this Firestore reference. */
|
|
4414
4454
|
this.type = "collection";
|
|
4415
4455
|
}
|
|
@@ -4427,23 +4467,23 @@ class Dn {
|
|
|
4427
4467
|
* subcollection. If this isn't a subcollection, the reference is null.
|
|
4428
4468
|
*/ get parent() {
|
|
4429
4469
|
const t = this._path.popLast();
|
|
4430
|
-
return t.isEmpty() ? null : new
|
|
4470
|
+
return t.isEmpty() ? null : new Sn(this.firestore,
|
|
4431
4471
|
/* converter= */ null, new it(t));
|
|
4432
4472
|
}
|
|
4433
4473
|
withConverter(t) {
|
|
4434
|
-
return new
|
|
4474
|
+
return new On(this.firestore, t, this._path);
|
|
4435
4475
|
}
|
|
4436
4476
|
}
|
|
4437
4477
|
|
|
4438
|
-
function
|
|
4439
|
-
if (t = d(t), ot("collection", "path", e), t instanceof
|
|
4478
|
+
function kn(t, e, ...n) {
|
|
4479
|
+
if (t = d(t), ot("collection", "path", e), t instanceof Pn) {
|
|
4440
4480
|
const r = nt.fromString(e, ...n);
|
|
4441
|
-
return ct(r), new
|
|
4481
|
+
return ct(r), new On(t, /* converter= */ null, r);
|
|
4442
4482
|
}
|
|
4443
4483
|
{
|
|
4444
|
-
if (!(t instanceof
|
|
4484
|
+
if (!(t instanceof Sn || t instanceof On)) throw new B($, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
4445
4485
|
const r = t._path.child(nt.fromString(e, ...n));
|
|
4446
|
-
return ct(r), new
|
|
4486
|
+
return ct(r), new On(t.firestore,
|
|
4447
4487
|
/* converter= */ null, r);
|
|
4448
4488
|
}
|
|
4449
4489
|
}
|
|
@@ -4460,27 +4500,27 @@ function On(t, e, ...n) {
|
|
|
4460
4500
|
* collection or subcollection with this ID as the last segment of its path
|
|
4461
4501
|
* will be included. Cannot contain a slash.
|
|
4462
4502
|
* @returns The created `Query`.
|
|
4463
|
-
*/ function
|
|
4464
|
-
if (t = ht(t,
|
|
4465
|
-
return new
|
|
4503
|
+
*/ function Cn(t, e) {
|
|
4504
|
+
if (t = ht(t, Pn), ot("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new B($, `Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
|
|
4505
|
+
return new qn(t,
|
|
4466
4506
|
/* converter= */ null, function(t) {
|
|
4467
|
-
return new
|
|
4507
|
+
return new Te(nt.emptyPath(), t);
|
|
4468
4508
|
}(e));
|
|
4469
4509
|
}
|
|
4470
4510
|
|
|
4471
|
-
function
|
|
4511
|
+
function Mn(t, e, ...n) {
|
|
4472
4512
|
if (t = d(t),
|
|
4473
4513
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
4474
4514
|
// 'undefined' and 'null'.
|
|
4475
|
-
1 === arguments.length && (e =
|
|
4515
|
+
1 === arguments.length && (e = At.N()), ot("doc", "path", e), t instanceof Pn) {
|
|
4476
4516
|
const r = nt.fromString(e, ...n);
|
|
4477
|
-
return ut(r), new
|
|
4517
|
+
return ut(r), new Sn(t,
|
|
4478
4518
|
/* converter= */ null, new it(r));
|
|
4479
4519
|
}
|
|
4480
4520
|
{
|
|
4481
|
-
if (!(t instanceof
|
|
4521
|
+
if (!(t instanceof Sn || t instanceof On)) throw new B($, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
4482
4522
|
const r = t._path.child(nt.fromString(e, ...n));
|
|
4483
|
-
return ut(r), new
|
|
4523
|
+
return ut(r), new Sn(t.firestore, t instanceof On ? t.converter : null, new it(r));
|
|
4484
4524
|
}
|
|
4485
4525
|
}
|
|
4486
4526
|
|
|
@@ -4491,8 +4531,8 @@ function Cn(t, e, ...n) {
|
|
|
4491
4531
|
* @param right - A reference to compare.
|
|
4492
4532
|
* @returns true if the references point to the same location in the same
|
|
4493
4533
|
* Firestore database.
|
|
4494
|
-
*/ function
|
|
4495
|
-
return t = d(t), e = d(e), (t instanceof
|
|
4534
|
+
*/ function Ln(t, e) {
|
|
4535
|
+
return t = d(t), e = d(e), (t instanceof Sn || t instanceof On) && (e instanceof Sn || e instanceof On) && (t.firestore === e.firestore && t.path === e.path && t.converter === e.converter);
|
|
4496
4536
|
}
|
|
4497
4537
|
|
|
4498
4538
|
/**
|
|
@@ -4503,8 +4543,8 @@ function Cn(t, e, ...n) {
|
|
|
4503
4543
|
* @param right - A `Query` to compare.
|
|
4504
4544
|
* @returns true if the references point to the same location in the same
|
|
4505
4545
|
* Firestore database.
|
|
4506
|
-
*/ function
|
|
4507
|
-
return t = d(t), e = d(e), t instanceof
|
|
4546
|
+
*/ function jn(t, e) {
|
|
4547
|
+
return t = d(t), e = d(e), t instanceof qn && e instanceof qn && (t.firestore === e.firestore && Fe(t._query, e._query) && t.converter === e.converter);
|
|
4508
4548
|
}
|
|
4509
4549
|
|
|
4510
4550
|
/**
|
|
@@ -4525,7 +4565,7 @@ function Cn(t, e, ...n) {
|
|
|
4525
4565
|
*/
|
|
4526
4566
|
/**
|
|
4527
4567
|
* An immutable object representing an array of bytes.
|
|
4528
|
-
*/ class
|
|
4568
|
+
*/ class Un {
|
|
4529
4569
|
/** @hideconstructor */
|
|
4530
4570
|
constructor(t) {
|
|
4531
4571
|
this._byteString = t;
|
|
@@ -4537,7 +4577,7 @@ function Cn(t, e, ...n) {
|
|
|
4537
4577
|
* @param base64 - The Base64 string used to create the `Bytes` object.
|
|
4538
4578
|
*/ static fromBase64String(t) {
|
|
4539
4579
|
try {
|
|
4540
|
-
return new
|
|
4580
|
+
return new Un(Dt.fromBase64String(t));
|
|
4541
4581
|
} catch (t) {
|
|
4542
4582
|
throw new B($, "Failed to construct data from Base64 string: " + t);
|
|
4543
4583
|
}
|
|
@@ -4547,7 +4587,7 @@ function Cn(t, e, ...n) {
|
|
|
4547
4587
|
*
|
|
4548
4588
|
* @param array - The Uint8Array used to create the `Bytes` object.
|
|
4549
4589
|
*/ static fromUint8Array(t) {
|
|
4550
|
-
return new
|
|
4590
|
+
return new Un(Dt.fromUint8Array(t));
|
|
4551
4591
|
}
|
|
4552
4592
|
/**
|
|
4553
4593
|
* Returns the underlying bytes as a Base64-encoded string.
|
|
@@ -4603,7 +4643,7 @@ function Cn(t, e, ...n) {
|
|
|
4603
4643
|
*
|
|
4604
4644
|
* Create a `FieldPath` by providing field names. If more than one field
|
|
4605
4645
|
* name is provided, the path will point to a nested field in a document.
|
|
4606
|
-
*/ class
|
|
4646
|
+
*/ class Bn {
|
|
4607
4647
|
/**
|
|
4608
4648
|
* Creates a `FieldPath` from the provided field names. If more than one field
|
|
4609
4649
|
* name is provided, the path will point to a nested field in a document.
|
|
@@ -4627,8 +4667,8 @@ function Cn(t, e, ...n) {
|
|
|
4627
4667
|
/**
|
|
4628
4668
|
* Returns a special sentinel `FieldPath` to refer to the ID of a document.
|
|
4629
4669
|
* It can be used in queries to sort or filter by the document ID.
|
|
4630
|
-
*/ function
|
|
4631
|
-
return new
|
|
4670
|
+
*/ function Qn() {
|
|
4671
|
+
return new Bn("__name__");
|
|
4632
4672
|
}
|
|
4633
4673
|
|
|
4634
4674
|
/**
|
|
@@ -4650,7 +4690,7 @@ function Cn(t, e, ...n) {
|
|
|
4650
4690
|
/**
|
|
4651
4691
|
* Sentinel values that can be used when writing document fields with `set()`
|
|
4652
4692
|
* or `update()`.
|
|
4653
|
-
*/ class
|
|
4693
|
+
*/ class zn {
|
|
4654
4694
|
/**
|
|
4655
4695
|
* @param _methodName - The public API endpoint that returns this class.
|
|
4656
4696
|
* @hideconstructor
|
|
@@ -4682,7 +4722,7 @@ function Cn(t, e, ...n) {
|
|
|
4682
4722
|
*
|
|
4683
4723
|
* Latitude values are in the range of [-90, 90].
|
|
4684
4724
|
* Longitude values are in the range of [-180, 180].
|
|
4685
|
-
*/ class
|
|
4725
|
+
*/ class Wn {
|
|
4686
4726
|
/**
|
|
4687
4727
|
* Creates a new immutable `GeoPoint` object with the provided latitude and
|
|
4688
4728
|
* longitude values.
|
|
@@ -4722,7 +4762,7 @@ function Cn(t, e, ...n) {
|
|
|
4722
4762
|
* Actually private to JS consumers of our API, so this function is prefixed
|
|
4723
4763
|
* with an underscore.
|
|
4724
4764
|
*/ _compareTo(t) {
|
|
4725
|
-
return
|
|
4765
|
+
return Tt(this._lat, t._lat) || Tt(this._long, t._long);
|
|
4726
4766
|
}
|
|
4727
4767
|
}
|
|
4728
4768
|
|
|
@@ -4741,29 +4781,29 @@ function Cn(t, e, ...n) {
|
|
|
4741
4781
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4742
4782
|
* See the License for the specific language governing permissions and
|
|
4743
4783
|
* limitations under the License.
|
|
4744
|
-
*/ const
|
|
4784
|
+
*/ const Gn = /^__.*__$/;
|
|
4745
4785
|
|
|
4746
|
-
/** The result of parsing document data (e.g. for a setData call). */ class
|
|
4786
|
+
/** The result of parsing document data (e.g. for a setData call). */ class Kn {
|
|
4747
4787
|
constructor(t, e, n) {
|
|
4748
4788
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
4749
4789
|
}
|
|
4750
4790
|
toMutation(t, e) {
|
|
4751
|
-
return null !== this.fieldMask ? new
|
|
4791
|
+
return null !== this.fieldMask ? new Be(t, this.data, this.fieldMask, e, this.fieldTransforms) : new Ue(t, this.data, e, this.fieldTransforms);
|
|
4752
4792
|
}
|
|
4753
4793
|
}
|
|
4754
4794
|
|
|
4755
|
-
/** The result of parsing "update" data (i.e. for an updateData call). */ class
|
|
4795
|
+
/** The result of parsing "update" data (i.e. for an updateData call). */ class Yn {
|
|
4756
4796
|
constructor(t,
|
|
4757
4797
|
// The fieldMask does not include document transforms.
|
|
4758
4798
|
e, n) {
|
|
4759
4799
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
4760
4800
|
}
|
|
4761
4801
|
toMutation(t, e) {
|
|
4762
|
-
return new
|
|
4802
|
+
return new Be(t, this.data, this.fieldMask, e, this.fieldTransforms);
|
|
4763
4803
|
}
|
|
4764
4804
|
}
|
|
4765
4805
|
|
|
4766
|
-
function
|
|
4806
|
+
function Hn(t) {
|
|
4767
4807
|
switch (t) {
|
|
4768
4808
|
case 0 /* UserDataSource.Set */ :
|
|
4769
4809
|
// fall through
|
|
@@ -4781,7 +4821,7 @@ function Yn(t) {
|
|
|
4781
4821
|
}
|
|
4782
4822
|
}
|
|
4783
4823
|
|
|
4784
|
-
/** A "context" object passed around while parsing user data. */ class
|
|
4824
|
+
/** A "context" object passed around while parsing user data. */ class Jn {
|
|
4785
4825
|
/**
|
|
4786
4826
|
* Initializes a ParseContext with the given source and path.
|
|
4787
4827
|
*
|
|
@@ -4813,7 +4853,7 @@ function Yn(t) {
|
|
|
4813
4853
|
return this.settings.et;
|
|
4814
4854
|
}
|
|
4815
4855
|
/** Returns a new context with the specified settings overwritten. */ nt(t) {
|
|
4816
|
-
return new
|
|
4856
|
+
return new Jn(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.serializer, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
|
|
4817
4857
|
}
|
|
4818
4858
|
rt(t) {
|
|
4819
4859
|
var e;
|
|
@@ -4840,7 +4880,7 @@ function Yn(t) {
|
|
|
4840
4880
|
});
|
|
4841
4881
|
}
|
|
4842
4882
|
ct(t) {
|
|
4843
|
-
return
|
|
4883
|
+
return yr(t, this.settings.methodName, this.settings.at || !1, this.path, this.settings.ht);
|
|
4844
4884
|
}
|
|
4845
4885
|
/** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
|
|
4846
4886
|
return void 0 !== this.fieldMask.find((e => t.isPrefixOf(e))) || void 0 !== this.fieldTransforms.find((e => t.isPrefixOf(e.field)));
|
|
@@ -4852,19 +4892,19 @@ function Yn(t) {
|
|
|
4852
4892
|
}
|
|
4853
4893
|
it(t) {
|
|
4854
4894
|
if (0 === t.length) throw this.ct("Document fields must not be empty");
|
|
4855
|
-
if (
|
|
4895
|
+
if (Hn(this.et) && Gn.test(t)) throw this.ct('Document fields cannot begin and end with "__"');
|
|
4856
4896
|
}
|
|
4857
4897
|
}
|
|
4858
4898
|
|
|
4859
4899
|
/**
|
|
4860
4900
|
* Helper for parsing raw user input (provided via the API) into internal model
|
|
4861
4901
|
* classes.
|
|
4862
|
-
*/ class
|
|
4902
|
+
*/ class Xn {
|
|
4863
4903
|
constructor(t, e, n) {
|
|
4864
|
-
this.databaseId = t, this.ignoreUndefinedProperties = e, this.serializer = n ||
|
|
4904
|
+
this.databaseId = t, this.ignoreUndefinedProperties = e, this.serializer = n || yn(t);
|
|
4865
4905
|
}
|
|
4866
4906
|
/** Creates a new top-level parse context. */ lt(t, e, n, r = !1) {
|
|
4867
|
-
return new
|
|
4907
|
+
return new Jn({
|
|
4868
4908
|
et: t,
|
|
4869
4909
|
methodName: e,
|
|
4870
4910
|
ht: n,
|
|
@@ -4875,29 +4915,29 @@ function Yn(t) {
|
|
|
4875
4915
|
}
|
|
4876
4916
|
}
|
|
4877
4917
|
|
|
4878
|
-
function
|
|
4879
|
-
const e = t._freezeSettings(), n =
|
|
4880
|
-
return new
|
|
4918
|
+
function Zn(t) {
|
|
4919
|
+
const e = t._freezeSettings(), n = yn(t._databaseId);
|
|
4920
|
+
return new Xn(t._databaseId, !!e.ignoreUndefinedProperties, n);
|
|
4881
4921
|
}
|
|
4882
4922
|
|
|
4883
|
-
/** Parse document data from a set() call. */ function
|
|
4923
|
+
/** Parse document data from a set() call. */ function tr(t, e, n, r, s, i = {}) {
|
|
4884
4924
|
const o = t.lt(i.merge || i.mergeFields ? 2 /* UserDataSource.MergeSet */ : 0 /* UserDataSource.Set */ , e, n, s);
|
|
4885
|
-
|
|
4886
|
-
const u =
|
|
4925
|
+
dr("Data must be an object, but it was:", o, r);
|
|
4926
|
+
const u = lr(r, o);
|
|
4887
4927
|
let c, a;
|
|
4888
|
-
if (i.merge) c = new
|
|
4928
|
+
if (i.merge) c = new ve(o.fieldMask), a = o.fieldTransforms; else if (i.mergeFields) {
|
|
4889
4929
|
const t = [];
|
|
4890
4930
|
for (const r of i.mergeFields) {
|
|
4891
|
-
const s =
|
|
4931
|
+
const s = wr(e, r, n);
|
|
4892
4932
|
if (!o.contains(s)) throw new B($, `Field '${s}' is specified in your field mask but missing from your input data.`);
|
|
4893
|
-
|
|
4933
|
+
gr(t, s) || t.push(s);
|
|
4894
4934
|
}
|
|
4895
|
-
c = new
|
|
4935
|
+
c = new ve(t), a = o.fieldTransforms.filter((t => c.covers(t.field)));
|
|
4896
4936
|
} else c = null, a = o.fieldTransforms;
|
|
4897
|
-
return new
|
|
4937
|
+
return new Kn(new be(u), c, a);
|
|
4898
4938
|
}
|
|
4899
4939
|
|
|
4900
|
-
class
|
|
4940
|
+
class er extends zn {
|
|
4901
4941
|
_toFieldTransform(t) {
|
|
4902
4942
|
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}`);
|
|
4903
4943
|
// No transform to add for a delete, but we need to add it to our
|
|
@@ -4905,7 +4945,7 @@ class tr extends Qn {
|
|
|
4905
4945
|
return t.fieldMask.push(t.path), null;
|
|
4906
4946
|
}
|
|
4907
4947
|
isEqual(t) {
|
|
4908
|
-
return t instanceof
|
|
4948
|
+
return t instanceof er;
|
|
4909
4949
|
}
|
|
4910
4950
|
}
|
|
4911
4951
|
|
|
@@ -4924,8 +4964,8 @@ class tr extends Qn {
|
|
|
4924
4964
|
* context.
|
|
4925
4965
|
* @param context - The parent context.
|
|
4926
4966
|
* @param arrayElement - Whether or not the FieldValue has an array.
|
|
4927
|
-
*/ function
|
|
4928
|
-
return new
|
|
4967
|
+
*/ function nr(t, e, n) {
|
|
4968
|
+
return new Jn({
|
|
4929
4969
|
et: 3 /* UserDataSource.Argument */ ,
|
|
4930
4970
|
ht: e.settings.ht,
|
|
4931
4971
|
methodName: t._methodName,
|
|
@@ -4933,23 +4973,23 @@ class tr extends Qn {
|
|
|
4933
4973
|
}, e.databaseId, e.serializer, e.ignoreUndefinedProperties);
|
|
4934
4974
|
}
|
|
4935
4975
|
|
|
4936
|
-
class
|
|
4976
|
+
class rr extends zn {
|
|
4937
4977
|
_toFieldTransform(t) {
|
|
4938
|
-
return new
|
|
4978
|
+
return new Me(t.path, new qe);
|
|
4939
4979
|
}
|
|
4940
4980
|
isEqual(t) {
|
|
4941
|
-
return t instanceof
|
|
4981
|
+
return t instanceof rr;
|
|
4942
4982
|
}
|
|
4943
4983
|
}
|
|
4944
4984
|
|
|
4945
|
-
class
|
|
4985
|
+
class sr extends zn {
|
|
4946
4986
|
constructor(t, e) {
|
|
4947
4987
|
super(t), this.ft = e;
|
|
4948
4988
|
}
|
|
4949
4989
|
_toFieldTransform(t) {
|
|
4950
|
-
const e =
|
|
4951
|
-
/*array=*/ !0), n = this.ft.map((t =>
|
|
4952
|
-
return new
|
|
4990
|
+
const e = nr(this, t,
|
|
4991
|
+
/*array=*/ !0), n = this.ft.map((t => hr(t, e))), r = new Oe(n);
|
|
4992
|
+
return new Me(t.path, r);
|
|
4953
4993
|
}
|
|
4954
4994
|
isEqual(t) {
|
|
4955
4995
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4957,14 +4997,14 @@ class rr extends Qn {
|
|
|
4957
4997
|
}
|
|
4958
4998
|
}
|
|
4959
4999
|
|
|
4960
|
-
class
|
|
5000
|
+
class ir extends zn {
|
|
4961
5001
|
constructor(t, e) {
|
|
4962
5002
|
super(t), this.ft = e;
|
|
4963
5003
|
}
|
|
4964
5004
|
_toFieldTransform(t) {
|
|
4965
|
-
const e =
|
|
4966
|
-
/*array=*/ !0), n = this.ft.map((t =>
|
|
4967
|
-
return new
|
|
5005
|
+
const e = nr(this, t,
|
|
5006
|
+
/*array=*/ !0), n = this.ft.map((t => hr(t, e))), r = new ke(n);
|
|
5007
|
+
return new Me(t.path, r);
|
|
4968
5008
|
}
|
|
4969
5009
|
isEqual(t) {
|
|
4970
5010
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4972,13 +5012,13 @@ class sr extends Qn {
|
|
|
4972
5012
|
}
|
|
4973
5013
|
}
|
|
4974
5014
|
|
|
4975
|
-
class
|
|
5015
|
+
class or extends zn {
|
|
4976
5016
|
constructor(t, e) {
|
|
4977
5017
|
super(t), this.dt = e;
|
|
4978
5018
|
}
|
|
4979
5019
|
_toFieldTransform(t) {
|
|
4980
|
-
const e = new
|
|
4981
|
-
return new
|
|
5020
|
+
const e = new Ce(t.serializer, xe(t.serializer, this.dt));
|
|
5021
|
+
return new Me(t.path, e);
|
|
4982
5022
|
}
|
|
4983
5023
|
isEqual(t) {
|
|
4984
5024
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4986,50 +5026,50 @@ class ir extends Qn {
|
|
|
4986
5026
|
}
|
|
4987
5027
|
}
|
|
4988
5028
|
|
|
4989
|
-
/** Parse update data from an update() call. */ function
|
|
5029
|
+
/** Parse update data from an update() call. */ function ur(t, e, n, r) {
|
|
4990
5030
|
const s = t.lt(1 /* UserDataSource.Update */ , e, n);
|
|
4991
|
-
|
|
4992
|
-
const i = [], o =
|
|
4993
|
-
|
|
4994
|
-
const u =
|
|
5031
|
+
dr("Data must be an object, but it was:", s, r);
|
|
5032
|
+
const i = [], o = be.empty();
|
|
5033
|
+
Vt(r, ((t, r) => {
|
|
5034
|
+
const u = pr(e, t, n);
|
|
4995
5035
|
// For Compat types, we have to "extract" the underlying types before
|
|
4996
5036
|
// performing validation.
|
|
4997
5037
|
r = d(r);
|
|
4998
5038
|
const c = s.ot(u);
|
|
4999
|
-
if (r instanceof
|
|
5039
|
+
if (r instanceof er)
|
|
5000
5040
|
// Add it to the field mask, but don't add anything to updateData.
|
|
5001
5041
|
i.push(u); else {
|
|
5002
|
-
const t =
|
|
5042
|
+
const t = hr(r, c);
|
|
5003
5043
|
null != t && (i.push(u), o.set(u, t));
|
|
5004
5044
|
}
|
|
5005
5045
|
}));
|
|
5006
|
-
const u = new
|
|
5007
|
-
return new
|
|
5046
|
+
const u = new ve(i);
|
|
5047
|
+
return new Yn(o, u, s.fieldTransforms);
|
|
5008
5048
|
}
|
|
5009
5049
|
|
|
5010
|
-
/** Parse update data from a list of field/value arguments. */ function
|
|
5011
|
-
const o = t.lt(1 /* UserDataSource.Update */ , e, n), u = [
|
|
5050
|
+
/** Parse update data from a list of field/value arguments. */ function cr(t, e, n, r, s, i) {
|
|
5051
|
+
const o = t.lt(1 /* UserDataSource.Update */ , e, n), u = [ wr(e, r, n) ], c = [ s ];
|
|
5012
5052
|
if (i.length % 2 != 0) throw new B($, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);
|
|
5013
|
-
for (let t = 0; t < i.length; t += 2) u.push(
|
|
5014
|
-
const a = [], h =
|
|
5053
|
+
for (let t = 0; t < i.length; t += 2) u.push(wr(e, i[t])), c.push(i[t + 1]);
|
|
5054
|
+
const a = [], h = be.empty();
|
|
5015
5055
|
// We iterate in reverse order to pick the last value for a field if the
|
|
5016
5056
|
// user specified the field multiple times.
|
|
5017
|
-
for (let t = u.length - 1; t >= 0; --t) if (!
|
|
5057
|
+
for (let t = u.length - 1; t >= 0; --t) if (!gr(a, u[t])) {
|
|
5018
5058
|
const e = u[t];
|
|
5019
5059
|
let n = c[t];
|
|
5020
5060
|
// For Compat types, we have to "extract" the underlying types before
|
|
5021
5061
|
// performing validation.
|
|
5022
5062
|
n = d(n);
|
|
5023
5063
|
const r = o.ot(e);
|
|
5024
|
-
if (n instanceof
|
|
5064
|
+
if (n instanceof er)
|
|
5025
5065
|
// Add it to the field mask, but don't add anything to updateData.
|
|
5026
5066
|
a.push(e); else {
|
|
5027
|
-
const t =
|
|
5067
|
+
const t = hr(n, r);
|
|
5028
5068
|
null != t && (a.push(e), h.set(e, t));
|
|
5029
5069
|
}
|
|
5030
5070
|
}
|
|
5031
|
-
const l = new
|
|
5032
|
-
return new
|
|
5071
|
+
const l = new ve(a);
|
|
5072
|
+
return new Yn(h, l, o.fieldTransforms);
|
|
5033
5073
|
}
|
|
5034
5074
|
|
|
5035
5075
|
/**
|
|
@@ -5038,8 +5078,8 @@ class ir extends Qn {
|
|
|
5038
5078
|
*
|
|
5039
5079
|
* @param allowArrays - Whether the query value is an array that may directly
|
|
5040
5080
|
* contain additional arrays (e.g. the operand of an `in` query).
|
|
5041
|
-
*/ function
|
|
5042
|
-
return
|
|
5081
|
+
*/ function ar(t, e, n, r = !1) {
|
|
5082
|
+
return hr(n, t.lt(r ? 4 /* UserDataSource.ArrayArgument */ : 3 /* UserDataSource.Argument */ , e));
|
|
5043
5083
|
}
|
|
5044
5084
|
|
|
5045
5085
|
/**
|
|
@@ -5050,12 +5090,12 @@ class ir extends Qn {
|
|
|
5050
5090
|
* the source of the data being parsed, etc.
|
|
5051
5091
|
* @returns The parsed value, or null if the value was a FieldValue sentinel
|
|
5052
5092
|
* that should not be included in the resulting parsed data.
|
|
5053
|
-
*/ function
|
|
5054
|
-
if (
|
|
5093
|
+
*/ function hr(t, e) {
|
|
5094
|
+
if (fr(
|
|
5055
5095
|
// Unwrap the API type from the Compat SDK. This will return the API type
|
|
5056
5096
|
// from firestore-exp.
|
|
5057
|
-
t = d(t))) return
|
|
5058
|
-
if (t instanceof
|
|
5097
|
+
t = d(t))) return dr("Unsupported field value:", e, t), lr(t, e);
|
|
5098
|
+
if (t instanceof zn)
|
|
5059
5099
|
// FieldValues usually parse into transforms (except deleteField())
|
|
5060
5100
|
// in which case we do not want to include this field in our parsed data
|
|
5061
5101
|
// (as doing so will overwrite the field directly prior to the transform
|
|
@@ -5067,7 +5107,7 @@ class ir extends Qn {
|
|
|
5067
5107
|
*/
|
|
5068
5108
|
return function(t, e) {
|
|
5069
5109
|
// Sentinels are only supported with writes, and not within arrays.
|
|
5070
|
-
if (!
|
|
5110
|
+
if (!Hn(e.et)) throw e.ct(`${t._methodName}() can only be used with update() and set()`);
|
|
5071
5111
|
if (!e.path) throw e.ct(`${t._methodName}() is not currently supported inside arrays`);
|
|
5072
5112
|
const n = t._toFieldTransform(e);
|
|
5073
5113
|
n && e.fieldTransforms.push(n);
|
|
@@ -5097,7 +5137,7 @@ class ir extends Qn {
|
|
|
5097
5137
|
const n = [];
|
|
5098
5138
|
let r = 0;
|
|
5099
5139
|
for (const s of t) {
|
|
5100
|
-
let t =
|
|
5140
|
+
let t = hr(s, e.ut(r));
|
|
5101
5141
|
null == t && (
|
|
5102
5142
|
// Just include nulls in the array for fields being replaced with a
|
|
5103
5143
|
// sentinel.
|
|
@@ -5116,7 +5156,7 @@ class ir extends Qn {
|
|
|
5116
5156
|
if (null === (t = d(t))) return {
|
|
5117
5157
|
nullValue: "NULL_VALUE"
|
|
5118
5158
|
};
|
|
5119
|
-
if ("number" == typeof t) return
|
|
5159
|
+
if ("number" == typeof t) return xe(e.serializer, t);
|
|
5120
5160
|
if ("boolean" == typeof t) return {
|
|
5121
5161
|
booleanValue: t
|
|
5122
5162
|
};
|
|
@@ -5124,34 +5164,34 @@ class ir extends Qn {
|
|
|
5124
5164
|
stringValue: t
|
|
5125
5165
|
};
|
|
5126
5166
|
if (t instanceof Date) {
|
|
5127
|
-
const n =
|
|
5167
|
+
const n = Ot.fromDate(t);
|
|
5128
5168
|
return {
|
|
5129
|
-
timestampValue:
|
|
5169
|
+
timestampValue: He(e.serializer, n)
|
|
5130
5170
|
};
|
|
5131
5171
|
}
|
|
5132
|
-
if (t instanceof
|
|
5172
|
+
if (t instanceof Ot) {
|
|
5133
5173
|
// Firestore backend truncates precision down to microseconds. To ensure
|
|
5134
5174
|
// offline mode works the same with regards to truncation, perform the
|
|
5135
5175
|
// truncation immediately without waiting for the backend to do that.
|
|
5136
|
-
const n = new
|
|
5176
|
+
const n = new Ot(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
|
|
5137
5177
|
return {
|
|
5138
|
-
timestampValue:
|
|
5178
|
+
timestampValue: He(e.serializer, n)
|
|
5139
5179
|
};
|
|
5140
5180
|
}
|
|
5141
|
-
if (t instanceof
|
|
5181
|
+
if (t instanceof Wn) return {
|
|
5142
5182
|
geoPointValue: {
|
|
5143
5183
|
latitude: t.latitude,
|
|
5144
5184
|
longitude: t.longitude
|
|
5145
5185
|
}
|
|
5146
5186
|
};
|
|
5147
|
-
if (t instanceof
|
|
5148
|
-
bytesValue:
|
|
5187
|
+
if (t instanceof Un) return {
|
|
5188
|
+
bytesValue: Je(e.serializer, t._byteString)
|
|
5149
5189
|
};
|
|
5150
|
-
if (t instanceof
|
|
5190
|
+
if (t instanceof Sn) {
|
|
5151
5191
|
const n = e.databaseId, r = t.firestore._databaseId;
|
|
5152
5192
|
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}`);
|
|
5153
5193
|
return {
|
|
5154
|
-
referenceValue:
|
|
5194
|
+
referenceValue: tn(t.firestore._databaseId || e.databaseId, t._key.path)
|
|
5155
5195
|
};
|
|
5156
5196
|
}
|
|
5157
5197
|
throw e.ct(`Unsupported field value: ${at(t)}`);
|
|
@@ -5165,13 +5205,13 @@ class ir extends Qn {
|
|
|
5165
5205
|
*/ (t, e);
|
|
5166
5206
|
}
|
|
5167
5207
|
|
|
5168
|
-
function
|
|
5208
|
+
function lr(t, e) {
|
|
5169
5209
|
const n = {};
|
|
5170
5210
|
return !function(t) {
|
|
5171
5211
|
for (const e in t) if (Object.prototype.hasOwnProperty.call(t, e)) return !1;
|
|
5172
5212
|
return !0;
|
|
5173
|
-
}(t) ?
|
|
5174
|
-
const s =
|
|
5213
|
+
}(t) ? Vt(t, ((t, r) => {
|
|
5214
|
+
const s = hr(r, e.rt(t));
|
|
5175
5215
|
null != s && (n[t] = s);
|
|
5176
5216
|
})) :
|
|
5177
5217
|
// If we encounter an empty object, we explicitly add it to the update
|
|
@@ -5183,12 +5223,12 @@ function hr(t, e) {
|
|
|
5183
5223
|
};
|
|
5184
5224
|
}
|
|
5185
5225
|
|
|
5186
|
-
function
|
|
5187
|
-
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof
|
|
5226
|
+
function fr(t) {
|
|
5227
|
+
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof Ot || t instanceof Wn || t instanceof Un || t instanceof Sn || t instanceof zn);
|
|
5188
5228
|
}
|
|
5189
5229
|
|
|
5190
|
-
function
|
|
5191
|
-
if (!
|
|
5230
|
+
function dr(t, e, n) {
|
|
5231
|
+
if (!fr(n) || !function(t) {
|
|
5192
5232
|
return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
|
|
5193
5233
|
}(n)) {
|
|
5194
5234
|
const r = at(n);
|
|
@@ -5198,20 +5238,20 @@ function fr(t, e, n) {
|
|
|
5198
5238
|
|
|
5199
5239
|
/**
|
|
5200
5240
|
* Helper that calls fromDotSeparatedString() but wraps any error thrown.
|
|
5201
|
-
*/ function
|
|
5241
|
+
*/ function wr(t, e, n) {
|
|
5202
5242
|
if ((
|
|
5203
5243
|
// If required, replace the FieldPath Compat class with with the firestore-exp
|
|
5204
5244
|
// FieldPath.
|
|
5205
|
-
e = d(e)) instanceof
|
|
5206
|
-
if ("string" == typeof e) return
|
|
5207
|
-
throw
|
|
5245
|
+
e = d(e)) instanceof Bn) return e._internalPath;
|
|
5246
|
+
if ("string" == typeof e) return pr(t, e);
|
|
5247
|
+
throw yr("Field path arguments must be of type string or ", t,
|
|
5208
5248
|
/* hasConverter= */ !1,
|
|
5209
5249
|
/* path= */ void 0, n);
|
|
5210
5250
|
}
|
|
5211
5251
|
|
|
5212
5252
|
/**
|
|
5213
5253
|
* Matches any characters in a field path string that are reserved.
|
|
5214
|
-
*/ const
|
|
5254
|
+
*/ const mr = new RegExp("[~\\*/\\[\\]]");
|
|
5215
5255
|
|
|
5216
5256
|
/**
|
|
5217
5257
|
* Wraps fromDotSeparatedString with an error message about the method that
|
|
@@ -5221,20 +5261,20 @@ function fr(t, e, n) {
|
|
|
5221
5261
|
* split on dots.
|
|
5222
5262
|
* @param targetDoc - The document against which the field path will be
|
|
5223
5263
|
* evaluated.
|
|
5224
|
-
*/ function
|
|
5225
|
-
if (e.search(
|
|
5264
|
+
*/ function pr(t, e, n) {
|
|
5265
|
+
if (e.search(mr) >= 0) throw yr(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`, t,
|
|
5226
5266
|
/* hasConverter= */ !1,
|
|
5227
5267
|
/* path= */ void 0, n);
|
|
5228
5268
|
try {
|
|
5229
|
-
return new
|
|
5269
|
+
return new Bn(...e.split("."))._internalPath;
|
|
5230
5270
|
} catch (r) {
|
|
5231
|
-
throw
|
|
5271
|
+
throw yr(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t,
|
|
5232
5272
|
/* hasConverter= */ !1,
|
|
5233
5273
|
/* path= */ void 0, n);
|
|
5234
5274
|
}
|
|
5235
5275
|
}
|
|
5236
5276
|
|
|
5237
|
-
function
|
|
5277
|
+
function yr(t, e, n, r, s) {
|
|
5238
5278
|
const i = r && !r.isEmpty(), o = void 0 !== s;
|
|
5239
5279
|
let u = `Function ${e}() called with invalid data`;
|
|
5240
5280
|
n && (u += " (via `toFirestore()`)"), u += ". ";
|
|
@@ -5243,7 +5283,7 @@ function pr(t, e, n, r, s) {
|
|
|
5243
5283
|
c += ")"), new B($, u + t + c);
|
|
5244
5284
|
}
|
|
5245
5285
|
|
|
5246
|
-
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function
|
|
5286
|
+
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function gr(t, e) {
|
|
5247
5287
|
return t.some((t => t.isEqual(e)));
|
|
5248
5288
|
}
|
|
5249
5289
|
|
|
@@ -5271,7 +5311,7 @@ function pr(t, e, n, r, s) {
|
|
|
5271
5311
|
* For a `DocumentSnapshot` that points to a non-existing document, any data
|
|
5272
5312
|
* access will return 'undefined'. You can use the `exists()` method to
|
|
5273
5313
|
* explicitly verify a document's existence.
|
|
5274
|
-
*/ class
|
|
5314
|
+
*/ class _r {
|
|
5275
5315
|
// Note: This class is stripped down version of the DocumentSnapshot in
|
|
5276
5316
|
// the legacy SDK. The changes are:
|
|
5277
5317
|
// - No support for SnapshotMetadata.
|
|
@@ -5287,7 +5327,7 @@ function pr(t, e, n, r, s) {
|
|
|
5287
5327
|
/**
|
|
5288
5328
|
* The `DocumentReference` for the document included in the `DocumentSnapshot`.
|
|
5289
5329
|
*/ get ref() {
|
|
5290
|
-
return new
|
|
5330
|
+
return new Sn(this._firestore, this._converter, this._key);
|
|
5291
5331
|
}
|
|
5292
5332
|
/**
|
|
5293
5333
|
* Signals whether or not the document at the snapshot's location exists.
|
|
@@ -5307,7 +5347,7 @@ function pr(t, e, n, r, s) {
|
|
|
5307
5347
|
if (this._converter) {
|
|
5308
5348
|
// We only want to use the converter and create a new DocumentSnapshot
|
|
5309
5349
|
// if a converter has been provided.
|
|
5310
|
-
const t = new
|
|
5350
|
+
const t = new vr(this._firestore, this._userDataWriter, this._key, this._document,
|
|
5311
5351
|
/* converter= */ null);
|
|
5312
5352
|
return this._converter.fromFirestore(t);
|
|
5313
5353
|
}
|
|
@@ -5327,7 +5367,7 @@ function pr(t, e, n, r, s) {
|
|
|
5327
5367
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5328
5368
|
get(t) {
|
|
5329
5369
|
if (this._document) {
|
|
5330
|
-
const e = this._document.data.field(
|
|
5370
|
+
const e = this._document.data.field(Ir("DocumentSnapshot.get", t));
|
|
5331
5371
|
if (null !== e) return this._userDataWriter.convertValue(e);
|
|
5332
5372
|
}
|
|
5333
5373
|
}
|
|
@@ -5343,7 +5383,7 @@ function pr(t, e, n, r, s) {
|
|
|
5343
5383
|
* `DocumentSnapshot`. Since query results contain only existing documents, the
|
|
5344
5384
|
* `exists` property will always be true and `data()` will never return
|
|
5345
5385
|
* 'undefined'.
|
|
5346
|
-
*/ class
|
|
5386
|
+
*/ class vr extends _r {
|
|
5347
5387
|
/**
|
|
5348
5388
|
* Retrieves all fields in the document as an `Object`.
|
|
5349
5389
|
*
|
|
@@ -5361,7 +5401,7 @@ function pr(t, e, n, r, s) {
|
|
|
5361
5401
|
* array via the `docs` property or enumerated using the `forEach` method. The
|
|
5362
5402
|
* number of documents can be determined via the `empty` and `size`
|
|
5363
5403
|
* properties.
|
|
5364
|
-
*/ class
|
|
5404
|
+
*/ class br {
|
|
5365
5405
|
/** @hideconstructor */
|
|
5366
5406
|
constructor(t, e) {
|
|
5367
5407
|
this._docs = e, this.query = t;
|
|
@@ -5392,14 +5432,14 @@ function pr(t, e, n, r, s) {
|
|
|
5392
5432
|
* @param left - A snapshot to compare.
|
|
5393
5433
|
* @param right - A snapshot to compare.
|
|
5394
5434
|
* @returns true if the snapshots are equal.
|
|
5395
|
-
*/ function
|
|
5396
|
-
return t = d(t), e = d(e), t instanceof
|
|
5435
|
+
*/ function Er(t, e) {
|
|
5436
|
+
return t = d(t), e = d(e), t instanceof _r && e instanceof _r ? 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 br && e instanceof br && (jn(t.query, e.query) && Rt(t.docs, e.docs, Er));
|
|
5397
5437
|
}
|
|
5398
5438
|
|
|
5399
5439
|
/**
|
|
5400
5440
|
* Helper that calls `fromDotSeparatedString()` but wraps any error thrown.
|
|
5401
|
-
*/ function
|
|
5402
|
-
return "string" == typeof e ?
|
|
5441
|
+
*/ function Ir(t, e) {
|
|
5442
|
+
return "string" == typeof e ? pr(t, e) : e instanceof Bn ? e._internalPath : e._delegate._internalPath;
|
|
5403
5443
|
}
|
|
5404
5444
|
|
|
5405
5445
|
/**
|
|
@@ -5422,7 +5462,7 @@ function pr(t, e, n, r, s) {
|
|
|
5422
5462
|
* An `AppliableConstraint` is an abstraction of a constraint that can be applied
|
|
5423
5463
|
* to a Firestore query.
|
|
5424
5464
|
*/
|
|
5425
|
-
class
|
|
5465
|
+
class Ar {}
|
|
5426
5466
|
|
|
5427
5467
|
/**
|
|
5428
5468
|
* A `QueryConstraint` is used to narrow the set of documents returned by a
|
|
@@ -5431,12 +5471,12 @@ class Ir {}
|
|
|
5431
5471
|
* (endBefore:1)}, {@link (endAt:1)}, {@link limit}, {@link limitToLast} and
|
|
5432
5472
|
* can then be passed to {@link (query:1)} to create a new query instance that
|
|
5433
5473
|
* also contains this `QueryConstraint`.
|
|
5434
|
-
*/ class
|
|
5474
|
+
*/ class Tr extends Ar {}
|
|
5435
5475
|
|
|
5436
|
-
function
|
|
5476
|
+
function Rr(t, e, ...n) {
|
|
5437
5477
|
let r = [];
|
|
5438
|
-
e instanceof
|
|
5439
|
-
const e = t.filter((t => t instanceof
|
|
5478
|
+
e instanceof Ar && r.push(e), r = r.concat(n), function(t) {
|
|
5479
|
+
const e = t.filter((t => t instanceof $r)).length, n = t.filter((t => t instanceof Pr)).length;
|
|
5440
5480
|
if (e > 1 || e > 0 && n > 0) throw new B($, "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(...)))`.");
|
|
5441
5481
|
}
|
|
5442
5482
|
/**
|
|
@@ -5471,7 +5511,7 @@ function Tr(t, e, ...n) {
|
|
|
5471
5511
|
* `QueryFieldFilterConstraint`s are created by invoking {@link where} and can then
|
|
5472
5512
|
* be passed to {@link (query:1)} to create a new query instance that also contains
|
|
5473
5513
|
* this `QueryFieldFilterConstraint`.
|
|
5474
|
-
*/ class
|
|
5514
|
+
*/ class Pr extends Tr {
|
|
5475
5515
|
/**
|
|
5476
5516
|
* @internal
|
|
5477
5517
|
*/
|
|
@@ -5481,31 +5521,31 @@ function Tr(t, e, ...n) {
|
|
|
5481
5521
|
this.type = "where";
|
|
5482
5522
|
}
|
|
5483
5523
|
static _create(t, e, n) {
|
|
5484
|
-
return new
|
|
5524
|
+
return new Pr(t, e, n);
|
|
5485
5525
|
}
|
|
5486
5526
|
_apply(t) {
|
|
5487
5527
|
const e = this._parse(t);
|
|
5488
|
-
return
|
|
5528
|
+
return Wr(t._query, e), new qn(t.firestore, t.converter, De(t._query, e));
|
|
5489
5529
|
}
|
|
5490
5530
|
_parse(t) {
|
|
5491
|
-
const e =
|
|
5531
|
+
const e = Zn(t.firestore), n = function(t, e, n, r, s, i, o) {
|
|
5492
5532
|
let u;
|
|
5493
5533
|
if (s.isKeyField()) {
|
|
5494
5534
|
if ("array-contains" /* Operator.ARRAY_CONTAINS */ === i || "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ === i) throw new B($, `Invalid Query. You can't perform '${i}' queries on documentId().`);
|
|
5495
5535
|
if ("in" /* Operator.IN */ === i || "not-in" /* Operator.NOT_IN */ === i) {
|
|
5496
|
-
|
|
5536
|
+
zr(o, i);
|
|
5497
5537
|
const e = [];
|
|
5498
|
-
for (const n of o) e.push(
|
|
5538
|
+
for (const n of o) e.push(Qr(r, t, n));
|
|
5499
5539
|
u = {
|
|
5500
5540
|
arrayValue: {
|
|
5501
5541
|
values: e
|
|
5502
5542
|
}
|
|
5503
5543
|
};
|
|
5504
|
-
} else u =
|
|
5505
|
-
} else "in" /* Operator.IN */ !== i && "not-in" /* Operator.NOT_IN */ !== i && "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ !== i ||
|
|
5506
|
-
u =
|
|
5544
|
+
} else u = Qr(r, t, o);
|
|
5545
|
+
} else "in" /* Operator.IN */ !== i && "not-in" /* Operator.NOT_IN */ !== i && "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ !== i || zr(o, i),
|
|
5546
|
+
u = ar(n, e, o,
|
|
5507
5547
|
/* allowArrays= */ "in" /* Operator.IN */ === i || "not-in" /* Operator.NOT_IN */ === i);
|
|
5508
|
-
return
|
|
5548
|
+
return ee.create(s, i, u);
|
|
5509
5549
|
}(t._query, "where", e, t.firestore._databaseId, this._field, this._op, this._value);
|
|
5510
5550
|
return n;
|
|
5511
5551
|
}
|
|
@@ -5521,9 +5561,9 @@ function Tr(t, e, ...n) {
|
|
|
5521
5561
|
* "<=", "!=").
|
|
5522
5562
|
* @param value - The value for comparison
|
|
5523
5563
|
* @returns The created {@link QueryFieldFilterConstraint}.
|
|
5524
|
-
*/ function
|
|
5525
|
-
const r = e, s =
|
|
5526
|
-
return
|
|
5564
|
+
*/ function Vr(t, e, n) {
|
|
5565
|
+
const r = e, s = Ir("where", t);
|
|
5566
|
+
return Pr._create(s, r, n);
|
|
5527
5567
|
}
|
|
5528
5568
|
|
|
5529
5569
|
/**
|
|
@@ -5533,7 +5573,7 @@ function Tr(t, e, ...n) {
|
|
|
5533
5573
|
* `QueryCompositeFilterConstraint`s are created by invoking {@link or} or
|
|
5534
5574
|
* {@link and} and can then be passed to {@link (query:1)} to create a new query
|
|
5535
5575
|
* instance that also contains the `QueryCompositeFilterConstraint`.
|
|
5536
|
-
*/ class
|
|
5576
|
+
*/ class $r extends Ar {
|
|
5537
5577
|
/**
|
|
5538
5578
|
* @internal
|
|
5539
5579
|
*/
|
|
@@ -5543,22 +5583,22 @@ function Tr(t, e, ...n) {
|
|
|
5543
5583
|
super(), this.type = t, this._queryConstraints = e;
|
|
5544
5584
|
}
|
|
5545
5585
|
static _create(t, e) {
|
|
5546
|
-
return new
|
|
5586
|
+
return new $r(t, e);
|
|
5547
5587
|
}
|
|
5548
5588
|
_parse(t) {
|
|
5549
5589
|
const e = this._queryConstraints.map((e => e._parse(t))).filter((t => t.getFilters().length > 0));
|
|
5550
|
-
return 1 === e.length ? e[0] :
|
|
5590
|
+
return 1 === e.length ? e[0] : ne.create(e, this._getOperator());
|
|
5551
5591
|
}
|
|
5552
5592
|
_apply(t) {
|
|
5553
5593
|
const e = this._parse(t);
|
|
5554
5594
|
return 0 === e.getFilters().length ? t : (function(t, e) {
|
|
5555
5595
|
let n = t;
|
|
5556
5596
|
const r = e.getFlattenedFilters();
|
|
5557
|
-
for (const t of r)
|
|
5597
|
+
for (const t of r) Wr(n, t), n = De(n, t);
|
|
5558
5598
|
}
|
|
5559
5599
|
// Checks if any of the provided filter operators are included in the given list of filters and
|
|
5560
5600
|
// returns the first one that is, or null if none are.
|
|
5561
|
-
(t._query, e), new
|
|
5601
|
+
(t._query, e), new qn(t.firestore, t.converter, De(t._query, e)));
|
|
5562
5602
|
}
|
|
5563
5603
|
_getQueryConstraints() {
|
|
5564
5604
|
return this._queryConstraints;
|
|
@@ -5577,9 +5617,9 @@ function Tr(t, e, ...n) {
|
|
|
5577
5617
|
* {@link QueryFilterConstraint}s to perform a disjunction for. These must be
|
|
5578
5618
|
* created with calls to {@link where}, {@link or}, or {@link and}.
|
|
5579
5619
|
* @returns The newly created {@link QueryCompositeFilterConstraint}.
|
|
5580
|
-
*/ function
|
|
5620
|
+
*/ function Nr(...t) {
|
|
5581
5621
|
// Only support QueryFilterConstraints
|
|
5582
|
-
return t.forEach((t =>
|
|
5622
|
+
return t.forEach((t => Kr("or", t))), $r._create("or" /* CompositeOperator.OR */ , t);
|
|
5583
5623
|
}
|
|
5584
5624
|
|
|
5585
5625
|
/**
|
|
@@ -5591,9 +5631,9 @@ function Tr(t, e, ...n) {
|
|
|
5591
5631
|
* {@link QueryFilterConstraint}s to perform a conjunction for. These must be
|
|
5592
5632
|
* created with calls to {@link where}, {@link or}, or {@link and}.
|
|
5593
5633
|
* @returns The newly created {@link QueryCompositeFilterConstraint}.
|
|
5594
|
-
*/ function
|
|
5634
|
+
*/ function Dr(...t) {
|
|
5595
5635
|
// Only support QueryFilterConstraints
|
|
5596
|
-
return t.forEach((t =>
|
|
5636
|
+
return t.forEach((t => Kr("and", t))), $r._create("and" /* CompositeOperator.AND */ , t);
|
|
5597
5637
|
}
|
|
5598
5638
|
|
|
5599
5639
|
/**
|
|
@@ -5604,7 +5644,7 @@ function Tr(t, e, ...n) {
|
|
|
5604
5644
|
*
|
|
5605
5645
|
* Note: Documents that do not contain the orderBy field will not be present in
|
|
5606
5646
|
* the query result.
|
|
5607
|
-
*/ class
|
|
5647
|
+
*/ class Fr extends Tr {
|
|
5608
5648
|
/**
|
|
5609
5649
|
* @internal
|
|
5610
5650
|
*/
|
|
@@ -5614,18 +5654,18 @@ function Tr(t, e, ...n) {
|
|
|
5614
5654
|
this.type = "orderBy";
|
|
5615
5655
|
}
|
|
5616
5656
|
static _create(t, e) {
|
|
5617
|
-
return new
|
|
5657
|
+
return new Fr(t, e);
|
|
5618
5658
|
}
|
|
5619
5659
|
_apply(t) {
|
|
5620
5660
|
const e = function(t, e, n) {
|
|
5621
5661
|
if (null !== t.startAt) throw new B($, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
|
|
5622
5662
|
if (null !== t.endAt) throw new B($, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
|
|
5623
|
-
const r = new
|
|
5663
|
+
const r = new fe(e, n);
|
|
5624
5664
|
return function(t, e) {
|
|
5625
|
-
if (null ===
|
|
5665
|
+
if (null === Re(t)) {
|
|
5626
5666
|
// This is the first order by. It must match any inequality.
|
|
5627
|
-
const n =
|
|
5628
|
-
null !== n &&
|
|
5667
|
+
const n = Pe(t);
|
|
5668
|
+
null !== n && Gr(t, n, e.field);
|
|
5629
5669
|
}
|
|
5630
5670
|
}(t, r), r;
|
|
5631
5671
|
}
|
|
@@ -5640,10 +5680,10 @@ function Tr(t, e, ...n) {
|
|
|
5640
5680
|
* of the query or if any of the fields in the order by are an uncommitted
|
|
5641
5681
|
* server timestamp.
|
|
5642
5682
|
*/ (t._query, this._field, this._direction);
|
|
5643
|
-
return new
|
|
5683
|
+
return new qn(t.firestore, t.converter, function(t, e) {
|
|
5644
5684
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
5645
5685
|
const n = t.explicitOrderBy.concat([ e ]);
|
|
5646
|
-
return new
|
|
5686
|
+
return new Te(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
|
|
5647
5687
|
}(t._query, e));
|
|
5648
5688
|
}
|
|
5649
5689
|
}
|
|
@@ -5659,9 +5699,9 @@ function Tr(t, e, ...n) {
|
|
|
5659
5699
|
* @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
|
|
5660
5700
|
* not specified, order will be ascending.
|
|
5661
5701
|
* @returns The created {@link QueryOrderByConstraint}.
|
|
5662
|
-
*/ function
|
|
5663
|
-
const n = e, r =
|
|
5664
|
-
return
|
|
5702
|
+
*/ function xr(t, e = "asc") {
|
|
5703
|
+
const n = e, r = Ir("orderBy", t);
|
|
5704
|
+
return Fr._create(r, n);
|
|
5665
5705
|
}
|
|
5666
5706
|
|
|
5667
5707
|
/**
|
|
@@ -5670,7 +5710,7 @@ function Tr(t, e, ...n) {
|
|
|
5670
5710
|
* `QueryLimitConstraint`s are created by invoking {@link limit} or
|
|
5671
5711
|
* {@link limitToLast} and can then be passed to {@link (query:1)} to create a new
|
|
5672
5712
|
* query instance that also contains this `QueryLimitConstraint`.
|
|
5673
|
-
*/ class
|
|
5713
|
+
*/ class Sr extends Tr {
|
|
5674
5714
|
/**
|
|
5675
5715
|
* @internal
|
|
5676
5716
|
*/
|
|
@@ -5680,11 +5720,11 @@ function Tr(t, e, ...n) {
|
|
|
5680
5720
|
super(), this.type = t, this._limit = e, this._limitType = n;
|
|
5681
5721
|
}
|
|
5682
5722
|
static _create(t, e, n) {
|
|
5683
|
-
return new
|
|
5723
|
+
return new Sr(t, e, n);
|
|
5684
5724
|
}
|
|
5685
5725
|
_apply(t) {
|
|
5686
|
-
return new
|
|
5687
|
-
return new
|
|
5726
|
+
return new qn(t.firestore, t.converter, function(t, e, n) {
|
|
5727
|
+
return new Te(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
|
|
5688
5728
|
}(t._query, this._limit, this._limitType));
|
|
5689
5729
|
}
|
|
5690
5730
|
}
|
|
@@ -5695,8 +5735,8 @@ function Tr(t, e, ...n) {
|
|
|
5695
5735
|
*
|
|
5696
5736
|
* @param limit - The maximum number of items to return.
|
|
5697
5737
|
* @returns The created {@link QueryLimitConstraint}.
|
|
5698
|
-
*/ function
|
|
5699
|
-
return lt("limit", t),
|
|
5738
|
+
*/ function qr(t) {
|
|
5739
|
+
return lt("limit", t), Sr._create("limit", t, "F" /* LimitType.First */);
|
|
5700
5740
|
}
|
|
5701
5741
|
|
|
5702
5742
|
/**
|
|
@@ -5708,8 +5748,8 @@ function Tr(t, e, ...n) {
|
|
|
5708
5748
|
*
|
|
5709
5749
|
* @param limit - The maximum number of items to return.
|
|
5710
5750
|
* @returns The created {@link QueryLimitConstraint}.
|
|
5711
|
-
*/ function
|
|
5712
|
-
return lt("limitToLast", t),
|
|
5751
|
+
*/ function Or(t) {
|
|
5752
|
+
return lt("limitToLast", t), Sr._create("limitToLast", t, "L" /* LimitType.Last */);
|
|
5713
5753
|
}
|
|
5714
5754
|
|
|
5715
5755
|
/**
|
|
@@ -5718,7 +5758,7 @@ function Tr(t, e, ...n) {
|
|
|
5718
5758
|
* `QueryStartAtConstraint`s are created by invoking {@link (startAt:1)} or
|
|
5719
5759
|
* {@link (startAfter:1)} and can then be passed to {@link (query:1)} to create a
|
|
5720
5760
|
* new query instance that also contains this `QueryStartAtConstraint`.
|
|
5721
|
-
*/ class
|
|
5761
|
+
*/ class kr extends Tr {
|
|
5722
5762
|
/**
|
|
5723
5763
|
* @internal
|
|
5724
5764
|
*/
|
|
@@ -5728,23 +5768,23 @@ function Tr(t, e, ...n) {
|
|
|
5728
5768
|
super(), this.type = t, this._docOrFields = e, this._inclusive = n;
|
|
5729
5769
|
}
|
|
5730
5770
|
static _create(t, e, n) {
|
|
5731
|
-
return new
|
|
5771
|
+
return new kr(t, e, n);
|
|
5732
5772
|
}
|
|
5733
5773
|
_apply(t) {
|
|
5734
|
-
const e =
|
|
5735
|
-
return new
|
|
5736
|
-
return new
|
|
5774
|
+
const e = Br(t, this.type, this._docOrFields, this._inclusive);
|
|
5775
|
+
return new qn(t.firestore, t.converter, function(t, e) {
|
|
5776
|
+
return new Te(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
|
|
5737
5777
|
}(t._query, e));
|
|
5738
5778
|
}
|
|
5739
5779
|
}
|
|
5740
5780
|
|
|
5741
|
-
function
|
|
5742
|
-
return
|
|
5781
|
+
function Cr(...t) {
|
|
5782
|
+
return kr._create("startAt", t,
|
|
5743
5783
|
/*inclusive=*/ !0);
|
|
5744
5784
|
}
|
|
5745
5785
|
|
|
5746
|
-
function
|
|
5747
|
-
return
|
|
5786
|
+
function Mr(...t) {
|
|
5787
|
+
return kr._create("startAfter", t,
|
|
5748
5788
|
/*inclusive=*/ !1);
|
|
5749
5789
|
}
|
|
5750
5790
|
|
|
@@ -5754,7 +5794,7 @@ function Cr(...t) {
|
|
|
5754
5794
|
* `QueryEndAtConstraint`s are created by invoking {@link (endAt:1)} or
|
|
5755
5795
|
* {@link (endBefore:1)} and can then be passed to {@link (query:1)} to create a new
|
|
5756
5796
|
* query instance that also contains this `QueryEndAtConstraint`.
|
|
5757
|
-
*/ class
|
|
5797
|
+
*/ class Lr extends Tr {
|
|
5758
5798
|
/**
|
|
5759
5799
|
* @internal
|
|
5760
5800
|
*/
|
|
@@ -5764,28 +5804,28 @@ function Cr(...t) {
|
|
|
5764
5804
|
super(), this.type = t, this._docOrFields = e, this._inclusive = n;
|
|
5765
5805
|
}
|
|
5766
5806
|
static _create(t, e, n) {
|
|
5767
|
-
return new
|
|
5807
|
+
return new Lr(t, e, n);
|
|
5768
5808
|
}
|
|
5769
5809
|
_apply(t) {
|
|
5770
|
-
const e =
|
|
5771
|
-
return new
|
|
5772
|
-
return new
|
|
5810
|
+
const e = Br(t, this.type, this._docOrFields, this._inclusive);
|
|
5811
|
+
return new qn(t.firestore, t.converter, function(t, e) {
|
|
5812
|
+
return new Te(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
|
|
5773
5813
|
}(t._query, e));
|
|
5774
5814
|
}
|
|
5775
5815
|
}
|
|
5776
5816
|
|
|
5777
|
-
function
|
|
5778
|
-
return
|
|
5817
|
+
function jr(...t) {
|
|
5818
|
+
return Lr._create("endBefore", t,
|
|
5779
5819
|
/*inclusive=*/ !1);
|
|
5780
5820
|
}
|
|
5781
5821
|
|
|
5782
|
-
function
|
|
5783
|
-
return
|
|
5822
|
+
function Ur(...t) {
|
|
5823
|
+
return Lr._create("endAt", t,
|
|
5784
5824
|
/*inclusive=*/ !0);
|
|
5785
5825
|
}
|
|
5786
5826
|
|
|
5787
|
-
/** Helper function to create a bound from a document or fields */ function
|
|
5788
|
-
if (n[0] = d(n[0]), n[0] instanceof
|
|
5827
|
+
/** Helper function to create a bound from a document or fields */ function Br(t, e, n, r) {
|
|
5828
|
+
if (n[0] = d(n[0]), n[0] instanceof _r) return function(t, e, n, r, s) {
|
|
5789
5829
|
if (!r) throw new B(D, `Can't use a DocumentSnapshot that doesn't exist for ${n}().`);
|
|
5790
5830
|
const i = [];
|
|
5791
5831
|
// Because people expect to continue/end a query at the exact document
|
|
@@ -5795,22 +5835,22 @@ function jr(...t) {
|
|
|
5795
5835
|
// the provided document. Without the key (by using the explicit sort
|
|
5796
5836
|
// orders), multiple documents could match the position, yielding duplicate
|
|
5797
5837
|
// results.
|
|
5798
|
-
for (const n of
|
|
5838
|
+
for (const n of $e(t)) if (n.field.isKeyField()) i.push(Wt(e, r.key)); else {
|
|
5799
5839
|
const t = r.data.field(n.field);
|
|
5800
|
-
if (
|
|
5840
|
+
if (kt(t)) throw new B($, '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.)');
|
|
5801
5841
|
if (null === t) {
|
|
5802
5842
|
const t = n.field.canonicalString();
|
|
5803
5843
|
throw new B($, `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.`);
|
|
5804
5844
|
}
|
|
5805
5845
|
i.push(t);
|
|
5806
5846
|
}
|
|
5807
|
-
return new
|
|
5847
|
+
return new Xt(i, s);
|
|
5808
5848
|
}
|
|
5809
5849
|
/**
|
|
5810
5850
|
* Converts a list of field values to a `Bound` for the given query.
|
|
5811
5851
|
*/ (t._query, t.firestore._databaseId, e, n[0]._document, r);
|
|
5812
5852
|
{
|
|
5813
|
-
const s =
|
|
5853
|
+
const s = Zn(t.firestore);
|
|
5814
5854
|
return function(t, e, n, r, s, i) {
|
|
5815
5855
|
// Use explicit order by's because it has to match the query the user made
|
|
5816
5856
|
const o = t.explicitOrderBy;
|
|
@@ -5820,17 +5860,17 @@ function jr(...t) {
|
|
|
5820
5860
|
const c = s[i];
|
|
5821
5861
|
if (o[i].field.isKeyField()) {
|
|
5822
5862
|
if ("string" != typeof c) throw new B($, `Invalid query. Expected a string for document ID in ${r}(), but got a ${typeof c}`);
|
|
5823
|
-
if (!
|
|
5863
|
+
if (!Ve(t) && -1 !== c.indexOf("/")) throw new B($, `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.`);
|
|
5824
5864
|
const n = t.path.child(nt.fromString(c));
|
|
5825
5865
|
if (!it.isDocumentKey(n)) throw new B($, `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.`);
|
|
5826
5866
|
const s = new it(n);
|
|
5827
|
-
u.push(
|
|
5867
|
+
u.push(Wt(e, s));
|
|
5828
5868
|
} else {
|
|
5829
|
-
const t =
|
|
5869
|
+
const t = ar(n, r, c);
|
|
5830
5870
|
u.push(t);
|
|
5831
5871
|
}
|
|
5832
5872
|
}
|
|
5833
|
-
return new
|
|
5873
|
+
return new Xt(u, i);
|
|
5834
5874
|
}
|
|
5835
5875
|
/**
|
|
5836
5876
|
* Parses the given `documentIdValue` into a `ReferenceValue`, throwing
|
|
@@ -5840,22 +5880,22 @@ function jr(...t) {
|
|
|
5840
5880
|
}
|
|
5841
5881
|
}
|
|
5842
5882
|
|
|
5843
|
-
function
|
|
5883
|
+
function Qr(t, e, n) {
|
|
5844
5884
|
if ("string" == typeof (n = d(n))) {
|
|
5845
5885
|
if ("" === n) throw new B($, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
|
|
5846
|
-
if (!
|
|
5886
|
+
if (!Ve(e) && -1 !== n.indexOf("/")) throw new B($, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);
|
|
5847
5887
|
const r = e.path.child(nt.fromString(n));
|
|
5848
5888
|
if (!it.isDocumentKey(r)) throw new B($, `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}).`);
|
|
5849
|
-
return
|
|
5889
|
+
return Wt(t, new it(r));
|
|
5850
5890
|
}
|
|
5851
|
-
if (n instanceof
|
|
5891
|
+
if (n instanceof Sn) return Wt(t, n._key);
|
|
5852
5892
|
throw new B($, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${at(n)}.`);
|
|
5853
5893
|
}
|
|
5854
5894
|
|
|
5855
5895
|
/**
|
|
5856
5896
|
* Validates that the value passed into a disjunctive filter satisfies all
|
|
5857
5897
|
* array requirements.
|
|
5858
|
-
*/ function
|
|
5898
|
+
*/ function zr(t, e) {
|
|
5859
5899
|
if (!Array.isArray(t) || 0 === t.length) throw new B($, `Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);
|
|
5860
5900
|
}
|
|
5861
5901
|
|
|
@@ -5868,12 +5908,12 @@ function Br(t, e, n) {
|
|
|
5868
5908
|
* Operators in a query must adhere to the following set of rules:
|
|
5869
5909
|
* 1. Only one inequality per query.
|
|
5870
5910
|
* 2. `NOT_IN` cannot be used with array, disjunctive, or `NOT_EQUAL` operators.
|
|
5871
|
-
*/ function
|
|
5911
|
+
*/ function Wr(t, e) {
|
|
5872
5912
|
if (e.isInequality()) {
|
|
5873
|
-
const n =
|
|
5913
|
+
const n = Pe(t), r = e.field;
|
|
5874
5914
|
if (null !== n && !n.isEqual(r)) throw new B($, `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()}'`);
|
|
5875
|
-
const s =
|
|
5876
|
-
null !== s &&
|
|
5915
|
+
const s = Re(t);
|
|
5916
|
+
null !== s && Gr(t, r, s);
|
|
5877
5917
|
}
|
|
5878
5918
|
const n = function(t, e) {
|
|
5879
5919
|
for (const n of t) for (const t of n.getFlattenedFilters()) if (e.indexOf(t.op) >= 0) return t.op;
|
|
@@ -5899,12 +5939,12 @@ function Br(t, e, n) {
|
|
|
5899
5939
|
throw n === e.op ? new B($, `Invalid query. You cannot use more than one '${e.op.toString()}' filter.`) : new B($, `Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`);
|
|
5900
5940
|
}
|
|
5901
5941
|
|
|
5902
|
-
function
|
|
5942
|
+
function Gr(t, e, n) {
|
|
5903
5943
|
if (!n.isEqual(e)) throw new B($, `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.`);
|
|
5904
5944
|
}
|
|
5905
5945
|
|
|
5906
|
-
function
|
|
5907
|
-
if (!(e instanceof
|
|
5946
|
+
function Kr(t, e) {
|
|
5947
|
+
if (!(e instanceof Pr || e instanceof $r)) throw new B($, `Function ${t}() requires AppliableConstraints created with a call to 'where(...)', 'or(...)', or 'and(...)'.`);
|
|
5908
5948
|
}
|
|
5909
5949
|
|
|
5910
5950
|
/**
|
|
@@ -5932,7 +5972,7 @@ function Gr(t, e) {
|
|
|
5932
5972
|
* their `set()` or fails due to invalid data originating from a `toFirestore()`
|
|
5933
5973
|
* call.
|
|
5934
5974
|
*/
|
|
5935
|
-
function
|
|
5975
|
+
function Yr(t, e, n) {
|
|
5936
5976
|
let r;
|
|
5937
5977
|
// Cast to `any` in order to satisfy the union type constraint on
|
|
5938
5978
|
// toFirestore().
|
|
@@ -5941,9 +5981,9 @@ function Kr(t, e, n) {
|
|
|
5941
5981
|
r;
|
|
5942
5982
|
}
|
|
5943
5983
|
|
|
5944
|
-
class
|
|
5984
|
+
class Hr extends class {
|
|
5945
5985
|
convertValue(t, e = "none") {
|
|
5946
|
-
switch (
|
|
5986
|
+
switch (jt(t)) {
|
|
5947
5987
|
case 0 /* TypeOrder.NullValue */ :
|
|
5948
5988
|
return null;
|
|
5949
5989
|
|
|
@@ -5951,7 +5991,7 @@ class Yr extends class {
|
|
|
5951
5991
|
return t.booleanValue;
|
|
5952
5992
|
|
|
5953
5993
|
case 2 /* TypeOrder.NumberValue */ :
|
|
5954
|
-
return
|
|
5994
|
+
return St(t.integerValue || t.doubleValue);
|
|
5955
5995
|
|
|
5956
5996
|
case 3 /* TypeOrder.TimestampValue */ :
|
|
5957
5997
|
return this.convertTimestamp(t.timestampValue);
|
|
@@ -5963,7 +6003,7 @@ class Yr extends class {
|
|
|
5963
6003
|
return t.stringValue;
|
|
5964
6004
|
|
|
5965
6005
|
case 6 /* TypeOrder.BlobValue */ :
|
|
5966
|
-
return this.convertBytes(
|
|
6006
|
+
return this.convertBytes(qt(t.bytesValue));
|
|
5967
6007
|
|
|
5968
6008
|
case 7 /* TypeOrder.RefValue */ :
|
|
5969
6009
|
return this.convertReference(t.referenceValue);
|
|
@@ -5988,12 +6028,12 @@ class Yr extends class {
|
|
|
5988
6028
|
* @internal
|
|
5989
6029
|
*/ convertObjectMap(t, e = "none") {
|
|
5990
6030
|
const n = {};
|
|
5991
|
-
return
|
|
6031
|
+
return Vt(t, ((t, r) => {
|
|
5992
6032
|
n[t] = this.convertValue(r, e);
|
|
5993
6033
|
})), n;
|
|
5994
6034
|
}
|
|
5995
6035
|
convertGeoPoint(t) {
|
|
5996
|
-
return new
|
|
6036
|
+
return new Wn(St(t.latitude), St(t.longitude));
|
|
5997
6037
|
}
|
|
5998
6038
|
convertArray(t, e) {
|
|
5999
6039
|
return (t.values || []).map((t => this.convertValue(t, e)));
|
|
@@ -6001,23 +6041,23 @@ class Yr extends class {
|
|
|
6001
6041
|
convertServerTimestamp(t, e) {
|
|
6002
6042
|
switch (e) {
|
|
6003
6043
|
case "previous":
|
|
6004
|
-
const n =
|
|
6044
|
+
const n = Ct(t);
|
|
6005
6045
|
return null == n ? null : this.convertValue(n, e);
|
|
6006
6046
|
|
|
6007
6047
|
case "estimate":
|
|
6008
|
-
return this.convertTimestamp(
|
|
6048
|
+
return this.convertTimestamp(Mt(t));
|
|
6009
6049
|
|
|
6010
6050
|
default:
|
|
6011
6051
|
return null;
|
|
6012
6052
|
}
|
|
6013
6053
|
}
|
|
6014
6054
|
convertTimestamp(t) {
|
|
6015
|
-
const e =
|
|
6016
|
-
return new
|
|
6055
|
+
const e = xt(t);
|
|
6056
|
+
return new Ot(e.seconds, e.nanos);
|
|
6017
6057
|
}
|
|
6018
6058
|
convertDocumentKey(t, e) {
|
|
6019
6059
|
const n = nt.fromString(t);
|
|
6020
|
-
A(
|
|
6060
|
+
A(pn(n));
|
|
6021
6061
|
const r = new tt(n.get(1), n.get(3)), s = new it(n.popFirst(5));
|
|
6022
6062
|
return r.isEqual(e) ||
|
|
6023
6063
|
// TODO(b/64130202): Somehow support foreign references.
|
|
@@ -6029,11 +6069,11 @@ class Yr extends class {
|
|
|
6029
6069
|
super(), this.firestore = t;
|
|
6030
6070
|
}
|
|
6031
6071
|
convertBytes(t) {
|
|
6032
|
-
return new
|
|
6072
|
+
return new Un(t);
|
|
6033
6073
|
}
|
|
6034
6074
|
convertReference(t) {
|
|
6035
6075
|
const e = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
6036
|
-
return new
|
|
6076
|
+
return new Sn(this.firestore, /* converter= */ null, e);
|
|
6037
6077
|
}
|
|
6038
6078
|
}
|
|
6039
6079
|
|
|
@@ -6049,12 +6089,12 @@ class Yr extends class {
|
|
|
6049
6089
|
* @param reference - The reference of the document to fetch.
|
|
6050
6090
|
* @returns A Promise resolved with a `DocumentSnapshot` containing the current
|
|
6051
6091
|
* document contents.
|
|
6052
|
-
*/ function
|
|
6053
|
-
const e =
|
|
6054
|
-
return
|
|
6092
|
+
*/ function Jr(t) {
|
|
6093
|
+
const e = Tn((t = ht(t, Sn)).firestore), n = new Hr(t.firestore);
|
|
6094
|
+
return bn(e, [ t._key ]).then((e => {
|
|
6055
6095
|
A(1 === e.length);
|
|
6056
6096
|
const r = e[0];
|
|
6057
|
-
return new
|
|
6097
|
+
return new _r(t.firestore, n, t._key, r.isFoundDocument() ? r : null, t.converter);
|
|
6058
6098
|
}));
|
|
6059
6099
|
}
|
|
6060
6100
|
|
|
@@ -6069,33 +6109,33 @@ class Yr extends class {
|
|
|
6069
6109
|
*
|
|
6070
6110
|
* @param query - The `Query` to execute.
|
|
6071
6111
|
* @returns A Promise that will be resolved with the results of the query.
|
|
6072
|
-
*/ function
|
|
6112
|
+
*/ function Xr(t) {
|
|
6073
6113
|
!function(t) {
|
|
6074
6114
|
if ("L" /* LimitType.Last */ === t.limitType && 0 === t.explicitOrderBy.length) throw new B(M, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
6075
|
-
}((t = ht(t,
|
|
6076
|
-
const e =
|
|
6077
|
-
return
|
|
6078
|
-
const r = e.map((e => new
|
|
6115
|
+
}((t = ht(t, qn))._query);
|
|
6116
|
+
const e = Tn(t.firestore), n = new Hr(t.firestore);
|
|
6117
|
+
return En(e, t._query).then((e => {
|
|
6118
|
+
const r = e.map((e => new vr(t.firestore, n, e.key, e, t.converter)));
|
|
6079
6119
|
return "L" /* LimitType.Last */ === t._query.limitType &&
|
|
6080
6120
|
// Limit to last queries reverse the orderBy constraint that was
|
|
6081
6121
|
// specified by the user. As such, we need to reverse the order of the
|
|
6082
6122
|
// results to return the documents in the expected order.
|
|
6083
|
-
r.reverse(), new
|
|
6123
|
+
r.reverse(), new br(t, r);
|
|
6084
6124
|
}));
|
|
6085
6125
|
}
|
|
6086
6126
|
|
|
6087
|
-
function
|
|
6088
|
-
const r =
|
|
6089
|
-
return
|
|
6127
|
+
function Zr(t, e, n) {
|
|
6128
|
+
const r = Yr((t = ht(t, Sn)).converter, e, n), s = tr(Zn(t.firestore), "setDoc", t._key, r, null !== t.converter, n);
|
|
6129
|
+
return vn(Tn(t.firestore), [ s.toMutation(t._key, Le.none()) ]);
|
|
6090
6130
|
}
|
|
6091
6131
|
|
|
6092
|
-
function
|
|
6093
|
-
const s =
|
|
6132
|
+
function ts(t, e, n, ...r) {
|
|
6133
|
+
const s = Zn((t = ht(t, Sn)).firestore);
|
|
6094
6134
|
// For Compat types, we have to "extract" the underlying types before
|
|
6095
6135
|
// performing validation.
|
|
6096
6136
|
let i;
|
|
6097
|
-
i = "string" == typeof (e = d(e)) || e instanceof
|
|
6098
|
-
return
|
|
6137
|
+
i = "string" == typeof (e = d(e)) || e instanceof Bn ? cr(s, "updateDoc", t._key, e, n, r) : ur(s, "updateDoc", t._key, e);
|
|
6138
|
+
return vn(Tn(t.firestore), [ i.toMutation(t._key, Le.exists(!0)) ]);
|
|
6099
6139
|
}
|
|
6100
6140
|
|
|
6101
6141
|
/**
|
|
@@ -6109,8 +6149,8 @@ function Zr(t, e, n, ...r) {
|
|
|
6109
6149
|
* @param reference - A reference to the document to delete.
|
|
6110
6150
|
* @returns A `Promise` resolved once the document has been successfully
|
|
6111
6151
|
* deleted from the backend.
|
|
6112
|
-
*/ function
|
|
6113
|
-
return
|
|
6152
|
+
*/ function es(t) {
|
|
6153
|
+
return vn(Tn((t = ht(t, Sn)).firestore), [ new Qe(t._key, Le.none()) ]);
|
|
6114
6154
|
}
|
|
6115
6155
|
|
|
6116
6156
|
/**
|
|
@@ -6127,9 +6167,9 @@ function Zr(t, e, n, ...r) {
|
|
|
6127
6167
|
* @throws Error - If the provided input is not a valid Firestore document.
|
|
6128
6168
|
* @returns A `Promise` resolved with a `DocumentReference` pointing to the
|
|
6129
6169
|
* newly created document after it has been written to the backend.
|
|
6130
|
-
*/ function
|
|
6131
|
-
const n =
|
|
6132
|
-
return
|
|
6170
|
+
*/ function ns(t, e) {
|
|
6171
|
+
const n = Mn(t = ht(t, On)), r = Yr(t.converter, e), s = tr(Zn(t.firestore), "addDoc", n._key, r, null !== n.converter, {});
|
|
6172
|
+
return vn(Tn(t.firestore), [ s.toMutation(n._key, Le.exists(!1)) ]).then((() => n));
|
|
6133
6173
|
}
|
|
6134
6174
|
|
|
6135
6175
|
/**
|
|
@@ -6161,9 +6201,9 @@ function Zr(t, e, n, ...r) {
|
|
|
6161
6201
|
* @returns A Promise that will be resolved with the count; the count can be
|
|
6162
6202
|
* retrieved from `snapshot.data().count`, where `snapshot` is the
|
|
6163
6203
|
* `AggregateQuerySnapshot` to which the returned Promise resolves.
|
|
6164
|
-
*/ function
|
|
6165
|
-
return
|
|
6166
|
-
count:
|
|
6204
|
+
*/ function rs(t) {
|
|
6205
|
+
return ss(t, {
|
|
6206
|
+
count: us()
|
|
6167
6207
|
});
|
|
6168
6208
|
}
|
|
6169
6209
|
|
|
@@ -6193,16 +6233,16 @@ function Zr(t, e, n, ...r) {
|
|
|
6193
6233
|
* const averageScore: number | null = aggregateSnapshot.data().averageScore;
|
|
6194
6234
|
* ```
|
|
6195
6235
|
* @internal TODO (sum/avg) remove when public
|
|
6196
|
-
*/ function
|
|
6197
|
-
const n = ht(t.firestore,
|
|
6236
|
+
*/ function ss(t, e) {
|
|
6237
|
+
const n = ht(t.firestore, Pn), r = Tn(n), s = function(t, e) {
|
|
6198
6238
|
const n = [];
|
|
6199
6239
|
for (const r in t) Object.prototype.hasOwnProperty.call(t, r) && n.push(e(t[r], r, t));
|
|
6200
6240
|
return n;
|
|
6201
|
-
}(e, ((t, e) => new
|
|
6241
|
+
}(e, ((t, e) => new Et(e, t._aggregateType, t._internalFieldPath)));
|
|
6202
6242
|
// Run the aggregation and convert the results
|
|
6203
|
-
return
|
|
6204
|
-
const r = new
|
|
6205
|
-
return new
|
|
6243
|
+
return In(r, t._query, s).then((e => function(t, e, n) {
|
|
6244
|
+
const r = new Hr(t);
|
|
6245
|
+
return new xn(e, r, n);
|
|
6206
6246
|
}
|
|
6207
6247
|
/**
|
|
6208
6248
|
* Create an AggregateField object that can be used to compute the sum of
|
|
@@ -6212,8 +6252,8 @@ function Zr(t, e, n, ...r) {
|
|
|
6212
6252
|
*/ (n, t, e)));
|
|
6213
6253
|
}
|
|
6214
6254
|
|
|
6215
|
-
function
|
|
6216
|
-
return new
|
|
6255
|
+
function is(t) {
|
|
6256
|
+
return new Fn("sum", wr("sum", t));
|
|
6217
6257
|
}
|
|
6218
6258
|
|
|
6219
6259
|
/**
|
|
@@ -6221,16 +6261,16 @@ function ss(t) {
|
|
|
6221
6261
|
* a specified field over a range of documents in the result set of a query.
|
|
6222
6262
|
* @param field Specifies the field to average across the result set.
|
|
6223
6263
|
* @internal TODO (sum/avg) remove when public
|
|
6224
|
-
*/ function
|
|
6225
|
-
return new
|
|
6264
|
+
*/ function os(t) {
|
|
6265
|
+
return new Fn("avg", wr("average", t));
|
|
6226
6266
|
}
|
|
6227
6267
|
|
|
6228
6268
|
/**
|
|
6229
6269
|
* Create an AggregateField object that can be used to compute the count of
|
|
6230
6270
|
* documents in the result set of a query.
|
|
6231
6271
|
* @internal TODO (sum/avg) remove when public
|
|
6232
|
-
*/ function
|
|
6233
|
-
return new
|
|
6272
|
+
*/ function us() {
|
|
6273
|
+
return new Fn("count");
|
|
6234
6274
|
}
|
|
6235
6275
|
|
|
6236
6276
|
/**
|
|
@@ -6239,9 +6279,9 @@ function ss(t) {
|
|
|
6239
6279
|
* @param left Compare this AggregateField to the `right`.
|
|
6240
6280
|
* @param right Compare this AggregateField to the `left`.
|
|
6241
6281
|
* @internal TODO (sum/avg) remove when public
|
|
6242
|
-
*/ function
|
|
6282
|
+
*/ function cs(t, e) {
|
|
6243
6283
|
var n, r;
|
|
6244
|
-
return t instanceof
|
|
6284
|
+
return t instanceof Fn && e instanceof Fn && 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());
|
|
6245
6285
|
}
|
|
6246
6286
|
|
|
6247
6287
|
/**
|
|
@@ -6255,8 +6295,8 @@ function ss(t) {
|
|
|
6255
6295
|
*
|
|
6256
6296
|
* @returns `true` if the objects are "equal", as defined above, or `false`
|
|
6257
6297
|
* otherwise.
|
|
6258
|
-
*/ function
|
|
6259
|
-
return
|
|
6298
|
+
*/ function as(t, e) {
|
|
6299
|
+
return jn(t.query, e.query) && w(t.data(), e.data());
|
|
6260
6300
|
}
|
|
6261
6301
|
|
|
6262
6302
|
/**
|
|
@@ -6278,15 +6318,15 @@ function ss(t) {
|
|
|
6278
6318
|
/**
|
|
6279
6319
|
* Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or
|
|
6280
6320
|
* {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion.
|
|
6281
|
-
*/ function
|
|
6282
|
-
return new
|
|
6321
|
+
*/ function hs() {
|
|
6322
|
+
return new er("deleteField");
|
|
6283
6323
|
}
|
|
6284
6324
|
|
|
6285
6325
|
/**
|
|
6286
6326
|
* Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
|
|
6287
6327
|
* include a server-generated timestamp in the written data.
|
|
6288
|
-
*/ function
|
|
6289
|
-
return new
|
|
6328
|
+
*/ function ls() {
|
|
6329
|
+
return new rr("serverTimestamp");
|
|
6290
6330
|
}
|
|
6291
6331
|
|
|
6292
6332
|
/**
|
|
@@ -6300,10 +6340,10 @@ function ss(t) {
|
|
|
6300
6340
|
* @param elements - The elements to union into the array.
|
|
6301
6341
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
6302
6342
|
* `updateDoc()`.
|
|
6303
|
-
*/ function
|
|
6343
|
+
*/ function fs(...t) {
|
|
6304
6344
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
6305
6345
|
// update() since we'd need the Firestore instance to do this.
|
|
6306
|
-
return new
|
|
6346
|
+
return new sr("arrayUnion", t);
|
|
6307
6347
|
}
|
|
6308
6348
|
|
|
6309
6349
|
/**
|
|
@@ -6316,10 +6356,10 @@ function ss(t) {
|
|
|
6316
6356
|
* @param elements - The elements to remove from the array.
|
|
6317
6357
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
6318
6358
|
* `updateDoc()`
|
|
6319
|
-
*/ function
|
|
6359
|
+
*/ function ds(...t) {
|
|
6320
6360
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
6321
6361
|
// update() since we'd need the Firestore instance to do this.
|
|
6322
|
-
return new
|
|
6362
|
+
return new ir("arrayRemove", t);
|
|
6323
6363
|
}
|
|
6324
6364
|
|
|
6325
6365
|
/**
|
|
@@ -6340,8 +6380,8 @@ function ss(t) {
|
|
|
6340
6380
|
* @param n - The value to increment by.
|
|
6341
6381
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
6342
6382
|
* `updateDoc()`
|
|
6343
|
-
*/ function
|
|
6344
|
-
return new
|
|
6383
|
+
*/ function ws(t) {
|
|
6384
|
+
return new or("increment", t);
|
|
6345
6385
|
}
|
|
6346
6386
|
|
|
6347
6387
|
/**
|
|
@@ -6367,25 +6407,25 @@ function ss(t) {
|
|
|
6367
6407
|
* provides methods for adding writes to the write batch. None of the writes
|
|
6368
6408
|
* will be committed (or visible locally) until {@link WriteBatch.commit} is
|
|
6369
6409
|
* called.
|
|
6370
|
-
*/ class
|
|
6410
|
+
*/ class ms {
|
|
6371
6411
|
/** @hideconstructor */
|
|
6372
6412
|
constructor(t, e) {
|
|
6373
6413
|
this._firestore = t, this._commitHandler = e, this._mutations = [], this._committed = !1,
|
|
6374
|
-
this._dataReader =
|
|
6414
|
+
this._dataReader = Zn(t);
|
|
6375
6415
|
}
|
|
6376
6416
|
set(t, e, n) {
|
|
6377
6417
|
this._verifyNotCommitted();
|
|
6378
|
-
const r =
|
|
6379
|
-
return this._mutations.push(i.toMutation(r._key,
|
|
6418
|
+
const r = ps(t, this._firestore), s = Yr(r.converter, e, n), i = tr(this._dataReader, "WriteBatch.set", r._key, s, null !== r.converter, n);
|
|
6419
|
+
return this._mutations.push(i.toMutation(r._key, Le.none())), this;
|
|
6380
6420
|
}
|
|
6381
6421
|
update(t, e, n, ...r) {
|
|
6382
6422
|
this._verifyNotCommitted();
|
|
6383
|
-
const s =
|
|
6423
|
+
const s = ps(t, this._firestore);
|
|
6384
6424
|
// For Compat types, we have to "extract" the underlying types before
|
|
6385
6425
|
// performing validation.
|
|
6386
6426
|
let i;
|
|
6387
|
-
return i = "string" == typeof (e = d(e)) || e instanceof
|
|
6388
|
-
this._mutations.push(i.toMutation(s._key,
|
|
6427
|
+
return i = "string" == typeof (e = d(e)) || e instanceof Bn ? cr(this._dataReader, "WriteBatch.update", s._key, e, n, r) : ur(this._dataReader, "WriteBatch.update", s._key, e),
|
|
6428
|
+
this._mutations.push(i.toMutation(s._key, Le.exists(!0))), this;
|
|
6389
6429
|
}
|
|
6390
6430
|
/**
|
|
6391
6431
|
* Deletes the document referred to by the provided {@link DocumentReference}.
|
|
@@ -6394,8 +6434,8 @@ function ss(t) {
|
|
|
6394
6434
|
* @returns This `WriteBatch` instance. Used for chaining method calls.
|
|
6395
6435
|
*/ delete(t) {
|
|
6396
6436
|
this._verifyNotCommitted();
|
|
6397
|
-
const e =
|
|
6398
|
-
return this._mutations = this._mutations.concat(new
|
|
6437
|
+
const e = ps(t, this._firestore);
|
|
6438
|
+
return this._mutations = this._mutations.concat(new Qe(e._key, Le.none())), this;
|
|
6399
6439
|
}
|
|
6400
6440
|
/**
|
|
6401
6441
|
* Commits all of the writes in this write batch as a single atomic unit.
|
|
@@ -6416,7 +6456,7 @@ function ss(t) {
|
|
|
6416
6456
|
}
|
|
6417
6457
|
}
|
|
6418
6458
|
|
|
6419
|
-
function
|
|
6459
|
+
function ps(t, e) {
|
|
6420
6460
|
if ((t = d(t)).firestore !== e) throw new B($, "Provided document reference is from a different Firestore instance.");
|
|
6421
6461
|
return t;
|
|
6422
6462
|
}
|
|
@@ -6433,9 +6473,9 @@ function ms(t, e) {
|
|
|
6433
6473
|
*
|
|
6434
6474
|
* @returns A `WriteBatch` that can be used to atomically execute multiple
|
|
6435
6475
|
* writes.
|
|
6436
|
-
*/ function
|
|
6437
|
-
const e =
|
|
6438
|
-
return new
|
|
6476
|
+
*/ function ys(t) {
|
|
6477
|
+
const e = Tn(t = ht(t, Pn));
|
|
6478
|
+
return new ms(t, (t => vn(e, t)));
|
|
6439
6479
|
}
|
|
6440
6480
|
|
|
6441
6481
|
/**
|
|
@@ -6457,7 +6497,7 @@ function ms(t, e) {
|
|
|
6457
6497
|
/**
|
|
6458
6498
|
* Internal transaction object responsible for accumulating the mutations to
|
|
6459
6499
|
* perform and the base versions for any documents read.
|
|
6460
|
-
*/ class
|
|
6500
|
+
*/ class gs {
|
|
6461
6501
|
constructor(t) {
|
|
6462
6502
|
this.datastore = t,
|
|
6463
6503
|
// The version of each document that was read during this transaction.
|
|
@@ -6477,7 +6517,7 @@ function ms(t, e) {
|
|
|
6477
6517
|
}
|
|
6478
6518
|
async lookup(t) {
|
|
6479
6519
|
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new B($, "Firestore transactions require all reads to be executed before all writes.");
|
|
6480
|
-
const e = await
|
|
6520
|
+
const e = await bn(this.datastore, t);
|
|
6481
6521
|
return e.forEach((t => this.recordVersion(t))), e;
|
|
6482
6522
|
}
|
|
6483
6523
|
set(t, e) {
|
|
@@ -6492,7 +6532,7 @@ function ms(t, e) {
|
|
|
6492
6532
|
this.writtenDocs.add(t.toString());
|
|
6493
6533
|
}
|
|
6494
6534
|
delete(t) {
|
|
6495
|
-
this.write(new
|
|
6535
|
+
this.write(new Qe(t, this.precondition(t))), this.writtenDocs.add(t.toString());
|
|
6496
6536
|
}
|
|
6497
6537
|
async commit() {
|
|
6498
6538
|
if (this.ensureCommitNotCalled(), this.lastWriteError) throw this.lastWriteError;
|
|
@@ -6505,15 +6545,15 @@ function ms(t, e) {
|
|
|
6505
6545
|
// a `verify` operation.
|
|
6506
6546
|
t.forEach(((t, e) => {
|
|
6507
6547
|
const n = it.fromPath(e);
|
|
6508
|
-
this.mutations.push(new
|
|
6509
|
-
})), await
|
|
6548
|
+
this.mutations.push(new ze(n, this.precondition(n)));
|
|
6549
|
+
})), await vn(this.datastore, this.mutations), this.committed = !0;
|
|
6510
6550
|
}
|
|
6511
6551
|
recordVersion(t) {
|
|
6512
6552
|
let e;
|
|
6513
6553
|
if (t.isFoundDocument()) e = t.version; else {
|
|
6514
6554
|
if (!t.isNoDocument()) throw I();
|
|
6515
6555
|
// Represent a deleted doc using SnapshotVersion.min().
|
|
6516
|
-
e =
|
|
6556
|
+
e = we.min();
|
|
6517
6557
|
}
|
|
6518
6558
|
const n = this.readVersions.get(t.key.toString());
|
|
6519
6559
|
if (n) {
|
|
@@ -6527,7 +6567,7 @@ function ms(t, e) {
|
|
|
6527
6567
|
* as a precondition, or no precondition if it was not read.
|
|
6528
6568
|
*/ precondition(t) {
|
|
6529
6569
|
const e = this.readVersions.get(t.toString());
|
|
6530
|
-
return !this.writtenDocs.has(t.toString()) && e ? e.isEqual(
|
|
6570
|
+
return !this.writtenDocs.has(t.toString()) && e ? e.isEqual(we.min()) ? Le.exists(!1) : Le.updateTime(e) : Le.none();
|
|
6531
6571
|
}
|
|
6532
6572
|
/**
|
|
6533
6573
|
* Returns the precondition for a document if the operation is an update.
|
|
@@ -6536,7 +6576,7 @@ function ms(t, e) {
|
|
|
6536
6576
|
// The first time a document is written, we want to take into account the
|
|
6537
6577
|
// read time and existence
|
|
6538
6578
|
if (!this.writtenDocs.has(t.toString()) && e) {
|
|
6539
|
-
if (e.isEqual(
|
|
6579
|
+
if (e.isEqual(we.min()))
|
|
6540
6580
|
// The document doesn't exist, so fail the transaction.
|
|
6541
6581
|
// This has to be validated locally because you can't send a
|
|
6542
6582
|
// precondition that a document does not exist without changing the
|
|
@@ -6548,11 +6588,11 @@ function ms(t, e) {
|
|
|
6548
6588
|
// transaction.
|
|
6549
6589
|
throw new B($, "Can't update a document that doesn't exist.");
|
|
6550
6590
|
// Document exists, base precondition on document update time.
|
|
6551
|
-
return
|
|
6591
|
+
return Le.updateTime(e);
|
|
6552
6592
|
}
|
|
6553
6593
|
// Document was not read, so we just use the preconditions for a blind
|
|
6554
6594
|
// update.
|
|
6555
|
-
return
|
|
6595
|
+
return Le.exists(!0);
|
|
6556
6596
|
}
|
|
6557
6597
|
write(t) {
|
|
6558
6598
|
this.ensureCommitNotCalled(), this.mutations.push(t);
|
|
@@ -6575,7 +6615,7 @@ function ms(t, e) {
|
|
|
6575
6615
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
6576
6616
|
* See the License for the specific language governing permissions and
|
|
6577
6617
|
* limitations under the License.
|
|
6578
|
-
*/ const
|
|
6618
|
+
*/ const _s = {
|
|
6579
6619
|
maxAttempts: 5
|
|
6580
6620
|
};
|
|
6581
6621
|
|
|
@@ -6599,17 +6639,17 @@ function ms(t, e) {
|
|
|
6599
6639
|
* TransactionRunner encapsulates the logic needed to run and retry transactions
|
|
6600
6640
|
* with backoff.
|
|
6601
6641
|
*/
|
|
6602
|
-
class
|
|
6642
|
+
class vs {
|
|
6603
6643
|
constructor(t, e, n, r, s) {
|
|
6604
6644
|
this.asyncQueue = t, this.datastore = e, this.options = n, this.updateFunction = r,
|
|
6605
|
-
this.deferred = s, this.wt = n.maxAttempts, this.yt = new
|
|
6645
|
+
this.deferred = s, this.wt = n.maxAttempts, this.yt = new gn(this.asyncQueue, "transaction_retry" /* TimerId.TransactionRetry */);
|
|
6606
6646
|
}
|
|
6607
6647
|
/** Runs the transaction and sets the result on deferred. */ run() {
|
|
6608
6648
|
this.wt -= 1, this.gt();
|
|
6609
6649
|
}
|
|
6610
6650
|
gt() {
|
|
6611
6651
|
this.yt.K((async () => {
|
|
6612
|
-
const t = new
|
|
6652
|
+
const t = new gs(this.datastore), e = this._t(t);
|
|
6613
6653
|
e && e.then((e => {
|
|
6614
6654
|
this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
|
|
6615
6655
|
this.deferred.resolve(e);
|
|
@@ -6624,7 +6664,7 @@ class _s {
|
|
|
6624
6664
|
_t(t) {
|
|
6625
6665
|
try {
|
|
6626
6666
|
const e = this.updateFunction(t);
|
|
6627
|
-
return !
|
|
6667
|
+
return !mt(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
|
|
6628
6668
|
null);
|
|
6629
6669
|
} catch (t) {
|
|
6630
6670
|
// Do not retry errors thrown by user provided updateFunction.
|
|
@@ -6699,7 +6739,7 @@ class _s {
|
|
|
6699
6739
|
* See the License for the specific language governing permissions and
|
|
6700
6740
|
* limitations under the License.
|
|
6701
6741
|
*/
|
|
6702
|
-
/** The Platform's 'document' implementation or null if not available. */ function
|
|
6742
|
+
/** The Platform's 'document' implementation or null if not available. */ function bs() {
|
|
6703
6743
|
// `document` is not always available, e.g. in ReactNative and WebWorkers.
|
|
6704
6744
|
// eslint-disable-next-line no-restricted-globals
|
|
6705
6745
|
return "undefined" != typeof document ? document : null;
|
|
@@ -6731,7 +6771,7 @@ class _s {
|
|
|
6731
6771
|
* Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type
|
|
6732
6772
|
* in newer versions of TypeScript defines `finally`, which is not available in
|
|
6733
6773
|
* IE.
|
|
6734
|
-
*/ class
|
|
6774
|
+
*/ class Es {
|
|
6735
6775
|
constructor(t, e, n, r, s) {
|
|
6736
6776
|
this.asyncQueue = t, this.timerId = e, this.targetTimeMs = n, this.op = r, this.removalCallback = s,
|
|
6737
6777
|
this.deferred = new Q, this.then = this.deferred.promise.then.bind(this.deferred.promise),
|
|
@@ -6754,7 +6794,7 @@ class _s {
|
|
|
6754
6794
|
* PORTING NOTE: This exists to prevent making removeDelayedOperation() and
|
|
6755
6795
|
* the DelayedOperation class public.
|
|
6756
6796
|
*/ static createAndSchedule(t, e, n, r, s) {
|
|
6757
|
-
const i = Date.now() + n, o = new
|
|
6797
|
+
const i = Date.now() + n, o = new Es(t, e, i, r, s);
|
|
6758
6798
|
return o.start(n), o;
|
|
6759
6799
|
}
|
|
6760
6800
|
/**
|
|
@@ -6803,7 +6843,7 @@ class _s {
|
|
|
6803
6843
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
6804
6844
|
* See the License for the specific language governing permissions and
|
|
6805
6845
|
* limitations under the License.
|
|
6806
|
-
*/ class
|
|
6846
|
+
*/ class Is {
|
|
6807
6847
|
constructor() {
|
|
6808
6848
|
// The last promise in the queue.
|
|
6809
6849
|
this.Et = Promise.resolve(),
|
|
@@ -6826,15 +6866,15 @@ class _s {
|
|
|
6826
6866
|
// List of TimerIds to fast-forward delays for.
|
|
6827
6867
|
this.$t = [],
|
|
6828
6868
|
// Backoff timer used to schedule retries for retryable operations
|
|
6829
|
-
this.yt = new
|
|
6869
|
+
this.yt = new gn(this, "async_queue_retry" /* TimerId.AsyncQueueRetry */),
|
|
6830
6870
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
6831
6871
|
// operations. Meant to speed up recovery when we regain file system access
|
|
6832
6872
|
// after page comes into foreground.
|
|
6833
6873
|
this.Nt = () => {
|
|
6834
|
-
const t =
|
|
6874
|
+
const t = bs();
|
|
6835
6875
|
t && _("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.yt.H();
|
|
6836
6876
|
};
|
|
6837
|
-
const t =
|
|
6877
|
+
const t = bs();
|
|
6838
6878
|
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Nt);
|
|
6839
6879
|
}
|
|
6840
6880
|
get isShuttingDown() {
|
|
@@ -6855,7 +6895,7 @@ class _s {
|
|
|
6855
6895
|
enterRestrictedMode(t) {
|
|
6856
6896
|
if (!this.At) {
|
|
6857
6897
|
this.At = !0, this.Vt = t || !1;
|
|
6858
|
-
const e =
|
|
6898
|
+
const e = bs();
|
|
6859
6899
|
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Nt);
|
|
6860
6900
|
}
|
|
6861
6901
|
}
|
|
@@ -6987,7 +7027,7 @@ class _s {
|
|
|
6987
7027
|
this.Dt(),
|
|
6988
7028
|
// Fast-forward delays for timerIds that have been overriden.
|
|
6989
7029
|
this.$t.indexOf(t) > -1 && (e = 0);
|
|
6990
|
-
const r =
|
|
7030
|
+
const r = Es.createAndSchedule(this, t, e, n, (t => this.St(t)));
|
|
6991
7031
|
return this.Tt.push(r), r;
|
|
6992
7032
|
}
|
|
6993
7033
|
Dt() {
|
|
@@ -7041,10 +7081,10 @@ class _s {
|
|
|
7041
7081
|
}
|
|
7042
7082
|
}
|
|
7043
7083
|
|
|
7044
|
-
class
|
|
7084
|
+
class As {
|
|
7045
7085
|
/** @hideconstructor */
|
|
7046
7086
|
constructor(t, e) {
|
|
7047
|
-
this._firestore = t, this._transaction = e, this._dataReader =
|
|
7087
|
+
this._firestore = t, this._transaction = e, this._dataReader = Zn(t);
|
|
7048
7088
|
}
|
|
7049
7089
|
/**
|
|
7050
7090
|
* Reads the document referenced by the provided {@link DocumentReference}.
|
|
@@ -7052,25 +7092,25 @@ class Is {
|
|
|
7052
7092
|
* @param documentRef - A reference to the document to be read.
|
|
7053
7093
|
* @returns A `DocumentSnapshot` with the read data.
|
|
7054
7094
|
*/ get(t) {
|
|
7055
|
-
const e =
|
|
7095
|
+
const e = ps(t, this._firestore), n = new Hr(this._firestore);
|
|
7056
7096
|
return this._transaction.lookup([ e._key ]).then((t => {
|
|
7057
7097
|
if (!t || 1 !== t.length) return I();
|
|
7058
7098
|
const r = t[0];
|
|
7059
|
-
if (r.isFoundDocument()) return new
|
|
7060
|
-
if (r.isNoDocument()) return new
|
|
7099
|
+
if (r.isFoundDocument()) return new _r(this._firestore, n, r.key, r, e.converter);
|
|
7100
|
+
if (r.isNoDocument()) return new _r(this._firestore, n, e._key, null, e.converter);
|
|
7061
7101
|
throw I();
|
|
7062
7102
|
}));
|
|
7063
7103
|
}
|
|
7064
7104
|
set(t, e, n) {
|
|
7065
|
-
const r =
|
|
7105
|
+
const r = ps(t, this._firestore), s = Yr(r.converter, e, n), i = tr(this._dataReader, "Transaction.set", r._key, s, null !== r.converter, n);
|
|
7066
7106
|
return this._transaction.set(r._key, i), this;
|
|
7067
7107
|
}
|
|
7068
7108
|
update(t, e, n, ...r) {
|
|
7069
|
-
const s =
|
|
7109
|
+
const s = ps(t, this._firestore);
|
|
7070
7110
|
// For Compat types, we have to "extract" the underlying types before
|
|
7071
7111
|
// performing validation.
|
|
7072
7112
|
let i;
|
|
7073
|
-
return i = "string" == typeof (e = d(e)) || e instanceof
|
|
7113
|
+
return i = "string" == typeof (e = d(e)) || e instanceof Bn ? cr(this._dataReader, "Transaction.update", s._key, e, n, r) : ur(this._dataReader, "Transaction.update", s._key, e),
|
|
7074
7114
|
this._transaction.update(s._key, i), this;
|
|
7075
7115
|
}
|
|
7076
7116
|
/**
|
|
@@ -7079,7 +7119,7 @@ class Is {
|
|
|
7079
7119
|
* @param documentRef - A reference to the document to be deleted.
|
|
7080
7120
|
* @returns This `Transaction` instance. Used for chaining method calls.
|
|
7081
7121
|
*/ delete(t) {
|
|
7082
|
-
const e =
|
|
7122
|
+
const e = ps(t, this._firestore);
|
|
7083
7123
|
return this._transaction.delete(e._key), this;
|
|
7084
7124
|
}
|
|
7085
7125
|
}
|
|
@@ -7102,13 +7142,13 @@ class Is {
|
|
|
7102
7142
|
* (the `updateFunction` returned a failed promise), the promise returned by the
|
|
7103
7143
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
7104
7144
|
* rejected promise with the corresponding failure error is returned.
|
|
7105
|
-
*/ function
|
|
7106
|
-
const r =
|
|
7145
|
+
*/ function Ts(t, e, n) {
|
|
7146
|
+
const r = Tn(t = ht(t, Pn)), s = Object.assign(Object.assign({}, _s), n);
|
|
7107
7147
|
!function(t) {
|
|
7108
7148
|
if (t.maxAttempts < 1) throw new B($, "Max attempts must be at least 1");
|
|
7109
7149
|
}(s);
|
|
7110
7150
|
const i = new Q;
|
|
7111
|
-
return new
|
|
7151
|
+
return new vs(new Is, r, s, (n => e(new As(t, n))), i).run(), i.promise;
|
|
7112
7152
|
}
|
|
7113
7153
|
|
|
7114
7154
|
/**
|
|
@@ -7121,7 +7161,7 @@ class Is {
|
|
|
7121
7161
|
*/ !function(t) {
|
|
7122
7162
|
p = t;
|
|
7123
7163
|
}(`${s}_lite`), n(new i("firestore/lite", ((t, {instanceIdentifier: e, options: n}) => {
|
|
7124
|
-
const r = t.getProvider("app").getImmediate(), s = new
|
|
7164
|
+
const r = t.getProvider("app").getImmediate(), s = new Pn(new K(t.getProvider("auth-internal")), new X(t.getProvider("app-check-internal")), function(t, e) {
|
|
7125
7165
|
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new B($, '"projectId" not provided in firebase.initializeApp.');
|
|
7126
7166
|
return new tt(t.options.projectId, e);
|
|
7127
7167
|
}
|
|
@@ -7144,7 +7184,7 @@ class Is {
|
|
|
7144
7184
|
return n && s._setSettings(n), s;
|
|
7145
7185
|
}), "PUBLIC").setMultipleInstances(!0)),
|
|
7146
7186
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
7147
|
-
r("firestore-lite", "3.
|
|
7187
|
+
r("firestore-lite", "3.12.0-20230511201449", "rn"), r("firestore-lite", "3.12.0-20230511201449", "esm2017");
|
|
7148
7188
|
|
|
7149
|
-
export {
|
|
7189
|
+
export { Fn as AggregateField, xn as AggregateQuerySnapshot, Un as Bytes, On as CollectionReference, Sn as DocumentReference, _r as DocumentSnapshot, Bn as FieldPath, zn as FieldValue, Pn as Firestore, B as FirestoreError, Wn as GeoPoint, qn as Query, $r as QueryCompositeFilterConstraint, Tr as QueryConstraint, vr as QueryDocumentSnapshot, Lr as QueryEndAtConstraint, Pr as QueryFieldFilterConstraint, Sr as QueryLimitConstraint, Fr as QueryOrderByConstraint, br as QuerySnapshot, kr as QueryStartAtConstraint, Ot as Timestamp, As as Transaction, ms as WriteBatch, ns as addDoc, cs as aggregateFieldEqual, as as aggregateQuerySnapshotEqual, Dr as and, ds as arrayRemove, fs as arrayUnion, os as average, kn as collection, Cn as collectionGroup, Nn as connectFirestoreEmulator, us as count, es as deleteDoc, hs as deleteField, Mn as doc, Qn as documentId, Ur as endAt, jr as endBefore, ss as getAggregate, rs as getCount, Jr as getDoc, Xr as getDocs, $n as getFirestore, ws as increment, Vn as initializeFirestore, qr as limit, Or as limitToLast, Nr as or, xr as orderBy, Rr as query, jn as queryEqual, Ln as refEqual, Ts as runTransaction, ls as serverTimestamp, Zr as setDoc, g as setLogLevel, Er as snapshotEqual, Mr as startAfter, Cr as startAt, is as sum, Dn as terminate, ts as updateDoc, Vr as where, ys as writeBatch };
|
|
7150
7190
|
//# sourceMappingURL=index.rn.esm2017.js.map
|