@firebase/firestore 3.4.7-canary.e9e5f6b3c → 3.4.8-canary.215e657ea
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/firestore/src/core/query.d.ts +2 -4
- package/dist/firestore/src/core/target.d.ts +6 -4
- package/dist/firestore/src/local/index_manager.d.ts +24 -3
- package/dist/firestore/src/local/indexeddb_index_manager.d.ts +4 -7
- package/dist/firestore/src/local/indexeddb_remote_document_cache.d.ts +9 -0
- package/dist/firestore/src/local/indexeddb_schema.d.ts +1 -0
- package/dist/firestore/src/local/local_documents_view.d.ts +1 -1
- package/dist/firestore/src/local/memory_index_manager.d.ts +3 -2
- package/dist/firestore/src/local/query_engine.d.ts +44 -5
- package/dist/firestore/src/local/simple_db.d.ts +2 -0
- package/dist/firestore/src/model/collections.d.ts +1 -1
- package/dist/firestore/src/model/values.d.ts +14 -2
- package/dist/firestore/src/util/misc.d.ts +3 -0
- package/dist/firestore/test/unit/local/counting_query_engine.d.ts +2 -1
- package/dist/firestore/test/unit/local/test_index_manager.d.ts +2 -2
- package/dist/firestore/test/unit/local/test_remote_document_cache.d.ts +0 -4
- package/dist/index.esm2017.js +4126 -4027
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +3957 -3865
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +1698 -1562
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +1698 -1562
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +4120 -4021
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +25 -3
- package/dist/lite/firestore/src/core/query.d.ts +2 -4
- package/dist/lite/firestore/src/core/target.d.ts +6 -4
- package/dist/lite/firestore/src/local/index_manager.d.ts +24 -3
- package/dist/lite/firestore/src/local/indexeddb_index_manager.d.ts +4 -7
- package/dist/lite/firestore/src/local/indexeddb_remote_document_cache.d.ts +9 -0
- package/dist/lite/firestore/src/local/indexeddb_schema.d.ts +1 -0
- package/dist/lite/firestore/src/local/local_documents_view.d.ts +1 -1
- package/dist/lite/firestore/src/local/memory_index_manager.d.ts +3 -2
- package/dist/lite/firestore/src/local/query_engine.d.ts +44 -5
- package/dist/lite/firestore/src/local/simple_db.d.ts +2 -0
- package/dist/lite/firestore/src/model/collections.d.ts +1 -1
- package/dist/lite/firestore/src/model/values.d.ts +14 -2
- package/dist/lite/firestore/src/util/misc.d.ts +3 -0
- package/dist/lite/firestore/test/unit/local/counting_query_engine.d.ts +2 -1
- package/dist/lite/firestore/test/unit/local/test_index_manager.d.ts +2 -2
- package/dist/lite/firestore/test/unit/local/test_remote_document_cache.d.ts +0 -4
- package/dist/lite/index.browser.esm2017.js +190 -184
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +209 -203
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +24 -10
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +24 -10
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +123 -117
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +18 -18
- package/dist/lite/packages/firestore/src/core/query.d.ts +2 -4
- package/dist/lite/packages/firestore/src/core/target.d.ts +6 -4
- package/dist/lite/packages/firestore/src/local/index_manager.d.ts +24 -3
- package/dist/lite/packages/firestore/src/local/indexeddb_index_manager.d.ts +4 -7
- package/dist/lite/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +9 -0
- package/dist/lite/packages/firestore/src/local/indexeddb_schema.d.ts +1 -0
- package/dist/lite/packages/firestore/src/local/local_documents_view.d.ts +1 -1
- package/dist/lite/packages/firestore/src/local/memory_index_manager.d.ts +3 -2
- package/dist/lite/packages/firestore/src/local/query_engine.d.ts +44 -5
- package/dist/lite/packages/firestore/src/local/simple_db.d.ts +2 -0
- package/dist/lite/packages/firestore/src/model/collections.d.ts +1 -1
- package/dist/lite/packages/firestore/src/model/values.d.ts +14 -2
- package/dist/lite/packages/firestore/src/util/misc.d.ts +3 -0
- package/dist/lite/packages/firestore/test/unit/local/counting_query_engine.d.ts +2 -1
- package/dist/lite/packages/firestore/test/unit/local/test_index_manager.d.ts +2 -2
- package/dist/lite/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +0 -4
- package/dist/packages/firestore/dist/index.esm2017.d.ts +168 -168
- package/dist/packages/firestore/src/core/query.d.ts +2 -4
- package/dist/packages/firestore/src/core/target.d.ts +6 -4
- package/dist/packages/firestore/src/local/index_manager.d.ts +24 -3
- package/dist/packages/firestore/src/local/indexeddb_index_manager.d.ts +4 -7
- package/dist/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +9 -0
- package/dist/packages/firestore/src/local/indexeddb_schema.d.ts +1 -0
- package/dist/packages/firestore/src/local/local_documents_view.d.ts +1 -1
- package/dist/packages/firestore/src/local/memory_index_manager.d.ts +3 -2
- package/dist/packages/firestore/src/local/query_engine.d.ts +44 -5
- package/dist/packages/firestore/src/local/simple_db.d.ts +2 -0
- package/dist/packages/firestore/src/model/collections.d.ts +1 -1
- package/dist/packages/firestore/src/model/values.d.ts +14 -2
- package/dist/packages/firestore/src/util/misc.d.ts +3 -0
- package/dist/packages/firestore/test/unit/local/counting_query_engine.d.ts +2 -1
- package/dist/packages/firestore/test/unit/local/test_index_manager.d.ts +2 -2
- package/dist/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +0 -4
- package/dist/private.d.ts +25 -3
- package/package.json +9 -9
|
@@ -66,7 +66,7 @@ f.MOCK_USER = new f("mock-user");
|
|
|
66
66
|
* See the License for the specific language governing permissions and
|
|
67
67
|
* limitations under the License.
|
|
68
68
|
*/
|
|
69
|
-
let d = "9.6.
|
|
69
|
+
let d = "9.6.11-canary.215e657ea";
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* @license
|
|
@@ -1676,9 +1676,16 @@ const Pt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1676
1676
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1677
1677
|
* See the License for the specific language governing permissions and
|
|
1678
1678
|
* limitations under the License.
|
|
1679
|
-
*/
|
|
1679
|
+
*/ const xt = {
|
|
1680
|
+
fields: {
|
|
1681
|
+
__type__: {
|
|
1682
|
+
stringValue: "__max__"
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
};
|
|
1686
|
+
|
|
1680
1687
|
/** Extracts the backend's type order for the provided value. */
|
|
1681
|
-
function
|
|
1688
|
+
function qt(t) {
|
|
1682
1689
|
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 ? $t(t) ? 4 /* ServerTimestampValue */ :
|
|
1683
1690
|
/** Returns true if the Value represents the canonical {@link #MAX_VALUE} . */
|
|
1684
1691
|
function(t) {
|
|
@@ -1703,13 +1710,13 @@ function xt(t) {
|
|
|
1703
1710
|
/**
|
|
1704
1711
|
* An ObjectValue represents a MapValue in the Firestore Proto and offers the
|
|
1705
1712
|
* ability to add and remove fields (via the ObjectValueBuilder).
|
|
1706
|
-
*/ (t) ?
|
|
1713
|
+
*/ (t) ? 9007199254740991 /* MaxValue */ : 10 /* ObjectValue */ : v();
|
|
1707
1714
|
}
|
|
1708
1715
|
|
|
1709
|
-
/** Tests `left` and `right` for equality based on the backend semantics. */ function
|
|
1716
|
+
/** Tests `left` and `right` for equality based on the backend semantics. */ function Ot(t, e) {
|
|
1710
1717
|
if (t === e) return !0;
|
|
1711
|
-
const n =
|
|
1712
|
-
if (n !==
|
|
1718
|
+
const n = qt(t);
|
|
1719
|
+
if (n !== qt(e)) return !1;
|
|
1713
1720
|
switch (n) {
|
|
1714
1721
|
case 0 /* NullValue */ :
|
|
1715
1722
|
case 9007199254740991 /* MaxValue */ :
|
|
@@ -1757,13 +1764,13 @@ function xt(t) {
|
|
|
1757
1764
|
}(t, e);
|
|
1758
1765
|
|
|
1759
1766
|
case 9 /* ArrayValue */ :
|
|
1760
|
-
return gt(t.arrayValue.values || [], e.arrayValue.values || [],
|
|
1767
|
+
return gt(t.arrayValue.values || [], e.arrayValue.values || [], Ot);
|
|
1761
1768
|
|
|
1762
1769
|
case 10 /* ObjectValue */ :
|
|
1763
1770
|
return function(t, e) {
|
|
1764
1771
|
const n = t.mapValue.fields || {}, r = e.mapValue.fields || {};
|
|
1765
1772
|
if (Et(n) !== Et(r)) return !1;
|
|
1766
|
-
for (const t in n) if (n.hasOwnProperty(t) && (void 0 === r[t] || !
|
|
1773
|
+
for (const t in n) if (n.hasOwnProperty(t) && (void 0 === r[t] || !Ot(n[t], r[t]))) return !1;
|
|
1767
1774
|
return !0;
|
|
1768
1775
|
}
|
|
1769
1776
|
/** Returns true if the ArrayValue contains the specified element. */ (t, e);
|
|
@@ -1773,13 +1780,13 @@ function xt(t) {
|
|
|
1773
1780
|
}
|
|
1774
1781
|
}
|
|
1775
1782
|
|
|
1776
|
-
function
|
|
1777
|
-
return void 0 !== (t.values || []).find((t =>
|
|
1783
|
+
function Ct(t, e) {
|
|
1784
|
+
return void 0 !== (t.values || []).find((t => Ot(t, e)));
|
|
1778
1785
|
}
|
|
1779
1786
|
|
|
1780
|
-
function
|
|
1787
|
+
function Lt(t, e) {
|
|
1781
1788
|
if (t === e) return 0;
|
|
1782
|
-
const n =
|
|
1789
|
+
const n = qt(t), r = qt(e);
|
|
1783
1790
|
if (n !== r) return _t(n, r);
|
|
1784
1791
|
switch (n) {
|
|
1785
1792
|
case 0 /* NullValue */ :
|
|
@@ -1798,10 +1805,10 @@ function Ct(t, e) {
|
|
|
1798
1805
|
}(t, e);
|
|
1799
1806
|
|
|
1800
1807
|
case 3 /* TimestampValue */ :
|
|
1801
|
-
return
|
|
1808
|
+
return kt(t.timestampValue, e.timestampValue);
|
|
1802
1809
|
|
|
1803
1810
|
case 4 /* ServerTimestampValue */ :
|
|
1804
|
-
return
|
|
1811
|
+
return kt(Ft(t), Ft(e));
|
|
1805
1812
|
|
|
1806
1813
|
case 5 /* StringValue */ :
|
|
1807
1814
|
return _t(t.stringValue, e.stringValue);
|
|
@@ -1833,7 +1840,7 @@ function Ct(t, e) {
|
|
|
1833
1840
|
return function(t, e) {
|
|
1834
1841
|
const n = t.values || [], r = e.values || [];
|
|
1835
1842
|
for (let t = 0; t < n.length && t < r.length; ++t) {
|
|
1836
|
-
const e =
|
|
1843
|
+
const e = Lt(n[t], r[t]);
|
|
1837
1844
|
if (e) return e;
|
|
1838
1845
|
}
|
|
1839
1846
|
return _t(n.length, r.length);
|
|
@@ -1841,6 +1848,9 @@ function Ct(t, e) {
|
|
|
1841
1848
|
|
|
1842
1849
|
case 10 /* ObjectValue */ :
|
|
1843
1850
|
return function(t, e) {
|
|
1851
|
+
if (t === xt && e === xt) return 0;
|
|
1852
|
+
if (t === xt) return 1;
|
|
1853
|
+
if (e === xt) return -1;
|
|
1844
1854
|
const n = t.fields || {}, r = Object.keys(n), s = e.fields || {}, i = Object.keys(s);
|
|
1845
1855
|
// Even though MapValues are likely sorted correctly based on their insertion
|
|
1846
1856
|
// order (e.g. when received from the backend), local modifications can bring
|
|
@@ -1850,7 +1860,7 @@ function Ct(t, e) {
|
|
|
1850
1860
|
for (let t = 0; t < r.length && t < i.length; ++t) {
|
|
1851
1861
|
const e = _t(r[t], i[t]);
|
|
1852
1862
|
if (0 !== e) return e;
|
|
1853
|
-
const o =
|
|
1863
|
+
const o = Lt(n[r[t]], s[i[t]]);
|
|
1854
1864
|
if (0 !== o) return o;
|
|
1855
1865
|
}
|
|
1856
1866
|
return _t(r.length, i.length);
|
|
@@ -1862,35 +1872,35 @@ function Ct(t, e) {
|
|
|
1862
1872
|
}
|
|
1863
1873
|
}
|
|
1864
1874
|
|
|
1865
|
-
function
|
|
1875
|
+
function kt(t, e) {
|
|
1866
1876
|
if ("string" == typeof t && "string" == typeof e && t.length === e.length) return _t(t, e);
|
|
1867
1877
|
const n = Vt(t), r = Vt(e), s = _t(n.seconds, r.seconds);
|
|
1868
1878
|
return 0 !== s ? s : _t(n.nanos, r.nanos);
|
|
1869
1879
|
}
|
|
1870
1880
|
|
|
1871
|
-
function
|
|
1881
|
+
function Ut(t, e) {
|
|
1872
1882
|
return {
|
|
1873
1883
|
referenceValue: `projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`
|
|
1874
1884
|
};
|
|
1875
1885
|
}
|
|
1876
1886
|
|
|
1877
|
-
/** Returns true if `value` is an ArrayValue. */ function
|
|
1887
|
+
/** Returns true if `value` is an ArrayValue. */ function jt(t) {
|
|
1878
1888
|
return !!t && "arrayValue" in t;
|
|
1879
1889
|
}
|
|
1880
1890
|
|
|
1881
|
-
/** Returns true if `value` is a NullValue. */ function
|
|
1891
|
+
/** Returns true if `value` is a NullValue. */ function Mt(t) {
|
|
1882
1892
|
return !!t && "nullValue" in t;
|
|
1883
1893
|
}
|
|
1884
1894
|
|
|
1885
|
-
/** Returns true if `value` is NaN. */ function
|
|
1895
|
+
/** Returns true if `value` is NaN. */ function Bt(t) {
|
|
1886
1896
|
return !!t && "doubleValue" in t && isNaN(Number(t.doubleValue));
|
|
1887
1897
|
}
|
|
1888
1898
|
|
|
1889
|
-
/** Returns true if `value` is a MapValue. */ function
|
|
1899
|
+
/** Returns true if `value` is a MapValue. */ function zt(t) {
|
|
1890
1900
|
return !!t && "mapValue" in t;
|
|
1891
1901
|
}
|
|
1892
1902
|
|
|
1893
|
-
/** Creates a deep copy of `source`. */ function
|
|
1903
|
+
/** Creates a deep copy of `source`. */ function Gt(t) {
|
|
1894
1904
|
if (t.geoPointValue) return {
|
|
1895
1905
|
geoPointValue: Object.assign({}, t.geoPointValue)
|
|
1896
1906
|
};
|
|
@@ -1903,7 +1913,7 @@ function kt(t, e) {
|
|
|
1903
1913
|
fields: {}
|
|
1904
1914
|
}
|
|
1905
1915
|
};
|
|
1906
|
-
return Tt(t.mapValue.fields, ((t, n) => e.mapValue.fields[t] =
|
|
1916
|
+
return Tt(t.mapValue.fields, ((t, n) => e.mapValue.fields[t] = Gt(n))), e;
|
|
1907
1917
|
}
|
|
1908
1918
|
if (t.arrayValue) {
|
|
1909
1919
|
const e = {
|
|
@@ -1911,18 +1921,18 @@ function kt(t, e) {
|
|
|
1911
1921
|
values: []
|
|
1912
1922
|
}
|
|
1913
1923
|
};
|
|
1914
|
-
for (let n = 0; n < (t.arrayValue.values || []).length; ++n) e.arrayValue.values[n] =
|
|
1924
|
+
for (let n = 0; n < (t.arrayValue.values || []).length; ++n) e.arrayValue.values[n] = Gt(t.arrayValue.values[n]);
|
|
1915
1925
|
return e;
|
|
1916
1926
|
}
|
|
1917
1927
|
return Object.assign({}, t);
|
|
1918
1928
|
}
|
|
1919
1929
|
|
|
1920
|
-
class
|
|
1930
|
+
class Qt {
|
|
1921
1931
|
constructor(t) {
|
|
1922
1932
|
this.value = t;
|
|
1923
1933
|
}
|
|
1924
1934
|
static empty() {
|
|
1925
|
-
return new
|
|
1935
|
+
return new Qt({
|
|
1926
1936
|
mapValue: {}
|
|
1927
1937
|
});
|
|
1928
1938
|
}
|
|
@@ -1936,7 +1946,7 @@ class Gt {
|
|
|
1936
1946
|
{
|
|
1937
1947
|
let e = this.value;
|
|
1938
1948
|
for (let n = 0; n < t.length - 1; ++n) if (e = (e.mapValue.fields || {})[t.get(n)],
|
|
1939
|
-
!
|
|
1949
|
+
!zt(e)) return null;
|
|
1940
1950
|
return e = (e.mapValue.fields || {})[t.lastSegment()], e || null;
|
|
1941
1951
|
}
|
|
1942
1952
|
}
|
|
@@ -1946,7 +1956,7 @@ class Gt {
|
|
|
1946
1956
|
* @param path - The field path to set.
|
|
1947
1957
|
* @param value - The value to set.
|
|
1948
1958
|
*/ set(t, e) {
|
|
1949
|
-
this.getFieldsMap(t.popLast())[t.lastSegment()] =
|
|
1959
|
+
this.getFieldsMap(t.popLast())[t.lastSegment()] = Gt(e);
|
|
1950
1960
|
}
|
|
1951
1961
|
/**
|
|
1952
1962
|
* Sets the provided fields to the provided values.
|
|
@@ -1960,7 +1970,7 @@ class Gt {
|
|
|
1960
1970
|
const t = this.getFieldsMap(e);
|
|
1961
1971
|
this.applyChanges(t, n, r), n = {}, r = [], e = s.popLast();
|
|
1962
1972
|
}
|
|
1963
|
-
t ? n[s.lastSegment()] =
|
|
1973
|
+
t ? n[s.lastSegment()] = Gt(t) : r.push(s.lastSegment());
|
|
1964
1974
|
}));
|
|
1965
1975
|
const s = this.getFieldsMap(e);
|
|
1966
1976
|
this.applyChanges(s, n, r);
|
|
@@ -1972,10 +1982,10 @@ class Gt {
|
|
|
1972
1982
|
* @param path - The field path to remove.
|
|
1973
1983
|
*/ delete(t) {
|
|
1974
1984
|
const e = this.field(t.popLast());
|
|
1975
|
-
|
|
1985
|
+
zt(e) && e.mapValue.fields && delete e.mapValue.fields[t.lastSegment()];
|
|
1976
1986
|
}
|
|
1977
1987
|
isEqual(t) {
|
|
1978
|
-
return
|
|
1988
|
+
return Ot(this.value, t.value);
|
|
1979
1989
|
}
|
|
1980
1990
|
/**
|
|
1981
1991
|
* Returns the map that contains the leaf element of `path`. If the parent
|
|
@@ -1987,7 +1997,7 @@ class Gt {
|
|
|
1987
1997
|
});
|
|
1988
1998
|
for (let n = 0; n < t.length; ++n) {
|
|
1989
1999
|
let r = e.mapValue.fields[t.get(n)];
|
|
1990
|
-
|
|
2000
|
+
zt(r) && r.mapValue.fields || (r = {
|
|
1991
2001
|
mapValue: {
|
|
1992
2002
|
fields: {}
|
|
1993
2003
|
}
|
|
@@ -2003,7 +2013,7 @@ class Gt {
|
|
|
2003
2013
|
for (const e of n) delete t[e];
|
|
2004
2014
|
}
|
|
2005
2015
|
clone() {
|
|
2006
|
-
return new Gt(
|
|
2016
|
+
return new Qt(Gt(this.value));
|
|
2007
2017
|
}
|
|
2008
2018
|
}
|
|
2009
2019
|
|
|
@@ -2032,7 +2042,7 @@ class Gt {
|
|
|
2032
2042
|
* not transition to one of these states even after all mutations have been
|
|
2033
2043
|
* applied, `isValidDocument()` returns false and the document should be removed
|
|
2034
2044
|
* from all views.
|
|
2035
|
-
*/ class
|
|
2045
|
+
*/ class Wt {
|
|
2036
2046
|
constructor(t, e, n, r, s, i) {
|
|
2037
2047
|
this.key = t, this.documentType = e, this.version = n, this.readTime = r, this.data = s,
|
|
2038
2048
|
this.documentState = i;
|
|
@@ -2041,23 +2051,23 @@ class Gt {
|
|
|
2041
2051
|
* Creates a document with no known version or data, but which can serve as
|
|
2042
2052
|
* base document for mutations.
|
|
2043
2053
|
*/ static newInvalidDocument(t) {
|
|
2044
|
-
return new
|
|
2054
|
+
return new Wt(t, 0 /* INVALID */ , bt.min(), bt.min(), Qt.empty(), 0 /* SYNCED */);
|
|
2045
2055
|
}
|
|
2046
2056
|
/**
|
|
2047
2057
|
* Creates a new document that is known to exist with the given data at the
|
|
2048
2058
|
* given version.
|
|
2049
2059
|
*/ static newFoundDocument(t, e, n) {
|
|
2050
|
-
return new
|
|
2060
|
+
return new Wt(t, 1 /* FOUND_DOCUMENT */ , e, bt.min(), n, 0 /* SYNCED */);
|
|
2051
2061
|
}
|
|
2052
2062
|
/** Creates a new document that is known to not exist at the given version. */ static newNoDocument(t, e) {
|
|
2053
|
-
return new
|
|
2063
|
+
return new Wt(t, 2 /* NO_DOCUMENT */ , e, bt.min(), Qt.empty(), 0 /* SYNCED */);
|
|
2054
2064
|
}
|
|
2055
2065
|
/**
|
|
2056
2066
|
* Creates a new document that is known to exist at the given version but
|
|
2057
2067
|
* whose data is not known (e.g. a document that was updated without a known
|
|
2058
2068
|
* base document).
|
|
2059
2069
|
*/ static newUnknownDocument(t, e) {
|
|
2060
|
-
return new
|
|
2070
|
+
return new Wt(t, 3 /* UNKNOWN_DOCUMENT */ , e, bt.min(), Qt.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
|
|
2061
2071
|
}
|
|
2062
2072
|
/**
|
|
2063
2073
|
* Changes the document type to indicate that it exists and that its version
|
|
@@ -2070,7 +2080,7 @@ class Gt {
|
|
|
2070
2080
|
* Changes the document type to indicate that it doesn't exist at the given
|
|
2071
2081
|
* version.
|
|
2072
2082
|
*/ convertToNoDocument(t) {
|
|
2073
|
-
return this.version = t, this.documentType = 2 /* NO_DOCUMENT */ , this.data =
|
|
2083
|
+
return this.version = t, this.documentType = 2 /* NO_DOCUMENT */ , this.data = Qt.empty(),
|
|
2074
2084
|
this.documentState = 0 /* SYNCED */ , this;
|
|
2075
2085
|
}
|
|
2076
2086
|
/**
|
|
@@ -2078,7 +2088,7 @@ class Gt {
|
|
|
2078
2088
|
* that its data is not known (e.g. a document that was updated without a known
|
|
2079
2089
|
* base document).
|
|
2080
2090
|
*/ convertToUnknownDocument(t) {
|
|
2081
|
-
return this.version = t, this.documentType = 3 /* UNKNOWN_DOCUMENT */ , this.data =
|
|
2091
|
+
return this.version = t, this.documentType = 3 /* UNKNOWN_DOCUMENT */ , this.data = Qt.empty(),
|
|
2082
2092
|
this.documentState = 2 /* HAS_COMMITTED_MUTATIONS */ , this;
|
|
2083
2093
|
}
|
|
2084
2094
|
setHasCommittedMutations() {
|
|
@@ -2112,10 +2122,10 @@ class Gt {
|
|
|
2112
2122
|
return 3 /* UNKNOWN_DOCUMENT */ === this.documentType;
|
|
2113
2123
|
}
|
|
2114
2124
|
isEqual(t) {
|
|
2115
|
-
return t instanceof
|
|
2125
|
+
return t instanceof Wt && this.key.isEqual(t.key) && this.version.isEqual(t.version) && this.documentType === t.documentType && this.documentState === t.documentState && this.data.isEqual(t.data);
|
|
2116
2126
|
}
|
|
2117
2127
|
mutableCopy() {
|
|
2118
|
-
return new
|
|
2128
|
+
return new Wt(this.key, this.documentType, this.version, this.readTime, this.data.clone(), this.documentState);
|
|
2119
2129
|
}
|
|
2120
2130
|
toString() {
|
|
2121
2131
|
return `Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`;
|
|
@@ -2139,7 +2149,7 @@ class Gt {
|
|
|
2139
2149
|
* limitations under the License.
|
|
2140
2150
|
*/
|
|
2141
2151
|
// Visible for testing
|
|
2142
|
-
class
|
|
2152
|
+
class Yt {
|
|
2143
2153
|
constructor(t, e = null, n = [], r = [], s = null, i = null, o = null) {
|
|
2144
2154
|
this.path = t, this.collectionGroup = e, this.orderBy = n, this.filters = r, this.limit = s,
|
|
2145
2155
|
this.startAt = i, this.endAt = o, this.P = null;
|
|
@@ -2153,26 +2163,26 @@ class Wt {
|
|
|
2153
2163
|
* NOTE: you should always construct `Target` from `Query.toTarget` instead of
|
|
2154
2164
|
* using this factory method, because `Query` provides an implicit `orderBy`
|
|
2155
2165
|
* property.
|
|
2156
|
-
*/ function
|
|
2157
|
-
return new
|
|
2166
|
+
*/ function Ht(t, e = null, n = [], r = [], s = null, i = null, o = null) {
|
|
2167
|
+
return new Yt(t, e, n, r, s, i, o);
|
|
2158
2168
|
}
|
|
2159
2169
|
|
|
2160
|
-
class
|
|
2170
|
+
class Kt extends class {} {
|
|
2161
2171
|
constructor(t, e, n) {
|
|
2162
2172
|
super(), this.field = t, this.op = e, this.value = n;
|
|
2163
2173
|
}
|
|
2164
2174
|
/**
|
|
2165
2175
|
* Creates a filter based on the provided arguments.
|
|
2166
2176
|
*/ static create(t, e, n) {
|
|
2167
|
-
return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.V(t, e, n) : new
|
|
2177
|
+
return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.V(t, e, n) : new Jt(t, e, n) : "array-contains" /* ARRAY_CONTAINS */ === e ? new ee(t, n) : "in" /* IN */ === e ? new ne(t, n) : "not-in" /* NOT_IN */ === e ? new re(t, n) : "array-contains-any" /* ARRAY_CONTAINS_ANY */ === e ? new se(t, n) : new Kt(t, e, n);
|
|
2168
2178
|
}
|
|
2169
2179
|
static V(t, e, n) {
|
|
2170
|
-
return "in" /* IN */ === e ? new
|
|
2180
|
+
return "in" /* IN */ === e ? new Xt(t, n) : new Zt(t, n);
|
|
2171
2181
|
}
|
|
2172
2182
|
matches(t) {
|
|
2173
2183
|
const e = t.data.field(this.field);
|
|
2174
2184
|
// Types do not have to match in NOT_EQUAL filters.
|
|
2175
|
-
return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.N(
|
|
2185
|
+
return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.N(Lt(e, this.value)) : null !== e && qt(this.value) === qt(e) && this.N(Lt(e, this.value));
|
|
2176
2186
|
// Only compare types with matching backend order (such as double and int).
|
|
2177
2187
|
}
|
|
2178
2188
|
N(t) {
|
|
@@ -2205,7 +2215,7 @@ class Ht extends class {} {
|
|
|
2205
2215
|
}
|
|
2206
2216
|
|
|
2207
2217
|
/** Filter that matches on key fields (i.e. '__name__'). */
|
|
2208
|
-
class
|
|
2218
|
+
class Jt extends Kt {
|
|
2209
2219
|
constructor(t, e, n) {
|
|
2210
2220
|
super(t, e, n), this.key = nt.fromName(n.referenceValue);
|
|
2211
2221
|
}
|
|
@@ -2215,69 +2225,69 @@ class Kt extends Ht {
|
|
|
2215
2225
|
}
|
|
2216
2226
|
}
|
|
2217
2227
|
|
|
2218
|
-
/** Filter that matches on key fields within an array. */ class
|
|
2228
|
+
/** Filter that matches on key fields within an array. */ class Xt extends Kt {
|
|
2219
2229
|
constructor(t, e) {
|
|
2220
|
-
super(t, "in" /* IN */ , e), this.keys =
|
|
2230
|
+
super(t, "in" /* IN */ , e), this.keys = te("in" /* IN */ , e);
|
|
2221
2231
|
}
|
|
2222
2232
|
matches(t) {
|
|
2223
2233
|
return this.keys.some((e => e.isEqual(t.key)));
|
|
2224
2234
|
}
|
|
2225
2235
|
}
|
|
2226
2236
|
|
|
2227
|
-
/** Filter that matches on key fields not present within an array. */ class
|
|
2237
|
+
/** Filter that matches on key fields not present within an array. */ class Zt extends Kt {
|
|
2228
2238
|
constructor(t, e) {
|
|
2229
|
-
super(t, "not-in" /* NOT_IN */ , e), this.keys =
|
|
2239
|
+
super(t, "not-in" /* NOT_IN */ , e), this.keys = te("not-in" /* NOT_IN */ , e);
|
|
2230
2240
|
}
|
|
2231
2241
|
matches(t) {
|
|
2232
2242
|
return !this.keys.some((e => e.isEqual(t.key)));
|
|
2233
2243
|
}
|
|
2234
2244
|
}
|
|
2235
2245
|
|
|
2236
|
-
function
|
|
2246
|
+
function te(t, e) {
|
|
2237
2247
|
var n;
|
|
2238
2248
|
return ((null === (n = e.arrayValue) || void 0 === n ? void 0 : n.values) || []).map((t => nt.fromName(t.referenceValue)));
|
|
2239
2249
|
}
|
|
2240
2250
|
|
|
2241
|
-
/** A Filter that implements the array-contains operator. */ class
|
|
2251
|
+
/** A Filter that implements the array-contains operator. */ class ee extends Kt {
|
|
2242
2252
|
constructor(t, e) {
|
|
2243
2253
|
super(t, "array-contains" /* ARRAY_CONTAINS */ , e);
|
|
2244
2254
|
}
|
|
2245
2255
|
matches(t) {
|
|
2246
2256
|
const e = t.data.field(this.field);
|
|
2247
|
-
return
|
|
2257
|
+
return jt(e) && Ct(e.arrayValue, this.value);
|
|
2248
2258
|
}
|
|
2249
2259
|
}
|
|
2250
2260
|
|
|
2251
|
-
/** A Filter that implements the IN operator. */ class
|
|
2261
|
+
/** A Filter that implements the IN operator. */ class ne extends Kt {
|
|
2252
2262
|
constructor(t, e) {
|
|
2253
2263
|
super(t, "in" /* IN */ , e);
|
|
2254
2264
|
}
|
|
2255
2265
|
matches(t) {
|
|
2256
2266
|
const e = t.data.field(this.field);
|
|
2257
|
-
return null !== e &&
|
|
2267
|
+
return null !== e && Ct(this.value.arrayValue, e);
|
|
2258
2268
|
}
|
|
2259
2269
|
}
|
|
2260
2270
|
|
|
2261
|
-
/** A Filter that implements the not-in operator. */ class
|
|
2271
|
+
/** A Filter that implements the not-in operator. */ class re extends Kt {
|
|
2262
2272
|
constructor(t, e) {
|
|
2263
2273
|
super(t, "not-in" /* NOT_IN */ , e);
|
|
2264
2274
|
}
|
|
2265
2275
|
matches(t) {
|
|
2266
|
-
if (
|
|
2276
|
+
if (Ct(this.value.arrayValue, {
|
|
2267
2277
|
nullValue: "NULL_VALUE"
|
|
2268
2278
|
})) return !1;
|
|
2269
2279
|
const e = t.data.field(this.field);
|
|
2270
|
-
return null !== e && !
|
|
2280
|
+
return null !== e && !Ct(this.value.arrayValue, e);
|
|
2271
2281
|
}
|
|
2272
2282
|
}
|
|
2273
2283
|
|
|
2274
|
-
/** A Filter that implements the array-contains-any operator. */ class
|
|
2284
|
+
/** A Filter that implements the array-contains-any operator. */ class se extends Kt {
|
|
2275
2285
|
constructor(t, e) {
|
|
2276
2286
|
super(t, "array-contains-any" /* ARRAY_CONTAINS_ANY */ , e);
|
|
2277
2287
|
}
|
|
2278
2288
|
matches(t) {
|
|
2279
2289
|
const e = t.data.field(this.field);
|
|
2280
|
-
return !(!
|
|
2290
|
+
return !(!jt(e) || !e.arrayValue.values) && e.arrayValue.values.some((t => Ct(this.value.arrayValue, t)));
|
|
2281
2291
|
}
|
|
2282
2292
|
}
|
|
2283
2293
|
|
|
@@ -2294,7 +2304,7 @@ function Zt(t, e) {
|
|
|
2294
2304
|
* Bound provides a function to determine whether a document comes before or
|
|
2295
2305
|
* after a bound. This is influenced by whether the position is just before or
|
|
2296
2306
|
* just after the provided values.
|
|
2297
|
-
*/ class
|
|
2307
|
+
*/ class ie {
|
|
2298
2308
|
constructor(t, e) {
|
|
2299
2309
|
this.position = t, this.inclusive = e;
|
|
2300
2310
|
}
|
|
@@ -2302,22 +2312,22 @@ function Zt(t, e) {
|
|
|
2302
2312
|
|
|
2303
2313
|
/**
|
|
2304
2314
|
* An ordering on a field, in some Direction. Direction defaults to ASCENDING.
|
|
2305
|
-
*/ class
|
|
2315
|
+
*/ class oe {
|
|
2306
2316
|
constructor(t, e = "asc" /* ASCENDING */) {
|
|
2307
2317
|
this.field = t, this.dir = e;
|
|
2308
2318
|
}
|
|
2309
2319
|
}
|
|
2310
2320
|
|
|
2311
|
-
function
|
|
2321
|
+
function ue(t, e) {
|
|
2312
2322
|
return t.dir === e.dir && t.field.isEqual(e.field);
|
|
2313
2323
|
}
|
|
2314
2324
|
|
|
2315
|
-
function
|
|
2325
|
+
function ce(t, e) {
|
|
2316
2326
|
if (null === t) return null === e;
|
|
2317
2327
|
if (null === e) return !1;
|
|
2318
2328
|
if (t.inclusive !== e.inclusive || t.position.length !== e.position.length) return !1;
|
|
2319
2329
|
for (let n = 0; n < t.position.length; n++) {
|
|
2320
|
-
if (!
|
|
2330
|
+
if (!Ot(t.position[n], e.position[n])) return !1;
|
|
2321
2331
|
}
|
|
2322
2332
|
return !0;
|
|
2323
2333
|
}
|
|
@@ -2344,7 +2354,7 @@ function ue(t, e) {
|
|
|
2344
2354
|
* query the RemoteStore results.
|
|
2345
2355
|
*
|
|
2346
2356
|
* Visible for testing.
|
|
2347
|
-
*/ class
|
|
2357
|
+
*/ class ae {
|
|
2348
2358
|
/**
|
|
2349
2359
|
* Initializes a Query with a path and optional additional query constraints.
|
|
2350
2360
|
* Path must currently be empty if this is a collection group query.
|
|
@@ -2357,11 +2367,7 @@ function ue(t, e) {
|
|
|
2357
2367
|
}
|
|
2358
2368
|
}
|
|
2359
2369
|
|
|
2360
|
-
/** Creates a new Query for a query that matches all documents at `path` */ function
|
|
2361
|
-
return !at(t.limit) && "L" /* Last */ === t.limitType;
|
|
2362
|
-
}
|
|
2363
|
-
|
|
2364
|
-
function he(t) {
|
|
2370
|
+
/** Creates a new Query for a query that matches all documents at `path` */ function he(t) {
|
|
2365
2371
|
return t.explicitOrderBy.length > 0 ? t.explicitOrderBy[0].field : null;
|
|
2366
2372
|
}
|
|
2367
2373
|
|
|
@@ -2395,14 +2401,14 @@ function fe(t) {
|
|
|
2395
2401
|
// In order to implicitly add key ordering, we must also add the
|
|
2396
2402
|
// inequality filter field for it to be a valid query.
|
|
2397
2403
|
// Note that the default inequality field and key ordering is ascending.
|
|
2398
|
-
t.isKeyField() || e.$.push(new
|
|
2404
|
+
t.isKeyField() || e.$.push(new oe(t)), e.$.push(new oe(et.keyField(), "asc" /* ASCENDING */)); else {
|
|
2399
2405
|
let t = !1;
|
|
2400
2406
|
for (const n of e.explicitOrderBy) e.$.push(n), n.field.isKeyField() && (t = !0);
|
|
2401
2407
|
if (!t) {
|
|
2402
2408
|
// The order of the implicit key ordering always matches the last
|
|
2403
2409
|
// explicit order by
|
|
2404
2410
|
const t = e.explicitOrderBy.length > 0 ? e.explicitOrderBy[e.explicitOrderBy.length - 1].dir : "asc" /* ASCENDING */;
|
|
2405
|
-
e.$.push(new
|
|
2411
|
+
e.$.push(new oe(et.keyField(), t));
|
|
2406
2412
|
}
|
|
2407
2413
|
}
|
|
2408
2414
|
}
|
|
@@ -2413,17 +2419,17 @@ function fe(t) {
|
|
|
2413
2419
|
* Converts this `Query` instance to it's corresponding `Target` representation.
|
|
2414
2420
|
*/ function we(t) {
|
|
2415
2421
|
const e = E(t);
|
|
2416
|
-
if (!e.S) if ("F" /* First */ === e.limitType) e.S =
|
|
2422
|
+
if (!e.S) if ("F" /* First */ === e.limitType) e.S = Ht(e.path, e.collectionGroup, de(e), e.filters, e.limit, e.startAt, e.endAt); else {
|
|
2417
2423
|
// Flip the orderBy directions since we want the last results
|
|
2418
2424
|
const t = [];
|
|
2419
2425
|
for (const n of de(e)) {
|
|
2420
2426
|
const e = "desc" /* DESCENDING */ === n.dir ? "asc" /* ASCENDING */ : "desc" /* DESCENDING */;
|
|
2421
|
-
t.push(new
|
|
2427
|
+
t.push(new oe(n.field, e));
|
|
2422
2428
|
}
|
|
2423
2429
|
// We need to swap the cursors to match the now-flipped query ordering.
|
|
2424
|
-
const n = e.endAt ? new
|
|
2430
|
+
const n = e.endAt ? new ie(e.endAt.position, e.endAt.inclusive) : null, r = e.startAt ? new ie(e.startAt.position, e.startAt.inclusive) : null;
|
|
2425
2431
|
// Now return as a LimitType.First query.
|
|
2426
|
-
e.S =
|
|
2432
|
+
e.S = Ht(e.path, e.collectionGroup, t, e.filters, e.limit, n, r);
|
|
2427
2433
|
}
|
|
2428
2434
|
return e.S;
|
|
2429
2435
|
}
|
|
@@ -2432,12 +2438,12 @@ function me(t, e) {
|
|
|
2432
2438
|
return function(t, e) {
|
|
2433
2439
|
if (t.limit !== e.limit) return !1;
|
|
2434
2440
|
if (t.orderBy.length !== e.orderBy.length) return !1;
|
|
2435
|
-
for (let n = 0; n < t.orderBy.length; n++) if (!
|
|
2441
|
+
for (let n = 0; n < t.orderBy.length; n++) if (!ue(t.orderBy[n], e.orderBy[n])) return !1;
|
|
2436
2442
|
if (t.filters.length !== e.filters.length) return !1;
|
|
2437
2443
|
for (let s = 0; s < t.filters.length; s++) if (n = t.filters[s], r = e.filters[s],
|
|
2438
|
-
n.op !== r.op || !n.field.isEqual(r.field) || !
|
|
2444
|
+
n.op !== r.op || !n.field.isEqual(r.field) || !Ot(n.value, r.value)) return !1;
|
|
2439
2445
|
var n, r;
|
|
2440
|
-
return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!
|
|
2446
|
+
return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!ce(t.startAt, e.startAt) && ce(t.endAt, e.endAt);
|
|
2441
2447
|
}(we(t), we(e)) && t.limitType === e.limitType;
|
|
2442
2448
|
}
|
|
2443
2449
|
|
|
@@ -2820,16 +2826,16 @@ function je(t, e, n) {
|
|
|
2820
2826
|
function Me(t, e) {
|
|
2821
2827
|
return "found" in e ? function(t, e) {
|
|
2822
2828
|
b(!!e.found), e.found.name, e.found.updateTime;
|
|
2823
|
-
const n = Le(t, e.found.name), r = qe(e.found.updateTime), s = new
|
|
2829
|
+
const n = Le(t, e.found.name), r = qe(e.found.updateTime), s = new Qt({
|
|
2824
2830
|
mapValue: {
|
|
2825
2831
|
fields: e.found.fields
|
|
2826
2832
|
}
|
|
2827
2833
|
});
|
|
2828
|
-
return
|
|
2834
|
+
return Wt.newFoundDocument(n, r, s);
|
|
2829
2835
|
}(t, e) : "missing" in e ? function(t, e) {
|
|
2830
2836
|
b(!!e.missing), b(!!e.readTime);
|
|
2831
2837
|
const n = Le(t, e.missing), r = qe(e.readTime);
|
|
2832
|
-
return
|
|
2838
|
+
return Wt.newNoDocument(n, r);
|
|
2833
2839
|
}(t, e) : v();
|
|
2834
2840
|
}
|
|
2835
2841
|
|
|
@@ -2897,26 +2903,26 @@ function ze(t, e) {
|
|
|
2897
2903
|
// visible for testing
|
|
2898
2904
|
function(t) {
|
|
2899
2905
|
if ("==" /* EQUAL */ === t.op) {
|
|
2900
|
-
if (
|
|
2906
|
+
if (Bt(t.value)) return {
|
|
2901
2907
|
unaryFilter: {
|
|
2902
2908
|
field: We(t.field),
|
|
2903
2909
|
op: "IS_NAN"
|
|
2904
2910
|
}
|
|
2905
2911
|
};
|
|
2906
|
-
if (
|
|
2912
|
+
if (Mt(t.value)) return {
|
|
2907
2913
|
unaryFilter: {
|
|
2908
2914
|
field: We(t.field),
|
|
2909
2915
|
op: "IS_NULL"
|
|
2910
2916
|
}
|
|
2911
2917
|
};
|
|
2912
2918
|
} else if ("!=" /* NOT_EQUAL */ === t.op) {
|
|
2913
|
-
if (
|
|
2919
|
+
if (Bt(t.value)) return {
|
|
2914
2920
|
unaryFilter: {
|
|
2915
2921
|
field: We(t.field),
|
|
2916
2922
|
op: "IS_NOT_NAN"
|
|
2917
2923
|
}
|
|
2918
2924
|
};
|
|
2919
|
-
if (
|
|
2925
|
+
if (Mt(t.value)) return {
|
|
2920
2926
|
unaryFilter: {
|
|
2921
2927
|
field: We(t.field),
|
|
2922
2928
|
op: "IS_NOT_NULL"
|
|
@@ -3194,11 +3200,11 @@ async function en(t, e) {
|
|
|
3194
3200
|
return (await n.T("RunQuery", r.parent, {
|
|
3195
3201
|
structuredQuery: r.structuredQuery
|
|
3196
3202
|
})).filter((t => !!t.document)).map((t => function(t, e, n) {
|
|
3197
|
-
const r = Le(t, e.name), s = qe(e.updateTime), i = new
|
|
3203
|
+
const r = Le(t, e.name), s = qe(e.updateTime), i = new Qt({
|
|
3198
3204
|
mapValue: {
|
|
3199
3205
|
fields: e.fields
|
|
3200
3206
|
}
|
|
3201
|
-
}), o =
|
|
3207
|
+
}), o = Wt.newFoundDocument(r, s, i);
|
|
3202
3208
|
return n && o.setHasCommittedMutations(), n ? o.setHasCommittedMutations() : o;
|
|
3203
3209
|
}(n.q, t.document, void 0)));
|
|
3204
3210
|
}
|
|
@@ -3572,7 +3578,7 @@ class ln {
|
|
|
3572
3578
|
*/ class dn extends fn {
|
|
3573
3579
|
/** @hideconstructor */
|
|
3574
3580
|
constructor(t, e, n) {
|
|
3575
|
-
super(t, e, new
|
|
3581
|
+
super(t, e, new ae(n)), this._path = n,
|
|
3576
3582
|
/** The type of this Firestore reference. */
|
|
3577
3583
|
this.type = "collection";
|
|
3578
3584
|
}
|
|
@@ -3632,7 +3638,7 @@ function wn(t, e, ...n) {
|
|
|
3632
3638
|
* within the provided collection group.
|
|
3633
3639
|
*/
|
|
3634
3640
|
function(t) {
|
|
3635
|
-
return new
|
|
3641
|
+
return new ae(Z.emptyPath(), t);
|
|
3636
3642
|
}(e));
|
|
3637
3643
|
}
|
|
3638
3644
|
|
|
@@ -4062,7 +4068,7 @@ function Dn(t) {
|
|
|
4062
4068
|
}
|
|
4063
4069
|
c = new It(t), a = o.fieldTransforms.filter((t => c.covers(t.field)));
|
|
4064
4070
|
} else c = null, a = o.fieldTransforms;
|
|
4065
|
-
return new An(new
|
|
4071
|
+
return new An(new Qt(u), c, a);
|
|
4066
4072
|
}
|
|
4067
4073
|
|
|
4068
4074
|
class Sn extends En {
|
|
@@ -4157,7 +4163,7 @@ class Cn extends En {
|
|
|
4157
4163
|
/** Parse update data from an update() call. */ function Ln(t, e, n, r) {
|
|
4158
4164
|
const s = t.ht(1 /* Update */ , e, n);
|
|
4159
4165
|
zn("Data must be an object, but it was:", s, r);
|
|
4160
|
-
const i = [], o =
|
|
4166
|
+
const i = [], o = Qt.empty();
|
|
4161
4167
|
Tt(r, ((t, r) => {
|
|
4162
4168
|
const u = Wn(e, t, n);
|
|
4163
4169
|
// For Compat types, we have to "extract" the underlying types before
|
|
@@ -4179,7 +4185,7 @@ class Cn extends En {
|
|
|
4179
4185
|
const o = t.ht(1 /* Update */ , e, n), u = [ Gn(e, r, n) ], c = [ s ];
|
|
4180
4186
|
if (i.length % 2 != 0) throw new U(R, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);
|
|
4181
4187
|
for (let t = 0; t < i.length; t += 2) u.push(Gn(e, i[t])), c.push(i[t + 1]);
|
|
4182
|
-
const a = [], h =
|
|
4188
|
+
const a = [], h = Qt.empty();
|
|
4183
4189
|
// We iterate in reverse order to pick the last value for a field if the
|
|
4184
4190
|
// user specified the field multiple times.
|
|
4185
4191
|
for (let t = u.length - 1; t >= 0; --t) if (!Hn(a, u[t])) {
|
|
@@ -4631,7 +4637,7 @@ class rr extends er {
|
|
|
4631
4637
|
} else "in" /* IN */ !== i && "not-in" /* NOT_IN */ !== i && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== i || _r(o, i),
|
|
4632
4638
|
u = Un(n, e, o,
|
|
4633
4639
|
/* allowArrays= */ "in" /* IN */ === i || "not-in" /* NOT_IN */ === i);
|
|
4634
|
-
const c =
|
|
4640
|
+
const c = Kt.create(s, i, u);
|
|
4635
4641
|
return function(t, e) {
|
|
4636
4642
|
if (e.D()) {
|
|
4637
4643
|
const n = le(t);
|
|
@@ -4683,7 +4689,7 @@ class rr extends er {
|
|
|
4683
4689
|
}(t._query, "where", e, t.firestore._databaseId, this.dt, this.wt, this.yt);
|
|
4684
4690
|
return new fn(t.firestore, t.converter, function(t, e) {
|
|
4685
4691
|
const n = t.filters.concat([ e ]);
|
|
4686
|
-
return new
|
|
4692
|
+
return new ae(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
|
|
4687
4693
|
}(t._query, n));
|
|
4688
4694
|
}
|
|
4689
4695
|
}
|
|
@@ -4711,7 +4717,7 @@ class ir extends er {
|
|
|
4711
4717
|
const e = function(t, e, n) {
|
|
4712
4718
|
if (null !== t.startAt) throw new U(R, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
|
|
4713
4719
|
if (null !== t.endAt) throw new U(R, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
|
|
4714
|
-
const r = new
|
|
4720
|
+
const r = new oe(e, n);
|
|
4715
4721
|
return function(t, e) {
|
|
4716
4722
|
if (null === he(t)) {
|
|
4717
4723
|
// This is the first order by. It must match any inequality.
|
|
@@ -4734,7 +4740,7 @@ class ir extends er {
|
|
|
4734
4740
|
return new fn(t.firestore, t.converter, function(t, e) {
|
|
4735
4741
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
4736
4742
|
const n = t.explicitOrderBy.concat([ e ]);
|
|
4737
|
-
return new
|
|
4743
|
+
return new ae(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
|
|
4738
4744
|
}(t._query, e));
|
|
4739
4745
|
}
|
|
4740
4746
|
}
|
|
@@ -4758,7 +4764,7 @@ class ur extends er {
|
|
|
4758
4764
|
}
|
|
4759
4765
|
_apply(t) {
|
|
4760
4766
|
return new fn(t.firestore, t.converter, function(t, e, n) {
|
|
4761
|
-
return new
|
|
4767
|
+
return new ae(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
|
|
4762
4768
|
}(t._query, this.gt, this.vt));
|
|
4763
4769
|
}
|
|
4764
4770
|
}
|
|
@@ -4791,7 +4797,7 @@ class hr extends er {
|
|
|
4791
4797
|
_apply(t) {
|
|
4792
4798
|
const e = pr(t, this.type, this.bt, this.Et);
|
|
4793
4799
|
return new fn(t.firestore, t.converter, function(t, e) {
|
|
4794
|
-
return new
|
|
4800
|
+
return new ae(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
|
|
4795
4801
|
}(t._query, e));
|
|
4796
4802
|
}
|
|
4797
4803
|
}
|
|
@@ -4813,7 +4819,7 @@ class dr extends er {
|
|
|
4813
4819
|
_apply(t) {
|
|
4814
4820
|
const e = pr(t, this.type, this.bt, this.Et);
|
|
4815
4821
|
return new fn(t.firestore, t.converter, function(t, e) {
|
|
4816
|
-
return new
|
|
4822
|
+
return new ae(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
|
|
4817
4823
|
}(t._query, e));
|
|
4818
4824
|
}
|
|
4819
4825
|
}
|
|
@@ -4838,7 +4844,7 @@ function mr(...t) {
|
|
|
4838
4844
|
// the provided document. Without the key (by using the explicit sort
|
|
4839
4845
|
// orders), multiple documents could match the position, yielding duplicate
|
|
4840
4846
|
// results.
|
|
4841
|
-
for (const n of de(t)) if (n.field.isKeyField()) i.push(
|
|
4847
|
+
for (const n of de(t)) if (n.field.isKeyField()) i.push(Ut(e, r.key)); else {
|
|
4842
4848
|
const t = r.data.field(n.field);
|
|
4843
4849
|
if ($t(t)) throw new U(R, '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.)');
|
|
4844
4850
|
if (null === t) {
|
|
@@ -4847,7 +4853,7 @@ function mr(...t) {
|
|
|
4847
4853
|
}
|
|
4848
4854
|
i.push(t);
|
|
4849
4855
|
}
|
|
4850
|
-
return new
|
|
4856
|
+
return new ie(i, s);
|
|
4851
4857
|
}
|
|
4852
4858
|
/**
|
|
4853
4859
|
* Converts a list of field values to a `Bound` for the given query.
|
|
@@ -4867,13 +4873,13 @@ function mr(...t) {
|
|
|
4867
4873
|
const n = t.path.child(Z.fromString(c));
|
|
4868
4874
|
if (!nt.isDocumentKey(n)) throw new U(R, `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.`);
|
|
4869
4875
|
const s = new nt(n);
|
|
4870
|
-
u.push(
|
|
4876
|
+
u.push(Ut(e, s));
|
|
4871
4877
|
} else {
|
|
4872
4878
|
const t = Un(n, r, c);
|
|
4873
4879
|
u.push(t);
|
|
4874
4880
|
}
|
|
4875
4881
|
}
|
|
4876
|
-
return new
|
|
4882
|
+
return new ie(u, i);
|
|
4877
4883
|
}
|
|
4878
4884
|
/**
|
|
4879
4885
|
* Parses the given `documentIdValue` into a `ReferenceValue`, throwing
|
|
@@ -4889,9 +4895,9 @@ function yr(t, e, n) {
|
|
|
4889
4895
|
if (!fe(e) && -1 !== n.indexOf("/")) throw new U(R, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);
|
|
4890
4896
|
const r = e.path.child(Z.fromString(n));
|
|
4891
4897
|
if (!nt.isDocumentKey(r)) throw new U(R, `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}).`);
|
|
4892
|
-
return
|
|
4898
|
+
return Ut(t, new nt(r));
|
|
4893
4899
|
}
|
|
4894
|
-
if (n instanceof ln) return
|
|
4900
|
+
if (n instanceof ln) return Ut(t, n._key);
|
|
4895
4901
|
throw new U(R, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${ot(n)}.`);
|
|
4896
4902
|
}
|
|
4897
4903
|
|
|
@@ -4965,7 +4971,7 @@ function vr(t, e, n) {
|
|
|
4965
4971
|
|
|
4966
4972
|
class br extends class {
|
|
4967
4973
|
convertValue(t, e = "none") {
|
|
4968
|
-
switch (
|
|
4974
|
+
switch (qt(t)) {
|
|
4969
4975
|
case 0 /* NullValue */ :
|
|
4970
4976
|
return null;
|
|
4971
4977
|
|
|
@@ -5088,12 +5094,12 @@ class br extends class {
|
|
|
5088
5094
|
* @returns A Promise that will be resolved with the results of the query.
|
|
5089
5095
|
*/ function Tr(t) {
|
|
5090
5096
|
!function(t) {
|
|
5091
|
-
if (
|
|
5097
|
+
if ("L" /* Last */ === t.limitType && 0 === t.explicitOrderBy.length) throw new U(O, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
5092
5098
|
}((t = ut(t, fn))._query);
|
|
5093
5099
|
const e = rn(t.firestore), n = new br(t.firestore);
|
|
5094
5100
|
return en(e, t._query).then((e => {
|
|
5095
5101
|
const r = e.map((e => new Jn(t.firestore, n, e.key, e, t.converter)));
|
|
5096
|
-
return
|
|
5102
|
+
return "L" /* Last */ === t._query.limitType &&
|
|
5097
5103
|
// Limit to last queries reverse the orderBy constraint that was
|
|
5098
5104
|
// specified by the user. As such, we need to reverse the order of the
|
|
5099
5105
|
// results to return the documents in the expected order.
|
|
@@ -5990,7 +5996,7 @@ class jr {
|
|
|
5990
5996
|
return e && r._setSettings(e), r;
|
|
5991
5997
|
}), "PUBLIC")),
|
|
5992
5998
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
5993
|
-
r("firestore-lite", "3.4.
|
|
5999
|
+
r("firestore-lite", "3.4.8-canary.215e657ea", "rn"), r("firestore-lite", "3.4.8-canary.215e657ea", "esm2017");
|
|
5994
6000
|
|
|
5995
6001
|
export { bn as Bytes, dn as CollectionReference, ln as DocumentReference, Kn as DocumentSnapshot, gn as FieldPath, En as FieldValue, on as Firestore, U as FirestoreError, Tn as GeoPoint, fn as Query, er as QueryConstraint, Jn as QueryDocumentSnapshot, Xn as QuerySnapshot, vt as Timestamp, jr as Transaction, Fr as WriteBatch, Pr as addDoc, $r as arrayRemove, Dr as arrayUnion, wn as collection, mn as collectionGroup, an as connectFirestoreEmulator, Rr as deleteDoc, Vr as deleteField, pn as doc, vn as documentId, mr as endAt, wr as endBefore, Er as getDoc, Tr as getDocs, cn as getFirestore, Sr as increment, un as initializeFirestore, cr as limit, ar as limitToLast, or as orderBy, nr as query, _n as queryEqual, yn as refEqual, Mr as runTransaction, Nr as serverTimestamp, Ir as setDoc, m as setLogLevel, Zn as snapshotEqual, fr as startAfter, lr as startAt, hn as terminate, Ar as updateDoc, sr as where, qr as writeBatch };
|
|
5996
6002
|
//# sourceMappingURL=index.rn.esm2017.js.map
|