@firebase/firestore 3.8.4 → 3.9.0-20230314181055
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 +12 -0
- package/dist/firestore/src/lite-api/query.d.ts +11 -19
- package/dist/firestore/src/lite-api/reference.d.ts +1 -1
- package/dist/firestore/src/util/debug_uid.d.ts +28 -0
- package/dist/firestore/test/unit/specs/spec_builder.d.ts +3 -0
- package/dist/firestore/test/unit/specs/spec_test_components.d.ts +5 -1
- package/dist/index.cjs.js +1359 -1309
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +66 -14
- package/dist/index.esm2017.js +1272 -1222
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +1335 -1259
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +97 -32
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +97 -32
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +1380 -1330
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +12 -20
- package/dist/lite/firestore/src/lite-api/query.d.ts +11 -19
- package/dist/lite/firestore/src/lite-api/reference.d.ts +1 -1
- package/dist/lite/firestore/src/util/debug_uid.d.ts +28 -0
- package/dist/lite/firestore/test/unit/specs/spec_builder.d.ts +3 -0
- package/dist/lite/firestore/test/unit/specs/spec_test_components.d.ts +5 -1
- package/dist/lite/index.browser.esm2017.js +775 -730
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +736 -693
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.cjs.js +775 -730
- package/dist/lite/index.cjs.js.map +1 -1
- package/dist/lite/index.d.ts +66 -14
- package/dist/lite/index.node.cjs.js +76 -18
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +76 -18
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +777 -732
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +12 -20
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +139 -142
- package/dist/lite/packages/firestore/src/lite-api/query.d.ts +11 -19
- package/dist/lite/packages/firestore/src/lite-api/reference.d.ts +1 -1
- package/dist/lite/packages/firestore/src/util/debug_uid.d.ts +28 -0
- package/dist/lite/packages/firestore/test/unit/specs/spec_builder.d.ts +3 -0
- package/dist/lite/packages/firestore/test/unit/specs/spec_test_components.d.ts +5 -1
- package/dist/lite/private.d.ts +72 -16
- package/dist/packages/firestore/dist/index.esm2017.d.ts +157 -160
- package/dist/packages/firestore/src/lite-api/query.d.ts +11 -19
- package/dist/packages/firestore/src/lite-api/reference.d.ts +1 -1
- package/dist/packages/firestore/src/util/debug_uid.d.ts +28 -0
- package/dist/packages/firestore/test/unit/specs/spec_builder.d.ts +3 -0
- package/dist/packages/firestore/test/unit/specs/spec_test_components.d.ts +5 -1
- package/dist/private.d.ts +72 -16
- package/package.json +2 -2
|
@@ -63,7 +63,7 @@ d.MOCK_USER = new d("mock-user");
|
|
|
63
63
|
* See the License for the specific language governing permissions and
|
|
64
64
|
* limitations under the License.
|
|
65
65
|
*/
|
|
66
|
-
let w = "9.
|
|
66
|
+
let w = "9.18.0-20230314181055";
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* @license
|
|
@@ -800,6 +800,54 @@ function at(t, e) {
|
|
|
800
800
|
if (e <= 0) throw new U(P, `Function ${t}() requires a positive number, but it was: ${e}.`);
|
|
801
801
|
}
|
|
802
802
|
|
|
803
|
+
/**
|
|
804
|
+
* @license
|
|
805
|
+
* Copyright 2023 Google LLC
|
|
806
|
+
*
|
|
807
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
808
|
+
* you may not use this file except in compliance with the License.
|
|
809
|
+
* You may obtain a copy of the License at
|
|
810
|
+
*
|
|
811
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
812
|
+
*
|
|
813
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
814
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
815
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
816
|
+
* See the License for the specific language governing permissions and
|
|
817
|
+
* limitations under the License.
|
|
818
|
+
*/
|
|
819
|
+
/**
|
|
820
|
+
* The value returned from the most recent invocation of
|
|
821
|
+
* `generateUniqueDebugId()`, or null if it has never been invoked.
|
|
822
|
+
*/ let ht = null;
|
|
823
|
+
|
|
824
|
+
/**
|
|
825
|
+
* Generates and returns an initial value for `lastUniqueDebugId`.
|
|
826
|
+
*
|
|
827
|
+
* The returned value is randomly selected from a range of integers that are
|
|
828
|
+
* represented as 8 hexadecimal digits. This means that (within reason) any
|
|
829
|
+
* numbers generated by incrementing the returned number by 1 will also be
|
|
830
|
+
* represented by 8 hexadecimal digits. This leads to all "IDs" having the same
|
|
831
|
+
* length when converted to a hexadecimal string, making reading logs containing
|
|
832
|
+
* these IDs easier to follow. And since the return value is randomly selected
|
|
833
|
+
* it will help to differentiate between logs from different executions.
|
|
834
|
+
*/
|
|
835
|
+
/**
|
|
836
|
+
* Generates and returns a unique ID as a hexadecimal string.
|
|
837
|
+
*
|
|
838
|
+
* The returned ID is intended to be used in debug logging messages to help
|
|
839
|
+
* correlate log messages that may be spatially separated in the logs, but
|
|
840
|
+
* logically related. For example, a network connection could include the same
|
|
841
|
+
* "debug ID" string in all of its log messages to help trace a specific
|
|
842
|
+
* connection over time.
|
|
843
|
+
*
|
|
844
|
+
* @return the 10-character generated ID (e.g. "0xa1b2c3d4").
|
|
845
|
+
*/
|
|
846
|
+
function lt() {
|
|
847
|
+
return null === ht ? ht = 268435456 + Math.round(2147483648 * Math.random()) : ht++,
|
|
848
|
+
"0x" + ht.toString(16);
|
|
849
|
+
}
|
|
850
|
+
|
|
803
851
|
/**
|
|
804
852
|
* @license
|
|
805
853
|
* Copyright 2017 Google LLC
|
|
@@ -818,11 +866,11 @@ function at(t, e) {
|
|
|
818
866
|
*/
|
|
819
867
|
/**
|
|
820
868
|
* Returns whether a variable is either undefined or null.
|
|
821
|
-
*/ function
|
|
869
|
+
*/ function ft(t) {
|
|
822
870
|
return null == t;
|
|
823
871
|
}
|
|
824
872
|
|
|
825
|
-
/** Returns whether the value represents -0. */ function
|
|
873
|
+
/** Returns whether the value represents -0. */ function dt(t) {
|
|
826
874
|
// Detect if the value is -0.0. Based on polyfill from
|
|
827
875
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
828
876
|
return 0 === t && 1 / t == -1 / 0;
|
|
@@ -848,7 +896,7 @@ function at(t, e) {
|
|
|
848
896
|
* See the License for the specific language governing permissions and
|
|
849
897
|
* limitations under the License.
|
|
850
898
|
*/
|
|
851
|
-
const
|
|
899
|
+
const wt = {
|
|
852
900
|
BatchGetDocuments: "batchGet",
|
|
853
901
|
Commit: "commit",
|
|
854
902
|
RunQuery: "runQuery",
|
|
@@ -886,7 +934,7 @@ const ft = {
|
|
|
886
934
|
* are used for reverse lookups from the webchannel stream. Do NOT change the
|
|
887
935
|
* names of these identifiers or change this into a const enum.
|
|
888
936
|
*/
|
|
889
|
-
var
|
|
937
|
+
var mt, pt;
|
|
890
938
|
|
|
891
939
|
/**
|
|
892
940
|
* Converts an HTTP Status Code to the equivalent error code.
|
|
@@ -895,7 +943,7 @@ var dt, wt;
|
|
|
895
943
|
* @returns The equivalent Code. Unknown status codes are mapped to
|
|
896
944
|
* Code.UNKNOWN.
|
|
897
945
|
*/
|
|
898
|
-
function
|
|
946
|
+
function yt(t) {
|
|
899
947
|
if (void 0 === t) return g("RPC_ERROR", "HTTP error has no status"), R;
|
|
900
948
|
// The canonical error codes for Google APIs [1] specify mapping onto HTTP
|
|
901
949
|
// status codes but the mapping is not bijective. In each case of ambiguity
|
|
@@ -988,16 +1036,16 @@ function mt(t) {
|
|
|
988
1036
|
/**
|
|
989
1037
|
* A Rest-based connection that relies on the native HTTP stack
|
|
990
1038
|
* (e.g. `fetch` or a polyfill).
|
|
991
|
-
*/ (
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
1039
|
+
*/ (pt = mt || (mt = {}))[pt.OK = 0] = "OK", pt[pt.CANCELLED = 1] = "CANCELLED",
|
|
1040
|
+
pt[pt.UNKNOWN = 2] = "UNKNOWN", pt[pt.INVALID_ARGUMENT = 3] = "INVALID_ARGUMENT",
|
|
1041
|
+
pt[pt.DEADLINE_EXCEEDED = 4] = "DEADLINE_EXCEEDED", pt[pt.NOT_FOUND = 5] = "NOT_FOUND",
|
|
1042
|
+
pt[pt.ALREADY_EXISTS = 6] = "ALREADY_EXISTS", pt[pt.PERMISSION_DENIED = 7] = "PERMISSION_DENIED",
|
|
1043
|
+
pt[pt.UNAUTHENTICATED = 16] = "UNAUTHENTICATED", pt[pt.RESOURCE_EXHAUSTED = 8] = "RESOURCE_EXHAUSTED",
|
|
1044
|
+
pt[pt.FAILED_PRECONDITION = 9] = "FAILED_PRECONDITION", pt[pt.ABORTED = 10] = "ABORTED",
|
|
1045
|
+
pt[pt.OUT_OF_RANGE = 11] = "OUT_OF_RANGE", pt[pt.UNIMPLEMENTED = 12] = "UNIMPLEMENTED",
|
|
1046
|
+
pt[pt.INTERNAL = 13] = "INTERNAL", pt[pt.UNAVAILABLE = 14] = "UNAVAILABLE", pt[pt.DATA_LOSS = 15] = "DATA_LOSS";
|
|
999
1047
|
|
|
1000
|
-
class
|
|
1048
|
+
class gt extends
|
|
1001
1049
|
/**
|
|
1002
1050
|
* Base class for all Rest-based connections to the backend (WebChannel and
|
|
1003
1051
|
* HTTP).
|
|
@@ -1014,12 +1062,12 @@ class {
|
|
|
1014
1062
|
return !1;
|
|
1015
1063
|
}
|
|
1016
1064
|
A(t, e, n, r, s) {
|
|
1017
|
-
const i = this.I(t, e);
|
|
1018
|
-
y("RestConnection",
|
|
1019
|
-
const
|
|
1020
|
-
return this.T(
|
|
1021
|
-
|
|
1022
|
-
throw _("RestConnection",
|
|
1065
|
+
const i = lt(), o = this.I(t, e);
|
|
1066
|
+
y("RestConnection", `Sending RPC '${t}' ${i}:`, o, n);
|
|
1067
|
+
const u = {};
|
|
1068
|
+
return this.T(u, r, s), this.R(t, o, u, n).then((e => (y("RestConnection", `Received RPC '${t}' ${i}: `, e),
|
|
1069
|
+
e)), (e => {
|
|
1070
|
+
throw _("RestConnection", `RPC '${t}' ${i} failed with error: `, e, "url: ", o, "request:", n),
|
|
1023
1071
|
e;
|
|
1024
1072
|
}));
|
|
1025
1073
|
}
|
|
@@ -1041,7 +1089,7 @@ class {
|
|
|
1041
1089
|
e && e.headers.forEach(((e, n) => t[n] = e)), n && n.headers.forEach(((e, n) => t[n] = e));
|
|
1042
1090
|
}
|
|
1043
1091
|
I(t, e) {
|
|
1044
|
-
const n =
|
|
1092
|
+
const n = wt[t];
|
|
1045
1093
|
return `${this.p}/v1/${e}:${n}`;
|
|
1046
1094
|
}
|
|
1047
1095
|
} {
|
|
@@ -1067,13 +1115,13 @@ class {
|
|
|
1067
1115
|
});
|
|
1068
1116
|
} catch (t) {
|
|
1069
1117
|
const e = t;
|
|
1070
|
-
throw new U(
|
|
1118
|
+
throw new U(yt(e.status), "Request failed with error: " + e.statusText);
|
|
1071
1119
|
}
|
|
1072
1120
|
if (!o.ok) {
|
|
1073
1121
|
let t = await o.json();
|
|
1074
1122
|
Array.isArray(t) && (t = t[0]);
|
|
1075
1123
|
const e = null === (s = null == t ? void 0 : t.error) || void 0 === s ? void 0 : s.message;
|
|
1076
|
-
throw new U(
|
|
1124
|
+
throw new U(yt(o.status), `Request failed with error: ${null != e ? e : o.statusText}`);
|
|
1077
1125
|
}
|
|
1078
1126
|
return o.json();
|
|
1079
1127
|
}
|
|
@@ -1112,12 +1160,12 @@ class {
|
|
|
1112
1160
|
* See the License for the specific language governing permissions and
|
|
1113
1161
|
* limitations under the License.
|
|
1114
1162
|
*/
|
|
1115
|
-
const
|
|
1163
|
+
const _t = /^[_a-zA-Z][_a-zA-Z0-9]*(?:\.[_a-zA-Z][_a-zA-Z0-9]*)*$/;
|
|
1116
1164
|
|
|
1117
1165
|
/**
|
|
1118
1166
|
* An alias for aggregation results.
|
|
1119
1167
|
* @internal
|
|
1120
|
-
*/ class
|
|
1168
|
+
*/ class vt {
|
|
1121
1169
|
/**
|
|
1122
1170
|
* @internal
|
|
1123
1171
|
* @param alias Un-escaped alias representation
|
|
@@ -1128,13 +1176,13 @@ const yt = /^[_a-zA-Z][_a-zA-Z0-9]*(?:\.[_a-zA-Z][_a-zA-Z0-9]*)*$/;
|
|
|
1128
1176
|
/**
|
|
1129
1177
|
* Returns true if the string could be used as an alias.
|
|
1130
1178
|
*/ static D(t) {
|
|
1131
|
-
return
|
|
1179
|
+
return _t.test(t);
|
|
1132
1180
|
}
|
|
1133
1181
|
/**
|
|
1134
1182
|
* Return an escaped and quoted string representation of the alias.
|
|
1135
1183
|
*/ canonicalString() {
|
|
1136
1184
|
let t = this.alias.replace(/\\/g, "\\\\").replace(/`/g, "\\`");
|
|
1137
|
-
return
|
|
1185
|
+
return vt.D(t) || (t = "`" + t + "`"), t;
|
|
1138
1186
|
}
|
|
1139
1187
|
}
|
|
1140
1188
|
|
|
@@ -1156,7 +1204,7 @@ const yt = /^[_a-zA-Z][_a-zA-Z0-9]*(?:\.[_a-zA-Z][_a-zA-Z0-9]*)*$/;
|
|
|
1156
1204
|
*/
|
|
1157
1205
|
/**
|
|
1158
1206
|
* Concrete implementation of the Aggregate type.
|
|
1159
|
-
*/ class
|
|
1207
|
+
*/ class bt {
|
|
1160
1208
|
constructor(t, e, n) {
|
|
1161
1209
|
this.alias = t, this.N = e, this.fieldPath = n;
|
|
1162
1210
|
}
|
|
@@ -1182,7 +1230,7 @@ const yt = /^[_a-zA-Z][_a-zA-Z0-9]*(?:\.[_a-zA-Z][_a-zA-Z0-9]*)*$/;
|
|
|
1182
1230
|
* Generates `nBytes` of random bytes.
|
|
1183
1231
|
*
|
|
1184
1232
|
* If `nBytes < 0` , an error will be thrown.
|
|
1185
|
-
*/ function
|
|
1233
|
+
*/ function Et(t) {
|
|
1186
1234
|
// Polyfills for IE and WebWorker by using `self` and `msCrypto` when `crypto` is not available.
|
|
1187
1235
|
const e =
|
|
1188
1236
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -1208,14 +1256,14 @@ const yt = /^[_a-zA-Z][_a-zA-Z0-9]*(?:\.[_a-zA-Z][_a-zA-Z0-9]*)*$/;
|
|
|
1208
1256
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1209
1257
|
* See the License for the specific language governing permissions and
|
|
1210
1258
|
* limitations under the License.
|
|
1211
|
-
*/ class
|
|
1259
|
+
*/ class At {
|
|
1212
1260
|
static F() {
|
|
1213
1261
|
// Alphanumeric characters
|
|
1214
1262
|
const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", e = Math.floor(256 / t.length) * t.length;
|
|
1215
1263
|
// The largest byte value that is a multiple of `char.length`.
|
|
1216
1264
|
let n = "";
|
|
1217
1265
|
for (;n.length < 20; ) {
|
|
1218
|
-
const r =
|
|
1266
|
+
const r = Et(40);
|
|
1219
1267
|
for (let s = 0; s < r.length; ++s)
|
|
1220
1268
|
// Only accept values that are [0, maxMultiple), this ensures they can
|
|
1221
1269
|
// be evenly mapped to indices of `chars` via a modulo operation.
|
|
@@ -1225,11 +1273,11 @@ const yt = /^[_a-zA-Z][_a-zA-Z0-9]*(?:\.[_a-zA-Z][_a-zA-Z0-9]*)*$/;
|
|
|
1225
1273
|
}
|
|
1226
1274
|
}
|
|
1227
1275
|
|
|
1228
|
-
function
|
|
1276
|
+
function It(t, e) {
|
|
1229
1277
|
return t < e ? -1 : t > e ? 1 : 0;
|
|
1230
1278
|
}
|
|
1231
1279
|
|
|
1232
|
-
/** Helper to compare arrays using isEqual(). */ function
|
|
1280
|
+
/** Helper to compare arrays using isEqual(). */ function Tt(t, e, n) {
|
|
1233
1281
|
return t.length === e.length && t.every(((t, r) => n(t, e[r])));
|
|
1234
1282
|
}
|
|
1235
1283
|
|
|
@@ -1248,13 +1296,13 @@ function Et(t, e) {
|
|
|
1248
1296
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1249
1297
|
* See the License for the specific language governing permissions and
|
|
1250
1298
|
* limitations under the License.
|
|
1251
|
-
*/ function
|
|
1299
|
+
*/ function Rt(t) {
|
|
1252
1300
|
let e = 0;
|
|
1253
1301
|
for (const n in t) Object.prototype.hasOwnProperty.call(t, n) && e++;
|
|
1254
1302
|
return e;
|
|
1255
1303
|
}
|
|
1256
1304
|
|
|
1257
|
-
function
|
|
1305
|
+
function Pt(t, e) {
|
|
1258
1306
|
for (const n in t) Object.prototype.hasOwnProperty.call(t, n) && e(n, t[n]);
|
|
1259
1307
|
}
|
|
1260
1308
|
|
|
@@ -1277,7 +1325,7 @@ function Tt(t, e) {
|
|
|
1277
1325
|
/**
|
|
1278
1326
|
* An error encountered while decoding base64 string.
|
|
1279
1327
|
*/
|
|
1280
|
-
class
|
|
1328
|
+
class Vt extends Error {
|
|
1281
1329
|
constructor() {
|
|
1282
1330
|
super(...arguments), this.name = "Base64DecodeError";
|
|
1283
1331
|
}
|
|
@@ -1325,7 +1373,7 @@ class Rt extends Error {
|
|
|
1325
1373
|
* before being sent as a proto.
|
|
1326
1374
|
* @internal
|
|
1327
1375
|
*/
|
|
1328
|
-
class
|
|
1376
|
+
class $t {
|
|
1329
1377
|
constructor(t) {
|
|
1330
1378
|
this.binaryString = t;
|
|
1331
1379
|
}
|
|
@@ -1334,11 +1382,11 @@ class Pt {
|
|
|
1334
1382
|
try {
|
|
1335
1383
|
return atob(t);
|
|
1336
1384
|
} catch (t) {
|
|
1337
|
-
throw t instanceof DOMException ? new
|
|
1385
|
+
throw t instanceof DOMException ? new Vt("Invalid base64 string: " + t) : t;
|
|
1338
1386
|
}
|
|
1339
1387
|
}
|
|
1340
1388
|
/** Converts a binary string to a Base64 encoded string. */ (t);
|
|
1341
|
-
return new
|
|
1389
|
+
return new $t(e);
|
|
1342
1390
|
}
|
|
1343
1391
|
static fromUint8Array(t) {
|
|
1344
1392
|
// TODO(indexing); Remove the copy of the byte string here as this method
|
|
@@ -1355,7 +1403,7 @@ class Pt {
|
|
|
1355
1403
|
/**
|
|
1356
1404
|
* Helper function to convert a binary string to an Uint8Array.
|
|
1357
1405
|
*/ (t);
|
|
1358
|
-
return new
|
|
1406
|
+
return new $t(e);
|
|
1359
1407
|
}
|
|
1360
1408
|
[Symbol.iterator]() {
|
|
1361
1409
|
let t = 0;
|
|
@@ -1402,21 +1450,21 @@ class Pt {
|
|
|
1402
1450
|
return 2 * this.binaryString.length;
|
|
1403
1451
|
}
|
|
1404
1452
|
compareTo(t) {
|
|
1405
|
-
return
|
|
1453
|
+
return It(this.binaryString, t.binaryString);
|
|
1406
1454
|
}
|
|
1407
1455
|
isEqual(t) {
|
|
1408
1456
|
return this.binaryString === t.binaryString;
|
|
1409
1457
|
}
|
|
1410
1458
|
}
|
|
1411
1459
|
|
|
1412
|
-
|
|
1460
|
+
$t.EMPTY_BYTE_STRING = new $t("");
|
|
1413
1461
|
|
|
1414
|
-
const
|
|
1462
|
+
const Dt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
1415
1463
|
|
|
1416
1464
|
/**
|
|
1417
1465
|
* Converts the possible Proto values for a timestamp value into a "seconds and
|
|
1418
1466
|
* nanos" representation.
|
|
1419
|
-
*/ function
|
|
1467
|
+
*/ function Nt(t) {
|
|
1420
1468
|
// The json interface (for the browser) will return an iso timestamp string,
|
|
1421
1469
|
// while the proto js library (for node) will return a
|
|
1422
1470
|
// google.protobuf.Timestamp instance.
|
|
@@ -1425,7 +1473,7 @@ const Vt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1425
1473
|
// (millis), so we do some custom parsing here.
|
|
1426
1474
|
// Parse the nanos right out of the string.
|
|
1427
1475
|
let e = 0;
|
|
1428
|
-
const n =
|
|
1476
|
+
const n = Dt.exec(t);
|
|
1429
1477
|
if (E(!!n), n[1]) {
|
|
1430
1478
|
// Pad the fraction out to 9 digits (nanos).
|
|
1431
1479
|
let t = n[1];
|
|
@@ -1439,21 +1487,21 @@ const Vt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1439
1487
|
};
|
|
1440
1488
|
}
|
|
1441
1489
|
return {
|
|
1442
|
-
seconds:
|
|
1443
|
-
nanos:
|
|
1490
|
+
seconds: Ft(t.seconds),
|
|
1491
|
+
nanos: Ft(t.nanos)
|
|
1444
1492
|
};
|
|
1445
1493
|
}
|
|
1446
1494
|
|
|
1447
1495
|
/**
|
|
1448
1496
|
* Converts the possible Proto types for numbers into a JavaScript number.
|
|
1449
1497
|
* Returns 0 if the value is not numeric.
|
|
1450
|
-
*/ function
|
|
1498
|
+
*/ function Ft(t) {
|
|
1451
1499
|
// TODO(bjornick): Handle int64 greater than 53 bits.
|
|
1452
1500
|
return "number" == typeof t ? t : "string" == typeof t ? Number(t) : 0;
|
|
1453
1501
|
}
|
|
1454
1502
|
|
|
1455
|
-
/** Converts the possible Proto types for Blobs into a ByteString. */ function
|
|
1456
|
-
return "string" == typeof t ?
|
|
1503
|
+
/** Converts the possible Proto types for Blobs into a ByteString. */ function xt(t) {
|
|
1504
|
+
return "string" == typeof t ? $t.fromBase64String(t) : $t.fromUint8Array(t);
|
|
1457
1505
|
}
|
|
1458
1506
|
|
|
1459
1507
|
/**
|
|
@@ -1487,7 +1535,7 @@ const Vt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1487
1535
|
* For examples and further specifications, refer to the
|
|
1488
1536
|
* {@link https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto | Timestamp definition}.
|
|
1489
1537
|
*/
|
|
1490
|
-
class
|
|
1538
|
+
class St {
|
|
1491
1539
|
/**
|
|
1492
1540
|
* Creates a new timestamp.
|
|
1493
1541
|
*
|
|
@@ -1519,7 +1567,7 @@ class Ft {
|
|
|
1519
1567
|
*
|
|
1520
1568
|
* @returns a new timestamp representing the current date.
|
|
1521
1569
|
*/ static now() {
|
|
1522
|
-
return
|
|
1570
|
+
return St.fromMillis(Date.now());
|
|
1523
1571
|
}
|
|
1524
1572
|
/**
|
|
1525
1573
|
* Creates a new timestamp from the given date.
|
|
@@ -1528,7 +1576,7 @@ class Ft {
|
|
|
1528
1576
|
* @returns A new `Timestamp` representing the same point in time as the given
|
|
1529
1577
|
* date.
|
|
1530
1578
|
*/ static fromDate(t) {
|
|
1531
|
-
return
|
|
1579
|
+
return St.fromMillis(t.getTime());
|
|
1532
1580
|
}
|
|
1533
1581
|
/**
|
|
1534
1582
|
* Creates a new timestamp from the given number of milliseconds.
|
|
@@ -1539,7 +1587,7 @@ class Ft {
|
|
|
1539
1587
|
* number of milliseconds.
|
|
1540
1588
|
*/ static fromMillis(t) {
|
|
1541
1589
|
const e = Math.floor(t / 1e3), n = Math.floor(1e6 * (t - 1e3 * e));
|
|
1542
|
-
return new
|
|
1590
|
+
return new St(e, n);
|
|
1543
1591
|
}
|
|
1544
1592
|
/**
|
|
1545
1593
|
* Converts a `Timestamp` to a JavaScript `Date` object. This conversion
|
|
@@ -1561,7 +1609,7 @@ class Ft {
|
|
|
1561
1609
|
return 1e3 * this.seconds + this.nanoseconds / 1e6;
|
|
1562
1610
|
}
|
|
1563
1611
|
_compareTo(t) {
|
|
1564
|
-
return this.seconds === t.seconds ?
|
|
1612
|
+
return this.seconds === t.seconds ? It(this.nanoseconds, t.nanoseconds) : It(this.seconds, t.seconds);
|
|
1565
1613
|
}
|
|
1566
1614
|
/**
|
|
1567
1615
|
* Returns true if this `Timestamp` is equal to the provided one.
|
|
@@ -1631,7 +1679,7 @@ class Ft {
|
|
|
1631
1679
|
* FieldValueOptions to value().
|
|
1632
1680
|
* - With respect to other ServerTimestampValues, they sort by their
|
|
1633
1681
|
* localWriteTime.
|
|
1634
|
-
*/ function
|
|
1682
|
+
*/ function qt(t) {
|
|
1635
1683
|
var e, n;
|
|
1636
1684
|
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);
|
|
1637
1685
|
}
|
|
@@ -1641,16 +1689,16 @@ class Ft {
|
|
|
1641
1689
|
*
|
|
1642
1690
|
* Preserving the previous values allows the user to display the last resoled
|
|
1643
1691
|
* value until the backend responds with the timestamp.
|
|
1644
|
-
*/ function
|
|
1692
|
+
*/ function Ot(t) {
|
|
1645
1693
|
const e = t.mapValue.fields.__previous_value__;
|
|
1646
|
-
return
|
|
1694
|
+
return qt(e) ? Ot(e) : e;
|
|
1647
1695
|
}
|
|
1648
1696
|
|
|
1649
1697
|
/**
|
|
1650
1698
|
* Returns the local time at which this timestamp was first set.
|
|
1651
|
-
*/ function
|
|
1652
|
-
const e =
|
|
1653
|
-
return new
|
|
1699
|
+
*/ function kt(t) {
|
|
1700
|
+
const e = Nt(t.mapValue.fields.__local_write_time__.timestampValue);
|
|
1701
|
+
return new St(e.seconds, e.nanos);
|
|
1654
1702
|
}
|
|
1655
1703
|
|
|
1656
1704
|
/**
|
|
@@ -1668,7 +1716,7 @@ class Ft {
|
|
|
1668
1716
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1669
1717
|
* See the License for the specific language governing permissions and
|
|
1670
1718
|
* limitations under the License.
|
|
1671
|
-
*/ const
|
|
1719
|
+
*/ const Ct = {
|
|
1672
1720
|
fields: {
|
|
1673
1721
|
__type__: {
|
|
1674
1722
|
stringValue: "__max__"
|
|
@@ -1677,8 +1725,8 @@ class Ft {
|
|
|
1677
1725
|
};
|
|
1678
1726
|
|
|
1679
1727
|
/** Extracts the backend's type order for the provided value. */
|
|
1680
|
-
function
|
|
1681
|
-
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 ?
|
|
1728
|
+
function Lt(t) {
|
|
1729
|
+
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 ? qt(t) ? 4 /* TypeOrder.ServerTimestampValue */ :
|
|
1682
1730
|
/** Returns true if the Value represents the canonical {@link #MAX_VALUE} . */
|
|
1683
1731
|
function(t) {
|
|
1684
1732
|
return "__max__" === (((t.mapValue || {}).fields || {}).__type__ || {}).stringValue;
|
|
@@ -1715,10 +1763,10 @@ function kt(t) {
|
|
|
1715
1763
|
*/ (t) ? 9007199254740991 /* TypeOrder.MaxValue */ : 10 /* TypeOrder.ObjectValue */ : b();
|
|
1716
1764
|
}
|
|
1717
1765
|
|
|
1718
|
-
/** Tests `left` and `right` for equality based on the backend semantics. */ function
|
|
1766
|
+
/** Tests `left` and `right` for equality based on the backend semantics. */ function Mt(t, e) {
|
|
1719
1767
|
if (t === e) return !0;
|
|
1720
|
-
const n =
|
|
1721
|
-
if (n !==
|
|
1768
|
+
const n = Lt(t);
|
|
1769
|
+
if (n !== Lt(e)) return !1;
|
|
1722
1770
|
switch (n) {
|
|
1723
1771
|
case 0 /* TypeOrder.NullValue */ :
|
|
1724
1772
|
case 9007199254740991 /* TypeOrder.MaxValue */ :
|
|
@@ -1728,14 +1776,14 @@ function kt(t) {
|
|
|
1728
1776
|
return t.booleanValue === e.booleanValue;
|
|
1729
1777
|
|
|
1730
1778
|
case 4 /* TypeOrder.ServerTimestampValue */ :
|
|
1731
|
-
return
|
|
1779
|
+
return kt(t).isEqual(kt(e));
|
|
1732
1780
|
|
|
1733
1781
|
case 3 /* TypeOrder.TimestampValue */ :
|
|
1734
1782
|
return function(t, e) {
|
|
1735
1783
|
if ("string" == typeof t.timestampValue && "string" == typeof e.timestampValue && t.timestampValue.length === e.timestampValue.length)
|
|
1736
1784
|
// Use string equality for ISO 8601 timestamps
|
|
1737
1785
|
return t.timestampValue === e.timestampValue;
|
|
1738
|
-
const n =
|
|
1786
|
+
const n = Nt(t.timestampValue), r = Nt(e.timestampValue);
|
|
1739
1787
|
return n.seconds === r.seconds && n.nanos === r.nanos;
|
|
1740
1788
|
}(t, e);
|
|
1741
1789
|
|
|
@@ -1744,7 +1792,7 @@ function kt(t) {
|
|
|
1744
1792
|
|
|
1745
1793
|
case 6 /* TypeOrder.BlobValue */ :
|
|
1746
1794
|
return function(t, e) {
|
|
1747
|
-
return
|
|
1795
|
+
return xt(t.bytesValue).isEqual(xt(e.bytesValue));
|
|
1748
1796
|
}(t, e);
|
|
1749
1797
|
|
|
1750
1798
|
case 7 /* TypeOrder.RefValue */ :
|
|
@@ -1752,27 +1800,27 @@ function kt(t) {
|
|
|
1752
1800
|
|
|
1753
1801
|
case 8 /* TypeOrder.GeoPointValue */ :
|
|
1754
1802
|
return function(t, e) {
|
|
1755
|
-
return
|
|
1803
|
+
return Ft(t.geoPointValue.latitude) === Ft(e.geoPointValue.latitude) && Ft(t.geoPointValue.longitude) === Ft(e.geoPointValue.longitude);
|
|
1756
1804
|
}(t, e);
|
|
1757
1805
|
|
|
1758
1806
|
case 2 /* TypeOrder.NumberValue */ :
|
|
1759
1807
|
return function(t, e) {
|
|
1760
|
-
if ("integerValue" in t && "integerValue" in e) return
|
|
1808
|
+
if ("integerValue" in t && "integerValue" in e) return Ft(t.integerValue) === Ft(e.integerValue);
|
|
1761
1809
|
if ("doubleValue" in t && "doubleValue" in e) {
|
|
1762
|
-
const n =
|
|
1763
|
-
return n === r ?
|
|
1810
|
+
const n = Ft(t.doubleValue), r = Ft(e.doubleValue);
|
|
1811
|
+
return n === r ? dt(n) === dt(r) : isNaN(n) && isNaN(r);
|
|
1764
1812
|
}
|
|
1765
1813
|
return !1;
|
|
1766
1814
|
}(t, e);
|
|
1767
1815
|
|
|
1768
1816
|
case 9 /* TypeOrder.ArrayValue */ :
|
|
1769
|
-
return
|
|
1817
|
+
return Tt(t.arrayValue.values || [], e.arrayValue.values || [], Mt);
|
|
1770
1818
|
|
|
1771
1819
|
case 10 /* TypeOrder.ObjectValue */ :
|
|
1772
1820
|
return function(t, e) {
|
|
1773
1821
|
const n = t.mapValue.fields || {}, r = e.mapValue.fields || {};
|
|
1774
|
-
if (
|
|
1775
|
-
for (const t in n) if (n.hasOwnProperty(t) && (void 0 === r[t] || !
|
|
1822
|
+
if (Rt(n) !== Rt(r)) return !1;
|
|
1823
|
+
for (const t in n) if (n.hasOwnProperty(t) && (void 0 === r[t] || !Mt(n[t], r[t]))) return !1;
|
|
1776
1824
|
return !0;
|
|
1777
1825
|
}
|
|
1778
1826
|
/** Returns true if the ArrayValue contains the specified element. */ (t, e);
|
|
@@ -1782,42 +1830,42 @@ function kt(t) {
|
|
|
1782
1830
|
}
|
|
1783
1831
|
}
|
|
1784
1832
|
|
|
1785
|
-
function
|
|
1786
|
-
return void 0 !== (t.values || []).find((t =>
|
|
1833
|
+
function Ut(t, e) {
|
|
1834
|
+
return void 0 !== (t.values || []).find((t => Mt(t, e)));
|
|
1787
1835
|
}
|
|
1788
1836
|
|
|
1789
|
-
function
|
|
1837
|
+
function jt(t, e) {
|
|
1790
1838
|
if (t === e) return 0;
|
|
1791
|
-
const n =
|
|
1792
|
-
if (n !== r) return
|
|
1839
|
+
const n = Lt(t), r = Lt(e);
|
|
1840
|
+
if (n !== r) return It(n, r);
|
|
1793
1841
|
switch (n) {
|
|
1794
1842
|
case 0 /* TypeOrder.NullValue */ :
|
|
1795
1843
|
case 9007199254740991 /* TypeOrder.MaxValue */ :
|
|
1796
1844
|
return 0;
|
|
1797
1845
|
|
|
1798
1846
|
case 1 /* TypeOrder.BooleanValue */ :
|
|
1799
|
-
return
|
|
1847
|
+
return It(t.booleanValue, e.booleanValue);
|
|
1800
1848
|
|
|
1801
1849
|
case 2 /* TypeOrder.NumberValue */ :
|
|
1802
1850
|
return function(t, e) {
|
|
1803
|
-
const n =
|
|
1851
|
+
const n = Ft(t.integerValue || t.doubleValue), r = Ft(e.integerValue || e.doubleValue);
|
|
1804
1852
|
return n < r ? -1 : n > r ? 1 : n === r ? 0 :
|
|
1805
1853
|
// one or both are NaN.
|
|
1806
1854
|
isNaN(n) ? isNaN(r) ? 0 : -1 : 1;
|
|
1807
1855
|
}(t, e);
|
|
1808
1856
|
|
|
1809
1857
|
case 3 /* TypeOrder.TimestampValue */ :
|
|
1810
|
-
return
|
|
1858
|
+
return Bt(t.timestampValue, e.timestampValue);
|
|
1811
1859
|
|
|
1812
1860
|
case 4 /* TypeOrder.ServerTimestampValue */ :
|
|
1813
|
-
return
|
|
1861
|
+
return Bt(kt(t), kt(e));
|
|
1814
1862
|
|
|
1815
1863
|
case 5 /* TypeOrder.StringValue */ :
|
|
1816
|
-
return
|
|
1864
|
+
return It(t.stringValue, e.stringValue);
|
|
1817
1865
|
|
|
1818
1866
|
case 6 /* TypeOrder.BlobValue */ :
|
|
1819
1867
|
return function(t, e) {
|
|
1820
|
-
const n =
|
|
1868
|
+
const n = xt(t), r = xt(e);
|
|
1821
1869
|
return n.compareTo(r);
|
|
1822
1870
|
}(t.bytesValue, e.bytesValue);
|
|
1823
1871
|
|
|
@@ -1825,34 +1873,34 @@ function Mt(t, e) {
|
|
|
1825
1873
|
return function(t, e) {
|
|
1826
1874
|
const n = t.split("/"), r = e.split("/");
|
|
1827
1875
|
for (let t = 0; t < n.length && t < r.length; t++) {
|
|
1828
|
-
const e =
|
|
1876
|
+
const e = It(n[t], r[t]);
|
|
1829
1877
|
if (0 !== e) return e;
|
|
1830
1878
|
}
|
|
1831
|
-
return
|
|
1879
|
+
return It(n.length, r.length);
|
|
1832
1880
|
}(t.referenceValue, e.referenceValue);
|
|
1833
1881
|
|
|
1834
1882
|
case 8 /* TypeOrder.GeoPointValue */ :
|
|
1835
1883
|
return function(t, e) {
|
|
1836
|
-
const n =
|
|
1884
|
+
const n = It(Ft(t.latitude), Ft(e.latitude));
|
|
1837
1885
|
if (0 !== n) return n;
|
|
1838
|
-
return
|
|
1886
|
+
return It(Ft(t.longitude), Ft(e.longitude));
|
|
1839
1887
|
}(t.geoPointValue, e.geoPointValue);
|
|
1840
1888
|
|
|
1841
1889
|
case 9 /* TypeOrder.ArrayValue */ :
|
|
1842
1890
|
return function(t, e) {
|
|
1843
1891
|
const n = t.values || [], r = e.values || [];
|
|
1844
1892
|
for (let t = 0; t < n.length && t < r.length; ++t) {
|
|
1845
|
-
const e =
|
|
1893
|
+
const e = jt(n[t], r[t]);
|
|
1846
1894
|
if (e) return e;
|
|
1847
1895
|
}
|
|
1848
|
-
return
|
|
1896
|
+
return It(n.length, r.length);
|
|
1849
1897
|
}(t.arrayValue, e.arrayValue);
|
|
1850
1898
|
|
|
1851
1899
|
case 10 /* TypeOrder.ObjectValue */ :
|
|
1852
1900
|
return function(t, e) {
|
|
1853
|
-
if (t ===
|
|
1854
|
-
if (t ===
|
|
1855
|
-
if (e ===
|
|
1901
|
+
if (t === Ct && e === Ct) return 0;
|
|
1902
|
+
if (t === Ct) return 1;
|
|
1903
|
+
if (e === Ct) return -1;
|
|
1856
1904
|
const n = t.fields || {}, r = Object.keys(n), s = e.fields || {}, i = Object.keys(s);
|
|
1857
1905
|
// Even though MapValues are likely sorted correctly based on their insertion
|
|
1858
1906
|
// order (e.g. when received from the backend), local modifications can bring
|
|
@@ -1860,12 +1908,12 @@ function Mt(t, e) {
|
|
|
1860
1908
|
// canonical IDs are independent of insertion order.
|
|
1861
1909
|
r.sort(), i.sort();
|
|
1862
1910
|
for (let t = 0; t < r.length && t < i.length; ++t) {
|
|
1863
|
-
const e =
|
|
1911
|
+
const e = It(r[t], i[t]);
|
|
1864
1912
|
if (0 !== e) return e;
|
|
1865
|
-
const o =
|
|
1913
|
+
const o = jt(n[r[t]], s[i[t]]);
|
|
1866
1914
|
if (0 !== o) return o;
|
|
1867
1915
|
}
|
|
1868
|
-
return
|
|
1916
|
+
return It(r.length, i.length);
|
|
1869
1917
|
}
|
|
1870
1918
|
/** Returns a reference value for the provided database and key. */ (t.mapValue, e.mapValue);
|
|
1871
1919
|
|
|
@@ -1874,35 +1922,35 @@ function Mt(t, e) {
|
|
|
1874
1922
|
}
|
|
1875
1923
|
}
|
|
1876
1924
|
|
|
1877
|
-
function
|
|
1878
|
-
if ("string" == typeof t && "string" == typeof e && t.length === e.length) return
|
|
1879
|
-
const n =
|
|
1880
|
-
return 0 !== s ? s :
|
|
1925
|
+
function Bt(t, e) {
|
|
1926
|
+
if ("string" == typeof t && "string" == typeof e && t.length === e.length) return It(t, e);
|
|
1927
|
+
const n = Nt(t), r = Nt(e), s = It(n.seconds, r.seconds);
|
|
1928
|
+
return 0 !== s ? s : It(n.nanos, r.nanos);
|
|
1881
1929
|
}
|
|
1882
1930
|
|
|
1883
|
-
function
|
|
1931
|
+
function zt(t, e) {
|
|
1884
1932
|
return {
|
|
1885
1933
|
referenceValue: `projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`
|
|
1886
1934
|
};
|
|
1887
1935
|
}
|
|
1888
1936
|
|
|
1889
|
-
/** Returns true if `value` is an ArrayValue. */ function
|
|
1937
|
+
/** Returns true if `value` is an ArrayValue. */ function Qt(t) {
|
|
1890
1938
|
return !!t && "arrayValue" in t;
|
|
1891
1939
|
}
|
|
1892
1940
|
|
|
1893
|
-
/** Returns true if `value` is a NullValue. */ function
|
|
1941
|
+
/** Returns true if `value` is a NullValue. */ function Wt(t) {
|
|
1894
1942
|
return !!t && "nullValue" in t;
|
|
1895
1943
|
}
|
|
1896
1944
|
|
|
1897
|
-
/** Returns true if `value` is NaN. */ function
|
|
1945
|
+
/** Returns true if `value` is NaN. */ function Gt(t) {
|
|
1898
1946
|
return !!t && "doubleValue" in t && isNaN(Number(t.doubleValue));
|
|
1899
1947
|
}
|
|
1900
1948
|
|
|
1901
|
-
/** Returns true if `value` is a MapValue. */ function
|
|
1949
|
+
/** Returns true if `value` is a MapValue. */ function Kt(t) {
|
|
1902
1950
|
return !!t && "mapValue" in t;
|
|
1903
1951
|
}
|
|
1904
1952
|
|
|
1905
|
-
/** Creates a deep copy of `source`. */ function
|
|
1953
|
+
/** Creates a deep copy of `source`. */ function Yt(t) {
|
|
1906
1954
|
if (t.geoPointValue) return {
|
|
1907
1955
|
geoPointValue: Object.assign({}, t.geoPointValue)
|
|
1908
1956
|
};
|
|
@@ -1915,7 +1963,7 @@ function jt(t, e) {
|
|
|
1915
1963
|
fields: {}
|
|
1916
1964
|
}
|
|
1917
1965
|
};
|
|
1918
|
-
return
|
|
1966
|
+
return Pt(t.mapValue.fields, ((t, n) => e.mapValue.fields[t] = Yt(n))), e;
|
|
1919
1967
|
}
|
|
1920
1968
|
if (t.arrayValue) {
|
|
1921
1969
|
const e = {
|
|
@@ -1923,24 +1971,24 @@ function jt(t, e) {
|
|
|
1923
1971
|
values: []
|
|
1924
1972
|
}
|
|
1925
1973
|
};
|
|
1926
|
-
for (let n = 0; n < (t.arrayValue.values || []).length; ++n) e.arrayValue.values[n] =
|
|
1974
|
+
for (let n = 0; n < (t.arrayValue.values || []).length; ++n) e.arrayValue.values[n] = Yt(t.arrayValue.values[n]);
|
|
1927
1975
|
return e;
|
|
1928
1976
|
}
|
|
1929
1977
|
return Object.assign({}, t);
|
|
1930
1978
|
}
|
|
1931
1979
|
|
|
1932
|
-
class
|
|
1980
|
+
class Ht {
|
|
1933
1981
|
constructor(t, e) {
|
|
1934
1982
|
this.position = t, this.inclusive = e;
|
|
1935
1983
|
}
|
|
1936
1984
|
}
|
|
1937
1985
|
|
|
1938
|
-
function
|
|
1986
|
+
function Zt(t, e) {
|
|
1939
1987
|
if (null === t) return null === e;
|
|
1940
1988
|
if (null === e) return !1;
|
|
1941
1989
|
if (t.inclusive !== e.inclusive || t.position.length !== e.position.length) return !1;
|
|
1942
1990
|
for (let n = 0; n < t.position.length; n++) {
|
|
1943
|
-
if (!
|
|
1991
|
+
if (!Mt(t.position[n], e.position[n])) return !1;
|
|
1944
1992
|
}
|
|
1945
1993
|
return !0;
|
|
1946
1994
|
}
|
|
@@ -1960,24 +2008,24 @@ function Yt(t, e) {
|
|
|
1960
2008
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1961
2009
|
* See the License for the specific language governing permissions and
|
|
1962
2010
|
* limitations under the License.
|
|
1963
|
-
*/ class
|
|
2011
|
+
*/ class Jt {}
|
|
1964
2012
|
|
|
1965
|
-
class
|
|
2013
|
+
class Xt extends Jt {
|
|
1966
2014
|
constructor(t, e, n) {
|
|
1967
2015
|
super(), this.field = t, this.op = e, this.value = n;
|
|
1968
2016
|
}
|
|
1969
2017
|
/**
|
|
1970
2018
|
* Creates a filter based on the provided arguments.
|
|
1971
2019
|
*/ static create(t, e, n) {
|
|
1972
|
-
return t.isKeyField() ? "in" /* Operator.IN */ === e || "not-in" /* Operator.NOT_IN */ === e ? this.createKeyFieldInFilter(t, e, n) : new
|
|
2020
|
+
return t.isKeyField() ? "in" /* Operator.IN */ === e || "not-in" /* Operator.NOT_IN */ === e ? this.createKeyFieldInFilter(t, e, n) : new ne(t, e, n) : "array-contains" /* Operator.ARRAY_CONTAINS */ === e ? new oe(t, n) : "in" /* Operator.IN */ === e ? new ue(t, n) : "not-in" /* Operator.NOT_IN */ === e ? new ce(t, n) : "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ === e ? new ae(t, n) : new Xt(t, e, n);
|
|
1973
2021
|
}
|
|
1974
2022
|
static createKeyFieldInFilter(t, e, n) {
|
|
1975
|
-
return "in" /* Operator.IN */ === e ? new
|
|
2023
|
+
return "in" /* Operator.IN */ === e ? new re(t, n) : new se(t, n);
|
|
1976
2024
|
}
|
|
1977
2025
|
matches(t) {
|
|
1978
2026
|
const e = t.data.field(this.field);
|
|
1979
2027
|
// Types do not have to match in NOT_EQUAL filters.
|
|
1980
|
-
return "!=" /* Operator.NOT_EQUAL */ === this.op ? null !== e && this.matchesComparison(
|
|
2028
|
+
return "!=" /* Operator.NOT_EQUAL */ === this.op ? null !== e && this.matchesComparison(jt(e, this.value)) : null !== e && Lt(this.value) === Lt(e) && this.matchesComparison(jt(e, this.value));
|
|
1981
2029
|
// Only compare types with matching backend order (such as double and int).
|
|
1982
2030
|
}
|
|
1983
2031
|
matchesComparison(t) {
|
|
@@ -2018,14 +2066,14 @@ class Zt extends Ht {
|
|
|
2018
2066
|
}
|
|
2019
2067
|
}
|
|
2020
2068
|
|
|
2021
|
-
class
|
|
2069
|
+
class te extends Jt {
|
|
2022
2070
|
constructor(t, e) {
|
|
2023
2071
|
super(), this.filters = t, this.op = e, this.S = null;
|
|
2024
2072
|
}
|
|
2025
2073
|
/**
|
|
2026
2074
|
* Creates a filter based on the provided arguments.
|
|
2027
2075
|
*/ static create(t, e) {
|
|
2028
|
-
return new
|
|
2076
|
+
return new te(t, e);
|
|
2029
2077
|
}
|
|
2030
2078
|
matches(t) {
|
|
2031
2079
|
return "and" /* CompositeOperator.AND */ === this.op ? void 0 === this.filters.find((e => !e.matches(t))) : void 0 !== this.filters.find((e => e.matches(t)));
|
|
@@ -2051,19 +2099,19 @@ class Jt extends Ht {
|
|
|
2051
2099
|
}
|
|
2052
2100
|
}
|
|
2053
2101
|
|
|
2054
|
-
function
|
|
2055
|
-
return t instanceof
|
|
2056
|
-
return e instanceof
|
|
2057
|
-
}(t, e) : t instanceof
|
|
2058
|
-
if (e instanceof
|
|
2059
|
-
return t.filters.reduce(((t, n, r) => t &&
|
|
2102
|
+
function ee(t, e) {
|
|
2103
|
+
return t instanceof Xt ? function(t, e) {
|
|
2104
|
+
return e instanceof Xt && t.op === e.op && t.field.isEqual(e.field) && Mt(t.value, e.value);
|
|
2105
|
+
}(t, e) : t instanceof te ? function(t, e) {
|
|
2106
|
+
if (e instanceof te && t.op === e.op && t.filters.length === e.filters.length) {
|
|
2107
|
+
return t.filters.reduce(((t, n, r) => t && ee(n, e.filters[r])), !0);
|
|
2060
2108
|
}
|
|
2061
2109
|
return !1;
|
|
2062
2110
|
}
|
|
2063
2111
|
/** Filter that matches on key fields (i.e. '__name__'). */ (t, e) : void b();
|
|
2064
2112
|
}
|
|
2065
2113
|
|
|
2066
|
-
class
|
|
2114
|
+
class ne extends Xt {
|
|
2067
2115
|
constructor(t, e, n) {
|
|
2068
2116
|
super(t, e, n), this.key = rt.fromName(n.referenceValue);
|
|
2069
2117
|
}
|
|
@@ -2073,69 +2121,69 @@ class te extends Zt {
|
|
|
2073
2121
|
}
|
|
2074
2122
|
}
|
|
2075
2123
|
|
|
2076
|
-
/** Filter that matches on key fields within an array. */ class
|
|
2124
|
+
/** Filter that matches on key fields within an array. */ class re extends Xt {
|
|
2077
2125
|
constructor(t, e) {
|
|
2078
|
-
super(t, "in" /* Operator.IN */ , e), this.keys =
|
|
2126
|
+
super(t, "in" /* Operator.IN */ , e), this.keys = ie("in" /* Operator.IN */ , e);
|
|
2079
2127
|
}
|
|
2080
2128
|
matches(t) {
|
|
2081
2129
|
return this.keys.some((e => e.isEqual(t.key)));
|
|
2082
2130
|
}
|
|
2083
2131
|
}
|
|
2084
2132
|
|
|
2085
|
-
/** Filter that matches on key fields not present within an array. */ class
|
|
2133
|
+
/** Filter that matches on key fields not present within an array. */ class se extends Xt {
|
|
2086
2134
|
constructor(t, e) {
|
|
2087
|
-
super(t, "not-in" /* Operator.NOT_IN */ , e), this.keys =
|
|
2135
|
+
super(t, "not-in" /* Operator.NOT_IN */ , e), this.keys = ie("not-in" /* Operator.NOT_IN */ , e);
|
|
2088
2136
|
}
|
|
2089
2137
|
matches(t) {
|
|
2090
2138
|
return !this.keys.some((e => e.isEqual(t.key)));
|
|
2091
2139
|
}
|
|
2092
2140
|
}
|
|
2093
2141
|
|
|
2094
|
-
function
|
|
2142
|
+
function ie(t, e) {
|
|
2095
2143
|
var n;
|
|
2096
2144
|
return ((null === (n = e.arrayValue) || void 0 === n ? void 0 : n.values) || []).map((t => rt.fromName(t.referenceValue)));
|
|
2097
2145
|
}
|
|
2098
2146
|
|
|
2099
|
-
/** A Filter that implements the array-contains operator. */ class
|
|
2147
|
+
/** A Filter that implements the array-contains operator. */ class oe extends Xt {
|
|
2100
2148
|
constructor(t, e) {
|
|
2101
2149
|
super(t, "array-contains" /* Operator.ARRAY_CONTAINS */ , e);
|
|
2102
2150
|
}
|
|
2103
2151
|
matches(t) {
|
|
2104
2152
|
const e = t.data.field(this.field);
|
|
2105
|
-
return
|
|
2153
|
+
return Qt(e) && Ut(e.arrayValue, this.value);
|
|
2106
2154
|
}
|
|
2107
2155
|
}
|
|
2108
2156
|
|
|
2109
|
-
/** A Filter that implements the IN operator. */ class
|
|
2157
|
+
/** A Filter that implements the IN operator. */ class ue extends Xt {
|
|
2110
2158
|
constructor(t, e) {
|
|
2111
2159
|
super(t, "in" /* Operator.IN */ , e);
|
|
2112
2160
|
}
|
|
2113
2161
|
matches(t) {
|
|
2114
2162
|
const e = t.data.field(this.field);
|
|
2115
|
-
return null !== e &&
|
|
2163
|
+
return null !== e && Ut(this.value.arrayValue, e);
|
|
2116
2164
|
}
|
|
2117
2165
|
}
|
|
2118
2166
|
|
|
2119
|
-
/** A Filter that implements the not-in operator. */ class
|
|
2167
|
+
/** A Filter that implements the not-in operator. */ class ce extends Xt {
|
|
2120
2168
|
constructor(t, e) {
|
|
2121
2169
|
super(t, "not-in" /* Operator.NOT_IN */ , e);
|
|
2122
2170
|
}
|
|
2123
2171
|
matches(t) {
|
|
2124
|
-
if (
|
|
2172
|
+
if (Ut(this.value.arrayValue, {
|
|
2125
2173
|
nullValue: "NULL_VALUE"
|
|
2126
2174
|
})) return !1;
|
|
2127
2175
|
const e = t.data.field(this.field);
|
|
2128
|
-
return null !== e && !
|
|
2176
|
+
return null !== e && !Ut(this.value.arrayValue, e);
|
|
2129
2177
|
}
|
|
2130
2178
|
}
|
|
2131
2179
|
|
|
2132
|
-
/** A Filter that implements the array-contains-any operator. */ class
|
|
2180
|
+
/** A Filter that implements the array-contains-any operator. */ class ae extends Xt {
|
|
2133
2181
|
constructor(t, e) {
|
|
2134
2182
|
super(t, "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ , e);
|
|
2135
2183
|
}
|
|
2136
2184
|
matches(t) {
|
|
2137
2185
|
const e = t.data.field(this.field);
|
|
2138
|
-
return !(!
|
|
2186
|
+
return !(!Qt(e) || !e.arrayValue.values) && e.arrayValue.values.some((t => Ut(this.value.arrayValue, t)));
|
|
2139
2187
|
}
|
|
2140
2188
|
}
|
|
2141
2189
|
|
|
@@ -2157,13 +2205,13 @@ function re(t, e) {
|
|
|
2157
2205
|
*/
|
|
2158
2206
|
/**
|
|
2159
2207
|
* An ordering on a field, in some Direction. Direction defaults to ASCENDING.
|
|
2160
|
-
*/ class
|
|
2208
|
+
*/ class he {
|
|
2161
2209
|
constructor(t, e = "asc" /* Direction.ASCENDING */) {
|
|
2162
2210
|
this.field = t, this.dir = e;
|
|
2163
2211
|
}
|
|
2164
2212
|
}
|
|
2165
2213
|
|
|
2166
|
-
function
|
|
2214
|
+
function le(t, e) {
|
|
2167
2215
|
return t.dir === e.dir && t.field.isEqual(e.field);
|
|
2168
2216
|
}
|
|
2169
2217
|
|
|
@@ -2186,18 +2234,18 @@ function ae(t, e) {
|
|
|
2186
2234
|
/**
|
|
2187
2235
|
* A version of a document in Firestore. This corresponds to the version
|
|
2188
2236
|
* timestamp, such as update_time or read_time.
|
|
2189
|
-
*/ class
|
|
2237
|
+
*/ class fe {
|
|
2190
2238
|
constructor(t) {
|
|
2191
2239
|
this.timestamp = t;
|
|
2192
2240
|
}
|
|
2193
2241
|
static fromTimestamp(t) {
|
|
2194
|
-
return new
|
|
2242
|
+
return new fe(t);
|
|
2195
2243
|
}
|
|
2196
2244
|
static min() {
|
|
2197
|
-
return new
|
|
2245
|
+
return new fe(new St(0, 0));
|
|
2198
2246
|
}
|
|
2199
2247
|
static max() {
|
|
2200
|
-
return new
|
|
2248
|
+
return new fe(new St(253402300799, 999999999));
|
|
2201
2249
|
}
|
|
2202
2250
|
compareTo(t) {
|
|
2203
2251
|
return this.timestamp._compareTo(t.timestamp);
|
|
@@ -2235,17 +2283,17 @@ function ae(t, e) {
|
|
|
2235
2283
|
*/
|
|
2236
2284
|
// An immutable sorted map implementation, based on a Left-leaning Red-Black
|
|
2237
2285
|
// tree.
|
|
2238
|
-
class
|
|
2286
|
+
class de {
|
|
2239
2287
|
constructor(t, e) {
|
|
2240
|
-
this.comparator = t, this.root = e ||
|
|
2288
|
+
this.comparator = t, this.root = e || me.EMPTY;
|
|
2241
2289
|
}
|
|
2242
2290
|
// Returns a copy of the map, with the specified key/value added or replaced.
|
|
2243
2291
|
insert(t, e) {
|
|
2244
|
-
return new
|
|
2292
|
+
return new de(this.comparator, this.root.insert(t, e, this.comparator).copy(null, null, me.BLACK, null, null));
|
|
2245
2293
|
}
|
|
2246
2294
|
// Returns a copy of the map, with the specified key removed.
|
|
2247
2295
|
remove(t) {
|
|
2248
|
-
return new
|
|
2296
|
+
return new de(this.comparator, this.root.remove(t, this.comparator).copy(null, null, me.BLACK, null, null));
|
|
2249
2297
|
}
|
|
2250
2298
|
// Returns the value of the node with the given key, or null.
|
|
2251
2299
|
get(t) {
|
|
@@ -2311,22 +2359,22 @@ class le {
|
|
|
2311
2359
|
}
|
|
2312
2360
|
// Returns an iterator over the SortedMap.
|
|
2313
2361
|
getIterator() {
|
|
2314
|
-
return new
|
|
2362
|
+
return new we(this.root, null, this.comparator, !1);
|
|
2315
2363
|
}
|
|
2316
2364
|
getIteratorFrom(t) {
|
|
2317
|
-
return new
|
|
2365
|
+
return new we(this.root, t, this.comparator, !1);
|
|
2318
2366
|
}
|
|
2319
2367
|
getReverseIterator() {
|
|
2320
|
-
return new
|
|
2368
|
+
return new we(this.root, null, this.comparator, !0);
|
|
2321
2369
|
}
|
|
2322
2370
|
getReverseIteratorFrom(t) {
|
|
2323
|
-
return new
|
|
2371
|
+
return new we(this.root, t, this.comparator, !0);
|
|
2324
2372
|
}
|
|
2325
2373
|
}
|
|
2326
2374
|
|
|
2327
2375
|
// end SortedMap
|
|
2328
2376
|
// An iterator over an LLRBNode.
|
|
2329
|
-
class
|
|
2377
|
+
class we {
|
|
2330
2378
|
constructor(t, e, n, r) {
|
|
2331
2379
|
this.isReverse = r, this.nodeStack = [];
|
|
2332
2380
|
let s = 1;
|
|
@@ -2371,14 +2419,14 @@ class fe {
|
|
|
2371
2419
|
|
|
2372
2420
|
// end SortedMapIterator
|
|
2373
2421
|
// Represents a node in a Left-leaning Red-Black tree.
|
|
2374
|
-
class
|
|
2422
|
+
class me {
|
|
2375
2423
|
constructor(t, e, n, r, s) {
|
|
2376
|
-
this.key = t, this.value = e, this.color = null != n ? n :
|
|
2377
|
-
this.right = null != s ? s :
|
|
2424
|
+
this.key = t, this.value = e, this.color = null != n ? n : me.RED, this.left = null != r ? r : me.EMPTY,
|
|
2425
|
+
this.right = null != s ? s : me.EMPTY, this.size = this.left.size + 1 + this.right.size;
|
|
2378
2426
|
}
|
|
2379
2427
|
// Returns a copy of the current node, optionally replacing pieces of it.
|
|
2380
2428
|
copy(t, e, n, r, s) {
|
|
2381
|
-
return new
|
|
2429
|
+
return new me(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);
|
|
2382
2430
|
}
|
|
2383
2431
|
isEmpty() {
|
|
2384
2432
|
return !1;
|
|
@@ -2417,7 +2465,7 @@ class de {
|
|
|
2417
2465
|
r.fixUp();
|
|
2418
2466
|
}
|
|
2419
2467
|
removeMin() {
|
|
2420
|
-
if (this.left.isEmpty()) return
|
|
2468
|
+
if (this.left.isEmpty()) return me.EMPTY;
|
|
2421
2469
|
let t = this;
|
|
2422
2470
|
return t.left.isRed() || t.left.left.isRed() || (t = t.moveRedLeft()), t = t.copy(null, null, null, t.left.removeMin(), null),
|
|
2423
2471
|
t.fixUp();
|
|
@@ -2429,7 +2477,7 @@ class de {
|
|
|
2429
2477
|
r = r.copy(null, null, null, r.left.remove(t, e), null); else {
|
|
2430
2478
|
if (r.left.isRed() && (r = r.rotateRight()), r.right.isEmpty() || r.right.isRed() || r.right.left.isRed() || (r = r.moveRedRight()),
|
|
2431
2479
|
0 === e(t, r.key)) {
|
|
2432
|
-
if (r.right.isEmpty()) return
|
|
2480
|
+
if (r.right.isEmpty()) return me.EMPTY;
|
|
2433
2481
|
n = r.right.min(), r = r.copy(n.key, n.value, null, null, r.right.removeMin());
|
|
2434
2482
|
}
|
|
2435
2483
|
r = r.copy(null, null, null, null, r.right.remove(t, e));
|
|
@@ -2455,11 +2503,11 @@ class de {
|
|
|
2455
2503
|
return t.left.left.isRed() && (t = t.rotateRight(), t = t.colorFlip()), t;
|
|
2456
2504
|
}
|
|
2457
2505
|
rotateLeft() {
|
|
2458
|
-
const t = this.copy(null, null,
|
|
2506
|
+
const t = this.copy(null, null, me.RED, null, this.right.left);
|
|
2459
2507
|
return this.right.copy(null, null, this.color, t, null);
|
|
2460
2508
|
}
|
|
2461
2509
|
rotateRight() {
|
|
2462
|
-
const t = this.copy(null, null,
|
|
2510
|
+
const t = this.copy(null, null, me.RED, this.left.right, null);
|
|
2463
2511
|
return this.left.copy(null, null, this.color, null, t);
|
|
2464
2512
|
}
|
|
2465
2513
|
colorFlip() {
|
|
@@ -2485,10 +2533,10 @@ class de {
|
|
|
2485
2533
|
// end LLRBNode
|
|
2486
2534
|
// Empty node is shared between all LLRB trees.
|
|
2487
2535
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2488
|
-
|
|
2536
|
+
me.EMPTY = null, me.RED = !0, me.BLACK = !1;
|
|
2489
2537
|
|
|
2490
2538
|
// end LLRBEmptyNode
|
|
2491
|
-
|
|
2539
|
+
me.EMPTY = new
|
|
2492
2540
|
// Represents an empty node (a leaf node in the Red-Black Tree).
|
|
2493
2541
|
class {
|
|
2494
2542
|
constructor() {
|
|
@@ -2515,7 +2563,7 @@ class {
|
|
|
2515
2563
|
}
|
|
2516
2564
|
// Returns a copy of the tree, with the specified key/value added.
|
|
2517
2565
|
insert(t, e, n) {
|
|
2518
|
-
return new
|
|
2566
|
+
return new me(t, e);
|
|
2519
2567
|
}
|
|
2520
2568
|
// Returns a copy of the tree, with the specified key removed.
|
|
2521
2569
|
remove(t, e) {
|
|
@@ -2571,9 +2619,9 @@ class {
|
|
|
2571
2619
|
* NOTE: if provided comparator returns 0 for two elements, we consider them to
|
|
2572
2620
|
* be equal!
|
|
2573
2621
|
*/
|
|
2574
|
-
class
|
|
2622
|
+
class pe {
|
|
2575
2623
|
constructor(t) {
|
|
2576
|
-
this.comparator = t, this.data = new
|
|
2624
|
+
this.comparator = t, this.data = new de(this.comparator);
|
|
2577
2625
|
}
|
|
2578
2626
|
has(t) {
|
|
2579
2627
|
return null !== this.data.get(t);
|
|
@@ -2614,10 +2662,10 @@ class we {
|
|
|
2614
2662
|
return e.hasNext() ? e.getNext().key : null;
|
|
2615
2663
|
}
|
|
2616
2664
|
getIterator() {
|
|
2617
|
-
return new
|
|
2665
|
+
return new ye(this.data.getIterator());
|
|
2618
2666
|
}
|
|
2619
2667
|
getIteratorFrom(t) {
|
|
2620
|
-
return new
|
|
2668
|
+
return new ye(this.data.getIteratorFrom(t));
|
|
2621
2669
|
}
|
|
2622
2670
|
/** Inserts or updates an element */ add(t) {
|
|
2623
2671
|
return this.copy(this.data.remove(t).insert(t, !0));
|
|
@@ -2636,7 +2684,7 @@ class we {
|
|
|
2636
2684
|
})), e;
|
|
2637
2685
|
}
|
|
2638
2686
|
isEqual(t) {
|
|
2639
|
-
if (!(t instanceof
|
|
2687
|
+
if (!(t instanceof pe)) return !1;
|
|
2640
2688
|
if (this.size !== t.size) return !1;
|
|
2641
2689
|
const e = this.data.getIterator(), n = t.data.getIterator();
|
|
2642
2690
|
for (;e.hasNext(); ) {
|
|
@@ -2656,12 +2704,12 @@ class we {
|
|
|
2656
2704
|
return this.forEach((e => t.push(e))), "SortedSet(" + t.toString() + ")";
|
|
2657
2705
|
}
|
|
2658
2706
|
copy(t) {
|
|
2659
|
-
const e = new
|
|
2707
|
+
const e = new pe(this.comparator);
|
|
2660
2708
|
return e.data = t, e;
|
|
2661
2709
|
}
|
|
2662
2710
|
}
|
|
2663
2711
|
|
|
2664
|
-
class
|
|
2712
|
+
class ye {
|
|
2665
2713
|
constructor(t) {
|
|
2666
2714
|
this.iter = t;
|
|
2667
2715
|
}
|
|
@@ -2698,7 +2746,7 @@ class me {
|
|
|
2698
2746
|
* foo.bar - Overwrites only the field bar of the object foo.
|
|
2699
2747
|
* If foo is not an object, foo is replaced with an object
|
|
2700
2748
|
* containing foo
|
|
2701
|
-
*/ class
|
|
2749
|
+
*/ class ge {
|
|
2702
2750
|
constructor(t) {
|
|
2703
2751
|
this.fields = t,
|
|
2704
2752
|
// TODO(dimond): validation of FieldMask
|
|
@@ -2706,16 +2754,16 @@ class me {
|
|
|
2706
2754
|
t.sort(nt.comparator);
|
|
2707
2755
|
}
|
|
2708
2756
|
static empty() {
|
|
2709
|
-
return new
|
|
2757
|
+
return new ge([]);
|
|
2710
2758
|
}
|
|
2711
2759
|
/**
|
|
2712
2760
|
* Returns a new FieldMask object that is the result of adding all the given
|
|
2713
2761
|
* fields paths to this field mask.
|
|
2714
2762
|
*/ unionWith(t) {
|
|
2715
|
-
let e = new
|
|
2763
|
+
let e = new pe(nt.comparator);
|
|
2716
2764
|
for (const t of this.fields) e = e.add(t);
|
|
2717
2765
|
for (const n of t) e = e.add(n);
|
|
2718
|
-
return new
|
|
2766
|
+
return new ge(e.toArray());
|
|
2719
2767
|
}
|
|
2720
2768
|
/**
|
|
2721
2769
|
* Verifies that `fieldPath` is included by at least one field in this field
|
|
@@ -2727,7 +2775,7 @@ class me {
|
|
|
2727
2775
|
return !1;
|
|
2728
2776
|
}
|
|
2729
2777
|
isEqual(t) {
|
|
2730
|
-
return
|
|
2778
|
+
return Tt(this.fields, t.fields, ((t, e) => t.isEqual(e)));
|
|
2731
2779
|
}
|
|
2732
2780
|
}
|
|
2733
2781
|
|
|
@@ -2750,12 +2798,12 @@ class me {
|
|
|
2750
2798
|
/**
|
|
2751
2799
|
* An ObjectValue represents a MapValue in the Firestore Proto and offers the
|
|
2752
2800
|
* ability to add and remove fields (via the ObjectValueBuilder).
|
|
2753
|
-
*/ class
|
|
2801
|
+
*/ class _e {
|
|
2754
2802
|
constructor(t) {
|
|
2755
2803
|
this.value = t;
|
|
2756
2804
|
}
|
|
2757
2805
|
static empty() {
|
|
2758
|
-
return new
|
|
2806
|
+
return new _e({
|
|
2759
2807
|
mapValue: {}
|
|
2760
2808
|
});
|
|
2761
2809
|
}
|
|
@@ -2769,7 +2817,7 @@ class me {
|
|
|
2769
2817
|
{
|
|
2770
2818
|
let e = this.value;
|
|
2771
2819
|
for (let n = 0; n < t.length - 1; ++n) if (e = (e.mapValue.fields || {})[t.get(n)],
|
|
2772
|
-
!
|
|
2820
|
+
!Kt(e)) return null;
|
|
2773
2821
|
return e = (e.mapValue.fields || {})[t.lastSegment()], e || null;
|
|
2774
2822
|
}
|
|
2775
2823
|
}
|
|
@@ -2779,7 +2827,7 @@ class me {
|
|
|
2779
2827
|
* @param path - The field path to set.
|
|
2780
2828
|
* @param value - The value to set.
|
|
2781
2829
|
*/ set(t, e) {
|
|
2782
|
-
this.getFieldsMap(t.popLast())[t.lastSegment()] =
|
|
2830
|
+
this.getFieldsMap(t.popLast())[t.lastSegment()] = Yt(e);
|
|
2783
2831
|
}
|
|
2784
2832
|
/**
|
|
2785
2833
|
* Sets the provided fields to the provided values.
|
|
@@ -2793,7 +2841,7 @@ class me {
|
|
|
2793
2841
|
const t = this.getFieldsMap(e);
|
|
2794
2842
|
this.applyChanges(t, n, r), n = {}, r = [], e = s.popLast();
|
|
2795
2843
|
}
|
|
2796
|
-
t ? n[s.lastSegment()] =
|
|
2844
|
+
t ? n[s.lastSegment()] = Yt(t) : r.push(s.lastSegment());
|
|
2797
2845
|
}));
|
|
2798
2846
|
const s = this.getFieldsMap(e);
|
|
2799
2847
|
this.applyChanges(s, n, r);
|
|
@@ -2805,10 +2853,10 @@ class me {
|
|
|
2805
2853
|
* @param path - The field path to remove.
|
|
2806
2854
|
*/ delete(t) {
|
|
2807
2855
|
const e = this.field(t.popLast());
|
|
2808
|
-
|
|
2856
|
+
Kt(e) && e.mapValue.fields && delete e.mapValue.fields[t.lastSegment()];
|
|
2809
2857
|
}
|
|
2810
2858
|
isEqual(t) {
|
|
2811
|
-
return
|
|
2859
|
+
return Mt(this.value, t.value);
|
|
2812
2860
|
}
|
|
2813
2861
|
/**
|
|
2814
2862
|
* Returns the map that contains the leaf element of `path`. If the parent
|
|
@@ -2820,7 +2868,7 @@ class me {
|
|
|
2820
2868
|
});
|
|
2821
2869
|
for (let n = 0; n < t.length; ++n) {
|
|
2822
2870
|
let r = e.mapValue.fields[t.get(n)];
|
|
2823
|
-
|
|
2871
|
+
Kt(r) && r.mapValue.fields || (r = {
|
|
2824
2872
|
mapValue: {
|
|
2825
2873
|
fields: {}
|
|
2826
2874
|
}
|
|
@@ -2832,11 +2880,11 @@ class me {
|
|
|
2832
2880
|
* Modifies `fieldsMap` by adding, replacing or deleting the specified
|
|
2833
2881
|
* entries.
|
|
2834
2882
|
*/ applyChanges(t, e, n) {
|
|
2835
|
-
|
|
2883
|
+
Pt(e, ((e, n) => t[e] = n));
|
|
2836
2884
|
for (const e of n) delete t[e];
|
|
2837
2885
|
}
|
|
2838
2886
|
clone() {
|
|
2839
|
-
return new
|
|
2887
|
+
return new _e(Yt(this.value));
|
|
2840
2888
|
}
|
|
2841
2889
|
}
|
|
2842
2890
|
|
|
@@ -2865,7 +2913,7 @@ class me {
|
|
|
2865
2913
|
* not transition to one of these states even after all mutations have been
|
|
2866
2914
|
* applied, `isValidDocument()` returns false and the document should be removed
|
|
2867
2915
|
* from all views.
|
|
2868
|
-
*/ class
|
|
2916
|
+
*/ class ve {
|
|
2869
2917
|
constructor(t, e, n, r, s, i, o) {
|
|
2870
2918
|
this.key = t, this.documentType = e, this.version = n, this.readTime = r, this.createTime = s,
|
|
2871
2919
|
this.data = i, this.documentState = o;
|
|
@@ -2874,35 +2922,35 @@ class me {
|
|
|
2874
2922
|
* Creates a document with no known version or data, but which can serve as
|
|
2875
2923
|
* base document for mutations.
|
|
2876
2924
|
*/ static newInvalidDocument(t) {
|
|
2877
|
-
return new
|
|
2878
|
-
/* version */
|
|
2879
|
-
/* readTime */
|
|
2880
|
-
/* createTime */
|
|
2925
|
+
return new ve(t, 0 /* DocumentType.INVALID */ ,
|
|
2926
|
+
/* version */ fe.min(),
|
|
2927
|
+
/* readTime */ fe.min(),
|
|
2928
|
+
/* createTime */ fe.min(), _e.empty(), 0 /* DocumentState.SYNCED */);
|
|
2881
2929
|
}
|
|
2882
2930
|
/**
|
|
2883
2931
|
* Creates a new document that is known to exist with the given data at the
|
|
2884
2932
|
* given version.
|
|
2885
2933
|
*/ static newFoundDocument(t, e, n, r) {
|
|
2886
|
-
return new
|
|
2934
|
+
return new ve(t, 1 /* DocumentType.FOUND_DOCUMENT */ ,
|
|
2887
2935
|
/* version */ e,
|
|
2888
|
-
/* readTime */
|
|
2936
|
+
/* readTime */ fe.min(),
|
|
2889
2937
|
/* createTime */ n, r, 0 /* DocumentState.SYNCED */);
|
|
2890
2938
|
}
|
|
2891
2939
|
/** Creates a new document that is known to not exist at the given version. */ static newNoDocument(t, e) {
|
|
2892
|
-
return new
|
|
2940
|
+
return new ve(t, 2 /* DocumentType.NO_DOCUMENT */ ,
|
|
2893
2941
|
/* version */ e,
|
|
2894
|
-
/* readTime */
|
|
2895
|
-
/* createTime */
|
|
2942
|
+
/* readTime */ fe.min(),
|
|
2943
|
+
/* createTime */ fe.min(), _e.empty(), 0 /* DocumentState.SYNCED */);
|
|
2896
2944
|
}
|
|
2897
2945
|
/**
|
|
2898
2946
|
* Creates a new document that is known to exist at the given version but
|
|
2899
2947
|
* whose data is not known (e.g. a document that was updated without a known
|
|
2900
2948
|
* base document).
|
|
2901
2949
|
*/ static newUnknownDocument(t, e) {
|
|
2902
|
-
return new
|
|
2950
|
+
return new ve(t, 3 /* DocumentType.UNKNOWN_DOCUMENT */ ,
|
|
2903
2951
|
/* version */ e,
|
|
2904
|
-
/* readTime */
|
|
2905
|
-
/* createTime */
|
|
2952
|
+
/* readTime */ fe.min(),
|
|
2953
|
+
/* createTime */ fe.min(), _e.empty(), 2 /* DocumentState.HAS_COMMITTED_MUTATIONS */);
|
|
2906
2954
|
}
|
|
2907
2955
|
/**
|
|
2908
2956
|
* Changes the document type to indicate that it exists and that its version
|
|
@@ -2913,7 +2961,7 @@ class me {
|
|
|
2913
2961
|
// update from Watch or due to applying a local set mutation on top
|
|
2914
2962
|
// of a deleted document, our best guess about its createTime would be the
|
|
2915
2963
|
// version at which the document transitioned to a FOUND_DOCUMENT.
|
|
2916
|
-
return !this.createTime.isEqual(
|
|
2964
|
+
return !this.createTime.isEqual(fe.min()) || 2 /* DocumentType.NO_DOCUMENT */ !== this.documentType && 0 /* DocumentType.INVALID */ !== this.documentType || (this.createTime = t),
|
|
2917
2965
|
this.version = t, this.documentType = 1 /* DocumentType.FOUND_DOCUMENT */ , this.data = e,
|
|
2918
2966
|
this.documentState = 0 /* DocumentState.SYNCED */ , this;
|
|
2919
2967
|
}
|
|
@@ -2922,7 +2970,7 @@ class me {
|
|
|
2922
2970
|
* version.
|
|
2923
2971
|
*/ convertToNoDocument(t) {
|
|
2924
2972
|
return this.version = t, this.documentType = 2 /* DocumentType.NO_DOCUMENT */ ,
|
|
2925
|
-
this.data =
|
|
2973
|
+
this.data = _e.empty(), this.documentState = 0 /* DocumentState.SYNCED */ , this;
|
|
2926
2974
|
}
|
|
2927
2975
|
/**
|
|
2928
2976
|
* Changes the document type to indicate that it exists at a given version but
|
|
@@ -2930,14 +2978,14 @@ class me {
|
|
|
2930
2978
|
* base document).
|
|
2931
2979
|
*/ convertToUnknownDocument(t) {
|
|
2932
2980
|
return this.version = t, this.documentType = 3 /* DocumentType.UNKNOWN_DOCUMENT */ ,
|
|
2933
|
-
this.data =
|
|
2981
|
+
this.data = _e.empty(), this.documentState = 2 /* DocumentState.HAS_COMMITTED_MUTATIONS */ ,
|
|
2934
2982
|
this;
|
|
2935
2983
|
}
|
|
2936
2984
|
setHasCommittedMutations() {
|
|
2937
2985
|
return this.documentState = 2 /* DocumentState.HAS_COMMITTED_MUTATIONS */ , this;
|
|
2938
2986
|
}
|
|
2939
2987
|
setHasLocalMutations() {
|
|
2940
|
-
return this.documentState = 1 /* DocumentState.HAS_LOCAL_MUTATIONS */ , this.version =
|
|
2988
|
+
return this.documentState = 1 /* DocumentState.HAS_LOCAL_MUTATIONS */ , this.version = fe.min(),
|
|
2941
2989
|
this;
|
|
2942
2990
|
}
|
|
2943
2991
|
setReadTime(t) {
|
|
@@ -2965,10 +3013,10 @@ class me {
|
|
|
2965
3013
|
return 3 /* DocumentType.UNKNOWN_DOCUMENT */ === this.documentType;
|
|
2966
3014
|
}
|
|
2967
3015
|
isEqual(t) {
|
|
2968
|
-
return t instanceof
|
|
3016
|
+
return t instanceof ve && this.key.isEqual(t.key) && this.version.isEqual(t.version) && this.documentType === t.documentType && this.documentState === t.documentState && this.data.isEqual(t.data);
|
|
2969
3017
|
}
|
|
2970
3018
|
mutableCopy() {
|
|
2971
|
-
return new
|
|
3019
|
+
return new ve(this.key, this.documentType, this.version, this.readTime, this.createTime, this.data.clone(), this.documentState);
|
|
2972
3020
|
}
|
|
2973
3021
|
toString() {
|
|
2974
3022
|
return `Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`;
|
|
@@ -2992,7 +3040,7 @@ class me {
|
|
|
2992
3040
|
* limitations under the License.
|
|
2993
3041
|
*/
|
|
2994
3042
|
// Visible for testing
|
|
2995
|
-
class
|
|
3043
|
+
class be {
|
|
2996
3044
|
constructor(t, e = null, n = [], r = [], s = null, i = null, o = null) {
|
|
2997
3045
|
this.path = t, this.collectionGroup = e, this.orderBy = n, this.filters = r, this.limit = s,
|
|
2998
3046
|
this.startAt = i, this.endAt = o, this.O = null;
|
|
@@ -3006,8 +3054,8 @@ class _e {
|
|
|
3006
3054
|
* NOTE: you should always construct `Target` from `Query.toTarget` instead of
|
|
3007
3055
|
* using this factory method, because `Query` provides an implicit `orderBy`
|
|
3008
3056
|
* property.
|
|
3009
|
-
*/ function
|
|
3010
|
-
return new
|
|
3057
|
+
*/ function Ee(t, e = null, n = [], r = [], s = null, i = null, o = null) {
|
|
3058
|
+
return new be(t, e, n, r, s, i, o);
|
|
3011
3059
|
}
|
|
3012
3060
|
|
|
3013
3061
|
/**
|
|
@@ -3033,7 +3081,7 @@ class _e {
|
|
|
3033
3081
|
*
|
|
3034
3082
|
* Visible for testing.
|
|
3035
3083
|
*/
|
|
3036
|
-
class
|
|
3084
|
+
class Ae {
|
|
3037
3085
|
/**
|
|
3038
3086
|
* Initializes a Query with a path and optional additional query constraints.
|
|
3039
3087
|
* Path must currently be empty if this is a collection group query.
|
|
@@ -3046,11 +3094,11 @@ class be {
|
|
|
3046
3094
|
}
|
|
3047
3095
|
}
|
|
3048
3096
|
|
|
3049
|
-
/** Creates a new Query for a query that matches all documents at `path` */ function
|
|
3097
|
+
/** Creates a new Query for a query that matches all documents at `path` */ function Ie(t) {
|
|
3050
3098
|
return t.explicitOrderBy.length > 0 ? t.explicitOrderBy[0].field : null;
|
|
3051
3099
|
}
|
|
3052
3100
|
|
|
3053
|
-
function
|
|
3101
|
+
function Te(t) {
|
|
3054
3102
|
for (const e of t.filters) {
|
|
3055
3103
|
const t = e.getFirstInequalityField();
|
|
3056
3104
|
if (null !== t) return t;
|
|
@@ -3066,7 +3114,7 @@ function Ae(t) {
|
|
|
3066
3114
|
* Returns whether the query matches a collection group rather than a specific
|
|
3067
3115
|
* collection.
|
|
3068
3116
|
*/
|
|
3069
|
-
function
|
|
3117
|
+
function Re(t) {
|
|
3070
3118
|
return null !== t.collectionGroup;
|
|
3071
3119
|
}
|
|
3072
3120
|
|
|
@@ -3074,23 +3122,23 @@ function Ie(t) {
|
|
|
3074
3122
|
* Returns the implicit order by constraint that is used to execute the Query,
|
|
3075
3123
|
* which can be different from the order by constraints the user provided (e.g.
|
|
3076
3124
|
* the SDK and backend always orders by `__name__`).
|
|
3077
|
-
*/ function
|
|
3125
|
+
*/ function Pe(t) {
|
|
3078
3126
|
const e = A(t);
|
|
3079
3127
|
if (null === e.k) {
|
|
3080
3128
|
e.k = [];
|
|
3081
|
-
const t =
|
|
3129
|
+
const t = Te(e), n = Ie(e);
|
|
3082
3130
|
if (null !== t && null === n)
|
|
3083
3131
|
// In order to implicitly add key ordering, we must also add the
|
|
3084
3132
|
// inequality filter field for it to be a valid query.
|
|
3085
3133
|
// Note that the default inequality field and key ordering is ascending.
|
|
3086
|
-
t.isKeyField() || e.k.push(new
|
|
3134
|
+
t.isKeyField() || e.k.push(new he(t)), e.k.push(new he(nt.keyField(), "asc" /* Direction.ASCENDING */)); else {
|
|
3087
3135
|
let t = !1;
|
|
3088
3136
|
for (const n of e.explicitOrderBy) e.k.push(n), n.field.isKeyField() && (t = !0);
|
|
3089
3137
|
if (!t) {
|
|
3090
3138
|
// The order of the implicit key ordering always matches the last
|
|
3091
3139
|
// explicit order by
|
|
3092
3140
|
const t = e.explicitOrderBy.length > 0 ? e.explicitOrderBy[e.explicitOrderBy.length - 1].dir : "asc" /* Direction.ASCENDING */;
|
|
3093
|
-
e.k.push(new
|
|
3141
|
+
e.k.push(new he(nt.keyField(), t));
|
|
3094
3142
|
}
|
|
3095
3143
|
}
|
|
3096
3144
|
}
|
|
@@ -3099,38 +3147,38 @@ function Ie(t) {
|
|
|
3099
3147
|
|
|
3100
3148
|
/**
|
|
3101
3149
|
* Converts this `Query` instance to it's corresponding `Target` representation.
|
|
3102
|
-
*/ function
|
|
3150
|
+
*/ function Ve(t) {
|
|
3103
3151
|
const e = A(t);
|
|
3104
|
-
if (!e.C) if ("F" /* LimitType.First */ === e.limitType) e.C =
|
|
3152
|
+
if (!e.C) if ("F" /* LimitType.First */ === e.limitType) e.C = Ee(e.path, e.collectionGroup, Pe(e), e.filters, e.limit, e.startAt, e.endAt); else {
|
|
3105
3153
|
// Flip the orderBy directions since we want the last results
|
|
3106
3154
|
const t = [];
|
|
3107
|
-
for (const n of
|
|
3155
|
+
for (const n of Pe(e)) {
|
|
3108
3156
|
const e = "desc" /* Direction.DESCENDING */ === n.dir ? "asc" /* Direction.ASCENDING */ : "desc" /* Direction.DESCENDING */;
|
|
3109
|
-
t.push(new
|
|
3157
|
+
t.push(new he(n.field, e));
|
|
3110
3158
|
}
|
|
3111
3159
|
// We need to swap the cursors to match the now-flipped query ordering.
|
|
3112
|
-
const n = e.endAt ? new
|
|
3160
|
+
const n = e.endAt ? new Ht(e.endAt.position, e.endAt.inclusive) : null, r = e.startAt ? new Ht(e.startAt.position, e.startAt.inclusive) : null;
|
|
3113
3161
|
// Now return as a LimitType.First query.
|
|
3114
|
-
e.C =
|
|
3162
|
+
e.C = Ee(e.path, e.collectionGroup, t, e.filters, e.limit, n, r);
|
|
3115
3163
|
}
|
|
3116
3164
|
return e.C;
|
|
3117
3165
|
}
|
|
3118
3166
|
|
|
3119
|
-
function
|
|
3120
|
-
e.getFirstInequalityField(),
|
|
3167
|
+
function $e(t, e) {
|
|
3168
|
+
e.getFirstInequalityField(), Te(t);
|
|
3121
3169
|
const n = t.filters.concat([ e ]);
|
|
3122
|
-
return new
|
|
3170
|
+
return new Ae(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
|
|
3123
3171
|
}
|
|
3124
3172
|
|
|
3125
|
-
function
|
|
3173
|
+
function De(t, e) {
|
|
3126
3174
|
return function(t, e) {
|
|
3127
3175
|
if (t.limit !== e.limit) return !1;
|
|
3128
3176
|
if (t.orderBy.length !== e.orderBy.length) return !1;
|
|
3129
|
-
for (let n = 0; n < t.orderBy.length; n++) if (!
|
|
3177
|
+
for (let n = 0; n < t.orderBy.length; n++) if (!le(t.orderBy[n], e.orderBy[n])) return !1;
|
|
3130
3178
|
if (t.filters.length !== e.filters.length) return !1;
|
|
3131
|
-
for (let n = 0; n < t.filters.length; n++) if (!
|
|
3132
|
-
return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!
|
|
3133
|
-
}(
|
|
3179
|
+
for (let n = 0; n < t.filters.length; n++) if (!ee(t.filters[n], e.filters[n])) return !1;
|
|
3180
|
+
return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!Zt(t.startAt, e.startAt) && Zt(t.endAt, e.endAt);
|
|
3181
|
+
}(Ve(t), Ve(e)) && t.limitType === e.limitType;
|
|
3134
3182
|
}
|
|
3135
3183
|
|
|
3136
3184
|
/**
|
|
@@ -3158,9 +3206,9 @@ function Ve(t, e) {
|
|
|
3158
3206
|
* The return value is an IntegerValue if it can safely represent the value,
|
|
3159
3207
|
* otherwise a DoubleValue is returned.
|
|
3160
3208
|
*/
|
|
3161
|
-
function
|
|
3209
|
+
function Ne(t, e) {
|
|
3162
3210
|
return function(t) {
|
|
3163
|
-
return "number" == typeof t && Number.isInteger(t) && !
|
|
3211
|
+
return "number" == typeof t && Number.isInteger(t) && !dt(t) && t <= Number.MAX_SAFE_INTEGER && t >= Number.MIN_SAFE_INTEGER;
|
|
3164
3212
|
}(e) ?
|
|
3165
3213
|
/**
|
|
3166
3214
|
* Returns an IntegerValue for `value`.
|
|
@@ -3182,7 +3230,7 @@ function $e(t, e) {
|
|
|
3182
3230
|
};
|
|
3183
3231
|
}
|
|
3184
3232
|
return {
|
|
3185
|
-
doubleValue:
|
|
3233
|
+
doubleValue: dt(e) ? "-0" : e
|
|
3186
3234
|
};
|
|
3187
3235
|
}(t, e);
|
|
3188
3236
|
}
|
|
@@ -3203,7 +3251,7 @@ function $e(t, e) {
|
|
|
3203
3251
|
* See the License for the specific language governing permissions and
|
|
3204
3252
|
* limitations under the License.
|
|
3205
3253
|
*/
|
|
3206
|
-
/** Used to represent a field transform on a mutation. */ class
|
|
3254
|
+
/** Used to represent a field transform on a mutation. */ class Fe {
|
|
3207
3255
|
constructor() {
|
|
3208
3256
|
// Make sure that the structural type of `TransformOperation` is unique.
|
|
3209
3257
|
// See https://github.com/microsoft/TypeScript/issues/5451
|
|
@@ -3211,15 +3259,15 @@ function $e(t, e) {
|
|
|
3211
3259
|
}
|
|
3212
3260
|
}
|
|
3213
3261
|
|
|
3214
|
-
/** Transforms a value into a server-generated timestamp. */ class
|
|
3262
|
+
/** Transforms a value into a server-generated timestamp. */ class xe extends Fe {}
|
|
3215
3263
|
|
|
3216
|
-
/** Transforms an array value via a union operation. */ class
|
|
3264
|
+
/** Transforms an array value via a union operation. */ class Se extends Fe {
|
|
3217
3265
|
constructor(t) {
|
|
3218
3266
|
super(), this.elements = t;
|
|
3219
3267
|
}
|
|
3220
3268
|
}
|
|
3221
3269
|
|
|
3222
|
-
/** Transforms an array value via a remove operation. */ class
|
|
3270
|
+
/** Transforms an array value via a remove operation. */ class qe extends Fe {
|
|
3223
3271
|
constructor(t) {
|
|
3224
3272
|
super(), this.elements = t;
|
|
3225
3273
|
}
|
|
@@ -3230,7 +3278,7 @@ function $e(t, e) {
|
|
|
3230
3278
|
* transforms. Converts all field values to integers or doubles, but unlike the
|
|
3231
3279
|
* backend does not cap integer values at 2^63. Instead, JavaScript number
|
|
3232
3280
|
* arithmetic is used and precision loss can occur for values greater than 2^53.
|
|
3233
|
-
*/ class
|
|
3281
|
+
*/ class Oe extends Fe {
|
|
3234
3282
|
constructor(t, e) {
|
|
3235
3283
|
super(), this.M = t, this.U = e;
|
|
3236
3284
|
}
|
|
@@ -3252,7 +3300,7 @@ function $e(t, e) {
|
|
|
3252
3300
|
* See the License for the specific language governing permissions and
|
|
3253
3301
|
* limitations under the License.
|
|
3254
3302
|
*/
|
|
3255
|
-
/** A field path and the TransformOperation to perform upon it. */ class
|
|
3303
|
+
/** A field path and the TransformOperation to perform upon it. */ class ke {
|
|
3256
3304
|
constructor(t, e) {
|
|
3257
3305
|
this.field = t, this.transform = e;
|
|
3258
3306
|
}
|
|
@@ -3262,18 +3310,18 @@ function $e(t, e) {
|
|
|
3262
3310
|
* Encodes a precondition for a mutation. This follows the model that the
|
|
3263
3311
|
* backend accepts with the special case of an explicit "empty" precondition
|
|
3264
3312
|
* (meaning no precondition).
|
|
3265
|
-
*/ class
|
|
3313
|
+
*/ class Ce {
|
|
3266
3314
|
constructor(t, e) {
|
|
3267
3315
|
this.updateTime = t, this.exists = e;
|
|
3268
3316
|
}
|
|
3269
3317
|
/** Creates a new empty Precondition. */ static none() {
|
|
3270
|
-
return new
|
|
3318
|
+
return new Ce;
|
|
3271
3319
|
}
|
|
3272
3320
|
/** Creates a new Precondition with an exists flag. */ static exists(t) {
|
|
3273
|
-
return new
|
|
3321
|
+
return new Ce(void 0, t);
|
|
3274
3322
|
}
|
|
3275
3323
|
/** Creates a new Precondition based on a version a document exists at. */ static updateTime(t) {
|
|
3276
|
-
return new
|
|
3324
|
+
return new Ce(t);
|
|
3277
3325
|
}
|
|
3278
3326
|
/** Returns whether this Precondition is empty. */ get isNone() {
|
|
3279
3327
|
return void 0 === this.updateTime && void 0 === this.exists;
|
|
@@ -3326,12 +3374,12 @@ function $e(t, e) {
|
|
|
3326
3374
|
* applyToLocalView() to implement the actual behavior of applying the mutation
|
|
3327
3375
|
* to some source document (see `setMutationApplyToRemoteDocument()` for an
|
|
3328
3376
|
* example).
|
|
3329
|
-
*/ class
|
|
3377
|
+
*/ class Le {}
|
|
3330
3378
|
|
|
3331
3379
|
/**
|
|
3332
3380
|
* A mutation that creates or replaces the document at the given key with the
|
|
3333
3381
|
* object value contents.
|
|
3334
|
-
*/ class
|
|
3382
|
+
*/ class Me extends Le {
|
|
3335
3383
|
constructor(t, e, n, r = []) {
|
|
3336
3384
|
super(), this.key = t, this.value = e, this.precondition = n, this.fieldTransforms = r,
|
|
3337
3385
|
this.type = 0 /* MutationType.Set */;
|
|
@@ -3353,7 +3401,7 @@ function $e(t, e) {
|
|
|
3353
3401
|
* is deleted.
|
|
3354
3402
|
* * When a field is not in the mask but is in the values, the values map is
|
|
3355
3403
|
* ignored.
|
|
3356
|
-
*/ class
|
|
3404
|
+
*/ class Ue extends Le {
|
|
3357
3405
|
constructor(t, e, n, r, s = []) {
|
|
3358
3406
|
super(), this.key = t, this.data = e, this.fieldMask = n, this.precondition = r,
|
|
3359
3407
|
this.fieldTransforms = s, this.type = 1 /* MutationType.Patch */;
|
|
@@ -3363,7 +3411,7 @@ function $e(t, e) {
|
|
|
3363
3411
|
}
|
|
3364
3412
|
}
|
|
3365
3413
|
|
|
3366
|
-
/** A mutation that deletes the document at the given key. */ class
|
|
3414
|
+
/** A mutation that deletes the document at the given key. */ class je extends Le {
|
|
3367
3415
|
constructor(t, e) {
|
|
3368
3416
|
super(), this.key = t, this.precondition = e, this.type = 2 /* MutationType.Delete */ ,
|
|
3369
3417
|
this.fieldTransforms = [];
|
|
@@ -3379,7 +3427,7 @@ function $e(t, e) {
|
|
|
3379
3427
|
*
|
|
3380
3428
|
* The `verify` operation is only used in Transactions, and this class serves
|
|
3381
3429
|
* primarily to facilitate serialization into protos.
|
|
3382
|
-
*/ class
|
|
3430
|
+
*/ class Be extends Le {
|
|
3383
3431
|
constructor(t, e) {
|
|
3384
3432
|
super(), this.key = t, this.precondition = e, this.type = 3 /* MutationType.Verify */ ,
|
|
3385
3433
|
this.fieldTransforms = [];
|
|
@@ -3404,13 +3452,13 @@ function $e(t, e) {
|
|
|
3404
3452
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3405
3453
|
* See the License for the specific language governing permissions and
|
|
3406
3454
|
* limitations under the License.
|
|
3407
|
-
*/ const
|
|
3455
|
+
*/ const ze = (() => {
|
|
3408
3456
|
const t = {
|
|
3409
3457
|
asc: "ASCENDING",
|
|
3410
3458
|
desc: "DESCENDING"
|
|
3411
3459
|
};
|
|
3412
3460
|
return t;
|
|
3413
|
-
})(),
|
|
3461
|
+
})(), Qe = (() => {
|
|
3414
3462
|
const t = {
|
|
3415
3463
|
"<": "LESS_THAN",
|
|
3416
3464
|
"<=": "LESS_THAN_OR_EQUAL",
|
|
@@ -3424,7 +3472,7 @@ function $e(t, e) {
|
|
|
3424
3472
|
"array-contains-any": "ARRAY_CONTAINS_ANY"
|
|
3425
3473
|
};
|
|
3426
3474
|
return t;
|
|
3427
|
-
})(),
|
|
3475
|
+
})(), We = (() => {
|
|
3428
3476
|
const t = {
|
|
3429
3477
|
and: "AND",
|
|
3430
3478
|
or: "OR"
|
|
@@ -3446,7 +3494,7 @@ function $e(t, e) {
|
|
|
3446
3494
|
* TODO(klimt): We can remove the databaseId argument if we keep the full
|
|
3447
3495
|
* resource name in documents.
|
|
3448
3496
|
*/
|
|
3449
|
-
class
|
|
3497
|
+
class Ge {
|
|
3450
3498
|
constructor(t, e) {
|
|
3451
3499
|
this.databaseId = t, this.L = e;
|
|
3452
3500
|
}
|
|
@@ -3463,7 +3511,7 @@ class Qe {
|
|
|
3463
3511
|
/**
|
|
3464
3512
|
* Returns a value for a Date that's appropriate to put into a proto.
|
|
3465
3513
|
*/
|
|
3466
|
-
function
|
|
3514
|
+
function Ke(t, e) {
|
|
3467
3515
|
if (t.L) {
|
|
3468
3516
|
return `${new Date(1e3 * e.seconds).toISOString().replace(/\.\d*/, "").replace("Z", "")}.${("000000000" + e.nanoseconds).slice(-9)}Z`;
|
|
3469
3517
|
}
|
|
@@ -3478,35 +3526,35 @@ function We(t, e) {
|
|
|
3478
3526
|
*
|
|
3479
3527
|
* Visible for testing.
|
|
3480
3528
|
*/
|
|
3481
|
-
function
|
|
3529
|
+
function Ye(t, e) {
|
|
3482
3530
|
return t.L ? e.toBase64() : e.toUint8Array();
|
|
3483
3531
|
}
|
|
3484
3532
|
|
|
3485
|
-
function
|
|
3486
|
-
return
|
|
3533
|
+
function He(t, e) {
|
|
3534
|
+
return Ke(t, e.toTimestamp());
|
|
3487
3535
|
}
|
|
3488
3536
|
|
|
3489
|
-
function
|
|
3490
|
-
return E(!!t),
|
|
3491
|
-
const e =
|
|
3492
|
-
return new
|
|
3537
|
+
function Ze(t) {
|
|
3538
|
+
return E(!!t), fe.fromTimestamp(function(t) {
|
|
3539
|
+
const e = Nt(t);
|
|
3540
|
+
return new St(e.seconds, e.nanos);
|
|
3493
3541
|
}(t));
|
|
3494
3542
|
}
|
|
3495
3543
|
|
|
3496
|
-
function
|
|
3544
|
+
function Je(t, e) {
|
|
3497
3545
|
return function(t) {
|
|
3498
3546
|
return new tt([ "projects", t.projectId, "databases", t.database ]);
|
|
3499
3547
|
}(t).child("documents").child(e).canonicalString();
|
|
3500
3548
|
}
|
|
3501
3549
|
|
|
3502
|
-
function
|
|
3503
|
-
return
|
|
3550
|
+
function Xe(t, e) {
|
|
3551
|
+
return Je(t.databaseId, e.path);
|
|
3504
3552
|
}
|
|
3505
3553
|
|
|
3506
|
-
function
|
|
3554
|
+
function tn(t, e) {
|
|
3507
3555
|
const n = function(t) {
|
|
3508
3556
|
const e = tt.fromString(t);
|
|
3509
|
-
return E(
|
|
3557
|
+
return E(wn(e)), e;
|
|
3510
3558
|
}(e);
|
|
3511
3559
|
if (n.get(1) !== t.databaseId.projectId) throw new U(P, "Tried to deserialize key from different project: " + n.get(1) + " vs " + t.databaseId.projectId);
|
|
3512
3560
|
if (n.get(3) !== t.databaseId.database) throw new U(P, "Tried to deserialize key from different database: " + n.get(3) + " vs " + t.databaseId.database);
|
|
@@ -3514,98 +3562,98 @@ function Je(t, e) {
|
|
|
3514
3562
|
var r;
|
|
3515
3563
|
/** Creates a Document proto from key and fields (but no create/update time) */}
|
|
3516
3564
|
|
|
3517
|
-
function
|
|
3518
|
-
return
|
|
3565
|
+
function en(t, e) {
|
|
3566
|
+
return Je(t.databaseId, e);
|
|
3519
3567
|
}
|
|
3520
3568
|
|
|
3521
|
-
function
|
|
3569
|
+
function nn(t) {
|
|
3522
3570
|
return new tt([ "projects", t.databaseId.projectId, "databases", t.databaseId.database ]).canonicalString();
|
|
3523
3571
|
}
|
|
3524
3572
|
|
|
3525
|
-
function
|
|
3573
|
+
function rn(t, e, n) {
|
|
3526
3574
|
return {
|
|
3527
|
-
name:
|
|
3575
|
+
name: Xe(t, e),
|
|
3528
3576
|
fields: n.value.mapValue.fields
|
|
3529
3577
|
};
|
|
3530
3578
|
}
|
|
3531
3579
|
|
|
3532
|
-
function
|
|
3580
|
+
function sn(t, e) {
|
|
3533
3581
|
return "found" in e ? function(t, e) {
|
|
3534
3582
|
E(!!e.found), e.found.name, e.found.updateTime;
|
|
3535
|
-
const n =
|
|
3583
|
+
const n = tn(t, e.found.name), r = Ze(e.found.updateTime), s = e.found.createTime ? Ze(e.found.createTime) : fe.min(), i = new _e({
|
|
3536
3584
|
mapValue: {
|
|
3537
3585
|
fields: e.found.fields
|
|
3538
3586
|
}
|
|
3539
3587
|
});
|
|
3540
|
-
return
|
|
3588
|
+
return ve.newFoundDocument(n, r, s, i);
|
|
3541
3589
|
}(t, e) : "missing" in e ? function(t, e) {
|
|
3542
3590
|
E(!!e.missing), E(!!e.readTime);
|
|
3543
|
-
const n =
|
|
3544
|
-
return
|
|
3591
|
+
const n = tn(t, e.missing), r = Ze(e.readTime);
|
|
3592
|
+
return ve.newNoDocument(n, r);
|
|
3545
3593
|
}(t, e) : b();
|
|
3546
3594
|
}
|
|
3547
3595
|
|
|
3548
|
-
function
|
|
3596
|
+
function on(t, e) {
|
|
3549
3597
|
let n;
|
|
3550
|
-
if (e instanceof
|
|
3551
|
-
update:
|
|
3552
|
-
}; else if (e instanceof
|
|
3553
|
-
delete:
|
|
3554
|
-
}; else if (e instanceof
|
|
3555
|
-
update:
|
|
3556
|
-
updateMask:
|
|
3598
|
+
if (e instanceof Me) n = {
|
|
3599
|
+
update: rn(t, e.key, e.value)
|
|
3600
|
+
}; else if (e instanceof je) n = {
|
|
3601
|
+
delete: Xe(t, e.key)
|
|
3602
|
+
}; else if (e instanceof Ue) n = {
|
|
3603
|
+
update: rn(t, e.key, e.data),
|
|
3604
|
+
updateMask: dn(e.fieldMask)
|
|
3557
3605
|
}; else {
|
|
3558
|
-
if (!(e instanceof
|
|
3606
|
+
if (!(e instanceof Be)) return b();
|
|
3559
3607
|
n = {
|
|
3560
|
-
verify:
|
|
3608
|
+
verify: Xe(t, e.key)
|
|
3561
3609
|
};
|
|
3562
3610
|
}
|
|
3563
3611
|
return e.fieldTransforms.length > 0 && (n.updateTransforms = e.fieldTransforms.map((t => function(t, e) {
|
|
3564
3612
|
const n = e.transform;
|
|
3565
|
-
if (n instanceof
|
|
3613
|
+
if (n instanceof xe) return {
|
|
3566
3614
|
fieldPath: e.field.canonicalString(),
|
|
3567
3615
|
setToServerValue: "REQUEST_TIME"
|
|
3568
3616
|
};
|
|
3569
|
-
if (n instanceof
|
|
3617
|
+
if (n instanceof Se) return {
|
|
3570
3618
|
fieldPath: e.field.canonicalString(),
|
|
3571
3619
|
appendMissingElements: {
|
|
3572
3620
|
values: n.elements
|
|
3573
3621
|
}
|
|
3574
3622
|
};
|
|
3575
|
-
if (n instanceof
|
|
3623
|
+
if (n instanceof qe) return {
|
|
3576
3624
|
fieldPath: e.field.canonicalString(),
|
|
3577
3625
|
removeAllFromArray: {
|
|
3578
3626
|
values: n.elements
|
|
3579
3627
|
}
|
|
3580
3628
|
};
|
|
3581
|
-
if (n instanceof
|
|
3629
|
+
if (n instanceof Oe) return {
|
|
3582
3630
|
fieldPath: e.field.canonicalString(),
|
|
3583
3631
|
increment: n.U
|
|
3584
3632
|
};
|
|
3585
3633
|
throw b();
|
|
3586
3634
|
}(0, t)))), e.precondition.isNone || (n.currentDocument = function(t, e) {
|
|
3587
3635
|
return void 0 !== e.updateTime ? {
|
|
3588
|
-
updateTime:
|
|
3636
|
+
updateTime: He(t, e.updateTime)
|
|
3589
3637
|
} : void 0 !== e.exists ? {
|
|
3590
3638
|
exists: e.exists
|
|
3591
3639
|
} : b();
|
|
3592
3640
|
}(t, e.precondition)), n;
|
|
3593
3641
|
}
|
|
3594
3642
|
|
|
3595
|
-
function
|
|
3643
|
+
function un(t, e) {
|
|
3596
3644
|
// Dissect the path into parent, collectionId, and optional key filter.
|
|
3597
3645
|
const n = {
|
|
3598
3646
|
structuredQuery: {}
|
|
3599
3647
|
}, r = e.path;
|
|
3600
|
-
null !== e.collectionGroup ? (n.parent =
|
|
3648
|
+
null !== e.collectionGroup ? (n.parent = en(t, r), n.structuredQuery.from = [ {
|
|
3601
3649
|
collectionId: e.collectionGroup,
|
|
3602
3650
|
allDescendants: !0
|
|
3603
|
-
} ]) : (n.parent =
|
|
3651
|
+
} ]) : (n.parent = en(t, r.popLast()), n.structuredQuery.from = [ {
|
|
3604
3652
|
collectionId: r.lastSegment()
|
|
3605
3653
|
} ]);
|
|
3606
3654
|
const s = function(t) {
|
|
3607
3655
|
if (0 === t.length) return;
|
|
3608
|
-
return
|
|
3656
|
+
return fn(te.create(t, "and" /* CompositeOperator.AND */));
|
|
3609
3657
|
}(e.filters);
|
|
3610
3658
|
s && (n.structuredQuery.where = s);
|
|
3611
3659
|
const i = function(t) {
|
|
@@ -3614,8 +3662,8 @@ function sn(t, e) {
|
|
|
3614
3662
|
// visible for testing
|
|
3615
3663
|
function(t) {
|
|
3616
3664
|
return {
|
|
3617
|
-
field:
|
|
3618
|
-
direction:
|
|
3665
|
+
field: ln(t.field),
|
|
3666
|
+
direction: cn(t.dir)
|
|
3619
3667
|
};
|
|
3620
3668
|
}
|
|
3621
3669
|
// visible for testing
|
|
@@ -3623,7 +3671,7 @@ function sn(t, e) {
|
|
|
3623
3671
|
}(e.orderBy);
|
|
3624
3672
|
i && (n.structuredQuery.orderBy = i);
|
|
3625
3673
|
const o = function(t, e) {
|
|
3626
|
-
return t.L ||
|
|
3674
|
+
return t.L || ft(e) ? e : {
|
|
3627
3675
|
value: e
|
|
3628
3676
|
};
|
|
3629
3677
|
}(t, e.limit);
|
|
@@ -3641,81 +3689,81 @@ function sn(t, e) {
|
|
|
3641
3689
|
(e.endAt)), n;
|
|
3642
3690
|
}
|
|
3643
3691
|
|
|
3644
|
-
function
|
|
3645
|
-
return
|
|
3692
|
+
function cn(t) {
|
|
3693
|
+
return ze[t];
|
|
3646
3694
|
}
|
|
3647
3695
|
|
|
3648
3696
|
// visible for testing
|
|
3649
|
-
function
|
|
3650
|
-
return
|
|
3697
|
+
function an(t) {
|
|
3698
|
+
return Qe[t];
|
|
3651
3699
|
}
|
|
3652
3700
|
|
|
3653
|
-
function
|
|
3654
|
-
return
|
|
3701
|
+
function hn(t) {
|
|
3702
|
+
return We[t];
|
|
3655
3703
|
}
|
|
3656
3704
|
|
|
3657
|
-
function
|
|
3705
|
+
function ln(t) {
|
|
3658
3706
|
return {
|
|
3659
3707
|
fieldPath: t.canonicalString()
|
|
3660
3708
|
};
|
|
3661
3709
|
}
|
|
3662
3710
|
|
|
3663
|
-
function
|
|
3664
|
-
return t instanceof
|
|
3711
|
+
function fn(t) {
|
|
3712
|
+
return t instanceof Xt ? function(t) {
|
|
3665
3713
|
if ("==" /* Operator.EQUAL */ === t.op) {
|
|
3666
|
-
if (
|
|
3714
|
+
if (Gt(t.value)) return {
|
|
3667
3715
|
unaryFilter: {
|
|
3668
|
-
field:
|
|
3716
|
+
field: ln(t.field),
|
|
3669
3717
|
op: "IS_NAN"
|
|
3670
3718
|
}
|
|
3671
3719
|
};
|
|
3672
|
-
if (
|
|
3720
|
+
if (Wt(t.value)) return {
|
|
3673
3721
|
unaryFilter: {
|
|
3674
|
-
field:
|
|
3722
|
+
field: ln(t.field),
|
|
3675
3723
|
op: "IS_NULL"
|
|
3676
3724
|
}
|
|
3677
3725
|
};
|
|
3678
3726
|
} else if ("!=" /* Operator.NOT_EQUAL */ === t.op) {
|
|
3679
|
-
if (
|
|
3727
|
+
if (Gt(t.value)) return {
|
|
3680
3728
|
unaryFilter: {
|
|
3681
|
-
field:
|
|
3729
|
+
field: ln(t.field),
|
|
3682
3730
|
op: "IS_NOT_NAN"
|
|
3683
3731
|
}
|
|
3684
3732
|
};
|
|
3685
|
-
if (
|
|
3733
|
+
if (Wt(t.value)) return {
|
|
3686
3734
|
unaryFilter: {
|
|
3687
|
-
field:
|
|
3735
|
+
field: ln(t.field),
|
|
3688
3736
|
op: "IS_NOT_NULL"
|
|
3689
3737
|
}
|
|
3690
3738
|
};
|
|
3691
3739
|
}
|
|
3692
3740
|
return {
|
|
3693
3741
|
fieldFilter: {
|
|
3694
|
-
field:
|
|
3695
|
-
op:
|
|
3742
|
+
field: ln(t.field),
|
|
3743
|
+
op: an(t.op),
|
|
3696
3744
|
value: t.value
|
|
3697
3745
|
}
|
|
3698
3746
|
};
|
|
3699
|
-
}(t) : t instanceof
|
|
3700
|
-
const e = t.getFilters().map((t =>
|
|
3747
|
+
}(t) : t instanceof te ? function(t) {
|
|
3748
|
+
const e = t.getFilters().map((t => fn(t)));
|
|
3701
3749
|
if (1 === e.length) return e[0];
|
|
3702
3750
|
return {
|
|
3703
3751
|
compositeFilter: {
|
|
3704
|
-
op:
|
|
3752
|
+
op: hn(t.op),
|
|
3705
3753
|
filters: e
|
|
3706
3754
|
}
|
|
3707
3755
|
};
|
|
3708
3756
|
}(t) : b();
|
|
3709
3757
|
}
|
|
3710
3758
|
|
|
3711
|
-
function
|
|
3759
|
+
function dn(t) {
|
|
3712
3760
|
const e = [];
|
|
3713
3761
|
return t.fields.forEach((t => e.push(t.canonicalString()))), {
|
|
3714
3762
|
fieldPaths: e
|
|
3715
3763
|
};
|
|
3716
3764
|
}
|
|
3717
3765
|
|
|
3718
|
-
function
|
|
3766
|
+
function wn(t) {
|
|
3719
3767
|
// Resource names have at least 4 components (project ID, database ID)
|
|
3720
3768
|
return t.length >= 4 && "projects" === t.get(0) && "databases" === t.get(2);
|
|
3721
3769
|
}
|
|
@@ -3735,8 +3783,8 @@ function fn(t) {
|
|
|
3735
3783
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3736
3784
|
* See the License for the specific language governing permissions and
|
|
3737
3785
|
* limitations under the License.
|
|
3738
|
-
*/ function
|
|
3739
|
-
return new
|
|
3786
|
+
*/ function mn(t) {
|
|
3787
|
+
return new Ge(t, /* useProto3Json= */ !0);
|
|
3740
3788
|
}
|
|
3741
3789
|
|
|
3742
3790
|
/**
|
|
@@ -3764,7 +3812,7 @@ function fn(t) {
|
|
|
3764
3812
|
* base delay. This prevents clients from accidentally synchronizing their
|
|
3765
3813
|
* delays causing spikes of load to the backend.
|
|
3766
3814
|
*/
|
|
3767
|
-
class
|
|
3815
|
+
class pn {
|
|
3768
3816
|
constructor(
|
|
3769
3817
|
/**
|
|
3770
3818
|
* The AsyncQueue to run backoff operations on.
|
|
@@ -3862,7 +3910,7 @@ class wn {
|
|
|
3862
3910
|
* An implementation of Datastore that exposes additional state for internal
|
|
3863
3911
|
* consumption.
|
|
3864
3912
|
*/
|
|
3865
|
-
class
|
|
3913
|
+
class yn extends class {} {
|
|
3866
3914
|
constructor(t, e, n, r) {
|
|
3867
3915
|
super(), this.authCredentials = t, this.appCheckCredentials = e, this.connection = n,
|
|
3868
3916
|
this.M = r, this.et = !1;
|
|
@@ -3889,19 +3937,19 @@ class mn extends class {} {
|
|
|
3889
3937
|
|
|
3890
3938
|
// TODO(firestorexp): Make sure there is only one Datastore instance per
|
|
3891
3939
|
// firestore-exp client.
|
|
3892
|
-
async function
|
|
3893
|
-
const n = A(t), r =
|
|
3894
|
-
writes: e.map((t =>
|
|
3940
|
+
async function gn(t, e) {
|
|
3941
|
+
const n = A(t), r = nn(n.M) + "/documents", s = {
|
|
3942
|
+
writes: e.map((t => on(n.M, t)))
|
|
3895
3943
|
};
|
|
3896
3944
|
await n.A("Commit", r, s);
|
|
3897
3945
|
}
|
|
3898
3946
|
|
|
3899
|
-
async function
|
|
3900
|
-
const n = A(t), r =
|
|
3901
|
-
documents: e.map((t =>
|
|
3947
|
+
async function _n(t, e) {
|
|
3948
|
+
const n = A(t), r = nn(n.M) + "/documents", s = {
|
|
3949
|
+
documents: e.map((t => Xe(n.M, t)))
|
|
3902
3950
|
}, i = await n.P("BatchGetDocuments", r, s, e.length), o = new Map;
|
|
3903
3951
|
i.forEach((t => {
|
|
3904
|
-
const e =
|
|
3952
|
+
const e = sn(n.M, t);
|
|
3905
3953
|
o.set(e.key.toString(), e);
|
|
3906
3954
|
}));
|
|
3907
3955
|
const u = [];
|
|
@@ -3911,23 +3959,23 @@ async function yn(t, e) {
|
|
|
3911
3959
|
})), u;
|
|
3912
3960
|
}
|
|
3913
3961
|
|
|
3914
|
-
async function
|
|
3915
|
-
const n = A(t), r =
|
|
3962
|
+
async function vn(t, e) {
|
|
3963
|
+
const n = A(t), r = un(n.M, Ve(e));
|
|
3916
3964
|
return (await n.P("RunQuery", r.parent, {
|
|
3917
3965
|
structuredQuery: r.structuredQuery
|
|
3918
3966
|
})).filter((t => !!t.document)).map((t => function(t, e, n) {
|
|
3919
|
-
const r =
|
|
3967
|
+
const r = tn(t, e.name), s = Ze(e.updateTime), i = e.createTime ? Ze(e.createTime) : fe.min(), o = new _e({
|
|
3920
3968
|
mapValue: {
|
|
3921
3969
|
fields: e.fields
|
|
3922
3970
|
}
|
|
3923
|
-
}), u =
|
|
3971
|
+
}), u = ve.newFoundDocument(r, s, i, o);
|
|
3924
3972
|
return n && u.setHasCommittedMutations(), n ? u.setHasCommittedMutations() : u;
|
|
3925
3973
|
}(n.M, t.document, void 0)));
|
|
3926
3974
|
}
|
|
3927
3975
|
|
|
3928
|
-
async function
|
|
3976
|
+
async function bn(t, e, n) {
|
|
3929
3977
|
const r = A(t), s = function(t, e, n) {
|
|
3930
|
-
const r =
|
|
3978
|
+
const r = un(t, e), s = [];
|
|
3931
3979
|
return n.forEach((t => {
|
|
3932
3980
|
"count" === t.N ? s.push({
|
|
3933
3981
|
alias: t.alias.canonicalString(),
|
|
@@ -3935,12 +3983,12 @@ async function _n(t, e, n) {
|
|
|
3935
3983
|
}) : "avg" === t.N ? s.push({
|
|
3936
3984
|
alias: t.alias.canonicalString(),
|
|
3937
3985
|
avg: {
|
|
3938
|
-
field:
|
|
3986
|
+
field: ln(t.fieldPath)
|
|
3939
3987
|
}
|
|
3940
3988
|
}) : "sum" === t.N && s.push({
|
|
3941
3989
|
alias: t.alias.canonicalString(),
|
|
3942
3990
|
sum: {
|
|
3943
|
-
field:
|
|
3991
|
+
field: ln(t.fieldPath)
|
|
3944
3992
|
}
|
|
3945
3993
|
});
|
|
3946
3994
|
})), {
|
|
@@ -3950,11 +3998,11 @@ async function _n(t, e, n) {
|
|
|
3950
3998
|
},
|
|
3951
3999
|
parent: r.parent
|
|
3952
4000
|
};
|
|
3953
|
-
}(r.M,
|
|
4001
|
+
}(r.M, Ve(e), n), i = s.parent;
|
|
3954
4002
|
r.connection.v || delete s.parent;
|
|
3955
4003
|
const o = (await r.P("RunAggregationQuery", i, s, /*expectedResponseCount=*/ 1)).filter((t => !!t.result));
|
|
3956
4004
|
// Omit RunAggregationQueryResponse that only contain readTimes.
|
|
3957
|
-
return E(1 === o.length), (u = o[0]).result, u.result.aggregateFields, new
|
|
4005
|
+
return E(1 === o.length), (u = o[0]).result, u.result.aggregateFields, new _e({
|
|
3958
4006
|
mapValue: {
|
|
3959
4007
|
fields: null === (c = u.result) || void 0 === c ? void 0 : c.aggregateFields
|
|
3960
4008
|
}
|
|
@@ -3977,7 +4025,7 @@ async function _n(t, e, n) {
|
|
|
3977
4025
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3978
4026
|
* See the License for the specific language governing permissions and
|
|
3979
4027
|
* limitations under the License.
|
|
3980
|
-
*/ const
|
|
4028
|
+
*/ const En = new Map;
|
|
3981
4029
|
|
|
3982
4030
|
/**
|
|
3983
4031
|
* An instance map that ensures only one Datastore exists per Firestore
|
|
@@ -3988,17 +4036,17 @@ async function _n(t, e, n) {
|
|
|
3988
4036
|
* instance. Callers must invoke removeComponents() when the Firestore
|
|
3989
4037
|
* instance is terminated.
|
|
3990
4038
|
*/
|
|
3991
|
-
function
|
|
4039
|
+
function An(t) {
|
|
3992
4040
|
if (t._terminated) throw new U(S, "The client has already been terminated.");
|
|
3993
|
-
if (!
|
|
4041
|
+
if (!En.has(t)) {
|
|
3994
4042
|
y("ComponentProvider", "Initializing Datastore");
|
|
3995
4043
|
const i = function(t) {
|
|
3996
|
-
return new
|
|
4044
|
+
return new gt(t, fetch.bind(null));
|
|
3997
4045
|
}((e = t._databaseId, n = t.app.options.appId || "", r = t._persistenceKey, s = t._freezeSettings(),
|
|
3998
|
-
new Z(e, n, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), o =
|
|
3999
|
-
return new
|
|
4046
|
+
new Z(e, n, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), o = mn(t._databaseId), u = function(t, e, n, r) {
|
|
4047
|
+
return new yn(t, e, n, r);
|
|
4000
4048
|
}(t._authCredentials, t._appCheckCredentials, i, o);
|
|
4001
|
-
|
|
4049
|
+
En.set(t, u);
|
|
4002
4050
|
}
|
|
4003
4051
|
var e, n, r, s;
|
|
4004
4052
|
/**
|
|
@@ -4016,7 +4064,7 @@ function bn(t) {
|
|
|
4016
4064
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4017
4065
|
* See the License for the specific language governing permissions and
|
|
4018
4066
|
* limitations under the License.
|
|
4019
|
-
*/ return
|
|
4067
|
+
*/ return En.get(t);
|
|
4020
4068
|
}
|
|
4021
4069
|
|
|
4022
4070
|
/**
|
|
@@ -4028,7 +4076,7 @@ function bn(t) {
|
|
|
4028
4076
|
* user-supplied `FirestoreSettings` object. This is a separate type so that
|
|
4029
4077
|
* defaults can be supplied and the value can be checked for equality.
|
|
4030
4078
|
*/
|
|
4031
|
-
class
|
|
4079
|
+
class In {
|
|
4032
4080
|
constructor(t) {
|
|
4033
4081
|
var e;
|
|
4034
4082
|
if (void 0 === t.host) {
|
|
@@ -4070,7 +4118,7 @@ class En {
|
|
|
4070
4118
|
* The Cloud Firestore service interface.
|
|
4071
4119
|
*
|
|
4072
4120
|
* Do not call this constructor directly. Instead, use {@link (getFirestore:1)}.
|
|
4073
|
-
*/ class
|
|
4121
|
+
*/ class Tn {
|
|
4074
4122
|
/** @hideconstructor */
|
|
4075
4123
|
constructor(t, e, n, r) {
|
|
4076
4124
|
this._authCredentials = t, this._appCheckCredentials = e, this._databaseId = n,
|
|
@@ -4078,7 +4126,7 @@ class En {
|
|
|
4078
4126
|
/**
|
|
4079
4127
|
* Whether it's a Firestore or Firestore Lite instance.
|
|
4080
4128
|
*/
|
|
4081
|
-
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new
|
|
4129
|
+
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new In({}),
|
|
4082
4130
|
this._settingsFrozen = !1;
|
|
4083
4131
|
}
|
|
4084
4132
|
/**
|
|
@@ -4096,7 +4144,7 @@ class En {
|
|
|
4096
4144
|
}
|
|
4097
4145
|
_setSettings(t) {
|
|
4098
4146
|
if (this._settingsFrozen) throw new U(S, "Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");
|
|
4099
|
-
this._settings = new
|
|
4147
|
+
this._settings = new In(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
|
|
4100
4148
|
if (!t) return new z;
|
|
4101
4149
|
switch (t.type) {
|
|
4102
4150
|
case "gapi":
|
|
@@ -4135,13 +4183,13 @@ class En {
|
|
|
4135
4183
|
* Only ever called once.
|
|
4136
4184
|
*/ _terminate() {
|
|
4137
4185
|
return function(t) {
|
|
4138
|
-
const e =
|
|
4139
|
-
e && (y("ComponentProvider", "Removing Datastore"),
|
|
4186
|
+
const e = En.get(t);
|
|
4187
|
+
e && (y("ComponentProvider", "Removing Datastore"), En.delete(t), e.terminate());
|
|
4140
4188
|
}(this), Promise.resolve();
|
|
4141
4189
|
}
|
|
4142
4190
|
}
|
|
4143
4191
|
|
|
4144
|
-
function
|
|
4192
|
+
function Rn(t, e, n) {
|
|
4145
4193
|
n || (n = "(default)");
|
|
4146
4194
|
const r = _getProvider(t, "firestore/lite");
|
|
4147
4195
|
if (r.isInitialized(n)) throw new U(S, "Firestore can only be initialized once per app.");
|
|
@@ -4151,13 +4199,13 @@ function In(t, e, n) {
|
|
|
4151
4199
|
});
|
|
4152
4200
|
}
|
|
4153
4201
|
|
|
4154
|
-
function
|
|
4202
|
+
function Pn(e, n) {
|
|
4155
4203
|
const r = "object" == typeof e ? e : getApp(), s = "string" == typeof e ? e : n || "(default)", i = _getProvider(r, "firestore/lite").getImmediate({
|
|
4156
4204
|
identifier: s
|
|
4157
4205
|
});
|
|
4158
4206
|
if (!i._initialized) {
|
|
4159
4207
|
const t = getDefaultEmulatorHostnameAndPort("firestore");
|
|
4160
|
-
t &&
|
|
4208
|
+
t && Vn(i, ...t);
|
|
4161
4209
|
}
|
|
4162
4210
|
return i;
|
|
4163
4211
|
}
|
|
@@ -4174,9 +4222,9 @@ function Tn(e, n) {
|
|
|
4174
4222
|
* @param port - the emulator port (ex: 9000).
|
|
4175
4223
|
* @param options.mockUserToken - the mock auth token to use for unit testing
|
|
4176
4224
|
* Security Rules.
|
|
4177
|
-
*/ function
|
|
4225
|
+
*/ function Vn(t, e, n, r = {}) {
|
|
4178
4226
|
var s;
|
|
4179
|
-
const i = (t = ct(t,
|
|
4227
|
+
const i = (t = ct(t, Tn))._getSettings();
|
|
4180
4228
|
if ("firestore.googleapis.com" !== i.host && i.host !== e && _("Host has been set in both settings() and useEmulator(), emulator host will be used"),
|
|
4181
4229
|
t._setSettings(Object.assign(Object.assign({}, i), {
|
|
4182
4230
|
host: `${e}:${n}`,
|
|
@@ -4214,8 +4262,8 @@ function Tn(e, n) {
|
|
|
4214
4262
|
* @param firestore - The `Firestore` instance to terminate.
|
|
4215
4263
|
* @returns A `Promise` that is resolved when the instance has been successfully
|
|
4216
4264
|
* terminated.
|
|
4217
|
-
*/ function
|
|
4218
|
-
return t = ct(t,
|
|
4265
|
+
*/ function $n(t) {
|
|
4266
|
+
return t = ct(t, Tn), _removeServiceInstance(t.app, "firestore/lite"), t._delete();
|
|
4219
4267
|
}
|
|
4220
4268
|
|
|
4221
4269
|
/**
|
|
@@ -4254,7 +4302,7 @@ function Tn(e, n) {
|
|
|
4254
4302
|
* Represents an aggregation that can be performed by Firestore.
|
|
4255
4303
|
*/
|
|
4256
4304
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4257
|
-
class
|
|
4305
|
+
class Dn {
|
|
4258
4306
|
/**
|
|
4259
4307
|
* Create a new AggregateField<T>
|
|
4260
4308
|
* @param _aggregateType Specifies the type of aggregation operation to perform.
|
|
@@ -4272,7 +4320,7 @@ class Vn {
|
|
|
4272
4320
|
|
|
4273
4321
|
/**
|
|
4274
4322
|
* The results of executing an aggregation query.
|
|
4275
|
-
*/ class
|
|
4323
|
+
*/ class Nn {
|
|
4276
4324
|
/** @hideconstructor */
|
|
4277
4325
|
constructor(t, e, n) {
|
|
4278
4326
|
this._userDataWriter = e, this._data = n,
|
|
@@ -4314,7 +4362,7 @@ class Vn {
|
|
|
4314
4362
|
* A `DocumentReference` refers to a document location in a Firestore database
|
|
4315
4363
|
* and can be used to write, read, or listen to the location. The document at
|
|
4316
4364
|
* the referenced location may or may not exist.
|
|
4317
|
-
*/ class
|
|
4365
|
+
*/ class Fn {
|
|
4318
4366
|
/** @hideconstructor */
|
|
4319
4367
|
constructor(t,
|
|
4320
4368
|
/**
|
|
@@ -4342,17 +4390,17 @@ class Vn {
|
|
|
4342
4390
|
/**
|
|
4343
4391
|
* The collection this `DocumentReference` belongs to.
|
|
4344
4392
|
*/ get parent() {
|
|
4345
|
-
return new
|
|
4393
|
+
return new Sn(this.firestore, this.converter, this._key.path.popLast());
|
|
4346
4394
|
}
|
|
4347
4395
|
withConverter(t) {
|
|
4348
|
-
return new
|
|
4396
|
+
return new Fn(this.firestore, t, this._key);
|
|
4349
4397
|
}
|
|
4350
4398
|
}
|
|
4351
4399
|
|
|
4352
4400
|
/**
|
|
4353
4401
|
* A `Query` refers to a query which you can read or listen to. You can also
|
|
4354
4402
|
* construct refined `Query` objects by adding filters and ordering.
|
|
4355
|
-
*/ class
|
|
4403
|
+
*/ class xn {
|
|
4356
4404
|
// This is the lite version of the Query class in the main SDK.
|
|
4357
4405
|
/** @hideconstructor protected */
|
|
4358
4406
|
constructor(t,
|
|
@@ -4365,17 +4413,17 @@ class Vn {
|
|
|
4365
4413
|
this.type = "query", this.firestore = t;
|
|
4366
4414
|
}
|
|
4367
4415
|
withConverter(t) {
|
|
4368
|
-
return new
|
|
4416
|
+
return new xn(this.firestore, t, this._query);
|
|
4369
4417
|
}
|
|
4370
4418
|
}
|
|
4371
4419
|
|
|
4372
4420
|
/**
|
|
4373
4421
|
* A `CollectionReference` object can be used for adding documents, getting
|
|
4374
|
-
* document references, and querying for documents (using {@link query}).
|
|
4375
|
-
*/ class
|
|
4422
|
+
* document references, and querying for documents (using {@link (query:1)}).
|
|
4423
|
+
*/ class Sn extends xn {
|
|
4376
4424
|
/** @hideconstructor */
|
|
4377
4425
|
constructor(t, e, n) {
|
|
4378
|
-
super(t, e, new
|
|
4426
|
+
super(t, e, new Ae(n)), this._path = n,
|
|
4379
4427
|
/** The type of this Firestore reference. */
|
|
4380
4428
|
this.type = "collection";
|
|
4381
4429
|
}
|
|
@@ -4393,23 +4441,23 @@ class Vn {
|
|
|
4393
4441
|
* subcollection. If this isn't a subcollection, the reference is null.
|
|
4394
4442
|
*/ get parent() {
|
|
4395
4443
|
const t = this._path.popLast();
|
|
4396
|
-
return t.isEmpty() ? null : new
|
|
4444
|
+
return t.isEmpty() ? null : new Fn(this.firestore,
|
|
4397
4445
|
/* converter= */ null, new rt(t));
|
|
4398
4446
|
}
|
|
4399
4447
|
withConverter(t) {
|
|
4400
|
-
return new
|
|
4448
|
+
return new Sn(this.firestore, t, this._path);
|
|
4401
4449
|
}
|
|
4402
4450
|
}
|
|
4403
4451
|
|
|
4404
|
-
function
|
|
4405
|
-
if (t = getModularInstance(t), st("collection", "path", e), t instanceof
|
|
4452
|
+
function qn(t, e, ...n) {
|
|
4453
|
+
if (t = getModularInstance(t), st("collection", "path", e), t instanceof Tn) {
|
|
4406
4454
|
const r = tt.fromString(e, ...n);
|
|
4407
|
-
return ot(r), new
|
|
4455
|
+
return ot(r), new Sn(t, /* converter= */ null, r);
|
|
4408
4456
|
}
|
|
4409
4457
|
{
|
|
4410
|
-
if (!(t instanceof
|
|
4458
|
+
if (!(t instanceof Fn || t instanceof Sn)) throw new U(P, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
4411
4459
|
const r = t._path.child(tt.fromString(e, ...n));
|
|
4412
|
-
return ot(r), new
|
|
4460
|
+
return ot(r), new Sn(t.firestore,
|
|
4413
4461
|
/* converter= */ null, r);
|
|
4414
4462
|
}
|
|
4415
4463
|
}
|
|
@@ -4426,27 +4474,27 @@ function xn(t, e, ...n) {
|
|
|
4426
4474
|
* collection or subcollection with this ID as the last segment of its path
|
|
4427
4475
|
* will be included. Cannot contain a slash.
|
|
4428
4476
|
* @returns The created `Query`.
|
|
4429
|
-
*/ function
|
|
4430
|
-
if (t = ct(t,
|
|
4431
|
-
return new
|
|
4477
|
+
*/ function On(t, e) {
|
|
4478
|
+
if (t = ct(t, Tn), st("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new U(P, `Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
|
|
4479
|
+
return new xn(t,
|
|
4432
4480
|
/* converter= */ null, function(t) {
|
|
4433
|
-
return new
|
|
4481
|
+
return new Ae(tt.emptyPath(), t);
|
|
4434
4482
|
}(e));
|
|
4435
4483
|
}
|
|
4436
4484
|
|
|
4437
|
-
function
|
|
4485
|
+
function kn(t, e, ...n) {
|
|
4438
4486
|
if (t = getModularInstance(t),
|
|
4439
4487
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
4440
4488
|
// 'undefined' and 'null'.
|
|
4441
|
-
1 === arguments.length && (e =
|
|
4489
|
+
1 === arguments.length && (e = At.F()), st("doc", "path", e), t instanceof Tn) {
|
|
4442
4490
|
const r = tt.fromString(e, ...n);
|
|
4443
|
-
return it(r), new
|
|
4491
|
+
return it(r), new Fn(t,
|
|
4444
4492
|
/* converter= */ null, new rt(r));
|
|
4445
4493
|
}
|
|
4446
4494
|
{
|
|
4447
|
-
if (!(t instanceof
|
|
4495
|
+
if (!(t instanceof Fn || t instanceof Sn)) throw new U(P, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
4448
4496
|
const r = t._path.child(tt.fromString(e, ...n));
|
|
4449
|
-
return it(r), new
|
|
4497
|
+
return it(r), new Fn(t.firestore, t instanceof Sn ? t.converter : null, new rt(r));
|
|
4450
4498
|
}
|
|
4451
4499
|
}
|
|
4452
4500
|
|
|
@@ -4457,8 +4505,8 @@ function qn(t, e, ...n) {
|
|
|
4457
4505
|
* @param right - A reference to compare.
|
|
4458
4506
|
* @returns true if the references point to the same location in the same
|
|
4459
4507
|
* Firestore database.
|
|
4460
|
-
*/ function
|
|
4461
|
-
return t = getModularInstance(t), e = getModularInstance(e), (t instanceof
|
|
4508
|
+
*/ function Cn(t, e) {
|
|
4509
|
+
return t = getModularInstance(t), e = getModularInstance(e), (t instanceof Fn || t instanceof Sn) && (e instanceof Fn || e instanceof Sn) && (t.firestore === e.firestore && t.path === e.path && t.converter === e.converter);
|
|
4462
4510
|
}
|
|
4463
4511
|
|
|
4464
4512
|
/**
|
|
@@ -4469,8 +4517,8 @@ function qn(t, e, ...n) {
|
|
|
4469
4517
|
* @param right - A `Query` to compare.
|
|
4470
4518
|
* @returns true if the references point to the same location in the same
|
|
4471
4519
|
* Firestore database.
|
|
4472
|
-
*/ function
|
|
4473
|
-
return t = getModularInstance(t), e = getModularInstance(e), t instanceof
|
|
4520
|
+
*/ function Ln(t, e) {
|
|
4521
|
+
return t = getModularInstance(t), e = getModularInstance(e), t instanceof xn && e instanceof xn && (t.firestore === e.firestore && De(t._query, e._query) && t.converter === e.converter);
|
|
4474
4522
|
}
|
|
4475
4523
|
|
|
4476
4524
|
/**
|
|
@@ -4491,7 +4539,7 @@ function qn(t, e, ...n) {
|
|
|
4491
4539
|
*/
|
|
4492
4540
|
/**
|
|
4493
4541
|
* An immutable object representing an array of bytes.
|
|
4494
|
-
*/ class
|
|
4542
|
+
*/ class Mn {
|
|
4495
4543
|
/** @hideconstructor */
|
|
4496
4544
|
constructor(t) {
|
|
4497
4545
|
this._byteString = t;
|
|
@@ -4503,7 +4551,7 @@ function qn(t, e, ...n) {
|
|
|
4503
4551
|
* @param base64 - The Base64 string used to create the `Bytes` object.
|
|
4504
4552
|
*/ static fromBase64String(t) {
|
|
4505
4553
|
try {
|
|
4506
|
-
return new
|
|
4554
|
+
return new Mn($t.fromBase64String(t));
|
|
4507
4555
|
} catch (t) {
|
|
4508
4556
|
throw new U(P, "Failed to construct data from Base64 string: " + t);
|
|
4509
4557
|
}
|
|
@@ -4513,7 +4561,7 @@ function qn(t, e, ...n) {
|
|
|
4513
4561
|
*
|
|
4514
4562
|
* @param array - The Uint8Array used to create the `Bytes` object.
|
|
4515
4563
|
*/ static fromUint8Array(t) {
|
|
4516
|
-
return new
|
|
4564
|
+
return new Mn($t.fromUint8Array(t));
|
|
4517
4565
|
}
|
|
4518
4566
|
/**
|
|
4519
4567
|
* Returns the underlying bytes as a Base64-encoded string.
|
|
@@ -4569,7 +4617,7 @@ function qn(t, e, ...n) {
|
|
|
4569
4617
|
*
|
|
4570
4618
|
* Create a `FieldPath` by providing field names. If more than one field
|
|
4571
4619
|
* name is provided, the path will point to a nested field in a document.
|
|
4572
|
-
*/ class
|
|
4620
|
+
*/ class Un {
|
|
4573
4621
|
/**
|
|
4574
4622
|
* Creates a `FieldPath` from the provided field names. If more than one field
|
|
4575
4623
|
* name is provided, the path will point to a nested field in a document.
|
|
@@ -4593,8 +4641,8 @@ function qn(t, e, ...n) {
|
|
|
4593
4641
|
/**
|
|
4594
4642
|
* Returns a special sentinel `FieldPath` to refer to the ID of a document.
|
|
4595
4643
|
* It can be used in queries to sort or filter by the document ID.
|
|
4596
|
-
*/ function
|
|
4597
|
-
return new
|
|
4644
|
+
*/ function jn() {
|
|
4645
|
+
return new Un("__name__");
|
|
4598
4646
|
}
|
|
4599
4647
|
|
|
4600
4648
|
/**
|
|
@@ -4616,7 +4664,7 @@ function qn(t, e, ...n) {
|
|
|
4616
4664
|
/**
|
|
4617
4665
|
* Sentinel values that can be used when writing document fields with `set()`
|
|
4618
4666
|
* or `update()`.
|
|
4619
|
-
*/ class
|
|
4667
|
+
*/ class Bn {
|
|
4620
4668
|
/**
|
|
4621
4669
|
* @param _methodName - The public API endpoint that returns this class.
|
|
4622
4670
|
* @hideconstructor
|
|
@@ -4648,7 +4696,7 @@ function qn(t, e, ...n) {
|
|
|
4648
4696
|
*
|
|
4649
4697
|
* Latitude values are in the range of [-90, 90].
|
|
4650
4698
|
* Longitude values are in the range of [-180, 180].
|
|
4651
|
-
*/ class
|
|
4699
|
+
*/ class zn {
|
|
4652
4700
|
/**
|
|
4653
4701
|
* Creates a new immutable `GeoPoint` object with the provided latitude and
|
|
4654
4702
|
* longitude values.
|
|
@@ -4688,7 +4736,7 @@ function qn(t, e, ...n) {
|
|
|
4688
4736
|
* Actually private to JS consumers of our API, so this function is prefixed
|
|
4689
4737
|
* with an underscore.
|
|
4690
4738
|
*/ _compareTo(t) {
|
|
4691
|
-
return
|
|
4739
|
+
return It(this._lat, t._lat) || It(this._long, t._long);
|
|
4692
4740
|
}
|
|
4693
4741
|
}
|
|
4694
4742
|
|
|
@@ -4707,29 +4755,29 @@ function qn(t, e, ...n) {
|
|
|
4707
4755
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4708
4756
|
* See the License for the specific language governing permissions and
|
|
4709
4757
|
* limitations under the License.
|
|
4710
|
-
*/ const
|
|
4758
|
+
*/ const Qn = /^__.*__$/;
|
|
4711
4759
|
|
|
4712
|
-
/** The result of parsing document data (e.g. for a setData call). */ class
|
|
4760
|
+
/** The result of parsing document data (e.g. for a setData call). */ class Wn {
|
|
4713
4761
|
constructor(t, e, n) {
|
|
4714
4762
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
4715
4763
|
}
|
|
4716
4764
|
toMutation(t, e) {
|
|
4717
|
-
return null !== this.fieldMask ? new
|
|
4765
|
+
return null !== this.fieldMask ? new Ue(t, this.data, this.fieldMask, e, this.fieldTransforms) : new Me(t, this.data, e, this.fieldTransforms);
|
|
4718
4766
|
}
|
|
4719
4767
|
}
|
|
4720
4768
|
|
|
4721
|
-
/** The result of parsing "update" data (i.e. for an updateData call). */ class
|
|
4769
|
+
/** The result of parsing "update" data (i.e. for an updateData call). */ class Gn {
|
|
4722
4770
|
constructor(t,
|
|
4723
4771
|
// The fieldMask does not include document transforms.
|
|
4724
4772
|
e, n) {
|
|
4725
4773
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
4726
4774
|
}
|
|
4727
4775
|
toMutation(t, e) {
|
|
4728
|
-
return new
|
|
4776
|
+
return new Ue(t, this.data, this.fieldMask, e, this.fieldTransforms);
|
|
4729
4777
|
}
|
|
4730
4778
|
}
|
|
4731
4779
|
|
|
4732
|
-
function
|
|
4780
|
+
function Kn(t) {
|
|
4733
4781
|
switch (t) {
|
|
4734
4782
|
case 0 /* UserDataSource.Set */ :
|
|
4735
4783
|
// fall through
|
|
@@ -4747,7 +4795,7 @@ function Wn(t) {
|
|
|
4747
4795
|
}
|
|
4748
4796
|
}
|
|
4749
4797
|
|
|
4750
|
-
/** A "context" object passed around while parsing user data. */ class
|
|
4798
|
+
/** A "context" object passed around while parsing user data. */ class Yn {
|
|
4751
4799
|
/**
|
|
4752
4800
|
* Initializes a ParseContext with the given source and path.
|
|
4753
4801
|
*
|
|
@@ -4779,7 +4827,7 @@ function Wn(t) {
|
|
|
4779
4827
|
return this.settings.st;
|
|
4780
4828
|
}
|
|
4781
4829
|
/** Returns a new context with the specified settings overwritten. */ it(t) {
|
|
4782
|
-
return new
|
|
4830
|
+
return new Yn(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.M, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
|
|
4783
4831
|
}
|
|
4784
4832
|
ot(t) {
|
|
4785
4833
|
var e;
|
|
@@ -4806,7 +4854,7 @@ function Wn(t) {
|
|
|
4806
4854
|
});
|
|
4807
4855
|
}
|
|
4808
4856
|
lt(t) {
|
|
4809
|
-
return
|
|
4857
|
+
return mr(t, this.settings.methodName, this.settings.ft || !1, this.path, this.settings.dt);
|
|
4810
4858
|
}
|
|
4811
4859
|
/** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
|
|
4812
4860
|
return void 0 !== this.fieldMask.find((e => t.isPrefixOf(e))) || void 0 !== this.fieldTransforms.find((e => t.isPrefixOf(e.field)));
|
|
@@ -4818,19 +4866,19 @@ function Wn(t) {
|
|
|
4818
4866
|
}
|
|
4819
4867
|
ct(t) {
|
|
4820
4868
|
if (0 === t.length) throw this.lt("Document fields must not be empty");
|
|
4821
|
-
if (
|
|
4869
|
+
if (Kn(this.st) && Qn.test(t)) throw this.lt('Document fields cannot begin and end with "__"');
|
|
4822
4870
|
}
|
|
4823
4871
|
}
|
|
4824
4872
|
|
|
4825
4873
|
/**
|
|
4826
4874
|
* Helper for parsing raw user input (provided via the API) into internal model
|
|
4827
4875
|
* classes.
|
|
4828
|
-
*/ class
|
|
4876
|
+
*/ class Hn {
|
|
4829
4877
|
constructor(t, e, n) {
|
|
4830
|
-
this.databaseId = t, this.ignoreUndefinedProperties = e, this.M = n ||
|
|
4878
|
+
this.databaseId = t, this.ignoreUndefinedProperties = e, this.M = n || mn(t);
|
|
4831
4879
|
}
|
|
4832
4880
|
/** Creates a new top-level parse context. */ wt(t, e, n, r = !1) {
|
|
4833
|
-
return new
|
|
4881
|
+
return new Yn({
|
|
4834
4882
|
st: t,
|
|
4835
4883
|
methodName: e,
|
|
4836
4884
|
dt: n,
|
|
@@ -4841,29 +4889,29 @@ function Wn(t) {
|
|
|
4841
4889
|
}
|
|
4842
4890
|
}
|
|
4843
4891
|
|
|
4844
|
-
function
|
|
4845
|
-
const e = t._freezeSettings(), n =
|
|
4846
|
-
return new
|
|
4892
|
+
function Zn(t) {
|
|
4893
|
+
const e = t._freezeSettings(), n = mn(t._databaseId);
|
|
4894
|
+
return new Hn(t._databaseId, !!e.ignoreUndefinedProperties, n);
|
|
4847
4895
|
}
|
|
4848
4896
|
|
|
4849
|
-
/** Parse document data from a set() call. */ function
|
|
4897
|
+
/** Parse document data from a set() call. */ function Jn(t, e, n, r, s, i = {}) {
|
|
4850
4898
|
const o = t.wt(i.merge || i.mergeFields ? 2 /* UserDataSource.MergeSet */ : 0 /* UserDataSource.Set */ , e, n, s);
|
|
4851
|
-
|
|
4852
|
-
const u =
|
|
4899
|
+
lr("Data must be an object, but it was:", o, r);
|
|
4900
|
+
const u = ar(r, o);
|
|
4853
4901
|
let c, a;
|
|
4854
|
-
if (i.merge) c = new
|
|
4902
|
+
if (i.merge) c = new ge(o.fieldMask), a = o.fieldTransforms; else if (i.mergeFields) {
|
|
4855
4903
|
const t = [];
|
|
4856
4904
|
for (const r of i.mergeFields) {
|
|
4857
|
-
const s =
|
|
4905
|
+
const s = fr(e, r, n);
|
|
4858
4906
|
if (!o.contains(s)) throw new U(P, `Field '${s}' is specified in your field mask but missing from your input data.`);
|
|
4859
|
-
|
|
4907
|
+
pr(t, s) || t.push(s);
|
|
4860
4908
|
}
|
|
4861
|
-
c = new
|
|
4909
|
+
c = new ge(t), a = o.fieldTransforms.filter((t => c.covers(t.field)));
|
|
4862
4910
|
} else c = null, a = o.fieldTransforms;
|
|
4863
|
-
return new
|
|
4911
|
+
return new Wn(new _e(u), c, a);
|
|
4864
4912
|
}
|
|
4865
4913
|
|
|
4866
|
-
class
|
|
4914
|
+
class Xn extends Bn {
|
|
4867
4915
|
_toFieldTransform(t) {
|
|
4868
4916
|
if (2 /* UserDataSource.MergeSet */ !== t.st) throw 1 /* UserDataSource.Update */ === t.st ? t.lt(`${this._methodName}() can only appear at the top level of your update data`) : t.lt(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);
|
|
4869
4917
|
// No transform to add for a delete, but we need to add it to our
|
|
@@ -4871,7 +4919,7 @@ class Zn extends Un {
|
|
|
4871
4919
|
return t.fieldMask.push(t.path), null;
|
|
4872
4920
|
}
|
|
4873
4921
|
isEqual(t) {
|
|
4874
|
-
return t instanceof
|
|
4922
|
+
return t instanceof Xn;
|
|
4875
4923
|
}
|
|
4876
4924
|
}
|
|
4877
4925
|
|
|
@@ -4890,8 +4938,8 @@ class Zn extends Un {
|
|
|
4890
4938
|
* context.
|
|
4891
4939
|
* @param context - The parent context.
|
|
4892
4940
|
* @param arrayElement - Whether or not the FieldValue has an array.
|
|
4893
|
-
*/ function
|
|
4894
|
-
return new
|
|
4941
|
+
*/ function tr(t, e, n) {
|
|
4942
|
+
return new Yn({
|
|
4895
4943
|
st: 3 /* UserDataSource.Argument */ ,
|
|
4896
4944
|
dt: e.settings.dt,
|
|
4897
4945
|
methodName: t._methodName,
|
|
@@ -4899,23 +4947,23 @@ class Zn extends Un {
|
|
|
4899
4947
|
}, e.databaseId, e.M, e.ignoreUndefinedProperties);
|
|
4900
4948
|
}
|
|
4901
4949
|
|
|
4902
|
-
class
|
|
4950
|
+
class er extends Bn {
|
|
4903
4951
|
_toFieldTransform(t) {
|
|
4904
|
-
return new
|
|
4952
|
+
return new ke(t.path, new xe);
|
|
4905
4953
|
}
|
|
4906
4954
|
isEqual(t) {
|
|
4907
|
-
return t instanceof
|
|
4955
|
+
return t instanceof er;
|
|
4908
4956
|
}
|
|
4909
4957
|
}
|
|
4910
4958
|
|
|
4911
|
-
class
|
|
4959
|
+
class nr extends Bn {
|
|
4912
4960
|
constructor(t, e) {
|
|
4913
4961
|
super(t), this.yt = e;
|
|
4914
4962
|
}
|
|
4915
4963
|
_toFieldTransform(t) {
|
|
4916
|
-
const e =
|
|
4917
|
-
/*array=*/ !0), n = this.yt.map((t =>
|
|
4918
|
-
return new
|
|
4964
|
+
const e = tr(this, t,
|
|
4965
|
+
/*array=*/ !0), n = this.yt.map((t => cr(t, e))), r = new Se(n);
|
|
4966
|
+
return new ke(t.path, r);
|
|
4919
4967
|
}
|
|
4920
4968
|
isEqual(t) {
|
|
4921
4969
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4923,14 +4971,14 @@ class tr extends Un {
|
|
|
4923
4971
|
}
|
|
4924
4972
|
}
|
|
4925
4973
|
|
|
4926
|
-
class
|
|
4974
|
+
class rr extends Bn {
|
|
4927
4975
|
constructor(t, e) {
|
|
4928
4976
|
super(t), this.yt = e;
|
|
4929
4977
|
}
|
|
4930
4978
|
_toFieldTransform(t) {
|
|
4931
|
-
const e =
|
|
4932
|
-
/*array=*/ !0), n = this.yt.map((t =>
|
|
4933
|
-
return new
|
|
4979
|
+
const e = tr(this, t,
|
|
4980
|
+
/*array=*/ !0), n = this.yt.map((t => cr(t, e))), r = new qe(n);
|
|
4981
|
+
return new ke(t.path, r);
|
|
4934
4982
|
}
|
|
4935
4983
|
isEqual(t) {
|
|
4936
4984
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4938,13 +4986,13 @@ class er extends Un {
|
|
|
4938
4986
|
}
|
|
4939
4987
|
}
|
|
4940
4988
|
|
|
4941
|
-
class
|
|
4989
|
+
class sr extends Bn {
|
|
4942
4990
|
constructor(t, e) {
|
|
4943
4991
|
super(t), this.gt = e;
|
|
4944
4992
|
}
|
|
4945
4993
|
_toFieldTransform(t) {
|
|
4946
|
-
const e = new
|
|
4947
|
-
return new
|
|
4994
|
+
const e = new Oe(t.M, Ne(t.M, this.gt));
|
|
4995
|
+
return new ke(t.path, e);
|
|
4948
4996
|
}
|
|
4949
4997
|
isEqual(t) {
|
|
4950
4998
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4952,50 +5000,50 @@ class nr extends Un {
|
|
|
4952
5000
|
}
|
|
4953
5001
|
}
|
|
4954
5002
|
|
|
4955
|
-
/** Parse update data from an update() call. */ function
|
|
5003
|
+
/** Parse update data from an update() call. */ function ir(t, e, n, r) {
|
|
4956
5004
|
const s = t.wt(1 /* UserDataSource.Update */ , e, n);
|
|
4957
|
-
|
|
4958
|
-
const i = [], o =
|
|
4959
|
-
|
|
4960
|
-
const u =
|
|
5005
|
+
lr("Data must be an object, but it was:", s, r);
|
|
5006
|
+
const i = [], o = _e.empty();
|
|
5007
|
+
Pt(r, ((t, r) => {
|
|
5008
|
+
const u = wr(e, t, n);
|
|
4961
5009
|
// For Compat types, we have to "extract" the underlying types before
|
|
4962
5010
|
// performing validation.
|
|
4963
5011
|
r = getModularInstance(r);
|
|
4964
5012
|
const c = s.at(u);
|
|
4965
|
-
if (r instanceof
|
|
5013
|
+
if (r instanceof Xn)
|
|
4966
5014
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4967
5015
|
i.push(u); else {
|
|
4968
|
-
const t =
|
|
5016
|
+
const t = cr(r, c);
|
|
4969
5017
|
null != t && (i.push(u), o.set(u, t));
|
|
4970
5018
|
}
|
|
4971
5019
|
}));
|
|
4972
|
-
const u = new
|
|
4973
|
-
return new
|
|
5020
|
+
const u = new ge(i);
|
|
5021
|
+
return new Gn(o, u, s.fieldTransforms);
|
|
4974
5022
|
}
|
|
4975
5023
|
|
|
4976
|
-
/** Parse update data from a list of field/value arguments. */ function
|
|
4977
|
-
const o = t.wt(1 /* UserDataSource.Update */ , e, n), u = [
|
|
5024
|
+
/** Parse update data from a list of field/value arguments. */ function or(t, e, n, r, s, i) {
|
|
5025
|
+
const o = t.wt(1 /* UserDataSource.Update */ , e, n), u = [ fr(e, r, n) ], c = [ s ];
|
|
4978
5026
|
if (i.length % 2 != 0) throw new U(P, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);
|
|
4979
|
-
for (let t = 0; t < i.length; t += 2) u.push(
|
|
4980
|
-
const a = [], h =
|
|
5027
|
+
for (let t = 0; t < i.length; t += 2) u.push(fr(e, i[t])), c.push(i[t + 1]);
|
|
5028
|
+
const a = [], h = _e.empty();
|
|
4981
5029
|
// We iterate in reverse order to pick the last value for a field if the
|
|
4982
5030
|
// user specified the field multiple times.
|
|
4983
|
-
for (let t = u.length - 1; t >= 0; --t) if (!
|
|
5031
|
+
for (let t = u.length - 1; t >= 0; --t) if (!pr(a, u[t])) {
|
|
4984
5032
|
const e = u[t];
|
|
4985
5033
|
let n = c[t];
|
|
4986
5034
|
// For Compat types, we have to "extract" the underlying types before
|
|
4987
5035
|
// performing validation.
|
|
4988
5036
|
n = getModularInstance(n);
|
|
4989
5037
|
const r = o.at(e);
|
|
4990
|
-
if (n instanceof
|
|
5038
|
+
if (n instanceof Xn)
|
|
4991
5039
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4992
5040
|
a.push(e); else {
|
|
4993
|
-
const t =
|
|
5041
|
+
const t = cr(n, r);
|
|
4994
5042
|
null != t && (a.push(e), h.set(e, t));
|
|
4995
5043
|
}
|
|
4996
5044
|
}
|
|
4997
|
-
const f = new
|
|
4998
|
-
return new
|
|
5045
|
+
const f = new ge(a);
|
|
5046
|
+
return new Gn(h, f, o.fieldTransforms);
|
|
4999
5047
|
}
|
|
5000
5048
|
|
|
5001
5049
|
/**
|
|
@@ -5004,8 +5052,8 @@ class nr extends Un {
|
|
|
5004
5052
|
*
|
|
5005
5053
|
* @param allowArrays - Whether the query value is an array that may directly
|
|
5006
5054
|
* contain additional arrays (e.g. the operand of an `in` query).
|
|
5007
|
-
*/ function
|
|
5008
|
-
return
|
|
5055
|
+
*/ function ur(t, e, n, r = !1) {
|
|
5056
|
+
return cr(n, t.wt(r ? 4 /* UserDataSource.ArrayArgument */ : 3 /* UserDataSource.Argument */ , e));
|
|
5009
5057
|
}
|
|
5010
5058
|
|
|
5011
5059
|
/**
|
|
@@ -5016,12 +5064,12 @@ class nr extends Un {
|
|
|
5016
5064
|
* the source of the data being parsed, etc.
|
|
5017
5065
|
* @returns The parsed value, or null if the value was a FieldValue sentinel
|
|
5018
5066
|
* that should not be included in the resulting parsed data.
|
|
5019
|
-
*/ function
|
|
5020
|
-
if (
|
|
5067
|
+
*/ function cr(t, e) {
|
|
5068
|
+
if (hr(
|
|
5021
5069
|
// Unwrap the API type from the Compat SDK. This will return the API type
|
|
5022
5070
|
// from firestore-exp.
|
|
5023
|
-
t = getModularInstance(t))) return
|
|
5024
|
-
if (t instanceof
|
|
5071
|
+
t = getModularInstance(t))) return lr("Unsupported field value:", e, t), ar(t, e);
|
|
5072
|
+
if (t instanceof Bn)
|
|
5025
5073
|
// FieldValues usually parse into transforms (except deleteField())
|
|
5026
5074
|
// in which case we do not want to include this field in our parsed data
|
|
5027
5075
|
// (as doing so will overwrite the field directly prior to the transform
|
|
@@ -5033,7 +5081,7 @@ class nr extends Un {
|
|
|
5033
5081
|
*/
|
|
5034
5082
|
return function(t, e) {
|
|
5035
5083
|
// Sentinels are only supported with writes, and not within arrays.
|
|
5036
|
-
if (!
|
|
5084
|
+
if (!Kn(e.st)) throw e.lt(`${t._methodName}() can only be used with update() and set()`);
|
|
5037
5085
|
if (!e.path) throw e.lt(`${t._methodName}() is not currently supported inside arrays`);
|
|
5038
5086
|
const n = t._toFieldTransform(e);
|
|
5039
5087
|
n && e.fieldTransforms.push(n);
|
|
@@ -5063,7 +5111,7 @@ class nr extends Un {
|
|
|
5063
5111
|
const n = [];
|
|
5064
5112
|
let r = 0;
|
|
5065
5113
|
for (const s of t) {
|
|
5066
|
-
let t =
|
|
5114
|
+
let t = cr(s, e.ht(r));
|
|
5067
5115
|
null == t && (
|
|
5068
5116
|
// Just include nulls in the array for fields being replaced with a
|
|
5069
5117
|
// sentinel.
|
|
@@ -5082,7 +5130,7 @@ class nr extends Un {
|
|
|
5082
5130
|
if (null === (t = getModularInstance(t))) return {
|
|
5083
5131
|
nullValue: "NULL_VALUE"
|
|
5084
5132
|
};
|
|
5085
|
-
if ("number" == typeof t) return
|
|
5133
|
+
if ("number" == typeof t) return Ne(e.M, t);
|
|
5086
5134
|
if ("boolean" == typeof t) return {
|
|
5087
5135
|
booleanValue: t
|
|
5088
5136
|
};
|
|
@@ -5090,34 +5138,34 @@ class nr extends Un {
|
|
|
5090
5138
|
stringValue: t
|
|
5091
5139
|
};
|
|
5092
5140
|
if (t instanceof Date) {
|
|
5093
|
-
const n =
|
|
5141
|
+
const n = St.fromDate(t);
|
|
5094
5142
|
return {
|
|
5095
|
-
timestampValue:
|
|
5143
|
+
timestampValue: Ke(e.M, n)
|
|
5096
5144
|
};
|
|
5097
5145
|
}
|
|
5098
|
-
if (t instanceof
|
|
5146
|
+
if (t instanceof St) {
|
|
5099
5147
|
// Firestore backend truncates precision down to microseconds. To ensure
|
|
5100
5148
|
// offline mode works the same with regards to truncation, perform the
|
|
5101
5149
|
// truncation immediately without waiting for the backend to do that.
|
|
5102
|
-
const n = new
|
|
5150
|
+
const n = new St(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
|
|
5103
5151
|
return {
|
|
5104
|
-
timestampValue:
|
|
5152
|
+
timestampValue: Ke(e.M, n)
|
|
5105
5153
|
};
|
|
5106
5154
|
}
|
|
5107
|
-
if (t instanceof
|
|
5155
|
+
if (t instanceof zn) return {
|
|
5108
5156
|
geoPointValue: {
|
|
5109
5157
|
latitude: t.latitude,
|
|
5110
5158
|
longitude: t.longitude
|
|
5111
5159
|
}
|
|
5112
5160
|
};
|
|
5113
|
-
if (t instanceof
|
|
5114
|
-
bytesValue:
|
|
5161
|
+
if (t instanceof Mn) return {
|
|
5162
|
+
bytesValue: Ye(e.M, t._byteString)
|
|
5115
5163
|
};
|
|
5116
|
-
if (t instanceof
|
|
5164
|
+
if (t instanceof Fn) {
|
|
5117
5165
|
const n = e.databaseId, r = t.firestore._databaseId;
|
|
5118
5166
|
if (!r.isEqual(n)) throw e.lt(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);
|
|
5119
5167
|
return {
|
|
5120
|
-
referenceValue:
|
|
5168
|
+
referenceValue: Je(t.firestore._databaseId || e.databaseId, t._key.path)
|
|
5121
5169
|
};
|
|
5122
5170
|
}
|
|
5123
5171
|
throw e.lt(`Unsupported field value: ${ut(t)}`);
|
|
@@ -5131,13 +5179,13 @@ class nr extends Un {
|
|
|
5131
5179
|
*/ (t, e);
|
|
5132
5180
|
}
|
|
5133
5181
|
|
|
5134
|
-
function
|
|
5182
|
+
function ar(t, e) {
|
|
5135
5183
|
const n = {};
|
|
5136
5184
|
return !function(t) {
|
|
5137
5185
|
for (const e in t) if (Object.prototype.hasOwnProperty.call(t, e)) return !1;
|
|
5138
5186
|
return !0;
|
|
5139
|
-
}(t) ?
|
|
5140
|
-
const s =
|
|
5187
|
+
}(t) ? Pt(t, ((t, r) => {
|
|
5188
|
+
const s = cr(r, e.ot(t));
|
|
5141
5189
|
null != s && (n[t] = s);
|
|
5142
5190
|
})) :
|
|
5143
5191
|
// If we encounter an empty object, we explicitly add it to the update
|
|
@@ -5149,12 +5197,12 @@ function ur(t, e) {
|
|
|
5149
5197
|
};
|
|
5150
5198
|
}
|
|
5151
5199
|
|
|
5152
|
-
function
|
|
5153
|
-
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof
|
|
5200
|
+
function hr(t) {
|
|
5201
|
+
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof St || t instanceof zn || t instanceof Mn || t instanceof Fn || t instanceof Bn);
|
|
5154
5202
|
}
|
|
5155
5203
|
|
|
5156
|
-
function
|
|
5157
|
-
if (!
|
|
5204
|
+
function lr(t, e, n) {
|
|
5205
|
+
if (!hr(n) || !function(t) {
|
|
5158
5206
|
return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
|
|
5159
5207
|
}(n)) {
|
|
5160
5208
|
const r = ut(n);
|
|
@@ -5164,20 +5212,20 @@ function ar(t, e, n) {
|
|
|
5164
5212
|
|
|
5165
5213
|
/**
|
|
5166
5214
|
* Helper that calls fromDotSeparatedString() but wraps any error thrown.
|
|
5167
|
-
*/ function
|
|
5215
|
+
*/ function fr(t, e, n) {
|
|
5168
5216
|
if ((
|
|
5169
5217
|
// If required, replace the FieldPath Compat class with with the firestore-exp
|
|
5170
5218
|
// FieldPath.
|
|
5171
|
-
e = getModularInstance(e)) instanceof
|
|
5172
|
-
if ("string" == typeof e) return
|
|
5173
|
-
throw
|
|
5219
|
+
e = getModularInstance(e)) instanceof Un) return e._internalPath;
|
|
5220
|
+
if ("string" == typeof e) return wr(t, e);
|
|
5221
|
+
throw mr("Field path arguments must be of type string or ", t,
|
|
5174
5222
|
/* hasConverter= */ !1,
|
|
5175
5223
|
/* path= */ void 0, n);
|
|
5176
5224
|
}
|
|
5177
5225
|
|
|
5178
5226
|
/**
|
|
5179
5227
|
* Matches any characters in a field path string that are reserved.
|
|
5180
|
-
*/ const
|
|
5228
|
+
*/ const dr = new RegExp("[~\\*/\\[\\]]");
|
|
5181
5229
|
|
|
5182
5230
|
/**
|
|
5183
5231
|
* Wraps fromDotSeparatedString with an error message about the method that
|
|
@@ -5187,20 +5235,20 @@ function ar(t, e, n) {
|
|
|
5187
5235
|
* split on dots.
|
|
5188
5236
|
* @param targetDoc - The document against which the field path will be
|
|
5189
5237
|
* evaluated.
|
|
5190
|
-
*/ function
|
|
5191
|
-
if (e.search(
|
|
5238
|
+
*/ function wr(t, e, n) {
|
|
5239
|
+
if (e.search(dr) >= 0) throw mr(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`, t,
|
|
5192
5240
|
/* hasConverter= */ !1,
|
|
5193
5241
|
/* path= */ void 0, n);
|
|
5194
5242
|
try {
|
|
5195
|
-
return new
|
|
5243
|
+
return new Un(...e.split("."))._internalPath;
|
|
5196
5244
|
} catch (r) {
|
|
5197
|
-
throw
|
|
5245
|
+
throw mr(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t,
|
|
5198
5246
|
/* hasConverter= */ !1,
|
|
5199
5247
|
/* path= */ void 0, n);
|
|
5200
5248
|
}
|
|
5201
5249
|
}
|
|
5202
5250
|
|
|
5203
|
-
function
|
|
5251
|
+
function mr(t, e, n, r, s) {
|
|
5204
5252
|
const i = r && !r.isEmpty(), o = void 0 !== s;
|
|
5205
5253
|
let u = `Function ${e}() called with invalid data`;
|
|
5206
5254
|
n && (u += " (via `toFirestore()`)"), u += ". ";
|
|
@@ -5209,7 +5257,7 @@ function dr(t, e, n, r, s) {
|
|
|
5209
5257
|
c += ")"), new U(P, u + t + c);
|
|
5210
5258
|
}
|
|
5211
5259
|
|
|
5212
|
-
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function
|
|
5260
|
+
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function pr(t, e) {
|
|
5213
5261
|
return t.some((t => t.isEqual(e)));
|
|
5214
5262
|
}
|
|
5215
5263
|
|
|
@@ -5237,7 +5285,7 @@ function dr(t, e, n, r, s) {
|
|
|
5237
5285
|
* For a `DocumentSnapshot` that points to a non-existing document, any data
|
|
5238
5286
|
* access will return 'undefined'. You can use the `exists()` method to
|
|
5239
5287
|
* explicitly verify a document's existence.
|
|
5240
|
-
*/ class
|
|
5288
|
+
*/ class yr {
|
|
5241
5289
|
// Note: This class is stripped down version of the DocumentSnapshot in
|
|
5242
5290
|
// the legacy SDK. The changes are:
|
|
5243
5291
|
// - No support for SnapshotMetadata.
|
|
@@ -5253,7 +5301,7 @@ function dr(t, e, n, r, s) {
|
|
|
5253
5301
|
/**
|
|
5254
5302
|
* The `DocumentReference` for the document included in the `DocumentSnapshot`.
|
|
5255
5303
|
*/ get ref() {
|
|
5256
|
-
return new
|
|
5304
|
+
return new Fn(this._firestore, this._converter, this._key);
|
|
5257
5305
|
}
|
|
5258
5306
|
/**
|
|
5259
5307
|
* Signals whether or not the document at the snapshot's location exists.
|
|
@@ -5273,7 +5321,7 @@ function dr(t, e, n, r, s) {
|
|
|
5273
5321
|
if (this._converter) {
|
|
5274
5322
|
// We only want to use the converter and create a new DocumentSnapshot
|
|
5275
5323
|
// if a converter has been provided.
|
|
5276
|
-
const t = new
|
|
5324
|
+
const t = new gr(this._firestore, this._userDataWriter, this._key, this._document,
|
|
5277
5325
|
/* converter= */ null);
|
|
5278
5326
|
return this._converter.fromFirestore(t);
|
|
5279
5327
|
}
|
|
@@ -5293,7 +5341,7 @@ function dr(t, e, n, r, s) {
|
|
|
5293
5341
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5294
5342
|
get(t) {
|
|
5295
5343
|
if (this._document) {
|
|
5296
|
-
const e = this._document.data.field(
|
|
5344
|
+
const e = this._document.data.field(br("DocumentSnapshot.get", t));
|
|
5297
5345
|
if (null !== e) return this._userDataWriter.convertValue(e);
|
|
5298
5346
|
}
|
|
5299
5347
|
}
|
|
@@ -5309,7 +5357,7 @@ function dr(t, e, n, r, s) {
|
|
|
5309
5357
|
* `DocumentSnapshot`. Since query results contain only existing documents, the
|
|
5310
5358
|
* `exists` property will always be true and `data()` will never return
|
|
5311
5359
|
* 'undefined'.
|
|
5312
|
-
*/ class
|
|
5360
|
+
*/ class gr extends yr {
|
|
5313
5361
|
/**
|
|
5314
5362
|
* Retrieves all fields in the document as an `Object`.
|
|
5315
5363
|
*
|
|
@@ -5327,7 +5375,7 @@ function dr(t, e, n, r, s) {
|
|
|
5327
5375
|
* array via the `docs` property or enumerated using the `forEach` method. The
|
|
5328
5376
|
* number of documents can be determined via the `empty` and `size`
|
|
5329
5377
|
* properties.
|
|
5330
|
-
*/ class
|
|
5378
|
+
*/ class _r {
|
|
5331
5379
|
/** @hideconstructor */
|
|
5332
5380
|
constructor(t, e) {
|
|
5333
5381
|
this._docs = e, this.query = t;
|
|
@@ -5358,14 +5406,14 @@ function dr(t, e, n, r, s) {
|
|
|
5358
5406
|
* @param left - A snapshot to compare.
|
|
5359
5407
|
* @param right - A snapshot to compare.
|
|
5360
5408
|
* @returns true if the snapshots are equal.
|
|
5361
|
-
*/ function
|
|
5362
|
-
return t = getModularInstance(t), e = getModularInstance(e), t instanceof
|
|
5409
|
+
*/ function vr(t, e) {
|
|
5410
|
+
return t = getModularInstance(t), e = getModularInstance(e), t instanceof yr && e instanceof yr ? 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 _r && e instanceof _r && (Ln(t.query, e.query) && Tt(t.docs, e.docs, vr));
|
|
5363
5411
|
}
|
|
5364
5412
|
|
|
5365
5413
|
/**
|
|
5366
5414
|
* Helper that calls `fromDotSeparatedString()` but wraps any error thrown.
|
|
5367
|
-
*/ function
|
|
5368
|
-
return "string" == typeof e ?
|
|
5415
|
+
*/ function br(t, e) {
|
|
5416
|
+
return "string" == typeof e ? wr(t, e) : e instanceof Un ? e._internalPath : e._delegate._internalPath;
|
|
5369
5417
|
}
|
|
5370
5418
|
|
|
5371
5419
|
/**
|
|
@@ -5388,21 +5436,21 @@ function dr(t, e, n, r, s) {
|
|
|
5388
5436
|
* An `AppliableConstraint` is an abstraction of a constraint that can be applied
|
|
5389
5437
|
* to a Firestore query.
|
|
5390
5438
|
*/
|
|
5391
|
-
class
|
|
5439
|
+
class Er {}
|
|
5392
5440
|
|
|
5393
5441
|
/**
|
|
5394
5442
|
* A `QueryConstraint` is used to narrow the set of documents returned by a
|
|
5395
5443
|
* Firestore query. `QueryConstraint`s are created by invoking {@link where},
|
|
5396
|
-
* {@link orderBy}, {@link startAt}, {@link startAfter}, {@link
|
|
5397
|
-
* endBefore}, {@link endAt}, {@link limit}, {@link limitToLast} and
|
|
5398
|
-
* can then be passed to {@link query} to create a new query instance that
|
|
5444
|
+
* {@link orderBy}, {@link (startAt:1)}, {@link (startAfter:1)}, {@link
|
|
5445
|
+
* (endBefore:1)}, {@link (endAt:1)}, {@link limit}, {@link limitToLast} and
|
|
5446
|
+
* can then be passed to {@link (query:1)} to create a new query instance that
|
|
5399
5447
|
* also contains this `QueryConstraint`.
|
|
5400
|
-
*/ class
|
|
5448
|
+
*/ class Ar extends Er {}
|
|
5401
5449
|
|
|
5402
|
-
function
|
|
5450
|
+
function Ir(t, e, ...n) {
|
|
5403
5451
|
let r = [];
|
|
5404
|
-
e instanceof
|
|
5405
|
-
const e = t.filter((t => t instanceof
|
|
5452
|
+
e instanceof Er && r.push(e), r = r.concat(n), function(t) {
|
|
5453
|
+
const e = t.filter((t => t instanceof Pr)).length, n = t.filter((t => t instanceof Tr)).length;
|
|
5406
5454
|
if (e > 1 || e > 0 && n > 0) throw new U(P, "InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.");
|
|
5407
5455
|
}
|
|
5408
5456
|
/**
|
|
@@ -5435,9 +5483,9 @@ function Er(t, e, ...n) {
|
|
|
5435
5483
|
* A `QueryFieldFilterConstraint` is used to narrow the set of documents returned by
|
|
5436
5484
|
* a Firestore query by filtering on one or more document fields.
|
|
5437
5485
|
* `QueryFieldFilterConstraint`s are created by invoking {@link where} and can then
|
|
5438
|
-
* be passed to {@link query} to create a new query instance that also contains
|
|
5486
|
+
* be passed to {@link (query:1)} to create a new query instance that also contains
|
|
5439
5487
|
* this `QueryFieldFilterConstraint`.
|
|
5440
|
-
*/ class
|
|
5488
|
+
*/ class Tr extends Ar {
|
|
5441
5489
|
/**
|
|
5442
5490
|
* @internal
|
|
5443
5491
|
*/
|
|
@@ -5447,31 +5495,31 @@ function Er(t, e, ...n) {
|
|
|
5447
5495
|
this.type = "where";
|
|
5448
5496
|
}
|
|
5449
5497
|
static _create(t, e, n) {
|
|
5450
|
-
return new
|
|
5498
|
+
return new Tr(t, e, n);
|
|
5451
5499
|
}
|
|
5452
5500
|
_apply(t) {
|
|
5453
5501
|
const e = this._parse(t);
|
|
5454
|
-
return
|
|
5502
|
+
return zr(t._query, e), new xn(t.firestore, t.converter, $e(t._query, e));
|
|
5455
5503
|
}
|
|
5456
5504
|
_parse(t) {
|
|
5457
|
-
const e =
|
|
5505
|
+
const e = Zn(t.firestore), n = function(t, e, n, r, s, i, o) {
|
|
5458
5506
|
let u;
|
|
5459
5507
|
if (s.isKeyField()) {
|
|
5460
5508
|
if ("array-contains" /* Operator.ARRAY_CONTAINS */ === i || "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ === i) throw new U(P, `Invalid Query. You can't perform '${i}' queries on documentId().`);
|
|
5461
5509
|
if ("in" /* Operator.IN */ === i || "not-in" /* Operator.NOT_IN */ === i) {
|
|
5462
|
-
|
|
5510
|
+
Br(o, i);
|
|
5463
5511
|
const e = [];
|
|
5464
|
-
for (const n of o) e.push(
|
|
5512
|
+
for (const n of o) e.push(jr(r, t, n));
|
|
5465
5513
|
u = {
|
|
5466
5514
|
arrayValue: {
|
|
5467
5515
|
values: e
|
|
5468
5516
|
}
|
|
5469
5517
|
};
|
|
5470
|
-
} else u =
|
|
5471
|
-
} else "in" /* Operator.IN */ !== i && "not-in" /* Operator.NOT_IN */ !== i && "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ !== i ||
|
|
5472
|
-
u =
|
|
5518
|
+
} else u = jr(r, t, o);
|
|
5519
|
+
} else "in" /* Operator.IN */ !== i && "not-in" /* Operator.NOT_IN */ !== i && "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ !== i || Br(o, i),
|
|
5520
|
+
u = ur(n, e, o,
|
|
5473
5521
|
/* allowArrays= */ "in" /* Operator.IN */ === i || "not-in" /* Operator.NOT_IN */ === i);
|
|
5474
|
-
return
|
|
5522
|
+
return Xt.create(s, i, u);
|
|
5475
5523
|
}(t._query, "where", e, t.firestore._databaseId, this._field, this._op, this._value);
|
|
5476
5524
|
return n;
|
|
5477
5525
|
}
|
|
@@ -5487,9 +5535,9 @@ function Er(t, e, ...n) {
|
|
|
5487
5535
|
* "<=", "!=").
|
|
5488
5536
|
* @param value - The value for comparison
|
|
5489
5537
|
* @returns The created {@link QueryFieldFilterConstraint}.
|
|
5490
|
-
*/ function
|
|
5491
|
-
const r = e, s =
|
|
5492
|
-
return
|
|
5538
|
+
*/ function Rr(t, e, n) {
|
|
5539
|
+
const r = e, s = br("where", t);
|
|
5540
|
+
return Tr._create(s, r, n);
|
|
5493
5541
|
}
|
|
5494
5542
|
|
|
5495
5543
|
/**
|
|
@@ -5497,10 +5545,9 @@ function Er(t, e, ...n) {
|
|
|
5497
5545
|
* returned by a Firestore query by performing the logical OR or AND of multiple
|
|
5498
5546
|
* {@link QueryFieldFilterConstraint}s or {@link QueryCompositeFilterConstraint}s.
|
|
5499
5547
|
* `QueryCompositeFilterConstraint`s are created by invoking {@link or} or
|
|
5500
|
-
* {@link and} and can then be passed to {@link query} to create a new query
|
|
5548
|
+
* {@link and} and can then be passed to {@link (query:1)} to create a new query
|
|
5501
5549
|
* instance that also contains the `QueryCompositeFilterConstraint`.
|
|
5502
|
-
|
|
5503
|
-
*/ class Tr extends vr {
|
|
5550
|
+
*/ class Pr extends Er {
|
|
5504
5551
|
/**
|
|
5505
5552
|
* @internal
|
|
5506
5553
|
*/
|
|
@@ -5510,22 +5557,22 @@ function Er(t, e, ...n) {
|
|
|
5510
5557
|
super(), this.type = t, this._queryConstraints = e;
|
|
5511
5558
|
}
|
|
5512
5559
|
static _create(t, e) {
|
|
5513
|
-
return new
|
|
5560
|
+
return new Pr(t, e);
|
|
5514
5561
|
}
|
|
5515
5562
|
_parse(t) {
|
|
5516
5563
|
const e = this._queryConstraints.map((e => e._parse(t))).filter((t => t.getFilters().length > 0));
|
|
5517
|
-
return 1 === e.length ? e[0] :
|
|
5564
|
+
return 1 === e.length ? e[0] : te.create(e, this._getOperator());
|
|
5518
5565
|
}
|
|
5519
5566
|
_apply(t) {
|
|
5520
5567
|
const e = this._parse(t);
|
|
5521
5568
|
return 0 === e.getFilters().length ? t : (function(t, e) {
|
|
5522
5569
|
let n = t;
|
|
5523
5570
|
const r = e.getFlattenedFilters();
|
|
5524
|
-
for (const t of r)
|
|
5571
|
+
for (const t of r) zr(n, t), n = $e(n, t);
|
|
5525
5572
|
}
|
|
5526
5573
|
// Checks if any of the provided filter operators are included in the given list of filters and
|
|
5527
5574
|
// returns the first one that is, or null if none are.
|
|
5528
|
-
(t._query, e), new
|
|
5575
|
+
(t._query, e), new xn(t.firestore, t.converter, $e(t._query, e)));
|
|
5529
5576
|
}
|
|
5530
5577
|
_getQueryConstraints() {
|
|
5531
5578
|
return this._queryConstraints;
|
|
@@ -5544,10 +5591,9 @@ function Er(t, e, ...n) {
|
|
|
5544
5591
|
* {@link QueryFilterConstraint}s to perform a disjunction for. These must be
|
|
5545
5592
|
* created with calls to {@link where}, {@link or}, or {@link and}.
|
|
5546
5593
|
* @returns The newly created {@link QueryCompositeFilterConstraint}.
|
|
5547
|
-
|
|
5548
|
-
*/ function Rr(...t) {
|
|
5594
|
+
*/ function Vr(...t) {
|
|
5549
5595
|
// Only support QueryFilterConstraints
|
|
5550
|
-
return t.forEach((t =>
|
|
5596
|
+
return t.forEach((t => Wr("or", t))), Pr._create("or" /* CompositeOperator.OR */ , t);
|
|
5551
5597
|
}
|
|
5552
5598
|
|
|
5553
5599
|
/**
|
|
@@ -5559,21 +5605,20 @@ function Er(t, e, ...n) {
|
|
|
5559
5605
|
* {@link QueryFilterConstraint}s to perform a conjunction for. These must be
|
|
5560
5606
|
* created with calls to {@link where}, {@link or}, or {@link and}.
|
|
5561
5607
|
* @returns The newly created {@link QueryCompositeFilterConstraint}.
|
|
5562
|
-
|
|
5563
|
-
*/ function Pr(...t) {
|
|
5608
|
+
*/ function $r(...t) {
|
|
5564
5609
|
// Only support QueryFilterConstraints
|
|
5565
|
-
return t.forEach((t =>
|
|
5610
|
+
return t.forEach((t => Wr("and", t))), Pr._create("and" /* CompositeOperator.AND */ , t);
|
|
5566
5611
|
}
|
|
5567
5612
|
|
|
5568
5613
|
/**
|
|
5569
5614
|
* A `QueryOrderByConstraint` is used to sort the set of documents returned by a
|
|
5570
5615
|
* Firestore query. `QueryOrderByConstraint`s are created by invoking
|
|
5571
|
-
* {@link orderBy} and can then be passed to {@link query} to create a new query
|
|
5616
|
+
* {@link orderBy} and can then be passed to {@link (query:1)} to create a new query
|
|
5572
5617
|
* instance that also contains this `QueryOrderByConstraint`.
|
|
5573
5618
|
*
|
|
5574
5619
|
* Note: Documents that do not contain the orderBy field will not be present in
|
|
5575
5620
|
* the query result.
|
|
5576
|
-
*/ class
|
|
5621
|
+
*/ class Dr extends Ar {
|
|
5577
5622
|
/**
|
|
5578
5623
|
* @internal
|
|
5579
5624
|
*/
|
|
@@ -5583,18 +5628,18 @@ function Er(t, e, ...n) {
|
|
|
5583
5628
|
this.type = "orderBy";
|
|
5584
5629
|
}
|
|
5585
5630
|
static _create(t, e) {
|
|
5586
|
-
return new
|
|
5631
|
+
return new Dr(t, e);
|
|
5587
5632
|
}
|
|
5588
5633
|
_apply(t) {
|
|
5589
5634
|
const e = function(t, e, n) {
|
|
5590
5635
|
if (null !== t.startAt) throw new U(P, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
|
|
5591
5636
|
if (null !== t.endAt) throw new U(P, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
|
|
5592
|
-
const r = new
|
|
5637
|
+
const r = new he(e, n);
|
|
5593
5638
|
return function(t, e) {
|
|
5594
|
-
if (null ===
|
|
5639
|
+
if (null === Ie(t)) {
|
|
5595
5640
|
// This is the first order by. It must match any inequality.
|
|
5596
|
-
const n =
|
|
5597
|
-
null !== n &&
|
|
5641
|
+
const n = Te(t);
|
|
5642
|
+
null !== n && Qr(t, n, e.field);
|
|
5598
5643
|
}
|
|
5599
5644
|
}(t, r), r;
|
|
5600
5645
|
}
|
|
@@ -5609,10 +5654,10 @@ function Er(t, e, ...n) {
|
|
|
5609
5654
|
* of the query or if any of the fields in the order by are an uncommitted
|
|
5610
5655
|
* server timestamp.
|
|
5611
5656
|
*/ (t._query, this._field, this._direction);
|
|
5612
|
-
return new
|
|
5657
|
+
return new xn(t.firestore, t.converter, function(t, e) {
|
|
5613
5658
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
5614
5659
|
const n = t.explicitOrderBy.concat([ e ]);
|
|
5615
|
-
return new
|
|
5660
|
+
return new Ae(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
|
|
5616
5661
|
}(t._query, e));
|
|
5617
5662
|
}
|
|
5618
5663
|
}
|
|
@@ -5628,18 +5673,18 @@ function Er(t, e, ...n) {
|
|
|
5628
5673
|
* @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
|
|
5629
5674
|
* not specified, order will be ascending.
|
|
5630
5675
|
* @returns The created {@link QueryOrderByConstraint}.
|
|
5631
|
-
*/ function
|
|
5632
|
-
const n = e, r =
|
|
5633
|
-
return
|
|
5676
|
+
*/ function Nr(t, e = "asc") {
|
|
5677
|
+
const n = e, r = br("orderBy", t);
|
|
5678
|
+
return Dr._create(r, n);
|
|
5634
5679
|
}
|
|
5635
5680
|
|
|
5636
5681
|
/**
|
|
5637
5682
|
* A `QueryLimitConstraint` is used to limit the number of documents returned by
|
|
5638
5683
|
* a Firestore query.
|
|
5639
5684
|
* `QueryLimitConstraint`s are created by invoking {@link limit} or
|
|
5640
|
-
* {@link limitToLast} and can then be passed to {@link query} to create a new
|
|
5685
|
+
* {@link limitToLast} and can then be passed to {@link (query:1)} to create a new
|
|
5641
5686
|
* query instance that also contains this `QueryLimitConstraint`.
|
|
5642
|
-
*/ class
|
|
5687
|
+
*/ class Fr extends Ar {
|
|
5643
5688
|
/**
|
|
5644
5689
|
* @internal
|
|
5645
5690
|
*/
|
|
@@ -5649,11 +5694,11 @@ function Er(t, e, ...n) {
|
|
|
5649
5694
|
super(), this.type = t, this._limit = e, this._limitType = n;
|
|
5650
5695
|
}
|
|
5651
5696
|
static _create(t, e, n) {
|
|
5652
|
-
return new
|
|
5697
|
+
return new Fr(t, e, n);
|
|
5653
5698
|
}
|
|
5654
5699
|
_apply(t) {
|
|
5655
|
-
return new
|
|
5656
|
-
return new
|
|
5700
|
+
return new xn(t.firestore, t.converter, function(t, e, n) {
|
|
5701
|
+
return new Ae(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
|
|
5657
5702
|
}(t._query, this._limit, this._limitType));
|
|
5658
5703
|
}
|
|
5659
5704
|
}
|
|
@@ -5664,8 +5709,8 @@ function Er(t, e, ...n) {
|
|
|
5664
5709
|
*
|
|
5665
5710
|
* @param limit - The maximum number of items to return.
|
|
5666
5711
|
* @returns The created {@link QueryLimitConstraint}.
|
|
5667
|
-
*/ function
|
|
5668
|
-
return at("limit", t),
|
|
5712
|
+
*/ function xr(t) {
|
|
5713
|
+
return at("limit", t), Fr._create("limit", t, "F" /* LimitType.First */);
|
|
5669
5714
|
}
|
|
5670
5715
|
|
|
5671
5716
|
/**
|
|
@@ -5677,17 +5722,17 @@ function Er(t, e, ...n) {
|
|
|
5677
5722
|
*
|
|
5678
5723
|
* @param limit - The maximum number of items to return.
|
|
5679
5724
|
* @returns The created {@link QueryLimitConstraint}.
|
|
5680
|
-
*/ function
|
|
5681
|
-
return at("limitToLast", t),
|
|
5725
|
+
*/ function Sr(t) {
|
|
5726
|
+
return at("limitToLast", t), Fr._create("limitToLast", t, "L" /* LimitType.Last */);
|
|
5682
5727
|
}
|
|
5683
5728
|
|
|
5684
5729
|
/**
|
|
5685
5730
|
* A `QueryStartAtConstraint` is used to exclude documents from the start of a
|
|
5686
5731
|
* result set returned by a Firestore query.
|
|
5687
5732
|
* `QueryStartAtConstraint`s are created by invoking {@link (startAt:1)} or
|
|
5688
|
-
* {@link (startAfter:1)} and can then be passed to {@link query} to create a
|
|
5733
|
+
* {@link (startAfter:1)} and can then be passed to {@link (query:1)} to create a
|
|
5689
5734
|
* new query instance that also contains this `QueryStartAtConstraint`.
|
|
5690
|
-
*/ class
|
|
5735
|
+
*/ class qr extends Ar {
|
|
5691
5736
|
/**
|
|
5692
5737
|
* @internal
|
|
5693
5738
|
*/
|
|
@@ -5697,23 +5742,23 @@ function Er(t, e, ...n) {
|
|
|
5697
5742
|
super(), this.type = t, this._docOrFields = e, this._inclusive = n;
|
|
5698
5743
|
}
|
|
5699
5744
|
static _create(t, e, n) {
|
|
5700
|
-
return new
|
|
5745
|
+
return new qr(t, e, n);
|
|
5701
5746
|
}
|
|
5702
5747
|
_apply(t) {
|
|
5703
|
-
const e =
|
|
5704
|
-
return new
|
|
5705
|
-
return new
|
|
5748
|
+
const e = Ur(t, this.type, this._docOrFields, this._inclusive);
|
|
5749
|
+
return new xn(t.firestore, t.converter, function(t, e) {
|
|
5750
|
+
return new Ae(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
|
|
5706
5751
|
}(t._query, e));
|
|
5707
5752
|
}
|
|
5708
5753
|
}
|
|
5709
5754
|
|
|
5710
|
-
function
|
|
5711
|
-
return
|
|
5755
|
+
function Or(...t) {
|
|
5756
|
+
return qr._create("startAt", t,
|
|
5712
5757
|
/*inclusive=*/ !0);
|
|
5713
5758
|
}
|
|
5714
5759
|
|
|
5715
|
-
function
|
|
5716
|
-
return
|
|
5760
|
+
function kr(...t) {
|
|
5761
|
+
return qr._create("startAfter", t,
|
|
5717
5762
|
/*inclusive=*/ !1);
|
|
5718
5763
|
}
|
|
5719
5764
|
|
|
@@ -5721,9 +5766,9 @@ function qr(...t) {
|
|
|
5721
5766
|
* A `QueryEndAtConstraint` is used to exclude documents from the end of a
|
|
5722
5767
|
* result set returned by a Firestore query.
|
|
5723
5768
|
* `QueryEndAtConstraint`s are created by invoking {@link (endAt:1)} or
|
|
5724
|
-
* {@link (endBefore:1)} and can then be passed to {@link query} to create a new
|
|
5769
|
+
* {@link (endBefore:1)} and can then be passed to {@link (query:1)} to create a new
|
|
5725
5770
|
* query instance that also contains this `QueryEndAtConstraint`.
|
|
5726
|
-
*/ class
|
|
5771
|
+
*/ class Cr extends Ar {
|
|
5727
5772
|
/**
|
|
5728
5773
|
* @internal
|
|
5729
5774
|
*/
|
|
@@ -5733,28 +5778,28 @@ function qr(...t) {
|
|
|
5733
5778
|
super(), this.type = t, this._docOrFields = e, this._inclusive = n;
|
|
5734
5779
|
}
|
|
5735
5780
|
static _create(t, e, n) {
|
|
5736
|
-
return new
|
|
5781
|
+
return new Cr(t, e, n);
|
|
5737
5782
|
}
|
|
5738
5783
|
_apply(t) {
|
|
5739
|
-
const e =
|
|
5740
|
-
return new
|
|
5741
|
-
return new
|
|
5784
|
+
const e = Ur(t, this.type, this._docOrFields, this._inclusive);
|
|
5785
|
+
return new xn(t.firestore, t.converter, function(t, e) {
|
|
5786
|
+
return new Ae(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
|
|
5742
5787
|
}(t._query, e));
|
|
5743
5788
|
}
|
|
5744
5789
|
}
|
|
5745
5790
|
|
|
5746
|
-
function
|
|
5747
|
-
return
|
|
5791
|
+
function Lr(...t) {
|
|
5792
|
+
return Cr._create("endBefore", t,
|
|
5748
5793
|
/*inclusive=*/ !1);
|
|
5749
5794
|
}
|
|
5750
5795
|
|
|
5751
|
-
function
|
|
5752
|
-
return
|
|
5796
|
+
function Mr(...t) {
|
|
5797
|
+
return Cr._create("endAt", t,
|
|
5753
5798
|
/*inclusive=*/ !0);
|
|
5754
5799
|
}
|
|
5755
5800
|
|
|
5756
|
-
/** Helper function to create a bound from a document or fields */ function
|
|
5757
|
-
if (n[0] = getModularInstance(n[0]), n[0] instanceof
|
|
5801
|
+
/** Helper function to create a bound from a document or fields */ function Ur(t, e, n, r) {
|
|
5802
|
+
if (n[0] = getModularInstance(n[0]), n[0] instanceof yr) return function(t, e, n, r, s) {
|
|
5758
5803
|
if (!r) throw new U($, `Can't use a DocumentSnapshot that doesn't exist for ${n}().`);
|
|
5759
5804
|
const i = [];
|
|
5760
5805
|
// Because people expect to continue/end a query at the exact document
|
|
@@ -5764,22 +5809,22 @@ function Cr(...t) {
|
|
|
5764
5809
|
// the provided document. Without the key (by using the explicit sort
|
|
5765
5810
|
// orders), multiple documents could match the position, yielding duplicate
|
|
5766
5811
|
// results.
|
|
5767
|
-
for (const n of
|
|
5812
|
+
for (const n of Pe(t)) if (n.field.isKeyField()) i.push(zt(e, r.key)); else {
|
|
5768
5813
|
const t = r.data.field(n.field);
|
|
5769
|
-
if (
|
|
5814
|
+
if (qt(t)) throw new U(P, 'Invalid query. You are trying to start or end a query using a document for which the field "' + n.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');
|
|
5770
5815
|
if (null === t) {
|
|
5771
5816
|
const t = n.field.canonicalString();
|
|
5772
5817
|
throw new U(P, `Invalid query. You are trying to start or end a query using a document for which the field '${t}' (used as the orderBy) does not exist.`);
|
|
5773
5818
|
}
|
|
5774
5819
|
i.push(t);
|
|
5775
5820
|
}
|
|
5776
|
-
return new
|
|
5821
|
+
return new Ht(i, s);
|
|
5777
5822
|
}
|
|
5778
5823
|
/**
|
|
5779
5824
|
* Converts a list of field values to a `Bound` for the given query.
|
|
5780
5825
|
*/ (t._query, t.firestore._databaseId, e, n[0]._document, r);
|
|
5781
5826
|
{
|
|
5782
|
-
const s =
|
|
5827
|
+
const s = Zn(t.firestore);
|
|
5783
5828
|
return function(t, e, n, r, s, i) {
|
|
5784
5829
|
// Use explicit order by's because it has to match the query the user made
|
|
5785
5830
|
const o = t.explicitOrderBy;
|
|
@@ -5789,17 +5834,17 @@ function Cr(...t) {
|
|
|
5789
5834
|
const c = s[i];
|
|
5790
5835
|
if (o[i].field.isKeyField()) {
|
|
5791
5836
|
if ("string" != typeof c) throw new U(P, `Invalid query. Expected a string for document ID in ${r}(), but got a ${typeof c}`);
|
|
5792
|
-
if (!
|
|
5837
|
+
if (!Re(t) && -1 !== c.indexOf("/")) throw new U(P, `Invalid query. When querying a collection and ordering by documentId(), the value passed to ${r}() must be a plain document ID, but '${c}' contains a slash.`);
|
|
5793
5838
|
const n = t.path.child(tt.fromString(c));
|
|
5794
5839
|
if (!rt.isDocumentKey(n)) throw new U(P, `Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${r}() must result in a valid document path, but '${n}' is not because it contains an odd number of segments.`);
|
|
5795
5840
|
const s = new rt(n);
|
|
5796
|
-
u.push(
|
|
5841
|
+
u.push(zt(e, s));
|
|
5797
5842
|
} else {
|
|
5798
|
-
const t =
|
|
5843
|
+
const t = ur(n, r, c);
|
|
5799
5844
|
u.push(t);
|
|
5800
5845
|
}
|
|
5801
5846
|
}
|
|
5802
|
-
return new
|
|
5847
|
+
return new Ht(u, i);
|
|
5803
5848
|
}
|
|
5804
5849
|
/**
|
|
5805
5850
|
* Parses the given `documentIdValue` into a `ReferenceValue`, throwing
|
|
@@ -5809,22 +5854,22 @@ function Cr(...t) {
|
|
|
5809
5854
|
}
|
|
5810
5855
|
}
|
|
5811
5856
|
|
|
5812
|
-
function
|
|
5857
|
+
function jr(t, e, n) {
|
|
5813
5858
|
if ("string" == typeof (n = getModularInstance(n))) {
|
|
5814
5859
|
if ("" === n) throw new U(P, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
|
|
5815
|
-
if (!
|
|
5860
|
+
if (!Re(e) && -1 !== n.indexOf("/")) throw new U(P, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);
|
|
5816
5861
|
const r = e.path.child(tt.fromString(n));
|
|
5817
5862
|
if (!rt.isDocumentKey(r)) throw new U(P, `Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);
|
|
5818
|
-
return
|
|
5863
|
+
return zt(t, new rt(r));
|
|
5819
5864
|
}
|
|
5820
|
-
if (n instanceof
|
|
5865
|
+
if (n instanceof Fn) return zt(t, n._key);
|
|
5821
5866
|
throw new U(P, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${ut(n)}.`);
|
|
5822
5867
|
}
|
|
5823
5868
|
|
|
5824
5869
|
/**
|
|
5825
5870
|
* Validates that the value passed into a disjunctive filter satisfies all
|
|
5826
5871
|
* array requirements.
|
|
5827
|
-
*/ function
|
|
5872
|
+
*/ function Br(t, e) {
|
|
5828
5873
|
if (!Array.isArray(t) || 0 === t.length) throw new U(P, `Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);
|
|
5829
5874
|
}
|
|
5830
5875
|
|
|
@@ -5837,12 +5882,12 @@ function Mr(t, e, n) {
|
|
|
5837
5882
|
* Operators in a query must adhere to the following set of rules:
|
|
5838
5883
|
* 1. Only one inequality per query.
|
|
5839
5884
|
* 2. `NOT_IN` cannot be used with array, disjunctive, or `NOT_EQUAL` operators.
|
|
5840
|
-
*/ function
|
|
5885
|
+
*/ function zr(t, e) {
|
|
5841
5886
|
if (e.isInequality()) {
|
|
5842
|
-
const n =
|
|
5887
|
+
const n = Te(t), r = e.field;
|
|
5843
5888
|
if (null !== n && !n.isEqual(r)) throw new U(P, `Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${n.toString()}' and '${r.toString()}'`);
|
|
5844
|
-
const s =
|
|
5845
|
-
null !== s &&
|
|
5889
|
+
const s = Ie(t);
|
|
5890
|
+
null !== s && Qr(t, r, s);
|
|
5846
5891
|
}
|
|
5847
5892
|
const n = function(t, e) {
|
|
5848
5893
|
for (const n of t) for (const t of n.getFlattenedFilters()) if (e.indexOf(t.op) >= 0) return t.op;
|
|
@@ -5868,12 +5913,12 @@ function Mr(t, e, n) {
|
|
|
5868
5913
|
throw n === e.op ? new U(P, `Invalid query. You cannot use more than one '${e.op.toString()}' filter.`) : new U(P, `Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`);
|
|
5869
5914
|
}
|
|
5870
5915
|
|
|
5871
|
-
function
|
|
5916
|
+
function Qr(t, e, n) {
|
|
5872
5917
|
if (!n.isEqual(e)) throw new U(P, `Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${e.toString()}' and so you must also use '${e.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${n.toString()}' instead.`);
|
|
5873
5918
|
}
|
|
5874
5919
|
|
|
5875
|
-
function
|
|
5876
|
-
if (!(e instanceof
|
|
5920
|
+
function Wr(t, e) {
|
|
5921
|
+
if (!(e instanceof Tr || e instanceof Pr)) throw new U(P, `Function ${t}() requires AppliableConstraints created with a call to 'where(...)', 'or(...)', or 'and(...)'.`);
|
|
5877
5922
|
}
|
|
5878
5923
|
|
|
5879
5924
|
/**
|
|
@@ -5901,7 +5946,7 @@ function zr(t, e) {
|
|
|
5901
5946
|
* their `set()` or fails due to invalid data originating from a `toFirestore()`
|
|
5902
5947
|
* call.
|
|
5903
5948
|
*/
|
|
5904
|
-
function
|
|
5949
|
+
function Gr(t, e, n) {
|
|
5905
5950
|
let r;
|
|
5906
5951
|
// Cast to `any` in order to satisfy the union type constraint on
|
|
5907
5952
|
// toFirestore().
|
|
@@ -5910,9 +5955,9 @@ function Qr(t, e, n) {
|
|
|
5910
5955
|
r;
|
|
5911
5956
|
}
|
|
5912
5957
|
|
|
5913
|
-
class
|
|
5958
|
+
class Kr extends class {
|
|
5914
5959
|
convertValue(t, e = "none") {
|
|
5915
|
-
switch (
|
|
5960
|
+
switch (Lt(t)) {
|
|
5916
5961
|
case 0 /* TypeOrder.NullValue */ :
|
|
5917
5962
|
return null;
|
|
5918
5963
|
|
|
@@ -5920,7 +5965,7 @@ class Wr extends class {
|
|
|
5920
5965
|
return t.booleanValue;
|
|
5921
5966
|
|
|
5922
5967
|
case 2 /* TypeOrder.NumberValue */ :
|
|
5923
|
-
return
|
|
5968
|
+
return Ft(t.integerValue || t.doubleValue);
|
|
5924
5969
|
|
|
5925
5970
|
case 3 /* TypeOrder.TimestampValue */ :
|
|
5926
5971
|
return this.convertTimestamp(t.timestampValue);
|
|
@@ -5932,7 +5977,7 @@ class Wr extends class {
|
|
|
5932
5977
|
return t.stringValue;
|
|
5933
5978
|
|
|
5934
5979
|
case 6 /* TypeOrder.BlobValue */ :
|
|
5935
|
-
return this.convertBytes(
|
|
5980
|
+
return this.convertBytes(xt(t.bytesValue));
|
|
5936
5981
|
|
|
5937
5982
|
case 7 /* TypeOrder.RefValue */ :
|
|
5938
5983
|
return this.convertReference(t.referenceValue);
|
|
@@ -5952,12 +5997,12 @@ class Wr extends class {
|
|
|
5952
5997
|
}
|
|
5953
5998
|
convertObject(t, e) {
|
|
5954
5999
|
const n = {};
|
|
5955
|
-
return
|
|
6000
|
+
return Pt(t.fields, ((t, r) => {
|
|
5956
6001
|
n[t] = this.convertValue(r, e);
|
|
5957
6002
|
})), n;
|
|
5958
6003
|
}
|
|
5959
6004
|
convertGeoPoint(t) {
|
|
5960
|
-
return new
|
|
6005
|
+
return new zn(Ft(t.latitude), Ft(t.longitude));
|
|
5961
6006
|
}
|
|
5962
6007
|
convertArray(t, e) {
|
|
5963
6008
|
return (t.values || []).map((t => this.convertValue(t, e)));
|
|
@@ -5965,23 +6010,23 @@ class Wr extends class {
|
|
|
5965
6010
|
convertServerTimestamp(t, e) {
|
|
5966
6011
|
switch (e) {
|
|
5967
6012
|
case "previous":
|
|
5968
|
-
const n =
|
|
6013
|
+
const n = Ot(t);
|
|
5969
6014
|
return null == n ? null : this.convertValue(n, e);
|
|
5970
6015
|
|
|
5971
6016
|
case "estimate":
|
|
5972
|
-
return this.convertTimestamp(
|
|
6017
|
+
return this.convertTimestamp(kt(t));
|
|
5973
6018
|
|
|
5974
6019
|
default:
|
|
5975
6020
|
return null;
|
|
5976
6021
|
}
|
|
5977
6022
|
}
|
|
5978
6023
|
convertTimestamp(t) {
|
|
5979
|
-
const e =
|
|
5980
|
-
return new
|
|
6024
|
+
const e = Nt(t);
|
|
6025
|
+
return new St(e.seconds, e.nanos);
|
|
5981
6026
|
}
|
|
5982
6027
|
convertDocumentKey(t, e) {
|
|
5983
6028
|
const n = tt.fromString(t);
|
|
5984
|
-
E(
|
|
6029
|
+
E(wn(n));
|
|
5985
6030
|
const r = new J(n.get(1), n.get(3)), s = new rt(n.popFirst(5));
|
|
5986
6031
|
return r.isEqual(e) ||
|
|
5987
6032
|
// TODO(b/64130202): Somehow support foreign references.
|
|
@@ -5993,11 +6038,11 @@ class Wr extends class {
|
|
|
5993
6038
|
super(), this.firestore = t;
|
|
5994
6039
|
}
|
|
5995
6040
|
convertBytes(t) {
|
|
5996
|
-
return new
|
|
6041
|
+
return new Mn(t);
|
|
5997
6042
|
}
|
|
5998
6043
|
convertReference(t) {
|
|
5999
6044
|
const e = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
6000
|
-
return new
|
|
6045
|
+
return new Fn(this.firestore, /* converter= */ null, e);
|
|
6001
6046
|
}
|
|
6002
6047
|
}
|
|
6003
6048
|
|
|
@@ -6013,12 +6058,12 @@ class Wr extends class {
|
|
|
6013
6058
|
* @param reference - The reference of the document to fetch.
|
|
6014
6059
|
* @returns A Promise resolved with a `DocumentSnapshot` containing the current
|
|
6015
6060
|
* document contents.
|
|
6016
|
-
*/ function
|
|
6017
|
-
const e =
|
|
6018
|
-
return
|
|
6061
|
+
*/ function Yr(t) {
|
|
6062
|
+
const e = An((t = ct(t, Fn)).firestore), n = new Kr(t.firestore);
|
|
6063
|
+
return _n(e, [ t._key ]).then((e => {
|
|
6019
6064
|
E(1 === e.length);
|
|
6020
6065
|
const r = e[0];
|
|
6021
|
-
return new
|
|
6066
|
+
return new yr(t.firestore, n, t._key, r.isFoundDocument() ? r : null, t.converter);
|
|
6022
6067
|
}));
|
|
6023
6068
|
}
|
|
6024
6069
|
|
|
@@ -6033,33 +6078,33 @@ class Wr extends class {
|
|
|
6033
6078
|
*
|
|
6034
6079
|
* @param query - The `Query` to execute.
|
|
6035
6080
|
* @returns A Promise that will be resolved with the results of the query.
|
|
6036
|
-
*/ function
|
|
6081
|
+
*/ function Hr(t) {
|
|
6037
6082
|
!function(t) {
|
|
6038
6083
|
if ("L" /* LimitType.Last */ === t.limitType && 0 === t.explicitOrderBy.length) throw new U(k, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
6039
|
-
}((t = ct(t,
|
|
6040
|
-
const e =
|
|
6041
|
-
return
|
|
6042
|
-
const r = e.map((e => new
|
|
6084
|
+
}((t = ct(t, xn))._query);
|
|
6085
|
+
const e = An(t.firestore), n = new Kr(t.firestore);
|
|
6086
|
+
return vn(e, t._query).then((e => {
|
|
6087
|
+
const r = e.map((e => new gr(t.firestore, n, e.key, e, t.converter)));
|
|
6043
6088
|
return "L" /* LimitType.Last */ === t._query.limitType &&
|
|
6044
6089
|
// Limit to last queries reverse the orderBy constraint that was
|
|
6045
6090
|
// specified by the user. As such, we need to reverse the order of the
|
|
6046
6091
|
// results to return the documents in the expected order.
|
|
6047
|
-
r.reverse(), new
|
|
6092
|
+
r.reverse(), new _r(t, r);
|
|
6048
6093
|
}));
|
|
6049
6094
|
}
|
|
6050
6095
|
|
|
6051
|
-
function
|
|
6052
|
-
const r =
|
|
6053
|
-
return
|
|
6096
|
+
function Zr(t, e, n) {
|
|
6097
|
+
const r = Gr((t = ct(t, Fn)).converter, e, n), s = Jn(Zn(t.firestore), "setDoc", t._key, r, null !== t.converter, n);
|
|
6098
|
+
return gn(An(t.firestore), [ s.toMutation(t._key, Ce.none()) ]);
|
|
6054
6099
|
}
|
|
6055
6100
|
|
|
6056
|
-
function
|
|
6057
|
-
const s =
|
|
6101
|
+
function Jr(t, e, n, ...r) {
|
|
6102
|
+
const s = Zn((t = ct(t, Fn)).firestore);
|
|
6058
6103
|
// For Compat types, we have to "extract" the underlying types before
|
|
6059
6104
|
// performing validation.
|
|
6060
6105
|
let i;
|
|
6061
|
-
i = "string" == typeof (e = getModularInstance(e)) || e instanceof
|
|
6062
|
-
return
|
|
6106
|
+
i = "string" == typeof (e = getModularInstance(e)) || e instanceof Un ? or(s, "updateDoc", t._key, e, n, r) : ir(s, "updateDoc", t._key, e);
|
|
6107
|
+
return gn(An(t.firestore), [ i.toMutation(t._key, Ce.exists(!0)) ]);
|
|
6063
6108
|
}
|
|
6064
6109
|
|
|
6065
6110
|
/**
|
|
@@ -6073,8 +6118,8 @@ function Hr(t, e, n, ...r) {
|
|
|
6073
6118
|
* @param reference - A reference to the document to delete.
|
|
6074
6119
|
* @returns A `Promise` resolved once the document has been successfully
|
|
6075
6120
|
* deleted from the backend.
|
|
6076
|
-
*/ function
|
|
6077
|
-
return
|
|
6121
|
+
*/ function Xr(t) {
|
|
6122
|
+
return gn(An((t = ct(t, Fn)).firestore), [ new je(t._key, Ce.none()) ]);
|
|
6078
6123
|
}
|
|
6079
6124
|
|
|
6080
6125
|
/**
|
|
@@ -6091,9 +6136,9 @@ function Hr(t, e, n, ...r) {
|
|
|
6091
6136
|
* @throws Error - If the provided input is not a valid Firestore document.
|
|
6092
6137
|
* @returns A `Promise` resolved with a `DocumentReference` pointing to the
|
|
6093
6138
|
* newly created document after it has been written to the backend.
|
|
6094
|
-
*/ function
|
|
6095
|
-
const n =
|
|
6096
|
-
return
|
|
6139
|
+
*/ function ts(t, e) {
|
|
6140
|
+
const n = kn(t = ct(t, Sn)), r = Gr(t.converter, e), s = Jn(Zn(t.firestore), "addDoc", n._key, r, null !== n.converter, {});
|
|
6141
|
+
return gn(An(t.firestore), [ s.toMutation(n._key, Ce.exists(!1)) ]).then((() => n));
|
|
6097
6142
|
}
|
|
6098
6143
|
|
|
6099
6144
|
/**
|
|
@@ -6125,9 +6170,9 @@ function Hr(t, e, n, ...r) {
|
|
|
6125
6170
|
* @returns A Promise that will be resolved with the count; the count can be
|
|
6126
6171
|
* retrieved from `snapshot.data().count`, where `snapshot` is the
|
|
6127
6172
|
* `AggregateQuerySnapshot` to which the returned Promise resolves.
|
|
6128
|
-
*/ function
|
|
6129
|
-
return
|
|
6130
|
-
count:
|
|
6173
|
+
*/ function es(t) {
|
|
6174
|
+
return ns(t, {
|
|
6175
|
+
count: is()
|
|
6131
6176
|
});
|
|
6132
6177
|
}
|
|
6133
6178
|
|
|
@@ -6157,16 +6202,16 @@ function Hr(t, e, n, ...r) {
|
|
|
6157
6202
|
* const averageScore: number | null = aggregateSnapshot.data().averageScore;
|
|
6158
6203
|
* ```
|
|
6159
6204
|
* @internal TODO (sum/avg) remove when public
|
|
6160
|
-
*/ function
|
|
6161
|
-
const n = ct(t.firestore,
|
|
6205
|
+
*/ function ns(t, e) {
|
|
6206
|
+
const n = ct(t.firestore, Tn), r = An(n), s = function(t, e) {
|
|
6162
6207
|
const n = [];
|
|
6163
6208
|
for (const r in t) Object.prototype.hasOwnProperty.call(t, r) && n.push(e(t[r], r, t));
|
|
6164
6209
|
return n;
|
|
6165
|
-
}(e, ((t, e) => new
|
|
6210
|
+
}(e, ((t, e) => new bt(new vt(e), t._aggregateType, t._internalFieldPath)));
|
|
6166
6211
|
// Run the aggregation and convert the results
|
|
6167
|
-
return
|
|
6168
|
-
const r = new
|
|
6169
|
-
return new
|
|
6212
|
+
return bn(r, t._query, s).then((e => function(t, e, n) {
|
|
6213
|
+
const r = new Kr(t);
|
|
6214
|
+
return new Nn(e, r, n);
|
|
6170
6215
|
}
|
|
6171
6216
|
/**
|
|
6172
6217
|
* Create an AggregateField object that can be used to compute the sum of
|
|
@@ -6176,8 +6221,8 @@ function Hr(t, e, n, ...r) {
|
|
|
6176
6221
|
*/ (n, t, e)));
|
|
6177
6222
|
}
|
|
6178
6223
|
|
|
6179
|
-
function
|
|
6180
|
-
return new
|
|
6224
|
+
function rs(t) {
|
|
6225
|
+
return new Dn("sum", fr("sum", t));
|
|
6181
6226
|
}
|
|
6182
6227
|
|
|
6183
6228
|
/**
|
|
@@ -6185,16 +6230,16 @@ function es(t) {
|
|
|
6185
6230
|
* a specified field over a range of documents in the result set of a query.
|
|
6186
6231
|
* @param field Specifies the field to average across the result set.
|
|
6187
6232
|
* @internal TODO (sum/avg) remove when public
|
|
6188
|
-
*/ function
|
|
6189
|
-
return new
|
|
6233
|
+
*/ function ss(t) {
|
|
6234
|
+
return new Dn("avg", fr("average", t));
|
|
6190
6235
|
}
|
|
6191
6236
|
|
|
6192
6237
|
/**
|
|
6193
6238
|
* Create an AggregateField object that can be used to compute the count of
|
|
6194
6239
|
* documents in the result set of a query.
|
|
6195
6240
|
* @internal TODO (sum/avg) remove when public
|
|
6196
|
-
*/ function
|
|
6197
|
-
return new
|
|
6241
|
+
*/ function is() {
|
|
6242
|
+
return new Dn("count");
|
|
6198
6243
|
}
|
|
6199
6244
|
|
|
6200
6245
|
/**
|
|
@@ -6203,9 +6248,9 @@ function es(t) {
|
|
|
6203
6248
|
* @param left Compare this AggregateField to the `right`.
|
|
6204
6249
|
* @param right Compare this AggregateField to the `left`.
|
|
6205
6250
|
* @internal TODO (sum/avg) remove when public
|
|
6206
|
-
*/ function
|
|
6251
|
+
*/ function os(t, e) {
|
|
6207
6252
|
var n, r;
|
|
6208
|
-
return t instanceof
|
|
6253
|
+
return t instanceof Dn && e instanceof Dn && 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());
|
|
6209
6254
|
}
|
|
6210
6255
|
|
|
6211
6256
|
/**
|
|
@@ -6219,8 +6264,8 @@ function es(t) {
|
|
|
6219
6264
|
*
|
|
6220
6265
|
* @returns `true` if the objects are "equal", as defined above, or `false`
|
|
6221
6266
|
* otherwise.
|
|
6222
|
-
*/ function
|
|
6223
|
-
return
|
|
6267
|
+
*/ function us(t, e) {
|
|
6268
|
+
return Ln(t.query, e.query) && deepEqual(t.data(), e.data());
|
|
6224
6269
|
}
|
|
6225
6270
|
|
|
6226
6271
|
/**
|
|
@@ -6242,15 +6287,15 @@ function es(t) {
|
|
|
6242
6287
|
/**
|
|
6243
6288
|
* Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or
|
|
6244
6289
|
* {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion.
|
|
6245
|
-
*/ function
|
|
6246
|
-
return new
|
|
6290
|
+
*/ function cs() {
|
|
6291
|
+
return new Xn("deleteField");
|
|
6247
6292
|
}
|
|
6248
6293
|
|
|
6249
6294
|
/**
|
|
6250
6295
|
* Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
|
|
6251
6296
|
* include a server-generated timestamp in the written data.
|
|
6252
|
-
*/ function
|
|
6253
|
-
return new
|
|
6297
|
+
*/ function as() {
|
|
6298
|
+
return new er("serverTimestamp");
|
|
6254
6299
|
}
|
|
6255
6300
|
|
|
6256
6301
|
/**
|
|
@@ -6264,10 +6309,10 @@ function es(t) {
|
|
|
6264
6309
|
* @param elements - The elements to union into the array.
|
|
6265
6310
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
6266
6311
|
* `updateDoc()`.
|
|
6267
|
-
*/ function
|
|
6312
|
+
*/ function hs(...t) {
|
|
6268
6313
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
6269
6314
|
// update() since we'd need the Firestore instance to do this.
|
|
6270
|
-
return new
|
|
6315
|
+
return new nr("arrayUnion", t);
|
|
6271
6316
|
}
|
|
6272
6317
|
|
|
6273
6318
|
/**
|
|
@@ -6280,10 +6325,10 @@ function es(t) {
|
|
|
6280
6325
|
* @param elements - The elements to remove from the array.
|
|
6281
6326
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
6282
6327
|
* `updateDoc()`
|
|
6283
|
-
*/ function
|
|
6328
|
+
*/ function ls(...t) {
|
|
6284
6329
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
6285
6330
|
// update() since we'd need the Firestore instance to do this.
|
|
6286
|
-
return new
|
|
6331
|
+
return new rr("arrayRemove", t);
|
|
6287
6332
|
}
|
|
6288
6333
|
|
|
6289
6334
|
/**
|
|
@@ -6304,8 +6349,8 @@ function es(t) {
|
|
|
6304
6349
|
* @param n - The value to increment by.
|
|
6305
6350
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
6306
6351
|
* `updateDoc()`
|
|
6307
|
-
*/ function
|
|
6308
|
-
return new
|
|
6352
|
+
*/ function fs(t) {
|
|
6353
|
+
return new sr("increment", t);
|
|
6309
6354
|
}
|
|
6310
6355
|
|
|
6311
6356
|
/**
|
|
@@ -6331,25 +6376,25 @@ function es(t) {
|
|
|
6331
6376
|
* provides methods for adding writes to the write batch. None of the writes
|
|
6332
6377
|
* will be committed (or visible locally) until {@link WriteBatch.commit} is
|
|
6333
6378
|
* called.
|
|
6334
|
-
*/ class
|
|
6379
|
+
*/ class ds {
|
|
6335
6380
|
/** @hideconstructor */
|
|
6336
6381
|
constructor(t, e) {
|
|
6337
6382
|
this._firestore = t, this._commitHandler = e, this._mutations = [], this._committed = !1,
|
|
6338
|
-
this._dataReader =
|
|
6383
|
+
this._dataReader = Zn(t);
|
|
6339
6384
|
}
|
|
6340
6385
|
set(t, e, n) {
|
|
6341
6386
|
this._verifyNotCommitted();
|
|
6342
|
-
const r =
|
|
6343
|
-
return this._mutations.push(i.toMutation(r._key,
|
|
6387
|
+
const r = ws(t, this._firestore), s = Gr(r.converter, e, n), i = Jn(this._dataReader, "WriteBatch.set", r._key, s, null !== r.converter, n);
|
|
6388
|
+
return this._mutations.push(i.toMutation(r._key, Ce.none())), this;
|
|
6344
6389
|
}
|
|
6345
6390
|
update(t, e, n, ...r) {
|
|
6346
6391
|
this._verifyNotCommitted();
|
|
6347
|
-
const s =
|
|
6392
|
+
const s = ws(t, this._firestore);
|
|
6348
6393
|
// For Compat types, we have to "extract" the underlying types before
|
|
6349
6394
|
// performing validation.
|
|
6350
6395
|
let i;
|
|
6351
|
-
return i = "string" == typeof (e = getModularInstance(e)) || e instanceof
|
|
6352
|
-
this._mutations.push(i.toMutation(s._key,
|
|
6396
|
+
return i = "string" == typeof (e = getModularInstance(e)) || e instanceof Un ? or(this._dataReader, "WriteBatch.update", s._key, e, n, r) : ir(this._dataReader, "WriteBatch.update", s._key, e),
|
|
6397
|
+
this._mutations.push(i.toMutation(s._key, Ce.exists(!0))), this;
|
|
6353
6398
|
}
|
|
6354
6399
|
/**
|
|
6355
6400
|
* Deletes the document referred to by the provided {@link DocumentReference}.
|
|
@@ -6358,8 +6403,8 @@ function es(t) {
|
|
|
6358
6403
|
* @returns This `WriteBatch` instance. Used for chaining method calls.
|
|
6359
6404
|
*/ delete(t) {
|
|
6360
6405
|
this._verifyNotCommitted();
|
|
6361
|
-
const e =
|
|
6362
|
-
return this._mutations = this._mutations.concat(new
|
|
6406
|
+
const e = ws(t, this._firestore);
|
|
6407
|
+
return this._mutations = this._mutations.concat(new je(e._key, Ce.none())), this;
|
|
6363
6408
|
}
|
|
6364
6409
|
/**
|
|
6365
6410
|
* Commits all of the writes in this write batch as a single atomic unit.
|
|
@@ -6380,7 +6425,7 @@ function es(t) {
|
|
|
6380
6425
|
}
|
|
6381
6426
|
}
|
|
6382
6427
|
|
|
6383
|
-
function
|
|
6428
|
+
function ws(t, e) {
|
|
6384
6429
|
if ((t = getModularInstance(t)).firestore !== e) throw new U(P, "Provided document reference is from a different Firestore instance.");
|
|
6385
6430
|
return t;
|
|
6386
6431
|
}
|
|
@@ -6397,9 +6442,9 @@ function fs(t, e) {
|
|
|
6397
6442
|
*
|
|
6398
6443
|
* @returns A `WriteBatch` that can be used to atomically execute multiple
|
|
6399
6444
|
* writes.
|
|
6400
|
-
*/ function
|
|
6401
|
-
const e =
|
|
6402
|
-
return new
|
|
6445
|
+
*/ function ms(t) {
|
|
6446
|
+
const e = An(t = ct(t, Tn));
|
|
6447
|
+
return new ds(t, (t => gn(e, t)));
|
|
6403
6448
|
}
|
|
6404
6449
|
|
|
6405
6450
|
/**
|
|
@@ -6421,7 +6466,7 @@ function fs(t, e) {
|
|
|
6421
6466
|
/**
|
|
6422
6467
|
* Internal transaction object responsible for accumulating the mutations to
|
|
6423
6468
|
* perform and the base versions for any documents read.
|
|
6424
|
-
*/ class
|
|
6469
|
+
*/ class ps {
|
|
6425
6470
|
constructor(t) {
|
|
6426
6471
|
this.datastore = t,
|
|
6427
6472
|
// The version of each document that was read during this transaction.
|
|
@@ -6441,7 +6486,7 @@ function fs(t, e) {
|
|
|
6441
6486
|
}
|
|
6442
6487
|
async lookup(t) {
|
|
6443
6488
|
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new U(P, "Firestore transactions require all reads to be executed before all writes.");
|
|
6444
|
-
const e = await
|
|
6489
|
+
const e = await _n(this.datastore, t);
|
|
6445
6490
|
return e.forEach((t => this.recordVersion(t))), e;
|
|
6446
6491
|
}
|
|
6447
6492
|
set(t, e) {
|
|
@@ -6456,7 +6501,7 @@ function fs(t, e) {
|
|
|
6456
6501
|
this.writtenDocs.add(t.toString());
|
|
6457
6502
|
}
|
|
6458
6503
|
delete(t) {
|
|
6459
|
-
this.write(new
|
|
6504
|
+
this.write(new je(t, this.precondition(t))), this.writtenDocs.add(t.toString());
|
|
6460
6505
|
}
|
|
6461
6506
|
async commit() {
|
|
6462
6507
|
if (this.ensureCommitNotCalled(), this.lastWriteError) throw this.lastWriteError;
|
|
@@ -6469,15 +6514,15 @@ function fs(t, e) {
|
|
|
6469
6514
|
// a `verify` operation.
|
|
6470
6515
|
t.forEach(((t, e) => {
|
|
6471
6516
|
const n = rt.fromPath(e);
|
|
6472
|
-
this.mutations.push(new
|
|
6473
|
-
})), await
|
|
6517
|
+
this.mutations.push(new Be(n, this.precondition(n)));
|
|
6518
|
+
})), await gn(this.datastore, this.mutations), this.committed = !0;
|
|
6474
6519
|
}
|
|
6475
6520
|
recordVersion(t) {
|
|
6476
6521
|
let e;
|
|
6477
6522
|
if (t.isFoundDocument()) e = t.version; else {
|
|
6478
6523
|
if (!t.isNoDocument()) throw b();
|
|
6479
6524
|
// Represent a deleted doc using SnapshotVersion.min().
|
|
6480
|
-
e =
|
|
6525
|
+
e = fe.min();
|
|
6481
6526
|
}
|
|
6482
6527
|
const n = this.readVersions.get(t.key.toString());
|
|
6483
6528
|
if (n) {
|
|
@@ -6491,7 +6536,7 @@ function fs(t, e) {
|
|
|
6491
6536
|
* as a precondition, or no precondition if it was not read.
|
|
6492
6537
|
*/ precondition(t) {
|
|
6493
6538
|
const e = this.readVersions.get(t.toString());
|
|
6494
|
-
return !this.writtenDocs.has(t.toString()) && e ? e.isEqual(
|
|
6539
|
+
return !this.writtenDocs.has(t.toString()) && e ? e.isEqual(fe.min()) ? Ce.exists(!1) : Ce.updateTime(e) : Ce.none();
|
|
6495
6540
|
}
|
|
6496
6541
|
/**
|
|
6497
6542
|
* Returns the precondition for a document if the operation is an update.
|
|
@@ -6500,7 +6545,7 @@ function fs(t, e) {
|
|
|
6500
6545
|
// The first time a document is written, we want to take into account the
|
|
6501
6546
|
// read time and existence
|
|
6502
6547
|
if (!this.writtenDocs.has(t.toString()) && e) {
|
|
6503
|
-
if (e.isEqual(
|
|
6548
|
+
if (e.isEqual(fe.min()))
|
|
6504
6549
|
// The document doesn't exist, so fail the transaction.
|
|
6505
6550
|
// This has to be validated locally because you can't send a
|
|
6506
6551
|
// precondition that a document does not exist without changing the
|
|
@@ -6512,11 +6557,11 @@ function fs(t, e) {
|
|
|
6512
6557
|
// transaction.
|
|
6513
6558
|
throw new U(P, "Can't update a document that doesn't exist.");
|
|
6514
6559
|
// Document exists, base precondition on document update time.
|
|
6515
|
-
return
|
|
6560
|
+
return Ce.updateTime(e);
|
|
6516
6561
|
}
|
|
6517
6562
|
// Document was not read, so we just use the preconditions for a blind
|
|
6518
6563
|
// update.
|
|
6519
|
-
return
|
|
6564
|
+
return Ce.exists(!0);
|
|
6520
6565
|
}
|
|
6521
6566
|
write(t) {
|
|
6522
6567
|
this.ensureCommitNotCalled(), this.mutations.push(t);
|
|
@@ -6539,7 +6584,7 @@ function fs(t, e) {
|
|
|
6539
6584
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
6540
6585
|
* See the License for the specific language governing permissions and
|
|
6541
6586
|
* limitations under the License.
|
|
6542
|
-
*/ const
|
|
6587
|
+
*/ const ys = {
|
|
6543
6588
|
maxAttempts: 5
|
|
6544
6589
|
};
|
|
6545
6590
|
|
|
@@ -6563,17 +6608,17 @@ function fs(t, e) {
|
|
|
6563
6608
|
* TransactionRunner encapsulates the logic needed to run and retry transactions
|
|
6564
6609
|
* with backoff.
|
|
6565
6610
|
*/
|
|
6566
|
-
class
|
|
6611
|
+
class gs {
|
|
6567
6612
|
constructor(t, e, n, r, s) {
|
|
6568
6613
|
this.asyncQueue = t, this.datastore = e, this.options = n, this.updateFunction = r,
|
|
6569
|
-
this.deferred = s, this._t = n.maxAttempts, this.vt = new
|
|
6614
|
+
this.deferred = s, this._t = n.maxAttempts, this.vt = new pn(this.asyncQueue, "transaction_retry" /* TimerId.TransactionRetry */);
|
|
6570
6615
|
}
|
|
6571
6616
|
/** Runs the transaction and sets the result on deferred. */ run() {
|
|
6572
6617
|
this._t -= 1, this.bt();
|
|
6573
6618
|
}
|
|
6574
6619
|
bt() {
|
|
6575
6620
|
this.vt.J((async () => {
|
|
6576
|
-
const t = new
|
|
6621
|
+
const t = new ps(this.datastore), e = this.Et(t);
|
|
6577
6622
|
e && e.then((e => {
|
|
6578
6623
|
this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
|
|
6579
6624
|
this.deferred.resolve(e);
|
|
@@ -6588,7 +6633,7 @@ class ps {
|
|
|
6588
6633
|
Et(t) {
|
|
6589
6634
|
try {
|
|
6590
6635
|
const e = this.updateFunction(t);
|
|
6591
|
-
return !
|
|
6636
|
+
return !ft(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
|
|
6592
6637
|
null);
|
|
6593
6638
|
} catch (t) {
|
|
6594
6639
|
// Do not retry errors thrown by user provided updateFunction.
|
|
@@ -6663,7 +6708,7 @@ class ps {
|
|
|
6663
6708
|
* See the License for the specific language governing permissions and
|
|
6664
6709
|
* limitations under the License.
|
|
6665
6710
|
*/
|
|
6666
|
-
/** The Platform's 'document' implementation or null if not available. */ function
|
|
6711
|
+
/** The Platform's 'document' implementation or null if not available. */ function _s() {
|
|
6667
6712
|
// `document` is not always available, e.g. in ReactNative and WebWorkers.
|
|
6668
6713
|
// eslint-disable-next-line no-restricted-globals
|
|
6669
6714
|
return "undefined" != typeof document ? document : null;
|
|
@@ -6695,7 +6740,7 @@ class ps {
|
|
|
6695
6740
|
* Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type
|
|
6696
6741
|
* in newer versions of TypeScript defines `finally`, which is not available in
|
|
6697
6742
|
* IE.
|
|
6698
|
-
*/ class
|
|
6743
|
+
*/ class vs {
|
|
6699
6744
|
constructor(t, e, n, r, s) {
|
|
6700
6745
|
this.asyncQueue = t, this.timerId = e, this.targetTimeMs = n, this.op = r, this.removalCallback = s,
|
|
6701
6746
|
this.deferred = new j, this.then = this.deferred.promise.then.bind(this.deferred.promise),
|
|
@@ -6718,7 +6763,7 @@ class ps {
|
|
|
6718
6763
|
* PORTING NOTE: This exists to prevent making removeDelayedOperation() and
|
|
6719
6764
|
* the DelayedOperation class public.
|
|
6720
6765
|
*/ static createAndSchedule(t, e, n, r, s) {
|
|
6721
|
-
const i = Date.now() + n, o = new
|
|
6766
|
+
const i = Date.now() + n, o = new vs(t, e, i, r, s);
|
|
6722
6767
|
return o.start(n), o;
|
|
6723
6768
|
}
|
|
6724
6769
|
/**
|
|
@@ -6767,7 +6812,7 @@ class ps {
|
|
|
6767
6812
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
6768
6813
|
* See the License for the specific language governing permissions and
|
|
6769
6814
|
* limitations under the License.
|
|
6770
|
-
*/ class
|
|
6815
|
+
*/ class bs {
|
|
6771
6816
|
constructor() {
|
|
6772
6817
|
// The last promise in the queue.
|
|
6773
6818
|
this.Tt = Promise.resolve(),
|
|
@@ -6790,15 +6835,15 @@ class ps {
|
|
|
6790
6835
|
// List of TimerIds to fast-forward delays for.
|
|
6791
6836
|
this.Ft = [],
|
|
6792
6837
|
// Backoff timer used to schedule retries for retryable operations
|
|
6793
|
-
this.vt = new
|
|
6838
|
+
this.vt = new pn(this, "async_queue_retry" /* TimerId.AsyncQueueRetry */),
|
|
6794
6839
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
6795
6840
|
// operations. Meant to speed up recovery when we regain file system access
|
|
6796
6841
|
// after page comes into foreground.
|
|
6797
6842
|
this.xt = () => {
|
|
6798
|
-
const t =
|
|
6843
|
+
const t = _s();
|
|
6799
6844
|
t && y("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.vt.tt();
|
|
6800
6845
|
};
|
|
6801
|
-
const t =
|
|
6846
|
+
const t = _s();
|
|
6802
6847
|
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.xt);
|
|
6803
6848
|
}
|
|
6804
6849
|
get isShuttingDown() {
|
|
@@ -6819,7 +6864,7 @@ class ps {
|
|
|
6819
6864
|
enterRestrictedMode(t) {
|
|
6820
6865
|
if (!this.Pt) {
|
|
6821
6866
|
this.Pt = !0, this.Nt = t || !1;
|
|
6822
|
-
const e =
|
|
6867
|
+
const e = _s();
|
|
6823
6868
|
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.xt);
|
|
6824
6869
|
}
|
|
6825
6870
|
}
|
|
@@ -6951,7 +6996,7 @@ class ps {
|
|
|
6951
6996
|
this.St(),
|
|
6952
6997
|
// Fast-forward delays for timerIds that have been overriden.
|
|
6953
6998
|
this.Ft.indexOf(t) > -1 && (e = 0);
|
|
6954
|
-
const r =
|
|
6999
|
+
const r = vs.createAndSchedule(this, t, e, n, (t => this.kt(t)));
|
|
6955
7000
|
return this.Vt.push(r), r;
|
|
6956
7001
|
}
|
|
6957
7002
|
St() {
|
|
@@ -7005,10 +7050,10 @@ class ps {
|
|
|
7005
7050
|
}
|
|
7006
7051
|
}
|
|
7007
7052
|
|
|
7008
|
-
class
|
|
7053
|
+
class Es {
|
|
7009
7054
|
/** @hideconstructor */
|
|
7010
7055
|
constructor(t, e) {
|
|
7011
|
-
this._firestore = t, this._transaction = e, this._dataReader =
|
|
7056
|
+
this._firestore = t, this._transaction = e, this._dataReader = Zn(t);
|
|
7012
7057
|
}
|
|
7013
7058
|
/**
|
|
7014
7059
|
* Reads the document referenced by the provided {@link DocumentReference}.
|
|
@@ -7016,25 +7061,25 @@ class vs {
|
|
|
7016
7061
|
* @param documentRef - A reference to the document to be read.
|
|
7017
7062
|
* @returns A `DocumentSnapshot` with the read data.
|
|
7018
7063
|
*/ get(t) {
|
|
7019
|
-
const e =
|
|
7064
|
+
const e = ws(t, this._firestore), n = new Kr(this._firestore);
|
|
7020
7065
|
return this._transaction.lookup([ e._key ]).then((t => {
|
|
7021
7066
|
if (!t || 1 !== t.length) return b();
|
|
7022
7067
|
const r = t[0];
|
|
7023
|
-
if (r.isFoundDocument()) return new
|
|
7024
|
-
if (r.isNoDocument()) return new
|
|
7068
|
+
if (r.isFoundDocument()) return new yr(this._firestore, n, r.key, r, e.converter);
|
|
7069
|
+
if (r.isNoDocument()) return new yr(this._firestore, n, e._key, null, e.converter);
|
|
7025
7070
|
throw b();
|
|
7026
7071
|
}));
|
|
7027
7072
|
}
|
|
7028
7073
|
set(t, e, n) {
|
|
7029
|
-
const r =
|
|
7074
|
+
const r = ws(t, this._firestore), s = Gr(r.converter, e, n), i = Jn(this._dataReader, "Transaction.set", r._key, s, null !== r.converter, n);
|
|
7030
7075
|
return this._transaction.set(r._key, i), this;
|
|
7031
7076
|
}
|
|
7032
7077
|
update(t, e, n, ...r) {
|
|
7033
|
-
const s =
|
|
7078
|
+
const s = ws(t, this._firestore);
|
|
7034
7079
|
// For Compat types, we have to "extract" the underlying types before
|
|
7035
7080
|
// performing validation.
|
|
7036
7081
|
let i;
|
|
7037
|
-
return i = "string" == typeof (e = getModularInstance(e)) || e instanceof
|
|
7082
|
+
return i = "string" == typeof (e = getModularInstance(e)) || e instanceof Un ? or(this._dataReader, "Transaction.update", s._key, e, n, r) : ir(this._dataReader, "Transaction.update", s._key, e),
|
|
7038
7083
|
this._transaction.update(s._key, i), this;
|
|
7039
7084
|
}
|
|
7040
7085
|
/**
|
|
@@ -7043,7 +7088,7 @@ class vs {
|
|
|
7043
7088
|
* @param documentRef - A reference to the document to be deleted.
|
|
7044
7089
|
* @returns This `Transaction` instance. Used for chaining method calls.
|
|
7045
7090
|
*/ delete(t) {
|
|
7046
|
-
const e =
|
|
7091
|
+
const e = ws(t, this._firestore);
|
|
7047
7092
|
return this._transaction.delete(e._key), this;
|
|
7048
7093
|
}
|
|
7049
7094
|
}
|
|
@@ -7066,13 +7111,13 @@ class vs {
|
|
|
7066
7111
|
* (the `updateFunction` returned a failed promise), the promise returned by the
|
|
7067
7112
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
7068
7113
|
* rejected promise with the corresponding failure error is returned.
|
|
7069
|
-
*/ function
|
|
7070
|
-
const r =
|
|
7114
|
+
*/ function As(t, e, n) {
|
|
7115
|
+
const r = An(t = ct(t, Tn)), s = Object.assign(Object.assign({}, ys), n);
|
|
7071
7116
|
!function(t) {
|
|
7072
7117
|
if (t.maxAttempts < 1) throw new U(P, "Max attempts must be at least 1");
|
|
7073
7118
|
}(s);
|
|
7074
7119
|
const i = new j;
|
|
7075
|
-
return new
|
|
7120
|
+
return new gs(new bs, r, s, (n => e(new Es(t, n))), i).run(), i.promise;
|
|
7076
7121
|
}
|
|
7077
7122
|
|
|
7078
7123
|
/**
|
|
@@ -7085,7 +7130,7 @@ class vs {
|
|
|
7085
7130
|
*/ !function(t) {
|
|
7086
7131
|
w = t;
|
|
7087
7132
|
}(`${SDK_VERSION}_lite`), _registerComponent(new Component("firestore/lite", ((t, {instanceIdentifier: e, options: n}) => {
|
|
7088
|
-
const r = t.getProvider("app").getImmediate(), s = new
|
|
7133
|
+
const r = t.getProvider("app").getImmediate(), s = new Tn(new W(t.getProvider("auth-internal")), new H(t.getProvider("app-check-internal")), function(t, e) {
|
|
7089
7134
|
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new U(P, '"projectId" not provided in firebase.initializeApp.');
|
|
7090
7135
|
return new J(t.options.projectId, e);
|
|
7091
7136
|
}
|
|
@@ -7108,7 +7153,7 @@ class vs {
|
|
|
7108
7153
|
return n && s._setSettings(n), s;
|
|
7109
7154
|
}), "PUBLIC").setMultipleInstances(!0)),
|
|
7110
7155
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
7111
|
-
registerVersion("firestore-lite", "3.
|
|
7156
|
+
registerVersion("firestore-lite", "3.9.0-20230314181055", ""), registerVersion("firestore-lite", "3.9.0-20230314181055", "esm2017");
|
|
7112
7157
|
|
|
7113
|
-
export {
|
|
7158
|
+
export { Dn as AggregateField, Nn as AggregateQuerySnapshot, Mn as Bytes, Sn as CollectionReference, Fn as DocumentReference, yr as DocumentSnapshot, Un as FieldPath, Bn as FieldValue, Tn as Firestore, U as FirestoreError, zn as GeoPoint, xn as Query, Pr as QueryCompositeFilterConstraint, Ar as QueryConstraint, gr as QueryDocumentSnapshot, Cr as QueryEndAtConstraint, Tr as QueryFieldFilterConstraint, Fr as QueryLimitConstraint, Dr as QueryOrderByConstraint, _r as QuerySnapshot, qr as QueryStartAtConstraint, St as Timestamp, Es as Transaction, ds as WriteBatch, ts as addDoc, os as aggregateFieldEqual, us as aggregateQuerySnapshotEqual, $r as and, ls as arrayRemove, hs as arrayUnion, ss as average, qn as collection, On as collectionGroup, Vn as connectFirestoreEmulator, is as count, Xr as deleteDoc, cs as deleteField, kn as doc, jn as documentId, Mr as endAt, Lr as endBefore, ns as getAggregate, es as getCount, Yr as getDoc, Hr as getDocs, Pn as getFirestore, fs as increment, Rn as initializeFirestore, xr as limit, Sr as limitToLast, Vr as or, Nr as orderBy, Ir as query, Ln as queryEqual, Cn as refEqual, As as runTransaction, as as serverTimestamp, Zr as setDoc, p as setLogLevel, vr as snapshotEqual, kr as startAfter, Or as startAt, rs as sum, $n as terminate, Jr as updateDoc, Rr as where, ms as writeBatch };
|
|
7114
7159
|
//# sourceMappingURL=index.browser.esm2017.js.map
|