@firebase/firestore 3.4.8-canary.69baecadd → 3.4.8-canary.6ceff4db0
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/lite/index.d.ts +1 -0
- package/dist/firestore/src/api/transaction.d.ts +2 -1
- package/dist/firestore/src/api/transaction_options.d.ts +17 -0
- package/dist/firestore/src/api.d.ts +1 -0
- package/dist/firestore/src/core/firestore_client.d.ts +2 -1
- package/dist/firestore/src/core/transaction_options.d.ts +25 -0
- package/dist/firestore/src/core/transaction_runner.d.ts +3 -2
- package/dist/firestore/src/lite-api/transaction.d.ts +2 -1
- package/dist/firestore/src/lite-api/transaction_options.d.ts +23 -0
- package/dist/index.d.ts +24 -1
- package/dist/index.esm2017.js +95 -71
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +105 -82
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +36 -9
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +36 -9
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +241 -217
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +25 -1
- package/dist/lite/firestore/lite/index.d.ts +1 -0
- package/dist/lite/firestore/src/api/transaction.d.ts +2 -1
- package/dist/lite/firestore/src/api/transaction_options.d.ts +17 -0
- package/dist/lite/firestore/src/api.d.ts +1 -0
- package/dist/lite/firestore/src/core/firestore_client.d.ts +2 -1
- package/dist/lite/firestore/src/core/transaction_options.d.ts +25 -0
- package/dist/lite/firestore/src/core/transaction_runner.d.ts +3 -2
- package/dist/lite/firestore/src/lite-api/transaction.d.ts +2 -1
- package/dist/lite/firestore/src/lite-api/transaction_options.d.ts +23 -0
- package/dist/lite/index.browser.esm2017.js +180 -157
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +112 -110
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.d.ts +24 -1
- package/dist/lite/index.node.cjs.js +34 -7
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +34 -7
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +204 -181
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +25 -1
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +13 -13
- package/dist/lite/packages/firestore/lite/index.d.ts +1 -0
- package/dist/lite/packages/firestore/src/api/transaction.d.ts +2 -1
- package/dist/lite/packages/firestore/src/api/transaction_options.d.ts +17 -0
- package/dist/lite/packages/firestore/src/api.d.ts +1 -0
- package/dist/lite/packages/firestore/src/core/firestore_client.d.ts +2 -1
- package/dist/lite/packages/firestore/src/core/transaction_options.d.ts +25 -0
- package/dist/lite/packages/firestore/src/core/transaction_runner.d.ts +3 -2
- package/dist/lite/packages/firestore/src/lite-api/transaction.d.ts +2 -1
- package/dist/lite/packages/firestore/src/lite-api/transaction_options.d.ts +23 -0
- package/dist/lite/private.d.ts +25 -1
- package/dist/packages/firestore/dist/index.esm2017.d.ts +30 -29
- package/dist/packages/firestore/lite/index.d.ts +1 -0
- package/dist/packages/firestore/src/api/transaction.d.ts +2 -1
- package/dist/packages/firestore/src/api/transaction_options.d.ts +17 -0
- package/dist/packages/firestore/src/api.d.ts +1 -0
- package/dist/packages/firestore/src/core/firestore_client.d.ts +2 -1
- package/dist/packages/firestore/src/core/transaction_options.d.ts +25 -0
- package/dist/packages/firestore/src/core/transaction_runner.d.ts +3 -2
- package/dist/packages/firestore/src/lite-api/transaction.d.ts +2 -1
- package/dist/packages/firestore/src/lite-api/transaction_options.d.ts +23 -0
- package/dist/private.d.ts +25 -1
- package/package.json +10 -10
|
@@ -63,7 +63,7 @@ l.MOCK_USER = new l("mock-user");
|
|
|
63
63
|
* See the License for the specific language governing permissions and
|
|
64
64
|
* limitations under the License.
|
|
65
65
|
*/
|
|
66
|
-
let f = "9.7.0-canary.
|
|
66
|
+
let f = "9.7.0-canary.6ceff4db0";
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* @license
|
|
@@ -218,7 +218,7 @@ e) {
|
|
|
218
218
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
219
219
|
* See the License for the specific language governing permissions and
|
|
220
220
|
* limitations under the License.
|
|
221
|
-
*/ const E = "ok", T = "cancelled",
|
|
221
|
+
*/ const E = "ok", T = "cancelled", A = "unknown", I = "invalid-argument", R = "deadline-exceeded", P = "not-found", V = "already-exists", D = "permission-denied", N = "unauthenticated", $ = "resource-exhausted", S = "failed-precondition", x = "aborted", F = "out-of-range", q = "unimplemented", O = "internal", C = "unavailable", L = "data-loss";
|
|
222
222
|
|
|
223
223
|
/** An error returned by a Firestore operation. */ class U extends FirebaseError {
|
|
224
224
|
/** @hideconstructor */
|
|
@@ -570,7 +570,7 @@ class J {
|
|
|
570
570
|
// for legacy reasons and should not be used frequently).
|
|
571
571
|
const e = [];
|
|
572
572
|
for (const n of t) {
|
|
573
|
-
if (n.indexOf("//") >= 0) throw new U(
|
|
573
|
+
if (n.indexOf("//") >= 0) throw new U(I, `Invalid segment (${n}). Paths must not contain // in them.`);
|
|
574
574
|
// Strip leading and traling slashed.
|
|
575
575
|
e.push(...n.split("/").filter((t => t.length > 0)));
|
|
576
576
|
}
|
|
@@ -626,20 +626,20 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
|
626
626
|
const e = [];
|
|
627
627
|
let n = "", r = 0;
|
|
628
628
|
const s = () => {
|
|
629
|
-
if (0 === n.length) throw new U(
|
|
629
|
+
if (0 === n.length) throw new U(I, `Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);
|
|
630
630
|
e.push(n), n = "";
|
|
631
631
|
};
|
|
632
632
|
let i = !1;
|
|
633
633
|
for (;r < t.length; ) {
|
|
634
634
|
const e = t[r];
|
|
635
635
|
if ("\\" === e) {
|
|
636
|
-
if (r + 1 === t.length) throw new U(
|
|
636
|
+
if (r + 1 === t.length) throw new U(I, "Path has trailing escape character: " + t);
|
|
637
637
|
const e = t[r + 1];
|
|
638
|
-
if ("\\" !== e && "." !== e && "`" !== e) throw new U(
|
|
638
|
+
if ("\\" !== e && "." !== e && "`" !== e) throw new U(I, "Path has invalid escape sequence: " + t);
|
|
639
639
|
n += e, r += 2;
|
|
640
640
|
} else "`" === e ? (i = !i, r++) : "." !== e || i ? (n += e, r++) : (s(), r++);
|
|
641
641
|
}
|
|
642
|
-
if (s(), i) throw new U(
|
|
642
|
+
if (s(), i) throw new U(I, "Unterminated ` in path: " + t);
|
|
643
643
|
return new tt(e);
|
|
644
644
|
}
|
|
645
645
|
static emptyPath() {
|
|
@@ -728,7 +728,7 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
|
728
728
|
* See the License for the specific language governing permissions and
|
|
729
729
|
* limitations under the License.
|
|
730
730
|
*/ function nt(t, e, n) {
|
|
731
|
-
if (!n) throw new U(
|
|
731
|
+
if (!n) throw new U(I, `Function ${t}() cannot be called with an empty ${e}.`);
|
|
732
732
|
}
|
|
733
733
|
|
|
734
734
|
/**
|
|
@@ -740,14 +740,14 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
|
740
740
|
* an even numbers of segments).
|
|
741
741
|
*/
|
|
742
742
|
function rt(t) {
|
|
743
|
-
if (!et.isDocumentKey(t)) throw new U(
|
|
743
|
+
if (!et.isDocumentKey(t)) throw new U(I, `Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`);
|
|
744
744
|
}
|
|
745
745
|
|
|
746
746
|
/**
|
|
747
747
|
* Validates that `path` refers to a collection (indicated by the fact it
|
|
748
748
|
* contains an odd numbers of segments).
|
|
749
749
|
*/ function st(t) {
|
|
750
|
-
if (et.isDocumentKey(t)) throw new U(
|
|
750
|
+
if (et.isDocumentKey(t)) throw new U(I, `Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`);
|
|
751
751
|
}
|
|
752
752
|
|
|
753
753
|
/**
|
|
@@ -791,17 +791,17 @@ e) {
|
|
|
791
791
|
// Unwrap Compat types
|
|
792
792
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
793
793
|
t = t._delegate), !(t instanceof e)) {
|
|
794
|
-
if (e.name === t.constructor.name) throw new U(
|
|
794
|
+
if (e.name === t.constructor.name) throw new U(I, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
|
|
795
795
|
{
|
|
796
796
|
const n = it(t);
|
|
797
|
-
throw new U(
|
|
797
|
+
throw new U(I, `Expected type '${e.name}', but it was: ${n}`);
|
|
798
798
|
}
|
|
799
799
|
}
|
|
800
800
|
return t;
|
|
801
801
|
}
|
|
802
802
|
|
|
803
803
|
function ut(t, e) {
|
|
804
|
-
if (e <= 0) throw new U(
|
|
804
|
+
if (e <= 0) throw new U(I, `Function ${t}() requires a positive number, but it was: ${e}.`);
|
|
805
805
|
}
|
|
806
806
|
|
|
807
807
|
/**
|
|
@@ -899,7 +899,7 @@ var lt, ft;
|
|
|
899
899
|
* Code.UNKNOWN.
|
|
900
900
|
*/
|
|
901
901
|
function dt(t) {
|
|
902
|
-
if (void 0 === t) return p("RPC_ERROR", "HTTP error has no status"),
|
|
902
|
+
if (void 0 === t) return p("RPC_ERROR", "HTTP error has no status"), A;
|
|
903
903
|
// The canonical error codes for Google APIs [1] specify mapping onto HTTP
|
|
904
904
|
// status codes but the mapping is not bijective. In each case of ambiguity
|
|
905
905
|
// this function chooses a primary error.
|
|
@@ -932,13 +932,13 @@ function dt(t) {
|
|
|
932
932
|
|
|
933
933
|
case 409:
|
|
934
934
|
// Conflict
|
|
935
|
-
return
|
|
935
|
+
return x;
|
|
936
936
|
|
|
937
937
|
// Other possibilities:
|
|
938
938
|
// return Code.ALREADY_EXISTS;
|
|
939
939
|
case 416:
|
|
940
940
|
// Range Not Satisfiable
|
|
941
|
-
return
|
|
941
|
+
return F;
|
|
942
942
|
|
|
943
943
|
case 429:
|
|
944
944
|
// Too Many Requests
|
|
@@ -950,7 +950,7 @@ function dt(t) {
|
|
|
950
950
|
|
|
951
951
|
case 500:
|
|
952
952
|
// Internal Server Error
|
|
953
|
-
return
|
|
953
|
+
return A;
|
|
954
954
|
|
|
955
955
|
// Other possibilities:
|
|
956
956
|
// return Code.INTERNAL;
|
|
@@ -968,7 +968,7 @@ function dt(t) {
|
|
|
968
968
|
return R;
|
|
969
969
|
|
|
970
970
|
default:
|
|
971
|
-
return t >= 200 && t < 300 ? E : t >= 400 && t < 500 ? S : t >= 500 && t < 600 ? O :
|
|
971
|
+
return t >= 200 && t < 300 ? E : t >= 400 && t < 500 ? S : t >= 500 && t < 600 ? O : A;
|
|
972
972
|
}
|
|
973
973
|
}
|
|
974
974
|
|
|
@@ -1048,16 +1048,16 @@ class {
|
|
|
1048
1048
|
* @param fetchImpl - `fetch` or a Polyfill that implements the fetch API.
|
|
1049
1049
|
*/
|
|
1050
1050
|
constructor(t, e) {
|
|
1051
|
-
super(t), this.
|
|
1051
|
+
super(t), this.A = e;
|
|
1052
1052
|
}
|
|
1053
|
-
|
|
1053
|
+
I(t, e) {
|
|
1054
1054
|
throw new Error("Not supported by FetchConnection");
|
|
1055
1055
|
}
|
|
1056
1056
|
async v(t, e, n, r) {
|
|
1057
1057
|
const s = JSON.stringify(r);
|
|
1058
1058
|
let i;
|
|
1059
1059
|
try {
|
|
1060
|
-
i = await this.
|
|
1060
|
+
i = await this.A(e, {
|
|
1061
1061
|
method: "POST",
|
|
1062
1062
|
headers: n,
|
|
1063
1063
|
body: s
|
|
@@ -1211,11 +1211,11 @@ class gt {
|
|
|
1211
1211
|
* The fractions of a second at nanosecond resolution.*
|
|
1212
1212
|
*/
|
|
1213
1213
|
e) {
|
|
1214
|
-
if (this.seconds = t, this.nanoseconds = e, e < 0) throw new U(
|
|
1215
|
-
if (e >= 1e9) throw new U(
|
|
1216
|
-
if (t < -62135596800) throw new U(
|
|
1214
|
+
if (this.seconds = t, this.nanoseconds = e, e < 0) throw new U(I, "Timestamp nanoseconds out of range: " + e);
|
|
1215
|
+
if (e >= 1e9) throw new U(I, "Timestamp nanoseconds out of range: " + e);
|
|
1216
|
+
if (t < -62135596800) throw new U(I, "Timestamp seconds out of range: " + t);
|
|
1217
1217
|
// This will break in the year 10,000.
|
|
1218
|
-
if (t >= 253402300800) throw new U(
|
|
1218
|
+
if (t >= 253402300800) throw new U(I, "Timestamp seconds out of range: " + t);
|
|
1219
1219
|
}
|
|
1220
1220
|
/**
|
|
1221
1221
|
* Creates a new timestamp with the current date, with millisecond precision.
|
|
@@ -1465,13 +1465,13 @@ class Tt {
|
|
|
1465
1465
|
* before being sent as a proto.
|
|
1466
1466
|
* @internal
|
|
1467
1467
|
*/
|
|
1468
|
-
class
|
|
1468
|
+
class At {
|
|
1469
1469
|
constructor(t) {
|
|
1470
1470
|
this.binaryString = t;
|
|
1471
1471
|
}
|
|
1472
1472
|
static fromBase64String(t) {
|
|
1473
1473
|
const e = atob(t);
|
|
1474
|
-
return new
|
|
1474
|
+
return new At(e);
|
|
1475
1475
|
}
|
|
1476
1476
|
static fromUint8Array(t) {
|
|
1477
1477
|
// TODO(indexing); Remove the copy of the byte string here as this method
|
|
@@ -1488,7 +1488,7 @@ class It {
|
|
|
1488
1488
|
/**
|
|
1489
1489
|
* Helper function to convert a binary string to an Uint8Array.
|
|
1490
1490
|
*/ (t);
|
|
1491
|
-
return new
|
|
1491
|
+
return new At(e);
|
|
1492
1492
|
}
|
|
1493
1493
|
[Symbol.iterator]() {
|
|
1494
1494
|
let t = 0;
|
|
@@ -1543,9 +1543,9 @@ class It {
|
|
|
1543
1543
|
}
|
|
1544
1544
|
}
|
|
1545
1545
|
|
|
1546
|
-
|
|
1546
|
+
At.EMPTY_BYTE_STRING = new At("");
|
|
1547
1547
|
|
|
1548
|
-
const
|
|
1548
|
+
const It = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
1549
1549
|
|
|
1550
1550
|
/**
|
|
1551
1551
|
* Converts the possible Proto values for a timestamp value into a "seconds and
|
|
@@ -1559,7 +1559,7 @@ const At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1559
1559
|
// (millis), so we do some custom parsing here.
|
|
1560
1560
|
// Parse the nanos right out of the string.
|
|
1561
1561
|
let e = 0;
|
|
1562
|
-
const n =
|
|
1562
|
+
const n = It.exec(t);
|
|
1563
1563
|
if (b(!!n), n[1]) {
|
|
1564
1564
|
// Pad the fraction out to 9 digits (nanos).
|
|
1565
1565
|
let t = n[1];
|
|
@@ -1587,7 +1587,7 @@ const At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1587
1587
|
}
|
|
1588
1588
|
|
|
1589
1589
|
/** Converts the possible Proto types for Blobs into a ByteString. */ function Vt(t) {
|
|
1590
|
-
return "string" == typeof t ?
|
|
1590
|
+
return "string" == typeof t ? At.fromBase64String(t) : At.fromUint8Array(t);
|
|
1591
1591
|
}
|
|
1592
1592
|
|
|
1593
1593
|
/**
|
|
@@ -1669,7 +1669,7 @@ const At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1669
1669
|
};
|
|
1670
1670
|
|
|
1671
1671
|
/** Extracts the backend's type order for the provided value. */
|
|
1672
|
-
function
|
|
1672
|
+
function xt(t) {
|
|
1673
1673
|
return "nullValue" in t ? 0 /* NullValue */ : "booleanValue" in t ? 1 /* BooleanValue */ : "integerValue" in t || "doubleValue" in t ? 2 /* NumberValue */ : "timestampValue" in t ? 3 /* TimestampValue */ : "stringValue" in t ? 5 /* StringValue */ : "bytesValue" in t ? 6 /* BlobValue */ : "referenceValue" in t ? 7 /* RefValue */ : "geoPointValue" in t ? 8 /* GeoPointValue */ : "arrayValue" in t ? 9 /* ArrayValue */ : "mapValue" in t ? Dt(t) ? 4 /* ServerTimestampValue */ :
|
|
1674
1674
|
/** Returns true if the Value represents the canonical {@link #MAX_VALUE} . */
|
|
1675
1675
|
function(t) {
|
|
@@ -1697,10 +1697,10 @@ function Ft(t) {
|
|
|
1697
1697
|
*/ (t) ? 9007199254740991 /* MaxValue */ : 10 /* ObjectValue */ : g();
|
|
1698
1698
|
}
|
|
1699
1699
|
|
|
1700
|
-
/** Tests `left` and `right` for equality based on the backend semantics. */ function
|
|
1700
|
+
/** Tests `left` and `right` for equality based on the backend semantics. */ function Ft(t, e) {
|
|
1701
1701
|
if (t === e) return !0;
|
|
1702
|
-
const n =
|
|
1703
|
-
if (n !==
|
|
1702
|
+
const n = xt(t);
|
|
1703
|
+
if (n !== xt(e)) return !1;
|
|
1704
1704
|
switch (n) {
|
|
1705
1705
|
case 0 /* NullValue */ :
|
|
1706
1706
|
case 9007199254740991 /* MaxValue */ :
|
|
@@ -1748,13 +1748,13 @@ function Ft(t) {
|
|
|
1748
1748
|
}(t, e);
|
|
1749
1749
|
|
|
1750
1750
|
case 9 /* ArrayValue */ :
|
|
1751
|
-
return _t(t.arrayValue.values || [], e.arrayValue.values || [],
|
|
1751
|
+
return _t(t.arrayValue.values || [], e.arrayValue.values || [], Ft);
|
|
1752
1752
|
|
|
1753
1753
|
case 10 /* ObjectValue */ :
|
|
1754
1754
|
return function(t, e) {
|
|
1755
1755
|
const n = t.mapValue.fields || {}, r = e.mapValue.fields || {};
|
|
1756
1756
|
if (vt(n) !== vt(r)) return !1;
|
|
1757
|
-
for (const t in n) if (n.hasOwnProperty(t) && (void 0 === r[t] || !
|
|
1757
|
+
for (const t in n) if (n.hasOwnProperty(t) && (void 0 === r[t] || !Ft(n[t], r[t]))) return !1;
|
|
1758
1758
|
return !0;
|
|
1759
1759
|
}
|
|
1760
1760
|
/** Returns true if the ArrayValue contains the specified element. */ (t, e);
|
|
@@ -1765,12 +1765,12 @@ function Ft(t) {
|
|
|
1765
1765
|
}
|
|
1766
1766
|
|
|
1767
1767
|
function qt(t, e) {
|
|
1768
|
-
return void 0 !== (t.values || []).find((t =>
|
|
1768
|
+
return void 0 !== (t.values || []).find((t => Ft(t, e)));
|
|
1769
1769
|
}
|
|
1770
1770
|
|
|
1771
1771
|
function Ot(t, e) {
|
|
1772
1772
|
if (t === e) return 0;
|
|
1773
|
-
const n =
|
|
1773
|
+
const n = xt(t), r = xt(e);
|
|
1774
1774
|
if (n !== r) return yt(n, r);
|
|
1775
1775
|
switch (n) {
|
|
1776
1776
|
case 0 /* NullValue */ :
|
|
@@ -1969,7 +1969,7 @@ class zt {
|
|
|
1969
1969
|
Mt(e) && e.mapValue.fields && delete e.mapValue.fields[t.lastSegment()];
|
|
1970
1970
|
}
|
|
1971
1971
|
isEqual(t) {
|
|
1972
|
-
return
|
|
1972
|
+
return Ft(this.value, t.value);
|
|
1973
1973
|
}
|
|
1974
1974
|
/**
|
|
1975
1975
|
* Returns the map that contains the leaf element of `path`. If the parent
|
|
@@ -2166,7 +2166,7 @@ class Yt extends class {} {
|
|
|
2166
2166
|
matches(t) {
|
|
2167
2167
|
const e = t.data.field(this.field);
|
|
2168
2168
|
// Types do not have to match in NOT_EQUAL filters.
|
|
2169
|
-
return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.D(Ot(e, this.value)) : null !== e &&
|
|
2169
|
+
return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.D(Ot(e, this.value)) : null !== e && xt(this.value) === xt(e) && this.D(Ot(e, this.value));
|
|
2170
2170
|
// Only compare types with matching backend order (such as double and int).
|
|
2171
2171
|
}
|
|
2172
2172
|
D(t) {
|
|
@@ -2311,7 +2311,7 @@ function oe(t, e) {
|
|
|
2311
2311
|
if (null === e) return !1;
|
|
2312
2312
|
if (t.inclusive !== e.inclusive || t.position.length !== e.position.length) return !1;
|
|
2313
2313
|
for (let n = 0; n < t.position.length; n++) {
|
|
2314
|
-
if (!
|
|
2314
|
+
if (!Ft(t.position[n], e.position[n])) return !1;
|
|
2315
2315
|
}
|
|
2316
2316
|
return !0;
|
|
2317
2317
|
}
|
|
@@ -2425,7 +2425,7 @@ function de(t, e) {
|
|
|
2425
2425
|
for (let n = 0; n < t.orderBy.length; n++) if (!ie(t.orderBy[n], e.orderBy[n])) return !1;
|
|
2426
2426
|
if (t.filters.length !== e.filters.length) return !1;
|
|
2427
2427
|
for (let s = 0; s < t.filters.length; s++) if (n = t.filters[s], r = e.filters[s],
|
|
2428
|
-
n.op !== r.op || !n.field.isEqual(r.field) || !
|
|
2428
|
+
n.op !== r.op || !n.field.isEqual(r.field) || !Ft(n.value, r.value)) return !1;
|
|
2429
2429
|
var n, r;
|
|
2430
2430
|
return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!oe(t.startAt, e.startAt) && oe(t.endAt, e.endAt);
|
|
2431
2431
|
}(fe(t), fe(e)) && t.limitType === e.limitType;
|
|
@@ -2648,14 +2648,14 @@ function we(t, e) {
|
|
|
2648
2648
|
* is deleted.
|
|
2649
2649
|
* * When a field is not in the mask but is in the values, the values map is
|
|
2650
2650
|
* ignored.
|
|
2651
|
-
*/ class
|
|
2651
|
+
*/ class Ae extends Ee {
|
|
2652
2652
|
constructor(t, e, n, r, s = []) {
|
|
2653
2653
|
super(), this.key = t, this.data = e, this.fieldMask = n, this.precondition = r,
|
|
2654
2654
|
this.fieldTransforms = s, this.type = 1 /* Patch */;
|
|
2655
2655
|
}
|
|
2656
2656
|
}
|
|
2657
2657
|
|
|
2658
|
-
/** A mutation that deletes the document at the given key. */ class
|
|
2658
|
+
/** A mutation that deletes the document at the given key. */ class Ie extends Ee {
|
|
2659
2659
|
constructor(t, e) {
|
|
2660
2660
|
super(), this.key = t, this.precondition = e, this.type = 2 /* Delete */ , this.fieldTransforms = [];
|
|
2661
2661
|
}
|
|
@@ -2764,21 +2764,21 @@ function Se(t, e) {
|
|
|
2764
2764
|
return Ne(t, e.toTimestamp());
|
|
2765
2765
|
}
|
|
2766
2766
|
|
|
2767
|
-
function
|
|
2767
|
+
function xe(t) {
|
|
2768
2768
|
return b(!!t), bt.fromTimestamp(function(t) {
|
|
2769
2769
|
const e = Rt(t);
|
|
2770
2770
|
return new gt(e.seconds, e.nanos);
|
|
2771
2771
|
}(t));
|
|
2772
2772
|
}
|
|
2773
2773
|
|
|
2774
|
-
function
|
|
2774
|
+
function Fe(t, e) {
|
|
2775
2775
|
return function(t) {
|
|
2776
2776
|
return new X([ "projects", t.projectId, "databases", t.database ]);
|
|
2777
2777
|
}(t).child("documents").child(e).canonicalString();
|
|
2778
2778
|
}
|
|
2779
2779
|
|
|
2780
2780
|
function qe(t, e) {
|
|
2781
|
-
return
|
|
2781
|
+
return Fe(t.databaseId, e.path);
|
|
2782
2782
|
}
|
|
2783
2783
|
|
|
2784
2784
|
function Oe(t, e) {
|
|
@@ -2786,14 +2786,14 @@ function Oe(t, e) {
|
|
|
2786
2786
|
const e = X.fromString(t);
|
|
2787
2787
|
return b(We(e)), e;
|
|
2788
2788
|
}(e);
|
|
2789
|
-
if (n.get(1) !== t.databaseId.projectId) throw new U(
|
|
2790
|
-
if (n.get(3) !== t.databaseId.database) throw new U(
|
|
2789
|
+
if (n.get(1) !== t.databaseId.projectId) throw new U(I, "Tried to deserialize key from different project: " + n.get(1) + " vs " + t.databaseId.projectId);
|
|
2790
|
+
if (n.get(3) !== t.databaseId.database) throw new U(I, "Tried to deserialize key from different database: " + n.get(3) + " vs " + t.databaseId.database);
|
|
2791
2791
|
return new et((b((r = n).length > 4 && "documents" === r.get(4)), r.popFirst(5)));
|
|
2792
2792
|
var r;
|
|
2793
2793
|
/** Creates a Document proto from key and fields (but no create/update time) */}
|
|
2794
2794
|
|
|
2795
2795
|
function Ce(t, e) {
|
|
2796
|
-
return
|
|
2796
|
+
return Fe(t.databaseId, e);
|
|
2797
2797
|
}
|
|
2798
2798
|
|
|
2799
2799
|
function Le(t) {
|
|
@@ -2810,7 +2810,7 @@ function Ue(t, e, n) {
|
|
|
2810
2810
|
function ke(t, e) {
|
|
2811
2811
|
return "found" in e ? function(t, e) {
|
|
2812
2812
|
b(!!e.found), e.found.name, e.found.updateTime;
|
|
2813
|
-
const n = Oe(t, e.found.name), r =
|
|
2813
|
+
const n = Oe(t, e.found.name), r = xe(e.found.updateTime), s = new zt({
|
|
2814
2814
|
mapValue: {
|
|
2815
2815
|
fields: e.found.fields
|
|
2816
2816
|
}
|
|
@@ -2818,7 +2818,7 @@ function ke(t, e) {
|
|
|
2818
2818
|
return Gt.newFoundDocument(n, r, s);
|
|
2819
2819
|
}(t, e) : "missing" in e ? function(t, e) {
|
|
2820
2820
|
b(!!e.missing), b(!!e.readTime);
|
|
2821
|
-
const n = Oe(t, e.missing), r =
|
|
2821
|
+
const n = Oe(t, e.missing), r = xe(e.readTime);
|
|
2822
2822
|
return Gt.newNoDocument(n, r);
|
|
2823
2823
|
}(t, e) : g();
|
|
2824
2824
|
}
|
|
@@ -2827,9 +2827,9 @@ function je(t, e) {
|
|
|
2827
2827
|
let n;
|
|
2828
2828
|
if (e instanceof Te) n = {
|
|
2829
2829
|
update: Ue(t, e.key, e.value)
|
|
2830
|
-
}; else if (e instanceof Ae) n = {
|
|
2831
|
-
delete: qe(t, e.key)
|
|
2832
2830
|
}; else if (e instanceof Ie) n = {
|
|
2831
|
+
delete: qe(t, e.key)
|
|
2832
|
+
}; else if (e instanceof Ae) n = {
|
|
2833
2833
|
update: Ue(t, e.key, e.data),
|
|
2834
2834
|
updateMask: Qe(e.fieldMask)
|
|
2835
2835
|
}; else {
|
|
@@ -3141,13 +3141,13 @@ class Ke extends class {} {
|
|
|
3141
3141
|
/** Invokes the provided RPC with auth and AppCheck tokens. */ m(t, e, n) {
|
|
3142
3142
|
return this.X(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.K.m(t, e, n, r, s))).catch((t => {
|
|
3143
3143
|
throw "FirebaseError" === t.name ? (t.code === N && (this.authCredentials.invalidateToken(),
|
|
3144
|
-
this.appCheckCredentials.invalidateToken()), t) : new U(
|
|
3144
|
+
this.appCheckCredentials.invalidateToken()), t) : new U(A, t.toString());
|
|
3145
3145
|
}));
|
|
3146
3146
|
}
|
|
3147
3147
|
/** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ T(t, e, n) {
|
|
3148
3148
|
return this.X(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.K.T(t, e, n, r, s))).catch((t => {
|
|
3149
3149
|
throw "FirebaseError" === t.name ? (t.code === N && (this.authCredentials.invalidateToken(),
|
|
3150
|
-
this.appCheckCredentials.invalidateToken()), t) : new U(
|
|
3150
|
+
this.appCheckCredentials.invalidateToken()), t) : new U(A, t.toString());
|
|
3151
3151
|
}));
|
|
3152
3152
|
}
|
|
3153
3153
|
terminate() {
|
|
@@ -3184,7 +3184,7 @@ async function Ze(t, e) {
|
|
|
3184
3184
|
return (await n.T("RunQuery", r.parent, {
|
|
3185
3185
|
structuredQuery: r.structuredQuery
|
|
3186
3186
|
})).filter((t => !!t.document)).map((t => function(t, e, n) {
|
|
3187
|
-
const r = Oe(t, e.name), s =
|
|
3187
|
+
const r = Oe(t, e.name), s = xe(e.updateTime), i = new zt({
|
|
3188
3188
|
mapValue: {
|
|
3189
3189
|
fields: e.fields
|
|
3190
3190
|
}
|
|
@@ -3263,17 +3263,17 @@ class nn {
|
|
|
3263
3263
|
constructor(t) {
|
|
3264
3264
|
var e;
|
|
3265
3265
|
if (void 0 === t.host) {
|
|
3266
|
-
if (void 0 !== t.ssl) throw new U(
|
|
3266
|
+
if (void 0 !== t.ssl) throw new U(I, "Can't provide ssl option if host option is not set");
|
|
3267
3267
|
this.host = "firestore.googleapis.com", this.ssl = true;
|
|
3268
3268
|
} else this.host = t.host, this.ssl = null === (e = t.ssl) || void 0 === e || e;
|
|
3269
3269
|
if (this.credentials = t.credentials, this.ignoreUndefinedProperties = !!t.ignoreUndefinedProperties,
|
|
3270
3270
|
void 0 === t.cacheSizeBytes) this.cacheSizeBytes = 41943040; else {
|
|
3271
|
-
if (-1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new U(
|
|
3271
|
+
if (-1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new U(I, "cacheSizeBytes must be at least 1048576");
|
|
3272
3272
|
this.cacheSizeBytes = t.cacheSizeBytes;
|
|
3273
3273
|
}
|
|
3274
3274
|
this.experimentalForceLongPolling = !!t.experimentalForceLongPolling, this.experimentalAutoDetectLongPolling = !!t.experimentalAutoDetectLongPolling,
|
|
3275
3275
|
this.useFetchStreams = !!t.useFetchStreams, function(t, e, n, r) {
|
|
3276
|
-
if (!0 === e && !0 === r) throw new U(
|
|
3276
|
+
if (!0 === e && !0 === r) throw new U(I, `${t} and ${n} cannot be used together.`);
|
|
3277
3277
|
}("experimentalForceLongPolling", t.experimentalForceLongPolling, "experimentalAutoDetectLongPolling", t.experimentalAutoDetectLongPolling);
|
|
3278
3278
|
}
|
|
3279
3279
|
isEqual(t) {
|
|
@@ -3311,7 +3311,7 @@ class nn {
|
|
|
3311
3311
|
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new nn({}),
|
|
3312
3312
|
this._settingsFrozen = !1, t instanceof K ? this._databaseId = t : (this._app = t,
|
|
3313
3313
|
this._databaseId = function(t) {
|
|
3314
|
-
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new U(
|
|
3314
|
+
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new U(I, '"projectId" not provided in firebase.initializeApp.');
|
|
3315
3315
|
return new K(t.options.projectId);
|
|
3316
3316
|
}
|
|
3317
3317
|
/**
|
|
@@ -3354,7 +3354,7 @@ class nn {
|
|
|
3354
3354
|
return t.client;
|
|
3355
3355
|
|
|
3356
3356
|
default:
|
|
3357
|
-
throw new U(
|
|
3357
|
+
throw new U(I, "makeAuthCredentialsProvider failed due to invalid credential type");
|
|
3358
3358
|
}
|
|
3359
3359
|
}(t.credentials));
|
|
3360
3360
|
}
|
|
@@ -3434,7 +3434,7 @@ function sn(t, e) {
|
|
|
3434
3434
|
// invalid field "uid" and missing field "sub" / "user_id".)
|
|
3435
3435
|
e = createMockUserToken(r.mockUserToken, null === (s = t._app) || void 0 === s ? void 0 : s.options.projectId);
|
|
3436
3436
|
const i = r.mockUserToken.sub || r.mockUserToken.user_id;
|
|
3437
|
-
if (!i) throw new U(
|
|
3437
|
+
if (!i) throw new U(I, "mockUserToken must contain 'sub' or 'user_id' field!");
|
|
3438
3438
|
n = new l(i);
|
|
3439
3439
|
}
|
|
3440
3440
|
t._authCredentials = new B(new j(e, n));
|
|
@@ -3594,7 +3594,7 @@ function fn(t, e, ...n) {
|
|
|
3594
3594
|
return st(r), new ln(t, /* converter= */ null, r);
|
|
3595
3595
|
}
|
|
3596
3596
|
{
|
|
3597
|
-
if (!(t instanceof an || t instanceof ln)) throw new U(
|
|
3597
|
+
if (!(t instanceof an || t instanceof ln)) throw new U(I, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
3598
3598
|
const r = t._path.child(X.fromString(e, ...n));
|
|
3599
3599
|
return st(r), new ln(t.firestore,
|
|
3600
3600
|
/* converter= */ null, r);
|
|
@@ -3614,7 +3614,7 @@ function fn(t, e, ...n) {
|
|
|
3614
3614
|
* will be included. Cannot contain a slash.
|
|
3615
3615
|
* @returns The created `Query`.
|
|
3616
3616
|
*/ function dn(t, e) {
|
|
3617
|
-
if (t = ot(t, rn), nt("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new U(
|
|
3617
|
+
if (t = ot(t, rn), nt("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new U(I, `Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
|
|
3618
3618
|
return new hn(t,
|
|
3619
3619
|
/* converter= */ null,
|
|
3620
3620
|
/**
|
|
@@ -3636,7 +3636,7 @@ function wn(t, e, ...n) {
|
|
|
3636
3636
|
/* converter= */ null, new et(r));
|
|
3637
3637
|
}
|
|
3638
3638
|
{
|
|
3639
|
-
if (!(t instanceof an || t instanceof ln)) throw new U(
|
|
3639
|
+
if (!(t instanceof an || t instanceof ln)) throw new U(I, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
3640
3640
|
const r = t._path.child(X.fromString(e, ...n));
|
|
3641
3641
|
return rt(r), new an(t.firestore, t instanceof ln ? t.converter : null, new et(r));
|
|
3642
3642
|
}
|
|
@@ -3696,7 +3696,7 @@ function wn(t, e, ...n) {
|
|
|
3696
3696
|
* @param fieldNames - A list of field names.
|
|
3697
3697
|
*/
|
|
3698
3698
|
constructor(...t) {
|
|
3699
|
-
for (let e = 0; e < t.length; ++e) if (0 === t[e].length) throw new U(
|
|
3699
|
+
for (let e = 0; e < t.length; ++e) if (0 === t[e].length) throw new U(I, "Invalid field name at argument $(i + 1). Field names must not be empty.");
|
|
3700
3700
|
this._internalPath = new tt(t);
|
|
3701
3701
|
}
|
|
3702
3702
|
/**
|
|
@@ -3746,9 +3746,9 @@ function wn(t, e, ...n) {
|
|
|
3746
3746
|
* @param base64 - The Base64 string used to create the `Bytes` object.
|
|
3747
3747
|
*/ static fromBase64String(t) {
|
|
3748
3748
|
try {
|
|
3749
|
-
return new gn(
|
|
3749
|
+
return new gn(At.fromBase64String(t));
|
|
3750
3750
|
} catch (t) {
|
|
3751
|
-
throw new U(
|
|
3751
|
+
throw new U(I, "Failed to construct data from Base64 string: " + t);
|
|
3752
3752
|
}
|
|
3753
3753
|
}
|
|
3754
3754
|
/**
|
|
@@ -3756,7 +3756,7 @@ function wn(t, e, ...n) {
|
|
|
3756
3756
|
*
|
|
3757
3757
|
* @param array - The Uint8Array used to create the `Bytes` object.
|
|
3758
3758
|
*/ static fromUint8Array(t) {
|
|
3759
|
-
return new gn(
|
|
3759
|
+
return new gn(At.fromUint8Array(t));
|
|
3760
3760
|
}
|
|
3761
3761
|
/**
|
|
3762
3762
|
* Returns the underlying bytes as a Base64-encoded string.
|
|
@@ -3848,8 +3848,8 @@ function wn(t, e, ...n) {
|
|
|
3848
3848
|
* @param longitude - The longitude as number between -180 and 180.
|
|
3849
3849
|
*/
|
|
3850
3850
|
constructor(t, e) {
|
|
3851
|
-
if (!isFinite(t) || t < -90 || t > 90) throw new U(
|
|
3852
|
-
if (!isFinite(e) || e < -180 || e > 180) throw new U(
|
|
3851
|
+
if (!isFinite(t) || t < -90 || t > 90) throw new U(I, "Latitude must be a number between -90 and 90, but was: " + t);
|
|
3852
|
+
if (!isFinite(e) || e < -180 || e > 180) throw new U(I, "Longitude must be a number between -180 and 180, but was: " + e);
|
|
3853
3853
|
this._lat = t, this._long = e;
|
|
3854
3854
|
}
|
|
3855
3855
|
/**
|
|
@@ -3906,22 +3906,22 @@ function wn(t, e, ...n) {
|
|
|
3906
3906
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
3907
3907
|
}
|
|
3908
3908
|
toMutation(t, e) {
|
|
3909
|
-
return null !== this.fieldMask ? new
|
|
3909
|
+
return null !== this.fieldMask ? new Ae(t, this.data, this.fieldMask, e, this.fieldTransforms) : new Te(t, this.data, e, this.fieldTransforms);
|
|
3910
3910
|
}
|
|
3911
3911
|
}
|
|
3912
3912
|
|
|
3913
|
-
/** The result of parsing "update" data (i.e. for an updateData call). */ class
|
|
3913
|
+
/** The result of parsing "update" data (i.e. for an updateData call). */ class An {
|
|
3914
3914
|
constructor(t,
|
|
3915
3915
|
// The fieldMask does not include document transforms.
|
|
3916
3916
|
e, n) {
|
|
3917
3917
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
3918
3918
|
}
|
|
3919
3919
|
toMutation(t, e) {
|
|
3920
|
-
return new
|
|
3920
|
+
return new Ae(t, this.data, this.fieldMask, e, this.fieldTransforms);
|
|
3921
3921
|
}
|
|
3922
3922
|
}
|
|
3923
3923
|
|
|
3924
|
-
function
|
|
3924
|
+
function In(t) {
|
|
3925
3925
|
switch (t) {
|
|
3926
3926
|
case 0 /* Set */ :
|
|
3927
3927
|
// fall through
|
|
@@ -4010,7 +4010,7 @@ function An(t) {
|
|
|
4010
4010
|
}
|
|
4011
4011
|
st(t) {
|
|
4012
4012
|
if (0 === t.length) throw this.ut("Document fields must not be empty");
|
|
4013
|
-
if (
|
|
4013
|
+
if (In(this.tt) && En.test(t)) throw this.ut('Document fields cannot begin and end with "__"');
|
|
4014
4014
|
}
|
|
4015
4015
|
}
|
|
4016
4016
|
|
|
@@ -4047,7 +4047,7 @@ function Vn(t) {
|
|
|
4047
4047
|
const t = [];
|
|
4048
4048
|
for (const r of i.mergeFields) {
|
|
4049
4049
|
const s = Bn(e, r, n);
|
|
4050
|
-
if (!o.contains(s)) throw new U(
|
|
4050
|
+
if (!o.contains(s)) throw new U(I, `Field '${s}' is specified in your field mask but missing from your input data.`);
|
|
4051
4051
|
Wn(t, s) || t.push(s);
|
|
4052
4052
|
}
|
|
4053
4053
|
c = new Tt(t), a = o.fieldTransforms.filter((t => c.covers(t.field)));
|
|
@@ -4100,7 +4100,7 @@ class Sn extends bn {
|
|
|
4100
4100
|
}
|
|
4101
4101
|
}
|
|
4102
4102
|
|
|
4103
|
-
class
|
|
4103
|
+
class xn extends bn {
|
|
4104
4104
|
constructor(t, e) {
|
|
4105
4105
|
super(t), this.lt = e;
|
|
4106
4106
|
}
|
|
@@ -4115,7 +4115,7 @@ class Fn extends bn {
|
|
|
4115
4115
|
}
|
|
4116
4116
|
}
|
|
4117
4117
|
|
|
4118
|
-
class
|
|
4118
|
+
class Fn extends bn {
|
|
4119
4119
|
constructor(t, e) {
|
|
4120
4120
|
super(t), this.lt = e;
|
|
4121
4121
|
}
|
|
@@ -4162,12 +4162,12 @@ class qn extends bn {
|
|
|
4162
4162
|
}
|
|
4163
4163
|
}));
|
|
4164
4164
|
const u = new Tt(i);
|
|
4165
|
-
return new
|
|
4165
|
+
return new An(o, u, s.fieldTransforms);
|
|
4166
4166
|
}
|
|
4167
4167
|
|
|
4168
4168
|
/** Parse update data from a list of field/value arguments. */ function Cn(t, e, n, r, s, i) {
|
|
4169
4169
|
const o = t.ht(1 /* Update */ , e, n), u = [ Bn(e, r, n) ], c = [ s ];
|
|
4170
|
-
if (i.length % 2 != 0) throw new U(
|
|
4170
|
+
if (i.length % 2 != 0) throw new U(I, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);
|
|
4171
4171
|
for (let t = 0; t < i.length; t += 2) u.push(Bn(e, i[t])), c.push(i[t + 1]);
|
|
4172
4172
|
const a = [], l = zt.empty();
|
|
4173
4173
|
// We iterate in reverse order to pick the last value for a field if the
|
|
@@ -4187,7 +4187,7 @@ class qn extends bn {
|
|
|
4187
4187
|
}
|
|
4188
4188
|
}
|
|
4189
4189
|
const f = new Tt(a);
|
|
4190
|
-
return new
|
|
4190
|
+
return new An(l, f, o.fieldTransforms);
|
|
4191
4191
|
}
|
|
4192
4192
|
|
|
4193
4193
|
/**
|
|
@@ -4225,7 +4225,7 @@ class qn extends bn {
|
|
|
4225
4225
|
*/
|
|
4226
4226
|
return function(t, e) {
|
|
4227
4227
|
// Sentinels are only supported with writes, and not within arrays.
|
|
4228
|
-
if (!
|
|
4228
|
+
if (!In(e.tt)) throw e.ut(`${t._methodName}() can only be used with update() and set()`);
|
|
4229
4229
|
if (!e.path) throw e.ut(`${t._methodName}() is not currently supported inside arrays`);
|
|
4230
4230
|
const n = t._toFieldTransform(e);
|
|
4231
4231
|
n && e.fieldTransforms.push(n);
|
|
@@ -4309,7 +4309,7 @@ class qn extends bn {
|
|
|
4309
4309
|
const n = e.databaseId, r = t.firestore._databaseId;
|
|
4310
4310
|
if (!r.isEqual(n)) throw e.ut(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);
|
|
4311
4311
|
return {
|
|
4312
|
-
referenceValue:
|
|
4312
|
+
referenceValue: Fe(t.firestore._databaseId || e.databaseId, t._key.path)
|
|
4313
4313
|
};
|
|
4314
4314
|
}
|
|
4315
4315
|
throw e.ut(`Unsupported field value: ${it(t)}`);
|
|
@@ -4398,7 +4398,7 @@ function Qn(t, e, n, r, s) {
|
|
|
4398
4398
|
n && (u += " (via `toFirestore()`)"), u += ". ";
|
|
4399
4399
|
let c = "";
|
|
4400
4400
|
return (i || o) && (c += " (found", i && (c += ` in field ${r}`), o && (c += ` in document ${s}`),
|
|
4401
|
-
c += ")"), new U(
|
|
4401
|
+
c += ")"), new U(I, u + t + c);
|
|
4402
4402
|
}
|
|
4403
4403
|
|
|
4404
4404
|
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function Wn(t, e) {
|
|
@@ -4607,7 +4607,7 @@ class er extends Zn {
|
|
|
4607
4607
|
const e = Vn(t.firestore), n = function(t, e, n, r, s, i, o) {
|
|
4608
4608
|
let u;
|
|
4609
4609
|
if (s.isKeyField()) {
|
|
4610
|
-
if ("array-contains" /* ARRAY_CONTAINS */ === i || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === i) throw new U(
|
|
4610
|
+
if ("array-contains" /* ARRAY_CONTAINS */ === i || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === i) throw new U(I, `Invalid Query. You can't perform '${i}' queries on documentId().`);
|
|
4611
4611
|
if ("in" /* IN */ === i || "not-in" /* NOT_IN */ === i) {
|
|
4612
4612
|
pr(o, i);
|
|
4613
4613
|
const e = [];
|
|
@@ -4625,7 +4625,7 @@ class er extends Zn {
|
|
|
4625
4625
|
return function(t, e) {
|
|
4626
4626
|
if (e.N()) {
|
|
4627
4627
|
const n = ae(t);
|
|
4628
|
-
if (null !== n && !n.isEqual(e.field)) throw new U(
|
|
4628
|
+
if (null !== n && !n.isEqual(e.field)) throw new U(I, `Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${n.toString()}' and '${e.field.toString()}'`);
|
|
4629
4629
|
const r = ce(t);
|
|
4630
4630
|
null !== r && yr(t, e.field, r);
|
|
4631
4631
|
}
|
|
@@ -4668,7 +4668,7 @@ class er extends Zn {
|
|
|
4668
4668
|
}(e.op));
|
|
4669
4669
|
if (null !== n)
|
|
4670
4670
|
// Special case when it's a duplicate op to give a slightly clearer error message.
|
|
4671
|
-
throw n === e.op ? new U(
|
|
4671
|
+
throw n === e.op ? new U(I, `Invalid query. You cannot use more than one '${e.op.toString()}' filter.`) : new U(I, `Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`);
|
|
4672
4672
|
}(t, c), c;
|
|
4673
4673
|
}(t._query, "where", e, t.firestore._databaseId, this.dt, this.wt, this.yt);
|
|
4674
4674
|
return new hn(t.firestore, t.converter, function(t, e) {
|
|
@@ -4699,8 +4699,8 @@ class rr extends Zn {
|
|
|
4699
4699
|
}
|
|
4700
4700
|
_apply(t) {
|
|
4701
4701
|
const e = function(t, e, n) {
|
|
4702
|
-
if (null !== t.startAt) throw new U(
|
|
4703
|
-
if (null !== t.endAt) throw new U(
|
|
4702
|
+
if (null !== t.startAt) throw new U(I, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
|
|
4703
|
+
if (null !== t.endAt) throw new U(I, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
|
|
4704
4704
|
const r = new se(e, n);
|
|
4705
4705
|
return function(t, e) {
|
|
4706
4706
|
if (null === ce(t)) {
|
|
@@ -4830,10 +4830,10 @@ function dr(...t) {
|
|
|
4830
4830
|
// results.
|
|
4831
4831
|
for (const n of le(t)) if (n.field.isKeyField()) i.push(Lt(e, r.key)); else {
|
|
4832
4832
|
const t = r.data.field(n.field);
|
|
4833
|
-
if (Dt(t)) throw new U(
|
|
4833
|
+
if (Dt(t)) throw new U(I, 'Invalid query. You are trying to start or end a query using a document for which the field "' + n.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');
|
|
4834
4834
|
if (null === t) {
|
|
4835
4835
|
const t = n.field.canonicalString();
|
|
4836
|
-
throw new U(
|
|
4836
|
+
throw new U(I, `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.`);
|
|
4837
4837
|
}
|
|
4838
4838
|
i.push(t);
|
|
4839
4839
|
}
|
|
@@ -4847,15 +4847,15 @@ function dr(...t) {
|
|
|
4847
4847
|
return function(t, e, n, r, s, i) {
|
|
4848
4848
|
// Use explicit order by's because it has to match the query the user made
|
|
4849
4849
|
const o = t.explicitOrderBy;
|
|
4850
|
-
if (s.length > o.length) throw new U(
|
|
4850
|
+
if (s.length > o.length) throw new U(I, `Too many arguments provided to ${r}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);
|
|
4851
4851
|
const u = [];
|
|
4852
4852
|
for (let i = 0; i < s.length; i++) {
|
|
4853
4853
|
const c = s[i];
|
|
4854
4854
|
if (o[i].field.isKeyField()) {
|
|
4855
|
-
if ("string" != typeof c) throw new U(
|
|
4856
|
-
if (!he(t) && -1 !== c.indexOf("/")) throw new U(
|
|
4855
|
+
if ("string" != typeof c) throw new U(I, `Invalid query. Expected a string for document ID in ${r}(), but got a ${typeof c}`);
|
|
4856
|
+
if (!he(t) && -1 !== c.indexOf("/")) throw new U(I, `Invalid query. When querying a collection and ordering by documentId(), the value passed to ${r}() must be a plain document ID, but '${c}' contains a slash.`);
|
|
4857
4857
|
const n = t.path.child(X.fromString(c));
|
|
4858
|
-
if (!et.isDocumentKey(n)) throw new U(
|
|
4858
|
+
if (!et.isDocumentKey(n)) throw new U(I, `Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${r}() must result in a valid document path, but '${n}' is not because it contains an odd number of segments.`);
|
|
4859
4859
|
const s = new et(n);
|
|
4860
4860
|
u.push(Lt(e, s));
|
|
4861
4861
|
} else {
|
|
@@ -4875,26 +4875,26 @@ function dr(...t) {
|
|
|
4875
4875
|
|
|
4876
4876
|
function mr(t, e, n) {
|
|
4877
4877
|
if ("string" == typeof (n = getModularInstance(n))) {
|
|
4878
|
-
if ("" === n) throw new U(
|
|
4879
|
-
if (!he(e) && -1 !== n.indexOf("/")) throw new U(
|
|
4878
|
+
if ("" === n) throw new U(I, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
|
|
4879
|
+
if (!he(e) && -1 !== n.indexOf("/")) throw new U(I, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);
|
|
4880
4880
|
const r = e.path.child(X.fromString(n));
|
|
4881
|
-
if (!et.isDocumentKey(r)) throw new U(
|
|
4881
|
+
if (!et.isDocumentKey(r)) throw new U(I, `Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);
|
|
4882
4882
|
return Lt(t, new et(r));
|
|
4883
4883
|
}
|
|
4884
4884
|
if (n instanceof an) return Lt(t, n._key);
|
|
4885
|
-
throw new U(
|
|
4885
|
+
throw new U(I, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${it(n)}.`);
|
|
4886
4886
|
}
|
|
4887
4887
|
|
|
4888
4888
|
/**
|
|
4889
4889
|
* Validates that the value passed into a disjunctive filter satisfies all
|
|
4890
4890
|
* array requirements.
|
|
4891
4891
|
*/ function pr(t, e) {
|
|
4892
|
-
if (!Array.isArray(t) || 0 === t.length) throw new U(
|
|
4893
|
-
if (t.length > 10) throw new U(
|
|
4892
|
+
if (!Array.isArray(t) || 0 === t.length) throw new U(I, `Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);
|
|
4893
|
+
if (t.length > 10) throw new U(I, `Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`);
|
|
4894
4894
|
}
|
|
4895
4895
|
|
|
4896
4896
|
function yr(t, e, n) {
|
|
4897
|
-
if (!n.isEqual(e)) throw new U(
|
|
4897
|
+
if (!n.isEqual(e)) throw new U(I, `Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${e.toString()}' and so you must also use '${e.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${n.toString()}' instead.`);
|
|
4898
4898
|
}
|
|
4899
4899
|
|
|
4900
4900
|
/**
|
|
@@ -4955,7 +4955,7 @@ function _r(t, e, n) {
|
|
|
4955
4955
|
|
|
4956
4956
|
class gr extends class {
|
|
4957
4957
|
convertValue(t, e = "none") {
|
|
4958
|
-
switch (
|
|
4958
|
+
switch (xt(t)) {
|
|
4959
4959
|
case 0 /* NullValue */ :
|
|
4960
4960
|
return null;
|
|
4961
4961
|
|
|
@@ -5116,8 +5116,8 @@ function Tr(t, e, n, ...r) {
|
|
|
5116
5116
|
* @param reference - A reference to the document to delete.
|
|
5117
5117
|
* @returns A `Promise` resolved once the document has been successfully
|
|
5118
5118
|
* deleted from the backend.
|
|
5119
|
-
*/ function
|
|
5120
|
-
return Je(en((t = ot(t, an)).firestore), [ new
|
|
5119
|
+
*/ function Ar(t) {
|
|
5120
|
+
return Je(en((t = ot(t, an)).firestore), [ new Ie(t._key, ve.none()) ]);
|
|
5121
5121
|
}
|
|
5122
5122
|
|
|
5123
5123
|
/**
|
|
@@ -5134,7 +5134,7 @@ function Tr(t, e, n, ...r) {
|
|
|
5134
5134
|
* @throws Error - If the provided input is not a valid Firestore document.
|
|
5135
5135
|
* @returns A `Promise` resolved with a `DocumentReference` pointing to the
|
|
5136
5136
|
* newly created document after it has been written to the backend.
|
|
5137
|
-
*/ function
|
|
5137
|
+
*/ function Ir(t, e) {
|
|
5138
5138
|
const n = wn(t = ot(t, ln)), r = _r(t.converter, e), s = Dn(Vn(t.firestore), "addDoc", n._key, r, null !== n.converter, {});
|
|
5139
5139
|
return Je(en(t.firestore), [ s.toMutation(n._key, ve.exists(!1)) ]).then((() => n));
|
|
5140
5140
|
}
|
|
@@ -5183,7 +5183,7 @@ function Tr(t, e, n, ...r) {
|
|
|
5183
5183
|
*/ function Vr(...t) {
|
|
5184
5184
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
5185
5185
|
// update() since we'd need the Firestore instance to do this.
|
|
5186
|
-
return new
|
|
5186
|
+
return new xn("arrayUnion", t);
|
|
5187
5187
|
}
|
|
5188
5188
|
|
|
5189
5189
|
/**
|
|
@@ -5199,7 +5199,7 @@ function Tr(t, e, n, ...r) {
|
|
|
5199
5199
|
*/ function Dr(...t) {
|
|
5200
5200
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
5201
5201
|
// update() since we'd need the Firestore instance to do this.
|
|
5202
|
-
return new
|
|
5202
|
+
return new Fn("arrayRemove", t);
|
|
5203
5203
|
}
|
|
5204
5204
|
|
|
5205
5205
|
/**
|
|
@@ -5275,7 +5275,7 @@ function Tr(t, e, n, ...r) {
|
|
|
5275
5275
|
*/ delete(t) {
|
|
5276
5276
|
this._verifyNotCommitted();
|
|
5277
5277
|
const e = Sr(t, this._firestore);
|
|
5278
|
-
return this._mutations = this._mutations.concat(new
|
|
5278
|
+
return this._mutations = this._mutations.concat(new Ie(e._key, ve.none())), this;
|
|
5279
5279
|
}
|
|
5280
5280
|
/**
|
|
5281
5281
|
* Commits all of the writes in this write batch as a single atomic unit.
|
|
@@ -5297,7 +5297,7 @@ function Tr(t, e, n, ...r) {
|
|
|
5297
5297
|
}
|
|
5298
5298
|
|
|
5299
5299
|
function Sr(t, e) {
|
|
5300
|
-
if ((t = getModularInstance(t)).firestore !== e) throw new U(
|
|
5300
|
+
if ((t = getModularInstance(t)).firestore !== e) throw new U(I, "Provided document reference is from a different Firestore instance.");
|
|
5301
5301
|
return t;
|
|
5302
5302
|
}
|
|
5303
5303
|
|
|
@@ -5313,7 +5313,7 @@ function Sr(t, e) {
|
|
|
5313
5313
|
*
|
|
5314
5314
|
* @returns A `WriteBatch` that can be used to atomically execute multiple
|
|
5315
5315
|
* writes.
|
|
5316
|
-
*/ function
|
|
5316
|
+
*/ function xr(t) {
|
|
5317
5317
|
const e = en(t = ot(t, rn));
|
|
5318
5318
|
return new $r(t, (t => Je(e, t)));
|
|
5319
5319
|
}
|
|
@@ -5337,7 +5337,7 @@ function Sr(t, e) {
|
|
|
5337
5337
|
/**
|
|
5338
5338
|
* Internal transaction object responsible for accumulating the mutations to
|
|
5339
5339
|
* perform and the base versions for any documents read.
|
|
5340
|
-
*/ class
|
|
5340
|
+
*/ class Fr {
|
|
5341
5341
|
constructor(t) {
|
|
5342
5342
|
this.datastore = t,
|
|
5343
5343
|
// The version of each document that was read during this transaction.
|
|
@@ -5356,7 +5356,7 @@ function Sr(t, e) {
|
|
|
5356
5356
|
this.writtenDocs = new Set;
|
|
5357
5357
|
}
|
|
5358
5358
|
async lookup(t) {
|
|
5359
|
-
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new U(
|
|
5359
|
+
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new U(I, "Firestore transactions require all reads to be executed before all writes.");
|
|
5360
5360
|
const e = await Xe(this.datastore, t);
|
|
5361
5361
|
return e.forEach((t => this.recordVersion(t))), e;
|
|
5362
5362
|
}
|
|
@@ -5372,7 +5372,7 @@ function Sr(t, e) {
|
|
|
5372
5372
|
this.writtenDocs.add(t.toString());
|
|
5373
5373
|
}
|
|
5374
5374
|
delete(t) {
|
|
5375
|
-
this.write(new
|
|
5375
|
+
this.write(new Ie(t, this.precondition(t))), this.writtenDocs.add(t.toString());
|
|
5376
5376
|
}
|
|
5377
5377
|
async commit() {
|
|
5378
5378
|
if (this.ensureCommitNotCalled(), this.lastWriteError) throw this.lastWriteError;
|
|
@@ -5399,7 +5399,7 @@ function Sr(t, e) {
|
|
|
5399
5399
|
if (n) {
|
|
5400
5400
|
if (!e.isEqual(n))
|
|
5401
5401
|
// This transaction will fail no matter what.
|
|
5402
|
-
throw new U(
|
|
5402
|
+
throw new U(x, "Document version changed between two reads.");
|
|
5403
5403
|
} else this.readVersions.set(t.key.toString(), e);
|
|
5404
5404
|
}
|
|
5405
5405
|
/**
|
|
@@ -5426,7 +5426,7 @@ function Sr(t, e) {
|
|
|
5426
5426
|
// express that to the backend, we have to validate locally.
|
|
5427
5427
|
// Note: this can change once we can send separate verify writes in the
|
|
5428
5428
|
// transaction.
|
|
5429
|
-
throw new U(
|
|
5429
|
+
throw new U(I, "Can't update a document that doesn't exist.");
|
|
5430
5430
|
// Document exists, base precondition on document update time.
|
|
5431
5431
|
return ve.updateTime(e);
|
|
5432
5432
|
}
|
|
@@ -5440,6 +5440,25 @@ function Sr(t, e) {
|
|
|
5440
5440
|
ensureCommitNotCalled() {}
|
|
5441
5441
|
}
|
|
5442
5442
|
|
|
5443
|
+
/**
|
|
5444
|
+
* @license
|
|
5445
|
+
* Copyright 2022 Google LLC
|
|
5446
|
+
*
|
|
5447
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5448
|
+
* you may not use this file except in compliance with the License.
|
|
5449
|
+
* You may obtain a copy of the License at
|
|
5450
|
+
*
|
|
5451
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5452
|
+
*
|
|
5453
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
5454
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5455
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5456
|
+
* See the License for the specific language governing permissions and
|
|
5457
|
+
* limitations under the License.
|
|
5458
|
+
*/ const qr = {
|
|
5459
|
+
maxAttempts: 5
|
|
5460
|
+
};
|
|
5461
|
+
|
|
5443
5462
|
/**
|
|
5444
5463
|
* @license
|
|
5445
5464
|
* Copyright 2019 Google LLC
|
|
@@ -5460,17 +5479,17 @@ function Sr(t, e) {
|
|
|
5460
5479
|
* TransactionRunner encapsulates the logic needed to run and retry transactions
|
|
5461
5480
|
* with backoff.
|
|
5462
5481
|
*/
|
|
5463
|
-
class
|
|
5464
|
-
constructor(t, e, n, r) {
|
|
5465
|
-
this.asyncQueue = t, this.datastore = e, this.
|
|
5466
|
-
this.Tt =
|
|
5482
|
+
class Or {
|
|
5483
|
+
constructor(t, e, n, r, s) {
|
|
5484
|
+
this.asyncQueue = t, this.datastore = e, this.options = n, this.updateFunction = r,
|
|
5485
|
+
this.deferred = s, this.Tt = n.maxAttempts, this.At = new He(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
|
|
5467
5486
|
}
|
|
5468
5487
|
/** Runs the transaction and sets the result on deferred. */ run() {
|
|
5469
|
-
this.Tt -= 1, this.
|
|
5488
|
+
this.Tt -= 1, this.It();
|
|
5470
5489
|
}
|
|
5471
|
-
|
|
5472
|
-
this.
|
|
5473
|
-
const t = new
|
|
5490
|
+
It() {
|
|
5491
|
+
this.At.W((async () => {
|
|
5492
|
+
const t = new Fr(this.datastore), e = this.Rt(t);
|
|
5474
5493
|
e && e.then((e => {
|
|
5475
5494
|
this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
|
|
5476
5495
|
this.deferred.resolve(e);
|
|
@@ -5493,7 +5512,7 @@ class qr {
|
|
|
5493
5512
|
}
|
|
5494
5513
|
}
|
|
5495
5514
|
Pt(t) {
|
|
5496
|
-
this.Tt > 0 && this.Vt(t) ? (this.Tt -= 1, this.asyncQueue.enqueueAndForget((() => (this.
|
|
5515
|
+
this.Tt > 0 && this.Vt(t) ? (this.Tt -= 1, this.asyncQueue.enqueueAndForget((() => (this.It(),
|
|
5497
5516
|
Promise.resolve())))) : this.deferred.reject(t);
|
|
5498
5517
|
}
|
|
5499
5518
|
Vt(t) {
|
|
@@ -5514,7 +5533,7 @@ class qr {
|
|
|
5514
5533
|
return g();
|
|
5515
5534
|
|
|
5516
5535
|
case T:
|
|
5517
|
-
case
|
|
5536
|
+
case A:
|
|
5518
5537
|
case R:
|
|
5519
5538
|
case $:
|
|
5520
5539
|
case O:
|
|
@@ -5524,7 +5543,7 @@ class qr {
|
|
|
5524
5543
|
case N:
|
|
5525
5544
|
return !1;
|
|
5526
5545
|
|
|
5527
|
-
case
|
|
5546
|
+
case I:
|
|
5528
5547
|
case P:
|
|
5529
5548
|
case V:
|
|
5530
5549
|
case D:
|
|
@@ -5532,8 +5551,8 @@ class qr {
|
|
|
5532
5551
|
// Aborted might be retried in some scenarios, but that is dependant on
|
|
5533
5552
|
// the context and should handled individually by the calling code.
|
|
5534
5553
|
// See https://cloud.google.com/apis/design/errors.
|
|
5535
|
-
case
|
|
5536
|
-
case
|
|
5554
|
+
case x:
|
|
5555
|
+
case F:
|
|
5537
5556
|
case q:
|
|
5538
5557
|
case L:
|
|
5539
5558
|
return !0;
|
|
@@ -5560,7 +5579,7 @@ class qr {
|
|
|
5560
5579
|
* See the License for the specific language governing permissions and
|
|
5561
5580
|
* limitations under the License.
|
|
5562
5581
|
*/
|
|
5563
|
-
/** The Platform's 'document' implementation or null if not available. */ function
|
|
5582
|
+
/** The Platform's 'document' implementation or null if not available. */ function Cr() {
|
|
5564
5583
|
// `document` is not always available, e.g. in ReactNative and WebWorkers.
|
|
5565
5584
|
// eslint-disable-next-line no-restricted-globals
|
|
5566
5585
|
return "undefined" != typeof document ? document : null;
|
|
@@ -5592,7 +5611,7 @@ class qr {
|
|
|
5592
5611
|
* Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type
|
|
5593
5612
|
* in newer versions of TypeScript defines `finally`, which is not available in
|
|
5594
5613
|
* IE.
|
|
5595
|
-
*/ class
|
|
5614
|
+
*/ class Lr {
|
|
5596
5615
|
constructor(t, e, n, r, s) {
|
|
5597
5616
|
this.asyncQueue = t, this.timerId = e, this.targetTimeMs = n, this.op = r, this.removalCallback = s,
|
|
5598
5617
|
this.deferred = new k, this.then = this.deferred.promise.then.bind(this.deferred.promise),
|
|
@@ -5615,7 +5634,7 @@ class qr {
|
|
|
5615
5634
|
* PORTING NOTE: This exists to prevent making removeDelayedOperation() and
|
|
5616
5635
|
* the DelayedOperation class public.
|
|
5617
5636
|
*/ static createAndSchedule(t, e, n, r, s) {
|
|
5618
|
-
const i = Date.now() + n, o = new
|
|
5637
|
+
const i = Date.now() + n, o = new Lr(t, e, i, r, s);
|
|
5619
5638
|
return o.start(n), o;
|
|
5620
5639
|
}
|
|
5621
5640
|
/**
|
|
@@ -5664,7 +5683,7 @@ class qr {
|
|
|
5664
5683
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5665
5684
|
* See the License for the specific language governing permissions and
|
|
5666
5685
|
* limitations under the License.
|
|
5667
|
-
*/ class
|
|
5686
|
+
*/ class Ur {
|
|
5668
5687
|
constructor() {
|
|
5669
5688
|
// The last promise in the queue.
|
|
5670
5689
|
this.Dt = Promise.resolve(),
|
|
@@ -5678,24 +5697,24 @@ class qr {
|
|
|
5678
5697
|
// automatically removed after they are run or canceled.
|
|
5679
5698
|
this.St = [],
|
|
5680
5699
|
// visible for testing
|
|
5681
|
-
this.
|
|
5700
|
+
this.xt = null,
|
|
5682
5701
|
// Flag set while there's an outstanding AsyncQueue operation, used for
|
|
5683
5702
|
// assertion sanity-checks.
|
|
5684
|
-
this.
|
|
5703
|
+
this.Ft = !1,
|
|
5685
5704
|
// Enabled during shutdown on Safari to prevent future access to IndexedDB.
|
|
5686
5705
|
this.qt = !1,
|
|
5687
5706
|
// List of TimerIds to fast-forward delays for.
|
|
5688
5707
|
this.Ot = [],
|
|
5689
5708
|
// Backoff timer used to schedule retries for retryable operations
|
|
5690
|
-
this.
|
|
5709
|
+
this.At = new He(this, "async_queue_retry" /* AsyncQueueRetry */),
|
|
5691
5710
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
5692
5711
|
// operations. Meant to speed up recovery when we regain file system access
|
|
5693
5712
|
// after page comes into foreground.
|
|
5694
5713
|
this.Ct = () => {
|
|
5695
|
-
const t =
|
|
5696
|
-
t && m("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.
|
|
5714
|
+
const t = Cr();
|
|
5715
|
+
t && m("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.At.H();
|
|
5697
5716
|
};
|
|
5698
|
-
const t =
|
|
5717
|
+
const t = Cr();
|
|
5699
5718
|
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Ct);
|
|
5700
5719
|
}
|
|
5701
5720
|
get isShuttingDown() {
|
|
@@ -5716,7 +5735,7 @@ class qr {
|
|
|
5716
5735
|
enterRestrictedMode(t) {
|
|
5717
5736
|
if (!this.$t) {
|
|
5718
5737
|
this.$t = !0, this.qt = t || !1;
|
|
5719
|
-
const e =
|
|
5738
|
+
const e = Cr();
|
|
5720
5739
|
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Ct);
|
|
5721
5740
|
}
|
|
5722
5741
|
}
|
|
@@ -5740,7 +5759,7 @@ class qr {
|
|
|
5740
5759
|
*/ async kt() {
|
|
5741
5760
|
if (0 !== this.Nt.length) {
|
|
5742
5761
|
try {
|
|
5743
|
-
await this.Nt[0](), this.Nt.shift(), this.
|
|
5762
|
+
await this.Nt[0](), this.Nt.shift(), this.At.reset();
|
|
5744
5763
|
} catch (t) {
|
|
5745
5764
|
if (!
|
|
5746
5765
|
/**
|
|
@@ -5795,12 +5814,12 @@ class qr {
|
|
|
5795
5814
|
// Since `backoffAndRun()` cancels an existing backoff and schedules a
|
|
5796
5815
|
// new backoff on every call, there is only ever a single additional
|
|
5797
5816
|
// operation in the queue.
|
|
5798
|
-
this.
|
|
5817
|
+
this.At.W((() => this.kt()));
|
|
5799
5818
|
}
|
|
5800
5819
|
}
|
|
5801
5820
|
Ut(t) {
|
|
5802
|
-
const e = this.Dt.then((() => (this.
|
|
5803
|
-
this.
|
|
5821
|
+
const e = this.Dt.then((() => (this.Ft = !0, t().catch((t => {
|
|
5822
|
+
this.xt = t, this.Ft = !1;
|
|
5804
5823
|
const e =
|
|
5805
5824
|
/**
|
|
5806
5825
|
* Chrome includes Error.message in Error.stack. Other browsers do not.
|
|
@@ -5841,18 +5860,18 @@ class qr {
|
|
|
5841
5860
|
// all further attempts to chain (via .then) will just short-circuit
|
|
5842
5861
|
// and return the rejected Promise.
|
|
5843
5862
|
throw p("INTERNAL UNHANDLED ERROR: ", e), t;
|
|
5844
|
-
})).then((t => (this.
|
|
5863
|
+
})).then((t => (this.Ft = !1, t))))));
|
|
5845
5864
|
return this.Dt = e, e;
|
|
5846
5865
|
}
|
|
5847
5866
|
enqueueAfterDelay(t, e, n) {
|
|
5848
5867
|
this.Lt(),
|
|
5849
5868
|
// Fast-forward delays for timerIds that have been overriden.
|
|
5850
5869
|
this.Ot.indexOf(t) > -1 && (e = 0);
|
|
5851
|
-
const r =
|
|
5870
|
+
const r = Lr.createAndSchedule(this, t, e, n, (t => this.jt(t)));
|
|
5852
5871
|
return this.St.push(r), r;
|
|
5853
5872
|
}
|
|
5854
5873
|
Lt() {
|
|
5855
|
-
this.
|
|
5874
|
+
this.xt && g();
|
|
5856
5875
|
}
|
|
5857
5876
|
verifyOperationInProgress() {}
|
|
5858
5877
|
/**
|
|
@@ -5902,7 +5921,7 @@ class qr {
|
|
|
5902
5921
|
}
|
|
5903
5922
|
}
|
|
5904
5923
|
|
|
5905
|
-
class
|
|
5924
|
+
class kr {
|
|
5906
5925
|
/** @hideconstructor */
|
|
5907
5926
|
constructor(t, e) {
|
|
5908
5927
|
this._firestore = t, this._transaction = e, this._dataReader = Vn(t);
|
|
@@ -5961,9 +5980,13 @@ class Ur {
|
|
|
5961
5980
|
* (the `updateFunction` returned a failed promise), the promise returned by the
|
|
5962
5981
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
5963
5982
|
* rejected promise with the corresponding failure error is returned.
|
|
5964
|
-
*/ function
|
|
5965
|
-
const
|
|
5966
|
-
|
|
5983
|
+
*/ function jr(t, e, n) {
|
|
5984
|
+
const r = en(t = ot(t, rn)), s = Object.assign(Object.assign({}, qr), n);
|
|
5985
|
+
!function(t) {
|
|
5986
|
+
if (t.maxAttempts < 1) throw new U(I, "Max attempts must be at least 1");
|
|
5987
|
+
}(s);
|
|
5988
|
+
const i = new k;
|
|
5989
|
+
return new Or(new Ur, r, s, (n => e(new kr(t, n))), i).run(), i.promise;
|
|
5967
5990
|
}
|
|
5968
5991
|
|
|
5969
5992
|
/**
|
|
@@ -5980,7 +6003,7 @@ class Ur {
|
|
|
5980
6003
|
return e && r._setSettings(e), r;
|
|
5981
6004
|
}), "PUBLIC")),
|
|
5982
6005
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
5983
|
-
registerVersion("firestore-lite", "3.4.8-canary.
|
|
6006
|
+
registerVersion("firestore-lite", "3.4.8-canary.6ceff4db0", ""), registerVersion("firestore-lite", "3.4.8-canary.6ceff4db0", "esm2017");
|
|
5984
6007
|
|
|
5985
|
-
export { gn as Bytes, ln as CollectionReference, an as DocumentReference, Yn as DocumentSnapshot, yn as FieldPath, bn as FieldValue, rn as Firestore, U as FirestoreError, vn as GeoPoint, hn as Query, Zn as QueryConstraint, Hn as QueryDocumentSnapshot, Kn as QuerySnapshot, gt as Timestamp,
|
|
6008
|
+
export { gn as Bytes, ln as CollectionReference, an as DocumentReference, Yn as DocumentSnapshot, yn as FieldPath, bn as FieldValue, rn as Firestore, U as FirestoreError, vn as GeoPoint, hn as Query, Zn as QueryConstraint, Hn as QueryDocumentSnapshot, Kn as QuerySnapshot, gt as Timestamp, kr as Transaction, $r as WriteBatch, Ir as addDoc, Dr as arrayRemove, Vr as arrayUnion, fn as collection, dn as collectionGroup, un as connectFirestoreEmulator, Ar as deleteDoc, Rr as deleteField, wn as doc, _n as documentId, dr as endAt, fr as endBefore, br as getDoc, vr as getDocs, on as getFirestore, Nr as increment, sn as initializeFirestore, or as limit, ur as limitToLast, sr as orderBy, tr as query, pn as queryEqual, mn as refEqual, jr as runTransaction, Pr as serverTimestamp, Er as setDoc, w as setLogLevel, Jn as snapshotEqual, hr as startAfter, ar as startAt, cn as terminate, Tr as updateDoc, nr as where, xr as writeBatch };
|
|
5986
6009
|
//# sourceMappingURL=index.browser.esm2017.js.map
|