@firebase/firestore 3.4.8-canary.7b58dabdf → 3.4.8-canary.93f3e841e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/firestore/src/core/query.d.ts +2 -4
- package/dist/firestore/src/core/target.d.ts +4 -4
- package/dist/firestore/src/local/index_manager.d.ts +5 -0
- package/dist/firestore/src/local/indexeddb_index_manager.d.ts +1 -5
- 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 +1 -0
- package/dist/firestore/src/local/query_engine.d.ts +44 -5
- 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/index.esm2017.js +2884 -2818
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +3071 -3010
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +176 -107
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +176 -107
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +2948 -2882
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +5 -0
- package/dist/lite/firestore/src/core/query.d.ts +2 -4
- package/dist/lite/firestore/src/core/target.d.ts +4 -4
- package/dist/lite/firestore/src/local/index_manager.d.ts +5 -0
- package/dist/lite/firestore/src/local/indexeddb_index_manager.d.ts +1 -5
- 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 +1 -0
- package/dist/lite/firestore/src/local/query_engine.d.ts +44 -5
- 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/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 +1184 -1178
- 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 +4 -4
- package/dist/lite/packages/firestore/src/local/index_manager.d.ts +5 -0
- package/dist/lite/packages/firestore/src/local/indexeddb_index_manager.d.ts +1 -5
- 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 +1 -0
- package/dist/lite/packages/firestore/src/local/query_engine.d.ts +44 -5
- 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/packages/firestore/dist/index.esm2017.d.ts +169 -169
- package/dist/packages/firestore/src/core/query.d.ts +2 -4
- package/dist/packages/firestore/src/core/target.d.ts +4 -4
- package/dist/packages/firestore/src/local/index_manager.d.ts +5 -0
- package/dist/packages/firestore/src/local/indexeddb_index_manager.d.ts +1 -5
- 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 +1 -0
- package/dist/packages/firestore/src/local/query_engine.d.ts +44 -5
- 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/private.d.ts +5 -0
- package/package.json +9 -9
|
@@ -63,7 +63,7 @@ l.MOCK_USER = new l("mock-user");
|
|
|
63
63
|
* See the License for the specific language governing permissions and
|
|
64
64
|
* limitations under the License.
|
|
65
65
|
*/
|
|
66
|
-
let f = "9.6.11-canary.
|
|
66
|
+
let f = "9.6.11-canary.93f3e841e";
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* @license
|
|
@@ -190,14 +190,14 @@ function p(t, ...e) {
|
|
|
190
190
|
* given message if it did.
|
|
191
191
|
*
|
|
192
192
|
* Messages are stripped in production builds.
|
|
193
|
-
*/ function
|
|
193
|
+
*/ function v(t, e) {
|
|
194
194
|
t || g();
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
/**
|
|
198
198
|
* Casts `obj` to `T`. In non-production builds, verifies that `obj` is an
|
|
199
199
|
* instance of `T` before casting.
|
|
200
|
-
*/ function
|
|
200
|
+
*/ function b(t,
|
|
201
201
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
202
202
|
e) {
|
|
203
203
|
return t;
|
|
@@ -332,7 +332,7 @@ e) {
|
|
|
332
332
|
}));
|
|
333
333
|
}
|
|
334
334
|
getToken() {
|
|
335
|
-
return this.auth ? this.auth.getToken().then((t => t ? (
|
|
335
|
+
return this.auth ? this.auth.getToken().then((t => t ? (v("string" == typeof t.accessToken),
|
|
336
336
|
new j(t.accessToken, new l(this.auth.getUid()))) : null)) : Promise.resolve(null);
|
|
337
337
|
}
|
|
338
338
|
invalidateToken() {}
|
|
@@ -386,7 +386,7 @@ class W {
|
|
|
386
386
|
}));
|
|
387
387
|
}
|
|
388
388
|
getToken() {
|
|
389
|
-
return this.appCheck ? this.appCheck.getToken().then((t => t ? (
|
|
389
|
+
return this.appCheck ? this.appCheck.getToken().then((t => t ? (v("string" == typeof t.token),
|
|
390
390
|
new W(t.token)) : null)) : Promise.resolve(null);
|
|
391
391
|
}
|
|
392
392
|
invalidateToken() {}
|
|
@@ -1320,18 +1320,18 @@ class gt {
|
|
|
1320
1320
|
/**
|
|
1321
1321
|
* A version of a document in Firestore. This corresponds to the version
|
|
1322
1322
|
* timestamp, such as update_time or read_time.
|
|
1323
|
-
*/ class
|
|
1323
|
+
*/ class vt {
|
|
1324
1324
|
constructor(t) {
|
|
1325
1325
|
this.timestamp = t;
|
|
1326
1326
|
}
|
|
1327
1327
|
static fromTimestamp(t) {
|
|
1328
|
-
return new
|
|
1328
|
+
return new vt(t);
|
|
1329
1329
|
}
|
|
1330
1330
|
static min() {
|
|
1331
|
-
return new
|
|
1331
|
+
return new vt(new gt(0, 0));
|
|
1332
1332
|
}
|
|
1333
1333
|
static max() {
|
|
1334
|
-
return new
|
|
1334
|
+
return new vt(new gt(253402300799, 999999999));
|
|
1335
1335
|
}
|
|
1336
1336
|
compareTo(t) {
|
|
1337
1337
|
return this.timestamp._compareTo(t.timestamp);
|
|
@@ -1366,7 +1366,7 @@ class gt {
|
|
|
1366
1366
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1367
1367
|
* See the License for the specific language governing permissions and
|
|
1368
1368
|
* limitations under the License.
|
|
1369
|
-
*/ function
|
|
1369
|
+
*/ function bt(t) {
|
|
1370
1370
|
let e = 0;
|
|
1371
1371
|
for (const n in t) Object.prototype.hasOwnProperty.call(t, n) && e++;
|
|
1372
1372
|
return e;
|
|
@@ -1554,13 +1554,13 @@ const At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1554
1554
|
// The json interface (for the browser) will return an iso timestamp string,
|
|
1555
1555
|
// while the proto js library (for node) will return a
|
|
1556
1556
|
// google.protobuf.Timestamp instance.
|
|
1557
|
-
if (
|
|
1557
|
+
if (v(!!t), "string" == typeof t) {
|
|
1558
1558
|
// The date string can have higher precision (nanos) than the Date class
|
|
1559
1559
|
// (millis), so we do some custom parsing here.
|
|
1560
1560
|
// Parse the nanos right out of the string.
|
|
1561
1561
|
let e = 0;
|
|
1562
1562
|
const n = At.exec(t);
|
|
1563
|
-
if (
|
|
1563
|
+
if (v(!!n), n[1]) {
|
|
1564
1564
|
// Pad the fraction out to 9 digits (nanos).
|
|
1565
1565
|
let t = n[1];
|
|
1566
1566
|
t = (t + "000000000").substr(0, 9), e = Number(t);
|
|
@@ -1660,9 +1660,16 @@ const At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1660
1660
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1661
1661
|
* See the License for the specific language governing permissions and
|
|
1662
1662
|
* limitations under the License.
|
|
1663
|
-
*/
|
|
1663
|
+
*/ const St = {
|
|
1664
|
+
fields: {
|
|
1665
|
+
__type__: {
|
|
1666
|
+
stringValue: "__max__"
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1669
|
+
};
|
|
1670
|
+
|
|
1664
1671
|
/** Extracts the backend's type order for the provided value. */
|
|
1665
|
-
function
|
|
1672
|
+
function Ft(t) {
|
|
1666
1673
|
return "nullValue" in t ? 0 /* NullValue */ : "booleanValue" in t ? 1 /* BooleanValue */ : "integerValue" in t || "doubleValue" in t ? 2 /* NumberValue */ : "timestampValue" in t ? 3 /* TimestampValue */ : "stringValue" in t ? 5 /* StringValue */ : "bytesValue" in t ? 6 /* BlobValue */ : "referenceValue" in t ? 7 /* RefValue */ : "geoPointValue" in t ? 8 /* GeoPointValue */ : "arrayValue" in t ? 9 /* ArrayValue */ : "mapValue" in t ? Dt(t) ? 4 /* ServerTimestampValue */ :
|
|
1667
1674
|
/** Returns true if the Value represents the canonical {@link #MAX_VALUE} . */
|
|
1668
1675
|
function(t) {
|
|
@@ -1687,13 +1694,13 @@ function St(t) {
|
|
|
1687
1694
|
/**
|
|
1688
1695
|
* An ObjectValue represents a MapValue in the Firestore Proto and offers the
|
|
1689
1696
|
* ability to add and remove fields (via the ObjectValueBuilder).
|
|
1690
|
-
*/ (t) ?
|
|
1697
|
+
*/ (t) ? 9007199254740991 /* MaxValue */ : 10 /* ObjectValue */ : g();
|
|
1691
1698
|
}
|
|
1692
1699
|
|
|
1693
|
-
/** Tests `left` and `right` for equality based on the backend semantics. */ function
|
|
1700
|
+
/** Tests `left` and `right` for equality based on the backend semantics. */ function xt(t, e) {
|
|
1694
1701
|
if (t === e) return !0;
|
|
1695
|
-
const n =
|
|
1696
|
-
if (n !==
|
|
1702
|
+
const n = Ft(t);
|
|
1703
|
+
if (n !== Ft(e)) return !1;
|
|
1697
1704
|
switch (n) {
|
|
1698
1705
|
case 0 /* NullValue */ :
|
|
1699
1706
|
case 9007199254740991 /* MaxValue */ :
|
|
@@ -1741,13 +1748,13 @@ function St(t) {
|
|
|
1741
1748
|
}(t, e);
|
|
1742
1749
|
|
|
1743
1750
|
case 9 /* ArrayValue */ :
|
|
1744
|
-
return _t(t.arrayValue.values || [], e.arrayValue.values || [],
|
|
1751
|
+
return _t(t.arrayValue.values || [], e.arrayValue.values || [], xt);
|
|
1745
1752
|
|
|
1746
1753
|
case 10 /* ObjectValue */ :
|
|
1747
1754
|
return function(t, e) {
|
|
1748
1755
|
const n = t.mapValue.fields || {}, r = e.mapValue.fields || {};
|
|
1749
|
-
if (
|
|
1750
|
-
for (const t in n) if (n.hasOwnProperty(t) && (void 0 === r[t] || !
|
|
1756
|
+
if (bt(n) !== bt(r)) return !1;
|
|
1757
|
+
for (const t in n) if (n.hasOwnProperty(t) && (void 0 === r[t] || !xt(n[t], r[t]))) return !1;
|
|
1751
1758
|
return !0;
|
|
1752
1759
|
}
|
|
1753
1760
|
/** Returns true if the ArrayValue contains the specified element. */ (t, e);
|
|
@@ -1757,13 +1764,13 @@ function St(t) {
|
|
|
1757
1764
|
}
|
|
1758
1765
|
}
|
|
1759
1766
|
|
|
1760
|
-
function
|
|
1761
|
-
return void 0 !== (t.values || []).find((t =>
|
|
1767
|
+
function qt(t, e) {
|
|
1768
|
+
return void 0 !== (t.values || []).find((t => xt(t, e)));
|
|
1762
1769
|
}
|
|
1763
1770
|
|
|
1764
|
-
function
|
|
1771
|
+
function Ot(t, e) {
|
|
1765
1772
|
if (t === e) return 0;
|
|
1766
|
-
const n =
|
|
1773
|
+
const n = Ft(t), r = Ft(e);
|
|
1767
1774
|
if (n !== r) return yt(n, r);
|
|
1768
1775
|
switch (n) {
|
|
1769
1776
|
case 0 /* NullValue */ :
|
|
@@ -1782,10 +1789,10 @@ function qt(t, e) {
|
|
|
1782
1789
|
}(t, e);
|
|
1783
1790
|
|
|
1784
1791
|
case 3 /* TimestampValue */ :
|
|
1785
|
-
return
|
|
1792
|
+
return Ct(t.timestampValue, e.timestampValue);
|
|
1786
1793
|
|
|
1787
1794
|
case 4 /* ServerTimestampValue */ :
|
|
1788
|
-
return
|
|
1795
|
+
return Ct($t(t), $t(e));
|
|
1789
1796
|
|
|
1790
1797
|
case 5 /* StringValue */ :
|
|
1791
1798
|
return yt(t.stringValue, e.stringValue);
|
|
@@ -1817,7 +1824,7 @@ function qt(t, e) {
|
|
|
1817
1824
|
return function(t, e) {
|
|
1818
1825
|
const n = t.values || [], r = e.values || [];
|
|
1819
1826
|
for (let t = 0; t < n.length && t < r.length; ++t) {
|
|
1820
|
-
const e =
|
|
1827
|
+
const e = Ot(n[t], r[t]);
|
|
1821
1828
|
if (e) return e;
|
|
1822
1829
|
}
|
|
1823
1830
|
return yt(n.length, r.length);
|
|
@@ -1825,6 +1832,9 @@ function qt(t, e) {
|
|
|
1825
1832
|
|
|
1826
1833
|
case 10 /* ObjectValue */ :
|
|
1827
1834
|
return function(t, e) {
|
|
1835
|
+
if (t === St && e === St) return 0;
|
|
1836
|
+
if (t === St) return 1;
|
|
1837
|
+
if (e === St) return -1;
|
|
1828
1838
|
const n = t.fields || {}, r = Object.keys(n), s = e.fields || {}, i = Object.keys(s);
|
|
1829
1839
|
// Even though MapValues are likely sorted correctly based on their insertion
|
|
1830
1840
|
// order (e.g. when received from the backend), local modifications can bring
|
|
@@ -1834,7 +1844,7 @@ function qt(t, e) {
|
|
|
1834
1844
|
for (let t = 0; t < r.length && t < i.length; ++t) {
|
|
1835
1845
|
const e = yt(r[t], i[t]);
|
|
1836
1846
|
if (0 !== e) return e;
|
|
1837
|
-
const o =
|
|
1847
|
+
const o = Ot(n[r[t]], s[i[t]]);
|
|
1838
1848
|
if (0 !== o) return o;
|
|
1839
1849
|
}
|
|
1840
1850
|
return yt(r.length, i.length);
|
|
@@ -1846,35 +1856,35 @@ function qt(t, e) {
|
|
|
1846
1856
|
}
|
|
1847
1857
|
}
|
|
1848
1858
|
|
|
1849
|
-
function
|
|
1859
|
+
function Ct(t, e) {
|
|
1850
1860
|
if ("string" == typeof t && "string" == typeof e && t.length === e.length) return yt(t, e);
|
|
1851
1861
|
const n = Rt(t), r = Rt(e), s = yt(n.seconds, r.seconds);
|
|
1852
1862
|
return 0 !== s ? s : yt(n.nanos, r.nanos);
|
|
1853
1863
|
}
|
|
1854
1864
|
|
|
1855
|
-
function
|
|
1865
|
+
function Lt(t, e) {
|
|
1856
1866
|
return {
|
|
1857
1867
|
referenceValue: `projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`
|
|
1858
1868
|
};
|
|
1859
1869
|
}
|
|
1860
1870
|
|
|
1861
|
-
/** Returns true if `value` is an ArrayValue. */ function
|
|
1871
|
+
/** Returns true if `value` is an ArrayValue. */ function Ut(t) {
|
|
1862
1872
|
return !!t && "arrayValue" in t;
|
|
1863
1873
|
}
|
|
1864
1874
|
|
|
1865
|
-
/** Returns true if `value` is a NullValue. */ function
|
|
1875
|
+
/** Returns true if `value` is a NullValue. */ function kt(t) {
|
|
1866
1876
|
return !!t && "nullValue" in t;
|
|
1867
1877
|
}
|
|
1868
1878
|
|
|
1869
|
-
/** Returns true if `value` is NaN. */ function
|
|
1879
|
+
/** Returns true if `value` is NaN. */ function jt(t) {
|
|
1870
1880
|
return !!t && "doubleValue" in t && isNaN(Number(t.doubleValue));
|
|
1871
1881
|
}
|
|
1872
1882
|
|
|
1873
|
-
/** Returns true if `value` is a MapValue. */ function
|
|
1883
|
+
/** Returns true if `value` is a MapValue. */ function Mt(t) {
|
|
1874
1884
|
return !!t && "mapValue" in t;
|
|
1875
1885
|
}
|
|
1876
1886
|
|
|
1877
|
-
/** Creates a deep copy of `source`. */ function
|
|
1887
|
+
/** Creates a deep copy of `source`. */ function Bt(t) {
|
|
1878
1888
|
if (t.geoPointValue) return {
|
|
1879
1889
|
geoPointValue: Object.assign({}, t.geoPointValue)
|
|
1880
1890
|
};
|
|
@@ -1887,7 +1897,7 @@ function Ct(t, e) {
|
|
|
1887
1897
|
fields: {}
|
|
1888
1898
|
}
|
|
1889
1899
|
};
|
|
1890
|
-
return Et(t.mapValue.fields, ((t, n) => e.mapValue.fields[t] =
|
|
1900
|
+
return Et(t.mapValue.fields, ((t, n) => e.mapValue.fields[t] = Bt(n))), e;
|
|
1891
1901
|
}
|
|
1892
1902
|
if (t.arrayValue) {
|
|
1893
1903
|
const e = {
|
|
@@ -1895,18 +1905,18 @@ function Ct(t, e) {
|
|
|
1895
1905
|
values: []
|
|
1896
1906
|
}
|
|
1897
1907
|
};
|
|
1898
|
-
for (let n = 0; n < (t.arrayValue.values || []).length; ++n) e.arrayValue.values[n] =
|
|
1908
|
+
for (let n = 0; n < (t.arrayValue.values || []).length; ++n) e.arrayValue.values[n] = Bt(t.arrayValue.values[n]);
|
|
1899
1909
|
return e;
|
|
1900
1910
|
}
|
|
1901
1911
|
return Object.assign({}, t);
|
|
1902
1912
|
}
|
|
1903
1913
|
|
|
1904
|
-
class
|
|
1914
|
+
class zt {
|
|
1905
1915
|
constructor(t) {
|
|
1906
1916
|
this.value = t;
|
|
1907
1917
|
}
|
|
1908
1918
|
static empty() {
|
|
1909
|
-
return new
|
|
1919
|
+
return new zt({
|
|
1910
1920
|
mapValue: {}
|
|
1911
1921
|
});
|
|
1912
1922
|
}
|
|
@@ -1920,7 +1930,7 @@ class Bt {
|
|
|
1920
1930
|
{
|
|
1921
1931
|
let e = this.value;
|
|
1922
1932
|
for (let n = 0; n < t.length - 1; ++n) if (e = (e.mapValue.fields || {})[t.get(n)],
|
|
1923
|
-
!
|
|
1933
|
+
!Mt(e)) return null;
|
|
1924
1934
|
return e = (e.mapValue.fields || {})[t.lastSegment()], e || null;
|
|
1925
1935
|
}
|
|
1926
1936
|
}
|
|
@@ -1930,7 +1940,7 @@ class Bt {
|
|
|
1930
1940
|
* @param path - The field path to set.
|
|
1931
1941
|
* @param value - The value to set.
|
|
1932
1942
|
*/ set(t, e) {
|
|
1933
|
-
this.getFieldsMap(t.popLast())[t.lastSegment()] =
|
|
1943
|
+
this.getFieldsMap(t.popLast())[t.lastSegment()] = Bt(e);
|
|
1934
1944
|
}
|
|
1935
1945
|
/**
|
|
1936
1946
|
* Sets the provided fields to the provided values.
|
|
@@ -1944,7 +1954,7 @@ class Bt {
|
|
|
1944
1954
|
const t = this.getFieldsMap(e);
|
|
1945
1955
|
this.applyChanges(t, n, r), n = {}, r = [], e = s.popLast();
|
|
1946
1956
|
}
|
|
1947
|
-
t ? n[s.lastSegment()] =
|
|
1957
|
+
t ? n[s.lastSegment()] = Bt(t) : r.push(s.lastSegment());
|
|
1948
1958
|
}));
|
|
1949
1959
|
const s = this.getFieldsMap(e);
|
|
1950
1960
|
this.applyChanges(s, n, r);
|
|
@@ -1956,10 +1966,10 @@ class Bt {
|
|
|
1956
1966
|
* @param path - The field path to remove.
|
|
1957
1967
|
*/ delete(t) {
|
|
1958
1968
|
const e = this.field(t.popLast());
|
|
1959
|
-
|
|
1969
|
+
Mt(e) && e.mapValue.fields && delete e.mapValue.fields[t.lastSegment()];
|
|
1960
1970
|
}
|
|
1961
1971
|
isEqual(t) {
|
|
1962
|
-
return
|
|
1972
|
+
return xt(this.value, t.value);
|
|
1963
1973
|
}
|
|
1964
1974
|
/**
|
|
1965
1975
|
* Returns the map that contains the leaf element of `path`. If the parent
|
|
@@ -1971,7 +1981,7 @@ class Bt {
|
|
|
1971
1981
|
});
|
|
1972
1982
|
for (let n = 0; n < t.length; ++n) {
|
|
1973
1983
|
let r = e.mapValue.fields[t.get(n)];
|
|
1974
|
-
|
|
1984
|
+
Mt(r) && r.mapValue.fields || (r = {
|
|
1975
1985
|
mapValue: {
|
|
1976
1986
|
fields: {}
|
|
1977
1987
|
}
|
|
@@ -1987,7 +1997,7 @@ class Bt {
|
|
|
1987
1997
|
for (const e of n) delete t[e];
|
|
1988
1998
|
}
|
|
1989
1999
|
clone() {
|
|
1990
|
-
return new Bt(
|
|
2000
|
+
return new zt(Bt(this.value));
|
|
1991
2001
|
}
|
|
1992
2002
|
}
|
|
1993
2003
|
|
|
@@ -2016,7 +2026,7 @@ class Bt {
|
|
|
2016
2026
|
* not transition to one of these states even after all mutations have been
|
|
2017
2027
|
* applied, `isValidDocument()` returns false and the document should be removed
|
|
2018
2028
|
* from all views.
|
|
2019
|
-
*/ class
|
|
2029
|
+
*/ class Gt {
|
|
2020
2030
|
constructor(t, e, n, r, s, i) {
|
|
2021
2031
|
this.key = t, this.documentType = e, this.version = n, this.readTime = r, this.data = s,
|
|
2022
2032
|
this.documentState = i;
|
|
@@ -2025,23 +2035,23 @@ class Bt {
|
|
|
2025
2035
|
* Creates a document with no known version or data, but which can serve as
|
|
2026
2036
|
* base document for mutations.
|
|
2027
2037
|
*/ static newInvalidDocument(t) {
|
|
2028
|
-
return new
|
|
2038
|
+
return new Gt(t, 0 /* INVALID */ , 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
|
|
|
@@ -2371,7 +2377,7 @@ function he(t) {
|
|
|
2371
2377
|
* which can be different from the order by constraints the user provided (e.g.
|
|
2372
2378
|
* the SDK and backend always orders by `__name__`).
|
|
2373
2379
|
*/ function le(t) {
|
|
2374
|
-
const e =
|
|
2380
|
+
const e = b(t);
|
|
2375
2381
|
if (null === e.$) {
|
|
2376
2382
|
e.$ = [];
|
|
2377
2383
|
const t = ae(e), n = ce(e);
|
|
@@ -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
|
}
|
|
@@ -2396,18 +2402,18 @@ function he(t) {
|
|
|
2396
2402
|
/**
|
|
2397
2403
|
* Converts this `Query` instance to it's corresponding `Target` representation.
|
|
2398
2404
|
*/ function fe(t) {
|
|
2399
|
-
const e =
|
|
2400
|
-
if (!e.S) if ("F" /* First */ === e.limitType) e.S =
|
|
2405
|
+
const e = b(t);
|
|
2406
|
+
if (!e.S) if ("F" /* First */ === e.limitType) e.S = Wt(e.path, e.collectionGroup, le(e), e.filters, e.limit, e.startAt, e.endAt); else {
|
|
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
|
|
|
@@ -2544,7 +2550,7 @@ function we(t, e) {
|
|
|
2544
2550
|
* See the License for the specific language governing permissions and
|
|
2545
2551
|
* limitations under the License.
|
|
2546
2552
|
*/
|
|
2547
|
-
/** A field path and the TransformOperation to perform upon it. */ class
|
|
2553
|
+
/** A field path and the TransformOperation to perform upon it. */ class ve {
|
|
2548
2554
|
constructor(t, e) {
|
|
2549
2555
|
this.field = t, this.transform = e;
|
|
2550
2556
|
}
|
|
@@ -2554,18 +2560,18 @@ function we(t, e) {
|
|
|
2554
2560
|
* Encodes a precondition for a mutation. This follows the model that the
|
|
2555
2561
|
* backend accepts with the special case of an explicit "empty" precondition
|
|
2556
2562
|
* (meaning no precondition).
|
|
2557
|
-
*/ class
|
|
2563
|
+
*/ class be {
|
|
2558
2564
|
constructor(t, e) {
|
|
2559
2565
|
this.updateTime = t, this.exists = e;
|
|
2560
2566
|
}
|
|
2561
2567
|
/** Creates a new empty Precondition. */ static none() {
|
|
2562
|
-
return new
|
|
2568
|
+
return new be;
|
|
2563
2569
|
}
|
|
2564
2570
|
/** Creates a new Precondition with an exists flag. */ static exists(t) {
|
|
2565
|
-
return new
|
|
2571
|
+
return new be(void 0, t);
|
|
2566
2572
|
}
|
|
2567
2573
|
/** Creates a new Precondition based on a version a document exists at. */ static updateTime(t) {
|
|
2568
|
-
return new
|
|
2574
|
+
return new be(t);
|
|
2569
2575
|
}
|
|
2570
2576
|
/** Returns whether this Precondition is empty. */ get isNone() {
|
|
2571
2577
|
return void 0 === this.updateTime && void 0 === this.exists;
|
|
@@ -2759,7 +2765,7 @@ function Se(t, e) {
|
|
|
2759
2765
|
}
|
|
2760
2766
|
|
|
2761
2767
|
function Fe(t) {
|
|
2762
|
-
return
|
|
2768
|
+
return v(!!t), vt.fromTimestamp(function(t) {
|
|
2763
2769
|
const e = Rt(t);
|
|
2764
2770
|
return new gt(e.seconds, e.nanos);
|
|
2765
2771
|
}(t));
|
|
@@ -2778,11 +2784,11 @@ function qe(t, e) {
|
|
|
2778
2784
|
function Oe(t, e) {
|
|
2779
2785
|
const n = function(t) {
|
|
2780
2786
|
const e = X.fromString(t);
|
|
2781
|
-
return
|
|
2787
|
+
return v(We(e)), e;
|
|
2782
2788
|
}(e);
|
|
2783
2789
|
if (n.get(1) !== t.databaseId.projectId) throw new U(A, "Tried to deserialize key from different project: " + n.get(1) + " vs " + t.databaseId.projectId);
|
|
2784
2790
|
if (n.get(3) !== t.databaseId.database) throw new U(A, "Tried to deserialize key from different database: " + n.get(3) + " vs " + t.databaseId.database);
|
|
2785
|
-
return new et((
|
|
2791
|
+
return new et((v((r = n).length > 4 && "documents" === r.get(4)), r.popFirst(5)));
|
|
2786
2792
|
var r;
|
|
2787
2793
|
/** Creates a Document proto from key and fields (but no create/update time) */}
|
|
2788
2794
|
|
|
@@ -2803,17 +2809,17 @@ function Ue(t, e, n) {
|
|
|
2803
2809
|
|
|
2804
2810
|
function ke(t, e) {
|
|
2805
2811
|
return "found" in e ? function(t, e) {
|
|
2806
|
-
|
|
2807
|
-
const n = Oe(t, e.found.name), r = Fe(e.found.updateTime), s = new
|
|
2812
|
+
v(!!e.found), e.found.name, e.found.updateTime;
|
|
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"
|
|
@@ -3152,14 +3158,14 @@ class Ke extends class {} {
|
|
|
3152
3158
|
// TODO(firestorexp): Make sure there is only one Datastore instance per
|
|
3153
3159
|
// firestore-exp client.
|
|
3154
3160
|
async function Je(t, e) {
|
|
3155
|
-
const n =
|
|
3161
|
+
const n = b(t), r = Le(n.q) + "/documents", s = {
|
|
3156
3162
|
writes: e.map((t => je(n.q, t)))
|
|
3157
3163
|
};
|
|
3158
3164
|
await n.m("Commit", r, s);
|
|
3159
3165
|
}
|
|
3160
3166
|
|
|
3161
3167
|
async function Xe(t, e) {
|
|
3162
|
-
const n =
|
|
3168
|
+
const n = b(t), r = Le(n.q) + "/documents", s = {
|
|
3163
3169
|
documents: e.map((t => qe(n.q, t)))
|
|
3164
3170
|
}, i = await n.T("BatchGetDocuments", r, s), o = new Map;
|
|
3165
3171
|
i.forEach((t => {
|
|
@@ -3169,20 +3175,20 @@ async function Xe(t, e) {
|
|
|
3169
3175
|
const u = [];
|
|
3170
3176
|
return e.forEach((t => {
|
|
3171
3177
|
const e = o.get(t.toString());
|
|
3172
|
-
|
|
3178
|
+
v(!!e), u.push(e);
|
|
3173
3179
|
})), u;
|
|
3174
3180
|
}
|
|
3175
3181
|
|
|
3176
3182
|
async function Ze(t, e) {
|
|
3177
|
-
const n =
|
|
3183
|
+
const n = b(t), r = Me(n.q, fe(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
|
}
|
|
@@ -3341,7 +3347,7 @@ class nn {
|
|
|
3341
3347
|
case "gapi":
|
|
3342
3348
|
const e = t.client;
|
|
3343
3349
|
// Make sure this really is a Gapi client.
|
|
3344
|
-
return
|
|
3350
|
+
return v(!("object" != typeof e || null === e || !e.auth || !e.auth.getAuthHeaderValueForFirstParty)),
|
|
3345
3351
|
new Q(e, t.sessionIndex || "0", t.iamToken || null);
|
|
3346
3352
|
|
|
3347
3353
|
case "provider":
|
|
@@ -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
|
|
|
@@ -3802,7 +3808,7 @@ function wn(t, e, ...n) {
|
|
|
3802
3808
|
/**
|
|
3803
3809
|
* Sentinel values that can be used when writing document fields with `set()`
|
|
3804
3810
|
* or `update()`.
|
|
3805
|
-
*/ class
|
|
3811
|
+
*/ class vn {
|
|
3806
3812
|
/**
|
|
3807
3813
|
* @param _methodName - The public API endpoint that returns this class.
|
|
3808
3814
|
* @hideconstructor
|
|
@@ -3834,7 +3840,7 @@ function wn(t, e, ...n) {
|
|
|
3834
3840
|
*
|
|
3835
3841
|
* Latitude values are in the range of [-90, 90].
|
|
3836
3842
|
* Longitude values are in the range of [-180, 180].
|
|
3837
|
-
*/ class
|
|
3843
|
+
*/ class bn {
|
|
3838
3844
|
/**
|
|
3839
3845
|
* Creates a new immutable `GeoPoint` object with the provided latitude and
|
|
3840
3846
|
* longitude values.
|
|
@@ -4046,10 +4052,10 @@ 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
|
-
class Nn extends
|
|
4058
|
+
class Nn extends vn {
|
|
4053
4059
|
_toFieldTransform(t) {
|
|
4054
4060
|
if (2 /* MergeSet */ !== t.tt) throw 1 /* Update */ === t.tt ? t.ut(`${this._methodName}() can only appear at the top level of your update data`) : t.ut(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);
|
|
4055
4061
|
// No transform to add for a delete, but we need to add it to our
|
|
@@ -4085,23 +4091,23 @@ class Nn extends bn {
|
|
|
4085
4091
|
}, e.databaseId, e.q, e.ignoreUndefinedProperties);
|
|
4086
4092
|
}
|
|
4087
4093
|
|
|
4088
|
-
class Sn extends
|
|
4094
|
+
class Sn extends vn {
|
|
4089
4095
|
_toFieldTransform(t) {
|
|
4090
|
-
return new
|
|
4096
|
+
return new ve(t.path, new pe);
|
|
4091
4097
|
}
|
|
4092
4098
|
isEqual(t) {
|
|
4093
4099
|
return t instanceof Sn;
|
|
4094
4100
|
}
|
|
4095
4101
|
}
|
|
4096
4102
|
|
|
4097
|
-
class Fn extends
|
|
4103
|
+
class Fn extends vn {
|
|
4098
4104
|
constructor(t, e) {
|
|
4099
4105
|
super(t), this.lt = e;
|
|
4100
4106
|
}
|
|
4101
4107
|
_toFieldTransform(t) {
|
|
4102
4108
|
const e = $n(this, t,
|
|
4103
4109
|
/*array=*/ !0), n = this.lt.map((t => Un(t, e))), r = new ye(n);
|
|
4104
|
-
return new
|
|
4110
|
+
return new ve(t.path, r);
|
|
4105
4111
|
}
|
|
4106
4112
|
isEqual(t) {
|
|
4107
4113
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4109,14 +4115,14 @@ class Fn extends bn {
|
|
|
4109
4115
|
}
|
|
4110
4116
|
}
|
|
4111
4117
|
|
|
4112
|
-
class xn extends
|
|
4118
|
+
class xn extends vn {
|
|
4113
4119
|
constructor(t, e) {
|
|
4114
4120
|
super(t), this.lt = e;
|
|
4115
4121
|
}
|
|
4116
4122
|
_toFieldTransform(t) {
|
|
4117
4123
|
const e = $n(this, t,
|
|
4118
4124
|
/*array=*/ !0), n = this.lt.map((t => Un(t, e))), r = new _e(n);
|
|
4119
|
-
return new
|
|
4125
|
+
return new ve(t.path, r);
|
|
4120
4126
|
}
|
|
4121
4127
|
isEqual(t) {
|
|
4122
4128
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4124,13 +4130,13 @@ class xn extends bn {
|
|
|
4124
4130
|
}
|
|
4125
4131
|
}
|
|
4126
4132
|
|
|
4127
|
-
class qn extends
|
|
4133
|
+
class qn extends vn {
|
|
4128
4134
|
constructor(t, e) {
|
|
4129
4135
|
super(t), this.ft = e;
|
|
4130
4136
|
}
|
|
4131
4137
|
_toFieldTransform(t) {
|
|
4132
4138
|
const e = new ge(t.q, we(t.q, this.ft));
|
|
4133
|
-
return new
|
|
4139
|
+
return new ve(t.path, e);
|
|
4134
4140
|
}
|
|
4135
4141
|
isEqual(t) {
|
|
4136
4142
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -4141,7 +4147,7 @@ class qn extends bn {
|
|
|
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 bn {
|
|
|
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])) {
|
|
@@ -4207,7 +4213,7 @@ class qn extends bn {
|
|
|
4207
4213
|
// Unwrap the API type from the Compat SDK. This will return the API type
|
|
4208
4214
|
// from firestore-exp.
|
|
4209
4215
|
t = getModularInstance(t))) return Mn("Unsupported field value:", e, t), kn(t, e);
|
|
4210
|
-
if (t instanceof
|
|
4216
|
+
if (t instanceof vn)
|
|
4211
4217
|
// FieldValues usually parse into transforms (except deleteField())
|
|
4212
4218
|
// in which case we do not want to include this field in our parsed data
|
|
4213
4219
|
// (as doing so will overwrite the field directly prior to the transform
|
|
@@ -4290,7 +4296,7 @@ class qn extends bn {
|
|
|
4290
4296
|
timestampValue: Ne(e.q, n)
|
|
4291
4297
|
};
|
|
4292
4298
|
}
|
|
4293
|
-
if (t instanceof
|
|
4299
|
+
if (t instanceof bn) return {
|
|
4294
4300
|
geoPointValue: {
|
|
4295
4301
|
latitude: t.latitude,
|
|
4296
4302
|
longitude: t.longitude
|
|
@@ -4336,7 +4342,7 @@ function kn(t, e) {
|
|
|
4336
4342
|
}
|
|
4337
4343
|
|
|
4338
4344
|
function jn(t) {
|
|
4339
|
-
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof gt || t instanceof
|
|
4345
|
+
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof gt || t instanceof bn || t instanceof gn || t instanceof an || t instanceof vn);
|
|
4340
4346
|
}
|
|
4341
4347
|
|
|
4342
4348
|
function Mn(t, e, n) {
|
|
@@ -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
|
}
|
|
@@ -4738,12 +4744,12 @@ class rr extends Zn {
|
|
|
4738
4744
|
|
|
4739
4745
|
class ir extends Zn {
|
|
4740
4746
|
constructor(t, e, n) {
|
|
4741
|
-
super(), this.type = t, this.gt = e, this.
|
|
4747
|
+
super(), this.type = t, this.gt = e, this.vt = n;
|
|
4742
4748
|
}
|
|
4743
4749
|
_apply(t) {
|
|
4744
4750
|
return new hn(t.firestore, t.converter, function(t, e, n) {
|
|
4745
|
-
return new
|
|
4746
|
-
}(t._query, this.gt, this.
|
|
4751
|
+
return new ue(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
|
|
4752
|
+
}(t._query, this.gt, this.vt));
|
|
4747
4753
|
}
|
|
4748
4754
|
}
|
|
4749
4755
|
|
|
@@ -4770,12 +4776,12 @@ class ir extends Zn {
|
|
|
4770
4776
|
|
|
4771
4777
|
class cr extends Zn {
|
|
4772
4778
|
constructor(t, e, n) {
|
|
4773
|
-
super(), this.type = t, this.
|
|
4779
|
+
super(), this.type = t, this.bt = e, this.Et = n;
|
|
4774
4780
|
}
|
|
4775
4781
|
_apply(t) {
|
|
4776
|
-
const e = wr(t, this.type, this.
|
|
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
|
}
|
|
@@ -4792,12 +4798,12 @@ function hr(...t) {
|
|
|
4792
4798
|
|
|
4793
4799
|
class lr extends Zn {
|
|
4794
4800
|
constructor(t, e, n) {
|
|
4795
|
-
super(), this.type = t, this.
|
|
4801
|
+
super(), this.type = t, this.bt = e, this.Et = n;
|
|
4796
4802
|
}
|
|
4797
4803
|
_apply(t) {
|
|
4798
|
-
const e = wr(t, this.type, this.
|
|
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
|
|
|
@@ -4994,7 +5000,7 @@ class gr extends class {
|
|
|
4994
5000
|
})), n;
|
|
4995
5001
|
}
|
|
4996
5002
|
convertGeoPoint(t) {
|
|
4997
|
-
return new
|
|
5003
|
+
return new bn(Pt(t.latitude), Pt(t.longitude));
|
|
4998
5004
|
}
|
|
4999
5005
|
convertArray(t, e) {
|
|
5000
5006
|
return (t.values || []).map((t => this.convertValue(t, e)));
|
|
@@ -5018,7 +5024,7 @@ class gr extends class {
|
|
|
5018
5024
|
}
|
|
5019
5025
|
convertDocumentKey(t, e) {
|
|
5020
5026
|
const n = X.fromString(t);
|
|
5021
|
-
|
|
5027
|
+
v(We(n));
|
|
5022
5028
|
const r = new K(n.get(1), n.get(3)), s = new et(n.popFirst(5));
|
|
5023
5029
|
return r.isEqual(e) ||
|
|
5024
5030
|
// TODO(b/64130202): Somehow support foreign references.
|
|
@@ -5050,10 +5056,10 @@ class gr extends class {
|
|
|
5050
5056
|
* @param reference - The reference of the document to fetch.
|
|
5051
5057
|
* @returns A Promise resolved with a `DocumentSnapshot` containing the current
|
|
5052
5058
|
* document contents.
|
|
5053
|
-
*/ function
|
|
5059
|
+
*/ function vr(t) {
|
|
5054
5060
|
const e = en((t = ot(t, an)).firestore), n = new gr(t.firestore);
|
|
5055
5061
|
return Xe(e, [ t._key ]).then((e => {
|
|
5056
|
-
|
|
5062
|
+
v(1 === e.length);
|
|
5057
5063
|
const r = e[0];
|
|
5058
5064
|
return new Yn(t.firestore, n, t._key, r.isFoundDocument() ? r : null, t.converter);
|
|
5059
5065
|
}));
|
|
@@ -5070,14 +5076,14 @@ class gr extends class {
|
|
|
5070
5076
|
*
|
|
5071
5077
|
* @param query - The `Query` to execute.
|
|
5072
5078
|
* @returns A Promise that will be resolved with the results of the query.
|
|
5073
|
-
*/ function
|
|
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.
|
|
@@ -5087,7 +5093,7 @@ class gr extends class {
|
|
|
5087
5093
|
|
|
5088
5094
|
function Er(t, e, n) {
|
|
5089
5095
|
const r = _r((t = ot(t, an)).converter, e, n), s = Dn(Vn(t.firestore), "setDoc", t._key, r, null !== t.converter, n);
|
|
5090
|
-
return Je(en(t.firestore), [ s.toMutation(t._key,
|
|
5096
|
+
return Je(en(t.firestore), [ s.toMutation(t._key, be.none()) ]);
|
|
5091
5097
|
}
|
|
5092
5098
|
|
|
5093
5099
|
function Tr(t, e, n, ...r) {
|
|
@@ -5096,7 +5102,7 @@ function Tr(t, e, n, ...r) {
|
|
|
5096
5102
|
// performing validation.
|
|
5097
5103
|
let i;
|
|
5098
5104
|
i = "string" == typeof (e = getModularInstance(e)) || e instanceof yn ? Cn(s, "updateDoc", t._key, e, n, r) : On(s, "updateDoc", t._key, e);
|
|
5099
|
-
return Je(en(t.firestore), [ i.toMutation(t._key,
|
|
5105
|
+
return Je(en(t.firestore), [ i.toMutation(t._key, be.exists(!0)) ]);
|
|
5100
5106
|
}
|
|
5101
5107
|
|
|
5102
5108
|
/**
|
|
@@ -5111,7 +5117,7 @@ function Tr(t, e, n, ...r) {
|
|
|
5111
5117
|
* @returns A `Promise` resolved once the document has been successfully
|
|
5112
5118
|
* deleted from the backend.
|
|
5113
5119
|
*/ function Ir(t) {
|
|
5114
|
-
return Je(en((t = ot(t, an)).firestore), [ new Ae(t._key,
|
|
5120
|
+
return Je(en((t = ot(t, an)).firestore), [ new Ae(t._key, be.none()) ]);
|
|
5115
5121
|
}
|
|
5116
5122
|
|
|
5117
5123
|
/**
|
|
@@ -5130,7 +5136,7 @@ function Tr(t, e, n, ...r) {
|
|
|
5130
5136
|
* newly created document after it has been written to the backend.
|
|
5131
5137
|
*/ function Ar(t, e) {
|
|
5132
5138
|
const n = wn(t = ot(t, ln)), r = _r(t.converter, e), s = Dn(Vn(t.firestore), "addDoc", n._key, r, null !== n.converter, {});
|
|
5133
|
-
return Je(en(t.firestore), [ s.toMutation(n._key,
|
|
5139
|
+
return Je(en(t.firestore), [ s.toMutation(n._key, be.exists(!1)) ]).then((() => n));
|
|
5134
5140
|
}
|
|
5135
5141
|
|
|
5136
5142
|
/**
|
|
@@ -5250,7 +5256,7 @@ function Tr(t, e, n, ...r) {
|
|
|
5250
5256
|
set(t, e, n) {
|
|
5251
5257
|
this._verifyNotCommitted();
|
|
5252
5258
|
const r = Sr(t, this._firestore), s = _r(r.converter, e, n), i = Dn(this._dataReader, "WriteBatch.set", r._key, s, null !== r.converter, n);
|
|
5253
|
-
return this._mutations.push(i.toMutation(r._key,
|
|
5259
|
+
return this._mutations.push(i.toMutation(r._key, be.none())), this;
|
|
5254
5260
|
}
|
|
5255
5261
|
update(t, e, n, ...r) {
|
|
5256
5262
|
this._verifyNotCommitted();
|
|
@@ -5259,7 +5265,7 @@ function Tr(t, e, n, ...r) {
|
|
|
5259
5265
|
// performing validation.
|
|
5260
5266
|
let i;
|
|
5261
5267
|
return i = "string" == typeof (e = getModularInstance(e)) || e instanceof yn ? Cn(this._dataReader, "WriteBatch.update", s._key, e, n, r) : On(this._dataReader, "WriteBatch.update", s._key, e),
|
|
5262
|
-
this._mutations.push(i.toMutation(s._key,
|
|
5268
|
+
this._mutations.push(i.toMutation(s._key, be.exists(!0))), this;
|
|
5263
5269
|
}
|
|
5264
5270
|
/**
|
|
5265
5271
|
* Deletes the document referred to by the provided {@link DocumentReference}.
|
|
@@ -5269,7 +5275,7 @@ function Tr(t, e, n, ...r) {
|
|
|
5269
5275
|
*/ delete(t) {
|
|
5270
5276
|
this._verifyNotCommitted();
|
|
5271
5277
|
const e = Sr(t, this._firestore);
|
|
5272
|
-
return this._mutations = this._mutations.concat(new Ae(e._key,
|
|
5278
|
+
return this._mutations = this._mutations.concat(new Ae(e._key, be.none())), this;
|
|
5273
5279
|
}
|
|
5274
5280
|
/**
|
|
5275
5281
|
* Commits all of the writes in this write batch as a single atomic unit.
|
|
@@ -5387,7 +5393,7 @@ function Sr(t, e) {
|
|
|
5387
5393
|
if (t.isFoundDocument()) e = t.version; else {
|
|
5388
5394
|
if (!t.isNoDocument()) throw g();
|
|
5389
5395
|
// For deleted docs, we must use baseVersion 0 when we overwrite them.
|
|
5390
|
-
e =
|
|
5396
|
+
e = vt.min();
|
|
5391
5397
|
}
|
|
5392
5398
|
const n = this.readVersions.get(t.key.toString());
|
|
5393
5399
|
if (n) {
|
|
@@ -5401,7 +5407,7 @@ function Sr(t, e) {
|
|
|
5401
5407
|
* as a precondition, or no precondition if it was not read.
|
|
5402
5408
|
*/ precondition(t) {
|
|
5403
5409
|
const e = this.readVersions.get(t.toString());
|
|
5404
|
-
return !this.writtenDocs.has(t.toString()) && e ?
|
|
5410
|
+
return !this.writtenDocs.has(t.toString()) && e ? be.updateTime(e) : be.none();
|
|
5405
5411
|
}
|
|
5406
5412
|
/**
|
|
5407
5413
|
* Returns the precondition for a document if the operation is an update.
|
|
@@ -5410,7 +5416,7 @@ function Sr(t, e) {
|
|
|
5410
5416
|
// The first time a document is written, we want to take into account the
|
|
5411
5417
|
// read time and existence
|
|
5412
5418
|
if (!this.writtenDocs.has(t.toString()) && e) {
|
|
5413
|
-
if (e.isEqual(
|
|
5419
|
+
if (e.isEqual(vt.min()))
|
|
5414
5420
|
// The document doesn't exist, so fail the transaction.
|
|
5415
5421
|
// This has to be validated locally because you can't send a
|
|
5416
5422
|
// precondition that a document does not exist without changing the
|
|
@@ -5422,11 +5428,11 @@ function Sr(t, e) {
|
|
|
5422
5428
|
// transaction.
|
|
5423
5429
|
throw new U(A, "Can't update a document that doesn't exist.");
|
|
5424
5430
|
// Document exists, base precondition on document update time.
|
|
5425
|
-
return
|
|
5431
|
+
return be.updateTime(e);
|
|
5426
5432
|
}
|
|
5427
5433
|
// Document was not read, so we just use the preconditions for a blind
|
|
5428
5434
|
// update.
|
|
5429
|
-
return
|
|
5435
|
+
return be.exists(!0);
|
|
5430
5436
|
}
|
|
5431
5437
|
write(t) {
|
|
5432
5438
|
this.ensureCommitNotCalled(), this.mutations.push(t);
|
|
@@ -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.8-canary.
|
|
5983
|
+
registerVersion("firestore-lite", "3.4.8-canary.93f3e841e", ""), registerVersion("firestore-lite", "3.4.8-canary.93f3e841e", "esm2017");
|
|
5978
5984
|
|
|
5979
|
-
export { gn as Bytes, ln as CollectionReference, an as DocumentReference, Yn as DocumentSnapshot, yn as FieldPath,
|
|
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
|