@firebase/firestore 3.4.8-canary.aa41fd662 → 3.4.8-canary.d8be8bf1c
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/core/target.d.ts +4 -4
- package/dist/firestore/src/local/indexeddb_index_manager.d.ts +0 -5
- package/dist/firestore/src/model/values.d.ts +14 -2
- package/dist/index.esm2017.js +1278 -1261
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +2298 -2282
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +46 -55
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +46 -55
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +1315 -1298
- package/dist/index.rn.js.map +1 -1
- package/dist/lite/firestore/src/core/target.d.ts +4 -4
- package/dist/lite/firestore/src/local/indexeddb_index_manager.d.ts +0 -5
- package/dist/lite/firestore/src/model/values.d.ts +14 -2
- package/dist/lite/index.browser.esm2017.js +509 -499
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +547 -537
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +21 -5
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +21 -5
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +1216 -1206
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +97 -97
- package/dist/lite/packages/firestore/src/core/target.d.ts +4 -4
- package/dist/lite/packages/firestore/src/local/indexeddb_index_manager.d.ts +0 -5
- package/dist/lite/packages/firestore/src/model/values.d.ts +14 -2
- package/dist/packages/firestore/dist/index.esm2017.d.ts +50 -50
- package/dist/packages/firestore/src/core/target.d.ts +4 -4
- package/dist/packages/firestore/src/local/indexeddb_index_manager.d.ts +0 -5
- package/dist/packages/firestore/src/model/values.d.ts +14 -2
- package/package.json +9 -9
|
@@ -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.6.11-canary.
|
|
66
|
+
let f = "9.6.11-canary.d8be8bf1c";
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* @license
|
|
@@ -190,14 +190,14 @@ function p(t, ...e) {
|
|
|
190
190
|
* given message if it did.
|
|
191
191
|
*
|
|
192
192
|
* Messages are stripped in production builds.
|
|
193
|
-
*/ function
|
|
193
|
+
*/ function b(t, e) {
|
|
194
194
|
t || g();
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
/**
|
|
198
198
|
* Casts `obj` to `T`. In non-production builds, verifies that `obj` is an
|
|
199
199
|
* instance of `T` before casting.
|
|
200
|
-
*/ function
|
|
200
|
+
*/ function v(t,
|
|
201
201
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
202
202
|
e) {
|
|
203
203
|
return t;
|
|
@@ -332,7 +332,7 @@ e) {
|
|
|
332
332
|
}));
|
|
333
333
|
}
|
|
334
334
|
getToken() {
|
|
335
|
-
return this.auth ? this.auth.getToken().then((t => t ? (
|
|
335
|
+
return this.auth ? this.auth.getToken().then((t => t ? (b("string" == typeof t.accessToken),
|
|
336
336
|
new j(t.accessToken, new l(this.auth.getUid()))) : null)) : Promise.resolve(null);
|
|
337
337
|
}
|
|
338
338
|
invalidateToken() {}
|
|
@@ -386,7 +386,7 @@ class W {
|
|
|
386
386
|
}));
|
|
387
387
|
}
|
|
388
388
|
getToken() {
|
|
389
|
-
return this.appCheck ? this.appCheck.getToken().then((t => t ? (
|
|
389
|
+
return this.appCheck ? this.appCheck.getToken().then((t => t ? (b("string" == typeof t.token),
|
|
390
390
|
new W(t.token)) : null)) : Promise.resolve(null);
|
|
391
391
|
}
|
|
392
392
|
invalidateToken() {}
|
|
@@ -1320,18 +1320,18 @@ class gt {
|
|
|
1320
1320
|
/**
|
|
1321
1321
|
* A version of a document in Firestore. This corresponds to the version
|
|
1322
1322
|
* timestamp, such as update_time or read_time.
|
|
1323
|
-
*/ class
|
|
1323
|
+
*/ class bt {
|
|
1324
1324
|
constructor(t) {
|
|
1325
1325
|
this.timestamp = t;
|
|
1326
1326
|
}
|
|
1327
1327
|
static fromTimestamp(t) {
|
|
1328
|
-
return new
|
|
1328
|
+
return new bt(t);
|
|
1329
1329
|
}
|
|
1330
1330
|
static min() {
|
|
1331
|
-
return new
|
|
1331
|
+
return new bt(new gt(0, 0));
|
|
1332
1332
|
}
|
|
1333
1333
|
static max() {
|
|
1334
|
-
return new
|
|
1334
|
+
return new bt(new gt(253402300799, 999999999));
|
|
1335
1335
|
}
|
|
1336
1336
|
compareTo(t) {
|
|
1337
1337
|
return this.timestamp._compareTo(t.timestamp);
|
|
@@ -1366,7 +1366,7 @@ class gt {
|
|
|
1366
1366
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1367
1367
|
* See the License for the specific language governing permissions and
|
|
1368
1368
|
* limitations under the License.
|
|
1369
|
-
*/ function
|
|
1369
|
+
*/ function vt(t) {
|
|
1370
1370
|
let e = 0;
|
|
1371
1371
|
for (const n in t) Object.prototype.hasOwnProperty.call(t, n) && e++;
|
|
1372
1372
|
return e;
|
|
@@ -1554,13 +1554,13 @@ const At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1554
1554
|
// The json interface (for the browser) will return an iso timestamp string,
|
|
1555
1555
|
// while the proto js library (for node) will return a
|
|
1556
1556
|
// google.protobuf.Timestamp instance.
|
|
1557
|
-
if (
|
|
1557
|
+
if (b(!!t), "string" == typeof t) {
|
|
1558
1558
|
// The date string can have higher precision (nanos) than the Date class
|
|
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
1562
|
const n = At.exec(t);
|
|
1563
|
-
if (
|
|
1563
|
+
if (b(!!n), n[1]) {
|
|
1564
1564
|
// Pad the fraction out to 9 digits (nanos).
|
|
1565
1565
|
let t = n[1];
|
|
1566
1566
|
t = (t + "000000000").substr(0, 9), e = Number(t);
|
|
@@ -1660,9 +1660,16 @@ const At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1660
1660
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1661
1661
|
* See the License for the specific language governing permissions and
|
|
1662
1662
|
* limitations under the License.
|
|
1663
|
-
*/
|
|
1663
|
+
*/ const St = {
|
|
1664
|
+
fields: {
|
|
1665
|
+
__type__: {
|
|
1666
|
+
stringValue: "__max__"
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1669
|
+
};
|
|
1670
|
+
|
|
1664
1671
|
/** Extracts the backend's type order for the provided value. */
|
|
1665
|
-
function
|
|
1672
|
+
function Ft(t) {
|
|
1666
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 */ :
|
|
1667
1674
|
/** Returns true if the Value represents the canonical {@link #MAX_VALUE} . */
|
|
1668
1675
|
function(t) {
|
|
@@ -1687,13 +1694,13 @@ function St(t) {
|
|
|
1687
1694
|
/**
|
|
1688
1695
|
* An ObjectValue represents a MapValue in the Firestore Proto and offers the
|
|
1689
1696
|
* ability to add and remove fields (via the ObjectValueBuilder).
|
|
1690
|
-
*/ (t) ?
|
|
1697
|
+
*/ (t) ? 9007199254740991 /* MaxValue */ : 10 /* ObjectValue */ : g();
|
|
1691
1698
|
}
|
|
1692
1699
|
|
|
1693
|
-
/** 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 xt(t, e) {
|
|
1694
1701
|
if (t === e) return !0;
|
|
1695
|
-
const n =
|
|
1696
|
-
if (n !==
|
|
1702
|
+
const n = Ft(t);
|
|
1703
|
+
if (n !== Ft(e)) return !1;
|
|
1697
1704
|
switch (n) {
|
|
1698
1705
|
case 0 /* NullValue */ :
|
|
1699
1706
|
case 9007199254740991 /* MaxValue */ :
|
|
@@ -1741,13 +1748,13 @@ function St(t) {
|
|
|
1741
1748
|
}(t, e);
|
|
1742
1749
|
|
|
1743
1750
|
case 9 /* ArrayValue */ :
|
|
1744
|
-
return _t(t.arrayValue.values || [], e.arrayValue.values || [],
|
|
1751
|
+
return _t(t.arrayValue.values || [], e.arrayValue.values || [], xt);
|
|
1745
1752
|
|
|
1746
1753
|
case 10 /* ObjectValue */ :
|
|
1747
1754
|
return function(t, e) {
|
|
1748
1755
|
const n = t.mapValue.fields || {}, r = e.mapValue.fields || {};
|
|
1749
|
-
if (
|
|
1750
|
-
for (const t in n) if (n.hasOwnProperty(t) && (void 0 === r[t] || !
|
|
1756
|
+
if (vt(n) !== vt(r)) return !1;
|
|
1757
|
+
for (const t in n) if (n.hasOwnProperty(t) && (void 0 === r[t] || !xt(n[t], r[t]))) return !1;
|
|
1751
1758
|
return !0;
|
|
1752
1759
|
}
|
|
1753
1760
|
/** Returns true if the ArrayValue contains the specified element. */ (t, e);
|
|
@@ -1757,13 +1764,13 @@ function St(t) {
|
|
|
1757
1764
|
}
|
|
1758
1765
|
}
|
|
1759
1766
|
|
|
1760
|
-
function
|
|
1761
|
-
return void 0 !== (t.values || []).find((t =>
|
|
1767
|
+
function qt(t, e) {
|
|
1768
|
+
return void 0 !== (t.values || []).find((t => xt(t, e)));
|
|
1762
1769
|
}
|
|
1763
1770
|
|
|
1764
|
-
function
|
|
1771
|
+
function Ot(t, e) {
|
|
1765
1772
|
if (t === e) return 0;
|
|
1766
|
-
const n =
|
|
1773
|
+
const n = Ft(t), r = Ft(e);
|
|
1767
1774
|
if (n !== r) return yt(n, r);
|
|
1768
1775
|
switch (n) {
|
|
1769
1776
|
case 0 /* NullValue */ :
|
|
@@ -1782,10 +1789,10 @@ function qt(t, e) {
|
|
|
1782
1789
|
}(t, e);
|
|
1783
1790
|
|
|
1784
1791
|
case 3 /* TimestampValue */ :
|
|
1785
|
-
return
|
|
1792
|
+
return Ct(t.timestampValue, e.timestampValue);
|
|
1786
1793
|
|
|
1787
1794
|
case 4 /* ServerTimestampValue */ :
|
|
1788
|
-
return
|
|
1795
|
+
return Ct($t(t), $t(e));
|
|
1789
1796
|
|
|
1790
1797
|
case 5 /* StringValue */ :
|
|
1791
1798
|
return yt(t.stringValue, e.stringValue);
|
|
@@ -1817,7 +1824,7 @@ function qt(t, e) {
|
|
|
1817
1824
|
return function(t, e) {
|
|
1818
1825
|
const n = t.values || [], r = e.values || [];
|
|
1819
1826
|
for (let t = 0; t < n.length && t < r.length; ++t) {
|
|
1820
|
-
const e =
|
|
1827
|
+
const e = Ot(n[t], r[t]);
|
|
1821
1828
|
if (e) return e;
|
|
1822
1829
|
}
|
|
1823
1830
|
return yt(n.length, r.length);
|
|
@@ -1825,6 +1832,9 @@ function qt(t, e) {
|
|
|
1825
1832
|
|
|
1826
1833
|
case 10 /* ObjectValue */ :
|
|
1827
1834
|
return function(t, e) {
|
|
1835
|
+
if (t === St && e === St) return 0;
|
|
1836
|
+
if (t === St) return 1;
|
|
1837
|
+
if (e === St) return -1;
|
|
1828
1838
|
const n = t.fields || {}, r = Object.keys(n), s = e.fields || {}, i = Object.keys(s);
|
|
1829
1839
|
// Even though MapValues are likely sorted correctly based on their insertion
|
|
1830
1840
|
// order (e.g. when received from the backend), local modifications can bring
|
|
@@ -1834,7 +1844,7 @@ function qt(t, e) {
|
|
|
1834
1844
|
for (let t = 0; t < r.length && t < i.length; ++t) {
|
|
1835
1845
|
const e = yt(r[t], i[t]);
|
|
1836
1846
|
if (0 !== e) return e;
|
|
1837
|
-
const o =
|
|
1847
|
+
const o = Ot(n[r[t]], s[i[t]]);
|
|
1838
1848
|
if (0 !== o) return o;
|
|
1839
1849
|
}
|
|
1840
1850
|
return yt(r.length, i.length);
|
|
@@ -1846,35 +1856,35 @@ function qt(t, e) {
|
|
|
1846
1856
|
}
|
|
1847
1857
|
}
|
|
1848
1858
|
|
|
1849
|
-
function
|
|
1859
|
+
function Ct(t, e) {
|
|
1850
1860
|
if ("string" == typeof t && "string" == typeof e && t.length === e.length) return yt(t, e);
|
|
1851
1861
|
const n = Rt(t), r = Rt(e), s = yt(n.seconds, r.seconds);
|
|
1852
1862
|
return 0 !== s ? s : yt(n.nanos, r.nanos);
|
|
1853
1863
|
}
|
|
1854
1864
|
|
|
1855
|
-
function
|
|
1865
|
+
function Lt(t, e) {
|
|
1856
1866
|
return {
|
|
1857
1867
|
referenceValue: `projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`
|
|
1858
1868
|
};
|
|
1859
1869
|
}
|
|
1860
1870
|
|
|
1861
|
-
/** Returns true if `value` is an ArrayValue. */ function
|
|
1871
|
+
/** Returns true if `value` is an ArrayValue. */ function Ut(t) {
|
|
1862
1872
|
return !!t && "arrayValue" in t;
|
|
1863
1873
|
}
|
|
1864
1874
|
|
|
1865
|
-
/** Returns true if `value` is a NullValue. */ function
|
|
1875
|
+
/** Returns true if `value` is a NullValue. */ function kt(t) {
|
|
1866
1876
|
return !!t && "nullValue" in t;
|
|
1867
1877
|
}
|
|
1868
1878
|
|
|
1869
|
-
/** Returns true if `value` is NaN. */ function
|
|
1879
|
+
/** Returns true if `value` is NaN. */ function jt(t) {
|
|
1870
1880
|
return !!t && "doubleValue" in t && isNaN(Number(t.doubleValue));
|
|
1871
1881
|
}
|
|
1872
1882
|
|
|
1873
|
-
/** Returns true if `value` is a MapValue. */ function
|
|
1883
|
+
/** Returns true if `value` is a MapValue. */ function Mt(t) {
|
|
1874
1884
|
return !!t && "mapValue" in t;
|
|
1875
1885
|
}
|
|
1876
1886
|
|
|
1877
|
-
/** Creates a deep copy of `source`. */ function
|
|
1887
|
+
/** Creates a deep copy of `source`. */ function Bt(t) {
|
|
1878
1888
|
if (t.geoPointValue) return {
|
|
1879
1889
|
geoPointValue: Object.assign({}, t.geoPointValue)
|
|
1880
1890
|
};
|
|
@@ -1887,7 +1897,7 @@ function Ct(t, e) {
|
|
|
1887
1897
|
fields: {}
|
|
1888
1898
|
}
|
|
1889
1899
|
};
|
|
1890
|
-
return Et(t.mapValue.fields, ((t, n) => e.mapValue.fields[t] =
|
|
1900
|
+
return Et(t.mapValue.fields, ((t, n) => e.mapValue.fields[t] = Bt(n))), e;
|
|
1891
1901
|
}
|
|
1892
1902
|
if (t.arrayValue) {
|
|
1893
1903
|
const e = {
|
|
@@ -1895,18 +1905,18 @@ function Ct(t, e) {
|
|
|
1895
1905
|
values: []
|
|
1896
1906
|
}
|
|
1897
1907
|
};
|
|
1898
|
-
for (let n = 0; n < (t.arrayValue.values || []).length; ++n) e.arrayValue.values[n] =
|
|
1908
|
+
for (let n = 0; n < (t.arrayValue.values || []).length; ++n) e.arrayValue.values[n] = Bt(t.arrayValue.values[n]);
|
|
1899
1909
|
return e;
|
|
1900
1910
|
}
|
|
1901
1911
|
return Object.assign({}, t);
|
|
1902
1912
|
}
|
|
1903
1913
|
|
|
1904
|
-
class
|
|
1914
|
+
class zt {
|
|
1905
1915
|
constructor(t) {
|
|
1906
1916
|
this.value = t;
|
|
1907
1917
|
}
|
|
1908
1918
|
static empty() {
|
|
1909
|
-
return new
|
|
1919
|
+
return new zt({
|
|
1910
1920
|
mapValue: {}
|
|
1911
1921
|
});
|
|
1912
1922
|
}
|
|
@@ -1920,7 +1930,7 @@ class Bt {
|
|
|
1920
1930
|
{
|
|
1921
1931
|
let e = this.value;
|
|
1922
1932
|
for (let n = 0; n < t.length - 1; ++n) if (e = (e.mapValue.fields || {})[t.get(n)],
|
|
1923
|
-
!
|
|
1933
|
+
!Mt(e)) return null;
|
|
1924
1934
|
return e = (e.mapValue.fields || {})[t.lastSegment()], e || null;
|
|
1925
1935
|
}
|
|
1926
1936
|
}
|
|
@@ -1930,7 +1940,7 @@ class Bt {
|
|
|
1930
1940
|
* @param path - The field path to set.
|
|
1931
1941
|
* @param value - The value to set.
|
|
1932
1942
|
*/ set(t, e) {
|
|
1933
|
-
this.getFieldsMap(t.popLast())[t.lastSegment()] =
|
|
1943
|
+
this.getFieldsMap(t.popLast())[t.lastSegment()] = Bt(e);
|
|
1934
1944
|
}
|
|
1935
1945
|
/**
|
|
1936
1946
|
* Sets the provided fields to the provided values.
|
|
@@ -1944,7 +1954,7 @@ class Bt {
|
|
|
1944
1954
|
const t = this.getFieldsMap(e);
|
|
1945
1955
|
this.applyChanges(t, n, r), n = {}, r = [], e = s.popLast();
|
|
1946
1956
|
}
|
|
1947
|
-
t ? n[s.lastSegment()] =
|
|
1957
|
+
t ? n[s.lastSegment()] = Bt(t) : r.push(s.lastSegment());
|
|
1948
1958
|
}));
|
|
1949
1959
|
const s = this.getFieldsMap(e);
|
|
1950
1960
|
this.applyChanges(s, n, r);
|
|
@@ -1956,10 +1966,10 @@ class Bt {
|
|
|
1956
1966
|
* @param path - The field path to remove.
|
|
1957
1967
|
*/ delete(t) {
|
|
1958
1968
|
const e = this.field(t.popLast());
|
|
1959
|
-
|
|
1969
|
+
Mt(e) && e.mapValue.fields && delete e.mapValue.fields[t.lastSegment()];
|
|
1960
1970
|
}
|
|
1961
1971
|
isEqual(t) {
|
|
1962
|
-
return
|
|
1972
|
+
return xt(this.value, t.value);
|
|
1963
1973
|
}
|
|
1964
1974
|
/**
|
|
1965
1975
|
* Returns the map that contains the leaf element of `path`. If the parent
|
|
@@ -1971,7 +1981,7 @@ class Bt {
|
|
|
1971
1981
|
});
|
|
1972
1982
|
for (let n = 0; n < t.length; ++n) {
|
|
1973
1983
|
let r = e.mapValue.fields[t.get(n)];
|
|
1974
|
-
|
|
1984
|
+
Mt(r) && r.mapValue.fields || (r = {
|
|
1975
1985
|
mapValue: {
|
|
1976
1986
|
fields: {}
|
|
1977
1987
|
}
|
|
@@ -1987,7 +1997,7 @@ class Bt {
|
|
|
1987
1997
|
for (const e of n) delete t[e];
|
|
1988
1998
|
}
|
|
1989
1999
|
clone() {
|
|
1990
|
-
return new Bt(
|
|
2000
|
+
return new zt(Bt(this.value));
|
|
1991
2001
|
}
|
|
1992
2002
|
}
|
|
1993
2003
|
|
|
@@ -2016,7 +2026,7 @@ class Bt {
|
|
|
2016
2026
|
* not transition to one of these states even after all mutations have been
|
|
2017
2027
|
* applied, `isValidDocument()` returns false and the document should be removed
|
|
2018
2028
|
* from all views.
|
|
2019
|
-
*/ class
|
|
2029
|
+
*/ class Gt {
|
|
2020
2030
|
constructor(t, e, n, r, s, i) {
|
|
2021
2031
|
this.key = t, this.documentType = e, this.version = n, this.readTime = r, this.data = s,
|
|
2022
2032
|
this.documentState = i;
|
|
@@ -2025,23 +2035,23 @@ class Bt {
|
|
|
2025
2035
|
* Creates a document with no known version or data, but which can serve as
|
|
2026
2036
|
* base document for mutations.
|
|
2027
2037
|
*/ static newInvalidDocument(t) {
|
|
2028
|
-
return new
|
|
2038
|
+
return new Gt(t, 0 /* INVALID */ , bt.min(), bt.min(), zt.empty(), 0 /* SYNCED */);
|
|
2029
2039
|
}
|
|
2030
2040
|
/**
|
|
2031
2041
|
* Creates a new document that is known to exist with the given data at the
|
|
2032
2042
|
* given version.
|
|
2033
2043
|
*/ static newFoundDocument(t, e, n) {
|
|
2034
|
-
return new
|
|
2044
|
+
return new Gt(t, 1 /* FOUND_DOCUMENT */ , e, bt.min(), n, 0 /* SYNCED */);
|
|
2035
2045
|
}
|
|
2036
2046
|
/** Creates a new document that is known to not exist at the given version. */ static newNoDocument(t, e) {
|
|
2037
|
-
return new
|
|
2047
|
+
return new Gt(t, 2 /* NO_DOCUMENT */ , e, bt.min(), zt.empty(), 0 /* SYNCED */);
|
|
2038
2048
|
}
|
|
2039
2049
|
/**
|
|
2040
2050
|
* Creates a new document that is known to exist at the given version but
|
|
2041
2051
|
* whose data is not known (e.g. a document that was updated without a known
|
|
2042
2052
|
* base document).
|
|
2043
2053
|
*/ static newUnknownDocument(t, e) {
|
|
2044
|
-
return new
|
|
2054
|
+
return new Gt(t, 3 /* UNKNOWN_DOCUMENT */ , e, bt.min(), zt.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
|
|
2045
2055
|
}
|
|
2046
2056
|
/**
|
|
2047
2057
|
* Changes the document type to indicate that it exists and that its version
|
|
@@ -2054,7 +2064,7 @@ class Bt {
|
|
|
2054
2064
|
* Changes the document type to indicate that it doesn't exist at the given
|
|
2055
2065
|
* version.
|
|
2056
2066
|
*/ convertToNoDocument(t) {
|
|
2057
|
-
return this.version = t, this.documentType = 2 /* NO_DOCUMENT */ , this.data =
|
|
2067
|
+
return this.version = t, this.documentType = 2 /* NO_DOCUMENT */ , this.data = zt.empty(),
|
|
2058
2068
|
this.documentState = 0 /* SYNCED */ , this;
|
|
2059
2069
|
}
|
|
2060
2070
|
/**
|
|
@@ -2062,7 +2072,7 @@ class Bt {
|
|
|
2062
2072
|
* that its data is not known (e.g. a document that was updated without a known
|
|
2063
2073
|
* base document).
|
|
2064
2074
|
*/ convertToUnknownDocument(t) {
|
|
2065
|
-
return this.version = t, this.documentType = 3 /* UNKNOWN_DOCUMENT */ , this.data =
|
|
2075
|
+
return this.version = t, this.documentType = 3 /* UNKNOWN_DOCUMENT */ , this.data = zt.empty(),
|
|
2066
2076
|
this.documentState = 2 /* HAS_COMMITTED_MUTATIONS */ , this;
|
|
2067
2077
|
}
|
|
2068
2078
|
setHasCommittedMutations() {
|
|
@@ -2096,10 +2106,10 @@ class Bt {
|
|
|
2096
2106
|
return 3 /* UNKNOWN_DOCUMENT */ === this.documentType;
|
|
2097
2107
|
}
|
|
2098
2108
|
isEqual(t) {
|
|
2099
|
-
return t instanceof
|
|
2109
|
+
return t instanceof Gt && this.key.isEqual(t.key) && this.version.isEqual(t.version) && this.documentType === t.documentType && this.documentState === t.documentState && this.data.isEqual(t.data);
|
|
2100
2110
|
}
|
|
2101
2111
|
mutableCopy() {
|
|
2102
|
-
return new
|
|
2112
|
+
return new Gt(this.key, this.documentType, this.version, this.readTime, this.data.clone(), this.documentState);
|
|
2103
2113
|
}
|
|
2104
2114
|
toString() {
|
|
2105
2115
|
return `Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`;
|
|
@@ -2123,7 +2133,7 @@ class Bt {
|
|
|
2123
2133
|
* limitations under the License.
|
|
2124
2134
|
*/
|
|
2125
2135
|
// Visible for testing
|
|
2126
|
-
class
|
|
2136
|
+
class Qt {
|
|
2127
2137
|
constructor(t, e = null, n = [], r = [], s = null, i = null, o = null) {
|
|
2128
2138
|
this.path = t, this.collectionGroup = e, this.orderBy = n, this.filters = r, this.limit = s,
|
|
2129
2139
|
this.startAt = i, this.endAt = o, this.P = null;
|
|
@@ -2137,26 +2147,26 @@ class Gt {
|
|
|
2137
2147
|
* NOTE: you should always construct `Target` from `Query.toTarget` instead of
|
|
2138
2148
|
* using this factory method, because `Query` provides an implicit `orderBy`
|
|
2139
2149
|
* property.
|
|
2140
|
-
*/ function
|
|
2141
|
-
return new
|
|
2150
|
+
*/ function Wt(t, e = null, n = [], r = [], s = null, i = null, o = null) {
|
|
2151
|
+
return new Qt(t, e, n, r, s, i, o);
|
|
2142
2152
|
}
|
|
2143
2153
|
|
|
2144
|
-
class
|
|
2154
|
+
class Yt extends class {} {
|
|
2145
2155
|
constructor(t, e, n) {
|
|
2146
2156
|
super(), this.field = t, this.op = e, this.value = n;
|
|
2147
2157
|
}
|
|
2148
2158
|
/**
|
|
2149
2159
|
* Creates a filter based on the provided arguments.
|
|
2150
2160
|
*/ static create(t, e, n) {
|
|
2151
|
-
return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.V(t, e, n) : new
|
|
2161
|
+
return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.V(t, e, n) : new Ht(t, e, n) : "array-contains" /* ARRAY_CONTAINS */ === e ? new Zt(t, n) : "in" /* IN */ === e ? new te(t, n) : "not-in" /* NOT_IN */ === e ? new ee(t, n) : "array-contains-any" /* ARRAY_CONTAINS_ANY */ === e ? new ne(t, n) : new Yt(t, e, n);
|
|
2152
2162
|
}
|
|
2153
2163
|
static V(t, e, n) {
|
|
2154
|
-
return "in" /* IN */ === e ? new
|
|
2164
|
+
return "in" /* IN */ === e ? new Kt(t, n) : new Jt(t, n);
|
|
2155
2165
|
}
|
|
2156
2166
|
matches(t) {
|
|
2157
2167
|
const e = t.data.field(this.field);
|
|
2158
2168
|
// Types do not have to match in NOT_EQUAL filters.
|
|
2159
|
-
return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.D(
|
|
2169
|
+
return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.D(Ot(e, this.value)) : null !== e && Ft(this.value) === Ft(e) && this.D(Ot(e, this.value));
|
|
2160
2170
|
// Only compare types with matching backend order (such as double and int).
|
|
2161
2171
|
}
|
|
2162
2172
|
D(t) {
|
|
@@ -2189,7 +2199,7 @@ class Wt extends class {} {
|
|
|
2189
2199
|
}
|
|
2190
2200
|
|
|
2191
2201
|
/** Filter that matches on key fields (i.e. '__name__'). */
|
|
2192
|
-
class
|
|
2202
|
+
class Ht extends Yt {
|
|
2193
2203
|
constructor(t, e, n) {
|
|
2194
2204
|
super(t, e, n), this.key = et.fromName(n.referenceValue);
|
|
2195
2205
|
}
|
|
@@ -2199,69 +2209,69 @@ class Yt extends Wt {
|
|
|
2199
2209
|
}
|
|
2200
2210
|
}
|
|
2201
2211
|
|
|
2202
|
-
/** Filter that matches on key fields within an array. */ class
|
|
2212
|
+
/** Filter that matches on key fields within an array. */ class Kt extends Yt {
|
|
2203
2213
|
constructor(t, e) {
|
|
2204
|
-
super(t, "in" /* IN */ , e), this.keys =
|
|
2214
|
+
super(t, "in" /* IN */ , e), this.keys = Xt("in" /* IN */ , e);
|
|
2205
2215
|
}
|
|
2206
2216
|
matches(t) {
|
|
2207
2217
|
return this.keys.some((e => e.isEqual(t.key)));
|
|
2208
2218
|
}
|
|
2209
2219
|
}
|
|
2210
2220
|
|
|
2211
|
-
/** Filter that matches on key fields not present within an array. */ class
|
|
2221
|
+
/** Filter that matches on key fields not present within an array. */ class Jt extends Yt {
|
|
2212
2222
|
constructor(t, e) {
|
|
2213
|
-
super(t, "not-in" /* NOT_IN */ , e), this.keys =
|
|
2223
|
+
super(t, "not-in" /* NOT_IN */ , e), this.keys = Xt("not-in" /* NOT_IN */ , e);
|
|
2214
2224
|
}
|
|
2215
2225
|
matches(t) {
|
|
2216
2226
|
return !this.keys.some((e => e.isEqual(t.key)));
|
|
2217
2227
|
}
|
|
2218
2228
|
}
|
|
2219
2229
|
|
|
2220
|
-
function
|
|
2230
|
+
function Xt(t, e) {
|
|
2221
2231
|
var n;
|
|
2222
2232
|
return ((null === (n = e.arrayValue) || void 0 === n ? void 0 : n.values) || []).map((t => et.fromName(t.referenceValue)));
|
|
2223
2233
|
}
|
|
2224
2234
|
|
|
2225
|
-
/** A Filter that implements the array-contains operator. */ class
|
|
2235
|
+
/** A Filter that implements the array-contains operator. */ class Zt extends Yt {
|
|
2226
2236
|
constructor(t, e) {
|
|
2227
2237
|
super(t, "array-contains" /* ARRAY_CONTAINS */ , e);
|
|
2228
2238
|
}
|
|
2229
2239
|
matches(t) {
|
|
2230
2240
|
const e = t.data.field(this.field);
|
|
2231
|
-
return
|
|
2241
|
+
return Ut(e) && qt(e.arrayValue, this.value);
|
|
2232
2242
|
}
|
|
2233
2243
|
}
|
|
2234
2244
|
|
|
2235
|
-
/** A Filter that implements the IN operator. */ class
|
|
2245
|
+
/** A Filter that implements the IN operator. */ class te extends Yt {
|
|
2236
2246
|
constructor(t, e) {
|
|
2237
2247
|
super(t, "in" /* IN */ , e);
|
|
2238
2248
|
}
|
|
2239
2249
|
matches(t) {
|
|
2240
2250
|
const e = t.data.field(this.field);
|
|
2241
|
-
return null !== e &&
|
|
2251
|
+
return null !== e && qt(this.value.arrayValue, e);
|
|
2242
2252
|
}
|
|
2243
2253
|
}
|
|
2244
2254
|
|
|
2245
|
-
/** A Filter that implements the not-in operator. */ class
|
|
2255
|
+
/** A Filter that implements the not-in operator. */ class ee extends Yt {
|
|
2246
2256
|
constructor(t, e) {
|
|
2247
2257
|
super(t, "not-in" /* NOT_IN */ , e);
|
|
2248
2258
|
}
|
|
2249
2259
|
matches(t) {
|
|
2250
|
-
if (
|
|
2260
|
+
if (qt(this.value.arrayValue, {
|
|
2251
2261
|
nullValue: "NULL_VALUE"
|
|
2252
2262
|
})) return !1;
|
|
2253
2263
|
const e = t.data.field(this.field);
|
|
2254
|
-
return null !== e && !
|
|
2264
|
+
return null !== e && !qt(this.value.arrayValue, e);
|
|
2255
2265
|
}
|
|
2256
2266
|
}
|
|
2257
2267
|
|
|
2258
|
-
/** A Filter that implements the array-contains-any operator. */ class
|
|
2268
|
+
/** A Filter that implements the array-contains-any operator. */ class ne extends Yt {
|
|
2259
2269
|
constructor(t, e) {
|
|
2260
2270
|
super(t, "array-contains-any" /* ARRAY_CONTAINS_ANY */ , e);
|
|
2261
2271
|
}
|
|
2262
2272
|
matches(t) {
|
|
2263
2273
|
const e = t.data.field(this.field);
|
|
2264
|
-
return !(!
|
|
2274
|
+
return !(!Ut(e) || !e.arrayValue.values) && e.arrayValue.values.some((t => qt(this.value.arrayValue, t)));
|
|
2265
2275
|
}
|
|
2266
2276
|
}
|
|
2267
2277
|
|
|
@@ -2278,7 +2288,7 @@ function Jt(t, e) {
|
|
|
2278
2288
|
* Bound provides a function to determine whether a document comes before or
|
|
2279
2289
|
* after a bound. This is influenced by whether the position is just before or
|
|
2280
2290
|
* just after the provided values.
|
|
2281
|
-
*/ class
|
|
2291
|
+
*/ class re {
|
|
2282
2292
|
constructor(t, e) {
|
|
2283
2293
|
this.position = t, this.inclusive = e;
|
|
2284
2294
|
}
|
|
@@ -2286,22 +2296,22 @@ function Jt(t, e) {
|
|
|
2286
2296
|
|
|
2287
2297
|
/**
|
|
2288
2298
|
* An ordering on a field, in some Direction. Direction defaults to ASCENDING.
|
|
2289
|
-
*/ class
|
|
2299
|
+
*/ class se {
|
|
2290
2300
|
constructor(t, e = "asc" /* ASCENDING */) {
|
|
2291
2301
|
this.field = t, this.dir = e;
|
|
2292
2302
|
}
|
|
2293
2303
|
}
|
|
2294
2304
|
|
|
2295
|
-
function
|
|
2305
|
+
function ie(t, e) {
|
|
2296
2306
|
return t.dir === e.dir && t.field.isEqual(e.field);
|
|
2297
2307
|
}
|
|
2298
2308
|
|
|
2299
|
-
function
|
|
2309
|
+
function oe(t, e) {
|
|
2300
2310
|
if (null === t) return null === e;
|
|
2301
2311
|
if (null === e) return !1;
|
|
2302
2312
|
if (t.inclusive !== e.inclusive || t.position.length !== e.position.length) return !1;
|
|
2303
2313
|
for (let n = 0; n < t.position.length; n++) {
|
|
2304
|
-
if (!
|
|
2314
|
+
if (!xt(t.position[n], e.position[n])) return !1;
|
|
2305
2315
|
}
|
|
2306
2316
|
return !0;
|
|
2307
2317
|
}
|
|
@@ -2328,7 +2338,7 @@ function ie(t, e) {
|
|
|
2328
2338
|
* query the RemoteStore results.
|
|
2329
2339
|
*
|
|
2330
2340
|
* Visible for testing.
|
|
2331
|
-
*/ class
|
|
2341
|
+
*/ class ue {
|
|
2332
2342
|
/**
|
|
2333
2343
|
* Initializes a Query with a path and optional additional query constraints.
|
|
2334
2344
|
* Path must currently be empty if this is a collection group query.
|
|
@@ -2341,11 +2351,11 @@ function ie(t, e) {
|
|
|
2341
2351
|
}
|
|
2342
2352
|
}
|
|
2343
2353
|
|
|
2344
|
-
/** Creates a new Query for a query that matches all documents at `path` */ function
|
|
2354
|
+
/** Creates a new Query for a query that matches all documents at `path` */ function ce(t) {
|
|
2345
2355
|
return t.explicitOrderBy.length > 0 ? t.explicitOrderBy[0].field : null;
|
|
2346
2356
|
}
|
|
2347
2357
|
|
|
2348
|
-
function
|
|
2358
|
+
function ae(t) {
|
|
2349
2359
|
for (const e of t.filters) if (e.N()) return e.field;
|
|
2350
2360
|
return null;
|
|
2351
2361
|
}
|
|
@@ -2358,7 +2368,7 @@ function ce(t) {
|
|
|
2358
2368
|
* Returns whether the query matches a collection group rather than a specific
|
|
2359
2369
|
* collection.
|
|
2360
2370
|
*/
|
|
2361
|
-
function
|
|
2371
|
+
function he(t) {
|
|
2362
2372
|
return null !== t.collectionGroup;
|
|
2363
2373
|
}
|
|
2364
2374
|
|
|
@@ -2366,23 +2376,23 @@ function ae(t) {
|
|
|
2366
2376
|
* Returns the implicit order by constraint that is used to execute the Query,
|
|
2367
2377
|
* which can be different from the order by constraints the user provided (e.g.
|
|
2368
2378
|
* the SDK and backend always orders by `__name__`).
|
|
2369
|
-
*/ function
|
|
2370
|
-
const e =
|
|
2379
|
+
*/ function le(t) {
|
|
2380
|
+
const e = v(t);
|
|
2371
2381
|
if (null === e.$) {
|
|
2372
2382
|
e.$ = [];
|
|
2373
|
-
const t =
|
|
2383
|
+
const t = ae(e), n = ce(e);
|
|
2374
2384
|
if (null !== t && null === n)
|
|
2375
2385
|
// In order to implicitly add key ordering, we must also add the
|
|
2376
2386
|
// inequality filter field for it to be a valid query.
|
|
2377
2387
|
// Note that the default inequality field and key ordering is ascending.
|
|
2378
|
-
t.isKeyField() || e.$.push(new
|
|
2388
|
+
t.isKeyField() || e.$.push(new se(t)), e.$.push(new se(tt.keyField(), "asc" /* ASCENDING */)); else {
|
|
2379
2389
|
let t = !1;
|
|
2380
2390
|
for (const n of e.explicitOrderBy) e.$.push(n), n.field.isKeyField() && (t = !0);
|
|
2381
2391
|
if (!t) {
|
|
2382
2392
|
// The order of the implicit key ordering always matches the last
|
|
2383
2393
|
// explicit order by
|
|
2384
2394
|
const t = e.explicitOrderBy.length > 0 ? e.explicitOrderBy[e.explicitOrderBy.length - 1].dir : "asc" /* ASCENDING */;
|
|
2385
|
-
e.$.push(new
|
|
2395
|
+
e.$.push(new se(tt.keyField(), t));
|
|
2386
2396
|
}
|
|
2387
2397
|
}
|
|
2388
2398
|
}
|
|
@@ -2391,34 +2401,34 @@ function ae(t) {
|
|
|
2391
2401
|
|
|
2392
2402
|
/**
|
|
2393
2403
|
* Converts this `Query` instance to it's corresponding `Target` representation.
|
|
2394
|
-
*/ function
|
|
2395
|
-
const e =
|
|
2396
|
-
if (!e.S) if ("F" /* First */ === e.limitType) e.S =
|
|
2404
|
+
*/ function fe(t) {
|
|
2405
|
+
const e = v(t);
|
|
2406
|
+
if (!e.S) if ("F" /* First */ === e.limitType) e.S = Wt(e.path, e.collectionGroup, le(e), e.filters, e.limit, e.startAt, e.endAt); else {
|
|
2397
2407
|
// Flip the orderBy directions since we want the last results
|
|
2398
2408
|
const t = [];
|
|
2399
|
-
for (const n of
|
|
2409
|
+
for (const n of le(e)) {
|
|
2400
2410
|
const e = "desc" /* DESCENDING */ === n.dir ? "asc" /* ASCENDING */ : "desc" /* DESCENDING */;
|
|
2401
|
-
t.push(new
|
|
2411
|
+
t.push(new se(n.field, e));
|
|
2402
2412
|
}
|
|
2403
2413
|
// We need to swap the cursors to match the now-flipped query ordering.
|
|
2404
|
-
const n = e.endAt ? new
|
|
2414
|
+
const n = e.endAt ? new re(e.endAt.position, e.endAt.inclusive) : null, r = e.startAt ? new re(e.startAt.position, e.startAt.inclusive) : null;
|
|
2405
2415
|
// Now return as a LimitType.First query.
|
|
2406
|
-
e.S =
|
|
2416
|
+
e.S = Wt(e.path, e.collectionGroup, t, e.filters, e.limit, n, r);
|
|
2407
2417
|
}
|
|
2408
2418
|
return e.S;
|
|
2409
2419
|
}
|
|
2410
2420
|
|
|
2411
|
-
function
|
|
2421
|
+
function de(t, e) {
|
|
2412
2422
|
return function(t, e) {
|
|
2413
2423
|
if (t.limit !== e.limit) return !1;
|
|
2414
2424
|
if (t.orderBy.length !== e.orderBy.length) return !1;
|
|
2415
|
-
for (let n = 0; n < t.orderBy.length; n++) if (!
|
|
2425
|
+
for (let n = 0; n < t.orderBy.length; n++) if (!ie(t.orderBy[n], e.orderBy[n])) return !1;
|
|
2416
2426
|
if (t.filters.length !== e.filters.length) return !1;
|
|
2417
2427
|
for (let s = 0; s < t.filters.length; s++) if (n = t.filters[s], r = e.filters[s],
|
|
2418
|
-
n.op !== r.op || !n.field.isEqual(r.field) || !
|
|
2428
|
+
n.op !== r.op || !n.field.isEqual(r.field) || !xt(n.value, r.value)) return !1;
|
|
2419
2429
|
var n, r;
|
|
2420
|
-
return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!
|
|
2421
|
-
}(
|
|
2430
|
+
return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!oe(t.startAt, e.startAt) && oe(t.endAt, e.endAt);
|
|
2431
|
+
}(fe(t), fe(e)) && t.limitType === e.limitType;
|
|
2422
2432
|
}
|
|
2423
2433
|
|
|
2424
2434
|
/**
|
|
@@ -2446,7 +2456,7 @@ function fe(t, e) {
|
|
|
2446
2456
|
* The return value is an IntegerValue if it can safely represent the value,
|
|
2447
2457
|
* otherwise a DoubleValue is returned.
|
|
2448
2458
|
*/
|
|
2449
|
-
function
|
|
2459
|
+
function we(t, e) {
|
|
2450
2460
|
return function(t) {
|
|
2451
2461
|
return "number" == typeof t && Number.isInteger(t) && !at(t) && t <= Number.MAX_SAFE_INTEGER && t >= Number.MIN_SAFE_INTEGER;
|
|
2452
2462
|
}(e) ?
|
|
@@ -2491,7 +2501,7 @@ function de(t, e) {
|
|
|
2491
2501
|
* See the License for the specific language governing permissions and
|
|
2492
2502
|
* limitations under the License.
|
|
2493
2503
|
*/
|
|
2494
|
-
/** Used to represent a field transform on a mutation. */ class
|
|
2504
|
+
/** Used to represent a field transform on a mutation. */ class me {
|
|
2495
2505
|
constructor() {
|
|
2496
2506
|
// Make sure that the structural type of `TransformOperation` is unique.
|
|
2497
2507
|
// See https://github.com/microsoft/TypeScript/issues/5451
|
|
@@ -2499,15 +2509,15 @@ function de(t, e) {
|
|
|
2499
2509
|
}
|
|
2500
2510
|
}
|
|
2501
2511
|
|
|
2502
|
-
/** Transforms a value into a server-generated timestamp. */ class
|
|
2512
|
+
/** Transforms a value into a server-generated timestamp. */ class pe extends me {}
|
|
2503
2513
|
|
|
2504
|
-
/** Transforms an array value via a union operation. */ class
|
|
2514
|
+
/** Transforms an array value via a union operation. */ class ye extends me {
|
|
2505
2515
|
constructor(t) {
|
|
2506
2516
|
super(), this.elements = t;
|
|
2507
2517
|
}
|
|
2508
2518
|
}
|
|
2509
2519
|
|
|
2510
|
-
/** Transforms an array value via a remove operation. */ class
|
|
2520
|
+
/** Transforms an array value via a remove operation. */ class _e extends me {
|
|
2511
2521
|
constructor(t) {
|
|
2512
2522
|
super(), this.elements = t;
|
|
2513
2523
|
}
|
|
@@ -2518,7 +2528,7 @@ function de(t, e) {
|
|
|
2518
2528
|
* transforms. Converts all field values to integers or doubles, but unlike the
|
|
2519
2529
|
* backend does not cap integer values at 2^63. Instead, JavaScript number
|
|
2520
2530
|
* arithmetic is used and precision loss can occur for values greater than 2^53.
|
|
2521
|
-
*/ class
|
|
2531
|
+
*/ class ge extends me {
|
|
2522
2532
|
constructor(t, e) {
|
|
2523
2533
|
super(), this.q = t, this.O = e;
|
|
2524
2534
|
}
|
|
@@ -2540,7 +2550,7 @@ function de(t, e) {
|
|
|
2540
2550
|
* See the License for the specific language governing permissions and
|
|
2541
2551
|
* limitations under the License.
|
|
2542
2552
|
*/
|
|
2543
|
-
/** A field path and the TransformOperation to perform upon it. */ class
|
|
2553
|
+
/** A field path and the TransformOperation to perform upon it. */ class be {
|
|
2544
2554
|
constructor(t, e) {
|
|
2545
2555
|
this.field = t, this.transform = e;
|
|
2546
2556
|
}
|
|
@@ -2614,12 +2624,12 @@ function de(t, e) {
|
|
|
2614
2624
|
* applyToLocalView() to implement the actual behavior of applying the mutation
|
|
2615
2625
|
* to some source document (see `setMutationApplyToRemoteDocument()` for an
|
|
2616
2626
|
* example).
|
|
2617
|
-
*/ class
|
|
2627
|
+
*/ class Ee {}
|
|
2618
2628
|
|
|
2619
2629
|
/**
|
|
2620
2630
|
* A mutation that creates or replaces the document at the given key with the
|
|
2621
2631
|
* object value contents.
|
|
2622
|
-
*/ class
|
|
2632
|
+
*/ class Te extends Ee {
|
|
2623
2633
|
constructor(t, e, n, r = []) {
|
|
2624
2634
|
super(), this.key = t, this.value = e, this.precondition = n, this.fieldTransforms = r,
|
|
2625
2635
|
this.type = 0 /* Set */;
|
|
@@ -2638,14 +2648,14 @@ function de(t, e) {
|
|
|
2638
2648
|
* is deleted.
|
|
2639
2649
|
* * When a field is not in the mask but is in the values, the values map is
|
|
2640
2650
|
* ignored.
|
|
2641
|
-
*/ class
|
|
2651
|
+
*/ class Ie extends Ee {
|
|
2642
2652
|
constructor(t, e, n, r, s = []) {
|
|
2643
2653
|
super(), this.key = t, this.data = e, this.fieldMask = n, this.precondition = r,
|
|
2644
2654
|
this.fieldTransforms = s, this.type = 1 /* Patch */;
|
|
2645
2655
|
}
|
|
2646
2656
|
}
|
|
2647
2657
|
|
|
2648
|
-
/** A mutation that deletes the document at the given key. */ class
|
|
2658
|
+
/** A mutation that deletes the document at the given key. */ class Ae extends Ee {
|
|
2649
2659
|
constructor(t, e) {
|
|
2650
2660
|
super(), this.key = t, this.precondition = e, this.type = 2 /* Delete */ , this.fieldTransforms = [];
|
|
2651
2661
|
}
|
|
@@ -2657,7 +2667,7 @@ function de(t, e) {
|
|
|
2657
2667
|
*
|
|
2658
2668
|
* The `verify` operation is only used in Transactions, and this class serves
|
|
2659
2669
|
* primarily to facilitate serialization into protos.
|
|
2660
|
-
*/ class
|
|
2670
|
+
*/ class Re extends Ee {
|
|
2661
2671
|
constructor(t, e) {
|
|
2662
2672
|
super(), this.key = t, this.precondition = e, this.type = 3 /* Verify */ , this.fieldTransforms = [];
|
|
2663
2673
|
}
|
|
@@ -2678,13 +2688,13 @@ function de(t, e) {
|
|
|
2678
2688
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2679
2689
|
* See the License for the specific language governing permissions and
|
|
2680
2690
|
* limitations under the License.
|
|
2681
|
-
*/ const
|
|
2691
|
+
*/ const Pe = (() => {
|
|
2682
2692
|
const t = {
|
|
2683
2693
|
asc: "ASCENDING",
|
|
2684
2694
|
desc: "DESCENDING"
|
|
2685
2695
|
};
|
|
2686
2696
|
return t;
|
|
2687
|
-
})(),
|
|
2697
|
+
})(), Ve = (() => {
|
|
2688
2698
|
const t = {
|
|
2689
2699
|
"<": "LESS_THAN",
|
|
2690
2700
|
"<=": "LESS_THAN_OR_EQUAL",
|
|
@@ -2714,7 +2724,7 @@ function de(t, e) {
|
|
|
2714
2724
|
* TODO(klimt): We can remove the databaseId argument if we keep the full
|
|
2715
2725
|
* resource name in documents.
|
|
2716
2726
|
*/
|
|
2717
|
-
class
|
|
2727
|
+
class De {
|
|
2718
2728
|
constructor(t, e) {
|
|
2719
2729
|
this.databaseId = t, this.F = e;
|
|
2720
2730
|
}
|
|
@@ -2731,7 +2741,7 @@ class Ve {
|
|
|
2731
2741
|
/**
|
|
2732
2742
|
* Returns a value for a Date that's appropriate to put into a proto.
|
|
2733
2743
|
*/
|
|
2734
|
-
function
|
|
2744
|
+
function Ne(t, e) {
|
|
2735
2745
|
if (t.F) {
|
|
2736
2746
|
return `${new Date(1e3 * e.seconds).toISOString().replace(/\.\d*/, "").replace("Z", "")}.${("000000000" + e.nanoseconds).slice(-9)}Z`;
|
|
2737
2747
|
}
|
|
@@ -2746,129 +2756,129 @@ function De(t, e) {
|
|
|
2746
2756
|
*
|
|
2747
2757
|
* Visible for testing.
|
|
2748
2758
|
*/
|
|
2749
|
-
function
|
|
2759
|
+
function $e(t, e) {
|
|
2750
2760
|
return t.F ? e.toBase64() : e.toUint8Array();
|
|
2751
2761
|
}
|
|
2752
2762
|
|
|
2753
|
-
function
|
|
2754
|
-
return
|
|
2763
|
+
function Se(t, e) {
|
|
2764
|
+
return Ne(t, e.toTimestamp());
|
|
2755
2765
|
}
|
|
2756
2766
|
|
|
2757
|
-
function
|
|
2758
|
-
return
|
|
2767
|
+
function Fe(t) {
|
|
2768
|
+
return b(!!t), bt.fromTimestamp(function(t) {
|
|
2759
2769
|
const e = Rt(t);
|
|
2760
2770
|
return new gt(e.seconds, e.nanos);
|
|
2761
2771
|
}(t));
|
|
2762
2772
|
}
|
|
2763
2773
|
|
|
2764
|
-
function
|
|
2774
|
+
function xe(t, e) {
|
|
2765
2775
|
return function(t) {
|
|
2766
2776
|
return new X([ "projects", t.projectId, "databases", t.database ]);
|
|
2767
2777
|
}(t).child("documents").child(e).canonicalString();
|
|
2768
2778
|
}
|
|
2769
2779
|
|
|
2770
|
-
function
|
|
2771
|
-
return
|
|
2780
|
+
function qe(t, e) {
|
|
2781
|
+
return xe(t.databaseId, e.path);
|
|
2772
2782
|
}
|
|
2773
2783
|
|
|
2774
|
-
function
|
|
2784
|
+
function Oe(t, e) {
|
|
2775
2785
|
const n = function(t) {
|
|
2776
2786
|
const e = X.fromString(t);
|
|
2777
|
-
return
|
|
2787
|
+
return b(We(e)), e;
|
|
2778
2788
|
}(e);
|
|
2779
2789
|
if (n.get(1) !== t.databaseId.projectId) throw new U(A, "Tried to deserialize key from different project: " + n.get(1) + " vs " + t.databaseId.projectId);
|
|
2780
2790
|
if (n.get(3) !== t.databaseId.database) throw new U(A, "Tried to deserialize key from different database: " + n.get(3) + " vs " + t.databaseId.database);
|
|
2781
|
-
return new et((
|
|
2791
|
+
return new et((b((r = n).length > 4 && "documents" === r.get(4)), r.popFirst(5)));
|
|
2782
2792
|
var r;
|
|
2783
2793
|
/** Creates a Document proto from key and fields (but no create/update time) */}
|
|
2784
2794
|
|
|
2785
|
-
function
|
|
2786
|
-
return
|
|
2795
|
+
function Ce(t, e) {
|
|
2796
|
+
return xe(t.databaseId, e);
|
|
2787
2797
|
}
|
|
2788
2798
|
|
|
2789
|
-
function
|
|
2799
|
+
function Le(t) {
|
|
2790
2800
|
return new X([ "projects", t.databaseId.projectId, "databases", t.databaseId.database ]).canonicalString();
|
|
2791
2801
|
}
|
|
2792
2802
|
|
|
2793
|
-
function
|
|
2803
|
+
function Ue(t, e, n) {
|
|
2794
2804
|
return {
|
|
2795
|
-
name:
|
|
2805
|
+
name: qe(t, e),
|
|
2796
2806
|
fields: n.value.mapValue.fields
|
|
2797
2807
|
};
|
|
2798
2808
|
}
|
|
2799
2809
|
|
|
2800
|
-
function
|
|
2810
|
+
function ke(t, e) {
|
|
2801
2811
|
return "found" in e ? function(t, e) {
|
|
2802
|
-
|
|
2803
|
-
const n =
|
|
2812
|
+
b(!!e.found), e.found.name, e.found.updateTime;
|
|
2813
|
+
const n = Oe(t, e.found.name), r = Fe(e.found.updateTime), s = new zt({
|
|
2804
2814
|
mapValue: {
|
|
2805
2815
|
fields: e.found.fields
|
|
2806
2816
|
}
|
|
2807
2817
|
});
|
|
2808
|
-
return
|
|
2818
|
+
return Gt.newFoundDocument(n, r, s);
|
|
2809
2819
|
}(t, e) : "missing" in e ? function(t, e) {
|
|
2810
|
-
|
|
2811
|
-
const n =
|
|
2812
|
-
return
|
|
2820
|
+
b(!!e.missing), b(!!e.readTime);
|
|
2821
|
+
const n = Oe(t, e.missing), r = Fe(e.readTime);
|
|
2822
|
+
return Gt.newNoDocument(n, r);
|
|
2813
2823
|
}(t, e) : g();
|
|
2814
2824
|
}
|
|
2815
2825
|
|
|
2816
|
-
function
|
|
2826
|
+
function je(t, e) {
|
|
2817
2827
|
let n;
|
|
2818
|
-
if (e instanceof
|
|
2819
|
-
update:
|
|
2828
|
+
if (e instanceof Te) n = {
|
|
2829
|
+
update: Ue(t, e.key, e.value)
|
|
2830
|
+
}; else if (e instanceof Ae) n = {
|
|
2831
|
+
delete: qe(t, e.key)
|
|
2820
2832
|
}; else if (e instanceof Ie) n = {
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
update: Le(t, e.key, e.data),
|
|
2824
|
-
updateMask: Ge(e.fieldMask)
|
|
2833
|
+
update: Ue(t, e.key, e.data),
|
|
2834
|
+
updateMask: Qe(e.fieldMask)
|
|
2825
2835
|
}; else {
|
|
2826
|
-
if (!(e instanceof
|
|
2836
|
+
if (!(e instanceof Re)) return g();
|
|
2827
2837
|
n = {
|
|
2828
|
-
verify:
|
|
2838
|
+
verify: qe(t, e.key)
|
|
2829
2839
|
};
|
|
2830
2840
|
}
|
|
2831
2841
|
return e.fieldTransforms.length > 0 && (n.updateTransforms = e.fieldTransforms.map((t => function(t, e) {
|
|
2832
2842
|
const n = e.transform;
|
|
2833
|
-
if (n instanceof
|
|
2843
|
+
if (n instanceof pe) return {
|
|
2834
2844
|
fieldPath: e.field.canonicalString(),
|
|
2835
2845
|
setToServerValue: "REQUEST_TIME"
|
|
2836
2846
|
};
|
|
2837
|
-
if (n instanceof
|
|
2847
|
+
if (n instanceof ye) return {
|
|
2838
2848
|
fieldPath: e.field.canonicalString(),
|
|
2839
2849
|
appendMissingElements: {
|
|
2840
2850
|
values: n.elements
|
|
2841
2851
|
}
|
|
2842
2852
|
};
|
|
2843
|
-
if (n instanceof
|
|
2853
|
+
if (n instanceof _e) return {
|
|
2844
2854
|
fieldPath: e.field.canonicalString(),
|
|
2845
2855
|
removeAllFromArray: {
|
|
2846
2856
|
values: n.elements
|
|
2847
2857
|
}
|
|
2848
2858
|
};
|
|
2849
|
-
if (n instanceof
|
|
2859
|
+
if (n instanceof ge) return {
|
|
2850
2860
|
fieldPath: e.field.canonicalString(),
|
|
2851
2861
|
increment: n.O
|
|
2852
2862
|
};
|
|
2853
2863
|
throw g();
|
|
2854
2864
|
}(0, t)))), e.precondition.isNone || (n.currentDocument = function(t, e) {
|
|
2855
2865
|
return void 0 !== e.updateTime ? {
|
|
2856
|
-
updateTime:
|
|
2866
|
+
updateTime: Se(t, e.updateTime)
|
|
2857
2867
|
} : void 0 !== e.exists ? {
|
|
2858
2868
|
exists: e.exists
|
|
2859
2869
|
} : g();
|
|
2860
2870
|
}(t, e.precondition)), n;
|
|
2861
2871
|
}
|
|
2862
2872
|
|
|
2863
|
-
function
|
|
2873
|
+
function Me(t, e) {
|
|
2864
2874
|
// Dissect the path into parent, collectionId, and optional key filter.
|
|
2865
2875
|
const n = {
|
|
2866
2876
|
structuredQuery: {}
|
|
2867
2877
|
}, r = e.path;
|
|
2868
|
-
null !== e.collectionGroup ? (n.parent =
|
|
2878
|
+
null !== e.collectionGroup ? (n.parent = Ce(t, r), n.structuredQuery.from = [ {
|
|
2869
2879
|
collectionId: e.collectionGroup,
|
|
2870
2880
|
allDescendants: !0
|
|
2871
|
-
} ]) : (n.parent =
|
|
2881
|
+
} ]) : (n.parent = Ce(t, r.popLast()), n.structuredQuery.from = [ {
|
|
2872
2882
|
collectionId: r.lastSegment()
|
|
2873
2883
|
} ]);
|
|
2874
2884
|
const s = function(t) {
|
|
@@ -2877,36 +2887,36 @@ function je(t, e) {
|
|
|
2877
2887
|
// visible for testing
|
|
2878
2888
|
function(t) {
|
|
2879
2889
|
if ("==" /* EQUAL */ === t.op) {
|
|
2880
|
-
if (
|
|
2890
|
+
if (jt(t.value)) return {
|
|
2881
2891
|
unaryFilter: {
|
|
2882
|
-
field:
|
|
2892
|
+
field: Ge(t.field),
|
|
2883
2893
|
op: "IS_NAN"
|
|
2884
2894
|
}
|
|
2885
2895
|
};
|
|
2886
|
-
if (
|
|
2896
|
+
if (kt(t.value)) return {
|
|
2887
2897
|
unaryFilter: {
|
|
2888
|
-
field:
|
|
2898
|
+
field: Ge(t.field),
|
|
2889
2899
|
op: "IS_NULL"
|
|
2890
2900
|
}
|
|
2891
2901
|
};
|
|
2892
2902
|
} else if ("!=" /* NOT_EQUAL */ === t.op) {
|
|
2893
|
-
if (
|
|
2903
|
+
if (jt(t.value)) return {
|
|
2894
2904
|
unaryFilter: {
|
|
2895
|
-
field:
|
|
2905
|
+
field: Ge(t.field),
|
|
2896
2906
|
op: "IS_NOT_NAN"
|
|
2897
2907
|
}
|
|
2898
2908
|
};
|
|
2899
|
-
if (
|
|
2909
|
+
if (kt(t.value)) return {
|
|
2900
2910
|
unaryFilter: {
|
|
2901
|
-
field:
|
|
2911
|
+
field: Ge(t.field),
|
|
2902
2912
|
op: "IS_NOT_NULL"
|
|
2903
2913
|
}
|
|
2904
2914
|
};
|
|
2905
2915
|
}
|
|
2906
2916
|
return {
|
|
2907
2917
|
fieldFilter: {
|
|
2908
|
-
field:
|
|
2909
|
-
op:
|
|
2918
|
+
field: Ge(t.field),
|
|
2919
|
+
op: ze(t.op),
|
|
2910
2920
|
value: t.value
|
|
2911
2921
|
}
|
|
2912
2922
|
};
|
|
@@ -2926,8 +2936,8 @@ function je(t, e) {
|
|
|
2926
2936
|
// visible for testing
|
|
2927
2937
|
function(t) {
|
|
2928
2938
|
return {
|
|
2929
|
-
field:
|
|
2930
|
-
direction:
|
|
2939
|
+
field: Ge(t.field),
|
|
2940
|
+
direction: Be(t.dir)
|
|
2931
2941
|
};
|
|
2932
2942
|
}(t)));
|
|
2933
2943
|
}(e.orderBy);
|
|
@@ -2951,29 +2961,29 @@ function je(t, e) {
|
|
|
2951
2961
|
(e.endAt)), n;
|
|
2952
2962
|
}
|
|
2953
2963
|
|
|
2954
|
-
function Me(t) {
|
|
2955
|
-
return Re[t];
|
|
2956
|
-
}
|
|
2957
|
-
|
|
2958
|
-
// visible for testing
|
|
2959
2964
|
function Be(t) {
|
|
2960
2965
|
return Pe[t];
|
|
2961
2966
|
}
|
|
2962
2967
|
|
|
2968
|
+
// visible for testing
|
|
2963
2969
|
function ze(t) {
|
|
2970
|
+
return Ve[t];
|
|
2971
|
+
}
|
|
2972
|
+
|
|
2973
|
+
function Ge(t) {
|
|
2964
2974
|
return {
|
|
2965
2975
|
fieldPath: t.canonicalString()
|
|
2966
2976
|
};
|
|
2967
2977
|
}
|
|
2968
2978
|
|
|
2969
|
-
function
|
|
2979
|
+
function Qe(t) {
|
|
2970
2980
|
const e = [];
|
|
2971
2981
|
return t.fields.forEach((t => e.push(t.canonicalString()))), {
|
|
2972
2982
|
fieldPaths: e
|
|
2973
2983
|
};
|
|
2974
2984
|
}
|
|
2975
2985
|
|
|
2976
|
-
function
|
|
2986
|
+
function We(t) {
|
|
2977
2987
|
// Resource names have at least 4 components (project ID, database ID)
|
|
2978
2988
|
return t.length >= 4 && "projects" === t.get(0) && "databases" === t.get(2);
|
|
2979
2989
|
}
|
|
@@ -2993,8 +3003,8 @@ function Qe(t) {
|
|
|
2993
3003
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2994
3004
|
* See the License for the specific language governing permissions and
|
|
2995
3005
|
* limitations under the License.
|
|
2996
|
-
*/ function
|
|
2997
|
-
return new
|
|
3006
|
+
*/ function Ye(t) {
|
|
3007
|
+
return new De(t, /* useProto3Json= */ !0);
|
|
2998
3008
|
}
|
|
2999
3009
|
|
|
3000
3010
|
/**
|
|
@@ -3022,7 +3032,7 @@ function Qe(t) {
|
|
|
3022
3032
|
* base delay. This prevents clients from accidentally synchronizing their
|
|
3023
3033
|
* delays causing spikes of load to the backend.
|
|
3024
3034
|
*/
|
|
3025
|
-
class
|
|
3035
|
+
class He {
|
|
3026
3036
|
constructor(
|
|
3027
3037
|
/**
|
|
3028
3038
|
* The AsyncQueue to run backoff operations on.
|
|
@@ -3120,7 +3130,7 @@ class Ye {
|
|
|
3120
3130
|
* An implementation of Datastore that exposes additional state for internal
|
|
3121
3131
|
* consumption.
|
|
3122
3132
|
*/
|
|
3123
|
-
class
|
|
3133
|
+
class Ke extends class {} {
|
|
3124
3134
|
constructor(t, e, n, r) {
|
|
3125
3135
|
super(), this.authCredentials = t, this.appCheckCredentials = e, this.K = n, this.q = r,
|
|
3126
3136
|
this.J = !1;
|
|
@@ -3147,38 +3157,38 @@ class He extends class {} {
|
|
|
3147
3157
|
|
|
3148
3158
|
// TODO(firestorexp): Make sure there is only one Datastore instance per
|
|
3149
3159
|
// firestore-exp client.
|
|
3150
|
-
async function
|
|
3151
|
-
const n =
|
|
3152
|
-
writes: e.map((t =>
|
|
3160
|
+
async function Je(t, e) {
|
|
3161
|
+
const n = v(t), r = Le(n.q) + "/documents", s = {
|
|
3162
|
+
writes: e.map((t => je(n.q, t)))
|
|
3153
3163
|
};
|
|
3154
3164
|
await n.m("Commit", r, s);
|
|
3155
3165
|
}
|
|
3156
3166
|
|
|
3157
|
-
async function
|
|
3158
|
-
const n =
|
|
3159
|
-
documents: e.map((t =>
|
|
3167
|
+
async function Xe(t, e) {
|
|
3168
|
+
const n = v(t), r = Le(n.q) + "/documents", s = {
|
|
3169
|
+
documents: e.map((t => qe(n.q, t)))
|
|
3160
3170
|
}, i = await n.T("BatchGetDocuments", r, s), o = new Map;
|
|
3161
3171
|
i.forEach((t => {
|
|
3162
|
-
const e =
|
|
3172
|
+
const e = ke(n.q, t);
|
|
3163
3173
|
o.set(e.key.toString(), e);
|
|
3164
3174
|
}));
|
|
3165
3175
|
const u = [];
|
|
3166
3176
|
return e.forEach((t => {
|
|
3167
3177
|
const e = o.get(t.toString());
|
|
3168
|
-
|
|
3178
|
+
b(!!e), u.push(e);
|
|
3169
3179
|
})), u;
|
|
3170
3180
|
}
|
|
3171
3181
|
|
|
3172
|
-
async function
|
|
3173
|
-
const n =
|
|
3182
|
+
async function Ze(t, e) {
|
|
3183
|
+
const n = v(t), r = Me(n.q, fe(e));
|
|
3174
3184
|
return (await n.T("RunQuery", r.parent, {
|
|
3175
3185
|
structuredQuery: r.structuredQuery
|
|
3176
3186
|
})).filter((t => !!t.document)).map((t => function(t, e, n) {
|
|
3177
|
-
const r =
|
|
3187
|
+
const r = Oe(t, e.name), s = Fe(e.updateTime), i = new zt({
|
|
3178
3188
|
mapValue: {
|
|
3179
3189
|
fields: e.fields
|
|
3180
3190
|
}
|
|
3181
|
-
}), o =
|
|
3191
|
+
}), o = Gt.newFoundDocument(r, s, i);
|
|
3182
3192
|
return n && o.setHasCommittedMutations(), n ? o.setHasCommittedMutations() : o;
|
|
3183
3193
|
}(n.q, t.document, void 0)));
|
|
3184
3194
|
}
|
|
@@ -3198,7 +3208,7 @@ async function Xe(t, e) {
|
|
|
3198
3208
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3199
3209
|
* See the License for the specific language governing permissions and
|
|
3200
3210
|
* limitations under the License.
|
|
3201
|
-
*/ const
|
|
3211
|
+
*/ const tn = new Map;
|
|
3202
3212
|
|
|
3203
3213
|
/**
|
|
3204
3214
|
* An instance map that ensures only one Datastore exists per Firestore
|
|
@@ -3209,17 +3219,17 @@ async function Xe(t, e) {
|
|
|
3209
3219
|
* instance. Callers must invoke removeComponents() when the Firestore
|
|
3210
3220
|
* instance is terminated.
|
|
3211
3221
|
*/
|
|
3212
|
-
function
|
|
3222
|
+
function en(t) {
|
|
3213
3223
|
if (t._terminated) throw new U(S, "The client has already been terminated.");
|
|
3214
|
-
if (!
|
|
3224
|
+
if (!tn.has(t)) {
|
|
3215
3225
|
m("ComponentProvider", "Initializing Datastore");
|
|
3216
3226
|
const i = function(t) {
|
|
3217
3227
|
return new wt(t, fetch.bind(null));
|
|
3218
3228
|
}((e = t._databaseId, n = t.app.options.appId || "", r = t._persistenceKey, s = t._freezeSettings(),
|
|
3219
|
-
new H(e, n, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), o =
|
|
3220
|
-
return new
|
|
3229
|
+
new H(e, n, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), o = Ye(t._databaseId), u = function(t, e, n, r) {
|
|
3230
|
+
return new Ke(t, e, n, r);
|
|
3221
3231
|
}(t._authCredentials, t._appCheckCredentials, i, o);
|
|
3222
|
-
|
|
3232
|
+
tn.set(t, u);
|
|
3223
3233
|
}
|
|
3224
3234
|
var e, n, r, s;
|
|
3225
3235
|
/**
|
|
@@ -3237,7 +3247,7 @@ function tn(t) {
|
|
|
3237
3247
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3238
3248
|
* See the License for the specific language governing permissions and
|
|
3239
3249
|
* limitations under the License.
|
|
3240
|
-
*/ return
|
|
3250
|
+
*/ return tn.get(t);
|
|
3241
3251
|
}
|
|
3242
3252
|
|
|
3243
3253
|
/**
|
|
@@ -3249,7 +3259,7 @@ function tn(t) {
|
|
|
3249
3259
|
* user-supplied `FirestoreSettings` object. This is a separate type so that
|
|
3250
3260
|
* defaults can be supplied and the value can be checked for equality.
|
|
3251
3261
|
*/
|
|
3252
|
-
class
|
|
3262
|
+
class nn {
|
|
3253
3263
|
constructor(t) {
|
|
3254
3264
|
var e;
|
|
3255
3265
|
if (void 0 === t.host) {
|
|
@@ -3291,14 +3301,14 @@ class en {
|
|
|
3291
3301
|
* The Cloud Firestore service interface.
|
|
3292
3302
|
*
|
|
3293
3303
|
* Do not call this constructor directly. Instead, use {@link getFirestore}.
|
|
3294
|
-
*/ class
|
|
3304
|
+
*/ class rn {
|
|
3295
3305
|
/** @hideconstructor */
|
|
3296
3306
|
constructor(t, e, n) {
|
|
3297
3307
|
this._authCredentials = e, this._appCheckCredentials = n,
|
|
3298
3308
|
/**
|
|
3299
3309
|
* Whether it's a Firestore or Firestore Lite instance.
|
|
3300
3310
|
*/
|
|
3301
|
-
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new
|
|
3311
|
+
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new nn({}),
|
|
3302
3312
|
this._settingsFrozen = !1, t instanceof K ? this._databaseId = t : (this._app = t,
|
|
3303
3313
|
this._databaseId = function(t) {
|
|
3304
3314
|
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new U(A, '"projectId" not provided in firebase.initializeApp.');
|
|
@@ -3331,13 +3341,13 @@ class en {
|
|
|
3331
3341
|
}
|
|
3332
3342
|
_setSettings(t) {
|
|
3333
3343
|
if (this._settingsFrozen) throw new U(S, "Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");
|
|
3334
|
-
this._settings = new
|
|
3344
|
+
this._settings = new nn(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
|
|
3335
3345
|
if (!t) return new M;
|
|
3336
3346
|
switch (t.type) {
|
|
3337
3347
|
case "gapi":
|
|
3338
3348
|
const e = t.client;
|
|
3339
3349
|
// Make sure this really is a Gapi client.
|
|
3340
|
-
return
|
|
3350
|
+
return b(!("object" != typeof e || null === e || !e.auth || !e.auth.getAuthHeaderValueForFirstParty)),
|
|
3341
3351
|
new Q(e, t.sessionIndex || "0", t.iamToken || null);
|
|
3342
3352
|
|
|
3343
3353
|
case "provider":
|
|
@@ -3372,13 +3382,13 @@ class en {
|
|
|
3372
3382
|
* Only ever called once.
|
|
3373
3383
|
*/ _terminate() {
|
|
3374
3384
|
return function(t) {
|
|
3375
|
-
const e =
|
|
3376
|
-
e && (m("ComponentProvider", "Removing Datastore"),
|
|
3385
|
+
const e = tn.get(t);
|
|
3386
|
+
e && (m("ComponentProvider", "Removing Datastore"), tn.delete(t), e.terminate());
|
|
3377
3387
|
}(this), Promise.resolve();
|
|
3378
3388
|
}
|
|
3379
3389
|
}
|
|
3380
3390
|
|
|
3381
|
-
function
|
|
3391
|
+
function sn(t, e) {
|
|
3382
3392
|
const n = _getProvider(t, "firestore/lite");
|
|
3383
3393
|
if (n.isInitialized()) throw new U(S, "Firestore can only be initialized once per app.");
|
|
3384
3394
|
return n.initialize({
|
|
@@ -3394,7 +3404,7 @@ function rn(t, e) {
|
|
|
3394
3404
|
* @param app - The {@link @firebase/app#FirebaseApp} instance that the returned `Firestore`
|
|
3395
3405
|
* instance is associated with.
|
|
3396
3406
|
* @returns The `Firestore` instance of the provided app.
|
|
3397
|
-
*/ function
|
|
3407
|
+
*/ function on(e = getApp()) {
|
|
3398
3408
|
return _getProvider(e, "firestore/lite").getImmediate();
|
|
3399
3409
|
}
|
|
3400
3410
|
|
|
@@ -3410,9 +3420,9 @@ function rn(t, e) {
|
|
|
3410
3420
|
* @param port - the emulator port (ex: 9000).
|
|
3411
3421
|
* @param options.mockUserToken - the mock auth token to use for unit testing
|
|
3412
3422
|
* Security Rules.
|
|
3413
|
-
*/ function
|
|
3423
|
+
*/ function un(t, e, n, r = {}) {
|
|
3414
3424
|
var s;
|
|
3415
|
-
const i = (t = ot(t,
|
|
3425
|
+
const i = (t = ot(t, rn))._getSettings();
|
|
3416
3426
|
if ("firestore.googleapis.com" !== i.host && i.host !== e && y("Host has been set in both settings() and useEmulator(), emulator host will be used"),
|
|
3417
3427
|
t._setSettings(Object.assign(Object.assign({}, i), {
|
|
3418
3428
|
host: `${e}:${n}`,
|
|
@@ -3450,8 +3460,8 @@ function rn(t, e) {
|
|
|
3450
3460
|
* @param firestore - The `Firestore` instance to terminate.
|
|
3451
3461
|
* @returns A `Promise` that is resolved when the instance has been successfully
|
|
3452
3462
|
* terminated.
|
|
3453
|
-
*/ function
|
|
3454
|
-
return t = ot(t,
|
|
3463
|
+
*/ function cn(t) {
|
|
3464
|
+
return t = ot(t, rn), _removeServiceInstance(t.app, "firestore/lite"), t._delete();
|
|
3455
3465
|
}
|
|
3456
3466
|
|
|
3457
3467
|
/**
|
|
@@ -3491,7 +3501,7 @@ function rn(t, e) {
|
|
|
3491
3501
|
* and can be used to write, read, or listen to the location. The document at
|
|
3492
3502
|
* the referenced location may or may not exist.
|
|
3493
3503
|
*/
|
|
3494
|
-
class
|
|
3504
|
+
class an {
|
|
3495
3505
|
/** @hideconstructor */
|
|
3496
3506
|
constructor(t,
|
|
3497
3507
|
/**
|
|
@@ -3519,17 +3529,17 @@ class cn {
|
|
|
3519
3529
|
/**
|
|
3520
3530
|
* The collection this `DocumentReference` belongs to.
|
|
3521
3531
|
*/ get parent() {
|
|
3522
|
-
return new
|
|
3532
|
+
return new ln(this.firestore, this.converter, this._key.path.popLast());
|
|
3523
3533
|
}
|
|
3524
3534
|
withConverter(t) {
|
|
3525
|
-
return new
|
|
3535
|
+
return new an(this.firestore, t, this._key);
|
|
3526
3536
|
}
|
|
3527
3537
|
}
|
|
3528
3538
|
|
|
3529
3539
|
/**
|
|
3530
3540
|
* A `Query` refers to a query which you can read or listen to. You can also
|
|
3531
3541
|
* construct refined `Query` objects by adding filters and ordering.
|
|
3532
|
-
*/ class
|
|
3542
|
+
*/ class hn {
|
|
3533
3543
|
// This is the lite version of the Query class in the main SDK.
|
|
3534
3544
|
/** @hideconstructor protected */
|
|
3535
3545
|
constructor(t,
|
|
@@ -3542,17 +3552,17 @@ class cn {
|
|
|
3542
3552
|
this.type = "query", this.firestore = t;
|
|
3543
3553
|
}
|
|
3544
3554
|
withConverter(t) {
|
|
3545
|
-
return new
|
|
3555
|
+
return new hn(this.firestore, t, this._query);
|
|
3546
3556
|
}
|
|
3547
3557
|
}
|
|
3548
3558
|
|
|
3549
3559
|
/**
|
|
3550
3560
|
* A `CollectionReference` object can be used for adding documents, getting
|
|
3551
3561
|
* document references, and querying for documents (using {@link query}).
|
|
3552
|
-
*/ class
|
|
3562
|
+
*/ class ln extends hn {
|
|
3553
3563
|
/** @hideconstructor */
|
|
3554
3564
|
constructor(t, e, n) {
|
|
3555
|
-
super(t, e, new
|
|
3565
|
+
super(t, e, new ue(n)), this._path = n,
|
|
3556
3566
|
/** The type of this Firestore reference. */
|
|
3557
3567
|
this.type = "collection";
|
|
3558
3568
|
}
|
|
@@ -3570,23 +3580,23 @@ class cn {
|
|
|
3570
3580
|
* subcollection. If this isn't a subcollection, the reference is null.
|
|
3571
3581
|
*/ get parent() {
|
|
3572
3582
|
const t = this._path.popLast();
|
|
3573
|
-
return t.isEmpty() ? null : new
|
|
3583
|
+
return t.isEmpty() ? null : new an(this.firestore,
|
|
3574
3584
|
/* converter= */ null, new et(t));
|
|
3575
3585
|
}
|
|
3576
3586
|
withConverter(t) {
|
|
3577
|
-
return new
|
|
3587
|
+
return new ln(this.firestore, t, this._path);
|
|
3578
3588
|
}
|
|
3579
3589
|
}
|
|
3580
3590
|
|
|
3581
|
-
function
|
|
3582
|
-
if (t = getModularInstance(t), nt("collection", "path", e), t instanceof
|
|
3591
|
+
function fn(t, e, ...n) {
|
|
3592
|
+
if (t = getModularInstance(t), nt("collection", "path", e), t instanceof rn) {
|
|
3583
3593
|
const r = X.fromString(e, ...n);
|
|
3584
|
-
return st(r), new
|
|
3594
|
+
return st(r), new ln(t, /* converter= */ null, r);
|
|
3585
3595
|
}
|
|
3586
3596
|
{
|
|
3587
|
-
if (!(t instanceof
|
|
3597
|
+
if (!(t instanceof an || t instanceof ln)) throw new U(A, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
3588
3598
|
const r = t._path.child(X.fromString(e, ...n));
|
|
3589
|
-
return st(r), new
|
|
3599
|
+
return st(r), new ln(t.firestore,
|
|
3590
3600
|
/* converter= */ null, r);
|
|
3591
3601
|
}
|
|
3592
3602
|
}
|
|
@@ -3603,32 +3613,32 @@ function ln(t, e, ...n) {
|
|
|
3603
3613
|
* collection or subcollection with this ID as the last segment of its path
|
|
3604
3614
|
* will be included. Cannot contain a slash.
|
|
3605
3615
|
* @returns The created `Query`.
|
|
3606
|
-
*/ function
|
|
3607
|
-
if (t = ot(t,
|
|
3608
|
-
return new
|
|
3616
|
+
*/ function dn(t, e) {
|
|
3617
|
+
if (t = ot(t, rn), nt("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new U(A, `Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
|
|
3618
|
+
return new hn(t,
|
|
3609
3619
|
/* converter= */ null,
|
|
3610
3620
|
/**
|
|
3611
3621
|
* Creates a new Query for a collection group query that matches all documents
|
|
3612
3622
|
* within the provided collection group.
|
|
3613
3623
|
*/
|
|
3614
3624
|
function(t) {
|
|
3615
|
-
return new
|
|
3625
|
+
return new ue(X.emptyPath(), t);
|
|
3616
3626
|
}(e));
|
|
3617
3627
|
}
|
|
3618
3628
|
|
|
3619
|
-
function
|
|
3629
|
+
function wn(t, e, ...n) {
|
|
3620
3630
|
if (t = getModularInstance(t),
|
|
3621
3631
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
3622
3632
|
// 'undefined' and 'null'.
|
|
3623
|
-
1 === arguments.length && (e = pt.R()), nt("doc", "path", e), t instanceof
|
|
3633
|
+
1 === arguments.length && (e = pt.R()), nt("doc", "path", e), t instanceof rn) {
|
|
3624
3634
|
const r = X.fromString(e, ...n);
|
|
3625
|
-
return rt(r), new
|
|
3635
|
+
return rt(r), new an(t,
|
|
3626
3636
|
/* converter= */ null, new et(r));
|
|
3627
3637
|
}
|
|
3628
3638
|
{
|
|
3629
|
-
if (!(t instanceof
|
|
3639
|
+
if (!(t instanceof an || t instanceof ln)) throw new U(A, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
3630
3640
|
const r = t._path.child(X.fromString(e, ...n));
|
|
3631
|
-
return rt(r), new
|
|
3641
|
+
return rt(r), new an(t.firestore, t instanceof ln ? t.converter : null, new et(r));
|
|
3632
3642
|
}
|
|
3633
3643
|
}
|
|
3634
3644
|
|
|
@@ -3639,8 +3649,8 @@ function dn(t, e, ...n) {
|
|
|
3639
3649
|
* @param right - A reference to compare.
|
|
3640
3650
|
* @returns true if the references point to the same location in the same
|
|
3641
3651
|
* Firestore database.
|
|
3642
|
-
*/ function
|
|
3643
|
-
return t = getModularInstance(t), e = getModularInstance(e), (t instanceof
|
|
3652
|
+
*/ function mn(t, e) {
|
|
3653
|
+
return t = getModularInstance(t), e = getModularInstance(e), (t instanceof an || t instanceof ln) && (e instanceof an || e instanceof ln) && (t.firestore === e.firestore && t.path === e.path && t.converter === e.converter);
|
|
3644
3654
|
}
|
|
3645
3655
|
|
|
3646
3656
|
/**
|
|
@@ -3651,8 +3661,8 @@ function dn(t, e, ...n) {
|
|
|
3651
3661
|
* @param right - A `Query` to compare.
|
|
3652
3662
|
* @returns true if the references point to the same location in the same
|
|
3653
3663
|
* Firestore database.
|
|
3654
|
-
*/ function
|
|
3655
|
-
return t = getModularInstance(t), e = getModularInstance(e), t instanceof
|
|
3664
|
+
*/ function pn(t, e) {
|
|
3665
|
+
return t = getModularInstance(t), e = getModularInstance(e), t instanceof hn && e instanceof hn && (t.firestore === e.firestore && de(t._query, e._query) && t.converter === e.converter);
|
|
3656
3666
|
}
|
|
3657
3667
|
|
|
3658
3668
|
/**
|
|
@@ -3678,7 +3688,7 @@ function dn(t, e, ...n) {
|
|
|
3678
3688
|
*
|
|
3679
3689
|
* Create a `FieldPath` by providing field names. If more than one field
|
|
3680
3690
|
* name is provided, the path will point to a nested field in a document.
|
|
3681
|
-
*/ class
|
|
3691
|
+
*/ class yn {
|
|
3682
3692
|
/**
|
|
3683
3693
|
* Creates a `FieldPath` from the provided field names. If more than one field
|
|
3684
3694
|
* name is provided, the path will point to a nested field in a document.
|
|
@@ -3702,8 +3712,8 @@ function dn(t, e, ...n) {
|
|
|
3702
3712
|
/**
|
|
3703
3713
|
* Returns a special sentinel `FieldPath` to refer to the ID of a document.
|
|
3704
3714
|
* It can be used in queries to sort or filter by the document ID.
|
|
3705
|
-
*/ function
|
|
3706
|
-
return new
|
|
3715
|
+
*/ function _n() {
|
|
3716
|
+
return new yn("__name__");
|
|
3707
3717
|
}
|
|
3708
3718
|
|
|
3709
3719
|
/**
|
|
@@ -3724,7 +3734,7 @@ function dn(t, e, ...n) {
|
|
|
3724
3734
|
*/
|
|
3725
3735
|
/**
|
|
3726
3736
|
* An immutable object representing an array of bytes.
|
|
3727
|
-
*/ class
|
|
3737
|
+
*/ class gn {
|
|
3728
3738
|
/** @hideconstructor */
|
|
3729
3739
|
constructor(t) {
|
|
3730
3740
|
this._byteString = t;
|
|
@@ -3736,7 +3746,7 @@ function dn(t, e, ...n) {
|
|
|
3736
3746
|
* @param base64 - The Base64 string used to create the `Bytes` object.
|
|
3737
3747
|
*/ static fromBase64String(t) {
|
|
3738
3748
|
try {
|
|
3739
|
-
return new
|
|
3749
|
+
return new gn(It.fromBase64String(t));
|
|
3740
3750
|
} catch (t) {
|
|
3741
3751
|
throw new U(A, "Failed to construct data from Base64 string: " + t);
|
|
3742
3752
|
}
|
|
@@ -3746,7 +3756,7 @@ function dn(t, e, ...n) {
|
|
|
3746
3756
|
*
|
|
3747
3757
|
* @param array - The Uint8Array used to create the `Bytes` object.
|
|
3748
3758
|
*/ static fromUint8Array(t) {
|
|
3749
|
-
return new
|
|
3759
|
+
return new gn(It.fromUint8Array(t));
|
|
3750
3760
|
}
|
|
3751
3761
|
/**
|
|
3752
3762
|
* Returns the underlying bytes as a Base64-encoded string.
|
|
@@ -3798,7 +3808,7 @@ function dn(t, e, ...n) {
|
|
|
3798
3808
|
/**
|
|
3799
3809
|
* Sentinel values that can be used when writing document fields with `set()`
|
|
3800
3810
|
* or `update()`.
|
|
3801
|
-
*/ class
|
|
3811
|
+
*/ class bn {
|
|
3802
3812
|
/**
|
|
3803
3813
|
* @param _methodName - The public API endpoint that returns this class.
|
|
3804
3814
|
* @hideconstructor
|
|
@@ -3889,29 +3899,29 @@ function dn(t, e, ...n) {
|
|
|
3889
3899
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3890
3900
|
* See the License for the specific language governing permissions and
|
|
3891
3901
|
* limitations under the License.
|
|
3892
|
-
*/ const
|
|
3902
|
+
*/ const En = /^__.*__$/;
|
|
3893
3903
|
|
|
3894
|
-
/** The result of parsing document data (e.g. for a setData call). */ class
|
|
3904
|
+
/** The result of parsing document data (e.g. for a setData call). */ class Tn {
|
|
3895
3905
|
constructor(t, e, n) {
|
|
3896
3906
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
3897
3907
|
}
|
|
3898
3908
|
toMutation(t, e) {
|
|
3899
|
-
return null !== this.fieldMask ? new
|
|
3909
|
+
return null !== this.fieldMask ? new Ie(t, this.data, this.fieldMask, e, this.fieldTransforms) : new Te(t, this.data, e, this.fieldTransforms);
|
|
3900
3910
|
}
|
|
3901
3911
|
}
|
|
3902
3912
|
|
|
3903
|
-
/** 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 In {
|
|
3904
3914
|
constructor(t,
|
|
3905
3915
|
// The fieldMask does not include document transforms.
|
|
3906
3916
|
e, n) {
|
|
3907
3917
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
3908
3918
|
}
|
|
3909
3919
|
toMutation(t, e) {
|
|
3910
|
-
return new
|
|
3920
|
+
return new Ie(t, this.data, this.fieldMask, e, this.fieldTransforms);
|
|
3911
3921
|
}
|
|
3912
3922
|
}
|
|
3913
3923
|
|
|
3914
|
-
function
|
|
3924
|
+
function An(t) {
|
|
3915
3925
|
switch (t) {
|
|
3916
3926
|
case 0 /* Set */ :
|
|
3917
3927
|
// fall through
|
|
@@ -3929,7 +3939,7 @@ function In(t) {
|
|
|
3929
3939
|
}
|
|
3930
3940
|
}
|
|
3931
3941
|
|
|
3932
|
-
/** A "context" object passed around while parsing user data. */ class
|
|
3942
|
+
/** A "context" object passed around while parsing user data. */ class Rn {
|
|
3933
3943
|
/**
|
|
3934
3944
|
* Initializes a ParseContext with the given source and path.
|
|
3935
3945
|
*
|
|
@@ -3961,7 +3971,7 @@ function In(t) {
|
|
|
3961
3971
|
return this.settings.tt;
|
|
3962
3972
|
}
|
|
3963
3973
|
/** Returns a new context with the specified settings overwritten. */ et(t) {
|
|
3964
|
-
return new
|
|
3974
|
+
return new Rn(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.q, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
|
|
3965
3975
|
}
|
|
3966
3976
|
nt(t) {
|
|
3967
3977
|
var e;
|
|
@@ -3988,7 +3998,7 @@ function In(t) {
|
|
|
3988
3998
|
});
|
|
3989
3999
|
}
|
|
3990
4000
|
ut(t) {
|
|
3991
|
-
return
|
|
4001
|
+
return Qn(t, this.settings.methodName, this.settings.ct || !1, this.path, this.settings.at);
|
|
3992
4002
|
}
|
|
3993
4003
|
/** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
|
|
3994
4004
|
return void 0 !== this.fieldMask.find((e => t.isPrefixOf(e))) || void 0 !== this.fieldTransforms.find((e => t.isPrefixOf(e.field)));
|
|
@@ -4000,19 +4010,19 @@ function In(t) {
|
|
|
4000
4010
|
}
|
|
4001
4011
|
st(t) {
|
|
4002
4012
|
if (0 === t.length) throw this.ut("Document fields must not be empty");
|
|
4003
|
-
if (
|
|
4013
|
+
if (An(this.tt) && En.test(t)) throw this.ut('Document fields cannot begin and end with "__"');
|
|
4004
4014
|
}
|
|
4005
4015
|
}
|
|
4006
4016
|
|
|
4007
4017
|
/**
|
|
4008
4018
|
* Helper for parsing raw user input (provided via the API) into internal model
|
|
4009
4019
|
* classes.
|
|
4010
|
-
*/ class
|
|
4020
|
+
*/ class Pn {
|
|
4011
4021
|
constructor(t, e, n) {
|
|
4012
|
-
this.databaseId = t, this.ignoreUndefinedProperties = e, this.q = n ||
|
|
4022
|
+
this.databaseId = t, this.ignoreUndefinedProperties = e, this.q = n || Ye(t);
|
|
4013
4023
|
}
|
|
4014
4024
|
/** Creates a new top-level parse context. */ ht(t, e, n, r = !1) {
|
|
4015
|
-
return new
|
|
4025
|
+
return new Rn({
|
|
4016
4026
|
tt: t,
|
|
4017
4027
|
methodName: e,
|
|
4018
4028
|
at: n,
|
|
@@ -4023,29 +4033,29 @@ function In(t) {
|
|
|
4023
4033
|
}
|
|
4024
4034
|
}
|
|
4025
4035
|
|
|
4026
|
-
function
|
|
4027
|
-
const e = t._freezeSettings(), n =
|
|
4028
|
-
return new
|
|
4036
|
+
function Vn(t) {
|
|
4037
|
+
const e = t._freezeSettings(), n = Ye(t._databaseId);
|
|
4038
|
+
return new Pn(t._databaseId, !!e.ignoreUndefinedProperties, n);
|
|
4029
4039
|
}
|
|
4030
4040
|
|
|
4031
|
-
/** Parse document data from a set() call. */ function
|
|
4041
|
+
/** Parse document data from a set() call. */ function Dn(t, e, n, r, s, i = {}) {
|
|
4032
4042
|
const o = t.ht(i.merge || i.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, s);
|
|
4033
|
-
|
|
4034
|
-
const u =
|
|
4043
|
+
Mn("Data must be an object, but it was:", o, r);
|
|
4044
|
+
const u = kn(r, o);
|
|
4035
4045
|
let c, a;
|
|
4036
4046
|
if (i.merge) c = new Tt(o.fieldMask), a = o.fieldTransforms; else if (i.mergeFields) {
|
|
4037
4047
|
const t = [];
|
|
4038
4048
|
for (const r of i.mergeFields) {
|
|
4039
|
-
const s =
|
|
4049
|
+
const s = Bn(e, r, n);
|
|
4040
4050
|
if (!o.contains(s)) throw new U(A, `Field '${s}' is specified in your field mask but missing from your input data.`);
|
|
4041
|
-
|
|
4051
|
+
Wn(t, s) || t.push(s);
|
|
4042
4052
|
}
|
|
4043
4053
|
c = new Tt(t), a = o.fieldTransforms.filter((t => c.covers(t.field)));
|
|
4044
4054
|
} else c = null, a = o.fieldTransforms;
|
|
4045
|
-
return new
|
|
4055
|
+
return new Tn(new zt(u), c, a);
|
|
4046
4056
|
}
|
|
4047
4057
|
|
|
4048
|
-
class
|
|
4058
|
+
class Nn extends bn {
|
|
4049
4059
|
_toFieldTransform(t) {
|
|
4050
4060
|
if (2 /* MergeSet */ !== t.tt) throw 1 /* Update */ === t.tt ? t.ut(`${this._methodName}() can only appear at the top level of your update data`) : t.ut(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);
|
|
4051
4061
|
// No transform to add for a delete, but we need to add it to our
|
|
@@ -4053,7 +4063,7 @@ class Dn extends gn {
|
|
|
4053
4063
|
return t.fieldMask.push(t.path), null;
|
|
4054
4064
|
}
|
|
4055
4065
|
isEqual(t) {
|
|
4056
|
-
return t instanceof
|
|
4066
|
+
return t instanceof Nn;
|
|
4057
4067
|
}
|
|
4058
4068
|
}
|
|
4059
4069
|
|
|
@@ -4072,8 +4082,8 @@ class Dn extends gn {
|
|
|
4072
4082
|
* context.
|
|
4073
4083
|
* @param context - The parent context.
|
|
4074
4084
|
* @param arrayElement - Whether or not the FieldValue has an array.
|
|
4075
|
-
*/ function
|
|
4076
|
-
return new
|
|
4085
|
+
*/ function $n(t, e, n) {
|
|
4086
|
+
return new Rn({
|
|
4077
4087
|
tt: 3 /* Argument */ ,
|
|
4078
4088
|
at: e.settings.at,
|
|
4079
4089
|
methodName: t._methodName,
|
|
@@ -4081,23 +4091,23 @@ class Dn extends gn {
|
|
|
4081
4091
|
}, e.databaseId, e.q, e.ignoreUndefinedProperties);
|
|
4082
4092
|
}
|
|
4083
4093
|
|
|
4084
|
-
class
|
|
4094
|
+
class Sn extends bn {
|
|
4085
4095
|
_toFieldTransform(t) {
|
|
4086
|
-
return new
|
|
4096
|
+
return new be(t.path, new pe);
|
|
4087
4097
|
}
|
|
4088
4098
|
isEqual(t) {
|
|
4089
|
-
return t instanceof
|
|
4099
|
+
return t instanceof Sn;
|
|
4090
4100
|
}
|
|
4091
4101
|
}
|
|
4092
4102
|
|
|
4093
|
-
class
|
|
4103
|
+
class Fn extends bn {
|
|
4094
4104
|
constructor(t, e) {
|
|
4095
4105
|
super(t), this.lt = e;
|
|
4096
4106
|
}
|
|
4097
4107
|
_toFieldTransform(t) {
|
|
4098
|
-
const e =
|
|
4099
|
-
/*array=*/ !0), n = this.lt.map((t =>
|
|
4100
|
-
return new
|
|
4108
|
+
const e = $n(this, t,
|
|
4109
|
+
/*array=*/ !0), n = this.lt.map((t => Un(t, e))), r = new ye(n);
|
|
4110
|
+
return new be(t.path, r);
|
|
4101
4111
|
}
|
|
4102
4112
|
isEqual(t) {
|
|
4103
4113
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4105,14 +4115,14 @@ class Sn extends gn {
|
|
|
4105
4115
|
}
|
|
4106
4116
|
}
|
|
4107
4117
|
|
|
4108
|
-
class
|
|
4118
|
+
class xn extends bn {
|
|
4109
4119
|
constructor(t, e) {
|
|
4110
4120
|
super(t), this.lt = e;
|
|
4111
4121
|
}
|
|
4112
4122
|
_toFieldTransform(t) {
|
|
4113
|
-
const e =
|
|
4114
|
-
/*array=*/ !0), n = this.lt.map((t =>
|
|
4115
|
-
return new
|
|
4123
|
+
const e = $n(this, t,
|
|
4124
|
+
/*array=*/ !0), n = this.lt.map((t => Un(t, e))), r = new _e(n);
|
|
4125
|
+
return new be(t.path, r);
|
|
4116
4126
|
}
|
|
4117
4127
|
isEqual(t) {
|
|
4118
4128
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4120,13 +4130,13 @@ class Fn extends gn {
|
|
|
4120
4130
|
}
|
|
4121
4131
|
}
|
|
4122
4132
|
|
|
4123
|
-
class
|
|
4133
|
+
class qn extends bn {
|
|
4124
4134
|
constructor(t, e) {
|
|
4125
4135
|
super(t), this.ft = e;
|
|
4126
4136
|
}
|
|
4127
4137
|
_toFieldTransform(t) {
|
|
4128
|
-
const e = new
|
|
4129
|
-
return new
|
|
4138
|
+
const e = new ge(t.q, we(t.q, this.ft));
|
|
4139
|
+
return new be(t.path, e);
|
|
4130
4140
|
}
|
|
4131
4141
|
isEqual(t) {
|
|
4132
4142
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4134,50 +4144,50 @@ class xn extends gn {
|
|
|
4134
4144
|
}
|
|
4135
4145
|
}
|
|
4136
4146
|
|
|
4137
|
-
/** Parse update data from an update() call. */ function
|
|
4147
|
+
/** Parse update data from an update() call. */ function On(t, e, n, r) {
|
|
4138
4148
|
const s = t.ht(1 /* Update */ , e, n);
|
|
4139
|
-
|
|
4140
|
-
const i = [], o =
|
|
4149
|
+
Mn("Data must be an object, but it was:", s, r);
|
|
4150
|
+
const i = [], o = zt.empty();
|
|
4141
4151
|
Et(r, ((t, r) => {
|
|
4142
|
-
const u =
|
|
4152
|
+
const u = Gn(e, t, n);
|
|
4143
4153
|
// For Compat types, we have to "extract" the underlying types before
|
|
4144
4154
|
// performing validation.
|
|
4145
4155
|
r = getModularInstance(r);
|
|
4146
4156
|
const c = s.it(u);
|
|
4147
|
-
if (r instanceof
|
|
4157
|
+
if (r instanceof Nn)
|
|
4148
4158
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4149
4159
|
i.push(u); else {
|
|
4150
|
-
const t =
|
|
4160
|
+
const t = Un(r, c);
|
|
4151
4161
|
null != t && (i.push(u), o.set(u, t));
|
|
4152
4162
|
}
|
|
4153
4163
|
}));
|
|
4154
4164
|
const u = new Tt(i);
|
|
4155
|
-
return new
|
|
4165
|
+
return new In(o, u, s.fieldTransforms);
|
|
4156
4166
|
}
|
|
4157
4167
|
|
|
4158
|
-
/** Parse update data from a list of field/value arguments. */ function
|
|
4159
|
-
const o = t.ht(1 /* Update */ , e, n), u = [
|
|
4168
|
+
/** Parse update data from a list of field/value arguments. */ function Cn(t, e, n, r, s, i) {
|
|
4169
|
+
const o = t.ht(1 /* Update */ , e, n), u = [ Bn(e, r, n) ], c = [ s ];
|
|
4160
4170
|
if (i.length % 2 != 0) throw new U(A, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);
|
|
4161
|
-
for (let t = 0; t < i.length; t += 2) u.push(
|
|
4162
|
-
const a = [], l =
|
|
4171
|
+
for (let t = 0; t < i.length; t += 2) u.push(Bn(e, i[t])), c.push(i[t + 1]);
|
|
4172
|
+
const a = [], l = zt.empty();
|
|
4163
4173
|
// We iterate in reverse order to pick the last value for a field if the
|
|
4164
4174
|
// user specified the field multiple times.
|
|
4165
|
-
for (let t = u.length - 1; t >= 0; --t) if (!
|
|
4175
|
+
for (let t = u.length - 1; t >= 0; --t) if (!Wn(a, u[t])) {
|
|
4166
4176
|
const e = u[t];
|
|
4167
4177
|
let n = c[t];
|
|
4168
4178
|
// For Compat types, we have to "extract" the underlying types before
|
|
4169
4179
|
// performing validation.
|
|
4170
4180
|
n = getModularInstance(n);
|
|
4171
4181
|
const r = o.it(e);
|
|
4172
|
-
if (n instanceof
|
|
4182
|
+
if (n instanceof Nn)
|
|
4173
4183
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4174
4184
|
a.push(e); else {
|
|
4175
|
-
const t =
|
|
4185
|
+
const t = Un(n, r);
|
|
4176
4186
|
null != t && (a.push(e), l.set(e, t));
|
|
4177
4187
|
}
|
|
4178
4188
|
}
|
|
4179
4189
|
const f = new Tt(a);
|
|
4180
|
-
return new
|
|
4190
|
+
return new In(l, f, o.fieldTransforms);
|
|
4181
4191
|
}
|
|
4182
4192
|
|
|
4183
4193
|
/**
|
|
@@ -4186,8 +4196,8 @@ class xn extends gn {
|
|
|
4186
4196
|
*
|
|
4187
4197
|
* @param allowArrays - Whether the query value is an array that may directly
|
|
4188
4198
|
* contain additional arrays (e.g. the operand of an `in` query).
|
|
4189
|
-
*/ function
|
|
4190
|
-
return
|
|
4199
|
+
*/ function Ln(t, e, n, r = !1) {
|
|
4200
|
+
return Un(n, t.ht(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
|
|
4191
4201
|
}
|
|
4192
4202
|
|
|
4193
4203
|
/**
|
|
@@ -4198,12 +4208,12 @@ class xn extends gn {
|
|
|
4198
4208
|
* the source of the data being parsed, etc.
|
|
4199
4209
|
* @returns The parsed value, or null if the value was a FieldValue sentinel
|
|
4200
4210
|
* that should not be included in the resulting parsed data.
|
|
4201
|
-
*/ function
|
|
4202
|
-
if (
|
|
4211
|
+
*/ function Un(t, e) {
|
|
4212
|
+
if (jn(
|
|
4203
4213
|
// Unwrap the API type from the Compat SDK. This will return the API type
|
|
4204
4214
|
// from firestore-exp.
|
|
4205
|
-
t = getModularInstance(t))) return
|
|
4206
|
-
if (t instanceof
|
|
4215
|
+
t = getModularInstance(t))) return Mn("Unsupported field value:", e, t), kn(t, e);
|
|
4216
|
+
if (t instanceof bn)
|
|
4207
4217
|
// FieldValues usually parse into transforms (except deleteField())
|
|
4208
4218
|
// in which case we do not want to include this field in our parsed data
|
|
4209
4219
|
// (as doing so will overwrite the field directly prior to the transform
|
|
@@ -4215,7 +4225,7 @@ class xn extends gn {
|
|
|
4215
4225
|
*/
|
|
4216
4226
|
return function(t, e) {
|
|
4217
4227
|
// Sentinels are only supported with writes, and not within arrays.
|
|
4218
|
-
if (!
|
|
4228
|
+
if (!An(e.tt)) throw e.ut(`${t._methodName}() can only be used with update() and set()`);
|
|
4219
4229
|
if (!e.path) throw e.ut(`${t._methodName}() is not currently supported inside arrays`);
|
|
4220
4230
|
const n = t._toFieldTransform(e);
|
|
4221
4231
|
n && e.fieldTransforms.push(n);
|
|
@@ -4245,7 +4255,7 @@ class xn extends gn {
|
|
|
4245
4255
|
const n = [];
|
|
4246
4256
|
let r = 0;
|
|
4247
4257
|
for (const s of t) {
|
|
4248
|
-
let t =
|
|
4258
|
+
let t = Un(s, e.ot(r));
|
|
4249
4259
|
null == t && (
|
|
4250
4260
|
// Just include nulls in the array for fields being replaced with a
|
|
4251
4261
|
// sentinel.
|
|
@@ -4264,7 +4274,7 @@ class xn extends gn {
|
|
|
4264
4274
|
if (null === (t = getModularInstance(t))) return {
|
|
4265
4275
|
nullValue: "NULL_VALUE"
|
|
4266
4276
|
};
|
|
4267
|
-
if ("number" == typeof t) return
|
|
4277
|
+
if ("number" == typeof t) return we(e.q, t);
|
|
4268
4278
|
if ("boolean" == typeof t) return {
|
|
4269
4279
|
booleanValue: t
|
|
4270
4280
|
};
|
|
@@ -4274,7 +4284,7 @@ class xn extends gn {
|
|
|
4274
4284
|
if (t instanceof Date) {
|
|
4275
4285
|
const n = gt.fromDate(t);
|
|
4276
4286
|
return {
|
|
4277
|
-
timestampValue:
|
|
4287
|
+
timestampValue: Ne(e.q, n)
|
|
4278
4288
|
};
|
|
4279
4289
|
}
|
|
4280
4290
|
if (t instanceof gt) {
|
|
@@ -4283,7 +4293,7 @@ class xn extends gn {
|
|
|
4283
4293
|
// truncation immediately without waiting for the backend to do that.
|
|
4284
4294
|
const n = new gt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
|
|
4285
4295
|
return {
|
|
4286
|
-
timestampValue:
|
|
4296
|
+
timestampValue: Ne(e.q, n)
|
|
4287
4297
|
};
|
|
4288
4298
|
}
|
|
4289
4299
|
if (t instanceof vn) return {
|
|
@@ -4292,14 +4302,14 @@ class xn extends gn {
|
|
|
4292
4302
|
longitude: t.longitude
|
|
4293
4303
|
}
|
|
4294
4304
|
};
|
|
4295
|
-
if (t instanceof
|
|
4296
|
-
bytesValue:
|
|
4305
|
+
if (t instanceof gn) return {
|
|
4306
|
+
bytesValue: $e(e.q, t._byteString)
|
|
4297
4307
|
};
|
|
4298
|
-
if (t instanceof
|
|
4308
|
+
if (t instanceof an) {
|
|
4299
4309
|
const n = e.databaseId, r = t.firestore._databaseId;
|
|
4300
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}`);
|
|
4301
4311
|
return {
|
|
4302
|
-
referenceValue:
|
|
4312
|
+
referenceValue: xe(t.firestore._databaseId || e.databaseId, t._key.path)
|
|
4303
4313
|
};
|
|
4304
4314
|
}
|
|
4305
4315
|
throw e.ut(`Unsupported field value: ${it(t)}`);
|
|
@@ -4313,13 +4323,13 @@ class xn extends gn {
|
|
|
4313
4323
|
*/ (t, e);
|
|
4314
4324
|
}
|
|
4315
4325
|
|
|
4316
|
-
function
|
|
4326
|
+
function kn(t, e) {
|
|
4317
4327
|
const n = {};
|
|
4318
4328
|
return !function(t) {
|
|
4319
4329
|
for (const e in t) if (Object.prototype.hasOwnProperty.call(t, e)) return !1;
|
|
4320
4330
|
return !0;
|
|
4321
4331
|
}(t) ? Et(t, ((t, r) => {
|
|
4322
|
-
const s =
|
|
4332
|
+
const s = Un(r, e.nt(t));
|
|
4323
4333
|
null != s && (n[t] = s);
|
|
4324
4334
|
})) :
|
|
4325
4335
|
// If we encounter an empty object, we explicitly add it to the update
|
|
@@ -4331,12 +4341,12 @@ function Un(t, e) {
|
|
|
4331
4341
|
};
|
|
4332
4342
|
}
|
|
4333
4343
|
|
|
4334
|
-
function
|
|
4335
|
-
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof gt || t instanceof vn || t instanceof
|
|
4344
|
+
function jn(t) {
|
|
4345
|
+
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof gt || t instanceof vn || t instanceof gn || t instanceof an || t instanceof bn);
|
|
4336
4346
|
}
|
|
4337
4347
|
|
|
4338
|
-
function
|
|
4339
|
-
if (!
|
|
4348
|
+
function Mn(t, e, n) {
|
|
4349
|
+
if (!jn(n) || !function(t) {
|
|
4340
4350
|
return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
|
|
4341
4351
|
}(n)) {
|
|
4342
4352
|
const r = it(n);
|
|
@@ -4346,20 +4356,20 @@ function jn(t, e, n) {
|
|
|
4346
4356
|
|
|
4347
4357
|
/**
|
|
4348
4358
|
* Helper that calls fromDotSeparatedString() but wraps any error thrown.
|
|
4349
|
-
*/ function
|
|
4359
|
+
*/ function Bn(t, e, n) {
|
|
4350
4360
|
if ((
|
|
4351
4361
|
// If required, replace the FieldPath Compat class with with the firestore-exp
|
|
4352
4362
|
// FieldPath.
|
|
4353
|
-
e = getModularInstance(e)) instanceof
|
|
4354
|
-
if ("string" == typeof e) return
|
|
4355
|
-
throw
|
|
4363
|
+
e = getModularInstance(e)) instanceof yn) return e._internalPath;
|
|
4364
|
+
if ("string" == typeof e) return Gn(t, e);
|
|
4365
|
+
throw Qn("Field path arguments must be of type string or ", t,
|
|
4356
4366
|
/* hasConverter= */ !1,
|
|
4357
4367
|
/* path= */ void 0, n);
|
|
4358
4368
|
}
|
|
4359
4369
|
|
|
4360
4370
|
/**
|
|
4361
4371
|
* Matches any characters in a field path string that are reserved.
|
|
4362
|
-
*/ const
|
|
4372
|
+
*/ const zn = new RegExp("[~\\*/\\[\\]]");
|
|
4363
4373
|
|
|
4364
4374
|
/**
|
|
4365
4375
|
* Wraps fromDotSeparatedString with an error message about the method that
|
|
@@ -4369,20 +4379,20 @@ function jn(t, e, n) {
|
|
|
4369
4379
|
* split on dots.
|
|
4370
4380
|
* @param targetDoc - The document against which the field path will be
|
|
4371
4381
|
* evaluated.
|
|
4372
|
-
*/ function
|
|
4373
|
-
if (e.search(
|
|
4382
|
+
*/ function Gn(t, e, n) {
|
|
4383
|
+
if (e.search(zn) >= 0) throw Qn(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`, t,
|
|
4374
4384
|
/* hasConverter= */ !1,
|
|
4375
4385
|
/* path= */ void 0, n);
|
|
4376
4386
|
try {
|
|
4377
|
-
return new
|
|
4387
|
+
return new yn(...e.split("."))._internalPath;
|
|
4378
4388
|
} catch (r) {
|
|
4379
|
-
throw
|
|
4389
|
+
throw Qn(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t,
|
|
4380
4390
|
/* hasConverter= */ !1,
|
|
4381
4391
|
/* path= */ void 0, n);
|
|
4382
4392
|
}
|
|
4383
4393
|
}
|
|
4384
4394
|
|
|
4385
|
-
function
|
|
4395
|
+
function Qn(t, e, n, r, s) {
|
|
4386
4396
|
const i = r && !r.isEmpty(), o = void 0 !== s;
|
|
4387
4397
|
let u = `Function ${e}() called with invalid data`;
|
|
4388
4398
|
n && (u += " (via `toFirestore()`)"), u += ". ";
|
|
@@ -4391,7 +4401,7 @@ function Gn(t, e, n, r, s) {
|
|
|
4391
4401
|
c += ")"), new U(A, u + t + c);
|
|
4392
4402
|
}
|
|
4393
4403
|
|
|
4394
|
-
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function
|
|
4404
|
+
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function Wn(t, e) {
|
|
4395
4405
|
return t.some((t => t.isEqual(e)));
|
|
4396
4406
|
}
|
|
4397
4407
|
|
|
@@ -4419,7 +4429,7 @@ function Gn(t, e, n, r, s) {
|
|
|
4419
4429
|
* For a `DocumentSnapshot` that points to a non-existing document, any data
|
|
4420
4430
|
* access will return 'undefined'. You can use the `exists()` method to
|
|
4421
4431
|
* explicitly verify a document's existence.
|
|
4422
|
-
*/ class
|
|
4432
|
+
*/ class Yn {
|
|
4423
4433
|
// Note: This class is stripped down version of the DocumentSnapshot in
|
|
4424
4434
|
// the legacy SDK. The changes are:
|
|
4425
4435
|
// - No support for SnapshotMetadata.
|
|
@@ -4435,7 +4445,7 @@ function Gn(t, e, n, r, s) {
|
|
|
4435
4445
|
/**
|
|
4436
4446
|
* The `DocumentReference` for the document included in the `DocumentSnapshot`.
|
|
4437
4447
|
*/ get ref() {
|
|
4438
|
-
return new
|
|
4448
|
+
return new an(this._firestore, this._converter, this._key);
|
|
4439
4449
|
}
|
|
4440
4450
|
/**
|
|
4441
4451
|
* Signals whether or not the document at the snapshot's location exists.
|
|
@@ -4455,7 +4465,7 @@ function Gn(t, e, n, r, s) {
|
|
|
4455
4465
|
if (this._converter) {
|
|
4456
4466
|
// We only want to use the converter and create a new DocumentSnapshot
|
|
4457
4467
|
// if a converter has been provided.
|
|
4458
|
-
const t = new
|
|
4468
|
+
const t = new Hn(this._firestore, this._userDataWriter, this._key, this._document,
|
|
4459
4469
|
/* converter= */ null);
|
|
4460
4470
|
return this._converter.fromFirestore(t);
|
|
4461
4471
|
}
|
|
@@ -4475,7 +4485,7 @@ function Gn(t, e, n, r, s) {
|
|
|
4475
4485
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4476
4486
|
get(t) {
|
|
4477
4487
|
if (this._document) {
|
|
4478
|
-
const e = this._document.data.field(
|
|
4488
|
+
const e = this._document.data.field(Xn("DocumentSnapshot.get", t));
|
|
4479
4489
|
if (null !== e) return this._userDataWriter.convertValue(e);
|
|
4480
4490
|
}
|
|
4481
4491
|
}
|
|
@@ -4491,7 +4501,7 @@ function Gn(t, e, n, r, s) {
|
|
|
4491
4501
|
* `DocumentSnapshot`. Since query results contain only existing documents, the
|
|
4492
4502
|
* `exists` property will always be true and `data()` will never return
|
|
4493
4503
|
* 'undefined'.
|
|
4494
|
-
*/ class
|
|
4504
|
+
*/ class Hn extends Yn {
|
|
4495
4505
|
/**
|
|
4496
4506
|
* Retrieves all fields in the document as an `Object`.
|
|
4497
4507
|
*
|
|
@@ -4509,7 +4519,7 @@ function Gn(t, e, n, r, s) {
|
|
|
4509
4519
|
* array via the `docs` property or enumerated using the `forEach` method. The
|
|
4510
4520
|
* number of documents can be determined via the `empty` and `size`
|
|
4511
4521
|
* properties.
|
|
4512
|
-
*/ class
|
|
4522
|
+
*/ class Kn {
|
|
4513
4523
|
/** @hideconstructor */
|
|
4514
4524
|
constructor(t, e) {
|
|
4515
4525
|
this._docs = e, this.query = t;
|
|
@@ -4540,14 +4550,14 @@ function Gn(t, e, n, r, s) {
|
|
|
4540
4550
|
* @param left - A snapshot to compare.
|
|
4541
4551
|
* @param right - A snapshot to compare.
|
|
4542
4552
|
* @returns true if the snapshots are equal.
|
|
4543
|
-
*/ function
|
|
4544
|
-
return t = getModularInstance(t), e = getModularInstance(e), t instanceof
|
|
4553
|
+
*/ function Jn(t, e) {
|
|
4554
|
+
return t = getModularInstance(t), e = getModularInstance(e), t instanceof Yn && e instanceof Yn ? t._firestore === e._firestore && t._key.isEqual(e._key) && (null === t._document ? null === e._document : t._document.isEqual(e._document)) && t._converter === e._converter : t instanceof Kn && e instanceof Kn && (pn(t.query, e.query) && _t(t.docs, e.docs, Jn));
|
|
4545
4555
|
}
|
|
4546
4556
|
|
|
4547
4557
|
/**
|
|
4548
4558
|
* Helper that calls `fromDotSeparatedString()` but wraps any error thrown.
|
|
4549
|
-
*/ function
|
|
4550
|
-
return "string" == typeof e ?
|
|
4559
|
+
*/ function Xn(t, e) {
|
|
4560
|
+
return "string" == typeof e ? Gn(t, e) : e instanceof yn ? e._internalPath : e._delegate._internalPath;
|
|
4551
4561
|
}
|
|
4552
4562
|
|
|
4553
4563
|
/**
|
|
@@ -4574,7 +4584,7 @@ function Gn(t, e, n, r, s) {
|
|
|
4574
4584
|
* can then be passed to {@link query} to create a new query instance that
|
|
4575
4585
|
* also contains this `QueryConstraint`.
|
|
4576
4586
|
*/
|
|
4577
|
-
class
|
|
4587
|
+
class Zn {}
|
|
4578
4588
|
|
|
4579
4589
|
/**
|
|
4580
4590
|
* Creates a new immutable instance of {@link Query} that is extended to also include
|
|
@@ -4584,40 +4594,40 @@ class Xn {}
|
|
|
4584
4594
|
* @param queryConstraints - The list of {@link QueryConstraint}s to apply.
|
|
4585
4595
|
* @throws if any of the provided query constraints cannot be combined with the
|
|
4586
4596
|
* existing or new constraints.
|
|
4587
|
-
*/ function
|
|
4597
|
+
*/ function tr(t, ...e) {
|
|
4588
4598
|
for (const n of e) t = n._apply(t);
|
|
4589
4599
|
return t;
|
|
4590
4600
|
}
|
|
4591
4601
|
|
|
4592
|
-
class
|
|
4602
|
+
class er extends Zn {
|
|
4593
4603
|
constructor(t, e, n) {
|
|
4594
4604
|
super(), this.dt = t, this.wt = e, this.yt = n, this.type = "where";
|
|
4595
4605
|
}
|
|
4596
4606
|
_apply(t) {
|
|
4597
|
-
const e =
|
|
4607
|
+
const e = Vn(t.firestore), n = function(t, e, n, r, s, i, o) {
|
|
4598
4608
|
let u;
|
|
4599
4609
|
if (s.isKeyField()) {
|
|
4600
4610
|
if ("array-contains" /* ARRAY_CONTAINS */ === i || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === i) throw new U(A, `Invalid Query. You can't perform '${i}' queries on documentId().`);
|
|
4601
4611
|
if ("in" /* IN */ === i || "not-in" /* NOT_IN */ === i) {
|
|
4602
|
-
|
|
4612
|
+
pr(o, i);
|
|
4603
4613
|
const e = [];
|
|
4604
|
-
for (const n of o) e.push(
|
|
4614
|
+
for (const n of o) e.push(mr(r, t, n));
|
|
4605
4615
|
u = {
|
|
4606
4616
|
arrayValue: {
|
|
4607
4617
|
values: e
|
|
4608
4618
|
}
|
|
4609
4619
|
};
|
|
4610
|
-
} else u =
|
|
4611
|
-
} else "in" /* IN */ !== i && "not-in" /* NOT_IN */ !== i && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== i ||
|
|
4612
|
-
u =
|
|
4620
|
+
} else u = mr(r, t, o);
|
|
4621
|
+
} else "in" /* IN */ !== i && "not-in" /* NOT_IN */ !== i && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== i || pr(o, i),
|
|
4622
|
+
u = Ln(n, e, o,
|
|
4613
4623
|
/* allowArrays= */ "in" /* IN */ === i || "not-in" /* NOT_IN */ === i);
|
|
4614
|
-
const c =
|
|
4624
|
+
const c = Yt.create(s, i, u);
|
|
4615
4625
|
return function(t, e) {
|
|
4616
4626
|
if (e.N()) {
|
|
4617
|
-
const n =
|
|
4627
|
+
const n = ae(t);
|
|
4618
4628
|
if (null !== n && !n.isEqual(e.field)) throw new U(A, `Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${n.toString()}' and '${e.field.toString()}'`);
|
|
4619
|
-
const r =
|
|
4620
|
-
null !== r &&
|
|
4629
|
+
const r = ce(t);
|
|
4630
|
+
null !== r && yr(t, e.field, r);
|
|
4621
4631
|
}
|
|
4622
4632
|
const n = function(t, e) {
|
|
4623
4633
|
for (const n of t.filters) if (e.indexOf(n.op) >= 0) return n.op;
|
|
@@ -4661,9 +4671,9 @@ class tr extends Xn {
|
|
|
4661
4671
|
throw n === e.op ? new U(A, `Invalid query. You cannot use more than one '${e.op.toString()}' filter.`) : new U(A, `Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`);
|
|
4662
4672
|
}(t, c), c;
|
|
4663
4673
|
}(t._query, "where", e, t.firestore._databaseId, this.dt, this.wt, this.yt);
|
|
4664
|
-
return new
|
|
4674
|
+
return new hn(t.firestore, t.converter, function(t, e) {
|
|
4665
4675
|
const n = t.filters.concat([ e ]);
|
|
4666
|
-
return new
|
|
4676
|
+
return new ue(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
|
|
4667
4677
|
}(t._query, n));
|
|
4668
4678
|
}
|
|
4669
4679
|
}
|
|
@@ -4678,12 +4688,12 @@ class tr extends Xn {
|
|
|
4678
4688
|
* "<=", "!=").
|
|
4679
4689
|
* @param value - The value for comparison
|
|
4680
4690
|
* @returns The created {@link Query}.
|
|
4681
|
-
*/ function
|
|
4682
|
-
const r = e, s =
|
|
4683
|
-
return new
|
|
4691
|
+
*/ function nr(t, e, n) {
|
|
4692
|
+
const r = e, s = Xn("where", t);
|
|
4693
|
+
return new er(s, r, n);
|
|
4684
4694
|
}
|
|
4685
4695
|
|
|
4686
|
-
class
|
|
4696
|
+
class rr extends Zn {
|
|
4687
4697
|
constructor(t, e) {
|
|
4688
4698
|
super(), this.dt = t, this._t = e, this.type = "orderBy";
|
|
4689
4699
|
}
|
|
@@ -4691,12 +4701,12 @@ class nr extends Xn {
|
|
|
4691
4701
|
const e = function(t, e, n) {
|
|
4692
4702
|
if (null !== t.startAt) throw new U(A, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
|
|
4693
4703
|
if (null !== t.endAt) throw new U(A, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
|
|
4694
|
-
const r = new
|
|
4704
|
+
const r = new se(e, n);
|
|
4695
4705
|
return function(t, e) {
|
|
4696
|
-
if (null ===
|
|
4706
|
+
if (null === ce(t)) {
|
|
4697
4707
|
// This is the first order by. It must match any inequality.
|
|
4698
|
-
const n =
|
|
4699
|
-
null !== n &&
|
|
4708
|
+
const n = ae(t);
|
|
4709
|
+
null !== n && yr(t, n, e.field);
|
|
4700
4710
|
}
|
|
4701
4711
|
}(t, r), r;
|
|
4702
4712
|
}
|
|
@@ -4711,10 +4721,10 @@ class nr extends Xn {
|
|
|
4711
4721
|
* of the query or if any of the fields in the order by are an uncommitted
|
|
4712
4722
|
* server timestamp.
|
|
4713
4723
|
*/ (t._query, this.dt, this._t);
|
|
4714
|
-
return new
|
|
4724
|
+
return new hn(t.firestore, t.converter, function(t, e) {
|
|
4715
4725
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
4716
4726
|
const n = t.explicitOrderBy.concat([ e ]);
|
|
4717
|
-
return new
|
|
4727
|
+
return new ue(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
|
|
4718
4728
|
}(t._query, e));
|
|
4719
4729
|
}
|
|
4720
4730
|
}
|
|
@@ -4727,19 +4737,19 @@ class nr extends Xn {
|
|
|
4727
4737
|
* @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
|
|
4728
4738
|
* not specified, order will be ascending.
|
|
4729
4739
|
* @returns The created {@link Query}.
|
|
4730
|
-
*/ function
|
|
4731
|
-
const n = e, r =
|
|
4732
|
-
return new
|
|
4740
|
+
*/ function sr(t, e = "asc") {
|
|
4741
|
+
const n = e, r = Xn("orderBy", t);
|
|
4742
|
+
return new rr(r, n);
|
|
4733
4743
|
}
|
|
4734
4744
|
|
|
4735
|
-
class
|
|
4745
|
+
class ir extends Zn {
|
|
4736
4746
|
constructor(t, e, n) {
|
|
4737
|
-
super(), this.type = t, this.gt = e, this.
|
|
4747
|
+
super(), this.type = t, this.gt = e, this.bt = n;
|
|
4738
4748
|
}
|
|
4739
4749
|
_apply(t) {
|
|
4740
|
-
return new
|
|
4741
|
-
return new
|
|
4742
|
-
}(t._query, this.gt, this.
|
|
4750
|
+
return new hn(t.firestore, t.converter, function(t, e, n) {
|
|
4751
|
+
return new ue(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
|
|
4752
|
+
}(t._query, this.gt, this.bt));
|
|
4743
4753
|
}
|
|
4744
4754
|
}
|
|
4745
4755
|
|
|
@@ -4748,8 +4758,8 @@ class sr extends Xn {
|
|
|
4748
4758
|
*
|
|
4749
4759
|
* @param limit - The maximum number of items to return.
|
|
4750
4760
|
* @returns The created {@link Query}.
|
|
4751
|
-
*/ function
|
|
4752
|
-
return ut("limit", t), new
|
|
4761
|
+
*/ function or(t) {
|
|
4762
|
+
return ut("limit", t), new ir("limit", t, "F" /* First */);
|
|
4753
4763
|
}
|
|
4754
4764
|
|
|
4755
4765
|
/**
|
|
@@ -4760,55 +4770,55 @@ class sr extends Xn {
|
|
|
4760
4770
|
*
|
|
4761
4771
|
* @param limit - The maximum number of items to return.
|
|
4762
4772
|
* @returns The created {@link Query}.
|
|
4763
|
-
*/ function
|
|
4764
|
-
return ut("limitToLast", t), new
|
|
4773
|
+
*/ function ur(t) {
|
|
4774
|
+
return ut("limitToLast", t), new ir("limitToLast", t, "L" /* Last */);
|
|
4765
4775
|
}
|
|
4766
4776
|
|
|
4767
|
-
class
|
|
4777
|
+
class cr extends Zn {
|
|
4768
4778
|
constructor(t, e, n) {
|
|
4769
|
-
super(), this.type = t, this.
|
|
4779
|
+
super(), this.type = t, this.vt = e, this.Et = n;
|
|
4770
4780
|
}
|
|
4771
4781
|
_apply(t) {
|
|
4772
|
-
const e =
|
|
4773
|
-
return new
|
|
4774
|
-
return new
|
|
4782
|
+
const e = wr(t, this.type, this.vt, this.Et);
|
|
4783
|
+
return new hn(t.firestore, t.converter, function(t, e) {
|
|
4784
|
+
return new ue(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
|
|
4775
4785
|
}(t._query, e));
|
|
4776
4786
|
}
|
|
4777
4787
|
}
|
|
4778
4788
|
|
|
4779
|
-
function
|
|
4780
|
-
return new
|
|
4789
|
+
function ar(...t) {
|
|
4790
|
+
return new cr("startAt", t,
|
|
4781
4791
|
/*inclusive=*/ !0);
|
|
4782
4792
|
}
|
|
4783
4793
|
|
|
4784
|
-
function
|
|
4785
|
-
return new
|
|
4794
|
+
function hr(...t) {
|
|
4795
|
+
return new cr("startAfter", t,
|
|
4786
4796
|
/*inclusive=*/ !1);
|
|
4787
4797
|
}
|
|
4788
4798
|
|
|
4789
|
-
class
|
|
4799
|
+
class lr extends Zn {
|
|
4790
4800
|
constructor(t, e, n) {
|
|
4791
|
-
super(), this.type = t, this.
|
|
4801
|
+
super(), this.type = t, this.vt = e, this.Et = n;
|
|
4792
4802
|
}
|
|
4793
4803
|
_apply(t) {
|
|
4794
|
-
const e =
|
|
4795
|
-
return new
|
|
4796
|
-
return new
|
|
4804
|
+
const e = wr(t, this.type, this.vt, this.Et);
|
|
4805
|
+
return new hn(t.firestore, t.converter, function(t, e) {
|
|
4806
|
+
return new ue(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
|
|
4797
4807
|
}(t._query, e));
|
|
4798
4808
|
}
|
|
4799
4809
|
}
|
|
4800
4810
|
|
|
4801
|
-
function
|
|
4802
|
-
return new
|
|
4811
|
+
function fr(...t) {
|
|
4812
|
+
return new lr("endBefore", t,
|
|
4803
4813
|
/*inclusive=*/ !1);
|
|
4804
4814
|
}
|
|
4805
4815
|
|
|
4806
|
-
function
|
|
4807
|
-
return new
|
|
4816
|
+
function dr(...t) {
|
|
4817
|
+
return new lr("endAt", t, /*inclusive=*/ !0);
|
|
4808
4818
|
}
|
|
4809
4819
|
|
|
4810
|
-
/** Helper function to create a bound from a document or fields */ function
|
|
4811
|
-
if (n[0] = getModularInstance(n[0]), n[0] instanceof
|
|
4820
|
+
/** Helper function to create a bound from a document or fields */ function wr(t, e, n, r) {
|
|
4821
|
+
if (n[0] = getModularInstance(n[0]), n[0] instanceof Yn) return function(t, e, n, r, s) {
|
|
4812
4822
|
if (!r) throw new U(P, `Can't use a DocumentSnapshot that doesn't exist for ${n}().`);
|
|
4813
4823
|
const i = [];
|
|
4814
4824
|
// Because people expect to continue/end a query at the exact document
|
|
@@ -4818,7 +4828,7 @@ function fr(...t) {
|
|
|
4818
4828
|
// the provided document. Without the key (by using the explicit sort
|
|
4819
4829
|
// orders), multiple documents could match the position, yielding duplicate
|
|
4820
4830
|
// results.
|
|
4821
|
-
for (const n of
|
|
4831
|
+
for (const n of le(t)) if (n.field.isKeyField()) i.push(Lt(e, r.key)); else {
|
|
4822
4832
|
const t = r.data.field(n.field);
|
|
4823
4833
|
if (Dt(t)) throw new U(A, 'Invalid query. You are trying to start or end a query using a document for which the field "' + n.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');
|
|
4824
4834
|
if (null === t) {
|
|
@@ -4827,13 +4837,13 @@ function fr(...t) {
|
|
|
4827
4837
|
}
|
|
4828
4838
|
i.push(t);
|
|
4829
4839
|
}
|
|
4830
|
-
return new
|
|
4840
|
+
return new re(i, s);
|
|
4831
4841
|
}
|
|
4832
4842
|
/**
|
|
4833
4843
|
* Converts a list of field values to a `Bound` for the given query.
|
|
4834
4844
|
*/ (t._query, t.firestore._databaseId, e, n[0]._document, r);
|
|
4835
4845
|
{
|
|
4836
|
-
const s =
|
|
4846
|
+
const s = Vn(t.firestore);
|
|
4837
4847
|
return function(t, e, n, r, s, i) {
|
|
4838
4848
|
// Use explicit order by's because it has to match the query the user made
|
|
4839
4849
|
const o = t.explicitOrderBy;
|
|
@@ -4843,17 +4853,17 @@ function fr(...t) {
|
|
|
4843
4853
|
const c = s[i];
|
|
4844
4854
|
if (o[i].field.isKeyField()) {
|
|
4845
4855
|
if ("string" != typeof c) throw new U(A, `Invalid query. Expected a string for document ID in ${r}(), but got a ${typeof c}`);
|
|
4846
|
-
if (!
|
|
4856
|
+
if (!he(t) && -1 !== c.indexOf("/")) throw new U(A, `Invalid query. When querying a collection and ordering by documentId(), the value passed to ${r}() must be a plain document ID, but '${c}' contains a slash.`);
|
|
4847
4857
|
const n = t.path.child(X.fromString(c));
|
|
4848
4858
|
if (!et.isDocumentKey(n)) throw new U(A, `Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${r}() must result in a valid document path, but '${n}' is not because it contains an odd number of segments.`);
|
|
4849
4859
|
const s = new et(n);
|
|
4850
|
-
u.push(
|
|
4860
|
+
u.push(Lt(e, s));
|
|
4851
4861
|
} else {
|
|
4852
|
-
const t =
|
|
4862
|
+
const t = Ln(n, r, c);
|
|
4853
4863
|
u.push(t);
|
|
4854
4864
|
}
|
|
4855
4865
|
}
|
|
4856
|
-
return new
|
|
4866
|
+
return new re(u, i);
|
|
4857
4867
|
}
|
|
4858
4868
|
/**
|
|
4859
4869
|
* Parses the given `documentIdValue` into a `ReferenceValue`, throwing
|
|
@@ -4863,27 +4873,27 @@ function fr(...t) {
|
|
|
4863
4873
|
}
|
|
4864
4874
|
}
|
|
4865
4875
|
|
|
4866
|
-
function
|
|
4876
|
+
function mr(t, e, n) {
|
|
4867
4877
|
if ("string" == typeof (n = getModularInstance(n))) {
|
|
4868
4878
|
if ("" === n) throw new U(A, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
|
|
4869
|
-
if (!
|
|
4879
|
+
if (!he(e) && -1 !== n.indexOf("/")) throw new U(A, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);
|
|
4870
4880
|
const r = e.path.child(X.fromString(n));
|
|
4871
4881
|
if (!et.isDocumentKey(r)) throw new U(A, `Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);
|
|
4872
|
-
return
|
|
4882
|
+
return Lt(t, new et(r));
|
|
4873
4883
|
}
|
|
4874
|
-
if (n instanceof
|
|
4884
|
+
if (n instanceof an) return Lt(t, n._key);
|
|
4875
4885
|
throw new U(A, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${it(n)}.`);
|
|
4876
4886
|
}
|
|
4877
4887
|
|
|
4878
4888
|
/**
|
|
4879
4889
|
* Validates that the value passed into a disjunctive filter satisfies all
|
|
4880
4890
|
* array requirements.
|
|
4881
|
-
*/ function
|
|
4891
|
+
*/ function pr(t, e) {
|
|
4882
4892
|
if (!Array.isArray(t) || 0 === t.length) throw new U(A, `Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);
|
|
4883
4893
|
if (t.length > 10) throw new U(A, `Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`);
|
|
4884
4894
|
}
|
|
4885
4895
|
|
|
4886
|
-
function
|
|
4896
|
+
function yr(t, e, n) {
|
|
4887
4897
|
if (!n.isEqual(e)) throw new U(A, `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.`);
|
|
4888
4898
|
}
|
|
4889
4899
|
|
|
@@ -4934,7 +4944,7 @@ function pr(t, e, n) {
|
|
|
4934
4944
|
* their `set()` or fails due to invalid data originating from a `toFirestore()`
|
|
4935
4945
|
* call.
|
|
4936
4946
|
*/
|
|
4937
|
-
function
|
|
4947
|
+
function _r(t, e, n) {
|
|
4938
4948
|
let r;
|
|
4939
4949
|
// Cast to `any` in order to satisfy the union type constraint on
|
|
4940
4950
|
// toFirestore().
|
|
@@ -4943,9 +4953,9 @@ function yr(t, e, n) {
|
|
|
4943
4953
|
r;
|
|
4944
4954
|
}
|
|
4945
4955
|
|
|
4946
|
-
class
|
|
4956
|
+
class gr extends class {
|
|
4947
4957
|
convertValue(t, e = "none") {
|
|
4948
|
-
switch (
|
|
4958
|
+
switch (Ft(t)) {
|
|
4949
4959
|
case 0 /* NullValue */ :
|
|
4950
4960
|
return null;
|
|
4951
4961
|
|
|
@@ -5014,7 +5024,7 @@ class _r extends class {
|
|
|
5014
5024
|
}
|
|
5015
5025
|
convertDocumentKey(t, e) {
|
|
5016
5026
|
const n = X.fromString(t);
|
|
5017
|
-
|
|
5027
|
+
b(We(n));
|
|
5018
5028
|
const r = new K(n.get(1), n.get(3)), s = new et(n.popFirst(5));
|
|
5019
5029
|
return r.isEqual(e) ||
|
|
5020
5030
|
// TODO(b/64130202): Somehow support foreign references.
|
|
@@ -5026,11 +5036,11 @@ class _r extends class {
|
|
|
5026
5036
|
super(), this.firestore = t;
|
|
5027
5037
|
}
|
|
5028
5038
|
convertBytes(t) {
|
|
5029
|
-
return new
|
|
5039
|
+
return new gn(t);
|
|
5030
5040
|
}
|
|
5031
5041
|
convertReference(t) {
|
|
5032
5042
|
const e = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
5033
|
-
return new
|
|
5043
|
+
return new an(this.firestore, /* converter= */ null, e);
|
|
5034
5044
|
}
|
|
5035
5045
|
}
|
|
5036
5046
|
|
|
@@ -5046,12 +5056,12 @@ class _r extends class {
|
|
|
5046
5056
|
* @param reference - The reference of the document to fetch.
|
|
5047
5057
|
* @returns A Promise resolved with a `DocumentSnapshot` containing the current
|
|
5048
5058
|
* document contents.
|
|
5049
|
-
*/ function
|
|
5050
|
-
const e =
|
|
5051
|
-
return
|
|
5052
|
-
|
|
5059
|
+
*/ function br(t) {
|
|
5060
|
+
const e = en((t = ot(t, an)).firestore), n = new gr(t.firestore);
|
|
5061
|
+
return Xe(e, [ t._key ]).then((e => {
|
|
5062
|
+
b(1 === e.length);
|
|
5053
5063
|
const r = e[0];
|
|
5054
|
-
return new
|
|
5064
|
+
return new Yn(t.firestore, n, t._key, r.isFoundDocument() ? r : null, t.converter);
|
|
5055
5065
|
}));
|
|
5056
5066
|
}
|
|
5057
5067
|
|
|
@@ -5069,30 +5079,30 @@ class _r extends class {
|
|
|
5069
5079
|
*/ function vr(t) {
|
|
5070
5080
|
!function(t) {
|
|
5071
5081
|
if ("L" /* Last */ === t.limitType && 0 === t.explicitOrderBy.length) throw new U(q, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
5072
|
-
}((t = ot(t,
|
|
5073
|
-
const e =
|
|
5074
|
-
return
|
|
5075
|
-
const r = e.map((e => new
|
|
5082
|
+
}((t = ot(t, hn))._query);
|
|
5083
|
+
const e = en(t.firestore), n = new gr(t.firestore);
|
|
5084
|
+
return Ze(e, t._query).then((e => {
|
|
5085
|
+
const r = e.map((e => new Hn(t.firestore, n, e.key, e, t.converter)));
|
|
5076
5086
|
return "L" /* Last */ === t._query.limitType &&
|
|
5077
5087
|
// Limit to last queries reverse the orderBy constraint that was
|
|
5078
5088
|
// specified by the user. As such, we need to reverse the order of the
|
|
5079
5089
|
// results to return the documents in the expected order.
|
|
5080
|
-
r.reverse(), new
|
|
5090
|
+
r.reverse(), new Kn(t, r);
|
|
5081
5091
|
}));
|
|
5082
5092
|
}
|
|
5083
5093
|
|
|
5084
|
-
function
|
|
5085
|
-
const r =
|
|
5086
|
-
return
|
|
5094
|
+
function Er(t, e, n) {
|
|
5095
|
+
const r = _r((t = ot(t, an)).converter, e, n), s = Dn(Vn(t.firestore), "setDoc", t._key, r, null !== t.converter, n);
|
|
5096
|
+
return Je(en(t.firestore), [ s.toMutation(t._key, ve.none()) ]);
|
|
5087
5097
|
}
|
|
5088
5098
|
|
|
5089
|
-
function
|
|
5090
|
-
const s =
|
|
5099
|
+
function Tr(t, e, n, ...r) {
|
|
5100
|
+
const s = Vn((t = ot(t, an)).firestore);
|
|
5091
5101
|
// For Compat types, we have to "extract" the underlying types before
|
|
5092
5102
|
// performing validation.
|
|
5093
5103
|
let i;
|
|
5094
|
-
i = "string" == typeof (e = getModularInstance(e)) || e instanceof
|
|
5095
|
-
return
|
|
5104
|
+
i = "string" == typeof (e = getModularInstance(e)) || e instanceof yn ? Cn(s, "updateDoc", t._key, e, n, r) : On(s, "updateDoc", t._key, e);
|
|
5105
|
+
return Je(en(t.firestore), [ i.toMutation(t._key, ve.exists(!0)) ]);
|
|
5096
5106
|
}
|
|
5097
5107
|
|
|
5098
5108
|
/**
|
|
@@ -5106,8 +5116,8 @@ function Er(t, e, n, ...r) {
|
|
|
5106
5116
|
* @param reference - A reference to the document to delete.
|
|
5107
5117
|
* @returns A `Promise` resolved once the document has been successfully
|
|
5108
5118
|
* deleted from the backend.
|
|
5109
|
-
*/ function
|
|
5110
|
-
return
|
|
5119
|
+
*/ function Ir(t) {
|
|
5120
|
+
return Je(en((t = ot(t, an)).firestore), [ new Ae(t._key, ve.none()) ]);
|
|
5111
5121
|
}
|
|
5112
5122
|
|
|
5113
5123
|
/**
|
|
@@ -5124,9 +5134,9 @@ function Er(t, e, n, ...r) {
|
|
|
5124
5134
|
* @throws Error - If the provided input is not a valid Firestore document.
|
|
5125
5135
|
* @returns A `Promise` resolved with a `DocumentReference` pointing to the
|
|
5126
5136
|
* newly created document after it has been written to the backend.
|
|
5127
|
-
*/ function
|
|
5128
|
-
const n =
|
|
5129
|
-
return
|
|
5137
|
+
*/ function Ar(t, e) {
|
|
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
|
+
return Je(en(t.firestore), [ s.toMutation(n._key, ve.exists(!1)) ]).then((() => n));
|
|
5130
5140
|
}
|
|
5131
5141
|
|
|
5132
5142
|
/**
|
|
@@ -5148,15 +5158,15 @@ function Er(t, e, n, ...r) {
|
|
|
5148
5158
|
/**
|
|
5149
5159
|
* Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or
|
|
5150
5160
|
* {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion.
|
|
5151
|
-
*/ function
|
|
5152
|
-
return new
|
|
5161
|
+
*/ function Rr() {
|
|
5162
|
+
return new Nn("deleteField");
|
|
5153
5163
|
}
|
|
5154
5164
|
|
|
5155
5165
|
/**
|
|
5156
5166
|
* Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
|
|
5157
5167
|
* include a server-generated timestamp in the written data.
|
|
5158
|
-
*/ function
|
|
5159
|
-
return new
|
|
5168
|
+
*/ function Pr() {
|
|
5169
|
+
return new Sn("serverTimestamp");
|
|
5160
5170
|
}
|
|
5161
5171
|
|
|
5162
5172
|
/**
|
|
@@ -5170,10 +5180,10 @@ function Er(t, e, n, ...r) {
|
|
|
5170
5180
|
* @param elements - The elements to union into the array.
|
|
5171
5181
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5172
5182
|
* `updateDoc()`.
|
|
5173
|
-
*/ function
|
|
5183
|
+
*/ function Vr(...t) {
|
|
5174
5184
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
5175
5185
|
// update() since we'd need the Firestore instance to do this.
|
|
5176
|
-
return new
|
|
5186
|
+
return new Fn("arrayUnion", t);
|
|
5177
5187
|
}
|
|
5178
5188
|
|
|
5179
5189
|
/**
|
|
@@ -5186,10 +5196,10 @@ function Er(t, e, n, ...r) {
|
|
|
5186
5196
|
* @param elements - The elements to remove from the array.
|
|
5187
5197
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5188
5198
|
* `updateDoc()`
|
|
5189
|
-
*/ function
|
|
5199
|
+
*/ function Dr(...t) {
|
|
5190
5200
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
5191
5201
|
// update() since we'd need the Firestore instance to do this.
|
|
5192
|
-
return new
|
|
5202
|
+
return new xn("arrayRemove", t);
|
|
5193
5203
|
}
|
|
5194
5204
|
|
|
5195
5205
|
/**
|
|
@@ -5210,8 +5220,8 @@ function Er(t, e, n, ...r) {
|
|
|
5210
5220
|
* @param n - The value to increment by.
|
|
5211
5221
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5212
5222
|
* `updateDoc()`
|
|
5213
|
-
*/ function
|
|
5214
|
-
return new
|
|
5223
|
+
*/ function Nr(t) {
|
|
5224
|
+
return new qn("increment", t);
|
|
5215
5225
|
}
|
|
5216
5226
|
|
|
5217
5227
|
/**
|
|
@@ -5237,24 +5247,24 @@ function Er(t, e, n, ...r) {
|
|
|
5237
5247
|
* provides methods for adding writes to the write batch. None of the writes
|
|
5238
5248
|
* will be committed (or visible locally) until {@link WriteBatch.commit} is
|
|
5239
5249
|
* called.
|
|
5240
|
-
*/ class
|
|
5250
|
+
*/ class $r {
|
|
5241
5251
|
/** @hideconstructor */
|
|
5242
5252
|
constructor(t, e) {
|
|
5243
5253
|
this._firestore = t, this._commitHandler = e, this._mutations = [], this._committed = !1,
|
|
5244
|
-
this._dataReader =
|
|
5254
|
+
this._dataReader = Vn(t);
|
|
5245
5255
|
}
|
|
5246
5256
|
set(t, e, n) {
|
|
5247
5257
|
this._verifyNotCommitted();
|
|
5248
|
-
const r =
|
|
5258
|
+
const r = Sr(t, this._firestore), s = _r(r.converter, e, n), i = Dn(this._dataReader, "WriteBatch.set", r._key, s, null !== r.converter, n);
|
|
5249
5259
|
return this._mutations.push(i.toMutation(r._key, ve.none())), this;
|
|
5250
5260
|
}
|
|
5251
5261
|
update(t, e, n, ...r) {
|
|
5252
5262
|
this._verifyNotCommitted();
|
|
5253
|
-
const s =
|
|
5263
|
+
const s = Sr(t, this._firestore);
|
|
5254
5264
|
// For Compat types, we have to "extract" the underlying types before
|
|
5255
5265
|
// performing validation.
|
|
5256
5266
|
let i;
|
|
5257
|
-
return i = "string" == typeof (e = getModularInstance(e)) || e instanceof
|
|
5267
|
+
return i = "string" == typeof (e = getModularInstance(e)) || e instanceof yn ? Cn(this._dataReader, "WriteBatch.update", s._key, e, n, r) : On(this._dataReader, "WriteBatch.update", s._key, e),
|
|
5258
5268
|
this._mutations.push(i.toMutation(s._key, ve.exists(!0))), this;
|
|
5259
5269
|
}
|
|
5260
5270
|
/**
|
|
@@ -5264,8 +5274,8 @@ function Er(t, e, n, ...r) {
|
|
|
5264
5274
|
* @returns This `WriteBatch` instance. Used for chaining method calls.
|
|
5265
5275
|
*/ delete(t) {
|
|
5266
5276
|
this._verifyNotCommitted();
|
|
5267
|
-
const e =
|
|
5268
|
-
return this._mutations = this._mutations.concat(new
|
|
5277
|
+
const e = Sr(t, this._firestore);
|
|
5278
|
+
return this._mutations = this._mutations.concat(new Ae(e._key, ve.none())), this;
|
|
5269
5279
|
}
|
|
5270
5280
|
/**
|
|
5271
5281
|
* Commits all of the writes in this write batch as a single atomic unit.
|
|
@@ -5286,7 +5296,7 @@ function Er(t, e, n, ...r) {
|
|
|
5286
5296
|
}
|
|
5287
5297
|
}
|
|
5288
5298
|
|
|
5289
|
-
function
|
|
5299
|
+
function Sr(t, e) {
|
|
5290
5300
|
if ((t = getModularInstance(t)).firestore !== e) throw new U(A, "Provided document reference is from a different Firestore instance.");
|
|
5291
5301
|
return t;
|
|
5292
5302
|
}
|
|
@@ -5303,9 +5313,9 @@ function $r(t, e) {
|
|
|
5303
5313
|
*
|
|
5304
5314
|
* @returns A `WriteBatch` that can be used to atomically execute multiple
|
|
5305
5315
|
* writes.
|
|
5306
|
-
*/ function
|
|
5307
|
-
const e =
|
|
5308
|
-
return new
|
|
5316
|
+
*/ function Fr(t) {
|
|
5317
|
+
const e = en(t = ot(t, rn));
|
|
5318
|
+
return new $r(t, (t => Je(e, t)));
|
|
5309
5319
|
}
|
|
5310
5320
|
|
|
5311
5321
|
/**
|
|
@@ -5327,7 +5337,7 @@ function $r(t, e) {
|
|
|
5327
5337
|
/**
|
|
5328
5338
|
* Internal transaction object responsible for accumulating the mutations to
|
|
5329
5339
|
* perform and the base versions for any documents read.
|
|
5330
|
-
*/ class
|
|
5340
|
+
*/ class xr {
|
|
5331
5341
|
constructor(t) {
|
|
5332
5342
|
this.datastore = t,
|
|
5333
5343
|
// The version of each document that was read during this transaction.
|
|
@@ -5347,7 +5357,7 @@ function $r(t, e) {
|
|
|
5347
5357
|
}
|
|
5348
5358
|
async lookup(t) {
|
|
5349
5359
|
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new U(A, "Firestore transactions require all reads to be executed before all writes.");
|
|
5350
|
-
const e = await
|
|
5360
|
+
const e = await Xe(this.datastore, t);
|
|
5351
5361
|
return e.forEach((t => this.recordVersion(t))), e;
|
|
5352
5362
|
}
|
|
5353
5363
|
set(t, e) {
|
|
@@ -5362,7 +5372,7 @@ function $r(t, e) {
|
|
|
5362
5372
|
this.writtenDocs.add(t.toString());
|
|
5363
5373
|
}
|
|
5364
5374
|
delete(t) {
|
|
5365
|
-
this.write(new
|
|
5375
|
+
this.write(new Ae(t, this.precondition(t))), this.writtenDocs.add(t.toString());
|
|
5366
5376
|
}
|
|
5367
5377
|
async commit() {
|
|
5368
5378
|
if (this.ensureCommitNotCalled(), this.lastWriteError) throw this.lastWriteError;
|
|
@@ -5375,15 +5385,15 @@ function $r(t, e) {
|
|
|
5375
5385
|
// a `verify` operation.
|
|
5376
5386
|
t.forEach(((t, e) => {
|
|
5377
5387
|
const n = et.fromPath(e);
|
|
5378
|
-
this.mutations.push(new
|
|
5379
|
-
})), await
|
|
5388
|
+
this.mutations.push(new Re(n, this.precondition(n)));
|
|
5389
|
+
})), await Je(this.datastore, this.mutations), this.committed = !0;
|
|
5380
5390
|
}
|
|
5381
5391
|
recordVersion(t) {
|
|
5382
5392
|
let e;
|
|
5383
5393
|
if (t.isFoundDocument()) e = t.version; else {
|
|
5384
5394
|
if (!t.isNoDocument()) throw g();
|
|
5385
5395
|
// For deleted docs, we must use baseVersion 0 when we overwrite them.
|
|
5386
|
-
e =
|
|
5396
|
+
e = bt.min();
|
|
5387
5397
|
}
|
|
5388
5398
|
const n = this.readVersions.get(t.key.toString());
|
|
5389
5399
|
if (n) {
|
|
@@ -5406,7 +5416,7 @@ function $r(t, e) {
|
|
|
5406
5416
|
// The first time a document is written, we want to take into account the
|
|
5407
5417
|
// read time and existence
|
|
5408
5418
|
if (!this.writtenDocs.has(t.toString()) && e) {
|
|
5409
|
-
if (e.isEqual(
|
|
5419
|
+
if (e.isEqual(bt.min()))
|
|
5410
5420
|
// The document doesn't exist, so fail the transaction.
|
|
5411
5421
|
// This has to be validated locally because you can't send a
|
|
5412
5422
|
// precondition that a document does not exist without changing the
|
|
@@ -5450,17 +5460,17 @@ function $r(t, e) {
|
|
|
5450
5460
|
* TransactionRunner encapsulates the logic needed to run and retry transactions
|
|
5451
5461
|
* with backoff.
|
|
5452
5462
|
*/
|
|
5453
|
-
class
|
|
5463
|
+
class qr {
|
|
5454
5464
|
constructor(t, e, n, r) {
|
|
5455
5465
|
this.asyncQueue = t, this.datastore = e, this.updateFunction = n, this.deferred = r,
|
|
5456
|
-
this.Tt = 5, this.It = new
|
|
5466
|
+
this.Tt = 5, this.It = new He(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
|
|
5457
5467
|
}
|
|
5458
5468
|
/** Runs the transaction and sets the result on deferred. */ run() {
|
|
5459
5469
|
this.Tt -= 1, this.At();
|
|
5460
5470
|
}
|
|
5461
5471
|
At() {
|
|
5462
5472
|
this.It.W((async () => {
|
|
5463
|
-
const t = new
|
|
5473
|
+
const t = new xr(this.datastore), e = this.Rt(t);
|
|
5464
5474
|
e && e.then((e => {
|
|
5465
5475
|
this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
|
|
5466
5476
|
this.deferred.resolve(e);
|
|
@@ -5550,7 +5560,7 @@ class xr {
|
|
|
5550
5560
|
* See the License for the specific language governing permissions and
|
|
5551
5561
|
* limitations under the License.
|
|
5552
5562
|
*/
|
|
5553
|
-
/** The Platform's 'document' implementation or null if not available. */ function
|
|
5563
|
+
/** The Platform's 'document' implementation or null if not available. */ function Or() {
|
|
5554
5564
|
// `document` is not always available, e.g. in ReactNative and WebWorkers.
|
|
5555
5565
|
// eslint-disable-next-line no-restricted-globals
|
|
5556
5566
|
return "undefined" != typeof document ? document : null;
|
|
@@ -5582,7 +5592,7 @@ class xr {
|
|
|
5582
5592
|
* Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type
|
|
5583
5593
|
* in newer versions of TypeScript defines `finally`, which is not available in
|
|
5584
5594
|
* IE.
|
|
5585
|
-
*/ class
|
|
5595
|
+
*/ class Cr {
|
|
5586
5596
|
constructor(t, e, n, r, s) {
|
|
5587
5597
|
this.asyncQueue = t, this.timerId = e, this.targetTimeMs = n, this.op = r, this.removalCallback = s,
|
|
5588
5598
|
this.deferred = new k, this.then = this.deferred.promise.then.bind(this.deferred.promise),
|
|
@@ -5605,7 +5615,7 @@ class xr {
|
|
|
5605
5615
|
* PORTING NOTE: This exists to prevent making removeDelayedOperation() and
|
|
5606
5616
|
* the DelayedOperation class public.
|
|
5607
5617
|
*/ static createAndSchedule(t, e, n, r, s) {
|
|
5608
|
-
const i = Date.now() + n, o = new
|
|
5618
|
+
const i = Date.now() + n, o = new Cr(t, e, i, r, s);
|
|
5609
5619
|
return o.start(n), o;
|
|
5610
5620
|
}
|
|
5611
5621
|
/**
|
|
@@ -5654,7 +5664,7 @@ class xr {
|
|
|
5654
5664
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5655
5665
|
* See the License for the specific language governing permissions and
|
|
5656
5666
|
* limitations under the License.
|
|
5657
|
-
*/ class
|
|
5667
|
+
*/ class Lr {
|
|
5658
5668
|
constructor() {
|
|
5659
5669
|
// The last promise in the queue.
|
|
5660
5670
|
this.Dt = Promise.resolve(),
|
|
@@ -5677,15 +5687,15 @@ class xr {
|
|
|
5677
5687
|
// List of TimerIds to fast-forward delays for.
|
|
5678
5688
|
this.Ot = [],
|
|
5679
5689
|
// Backoff timer used to schedule retries for retryable operations
|
|
5680
|
-
this.It = new
|
|
5690
|
+
this.It = new He(this, "async_queue_retry" /* AsyncQueueRetry */),
|
|
5681
5691
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
5682
5692
|
// operations. Meant to speed up recovery when we regain file system access
|
|
5683
5693
|
// after page comes into foreground.
|
|
5684
5694
|
this.Ct = () => {
|
|
5685
|
-
const t =
|
|
5695
|
+
const t = Or();
|
|
5686
5696
|
t && m("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.It.H();
|
|
5687
5697
|
};
|
|
5688
|
-
const t =
|
|
5698
|
+
const t = Or();
|
|
5689
5699
|
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Ct);
|
|
5690
5700
|
}
|
|
5691
5701
|
get isShuttingDown() {
|
|
@@ -5706,7 +5716,7 @@ class xr {
|
|
|
5706
5716
|
enterRestrictedMode(t) {
|
|
5707
5717
|
if (!this.$t) {
|
|
5708
5718
|
this.$t = !0, this.qt = t || !1;
|
|
5709
|
-
const e =
|
|
5719
|
+
const e = Or();
|
|
5710
5720
|
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Ct);
|
|
5711
5721
|
}
|
|
5712
5722
|
}
|
|
@@ -5838,7 +5848,7 @@ class xr {
|
|
|
5838
5848
|
this.Lt(),
|
|
5839
5849
|
// Fast-forward delays for timerIds that have been overriden.
|
|
5840
5850
|
this.Ot.indexOf(t) > -1 && (e = 0);
|
|
5841
|
-
const r =
|
|
5851
|
+
const r = Cr.createAndSchedule(this, t, e, n, (t => this.jt(t)));
|
|
5842
5852
|
return this.St.push(r), r;
|
|
5843
5853
|
}
|
|
5844
5854
|
Lt() {
|
|
@@ -5892,10 +5902,10 @@ class xr {
|
|
|
5892
5902
|
}
|
|
5893
5903
|
}
|
|
5894
5904
|
|
|
5895
|
-
class
|
|
5905
|
+
class Ur {
|
|
5896
5906
|
/** @hideconstructor */
|
|
5897
5907
|
constructor(t, e) {
|
|
5898
|
-
this._firestore = t, this._transaction = e, this._dataReader =
|
|
5908
|
+
this._firestore = t, this._transaction = e, this._dataReader = Vn(t);
|
|
5899
5909
|
}
|
|
5900
5910
|
/**
|
|
5901
5911
|
* Reads the document referenced by the provided {@link DocumentReference}.
|
|
@@ -5903,25 +5913,25 @@ class Lr {
|
|
|
5903
5913
|
* @param documentRef - A reference to the document to be read.
|
|
5904
5914
|
* @returns A `DocumentSnapshot` with the read data.
|
|
5905
5915
|
*/ get(t) {
|
|
5906
|
-
const e =
|
|
5916
|
+
const e = Sr(t, this._firestore), n = new gr(this._firestore);
|
|
5907
5917
|
return this._transaction.lookup([ e._key ]).then((t => {
|
|
5908
5918
|
if (!t || 1 !== t.length) return g();
|
|
5909
5919
|
const r = t[0];
|
|
5910
|
-
if (r.isFoundDocument()) return new
|
|
5911
|
-
if (r.isNoDocument()) return new
|
|
5920
|
+
if (r.isFoundDocument()) return new Yn(this._firestore, n, r.key, r, e.converter);
|
|
5921
|
+
if (r.isNoDocument()) return new Yn(this._firestore, n, e._key, null, e.converter);
|
|
5912
5922
|
throw g();
|
|
5913
5923
|
}));
|
|
5914
5924
|
}
|
|
5915
5925
|
set(t, e, n) {
|
|
5916
|
-
const r =
|
|
5926
|
+
const r = Sr(t, this._firestore), s = _r(r.converter, e, n), i = Dn(this._dataReader, "Transaction.set", r._key, s, null !== r.converter, n);
|
|
5917
5927
|
return this._transaction.set(r._key, i), this;
|
|
5918
5928
|
}
|
|
5919
5929
|
update(t, e, n, ...r) {
|
|
5920
|
-
const s =
|
|
5930
|
+
const s = Sr(t, this._firestore);
|
|
5921
5931
|
// For Compat types, we have to "extract" the underlying types before
|
|
5922
5932
|
// performing validation.
|
|
5923
5933
|
let i;
|
|
5924
|
-
return i = "string" == typeof (e = getModularInstance(e)) || e instanceof
|
|
5934
|
+
return i = "string" == typeof (e = getModularInstance(e)) || e instanceof yn ? Cn(this._dataReader, "Transaction.update", s._key, e, n, r) : On(this._dataReader, "Transaction.update", s._key, e),
|
|
5925
5935
|
this._transaction.update(s._key, i), this;
|
|
5926
5936
|
}
|
|
5927
5937
|
/**
|
|
@@ -5930,7 +5940,7 @@ class Lr {
|
|
|
5930
5940
|
* @param documentRef - A reference to the document to be deleted.
|
|
5931
5941
|
* @returns This `Transaction` instance. Used for chaining method calls.
|
|
5932
5942
|
*/ delete(t) {
|
|
5933
|
-
const e =
|
|
5943
|
+
const e = Sr(t, this._firestore);
|
|
5934
5944
|
return this._transaction.delete(e._key), this;
|
|
5935
5945
|
}
|
|
5936
5946
|
}
|
|
@@ -5951,9 +5961,9 @@ class Lr {
|
|
|
5951
5961
|
* (the `updateFunction` returned a failed promise), the promise returned by the
|
|
5952
5962
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
5953
5963
|
* rejected promise with the corresponding failure error is returned.
|
|
5954
|
-
*/ function
|
|
5955
|
-
const n =
|
|
5956
|
-
return new
|
|
5964
|
+
*/ function kr(t, e) {
|
|
5965
|
+
const n = en(t = ot(t, rn)), r = new k;
|
|
5966
|
+
return new qr(new Lr, n, (n => e(new Ur(t, n))), r).run(), r.promise;
|
|
5957
5967
|
}
|
|
5958
5968
|
|
|
5959
5969
|
/**
|
|
@@ -5966,11 +5976,11 @@ class Lr {
|
|
|
5966
5976
|
*/ !function(t) {
|
|
5967
5977
|
f = t;
|
|
5968
5978
|
}(`${SDK_VERSION}_lite`), _registerComponent(new Component("firestore/lite", ((t, {options: e}) => {
|
|
5969
|
-
const n = t.getProvider("app").getImmediate(), r = new
|
|
5979
|
+
const n = t.getProvider("app").getImmediate(), r = new rn(n, new z(t.getProvider("auth-internal")), new Y(t.getProvider("app-check-internal")));
|
|
5970
5980
|
return e && r._setSettings(e), r;
|
|
5971
5981
|
}), "PUBLIC")),
|
|
5972
5982
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
5973
|
-
registerVersion("firestore-lite", "3.4.8-canary.
|
|
5983
|
+
registerVersion("firestore-lite", "3.4.8-canary.d8be8bf1c", ""), registerVersion("firestore-lite", "3.4.8-canary.d8be8bf1c", "esm2017");
|
|
5974
5984
|
|
|
5975
|
-
export {
|
|
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, Ur as Transaction, $r as WriteBatch, Ar as addDoc, Dr as arrayRemove, Vr as arrayUnion, fn as collection, dn as collectionGroup, un as connectFirestoreEmulator, Ir 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, kr 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, Fr as writeBatch };
|
|
5976
5986
|
//# sourceMappingURL=index.browser.esm2017.js.map
|