@firebase/firestore 3.11.0 → 3.12.0-20230511201449
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/firestore/src/api/long_polling_options.d.ts +55 -0
- package/dist/firestore/src/api/settings.d.ts +16 -2
- package/dist/firestore/src/api.d.ts +1 -0
- package/dist/firestore/src/core/database_info.d.ts +4 -1
- package/dist/firestore/src/lite-api/settings.d.ts +3 -0
- package/dist/firestore/src/platform/browser/webchannel_connection.d.ts +1 -0
- package/dist/firestore/test/unit/api/long_polling_options.test.d.ts +17 -0
- package/dist/index.cjs.js +1222 -1181
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +61 -2
- package/dist/index.esm2017.js +1137 -1096
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +1041 -1021
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +71 -6
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +71 -6
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +868 -827
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +67 -3
- package/dist/lite/firestore/src/api/long_polling_options.d.ts +55 -0
- package/dist/lite/firestore/src/api/settings.d.ts +16 -2
- package/dist/lite/firestore/src/api.d.ts +1 -0
- package/dist/lite/firestore/src/core/database_info.d.ts +4 -1
- package/dist/lite/firestore/src/lite-api/settings.d.ts +3 -0
- package/dist/lite/firestore/src/platform/browser/webchannel_connection.d.ts +1 -0
- package/dist/lite/firestore/test/unit/api/long_polling_options.test.d.ts +17 -0
- package/dist/lite/index.browser.esm2017.js +756 -716
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +764 -745
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.cjs.js +756 -716
- package/dist/lite/index.cjs.js.map +1 -1
- package/dist/lite/index.node.cjs.js +71 -6
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +71 -6
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +763 -723
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +52 -1
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +127 -144
- package/dist/lite/packages/firestore/src/api/long_polling_options.d.ts +55 -0
- package/dist/lite/packages/firestore/src/api/settings.d.ts +16 -2
- package/dist/lite/packages/firestore/src/api.d.ts +1 -0
- package/dist/lite/packages/firestore/src/core/database_info.d.ts +4 -1
- package/dist/lite/packages/firestore/src/lite-api/settings.d.ts +3 -0
- package/dist/lite/packages/firestore/src/platform/browser/webchannel_connection.d.ts +1 -0
- package/dist/lite/packages/firestore/test/unit/api/long_polling_options.test.d.ts +17 -0
- package/dist/lite/private.d.ts +52 -1
- package/dist/packages/firestore/dist/index.esm2017.d.ts +275 -292
- package/dist/packages/firestore/src/api/long_polling_options.d.ts +55 -0
- package/dist/packages/firestore/src/api/settings.d.ts +16 -2
- package/dist/packages/firestore/src/api.d.ts +1 -0
- package/dist/packages/firestore/src/core/database_info.d.ts +4 -1
- package/dist/packages/firestore/src/lite-api/settings.d.ts +3 -0
- package/dist/packages/firestore/src/platform/browser/webchannel_connection.d.ts +1 -0
- package/dist/packages/firestore/test/unit/api/long_polling_options.test.d.ts +17 -0
- package/dist/private.d.ts +67 -3
- package/package.json +5 -5
|
@@ -67,7 +67,7 @@ v.MOCK_USER = new v("mock-user");
|
|
|
67
67
|
* See the License for the specific language governing permissions and
|
|
68
68
|
* limitations under the License.
|
|
69
69
|
*/
|
|
70
|
-
var g = "9.
|
|
70
|
+
var g = "9.22.0-20230511201449", w = new l("@firebase/firestore");
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
73
|
* @license
|
|
@@ -225,7 +225,7 @@ e) {
|
|
|
225
225
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
226
226
|
* See the License for the specific language governing permissions and
|
|
227
227
|
* limitations under the License.
|
|
228
|
-
*/ var
|
|
228
|
+
*/ var P = "cancelled", F = "unknown", O = "invalid-argument", V = "deadline-exceeded", D = "not-found", N = "permission-denied", q = "unauthenticated", R = "resource-exhausted", x = "failed-precondition", C = "aborted", j = "out-of-range", L = "unimplemented", M = "internal", U = "unavailable", B = /** @class */ function(e) {
|
|
229
229
|
/** @hideconstructor */
|
|
230
230
|
function n(
|
|
231
231
|
/**
|
|
@@ -364,12 +364,14 @@ e) {
|
|
|
364
364
|
* when using WebChannel as the network transport.
|
|
365
365
|
* @param autoDetectLongPolling - Whether to use the detectBufferingProxy
|
|
366
366
|
* option when using WebChannel as the network transport.
|
|
367
|
+
* @param longPollingOptions Options that configure long-polling.
|
|
367
368
|
* @param useFetchStreams Whether to use the Fetch API instead of
|
|
368
369
|
* XMLHTTPRequest
|
|
369
370
|
*/
|
|
370
|
-
function(t, e, n, r, i, o, a, u) {
|
|
371
|
+
function(t, e, n, r, i, o, a, u, s) {
|
|
371
372
|
this.databaseId = t, this.appId = e, this.persistenceKey = n, this.host = r, this.ssl = i,
|
|
372
|
-
this.forceLongPolling = o, this.autoDetectLongPolling = a, this.
|
|
373
|
+
this.forceLongPolling = o, this.autoDetectLongPolling = a, this.longPollingOptions = u,
|
|
374
|
+
this.useFetchStreams = s;
|
|
373
375
|
}, Z = /** @class */ function() {
|
|
374
376
|
function t(t, e) {
|
|
375
377
|
this.projectId = t, this.database = e || "(default)";
|
|
@@ -464,7 +466,7 @@ function(t, e, n, r, i, o, a, u) {
|
|
|
464
466
|
// for legacy reasons and should not be used frequently).
|
|
465
467
|
for (var r = [], i = 0, o = t; i < o.length; i++) {
|
|
466
468
|
var a = o[i];
|
|
467
|
-
if (a.indexOf("//") >= 0) throw new B(
|
|
469
|
+
if (a.indexOf("//") >= 0) throw new B(O, "Invalid segment (".concat(a, "). Paths must not contain // in them."));
|
|
468
470
|
// Strip leading and traling slashed.
|
|
469
471
|
r.push.apply(r, a.split("/").filter((function(t) {
|
|
470
472
|
return t.length > 0;
|
|
@@ -519,18 +521,18 @@ function(t, e, n, r, i, o, a, u) {
|
|
|
519
521
|
*/
|
|
520
522
|
n.fromServerFormat = function(t) {
|
|
521
523
|
for (var e = [], r = "", i = 0, o = function() {
|
|
522
|
-
if (0 === r.length) throw new B(
|
|
524
|
+
if (0 === r.length) throw new B(O, "Invalid field path (".concat(t, "). Paths must not be empty, begin with '.', end with '.', or contain '..'"));
|
|
523
525
|
e.push(r), r = "";
|
|
524
526
|
}, a = !1; i < t.length; ) {
|
|
525
527
|
var u = t[i];
|
|
526
528
|
if ("\\" === u) {
|
|
527
|
-
if (i + 1 === t.length) throw new B(
|
|
529
|
+
if (i + 1 === t.length) throw new B(O, "Path has trailing escape character: " + t);
|
|
528
530
|
var s = t[i + 1];
|
|
529
|
-
if ("\\" !== s && "." !== s && "`" !== s) throw new B(
|
|
531
|
+
if ("\\" !== s && "." !== s && "`" !== s) throw new B(O, "Path has invalid escape sequence: " + t);
|
|
530
532
|
r += s, i += 2;
|
|
531
533
|
} else "`" === u ? (a = !a, i++) : "." !== u || a ? (r += u, i++) : (o(), i++);
|
|
532
534
|
}
|
|
533
|
-
if (o(), a) throw new B(
|
|
535
|
+
if (o(), a) throw new B(O, "Unterminated ` in path: " + t);
|
|
534
536
|
return new n(e);
|
|
535
537
|
}, n.emptyPath = function() {
|
|
536
538
|
return new n([]);
|
|
@@ -598,7 +600,7 @@ function(t, e, n, r, i, o, a, u) {
|
|
|
598
600
|
* limitations under the License.
|
|
599
601
|
*/
|
|
600
602
|
function ot(t, e, n) {
|
|
601
|
-
if (!n) throw new B(
|
|
603
|
+
if (!n) throw new B(O, "Function ".concat(t, "() cannot be called with an empty ").concat(e, "."));
|
|
602
604
|
}
|
|
603
605
|
|
|
604
606
|
/**
|
|
@@ -609,14 +611,14 @@ function ot(t, e, n) {
|
|
|
609
611
|
* Validates that `path` refers to a document (indicated by the fact it contains
|
|
610
612
|
* an even numbers of segments).
|
|
611
613
|
*/ function at(t) {
|
|
612
|
-
if (!it.isDocumentKey(t)) throw new B(
|
|
614
|
+
if (!it.isDocumentKey(t)) throw new B(O, "Invalid document reference. Document references must have an even number of segments, but ".concat(t, " has ").concat(t.length, "."));
|
|
613
615
|
}
|
|
614
616
|
|
|
615
617
|
/**
|
|
616
618
|
* Validates that `path` refers to a collection (indicated by the fact it
|
|
617
619
|
* contains an odd numbers of segments).
|
|
618
620
|
*/ function ut(t) {
|
|
619
|
-
if (it.isDocumentKey(t)) throw new B(
|
|
621
|
+
if (it.isDocumentKey(t)) throw new B(O, "Invalid collection reference. Collection references must have an odd number of segments, but ".concat(t, " has ").concat(t.length, "."));
|
|
620
622
|
}
|
|
621
623
|
|
|
622
624
|
/**
|
|
@@ -648,15 +650,15 @@ e) {
|
|
|
648
650
|
// Unwrap Compat types
|
|
649
651
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
650
652
|
t = t._delegate), !(t instanceof e)) {
|
|
651
|
-
if (e.name === t.constructor.name) throw new B(
|
|
653
|
+
if (e.name === t.constructor.name) throw new B(O, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
|
|
652
654
|
var n = st(t);
|
|
653
|
-
throw new B(
|
|
655
|
+
throw new B(O, "Expected type '".concat(e.name, "', but it was: ").concat(n));
|
|
654
656
|
}
|
|
655
657
|
return t;
|
|
656
658
|
}
|
|
657
659
|
|
|
658
660
|
function lt(t, e) {
|
|
659
|
-
if (e <= 0) throw new B(
|
|
661
|
+
if (e <= 0) throw new B(O, "Function ".concat(t, "() requires a positive number, but it was: ").concat(e, "."));
|
|
660
662
|
}
|
|
661
663
|
|
|
662
664
|
/**
|
|
@@ -676,9 +678,37 @@ function lt(t, e) {
|
|
|
676
678
|
* limitations under the License.
|
|
677
679
|
*/
|
|
678
680
|
/**
|
|
681
|
+
* Compares two `ExperimentalLongPollingOptions` objects for equality.
|
|
682
|
+
*/
|
|
683
|
+
/**
|
|
684
|
+
* Creates and returns a new `ExperimentalLongPollingOptions` with the same
|
|
685
|
+
* option values as the given instance.
|
|
686
|
+
*/ function ft(t) {
|
|
687
|
+
var e = {};
|
|
688
|
+
return void 0 !== t.timeoutSeconds && (e.timeoutSeconds = t.timeoutSeconds), e
|
|
689
|
+
/**
|
|
690
|
+
* @license
|
|
691
|
+
* Copyright 2023 Google LLC
|
|
692
|
+
*
|
|
693
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
694
|
+
* you may not use this file except in compliance with the License.
|
|
695
|
+
* You may obtain a copy of the License at
|
|
696
|
+
*
|
|
697
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
698
|
+
*
|
|
699
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
700
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
701
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
702
|
+
* See the License for the specific language governing permissions and
|
|
703
|
+
* limitations under the License.
|
|
704
|
+
*/
|
|
705
|
+
/**
|
|
679
706
|
* The value returned from the most recent invocation of
|
|
680
707
|
* `generateUniqueDebugId()`, or null if it has never been invoked.
|
|
681
|
-
|
|
708
|
+
*/;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
var ht = null;
|
|
682
712
|
|
|
683
713
|
/**
|
|
684
714
|
* Generates and returns an initial value for `lastUniqueDebugId`.
|
|
@@ -721,11 +751,11 @@ function lt(t, e) {
|
|
|
721
751
|
/**
|
|
722
752
|
* Returns whether a variable is either undefined or null.
|
|
723
753
|
*/
|
|
724
|
-
function
|
|
754
|
+
function pt(t) {
|
|
725
755
|
return null == t;
|
|
726
756
|
}
|
|
727
757
|
|
|
728
|
-
/** Returns whether the value represents -0. */ function
|
|
758
|
+
/** Returns whether the value represents -0. */ function dt(t) {
|
|
729
759
|
// Detect if the value is -0.0. Based on polyfill from
|
|
730
760
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
731
761
|
return 0 === t && 1 / t == -1 / 0;
|
|
@@ -750,7 +780,7 @@ function ht(t) {
|
|
|
750
780
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
751
781
|
* See the License for the specific language governing permissions and
|
|
752
782
|
* limitations under the License.
|
|
753
|
-
*/ var
|
|
783
|
+
*/ var yt, mt, vt = {
|
|
754
784
|
BatchGetDocuments: "batchGet",
|
|
755
785
|
Commit: "commit",
|
|
756
786
|
RunQuery: "runQuery",
|
|
@@ -795,8 +825,8 @@ function ht(t) {
|
|
|
795
825
|
* @returns The equivalent Code. Unknown status codes are mapped to
|
|
796
826
|
* Code.UNKNOWN.
|
|
797
827
|
*/
|
|
798
|
-
function
|
|
799
|
-
if (void 0 === t) return T("RPC_ERROR", "HTTP error has no status"),
|
|
828
|
+
function gt(t) {
|
|
829
|
+
if (void 0 === t) return T("RPC_ERROR", "HTTP error has no status"), F;
|
|
800
830
|
// The canonical error codes for Google APIs [1] specify mapping onto HTTP
|
|
801
831
|
// status codes but the mapping is not bijective. In each case of ambiguity
|
|
802
832
|
// this function chooses a primary error.
|
|
@@ -809,7 +839,7 @@ function vt(t) {
|
|
|
809
839
|
|
|
810
840
|
case 400:
|
|
811
841
|
// Bad Request
|
|
812
|
-
return
|
|
842
|
+
return x;
|
|
813
843
|
|
|
814
844
|
// Other possibilities based on the forward mapping
|
|
815
845
|
// return Code.INVALID_ARGUMENT;
|
|
@@ -824,11 +854,11 @@ function vt(t) {
|
|
|
824
854
|
|
|
825
855
|
case 404:
|
|
826
856
|
// Not Found
|
|
827
|
-
return
|
|
857
|
+
return D;
|
|
828
858
|
|
|
829
859
|
case 409:
|
|
830
860
|
// Conflict
|
|
831
|
-
return
|
|
861
|
+
return C;
|
|
832
862
|
|
|
833
863
|
// Other possibilities:
|
|
834
864
|
// return Code.ALREADY_EXISTS;
|
|
@@ -842,11 +872,11 @@ function vt(t) {
|
|
|
842
872
|
|
|
843
873
|
case 499:
|
|
844
874
|
// Client Closed Request
|
|
845
|
-
return
|
|
875
|
+
return P;
|
|
846
876
|
|
|
847
877
|
case 500:
|
|
848
878
|
// Internal Server Error
|
|
849
|
-
return
|
|
879
|
+
return F;
|
|
850
880
|
|
|
851
881
|
// Other possibilities:
|
|
852
882
|
// return Code.INTERNAL;
|
|
@@ -861,10 +891,10 @@ function vt(t) {
|
|
|
861
891
|
|
|
862
892
|
case 504:
|
|
863
893
|
// Gateway Timeout
|
|
864
|
-
return
|
|
894
|
+
return V;
|
|
865
895
|
|
|
866
896
|
default:
|
|
867
|
-
return t >= 200 && t < 300 ? "ok" : t >= 400 && t < 500 ?
|
|
897
|
+
return t >= 200 && t < 300 ? "ok" : t >= 400 && t < 500 ? x : t >= 500 && t < 600 ? M : F;
|
|
868
898
|
}
|
|
869
899
|
}
|
|
870
900
|
|
|
@@ -887,16 +917,16 @@ function vt(t) {
|
|
|
887
917
|
/**
|
|
888
918
|
* A Rest-based connection that relies on the native HTTP stack
|
|
889
919
|
* (e.g. `fetch` or a polyfill).
|
|
890
|
-
*/ (
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
var
|
|
920
|
+
*/ (mt = yt || (yt = {}))[mt.OK = 0] = "OK", mt[mt.CANCELLED = 1] = "CANCELLED",
|
|
921
|
+
mt[mt.UNKNOWN = 2] = "UNKNOWN", mt[mt.INVALID_ARGUMENT = 3] = "INVALID_ARGUMENT",
|
|
922
|
+
mt[mt.DEADLINE_EXCEEDED = 4] = "DEADLINE_EXCEEDED", mt[mt.NOT_FOUND = 5] = "NOT_FOUND",
|
|
923
|
+
mt[mt.ALREADY_EXISTS = 6] = "ALREADY_EXISTS", mt[mt.PERMISSION_DENIED = 7] = "PERMISSION_DENIED",
|
|
924
|
+
mt[mt.UNAUTHENTICATED = 16] = "UNAUTHENTICATED", mt[mt.RESOURCE_EXHAUSTED = 8] = "RESOURCE_EXHAUSTED",
|
|
925
|
+
mt[mt.FAILED_PRECONDITION = 9] = "FAILED_PRECONDITION", mt[mt.ABORTED = 10] = "ABORTED",
|
|
926
|
+
mt[mt.OUT_OF_RANGE = 11] = "OUT_OF_RANGE", mt[mt.UNIMPLEMENTED = 12] = "UNIMPLEMENTED",
|
|
927
|
+
mt[mt.INTERNAL = 13] = "INTERNAL", mt[mt.UNAVAILABLE = 14] = "UNAVAILABLE", mt[mt.DATA_LOSS = 15] = "DATA_LOSS";
|
|
928
|
+
|
|
929
|
+
var wt = /** @class */ function(r) {
|
|
900
930
|
/**
|
|
901
931
|
* @param databaseInfo - The connection info.
|
|
902
932
|
* @param fetchImpl - `fetch` or a Polyfill that implements the fetch API.
|
|
@@ -930,14 +960,14 @@ var gt = /** @class */ function(r) {
|
|
|
930
960
|
return a = n.sent(), [ 3 /*break*/ , 4 ];
|
|
931
961
|
|
|
932
962
|
case 3:
|
|
933
|
-
throw u = n.sent(), new B(
|
|
963
|
+
throw u = n.sent(), new B(gt((s = u).status), "Request failed with error: " + s.statusText);
|
|
934
964
|
|
|
935
965
|
case 4:
|
|
936
966
|
return a.ok ? [ 3 /*break*/ , 6 ] : [ 4 /*yield*/ , a.json() ];
|
|
937
967
|
|
|
938
968
|
case 5:
|
|
939
969
|
throw c = n.sent(), Array.isArray(c) && (c = c[0]), l = null === (t = null == c ? void 0 : c.error) || void 0 === t ? void 0 : t.message,
|
|
940
|
-
new B(
|
|
970
|
+
new B(gt(a.status), "Request failed with error: ".concat(null != l ? l : a.statusText));
|
|
941
971
|
|
|
942
972
|
case 6:
|
|
943
973
|
return [ 2 /*return*/ , a.json() ];
|
|
@@ -960,8 +990,8 @@ var gt = /** @class */ function(r) {
|
|
|
960
990
|
enumerable: !1,
|
|
961
991
|
configurable: !0
|
|
962
992
|
}), t.prototype.v = function(t, e, n, r, i) {
|
|
963
|
-
var o = (null ===
|
|
964
|
-
"0x" +
|
|
993
|
+
var o = (null === ht ? ht = 268435456 + Math.round(2147483648 * Math.random()) : ht++,
|
|
994
|
+
"0x" + ht.toString(16)), a = this.I(t, e);
|
|
965
995
|
b("RestConnection", "Sending RPC '".concat(t, "' ").concat(o, ":"), a, n);
|
|
966
996
|
var u = {};
|
|
967
997
|
return this.T(u, r, i), this.A(t, a, u, n).then((function(e) {
|
|
@@ -993,10 +1023,10 @@ var gt = /** @class */ function(r) {
|
|
|
993
1023
|
return t[n] = e;
|
|
994
1024
|
}));
|
|
995
1025
|
}, t.prototype.I = function(t, e) {
|
|
996
|
-
var n =
|
|
1026
|
+
var n = vt[t];
|
|
997
1027
|
return "".concat(this.m, "/v1/").concat(e, ":").concat(n);
|
|
998
1028
|
}, t;
|
|
999
|
-
}()),
|
|
1029
|
+
}()), _t = function(t, e, n) {
|
|
1000
1030
|
this.alias = t, this.$ = e, this.fieldPath = n;
|
|
1001
1031
|
};
|
|
1002
1032
|
|
|
@@ -1057,7 +1087,7 @@ var gt = /** @class */ function(r) {
|
|
|
1057
1087
|
*
|
|
1058
1088
|
* If `nBytes < 0` , an error will be thrown.
|
|
1059
1089
|
*/
|
|
1060
|
-
function
|
|
1090
|
+
function bt(t) {
|
|
1061
1091
|
// Polyfills for IE and WebWorker by using `self` and `msCrypto` when `crypto` is not available.
|
|
1062
1092
|
var e =
|
|
1063
1093
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -1083,14 +1113,14 @@ function _t(t) {
|
|
|
1083
1113
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1084
1114
|
* See the License for the specific language governing permissions and
|
|
1085
1115
|
* limitations under the License.
|
|
1086
|
-
*/ var
|
|
1116
|
+
*/ var Tt = /** @class */ function() {
|
|
1087
1117
|
function t() {}
|
|
1088
|
-
return t.
|
|
1118
|
+
return t.N = function() {
|
|
1089
1119
|
for (
|
|
1090
1120
|
// Alphanumeric characters
|
|
1091
1121
|
var t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", e = Math.floor(256 / t.length) * t.length, n = ""
|
|
1092
1122
|
// The largest byte value that is a multiple of `char.length`.
|
|
1093
|
-
; n.length < 20; ) for (var r =
|
|
1123
|
+
; n.length < 20; ) for (var r = bt(40), i = 0; i < r.length; ++i)
|
|
1094
1124
|
// Only accept values that are [0, maxMultiple), this ensures they can
|
|
1095
1125
|
// be evenly mapped to indices of `chars` via a modulo operation.
|
|
1096
1126
|
n.length < 20 && r[i] < e && (n += t.charAt(r[i] % t.length));
|
|
@@ -1098,11 +1128,11 @@ function _t(t) {
|
|
|
1098
1128
|
}, t;
|
|
1099
1129
|
}();
|
|
1100
1130
|
|
|
1101
|
-
function
|
|
1131
|
+
function Et(t, e) {
|
|
1102
1132
|
return t < e ? -1 : t > e ? 1 : 0;
|
|
1103
1133
|
}
|
|
1104
1134
|
|
|
1105
|
-
/** Helper to compare arrays using isEqual(). */ function
|
|
1135
|
+
/** Helper to compare arrays using isEqual(). */ function St(t, e, n) {
|
|
1106
1136
|
return t.length === e.length && t.every((function(t, r) {
|
|
1107
1137
|
return n(t, e[r]);
|
|
1108
1138
|
}));
|
|
@@ -1123,13 +1153,13 @@ function Tt(t, e) {
|
|
|
1123
1153
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1124
1154
|
* See the License for the specific language governing permissions and
|
|
1125
1155
|
* limitations under the License.
|
|
1126
|
-
*/ function
|
|
1156
|
+
*/ function kt(t) {
|
|
1127
1157
|
var e = 0;
|
|
1128
1158
|
for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e++;
|
|
1129
1159
|
return e;
|
|
1130
1160
|
}
|
|
1131
1161
|
|
|
1132
|
-
function
|
|
1162
|
+
function It(t, e) {
|
|
1133
1163
|
for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e(n, t[n]);
|
|
1134
1164
|
}
|
|
1135
1165
|
|
|
@@ -1151,13 +1181,13 @@ function kt(t, e) {
|
|
|
1151
1181
|
*/
|
|
1152
1182
|
/**
|
|
1153
1183
|
* An error encountered while decoding base64 string.
|
|
1154
|
-
*/ var
|
|
1184
|
+
*/ var At = /** @class */ function(e) {
|
|
1155
1185
|
function n() {
|
|
1156
1186
|
var t = this;
|
|
1157
1187
|
return (t = e.apply(this, arguments) || this).name = "Base64DecodeError", t;
|
|
1158
1188
|
}
|
|
1159
1189
|
return t(n, e), n;
|
|
1160
|
-
}(Error),
|
|
1190
|
+
}(Error), Pt = /** @class */ function() {
|
|
1161
1191
|
function t(t) {
|
|
1162
1192
|
this.binaryString = t;
|
|
1163
1193
|
}
|
|
@@ -1169,7 +1199,7 @@ function kt(t, e) {
|
|
|
1169
1199
|
// Check that `DOMException` is defined before using it to avoid
|
|
1170
1200
|
// "ReferenceError: Property 'DOMException' doesn't exist" in react-native.
|
|
1171
1201
|
// (https://github.com/firebase/firebase-js-sdk/issues/7115)
|
|
1172
|
-
throw "undefined" != typeof DOMException && t instanceof DOMException ? new
|
|
1202
|
+
throw "undefined" != typeof DOMException && t instanceof DOMException ? new At("Invalid base64 string: " + t) : t;
|
|
1173
1203
|
}
|
|
1174
1204
|
}(e);
|
|
1175
1205
|
return new t(n);
|
|
@@ -1209,7 +1239,7 @@ function kt(t, e) {
|
|
|
1209
1239
|
}, t.prototype.approximateByteSize = function() {
|
|
1210
1240
|
return 2 * this.binaryString.length;
|
|
1211
1241
|
}, t.prototype.compareTo = function(t) {
|
|
1212
|
-
return
|
|
1242
|
+
return Et(this.binaryString, t.binaryString);
|
|
1213
1243
|
}, t.prototype.isEqual = function(t) {
|
|
1214
1244
|
return this.binaryString === t.binaryString;
|
|
1215
1245
|
}, t;
|
|
@@ -1256,14 +1286,14 @@ function kt(t, e) {
|
|
|
1256
1286
|
* the proto byte string in a common class that must be converted into a string
|
|
1257
1287
|
* before being sent as a proto.
|
|
1258
1288
|
* @internal
|
|
1259
|
-
*/
|
|
1289
|
+
*/ Pt.EMPTY_BYTE_STRING = new Pt("");
|
|
1260
1290
|
|
|
1261
1291
|
var Ft = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
1262
1292
|
|
|
1263
1293
|
/**
|
|
1264
1294
|
* Converts the possible Proto values for a timestamp value into a "seconds and
|
|
1265
1295
|
* nanos" representation.
|
|
1266
|
-
*/ function
|
|
1296
|
+
*/ function Ot(t) {
|
|
1267
1297
|
// The json interface (for the browser) will return an iso timestamp string,
|
|
1268
1298
|
// while the proto js library (for node) will return a
|
|
1269
1299
|
// google.protobuf.Timestamp instance.
|
|
@@ -1299,7 +1329,7 @@ var Ft = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1299
1329
|
}
|
|
1300
1330
|
|
|
1301
1331
|
/** Converts the possible Proto types for Blobs into a ByteString. */ function Dt(t) {
|
|
1302
|
-
return "string" == typeof t ?
|
|
1332
|
+
return "string" == typeof t ? Pt.fromBase64String(t) : Pt.fromUint8Array(t);
|
|
1303
1333
|
}
|
|
1304
1334
|
|
|
1305
1335
|
/**
|
|
@@ -1332,7 +1362,7 @@ var Ft = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1332
1362
|
*
|
|
1333
1363
|
* For examples and further specifications, refer to the
|
|
1334
1364
|
* {@link https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto | Timestamp definition}.
|
|
1335
|
-
*/ var
|
|
1365
|
+
*/ var Nt = /** @class */ function() {
|
|
1336
1366
|
/**
|
|
1337
1367
|
* Creates a new timestamp.
|
|
1338
1368
|
*
|
|
@@ -1353,11 +1383,11 @@ var Ft = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1353
1383
|
* The fractions of a second at nanosecond resolution.*
|
|
1354
1384
|
*/
|
|
1355
1385
|
e) {
|
|
1356
|
-
if (this.seconds = t, this.nanoseconds = e, e < 0) throw new B(
|
|
1357
|
-
if (e >= 1e9) throw new B(
|
|
1358
|
-
if (t < -62135596800) throw new B(
|
|
1386
|
+
if (this.seconds = t, this.nanoseconds = e, e < 0) throw new B(O, "Timestamp nanoseconds out of range: " + e);
|
|
1387
|
+
if (e >= 1e9) throw new B(O, "Timestamp nanoseconds out of range: " + e);
|
|
1388
|
+
if (t < -62135596800) throw new B(O, "Timestamp seconds out of range: " + t);
|
|
1359
1389
|
// This will break in the year 10,000.
|
|
1360
|
-
if (t >= 253402300800) throw new B(
|
|
1390
|
+
if (t >= 253402300800) throw new B(O, "Timestamp seconds out of range: " + t);
|
|
1361
1391
|
}
|
|
1362
1392
|
/**
|
|
1363
1393
|
* Creates a new timestamp with the current date, with millisecond precision.
|
|
@@ -1409,7 +1439,7 @@ var Ft = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1409
1439
|
t.prototype.toMillis = function() {
|
|
1410
1440
|
return 1e3 * this.seconds + this.nanoseconds / 1e6;
|
|
1411
1441
|
}, t.prototype._compareTo = function(t) {
|
|
1412
|
-
return this.seconds === t.seconds ?
|
|
1442
|
+
return this.seconds === t.seconds ? Et(this.nanoseconds, t.nanoseconds) : Et(this.seconds, t.seconds);
|
|
1413
1443
|
},
|
|
1414
1444
|
/**
|
|
1415
1445
|
* Returns true if this `Timestamp` is equal to the provided one.
|
|
@@ -1481,7 +1511,7 @@ var Ft = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1481
1511
|
* FieldValueOptions to value().
|
|
1482
1512
|
* - With respect to other ServerTimestampValues, they sort by their
|
|
1483
1513
|
* localWriteTime.
|
|
1484
|
-
*/ function
|
|
1514
|
+
*/ function qt(t) {
|
|
1485
1515
|
var e, n;
|
|
1486
1516
|
return "server_timestamp" === (null === (n = ((null === (e = null == t ? void 0 : t.mapValue) || void 0 === e ? void 0 : e.fields) || {}).__type__) || void 0 === n ? void 0 : n.stringValue);
|
|
1487
1517
|
}
|
|
@@ -1491,16 +1521,16 @@ var Ft = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1491
1521
|
*
|
|
1492
1522
|
* Preserving the previous values allows the user to display the last resoled
|
|
1493
1523
|
* value until the backend responds with the timestamp.
|
|
1494
|
-
*/ function
|
|
1524
|
+
*/ function Rt(t) {
|
|
1495
1525
|
var e = t.mapValue.fields.__previous_value__;
|
|
1496
|
-
return
|
|
1526
|
+
return qt(e) ? Rt(e) : e;
|
|
1497
1527
|
}
|
|
1498
1528
|
|
|
1499
1529
|
/**
|
|
1500
1530
|
* Returns the local time at which this timestamp was first set.
|
|
1501
|
-
*/ function
|
|
1502
|
-
var e =
|
|
1503
|
-
return new
|
|
1531
|
+
*/ function xt(t) {
|
|
1532
|
+
var e = Ot(t.mapValue.fields.__local_write_time__.timestampValue);
|
|
1533
|
+
return new Nt(e.seconds, e.nanos);
|
|
1504
1534
|
}
|
|
1505
1535
|
|
|
1506
1536
|
/**
|
|
@@ -1526,18 +1556,18 @@ var Ft = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1526
1556
|
}
|
|
1527
1557
|
};
|
|
1528
1558
|
|
|
1529
|
-
/** Extracts the backend's type order for the provided value. */ function
|
|
1530
|
-
return "nullValue" in t ? 0 /* TypeOrder.NullValue */ : "booleanValue" in t ? 1 /* TypeOrder.BooleanValue */ : "integerValue" in t || "doubleValue" in t ? 2 /* TypeOrder.NumberValue */ : "timestampValue" in t ? 3 /* TypeOrder.TimestampValue */ : "stringValue" in t ? 5 /* TypeOrder.StringValue */ : "bytesValue" in t ? 6 /* TypeOrder.BlobValue */ : "referenceValue" in t ? 7 /* TypeOrder.RefValue */ : "geoPointValue" in t ? 8 /* TypeOrder.GeoPointValue */ : "arrayValue" in t ? 9 /* TypeOrder.ArrayValue */ : "mapValue" in t ?
|
|
1559
|
+
/** Extracts the backend's type order for the provided value. */ function jt(t) {
|
|
1560
|
+
return "nullValue" in t ? 0 /* TypeOrder.NullValue */ : "booleanValue" in t ? 1 /* TypeOrder.BooleanValue */ : "integerValue" in t || "doubleValue" in t ? 2 /* TypeOrder.NumberValue */ : "timestampValue" in t ? 3 /* TypeOrder.TimestampValue */ : "stringValue" in t ? 5 /* TypeOrder.StringValue */ : "bytesValue" in t ? 6 /* TypeOrder.BlobValue */ : "referenceValue" in t ? 7 /* TypeOrder.RefValue */ : "geoPointValue" in t ? 8 /* TypeOrder.GeoPointValue */ : "arrayValue" in t ? 9 /* TypeOrder.ArrayValue */ : "mapValue" in t ? qt(t) ? 4 /* TypeOrder.ServerTimestampValue */ :
|
|
1531
1561
|
/** Returns true if the Value represents the canonical {@link #MAX_VALUE} . */
|
|
1532
1562
|
function(t) {
|
|
1533
1563
|
return "__max__" === (((t.mapValue || {}).fields || {}).__type__ || {}).stringValue;
|
|
1534
1564
|
}(t) ? 9007199254740991 /* TypeOrder.MaxValue */ : 10 /* TypeOrder.ObjectValue */ : k();
|
|
1535
1565
|
}
|
|
1536
1566
|
|
|
1537
|
-
/** Tests `left` and `right` for equality based on the backend semantics. */ function
|
|
1567
|
+
/** Tests `left` and `right` for equality based on the backend semantics. */ function Lt(t, e) {
|
|
1538
1568
|
if (t === e) return !0;
|
|
1539
|
-
var n =
|
|
1540
|
-
if (n !==
|
|
1569
|
+
var n = jt(t);
|
|
1570
|
+
if (n !== jt(e)) return !1;
|
|
1541
1571
|
switch (n) {
|
|
1542
1572
|
case 0 /* TypeOrder.NullValue */ :
|
|
1543
1573
|
case 9007199254740991 /* TypeOrder.MaxValue */ :
|
|
@@ -1547,14 +1577,14 @@ var Ft = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1547
1577
|
return t.booleanValue === e.booleanValue;
|
|
1548
1578
|
|
|
1549
1579
|
case 4 /* TypeOrder.ServerTimestampValue */ :
|
|
1550
|
-
return
|
|
1580
|
+
return xt(t).isEqual(xt(e));
|
|
1551
1581
|
|
|
1552
1582
|
case 3 /* TypeOrder.TimestampValue */ :
|
|
1553
1583
|
return function(t, e) {
|
|
1554
1584
|
if ("string" == typeof t.timestampValue && "string" == typeof e.timestampValue && t.timestampValue.length === e.timestampValue.length)
|
|
1555
1585
|
// Use string equality for ISO 8601 timestamps
|
|
1556
1586
|
return t.timestampValue === e.timestampValue;
|
|
1557
|
-
var n =
|
|
1587
|
+
var n = Ot(t.timestampValue), r = Ot(e.timestampValue);
|
|
1558
1588
|
return n.seconds === r.seconds && n.nanos === r.nanos;
|
|
1559
1589
|
}(t, e);
|
|
1560
1590
|
|
|
@@ -1579,19 +1609,19 @@ var Ft = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1579
1609
|
if ("integerValue" in t && "integerValue" in e) return Vt(t.integerValue) === Vt(e.integerValue);
|
|
1580
1610
|
if ("doubleValue" in t && "doubleValue" in e) {
|
|
1581
1611
|
var n = Vt(t.doubleValue), r = Vt(e.doubleValue);
|
|
1582
|
-
return n === r ?
|
|
1612
|
+
return n === r ? dt(n) === dt(r) : isNaN(n) && isNaN(r);
|
|
1583
1613
|
}
|
|
1584
1614
|
return !1;
|
|
1585
1615
|
}(t, e);
|
|
1586
1616
|
|
|
1587
1617
|
case 9 /* TypeOrder.ArrayValue */ :
|
|
1588
|
-
return
|
|
1618
|
+
return St(t.arrayValue.values || [], e.arrayValue.values || [], Lt);
|
|
1589
1619
|
|
|
1590
1620
|
case 10 /* TypeOrder.ObjectValue */ :
|
|
1591
1621
|
return function(t, e) {
|
|
1592
1622
|
var n = t.mapValue.fields || {}, r = e.mapValue.fields || {};
|
|
1593
|
-
if (
|
|
1594
|
-
for (var i in n) if (n.hasOwnProperty(i) && (void 0 === r[i] || !
|
|
1623
|
+
if (kt(n) !== kt(r)) return !1;
|
|
1624
|
+
for (var i in n) if (n.hasOwnProperty(i) && (void 0 === r[i] || !Lt(n[i], r[i]))) return !1;
|
|
1595
1625
|
return !0;
|
|
1596
1626
|
}(t, e);
|
|
1597
1627
|
|
|
@@ -1600,23 +1630,23 @@ var Ft = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1600
1630
|
}
|
|
1601
1631
|
}
|
|
1602
1632
|
|
|
1603
|
-
function
|
|
1633
|
+
function Mt(t, e) {
|
|
1604
1634
|
return void 0 !== (t.values || []).find((function(t) {
|
|
1605
|
-
return
|
|
1635
|
+
return Lt(t, e);
|
|
1606
1636
|
}));
|
|
1607
1637
|
}
|
|
1608
1638
|
|
|
1609
|
-
function
|
|
1639
|
+
function Ut(t, e) {
|
|
1610
1640
|
if (t === e) return 0;
|
|
1611
|
-
var n =
|
|
1612
|
-
if (n !== r) return
|
|
1641
|
+
var n = jt(t), r = jt(e);
|
|
1642
|
+
if (n !== r) return Et(n, r);
|
|
1613
1643
|
switch (n) {
|
|
1614
1644
|
case 0 /* TypeOrder.NullValue */ :
|
|
1615
1645
|
case 9007199254740991 /* TypeOrder.MaxValue */ :
|
|
1616
1646
|
return 0;
|
|
1617
1647
|
|
|
1618
1648
|
case 1 /* TypeOrder.BooleanValue */ :
|
|
1619
|
-
return
|
|
1649
|
+
return Et(t.booleanValue, e.booleanValue);
|
|
1620
1650
|
|
|
1621
1651
|
case 2 /* TypeOrder.NumberValue */ :
|
|
1622
1652
|
return function(t, e) {
|
|
@@ -1627,13 +1657,13 @@ function Mt(t, e) {
|
|
|
1627
1657
|
}(t, e);
|
|
1628
1658
|
|
|
1629
1659
|
case 3 /* TypeOrder.TimestampValue */ :
|
|
1630
|
-
return
|
|
1660
|
+
return Bt(t.timestampValue, e.timestampValue);
|
|
1631
1661
|
|
|
1632
1662
|
case 4 /* TypeOrder.ServerTimestampValue */ :
|
|
1633
|
-
return
|
|
1663
|
+
return Bt(xt(t), xt(e));
|
|
1634
1664
|
|
|
1635
1665
|
case 5 /* TypeOrder.StringValue */ :
|
|
1636
|
-
return
|
|
1666
|
+
return Et(t.stringValue, e.stringValue);
|
|
1637
1667
|
|
|
1638
1668
|
case 6 /* TypeOrder.BlobValue */ :
|
|
1639
1669
|
return function(t, e) {
|
|
@@ -1644,25 +1674,25 @@ function Mt(t, e) {
|
|
|
1644
1674
|
case 7 /* TypeOrder.RefValue */ :
|
|
1645
1675
|
return function(t, e) {
|
|
1646
1676
|
for (var n = t.split("/"), r = e.split("/"), i = 0; i < n.length && i < r.length; i++) {
|
|
1647
|
-
var o =
|
|
1677
|
+
var o = Et(n[i], r[i]);
|
|
1648
1678
|
if (0 !== o) return o;
|
|
1649
1679
|
}
|
|
1650
|
-
return
|
|
1680
|
+
return Et(n.length, r.length);
|
|
1651
1681
|
}(t.referenceValue, e.referenceValue);
|
|
1652
1682
|
|
|
1653
1683
|
case 8 /* TypeOrder.GeoPointValue */ :
|
|
1654
1684
|
return function(t, e) {
|
|
1655
|
-
var n =
|
|
1656
|
-
return 0 !== n ? n :
|
|
1685
|
+
var n = Et(Vt(t.latitude), Vt(e.latitude));
|
|
1686
|
+
return 0 !== n ? n : Et(Vt(t.longitude), Vt(e.longitude));
|
|
1657
1687
|
}(t.geoPointValue, e.geoPointValue);
|
|
1658
1688
|
|
|
1659
1689
|
case 9 /* TypeOrder.ArrayValue */ :
|
|
1660
1690
|
return function(t, e) {
|
|
1661
1691
|
for (var n = t.values || [], r = e.values || [], i = 0; i < n.length && i < r.length; ++i) {
|
|
1662
|
-
var o =
|
|
1692
|
+
var o = Ut(n[i], r[i]);
|
|
1663
1693
|
if (o) return o;
|
|
1664
1694
|
}
|
|
1665
|
-
return
|
|
1695
|
+
return Et(n.length, r.length);
|
|
1666
1696
|
}(t.arrayValue, e.arrayValue);
|
|
1667
1697
|
|
|
1668
1698
|
case 10 /* TypeOrder.ObjectValue */ :
|
|
@@ -1677,12 +1707,12 @@ function Mt(t, e) {
|
|
|
1677
1707
|
// canonical IDs are independent of insertion order.
|
|
1678
1708
|
r.sort(), o.sort();
|
|
1679
1709
|
for (var a = 0; a < r.length && a < o.length; ++a) {
|
|
1680
|
-
var u =
|
|
1710
|
+
var u = Et(r[a], o[a]);
|
|
1681
1711
|
if (0 !== u) return u;
|
|
1682
|
-
var s =
|
|
1712
|
+
var s = Ut(n[r[a]], i[o[a]]);
|
|
1683
1713
|
if (0 !== s) return s;
|
|
1684
1714
|
}
|
|
1685
|
-
return
|
|
1715
|
+
return Et(r.length, o.length);
|
|
1686
1716
|
}(t.mapValue, e.mapValue);
|
|
1687
1717
|
|
|
1688
1718
|
default:
|
|
@@ -1690,35 +1720,35 @@ function Mt(t, e) {
|
|
|
1690
1720
|
}
|
|
1691
1721
|
}
|
|
1692
1722
|
|
|
1693
|
-
function
|
|
1694
|
-
if ("string" == typeof t && "string" == typeof e && t.length === e.length) return
|
|
1695
|
-
var n =
|
|
1696
|
-
return 0 !== i ? i :
|
|
1723
|
+
function Bt(t, e) {
|
|
1724
|
+
if ("string" == typeof t && "string" == typeof e && t.length === e.length) return Et(t, e);
|
|
1725
|
+
var n = Ot(t), r = Ot(e), i = Et(n.seconds, r.seconds);
|
|
1726
|
+
return 0 !== i ? i : Et(n.nanos, r.nanos);
|
|
1697
1727
|
}
|
|
1698
1728
|
|
|
1699
|
-
function
|
|
1729
|
+
function zt(t, e) {
|
|
1700
1730
|
return {
|
|
1701
1731
|
referenceValue: "projects/".concat(t.projectId, "/databases/").concat(t.database, "/documents/").concat(e.path.canonicalString())
|
|
1702
1732
|
};
|
|
1703
1733
|
}
|
|
1704
1734
|
|
|
1705
|
-
/** Returns true if `value` is an ArrayValue. */ function
|
|
1735
|
+
/** Returns true if `value` is an ArrayValue. */ function Qt(t) {
|
|
1706
1736
|
return !!t && "arrayValue" in t;
|
|
1707
1737
|
}
|
|
1708
1738
|
|
|
1709
|
-
/** Returns true if `value` is a NullValue. */ function
|
|
1739
|
+
/** Returns true if `value` is a NullValue. */ function Kt(t) {
|
|
1710
1740
|
return !!t && "nullValue" in t;
|
|
1711
1741
|
}
|
|
1712
1742
|
|
|
1713
|
-
/** Returns true if `value` is NaN. */ function
|
|
1743
|
+
/** Returns true if `value` is NaN. */ function Gt(t) {
|
|
1714
1744
|
return !!t && "doubleValue" in t && isNaN(Number(t.doubleValue));
|
|
1715
1745
|
}
|
|
1716
1746
|
|
|
1717
|
-
/** Returns true if `value` is a MapValue. */ function
|
|
1747
|
+
/** Returns true if `value` is a MapValue. */ function Wt(t) {
|
|
1718
1748
|
return !!t && "mapValue" in t;
|
|
1719
1749
|
}
|
|
1720
1750
|
|
|
1721
|
-
/** Creates a deep copy of `source`. */ function
|
|
1751
|
+
/** Creates a deep copy of `source`. */ function Yt(t) {
|
|
1722
1752
|
if (t.geoPointValue) return {
|
|
1723
1753
|
geoPointValue: Object.assign({}, t.geoPointValue)
|
|
1724
1754
|
};
|
|
@@ -1731,8 +1761,8 @@ function Bt(t, e) {
|
|
|
1731
1761
|
fields: {}
|
|
1732
1762
|
}
|
|
1733
1763
|
};
|
|
1734
|
-
return
|
|
1735
|
-
return e.mapValue.fields[t] =
|
|
1764
|
+
return It(t.mapValue.fields, (function(t, n) {
|
|
1765
|
+
return e.mapValue.fields[t] = Yt(n);
|
|
1736
1766
|
})), e;
|
|
1737
1767
|
}
|
|
1738
1768
|
if (t.arrayValue) {
|
|
@@ -1740,21 +1770,21 @@ function Bt(t, e) {
|
|
|
1740
1770
|
arrayValue: {
|
|
1741
1771
|
values: []
|
|
1742
1772
|
}
|
|
1743
|
-
}, r = 0; r < (t.arrayValue.values || []).length; ++r) n.arrayValue.values[r] =
|
|
1773
|
+
}, r = 0; r < (t.arrayValue.values || []).length; ++r) n.arrayValue.values[r] = Yt(t.arrayValue.values[r]);
|
|
1744
1774
|
return n;
|
|
1745
1775
|
}
|
|
1746
1776
|
return Object.assign({}, t);
|
|
1747
1777
|
}
|
|
1748
1778
|
|
|
1749
|
-
var
|
|
1779
|
+
var Ht = function(t, e) {
|
|
1750
1780
|
this.position = t, this.inclusive = e;
|
|
1751
1781
|
};
|
|
1752
1782
|
|
|
1753
|
-
function
|
|
1783
|
+
function Jt(t, e) {
|
|
1754
1784
|
if (null === t) return null === e;
|
|
1755
1785
|
if (null === e) return !1;
|
|
1756
1786
|
if (t.inclusive !== e.inclusive || t.position.length !== e.position.length) return !1;
|
|
1757
|
-
for (var n = 0; n < t.position.length; n++) if (!
|
|
1787
|
+
for (var n = 0; n < t.position.length; n++) if (!Lt(t.position[n], e.position[n])) return !1;
|
|
1758
1788
|
return !0;
|
|
1759
1789
|
}
|
|
1760
1790
|
|
|
@@ -1773,7 +1803,7 @@ function Ht(t, e) {
|
|
|
1773
1803
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1774
1804
|
* See the License for the specific language governing permissions and
|
|
1775
1805
|
* limitations under the License.
|
|
1776
|
-
*/ var
|
|
1806
|
+
*/ var Xt = function() {}, $t = /** @class */ function(e) {
|
|
1777
1807
|
function n(t, n, r) {
|
|
1778
1808
|
var i = this;
|
|
1779
1809
|
return (i = e.call(this) || this).field = t, i.op = n, i.value = r, i;
|
|
@@ -1781,13 +1811,13 @@ function Ht(t, e) {
|
|
|
1781
1811
|
/**
|
|
1782
1812
|
* Creates a filter based on the provided arguments.
|
|
1783
1813
|
*/ return t(n, e), n.create = function(t, e, r) {
|
|
1784
|
-
return t.isKeyField() ? "in" /* Operator.IN */ === e || "not-in" /* Operator.NOT_IN */ === e ? this.createKeyFieldInFilter(t, e, r) : new
|
|
1814
|
+
return t.isKeyField() ? "in" /* Operator.IN */ === e || "not-in" /* Operator.NOT_IN */ === e ? this.createKeyFieldInFilter(t, e, r) : new ee(t, e, r) : "array-contains" /* Operator.ARRAY_CONTAINS */ === e ? new oe(t, r) : "in" /* Operator.IN */ === e ? new ae(t, r) : "not-in" /* Operator.NOT_IN */ === e ? new ue(t, r) : "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ === e ? new se(t, r) : new n(t, e, r);
|
|
1785
1815
|
}, n.createKeyFieldInFilter = function(t, e, n) {
|
|
1786
|
-
return "in" /* Operator.IN */ === e ? new
|
|
1816
|
+
return "in" /* Operator.IN */ === e ? new ne(t, n) : new re(t, n);
|
|
1787
1817
|
}, n.prototype.matches = function(t) {
|
|
1788
1818
|
var e = t.data.field(this.field);
|
|
1789
1819
|
// Types do not have to match in NOT_EQUAL filters.
|
|
1790
|
-
return "!=" /* Operator.NOT_EQUAL */ === this.op ? null !== e && this.matchesComparison(
|
|
1820
|
+
return "!=" /* Operator.NOT_EQUAL */ === this.op ? null !== e && this.matchesComparison(Ut(e, this.value)) : null !== e && jt(this.value) === jt(e) && this.matchesComparison(Ut(e, this.value));
|
|
1791
1821
|
// Only compare types with matching backend order (such as double and int).
|
|
1792
1822
|
}, n.prototype.matchesComparison = function(t) {
|
|
1793
1823
|
switch (this.op) {
|
|
@@ -1821,10 +1851,10 @@ function Ht(t, e) {
|
|
|
1821
1851
|
}, n.prototype.getFirstInequalityField = function() {
|
|
1822
1852
|
return this.isInequality() ? this.field : null;
|
|
1823
1853
|
}, n;
|
|
1824
|
-
}(
|
|
1854
|
+
}(Xt), Zt = /** @class */ function(e) {
|
|
1825
1855
|
function n(t, n) {
|
|
1826
1856
|
var r = this;
|
|
1827
|
-
return (r = e.call(this) || this).filters = t, r.op = n, r.
|
|
1857
|
+
return (r = e.call(this) || this).filters = t, r.op = n, r.D = null, r;
|
|
1828
1858
|
}
|
|
1829
1859
|
/**
|
|
1830
1860
|
* Creates a filter based on the provided arguments.
|
|
@@ -1837,9 +1867,9 @@ function Ht(t, e) {
|
|
|
1837
1867
|
return e.matches(t);
|
|
1838
1868
|
}));
|
|
1839
1869
|
}, n.prototype.getFlattenedFilters = function() {
|
|
1840
|
-
return null !== this.
|
|
1870
|
+
return null !== this.D || (this.D = this.filters.reduce((function(t, e) {
|
|
1841
1871
|
return t.concat(e.getFlattenedFilters());
|
|
1842
|
-
}), [])), this.
|
|
1872
|
+
}), [])), this.D;
|
|
1843
1873
|
},
|
|
1844
1874
|
// Returns a mutable copy of `this.filters`
|
|
1845
1875
|
n.prototype.getFilters = function() {
|
|
@@ -1860,19 +1890,19 @@ function Ht(t, e) {
|
|
|
1860
1890
|
}
|
|
1861
1891
|
return null;
|
|
1862
1892
|
}, n;
|
|
1863
|
-
}(
|
|
1864
|
-
|
|
1865
|
-
function
|
|
1866
|
-
return t instanceof
|
|
1867
|
-
return e instanceof
|
|
1868
|
-
}(t, e) : t instanceof
|
|
1869
|
-
return e instanceof
|
|
1870
|
-
return t &&
|
|
1893
|
+
}(Xt);
|
|
1894
|
+
|
|
1895
|
+
function te(t, e) {
|
|
1896
|
+
return t instanceof $t ? function(t, e) {
|
|
1897
|
+
return e instanceof $t && t.op === e.op && t.field.isEqual(e.field) && Lt(t.value, e.value);
|
|
1898
|
+
}(t, e) : t instanceof Zt ? function(t, e) {
|
|
1899
|
+
return e instanceof Zt && t.op === e.op && t.filters.length === e.filters.length && t.filters.reduce((function(t, n, r) {
|
|
1900
|
+
return t && te(n, e.filters[r]);
|
|
1871
1901
|
}), !0);
|
|
1872
1902
|
}(t, e) : void k();
|
|
1873
1903
|
}
|
|
1874
1904
|
|
|
1875
|
-
var
|
|
1905
|
+
var ee = /** @class */ function(e) {
|
|
1876
1906
|
function n(t, n, r) {
|
|
1877
1907
|
var i = this;
|
|
1878
1908
|
return (i = e.call(this, t, n, r) || this).key = it.fromName(r.referenceValue),
|
|
@@ -1882,10 +1912,10 @@ var te = /** @class */ function(e) {
|
|
|
1882
1912
|
var e = it.comparator(t.key, this.key);
|
|
1883
1913
|
return this.matchesComparison(e);
|
|
1884
1914
|
}, n;
|
|
1885
|
-
}(
|
|
1915
|
+
}($t), ne = /** @class */ function(e) {
|
|
1886
1916
|
function n(t, n) {
|
|
1887
1917
|
var r = this;
|
|
1888
|
-
return (r = e.call(this, t, "in" /* Operator.IN */ , n) || this).keys =
|
|
1918
|
+
return (r = e.call(this, t, "in" /* Operator.IN */ , n) || this).keys = ie("in" /* Operator.IN */ , n),
|
|
1889
1919
|
r;
|
|
1890
1920
|
}
|
|
1891
1921
|
return t(n, e), n.prototype.matches = function(t) {
|
|
@@ -1893,10 +1923,10 @@ var te = /** @class */ function(e) {
|
|
|
1893
1923
|
return e.isEqual(t.key);
|
|
1894
1924
|
}));
|
|
1895
1925
|
}, n;
|
|
1896
|
-
}(
|
|
1926
|
+
}($t), re = /** @class */ function(e) {
|
|
1897
1927
|
function n(t, n) {
|
|
1898
1928
|
var r = this;
|
|
1899
|
-
return (r = e.call(this, t, "not-in" /* Operator.NOT_IN */ , n) || this).keys =
|
|
1929
|
+
return (r = e.call(this, t, "not-in" /* Operator.NOT_IN */ , n) || this).keys = ie("not-in" /* Operator.NOT_IN */ , n),
|
|
1900
1930
|
r;
|
|
1901
1931
|
}
|
|
1902
1932
|
return t(n, e), n.prototype.matches = function(t) {
|
|
@@ -1904,57 +1934,57 @@ var te = /** @class */ function(e) {
|
|
|
1904
1934
|
return e.isEqual(t.key);
|
|
1905
1935
|
}));
|
|
1906
1936
|
}, n;
|
|
1907
|
-
}(
|
|
1937
|
+
}($t);
|
|
1908
1938
|
|
|
1909
|
-
/** Filter that matches on key fields within an array. */ function
|
|
1939
|
+
/** Filter that matches on key fields within an array. */ function ie(t, e) {
|
|
1910
1940
|
var n;
|
|
1911
1941
|
return ((null === (n = e.arrayValue) || void 0 === n ? void 0 : n.values) || []).map((function(t) {
|
|
1912
1942
|
return it.fromName(t.referenceValue);
|
|
1913
1943
|
}));
|
|
1914
1944
|
}
|
|
1915
1945
|
|
|
1916
|
-
/** A Filter that implements the array-contains operator. */ var
|
|
1946
|
+
/** A Filter that implements the array-contains operator. */ var oe = /** @class */ function(e) {
|
|
1917
1947
|
function n(t, n) {
|
|
1918
1948
|
return e.call(this, t, "array-contains" /* Operator.ARRAY_CONTAINS */ , n) || this;
|
|
1919
1949
|
}
|
|
1920
1950
|
return t(n, e), n.prototype.matches = function(t) {
|
|
1921
1951
|
var e = t.data.field(this.field);
|
|
1922
|
-
return
|
|
1952
|
+
return Qt(e) && Mt(e.arrayValue, this.value);
|
|
1923
1953
|
}, n;
|
|
1924
|
-
}(
|
|
1954
|
+
}($t), ae = /** @class */ function(e) {
|
|
1925
1955
|
function n(t, n) {
|
|
1926
1956
|
return e.call(this, t, "in" /* Operator.IN */ , n) || this;
|
|
1927
1957
|
}
|
|
1928
1958
|
return t(n, e), n.prototype.matches = function(t) {
|
|
1929
1959
|
var e = t.data.field(this.field);
|
|
1930
|
-
return null !== e &&
|
|
1960
|
+
return null !== e && Mt(this.value.arrayValue, e);
|
|
1931
1961
|
}, n;
|
|
1932
|
-
}(
|
|
1962
|
+
}($t), ue = /** @class */ function(e) {
|
|
1933
1963
|
function n(t, n) {
|
|
1934
1964
|
return e.call(this, t, "not-in" /* Operator.NOT_IN */ , n) || this;
|
|
1935
1965
|
}
|
|
1936
1966
|
return t(n, e), n.prototype.matches = function(t) {
|
|
1937
|
-
if (
|
|
1967
|
+
if (Mt(this.value.arrayValue, {
|
|
1938
1968
|
nullValue: "NULL_VALUE"
|
|
1939
1969
|
})) return !1;
|
|
1940
1970
|
var e = t.data.field(this.field);
|
|
1941
|
-
return null !== e && !
|
|
1971
|
+
return null !== e && !Mt(this.value.arrayValue, e);
|
|
1942
1972
|
}, n;
|
|
1943
|
-
}(
|
|
1973
|
+
}($t), se = /** @class */ function(e) {
|
|
1944
1974
|
function n(t, n) {
|
|
1945
1975
|
return e.call(this, t, "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ , n) || this;
|
|
1946
1976
|
}
|
|
1947
1977
|
return t(n, e), n.prototype.matches = function(t) {
|
|
1948
1978
|
var e = this, n = t.data.field(this.field);
|
|
1949
|
-
return !(!
|
|
1950
|
-
return
|
|
1979
|
+
return !(!Qt(n) || !n.arrayValue.values) && n.arrayValue.values.some((function(t) {
|
|
1980
|
+
return Mt(e.value.arrayValue, t);
|
|
1951
1981
|
}));
|
|
1952
1982
|
}, n;
|
|
1953
|
-
}(
|
|
1983
|
+
}($t), ce = function(t, e /* Direction.ASCENDING */) {
|
|
1954
1984
|
void 0 === e && (e = "asc"), this.field = t, this.dir = e;
|
|
1955
1985
|
};
|
|
1956
1986
|
|
|
1957
|
-
/** A Filter that implements the IN operator. */ function
|
|
1987
|
+
/** A Filter that implements the IN operator. */ function le(t, e) {
|
|
1958
1988
|
return t.dir === e.dir && t.field.isEqual(e.field);
|
|
1959
1989
|
}
|
|
1960
1990
|
|
|
@@ -1977,16 +2007,16 @@ var te = /** @class */ function(e) {
|
|
|
1977
2007
|
/**
|
|
1978
2008
|
* A version of a document in Firestore. This corresponds to the version
|
|
1979
2009
|
* timestamp, such as update_time or read_time.
|
|
1980
|
-
*/ var
|
|
2010
|
+
*/ var fe = /** @class */ function() {
|
|
1981
2011
|
function t(t) {
|
|
1982
2012
|
this.timestamp = t;
|
|
1983
2013
|
}
|
|
1984
2014
|
return t.fromTimestamp = function(e) {
|
|
1985
2015
|
return new t(e);
|
|
1986
2016
|
}, t.min = function() {
|
|
1987
|
-
return new t(new
|
|
2017
|
+
return new t(new Nt(0, 0));
|
|
1988
2018
|
}, t.max = function() {
|
|
1989
|
-
return new t(new
|
|
2019
|
+
return new t(new Nt(253402300799, 999999999));
|
|
1990
2020
|
}, t.prototype.compareTo = function(t) {
|
|
1991
2021
|
return this.timestamp._compareTo(t.timestamp);
|
|
1992
2022
|
}, t.prototype.isEqual = function(t) {
|
|
@@ -2000,17 +2030,17 @@ var te = /** @class */ function(e) {
|
|
|
2000
2030
|
}, t.prototype.toTimestamp = function() {
|
|
2001
2031
|
return this.timestamp;
|
|
2002
2032
|
}, t;
|
|
2003
|
-
}(),
|
|
2033
|
+
}(), he = /** @class */ function() {
|
|
2004
2034
|
function t(t, e) {
|
|
2005
|
-
this.comparator = t, this.root = e ||
|
|
2035
|
+
this.comparator = t, this.root = e || de.EMPTY;
|
|
2006
2036
|
}
|
|
2007
2037
|
// Returns a copy of the map, with the specified key/value added or replaced.
|
|
2008
2038
|
return t.prototype.insert = function(e, n) {
|
|
2009
|
-
return new t(this.comparator, this.root.insert(e, n, this.comparator).copy(null, null,
|
|
2039
|
+
return new t(this.comparator, this.root.insert(e, n, this.comparator).copy(null, null, de.BLACK, null, null));
|
|
2010
2040
|
},
|
|
2011
2041
|
// Returns a copy of the map, with the specified key removed.
|
|
2012
2042
|
t.prototype.remove = function(e) {
|
|
2013
|
-
return new t(this.comparator, this.root.remove(e, this.comparator).copy(null, null,
|
|
2043
|
+
return new t(this.comparator, this.root.remove(e, this.comparator).copy(null, null, de.BLACK, null, null));
|
|
2014
2044
|
},
|
|
2015
2045
|
// Returns the value of the node with the given key, or null.
|
|
2016
2046
|
t.prototype.get = function(t) {
|
|
@@ -2079,15 +2109,15 @@ var te = /** @class */ function(e) {
|
|
|
2079
2109
|
},
|
|
2080
2110
|
// Returns an iterator over the SortedMap.
|
|
2081
2111
|
t.prototype.getIterator = function() {
|
|
2082
|
-
return new
|
|
2112
|
+
return new pe(this.root, null, this.comparator, !1);
|
|
2083
2113
|
}, t.prototype.getIteratorFrom = function(t) {
|
|
2084
|
-
return new
|
|
2114
|
+
return new pe(this.root, t, this.comparator, !1);
|
|
2085
2115
|
}, t.prototype.getReverseIterator = function() {
|
|
2086
|
-
return new
|
|
2116
|
+
return new pe(this.root, null, this.comparator, !0);
|
|
2087
2117
|
}, t.prototype.getReverseIteratorFrom = function(t) {
|
|
2088
|
-
return new
|
|
2118
|
+
return new pe(this.root, t, this.comparator, !0);
|
|
2089
2119
|
}, t;
|
|
2090
|
-
}(),
|
|
2120
|
+
}(), pe = /** @class */ function() {
|
|
2091
2121
|
function t(t, e, n, r) {
|
|
2092
2122
|
this.isReverse = r, this.nodeStack = [];
|
|
2093
2123
|
for (var i = 1; !t.isEmpty(); ) if (i = e ? n(t.key, e) : 1,
|
|
@@ -2124,7 +2154,7 @@ var te = /** @class */ function(e) {
|
|
|
2124
2154
|
value: t.value
|
|
2125
2155
|
};
|
|
2126
2156
|
}, t;
|
|
2127
|
-
}(),
|
|
2157
|
+
}(), de = /** @class */ function() {
|
|
2128
2158
|
function t(e, n, r, i, o) {
|
|
2129
2159
|
this.key = e, this.value = n, this.color = null != r ? r : t.RED, this.left = null != i ? i : t.EMPTY,
|
|
2130
2160
|
this.right = null != o ? o : t.EMPTY, this.size = this.left.size + 1 + this.right.size;
|
|
@@ -2245,9 +2275,9 @@ var te = /** @class */ function(e) {
|
|
|
2245
2275
|
// end LLRBNode
|
|
2246
2276
|
// Empty node is shared between all LLRB trees.
|
|
2247
2277
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2248
|
-
|
|
2278
|
+
de.EMPTY = null, de.RED = !0, de.BLACK = !1,
|
|
2249
2279
|
// end LLRBEmptyNode
|
|
2250
|
-
|
|
2280
|
+
de.EMPTY = new (/** @class */ function() {
|
|
2251
2281
|
function t() {
|
|
2252
2282
|
this.size = 0;
|
|
2253
2283
|
}
|
|
@@ -2288,7 +2318,7 @@ pe.EMPTY = new (/** @class */ function() {
|
|
|
2288
2318
|
},
|
|
2289
2319
|
// Returns a copy of the tree, with the specified key/value added.
|
|
2290
2320
|
t.prototype.insert = function(t, e, n) {
|
|
2291
|
-
return new
|
|
2321
|
+
return new de(t, e);
|
|
2292
2322
|
},
|
|
2293
2323
|
// Returns a copy of the tree, with the specified key removed.
|
|
2294
2324
|
t.prototype.remove = function(t, e) {
|
|
@@ -2337,9 +2367,9 @@ pe.EMPTY = new (/** @class */ function() {
|
|
|
2337
2367
|
* NOTE: if provided comparator returns 0 for two elements, we consider them to
|
|
2338
2368
|
* be equal!
|
|
2339
2369
|
*/
|
|
2340
|
-
var
|
|
2370
|
+
var ye = /** @class */ function() {
|
|
2341
2371
|
function t(t) {
|
|
2342
|
-
this.comparator = t, this.data = new
|
|
2372
|
+
this.comparator = t, this.data = new he(this.comparator);
|
|
2343
2373
|
}
|
|
2344
2374
|
return t.prototype.has = function(t) {
|
|
2345
2375
|
return null !== this.data.get(t);
|
|
@@ -2379,9 +2409,9 @@ var de = /** @class */ function() {
|
|
|
2379
2409
|
var e = this.data.getIteratorFrom(t);
|
|
2380
2410
|
return e.hasNext() ? e.getNext().key : null;
|
|
2381
2411
|
}, t.prototype.getIterator = function() {
|
|
2382
|
-
return new
|
|
2412
|
+
return new me(this.data.getIterator());
|
|
2383
2413
|
}, t.prototype.getIteratorFrom = function(t) {
|
|
2384
|
-
return new
|
|
2414
|
+
return new me(this.data.getIteratorFrom(t));
|
|
2385
2415
|
},
|
|
2386
2416
|
/** Inserts or updates an element */ t.prototype.add = function(t) {
|
|
2387
2417
|
return this.copy(this.data.remove(t).insert(t, !0));
|
|
@@ -2418,7 +2448,7 @@ var de = /** @class */ function() {
|
|
|
2418
2448
|
var n = new t(this.comparator);
|
|
2419
2449
|
return n.data = e, n;
|
|
2420
2450
|
}, t;
|
|
2421
|
-
}(),
|
|
2451
|
+
}(), me = /** @class */ function() {
|
|
2422
2452
|
function t(t) {
|
|
2423
2453
|
this.iter = t;
|
|
2424
2454
|
}
|
|
@@ -2427,7 +2457,7 @@ var de = /** @class */ function() {
|
|
|
2427
2457
|
}, t.prototype.hasNext = function() {
|
|
2428
2458
|
return this.iter.hasNext();
|
|
2429
2459
|
}, t;
|
|
2430
|
-
}(),
|
|
2460
|
+
}(), ve = /** @class */ function() {
|
|
2431
2461
|
function t(t) {
|
|
2432
2462
|
this.fields = t,
|
|
2433
2463
|
// TODO(dimond): validation of FieldMask
|
|
@@ -2442,7 +2472,7 @@ var de = /** @class */ function() {
|
|
|
2442
2472
|
* fields paths to this field mask.
|
|
2443
2473
|
*/
|
|
2444
2474
|
t.prototype.unionWith = function(e) {
|
|
2445
|
-
for (var n = new
|
|
2475
|
+
for (var n = new ye(rt.comparator), r = 0, i = this.fields; r < i.length; r++) {
|
|
2446
2476
|
var o = i[r];
|
|
2447
2477
|
n = n.add(o);
|
|
2448
2478
|
}
|
|
@@ -2464,11 +2494,11 @@ var de = /** @class */ function() {
|
|
|
2464
2494
|
}
|
|
2465
2495
|
return !1;
|
|
2466
2496
|
}, t.prototype.isEqual = function(t) {
|
|
2467
|
-
return
|
|
2497
|
+
return St(this.fields, t.fields, (function(t, e) {
|
|
2468
2498
|
return t.isEqual(e);
|
|
2469
2499
|
}));
|
|
2470
2500
|
}, t;
|
|
2471
|
-
}(),
|
|
2501
|
+
}(), ge = /** @class */ function() {
|
|
2472
2502
|
function t(t) {
|
|
2473
2503
|
this.value = t;
|
|
2474
2504
|
}
|
|
@@ -2485,7 +2515,7 @@ var de = /** @class */ function() {
|
|
|
2485
2515
|
*/
|
|
2486
2516
|
t.prototype.field = function(t) {
|
|
2487
2517
|
if (t.isEmpty()) return this.value;
|
|
2488
|
-
for (var e = this.value, n = 0; n < t.length - 1; ++n) if (!
|
|
2518
|
+
for (var e = this.value, n = 0; n < t.length - 1; ++n) if (!Wt(e = (e.mapValue.fields || {})[t.get(n)])) return null;
|
|
2489
2519
|
return (e = (e.mapValue.fields || {})[t.lastSegment()]) || null;
|
|
2490
2520
|
},
|
|
2491
2521
|
/**
|
|
@@ -2495,7 +2525,7 @@ var de = /** @class */ function() {
|
|
|
2495
2525
|
* @param value - The value to set.
|
|
2496
2526
|
*/
|
|
2497
2527
|
t.prototype.set = function(t, e) {
|
|
2498
|
-
this.getFieldsMap(t.popLast())[t.lastSegment()] =
|
|
2528
|
+
this.getFieldsMap(t.popLast())[t.lastSegment()] = Yt(e);
|
|
2499
2529
|
},
|
|
2500
2530
|
/**
|
|
2501
2531
|
* Sets the provided fields to the provided values.
|
|
@@ -2510,7 +2540,7 @@ var de = /** @class */ function() {
|
|
|
2510
2540
|
var a = e.getFieldsMap(n);
|
|
2511
2541
|
e.applyChanges(a, r, i), r = {}, i = [], n = o.popLast();
|
|
2512
2542
|
}
|
|
2513
|
-
t ? r[o.lastSegment()] =
|
|
2543
|
+
t ? r[o.lastSegment()] = Yt(t) : i.push(o.lastSegment());
|
|
2514
2544
|
}));
|
|
2515
2545
|
var o = this.getFieldsMap(n);
|
|
2516
2546
|
this.applyChanges(o, r, i);
|
|
@@ -2523,9 +2553,9 @@ var de = /** @class */ function() {
|
|
|
2523
2553
|
*/
|
|
2524
2554
|
t.prototype.delete = function(t) {
|
|
2525
2555
|
var e = this.field(t.popLast());
|
|
2526
|
-
|
|
2556
|
+
Wt(e) && e.mapValue.fields && delete e.mapValue.fields[t.lastSegment()];
|
|
2527
2557
|
}, t.prototype.isEqual = function(t) {
|
|
2528
|
-
return
|
|
2558
|
+
return Lt(this.value, t.value);
|
|
2529
2559
|
},
|
|
2530
2560
|
/**
|
|
2531
2561
|
* Returns the map that contains the leaf element of `path`. If the parent
|
|
@@ -2538,7 +2568,7 @@ var de = /** @class */ function() {
|
|
|
2538
2568
|
});
|
|
2539
2569
|
for (var n = 0; n < t.length; ++n) {
|
|
2540
2570
|
var r = e.mapValue.fields[t.get(n)];
|
|
2541
|
-
|
|
2571
|
+
Wt(r) && r.mapValue.fields || (r = {
|
|
2542
2572
|
mapValue: {
|
|
2543
2573
|
fields: {}
|
|
2544
2574
|
}
|
|
@@ -2551,7 +2581,7 @@ var de = /** @class */ function() {
|
|
|
2551
2581
|
* entries.
|
|
2552
2582
|
*/
|
|
2553
2583
|
t.prototype.applyChanges = function(t, e, n) {
|
|
2554
|
-
|
|
2584
|
+
It(e, (function(e, n) {
|
|
2555
2585
|
return t[e] = n;
|
|
2556
2586
|
}));
|
|
2557
2587
|
for (var r = 0, i = n; r < i.length; r++) {
|
|
@@ -2559,9 +2589,9 @@ var de = /** @class */ function() {
|
|
|
2559
2589
|
delete t[o];
|
|
2560
2590
|
}
|
|
2561
2591
|
}, t.prototype.clone = function() {
|
|
2562
|
-
return new t(
|
|
2592
|
+
return new t(Yt(this.value));
|
|
2563
2593
|
}, t;
|
|
2564
|
-
}(),
|
|
2594
|
+
}(), we = /** @class */ function() {
|
|
2565
2595
|
function t(t, e, n, r, i, o, a) {
|
|
2566
2596
|
this.key = t, this.documentType = e, this.version = n, this.readTime = r, this.createTime = i,
|
|
2567
2597
|
this.data = o, this.documentState = a
|
|
@@ -2572,9 +2602,9 @@ var de = /** @class */ function() {
|
|
|
2572
2602
|
}
|
|
2573
2603
|
return t.newInvalidDocument = function(e) {
|
|
2574
2604
|
return new t(e, 0 /* DocumentType.INVALID */ ,
|
|
2575
|
-
/* version */
|
|
2576
|
-
/* readTime */
|
|
2577
|
-
/* createTime */
|
|
2605
|
+
/* version */ fe.min(),
|
|
2606
|
+
/* readTime */ fe.min(),
|
|
2607
|
+
/* createTime */ fe.min(), ge.empty(), 0 /* DocumentState.SYNCED */);
|
|
2578
2608
|
},
|
|
2579
2609
|
/**
|
|
2580
2610
|
* Creates a new document that is known to exist with the given data at the
|
|
@@ -2583,14 +2613,14 @@ var de = /** @class */ function() {
|
|
|
2583
2613
|
t.newFoundDocument = function(e, n, r, i) {
|
|
2584
2614
|
return new t(e, 1 /* DocumentType.FOUND_DOCUMENT */ ,
|
|
2585
2615
|
/* version */ n,
|
|
2586
|
-
/* readTime */
|
|
2616
|
+
/* readTime */ fe.min(),
|
|
2587
2617
|
/* createTime */ r, i, 0 /* DocumentState.SYNCED */);
|
|
2588
2618
|
},
|
|
2589
2619
|
/** Creates a new document that is known to not exist at the given version. */ t.newNoDocument = function(e, n) {
|
|
2590
2620
|
return new t(e, 2 /* DocumentType.NO_DOCUMENT */ ,
|
|
2591
2621
|
/* version */ n,
|
|
2592
|
-
/* readTime */
|
|
2593
|
-
/* createTime */
|
|
2622
|
+
/* readTime */ fe.min(),
|
|
2623
|
+
/* createTime */ fe.min(), ge.empty(), 0 /* DocumentState.SYNCED */);
|
|
2594
2624
|
},
|
|
2595
2625
|
/**
|
|
2596
2626
|
* Creates a new document that is known to exist at the given version but
|
|
@@ -2600,8 +2630,8 @@ var de = /** @class */ function() {
|
|
|
2600
2630
|
t.newUnknownDocument = function(e, n) {
|
|
2601
2631
|
return new t(e, 3 /* DocumentType.UNKNOWN_DOCUMENT */ ,
|
|
2602
2632
|
/* version */ n,
|
|
2603
|
-
/* readTime */
|
|
2604
|
-
/* createTime */
|
|
2633
|
+
/* readTime */ fe.min(),
|
|
2634
|
+
/* createTime */ fe.min(), ge.empty(), 2 /* DocumentState.HAS_COMMITTED_MUTATIONS */);
|
|
2605
2635
|
},
|
|
2606
2636
|
/**
|
|
2607
2637
|
* Changes the document type to indicate that it exists and that its version
|
|
@@ -2613,7 +2643,7 @@ var de = /** @class */ function() {
|
|
|
2613
2643
|
// update from Watch or due to applying a local set mutation on top
|
|
2614
2644
|
// of a deleted document, our best guess about its createTime would be the
|
|
2615
2645
|
// version at which the document transitioned to a FOUND_DOCUMENT.
|
|
2616
|
-
return !this.createTime.isEqual(
|
|
2646
|
+
return !this.createTime.isEqual(fe.min()) || 2 /* DocumentType.NO_DOCUMENT */ !== this.documentType && 0 /* DocumentType.INVALID */ !== this.documentType || (this.createTime = t),
|
|
2617
2647
|
this.version = t, this.documentType = 1 /* DocumentType.FOUND_DOCUMENT */ , this.data = e,
|
|
2618
2648
|
this.documentState = 0 /* DocumentState.SYNCED */ , this;
|
|
2619
2649
|
},
|
|
@@ -2623,7 +2653,7 @@ var de = /** @class */ function() {
|
|
|
2623
2653
|
*/
|
|
2624
2654
|
t.prototype.convertToNoDocument = function(t) {
|
|
2625
2655
|
return this.version = t, this.documentType = 2 /* DocumentType.NO_DOCUMENT */ ,
|
|
2626
|
-
this.data =
|
|
2656
|
+
this.data = ge.empty(), this.documentState = 0 /* DocumentState.SYNCED */ , this;
|
|
2627
2657
|
},
|
|
2628
2658
|
/**
|
|
2629
2659
|
* Changes the document type to indicate that it exists at a given version but
|
|
@@ -2632,12 +2662,12 @@ var de = /** @class */ function() {
|
|
|
2632
2662
|
*/
|
|
2633
2663
|
t.prototype.convertToUnknownDocument = function(t) {
|
|
2634
2664
|
return this.version = t, this.documentType = 3 /* DocumentType.UNKNOWN_DOCUMENT */ ,
|
|
2635
|
-
this.data =
|
|
2665
|
+
this.data = ge.empty(), this.documentState = 2 /* DocumentState.HAS_COMMITTED_MUTATIONS */ ,
|
|
2636
2666
|
this;
|
|
2637
2667
|
}, t.prototype.setHasCommittedMutations = function() {
|
|
2638
2668
|
return this.documentState = 2 /* DocumentState.HAS_COMMITTED_MUTATIONS */ , this;
|
|
2639
2669
|
}, t.prototype.setHasLocalMutations = function() {
|
|
2640
|
-
return this.documentState = 1 /* DocumentState.HAS_LOCAL_MUTATIONS */ , this.version =
|
|
2670
|
+
return this.documentState = 1 /* DocumentState.HAS_LOCAL_MUTATIONS */ , this.version = fe.min(),
|
|
2641
2671
|
this;
|
|
2642
2672
|
}, t.prototype.setReadTime = function(t) {
|
|
2643
2673
|
return this.readTime = t, this;
|
|
@@ -2674,7 +2704,7 @@ var de = /** @class */ function() {
|
|
|
2674
2704
|
}, t.prototype.toString = function() {
|
|
2675
2705
|
return "Document(".concat(this.key, ", ").concat(this.version, ", ").concat(JSON.stringify(this.data.value), ", {createTime: ").concat(this.createTime, "}), {documentType: ").concat(this.documentType, "}), {documentState: ").concat(this.documentState, "})");
|
|
2676
2706
|
}, t;
|
|
2677
|
-
}(),
|
|
2707
|
+
}(), _e = function(t, e, n, r, i, o, a) {
|
|
2678
2708
|
void 0 === e && (e = null), void 0 === n && (n = []), void 0 === r && (r = []),
|
|
2679
2709
|
void 0 === i && (i = null), void 0 === o && (o = null), void 0 === a && (a = null),
|
|
2680
2710
|
this.path = t, this.collectionGroup = e, this.orderBy = n, this.filters = r, this.limit = i,
|
|
@@ -2689,10 +2719,10 @@ var de = /** @class */ function() {
|
|
|
2689
2719
|
* using this factory method, because `Query` provides an implicit `orderBy`
|
|
2690
2720
|
* property.
|
|
2691
2721
|
*/
|
|
2692
|
-
function
|
|
2722
|
+
function be(t, e, n, r, i, o, a) {
|
|
2693
2723
|
return void 0 === e && (e = null), void 0 === n && (n = []), void 0 === r && (r = []),
|
|
2694
2724
|
void 0 === i && (i = null), void 0 === o && (o = null), void 0 === a && (a = null),
|
|
2695
|
-
new
|
|
2725
|
+
new _e(t, e, n, r, i, o, a);
|
|
2696
2726
|
}
|
|
2697
2727
|
|
|
2698
2728
|
/**
|
|
@@ -2717,7 +2747,7 @@ function _e(t, e, n, r, i, o, a) {
|
|
|
2717
2747
|
* query the RemoteStore results.
|
|
2718
2748
|
*
|
|
2719
2749
|
* Visible for testing.
|
|
2720
|
-
*/ var
|
|
2750
|
+
*/ var Te =
|
|
2721
2751
|
/**
|
|
2722
2752
|
* Initializes a Query with a path and optional additional query constraints.
|
|
2723
2753
|
* Path must currently be empty if this is a collection group query.
|
|
@@ -2732,11 +2762,11 @@ function(t, e, n, r, i, o /* LimitType.First */ , a, u) {
|
|
|
2732
2762
|
this.O = null, this.startAt, this.endAt;
|
|
2733
2763
|
};
|
|
2734
2764
|
|
|
2735
|
-
/** Creates a new Query for a query that matches all documents at `path` */ function
|
|
2765
|
+
/** Creates a new Query for a query that matches all documents at `path` */ function Ee(t) {
|
|
2736
2766
|
return t.explicitOrderBy.length > 0 ? t.explicitOrderBy[0].field : null;
|
|
2737
2767
|
}
|
|
2738
2768
|
|
|
2739
|
-
function
|
|
2769
|
+
function Se(t) {
|
|
2740
2770
|
for (var e = 0, n = t.filters; e < n.length; e++) {
|
|
2741
2771
|
var r = n[e].getFirstInequalityField();
|
|
2742
2772
|
if (null !== r) return r;
|
|
@@ -2751,7 +2781,7 @@ function Ee(t) {
|
|
|
2751
2781
|
/**
|
|
2752
2782
|
* Returns whether the query matches a collection group rather than a specific
|
|
2753
2783
|
* collection.
|
|
2754
|
-
*/ function
|
|
2784
|
+
*/ function ke(t) {
|
|
2755
2785
|
return null !== t.collectionGroup;
|
|
2756
2786
|
}
|
|
2757
2787
|
|
|
@@ -2759,16 +2789,16 @@ function Ee(t) {
|
|
|
2759
2789
|
* Returns the implicit order by constraint that is used to execute the Query,
|
|
2760
2790
|
* which can be different from the order by constraints the user provided (e.g.
|
|
2761
2791
|
* the SDK and backend always orders by `__name__`).
|
|
2762
|
-
*/ function
|
|
2792
|
+
*/ function Ie(t) {
|
|
2763
2793
|
var e = A(t);
|
|
2764
2794
|
if (null === e.q) {
|
|
2765
2795
|
e.q = [];
|
|
2766
|
-
var n =
|
|
2796
|
+
var n = Se(e), r = Ee(e);
|
|
2767
2797
|
if (null !== n && null === r)
|
|
2768
2798
|
// In order to implicitly add key ordering, we must also add the
|
|
2769
2799
|
// inequality filter field for it to be a valid query.
|
|
2770
2800
|
// Note that the default inequality field and key ordering is ascending.
|
|
2771
|
-
n.isKeyField() || e.q.push(new
|
|
2801
|
+
n.isKeyField() || e.q.push(new ce(n)), e.q.push(new ce(rt.keyField(), "asc" /* Direction.ASCENDING */)); else {
|
|
2772
2802
|
for (var i = !1, o = 0, a = e.explicitOrderBy; o < a.length; o++) {
|
|
2773
2803
|
var u = a[o];
|
|
2774
2804
|
e.q.push(u), u.field.isKeyField() && (i = !0);
|
|
@@ -2777,7 +2807,7 @@ function Ee(t) {
|
|
|
2777
2807
|
// The order of the implicit key ordering always matches the last
|
|
2778
2808
|
// explicit order by
|
|
2779
2809
|
var s = e.explicitOrderBy.length > 0 ? e.explicitOrderBy[e.explicitOrderBy.length - 1].dir : "asc" /* Direction.ASCENDING */;
|
|
2780
|
-
e.q.push(new
|
|
2810
|
+
e.q.push(new ce(rt.keyField(), s));
|
|
2781
2811
|
}
|
|
2782
2812
|
}
|
|
2783
2813
|
}
|
|
@@ -2786,27 +2816,27 @@ function Ee(t) {
|
|
|
2786
2816
|
|
|
2787
2817
|
/**
|
|
2788
2818
|
* Converts this `Query` instance to it's corresponding `Target` representation.
|
|
2789
|
-
*/ function
|
|
2819
|
+
*/ function Ae(t) {
|
|
2790
2820
|
var e = A(t);
|
|
2791
|
-
if (!e.O) if ("F" /* LimitType.First */ === e.limitType) e.O =
|
|
2821
|
+
if (!e.O) if ("F" /* LimitType.First */ === e.limitType) e.O = be(e.path, e.collectionGroup, Ie(e), e.filters, e.limit, e.startAt, e.endAt); else {
|
|
2792
2822
|
for (
|
|
2793
2823
|
// Flip the orderBy directions since we want the last results
|
|
2794
|
-
var n = [], r = 0, i =
|
|
2824
|
+
var n = [], r = 0, i = Ie(e); r < i.length; r++) {
|
|
2795
2825
|
var o = i[r], a = "desc" /* Direction.DESCENDING */ === o.dir ? "asc" /* Direction.ASCENDING */ : "desc" /* Direction.DESCENDING */;
|
|
2796
|
-
n.push(new
|
|
2826
|
+
n.push(new ce(o.field, a));
|
|
2797
2827
|
}
|
|
2798
2828
|
// We need to swap the cursors to match the now-flipped query ordering.
|
|
2799
|
-
var u = e.endAt ? new
|
|
2829
|
+
var u = e.endAt ? new Ht(e.endAt.position, e.endAt.inclusive) : null, s = e.startAt ? new Ht(e.startAt.position, e.startAt.inclusive) : null;
|
|
2800
2830
|
// Now return as a LimitType.First query.
|
|
2801
|
-
e.O =
|
|
2831
|
+
e.O = be(e.path, e.collectionGroup, n, e.filters, e.limit, u, s);
|
|
2802
2832
|
}
|
|
2803
2833
|
return e.O;
|
|
2804
2834
|
}
|
|
2805
2835
|
|
|
2806
|
-
function
|
|
2807
|
-
e.getFirstInequalityField(),
|
|
2836
|
+
function Pe(t, e) {
|
|
2837
|
+
e.getFirstInequalityField(), Se(t);
|
|
2808
2838
|
var n = t.filters.concat([ e ]);
|
|
2809
|
-
return new
|
|
2839
|
+
return new Te(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
|
|
2810
2840
|
}
|
|
2811
2841
|
|
|
2812
2842
|
/**
|
|
@@ -2836,7 +2866,7 @@ function Ae(t, e) {
|
|
|
2836
2866
|
*/
|
|
2837
2867
|
function Fe(t, e) {
|
|
2838
2868
|
return function(t) {
|
|
2839
|
-
return "number" == typeof t && Number.isInteger(t) && !
|
|
2869
|
+
return "number" == typeof t && Number.isInteger(t) && !dt(t) && t <= Number.MAX_SAFE_INTEGER && t >= Number.MIN_SAFE_INTEGER;
|
|
2840
2870
|
}(e) ?
|
|
2841
2871
|
/**
|
|
2842
2872
|
* Returns an IntegerValue for `value`.
|
|
@@ -2858,7 +2888,7 @@ function Fe(t, e) {
|
|
|
2858
2888
|
};
|
|
2859
2889
|
}
|
|
2860
2890
|
return {
|
|
2861
|
-
doubleValue:
|
|
2891
|
+
doubleValue: dt(e) ? "-0" : e
|
|
2862
2892
|
};
|
|
2863
2893
|
}(t, e);
|
|
2864
2894
|
}
|
|
@@ -2879,7 +2909,7 @@ function Fe(t, e) {
|
|
|
2879
2909
|
* See the License for the specific language governing permissions and
|
|
2880
2910
|
* limitations under the License.
|
|
2881
2911
|
*/
|
|
2882
|
-
/** Used to represent a field transform on a mutation. */ var
|
|
2912
|
+
/** Used to represent a field transform on a mutation. */ var Oe = function() {
|
|
2883
2913
|
// Make sure that the structural type of `TransformOperation` is unique.
|
|
2884
2914
|
// See https://github.com/microsoft/TypeScript/issues/5451
|
|
2885
2915
|
this._ = void 0;
|
|
@@ -2888,27 +2918,27 @@ function Fe(t, e) {
|
|
|
2888
2918
|
return null !== e && e.apply(this, arguments) || this;
|
|
2889
2919
|
}
|
|
2890
2920
|
return t(n, e), n;
|
|
2891
|
-
}(
|
|
2921
|
+
}(Oe), De = /** @class */ function(e) {
|
|
2892
2922
|
function n(t) {
|
|
2893
2923
|
var n = this;
|
|
2894
2924
|
return (n = e.call(this) || this).elements = t, n;
|
|
2895
2925
|
}
|
|
2896
2926
|
return t(n, e), n;
|
|
2897
|
-
}(
|
|
2927
|
+
}(Oe), Ne = /** @class */ function(e) {
|
|
2898
2928
|
function n(t) {
|
|
2899
2929
|
var n = this;
|
|
2900
2930
|
return (n = e.call(this) || this).elements = t, n;
|
|
2901
2931
|
}
|
|
2902
2932
|
return t(n, e), n;
|
|
2903
|
-
}(
|
|
2933
|
+
}(Oe), qe = /** @class */ function(e) {
|
|
2904
2934
|
function n(t, n) {
|
|
2905
2935
|
var r = this;
|
|
2906
2936
|
return (r = e.call(this) || this).serializer = t, r.k = n, r;
|
|
2907
2937
|
}
|
|
2908
2938
|
return t(n, e), n;
|
|
2909
|
-
}(
|
|
2939
|
+
}(Oe), Re = function(t, e) {
|
|
2910
2940
|
this.field = t, this.transform = e;
|
|
2911
|
-
},
|
|
2941
|
+
}, xe = /** @class */ function() {
|
|
2912
2942
|
function t(t, e) {
|
|
2913
2943
|
this.updateTime = t, this.exists = e
|
|
2914
2944
|
/** Creates a new empty Precondition. */;
|
|
@@ -2930,7 +2960,7 @@ function Fe(t, e) {
|
|
|
2930
2960
|
}), t.prototype.isEqual = function(t) {
|
|
2931
2961
|
return this.exists === t.exists && (this.updateTime ? !!t.updateTime && this.updateTime.isEqual(t.updateTime) : !t.updateTime);
|
|
2932
2962
|
}, t;
|
|
2933
|
-
}(), Ce = function() {},
|
|
2963
|
+
}(), Ce = function() {}, je = /** @class */ function(e) {
|
|
2934
2964
|
function n(t, n, r, i) {
|
|
2935
2965
|
void 0 === i && (i = []);
|
|
2936
2966
|
var o = this;
|
|
@@ -2940,7 +2970,7 @@ function Fe(t, e) {
|
|
|
2940
2970
|
return t(n, e), n.prototype.getFieldMask = function() {
|
|
2941
2971
|
return null;
|
|
2942
2972
|
}, n;
|
|
2943
|
-
}(Ce),
|
|
2973
|
+
}(Ce), Le = /** @class */ function(e) {
|
|
2944
2974
|
function n(t, n, r, i, o) {
|
|
2945
2975
|
void 0 === o && (o = []);
|
|
2946
2976
|
var a = this;
|
|
@@ -2950,7 +2980,7 @@ function Fe(t, e) {
|
|
|
2950
2980
|
return t(n, e), n.prototype.getFieldMask = function() {
|
|
2951
2981
|
return this.fieldMask;
|
|
2952
2982
|
}, n;
|
|
2953
|
-
}(Ce),
|
|
2983
|
+
}(Ce), Me = /** @class */ function(e) {
|
|
2954
2984
|
function n(t, n) {
|
|
2955
2985
|
var r = this;
|
|
2956
2986
|
return (r = e.call(this) || this).key = t, r.precondition = n, r.type = 2 /* MutationType.Delete */ ,
|
|
@@ -2959,7 +2989,7 @@ function Fe(t, e) {
|
|
|
2959
2989
|
return t(n, e), n.prototype.getFieldMask = function() {
|
|
2960
2990
|
return null;
|
|
2961
2991
|
}, n;
|
|
2962
|
-
}(Ce),
|
|
2992
|
+
}(Ce), Ue = /** @class */ function(e) {
|
|
2963
2993
|
function n(t, n) {
|
|
2964
2994
|
var r = this;
|
|
2965
2995
|
return (r = e.call(this) || this).key = t, r.precondition = n, r.type = 3 /* MutationType.Verify */ ,
|
|
@@ -2968,10 +2998,10 @@ function Fe(t, e) {
|
|
|
2968
2998
|
return t(n, e), n.prototype.getFieldMask = function() {
|
|
2969
2999
|
return null;
|
|
2970
3000
|
}, n;
|
|
2971
|
-
}(Ce),
|
|
3001
|
+
}(Ce), Be = {
|
|
2972
3002
|
asc: "ASCENDING",
|
|
2973
3003
|
desc: "DESCENDING"
|
|
2974
|
-
},
|
|
3004
|
+
}, ze = {
|
|
2975
3005
|
"<": "LESS_THAN",
|
|
2976
3006
|
"<=": "LESS_THAN_OR_EQUAL",
|
|
2977
3007
|
">": "GREATER_THAN",
|
|
@@ -2982,10 +3012,10 @@ function Fe(t, e) {
|
|
|
2982
3012
|
in: "IN",
|
|
2983
3013
|
"not-in": "NOT_IN",
|
|
2984
3014
|
"array-contains-any": "ARRAY_CONTAINS_ANY"
|
|
2985
|
-
},
|
|
3015
|
+
}, Qe = {
|
|
2986
3016
|
and: "AND",
|
|
2987
3017
|
or: "OR"
|
|
2988
|
-
},
|
|
3018
|
+
}, Ke = function(t, e) {
|
|
2989
3019
|
this.databaseId = t, this.useProto3Json = e;
|
|
2990
3020
|
};
|
|
2991
3021
|
|
|
@@ -3001,7 +3031,7 @@ function Fe(t, e) {
|
|
|
3001
3031
|
/**
|
|
3002
3032
|
* Returns a value for a Date that's appropriate to put into a proto.
|
|
3003
3033
|
*/
|
|
3004
|
-
function
|
|
3034
|
+
function Ge(t, e) {
|
|
3005
3035
|
return t.useProto3Json ? "".concat(new Date(1e3 * e.seconds).toISOString().replace(/\.\d*/, "").replace("Z", ""), ".").concat(("000000000" + e.nanoseconds).slice(-9), "Z") : {
|
|
3006
3036
|
seconds: "" + e.seconds,
|
|
3007
3037
|
nanos: e.nanoseconds
|
|
@@ -3012,69 +3042,69 @@ function Ke(t, e) {
|
|
|
3012
3042
|
* Returns a value for bytes that's appropriate to put in a proto.
|
|
3013
3043
|
*
|
|
3014
3044
|
* Visible for testing.
|
|
3015
|
-
*/ function
|
|
3045
|
+
*/ function We(t, e) {
|
|
3016
3046
|
return t.useProto3Json ? e.toBase64() : e.toUint8Array();
|
|
3017
3047
|
}
|
|
3018
3048
|
|
|
3019
|
-
function
|
|
3020
|
-
return
|
|
3049
|
+
function Ye(t, e) {
|
|
3050
|
+
return Ge(t, e.toTimestamp());
|
|
3021
3051
|
}
|
|
3022
3052
|
|
|
3023
|
-
function
|
|
3024
|
-
return I(!!t),
|
|
3025
|
-
var e =
|
|
3026
|
-
return new
|
|
3053
|
+
function He(t) {
|
|
3054
|
+
return I(!!t), fe.fromTimestamp(function(t) {
|
|
3055
|
+
var e = Ot(t);
|
|
3056
|
+
return new Nt(e.seconds, e.nanos);
|
|
3027
3057
|
}(t));
|
|
3028
3058
|
}
|
|
3029
3059
|
|
|
3030
|
-
function
|
|
3060
|
+
function Je(t, e) {
|
|
3031
3061
|
return function(t) {
|
|
3032
3062
|
return new et([ "projects", t.projectId, "databases", t.database ]);
|
|
3033
3063
|
}(t).child("documents").child(e).canonicalString();
|
|
3034
3064
|
}
|
|
3035
3065
|
|
|
3036
|
-
function
|
|
3037
|
-
return
|
|
3066
|
+
function Xe(t, e) {
|
|
3067
|
+
return Je(t.databaseId, e.path);
|
|
3038
3068
|
}
|
|
3039
3069
|
|
|
3040
|
-
function
|
|
3070
|
+
function $e(t, e) {
|
|
3041
3071
|
var n, r = function(t) {
|
|
3042
3072
|
var e = et.fromString(t);
|
|
3043
|
-
return I(
|
|
3073
|
+
return I(ln(e)), e;
|
|
3044
3074
|
}(e);
|
|
3045
|
-
if (r.get(1) !== t.databaseId.projectId) throw new B(
|
|
3046
|
-
if (r.get(3) !== t.databaseId.database) throw new B(
|
|
3075
|
+
if (r.get(1) !== t.databaseId.projectId) throw new B(O, "Tried to deserialize key from different project: " + r.get(1) + " vs " + t.databaseId.projectId);
|
|
3076
|
+
if (r.get(3) !== t.databaseId.database) throw new B(O, "Tried to deserialize key from different database: " + r.get(3) + " vs " + t.databaseId.database);
|
|
3047
3077
|
return new it((I((n = r).length > 4 && "documents" === n.get(4)), n.popFirst(5)));
|
|
3048
3078
|
}
|
|
3049
3079
|
|
|
3050
|
-
function
|
|
3051
|
-
return
|
|
3080
|
+
function Ze(t, e) {
|
|
3081
|
+
return Je(t.databaseId, e);
|
|
3052
3082
|
}
|
|
3053
3083
|
|
|
3054
|
-
function
|
|
3084
|
+
function tn(t) {
|
|
3055
3085
|
return new et([ "projects", t.databaseId.projectId, "databases", t.databaseId.database ]).canonicalString();
|
|
3056
3086
|
}
|
|
3057
3087
|
|
|
3058
|
-
function
|
|
3088
|
+
function en(t, e, n) {
|
|
3059
3089
|
return {
|
|
3060
|
-
name:
|
|
3090
|
+
name: Xe(t, e),
|
|
3061
3091
|
fields: n.value.mapValue.fields
|
|
3062
3092
|
};
|
|
3063
3093
|
}
|
|
3064
3094
|
|
|
3065
|
-
function
|
|
3095
|
+
function nn(t, e) {
|
|
3066
3096
|
// Dissect the path into parent, collectionId, and optional key filter.
|
|
3067
3097
|
var n = {
|
|
3068
3098
|
structuredQuery: {}
|
|
3069
3099
|
}, r = e.path;
|
|
3070
|
-
null !== e.collectionGroup ? (n.parent =
|
|
3100
|
+
null !== e.collectionGroup ? (n.parent = Ze(t, r), n.structuredQuery.from = [ {
|
|
3071
3101
|
collectionId: e.collectionGroup,
|
|
3072
3102
|
allDescendants: !0
|
|
3073
|
-
} ]) : (n.parent =
|
|
3103
|
+
} ]) : (n.parent = Ze(t, r.popLast()), n.structuredQuery.from = [ {
|
|
3074
3104
|
collectionId: r.lastSegment()
|
|
3075
3105
|
} ]);
|
|
3076
3106
|
var i = function(t) {
|
|
3077
|
-
if (0 !== t.length) return
|
|
3107
|
+
if (0 !== t.length) return sn(Zt.create(t, "and" /* CompositeOperator.AND */));
|
|
3078
3108
|
}(e.filters);
|
|
3079
3109
|
i && (n.structuredQuery.where = i);
|
|
3080
3110
|
var o = function(t) {
|
|
@@ -3082,15 +3112,15 @@ function en(t, e) {
|
|
|
3082
3112
|
// visible for testing
|
|
3083
3113
|
return function(t) {
|
|
3084
3114
|
return {
|
|
3085
|
-
field:
|
|
3086
|
-
direction:
|
|
3115
|
+
field: un(t.field),
|
|
3116
|
+
direction: rn(t.dir)
|
|
3087
3117
|
};
|
|
3088
3118
|
}(t);
|
|
3089
3119
|
}));
|
|
3090
3120
|
}(e.orderBy);
|
|
3091
3121
|
o && (n.structuredQuery.orderBy = o);
|
|
3092
3122
|
var a, u = function(t, e) {
|
|
3093
|
-
return t.useProto3Json ||
|
|
3123
|
+
return t.useProto3Json || pt(e) ? e : {
|
|
3094
3124
|
value: e
|
|
3095
3125
|
};
|
|
3096
3126
|
}(t, e.limit);
|
|
@@ -3105,75 +3135,75 @@ function en(t, e) {
|
|
|
3105
3135
|
}(e.endAt)), n;
|
|
3106
3136
|
}
|
|
3107
3137
|
|
|
3108
|
-
function nn(t) {
|
|
3109
|
-
return Ue[t];
|
|
3110
|
-
}
|
|
3111
|
-
|
|
3112
|
-
// visible for testing
|
|
3113
3138
|
function rn(t) {
|
|
3114
3139
|
return Be[t];
|
|
3115
3140
|
}
|
|
3116
3141
|
|
|
3142
|
+
// visible for testing
|
|
3117
3143
|
function on(t) {
|
|
3118
3144
|
return ze[t];
|
|
3119
3145
|
}
|
|
3120
3146
|
|
|
3121
3147
|
function an(t) {
|
|
3148
|
+
return Qe[t];
|
|
3149
|
+
}
|
|
3150
|
+
|
|
3151
|
+
function un(t) {
|
|
3122
3152
|
return {
|
|
3123
3153
|
fieldPath: t.canonicalString()
|
|
3124
3154
|
};
|
|
3125
3155
|
}
|
|
3126
3156
|
|
|
3127
|
-
function
|
|
3128
|
-
return t instanceof
|
|
3157
|
+
function sn(t) {
|
|
3158
|
+
return t instanceof $t ? function(t) {
|
|
3129
3159
|
if ("==" /* Operator.EQUAL */ === t.op) {
|
|
3130
|
-
if (
|
|
3160
|
+
if (Gt(t.value)) return {
|
|
3131
3161
|
unaryFilter: {
|
|
3132
|
-
field:
|
|
3162
|
+
field: un(t.field),
|
|
3133
3163
|
op: "IS_NAN"
|
|
3134
3164
|
}
|
|
3135
3165
|
};
|
|
3136
|
-
if (
|
|
3166
|
+
if (Kt(t.value)) return {
|
|
3137
3167
|
unaryFilter: {
|
|
3138
|
-
field:
|
|
3168
|
+
field: un(t.field),
|
|
3139
3169
|
op: "IS_NULL"
|
|
3140
3170
|
}
|
|
3141
3171
|
};
|
|
3142
3172
|
} else if ("!=" /* Operator.NOT_EQUAL */ === t.op) {
|
|
3143
|
-
if (
|
|
3173
|
+
if (Gt(t.value)) return {
|
|
3144
3174
|
unaryFilter: {
|
|
3145
|
-
field:
|
|
3175
|
+
field: un(t.field),
|
|
3146
3176
|
op: "IS_NOT_NAN"
|
|
3147
3177
|
}
|
|
3148
3178
|
};
|
|
3149
|
-
if (
|
|
3179
|
+
if (Kt(t.value)) return {
|
|
3150
3180
|
unaryFilter: {
|
|
3151
|
-
field:
|
|
3181
|
+
field: un(t.field),
|
|
3152
3182
|
op: "IS_NOT_NULL"
|
|
3153
3183
|
}
|
|
3154
3184
|
};
|
|
3155
3185
|
}
|
|
3156
3186
|
return {
|
|
3157
3187
|
fieldFilter: {
|
|
3158
|
-
field:
|
|
3159
|
-
op:
|
|
3188
|
+
field: un(t.field),
|
|
3189
|
+
op: on(t.op),
|
|
3160
3190
|
value: t.value
|
|
3161
3191
|
}
|
|
3162
3192
|
};
|
|
3163
|
-
}(t) : t instanceof
|
|
3193
|
+
}(t) : t instanceof Zt ? function(t) {
|
|
3164
3194
|
var e = t.getFilters().map((function(t) {
|
|
3165
|
-
return
|
|
3195
|
+
return sn(t);
|
|
3166
3196
|
}));
|
|
3167
3197
|
return 1 === e.length ? e[0] : {
|
|
3168
3198
|
compositeFilter: {
|
|
3169
|
-
op:
|
|
3199
|
+
op: an(t.op),
|
|
3170
3200
|
filters: e
|
|
3171
3201
|
}
|
|
3172
3202
|
};
|
|
3173
3203
|
}(t) : k();
|
|
3174
3204
|
}
|
|
3175
3205
|
|
|
3176
|
-
function
|
|
3206
|
+
function cn(t) {
|
|
3177
3207
|
var e = [];
|
|
3178
3208
|
return t.fields.forEach((function(t) {
|
|
3179
3209
|
return e.push(t.canonicalString());
|
|
@@ -3182,7 +3212,7 @@ function sn(t) {
|
|
|
3182
3212
|
};
|
|
3183
3213
|
}
|
|
3184
3214
|
|
|
3185
|
-
function
|
|
3215
|
+
function ln(t) {
|
|
3186
3216
|
// Resource names have at least 4 components (project ID, database ID)
|
|
3187
3217
|
return t.length >= 4 && "projects" === t.get(0) && "databases" === t.get(2);
|
|
3188
3218
|
}
|
|
@@ -3202,8 +3232,8 @@ function cn(t) {
|
|
|
3202
3232
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3203
3233
|
* See the License for the specific language governing permissions and
|
|
3204
3234
|
* limitations under the License.
|
|
3205
|
-
*/ function
|
|
3206
|
-
return new
|
|
3235
|
+
*/ function fn(t) {
|
|
3236
|
+
return new Ke(t, /* useProto3Json= */ !0);
|
|
3207
3237
|
}
|
|
3208
3238
|
|
|
3209
3239
|
/**
|
|
@@ -3230,7 +3260,7 @@ function cn(t) {
|
|
|
3230
3260
|
* backoff curve, and a +/- 50% "jitter" that is calculated and added to the
|
|
3231
3261
|
* base delay. This prevents clients from accidentally synchronizing their
|
|
3232
3262
|
* delays causing spikes of load to the backend.
|
|
3233
|
-
*/ var
|
|
3263
|
+
*/ var hn = /** @class */ function() {
|
|
3234
3264
|
function t(
|
|
3235
3265
|
/**
|
|
3236
3266
|
* The AsyncQueue to run backoff operations on.
|
|
@@ -3304,14 +3334,14 @@ function cn(t) {
|
|
|
3304
3334
|
/** Returns a random value in the range [-currentBaseMs/2, currentBaseMs/2] */ t.prototype.Y = function() {
|
|
3305
3335
|
return (Math.random() - .5) * this.j;
|
|
3306
3336
|
}, t;
|
|
3307
|
-
}(),
|
|
3337
|
+
}(), pn = /** @class */ function(e) {
|
|
3308
3338
|
function n(t, n, r, i) {
|
|
3309
3339
|
var o = this;
|
|
3310
3340
|
return (o = e.call(this) || this).authCredentials = t, o.appCheckCredentials = n,
|
|
3311
3341
|
o.connection = r, o.serializer = i, o.J = !1, o;
|
|
3312
3342
|
}
|
|
3313
3343
|
return t(n, e), n.prototype.X = function() {
|
|
3314
|
-
if (this.J) throw new B(
|
|
3344
|
+
if (this.J) throw new B(x, "The client has already been terminated.");
|
|
3315
3345
|
},
|
|
3316
3346
|
/** Invokes the provided RPC with auth and AppCheck tokens. */ n.prototype.v = function(t, e, n) {
|
|
3317
3347
|
var r = this;
|
|
@@ -3320,7 +3350,7 @@ function cn(t) {
|
|
|
3320
3350
|
return r.connection.v(t, e, n, o, a);
|
|
3321
3351
|
})).catch((function(t) {
|
|
3322
3352
|
throw "FirebaseError" === t.name ? (t.code === q && (r.authCredentials.invalidateToken(),
|
|
3323
|
-
r.appCheckCredentials.invalidateToken()), t) : new B(
|
|
3353
|
+
r.appCheckCredentials.invalidateToken()), t) : new B(F, t.toString());
|
|
3324
3354
|
}));
|
|
3325
3355
|
},
|
|
3326
3356
|
/** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ n.prototype.R = function(t, e, n, r) {
|
|
@@ -3330,7 +3360,7 @@ function cn(t) {
|
|
|
3330
3360
|
return i.connection.R(t, e, n, a, u, r);
|
|
3331
3361
|
})).catch((function(t) {
|
|
3332
3362
|
throw "FirebaseError" === t.name ? (t.code === q && (i.authCredentials.invalidateToken(),
|
|
3333
|
-
i.appCheckCredentials.invalidateToken()), t) : new B(
|
|
3363
|
+
i.appCheckCredentials.invalidateToken()), t) : new B(F, t.toString());
|
|
3334
3364
|
}));
|
|
3335
3365
|
}, n.prototype.terminate = function() {
|
|
3336
3366
|
this.J = !0;
|
|
@@ -3364,27 +3394,27 @@ function cn(t) {
|
|
|
3364
3394
|
*/
|
|
3365
3395
|
// TODO(firestorexp): Make sure there is only one Datastore instance per
|
|
3366
3396
|
// firestore-exp client.
|
|
3367
|
-
function
|
|
3397
|
+
function dn(t, r) {
|
|
3368
3398
|
return e(this, void 0, void 0, (function() {
|
|
3369
3399
|
var e, i, o;
|
|
3370
3400
|
return n(this, (function(n) {
|
|
3371
3401
|
switch (n.label) {
|
|
3372
3402
|
case 0:
|
|
3373
|
-
return e = A(t), i =
|
|
3403
|
+
return e = A(t), i = tn(e.serializer) + "/documents", o = {
|
|
3374
3404
|
writes: r.map((function(t) {
|
|
3375
3405
|
return function(t, e) {
|
|
3376
3406
|
var n;
|
|
3377
|
-
if (e instanceof
|
|
3378
|
-
update:
|
|
3407
|
+
if (e instanceof je) n = {
|
|
3408
|
+
update: en(t, e.key, e.value)
|
|
3409
|
+
}; else if (e instanceof Me) n = {
|
|
3410
|
+
delete: Xe(t, e.key)
|
|
3379
3411
|
}; else if (e instanceof Le) n = {
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
update: tn(t, e.key, e.data),
|
|
3383
|
-
updateMask: sn(e.fieldMask)
|
|
3412
|
+
update: en(t, e.key, e.data),
|
|
3413
|
+
updateMask: cn(e.fieldMask)
|
|
3384
3414
|
}; else {
|
|
3385
|
-
if (!(e instanceof
|
|
3415
|
+
if (!(e instanceof Ue)) return k();
|
|
3386
3416
|
n = {
|
|
3387
|
-
verify:
|
|
3417
|
+
verify: Xe(t, e.key)
|
|
3388
3418
|
};
|
|
3389
3419
|
}
|
|
3390
3420
|
return e.fieldTransforms.length > 0 && (n.updateTransforms = e.fieldTransforms.map((function(t) {
|
|
@@ -3400,13 +3430,13 @@ function pn(t, r) {
|
|
|
3400
3430
|
values: n.elements
|
|
3401
3431
|
}
|
|
3402
3432
|
};
|
|
3403
|
-
if (n instanceof
|
|
3433
|
+
if (n instanceof Ne) return {
|
|
3404
3434
|
fieldPath: e.field.canonicalString(),
|
|
3405
3435
|
removeAllFromArray: {
|
|
3406
3436
|
values: n.elements
|
|
3407
3437
|
}
|
|
3408
3438
|
};
|
|
3409
|
-
if (n instanceof
|
|
3439
|
+
if (n instanceof qe) return {
|
|
3410
3440
|
fieldPath: e.field.canonicalString(),
|
|
3411
3441
|
increment: n.k
|
|
3412
3442
|
};
|
|
@@ -3414,7 +3444,7 @@ function pn(t, r) {
|
|
|
3414
3444
|
}(0, t);
|
|
3415
3445
|
}))), e.precondition.isNone || (n.currentDocument = function(t, e) {
|
|
3416
3446
|
return void 0 !== e.updateTime ? {
|
|
3417
|
-
updateTime:
|
|
3447
|
+
updateTime: Ye(t, e.updateTime)
|
|
3418
3448
|
} : void 0 !== e.exists ? {
|
|
3419
3449
|
exists: e.exists
|
|
3420
3450
|
} : k();
|
|
@@ -3430,15 +3460,15 @@ function pn(t, r) {
|
|
|
3430
3460
|
}));
|
|
3431
3461
|
}
|
|
3432
3462
|
|
|
3433
|
-
function
|
|
3463
|
+
function yn(t, r) {
|
|
3434
3464
|
return e(this, void 0, void 0, (function() {
|
|
3435
3465
|
var e, i, o, a, u, s;
|
|
3436
3466
|
return n(this, (function(n) {
|
|
3437
3467
|
switch (n.label) {
|
|
3438
3468
|
case 0:
|
|
3439
|
-
return e = A(t), i =
|
|
3469
|
+
return e = A(t), i = tn(e.serializer) + "/documents", o = {
|
|
3440
3470
|
documents: r.map((function(t) {
|
|
3441
|
-
return
|
|
3471
|
+
return Xe(e.serializer, t);
|
|
3442
3472
|
}))
|
|
3443
3473
|
}, [ 4 /*yield*/ , e.R("BatchGetDocuments", i, o, r.length) ];
|
|
3444
3474
|
|
|
@@ -3447,16 +3477,16 @@ function dn(t, r) {
|
|
|
3447
3477
|
var n = function(t, e) {
|
|
3448
3478
|
return "found" in e ? function(t, e) {
|
|
3449
3479
|
I(!!e.found), e.found.name, e.found.updateTime;
|
|
3450
|
-
var n =
|
|
3480
|
+
var n = $e(t, e.found.name), r = He(e.found.updateTime), i = e.found.createTime ? He(e.found.createTime) : fe.min(), o = new ge({
|
|
3451
3481
|
mapValue: {
|
|
3452
3482
|
fields: e.found.fields
|
|
3453
3483
|
}
|
|
3454
3484
|
});
|
|
3455
|
-
return
|
|
3485
|
+
return we.newFoundDocument(n, r, i, o);
|
|
3456
3486
|
}(t, e) : "missing" in e ? function(t, e) {
|
|
3457
3487
|
I(!!e.missing), I(!!e.readTime);
|
|
3458
|
-
var n =
|
|
3459
|
-
return
|
|
3488
|
+
var n = $e(t, e.missing), r = He(e.readTime);
|
|
3489
|
+
return we.newNoDocument(n, r);
|
|
3460
3490
|
}(t, e) : k();
|
|
3461
3491
|
}(e.serializer, t);
|
|
3462
3492
|
u.set(n.key.toString(), n);
|
|
@@ -3485,7 +3515,7 @@ function dn(t, r) {
|
|
|
3485
3515
|
* See the License for the specific language governing permissions and
|
|
3486
3516
|
* limitations under the License.
|
|
3487
3517
|
*/
|
|
3488
|
-
var
|
|
3518
|
+
var mn = new Map;
|
|
3489
3519
|
|
|
3490
3520
|
/**
|
|
3491
3521
|
* An instance map that ensures only one Datastore exists per Firestore
|
|
@@ -3495,17 +3525,17 @@ var yn = new Map;
|
|
|
3495
3525
|
* Returns an initialized and started Datastore for the given Firestore
|
|
3496
3526
|
* instance. Callers must invoke removeComponents() when the Firestore
|
|
3497
3527
|
* instance is terminated.
|
|
3498
|
-
*/ function
|
|
3499
|
-
if (t._terminated) throw new B(
|
|
3500
|
-
if (!
|
|
3528
|
+
*/ function vn(t) {
|
|
3529
|
+
if (t._terminated) throw new B(x, "The client has already been terminated.");
|
|
3530
|
+
if (!mn.has(t)) {
|
|
3501
3531
|
b("ComponentProvider", "Initializing Datastore");
|
|
3502
3532
|
var e = function(t) {
|
|
3503
|
-
return new
|
|
3533
|
+
return new wt(t, fetch.bind(null));
|
|
3504
3534
|
}((i = t._databaseId, o = t.app.options.appId || "", a = t._persistenceKey, u = t._freezeSettings(),
|
|
3505
|
-
new $(i, o, a, u.host, u.ssl, u.experimentalForceLongPolling, u.experimentalAutoDetectLongPolling, u.useFetchStreams))), n =
|
|
3506
|
-
return new
|
|
3535
|
+
new $(i, o, a, u.host, u.ssl, u.experimentalForceLongPolling, u.experimentalAutoDetectLongPolling, ft(u.experimentalLongPollingOptions), u.useFetchStreams))), n = fn(t._databaseId), r = function(t, e, n, r) {
|
|
3536
|
+
return new pn(t, e, n, r);
|
|
3507
3537
|
}(t._authCredentials, t._appCheckCredentials, e, n);
|
|
3508
|
-
|
|
3538
|
+
mn.set(t, r);
|
|
3509
3539
|
}
|
|
3510
3540
|
var i, o, a, u;
|
|
3511
3541
|
/**
|
|
@@ -3523,7 +3553,7 @@ var yn = new Map;
|
|
|
3523
3553
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3524
3554
|
* See the License for the specific language governing permissions and
|
|
3525
3555
|
* limitations under the License.
|
|
3526
|
-
*/ return
|
|
3556
|
+
*/ return mn.get(t);
|
|
3527
3557
|
}
|
|
3528
3558
|
|
|
3529
3559
|
/**
|
|
@@ -3534,32 +3564,41 @@ var yn = new Map;
|
|
|
3534
3564
|
* A concrete type describing all the values that can be applied via a
|
|
3535
3565
|
* user-supplied `FirestoreSettings` object. This is a separate type so that
|
|
3536
3566
|
* defaults can be supplied and the value can be checked for equality.
|
|
3537
|
-
*/ var
|
|
3567
|
+
*/ var gn = /** @class */ function() {
|
|
3538
3568
|
function t(t) {
|
|
3539
|
-
var e;
|
|
3569
|
+
var e, n;
|
|
3540
3570
|
if (void 0 === t.host) {
|
|
3541
|
-
if (void 0 !== t.ssl) throw new B(
|
|
3571
|
+
if (void 0 !== t.ssl) throw new B(O, "Can't provide ssl option if host option is not set");
|
|
3542
3572
|
this.host = "firestore.googleapis.com", this.ssl = !0;
|
|
3543
3573
|
} else this.host = t.host, this.ssl = null === (e = t.ssl) || void 0 === e || e;
|
|
3544
3574
|
if (this.credentials = t.credentials, this.ignoreUndefinedProperties = !!t.ignoreUndefinedProperties,
|
|
3545
3575
|
this.cache = t.localCache, void 0 === t.cacheSizeBytes) this.cacheSizeBytes = 41943040; else {
|
|
3546
|
-
if (-1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new B(
|
|
3576
|
+
if (-1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new B(O, "cacheSizeBytes must be at least 1048576");
|
|
3547
3577
|
this.cacheSizeBytes = t.cacheSizeBytes;
|
|
3548
3578
|
}
|
|
3549
3579
|
!function(t, e, n, r) {
|
|
3550
|
-
if (!0 === e && !0 === r) throw new B(
|
|
3580
|
+
if (!0 === e && !0 === r) throw new B(O, "".concat("experimentalForceLongPolling", " and ").concat("experimentalAutoDetectLongPolling", " cannot be used together."));
|
|
3551
3581
|
}(0, t.experimentalForceLongPolling, 0, t.experimentalAutoDetectLongPolling), this.experimentalForceLongPolling = !!t.experimentalForceLongPolling,
|
|
3552
|
-
this.experimentalForceLongPolling
|
|
3582
|
+
this.experimentalForceLongPolling ? this.experimentalAutoDetectLongPolling = !1 : void 0 === t.experimentalAutoDetectLongPolling ? this.experimentalAutoDetectLongPolling = !0 :
|
|
3553
3583
|
// For backwards compatibility, coerce the value to boolean even though
|
|
3554
3584
|
// the TypeScript compiler has narrowed the type to boolean already.
|
|
3555
3585
|
// noinspection PointlessBooleanExpressionJS
|
|
3556
3586
|
this.experimentalAutoDetectLongPolling = !!t.experimentalAutoDetectLongPolling,
|
|
3557
|
-
this.
|
|
3587
|
+
this.experimentalLongPollingOptions = ft(null !== (n = t.experimentalLongPollingOptions) && void 0 !== n ? n : {}),
|
|
3588
|
+
function(t) {
|
|
3589
|
+
if (void 0 !== t.timeoutSeconds) {
|
|
3590
|
+
if (isNaN(t.timeoutSeconds)) throw new B(O, "invalid long polling timeout: ".concat(t.timeoutSeconds, " (must not be NaN)"));
|
|
3591
|
+
if (t.timeoutSeconds < 5) throw new B(O, "invalid long polling timeout: ".concat(t.timeoutSeconds, " (minimum allowed value is 5)"));
|
|
3592
|
+
if (t.timeoutSeconds > 30) throw new B(O, "invalid long polling timeout: ".concat(t.timeoutSeconds, " (maximum allowed value is 30)"));
|
|
3593
|
+
}
|
|
3594
|
+
}(this.experimentalLongPollingOptions), this.useFetchStreams = !!t.useFetchStreams;
|
|
3558
3595
|
}
|
|
3559
3596
|
return t.prototype.isEqual = function(t) {
|
|
3560
|
-
return this.host === t.host && this.ssl === t.ssl && this.credentials === t.credentials && this.cacheSizeBytes === t.cacheSizeBytes && this.experimentalForceLongPolling === t.experimentalForceLongPolling && this.experimentalAutoDetectLongPolling === t.experimentalAutoDetectLongPolling &&
|
|
3597
|
+
return this.host === t.host && this.ssl === t.ssl && this.credentials === t.credentials && this.cacheSizeBytes === t.cacheSizeBytes && this.experimentalForceLongPolling === t.experimentalForceLongPolling && this.experimentalAutoDetectLongPolling === t.experimentalAutoDetectLongPolling && (e = this.experimentalLongPollingOptions,
|
|
3598
|
+
n = t.experimentalLongPollingOptions, e.timeoutSeconds === n.timeoutSeconds) && this.ignoreUndefinedProperties === t.ignoreUndefinedProperties && this.useFetchStreams === t.useFetchStreams;
|
|
3599
|
+
var e, n;
|
|
3561
3600
|
}, t;
|
|
3562
|
-
}(),
|
|
3601
|
+
}(), wn = /** @class */ function() {
|
|
3563
3602
|
/** @hideconstructor */
|
|
3564
3603
|
function t(t, e, n, r) {
|
|
3565
3604
|
this._authCredentials = t, this._appCheckCredentials = e, this._databaseId = n,
|
|
@@ -3567,7 +3606,7 @@ var yn = new Map;
|
|
|
3567
3606
|
/**
|
|
3568
3607
|
* Whether it's a Firestore or Firestore Lite instance.
|
|
3569
3608
|
*/
|
|
3570
|
-
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new
|
|
3609
|
+
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new gn({}),
|
|
3571
3610
|
this._settingsFrozen = !1;
|
|
3572
3611
|
}
|
|
3573
3612
|
return Object.defineProperty(t.prototype, "app", {
|
|
@@ -3576,7 +3615,7 @@ var yn = new Map;
|
|
|
3576
3615
|
* instance.
|
|
3577
3616
|
*/
|
|
3578
3617
|
get: function() {
|
|
3579
|
-
if (!this._app) throw new B(
|
|
3618
|
+
if (!this._app) throw new B(x, "Firestore was not initialized using the Firebase SDK. 'app' is not available");
|
|
3580
3619
|
return this._app;
|
|
3581
3620
|
},
|
|
3582
3621
|
enumerable: !1,
|
|
@@ -3594,8 +3633,8 @@ var yn = new Map;
|
|
|
3594
3633
|
enumerable: !1,
|
|
3595
3634
|
configurable: !0
|
|
3596
3635
|
}), t.prototype._setSettings = function(t) {
|
|
3597
|
-
if (this._settingsFrozen) throw new B(
|
|
3598
|
-
this._settings = new
|
|
3636
|
+
if (this._settingsFrozen) throw new B(x, "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.");
|
|
3637
|
+
this._settings = new gn(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
|
|
3599
3638
|
if (!t) return new K;
|
|
3600
3639
|
switch (t.type) {
|
|
3601
3640
|
case "firstParty":
|
|
@@ -3605,7 +3644,7 @@ var yn = new Map;
|
|
|
3605
3644
|
return t.client;
|
|
3606
3645
|
|
|
3607
3646
|
default:
|
|
3608
|
-
throw new B(
|
|
3647
|
+
throw new B(O, "makeAuthCredentialsProvider failed due to invalid credential type");
|
|
3609
3648
|
}
|
|
3610
3649
|
}(t.credentials));
|
|
3611
3650
|
}, t.prototype._getSettings = function() {
|
|
@@ -3630,49 +3669,29 @@ var yn = new Map;
|
|
|
3630
3669
|
* Only ever called once.
|
|
3631
3670
|
*/
|
|
3632
3671
|
t.prototype._terminate = function() {
|
|
3633
|
-
return t = this, (e =
|
|
3634
|
-
|
|
3672
|
+
return t = this, (e = mn.get(t)) && (b("ComponentProvider", "Removing Datastore"),
|
|
3673
|
+
mn.delete(t), e.terminate()), Promise.resolve();
|
|
3635
3674
|
var t, e;
|
|
3636
3675
|
}, t;
|
|
3637
3676
|
}();
|
|
3638
3677
|
|
|
3639
|
-
|
|
3640
|
-
* @license
|
|
3641
|
-
* Copyright 2020 Google LLC
|
|
3642
|
-
*
|
|
3643
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3644
|
-
* you may not use this file except in compliance with the License.
|
|
3645
|
-
* You may obtain a copy of the License at
|
|
3646
|
-
*
|
|
3647
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3648
|
-
*
|
|
3649
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
3650
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3651
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3652
|
-
* See the License for the specific language governing permissions and
|
|
3653
|
-
* limitations under the License.
|
|
3654
|
-
*/
|
|
3655
|
-
/**
|
|
3656
|
-
* The Cloud Firestore service interface.
|
|
3657
|
-
*
|
|
3658
|
-
* Do not call this constructor directly. Instead, use {@link (getFirestore:1)}.
|
|
3659
|
-
*/ function wn(t, e, n) {
|
|
3678
|
+
function _n(t, e, n) {
|
|
3660
3679
|
n || (n = "(default)");
|
|
3661
3680
|
var r = _getProvider(t, "firestore/lite");
|
|
3662
|
-
if (r.isInitialized(n)) throw new B(
|
|
3681
|
+
if (r.isInitialized(n)) throw new B(x, "Firestore can only be initialized once per app.");
|
|
3663
3682
|
return r.initialize({
|
|
3664
3683
|
options: e,
|
|
3665
3684
|
instanceIdentifier: n
|
|
3666
3685
|
});
|
|
3667
3686
|
}
|
|
3668
3687
|
|
|
3669
|
-
function
|
|
3688
|
+
function bn(t, e) {
|
|
3670
3689
|
var n = "object" == typeof t ? t : u(), i = "string" == typeof t ? t : e || "(default)", o = _getProvider(n, "firestore/lite").getImmediate({
|
|
3671
3690
|
identifier: i
|
|
3672
3691
|
});
|
|
3673
3692
|
if (!o._initialized) {
|
|
3674
3693
|
var a = d("firestore");
|
|
3675
|
-
a &&
|
|
3694
|
+
a && Tn.apply(void 0, r([ o ], a, !1));
|
|
3676
3695
|
}
|
|
3677
3696
|
return o;
|
|
3678
3697
|
}
|
|
@@ -3689,10 +3708,10 @@ function _n(t, e) {
|
|
|
3689
3708
|
* @param port - the emulator port (ex: 9000).
|
|
3690
3709
|
* @param options.mockUserToken - the mock auth token to use for unit testing
|
|
3691
3710
|
* Security Rules.
|
|
3692
|
-
*/ function
|
|
3711
|
+
*/ function Tn(t, e, n, r) {
|
|
3693
3712
|
var i;
|
|
3694
3713
|
void 0 === r && (r = {});
|
|
3695
|
-
var o = (t = ct(t,
|
|
3714
|
+
var o = (t = ct(t, wn))._getSettings();
|
|
3696
3715
|
if ("firestore.googleapis.com" !== o.host && o.host !== e && E("Host has been set in both settings() and useEmulator(), emulator host will be used"),
|
|
3697
3716
|
t._setSettings(Object.assign(Object.assign({}, o), {
|
|
3698
3717
|
host: "".concat(e, ":").concat(n),
|
|
@@ -3704,7 +3723,7 @@ function _n(t, e) {
|
|
|
3704
3723
|
// invalid field "uid" and missing field "sub" / "user_id".)
|
|
3705
3724
|
a = y(r.mockUserToken, null === (i = t._app) || void 0 === i ? void 0 : i.options.projectId);
|
|
3706
3725
|
var s = r.mockUserToken.sub || r.mockUserToken.user_id;
|
|
3707
|
-
if (!s) throw new B(
|
|
3726
|
+
if (!s) throw new B(O, "mockUserToken must contain 'sub' or 'user_id' field!");
|
|
3708
3727
|
u = new v(s);
|
|
3709
3728
|
}
|
|
3710
3729
|
t._authCredentials = new G(new Q(a, u));
|
|
@@ -3730,8 +3749,8 @@ function _n(t, e) {
|
|
|
3730
3749
|
* @param firestore - The `Firestore` instance to terminate.
|
|
3731
3750
|
* @returns A `Promise` that is resolved when the instance has been successfully
|
|
3732
3751
|
* terminated.
|
|
3733
|
-
*/ function
|
|
3734
|
-
return t = ct(t,
|
|
3752
|
+
*/ function En(t) {
|
|
3753
|
+
return t = ct(t, wn), s(t.app, "firestore/lite"), t._delete();
|
|
3735
3754
|
}
|
|
3736
3755
|
|
|
3737
3756
|
/**
|
|
@@ -3770,7 +3789,7 @@ function _n(t, e) {
|
|
|
3770
3789
|
* Represents an aggregation that can be performed by Firestore.
|
|
3771
3790
|
*/
|
|
3772
3791
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3773
|
-
var
|
|
3792
|
+
var Sn =
|
|
3774
3793
|
/**
|
|
3775
3794
|
* Create a new AggregateField<T>
|
|
3776
3795
|
* @param _aggregateType Specifies the type of aggregation operation to perform.
|
|
@@ -3783,7 +3802,7 @@ t, e) {
|
|
|
3783
3802
|
void 0 === t && (t = "count"), this._aggregateType = t, this._internalFieldPath = e,
|
|
3784
3803
|
/** A type string to uniquely identify instances of this class. */
|
|
3785
3804
|
this.type = "AggregateField";
|
|
3786
|
-
},
|
|
3805
|
+
}, kn = /** @class */ function() {
|
|
3787
3806
|
/** @hideconstructor */
|
|
3788
3807
|
function t(t, e, n) {
|
|
3789
3808
|
this._userDataWriter = e, this._data = n,
|
|
@@ -3804,7 +3823,7 @@ t, e) {
|
|
|
3804
3823
|
return t.prototype.data = function() {
|
|
3805
3824
|
return this._userDataWriter.convertObjectMap(this._data);
|
|
3806
3825
|
}, t;
|
|
3807
|
-
}(),
|
|
3826
|
+
}(), In = /** @class */ function() {
|
|
3808
3827
|
/** @hideconstructor */
|
|
3809
3828
|
function t(t,
|
|
3810
3829
|
/**
|
|
@@ -3845,14 +3864,14 @@ t, e) {
|
|
|
3845
3864
|
* The collection this `DocumentReference` belongs to.
|
|
3846
3865
|
*/
|
|
3847
3866
|
get: function() {
|
|
3848
|
-
return new
|
|
3867
|
+
return new Pn(this.firestore, this.converter, this._key.path.popLast());
|
|
3849
3868
|
},
|
|
3850
3869
|
enumerable: !1,
|
|
3851
3870
|
configurable: !0
|
|
3852
3871
|
}), t.prototype.withConverter = function(e) {
|
|
3853
3872
|
return new t(this.firestore, e, this._key);
|
|
3854
3873
|
}, t;
|
|
3855
|
-
}(),
|
|
3874
|
+
}(), An = /** @class */ function() {
|
|
3856
3875
|
// This is the lite version of the Query class in the main SDK.
|
|
3857
3876
|
/** @hideconstructor protected */
|
|
3858
3877
|
function t(t,
|
|
@@ -3867,11 +3886,11 @@ t, e) {
|
|
|
3867
3886
|
return t.prototype.withConverter = function(e) {
|
|
3868
3887
|
return new t(this.firestore, e, this._query);
|
|
3869
3888
|
}, t;
|
|
3870
|
-
}(),
|
|
3889
|
+
}(), Pn = /** @class */ function(e) {
|
|
3871
3890
|
/** @hideconstructor */
|
|
3872
3891
|
function n(t, n, r) {
|
|
3873
3892
|
var i = this;
|
|
3874
|
-
return (i = e.call(this, t, n, new
|
|
3893
|
+
return (i = e.call(this, t, n, new Te(r)) || this)._path = r,
|
|
3875
3894
|
/** The type of this Firestore reference. */
|
|
3876
3895
|
i.type = "collection", i;
|
|
3877
3896
|
}
|
|
@@ -3898,7 +3917,7 @@ t, e) {
|
|
|
3898
3917
|
*/
|
|
3899
3918
|
get: function() {
|
|
3900
3919
|
var t = this._path.popLast();
|
|
3901
|
-
return t.isEmpty() ? null : new
|
|
3920
|
+
return t.isEmpty() ? null : new In(this.firestore,
|
|
3902
3921
|
/* converter= */ null, new it(t));
|
|
3903
3922
|
},
|
|
3904
3923
|
enumerable: !1,
|
|
@@ -3906,19 +3925,19 @@ t, e) {
|
|
|
3906
3925
|
}), n.prototype.withConverter = function(t) {
|
|
3907
3926
|
return new n(this.firestore, t, this._path);
|
|
3908
3927
|
}, n;
|
|
3909
|
-
}(
|
|
3928
|
+
}(An);
|
|
3910
3929
|
|
|
3911
3930
|
/**
|
|
3912
3931
|
* The results of executing an aggregation query.
|
|
3913
3932
|
*/ function Fn(t, e) {
|
|
3914
3933
|
for (var n = [], i = 2; i < arguments.length; i++) n[i - 2] = arguments[i];
|
|
3915
|
-
if (t = p(t), ot("collection", "path", e), t instanceof
|
|
3934
|
+
if (t = p(t), ot("collection", "path", e), t instanceof wn) {
|
|
3916
3935
|
var o = et.fromString.apply(et, r([ e ], n, !1));
|
|
3917
|
-
return ut(o), new
|
|
3936
|
+
return ut(o), new Pn(t, /* converter= */ null, o);
|
|
3918
3937
|
}
|
|
3919
|
-
if (!(t instanceof
|
|
3938
|
+
if (!(t instanceof In || t instanceof Pn)) throw new B(O, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
3920
3939
|
var a = t._path.child(et.fromString.apply(et, r([ e ], n, !1)));
|
|
3921
|
-
return ut(a), new
|
|
3940
|
+
return ut(a), new Pn(t.firestore,
|
|
3922
3941
|
/* converter= */ null, a);
|
|
3923
3942
|
}
|
|
3924
3943
|
|
|
@@ -3934,11 +3953,11 @@ t, e) {
|
|
|
3934
3953
|
* collection or subcollection with this ID as the last segment of its path
|
|
3935
3954
|
* will be included. Cannot contain a slash.
|
|
3936
3955
|
* @returns The created `Query`.
|
|
3937
|
-
*/ function
|
|
3938
|
-
if (t = ct(t,
|
|
3939
|
-
return new
|
|
3956
|
+
*/ function On(t, e) {
|
|
3957
|
+
if (t = ct(t, wn), ot("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new B(O, "Invalid collection ID '".concat(e, "' passed to function collectionGroup(). Collection IDs must not contain '/'."));
|
|
3958
|
+
return new An(t,
|
|
3940
3959
|
/* converter= */ null, function(t) {
|
|
3941
|
-
return new
|
|
3960
|
+
return new Te(et.emptyPath(), t);
|
|
3942
3961
|
}(e));
|
|
3943
3962
|
}
|
|
3944
3963
|
|
|
@@ -3947,14 +3966,14 @@ function Vn(t, e) {
|
|
|
3947
3966
|
if (t = p(t),
|
|
3948
3967
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
3949
3968
|
// 'undefined' and 'null'.
|
|
3950
|
-
1 === arguments.length && (e =
|
|
3969
|
+
1 === arguments.length && (e = Tt.N()), ot("doc", "path", e), t instanceof wn) {
|
|
3951
3970
|
var o = et.fromString.apply(et, r([ e ], n, !1));
|
|
3952
|
-
return at(o), new
|
|
3971
|
+
return at(o), new In(t,
|
|
3953
3972
|
/* converter= */ null, new it(o));
|
|
3954
3973
|
}
|
|
3955
|
-
if (!(t instanceof
|
|
3974
|
+
if (!(t instanceof In || t instanceof Pn)) throw new B(O, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
3956
3975
|
var a = t._path.child(et.fromString.apply(et, r([ e ], n, !1)));
|
|
3957
|
-
return at(a), new
|
|
3976
|
+
return at(a), new In(t.firestore, t instanceof Pn ? t.converter : null, new it(a));
|
|
3958
3977
|
}
|
|
3959
3978
|
|
|
3960
3979
|
/**
|
|
@@ -3965,7 +3984,7 @@ function Vn(t, e) {
|
|
|
3965
3984
|
* @returns true if the references point to the same location in the same
|
|
3966
3985
|
* Firestore database.
|
|
3967
3986
|
*/ function Dn(t, e) {
|
|
3968
|
-
return t = p(t), e = p(e), (t instanceof
|
|
3987
|
+
return t = p(t), e = p(e), (t instanceof In || t instanceof Pn) && (e instanceof In || e instanceof Pn) && t.firestore === e.firestore && t.path === e.path && t.converter === e.converter
|
|
3969
3988
|
/**
|
|
3970
3989
|
* Returns true if the provided queries point to the same collection and apply
|
|
3971
3990
|
* the same constraints.
|
|
@@ -3977,16 +3996,16 @@ function Vn(t, e) {
|
|
|
3977
3996
|
*/;
|
|
3978
3997
|
}
|
|
3979
3998
|
|
|
3980
|
-
function
|
|
3981
|
-
return t = p(t), e = p(e), t instanceof
|
|
3999
|
+
function Nn(t, e) {
|
|
4000
|
+
return t = p(t), e = p(e), t instanceof An && e instanceof An && t.firestore === e.firestore && function(t, e) {
|
|
3982
4001
|
return function(t, e) {
|
|
3983
4002
|
if (t.limit !== e.limit) return !1;
|
|
3984
4003
|
if (t.orderBy.length !== e.orderBy.length) return !1;
|
|
3985
|
-
for (var n = 0; n < t.orderBy.length; n++) if (!
|
|
4004
|
+
for (var n = 0; n < t.orderBy.length; n++) if (!le(t.orderBy[n], e.orderBy[n])) return !1;
|
|
3986
4005
|
if (t.filters.length !== e.filters.length) return !1;
|
|
3987
|
-
for (var r = 0; r < t.filters.length; r++) if (!
|
|
3988
|
-
return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!
|
|
3989
|
-
}(
|
|
4006
|
+
for (var r = 0; r < t.filters.length; r++) if (!te(t.filters[r], e.filters[r])) return !1;
|
|
4007
|
+
return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!Jt(t.startAt, e.startAt) && Jt(t.endAt, e.endAt);
|
|
4008
|
+
}(Ae(t), Ae(e)) && t.limitType === e.limitType;
|
|
3990
4009
|
}(t._query, e._query) && t.converter === e.converter
|
|
3991
4010
|
/**
|
|
3992
4011
|
* @license
|
|
@@ -4009,7 +4028,7 @@ function On(t, e) {
|
|
|
4009
4028
|
*/;
|
|
4010
4029
|
}
|
|
4011
4030
|
|
|
4012
|
-
var
|
|
4031
|
+
var qn = /** @class */ function() {
|
|
4013
4032
|
/** @hideconstructor */
|
|
4014
4033
|
function t(t) {
|
|
4015
4034
|
this._byteString = t;
|
|
@@ -4021,9 +4040,9 @@ var Nn = /** @class */ function() {
|
|
|
4021
4040
|
* @param base64 - The Base64 string used to create the `Bytes` object.
|
|
4022
4041
|
*/ return t.fromBase64String = function(e) {
|
|
4023
4042
|
try {
|
|
4024
|
-
return new t(
|
|
4043
|
+
return new t(Pt.fromBase64String(e));
|
|
4025
4044
|
} catch (e) {
|
|
4026
|
-
throw new B(
|
|
4045
|
+
throw new B(O, "Failed to construct data from Base64 string: " + e);
|
|
4027
4046
|
}
|
|
4028
4047
|
},
|
|
4029
4048
|
/**
|
|
@@ -4032,7 +4051,7 @@ var Nn = /** @class */ function() {
|
|
|
4032
4051
|
* @param array - The Uint8Array used to create the `Bytes` object.
|
|
4033
4052
|
*/
|
|
4034
4053
|
t.fromUint8Array = function(e) {
|
|
4035
|
-
return new t(
|
|
4054
|
+
return new t(Pt.fromUint8Array(e));
|
|
4036
4055
|
},
|
|
4037
4056
|
/**
|
|
4038
4057
|
* Returns the underlying bytes as a Base64-encoded string.
|
|
@@ -4067,7 +4086,7 @@ var Nn = /** @class */ function() {
|
|
|
4067
4086
|
t.prototype.isEqual = function(t) {
|
|
4068
4087
|
return this._byteString.isEqual(t._byteString);
|
|
4069
4088
|
}, t;
|
|
4070
|
-
}(),
|
|
4089
|
+
}(), Rn = /** @class */ function() {
|
|
4071
4090
|
/**
|
|
4072
4091
|
* Creates a `FieldPath` from the provided field names. If more than one field
|
|
4073
4092
|
* name is provided, the path will point to a nested field in a document.
|
|
@@ -4076,7 +4095,7 @@ var Nn = /** @class */ function() {
|
|
|
4076
4095
|
*/
|
|
4077
4096
|
function t() {
|
|
4078
4097
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
4079
|
-
for (var n = 0; n < t.length; ++n) if (0 === t[n].length) throw new B(
|
|
4098
|
+
for (var n = 0; n < t.length; ++n) if (0 === t[n].length) throw new B(O, "Invalid field name at argument $(i + 1). Field names must not be empty.");
|
|
4080
4099
|
this._internalPath = new rt(t);
|
|
4081
4100
|
}
|
|
4082
4101
|
/**
|
|
@@ -4117,8 +4136,8 @@ var Nn = /** @class */ function() {
|
|
|
4117
4136
|
* Returns a special sentinel `FieldPath` to refer to the ID of a document.
|
|
4118
4137
|
* It can be used in queries to sort or filter by the document ID.
|
|
4119
4138
|
*/
|
|
4120
|
-
function
|
|
4121
|
-
return new
|
|
4139
|
+
function xn() {
|
|
4140
|
+
return new Rn("__name__");
|
|
4122
4141
|
}
|
|
4123
4142
|
|
|
4124
4143
|
/**
|
|
@@ -4147,7 +4166,7 @@ function Rn() {
|
|
|
4147
4166
|
*/
|
|
4148
4167
|
function(t) {
|
|
4149
4168
|
this._methodName = t;
|
|
4150
|
-
},
|
|
4169
|
+
}, jn = /** @class */ function() {
|
|
4151
4170
|
/**
|
|
4152
4171
|
* Creates a new immutable `GeoPoint` object with the provided latitude and
|
|
4153
4172
|
* longitude values.
|
|
@@ -4155,8 +4174,8 @@ function(t) {
|
|
|
4155
4174
|
* @param longitude - The longitude as number between -180 and 180.
|
|
4156
4175
|
*/
|
|
4157
4176
|
function t(t, e) {
|
|
4158
|
-
if (!isFinite(t) || t < -90 || t > 90) throw new B(
|
|
4159
|
-
if (!isFinite(e) || e < -180 || e > 180) throw new B(
|
|
4177
|
+
if (!isFinite(t) || t < -90 || t > 90) throw new B(O, "Latitude must be a number between -90 and 90, but was: " + t);
|
|
4178
|
+
if (!isFinite(e) || e < -180 || e > 180) throw new B(O, "Longitude must be a number between -180 and 180, but was: " + e);
|
|
4160
4179
|
this._lat = t, this._long = e;
|
|
4161
4180
|
}
|
|
4162
4181
|
return Object.defineProperty(t.prototype, "latitude", {
|
|
@@ -4198,23 +4217,23 @@ function(t) {
|
|
|
4198
4217
|
* with an underscore.
|
|
4199
4218
|
*/
|
|
4200
4219
|
t.prototype._compareTo = function(t) {
|
|
4201
|
-
return
|
|
4220
|
+
return Et(this._lat, t._lat) || Et(this._long, t._long);
|
|
4202
4221
|
}, t;
|
|
4203
|
-
}(),
|
|
4222
|
+
}(), Ln = /^__.*__$/, Mn = /** @class */ function() {
|
|
4204
4223
|
function t(t, e, n) {
|
|
4205
4224
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
4206
4225
|
}
|
|
4207
4226
|
return t.prototype.toMutation = function(t, e) {
|
|
4208
|
-
return null !== this.fieldMask ? new
|
|
4227
|
+
return null !== this.fieldMask ? new Le(t, this.data, this.fieldMask, e, this.fieldTransforms) : new je(t, this.data, e, this.fieldTransforms);
|
|
4209
4228
|
}, t;
|
|
4210
|
-
}(),
|
|
4229
|
+
}(), Un = /** @class */ function() {
|
|
4211
4230
|
function t(t,
|
|
4212
4231
|
// The fieldMask does not include document transforms.
|
|
4213
4232
|
e, n) {
|
|
4214
4233
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
4215
4234
|
}
|
|
4216
4235
|
return t.prototype.toMutation = function(t, e) {
|
|
4217
|
-
return new
|
|
4236
|
+
return new Le(t, this.data, this.fieldMask, e, this.fieldTransforms);
|
|
4218
4237
|
}, t;
|
|
4219
4238
|
}();
|
|
4220
4239
|
|
|
@@ -4240,7 +4259,7 @@ function(t) {
|
|
|
4240
4259
|
*
|
|
4241
4260
|
* Latitude values are in the range of [-90, 90].
|
|
4242
4261
|
* Longitude values are in the range of [-180, 180].
|
|
4243
|
-
*/ function
|
|
4262
|
+
*/ function Bn(t) {
|
|
4244
4263
|
switch (t) {
|
|
4245
4264
|
case 0 /* UserDataSource.Set */ :
|
|
4246
4265
|
// fall through
|
|
@@ -4258,7 +4277,7 @@ function(t) {
|
|
|
4258
4277
|
}
|
|
4259
4278
|
}
|
|
4260
4279
|
|
|
4261
|
-
/** A "context" object passed around while parsing user data. */ var
|
|
4280
|
+
/** A "context" object passed around while parsing user data. */ var zn = /** @class */ function() {
|
|
4262
4281
|
/**
|
|
4263
4282
|
* Initializes a ParseContext with the given source and path.
|
|
4264
4283
|
*
|
|
@@ -4318,7 +4337,7 @@ function(t) {
|
|
|
4318
4337
|
st: !0
|
|
4319
4338
|
});
|
|
4320
4339
|
}, t.prototype.ct = function(t) {
|
|
4321
|
-
return
|
|
4340
|
+
return cr(t, this.settings.methodName, this.settings.at || !1, this.path, this.settings.ht);
|
|
4322
4341
|
},
|
|
4323
4342
|
/** Returns 'true' if 'fieldPath' was traversed when creating this context. */ t.prototype.contains = function(t) {
|
|
4324
4343
|
return void 0 !== this.fieldMask.find((function(e) {
|
|
@@ -4332,15 +4351,15 @@ function(t) {
|
|
|
4332
4351
|
if (this.path) for (var t = 0; t < this.path.length; t++) this.it(this.path.get(t));
|
|
4333
4352
|
}, t.prototype.it = function(t) {
|
|
4334
4353
|
if (0 === t.length) throw this.ct("Document fields must not be empty");
|
|
4335
|
-
if (
|
|
4354
|
+
if (Bn(this.et) && Ln.test(t)) throw this.ct('Document fields cannot begin and end with "__"');
|
|
4336
4355
|
}, t;
|
|
4337
|
-
}(),
|
|
4356
|
+
}(), Qn = /** @class */ function() {
|
|
4338
4357
|
function t(t, e, n) {
|
|
4339
|
-
this.databaseId = t, this.ignoreUndefinedProperties = e, this.serializer = n ||
|
|
4358
|
+
this.databaseId = t, this.ignoreUndefinedProperties = e, this.serializer = n || fn(t)
|
|
4340
4359
|
/** Creates a new top-level parse context. */;
|
|
4341
4360
|
}
|
|
4342
4361
|
return t.prototype.lt = function(t, e, n, r) {
|
|
4343
|
-
return void 0 === r && (r = !1), new
|
|
4362
|
+
return void 0 === r && (r = !1), new zn({
|
|
4344
4363
|
et: t,
|
|
4345
4364
|
methodName: e,
|
|
4346
4365
|
ht: n,
|
|
@@ -4354,30 +4373,30 @@ function(t) {
|
|
|
4354
4373
|
/**
|
|
4355
4374
|
* Helper for parsing raw user input (provided via the API) into internal model
|
|
4356
4375
|
* classes.
|
|
4357
|
-
*/ function
|
|
4358
|
-
var e = t._freezeSettings(), n =
|
|
4359
|
-
return new
|
|
4376
|
+
*/ function Kn(t) {
|
|
4377
|
+
var e = t._freezeSettings(), n = fn(t._databaseId);
|
|
4378
|
+
return new Qn(t._databaseId, !!e.ignoreUndefinedProperties, n);
|
|
4360
4379
|
}
|
|
4361
4380
|
|
|
4362
|
-
/** Parse document data from a set() call. */ function
|
|
4381
|
+
/** Parse document data from a set() call. */ function Gn(t, e, n, r, i, o) {
|
|
4363
4382
|
void 0 === o && (o = {});
|
|
4364
4383
|
var a = t.lt(o.merge || o.mergeFields ? 2 /* UserDataSource.MergeSet */ : 0 /* UserDataSource.Set */ , e, n, i);
|
|
4365
|
-
|
|
4366
|
-
var u, s, c =
|
|
4367
|
-
if (o.merge) u = new
|
|
4384
|
+
or("Data must be an object, but it was:", a, r);
|
|
4385
|
+
var u, s, c = rr(r, a);
|
|
4386
|
+
if (o.merge) u = new ve(a.fieldMask), s = a.fieldTransforms; else if (o.mergeFields) {
|
|
4368
4387
|
for (var l = [], f = 0, h = o.mergeFields; f < h.length; f++) {
|
|
4369
|
-
var p =
|
|
4370
|
-
if (!a.contains(p)) throw new B(
|
|
4371
|
-
|
|
4388
|
+
var p = ar(e, h[f], n);
|
|
4389
|
+
if (!a.contains(p)) throw new B(O, "Field '".concat(p, "' is specified in your field mask but missing from your input data."));
|
|
4390
|
+
lr(l, p) || l.push(p);
|
|
4372
4391
|
}
|
|
4373
|
-
u = new
|
|
4392
|
+
u = new ve(l), s = a.fieldTransforms.filter((function(t) {
|
|
4374
4393
|
return u.covers(t.field);
|
|
4375
4394
|
}));
|
|
4376
4395
|
} else u = null, s = a.fieldTransforms;
|
|
4377
|
-
return new
|
|
4396
|
+
return new Mn(new ge(c), u, s);
|
|
4378
4397
|
}
|
|
4379
4398
|
|
|
4380
|
-
var
|
|
4399
|
+
var Wn = /** @class */ function(e) {
|
|
4381
4400
|
function n() {
|
|
4382
4401
|
return null !== e && e.apply(this, arguments) || this;
|
|
4383
4402
|
}
|
|
@@ -4406,8 +4425,8 @@ var Gn = /** @class */ function(e) {
|
|
|
4406
4425
|
* context.
|
|
4407
4426
|
* @param context - The parent context.
|
|
4408
4427
|
* @param arrayElement - Whether or not the FieldValue has an array.
|
|
4409
|
-
*/ function
|
|
4410
|
-
return new
|
|
4428
|
+
*/ function Yn(t, e, n) {
|
|
4429
|
+
return new zn({
|
|
4411
4430
|
et: 3 /* UserDataSource.Argument */ ,
|
|
4412
4431
|
ht: e.settings.ht,
|
|
4413
4432
|
methodName: t._methodName,
|
|
@@ -4415,101 +4434,101 @@ var Gn = /** @class */ function(e) {
|
|
|
4415
4434
|
}, e.databaseId, e.serializer, e.ignoreUndefinedProperties);
|
|
4416
4435
|
}
|
|
4417
4436
|
|
|
4418
|
-
var
|
|
4437
|
+
var Hn = /** @class */ function(e) {
|
|
4419
4438
|
function n() {
|
|
4420
4439
|
return null !== e && e.apply(this, arguments) || this;
|
|
4421
4440
|
}
|
|
4422
4441
|
return t(n, e), n.prototype._toFieldTransform = function(t) {
|
|
4423
|
-
return new
|
|
4442
|
+
return new Re(t.path, new Ve);
|
|
4424
4443
|
}, n.prototype.isEqual = function(t) {
|
|
4425
4444
|
return t instanceof n;
|
|
4426
4445
|
}, n;
|
|
4427
|
-
}(Cn),
|
|
4446
|
+
}(Cn), Jn = /** @class */ function(e) {
|
|
4428
4447
|
function n(t, n) {
|
|
4429
4448
|
var r = this;
|
|
4430
4449
|
return (r = e.call(this, t) || this).ft = n, r;
|
|
4431
4450
|
}
|
|
4432
4451
|
return t(n, e), n.prototype._toFieldTransform = function(t) {
|
|
4433
|
-
var e =
|
|
4452
|
+
var e = Yn(this, t,
|
|
4434
4453
|
/*array=*/ !0), n = this.ft.map((function(t) {
|
|
4435
|
-
return
|
|
4454
|
+
return nr(t, e);
|
|
4436
4455
|
})), r = new De(n);
|
|
4437
|
-
return new
|
|
4456
|
+
return new Re(t.path, r);
|
|
4438
4457
|
}, n.prototype.isEqual = function(t) {
|
|
4439
4458
|
// TODO(mrschmidt): Implement isEquals
|
|
4440
4459
|
return this === t;
|
|
4441
4460
|
}, n;
|
|
4442
|
-
}(Cn),
|
|
4461
|
+
}(Cn), Xn = /** @class */ function(e) {
|
|
4443
4462
|
function n(t, n) {
|
|
4444
4463
|
var r = this;
|
|
4445
4464
|
return (r = e.call(this, t) || this).ft = n, r;
|
|
4446
4465
|
}
|
|
4447
4466
|
return t(n, e), n.prototype._toFieldTransform = function(t) {
|
|
4448
|
-
var e =
|
|
4467
|
+
var e = Yn(this, t,
|
|
4449
4468
|
/*array=*/ !0), n = this.ft.map((function(t) {
|
|
4450
|
-
return
|
|
4451
|
-
})), r = new
|
|
4452
|
-
return new
|
|
4469
|
+
return nr(t, e);
|
|
4470
|
+
})), r = new Ne(n);
|
|
4471
|
+
return new Re(t.path, r);
|
|
4453
4472
|
}, n.prototype.isEqual = function(t) {
|
|
4454
4473
|
// TODO(mrschmidt): Implement isEquals
|
|
4455
4474
|
return this === t;
|
|
4456
4475
|
}, n;
|
|
4457
|
-
}(Cn),
|
|
4476
|
+
}(Cn), $n = /** @class */ function(e) {
|
|
4458
4477
|
function n(t, n) {
|
|
4459
4478
|
var r = this;
|
|
4460
4479
|
return (r = e.call(this, t) || this).dt = n, r;
|
|
4461
4480
|
}
|
|
4462
4481
|
return t(n, e), n.prototype._toFieldTransform = function(t) {
|
|
4463
|
-
var e = new
|
|
4464
|
-
return new
|
|
4482
|
+
var e = new qe(t.serializer, Fe(t.serializer, this.dt));
|
|
4483
|
+
return new Re(t.path, e);
|
|
4465
4484
|
}, n.prototype.isEqual = function(t) {
|
|
4466
4485
|
// TODO(mrschmidt): Implement isEquals
|
|
4467
4486
|
return this === t;
|
|
4468
4487
|
}, n;
|
|
4469
4488
|
}(Cn);
|
|
4470
4489
|
|
|
4471
|
-
/** Parse update data from an update() call. */ function
|
|
4490
|
+
/** Parse update data from an update() call. */ function Zn(t, e, n, r) {
|
|
4472
4491
|
var i = t.lt(1 /* UserDataSource.Update */ , e, n);
|
|
4473
|
-
|
|
4474
|
-
var o = [], a =
|
|
4475
|
-
|
|
4476
|
-
var u =
|
|
4492
|
+
or("Data must be an object, but it was:", i, r);
|
|
4493
|
+
var o = [], a = ge.empty();
|
|
4494
|
+
It(r, (function(t, r) {
|
|
4495
|
+
var u = sr(e, t, n);
|
|
4477
4496
|
// For Compat types, we have to "extract" the underlying types before
|
|
4478
4497
|
// performing validation.
|
|
4479
4498
|
r = p(r);
|
|
4480
4499
|
var s = i.ot(u);
|
|
4481
|
-
if (r instanceof
|
|
4500
|
+
if (r instanceof Wn)
|
|
4482
4501
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4483
4502
|
o.push(u); else {
|
|
4484
|
-
var c =
|
|
4503
|
+
var c = nr(r, s);
|
|
4485
4504
|
null != c && (o.push(u), a.set(u, c));
|
|
4486
4505
|
}
|
|
4487
4506
|
}));
|
|
4488
|
-
var u = new
|
|
4489
|
-
return new
|
|
4507
|
+
var u = new ve(o);
|
|
4508
|
+
return new Un(a, u, i.fieldTransforms);
|
|
4490
4509
|
}
|
|
4491
4510
|
|
|
4492
|
-
/** Parse update data from a list of field/value arguments. */ function
|
|
4493
|
-
var a = t.lt(1 /* UserDataSource.Update */ , e, n), u = [
|
|
4494
|
-
if (o.length % 2 != 0) throw new B(
|
|
4495
|
-
for (var c = 0; c < o.length; c += 2) u.push(
|
|
4511
|
+
/** Parse update data from a list of field/value arguments. */ function tr(t, e, n, r, i, o) {
|
|
4512
|
+
var a = t.lt(1 /* UserDataSource.Update */ , e, n), u = [ ar(e, r, n) ], s = [ i ];
|
|
4513
|
+
if (o.length % 2 != 0) throw new B(O, "Function ".concat(e, "() needs to be called with an even number of arguments that alternate between field names and values."));
|
|
4514
|
+
for (var c = 0; c < o.length; c += 2) u.push(ar(e, o[c])), s.push(o[c + 1]);
|
|
4496
4515
|
// We iterate in reverse order to pick the last value for a field if the
|
|
4497
4516
|
// user specified the field multiple times.
|
|
4498
|
-
for (var l = [], f =
|
|
4517
|
+
for (var l = [], f = ge.empty(), h = u.length - 1; h >= 0; --h) if (!lr(l, u[h])) {
|
|
4499
4518
|
var d = u[h], y = s[h];
|
|
4500
4519
|
// For Compat types, we have to "extract" the underlying types before
|
|
4501
4520
|
// performing validation.
|
|
4502
4521
|
y = p(y);
|
|
4503
4522
|
var m = a.ot(d);
|
|
4504
|
-
if (y instanceof
|
|
4523
|
+
if (y instanceof Wn)
|
|
4505
4524
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4506
4525
|
l.push(d); else {
|
|
4507
|
-
var v =
|
|
4526
|
+
var v = nr(y, m);
|
|
4508
4527
|
null != v && (l.push(d), f.set(d, v));
|
|
4509
4528
|
}
|
|
4510
4529
|
}
|
|
4511
|
-
var g = new
|
|
4512
|
-
return new
|
|
4530
|
+
var g = new ve(l);
|
|
4531
|
+
return new Un(f, g, a.fieldTransforms);
|
|
4513
4532
|
}
|
|
4514
4533
|
|
|
4515
4534
|
/**
|
|
@@ -4518,8 +4537,8 @@ var Yn = /** @class */ function(e) {
|
|
|
4518
4537
|
*
|
|
4519
4538
|
* @param allowArrays - Whether the query value is an array that may directly
|
|
4520
4539
|
* contain additional arrays (e.g. the operand of an `in` query).
|
|
4521
|
-
*/ function
|
|
4522
|
-
return void 0 === r && (r = !1),
|
|
4540
|
+
*/ function er(t, e, n, r) {
|
|
4541
|
+
return void 0 === r && (r = !1), nr(n, t.lt(r ? 4 /* UserDataSource.ArrayArgument */ : 3 /* UserDataSource.Argument */ , e));
|
|
4523
4542
|
}
|
|
4524
4543
|
|
|
4525
4544
|
/**
|
|
@@ -4530,11 +4549,11 @@ var Yn = /** @class */ function(e) {
|
|
|
4530
4549
|
* the source of the data being parsed, etc.
|
|
4531
4550
|
* @returns The parsed value, or null if the value was a FieldValue sentinel
|
|
4532
4551
|
* that should not be included in the resulting parsed data.
|
|
4533
|
-
*/ function
|
|
4534
|
-
if (
|
|
4552
|
+
*/ function nr(t, e) {
|
|
4553
|
+
if (ir(
|
|
4535
4554
|
// Unwrap the API type from the Compat SDK. This will return the API type
|
|
4536
4555
|
// from firestore-exp.
|
|
4537
|
-
t = p(t))) return
|
|
4556
|
+
t = p(t))) return or("Unsupported field value:", e, t), rr(t, e);
|
|
4538
4557
|
if (t instanceof Cn)
|
|
4539
4558
|
// FieldValues usually parse into transforms (except deleteField())
|
|
4540
4559
|
// in which case we do not want to include this field in our parsed data
|
|
@@ -4547,7 +4566,7 @@ var Yn = /** @class */ function(e) {
|
|
|
4547
4566
|
*/
|
|
4548
4567
|
return function(t, e) {
|
|
4549
4568
|
// Sentinels are only supported with writes, and not within arrays.
|
|
4550
|
-
if (!
|
|
4569
|
+
if (!Bn(e.et)) throw e.ct("".concat(t._methodName, "() can only be used with update() and set()"));
|
|
4551
4570
|
if (!e.path) throw e.ct("".concat(t._methodName, "() is not currently supported inside arrays"));
|
|
4552
4571
|
var n = t._toFieldTransform(e);
|
|
4553
4572
|
n && e.fieldTransforms.push(n);
|
|
@@ -4570,7 +4589,7 @@ var Yn = /** @class */ function(e) {
|
|
|
4570
4589
|
if (e.settings.st && 4 /* UserDataSource.ArrayArgument */ !== e.et) throw e.ct("Nested arrays are not supported");
|
|
4571
4590
|
return function(t, e) {
|
|
4572
4591
|
for (var n = [], r = 0, i = 0, o = t; i < o.length; i++) {
|
|
4573
|
-
var a =
|
|
4592
|
+
var a = nr(o[i], e.ut(r));
|
|
4574
4593
|
null == a && (
|
|
4575
4594
|
// Just include nulls in the array for fields being replaced with a
|
|
4576
4595
|
// sentinel.
|
|
@@ -4597,41 +4616,41 @@ var Yn = /** @class */ function(e) {
|
|
|
4597
4616
|
stringValue: t
|
|
4598
4617
|
};
|
|
4599
4618
|
if (t instanceof Date) {
|
|
4600
|
-
var n =
|
|
4619
|
+
var n = Nt.fromDate(t);
|
|
4601
4620
|
return {
|
|
4602
|
-
timestampValue:
|
|
4621
|
+
timestampValue: Ge(e.serializer, n)
|
|
4603
4622
|
};
|
|
4604
4623
|
}
|
|
4605
|
-
if (t instanceof
|
|
4624
|
+
if (t instanceof Nt) {
|
|
4606
4625
|
// Firestore backend truncates precision down to microseconds. To ensure
|
|
4607
4626
|
// offline mode works the same with regards to truncation, perform the
|
|
4608
4627
|
// truncation immediately without waiting for the backend to do that.
|
|
4609
|
-
var r = new
|
|
4628
|
+
var r = new Nt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
|
|
4610
4629
|
return {
|
|
4611
|
-
timestampValue:
|
|
4630
|
+
timestampValue: Ge(e.serializer, r)
|
|
4612
4631
|
};
|
|
4613
4632
|
}
|
|
4614
|
-
if (t instanceof
|
|
4633
|
+
if (t instanceof jn) return {
|
|
4615
4634
|
geoPointValue: {
|
|
4616
4635
|
latitude: t.latitude,
|
|
4617
4636
|
longitude: t.longitude
|
|
4618
4637
|
}
|
|
4619
4638
|
};
|
|
4620
|
-
if (t instanceof
|
|
4621
|
-
bytesValue:
|
|
4639
|
+
if (t instanceof qn) return {
|
|
4640
|
+
bytesValue: We(e.serializer, t._byteString)
|
|
4622
4641
|
};
|
|
4623
|
-
if (t instanceof
|
|
4642
|
+
if (t instanceof In) {
|
|
4624
4643
|
var i = e.databaseId, o = t.firestore._databaseId;
|
|
4625
4644
|
if (!o.isEqual(i)) throw e.ct("Document reference is for database ".concat(o.projectId, "/").concat(o.database, " but should be for database ").concat(i.projectId, "/").concat(i.database));
|
|
4626
4645
|
return {
|
|
4627
|
-
referenceValue:
|
|
4646
|
+
referenceValue: Je(t.firestore._databaseId || e.databaseId, t._key.path)
|
|
4628
4647
|
};
|
|
4629
4648
|
}
|
|
4630
4649
|
throw e.ct("Unsupported field value: ".concat(st(t)));
|
|
4631
4650
|
}(t, e);
|
|
4632
4651
|
}
|
|
4633
4652
|
|
|
4634
|
-
function
|
|
4653
|
+
function rr(t, e) {
|
|
4635
4654
|
var n = {};
|
|
4636
4655
|
return function(t) {
|
|
4637
4656
|
for (var e in t) if (Object.prototype.hasOwnProperty.call(t, e)) return !1;
|
|
@@ -4639,8 +4658,8 @@ function nr(t, e) {
|
|
|
4639
4658
|
}(t) ?
|
|
4640
4659
|
// If we encounter an empty object, we explicitly add it to the update
|
|
4641
4660
|
// mask to ensure that the server creates a map entry.
|
|
4642
|
-
e.path && e.path.length > 0 && e.fieldMask.push(e.path) :
|
|
4643
|
-
var i =
|
|
4661
|
+
e.path && e.path.length > 0 && e.fieldMask.push(e.path) : It(t, (function(t, r) {
|
|
4662
|
+
var i = nr(r, e.rt(t));
|
|
4644
4663
|
null != i && (n[t] = i);
|
|
4645
4664
|
})), {
|
|
4646
4665
|
mapValue: {
|
|
@@ -4649,12 +4668,12 @@ function nr(t, e) {
|
|
|
4649
4668
|
};
|
|
4650
4669
|
}
|
|
4651
4670
|
|
|
4652
|
-
function
|
|
4653
|
-
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof
|
|
4671
|
+
function ir(t) {
|
|
4672
|
+
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof Nt || t instanceof jn || t instanceof qn || t instanceof In || t instanceof Cn);
|
|
4654
4673
|
}
|
|
4655
4674
|
|
|
4656
|
-
function
|
|
4657
|
-
if (!
|
|
4675
|
+
function or(t, e, n) {
|
|
4676
|
+
if (!ir(n) || !function(t) {
|
|
4658
4677
|
return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
|
|
4659
4678
|
}(n)) {
|
|
4660
4679
|
var r = st(n);
|
|
@@ -4664,20 +4683,20 @@ function ir(t, e, n) {
|
|
|
4664
4683
|
|
|
4665
4684
|
/**
|
|
4666
4685
|
* Helper that calls fromDotSeparatedString() but wraps any error thrown.
|
|
4667
|
-
*/ function
|
|
4686
|
+
*/ function ar(t, e, n) {
|
|
4668
4687
|
if (
|
|
4669
4688
|
// If required, replace the FieldPath Compat class with with the firestore-exp
|
|
4670
4689
|
// FieldPath.
|
|
4671
|
-
(e = p(e)) instanceof
|
|
4672
|
-
if ("string" == typeof e) return
|
|
4673
|
-
throw
|
|
4690
|
+
(e = p(e)) instanceof Rn) return e._internalPath;
|
|
4691
|
+
if ("string" == typeof e) return sr(t, e);
|
|
4692
|
+
throw cr("Field path arguments must be of type string or ", t,
|
|
4674
4693
|
/* hasConverter= */ !1,
|
|
4675
4694
|
/* path= */ void 0, n);
|
|
4676
4695
|
}
|
|
4677
4696
|
|
|
4678
4697
|
/**
|
|
4679
4698
|
* Matches any characters in a field path string that are reserved.
|
|
4680
|
-
*/ var
|
|
4699
|
+
*/ var ur = new RegExp("[~\\*/\\[\\]]");
|
|
4681
4700
|
|
|
4682
4701
|
/**
|
|
4683
4702
|
* Wraps fromDotSeparatedString with an error message about the method that
|
|
@@ -4687,29 +4706,29 @@ function ir(t, e, n) {
|
|
|
4687
4706
|
* split on dots.
|
|
4688
4707
|
* @param targetDoc - The document against which the field path will be
|
|
4689
4708
|
* evaluated.
|
|
4690
|
-
*/ function
|
|
4691
|
-
if (e.search(
|
|
4709
|
+
*/ function sr(t, e, n) {
|
|
4710
|
+
if (e.search(ur) >= 0) throw cr("Invalid field path (".concat(e, "). Paths must not contain '~', '*', '/', '[', or ']'"), t,
|
|
4692
4711
|
/* hasConverter= */ !1,
|
|
4693
4712
|
/* path= */ void 0, n);
|
|
4694
4713
|
try {
|
|
4695
|
-
return (new (
|
|
4714
|
+
return (new (Rn.bind.apply(Rn, r([ void 0 ], e.split("."), !1))))._internalPath;
|
|
4696
4715
|
} catch (r) {
|
|
4697
|
-
throw
|
|
4716
|
+
throw cr("Invalid field path (".concat(e, "). Paths must not be empty, begin with '.', end with '.', or contain '..'"), t,
|
|
4698
4717
|
/* hasConverter= */ !1,
|
|
4699
4718
|
/* path= */ void 0, n);
|
|
4700
4719
|
}
|
|
4701
4720
|
}
|
|
4702
4721
|
|
|
4703
|
-
function
|
|
4722
|
+
function cr(t, e, n, r, i) {
|
|
4704
4723
|
var o = r && !r.isEmpty(), a = void 0 !== i, u = "Function ".concat(e, "() called with invalid data");
|
|
4705
4724
|
n && (u += " (via `toFirestore()`)"), u += ". ";
|
|
4706
4725
|
var s = "";
|
|
4707
4726
|
return (o || a) && (s += " (found", o && (s += " in field ".concat(r)), a && (s += " in document ".concat(i)),
|
|
4708
|
-
s += ")"), new B(
|
|
4727
|
+
s += ")"), new B(O, u + t + s)
|
|
4709
4728
|
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */;
|
|
4710
4729
|
}
|
|
4711
4730
|
|
|
4712
|
-
function
|
|
4731
|
+
function lr(t, e) {
|
|
4713
4732
|
return t.some((function(t) {
|
|
4714
4733
|
return t.isEqual(e);
|
|
4715
4734
|
}));
|
|
@@ -4739,7 +4758,7 @@ function cr(t, e) {
|
|
|
4739
4758
|
* For a `DocumentSnapshot` that points to a non-existing document, any data
|
|
4740
4759
|
* access will return 'undefined'. You can use the `exists()` method to
|
|
4741
4760
|
* explicitly verify a document's existence.
|
|
4742
|
-
*/ var
|
|
4761
|
+
*/ var fr = /** @class */ function() {
|
|
4743
4762
|
// Note: This class is stripped down version of the DocumentSnapshot in
|
|
4744
4763
|
// the legacy SDK. The changes are:
|
|
4745
4764
|
// - No support for SnapshotMetadata.
|
|
@@ -4760,7 +4779,7 @@ function cr(t, e) {
|
|
|
4760
4779
|
* The `DocumentReference` for the document included in the `DocumentSnapshot`.
|
|
4761
4780
|
*/
|
|
4762
4781
|
get: function() {
|
|
4763
|
-
return new
|
|
4782
|
+
return new In(this._firestore, this._converter, this._key);
|
|
4764
4783
|
},
|
|
4765
4784
|
enumerable: !1,
|
|
4766
4785
|
configurable: !0
|
|
@@ -4785,7 +4804,7 @@ function cr(t, e) {
|
|
|
4785
4804
|
if (this._converter) {
|
|
4786
4805
|
// We only want to use the converter and create a new DocumentSnapshot
|
|
4787
4806
|
// if a converter has been provided.
|
|
4788
|
-
var t = new
|
|
4807
|
+
var t = new hr(this._firestore, this._userDataWriter, this._key, this._document,
|
|
4789
4808
|
/* converter= */ null);
|
|
4790
4809
|
return this._converter.fromFirestore(t);
|
|
4791
4810
|
}
|
|
@@ -4805,11 +4824,11 @@ function cr(t, e) {
|
|
|
4805
4824
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4806
4825
|
t.prototype.get = function(t) {
|
|
4807
4826
|
if (this._document) {
|
|
4808
|
-
var e = this._document.data.field(
|
|
4827
|
+
var e = this._document.data.field(yr("DocumentSnapshot.get", t));
|
|
4809
4828
|
if (null !== e) return this._userDataWriter.convertValue(e);
|
|
4810
4829
|
}
|
|
4811
4830
|
}, t;
|
|
4812
|
-
}(),
|
|
4831
|
+
}(), hr = /** @class */ function(e) {
|
|
4813
4832
|
function n() {
|
|
4814
4833
|
return null !== e && e.apply(this, arguments) || this;
|
|
4815
4834
|
}
|
|
@@ -4821,7 +4840,7 @@ function cr(t, e) {
|
|
|
4821
4840
|
*/ return t(n, e), n.prototype.data = function() {
|
|
4822
4841
|
return e.prototype.data.call(this);
|
|
4823
4842
|
}, n;
|
|
4824
|
-
}(
|
|
4843
|
+
}(fr), pr = /** @class */ function() {
|
|
4825
4844
|
/** @hideconstructor */
|
|
4826
4845
|
function t(t, e) {
|
|
4827
4846
|
this._docs = e, this.query = t;
|
|
@@ -4875,15 +4894,15 @@ function cr(t, e) {
|
|
|
4875
4894
|
* @param right - A snapshot to compare.
|
|
4876
4895
|
* @returns true if the snapshots are equal.
|
|
4877
4896
|
*/
|
|
4878
|
-
function
|
|
4879
|
-
return t = p(t), e = p(e), t instanceof
|
|
4897
|
+
function dr(t, e) {
|
|
4898
|
+
return t = p(t), e = p(e), t instanceof fr && e instanceof fr ? t._firestore === e._firestore && t._key.isEqual(e._key) && (null === t._document ? null === e._document : t._document.isEqual(e._document)) && t._converter === e._converter : t instanceof pr && e instanceof pr && Nn(t.query, e.query) && St(t.docs, e.docs, dr)
|
|
4880
4899
|
/**
|
|
4881
4900
|
* Helper that calls `fromDotSeparatedString()` but wraps any error thrown.
|
|
4882
4901
|
*/;
|
|
4883
4902
|
}
|
|
4884
4903
|
|
|
4885
|
-
function
|
|
4886
|
-
return "string" == typeof e ?
|
|
4904
|
+
function yr(t, e) {
|
|
4905
|
+
return "string" == typeof e ? sr(t, e) : e instanceof Rn ? e._internalPath : e._delegate._internalPath;
|
|
4887
4906
|
}
|
|
4888
4907
|
|
|
4889
4908
|
/**
|
|
@@ -4905,12 +4924,12 @@ function dr(t, e) {
|
|
|
4905
4924
|
/**
|
|
4906
4925
|
* An `AppliableConstraint` is an abstraction of a constraint that can be applied
|
|
4907
4926
|
* to a Firestore query.
|
|
4908
|
-
*/ var
|
|
4927
|
+
*/ var mr = function() {}, vr = /** @class */ function(e) {
|
|
4909
4928
|
function n() {
|
|
4910
4929
|
return null !== e && e.apply(this, arguments) || this;
|
|
4911
4930
|
}
|
|
4912
4931
|
return t(n, e), n;
|
|
4913
|
-
}(
|
|
4932
|
+
}(mr);
|
|
4914
4933
|
|
|
4915
4934
|
/**
|
|
4916
4935
|
* A `QueryConstraint` is used to narrow the set of documents returned by a
|
|
@@ -4919,16 +4938,16 @@ function dr(t, e) {
|
|
|
4919
4938
|
* (endBefore:1)}, {@link (endAt:1)}, {@link limit}, {@link limitToLast} and
|
|
4920
4939
|
* can then be passed to {@link (query:1)} to create a new query instance that
|
|
4921
4940
|
* also contains this `QueryConstraint`.
|
|
4922
|
-
*/ function
|
|
4941
|
+
*/ function gr(t, e) {
|
|
4923
4942
|
for (var n = [], r = 2; r < arguments.length; r++) n[r - 2] = arguments[r];
|
|
4924
4943
|
var i = [];
|
|
4925
|
-
e instanceof
|
|
4944
|
+
e instanceof mr && i.push(e), function(t) {
|
|
4926
4945
|
var e = t.filter((function(t) {
|
|
4927
|
-
return t instanceof
|
|
4946
|
+
return t instanceof br;
|
|
4928
4947
|
})).length, n = t.filter((function(t) {
|
|
4929
|
-
return t instanceof
|
|
4948
|
+
return t instanceof wr;
|
|
4930
4949
|
})).length;
|
|
4931
|
-
if (e > 1 || e > 0 && n > 0) throw new B(
|
|
4950
|
+
if (e > 1 || e > 0 && n > 0) throw new B(O, "InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.");
|
|
4932
4951
|
}(i = i.concat(n));
|
|
4933
4952
|
for (var o = 0, a = i; o < a.length; o++) {
|
|
4934
4953
|
var u = a[o];
|
|
@@ -4943,7 +4962,7 @@ function dr(t, e) {
|
|
|
4943
4962
|
* `QueryFieldFilterConstraint`s are created by invoking {@link where} and can then
|
|
4944
4963
|
* be passed to {@link (query:1)} to create a new query instance that also contains
|
|
4945
4964
|
* this `QueryFieldFilterConstraint`.
|
|
4946
|
-
*/ var
|
|
4965
|
+
*/ var wr = /** @class */ function(e) {
|
|
4947
4966
|
/**
|
|
4948
4967
|
* @internal
|
|
4949
4968
|
*/
|
|
@@ -4957,32 +4976,32 @@ function dr(t, e) {
|
|
|
4957
4976
|
return new n(t, e, r);
|
|
4958
4977
|
}, n.prototype._apply = function(t) {
|
|
4959
4978
|
var e = this._parse(t);
|
|
4960
|
-
return
|
|
4979
|
+
return jr(t._query, e), new An(t.firestore, t.converter, Pe(t._query, e));
|
|
4961
4980
|
}, n.prototype._parse = function(t) {
|
|
4962
|
-
var e =
|
|
4981
|
+
var e = Kn(t.firestore), n = function(t, e, n, r, i, o, a) {
|
|
4963
4982
|
var u;
|
|
4964
4983
|
if (i.isKeyField()) {
|
|
4965
|
-
if ("array-contains" /* Operator.ARRAY_CONTAINS */ === o || "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ === o) throw new B(
|
|
4984
|
+
if ("array-contains" /* Operator.ARRAY_CONTAINS */ === o || "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ === o) throw new B(O, "Invalid Query. You can't perform '".concat(o, "' queries on documentId()."));
|
|
4966
4985
|
if ("in" /* Operator.IN */ === o || "not-in" /* Operator.NOT_IN */ === o) {
|
|
4967
4986
|
Cr(a, o);
|
|
4968
4987
|
for (var s = [], c = 0, l = a; c < l.length; c++) {
|
|
4969
4988
|
var f = l[c];
|
|
4970
|
-
s.push(
|
|
4989
|
+
s.push(xr(r, t, f));
|
|
4971
4990
|
}
|
|
4972
4991
|
u = {
|
|
4973
4992
|
arrayValue: {
|
|
4974
4993
|
values: s
|
|
4975
4994
|
}
|
|
4976
4995
|
};
|
|
4977
|
-
} else u =
|
|
4996
|
+
} else u = xr(r, t, a);
|
|
4978
4997
|
} else "in" /* Operator.IN */ !== o && "not-in" /* Operator.NOT_IN */ !== o && "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ !== o || Cr(a, o),
|
|
4979
|
-
u =
|
|
4998
|
+
u = er(n, "where", a,
|
|
4980
4999
|
/* allowArrays= */ "in" /* Operator.IN */ === o || "not-in" /* Operator.NOT_IN */ === o);
|
|
4981
|
-
return
|
|
5000
|
+
return $t.create(i, o, u);
|
|
4982
5001
|
}(t._query, 0, e, t.firestore._databaseId, this._field, this._op, this._value);
|
|
4983
5002
|
return n;
|
|
4984
5003
|
}, n;
|
|
4985
|
-
}(
|
|
5004
|
+
}(vr);
|
|
4986
5005
|
|
|
4987
5006
|
/**
|
|
4988
5007
|
* Creates a {@link QueryFieldFilterConstraint} that enforces that documents
|
|
@@ -4994,9 +5013,9 @@ function dr(t, e) {
|
|
|
4994
5013
|
* "<=", "!=").
|
|
4995
5014
|
* @param value - The value for comparison
|
|
4996
5015
|
* @returns The created {@link QueryFieldFilterConstraint}.
|
|
4997
|
-
*/ function
|
|
4998
|
-
var r = e, i =
|
|
4999
|
-
return
|
|
5016
|
+
*/ function _r(t, e, n) {
|
|
5017
|
+
var r = e, i = yr("where", t);
|
|
5018
|
+
return wr._create(i, r, n);
|
|
5000
5019
|
}
|
|
5001
5020
|
|
|
5002
5021
|
/**
|
|
@@ -5006,7 +5025,7 @@ function dr(t, e) {
|
|
|
5006
5025
|
* `QueryCompositeFilterConstraint`s are created by invoking {@link or} or
|
|
5007
5026
|
* {@link and} and can then be passed to {@link (query:1)} to create a new query
|
|
5008
5027
|
* instance that also contains the `QueryCompositeFilterConstraint`.
|
|
5009
|
-
*/ var
|
|
5028
|
+
*/ var br = /** @class */ function(e) {
|
|
5010
5029
|
/**
|
|
5011
5030
|
* @internal
|
|
5012
5031
|
*/
|
|
@@ -5024,21 +5043,21 @@ function dr(t, e) {
|
|
|
5024
5043
|
})).filter((function(t) {
|
|
5025
5044
|
return t.getFilters().length > 0;
|
|
5026
5045
|
}));
|
|
5027
|
-
return 1 === e.length ? e[0] :
|
|
5046
|
+
return 1 === e.length ? e[0] : Zt.create(e, this._getOperator());
|
|
5028
5047
|
}, n.prototype._apply = function(t) {
|
|
5029
5048
|
var e = this._parse(t);
|
|
5030
5049
|
return 0 === e.getFilters().length ? t : (function(t, e) {
|
|
5031
5050
|
for (var n = t, r = 0, i = e.getFlattenedFilters(); r < i.length; r++) {
|
|
5032
5051
|
var o = i[r];
|
|
5033
|
-
|
|
5052
|
+
jr(n, o), n = Pe(n, o);
|
|
5034
5053
|
}
|
|
5035
|
-
}(t._query, e), new
|
|
5054
|
+
}(t._query, e), new An(t.firestore, t.converter, Pe(t._query, e)));
|
|
5036
5055
|
}, n.prototype._getQueryConstraints = function() {
|
|
5037
5056
|
return this._queryConstraints;
|
|
5038
5057
|
}, n.prototype._getOperator = function() {
|
|
5039
5058
|
return "and" === this.type ? "and" /* CompositeOperator.AND */ : "or" /* CompositeOperator.OR */;
|
|
5040
5059
|
}, n;
|
|
5041
|
-
}(
|
|
5060
|
+
}(mr);
|
|
5042
5061
|
|
|
5043
5062
|
/**
|
|
5044
5063
|
* Creates a new {@link QueryCompositeFilterConstraint} that is a disjunction of
|
|
@@ -5049,12 +5068,12 @@ function dr(t, e) {
|
|
|
5049
5068
|
* {@link QueryFilterConstraint}s to perform a disjunction for. These must be
|
|
5050
5069
|
* created with calls to {@link where}, {@link or}, or {@link and}.
|
|
5051
5070
|
* @returns The newly created {@link QueryCompositeFilterConstraint}.
|
|
5052
|
-
*/ function
|
|
5071
|
+
*/ function Tr() {
|
|
5053
5072
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
5054
5073
|
// Only support QueryFilterConstraints
|
|
5055
5074
|
return t.forEach((function(t) {
|
|
5056
|
-
return
|
|
5057
|
-
})),
|
|
5075
|
+
return Mr("or", t);
|
|
5076
|
+
})), br._create("or" /* CompositeOperator.OR */ , t)
|
|
5058
5077
|
/**
|
|
5059
5078
|
* Creates a new {@link QueryCompositeFilterConstraint} that is a conjunction of
|
|
5060
5079
|
* the given filter constraints. A conjunction filter includes a document if it
|
|
@@ -5067,12 +5086,12 @@ function dr(t, e) {
|
|
|
5067
5086
|
*/;
|
|
5068
5087
|
}
|
|
5069
5088
|
|
|
5070
|
-
function
|
|
5089
|
+
function Er() {
|
|
5071
5090
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
5072
5091
|
// Only support QueryFilterConstraints
|
|
5073
5092
|
return t.forEach((function(t) {
|
|
5074
|
-
return
|
|
5075
|
-
})),
|
|
5093
|
+
return Mr("and", t);
|
|
5094
|
+
})), br._create("and" /* CompositeOperator.AND */ , t)
|
|
5076
5095
|
/**
|
|
5077
5096
|
* A `QueryOrderByConstraint` is used to sort the set of documents returned by a
|
|
5078
5097
|
* Firestore query. `QueryOrderByConstraint`s are created by invoking
|
|
@@ -5084,7 +5103,7 @@ function Tr() {
|
|
|
5084
5103
|
*/;
|
|
5085
5104
|
}
|
|
5086
5105
|
|
|
5087
|
-
var
|
|
5106
|
+
var Sr = /** @class */ function(e) {
|
|
5088
5107
|
/**
|
|
5089
5108
|
* @internal
|
|
5090
5109
|
*/
|
|
@@ -5098,24 +5117,24 @@ var Er = /** @class */ function(e) {
|
|
|
5098
5117
|
return new n(t, e);
|
|
5099
5118
|
}, n.prototype._apply = function(t) {
|
|
5100
5119
|
var e = function(t, e, n) {
|
|
5101
|
-
if (null !== t.startAt) throw new B(
|
|
5102
|
-
if (null !== t.endAt) throw new B(
|
|
5103
|
-
var r = new
|
|
5120
|
+
if (null !== t.startAt) throw new B(O, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
|
|
5121
|
+
if (null !== t.endAt) throw new B(O, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
|
|
5122
|
+
var r = new ce(e, n);
|
|
5104
5123
|
return function(t, e) {
|
|
5105
|
-
if (null ===
|
|
5124
|
+
if (null === Ee(t)) {
|
|
5106
5125
|
// This is the first order by. It must match any inequality.
|
|
5107
|
-
var n =
|
|
5108
|
-
null !== n &&
|
|
5126
|
+
var n = Se(t);
|
|
5127
|
+
null !== n && Lr(t, n, e.field);
|
|
5109
5128
|
}
|
|
5110
5129
|
}(t, r), r;
|
|
5111
5130
|
}(t._query, this._field, this._direction);
|
|
5112
|
-
return new
|
|
5131
|
+
return new An(t.firestore, t.converter, function(t, e) {
|
|
5113
5132
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
5114
5133
|
var n = t.explicitOrderBy.concat([ e ]);
|
|
5115
|
-
return new
|
|
5134
|
+
return new Te(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
|
|
5116
5135
|
}(t._query, e));
|
|
5117
5136
|
}, n;
|
|
5118
|
-
}(
|
|
5137
|
+
}(vr);
|
|
5119
5138
|
|
|
5120
5139
|
/**
|
|
5121
5140
|
* Creates a {@link QueryOrderByConstraint} that sorts the query result by the
|
|
@@ -5128,10 +5147,10 @@ var Er = /** @class */ function(e) {
|
|
|
5128
5147
|
* @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
|
|
5129
5148
|
* not specified, order will be ascending.
|
|
5130
5149
|
* @returns The created {@link QueryOrderByConstraint}.
|
|
5131
|
-
*/ function
|
|
5150
|
+
*/ function kr(t, e) {
|
|
5132
5151
|
void 0 === e && (e = "asc");
|
|
5133
|
-
var n = e, r =
|
|
5134
|
-
return
|
|
5152
|
+
var n = e, r = yr("orderBy", t);
|
|
5153
|
+
return Sr._create(r, n);
|
|
5135
5154
|
}
|
|
5136
5155
|
|
|
5137
5156
|
/**
|
|
@@ -5140,7 +5159,7 @@ var Er = /** @class */ function(e) {
|
|
|
5140
5159
|
* `QueryLimitConstraint`s are created by invoking {@link limit} or
|
|
5141
5160
|
* {@link limitToLast} and can then be passed to {@link (query:1)} to create a new
|
|
5142
5161
|
* query instance that also contains this `QueryLimitConstraint`.
|
|
5143
|
-
*/ var
|
|
5162
|
+
*/ var Ir = /** @class */ function(e) {
|
|
5144
5163
|
/**
|
|
5145
5164
|
* @internal
|
|
5146
5165
|
*/
|
|
@@ -5153,11 +5172,11 @@ var Er = /** @class */ function(e) {
|
|
|
5153
5172
|
return t(n, e), n._create = function(t, e, r) {
|
|
5154
5173
|
return new n(t, e, r);
|
|
5155
5174
|
}, n.prototype._apply = function(t) {
|
|
5156
|
-
return new
|
|
5157
|
-
return new
|
|
5175
|
+
return new An(t.firestore, t.converter, function(t, e, n) {
|
|
5176
|
+
return new Te(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
|
|
5158
5177
|
}(t._query, this._limit, this._limitType));
|
|
5159
5178
|
}, n;
|
|
5160
|
-
}(
|
|
5179
|
+
}(vr);
|
|
5161
5180
|
|
|
5162
5181
|
/**
|
|
5163
5182
|
* Creates a {@link QueryLimitConstraint} that only returns the first matching
|
|
@@ -5165,8 +5184,8 @@ var Er = /** @class */ function(e) {
|
|
|
5165
5184
|
*
|
|
5166
5185
|
* @param limit - The maximum number of items to return.
|
|
5167
5186
|
* @returns The created {@link QueryLimitConstraint}.
|
|
5168
|
-
*/ function
|
|
5169
|
-
return lt("limit", t),
|
|
5187
|
+
*/ function Ar(t) {
|
|
5188
|
+
return lt("limit", t), Ir._create("limit", t, "F" /* LimitType.First */)
|
|
5170
5189
|
/**
|
|
5171
5190
|
* Creates a {@link QueryLimitConstraint} that only returns the last matching
|
|
5172
5191
|
* documents.
|
|
@@ -5179,8 +5198,8 @@ var Er = /** @class */ function(e) {
|
|
|
5179
5198
|
*/;
|
|
5180
5199
|
}
|
|
5181
5200
|
|
|
5182
|
-
function
|
|
5183
|
-
return lt("limitToLast", t),
|
|
5201
|
+
function Pr(t) {
|
|
5202
|
+
return lt("limitToLast", t), Ir._create("limitToLast", t, "L" /* LimitType.Last */)
|
|
5184
5203
|
/**
|
|
5185
5204
|
* A `QueryStartAtConstraint` is used to exclude documents from the start of a
|
|
5186
5205
|
* result set returned by a Firestore query.
|
|
@@ -5204,14 +5223,14 @@ var Fr = /** @class */ function(e) {
|
|
|
5204
5223
|
return t(n, e), n._create = function(t, e, r) {
|
|
5205
5224
|
return new n(t, e, r);
|
|
5206
5225
|
}, n.prototype._apply = function(t) {
|
|
5207
|
-
var e =
|
|
5208
|
-
return new
|
|
5209
|
-
return new
|
|
5226
|
+
var e = Rr(t, this.type, this._docOrFields, this._inclusive);
|
|
5227
|
+
return new An(t.firestore, t.converter, function(t, e) {
|
|
5228
|
+
return new Te(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
|
|
5210
5229
|
}(t._query, e));
|
|
5211
5230
|
}, n;
|
|
5212
|
-
}(
|
|
5231
|
+
}(vr);
|
|
5213
5232
|
|
|
5214
|
-
function
|
|
5233
|
+
function Or() {
|
|
5215
5234
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
5216
5235
|
return Fr._create("startAt", t,
|
|
5217
5236
|
/*inclusive=*/ !0);
|
|
@@ -5243,28 +5262,28 @@ function Vr() {
|
|
|
5243
5262
|
return t(n, e), n._create = function(t, e, r) {
|
|
5244
5263
|
return new n(t, e, r);
|
|
5245
5264
|
}, n.prototype._apply = function(t) {
|
|
5246
|
-
var e =
|
|
5247
|
-
return new
|
|
5248
|
-
return new
|
|
5265
|
+
var e = Rr(t, this.type, this._docOrFields, this._inclusive);
|
|
5266
|
+
return new An(t.firestore, t.converter, function(t, e) {
|
|
5267
|
+
return new Te(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
|
|
5249
5268
|
}(t._query, e));
|
|
5250
5269
|
}, n;
|
|
5251
|
-
}(
|
|
5270
|
+
}(vr);
|
|
5252
5271
|
|
|
5253
|
-
function
|
|
5272
|
+
function Nr() {
|
|
5254
5273
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
5255
5274
|
return Dr._create("endBefore", t,
|
|
5256
5275
|
/*inclusive=*/ !1);
|
|
5257
5276
|
}
|
|
5258
5277
|
|
|
5259
|
-
function
|
|
5278
|
+
function qr() {
|
|
5260
5279
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
5261
5280
|
return Dr._create("endAt", t,
|
|
5262
5281
|
/*inclusive=*/ !0);
|
|
5263
5282
|
}
|
|
5264
5283
|
|
|
5265
|
-
/** Helper function to create a bound from a document or fields */ function
|
|
5266
|
-
if (n[0] = p(n[0]), n[0] instanceof
|
|
5267
|
-
if (!r) throw new B(
|
|
5284
|
+
/** Helper function to create a bound from a document or fields */ function Rr(t, e, n, r) {
|
|
5285
|
+
if (n[0] = p(n[0]), n[0] instanceof fr) return function(t, e, n, r, i) {
|
|
5286
|
+
if (!r) throw new B(D, "Can't use a DocumentSnapshot that doesn't exist for ".concat(n, "()."));
|
|
5268
5287
|
// Because people expect to continue/end a query at the exact document
|
|
5269
5288
|
// provided, we need to use the implicit sort order rather than the explicit
|
|
5270
5289
|
// sort order, because it's guaranteed to contain the document key. That way
|
|
@@ -5272,60 +5291,60 @@ function Nr() {
|
|
|
5272
5291
|
// the provided document. Without the key (by using the explicit sort
|
|
5273
5292
|
// orders), multiple documents could match the position, yielding duplicate
|
|
5274
5293
|
// results.
|
|
5275
|
-
for (var o = [], a = 0, u =
|
|
5294
|
+
for (var o = [], a = 0, u = Ie(t); a < u.length; a++) {
|
|
5276
5295
|
var s = u[a];
|
|
5277
|
-
if (s.field.isKeyField()) o.push(
|
|
5296
|
+
if (s.field.isKeyField()) o.push(zt(e, r.key)); else {
|
|
5278
5297
|
var c = r.data.field(s.field);
|
|
5279
|
-
if (
|
|
5298
|
+
if (qt(c)) throw new B(O, 'Invalid query. You are trying to start or end a query using a document for which the field "' + s.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');
|
|
5280
5299
|
if (null === c) {
|
|
5281
5300
|
var l = s.field.canonicalString();
|
|
5282
|
-
throw new B(
|
|
5301
|
+
throw new B(O, "Invalid query. You are trying to start or end a query using a document for which the field '".concat(l, "' (used as the orderBy) does not exist."));
|
|
5283
5302
|
}
|
|
5284
5303
|
o.push(c);
|
|
5285
5304
|
}
|
|
5286
5305
|
}
|
|
5287
|
-
return new
|
|
5306
|
+
return new Ht(o, i);
|
|
5288
5307
|
}(t._query, t.firestore._databaseId, e, n[0]._document, r);
|
|
5289
|
-
var i =
|
|
5308
|
+
var i = Kn(t.firestore);
|
|
5290
5309
|
return function(t, e, n, r, i, o) {
|
|
5291
5310
|
// Use explicit order by's because it has to match the query the user made
|
|
5292
5311
|
var a = t.explicitOrderBy;
|
|
5293
|
-
if (i.length > a.length) throw new B(
|
|
5312
|
+
if (i.length > a.length) throw new B(O, "Too many arguments provided to ".concat(r, "(). The number of arguments must be less than or equal to the number of orderBy() clauses"));
|
|
5294
5313
|
for (var u = [], s = 0; s < i.length; s++) {
|
|
5295
5314
|
var c = i[s];
|
|
5296
5315
|
if (a[s].field.isKeyField()) {
|
|
5297
|
-
if ("string" != typeof c) throw new B(
|
|
5298
|
-
if (!
|
|
5316
|
+
if ("string" != typeof c) throw new B(O, "Invalid query. Expected a string for document ID in ".concat(r, "(), but got a ").concat(typeof c));
|
|
5317
|
+
if (!ke(t) && -1 !== c.indexOf("/")) throw new B(O, "Invalid query. When querying a collection and ordering by documentId(), the value passed to ".concat(r, "() must be a plain document ID, but '").concat(c, "' contains a slash."));
|
|
5299
5318
|
var l = t.path.child(et.fromString(c));
|
|
5300
|
-
if (!it.isDocumentKey(l)) throw new B(
|
|
5319
|
+
if (!it.isDocumentKey(l)) throw new B(O, "Invalid query. When querying a collection group and ordering by documentId(), the value passed to ".concat(r, "() must result in a valid document path, but '").concat(l, "' is not because it contains an odd number of segments."));
|
|
5301
5320
|
var f = new it(l);
|
|
5302
|
-
u.push(
|
|
5321
|
+
u.push(zt(e, f));
|
|
5303
5322
|
} else {
|
|
5304
|
-
var h =
|
|
5323
|
+
var h = er(n, r, c);
|
|
5305
5324
|
u.push(h);
|
|
5306
5325
|
}
|
|
5307
5326
|
}
|
|
5308
|
-
return new
|
|
5327
|
+
return new Ht(u, o);
|
|
5309
5328
|
}(t._query, t.firestore._databaseId, i, e, n, r);
|
|
5310
5329
|
}
|
|
5311
5330
|
|
|
5312
|
-
function
|
|
5331
|
+
function xr(t, e, n) {
|
|
5313
5332
|
if ("string" == typeof (n = p(n))) {
|
|
5314
|
-
if ("" === n) throw new B(
|
|
5315
|
-
if (!
|
|
5333
|
+
if ("" === n) throw new B(O, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
|
|
5334
|
+
if (!ke(e) && -1 !== n.indexOf("/")) throw new B(O, "Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '".concat(n, "' contains a '/' character."));
|
|
5316
5335
|
var r = e.path.child(et.fromString(n));
|
|
5317
|
-
if (!it.isDocumentKey(r)) throw new B(
|
|
5318
|
-
return
|
|
5336
|
+
if (!it.isDocumentKey(r)) throw new B(O, "Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '".concat(r, "' is not because it has an odd number of segments (").concat(r.length, ")."));
|
|
5337
|
+
return zt(t, new it(r));
|
|
5319
5338
|
}
|
|
5320
|
-
if (n instanceof
|
|
5321
|
-
throw new B(
|
|
5339
|
+
if (n instanceof In) return zt(t, n._key);
|
|
5340
|
+
throw new B(O, "Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ".concat(st(n), "."));
|
|
5322
5341
|
}
|
|
5323
5342
|
|
|
5324
5343
|
/**
|
|
5325
5344
|
* Validates that the value passed into a disjunctive filter satisfies all
|
|
5326
5345
|
* array requirements.
|
|
5327
5346
|
*/ function Cr(t, e) {
|
|
5328
|
-
if (!Array.isArray(t) || 0 === t.length) throw new B(
|
|
5347
|
+
if (!Array.isArray(t) || 0 === t.length) throw new B(O, "Invalid Query. A non-empty array is required for '".concat(e.toString(), "' filters."));
|
|
5329
5348
|
}
|
|
5330
5349
|
|
|
5331
5350
|
/**
|
|
@@ -5337,12 +5356,12 @@ function Rr(t, e, n) {
|
|
|
5337
5356
|
* Operators in a query must adhere to the following set of rules:
|
|
5338
5357
|
* 1. Only one inequality per query.
|
|
5339
5358
|
* 2. `NOT_IN` cannot be used with array, disjunctive, or `NOT_EQUAL` operators.
|
|
5340
|
-
*/ function
|
|
5359
|
+
*/ function jr(t, e) {
|
|
5341
5360
|
if (e.isInequality()) {
|
|
5342
|
-
var n =
|
|
5343
|
-
if (null !== n && !n.isEqual(r)) throw new B(
|
|
5344
|
-
var i =
|
|
5345
|
-
null !== i &&
|
|
5361
|
+
var n = Se(t), r = e.field;
|
|
5362
|
+
if (null !== n && !n.isEqual(r)) throw new B(O, "Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '".concat(n.toString(), "' and '").concat(r.toString(), "'"));
|
|
5363
|
+
var i = Ee(t);
|
|
5364
|
+
null !== i && Lr(t, r, i);
|
|
5346
5365
|
}
|
|
5347
5366
|
var o = function(t, e) {
|
|
5348
5367
|
for (var n = 0, r = t; n < r.length; n++) for (var i = 0, o = r[n].getFlattenedFilters(); i < o.length; i++) {
|
|
@@ -5368,15 +5387,15 @@ function Rr(t, e, n) {
|
|
|
5368
5387
|
}(e.op));
|
|
5369
5388
|
if (null !== o)
|
|
5370
5389
|
// Special case when it's a duplicate op to give a slightly clearer error message.
|
|
5371
|
-
throw o === e.op ? new B(
|
|
5390
|
+
throw o === e.op ? new B(O, "Invalid query. You cannot use more than one '".concat(e.op.toString(), "' filter.")) : new B(O, "Invalid query. You cannot use '".concat(e.op.toString(), "' filters with '").concat(o.toString(), "' filters."));
|
|
5372
5391
|
}
|
|
5373
5392
|
|
|
5374
|
-
function
|
|
5375
|
-
if (!n.isEqual(e)) throw new B(
|
|
5393
|
+
function Lr(t, e, n) {
|
|
5394
|
+
if (!n.isEqual(e)) throw new B(O, "Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '".concat(e.toString(), "' and so you must also use '").concat(e.toString(), "' as your first argument to orderBy(), but your first orderBy() is on field '").concat(n.toString(), "' instead."));
|
|
5376
5395
|
}
|
|
5377
5396
|
|
|
5378
|
-
function
|
|
5379
|
-
if (!(e instanceof
|
|
5397
|
+
function Mr(t, e) {
|
|
5398
|
+
if (!(e instanceof wr || e instanceof br)) throw new B(O, "Function ".concat(t, "() requires AppliableConstraints created with a call to 'where(...)', 'or(...)', or 'and(...)'."));
|
|
5380
5399
|
}
|
|
5381
5400
|
|
|
5382
5401
|
/**
|
|
@@ -5403,28 +5422,28 @@ function Lr(t, e) {
|
|
|
5403
5422
|
* because we want to provide the user with a more specific error message if
|
|
5404
5423
|
* their `set()` or fails due to invalid data originating from a `toFirestore()`
|
|
5405
5424
|
* call.
|
|
5406
|
-
*/ function
|
|
5425
|
+
*/ function Ur(t, e, n) {
|
|
5407
5426
|
// Cast to `any` in order to satisfy the union type constraint on
|
|
5408
5427
|
// toFirestore().
|
|
5409
5428
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5410
5429
|
return t ? n && (n.merge || n.mergeFields) ? t.toFirestore(e, n) : t.toFirestore(e) : e;
|
|
5411
5430
|
}
|
|
5412
5431
|
|
|
5413
|
-
var
|
|
5432
|
+
var Br = /** @class */ function(e) {
|
|
5414
5433
|
function n(t) {
|
|
5415
5434
|
var n = this;
|
|
5416
5435
|
return (n = e.call(this) || this).firestore = t, n;
|
|
5417
5436
|
}
|
|
5418
5437
|
return t(n, e), n.prototype.convertBytes = function(t) {
|
|
5419
|
-
return new
|
|
5438
|
+
return new qn(t);
|
|
5420
5439
|
}, n.prototype.convertReference = function(t) {
|
|
5421
5440
|
var e = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
5422
|
-
return new
|
|
5441
|
+
return new In(this.firestore, /* converter= */ null, e);
|
|
5423
5442
|
}, n;
|
|
5424
5443
|
}(/** @class */ function() {
|
|
5425
5444
|
function t() {}
|
|
5426
5445
|
return t.prototype.convertValue = function(t, e) {
|
|
5427
|
-
switch (void 0 === e && (e = "none"),
|
|
5446
|
+
switch (void 0 === e && (e = "none"), jt(t)) {
|
|
5428
5447
|
case 0 /* TypeOrder.NullValue */ :
|
|
5429
5448
|
return null;
|
|
5430
5449
|
|
|
@@ -5471,11 +5490,11 @@ var Ur = /** @class */ function(e) {
|
|
|
5471
5490
|
var n = this;
|
|
5472
5491
|
void 0 === e && (e = "none");
|
|
5473
5492
|
var r = {};
|
|
5474
|
-
return
|
|
5493
|
+
return It(t, (function(t, i) {
|
|
5475
5494
|
r[t] = n.convertValue(i, e);
|
|
5476
5495
|
})), r;
|
|
5477
5496
|
}, t.prototype.convertGeoPoint = function(t) {
|
|
5478
|
-
return new
|
|
5497
|
+
return new jn(Vt(t.latitude), Vt(t.longitude));
|
|
5479
5498
|
}, t.prototype.convertArray = function(t, e) {
|
|
5480
5499
|
var n = this;
|
|
5481
5500
|
return (t.values || []).map((function(t) {
|
|
@@ -5484,21 +5503,21 @@ var Ur = /** @class */ function(e) {
|
|
|
5484
5503
|
}, t.prototype.convertServerTimestamp = function(t, e) {
|
|
5485
5504
|
switch (e) {
|
|
5486
5505
|
case "previous":
|
|
5487
|
-
var n =
|
|
5506
|
+
var n = Rt(t);
|
|
5488
5507
|
return null == n ? null : this.convertValue(n, e);
|
|
5489
5508
|
|
|
5490
5509
|
case "estimate":
|
|
5491
|
-
return this.convertTimestamp(
|
|
5510
|
+
return this.convertTimestamp(xt(t));
|
|
5492
5511
|
|
|
5493
5512
|
default:
|
|
5494
5513
|
return null;
|
|
5495
5514
|
}
|
|
5496
5515
|
}, t.prototype.convertTimestamp = function(t) {
|
|
5497
|
-
var e =
|
|
5498
|
-
return new
|
|
5516
|
+
var e = Ot(t);
|
|
5517
|
+
return new Nt(e.seconds, e.nanos);
|
|
5499
5518
|
}, t.prototype.convertDocumentKey = function(t, e) {
|
|
5500
5519
|
var n = et.fromString(t);
|
|
5501
|
-
I(
|
|
5520
|
+
I(ln(n));
|
|
5502
5521
|
var r = new Z(n.get(1), n.get(3)), i = new it(n.popFirst(5));
|
|
5503
5522
|
return r.isEqual(e) ||
|
|
5504
5523
|
// TODO(b/64130202): Somehow support foreign references.
|
|
@@ -5519,12 +5538,12 @@ var Ur = /** @class */ function(e) {
|
|
|
5519
5538
|
* @param reference - The reference of the document to fetch.
|
|
5520
5539
|
* @returns A Promise resolved with a `DocumentSnapshot` containing the current
|
|
5521
5540
|
* document contents.
|
|
5522
|
-
*/ function
|
|
5523
|
-
var e =
|
|
5524
|
-
return
|
|
5541
|
+
*/ function zr(t) {
|
|
5542
|
+
var e = vn((t = ct(t, In)).firestore), n = new Br(t.firestore);
|
|
5543
|
+
return yn(e, [ t._key ]).then((function(e) {
|
|
5525
5544
|
I(1 === e.length);
|
|
5526
5545
|
var r = e[0];
|
|
5527
|
-
return new
|
|
5546
|
+
return new fr(t.firestore, n, t._key, r.isFoundDocument() ? r : null, t.converter);
|
|
5528
5547
|
}));
|
|
5529
5548
|
}
|
|
5530
5549
|
|
|
@@ -5539,18 +5558,18 @@ var Ur = /** @class */ function(e) {
|
|
|
5539
5558
|
*
|
|
5540
5559
|
* @param query - The `Query` to execute.
|
|
5541
5560
|
* @returns A Promise that will be resolved with the results of the query.
|
|
5542
|
-
*/ function
|
|
5561
|
+
*/ function Qr(t) {
|
|
5543
5562
|
!function(t) {
|
|
5544
5563
|
if ("L" /* LimitType.Last */ === t.limitType && 0 === t.explicitOrderBy.length) throw new B(L, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
5545
|
-
}((t = ct(t,
|
|
5546
|
-
var r =
|
|
5564
|
+
}((t = ct(t, An))._query);
|
|
5565
|
+
var r = vn(t.firestore), i = new Br(t.firestore);
|
|
5547
5566
|
return function(t, r) {
|
|
5548
5567
|
return e(this, void 0, void 0, (function() {
|
|
5549
5568
|
var e, i;
|
|
5550
5569
|
return n(this, (function(n) {
|
|
5551
5570
|
switch (n.label) {
|
|
5552
5571
|
case 0:
|
|
5553
|
-
return e = A(t), i =
|
|
5572
|
+
return e = A(t), i = nn(e.serializer, Ae(r)), [ 4 /*yield*/ , e.R("RunQuery", i.parent, {
|
|
5554
5573
|
structuredQuery: i.structuredQuery
|
|
5555
5574
|
}) ];
|
|
5556
5575
|
|
|
@@ -5559,12 +5578,12 @@ var Ur = /** @class */ function(e) {
|
|
|
5559
5578
|
return !!t.document;
|
|
5560
5579
|
})).map((function(t) {
|
|
5561
5580
|
return function(t, e, n) {
|
|
5562
|
-
var r =
|
|
5581
|
+
var r = $e(t, e.name), i = He(e.updateTime), o = e.createTime ? He(e.createTime) : fe.min(), a = new ge({
|
|
5563
5582
|
mapValue: {
|
|
5564
5583
|
fields: e.fields
|
|
5565
5584
|
}
|
|
5566
5585
|
});
|
|
5567
|
-
return
|
|
5586
|
+
return we.newFoundDocument(r, i, o, a);
|
|
5568
5587
|
}(e.serializer, t.document);
|
|
5569
5588
|
})) ];
|
|
5570
5589
|
}
|
|
@@ -5572,28 +5591,28 @@ var Ur = /** @class */ function(e) {
|
|
|
5572
5591
|
}));
|
|
5573
5592
|
}(r, t._query).then((function(e) {
|
|
5574
5593
|
var n = e.map((function(e) {
|
|
5575
|
-
return new
|
|
5594
|
+
return new hr(t.firestore, i, e.key, e, t.converter);
|
|
5576
5595
|
}));
|
|
5577
5596
|
return "L" /* LimitType.Last */ === t._query.limitType &&
|
|
5578
5597
|
// Limit to last queries reverse the orderBy constraint that was
|
|
5579
5598
|
// specified by the user. As such, we need to reverse the order of the
|
|
5580
5599
|
// results to return the documents in the expected order.
|
|
5581
|
-
n.reverse(), new
|
|
5600
|
+
n.reverse(), new pr(t, n);
|
|
5582
5601
|
}));
|
|
5583
5602
|
}
|
|
5584
5603
|
|
|
5585
|
-
function
|
|
5586
|
-
var r =
|
|
5587
|
-
return
|
|
5604
|
+
function Kr(t, e, n) {
|
|
5605
|
+
var r = Ur((t = ct(t, In)).converter, e, n), i = Gn(Kn(t.firestore), "setDoc", t._key, r, null !== t.converter, n);
|
|
5606
|
+
return dn(vn(t.firestore), [ i.toMutation(t._key, xe.none()) ]);
|
|
5588
5607
|
}
|
|
5589
5608
|
|
|
5590
|
-
function
|
|
5609
|
+
function Gr(t, e, n) {
|
|
5591
5610
|
for (var r = [], i = 3; i < arguments.length; i++) r[i - 3] = arguments[i];
|
|
5592
|
-
var o, a =
|
|
5611
|
+
var o, a = Kn((t = ct(t, In)).firestore);
|
|
5593
5612
|
// For Compat types, we have to "extract" the underlying types before
|
|
5594
5613
|
// performing validation.
|
|
5595
|
-
return o = "string" == typeof (e = p(e)) || e instanceof
|
|
5596
|
-
|
|
5614
|
+
return o = "string" == typeof (e = p(e)) || e instanceof Rn ? tr(a, "updateDoc", t._key, e, n, r) : Zn(a, "updateDoc", t._key, e),
|
|
5615
|
+
dn(vn(t.firestore), [ o.toMutation(t._key, xe.exists(!0)) ]);
|
|
5597
5616
|
}
|
|
5598
5617
|
|
|
5599
5618
|
/**
|
|
@@ -5607,8 +5626,8 @@ function Kr(t, e, n) {
|
|
|
5607
5626
|
* @param reference - A reference to the document to delete.
|
|
5608
5627
|
* @returns A `Promise` resolved once the document has been successfully
|
|
5609
5628
|
* deleted from the backend.
|
|
5610
|
-
*/ function
|
|
5611
|
-
return
|
|
5629
|
+
*/ function Wr(t) {
|
|
5630
|
+
return dn(vn((t = ct(t, In)).firestore), [ new Me(t._key, xe.none()) ]);
|
|
5612
5631
|
}
|
|
5613
5632
|
|
|
5614
5633
|
/**
|
|
@@ -5625,9 +5644,9 @@ function Kr(t, e, n) {
|
|
|
5625
5644
|
* @throws Error - If the provided input is not a valid Firestore document.
|
|
5626
5645
|
* @returns A `Promise` resolved with a `DocumentReference` pointing to the
|
|
5627
5646
|
* newly created document after it has been written to the backend.
|
|
5628
|
-
*/ function
|
|
5629
|
-
var n = Vn(t = ct(t,
|
|
5630
|
-
return
|
|
5647
|
+
*/ function Yr(t, e) {
|
|
5648
|
+
var n = Vn(t = ct(t, Pn)), r = Ur(t.converter, e), i = Gn(Kn(t.firestore), "addDoc", n._key, r, null !== n.converter, {});
|
|
5649
|
+
return dn(vn(t.firestore), [ i.toMutation(n._key, xe.exists(!1)) ]).then((function() {
|
|
5631
5650
|
return n;
|
|
5632
5651
|
}));
|
|
5633
5652
|
}
|
|
@@ -5661,9 +5680,9 @@ function Kr(t, e, n) {
|
|
|
5661
5680
|
* @returns A Promise that will be resolved with the count; the count can be
|
|
5662
5681
|
* retrieved from `snapshot.data().count`, where `snapshot` is the
|
|
5663
5682
|
* `AggregateQuerySnapshot` to which the returned Promise resolves.
|
|
5664
|
-
*/ function
|
|
5665
|
-
return
|
|
5666
|
-
count:
|
|
5683
|
+
*/ function Hr(t) {
|
|
5684
|
+
return Jr(t, {
|
|
5685
|
+
count: Zr()
|
|
5667
5686
|
});
|
|
5668
5687
|
}
|
|
5669
5688
|
|
|
@@ -5693,13 +5712,13 @@ function Kr(t, e, n) {
|
|
|
5693
5712
|
* const averageScore: number | null = aggregateSnapshot.data().averageScore;
|
|
5694
5713
|
* ```
|
|
5695
5714
|
* @internal TODO (sum/avg) remove when public
|
|
5696
|
-
*/ function
|
|
5697
|
-
var i = ct(t.firestore,
|
|
5715
|
+
*/ function Jr(t, r) {
|
|
5716
|
+
var i = ct(t.firestore, wn), o = vn(i), a = function(t, e) {
|
|
5698
5717
|
var n = [];
|
|
5699
5718
|
for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && n.push(e(t[r], r));
|
|
5700
5719
|
return n;
|
|
5701
5720
|
}(r, (function(t, e) {
|
|
5702
|
-
return new
|
|
5721
|
+
return new _t(e, t._aggregateType, t._internalFieldPath);
|
|
5703
5722
|
}));
|
|
5704
5723
|
// Run the aggregation and convert the results
|
|
5705
5724
|
return function(t, r, i) {
|
|
@@ -5709,7 +5728,7 @@ function Kr(t, e, n) {
|
|
|
5709
5728
|
switch (n.label) {
|
|
5710
5729
|
case 0:
|
|
5711
5730
|
return o = A(t), a = function(t, e, n) {
|
|
5712
|
-
var r =
|
|
5731
|
+
var r = nn(t, e), i = {}, o = [], a = 0;
|
|
5713
5732
|
return n.forEach((function(t) {
|
|
5714
5733
|
// Map all client-side aliases to a unique short-form
|
|
5715
5734
|
// alias. This avoids issues with client-side aliases that
|
|
@@ -5721,12 +5740,12 @@ function Kr(t, e, n) {
|
|
|
5721
5740
|
}) : "avg" === t.$ ? o.push({
|
|
5722
5741
|
alias: e,
|
|
5723
5742
|
avg: {
|
|
5724
|
-
field:
|
|
5743
|
+
field: un(t.fieldPath)
|
|
5725
5744
|
}
|
|
5726
5745
|
}) : "sum" === t.$ && o.push({
|
|
5727
5746
|
alias: e,
|
|
5728
5747
|
sum: {
|
|
5729
|
-
field:
|
|
5748
|
+
field: un(t.fieldPath)
|
|
5730
5749
|
}
|
|
5731
5750
|
});
|
|
5732
5751
|
})), {
|
|
@@ -5739,7 +5758,7 @@ function Kr(t, e, n) {
|
|
|
5739
5758
|
},
|
|
5740
5759
|
Z: i
|
|
5741
5760
|
};
|
|
5742
|
-
}(o.serializer,
|
|
5761
|
+
}(o.serializer, Ae(r), i), u = a.request, s = a.Z, c = u.parent, o.connection.g || delete u.parent,
|
|
5743
5762
|
[ 4 /*yield*/ , o.R("RunAggregationQuery", c, u, /*expectedResponseCount=*/ 1) ];
|
|
5744
5763
|
|
|
5745
5764
|
case 1:
|
|
@@ -5756,14 +5775,14 @@ function Kr(t, e, n) {
|
|
|
5756
5775
|
}));
|
|
5757
5776
|
}(o, t._query, a).then((function(e) {
|
|
5758
5777
|
return function(t, e, n) {
|
|
5759
|
-
var r = new
|
|
5760
|
-
return new
|
|
5778
|
+
var r = new Br(t);
|
|
5779
|
+
return new kn(e, r, n);
|
|
5761
5780
|
}(i, t, e);
|
|
5762
5781
|
}));
|
|
5763
5782
|
}
|
|
5764
5783
|
|
|
5765
|
-
function
|
|
5766
|
-
return new
|
|
5784
|
+
function Xr(t) {
|
|
5785
|
+
return new Sn("sum", ar("sum", t));
|
|
5767
5786
|
}
|
|
5768
5787
|
|
|
5769
5788
|
/**
|
|
@@ -5771,16 +5790,16 @@ function Jr(t) {
|
|
|
5771
5790
|
* a specified field over a range of documents in the result set of a query.
|
|
5772
5791
|
* @param field Specifies the field to average across the result set.
|
|
5773
5792
|
* @internal TODO (sum/avg) remove when public
|
|
5774
|
-
*/ function
|
|
5775
|
-
return new
|
|
5793
|
+
*/ function $r(t) {
|
|
5794
|
+
return new Sn("avg", ar("average", t));
|
|
5776
5795
|
}
|
|
5777
5796
|
|
|
5778
5797
|
/**
|
|
5779
5798
|
* Create an AggregateField object that can be used to compute the count of
|
|
5780
5799
|
* documents in the result set of a query.
|
|
5781
5800
|
* @internal TODO (sum/avg) remove when public
|
|
5782
|
-
*/ function
|
|
5783
|
-
return new
|
|
5801
|
+
*/ function Zr() {
|
|
5802
|
+
return new Sn("count");
|
|
5784
5803
|
}
|
|
5785
5804
|
|
|
5786
5805
|
/**
|
|
@@ -5789,9 +5808,9 @@ function Jr(t) {
|
|
|
5789
5808
|
* @param left Compare this AggregateField to the `right`.
|
|
5790
5809
|
* @param right Compare this AggregateField to the `left`.
|
|
5791
5810
|
* @internal TODO (sum/avg) remove when public
|
|
5792
|
-
*/ function
|
|
5811
|
+
*/ function ti(t, e) {
|
|
5793
5812
|
var n, r;
|
|
5794
|
-
return t instanceof
|
|
5813
|
+
return t instanceof Sn && e instanceof Sn && t._aggregateType === e._aggregateType && (null === (n = t._internalFieldPath) || void 0 === n ? void 0 : n.canonicalString()) === (null === (r = e._internalFieldPath) || void 0 === r ? void 0 : r.canonicalString());
|
|
5795
5814
|
}
|
|
5796
5815
|
|
|
5797
5816
|
/**
|
|
@@ -5805,8 +5824,8 @@ function Jr(t) {
|
|
|
5805
5824
|
*
|
|
5806
5825
|
* @returns `true` if the objects are "equal", as defined above, or `false`
|
|
5807
5826
|
* otherwise.
|
|
5808
|
-
*/ function
|
|
5809
|
-
return
|
|
5827
|
+
*/ function ei(t, e) {
|
|
5828
|
+
return Nn(t.query, e.query) && m(t.data(), e.data());
|
|
5810
5829
|
}
|
|
5811
5830
|
|
|
5812
5831
|
/**
|
|
@@ -5828,15 +5847,15 @@ function Jr(t) {
|
|
|
5828
5847
|
/**
|
|
5829
5848
|
* Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or
|
|
5830
5849
|
* {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion.
|
|
5831
|
-
*/ function
|
|
5832
|
-
return new
|
|
5850
|
+
*/ function ni() {
|
|
5851
|
+
return new Wn("deleteField");
|
|
5833
5852
|
}
|
|
5834
5853
|
|
|
5835
5854
|
/**
|
|
5836
5855
|
* Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
|
|
5837
5856
|
* include a server-generated timestamp in the written data.
|
|
5838
|
-
*/ function
|
|
5839
|
-
return new
|
|
5857
|
+
*/ function ri() {
|
|
5858
|
+
return new Hn("serverTimestamp");
|
|
5840
5859
|
}
|
|
5841
5860
|
|
|
5842
5861
|
/**
|
|
@@ -5850,11 +5869,11 @@ function Jr(t) {
|
|
|
5850
5869
|
* @param elements - The elements to union into the array.
|
|
5851
5870
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5852
5871
|
* `updateDoc()`.
|
|
5853
|
-
*/ function
|
|
5872
|
+
*/ function ii() {
|
|
5854
5873
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
5855
5874
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
5856
5875
|
// update() since we'd need the Firestore instance to do this.
|
|
5857
|
-
return new
|
|
5876
|
+
return new Jn("arrayUnion", t);
|
|
5858
5877
|
}
|
|
5859
5878
|
|
|
5860
5879
|
/**
|
|
@@ -5867,11 +5886,11 @@ function Jr(t) {
|
|
|
5867
5886
|
* @param elements - The elements to remove from the array.
|
|
5868
5887
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5869
5888
|
* `updateDoc()`
|
|
5870
|
-
*/ function
|
|
5889
|
+
*/ function oi() {
|
|
5871
5890
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
5872
5891
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
5873
5892
|
// update() since we'd need the Firestore instance to do this.
|
|
5874
|
-
return new
|
|
5893
|
+
return new Xn("arrayRemove", t);
|
|
5875
5894
|
}
|
|
5876
5895
|
|
|
5877
5896
|
/**
|
|
@@ -5892,8 +5911,8 @@ function Jr(t) {
|
|
|
5892
5911
|
* @param n - The value to increment by.
|
|
5893
5912
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5894
5913
|
* `updateDoc()`
|
|
5895
|
-
*/ function
|
|
5896
|
-
return new
|
|
5914
|
+
*/ function ai(t) {
|
|
5915
|
+
return new $n("increment", t);
|
|
5897
5916
|
}
|
|
5898
5917
|
|
|
5899
5918
|
/**
|
|
@@ -5919,24 +5938,24 @@ function Jr(t) {
|
|
|
5919
5938
|
* provides methods for adding writes to the write batch. None of the writes
|
|
5920
5939
|
* will be committed (or visible locally) until {@link WriteBatch.commit} is
|
|
5921
5940
|
* called.
|
|
5922
|
-
*/ var
|
|
5941
|
+
*/ var ui = /** @class */ function() {
|
|
5923
5942
|
/** @hideconstructor */
|
|
5924
5943
|
function t(t, e) {
|
|
5925
5944
|
this._firestore = t, this._commitHandler = e, this._mutations = [], this._committed = !1,
|
|
5926
|
-
this._dataReader =
|
|
5945
|
+
this._dataReader = Kn(t);
|
|
5927
5946
|
}
|
|
5928
5947
|
return t.prototype.set = function(t, e, n) {
|
|
5929
5948
|
this._verifyNotCommitted();
|
|
5930
|
-
var r =
|
|
5931
|
-
return this._mutations.push(o.toMutation(r._key,
|
|
5949
|
+
var r = si(t, this._firestore), i = Ur(r.converter, e, n), o = Gn(this._dataReader, "WriteBatch.set", r._key, i, null !== r.converter, n);
|
|
5950
|
+
return this._mutations.push(o.toMutation(r._key, xe.none())), this;
|
|
5932
5951
|
}, t.prototype.update = function(t, e, n) {
|
|
5933
5952
|
for (var r = [], i = 3; i < arguments.length; i++) r[i - 3] = arguments[i];
|
|
5934
5953
|
this._verifyNotCommitted();
|
|
5935
|
-
var o, a =
|
|
5954
|
+
var o, a = si(t, this._firestore);
|
|
5936
5955
|
// For Compat types, we have to "extract" the underlying types before
|
|
5937
5956
|
// performing validation.
|
|
5938
|
-
return o = "string" == typeof (e = p(e)) || e instanceof
|
|
5939
|
-
this._mutations.push(o.toMutation(a._key,
|
|
5957
|
+
return o = "string" == typeof (e = p(e)) || e instanceof Rn ? tr(this._dataReader, "WriteBatch.update", a._key, e, n, r) : Zn(this._dataReader, "WriteBatch.update", a._key, e),
|
|
5958
|
+
this._mutations.push(o.toMutation(a._key, xe.exists(!0))), this;
|
|
5940
5959
|
},
|
|
5941
5960
|
/**
|
|
5942
5961
|
* Deletes the document referred to by the provided {@link DocumentReference}.
|
|
@@ -5946,8 +5965,8 @@ function Jr(t) {
|
|
|
5946
5965
|
*/
|
|
5947
5966
|
t.prototype.delete = function(t) {
|
|
5948
5967
|
this._verifyNotCommitted();
|
|
5949
|
-
var e =
|
|
5950
|
-
return this._mutations = this._mutations.concat(new
|
|
5968
|
+
var e = si(t, this._firestore);
|
|
5969
|
+
return this._mutations = this._mutations.concat(new Me(e._key, xe.none())), this;
|
|
5951
5970
|
},
|
|
5952
5971
|
/**
|
|
5953
5972
|
* Commits all of the writes in this write batch as a single atomic unit.
|
|
@@ -5964,12 +5983,12 @@ function Jr(t) {
|
|
|
5964
5983
|
t.prototype.commit = function() {
|
|
5965
5984
|
return this._verifyNotCommitted(), this._committed = !0, this._mutations.length > 0 ? this._commitHandler(this._mutations) : Promise.resolve();
|
|
5966
5985
|
}, t.prototype._verifyNotCommitted = function() {
|
|
5967
|
-
if (this._committed) throw new B(
|
|
5986
|
+
if (this._committed) throw new B(x, "A write batch can no longer be used after commit() has been called.");
|
|
5968
5987
|
}, t;
|
|
5969
5988
|
}();
|
|
5970
5989
|
|
|
5971
|
-
function
|
|
5972
|
-
if ((t = p(t)).firestore !== e) throw new B(
|
|
5990
|
+
function si(t, e) {
|
|
5991
|
+
if ((t = p(t)).firestore !== e) throw new B(O, "Provided document reference is from a different Firestore instance.");
|
|
5973
5992
|
return t;
|
|
5974
5993
|
}
|
|
5975
5994
|
|
|
@@ -5985,10 +6004,10 @@ function ui(t, e) {
|
|
|
5985
6004
|
*
|
|
5986
6005
|
* @returns A `WriteBatch` that can be used to atomically execute multiple
|
|
5987
6006
|
* writes.
|
|
5988
|
-
*/ function
|
|
5989
|
-
var e =
|
|
5990
|
-
return new
|
|
5991
|
-
return
|
|
6007
|
+
*/ function ci(t) {
|
|
6008
|
+
var e = vn(t = ct(t, wn));
|
|
6009
|
+
return new ui(t, (function(t) {
|
|
6010
|
+
return dn(e, t);
|
|
5992
6011
|
}));
|
|
5993
6012
|
}
|
|
5994
6013
|
|
|
@@ -6011,7 +6030,7 @@ function ui(t, e) {
|
|
|
6011
6030
|
/**
|
|
6012
6031
|
* Internal transaction object responsible for accumulating the mutations to
|
|
6013
6032
|
* perform and the base versions for any documents read.
|
|
6014
|
-
*/ var
|
|
6033
|
+
*/ var li = /** @class */ function() {
|
|
6015
6034
|
function t(t) {
|
|
6016
6035
|
this.datastore = t,
|
|
6017
6036
|
// The version of each document that was read during this transaction.
|
|
@@ -6035,8 +6054,8 @@ function ui(t, e) {
|
|
|
6035
6054
|
return n(this, (function(n) {
|
|
6036
6055
|
switch (n.label) {
|
|
6037
6056
|
case 0:
|
|
6038
|
-
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new B(
|
|
6039
|
-
return [ 4 /*yield*/ ,
|
|
6057
|
+
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new B(O, "Firestore transactions require all reads to be executed before all writes.");
|
|
6058
|
+
return [ 4 /*yield*/ , yn(this.datastore, t) ];
|
|
6040
6059
|
|
|
6041
6060
|
case 1:
|
|
6042
6061
|
return [ 2 /*return*/ , ((e = n.sent()).forEach((function(t) {
|
|
@@ -6055,7 +6074,7 @@ function ui(t, e) {
|
|
|
6055
6074
|
}
|
|
6056
6075
|
this.writtenDocs.add(t.toString());
|
|
6057
6076
|
}, t.prototype.delete = function(t) {
|
|
6058
|
-
this.write(new
|
|
6077
|
+
this.write(new Me(t, this.precondition(t))), this.writtenDocs.add(t.toString());
|
|
6059
6078
|
}, t.prototype.commit = function() {
|
|
6060
6079
|
return e(this, void 0, void 0, (function() {
|
|
6061
6080
|
var t, e = this;
|
|
@@ -6072,8 +6091,8 @@ function ui(t, e) {
|
|
|
6072
6091
|
// a `verify` operation.
|
|
6073
6092
|
t.forEach((function(t, n) {
|
|
6074
6093
|
var r = it.fromPath(n);
|
|
6075
|
-
e.mutations.push(new
|
|
6076
|
-
})), [ 4 /*yield*/ ,
|
|
6094
|
+
e.mutations.push(new Ue(r, e.precondition(r)));
|
|
6095
|
+
})), [ 4 /*yield*/ , dn(this.datastore, this.mutations) ];
|
|
6077
6096
|
|
|
6078
6097
|
case 1:
|
|
6079
6098
|
// For each mutation, note that the doc was written.
|
|
@@ -6086,13 +6105,13 @@ function ui(t, e) {
|
|
|
6086
6105
|
if (t.isFoundDocument()) e = t.version; else {
|
|
6087
6106
|
if (!t.isNoDocument()) throw k();
|
|
6088
6107
|
// Represent a deleted doc using SnapshotVersion.min().
|
|
6089
|
-
e =
|
|
6108
|
+
e = fe.min();
|
|
6090
6109
|
}
|
|
6091
6110
|
var n = this.readVersions.get(t.key.toString());
|
|
6092
6111
|
if (n) {
|
|
6093
6112
|
if (!e.isEqual(n))
|
|
6094
6113
|
// This transaction will fail no matter what.
|
|
6095
|
-
throw new B(
|
|
6114
|
+
throw new B(C, "Document version changed between two reads.");
|
|
6096
6115
|
} else this.readVersions.set(t.key.toString(), e);
|
|
6097
6116
|
},
|
|
6098
6117
|
/**
|
|
@@ -6101,7 +6120,7 @@ function ui(t, e) {
|
|
|
6101
6120
|
*/
|
|
6102
6121
|
t.prototype.precondition = function(t) {
|
|
6103
6122
|
var e = this.readVersions.get(t.toString());
|
|
6104
|
-
return !this.writtenDocs.has(t.toString()) && e ? e.isEqual(
|
|
6123
|
+
return !this.writtenDocs.has(t.toString()) && e ? e.isEqual(fe.min()) ? xe.exists(!1) : xe.updateTime(e) : xe.none();
|
|
6105
6124
|
},
|
|
6106
6125
|
/**
|
|
6107
6126
|
* Returns the precondition for a document if the operation is an update.
|
|
@@ -6111,7 +6130,7 @@ function ui(t, e) {
|
|
|
6111
6130
|
// The first time a document is written, we want to take into account the
|
|
6112
6131
|
// read time and existence
|
|
6113
6132
|
if (!this.writtenDocs.has(t.toString()) && e) {
|
|
6114
|
-
if (e.isEqual(
|
|
6133
|
+
if (e.isEqual(fe.min()))
|
|
6115
6134
|
// The document doesn't exist, so fail the transaction.
|
|
6116
6135
|
// This has to be validated locally because you can't send a
|
|
6117
6136
|
// precondition that a document does not exist without changing the
|
|
@@ -6121,22 +6140,22 @@ function ui(t, e) {
|
|
|
6121
6140
|
// express that to the backend, we have to validate locally.
|
|
6122
6141
|
// Note: this can change once we can send separate verify writes in the
|
|
6123
6142
|
// transaction.
|
|
6124
|
-
throw new B(
|
|
6143
|
+
throw new B(O, "Can't update a document that doesn't exist.");
|
|
6125
6144
|
// Document exists, base precondition on document update time.
|
|
6126
|
-
return
|
|
6145
|
+
return xe.updateTime(e);
|
|
6127
6146
|
}
|
|
6128
6147
|
// Document was not read, so we just use the preconditions for a blind
|
|
6129
6148
|
// update.
|
|
6130
|
-
return
|
|
6149
|
+
return xe.exists(!0);
|
|
6131
6150
|
}, t.prototype.write = function(t) {
|
|
6132
6151
|
this.ensureCommitNotCalled(), this.mutations.push(t);
|
|
6133
6152
|
}, t.prototype.ensureCommitNotCalled = function() {}, t;
|
|
6134
|
-
}(),
|
|
6153
|
+
}(), fi = {
|
|
6135
6154
|
maxAttempts: 5
|
|
6136
|
-
},
|
|
6155
|
+
}, hi = /** @class */ function() {
|
|
6137
6156
|
function t(t, e, n, r, i) {
|
|
6138
6157
|
this.asyncQueue = t, this.datastore = e, this.options = n, this.updateFunction = r,
|
|
6139
|
-
this.deferred = i, this.wt = n.maxAttempts, this.yt = new
|
|
6158
|
+
this.deferred = i, this.wt = n.maxAttempts, this.yt = new hn(this.asyncQueue, "transaction_retry" /* TimerId.TransactionRetry */)
|
|
6140
6159
|
/** Runs the transaction and sets the result on deferred. */;
|
|
6141
6160
|
}
|
|
6142
6161
|
return t.prototype.run = function() {
|
|
@@ -6147,7 +6166,7 @@ function ui(t, e) {
|
|
|
6147
6166
|
return e(t, void 0, void 0, (function() {
|
|
6148
6167
|
var t, e, r = this;
|
|
6149
6168
|
return n(this, (function(n) {
|
|
6150
|
-
return t = new
|
|
6169
|
+
return t = new li(this.datastore), (e = this._t(t)) && e.then((function(e) {
|
|
6151
6170
|
r.asyncQueue.enqueueAndForget((function() {
|
|
6152
6171
|
return t.commit().then((function() {
|
|
6153
6172
|
r.deferred.resolve(e);
|
|
@@ -6164,7 +6183,7 @@ function ui(t, e) {
|
|
|
6164
6183
|
}, t.prototype._t = function(t) {
|
|
6165
6184
|
try {
|
|
6166
6185
|
var e = this.updateFunction(t);
|
|
6167
|
-
return !
|
|
6186
|
+
return !pt(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
|
|
6168
6187
|
null);
|
|
6169
6188
|
} catch (t) {
|
|
6170
6189
|
// Do not retry errors thrown by user provided updateFunction.
|
|
@@ -6192,9 +6211,9 @@ function ui(t, e) {
|
|
|
6192
6211
|
default:
|
|
6193
6212
|
return k();
|
|
6194
6213
|
|
|
6195
|
-
case F:
|
|
6196
6214
|
case P:
|
|
6197
|
-
case
|
|
6215
|
+
case F:
|
|
6216
|
+
case V:
|
|
6198
6217
|
case R:
|
|
6199
6218
|
case M:
|
|
6200
6219
|
case U:
|
|
@@ -6203,15 +6222,15 @@ function ui(t, e) {
|
|
|
6203
6222
|
case q:
|
|
6204
6223
|
return !1;
|
|
6205
6224
|
|
|
6206
|
-
case V:
|
|
6207
6225
|
case O:
|
|
6226
|
+
case D:
|
|
6208
6227
|
case "already-exists":
|
|
6209
6228
|
case N:
|
|
6210
|
-
case
|
|
6229
|
+
case x:
|
|
6211
6230
|
// Aborted might be retried in some scenarios, but that is dependant on
|
|
6212
6231
|
// the context and should handled individually by the calling code.
|
|
6213
6232
|
// See https://cloud.google.com/apis/design/errors.
|
|
6214
|
-
case
|
|
6233
|
+
case C:
|
|
6215
6234
|
case j:
|
|
6216
6235
|
case L:
|
|
6217
6236
|
case "data-loss":
|
|
@@ -6255,7 +6274,7 @@ function ui(t, e) {
|
|
|
6255
6274
|
* See the License for the specific language governing permissions and
|
|
6256
6275
|
* limitations under the License.
|
|
6257
6276
|
*/
|
|
6258
|
-
/** The Platform's 'document' implementation or null if not available. */ function
|
|
6277
|
+
/** The Platform's 'document' implementation or null if not available. */ function pi() {
|
|
6259
6278
|
// `document` is not always available, e.g. in ReactNative and WebWorkers.
|
|
6260
6279
|
// eslint-disable-next-line no-restricted-globals
|
|
6261
6280
|
return "undefined" != typeof document ? document : null;
|
|
@@ -6287,7 +6306,7 @@ function ui(t, e) {
|
|
|
6287
6306
|
* Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type
|
|
6288
6307
|
* in newer versions of TypeScript defines `finally`, which is not available in
|
|
6289
6308
|
* IE.
|
|
6290
|
-
*/ var
|
|
6309
|
+
*/ var di, yi = /** @class */ function() {
|
|
6291
6310
|
function t(t, e, n, r, i) {
|
|
6292
6311
|
this.asyncQueue = t, this.timerId = e, this.targetTimeMs = n, this.op = r, this.removalCallback = i,
|
|
6293
6312
|
this.deferred = new z, this.then = this.deferred.promise.then.bind(this.deferred.promise),
|
|
@@ -6339,7 +6358,7 @@ function ui(t, e) {
|
|
|
6339
6358
|
* guarantee that the operation will not be run.
|
|
6340
6359
|
*/
|
|
6341
6360
|
t.prototype.cancel = function(t) {
|
|
6342
|
-
null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new B(
|
|
6361
|
+
null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new B(P, "Operation cancelled" + (t ? ": " + t : ""))));
|
|
6343
6362
|
}, t.prototype.handleDelayElapsed = function() {
|
|
6344
6363
|
var t = this;
|
|
6345
6364
|
this.asyncQueue.enqueueAndForget((function() {
|
|
@@ -6351,7 +6370,7 @@ function ui(t, e) {
|
|
|
6351
6370
|
null !== this.timerHandle && (this.removalCallback(this), clearTimeout(this.timerHandle),
|
|
6352
6371
|
this.timerHandle = null);
|
|
6353
6372
|
}, t;
|
|
6354
|
-
}(),
|
|
6373
|
+
}(), mi = /** @class */ function() {
|
|
6355
6374
|
function t() {
|
|
6356
6375
|
var t = this;
|
|
6357
6376
|
// The last promise in the queue.
|
|
@@ -6375,16 +6394,16 @@ function ui(t, e) {
|
|
|
6375
6394
|
// List of TimerIds to fast-forward delays for.
|
|
6376
6395
|
this.$t = [],
|
|
6377
6396
|
// Backoff timer used to schedule retries for retryable operations
|
|
6378
|
-
this.yt = new
|
|
6397
|
+
this.yt = new hn(this, "async_queue_retry" /* TimerId.AsyncQueueRetry */),
|
|
6379
6398
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
6380
6399
|
// operations. Meant to speed up recovery when we regain file system access
|
|
6381
6400
|
// after page comes into foreground.
|
|
6382
|
-
this.
|
|
6383
|
-
var e =
|
|
6401
|
+
this.Nt = function() {
|
|
6402
|
+
var e = pi();
|
|
6384
6403
|
e && b("AsyncQueue", "Visibility state changed to " + e.visibilityState), t.yt.H();
|
|
6385
6404
|
};
|
|
6386
|
-
var e =
|
|
6387
|
-
e && "function" == typeof e.addEventListener && e.addEventListener("visibilitychange", this.
|
|
6405
|
+
var e = pi();
|
|
6406
|
+
e && "function" == typeof e.addEventListener && e.addEventListener("visibilitychange", this.Nt);
|
|
6388
6407
|
}
|
|
6389
6408
|
return Object.defineProperty(t.prototype, "isShuttingDown", {
|
|
6390
6409
|
get: function() {
|
|
@@ -6401,18 +6420,18 @@ function ui(t, e) {
|
|
|
6401
6420
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
6402
6421
|
this.enqueue(t);
|
|
6403
6422
|
}, t.prototype.enqueueAndForgetEvenWhileRestricted = function(t) {
|
|
6404
|
-
this.
|
|
6423
|
+
this.Dt(),
|
|
6405
6424
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
6406
6425
|
this.Ft(t);
|
|
6407
6426
|
}, t.prototype.enterRestrictedMode = function(t) {
|
|
6408
6427
|
if (!this.Tt) {
|
|
6409
6428
|
this.Tt = !0, this.Vt = t || !1;
|
|
6410
|
-
var e =
|
|
6411
|
-
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.
|
|
6429
|
+
var e = pi();
|
|
6430
|
+
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Nt);
|
|
6412
6431
|
}
|
|
6413
6432
|
}, t.prototype.enqueue = function(t) {
|
|
6414
6433
|
var e = this;
|
|
6415
|
-
if (this.
|
|
6434
|
+
if (this.Dt(), this.Tt)
|
|
6416
6435
|
// Return a Promise which never resolves.
|
|
6417
6436
|
return new Promise((function() {}));
|
|
6418
6437
|
// Create a deferred Promise that we can return to the callee. This
|
|
@@ -6502,14 +6521,14 @@ function ui(t, e) {
|
|
|
6502
6521
|
return this.Et = n, n;
|
|
6503
6522
|
}, t.prototype.enqueueAfterDelay = function(t, e, n) {
|
|
6504
6523
|
var r = this;
|
|
6505
|
-
this.
|
|
6524
|
+
this.Dt(),
|
|
6506
6525
|
// Fast-forward delays for timerIds that have been overriden.
|
|
6507
6526
|
this.$t.indexOf(t) > -1 && (e = 0);
|
|
6508
|
-
var i =
|
|
6527
|
+
var i = yi.createAndSchedule(this, t, e, n, (function(t) {
|
|
6509
6528
|
return r.St(t);
|
|
6510
6529
|
}));
|
|
6511
6530
|
return this.At.push(i), i;
|
|
6512
|
-
}, t.prototype.
|
|
6531
|
+
}, t.prototype.Dt = function() {
|
|
6513
6532
|
this.Rt && k();
|
|
6514
6533
|
}, t.prototype.verifyOperationInProgress = function() {},
|
|
6515
6534
|
/**
|
|
@@ -6580,10 +6599,10 @@ function ui(t, e) {
|
|
|
6580
6599
|
var e = this.At.indexOf(t);
|
|
6581
6600
|
this.At.splice(e, 1);
|
|
6582
6601
|
}, t;
|
|
6583
|
-
}(),
|
|
6602
|
+
}(), vi = /** @class */ function() {
|
|
6584
6603
|
/** @hideconstructor */
|
|
6585
6604
|
function t(t, e) {
|
|
6586
|
-
this._firestore = t, this._transaction = e, this._dataReader =
|
|
6605
|
+
this._firestore = t, this._transaction = e, this._dataReader = Kn(t)
|
|
6587
6606
|
/**
|
|
6588
6607
|
* Reads the document referenced by the provided {@link DocumentReference}.
|
|
6589
6608
|
*
|
|
@@ -6592,23 +6611,23 @@ function ui(t, e) {
|
|
|
6592
6611
|
*/;
|
|
6593
6612
|
}
|
|
6594
6613
|
return t.prototype.get = function(t) {
|
|
6595
|
-
var e = this, n =
|
|
6614
|
+
var e = this, n = si(t, this._firestore), r = new Br(this._firestore);
|
|
6596
6615
|
return this._transaction.lookup([ n._key ]).then((function(t) {
|
|
6597
6616
|
if (!t || 1 !== t.length) return k();
|
|
6598
6617
|
var i = t[0];
|
|
6599
|
-
if (i.isFoundDocument()) return new
|
|
6600
|
-
if (i.isNoDocument()) return new
|
|
6618
|
+
if (i.isFoundDocument()) return new fr(e._firestore, r, i.key, i, n.converter);
|
|
6619
|
+
if (i.isNoDocument()) return new fr(e._firestore, r, n._key, null, n.converter);
|
|
6601
6620
|
throw k();
|
|
6602
6621
|
}));
|
|
6603
6622
|
}, t.prototype.set = function(t, e, n) {
|
|
6604
|
-
var r =
|
|
6623
|
+
var r = si(t, this._firestore), i = Ur(r.converter, e, n), o = Gn(this._dataReader, "Transaction.set", r._key, i, null !== r.converter, n);
|
|
6605
6624
|
return this._transaction.set(r._key, o), this;
|
|
6606
6625
|
}, t.prototype.update = function(t, e, n) {
|
|
6607
6626
|
for (var r = [], i = 3; i < arguments.length; i++) r[i - 3] = arguments[i];
|
|
6608
|
-
var o, a =
|
|
6627
|
+
var o, a = si(t, this._firestore);
|
|
6609
6628
|
// For Compat types, we have to "extract" the underlying types before
|
|
6610
6629
|
// performing validation.
|
|
6611
|
-
return o = "string" == typeof (e = p(e)) || e instanceof
|
|
6630
|
+
return o = "string" == typeof (e = p(e)) || e instanceof Rn ? tr(this._dataReader, "Transaction.update", a._key, e, n, r) : Zn(this._dataReader, "Transaction.update", a._key, e),
|
|
6612
6631
|
this._transaction.update(a._key, o), this;
|
|
6613
6632
|
},
|
|
6614
6633
|
/**
|
|
@@ -6618,7 +6637,7 @@ function ui(t, e) {
|
|
|
6618
6637
|
* @returns This `Transaction` instance. Used for chaining method calls.
|
|
6619
6638
|
*/
|
|
6620
6639
|
t.prototype.delete = function(t) {
|
|
6621
|
-
var e =
|
|
6640
|
+
var e = si(t, this._firestore);
|
|
6622
6641
|
return this._transaction.delete(e._key), this;
|
|
6623
6642
|
}, t;
|
|
6624
6643
|
}();
|
|
@@ -6658,14 +6677,14 @@ function ui(t, e) {
|
|
|
6658
6677
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
6659
6678
|
* rejected promise with the corresponding failure error is returned.
|
|
6660
6679
|
*/
|
|
6661
|
-
function
|
|
6662
|
-
var r =
|
|
6680
|
+
function gi(t, e, n) {
|
|
6681
|
+
var r = vn(t = ct(t, wn)), i = Object.assign(Object.assign({}, fi), n);
|
|
6663
6682
|
!function(t) {
|
|
6664
|
-
if (t.maxAttempts < 1) throw new B(
|
|
6683
|
+
if (t.maxAttempts < 1) throw new B(O, "Max attempts must be at least 1");
|
|
6665
6684
|
}(i);
|
|
6666
6685
|
var o = new z;
|
|
6667
|
-
return new
|
|
6668
|
-
return e(new
|
|
6686
|
+
return new hi(new mi, r, i, (function(n) {
|
|
6687
|
+
return e(new vi(t, n));
|
|
6669
6688
|
}), o).run(), o.promise
|
|
6670
6689
|
/**
|
|
6671
6690
|
* Firestore Lite
|
|
@@ -6677,15 +6696,15 @@ function vi(t, e, n) {
|
|
|
6677
6696
|
*/;
|
|
6678
6697
|
}
|
|
6679
6698
|
|
|
6680
|
-
|
|
6681
|
-
var n = e.instanceIdentifier, r = e.options, i = t.getProvider("app").getImmediate(), o = new
|
|
6682
|
-
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new B(
|
|
6699
|
+
di = "".concat(i, "_lite"), g = di, o(new c("firestore/lite", (function(t, e) {
|
|
6700
|
+
var n = e.instanceIdentifier, r = e.options, i = t.getProvider("app").getImmediate(), o = new wn(new W(t.getProvider("auth-internal")), new X(t.getProvider("app-check-internal")), function(t, e) {
|
|
6701
|
+
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new B(O, '"projectId" not provided in firebase.initializeApp.');
|
|
6683
6702
|
return new Z(t.options.projectId, e);
|
|
6684
6703
|
}(i, n), i);
|
|
6685
6704
|
return r && o._setSettings(r), o;
|
|
6686
6705
|
}), "PUBLIC").setMultipleInstances(!0)),
|
|
6687
6706
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
6688
|
-
a("firestore-lite", "3.
|
|
6707
|
+
a("firestore-lite", "3.12.0-20230511201449", ""), a("firestore-lite", "3.12.0-20230511201449", "esm5");
|
|
6689
6708
|
|
|
6690
|
-
export {
|
|
6709
|
+
export { Sn as AggregateField, kn as AggregateQuerySnapshot, qn as Bytes, Pn as CollectionReference, In as DocumentReference, fr as DocumentSnapshot, Rn as FieldPath, Cn as FieldValue, wn as Firestore, B as FirestoreError, jn as GeoPoint, An as Query, br as QueryCompositeFilterConstraint, vr as QueryConstraint, hr as QueryDocumentSnapshot, Dr as QueryEndAtConstraint, wr as QueryFieldFilterConstraint, Ir as QueryLimitConstraint, Sr as QueryOrderByConstraint, pr as QuerySnapshot, Fr as QueryStartAtConstraint, Nt as Timestamp, vi as Transaction, ui as WriteBatch, Yr as addDoc, ti as aggregateFieldEqual, ei as aggregateQuerySnapshotEqual, Er as and, oi as arrayRemove, ii as arrayUnion, $r as average, Fn as collection, On as collectionGroup, Tn as connectFirestoreEmulator, Zr as count, Wr as deleteDoc, ni as deleteField, Vn as doc, xn as documentId, qr as endAt, Nr as endBefore, Jr as getAggregate, Hr as getCount, zr as getDoc, Qr as getDocs, bn as getFirestore, ai as increment, _n as initializeFirestore, Ar as limit, Pr as limitToLast, Tr as or, kr as orderBy, gr as query, Nn as queryEqual, Dn as refEqual, gi as runTransaction, ri as serverTimestamp, Kr as setDoc, _ as setLogLevel, dr as snapshotEqual, Vr as startAfter, Or as startAt, Xr as sum, En as terminate, Gr as updateDoc, _r as where, ci as writeBatch };
|
|
6691
6710
|
//# sourceMappingURL=index.browser.esm5.js.map
|