@firebase/firestore 3.4.7 → 3.4.8-canary.19e31a231
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 +27 -5
- package/dist/firestore/src/local/indexeddb_index_manager.d.ts +15 -10
- package/dist/firestore/src/local/indexeddb_remote_document_cache.d.ts +9 -0
- package/dist/firestore/src/local/indexeddb_schema.d.ts +8 -2
- package/dist/firestore/src/local/indexeddb_sentinels.d.ts +9 -2
- package/dist/firestore/src/local/local_documents_view.d.ts +1 -1
- package/dist/firestore/src/local/memory_index_manager.d.ts +6 -4
- 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/field_index.d.ts +6 -0
- 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 +5 -4
- package/dist/firestore/test/unit/local/test_remote_document_cache.d.ts +0 -4
- package/dist/index.esm2017.js +4649 -4498
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +4941 -4800
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +1764 -1577
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +1764 -1577
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +4495 -4344
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +26 -4
- 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 +27 -5
- package/dist/lite/firestore/src/local/indexeddb_index_manager.d.ts +15 -10
- package/dist/lite/firestore/src/local/indexeddb_remote_document_cache.d.ts +9 -0
- package/dist/lite/firestore/src/local/indexeddb_schema.d.ts +8 -2
- package/dist/lite/firestore/src/local/indexeddb_sentinels.d.ts +9 -2
- package/dist/lite/firestore/src/local/local_documents_view.d.ts +1 -1
- package/dist/lite/firestore/src/local/memory_index_manager.d.ts +6 -4
- 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/field_index.d.ts +6 -0
- 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 +5 -4
- package/dist/lite/firestore/test/unit/local/test_remote_document_cache.d.ts +0 -4
- package/dist/lite/index.browser.esm2017.js +123 -117
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +203 -197
- 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 +1155 -1149
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- 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 +27 -5
- package/dist/lite/packages/firestore/src/local/indexeddb_index_manager.d.ts +15 -10
- 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 +8 -2
- package/dist/lite/packages/firestore/src/local/indexeddb_sentinels.d.ts +9 -2
- 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 +6 -4
- 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/field_index.d.ts +6 -0
- 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 +5 -4
- 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 +171 -171
- 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 +27 -5
- package/dist/packages/firestore/src/local/indexeddb_index_manager.d.ts +15 -10
- package/dist/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +9 -0
- package/dist/packages/firestore/src/local/indexeddb_schema.d.ts +8 -2
- package/dist/packages/firestore/src/local/indexeddb_sentinels.d.ts +9 -2
- package/dist/packages/firestore/src/local/local_documents_view.d.ts +1 -1
- package/dist/packages/firestore/src/local/memory_index_manager.d.ts +6 -4
- 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/field_index.d.ts +6 -0
- 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 +5 -4
- package/dist/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +0 -4
- package/dist/private.d.ts +26 -4
- 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.
|
|
66
|
+
let f = "9.6.11-canary.19e31a231";
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* @license
|
|
@@ -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
1756
|
if (bt(n) !== bt(r)) return !1;
|
|
1750
|
-
for (const t in n) if (n.hasOwnProperty(t) && (void 0 === r[t] || !
|
|
1757
|
+
for (const t in n) if (n.hasOwnProperty(t) && (void 0 === r[t] || !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 */ , vt.min(), vt.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, vt.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, vt.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, vt.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,7 @@ 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
|
|
2345
|
-
return !ct(t.limit) && "L" /* Last */ === t.limitType;
|
|
2346
|
-
}
|
|
2347
|
-
|
|
2348
|
-
function ce(t) {
|
|
2354
|
+
/** Creates a new Query for a query that matches all documents at `path` */ function ce(t) {
|
|
2349
2355
|
return t.explicitOrderBy.length > 0 ? t.explicitOrderBy[0].field : null;
|
|
2350
2356
|
}
|
|
2351
2357
|
|
|
@@ -2379,14 +2385,14 @@ function he(t) {
|
|
|
2379
2385
|
// In order to implicitly add key ordering, we must also add the
|
|
2380
2386
|
// inequality filter field for it to be a valid query.
|
|
2381
2387
|
// Note that the default inequality field and key ordering is ascending.
|
|
2382
|
-
t.isKeyField() || e.$.push(new
|
|
2388
|
+
t.isKeyField() || e.$.push(new se(t)), e.$.push(new se(tt.keyField(), "asc" /* ASCENDING */)); else {
|
|
2383
2389
|
let t = !1;
|
|
2384
2390
|
for (const n of e.explicitOrderBy) e.$.push(n), n.field.isKeyField() && (t = !0);
|
|
2385
2391
|
if (!t) {
|
|
2386
2392
|
// The order of the implicit key ordering always matches the last
|
|
2387
2393
|
// explicit order by
|
|
2388
2394
|
const t = e.explicitOrderBy.length > 0 ? e.explicitOrderBy[e.explicitOrderBy.length - 1].dir : "asc" /* ASCENDING */;
|
|
2389
|
-
e.$.push(new
|
|
2395
|
+
e.$.push(new se(tt.keyField(), t));
|
|
2390
2396
|
}
|
|
2391
2397
|
}
|
|
2392
2398
|
}
|
|
@@ -2397,17 +2403,17 @@ function he(t) {
|
|
|
2397
2403
|
* Converts this `Query` instance to it's corresponding `Target` representation.
|
|
2398
2404
|
*/ function fe(t) {
|
|
2399
2405
|
const e = b(t);
|
|
2400
|
-
if (!e.S) if ("F" /* First */ === e.limitType) e.S =
|
|
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 {
|
|
2401
2407
|
// Flip the orderBy directions since we want the last results
|
|
2402
2408
|
const t = [];
|
|
2403
2409
|
for (const n of le(e)) {
|
|
2404
2410
|
const e = "desc" /* DESCENDING */ === n.dir ? "asc" /* ASCENDING */ : "desc" /* DESCENDING */;
|
|
2405
|
-
t.push(new
|
|
2411
|
+
t.push(new se(n.field, e));
|
|
2406
2412
|
}
|
|
2407
2413
|
// We need to swap the cursors to match the now-flipped query ordering.
|
|
2408
|
-
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;
|
|
2409
2415
|
// Now return as a LimitType.First query.
|
|
2410
|
-
e.S =
|
|
2416
|
+
e.S = Wt(e.path, e.collectionGroup, t, e.filters, e.limit, n, r);
|
|
2411
2417
|
}
|
|
2412
2418
|
return e.S;
|
|
2413
2419
|
}
|
|
@@ -2416,12 +2422,12 @@ function de(t, e) {
|
|
|
2416
2422
|
return function(t, e) {
|
|
2417
2423
|
if (t.limit !== e.limit) return !1;
|
|
2418
2424
|
if (t.orderBy.length !== e.orderBy.length) return !1;
|
|
2419
|
-
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;
|
|
2420
2426
|
if (t.filters.length !== e.filters.length) return !1;
|
|
2421
2427
|
for (let s = 0; s < t.filters.length; s++) if (n = t.filters[s], r = e.filters[s],
|
|
2422
|
-
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;
|
|
2423
2429
|
var n, r;
|
|
2424
|
-
return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!
|
|
2430
|
+
return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!oe(t.startAt, e.startAt) && oe(t.endAt, e.endAt);
|
|
2425
2431
|
}(fe(t), fe(e)) && t.limitType === e.limitType;
|
|
2426
2432
|
}
|
|
2427
2433
|
|
|
@@ -2804,16 +2810,16 @@ function Ue(t, e, n) {
|
|
|
2804
2810
|
function ke(t, e) {
|
|
2805
2811
|
return "found" in e ? function(t, e) {
|
|
2806
2812
|
v(!!e.found), e.found.name, e.found.updateTime;
|
|
2807
|
-
const n = Oe(t, e.found.name), r = Fe(e.found.updateTime), s = new
|
|
2813
|
+
const n = Oe(t, e.found.name), r = Fe(e.found.updateTime), s = new zt({
|
|
2808
2814
|
mapValue: {
|
|
2809
2815
|
fields: e.found.fields
|
|
2810
2816
|
}
|
|
2811
2817
|
});
|
|
2812
|
-
return
|
|
2818
|
+
return Gt.newFoundDocument(n, r, s);
|
|
2813
2819
|
}(t, e) : "missing" in e ? function(t, e) {
|
|
2814
2820
|
v(!!e.missing), v(!!e.readTime);
|
|
2815
2821
|
const n = Oe(t, e.missing), r = Fe(e.readTime);
|
|
2816
|
-
return
|
|
2822
|
+
return Gt.newNoDocument(n, r);
|
|
2817
2823
|
}(t, e) : g();
|
|
2818
2824
|
}
|
|
2819
2825
|
|
|
@@ -2881,26 +2887,26 @@ function Me(t, e) {
|
|
|
2881
2887
|
// visible for testing
|
|
2882
2888
|
function(t) {
|
|
2883
2889
|
if ("==" /* EQUAL */ === t.op) {
|
|
2884
|
-
if (
|
|
2890
|
+
if (jt(t.value)) return {
|
|
2885
2891
|
unaryFilter: {
|
|
2886
2892
|
field: Ge(t.field),
|
|
2887
2893
|
op: "IS_NAN"
|
|
2888
2894
|
}
|
|
2889
2895
|
};
|
|
2890
|
-
if (
|
|
2896
|
+
if (kt(t.value)) return {
|
|
2891
2897
|
unaryFilter: {
|
|
2892
2898
|
field: Ge(t.field),
|
|
2893
2899
|
op: "IS_NULL"
|
|
2894
2900
|
}
|
|
2895
2901
|
};
|
|
2896
2902
|
} else if ("!=" /* NOT_EQUAL */ === t.op) {
|
|
2897
|
-
if (
|
|
2903
|
+
if (jt(t.value)) return {
|
|
2898
2904
|
unaryFilter: {
|
|
2899
2905
|
field: Ge(t.field),
|
|
2900
2906
|
op: "IS_NOT_NAN"
|
|
2901
2907
|
}
|
|
2902
2908
|
};
|
|
2903
|
-
if (
|
|
2909
|
+
if (kt(t.value)) return {
|
|
2904
2910
|
unaryFilter: {
|
|
2905
2911
|
field: Ge(t.field),
|
|
2906
2912
|
op: "IS_NOT_NULL"
|
|
@@ -3178,11 +3184,11 @@ async function Ze(t, e) {
|
|
|
3178
3184
|
return (await n.T("RunQuery", r.parent, {
|
|
3179
3185
|
structuredQuery: r.structuredQuery
|
|
3180
3186
|
})).filter((t => !!t.document)).map((t => function(t, e, n) {
|
|
3181
|
-
const r = Oe(t, e.name), s = Fe(e.updateTime), i = new
|
|
3187
|
+
const r = Oe(t, e.name), s = Fe(e.updateTime), i = new zt({
|
|
3182
3188
|
mapValue: {
|
|
3183
3189
|
fields: e.fields
|
|
3184
3190
|
}
|
|
3185
|
-
}), o =
|
|
3191
|
+
}), o = Gt.newFoundDocument(r, s, i);
|
|
3186
3192
|
return n && o.setHasCommittedMutations(), n ? o.setHasCommittedMutations() : o;
|
|
3187
3193
|
}(n.q, t.document, void 0)));
|
|
3188
3194
|
}
|
|
@@ -3556,7 +3562,7 @@ class an {
|
|
|
3556
3562
|
*/ class ln extends hn {
|
|
3557
3563
|
/** @hideconstructor */
|
|
3558
3564
|
constructor(t, e, n) {
|
|
3559
|
-
super(t, e, new
|
|
3565
|
+
super(t, e, new ue(n)), this._path = n,
|
|
3560
3566
|
/** The type of this Firestore reference. */
|
|
3561
3567
|
this.type = "collection";
|
|
3562
3568
|
}
|
|
@@ -3616,7 +3622,7 @@ function fn(t, e, ...n) {
|
|
|
3616
3622
|
* within the provided collection group.
|
|
3617
3623
|
*/
|
|
3618
3624
|
function(t) {
|
|
3619
|
-
return new
|
|
3625
|
+
return new ue(X.emptyPath(), t);
|
|
3620
3626
|
}(e));
|
|
3621
3627
|
}
|
|
3622
3628
|
|
|
@@ -4046,7 +4052,7 @@ function Vn(t) {
|
|
|
4046
4052
|
}
|
|
4047
4053
|
c = new Tt(t), a = o.fieldTransforms.filter((t => c.covers(t.field)));
|
|
4048
4054
|
} else c = null, a = o.fieldTransforms;
|
|
4049
|
-
return new Tn(new
|
|
4055
|
+
return new Tn(new zt(u), c, a);
|
|
4050
4056
|
}
|
|
4051
4057
|
|
|
4052
4058
|
class Nn extends vn {
|
|
@@ -4141,7 +4147,7 @@ class qn extends vn {
|
|
|
4141
4147
|
/** Parse update data from an update() call. */ function On(t, e, n, r) {
|
|
4142
4148
|
const s = t.ht(1 /* Update */ , e, n);
|
|
4143
4149
|
Mn("Data must be an object, but it was:", s, r);
|
|
4144
|
-
const i = [], o =
|
|
4150
|
+
const i = [], o = zt.empty();
|
|
4145
4151
|
Et(r, ((t, r) => {
|
|
4146
4152
|
const u = Gn(e, t, n);
|
|
4147
4153
|
// For Compat types, we have to "extract" the underlying types before
|
|
@@ -4163,7 +4169,7 @@ class qn extends vn {
|
|
|
4163
4169
|
const o = t.ht(1 /* Update */ , e, n), u = [ Bn(e, r, n) ], c = [ s ];
|
|
4164
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.`);
|
|
4165
4171
|
for (let t = 0; t < i.length; t += 2) u.push(Bn(e, i[t])), c.push(i[t + 1]);
|
|
4166
|
-
const a = [], l =
|
|
4172
|
+
const a = [], l = zt.empty();
|
|
4167
4173
|
// We iterate in reverse order to pick the last value for a field if the
|
|
4168
4174
|
// user specified the field multiple times.
|
|
4169
4175
|
for (let t = u.length - 1; t >= 0; --t) if (!Wn(a, u[t])) {
|
|
@@ -4615,7 +4621,7 @@ class er extends Zn {
|
|
|
4615
4621
|
} else "in" /* IN */ !== i && "not-in" /* NOT_IN */ !== i && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== i || pr(o, i),
|
|
4616
4622
|
u = Ln(n, e, o,
|
|
4617
4623
|
/* allowArrays= */ "in" /* IN */ === i || "not-in" /* NOT_IN */ === i);
|
|
4618
|
-
const c =
|
|
4624
|
+
const c = Yt.create(s, i, u);
|
|
4619
4625
|
return function(t, e) {
|
|
4620
4626
|
if (e.N()) {
|
|
4621
4627
|
const n = ae(t);
|
|
@@ -4667,7 +4673,7 @@ class er extends Zn {
|
|
|
4667
4673
|
}(t._query, "where", e, t.firestore._databaseId, this.dt, this.wt, this.yt);
|
|
4668
4674
|
return new hn(t.firestore, t.converter, function(t, e) {
|
|
4669
4675
|
const n = t.filters.concat([ e ]);
|
|
4670
|
-
return new
|
|
4676
|
+
return new ue(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
|
|
4671
4677
|
}(t._query, n));
|
|
4672
4678
|
}
|
|
4673
4679
|
}
|
|
@@ -4695,7 +4701,7 @@ class rr extends Zn {
|
|
|
4695
4701
|
const e = function(t, e, n) {
|
|
4696
4702
|
if (null !== t.startAt) throw new U(A, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
|
|
4697
4703
|
if (null !== t.endAt) throw new U(A, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
|
|
4698
|
-
const r = new
|
|
4704
|
+
const r = new se(e, n);
|
|
4699
4705
|
return function(t, e) {
|
|
4700
4706
|
if (null === ce(t)) {
|
|
4701
4707
|
// This is the first order by. It must match any inequality.
|
|
@@ -4718,7 +4724,7 @@ class rr extends Zn {
|
|
|
4718
4724
|
return new hn(t.firestore, t.converter, function(t, e) {
|
|
4719
4725
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
4720
4726
|
const n = t.explicitOrderBy.concat([ e ]);
|
|
4721
|
-
return new
|
|
4727
|
+
return new ue(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
|
|
4722
4728
|
}(t._query, e));
|
|
4723
4729
|
}
|
|
4724
4730
|
}
|
|
@@ -4742,7 +4748,7 @@ class ir extends Zn {
|
|
|
4742
4748
|
}
|
|
4743
4749
|
_apply(t) {
|
|
4744
4750
|
return new hn(t.firestore, t.converter, function(t, e, n) {
|
|
4745
|
-
return new
|
|
4751
|
+
return new ue(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
|
|
4746
4752
|
}(t._query, this.gt, this.vt));
|
|
4747
4753
|
}
|
|
4748
4754
|
}
|
|
@@ -4775,7 +4781,7 @@ class cr extends Zn {
|
|
|
4775
4781
|
_apply(t) {
|
|
4776
4782
|
const e = wr(t, this.type, this.bt, this.Et);
|
|
4777
4783
|
return new hn(t.firestore, t.converter, function(t, e) {
|
|
4778
|
-
return new
|
|
4784
|
+
return new ue(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
|
|
4779
4785
|
}(t._query, e));
|
|
4780
4786
|
}
|
|
4781
4787
|
}
|
|
@@ -4797,7 +4803,7 @@ class lr extends Zn {
|
|
|
4797
4803
|
_apply(t) {
|
|
4798
4804
|
const e = wr(t, this.type, this.bt, this.Et);
|
|
4799
4805
|
return new hn(t.firestore, t.converter, function(t, e) {
|
|
4800
|
-
return new
|
|
4806
|
+
return new ue(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
|
|
4801
4807
|
}(t._query, e));
|
|
4802
4808
|
}
|
|
4803
4809
|
}
|
|
@@ -4822,7 +4828,7 @@ function dr(...t) {
|
|
|
4822
4828
|
// the provided document. Without the key (by using the explicit sort
|
|
4823
4829
|
// orders), multiple documents could match the position, yielding duplicate
|
|
4824
4830
|
// results.
|
|
4825
|
-
for (const n of le(t)) if (n.field.isKeyField()) i.push(
|
|
4831
|
+
for (const n of le(t)) if (n.field.isKeyField()) i.push(Lt(e, r.key)); else {
|
|
4826
4832
|
const t = r.data.field(n.field);
|
|
4827
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.)');
|
|
4828
4834
|
if (null === t) {
|
|
@@ -4831,7 +4837,7 @@ function dr(...t) {
|
|
|
4831
4837
|
}
|
|
4832
4838
|
i.push(t);
|
|
4833
4839
|
}
|
|
4834
|
-
return new
|
|
4840
|
+
return new re(i, s);
|
|
4835
4841
|
}
|
|
4836
4842
|
/**
|
|
4837
4843
|
* Converts a list of field values to a `Bound` for the given query.
|
|
@@ -4851,13 +4857,13 @@ function dr(...t) {
|
|
|
4851
4857
|
const n = t.path.child(X.fromString(c));
|
|
4852
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.`);
|
|
4853
4859
|
const s = new et(n);
|
|
4854
|
-
u.push(
|
|
4860
|
+
u.push(Lt(e, s));
|
|
4855
4861
|
} else {
|
|
4856
4862
|
const t = Ln(n, r, c);
|
|
4857
4863
|
u.push(t);
|
|
4858
4864
|
}
|
|
4859
4865
|
}
|
|
4860
|
-
return new
|
|
4866
|
+
return new re(u, i);
|
|
4861
4867
|
}
|
|
4862
4868
|
/**
|
|
4863
4869
|
* Parses the given `documentIdValue` into a `ReferenceValue`, throwing
|
|
@@ -4873,9 +4879,9 @@ function mr(t, e, n) {
|
|
|
4873
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.`);
|
|
4874
4880
|
const r = e.path.child(X.fromString(n));
|
|
4875
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}).`);
|
|
4876
|
-
return
|
|
4882
|
+
return Lt(t, new et(r));
|
|
4877
4883
|
}
|
|
4878
|
-
if (n instanceof an) return
|
|
4884
|
+
if (n instanceof an) return Lt(t, n._key);
|
|
4879
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)}.`);
|
|
4880
4886
|
}
|
|
4881
4887
|
|
|
@@ -4949,7 +4955,7 @@ function _r(t, e, n) {
|
|
|
4949
4955
|
|
|
4950
4956
|
class gr extends class {
|
|
4951
4957
|
convertValue(t, e = "none") {
|
|
4952
|
-
switch (
|
|
4958
|
+
switch (Ft(t)) {
|
|
4953
4959
|
case 0 /* NullValue */ :
|
|
4954
4960
|
return null;
|
|
4955
4961
|
|
|
@@ -5072,12 +5078,12 @@ class gr extends class {
|
|
|
5072
5078
|
* @returns A Promise that will be resolved with the results of the query.
|
|
5073
5079
|
*/ function br(t) {
|
|
5074
5080
|
!function(t) {
|
|
5075
|
-
if (
|
|
5081
|
+
if ("L" /* Last */ === t.limitType && 0 === t.explicitOrderBy.length) throw new U(q, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
5076
5082
|
}((t = ot(t, hn))._query);
|
|
5077
5083
|
const e = en(t.firestore), n = new gr(t.firestore);
|
|
5078
5084
|
return Ze(e, t._query).then((e => {
|
|
5079
5085
|
const r = e.map((e => new Hn(t.firestore, n, e.key, e, t.converter)));
|
|
5080
|
-
return
|
|
5086
|
+
return "L" /* Last */ === t._query.limitType &&
|
|
5081
5087
|
// Limit to last queries reverse the orderBy constraint that was
|
|
5082
5088
|
// specified by the user. As such, we need to reverse the order of the
|
|
5083
5089
|
// results to return the documents in the expected order.
|
|
@@ -5974,7 +5980,7 @@ class Ur {
|
|
|
5974
5980
|
return e && r._setSettings(e), r;
|
|
5975
5981
|
}), "PUBLIC")),
|
|
5976
5982
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
5977
|
-
registerVersion("firestore-lite", "3.4.
|
|
5983
|
+
registerVersion("firestore-lite", "3.4.8-canary.19e31a231", ""), registerVersion("firestore-lite", "3.4.8-canary.19e31a231", "esm2017");
|
|
5978
5984
|
|
|
5979
5985
|
export { gn as Bytes, ln as CollectionReference, an as DocumentReference, Yn as DocumentSnapshot, yn as FieldPath, vn as FieldValue, rn as Firestore, U as FirestoreError, bn 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, vr as getDoc, br 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 };
|
|
5980
5986
|
//# sourceMappingURL=index.browser.esm2017.js.map
|