@firebase/firestore 4.7.5 → 4.7.6-canary.144bc3709
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/dist/firestore/src/global_index.d.ts +8 -0
- package/dist/firestore/src/model/path.d.ts +8 -0
- package/dist/index.cjs.js +219 -197
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm2017.js +219 -197
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.node.cjs.js +48 -13
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +48 -13
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +317 -295
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +8 -0
- package/dist/lite/firestore/src/model/path.d.ts +8 -0
- package/dist/lite/index.browser.esm2017.js +193 -176
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.cjs.js +193 -176
- package/dist/lite/index.cjs.js.map +1 -1
- package/dist/lite/index.node.cjs.js +41 -12
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +41 -12
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +181 -163
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +8 -0
- package/dist/lite/private.d.ts +8 -0
- package/dist/packages/firestore/src/model/path.d.ts +8 -0
- package/dist/private.d.ts +8 -0
- package/package.json +9 -9
|
@@ -6,6 +6,8 @@ import { Logger as o, LogLevel as a } from "@firebase/logger";
|
|
|
6
6
|
|
|
7
7
|
import { FirebaseError as u, base64 as _, DecodeBase64StringError as c, getDefaultEmulatorHostnameAndPort as l, createMockUserToken as h, getModularInstance as d, deepEqual as f } from "@firebase/util";
|
|
8
8
|
|
|
9
|
+
import { Integer as E } from "@firebase/webchannel-wrapper/bloom-blob";
|
|
10
|
+
|
|
9
11
|
/**
|
|
10
12
|
* @license
|
|
11
13
|
* Copyright 2017 Google LLC
|
|
@@ -66,7 +68,7 @@ User.MOCK_USER = new User("mock-user");
|
|
|
66
68
|
* See the License for the specific language governing permissions and
|
|
67
69
|
* limitations under the License.
|
|
68
70
|
*/
|
|
69
|
-
let
|
|
71
|
+
let m = "11.2.0-canary.144bc3709";
|
|
70
72
|
|
|
71
73
|
/**
|
|
72
74
|
* @license
|
|
@@ -84,7 +86,7 @@ let E = "11.0.2";
|
|
|
84
86
|
* See the License for the specific language governing permissions and
|
|
85
87
|
* limitations under the License.
|
|
86
88
|
*/
|
|
87
|
-
const
|
|
89
|
+
const A = new o("@firebase/firestore");
|
|
88
90
|
|
|
89
91
|
/**
|
|
90
92
|
* Sets the verbosity of Cloud Firestore logs (debug, error, or silent).
|
|
@@ -99,29 +101,29 @@ const m = new o("@firebase/firestore");
|
|
|
99
101
|
* <li><code>`silent` to turn off logging.</li>
|
|
100
102
|
* </ul>
|
|
101
103
|
*/ function setLogLevel(t) {
|
|
102
|
-
|
|
104
|
+
A.setLogLevel(t);
|
|
103
105
|
}
|
|
104
106
|
|
|
105
107
|
function __PRIVATE_logDebug(t, ...e) {
|
|
106
|
-
if (
|
|
108
|
+
if (A.logLevel <= a.DEBUG) {
|
|
107
109
|
const r = e.map(__PRIVATE_argToString);
|
|
108
|
-
|
|
110
|
+
A.debug(`Firestore (${m}): ${t}`, ...r);
|
|
109
111
|
}
|
|
110
112
|
}
|
|
111
113
|
|
|
112
114
|
function __PRIVATE_logError(t, ...e) {
|
|
113
|
-
if (
|
|
115
|
+
if (A.logLevel <= a.ERROR) {
|
|
114
116
|
const r = e.map(__PRIVATE_argToString);
|
|
115
|
-
|
|
117
|
+
A.error(`Firestore (${m}): ${t}`, ...r);
|
|
116
118
|
}
|
|
117
119
|
}
|
|
118
120
|
|
|
119
121
|
/**
|
|
120
122
|
* @internal
|
|
121
123
|
*/ function __PRIVATE_logWarn(t, ...e) {
|
|
122
|
-
if (
|
|
124
|
+
if (A.logLevel <= a.WARN) {
|
|
123
125
|
const r = e.map(__PRIVATE_argToString);
|
|
124
|
-
|
|
126
|
+
A.warn(`Firestore (${m}): ${t}`, ...r);
|
|
125
127
|
}
|
|
126
128
|
}
|
|
127
129
|
|
|
@@ -182,7 +184,7 @@ function __PRIVATE_logError(t, ...e) {
|
|
|
182
184
|
*/ function fail(t = "Unexpected state") {
|
|
183
185
|
// Log the failure in addition to throw an exception, just in case the
|
|
184
186
|
// exception is swallowed.
|
|
185
|
-
const e = `FIRESTORE (${
|
|
187
|
+
const e = `FIRESTORE (${m}) INTERNAL ASSERTION FAILED: ` + t;
|
|
186
188
|
// NOTE: We don't use FirestoreError here because these are internal failures
|
|
187
189
|
// that cannot be handled by the user. (Also it would create a circular
|
|
188
190
|
// dependency between the error and assert modules which doesn't work.)
|
|
@@ -222,7 +224,7 @@ e) {
|
|
|
222
224
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
223
225
|
* See the License for the specific language governing permissions and
|
|
224
226
|
* limitations under the License.
|
|
225
|
-
*/ const
|
|
227
|
+
*/ const T = "ok", P = "cancelled", R = "unknown", V = "invalid-argument", I = "deadline-exceeded", p = "not-found", y = "already-exists", w = "permission-denied", g = "unauthenticated", F = "resource-exhausted", v = "failed-precondition", D = "aborted", b = "out-of-range", C = "unimplemented", S = "internal", N = "unavailable", O = "data-loss";
|
|
226
228
|
|
|
227
229
|
/** An error returned by a Firestore operation. */ class FirestoreError extends u {
|
|
228
230
|
/** @hideconstructor */
|
|
@@ -533,14 +535,30 @@ class BasePath {
|
|
|
533
535
|
toArray() {
|
|
534
536
|
return this.segments.slice(this.offset, this.limit());
|
|
535
537
|
}
|
|
536
|
-
|
|
538
|
+
/**
|
|
539
|
+
* Compare 2 paths segment by segment, prioritizing numeric IDs
|
|
540
|
+
* (e.g., "__id123__") in numeric ascending order, followed by string
|
|
541
|
+
* segments in lexicographical order.
|
|
542
|
+
*/ static comparator(t, e) {
|
|
537
543
|
const r = Math.min(t.length, e.length);
|
|
538
544
|
for (let n = 0; n < r; n++) {
|
|
539
|
-
const r = t.get(n),
|
|
540
|
-
if (
|
|
541
|
-
if (r > i) return 1;
|
|
545
|
+
const r = BasePath.compareSegments(t.get(n), e.get(n));
|
|
546
|
+
if (0 !== r) return r;
|
|
542
547
|
}
|
|
543
|
-
return t.length
|
|
548
|
+
return Math.sign(t.length - e.length);
|
|
549
|
+
}
|
|
550
|
+
static compareSegments(t, e) {
|
|
551
|
+
const r = BasePath.isNumericId(t), n = BasePath.isNumericId(e);
|
|
552
|
+
return r && !n ? -1 : !r && n ? 1 : r && n ? BasePath.extractNumericId(t).compare(BasePath.extractNumericId(e)) :
|
|
553
|
+
// both non-numeric
|
|
554
|
+
t < e ? -1 : t > e ? 1 : 0;
|
|
555
|
+
}
|
|
556
|
+
// Checks if a segment is a numeric ID (starts with "__id" and ends with "__").
|
|
557
|
+
static isNumericId(t) {
|
|
558
|
+
return t.startsWith("__id") && t.endsWith("__");
|
|
559
|
+
}
|
|
560
|
+
static extractNumericId(t) {
|
|
561
|
+
return E.fromString(t.substring(4, t.length - 2));
|
|
544
562
|
}
|
|
545
563
|
}
|
|
546
564
|
|
|
@@ -579,7 +597,7 @@ class BasePath {
|
|
|
579
597
|
// for legacy reasons and should not be used frequently).
|
|
580
598
|
const e = [];
|
|
581
599
|
for (const r of t) {
|
|
582
|
-
if (r.indexOf("//") >= 0) throw new FirestoreError(
|
|
600
|
+
if (r.indexOf("//") >= 0) throw new FirestoreError(V, `Invalid segment (${r}). Paths must not contain // in them.`);
|
|
583
601
|
// Strip leading and trailing slashed.
|
|
584
602
|
e.push(...r.split("/").filter((t => t.length > 0)));
|
|
585
603
|
}
|
|
@@ -590,7 +608,7 @@ class BasePath {
|
|
|
590
608
|
}
|
|
591
609
|
}
|
|
592
610
|
|
|
593
|
-
const
|
|
611
|
+
const q = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
594
612
|
|
|
595
613
|
/**
|
|
596
614
|
* A dot-separated path for navigating sub-objects within a document.
|
|
@@ -603,7 +621,7 @@ const O = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
|
603
621
|
* Returns true if the string could be used as a segment in a field path
|
|
604
622
|
* without escaping.
|
|
605
623
|
*/ static isValidIdentifier(t) {
|
|
606
|
-
return
|
|
624
|
+
return q.test(t);
|
|
607
625
|
}
|
|
608
626
|
canonicalString() {
|
|
609
627
|
return this.toArray().map((t => (t = t.replace(/\\/g, "\\\\").replace(/`/g, "\\`"),
|
|
@@ -635,21 +653,21 @@ const O = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
|
635
653
|
const e = [];
|
|
636
654
|
let r = "", n = 0;
|
|
637
655
|
const __PRIVATE_addCurrentSegment = () => {
|
|
638
|
-
if (0 === r.length) throw new FirestoreError(
|
|
656
|
+
if (0 === r.length) throw new FirestoreError(V, `Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);
|
|
639
657
|
e.push(r), r = "";
|
|
640
658
|
};
|
|
641
659
|
let i = !1;
|
|
642
660
|
for (;n < t.length; ) {
|
|
643
661
|
const e = t[n];
|
|
644
662
|
if ("\\" === e) {
|
|
645
|
-
if (n + 1 === t.length) throw new FirestoreError(
|
|
663
|
+
if (n + 1 === t.length) throw new FirestoreError(V, "Path has trailing escape character: " + t);
|
|
646
664
|
const e = t[n + 1];
|
|
647
|
-
if ("\\" !== e && "." !== e && "`" !== e) throw new FirestoreError(
|
|
665
|
+
if ("\\" !== e && "." !== e && "`" !== e) throw new FirestoreError(V, "Path has invalid escape sequence: " + t);
|
|
648
666
|
r += e, n += 2;
|
|
649
667
|
} else "`" === e ? (i = !i, n++) : "." !== e || i ? (r += e, n++) : (__PRIVATE_addCurrentSegment(),
|
|
650
668
|
n++);
|
|
651
669
|
}
|
|
652
|
-
if (__PRIVATE_addCurrentSegment(), i) throw new FirestoreError(
|
|
670
|
+
if (__PRIVATE_addCurrentSegment(), i) throw new FirestoreError(V, "Unterminated ` in path: " + t);
|
|
653
671
|
return new FieldPath$1(e);
|
|
654
672
|
}
|
|
655
673
|
static emptyPath() {
|
|
@@ -738,7 +756,7 @@ const O = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
|
738
756
|
* See the License for the specific language governing permissions and
|
|
739
757
|
* limitations under the License.
|
|
740
758
|
*/ function __PRIVATE_validateNonEmptyArgument(t, e, r) {
|
|
741
|
-
if (!r) throw new FirestoreError(
|
|
759
|
+
if (!r) throw new FirestoreError(V, `Function ${t}() cannot be called with an empty ${e}.`);
|
|
742
760
|
}
|
|
743
761
|
|
|
744
762
|
/**
|
|
@@ -750,14 +768,14 @@ const O = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
|
750
768
|
* an even numbers of segments).
|
|
751
769
|
*/
|
|
752
770
|
function __PRIVATE_validateDocumentPath(t) {
|
|
753
|
-
if (!DocumentKey.isDocumentKey(t)) throw new FirestoreError(
|
|
771
|
+
if (!DocumentKey.isDocumentKey(t)) throw new FirestoreError(V, `Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`);
|
|
754
772
|
}
|
|
755
773
|
|
|
756
774
|
/**
|
|
757
775
|
* Validates that `path` refers to a collection (indicated by the fact it
|
|
758
776
|
* contains an odd numbers of segments).
|
|
759
777
|
*/ function __PRIVATE_validateCollectionPath(t) {
|
|
760
|
-
if (DocumentKey.isDocumentKey(t)) throw new FirestoreError(
|
|
778
|
+
if (DocumentKey.isDocumentKey(t)) throw new FirestoreError(V, `Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`);
|
|
761
779
|
}
|
|
762
780
|
|
|
763
781
|
/**
|
|
@@ -801,17 +819,17 @@ e) {
|
|
|
801
819
|
// Unwrap Compat types
|
|
802
820
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
803
821
|
t = t._delegate), !(t instanceof e)) {
|
|
804
|
-
if (e.name === t.constructor.name) throw new FirestoreError(
|
|
822
|
+
if (e.name === t.constructor.name) throw new FirestoreError(V, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
|
|
805
823
|
{
|
|
806
824
|
const r = __PRIVATE_valueDescription(t);
|
|
807
|
-
throw new FirestoreError(
|
|
825
|
+
throw new FirestoreError(V, `Expected type '${e.name}', but it was: ${r}`);
|
|
808
826
|
}
|
|
809
827
|
}
|
|
810
828
|
return t;
|
|
811
829
|
}
|
|
812
830
|
|
|
813
831
|
function __PRIVATE_validatePositiveNumber(t, e) {
|
|
814
|
-
if (e <= 0) throw new FirestoreError(
|
|
832
|
+
if (e <= 0) throw new FirestoreError(V, `Function ${t}() requires a positive number, but it was: ${e}.`);
|
|
815
833
|
}
|
|
816
834
|
|
|
817
835
|
/**
|
|
@@ -861,7 +879,7 @@ function __PRIVATE_cloneLongPollingOptions(t) {
|
|
|
861
879
|
/**
|
|
862
880
|
* The value returned from the most recent invocation of
|
|
863
881
|
* `generateUniqueDebugId()`, or null if it has never been invoked.
|
|
864
|
-
*/ let
|
|
882
|
+
*/ let B = null;
|
|
865
883
|
|
|
866
884
|
/**
|
|
867
885
|
* Generates and returns an initial value for `lastUniqueDebugId`.
|
|
@@ -886,9 +904,9 @@ function __PRIVATE_cloneLongPollingOptions(t) {
|
|
|
886
904
|
* @return the 10-character generated ID (e.g. "0xa1b2c3d4").
|
|
887
905
|
*/
|
|
888
906
|
function __PRIVATE_generateUniqueDebugId() {
|
|
889
|
-
return null ===
|
|
907
|
+
return null === B ? B = function __PRIVATE_generateInitialUniqueDebugId() {
|
|
890
908
|
return 268435456 + Math.round(2147483648 * Math.random());
|
|
891
|
-
}() :
|
|
909
|
+
}() : B++, "0x" + B.toString(16);
|
|
892
910
|
}
|
|
893
911
|
|
|
894
912
|
/**
|
|
@@ -939,7 +957,7 @@ function __PRIVATE_generateUniqueDebugId() {
|
|
|
939
957
|
* See the License for the specific language governing permissions and
|
|
940
958
|
* limitations under the License.
|
|
941
959
|
*/
|
|
942
|
-
const
|
|
960
|
+
const $ = {
|
|
943
961
|
BatchGetDocuments: "batchGet",
|
|
944
962
|
Commit: "commit",
|
|
945
963
|
RunQuery: "runQuery",
|
|
@@ -977,7 +995,7 @@ const B = {
|
|
|
977
995
|
* are used for reverse lookups from the webchannel stream. Do NOT change the
|
|
978
996
|
* names of these identifiers or change this into a const enum.
|
|
979
997
|
*/
|
|
980
|
-
var
|
|
998
|
+
var Q, L;
|
|
981
999
|
|
|
982
1000
|
/**
|
|
983
1001
|
* Converts an HTTP Status Code to the equivalent error code.
|
|
@@ -998,44 +1016,44 @@ function __PRIVATE_mapCodeFromHttpStatus(t) {
|
|
|
998
1016
|
switch (t) {
|
|
999
1017
|
case 200:
|
|
1000
1018
|
// OK
|
|
1001
|
-
return
|
|
1019
|
+
return T;
|
|
1002
1020
|
|
|
1003
1021
|
case 400:
|
|
1004
1022
|
// Bad Request
|
|
1005
|
-
return
|
|
1023
|
+
return v;
|
|
1006
1024
|
|
|
1007
1025
|
// Other possibilities based on the forward mapping
|
|
1008
1026
|
// return Code.INVALID_ARGUMENT;
|
|
1009
1027
|
// return Code.OUT_OF_RANGE;
|
|
1010
1028
|
case 401:
|
|
1011
1029
|
// Unauthorized
|
|
1012
|
-
return
|
|
1030
|
+
return g;
|
|
1013
1031
|
|
|
1014
1032
|
case 403:
|
|
1015
1033
|
// Forbidden
|
|
1016
|
-
return
|
|
1034
|
+
return w;
|
|
1017
1035
|
|
|
1018
1036
|
case 404:
|
|
1019
1037
|
// Not Found
|
|
1020
|
-
return
|
|
1038
|
+
return p;
|
|
1021
1039
|
|
|
1022
1040
|
case 409:
|
|
1023
1041
|
// Conflict
|
|
1024
|
-
return
|
|
1042
|
+
return D;
|
|
1025
1043
|
|
|
1026
1044
|
// Other possibilities:
|
|
1027
1045
|
// return Code.ALREADY_EXISTS;
|
|
1028
1046
|
case 416:
|
|
1029
1047
|
// Range Not Satisfiable
|
|
1030
|
-
return
|
|
1048
|
+
return b;
|
|
1031
1049
|
|
|
1032
1050
|
case 429:
|
|
1033
1051
|
// Too Many Requests
|
|
1034
|
-
return
|
|
1052
|
+
return F;
|
|
1035
1053
|
|
|
1036
1054
|
case 499:
|
|
1037
1055
|
// Client Closed Request
|
|
1038
|
-
return
|
|
1056
|
+
return P;
|
|
1039
1057
|
|
|
1040
1058
|
case 500:
|
|
1041
1059
|
// Internal Server Error
|
|
@@ -1046,18 +1064,18 @@ function __PRIVATE_mapCodeFromHttpStatus(t) {
|
|
|
1046
1064
|
// return Code.DATA_LOSS;
|
|
1047
1065
|
case 501:
|
|
1048
1066
|
// Unimplemented
|
|
1049
|
-
return
|
|
1067
|
+
return C;
|
|
1050
1068
|
|
|
1051
1069
|
case 503:
|
|
1052
1070
|
// Service Unavailable
|
|
1053
|
-
return
|
|
1071
|
+
return N;
|
|
1054
1072
|
|
|
1055
1073
|
case 504:
|
|
1056
1074
|
// Gateway Timeout
|
|
1057
|
-
return
|
|
1075
|
+
return I;
|
|
1058
1076
|
|
|
1059
1077
|
default:
|
|
1060
|
-
return t >= 200 && t < 300 ?
|
|
1078
|
+
return t >= 200 && t < 300 ? T : t >= 400 && t < 500 ? v : t >= 500 && t < 600 ? S : R;
|
|
1061
1079
|
}
|
|
1062
1080
|
}
|
|
1063
1081
|
|
|
@@ -1080,13 +1098,13 @@ function __PRIVATE_mapCodeFromHttpStatus(t) {
|
|
|
1080
1098
|
/**
|
|
1081
1099
|
* A Rest-based connection that relies on the native HTTP stack
|
|
1082
1100
|
* (e.g. `fetch` or a polyfill).
|
|
1083
|
-
*/ (
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1101
|
+
*/ (L = Q || (Q = {}))[L.OK = 0] = "OK", L[L.CANCELLED = 1] = "CANCELLED", L[L.UNKNOWN = 2] = "UNKNOWN",
|
|
1102
|
+
L[L.INVALID_ARGUMENT = 3] = "INVALID_ARGUMENT", L[L.DEADLINE_EXCEEDED = 4] = "DEADLINE_EXCEEDED",
|
|
1103
|
+
L[L.NOT_FOUND = 5] = "NOT_FOUND", L[L.ALREADY_EXISTS = 6] = "ALREADY_EXISTS", L[L.PERMISSION_DENIED = 7] = "PERMISSION_DENIED",
|
|
1104
|
+
L[L.UNAUTHENTICATED = 16] = "UNAUTHENTICATED", L[L.RESOURCE_EXHAUSTED = 8] = "RESOURCE_EXHAUSTED",
|
|
1105
|
+
L[L.FAILED_PRECONDITION = 9] = "FAILED_PRECONDITION", L[L.ABORTED = 10] = "ABORTED",
|
|
1106
|
+
L[L.OUT_OF_RANGE = 11] = "OUT_OF_RANGE", L[L.UNIMPLEMENTED = 12] = "UNIMPLEMENTED",
|
|
1107
|
+
L[L.INTERNAL = 13] = "INTERNAL", L[L.UNAVAILABLE = 14] = "UNAVAILABLE", L[L.DATA_LOSS = 15] = "DATA_LOSS";
|
|
1090
1108
|
|
|
1091
1109
|
class __PRIVATE_FetchConnection extends
|
|
1092
1110
|
/**
|
|
@@ -1102,14 +1120,14 @@ class __PRIVATE_RestConnection {
|
|
|
1102
1120
|
constructor(t) {
|
|
1103
1121
|
this.databaseInfo = t, this.databaseId = t.databaseId;
|
|
1104
1122
|
const e = t.ssl ? "https" : "http", r = encodeURIComponent(this.databaseId.projectId), n = encodeURIComponent(this.databaseId.database);
|
|
1105
|
-
this.A = e + "://" + t.host, this.T = `projects/${r}/databases/${n}`, this.
|
|
1123
|
+
this.A = e + "://" + t.host, this.T = `projects/${r}/databases/${n}`, this.P = "(default)" === this.databaseId.database ? `project_id=${r}` : `project_id=${r}&database_id=${n}`;
|
|
1106
1124
|
}
|
|
1107
|
-
|
|
1125
|
+
R(t, e, r, n, i) {
|
|
1108
1126
|
const s = __PRIVATE_generateUniqueDebugId(), o = this.V(t, e.toUriEncodedString());
|
|
1109
1127
|
__PRIVATE_logDebug("RestConnection", `Sending RPC '${t}' ${s}:`, o, r);
|
|
1110
1128
|
const a = {
|
|
1111
1129
|
"google-cloud-resource-prefix": this.T,
|
|
1112
|
-
"x-goog-request-params": this.
|
|
1130
|
+
"x-goog-request-params": this.P
|
|
1113
1131
|
};
|
|
1114
1132
|
return this.I(a, n, i), this.p(t, o, a, r).then((e => (__PRIVATE_logDebug("RestConnection", `Received RPC '${t}' ${s}: `, e),
|
|
1115
1133
|
e)), (e => {
|
|
@@ -1120,7 +1138,7 @@ class __PRIVATE_RestConnection {
|
|
|
1120
1138
|
g(t, e, r, n, i, s) {
|
|
1121
1139
|
// The REST API automatically aggregates all of the streamed results, so we
|
|
1122
1140
|
// can just use the normal invoke() method.
|
|
1123
|
-
return this.
|
|
1141
|
+
return this.R(t, e, r, n, i);
|
|
1124
1142
|
}
|
|
1125
1143
|
/**
|
|
1126
1144
|
* Modifies the headers for a request, adding any authorization token if
|
|
@@ -1130,7 +1148,7 @@ class __PRIVATE_RestConnection {
|
|
|
1130
1148
|
// SDK_VERSION is updated to different value at runtime depending on the entry point,
|
|
1131
1149
|
// so we need to get its value when we need it in a function.
|
|
1132
1150
|
function __PRIVATE_getGoogApiClientValue() {
|
|
1133
|
-
return "gl-js/ fire/" +
|
|
1151
|
+
return "gl-js/ fire/" + m;
|
|
1134
1152
|
}(),
|
|
1135
1153
|
// Content-Type: text/plain will avoid preflight requests which might
|
|
1136
1154
|
// mess with CORS and redirects by proxies. If we add custom headers
|
|
@@ -1140,7 +1158,7 @@ class __PRIVATE_RestConnection {
|
|
|
1140
1158
|
e && e.headers.forEach(((e, r) => t[r] = e)), r && r.headers.forEach(((e, r) => t[r] = e));
|
|
1141
1159
|
}
|
|
1142
1160
|
V(t, e) {
|
|
1143
|
-
const r =
|
|
1161
|
+
const r = $[t];
|
|
1144
1162
|
return `${this.A}/v1/${e}:${r}`;
|
|
1145
1163
|
}
|
|
1146
1164
|
/**
|
|
@@ -1486,7 +1504,7 @@ class ByteString {
|
|
|
1486
1504
|
|
|
1487
1505
|
ByteString.EMPTY_BYTE_STRING = new ByteString("");
|
|
1488
1506
|
|
|
1489
|
-
const
|
|
1507
|
+
const M = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
1490
1508
|
|
|
1491
1509
|
/**
|
|
1492
1510
|
* Converts the possible Proto values for a timestamp value into a "seconds and
|
|
@@ -1500,7 +1518,7 @@ const L = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1500
1518
|
// (millis), so we do some custom parsing here.
|
|
1501
1519
|
// Parse the nanos right out of the string.
|
|
1502
1520
|
let e = 0;
|
|
1503
|
-
const r =
|
|
1521
|
+
const r = M.exec(t);
|
|
1504
1522
|
if (__PRIVATE_hardAssert(!!r), r[1]) {
|
|
1505
1523
|
// Pad the fraction out to 9 digits (nanos).
|
|
1506
1524
|
let t = r[1];
|
|
@@ -1610,11 +1628,11 @@ class Timestamp {
|
|
|
1610
1628
|
* The fractions of a second at nanosecond resolution.*
|
|
1611
1629
|
*/
|
|
1612
1630
|
e) {
|
|
1613
|
-
if (this.seconds = t, this.nanoseconds = e, e < 0) throw new FirestoreError(
|
|
1614
|
-
if (e >= 1e9) throw new FirestoreError(
|
|
1615
|
-
if (t < -62135596800) throw new FirestoreError(
|
|
1631
|
+
if (this.seconds = t, this.nanoseconds = e, e < 0) throw new FirestoreError(V, "Timestamp nanoseconds out of range: " + e);
|
|
1632
|
+
if (e >= 1e9) throw new FirestoreError(V, "Timestamp nanoseconds out of range: " + e);
|
|
1633
|
+
if (t < -62135596800) throw new FirestoreError(V, "Timestamp seconds out of range: " + t);
|
|
1616
1634
|
// This will break in the year 10,000.
|
|
1617
|
-
if (t >= 253402300800) throw new FirestoreError(
|
|
1635
|
+
if (t >= 253402300800) throw new FirestoreError(V, "Timestamp seconds out of range: " + t);
|
|
1618
1636
|
}
|
|
1619
1637
|
/**
|
|
1620
1638
|
* Converts a `Timestamp` to a JavaScript `Date` object. This conversion
|
|
@@ -1743,7 +1761,7 @@ class Timestamp {
|
|
|
1743
1761
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1744
1762
|
* See the License for the specific language governing permissions and
|
|
1745
1763
|
* limitations under the License.
|
|
1746
|
-
*/ const
|
|
1764
|
+
*/ const x = {
|
|
1747
1765
|
fields: {
|
|
1748
1766
|
__type__: {
|
|
1749
1767
|
stringValue: "__max__"
|
|
@@ -1933,9 +1951,9 @@ function __PRIVATE_valueCompare(t, e) {
|
|
|
1933
1951
|
|
|
1934
1952
|
case 11 /* TypeOrder.ObjectValue */ :
|
|
1935
1953
|
return function __PRIVATE_compareMaps(t, e) {
|
|
1936
|
-
if (t ===
|
|
1937
|
-
if (t ===
|
|
1938
|
-
if (e ===
|
|
1954
|
+
if (t === x && e === x) return 0;
|
|
1955
|
+
if (t === x) return 1;
|
|
1956
|
+
if (e === x) return -1;
|
|
1939
1957
|
const r = t.fields || {}, n = Object.keys(r), i = e.fields || {}, s = Object.keys(i);
|
|
1940
1958
|
// Even though MapValues are likely sorted correctly based on their insertion
|
|
1941
1959
|
// order (e.g. when received from the backend), local modifications can bring
|
|
@@ -3500,13 +3518,13 @@ function toNumber(t, e) {
|
|
|
3500
3518
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3501
3519
|
* See the License for the specific language governing permissions and
|
|
3502
3520
|
* limitations under the License.
|
|
3503
|
-
*/ const
|
|
3521
|
+
*/ const k = (() => {
|
|
3504
3522
|
const t = {
|
|
3505
3523
|
asc: "ASCENDING",
|
|
3506
3524
|
desc: "DESCENDING"
|
|
3507
3525
|
};
|
|
3508
3526
|
return t;
|
|
3509
|
-
})(),
|
|
3527
|
+
})(), U = (() => {
|
|
3510
3528
|
const t = {
|
|
3511
3529
|
"<": "LESS_THAN",
|
|
3512
3530
|
"<=": "LESS_THAN_OR_EQUAL",
|
|
@@ -3520,7 +3538,7 @@ function toNumber(t, e) {
|
|
|
3520
3538
|
"array-contains-any": "ARRAY_CONTAINS_ANY"
|
|
3521
3539
|
};
|
|
3522
3540
|
return t;
|
|
3523
|
-
})(),
|
|
3541
|
+
})(), j = (() => {
|
|
3524
3542
|
const t = {
|
|
3525
3543
|
and: "AND",
|
|
3526
3544
|
or: "OR"
|
|
@@ -3609,8 +3627,8 @@ function fromName(t, e) {
|
|
|
3609
3627
|
const e = ResourcePath.fromString(t);
|
|
3610
3628
|
return __PRIVATE_hardAssert(__PRIVATE_isValidResourceName(e)), e;
|
|
3611
3629
|
}(e);
|
|
3612
|
-
if (r.get(1) !== t.databaseId.projectId) throw new FirestoreError(
|
|
3613
|
-
if (r.get(3) !== t.databaseId.database) throw new FirestoreError(
|
|
3630
|
+
if (r.get(1) !== t.databaseId.projectId) throw new FirestoreError(V, "Tried to deserialize key from different project: " + r.get(1) + " vs " + t.databaseId.projectId);
|
|
3631
|
+
if (r.get(3) !== t.databaseId.database) throw new FirestoreError(V, "Tried to deserialize key from different database: " + r.get(3) + " vs " + t.databaseId.database);
|
|
3614
3632
|
return new DocumentKey(function __PRIVATE_extractLocalPathFromResourceName(t) {
|
|
3615
3633
|
return __PRIVATE_hardAssert(t.length > 4 && "documents" === t.get(4)), t.popFirst(5);
|
|
3616
3634
|
}
|
|
@@ -3744,16 +3762,16 @@ function __PRIVATE_toQueryTarget(t, e) {
|
|
|
3744
3762
|
}
|
|
3745
3763
|
|
|
3746
3764
|
function __PRIVATE_toDirection(t) {
|
|
3747
|
-
return
|
|
3765
|
+
return k[t];
|
|
3748
3766
|
}
|
|
3749
3767
|
|
|
3750
3768
|
// visible for testing
|
|
3751
3769
|
function __PRIVATE_toOperatorName(t) {
|
|
3752
|
-
return
|
|
3770
|
+
return U[t];
|
|
3753
3771
|
}
|
|
3754
3772
|
|
|
3755
3773
|
function __PRIVATE_toCompositeOperatorName(t) {
|
|
3756
|
-
return
|
|
3774
|
+
return j[t];
|
|
3757
3775
|
}
|
|
3758
3776
|
|
|
3759
3777
|
function __PRIVATE_toFieldPathReference(t) {
|
|
@@ -3970,17 +3988,17 @@ class __PRIVATE_DatastoreImpl extends class Datastore {} {
|
|
|
3970
3988
|
this.serializer = n, this.J = !1;
|
|
3971
3989
|
}
|
|
3972
3990
|
Y() {
|
|
3973
|
-
if (this.J) throw new FirestoreError(
|
|
3991
|
+
if (this.J) throw new FirestoreError(v, "The client has already been terminated.");
|
|
3974
3992
|
}
|
|
3975
|
-
/** Invokes the provided RPC with auth and AppCheck tokens. */
|
|
3976
|
-
return this.Y(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([i, s]) => this.connection.
|
|
3977
|
-
throw "FirebaseError" === t.name ? (t.code ===
|
|
3993
|
+
/** Invokes the provided RPC with auth and AppCheck tokens. */ R(t, e, r, n) {
|
|
3994
|
+
return this.Y(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([i, s]) => this.connection.R(t, __PRIVATE_toResourcePath(e, r), n, i, s))).catch((t => {
|
|
3995
|
+
throw "FirebaseError" === t.name ? (t.code === g && (this.authCredentials.invalidateToken(),
|
|
3978
3996
|
this.appCheckCredentials.invalidateToken()), t) : new FirestoreError(R, t.toString());
|
|
3979
3997
|
}));
|
|
3980
3998
|
}
|
|
3981
3999
|
/** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ g(t, e, r, n, i) {
|
|
3982
4000
|
return this.Y(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([s, o]) => this.connection.g(t, __PRIVATE_toResourcePath(e, r), n, s, o, i))).catch((t => {
|
|
3983
|
-
throw "FirebaseError" === t.name ? (t.code ===
|
|
4001
|
+
throw "FirebaseError" === t.name ? (t.code === g && (this.authCredentials.invalidateToken(),
|
|
3984
4002
|
this.appCheckCredentials.invalidateToken()), t) : new FirestoreError(R, t.toString());
|
|
3985
4003
|
}));
|
|
3986
4004
|
}
|
|
@@ -3995,7 +4013,7 @@ async function __PRIVATE_invokeCommitRpc(t, e) {
|
|
|
3995
4013
|
const r = __PRIVATE_debugCast(t), n = {
|
|
3996
4014
|
writes: e.map((t => toMutation(r.serializer, t)))
|
|
3997
4015
|
};
|
|
3998
|
-
await r.
|
|
4016
|
+
await r.R("Commit", r.serializer.databaseId, ResourcePath.emptyPath(), n);
|
|
3999
4017
|
}
|
|
4000
4018
|
|
|
4001
4019
|
async function __PRIVATE_invokeBatchGetDocumentsRpc(t, e) {
|
|
@@ -4095,7 +4113,7 @@ async function __PRIVATE_invokeRunAggregationQueryRpc(t, e, r) {
|
|
|
4095
4113
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4096
4114
|
* See the License for the specific language governing permissions and
|
|
4097
4115
|
* limitations under the License.
|
|
4098
|
-
*/ const
|
|
4116
|
+
*/ const z = new Map;
|
|
4099
4117
|
|
|
4100
4118
|
/**
|
|
4101
4119
|
* An instance map that ensures only one Datastore exists per Firestore
|
|
@@ -4107,8 +4125,8 @@ async function __PRIVATE_invokeRunAggregationQueryRpc(t, e, r) {
|
|
|
4107
4125
|
* instance is terminated.
|
|
4108
4126
|
*/
|
|
4109
4127
|
function __PRIVATE_getDatastore(t) {
|
|
4110
|
-
if (t._terminated) throw new FirestoreError(
|
|
4111
|
-
if (!
|
|
4128
|
+
if (t._terminated) throw new FirestoreError(v, "The client has already been terminated.");
|
|
4129
|
+
if (!z.has(t)) {
|
|
4112
4130
|
__PRIVATE_logDebug("ComponentProvider", "Initializing Datastore");
|
|
4113
4131
|
const e = function __PRIVATE_newConnection(t) {
|
|
4114
4132
|
return new __PRIVATE_FetchConnection(t);
|
|
@@ -4133,9 +4151,9 @@ function __PRIVATE_getDatastore(t) {
|
|
|
4133
4151
|
*/ (t._databaseId, t.app.options.appId || "", t._persistenceKey, t._freezeSettings())), r = __PRIVATE_newSerializer(t._databaseId), n = function __PRIVATE_newDatastore(t, e, r, n) {
|
|
4134
4152
|
return new __PRIVATE_DatastoreImpl(t, e, r, n);
|
|
4135
4153
|
}(t._authCredentials, t._appCheckCredentials, e, r);
|
|
4136
|
-
|
|
4154
|
+
z.set(t, n);
|
|
4137
4155
|
}
|
|
4138
|
-
return
|
|
4156
|
+
return z.get(t);
|
|
4139
4157
|
}
|
|
4140
4158
|
|
|
4141
4159
|
/**
|
|
@@ -4151,16 +4169,16 @@ class FirestoreSettingsImpl {
|
|
|
4151
4169
|
constructor(t) {
|
|
4152
4170
|
var e, r;
|
|
4153
4171
|
if (void 0 === t.host) {
|
|
4154
|
-
if (void 0 !== t.ssl) throw new FirestoreError(
|
|
4172
|
+
if (void 0 !== t.ssl) throw new FirestoreError(V, "Can't provide ssl option if host option is not set");
|
|
4155
4173
|
this.host = "firestore.googleapis.com", this.ssl = true;
|
|
4156
4174
|
} else this.host = t.host, this.ssl = null === (e = t.ssl) || void 0 === e || e;
|
|
4157
4175
|
if (this.credentials = t.credentials, this.ignoreUndefinedProperties = !!t.ignoreUndefinedProperties,
|
|
4158
4176
|
this.localCache = t.localCache, void 0 === t.cacheSizeBytes) this.cacheSizeBytes = 41943040; else {
|
|
4159
|
-
if (-1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new FirestoreError(
|
|
4177
|
+
if (-1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new FirestoreError(V, "cacheSizeBytes must be at least 1048576");
|
|
4160
4178
|
this.cacheSizeBytes = t.cacheSizeBytes;
|
|
4161
4179
|
}
|
|
4162
4180
|
!function __PRIVATE_validateIsNotUsedTogether(t, e, r, n) {
|
|
4163
|
-
if (!0 === e && !0 === n) throw new FirestoreError(
|
|
4181
|
+
if (!0 === e && !0 === n) throw new FirestoreError(V, `${t} and ${r} cannot be used together.`);
|
|
4164
4182
|
}("experimentalForceLongPolling", t.experimentalForceLongPolling, "experimentalAutoDetectLongPolling", t.experimentalAutoDetectLongPolling),
|
|
4165
4183
|
this.experimentalForceLongPolling = !!t.experimentalForceLongPolling, this.experimentalForceLongPolling ? this.experimentalAutoDetectLongPolling = !1 : void 0 === t.experimentalAutoDetectLongPolling ? this.experimentalAutoDetectLongPolling = true :
|
|
4166
4184
|
// For backwards compatibility, coerce the value to boolean even though
|
|
@@ -4170,9 +4188,9 @@ class FirestoreSettingsImpl {
|
|
|
4170
4188
|
this.experimentalLongPollingOptions = __PRIVATE_cloneLongPollingOptions(null !== (r = t.experimentalLongPollingOptions) && void 0 !== r ? r : {}),
|
|
4171
4189
|
function __PRIVATE_validateLongPollingOptions(t) {
|
|
4172
4190
|
if (void 0 !== t.timeoutSeconds) {
|
|
4173
|
-
if (isNaN(t.timeoutSeconds)) throw new FirestoreError(
|
|
4174
|
-
if (t.timeoutSeconds < 5) throw new FirestoreError(
|
|
4175
|
-
if (t.timeoutSeconds > 30) throw new FirestoreError(
|
|
4191
|
+
if (isNaN(t.timeoutSeconds)) throw new FirestoreError(V, `invalid long polling timeout: ${t.timeoutSeconds} (must not be NaN)`);
|
|
4192
|
+
if (t.timeoutSeconds < 5) throw new FirestoreError(V, `invalid long polling timeout: ${t.timeoutSeconds} (minimum allowed value is 5)`);
|
|
4193
|
+
if (t.timeoutSeconds > 30) throw new FirestoreError(V, `invalid long polling timeout: ${t.timeoutSeconds} (maximum allowed value is 30)`);
|
|
4176
4194
|
}
|
|
4177
4195
|
}
|
|
4178
4196
|
/**
|
|
@@ -4224,7 +4242,7 @@ class Firestore {
|
|
|
4224
4242
|
* The {@link @firebase/app#FirebaseApp} associated with this `Firestore` service
|
|
4225
4243
|
* instance.
|
|
4226
4244
|
*/ get app() {
|
|
4227
|
-
if (!this._app) throw new FirestoreError(
|
|
4245
|
+
if (!this._app) throw new FirestoreError(v, "Firestore was not initialized using the Firebase SDK. 'app' is not available");
|
|
4228
4246
|
return this._app;
|
|
4229
4247
|
}
|
|
4230
4248
|
get _initialized() {
|
|
@@ -4234,7 +4252,7 @@ class Firestore {
|
|
|
4234
4252
|
return "notTerminated" !== this._terminateTask;
|
|
4235
4253
|
}
|
|
4236
4254
|
_setSettings(t) {
|
|
4237
|
-
if (this._settingsFrozen) throw new FirestoreError(
|
|
4255
|
+
if (this._settingsFrozen) throw new FirestoreError(v, "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.");
|
|
4238
4256
|
this._settings = new FirestoreSettingsImpl(t), void 0 !== t.credentials && (this._authCredentials = function __PRIVATE_makeAuthCredentialsProvider(t) {
|
|
4239
4257
|
if (!t) return new __PRIVATE_EmptyAuthCredentialsProvider;
|
|
4240
4258
|
switch (t.type) {
|
|
@@ -4245,7 +4263,7 @@ class Firestore {
|
|
|
4245
4263
|
return t.client;
|
|
4246
4264
|
|
|
4247
4265
|
default:
|
|
4248
|
-
throw new FirestoreError(
|
|
4266
|
+
throw new FirestoreError(V, "makeAuthCredentialsProvider failed due to invalid credential type");
|
|
4249
4267
|
}
|
|
4250
4268
|
}(t.credentials));
|
|
4251
4269
|
}
|
|
@@ -4282,8 +4300,8 @@ class Firestore {
|
|
|
4282
4300
|
* Only ever called once.
|
|
4283
4301
|
*/ _terminate() {
|
|
4284
4302
|
return function __PRIVATE_removeComponents(t) {
|
|
4285
|
-
const e =
|
|
4286
|
-
e && (__PRIVATE_logDebug("ComponentProvider", "Removing Datastore"),
|
|
4303
|
+
const e = z.get(t);
|
|
4304
|
+
e && (__PRIVATE_logDebug("ComponentProvider", "Removing Datastore"), z.delete(t),
|
|
4287
4305
|
e.terminate());
|
|
4288
4306
|
}(this), Promise.resolve();
|
|
4289
4307
|
}
|
|
@@ -4292,7 +4310,7 @@ class Firestore {
|
|
|
4292
4310
|
function initializeFirestore(t, e, r) {
|
|
4293
4311
|
r || (r = "(default)");
|
|
4294
4312
|
const n = _getProvider(t, "firestore/lite");
|
|
4295
|
-
if (n.isInitialized(r)) throw new FirestoreError(
|
|
4313
|
+
if (n.isInitialized(r)) throw new FirestoreError(v, "Firestore can only be initialized once per app.");
|
|
4296
4314
|
return n.initialize({
|
|
4297
4315
|
options: e,
|
|
4298
4316
|
instanceIdentifier: r
|
|
@@ -4336,7 +4354,7 @@ function getFirestore(e, r) {
|
|
|
4336
4354
|
// invalid field "uid" and missing field "sub" / "user_id".)
|
|
4337
4355
|
e = h(n.mockUserToken, null === (i = t._app) || void 0 === i ? void 0 : i.options.projectId);
|
|
4338
4356
|
const s = n.mockUserToken.sub || n.mockUserToken.user_id;
|
|
4339
|
-
if (!s) throw new FirestoreError(
|
|
4357
|
+
if (!s) throw new FirestoreError(V, "mockUserToken must contain 'sub' or 'user_id' field!");
|
|
4340
4358
|
r = new User(s);
|
|
4341
4359
|
}
|
|
4342
4360
|
t._authCredentials = new __PRIVATE_EmulatorAuthCredentialsProvider(new __PRIVATE_OAuthToken(e, r));
|
|
@@ -4555,7 +4573,7 @@ function collection(t, e, ...r) {
|
|
|
4555
4573
|
return __PRIVATE_validateCollectionPath(n), new CollectionReference(t, /* converter= */ null, n);
|
|
4556
4574
|
}
|
|
4557
4575
|
{
|
|
4558
|
-
if (!(t instanceof DocumentReference || t instanceof CollectionReference)) throw new FirestoreError(
|
|
4576
|
+
if (!(t instanceof DocumentReference || t instanceof CollectionReference)) throw new FirestoreError(V, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
4559
4577
|
const n = t._path.child(ResourcePath.fromString(e, ...r));
|
|
4560
4578
|
return __PRIVATE_validateCollectionPath(n), new CollectionReference(t.firestore,
|
|
4561
4579
|
/* converter= */ null, n);
|
|
@@ -4576,7 +4594,7 @@ function collection(t, e, ...r) {
|
|
|
4576
4594
|
* @returns The created `Query`.
|
|
4577
4595
|
*/ function collectionGroup(t, e) {
|
|
4578
4596
|
if (t = __PRIVATE_cast(t, Firestore), __PRIVATE_validateNonEmptyArgument("collectionGroup", "collection id", e),
|
|
4579
|
-
e.indexOf("/") >= 0) throw new FirestoreError(
|
|
4597
|
+
e.indexOf("/") >= 0) throw new FirestoreError(V, `Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
|
|
4580
4598
|
return new Query(t,
|
|
4581
4599
|
/* converter= */ null, function __PRIVATE_newQueryForCollectionGroup(t) {
|
|
4582
4600
|
return new __PRIVATE_QueryImpl(ResourcePath.emptyPath(), t);
|
|
@@ -4594,7 +4612,7 @@ function doc(t, e, ...r) {
|
|
|
4594
4612
|
/* converter= */ null, new DocumentKey(n));
|
|
4595
4613
|
}
|
|
4596
4614
|
{
|
|
4597
|
-
if (!(t instanceof DocumentReference || t instanceof CollectionReference)) throw new FirestoreError(
|
|
4615
|
+
if (!(t instanceof DocumentReference || t instanceof CollectionReference)) throw new FirestoreError(V, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
4598
4616
|
const n = t._path.child(ResourcePath.fromString(e, ...r));
|
|
4599
4617
|
return __PRIVATE_validateDocumentPath(n), new DocumentReference(t.firestore, t instanceof CollectionReference ? t.converter : null, new DocumentKey(n));
|
|
4600
4618
|
}
|
|
@@ -4655,7 +4673,7 @@ function doc(t, e, ...r) {
|
|
|
4655
4673
|
try {
|
|
4656
4674
|
return new Bytes(ByteString.fromBase64String(t));
|
|
4657
4675
|
} catch (t) {
|
|
4658
|
-
throw new FirestoreError(
|
|
4676
|
+
throw new FirestoreError(V, "Failed to construct data from Base64 string: " + t);
|
|
4659
4677
|
}
|
|
4660
4678
|
}
|
|
4661
4679
|
/**
|
|
@@ -4727,7 +4745,7 @@ function doc(t, e, ...r) {
|
|
|
4727
4745
|
* @param fieldNames - A list of field names.
|
|
4728
4746
|
*/
|
|
4729
4747
|
constructor(...t) {
|
|
4730
|
-
for (let e = 0; e < t.length; ++e) if (0 === t[e].length) throw new FirestoreError(
|
|
4748
|
+
for (let e = 0; e < t.length; ++e) if (0 === t[e].length) throw new FirestoreError(V, "Invalid field name at argument $(i + 1). Field names must not be empty.");
|
|
4731
4749
|
this._internalPath = new FieldPath$1(t);
|
|
4732
4750
|
}
|
|
4733
4751
|
/**
|
|
@@ -4806,8 +4824,8 @@ function doc(t, e, ...r) {
|
|
|
4806
4824
|
* @param longitude - The longitude as number between -180 and 180.
|
|
4807
4825
|
*/
|
|
4808
4826
|
constructor(t, e) {
|
|
4809
|
-
if (!isFinite(t) || t < -90 || t > 90) throw new FirestoreError(
|
|
4810
|
-
if (!isFinite(e) || e < -180 || e > 180) throw new FirestoreError(
|
|
4827
|
+
if (!isFinite(t) || t < -90 || t > 90) throw new FirestoreError(V, "Latitude must be a number between -90 and 90, but was: " + t);
|
|
4828
|
+
if (!isFinite(e) || e < -180 || e > 180) throw new FirestoreError(V, "Longitude must be a number between -180 and 180, but was: " + e);
|
|
4811
4829
|
this._lat = t, this._long = e;
|
|
4812
4830
|
}
|
|
4813
4831
|
/**
|
|
@@ -4929,7 +4947,7 @@ class VectorValue {
|
|
|
4929
4947
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4930
4948
|
* See the License for the specific language governing permissions and
|
|
4931
4949
|
* limitations under the License.
|
|
4932
|
-
*/ const
|
|
4950
|
+
*/ const W = /^__.*__$/;
|
|
4933
4951
|
|
|
4934
4952
|
/** The result of parsing document data (e.g. for a setData call). */ class ParsedSetData {
|
|
4935
4953
|
constructor(t, e, r) {
|
|
@@ -5040,7 +5058,7 @@ function __PRIVATE_isWrite(t) {
|
|
|
5040
5058
|
}
|
|
5041
5059
|
it(t) {
|
|
5042
5060
|
if (0 === t.length) throw this.ut("Document fields must not be empty");
|
|
5043
|
-
if (__PRIVATE_isWrite(this.tt) &&
|
|
5061
|
+
if (__PRIVATE_isWrite(this.tt) && W.test(t)) throw this.ut('Document fields cannot begin and end with "__"');
|
|
5044
5062
|
}
|
|
5045
5063
|
}
|
|
5046
5064
|
|
|
@@ -5077,7 +5095,7 @@ function __PRIVATE_newUserDataReader(t) {
|
|
|
5077
5095
|
const t = [];
|
|
5078
5096
|
for (const n of s.mergeFields) {
|
|
5079
5097
|
const i = __PRIVATE_fieldPathFromArgument$1(e, n, r);
|
|
5080
|
-
if (!o.contains(i)) throw new FirestoreError(
|
|
5098
|
+
if (!o.contains(i)) throw new FirestoreError(V, `Field '${i}' is specified in your field mask but missing from your input data.`);
|
|
5081
5099
|
__PRIVATE_fieldMaskContains(t, i) || t.push(i);
|
|
5082
5100
|
}
|
|
5083
5101
|
u = new FieldMask(t), _ = o.fieldTransforms.filter((t => u.covers(t.field)));
|
|
@@ -5194,7 +5212,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
|
|
|
5194
5212
|
|
|
5195
5213
|
/** Parse update data from a list of field/value arguments. */ function __PRIVATE_parseUpdateVarargs(t, e, r, n, i, s) {
|
|
5196
5214
|
const o = t.lt(1 /* UserDataSource.Update */ , e, r), a = [ __PRIVATE_fieldPathFromArgument$1(e, n, r) ], u = [ i ];
|
|
5197
|
-
if (s.length % 2 != 0) throw new FirestoreError(
|
|
5215
|
+
if (s.length % 2 != 0) throw new FirestoreError(V, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);
|
|
5198
5216
|
for (let t = 0; t < s.length; t += 2) a.push(__PRIVATE_fieldPathFromArgument$1(e, s[t])),
|
|
5199
5217
|
u.push(s[t + 1]);
|
|
5200
5218
|
const _ = [], c = ObjectValue.empty();
|
|
@@ -5421,7 +5439,7 @@ function __PRIVATE_validatePlainObject(t, e, r) {
|
|
|
5421
5439
|
|
|
5422
5440
|
/**
|
|
5423
5441
|
* Matches any characters in a field path string that are reserved.
|
|
5424
|
-
*/ const
|
|
5442
|
+
*/ const K = new RegExp("[~\\*/\\[\\]]");
|
|
5425
5443
|
|
|
5426
5444
|
/**
|
|
5427
5445
|
* Wraps fromDotSeparatedString with an error message about the method that
|
|
@@ -5432,7 +5450,7 @@ function __PRIVATE_validatePlainObject(t, e, r) {
|
|
|
5432
5450
|
* @param targetDoc - The document against which the field path will be
|
|
5433
5451
|
* evaluated.
|
|
5434
5452
|
*/ function __PRIVATE_fieldPathFromDotSeparatedString(t, e, r) {
|
|
5435
|
-
if (e.search(
|
|
5453
|
+
if (e.search(K) >= 0) throw __PRIVATE_createError(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`, t,
|
|
5436
5454
|
/* hasConverter= */ !1,
|
|
5437
5455
|
/* path= */ void 0, r);
|
|
5438
5456
|
try {
|
|
@@ -5450,7 +5468,7 @@ function __PRIVATE_createError(t, e, r, n, i) {
|
|
|
5450
5468
|
r && (a += " (via `toFirestore()`)"), a += ". ";
|
|
5451
5469
|
let u = "";
|
|
5452
5470
|
return (s || o) && (u += " (found", s && (u += ` in field ${n}`), o && (u += ` in document ${i}`),
|
|
5453
|
-
u += ")"), new FirestoreError(
|
|
5471
|
+
u += ")"), new FirestoreError(V, a + t + u);
|
|
5454
5472
|
}
|
|
5455
5473
|
|
|
5456
5474
|
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function __PRIVATE_fieldMaskContains(t, e) {
|
|
@@ -5647,7 +5665,7 @@ function query(t, e, ...r) {
|
|
|
5647
5665
|
let n = [];
|
|
5648
5666
|
e instanceof AppliableConstraint && n.push(e), n = n.concat(r), function __PRIVATE_validateQueryConstraintArray(t) {
|
|
5649
5667
|
const e = t.filter((t => t instanceof QueryCompositeFilterConstraint)).length, r = t.filter((t => t instanceof QueryFieldFilterConstraint)).length;
|
|
5650
|
-
if (e > 1 || e > 0 && r > 0) throw new FirestoreError(
|
|
5668
|
+
if (e > 1 || e > 0 && r > 0) throw new FirestoreError(V, "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(...)))`.");
|
|
5651
5669
|
}
|
|
5652
5670
|
/**
|
|
5653
5671
|
* @license
|
|
@@ -5701,7 +5719,7 @@ function query(t, e, ...r) {
|
|
|
5701
5719
|
const e = __PRIVATE_newUserDataReader(t.firestore), r = function __PRIVATE_newQueryFilter(t, e, r, n, i, s, o) {
|
|
5702
5720
|
let a;
|
|
5703
5721
|
if (i.isKeyField()) {
|
|
5704
|
-
if ("array-contains" /* Operator.ARRAY_CONTAINS */ === s || "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ === s) throw new FirestoreError(
|
|
5722
|
+
if ("array-contains" /* Operator.ARRAY_CONTAINS */ === s || "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ === s) throw new FirestoreError(V, `Invalid Query. You can't perform '${s}' queries on documentId().`);
|
|
5705
5723
|
if ("in" /* Operator.IN */ === s || "not-in" /* Operator.NOT_IN */ === s) {
|
|
5706
5724
|
__PRIVATE_validateDisjunctiveFilterElements(o, s);
|
|
5707
5725
|
const e = [];
|
|
@@ -5828,8 +5846,8 @@ function query(t, e, ...r) {
|
|
|
5828
5846
|
}
|
|
5829
5847
|
_apply(t) {
|
|
5830
5848
|
const e = function __PRIVATE_newQueryOrderBy(t, e, r) {
|
|
5831
|
-
if (null !== t.startAt) throw new FirestoreError(
|
|
5832
|
-
if (null !== t.endAt) throw new FirestoreError(
|
|
5849
|
+
if (null !== t.startAt) throw new FirestoreError(V, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
|
|
5850
|
+
if (null !== t.endAt) throw new FirestoreError(V, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
|
|
5833
5851
|
return new OrderBy(e, r);
|
|
5834
5852
|
}
|
|
5835
5853
|
/**
|
|
@@ -5989,7 +6007,7 @@ function endAt(...t) {
|
|
|
5989
6007
|
|
|
5990
6008
|
/** Helper function to create a bound from a document or fields */ function __PRIVATE_newQueryBoundFromDocOrFields(t, e, r, n) {
|
|
5991
6009
|
if (r[0] = d(r[0]), r[0] instanceof DocumentSnapshot) return function __PRIVATE_newQueryBoundFromDocument(t, e, r, n, i) {
|
|
5992
|
-
if (!n) throw new FirestoreError(
|
|
6010
|
+
if (!n) throw new FirestoreError(p, `Can't use a DocumentSnapshot that doesn't exist for ${r}().`);
|
|
5993
6011
|
const s = [];
|
|
5994
6012
|
// Because people expect to continue/end a query at the exact document
|
|
5995
6013
|
// provided, we need to use the implicit sort order rather than the explicit
|
|
@@ -6000,10 +6018,10 @@ function endAt(...t) {
|
|
|
6000
6018
|
// results.
|
|
6001
6019
|
for (const r of __PRIVATE_queryNormalizedOrderBy(t)) if (r.field.isKeyField()) s.push(__PRIVATE_refValue(e, n.key)); else {
|
|
6002
6020
|
const t = n.data.field(r.field);
|
|
6003
|
-
if (__PRIVATE_isServerTimestamp(t)) throw new FirestoreError(
|
|
6021
|
+
if (__PRIVATE_isServerTimestamp(t)) throw new FirestoreError(V, 'Invalid query. You are trying to start or end a query using a document for which the field "' + r.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');
|
|
6004
6022
|
if (null === t) {
|
|
6005
6023
|
const t = r.field.canonicalString();
|
|
6006
|
-
throw new FirestoreError(
|
|
6024
|
+
throw new FirestoreError(V, `Invalid query. You are trying to start or end a query using a document for which the field '${t}' (used as the orderBy) does not exist.`);
|
|
6007
6025
|
}
|
|
6008
6026
|
s.push(t);
|
|
6009
6027
|
}
|
|
@@ -6017,15 +6035,15 @@ function endAt(...t) {
|
|
|
6017
6035
|
return function __PRIVATE_newQueryBoundFromFields(t, e, r, n, i, s) {
|
|
6018
6036
|
// Use explicit order by's because it has to match the query the user made
|
|
6019
6037
|
const o = t.explicitOrderBy;
|
|
6020
|
-
if (i.length > o.length) throw new FirestoreError(
|
|
6038
|
+
if (i.length > o.length) throw new FirestoreError(V, `Too many arguments provided to ${n}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);
|
|
6021
6039
|
const a = [];
|
|
6022
6040
|
for (let s = 0; s < i.length; s++) {
|
|
6023
6041
|
const u = i[s];
|
|
6024
6042
|
if (o[s].field.isKeyField()) {
|
|
6025
|
-
if ("string" != typeof u) throw new FirestoreError(
|
|
6026
|
-
if (!__PRIVATE_isCollectionGroupQuery(t) && -1 !== u.indexOf("/")) throw new FirestoreError(
|
|
6043
|
+
if ("string" != typeof u) throw new FirestoreError(V, `Invalid query. Expected a string for document ID in ${n}(), but got a ${typeof u}`);
|
|
6044
|
+
if (!__PRIVATE_isCollectionGroupQuery(t) && -1 !== u.indexOf("/")) throw new FirestoreError(V, `Invalid query. When querying a collection and ordering by documentId(), the value passed to ${n}() must be a plain document ID, but '${u}' contains a slash.`);
|
|
6027
6045
|
const r = t.path.child(ResourcePath.fromString(u));
|
|
6028
|
-
if (!DocumentKey.isDocumentKey(r)) throw new FirestoreError(
|
|
6046
|
+
if (!DocumentKey.isDocumentKey(r)) throw new FirestoreError(V, `Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${n}() must result in a valid document path, but '${r}' is not because it contains an odd number of segments.`);
|
|
6029
6047
|
const i = new DocumentKey(r);
|
|
6030
6048
|
a.push(__PRIVATE_refValue(e, i));
|
|
6031
6049
|
} else {
|
|
@@ -6045,21 +6063,21 @@ function endAt(...t) {
|
|
|
6045
6063
|
|
|
6046
6064
|
function __PRIVATE_parseDocumentIdValue(t, e, r) {
|
|
6047
6065
|
if ("string" == typeof (r = d(r))) {
|
|
6048
|
-
if ("" === r) throw new FirestoreError(
|
|
6049
|
-
if (!__PRIVATE_isCollectionGroupQuery(e) && -1 !== r.indexOf("/")) throw new FirestoreError(
|
|
6066
|
+
if ("" === r) throw new FirestoreError(V, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
|
|
6067
|
+
if (!__PRIVATE_isCollectionGroupQuery(e) && -1 !== r.indexOf("/")) throw new FirestoreError(V, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${r}' contains a '/' character.`);
|
|
6050
6068
|
const n = e.path.child(ResourcePath.fromString(r));
|
|
6051
|
-
if (!DocumentKey.isDocumentKey(n)) throw new FirestoreError(
|
|
6069
|
+
if (!DocumentKey.isDocumentKey(n)) throw new FirestoreError(V, `Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${n}' is not because it has an odd number of segments (${n.length}).`);
|
|
6052
6070
|
return __PRIVATE_refValue(t, new DocumentKey(n));
|
|
6053
6071
|
}
|
|
6054
6072
|
if (r instanceof DocumentReference) return __PRIVATE_refValue(t, r._key);
|
|
6055
|
-
throw new FirestoreError(
|
|
6073
|
+
throw new FirestoreError(V, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${__PRIVATE_valueDescription(r)}.`);
|
|
6056
6074
|
}
|
|
6057
6075
|
|
|
6058
6076
|
/**
|
|
6059
6077
|
* Validates that the value passed into a disjunctive filter satisfies all
|
|
6060
6078
|
* array requirements.
|
|
6061
6079
|
*/ function __PRIVATE_validateDisjunctiveFilterElements(t, e) {
|
|
6062
|
-
if (!Array.isArray(t) || 0 === t.length) throw new FirestoreError(
|
|
6080
|
+
if (!Array.isArray(t) || 0 === t.length) throw new FirestoreError(V, `Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);
|
|
6063
6081
|
}
|
|
6064
6082
|
|
|
6065
6083
|
/**
|
|
@@ -6093,11 +6111,11 @@ function __PRIVATE_parseDocumentIdValue(t, e, r) {
|
|
|
6093
6111
|
}(e.op));
|
|
6094
6112
|
if (null !== r)
|
|
6095
6113
|
// Special case when it's a duplicate op to give a slightly clearer error message.
|
|
6096
|
-
throw r === e.op ? new FirestoreError(
|
|
6114
|
+
throw r === e.op ? new FirestoreError(V, `Invalid query. You cannot use more than one '${e.op.toString()}' filter.`) : new FirestoreError(V, `Invalid query. You cannot use '${e.op.toString()}' filters with '${r.toString()}' filters.`);
|
|
6097
6115
|
}
|
|
6098
6116
|
|
|
6099
6117
|
function __PRIVATE_validateQueryFilterConstraint(t, e) {
|
|
6100
|
-
if (!(e instanceof QueryFieldFilterConstraint || e instanceof QueryCompositeFilterConstraint)) throw new FirestoreError(
|
|
6118
|
+
if (!(e instanceof QueryFieldFilterConstraint || e instanceof QueryCompositeFilterConstraint)) throw new FirestoreError(V, `Function ${t}() requires AppliableConstraints created with a call to 'where(...)', 'or(...)', or 'and(...)'.`);
|
|
6101
6119
|
}
|
|
6102
6120
|
|
|
6103
6121
|
/**
|
|
@@ -6274,7 +6292,7 @@ class __PRIVATE_LiteUserDataWriter extends class AbstractUserDataWriter {
|
|
|
6274
6292
|
* @returns A Promise that will be resolved with the results of the query.
|
|
6275
6293
|
*/ function getDocs(t) {
|
|
6276
6294
|
(function __PRIVATE_validateHasExplicitOrderByForLimitToLast(t) {
|
|
6277
|
-
if ("L" /* LimitType.Last */ === t.limitType && 0 === t.explicitOrderBy.length) throw new FirestoreError(
|
|
6295
|
+
if ("L" /* LimitType.Last */ === t.limitType && 0 === t.explicitOrderBy.length) throw new FirestoreError(C, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
6278
6296
|
})((t = __PRIVATE_cast(t, Query))._query);
|
|
6279
6297
|
const e = __PRIVATE_getDatastore(t.firestore), r = new __PRIVATE_LiteUserDataWriter(t.firestore);
|
|
6280
6298
|
return __PRIVATE_invokeRunQueryRpc(e, t._query).then((e => {
|
|
@@ -6621,12 +6639,12 @@ function sum(t) {
|
|
|
6621
6639
|
return this._verifyNotCommitted(), this._committed = !0, this._mutations.length > 0 ? this._commitHandler(this._mutations) : Promise.resolve();
|
|
6622
6640
|
}
|
|
6623
6641
|
_verifyNotCommitted() {
|
|
6624
|
-
if (this._committed) throw new FirestoreError(
|
|
6642
|
+
if (this._committed) throw new FirestoreError(v, "A write batch can no longer be used after commit() has been called.");
|
|
6625
6643
|
}
|
|
6626
6644
|
}
|
|
6627
6645
|
|
|
6628
6646
|
function __PRIVATE_validateReference(t, e) {
|
|
6629
|
-
if ((t = d(t)).firestore !== e) throw new FirestoreError(
|
|
6647
|
+
if ((t = d(t)).firestore !== e) throw new FirestoreError(V, "Provided document reference is from a different Firestore instance.");
|
|
6630
6648
|
return t;
|
|
6631
6649
|
}
|
|
6632
6650
|
|
|
@@ -6685,7 +6703,7 @@ function __PRIVATE_validateReference(t, e) {
|
|
|
6685
6703
|
this.writtenDocs = new Set;
|
|
6686
6704
|
}
|
|
6687
6705
|
async lookup(t) {
|
|
6688
|
-
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw this.lastTransactionError = new FirestoreError(
|
|
6706
|
+
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw this.lastTransactionError = new FirestoreError(V, "Firestore transactions require all reads to be executed before all writes."),
|
|
6689
6707
|
this.lastTransactionError;
|
|
6690
6708
|
const e = await __PRIVATE_invokeBatchGetDocumentsRpc(this.datastore, t);
|
|
6691
6709
|
return e.forEach((t => this.recordVersion(t))), e;
|
|
@@ -6729,7 +6747,7 @@ function __PRIVATE_validateReference(t, e) {
|
|
|
6729
6747
|
if (r) {
|
|
6730
6748
|
if (!e.isEqual(r))
|
|
6731
6749
|
// This transaction will fail no matter what.
|
|
6732
|
-
throw new FirestoreError(
|
|
6750
|
+
throw new FirestoreError(D, "Document version changed between two reads.");
|
|
6733
6751
|
} else this.readVersions.set(t.key.toString(), e);
|
|
6734
6752
|
}
|
|
6735
6753
|
/**
|
|
@@ -6756,7 +6774,7 @@ function __PRIVATE_validateReference(t, e) {
|
|
|
6756
6774
|
// express that to the backend, we have to validate locally.
|
|
6757
6775
|
// Note: this can change once we can send separate verify writes in the
|
|
6758
6776
|
// transaction.
|
|
6759
|
-
throw new FirestoreError(
|
|
6777
|
+
throw new FirestoreError(V, "Can't update a document that doesn't exist.");
|
|
6760
6778
|
// Document exists, base precondition on document update time.
|
|
6761
6779
|
return Precondition.updateTime(e);
|
|
6762
6780
|
}
|
|
@@ -6785,7 +6803,7 @@ function __PRIVATE_validateReference(t, e) {
|
|
|
6785
6803
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
6786
6804
|
* See the License for the specific language governing permissions and
|
|
6787
6805
|
* limitations under the License.
|
|
6788
|
-
*/ const
|
|
6806
|
+
*/ const G = {
|
|
6789
6807
|
maxAttempts: 5
|
|
6790
6808
|
};
|
|
6791
6809
|
|
|
@@ -6819,19 +6837,19 @@ class __PRIVATE_TransactionRunner {
|
|
|
6819
6837
|
}
|
|
6820
6838
|
Tt() {
|
|
6821
6839
|
this.Et.K((async () => {
|
|
6822
|
-
const t = new Transaction$1(this.datastore), e = this.
|
|
6840
|
+
const t = new Transaction$1(this.datastore), e = this.Pt(t);
|
|
6823
6841
|
e && e.then((e => {
|
|
6824
6842
|
this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
|
|
6825
6843
|
this.deferred.resolve(e);
|
|
6826
6844
|
})).catch((t => {
|
|
6827
|
-
this.
|
|
6845
|
+
this.Rt(t);
|
|
6828
6846
|
}))));
|
|
6829
6847
|
})).catch((t => {
|
|
6830
|
-
this.
|
|
6848
|
+
this.Rt(t);
|
|
6831
6849
|
}));
|
|
6832
6850
|
}));
|
|
6833
6851
|
}
|
|
6834
|
-
|
|
6852
|
+
Pt(t) {
|
|
6835
6853
|
try {
|
|
6836
6854
|
const e = this.updateFunction(t);
|
|
6837
6855
|
return !__PRIVATE_isNullOrUndefined(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
|
|
@@ -6841,7 +6859,7 @@ class __PRIVATE_TransactionRunner {
|
|
|
6841
6859
|
return this.deferred.reject(t), null;
|
|
6842
6860
|
}
|
|
6843
6861
|
}
|
|
6844
|
-
|
|
6862
|
+
Rt(t) {
|
|
6845
6863
|
this.ft > 0 && this.Vt(t) ? (this.ft -= 1, this.asyncQueue.enqueueAndForget((() => (this.Tt(),
|
|
6846
6864
|
Promise.resolve())))) : this.deferred.reject(t);
|
|
6847
6865
|
}
|
|
@@ -6862,29 +6880,29 @@ class __PRIVATE_TransactionRunner {
|
|
|
6862
6880
|
default:
|
|
6863
6881
|
return fail();
|
|
6864
6882
|
|
|
6865
|
-
case
|
|
6883
|
+
case P:
|
|
6866
6884
|
case R:
|
|
6867
|
-
case
|
|
6868
|
-
case
|
|
6869
|
-
case C:
|
|
6885
|
+
case I:
|
|
6886
|
+
case F:
|
|
6870
6887
|
case S:
|
|
6888
|
+
case N:
|
|
6871
6889
|
// Unauthenticated means something went wrong with our token and we need
|
|
6872
6890
|
// to retry with new credentials which will happen automatically.
|
|
6873
|
-
case
|
|
6891
|
+
case g:
|
|
6874
6892
|
return !1;
|
|
6875
6893
|
|
|
6876
|
-
case
|
|
6877
|
-
case I:
|
|
6894
|
+
case V:
|
|
6878
6895
|
case p:
|
|
6879
6896
|
case y:
|
|
6880
|
-
case
|
|
6897
|
+
case w:
|
|
6898
|
+
case v:
|
|
6881
6899
|
// Aborted might be retried in some scenarios, but that is dependent on
|
|
6882
6900
|
// the context and should handled individually by the calling code.
|
|
6883
6901
|
// See https://cloud.google.com/apis/design/errors.
|
|
6884
|
-
case
|
|
6885
|
-
case D:
|
|
6902
|
+
case D:
|
|
6886
6903
|
case b:
|
|
6887
|
-
case
|
|
6904
|
+
case C:
|
|
6905
|
+
case O:
|
|
6888
6906
|
return !0;
|
|
6889
6907
|
}
|
|
6890
6908
|
}(e);
|
|
@@ -6989,7 +7007,7 @@ class __PRIVATE_TransactionRunner {
|
|
|
6989
7007
|
* As long as the operation has not yet been run, calling cancel() provides a
|
|
6990
7008
|
* guarantee that the operation will not be run.
|
|
6991
7009
|
*/ cancel(t) {
|
|
6992
|
-
null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new FirestoreError(
|
|
7010
|
+
null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new FirestoreError(P, "Operation cancelled" + (t ? ": " + t : ""))));
|
|
6993
7011
|
}
|
|
6994
7012
|
handleDelayElapsed() {
|
|
6995
7013
|
this.asyncQueue.enqueueAndForget((() => null !== this.timerHandle ? (this.clearTimeout(),
|
|
@@ -7316,9 +7334,9 @@ class Transaction {
|
|
|
7316
7334
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
7317
7335
|
* rejected promise with the corresponding failure error is returned.
|
|
7318
7336
|
*/ function runTransaction(t, e, r) {
|
|
7319
|
-
const n = __PRIVATE_getDatastore(t = __PRIVATE_cast(t, Firestore)), i = Object.assign(Object.assign({},
|
|
7337
|
+
const n = __PRIVATE_getDatastore(t = __PRIVATE_cast(t, Firestore)), i = Object.assign(Object.assign({}, G), r);
|
|
7320
7338
|
!function __PRIVATE_validateTransactionOptions(t) {
|
|
7321
|
-
if (t.maxAttempts < 1) throw new FirestoreError(
|
|
7339
|
+
if (t.maxAttempts < 1) throw new FirestoreError(V, "Max attempts must be at least 1");
|
|
7322
7340
|
}(i);
|
|
7323
7341
|
const s = new __PRIVATE_Deferred;
|
|
7324
7342
|
return new __PRIVATE_TransactionRunner(function __PRIVATE_newAsyncQueue() {
|
|
@@ -7335,10 +7353,10 @@ class Transaction {
|
|
|
7335
7353
|
* @packageDocumentation
|
|
7336
7354
|
*/ !function __PRIVATE_registerFirestore() {
|
|
7337
7355
|
!function __PRIVATE_setSDKVersion(t) {
|
|
7338
|
-
|
|
7356
|
+
m = t;
|
|
7339
7357
|
}(`${i}_lite`), r(new s("firestore/lite", ((t, {instanceIdentifier: e, options: r}) => {
|
|
7340
7358
|
const n = t.getProvider("app").getImmediate(), i = new Firestore(new __PRIVATE_LiteAuthCredentialsProvider(t.getProvider("auth-internal")), new __PRIVATE_LiteAppCheckTokenProvider(t.getProvider("app-check-internal")), function __PRIVATE_databaseIdFromApp(t, e) {
|
|
7341
|
-
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new FirestoreError(
|
|
7359
|
+
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new FirestoreError(V, '"projectId" not provided in firebase.initializeApp.');
|
|
7342
7360
|
return new DatabaseId(t.options.projectId, e);
|
|
7343
7361
|
}
|
|
7344
7362
|
/**
|
|
@@ -7360,7 +7378,7 @@ class Transaction {
|
|
|
7360
7378
|
return r && i._setSettings(r), i;
|
|
7361
7379
|
}), "PUBLIC").setMultipleInstances(!0)),
|
|
7362
7380
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
7363
|
-
n("firestore-lite", "4.7.
|
|
7381
|
+
n("firestore-lite", "4.7.6-canary.144bc3709", "rn"), n("firestore-lite", "4.7.6-canary.144bc3709", "esm2017");
|
|
7364
7382
|
}();
|
|
7365
7383
|
|
|
7366
7384
|
export { AggregateField, AggregateQuerySnapshot, Bytes, CollectionReference, DocumentReference, DocumentSnapshot, FieldPath, FieldValue, Firestore, FirestoreError, GeoPoint, Query, QueryCompositeFilterConstraint, QueryConstraint, QueryDocumentSnapshot, QueryEndAtConstraint, QueryFieldFilterConstraint, QueryLimitConstraint, QueryOrderByConstraint, QuerySnapshot, QueryStartAtConstraint, Timestamp, Transaction, VectorValue, WriteBatch, addDoc, aggregateFieldEqual, aggregateQuerySnapshotEqual, and, arrayRemove, arrayUnion, average, collection, collectionGroup, connectFirestoreEmulator, count, deleteDoc, deleteField, doc, documentId, endAt, endBefore, getAggregate, getCount, getDoc, getDocs, getFirestore, increment, initializeFirestore, limit, limitToLast, or, orderBy, query, queryEqual, refEqual, runTransaction, serverTimestamp, setDoc, setLogLevel, snapshotEqual, startAfter, startAt, sum, terminate, updateDoc, vector, where, writeBatch };
|