firebase 9.6.2 → 9.6.3
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/app/dist/index.cjs.js +1 -1
- package/app/dist/index.esm.js +1 -1
- package/app/dist/index.mjs +1 -1
- package/compat/app/dist/index.cjs.js +1 -1
- package/compat/app/dist/index.esm.js +1 -1
- package/compat/app/dist/index.mjs +1 -1
- package/compat/dist/index.esm.js +2 -2
- package/compat/dist/index.node.cjs +2 -2
- package/compat/dist/index.rn.cjs.js +2 -2
- package/firebase-analytics-compat.js.map +1 -1
- package/firebase-analytics.js +3 -3
- package/firebase-analytics.js.map +1 -1
- package/firebase-app-check-compat.js.map +1 -1
- package/firebase-app-check.js +4 -4
- package/firebase-app-check.js.map +1 -1
- package/firebase-app-compat.js +2 -2
- package/firebase-app-compat.js.map +1 -1
- package/firebase-app.js +9 -9
- package/firebase-app.js.map +1 -1
- package/firebase-auth-compat.js.map +1 -1
- package/firebase-auth.js +4 -4
- package/firebase-auth.js.map +1 -1
- package/firebase-compat.js +3 -3
- package/firebase-compat.js.map +1 -1
- package/firebase-database.js +4 -4
- package/firebase-firestore-compat.js +1 -1
- package/firebase-firestore-compat.js.map +1 -1
- package/firebase-firestore-lite.js +1141 -1141
- package/firebase-firestore-lite.js.map +1 -1
- package/firebase-firestore.js +874 -874
- package/firebase-firestore.js.map +1 -1
- package/firebase-functions-compat.js.map +1 -1
- package/firebase-functions.js +2 -2
- package/firebase-functions.js.map +1 -1
- package/firebase-messaging-compat.js +1 -1
- package/firebase-messaging-compat.js.map +1 -1
- package/firebase-messaging-sw.js +4 -4
- package/firebase-messaging-sw.js.map +1 -1
- package/firebase-messaging.js +3 -3
- package/firebase-messaging.js.map +1 -1
- package/firebase-performance-compat.js.map +1 -1
- package/firebase-performance-standalone-compat.es2017.js +5 -5
- package/firebase-performance-standalone-compat.es2017.js.map +1 -1
- package/firebase-performance-standalone-compat.js +1 -1
- package/firebase-performance-standalone-compat.js.map +1 -1
- package/firebase-performance.js +3 -3
- package/firebase-performance.js.map +1 -1
- package/firebase-remote-config-compat.js.map +1 -1
- package/firebase-remote-config.js +2 -2
- package/firebase-remote-config.js.map +1 -1
- package/firebase-storage-compat.js.map +1 -1
- package/firebase-storage.js +1 -1
- package/firebase-storage.js.map +1 -1
- package/package.json +7 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _registerComponent, registerVersion, _getProvider, getApp, _removeServiceInstance, SDK_VERSION } from 'https://www.gstatic.com/firebasejs/9.6.
|
|
1
|
+
import { _registerComponent, registerVersion, _getProvider, getApp, _removeServiceInstance, SDK_VERSION } from 'https://www.gstatic.com/firebasejs/9.6.3/firebase-app.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @license
|
|
@@ -740,7 +740,7 @@ l.MOCK_USER = new l("mock-user");
|
|
|
740
740
|
* See the License for the specific language governing permissions and
|
|
741
741
|
* limitations under the License.
|
|
742
742
|
*/
|
|
743
|
-
let f = "9.6.
|
|
743
|
+
let f = "9.6.3";
|
|
744
744
|
|
|
745
745
|
/**
|
|
746
746
|
* @license
|
|
@@ -776,26 +776,26 @@ const d = new Logger("@firebase/firestore");
|
|
|
776
776
|
d.setLogLevel(t);
|
|
777
777
|
}
|
|
778
778
|
|
|
779
|
-
function m(t, ...
|
|
779
|
+
function m(t, ...n) {
|
|
780
780
|
if (d.logLevel <= LogLevel.DEBUG) {
|
|
781
|
-
const
|
|
782
|
-
d.debug(`Firestore (${f}): ${t}`, ...
|
|
781
|
+
const e = n.map(_);
|
|
782
|
+
d.debug(`Firestore (${f}): ${t}`, ...e);
|
|
783
783
|
}
|
|
784
784
|
}
|
|
785
785
|
|
|
786
|
-
function p(t, ...
|
|
786
|
+
function p(t, ...n) {
|
|
787
787
|
if (d.logLevel <= LogLevel.ERROR) {
|
|
788
|
-
const
|
|
789
|
-
d.error(`Firestore (${f}): ${t}`, ...
|
|
788
|
+
const e = n.map(_);
|
|
789
|
+
d.error(`Firestore (${f}): ${t}`, ...e);
|
|
790
790
|
}
|
|
791
791
|
}
|
|
792
792
|
|
|
793
793
|
/**
|
|
794
794
|
* @internal
|
|
795
|
-
*/ function y(t, ...
|
|
795
|
+
*/ function y(t, ...n) {
|
|
796
796
|
if (d.logLevel <= LogLevel.WARN) {
|
|
797
|
-
const
|
|
798
|
-
d.warn(`Firestore (${f}): ${t}`, ...
|
|
797
|
+
const e = n.map(_);
|
|
798
|
+
d.warn(`Firestore (${f}): ${t}`, ...e);
|
|
799
799
|
}
|
|
800
800
|
}
|
|
801
801
|
|
|
@@ -804,8 +804,8 @@ function p(t, ...e) {
|
|
|
804
804
|
*/ function _(t) {
|
|
805
805
|
if ("string" == typeof t) return t;
|
|
806
806
|
try {
|
|
807
|
-
return
|
|
808
|
-
} catch (
|
|
807
|
+
return n = t, JSON.stringify(n);
|
|
808
|
+
} catch (n) {
|
|
809
809
|
// Converting to JSON failed, just log the object directly
|
|
810
810
|
return t;
|
|
811
811
|
}
|
|
@@ -826,7 +826,7 @@ function p(t, ...e) {
|
|
|
826
826
|
* limitations under the License.
|
|
827
827
|
*/
|
|
828
828
|
/** Formats an object as a JSON string, suitable for logging. */
|
|
829
|
-
var
|
|
829
|
+
var n;
|
|
830
830
|
}
|
|
831
831
|
|
|
832
832
|
/**
|
|
@@ -855,11 +855,11 @@ function p(t, ...e) {
|
|
|
855
855
|
*/ function g(t = "Unexpected state") {
|
|
856
856
|
// Log the failure in addition to throw an exception, just in case the
|
|
857
857
|
// exception is swallowed.
|
|
858
|
-
const
|
|
858
|
+
const n = `FIRESTORE (${f}) INTERNAL ASSERTION FAILED: ` + t;
|
|
859
859
|
// NOTE: We don't use FirestoreError here because these are internal failures
|
|
860
860
|
// that cannot be handled by the user. (Also it would create a circular
|
|
861
861
|
// dependency between the error and assert modules which doesn't work.)
|
|
862
|
-
throw p(
|
|
862
|
+
throw p(n), new Error(n);
|
|
863
863
|
}
|
|
864
864
|
|
|
865
865
|
/**
|
|
@@ -867,7 +867,7 @@ function p(t, ...e) {
|
|
|
867
867
|
* given message if it did.
|
|
868
868
|
*
|
|
869
869
|
* Messages are stripped in production builds.
|
|
870
|
-
*/ function v(t,
|
|
870
|
+
*/ function v(t, n) {
|
|
871
871
|
t || g();
|
|
872
872
|
}
|
|
873
873
|
|
|
@@ -876,7 +876,7 @@ function p(t, ...e) {
|
|
|
876
876
|
* instance of `T` before casting.
|
|
877
877
|
*/ function b(t,
|
|
878
878
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
879
|
-
|
|
879
|
+
n) {
|
|
880
880
|
return t;
|
|
881
881
|
}
|
|
882
882
|
|
|
@@ -895,7 +895,7 @@ e) {
|
|
|
895
895
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
896
896
|
* See the License for the specific language governing permissions and
|
|
897
897
|
* limitations under the License.
|
|
898
|
-
*/ const E = "ok", T = "cancelled", I = "unknown", A = "invalid-argument",
|
|
898
|
+
*/ const E = "ok", T = "cancelled", I = "unknown", A = "invalid-argument", R = "deadline-exceeded", P = "not-found", V = "already-exists", D = "permission-denied", N = "unauthenticated", $ = "resource-exhausted", S = "failed-precondition", F = "aborted", x = "out-of-range", q = "unimplemented", O = "internal", C = "unavailable", L = "data-loss";
|
|
899
899
|
|
|
900
900
|
/** An error returned by a Firestore operation. */ class U extends FirebaseError {
|
|
901
901
|
/** @hideconstructor */
|
|
@@ -907,8 +907,8 @@ e) {
|
|
|
907
907
|
/**
|
|
908
908
|
* A custom error description.
|
|
909
909
|
*/
|
|
910
|
-
|
|
911
|
-
super(t,
|
|
910
|
+
n) {
|
|
911
|
+
super(t, n), this.code = t, this.message = n,
|
|
912
912
|
// HACK: We write a toString property directly because Error is not a real
|
|
913
913
|
// class and so inheritance does not work correctly. We could alternatively
|
|
914
914
|
// do the same "back-door inheritance" trick that FirebaseError does.
|
|
@@ -933,8 +933,8 @@ e) {
|
|
|
933
933
|
* limitations under the License.
|
|
934
934
|
*/ class k {
|
|
935
935
|
constructor() {
|
|
936
|
-
this.promise = new Promise(((t,
|
|
937
|
-
this.resolve = t, this.reject =
|
|
936
|
+
this.promise = new Promise(((t, n) => {
|
|
937
|
+
this.resolve = t, this.reject = n;
|
|
938
938
|
}));
|
|
939
939
|
}
|
|
940
940
|
}
|
|
@@ -955,8 +955,8 @@ e) {
|
|
|
955
955
|
* See the License for the specific language governing permissions and
|
|
956
956
|
* limitations under the License.
|
|
957
957
|
*/ class j {
|
|
958
|
-
constructor(t,
|
|
959
|
-
this.user =
|
|
958
|
+
constructor(t, n) {
|
|
959
|
+
this.user = n, this.type = "OAuth", this.headers = new Map, this.headers.set("Authorization", `Bearer ${t}`);
|
|
960
960
|
}
|
|
961
961
|
}
|
|
962
962
|
|
|
@@ -968,9 +968,9 @@ e) {
|
|
|
968
968
|
return Promise.resolve(null);
|
|
969
969
|
}
|
|
970
970
|
invalidateToken() {}
|
|
971
|
-
start(t,
|
|
971
|
+
start(t, n) {
|
|
972
972
|
// Fire with initial user.
|
|
973
|
-
t.enqueueRetryable((() =>
|
|
973
|
+
t.enqueueRetryable((() => n(l.UNAUTHENTICATED)));
|
|
974
974
|
}
|
|
975
975
|
shutdown() {}
|
|
976
976
|
}
|
|
@@ -992,10 +992,10 @@ e) {
|
|
|
992
992
|
return Promise.resolve(this.token);
|
|
993
993
|
}
|
|
994
994
|
invalidateToken() {}
|
|
995
|
-
start(t,
|
|
996
|
-
this.changeListener =
|
|
995
|
+
start(t, n) {
|
|
996
|
+
this.changeListener = n,
|
|
997
997
|
// Fire with initial user.
|
|
998
|
-
t.enqueueRetryable((() =>
|
|
998
|
+
t.enqueueRetryable((() => n(this.token.user)));
|
|
999
999
|
}
|
|
1000
1000
|
shutdown() {
|
|
1001
1001
|
this.changeListener = null;
|
|
@@ -1013,7 +1013,7 @@ e) {
|
|
|
1013
1013
|
new j(t.accessToken, new l(this.auth.getUid()))) : null)) : Promise.resolve(null);
|
|
1014
1014
|
}
|
|
1015
1015
|
invalidateToken() {}
|
|
1016
|
-
start(t,
|
|
1016
|
+
start(t, n) {}
|
|
1017
1017
|
shutdown() {}
|
|
1018
1018
|
}
|
|
1019
1019
|
|
|
@@ -1024,10 +1024,10 @@ e) {
|
|
|
1024
1024
|
* recover from unauthenticated errors (see b/33147818 for context), but it's
|
|
1025
1025
|
* safer to keep the implementation as-is.
|
|
1026
1026
|
*/ class G {
|
|
1027
|
-
constructor(t,
|
|
1028
|
-
this.type = "FirstParty", this.user = l.FIRST_PARTY, this.headers = new Map, this.headers.set("X-Goog-AuthUser",
|
|
1027
|
+
constructor(t, n, e) {
|
|
1028
|
+
this.type = "FirstParty", this.user = l.FIRST_PARTY, this.headers = new Map, this.headers.set("X-Goog-AuthUser", n);
|
|
1029
1029
|
const r = t.auth.getAuthHeaderValueForFirstParty([]);
|
|
1030
|
-
r && this.headers.set("Authorization", r),
|
|
1030
|
+
r && this.headers.set("Authorization", r), e && this.headers.set("X-Goog-Iam-Authorization-Token", e);
|
|
1031
1031
|
}
|
|
1032
1032
|
}
|
|
1033
1033
|
|
|
@@ -1036,15 +1036,15 @@ e) {
|
|
|
1036
1036
|
* to authenticate the user, using technique that is only available
|
|
1037
1037
|
* to applications hosted by Google.
|
|
1038
1038
|
*/ class Q {
|
|
1039
|
-
constructor(t,
|
|
1040
|
-
this.t = t, this.i =
|
|
1039
|
+
constructor(t, n, e) {
|
|
1040
|
+
this.t = t, this.i = n, this.o = e;
|
|
1041
1041
|
}
|
|
1042
1042
|
getToken() {
|
|
1043
1043
|
return Promise.resolve(new G(this.t, this.i, this.o));
|
|
1044
1044
|
}
|
|
1045
|
-
start(t,
|
|
1045
|
+
start(t, n) {
|
|
1046
1046
|
// Fire with initial uid.
|
|
1047
|
-
t.enqueueRetryable((() =>
|
|
1047
|
+
t.enqueueRetryable((() => n(l.FIRST_PARTY)));
|
|
1048
1048
|
}
|
|
1049
1049
|
shutdown() {}
|
|
1050
1050
|
invalidateToken() {}
|
|
@@ -1067,7 +1067,7 @@ class W {
|
|
|
1067
1067
|
new W(t.token)) : null)) : Promise.resolve(null);
|
|
1068
1068
|
}
|
|
1069
1069
|
invalidateToken() {}
|
|
1070
|
-
start(t,
|
|
1070
|
+
start(t, n) {}
|
|
1071
1071
|
shutdown() {}
|
|
1072
1072
|
}
|
|
1073
1073
|
|
|
@@ -1109,8 +1109,8 @@ class H {
|
|
|
1109
1109
|
* @param useFetchStreams Whether to use the Fetch API instead of
|
|
1110
1110
|
* XMLHTTPRequest
|
|
1111
1111
|
*/
|
|
1112
|
-
constructor(t,
|
|
1113
|
-
this.databaseId = t, this.appId =
|
|
1112
|
+
constructor(t, n, e, r, s, i, o, u) {
|
|
1113
|
+
this.databaseId = t, this.appId = n, this.persistenceKey = e, this.host = r, this.ssl = s,
|
|
1114
1114
|
this.forceLongPolling = i, this.autoDetectLongPolling = o, this.useFetchStreams = u;
|
|
1115
1115
|
}
|
|
1116
1116
|
}
|
|
@@ -1121,8 +1121,8 @@ class H {
|
|
|
1121
1121
|
* @internal
|
|
1122
1122
|
*/
|
|
1123
1123
|
class K {
|
|
1124
|
-
constructor(t,
|
|
1125
|
-
this.projectId = t, this.database =
|
|
1124
|
+
constructor(t, n) {
|
|
1125
|
+
this.projectId = t, this.database = n || "(default)";
|
|
1126
1126
|
}
|
|
1127
1127
|
get isDefaultDatabase() {
|
|
1128
1128
|
return "(default)" === this.database;
|
|
@@ -1152,9 +1152,9 @@ class K {
|
|
|
1152
1152
|
* Path represents an ordered sequence of string segments.
|
|
1153
1153
|
*/
|
|
1154
1154
|
class J {
|
|
1155
|
-
constructor(t,
|
|
1156
|
-
void 0 ===
|
|
1157
|
-
this.segments = t, this.offset =
|
|
1155
|
+
constructor(t, n, e) {
|
|
1156
|
+
void 0 === n ? n = 0 : n > t.length && g(), void 0 === e ? e = t.length - n : e > t.length - n && g(),
|
|
1157
|
+
this.segments = t, this.offset = n, this.len = e;
|
|
1158
1158
|
}
|
|
1159
1159
|
get length() {
|
|
1160
1160
|
return this.len;
|
|
@@ -1163,10 +1163,10 @@ class J {
|
|
|
1163
1163
|
return 0 === J.comparator(this, t);
|
|
1164
1164
|
}
|
|
1165
1165
|
child(t) {
|
|
1166
|
-
const
|
|
1166
|
+
const n = this.segments.slice(this.offset, this.limit());
|
|
1167
1167
|
return t instanceof J ? t.forEach((t => {
|
|
1168
|
-
|
|
1169
|
-
})) :
|
|
1168
|
+
n.push(t);
|
|
1169
|
+
})) : n.push(t), this.construct(n);
|
|
1170
1170
|
}
|
|
1171
1171
|
/** The index of one past the last segment of the path. */ limit() {
|
|
1172
1172
|
return this.offset + this.length;
|
|
@@ -1191,28 +1191,28 @@ class J {
|
|
|
1191
1191
|
}
|
|
1192
1192
|
isPrefixOf(t) {
|
|
1193
1193
|
if (t.length < this.length) return !1;
|
|
1194
|
-
for (let
|
|
1194
|
+
for (let n = 0; n < this.length; n++) if (this.get(n) !== t.get(n)) return !1;
|
|
1195
1195
|
return !0;
|
|
1196
1196
|
}
|
|
1197
1197
|
isImmediateParentOf(t) {
|
|
1198
1198
|
if (this.length + 1 !== t.length) return !1;
|
|
1199
|
-
for (let
|
|
1199
|
+
for (let n = 0; n < this.length; n++) if (this.get(n) !== t.get(n)) return !1;
|
|
1200
1200
|
return !0;
|
|
1201
1201
|
}
|
|
1202
1202
|
forEach(t) {
|
|
1203
|
-
for (let
|
|
1203
|
+
for (let n = this.offset, e = this.limit(); n < e; n++) t(this.segments[n]);
|
|
1204
1204
|
}
|
|
1205
1205
|
toArray() {
|
|
1206
1206
|
return this.segments.slice(this.offset, this.limit());
|
|
1207
1207
|
}
|
|
1208
|
-
static comparator(t,
|
|
1209
|
-
const
|
|
1210
|
-
for (let r = 0; r <
|
|
1211
|
-
const
|
|
1212
|
-
if (
|
|
1213
|
-
if (
|
|
1208
|
+
static comparator(t, n) {
|
|
1209
|
+
const e = Math.min(t.length, n.length);
|
|
1210
|
+
for (let r = 0; r < e; r++) {
|
|
1211
|
+
const e = t.get(r), s = n.get(r);
|
|
1212
|
+
if (e < s) return -1;
|
|
1213
|
+
if (e > s) return 1;
|
|
1214
1214
|
}
|
|
1215
|
-
return t.length <
|
|
1215
|
+
return t.length < n.length ? -1 : t.length > n.length ? 1 : 0;
|
|
1216
1216
|
}
|
|
1217
1217
|
}
|
|
1218
1218
|
|
|
@@ -1222,8 +1222,8 @@ class J {
|
|
|
1222
1222
|
*
|
|
1223
1223
|
* @internal
|
|
1224
1224
|
*/ class X extends J {
|
|
1225
|
-
construct(t,
|
|
1226
|
-
return new X(t,
|
|
1225
|
+
construct(t, n, e) {
|
|
1226
|
+
return new X(t, n, e);
|
|
1227
1227
|
}
|
|
1228
1228
|
canonicalString() {
|
|
1229
1229
|
// NOTE: The client is ignorant of any path segments containing escape
|
|
@@ -1242,13 +1242,13 @@ class J {
|
|
|
1242
1242
|
// NOTE: The client is ignorant of any path segments containing escape
|
|
1243
1243
|
// sequences (e.g. __id123__) and just passes them through raw (they exist
|
|
1244
1244
|
// for legacy reasons and should not be used frequently).
|
|
1245
|
-
const
|
|
1246
|
-
for (const
|
|
1247
|
-
if (
|
|
1245
|
+
const n = [];
|
|
1246
|
+
for (const e of t) {
|
|
1247
|
+
if (e.indexOf("//") >= 0) throw new U(A, `Invalid segment (${e}). Paths must not contain // in them.`);
|
|
1248
1248
|
// Strip leading and traling slashed.
|
|
1249
|
-
|
|
1249
|
+
n.push(...e.split("/").filter((t => t.length > 0)));
|
|
1250
1250
|
}
|
|
1251
|
-
return new X(
|
|
1251
|
+
return new X(n);
|
|
1252
1252
|
}
|
|
1253
1253
|
static emptyPath() {
|
|
1254
1254
|
return new X([]);
|
|
@@ -1261,8 +1261,8 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
|
1261
1261
|
* A dot-separated path for navigating sub-objects within a document.
|
|
1262
1262
|
* @internal
|
|
1263
1263
|
*/ class tt extends J {
|
|
1264
|
-
construct(t,
|
|
1265
|
-
return new tt(t,
|
|
1264
|
+
construct(t, n, e) {
|
|
1265
|
+
return new tt(t, n, e);
|
|
1266
1266
|
}
|
|
1267
1267
|
/**
|
|
1268
1268
|
* Returns true if the string could be used as a segment in a field path
|
|
@@ -1297,24 +1297,24 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
|
1297
1297
|
* TODO(b/37244157): we should make this more strict. Right now, it allows
|
|
1298
1298
|
* non-identifier path components, even if they aren't escaped.
|
|
1299
1299
|
*/ static fromServerFormat(t) {
|
|
1300
|
-
const
|
|
1301
|
-
let
|
|
1300
|
+
const n = [];
|
|
1301
|
+
let e = "", r = 0;
|
|
1302
1302
|
const s = () => {
|
|
1303
|
-
if (0 ===
|
|
1304
|
-
|
|
1303
|
+
if (0 === e.length) throw new U(A, `Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);
|
|
1304
|
+
n.push(e), e = "";
|
|
1305
1305
|
};
|
|
1306
1306
|
let i = !1;
|
|
1307
1307
|
for (;r < t.length; ) {
|
|
1308
|
-
const
|
|
1309
|
-
if ("\\" ===
|
|
1308
|
+
const n = t[r];
|
|
1309
|
+
if ("\\" === n) {
|
|
1310
1310
|
if (r + 1 === t.length) throw new U(A, "Path has trailing escape character: " + t);
|
|
1311
|
-
const
|
|
1312
|
-
if ("\\" !==
|
|
1313
|
-
|
|
1314
|
-
} else "`" ===
|
|
1311
|
+
const n = t[r + 1];
|
|
1312
|
+
if ("\\" !== n && "." !== n && "`" !== n) throw new U(A, "Path has invalid escape sequence: " + t);
|
|
1313
|
+
e += n, r += 2;
|
|
1314
|
+
} else "`" === n ? (i = !i, r++) : "." !== n || i ? (e += n, r++) : (s(), r++);
|
|
1315
1315
|
}
|
|
1316
1316
|
if (s(), i) throw new U(A, "Unterminated ` in path: " + t);
|
|
1317
|
-
return new tt(
|
|
1317
|
+
return new tt(n);
|
|
1318
1318
|
}
|
|
1319
1319
|
static emptyPath() {
|
|
1320
1320
|
return new tt([]);
|
|
@@ -1339,15 +1339,15 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
|
1339
1339
|
*/
|
|
1340
1340
|
/**
|
|
1341
1341
|
* @internal
|
|
1342
|
-
*/ class
|
|
1342
|
+
*/ class nt {
|
|
1343
1343
|
constructor(t) {
|
|
1344
1344
|
this.path = t;
|
|
1345
1345
|
}
|
|
1346
1346
|
static fromPath(t) {
|
|
1347
|
-
return new
|
|
1347
|
+
return new nt(X.fromString(t));
|
|
1348
1348
|
}
|
|
1349
1349
|
static fromName(t) {
|
|
1350
|
-
return new
|
|
1350
|
+
return new nt(X.fromString(t).popFirst(5));
|
|
1351
1351
|
}
|
|
1352
1352
|
/** Returns true if the document is in the specified collectionId. */ hasCollectionId(t) {
|
|
1353
1353
|
return this.path.length >= 2 && this.path.get(this.path.length - 2) === t;
|
|
@@ -1358,8 +1358,8 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
|
1358
1358
|
toString() {
|
|
1359
1359
|
return this.path.toString();
|
|
1360
1360
|
}
|
|
1361
|
-
static comparator(t,
|
|
1362
|
-
return X.comparator(t.path,
|
|
1361
|
+
static comparator(t, n) {
|
|
1362
|
+
return X.comparator(t.path, n.path);
|
|
1363
1363
|
}
|
|
1364
1364
|
static isDocumentKey(t) {
|
|
1365
1365
|
return t.length % 2 == 0;
|
|
@@ -1370,7 +1370,7 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
|
1370
1370
|
* @param segments - The segments of the path to the document
|
|
1371
1371
|
* @returns A new instance of DocumentKey
|
|
1372
1372
|
*/ static fromSegments(t) {
|
|
1373
|
-
return new
|
|
1373
|
+
return new nt(new X(t.slice()));
|
|
1374
1374
|
}
|
|
1375
1375
|
}
|
|
1376
1376
|
|
|
@@ -1389,8 +1389,8 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
|
1389
1389
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1390
1390
|
* See the License for the specific language governing permissions and
|
|
1391
1391
|
* limitations under the License.
|
|
1392
|
-
*/ function
|
|
1393
|
-
if (!
|
|
1392
|
+
*/ function et(t, n, e) {
|
|
1393
|
+
if (!e) throw new U(A, `Function ${t}() cannot be called with an empty ${n}.`);
|
|
1394
1394
|
}
|
|
1395
1395
|
|
|
1396
1396
|
/**
|
|
@@ -1402,14 +1402,14 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
|
1402
1402
|
* an even numbers of segments).
|
|
1403
1403
|
*/
|
|
1404
1404
|
function rt(t) {
|
|
1405
|
-
if (!
|
|
1405
|
+
if (!nt.isDocumentKey(t)) throw new U(A, `Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`);
|
|
1406
1406
|
}
|
|
1407
1407
|
|
|
1408
1408
|
/**
|
|
1409
1409
|
* Validates that `path` refers to a collection (indicated by the fact it
|
|
1410
1410
|
* contains an odd numbers of segments).
|
|
1411
1411
|
*/ function st(t) {
|
|
1412
|
-
if (
|
|
1412
|
+
if (nt.isDocumentKey(t)) throw new U(A, `Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`);
|
|
1413
1413
|
}
|
|
1414
1414
|
|
|
1415
1415
|
/**
|
|
@@ -1426,7 +1426,7 @@ function it(t) {
|
|
|
1426
1426
|
if ("object" == typeof t) {
|
|
1427
1427
|
if (t instanceof Array) return "an array";
|
|
1428
1428
|
{
|
|
1429
|
-
const
|
|
1429
|
+
const n =
|
|
1430
1430
|
/** try to get the constructor name for an object. */
|
|
1431
1431
|
function(t) {
|
|
1432
1432
|
if (t.constructor) return t.constructor.name;
|
|
@@ -1440,7 +1440,7 @@ function it(t) {
|
|
|
1440
1440
|
* arguments passed to the public API.
|
|
1441
1441
|
* @internal
|
|
1442
1442
|
*/ (t);
|
|
1443
|
-
return
|
|
1443
|
+
return n ? `a custom ${n} object` : "an object";
|
|
1444
1444
|
}
|
|
1445
1445
|
}
|
|
1446
1446
|
return "function" == typeof t ? "a function" : g();
|
|
@@ -1448,22 +1448,22 @@ function it(t) {
|
|
|
1448
1448
|
|
|
1449
1449
|
function ot(t,
|
|
1450
1450
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1451
|
-
|
|
1451
|
+
n) {
|
|
1452
1452
|
if ("_delegate" in t && (
|
|
1453
1453
|
// Unwrap Compat types
|
|
1454
1454
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1455
|
-
t = t._delegate), !(t instanceof
|
|
1456
|
-
if (
|
|
1455
|
+
t = t._delegate), !(t instanceof n)) {
|
|
1456
|
+
if (n.name === t.constructor.name) throw new U(A, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
|
|
1457
1457
|
{
|
|
1458
|
-
const
|
|
1459
|
-
throw new U(A, `Expected type '${
|
|
1458
|
+
const e = it(t);
|
|
1459
|
+
throw new U(A, `Expected type '${n.name}', but it was: ${e}`);
|
|
1460
1460
|
}
|
|
1461
1461
|
}
|
|
1462
1462
|
return t;
|
|
1463
1463
|
}
|
|
1464
1464
|
|
|
1465
|
-
function ut(t,
|
|
1466
|
-
if (
|
|
1465
|
+
function ut(t, n) {
|
|
1466
|
+
if (n <= 0) throw new U(A, `Function ${t}() requires a positive number, but it was: ${n}.`);
|
|
1467
1467
|
}
|
|
1468
1468
|
|
|
1469
1469
|
/**
|
|
@@ -1575,7 +1575,7 @@ function dt(t) {
|
|
|
1575
1575
|
|
|
1576
1576
|
case 400:
|
|
1577
1577
|
// Bad Request
|
|
1578
|
-
return
|
|
1578
|
+
return S;
|
|
1579
1579
|
|
|
1580
1580
|
// Other possibilities based on the forward mapping
|
|
1581
1581
|
// return Code.INVALID_ARGUMENT;
|
|
@@ -1590,11 +1590,11 @@ function dt(t) {
|
|
|
1590
1590
|
|
|
1591
1591
|
case 404:
|
|
1592
1592
|
// Not Found
|
|
1593
|
-
return
|
|
1593
|
+
return P;
|
|
1594
1594
|
|
|
1595
1595
|
case 409:
|
|
1596
1596
|
// Conflict
|
|
1597
|
-
return
|
|
1597
|
+
return F;
|
|
1598
1598
|
|
|
1599
1599
|
// Other possibilities:
|
|
1600
1600
|
// return Code.ALREADY_EXISTS;
|
|
@@ -1627,10 +1627,10 @@ function dt(t) {
|
|
|
1627
1627
|
|
|
1628
1628
|
case 504:
|
|
1629
1629
|
// Gateway Timeout
|
|
1630
|
-
return
|
|
1630
|
+
return R;
|
|
1631
1631
|
|
|
1632
1632
|
default:
|
|
1633
|
-
return t >= 200 && t < 300 ? E : t >= 400 && t < 500 ?
|
|
1633
|
+
return t >= 200 && t < 300 ? E : t >= 400 && t < 500 ? S : t >= 500 && t < 600 ? O : I;
|
|
1634
1634
|
}
|
|
1635
1635
|
}
|
|
1636
1636
|
|
|
@@ -1670,58 +1670,58 @@ class wt extends
|
|
|
1670
1670
|
class {
|
|
1671
1671
|
constructor(t) {
|
|
1672
1672
|
this.databaseInfo = t, this.databaseId = t.databaseId;
|
|
1673
|
-
const
|
|
1674
|
-
this.h =
|
|
1673
|
+
const n = t.ssl ? "https" : "http";
|
|
1674
|
+
this.h = n + "://" + t.host, this.l = "projects/" + this.databaseId.projectId + "/databases/" + this.databaseId.database + "/documents";
|
|
1675
1675
|
}
|
|
1676
|
-
m(t,
|
|
1677
|
-
const i = this.p(t,
|
|
1678
|
-
m("RestConnection", "Sending: ", i,
|
|
1676
|
+
m(t, n, e, r, s) {
|
|
1677
|
+
const i = this.p(t, n);
|
|
1678
|
+
m("RestConnection", "Sending: ", i, e);
|
|
1679
1679
|
const o = {};
|
|
1680
|
-
return this.g(o, r, s), this.v(t, i, o,
|
|
1681
|
-
t)), (
|
|
1682
|
-
throw y("RestConnection", `${t} failed with error: `,
|
|
1683
|
-
|
|
1680
|
+
return this.g(o, r, s), this.v(t, i, o, e).then((t => (m("RestConnection", "Received: ", t),
|
|
1681
|
+
t)), (n => {
|
|
1682
|
+
throw y("RestConnection", `${t} failed with error: `, n, "url: ", i, "request:", e),
|
|
1683
|
+
n;
|
|
1684
1684
|
}));
|
|
1685
1685
|
}
|
|
1686
|
-
T(t,
|
|
1686
|
+
T(t, n, e, r, s) {
|
|
1687
1687
|
// The REST API automatically aggregates all of the streamed results, so we
|
|
1688
1688
|
// can just use the normal invoke() method.
|
|
1689
|
-
return this.m(t,
|
|
1689
|
+
return this.m(t, n, e, r, s);
|
|
1690
1690
|
}
|
|
1691
1691
|
/**
|
|
1692
1692
|
* Modifies the headers for a request, adding any authorization token if
|
|
1693
1693
|
* present and any additional headers for the request.
|
|
1694
|
-
*/ g(t,
|
|
1694
|
+
*/ g(t, n, e) {
|
|
1695
1695
|
t["X-Goog-Api-Client"] = "gl-js/ fire/" + f,
|
|
1696
1696
|
// Content-Type: text/plain will avoid preflight requests which might
|
|
1697
1697
|
// mess with CORS and redirects by proxies. If we add custom headers
|
|
1698
1698
|
// we will need to change this code to potentially use the $httpOverwrite
|
|
1699
1699
|
// parameter supported by ESF to avoid triggering preflight requests.
|
|
1700
1700
|
t["Content-Type"] = "text/plain", this.databaseInfo.appId && (t["X-Firebase-GMPID"] = this.databaseInfo.appId),
|
|
1701
|
-
|
|
1701
|
+
n && n.headers.forEach(((n, e) => t[e] = n)), e && e.headers.forEach(((n, e) => t[e] = n));
|
|
1702
1702
|
}
|
|
1703
|
-
p(t,
|
|
1704
|
-
const
|
|
1705
|
-
return `${this.h}/v1/${
|
|
1703
|
+
p(t, n) {
|
|
1704
|
+
const e = ht[t];
|
|
1705
|
+
return `${this.h}/v1/${n}:${e}`;
|
|
1706
1706
|
}
|
|
1707
1707
|
} {
|
|
1708
1708
|
/**
|
|
1709
1709
|
* @param databaseInfo - The connection info.
|
|
1710
1710
|
* @param fetchImpl - `fetch` or a Polyfill that implements the fetch API.
|
|
1711
1711
|
*/
|
|
1712
|
-
constructor(t,
|
|
1713
|
-
super(t), this.I =
|
|
1712
|
+
constructor(t, n) {
|
|
1713
|
+
super(t), this.I = n;
|
|
1714
1714
|
}
|
|
1715
|
-
A(t,
|
|
1715
|
+
A(t, n) {
|
|
1716
1716
|
throw new Error("Not supported by FetchConnection");
|
|
1717
1717
|
}
|
|
1718
|
-
async v(t,
|
|
1718
|
+
async v(t, n, e, r) {
|
|
1719
1719
|
const s = JSON.stringify(r);
|
|
1720
1720
|
let i;
|
|
1721
1721
|
try {
|
|
1722
|
-
i = await this.I(
|
|
1722
|
+
i = await this.I(n, {
|
|
1723
1723
|
method: "POST",
|
|
1724
|
-
headers:
|
|
1724
|
+
headers: e,
|
|
1725
1725
|
body: s
|
|
1726
1726
|
});
|
|
1727
1727
|
} catch (t) {
|
|
@@ -1772,13 +1772,13 @@ class {
|
|
|
1772
1772
|
*/
|
|
1773
1773
|
function mt(t) {
|
|
1774
1774
|
// Polyfills for IE and WebWorker by using `self` and `msCrypto` when `crypto` is not available.
|
|
1775
|
-
const
|
|
1775
|
+
const n =
|
|
1776
1776
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1777
|
-
"undefined" != typeof self && (self.crypto || self.msCrypto),
|
|
1778
|
-
if (
|
|
1777
|
+
"undefined" != typeof self && (self.crypto || self.msCrypto), e = new Uint8Array(t);
|
|
1778
|
+
if (n && "function" == typeof n.getRandomValues) n.getRandomValues(e); else
|
|
1779
1779
|
// Falls back to Math.random
|
|
1780
|
-
for (let
|
|
1781
|
-
return
|
|
1780
|
+
for (let n = 0; n < t; n++) e[n] = Math.floor(256 * Math.random());
|
|
1781
|
+
return e;
|
|
1782
1782
|
}
|
|
1783
1783
|
|
|
1784
1784
|
/**
|
|
@@ -1797,28 +1797,28 @@ function mt(t) {
|
|
|
1797
1797
|
* See the License for the specific language governing permissions and
|
|
1798
1798
|
* limitations under the License.
|
|
1799
1799
|
*/ class pt {
|
|
1800
|
-
static
|
|
1800
|
+
static R() {
|
|
1801
1801
|
// Alphanumeric characters
|
|
1802
|
-
const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
|
|
1802
|
+
const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", n = Math.floor(256 / t.length) * t.length;
|
|
1803
1803
|
// The largest byte value that is a multiple of `char.length`.
|
|
1804
|
-
let
|
|
1805
|
-
for (;
|
|
1804
|
+
let e = "";
|
|
1805
|
+
for (;e.length < 20; ) {
|
|
1806
1806
|
const r = mt(40);
|
|
1807
1807
|
for (let s = 0; s < r.length; ++s)
|
|
1808
1808
|
// Only accept values that are [0, maxMultiple), this ensures they can
|
|
1809
1809
|
// be evenly mapped to indices of `chars` via a modulo operation.
|
|
1810
|
-
|
|
1810
|
+
e.length < 20 && r[s] < n && (e += t.charAt(r[s] % t.length));
|
|
1811
1811
|
}
|
|
1812
|
-
return
|
|
1812
|
+
return e;
|
|
1813
1813
|
}
|
|
1814
1814
|
}
|
|
1815
1815
|
|
|
1816
|
-
function yt(t,
|
|
1817
|
-
return t <
|
|
1816
|
+
function yt(t, n) {
|
|
1817
|
+
return t < n ? -1 : t > n ? 1 : 0;
|
|
1818
1818
|
}
|
|
1819
1819
|
|
|
1820
|
-
/** Helper to compare arrays using isEqual(). */ function _t(t,
|
|
1821
|
-
return t.length ===
|
|
1820
|
+
/** Helper to compare arrays using isEqual(). */ function _t(t, n, e) {
|
|
1821
|
+
return t.length === n.length && t.every(((t, r) => e(t, n[r])));
|
|
1822
1822
|
}
|
|
1823
1823
|
|
|
1824
1824
|
/**
|
|
@@ -1872,9 +1872,9 @@ class gt {
|
|
|
1872
1872
|
/**
|
|
1873
1873
|
* The fractions of a second at nanosecond resolution.*
|
|
1874
1874
|
*/
|
|
1875
|
-
|
|
1876
|
-
if (this.seconds = t, this.nanoseconds =
|
|
1877
|
-
if (
|
|
1875
|
+
n) {
|
|
1876
|
+
if (this.seconds = t, this.nanoseconds = n, n < 0) throw new U(A, "Timestamp nanoseconds out of range: " + n);
|
|
1877
|
+
if (n >= 1e9) throw new U(A, "Timestamp nanoseconds out of range: " + n);
|
|
1878
1878
|
if (t < -62135596800) throw new U(A, "Timestamp seconds out of range: " + t);
|
|
1879
1879
|
// This will break in the year 10,000.
|
|
1880
1880
|
if (t >= 253402300800) throw new U(A, "Timestamp seconds out of range: " + t);
|
|
@@ -1903,8 +1903,8 @@ class gt {
|
|
|
1903
1903
|
* @returns A new `Timestamp` representing the same point in time as the given
|
|
1904
1904
|
* number of milliseconds.
|
|
1905
1905
|
*/ static fromMillis(t) {
|
|
1906
|
-
const
|
|
1907
|
-
return new gt(
|
|
1906
|
+
const n = Math.floor(t / 1e3), e = Math.floor(1e6 * (t - 1e3 * n));
|
|
1907
|
+
return new gt(n, e);
|
|
1908
1908
|
}
|
|
1909
1909
|
/**
|
|
1910
1910
|
* Converts a `Timestamp` to a JavaScript `Date` object. This conversion
|
|
@@ -2026,13 +2026,13 @@ class gt {
|
|
|
2026
2026
|
* See the License for the specific language governing permissions and
|
|
2027
2027
|
* limitations under the License.
|
|
2028
2028
|
*/ function bt(t) {
|
|
2029
|
-
let
|
|
2030
|
-
for (const
|
|
2031
|
-
return
|
|
2029
|
+
let n = 0;
|
|
2030
|
+
for (const e in t) Object.prototype.hasOwnProperty.call(t, e) && n++;
|
|
2031
|
+
return n;
|
|
2032
2032
|
}
|
|
2033
2033
|
|
|
2034
|
-
function Et(t,
|
|
2035
|
-
for (const
|
|
2034
|
+
function Et(t, n) {
|
|
2035
|
+
for (const e in t) Object.prototype.hasOwnProperty.call(t, e) && n(e, t[e]);
|
|
2036
2036
|
}
|
|
2037
2037
|
|
|
2038
2038
|
/**
|
|
@@ -2074,11 +2074,11 @@ class Tt {
|
|
|
2074
2074
|
*
|
|
2075
2075
|
* This is an O(n) operation, where `n` is the size of the field mask.
|
|
2076
2076
|
*/ covers(t) {
|
|
2077
|
-
for (const
|
|
2077
|
+
for (const n of this.fields) if (n.isPrefixOf(t)) return !0;
|
|
2078
2078
|
return !1;
|
|
2079
2079
|
}
|
|
2080
2080
|
isEqual(t) {
|
|
2081
|
-
return _t(this.fields, t.fields, ((t,
|
|
2081
|
+
return _t(this.fields, t.fields, ((t, n) => t.isEqual(n)));
|
|
2082
2082
|
}
|
|
2083
2083
|
}
|
|
2084
2084
|
|
|
@@ -2129,23 +2129,23 @@ class It {
|
|
|
2129
2129
|
this.binaryString = t;
|
|
2130
2130
|
}
|
|
2131
2131
|
static fromBase64String(t) {
|
|
2132
|
-
const
|
|
2133
|
-
return new It(
|
|
2132
|
+
const n = atob(t);
|
|
2133
|
+
return new It(n);
|
|
2134
2134
|
}
|
|
2135
2135
|
static fromUint8Array(t) {
|
|
2136
|
-
const
|
|
2136
|
+
const n =
|
|
2137
2137
|
/**
|
|
2138
2138
|
* Helper function to convert an Uint8array to a binary string.
|
|
2139
2139
|
*/
|
|
2140
2140
|
function(t) {
|
|
2141
|
-
let
|
|
2142
|
-
for (let
|
|
2143
|
-
return
|
|
2141
|
+
let n = "";
|
|
2142
|
+
for (let e = 0; e < t.length; ++e) n += String.fromCharCode(t[e]);
|
|
2143
|
+
return n;
|
|
2144
2144
|
}
|
|
2145
2145
|
/**
|
|
2146
2146
|
* Helper function to convert a binary string to an Uint8Array.
|
|
2147
2147
|
*/ (t);
|
|
2148
|
-
return new It(
|
|
2148
|
+
return new It(n);
|
|
2149
2149
|
}
|
|
2150
2150
|
[Symbol.iterator]() {
|
|
2151
2151
|
let t = 0;
|
|
@@ -2166,9 +2166,9 @@ class It {
|
|
|
2166
2166
|
}
|
|
2167
2167
|
toUint8Array() {
|
|
2168
2168
|
return function(t) {
|
|
2169
|
-
const
|
|
2170
|
-
for (let
|
|
2171
|
-
return
|
|
2169
|
+
const n = new Uint8Array(t.length);
|
|
2170
|
+
for (let e = 0; e < t.length; e++) n[e] = t.charCodeAt(e);
|
|
2171
|
+
return n;
|
|
2172
2172
|
}
|
|
2173
2173
|
/**
|
|
2174
2174
|
* @license
|
|
@@ -2207,7 +2207,7 @@ const At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
2207
2207
|
/**
|
|
2208
2208
|
* Converts the possible Proto values for a timestamp value into a "seconds and
|
|
2209
2209
|
* nanos" representation.
|
|
2210
|
-
*/ function
|
|
2210
|
+
*/ function Rt(t) {
|
|
2211
2211
|
// The json interface (for the browser) will return an iso timestamp string,
|
|
2212
2212
|
// while the proto js library (for node) will return a
|
|
2213
2213
|
// google.protobuf.Timestamp instance.
|
|
@@ -2215,30 +2215,30 @@ const At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
2215
2215
|
// The date string can have higher precision (nanos) than the Date class
|
|
2216
2216
|
// (millis), so we do some custom parsing here.
|
|
2217
2217
|
// Parse the nanos right out of the string.
|
|
2218
|
-
let
|
|
2219
|
-
const
|
|
2220
|
-
if (v(!!
|
|
2218
|
+
let n = 0;
|
|
2219
|
+
const e = At.exec(t);
|
|
2220
|
+
if (v(!!e), e[1]) {
|
|
2221
2221
|
// Pad the fraction out to 9 digits (nanos).
|
|
2222
|
-
let t =
|
|
2223
|
-
t = (t + "000000000").substr(0, 9),
|
|
2222
|
+
let t = e[1];
|
|
2223
|
+
t = (t + "000000000").substr(0, 9), n = Number(t);
|
|
2224
2224
|
}
|
|
2225
2225
|
// Parse the date to get the seconds.
|
|
2226
2226
|
const r = new Date(t);
|
|
2227
2227
|
return {
|
|
2228
2228
|
seconds: Math.floor(r.getTime() / 1e3),
|
|
2229
|
-
nanos:
|
|
2229
|
+
nanos: n
|
|
2230
2230
|
};
|
|
2231
2231
|
}
|
|
2232
2232
|
return {
|
|
2233
|
-
seconds:
|
|
2234
|
-
nanos:
|
|
2233
|
+
seconds: Pt(t.seconds),
|
|
2234
|
+
nanos: Pt(t.nanos)
|
|
2235
2235
|
};
|
|
2236
2236
|
}
|
|
2237
2237
|
|
|
2238
2238
|
/**
|
|
2239
2239
|
* Converts the possible Proto types for numbers into a JavaScript number.
|
|
2240
2240
|
* Returns 0 if the value is not numeric.
|
|
2241
|
-
*/ function
|
|
2241
|
+
*/ function Pt(t) {
|
|
2242
2242
|
// TODO(bjornick): Handle int64 greater than 53 bits.
|
|
2243
2243
|
return "number" == typeof t ? t : "string" == typeof t ? Number(t) : 0;
|
|
2244
2244
|
}
|
|
@@ -2281,8 +2281,8 @@ const At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
2281
2281
|
* - With respect to other ServerTimestampValues, they sort by their
|
|
2282
2282
|
* localWriteTime.
|
|
2283
2283
|
*/ function Dt(t) {
|
|
2284
|
-
var
|
|
2285
|
-
return "server_timestamp" === (null === (
|
|
2284
|
+
var n, e;
|
|
2285
|
+
return "server_timestamp" === (null === (e = ((null === (n = null == t ? void 0 : t.mapValue) || void 0 === n ? void 0 : n.fields) || {}).__type__) || void 0 === e ? void 0 : e.stringValue);
|
|
2286
2286
|
}
|
|
2287
2287
|
|
|
2288
2288
|
/**
|
|
@@ -2291,15 +2291,15 @@ const At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
2291
2291
|
* Preserving the previous values allows the user to display the last resoled
|
|
2292
2292
|
* value until the backend responds with the timestamp.
|
|
2293
2293
|
*/ function Nt(t) {
|
|
2294
|
-
const
|
|
2295
|
-
return Dt(
|
|
2294
|
+
const n = t.mapValue.fields.__previous_value__;
|
|
2295
|
+
return Dt(n) ? Nt(n) : n;
|
|
2296
2296
|
}
|
|
2297
2297
|
|
|
2298
2298
|
/**
|
|
2299
2299
|
* Returns the local time at which this timestamp was first set.
|
|
2300
2300
|
*/ function $t(t) {
|
|
2301
|
-
const
|
|
2302
|
-
return new gt(
|
|
2301
|
+
const n = Rt(t.mapValue.fields.__local_write_time__.timestampValue);
|
|
2302
|
+
return new gt(n.seconds, n.nanos);
|
|
2303
2303
|
}
|
|
2304
2304
|
|
|
2305
2305
|
/**
|
|
@@ -2318,173 +2318,173 @@ const At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
2318
2318
|
* See the License for the specific language governing permissions and
|
|
2319
2319
|
* limitations under the License.
|
|
2320
2320
|
*/
|
|
2321
|
-
/** Extracts the backend's type order for the provided value. */ function
|
|
2321
|
+
/** Extracts the backend's type order for the provided value. */ function St(t) {
|
|
2322
2322
|
return "nullValue" in t ? 0 /* NullValue */ : "booleanValue" in t ? 1 /* BooleanValue */ : "integerValue" in t || "doubleValue" in t ? 2 /* NumberValue */ : "timestampValue" in t ? 3 /* TimestampValue */ : "stringValue" in t ? 5 /* StringValue */ : "bytesValue" in t ? 6 /* BlobValue */ : "referenceValue" in t ? 7 /* RefValue */ : "geoPointValue" in t ? 8 /* GeoPointValue */ : "arrayValue" in t ? 9 /* ArrayValue */ : "mapValue" in t ? Dt(t) ? 4 /* ServerTimestampValue */ : 10 /* ObjectValue */ : g();
|
|
2323
2323
|
}
|
|
2324
2324
|
|
|
2325
|
-
/** Tests `left` and `right` for equality based on the backend semantics. */ function
|
|
2326
|
-
if (t ===
|
|
2327
|
-
const
|
|
2328
|
-
if (
|
|
2329
|
-
switch (
|
|
2325
|
+
/** Tests `left` and `right` for equality based on the backend semantics. */ function Ft(t, n) {
|
|
2326
|
+
if (t === n) return !0;
|
|
2327
|
+
const e = St(t);
|
|
2328
|
+
if (e !== St(n)) return !1;
|
|
2329
|
+
switch (e) {
|
|
2330
2330
|
case 0 /* NullValue */ :
|
|
2331
2331
|
return !0;
|
|
2332
2332
|
|
|
2333
2333
|
case 1 /* BooleanValue */ :
|
|
2334
|
-
return t.booleanValue ===
|
|
2334
|
+
return t.booleanValue === n.booleanValue;
|
|
2335
2335
|
|
|
2336
2336
|
case 4 /* ServerTimestampValue */ :
|
|
2337
|
-
return $t(t).isEqual($t(
|
|
2337
|
+
return $t(t).isEqual($t(n));
|
|
2338
2338
|
|
|
2339
2339
|
case 3 /* TimestampValue */ :
|
|
2340
|
-
return function(t,
|
|
2341
|
-
if ("string" == typeof t.timestampValue && "string" == typeof
|
|
2340
|
+
return function(t, n) {
|
|
2341
|
+
if ("string" == typeof t.timestampValue && "string" == typeof n.timestampValue && t.timestampValue.length === n.timestampValue.length)
|
|
2342
2342
|
// Use string equality for ISO 8601 timestamps
|
|
2343
|
-
return t.timestampValue ===
|
|
2344
|
-
const
|
|
2345
|
-
return
|
|
2346
|
-
}(t,
|
|
2343
|
+
return t.timestampValue === n.timestampValue;
|
|
2344
|
+
const e = Rt(t.timestampValue), r = Rt(n.timestampValue);
|
|
2345
|
+
return e.seconds === r.seconds && e.nanos === r.nanos;
|
|
2346
|
+
}(t, n);
|
|
2347
2347
|
|
|
2348
2348
|
case 5 /* StringValue */ :
|
|
2349
|
-
return t.stringValue ===
|
|
2349
|
+
return t.stringValue === n.stringValue;
|
|
2350
2350
|
|
|
2351
2351
|
case 6 /* BlobValue */ :
|
|
2352
|
-
return function(t,
|
|
2353
|
-
return Vt(t.bytesValue).isEqual(Vt(
|
|
2354
|
-
}(t,
|
|
2352
|
+
return function(t, n) {
|
|
2353
|
+
return Vt(t.bytesValue).isEqual(Vt(n.bytesValue));
|
|
2354
|
+
}(t, n);
|
|
2355
2355
|
|
|
2356
2356
|
case 7 /* RefValue */ :
|
|
2357
|
-
return t.referenceValue ===
|
|
2357
|
+
return t.referenceValue === n.referenceValue;
|
|
2358
2358
|
|
|
2359
2359
|
case 8 /* GeoPointValue */ :
|
|
2360
|
-
return function(t,
|
|
2361
|
-
return
|
|
2362
|
-
}(t,
|
|
2360
|
+
return function(t, n) {
|
|
2361
|
+
return Pt(t.geoPointValue.latitude) === Pt(n.geoPointValue.latitude) && Pt(t.geoPointValue.longitude) === Pt(n.geoPointValue.longitude);
|
|
2362
|
+
}(t, n);
|
|
2363
2363
|
|
|
2364
2364
|
case 2 /* NumberValue */ :
|
|
2365
|
-
return function(t,
|
|
2366
|
-
if ("integerValue" in t && "integerValue" in
|
|
2367
|
-
if ("doubleValue" in t && "doubleValue" in
|
|
2368
|
-
const
|
|
2369
|
-
return
|
|
2365
|
+
return function(t, n) {
|
|
2366
|
+
if ("integerValue" in t && "integerValue" in n) return Pt(t.integerValue) === Pt(n.integerValue);
|
|
2367
|
+
if ("doubleValue" in t && "doubleValue" in n) {
|
|
2368
|
+
const e = Pt(t.doubleValue), r = Pt(n.doubleValue);
|
|
2369
|
+
return e === r ? at(e) === at(r) : isNaN(e) && isNaN(r);
|
|
2370
2370
|
}
|
|
2371
2371
|
return !1;
|
|
2372
|
-
}(t,
|
|
2372
|
+
}(t, n);
|
|
2373
2373
|
|
|
2374
2374
|
case 9 /* ArrayValue */ :
|
|
2375
|
-
return _t(t.arrayValue.values || [],
|
|
2375
|
+
return _t(t.arrayValue.values || [], n.arrayValue.values || [], Ft);
|
|
2376
2376
|
|
|
2377
2377
|
case 10 /* ObjectValue */ :
|
|
2378
|
-
return function(t,
|
|
2379
|
-
const
|
|
2380
|
-
if (bt(
|
|
2381
|
-
for (const t in
|
|
2378
|
+
return function(t, n) {
|
|
2379
|
+
const e = t.mapValue.fields || {}, r = n.mapValue.fields || {};
|
|
2380
|
+
if (bt(e) !== bt(r)) return !1;
|
|
2381
|
+
for (const t in e) if (e.hasOwnProperty(t) && (void 0 === r[t] || !Ft(e[t], r[t]))) return !1;
|
|
2382
2382
|
return !0;
|
|
2383
2383
|
}
|
|
2384
|
-
/** Returns true if the ArrayValue contains the specified element. */ (t,
|
|
2384
|
+
/** Returns true if the ArrayValue contains the specified element. */ (t, n);
|
|
2385
2385
|
|
|
2386
2386
|
default:
|
|
2387
2387
|
return g();
|
|
2388
2388
|
}
|
|
2389
2389
|
}
|
|
2390
2390
|
|
|
2391
|
-
function xt(t,
|
|
2392
|
-
return void 0 !== (t.values || []).find((t =>
|
|
2391
|
+
function xt(t, n) {
|
|
2392
|
+
return void 0 !== (t.values || []).find((t => Ft(t, n)));
|
|
2393
2393
|
}
|
|
2394
2394
|
|
|
2395
|
-
function qt(t,
|
|
2396
|
-
if (t ===
|
|
2397
|
-
const
|
|
2398
|
-
if (
|
|
2399
|
-
switch (
|
|
2395
|
+
function qt(t, n) {
|
|
2396
|
+
if (t === n) return 0;
|
|
2397
|
+
const e = St(t), r = St(n);
|
|
2398
|
+
if (e !== r) return yt(e, r);
|
|
2399
|
+
switch (e) {
|
|
2400
2400
|
case 0 /* NullValue */ :
|
|
2401
2401
|
return 0;
|
|
2402
2402
|
|
|
2403
2403
|
case 1 /* BooleanValue */ :
|
|
2404
|
-
return yt(t.booleanValue,
|
|
2404
|
+
return yt(t.booleanValue, n.booleanValue);
|
|
2405
2405
|
|
|
2406
2406
|
case 2 /* NumberValue */ :
|
|
2407
|
-
return function(t,
|
|
2408
|
-
const
|
|
2409
|
-
return
|
|
2407
|
+
return function(t, n) {
|
|
2408
|
+
const e = Pt(t.integerValue || t.doubleValue), r = Pt(n.integerValue || n.doubleValue);
|
|
2409
|
+
return e < r ? -1 : e > r ? 1 : e === r ? 0 :
|
|
2410
2410
|
// one or both are NaN.
|
|
2411
|
-
isNaN(
|
|
2412
|
-
}(t,
|
|
2411
|
+
isNaN(e) ? isNaN(r) ? 0 : -1 : 1;
|
|
2412
|
+
}(t, n);
|
|
2413
2413
|
|
|
2414
2414
|
case 3 /* TimestampValue */ :
|
|
2415
|
-
return Ot(t.timestampValue,
|
|
2415
|
+
return Ot(t.timestampValue, n.timestampValue);
|
|
2416
2416
|
|
|
2417
2417
|
case 4 /* ServerTimestampValue */ :
|
|
2418
|
-
return Ot($t(t), $t(
|
|
2418
|
+
return Ot($t(t), $t(n));
|
|
2419
2419
|
|
|
2420
2420
|
case 5 /* StringValue */ :
|
|
2421
|
-
return yt(t.stringValue,
|
|
2421
|
+
return yt(t.stringValue, n.stringValue);
|
|
2422
2422
|
|
|
2423
2423
|
case 6 /* BlobValue */ :
|
|
2424
|
-
return function(t,
|
|
2425
|
-
const
|
|
2426
|
-
return
|
|
2427
|
-
}(t.bytesValue,
|
|
2424
|
+
return function(t, n) {
|
|
2425
|
+
const e = Vt(t), r = Vt(n);
|
|
2426
|
+
return e.compareTo(r);
|
|
2427
|
+
}(t.bytesValue, n.bytesValue);
|
|
2428
2428
|
|
|
2429
2429
|
case 7 /* RefValue */ :
|
|
2430
|
-
return function(t,
|
|
2431
|
-
const
|
|
2432
|
-
for (let t = 0; t <
|
|
2433
|
-
const
|
|
2434
|
-
if (0 !==
|
|
2430
|
+
return function(t, n) {
|
|
2431
|
+
const e = t.split("/"), r = n.split("/");
|
|
2432
|
+
for (let t = 0; t < e.length && t < r.length; t++) {
|
|
2433
|
+
const n = yt(e[t], r[t]);
|
|
2434
|
+
if (0 !== n) return n;
|
|
2435
2435
|
}
|
|
2436
|
-
return yt(
|
|
2437
|
-
}(t.referenceValue,
|
|
2436
|
+
return yt(e.length, r.length);
|
|
2437
|
+
}(t.referenceValue, n.referenceValue);
|
|
2438
2438
|
|
|
2439
2439
|
case 8 /* GeoPointValue */ :
|
|
2440
|
-
return function(t,
|
|
2441
|
-
const
|
|
2442
|
-
if (0 !==
|
|
2443
|
-
return yt(
|
|
2444
|
-
}(t.geoPointValue,
|
|
2440
|
+
return function(t, n) {
|
|
2441
|
+
const e = yt(Pt(t.latitude), Pt(n.latitude));
|
|
2442
|
+
if (0 !== e) return e;
|
|
2443
|
+
return yt(Pt(t.longitude), Pt(n.longitude));
|
|
2444
|
+
}(t.geoPointValue, n.geoPointValue);
|
|
2445
2445
|
|
|
2446
2446
|
case 9 /* ArrayValue */ :
|
|
2447
|
-
return function(t,
|
|
2448
|
-
const
|
|
2449
|
-
for (let t = 0; t <
|
|
2450
|
-
const
|
|
2451
|
-
if (
|
|
2447
|
+
return function(t, n) {
|
|
2448
|
+
const e = t.values || [], r = n.values || [];
|
|
2449
|
+
for (let t = 0; t < e.length && t < r.length; ++t) {
|
|
2450
|
+
const n = qt(e[t], r[t]);
|
|
2451
|
+
if (n) return n;
|
|
2452
2452
|
}
|
|
2453
|
-
return yt(
|
|
2454
|
-
}(t.arrayValue,
|
|
2453
|
+
return yt(e.length, r.length);
|
|
2454
|
+
}(t.arrayValue, n.arrayValue);
|
|
2455
2455
|
|
|
2456
2456
|
case 10 /* ObjectValue */ :
|
|
2457
|
-
return function(t,
|
|
2458
|
-
const
|
|
2457
|
+
return function(t, n) {
|
|
2458
|
+
const e = t.fields || {}, r = Object.keys(e), s = n.fields || {}, i = Object.keys(s);
|
|
2459
2459
|
// Even though MapValues are likely sorted correctly based on their insertion
|
|
2460
2460
|
// order (e.g. when received from the backend), local modifications can bring
|
|
2461
2461
|
// elements out of order. We need to re-sort the elements to ensure that
|
|
2462
2462
|
// canonical IDs are independent of insertion order.
|
|
2463
2463
|
r.sort(), i.sort();
|
|
2464
2464
|
for (let t = 0; t < r.length && t < i.length; ++t) {
|
|
2465
|
-
const
|
|
2466
|
-
if (0 !==
|
|
2467
|
-
const o = qt(
|
|
2465
|
+
const n = yt(r[t], i[t]);
|
|
2466
|
+
if (0 !== n) return n;
|
|
2467
|
+
const o = qt(e[r[t]], s[i[t]]);
|
|
2468
2468
|
if (0 !== o) return o;
|
|
2469
2469
|
}
|
|
2470
2470
|
return yt(r.length, i.length);
|
|
2471
2471
|
}
|
|
2472
|
-
/** Returns a reference value for the provided database and key. */ (t.mapValue,
|
|
2472
|
+
/** Returns a reference value for the provided database and key. */ (t.mapValue, n.mapValue);
|
|
2473
2473
|
|
|
2474
2474
|
default:
|
|
2475
2475
|
throw g();
|
|
2476
2476
|
}
|
|
2477
2477
|
}
|
|
2478
2478
|
|
|
2479
|
-
function Ot(t,
|
|
2480
|
-
if ("string" == typeof t && "string" == typeof
|
|
2481
|
-
const
|
|
2482
|
-
return 0 !== s ? s : yt(
|
|
2479
|
+
function Ot(t, n) {
|
|
2480
|
+
if ("string" == typeof t && "string" == typeof n && t.length === n.length) return yt(t, n);
|
|
2481
|
+
const e = Rt(t), r = Rt(n), s = yt(e.seconds, r.seconds);
|
|
2482
|
+
return 0 !== s ? s : yt(e.nanos, r.nanos);
|
|
2483
2483
|
}
|
|
2484
2484
|
|
|
2485
|
-
function Ct(t,
|
|
2485
|
+
function Ct(t, n) {
|
|
2486
2486
|
return {
|
|
2487
|
-
referenceValue: `projects/${t.projectId}/databases/${t.database}/documents/${
|
|
2487
|
+
referenceValue: `projects/${t.projectId}/databases/${t.database}/documents/${n.path.canonicalString()}`
|
|
2488
2488
|
};
|
|
2489
2489
|
}
|
|
2490
2490
|
|
|
@@ -2512,21 +2512,21 @@ function Ct(t, e) {
|
|
|
2512
2512
|
timestampValue: Object.assign({}, t.timestampValue)
|
|
2513
2513
|
};
|
|
2514
2514
|
if (t.mapValue) {
|
|
2515
|
-
const
|
|
2515
|
+
const n = {
|
|
2516
2516
|
mapValue: {
|
|
2517
2517
|
fields: {}
|
|
2518
2518
|
}
|
|
2519
2519
|
};
|
|
2520
|
-
return Et(t.mapValue.fields, ((t,
|
|
2520
|
+
return Et(t.mapValue.fields, ((t, e) => n.mapValue.fields[t] = Mt(e))), n;
|
|
2521
2521
|
}
|
|
2522
2522
|
if (t.arrayValue) {
|
|
2523
|
-
const
|
|
2523
|
+
const n = {
|
|
2524
2524
|
arrayValue: {
|
|
2525
2525
|
values: []
|
|
2526
2526
|
}
|
|
2527
2527
|
};
|
|
2528
|
-
for (let
|
|
2529
|
-
return
|
|
2528
|
+
for (let e = 0; e < (t.arrayValue.values || []).length; ++e) n.arrayValue.values[e] = Mt(t.arrayValue.values[e]);
|
|
2529
|
+
return n;
|
|
2530
2530
|
}
|
|
2531
2531
|
return Object.assign({}, t);
|
|
2532
2532
|
}
|
|
@@ -2567,10 +2567,10 @@ function Ct(t, e) {
|
|
|
2567
2567
|
*/ field(t) {
|
|
2568
2568
|
if (t.isEmpty()) return this.value;
|
|
2569
2569
|
{
|
|
2570
|
-
let
|
|
2571
|
-
for (let
|
|
2572
|
-
!jt(
|
|
2573
|
-
return
|
|
2570
|
+
let n = this.value;
|
|
2571
|
+
for (let e = 0; e < t.length - 1; ++e) if (n = (n.mapValue.fields || {})[t.get(e)],
|
|
2572
|
+
!jt(n)) return null;
|
|
2573
|
+
return n = (n.mapValue.fields || {})[t.lastSegment()], n || null;
|
|
2574
2574
|
}
|
|
2575
2575
|
}
|
|
2576
2576
|
/**
|
|
@@ -2578,25 +2578,25 @@ function Ct(t, e) {
|
|
|
2578
2578
|
*
|
|
2579
2579
|
* @param path - The field path to set.
|
|
2580
2580
|
* @param value - The value to set.
|
|
2581
|
-
*/ set(t,
|
|
2582
|
-
this.getFieldsMap(t.popLast())[t.lastSegment()] = Mt(
|
|
2581
|
+
*/ set(t, n) {
|
|
2582
|
+
this.getFieldsMap(t.popLast())[t.lastSegment()] = Mt(n);
|
|
2583
2583
|
}
|
|
2584
2584
|
/**
|
|
2585
2585
|
* Sets the provided fields to the provided values.
|
|
2586
2586
|
*
|
|
2587
2587
|
* @param data - A map of fields to values (or null for deletes).
|
|
2588
2588
|
*/ setAll(t) {
|
|
2589
|
-
let
|
|
2589
|
+
let n = tt.emptyPath(), e = {}, r = [];
|
|
2590
2590
|
t.forEach(((t, s) => {
|
|
2591
|
-
if (!
|
|
2591
|
+
if (!n.isImmediateParentOf(s)) {
|
|
2592
2592
|
// Insert the accumulated changes at this parent location
|
|
2593
|
-
const t = this.getFieldsMap(
|
|
2594
|
-
this.applyChanges(t,
|
|
2593
|
+
const t = this.getFieldsMap(n);
|
|
2594
|
+
this.applyChanges(t, e, r), e = {}, r = [], n = s.popLast();
|
|
2595
2595
|
}
|
|
2596
|
-
t ?
|
|
2596
|
+
t ? e[s.lastSegment()] = Mt(t) : r.push(s.lastSegment());
|
|
2597
2597
|
}));
|
|
2598
|
-
const s = this.getFieldsMap(
|
|
2599
|
-
this.applyChanges(s,
|
|
2598
|
+
const s = this.getFieldsMap(n);
|
|
2599
|
+
this.applyChanges(s, e, r);
|
|
2600
2600
|
}
|
|
2601
2601
|
/**
|
|
2602
2602
|
* Removes the field at the specified path. If there is no field at the
|
|
@@ -2604,36 +2604,36 @@ function Ct(t, e) {
|
|
|
2604
2604
|
*
|
|
2605
2605
|
* @param path - The field path to remove.
|
|
2606
2606
|
*/ delete(t) {
|
|
2607
|
-
const
|
|
2608
|
-
jt(
|
|
2607
|
+
const n = this.field(t.popLast());
|
|
2608
|
+
jt(n) && n.mapValue.fields && delete n.mapValue.fields[t.lastSegment()];
|
|
2609
2609
|
}
|
|
2610
2610
|
isEqual(t) {
|
|
2611
|
-
return
|
|
2611
|
+
return Ft(this.value, t.value);
|
|
2612
2612
|
}
|
|
2613
2613
|
/**
|
|
2614
2614
|
* Returns the map that contains the leaf element of `path`. If the parent
|
|
2615
2615
|
* entry does not yet exist, or if it is not a map, a new map will be created.
|
|
2616
2616
|
*/ getFieldsMap(t) {
|
|
2617
|
-
let
|
|
2618
|
-
|
|
2617
|
+
let n = this.value;
|
|
2618
|
+
n.mapValue.fields || (n.mapValue = {
|
|
2619
2619
|
fields: {}
|
|
2620
2620
|
});
|
|
2621
|
-
for (let
|
|
2622
|
-
let r =
|
|
2621
|
+
for (let e = 0; e < t.length; ++e) {
|
|
2622
|
+
let r = n.mapValue.fields[t.get(e)];
|
|
2623
2623
|
jt(r) && r.mapValue.fields || (r = {
|
|
2624
2624
|
mapValue: {
|
|
2625
2625
|
fields: {}
|
|
2626
2626
|
}
|
|
2627
|
-
},
|
|
2627
|
+
}, n.mapValue.fields[t.get(e)] = r), n = r;
|
|
2628
2628
|
}
|
|
2629
|
-
return
|
|
2629
|
+
return n.mapValue.fields;
|
|
2630
2630
|
}
|
|
2631
2631
|
/**
|
|
2632
2632
|
* Modifies `fieldsMap` by adding, replacing or deleting the specified
|
|
2633
2633
|
* entries.
|
|
2634
|
-
*/ applyChanges(t,
|
|
2635
|
-
Et(
|
|
2636
|
-
for (const
|
|
2634
|
+
*/ applyChanges(t, n, e) {
|
|
2635
|
+
Et(n, ((n, e) => t[n] = e));
|
|
2636
|
+
for (const n of e) delete t[n];
|
|
2637
2637
|
}
|
|
2638
2638
|
clone() {
|
|
2639
2639
|
return new Bt(Mt(this.value));
|
|
@@ -2666,8 +2666,8 @@ function Ct(t, e) {
|
|
|
2666
2666
|
* applied, `isValidDocument()` returns false and the document should be removed
|
|
2667
2667
|
* from all views.
|
|
2668
2668
|
*/ class zt {
|
|
2669
|
-
constructor(t,
|
|
2670
|
-
this.key = t, this.documentType =
|
|
2669
|
+
constructor(t, n, e, r, s) {
|
|
2670
|
+
this.key = t, this.documentType = n, this.version = e, this.data = r, this.documentState = s;
|
|
2671
2671
|
}
|
|
2672
2672
|
/**
|
|
2673
2673
|
* Creates a document with no known version or data, but which can serve as
|
|
@@ -2678,24 +2678,24 @@ function Ct(t, e) {
|
|
|
2678
2678
|
/**
|
|
2679
2679
|
* Creates a new document that is known to exist with the given data at the
|
|
2680
2680
|
* given version.
|
|
2681
|
-
*/ static newFoundDocument(t,
|
|
2682
|
-
return new zt(t, 1 /* FOUND_DOCUMENT */ ,
|
|
2681
|
+
*/ static newFoundDocument(t, n, e) {
|
|
2682
|
+
return new zt(t, 1 /* FOUND_DOCUMENT */ , n, e, 0 /* SYNCED */);
|
|
2683
2683
|
}
|
|
2684
|
-
/** Creates a new document that is known to not exist at the given version. */ static newNoDocument(t,
|
|
2685
|
-
return new zt(t, 2 /* NO_DOCUMENT */ ,
|
|
2684
|
+
/** Creates a new document that is known to not exist at the given version. */ static newNoDocument(t, n) {
|
|
2685
|
+
return new zt(t, 2 /* NO_DOCUMENT */ , n, Bt.empty(), 0 /* SYNCED */);
|
|
2686
2686
|
}
|
|
2687
2687
|
/**
|
|
2688
2688
|
* Creates a new document that is known to exist at the given version but
|
|
2689
2689
|
* whose data is not known (e.g. a document that was updated without a known
|
|
2690
2690
|
* base document).
|
|
2691
|
-
*/ static newUnknownDocument(t,
|
|
2692
|
-
return new zt(t, 3 /* UNKNOWN_DOCUMENT */ ,
|
|
2691
|
+
*/ static newUnknownDocument(t, n) {
|
|
2692
|
+
return new zt(t, 3 /* UNKNOWN_DOCUMENT */ , n, Bt.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
|
|
2693
2693
|
}
|
|
2694
2694
|
/**
|
|
2695
2695
|
* Changes the document type to indicate that it exists and that its version
|
|
2696
2696
|
* and data are known.
|
|
2697
|
-
*/ convertToFoundDocument(t,
|
|
2698
|
-
return this.version = t, this.documentType = 1 /* FOUND_DOCUMENT */ , this.data =
|
|
2697
|
+
*/ convertToFoundDocument(t, n) {
|
|
2698
|
+
return this.version = t, this.documentType = 1 /* FOUND_DOCUMENT */ , this.data = n,
|
|
2699
2699
|
this.documentState = 0 /* SYNCED */ , this;
|
|
2700
2700
|
}
|
|
2701
2701
|
/**
|
|
@@ -2769,9 +2769,9 @@ function Ct(t, e) {
|
|
|
2769
2769
|
*/
|
|
2770
2770
|
// Visible for testing
|
|
2771
2771
|
class Gt {
|
|
2772
|
-
constructor(t,
|
|
2773
|
-
this.path = t, this.collectionGroup =
|
|
2774
|
-
this.startAt = i, this.endAt = o, this.
|
|
2772
|
+
constructor(t, n = null, e = [], r = [], s = null, i = null, o = null) {
|
|
2773
|
+
this.path = t, this.collectionGroup = n, this.orderBy = e, this.filters = r, this.limit = s,
|
|
2774
|
+
this.startAt = i, this.endAt = o, this.P = null;
|
|
2775
2775
|
}
|
|
2776
2776
|
}
|
|
2777
2777
|
|
|
@@ -2782,26 +2782,26 @@ class Gt {
|
|
|
2782
2782
|
* NOTE: you should always construct `Target` from `Query.toTarget` instead of
|
|
2783
2783
|
* using this factory method, because `Query` provides an implicit `orderBy`
|
|
2784
2784
|
* property.
|
|
2785
|
-
*/ function Qt(t,
|
|
2786
|
-
return new Gt(t,
|
|
2785
|
+
*/ function Qt(t, n = null, e = [], r = [], s = null, i = null, o = null) {
|
|
2786
|
+
return new Gt(t, n, e, r, s, i, o);
|
|
2787
2787
|
}
|
|
2788
2788
|
|
|
2789
2789
|
class Wt extends class {} {
|
|
2790
|
-
constructor(t,
|
|
2791
|
-
super(), this.field = t, this.op =
|
|
2790
|
+
constructor(t, n, e) {
|
|
2791
|
+
super(), this.field = t, this.op = n, this.value = e;
|
|
2792
2792
|
}
|
|
2793
2793
|
/**
|
|
2794
2794
|
* Creates a filter based on the provided arguments.
|
|
2795
|
-
*/ static create(t,
|
|
2796
|
-
return t.isKeyField() ? "in" /* IN */ ===
|
|
2795
|
+
*/ static create(t, n, e) {
|
|
2796
|
+
return t.isKeyField() ? "in" /* IN */ === n || "not-in" /* NOT_IN */ === n ? this.V(t, n, e) : new Yt(t, n, e) : "array-contains" /* ARRAY_CONTAINS */ === n ? new Xt(t, e) : "in" /* IN */ === n ? new Zt(t, e) : "not-in" /* NOT_IN */ === n ? new tn(t, e) : "array-contains-any" /* ARRAY_CONTAINS_ANY */ === n ? new nn(t, e) : new Wt(t, n, e);
|
|
2797
2797
|
}
|
|
2798
|
-
static V(t,
|
|
2799
|
-
return "in" /* IN */ ===
|
|
2798
|
+
static V(t, n, e) {
|
|
2799
|
+
return "in" /* IN */ === n ? new Ht(t, e) : new Kt(t, e);
|
|
2800
2800
|
}
|
|
2801
2801
|
matches(t) {
|
|
2802
|
-
const
|
|
2802
|
+
const n = t.data.field(this.field);
|
|
2803
2803
|
// Types do not have to match in NOT_EQUAL filters.
|
|
2804
|
-
return "!=" /* NOT_EQUAL */ === this.op ? null !==
|
|
2804
|
+
return "!=" /* NOT_EQUAL */ === this.op ? null !== n && this.D(qt(n, this.value)) : null !== n && St(this.value) === St(n) && this.D(qt(n, this.value));
|
|
2805
2805
|
// Only compare types with matching backend order (such as double and int).
|
|
2806
2806
|
}
|
|
2807
2807
|
D(t) {
|
|
@@ -2835,78 +2835,78 @@ class Wt extends class {} {
|
|
|
2835
2835
|
|
|
2836
2836
|
/** Filter that matches on key fields (i.e. '__name__'). */
|
|
2837
2837
|
class Yt extends Wt {
|
|
2838
|
-
constructor(t,
|
|
2839
|
-
super(t,
|
|
2838
|
+
constructor(t, n, e) {
|
|
2839
|
+
super(t, n, e), this.key = nt.fromName(e.referenceValue);
|
|
2840
2840
|
}
|
|
2841
2841
|
matches(t) {
|
|
2842
|
-
const
|
|
2843
|
-
return this.D(
|
|
2842
|
+
const n = nt.comparator(t.key, this.key);
|
|
2843
|
+
return this.D(n);
|
|
2844
2844
|
}
|
|
2845
2845
|
}
|
|
2846
2846
|
|
|
2847
2847
|
/** Filter that matches on key fields within an array. */ class Ht extends Wt {
|
|
2848
|
-
constructor(t,
|
|
2849
|
-
super(t, "in" /* IN */ ,
|
|
2848
|
+
constructor(t, n) {
|
|
2849
|
+
super(t, "in" /* IN */ , n), this.keys = Jt("in" /* IN */ , n);
|
|
2850
2850
|
}
|
|
2851
2851
|
matches(t) {
|
|
2852
|
-
return this.keys.some((
|
|
2852
|
+
return this.keys.some((n => n.isEqual(t.key)));
|
|
2853
2853
|
}
|
|
2854
2854
|
}
|
|
2855
2855
|
|
|
2856
2856
|
/** Filter that matches on key fields not present within an array. */ class Kt extends Wt {
|
|
2857
|
-
constructor(t,
|
|
2858
|
-
super(t, "not-in" /* NOT_IN */ ,
|
|
2857
|
+
constructor(t, n) {
|
|
2858
|
+
super(t, "not-in" /* NOT_IN */ , n), this.keys = Jt("not-in" /* NOT_IN */ , n);
|
|
2859
2859
|
}
|
|
2860
2860
|
matches(t) {
|
|
2861
|
-
return !this.keys.some((
|
|
2861
|
+
return !this.keys.some((n => n.isEqual(t.key)));
|
|
2862
2862
|
}
|
|
2863
2863
|
}
|
|
2864
2864
|
|
|
2865
|
-
function Jt(t,
|
|
2866
|
-
var
|
|
2867
|
-
return ((null === (
|
|
2865
|
+
function Jt(t, n) {
|
|
2866
|
+
var e;
|
|
2867
|
+
return ((null === (e = n.arrayValue) || void 0 === e ? void 0 : e.values) || []).map((t => nt.fromName(t.referenceValue)));
|
|
2868
2868
|
}
|
|
2869
2869
|
|
|
2870
2870
|
/** A Filter that implements the array-contains operator. */ class Xt extends Wt {
|
|
2871
|
-
constructor(t,
|
|
2872
|
-
super(t, "array-contains" /* ARRAY_CONTAINS */ ,
|
|
2871
|
+
constructor(t, n) {
|
|
2872
|
+
super(t, "array-contains" /* ARRAY_CONTAINS */ , n);
|
|
2873
2873
|
}
|
|
2874
2874
|
matches(t) {
|
|
2875
|
-
const
|
|
2876
|
-
return Lt(
|
|
2875
|
+
const n = t.data.field(this.field);
|
|
2876
|
+
return Lt(n) && xt(n.arrayValue, this.value);
|
|
2877
2877
|
}
|
|
2878
2878
|
}
|
|
2879
2879
|
|
|
2880
2880
|
/** A Filter that implements the IN operator. */ class Zt extends Wt {
|
|
2881
|
-
constructor(t,
|
|
2882
|
-
super(t, "in" /* IN */ ,
|
|
2881
|
+
constructor(t, n) {
|
|
2882
|
+
super(t, "in" /* IN */ , n);
|
|
2883
2883
|
}
|
|
2884
2884
|
matches(t) {
|
|
2885
|
-
const
|
|
2886
|
-
return null !==
|
|
2885
|
+
const n = t.data.field(this.field);
|
|
2886
|
+
return null !== n && xt(this.value.arrayValue, n);
|
|
2887
2887
|
}
|
|
2888
2888
|
}
|
|
2889
2889
|
|
|
2890
|
-
/** A Filter that implements the not-in operator. */ class
|
|
2891
|
-
constructor(t,
|
|
2892
|
-
super(t, "not-in" /* NOT_IN */ ,
|
|
2890
|
+
/** A Filter that implements the not-in operator. */ class tn extends Wt {
|
|
2891
|
+
constructor(t, n) {
|
|
2892
|
+
super(t, "not-in" /* NOT_IN */ , n);
|
|
2893
2893
|
}
|
|
2894
2894
|
matches(t) {
|
|
2895
2895
|
if (xt(this.value.arrayValue, {
|
|
2896
2896
|
nullValue: "NULL_VALUE"
|
|
2897
2897
|
})) return !1;
|
|
2898
|
-
const
|
|
2899
|
-
return null !==
|
|
2898
|
+
const n = t.data.field(this.field);
|
|
2899
|
+
return null !== n && !xt(this.value.arrayValue, n);
|
|
2900
2900
|
}
|
|
2901
2901
|
}
|
|
2902
2902
|
|
|
2903
|
-
/** A Filter that implements the array-contains-any operator. */ class
|
|
2904
|
-
constructor(t,
|
|
2905
|
-
super(t, "array-contains-any" /* ARRAY_CONTAINS_ANY */ ,
|
|
2903
|
+
/** A Filter that implements the array-contains-any operator. */ class nn extends Wt {
|
|
2904
|
+
constructor(t, n) {
|
|
2905
|
+
super(t, "array-contains-any" /* ARRAY_CONTAINS_ANY */ , n);
|
|
2906
2906
|
}
|
|
2907
2907
|
matches(t) {
|
|
2908
|
-
const
|
|
2909
|
-
return !(!Lt(
|
|
2908
|
+
const n = t.data.field(this.field);
|
|
2909
|
+
return !(!Lt(n) || !n.arrayValue.values) && n.arrayValue.values.some((t => xt(this.value.arrayValue, t)));
|
|
2910
2910
|
}
|
|
2911
2911
|
}
|
|
2912
2912
|
|
|
@@ -2923,30 +2923,30 @@ function Jt(t, e) {
|
|
|
2923
2923
|
* Bound provides a function to determine whether a document comes before or
|
|
2924
2924
|
* after a bound. This is influenced by whether the position is just before or
|
|
2925
2925
|
* just after the provided values.
|
|
2926
|
-
*/ class
|
|
2927
|
-
constructor(t,
|
|
2928
|
-
this.position = t, this.before =
|
|
2926
|
+
*/ class en {
|
|
2927
|
+
constructor(t, n) {
|
|
2928
|
+
this.position = t, this.before = n;
|
|
2929
2929
|
}
|
|
2930
2930
|
}
|
|
2931
2931
|
|
|
2932
2932
|
/**
|
|
2933
2933
|
* An ordering on a field, in some Direction. Direction defaults to ASCENDING.
|
|
2934
|
-
*/ class
|
|
2935
|
-
constructor(t,
|
|
2936
|
-
this.field = t, this.dir =
|
|
2934
|
+
*/ class rn {
|
|
2935
|
+
constructor(t, n = "asc" /* ASCENDING */) {
|
|
2936
|
+
this.field = t, this.dir = n;
|
|
2937
2937
|
}
|
|
2938
2938
|
}
|
|
2939
2939
|
|
|
2940
|
-
function
|
|
2941
|
-
return t.dir ===
|
|
2940
|
+
function sn(t, n) {
|
|
2941
|
+
return t.dir === n.dir && t.field.isEqual(n.field);
|
|
2942
2942
|
}
|
|
2943
2943
|
|
|
2944
|
-
function
|
|
2945
|
-
if (null === t) return null ===
|
|
2946
|
-
if (null ===
|
|
2947
|
-
if (t.before !==
|
|
2948
|
-
for (let
|
|
2949
|
-
if (!
|
|
2944
|
+
function on(t, n) {
|
|
2945
|
+
if (null === t) return null === n;
|
|
2946
|
+
if (null === n) return !1;
|
|
2947
|
+
if (t.before !== n.before || t.position.length !== n.position.length) return !1;
|
|
2948
|
+
for (let e = 0; e < t.position.length; e++) {
|
|
2949
|
+
if (!Ft(t.position[e], n.position[e])) return !1;
|
|
2950
2950
|
}
|
|
2951
2951
|
return !0;
|
|
2952
2952
|
}
|
|
@@ -2973,29 +2973,29 @@ function ie(t, e) {
|
|
|
2973
2973
|
* query the RemoteStore results.
|
|
2974
2974
|
*
|
|
2975
2975
|
* Visible for testing.
|
|
2976
|
-
*/ class
|
|
2976
|
+
*/ class un {
|
|
2977
2977
|
/**
|
|
2978
2978
|
* Initializes a Query with a path and optional additional query constraints.
|
|
2979
2979
|
* Path must currently be empty if this is a collection group query.
|
|
2980
2980
|
*/
|
|
2981
|
-
constructor(t,
|
|
2982
|
-
this.path = t, this.collectionGroup =
|
|
2981
|
+
constructor(t, n = null, e = [], r = [], s = null, i = "F" /* First */ , o = null, u = null) {
|
|
2982
|
+
this.path = t, this.collectionGroup = n, this.explicitOrderBy = e, this.filters = r,
|
|
2983
2983
|
this.limit = s, this.limitType = i, this.startAt = o, this.endAt = u, this.$ = null,
|
|
2984
2984
|
// The corresponding `Target` of this `Query` instance.
|
|
2985
|
-
this.
|
|
2985
|
+
this.S = null, this.startAt, this.endAt;
|
|
2986
2986
|
}
|
|
2987
2987
|
}
|
|
2988
2988
|
|
|
2989
|
-
/** Creates a new Query for a query that matches all documents at `path` */ function
|
|
2989
|
+
/** Creates a new Query for a query that matches all documents at `path` */ function cn(t) {
|
|
2990
2990
|
return !ct(t.limit) && "L" /* Last */ === t.limitType;
|
|
2991
2991
|
}
|
|
2992
2992
|
|
|
2993
|
-
function
|
|
2993
|
+
function an(t) {
|
|
2994
2994
|
return t.explicitOrderBy.length > 0 ? t.explicitOrderBy[0].field : null;
|
|
2995
2995
|
}
|
|
2996
2996
|
|
|
2997
|
-
function
|
|
2998
|
-
for (const
|
|
2997
|
+
function hn(t) {
|
|
2998
|
+
for (const n of t.filters) if (n.N()) return n.field;
|
|
2999
2999
|
return null;
|
|
3000
3000
|
}
|
|
3001
3001
|
|
|
@@ -3007,7 +3007,7 @@ function ae(t) {
|
|
|
3007
3007
|
* Returns whether the query matches a collection group rather than a specific
|
|
3008
3008
|
* collection.
|
|
3009
3009
|
*/
|
|
3010
|
-
function
|
|
3010
|
+
function ln(t) {
|
|
3011
3011
|
return null !== t.collectionGroup;
|
|
3012
3012
|
}
|
|
3013
3013
|
|
|
@@ -3015,59 +3015,59 @@ function he(t) {
|
|
|
3015
3015
|
* Returns the implicit order by constraint that is used to execute the Query,
|
|
3016
3016
|
* which can be different from the order by constraints the user provided (e.g.
|
|
3017
3017
|
* the SDK and backend always orders by `__name__`).
|
|
3018
|
-
*/ function
|
|
3019
|
-
const
|
|
3020
|
-
if (null ===
|
|
3021
|
-
|
|
3022
|
-
const t =
|
|
3023
|
-
if (null !== t && null ===
|
|
3018
|
+
*/ function fn(t) {
|
|
3019
|
+
const n = b(t);
|
|
3020
|
+
if (null === n.$) {
|
|
3021
|
+
n.$ = [];
|
|
3022
|
+
const t = hn(n), e = an(n);
|
|
3023
|
+
if (null !== t && null === e)
|
|
3024
3024
|
// In order to implicitly add key ordering, we must also add the
|
|
3025
3025
|
// inequality filter field for it to be a valid query.
|
|
3026
3026
|
// Note that the default inequality field and key ordering is ascending.
|
|
3027
|
-
t.isKeyField() ||
|
|
3027
|
+
t.isKeyField() || n.$.push(new rn(t)), n.$.push(new rn(tt.keyField(), "asc" /* ASCENDING */)); else {
|
|
3028
3028
|
let t = !1;
|
|
3029
|
-
for (const
|
|
3029
|
+
for (const e of n.explicitOrderBy) n.$.push(e), e.field.isKeyField() && (t = !0);
|
|
3030
3030
|
if (!t) {
|
|
3031
3031
|
// The order of the implicit key ordering always matches the last
|
|
3032
3032
|
// explicit order by
|
|
3033
|
-
const t =
|
|
3034
|
-
|
|
3033
|
+
const t = n.explicitOrderBy.length > 0 ? n.explicitOrderBy[n.explicitOrderBy.length - 1].dir : "asc" /* ASCENDING */;
|
|
3034
|
+
n.$.push(new rn(tt.keyField(), t));
|
|
3035
3035
|
}
|
|
3036
3036
|
}
|
|
3037
3037
|
}
|
|
3038
|
-
return
|
|
3038
|
+
return n.$;
|
|
3039
3039
|
}
|
|
3040
3040
|
|
|
3041
3041
|
/**
|
|
3042
3042
|
* Converts this `Query` instance to it's corresponding `Target` representation.
|
|
3043
|
-
*/ function
|
|
3044
|
-
const
|
|
3045
|
-
if (!
|
|
3043
|
+
*/ function dn(t) {
|
|
3044
|
+
const n = b(t);
|
|
3045
|
+
if (!n.S) if ("F" /* First */ === n.limitType) n.S = Qt(n.path, n.collectionGroup, fn(n), n.filters, n.limit, n.startAt, n.endAt); else {
|
|
3046
3046
|
// Flip the orderBy directions since we want the last results
|
|
3047
3047
|
const t = [];
|
|
3048
|
-
for (const
|
|
3049
|
-
const
|
|
3050
|
-
t.push(new
|
|
3048
|
+
for (const e of fn(n)) {
|
|
3049
|
+
const n = "desc" /* DESCENDING */ === e.dir ? "asc" /* ASCENDING */ : "desc" /* DESCENDING */;
|
|
3050
|
+
t.push(new rn(e.field, n));
|
|
3051
3051
|
}
|
|
3052
3052
|
// We need to swap the cursors to match the now-flipped query ordering.
|
|
3053
|
-
const
|
|
3053
|
+
const e = n.endAt ? new en(n.endAt.position, !n.endAt.before) : null, r = n.startAt ? new en(n.startAt.position, !n.startAt.before) : null;
|
|
3054
3054
|
// Now return as a LimitType.First query.
|
|
3055
|
-
|
|
3055
|
+
n.S = Qt(n.path, n.collectionGroup, t, n.filters, n.limit, e, r);
|
|
3056
3056
|
}
|
|
3057
|
-
return
|
|
3057
|
+
return n.S;
|
|
3058
3058
|
}
|
|
3059
3059
|
|
|
3060
|
-
function
|
|
3061
|
-
return function(t,
|
|
3062
|
-
if (t.limit !==
|
|
3063
|
-
if (t.orderBy.length !==
|
|
3064
|
-
for (let
|
|
3065
|
-
if (t.filters.length !==
|
|
3066
|
-
for (let s = 0; s < t.filters.length; s++) if (
|
|
3067
|
-
|
|
3068
|
-
var
|
|
3069
|
-
return t.collectionGroup ===
|
|
3070
|
-
}(
|
|
3060
|
+
function wn(t, n) {
|
|
3061
|
+
return function(t, n) {
|
|
3062
|
+
if (t.limit !== n.limit) return !1;
|
|
3063
|
+
if (t.orderBy.length !== n.orderBy.length) return !1;
|
|
3064
|
+
for (let e = 0; e < t.orderBy.length; e++) if (!sn(t.orderBy[e], n.orderBy[e])) return !1;
|
|
3065
|
+
if (t.filters.length !== n.filters.length) return !1;
|
|
3066
|
+
for (let s = 0; s < t.filters.length; s++) if (e = t.filters[s], r = n.filters[s],
|
|
3067
|
+
e.op !== r.op || !e.field.isEqual(r.field) || !Ft(e.value, r.value)) return !1;
|
|
3068
|
+
var e, r;
|
|
3069
|
+
return t.collectionGroup === n.collectionGroup && !!t.path.isEqual(n.path) && !!on(t.startAt, n.startAt) && on(t.endAt, n.endAt);
|
|
3070
|
+
}(dn(t), dn(n)) && t.limitType === n.limitType;
|
|
3071
3071
|
}
|
|
3072
3072
|
|
|
3073
3073
|
/**
|
|
@@ -3095,10 +3095,10 @@ function de(t, e) {
|
|
|
3095
3095
|
* The return value is an IntegerValue if it can safely represent the value,
|
|
3096
3096
|
* otherwise a DoubleValue is returned.
|
|
3097
3097
|
*/
|
|
3098
|
-
function
|
|
3098
|
+
function mn(t, n) {
|
|
3099
3099
|
return function(t) {
|
|
3100
3100
|
return "number" == typeof t && Number.isInteger(t) && !at(t) && t <= Number.MAX_SAFE_INTEGER && t >= Number.MIN_SAFE_INTEGER;
|
|
3101
|
-
}(
|
|
3101
|
+
}(n) ?
|
|
3102
3102
|
/**
|
|
3103
3103
|
* Returns an IntegerValue for `value`.
|
|
3104
3104
|
*/
|
|
@@ -3106,22 +3106,22 @@ function we(t, e) {
|
|
|
3106
3106
|
return {
|
|
3107
3107
|
integerValue: "" + t
|
|
3108
3108
|
};
|
|
3109
|
-
}(
|
|
3110
|
-
if (t.
|
|
3111
|
-
if (isNaN(
|
|
3109
|
+
}(n) : function(t, n) {
|
|
3110
|
+
if (t.F) {
|
|
3111
|
+
if (isNaN(n)) return {
|
|
3112
3112
|
doubleValue: "NaN"
|
|
3113
3113
|
};
|
|
3114
|
-
if (
|
|
3114
|
+
if (n === 1 / 0) return {
|
|
3115
3115
|
doubleValue: "Infinity"
|
|
3116
3116
|
};
|
|
3117
|
-
if (
|
|
3117
|
+
if (n === -1 / 0) return {
|
|
3118
3118
|
doubleValue: "-Infinity"
|
|
3119
3119
|
};
|
|
3120
3120
|
}
|
|
3121
3121
|
return {
|
|
3122
|
-
doubleValue: at(
|
|
3122
|
+
doubleValue: at(n) ? "-0" : n
|
|
3123
3123
|
};
|
|
3124
|
-
}(t,
|
|
3124
|
+
}(t, n);
|
|
3125
3125
|
}
|
|
3126
3126
|
|
|
3127
3127
|
/**
|
|
@@ -3140,7 +3140,7 @@ function we(t, e) {
|
|
|
3140
3140
|
* See the License for the specific language governing permissions and
|
|
3141
3141
|
* limitations under the License.
|
|
3142
3142
|
*/
|
|
3143
|
-
/** Used to represent a field transform on a mutation. */ class
|
|
3143
|
+
/** Used to represent a field transform on a mutation. */ class pn {
|
|
3144
3144
|
constructor() {
|
|
3145
3145
|
// Make sure that the structural type of `TransformOperation` is unique.
|
|
3146
3146
|
// See https://github.com/microsoft/TypeScript/issues/5451
|
|
@@ -3148,15 +3148,15 @@ function we(t, e) {
|
|
|
3148
3148
|
}
|
|
3149
3149
|
}
|
|
3150
3150
|
|
|
3151
|
-
/** Transforms a value into a server-generated timestamp. */ class
|
|
3151
|
+
/** Transforms a value into a server-generated timestamp. */ class yn extends pn {}
|
|
3152
3152
|
|
|
3153
|
-
/** Transforms an array value via a union operation. */ class
|
|
3153
|
+
/** Transforms an array value via a union operation. */ class _n extends pn {
|
|
3154
3154
|
constructor(t) {
|
|
3155
3155
|
super(), this.elements = t;
|
|
3156
3156
|
}
|
|
3157
3157
|
}
|
|
3158
3158
|
|
|
3159
|
-
/** Transforms an array value via a remove operation. */ class
|
|
3159
|
+
/** Transforms an array value via a remove operation. */ class gn extends pn {
|
|
3160
3160
|
constructor(t) {
|
|
3161
3161
|
super(), this.elements = t;
|
|
3162
3162
|
}
|
|
@@ -3167,9 +3167,9 @@ function we(t, e) {
|
|
|
3167
3167
|
* transforms. Converts all field values to integers or doubles, but unlike the
|
|
3168
3168
|
* backend does not cap integer values at 2^63. Instead, JavaScript number
|
|
3169
3169
|
* arithmetic is used and precision loss can occur for values greater than 2^53.
|
|
3170
|
-
*/ class
|
|
3171
|
-
constructor(t,
|
|
3172
|
-
super(), this.q = t, this.O =
|
|
3170
|
+
*/ class vn extends pn {
|
|
3171
|
+
constructor(t, n) {
|
|
3172
|
+
super(), this.q = t, this.O = n;
|
|
3173
3173
|
}
|
|
3174
3174
|
}
|
|
3175
3175
|
|
|
@@ -3189,9 +3189,9 @@ function we(t, e) {
|
|
|
3189
3189
|
* See the License for the specific language governing permissions and
|
|
3190
3190
|
* limitations under the License.
|
|
3191
3191
|
*/
|
|
3192
|
-
/** A field path and the TransformOperation to perform upon it. */ class
|
|
3193
|
-
constructor(t,
|
|
3194
|
-
this.field = t, this.transform =
|
|
3192
|
+
/** A field path and the TransformOperation to perform upon it. */ class bn {
|
|
3193
|
+
constructor(t, n) {
|
|
3194
|
+
this.field = t, this.transform = n;
|
|
3195
3195
|
}
|
|
3196
3196
|
}
|
|
3197
3197
|
|
|
@@ -3199,18 +3199,18 @@ function we(t, e) {
|
|
|
3199
3199
|
* Encodes a precondition for a mutation. This follows the model that the
|
|
3200
3200
|
* backend accepts with the special case of an explicit "empty" precondition
|
|
3201
3201
|
* (meaning no precondition).
|
|
3202
|
-
*/ class
|
|
3203
|
-
constructor(t,
|
|
3204
|
-
this.updateTime = t, this.exists =
|
|
3202
|
+
*/ class En {
|
|
3203
|
+
constructor(t, n) {
|
|
3204
|
+
this.updateTime = t, this.exists = n;
|
|
3205
3205
|
}
|
|
3206
3206
|
/** Creates a new empty Precondition. */ static none() {
|
|
3207
|
-
return new
|
|
3207
|
+
return new En;
|
|
3208
3208
|
}
|
|
3209
3209
|
/** Creates a new Precondition with an exists flag. */ static exists(t) {
|
|
3210
|
-
return new
|
|
3210
|
+
return new En(void 0, t);
|
|
3211
3211
|
}
|
|
3212
3212
|
/** Creates a new Precondition based on a version a document exists at. */ static updateTime(t) {
|
|
3213
|
-
return new
|
|
3213
|
+
return new En(t);
|
|
3214
3214
|
}
|
|
3215
3215
|
/** Returns whether this Precondition is empty. */ get isNone() {
|
|
3216
3216
|
return void 0 === this.updateTime && void 0 === this.exists;
|
|
@@ -3263,14 +3263,14 @@ function we(t, e) {
|
|
|
3263
3263
|
* applyToLocalView() to implement the actual behavior of applying the mutation
|
|
3264
3264
|
* to some source document (see `setMutationApplyToRemoteDocument()` for an
|
|
3265
3265
|
* example).
|
|
3266
|
-
*/ class
|
|
3266
|
+
*/ class Tn {}
|
|
3267
3267
|
|
|
3268
3268
|
/**
|
|
3269
3269
|
* A mutation that creates or replaces the document at the given key with the
|
|
3270
3270
|
* object value contents.
|
|
3271
|
-
*/ class
|
|
3272
|
-
constructor(t,
|
|
3273
|
-
super(), this.key = t, this.value =
|
|
3271
|
+
*/ class In extends Tn {
|
|
3272
|
+
constructor(t, n, e, r = []) {
|
|
3273
|
+
super(), this.key = t, this.value = n, this.precondition = e, this.fieldTransforms = r,
|
|
3274
3274
|
this.type = 0 /* Set */;
|
|
3275
3275
|
}
|
|
3276
3276
|
}
|
|
@@ -3287,16 +3287,16 @@ function we(t, e) {
|
|
|
3287
3287
|
* is deleted.
|
|
3288
3288
|
* * When a field is not in the mask but is in the values, the values map is
|
|
3289
3289
|
* ignored.
|
|
3290
|
-
*/ class
|
|
3291
|
-
constructor(t,
|
|
3292
|
-
super(), this.key = t, this.data =
|
|
3290
|
+
*/ class An extends Tn {
|
|
3291
|
+
constructor(t, n, e, r, s = []) {
|
|
3292
|
+
super(), this.key = t, this.data = n, this.fieldMask = e, this.precondition = r,
|
|
3293
3293
|
this.fieldTransforms = s, this.type = 1 /* Patch */;
|
|
3294
3294
|
}
|
|
3295
3295
|
}
|
|
3296
3296
|
|
|
3297
|
-
/** A mutation that deletes the document at the given key. */ class
|
|
3298
|
-
constructor(t,
|
|
3299
|
-
super(), this.key = t, this.precondition =
|
|
3297
|
+
/** A mutation that deletes the document at the given key. */ class Rn extends Tn {
|
|
3298
|
+
constructor(t, n) {
|
|
3299
|
+
super(), this.key = t, this.precondition = n, this.type = 2 /* Delete */ , this.fieldTransforms = [];
|
|
3300
3300
|
}
|
|
3301
3301
|
}
|
|
3302
3302
|
|
|
@@ -3306,9 +3306,9 @@ function we(t, e) {
|
|
|
3306
3306
|
*
|
|
3307
3307
|
* The `verify` operation is only used in Transactions, and this class serves
|
|
3308
3308
|
* primarily to facilitate serialization into protos.
|
|
3309
|
-
*/ class
|
|
3310
|
-
constructor(t,
|
|
3311
|
-
super(), this.key = t, this.precondition =
|
|
3309
|
+
*/ class Pn extends Tn {
|
|
3310
|
+
constructor(t, n) {
|
|
3311
|
+
super(), this.key = t, this.precondition = n, this.type = 3 /* Verify */ , this.fieldTransforms = [];
|
|
3312
3312
|
}
|
|
3313
3313
|
}
|
|
3314
3314
|
|
|
@@ -3327,13 +3327,13 @@ function we(t, e) {
|
|
|
3327
3327
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3328
3328
|
* See the License for the specific language governing permissions and
|
|
3329
3329
|
* limitations under the License.
|
|
3330
|
-
*/ const
|
|
3330
|
+
*/ const Vn = (() => {
|
|
3331
3331
|
const t = {
|
|
3332
3332
|
asc: "ASCENDING",
|
|
3333
3333
|
desc: "DESCENDING"
|
|
3334
3334
|
};
|
|
3335
3335
|
return t;
|
|
3336
|
-
})(),
|
|
3336
|
+
})(), Dn = (() => {
|
|
3337
3337
|
const t = {
|
|
3338
3338
|
"<": "LESS_THAN",
|
|
3339
3339
|
"<=": "LESS_THAN_OR_EQUAL",
|
|
@@ -3363,9 +3363,9 @@ function we(t, e) {
|
|
|
3363
3363
|
* TODO(klimt): We can remove the databaseId argument if we keep the full
|
|
3364
3364
|
* resource name in documents.
|
|
3365
3365
|
*/
|
|
3366
|
-
class
|
|
3367
|
-
constructor(t,
|
|
3368
|
-
this.databaseId = t, this.
|
|
3366
|
+
class Nn {
|
|
3367
|
+
constructor(t, n) {
|
|
3368
|
+
this.databaseId = t, this.F = n;
|
|
3369
3369
|
}
|
|
3370
3370
|
}
|
|
3371
3371
|
|
|
@@ -3380,13 +3380,13 @@ class De {
|
|
|
3380
3380
|
/**
|
|
3381
3381
|
* Returns a value for a Date that's appropriate to put into a proto.
|
|
3382
3382
|
*/
|
|
3383
|
-
function
|
|
3384
|
-
if (t.
|
|
3385
|
-
return `${new Date(1e3 *
|
|
3383
|
+
function $n(t, n) {
|
|
3384
|
+
if (t.F) {
|
|
3385
|
+
return `${new Date(1e3 * n.seconds).toISOString().replace(/\.\d*/, "").replace("Z", "")}.${("000000000" + n.nanoseconds).slice(-9)}Z`;
|
|
3386
3386
|
}
|
|
3387
3387
|
return {
|
|
3388
|
-
seconds: "" +
|
|
3389
|
-
nanos:
|
|
3388
|
+
seconds: "" + n.seconds,
|
|
3389
|
+
nanos: n.nanoseconds
|
|
3390
3390
|
};
|
|
3391
3391
|
}
|
|
3392
3392
|
|
|
@@ -3395,202 +3395,202 @@ function Ne(t, e) {
|
|
|
3395
3395
|
*
|
|
3396
3396
|
* Visible for testing.
|
|
3397
3397
|
*/
|
|
3398
|
-
function
|
|
3399
|
-
return t.
|
|
3398
|
+
function Sn(t, n) {
|
|
3399
|
+
return t.F ? n.toBase64() : n.toUint8Array();
|
|
3400
3400
|
}
|
|
3401
3401
|
|
|
3402
|
-
function
|
|
3403
|
-
return
|
|
3402
|
+
function Fn(t, n) {
|
|
3403
|
+
return $n(t, n.toTimestamp());
|
|
3404
3404
|
}
|
|
3405
3405
|
|
|
3406
|
-
function
|
|
3406
|
+
function xn(t) {
|
|
3407
3407
|
return v(!!t), vt.fromTimestamp(function(t) {
|
|
3408
|
-
const
|
|
3409
|
-
return new gt(
|
|
3408
|
+
const n = Rt(t);
|
|
3409
|
+
return new gt(n.seconds, n.nanos);
|
|
3410
3410
|
}(t));
|
|
3411
3411
|
}
|
|
3412
3412
|
|
|
3413
|
-
function
|
|
3413
|
+
function qn(t, n) {
|
|
3414
3414
|
return function(t) {
|
|
3415
3415
|
return new X([ "projects", t.projectId, "databases", t.database ]);
|
|
3416
|
-
}(t).child("documents").child(
|
|
3416
|
+
}(t).child("documents").child(n).canonicalString();
|
|
3417
3417
|
}
|
|
3418
3418
|
|
|
3419
|
-
function
|
|
3420
|
-
return
|
|
3419
|
+
function On(t, n) {
|
|
3420
|
+
return qn(t.databaseId, n.path);
|
|
3421
3421
|
}
|
|
3422
3422
|
|
|
3423
|
-
function
|
|
3424
|
-
const
|
|
3425
|
-
const
|
|
3426
|
-
return v(
|
|
3427
|
-
}(
|
|
3428
|
-
if (
|
|
3429
|
-
if (
|
|
3430
|
-
return new
|
|
3423
|
+
function Cn(t, n) {
|
|
3424
|
+
const e = function(t) {
|
|
3425
|
+
const n = X.fromString(t);
|
|
3426
|
+
return v(Hn(n)), n;
|
|
3427
|
+
}(n);
|
|
3428
|
+
if (e.get(1) !== t.databaseId.projectId) throw new U(A, "Tried to deserialize key from different project: " + e.get(1) + " vs " + t.databaseId.projectId);
|
|
3429
|
+
if (e.get(3) !== t.databaseId.database) throw new U(A, "Tried to deserialize key from different database: " + e.get(3) + " vs " + t.databaseId.database);
|
|
3430
|
+
return new nt((v((r = e).length > 4 && "documents" === r.get(4)), r.popFirst(5)));
|
|
3431
3431
|
var r;
|
|
3432
3432
|
/** Creates a Document proto from key and fields (but no create/update time) */}
|
|
3433
3433
|
|
|
3434
|
-
function
|
|
3435
|
-
return
|
|
3434
|
+
function Ln(t, n) {
|
|
3435
|
+
return qn(t.databaseId, n);
|
|
3436
3436
|
}
|
|
3437
3437
|
|
|
3438
|
-
function
|
|
3438
|
+
function Un(t) {
|
|
3439
3439
|
return new X([ "projects", t.databaseId.projectId, "databases", t.databaseId.database ]).canonicalString();
|
|
3440
3440
|
}
|
|
3441
3441
|
|
|
3442
|
-
function
|
|
3442
|
+
function kn(t, n, e) {
|
|
3443
3443
|
return {
|
|
3444
|
-
name:
|
|
3445
|
-
fields:
|
|
3444
|
+
name: On(t, n),
|
|
3445
|
+
fields: e.value.mapValue.fields
|
|
3446
3446
|
};
|
|
3447
3447
|
}
|
|
3448
3448
|
|
|
3449
|
-
function
|
|
3450
|
-
return "found" in
|
|
3451
|
-
v(!!
|
|
3452
|
-
const
|
|
3449
|
+
function jn(t, n) {
|
|
3450
|
+
return "found" in n ? function(t, n) {
|
|
3451
|
+
v(!!n.found), n.found.name, n.found.updateTime;
|
|
3452
|
+
const e = Cn(t, n.found.name), r = xn(n.found.updateTime), s = new Bt({
|
|
3453
3453
|
mapValue: {
|
|
3454
|
-
fields:
|
|
3454
|
+
fields: n.found.fields
|
|
3455
3455
|
}
|
|
3456
3456
|
});
|
|
3457
|
-
return zt.newFoundDocument(
|
|
3458
|
-
}(t,
|
|
3459
|
-
v(!!
|
|
3460
|
-
const
|
|
3461
|
-
return zt.newNoDocument(
|
|
3462
|
-
}(t,
|
|
3463
|
-
}
|
|
3464
|
-
|
|
3465
|
-
function
|
|
3466
|
-
let
|
|
3467
|
-
if (
|
|
3468
|
-
update:
|
|
3469
|
-
}; else if (
|
|
3470
|
-
delete:
|
|
3471
|
-
}; else if (
|
|
3472
|
-
update:
|
|
3473
|
-
updateMask:
|
|
3457
|
+
return zt.newFoundDocument(e, r, s);
|
|
3458
|
+
}(t, n) : "missing" in n ? function(t, n) {
|
|
3459
|
+
v(!!n.missing), v(!!n.readTime);
|
|
3460
|
+
const e = Cn(t, n.missing), r = xn(n.readTime);
|
|
3461
|
+
return zt.newNoDocument(e, r);
|
|
3462
|
+
}(t, n) : g();
|
|
3463
|
+
}
|
|
3464
|
+
|
|
3465
|
+
function Mn(t, n) {
|
|
3466
|
+
let e;
|
|
3467
|
+
if (n instanceof In) e = {
|
|
3468
|
+
update: kn(t, n.key, n.value)
|
|
3469
|
+
}; else if (n instanceof Rn) e = {
|
|
3470
|
+
delete: On(t, n.key)
|
|
3471
|
+
}; else if (n instanceof An) e = {
|
|
3472
|
+
update: kn(t, n.key, n.data),
|
|
3473
|
+
updateMask: Yn(n.fieldMask)
|
|
3474
3474
|
}; else {
|
|
3475
|
-
if (!(
|
|
3476
|
-
|
|
3477
|
-
verify:
|
|
3475
|
+
if (!(n instanceof Pn)) return g();
|
|
3476
|
+
e = {
|
|
3477
|
+
verify: On(t, n.key)
|
|
3478
3478
|
};
|
|
3479
3479
|
}
|
|
3480
|
-
return
|
|
3481
|
-
const
|
|
3482
|
-
if (
|
|
3483
|
-
fieldPath:
|
|
3480
|
+
return n.fieldTransforms.length > 0 && (e.updateTransforms = n.fieldTransforms.map((t => function(t, n) {
|
|
3481
|
+
const e = n.transform;
|
|
3482
|
+
if (e instanceof yn) return {
|
|
3483
|
+
fieldPath: n.field.canonicalString(),
|
|
3484
3484
|
setToServerValue: "REQUEST_TIME"
|
|
3485
3485
|
};
|
|
3486
|
-
if (
|
|
3487
|
-
fieldPath:
|
|
3486
|
+
if (e instanceof _n) return {
|
|
3487
|
+
fieldPath: n.field.canonicalString(),
|
|
3488
3488
|
appendMissingElements: {
|
|
3489
|
-
values:
|
|
3489
|
+
values: e.elements
|
|
3490
3490
|
}
|
|
3491
3491
|
};
|
|
3492
|
-
if (
|
|
3493
|
-
fieldPath:
|
|
3492
|
+
if (e instanceof gn) return {
|
|
3493
|
+
fieldPath: n.field.canonicalString(),
|
|
3494
3494
|
removeAllFromArray: {
|
|
3495
|
-
values:
|
|
3495
|
+
values: e.elements
|
|
3496
3496
|
}
|
|
3497
3497
|
};
|
|
3498
|
-
if (
|
|
3499
|
-
fieldPath:
|
|
3500
|
-
increment:
|
|
3498
|
+
if (e instanceof vn) return {
|
|
3499
|
+
fieldPath: n.field.canonicalString(),
|
|
3500
|
+
increment: e.O
|
|
3501
3501
|
};
|
|
3502
3502
|
throw g();
|
|
3503
|
-
}(0, t)))),
|
|
3504
|
-
return void 0 !==
|
|
3505
|
-
updateTime:
|
|
3506
|
-
} : void 0 !==
|
|
3507
|
-
exists:
|
|
3503
|
+
}(0, t)))), n.precondition.isNone || (e.currentDocument = function(t, n) {
|
|
3504
|
+
return void 0 !== n.updateTime ? {
|
|
3505
|
+
updateTime: Fn(t, n.updateTime)
|
|
3506
|
+
} : void 0 !== n.exists ? {
|
|
3507
|
+
exists: n.exists
|
|
3508
3508
|
} : g();
|
|
3509
|
-
}(t,
|
|
3509
|
+
}(t, n.precondition)), e;
|
|
3510
3510
|
}
|
|
3511
3511
|
|
|
3512
|
-
function
|
|
3512
|
+
function Bn(t, n) {
|
|
3513
3513
|
// Dissect the path into parent, collectionId, and optional key filter.
|
|
3514
|
-
const
|
|
3514
|
+
const e = {
|
|
3515
3515
|
structuredQuery: {}
|
|
3516
|
-
}, r =
|
|
3517
|
-
null !==
|
|
3518
|
-
collectionId:
|
|
3516
|
+
}, r = n.path;
|
|
3517
|
+
null !== n.collectionGroup ? (e.parent = Ln(t, r), e.structuredQuery.from = [ {
|
|
3518
|
+
collectionId: n.collectionGroup,
|
|
3519
3519
|
allDescendants: !0
|
|
3520
|
-
} ]) : (
|
|
3520
|
+
} ]) : (e.parent = Ln(t, r.popLast()), e.structuredQuery.from = [ {
|
|
3521
3521
|
collectionId: r.lastSegment()
|
|
3522
3522
|
} ]);
|
|
3523
3523
|
const s = function(t) {
|
|
3524
3524
|
if (0 === t.length) return;
|
|
3525
|
-
const
|
|
3525
|
+
const n = t.map((t =>
|
|
3526
3526
|
// visible for testing
|
|
3527
3527
|
function(t) {
|
|
3528
3528
|
if ("==" /* EQUAL */ === t.op) {
|
|
3529
3529
|
if (kt(t.value)) return {
|
|
3530
3530
|
unaryFilter: {
|
|
3531
|
-
field:
|
|
3531
|
+
field: Wn(t.field),
|
|
3532
3532
|
op: "IS_NAN"
|
|
3533
3533
|
}
|
|
3534
3534
|
};
|
|
3535
3535
|
if (Ut(t.value)) return {
|
|
3536
3536
|
unaryFilter: {
|
|
3537
|
-
field:
|
|
3537
|
+
field: Wn(t.field),
|
|
3538
3538
|
op: "IS_NULL"
|
|
3539
3539
|
}
|
|
3540
3540
|
};
|
|
3541
3541
|
} else if ("!=" /* NOT_EQUAL */ === t.op) {
|
|
3542
3542
|
if (kt(t.value)) return {
|
|
3543
3543
|
unaryFilter: {
|
|
3544
|
-
field:
|
|
3544
|
+
field: Wn(t.field),
|
|
3545
3545
|
op: "IS_NOT_NAN"
|
|
3546
3546
|
}
|
|
3547
3547
|
};
|
|
3548
3548
|
if (Ut(t.value)) return {
|
|
3549
3549
|
unaryFilter: {
|
|
3550
|
-
field:
|
|
3550
|
+
field: Wn(t.field),
|
|
3551
3551
|
op: "IS_NOT_NULL"
|
|
3552
3552
|
}
|
|
3553
3553
|
};
|
|
3554
3554
|
}
|
|
3555
3555
|
return {
|
|
3556
3556
|
fieldFilter: {
|
|
3557
|
-
field:
|
|
3558
|
-
op:
|
|
3557
|
+
field: Wn(t.field),
|
|
3558
|
+
op: Qn(t.op),
|
|
3559
3559
|
value: t.value
|
|
3560
3560
|
}
|
|
3561
3561
|
};
|
|
3562
3562
|
}(t)));
|
|
3563
|
-
if (1 ===
|
|
3563
|
+
if (1 === n.length) return n[0];
|
|
3564
3564
|
return {
|
|
3565
3565
|
compositeFilter: {
|
|
3566
3566
|
op: "AND",
|
|
3567
|
-
filters:
|
|
3567
|
+
filters: n
|
|
3568
3568
|
}
|
|
3569
3569
|
};
|
|
3570
|
-
}(
|
|
3571
|
-
s && (
|
|
3570
|
+
}(n.filters);
|
|
3571
|
+
s && (e.structuredQuery.where = s);
|
|
3572
3572
|
const i = function(t) {
|
|
3573
3573
|
if (0 === t.length) return;
|
|
3574
3574
|
return t.map((t =>
|
|
3575
3575
|
// visible for testing
|
|
3576
3576
|
function(t) {
|
|
3577
3577
|
return {
|
|
3578
|
-
field:
|
|
3579
|
-
direction:
|
|
3578
|
+
field: Wn(t.field),
|
|
3579
|
+
direction: Gn(t.dir)
|
|
3580
3580
|
};
|
|
3581
3581
|
}(t)));
|
|
3582
|
-
}(
|
|
3583
|
-
i && (
|
|
3584
|
-
const o = function(t,
|
|
3585
|
-
return t.
|
|
3586
|
-
value:
|
|
3582
|
+
}(n.orderBy);
|
|
3583
|
+
i && (e.structuredQuery.orderBy = i);
|
|
3584
|
+
const o = function(t, n) {
|
|
3585
|
+
return t.F || ct(n) ? n : {
|
|
3586
|
+
value: n
|
|
3587
3587
|
};
|
|
3588
|
-
}(t,
|
|
3589
|
-
return null !== o && (
|
|
3590
|
-
|
|
3588
|
+
}(t, n.limit);
|
|
3589
|
+
return null !== o && (e.structuredQuery.limit = o), n.startAt && (e.structuredQuery.startAt = zn(n.startAt)),
|
|
3590
|
+
n.endAt && (e.structuredQuery.endAt = zn(n.endAt)), e;
|
|
3591
3591
|
}
|
|
3592
3592
|
|
|
3593
|
-
function
|
|
3593
|
+
function zn(t) {
|
|
3594
3594
|
return {
|
|
3595
3595
|
before: t.before,
|
|
3596
3596
|
values: t.position
|
|
@@ -3598,29 +3598,29 @@ function Be(t) {
|
|
|
3598
3598
|
}
|
|
3599
3599
|
|
|
3600
3600
|
// visible for testing
|
|
3601
|
-
function
|
|
3602
|
-
return
|
|
3601
|
+
function Gn(t) {
|
|
3602
|
+
return Vn[t];
|
|
3603
3603
|
}
|
|
3604
3604
|
|
|
3605
3605
|
// visible for testing
|
|
3606
|
-
function
|
|
3607
|
-
return
|
|
3606
|
+
function Qn(t) {
|
|
3607
|
+
return Dn[t];
|
|
3608
3608
|
}
|
|
3609
3609
|
|
|
3610
|
-
function
|
|
3610
|
+
function Wn(t) {
|
|
3611
3611
|
return {
|
|
3612
3612
|
fieldPath: t.canonicalString()
|
|
3613
3613
|
};
|
|
3614
3614
|
}
|
|
3615
3615
|
|
|
3616
|
-
function
|
|
3617
|
-
const
|
|
3618
|
-
return t.fields.forEach((t =>
|
|
3619
|
-
fieldPaths:
|
|
3616
|
+
function Yn(t) {
|
|
3617
|
+
const n = [];
|
|
3618
|
+
return t.fields.forEach((t => n.push(t.canonicalString()))), {
|
|
3619
|
+
fieldPaths: n
|
|
3620
3620
|
};
|
|
3621
3621
|
}
|
|
3622
3622
|
|
|
3623
|
-
function
|
|
3623
|
+
function Hn(t) {
|
|
3624
3624
|
// Resource names have at least 4 components (project ID, database ID)
|
|
3625
3625
|
return t.length >= 4 && "projects" === t.get(0) && "databases" === t.get(2);
|
|
3626
3626
|
}
|
|
@@ -3640,8 +3640,8 @@ function Ye(t) {
|
|
|
3640
3640
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3641
3641
|
* See the License for the specific language governing permissions and
|
|
3642
3642
|
* limitations under the License.
|
|
3643
|
-
*/ function
|
|
3644
|
-
return new
|
|
3643
|
+
*/ function Kn(t) {
|
|
3644
|
+
return new Nn(t, /* useProto3Json= */ !0);
|
|
3645
3645
|
}
|
|
3646
3646
|
|
|
3647
3647
|
/**
|
|
@@ -3669,7 +3669,7 @@ function Ye(t) {
|
|
|
3669
3669
|
* base delay. This prevents clients from accidentally synchronizing their
|
|
3670
3670
|
* delays causing spikes of load to the backend.
|
|
3671
3671
|
*/
|
|
3672
|
-
class
|
|
3672
|
+
class Jn {
|
|
3673
3673
|
constructor(
|
|
3674
3674
|
/**
|
|
3675
3675
|
* The AsyncQueue to run backoff operations on.
|
|
@@ -3678,13 +3678,13 @@ class Ke {
|
|
|
3678
3678
|
/**
|
|
3679
3679
|
* The ID to use when scheduling backoff operations on the AsyncQueue.
|
|
3680
3680
|
*/
|
|
3681
|
-
|
|
3681
|
+
n,
|
|
3682
3682
|
/**
|
|
3683
3683
|
* The initial delay (used as the base delay on the first retry attempt).
|
|
3684
3684
|
* Note that jitter will still be applied, so the actual delay could be as
|
|
3685
3685
|
* little as 0.5*initialDelayMs.
|
|
3686
3686
|
*/
|
|
3687
|
-
|
|
3687
|
+
e = 1e3
|
|
3688
3688
|
/**
|
|
3689
3689
|
* The multiplier to use to determine the extended base delay after each
|
|
3690
3690
|
* attempt.
|
|
@@ -3694,7 +3694,7 @@ class Ke {
|
|
|
3694
3694
|
* Note that jitter will still be applied, so the actual delay could be as
|
|
3695
3695
|
* much as 1.5*maxDelayMs.
|
|
3696
3696
|
*/ , s = 6e4) {
|
|
3697
|
-
this.C = t, this.timerId =
|
|
3697
|
+
this.C = t, this.timerId = n, this.L = e, this.U = r, this.k = s, this.j = 0, this.M = null,
|
|
3698
3698
|
/** The last backoff attempt, as epoch milliseconds. */
|
|
3699
3699
|
this.B = Date.now(), this.reset();
|
|
3700
3700
|
}
|
|
@@ -3722,9 +3722,9 @@ class Ke {
|
|
|
3722
3722
|
this.cancel();
|
|
3723
3723
|
// First schedule using the current base (which may be 0 and should be
|
|
3724
3724
|
// honored as such).
|
|
3725
|
-
const
|
|
3725
|
+
const n = Math.floor(this.j + this.Y()), e = Math.max(0, Date.now() - this.B), r = Math.max(0, n - e);
|
|
3726
3726
|
// Guard against lastAttemptTime being in the future due to a clock change.
|
|
3727
|
-
r > 0 && m("ExponentialBackoff", `Backing off for ${r} ms (base delay: ${this.j} ms, delay with jitter: ${
|
|
3727
|
+
r > 0 && m("ExponentialBackoff", `Backing off for ${r} ms (base delay: ${this.j} ms, delay with jitter: ${n} ms, last attempt: ${e} ms ago)`),
|
|
3728
3728
|
this.M = this.C.enqueueAfterDelay(this.timerId, r, (() => (this.B = Date.now(),
|
|
3729
3729
|
t()))),
|
|
3730
3730
|
// Apply backoff factor to determine next delay and ensure it is within
|
|
@@ -3767,22 +3767,22 @@ class Ke {
|
|
|
3767
3767
|
* An implementation of Datastore that exposes additional state for internal
|
|
3768
3768
|
* consumption.
|
|
3769
3769
|
*/
|
|
3770
|
-
class
|
|
3771
|
-
constructor(t,
|
|
3772
|
-
super(), this.authCredentials = t, this.appCheckCredentials =
|
|
3770
|
+
class Xn extends class {} {
|
|
3771
|
+
constructor(t, n, e, r) {
|
|
3772
|
+
super(), this.authCredentials = t, this.appCheckCredentials = n, this.K = e, this.q = r,
|
|
3773
3773
|
this.J = !1;
|
|
3774
3774
|
}
|
|
3775
3775
|
X() {
|
|
3776
|
-
if (this.J) throw new U(
|
|
3776
|
+
if (this.J) throw new U(S, "The client has already been terminated.");
|
|
3777
3777
|
}
|
|
3778
|
-
/** Invokes the provided RPC with auth and AppCheck tokens. */ m(t,
|
|
3779
|
-
return this.X(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.K.m(t,
|
|
3778
|
+
/** Invokes the provided RPC with auth and AppCheck tokens. */ m(t, n, e) {
|
|
3779
|
+
return this.X(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.K.m(t, n, e, r, s))).catch((t => {
|
|
3780
3780
|
throw "FirebaseError" === t.name ? (t.code === N && (this.authCredentials.invalidateToken(),
|
|
3781
3781
|
this.appCheckCredentials.invalidateToken()), t) : new U(I, t.toString());
|
|
3782
3782
|
}));
|
|
3783
3783
|
}
|
|
3784
|
-
/** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ T(t,
|
|
3785
|
-
return this.X(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.K.T(t,
|
|
3784
|
+
/** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ T(t, n, e) {
|
|
3785
|
+
return this.X(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.K.T(t, n, e, r, s))).catch((t => {
|
|
3786
3786
|
throw "FirebaseError" === t.name ? (t.code === N && (this.authCredentials.invalidateToken(),
|
|
3787
3787
|
this.appCheckCredentials.invalidateToken()), t) : new U(I, t.toString());
|
|
3788
3788
|
}));
|
|
@@ -3794,40 +3794,40 @@ class Je extends class {} {
|
|
|
3794
3794
|
|
|
3795
3795
|
// TODO(firestorexp): Make sure there is only one Datastore instance per
|
|
3796
3796
|
// firestore-exp client.
|
|
3797
|
-
async function
|
|
3798
|
-
const
|
|
3799
|
-
writes:
|
|
3797
|
+
async function Zn(t, n) {
|
|
3798
|
+
const e = b(t), r = Un(e.q) + "/documents", s = {
|
|
3799
|
+
writes: n.map((t => Mn(e.q, t)))
|
|
3800
3800
|
};
|
|
3801
|
-
await
|
|
3801
|
+
await e.m("Commit", r, s);
|
|
3802
3802
|
}
|
|
3803
3803
|
|
|
3804
|
-
async function
|
|
3805
|
-
const
|
|
3806
|
-
documents:
|
|
3807
|
-
}, i = await
|
|
3804
|
+
async function te(t, n) {
|
|
3805
|
+
const e = b(t), r = Un(e.q) + "/documents", s = {
|
|
3806
|
+
documents: n.map((t => On(e.q, t)))
|
|
3807
|
+
}, i = await e.T("BatchGetDocuments", r, s), o = new Map;
|
|
3808
3808
|
i.forEach((t => {
|
|
3809
|
-
const
|
|
3810
|
-
o.set(
|
|
3809
|
+
const n = jn(e.q, t);
|
|
3810
|
+
o.set(n.key.toString(), n);
|
|
3811
3811
|
}));
|
|
3812
3812
|
const u = [];
|
|
3813
|
-
return
|
|
3814
|
-
const
|
|
3815
|
-
v(!!
|
|
3813
|
+
return n.forEach((t => {
|
|
3814
|
+
const n = o.get(t.toString());
|
|
3815
|
+
v(!!n), u.push(n);
|
|
3816
3816
|
})), u;
|
|
3817
3817
|
}
|
|
3818
3818
|
|
|
3819
|
-
async function
|
|
3820
|
-
const
|
|
3821
|
-
return (await
|
|
3819
|
+
async function ne(t, n) {
|
|
3820
|
+
const e = b(t), r = Bn(e.q, dn(n));
|
|
3821
|
+
return (await e.T("RunQuery", r.parent, {
|
|
3822
3822
|
structuredQuery: r.structuredQuery
|
|
3823
|
-
})).filter((t => !!t.document)).map((t => function(t,
|
|
3824
|
-
const r =
|
|
3823
|
+
})).filter((t => !!t.document)).map((t => function(t, n, e) {
|
|
3824
|
+
const r = Cn(t, n.name), s = xn(n.updateTime), i = new Bt({
|
|
3825
3825
|
mapValue: {
|
|
3826
|
-
fields:
|
|
3826
|
+
fields: n.fields
|
|
3827
3827
|
}
|
|
3828
3828
|
}), o = zt.newFoundDocument(r, s, i);
|
|
3829
|
-
return
|
|
3830
|
-
}(
|
|
3829
|
+
return e && o.setHasCommittedMutations(), e ? o.setHasCommittedMutations() : o;
|
|
3830
|
+
}(e.q, t.document, void 0)));
|
|
3831
3831
|
}
|
|
3832
3832
|
|
|
3833
3833
|
/**
|
|
@@ -3845,7 +3845,7 @@ async function tn(t, e) {
|
|
|
3845
3845
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3846
3846
|
* See the License for the specific language governing permissions and
|
|
3847
3847
|
* limitations under the License.
|
|
3848
|
-
*/ const
|
|
3848
|
+
*/ const ee = new Map;
|
|
3849
3849
|
|
|
3850
3850
|
/**
|
|
3851
3851
|
* An instance map that ensures only one Datastore exists per Firestore
|
|
@@ -3856,19 +3856,19 @@ async function tn(t, e) {
|
|
|
3856
3856
|
* instance. Callers must invoke removeComponents() when the Firestore
|
|
3857
3857
|
* instance is terminated.
|
|
3858
3858
|
*/
|
|
3859
|
-
function
|
|
3860
|
-
if (t._terminated) throw new U(
|
|
3861
|
-
if (!
|
|
3859
|
+
function re(t) {
|
|
3860
|
+
if (t._terminated) throw new U(S, "The client has already been terminated.");
|
|
3861
|
+
if (!ee.has(t)) {
|
|
3862
3862
|
m("ComponentProvider", "Initializing Datastore");
|
|
3863
3863
|
const i = function(t) {
|
|
3864
3864
|
return new wt(t, fetch.bind(null));
|
|
3865
|
-
}((
|
|
3866
|
-
new H(
|
|
3867
|
-
return new
|
|
3865
|
+
}((n = t._databaseId, e = t.app.options.appId || "", r = t._persistenceKey, s = t._freezeSettings(),
|
|
3866
|
+
new H(n, e, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), o = Kn(t._databaseId), u = function(t, n, e, r) {
|
|
3867
|
+
return new Xn(t, n, e, r);
|
|
3868
3868
|
}(t._authCredentials, t._appCheckCredentials, i, o);
|
|
3869
|
-
|
|
3869
|
+
ee.set(t, u);
|
|
3870
3870
|
}
|
|
3871
|
-
var
|
|
3871
|
+
var n, e, r, s;
|
|
3872
3872
|
/**
|
|
3873
3873
|
* @license
|
|
3874
3874
|
* Copyright 2018 Google LLC
|
|
@@ -3884,7 +3884,7 @@ function nn(t) {
|
|
|
3884
3884
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3885
3885
|
* See the License for the specific language governing permissions and
|
|
3886
3886
|
* limitations under the License.
|
|
3887
|
-
*/ return
|
|
3887
|
+
*/ return ee.get(t);
|
|
3888
3888
|
}
|
|
3889
3889
|
|
|
3890
3890
|
/**
|
|
@@ -3896,21 +3896,21 @@ function nn(t) {
|
|
|
3896
3896
|
* user-supplied `FirestoreSettings` object. This is a separate type so that
|
|
3897
3897
|
* defaults can be supplied and the value can be checked for equality.
|
|
3898
3898
|
*/
|
|
3899
|
-
class
|
|
3899
|
+
class se {
|
|
3900
3900
|
constructor(t) {
|
|
3901
|
-
var
|
|
3901
|
+
var n;
|
|
3902
3902
|
if (void 0 === t.host) {
|
|
3903
3903
|
if (void 0 !== t.ssl) throw new U(A, "Can't provide ssl option if host option is not set");
|
|
3904
3904
|
this.host = "firestore.googleapis.com", this.ssl = true;
|
|
3905
|
-
} else this.host = t.host, this.ssl = null === (
|
|
3905
|
+
} else this.host = t.host, this.ssl = null === (n = t.ssl) || void 0 === n || n;
|
|
3906
3906
|
if (this.credentials = t.credentials, this.ignoreUndefinedProperties = !!t.ignoreUndefinedProperties,
|
|
3907
3907
|
void 0 === t.cacheSizeBytes) this.cacheSizeBytes = 41943040; else {
|
|
3908
3908
|
if (-1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new U(A, "cacheSizeBytes must be at least 1048576");
|
|
3909
3909
|
this.cacheSizeBytes = t.cacheSizeBytes;
|
|
3910
3910
|
}
|
|
3911
3911
|
this.experimentalForceLongPolling = !!t.experimentalForceLongPolling, this.experimentalAutoDetectLongPolling = !!t.experimentalAutoDetectLongPolling,
|
|
3912
|
-
this.useFetchStreams = !!t.useFetchStreams, function(t,
|
|
3913
|
-
if (!0 ===
|
|
3912
|
+
this.useFetchStreams = !!t.useFetchStreams, function(t, n, e, r) {
|
|
3913
|
+
if (!0 === n && !0 === r) throw new U(A, `${t} and ${e} cannot be used together.`);
|
|
3914
3914
|
}("experimentalForceLongPolling", t.experimentalForceLongPolling, "experimentalAutoDetectLongPolling", t.experimentalAutoDetectLongPolling);
|
|
3915
3915
|
}
|
|
3916
3916
|
isEqual(t) {
|
|
@@ -3938,14 +3938,14 @@ class rn {
|
|
|
3938
3938
|
* The Cloud Firestore service interface.
|
|
3939
3939
|
*
|
|
3940
3940
|
* Do not call this constructor directly. Instead, use {@link getFirestore}.
|
|
3941
|
-
*/ class
|
|
3941
|
+
*/ class ie {
|
|
3942
3942
|
/** @hideconstructor */
|
|
3943
|
-
constructor(t,
|
|
3944
|
-
this._authCredentials =
|
|
3943
|
+
constructor(t, n, e) {
|
|
3944
|
+
this._authCredentials = n, this._appCheckCredentials = e,
|
|
3945
3945
|
/**
|
|
3946
3946
|
* Whether it's a Firestore or Firestore Lite instance.
|
|
3947
3947
|
*/
|
|
3948
|
-
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new
|
|
3948
|
+
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new se({}),
|
|
3949
3949
|
this._settingsFrozen = !1, t instanceof K ? this._databaseId = t : (this._app = t,
|
|
3950
3950
|
this._databaseId = function(t) {
|
|
3951
3951
|
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new U(A, '"projectId" not provided in firebase.initializeApp.');
|
|
@@ -3957,17 +3957,17 @@ class rn {
|
|
|
3957
3957
|
* {@link getFirestore}. If the custom settings are empty, this function is
|
|
3958
3958
|
* equivalent to calling {@link getFirestore}.
|
|
3959
3959
|
*
|
|
3960
|
-
* @param app - The {@link https://www.gstatic.com/firebasejs/9.6.
|
|
3960
|
+
* @param app - The {@link https://www.gstatic.com/firebasejs/9.6.3/firebase-app.js#FirebaseApp} with which the `Firestore` instance will
|
|
3961
3961
|
* be associated.
|
|
3962
3962
|
* @param settings - A settings object to configure the `Firestore` instance.
|
|
3963
3963
|
* @returns A newly initialized `Firestore` instance.
|
|
3964
3964
|
*/ (t));
|
|
3965
3965
|
}
|
|
3966
3966
|
/**
|
|
3967
|
-
* The {@link https://www.gstatic.com/firebasejs/9.6.
|
|
3967
|
+
* The {@link https://www.gstatic.com/firebasejs/9.6.3/firebase-app.js#FirebaseApp} associated with this `Firestore` service
|
|
3968
3968
|
* instance.
|
|
3969
3969
|
*/ get app() {
|
|
3970
|
-
if (!this._app) throw new U(
|
|
3970
|
+
if (!this._app) throw new U(S, "Firestore was not initialized using the Firebase SDK. 'app' is not available");
|
|
3971
3971
|
return this._app;
|
|
3972
3972
|
}
|
|
3973
3973
|
get _initialized() {
|
|
@@ -3977,15 +3977,15 @@ class rn {
|
|
|
3977
3977
|
return void 0 !== this._terminateTask;
|
|
3978
3978
|
}
|
|
3979
3979
|
_setSettings(t) {
|
|
3980
|
-
if (this._settingsFrozen) throw new U(
|
|
3981
|
-
this._settings = new
|
|
3980
|
+
if (this._settingsFrozen) throw new U(S, "Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");
|
|
3981
|
+
this._settings = new se(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
|
|
3982
3982
|
if (!t) return new M;
|
|
3983
3983
|
switch (t.type) {
|
|
3984
3984
|
case "gapi":
|
|
3985
|
-
const
|
|
3985
|
+
const n = t.client;
|
|
3986
3986
|
// Make sure this really is a Gapi client.
|
|
3987
|
-
return v(!("object" != typeof
|
|
3988
|
-
new Q(
|
|
3987
|
+
return v(!("object" != typeof n || null === n || !n.auth || !n.auth.getAuthHeaderValueForFirstParty)),
|
|
3988
|
+
new Q(n, t.sessionIndex || "0", t.iamToken || null);
|
|
3989
3989
|
|
|
3990
3990
|
case "provider":
|
|
3991
3991
|
return t.client;
|
|
@@ -4019,30 +4019,30 @@ class rn {
|
|
|
4019
4019
|
* Only ever called once.
|
|
4020
4020
|
*/ _terminate() {
|
|
4021
4021
|
return function(t) {
|
|
4022
|
-
const
|
|
4023
|
-
|
|
4022
|
+
const n = ee.get(t);
|
|
4023
|
+
n && (m("ComponentProvider", "Removing Datastore"), ee.delete(t), n.terminate());
|
|
4024
4024
|
}(this), Promise.resolve();
|
|
4025
4025
|
}
|
|
4026
4026
|
}
|
|
4027
4027
|
|
|
4028
|
-
function
|
|
4029
|
-
const
|
|
4030
|
-
if (
|
|
4031
|
-
return
|
|
4032
|
-
options:
|
|
4028
|
+
function oe(t, n) {
|
|
4029
|
+
const e = _getProvider(t, "firestore/lite");
|
|
4030
|
+
if (e.isInitialized()) throw new U(S, "Firestore can only be initialized once per app.");
|
|
4031
|
+
return e.initialize({
|
|
4032
|
+
options: n
|
|
4033
4033
|
});
|
|
4034
4034
|
}
|
|
4035
4035
|
|
|
4036
4036
|
/**
|
|
4037
4037
|
* Returns the existing `Firestore` instance that is associated with the
|
|
4038
|
-
* provided {@link https://www.gstatic.com/firebasejs/9.6.
|
|
4038
|
+
* provided {@link https://www.gstatic.com/firebasejs/9.6.3/firebase-app.js#FirebaseApp}. If no instance exists, initializes a new
|
|
4039
4039
|
* instance with default settings.
|
|
4040
4040
|
*
|
|
4041
|
-
* @param app - The {@link https://www.gstatic.com/firebasejs/9.6.
|
|
4041
|
+
* @param app - The {@link https://www.gstatic.com/firebasejs/9.6.3/firebase-app.js#FirebaseApp} instance that the returned `Firestore`
|
|
4042
4042
|
* instance is associated with.
|
|
4043
4043
|
* @returns The `Firestore` instance of the provided app.
|
|
4044
|
-
*/ function
|
|
4045
|
-
return _getProvider(
|
|
4044
|
+
*/ function ue(n = getApp()) {
|
|
4045
|
+
return _getProvider(n, "firestore/lite").getImmediate();
|
|
4046
4046
|
}
|
|
4047
4047
|
|
|
4048
4048
|
/**
|
|
@@ -4057,24 +4057,24 @@ function on(t, e) {
|
|
|
4057
4057
|
* @param port - the emulator port (ex: 9000).
|
|
4058
4058
|
* @param options.mockUserToken - the mock auth token to use for unit testing
|
|
4059
4059
|
* Security Rules.
|
|
4060
|
-
*/ function
|
|
4060
|
+
*/ function ce(t, n, e, r = {}) {
|
|
4061
4061
|
var s;
|
|
4062
|
-
const i = (t = ot(t,
|
|
4063
|
-
if ("firestore.googleapis.com" !== i.host && i.host !==
|
|
4062
|
+
const i = (t = ot(t, ie))._getSettings();
|
|
4063
|
+
if ("firestore.googleapis.com" !== i.host && i.host !== n && y("Host has been set in both settings() and useEmulator(), emulator host will be used"),
|
|
4064
4064
|
t._setSettings(Object.assign(Object.assign({}, i), {
|
|
4065
|
-
host: `${
|
|
4065
|
+
host: `${n}:${e}`,
|
|
4066
4066
|
ssl: !1
|
|
4067
4067
|
})), r.mockUserToken) {
|
|
4068
|
-
let
|
|
4069
|
-
if ("string" == typeof r.mockUserToken)
|
|
4068
|
+
let n, e;
|
|
4069
|
+
if ("string" == typeof r.mockUserToken) n = r.mockUserToken, e = l.MOCK_USER; else {
|
|
4070
4070
|
// Let createMockUserToken validate first (catches common mistakes like
|
|
4071
4071
|
// invalid field "uid" and missing field "sub" / "user_id".)
|
|
4072
|
-
|
|
4072
|
+
n = createMockUserToken(r.mockUserToken, null === (s = t._app) || void 0 === s ? void 0 : s.options.projectId);
|
|
4073
4073
|
const i = r.mockUserToken.sub || r.mockUserToken.user_id;
|
|
4074
4074
|
if (!i) throw new U(A, "mockUserToken must contain 'sub' or 'user_id' field!");
|
|
4075
|
-
|
|
4075
|
+
e = new l(i);
|
|
4076
4076
|
}
|
|
4077
|
-
t._authCredentials = new B(new j(
|
|
4077
|
+
t._authCredentials = new B(new j(n, e));
|
|
4078
4078
|
}
|
|
4079
4079
|
}
|
|
4080
4080
|
|
|
@@ -4097,8 +4097,8 @@ function on(t, e) {
|
|
|
4097
4097
|
* @param firestore - The `Firestore` instance to terminate.
|
|
4098
4098
|
* @returns A `Promise` that is resolved when the instance has been successfully
|
|
4099
4099
|
* terminated.
|
|
4100
|
-
*/ function
|
|
4101
|
-
return t = ot(t,
|
|
4100
|
+
*/ function ae(t) {
|
|
4101
|
+
return t = ot(t, ie), _removeServiceInstance(t.app, "firestore/lite"), t._delete();
|
|
4102
4102
|
}
|
|
4103
4103
|
|
|
4104
4104
|
/**
|
|
@@ -4138,14 +4138,14 @@ function on(t, e) {
|
|
|
4138
4138
|
* and can be used to write, read, or listen to the location. The document at
|
|
4139
4139
|
* the referenced location may or may not exist.
|
|
4140
4140
|
*/
|
|
4141
|
-
class
|
|
4141
|
+
class he {
|
|
4142
4142
|
/** @hideconstructor */
|
|
4143
4143
|
constructor(t,
|
|
4144
4144
|
/**
|
|
4145
4145
|
* If provided, the `FirestoreDataConverter` associated with this instance.
|
|
4146
4146
|
*/
|
|
4147
|
-
|
|
4148
|
-
this.converter =
|
|
4147
|
+
n, e) {
|
|
4148
|
+
this.converter = n, this._key = e,
|
|
4149
4149
|
/** The type of this Firestore reference. */
|
|
4150
4150
|
this.type = "document", this.firestore = t;
|
|
4151
4151
|
}
|
|
@@ -4166,40 +4166,40 @@ class hn {
|
|
|
4166
4166
|
/**
|
|
4167
4167
|
* The collection this `DocumentReference` belongs to.
|
|
4168
4168
|
*/ get parent() {
|
|
4169
|
-
return new
|
|
4169
|
+
return new fe(this.firestore, this.converter, this._key.path.popLast());
|
|
4170
4170
|
}
|
|
4171
4171
|
withConverter(t) {
|
|
4172
|
-
return new
|
|
4172
|
+
return new he(this.firestore, t, this._key);
|
|
4173
4173
|
}
|
|
4174
4174
|
}
|
|
4175
4175
|
|
|
4176
4176
|
/**
|
|
4177
4177
|
* A `Query` refers to a query which you can read or listen to. You can also
|
|
4178
4178
|
* construct refined `Query` objects by adding filters and ordering.
|
|
4179
|
-
*/ class
|
|
4179
|
+
*/ class le {
|
|
4180
4180
|
// This is the lite version of the Query class in the main SDK.
|
|
4181
4181
|
/** @hideconstructor protected */
|
|
4182
4182
|
constructor(t,
|
|
4183
4183
|
/**
|
|
4184
4184
|
* If provided, the `FirestoreDataConverter` associated with this instance.
|
|
4185
4185
|
*/
|
|
4186
|
-
|
|
4187
|
-
this.converter =
|
|
4186
|
+
n, e) {
|
|
4187
|
+
this.converter = n, this._query = e,
|
|
4188
4188
|
/** The type of this Firestore reference. */
|
|
4189
4189
|
this.type = "query", this.firestore = t;
|
|
4190
4190
|
}
|
|
4191
4191
|
withConverter(t) {
|
|
4192
|
-
return new
|
|
4192
|
+
return new le(this.firestore, t, this._query);
|
|
4193
4193
|
}
|
|
4194
4194
|
}
|
|
4195
4195
|
|
|
4196
4196
|
/**
|
|
4197
4197
|
* A `CollectionReference` object can be used for adding documents, getting
|
|
4198
4198
|
* document references, and querying for documents (using {@link query}).
|
|
4199
|
-
*/ class
|
|
4199
|
+
*/ class fe extends le {
|
|
4200
4200
|
/** @hideconstructor */
|
|
4201
|
-
constructor(t,
|
|
4202
|
-
super(t,
|
|
4201
|
+
constructor(t, n, e) {
|
|
4202
|
+
super(t, n, new un(e)), this._path = e,
|
|
4203
4203
|
/** The type of this Firestore reference. */
|
|
4204
4204
|
this.type = "collection";
|
|
4205
4205
|
}
|
|
@@ -4217,23 +4217,23 @@ class hn {
|
|
|
4217
4217
|
* subcollection. If this isn't a subcollection, the reference is null.
|
|
4218
4218
|
*/ get parent() {
|
|
4219
4219
|
const t = this._path.popLast();
|
|
4220
|
-
return t.isEmpty() ? null : new
|
|
4221
|
-
/* converter= */ null, new
|
|
4220
|
+
return t.isEmpty() ? null : new he(this.firestore,
|
|
4221
|
+
/* converter= */ null, new nt(t));
|
|
4222
4222
|
}
|
|
4223
4223
|
withConverter(t) {
|
|
4224
|
-
return new
|
|
4224
|
+
return new fe(this.firestore, t, this._path);
|
|
4225
4225
|
}
|
|
4226
4226
|
}
|
|
4227
4227
|
|
|
4228
|
-
function
|
|
4229
|
-
if (t = getModularInstance(t),
|
|
4230
|
-
const r = X.fromString(
|
|
4231
|
-
return st(r), new
|
|
4228
|
+
function de(t, n, ...e) {
|
|
4229
|
+
if (t = getModularInstance(t), et("collection", "path", n), t instanceof ie) {
|
|
4230
|
+
const r = X.fromString(n, ...e);
|
|
4231
|
+
return st(r), new fe(t, /* converter= */ null, r);
|
|
4232
4232
|
}
|
|
4233
4233
|
{
|
|
4234
|
-
if (!(t instanceof
|
|
4235
|
-
const r = t._path.child(X.fromString(
|
|
4236
|
-
return st(r), new
|
|
4234
|
+
if (!(t instanceof he || t instanceof fe)) throw new U(A, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
4235
|
+
const r = t._path.child(X.fromString(n, ...e));
|
|
4236
|
+
return st(r), new fe(t.firestore,
|
|
4237
4237
|
/* converter= */ null, r);
|
|
4238
4238
|
}
|
|
4239
4239
|
}
|
|
@@ -4250,32 +4250,32 @@ function dn(t, e, ...n) {
|
|
|
4250
4250
|
* collection or subcollection with this ID as the last segment of its path
|
|
4251
4251
|
* will be included. Cannot contain a slash.
|
|
4252
4252
|
* @returns The created `Query`.
|
|
4253
|
-
*/ function
|
|
4254
|
-
if (t = ot(t,
|
|
4255
|
-
return new
|
|
4253
|
+
*/ function we(t, n) {
|
|
4254
|
+
if (t = ot(t, ie), et("collectionGroup", "collection id", n), n.indexOf("/") >= 0) throw new U(A, `Invalid collection ID '${n}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
|
|
4255
|
+
return new le(t,
|
|
4256
4256
|
/* converter= */ null,
|
|
4257
4257
|
/**
|
|
4258
4258
|
* Creates a new Query for a collection group query that matches all documents
|
|
4259
4259
|
* within the provided collection group.
|
|
4260
4260
|
*/
|
|
4261
4261
|
function(t) {
|
|
4262
|
-
return new
|
|
4263
|
-
}(
|
|
4262
|
+
return new un(X.emptyPath(), t);
|
|
4263
|
+
}(n));
|
|
4264
4264
|
}
|
|
4265
4265
|
|
|
4266
|
-
function
|
|
4266
|
+
function me(t, n, ...e) {
|
|
4267
4267
|
if (t = getModularInstance(t),
|
|
4268
4268
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
4269
4269
|
// 'undefined' and 'null'.
|
|
4270
|
-
1 === arguments.length && (
|
|
4271
|
-
const r = X.fromString(
|
|
4272
|
-
return rt(r), new
|
|
4273
|
-
/* converter= */ null, new
|
|
4270
|
+
1 === arguments.length && (n = pt.R()), et("doc", "path", n), t instanceof ie) {
|
|
4271
|
+
const r = X.fromString(n, ...e);
|
|
4272
|
+
return rt(r), new he(t,
|
|
4273
|
+
/* converter= */ null, new nt(r));
|
|
4274
4274
|
}
|
|
4275
4275
|
{
|
|
4276
|
-
if (!(t instanceof
|
|
4277
|
-
const r = t._path.child(X.fromString(
|
|
4278
|
-
return rt(r), new
|
|
4276
|
+
if (!(t instanceof he || t instanceof fe)) throw new U(A, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
4277
|
+
const r = t._path.child(X.fromString(n, ...e));
|
|
4278
|
+
return rt(r), new he(t.firestore, t instanceof fe ? t.converter : null, new nt(r));
|
|
4279
4279
|
}
|
|
4280
4280
|
}
|
|
4281
4281
|
|
|
@@ -4286,8 +4286,8 @@ function mn(t, e, ...n) {
|
|
|
4286
4286
|
* @param right - A reference to compare.
|
|
4287
4287
|
* @returns true if the references point to the same location in the same
|
|
4288
4288
|
* Firestore database.
|
|
4289
|
-
*/ function
|
|
4290
|
-
return t = getModularInstance(t),
|
|
4289
|
+
*/ function pe(t, n) {
|
|
4290
|
+
return t = getModularInstance(t), n = getModularInstance(n), (t instanceof he || t instanceof fe) && (n instanceof he || n instanceof fe) && (t.firestore === n.firestore && t.path === n.path && t.converter === n.converter);
|
|
4291
4291
|
}
|
|
4292
4292
|
|
|
4293
4293
|
/**
|
|
@@ -4298,8 +4298,8 @@ function mn(t, e, ...n) {
|
|
|
4298
4298
|
* @param right - A `Query` to compare.
|
|
4299
4299
|
* @returns true if the references point to the same location in the same
|
|
4300
4300
|
* Firestore database.
|
|
4301
|
-
*/ function
|
|
4302
|
-
return t = getModularInstance(t),
|
|
4301
|
+
*/ function ye(t, n) {
|
|
4302
|
+
return t = getModularInstance(t), n = getModularInstance(n), t instanceof le && n instanceof le && (t.firestore === n.firestore && wn(t._query, n._query) && t.converter === n.converter);
|
|
4303
4303
|
}
|
|
4304
4304
|
|
|
4305
4305
|
/**
|
|
@@ -4325,7 +4325,7 @@ function mn(t, e, ...n) {
|
|
|
4325
4325
|
*
|
|
4326
4326
|
* Create a `FieldPath` by providing field names. If more than one field
|
|
4327
4327
|
* name is provided, the path will point to a nested field in a document.
|
|
4328
|
-
*/ class
|
|
4328
|
+
*/ class _e {
|
|
4329
4329
|
/**
|
|
4330
4330
|
* Creates a `FieldPath` from the provided field names. If more than one field
|
|
4331
4331
|
* name is provided, the path will point to a nested field in a document.
|
|
@@ -4333,7 +4333,7 @@ function mn(t, e, ...n) {
|
|
|
4333
4333
|
* @param fieldNames - A list of field names.
|
|
4334
4334
|
*/
|
|
4335
4335
|
constructor(...t) {
|
|
4336
|
-
for (let
|
|
4336
|
+
for (let n = 0; n < t.length; ++n) if (0 === t[n].length) throw new U(A, "Invalid field name at argument $(i + 1). Field names must not be empty.");
|
|
4337
4337
|
this._internalPath = new tt(t);
|
|
4338
4338
|
}
|
|
4339
4339
|
/**
|
|
@@ -4349,8 +4349,8 @@ function mn(t, e, ...n) {
|
|
|
4349
4349
|
/**
|
|
4350
4350
|
* Returns a special sentinel `FieldPath` to refer to the ID of a document.
|
|
4351
4351
|
* It can be used in queries to sort or filter by the document ID.
|
|
4352
|
-
*/ function
|
|
4353
|
-
return new
|
|
4352
|
+
*/ function ge() {
|
|
4353
|
+
return new _e("__name__");
|
|
4354
4354
|
}
|
|
4355
4355
|
|
|
4356
4356
|
/**
|
|
@@ -4371,7 +4371,7 @@ function mn(t, e, ...n) {
|
|
|
4371
4371
|
*/
|
|
4372
4372
|
/**
|
|
4373
4373
|
* An immutable object representing an array of bytes.
|
|
4374
|
-
*/ class
|
|
4374
|
+
*/ class ve {
|
|
4375
4375
|
/** @hideconstructor */
|
|
4376
4376
|
constructor(t) {
|
|
4377
4377
|
this._byteString = t;
|
|
@@ -4383,7 +4383,7 @@ function mn(t, e, ...n) {
|
|
|
4383
4383
|
* @param base64 - The Base64 string used to create the `Bytes` object.
|
|
4384
4384
|
*/ static fromBase64String(t) {
|
|
4385
4385
|
try {
|
|
4386
|
-
return new
|
|
4386
|
+
return new ve(It.fromBase64String(t));
|
|
4387
4387
|
} catch (t) {
|
|
4388
4388
|
throw new U(A, "Failed to construct data from Base64 string: " + t);
|
|
4389
4389
|
}
|
|
@@ -4393,7 +4393,7 @@ function mn(t, e, ...n) {
|
|
|
4393
4393
|
*
|
|
4394
4394
|
* @param array - The Uint8Array used to create the `Bytes` object.
|
|
4395
4395
|
*/ static fromUint8Array(t) {
|
|
4396
|
-
return new
|
|
4396
|
+
return new ve(It.fromUint8Array(t));
|
|
4397
4397
|
}
|
|
4398
4398
|
/**
|
|
4399
4399
|
* Returns the underlying bytes as a Base64-encoded string.
|
|
@@ -4445,7 +4445,7 @@ function mn(t, e, ...n) {
|
|
|
4445
4445
|
/**
|
|
4446
4446
|
* Sentinel values that can be used when writing document fields with `set()`
|
|
4447
4447
|
* or `update()`.
|
|
4448
|
-
*/ class
|
|
4448
|
+
*/ class be {
|
|
4449
4449
|
/**
|
|
4450
4450
|
* @param _methodName - The public API endpoint that returns this class.
|
|
4451
4451
|
* @hideconstructor
|
|
@@ -4477,17 +4477,17 @@ function mn(t, e, ...n) {
|
|
|
4477
4477
|
*
|
|
4478
4478
|
* Latitude values are in the range of [-90, 90].
|
|
4479
4479
|
* Longitude values are in the range of [-180, 180].
|
|
4480
|
-
*/ class
|
|
4480
|
+
*/ class Ee {
|
|
4481
4481
|
/**
|
|
4482
4482
|
* Creates a new immutable `GeoPoint` object with the provided latitude and
|
|
4483
4483
|
* longitude values.
|
|
4484
4484
|
* @param latitude - The latitude as number between -90 and 90.
|
|
4485
4485
|
* @param longitude - The longitude as number between -180 and 180.
|
|
4486
4486
|
*/
|
|
4487
|
-
constructor(t,
|
|
4487
|
+
constructor(t, n) {
|
|
4488
4488
|
if (!isFinite(t) || t < -90 || t > 90) throw new U(A, "Latitude must be a number between -90 and 90, but was: " + t);
|
|
4489
|
-
if (!isFinite(
|
|
4490
|
-
this._lat = t, this._long =
|
|
4489
|
+
if (!isFinite(n) || n < -180 || n > 180) throw new U(A, "Longitude must be a number between -180 and 180, but was: " + n);
|
|
4490
|
+
this._lat = t, this._long = n;
|
|
4491
4491
|
}
|
|
4492
4492
|
/**
|
|
4493
4493
|
* The latitude of this `GeoPoint` instance.
|
|
@@ -4536,29 +4536,29 @@ function mn(t, e, ...n) {
|
|
|
4536
4536
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4537
4537
|
* See the License for the specific language governing permissions and
|
|
4538
4538
|
* limitations under the License.
|
|
4539
|
-
*/ const
|
|
4539
|
+
*/ const Te = /^__.*__$/;
|
|
4540
4540
|
|
|
4541
|
-
/** The result of parsing document data (e.g. for a setData call). */ class
|
|
4542
|
-
constructor(t,
|
|
4543
|
-
this.data = t, this.fieldMask =
|
|
4541
|
+
/** The result of parsing document data (e.g. for a setData call). */ class Ie {
|
|
4542
|
+
constructor(t, n, e) {
|
|
4543
|
+
this.data = t, this.fieldMask = n, this.fieldTransforms = e;
|
|
4544
4544
|
}
|
|
4545
|
-
toMutation(t,
|
|
4546
|
-
return null !== this.fieldMask ? new
|
|
4545
|
+
toMutation(t, n) {
|
|
4546
|
+
return null !== this.fieldMask ? new An(t, this.data, this.fieldMask, n, this.fieldTransforms) : new In(t, this.data, n, this.fieldTransforms);
|
|
4547
4547
|
}
|
|
4548
4548
|
}
|
|
4549
4549
|
|
|
4550
|
-
/** The result of parsing "update" data (i.e. for an updateData call). */ class
|
|
4550
|
+
/** The result of parsing "update" data (i.e. for an updateData call). */ class Ae {
|
|
4551
4551
|
constructor(t,
|
|
4552
4552
|
// The fieldMask does not include document transforms.
|
|
4553
|
-
|
|
4554
|
-
this.data = t, this.fieldMask =
|
|
4553
|
+
n, e) {
|
|
4554
|
+
this.data = t, this.fieldMask = n, this.fieldTransforms = e;
|
|
4555
4555
|
}
|
|
4556
|
-
toMutation(t,
|
|
4557
|
-
return new
|
|
4556
|
+
toMutation(t, n) {
|
|
4557
|
+
return new An(t, this.data, this.fieldMask, n, this.fieldTransforms);
|
|
4558
4558
|
}
|
|
4559
4559
|
}
|
|
4560
4560
|
|
|
4561
|
-
function
|
|
4561
|
+
function Re(t) {
|
|
4562
4562
|
switch (t) {
|
|
4563
4563
|
case 0 /* Set */ :
|
|
4564
4564
|
// fall through
|
|
@@ -4576,7 +4576,7 @@ function Pn(t) {
|
|
|
4576
4576
|
}
|
|
4577
4577
|
}
|
|
4578
4578
|
|
|
4579
|
-
/** A "context" object passed around while parsing user data. */ class
|
|
4579
|
+
/** A "context" object passed around while parsing user data. */ class Pe {
|
|
4580
4580
|
/**
|
|
4581
4581
|
* Initializes a ParseContext with the given source and path.
|
|
4582
4582
|
*
|
|
@@ -4595,8 +4595,8 @@ function Pn(t) {
|
|
|
4595
4595
|
* which case certain features will not work and errors will be somewhat
|
|
4596
4596
|
* compromised).
|
|
4597
4597
|
*/
|
|
4598
|
-
constructor(t,
|
|
4599
|
-
this.settings = t, this.databaseId =
|
|
4598
|
+
constructor(t, n, e, r, s, i) {
|
|
4599
|
+
this.settings = t, this.databaseId = n, this.q = e, this.ignoreUndefinedProperties = r,
|
|
4600
4600
|
// Minor hack: If fieldTransforms is undefined, we assume this is an
|
|
4601
4601
|
// external call and we need to validate the entire path.
|
|
4602
4602
|
void 0 === s && this.Z(), this.fieldTransforms = s || [], this.fieldMask = i || [];
|
|
@@ -4607,21 +4607,21 @@ function Pn(t) {
|
|
|
4607
4607
|
get tt() {
|
|
4608
4608
|
return this.settings.tt;
|
|
4609
4609
|
}
|
|
4610
|
-
/** Returns a new context with the specified settings overwritten. */
|
|
4611
|
-
return new
|
|
4610
|
+
/** Returns a new context with the specified settings overwritten. */ nt(t) {
|
|
4611
|
+
return new Pe(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.q, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
|
|
4612
4612
|
}
|
|
4613
|
-
|
|
4614
|
-
var
|
|
4615
|
-
const
|
|
4616
|
-
path:
|
|
4613
|
+
et(t) {
|
|
4614
|
+
var n;
|
|
4615
|
+
const e = null === (n = this.path) || void 0 === n ? void 0 : n.child(t), r = this.nt({
|
|
4616
|
+
path: e,
|
|
4617
4617
|
rt: !1
|
|
4618
4618
|
});
|
|
4619
4619
|
return r.st(t), r;
|
|
4620
4620
|
}
|
|
4621
4621
|
it(t) {
|
|
4622
|
-
var
|
|
4623
|
-
const
|
|
4624
|
-
path:
|
|
4622
|
+
var n;
|
|
4623
|
+
const e = null === (n = this.path) || void 0 === n ? void 0 : n.child(t), r = this.nt({
|
|
4624
|
+
path: e,
|
|
4625
4625
|
rt: !1
|
|
4626
4626
|
});
|
|
4627
4627
|
return r.Z(), r;
|
|
@@ -4629,16 +4629,16 @@ function Pn(t) {
|
|
|
4629
4629
|
ot(t) {
|
|
4630
4630
|
// TODO(b/34871131): We don't support array paths right now; so make path
|
|
4631
4631
|
// undefined.
|
|
4632
|
-
return this.
|
|
4632
|
+
return this.nt({
|
|
4633
4633
|
path: void 0,
|
|
4634
4634
|
rt: !0
|
|
4635
4635
|
});
|
|
4636
4636
|
}
|
|
4637
4637
|
ut(t) {
|
|
4638
|
-
return
|
|
4638
|
+
return We(t, this.settings.methodName, this.settings.ct || !1, this.path, this.settings.at);
|
|
4639
4639
|
}
|
|
4640
4640
|
/** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
|
|
4641
|
-
return void 0 !== this.fieldMask.find((
|
|
4641
|
+
return void 0 !== this.fieldMask.find((n => t.isPrefixOf(n))) || void 0 !== this.fieldTransforms.find((n => t.isPrefixOf(n.field)));
|
|
4642
4642
|
}
|
|
4643
4643
|
Z() {
|
|
4644
4644
|
// TODO(b/34871131): Remove null check once we have proper paths for fields
|
|
@@ -4647,22 +4647,22 @@ function Pn(t) {
|
|
|
4647
4647
|
}
|
|
4648
4648
|
st(t) {
|
|
4649
4649
|
if (0 === t.length) throw this.ut("Document fields must not be empty");
|
|
4650
|
-
if (
|
|
4650
|
+
if (Re(this.tt) && Te.test(t)) throw this.ut('Document fields cannot begin and end with "__"');
|
|
4651
4651
|
}
|
|
4652
4652
|
}
|
|
4653
4653
|
|
|
4654
4654
|
/**
|
|
4655
4655
|
* Helper for parsing raw user input (provided via the API) into internal model
|
|
4656
4656
|
* classes.
|
|
4657
|
-
*/ class
|
|
4658
|
-
constructor(t,
|
|
4659
|
-
this.databaseId = t, this.ignoreUndefinedProperties =
|
|
4657
|
+
*/ class Ve {
|
|
4658
|
+
constructor(t, n, e) {
|
|
4659
|
+
this.databaseId = t, this.ignoreUndefinedProperties = n, this.q = e || Kn(t);
|
|
4660
4660
|
}
|
|
4661
|
-
/** Creates a new top-level parse context. */ ht(t,
|
|
4662
|
-
return new
|
|
4661
|
+
/** Creates a new top-level parse context. */ ht(t, n, e, r = !1) {
|
|
4662
|
+
return new Pe({
|
|
4663
4663
|
tt: t,
|
|
4664
|
-
methodName:
|
|
4665
|
-
at:
|
|
4664
|
+
methodName: n,
|
|
4665
|
+
at: e,
|
|
4666
4666
|
path: tt.emptyPath(),
|
|
4667
4667
|
rt: !1,
|
|
4668
4668
|
ct: r
|
|
@@ -4670,29 +4670,29 @@ function Pn(t) {
|
|
|
4670
4670
|
}
|
|
4671
4671
|
}
|
|
4672
4672
|
|
|
4673
|
-
function
|
|
4674
|
-
const
|
|
4675
|
-
return new
|
|
4673
|
+
function De(t) {
|
|
4674
|
+
const n = t._freezeSettings(), e = Kn(t._databaseId);
|
|
4675
|
+
return new Ve(t._databaseId, !!n.ignoreUndefinedProperties, e);
|
|
4676
4676
|
}
|
|
4677
4677
|
|
|
4678
|
-
/** Parse document data from a set() call. */ function
|
|
4679
|
-
const o = t.ht(i.merge || i.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ ,
|
|
4680
|
-
|
|
4681
|
-
const u =
|
|
4678
|
+
/** Parse document data from a set() call. */ function Ne(t, n, e, r, s, i = {}) {
|
|
4679
|
+
const o = t.ht(i.merge || i.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , n, e, s);
|
|
4680
|
+
Be("Data must be an object, but it was:", o, r);
|
|
4681
|
+
const u = je(r, o);
|
|
4682
4682
|
let c, a;
|
|
4683
4683
|
if (i.merge) c = new Tt(o.fieldMask), a = o.fieldTransforms; else if (i.mergeFields) {
|
|
4684
4684
|
const t = [];
|
|
4685
4685
|
for (const r of i.mergeFields) {
|
|
4686
|
-
const s =
|
|
4686
|
+
const s = ze(n, r, e);
|
|
4687
4687
|
if (!o.contains(s)) throw new U(A, `Field '${s}' is specified in your field mask but missing from your input data.`);
|
|
4688
|
-
|
|
4688
|
+
Ye(t, s) || t.push(s);
|
|
4689
4689
|
}
|
|
4690
4690
|
c = new Tt(t), a = o.fieldTransforms.filter((t => c.covers(t.field)));
|
|
4691
4691
|
} else c = null, a = o.fieldTransforms;
|
|
4692
|
-
return new
|
|
4692
|
+
return new Ie(new Bt(u), c, a);
|
|
4693
4693
|
}
|
|
4694
4694
|
|
|
4695
|
-
class $
|
|
4695
|
+
class $e extends be {
|
|
4696
4696
|
_toFieldTransform(t) {
|
|
4697
4697
|
if (2 /* MergeSet */ !== t.tt) throw 1 /* Update */ === t.tt ? t.ut(`${this._methodName}() can only appear at the top level of your update data`) : t.ut(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);
|
|
4698
4698
|
// No transform to add for a delete, but we need to add it to our
|
|
@@ -4700,7 +4700,7 @@ class $n extends bn {
|
|
|
4700
4700
|
return t.fieldMask.push(t.path), null;
|
|
4701
4701
|
}
|
|
4702
4702
|
isEqual(t) {
|
|
4703
|
-
return t instanceof $
|
|
4703
|
+
return t instanceof $e;
|
|
4704
4704
|
}
|
|
4705
4705
|
}
|
|
4706
4706
|
|
|
@@ -4719,32 +4719,32 @@ class $n extends bn {
|
|
|
4719
4719
|
* context.
|
|
4720
4720
|
* @param context - The parent context.
|
|
4721
4721
|
* @param arrayElement - Whether or not the FieldValue has an array.
|
|
4722
|
-
*/ function
|
|
4723
|
-
return new
|
|
4722
|
+
*/ function Se(t, n, e) {
|
|
4723
|
+
return new Pe({
|
|
4724
4724
|
tt: 3 /* Argument */ ,
|
|
4725
|
-
at:
|
|
4725
|
+
at: n.settings.at,
|
|
4726
4726
|
methodName: t._methodName,
|
|
4727
|
-
rt:
|
|
4728
|
-
},
|
|
4727
|
+
rt: e
|
|
4728
|
+
}, n.databaseId, n.q, n.ignoreUndefinedProperties);
|
|
4729
4729
|
}
|
|
4730
4730
|
|
|
4731
|
-
class
|
|
4731
|
+
class Fe extends be {
|
|
4732
4732
|
_toFieldTransform(t) {
|
|
4733
|
-
return new
|
|
4733
|
+
return new bn(t.path, new yn);
|
|
4734
4734
|
}
|
|
4735
4735
|
isEqual(t) {
|
|
4736
|
-
return t instanceof
|
|
4736
|
+
return t instanceof Fe;
|
|
4737
4737
|
}
|
|
4738
4738
|
}
|
|
4739
4739
|
|
|
4740
|
-
class
|
|
4741
|
-
constructor(t,
|
|
4742
|
-
super(t), this.lt =
|
|
4740
|
+
class xe extends be {
|
|
4741
|
+
constructor(t, n) {
|
|
4742
|
+
super(t), this.lt = n;
|
|
4743
4743
|
}
|
|
4744
4744
|
_toFieldTransform(t) {
|
|
4745
|
-
const
|
|
4746
|
-
/*array=*/ !0),
|
|
4747
|
-
return new
|
|
4745
|
+
const n = Se(this, t,
|
|
4746
|
+
/*array=*/ !0), e = this.lt.map((t => ke(t, n))), r = new _n(e);
|
|
4747
|
+
return new bn(t.path, r);
|
|
4748
4748
|
}
|
|
4749
4749
|
isEqual(t) {
|
|
4750
4750
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4752,14 +4752,14 @@ class xn extends bn {
|
|
|
4752
4752
|
}
|
|
4753
4753
|
}
|
|
4754
4754
|
|
|
4755
|
-
class
|
|
4756
|
-
constructor(t,
|
|
4757
|
-
super(t), this.lt =
|
|
4755
|
+
class qe extends be {
|
|
4756
|
+
constructor(t, n) {
|
|
4757
|
+
super(t), this.lt = n;
|
|
4758
4758
|
}
|
|
4759
4759
|
_toFieldTransform(t) {
|
|
4760
|
-
const
|
|
4761
|
-
/*array=*/ !0),
|
|
4762
|
-
return new
|
|
4760
|
+
const n = Se(this, t,
|
|
4761
|
+
/*array=*/ !0), e = this.lt.map((t => ke(t, n))), r = new gn(e);
|
|
4762
|
+
return new bn(t.path, r);
|
|
4763
4763
|
}
|
|
4764
4764
|
isEqual(t) {
|
|
4765
4765
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4767,13 +4767,13 @@ class qn extends bn {
|
|
|
4767
4767
|
}
|
|
4768
4768
|
}
|
|
4769
4769
|
|
|
4770
|
-
class
|
|
4771
|
-
constructor(t,
|
|
4772
|
-
super(t), this.ft =
|
|
4770
|
+
class Oe extends be {
|
|
4771
|
+
constructor(t, n) {
|
|
4772
|
+
super(t), this.ft = n;
|
|
4773
4773
|
}
|
|
4774
4774
|
_toFieldTransform(t) {
|
|
4775
|
-
const
|
|
4776
|
-
return new
|
|
4775
|
+
const n = new vn(t.q, mn(t.q, this.ft));
|
|
4776
|
+
return new bn(t.path, n);
|
|
4777
4777
|
}
|
|
4778
4778
|
isEqual(t) {
|
|
4779
4779
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4781,50 +4781,50 @@ class On extends bn {
|
|
|
4781
4781
|
}
|
|
4782
4782
|
}
|
|
4783
4783
|
|
|
4784
|
-
/** Parse update data from an update() call. */ function
|
|
4785
|
-
const s = t.ht(1 /* Update */ ,
|
|
4786
|
-
|
|
4784
|
+
/** Parse update data from an update() call. */ function Ce(t, n, e, r) {
|
|
4785
|
+
const s = t.ht(1 /* Update */ , n, e);
|
|
4786
|
+
Be("Data must be an object, but it was:", s, r);
|
|
4787
4787
|
const i = [], o = Bt.empty();
|
|
4788
4788
|
Et(r, ((t, r) => {
|
|
4789
|
-
const u =
|
|
4789
|
+
const u = Qe(n, t, e);
|
|
4790
4790
|
// For Compat types, we have to "extract" the underlying types before
|
|
4791
4791
|
// performing validation.
|
|
4792
4792
|
r = getModularInstance(r);
|
|
4793
4793
|
const c = s.it(u);
|
|
4794
|
-
if (r instanceof $
|
|
4794
|
+
if (r instanceof $e)
|
|
4795
4795
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4796
4796
|
i.push(u); else {
|
|
4797
|
-
const t =
|
|
4797
|
+
const t = ke(r, c);
|
|
4798
4798
|
null != t && (i.push(u), o.set(u, t));
|
|
4799
4799
|
}
|
|
4800
4800
|
}));
|
|
4801
4801
|
const u = new Tt(i);
|
|
4802
|
-
return new
|
|
4802
|
+
return new Ae(o, u, s.fieldTransforms);
|
|
4803
4803
|
}
|
|
4804
4804
|
|
|
4805
|
-
/** Parse update data from a list of field/value arguments. */ function
|
|
4806
|
-
const o = t.ht(1 /* Update */ ,
|
|
4807
|
-
if (i.length % 2 != 0) throw new U(A, `Function ${
|
|
4808
|
-
for (let t = 0; t < i.length; t += 2) u.push(
|
|
4805
|
+
/** Parse update data from a list of field/value arguments. */ function Le(t, n, e, r, s, i) {
|
|
4806
|
+
const o = t.ht(1 /* Update */ , n, e), u = [ ze(n, r, e) ], c = [ s ];
|
|
4807
|
+
if (i.length % 2 != 0) throw new U(A, `Function ${n}() needs to be called with an even number of arguments that alternate between field names and values.`);
|
|
4808
|
+
for (let t = 0; t < i.length; t += 2) u.push(ze(n, i[t])), c.push(i[t + 1]);
|
|
4809
4809
|
const a = [], l = Bt.empty();
|
|
4810
4810
|
// We iterate in reverse order to pick the last value for a field if the
|
|
4811
4811
|
// user specified the field multiple times.
|
|
4812
|
-
for (let t = u.length - 1; t >= 0; --t) if (!
|
|
4813
|
-
const
|
|
4814
|
-
let
|
|
4812
|
+
for (let t = u.length - 1; t >= 0; --t) if (!Ye(a, u[t])) {
|
|
4813
|
+
const n = u[t];
|
|
4814
|
+
let e = c[t];
|
|
4815
4815
|
// For Compat types, we have to "extract" the underlying types before
|
|
4816
4816
|
// performing validation.
|
|
4817
|
-
|
|
4818
|
-
const r = o.it(
|
|
4819
|
-
if (
|
|
4817
|
+
e = getModularInstance(e);
|
|
4818
|
+
const r = o.it(n);
|
|
4819
|
+
if (e instanceof $e)
|
|
4820
4820
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4821
|
-
a.push(
|
|
4822
|
-
const t =
|
|
4823
|
-
null != t && (a.push(
|
|
4821
|
+
a.push(n); else {
|
|
4822
|
+
const t = ke(e, r);
|
|
4823
|
+
null != t && (a.push(n), l.set(n, t));
|
|
4824
4824
|
}
|
|
4825
4825
|
}
|
|
4826
4826
|
const f = new Tt(a);
|
|
4827
|
-
return new
|
|
4827
|
+
return new Ae(l, f, o.fieldTransforms);
|
|
4828
4828
|
}
|
|
4829
4829
|
|
|
4830
4830
|
/**
|
|
@@ -4833,8 +4833,8 @@ class On extends bn {
|
|
|
4833
4833
|
*
|
|
4834
4834
|
* @param allowArrays - Whether the query value is an array that may directly
|
|
4835
4835
|
* contain additional arrays (e.g. the operand of an `in` query).
|
|
4836
|
-
*/ function
|
|
4837
|
-
return
|
|
4836
|
+
*/ function Ue(t, n, e, r = !1) {
|
|
4837
|
+
return ke(e, t.ht(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , n));
|
|
4838
4838
|
}
|
|
4839
4839
|
|
|
4840
4840
|
/**
|
|
@@ -4845,13 +4845,13 @@ class On extends bn {
|
|
|
4845
4845
|
* the source of the data being parsed, etc.
|
|
4846
4846
|
* @returns The parsed value, or null if the value was a FieldValue sentinel
|
|
4847
4847
|
* that should not be included in the resulting parsed data.
|
|
4848
|
-
*/ function
|
|
4849
|
-
if (
|
|
4848
|
+
*/ function ke(t, n) {
|
|
4849
|
+
if (Me(
|
|
4850
4850
|
// Unwrap the API type from the Compat SDK. This will return the API type
|
|
4851
4851
|
// from firestore-exp.
|
|
4852
|
-
t = getModularInstance(t))) return
|
|
4853
|
-
if (t instanceof
|
|
4854
|
-
// FieldValues usually parse into transforms (except
|
|
4852
|
+
t = getModularInstance(t))) return Be("Unsupported field value:", n, t), je(t, n);
|
|
4853
|
+
if (t instanceof be)
|
|
4854
|
+
// FieldValues usually parse into transforms (except deleteField())
|
|
4855
4855
|
// in which case we do not want to include this field in our parsed data
|
|
4856
4856
|
// (as doing so will overwrite the field directly prior to the transform
|
|
4857
4857
|
// trying to transform it). So we don't add this location to
|
|
@@ -4860,19 +4860,19 @@ class On extends bn {
|
|
|
4860
4860
|
* "Parses" the provided FieldValueImpl, adding any necessary transforms to
|
|
4861
4861
|
* context.fieldTransforms.
|
|
4862
4862
|
*/
|
|
4863
|
-
return function(t,
|
|
4863
|
+
return function(t, n) {
|
|
4864
4864
|
// Sentinels are only supported with writes, and not within arrays.
|
|
4865
|
-
if (!
|
|
4866
|
-
if (!
|
|
4867
|
-
const
|
|
4868
|
-
|
|
4865
|
+
if (!Re(n.tt)) throw n.ut(`${t._methodName}() can only be used with update() and set()`);
|
|
4866
|
+
if (!n.path) throw n.ut(`${t._methodName}() is not currently supported inside arrays`);
|
|
4867
|
+
const e = t._toFieldTransform(n);
|
|
4868
|
+
e && n.fieldTransforms.push(e);
|
|
4869
4869
|
}
|
|
4870
4870
|
/**
|
|
4871
4871
|
* Helper to parse a scalar value (i.e. not an Object, Array, or FieldValue)
|
|
4872
4872
|
*
|
|
4873
4873
|
* @returns The parsed value
|
|
4874
|
-
*/ (t,
|
|
4875
|
-
if (void 0 === t &&
|
|
4874
|
+
*/ (t, n), null;
|
|
4875
|
+
if (void 0 === t && n.ignoreUndefinedProperties)
|
|
4876
4876
|
// If the input is undefined it can never participate in the fieldMask, so
|
|
4877
4877
|
// don't handle this below. If `ignoreUndefinedProperties` is false,
|
|
4878
4878
|
// `parseScalarValue` will reject an undefined value.
|
|
@@ -4880,38 +4880,38 @@ class On extends bn {
|
|
|
4880
4880
|
if (
|
|
4881
4881
|
// If context.path is null we are inside an array and we don't support
|
|
4882
4882
|
// field mask paths more granular than the top-level array.
|
|
4883
|
-
|
|
4883
|
+
n.path && n.fieldMask.push(n.path), t instanceof Array) {
|
|
4884
4884
|
// TODO(b/34871131): Include the path containing the array in the error
|
|
4885
4885
|
// message.
|
|
4886
4886
|
// In the case of IN queries, the parsed data is an array (representing
|
|
4887
4887
|
// the set of values to be included for the IN query) that may directly
|
|
4888
4888
|
// contain additional arrays (each representing an individual field
|
|
4889
4889
|
// value), so we disable this validation.
|
|
4890
|
-
if (
|
|
4891
|
-
return function(t,
|
|
4892
|
-
const
|
|
4890
|
+
if (n.settings.rt && 4 /* ArrayArgument */ !== n.tt) throw n.ut("Nested arrays are not supported");
|
|
4891
|
+
return function(t, n) {
|
|
4892
|
+
const e = [];
|
|
4893
4893
|
let r = 0;
|
|
4894
4894
|
for (const s of t) {
|
|
4895
|
-
let t =
|
|
4895
|
+
let t = ke(s, n.ot(r));
|
|
4896
4896
|
null == t && (
|
|
4897
4897
|
// Just include nulls in the array for fields being replaced with a
|
|
4898
4898
|
// sentinel.
|
|
4899
4899
|
t = {
|
|
4900
4900
|
nullValue: "NULL_VALUE"
|
|
4901
|
-
}),
|
|
4901
|
+
}), e.push(t), r++;
|
|
4902
4902
|
}
|
|
4903
4903
|
return {
|
|
4904
4904
|
arrayValue: {
|
|
4905
|
-
values:
|
|
4905
|
+
values: e
|
|
4906
4906
|
}
|
|
4907
4907
|
};
|
|
4908
|
-
}(t,
|
|
4908
|
+
}(t, n);
|
|
4909
4909
|
}
|
|
4910
|
-
return function(t,
|
|
4910
|
+
return function(t, n) {
|
|
4911
4911
|
if (null === (t = getModularInstance(t))) return {
|
|
4912
4912
|
nullValue: "NULL_VALUE"
|
|
4913
4913
|
};
|
|
4914
|
-
if ("number" == typeof t) return
|
|
4914
|
+
if ("number" == typeof t) return mn(n.q, t);
|
|
4915
4915
|
if ("boolean" == typeof t) return {
|
|
4916
4916
|
booleanValue: t
|
|
4917
4917
|
};
|
|
@@ -4919,37 +4919,37 @@ class On extends bn {
|
|
|
4919
4919
|
stringValue: t
|
|
4920
4920
|
};
|
|
4921
4921
|
if (t instanceof Date) {
|
|
4922
|
-
const
|
|
4922
|
+
const e = gt.fromDate(t);
|
|
4923
4923
|
return {
|
|
4924
|
-
timestampValue:
|
|
4924
|
+
timestampValue: $n(n.q, e)
|
|
4925
4925
|
};
|
|
4926
4926
|
}
|
|
4927
4927
|
if (t instanceof gt) {
|
|
4928
4928
|
// Firestore backend truncates precision down to microseconds. To ensure
|
|
4929
4929
|
// offline mode works the same with regards to truncation, perform the
|
|
4930
4930
|
// truncation immediately without waiting for the backend to do that.
|
|
4931
|
-
const
|
|
4931
|
+
const e = new gt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
|
|
4932
4932
|
return {
|
|
4933
|
-
timestampValue:
|
|
4933
|
+
timestampValue: $n(n.q, e)
|
|
4934
4934
|
};
|
|
4935
4935
|
}
|
|
4936
|
-
if (t instanceof
|
|
4936
|
+
if (t instanceof Ee) return {
|
|
4937
4937
|
geoPointValue: {
|
|
4938
4938
|
latitude: t.latitude,
|
|
4939
4939
|
longitude: t.longitude
|
|
4940
4940
|
}
|
|
4941
4941
|
};
|
|
4942
|
-
if (t instanceof
|
|
4943
|
-
bytesValue:
|
|
4942
|
+
if (t instanceof ve) return {
|
|
4943
|
+
bytesValue: Sn(n.q, t._byteString)
|
|
4944
4944
|
};
|
|
4945
|
-
if (t instanceof
|
|
4946
|
-
const
|
|
4947
|
-
if (!r.isEqual(
|
|
4945
|
+
if (t instanceof he) {
|
|
4946
|
+
const e = n.databaseId, r = t.firestore._databaseId;
|
|
4947
|
+
if (!r.isEqual(e)) throw n.ut(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${e.projectId}/${e.database}`);
|
|
4948
4948
|
return {
|
|
4949
|
-
referenceValue:
|
|
4949
|
+
referenceValue: qn(t.firestore._databaseId || n.databaseId, t._key.path)
|
|
4950
4950
|
};
|
|
4951
4951
|
}
|
|
4952
|
-
throw
|
|
4952
|
+
throw n.ut(`Unsupported field value: ${it(t)}`);
|
|
4953
4953
|
}
|
|
4954
4954
|
/**
|
|
4955
4955
|
* Checks whether an object looks like a JSON object that should be converted
|
|
@@ -4957,56 +4957,56 @@ class On extends bn {
|
|
|
4957
4957
|
* JSON objects since they should be converted to a struct value. Arrays, Dates,
|
|
4958
4958
|
* GeoPoints, etc. are not considered to look like JSON objects since they map
|
|
4959
4959
|
* to specific FieldValue types other than ObjectValue.
|
|
4960
|
-
*/ (t,
|
|
4960
|
+
*/ (t, n);
|
|
4961
4961
|
}
|
|
4962
4962
|
|
|
4963
|
-
function
|
|
4964
|
-
const
|
|
4963
|
+
function je(t, n) {
|
|
4964
|
+
const e = {};
|
|
4965
4965
|
return !function(t) {
|
|
4966
|
-
for (const
|
|
4966
|
+
for (const n in t) if (Object.prototype.hasOwnProperty.call(t, n)) return !1;
|
|
4967
4967
|
return !0;
|
|
4968
4968
|
}(t) ? Et(t, ((t, r) => {
|
|
4969
|
-
const s =
|
|
4970
|
-
null != s && (
|
|
4969
|
+
const s = ke(r, n.et(t));
|
|
4970
|
+
null != s && (e[t] = s);
|
|
4971
4971
|
})) :
|
|
4972
4972
|
// If we encounter an empty object, we explicitly add it to the update
|
|
4973
4973
|
// mask to ensure that the server creates a map entry.
|
|
4974
|
-
|
|
4974
|
+
n.path && n.path.length > 0 && n.fieldMask.push(n.path), {
|
|
4975
4975
|
mapValue: {
|
|
4976
|
-
fields:
|
|
4976
|
+
fields: e
|
|
4977
4977
|
}
|
|
4978
4978
|
};
|
|
4979
4979
|
}
|
|
4980
4980
|
|
|
4981
|
-
function
|
|
4982
|
-
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof gt || t instanceof
|
|
4981
|
+
function Me(t) {
|
|
4982
|
+
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof gt || t instanceof Ee || t instanceof ve || t instanceof he || t instanceof be);
|
|
4983
4983
|
}
|
|
4984
4984
|
|
|
4985
|
-
function
|
|
4986
|
-
if (!
|
|
4985
|
+
function Be(t, n, e) {
|
|
4986
|
+
if (!Me(e) || !function(t) {
|
|
4987
4987
|
return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
|
|
4988
|
-
}(
|
|
4989
|
-
const r = it(
|
|
4990
|
-
throw "an object" === r ?
|
|
4988
|
+
}(e)) {
|
|
4989
|
+
const r = it(e);
|
|
4990
|
+
throw "an object" === r ? n.ut(t + " a custom object") : n.ut(t + " " + r);
|
|
4991
4991
|
}
|
|
4992
4992
|
}
|
|
4993
4993
|
|
|
4994
4994
|
/**
|
|
4995
4995
|
* Helper that calls fromDotSeparatedString() but wraps any error thrown.
|
|
4996
|
-
*/ function
|
|
4996
|
+
*/ function ze(t, n, e) {
|
|
4997
4997
|
if ((
|
|
4998
4998
|
// If required, replace the FieldPath Compat class with with the firestore-exp
|
|
4999
4999
|
// FieldPath.
|
|
5000
|
-
|
|
5001
|
-
if ("string" == typeof
|
|
5002
|
-
throw
|
|
5000
|
+
n = getModularInstance(n)) instanceof _e) return n._internalPath;
|
|
5001
|
+
if ("string" == typeof n) return Qe(t, n);
|
|
5002
|
+
throw We("Field path arguments must be of type string or ", t,
|
|
5003
5003
|
/* hasConverter= */ !1,
|
|
5004
|
-
/* path= */ void 0,
|
|
5004
|
+
/* path= */ void 0, e);
|
|
5005
5005
|
}
|
|
5006
5006
|
|
|
5007
5007
|
/**
|
|
5008
5008
|
* Matches any characters in a field path string that are reserved.
|
|
5009
|
-
*/ const
|
|
5009
|
+
*/ const Ge = new RegExp("[~\\*/\\[\\]]");
|
|
5010
5010
|
|
|
5011
5011
|
/**
|
|
5012
5012
|
* Wraps fromDotSeparatedString with an error message about the method that
|
|
@@ -5016,30 +5016,30 @@ function Bn(t, e, n) {
|
|
|
5016
5016
|
* split on dots.
|
|
5017
5017
|
* @param targetDoc - The document against which the field path will be
|
|
5018
5018
|
* evaluated.
|
|
5019
|
-
*/ function
|
|
5020
|
-
if (
|
|
5019
|
+
*/ function Qe(t, n, e) {
|
|
5020
|
+
if (n.search(Ge) >= 0) throw We(`Invalid field path (${n}). Paths must not contain '~', '*', '/', '[', or ']'`, t,
|
|
5021
5021
|
/* hasConverter= */ !1,
|
|
5022
|
-
/* path= */ void 0,
|
|
5022
|
+
/* path= */ void 0, e);
|
|
5023
5023
|
try {
|
|
5024
|
-
return new
|
|
5024
|
+
return new _e(...n.split("."))._internalPath;
|
|
5025
5025
|
} catch (r) {
|
|
5026
|
-
throw
|
|
5026
|
+
throw We(`Invalid field path (${n}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t,
|
|
5027
5027
|
/* hasConverter= */ !1,
|
|
5028
|
-
/* path= */ void 0,
|
|
5028
|
+
/* path= */ void 0, e);
|
|
5029
5029
|
}
|
|
5030
5030
|
}
|
|
5031
5031
|
|
|
5032
|
-
function
|
|
5032
|
+
function We(t, n, e, r, s) {
|
|
5033
5033
|
const i = r && !r.isEmpty(), o = void 0 !== s;
|
|
5034
|
-
let u = `Function ${
|
|
5035
|
-
|
|
5034
|
+
let u = `Function ${n}() called with invalid data`;
|
|
5035
|
+
e && (u += " (via `toFirestore()`)"), u += ". ";
|
|
5036
5036
|
let c = "";
|
|
5037
5037
|
return (i || o) && (c += " (found", i && (c += ` in field ${r}`), o && (c += ` in document ${s}`),
|
|
5038
5038
|
c += ")"), new U(A, u + t + c);
|
|
5039
5039
|
}
|
|
5040
5040
|
|
|
5041
|
-
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function
|
|
5042
|
-
return t.some((t => t.isEqual(
|
|
5041
|
+
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function Ye(t, n) {
|
|
5042
|
+
return t.some((t => t.isEqual(n)));
|
|
5043
5043
|
}
|
|
5044
5044
|
|
|
5045
5045
|
/**
|
|
@@ -5066,14 +5066,14 @@ function Wn(t, e, n, r, s) {
|
|
|
5066
5066
|
* For a `DocumentSnapshot` that points to a non-existing document, any data
|
|
5067
5067
|
* access will return 'undefined'. You can use the `exists()` method to
|
|
5068
5068
|
* explicitly verify a document's existence.
|
|
5069
|
-
*/ class
|
|
5069
|
+
*/ class He {
|
|
5070
5070
|
// Note: This class is stripped down version of the DocumentSnapshot in
|
|
5071
5071
|
// the legacy SDK. The changes are:
|
|
5072
5072
|
// - No support for SnapshotMetadata.
|
|
5073
5073
|
// - No support for SnapshotOptions.
|
|
5074
5074
|
/** @hideconstructor protected */
|
|
5075
|
-
constructor(t,
|
|
5076
|
-
this._firestore = t, this._userDataWriter =
|
|
5075
|
+
constructor(t, n, e, r, s) {
|
|
5076
|
+
this._firestore = t, this._userDataWriter = n, this._key = e, this._document = r,
|
|
5077
5077
|
this._converter = s;
|
|
5078
5078
|
}
|
|
5079
5079
|
/** Property of the `DocumentSnapshot` that provides the document's ID. */ get id() {
|
|
@@ -5082,7 +5082,7 @@ function Wn(t, e, n, r, s) {
|
|
|
5082
5082
|
/**
|
|
5083
5083
|
* The `DocumentReference` for the document included in the `DocumentSnapshot`.
|
|
5084
5084
|
*/ get ref() {
|
|
5085
|
-
return new
|
|
5085
|
+
return new he(this._firestore, this._converter, this._key);
|
|
5086
5086
|
}
|
|
5087
5087
|
/**
|
|
5088
5088
|
* Signals whether or not the document at the snapshot's location exists.
|
|
@@ -5102,7 +5102,7 @@ function Wn(t, e, n, r, s) {
|
|
|
5102
5102
|
if (this._converter) {
|
|
5103
5103
|
// We only want to use the converter and create a new DocumentSnapshot
|
|
5104
5104
|
// if a converter has been provided.
|
|
5105
|
-
const t = new
|
|
5105
|
+
const t = new Ke(this._firestore, this._userDataWriter, this._key, this._document,
|
|
5106
5106
|
/* converter= */ null);
|
|
5107
5107
|
return this._converter.fromFirestore(t);
|
|
5108
5108
|
}
|
|
@@ -5122,8 +5122,8 @@ function Wn(t, e, n, r, s) {
|
|
|
5122
5122
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5123
5123
|
get(t) {
|
|
5124
5124
|
if (this._document) {
|
|
5125
|
-
const
|
|
5126
|
-
if (null !==
|
|
5125
|
+
const n = this._document.data.field(Ze("DocumentSnapshot.get", t));
|
|
5126
|
+
if (null !== n) return this._userDataWriter.convertValue(n);
|
|
5127
5127
|
}
|
|
5128
5128
|
}
|
|
5129
5129
|
}
|
|
@@ -5138,7 +5138,7 @@ function Wn(t, e, n, r, s) {
|
|
|
5138
5138
|
* `DocumentSnapshot`. Since query results contain only existing documents, the
|
|
5139
5139
|
* `exists` property will always be true and `data()` will never return
|
|
5140
5140
|
* 'undefined'.
|
|
5141
|
-
*/ class
|
|
5141
|
+
*/ class Ke extends He {
|
|
5142
5142
|
/**
|
|
5143
5143
|
* Retrieves all fields in the document as an `Object`.
|
|
5144
5144
|
*
|
|
@@ -5156,10 +5156,10 @@ function Wn(t, e, n, r, s) {
|
|
|
5156
5156
|
* array via the `docs` property or enumerated using the `forEach` method. The
|
|
5157
5157
|
* number of documents can be determined via the `empty` and `size`
|
|
5158
5158
|
* properties.
|
|
5159
|
-
*/ class
|
|
5159
|
+
*/ class Je {
|
|
5160
5160
|
/** @hideconstructor */
|
|
5161
|
-
constructor(t,
|
|
5162
|
-
this._docs =
|
|
5161
|
+
constructor(t, n) {
|
|
5162
|
+
this._docs = n, this.query = t;
|
|
5163
5163
|
}
|
|
5164
5164
|
/** An array of all the documents in the `QuerySnapshot`. */ get docs() {
|
|
5165
5165
|
return [ ...this._docs ];
|
|
@@ -5176,8 +5176,8 @@ function Wn(t, e, n, r, s) {
|
|
|
5176
5176
|
* @param callback - A callback to be called with a `QueryDocumentSnapshot` for
|
|
5177
5177
|
* each document in the snapshot.
|
|
5178
5178
|
* @param thisArg - The `this` binding for the callback.
|
|
5179
|
-
*/ forEach(t,
|
|
5180
|
-
this._docs.forEach(t,
|
|
5179
|
+
*/ forEach(t, n) {
|
|
5180
|
+
this._docs.forEach(t, n);
|
|
5181
5181
|
}
|
|
5182
5182
|
}
|
|
5183
5183
|
|
|
@@ -5187,14 +5187,14 @@ function Wn(t, e, n, r, s) {
|
|
|
5187
5187
|
* @param left - A snapshot to compare.
|
|
5188
5188
|
* @param right - A snapshot to compare.
|
|
5189
5189
|
* @returns true if the snapshots are equal.
|
|
5190
|
-
*/ function
|
|
5191
|
-
return t = getModularInstance(t),
|
|
5190
|
+
*/ function Xe(t, n) {
|
|
5191
|
+
return t = getModularInstance(t), n = getModularInstance(n), t instanceof He && n instanceof He ? t._firestore === n._firestore && t._key.isEqual(n._key) && (null === t._document ? null === n._document : t._document.isEqual(n._document)) && t._converter === n._converter : t instanceof Je && n instanceof Je && (ye(t.query, n.query) && _t(t.docs, n.docs, Xe));
|
|
5192
5192
|
}
|
|
5193
5193
|
|
|
5194
5194
|
/**
|
|
5195
5195
|
* Helper that calls `fromDotSeparatedString()` but wraps any error thrown.
|
|
5196
|
-
*/ function
|
|
5197
|
-
return "string" == typeof
|
|
5196
|
+
*/ function Ze(t, n) {
|
|
5197
|
+
return "string" == typeof n ? Qe(t, n) : n instanceof _e ? n._internalPath : n._delegate._internalPath;
|
|
5198
5198
|
}
|
|
5199
5199
|
|
|
5200
5200
|
/**
|
|
@@ -5231,43 +5231,43 @@ class tr {}
|
|
|
5231
5231
|
* @param queryConstraints - The list of {@link QueryConstraint}s to apply.
|
|
5232
5232
|
* @throws if any of the provided query constraints cannot be combined with the
|
|
5233
5233
|
* existing or new constraints.
|
|
5234
|
-
*/ function
|
|
5235
|
-
for (const
|
|
5234
|
+
*/ function nr(t, ...n) {
|
|
5235
|
+
for (const e of n) t = e._apply(t);
|
|
5236
5236
|
return t;
|
|
5237
5237
|
}
|
|
5238
5238
|
|
|
5239
|
-
class
|
|
5240
|
-
constructor(t,
|
|
5241
|
-
super(), this.dt = t, this.wt =
|
|
5239
|
+
class er extends tr {
|
|
5240
|
+
constructor(t, n, e) {
|
|
5241
|
+
super(), this.dt = t, this.wt = n, this.yt = e, this.type = "where";
|
|
5242
5242
|
}
|
|
5243
5243
|
_apply(t) {
|
|
5244
|
-
const
|
|
5244
|
+
const n = De(t.firestore), e = function(t, n, e, r, s, i, o) {
|
|
5245
5245
|
let u;
|
|
5246
5246
|
if (s.isKeyField()) {
|
|
5247
|
-
if ("array-contains" /* ARRAY_CONTAINS */ === i || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === i) throw new U(A, `Invalid Query. You can't perform '${i}' queries on
|
|
5247
|
+
if ("array-contains" /* ARRAY_CONTAINS */ === i || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === i) throw new U(A, `Invalid Query. You can't perform '${i}' queries on documentId().`);
|
|
5248
5248
|
if ("in" /* IN */ === i || "not-in" /* NOT_IN */ === i) {
|
|
5249
5249
|
yr(o, i);
|
|
5250
|
-
const
|
|
5251
|
-
for (const
|
|
5250
|
+
const n = [];
|
|
5251
|
+
for (const e of o) n.push(pr(r, t, e));
|
|
5252
5252
|
u = {
|
|
5253
5253
|
arrayValue: {
|
|
5254
|
-
values:
|
|
5254
|
+
values: n
|
|
5255
5255
|
}
|
|
5256
5256
|
};
|
|
5257
5257
|
} else u = pr(r, t, o);
|
|
5258
5258
|
} else "in" /* IN */ !== i && "not-in" /* NOT_IN */ !== i && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== i || yr(o, i),
|
|
5259
|
-
u =
|
|
5259
|
+
u = Ue(e, n, o,
|
|
5260
5260
|
/* allowArrays= */ "in" /* IN */ === i || "not-in" /* NOT_IN */ === i);
|
|
5261
5261
|
const c = Wt.create(s, i, u);
|
|
5262
|
-
return function(t,
|
|
5263
|
-
if (
|
|
5264
|
-
const
|
|
5265
|
-
if (null !==
|
|
5266
|
-
const r =
|
|
5267
|
-
null !== r && _r(t,
|
|
5262
|
+
return function(t, n) {
|
|
5263
|
+
if (n.N()) {
|
|
5264
|
+
const e = hn(t);
|
|
5265
|
+
if (null !== e && !e.isEqual(n.field)) throw new U(A, `Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${e.toString()}' and '${n.field.toString()}'`);
|
|
5266
|
+
const r = an(t);
|
|
5267
|
+
null !== r && _r(t, n.field, r);
|
|
5268
5268
|
}
|
|
5269
|
-
const
|
|
5270
|
-
for (const
|
|
5269
|
+
const e = function(t, n) {
|
|
5270
|
+
for (const e of t.filters) if (n.indexOf(e.op) >= 0) return e.op;
|
|
5271
5271
|
return null;
|
|
5272
5272
|
}(t,
|
|
5273
5273
|
/**
|
|
@@ -5302,16 +5302,16 @@ class nr extends tr {
|
|
|
5302
5302
|
default:
|
|
5303
5303
|
return [];
|
|
5304
5304
|
}
|
|
5305
|
-
}(
|
|
5306
|
-
if (null !==
|
|
5305
|
+
}(n.op));
|
|
5306
|
+
if (null !== e)
|
|
5307
5307
|
// Special case when it's a duplicate op to give a slightly clearer error message.
|
|
5308
|
-
throw
|
|
5308
|
+
throw e === n.op ? new U(A, `Invalid query. You cannot use more than one '${n.op.toString()}' filter.`) : new U(A, `Invalid query. You cannot use '${n.op.toString()}' filters with '${e.toString()}' filters.`);
|
|
5309
5309
|
}(t, c), c;
|
|
5310
|
-
}(t._query, "where",
|
|
5311
|
-
return new
|
|
5312
|
-
const
|
|
5313
|
-
return new
|
|
5314
|
-
}(t._query,
|
|
5310
|
+
}(t._query, "where", n, t.firestore._databaseId, this.dt, this.wt, this.yt);
|
|
5311
|
+
return new le(t.firestore, t.converter, function(t, n) {
|
|
5312
|
+
const e = t.filters.concat([ n ]);
|
|
5313
|
+
return new un(t.path, t.collectionGroup, t.explicitOrderBy.slice(), e, t.limit, t.limitType, t.startAt, t.endAt);
|
|
5314
|
+
}(t._query, e));
|
|
5315
5315
|
}
|
|
5316
5316
|
}
|
|
5317
5317
|
|
|
@@ -5325,25 +5325,25 @@ class nr extends tr {
|
|
|
5325
5325
|
* "<=", "!=").
|
|
5326
5326
|
* @param value - The value for comparison
|
|
5327
5327
|
* @returns The created {@link Query}.
|
|
5328
|
-
*/ function rr(t,
|
|
5329
|
-
const r =
|
|
5330
|
-
return new
|
|
5328
|
+
*/ function rr(t, n, e) {
|
|
5329
|
+
const r = n, s = Ze("where", t);
|
|
5330
|
+
return new er(s, r, e);
|
|
5331
5331
|
}
|
|
5332
5332
|
|
|
5333
5333
|
class sr extends tr {
|
|
5334
|
-
constructor(t,
|
|
5335
|
-
super(), this.dt = t, this._t =
|
|
5334
|
+
constructor(t, n) {
|
|
5335
|
+
super(), this.dt = t, this._t = n, this.type = "orderBy";
|
|
5336
5336
|
}
|
|
5337
5337
|
_apply(t) {
|
|
5338
|
-
const
|
|
5338
|
+
const n = function(t, n, e) {
|
|
5339
5339
|
if (null !== t.startAt) throw new U(A, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
|
|
5340
5340
|
if (null !== t.endAt) throw new U(A, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
|
|
5341
|
-
const r = new
|
|
5342
|
-
return function(t,
|
|
5343
|
-
if (null ===
|
|
5341
|
+
const r = new rn(n, e);
|
|
5342
|
+
return function(t, n) {
|
|
5343
|
+
if (null === an(t)) {
|
|
5344
5344
|
// This is the first order by. It must match any inequality.
|
|
5345
|
-
const
|
|
5346
|
-
null !==
|
|
5345
|
+
const e = hn(t);
|
|
5346
|
+
null !== e && _r(t, e, n.field);
|
|
5347
5347
|
}
|
|
5348
5348
|
}(t, r), r;
|
|
5349
5349
|
}
|
|
@@ -5358,11 +5358,11 @@ class sr extends tr {
|
|
|
5358
5358
|
* of the query or if any of the fields in the order by are an uncommitted
|
|
5359
5359
|
* server timestamp.
|
|
5360
5360
|
*/ (t._query, this.dt, this._t);
|
|
5361
|
-
return new
|
|
5361
|
+
return new le(t.firestore, t.converter, function(t, n) {
|
|
5362
5362
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
5363
|
-
const
|
|
5364
|
-
return new
|
|
5365
|
-
}(t._query,
|
|
5363
|
+
const e = t.explicitOrderBy.concat([ n ]);
|
|
5364
|
+
return new un(t.path, t.collectionGroup, e, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
|
|
5365
|
+
}(t._query, n));
|
|
5366
5366
|
}
|
|
5367
5367
|
}
|
|
5368
5368
|
|
|
@@ -5374,18 +5374,18 @@ class sr extends tr {
|
|
|
5374
5374
|
* @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
|
|
5375
5375
|
* not specified, order will be ascending.
|
|
5376
5376
|
* @returns The created {@link Query}.
|
|
5377
|
-
*/ function ir(t,
|
|
5378
|
-
const
|
|
5379
|
-
return new sr(r,
|
|
5377
|
+
*/ function ir(t, n = "asc") {
|
|
5378
|
+
const e = n, r = Ze("orderBy", t);
|
|
5379
|
+
return new sr(r, e);
|
|
5380
5380
|
}
|
|
5381
5381
|
|
|
5382
5382
|
class or extends tr {
|
|
5383
|
-
constructor(t,
|
|
5384
|
-
super(), this.type = t, this.gt =
|
|
5383
|
+
constructor(t, n, e) {
|
|
5384
|
+
super(), this.type = t, this.gt = n, this.vt = e;
|
|
5385
5385
|
}
|
|
5386
5386
|
_apply(t) {
|
|
5387
|
-
return new
|
|
5388
|
-
return new
|
|
5387
|
+
return new le(t.firestore, t.converter, function(t, n, e) {
|
|
5388
|
+
return new un(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), n, e, t.startAt, t.endAt);
|
|
5389
5389
|
}(t._query, this.gt, this.vt));
|
|
5390
5390
|
}
|
|
5391
5391
|
}
|
|
@@ -5412,14 +5412,14 @@ class or extends tr {
|
|
|
5412
5412
|
}
|
|
5413
5413
|
|
|
5414
5414
|
class ar extends tr {
|
|
5415
|
-
constructor(t,
|
|
5416
|
-
super(), this.type = t, this.bt =
|
|
5415
|
+
constructor(t, n, e) {
|
|
5416
|
+
super(), this.type = t, this.bt = n, this.Et = e;
|
|
5417
5417
|
}
|
|
5418
5418
|
_apply(t) {
|
|
5419
|
-
const
|
|
5420
|
-
return new
|
|
5421
|
-
return new
|
|
5422
|
-
}(t._query,
|
|
5419
|
+
const n = mr(t, this.type, this.bt, this.Et);
|
|
5420
|
+
return new le(t.firestore, t.converter, function(t, n) {
|
|
5421
|
+
return new un(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, n, t.endAt);
|
|
5422
|
+
}(t._query, n));
|
|
5423
5423
|
}
|
|
5424
5424
|
}
|
|
5425
5425
|
|
|
@@ -5433,14 +5433,14 @@ function lr(...t) {
|
|
|
5433
5433
|
}
|
|
5434
5434
|
|
|
5435
5435
|
class fr extends tr {
|
|
5436
|
-
constructor(t,
|
|
5437
|
-
super(), this.type = t, this.bt =
|
|
5436
|
+
constructor(t, n, e) {
|
|
5437
|
+
super(), this.type = t, this.bt = n, this.Et = e;
|
|
5438
5438
|
}
|
|
5439
5439
|
_apply(t) {
|
|
5440
|
-
const
|
|
5441
|
-
return new
|
|
5442
|
-
return new
|
|
5443
|
-
}(t._query,
|
|
5440
|
+
const n = mr(t, this.type, this.bt, this.Et);
|
|
5441
|
+
return new le(t.firestore, t.converter, function(t, n) {
|
|
5442
|
+
return new un(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, n);
|
|
5443
|
+
}(t._query, n));
|
|
5444
5444
|
}
|
|
5445
5445
|
}
|
|
5446
5446
|
|
|
@@ -5452,9 +5452,9 @@ function wr(...t) {
|
|
|
5452
5452
|
return new fr("endAt", t, /*before=*/ !1);
|
|
5453
5453
|
}
|
|
5454
5454
|
|
|
5455
|
-
/** Helper function to create a bound from a document or fields */ function mr(t,
|
|
5456
|
-
if (
|
|
5457
|
-
if (!r) throw new U(
|
|
5455
|
+
/** Helper function to create a bound from a document or fields */ function mr(t, n, e, r) {
|
|
5456
|
+
if (e[0] = getModularInstance(e[0]), e[0] instanceof He) return function(t, n, e, r, s) {
|
|
5457
|
+
if (!r) throw new U(P, `Can't use a DocumentSnapshot that doesn't exist for ${e}().`);
|
|
5458
5458
|
const i = [];
|
|
5459
5459
|
// Because people expect to continue/end a query at the exact document
|
|
5460
5460
|
// provided, we need to use the implicit sort order rather than the explicit
|
|
@@ -5463,23 +5463,23 @@ function wr(...t) {
|
|
|
5463
5463
|
// the provided document. Without the key (by using the explicit sort
|
|
5464
5464
|
// orders), multiple documents could match the position, yielding duplicate
|
|
5465
5465
|
// results.
|
|
5466
|
-
for (const
|
|
5467
|
-
const t = r.data.field(
|
|
5468
|
-
if (Dt(t)) throw new U(A, 'Invalid query. You are trying to start or end a query using a document for which the field "' +
|
|
5466
|
+
for (const e of fn(t)) if (e.field.isKeyField()) i.push(Ct(n, r.key)); else {
|
|
5467
|
+
const t = r.data.field(e.field);
|
|
5468
|
+
if (Dt(t)) throw new U(A, 'Invalid query. You are trying to start or end a query using a document for which the field "' + e.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');
|
|
5469
5469
|
if (null === t) {
|
|
5470
|
-
const t =
|
|
5470
|
+
const t = e.field.canonicalString();
|
|
5471
5471
|
throw new U(A, `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.`);
|
|
5472
5472
|
}
|
|
5473
5473
|
i.push(t);
|
|
5474
5474
|
}
|
|
5475
|
-
return new
|
|
5475
|
+
return new en(i, s);
|
|
5476
5476
|
}
|
|
5477
5477
|
/**
|
|
5478
5478
|
* Converts a list of field values to a `Bound` for the given query.
|
|
5479
|
-
*/ (t._query, t.firestore._databaseId,
|
|
5479
|
+
*/ (t._query, t.firestore._databaseId, n, e[0]._document, r);
|
|
5480
5480
|
{
|
|
5481
|
-
const s =
|
|
5482
|
-
return function(t,
|
|
5481
|
+
const s = De(t.firestore);
|
|
5482
|
+
return function(t, n, e, r, s, i) {
|
|
5483
5483
|
// Use explicit order by's because it has to match the query the user made
|
|
5484
5484
|
const o = t.explicitOrderBy;
|
|
5485
5485
|
if (s.length > o.length) throw new U(A, `Too many arguments provided to ${r}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);
|
|
@@ -5488,48 +5488,48 @@ function wr(...t) {
|
|
|
5488
5488
|
const c = s[i];
|
|
5489
5489
|
if (o[i].field.isKeyField()) {
|
|
5490
5490
|
if ("string" != typeof c) throw new U(A, `Invalid query. Expected a string for document ID in ${r}(), but got a ${typeof c}`);
|
|
5491
|
-
if (!
|
|
5492
|
-
const
|
|
5493
|
-
if (!
|
|
5494
|
-
const s = new
|
|
5495
|
-
u.push(Ct(
|
|
5491
|
+
if (!ln(t) && -1 !== c.indexOf("/")) throw new U(A, `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.`);
|
|
5492
|
+
const e = t.path.child(X.fromString(c));
|
|
5493
|
+
if (!nt.isDocumentKey(e)) throw new U(A, `Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${r}() must result in a valid document path, but '${e}' is not because it contains an odd number of segments.`);
|
|
5494
|
+
const s = new nt(e);
|
|
5495
|
+
u.push(Ct(n, s));
|
|
5496
5496
|
} else {
|
|
5497
|
-
const t =
|
|
5497
|
+
const t = Ue(e, r, c);
|
|
5498
5498
|
u.push(t);
|
|
5499
5499
|
}
|
|
5500
5500
|
}
|
|
5501
|
-
return new
|
|
5501
|
+
return new en(u, i);
|
|
5502
5502
|
}
|
|
5503
5503
|
/**
|
|
5504
5504
|
* Parses the given `documentIdValue` into a `ReferenceValue`, throwing
|
|
5505
5505
|
* appropriate errors if the value is anything other than a `DocumentReference`
|
|
5506
5506
|
* or `string`, or if the string is malformed.
|
|
5507
|
-
*/ (t._query, t.firestore._databaseId, s,
|
|
5507
|
+
*/ (t._query, t.firestore._databaseId, s, n, e, r);
|
|
5508
5508
|
}
|
|
5509
5509
|
}
|
|
5510
5510
|
|
|
5511
|
-
function pr(t,
|
|
5512
|
-
if ("string" == typeof (
|
|
5513
|
-
if ("" ===
|
|
5514
|
-
if (!
|
|
5515
|
-
const r =
|
|
5516
|
-
if (!
|
|
5517
|
-
return Ct(t, new
|
|
5511
|
+
function pr(t, n, e) {
|
|
5512
|
+
if ("string" == typeof (e = getModularInstance(e))) {
|
|
5513
|
+
if ("" === e) throw new U(A, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
|
|
5514
|
+
if (!ln(n) && -1 !== e.indexOf("/")) throw new U(A, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${e}' contains a '/' character.`);
|
|
5515
|
+
const r = n.path.child(X.fromString(e));
|
|
5516
|
+
if (!nt.isDocumentKey(r)) throw new U(A, `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}).`);
|
|
5517
|
+
return Ct(t, new nt(r));
|
|
5518
5518
|
}
|
|
5519
|
-
if (
|
|
5520
|
-
throw new U(A, `Invalid query. When querying with
|
|
5519
|
+
if (e instanceof he) return Ct(t, e._key);
|
|
5520
|
+
throw new U(A, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${it(e)}.`);
|
|
5521
5521
|
}
|
|
5522
5522
|
|
|
5523
5523
|
/**
|
|
5524
5524
|
* Validates that the value passed into a disjunctive filter satisfies all
|
|
5525
5525
|
* array requirements.
|
|
5526
|
-
*/ function yr(t,
|
|
5527
|
-
if (!Array.isArray(t) || 0 === t.length) throw new U(A, `Invalid Query. A non-empty array is required for '${
|
|
5528
|
-
if (t.length > 10) throw new U(A, `Invalid Query. '${
|
|
5526
|
+
*/ function yr(t, n) {
|
|
5527
|
+
if (!Array.isArray(t) || 0 === t.length) throw new U(A, `Invalid Query. A non-empty array is required for '${n.toString()}' filters.`);
|
|
5528
|
+
if (t.length > 10) throw new U(A, `Invalid Query. '${n.toString()}' filters support a maximum of 10 elements in the value array.`);
|
|
5529
5529
|
}
|
|
5530
5530
|
|
|
5531
|
-
function _r(t,
|
|
5532
|
-
if (!
|
|
5531
|
+
function _r(t, n, e) {
|
|
5532
|
+
if (!e.isEqual(n)) throw new U(A, `Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${n.toString()}' and so you must also use '${n.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${e.toString()}' instead.`);
|
|
5533
5533
|
}
|
|
5534
5534
|
|
|
5535
5535
|
/**
|
|
@@ -5579,18 +5579,18 @@ function _r(t, e, n) {
|
|
|
5579
5579
|
* their `set()` or fails due to invalid data originating from a `toFirestore()`
|
|
5580
5580
|
* call.
|
|
5581
5581
|
*/
|
|
5582
|
-
function gr(t,
|
|
5582
|
+
function gr(t, n, e) {
|
|
5583
5583
|
let r;
|
|
5584
5584
|
// Cast to `any` in order to satisfy the union type constraint on
|
|
5585
5585
|
// toFirestore().
|
|
5586
5586
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5587
|
-
return r = t ?
|
|
5587
|
+
return r = t ? e && (e.merge || e.mergeFields) ? t.toFirestore(n, e) : t.toFirestore(n) : n,
|
|
5588
5588
|
r;
|
|
5589
5589
|
}
|
|
5590
5590
|
|
|
5591
5591
|
class vr extends class {
|
|
5592
|
-
convertValue(t,
|
|
5593
|
-
switch (
|
|
5592
|
+
convertValue(t, n = "none") {
|
|
5593
|
+
switch (St(t)) {
|
|
5594
5594
|
case 0 /* NullValue */ :
|
|
5595
5595
|
return null;
|
|
5596
5596
|
|
|
@@ -5598,13 +5598,13 @@ class vr extends class {
|
|
|
5598
5598
|
return t.booleanValue;
|
|
5599
5599
|
|
|
5600
5600
|
case 2 /* NumberValue */ :
|
|
5601
|
-
return
|
|
5601
|
+
return Pt(t.integerValue || t.doubleValue);
|
|
5602
5602
|
|
|
5603
5603
|
case 3 /* TimestampValue */ :
|
|
5604
5604
|
return this.convertTimestamp(t.timestampValue);
|
|
5605
5605
|
|
|
5606
5606
|
case 4 /* ServerTimestampValue */ :
|
|
5607
|
-
return this.convertServerTimestamp(t,
|
|
5607
|
+
return this.convertServerTimestamp(t, n);
|
|
5608
5608
|
|
|
5609
5609
|
case 5 /* StringValue */ :
|
|
5610
5610
|
return t.stringValue;
|
|
@@ -5619,32 +5619,32 @@ class vr extends class {
|
|
|
5619
5619
|
return this.convertGeoPoint(t.geoPointValue);
|
|
5620
5620
|
|
|
5621
5621
|
case 9 /* ArrayValue */ :
|
|
5622
|
-
return this.convertArray(t.arrayValue,
|
|
5622
|
+
return this.convertArray(t.arrayValue, n);
|
|
5623
5623
|
|
|
5624
5624
|
case 10 /* ObjectValue */ :
|
|
5625
|
-
return this.convertObject(t.mapValue,
|
|
5625
|
+
return this.convertObject(t.mapValue, n);
|
|
5626
5626
|
|
|
5627
5627
|
default:
|
|
5628
5628
|
throw g();
|
|
5629
5629
|
}
|
|
5630
5630
|
}
|
|
5631
|
-
convertObject(t,
|
|
5632
|
-
const
|
|
5631
|
+
convertObject(t, n) {
|
|
5632
|
+
const e = {};
|
|
5633
5633
|
return Et(t.fields, ((t, r) => {
|
|
5634
|
-
|
|
5635
|
-
})),
|
|
5634
|
+
e[t] = this.convertValue(r, n);
|
|
5635
|
+
})), e;
|
|
5636
5636
|
}
|
|
5637
5637
|
convertGeoPoint(t) {
|
|
5638
|
-
return new
|
|
5638
|
+
return new Ee(Pt(t.latitude), Pt(t.longitude));
|
|
5639
5639
|
}
|
|
5640
|
-
convertArray(t,
|
|
5641
|
-
return (t.values || []).map((t => this.convertValue(t,
|
|
5640
|
+
convertArray(t, n) {
|
|
5641
|
+
return (t.values || []).map((t => this.convertValue(t, n)));
|
|
5642
5642
|
}
|
|
5643
|
-
convertServerTimestamp(t,
|
|
5644
|
-
switch (
|
|
5643
|
+
convertServerTimestamp(t, n) {
|
|
5644
|
+
switch (n) {
|
|
5645
5645
|
case "previous":
|
|
5646
|
-
const
|
|
5647
|
-
return null ==
|
|
5646
|
+
const e = Nt(t);
|
|
5647
|
+
return null == e ? null : this.convertValue(e, n);
|
|
5648
5648
|
|
|
5649
5649
|
case "estimate":
|
|
5650
5650
|
return this.convertTimestamp($t(t));
|
|
@@ -5654,16 +5654,16 @@ class vr extends class {
|
|
|
5654
5654
|
}
|
|
5655
5655
|
}
|
|
5656
5656
|
convertTimestamp(t) {
|
|
5657
|
-
const
|
|
5658
|
-
return new gt(
|
|
5657
|
+
const n = Rt(t);
|
|
5658
|
+
return new gt(n.seconds, n.nanos);
|
|
5659
5659
|
}
|
|
5660
|
-
convertDocumentKey(t,
|
|
5661
|
-
const
|
|
5662
|
-
v(
|
|
5663
|
-
const r = new K(
|
|
5664
|
-
return r.isEqual(
|
|
5660
|
+
convertDocumentKey(t, n) {
|
|
5661
|
+
const e = X.fromString(t);
|
|
5662
|
+
v(Hn(e));
|
|
5663
|
+
const r = new K(e.get(1), e.get(3)), s = new nt(e.popFirst(5));
|
|
5664
|
+
return r.isEqual(n) ||
|
|
5665
5665
|
// TODO(b/64130202): Somehow support foreign references.
|
|
5666
|
-
p(`Document ${s} contains a document reference within a different database (${r.projectId}/${r.database}) which is not supported. It will be treated as a reference in the current database (${
|
|
5666
|
+
p(`Document ${s} contains a document reference within a different database (${r.projectId}/${r.database}) which is not supported. It will be treated as a reference in the current database (${n.projectId}/${n.database}) instead.`),
|
|
5667
5667
|
s;
|
|
5668
5668
|
}
|
|
5669
5669
|
} {
|
|
@@ -5671,11 +5671,11 @@ class vr extends class {
|
|
|
5671
5671
|
super(), this.firestore = t;
|
|
5672
5672
|
}
|
|
5673
5673
|
convertBytes(t) {
|
|
5674
|
-
return new
|
|
5674
|
+
return new ve(t);
|
|
5675
5675
|
}
|
|
5676
5676
|
convertReference(t) {
|
|
5677
|
-
const
|
|
5678
|
-
return new
|
|
5677
|
+
const n = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
5678
|
+
return new he(this.firestore, /* converter= */ null, n);
|
|
5679
5679
|
}
|
|
5680
5680
|
}
|
|
5681
5681
|
|
|
@@ -5692,11 +5692,11 @@ class vr extends class {
|
|
|
5692
5692
|
* @returns A Promise resolved with a `DocumentSnapshot` containing the current
|
|
5693
5693
|
* document contents.
|
|
5694
5694
|
*/ function br(t) {
|
|
5695
|
-
const
|
|
5696
|
-
return
|
|
5697
|
-
v(1 ===
|
|
5698
|
-
const r =
|
|
5699
|
-
return new
|
|
5695
|
+
const n = re((t = ot(t, he)).firestore), e = new vr(t.firestore);
|
|
5696
|
+
return te(n, [ t._key ]).then((n => {
|
|
5697
|
+
v(1 === n.length);
|
|
5698
|
+
const r = n[0];
|
|
5699
|
+
return new He(t.firestore, e, t._key, r.isFoundDocument() ? r : null, t.converter);
|
|
5700
5700
|
}));
|
|
5701
5701
|
}
|
|
5702
5702
|
|
|
@@ -5713,31 +5713,31 @@ class vr extends class {
|
|
|
5713
5713
|
* @returns A Promise that will be resolved with the results of the query.
|
|
5714
5714
|
*/ function Er(t) {
|
|
5715
5715
|
!function(t) {
|
|
5716
|
-
if (
|
|
5717
|
-
}((t = ot(t,
|
|
5718
|
-
const
|
|
5719
|
-
return
|
|
5720
|
-
const r =
|
|
5721
|
-
return
|
|
5716
|
+
if (cn(t) && 0 === t.explicitOrderBy.length) throw new U(q, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
5717
|
+
}((t = ot(t, le))._query);
|
|
5718
|
+
const n = re(t.firestore), e = new vr(t.firestore);
|
|
5719
|
+
return ne(n, t._query).then((n => {
|
|
5720
|
+
const r = n.map((n => new Ke(t.firestore, e, n.key, n, t.converter)));
|
|
5721
|
+
return cn(t._query) &&
|
|
5722
5722
|
// Limit to last queries reverse the orderBy constraint that was
|
|
5723
5723
|
// specified by the user. As such, we need to reverse the order of the
|
|
5724
5724
|
// results to return the documents in the expected order.
|
|
5725
|
-
r.reverse(), new
|
|
5725
|
+
r.reverse(), new Je(t, r);
|
|
5726
5726
|
}));
|
|
5727
5727
|
}
|
|
5728
5728
|
|
|
5729
|
-
function Tr(t,
|
|
5730
|
-
const r = gr((t = ot(t,
|
|
5731
|
-
return
|
|
5729
|
+
function Tr(t, n, e) {
|
|
5730
|
+
const r = gr((t = ot(t, he)).converter, n, e), s = Ne(De(t.firestore), "setDoc", t._key, r, null !== t.converter, e);
|
|
5731
|
+
return Zn(re(t.firestore), [ s.toMutation(t._key, En.none()) ]);
|
|
5732
5732
|
}
|
|
5733
5733
|
|
|
5734
|
-
function Ir(t,
|
|
5735
|
-
const s =
|
|
5734
|
+
function Ir(t, n, e, ...r) {
|
|
5735
|
+
const s = De((t = ot(t, he)).firestore);
|
|
5736
5736
|
// For Compat types, we have to "extract" the underlying types before
|
|
5737
5737
|
// performing validation.
|
|
5738
5738
|
let i;
|
|
5739
|
-
i = "string" == typeof (
|
|
5740
|
-
return
|
|
5739
|
+
i = "string" == typeof (n = getModularInstance(n)) || n instanceof _e ? Le(s, "updateDoc", t._key, n, e, r) : Ce(s, "updateDoc", t._key, n);
|
|
5740
|
+
return Zn(re(t.firestore), [ i.toMutation(t._key, En.exists(!0)) ]);
|
|
5741
5741
|
}
|
|
5742
5742
|
|
|
5743
5743
|
/**
|
|
@@ -5752,7 +5752,7 @@ function Ir(t, e, n, ...r) {
|
|
|
5752
5752
|
* @returns A `Promise` resolved once the document has been successfully
|
|
5753
5753
|
* deleted from the backend.
|
|
5754
5754
|
*/ function Ar(t) {
|
|
5755
|
-
return
|
|
5755
|
+
return Zn(re((t = ot(t, he)).firestore), [ new Rn(t._key, En.none()) ]);
|
|
5756
5756
|
}
|
|
5757
5757
|
|
|
5758
5758
|
/**
|
|
@@ -5769,9 +5769,9 @@ function Ir(t, e, n, ...r) {
|
|
|
5769
5769
|
* @throws Error - If the provided input is not a valid Firestore document.
|
|
5770
5770
|
* @returns A `Promise` resolved with a `DocumentReference` pointing to the
|
|
5771
5771
|
* newly created document after it has been written to the backend.
|
|
5772
|
-
*/ function
|
|
5773
|
-
const
|
|
5774
|
-
return
|
|
5772
|
+
*/ function Rr(t, n) {
|
|
5773
|
+
const e = me(t = ot(t, fe)), r = gr(t.converter, n), s = Ne(De(t.firestore), "addDoc", e._key, r, null !== e.converter, {});
|
|
5774
|
+
return Zn(re(t.firestore), [ s.toMutation(e._key, En.exists(!1)) ]).then((() => e));
|
|
5775
5775
|
}
|
|
5776
5776
|
|
|
5777
5777
|
/**
|
|
@@ -5793,15 +5793,15 @@ function Ir(t, e, n, ...r) {
|
|
|
5793
5793
|
/**
|
|
5794
5794
|
* Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or
|
|
5795
5795
|
* {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion.
|
|
5796
|
-
*/ function
|
|
5797
|
-
return new $
|
|
5796
|
+
*/ function Pr() {
|
|
5797
|
+
return new $e("deleteField");
|
|
5798
5798
|
}
|
|
5799
5799
|
|
|
5800
5800
|
/**
|
|
5801
5801
|
* Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
|
|
5802
5802
|
* include a server-generated timestamp in the written data.
|
|
5803
5803
|
*/ function Vr() {
|
|
5804
|
-
return new
|
|
5804
|
+
return new Fe("serverTimestamp");
|
|
5805
5805
|
}
|
|
5806
5806
|
|
|
5807
5807
|
/**
|
|
@@ -5818,7 +5818,7 @@ function Ir(t, e, n, ...r) {
|
|
|
5818
5818
|
*/ function Dr(...t) {
|
|
5819
5819
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
5820
5820
|
// update() since we'd need the Firestore instance to do this.
|
|
5821
|
-
return new
|
|
5821
|
+
return new xe("arrayUnion", t);
|
|
5822
5822
|
}
|
|
5823
5823
|
|
|
5824
5824
|
/**
|
|
@@ -5834,7 +5834,7 @@ function Ir(t, e, n, ...r) {
|
|
|
5834
5834
|
*/ function Nr(...t) {
|
|
5835
5835
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
5836
5836
|
// update() since we'd need the Firestore instance to do this.
|
|
5837
|
-
return new
|
|
5837
|
+
return new qe("arrayRemove", t);
|
|
5838
5838
|
}
|
|
5839
5839
|
|
|
5840
5840
|
/**
|
|
@@ -5856,7 +5856,7 @@ function Ir(t, e, n, ...r) {
|
|
|
5856
5856
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5857
5857
|
* `updateDoc()`
|
|
5858
5858
|
*/ function $r(t) {
|
|
5859
|
-
return new
|
|
5859
|
+
return new Oe("increment", t);
|
|
5860
5860
|
}
|
|
5861
5861
|
|
|
5862
5862
|
/**
|
|
@@ -5882,25 +5882,25 @@ function Ir(t, e, n, ...r) {
|
|
|
5882
5882
|
* provides methods for adding writes to the write batch. None of the writes
|
|
5883
5883
|
* will be committed (or visible locally) until {@link WriteBatch.commit} is
|
|
5884
5884
|
* called.
|
|
5885
|
-
*/ class
|
|
5885
|
+
*/ class Sr {
|
|
5886
5886
|
/** @hideconstructor */
|
|
5887
|
-
constructor(t,
|
|
5888
|
-
this._firestore = t, this._commitHandler =
|
|
5889
|
-
this._dataReader =
|
|
5887
|
+
constructor(t, n) {
|
|
5888
|
+
this._firestore = t, this._commitHandler = n, this._mutations = [], this._committed = !1,
|
|
5889
|
+
this._dataReader = De(t);
|
|
5890
5890
|
}
|
|
5891
|
-
set(t,
|
|
5891
|
+
set(t, n, e) {
|
|
5892
5892
|
this._verifyNotCommitted();
|
|
5893
|
-
const r =
|
|
5894
|
-
return this._mutations.push(i.toMutation(r._key,
|
|
5893
|
+
const r = Fr(t, this._firestore), s = gr(r.converter, n, e), i = Ne(this._dataReader, "WriteBatch.set", r._key, s, null !== r.converter, e);
|
|
5894
|
+
return this._mutations.push(i.toMutation(r._key, En.none())), this;
|
|
5895
5895
|
}
|
|
5896
|
-
update(t,
|
|
5896
|
+
update(t, n, e, ...r) {
|
|
5897
5897
|
this._verifyNotCommitted();
|
|
5898
|
-
const s =
|
|
5898
|
+
const s = Fr(t, this._firestore);
|
|
5899
5899
|
// For Compat types, we have to "extract" the underlying types before
|
|
5900
5900
|
// performing validation.
|
|
5901
5901
|
let i;
|
|
5902
|
-
return i = "string" == typeof (
|
|
5903
|
-
this._mutations.push(i.toMutation(s._key,
|
|
5902
|
+
return i = "string" == typeof (n = getModularInstance(n)) || n instanceof _e ? Le(this._dataReader, "WriteBatch.update", s._key, n, e, r) : Ce(this._dataReader, "WriteBatch.update", s._key, n),
|
|
5903
|
+
this._mutations.push(i.toMutation(s._key, En.exists(!0))), this;
|
|
5904
5904
|
}
|
|
5905
5905
|
/**
|
|
5906
5906
|
* Deletes the document referred to by the provided {@link DocumentReference}.
|
|
@@ -5909,8 +5909,8 @@ function Ir(t, e, n, ...r) {
|
|
|
5909
5909
|
* @returns This `WriteBatch` instance. Used for chaining method calls.
|
|
5910
5910
|
*/ delete(t) {
|
|
5911
5911
|
this._verifyNotCommitted();
|
|
5912
|
-
const
|
|
5913
|
-
return this._mutations = this._mutations.concat(new
|
|
5912
|
+
const n = Fr(t, this._firestore);
|
|
5913
|
+
return this._mutations = this._mutations.concat(new Rn(n._key, En.none())), this;
|
|
5914
5914
|
}
|
|
5915
5915
|
/**
|
|
5916
5916
|
* Commits all of the writes in this write batch as a single atomic unit.
|
|
@@ -5927,12 +5927,12 @@ function Ir(t, e, n, ...r) {
|
|
|
5927
5927
|
return this._verifyNotCommitted(), this._committed = !0, this._mutations.length > 0 ? this._commitHandler(this._mutations) : Promise.resolve();
|
|
5928
5928
|
}
|
|
5929
5929
|
_verifyNotCommitted() {
|
|
5930
|
-
if (this._committed) throw new U(
|
|
5930
|
+
if (this._committed) throw new U(S, "A write batch can no longer be used after commit() has been called.");
|
|
5931
5931
|
}
|
|
5932
5932
|
}
|
|
5933
5933
|
|
|
5934
|
-
function
|
|
5935
|
-
if ((t = getModularInstance(t)).firestore !==
|
|
5934
|
+
function Fr(t, n) {
|
|
5935
|
+
if ((t = getModularInstance(t)).firestore !== n) throw new U(A, "Provided document reference is from a different Firestore instance.");
|
|
5936
5936
|
return t;
|
|
5937
5937
|
}
|
|
5938
5938
|
|
|
@@ -5949,8 +5949,8 @@ function Sr(t, e) {
|
|
|
5949
5949
|
* @returns A `WriteBatch` that can be used to atomically execute multiple
|
|
5950
5950
|
* writes.
|
|
5951
5951
|
*/ function xr(t) {
|
|
5952
|
-
const
|
|
5953
|
-
return new
|
|
5952
|
+
const n = re(t = ot(t, ie));
|
|
5953
|
+
return new Sr(t, (t => Zn(n, t)));
|
|
5954
5954
|
}
|
|
5955
5955
|
|
|
5956
5956
|
/**
|
|
@@ -5992,66 +5992,66 @@ function Sr(t, e) {
|
|
|
5992
5992
|
}
|
|
5993
5993
|
async lookup(t) {
|
|
5994
5994
|
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new U(A, "Firestore transactions require all reads to be executed before all writes.");
|
|
5995
|
-
const
|
|
5996
|
-
return
|
|
5995
|
+
const n = await te(this.datastore, t);
|
|
5996
|
+
return n.forEach((t => this.recordVersion(t))), n;
|
|
5997
5997
|
}
|
|
5998
|
-
set(t,
|
|
5999
|
-
this.write(
|
|
5998
|
+
set(t, n) {
|
|
5999
|
+
this.write(n.toMutation(t, this.precondition(t))), this.writtenDocs.add(t.toString());
|
|
6000
6000
|
}
|
|
6001
|
-
update(t,
|
|
6001
|
+
update(t, n) {
|
|
6002
6002
|
try {
|
|
6003
|
-
this.write(
|
|
6003
|
+
this.write(n.toMutation(t, this.preconditionForUpdate(t)));
|
|
6004
6004
|
} catch (t) {
|
|
6005
6005
|
this.lastWriteError = t;
|
|
6006
6006
|
}
|
|
6007
6007
|
this.writtenDocs.add(t.toString());
|
|
6008
6008
|
}
|
|
6009
6009
|
delete(t) {
|
|
6010
|
-
this.write(new
|
|
6010
|
+
this.write(new Rn(t, this.precondition(t))), this.writtenDocs.add(t.toString());
|
|
6011
6011
|
}
|
|
6012
6012
|
async commit() {
|
|
6013
6013
|
if (this.ensureCommitNotCalled(), this.lastWriteError) throw this.lastWriteError;
|
|
6014
6014
|
const t = this.readVersions;
|
|
6015
6015
|
// For each mutation, note that the doc was written.
|
|
6016
|
-
this.mutations.forEach((
|
|
6017
|
-
t.delete(
|
|
6016
|
+
this.mutations.forEach((n => {
|
|
6017
|
+
t.delete(n.key.toString());
|
|
6018
6018
|
})),
|
|
6019
6019
|
// For each document that was read but not written to, we want to perform
|
|
6020
6020
|
// a `verify` operation.
|
|
6021
|
-
t.forEach(((t,
|
|
6022
|
-
const
|
|
6023
|
-
this.mutations.push(new
|
|
6024
|
-
})), await
|
|
6021
|
+
t.forEach(((t, n) => {
|
|
6022
|
+
const e = nt.fromPath(n);
|
|
6023
|
+
this.mutations.push(new Pn(e, this.precondition(e)));
|
|
6024
|
+
})), await Zn(this.datastore, this.mutations), this.committed = !0;
|
|
6025
6025
|
}
|
|
6026
6026
|
recordVersion(t) {
|
|
6027
|
-
let
|
|
6028
|
-
if (t.isFoundDocument())
|
|
6027
|
+
let n;
|
|
6028
|
+
if (t.isFoundDocument()) n = t.version; else {
|
|
6029
6029
|
if (!t.isNoDocument()) throw g();
|
|
6030
6030
|
// For deleted docs, we must use baseVersion 0 when we overwrite them.
|
|
6031
|
-
|
|
6031
|
+
n = vt.min();
|
|
6032
6032
|
}
|
|
6033
|
-
const
|
|
6034
|
-
if (
|
|
6035
|
-
if (!
|
|
6033
|
+
const e = this.readVersions.get(t.key.toString());
|
|
6034
|
+
if (e) {
|
|
6035
|
+
if (!n.isEqual(e))
|
|
6036
6036
|
// This transaction will fail no matter what.
|
|
6037
|
-
throw new U(
|
|
6038
|
-
} else this.readVersions.set(t.key.toString(),
|
|
6037
|
+
throw new U(F, "Document version changed between two reads.");
|
|
6038
|
+
} else this.readVersions.set(t.key.toString(), n);
|
|
6039
6039
|
}
|
|
6040
6040
|
/**
|
|
6041
6041
|
* Returns the version of this document when it was read in this transaction,
|
|
6042
6042
|
* as a precondition, or no precondition if it was not read.
|
|
6043
6043
|
*/ precondition(t) {
|
|
6044
|
-
const
|
|
6045
|
-
return !this.writtenDocs.has(t.toString()) &&
|
|
6044
|
+
const n = this.readVersions.get(t.toString());
|
|
6045
|
+
return !this.writtenDocs.has(t.toString()) && n ? En.updateTime(n) : En.none();
|
|
6046
6046
|
}
|
|
6047
6047
|
/**
|
|
6048
6048
|
* Returns the precondition for a document if the operation is an update.
|
|
6049
6049
|
*/ preconditionForUpdate(t) {
|
|
6050
|
-
const
|
|
6050
|
+
const n = this.readVersions.get(t.toString());
|
|
6051
6051
|
// The first time a document is written, we want to take into account the
|
|
6052
6052
|
// read time and existence
|
|
6053
|
-
if (!this.writtenDocs.has(t.toString()) &&
|
|
6054
|
-
if (
|
|
6053
|
+
if (!this.writtenDocs.has(t.toString()) && n) {
|
|
6054
|
+
if (n.isEqual(vt.min()))
|
|
6055
6055
|
// The document doesn't exist, so fail the transaction.
|
|
6056
6056
|
// This has to be validated locally because you can't send a
|
|
6057
6057
|
// precondition that a document does not exist without changing the
|
|
@@ -6063,11 +6063,11 @@ function Sr(t, e) {
|
|
|
6063
6063
|
// transaction.
|
|
6064
6064
|
throw new U(A, "Can't update a document that doesn't exist.");
|
|
6065
6065
|
// Document exists, base precondition on document update time.
|
|
6066
|
-
return
|
|
6066
|
+
return En.updateTime(n);
|
|
6067
6067
|
}
|
|
6068
6068
|
// Document was not read, so we just use the preconditions for a blind
|
|
6069
6069
|
// update.
|
|
6070
|
-
return
|
|
6070
|
+
return En.exists(!0);
|
|
6071
6071
|
}
|
|
6072
6072
|
write(t) {
|
|
6073
6073
|
this.ensureCommitNotCalled(), this.mutations.push(t);
|
|
@@ -6096,38 +6096,38 @@ function Sr(t, e) {
|
|
|
6096
6096
|
* with backoff.
|
|
6097
6097
|
*/
|
|
6098
6098
|
class Or {
|
|
6099
|
-
constructor(t,
|
|
6100
|
-
this.asyncQueue = t, this.datastore =
|
|
6101
|
-
this.Tt = 5, this.It = new
|
|
6099
|
+
constructor(t, n, e, r) {
|
|
6100
|
+
this.asyncQueue = t, this.datastore = n, this.updateFunction = e, this.deferred = r,
|
|
6101
|
+
this.Tt = 5, this.It = new Jn(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
|
|
6102
6102
|
}
|
|
6103
6103
|
/** Runs the transaction and sets the result on deferred. */ run() {
|
|
6104
6104
|
this.Tt -= 1, this.At();
|
|
6105
6105
|
}
|
|
6106
6106
|
At() {
|
|
6107
6107
|
this.It.W((async () => {
|
|
6108
|
-
const t = new qr(this.datastore),
|
|
6109
|
-
|
|
6108
|
+
const t = new qr(this.datastore), n = this.Rt(t);
|
|
6109
|
+
n && n.then((n => {
|
|
6110
6110
|
this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
|
|
6111
|
-
this.deferred.resolve(
|
|
6111
|
+
this.deferred.resolve(n);
|
|
6112
6112
|
})).catch((t => {
|
|
6113
|
-
this.
|
|
6113
|
+
this.Pt(t);
|
|
6114
6114
|
}))));
|
|
6115
6115
|
})).catch((t => {
|
|
6116
|
-
this.
|
|
6116
|
+
this.Pt(t);
|
|
6117
6117
|
}));
|
|
6118
6118
|
}));
|
|
6119
6119
|
}
|
|
6120
|
-
|
|
6120
|
+
Rt(t) {
|
|
6121
6121
|
try {
|
|
6122
|
-
const
|
|
6123
|
-
return !ct(
|
|
6122
|
+
const n = this.updateFunction(t);
|
|
6123
|
+
return !ct(n) && n.catch && n.then ? n : (this.deferred.reject(Error("Transaction callback must return a Promise")),
|
|
6124
6124
|
null);
|
|
6125
6125
|
} catch (t) {
|
|
6126
6126
|
// Do not retry errors thrown by user provided updateFunction.
|
|
6127
6127
|
return this.deferred.reject(t), null;
|
|
6128
6128
|
}
|
|
6129
6129
|
}
|
|
6130
|
-
|
|
6130
|
+
Pt(t) {
|
|
6131
6131
|
this.Tt > 0 && this.Vt(t) ? (this.Tt -= 1, this.asyncQueue.enqueueAndForget((() => (this.At(),
|
|
6132
6132
|
Promise.resolve())))) : this.deferred.reject(t);
|
|
6133
6133
|
}
|
|
@@ -6135,8 +6135,8 @@ class Or {
|
|
|
6135
6135
|
if ("FirebaseError" === t.name) {
|
|
6136
6136
|
// In transactions, the backend will fail outdated reads with FAILED_PRECONDITION and
|
|
6137
6137
|
// non-matching document versions with ABORTED. These errors should be retried.
|
|
6138
|
-
const
|
|
6139
|
-
return "aborted" ===
|
|
6138
|
+
const n = t.code;
|
|
6139
|
+
return "aborted" === n || "failed-precondition" === n || !
|
|
6140
6140
|
/**
|
|
6141
6141
|
* Determines whether an error code represents a permanent error when received
|
|
6142
6142
|
* in response to a non-write operation.
|
|
@@ -6150,7 +6150,7 @@ class Or {
|
|
|
6150
6150
|
|
|
6151
6151
|
case T:
|
|
6152
6152
|
case I:
|
|
6153
|
-
case
|
|
6153
|
+
case R:
|
|
6154
6154
|
case $:
|
|
6155
6155
|
case O:
|
|
6156
6156
|
case C:
|
|
@@ -6160,20 +6160,20 @@ class Or {
|
|
|
6160
6160
|
return !1;
|
|
6161
6161
|
|
|
6162
6162
|
case A:
|
|
6163
|
-
case
|
|
6163
|
+
case P:
|
|
6164
6164
|
case V:
|
|
6165
6165
|
case D:
|
|
6166
|
-
case
|
|
6166
|
+
case S:
|
|
6167
6167
|
// Aborted might be retried in some scenarios, but that is dependant on
|
|
6168
6168
|
// the context and should handled individually by the calling code.
|
|
6169
6169
|
// See https://cloud.google.com/apis/design/errors.
|
|
6170
|
-
case
|
|
6170
|
+
case F:
|
|
6171
6171
|
case x:
|
|
6172
6172
|
case q:
|
|
6173
6173
|
case L:
|
|
6174
6174
|
return !0;
|
|
6175
6175
|
}
|
|
6176
|
-
}(
|
|
6176
|
+
}(n);
|
|
6177
6177
|
}
|
|
6178
6178
|
return !1;
|
|
6179
6179
|
}
|
|
@@ -6228,8 +6228,8 @@ class Or {
|
|
|
6228
6228
|
* in newer versions of TypeScript defines `finally`, which is not available in
|
|
6229
6229
|
* IE.
|
|
6230
6230
|
*/ class Lr {
|
|
6231
|
-
constructor(t,
|
|
6232
|
-
this.asyncQueue = t, this.timerId =
|
|
6231
|
+
constructor(t, n, e, r, s) {
|
|
6232
|
+
this.asyncQueue = t, this.timerId = n, this.targetTimeMs = e, this.op = r, this.removalCallback = s,
|
|
6233
6233
|
this.deferred = new k, this.then = this.deferred.promise.then.bind(this.deferred.promise),
|
|
6234
6234
|
// It's normal for the deferred promise to be canceled (due to cancellation)
|
|
6235
6235
|
// and so we attach a dummy catch callback to avoid
|
|
@@ -6249,9 +6249,9 @@ class Or {
|
|
|
6249
6249
|
* from its delayedOperations list.
|
|
6250
6250
|
* PORTING NOTE: This exists to prevent making removeDelayedOperation() and
|
|
6251
6251
|
* the DelayedOperation class public.
|
|
6252
|
-
*/ static createAndSchedule(t,
|
|
6253
|
-
const i = Date.now() +
|
|
6254
|
-
return o.start(
|
|
6252
|
+
*/ static createAndSchedule(t, n, e, r, s) {
|
|
6253
|
+
const i = Date.now() + e, o = new Lr(t, n, i, r, s);
|
|
6254
|
+
return o.start(e), o;
|
|
6255
6255
|
}
|
|
6256
6256
|
/**
|
|
6257
6257
|
* Starts the timer. This is called immediately after construction by
|
|
@@ -6311,9 +6311,9 @@ class Or {
|
|
|
6311
6311
|
this.$t = !1,
|
|
6312
6312
|
// Operations scheduled to be queued in the future. Operations are
|
|
6313
6313
|
// automatically removed after they are run or canceled.
|
|
6314
|
-
this.
|
|
6314
|
+
this.St = [],
|
|
6315
6315
|
// visible for testing
|
|
6316
|
-
this.
|
|
6316
|
+
this.Ft = null,
|
|
6317
6317
|
// Flag set while there's an outstanding AsyncQueue operation, used for
|
|
6318
6318
|
// assertion sanity-checks.
|
|
6319
6319
|
this.xt = !1,
|
|
@@ -6322,7 +6322,7 @@ class Or {
|
|
|
6322
6322
|
// List of TimerIds to fast-forward delays for.
|
|
6323
6323
|
this.Ot = [],
|
|
6324
6324
|
// Backoff timer used to schedule retries for retryable operations
|
|
6325
|
-
this.It = new
|
|
6325
|
+
this.It = new Jn(this, "async_queue_retry" /* AsyncQueueRetry */),
|
|
6326
6326
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
6327
6327
|
// operations. Meant to speed up recovery when we regain file system access
|
|
6328
6328
|
// after page comes into foreground.
|
|
@@ -6351,8 +6351,8 @@ class Or {
|
|
|
6351
6351
|
enterRestrictedMode(t) {
|
|
6352
6352
|
if (!this.$t) {
|
|
6353
6353
|
this.$t = !0, this.qt = t || !1;
|
|
6354
|
-
const
|
|
6355
|
-
|
|
6354
|
+
const n = Cr();
|
|
6355
|
+
n && "function" == typeof n.removeEventListener && n.removeEventListener("visibilitychange", this.Ct);
|
|
6356
6356
|
}
|
|
6357
6357
|
}
|
|
6358
6358
|
enqueue(t) {
|
|
@@ -6362,9 +6362,9 @@ class Or {
|
|
|
6362
6362
|
// Create a deferred Promise that we can return to the callee. This
|
|
6363
6363
|
// allows us to return a "hanging Promise" only to the callee and still
|
|
6364
6364
|
// advance the queue even when the operation is not run.
|
|
6365
|
-
const
|
|
6366
|
-
return this.Ut((() => this.$t && this.qt ? Promise.resolve() : (t().then(
|
|
6367
|
-
|
|
6365
|
+
const n = new k;
|
|
6366
|
+
return this.Ut((() => this.$t && this.qt ? Promise.resolve() : (t().then(n.resolve, n.reject),
|
|
6367
|
+
n.promise))).then((() => n.promise));
|
|
6368
6368
|
}
|
|
6369
6369
|
enqueueRetryable(t) {
|
|
6370
6370
|
this.enqueueAndForget((() => (this.Nt.push(t), this.kt())));
|
|
@@ -6434,18 +6434,18 @@ class Or {
|
|
|
6434
6434
|
}
|
|
6435
6435
|
}
|
|
6436
6436
|
Ut(t) {
|
|
6437
|
-
const
|
|
6438
|
-
this.
|
|
6439
|
-
const
|
|
6437
|
+
const n = this.Dt.then((() => (this.xt = !0, t().catch((t => {
|
|
6438
|
+
this.Ft = t, this.xt = !1;
|
|
6439
|
+
const n =
|
|
6440
6440
|
/**
|
|
6441
6441
|
* Chrome includes Error.message in Error.stack. Other browsers do not.
|
|
6442
6442
|
* This returns expected output of message + stack when available.
|
|
6443
6443
|
* @param error - Error or FirestoreError
|
|
6444
6444
|
*/
|
|
6445
6445
|
function(t) {
|
|
6446
|
-
let
|
|
6447
|
-
t.stack && (
|
|
6448
|
-
return
|
|
6446
|
+
let n = t.message || "";
|
|
6447
|
+
t.stack && (n = t.stack.includes(t.message) ? t.stack : t.message + "\n" + t.stack);
|
|
6448
|
+
return n;
|
|
6449
6449
|
}
|
|
6450
6450
|
/**
|
|
6451
6451
|
* @license
|
|
@@ -6475,19 +6475,19 @@ class Or {
|
|
|
6475
6475
|
// Re-throw the error so that this.tail becomes a rejected Promise and
|
|
6476
6476
|
// all further attempts to chain (via .then) will just short-circuit
|
|
6477
6477
|
// and return the rejected Promise.
|
|
6478
|
-
throw p("INTERNAL UNHANDLED ERROR: ",
|
|
6478
|
+
throw p("INTERNAL UNHANDLED ERROR: ", n), t;
|
|
6479
6479
|
})).then((t => (this.xt = !1, t))))));
|
|
6480
|
-
return this.Dt =
|
|
6480
|
+
return this.Dt = n, n;
|
|
6481
6481
|
}
|
|
6482
|
-
enqueueAfterDelay(t,
|
|
6482
|
+
enqueueAfterDelay(t, n, e) {
|
|
6483
6483
|
this.Lt(),
|
|
6484
6484
|
// Fast-forward delays for timerIds that have been overriden.
|
|
6485
|
-
this.Ot.indexOf(t) > -1 && (
|
|
6486
|
-
const r = Lr.createAndSchedule(this, t,
|
|
6487
|
-
return this.
|
|
6485
|
+
this.Ot.indexOf(t) > -1 && (n = 0);
|
|
6486
|
+
const r = Lr.createAndSchedule(this, t, n, e, (t => this.jt(t)));
|
|
6487
|
+
return this.St.push(r), r;
|
|
6488
6488
|
}
|
|
6489
6489
|
Lt() {
|
|
6490
|
-
this.
|
|
6490
|
+
this.Ft && g();
|
|
6491
6491
|
}
|
|
6492
6492
|
verifyOperationInProgress() {}
|
|
6493
6493
|
/**
|
|
@@ -6507,7 +6507,7 @@ class Or {
|
|
|
6507
6507
|
* For Tests: Determine if a delayed operation with a particular TimerId
|
|
6508
6508
|
* exists.
|
|
6509
6509
|
*/ Bt(t) {
|
|
6510
|
-
for (const
|
|
6510
|
+
for (const n of this.St) if (n.timerId === t) return !0;
|
|
6511
6511
|
return !1;
|
|
6512
6512
|
}
|
|
6513
6513
|
/**
|
|
@@ -6520,8 +6520,8 @@ class Or {
|
|
|
6520
6520
|
// Note that draining may generate more delayed ops, so we do that first.
|
|
6521
6521
|
return this.Mt().then((() => {
|
|
6522
6522
|
// Run ops in the same order they'd run if they ran naturally.
|
|
6523
|
-
this.
|
|
6524
|
-
for (const
|
|
6523
|
+
this.St.sort(((t, n) => t.targetTimeMs - n.targetTimeMs));
|
|
6524
|
+
for (const n of this.St) if (n.skipDelay(), "all" /* All */ !== t && n.timerId === t) break;
|
|
6525
6525
|
return this.Mt();
|
|
6526
6526
|
}));
|
|
6527
6527
|
}
|
|
@@ -6532,15 +6532,15 @@ class Or {
|
|
|
6532
6532
|
}
|
|
6533
6533
|
/** Called once a DelayedOperation is run or canceled. */ jt(t) {
|
|
6534
6534
|
// NOTE: indexOf / slice are O(n), but delayedOperations is expected to be small.
|
|
6535
|
-
const
|
|
6536
|
-
this.
|
|
6535
|
+
const n = this.St.indexOf(t);
|
|
6536
|
+
this.St.splice(n, 1);
|
|
6537
6537
|
}
|
|
6538
6538
|
}
|
|
6539
6539
|
|
|
6540
6540
|
class kr {
|
|
6541
6541
|
/** @hideconstructor */
|
|
6542
|
-
constructor(t,
|
|
6543
|
-
this._firestore = t, this._transaction =
|
|
6542
|
+
constructor(t, n) {
|
|
6543
|
+
this._firestore = t, this._transaction = n, this._dataReader = De(t);
|
|
6544
6544
|
}
|
|
6545
6545
|
/**
|
|
6546
6546
|
* Reads the document referenced by the provided {@link DocumentReference}.
|
|
@@ -6548,25 +6548,25 @@ class kr {
|
|
|
6548
6548
|
* @param documentRef - A reference to the document to be read.
|
|
6549
6549
|
* @returns A `DocumentSnapshot` with the read data.
|
|
6550
6550
|
*/ get(t) {
|
|
6551
|
-
const
|
|
6552
|
-
return this._transaction.lookup([
|
|
6551
|
+
const n = Fr(t, this._firestore), e = new vr(this._firestore);
|
|
6552
|
+
return this._transaction.lookup([ n._key ]).then((t => {
|
|
6553
6553
|
if (!t || 1 !== t.length) return g();
|
|
6554
6554
|
const r = t[0];
|
|
6555
|
-
if (r.isFoundDocument()) return new
|
|
6556
|
-
if (r.isNoDocument()) return new
|
|
6555
|
+
if (r.isFoundDocument()) return new He(this._firestore, e, r.key, r, n.converter);
|
|
6556
|
+
if (r.isNoDocument()) return new He(this._firestore, e, n._key, null, n.converter);
|
|
6557
6557
|
throw g();
|
|
6558
6558
|
}));
|
|
6559
6559
|
}
|
|
6560
|
-
set(t,
|
|
6561
|
-
const r =
|
|
6560
|
+
set(t, n, e) {
|
|
6561
|
+
const r = Fr(t, this._firestore), s = gr(r.converter, n, e), i = Ne(this._dataReader, "Transaction.set", r._key, s, null !== r.converter, e);
|
|
6562
6562
|
return this._transaction.set(r._key, i), this;
|
|
6563
6563
|
}
|
|
6564
|
-
update(t,
|
|
6565
|
-
const s =
|
|
6564
|
+
update(t, n, e, ...r) {
|
|
6565
|
+
const s = Fr(t, this._firestore);
|
|
6566
6566
|
// For Compat types, we have to "extract" the underlying types before
|
|
6567
6567
|
// performing validation.
|
|
6568
6568
|
let i;
|
|
6569
|
-
return i = "string" == typeof (
|
|
6569
|
+
return i = "string" == typeof (n = getModularInstance(n)) || n instanceof _e ? Le(this._dataReader, "Transaction.update", s._key, n, e, r) : Ce(this._dataReader, "Transaction.update", s._key, n),
|
|
6570
6570
|
this._transaction.update(s._key, i), this;
|
|
6571
6571
|
}
|
|
6572
6572
|
/**
|
|
@@ -6575,8 +6575,8 @@ class kr {
|
|
|
6575
6575
|
* @param documentRef - A reference to the document to be deleted.
|
|
6576
6576
|
* @returns This `Transaction` instance. Used for chaining method calls.
|
|
6577
6577
|
*/ delete(t) {
|
|
6578
|
-
const
|
|
6579
|
-
return this._transaction.delete(
|
|
6578
|
+
const n = Fr(t, this._firestore);
|
|
6579
|
+
return this._transaction.delete(n._key), this;
|
|
6580
6580
|
}
|
|
6581
6581
|
}
|
|
6582
6582
|
|
|
@@ -6596,9 +6596,9 @@ class kr {
|
|
|
6596
6596
|
* (the `updateFunction` returned a failed promise), the promise returned by the
|
|
6597
6597
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
6598
6598
|
* rejected promise with the corresponding failure error is returned.
|
|
6599
|
-
*/ function jr(t,
|
|
6600
|
-
const
|
|
6601
|
-
return new Or(new Ur,
|
|
6599
|
+
*/ function jr(t, n) {
|
|
6600
|
+
const e = re(t = ot(t, ie)), r = new k;
|
|
6601
|
+
return new Or(new Ur, e, (e => n(new kr(t, e))), r).run(), r.promise;
|
|
6602
6602
|
}
|
|
6603
6603
|
|
|
6604
6604
|
/**
|
|
@@ -6610,13 +6610,13 @@ class kr {
|
|
|
6610
6610
|
* @packageDocumentation
|
|
6611
6611
|
*/ !function(t) {
|
|
6612
6612
|
f = t;
|
|
6613
|
-
}(`${SDK_VERSION}_lite`), _registerComponent(new Component("firestore/lite", ((t, {options:
|
|
6614
|
-
const
|
|
6615
|
-
return
|
|
6613
|
+
}(`${SDK_VERSION}_lite`), _registerComponent(new Component("firestore/lite", ((t, {options: n}) => {
|
|
6614
|
+
const e = t.getProvider("app").getImmediate(), r = new ie(e, new z(t.getProvider("auth-internal")), new Y(t.getProvider("app-check-internal")));
|
|
6615
|
+
return n && r._setSettings(n), r;
|
|
6616
6616
|
}), "PUBLIC")),
|
|
6617
6617
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
6618
|
-
registerVersion("firestore-lite", "3.4.
|
|
6618
|
+
registerVersion("firestore-lite", "3.4.3", ""), registerVersion("firestore-lite", "3.4.3", "esm2017");
|
|
6619
6619
|
|
|
6620
|
-
export {
|
|
6620
|
+
export { ve as Bytes, fe as CollectionReference, he as DocumentReference, He as DocumentSnapshot, _e as FieldPath, be as FieldValue, ie as Firestore, U as FirestoreError, Ee as GeoPoint, le as Query, tr as QueryConstraint, Ke as QueryDocumentSnapshot, Je as QuerySnapshot, gt as Timestamp, kr as Transaction, Sr as WriteBatch, Rr as addDoc, Nr as arrayRemove, Dr as arrayUnion, de as collection, we as collectionGroup, ce as connectFirestoreEmulator, Ar as deleteDoc, Pr as deleteField, me as doc, ge as documentId, wr as endAt, dr as endBefore, br as getDoc, Er as getDocs, ue as getFirestore, $r as increment, oe as initializeFirestore, ur as limit, cr as limitToLast, ir as orderBy, nr as query, ye as queryEqual, pe as refEqual, jr as runTransaction, Vr as serverTimestamp, Tr as setDoc, w as setLogLevel, Xe as snapshotEqual, lr as startAfter, hr as startAt, ae as terminate, Ir as updateDoc, rr as where, xr as writeBatch };
|
|
6621
6621
|
|
|
6622
6622
|
//# sourceMappingURL=firebase-firestore-lite.js.map
|