@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
|
@@ -66,7 +66,7 @@ m.MOCK_USER = new m("mock-user");
|
|
|
66
66
|
* See the License for the specific language governing permissions and
|
|
67
67
|
* limitations under the License.
|
|
68
68
|
*/
|
|
69
|
-
let p = "9.
|
|
69
|
+
let p = "9.18.0-20230314181055";
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* @license
|
|
@@ -803,6 +803,54 @@ function lt(t, e) {
|
|
|
803
803
|
if (e <= 0) throw new B($, `Function ${t}() requires a positive number, but it was: ${e}.`);
|
|
804
804
|
}
|
|
805
805
|
|
|
806
|
+
/**
|
|
807
|
+
* @license
|
|
808
|
+
* Copyright 2023 Google LLC
|
|
809
|
+
*
|
|
810
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
811
|
+
* you may not use this file except in compliance with the License.
|
|
812
|
+
* You may obtain a copy of the License at
|
|
813
|
+
*
|
|
814
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
815
|
+
*
|
|
816
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
817
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
818
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
819
|
+
* See the License for the specific language governing permissions and
|
|
820
|
+
* limitations under the License.
|
|
821
|
+
*/
|
|
822
|
+
/**
|
|
823
|
+
* The value returned from the most recent invocation of
|
|
824
|
+
* `generateUniqueDebugId()`, or null if it has never been invoked.
|
|
825
|
+
*/ let ft = null;
|
|
826
|
+
|
|
827
|
+
/**
|
|
828
|
+
* Generates and returns an initial value for `lastUniqueDebugId`.
|
|
829
|
+
*
|
|
830
|
+
* The returned value is randomly selected from a range of integers that are
|
|
831
|
+
* represented as 8 hexadecimal digits. This means that (within reason) any
|
|
832
|
+
* numbers generated by incrementing the returned number by 1 will also be
|
|
833
|
+
* represented by 8 hexadecimal digits. This leads to all "IDs" having the same
|
|
834
|
+
* length when converted to a hexadecimal string, making reading logs containing
|
|
835
|
+
* these IDs easier to follow. And since the return value is randomly selected
|
|
836
|
+
* it will help to differentiate between logs from different executions.
|
|
837
|
+
*/
|
|
838
|
+
/**
|
|
839
|
+
* Generates and returns a unique ID as a hexadecimal string.
|
|
840
|
+
*
|
|
841
|
+
* The returned ID is intended to be used in debug logging messages to help
|
|
842
|
+
* correlate log messages that may be spatially separated in the logs, but
|
|
843
|
+
* logically related. For example, a network connection could include the same
|
|
844
|
+
* "debug ID" string in all of its log messages to help trace a specific
|
|
845
|
+
* connection over time.
|
|
846
|
+
*
|
|
847
|
+
* @return the 10-character generated ID (e.g. "0xa1b2c3d4").
|
|
848
|
+
*/
|
|
849
|
+
function dt() {
|
|
850
|
+
return null === ft ? ft = 268435456 + Math.round(2147483648 * Math.random()) : ft++,
|
|
851
|
+
"0x" + ft.toString(16);
|
|
852
|
+
}
|
|
853
|
+
|
|
806
854
|
/**
|
|
807
855
|
* @license
|
|
808
856
|
* Copyright 2017 Google LLC
|
|
@@ -821,11 +869,11 @@ function lt(t, e) {
|
|
|
821
869
|
*/
|
|
822
870
|
/**
|
|
823
871
|
* Returns whether a variable is either undefined or null.
|
|
824
|
-
*/ function
|
|
872
|
+
*/ function wt(t) {
|
|
825
873
|
return null == t;
|
|
826
874
|
}
|
|
827
875
|
|
|
828
|
-
/** Returns whether the value represents -0. */ function
|
|
876
|
+
/** Returns whether the value represents -0. */ function mt(t) {
|
|
829
877
|
// Detect if the value is -0.0. Based on polyfill from
|
|
830
878
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
831
879
|
return 0 === t && 1 / t == -1 / 0;
|
|
@@ -851,7 +899,7 @@ function lt(t, e) {
|
|
|
851
899
|
* See the License for the specific language governing permissions and
|
|
852
900
|
* limitations under the License.
|
|
853
901
|
*/
|
|
854
|
-
const
|
|
902
|
+
const pt = {
|
|
855
903
|
BatchGetDocuments: "batchGet",
|
|
856
904
|
Commit: "commit",
|
|
857
905
|
RunQuery: "runQuery",
|
|
@@ -889,7 +937,7 @@ const wt = {
|
|
|
889
937
|
* are used for reverse lookups from the webchannel stream. Do NOT change the
|
|
890
938
|
* names of these identifiers or change this into a const enum.
|
|
891
939
|
*/
|
|
892
|
-
var
|
|
940
|
+
var yt, gt;
|
|
893
941
|
|
|
894
942
|
/**
|
|
895
943
|
* Converts an HTTP Status Code to the equivalent error code.
|
|
@@ -898,7 +946,7 @@ var mt, pt;
|
|
|
898
946
|
* @returns The equivalent Code. Unknown status codes are mapped to
|
|
899
947
|
* Code.UNKNOWN.
|
|
900
948
|
*/
|
|
901
|
-
function
|
|
949
|
+
function _t(t) {
|
|
902
950
|
if (void 0 === t) return v("RPC_ERROR", "HTTP error has no status"), V;
|
|
903
951
|
// The canonical error codes for Google APIs [1] specify mapping onto HTTP
|
|
904
952
|
// status codes but the mapping is not bijective. In each case of ambiguity
|
|
@@ -991,16 +1039,16 @@ function yt(t) {
|
|
|
991
1039
|
/**
|
|
992
1040
|
* A Rest-based connection that relies on the native HTTP stack
|
|
993
1041
|
* (e.g. `fetch` or a polyfill).
|
|
994
|
-
*/ (
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1042
|
+
*/ (gt = yt || (yt = {}))[gt.OK = 0] = "OK", gt[gt.CANCELLED = 1] = "CANCELLED",
|
|
1043
|
+
gt[gt.UNKNOWN = 2] = "UNKNOWN", gt[gt.INVALID_ARGUMENT = 3] = "INVALID_ARGUMENT",
|
|
1044
|
+
gt[gt.DEADLINE_EXCEEDED = 4] = "DEADLINE_EXCEEDED", gt[gt.NOT_FOUND = 5] = "NOT_FOUND",
|
|
1045
|
+
gt[gt.ALREADY_EXISTS = 6] = "ALREADY_EXISTS", gt[gt.PERMISSION_DENIED = 7] = "PERMISSION_DENIED",
|
|
1046
|
+
gt[gt.UNAUTHENTICATED = 16] = "UNAUTHENTICATED", gt[gt.RESOURCE_EXHAUSTED = 8] = "RESOURCE_EXHAUSTED",
|
|
1047
|
+
gt[gt.FAILED_PRECONDITION = 9] = "FAILED_PRECONDITION", gt[gt.ABORTED = 10] = "ABORTED",
|
|
1048
|
+
gt[gt.OUT_OF_RANGE = 11] = "OUT_OF_RANGE", gt[gt.UNIMPLEMENTED = 12] = "UNIMPLEMENTED",
|
|
1049
|
+
gt[gt.INTERNAL = 13] = "INTERNAL", gt[gt.UNAVAILABLE = 14] = "UNAVAILABLE", gt[gt.DATA_LOSS = 15] = "DATA_LOSS";
|
|
1002
1050
|
|
|
1003
|
-
class
|
|
1051
|
+
class vt extends
|
|
1004
1052
|
/**
|
|
1005
1053
|
* Base class for all Rest-based connections to the backend (WebChannel and
|
|
1006
1054
|
* HTTP).
|
|
@@ -1017,12 +1065,12 @@ class {
|
|
|
1017
1065
|
return !1;
|
|
1018
1066
|
}
|
|
1019
1067
|
A(t, e, n, r, s) {
|
|
1020
|
-
const i = this.I(t, e);
|
|
1021
|
-
_("RestConnection",
|
|
1022
|
-
const
|
|
1023
|
-
return this.T(
|
|
1024
|
-
|
|
1025
|
-
throw b("RestConnection",
|
|
1068
|
+
const i = dt(), o = this.I(t, e);
|
|
1069
|
+
_("RestConnection", `Sending RPC '${t}' ${i}:`, o, n);
|
|
1070
|
+
const u = {};
|
|
1071
|
+
return this.T(u, r, s), this.R(t, o, u, n).then((e => (_("RestConnection", `Received RPC '${t}' ${i}: `, e),
|
|
1072
|
+
e)), (e => {
|
|
1073
|
+
throw b("RestConnection", `RPC '${t}' ${i} failed with error: `, e, "url: ", o, "request:", n),
|
|
1026
1074
|
e;
|
|
1027
1075
|
}));
|
|
1028
1076
|
}
|
|
@@ -1044,7 +1092,7 @@ class {
|
|
|
1044
1092
|
e && e.headers.forEach(((e, n) => t[n] = e)), n && n.headers.forEach(((e, n) => t[n] = e));
|
|
1045
1093
|
}
|
|
1046
1094
|
I(t, e) {
|
|
1047
|
-
const n =
|
|
1095
|
+
const n = pt[t];
|
|
1048
1096
|
return `${this.p}/v1/${e}:${n}`;
|
|
1049
1097
|
}
|
|
1050
1098
|
} {
|
|
@@ -1070,13 +1118,13 @@ class {
|
|
|
1070
1118
|
});
|
|
1071
1119
|
} catch (t) {
|
|
1072
1120
|
const e = t;
|
|
1073
|
-
throw new B(
|
|
1121
|
+
throw new B(_t(e.status), "Request failed with error: " + e.statusText);
|
|
1074
1122
|
}
|
|
1075
1123
|
if (!o.ok) {
|
|
1076
1124
|
let t = await o.json();
|
|
1077
1125
|
Array.isArray(t) && (t = t[0]);
|
|
1078
1126
|
const e = null === (s = null == t ? void 0 : t.error) || void 0 === s ? void 0 : s.message;
|
|
1079
|
-
throw new B(
|
|
1127
|
+
throw new B(_t(o.status), `Request failed with error: ${null != e ? e : o.statusText}`);
|
|
1080
1128
|
}
|
|
1081
1129
|
return o.json();
|
|
1082
1130
|
}
|
|
@@ -1115,12 +1163,12 @@ class {
|
|
|
1115
1163
|
* See the License for the specific language governing permissions and
|
|
1116
1164
|
* limitations under the License.
|
|
1117
1165
|
*/
|
|
1118
|
-
const
|
|
1166
|
+
const bt = /^[_a-zA-Z][_a-zA-Z0-9]*(?:\.[_a-zA-Z][_a-zA-Z0-9]*)*$/;
|
|
1119
1167
|
|
|
1120
1168
|
/**
|
|
1121
1169
|
* An alias for aggregation results.
|
|
1122
1170
|
* @internal
|
|
1123
|
-
*/ class
|
|
1171
|
+
*/ class Et {
|
|
1124
1172
|
/**
|
|
1125
1173
|
* @internal
|
|
1126
1174
|
* @param alias Un-escaped alias representation
|
|
@@ -1131,13 +1179,13 @@ const _t = /^[_a-zA-Z][_a-zA-Z0-9]*(?:\.[_a-zA-Z][_a-zA-Z0-9]*)*$/;
|
|
|
1131
1179
|
/**
|
|
1132
1180
|
* Returns true if the string could be used as an alias.
|
|
1133
1181
|
*/ static N(t) {
|
|
1134
|
-
return
|
|
1182
|
+
return bt.test(t);
|
|
1135
1183
|
}
|
|
1136
1184
|
/**
|
|
1137
1185
|
* Return an escaped and quoted string representation of the alias.
|
|
1138
1186
|
*/ canonicalString() {
|
|
1139
1187
|
let t = this.alias.replace(/\\/g, "\\\\").replace(/`/g, "\\`");
|
|
1140
|
-
return
|
|
1188
|
+
return Et.N(t) || (t = "`" + t + "`"), t;
|
|
1141
1189
|
}
|
|
1142
1190
|
}
|
|
1143
1191
|
|
|
@@ -1159,7 +1207,7 @@ const _t = /^[_a-zA-Z][_a-zA-Z0-9]*(?:\.[_a-zA-Z][_a-zA-Z0-9]*)*$/;
|
|
|
1159
1207
|
*/
|
|
1160
1208
|
/**
|
|
1161
1209
|
* Concrete implementation of the Aggregate type.
|
|
1162
|
-
*/ class
|
|
1210
|
+
*/ class At {
|
|
1163
1211
|
constructor(t, e, n) {
|
|
1164
1212
|
this.alias = t, this.D = e, this.fieldPath = n;
|
|
1165
1213
|
}
|
|
@@ -1185,7 +1233,7 @@ const _t = /^[_a-zA-Z][_a-zA-Z0-9]*(?:\.[_a-zA-Z][_a-zA-Z0-9]*)*$/;
|
|
|
1185
1233
|
* Generates `nBytes` of random bytes.
|
|
1186
1234
|
*
|
|
1187
1235
|
* If `nBytes < 0` , an error will be thrown.
|
|
1188
|
-
*/ function
|
|
1236
|
+
*/ function It(t) {
|
|
1189
1237
|
// Polyfills for IE and WebWorker by using `self` and `msCrypto` when `crypto` is not available.
|
|
1190
1238
|
const e =
|
|
1191
1239
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -1211,14 +1259,14 @@ const _t = /^[_a-zA-Z][_a-zA-Z0-9]*(?:\.[_a-zA-Z][_a-zA-Z0-9]*)*$/;
|
|
|
1211
1259
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1212
1260
|
* See the License for the specific language governing permissions and
|
|
1213
1261
|
* limitations under the License.
|
|
1214
|
-
*/ class
|
|
1262
|
+
*/ class Tt {
|
|
1215
1263
|
static F() {
|
|
1216
1264
|
// Alphanumeric characters
|
|
1217
1265
|
const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", e = Math.floor(256 / t.length) * t.length;
|
|
1218
1266
|
// The largest byte value that is a multiple of `char.length`.
|
|
1219
1267
|
let n = "";
|
|
1220
1268
|
for (;n.length < 20; ) {
|
|
1221
|
-
const r =
|
|
1269
|
+
const r = It(40);
|
|
1222
1270
|
for (let s = 0; s < r.length; ++s)
|
|
1223
1271
|
// Only accept values that are [0, maxMultiple), this ensures they can
|
|
1224
1272
|
// be evenly mapped to indices of `chars` via a modulo operation.
|
|
@@ -1228,11 +1276,11 @@ const _t = /^[_a-zA-Z][_a-zA-Z0-9]*(?:\.[_a-zA-Z][_a-zA-Z0-9]*)*$/;
|
|
|
1228
1276
|
}
|
|
1229
1277
|
}
|
|
1230
1278
|
|
|
1231
|
-
function
|
|
1279
|
+
function Rt(t, e) {
|
|
1232
1280
|
return t < e ? -1 : t > e ? 1 : 0;
|
|
1233
1281
|
}
|
|
1234
1282
|
|
|
1235
|
-
/** Helper to compare arrays using isEqual(). */ function
|
|
1283
|
+
/** Helper to compare arrays using isEqual(). */ function Pt(t, e, n) {
|
|
1236
1284
|
return t.length === e.length && t.every(((t, r) => n(t, e[r])));
|
|
1237
1285
|
}
|
|
1238
1286
|
|
|
@@ -1251,13 +1299,13 @@ function It(t, e) {
|
|
|
1251
1299
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1252
1300
|
* See the License for the specific language governing permissions and
|
|
1253
1301
|
* limitations under the License.
|
|
1254
|
-
*/ function
|
|
1302
|
+
*/ function Vt(t) {
|
|
1255
1303
|
let e = 0;
|
|
1256
1304
|
for (const n in t) Object.prototype.hasOwnProperty.call(t, n) && e++;
|
|
1257
1305
|
return e;
|
|
1258
1306
|
}
|
|
1259
1307
|
|
|
1260
|
-
function
|
|
1308
|
+
function $t(t, e) {
|
|
1261
1309
|
for (const n in t) Object.prototype.hasOwnProperty.call(t, n) && e(n, t[n]);
|
|
1262
1310
|
}
|
|
1263
1311
|
|
|
@@ -1280,7 +1328,7 @@ function Pt(t, e) {
|
|
|
1280
1328
|
/**
|
|
1281
1329
|
* An error encountered while decoding base64 string.
|
|
1282
1330
|
*/
|
|
1283
|
-
class
|
|
1331
|
+
class Nt extends Error {
|
|
1284
1332
|
constructor() {
|
|
1285
1333
|
super(...arguments), this.name = "Base64DecodeError";
|
|
1286
1334
|
}
|
|
@@ -1305,7 +1353,7 @@ class Vt extends Error {
|
|
|
1305
1353
|
// WebSafe uses a different URL-encoding safe alphabet that doesn't match
|
|
1306
1354
|
// the encoding used on the backend.
|
|
1307
1355
|
/** Converts a Base64 encoded string to a binary string. */
|
|
1308
|
-
function
|
|
1356
|
+
function Dt(t) {
|
|
1309
1357
|
try {
|
|
1310
1358
|
return String.fromCharCode.apply(null,
|
|
1311
1359
|
// We use `decodeStringToByteArray()` instead of `decodeString()` since
|
|
@@ -1313,7 +1361,7 @@ function $t(t) {
|
|
|
1313
1361
|
// returned by `atob()`'s Latin1 representation.
|
|
1314
1362
|
a.decodeStringToByteArray(t, false));
|
|
1315
1363
|
} catch (t) {
|
|
1316
|
-
throw t instanceof h ? new
|
|
1364
|
+
throw t instanceof h ? new Nt("Invalid base64 string: " + t) : t;
|
|
1317
1365
|
}
|
|
1318
1366
|
}
|
|
1319
1367
|
|
|
@@ -1343,13 +1391,13 @@ function $t(t) {
|
|
|
1343
1391
|
* before being sent as a proto.
|
|
1344
1392
|
* @internal
|
|
1345
1393
|
*/
|
|
1346
|
-
class
|
|
1394
|
+
class Ft {
|
|
1347
1395
|
constructor(t) {
|
|
1348
1396
|
this.binaryString = t;
|
|
1349
1397
|
}
|
|
1350
1398
|
static fromBase64String(t) {
|
|
1351
|
-
const e =
|
|
1352
|
-
return new
|
|
1399
|
+
const e = Dt(t);
|
|
1400
|
+
return new Ft(e);
|
|
1353
1401
|
}
|
|
1354
1402
|
static fromUint8Array(t) {
|
|
1355
1403
|
// TODO(indexing); Remove the copy of the byte string here as this method
|
|
@@ -1366,7 +1414,7 @@ class Nt {
|
|
|
1366
1414
|
/**
|
|
1367
1415
|
* Helper function to convert a binary string to an Uint8Array.
|
|
1368
1416
|
*/ (t);
|
|
1369
|
-
return new
|
|
1417
|
+
return new Ft(e);
|
|
1370
1418
|
}
|
|
1371
1419
|
[Symbol.iterator]() {
|
|
1372
1420
|
let t = 0;
|
|
@@ -1416,21 +1464,21 @@ class Nt {
|
|
|
1416
1464
|
return 2 * this.binaryString.length;
|
|
1417
1465
|
}
|
|
1418
1466
|
compareTo(t) {
|
|
1419
|
-
return
|
|
1467
|
+
return Rt(this.binaryString, t.binaryString);
|
|
1420
1468
|
}
|
|
1421
1469
|
isEqual(t) {
|
|
1422
1470
|
return this.binaryString === t.binaryString;
|
|
1423
1471
|
}
|
|
1424
1472
|
}
|
|
1425
1473
|
|
|
1426
|
-
|
|
1474
|
+
Ft.EMPTY_BYTE_STRING = new Ft("");
|
|
1427
1475
|
|
|
1428
|
-
const
|
|
1476
|
+
const xt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
1429
1477
|
|
|
1430
1478
|
/**
|
|
1431
1479
|
* Converts the possible Proto values for a timestamp value into a "seconds and
|
|
1432
1480
|
* nanos" representation.
|
|
1433
|
-
*/ function
|
|
1481
|
+
*/ function St(t) {
|
|
1434
1482
|
// The json interface (for the browser) will return an iso timestamp string,
|
|
1435
1483
|
// while the proto js library (for node) will return a
|
|
1436
1484
|
// google.protobuf.Timestamp instance.
|
|
@@ -1439,7 +1487,7 @@ const Dt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1439
1487
|
// (millis), so we do some custom parsing here.
|
|
1440
1488
|
// Parse the nanos right out of the string.
|
|
1441
1489
|
let e = 0;
|
|
1442
|
-
const n =
|
|
1490
|
+
const n = xt.exec(t);
|
|
1443
1491
|
if (I(!!n), n[1]) {
|
|
1444
1492
|
// Pad the fraction out to 9 digits (nanos).
|
|
1445
1493
|
let t = n[1];
|
|
@@ -1453,21 +1501,21 @@ const Dt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1453
1501
|
};
|
|
1454
1502
|
}
|
|
1455
1503
|
return {
|
|
1456
|
-
seconds:
|
|
1457
|
-
nanos:
|
|
1504
|
+
seconds: qt(t.seconds),
|
|
1505
|
+
nanos: qt(t.nanos)
|
|
1458
1506
|
};
|
|
1459
1507
|
}
|
|
1460
1508
|
|
|
1461
1509
|
/**
|
|
1462
1510
|
* Converts the possible Proto types for numbers into a JavaScript number.
|
|
1463
1511
|
* Returns 0 if the value is not numeric.
|
|
1464
|
-
*/ function
|
|
1512
|
+
*/ function qt(t) {
|
|
1465
1513
|
// TODO(bjornick): Handle int64 greater than 53 bits.
|
|
1466
1514
|
return "number" == typeof t ? t : "string" == typeof t ? Number(t) : 0;
|
|
1467
1515
|
}
|
|
1468
1516
|
|
|
1469
|
-
/** Converts the possible Proto types for Blobs into a ByteString. */ function
|
|
1470
|
-
return "string" == typeof t ?
|
|
1517
|
+
/** Converts the possible Proto types for Blobs into a ByteString. */ function Ot(t) {
|
|
1518
|
+
return "string" == typeof t ? Ft.fromBase64String(t) : Ft.fromUint8Array(t);
|
|
1471
1519
|
}
|
|
1472
1520
|
|
|
1473
1521
|
/**
|
|
@@ -1501,7 +1549,7 @@ const Dt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1501
1549
|
* For examples and further specifications, refer to the
|
|
1502
1550
|
* {@link https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto | Timestamp definition}.
|
|
1503
1551
|
*/
|
|
1504
|
-
class
|
|
1552
|
+
class kt {
|
|
1505
1553
|
/**
|
|
1506
1554
|
* Creates a new timestamp.
|
|
1507
1555
|
*
|
|
@@ -1533,7 +1581,7 @@ class qt {
|
|
|
1533
1581
|
*
|
|
1534
1582
|
* @returns a new timestamp representing the current date.
|
|
1535
1583
|
*/ static now() {
|
|
1536
|
-
return
|
|
1584
|
+
return kt.fromMillis(Date.now());
|
|
1537
1585
|
}
|
|
1538
1586
|
/**
|
|
1539
1587
|
* Creates a new timestamp from the given date.
|
|
@@ -1542,7 +1590,7 @@ class qt {
|
|
|
1542
1590
|
* @returns A new `Timestamp` representing the same point in time as the given
|
|
1543
1591
|
* date.
|
|
1544
1592
|
*/ static fromDate(t) {
|
|
1545
|
-
return
|
|
1593
|
+
return kt.fromMillis(t.getTime());
|
|
1546
1594
|
}
|
|
1547
1595
|
/**
|
|
1548
1596
|
* Creates a new timestamp from the given number of milliseconds.
|
|
@@ -1553,7 +1601,7 @@ class qt {
|
|
|
1553
1601
|
* number of milliseconds.
|
|
1554
1602
|
*/ static fromMillis(t) {
|
|
1555
1603
|
const e = Math.floor(t / 1e3), n = Math.floor(1e6 * (t - 1e3 * e));
|
|
1556
|
-
return new
|
|
1604
|
+
return new kt(e, n);
|
|
1557
1605
|
}
|
|
1558
1606
|
/**
|
|
1559
1607
|
* Converts a `Timestamp` to a JavaScript `Date` object. This conversion
|
|
@@ -1575,7 +1623,7 @@ class qt {
|
|
|
1575
1623
|
return 1e3 * this.seconds + this.nanoseconds / 1e6;
|
|
1576
1624
|
}
|
|
1577
1625
|
_compareTo(t) {
|
|
1578
|
-
return this.seconds === t.seconds ?
|
|
1626
|
+
return this.seconds === t.seconds ? Rt(this.nanoseconds, t.nanoseconds) : Rt(this.seconds, t.seconds);
|
|
1579
1627
|
}
|
|
1580
1628
|
/**
|
|
1581
1629
|
* Returns true if this `Timestamp` is equal to the provided one.
|
|
@@ -1645,7 +1693,7 @@ class qt {
|
|
|
1645
1693
|
* FieldValueOptions to value().
|
|
1646
1694
|
* - With respect to other ServerTimestampValues, they sort by their
|
|
1647
1695
|
* localWriteTime.
|
|
1648
|
-
*/ function
|
|
1696
|
+
*/ function Ct(t) {
|
|
1649
1697
|
var e, n;
|
|
1650
1698
|
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);
|
|
1651
1699
|
}
|
|
@@ -1655,16 +1703,16 @@ class qt {
|
|
|
1655
1703
|
*
|
|
1656
1704
|
* Preserving the previous values allows the user to display the last resoled
|
|
1657
1705
|
* value until the backend responds with the timestamp.
|
|
1658
|
-
*/ function
|
|
1706
|
+
*/ function Lt(t) {
|
|
1659
1707
|
const e = t.mapValue.fields.__previous_value__;
|
|
1660
|
-
return
|
|
1708
|
+
return Ct(e) ? Lt(e) : e;
|
|
1661
1709
|
}
|
|
1662
1710
|
|
|
1663
1711
|
/**
|
|
1664
1712
|
* Returns the local time at which this timestamp was first set.
|
|
1665
|
-
*/ function
|
|
1666
|
-
const e =
|
|
1667
|
-
return new
|
|
1713
|
+
*/ function Mt(t) {
|
|
1714
|
+
const e = St(t.mapValue.fields.__local_write_time__.timestampValue);
|
|
1715
|
+
return new kt(e.seconds, e.nanos);
|
|
1668
1716
|
}
|
|
1669
1717
|
|
|
1670
1718
|
/**
|
|
@@ -1682,7 +1730,7 @@ class qt {
|
|
|
1682
1730
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1683
1731
|
* See the License for the specific language governing permissions and
|
|
1684
1732
|
* limitations under the License.
|
|
1685
|
-
*/ const
|
|
1733
|
+
*/ const Ut = {
|
|
1686
1734
|
fields: {
|
|
1687
1735
|
__type__: {
|
|
1688
1736
|
stringValue: "__max__"
|
|
@@ -1691,8 +1739,8 @@ class qt {
|
|
|
1691
1739
|
};
|
|
1692
1740
|
|
|
1693
1741
|
/** Extracts the backend's type order for the provided value. */
|
|
1694
|
-
function
|
|
1695
|
-
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 ?
|
|
1742
|
+
function jt(t) {
|
|
1743
|
+
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 ? Ct(t) ? 4 /* TypeOrder.ServerTimestampValue */ :
|
|
1696
1744
|
/** Returns true if the Value represents the canonical {@link #MAX_VALUE} . */
|
|
1697
1745
|
function(t) {
|
|
1698
1746
|
return "__max__" === (((t.mapValue || {}).fields || {}).__type__ || {}).stringValue;
|
|
@@ -1729,10 +1777,10 @@ function Mt(t) {
|
|
|
1729
1777
|
*/ (t) ? 9007199254740991 /* TypeOrder.MaxValue */ : 10 /* TypeOrder.ObjectValue */ : A();
|
|
1730
1778
|
}
|
|
1731
1779
|
|
|
1732
|
-
/** Tests `left` and `right` for equality based on the backend semantics. */ function
|
|
1780
|
+
/** Tests `left` and `right` for equality based on the backend semantics. */ function Bt(t, e) {
|
|
1733
1781
|
if (t === e) return !0;
|
|
1734
|
-
const n =
|
|
1735
|
-
if (n !==
|
|
1782
|
+
const n = jt(t);
|
|
1783
|
+
if (n !== jt(e)) return !1;
|
|
1736
1784
|
switch (n) {
|
|
1737
1785
|
case 0 /* TypeOrder.NullValue */ :
|
|
1738
1786
|
case 9007199254740991 /* TypeOrder.MaxValue */ :
|
|
@@ -1742,14 +1790,14 @@ function Mt(t) {
|
|
|
1742
1790
|
return t.booleanValue === e.booleanValue;
|
|
1743
1791
|
|
|
1744
1792
|
case 4 /* TypeOrder.ServerTimestampValue */ :
|
|
1745
|
-
return
|
|
1793
|
+
return Mt(t).isEqual(Mt(e));
|
|
1746
1794
|
|
|
1747
1795
|
case 3 /* TypeOrder.TimestampValue */ :
|
|
1748
1796
|
return function(t, e) {
|
|
1749
1797
|
if ("string" == typeof t.timestampValue && "string" == typeof e.timestampValue && t.timestampValue.length === e.timestampValue.length)
|
|
1750
1798
|
// Use string equality for ISO 8601 timestamps
|
|
1751
1799
|
return t.timestampValue === e.timestampValue;
|
|
1752
|
-
const n =
|
|
1800
|
+
const n = St(t.timestampValue), r = St(e.timestampValue);
|
|
1753
1801
|
return n.seconds === r.seconds && n.nanos === r.nanos;
|
|
1754
1802
|
}(t, e);
|
|
1755
1803
|
|
|
@@ -1758,7 +1806,7 @@ function Mt(t) {
|
|
|
1758
1806
|
|
|
1759
1807
|
case 6 /* TypeOrder.BlobValue */ :
|
|
1760
1808
|
return function(t, e) {
|
|
1761
|
-
return
|
|
1809
|
+
return Ot(t.bytesValue).isEqual(Ot(e.bytesValue));
|
|
1762
1810
|
}(t, e);
|
|
1763
1811
|
|
|
1764
1812
|
case 7 /* TypeOrder.RefValue */ :
|
|
@@ -1766,27 +1814,27 @@ function Mt(t) {
|
|
|
1766
1814
|
|
|
1767
1815
|
case 8 /* TypeOrder.GeoPointValue */ :
|
|
1768
1816
|
return function(t, e) {
|
|
1769
|
-
return
|
|
1817
|
+
return qt(t.geoPointValue.latitude) === qt(e.geoPointValue.latitude) && qt(t.geoPointValue.longitude) === qt(e.geoPointValue.longitude);
|
|
1770
1818
|
}(t, e);
|
|
1771
1819
|
|
|
1772
1820
|
case 2 /* TypeOrder.NumberValue */ :
|
|
1773
1821
|
return function(t, e) {
|
|
1774
|
-
if ("integerValue" in t && "integerValue" in e) return
|
|
1822
|
+
if ("integerValue" in t && "integerValue" in e) return qt(t.integerValue) === qt(e.integerValue);
|
|
1775
1823
|
if ("doubleValue" in t && "doubleValue" in e) {
|
|
1776
|
-
const n =
|
|
1777
|
-
return n === r ?
|
|
1824
|
+
const n = qt(t.doubleValue), r = qt(e.doubleValue);
|
|
1825
|
+
return n === r ? mt(n) === mt(r) : isNaN(n) && isNaN(r);
|
|
1778
1826
|
}
|
|
1779
1827
|
return !1;
|
|
1780
1828
|
}(t, e);
|
|
1781
1829
|
|
|
1782
1830
|
case 9 /* TypeOrder.ArrayValue */ :
|
|
1783
|
-
return
|
|
1831
|
+
return Pt(t.arrayValue.values || [], e.arrayValue.values || [], Bt);
|
|
1784
1832
|
|
|
1785
1833
|
case 10 /* TypeOrder.ObjectValue */ :
|
|
1786
1834
|
return function(t, e) {
|
|
1787
1835
|
const n = t.mapValue.fields || {}, r = e.mapValue.fields || {};
|
|
1788
|
-
if (
|
|
1789
|
-
for (const t in n) if (n.hasOwnProperty(t) && (void 0 === r[t] || !
|
|
1836
|
+
if (Vt(n) !== Vt(r)) return !1;
|
|
1837
|
+
for (const t in n) if (n.hasOwnProperty(t) && (void 0 === r[t] || !Bt(n[t], r[t]))) return !1;
|
|
1790
1838
|
return !0;
|
|
1791
1839
|
}
|
|
1792
1840
|
/** Returns true if the ArrayValue contains the specified element. */ (t, e);
|
|
@@ -1796,42 +1844,42 @@ function Mt(t) {
|
|
|
1796
1844
|
}
|
|
1797
1845
|
}
|
|
1798
1846
|
|
|
1799
|
-
function
|
|
1800
|
-
return void 0 !== (t.values || []).find((t =>
|
|
1847
|
+
function zt(t, e) {
|
|
1848
|
+
return void 0 !== (t.values || []).find((t => Bt(t, e)));
|
|
1801
1849
|
}
|
|
1802
1850
|
|
|
1803
|
-
function
|
|
1851
|
+
function Qt(t, e) {
|
|
1804
1852
|
if (t === e) return 0;
|
|
1805
|
-
const n =
|
|
1806
|
-
if (n !== r) return
|
|
1853
|
+
const n = jt(t), r = jt(e);
|
|
1854
|
+
if (n !== r) return Rt(n, r);
|
|
1807
1855
|
switch (n) {
|
|
1808
1856
|
case 0 /* TypeOrder.NullValue */ :
|
|
1809
1857
|
case 9007199254740991 /* TypeOrder.MaxValue */ :
|
|
1810
1858
|
return 0;
|
|
1811
1859
|
|
|
1812
1860
|
case 1 /* TypeOrder.BooleanValue */ :
|
|
1813
|
-
return
|
|
1861
|
+
return Rt(t.booleanValue, e.booleanValue);
|
|
1814
1862
|
|
|
1815
1863
|
case 2 /* TypeOrder.NumberValue */ :
|
|
1816
1864
|
return function(t, e) {
|
|
1817
|
-
const n =
|
|
1865
|
+
const n = qt(t.integerValue || t.doubleValue), r = qt(e.integerValue || e.doubleValue);
|
|
1818
1866
|
return n < r ? -1 : n > r ? 1 : n === r ? 0 :
|
|
1819
1867
|
// one or both are NaN.
|
|
1820
1868
|
isNaN(n) ? isNaN(r) ? 0 : -1 : 1;
|
|
1821
1869
|
}(t, e);
|
|
1822
1870
|
|
|
1823
1871
|
case 3 /* TypeOrder.TimestampValue */ :
|
|
1824
|
-
return
|
|
1872
|
+
return Wt(t.timestampValue, e.timestampValue);
|
|
1825
1873
|
|
|
1826
1874
|
case 4 /* TypeOrder.ServerTimestampValue */ :
|
|
1827
|
-
return
|
|
1875
|
+
return Wt(Mt(t), Mt(e));
|
|
1828
1876
|
|
|
1829
1877
|
case 5 /* TypeOrder.StringValue */ :
|
|
1830
|
-
return
|
|
1878
|
+
return Rt(t.stringValue, e.stringValue);
|
|
1831
1879
|
|
|
1832
1880
|
case 6 /* TypeOrder.BlobValue */ :
|
|
1833
1881
|
return function(t, e) {
|
|
1834
|
-
const n =
|
|
1882
|
+
const n = Ot(t), r = Ot(e);
|
|
1835
1883
|
return n.compareTo(r);
|
|
1836
1884
|
}(t.bytesValue, e.bytesValue);
|
|
1837
1885
|
|
|
@@ -1839,34 +1887,34 @@ function Bt(t, e) {
|
|
|
1839
1887
|
return function(t, e) {
|
|
1840
1888
|
const n = t.split("/"), r = e.split("/");
|
|
1841
1889
|
for (let t = 0; t < n.length && t < r.length; t++) {
|
|
1842
|
-
const e =
|
|
1890
|
+
const e = Rt(n[t], r[t]);
|
|
1843
1891
|
if (0 !== e) return e;
|
|
1844
1892
|
}
|
|
1845
|
-
return
|
|
1893
|
+
return Rt(n.length, r.length);
|
|
1846
1894
|
}(t.referenceValue, e.referenceValue);
|
|
1847
1895
|
|
|
1848
1896
|
case 8 /* TypeOrder.GeoPointValue */ :
|
|
1849
1897
|
return function(t, e) {
|
|
1850
|
-
const n =
|
|
1898
|
+
const n = Rt(qt(t.latitude), qt(e.latitude));
|
|
1851
1899
|
if (0 !== n) return n;
|
|
1852
|
-
return
|
|
1900
|
+
return Rt(qt(t.longitude), qt(e.longitude));
|
|
1853
1901
|
}(t.geoPointValue, e.geoPointValue);
|
|
1854
1902
|
|
|
1855
1903
|
case 9 /* TypeOrder.ArrayValue */ :
|
|
1856
1904
|
return function(t, e) {
|
|
1857
1905
|
const n = t.values || [], r = e.values || [];
|
|
1858
1906
|
for (let t = 0; t < n.length && t < r.length; ++t) {
|
|
1859
|
-
const e =
|
|
1907
|
+
const e = Qt(n[t], r[t]);
|
|
1860
1908
|
if (e) return e;
|
|
1861
1909
|
}
|
|
1862
|
-
return
|
|
1910
|
+
return Rt(n.length, r.length);
|
|
1863
1911
|
}(t.arrayValue, e.arrayValue);
|
|
1864
1912
|
|
|
1865
1913
|
case 10 /* TypeOrder.ObjectValue */ :
|
|
1866
1914
|
return function(t, e) {
|
|
1867
|
-
if (t ===
|
|
1868
|
-
if (t ===
|
|
1869
|
-
if (e ===
|
|
1915
|
+
if (t === Ut && e === Ut) return 0;
|
|
1916
|
+
if (t === Ut) return 1;
|
|
1917
|
+
if (e === Ut) return -1;
|
|
1870
1918
|
const n = t.fields || {}, r = Object.keys(n), s = e.fields || {}, i = Object.keys(s);
|
|
1871
1919
|
// Even though MapValues are likely sorted correctly based on their insertion
|
|
1872
1920
|
// order (e.g. when received from the backend), local modifications can bring
|
|
@@ -1874,12 +1922,12 @@ function Bt(t, e) {
|
|
|
1874
1922
|
// canonical IDs are independent of insertion order.
|
|
1875
1923
|
r.sort(), i.sort();
|
|
1876
1924
|
for (let t = 0; t < r.length && t < i.length; ++t) {
|
|
1877
|
-
const e =
|
|
1925
|
+
const e = Rt(r[t], i[t]);
|
|
1878
1926
|
if (0 !== e) return e;
|
|
1879
|
-
const o =
|
|
1927
|
+
const o = Qt(n[r[t]], s[i[t]]);
|
|
1880
1928
|
if (0 !== o) return o;
|
|
1881
1929
|
}
|
|
1882
|
-
return
|
|
1930
|
+
return Rt(r.length, i.length);
|
|
1883
1931
|
}
|
|
1884
1932
|
/** Returns a reference value for the provided database and key. */ (t.mapValue, e.mapValue);
|
|
1885
1933
|
|
|
@@ -1888,35 +1936,35 @@ function Bt(t, e) {
|
|
|
1888
1936
|
}
|
|
1889
1937
|
}
|
|
1890
1938
|
|
|
1891
|
-
function
|
|
1892
|
-
if ("string" == typeof t && "string" == typeof e && t.length === e.length) return
|
|
1893
|
-
const n =
|
|
1894
|
-
return 0 !== s ? s :
|
|
1939
|
+
function Wt(t, e) {
|
|
1940
|
+
if ("string" == typeof t && "string" == typeof e && t.length === e.length) return Rt(t, e);
|
|
1941
|
+
const n = St(t), r = St(e), s = Rt(n.seconds, r.seconds);
|
|
1942
|
+
return 0 !== s ? s : Rt(n.nanos, r.nanos);
|
|
1895
1943
|
}
|
|
1896
1944
|
|
|
1897
|
-
function
|
|
1945
|
+
function Gt(t, e) {
|
|
1898
1946
|
return {
|
|
1899
1947
|
referenceValue: `projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`
|
|
1900
1948
|
};
|
|
1901
1949
|
}
|
|
1902
1950
|
|
|
1903
|
-
/** Returns true if `value` is an ArrayValue. */ function
|
|
1951
|
+
/** Returns true if `value` is an ArrayValue. */ function Kt(t) {
|
|
1904
1952
|
return !!t && "arrayValue" in t;
|
|
1905
1953
|
}
|
|
1906
1954
|
|
|
1907
|
-
/** Returns true if `value` is a NullValue. */ function
|
|
1955
|
+
/** Returns true if `value` is a NullValue. */ function Yt(t) {
|
|
1908
1956
|
return !!t && "nullValue" in t;
|
|
1909
1957
|
}
|
|
1910
1958
|
|
|
1911
|
-
/** Returns true if `value` is NaN. */ function
|
|
1959
|
+
/** Returns true if `value` is NaN. */ function Ht(t) {
|
|
1912
1960
|
return !!t && "doubleValue" in t && isNaN(Number(t.doubleValue));
|
|
1913
1961
|
}
|
|
1914
1962
|
|
|
1915
|
-
/** Returns true if `value` is a MapValue. */ function
|
|
1963
|
+
/** Returns true if `value` is a MapValue. */ function Zt(t) {
|
|
1916
1964
|
return !!t && "mapValue" in t;
|
|
1917
1965
|
}
|
|
1918
1966
|
|
|
1919
|
-
/** Creates a deep copy of `source`. */ function
|
|
1967
|
+
/** Creates a deep copy of `source`. */ function Jt(t) {
|
|
1920
1968
|
if (t.geoPointValue) return {
|
|
1921
1969
|
geoPointValue: Object.assign({}, t.geoPointValue)
|
|
1922
1970
|
};
|
|
@@ -1929,7 +1977,7 @@ function Qt(t, e) {
|
|
|
1929
1977
|
fields: {}
|
|
1930
1978
|
}
|
|
1931
1979
|
};
|
|
1932
|
-
return
|
|
1980
|
+
return $t(t.mapValue.fields, ((t, n) => e.mapValue.fields[t] = Jt(n))), e;
|
|
1933
1981
|
}
|
|
1934
1982
|
if (t.arrayValue) {
|
|
1935
1983
|
const e = {
|
|
@@ -1937,24 +1985,24 @@ function Qt(t, e) {
|
|
|
1937
1985
|
values: []
|
|
1938
1986
|
}
|
|
1939
1987
|
};
|
|
1940
|
-
for (let n = 0; n < (t.arrayValue.values || []).length; ++n) e.arrayValue.values[n] =
|
|
1988
|
+
for (let n = 0; n < (t.arrayValue.values || []).length; ++n) e.arrayValue.values[n] = Jt(t.arrayValue.values[n]);
|
|
1941
1989
|
return e;
|
|
1942
1990
|
}
|
|
1943
1991
|
return Object.assign({}, t);
|
|
1944
1992
|
}
|
|
1945
1993
|
|
|
1946
|
-
class
|
|
1994
|
+
class Xt {
|
|
1947
1995
|
constructor(t, e) {
|
|
1948
1996
|
this.position = t, this.inclusive = e;
|
|
1949
1997
|
}
|
|
1950
1998
|
}
|
|
1951
1999
|
|
|
1952
|
-
function
|
|
2000
|
+
function te(t, e) {
|
|
1953
2001
|
if (null === t) return null === e;
|
|
1954
2002
|
if (null === e) return !1;
|
|
1955
2003
|
if (t.inclusive !== e.inclusive || t.position.length !== e.position.length) return !1;
|
|
1956
2004
|
for (let n = 0; n < t.position.length; n++) {
|
|
1957
|
-
if (!
|
|
2005
|
+
if (!Bt(t.position[n], e.position[n])) return !1;
|
|
1958
2006
|
}
|
|
1959
2007
|
return !0;
|
|
1960
2008
|
}
|
|
@@ -1974,24 +2022,24 @@ function Jt(t, e) {
|
|
|
1974
2022
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1975
2023
|
* See the License for the specific language governing permissions and
|
|
1976
2024
|
* limitations under the License.
|
|
1977
|
-
*/ class
|
|
2025
|
+
*/ class ee {}
|
|
1978
2026
|
|
|
1979
|
-
class
|
|
2027
|
+
class ne extends ee {
|
|
1980
2028
|
constructor(t, e, n) {
|
|
1981
2029
|
super(), this.field = t, this.op = e, this.value = n;
|
|
1982
2030
|
}
|
|
1983
2031
|
/**
|
|
1984
2032
|
* Creates a filter based on the provided arguments.
|
|
1985
2033
|
*/ static create(t, e, n) {
|
|
1986
|
-
return t.isKeyField() ? "in" /* Operator.IN */ === e || "not-in" /* Operator.NOT_IN */ === e ? this.createKeyFieldInFilter(t, e, n) : new
|
|
2034
|
+
return t.isKeyField() ? "in" /* Operator.IN */ === e || "not-in" /* Operator.NOT_IN */ === e ? this.createKeyFieldInFilter(t, e, n) : new ie(t, e, n) : "array-contains" /* Operator.ARRAY_CONTAINS */ === e ? new ae(t, n) : "in" /* Operator.IN */ === e ? new he(t, n) : "not-in" /* Operator.NOT_IN */ === e ? new le(t, n) : "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ === e ? new fe(t, n) : new ne(t, e, n);
|
|
1987
2035
|
}
|
|
1988
2036
|
static createKeyFieldInFilter(t, e, n) {
|
|
1989
|
-
return "in" /* Operator.IN */ === e ? new
|
|
2037
|
+
return "in" /* Operator.IN */ === e ? new oe(t, n) : new ue(t, n);
|
|
1990
2038
|
}
|
|
1991
2039
|
matches(t) {
|
|
1992
2040
|
const e = t.data.field(this.field);
|
|
1993
2041
|
// Types do not have to match in NOT_EQUAL filters.
|
|
1994
|
-
return "!=" /* Operator.NOT_EQUAL */ === this.op ? null !== e && this.matchesComparison(
|
|
2042
|
+
return "!=" /* Operator.NOT_EQUAL */ === this.op ? null !== e && this.matchesComparison(Qt(e, this.value)) : null !== e && jt(this.value) === jt(e) && this.matchesComparison(Qt(e, this.value));
|
|
1995
2043
|
// Only compare types with matching backend order (such as double and int).
|
|
1996
2044
|
}
|
|
1997
2045
|
matchesComparison(t) {
|
|
@@ -2032,14 +2080,14 @@ class te extends Xt {
|
|
|
2032
2080
|
}
|
|
2033
2081
|
}
|
|
2034
2082
|
|
|
2035
|
-
class
|
|
2083
|
+
class re extends ee {
|
|
2036
2084
|
constructor(t, e) {
|
|
2037
2085
|
super(), this.filters = t, this.op = e, this.S = null;
|
|
2038
2086
|
}
|
|
2039
2087
|
/**
|
|
2040
2088
|
* Creates a filter based on the provided arguments.
|
|
2041
2089
|
*/ static create(t, e) {
|
|
2042
|
-
return new
|
|
2090
|
+
return new re(t, e);
|
|
2043
2091
|
}
|
|
2044
2092
|
matches(t) {
|
|
2045
2093
|
return "and" /* CompositeOperator.AND */ === this.op ? void 0 === this.filters.find((e => !e.matches(t))) : void 0 !== this.filters.find((e => e.matches(t)));
|
|
@@ -2065,19 +2113,19 @@ class ee extends Xt {
|
|
|
2065
2113
|
}
|
|
2066
2114
|
}
|
|
2067
2115
|
|
|
2068
|
-
function
|
|
2069
|
-
return t instanceof
|
|
2070
|
-
return e instanceof
|
|
2071
|
-
}(t, e) : t instanceof
|
|
2072
|
-
if (e instanceof
|
|
2073
|
-
return t.filters.reduce(((t, n, r) => t &&
|
|
2116
|
+
function se(t, e) {
|
|
2117
|
+
return t instanceof ne ? function(t, e) {
|
|
2118
|
+
return e instanceof ne && t.op === e.op && t.field.isEqual(e.field) && Bt(t.value, e.value);
|
|
2119
|
+
}(t, e) : t instanceof re ? function(t, e) {
|
|
2120
|
+
if (e instanceof re && t.op === e.op && t.filters.length === e.filters.length) {
|
|
2121
|
+
return t.filters.reduce(((t, n, r) => t && se(n, e.filters[r])), !0);
|
|
2074
2122
|
}
|
|
2075
2123
|
return !1;
|
|
2076
2124
|
}
|
|
2077
2125
|
/** Filter that matches on key fields (i.e. '__name__'). */ (t, e) : void A();
|
|
2078
2126
|
}
|
|
2079
2127
|
|
|
2080
|
-
class
|
|
2128
|
+
class ie extends ne {
|
|
2081
2129
|
constructor(t, e, n) {
|
|
2082
2130
|
super(t, e, n), this.key = it.fromName(n.referenceValue);
|
|
2083
2131
|
}
|
|
@@ -2087,69 +2135,69 @@ class re extends te {
|
|
|
2087
2135
|
}
|
|
2088
2136
|
}
|
|
2089
2137
|
|
|
2090
|
-
/** Filter that matches on key fields within an array. */ class
|
|
2138
|
+
/** Filter that matches on key fields within an array. */ class oe extends ne {
|
|
2091
2139
|
constructor(t, e) {
|
|
2092
|
-
super(t, "in" /* Operator.IN */ , e), this.keys =
|
|
2140
|
+
super(t, "in" /* Operator.IN */ , e), this.keys = ce("in" /* Operator.IN */ , e);
|
|
2093
2141
|
}
|
|
2094
2142
|
matches(t) {
|
|
2095
2143
|
return this.keys.some((e => e.isEqual(t.key)));
|
|
2096
2144
|
}
|
|
2097
2145
|
}
|
|
2098
2146
|
|
|
2099
|
-
/** Filter that matches on key fields not present within an array. */ class
|
|
2147
|
+
/** Filter that matches on key fields not present within an array. */ class ue extends ne {
|
|
2100
2148
|
constructor(t, e) {
|
|
2101
|
-
super(t, "not-in" /* Operator.NOT_IN */ , e), this.keys =
|
|
2149
|
+
super(t, "not-in" /* Operator.NOT_IN */ , e), this.keys = ce("not-in" /* Operator.NOT_IN */ , e);
|
|
2102
2150
|
}
|
|
2103
2151
|
matches(t) {
|
|
2104
2152
|
return !this.keys.some((e => e.isEqual(t.key)));
|
|
2105
2153
|
}
|
|
2106
2154
|
}
|
|
2107
2155
|
|
|
2108
|
-
function
|
|
2156
|
+
function ce(t, e) {
|
|
2109
2157
|
var n;
|
|
2110
2158
|
return ((null === (n = e.arrayValue) || void 0 === n ? void 0 : n.values) || []).map((t => it.fromName(t.referenceValue)));
|
|
2111
2159
|
}
|
|
2112
2160
|
|
|
2113
|
-
/** A Filter that implements the array-contains operator. */ class
|
|
2161
|
+
/** A Filter that implements the array-contains operator. */ class ae extends ne {
|
|
2114
2162
|
constructor(t, e) {
|
|
2115
2163
|
super(t, "array-contains" /* Operator.ARRAY_CONTAINS */ , e);
|
|
2116
2164
|
}
|
|
2117
2165
|
matches(t) {
|
|
2118
2166
|
const e = t.data.field(this.field);
|
|
2119
|
-
return
|
|
2167
|
+
return Kt(e) && zt(e.arrayValue, this.value);
|
|
2120
2168
|
}
|
|
2121
2169
|
}
|
|
2122
2170
|
|
|
2123
|
-
/** A Filter that implements the IN operator. */ class
|
|
2171
|
+
/** A Filter that implements the IN operator. */ class he extends ne {
|
|
2124
2172
|
constructor(t, e) {
|
|
2125
2173
|
super(t, "in" /* Operator.IN */ , e);
|
|
2126
2174
|
}
|
|
2127
2175
|
matches(t) {
|
|
2128
2176
|
const e = t.data.field(this.field);
|
|
2129
|
-
return null !== e &&
|
|
2177
|
+
return null !== e && zt(this.value.arrayValue, e);
|
|
2130
2178
|
}
|
|
2131
2179
|
}
|
|
2132
2180
|
|
|
2133
|
-
/** A Filter that implements the not-in operator. */ class
|
|
2181
|
+
/** A Filter that implements the not-in operator. */ class le extends ne {
|
|
2134
2182
|
constructor(t, e) {
|
|
2135
2183
|
super(t, "not-in" /* Operator.NOT_IN */ , e);
|
|
2136
2184
|
}
|
|
2137
2185
|
matches(t) {
|
|
2138
|
-
if (
|
|
2186
|
+
if (zt(this.value.arrayValue, {
|
|
2139
2187
|
nullValue: "NULL_VALUE"
|
|
2140
2188
|
})) return !1;
|
|
2141
2189
|
const e = t.data.field(this.field);
|
|
2142
|
-
return null !== e && !
|
|
2190
|
+
return null !== e && !zt(this.value.arrayValue, e);
|
|
2143
2191
|
}
|
|
2144
2192
|
}
|
|
2145
2193
|
|
|
2146
|
-
/** A Filter that implements the array-contains-any operator. */ class
|
|
2194
|
+
/** A Filter that implements the array-contains-any operator. */ class fe extends ne {
|
|
2147
2195
|
constructor(t, e) {
|
|
2148
2196
|
super(t, "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ , e);
|
|
2149
2197
|
}
|
|
2150
2198
|
matches(t) {
|
|
2151
2199
|
const e = t.data.field(this.field);
|
|
2152
|
-
return !(!
|
|
2200
|
+
return !(!Kt(e) || !e.arrayValue.values) && e.arrayValue.values.some((t => zt(this.value.arrayValue, t)));
|
|
2153
2201
|
}
|
|
2154
2202
|
}
|
|
2155
2203
|
|
|
@@ -2171,13 +2219,13 @@ function oe(t, e) {
|
|
|
2171
2219
|
*/
|
|
2172
2220
|
/**
|
|
2173
2221
|
* An ordering on a field, in some Direction. Direction defaults to ASCENDING.
|
|
2174
|
-
*/ class
|
|
2222
|
+
*/ class de {
|
|
2175
2223
|
constructor(t, e = "asc" /* Direction.ASCENDING */) {
|
|
2176
2224
|
this.field = t, this.dir = e;
|
|
2177
2225
|
}
|
|
2178
2226
|
}
|
|
2179
2227
|
|
|
2180
|
-
function
|
|
2228
|
+
function we(t, e) {
|
|
2181
2229
|
return t.dir === e.dir && t.field.isEqual(e.field);
|
|
2182
2230
|
}
|
|
2183
2231
|
|
|
@@ -2200,18 +2248,18 @@ function fe(t, e) {
|
|
|
2200
2248
|
/**
|
|
2201
2249
|
* A version of a document in Firestore. This corresponds to the version
|
|
2202
2250
|
* timestamp, such as update_time or read_time.
|
|
2203
|
-
*/ class
|
|
2251
|
+
*/ class me {
|
|
2204
2252
|
constructor(t) {
|
|
2205
2253
|
this.timestamp = t;
|
|
2206
2254
|
}
|
|
2207
2255
|
static fromTimestamp(t) {
|
|
2208
|
-
return new
|
|
2256
|
+
return new me(t);
|
|
2209
2257
|
}
|
|
2210
2258
|
static min() {
|
|
2211
|
-
return new
|
|
2259
|
+
return new me(new kt(0, 0));
|
|
2212
2260
|
}
|
|
2213
2261
|
static max() {
|
|
2214
|
-
return new
|
|
2262
|
+
return new me(new kt(253402300799, 999999999));
|
|
2215
2263
|
}
|
|
2216
2264
|
compareTo(t) {
|
|
2217
2265
|
return this.timestamp._compareTo(t.timestamp);
|
|
@@ -2249,17 +2297,17 @@ function fe(t, e) {
|
|
|
2249
2297
|
*/
|
|
2250
2298
|
// An immutable sorted map implementation, based on a Left-leaning Red-Black
|
|
2251
2299
|
// tree.
|
|
2252
|
-
class
|
|
2300
|
+
class pe {
|
|
2253
2301
|
constructor(t, e) {
|
|
2254
|
-
this.comparator = t, this.root = e ||
|
|
2302
|
+
this.comparator = t, this.root = e || ge.EMPTY;
|
|
2255
2303
|
}
|
|
2256
2304
|
// Returns a copy of the map, with the specified key/value added or replaced.
|
|
2257
2305
|
insert(t, e) {
|
|
2258
|
-
return new
|
|
2306
|
+
return new pe(this.comparator, this.root.insert(t, e, this.comparator).copy(null, null, ge.BLACK, null, null));
|
|
2259
2307
|
}
|
|
2260
2308
|
// Returns a copy of the map, with the specified key removed.
|
|
2261
2309
|
remove(t) {
|
|
2262
|
-
return new
|
|
2310
|
+
return new pe(this.comparator, this.root.remove(t, this.comparator).copy(null, null, ge.BLACK, null, null));
|
|
2263
2311
|
}
|
|
2264
2312
|
// Returns the value of the node with the given key, or null.
|
|
2265
2313
|
get(t) {
|
|
@@ -2325,22 +2373,22 @@ class we {
|
|
|
2325
2373
|
}
|
|
2326
2374
|
// Returns an iterator over the SortedMap.
|
|
2327
2375
|
getIterator() {
|
|
2328
|
-
return new
|
|
2376
|
+
return new ye(this.root, null, this.comparator, !1);
|
|
2329
2377
|
}
|
|
2330
2378
|
getIteratorFrom(t) {
|
|
2331
|
-
return new
|
|
2379
|
+
return new ye(this.root, t, this.comparator, !1);
|
|
2332
2380
|
}
|
|
2333
2381
|
getReverseIterator() {
|
|
2334
|
-
return new
|
|
2382
|
+
return new ye(this.root, null, this.comparator, !0);
|
|
2335
2383
|
}
|
|
2336
2384
|
getReverseIteratorFrom(t) {
|
|
2337
|
-
return new
|
|
2385
|
+
return new ye(this.root, t, this.comparator, !0);
|
|
2338
2386
|
}
|
|
2339
2387
|
}
|
|
2340
2388
|
|
|
2341
2389
|
// end SortedMap
|
|
2342
2390
|
// An iterator over an LLRBNode.
|
|
2343
|
-
class
|
|
2391
|
+
class ye {
|
|
2344
2392
|
constructor(t, e, n, r) {
|
|
2345
2393
|
this.isReverse = r, this.nodeStack = [];
|
|
2346
2394
|
let s = 1;
|
|
@@ -2385,14 +2433,14 @@ class me {
|
|
|
2385
2433
|
|
|
2386
2434
|
// end SortedMapIterator
|
|
2387
2435
|
// Represents a node in a Left-leaning Red-Black tree.
|
|
2388
|
-
class
|
|
2436
|
+
class ge {
|
|
2389
2437
|
constructor(t, e, n, r, s) {
|
|
2390
|
-
this.key = t, this.value = e, this.color = null != n ? n :
|
|
2391
|
-
this.right = null != s ? s :
|
|
2438
|
+
this.key = t, this.value = e, this.color = null != n ? n : ge.RED, this.left = null != r ? r : ge.EMPTY,
|
|
2439
|
+
this.right = null != s ? s : ge.EMPTY, this.size = this.left.size + 1 + this.right.size;
|
|
2392
2440
|
}
|
|
2393
2441
|
// Returns a copy of the current node, optionally replacing pieces of it.
|
|
2394
2442
|
copy(t, e, n, r, s) {
|
|
2395
|
-
return new
|
|
2443
|
+
return new ge(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);
|
|
2396
2444
|
}
|
|
2397
2445
|
isEmpty() {
|
|
2398
2446
|
return !1;
|
|
@@ -2431,7 +2479,7 @@ class pe {
|
|
|
2431
2479
|
r.fixUp();
|
|
2432
2480
|
}
|
|
2433
2481
|
removeMin() {
|
|
2434
|
-
if (this.left.isEmpty()) return
|
|
2482
|
+
if (this.left.isEmpty()) return ge.EMPTY;
|
|
2435
2483
|
let t = this;
|
|
2436
2484
|
return t.left.isRed() || t.left.left.isRed() || (t = t.moveRedLeft()), t = t.copy(null, null, null, t.left.removeMin(), null),
|
|
2437
2485
|
t.fixUp();
|
|
@@ -2443,7 +2491,7 @@ class pe {
|
|
|
2443
2491
|
r = r.copy(null, null, null, r.left.remove(t, e), null); else {
|
|
2444
2492
|
if (r.left.isRed() && (r = r.rotateRight()), r.right.isEmpty() || r.right.isRed() || r.right.left.isRed() || (r = r.moveRedRight()),
|
|
2445
2493
|
0 === e(t, r.key)) {
|
|
2446
|
-
if (r.right.isEmpty()) return
|
|
2494
|
+
if (r.right.isEmpty()) return ge.EMPTY;
|
|
2447
2495
|
n = r.right.min(), r = r.copy(n.key, n.value, null, null, r.right.removeMin());
|
|
2448
2496
|
}
|
|
2449
2497
|
r = r.copy(null, null, null, null, r.right.remove(t, e));
|
|
@@ -2469,11 +2517,11 @@ class pe {
|
|
|
2469
2517
|
return t.left.left.isRed() && (t = t.rotateRight(), t = t.colorFlip()), t;
|
|
2470
2518
|
}
|
|
2471
2519
|
rotateLeft() {
|
|
2472
|
-
const t = this.copy(null, null,
|
|
2520
|
+
const t = this.copy(null, null, ge.RED, null, this.right.left);
|
|
2473
2521
|
return this.right.copy(null, null, this.color, t, null);
|
|
2474
2522
|
}
|
|
2475
2523
|
rotateRight() {
|
|
2476
|
-
const t = this.copy(null, null,
|
|
2524
|
+
const t = this.copy(null, null, ge.RED, this.left.right, null);
|
|
2477
2525
|
return this.left.copy(null, null, this.color, null, t);
|
|
2478
2526
|
}
|
|
2479
2527
|
colorFlip() {
|
|
@@ -2499,10 +2547,10 @@ class pe {
|
|
|
2499
2547
|
// end LLRBNode
|
|
2500
2548
|
// Empty node is shared between all LLRB trees.
|
|
2501
2549
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2502
|
-
|
|
2550
|
+
ge.EMPTY = null, ge.RED = !0, ge.BLACK = !1;
|
|
2503
2551
|
|
|
2504
2552
|
// end LLRBEmptyNode
|
|
2505
|
-
|
|
2553
|
+
ge.EMPTY = new
|
|
2506
2554
|
// Represents an empty node (a leaf node in the Red-Black Tree).
|
|
2507
2555
|
class {
|
|
2508
2556
|
constructor() {
|
|
@@ -2529,7 +2577,7 @@ class {
|
|
|
2529
2577
|
}
|
|
2530
2578
|
// Returns a copy of the tree, with the specified key/value added.
|
|
2531
2579
|
insert(t, e, n) {
|
|
2532
|
-
return new
|
|
2580
|
+
return new ge(t, e);
|
|
2533
2581
|
}
|
|
2534
2582
|
// Returns a copy of the tree, with the specified key removed.
|
|
2535
2583
|
remove(t, e) {
|
|
@@ -2585,9 +2633,9 @@ class {
|
|
|
2585
2633
|
* NOTE: if provided comparator returns 0 for two elements, we consider them to
|
|
2586
2634
|
* be equal!
|
|
2587
2635
|
*/
|
|
2588
|
-
class
|
|
2636
|
+
class _e {
|
|
2589
2637
|
constructor(t) {
|
|
2590
|
-
this.comparator = t, this.data = new
|
|
2638
|
+
this.comparator = t, this.data = new pe(this.comparator);
|
|
2591
2639
|
}
|
|
2592
2640
|
has(t) {
|
|
2593
2641
|
return null !== this.data.get(t);
|
|
@@ -2628,10 +2676,10 @@ class ye {
|
|
|
2628
2676
|
return e.hasNext() ? e.getNext().key : null;
|
|
2629
2677
|
}
|
|
2630
2678
|
getIterator() {
|
|
2631
|
-
return new
|
|
2679
|
+
return new ve(this.data.getIterator());
|
|
2632
2680
|
}
|
|
2633
2681
|
getIteratorFrom(t) {
|
|
2634
|
-
return new
|
|
2682
|
+
return new ve(this.data.getIteratorFrom(t));
|
|
2635
2683
|
}
|
|
2636
2684
|
/** Inserts or updates an element */ add(t) {
|
|
2637
2685
|
return this.copy(this.data.remove(t).insert(t, !0));
|
|
@@ -2650,7 +2698,7 @@ class ye {
|
|
|
2650
2698
|
})), e;
|
|
2651
2699
|
}
|
|
2652
2700
|
isEqual(t) {
|
|
2653
|
-
if (!(t instanceof
|
|
2701
|
+
if (!(t instanceof _e)) return !1;
|
|
2654
2702
|
if (this.size !== t.size) return !1;
|
|
2655
2703
|
const e = this.data.getIterator(), n = t.data.getIterator();
|
|
2656
2704
|
for (;e.hasNext(); ) {
|
|
@@ -2670,12 +2718,12 @@ class ye {
|
|
|
2670
2718
|
return this.forEach((e => t.push(e))), "SortedSet(" + t.toString() + ")";
|
|
2671
2719
|
}
|
|
2672
2720
|
copy(t) {
|
|
2673
|
-
const e = new
|
|
2721
|
+
const e = new _e(this.comparator);
|
|
2674
2722
|
return e.data = t, e;
|
|
2675
2723
|
}
|
|
2676
2724
|
}
|
|
2677
2725
|
|
|
2678
|
-
class
|
|
2726
|
+
class ve {
|
|
2679
2727
|
constructor(t) {
|
|
2680
2728
|
this.iter = t;
|
|
2681
2729
|
}
|
|
@@ -2712,7 +2760,7 @@ class ge {
|
|
|
2712
2760
|
* foo.bar - Overwrites only the field bar of the object foo.
|
|
2713
2761
|
* If foo is not an object, foo is replaced with an object
|
|
2714
2762
|
* containing foo
|
|
2715
|
-
*/ class
|
|
2763
|
+
*/ class be {
|
|
2716
2764
|
constructor(t) {
|
|
2717
2765
|
this.fields = t,
|
|
2718
2766
|
// TODO(dimond): validation of FieldMask
|
|
@@ -2720,16 +2768,16 @@ class ge {
|
|
|
2720
2768
|
t.sort(st.comparator);
|
|
2721
2769
|
}
|
|
2722
2770
|
static empty() {
|
|
2723
|
-
return new
|
|
2771
|
+
return new be([]);
|
|
2724
2772
|
}
|
|
2725
2773
|
/**
|
|
2726
2774
|
* Returns a new FieldMask object that is the result of adding all the given
|
|
2727
2775
|
* fields paths to this field mask.
|
|
2728
2776
|
*/ unionWith(t) {
|
|
2729
|
-
let e = new
|
|
2777
|
+
let e = new _e(st.comparator);
|
|
2730
2778
|
for (const t of this.fields) e = e.add(t);
|
|
2731
2779
|
for (const n of t) e = e.add(n);
|
|
2732
|
-
return new
|
|
2780
|
+
return new be(e.toArray());
|
|
2733
2781
|
}
|
|
2734
2782
|
/**
|
|
2735
2783
|
* Verifies that `fieldPath` is included by at least one field in this field
|
|
@@ -2741,7 +2789,7 @@ class ge {
|
|
|
2741
2789
|
return !1;
|
|
2742
2790
|
}
|
|
2743
2791
|
isEqual(t) {
|
|
2744
|
-
return
|
|
2792
|
+
return Pt(this.fields, t.fields, ((t, e) => t.isEqual(e)));
|
|
2745
2793
|
}
|
|
2746
2794
|
}
|
|
2747
2795
|
|
|
@@ -2764,12 +2812,12 @@ class ge {
|
|
|
2764
2812
|
/**
|
|
2765
2813
|
* An ObjectValue represents a MapValue in the Firestore Proto and offers the
|
|
2766
2814
|
* ability to add and remove fields (via the ObjectValueBuilder).
|
|
2767
|
-
*/ class
|
|
2815
|
+
*/ class Ee {
|
|
2768
2816
|
constructor(t) {
|
|
2769
2817
|
this.value = t;
|
|
2770
2818
|
}
|
|
2771
2819
|
static empty() {
|
|
2772
|
-
return new
|
|
2820
|
+
return new Ee({
|
|
2773
2821
|
mapValue: {}
|
|
2774
2822
|
});
|
|
2775
2823
|
}
|
|
@@ -2783,7 +2831,7 @@ class ge {
|
|
|
2783
2831
|
{
|
|
2784
2832
|
let e = this.value;
|
|
2785
2833
|
for (let n = 0; n < t.length - 1; ++n) if (e = (e.mapValue.fields || {})[t.get(n)],
|
|
2786
|
-
!
|
|
2834
|
+
!Zt(e)) return null;
|
|
2787
2835
|
return e = (e.mapValue.fields || {})[t.lastSegment()], e || null;
|
|
2788
2836
|
}
|
|
2789
2837
|
}
|
|
@@ -2793,7 +2841,7 @@ class ge {
|
|
|
2793
2841
|
* @param path - The field path to set.
|
|
2794
2842
|
* @param value - The value to set.
|
|
2795
2843
|
*/ set(t, e) {
|
|
2796
|
-
this.getFieldsMap(t.popLast())[t.lastSegment()] =
|
|
2844
|
+
this.getFieldsMap(t.popLast())[t.lastSegment()] = Jt(e);
|
|
2797
2845
|
}
|
|
2798
2846
|
/**
|
|
2799
2847
|
* Sets the provided fields to the provided values.
|
|
@@ -2807,7 +2855,7 @@ class ge {
|
|
|
2807
2855
|
const t = this.getFieldsMap(e);
|
|
2808
2856
|
this.applyChanges(t, n, r), n = {}, r = [], e = s.popLast();
|
|
2809
2857
|
}
|
|
2810
|
-
t ? n[s.lastSegment()] =
|
|
2858
|
+
t ? n[s.lastSegment()] = Jt(t) : r.push(s.lastSegment());
|
|
2811
2859
|
}));
|
|
2812
2860
|
const s = this.getFieldsMap(e);
|
|
2813
2861
|
this.applyChanges(s, n, r);
|
|
@@ -2819,10 +2867,10 @@ class ge {
|
|
|
2819
2867
|
* @param path - The field path to remove.
|
|
2820
2868
|
*/ delete(t) {
|
|
2821
2869
|
const e = this.field(t.popLast());
|
|
2822
|
-
|
|
2870
|
+
Zt(e) && e.mapValue.fields && delete e.mapValue.fields[t.lastSegment()];
|
|
2823
2871
|
}
|
|
2824
2872
|
isEqual(t) {
|
|
2825
|
-
return
|
|
2873
|
+
return Bt(this.value, t.value);
|
|
2826
2874
|
}
|
|
2827
2875
|
/**
|
|
2828
2876
|
* Returns the map that contains the leaf element of `path`. If the parent
|
|
@@ -2834,7 +2882,7 @@ class ge {
|
|
|
2834
2882
|
});
|
|
2835
2883
|
for (let n = 0; n < t.length; ++n) {
|
|
2836
2884
|
let r = e.mapValue.fields[t.get(n)];
|
|
2837
|
-
|
|
2885
|
+
Zt(r) && r.mapValue.fields || (r = {
|
|
2838
2886
|
mapValue: {
|
|
2839
2887
|
fields: {}
|
|
2840
2888
|
}
|
|
@@ -2846,11 +2894,11 @@ class ge {
|
|
|
2846
2894
|
* Modifies `fieldsMap` by adding, replacing or deleting the specified
|
|
2847
2895
|
* entries.
|
|
2848
2896
|
*/ applyChanges(t, e, n) {
|
|
2849
|
-
|
|
2897
|
+
$t(e, ((e, n) => t[e] = n));
|
|
2850
2898
|
for (const e of n) delete t[e];
|
|
2851
2899
|
}
|
|
2852
2900
|
clone() {
|
|
2853
|
-
return new
|
|
2901
|
+
return new Ee(Jt(this.value));
|
|
2854
2902
|
}
|
|
2855
2903
|
}
|
|
2856
2904
|
|
|
@@ -2879,7 +2927,7 @@ class ge {
|
|
|
2879
2927
|
* not transition to one of these states even after all mutations have been
|
|
2880
2928
|
* applied, `isValidDocument()` returns false and the document should be removed
|
|
2881
2929
|
* from all views.
|
|
2882
|
-
*/ class
|
|
2930
|
+
*/ class Ae {
|
|
2883
2931
|
constructor(t, e, n, r, s, i, o) {
|
|
2884
2932
|
this.key = t, this.documentType = e, this.version = n, this.readTime = r, this.createTime = s,
|
|
2885
2933
|
this.data = i, this.documentState = o;
|
|
@@ -2888,35 +2936,35 @@ class ge {
|
|
|
2888
2936
|
* Creates a document with no known version or data, but which can serve as
|
|
2889
2937
|
* base document for mutations.
|
|
2890
2938
|
*/ static newInvalidDocument(t) {
|
|
2891
|
-
return new
|
|
2892
|
-
/* version */
|
|
2893
|
-
/* readTime */
|
|
2894
|
-
/* createTime */
|
|
2939
|
+
return new Ae(t, 0 /* DocumentType.INVALID */ ,
|
|
2940
|
+
/* version */ me.min(),
|
|
2941
|
+
/* readTime */ me.min(),
|
|
2942
|
+
/* createTime */ me.min(), Ee.empty(), 0 /* DocumentState.SYNCED */);
|
|
2895
2943
|
}
|
|
2896
2944
|
/**
|
|
2897
2945
|
* Creates a new document that is known to exist with the given data at the
|
|
2898
2946
|
* given version.
|
|
2899
2947
|
*/ static newFoundDocument(t, e, n, r) {
|
|
2900
|
-
return new
|
|
2948
|
+
return new Ae(t, 1 /* DocumentType.FOUND_DOCUMENT */ ,
|
|
2901
2949
|
/* version */ e,
|
|
2902
|
-
/* readTime */
|
|
2950
|
+
/* readTime */ me.min(),
|
|
2903
2951
|
/* createTime */ n, r, 0 /* DocumentState.SYNCED */);
|
|
2904
2952
|
}
|
|
2905
2953
|
/** Creates a new document that is known to not exist at the given version. */ static newNoDocument(t, e) {
|
|
2906
|
-
return new
|
|
2954
|
+
return new Ae(t, 2 /* DocumentType.NO_DOCUMENT */ ,
|
|
2907
2955
|
/* version */ e,
|
|
2908
|
-
/* readTime */
|
|
2909
|
-
/* createTime */
|
|
2956
|
+
/* readTime */ me.min(),
|
|
2957
|
+
/* createTime */ me.min(), Ee.empty(), 0 /* DocumentState.SYNCED */);
|
|
2910
2958
|
}
|
|
2911
2959
|
/**
|
|
2912
2960
|
* Creates a new document that is known to exist at the given version but
|
|
2913
2961
|
* whose data is not known (e.g. a document that was updated without a known
|
|
2914
2962
|
* base document).
|
|
2915
2963
|
*/ static newUnknownDocument(t, e) {
|
|
2916
|
-
return new
|
|
2964
|
+
return new Ae(t, 3 /* DocumentType.UNKNOWN_DOCUMENT */ ,
|
|
2917
2965
|
/* version */ e,
|
|
2918
|
-
/* readTime */
|
|
2919
|
-
/* createTime */
|
|
2966
|
+
/* readTime */ me.min(),
|
|
2967
|
+
/* createTime */ me.min(), Ee.empty(), 2 /* DocumentState.HAS_COMMITTED_MUTATIONS */);
|
|
2920
2968
|
}
|
|
2921
2969
|
/**
|
|
2922
2970
|
* Changes the document type to indicate that it exists and that its version
|
|
@@ -2927,7 +2975,7 @@ class ge {
|
|
|
2927
2975
|
// update from Watch or due to applying a local set mutation on top
|
|
2928
2976
|
// of a deleted document, our best guess about its createTime would be the
|
|
2929
2977
|
// version at which the document transitioned to a FOUND_DOCUMENT.
|
|
2930
|
-
return !this.createTime.isEqual(
|
|
2978
|
+
return !this.createTime.isEqual(me.min()) || 2 /* DocumentType.NO_DOCUMENT */ !== this.documentType && 0 /* DocumentType.INVALID */ !== this.documentType || (this.createTime = t),
|
|
2931
2979
|
this.version = t, this.documentType = 1 /* DocumentType.FOUND_DOCUMENT */ , this.data = e,
|
|
2932
2980
|
this.documentState = 0 /* DocumentState.SYNCED */ , this;
|
|
2933
2981
|
}
|
|
@@ -2936,7 +2984,7 @@ class ge {
|
|
|
2936
2984
|
* version.
|
|
2937
2985
|
*/ convertToNoDocument(t) {
|
|
2938
2986
|
return this.version = t, this.documentType = 2 /* DocumentType.NO_DOCUMENT */ ,
|
|
2939
|
-
this.data =
|
|
2987
|
+
this.data = Ee.empty(), this.documentState = 0 /* DocumentState.SYNCED */ , this;
|
|
2940
2988
|
}
|
|
2941
2989
|
/**
|
|
2942
2990
|
* Changes the document type to indicate that it exists at a given version but
|
|
@@ -2944,14 +2992,14 @@ class ge {
|
|
|
2944
2992
|
* base document).
|
|
2945
2993
|
*/ convertToUnknownDocument(t) {
|
|
2946
2994
|
return this.version = t, this.documentType = 3 /* DocumentType.UNKNOWN_DOCUMENT */ ,
|
|
2947
|
-
this.data =
|
|
2995
|
+
this.data = Ee.empty(), this.documentState = 2 /* DocumentState.HAS_COMMITTED_MUTATIONS */ ,
|
|
2948
2996
|
this;
|
|
2949
2997
|
}
|
|
2950
2998
|
setHasCommittedMutations() {
|
|
2951
2999
|
return this.documentState = 2 /* DocumentState.HAS_COMMITTED_MUTATIONS */ , this;
|
|
2952
3000
|
}
|
|
2953
3001
|
setHasLocalMutations() {
|
|
2954
|
-
return this.documentState = 1 /* DocumentState.HAS_LOCAL_MUTATIONS */ , this.version =
|
|
3002
|
+
return this.documentState = 1 /* DocumentState.HAS_LOCAL_MUTATIONS */ , this.version = me.min(),
|
|
2955
3003
|
this;
|
|
2956
3004
|
}
|
|
2957
3005
|
setReadTime(t) {
|
|
@@ -2979,10 +3027,10 @@ class ge {
|
|
|
2979
3027
|
return 3 /* DocumentType.UNKNOWN_DOCUMENT */ === this.documentType;
|
|
2980
3028
|
}
|
|
2981
3029
|
isEqual(t) {
|
|
2982
|
-
return t instanceof
|
|
3030
|
+
return t instanceof Ae && this.key.isEqual(t.key) && this.version.isEqual(t.version) && this.documentType === t.documentType && this.documentState === t.documentState && this.data.isEqual(t.data);
|
|
2983
3031
|
}
|
|
2984
3032
|
mutableCopy() {
|
|
2985
|
-
return new
|
|
3033
|
+
return new Ae(this.key, this.documentType, this.version, this.readTime, this.createTime, this.data.clone(), this.documentState);
|
|
2986
3034
|
}
|
|
2987
3035
|
toString() {
|
|
2988
3036
|
return `Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`;
|
|
@@ -3006,7 +3054,7 @@ class ge {
|
|
|
3006
3054
|
* limitations under the License.
|
|
3007
3055
|
*/
|
|
3008
3056
|
// Visible for testing
|
|
3009
|
-
class
|
|
3057
|
+
class Ie {
|
|
3010
3058
|
constructor(t, e = null, n = [], r = [], s = null, i = null, o = null) {
|
|
3011
3059
|
this.path = t, this.collectionGroup = e, this.orderBy = n, this.filters = r, this.limit = s,
|
|
3012
3060
|
this.startAt = i, this.endAt = o, this.O = null;
|
|
@@ -3020,8 +3068,8 @@ class Ee {
|
|
|
3020
3068
|
* NOTE: you should always construct `Target` from `Query.toTarget` instead of
|
|
3021
3069
|
* using this factory method, because `Query` provides an implicit `orderBy`
|
|
3022
3070
|
* property.
|
|
3023
|
-
*/ function
|
|
3024
|
-
return new
|
|
3071
|
+
*/ function Te(t, e = null, n = [], r = [], s = null, i = null, o = null) {
|
|
3072
|
+
return new Ie(t, e, n, r, s, i, o);
|
|
3025
3073
|
}
|
|
3026
3074
|
|
|
3027
3075
|
/**
|
|
@@ -3047,7 +3095,7 @@ class Ee {
|
|
|
3047
3095
|
*
|
|
3048
3096
|
* Visible for testing.
|
|
3049
3097
|
*/
|
|
3050
|
-
class
|
|
3098
|
+
class Re {
|
|
3051
3099
|
/**
|
|
3052
3100
|
* Initializes a Query with a path and optional additional query constraints.
|
|
3053
3101
|
* Path must currently be empty if this is a collection group query.
|
|
@@ -3060,11 +3108,11 @@ class Ie {
|
|
|
3060
3108
|
}
|
|
3061
3109
|
}
|
|
3062
3110
|
|
|
3063
|
-
/** Creates a new Query for a query that matches all documents at `path` */ function
|
|
3111
|
+
/** Creates a new Query for a query that matches all documents at `path` */ function Pe(t) {
|
|
3064
3112
|
return t.explicitOrderBy.length > 0 ? t.explicitOrderBy[0].field : null;
|
|
3065
3113
|
}
|
|
3066
3114
|
|
|
3067
|
-
function
|
|
3115
|
+
function Ve(t) {
|
|
3068
3116
|
for (const e of t.filters) {
|
|
3069
3117
|
const t = e.getFirstInequalityField();
|
|
3070
3118
|
if (null !== t) return t;
|
|
@@ -3080,7 +3128,7 @@ function Re(t) {
|
|
|
3080
3128
|
* Returns whether the query matches a collection group rather than a specific
|
|
3081
3129
|
* collection.
|
|
3082
3130
|
*/
|
|
3083
|
-
function
|
|
3131
|
+
function $e(t) {
|
|
3084
3132
|
return null !== t.collectionGroup;
|
|
3085
3133
|
}
|
|
3086
3134
|
|
|
@@ -3088,23 +3136,23 @@ function Pe(t) {
|
|
|
3088
3136
|
* Returns the implicit order by constraint that is used to execute the Query,
|
|
3089
3137
|
* which can be different from the order by constraints the user provided (e.g.
|
|
3090
3138
|
* the SDK and backend always orders by `__name__`).
|
|
3091
|
-
*/ function
|
|
3139
|
+
*/ function Ne(t) {
|
|
3092
3140
|
const e = T(t);
|
|
3093
3141
|
if (null === e.k) {
|
|
3094
3142
|
e.k = [];
|
|
3095
|
-
const t =
|
|
3143
|
+
const t = Ve(e), n = Pe(e);
|
|
3096
3144
|
if (null !== t && null === n)
|
|
3097
3145
|
// In order to implicitly add key ordering, we must also add the
|
|
3098
3146
|
// inequality filter field for it to be a valid query.
|
|
3099
3147
|
// Note that the default inequality field and key ordering is ascending.
|
|
3100
|
-
t.isKeyField() || e.k.push(new
|
|
3148
|
+
t.isKeyField() || e.k.push(new de(t)), e.k.push(new de(st.keyField(), "asc" /* Direction.ASCENDING */)); else {
|
|
3101
3149
|
let t = !1;
|
|
3102
3150
|
for (const n of e.explicitOrderBy) e.k.push(n), n.field.isKeyField() && (t = !0);
|
|
3103
3151
|
if (!t) {
|
|
3104
3152
|
// The order of the implicit key ordering always matches the last
|
|
3105
3153
|
// explicit order by
|
|
3106
3154
|
const t = e.explicitOrderBy.length > 0 ? e.explicitOrderBy[e.explicitOrderBy.length - 1].dir : "asc" /* Direction.ASCENDING */;
|
|
3107
|
-
e.k.push(new
|
|
3155
|
+
e.k.push(new de(st.keyField(), t));
|
|
3108
3156
|
}
|
|
3109
3157
|
}
|
|
3110
3158
|
}
|
|
@@ -3113,38 +3161,38 @@ function Pe(t) {
|
|
|
3113
3161
|
|
|
3114
3162
|
/**
|
|
3115
3163
|
* Converts this `Query` instance to it's corresponding `Target` representation.
|
|
3116
|
-
*/ function
|
|
3164
|
+
*/ function De(t) {
|
|
3117
3165
|
const e = T(t);
|
|
3118
|
-
if (!e.C) if ("F" /* LimitType.First */ === e.limitType) e.C =
|
|
3166
|
+
if (!e.C) if ("F" /* LimitType.First */ === e.limitType) e.C = Te(e.path, e.collectionGroup, Ne(e), e.filters, e.limit, e.startAt, e.endAt); else {
|
|
3119
3167
|
// Flip the orderBy directions since we want the last results
|
|
3120
3168
|
const t = [];
|
|
3121
|
-
for (const n of
|
|
3169
|
+
for (const n of Ne(e)) {
|
|
3122
3170
|
const e = "desc" /* Direction.DESCENDING */ === n.dir ? "asc" /* Direction.ASCENDING */ : "desc" /* Direction.DESCENDING */;
|
|
3123
|
-
t.push(new
|
|
3171
|
+
t.push(new de(n.field, e));
|
|
3124
3172
|
}
|
|
3125
3173
|
// We need to swap the cursors to match the now-flipped query ordering.
|
|
3126
|
-
const n = e.endAt ? new
|
|
3174
|
+
const n = e.endAt ? new Xt(e.endAt.position, e.endAt.inclusive) : null, r = e.startAt ? new Xt(e.startAt.position, e.startAt.inclusive) : null;
|
|
3127
3175
|
// Now return as a LimitType.First query.
|
|
3128
|
-
e.C =
|
|
3176
|
+
e.C = Te(e.path, e.collectionGroup, t, e.filters, e.limit, n, r);
|
|
3129
3177
|
}
|
|
3130
3178
|
return e.C;
|
|
3131
3179
|
}
|
|
3132
3180
|
|
|
3133
|
-
function
|
|
3134
|
-
e.getFirstInequalityField(),
|
|
3181
|
+
function Fe(t, e) {
|
|
3182
|
+
e.getFirstInequalityField(), Ve(t);
|
|
3135
3183
|
const n = t.filters.concat([ e ]);
|
|
3136
|
-
return new
|
|
3184
|
+
return new Re(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
|
|
3137
3185
|
}
|
|
3138
3186
|
|
|
3139
|
-
function
|
|
3187
|
+
function xe(t, e) {
|
|
3140
3188
|
return function(t, e) {
|
|
3141
3189
|
if (t.limit !== e.limit) return !1;
|
|
3142
3190
|
if (t.orderBy.length !== e.orderBy.length) return !1;
|
|
3143
|
-
for (let n = 0; n < t.orderBy.length; n++) if (!
|
|
3191
|
+
for (let n = 0; n < t.orderBy.length; n++) if (!we(t.orderBy[n], e.orderBy[n])) return !1;
|
|
3144
3192
|
if (t.filters.length !== e.filters.length) return !1;
|
|
3145
|
-
for (let n = 0; n < t.filters.length; n++) if (!
|
|
3146
|
-
return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!
|
|
3147
|
-
}(
|
|
3193
|
+
for (let n = 0; n < t.filters.length; n++) if (!se(t.filters[n], e.filters[n])) return !1;
|
|
3194
|
+
return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!te(t.startAt, e.startAt) && te(t.endAt, e.endAt);
|
|
3195
|
+
}(De(t), De(e)) && t.limitType === e.limitType;
|
|
3148
3196
|
}
|
|
3149
3197
|
|
|
3150
3198
|
/**
|
|
@@ -3172,9 +3220,9 @@ function De(t, e) {
|
|
|
3172
3220
|
* The return value is an IntegerValue if it can safely represent the value,
|
|
3173
3221
|
* otherwise a DoubleValue is returned.
|
|
3174
3222
|
*/
|
|
3175
|
-
function
|
|
3223
|
+
function Se(t, e) {
|
|
3176
3224
|
return function(t) {
|
|
3177
|
-
return "number" == typeof t && Number.isInteger(t) && !
|
|
3225
|
+
return "number" == typeof t && Number.isInteger(t) && !mt(t) && t <= Number.MAX_SAFE_INTEGER && t >= Number.MIN_SAFE_INTEGER;
|
|
3178
3226
|
}(e) ?
|
|
3179
3227
|
/**
|
|
3180
3228
|
* Returns an IntegerValue for `value`.
|
|
@@ -3196,7 +3244,7 @@ function Fe(t, e) {
|
|
|
3196
3244
|
};
|
|
3197
3245
|
}
|
|
3198
3246
|
return {
|
|
3199
|
-
doubleValue:
|
|
3247
|
+
doubleValue: mt(e) ? "-0" : e
|
|
3200
3248
|
};
|
|
3201
3249
|
}(t, e);
|
|
3202
3250
|
}
|
|
@@ -3217,7 +3265,7 @@ function Fe(t, e) {
|
|
|
3217
3265
|
* See the License for the specific language governing permissions and
|
|
3218
3266
|
* limitations under the License.
|
|
3219
3267
|
*/
|
|
3220
|
-
/** Used to represent a field transform on a mutation. */ class
|
|
3268
|
+
/** Used to represent a field transform on a mutation. */ class qe {
|
|
3221
3269
|
constructor() {
|
|
3222
3270
|
// Make sure that the structural type of `TransformOperation` is unique.
|
|
3223
3271
|
// See https://github.com/microsoft/TypeScript/issues/5451
|
|
@@ -3225,15 +3273,15 @@ function Fe(t, e) {
|
|
|
3225
3273
|
}
|
|
3226
3274
|
}
|
|
3227
3275
|
|
|
3228
|
-
/** Transforms a value into a server-generated timestamp. */ class
|
|
3276
|
+
/** Transforms a value into a server-generated timestamp. */ class Oe extends qe {}
|
|
3229
3277
|
|
|
3230
|
-
/** Transforms an array value via a union operation. */ class
|
|
3278
|
+
/** Transforms an array value via a union operation. */ class ke extends qe {
|
|
3231
3279
|
constructor(t) {
|
|
3232
3280
|
super(), this.elements = t;
|
|
3233
3281
|
}
|
|
3234
3282
|
}
|
|
3235
3283
|
|
|
3236
|
-
/** Transforms an array value via a remove operation. */ class
|
|
3284
|
+
/** Transforms an array value via a remove operation. */ class Ce extends qe {
|
|
3237
3285
|
constructor(t) {
|
|
3238
3286
|
super(), this.elements = t;
|
|
3239
3287
|
}
|
|
@@ -3244,7 +3292,7 @@ function Fe(t, e) {
|
|
|
3244
3292
|
* transforms. Converts all field values to integers or doubles, but unlike the
|
|
3245
3293
|
* backend does not cap integer values at 2^63. Instead, JavaScript number
|
|
3246
3294
|
* arithmetic is used and precision loss can occur for values greater than 2^53.
|
|
3247
|
-
*/ class
|
|
3295
|
+
*/ class Le extends qe {
|
|
3248
3296
|
constructor(t, e) {
|
|
3249
3297
|
super(), this.M = t, this.U = e;
|
|
3250
3298
|
}
|
|
@@ -3266,7 +3314,7 @@ function Fe(t, e) {
|
|
|
3266
3314
|
* See the License for the specific language governing permissions and
|
|
3267
3315
|
* limitations under the License.
|
|
3268
3316
|
*/
|
|
3269
|
-
/** A field path and the TransformOperation to perform upon it. */ class
|
|
3317
|
+
/** A field path and the TransformOperation to perform upon it. */ class Me {
|
|
3270
3318
|
constructor(t, e) {
|
|
3271
3319
|
this.field = t, this.transform = e;
|
|
3272
3320
|
}
|
|
@@ -3276,18 +3324,18 @@ function Fe(t, e) {
|
|
|
3276
3324
|
* Encodes a precondition for a mutation. This follows the model that the
|
|
3277
3325
|
* backend accepts with the special case of an explicit "empty" precondition
|
|
3278
3326
|
* (meaning no precondition).
|
|
3279
|
-
*/ class
|
|
3327
|
+
*/ class Ue {
|
|
3280
3328
|
constructor(t, e) {
|
|
3281
3329
|
this.updateTime = t, this.exists = e;
|
|
3282
3330
|
}
|
|
3283
3331
|
/** Creates a new empty Precondition. */ static none() {
|
|
3284
|
-
return new
|
|
3332
|
+
return new Ue;
|
|
3285
3333
|
}
|
|
3286
3334
|
/** Creates a new Precondition with an exists flag. */ static exists(t) {
|
|
3287
|
-
return new
|
|
3335
|
+
return new Ue(void 0, t);
|
|
3288
3336
|
}
|
|
3289
3337
|
/** Creates a new Precondition based on a version a document exists at. */ static updateTime(t) {
|
|
3290
|
-
return new
|
|
3338
|
+
return new Ue(t);
|
|
3291
3339
|
}
|
|
3292
3340
|
/** Returns whether this Precondition is empty. */ get isNone() {
|
|
3293
3341
|
return void 0 === this.updateTime && void 0 === this.exists;
|
|
@@ -3340,12 +3388,12 @@ function Fe(t, e) {
|
|
|
3340
3388
|
* applyToLocalView() to implement the actual behavior of applying the mutation
|
|
3341
3389
|
* to some source document (see `setMutationApplyToRemoteDocument()` for an
|
|
3342
3390
|
* example).
|
|
3343
|
-
*/ class
|
|
3391
|
+
*/ class je {}
|
|
3344
3392
|
|
|
3345
3393
|
/**
|
|
3346
3394
|
* A mutation that creates or replaces the document at the given key with the
|
|
3347
3395
|
* object value contents.
|
|
3348
|
-
*/ class
|
|
3396
|
+
*/ class Be extends je {
|
|
3349
3397
|
constructor(t, e, n, r = []) {
|
|
3350
3398
|
super(), this.key = t, this.value = e, this.precondition = n, this.fieldTransforms = r,
|
|
3351
3399
|
this.type = 0 /* MutationType.Set */;
|
|
@@ -3367,7 +3415,7 @@ function Fe(t, e) {
|
|
|
3367
3415
|
* is deleted.
|
|
3368
3416
|
* * When a field is not in the mask but is in the values, the values map is
|
|
3369
3417
|
* ignored.
|
|
3370
|
-
*/ class
|
|
3418
|
+
*/ class ze extends je {
|
|
3371
3419
|
constructor(t, e, n, r, s = []) {
|
|
3372
3420
|
super(), this.key = t, this.data = e, this.fieldMask = n, this.precondition = r,
|
|
3373
3421
|
this.fieldTransforms = s, this.type = 1 /* MutationType.Patch */;
|
|
@@ -3377,7 +3425,7 @@ function Fe(t, e) {
|
|
|
3377
3425
|
}
|
|
3378
3426
|
}
|
|
3379
3427
|
|
|
3380
|
-
/** A mutation that deletes the document at the given key. */ class
|
|
3428
|
+
/** A mutation that deletes the document at the given key. */ class Qe extends je {
|
|
3381
3429
|
constructor(t, e) {
|
|
3382
3430
|
super(), this.key = t, this.precondition = e, this.type = 2 /* MutationType.Delete */ ,
|
|
3383
3431
|
this.fieldTransforms = [];
|
|
@@ -3393,7 +3441,7 @@ function Fe(t, e) {
|
|
|
3393
3441
|
*
|
|
3394
3442
|
* The `verify` operation is only used in Transactions, and this class serves
|
|
3395
3443
|
* primarily to facilitate serialization into protos.
|
|
3396
|
-
*/ class
|
|
3444
|
+
*/ class We extends je {
|
|
3397
3445
|
constructor(t, e) {
|
|
3398
3446
|
super(), this.key = t, this.precondition = e, this.type = 3 /* MutationType.Verify */ ,
|
|
3399
3447
|
this.fieldTransforms = [];
|
|
@@ -3418,13 +3466,13 @@ function Fe(t, e) {
|
|
|
3418
3466
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3419
3467
|
* See the License for the specific language governing permissions and
|
|
3420
3468
|
* limitations under the License.
|
|
3421
|
-
*/ const
|
|
3469
|
+
*/ const Ge = (() => {
|
|
3422
3470
|
const t = {
|
|
3423
3471
|
asc: "ASCENDING",
|
|
3424
3472
|
desc: "DESCENDING"
|
|
3425
3473
|
};
|
|
3426
3474
|
return t;
|
|
3427
|
-
})(),
|
|
3475
|
+
})(), Ke = (() => {
|
|
3428
3476
|
const t = {
|
|
3429
3477
|
"<": "LESS_THAN",
|
|
3430
3478
|
"<=": "LESS_THAN_OR_EQUAL",
|
|
@@ -3438,7 +3486,7 @@ function Fe(t, e) {
|
|
|
3438
3486
|
"array-contains-any": "ARRAY_CONTAINS_ANY"
|
|
3439
3487
|
};
|
|
3440
3488
|
return t;
|
|
3441
|
-
})(),
|
|
3489
|
+
})(), Ye = (() => {
|
|
3442
3490
|
const t = {
|
|
3443
3491
|
and: "AND",
|
|
3444
3492
|
or: "OR"
|
|
@@ -3460,7 +3508,7 @@ function Fe(t, e) {
|
|
|
3460
3508
|
* TODO(klimt): We can remove the databaseId argument if we keep the full
|
|
3461
3509
|
* resource name in documents.
|
|
3462
3510
|
*/
|
|
3463
|
-
class
|
|
3511
|
+
class He {
|
|
3464
3512
|
constructor(t, e) {
|
|
3465
3513
|
this.databaseId = t, this.L = e;
|
|
3466
3514
|
}
|
|
@@ -3477,7 +3525,7 @@ class Ke {
|
|
|
3477
3525
|
/**
|
|
3478
3526
|
* Returns a value for a Date that's appropriate to put into a proto.
|
|
3479
3527
|
*/
|
|
3480
|
-
function
|
|
3528
|
+
function Ze(t, e) {
|
|
3481
3529
|
if (t.L) {
|
|
3482
3530
|
return `${new Date(1e3 * e.seconds).toISOString().replace(/\.\d*/, "").replace("Z", "")}.${("000000000" + e.nanoseconds).slice(-9)}Z`;
|
|
3483
3531
|
}
|
|
@@ -3492,35 +3540,35 @@ function Ye(t, e) {
|
|
|
3492
3540
|
*
|
|
3493
3541
|
* Visible for testing.
|
|
3494
3542
|
*/
|
|
3495
|
-
function
|
|
3543
|
+
function Je(t, e) {
|
|
3496
3544
|
return t.L ? e.toBase64() : e.toUint8Array();
|
|
3497
3545
|
}
|
|
3498
3546
|
|
|
3499
|
-
function
|
|
3500
|
-
return
|
|
3547
|
+
function Xe(t, e) {
|
|
3548
|
+
return Ze(t, e.toTimestamp());
|
|
3501
3549
|
}
|
|
3502
3550
|
|
|
3503
|
-
function
|
|
3504
|
-
return I(!!t),
|
|
3505
|
-
const e =
|
|
3506
|
-
return new
|
|
3551
|
+
function tn(t) {
|
|
3552
|
+
return I(!!t), me.fromTimestamp(function(t) {
|
|
3553
|
+
const e = St(t);
|
|
3554
|
+
return new kt(e.seconds, e.nanos);
|
|
3507
3555
|
}(t));
|
|
3508
3556
|
}
|
|
3509
3557
|
|
|
3510
|
-
function
|
|
3558
|
+
function en(t, e) {
|
|
3511
3559
|
return function(t) {
|
|
3512
3560
|
return new nt([ "projects", t.projectId, "databases", t.database ]);
|
|
3513
3561
|
}(t).child("documents").child(e).canonicalString();
|
|
3514
3562
|
}
|
|
3515
3563
|
|
|
3516
|
-
function
|
|
3517
|
-
return
|
|
3564
|
+
function nn(t, e) {
|
|
3565
|
+
return en(t.databaseId, e.path);
|
|
3518
3566
|
}
|
|
3519
3567
|
|
|
3520
|
-
function
|
|
3568
|
+
function rn(t, e) {
|
|
3521
3569
|
const n = function(t) {
|
|
3522
3570
|
const e = nt.fromString(t);
|
|
3523
|
-
return I(
|
|
3571
|
+
return I(yn(e)), e;
|
|
3524
3572
|
}(e);
|
|
3525
3573
|
if (n.get(1) !== t.databaseId.projectId) throw new B($, "Tried to deserialize key from different project: " + n.get(1) + " vs " + t.databaseId.projectId);
|
|
3526
3574
|
if (n.get(3) !== t.databaseId.database) throw new B($, "Tried to deserialize key from different database: " + n.get(3) + " vs " + t.databaseId.database);
|
|
@@ -3528,98 +3576,98 @@ function en(t, e) {
|
|
|
3528
3576
|
var r;
|
|
3529
3577
|
/** Creates a Document proto from key and fields (but no create/update time) */}
|
|
3530
3578
|
|
|
3531
|
-
function
|
|
3532
|
-
return
|
|
3579
|
+
function sn(t, e) {
|
|
3580
|
+
return en(t.databaseId, e);
|
|
3533
3581
|
}
|
|
3534
3582
|
|
|
3535
|
-
function
|
|
3583
|
+
function on(t) {
|
|
3536
3584
|
return new nt([ "projects", t.databaseId.projectId, "databases", t.databaseId.database ]).canonicalString();
|
|
3537
3585
|
}
|
|
3538
3586
|
|
|
3539
|
-
function
|
|
3587
|
+
function un(t, e, n) {
|
|
3540
3588
|
return {
|
|
3541
|
-
name:
|
|
3589
|
+
name: nn(t, e),
|
|
3542
3590
|
fields: n.value.mapValue.fields
|
|
3543
3591
|
};
|
|
3544
3592
|
}
|
|
3545
3593
|
|
|
3546
|
-
function
|
|
3594
|
+
function cn(t, e) {
|
|
3547
3595
|
return "found" in e ? function(t, e) {
|
|
3548
3596
|
I(!!e.found), e.found.name, e.found.updateTime;
|
|
3549
|
-
const n =
|
|
3597
|
+
const n = rn(t, e.found.name), r = tn(e.found.updateTime), s = e.found.createTime ? tn(e.found.createTime) : me.min(), i = new Ee({
|
|
3550
3598
|
mapValue: {
|
|
3551
3599
|
fields: e.found.fields
|
|
3552
3600
|
}
|
|
3553
3601
|
});
|
|
3554
|
-
return
|
|
3602
|
+
return Ae.newFoundDocument(n, r, s, i);
|
|
3555
3603
|
}(t, e) : "missing" in e ? function(t, e) {
|
|
3556
3604
|
I(!!e.missing), I(!!e.readTime);
|
|
3557
|
-
const n =
|
|
3558
|
-
return
|
|
3605
|
+
const n = rn(t, e.missing), r = tn(e.readTime);
|
|
3606
|
+
return Ae.newNoDocument(n, r);
|
|
3559
3607
|
}(t, e) : A();
|
|
3560
3608
|
}
|
|
3561
3609
|
|
|
3562
|
-
function
|
|
3610
|
+
function an(t, e) {
|
|
3563
3611
|
let n;
|
|
3564
|
-
if (e instanceof
|
|
3565
|
-
update:
|
|
3566
|
-
}; else if (e instanceof
|
|
3567
|
-
delete:
|
|
3568
|
-
}; else if (e instanceof
|
|
3569
|
-
update:
|
|
3570
|
-
updateMask:
|
|
3612
|
+
if (e instanceof Be) n = {
|
|
3613
|
+
update: un(t, e.key, e.value)
|
|
3614
|
+
}; else if (e instanceof Qe) n = {
|
|
3615
|
+
delete: nn(t, e.key)
|
|
3616
|
+
}; else if (e instanceof ze) n = {
|
|
3617
|
+
update: un(t, e.key, e.data),
|
|
3618
|
+
updateMask: pn(e.fieldMask)
|
|
3571
3619
|
}; else {
|
|
3572
|
-
if (!(e instanceof
|
|
3620
|
+
if (!(e instanceof We)) return A();
|
|
3573
3621
|
n = {
|
|
3574
|
-
verify:
|
|
3622
|
+
verify: nn(t, e.key)
|
|
3575
3623
|
};
|
|
3576
3624
|
}
|
|
3577
3625
|
return e.fieldTransforms.length > 0 && (n.updateTransforms = e.fieldTransforms.map((t => function(t, e) {
|
|
3578
3626
|
const n = e.transform;
|
|
3579
|
-
if (n instanceof
|
|
3627
|
+
if (n instanceof Oe) return {
|
|
3580
3628
|
fieldPath: e.field.canonicalString(),
|
|
3581
3629
|
setToServerValue: "REQUEST_TIME"
|
|
3582
3630
|
};
|
|
3583
|
-
if (n instanceof
|
|
3631
|
+
if (n instanceof ke) return {
|
|
3584
3632
|
fieldPath: e.field.canonicalString(),
|
|
3585
3633
|
appendMissingElements: {
|
|
3586
3634
|
values: n.elements
|
|
3587
3635
|
}
|
|
3588
3636
|
};
|
|
3589
|
-
if (n instanceof
|
|
3637
|
+
if (n instanceof Ce) return {
|
|
3590
3638
|
fieldPath: e.field.canonicalString(),
|
|
3591
3639
|
removeAllFromArray: {
|
|
3592
3640
|
values: n.elements
|
|
3593
3641
|
}
|
|
3594
3642
|
};
|
|
3595
|
-
if (n instanceof
|
|
3643
|
+
if (n instanceof Le) return {
|
|
3596
3644
|
fieldPath: e.field.canonicalString(),
|
|
3597
3645
|
increment: n.U
|
|
3598
3646
|
};
|
|
3599
3647
|
throw A();
|
|
3600
3648
|
}(0, t)))), e.precondition.isNone || (n.currentDocument = function(t, e) {
|
|
3601
3649
|
return void 0 !== e.updateTime ? {
|
|
3602
|
-
updateTime:
|
|
3650
|
+
updateTime: Xe(t, e.updateTime)
|
|
3603
3651
|
} : void 0 !== e.exists ? {
|
|
3604
3652
|
exists: e.exists
|
|
3605
3653
|
} : A();
|
|
3606
3654
|
}(t, e.precondition)), n;
|
|
3607
3655
|
}
|
|
3608
3656
|
|
|
3609
|
-
function
|
|
3657
|
+
function hn(t, e) {
|
|
3610
3658
|
// Dissect the path into parent, collectionId, and optional key filter.
|
|
3611
3659
|
const n = {
|
|
3612
3660
|
structuredQuery: {}
|
|
3613
3661
|
}, r = e.path;
|
|
3614
|
-
null !== e.collectionGroup ? (n.parent =
|
|
3662
|
+
null !== e.collectionGroup ? (n.parent = sn(t, r), n.structuredQuery.from = [ {
|
|
3615
3663
|
collectionId: e.collectionGroup,
|
|
3616
3664
|
allDescendants: !0
|
|
3617
|
-
} ]) : (n.parent =
|
|
3665
|
+
} ]) : (n.parent = sn(t, r.popLast()), n.structuredQuery.from = [ {
|
|
3618
3666
|
collectionId: r.lastSegment()
|
|
3619
3667
|
} ]);
|
|
3620
3668
|
const s = function(t) {
|
|
3621
3669
|
if (0 === t.length) return;
|
|
3622
|
-
return
|
|
3670
|
+
return mn(re.create(t, "and" /* CompositeOperator.AND */));
|
|
3623
3671
|
}(e.filters);
|
|
3624
3672
|
s && (n.structuredQuery.where = s);
|
|
3625
3673
|
const i = function(t) {
|
|
@@ -3628,8 +3676,8 @@ function cn(t, e) {
|
|
|
3628
3676
|
// visible for testing
|
|
3629
3677
|
function(t) {
|
|
3630
3678
|
return {
|
|
3631
|
-
field:
|
|
3632
|
-
direction:
|
|
3679
|
+
field: wn(t.field),
|
|
3680
|
+
direction: ln(t.dir)
|
|
3633
3681
|
};
|
|
3634
3682
|
}
|
|
3635
3683
|
// visible for testing
|
|
@@ -3637,7 +3685,7 @@ function cn(t, e) {
|
|
|
3637
3685
|
}(e.orderBy);
|
|
3638
3686
|
i && (n.structuredQuery.orderBy = i);
|
|
3639
3687
|
const o = function(t, e) {
|
|
3640
|
-
return t.L ||
|
|
3688
|
+
return t.L || wt(e) ? e : {
|
|
3641
3689
|
value: e
|
|
3642
3690
|
};
|
|
3643
3691
|
}(t, e.limit);
|
|
@@ -3655,81 +3703,81 @@ function cn(t, e) {
|
|
|
3655
3703
|
(e.endAt)), n;
|
|
3656
3704
|
}
|
|
3657
3705
|
|
|
3658
|
-
function
|
|
3659
|
-
return
|
|
3706
|
+
function ln(t) {
|
|
3707
|
+
return Ge[t];
|
|
3660
3708
|
}
|
|
3661
3709
|
|
|
3662
3710
|
// visible for testing
|
|
3663
|
-
function
|
|
3664
|
-
return
|
|
3711
|
+
function fn(t) {
|
|
3712
|
+
return Ke[t];
|
|
3665
3713
|
}
|
|
3666
3714
|
|
|
3667
|
-
function
|
|
3668
|
-
return
|
|
3715
|
+
function dn(t) {
|
|
3716
|
+
return Ye[t];
|
|
3669
3717
|
}
|
|
3670
3718
|
|
|
3671
|
-
function
|
|
3719
|
+
function wn(t) {
|
|
3672
3720
|
return {
|
|
3673
3721
|
fieldPath: t.canonicalString()
|
|
3674
3722
|
};
|
|
3675
3723
|
}
|
|
3676
3724
|
|
|
3677
|
-
function
|
|
3678
|
-
return t instanceof
|
|
3725
|
+
function mn(t) {
|
|
3726
|
+
return t instanceof ne ? function(t) {
|
|
3679
3727
|
if ("==" /* Operator.EQUAL */ === t.op) {
|
|
3680
|
-
if (
|
|
3728
|
+
if (Ht(t.value)) return {
|
|
3681
3729
|
unaryFilter: {
|
|
3682
|
-
field:
|
|
3730
|
+
field: wn(t.field),
|
|
3683
3731
|
op: "IS_NAN"
|
|
3684
3732
|
}
|
|
3685
3733
|
};
|
|
3686
|
-
if (
|
|
3734
|
+
if (Yt(t.value)) return {
|
|
3687
3735
|
unaryFilter: {
|
|
3688
|
-
field:
|
|
3736
|
+
field: wn(t.field),
|
|
3689
3737
|
op: "IS_NULL"
|
|
3690
3738
|
}
|
|
3691
3739
|
};
|
|
3692
3740
|
} else if ("!=" /* Operator.NOT_EQUAL */ === t.op) {
|
|
3693
|
-
if (
|
|
3741
|
+
if (Ht(t.value)) return {
|
|
3694
3742
|
unaryFilter: {
|
|
3695
|
-
field:
|
|
3743
|
+
field: wn(t.field),
|
|
3696
3744
|
op: "IS_NOT_NAN"
|
|
3697
3745
|
}
|
|
3698
3746
|
};
|
|
3699
|
-
if (
|
|
3747
|
+
if (Yt(t.value)) return {
|
|
3700
3748
|
unaryFilter: {
|
|
3701
|
-
field:
|
|
3749
|
+
field: wn(t.field),
|
|
3702
3750
|
op: "IS_NOT_NULL"
|
|
3703
3751
|
}
|
|
3704
3752
|
};
|
|
3705
3753
|
}
|
|
3706
3754
|
return {
|
|
3707
3755
|
fieldFilter: {
|
|
3708
|
-
field:
|
|
3709
|
-
op:
|
|
3756
|
+
field: wn(t.field),
|
|
3757
|
+
op: fn(t.op),
|
|
3710
3758
|
value: t.value
|
|
3711
3759
|
}
|
|
3712
3760
|
};
|
|
3713
|
-
}(t) : t instanceof
|
|
3714
|
-
const e = t.getFilters().map((t =>
|
|
3761
|
+
}(t) : t instanceof re ? function(t) {
|
|
3762
|
+
const e = t.getFilters().map((t => mn(t)));
|
|
3715
3763
|
if (1 === e.length) return e[0];
|
|
3716
3764
|
return {
|
|
3717
3765
|
compositeFilter: {
|
|
3718
|
-
op:
|
|
3766
|
+
op: dn(t.op),
|
|
3719
3767
|
filters: e
|
|
3720
3768
|
}
|
|
3721
3769
|
};
|
|
3722
3770
|
}(t) : A();
|
|
3723
3771
|
}
|
|
3724
3772
|
|
|
3725
|
-
function
|
|
3773
|
+
function pn(t) {
|
|
3726
3774
|
const e = [];
|
|
3727
3775
|
return t.fields.forEach((t => e.push(t.canonicalString()))), {
|
|
3728
3776
|
fieldPaths: e
|
|
3729
3777
|
};
|
|
3730
3778
|
}
|
|
3731
3779
|
|
|
3732
|
-
function
|
|
3780
|
+
function yn(t) {
|
|
3733
3781
|
// Resource names have at least 4 components (project ID, database ID)
|
|
3734
3782
|
return t.length >= 4 && "projects" === t.get(0) && "databases" === t.get(2);
|
|
3735
3783
|
}
|
|
@@ -3749,8 +3797,8 @@ function mn(t) {
|
|
|
3749
3797
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3750
3798
|
* See the License for the specific language governing permissions and
|
|
3751
3799
|
* limitations under the License.
|
|
3752
|
-
*/ function
|
|
3753
|
-
return new
|
|
3800
|
+
*/ function gn(t) {
|
|
3801
|
+
return new He(t, /* useProto3Json= */ !0);
|
|
3754
3802
|
}
|
|
3755
3803
|
|
|
3756
3804
|
/**
|
|
@@ -3778,7 +3826,7 @@ function mn(t) {
|
|
|
3778
3826
|
* base delay. This prevents clients from accidentally synchronizing their
|
|
3779
3827
|
* delays causing spikes of load to the backend.
|
|
3780
3828
|
*/
|
|
3781
|
-
class
|
|
3829
|
+
class _n {
|
|
3782
3830
|
constructor(
|
|
3783
3831
|
/**
|
|
3784
3832
|
* The AsyncQueue to run backoff operations on.
|
|
@@ -3876,7 +3924,7 @@ class yn {
|
|
|
3876
3924
|
* An implementation of Datastore that exposes additional state for internal
|
|
3877
3925
|
* consumption.
|
|
3878
3926
|
*/
|
|
3879
|
-
class
|
|
3927
|
+
class vn extends class {} {
|
|
3880
3928
|
constructor(t, e, n, r) {
|
|
3881
3929
|
super(), this.authCredentials = t, this.appCheckCredentials = e, this.connection = n,
|
|
3882
3930
|
this.M = r, this.et = !1;
|
|
@@ -3903,19 +3951,19 @@ class gn extends class {} {
|
|
|
3903
3951
|
|
|
3904
3952
|
// TODO(firestorexp): Make sure there is only one Datastore instance per
|
|
3905
3953
|
// firestore-exp client.
|
|
3906
|
-
async function
|
|
3907
|
-
const n = T(t), r =
|
|
3908
|
-
writes: e.map((t =>
|
|
3954
|
+
async function bn(t, e) {
|
|
3955
|
+
const n = T(t), r = on(n.M) + "/documents", s = {
|
|
3956
|
+
writes: e.map((t => an(n.M, t)))
|
|
3909
3957
|
};
|
|
3910
3958
|
await n.A("Commit", r, s);
|
|
3911
3959
|
}
|
|
3912
3960
|
|
|
3913
|
-
async function
|
|
3914
|
-
const n = T(t), r =
|
|
3915
|
-
documents: e.map((t =>
|
|
3961
|
+
async function En(t, e) {
|
|
3962
|
+
const n = T(t), r = on(n.M) + "/documents", s = {
|
|
3963
|
+
documents: e.map((t => nn(n.M, t)))
|
|
3916
3964
|
}, i = await n.P("BatchGetDocuments", r, s, e.length), o = new Map;
|
|
3917
3965
|
i.forEach((t => {
|
|
3918
|
-
const e =
|
|
3966
|
+
const e = cn(n.M, t);
|
|
3919
3967
|
o.set(e.key.toString(), e);
|
|
3920
3968
|
}));
|
|
3921
3969
|
const u = [];
|
|
@@ -3925,23 +3973,23 @@ async function vn(t, e) {
|
|
|
3925
3973
|
})), u;
|
|
3926
3974
|
}
|
|
3927
3975
|
|
|
3928
|
-
async function
|
|
3929
|
-
const n = T(t), r =
|
|
3976
|
+
async function An(t, e) {
|
|
3977
|
+
const n = T(t), r = hn(n.M, De(e));
|
|
3930
3978
|
return (await n.P("RunQuery", r.parent, {
|
|
3931
3979
|
structuredQuery: r.structuredQuery
|
|
3932
3980
|
})).filter((t => !!t.document)).map((t => function(t, e, n) {
|
|
3933
|
-
const r =
|
|
3981
|
+
const r = rn(t, e.name), s = tn(e.updateTime), i = e.createTime ? tn(e.createTime) : me.min(), o = new Ee({
|
|
3934
3982
|
mapValue: {
|
|
3935
3983
|
fields: e.fields
|
|
3936
3984
|
}
|
|
3937
|
-
}), u =
|
|
3985
|
+
}), u = Ae.newFoundDocument(r, s, i, o);
|
|
3938
3986
|
return n && u.setHasCommittedMutations(), n ? u.setHasCommittedMutations() : u;
|
|
3939
3987
|
}(n.M, t.document, void 0)));
|
|
3940
3988
|
}
|
|
3941
3989
|
|
|
3942
|
-
async function
|
|
3990
|
+
async function In(t, e, n) {
|
|
3943
3991
|
const r = T(t), s = function(t, e, n) {
|
|
3944
|
-
const r =
|
|
3992
|
+
const r = hn(t, e), s = [];
|
|
3945
3993
|
return n.forEach((t => {
|
|
3946
3994
|
"count" === t.D ? s.push({
|
|
3947
3995
|
alias: t.alias.canonicalString(),
|
|
@@ -3949,12 +3997,12 @@ async function En(t, e, n) {
|
|
|
3949
3997
|
}) : "avg" === t.D ? s.push({
|
|
3950
3998
|
alias: t.alias.canonicalString(),
|
|
3951
3999
|
avg: {
|
|
3952
|
-
field:
|
|
4000
|
+
field: wn(t.fieldPath)
|
|
3953
4001
|
}
|
|
3954
4002
|
}) : "sum" === t.D && s.push({
|
|
3955
4003
|
alias: t.alias.canonicalString(),
|
|
3956
4004
|
sum: {
|
|
3957
|
-
field:
|
|
4005
|
+
field: wn(t.fieldPath)
|
|
3958
4006
|
}
|
|
3959
4007
|
});
|
|
3960
4008
|
})), {
|
|
@@ -3964,11 +4012,11 @@ async function En(t, e, n) {
|
|
|
3964
4012
|
},
|
|
3965
4013
|
parent: r.parent
|
|
3966
4014
|
};
|
|
3967
|
-
}(r.M,
|
|
4015
|
+
}(r.M, De(e), n), i = s.parent;
|
|
3968
4016
|
r.connection.v || delete s.parent;
|
|
3969
4017
|
const o = (await r.P("RunAggregationQuery", i, s, /*expectedResponseCount=*/ 1)).filter((t => !!t.result));
|
|
3970
4018
|
// Omit RunAggregationQueryResponse that only contain readTimes.
|
|
3971
|
-
return I(1 === o.length), (u = o[0]).result, u.result.aggregateFields, new
|
|
4019
|
+
return I(1 === o.length), (u = o[0]).result, u.result.aggregateFields, new Ee({
|
|
3972
4020
|
mapValue: {
|
|
3973
4021
|
fields: null === (c = u.result) || void 0 === c ? void 0 : c.aggregateFields
|
|
3974
4022
|
}
|
|
@@ -3991,7 +4039,7 @@ async function En(t, e, n) {
|
|
|
3991
4039
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3992
4040
|
* See the License for the specific language governing permissions and
|
|
3993
4041
|
* limitations under the License.
|
|
3994
|
-
*/ const
|
|
4042
|
+
*/ const Tn = new Map;
|
|
3995
4043
|
|
|
3996
4044
|
/**
|
|
3997
4045
|
* An instance map that ensures only one Datastore exists per Firestore
|
|
@@ -4002,17 +4050,17 @@ async function En(t, e, n) {
|
|
|
4002
4050
|
* instance. Callers must invoke removeComponents() when the Firestore
|
|
4003
4051
|
* instance is terminated.
|
|
4004
4052
|
*/
|
|
4005
|
-
function
|
|
4053
|
+
function Rn(t) {
|
|
4006
4054
|
if (t._terminated) throw new B(O, "The client has already been terminated.");
|
|
4007
|
-
if (!
|
|
4055
|
+
if (!Tn.has(t)) {
|
|
4008
4056
|
_("ComponentProvider", "Initializing Datastore");
|
|
4009
4057
|
const i = function(t) {
|
|
4010
|
-
return new
|
|
4058
|
+
return new vt(t, fetch.bind(null));
|
|
4011
4059
|
}((e = t._databaseId, n = t.app.options.appId || "", r = t._persistenceKey, s = t._freezeSettings(),
|
|
4012
|
-
new X(e, n, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), o =
|
|
4013
|
-
return new
|
|
4060
|
+
new X(e, n, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), o = gn(t._databaseId), u = function(t, e, n, r) {
|
|
4061
|
+
return new vn(t, e, n, r);
|
|
4014
4062
|
}(t._authCredentials, t._appCheckCredentials, i, o);
|
|
4015
|
-
|
|
4063
|
+
Tn.set(t, u);
|
|
4016
4064
|
}
|
|
4017
4065
|
var e, n, r, s;
|
|
4018
4066
|
/**
|
|
@@ -4030,7 +4078,7 @@ function In(t) {
|
|
|
4030
4078
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4031
4079
|
* See the License for the specific language governing permissions and
|
|
4032
4080
|
* limitations under the License.
|
|
4033
|
-
*/ return
|
|
4081
|
+
*/ return Tn.get(t);
|
|
4034
4082
|
}
|
|
4035
4083
|
|
|
4036
4084
|
/**
|
|
@@ -4042,7 +4090,7 @@ function In(t) {
|
|
|
4042
4090
|
* user-supplied `FirestoreSettings` object. This is a separate type so that
|
|
4043
4091
|
* defaults can be supplied and the value can be checked for equality.
|
|
4044
4092
|
*/
|
|
4045
|
-
class
|
|
4093
|
+
class Pn {
|
|
4046
4094
|
constructor(t) {
|
|
4047
4095
|
var e;
|
|
4048
4096
|
if (void 0 === t.host) {
|
|
@@ -4084,7 +4132,7 @@ class Tn {
|
|
|
4084
4132
|
* The Cloud Firestore service interface.
|
|
4085
4133
|
*
|
|
4086
4134
|
* Do not call this constructor directly. Instead, use {@link (getFirestore:1)}.
|
|
4087
|
-
*/ class
|
|
4135
|
+
*/ class Vn {
|
|
4088
4136
|
/** @hideconstructor */
|
|
4089
4137
|
constructor(t, e, n, r) {
|
|
4090
4138
|
this._authCredentials = t, this._appCheckCredentials = e, this._databaseId = n,
|
|
@@ -4092,7 +4140,7 @@ class Tn {
|
|
|
4092
4140
|
/**
|
|
4093
4141
|
* Whether it's a Firestore or Firestore Lite instance.
|
|
4094
4142
|
*/
|
|
4095
|
-
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new
|
|
4143
|
+
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new Pn({}),
|
|
4096
4144
|
this._settingsFrozen = !1;
|
|
4097
4145
|
}
|
|
4098
4146
|
/**
|
|
@@ -4110,7 +4158,7 @@ class Tn {
|
|
|
4110
4158
|
}
|
|
4111
4159
|
_setSettings(t) {
|
|
4112
4160
|
if (this._settingsFrozen) throw new B(O, "Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");
|
|
4113
|
-
this._settings = new
|
|
4161
|
+
this._settings = new Pn(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
|
|
4114
4162
|
if (!t) return new W;
|
|
4115
4163
|
switch (t.type) {
|
|
4116
4164
|
case "gapi":
|
|
@@ -4149,13 +4197,13 @@ class Tn {
|
|
|
4149
4197
|
* Only ever called once.
|
|
4150
4198
|
*/ _terminate() {
|
|
4151
4199
|
return function(t) {
|
|
4152
|
-
const e =
|
|
4153
|
-
e && (_("ComponentProvider", "Removing Datastore"),
|
|
4200
|
+
const e = Tn.get(t);
|
|
4201
|
+
e && (_("ComponentProvider", "Removing Datastore"), Tn.delete(t), e.terminate());
|
|
4154
4202
|
}(this), Promise.resolve();
|
|
4155
4203
|
}
|
|
4156
4204
|
}
|
|
4157
4205
|
|
|
4158
|
-
function
|
|
4206
|
+
function $n(t, e, n) {
|
|
4159
4207
|
n || (n = "(default)");
|
|
4160
4208
|
const r = _getProvider(t, "firestore/lite");
|
|
4161
4209
|
if (r.isInitialized(n)) throw new B(O, "Firestore can only be initialized once per app.");
|
|
@@ -4165,13 +4213,13 @@ function Pn(t, e, n) {
|
|
|
4165
4213
|
});
|
|
4166
4214
|
}
|
|
4167
4215
|
|
|
4168
|
-
function
|
|
4216
|
+
function Nn(e, n) {
|
|
4169
4217
|
const r = "object" == typeof e ? e : t(), s = "string" == typeof e ? e : n || "(default)", i = _getProvider(r, "firestore/lite").getImmediate({
|
|
4170
4218
|
identifier: s
|
|
4171
4219
|
});
|
|
4172
4220
|
if (!i._initialized) {
|
|
4173
4221
|
const t = l("firestore");
|
|
4174
|
-
t &&
|
|
4222
|
+
t && Dn(i, ...t);
|
|
4175
4223
|
}
|
|
4176
4224
|
return i;
|
|
4177
4225
|
}
|
|
@@ -4188,9 +4236,9 @@ function Vn(e, n) {
|
|
|
4188
4236
|
* @param port - the emulator port (ex: 9000).
|
|
4189
4237
|
* @param options.mockUserToken - the mock auth token to use for unit testing
|
|
4190
4238
|
* Security Rules.
|
|
4191
|
-
*/ function
|
|
4239
|
+
*/ function Dn(t, e, n, r = {}) {
|
|
4192
4240
|
var s;
|
|
4193
|
-
const i = (t = ht(t,
|
|
4241
|
+
const i = (t = ht(t, Vn))._getSettings();
|
|
4194
4242
|
if ("firestore.googleapis.com" !== i.host && i.host !== e && b("Host has been set in both settings() and useEmulator(), emulator host will be used"),
|
|
4195
4243
|
t._setSettings(Object.assign(Object.assign({}, i), {
|
|
4196
4244
|
host: `${e}:${n}`,
|
|
@@ -4228,8 +4276,8 @@ function Vn(e, n) {
|
|
|
4228
4276
|
* @param firestore - The `Firestore` instance to terminate.
|
|
4229
4277
|
* @returns A `Promise` that is resolved when the instance has been successfully
|
|
4230
4278
|
* terminated.
|
|
4231
|
-
*/ function
|
|
4232
|
-
return t = ht(t,
|
|
4279
|
+
*/ function Fn(t) {
|
|
4280
|
+
return t = ht(t, Vn), e(t.app, "firestore/lite"), t._delete();
|
|
4233
4281
|
}
|
|
4234
4282
|
|
|
4235
4283
|
/**
|
|
@@ -4268,7 +4316,7 @@ function Vn(e, n) {
|
|
|
4268
4316
|
* Represents an aggregation that can be performed by Firestore.
|
|
4269
4317
|
*/
|
|
4270
4318
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4271
|
-
class
|
|
4319
|
+
class xn {
|
|
4272
4320
|
/**
|
|
4273
4321
|
* Create a new AggregateField<T>
|
|
4274
4322
|
* @param _aggregateType Specifies the type of aggregation operation to perform.
|
|
@@ -4286,7 +4334,7 @@ class Dn {
|
|
|
4286
4334
|
|
|
4287
4335
|
/**
|
|
4288
4336
|
* The results of executing an aggregation query.
|
|
4289
|
-
*/ class
|
|
4337
|
+
*/ class Sn {
|
|
4290
4338
|
/** @hideconstructor */
|
|
4291
4339
|
constructor(t, e, n) {
|
|
4292
4340
|
this._userDataWriter = e, this._data = n,
|
|
@@ -4328,7 +4376,7 @@ class Dn {
|
|
|
4328
4376
|
* A `DocumentReference` refers to a document location in a Firestore database
|
|
4329
4377
|
* and can be used to write, read, or listen to the location. The document at
|
|
4330
4378
|
* the referenced location may or may not exist.
|
|
4331
|
-
*/ class
|
|
4379
|
+
*/ class qn {
|
|
4332
4380
|
/** @hideconstructor */
|
|
4333
4381
|
constructor(t,
|
|
4334
4382
|
/**
|
|
@@ -4356,17 +4404,17 @@ class Dn {
|
|
|
4356
4404
|
/**
|
|
4357
4405
|
* The collection this `DocumentReference` belongs to.
|
|
4358
4406
|
*/ get parent() {
|
|
4359
|
-
return new
|
|
4407
|
+
return new kn(this.firestore, this.converter, this._key.path.popLast());
|
|
4360
4408
|
}
|
|
4361
4409
|
withConverter(t) {
|
|
4362
|
-
return new
|
|
4410
|
+
return new qn(this.firestore, t, this._key);
|
|
4363
4411
|
}
|
|
4364
4412
|
}
|
|
4365
4413
|
|
|
4366
4414
|
/**
|
|
4367
4415
|
* A `Query` refers to a query which you can read or listen to. You can also
|
|
4368
4416
|
* construct refined `Query` objects by adding filters and ordering.
|
|
4369
|
-
*/ class
|
|
4417
|
+
*/ class On {
|
|
4370
4418
|
// This is the lite version of the Query class in the main SDK.
|
|
4371
4419
|
/** @hideconstructor protected */
|
|
4372
4420
|
constructor(t,
|
|
@@ -4379,17 +4427,17 @@ class Dn {
|
|
|
4379
4427
|
this.type = "query", this.firestore = t;
|
|
4380
4428
|
}
|
|
4381
4429
|
withConverter(t) {
|
|
4382
|
-
return new
|
|
4430
|
+
return new On(this.firestore, t, this._query);
|
|
4383
4431
|
}
|
|
4384
4432
|
}
|
|
4385
4433
|
|
|
4386
4434
|
/**
|
|
4387
4435
|
* A `CollectionReference` object can be used for adding documents, getting
|
|
4388
|
-
* document references, and querying for documents (using {@link query}).
|
|
4389
|
-
*/ class
|
|
4436
|
+
* document references, and querying for documents (using {@link (query:1)}).
|
|
4437
|
+
*/ class kn extends On {
|
|
4390
4438
|
/** @hideconstructor */
|
|
4391
4439
|
constructor(t, e, n) {
|
|
4392
|
-
super(t, e, new
|
|
4440
|
+
super(t, e, new Re(n)), this._path = n,
|
|
4393
4441
|
/** The type of this Firestore reference. */
|
|
4394
4442
|
this.type = "collection";
|
|
4395
4443
|
}
|
|
@@ -4407,23 +4455,23 @@ class Dn {
|
|
|
4407
4455
|
* subcollection. If this isn't a subcollection, the reference is null.
|
|
4408
4456
|
*/ get parent() {
|
|
4409
4457
|
const t = this._path.popLast();
|
|
4410
|
-
return t.isEmpty() ? null : new
|
|
4458
|
+
return t.isEmpty() ? null : new qn(this.firestore,
|
|
4411
4459
|
/* converter= */ null, new it(t));
|
|
4412
4460
|
}
|
|
4413
4461
|
withConverter(t) {
|
|
4414
|
-
return new
|
|
4462
|
+
return new kn(this.firestore, t, this._path);
|
|
4415
4463
|
}
|
|
4416
4464
|
}
|
|
4417
4465
|
|
|
4418
|
-
function
|
|
4419
|
-
if (t = d(t), ot("collection", "path", e), t instanceof
|
|
4466
|
+
function Cn(t, e, ...n) {
|
|
4467
|
+
if (t = d(t), ot("collection", "path", e), t instanceof Vn) {
|
|
4420
4468
|
const r = nt.fromString(e, ...n);
|
|
4421
|
-
return ct(r), new
|
|
4469
|
+
return ct(r), new kn(t, /* converter= */ null, r);
|
|
4422
4470
|
}
|
|
4423
4471
|
{
|
|
4424
|
-
if (!(t instanceof
|
|
4472
|
+
if (!(t instanceof qn || t instanceof kn)) throw new B($, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
4425
4473
|
const r = t._path.child(nt.fromString(e, ...n));
|
|
4426
|
-
return ct(r), new
|
|
4474
|
+
return ct(r), new kn(t.firestore,
|
|
4427
4475
|
/* converter= */ null, r);
|
|
4428
4476
|
}
|
|
4429
4477
|
}
|
|
@@ -4440,27 +4488,27 @@ function On(t, e, ...n) {
|
|
|
4440
4488
|
* collection or subcollection with this ID as the last segment of its path
|
|
4441
4489
|
* will be included. Cannot contain a slash.
|
|
4442
4490
|
* @returns The created `Query`.
|
|
4443
|
-
*/ function
|
|
4444
|
-
if (t = ht(t,
|
|
4445
|
-
return new
|
|
4491
|
+
*/ function Ln(t, e) {
|
|
4492
|
+
if (t = ht(t, Vn), ot("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new B($, `Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
|
|
4493
|
+
return new On(t,
|
|
4446
4494
|
/* converter= */ null, function(t) {
|
|
4447
|
-
return new
|
|
4495
|
+
return new Re(nt.emptyPath(), t);
|
|
4448
4496
|
}(e));
|
|
4449
4497
|
}
|
|
4450
4498
|
|
|
4451
|
-
function
|
|
4499
|
+
function Mn(t, e, ...n) {
|
|
4452
4500
|
if (t = d(t),
|
|
4453
4501
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
4454
4502
|
// 'undefined' and 'null'.
|
|
4455
|
-
1 === arguments.length && (e =
|
|
4503
|
+
1 === arguments.length && (e = Tt.F()), ot("doc", "path", e), t instanceof Vn) {
|
|
4456
4504
|
const r = nt.fromString(e, ...n);
|
|
4457
|
-
return ut(r), new
|
|
4505
|
+
return ut(r), new qn(t,
|
|
4458
4506
|
/* converter= */ null, new it(r));
|
|
4459
4507
|
}
|
|
4460
4508
|
{
|
|
4461
|
-
if (!(t instanceof
|
|
4509
|
+
if (!(t instanceof qn || t instanceof kn)) throw new B($, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
4462
4510
|
const r = t._path.child(nt.fromString(e, ...n));
|
|
4463
|
-
return ut(r), new
|
|
4511
|
+
return ut(r), new qn(t.firestore, t instanceof kn ? t.converter : null, new it(r));
|
|
4464
4512
|
}
|
|
4465
4513
|
}
|
|
4466
4514
|
|
|
@@ -4471,8 +4519,8 @@ function Cn(t, e, ...n) {
|
|
|
4471
4519
|
* @param right - A reference to compare.
|
|
4472
4520
|
* @returns true if the references point to the same location in the same
|
|
4473
4521
|
* Firestore database.
|
|
4474
|
-
*/ function
|
|
4475
|
-
return t = d(t), e = d(e), (t instanceof
|
|
4522
|
+
*/ function Un(t, e) {
|
|
4523
|
+
return t = d(t), e = d(e), (t instanceof qn || t instanceof kn) && (e instanceof qn || e instanceof kn) && (t.firestore === e.firestore && t.path === e.path && t.converter === e.converter);
|
|
4476
4524
|
}
|
|
4477
4525
|
|
|
4478
4526
|
/**
|
|
@@ -4483,8 +4531,8 @@ function Cn(t, e, ...n) {
|
|
|
4483
4531
|
* @param right - A `Query` to compare.
|
|
4484
4532
|
* @returns true if the references point to the same location in the same
|
|
4485
4533
|
* Firestore database.
|
|
4486
|
-
*/ function
|
|
4487
|
-
return t = d(t), e = d(e), t instanceof
|
|
4534
|
+
*/ function jn(t, e) {
|
|
4535
|
+
return t = d(t), e = d(e), t instanceof On && e instanceof On && (t.firestore === e.firestore && xe(t._query, e._query) && t.converter === e.converter);
|
|
4488
4536
|
}
|
|
4489
4537
|
|
|
4490
4538
|
/**
|
|
@@ -4505,7 +4553,7 @@ function Cn(t, e, ...n) {
|
|
|
4505
4553
|
*/
|
|
4506
4554
|
/**
|
|
4507
4555
|
* An immutable object representing an array of bytes.
|
|
4508
|
-
*/ class
|
|
4556
|
+
*/ class Bn {
|
|
4509
4557
|
/** @hideconstructor */
|
|
4510
4558
|
constructor(t) {
|
|
4511
4559
|
this._byteString = t;
|
|
@@ -4517,7 +4565,7 @@ function Cn(t, e, ...n) {
|
|
|
4517
4565
|
* @param base64 - The Base64 string used to create the `Bytes` object.
|
|
4518
4566
|
*/ static fromBase64String(t) {
|
|
4519
4567
|
try {
|
|
4520
|
-
return new
|
|
4568
|
+
return new Bn(Ft.fromBase64String(t));
|
|
4521
4569
|
} catch (t) {
|
|
4522
4570
|
throw new B($, "Failed to construct data from Base64 string: " + t);
|
|
4523
4571
|
}
|
|
@@ -4527,7 +4575,7 @@ function Cn(t, e, ...n) {
|
|
|
4527
4575
|
*
|
|
4528
4576
|
* @param array - The Uint8Array used to create the `Bytes` object.
|
|
4529
4577
|
*/ static fromUint8Array(t) {
|
|
4530
|
-
return new
|
|
4578
|
+
return new Bn(Ft.fromUint8Array(t));
|
|
4531
4579
|
}
|
|
4532
4580
|
/**
|
|
4533
4581
|
* Returns the underlying bytes as a Base64-encoded string.
|
|
@@ -4583,7 +4631,7 @@ function Cn(t, e, ...n) {
|
|
|
4583
4631
|
*
|
|
4584
4632
|
* Create a `FieldPath` by providing field names. If more than one field
|
|
4585
4633
|
* name is provided, the path will point to a nested field in a document.
|
|
4586
|
-
*/ class
|
|
4634
|
+
*/ class zn {
|
|
4587
4635
|
/**
|
|
4588
4636
|
* Creates a `FieldPath` from the provided field names. If more than one field
|
|
4589
4637
|
* name is provided, the path will point to a nested field in a document.
|
|
@@ -4607,8 +4655,8 @@ function Cn(t, e, ...n) {
|
|
|
4607
4655
|
/**
|
|
4608
4656
|
* Returns a special sentinel `FieldPath` to refer to the ID of a document.
|
|
4609
4657
|
* It can be used in queries to sort or filter by the document ID.
|
|
4610
|
-
*/ function
|
|
4611
|
-
return new
|
|
4658
|
+
*/ function Qn() {
|
|
4659
|
+
return new zn("__name__");
|
|
4612
4660
|
}
|
|
4613
4661
|
|
|
4614
4662
|
/**
|
|
@@ -4630,7 +4678,7 @@ function Cn(t, e, ...n) {
|
|
|
4630
4678
|
/**
|
|
4631
4679
|
* Sentinel values that can be used when writing document fields with `set()`
|
|
4632
4680
|
* or `update()`.
|
|
4633
|
-
*/ class
|
|
4681
|
+
*/ class Wn {
|
|
4634
4682
|
/**
|
|
4635
4683
|
* @param _methodName - The public API endpoint that returns this class.
|
|
4636
4684
|
* @hideconstructor
|
|
@@ -4662,7 +4710,7 @@ function Cn(t, e, ...n) {
|
|
|
4662
4710
|
*
|
|
4663
4711
|
* Latitude values are in the range of [-90, 90].
|
|
4664
4712
|
* Longitude values are in the range of [-180, 180].
|
|
4665
|
-
*/ class
|
|
4713
|
+
*/ class Gn {
|
|
4666
4714
|
/**
|
|
4667
4715
|
* Creates a new immutable `GeoPoint` object with the provided latitude and
|
|
4668
4716
|
* longitude values.
|
|
@@ -4702,7 +4750,7 @@ function Cn(t, e, ...n) {
|
|
|
4702
4750
|
* Actually private to JS consumers of our API, so this function is prefixed
|
|
4703
4751
|
* with an underscore.
|
|
4704
4752
|
*/ _compareTo(t) {
|
|
4705
|
-
return
|
|
4753
|
+
return Rt(this._lat, t._lat) || Rt(this._long, t._long);
|
|
4706
4754
|
}
|
|
4707
4755
|
}
|
|
4708
4756
|
|
|
@@ -4721,29 +4769,29 @@ function Cn(t, e, ...n) {
|
|
|
4721
4769
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4722
4770
|
* See the License for the specific language governing permissions and
|
|
4723
4771
|
* limitations under the License.
|
|
4724
|
-
*/ const
|
|
4772
|
+
*/ const Kn = /^__.*__$/;
|
|
4725
4773
|
|
|
4726
|
-
/** The result of parsing document data (e.g. for a setData call). */ class
|
|
4774
|
+
/** The result of parsing document data (e.g. for a setData call). */ class Yn {
|
|
4727
4775
|
constructor(t, e, n) {
|
|
4728
4776
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
4729
4777
|
}
|
|
4730
4778
|
toMutation(t, e) {
|
|
4731
|
-
return null !== this.fieldMask ? new
|
|
4779
|
+
return null !== this.fieldMask ? new ze(t, this.data, this.fieldMask, e, this.fieldTransforms) : new Be(t, this.data, e, this.fieldTransforms);
|
|
4732
4780
|
}
|
|
4733
4781
|
}
|
|
4734
4782
|
|
|
4735
|
-
/** The result of parsing "update" data (i.e. for an updateData call). */ class
|
|
4783
|
+
/** The result of parsing "update" data (i.e. for an updateData call). */ class Hn {
|
|
4736
4784
|
constructor(t,
|
|
4737
4785
|
// The fieldMask does not include document transforms.
|
|
4738
4786
|
e, n) {
|
|
4739
4787
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
4740
4788
|
}
|
|
4741
4789
|
toMutation(t, e) {
|
|
4742
|
-
return new
|
|
4790
|
+
return new ze(t, this.data, this.fieldMask, e, this.fieldTransforms);
|
|
4743
4791
|
}
|
|
4744
4792
|
}
|
|
4745
4793
|
|
|
4746
|
-
function
|
|
4794
|
+
function Zn(t) {
|
|
4747
4795
|
switch (t) {
|
|
4748
4796
|
case 0 /* UserDataSource.Set */ :
|
|
4749
4797
|
// fall through
|
|
@@ -4761,7 +4809,7 @@ function Yn(t) {
|
|
|
4761
4809
|
}
|
|
4762
4810
|
}
|
|
4763
4811
|
|
|
4764
|
-
/** A "context" object passed around while parsing user data. */ class
|
|
4812
|
+
/** A "context" object passed around while parsing user data. */ class Jn {
|
|
4765
4813
|
/**
|
|
4766
4814
|
* Initializes a ParseContext with the given source and path.
|
|
4767
4815
|
*
|
|
@@ -4793,7 +4841,7 @@ function Yn(t) {
|
|
|
4793
4841
|
return this.settings.st;
|
|
4794
4842
|
}
|
|
4795
4843
|
/** Returns a new context with the specified settings overwritten. */ it(t) {
|
|
4796
|
-
return new
|
|
4844
|
+
return new Jn(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.M, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
|
|
4797
4845
|
}
|
|
4798
4846
|
ot(t) {
|
|
4799
4847
|
var e;
|
|
@@ -4820,7 +4868,7 @@ function Yn(t) {
|
|
|
4820
4868
|
});
|
|
4821
4869
|
}
|
|
4822
4870
|
lt(t) {
|
|
4823
|
-
return
|
|
4871
|
+
return gr(t, this.settings.methodName, this.settings.ft || !1, this.path, this.settings.dt);
|
|
4824
4872
|
}
|
|
4825
4873
|
/** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
|
|
4826
4874
|
return void 0 !== this.fieldMask.find((e => t.isPrefixOf(e))) || void 0 !== this.fieldTransforms.find((e => t.isPrefixOf(e.field)));
|
|
@@ -4832,19 +4880,19 @@ function Yn(t) {
|
|
|
4832
4880
|
}
|
|
4833
4881
|
ct(t) {
|
|
4834
4882
|
if (0 === t.length) throw this.lt("Document fields must not be empty");
|
|
4835
|
-
if (
|
|
4883
|
+
if (Zn(this.st) && Kn.test(t)) throw this.lt('Document fields cannot begin and end with "__"');
|
|
4836
4884
|
}
|
|
4837
4885
|
}
|
|
4838
4886
|
|
|
4839
4887
|
/**
|
|
4840
4888
|
* Helper for parsing raw user input (provided via the API) into internal model
|
|
4841
4889
|
* classes.
|
|
4842
|
-
*/ class
|
|
4890
|
+
*/ class Xn {
|
|
4843
4891
|
constructor(t, e, n) {
|
|
4844
|
-
this.databaseId = t, this.ignoreUndefinedProperties = e, this.M = n ||
|
|
4892
|
+
this.databaseId = t, this.ignoreUndefinedProperties = e, this.M = n || gn(t);
|
|
4845
4893
|
}
|
|
4846
4894
|
/** Creates a new top-level parse context. */ wt(t, e, n, r = !1) {
|
|
4847
|
-
return new
|
|
4895
|
+
return new Jn({
|
|
4848
4896
|
st: t,
|
|
4849
4897
|
methodName: e,
|
|
4850
4898
|
dt: n,
|
|
@@ -4855,29 +4903,29 @@ function Yn(t) {
|
|
|
4855
4903
|
}
|
|
4856
4904
|
}
|
|
4857
4905
|
|
|
4858
|
-
function
|
|
4859
|
-
const e = t._freezeSettings(), n =
|
|
4860
|
-
return new
|
|
4906
|
+
function tr(t) {
|
|
4907
|
+
const e = t._freezeSettings(), n = gn(t._databaseId);
|
|
4908
|
+
return new Xn(t._databaseId, !!e.ignoreUndefinedProperties, n);
|
|
4861
4909
|
}
|
|
4862
4910
|
|
|
4863
|
-
/** Parse document data from a set() call. */ function
|
|
4911
|
+
/** Parse document data from a set() call. */ function er(t, e, n, r, s, i = {}) {
|
|
4864
4912
|
const o = t.wt(i.merge || i.mergeFields ? 2 /* UserDataSource.MergeSet */ : 0 /* UserDataSource.Set */ , e, n, s);
|
|
4865
|
-
|
|
4866
|
-
const u =
|
|
4913
|
+
wr("Data must be an object, but it was:", o, r);
|
|
4914
|
+
const u = fr(r, o);
|
|
4867
4915
|
let c, a;
|
|
4868
|
-
if (i.merge) c = new
|
|
4916
|
+
if (i.merge) c = new be(o.fieldMask), a = o.fieldTransforms; else if (i.mergeFields) {
|
|
4869
4917
|
const t = [];
|
|
4870
4918
|
for (const r of i.mergeFields) {
|
|
4871
|
-
const s =
|
|
4919
|
+
const s = mr(e, r, n);
|
|
4872
4920
|
if (!o.contains(s)) throw new B($, `Field '${s}' is specified in your field mask but missing from your input data.`);
|
|
4873
|
-
|
|
4921
|
+
_r(t, s) || t.push(s);
|
|
4874
4922
|
}
|
|
4875
|
-
c = new
|
|
4923
|
+
c = new be(t), a = o.fieldTransforms.filter((t => c.covers(t.field)));
|
|
4876
4924
|
} else c = null, a = o.fieldTransforms;
|
|
4877
|
-
return new
|
|
4925
|
+
return new Yn(new Ee(u), c, a);
|
|
4878
4926
|
}
|
|
4879
4927
|
|
|
4880
|
-
class
|
|
4928
|
+
class nr extends Wn {
|
|
4881
4929
|
_toFieldTransform(t) {
|
|
4882
4930
|
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}`);
|
|
4883
4931
|
// No transform to add for a delete, but we need to add it to our
|
|
@@ -4885,7 +4933,7 @@ class tr extends zn {
|
|
|
4885
4933
|
return t.fieldMask.push(t.path), null;
|
|
4886
4934
|
}
|
|
4887
4935
|
isEqual(t) {
|
|
4888
|
-
return t instanceof
|
|
4936
|
+
return t instanceof nr;
|
|
4889
4937
|
}
|
|
4890
4938
|
}
|
|
4891
4939
|
|
|
@@ -4904,8 +4952,8 @@ class tr extends zn {
|
|
|
4904
4952
|
* context.
|
|
4905
4953
|
* @param context - The parent context.
|
|
4906
4954
|
* @param arrayElement - Whether or not the FieldValue has an array.
|
|
4907
|
-
*/ function
|
|
4908
|
-
return new
|
|
4955
|
+
*/ function rr(t, e, n) {
|
|
4956
|
+
return new Jn({
|
|
4909
4957
|
st: 3 /* UserDataSource.Argument */ ,
|
|
4910
4958
|
dt: e.settings.dt,
|
|
4911
4959
|
methodName: t._methodName,
|
|
@@ -4913,23 +4961,23 @@ class tr extends zn {
|
|
|
4913
4961
|
}, e.databaseId, e.M, e.ignoreUndefinedProperties);
|
|
4914
4962
|
}
|
|
4915
4963
|
|
|
4916
|
-
class
|
|
4964
|
+
class sr extends Wn {
|
|
4917
4965
|
_toFieldTransform(t) {
|
|
4918
|
-
return new
|
|
4966
|
+
return new Me(t.path, new Oe);
|
|
4919
4967
|
}
|
|
4920
4968
|
isEqual(t) {
|
|
4921
|
-
return t instanceof
|
|
4969
|
+
return t instanceof sr;
|
|
4922
4970
|
}
|
|
4923
4971
|
}
|
|
4924
4972
|
|
|
4925
|
-
class
|
|
4973
|
+
class ir extends Wn {
|
|
4926
4974
|
constructor(t, e) {
|
|
4927
4975
|
super(t), this.yt = e;
|
|
4928
4976
|
}
|
|
4929
4977
|
_toFieldTransform(t) {
|
|
4930
|
-
const e =
|
|
4931
|
-
/*array=*/ !0), n = this.yt.map((t =>
|
|
4932
|
-
return new
|
|
4978
|
+
const e = rr(this, t,
|
|
4979
|
+
/*array=*/ !0), n = this.yt.map((t => lr(t, e))), r = new ke(n);
|
|
4980
|
+
return new Me(t.path, r);
|
|
4933
4981
|
}
|
|
4934
4982
|
isEqual(t) {
|
|
4935
4983
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4937,14 +4985,14 @@ class rr extends zn {
|
|
|
4937
4985
|
}
|
|
4938
4986
|
}
|
|
4939
4987
|
|
|
4940
|
-
class
|
|
4988
|
+
class or extends Wn {
|
|
4941
4989
|
constructor(t, e) {
|
|
4942
4990
|
super(t), this.yt = e;
|
|
4943
4991
|
}
|
|
4944
4992
|
_toFieldTransform(t) {
|
|
4945
|
-
const e =
|
|
4946
|
-
/*array=*/ !0), n = this.yt.map((t =>
|
|
4947
|
-
return new
|
|
4993
|
+
const e = rr(this, t,
|
|
4994
|
+
/*array=*/ !0), n = this.yt.map((t => lr(t, e))), r = new Ce(n);
|
|
4995
|
+
return new Me(t.path, r);
|
|
4948
4996
|
}
|
|
4949
4997
|
isEqual(t) {
|
|
4950
4998
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4952,13 +5000,13 @@ class sr extends zn {
|
|
|
4952
5000
|
}
|
|
4953
5001
|
}
|
|
4954
5002
|
|
|
4955
|
-
class
|
|
5003
|
+
class ur extends Wn {
|
|
4956
5004
|
constructor(t, e) {
|
|
4957
5005
|
super(t), this.gt = e;
|
|
4958
5006
|
}
|
|
4959
5007
|
_toFieldTransform(t) {
|
|
4960
|
-
const e = new
|
|
4961
|
-
return new
|
|
5008
|
+
const e = new Le(t.M, Se(t.M, this.gt));
|
|
5009
|
+
return new Me(t.path, e);
|
|
4962
5010
|
}
|
|
4963
5011
|
isEqual(t) {
|
|
4964
5012
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4966,50 +5014,50 @@ class ir extends zn {
|
|
|
4966
5014
|
}
|
|
4967
5015
|
}
|
|
4968
5016
|
|
|
4969
|
-
/** Parse update data from an update() call. */ function
|
|
5017
|
+
/** Parse update data from an update() call. */ function cr(t, e, n, r) {
|
|
4970
5018
|
const s = t.wt(1 /* UserDataSource.Update */ , e, n);
|
|
4971
|
-
|
|
4972
|
-
const i = [], o =
|
|
4973
|
-
|
|
4974
|
-
const u =
|
|
5019
|
+
wr("Data must be an object, but it was:", s, r);
|
|
5020
|
+
const i = [], o = Ee.empty();
|
|
5021
|
+
$t(r, ((t, r) => {
|
|
5022
|
+
const u = yr(e, t, n);
|
|
4975
5023
|
// For Compat types, we have to "extract" the underlying types before
|
|
4976
5024
|
// performing validation.
|
|
4977
5025
|
r = d(r);
|
|
4978
5026
|
const c = s.at(u);
|
|
4979
|
-
if (r instanceof
|
|
5027
|
+
if (r instanceof nr)
|
|
4980
5028
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4981
5029
|
i.push(u); else {
|
|
4982
|
-
const t =
|
|
5030
|
+
const t = lr(r, c);
|
|
4983
5031
|
null != t && (i.push(u), o.set(u, t));
|
|
4984
5032
|
}
|
|
4985
5033
|
}));
|
|
4986
|
-
const u = new
|
|
4987
|
-
return new
|
|
5034
|
+
const u = new be(i);
|
|
5035
|
+
return new Hn(o, u, s.fieldTransforms);
|
|
4988
5036
|
}
|
|
4989
5037
|
|
|
4990
|
-
/** Parse update data from a list of field/value arguments. */ function
|
|
4991
|
-
const o = t.wt(1 /* UserDataSource.Update */ , e, n), u = [
|
|
5038
|
+
/** Parse update data from a list of field/value arguments. */ function ar(t, e, n, r, s, i) {
|
|
5039
|
+
const o = t.wt(1 /* UserDataSource.Update */ , e, n), u = [ mr(e, r, n) ], c = [ s ];
|
|
4992
5040
|
if (i.length % 2 != 0) throw new B($, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);
|
|
4993
|
-
for (let t = 0; t < i.length; t += 2) u.push(
|
|
4994
|
-
const a = [], h =
|
|
5041
|
+
for (let t = 0; t < i.length; t += 2) u.push(mr(e, i[t])), c.push(i[t + 1]);
|
|
5042
|
+
const a = [], h = Ee.empty();
|
|
4995
5043
|
// We iterate in reverse order to pick the last value for a field if the
|
|
4996
5044
|
// user specified the field multiple times.
|
|
4997
|
-
for (let t = u.length - 1; t >= 0; --t) if (!
|
|
5045
|
+
for (let t = u.length - 1; t >= 0; --t) if (!_r(a, u[t])) {
|
|
4998
5046
|
const e = u[t];
|
|
4999
5047
|
let n = c[t];
|
|
5000
5048
|
// For Compat types, we have to "extract" the underlying types before
|
|
5001
5049
|
// performing validation.
|
|
5002
5050
|
n = d(n);
|
|
5003
5051
|
const r = o.at(e);
|
|
5004
|
-
if (n instanceof
|
|
5052
|
+
if (n instanceof nr)
|
|
5005
5053
|
// Add it to the field mask, but don't add anything to updateData.
|
|
5006
5054
|
a.push(e); else {
|
|
5007
|
-
const t =
|
|
5055
|
+
const t = lr(n, r);
|
|
5008
5056
|
null != t && (a.push(e), h.set(e, t));
|
|
5009
5057
|
}
|
|
5010
5058
|
}
|
|
5011
|
-
const l = new
|
|
5012
|
-
return new
|
|
5059
|
+
const l = new be(a);
|
|
5060
|
+
return new Hn(h, l, o.fieldTransforms);
|
|
5013
5061
|
}
|
|
5014
5062
|
|
|
5015
5063
|
/**
|
|
@@ -5018,8 +5066,8 @@ class ir extends zn {
|
|
|
5018
5066
|
*
|
|
5019
5067
|
* @param allowArrays - Whether the query value is an array that may directly
|
|
5020
5068
|
* contain additional arrays (e.g. the operand of an `in` query).
|
|
5021
|
-
*/ function
|
|
5022
|
-
return
|
|
5069
|
+
*/ function hr(t, e, n, r = !1) {
|
|
5070
|
+
return lr(n, t.wt(r ? 4 /* UserDataSource.ArrayArgument */ : 3 /* UserDataSource.Argument */ , e));
|
|
5023
5071
|
}
|
|
5024
5072
|
|
|
5025
5073
|
/**
|
|
@@ -5030,12 +5078,12 @@ class ir extends zn {
|
|
|
5030
5078
|
* the source of the data being parsed, etc.
|
|
5031
5079
|
* @returns The parsed value, or null if the value was a FieldValue sentinel
|
|
5032
5080
|
* that should not be included in the resulting parsed data.
|
|
5033
|
-
*/ function
|
|
5034
|
-
if (
|
|
5081
|
+
*/ function lr(t, e) {
|
|
5082
|
+
if (dr(
|
|
5035
5083
|
// Unwrap the API type from the Compat SDK. This will return the API type
|
|
5036
5084
|
// from firestore-exp.
|
|
5037
|
-
t = d(t))) return
|
|
5038
|
-
if (t instanceof
|
|
5085
|
+
t = d(t))) return wr("Unsupported field value:", e, t), fr(t, e);
|
|
5086
|
+
if (t instanceof Wn)
|
|
5039
5087
|
// FieldValues usually parse into transforms (except deleteField())
|
|
5040
5088
|
// in which case we do not want to include this field in our parsed data
|
|
5041
5089
|
// (as doing so will overwrite the field directly prior to the transform
|
|
@@ -5047,7 +5095,7 @@ class ir extends zn {
|
|
|
5047
5095
|
*/
|
|
5048
5096
|
return function(t, e) {
|
|
5049
5097
|
// Sentinels are only supported with writes, and not within arrays.
|
|
5050
|
-
if (!
|
|
5098
|
+
if (!Zn(e.st)) throw e.lt(`${t._methodName}() can only be used with update() and set()`);
|
|
5051
5099
|
if (!e.path) throw e.lt(`${t._methodName}() is not currently supported inside arrays`);
|
|
5052
5100
|
const n = t._toFieldTransform(e);
|
|
5053
5101
|
n && e.fieldTransforms.push(n);
|
|
@@ -5077,7 +5125,7 @@ class ir extends zn {
|
|
|
5077
5125
|
const n = [];
|
|
5078
5126
|
let r = 0;
|
|
5079
5127
|
for (const s of t) {
|
|
5080
|
-
let t =
|
|
5128
|
+
let t = lr(s, e.ht(r));
|
|
5081
5129
|
null == t && (
|
|
5082
5130
|
// Just include nulls in the array for fields being replaced with a
|
|
5083
5131
|
// sentinel.
|
|
@@ -5096,7 +5144,7 @@ class ir extends zn {
|
|
|
5096
5144
|
if (null === (t = d(t))) return {
|
|
5097
5145
|
nullValue: "NULL_VALUE"
|
|
5098
5146
|
};
|
|
5099
|
-
if ("number" == typeof t) return
|
|
5147
|
+
if ("number" == typeof t) return Se(e.M, t);
|
|
5100
5148
|
if ("boolean" == typeof t) return {
|
|
5101
5149
|
booleanValue: t
|
|
5102
5150
|
};
|
|
@@ -5104,34 +5152,34 @@ class ir extends zn {
|
|
|
5104
5152
|
stringValue: t
|
|
5105
5153
|
};
|
|
5106
5154
|
if (t instanceof Date) {
|
|
5107
|
-
const n =
|
|
5155
|
+
const n = kt.fromDate(t);
|
|
5108
5156
|
return {
|
|
5109
|
-
timestampValue:
|
|
5157
|
+
timestampValue: Ze(e.M, n)
|
|
5110
5158
|
};
|
|
5111
5159
|
}
|
|
5112
|
-
if (t instanceof
|
|
5160
|
+
if (t instanceof kt) {
|
|
5113
5161
|
// Firestore backend truncates precision down to microseconds. To ensure
|
|
5114
5162
|
// offline mode works the same with regards to truncation, perform the
|
|
5115
5163
|
// truncation immediately without waiting for the backend to do that.
|
|
5116
|
-
const n = new
|
|
5164
|
+
const n = new kt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
|
|
5117
5165
|
return {
|
|
5118
|
-
timestampValue:
|
|
5166
|
+
timestampValue: Ze(e.M, n)
|
|
5119
5167
|
};
|
|
5120
5168
|
}
|
|
5121
|
-
if (t instanceof
|
|
5169
|
+
if (t instanceof Gn) return {
|
|
5122
5170
|
geoPointValue: {
|
|
5123
5171
|
latitude: t.latitude,
|
|
5124
5172
|
longitude: t.longitude
|
|
5125
5173
|
}
|
|
5126
5174
|
};
|
|
5127
|
-
if (t instanceof
|
|
5128
|
-
bytesValue:
|
|
5175
|
+
if (t instanceof Bn) return {
|
|
5176
|
+
bytesValue: Je(e.M, t._byteString)
|
|
5129
5177
|
};
|
|
5130
|
-
if (t instanceof
|
|
5178
|
+
if (t instanceof qn) {
|
|
5131
5179
|
const n = e.databaseId, r = t.firestore._databaseId;
|
|
5132
5180
|
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}`);
|
|
5133
5181
|
return {
|
|
5134
|
-
referenceValue:
|
|
5182
|
+
referenceValue: en(t.firestore._databaseId || e.databaseId, t._key.path)
|
|
5135
5183
|
};
|
|
5136
5184
|
}
|
|
5137
5185
|
throw e.lt(`Unsupported field value: ${at(t)}`);
|
|
@@ -5145,13 +5193,13 @@ class ir extends zn {
|
|
|
5145
5193
|
*/ (t, e);
|
|
5146
5194
|
}
|
|
5147
5195
|
|
|
5148
|
-
function
|
|
5196
|
+
function fr(t, e) {
|
|
5149
5197
|
const n = {};
|
|
5150
5198
|
return !function(t) {
|
|
5151
5199
|
for (const e in t) if (Object.prototype.hasOwnProperty.call(t, e)) return !1;
|
|
5152
5200
|
return !0;
|
|
5153
|
-
}(t) ?
|
|
5154
|
-
const s =
|
|
5201
|
+
}(t) ? $t(t, ((t, r) => {
|
|
5202
|
+
const s = lr(r, e.ot(t));
|
|
5155
5203
|
null != s && (n[t] = s);
|
|
5156
5204
|
})) :
|
|
5157
5205
|
// If we encounter an empty object, we explicitly add it to the update
|
|
@@ -5163,12 +5211,12 @@ function hr(t, e) {
|
|
|
5163
5211
|
};
|
|
5164
5212
|
}
|
|
5165
5213
|
|
|
5166
|
-
function
|
|
5167
|
-
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof
|
|
5214
|
+
function dr(t) {
|
|
5215
|
+
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof kt || t instanceof Gn || t instanceof Bn || t instanceof qn || t instanceof Wn);
|
|
5168
5216
|
}
|
|
5169
5217
|
|
|
5170
|
-
function
|
|
5171
|
-
if (!
|
|
5218
|
+
function wr(t, e, n) {
|
|
5219
|
+
if (!dr(n) || !function(t) {
|
|
5172
5220
|
return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
|
|
5173
5221
|
}(n)) {
|
|
5174
5222
|
const r = at(n);
|
|
@@ -5178,20 +5226,20 @@ function fr(t, e, n) {
|
|
|
5178
5226
|
|
|
5179
5227
|
/**
|
|
5180
5228
|
* Helper that calls fromDotSeparatedString() but wraps any error thrown.
|
|
5181
|
-
*/ function
|
|
5229
|
+
*/ function mr(t, e, n) {
|
|
5182
5230
|
if ((
|
|
5183
5231
|
// If required, replace the FieldPath Compat class with with the firestore-exp
|
|
5184
5232
|
// FieldPath.
|
|
5185
|
-
e = d(e)) instanceof
|
|
5186
|
-
if ("string" == typeof e) return
|
|
5187
|
-
throw
|
|
5233
|
+
e = d(e)) instanceof zn) return e._internalPath;
|
|
5234
|
+
if ("string" == typeof e) return yr(t, e);
|
|
5235
|
+
throw gr("Field path arguments must be of type string or ", t,
|
|
5188
5236
|
/* hasConverter= */ !1,
|
|
5189
5237
|
/* path= */ void 0, n);
|
|
5190
5238
|
}
|
|
5191
5239
|
|
|
5192
5240
|
/**
|
|
5193
5241
|
* Matches any characters in a field path string that are reserved.
|
|
5194
|
-
*/ const
|
|
5242
|
+
*/ const pr = new RegExp("[~\\*/\\[\\]]");
|
|
5195
5243
|
|
|
5196
5244
|
/**
|
|
5197
5245
|
* Wraps fromDotSeparatedString with an error message about the method that
|
|
@@ -5201,20 +5249,20 @@ function fr(t, e, n) {
|
|
|
5201
5249
|
* split on dots.
|
|
5202
5250
|
* @param targetDoc - The document against which the field path will be
|
|
5203
5251
|
* evaluated.
|
|
5204
|
-
*/ function
|
|
5205
|
-
if (e.search(
|
|
5252
|
+
*/ function yr(t, e, n) {
|
|
5253
|
+
if (e.search(pr) >= 0) throw gr(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`, t,
|
|
5206
5254
|
/* hasConverter= */ !1,
|
|
5207
5255
|
/* path= */ void 0, n);
|
|
5208
5256
|
try {
|
|
5209
|
-
return new
|
|
5257
|
+
return new zn(...e.split("."))._internalPath;
|
|
5210
5258
|
} catch (r) {
|
|
5211
|
-
throw
|
|
5259
|
+
throw gr(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t,
|
|
5212
5260
|
/* hasConverter= */ !1,
|
|
5213
5261
|
/* path= */ void 0, n);
|
|
5214
5262
|
}
|
|
5215
5263
|
}
|
|
5216
5264
|
|
|
5217
|
-
function
|
|
5265
|
+
function gr(t, e, n, r, s) {
|
|
5218
5266
|
const i = r && !r.isEmpty(), o = void 0 !== s;
|
|
5219
5267
|
let u = `Function ${e}() called with invalid data`;
|
|
5220
5268
|
n && (u += " (via `toFirestore()`)"), u += ". ";
|
|
@@ -5223,7 +5271,7 @@ function pr(t, e, n, r, s) {
|
|
|
5223
5271
|
c += ")"), new B($, u + t + c);
|
|
5224
5272
|
}
|
|
5225
5273
|
|
|
5226
|
-
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function
|
|
5274
|
+
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function _r(t, e) {
|
|
5227
5275
|
return t.some((t => t.isEqual(e)));
|
|
5228
5276
|
}
|
|
5229
5277
|
|
|
@@ -5251,7 +5299,7 @@ function pr(t, e, n, r, s) {
|
|
|
5251
5299
|
* For a `DocumentSnapshot` that points to a non-existing document, any data
|
|
5252
5300
|
* access will return 'undefined'. You can use the `exists()` method to
|
|
5253
5301
|
* explicitly verify a document's existence.
|
|
5254
|
-
*/ class
|
|
5302
|
+
*/ class vr {
|
|
5255
5303
|
// Note: This class is stripped down version of the DocumentSnapshot in
|
|
5256
5304
|
// the legacy SDK. The changes are:
|
|
5257
5305
|
// - No support for SnapshotMetadata.
|
|
@@ -5267,7 +5315,7 @@ function pr(t, e, n, r, s) {
|
|
|
5267
5315
|
/**
|
|
5268
5316
|
* The `DocumentReference` for the document included in the `DocumentSnapshot`.
|
|
5269
5317
|
*/ get ref() {
|
|
5270
|
-
return new
|
|
5318
|
+
return new qn(this._firestore, this._converter, this._key);
|
|
5271
5319
|
}
|
|
5272
5320
|
/**
|
|
5273
5321
|
* Signals whether or not the document at the snapshot's location exists.
|
|
@@ -5287,7 +5335,7 @@ function pr(t, e, n, r, s) {
|
|
|
5287
5335
|
if (this._converter) {
|
|
5288
5336
|
// We only want to use the converter and create a new DocumentSnapshot
|
|
5289
5337
|
// if a converter has been provided.
|
|
5290
|
-
const t = new
|
|
5338
|
+
const t = new br(this._firestore, this._userDataWriter, this._key, this._document,
|
|
5291
5339
|
/* converter= */ null);
|
|
5292
5340
|
return this._converter.fromFirestore(t);
|
|
5293
5341
|
}
|
|
@@ -5307,7 +5355,7 @@ function pr(t, e, n, r, s) {
|
|
|
5307
5355
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5308
5356
|
get(t) {
|
|
5309
5357
|
if (this._document) {
|
|
5310
|
-
const e = this._document.data.field(
|
|
5358
|
+
const e = this._document.data.field(Ir("DocumentSnapshot.get", t));
|
|
5311
5359
|
if (null !== e) return this._userDataWriter.convertValue(e);
|
|
5312
5360
|
}
|
|
5313
5361
|
}
|
|
@@ -5323,7 +5371,7 @@ function pr(t, e, n, r, s) {
|
|
|
5323
5371
|
* `DocumentSnapshot`. Since query results contain only existing documents, the
|
|
5324
5372
|
* `exists` property will always be true and `data()` will never return
|
|
5325
5373
|
* 'undefined'.
|
|
5326
|
-
*/ class
|
|
5374
|
+
*/ class br extends vr {
|
|
5327
5375
|
/**
|
|
5328
5376
|
* Retrieves all fields in the document as an `Object`.
|
|
5329
5377
|
*
|
|
@@ -5341,7 +5389,7 @@ function pr(t, e, n, r, s) {
|
|
|
5341
5389
|
* array via the `docs` property or enumerated using the `forEach` method. The
|
|
5342
5390
|
* number of documents can be determined via the `empty` and `size`
|
|
5343
5391
|
* properties.
|
|
5344
|
-
*/ class
|
|
5392
|
+
*/ class Er {
|
|
5345
5393
|
/** @hideconstructor */
|
|
5346
5394
|
constructor(t, e) {
|
|
5347
5395
|
this._docs = e, this.query = t;
|
|
@@ -5372,14 +5420,14 @@ function pr(t, e, n, r, s) {
|
|
|
5372
5420
|
* @param left - A snapshot to compare.
|
|
5373
5421
|
* @param right - A snapshot to compare.
|
|
5374
5422
|
* @returns true if the snapshots are equal.
|
|
5375
|
-
*/ function
|
|
5376
|
-
return t = d(t), e = d(e), t instanceof
|
|
5423
|
+
*/ function Ar(t, e) {
|
|
5424
|
+
return t = d(t), e = d(e), t instanceof vr && e instanceof vr ? 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 Er && e instanceof Er && (jn(t.query, e.query) && Pt(t.docs, e.docs, Ar));
|
|
5377
5425
|
}
|
|
5378
5426
|
|
|
5379
5427
|
/**
|
|
5380
5428
|
* Helper that calls `fromDotSeparatedString()` but wraps any error thrown.
|
|
5381
|
-
*/ function
|
|
5382
|
-
return "string" == typeof e ?
|
|
5429
|
+
*/ function Ir(t, e) {
|
|
5430
|
+
return "string" == typeof e ? yr(t, e) : e instanceof zn ? e._internalPath : e._delegate._internalPath;
|
|
5383
5431
|
}
|
|
5384
5432
|
|
|
5385
5433
|
/**
|
|
@@ -5402,21 +5450,21 @@ function pr(t, e, n, r, s) {
|
|
|
5402
5450
|
* An `AppliableConstraint` is an abstraction of a constraint that can be applied
|
|
5403
5451
|
* to a Firestore query.
|
|
5404
5452
|
*/
|
|
5405
|
-
class
|
|
5453
|
+
class Tr {}
|
|
5406
5454
|
|
|
5407
5455
|
/**
|
|
5408
5456
|
* A `QueryConstraint` is used to narrow the set of documents returned by a
|
|
5409
5457
|
* Firestore query. `QueryConstraint`s are created by invoking {@link where},
|
|
5410
|
-
* {@link orderBy}, {@link startAt}, {@link startAfter}, {@link
|
|
5411
|
-
* endBefore}, {@link endAt}, {@link limit}, {@link limitToLast} and
|
|
5412
|
-
* can then be passed to {@link query} to create a new query instance that
|
|
5458
|
+
* {@link orderBy}, {@link (startAt:1)}, {@link (startAfter:1)}, {@link
|
|
5459
|
+
* (endBefore:1)}, {@link (endAt:1)}, {@link limit}, {@link limitToLast} and
|
|
5460
|
+
* can then be passed to {@link (query:1)} to create a new query instance that
|
|
5413
5461
|
* also contains this `QueryConstraint`.
|
|
5414
|
-
*/ class
|
|
5462
|
+
*/ class Rr extends Tr {}
|
|
5415
5463
|
|
|
5416
|
-
function
|
|
5464
|
+
function Pr(t, e, ...n) {
|
|
5417
5465
|
let r = [];
|
|
5418
|
-
e instanceof
|
|
5419
|
-
const e = t.filter((t => t instanceof
|
|
5466
|
+
e instanceof Tr && r.push(e), r = r.concat(n), function(t) {
|
|
5467
|
+
const e = t.filter((t => t instanceof Nr)).length, n = t.filter((t => t instanceof Vr)).length;
|
|
5420
5468
|
if (e > 1 || e > 0 && n > 0) throw new B($, "InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.");
|
|
5421
5469
|
}
|
|
5422
5470
|
/**
|
|
@@ -5449,9 +5497,9 @@ function Tr(t, e, ...n) {
|
|
|
5449
5497
|
* A `QueryFieldFilterConstraint` is used to narrow the set of documents returned by
|
|
5450
5498
|
* a Firestore query by filtering on one or more document fields.
|
|
5451
5499
|
* `QueryFieldFilterConstraint`s are created by invoking {@link where} and can then
|
|
5452
|
-
* be passed to {@link query} to create a new query instance that also contains
|
|
5500
|
+
* be passed to {@link (query:1)} to create a new query instance that also contains
|
|
5453
5501
|
* this `QueryFieldFilterConstraint`.
|
|
5454
|
-
*/ class
|
|
5502
|
+
*/ class Vr extends Rr {
|
|
5455
5503
|
/**
|
|
5456
5504
|
* @internal
|
|
5457
5505
|
*/
|
|
@@ -5461,31 +5509,31 @@ function Tr(t, e, ...n) {
|
|
|
5461
5509
|
this.type = "where";
|
|
5462
5510
|
}
|
|
5463
5511
|
static _create(t, e, n) {
|
|
5464
|
-
return new
|
|
5512
|
+
return new Vr(t, e, n);
|
|
5465
5513
|
}
|
|
5466
5514
|
_apply(t) {
|
|
5467
5515
|
const e = this._parse(t);
|
|
5468
|
-
return
|
|
5516
|
+
return Gr(t._query, e), new On(t.firestore, t.converter, Fe(t._query, e));
|
|
5469
5517
|
}
|
|
5470
5518
|
_parse(t) {
|
|
5471
|
-
const e =
|
|
5519
|
+
const e = tr(t.firestore), n = function(t, e, n, r, s, i, o) {
|
|
5472
5520
|
let u;
|
|
5473
5521
|
if (s.isKeyField()) {
|
|
5474
5522
|
if ("array-contains" /* Operator.ARRAY_CONTAINS */ === i || "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ === i) throw new B($, `Invalid Query. You can't perform '${i}' queries on documentId().`);
|
|
5475
5523
|
if ("in" /* Operator.IN */ === i || "not-in" /* Operator.NOT_IN */ === i) {
|
|
5476
|
-
|
|
5524
|
+
Wr(o, i);
|
|
5477
5525
|
const e = [];
|
|
5478
|
-
for (const n of o) e.push(
|
|
5526
|
+
for (const n of o) e.push(Qr(r, t, n));
|
|
5479
5527
|
u = {
|
|
5480
5528
|
arrayValue: {
|
|
5481
5529
|
values: e
|
|
5482
5530
|
}
|
|
5483
5531
|
};
|
|
5484
|
-
} else u =
|
|
5485
|
-
} else "in" /* Operator.IN */ !== i && "not-in" /* Operator.NOT_IN */ !== i && "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ !== i ||
|
|
5486
|
-
u =
|
|
5532
|
+
} else u = Qr(r, t, o);
|
|
5533
|
+
} else "in" /* Operator.IN */ !== i && "not-in" /* Operator.NOT_IN */ !== i && "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ !== i || Wr(o, i),
|
|
5534
|
+
u = hr(n, e, o,
|
|
5487
5535
|
/* allowArrays= */ "in" /* Operator.IN */ === i || "not-in" /* Operator.NOT_IN */ === i);
|
|
5488
|
-
return
|
|
5536
|
+
return ne.create(s, i, u);
|
|
5489
5537
|
}(t._query, "where", e, t.firestore._databaseId, this._field, this._op, this._value);
|
|
5490
5538
|
return n;
|
|
5491
5539
|
}
|
|
@@ -5501,9 +5549,9 @@ function Tr(t, e, ...n) {
|
|
|
5501
5549
|
* "<=", "!=").
|
|
5502
5550
|
* @param value - The value for comparison
|
|
5503
5551
|
* @returns The created {@link QueryFieldFilterConstraint}.
|
|
5504
|
-
*/ function
|
|
5505
|
-
const r = e, s =
|
|
5506
|
-
return
|
|
5552
|
+
*/ function $r(t, e, n) {
|
|
5553
|
+
const r = e, s = Ir("where", t);
|
|
5554
|
+
return Vr._create(s, r, n);
|
|
5507
5555
|
}
|
|
5508
5556
|
|
|
5509
5557
|
/**
|
|
@@ -5511,10 +5559,9 @@ function Tr(t, e, ...n) {
|
|
|
5511
5559
|
* returned by a Firestore query by performing the logical OR or AND of multiple
|
|
5512
5560
|
* {@link QueryFieldFilterConstraint}s or {@link QueryCompositeFilterConstraint}s.
|
|
5513
5561
|
* `QueryCompositeFilterConstraint`s are created by invoking {@link or} or
|
|
5514
|
-
* {@link and} and can then be passed to {@link query} to create a new query
|
|
5562
|
+
* {@link and} and can then be passed to {@link (query:1)} to create a new query
|
|
5515
5563
|
* instance that also contains the `QueryCompositeFilterConstraint`.
|
|
5516
|
-
|
|
5517
|
-
*/ class Vr extends Ar {
|
|
5564
|
+
*/ class Nr extends Tr {
|
|
5518
5565
|
/**
|
|
5519
5566
|
* @internal
|
|
5520
5567
|
*/
|
|
@@ -5524,22 +5571,22 @@ function Tr(t, e, ...n) {
|
|
|
5524
5571
|
super(), this.type = t, this._queryConstraints = e;
|
|
5525
5572
|
}
|
|
5526
5573
|
static _create(t, e) {
|
|
5527
|
-
return new
|
|
5574
|
+
return new Nr(t, e);
|
|
5528
5575
|
}
|
|
5529
5576
|
_parse(t) {
|
|
5530
5577
|
const e = this._queryConstraints.map((e => e._parse(t))).filter((t => t.getFilters().length > 0));
|
|
5531
|
-
return 1 === e.length ? e[0] :
|
|
5578
|
+
return 1 === e.length ? e[0] : re.create(e, this._getOperator());
|
|
5532
5579
|
}
|
|
5533
5580
|
_apply(t) {
|
|
5534
5581
|
const e = this._parse(t);
|
|
5535
5582
|
return 0 === e.getFilters().length ? t : (function(t, e) {
|
|
5536
5583
|
let n = t;
|
|
5537
5584
|
const r = e.getFlattenedFilters();
|
|
5538
|
-
for (const t of r)
|
|
5585
|
+
for (const t of r) Gr(n, t), n = Fe(n, t);
|
|
5539
5586
|
}
|
|
5540
5587
|
// Checks if any of the provided filter operators are included in the given list of filters and
|
|
5541
5588
|
// returns the first one that is, or null if none are.
|
|
5542
|
-
(t._query, e), new
|
|
5589
|
+
(t._query, e), new On(t.firestore, t.converter, Fe(t._query, e)));
|
|
5543
5590
|
}
|
|
5544
5591
|
_getQueryConstraints() {
|
|
5545
5592
|
return this._queryConstraints;
|
|
@@ -5558,10 +5605,9 @@ function Tr(t, e, ...n) {
|
|
|
5558
5605
|
* {@link QueryFilterConstraint}s to perform a disjunction for. These must be
|
|
5559
5606
|
* created with calls to {@link where}, {@link or}, or {@link and}.
|
|
5560
5607
|
* @returns The newly created {@link QueryCompositeFilterConstraint}.
|
|
5561
|
-
|
|
5562
|
-
*/ function $r(...t) {
|
|
5608
|
+
*/ function Dr(...t) {
|
|
5563
5609
|
// Only support QueryFilterConstraints
|
|
5564
|
-
return t.forEach((t =>
|
|
5610
|
+
return t.forEach((t => Yr("or", t))), Nr._create("or" /* CompositeOperator.OR */ , t);
|
|
5565
5611
|
}
|
|
5566
5612
|
|
|
5567
5613
|
/**
|
|
@@ -5573,21 +5619,20 @@ function Tr(t, e, ...n) {
|
|
|
5573
5619
|
* {@link QueryFilterConstraint}s to perform a conjunction for. These must be
|
|
5574
5620
|
* created with calls to {@link where}, {@link or}, or {@link and}.
|
|
5575
5621
|
* @returns The newly created {@link QueryCompositeFilterConstraint}.
|
|
5576
|
-
|
|
5577
|
-
*/ function Nr(...t) {
|
|
5622
|
+
*/ function Fr(...t) {
|
|
5578
5623
|
// Only support QueryFilterConstraints
|
|
5579
|
-
return t.forEach((t =>
|
|
5624
|
+
return t.forEach((t => Yr("and", t))), Nr._create("and" /* CompositeOperator.AND */ , t);
|
|
5580
5625
|
}
|
|
5581
5626
|
|
|
5582
5627
|
/**
|
|
5583
5628
|
* A `QueryOrderByConstraint` is used to sort the set of documents returned by a
|
|
5584
5629
|
* Firestore query. `QueryOrderByConstraint`s are created by invoking
|
|
5585
|
-
* {@link orderBy} and can then be passed to {@link query} to create a new query
|
|
5630
|
+
* {@link orderBy} and can then be passed to {@link (query:1)} to create a new query
|
|
5586
5631
|
* instance that also contains this `QueryOrderByConstraint`.
|
|
5587
5632
|
*
|
|
5588
5633
|
* Note: Documents that do not contain the orderBy field will not be present in
|
|
5589
5634
|
* the query result.
|
|
5590
|
-
*/ class
|
|
5635
|
+
*/ class xr extends Rr {
|
|
5591
5636
|
/**
|
|
5592
5637
|
* @internal
|
|
5593
5638
|
*/
|
|
@@ -5597,18 +5642,18 @@ function Tr(t, e, ...n) {
|
|
|
5597
5642
|
this.type = "orderBy";
|
|
5598
5643
|
}
|
|
5599
5644
|
static _create(t, e) {
|
|
5600
|
-
return new
|
|
5645
|
+
return new xr(t, e);
|
|
5601
5646
|
}
|
|
5602
5647
|
_apply(t) {
|
|
5603
5648
|
const e = function(t, e, n) {
|
|
5604
5649
|
if (null !== t.startAt) throw new B($, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
|
|
5605
5650
|
if (null !== t.endAt) throw new B($, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
|
|
5606
|
-
const r = new
|
|
5651
|
+
const r = new de(e, n);
|
|
5607
5652
|
return function(t, e) {
|
|
5608
|
-
if (null ===
|
|
5653
|
+
if (null === Pe(t)) {
|
|
5609
5654
|
// This is the first order by. It must match any inequality.
|
|
5610
|
-
const n =
|
|
5611
|
-
null !== n &&
|
|
5655
|
+
const n = Ve(t);
|
|
5656
|
+
null !== n && Kr(t, n, e.field);
|
|
5612
5657
|
}
|
|
5613
5658
|
}(t, r), r;
|
|
5614
5659
|
}
|
|
@@ -5623,10 +5668,10 @@ function Tr(t, e, ...n) {
|
|
|
5623
5668
|
* of the query or if any of the fields in the order by are an uncommitted
|
|
5624
5669
|
* server timestamp.
|
|
5625
5670
|
*/ (t._query, this._field, this._direction);
|
|
5626
|
-
return new
|
|
5671
|
+
return new On(t.firestore, t.converter, function(t, e) {
|
|
5627
5672
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
5628
5673
|
const n = t.explicitOrderBy.concat([ e ]);
|
|
5629
|
-
return new
|
|
5674
|
+
return new Re(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
|
|
5630
5675
|
}(t._query, e));
|
|
5631
5676
|
}
|
|
5632
5677
|
}
|
|
@@ -5642,18 +5687,18 @@ function Tr(t, e, ...n) {
|
|
|
5642
5687
|
* @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
|
|
5643
5688
|
* not specified, order will be ascending.
|
|
5644
5689
|
* @returns The created {@link QueryOrderByConstraint}.
|
|
5645
|
-
*/ function
|
|
5646
|
-
const n = e, r =
|
|
5647
|
-
return
|
|
5690
|
+
*/ function Sr(t, e = "asc") {
|
|
5691
|
+
const n = e, r = Ir("orderBy", t);
|
|
5692
|
+
return xr._create(r, n);
|
|
5648
5693
|
}
|
|
5649
5694
|
|
|
5650
5695
|
/**
|
|
5651
5696
|
* A `QueryLimitConstraint` is used to limit the number of documents returned by
|
|
5652
5697
|
* a Firestore query.
|
|
5653
5698
|
* `QueryLimitConstraint`s are created by invoking {@link limit} or
|
|
5654
|
-
* {@link limitToLast} and can then be passed to {@link query} to create a new
|
|
5699
|
+
* {@link limitToLast} and can then be passed to {@link (query:1)} to create a new
|
|
5655
5700
|
* query instance that also contains this `QueryLimitConstraint`.
|
|
5656
|
-
*/ class
|
|
5701
|
+
*/ class qr extends Rr {
|
|
5657
5702
|
/**
|
|
5658
5703
|
* @internal
|
|
5659
5704
|
*/
|
|
@@ -5663,11 +5708,11 @@ function Tr(t, e, ...n) {
|
|
|
5663
5708
|
super(), this.type = t, this._limit = e, this._limitType = n;
|
|
5664
5709
|
}
|
|
5665
5710
|
static _create(t, e, n) {
|
|
5666
|
-
return new
|
|
5711
|
+
return new qr(t, e, n);
|
|
5667
5712
|
}
|
|
5668
5713
|
_apply(t) {
|
|
5669
|
-
return new
|
|
5670
|
-
return new
|
|
5714
|
+
return new On(t.firestore, t.converter, function(t, e, n) {
|
|
5715
|
+
return new Re(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
|
|
5671
5716
|
}(t._query, this._limit, this._limitType));
|
|
5672
5717
|
}
|
|
5673
5718
|
}
|
|
@@ -5678,8 +5723,8 @@ function Tr(t, e, ...n) {
|
|
|
5678
5723
|
*
|
|
5679
5724
|
* @param limit - The maximum number of items to return.
|
|
5680
5725
|
* @returns The created {@link QueryLimitConstraint}.
|
|
5681
|
-
*/ function
|
|
5682
|
-
return lt("limit", t),
|
|
5726
|
+
*/ function Or(t) {
|
|
5727
|
+
return lt("limit", t), qr._create("limit", t, "F" /* LimitType.First */);
|
|
5683
5728
|
}
|
|
5684
5729
|
|
|
5685
5730
|
/**
|
|
@@ -5691,17 +5736,17 @@ function Tr(t, e, ...n) {
|
|
|
5691
5736
|
*
|
|
5692
5737
|
* @param limit - The maximum number of items to return.
|
|
5693
5738
|
* @returns The created {@link QueryLimitConstraint}.
|
|
5694
|
-
*/ function
|
|
5695
|
-
return lt("limitToLast", t),
|
|
5739
|
+
*/ function kr(t) {
|
|
5740
|
+
return lt("limitToLast", t), qr._create("limitToLast", t, "L" /* LimitType.Last */);
|
|
5696
5741
|
}
|
|
5697
5742
|
|
|
5698
5743
|
/**
|
|
5699
5744
|
* A `QueryStartAtConstraint` is used to exclude documents from the start of a
|
|
5700
5745
|
* result set returned by a Firestore query.
|
|
5701
5746
|
* `QueryStartAtConstraint`s are created by invoking {@link (startAt:1)} or
|
|
5702
|
-
* {@link (startAfter:1)} and can then be passed to {@link query} to create a
|
|
5747
|
+
* {@link (startAfter:1)} and can then be passed to {@link (query:1)} to create a
|
|
5703
5748
|
* new query instance that also contains this `QueryStartAtConstraint`.
|
|
5704
|
-
*/ class
|
|
5749
|
+
*/ class Cr extends Rr {
|
|
5705
5750
|
/**
|
|
5706
5751
|
* @internal
|
|
5707
5752
|
*/
|
|
@@ -5711,23 +5756,23 @@ function Tr(t, e, ...n) {
|
|
|
5711
5756
|
super(), this.type = t, this._docOrFields = e, this._inclusive = n;
|
|
5712
5757
|
}
|
|
5713
5758
|
static _create(t, e, n) {
|
|
5714
|
-
return new
|
|
5759
|
+
return new Cr(t, e, n);
|
|
5715
5760
|
}
|
|
5716
5761
|
_apply(t) {
|
|
5717
|
-
const e =
|
|
5718
|
-
return new
|
|
5719
|
-
return new
|
|
5762
|
+
const e = zr(t, this.type, this._docOrFields, this._inclusive);
|
|
5763
|
+
return new On(t.firestore, t.converter, function(t, e) {
|
|
5764
|
+
return new Re(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
|
|
5720
5765
|
}(t._query, e));
|
|
5721
5766
|
}
|
|
5722
5767
|
}
|
|
5723
5768
|
|
|
5724
|
-
function
|
|
5725
|
-
return
|
|
5769
|
+
function Lr(...t) {
|
|
5770
|
+
return Cr._create("startAt", t,
|
|
5726
5771
|
/*inclusive=*/ !0);
|
|
5727
5772
|
}
|
|
5728
5773
|
|
|
5729
|
-
function
|
|
5730
|
-
return
|
|
5774
|
+
function Mr(...t) {
|
|
5775
|
+
return Cr._create("startAfter", t,
|
|
5731
5776
|
/*inclusive=*/ !1);
|
|
5732
5777
|
}
|
|
5733
5778
|
|
|
@@ -5735,9 +5780,9 @@ function Cr(...t) {
|
|
|
5735
5780
|
* A `QueryEndAtConstraint` is used to exclude documents from the end of a
|
|
5736
5781
|
* result set returned by a Firestore query.
|
|
5737
5782
|
* `QueryEndAtConstraint`s are created by invoking {@link (endAt:1)} or
|
|
5738
|
-
* {@link (endBefore:1)} and can then be passed to {@link query} to create a new
|
|
5783
|
+
* {@link (endBefore:1)} and can then be passed to {@link (query:1)} to create a new
|
|
5739
5784
|
* query instance that also contains this `QueryEndAtConstraint`.
|
|
5740
|
-
*/ class
|
|
5785
|
+
*/ class Ur extends Rr {
|
|
5741
5786
|
/**
|
|
5742
5787
|
* @internal
|
|
5743
5788
|
*/
|
|
@@ -5747,28 +5792,28 @@ function Cr(...t) {
|
|
|
5747
5792
|
super(), this.type = t, this._docOrFields = e, this._inclusive = n;
|
|
5748
5793
|
}
|
|
5749
5794
|
static _create(t, e, n) {
|
|
5750
|
-
return new
|
|
5795
|
+
return new Ur(t, e, n);
|
|
5751
5796
|
}
|
|
5752
5797
|
_apply(t) {
|
|
5753
|
-
const e =
|
|
5754
|
-
return new
|
|
5755
|
-
return new
|
|
5798
|
+
const e = zr(t, this.type, this._docOrFields, this._inclusive);
|
|
5799
|
+
return new On(t.firestore, t.converter, function(t, e) {
|
|
5800
|
+
return new Re(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
|
|
5756
5801
|
}(t._query, e));
|
|
5757
5802
|
}
|
|
5758
5803
|
}
|
|
5759
5804
|
|
|
5760
|
-
function
|
|
5761
|
-
return
|
|
5805
|
+
function jr(...t) {
|
|
5806
|
+
return Ur._create("endBefore", t,
|
|
5762
5807
|
/*inclusive=*/ !1);
|
|
5763
5808
|
}
|
|
5764
5809
|
|
|
5765
|
-
function
|
|
5766
|
-
return
|
|
5810
|
+
function Br(...t) {
|
|
5811
|
+
return Ur._create("endAt", t,
|
|
5767
5812
|
/*inclusive=*/ !0);
|
|
5768
5813
|
}
|
|
5769
5814
|
|
|
5770
|
-
/** Helper function to create a bound from a document or fields */ function
|
|
5771
|
-
if (n[0] = d(n[0]), n[0] instanceof
|
|
5815
|
+
/** Helper function to create a bound from a document or fields */ function zr(t, e, n, r) {
|
|
5816
|
+
if (n[0] = d(n[0]), n[0] instanceof vr) return function(t, e, n, r, s) {
|
|
5772
5817
|
if (!r) throw new B(D, `Can't use a DocumentSnapshot that doesn't exist for ${n}().`);
|
|
5773
5818
|
const i = [];
|
|
5774
5819
|
// Because people expect to continue/end a query at the exact document
|
|
@@ -5778,22 +5823,22 @@ function Ur(...t) {
|
|
|
5778
5823
|
// the provided document. Without the key (by using the explicit sort
|
|
5779
5824
|
// orders), multiple documents could match the position, yielding duplicate
|
|
5780
5825
|
// results.
|
|
5781
|
-
for (const n of
|
|
5826
|
+
for (const n of Ne(t)) if (n.field.isKeyField()) i.push(Gt(e, r.key)); else {
|
|
5782
5827
|
const t = r.data.field(n.field);
|
|
5783
|
-
if (
|
|
5828
|
+
if (Ct(t)) throw new B($, 'Invalid query. You are trying to start or end a query using a document for which the field "' + n.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');
|
|
5784
5829
|
if (null === t) {
|
|
5785
5830
|
const t = n.field.canonicalString();
|
|
5786
5831
|
throw new B($, `Invalid query. You are trying to start or end a query using a document for which the field '${t}' (used as the orderBy) does not exist.`);
|
|
5787
5832
|
}
|
|
5788
5833
|
i.push(t);
|
|
5789
5834
|
}
|
|
5790
|
-
return new
|
|
5835
|
+
return new Xt(i, s);
|
|
5791
5836
|
}
|
|
5792
5837
|
/**
|
|
5793
5838
|
* Converts a list of field values to a `Bound` for the given query.
|
|
5794
5839
|
*/ (t._query, t.firestore._databaseId, e, n[0]._document, r);
|
|
5795
5840
|
{
|
|
5796
|
-
const s =
|
|
5841
|
+
const s = tr(t.firestore);
|
|
5797
5842
|
return function(t, e, n, r, s, i) {
|
|
5798
5843
|
// Use explicit order by's because it has to match the query the user made
|
|
5799
5844
|
const o = t.explicitOrderBy;
|
|
@@ -5803,17 +5848,17 @@ function Ur(...t) {
|
|
|
5803
5848
|
const c = s[i];
|
|
5804
5849
|
if (o[i].field.isKeyField()) {
|
|
5805
5850
|
if ("string" != typeof c) throw new B($, `Invalid query. Expected a string for document ID in ${r}(), but got a ${typeof c}`);
|
|
5806
|
-
if (
|
|
5851
|
+
if (!$e(t) && -1 !== c.indexOf("/")) throw new B($, `Invalid query. When querying a collection and ordering by documentId(), the value passed to ${r}() must be a plain document ID, but '${c}' contains a slash.`);
|
|
5807
5852
|
const n = t.path.child(nt.fromString(c));
|
|
5808
5853
|
if (!it.isDocumentKey(n)) throw new B($, `Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${r}() must result in a valid document path, but '${n}' is not because it contains an odd number of segments.`);
|
|
5809
5854
|
const s = new it(n);
|
|
5810
|
-
u.push(
|
|
5855
|
+
u.push(Gt(e, s));
|
|
5811
5856
|
} else {
|
|
5812
|
-
const t =
|
|
5857
|
+
const t = hr(n, r, c);
|
|
5813
5858
|
u.push(t);
|
|
5814
5859
|
}
|
|
5815
5860
|
}
|
|
5816
|
-
return new
|
|
5861
|
+
return new Xt(u, i);
|
|
5817
5862
|
}
|
|
5818
5863
|
/**
|
|
5819
5864
|
* Parses the given `documentIdValue` into a `ReferenceValue`, throwing
|
|
@@ -5823,22 +5868,22 @@ function Ur(...t) {
|
|
|
5823
5868
|
}
|
|
5824
5869
|
}
|
|
5825
5870
|
|
|
5826
|
-
function
|
|
5871
|
+
function Qr(t, e, n) {
|
|
5827
5872
|
if ("string" == typeof (n = d(n))) {
|
|
5828
5873
|
if ("" === n) throw new B($, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
|
|
5829
|
-
if (
|
|
5874
|
+
if (!$e(e) && -1 !== n.indexOf("/")) throw new B($, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);
|
|
5830
5875
|
const r = e.path.child(nt.fromString(n));
|
|
5831
5876
|
if (!it.isDocumentKey(r)) throw new B($, `Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);
|
|
5832
|
-
return
|
|
5877
|
+
return Gt(t, new it(r));
|
|
5833
5878
|
}
|
|
5834
|
-
if (n instanceof
|
|
5879
|
+
if (n instanceof qn) return Gt(t, n._key);
|
|
5835
5880
|
throw new B($, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${at(n)}.`);
|
|
5836
5881
|
}
|
|
5837
5882
|
|
|
5838
5883
|
/**
|
|
5839
5884
|
* Validates that the value passed into a disjunctive filter satisfies all
|
|
5840
5885
|
* array requirements.
|
|
5841
|
-
*/ function
|
|
5886
|
+
*/ function Wr(t, e) {
|
|
5842
5887
|
if (!Array.isArray(t) || 0 === t.length) throw new B($, `Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);
|
|
5843
5888
|
}
|
|
5844
5889
|
|
|
@@ -5851,12 +5896,12 @@ function Br(t, e, n) {
|
|
|
5851
5896
|
* Operators in a query must adhere to the following set of rules:
|
|
5852
5897
|
* 1. Only one inequality per query.
|
|
5853
5898
|
* 2. `NOT_IN` cannot be used with array, disjunctive, or `NOT_EQUAL` operators.
|
|
5854
|
-
*/ function
|
|
5899
|
+
*/ function Gr(t, e) {
|
|
5855
5900
|
if (e.isInequality()) {
|
|
5856
|
-
const n =
|
|
5901
|
+
const n = Ve(t), r = e.field;
|
|
5857
5902
|
if (null !== n && !n.isEqual(r)) throw new B($, `Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${n.toString()}' and '${r.toString()}'`);
|
|
5858
|
-
const s =
|
|
5859
|
-
null !== s &&
|
|
5903
|
+
const s = Pe(t);
|
|
5904
|
+
null !== s && Kr(t, r, s);
|
|
5860
5905
|
}
|
|
5861
5906
|
const n = function(t, e) {
|
|
5862
5907
|
for (const n of t) for (const t of n.getFlattenedFilters()) if (e.indexOf(t.op) >= 0) return t.op;
|
|
@@ -5882,12 +5927,12 @@ function Br(t, e, n) {
|
|
|
5882
5927
|
throw n === e.op ? new B($, `Invalid query. You cannot use more than one '${e.op.toString()}' filter.`) : new B($, `Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`);
|
|
5883
5928
|
}
|
|
5884
5929
|
|
|
5885
|
-
function
|
|
5930
|
+
function Kr(t, e, n) {
|
|
5886
5931
|
if (!n.isEqual(e)) throw new B($, `Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${e.toString()}' and so you must also use '${e.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${n.toString()}' instead.`);
|
|
5887
5932
|
}
|
|
5888
5933
|
|
|
5889
|
-
function
|
|
5890
|
-
if (!(e instanceof
|
|
5934
|
+
function Yr(t, e) {
|
|
5935
|
+
if (!(e instanceof Vr || e instanceof Nr)) throw new B($, `Function ${t}() requires AppliableConstraints created with a call to 'where(...)', 'or(...)', or 'and(...)'.`);
|
|
5891
5936
|
}
|
|
5892
5937
|
|
|
5893
5938
|
/**
|
|
@@ -5915,7 +5960,7 @@ function Gr(t, e) {
|
|
|
5915
5960
|
* their `set()` or fails due to invalid data originating from a `toFirestore()`
|
|
5916
5961
|
* call.
|
|
5917
5962
|
*/
|
|
5918
|
-
function
|
|
5963
|
+
function Hr(t, e, n) {
|
|
5919
5964
|
let r;
|
|
5920
5965
|
// Cast to `any` in order to satisfy the union type constraint on
|
|
5921
5966
|
// toFirestore().
|
|
@@ -5924,9 +5969,9 @@ function Kr(t, e, n) {
|
|
|
5924
5969
|
r;
|
|
5925
5970
|
}
|
|
5926
5971
|
|
|
5927
|
-
class
|
|
5972
|
+
class Zr extends class {
|
|
5928
5973
|
convertValue(t, e = "none") {
|
|
5929
|
-
switch (
|
|
5974
|
+
switch (jt(t)) {
|
|
5930
5975
|
case 0 /* TypeOrder.NullValue */ :
|
|
5931
5976
|
return null;
|
|
5932
5977
|
|
|
@@ -5934,7 +5979,7 @@ class Yr extends class {
|
|
|
5934
5979
|
return t.booleanValue;
|
|
5935
5980
|
|
|
5936
5981
|
case 2 /* TypeOrder.NumberValue */ :
|
|
5937
|
-
return
|
|
5982
|
+
return qt(t.integerValue || t.doubleValue);
|
|
5938
5983
|
|
|
5939
5984
|
case 3 /* TypeOrder.TimestampValue */ :
|
|
5940
5985
|
return this.convertTimestamp(t.timestampValue);
|
|
@@ -5946,7 +5991,7 @@ class Yr extends class {
|
|
|
5946
5991
|
return t.stringValue;
|
|
5947
5992
|
|
|
5948
5993
|
case 6 /* TypeOrder.BlobValue */ :
|
|
5949
|
-
return this.convertBytes(
|
|
5994
|
+
return this.convertBytes(Ot(t.bytesValue));
|
|
5950
5995
|
|
|
5951
5996
|
case 7 /* TypeOrder.RefValue */ :
|
|
5952
5997
|
return this.convertReference(t.referenceValue);
|
|
@@ -5966,12 +6011,12 @@ class Yr extends class {
|
|
|
5966
6011
|
}
|
|
5967
6012
|
convertObject(t, e) {
|
|
5968
6013
|
const n = {};
|
|
5969
|
-
return
|
|
6014
|
+
return $t(t.fields, ((t, r) => {
|
|
5970
6015
|
n[t] = this.convertValue(r, e);
|
|
5971
6016
|
})), n;
|
|
5972
6017
|
}
|
|
5973
6018
|
convertGeoPoint(t) {
|
|
5974
|
-
return new
|
|
6019
|
+
return new Gn(qt(t.latitude), qt(t.longitude));
|
|
5975
6020
|
}
|
|
5976
6021
|
convertArray(t, e) {
|
|
5977
6022
|
return (t.values || []).map((t => this.convertValue(t, e)));
|
|
@@ -5979,23 +6024,23 @@ class Yr extends class {
|
|
|
5979
6024
|
convertServerTimestamp(t, e) {
|
|
5980
6025
|
switch (e) {
|
|
5981
6026
|
case "previous":
|
|
5982
|
-
const n =
|
|
6027
|
+
const n = Lt(t);
|
|
5983
6028
|
return null == n ? null : this.convertValue(n, e);
|
|
5984
6029
|
|
|
5985
6030
|
case "estimate":
|
|
5986
|
-
return this.convertTimestamp(
|
|
6031
|
+
return this.convertTimestamp(Mt(t));
|
|
5987
6032
|
|
|
5988
6033
|
default:
|
|
5989
6034
|
return null;
|
|
5990
6035
|
}
|
|
5991
6036
|
}
|
|
5992
6037
|
convertTimestamp(t) {
|
|
5993
|
-
const e =
|
|
5994
|
-
return new
|
|
6038
|
+
const e = St(t);
|
|
6039
|
+
return new kt(e.seconds, e.nanos);
|
|
5995
6040
|
}
|
|
5996
6041
|
convertDocumentKey(t, e) {
|
|
5997
6042
|
const n = nt.fromString(t);
|
|
5998
|
-
I(
|
|
6043
|
+
I(yn(n));
|
|
5999
6044
|
const r = new tt(n.get(1), n.get(3)), s = new it(n.popFirst(5));
|
|
6000
6045
|
return r.isEqual(e) ||
|
|
6001
6046
|
// TODO(b/64130202): Somehow support foreign references.
|
|
@@ -6007,11 +6052,11 @@ class Yr extends class {
|
|
|
6007
6052
|
super(), this.firestore = t;
|
|
6008
6053
|
}
|
|
6009
6054
|
convertBytes(t) {
|
|
6010
|
-
return new
|
|
6055
|
+
return new Bn(t);
|
|
6011
6056
|
}
|
|
6012
6057
|
convertReference(t) {
|
|
6013
6058
|
const e = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
6014
|
-
return new
|
|
6059
|
+
return new qn(this.firestore, /* converter= */ null, e);
|
|
6015
6060
|
}
|
|
6016
6061
|
}
|
|
6017
6062
|
|
|
@@ -6027,12 +6072,12 @@ class Yr extends class {
|
|
|
6027
6072
|
* @param reference - The reference of the document to fetch.
|
|
6028
6073
|
* @returns A Promise resolved with a `DocumentSnapshot` containing the current
|
|
6029
6074
|
* document contents.
|
|
6030
|
-
*/ function
|
|
6031
|
-
const e =
|
|
6032
|
-
return
|
|
6075
|
+
*/ function Jr(t) {
|
|
6076
|
+
const e = Rn((t = ht(t, qn)).firestore), n = new Zr(t.firestore);
|
|
6077
|
+
return En(e, [ t._key ]).then((e => {
|
|
6033
6078
|
I(1 === e.length);
|
|
6034
6079
|
const r = e[0];
|
|
6035
|
-
return new
|
|
6080
|
+
return new vr(t.firestore, n, t._key, r.isFoundDocument() ? r : null, t.converter);
|
|
6036
6081
|
}));
|
|
6037
6082
|
}
|
|
6038
6083
|
|
|
@@ -6047,33 +6092,33 @@ class Yr extends class {
|
|
|
6047
6092
|
*
|
|
6048
6093
|
* @param query - The `Query` to execute.
|
|
6049
6094
|
* @returns A Promise that will be resolved with the results of the query.
|
|
6050
|
-
*/ function
|
|
6095
|
+
*/ function Xr(t) {
|
|
6051
6096
|
!function(t) {
|
|
6052
6097
|
if ("L" /* LimitType.Last */ === t.limitType && 0 === t.explicitOrderBy.length) throw new B(L, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
6053
|
-
}((t = ht(t,
|
|
6054
|
-
const e =
|
|
6055
|
-
return
|
|
6056
|
-
const r = e.map((e => new
|
|
6098
|
+
}((t = ht(t, On))._query);
|
|
6099
|
+
const e = Rn(t.firestore), n = new Zr(t.firestore);
|
|
6100
|
+
return An(e, t._query).then((e => {
|
|
6101
|
+
const r = e.map((e => new br(t.firestore, n, e.key, e, t.converter)));
|
|
6057
6102
|
return "L" /* LimitType.Last */ === t._query.limitType &&
|
|
6058
6103
|
// Limit to last queries reverse the orderBy constraint that was
|
|
6059
6104
|
// specified by the user. As such, we need to reverse the order of the
|
|
6060
6105
|
// results to return the documents in the expected order.
|
|
6061
|
-
r.reverse(), new
|
|
6106
|
+
r.reverse(), new Er(t, r);
|
|
6062
6107
|
}));
|
|
6063
6108
|
}
|
|
6064
6109
|
|
|
6065
|
-
function
|
|
6066
|
-
const r =
|
|
6067
|
-
return
|
|
6110
|
+
function ts(t, e, n) {
|
|
6111
|
+
const r = Hr((t = ht(t, qn)).converter, e, n), s = er(tr(t.firestore), "setDoc", t._key, r, null !== t.converter, n);
|
|
6112
|
+
return bn(Rn(t.firestore), [ s.toMutation(t._key, Ue.none()) ]);
|
|
6068
6113
|
}
|
|
6069
6114
|
|
|
6070
|
-
function
|
|
6071
|
-
const s =
|
|
6115
|
+
function es(t, e, n, ...r) {
|
|
6116
|
+
const s = tr((t = ht(t, qn)).firestore);
|
|
6072
6117
|
// For Compat types, we have to "extract" the underlying types before
|
|
6073
6118
|
// performing validation.
|
|
6074
6119
|
let i;
|
|
6075
|
-
i = "string" == typeof (e = d(e)) || e instanceof
|
|
6076
|
-
return
|
|
6120
|
+
i = "string" == typeof (e = d(e)) || e instanceof zn ? ar(s, "updateDoc", t._key, e, n, r) : cr(s, "updateDoc", t._key, e);
|
|
6121
|
+
return bn(Rn(t.firestore), [ i.toMutation(t._key, Ue.exists(!0)) ]);
|
|
6077
6122
|
}
|
|
6078
6123
|
|
|
6079
6124
|
/**
|
|
@@ -6087,8 +6132,8 @@ function Xr(t, e, n, ...r) {
|
|
|
6087
6132
|
* @param reference - A reference to the document to delete.
|
|
6088
6133
|
* @returns A `Promise` resolved once the document has been successfully
|
|
6089
6134
|
* deleted from the backend.
|
|
6090
|
-
*/ function
|
|
6091
|
-
return
|
|
6135
|
+
*/ function ns(t) {
|
|
6136
|
+
return bn(Rn((t = ht(t, qn)).firestore), [ new Qe(t._key, Ue.none()) ]);
|
|
6092
6137
|
}
|
|
6093
6138
|
|
|
6094
6139
|
/**
|
|
@@ -6105,9 +6150,9 @@ function Xr(t, e, n, ...r) {
|
|
|
6105
6150
|
* @throws Error - If the provided input is not a valid Firestore document.
|
|
6106
6151
|
* @returns A `Promise` resolved with a `DocumentReference` pointing to the
|
|
6107
6152
|
* newly created document after it has been written to the backend.
|
|
6108
|
-
*/ function
|
|
6109
|
-
const n =
|
|
6110
|
-
return
|
|
6153
|
+
*/ function rs(t, e) {
|
|
6154
|
+
const n = Mn(t = ht(t, kn)), r = Hr(t.converter, e), s = er(tr(t.firestore), "addDoc", n._key, r, null !== n.converter, {});
|
|
6155
|
+
return bn(Rn(t.firestore), [ s.toMutation(n._key, Ue.exists(!1)) ]).then((() => n));
|
|
6111
6156
|
}
|
|
6112
6157
|
|
|
6113
6158
|
/**
|
|
@@ -6139,9 +6184,9 @@ function Xr(t, e, n, ...r) {
|
|
|
6139
6184
|
* @returns A Promise that will be resolved with the count; the count can be
|
|
6140
6185
|
* retrieved from `snapshot.data().count`, where `snapshot` is the
|
|
6141
6186
|
* `AggregateQuerySnapshot` to which the returned Promise resolves.
|
|
6142
|
-
*/ function
|
|
6143
|
-
return
|
|
6144
|
-
count:
|
|
6187
|
+
*/ function ss(t) {
|
|
6188
|
+
return is(t, {
|
|
6189
|
+
count: cs()
|
|
6145
6190
|
});
|
|
6146
6191
|
}
|
|
6147
6192
|
|
|
@@ -6171,16 +6216,16 @@ function Xr(t, e, n, ...r) {
|
|
|
6171
6216
|
* const averageScore: number | null = aggregateSnapshot.data().averageScore;
|
|
6172
6217
|
* ```
|
|
6173
6218
|
* @internal TODO (sum/avg) remove when public
|
|
6174
|
-
*/ function
|
|
6175
|
-
const n = ht(t.firestore,
|
|
6219
|
+
*/ function is(t, e) {
|
|
6220
|
+
const n = ht(t.firestore, Vn), r = Rn(n), s = function(t, e) {
|
|
6176
6221
|
const n = [];
|
|
6177
6222
|
for (const r in t) Object.prototype.hasOwnProperty.call(t, r) && n.push(e(t[r], r, t));
|
|
6178
6223
|
return n;
|
|
6179
|
-
}(e, ((t, e) => new
|
|
6224
|
+
}(e, ((t, e) => new At(new Et(e), t._aggregateType, t._internalFieldPath)));
|
|
6180
6225
|
// Run the aggregation and convert the results
|
|
6181
|
-
return
|
|
6182
|
-
const r = new
|
|
6183
|
-
return new
|
|
6226
|
+
return In(r, t._query, s).then((e => function(t, e, n) {
|
|
6227
|
+
const r = new Zr(t);
|
|
6228
|
+
return new Sn(e, r, n);
|
|
6184
6229
|
}
|
|
6185
6230
|
/**
|
|
6186
6231
|
* Create an AggregateField object that can be used to compute the sum of
|
|
@@ -6190,8 +6235,8 @@ function Xr(t, e, n, ...r) {
|
|
|
6190
6235
|
*/ (n, t, e)));
|
|
6191
6236
|
}
|
|
6192
6237
|
|
|
6193
|
-
function
|
|
6194
|
-
return new
|
|
6238
|
+
function os(t) {
|
|
6239
|
+
return new xn("sum", mr("sum", t));
|
|
6195
6240
|
}
|
|
6196
6241
|
|
|
6197
6242
|
/**
|
|
@@ -6199,16 +6244,16 @@ function ss(t) {
|
|
|
6199
6244
|
* a specified field over a range of documents in the result set of a query.
|
|
6200
6245
|
* @param field Specifies the field to average across the result set.
|
|
6201
6246
|
* @internal TODO (sum/avg) remove when public
|
|
6202
|
-
*/ function
|
|
6203
|
-
return new
|
|
6247
|
+
*/ function us(t) {
|
|
6248
|
+
return new xn("avg", mr("average", t));
|
|
6204
6249
|
}
|
|
6205
6250
|
|
|
6206
6251
|
/**
|
|
6207
6252
|
* Create an AggregateField object that can be used to compute the count of
|
|
6208
6253
|
* documents in the result set of a query.
|
|
6209
6254
|
* @internal TODO (sum/avg) remove when public
|
|
6210
|
-
*/ function
|
|
6211
|
-
return new
|
|
6255
|
+
*/ function cs() {
|
|
6256
|
+
return new xn("count");
|
|
6212
6257
|
}
|
|
6213
6258
|
|
|
6214
6259
|
/**
|
|
@@ -6217,9 +6262,9 @@ function ss(t) {
|
|
|
6217
6262
|
* @param left Compare this AggregateField to the `right`.
|
|
6218
6263
|
* @param right Compare this AggregateField to the `left`.
|
|
6219
6264
|
* @internal TODO (sum/avg) remove when public
|
|
6220
|
-
*/ function
|
|
6265
|
+
*/ function as(t, e) {
|
|
6221
6266
|
var n, r;
|
|
6222
|
-
return t instanceof
|
|
6267
|
+
return t instanceof xn && e instanceof xn && 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());
|
|
6223
6268
|
}
|
|
6224
6269
|
|
|
6225
6270
|
/**
|
|
@@ -6233,8 +6278,8 @@ function ss(t) {
|
|
|
6233
6278
|
*
|
|
6234
6279
|
* @returns `true` if the objects are "equal", as defined above, or `false`
|
|
6235
6280
|
* otherwise.
|
|
6236
|
-
*/ function
|
|
6237
|
-
return
|
|
6281
|
+
*/ function hs(t, e) {
|
|
6282
|
+
return jn(t.query, e.query) && w(t.data(), e.data());
|
|
6238
6283
|
}
|
|
6239
6284
|
|
|
6240
6285
|
/**
|
|
@@ -6256,15 +6301,15 @@ function ss(t) {
|
|
|
6256
6301
|
/**
|
|
6257
6302
|
* Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or
|
|
6258
6303
|
* {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion.
|
|
6259
|
-
*/ function
|
|
6260
|
-
return new
|
|
6304
|
+
*/ function ls() {
|
|
6305
|
+
return new nr("deleteField");
|
|
6261
6306
|
}
|
|
6262
6307
|
|
|
6263
6308
|
/**
|
|
6264
6309
|
* Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
|
|
6265
6310
|
* include a server-generated timestamp in the written data.
|
|
6266
|
-
*/ function
|
|
6267
|
-
return new
|
|
6311
|
+
*/ function fs() {
|
|
6312
|
+
return new sr("serverTimestamp");
|
|
6268
6313
|
}
|
|
6269
6314
|
|
|
6270
6315
|
/**
|
|
@@ -6278,10 +6323,10 @@ function ss(t) {
|
|
|
6278
6323
|
* @param elements - The elements to union into the array.
|
|
6279
6324
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
6280
6325
|
* `updateDoc()`.
|
|
6281
|
-
*/ function
|
|
6326
|
+
*/ function ds(...t) {
|
|
6282
6327
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
6283
6328
|
// update() since we'd need the Firestore instance to do this.
|
|
6284
|
-
return new
|
|
6329
|
+
return new ir("arrayUnion", t);
|
|
6285
6330
|
}
|
|
6286
6331
|
|
|
6287
6332
|
/**
|
|
@@ -6294,10 +6339,10 @@ function ss(t) {
|
|
|
6294
6339
|
* @param elements - The elements to remove from the array.
|
|
6295
6340
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
6296
6341
|
* `updateDoc()`
|
|
6297
|
-
*/ function
|
|
6342
|
+
*/ function ws(...t) {
|
|
6298
6343
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
6299
6344
|
// update() since we'd need the Firestore instance to do this.
|
|
6300
|
-
return new
|
|
6345
|
+
return new or("arrayRemove", t);
|
|
6301
6346
|
}
|
|
6302
6347
|
|
|
6303
6348
|
/**
|
|
@@ -6318,8 +6363,8 @@ function ss(t) {
|
|
|
6318
6363
|
* @param n - The value to increment by.
|
|
6319
6364
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
6320
6365
|
* `updateDoc()`
|
|
6321
|
-
*/ function
|
|
6322
|
-
return new
|
|
6366
|
+
*/ function ms(t) {
|
|
6367
|
+
return new ur("increment", t);
|
|
6323
6368
|
}
|
|
6324
6369
|
|
|
6325
6370
|
/**
|
|
@@ -6345,25 +6390,25 @@ function ss(t) {
|
|
|
6345
6390
|
* provides methods for adding writes to the write batch. None of the writes
|
|
6346
6391
|
* will be committed (or visible locally) until {@link WriteBatch.commit} is
|
|
6347
6392
|
* called.
|
|
6348
|
-
*/ class
|
|
6393
|
+
*/ class ps {
|
|
6349
6394
|
/** @hideconstructor */
|
|
6350
6395
|
constructor(t, e) {
|
|
6351
6396
|
this._firestore = t, this._commitHandler = e, this._mutations = [], this._committed = !1,
|
|
6352
|
-
this._dataReader =
|
|
6397
|
+
this._dataReader = tr(t);
|
|
6353
6398
|
}
|
|
6354
6399
|
set(t, e, n) {
|
|
6355
6400
|
this._verifyNotCommitted();
|
|
6356
|
-
const r =
|
|
6357
|
-
return this._mutations.push(i.toMutation(r._key,
|
|
6401
|
+
const r = ys(t, this._firestore), s = Hr(r.converter, e, n), i = er(this._dataReader, "WriteBatch.set", r._key, s, null !== r.converter, n);
|
|
6402
|
+
return this._mutations.push(i.toMutation(r._key, Ue.none())), this;
|
|
6358
6403
|
}
|
|
6359
6404
|
update(t, e, n, ...r) {
|
|
6360
6405
|
this._verifyNotCommitted();
|
|
6361
|
-
const s =
|
|
6406
|
+
const s = ys(t, this._firestore);
|
|
6362
6407
|
// For Compat types, we have to "extract" the underlying types before
|
|
6363
6408
|
// performing validation.
|
|
6364
6409
|
let i;
|
|
6365
|
-
return i = "string" == typeof (e = d(e)) || e instanceof
|
|
6366
|
-
this._mutations.push(i.toMutation(s._key,
|
|
6410
|
+
return i = "string" == typeof (e = d(e)) || e instanceof zn ? ar(this._dataReader, "WriteBatch.update", s._key, e, n, r) : cr(this._dataReader, "WriteBatch.update", s._key, e),
|
|
6411
|
+
this._mutations.push(i.toMutation(s._key, Ue.exists(!0))), this;
|
|
6367
6412
|
}
|
|
6368
6413
|
/**
|
|
6369
6414
|
* Deletes the document referred to by the provided {@link DocumentReference}.
|
|
@@ -6372,8 +6417,8 @@ function ss(t) {
|
|
|
6372
6417
|
* @returns This `WriteBatch` instance. Used for chaining method calls.
|
|
6373
6418
|
*/ delete(t) {
|
|
6374
6419
|
this._verifyNotCommitted();
|
|
6375
|
-
const e =
|
|
6376
|
-
return this._mutations = this._mutations.concat(new
|
|
6420
|
+
const e = ys(t, this._firestore);
|
|
6421
|
+
return this._mutations = this._mutations.concat(new Qe(e._key, Ue.none())), this;
|
|
6377
6422
|
}
|
|
6378
6423
|
/**
|
|
6379
6424
|
* Commits all of the writes in this write batch as a single atomic unit.
|
|
@@ -6394,7 +6439,7 @@ function ss(t) {
|
|
|
6394
6439
|
}
|
|
6395
6440
|
}
|
|
6396
6441
|
|
|
6397
|
-
function
|
|
6442
|
+
function ys(t, e) {
|
|
6398
6443
|
if ((t = d(t)).firestore !== e) throw new B($, "Provided document reference is from a different Firestore instance.");
|
|
6399
6444
|
return t;
|
|
6400
6445
|
}
|
|
@@ -6411,9 +6456,9 @@ function ms(t, e) {
|
|
|
6411
6456
|
*
|
|
6412
6457
|
* @returns A `WriteBatch` that can be used to atomically execute multiple
|
|
6413
6458
|
* writes.
|
|
6414
|
-
*/ function
|
|
6415
|
-
const e =
|
|
6416
|
-
return new
|
|
6459
|
+
*/ function gs(t) {
|
|
6460
|
+
const e = Rn(t = ht(t, Vn));
|
|
6461
|
+
return new ps(t, (t => bn(e, t)));
|
|
6417
6462
|
}
|
|
6418
6463
|
|
|
6419
6464
|
/**
|
|
@@ -6435,7 +6480,7 @@ function ms(t, e) {
|
|
|
6435
6480
|
/**
|
|
6436
6481
|
* Internal transaction object responsible for accumulating the mutations to
|
|
6437
6482
|
* perform and the base versions for any documents read.
|
|
6438
|
-
*/ class
|
|
6483
|
+
*/ class _s {
|
|
6439
6484
|
constructor(t) {
|
|
6440
6485
|
this.datastore = t,
|
|
6441
6486
|
// The version of each document that was read during this transaction.
|
|
@@ -6455,7 +6500,7 @@ function ms(t, e) {
|
|
|
6455
6500
|
}
|
|
6456
6501
|
async lookup(t) {
|
|
6457
6502
|
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new B($, "Firestore transactions require all reads to be executed before all writes.");
|
|
6458
|
-
const e = await
|
|
6503
|
+
const e = await En(this.datastore, t);
|
|
6459
6504
|
return e.forEach((t => this.recordVersion(t))), e;
|
|
6460
6505
|
}
|
|
6461
6506
|
set(t, e) {
|
|
@@ -6470,7 +6515,7 @@ function ms(t, e) {
|
|
|
6470
6515
|
this.writtenDocs.add(t.toString());
|
|
6471
6516
|
}
|
|
6472
6517
|
delete(t) {
|
|
6473
|
-
this.write(new
|
|
6518
|
+
this.write(new Qe(t, this.precondition(t))), this.writtenDocs.add(t.toString());
|
|
6474
6519
|
}
|
|
6475
6520
|
async commit() {
|
|
6476
6521
|
if (this.ensureCommitNotCalled(), this.lastWriteError) throw this.lastWriteError;
|
|
@@ -6483,15 +6528,15 @@ function ms(t, e) {
|
|
|
6483
6528
|
// a `verify` operation.
|
|
6484
6529
|
t.forEach(((t, e) => {
|
|
6485
6530
|
const n = it.fromPath(e);
|
|
6486
|
-
this.mutations.push(new
|
|
6487
|
-
})), await
|
|
6531
|
+
this.mutations.push(new We(n, this.precondition(n)));
|
|
6532
|
+
})), await bn(this.datastore, this.mutations), this.committed = !0;
|
|
6488
6533
|
}
|
|
6489
6534
|
recordVersion(t) {
|
|
6490
6535
|
let e;
|
|
6491
6536
|
if (t.isFoundDocument()) e = t.version; else {
|
|
6492
6537
|
if (!t.isNoDocument()) throw A();
|
|
6493
6538
|
// Represent a deleted doc using SnapshotVersion.min().
|
|
6494
|
-
e =
|
|
6539
|
+
e = me.min();
|
|
6495
6540
|
}
|
|
6496
6541
|
const n = this.readVersions.get(t.key.toString());
|
|
6497
6542
|
if (n) {
|
|
@@ -6505,7 +6550,7 @@ function ms(t, e) {
|
|
|
6505
6550
|
* as a precondition, or no precondition if it was not read.
|
|
6506
6551
|
*/ precondition(t) {
|
|
6507
6552
|
const e = this.readVersions.get(t.toString());
|
|
6508
|
-
return !this.writtenDocs.has(t.toString()) && e ? e.isEqual(
|
|
6553
|
+
return !this.writtenDocs.has(t.toString()) && e ? e.isEqual(me.min()) ? Ue.exists(!1) : Ue.updateTime(e) : Ue.none();
|
|
6509
6554
|
}
|
|
6510
6555
|
/**
|
|
6511
6556
|
* Returns the precondition for a document if the operation is an update.
|
|
@@ -6514,7 +6559,7 @@ function ms(t, e) {
|
|
|
6514
6559
|
// The first time a document is written, we want to take into account the
|
|
6515
6560
|
// read time and existence
|
|
6516
6561
|
if (!this.writtenDocs.has(t.toString()) && e) {
|
|
6517
|
-
if (e.isEqual(
|
|
6562
|
+
if (e.isEqual(me.min()))
|
|
6518
6563
|
// The document doesn't exist, so fail the transaction.
|
|
6519
6564
|
// This has to be validated locally because you can't send a
|
|
6520
6565
|
// precondition that a document does not exist without changing the
|
|
@@ -6526,11 +6571,11 @@ function ms(t, e) {
|
|
|
6526
6571
|
// transaction.
|
|
6527
6572
|
throw new B($, "Can't update a document that doesn't exist.");
|
|
6528
6573
|
// Document exists, base precondition on document update time.
|
|
6529
|
-
return
|
|
6574
|
+
return Ue.updateTime(e);
|
|
6530
6575
|
}
|
|
6531
6576
|
// Document was not read, so we just use the preconditions for a blind
|
|
6532
6577
|
// update.
|
|
6533
|
-
return
|
|
6578
|
+
return Ue.exists(!0);
|
|
6534
6579
|
}
|
|
6535
6580
|
write(t) {
|
|
6536
6581
|
this.ensureCommitNotCalled(), this.mutations.push(t);
|
|
@@ -6553,7 +6598,7 @@ function ms(t, e) {
|
|
|
6553
6598
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
6554
6599
|
* See the License for the specific language governing permissions and
|
|
6555
6600
|
* limitations under the License.
|
|
6556
|
-
*/ const
|
|
6601
|
+
*/ const vs = {
|
|
6557
6602
|
maxAttempts: 5
|
|
6558
6603
|
};
|
|
6559
6604
|
|
|
@@ -6577,17 +6622,17 @@ function ms(t, e) {
|
|
|
6577
6622
|
* TransactionRunner encapsulates the logic needed to run and retry transactions
|
|
6578
6623
|
* with backoff.
|
|
6579
6624
|
*/
|
|
6580
|
-
class
|
|
6625
|
+
class bs {
|
|
6581
6626
|
constructor(t, e, n, r, s) {
|
|
6582
6627
|
this.asyncQueue = t, this.datastore = e, this.options = n, this.updateFunction = r,
|
|
6583
|
-
this.deferred = s, this._t = n.maxAttempts, this.vt = new
|
|
6628
|
+
this.deferred = s, this._t = n.maxAttempts, this.vt = new _n(this.asyncQueue, "transaction_retry" /* TimerId.TransactionRetry */);
|
|
6584
6629
|
}
|
|
6585
6630
|
/** Runs the transaction and sets the result on deferred. */ run() {
|
|
6586
6631
|
this._t -= 1, this.bt();
|
|
6587
6632
|
}
|
|
6588
6633
|
bt() {
|
|
6589
6634
|
this.vt.J((async () => {
|
|
6590
|
-
const t = new
|
|
6635
|
+
const t = new _s(this.datastore), e = this.Et(t);
|
|
6591
6636
|
e && e.then((e => {
|
|
6592
6637
|
this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
|
|
6593
6638
|
this.deferred.resolve(e);
|
|
@@ -6602,7 +6647,7 @@ class _s {
|
|
|
6602
6647
|
Et(t) {
|
|
6603
6648
|
try {
|
|
6604
6649
|
const e = this.updateFunction(t);
|
|
6605
|
-
return !
|
|
6650
|
+
return !wt(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
|
|
6606
6651
|
null);
|
|
6607
6652
|
} catch (t) {
|
|
6608
6653
|
// Do not retry errors thrown by user provided updateFunction.
|
|
@@ -6677,7 +6722,7 @@ class _s {
|
|
|
6677
6722
|
* See the License for the specific language governing permissions and
|
|
6678
6723
|
* limitations under the License.
|
|
6679
6724
|
*/
|
|
6680
|
-
/** The Platform's 'document' implementation or null if not available. */ function
|
|
6725
|
+
/** The Platform's 'document' implementation or null if not available. */ function Es() {
|
|
6681
6726
|
// `document` is not always available, e.g. in ReactNative and WebWorkers.
|
|
6682
6727
|
// eslint-disable-next-line no-restricted-globals
|
|
6683
6728
|
return "undefined" != typeof document ? document : null;
|
|
@@ -6709,7 +6754,7 @@ class _s {
|
|
|
6709
6754
|
* Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type
|
|
6710
6755
|
* in newer versions of TypeScript defines `finally`, which is not available in
|
|
6711
6756
|
* IE.
|
|
6712
|
-
*/ class
|
|
6757
|
+
*/ class As {
|
|
6713
6758
|
constructor(t, e, n, r, s) {
|
|
6714
6759
|
this.asyncQueue = t, this.timerId = e, this.targetTimeMs = n, this.op = r, this.removalCallback = s,
|
|
6715
6760
|
this.deferred = new z, this.then = this.deferred.promise.then.bind(this.deferred.promise),
|
|
@@ -6732,7 +6777,7 @@ class _s {
|
|
|
6732
6777
|
* PORTING NOTE: This exists to prevent making removeDelayedOperation() and
|
|
6733
6778
|
* the DelayedOperation class public.
|
|
6734
6779
|
*/ static createAndSchedule(t, e, n, r, s) {
|
|
6735
|
-
const i = Date.now() + n, o = new
|
|
6780
|
+
const i = Date.now() + n, o = new As(t, e, i, r, s);
|
|
6736
6781
|
return o.start(n), o;
|
|
6737
6782
|
}
|
|
6738
6783
|
/**
|
|
@@ -6781,7 +6826,7 @@ class _s {
|
|
|
6781
6826
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
6782
6827
|
* See the License for the specific language governing permissions and
|
|
6783
6828
|
* limitations under the License.
|
|
6784
|
-
*/ class
|
|
6829
|
+
*/ class Is {
|
|
6785
6830
|
constructor() {
|
|
6786
6831
|
// The last promise in the queue.
|
|
6787
6832
|
this.Tt = Promise.resolve(),
|
|
@@ -6804,15 +6849,15 @@ class _s {
|
|
|
6804
6849
|
// List of TimerIds to fast-forward delays for.
|
|
6805
6850
|
this.Ft = [],
|
|
6806
6851
|
// Backoff timer used to schedule retries for retryable operations
|
|
6807
|
-
this.vt = new
|
|
6852
|
+
this.vt = new _n(this, "async_queue_retry" /* TimerId.AsyncQueueRetry */),
|
|
6808
6853
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
6809
6854
|
// operations. Meant to speed up recovery when we regain file system access
|
|
6810
6855
|
// after page comes into foreground.
|
|
6811
6856
|
this.xt = () => {
|
|
6812
|
-
const t =
|
|
6857
|
+
const t = Es();
|
|
6813
6858
|
t && _("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.vt.tt();
|
|
6814
6859
|
};
|
|
6815
|
-
const t =
|
|
6860
|
+
const t = Es();
|
|
6816
6861
|
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.xt);
|
|
6817
6862
|
}
|
|
6818
6863
|
get isShuttingDown() {
|
|
@@ -6833,7 +6878,7 @@ class _s {
|
|
|
6833
6878
|
enterRestrictedMode(t) {
|
|
6834
6879
|
if (!this.Pt) {
|
|
6835
6880
|
this.Pt = !0, this.Dt = t || !1;
|
|
6836
|
-
const e =
|
|
6881
|
+
const e = Es();
|
|
6837
6882
|
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.xt);
|
|
6838
6883
|
}
|
|
6839
6884
|
}
|
|
@@ -6965,7 +7010,7 @@ class _s {
|
|
|
6965
7010
|
this.St(),
|
|
6966
7011
|
// Fast-forward delays for timerIds that have been overriden.
|
|
6967
7012
|
this.Ft.indexOf(t) > -1 && (e = 0);
|
|
6968
|
-
const r =
|
|
7013
|
+
const r = As.createAndSchedule(this, t, e, n, (t => this.kt(t)));
|
|
6969
7014
|
return this.Vt.push(r), r;
|
|
6970
7015
|
}
|
|
6971
7016
|
St() {
|
|
@@ -7019,10 +7064,10 @@ class _s {
|
|
|
7019
7064
|
}
|
|
7020
7065
|
}
|
|
7021
7066
|
|
|
7022
|
-
class
|
|
7067
|
+
class Ts {
|
|
7023
7068
|
/** @hideconstructor */
|
|
7024
7069
|
constructor(t, e) {
|
|
7025
|
-
this._firestore = t, this._transaction = e, this._dataReader =
|
|
7070
|
+
this._firestore = t, this._transaction = e, this._dataReader = tr(t);
|
|
7026
7071
|
}
|
|
7027
7072
|
/**
|
|
7028
7073
|
* Reads the document referenced by the provided {@link DocumentReference}.
|
|
@@ -7030,25 +7075,25 @@ class As {
|
|
|
7030
7075
|
* @param documentRef - A reference to the document to be read.
|
|
7031
7076
|
* @returns A `DocumentSnapshot` with the read data.
|
|
7032
7077
|
*/ get(t) {
|
|
7033
|
-
const e =
|
|
7078
|
+
const e = ys(t, this._firestore), n = new Zr(this._firestore);
|
|
7034
7079
|
return this._transaction.lookup([ e._key ]).then((t => {
|
|
7035
7080
|
if (!t || 1 !== t.length) return A();
|
|
7036
7081
|
const r = t[0];
|
|
7037
|
-
if (r.isFoundDocument()) return new
|
|
7038
|
-
if (r.isNoDocument()) return new
|
|
7082
|
+
if (r.isFoundDocument()) return new vr(this._firestore, n, r.key, r, e.converter);
|
|
7083
|
+
if (r.isNoDocument()) return new vr(this._firestore, n, e._key, null, e.converter);
|
|
7039
7084
|
throw A();
|
|
7040
7085
|
}));
|
|
7041
7086
|
}
|
|
7042
7087
|
set(t, e, n) {
|
|
7043
|
-
const r =
|
|
7088
|
+
const r = ys(t, this._firestore), s = Hr(r.converter, e, n), i = er(this._dataReader, "Transaction.set", r._key, s, null !== r.converter, n);
|
|
7044
7089
|
return this._transaction.set(r._key, i), this;
|
|
7045
7090
|
}
|
|
7046
7091
|
update(t, e, n, ...r) {
|
|
7047
|
-
const s =
|
|
7092
|
+
const s = ys(t, this._firestore);
|
|
7048
7093
|
// For Compat types, we have to "extract" the underlying types before
|
|
7049
7094
|
// performing validation.
|
|
7050
7095
|
let i;
|
|
7051
|
-
return i = "string" == typeof (e = d(e)) || e instanceof
|
|
7096
|
+
return i = "string" == typeof (e = d(e)) || e instanceof zn ? ar(this._dataReader, "Transaction.update", s._key, e, n, r) : cr(this._dataReader, "Transaction.update", s._key, e),
|
|
7052
7097
|
this._transaction.update(s._key, i), this;
|
|
7053
7098
|
}
|
|
7054
7099
|
/**
|
|
@@ -7057,7 +7102,7 @@ class As {
|
|
|
7057
7102
|
* @param documentRef - A reference to the document to be deleted.
|
|
7058
7103
|
* @returns This `Transaction` instance. Used for chaining method calls.
|
|
7059
7104
|
*/ delete(t) {
|
|
7060
|
-
const e =
|
|
7105
|
+
const e = ys(t, this._firestore);
|
|
7061
7106
|
return this._transaction.delete(e._key), this;
|
|
7062
7107
|
}
|
|
7063
7108
|
}
|
|
@@ -7080,13 +7125,13 @@ class As {
|
|
|
7080
7125
|
* (the `updateFunction` returned a failed promise), the promise returned by the
|
|
7081
7126
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
7082
7127
|
* rejected promise with the corresponding failure error is returned.
|
|
7083
|
-
*/ function
|
|
7084
|
-
const r =
|
|
7128
|
+
*/ function Rs(t, e, n) {
|
|
7129
|
+
const r = Rn(t = ht(t, Vn)), s = Object.assign(Object.assign({}, vs), n);
|
|
7085
7130
|
!function(t) {
|
|
7086
7131
|
if (t.maxAttempts < 1) throw new B($, "Max attempts must be at least 1");
|
|
7087
7132
|
}(s);
|
|
7088
7133
|
const i = new z;
|
|
7089
|
-
return new
|
|
7134
|
+
return new bs(new Is, r, s, (n => e(new Ts(t, n))), i).run(), i.promise;
|
|
7090
7135
|
}
|
|
7091
7136
|
|
|
7092
7137
|
/**
|
|
@@ -7099,7 +7144,7 @@ class As {
|
|
|
7099
7144
|
*/ !function(t) {
|
|
7100
7145
|
p = t;
|
|
7101
7146
|
}(`${s}_lite`), n(new i("firestore/lite", ((t, {instanceIdentifier: e, options: n}) => {
|
|
7102
|
-
const r = t.getProvider("app").getImmediate(), s = new
|
|
7147
|
+
const r = t.getProvider("app").getImmediate(), s = new Vn(new K(t.getProvider("auth-internal")), new J(t.getProvider("app-check-internal")), function(t, e) {
|
|
7103
7148
|
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new B($, '"projectId" not provided in firebase.initializeApp.');
|
|
7104
7149
|
return new tt(t.options.projectId, e);
|
|
7105
7150
|
}
|
|
@@ -7122,7 +7167,7 @@ class As {
|
|
|
7122
7167
|
return n && s._setSettings(n), s;
|
|
7123
7168
|
}), "PUBLIC").setMultipleInstances(!0)),
|
|
7124
7169
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
7125
|
-
r("firestore-lite", "3.
|
|
7170
|
+
r("firestore-lite", "3.9.0-20230314181055", "rn"), r("firestore-lite", "3.9.0-20230314181055", "esm2017");
|
|
7126
7171
|
|
|
7127
|
-
export {
|
|
7172
|
+
export { xn as AggregateField, Sn as AggregateQuerySnapshot, Bn as Bytes, kn as CollectionReference, qn as DocumentReference, vr as DocumentSnapshot, zn as FieldPath, Wn as FieldValue, Vn as Firestore, B as FirestoreError, Gn as GeoPoint, On as Query, Nr as QueryCompositeFilterConstraint, Rr as QueryConstraint, br as QueryDocumentSnapshot, Ur as QueryEndAtConstraint, Vr as QueryFieldFilterConstraint, qr as QueryLimitConstraint, xr as QueryOrderByConstraint, Er as QuerySnapshot, Cr as QueryStartAtConstraint, kt as Timestamp, Ts as Transaction, ps as WriteBatch, rs as addDoc, as as aggregateFieldEqual, hs as aggregateQuerySnapshotEqual, Fr as and, ws as arrayRemove, ds as arrayUnion, us as average, Cn as collection, Ln as collectionGroup, Dn as connectFirestoreEmulator, cs as count, ns as deleteDoc, ls as deleteField, Mn as doc, Qn as documentId, Br as endAt, jr as endBefore, is as getAggregate, ss as getCount, Jr as getDoc, Xr as getDocs, Nn as getFirestore, ms as increment, $n as initializeFirestore, Or as limit, kr as limitToLast, Dr as or, Sr as orderBy, Pr as query, jn as queryEqual, Un as refEqual, Rs as runTransaction, fs as serverTimestamp, ts as setDoc, g as setLogLevel, Ar as snapshotEqual, Mr as startAfter, Lr as startAt, os as sum, Fn as terminate, es as updateDoc, $r as where, gs as writeBatch };
|
|
7128
7173
|
//# sourceMappingURL=index.rn.esm2017.js.map
|