@firebase/firestore 3.7.1 → 3.7.2
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 +12 -0
- package/dist/index.esm2017.js +234 -231
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +622 -621
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +36 -35
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +3 -2
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +234 -231
- package/dist/index.rn.js.map +1 -1
- package/dist/lite/index.browser.esm2017.js +134 -134
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +257 -257
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +2 -2
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +2 -2
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +134 -134
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +17 -17
- package/dist/packages/firestore/dist/index.esm2017.d.ts +1 -1
- package/package.json +10 -10
- package/dist/firestore/test/integration/api_internal/aggregation.test.d.ts +0 -17
- package/dist/lite/firestore/test/integration/api_internal/aggregation.test.d.ts +0 -17
- package/dist/lite/packages/firestore/test/integration/api_internal/aggregation.test.d.ts +0 -17
- package/dist/packages/firestore/test/integration/api_internal/aggregation.test.d.ts +0 -17
package/dist/index.esm5.js
CHANGED
|
@@ -6,11 +6,11 @@ import { Component as c } from "@firebase/component";
|
|
|
6
6
|
|
|
7
7
|
import { Logger as l, LogLevel as h } from "@firebase/logger";
|
|
8
8
|
|
|
9
|
-
import { FirebaseError as f, getUA as d, isSafari as p, getModularInstance as v,
|
|
9
|
+
import { FirebaseError as f, getUA as d, isSafari as p, getModularInstance as v, isIndexedDBAvailable as y, createMockUserToken as m, deepEqual as g, getDefaultEmulatorHostnameAndPort as w } from "@firebase/util";
|
|
10
10
|
|
|
11
|
-
import { XhrIo as b, EventType as I, ErrorCode as
|
|
11
|
+
import { XhrIo as b, EventType as I, ErrorCode as T, createWebChannelTransport as E, getStatEventTarget as S, FetchXmlHttpFactory as D, WebChannel as x, Event as _, Stat as A } from "@firebase/webchannel-wrapper";
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var N = "@firebase/firestore", C = /** @class */ function() {
|
|
14
14
|
function t(t) {
|
|
15
15
|
this.uid = t;
|
|
16
16
|
}
|
|
@@ -70,7 +70,7 @@ C.MOCK_USER = new C("mock-user");
|
|
|
70
70
|
* See the License for the specific language governing permissions and
|
|
71
71
|
* limitations under the License.
|
|
72
72
|
*/
|
|
73
|
-
var k = "9.
|
|
73
|
+
var k = "9.13.0", O = new l("@firebase/firestore");
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* @license
|
|
@@ -1128,7 +1128,7 @@ function gt(t, e) {
|
|
|
1128
1128
|
/** The state of an index that has not yet been backfilled. */;
|
|
1129
1129
|
}
|
|
1130
1130
|
return t.empty = function() {
|
|
1131
|
-
return new t(0,
|
|
1131
|
+
return new t(0, Tt.min());
|
|
1132
1132
|
}, t;
|
|
1133
1133
|
}();
|
|
1134
1134
|
|
|
@@ -1143,17 +1143,17 @@ function gt(t, e) {
|
|
|
1143
1143
|
// `(readTime + 1, DocumentKey.empty())` since `> DocumentKey.empty()` matches
|
|
1144
1144
|
// all valid document IDs.
|
|
1145
1145
|
var n = t.toTimestamp().seconds, r = t.toTimestamp().nanoseconds + 1, i = st.fromTimestamp(1e9 === r ? new ut(n + 1, 0) : new ut(n, r));
|
|
1146
|
-
return new
|
|
1146
|
+
return new Tt(i, ft.empty(), e);
|
|
1147
1147
|
}
|
|
1148
1148
|
|
|
1149
1149
|
/** Creates a new offset based on the provided document. */ function It(t) {
|
|
1150
|
-
return new
|
|
1150
|
+
return new Tt(t.readTime, t.key, -1);
|
|
1151
1151
|
}
|
|
1152
1152
|
|
|
1153
1153
|
/**
|
|
1154
1154
|
* Stores the latest read time, document and batch ID that were processed for an
|
|
1155
1155
|
* index.
|
|
1156
|
-
*/ var
|
|
1156
|
+
*/ var Tt = /** @class */ function() {
|
|
1157
1157
|
function t(
|
|
1158
1158
|
/**
|
|
1159
1159
|
* The latest read time version that has been indexed by Firestore for this
|
|
@@ -1180,7 +1180,7 @@ function gt(t, e) {
|
|
|
1180
1180
|
}, t;
|
|
1181
1181
|
}();
|
|
1182
1182
|
|
|
1183
|
-
function
|
|
1183
|
+
function Et(t, e) {
|
|
1184
1184
|
var n = t.readTime.compareTo(e.readTime);
|
|
1185
1185
|
return 0 !== n ? n : 0 !== (n = ft.comparator(t.documentKey, e.documentKey)) ? n : rt(t.largestBatchId, e.largestBatchId);
|
|
1186
1186
|
}
|
|
@@ -1247,7 +1247,7 @@ function Tt(t, e) {
|
|
|
1247
1247
|
* @param err - An error returned by a LocalStore operation.
|
|
1248
1248
|
* @returns A Promise that resolves after we recovered, or the original error.
|
|
1249
1249
|
*/
|
|
1250
|
-
function
|
|
1250
|
+
function xt(t) {
|
|
1251
1251
|
return e(this, void 0, void 0, (function() {
|
|
1252
1252
|
return n(this, (function(e) {
|
|
1253
1253
|
if (t.code !== K.FAILED_PRECONDITION || t.message !== St) throw t;
|
|
@@ -1284,7 +1284,7 @@ function _t(t) {
|
|
|
1284
1284
|
*
|
|
1285
1285
|
* NOTE: .then() and .catch() only allow a single consumer, unlike normal
|
|
1286
1286
|
* Promises.
|
|
1287
|
-
*/ var
|
|
1287
|
+
*/ var _t = /** @class */ function() {
|
|
1288
1288
|
function t(t) {
|
|
1289
1289
|
var e = this;
|
|
1290
1290
|
// NOTE: next/catchCallback will always point to our own wrapper functions,
|
|
@@ -1409,7 +1409,7 @@ function _t(t) {
|
|
|
1409
1409
|
i();
|
|
1410
1410
|
}));
|
|
1411
1411
|
}, t;
|
|
1412
|
-
}(),
|
|
1412
|
+
}(), At = /** @class */ function() {
|
|
1413
1413
|
function t(t, e) {
|
|
1414
1414
|
var n = this;
|
|
1415
1415
|
this.action = t, this.transaction = e, this.aborted = !1,
|
|
@@ -1460,7 +1460,7 @@ function _t(t) {
|
|
|
1460
1460
|
var e = this.transaction.objectStore(t);
|
|
1461
1461
|
return new Rt(e);
|
|
1462
1462
|
}, t;
|
|
1463
|
-
}(),
|
|
1463
|
+
}(), Nt = /** @class */ function() {
|
|
1464
1464
|
/*
|
|
1465
1465
|
* Creates a new SimpleDb wrapper for IndexedDb database `name`.
|
|
1466
1466
|
*
|
|
@@ -1482,7 +1482,7 @@ function _t(t) {
|
|
|
1482
1482
|
return L("SimpleDb", "Removing database:", t), Vt(window.indexedDB.deleteDatabase(t)).toPromise();
|
|
1483
1483
|
},
|
|
1484
1484
|
/** Returns true if IndexedDB is available in the current environment. */ t.C = function() {
|
|
1485
|
-
if (!
|
|
1485
|
+
if (!y()) return !1;
|
|
1486
1486
|
if (t.N()) return !0;
|
|
1487
1487
|
// We extensively use indexed array values and compound keys,
|
|
1488
1488
|
// which IE and Edge do not support. However, they still have indexedDB
|
|
@@ -1593,11 +1593,11 @@ function _t(t) {
|
|
|
1593
1593
|
// Wait for the transaction to complete (i.e. IndexedDb's onsuccess event to
|
|
1594
1594
|
// fire), but still return the original transactionFnResult back to the
|
|
1595
1595
|
// caller.
|
|
1596
|
-
return a.db = n.sent(), r =
|
|
1596
|
+
return a.db = n.sent(), r = At.open(a.db, t, e ? "readonly" : "readwrite", i), s = o(r).next((function(t) {
|
|
1597
1597
|
return r.V(), t;
|
|
1598
1598
|
})).catch((function(t) {
|
|
1599
1599
|
// Abort the transaction if there was an error.
|
|
1600
|
-
return r.abort(t),
|
|
1600
|
+
return r.abort(t), _t.reject(t);
|
|
1601
1601
|
})).toPromise(), c = {}, s.catch((function() {})), [ 4 /*yield*/ , r.v ];
|
|
1602
1602
|
|
|
1603
1603
|
case 3:
|
|
@@ -1790,7 +1790,7 @@ function _t(t) {
|
|
|
1790
1790
|
}));
|
|
1791
1791
|
}
|
|
1792
1792
|
var o = this.store.getAll(n.range);
|
|
1793
|
-
return new
|
|
1793
|
+
return new _t((function(t, e) {
|
|
1794
1794
|
o.onerror = function(t) {
|
|
1795
1795
|
e(t.target.error);
|
|
1796
1796
|
}, o.onsuccess = function(e) {
|
|
@@ -1804,7 +1804,7 @@ function _t(t) {
|
|
|
1804
1804
|
*/
|
|
1805
1805
|
t.prototype.J = function(t, e) {
|
|
1806
1806
|
var n = this.store.getAll(t, null === e ? void 0 : e);
|
|
1807
|
-
return new
|
|
1807
|
+
return new _t((function(t, e) {
|
|
1808
1808
|
n.onerror = function(t) {
|
|
1809
1809
|
e(t.target.error);
|
|
1810
1810
|
}, n.onsuccess = function(e) {
|
|
@@ -1835,7 +1835,7 @@ function _t(t) {
|
|
|
1835
1835
|
*/
|
|
1836
1836
|
t.prototype.tt = function(t) {
|
|
1837
1837
|
var e = this.cursor({});
|
|
1838
|
-
return new
|
|
1838
|
+
return new _t((function(n, r) {
|
|
1839
1839
|
e.onerror = function(t) {
|
|
1840
1840
|
var e = Mt(t.target.error);
|
|
1841
1841
|
r(e);
|
|
@@ -1848,16 +1848,16 @@ function _t(t) {
|
|
|
1848
1848
|
}));
|
|
1849
1849
|
}, t.prototype.H = function(t, e) {
|
|
1850
1850
|
var n = [];
|
|
1851
|
-
return new
|
|
1851
|
+
return new _t((function(r, i) {
|
|
1852
1852
|
t.onerror = function(t) {
|
|
1853
1853
|
i(t.target.error);
|
|
1854
1854
|
}, t.onsuccess = function(t) {
|
|
1855
1855
|
var i = t.target.result;
|
|
1856
1856
|
if (i) {
|
|
1857
1857
|
var o = new Ct(i), u = e(i.primaryKey, i.value, o);
|
|
1858
|
-
if (u instanceof
|
|
1858
|
+
if (u instanceof _t) {
|
|
1859
1859
|
var s = u.catch((function(t) {
|
|
1860
|
-
return o.done(),
|
|
1860
|
+
return o.done(), _t.reject(t);
|
|
1861
1861
|
}));
|
|
1862
1862
|
n.push(s);
|
|
1863
1863
|
}
|
|
@@ -1865,7 +1865,7 @@ function _t(t) {
|
|
|
1865
1865
|
} else r();
|
|
1866
1866
|
};
|
|
1867
1867
|
})).next((function() {
|
|
1868
|
-
return
|
|
1868
|
+
return _t.waitFor(n);
|
|
1869
1869
|
}));
|
|
1870
1870
|
}, t.prototype.options = function(t, e) {
|
|
1871
1871
|
var n;
|
|
@@ -1887,7 +1887,7 @@ function _t(t) {
|
|
|
1887
1887
|
* Wraps an IDBRequest in a PersistencePromise, using the onsuccess / onerror
|
|
1888
1888
|
* handlers to resolve / reject the PersistencePromise as appropriate.
|
|
1889
1889
|
*/ function Vt(t) {
|
|
1890
|
-
return new
|
|
1890
|
+
return new _t((function(e, n) {
|
|
1891
1891
|
t.onsuccess = function(t) {
|
|
1892
1892
|
var n = t.target.result;
|
|
1893
1893
|
e(n);
|
|
@@ -1902,7 +1902,7 @@ function _t(t) {
|
|
|
1902
1902
|
var Lt = !1;
|
|
1903
1903
|
|
|
1904
1904
|
function Mt(t) {
|
|
1905
|
-
var e =
|
|
1905
|
+
var e = Nt.D(d());
|
|
1906
1906
|
if (e >= 12.2 && e < 13) {
|
|
1907
1907
|
var n = "An internal error was encountered in the Indexed Database server";
|
|
1908
1908
|
if (t.message.indexOf(n) >= 0) {
|
|
@@ -1955,7 +1955,7 @@ function Mt(t) {
|
|
|
1955
1955
|
[ 3 /*break*/ , 6 ]) : [ 3 /*break*/ , 4 ];
|
|
1956
1956
|
|
|
1957
1957
|
case 4:
|
|
1958
|
-
return [ 4 /*yield*/ ,
|
|
1958
|
+
return [ 4 /*yield*/ , xt(i) ];
|
|
1959
1959
|
|
|
1960
1960
|
case 5:
|
|
1961
1961
|
n.sent(), n.label = 6;
|
|
@@ -1997,7 +1997,7 @@ function Mt(t) {
|
|
|
1997
1997
|
},
|
|
1998
1998
|
/** Writes index entries until the cap is reached. Returns the number of documents processed. */ t.prototype.it = function(t, e) {
|
|
1999
1999
|
var n = this, r = new Set, i = e, o = !0;
|
|
2000
|
-
return
|
|
2000
|
+
return _t.doWhile((function() {
|
|
2001
2001
|
return !0 === o && i > 0;
|
|
2002
2002
|
}), (function() {
|
|
2003
2003
|
return n.localStore.indexManager.getNextCollectionGroupToUpdate(t).next((function(e) {
|
|
@@ -2034,8 +2034,8 @@ function Mt(t) {
|
|
|
2034
2034
|
var n = t;
|
|
2035
2035
|
return e.changes.forEach((function(t, e) {
|
|
2036
2036
|
var r = It(e);
|
|
2037
|
-
|
|
2038
|
-
})), new
|
|
2037
|
+
Et(r, n) > 0 && (n = r);
|
|
2038
|
+
})), new Tt(n.readTime, n.documentKey, Math.max(e.batchId, t.largestBatchId));
|
|
2039
2039
|
}, t;
|
|
2040
2040
|
}(), qt = /** @class */ function() {
|
|
2041
2041
|
function t(t, e) {
|
|
@@ -2914,7 +2914,7 @@ function se(t) {
|
|
|
2914
2914
|
};
|
|
2915
2915
|
|
|
2916
2916
|
/** Extracts the backend's type order for the provided value. */ function fe(t) {
|
|
2917
|
-
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 ? ne(t) ? 4 /* ServerTimestampValue */ :
|
|
2917
|
+
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 ? ne(t) ? 4 /* ServerTimestampValue */ : xe(t) ? 9007199254740991 /* MaxValue */ : 10 /* ObjectValue */ : q();
|
|
2918
2918
|
}
|
|
2919
2919
|
|
|
2920
2920
|
/** Tests `left` and `right` for equality based on the backend semantics. */ function de(t, e) {
|
|
@@ -3121,11 +3121,11 @@ function we(t, e) {
|
|
|
3121
3121
|
return !!t && "arrayValue" in t;
|
|
3122
3122
|
}
|
|
3123
3123
|
|
|
3124
|
-
/** Returns true if `value` is a NullValue. */ function
|
|
3124
|
+
/** Returns true if `value` is a NullValue. */ function Te(t) {
|
|
3125
3125
|
return !!t && "nullValue" in t;
|
|
3126
3126
|
}
|
|
3127
3127
|
|
|
3128
|
-
/** Returns true if `value` is NaN. */ function
|
|
3128
|
+
/** Returns true if `value` is NaN. */ function Ee(t) {
|
|
3129
3129
|
return !!t && "doubleValue" in t && isNaN(Number(t.doubleValue));
|
|
3130
3130
|
}
|
|
3131
3131
|
|
|
@@ -3161,11 +3161,11 @@ function we(t, e) {
|
|
|
3161
3161
|
return Object.assign({}, t);
|
|
3162
3162
|
}
|
|
3163
3163
|
|
|
3164
|
-
/** Returns true if the Value represents the canonical {@link #MAX_VALUE} . */ function
|
|
3164
|
+
/** Returns true if the Value represents the canonical {@link #MAX_VALUE} . */ function xe(t) {
|
|
3165
3165
|
return "__max__" === (((t.mapValue || {}).fields || {}).__type__ || {}).stringValue;
|
|
3166
3166
|
}
|
|
3167
3167
|
|
|
3168
|
-
/** Returns the lowest value for the given value type (inclusive). */ function
|
|
3168
|
+
/** Returns the lowest value for the given value type (inclusive). */ function _e(t) {
|
|
3169
3169
|
return "nullValue" in t ? he : "booleanValue" in t ? {
|
|
3170
3170
|
booleanValue: !1
|
|
3171
3171
|
} : "integerValue" in t || "doubleValue" in t ? {
|
|
@@ -3190,7 +3190,7 @@ function we(t, e) {
|
|
|
3190
3190
|
} : q();
|
|
3191
3191
|
}
|
|
3192
3192
|
|
|
3193
|
-
/** Returns the largest value for the given value type (exclusive). */ function
|
|
3193
|
+
/** Returns the largest value for the given value type (exclusive). */ function Ae(t) {
|
|
3194
3194
|
return "nullValue" in t ? {
|
|
3195
3195
|
booleanValue: !1
|
|
3196
3196
|
} : "booleanValue" in t ? {
|
|
@@ -3215,7 +3215,7 @@ function we(t, e) {
|
|
|
3215
3215
|
} : "mapValue" in t ? le : q();
|
|
3216
3216
|
}
|
|
3217
3217
|
|
|
3218
|
-
function
|
|
3218
|
+
function Ne(t, e) {
|
|
3219
3219
|
var n = ve(t.value, e.value);
|
|
3220
3220
|
return 0 !== n ? n : t.inclusive && !e.inclusive ? -1 : !t.inclusive && e.inclusive ? 1 : 0;
|
|
3221
3221
|
}
|
|
@@ -3582,7 +3582,7 @@ function Fe(t) {
|
|
|
3582
3582
|
switch (s.op) {
|
|
3583
3583
|
case "<" /* LESS_THAN */ :
|
|
3584
3584
|
case "<=" /* LESS_THAN_OR_EQUAL */ :
|
|
3585
|
-
a =
|
|
3585
|
+
a = _e(s.value);
|
|
3586
3586
|
break;
|
|
3587
3587
|
|
|
3588
3588
|
case "==" /* EQUAL */ :
|
|
@@ -3600,7 +3600,7 @@ function Fe(t) {
|
|
|
3600
3600
|
a = he;
|
|
3601
3601
|
// Remaining filters cannot be used as lower bounds.
|
|
3602
3602
|
}
|
|
3603
|
-
|
|
3603
|
+
Ne({
|
|
3604
3604
|
value: r,
|
|
3605
3605
|
inclusive: i
|
|
3606
3606
|
}, {
|
|
@@ -3612,7 +3612,7 @@ function Fe(t) {
|
|
|
3612
3612
|
// range to see if we can narrow the scope.
|
|
3613
3613
|
if (null !== n) for (var l = 0; l < t.orderBy.length; ++l) if (t.orderBy[l].field.isEqual(e)) {
|
|
3614
3614
|
var h = n.position[l];
|
|
3615
|
-
|
|
3615
|
+
Ne({
|
|
3616
3616
|
value: r,
|
|
3617
3617
|
inclusive: i
|
|
3618
3618
|
}, {
|
|
@@ -3637,7 +3637,7 @@ function Fe(t) {
|
|
|
3637
3637
|
switch (s.op) {
|
|
3638
3638
|
case ">=" /* GREATER_THAN_OR_EQUAL */ :
|
|
3639
3639
|
case ">" /* GREATER_THAN */ :
|
|
3640
|
-
a =
|
|
3640
|
+
a = Ae(s.value), c = !1;
|
|
3641
3641
|
break;
|
|
3642
3642
|
|
|
3643
3643
|
case "==" /* EQUAL */ :
|
|
@@ -4113,7 +4113,7 @@ function wn(t, e, n) {
|
|
|
4113
4113
|
* Returns a value for a number that's appropriate to put into a proto.
|
|
4114
4114
|
* The return value is an IntegerValue if it can safely represent the value,
|
|
4115
4115
|
* otherwise a DoubleValue is returned.
|
|
4116
|
-
*/ function
|
|
4116
|
+
*/ function Tn(t, e) {
|
|
4117
4117
|
return ce(e) ? In(e) : bn(t, e);
|
|
4118
4118
|
}
|
|
4119
4119
|
|
|
@@ -4133,7 +4133,7 @@ function wn(t, e, n) {
|
|
|
4133
4133
|
* See the License for the specific language governing permissions and
|
|
4134
4134
|
* limitations under the License.
|
|
4135
4135
|
*/
|
|
4136
|
-
/** Used to represent a field transform on a mutation. */ var
|
|
4136
|
+
/** Used to represent a field transform on a mutation. */ var En = function() {
|
|
4137
4137
|
// Make sure that the structural type of `TransformOperation` is unique.
|
|
4138
4138
|
// See https://github.com/microsoft/TypeScript/issues/5451
|
|
4139
4139
|
this._ = void 0;
|
|
@@ -4143,7 +4143,7 @@ function wn(t, e, n) {
|
|
|
4143
4143
|
* Computes the local transform result against the provided `previousValue`,
|
|
4144
4144
|
* optionally using the provided localWriteTime.
|
|
4145
4145
|
*/ function Sn(t, e, n) {
|
|
4146
|
-
return t instanceof
|
|
4146
|
+
return t instanceof _n ? function(t, e) {
|
|
4147
4147
|
var n = {
|
|
4148
4148
|
fields: {
|
|
4149
4149
|
__type__: {
|
|
@@ -4160,11 +4160,11 @@ function wn(t, e, n) {
|
|
|
4160
4160
|
return e && (n.fields.__previous_value__ = e), {
|
|
4161
4161
|
mapValue: n
|
|
4162
4162
|
};
|
|
4163
|
-
}(n, e) : t instanceof
|
|
4163
|
+
}(n, e) : t instanceof An ? Nn(t, e) : t instanceof Cn ? kn(t, e) : function(t, e) {
|
|
4164
4164
|
// PORTING NOTE: Since JavaScript's integer arithmetic is limited to 53 bit
|
|
4165
4165
|
// precision and resolves overflows by reducing precision, we do not
|
|
4166
4166
|
// manually cap overflows at 2^63.
|
|
4167
|
-
var n =
|
|
4167
|
+
var n = xn(t, e), r = Rn(n) + Rn(t.yt);
|
|
4168
4168
|
return be(n) && be(t.yt) ? In(r) : bn(t.It, r);
|
|
4169
4169
|
}(t, e);
|
|
4170
4170
|
}
|
|
@@ -4176,7 +4176,7 @@ function wn(t, e, n) {
|
|
|
4176
4176
|
// The server just sends null as the transform result for array operations,
|
|
4177
4177
|
// so we have to calculate a result the same as we do for local
|
|
4178
4178
|
// applications.
|
|
4179
|
-
return t instanceof
|
|
4179
|
+
return t instanceof An ? Nn(t, e) : t instanceof Cn ? kn(t, e) : n;
|
|
4180
4180
|
}
|
|
4181
4181
|
|
|
4182
4182
|
/**
|
|
@@ -4193,7 +4193,7 @@ function wn(t, e, n) {
|
|
|
4193
4193
|
*
|
|
4194
4194
|
* @returns a base value to store along with the mutation, or null for
|
|
4195
4195
|
* idempotent transforms.
|
|
4196
|
-
*/ function
|
|
4196
|
+
*/ function xn(t, e) {
|
|
4197
4197
|
return t instanceof On ? be(n = e) || function(t) {
|
|
4198
4198
|
return !!t && "doubleValue" in t;
|
|
4199
4199
|
}(n) ? e : {
|
|
@@ -4202,20 +4202,20 @@ function wn(t, e, n) {
|
|
|
4202
4202
|
var n;
|
|
4203
4203
|
}
|
|
4204
4204
|
|
|
4205
|
-
/** Transforms a value into a server-generated timestamp. */ var
|
|
4205
|
+
/** Transforms a value into a server-generated timestamp. */ var _n = /** @class */ function(e) {
|
|
4206
4206
|
function n() {
|
|
4207
4207
|
return null !== e && e.apply(this, arguments) || this;
|
|
4208
4208
|
}
|
|
4209
4209
|
return t(n, e), n;
|
|
4210
|
-
}(
|
|
4210
|
+
}(En), An = /** @class */ function(e) {
|
|
4211
4211
|
function n(t) {
|
|
4212
4212
|
var n = this;
|
|
4213
4213
|
return (n = e.call(this) || this).elements = t, n;
|
|
4214
4214
|
}
|
|
4215
4215
|
return t(n, e), n;
|
|
4216
|
-
}(
|
|
4216
|
+
}(En);
|
|
4217
4217
|
|
|
4218
|
-
/** Transforms an array value via a union operation. */ function
|
|
4218
|
+
/** Transforms an array value via a union operation. */ function Nn(t, e) {
|
|
4219
4219
|
for (var n = Vn(e), r = function(t) {
|
|
4220
4220
|
n.some((function(e) {
|
|
4221
4221
|
return de(e, t);
|
|
@@ -4236,7 +4236,7 @@ function wn(t, e, n) {
|
|
|
4236
4236
|
return (n = e.call(this) || this).elements = t, n;
|
|
4237
4237
|
}
|
|
4238
4238
|
return t(n, e), n;
|
|
4239
|
-
}(
|
|
4239
|
+
}(En);
|
|
4240
4240
|
|
|
4241
4241
|
function kn(t, e) {
|
|
4242
4242
|
for (var n = Vn(e), r = function(t) {
|
|
@@ -4264,7 +4264,7 @@ function kn(t, e) {
|
|
|
4264
4264
|
return (r = e.call(this) || this).It = t, r.yt = n, r;
|
|
4265
4265
|
}
|
|
4266
4266
|
return t(n, e), n;
|
|
4267
|
-
}(
|
|
4267
|
+
}(En);
|
|
4268
4268
|
|
|
4269
4269
|
function Rn(t) {
|
|
4270
4270
|
return te(t.integerValue || t.doubleValue);
|
|
@@ -4506,7 +4506,7 @@ e) {
|
|
|
4506
4506
|
* idempotent mutations.
|
|
4507
4507
|
*/ function Kn(t, e) {
|
|
4508
4508
|
for (var n = null, r = 0, i = t.fieldTransforms; r < i.length; r++) {
|
|
4509
|
-
var o = i[r], u = e.data.field(o.field), s =
|
|
4509
|
+
var o = i[r], u = e.data.field(o.field), s = xn(o.transform, u || null);
|
|
4510
4510
|
null != s && (null === n && (n = ke.empty()), n.set(o.field, s));
|
|
4511
4511
|
}
|
|
4512
4512
|
return n || null;
|
|
@@ -4517,7 +4517,7 @@ function jn(t, e) {
|
|
|
4517
4517
|
return void 0 === t && void 0 === e || !(!t || !e) && it(t, e, (function(t, e) {
|
|
4518
4518
|
return function(t, e) {
|
|
4519
4519
|
return t.field.isEqual(e.field) && function(t, e) {
|
|
4520
|
-
return t instanceof
|
|
4520
|
+
return t instanceof An && e instanceof An || t instanceof Cn && e instanceof Cn ? it(t.elements, e.elements, de) : t instanceof On && e instanceof On ? de(t.yt, e.yt) : t instanceof _n && e instanceof _n;
|
|
4521
4521
|
}(t.transform, e.transform);
|
|
4522
4522
|
}(t, e);
|
|
4523
4523
|
}));
|
|
@@ -5031,7 +5031,7 @@ n
|
|
|
5031
5031
|
/** An RPC error indicating why the watch failed. */ , r) {
|
|
5032
5032
|
void 0 === n && (n = Zt.EMPTY_BYTE_STRING), void 0 === r && (r = null), this.state = t,
|
|
5033
5033
|
this.targetIds = e, this.resumeToken = n, this.cause = r;
|
|
5034
|
-
},
|
|
5034
|
+
}, Tr = /** @class */ function() {
|
|
5035
5035
|
function t() {
|
|
5036
5036
|
/**
|
|
5037
5037
|
* The number of pending responses (adds or removes) that we are waiting on.
|
|
@@ -5137,7 +5137,7 @@ n
|
|
|
5137
5137
|
}, t.prototype.$t = function() {
|
|
5138
5138
|
this.Vt = !0, this.vt = !0;
|
|
5139
5139
|
}, t;
|
|
5140
|
-
}(),
|
|
5140
|
+
}(), Er = /** @class */ function() {
|
|
5141
5141
|
function t(t) {
|
|
5142
5142
|
this.Bt = t,
|
|
5143
5143
|
/** The internal state of all tracked targets. */
|
|
@@ -5333,7 +5333,7 @@ n
|
|
|
5333
5333
|
this.zt(t).Mt();
|
|
5334
5334
|
}, t.prototype.zt = function(t) {
|
|
5335
5335
|
var e = this.Lt.get(t);
|
|
5336
|
-
return e || (e = new
|
|
5336
|
+
return e || (e = new Tr, this.Lt.set(t, e)), e;
|
|
5337
5337
|
}, t.prototype.ne = function(t) {
|
|
5338
5338
|
var e = this.qt.get(t);
|
|
5339
5339
|
return e || (e = new zt(rt), this.qt = this.qt.insert(t, e)), e;
|
|
@@ -5362,7 +5362,7 @@ n
|
|
|
5362
5362
|
*/
|
|
5363
5363
|
t.prototype.Jt = function(t) {
|
|
5364
5364
|
var e = this;
|
|
5365
|
-
this.Lt.set(t, new
|
|
5365
|
+
this.Lt.set(t, new Tr), this.Bt.getRemoteKeysForTarget(t).forEach((function(n) {
|
|
5366
5366
|
e.jt(t, n, /*updatedDocument=*/ null);
|
|
5367
5367
|
}));
|
|
5368
5368
|
},
|
|
@@ -5405,10 +5405,10 @@ function Dr() {
|
|
|
5405
5405
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5406
5406
|
* See the License for the specific language governing permissions and
|
|
5407
5407
|
* limitations under the License.
|
|
5408
|
-
*/ var
|
|
5408
|
+
*/ var xr = {
|
|
5409
5409
|
asc: "ASCENDING",
|
|
5410
5410
|
desc: "DESCENDING"
|
|
5411
|
-
},
|
|
5411
|
+
}, _r = {
|
|
5412
5412
|
"<": "LESS_THAN",
|
|
5413
5413
|
"<=": "LESS_THAN_OR_EQUAL",
|
|
5414
5414
|
">": "GREATER_THAN",
|
|
@@ -5419,7 +5419,7 @@ function Dr() {
|
|
|
5419
5419
|
in: "IN",
|
|
5420
5420
|
"not-in": "NOT_IN",
|
|
5421
5421
|
"array-contains-any": "ARRAY_CONTAINS_ANY"
|
|
5422
|
-
},
|
|
5422
|
+
}, Ar = function(t, e) {
|
|
5423
5423
|
this.databaseId = t, this.gt = e;
|
|
5424
5424
|
};
|
|
5425
5425
|
|
|
@@ -5440,7 +5440,7 @@ function Dr() {
|
|
|
5440
5440
|
/**
|
|
5441
5441
|
* Returns a value for a Date that's appropriate to put into a proto.
|
|
5442
5442
|
*/
|
|
5443
|
-
function
|
|
5443
|
+
function Nr(t, e) {
|
|
5444
5444
|
return t.gt ? new Date(1e3 * e.seconds).toISOString().replace(/\.\d*/, "").replace("Z", "") + "." + ("000000000" + e.nanoseconds).slice(-9) + "Z" : {
|
|
5445
5445
|
seconds: "" + e.seconds,
|
|
5446
5446
|
nanos: e.nanoseconds
|
|
@@ -5458,7 +5458,7 @@ function Ar(t, e) {
|
|
|
5458
5458
|
/**
|
|
5459
5459
|
* Returns a ByteString based on the proto string value.
|
|
5460
5460
|
*/ function kr(t, e) {
|
|
5461
|
-
return
|
|
5461
|
+
return Nr(t, e.toTimestamp());
|
|
5462
5462
|
}
|
|
5463
5463
|
|
|
5464
5464
|
function Or(t) {
|
|
@@ -5546,11 +5546,11 @@ function Kr(t, e) {
|
|
|
5546
5546
|
return e.fieldTransforms.length > 0 && (n.updateTransforms = e.fieldTransforms.map((function(t) {
|
|
5547
5547
|
return function(t, e) {
|
|
5548
5548
|
var n = e.transform;
|
|
5549
|
-
if (n instanceof
|
|
5549
|
+
if (n instanceof _n) return {
|
|
5550
5550
|
fieldPath: e.field.canonicalString(),
|
|
5551
5551
|
setToServerValue: "REQUEST_TIME"
|
|
5552
5552
|
};
|
|
5553
|
-
if (n instanceof
|
|
5553
|
+
if (n instanceof An) return {
|
|
5554
5554
|
fieldPath: e.field.canonicalString(),
|
|
5555
5555
|
appendMissingElements: {
|
|
5556
5556
|
values: n.elements
|
|
@@ -5583,9 +5583,9 @@ function jr(t, e) {
|
|
|
5583
5583
|
}(e.currentDocument) : Pn.none(), r = e.updateTransforms ? e.updateTransforms.map((function(e) {
|
|
5584
5584
|
return function(t, e) {
|
|
5585
5585
|
var n = null;
|
|
5586
|
-
if ("setToServerValue" in e) U("REQUEST_TIME" === e.setToServerValue), n = new
|
|
5586
|
+
if ("setToServerValue" in e) U("REQUEST_TIME" === e.setToServerValue), n = new _n; else if ("appendMissingElements" in e) {
|
|
5587
5587
|
var r = e.appendMissingElements.values || [];
|
|
5588
|
-
n = new
|
|
5588
|
+
n = new An(r);
|
|
5589
5589
|
} else if ("removeAllFromArray" in e) {
|
|
5590
5590
|
var i = e.removeAllFromArray.values || [];
|
|
5591
5591
|
n = new Cn(i);
|
|
@@ -5646,26 +5646,26 @@ function zr(t, e) {
|
|
|
5646
5646
|
// visible for testing
|
|
5647
5647
|
return function(t) {
|
|
5648
5648
|
if ("==" /* EQUAL */ === t.op) {
|
|
5649
|
-
if (
|
|
5649
|
+
if (Ee(t.value)) return {
|
|
5650
5650
|
unaryFilter: {
|
|
5651
5651
|
field: Zr(t.field),
|
|
5652
5652
|
op: "IS_NAN"
|
|
5653
5653
|
}
|
|
5654
5654
|
};
|
|
5655
|
-
if (
|
|
5655
|
+
if (Te(t.value)) return {
|
|
5656
5656
|
unaryFilter: {
|
|
5657
5657
|
field: Zr(t.field),
|
|
5658
5658
|
op: "IS_NULL"
|
|
5659
5659
|
}
|
|
5660
5660
|
};
|
|
5661
5661
|
} else if ("!=" /* NOT_EQUAL */ === t.op) {
|
|
5662
|
-
if (
|
|
5662
|
+
if (Ee(t.value)) return {
|
|
5663
5663
|
unaryFilter: {
|
|
5664
5664
|
field: Zr(t.field),
|
|
5665
5665
|
op: "IS_NOT_NAN"
|
|
5666
5666
|
}
|
|
5667
5667
|
};
|
|
5668
|
-
if (
|
|
5668
|
+
if (Te(t.value)) return {
|
|
5669
5669
|
unaryFilter: {
|
|
5670
5670
|
field: Zr(t.field),
|
|
5671
5671
|
op: "IS_NOT_NULL"
|
|
@@ -5772,11 +5772,11 @@ function Hr(t) {
|
|
|
5772
5772
|
}
|
|
5773
5773
|
|
|
5774
5774
|
function Yr(t) {
|
|
5775
|
-
return
|
|
5775
|
+
return xr[t];
|
|
5776
5776
|
}
|
|
5777
5777
|
|
|
5778
5778
|
function Xr(t) {
|
|
5779
|
-
return
|
|
5779
|
+
return _r[t];
|
|
5780
5780
|
}
|
|
5781
5781
|
|
|
5782
5782
|
function Zr(t) {
|
|
@@ -6020,7 +6020,7 @@ function ni(t) {
|
|
|
6020
6020
|
* there is no useful information to store as the value. The raw (unencoded)
|
|
6021
6021
|
* path cannot be stored because IndexedDb doesn't store prototype
|
|
6022
6022
|
* information.
|
|
6023
|
-
*/ var li = {}, hi = [ "prefixPath", "collectionGroup", "readTime", "documentId" ], fi = [ "prefixPath", "collectionGroup", "documentId" ], di = [ "collectionGroup", "readTime", "prefixPath", "documentId" ], pi = [ "canonicalId", "targetId" ], vi = [ "targetId", "path" ], yi = [ "path", "targetId" ], mi = [ "collectionId", "parent" ], gi = [ "indexId", "uid" ], wi = [ "uid", "sequenceNumber" ], bi = [ "indexId", "uid", "arrayValue", "directionalValue", "orderedDocumentKey", "documentKey" ], Ii = [ "indexId", "uid", "orderedDocumentKey" ],
|
|
6023
|
+
*/ var li = {}, hi = [ "prefixPath", "collectionGroup", "readTime", "documentId" ], fi = [ "prefixPath", "collectionGroup", "documentId" ], di = [ "collectionGroup", "readTime", "prefixPath", "documentId" ], pi = [ "canonicalId", "targetId" ], vi = [ "targetId", "path" ], yi = [ "path", "targetId" ], mi = [ "collectionId", "parent" ], gi = [ "indexId", "uid" ], wi = [ "uid", "sequenceNumber" ], bi = [ "indexId", "uid", "arrayValue", "directionalValue", "orderedDocumentKey", "documentKey" ], Ii = [ "indexId", "uid", "orderedDocumentKey" ], Ti = [ "userId", "collectionPath", "documentId" ], Ei = [ "userId", "collectionPath", "largestBatchId" ], Si = [ "userId", "collectionGroup", "largestBatchId" ], Di = r(r([], r(r([], r(r([], r(r([], [ "mutationQueues", "mutations", "documentMutations", "remoteDocuments", "targets", "owner", "targetGlobal", "targetDocuments" ]), [ "clientMetadata" ])), [ "remoteDocumentGlobal" ])), [ "collectionParents" ])), [ "bundles", "namedQueries" ]), xi = r(r([], Di), [ "documentOverlays" ]), _i = [ "mutationQueues", "mutations", "documentMutations", "remoteDocumentsV14", "targets", "owner", "targetGlobal", "targetDocuments", "clientMetadata", "remoteDocumentGlobal", "collectionParents", "bundles", "namedQueries", "documentOverlays" ], Ai = _i, Ni = r(r([], Ai), [ "indexConfiguration", "indexState", "indexEntries" ]), Ci = /** @class */ function(e) {
|
|
6024
6024
|
function n(t, n) {
|
|
6025
6025
|
var r = this;
|
|
6026
6026
|
return (r = e.call(this) || this).ie = t, r.currentSequenceNumber = n, r;
|
|
@@ -6045,7 +6045,7 @@ function ni(t) {
|
|
|
6045
6045
|
* limitations under the License.
|
|
6046
6046
|
*/ function ki(t, e) {
|
|
6047
6047
|
var n = G(t);
|
|
6048
|
-
return
|
|
6048
|
+
return Nt.M(n.ie, e);
|
|
6049
6049
|
}
|
|
6050
6050
|
|
|
6051
6051
|
/**
|
|
@@ -6244,7 +6244,7 @@ function ni(t) {
|
|
|
6244
6244
|
return {
|
|
6245
6245
|
name: Lr(t, e.key),
|
|
6246
6246
|
fields: e.data.value.mapValue.fields,
|
|
6247
|
-
updateTime:
|
|
6247
|
+
updateTime: Nr(t, e.version.toTimestamp())
|
|
6248
6248
|
};
|
|
6249
6249
|
}(t.re, e); else if (e.isNoDocument()) r.noDocument = {
|
|
6250
6250
|
path: n.path.toArray(),
|
|
@@ -6468,7 +6468,7 @@ function Wi(t, e, n, r) {
|
|
|
6468
6468
|
}));
|
|
6469
6469
|
}, t.prototype.getOverlays = function(t, e) {
|
|
6470
6470
|
var n = this, r = cr();
|
|
6471
|
-
return
|
|
6471
|
+
return _t.forEach(e, (function(e) {
|
|
6472
6472
|
return n.getOverlay(t, e).next((function(t) {
|
|
6473
6473
|
null !== t && r.set(e, t);
|
|
6474
6474
|
}));
|
|
@@ -6480,7 +6480,7 @@ function Wi(t, e, n, r) {
|
|
|
6480
6480
|
return n.forEach((function(n, o) {
|
|
6481
6481
|
var u = new Vi(e, o);
|
|
6482
6482
|
i.push(r.ue(t, u));
|
|
6483
|
-
})),
|
|
6483
|
+
})), _t.waitFor(i);
|
|
6484
6484
|
}, t.prototype.removeOverlaysForBatchId = function(t, e, n) {
|
|
6485
6485
|
var r = this, i = new Set;
|
|
6486
6486
|
// Get the set of unique collection paths.
|
|
@@ -6493,7 +6493,7 @@ function Wi(t, e, n, r) {
|
|
|
6493
6493
|
/*lowerOpen=*/ !1,
|
|
6494
6494
|
/*upperOpen=*/ !0);
|
|
6495
6495
|
o.push(Ji(t).Y("collectionPathOverlayIndex", i));
|
|
6496
|
-
})),
|
|
6496
|
+
})), _t.waitFor(o);
|
|
6497
6497
|
}, t.prototype.getOverlaysForCollection = function(t, e, n) {
|
|
6498
6498
|
var r = this, i = cr(), o = ri(e), u = IDBKeyRange.bound([ this.userId, o, n ], [ this.userId, o, Number.POSITIVE_INFINITY ],
|
|
6499
6499
|
/*lowerOpen=*/ !0);
|
|
@@ -6587,7 +6587,7 @@ function Wi(t, e, n, r) {
|
|
|
6587
6587
|
e.me(ee(t.bytesValue)), this.we(e); else if ("referenceValue" in t) this.ge(t.referenceValue, e); else if ("geoPointValue" in t) {
|
|
6588
6588
|
var i = t.geoPointValue;
|
|
6589
6589
|
this.le(e, 45), e.fe(i.latitude || 0), e.fe(i.longitude || 0);
|
|
6590
|
-
} else "mapValue" in t ?
|
|
6590
|
+
} else "mapValue" in t ? xe(t) ? this.le(e, Number.MAX_SAFE_INTEGER) : (this.ye(t.mapValue, e),
|
|
6591
6591
|
this.we(e)) : "arrayValue" in t ? (this.pe(t.arrayValue, e), this.we(e)) : q();
|
|
6592
6592
|
}, t.prototype._e = function(t, e) {
|
|
6593
6593
|
this.le(e, 25), this.Ie(t, e);
|
|
@@ -6960,37 +6960,37 @@ function ao(t, e) {
|
|
|
6960
6960
|
this.Ye = new ho;
|
|
6961
6961
|
}
|
|
6962
6962
|
return t.prototype.addToCollectionParentIndex = function(t, e) {
|
|
6963
|
-
return this.Ye.add(e),
|
|
6963
|
+
return this.Ye.add(e), _t.resolve();
|
|
6964
6964
|
}, t.prototype.getCollectionParents = function(t, e) {
|
|
6965
|
-
return
|
|
6965
|
+
return _t.resolve(this.Ye.getEntries(e));
|
|
6966
6966
|
}, t.prototype.addFieldIndex = function(t, e) {
|
|
6967
6967
|
// Field indices are not supported with memory persistence.
|
|
6968
|
-
return
|
|
6968
|
+
return _t.resolve();
|
|
6969
6969
|
}, t.prototype.deleteFieldIndex = function(t, e) {
|
|
6970
6970
|
// Field indices are not supported with memory persistence.
|
|
6971
|
-
return
|
|
6971
|
+
return _t.resolve();
|
|
6972
6972
|
}, t.prototype.getDocumentsMatchingTarget = function(t, e) {
|
|
6973
6973
|
// Field indices are not supported with memory persistence.
|
|
6974
|
-
return
|
|
6974
|
+
return _t.resolve(null);
|
|
6975
6975
|
}, t.prototype.getIndexType = function(t, e) {
|
|
6976
6976
|
// Field indices are not supported with memory persistence.
|
|
6977
|
-
return
|
|
6977
|
+
return _t.resolve(0 /* NONE */);
|
|
6978
6978
|
}, t.prototype.getFieldIndexes = function(t, e) {
|
|
6979
6979
|
// Field indices are not supported with memory persistence.
|
|
6980
|
-
return
|
|
6980
|
+
return _t.resolve([]);
|
|
6981
6981
|
}, t.prototype.getNextCollectionGroupToUpdate = function(t) {
|
|
6982
6982
|
// Field indices are not supported with memory persistence.
|
|
6983
|
-
return
|
|
6983
|
+
return _t.resolve(null);
|
|
6984
6984
|
}, t.prototype.getMinOffset = function(t, e) {
|
|
6985
|
-
return
|
|
6985
|
+
return _t.resolve(Tt.min());
|
|
6986
6986
|
}, t.prototype.getMinOffsetFromCollectionGroup = function(t, e) {
|
|
6987
|
-
return
|
|
6987
|
+
return _t.resolve(Tt.min());
|
|
6988
6988
|
}, t.prototype.updateCollectionGroup = function(t, e, n) {
|
|
6989
6989
|
// Field indices are not supported with memory persistence.
|
|
6990
|
-
return
|
|
6990
|
+
return _t.resolve();
|
|
6991
6991
|
}, t.prototype.updateIndexEntries = function(t, e) {
|
|
6992
6992
|
// Field indices are not supported with memory persistence.
|
|
6993
|
-
return
|
|
6993
|
+
return _t.resolve();
|
|
6994
6994
|
}, t;
|
|
6995
6995
|
}(), ho = /** @class */ function() {
|
|
6996
6996
|
function t() {
|
|
@@ -7049,7 +7049,7 @@ function ao(t, e) {
|
|
|
7049
7049
|
};
|
|
7050
7050
|
return vo(t).put(o);
|
|
7051
7051
|
}
|
|
7052
|
-
return
|
|
7052
|
+
return _t.resolve();
|
|
7053
7053
|
}, t.prototype.getCollectionParents = function(t, e) {
|
|
7054
7054
|
var n = [], r = IDBKeyRange.bound([ e, "" ], [ ot(e), "" ],
|
|
7055
7055
|
/*lowerOpen=*/ !1,
|
|
@@ -7101,14 +7101,14 @@ function ao(t, e) {
|
|
|
7101
7101
|
}));
|
|
7102
7102
|
}, t.prototype.getDocumentsMatchingTarget = function(t, e) {
|
|
7103
7103
|
var n = this, r = yo(t), i = !0, o = new Map;
|
|
7104
|
-
return
|
|
7104
|
+
return _t.forEach(this.tn(e), (function(e) {
|
|
7105
7105
|
return n.en(t, e).next((function(t) {
|
|
7106
7106
|
i && (i = !!t), o.set(e, t);
|
|
7107
7107
|
}));
|
|
7108
7108
|
})).next((function() {
|
|
7109
7109
|
if (i) {
|
|
7110
7110
|
var t = pr(), u = [];
|
|
7111
|
-
return
|
|
7111
|
+
return _t.forEach(o, (function(i, o) {
|
|
7112
7112
|
var s;
|
|
7113
7113
|
L("IndexedDbIndexManager", "Using index " + ("id=" + (s = i).indexId + "|cg=" + s.collectionGroup + "|f=" + s.fields.map((function(t) {
|
|
7114
7114
|
return t.fieldPath + ":" + t.kind;
|
|
@@ -7166,7 +7166,7 @@ function ao(t, e) {
|
|
|
7166
7166
|
}
|
|
7167
7167
|
return new Ze(n, r);
|
|
7168
7168
|
}(o, i), f = n.nn(i, o, l), d = n.nn(i, o, h), p = n.sn(i, o, c), v = n.rn(i.indexId, a, f, l.inclusive, d, h.inclusive, p);
|
|
7169
|
-
return
|
|
7169
|
+
return _t.forEach(v, (function(n) {
|
|
7170
7170
|
return r.J(n, e.limit).next((function(e) {
|
|
7171
7171
|
e.forEach((function(e) {
|
|
7172
7172
|
var n = ft.fromSegments(e.documentKey);
|
|
@@ -7178,7 +7178,7 @@ function ao(t, e) {
|
|
|
7178
7178
|
return u;
|
|
7179
7179
|
}));
|
|
7180
7180
|
}
|
|
7181
|
-
return
|
|
7181
|
+
return _t.resolve(null);
|
|
7182
7182
|
}));
|
|
7183
7183
|
}, t.prototype.tn = function(t) {
|
|
7184
7184
|
var e = this.Ze.get(t);
|
|
@@ -7225,7 +7225,7 @@ function ao(t, e) {
|
|
|
7225
7225
|
}));
|
|
7226
7226
|
}, t.prototype.getIndexType = function(t, e) {
|
|
7227
7227
|
var n = this, r = 2 /* FULL */;
|
|
7228
|
-
return
|
|
7228
|
+
return _t.forEach(this.tn(e), (function(e) {
|
|
7229
7229
|
return n.en(t, e).next((function(t) {
|
|
7230
7230
|
t ? 0 /* NONE */ !== r && t.fields.length < function(t) {
|
|
7231
7231
|
for (var e = new zt(ht.comparator), n = !1, r = 0, i = t.filters; r < i.length; r++) {
|
|
@@ -7331,10 +7331,10 @@ function ao(t, e) {
|
|
|
7331
7331
|
var n = this, r = mo(t), i = go(t);
|
|
7332
7332
|
return (e ? r.W("collectionGroupIndex", IDBKeyRange.bound(e, e)) : r.W()).next((function(t) {
|
|
7333
7333
|
var e = [];
|
|
7334
|
-
return
|
|
7334
|
+
return _t.forEach(t, (function(t) {
|
|
7335
7335
|
return i.get([ t.indexId, n.uid ]).next((function(n) {
|
|
7336
7336
|
e.push(function(t, e) {
|
|
7337
|
-
var n = e ? new wt(e.sequenceNumber, new
|
|
7337
|
+
var n = e ? new wt(e.sequenceNumber, new Tt(Ui(e.readTime), new ft(ui(e.documentKey)), e.largestBatchId)) : wt.empty(), r = t.fields.map((function(t) {
|
|
7338
7338
|
var e = t[0], n = t[1];
|
|
7339
7339
|
return new mt(ht.fromServerFormat(e), n);
|
|
7340
7340
|
}));
|
|
@@ -7356,7 +7356,7 @@ function ao(t, e) {
|
|
|
7356
7356
|
var r = this, i = mo(t), o = go(t);
|
|
7357
7357
|
return this._n(t).next((function(t) {
|
|
7358
7358
|
return i.W("collectionGroupIndex", IDBKeyRange.bound(e, e)).next((function(e) {
|
|
7359
|
-
return
|
|
7359
|
+
return _t.forEach(e, (function(e) {
|
|
7360
7360
|
return o.put(Wi(e.indexId, r.user, t, n));
|
|
7361
7361
|
}));
|
|
7362
7362
|
}));
|
|
@@ -7368,13 +7368,13 @@ function ao(t, e) {
|
|
|
7368
7368
|
// data might be invalidated by other multi-tab clients, we can only trust
|
|
7369
7369
|
// data within a single IndexedDB transaction. We therefore add a cache
|
|
7370
7370
|
// here.
|
|
7371
|
-
return
|
|
7371
|
+
return _t.forEach(e, (function(e, i) {
|
|
7372
7372
|
var o = r.get(e.collectionGroup);
|
|
7373
|
-
return (o ?
|
|
7374
|
-
return r.set(e.collectionGroup, o),
|
|
7373
|
+
return (o ? _t.resolve(o) : n.getFieldIndexes(t, e.collectionGroup)).next((function(o) {
|
|
7374
|
+
return r.set(e.collectionGroup, o), _t.forEach(o, (function(r) {
|
|
7375
7375
|
return n.wn(t, e, r).next((function(e) {
|
|
7376
7376
|
var o = n.mn(i, r);
|
|
7377
|
-
return e.isEqual(o) ?
|
|
7377
|
+
return e.isEqual(o) ? _t.resolve() : n.gn(t, i, r, e, o);
|
|
7378
7378
|
}));
|
|
7379
7379
|
}));
|
|
7380
7380
|
}));
|
|
@@ -7446,7 +7446,7 @@ function ao(t, e) {
|
|
|
7446
7446
|
}), (
|
|
7447
7447
|
/* onRemove= */ function(r) {
|
|
7448
7448
|
u.push(o.pn(t, e, n, r));
|
|
7449
|
-
})),
|
|
7449
|
+
})), _t.waitFor(u);
|
|
7450
7450
|
}, t.prototype._n = function(t) {
|
|
7451
7451
|
var e = 1;
|
|
7452
7452
|
return go(t).Z({
|
|
@@ -7492,7 +7492,7 @@ function ao(t, e) {
|
|
|
7492
7492
|
return this.getFieldIndexes(t, e).next(wo);
|
|
7493
7493
|
}, t.prototype.getMinOffset = function(t, e) {
|
|
7494
7494
|
var n = this;
|
|
7495
|
-
return
|
|
7495
|
+
return _t.mapArray(this.tn(e), (function(e) {
|
|
7496
7496
|
return n.en(t, e).next((function(t) {
|
|
7497
7497
|
return t || q();
|
|
7498
7498
|
}));
|
|
@@ -7549,9 +7549,9 @@ function wo(t) {
|
|
|
7549
7549
|
U(0 !== t.length);
|
|
7550
7550
|
for (var e = t[0].indexState.offset, n = e.largestBatchId, r = 1; r < t.length; r++) {
|
|
7551
7551
|
var i = t[r].indexState.offset;
|
|
7552
|
-
|
|
7552
|
+
Et(i, e) < 0 && (e = i), n < i.largestBatchId && (n = i.largestBatchId);
|
|
7553
7553
|
}
|
|
7554
|
-
return new
|
|
7554
|
+
return new Tt(e.readTime, e.documentKey, n);
|
|
7555
7555
|
}
|
|
7556
7556
|
|
|
7557
7557
|
/**
|
|
@@ -7611,7 +7611,7 @@ function wo(t) {
|
|
|
7611
7611
|
* Delete a mutation batch and the associated document mutations.
|
|
7612
7612
|
* @returns A PersistencePromise of the document mutations that were removed.
|
|
7613
7613
|
*/
|
|
7614
|
-
function
|
|
7614
|
+
function To(t, e, n) {
|
|
7615
7615
|
var r = t.store("mutations"), i = t.store("documentMutations"), o = [], u = IDBKeyRange.only(n.batchId), s = 0, a = r.Z({
|
|
7616
7616
|
range: u
|
|
7617
7617
|
}, (function(t, e, n) {
|
|
@@ -7624,14 +7624,14 @@ function Eo(t, e, n) {
|
|
|
7624
7624
|
var f = h[l], d = ci(e, f.key.path, n.batchId);
|
|
7625
7625
|
o.push(i.delete(d)), c.push(f.key);
|
|
7626
7626
|
}
|
|
7627
|
-
return
|
|
7627
|
+
return _t.waitFor(o).next((function() {
|
|
7628
7628
|
return c;
|
|
7629
7629
|
}));
|
|
7630
7630
|
}
|
|
7631
7631
|
|
|
7632
7632
|
/**
|
|
7633
7633
|
* Returns an approximate size for the given document.
|
|
7634
|
-
*/ function
|
|
7634
|
+
*/ function Eo(t) {
|
|
7635
7635
|
if (!t) return 0;
|
|
7636
7636
|
var e;
|
|
7637
7637
|
if (t.document) e = t.document; else if (t.unknownDocument) e = t.unknownDocument; else {
|
|
@@ -7696,7 +7696,7 @@ var So = /** @class */ function() {
|
|
|
7696
7696
|
return U("" !== e.uid), new t(e.isAuthenticated() ? e.uid : "", n, r, i);
|
|
7697
7697
|
}, t.prototype.checkEmpty = function(t) {
|
|
7698
7698
|
var e = !0, n = IDBKeyRange.bound([ this.userId, Number.NEGATIVE_INFINITY ], [ this.userId, Number.POSITIVE_INFINITY ]);
|
|
7699
|
-
return
|
|
7699
|
+
return xo(t).Z({
|
|
7700
7700
|
index: "userMutationsIndex",
|
|
7701
7701
|
range: n
|
|
7702
7702
|
}, (function(t, n, r) {
|
|
@@ -7705,7 +7705,7 @@ var So = /** @class */ function() {
|
|
|
7705
7705
|
return e;
|
|
7706
7706
|
}));
|
|
7707
7707
|
}, t.prototype.addMutationBatch = function(t, e, n, r) {
|
|
7708
|
-
var i = this, o =
|
|
7708
|
+
var i = this, o = _o(t), u = xo(t);
|
|
7709
7709
|
// The IndexedDb implementation in Chrome (and Firefox) does not handle
|
|
7710
7710
|
// compound indices that include auto-generated keys correctly. To ensure
|
|
7711
7711
|
// that the index entry is added correctly in all browsers, we perform two
|
|
@@ -7740,13 +7740,13 @@ var So = /** @class */ function() {
|
|
|
7740
7740
|
l.push(i.indexManager.addToCollectionParentIndex(t, e));
|
|
7741
7741
|
})), t.addOnCommittedListener((function() {
|
|
7742
7742
|
i.In[s] = a.keys();
|
|
7743
|
-
})),
|
|
7743
|
+
})), _t.waitFor(l).next((function() {
|
|
7744
7744
|
return a;
|
|
7745
7745
|
}));
|
|
7746
7746
|
}));
|
|
7747
7747
|
}, t.prototype.lookupMutationBatch = function(t, e) {
|
|
7748
7748
|
var n = this;
|
|
7749
|
-
return
|
|
7749
|
+
return xo(t).get(e).next((function(t) {
|
|
7750
7750
|
return t ? (U(t.userId === n.userId), Bi(n.It, t)) : null;
|
|
7751
7751
|
}));
|
|
7752
7752
|
},
|
|
@@ -7759,7 +7759,7 @@ var So = /** @class */ function() {
|
|
|
7759
7759
|
// PORTING NOTE: Multi-tab only.
|
|
7760
7760
|
t.prototype.Tn = function(t, e) {
|
|
7761
7761
|
var n = this;
|
|
7762
|
-
return this.In[e] ?
|
|
7762
|
+
return this.In[e] ? _t.resolve(this.In[e]) : this.lookupMutationBatch(t, e).next((function(t) {
|
|
7763
7763
|
if (t) {
|
|
7764
7764
|
var r = t.keys();
|
|
7765
7765
|
return n.In[e] = r, r;
|
|
@@ -7768,7 +7768,7 @@ var So = /** @class */ function() {
|
|
|
7768
7768
|
}));
|
|
7769
7769
|
}, t.prototype.getNextMutationBatchAfterBatchId = function(t, e) {
|
|
7770
7770
|
var n = this, r = e + 1, i = IDBKeyRange.lowerBound([ this.userId, r ]), o = null;
|
|
7771
|
-
return
|
|
7771
|
+
return xo(t).Z({
|
|
7772
7772
|
index: "userMutationsIndex",
|
|
7773
7773
|
range: i
|
|
7774
7774
|
}, (function(t, e, i) {
|
|
@@ -7778,7 +7778,7 @@ var So = /** @class */ function() {
|
|
|
7778
7778
|
}));
|
|
7779
7779
|
}, t.prototype.getHighestUnacknowledgedBatchId = function(t) {
|
|
7780
7780
|
var e = IDBKeyRange.upperBound([ this.userId, Number.POSITIVE_INFINITY ]), n = -1;
|
|
7781
|
-
return
|
|
7781
|
+
return xo(t).Z({
|
|
7782
7782
|
index: "userMutationsIndex",
|
|
7783
7783
|
range: e,
|
|
7784
7784
|
reverse: !0
|
|
@@ -7789,7 +7789,7 @@ var So = /** @class */ function() {
|
|
|
7789
7789
|
}));
|
|
7790
7790
|
}, t.prototype.getAllMutationBatches = function(t) {
|
|
7791
7791
|
var e = this, n = IDBKeyRange.bound([ this.userId, -1 ], [ this.userId, Number.POSITIVE_INFINITY ]);
|
|
7792
|
-
return
|
|
7792
|
+
return xo(t).W("userMutationsIndex", n).next((function(t) {
|
|
7793
7793
|
return t.map((function(t) {
|
|
7794
7794
|
return Bi(e.It, t);
|
|
7795
7795
|
}));
|
|
@@ -7798,7 +7798,7 @@ var So = /** @class */ function() {
|
|
|
7798
7798
|
var n = this, r = ai(this.userId, e.path), i = IDBKeyRange.lowerBound(r), o = [];
|
|
7799
7799
|
// Scan the document-mutation index starting with a prefix starting with
|
|
7800
7800
|
// the given documentKey.
|
|
7801
|
-
return
|
|
7801
|
+
return _o(t).Z({
|
|
7802
7802
|
range: i
|
|
7803
7803
|
}, (function(r, i, u) {
|
|
7804
7804
|
var s = r[0], a = r[1], c = r[2], l = ui(a);
|
|
@@ -7811,7 +7811,7 @@ var So = /** @class */ function() {
|
|
|
7811
7811
|
// can stop as soon as we hit any such row.
|
|
7812
7812
|
if (s === n.userId && e.path.isEqual(l))
|
|
7813
7813
|
// Look up the mutation batch in the store.
|
|
7814
|
-
return
|
|
7814
|
+
return xo(t).get(c).next((function(t) {
|
|
7815
7815
|
if (!t) throw q();
|
|
7816
7816
|
U(t.userId === n.userId), o.push(Bi(n.It, t));
|
|
7817
7817
|
}));
|
|
@@ -7822,7 +7822,7 @@ var So = /** @class */ function() {
|
|
|
7822
7822
|
}, t.prototype.getAllMutationBatchesAffectingDocumentKeys = function(t, e) {
|
|
7823
7823
|
var n = this, r = new zt(rt), i = [];
|
|
7824
7824
|
return e.forEach((function(e) {
|
|
7825
|
-
var o = ai(n.userId, e.path), u = IDBKeyRange.lowerBound(o), s =
|
|
7825
|
+
var o = ai(n.userId, e.path), u = IDBKeyRange.lowerBound(o), s = _o(t).Z({
|
|
7826
7826
|
range: u
|
|
7827
7827
|
}, (function(t, i, o) {
|
|
7828
7828
|
var u = t[0], s = t[1], a = t[2], c = ui(s);
|
|
@@ -7836,12 +7836,12 @@ var So = /** @class */ function() {
|
|
|
7836
7836
|
u === n.userId && e.path.isEqual(c) ? r = r.add(a) : o.done();
|
|
7837
7837
|
}));
|
|
7838
7838
|
i.push(s);
|
|
7839
|
-
})),
|
|
7839
|
+
})), _t.waitFor(i).next((function() {
|
|
7840
7840
|
return n.En(t, r);
|
|
7841
7841
|
}));
|
|
7842
7842
|
}, t.prototype.getAllMutationBatchesAffectingQuery = function(t, e) {
|
|
7843
7843
|
var n = this, r = e.path, i = r.length + 1, o = ai(this.userId, r), u = IDBKeyRange.lowerBound(o), s = new zt(rt);
|
|
7844
|
-
return
|
|
7844
|
+
return _o(t).Z({
|
|
7845
7845
|
range: u
|
|
7846
7846
|
}, (function(t, e, o) {
|
|
7847
7847
|
var u = t[0], a = t[1], c = t[2], l = ui(a);
|
|
@@ -7859,19 +7859,19 @@ var So = /** @class */ function() {
|
|
|
7859
7859
|
var n = this, r = [], i = [];
|
|
7860
7860
|
// TODO(rockwood): Implement this using iterate.
|
|
7861
7861
|
return e.forEach((function(e) {
|
|
7862
|
-
i.push(
|
|
7862
|
+
i.push(xo(t).get(e).next((function(t) {
|
|
7863
7863
|
if (null === t) throw q();
|
|
7864
7864
|
U(t.userId === n.userId), r.push(Bi(n.It, t));
|
|
7865
7865
|
})));
|
|
7866
|
-
})),
|
|
7866
|
+
})), _t.waitFor(i).next((function() {
|
|
7867
7867
|
return r;
|
|
7868
7868
|
}));
|
|
7869
7869
|
}, t.prototype.removeMutationBatch = function(t, e) {
|
|
7870
7870
|
var n = this;
|
|
7871
|
-
return
|
|
7871
|
+
return To(t.ie, this.userId, e).next((function(r) {
|
|
7872
7872
|
return t.addOnCommittedListener((function() {
|
|
7873
7873
|
n.An(e.batchId);
|
|
7874
|
-
})),
|
|
7874
|
+
})), _t.forEach(r, (function(e) {
|
|
7875
7875
|
return n.referenceDelegate.markPotentiallyOrphaned(t, e);
|
|
7876
7876
|
}));
|
|
7877
7877
|
}));
|
|
@@ -7890,11 +7890,11 @@ var So = /** @class */ function() {
|
|
|
7890
7890
|
}, t.prototype.performConsistencyCheck = function(t) {
|
|
7891
7891
|
var e = this;
|
|
7892
7892
|
return this.checkEmpty(t).next((function(n) {
|
|
7893
|
-
if (!n) return
|
|
7893
|
+
if (!n) return _t.resolve();
|
|
7894
7894
|
// Verify that there are no entries in the documentMutations index if
|
|
7895
7895
|
// the queue is empty.
|
|
7896
7896
|
var r = IDBKeyRange.lowerBound([ e.userId ]), i = [];
|
|
7897
|
-
return
|
|
7897
|
+
return _o(t).Z({
|
|
7898
7898
|
range: r
|
|
7899
7899
|
}, (function(t, n, r) {
|
|
7900
7900
|
if (t[0] === e.userId) {
|
|
@@ -7912,7 +7912,7 @@ var So = /** @class */ function() {
|
|
|
7912
7912
|
/** Returns the mutation queue's metadata from IndexedDb. */
|
|
7913
7913
|
t.prototype.Rn = function(t) {
|
|
7914
7914
|
var e = this;
|
|
7915
|
-
return
|
|
7915
|
+
return Ao(t).get(this.userId).next((function(t) {
|
|
7916
7916
|
return t || {
|
|
7917
7917
|
userId: e.userId,
|
|
7918
7918
|
lastAcknowledgedBatchId: -1,
|
|
@@ -7927,7 +7927,7 @@ var So = /** @class */ function() {
|
|
|
7927
7927
|
* mutation for the given key.
|
|
7928
7928
|
*/ function Do(t, e, n) {
|
|
7929
7929
|
var r = ai(e, n.path), i = r[1], o = IDBKeyRange.lowerBound(r), u = !1;
|
|
7930
|
-
return
|
|
7930
|
+
return _o(t).Z({
|
|
7931
7931
|
range: o,
|
|
7932
7932
|
X: !0
|
|
7933
7933
|
}, (function(t, n, r) {
|
|
@@ -7942,19 +7942,19 @@ var So = /** @class */ function() {
|
|
|
7942
7942
|
/** Returns true if any mutation queue contains the given document. */
|
|
7943
7943
|
/**
|
|
7944
7944
|
* Helper to get a typed SimpleDbStore for the mutations object store.
|
|
7945
|
-
*/ function
|
|
7945
|
+
*/ function xo(t) {
|
|
7946
7946
|
return ki(t, "mutations");
|
|
7947
7947
|
}
|
|
7948
7948
|
|
|
7949
7949
|
/**
|
|
7950
7950
|
* Helper to get a typed SimpleDbStore for the mutationQueues object store.
|
|
7951
|
-
*/ function
|
|
7951
|
+
*/ function _o(t) {
|
|
7952
7952
|
return ki(t, "documentMutations");
|
|
7953
7953
|
}
|
|
7954
7954
|
|
|
7955
7955
|
/**
|
|
7956
7956
|
* Helper to get a typed SimpleDbStore for the mutationQueues object store.
|
|
7957
|
-
*/ function
|
|
7957
|
+
*/ function Ao(t) {
|
|
7958
7958
|
return ki(t, "mutationQueues");
|
|
7959
7959
|
}
|
|
7960
7960
|
|
|
@@ -7988,7 +7988,7 @@ var So = /** @class */ function() {
|
|
|
7988
7988
|
* that persist across client restarts, while sync engine can independently
|
|
7989
7989
|
* generate in-memory target IDs that are transient and can be reused after a
|
|
7990
7990
|
* restart.
|
|
7991
|
-
*/ var
|
|
7991
|
+
*/ var No = /** @class */ function() {
|
|
7992
7992
|
function t(t) {
|
|
7993
7993
|
this.bn = t;
|
|
7994
7994
|
}
|
|
@@ -8017,7 +8017,7 @@ var So = /** @class */ function() {
|
|
|
8017
8017
|
return t.prototype.allocateTargetId = function(t) {
|
|
8018
8018
|
var e = this;
|
|
8019
8019
|
return this.Vn(t).next((function(n) {
|
|
8020
|
-
var r = new
|
|
8020
|
+
var r = new No(n.highestTargetId);
|
|
8021
8021
|
return n.highestTargetId = r.next(), e.Sn(t, n).next((function() {
|
|
8022
8022
|
return n.highestTargetId;
|
|
8023
8023
|
}));
|
|
@@ -8066,7 +8066,7 @@ var So = /** @class */ function() {
|
|
|
8066
8066
|
var a = Gi(s);
|
|
8067
8067
|
a.sequenceNumber <= e && null === n.get(a.targetId) && (i++, o.push(r.removeTargetData(t, a)));
|
|
8068
8068
|
})).next((function() {
|
|
8069
|
-
return
|
|
8069
|
+
return _t.waitFor(o);
|
|
8070
8070
|
})).next((function() {
|
|
8071
8071
|
return i;
|
|
8072
8072
|
}));
|
|
@@ -8128,14 +8128,14 @@ var So = /** @class */ function() {
|
|
|
8128
8128
|
targetId: n,
|
|
8129
8129
|
path: u
|
|
8130
8130
|
})), i.push(r.referenceDelegate.addReference(t, n, e));
|
|
8131
|
-
})),
|
|
8131
|
+
})), _t.waitFor(i);
|
|
8132
8132
|
}, t.prototype.removeMatchingKeys = function(t, e, n) {
|
|
8133
8133
|
var r = this, i = Ro(t);
|
|
8134
8134
|
// PORTING NOTE: The reverse index (documentsTargets) is maintained by
|
|
8135
8135
|
// IndexedDb.
|
|
8136
|
-
return
|
|
8136
|
+
return _t.forEach(e, (function(e) {
|
|
8137
8137
|
var o = ri(e.path);
|
|
8138
|
-
return
|
|
8138
|
+
return _t.waitFor([ i.delete([ n, o ]), r.referenceDelegate.removeReference(t, n, e) ]);
|
|
8139
8139
|
}));
|
|
8140
8140
|
}, t.prototype.removeMatchingKeysForTargetId = function(t, e) {
|
|
8141
8141
|
var n = Ro(t), r = IDBKeyRange.bound([ e ], [ e + 1 ],
|
|
@@ -8308,7 +8308,7 @@ function ko(t) {
|
|
|
8308
8308
|
[ 3 /*break*/ , 6 ]) : [ 3 /*break*/ , 4 ];
|
|
8309
8309
|
|
|
8310
8310
|
case 4:
|
|
8311
|
-
return [ 4 /*yield*/ ,
|
|
8311
|
+
return [ 4 /*yield*/ , xt(t) ];
|
|
8312
8312
|
|
|
8313
8313
|
case 5:
|
|
8314
8314
|
e.sent(), e.label = 6;
|
|
@@ -8336,7 +8336,7 @@ function ko(t) {
|
|
|
8336
8336
|
}));
|
|
8337
8337
|
}, t.prototype.nthSequenceNumber = function(t, e) {
|
|
8338
8338
|
var n = this;
|
|
8339
|
-
if (0 === e) return
|
|
8339
|
+
if (0 === e) return _t.resolve(qt.at);
|
|
8340
8340
|
var r = new Lo(e);
|
|
8341
8341
|
return this.$n.forEachTarget(t, (function(t) {
|
|
8342
8342
|
return r.On(t.sequenceNumber);
|
|
@@ -8354,7 +8354,7 @@ function ko(t) {
|
|
|
8354
8354
|
}, t.prototype.collect = function(t, e) {
|
|
8355
8355
|
var n = this;
|
|
8356
8356
|
return -1 === this.params.cacheSizeCollectionThreshold ? (L("LruGarbageCollector", "Garbage collection skipped; disabled"),
|
|
8357
|
-
|
|
8357
|
+
_t.resolve(bo)) : this.getCacheSize(t).next((function(r) {
|
|
8358
8358
|
return r < n.params.cacheSizeCollectionThreshold ? (L("LruGarbageCollector", "Garbage collection skipped; Cache size " + r + " is lower than threshold " + n.params.cacheSizeCollectionThreshold),
|
|
8359
8359
|
bo) : n.Un(t, e);
|
|
8360
8360
|
}));
|
|
@@ -8372,7 +8372,7 @@ function ko(t) {
|
|
|
8372
8372
|
return i = e, s = Date.now(), c.removeOrphanedDocuments(t, n);
|
|
8373
8373
|
})).next((function(t) {
|
|
8374
8374
|
return a = Date.now(), R() <= h.DEBUG && L("LruGarbageCollector", "LRU Garbage Collection\n\tCounted targets in " + (o - l) + "ms\n\tDetermined least recently used " + r + " in " + (u - o) + "ms\n\tRemoved " + i + " targets in " + (s - u) + "ms\n\tRemoved " + t + " documents in " + (a - s) + "ms\nTotal Duration: " + (a - l) + "ms"),
|
|
8375
|
-
|
|
8375
|
+
_t.resolve({
|
|
8376
8376
|
didRun: !0,
|
|
8377
8377
|
sequenceNumbersCollected: r,
|
|
8378
8378
|
targetsRemoved: i,
|
|
@@ -8424,9 +8424,9 @@ function ko(t) {
|
|
|
8424
8424
|
t.prototype.Gn = function(t, e) {
|
|
8425
8425
|
return function(t, e) {
|
|
8426
8426
|
var n = !1;
|
|
8427
|
-
return
|
|
8427
|
+
return Ao(t).tt((function(r) {
|
|
8428
8428
|
return Do(t, r, e).next((function(t) {
|
|
8429
|
-
return t && (n = !0),
|
|
8429
|
+
return t && (n = !0), _t.resolve(!t);
|
|
8430
8430
|
}));
|
|
8431
8431
|
})).next((function() {
|
|
8432
8432
|
return n;
|
|
@@ -8447,7 +8447,7 @@ function ko(t) {
|
|
|
8447
8447
|
i.push(a);
|
|
8448
8448
|
}
|
|
8449
8449
|
})).next((function() {
|
|
8450
|
-
return
|
|
8450
|
+
return _t.waitFor(i);
|
|
8451
8451
|
})).next((function() {
|
|
8452
8452
|
return r.apply(t);
|
|
8453
8453
|
})).next((function() {
|
|
@@ -8584,7 +8584,7 @@ function ko(t) {
|
|
|
8584
8584
|
t.prototype.getEntry = function(t, e) {
|
|
8585
8585
|
this.assertNotApplied();
|
|
8586
8586
|
var n = this.changes.get(e);
|
|
8587
|
-
return void 0 !== n ?
|
|
8587
|
+
return void 0 !== n ? _t.resolve(n) : this.getFromCache(t, e);
|
|
8588
8588
|
},
|
|
8589
8589
|
/**
|
|
8590
8590
|
* Looks up several entries in the cache, forwarding to
|
|
@@ -8683,7 +8683,7 @@ function ko(t) {
|
|
|
8683
8683
|
}, (function(t, i) {
|
|
8684
8684
|
r = {
|
|
8685
8685
|
document: n.jn(e, i),
|
|
8686
|
-
size:
|
|
8686
|
+
size: Eo(i)
|
|
8687
8687
|
};
|
|
8688
8688
|
})).next((function() {
|
|
8689
8689
|
return r;
|
|
@@ -8708,7 +8708,7 @@ function ko(t) {
|
|
|
8708
8708
|
var n = this, r = or(), i = new Kt(ft.comparator);
|
|
8709
8709
|
return this.zn(t, e, (function(t, e) {
|
|
8710
8710
|
var o = n.jn(t, e);
|
|
8711
|
-
r = r.insert(t, o), i = i.insert(t,
|
|
8711
|
+
r = r.insert(t, o), i = i.insert(t, Eo(e));
|
|
8712
8712
|
})).next((function() {
|
|
8713
8713
|
return {
|
|
8714
8714
|
documents: r,
|
|
@@ -8716,7 +8716,7 @@ function ko(t) {
|
|
|
8716
8716
|
};
|
|
8717
8717
|
}));
|
|
8718
8718
|
}, t.prototype.zn = function(t, e, n) {
|
|
8719
|
-
if (e.isEmpty()) return
|
|
8719
|
+
if (e.isEmpty()) return _t.resolve();
|
|
8720
8720
|
var i = new zt(Ho);
|
|
8721
8721
|
e.forEach((function(t) {
|
|
8722
8722
|
return i = i.add(t);
|
|
@@ -8749,7 +8749,7 @@ function ko(t) {
|
|
|
8749
8749
|
return e;
|
|
8750
8750
|
}));
|
|
8751
8751
|
}, t.prototype.getAllFromCollectionGroup = function(t, e, n, r) {
|
|
8752
|
-
var i = this, o = or(), u = Wo(e, n), s = Wo(e,
|
|
8752
|
+
var i = this, o = or(), u = Wo(e, n), s = Wo(e, Tt.max());
|
|
8753
8753
|
return Qo(t).Z({
|
|
8754
8754
|
index: "collectionGroupIndex",
|
|
8755
8755
|
range: IDBKeyRange.bound(u, s, !0)
|
|
@@ -8858,7 +8858,7 @@ function ko(t) {
|
|
|
8858
8858
|
if (n.push(e.Yn.removeEntry(t, o, s.readTime)), u.isValidDocument()) {
|
|
8859
8859
|
var a = Pi(e.Yn.It, u);
|
|
8860
8860
|
i = i.add(o.path.popLast());
|
|
8861
|
-
var c =
|
|
8861
|
+
var c = Eo(a);
|
|
8862
8862
|
r += c - s.size, n.push(e.Yn.addEntry(t, o, a));
|
|
8863
8863
|
} else if (r -= s.size, e.trackRemovals) {
|
|
8864
8864
|
// In order to track removals, we store a "sentinel delete" in the
|
|
@@ -8870,7 +8870,7 @@ function ko(t) {
|
|
|
8870
8870
|
}
|
|
8871
8871
|
})), i.forEach((function(r) {
|
|
8872
8872
|
n.push(e.Yn.indexManager.addToCollectionParentIndex(t, r));
|
|
8873
|
-
})), n.push(this.Yn.updateMetadata(t, r)),
|
|
8873
|
+
})), n.push(this.Yn.updateMetadata(t, r)), _t.waitFor(n);
|
|
8874
8874
|
}, n.prototype.getFromCache = function(t, e) {
|
|
8875
8875
|
var n = this;
|
|
8876
8876
|
// Record the size of everything we load from the cache so we can compute a delta later.
|
|
@@ -9151,7 +9151,7 @@ e) {
|
|
|
9151
9151
|
}
|
|
9152
9152
|
})), u.push(n.documentOverlayCache.saveOverlays(t, a, l));
|
|
9153
9153
|
}; s.hasNext(); ) a();
|
|
9154
|
-
return
|
|
9154
|
+
return _t.waitFor(u);
|
|
9155
9155
|
})).next((function() {
|
|
9156
9156
|
return r;
|
|
9157
9157
|
}));
|
|
@@ -9200,14 +9200,14 @@ e) {
|
|
|
9200
9200
|
t.prototype.getNextDocuments = function(t, e, n, r) {
|
|
9201
9201
|
var i = this;
|
|
9202
9202
|
return this.remoteDocumentCache.getAllFromCollectionGroup(t, e, n, r).next((function(o) {
|
|
9203
|
-
var u = r - o.size > 0 ? i.documentOverlayCache.getOverlaysForCollectionGroup(t, e, n.largestBatchId, r - o.size) :
|
|
9203
|
+
var u = r - o.size > 0 ? i.documentOverlayCache.getOverlaysForCollectionGroup(t, e, n.largestBatchId, r - o.size) : _t.resolve(cr()), s = -1, a = o;
|
|
9204
9204
|
// The callsite will use the largest batch ID together with the latest read time to create
|
|
9205
9205
|
// a new index offset. Since we only process batch IDs if all remote documents have been read,
|
|
9206
9206
|
// no overlay will increase the overall read time. This is why we only need to special case
|
|
9207
9207
|
// the batch id.
|
|
9208
9208
|
return u.next((function(e) {
|
|
9209
|
-
return
|
|
9210
|
-
return s < n.largestBatchId && (s = n.largestBatchId), o.get(e) ?
|
|
9209
|
+
return _t.forEach(e, (function(e, n) {
|
|
9210
|
+
return s < n.largestBatchId && (s = n.largestBatchId), o.get(e) ? _t.resolve() : i.getBaseDocument(t, e, n).next((function(t) {
|
|
9211
9211
|
a = a.insert(e, t);
|
|
9212
9212
|
}));
|
|
9213
9213
|
})).next((function() {
|
|
@@ -9231,7 +9231,7 @@ e) {
|
|
|
9231
9231
|
}, t.prototype.getDocumentsMatchingCollectionGroupQuery = function(t, e, n) {
|
|
9232
9232
|
var r = this, i = e.collectionGroup, o = sr();
|
|
9233
9233
|
return this.indexManager.getCollectionParents(t, i).next((function(u) {
|
|
9234
|
-
return
|
|
9234
|
+
return _t.forEach(u, (function(u) {
|
|
9235
9235
|
var s = function(t, e) {
|
|
9236
9236
|
return new nn(e,
|
|
9237
9237
|
/*collectionGroup=*/ null, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
|
|
@@ -9268,14 +9268,14 @@ e) {
|
|
|
9268
9268
|
}));
|
|
9269
9269
|
},
|
|
9270
9270
|
/** Returns a base document that can be used to apply `overlay`. */ t.prototype.getBaseDocument = function(t, e, n) {
|
|
9271
|
-
return null === n || 1 /* Patch */ === n.mutation.type ? this.remoteDocumentCache.getEntry(t, e) :
|
|
9271
|
+
return null === n || 1 /* Patch */ === n.mutation.type ? this.remoteDocumentCache.getEntry(t, e) : _t.resolve(Re.newInvalidDocument(e));
|
|
9272
9272
|
}, t;
|
|
9273
9273
|
}(), Zo = /** @class */ function() {
|
|
9274
9274
|
function t(t) {
|
|
9275
9275
|
this.It = t, this.Zn = new Map, this.ts = new Map;
|
|
9276
9276
|
}
|
|
9277
9277
|
return t.prototype.getBundleMetadata = function(t, e) {
|
|
9278
|
-
return
|
|
9278
|
+
return _t.resolve(this.Zn.get(e));
|
|
9279
9279
|
}, t.prototype.saveBundleMetadata = function(t, e) {
|
|
9280
9280
|
/** Decodes a BundleMetadata proto into a BundleMetadata object. */
|
|
9281
9281
|
var n;
|
|
@@ -9283,9 +9283,9 @@ e) {
|
|
|
9283
9283
|
id: (n = e).id,
|
|
9284
9284
|
version: n.version,
|
|
9285
9285
|
createTime: Or(n.createTime)
|
|
9286
|
-
}),
|
|
9286
|
+
}), _t.resolve();
|
|
9287
9287
|
}, t.prototype.getNamedQuery = function(t, e) {
|
|
9288
|
-
return
|
|
9288
|
+
return _t.resolve(this.ts.get(e));
|
|
9289
9289
|
}, t.prototype.saveNamedQuery = function(t, e) {
|
|
9290
9290
|
return this.ts.set(e.name, function(t) {
|
|
9291
9291
|
return {
|
|
@@ -9293,7 +9293,7 @@ e) {
|
|
|
9293
9293
|
query: ji(t.bundledQuery),
|
|
9294
9294
|
readTime: Or(t.readTime)
|
|
9295
9295
|
};
|
|
9296
|
-
}(e)),
|
|
9296
|
+
}(e)), _t.resolve();
|
|
9297
9297
|
}, t;
|
|
9298
9298
|
}(), Jo = /** @class */ function() {
|
|
9299
9299
|
function t() {
|
|
@@ -9302,10 +9302,10 @@ e) {
|
|
|
9302
9302
|
this.overlays = new Kt(ft.comparator), this.es = new Map;
|
|
9303
9303
|
}
|
|
9304
9304
|
return t.prototype.getOverlay = function(t, e) {
|
|
9305
|
-
return
|
|
9305
|
+
return _t.resolve(this.overlays.get(e));
|
|
9306
9306
|
}, t.prototype.getOverlays = function(t, e) {
|
|
9307
9307
|
var n = this, r = cr();
|
|
9308
|
-
return
|
|
9308
|
+
return _t.forEach(e, (function(e) {
|
|
9309
9309
|
return n.getOverlay(t, e).next((function(t) {
|
|
9310
9310
|
null !== t && r.set(e, t);
|
|
9311
9311
|
}));
|
|
@@ -9316,12 +9316,12 @@ e) {
|
|
|
9316
9316
|
var r = this;
|
|
9317
9317
|
return n.forEach((function(n, i) {
|
|
9318
9318
|
r.ue(t, e, i);
|
|
9319
|
-
})),
|
|
9319
|
+
})), _t.resolve();
|
|
9320
9320
|
}, t.prototype.removeOverlaysForBatchId = function(t, e, n) {
|
|
9321
9321
|
var r = this, i = this.es.get(n);
|
|
9322
9322
|
return void 0 !== i && (i.forEach((function(t) {
|
|
9323
9323
|
return r.overlays = r.overlays.remove(t);
|
|
9324
|
-
})), this.es.delete(n)),
|
|
9324
|
+
})), this.es.delete(n)), _t.resolve();
|
|
9325
9325
|
}, t.prototype.getOverlaysForCollection = function(t, e, n) {
|
|
9326
9326
|
for (var r = cr(), i = e.length + 1, o = new ft(e.child("")), u = this.overlays.getIteratorFrom(o); u.hasNext(); ) {
|
|
9327
9327
|
var s = u.getNext().value, a = s.getKey();
|
|
@@ -9329,7 +9329,7 @@ e) {
|
|
|
9329
9329
|
// Documents from sub-collections
|
|
9330
9330
|
a.path.length === i && s.largestBatchId > n && r.set(s.getKey(), s);
|
|
9331
9331
|
}
|
|
9332
|
-
return
|
|
9332
|
+
return _t.resolve(r);
|
|
9333
9333
|
}, t.prototype.getOverlaysForCollectionGroup = function(t, e, n, r) {
|
|
9334
9334
|
for (var i = new Kt((function(t, e) {
|
|
9335
9335
|
return t - e;
|
|
@@ -9343,7 +9343,7 @@ e) {
|
|
|
9343
9343
|
for (var a = cr(), c = i.getIterator(); c.hasNext() && (c.getNext().value.forEach((function(t, e) {
|
|
9344
9344
|
return a.set(t, e);
|
|
9345
9345
|
})), !(a.size() >= r)); ) ;
|
|
9346
|
-
return
|
|
9346
|
+
return _t.resolve(a);
|
|
9347
9347
|
}, t.prototype.ue = function(t, e, n) {
|
|
9348
9348
|
// Remove the association of the overlay to its batch id.
|
|
9349
9349
|
var r = this.overlays.get(n.key);
|
|
@@ -9439,7 +9439,7 @@ e) {
|
|
|
9439
9439
|
this.gs = new zt(tu.ss);
|
|
9440
9440
|
}
|
|
9441
9441
|
return t.prototype.checkEmpty = function(t) {
|
|
9442
|
-
return
|
|
9442
|
+
return _t.resolve(0 === this.mutationQueue.length);
|
|
9443
9443
|
}, t.prototype.addMutationBatch = function(t, e, n, r) {
|
|
9444
9444
|
var i = this.ws;
|
|
9445
9445
|
this.ws++, this.mutationQueue.length > 0 && this.mutationQueue[this.mutationQueue.length - 1];
|
|
@@ -9450,24 +9450,24 @@ e) {
|
|
|
9450
9450
|
var a = s[u];
|
|
9451
9451
|
this.gs = this.gs.add(new tu(a.key, i)), this.indexManager.addToCollectionParentIndex(t, a.key.path.popLast());
|
|
9452
9452
|
}
|
|
9453
|
-
return
|
|
9453
|
+
return _t.resolve(o);
|
|
9454
9454
|
}, t.prototype.lookupMutationBatch = function(t, e) {
|
|
9455
|
-
return
|
|
9455
|
+
return _t.resolve(this.ys(e));
|
|
9456
9456
|
}, t.prototype.getNextMutationBatchAfterBatchId = function(t, e) {
|
|
9457
9457
|
var n = e + 1, r = this.ps(n), i = r < 0 ? 0 : r;
|
|
9458
9458
|
// The requested batchId may still be out of range so normalize it to the
|
|
9459
9459
|
// start of the queue.
|
|
9460
|
-
return
|
|
9460
|
+
return _t.resolve(this.mutationQueue.length > i ? this.mutationQueue[i] : null);
|
|
9461
9461
|
}, t.prototype.getHighestUnacknowledgedBatchId = function() {
|
|
9462
|
-
return
|
|
9462
|
+
return _t.resolve(0 === this.mutationQueue.length ? -1 : this.ws - 1);
|
|
9463
9463
|
}, t.prototype.getAllMutationBatches = function(t) {
|
|
9464
|
-
return
|
|
9464
|
+
return _t.resolve(this.mutationQueue.slice());
|
|
9465
9465
|
}, t.prototype.getAllMutationBatchesAffectingDocumentKey = function(t, e) {
|
|
9466
9466
|
var n = this, r = new tu(e, 0), i = new tu(e, Number.POSITIVE_INFINITY), o = [];
|
|
9467
9467
|
return this.gs.forEachInRange([ r, i ], (function(t) {
|
|
9468
9468
|
var e = n.ys(t._s);
|
|
9469
9469
|
o.push(e);
|
|
9470
|
-
})),
|
|
9470
|
+
})), _t.resolve(o);
|
|
9471
9471
|
}, t.prototype.getAllMutationBatchesAffectingDocumentKeys = function(t, e) {
|
|
9472
9472
|
var n = this, r = new zt(rt);
|
|
9473
9473
|
return e.forEach((function(t) {
|
|
@@ -9475,7 +9475,7 @@ e) {
|
|
|
9475
9475
|
n.gs.forEachInRange([ e, i ], (function(t) {
|
|
9476
9476
|
r = r.add(t._s);
|
|
9477
9477
|
}));
|
|
9478
|
-
})),
|
|
9478
|
+
})), _t.resolve(this.Is(r));
|
|
9479
9479
|
}, t.prototype.getAllMutationBatchesAffectingQuery = function(t, e) {
|
|
9480
9480
|
// Use the query path as a prefix for testing if a document matches the
|
|
9481
9481
|
// query.
|
|
@@ -9497,7 +9497,7 @@ e) {
|
|
|
9497
9497
|
// TODO(mcg): we'll need a different scanner when we implement
|
|
9498
9498
|
// ancestor queries.
|
|
9499
9499
|
e.length === r && (u = u.add(t._s)), !0);
|
|
9500
|
-
}), o),
|
|
9500
|
+
}), o), _t.resolve(this.Is(u));
|
|
9501
9501
|
}, t.prototype.Is = function(t) {
|
|
9502
9502
|
var e = this, n = [];
|
|
9503
9503
|
// Construct an array of matching batches, sorted by batchID to ensure that
|
|
@@ -9510,7 +9510,7 @@ e) {
|
|
|
9510
9510
|
var n = this;
|
|
9511
9511
|
U(0 === this.Ts(e.batchId, "removed")), this.mutationQueue.shift();
|
|
9512
9512
|
var r = this.gs;
|
|
9513
|
-
return
|
|
9513
|
+
return _t.forEach(e.mutations, (function(i) {
|
|
9514
9514
|
var o = new tu(i.key, e.batchId);
|
|
9515
9515
|
return r = r.delete(o), n.referenceDelegate.markPotentiallyOrphaned(t, i.key);
|
|
9516
9516
|
})).next((function() {
|
|
@@ -9520,9 +9520,9 @@ e) {
|
|
|
9520
9520
|
// No-op since the memory mutation queue does not maintain a separate cache.
|
|
9521
9521
|
}, t.prototype.containsKey = function(t, e) {
|
|
9522
9522
|
var n = new tu(e, 0), r = this.gs.firstAfterOrEqual(n);
|
|
9523
|
-
return
|
|
9523
|
+
return _t.resolve(e.isEqual(r && r.key));
|
|
9524
9524
|
}, t.prototype.performConsistencyCheck = function(t) {
|
|
9525
|
-
return this.mutationQueue.length,
|
|
9525
|
+
return this.mutationQueue.length, _t.resolve();
|
|
9526
9526
|
},
|
|
9527
9527
|
/**
|
|
9528
9528
|
* Finds the index of the given batchId in the mutation queue and asserts that
|
|
@@ -9599,13 +9599,13 @@ e) {
|
|
|
9599
9599
|
e && (this.docs = this.docs.remove(t), this.size -= e.size);
|
|
9600
9600
|
}, t.prototype.getEntry = function(t, e) {
|
|
9601
9601
|
var n = this.docs.get(e);
|
|
9602
|
-
return
|
|
9602
|
+
return _t.resolve(n ? n.document.mutableCopy() : Re.newInvalidDocument(e));
|
|
9603
9603
|
}, t.prototype.getEntries = function(t, e) {
|
|
9604
9604
|
var n = this, r = or();
|
|
9605
9605
|
return e.forEach((function(t) {
|
|
9606
9606
|
var e = n.docs.get(t);
|
|
9607
9607
|
r = r.insert(t, e ? e.document.mutableCopy() : Re.newInvalidDocument(t));
|
|
9608
|
-
})),
|
|
9608
|
+
})), _t.resolve(r);
|
|
9609
9609
|
}, t.prototype.getAllFromCollection = function(t, e, n) {
|
|
9610
9610
|
for (var r = or(), i = new ft(e.child("")), o = this.docs.getIteratorFrom(i)
|
|
9611
9611
|
// Documents are ordered by key, so we can use a prefix scan to narrow down
|
|
@@ -9613,15 +9613,15 @@ e) {
|
|
|
9613
9613
|
; o.hasNext(); ) {
|
|
9614
9614
|
var u = o.getNext(), s = u.key, a = u.value.document;
|
|
9615
9615
|
if (!e.isPrefixOf(s.path)) break;
|
|
9616
|
-
s.path.length > e.length + 1 ||
|
|
9616
|
+
s.path.length > e.length + 1 || Et(It(a), n) <= 0 || (r = r.insert(a.key, a.mutableCopy()));
|
|
9617
9617
|
}
|
|
9618
|
-
return
|
|
9618
|
+
return _t.resolve(r);
|
|
9619
9619
|
}, t.prototype.getAllFromCollectionGroup = function(t, e, n, r) {
|
|
9620
9620
|
// This method should only be called from the IndexBackfiller if persistence
|
|
9621
9621
|
// is enabled.
|
|
9622
9622
|
q();
|
|
9623
9623
|
}, t.prototype.As = function(t, e) {
|
|
9624
|
-
return
|
|
9624
|
+
return _t.forEach(this.docs, (function(t) {
|
|
9625
9625
|
return e(t);
|
|
9626
9626
|
}));
|
|
9627
9627
|
}, t.prototype.newChangeBuffer = function(t) {
|
|
@@ -9629,7 +9629,7 @@ e) {
|
|
|
9629
9629
|
// a separate changelog and does not need special handling for removals.
|
|
9630
9630
|
return new ru(this);
|
|
9631
9631
|
}, t.prototype.getSize = function(t) {
|
|
9632
|
-
return
|
|
9632
|
+
return _t.resolve(this.size);
|
|
9633
9633
|
}, t;
|
|
9634
9634
|
}(), ru = /** @class */ function(e) {
|
|
9635
9635
|
function n(t) {
|
|
@@ -9640,7 +9640,7 @@ e) {
|
|
|
9640
9640
|
var e = this, n = [];
|
|
9641
9641
|
return this.changes.forEach((function(r, i) {
|
|
9642
9642
|
i.isValidDocument() ? n.push(e.Yn.addEntry(t, i)) : e.Yn.removeEntry(r);
|
|
9643
|
-
})),
|
|
9643
|
+
})), _t.waitFor(n);
|
|
9644
9644
|
}, n.prototype.getFromCache = function(t, e) {
|
|
9645
9645
|
return this.Yn.getEntry(t, e);
|
|
9646
9646
|
}, n.prototype.getAllFromCache = function(t, e) {
|
|
@@ -9665,60 +9665,60 @@ e) {
|
|
|
9665
9665
|
* A ordered bidirectional mapping between documents and the remote target
|
|
9666
9666
|
* IDs.
|
|
9667
9667
|
*/
|
|
9668
|
-
this.Ps = new $o, this.targetCount = 0, this.vs =
|
|
9668
|
+
this.Ps = new $o, this.targetCount = 0, this.vs = No.Pn();
|
|
9669
9669
|
}
|
|
9670
9670
|
return t.prototype.forEachTarget = function(t, e) {
|
|
9671
9671
|
return this.Rs.forEach((function(t, n) {
|
|
9672
9672
|
return e(n);
|
|
9673
|
-
})),
|
|
9673
|
+
})), _t.resolve();
|
|
9674
9674
|
}, t.prototype.getLastRemoteSnapshotVersion = function(t) {
|
|
9675
|
-
return
|
|
9675
|
+
return _t.resolve(this.lastRemoteSnapshotVersion);
|
|
9676
9676
|
}, t.prototype.getHighestSequenceNumber = function(t) {
|
|
9677
|
-
return
|
|
9677
|
+
return _t.resolve(this.bs);
|
|
9678
9678
|
}, t.prototype.allocateTargetId = function(t) {
|
|
9679
|
-
return this.highestTargetId = this.vs.next(),
|
|
9679
|
+
return this.highestTargetId = this.vs.next(), _t.resolve(this.highestTargetId);
|
|
9680
9680
|
}, t.prototype.setTargetsMetadata = function(t, e, n) {
|
|
9681
9681
|
return n && (this.lastRemoteSnapshotVersion = n), e > this.bs && (this.bs = e),
|
|
9682
|
-
|
|
9682
|
+
_t.resolve();
|
|
9683
9683
|
}, t.prototype.Dn = function(t) {
|
|
9684
9684
|
this.Rs.set(t.target, t);
|
|
9685
9685
|
var e = t.targetId;
|
|
9686
|
-
e > this.highestTargetId && (this.vs = new
|
|
9686
|
+
e > this.highestTargetId && (this.vs = new No(e), this.highestTargetId = e), t.sequenceNumber > this.bs && (this.bs = t.sequenceNumber);
|
|
9687
9687
|
}, t.prototype.addTargetData = function(t, e) {
|
|
9688
|
-
return this.Dn(e), this.targetCount += 1,
|
|
9688
|
+
return this.Dn(e), this.targetCount += 1, _t.resolve();
|
|
9689
9689
|
}, t.prototype.updateTargetData = function(t, e) {
|
|
9690
|
-
return this.Dn(e),
|
|
9690
|
+
return this.Dn(e), _t.resolve();
|
|
9691
9691
|
}, t.prototype.removeTargetData = function(t, e) {
|
|
9692
9692
|
return this.Rs.delete(e.target), this.Ps.ls(e.targetId), this.targetCount -= 1,
|
|
9693
|
-
|
|
9693
|
+
_t.resolve();
|
|
9694
9694
|
}, t.prototype.removeTargets = function(t, e, n) {
|
|
9695
9695
|
var r = this, i = 0, o = [];
|
|
9696
9696
|
return this.Rs.forEach((function(u, s) {
|
|
9697
9697
|
s.sequenceNumber <= e && null === n.get(s.targetId) && (r.Rs.delete(u), o.push(r.removeMatchingKeysForTargetId(t, s.targetId)),
|
|
9698
9698
|
i++);
|
|
9699
|
-
})),
|
|
9699
|
+
})), _t.waitFor(o).next((function() {
|
|
9700
9700
|
return i;
|
|
9701
9701
|
}));
|
|
9702
9702
|
}, t.prototype.getTargetCount = function(t) {
|
|
9703
|
-
return
|
|
9703
|
+
return _t.resolve(this.targetCount);
|
|
9704
9704
|
}, t.prototype.getTargetData = function(t, e) {
|
|
9705
9705
|
var n = this.Rs.get(e) || null;
|
|
9706
|
-
return
|
|
9706
|
+
return _t.resolve(n);
|
|
9707
9707
|
}, t.prototype.addMatchingKeys = function(t, e, n) {
|
|
9708
|
-
return this.Ps.us(e, n),
|
|
9708
|
+
return this.Ps.us(e, n), _t.resolve();
|
|
9709
9709
|
}, t.prototype.removeMatchingKeys = function(t, e, n) {
|
|
9710
9710
|
this.Ps.hs(e, n);
|
|
9711
9711
|
var r = this.persistence.referenceDelegate, i = [];
|
|
9712
9712
|
return r && e.forEach((function(e) {
|
|
9713
9713
|
i.push(r.markPotentiallyOrphaned(t, e));
|
|
9714
|
-
})),
|
|
9714
|
+
})), _t.waitFor(i);
|
|
9715
9715
|
}, t.prototype.removeMatchingKeysForTargetId = function(t, e) {
|
|
9716
|
-
return this.Ps.ls(e),
|
|
9716
|
+
return this.Ps.ls(e), _t.resolve();
|
|
9717
9717
|
}, t.prototype.getMatchingKeysForTargetId = function(t, e) {
|
|
9718
9718
|
var n = this.Ps.ds(e);
|
|
9719
|
-
return
|
|
9719
|
+
return _t.resolve(n);
|
|
9720
9720
|
}, t.prototype.containsKey = function(t, e) {
|
|
9721
|
-
return
|
|
9721
|
+
return _t.resolve(this.Ps.containsKey(e));
|
|
9722
9722
|
}, t;
|
|
9723
9723
|
}(), ou = /** @class */ function() {
|
|
9724
9724
|
/**
|
|
@@ -9778,7 +9778,7 @@ e) {
|
|
|
9778
9778
|
return i.raiseOnCommittedEvent(), t;
|
|
9779
9779
|
}));
|
|
9780
9780
|
}, t.prototype.Ms = function(t, e) {
|
|
9781
|
-
return
|
|
9781
|
+
return _t.or(Object.values(this.Vs).map((function(n) {
|
|
9782
9782
|
return function() {
|
|
9783
9783
|
return n.containsKey(t, e);
|
|
9784
9784
|
};
|
|
@@ -9808,11 +9808,11 @@ e) {
|
|
|
9808
9808
|
enumerable: !1,
|
|
9809
9809
|
configurable: !0
|
|
9810
9810
|
}), t.prototype.addReference = function(t, e, n) {
|
|
9811
|
-
return this.Fs.addReference(n, e), this.Ls.delete(n.toString()),
|
|
9811
|
+
return this.Fs.addReference(n, e), this.Ls.delete(n.toString()), _t.resolve();
|
|
9812
9812
|
}, t.prototype.removeReference = function(t, e, n) {
|
|
9813
|
-
return this.Fs.removeReference(n, e), this.Ls.add(n.toString()),
|
|
9813
|
+
return this.Fs.removeReference(n, e), this.Ls.add(n.toString()), _t.resolve();
|
|
9814
9814
|
}, t.prototype.markPotentiallyOrphaned = function(t, e) {
|
|
9815
|
-
return this.Ls.add(e.toString()),
|
|
9815
|
+
return this.Ls.add(e.toString()), _t.resolve();
|
|
9816
9816
|
}, t.prototype.removeTarget = function(t, e) {
|
|
9817
9817
|
var n = this;
|
|
9818
9818
|
this.Fs.ls(e.targetId).forEach((function(t) {
|
|
@@ -9831,7 +9831,7 @@ e) {
|
|
|
9831
9831
|
}, t.prototype.Os = function(t) {
|
|
9832
9832
|
var e = this, n = this.persistence.getRemoteDocumentCache().newChangeBuffer();
|
|
9833
9833
|
// Remove newly orphaned documents.
|
|
9834
|
-
return
|
|
9834
|
+
return _t.forEach(this.Ls, (function(r) {
|
|
9835
9835
|
var i = ft.fromPath(r);
|
|
9836
9836
|
return e.Us(t, i).next((function(t) {
|
|
9837
9837
|
t || n.removeEntry(i, st.min());
|
|
@@ -9849,8 +9849,8 @@ e) {
|
|
|
9849
9849
|
return 0;
|
|
9850
9850
|
}, t.prototype.Us = function(t, e) {
|
|
9851
9851
|
var n = this;
|
|
9852
|
-
return
|
|
9853
|
-
return
|
|
9852
|
+
return _t.or([ function() {
|
|
9853
|
+
return _t.resolve(n.Fs.containsKey(e));
|
|
9854
9854
|
}, function() {
|
|
9855
9855
|
return n.persistence.getTargetCache().containsKey(t, e);
|
|
9856
9856
|
}, function() {
|
|
@@ -9868,7 +9868,7 @@ e) {
|
|
|
9868
9868
|
* to SCHEMA_VERSION. Different values of toVersion are only used for testing
|
|
9869
9869
|
* and local feature development.
|
|
9870
9870
|
*/ return t.prototype.$ = function(t, e, n, r) {
|
|
9871
|
-
var i = this, o = new
|
|
9871
|
+
var i = this, o = new At("createOrUpgrade", e);
|
|
9872
9872
|
n < 1 && r >= 1 && (function(t) {
|
|
9873
9873
|
t.createObjectStore("owner");
|
|
9874
9874
|
}(t), function(t) {
|
|
@@ -9885,7 +9885,7 @@ e) {
|
|
|
9885
9885
|
}(t));
|
|
9886
9886
|
// Migration 2 to populate the targetGlobal object no longer needed since
|
|
9887
9887
|
// migration 3 unconditionally clears it.
|
|
9888
|
-
var u =
|
|
9888
|
+
var u = _t.resolve();
|
|
9889
9889
|
return n < 3 && r >= 3 && (
|
|
9890
9890
|
// Brand new clients don't need to drop and recreate--only clients that
|
|
9891
9891
|
// potentially have corrupt data.
|
|
@@ -9925,7 +9925,7 @@ e) {
|
|
|
9925
9925
|
var r = e.store("mutations"), i = n.map((function(t) {
|
|
9926
9926
|
return r.put(t);
|
|
9927
9927
|
}));
|
|
9928
|
-
return
|
|
9928
|
+
return _t.waitFor(i);
|
|
9929
9929
|
}));
|
|
9930
9930
|
}(t, o);
|
|
9931
9931
|
}))), u = u.next((function() {
|
|
@@ -9968,9 +9968,9 @@ e) {
|
|
|
9968
9968
|
}))), n < 12 && r >= 12 && (u = u.next((function() {
|
|
9969
9969
|
!function(t) {
|
|
9970
9970
|
var e = t.createObjectStore("documentOverlays", {
|
|
9971
|
-
keyPath:
|
|
9971
|
+
keyPath: Ti
|
|
9972
9972
|
});
|
|
9973
|
-
e.createIndex("collectionPathOverlayIndex",
|
|
9973
|
+
e.createIndex("collectionPathOverlayIndex", Ei, {
|
|
9974
9974
|
unique: !1
|
|
9975
9975
|
}), e.createIndex("collectionGroupOverlayIndex", Si, {
|
|
9976
9976
|
unique: !1
|
|
@@ -10010,7 +10010,7 @@ e) {
|
|
|
10010
10010
|
}, t.prototype.Ks = function(t) {
|
|
10011
10011
|
var e = 0;
|
|
10012
10012
|
return t.store("remoteDocuments").Z((function(t, n) {
|
|
10013
|
-
e +=
|
|
10013
|
+
e += Eo(n);
|
|
10014
10014
|
})).next((function() {
|
|
10015
10015
|
var n = {
|
|
10016
10016
|
byteSize: e
|
|
@@ -10020,13 +10020,13 @@ e) {
|
|
|
10020
10020
|
}, t.prototype.qs = function(t) {
|
|
10021
10021
|
var e = this, n = t.store("mutationQueues"), r = t.store("mutations");
|
|
10022
10022
|
return n.W().next((function(n) {
|
|
10023
|
-
return
|
|
10023
|
+
return _t.forEach(n, (function(n) {
|
|
10024
10024
|
var i = IDBKeyRange.bound([ n.userId, -1 ], [ n.userId, n.lastAcknowledgedBatchId ]);
|
|
10025
10025
|
return r.W("userMutationsIndex", i).next((function(r) {
|
|
10026
|
-
return
|
|
10026
|
+
return _t.forEach(r, (function(r) {
|
|
10027
10027
|
U(r.userId === n.userId);
|
|
10028
10028
|
var i = Bi(e.It, r);
|
|
10029
|
-
return
|
|
10029
|
+
return To(t, n.userId, i).next((function() {}));
|
|
10030
10030
|
}));
|
|
10031
10031
|
}));
|
|
10032
10032
|
}));
|
|
@@ -10045,7 +10045,7 @@ e) {
|
|
|
10045
10045
|
return [ 0, ri(t) ];
|
|
10046
10046
|
}(o);
|
|
10047
10047
|
r.push(e.get(u).next((function(n) {
|
|
10048
|
-
return n ?
|
|
10048
|
+
return n ? _t.resolve() : function(n) {
|
|
10049
10049
|
return e.put({
|
|
10050
10050
|
targetId: 0,
|
|
10051
10051
|
path: ri(n),
|
|
@@ -10054,7 +10054,7 @@ e) {
|
|
|
10054
10054
|
}(o);
|
|
10055
10055
|
})));
|
|
10056
10056
|
})).next((function() {
|
|
10057
|
-
return
|
|
10057
|
+
return _t.waitFor(r);
|
|
10058
10058
|
}));
|
|
10059
10059
|
}));
|
|
10060
10060
|
}, t.prototype.Qs = function(t, e) {
|
|
@@ -10110,7 +10110,7 @@ e) {
|
|
|
10110
10110
|
};
|
|
10111
10111
|
r.push(o.put(s));
|
|
10112
10112
|
})).next((function() {
|
|
10113
|
-
return
|
|
10113
|
+
return _t.waitFor(r);
|
|
10114
10114
|
}));
|
|
10115
10115
|
}, t.prototype.zs = function(t, e) {
|
|
10116
10116
|
var n = this, r = e.store("mutations"), i = Go(this.It), o = new ou(su.Bs, this.It.re);
|
|
@@ -10121,7 +10121,7 @@ e) {
|
|
|
10121
10121
|
Bi(n.It, t).keys().forEach((function(t) {
|
|
10122
10122
|
return i = i.add(t);
|
|
10123
10123
|
})), r.set(t.userId, i);
|
|
10124
|
-
})),
|
|
10124
|
+
})), _t.forEach(r, (function(t, r) {
|
|
10125
10125
|
var u = new C(r), s = Zi.oe(n.It, u), a = o.getIndexManager(u), c = So.oe(u, n.It, a, o.referenceDelegate);
|
|
10126
10126
|
return new Xo(i, c, s, a).recalculateAndSaveOverlaysForDocumentKeys(new Ci(e, qt.at), t).next();
|
|
10127
10127
|
}));
|
|
@@ -10192,7 +10192,7 @@ var lu = "Failed to obtain exclusive access to the persistence layer. To allow s
|
|
|
10192
10192
|
return Promise.resolve();
|
|
10193
10193
|
}, !t.C()) throw new j(K.UNIMPLEMENTED, "This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");
|
|
10194
10194
|
this.referenceDelegate = new Fo(this, i), this.ii = n + "main", this.It = new Mi(a),
|
|
10195
|
-
this.ri = new
|
|
10195
|
+
this.ri = new Nt(this.ii, this.Xs, new au(this.It)), this.Cs = new Co(this.referenceDelegate, this.It),
|
|
10196
10196
|
this.remoteDocumentCache = Go(this.It), this.Ns = new Hi, this.window && this.window.localStorage ? this.oi = this.window.localStorage : (this.oi = null,
|
|
10197
10197
|
!1 === l && M("IndexedDbPersistence", "LocalStorage is unavailable. As a result, persistence may not work reliably. In particular enablePersistence() could fail immediately after refreshing the page."));
|
|
10198
10198
|
}
|
|
@@ -10336,7 +10336,7 @@ var lu = "Failed to obtain exclusive access to the persistence layer. To allow s
|
|
|
10336
10336
|
}, t.prototype.fi = function(t) {
|
|
10337
10337
|
var e = this;
|
|
10338
10338
|
return fu(t).get("owner").next((function(t) {
|
|
10339
|
-
return
|
|
10339
|
+
return _t.resolve(e.mi(t));
|
|
10340
10340
|
}));
|
|
10341
10341
|
}, t.prototype.gi = function(t) {
|
|
10342
10342
|
return du(t).delete(this.clientId);
|
|
@@ -10360,7 +10360,7 @@ var lu = "Failed to obtain exclusive access to the persistence layer. To allow s
|
|
|
10360
10360
|
return -1 === n.indexOf(t);
|
|
10361
10361
|
}));
|
|
10362
10362
|
// Delete metadata for clients that are no longer considered active.
|
|
10363
|
-
return
|
|
10363
|
+
return _t.forEach(r, (function(t) {
|
|
10364
10364
|
return e.delete(t.clientId);
|
|
10365
10365
|
})).next((function() {
|
|
10366
10366
|
return r;
|
|
@@ -10411,7 +10411,7 @@ var lu = "Failed to obtain exclusive access to the persistence layer. To allow s
|
|
|
10411
10411
|
*/
|
|
10412
10412
|
t.prototype.di = function(t) {
|
|
10413
10413
|
var e = this;
|
|
10414
|
-
return this.Ys ?
|
|
10414
|
+
return this.Ys ? _t.resolve(!0) : fu(t).get("owner").next((function(n) {
|
|
10415
10415
|
// A client is eligible for the primary lease if:
|
|
10416
10416
|
// - its network is enabled and the client's tab is in the foreground.
|
|
10417
10417
|
// - its network is enabled and no other client's tab is in the
|
|
@@ -10531,7 +10531,7 @@ var lu = "Failed to obtain exclusive access to the persistence layer. To allow s
|
|
|
10531
10531
|
}, t.prototype.runTransaction = function(t, e, n) {
|
|
10532
10532
|
var r = this;
|
|
10533
10533
|
L("IndexedDbPersistence", "Starting transaction:", t);
|
|
10534
|
-
var i, o, u = "readonly" === e ? "readonly" : "readwrite", s = 15 === (i = this.Xs) ?
|
|
10534
|
+
var i, o, u = "readonly" === e ? "readonly" : "readwrite", s = 15 === (i = this.Xs) ? Ni : 14 === i ? Ai : 13 === i ? _i : 12 === i ? xi : 11 === i ? Di : void q();
|
|
10535
10535
|
/** Returns the object stores for the provided schema. */
|
|
10536
10536
|
// Do all transactions as readwrite against all object stores, since we
|
|
10537
10537
|
// are the only reader/writer.
|
|
@@ -10579,12 +10579,12 @@ var lu = "Failed to obtain exclusive access to the persistence layer. To allow s
|
|
|
10579
10579
|
};
|
|
10580
10580
|
return fu(t).put("owner", e);
|
|
10581
10581
|
}, t.C = function() {
|
|
10582
|
-
return
|
|
10582
|
+
return Nt.C();
|
|
10583
10583
|
},
|
|
10584
10584
|
/** Checks the primary lease and removes it if we are the current primary. */ t.prototype._i = function(t) {
|
|
10585
10585
|
var e = this, n = fu(t);
|
|
10586
10586
|
return n.get("owner").next((function(t) {
|
|
10587
|
-
return e.mi(t) ? (L("IndexedDbPersistence", "Releasing primary lease."), n.delete("owner")) :
|
|
10587
|
+
return e.mi(t) ? (L("IndexedDbPersistence", "Releasing primary lease."), n.delete("owner")) : _t.resolve();
|
|
10588
10588
|
}));
|
|
10589
10589
|
},
|
|
10590
10590
|
/** Verifies that `updateTimeMs` is within `maxAgeMs`. */ t.prototype.pi = function(t, e) {
|
|
@@ -10809,7 +10809,7 @@ var vu = /** @class */ function() {
|
|
|
10809
10809
|
// Queries that match all documents don't benefit from using
|
|
10810
10810
|
// key-based lookups. It is more efficient to scan all documents in a
|
|
10811
10811
|
// collection, rather than to perform individual lookups.
|
|
10812
|
-
return
|
|
10812
|
+
return _t.resolve(null);
|
|
10813
10813
|
var r = hn(e);
|
|
10814
10814
|
return this.indexManager.getIndexType(t, r).next((function(i) {
|
|
10815
10815
|
return 0 /* NONE */ === i ? null : (null !== e.limit && 1 /* PARTIAL */ === i && (
|
|
@@ -10885,7 +10885,7 @@ var vu = /** @class */ function() {
|
|
|
10885
10885
|
return !!i && (i.hasPendingWrites || i.version.compareTo(r) > 0);
|
|
10886
10886
|
}, t.prototype.Mi = function(t, e) {
|
|
10887
10887
|
return R() <= h.DEBUG && L("QueryEngine", "Using full collection scan to execute query:", vn(e)),
|
|
10888
|
-
this.Ni.getDocumentsMatchingQuery(t, e,
|
|
10888
|
+
this.Ni.getDocumentsMatchingQuery(t, e, Tt.min());
|
|
10889
10889
|
},
|
|
10890
10890
|
/**
|
|
10891
10891
|
* Combines the results from an indexed execution with the remaining documents
|
|
@@ -11078,7 +11078,7 @@ function wu(t, r) {
|
|
|
11078
11078
|
trackRemovals: !0
|
|
11079
11079
|
});
|
|
11080
11080
|
return function(t, e, n, r) {
|
|
11081
|
-
var i = n.batch, o = i.keys(), u =
|
|
11081
|
+
var i = n.batch, o = i.keys(), u = _t.resolve();
|
|
11082
11082
|
return o.forEach((function(t) {
|
|
11083
11083
|
u = u.next((function() {
|
|
11084
11084
|
return r.getEntry(e, t);
|
|
@@ -11127,7 +11127,7 @@ function wu(t, r) {
|
|
|
11127
11127
|
*
|
|
11128
11128
|
* LocalDocuments are re-calculated if there are remaining mutations in the
|
|
11129
11129
|
* queue.
|
|
11130
|
-
*/ function
|
|
11130
|
+
*/ function Tu(t, e) {
|
|
11131
11131
|
var n = G(t), r = e.snapshotVersion, i = n.Ui;
|
|
11132
11132
|
return n.persistence.runTransaction("Apply remote event", "readwrite-primary", (function(t) {
|
|
11133
11133
|
var o = n.Gi.newChangeBuffer({
|
|
@@ -11183,7 +11183,7 @@ function wu(t, r) {
|
|
|
11183
11183
|
})),
|
|
11184
11184
|
// Each loop iteration only affects its "own" doc, so it's safe to get all
|
|
11185
11185
|
// the remote documents in advance in a single call.
|
|
11186
|
-
u.push(
|
|
11186
|
+
u.push(Eu(t, o, e.documentUpdates).next((function(t) {
|
|
11187
11187
|
s = t.Wi, a = t.zi;
|
|
11188
11188
|
}))), !r.isEqual(st.min())) {
|
|
11189
11189
|
var c = n.Cs.getLastRemoteSnapshotVersion(t).next((function(e) {
|
|
@@ -11191,7 +11191,7 @@ function wu(t, r) {
|
|
|
11191
11191
|
}));
|
|
11192
11192
|
u.push(c);
|
|
11193
11193
|
}
|
|
11194
|
-
return
|
|
11194
|
+
return _t.waitFor(u).next((function() {
|
|
11195
11195
|
return o.apply(t);
|
|
11196
11196
|
})).next((function() {
|
|
11197
11197
|
return n.localDocuments.getLocalViewOfDocuments(t, s, a);
|
|
@@ -11212,7 +11212,7 @@ function wu(t, r) {
|
|
|
11212
11212
|
* @param documentBuffer - Document buffer to collect the resulted changes to be
|
|
11213
11213
|
* applied to storage.
|
|
11214
11214
|
* @param documents - Documents to be applied.
|
|
11215
|
-
*/ function
|
|
11215
|
+
*/ function Eu(t, e, n) {
|
|
11216
11216
|
var r = pr(), i = pr();
|
|
11217
11217
|
return n.forEach((function(t) {
|
|
11218
11218
|
return r = r.add(t);
|
|
@@ -11272,7 +11272,7 @@ function Su(t, e) {
|
|
|
11272
11272
|
// This target has been listened to previously, so reuse the
|
|
11273
11273
|
// previous targetID.
|
|
11274
11274
|
// TODO(mcg): freshen last accessed date?
|
|
11275
|
-
r = i,
|
|
11275
|
+
r = i, _t.resolve(r)) : n.Cs.allocateTargetId(t).next((function(i) {
|
|
11276
11276
|
return r = new Li(e, i, 0 /* Listen */ , t.currentSequenceNumber), n.Cs.addTargetData(t, r).next((function() {
|
|
11277
11277
|
return r;
|
|
11278
11278
|
}));
|
|
@@ -11300,7 +11300,7 @@ function Su(t, e) {
|
|
|
11300
11300
|
* Releasing a non-existing `Target` is a no-op.
|
|
11301
11301
|
*/
|
|
11302
11302
|
// PORTING NOTE: `keepPersistedTargetData` is multi-tab only.
|
|
11303
|
-
function
|
|
11303
|
+
function xu(t, r, i) {
|
|
11304
11304
|
return e(this, void 0, void 0, (function() {
|
|
11305
11305
|
var e, o, u, s;
|
|
11306
11306
|
return n(this, (function(n) {
|
|
@@ -11343,12 +11343,12 @@ function _u(t, r, i) {
|
|
|
11343
11343
|
*
|
|
11344
11344
|
* @param usePreviousResults - Whether results from previous executions can
|
|
11345
11345
|
* be used to optimize this query execution.
|
|
11346
|
-
*/ function
|
|
11346
|
+
*/ function _u(t, e, n) {
|
|
11347
11347
|
var r = G(t), i = st.min(), o = pr();
|
|
11348
11348
|
return r.persistence.runTransaction("Execute query", "readonly", (function(t) {
|
|
11349
11349
|
return function(t, e, n) {
|
|
11350
11350
|
var r = G(t), i = r.qi.get(n);
|
|
11351
|
-
return void 0 !== i ?
|
|
11351
|
+
return void 0 !== i ? _t.resolve(r.Ui.get(i)) : r.Cs.getTargetData(e, n);
|
|
11352
11352
|
}(r, t, hn(e)).next((function(e) {
|
|
11353
11353
|
if (e) return i = e.lastLimboFreeSnapshotVersion, r.Cs.getMatchingKeysForTargetId(t, e.targetId).next((function(t) {
|
|
11354
11354
|
o = t;
|
|
@@ -11365,7 +11365,7 @@ function _u(t, r, i) {
|
|
|
11365
11365
|
}
|
|
11366
11366
|
|
|
11367
11367
|
// PORTING NOTE: Multi-Tab only.
|
|
11368
|
-
function
|
|
11368
|
+
function Au(t, e) {
|
|
11369
11369
|
var n = G(t), r = G(n.Cs), i = n.Ui.get(e);
|
|
11370
11370
|
return i ? Promise.resolve(i.target) : n.persistence.runTransaction("Get target data", "readonly", (function(t) {
|
|
11371
11371
|
return r.se(t, e).next((function(t) {
|
|
@@ -11381,7 +11381,7 @@ function Nu(t, e) {
|
|
|
11381
11381
|
* since the prior call.
|
|
11382
11382
|
*/
|
|
11383
11383
|
// PORTING NOTE: Multi-Tab only.
|
|
11384
|
-
function
|
|
11384
|
+
function Nu(t, e) {
|
|
11385
11385
|
var n = G(t), r = n.Ki.get(e) || st.min();
|
|
11386
11386
|
// Get the current maximum read time for the collection. This should always
|
|
11387
11387
|
// exist, but to reduce the chance for regressions we default to
|
|
@@ -11437,7 +11437,7 @@ function Cu(t, e, n) {
|
|
|
11437
11437
|
// Allocates a target to hold all document keys from the bundle, such that
|
|
11438
11438
|
// they will not get garbage collected right away.
|
|
11439
11439
|
return p = n.sent(), [ 2 /*return*/ , e.persistence.runTransaction("Apply bundle documents", "readwrite", (function(t) {
|
|
11440
|
-
return
|
|
11440
|
+
return Eu(t, d, s).next((function(e) {
|
|
11441
11441
|
return d.apply(t), e;
|
|
11442
11442
|
})).next((function(n) {
|
|
11443
11443
|
return e.Cs.removeMatchingKeysForTargetId(t, p.targetId).next((function() {
|
|
@@ -11995,16 +11995,16 @@ var Mu = /** @class */ function() {
|
|
|
11995
11995
|
u.setWithCredentials(!0), u.listenOnce(I.COMPLETE, (function() {
|
|
11996
11996
|
try {
|
|
11997
11997
|
switch (u.getLastErrorCode()) {
|
|
11998
|
-
case
|
|
11998
|
+
case T.NO_ERROR:
|
|
11999
11999
|
var e = u.getResponseJson();
|
|
12000
12000
|
L("Connection", "XHR received:", JSON.stringify(e)), i(e);
|
|
12001
12001
|
break;
|
|
12002
12002
|
|
|
12003
|
-
case
|
|
12003
|
+
case T.TIMEOUT:
|
|
12004
12004
|
L("Connection", 'RPC "' + t + '" timed out'), o(new j(K.DEADLINE_EXCEEDED, "Request time out"));
|
|
12005
12005
|
break;
|
|
12006
12006
|
|
|
12007
|
-
case
|
|
12007
|
+
case T.HTTP_ERROR:
|
|
12008
12008
|
var n = u.getStatus();
|
|
12009
12009
|
if (L("Connection", 'RPC "' + t + '" failed with status:', n, "response text:", u.getResponseText()),
|
|
12010
12010
|
n > 0) {
|
|
@@ -12033,7 +12033,7 @@ var Mu = /** @class */ function() {
|
|
|
12033
12033
|
u.send(e, "POST", s, n, 15);
|
|
12034
12034
|
}));
|
|
12035
12035
|
}, n.prototype.wo = function(t, e, n) {
|
|
12036
|
-
var r = [ this.oo, "/", "google.firestore.v1.Firestore", "/", t, "/channel" ], i =
|
|
12036
|
+
var r = [ this.oo, "/", "google.firestore.v1.Firestore", "/", t, "/channel" ], i = E(), o = S(), u = {
|
|
12037
12037
|
// Required for backend stickiness, routing behavior is based on this
|
|
12038
12038
|
// parameter.
|
|
12039
12039
|
httpSessionIdParam: "gsessionid",
|
|
@@ -12100,13 +12100,13 @@ var Mu = /** @class */ function() {
|
|
|
12100
12100
|
// exception and rethrow using a setTimeout so they become visible again.
|
|
12101
12101
|
// Note that eventually this function could go away if we are confident
|
|
12102
12102
|
// enough the code is exception free.
|
|
12103
|
-
return f(a,
|
|
12103
|
+
return f(a, x.EventType.OPEN, (function() {
|
|
12104
12104
|
l || L("Connection", "WebChannel transport opened.");
|
|
12105
|
-
})), f(a,
|
|
12105
|
+
})), f(a, x.EventType.CLOSE, (function() {
|
|
12106
12106
|
l || (l = !0, L("Connection", "WebChannel transport closed"), h.io());
|
|
12107
|
-
})), f(a,
|
|
12107
|
+
})), f(a, x.EventType.ERROR, (function(t) {
|
|
12108
12108
|
l || (l = !0, P("Connection", "WebChannel transport errored:", t), h.io(new j(K.UNAVAILABLE, "The operation could not be completed")));
|
|
12109
|
-
})), f(a,
|
|
12109
|
+
})), f(a, x.EventType.MESSAGE, (function(t) {
|
|
12110
12110
|
var e;
|
|
12111
12111
|
if (!l) {
|
|
12112
12112
|
var n = t.data[0];
|
|
@@ -12138,8 +12138,8 @@ var Mu = /** @class */ function() {
|
|
|
12138
12138
|
l = !0, h.io(new j(u, s)), a.close();
|
|
12139
12139
|
} else L("Connection", "WebChannel received:", n), h.ro(n);
|
|
12140
12140
|
}
|
|
12141
|
-
})), f(o,
|
|
12142
|
-
t.stat ===
|
|
12141
|
+
})), f(o, _.STAT_EVENT, (function(t) {
|
|
12142
|
+
t.stat === A.PROXY ? L("Connection", "Detected buffering proxy") : t.stat === A.NOPROXY && L("Connection", "Detected no buffering proxy");
|
|
12143
12143
|
})), setTimeout((function() {
|
|
12144
12144
|
// Technically we could/should wait for the WebChannel opened event,
|
|
12145
12145
|
// but because we want to send the first message with the WebChannel
|
|
@@ -12266,7 +12266,7 @@ function Hu() {
|
|
|
12266
12266
|
* See the License for the specific language governing permissions and
|
|
12267
12267
|
* limitations under the License.
|
|
12268
12268
|
*/ function Xu(t) {
|
|
12269
|
-
return new
|
|
12269
|
+
return new Ar(t, /* useProto3Json= */ !0);
|
|
12270
12270
|
}
|
|
12271
12271
|
|
|
12272
12272
|
/**
|
|
@@ -12357,14 +12357,14 @@ function Hu() {
|
|
|
12357
12357
|
}, t;
|
|
12358
12358
|
}(), Ju = /** @class */ function() {
|
|
12359
12359
|
function t(t, e, n, r, i, o, u, s) {
|
|
12360
|
-
this.Hs = t, this.vo = n, this.Vo = r, this.
|
|
12360
|
+
this.Hs = t, this.vo = n, this.Vo = r, this.connection = i, this.authCredentialsProvider = o,
|
|
12361
12361
|
this.appCheckCredentialsProvider = u, this.listener = s, this.state = 0 /* Initial */ ,
|
|
12362
12362
|
/**
|
|
12363
12363
|
* A close count that's incremented every time the stream is closed; used by
|
|
12364
12364
|
* getCloseGuardedDispatcher() to invalidate callbacks that happen after
|
|
12365
12365
|
* close.
|
|
12366
12366
|
*/
|
|
12367
|
-
this.
|
|
12367
|
+
this.So = 0, this.Do = null, this.Co = null, this.stream = null, this.xo = new Zu(t, e)
|
|
12368
12368
|
/**
|
|
12369
12369
|
* Returns true if start() has been called and no error has occurred. True
|
|
12370
12370
|
* indicates the stream is open or in the process of opening (which
|
|
@@ -12373,14 +12373,14 @@ function Hu() {
|
|
|
12373
12373
|
* outbound requests.
|
|
12374
12374
|
*/;
|
|
12375
12375
|
}
|
|
12376
|
-
return t.prototype.
|
|
12377
|
-
return 1 /* Starting */ === this.state || 5 /* Backoff */ === this.state || this.
|
|
12376
|
+
return t.prototype.No = function() {
|
|
12377
|
+
return 1 /* Starting */ === this.state || 5 /* Backoff */ === this.state || this.ko();
|
|
12378
12378
|
},
|
|
12379
12379
|
/**
|
|
12380
12380
|
* Returns true if the underlying RPC is open (the onOpen() listener has been
|
|
12381
12381
|
* called) and the stream is ready for outbound requests.
|
|
12382
12382
|
*/
|
|
12383
|
-
t.prototype.
|
|
12383
|
+
t.prototype.ko = function() {
|
|
12384
12384
|
return 2 /* Open */ === this.state || 3 /* Healthy */ === this.state;
|
|
12385
12385
|
},
|
|
12386
12386
|
/**
|
|
@@ -12391,7 +12391,7 @@ function Hu() {
|
|
|
12391
12391
|
* When start returns, isStarted() will return true.
|
|
12392
12392
|
*/
|
|
12393
12393
|
t.prototype.start = function() {
|
|
12394
|
-
4 /* Error */ !== this.state ? this.auth() : this.
|
|
12394
|
+
4 /* Error */ !== this.state ? this.auth() : this.Oo();
|
|
12395
12395
|
},
|
|
12396
12396
|
/**
|
|
12397
12397
|
* Stops the RPC. This call is idempotent and allowed regardless of the
|
|
@@ -12404,7 +12404,7 @@ function Hu() {
|
|
|
12404
12404
|
return n(this, (function(t) {
|
|
12405
12405
|
switch (t.label) {
|
|
12406
12406
|
case 0:
|
|
12407
|
-
return this.
|
|
12407
|
+
return this.No() ? [ 4 /*yield*/ , this.close(0 /* Initial */) ] : [ 3 /*break*/ , 2 ];
|
|
12408
12408
|
|
|
12409
12409
|
case 1:
|
|
12410
12410
|
t.sent(), t.label = 2;
|
|
@@ -12423,8 +12423,8 @@ function Hu() {
|
|
|
12423
12423
|
* Each error will call the onClose() listener. That function can decide to
|
|
12424
12424
|
* inhibit backoff if required.
|
|
12425
12425
|
*/
|
|
12426
|
-
t.prototype.
|
|
12427
|
-
this.state = 0 /* Initial */ , this.
|
|
12426
|
+
t.prototype.Mo = function() {
|
|
12427
|
+
this.state = 0 /* Initial */ , this.xo.reset();
|
|
12428
12428
|
},
|
|
12429
12429
|
/**
|
|
12430
12430
|
* Marks this stream as idle. If no further actions are performed on the
|
|
@@ -12436,29 +12436,29 @@ function Hu() {
|
|
|
12436
12436
|
* Only streams that are in state 'Open' can be marked idle, as all other
|
|
12437
12437
|
* states imply pending network operations.
|
|
12438
12438
|
*/
|
|
12439
|
-
t.prototype
|
|
12439
|
+
t.prototype.Fo = function() {
|
|
12440
12440
|
var t = this;
|
|
12441
12441
|
// Starts the idle time if we are in state 'Open' and are not yet already
|
|
12442
12442
|
// running a timer (in which case the previous idle timeout still applies).
|
|
12443
|
-
this.
|
|
12444
|
-
return t
|
|
12443
|
+
this.ko() && null === this.Do && (this.Do = this.Hs.enqueueAfterDelay(this.vo, 6e4, (function() {
|
|
12444
|
+
return t.$o();
|
|
12445
12445
|
})));
|
|
12446
12446
|
},
|
|
12447
|
-
/** Sends a message to the underlying stream. */ t.prototype.
|
|
12448
|
-
this.
|
|
12447
|
+
/** Sends a message to the underlying stream. */ t.prototype.Bo = function(t) {
|
|
12448
|
+
this.Lo(), this.stream.send(t);
|
|
12449
12449
|
},
|
|
12450
|
-
/** Called by the idle timer when the stream should close due to inactivity. */ t.prototype
|
|
12450
|
+
/** Called by the idle timer when the stream should close due to inactivity. */ t.prototype.$o = function() {
|
|
12451
12451
|
return e(this, void 0, void 0, (function() {
|
|
12452
12452
|
return n(this, (function(t) {
|
|
12453
|
-
return this.
|
|
12453
|
+
return this.ko() ? [ 2 /*return*/ , this.close(0 /* Initial */) ] : [ 2 /*return*/ ];
|
|
12454
12454
|
}));
|
|
12455
12455
|
}));
|
|
12456
12456
|
},
|
|
12457
|
-
/** Marks the stream as active again. */ t.prototype.
|
|
12458
|
-
this.
|
|
12457
|
+
/** Marks the stream as active again. */ t.prototype.Lo = function() {
|
|
12458
|
+
this.Do && (this.Do.cancel(), this.Do = null);
|
|
12459
12459
|
},
|
|
12460
|
-
/** Cancels the health check delayed operation. */ t.prototype.
|
|
12461
|
-
this.
|
|
12460
|
+
/** Cancels the health check delayed operation. */ t.prototype.Uo = function() {
|
|
12461
|
+
this.Co && (this.Co.cancel(), this.Co = null);
|
|
12462
12462
|
},
|
|
12463
12463
|
/**
|
|
12464
12464
|
* Closes the stream and cleans up as necessary:
|
|
@@ -12480,15 +12480,15 @@ function Hu() {
|
|
|
12480
12480
|
case 0:
|
|
12481
12481
|
// Notify the listener that the stream closed.
|
|
12482
12482
|
// Cancel any outstanding timers (they're guaranteed not to execute).
|
|
12483
|
-
return this.
|
|
12483
|
+
return this.Lo(), this.Uo(), this.xo.cancel(),
|
|
12484
12484
|
// Invalidates any stream-related callbacks (e.g. from auth or the
|
|
12485
12485
|
// underlying stream), guaranteeing they won't execute.
|
|
12486
|
-
this.
|
|
12486
|
+
this.So++, 4 /* Error */ !== t ?
|
|
12487
12487
|
// If this is an intentional close ensure we don't delay our next connection attempt.
|
|
12488
|
-
this.
|
|
12488
|
+
this.xo.reset() : r && r.code === K.RESOURCE_EXHAUSTED ? (
|
|
12489
12489
|
// Log the error. (Probably either 'quota exceeded' or 'max queue length reached'.)
|
|
12490
12490
|
M(r.toString()), M("Using maximum backoff delay to prevent overloading the backend."),
|
|
12491
|
-
this.
|
|
12491
|
+
this.xo.Ao()) : r && r.code === K.UNAUTHENTICATED && 3 /* Healthy */ !== this.state && (
|
|
12492
12492
|
// "unauthenticated" error means the token was rejected. This should rarely
|
|
12493
12493
|
// happen since both Auth and AppCheck ensure a sufficient TTL when we
|
|
12494
12494
|
// request a token. If a user manually resets their system clock this can
|
|
@@ -12497,7 +12497,7 @@ function Hu() {
|
|
|
12497
12497
|
// to ensure that we fetch a new token.
|
|
12498
12498
|
this.authCredentialsProvider.invalidateToken(), this.appCheckCredentialsProvider.invalidateToken()),
|
|
12499
12499
|
// Clean up the underlying stream because we are no longer interested in events.
|
|
12500
|
-
null !== this.stream && (this.
|
|
12500
|
+
null !== this.stream && (this.qo(), this.stream.close(), this.stream = null),
|
|
12501
12501
|
// This state must be assigned before calling onClose() to allow the callback to
|
|
12502
12502
|
// inhibit backoff or otherwise manipulate the state in its non-started state.
|
|
12503
12503
|
this.state = t, [ 4 /*yield*/ , this.listener.Zr(r) ];
|
|
@@ -12514,10 +12514,10 @@ function Hu() {
|
|
|
12514
12514
|
* Can be overridden to perform additional cleanup before the stream is closed.
|
|
12515
12515
|
* Calling super.tearDown() is not required.
|
|
12516
12516
|
*/
|
|
12517
|
-
t.prototype.
|
|
12517
|
+
t.prototype.qo = function() {}, t.prototype.auth = function() {
|
|
12518
12518
|
var t = this;
|
|
12519
12519
|
this.state = 1 /* Starting */;
|
|
12520
|
-
var e = this.
|
|
12520
|
+
var e = this.Ko(this.So), n = this.So;
|
|
12521
12521
|
// TODO(mikelehen): Just use dispatchIfNotClosed, but see TODO below.
|
|
12522
12522
|
Promise.all([ this.authCredentialsProvider.getToken(), this.appCheckCredentialsProvider.getToken() ]).then((function(e) {
|
|
12523
12523
|
var r = e[0], i = e[1];
|
|
@@ -12525,37 +12525,37 @@ function Hu() {
|
|
|
12525
12525
|
// TODO(mikelehen): We really should just use dispatchIfNotClosed
|
|
12526
12526
|
// and let this dispatch onto the queue, but that opened a spec test can
|
|
12527
12527
|
// of worms that I don't want to deal with in this PR.
|
|
12528
|
-
t.
|
|
12528
|
+
t.So === n &&
|
|
12529
12529
|
// Normally we'd have to schedule the callback on the AsyncQueue.
|
|
12530
12530
|
// However, the following calls are safe to be called outside the
|
|
12531
12531
|
// AsyncQueue since they don't chain asynchronous calls
|
|
12532
|
-
t.
|
|
12532
|
+
t.Go(r, i);
|
|
12533
12533
|
}), (function(n) {
|
|
12534
12534
|
e((function() {
|
|
12535
12535
|
var e = new j(K.UNKNOWN, "Fetching auth token failed: " + n.message);
|
|
12536
|
-
return t.
|
|
12536
|
+
return t.Qo(e);
|
|
12537
12537
|
}));
|
|
12538
12538
|
}));
|
|
12539
|
-
}, t.prototype.
|
|
12540
|
-
var n = this, r = this.
|
|
12541
|
-
this.stream = this.
|
|
12539
|
+
}, t.prototype.Go = function(t, e) {
|
|
12540
|
+
var n = this, r = this.Ko(this.So);
|
|
12541
|
+
this.stream = this.jo(t, e), this.stream.Yr((function() {
|
|
12542
12542
|
r((function() {
|
|
12543
|
-
return n.state = 2 /* Open */ , n.
|
|
12544
|
-
return n.
|
|
12543
|
+
return n.state = 2 /* Open */ , n.Co = n.Hs.enqueueAfterDelay(n.Vo, 1e4, (function() {
|
|
12544
|
+
return n.ko() && (n.state = 3 /* Healthy */), Promise.resolve();
|
|
12545
12545
|
})), n.listener.Yr();
|
|
12546
12546
|
}));
|
|
12547
12547
|
})), this.stream.Zr((function(t) {
|
|
12548
12548
|
r((function() {
|
|
12549
|
-
return n.
|
|
12549
|
+
return n.Qo(t);
|
|
12550
12550
|
}));
|
|
12551
12551
|
})), this.stream.onMessage((function(t) {
|
|
12552
12552
|
r((function() {
|
|
12553
12553
|
return n.onMessage(t);
|
|
12554
12554
|
}));
|
|
12555
12555
|
}));
|
|
12556
|
-
}, t.prototype.
|
|
12556
|
+
}, t.prototype.Oo = function() {
|
|
12557
12557
|
var t = this;
|
|
12558
|
-
this.state = 5 /* Backoff */ , this.
|
|
12558
|
+
this.state = 5 /* Backoff */ , this.xo.Ro((function() {
|
|
12559
12559
|
return e(t, void 0, void 0, (function() {
|
|
12560
12560
|
return n(this, (function(t) {
|
|
12561
12561
|
return this.state = 0 /* Initial */ , this.start(), [ 2 /*return*/ ];
|
|
@@ -12564,7 +12564,7 @@ function Hu() {
|
|
|
12564
12564
|
}));
|
|
12565
12565
|
},
|
|
12566
12566
|
// Visible for tests
|
|
12567
|
-
t.prototype.
|
|
12567
|
+
t.prototype.Qo = function(t) {
|
|
12568
12568
|
// In theory the stream could close cleanly, however, in our current model
|
|
12569
12569
|
// we never expect this to happen because if we stop a stream ourselves,
|
|
12570
12570
|
// this callback will never be called. To prevent cases where we retry
|
|
@@ -12577,11 +12577,11 @@ function Hu() {
|
|
|
12577
12577
|
* us to turn auth / stream callbacks into no-ops if the stream is closed /
|
|
12578
12578
|
* re-opened, etc.
|
|
12579
12579
|
*/
|
|
12580
|
-
t.prototype.
|
|
12580
|
+
t.prototype.Ko = function(t) {
|
|
12581
12581
|
var e = this;
|
|
12582
12582
|
return function(n) {
|
|
12583
12583
|
e.Hs.enqueueAndForget((function() {
|
|
12584
|
-
return e.
|
|
12584
|
+
return e.So === t ? n() : (L("PersistentStream", "stream callback skipped by getCloseGuardedDispatcher."),
|
|
12585
12585
|
Promise.resolve());
|
|
12586
12586
|
}));
|
|
12587
12587
|
};
|
|
@@ -12592,11 +12592,11 @@ function Hu() {
|
|
|
12592
12592
|
return (s = e.call(this, t, "listen_stream_connection_backoff" /* ListenStreamConnectionBackoff */ , "listen_stream_idle" /* ListenStreamIdle */ , "health_check_timeout" /* HealthCheckTimeout */ , n, r, i, u) || this).It = o,
|
|
12593
12593
|
s;
|
|
12594
12594
|
}
|
|
12595
|
-
return t(n, e), n.prototype.
|
|
12596
|
-
return this.
|
|
12595
|
+
return t(n, e), n.prototype.jo = function(t, e) {
|
|
12596
|
+
return this.connection.wo("Listen", t, e);
|
|
12597
12597
|
}, n.prototype.onMessage = function(t) {
|
|
12598
12598
|
// A successful response means the stream is healthy
|
|
12599
|
-
this.
|
|
12599
|
+
this.xo.reset();
|
|
12600
12600
|
var e = function(t, e) {
|
|
12601
12601
|
var n;
|
|
12602
12602
|
if ("targetChange" in e) {
|
|
@@ -12633,15 +12633,15 @@ function Hu() {
|
|
|
12633
12633
|
e.documentRemove;
|
|
12634
12634
|
var b = e.documentRemove;
|
|
12635
12635
|
b.document;
|
|
12636
|
-
var I = Mr(t, b.document),
|
|
12637
|
-
n = new wr([],
|
|
12636
|
+
var I = Mr(t, b.document), T = b.removedTargetIds || [];
|
|
12637
|
+
n = new wr([], T, I, null);
|
|
12638
12638
|
} else {
|
|
12639
12639
|
if (!("filter" in e)) return q();
|
|
12640
12640
|
e.filter;
|
|
12641
|
-
var
|
|
12642
|
-
|
|
12643
|
-
var S =
|
|
12644
|
-
n = new br(
|
|
12641
|
+
var E = e.filter;
|
|
12642
|
+
E.targetId;
|
|
12643
|
+
var S = E.count || 0, D = new tr(S), x = E.targetId;
|
|
12644
|
+
n = new br(x, D);
|
|
12645
12645
|
}
|
|
12646
12646
|
return n;
|
|
12647
12647
|
}(this.It, t), n = function(t) {
|
|
@@ -12652,7 +12652,7 @@ function Hu() {
|
|
|
12652
12652
|
var e = t.targetChange;
|
|
12653
12653
|
return e.targetIds && e.targetIds.length ? st.min() : e.readTime ? Or(e.readTime) : st.min();
|
|
12654
12654
|
}(t);
|
|
12655
|
-
return this.listener.
|
|
12655
|
+
return this.listener.Wo(e, n);
|
|
12656
12656
|
},
|
|
12657
12657
|
/**
|
|
12658
12658
|
* Registers interest in the results of the given target. If the target
|
|
@@ -12660,7 +12660,7 @@ function Hu() {
|
|
|
12660
12660
|
* affect the target will be streamed back as WatchChange messages that
|
|
12661
12661
|
* reference the targetId.
|
|
12662
12662
|
*/
|
|
12663
|
-
n.prototype.
|
|
12663
|
+
n.prototype.zo = function(t) {
|
|
12664
12664
|
var e = {};
|
|
12665
12665
|
e.database = qr(this.It), e.addTarget = function(t, e) {
|
|
12666
12666
|
var n, r = e.target;
|
|
@@ -12672,7 +12672,7 @@ function Hu() {
|
|
|
12672
12672
|
// TODO(wuandy): Consider removing above check because it is most likely true.
|
|
12673
12673
|
// Right now, many tests depend on this behaviour though (leaving min() out
|
|
12674
12674
|
// of serialization).
|
|
12675
|
-
n.readTime =
|
|
12675
|
+
n.readTime = Nr(t, e.snapshotVersion.toTimestamp())), n;
|
|
12676
12676
|
}(this.It, t);
|
|
12677
12677
|
var n = function(t, e) {
|
|
12678
12678
|
var n = function(t, e) {
|
|
@@ -12694,48 +12694,48 @@ function Hu() {
|
|
|
12694
12694
|
"goog-listen-tags": n
|
|
12695
12695
|
};
|
|
12696
12696
|
}(this.It, t);
|
|
12697
|
-
n && (e.labels = n), this.
|
|
12697
|
+
n && (e.labels = n), this.Bo(e);
|
|
12698
12698
|
},
|
|
12699
12699
|
/**
|
|
12700
12700
|
* Unregisters interest in the results of the target associated with the
|
|
12701
12701
|
* given targetId.
|
|
12702
12702
|
*/
|
|
12703
|
-
n.prototype.
|
|
12703
|
+
n.prototype.Ho = function(t) {
|
|
12704
12704
|
var e = {};
|
|
12705
|
-
e.database = qr(this.It), e.removeTarget = t, this.
|
|
12705
|
+
e.database = qr(this.It), e.removeTarget = t, this.Bo(e);
|
|
12706
12706
|
}, n;
|
|
12707
12707
|
}(Ju), ts = /** @class */ function(e) {
|
|
12708
12708
|
function n(t, n, r, i, o, u) {
|
|
12709
12709
|
var s = this;
|
|
12710
12710
|
return (s = e.call(this, t, "write_stream_connection_backoff" /* WriteStreamConnectionBackoff */ , "write_stream_idle" /* WriteStreamIdle */ , "health_check_timeout" /* HealthCheckTimeout */ , n, r, i, u) || this).It = o,
|
|
12711
|
-
s.
|
|
12711
|
+
s.Jo = !1, s;
|
|
12712
12712
|
}
|
|
12713
|
-
return t(n, e), Object.defineProperty(n.prototype, "
|
|
12713
|
+
return t(n, e), Object.defineProperty(n.prototype, "Yo", {
|
|
12714
12714
|
/**
|
|
12715
12715
|
* Tracks whether or not a handshake has been successfully exchanged and
|
|
12716
12716
|
* the stream is ready to accept mutations.
|
|
12717
12717
|
*/
|
|
12718
12718
|
get: function() {
|
|
12719
|
-
return this.
|
|
12719
|
+
return this.Jo;
|
|
12720
12720
|
},
|
|
12721
12721
|
enumerable: !1,
|
|
12722
12722
|
configurable: !0
|
|
12723
12723
|
}),
|
|
12724
12724
|
// Override of PersistentStream.start
|
|
12725
12725
|
n.prototype.start = function() {
|
|
12726
|
-
this.
|
|
12727
|
-
}, n.prototype.
|
|
12728
|
-
this.
|
|
12729
|
-
}, n.prototype.
|
|
12730
|
-
return this.
|
|
12726
|
+
this.Jo = !1, this.lastStreamToken = void 0, e.prototype.start.call(this);
|
|
12727
|
+
}, n.prototype.qo = function() {
|
|
12728
|
+
this.Jo && this.Xo([]);
|
|
12729
|
+
}, n.prototype.jo = function(t, e) {
|
|
12730
|
+
return this.connection.wo("Write", t, e);
|
|
12731
12731
|
}, n.prototype.onMessage = function(t) {
|
|
12732
12732
|
if (
|
|
12733
12733
|
// Always capture the last stream token.
|
|
12734
|
-
U(!!t.streamToken), this.lastStreamToken = t.streamToken, this.
|
|
12734
|
+
U(!!t.streamToken), this.lastStreamToken = t.streamToken, this.Jo) {
|
|
12735
12735
|
// A successful first write response means the stream is healthy,
|
|
12736
12736
|
// Note, that we could consider a successful handshake healthy, however,
|
|
12737
12737
|
// the write itself might be causing an error we want to back off from.
|
|
12738
|
-
this.
|
|
12738
|
+
this.xo.reset();
|
|
12739
12739
|
var e = function(t, e) {
|
|
12740
12740
|
return t && t.length > 0 ? (U(void 0 !== e), t.map((function(t) {
|
|
12741
12741
|
return function(t, e) {
|
|
@@ -12751,46 +12751,46 @@ function Hu() {
|
|
|
12751
12751
|
}(t, e);
|
|
12752
12752
|
}))) : [];
|
|
12753
12753
|
}(t.writeResults, t.commitTime), n = Or(t.commitTime);
|
|
12754
|
-
return this.listener.
|
|
12754
|
+
return this.listener.Zo(n, e);
|
|
12755
12755
|
}
|
|
12756
12756
|
// The first response is always the handshake response
|
|
12757
|
-
return U(!t.writeResults || 0 === t.writeResults.length), this.
|
|
12758
|
-
this.listener.
|
|
12757
|
+
return U(!t.writeResults || 0 === t.writeResults.length), this.Jo = !0,
|
|
12758
|
+
this.listener.tu();
|
|
12759
12759
|
},
|
|
12760
12760
|
/**
|
|
12761
12761
|
* Sends an initial streamToken to the server, performing the handshake
|
|
12762
12762
|
* required to make the StreamingWrite RPC work. Subsequent
|
|
12763
12763
|
* calls should wait until onHandshakeComplete was called.
|
|
12764
12764
|
*/
|
|
12765
|
-
n.prototype.
|
|
12765
|
+
n.prototype.eu = function() {
|
|
12766
12766
|
// TODO(dimond): Support stream resumption. We intentionally do not set the
|
|
12767
12767
|
// stream token on the handshake, ignoring any stream token we might have.
|
|
12768
12768
|
var t = {};
|
|
12769
|
-
t.database = qr(this.It), this.
|
|
12769
|
+
t.database = qr(this.It), this.Bo(t);
|
|
12770
12770
|
},
|
|
12771
|
-
/** Sends a group of mutations to the Firestore backend to apply. */ n.prototype.
|
|
12771
|
+
/** Sends a group of mutations to the Firestore backend to apply. */ n.prototype.Xo = function(t) {
|
|
12772
12772
|
var e = this, n = {
|
|
12773
12773
|
streamToken: this.lastStreamToken,
|
|
12774
12774
|
writes: t.map((function(t) {
|
|
12775
12775
|
return Kr(e.It, t);
|
|
12776
12776
|
}))
|
|
12777
12777
|
};
|
|
12778
|
-
this.
|
|
12778
|
+
this.Bo(n);
|
|
12779
12779
|
}, n;
|
|
12780
12780
|
}(Ju), es = /** @class */ function(e) {
|
|
12781
12781
|
function n(t, n, r, i) {
|
|
12782
12782
|
var o = this;
|
|
12783
12783
|
return (o = e.call(this) || this).authCredentials = t, o.appCheckCredentials = n,
|
|
12784
|
-
o.
|
|
12784
|
+
o.connection = r, o.It = i, o.nu = !1, o;
|
|
12785
12785
|
}
|
|
12786
|
-
return t(n, e), n.prototype.
|
|
12787
|
-
if (this.
|
|
12786
|
+
return t(n, e), n.prototype.su = function() {
|
|
12787
|
+
if (this.nu) throw new j(K.FAILED_PRECONDITION, "The client has already been terminated.");
|
|
12788
12788
|
},
|
|
12789
12789
|
/** Invokes the provided RPC with auth and AppCheck tokens. */ n.prototype.ao = function(t, e, n) {
|
|
12790
12790
|
var r = this;
|
|
12791
|
-
return this.
|
|
12791
|
+
return this.su(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((function(i) {
|
|
12792
12792
|
var o = i[0], u = i[1];
|
|
12793
|
-
return r.
|
|
12793
|
+
return r.connection.ao(t, e, n, o, u);
|
|
12794
12794
|
})).catch((function(t) {
|
|
12795
12795
|
throw "FirebaseError" === t.name ? (t.code === K.UNAUTHENTICATED && (r.authCredentials.invalidateToken(),
|
|
12796
12796
|
r.appCheckCredentials.invalidateToken()), t) : new j(K.UNKNOWN, t.toString());
|
|
@@ -12798,15 +12798,15 @@ function Hu() {
|
|
|
12798
12798
|
},
|
|
12799
12799
|
/** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ n.prototype._o = function(t, e, n, r) {
|
|
12800
12800
|
var i = this;
|
|
12801
|
-
return this.
|
|
12801
|
+
return this.su(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((function(o) {
|
|
12802
12802
|
var u = o[0], s = o[1];
|
|
12803
|
-
return i.
|
|
12803
|
+
return i.connection._o(t, e, n, u, s, r);
|
|
12804
12804
|
})).catch((function(t) {
|
|
12805
12805
|
throw "FirebaseError" === t.name ? (t.code === K.UNAUTHENTICATED && (i.authCredentials.invalidateToken(),
|
|
12806
12806
|
i.appCheckCredentials.invalidateToken()), t) : new j(K.UNKNOWN, t.toString());
|
|
12807
12807
|
}));
|
|
12808
12808
|
}, n.prototype.terminate = function() {
|
|
12809
|
-
this.
|
|
12809
|
+
this.nu = !0;
|
|
12810
12810
|
}, n;
|
|
12811
12811
|
}((function() {}));
|
|
12812
12812
|
|
|
@@ -12879,19 +12879,19 @@ var ns = /** @class */ function() {
|
|
|
12879
12879
|
* maximum defined by MAX_WATCH_STREAM_FAILURES, we'll set the OnlineState to
|
|
12880
12880
|
* Offline.
|
|
12881
12881
|
*/
|
|
12882
|
-
this.
|
|
12882
|
+
this.iu = 0,
|
|
12883
12883
|
/**
|
|
12884
12884
|
* A timer that elapses after ONLINE_STATE_TIMEOUT_MS, at which point we
|
|
12885
12885
|
* transition from OnlineState.Unknown to OnlineState.Offline without waiting
|
|
12886
12886
|
* for the stream to actually fail (MAX_WATCH_STREAM_FAILURES times).
|
|
12887
12887
|
*/
|
|
12888
|
-
this.
|
|
12888
|
+
this.ru = null,
|
|
12889
12889
|
/**
|
|
12890
12890
|
* Whether the client should log a warning message if it fails to connect to
|
|
12891
12891
|
* the backend (initially true, cleared after a successful stream, or if we've
|
|
12892
12892
|
* logged the message already).
|
|
12893
12893
|
*/
|
|
12894
|
-
this.
|
|
12894
|
+
this.ou = !0
|
|
12895
12895
|
/**
|
|
12896
12896
|
* Called by RemoteStore when a watch stream is started (including on each
|
|
12897
12897
|
* backoff attempt).
|
|
@@ -12900,10 +12900,10 @@ var ns = /** @class */ function() {
|
|
|
12900
12900
|
* the onlineStateTimer.
|
|
12901
12901
|
*/;
|
|
12902
12902
|
}
|
|
12903
|
-
return t.prototype.
|
|
12903
|
+
return t.prototype.uu = function() {
|
|
12904
12904
|
var t = this;
|
|
12905
|
-
0 === this.
|
|
12906
|
-
return t.
|
|
12905
|
+
0 === this.iu && (this.cu("Unknown" /* Unknown */), this.ru = this.asyncQueue.enqueueAfterDelay("online_state_timeout" /* OnlineStateTimeout */ , 1e4, (function() {
|
|
12906
|
+
return t.ru = null, t.au("Backend didn't respond within 10 seconds."), t.cu("Offline" /* Offline */),
|
|
12907
12907
|
Promise.resolve();
|
|
12908
12908
|
})));
|
|
12909
12909
|
},
|
|
@@ -12913,10 +12913,10 @@ var ns = /** @class */ function() {
|
|
|
12913
12913
|
* allow multiple failures (based on MAX_WATCH_STREAM_FAILURES) before we
|
|
12914
12914
|
* actually transition to the 'Offline' state.
|
|
12915
12915
|
*/
|
|
12916
|
-
t.prototype.
|
|
12917
|
-
"Online" /* Online */ === this.state ? this.
|
|
12918
|
-
this.
|
|
12919
|
-
this.
|
|
12916
|
+
t.prototype.hu = function(t) {
|
|
12917
|
+
"Online" /* Online */ === this.state ? this.cu("Unknown" /* Unknown */) : (this.iu++,
|
|
12918
|
+
this.iu >= 1 && (this.lu(), this.au("Connection failed 1 times. Most recent error: " + t.toString()),
|
|
12919
|
+
this.cu("Offline" /* Offline */)));
|
|
12920
12920
|
},
|
|
12921
12921
|
/**
|
|
12922
12922
|
* Explicitly sets the OnlineState to the specified state.
|
|
@@ -12926,17 +12926,17 @@ var ns = /** @class */ function() {
|
|
|
12926
12926
|
* handleWatchStreamStart() and handleWatchStreamFailure().
|
|
12927
12927
|
*/
|
|
12928
12928
|
t.prototype.set = function(t) {
|
|
12929
|
-
this.
|
|
12929
|
+
this.lu(), this.iu = 0, "Online" /* Online */ === t && (
|
|
12930
12930
|
// We've connected to watch at least once. Don't warn the developer
|
|
12931
12931
|
// about being offline going forward.
|
|
12932
|
-
this.
|
|
12933
|
-
}, t.prototype.
|
|
12932
|
+
this.ou = !1), this.cu(t);
|
|
12933
|
+
}, t.prototype.cu = function(t) {
|
|
12934
12934
|
t !== this.state && (this.state = t, this.onlineStateHandler(t));
|
|
12935
|
-
}, t.prototype.
|
|
12935
|
+
}, t.prototype.au = function(t) {
|
|
12936
12936
|
var e = "Could not reach Cloud Firestore backend. " + t + "\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.";
|
|
12937
|
-
this.
|
|
12938
|
-
}, t.prototype.
|
|
12939
|
-
null !== this.
|
|
12937
|
+
this.ou ? (M(e), this.ou = !1) : L("OnlineStateTracker", e);
|
|
12938
|
+
}, t.prototype.lu = function() {
|
|
12939
|
+
null !== this.ru && (this.ru.cancel(), this.ru = null);
|
|
12940
12940
|
}, t;
|
|
12941
12941
|
}(), rs = function(
|
|
12942
12942
|
/**
|
|
@@ -12964,7 +12964,7 @@ r, i, o, u) {
|
|
|
12964
12964
|
* purely based on order, and so we can just shift() writes from the front of
|
|
12965
12965
|
* the writePipeline as we receive responses.
|
|
12966
12966
|
*/
|
|
12967
|
-
this.
|
|
12967
|
+
this.fu = [],
|
|
12968
12968
|
/**
|
|
12969
12969
|
* A mapping of watched targets that the client cares about tracking and the
|
|
12970
12970
|
* user has explicitly called a 'listen' for this target.
|
|
@@ -12974,12 +12974,12 @@ r, i, o, u) {
|
|
|
12974
12974
|
* to the server. The targets removed with unlistens are removed eagerly
|
|
12975
12975
|
* without waiting for confirmation from the listen stream.
|
|
12976
12976
|
*/
|
|
12977
|
-
this.
|
|
12977
|
+
this.du = new Map,
|
|
12978
12978
|
/**
|
|
12979
12979
|
* A set of reasons for why the RemoteStore may be offline. If empty, the
|
|
12980
12980
|
* RemoteStore may start its network connections.
|
|
12981
12981
|
*/
|
|
12982
|
-
this.
|
|
12982
|
+
this._u = new Set,
|
|
12983
12983
|
/**
|
|
12984
12984
|
* Event handlers that get called when the network is disabled or enabled.
|
|
12985
12985
|
*
|
|
@@ -12987,7 +12987,7 @@ r, i, o, u) {
|
|
|
12987
12987
|
* underlying streams (to support tree-shakeable streams). On Android and iOS,
|
|
12988
12988
|
* the streams are created during construction of RemoteStore.
|
|
12989
12989
|
*/
|
|
12990
|
-
this.
|
|
12990
|
+
this.wu = [], this.mu = u, this.mu.qr((function(t) {
|
|
12991
12991
|
i.enqueueAndForget((function() {
|
|
12992
12992
|
return e(s, void 0, void 0, (function() {
|
|
12993
12993
|
return n(this, (function(t) {
|
|
@@ -13000,10 +13000,10 @@ r, i, o, u) {
|
|
|
13000
13000
|
return n(this, (function(n) {
|
|
13001
13001
|
switch (n.label) {
|
|
13002
13002
|
case 0:
|
|
13003
|
-
return (e = G(t)).
|
|
13003
|
+
return (e = G(t))._u.add(4 /* ConnectivityChange */), [ 4 /*yield*/ , os(e) ];
|
|
13004
13004
|
|
|
13005
13005
|
case 1:
|
|
13006
|
-
return n.sent(), e.
|
|
13006
|
+
return n.sent(), e.gu.set("Unknown" /* Unknown */), e._u.delete(4 /* ConnectivityChange */),
|
|
13007
13007
|
[ 4 /*yield*/ , is(e) ];
|
|
13008
13008
|
|
|
13009
13009
|
case 2:
|
|
@@ -13022,7 +13022,7 @@ r, i, o, u) {
|
|
|
13022
13022
|
}));
|
|
13023
13023
|
}));
|
|
13024
13024
|
}));
|
|
13025
|
-
})), this.
|
|
13025
|
+
})), this.gu = new ns(i, o);
|
|
13026
13026
|
};
|
|
13027
13027
|
|
|
13028
13028
|
/**
|
|
@@ -13047,7 +13047,7 @@ r, i, o, u) {
|
|
|
13047
13047
|
switch (n.label) {
|
|
13048
13048
|
case 0:
|
|
13049
13049
|
if (!fs(t)) return [ 3 /*break*/ , 4 ];
|
|
13050
|
-
e = 0, r = t.
|
|
13050
|
+
e = 0, r = t.wu, n.label = 1;
|
|
13051
13051
|
|
|
13052
13052
|
case 1:
|
|
13053
13053
|
return e < r.length ? [ 4 /*yield*/ , (0, r[e])(/* enabled= */ !0) ] : [ 3 /*break*/ , 4 ];
|
|
@@ -13074,7 +13074,7 @@ r, i, o, u) {
|
|
|
13074
13074
|
return n(this, (function(n) {
|
|
13075
13075
|
switch (n.label) {
|
|
13076
13076
|
case 0:
|
|
13077
|
-
e = 0, r = t.
|
|
13077
|
+
e = 0, r = t.wu, n.label = 1;
|
|
13078
13078
|
|
|
13079
13079
|
case 1:
|
|
13080
13080
|
return e < r.length ? [ 4 /*yield*/ , (0, r[e])(/* enabled= */ !1) ] : [ 3 /*break*/ , 4 ];
|
|
@@ -13097,30 +13097,30 @@ r, i, o, u) {
|
|
|
13097
13097
|
* is a no-op if the target of given `TargetData` is already being listened to.
|
|
13098
13098
|
*/ function us(t, e) {
|
|
13099
13099
|
var n = G(t);
|
|
13100
|
-
n.
|
|
13100
|
+
n.du.has(e.targetId) || (
|
|
13101
13101
|
// Mark this as something the client is currently listening for.
|
|
13102
|
-
n.
|
|
13102
|
+
n.du.set(e.targetId, e), hs(n) ?
|
|
13103
13103
|
// The listen will be sent in onWatchStreamOpen
|
|
13104
|
-
ls(n) :
|
|
13104
|
+
ls(n) : As(n).ko() && as(n, e));
|
|
13105
13105
|
}
|
|
13106
13106
|
|
|
13107
13107
|
/**
|
|
13108
13108
|
* Removes the listen from server. It is a no-op if the given target id is
|
|
13109
13109
|
* not being listened to.
|
|
13110
13110
|
*/ function ss(t, e) {
|
|
13111
|
-
var n = G(t), r =
|
|
13112
|
-
n.
|
|
13111
|
+
var n = G(t), r = As(n);
|
|
13112
|
+
n.du.delete(e), r.ko() && cs(n, e), 0 === n.du.size && (r.ko() ? r.Fo() : fs(n) &&
|
|
13113
13113
|
// Revert to OnlineState.Unknown if the watch stream is not open and we
|
|
13114
13114
|
// have no listeners, since without any listens to send we cannot
|
|
13115
13115
|
// confirm if the stream is healthy and upgrade to OnlineState.Online.
|
|
13116
|
-
n.
|
|
13116
|
+
n.gu.set("Unknown" /* Unknown */));
|
|
13117
13117
|
}
|
|
13118
13118
|
|
|
13119
13119
|
/**
|
|
13120
13120
|
* We need to increment the the expected number of pending responses we're due
|
|
13121
13121
|
* from watch so we wait for the ack to process any messages from this target.
|
|
13122
13122
|
*/ function as(t, e) {
|
|
13123
|
-
t.
|
|
13123
|
+
t.yu.Mt(e.targetId), As(t).zo(e)
|
|
13124
13124
|
/**
|
|
13125
13125
|
* We need to increment the expected number of pending responses we're due
|
|
13126
13126
|
* from watch so we wait for the removal on the server before we process any
|
|
@@ -13129,18 +13129,18 @@ r, i, o, u) {
|
|
|
13129
13129
|
}
|
|
13130
13130
|
|
|
13131
13131
|
function cs(t, e) {
|
|
13132
|
-
t.
|
|
13132
|
+
t.yu.Mt(e), As(t).Ho(e);
|
|
13133
13133
|
}
|
|
13134
13134
|
|
|
13135
13135
|
function ls(t) {
|
|
13136
|
-
t.
|
|
13136
|
+
t.yu = new Er({
|
|
13137
13137
|
getRemoteKeysForTarget: function(e) {
|
|
13138
13138
|
return t.remoteSyncer.getRemoteKeysForTarget(e);
|
|
13139
13139
|
},
|
|
13140
13140
|
se: function(e) {
|
|
13141
|
-
return t.
|
|
13141
|
+
return t.du.get(e) || null;
|
|
13142
13142
|
}
|
|
13143
|
-
}),
|
|
13143
|
+
}), As(t).start(), t.gu.uu()
|
|
13144
13144
|
/**
|
|
13145
13145
|
* Returns whether the watch stream should be started because it's necessary
|
|
13146
13146
|
* and has not yet been started.
|
|
@@ -13148,21 +13148,21 @@ function ls(t) {
|
|
|
13148
13148
|
}
|
|
13149
13149
|
|
|
13150
13150
|
function hs(t) {
|
|
13151
|
-
return fs(t) && !
|
|
13151
|
+
return fs(t) && !As(t).No() && t.du.size > 0;
|
|
13152
13152
|
}
|
|
13153
13153
|
|
|
13154
13154
|
function fs(t) {
|
|
13155
|
-
return 0 === G(t).
|
|
13155
|
+
return 0 === G(t)._u.size;
|
|
13156
13156
|
}
|
|
13157
13157
|
|
|
13158
13158
|
function ds(t) {
|
|
13159
|
-
t.
|
|
13159
|
+
t.yu = void 0;
|
|
13160
13160
|
}
|
|
13161
13161
|
|
|
13162
13162
|
function ps(t) {
|
|
13163
13163
|
return e(this, void 0, void 0, (function() {
|
|
13164
13164
|
return n(this, (function(e) {
|
|
13165
|
-
return t.
|
|
13165
|
+
return t.du.forEach((function(e, n) {
|
|
13166
13166
|
as(t, e);
|
|
13167
13167
|
})), [ 2 /*return*/ ];
|
|
13168
13168
|
}));
|
|
@@ -13174,11 +13174,11 @@ function vs(t, r) {
|
|
|
13174
13174
|
return n(this, (function(e) {
|
|
13175
13175
|
return ds(t),
|
|
13176
13176
|
// If we still need the watch stream, retry the connection.
|
|
13177
|
-
hs(t) ? (t.
|
|
13177
|
+
hs(t) ? (t.gu.hu(r), ls(t)) :
|
|
13178
13178
|
// No need to restart watch stream because there are no active targets.
|
|
13179
13179
|
// The online state is set to unknown because there is no active attempt
|
|
13180
13180
|
// at establishing a connection
|
|
13181
|
-
t.
|
|
13181
|
+
t.gu.set("Unknown" /* Unknown */), [ 2 /*return*/ ];
|
|
13182
13182
|
}));
|
|
13183
13183
|
}));
|
|
13184
13184
|
}
|
|
@@ -13189,7 +13189,7 @@ function ys(t, r, i) {
|
|
|
13189
13189
|
return n(this, (function(a) {
|
|
13190
13190
|
switch (a.label) {
|
|
13191
13191
|
case 0:
|
|
13192
|
-
if (t.
|
|
13192
|
+
if (t.gu.set("Online" /* Online */), !(r instanceof Ir && 2 /* Removed */ === r.state && r.cause))
|
|
13193
13193
|
// Mark the client as online since we got a message from the server
|
|
13194
13194
|
return [ 3 /*break*/ , 6 ];
|
|
13195
13195
|
a.label = 1;
|
|
@@ -13206,10 +13206,10 @@ function ys(t, r, i) {
|
|
|
13206
13206
|
e = r.cause, i = 0, o = r.targetIds, n.label = 1;
|
|
13207
13207
|
|
|
13208
13208
|
case 1:
|
|
13209
|
-
return i < o.length ? (u = o[i], t.
|
|
13209
|
+
return i < o.length ? (u = o[i], t.du.has(u) ? [ 4 /*yield*/ , t.remoteSyncer.rejectListen(u, e) ] : [ 3 /*break*/ , 3 ]) : [ 3 /*break*/ , 5 ];
|
|
13210
13210
|
|
|
13211
13211
|
case 2:
|
|
13212
|
-
n.sent(), t.
|
|
13212
|
+
n.sent(), t.du.delete(u), t.yu.removeTarget(u), n.label = 3;
|
|
13213
13213
|
|
|
13214
13214
|
case 3:
|
|
13215
13215
|
n.label = 4;
|
|
@@ -13238,7 +13238,7 @@ function ys(t, r, i) {
|
|
|
13238
13238
|
return [ 3 /*break*/ , 13 ];
|
|
13239
13239
|
|
|
13240
13240
|
case 6:
|
|
13241
|
-
if (r instanceof wr ? t.
|
|
13241
|
+
if (r instanceof wr ? t.yu.Gt(r) : r instanceof br ? t.yu.Yt(r) : t.yu.Wt(r), i.isEqual(st.min())) return [ 3 /*break*/ , 13 ];
|
|
13242
13242
|
a.label = 7;
|
|
13243
13243
|
|
|
13244
13244
|
case 7:
|
|
@@ -13252,24 +13252,24 @@ function ys(t, r, i) {
|
|
|
13252
13252
|
* SyncEngine.
|
|
13253
13253
|
*/
|
|
13254
13254
|
function(t, e) {
|
|
13255
|
-
var n = t.
|
|
13255
|
+
var n = t.yu.te(e);
|
|
13256
13256
|
// Update in-memory resume tokens. LocalStore will update the
|
|
13257
13257
|
// persistent view of these when applying the completed RemoteEvent.
|
|
13258
13258
|
return n.targetChanges.forEach((function(n, r) {
|
|
13259
13259
|
if (n.resumeToken.approximateByteSize() > 0) {
|
|
13260
|
-
var i = t.
|
|
13260
|
+
var i = t.du.get(r);
|
|
13261
13261
|
// A watched target might have been removed already.
|
|
13262
|
-
i && t.
|
|
13262
|
+
i && t.du.set(r, i.withResumeToken(n.resumeToken, e));
|
|
13263
13263
|
}
|
|
13264
13264
|
})),
|
|
13265
13265
|
// Re-establish listens for the targets that have been invalidated by
|
|
13266
13266
|
// existence filter mismatches.
|
|
13267
13267
|
n.targetMismatches.forEach((function(e) {
|
|
13268
|
-
var n = t.
|
|
13268
|
+
var n = t.du.get(e);
|
|
13269
13269
|
if (n) {
|
|
13270
13270
|
// Clear the resume token for the target, since we're in a known mismatch
|
|
13271
13271
|
// state.
|
|
13272
|
-
t.
|
|
13272
|
+
t.du.set(e, n.withResumeToken(Zt.EMPTY_BYTE_STRING, n.snapshotVersion)),
|
|
13273
13273
|
// Cause a hard reset by unwatching and rewatching immediately, but
|
|
13274
13274
|
// deliberately don't send a resume token so that we get a full update.
|
|
13275
13275
|
cs(t, e);
|
|
@@ -13322,11 +13322,11 @@ function ys(t, r, i) {
|
|
|
13322
13322
|
case 0:
|
|
13323
13323
|
if (!Ot(r)) throw r;
|
|
13324
13324
|
// Disable network and raise offline snapshots
|
|
13325
|
-
return t.
|
|
13325
|
+
return t._u.add(1 /* IndexedDbFailed */), [ 4 /*yield*/ , os(t) ];
|
|
13326
13326
|
|
|
13327
13327
|
case 1:
|
|
13328
13328
|
// Disable network and raise offline snapshots
|
|
13329
|
-
return u.sent(), t.
|
|
13329
|
+
return u.sent(), t.gu.set("Offline" /* Offline */), i || (
|
|
13330
13330
|
// Use a simple read operation to determine if IndexedDB recovered.
|
|
13331
13331
|
// Ideally, we would expose a health check directly on SimpleDb, but
|
|
13332
13332
|
// RemoteStore only has access to persistence through LocalStore.
|
|
@@ -13342,7 +13342,7 @@ function ys(t, r, i) {
|
|
|
13342
13342
|
return L("RemoteStore", "Retrying IndexedDB access"), [ 4 /*yield*/ , i() ];
|
|
13343
13343
|
|
|
13344
13344
|
case 1:
|
|
13345
|
-
return e.sent(), t.
|
|
13345
|
+
return e.sent(), t._u.delete(1 /* IndexedDbFailed */), [ 4 /*yield*/ , is(t) ];
|
|
13346
13346
|
|
|
13347
13347
|
case 2:
|
|
13348
13348
|
return e.sent(), [ 2 /*return*/ ];
|
|
@@ -13370,7 +13370,7 @@ function ws(t) {
|
|
|
13370
13370
|
return n(this, (function(n) {
|
|
13371
13371
|
switch (n.label) {
|
|
13372
13372
|
case 0:
|
|
13373
|
-
e = G(t), r =
|
|
13373
|
+
e = G(t), r = Ns(e), i = e.fu.length > 0 ? e.fu[e.fu.length - 1].batchId : -1, n.label = 1;
|
|
13374
13374
|
|
|
13375
13375
|
case 1:
|
|
13376
13376
|
if (!
|
|
@@ -13379,7 +13379,7 @@ function ws(t) {
|
|
|
13379
13379
|
* enabled and the write pipeline is not full).
|
|
13380
13380
|
*/
|
|
13381
13381
|
function(t) {
|
|
13382
|
-
return fs(t) && t.
|
|
13382
|
+
return fs(t) && t.fu.length < 10;
|
|
13383
13383
|
}
|
|
13384
13384
|
/**
|
|
13385
13385
|
* Queues additional writes to be sent to the write stream, sending them
|
|
@@ -13391,11 +13391,11 @@ function ws(t) {
|
|
|
13391
13391
|
return n.trys.push([ 2, 4, , 6 ]), [ 4 /*yield*/ , Su(e.localStore, i) ];
|
|
13392
13392
|
|
|
13393
13393
|
case 3:
|
|
13394
|
-
return null === (o = n.sent()) ? (0 === e.
|
|
13394
|
+
return null === (o = n.sent()) ? (0 === e.fu.length && r.Fo(), [ 3 /*break*/ , 7 ]) : (i = o.batchId,
|
|
13395
13395
|
function(t, e) {
|
|
13396
|
-
t.
|
|
13397
|
-
var n =
|
|
13398
|
-
n.
|
|
13396
|
+
t.fu.push(e);
|
|
13397
|
+
var n = Ns(t);
|
|
13398
|
+
n.ko() && n.Yo && n.Xo(e.mutations);
|
|
13399
13399
|
}(e, o), [ 3 /*break*/ , 6 ]);
|
|
13400
13400
|
|
|
13401
13401
|
case 4:
|
|
@@ -13415,27 +13415,27 @@ function ws(t) {
|
|
|
13415
13415
|
}
|
|
13416
13416
|
|
|
13417
13417
|
function bs(t) {
|
|
13418
|
-
return fs(t) && !
|
|
13418
|
+
return fs(t) && !Ns(t).No() && t.fu.length > 0;
|
|
13419
13419
|
}
|
|
13420
13420
|
|
|
13421
13421
|
function Is(t) {
|
|
13422
|
-
|
|
13422
|
+
Ns(t).start();
|
|
13423
13423
|
}
|
|
13424
13424
|
|
|
13425
|
-
function
|
|
13425
|
+
function Ts(t) {
|
|
13426
13426
|
return e(this, void 0, void 0, (function() {
|
|
13427
13427
|
return n(this, (function(e) {
|
|
13428
|
-
return
|
|
13428
|
+
return Ns(t).eu(), [ 2 /*return*/ ];
|
|
13429
13429
|
}));
|
|
13430
13430
|
}));
|
|
13431
13431
|
}
|
|
13432
13432
|
|
|
13433
|
-
function
|
|
13433
|
+
function Es(t) {
|
|
13434
13434
|
return e(this, void 0, void 0, (function() {
|
|
13435
13435
|
var e, r, i, o;
|
|
13436
13436
|
return n(this, (function(n) {
|
|
13437
13437
|
// Send the write pipeline now that the stream is established.
|
|
13438
|
-
for (e =
|
|
13438
|
+
for (e = Ns(t), r = 0, i = t.fu; r < i.length; r++) o = i[r], e.Xo(o.mutations);
|
|
13439
13439
|
return [ 2 /*return*/ ];
|
|
13440
13440
|
}));
|
|
13441
13441
|
}));
|
|
@@ -13447,7 +13447,7 @@ function Ss(t, r, i) {
|
|
|
13447
13447
|
return n(this, (function(n) {
|
|
13448
13448
|
switch (n.label) {
|
|
13449
13449
|
case 0:
|
|
13450
|
-
return e = t.
|
|
13450
|
+
return e = t.fu.shift(), o = Ri.from(e, r, i), [ 4 /*yield*/ , gs(t, (function() {
|
|
13451
13451
|
return t.remoteSyncer.applySuccessfulWrite(o);
|
|
13452
13452
|
})) ];
|
|
13453
13453
|
|
|
@@ -13470,17 +13470,17 @@ function Ds(t, r) {
|
|
|
13470
13470
|
return n(this, (function(i) {
|
|
13471
13471
|
switch (i.label) {
|
|
13472
13472
|
case 0:
|
|
13473
|
-
return r &&
|
|
13473
|
+
return r && Ns(t).Yo ? [ 4 /*yield*/ , function(t, r) {
|
|
13474
13474
|
return e(this, void 0, void 0, (function() {
|
|
13475
13475
|
var e, i;
|
|
13476
13476
|
return n(this, (function(n) {
|
|
13477
13477
|
switch (n.label) {
|
|
13478
13478
|
case 0:
|
|
13479
|
-
return er(i = r.code) && i !== K.ABORTED ? (e = t.
|
|
13479
|
+
return er(i = r.code) && i !== K.ABORTED ? (e = t.fu.shift(),
|
|
13480
13480
|
// In this case it's also unlikely that the server itself is melting
|
|
13481
13481
|
// down -- this was just a bad request so inhibit backoff on the next
|
|
13482
13482
|
// restart.
|
|
13483
|
-
|
|
13483
|
+
Ns(t).Mo(), [ 4 /*yield*/ , gs(t, (function() {
|
|
13484
13484
|
return t.remoteSyncer.rejectFailedWrite(e.batchId, r);
|
|
13485
13485
|
})) ]) : [ 3 /*break*/ , 3 ];
|
|
13486
13486
|
|
|
@@ -13520,7 +13520,7 @@ function Ds(t, r) {
|
|
|
13520
13520
|
}));
|
|
13521
13521
|
}
|
|
13522
13522
|
|
|
13523
|
-
function
|
|
13523
|
+
function xs(t, r) {
|
|
13524
13524
|
return e(this, void 0, void 0, (function() {
|
|
13525
13525
|
var e, i;
|
|
13526
13526
|
return n(this, (function(n) {
|
|
@@ -13531,15 +13531,15 @@ function _s(t, r) {
|
|
|
13531
13531
|
// Tear down and re-create our network streams. This will ensure we get a
|
|
13532
13532
|
// fresh auth token for the new user and re-fill the write pipeline with
|
|
13533
13533
|
// new mutations from the LocalStore (since mutations are per-user).
|
|
13534
|
-
e.
|
|
13534
|
+
e._u.add(3 /* CredentialChange */), [ 4 /*yield*/ , os(e) ];
|
|
13535
13535
|
|
|
13536
13536
|
case 1:
|
|
13537
13537
|
return n.sent(), i &&
|
|
13538
13538
|
// Don't set the network status to Unknown if we are offline.
|
|
13539
|
-
e.
|
|
13539
|
+
e.gu.set("Unknown" /* Unknown */), [ 4 /*yield*/ , e.remoteSyncer.handleCredentialChange(r) ];
|
|
13540
13540
|
|
|
13541
13541
|
case 2:
|
|
13542
|
-
return n.sent(), e.
|
|
13542
|
+
return n.sent(), e._u.delete(3 /* CredentialChange */), [ 4 /*yield*/ , is(e) ];
|
|
13543
13543
|
|
|
13544
13544
|
case 3:
|
|
13545
13545
|
// Tear down and re-create our network streams. This will ensure we get a
|
|
@@ -13553,22 +13553,22 @@ function _s(t, r) {
|
|
|
13553
13553
|
|
|
13554
13554
|
/**
|
|
13555
13555
|
* Toggles the network state when the client gains or loses its primary lease.
|
|
13556
|
-
*/ function
|
|
13556
|
+
*/ function _s(t, r) {
|
|
13557
13557
|
return e(this, void 0, void 0, (function() {
|
|
13558
13558
|
var e;
|
|
13559
13559
|
return n(this, (function(n) {
|
|
13560
13560
|
switch (n.label) {
|
|
13561
13561
|
case 0:
|
|
13562
|
-
return e = G(t), r ? (e.
|
|
13562
|
+
return e = G(t), r ? (e._u.delete(2 /* IsSecondary */), [ 4 /*yield*/ , is(e) ]) : [ 3 /*break*/ , 2 ];
|
|
13563
13563
|
|
|
13564
13564
|
case 1:
|
|
13565
13565
|
return n.sent(), [ 3 /*break*/ , 5 ];
|
|
13566
13566
|
|
|
13567
13567
|
case 2:
|
|
13568
|
-
return r ? [ 3 /*break*/ , 4 ] : (e.
|
|
13568
|
+
return r ? [ 3 /*break*/ , 4 ] : (e._u.add(2 /* IsSecondary */), [ 4 /*yield*/ , os(e) ]);
|
|
13569
13569
|
|
|
13570
13570
|
case 3:
|
|
13571
|
-
n.sent(), e.
|
|
13571
|
+
n.sent(), e.gu.set("Unknown" /* Unknown */), n.label = 4;
|
|
13572
13572
|
|
|
13573
13573
|
case 4:
|
|
13574
13574
|
n.label = 5;
|
|
@@ -13587,26 +13587,26 @@ function _s(t, r) {
|
|
|
13587
13587
|
*
|
|
13588
13588
|
* PORTING NOTE: On iOS and Android, the WatchStream gets registered on startup.
|
|
13589
13589
|
* This is not done on Web to allow it to be tree-shaken.
|
|
13590
|
-
*/ function
|
|
13590
|
+
*/ function As(t) {
|
|
13591
13591
|
var r = this;
|
|
13592
|
-
return t.
|
|
13592
|
+
return t.pu || (
|
|
13593
13593
|
// Create stream (but note that it is not started yet).
|
|
13594
|
-
t.
|
|
13594
|
+
t.pu = function(t, e, n) {
|
|
13595
13595
|
var r = G(t);
|
|
13596
|
-
return r.
|
|
13596
|
+
return r.su(), new $u(e, r.connection, r.authCredentials, r.appCheckCredentials, r.It, n);
|
|
13597
13597
|
}(t.datastore, t.asyncQueue, {
|
|
13598
13598
|
Yr: ps.bind(null, t),
|
|
13599
13599
|
Zr: vs.bind(null, t),
|
|
13600
|
-
|
|
13601
|
-
}), t.
|
|
13600
|
+
Wo: ys.bind(null, t)
|
|
13601
|
+
}), t.wu.push((function(i) {
|
|
13602
13602
|
return e(r, void 0, void 0, (function() {
|
|
13603
13603
|
return n(this, (function(e) {
|
|
13604
13604
|
switch (e.label) {
|
|
13605
13605
|
case 0:
|
|
13606
|
-
return i ? (t.
|
|
13606
|
+
return i ? (t.pu.Mo(), hs(t) ? ls(t) : t.gu.set("Unknown" /* Unknown */), [ 3 /*break*/ , 3 ]) : [ 3 /*break*/ , 1 ];
|
|
13607
13607
|
|
|
13608
13608
|
case 1:
|
|
13609
|
-
return [ 4 /*yield*/ , t.
|
|
13609
|
+
return [ 4 /*yield*/ , t.pu.stop() ];
|
|
13610
13610
|
|
|
13611
13611
|
case 2:
|
|
13612
13612
|
e.sent(), ds(t), e.label = 3;
|
|
@@ -13616,7 +13616,7 @@ function _s(t, r) {
|
|
|
13616
13616
|
}
|
|
13617
13617
|
}));
|
|
13618
13618
|
}));
|
|
13619
|
-
}))), t.
|
|
13619
|
+
}))), t.pu
|
|
13620
13620
|
/**
|
|
13621
13621
|
* If not yet initialized, registers the WriteStream and its network state
|
|
13622
13622
|
* callback with `remoteStoreImpl`. Returns the existing stream if one is
|
|
@@ -13627,42 +13627,42 @@ function _s(t, r) {
|
|
|
13627
13627
|
*/;
|
|
13628
13628
|
}
|
|
13629
13629
|
|
|
13630
|
-
function
|
|
13630
|
+
function Ns(t) {
|
|
13631
13631
|
var r = this;
|
|
13632
|
-
return t.
|
|
13632
|
+
return t.Iu || (
|
|
13633
13633
|
// Create stream (but note that it is not started yet).
|
|
13634
|
-
t.
|
|
13634
|
+
t.Iu = function(t, e, n) {
|
|
13635
13635
|
var r = G(t);
|
|
13636
|
-
return r.
|
|
13636
|
+
return r.su(), new ts(e, r.connection, r.authCredentials, r.appCheckCredentials, r.It, n);
|
|
13637
13637
|
}(t.datastore, t.asyncQueue, {
|
|
13638
|
-
Yr:
|
|
13638
|
+
Yr: Ts.bind(null, t),
|
|
13639
13639
|
Zr: Ds.bind(null, t),
|
|
13640
|
-
|
|
13641
|
-
|
|
13642
|
-
}), t.
|
|
13640
|
+
tu: Es.bind(null, t),
|
|
13641
|
+
Zo: Ss.bind(null, t)
|
|
13642
|
+
}), t.wu.push((function(i) {
|
|
13643
13643
|
return e(r, void 0, void 0, (function() {
|
|
13644
13644
|
return n(this, (function(e) {
|
|
13645
13645
|
switch (e.label) {
|
|
13646
13646
|
case 0:
|
|
13647
|
-
return i ? (t.
|
|
13647
|
+
return i ? (t.Iu.Mo(), [ 4 /*yield*/ , ws(t) ]) : [ 3 /*break*/ , 2 ];
|
|
13648
13648
|
|
|
13649
13649
|
case 1:
|
|
13650
13650
|
// This will start the write stream if necessary.
|
|
13651
13651
|
return e.sent(), [ 3 /*break*/ , 4 ];
|
|
13652
13652
|
|
|
13653
13653
|
case 2:
|
|
13654
|
-
return [ 4 /*yield*/ , t.
|
|
13654
|
+
return [ 4 /*yield*/ , t.Iu.stop() ];
|
|
13655
13655
|
|
|
13656
13656
|
case 3:
|
|
13657
|
-
e.sent(), t.
|
|
13658
|
-
t.
|
|
13657
|
+
e.sent(), t.fu.length > 0 && (L("RemoteStore", "Stopping write stream with " + t.fu.length + " pending writes"),
|
|
13658
|
+
t.fu = []), e.label = 4;
|
|
13659
13659
|
|
|
13660
13660
|
case 4:
|
|
13661
13661
|
return [ 2 /*return*/ ];
|
|
13662
13662
|
}
|
|
13663
13663
|
}));
|
|
13664
13664
|
}));
|
|
13665
|
-
}))), t.
|
|
13665
|
+
}))), t.Iu
|
|
13666
13666
|
/**
|
|
13667
13667
|
* @license
|
|
13668
13668
|
* Copyright 2017 Google LLC
|
|
@@ -13861,25 +13861,25 @@ var Cs = /** @class */ function() {
|
|
|
13861
13861
|
}, t;
|
|
13862
13862
|
}(), Rs = /** @class */ function() {
|
|
13863
13863
|
function t() {
|
|
13864
|
-
this.
|
|
13864
|
+
this.Tu = new Kt(ft.comparator);
|
|
13865
13865
|
}
|
|
13866
13866
|
return t.prototype.track = function(t) {
|
|
13867
|
-
var e = t.doc.key, n = this.
|
|
13867
|
+
var e = t.doc.key, n = this.Tu.get(e);
|
|
13868
13868
|
n ?
|
|
13869
13869
|
// Merge the new change with the existing change.
|
|
13870
|
-
0 /* Added */ !== t.type && 3 /* Metadata */ === n.type ? this.
|
|
13870
|
+
0 /* Added */ !== t.type && 3 /* Metadata */ === n.type ? this.Tu = this.Tu.insert(e, t) : 3 /* Metadata */ === t.type && 1 /* Removed */ !== n.type ? this.Tu = this.Tu.insert(e, {
|
|
13871
13871
|
type: n.type,
|
|
13872
13872
|
doc: t.doc
|
|
13873
|
-
}) : 2 /* Modified */ === t.type && 2 /* Modified */ === n.type ? this.
|
|
13873
|
+
}) : 2 /* Modified */ === t.type && 2 /* Modified */ === n.type ? this.Tu = this.Tu.insert(e, {
|
|
13874
13874
|
type: 2 /* Modified */ ,
|
|
13875
13875
|
doc: t.doc
|
|
13876
|
-
}) : 2 /* Modified */ === t.type && 0 /* Added */ === n.type ? this.
|
|
13876
|
+
}) : 2 /* Modified */ === t.type && 0 /* Added */ === n.type ? this.Tu = this.Tu.insert(e, {
|
|
13877
13877
|
type: 0 /* Added */ ,
|
|
13878
13878
|
doc: t.doc
|
|
13879
|
-
}) : 1 /* Removed */ === t.type && 0 /* Added */ === n.type ? this.
|
|
13879
|
+
}) : 1 /* Removed */ === t.type && 0 /* Added */ === n.type ? this.Tu = this.Tu.remove(e) : 1 /* Removed */ === t.type && 2 /* Modified */ === n.type ? this.Tu = this.Tu.insert(e, {
|
|
13880
13880
|
type: 1 /* Removed */ ,
|
|
13881
13881
|
doc: n.doc
|
|
13882
|
-
}) : 0 /* Added */ === t.type && 1 /* Removed */ === n.type ? this.
|
|
13882
|
+
}) : 0 /* Added */ === t.type && 1 /* Removed */ === n.type ? this.Tu = this.Tu.insert(e, {
|
|
13883
13883
|
type: 2 /* Modified */ ,
|
|
13884
13884
|
doc: t.doc
|
|
13885
13885
|
}) :
|
|
@@ -13890,10 +13890,10 @@ var Cs = /** @class */ function() {
|
|
|
13890
13890
|
// Removed->Modified
|
|
13891
13891
|
// Metadata->Added
|
|
13892
13892
|
// Removed->Metadata
|
|
13893
|
-
q() : this.
|
|
13894
|
-
}, t.prototype.
|
|
13893
|
+
q() : this.Tu = this.Tu.insert(e, t);
|
|
13894
|
+
}, t.prototype.Eu = function() {
|
|
13895
13895
|
var t = [];
|
|
13896
|
-
return this.
|
|
13896
|
+
return this.Tu.inorderTraversal((function(e, n) {
|
|
13897
13897
|
t.push(n);
|
|
13898
13898
|
})), t;
|
|
13899
13899
|
}, t;
|
|
@@ -13928,11 +13928,11 @@ var Cs = /** @class */ function() {
|
|
|
13928
13928
|
return !0;
|
|
13929
13929
|
}, t;
|
|
13930
13930
|
}(), Ls = function() {
|
|
13931
|
-
this.
|
|
13931
|
+
this.Au = void 0, this.listeners = [];
|
|
13932
13932
|
}, Ms = function() {
|
|
13933
13933
|
this.queries = new rr((function(t) {
|
|
13934
13934
|
return pn(t);
|
|
13935
|
-
}), dn), this.onlineState = "Unknown" /* Unknown */ , this.
|
|
13935
|
+
}), dn), this.onlineState = "Unknown" /* Unknown */ , this.Ru = new Set;
|
|
13936
13936
|
};
|
|
13937
13937
|
|
|
13938
13938
|
/**
|
|
@@ -13968,7 +13968,7 @@ var Cs = /** @class */ function() {
|
|
|
13968
13968
|
return n.trys.push([ 1, 3, , 4 ]), s = u, [ 4 /*yield*/ , e.onListen(i) ];
|
|
13969
13969
|
|
|
13970
13970
|
case 2:
|
|
13971
|
-
return s.
|
|
13971
|
+
return s.Au = n.sent(), [ 3 /*break*/ , 4 ];
|
|
13972
13972
|
|
|
13973
13973
|
case 3:
|
|
13974
13974
|
return a = n.sent(), c = ks(a, "Initialization of query '" + vn(r.query) + "' failed"),
|
|
@@ -13977,7 +13977,7 @@ var Cs = /** @class */ function() {
|
|
|
13977
13977
|
case 4:
|
|
13978
13978
|
return e.queries.set(i, u), u.listeners.push(r),
|
|
13979
13979
|
// Run global snapshot listeners if a consistent snapshot has been emitted.
|
|
13980
|
-
r.
|
|
13980
|
+
r.bu(e.onlineState), u.Au && r.Pu(u.Au) && Bs(e), [ 2 /*return*/ ];
|
|
13981
13981
|
}
|
|
13982
13982
|
}));
|
|
13983
13983
|
}));
|
|
@@ -13998,9 +13998,9 @@ function qs(t, e) {
|
|
|
13998
13998
|
var u = o[i], s = u.query, a = n.queries.get(s);
|
|
13999
13999
|
if (a) {
|
|
14000
14000
|
for (var c = 0, l = a.listeners; c < l.length; c++) {
|
|
14001
|
-
l[c].
|
|
14001
|
+
l[c].Pu(u) && (r = !0);
|
|
14002
14002
|
}
|
|
14003
|
-
a.
|
|
14003
|
+
a.Au = u;
|
|
14004
14004
|
}
|
|
14005
14005
|
}
|
|
14006
14006
|
r && Bs(n);
|
|
@@ -14018,7 +14018,7 @@ function Us(t, e, n) {
|
|
|
14018
14018
|
|
|
14019
14019
|
// Call all global snapshot listeners that have been set.
|
|
14020
14020
|
function Bs(t) {
|
|
14021
|
-
t.
|
|
14021
|
+
t.Ru.forEach((function(t) {
|
|
14022
14022
|
t.next();
|
|
14023
14023
|
}));
|
|
14024
14024
|
}
|
|
@@ -14030,12 +14030,12 @@ function Bs(t) {
|
|
|
14030
14030
|
* It uses an Observer to dispatch events.
|
|
14031
14031
|
*/ var Gs = /** @class */ function() {
|
|
14032
14032
|
function t(t, e, n) {
|
|
14033
|
-
this.query = t, this.
|
|
14033
|
+
this.query = t, this.vu = e,
|
|
14034
14034
|
/**
|
|
14035
14035
|
* Initial snapshots (e.g. from cache) may not be propagated to the wrapped
|
|
14036
14036
|
* observer. This flag is set to true once we've actually raised an event.
|
|
14037
14037
|
*/
|
|
14038
|
-
this.
|
|
14038
|
+
this.Vu = !1, this.Su = null, this.onlineState = "Unknown" /* Unknown */ , this.options = n || {}
|
|
14039
14039
|
/**
|
|
14040
14040
|
* Applies the new ViewSnapshot to this listener, raising a user-facing event
|
|
14041
14041
|
* if applicable (depending on what changed, whether the user has opted into
|
|
@@ -14043,7 +14043,7 @@ function Bs(t) {
|
|
|
14043
14043
|
* indeed raised.
|
|
14044
14044
|
*/;
|
|
14045
14045
|
}
|
|
14046
|
-
return t.prototype.
|
|
14046
|
+
return t.prototype.Pu = function(t) {
|
|
14047
14047
|
if (!this.options.includeMetadataChanges) {
|
|
14048
14048
|
for (
|
|
14049
14049
|
// Remove the metadata only changes.
|
|
@@ -14055,17 +14055,17 @@ function Bs(t) {
|
|
|
14055
14055
|
/* excludesMetadataChanges= */ !0, t.hasCachedResults);
|
|
14056
14056
|
}
|
|
14057
14057
|
var o = !1;
|
|
14058
|
-
return this.
|
|
14059
|
-
o = !0), this.
|
|
14058
|
+
return this.Vu ? this.Du(t) && (this.vu.next(t), o = !0) : this.Cu(t, this.onlineState) && (this.xu(t),
|
|
14059
|
+
o = !0), this.Su = t, o;
|
|
14060
14060
|
}, t.prototype.onError = function(t) {
|
|
14061
|
-
this.
|
|
14061
|
+
this.vu.error(t);
|
|
14062
14062
|
},
|
|
14063
|
-
/** Returns whether a snapshot was raised. */ t.prototype.
|
|
14063
|
+
/** Returns whether a snapshot was raised. */ t.prototype.bu = function(t) {
|
|
14064
14064
|
this.onlineState = t;
|
|
14065
14065
|
var e = !1;
|
|
14066
|
-
return this.
|
|
14066
|
+
return this.Su && !this.Vu && this.Cu(this.Su, t) && (this.xu(this.Su), e = !0),
|
|
14067
14067
|
e;
|
|
14068
|
-
}, t.prototype.
|
|
14068
|
+
}, t.prototype.Cu = function(t, e) {
|
|
14069
14069
|
// Always raise the first event when we're synced
|
|
14070
14070
|
if (!t.fromCache) return !0;
|
|
14071
14071
|
// NOTE: We consider OnlineState.Unknown as online (it should become Offline
|
|
@@ -14073,32 +14073,32 @@ function Bs(t) {
|
|
|
14073
14073
|
var n = "Offline" /* Offline */ !== e;
|
|
14074
14074
|
// Don't raise the event if we're online, aren't synced yet (checked
|
|
14075
14075
|
// above) and are waiting for a sync.
|
|
14076
|
-
return (!this.options.
|
|
14076
|
+
return (!this.options.Nu || !n) && (!t.docs.isEmpty() || t.hasCachedResults || "Offline" /* Offline */ === e);
|
|
14077
14077
|
// Raise data from cache if we have any documents, have cached results before,
|
|
14078
14078
|
// or we are offline.
|
|
14079
|
-
}, t.prototype.
|
|
14079
|
+
}, t.prototype.Du = function(t) {
|
|
14080
14080
|
// We don't need to handle includeDocumentMetadataChanges here because
|
|
14081
14081
|
// the Metadata only changes have already been stripped out if needed.
|
|
14082
14082
|
// At this point the only changes we will see are the ones we should
|
|
14083
14083
|
// propagate.
|
|
14084
14084
|
if (t.docChanges.length > 0) return !0;
|
|
14085
|
-
var e = this.
|
|
14085
|
+
var e = this.Su && this.Su.hasPendingWrites !== t.hasPendingWrites;
|
|
14086
14086
|
return !(!t.syncStateChanged && !e) && !0 === this.options.includeMetadataChanges;
|
|
14087
14087
|
// Generally we should have hit one of the cases above, but it's possible
|
|
14088
14088
|
// to get here if there were only metadata docChanges and they got
|
|
14089
14089
|
// stripped out.
|
|
14090
|
-
}, t.prototype.
|
|
14090
|
+
}, t.prototype.xu = function(t) {
|
|
14091
14091
|
t = Vs.fromInitialDocuments(t.query, t.docs, t.mutatedKeys, t.fromCache, t.hasCachedResults),
|
|
14092
|
-
this.
|
|
14092
|
+
this.Vu = !0, this.vu.next(t);
|
|
14093
14093
|
}, t;
|
|
14094
14094
|
}(), Ks = /** @class */ function() {
|
|
14095
14095
|
function t(t,
|
|
14096
14096
|
// How many bytes this element takes to store in the bundle.
|
|
14097
14097
|
e) {
|
|
14098
|
-
this.
|
|
14098
|
+
this.ku = t, this.byteLength = e;
|
|
14099
14099
|
}
|
|
14100
14100
|
return t.prototype.Ou = function() {
|
|
14101
|
-
return "metadata" in this.
|
|
14101
|
+
return "metadata" in this.ku;
|
|
14102
14102
|
}, t;
|
|
14103
14103
|
}(), js = /** @class */ function() {
|
|
14104
14104
|
function t(t) {
|
|
@@ -14134,13 +14134,13 @@ function Bs(t) {
|
|
|
14134
14134
|
return t.prototype.Fu = function(t) {
|
|
14135
14135
|
this.progress.bytesLoaded += t.byteLength;
|
|
14136
14136
|
var e = this.progress.documentsLoaded;
|
|
14137
|
-
if (t.
|
|
14137
|
+
if (t.ku.namedQuery) this.queries.push(t.ku.namedQuery); else if (t.ku.documentMetadata) {
|
|
14138
14138
|
this.documents.push({
|
|
14139
|
-
metadata: t.
|
|
14140
|
-
}), t.
|
|
14141
|
-
var n = ct.fromString(t.
|
|
14139
|
+
metadata: t.ku.documentMetadata
|
|
14140
|
+
}), t.ku.documentMetadata.exists || ++e;
|
|
14141
|
+
var n = ct.fromString(t.ku.documentMetadata.name);
|
|
14142
14142
|
this.collectionGroups.add(n.get(n.length - 2));
|
|
14143
|
-
} else t.
|
|
14143
|
+
} else t.ku.document && (this.documents[this.documents.length - 1].document = t.ku.document,
|
|
14144
14144
|
++e);
|
|
14145
14145
|
return e !== this.progress.documentsLoaded ? (this.progress.documentsLoaded = e,
|
|
14146
14146
|
Object.assign({}, this.progress)) : null;
|
|
@@ -14353,7 +14353,7 @@ function zs(t) {
|
|
|
14353
14353
|
var r = this, i = this.Qu;
|
|
14354
14354
|
this.Qu = t.Qu, this.mutatedKeys = t.mutatedKeys;
|
|
14355
14355
|
// Sort changes based on type and query comparator
|
|
14356
|
-
var o = t.zu.
|
|
14356
|
+
var o = t.zu.Eu();
|
|
14357
14357
|
o.sort((function(t, e) {
|
|
14358
14358
|
return function(t, e) {
|
|
14359
14359
|
var n = function(t) {
|
|
@@ -14392,7 +14392,7 @@ function zs(t) {
|
|
|
14392
14392
|
* Applies an OnlineState change to the view, potentially generating a
|
|
14393
14393
|
* ViewChange if the view's syncState changes as a result.
|
|
14394
14394
|
*/
|
|
14395
|
-
t.prototype.
|
|
14395
|
+
t.prototype.bu = function(t) {
|
|
14396
14396
|
return this.current && "Offline" /* Offline */ === t ? (
|
|
14397
14397
|
// If we're offline, set `current` to false and then call applyChanges()
|
|
14398
14398
|
// to refresh our syncState and generate a ViewChange as appropriate. We
|
|
@@ -14538,7 +14538,7 @@ n) {
|
|
|
14538
14538
|
/** Stores user completion handlers, indexed by User and BatchId. */
|
|
14539
14539
|
this.hc = {},
|
|
14540
14540
|
/** Stores user callbacks waiting for all pending writes to be acknowledged. */
|
|
14541
|
-
this.lc = new Map, this.fc =
|
|
14541
|
+
this.lc = new Map, this.fc = No.vn(), this.onlineState = "Unknown" /* Unknown */ ,
|
|
14542
14542
|
// The primary state is set to `true` or `false` immediately after Firestore
|
|
14543
14543
|
// startup. In the interim, a client should only be considered primary if
|
|
14544
14544
|
// `isPrimary` is true.
|
|
@@ -14564,7 +14564,7 @@ function $s(t, r) {
|
|
|
14564
14564
|
return n(this, (function(n) {
|
|
14565
14565
|
switch (n.label) {
|
|
14566
14566
|
case 0:
|
|
14567
|
-
return e =
|
|
14567
|
+
return e = Aa(t), (u = e.ic.get(r)) ? (
|
|
14568
14568
|
// PORTING NOTE: With Multi-Tab Web, it is possible that a query view
|
|
14569
14569
|
// already exists when EventManager calls us for the first time. This
|
|
14570
14570
|
// happens when the primary tab is already listening to this query on
|
|
@@ -14609,7 +14609,7 @@ function $s(t, r) {
|
|
|
14609
14609
|
return n(this, (function(n) {
|
|
14610
14610
|
switch (n.label) {
|
|
14611
14611
|
case 0:
|
|
14612
|
-
return e = r.view.Wu(i), e.$i ? [ 4 /*yield*/ ,
|
|
14612
|
+
return e = r.view.Wu(i), e.$i ? [ 4 /*yield*/ , _u(t.localStore, r.query,
|
|
14613
14613
|
/* usePreviousResults= */ !1).then((function(t) {
|
|
14614
14614
|
var n = t.documents;
|
|
14615
14615
|
return r.view.Wu(n, e);
|
|
@@ -14629,7 +14629,7 @@ function $s(t, r) {
|
|
|
14629
14629
|
}));
|
|
14630
14630
|
}));
|
|
14631
14631
|
}(t, r, i, o);
|
|
14632
|
-
}, [ 4 /*yield*/ ,
|
|
14632
|
+
}, [ 4 /*yield*/ , _u(t.localStore, r,
|
|
14633
14633
|
/* usePreviousResults= */ !0) ];
|
|
14634
14634
|
|
|
14635
14635
|
case 1:
|
|
@@ -14654,11 +14654,11 @@ function $s(t, r) {
|
|
|
14654
14654
|
}))), void e.ic.delete(r)) ] : e.isPrimaryClient ? (
|
|
14655
14655
|
// We need to remove the local query target first to allow us to verify
|
|
14656
14656
|
// whether any other client is still interested in this target.
|
|
14657
|
-
e.sharedClientState.removeLocalQueryTarget(i.targetId), e.sharedClientState.isActiveQueryTarget(i.targetId) ? [ 3 /*break*/ , 2 ] : [ 4 /*yield*/ ,
|
|
14657
|
+
e.sharedClientState.removeLocalQueryTarget(i.targetId), e.sharedClientState.isActiveQueryTarget(i.targetId) ? [ 3 /*break*/ , 2 ] : [ 4 /*yield*/ , xu(e.localStore, i.targetId,
|
|
14658
14658
|
/*keepPersistedTargetData=*/ !1).then((function() {
|
|
14659
14659
|
e.sharedClientState.clearQueryState(i.targetId), ss(e.remoteStore, i.targetId),
|
|
14660
14660
|
ha(e, i.targetId);
|
|
14661
|
-
})).catch(
|
|
14661
|
+
})).catch(xt) ]) : [ 3 /*break*/ , 3 ];
|
|
14662
14662
|
|
|
14663
14663
|
case 1:
|
|
14664
14664
|
n.sent(), n.label = 2;
|
|
@@ -14667,7 +14667,7 @@ function $s(t, r) {
|
|
|
14667
14667
|
return [ 3 /*break*/ , 5 ];
|
|
14668
14668
|
|
|
14669
14669
|
case 3:
|
|
14670
|
-
return ha(e, i.targetId), [ 4 /*yield*/ ,
|
|
14670
|
+
return ha(e, i.targetId), [ 4 /*yield*/ , xu(e.localStore, i.targetId,
|
|
14671
14671
|
/*keepPersistedTargetData=*/ !0) ];
|
|
14672
14672
|
|
|
14673
14673
|
case 4:
|
|
@@ -14695,7 +14695,7 @@ function $s(t, r) {
|
|
|
14695
14695
|
return n(this, (function(n) {
|
|
14696
14696
|
switch (n.label) {
|
|
14697
14697
|
case 0:
|
|
14698
|
-
e =
|
|
14698
|
+
e = Na(t), n.label = 1;
|
|
14699
14699
|
|
|
14700
14700
|
case 1:
|
|
14701
14701
|
return n.trys.push([ 1, 5, , 6 ]), [ 4 /*yield*/ , function(t, e) {
|
|
@@ -14781,7 +14781,7 @@ function $s(t, r) {
|
|
|
14781
14781
|
e = G(t), n.label = 1;
|
|
14782
14782
|
|
|
14783
14783
|
case 1:
|
|
14784
|
-
return n.trys.push([ 1, 4, , 6 ]), [ 4 /*yield*/ ,
|
|
14784
|
+
return n.trys.push([ 1, 4, , 6 ]), [ 4 /*yield*/ , Tu(e.localStore, r) ];
|
|
14785
14785
|
|
|
14786
14786
|
case 2:
|
|
14787
14787
|
return i = n.sent(),
|
|
@@ -14801,7 +14801,7 @@ function $s(t, r) {
|
|
|
14801
14801
|
return n.sent(), [ 3 /*break*/ , 6 ];
|
|
14802
14802
|
|
|
14803
14803
|
case 4:
|
|
14804
|
-
return [ 4 /*yield*/ ,
|
|
14804
|
+
return [ 4 /*yield*/ , xt(n.sent()) ];
|
|
14805
14805
|
|
|
14806
14806
|
case 5:
|
|
14807
14807
|
return n.sent(), [ 3 /*break*/ , 6 ];
|
|
@@ -14825,7 +14825,7 @@ function $s(t, r) {
|
|
|
14825
14825
|
if (r.isPrimaryClient && 0 /* RemoteStore */ === n || !r.isPrimaryClient && 1 /* SharedClientState */ === n) {
|
|
14826
14826
|
var i = [];
|
|
14827
14827
|
r.ic.forEach((function(t, n) {
|
|
14828
|
-
var r = n.view.
|
|
14828
|
+
var r = n.view.bu(e);
|
|
14829
14829
|
r.snapshot && i.push(r.snapshot);
|
|
14830
14830
|
})), function(t, e) {
|
|
14831
14831
|
var n = G(t);
|
|
@@ -14834,10 +14834,10 @@ function $s(t, r) {
|
|
|
14834
14834
|
n.queries.forEach((function(t, n) {
|
|
14835
14835
|
for (var i = 0, o = n.listeners; i < o.length; i++) {
|
|
14836
14836
|
// Run global snapshot listeners if a consistent snapshot has been emitted.
|
|
14837
|
-
o[i].
|
|
14837
|
+
o[i].bu(e) && (r = !0);
|
|
14838
14838
|
}
|
|
14839
14839
|
})), r && Bs(n);
|
|
14840
|
-
}(r.eventManager, e), i.length && r.sc.
|
|
14840
|
+
}(r.eventManager, e), i.length && r.sc.Wo(i), r.onlineState = e, r.isPrimaryClient && r.sharedClientState.setOnlineState(e);
|
|
14841
14841
|
}
|
|
14842
14842
|
}
|
|
14843
14843
|
|
|
@@ -14878,10 +14878,10 @@ function $s(t, r) {
|
|
|
14878
14878
|
e.uc = e.uc.remove(u), e.cc.delete(r), va(e), [ 3 /*break*/ , 4 ];
|
|
14879
14879
|
|
|
14880
14880
|
case 2:
|
|
14881
|
-
return [ 4 /*yield*/ ,
|
|
14881
|
+
return [ 4 /*yield*/ , xu(e.localStore, r,
|
|
14882
14882
|
/* keepPersistedTargetData */ !1).then((function() {
|
|
14883
14883
|
return ha(e, r, i);
|
|
14884
|
-
})).catch(
|
|
14884
|
+
})).catch(xt) ];
|
|
14885
14885
|
|
|
14886
14886
|
case 3:
|
|
14887
14887
|
n.sent(), n.label = 4;
|
|
@@ -14921,7 +14921,7 @@ function ua(t, r) {
|
|
|
14921
14921
|
return n.sent(), [ 3 /*break*/ , 6 ];
|
|
14922
14922
|
|
|
14923
14923
|
case 4:
|
|
14924
|
-
return [ 4 /*yield*/ ,
|
|
14924
|
+
return [ 4 /*yield*/ , xt(n.sent()) ];
|
|
14925
14925
|
|
|
14926
14926
|
case 5:
|
|
14927
14927
|
return n.sent(), [ 3 /*break*/ , 6 ];
|
|
@@ -14977,7 +14977,7 @@ function sa(t, r, i) {
|
|
|
14977
14977
|
return n.sent(), [ 3 /*break*/ , 6 ];
|
|
14978
14978
|
|
|
14979
14979
|
case 4:
|
|
14980
|
-
return [ 4 /*yield*/ ,
|
|
14980
|
+
return [ 4 /*yield*/ , xt(n.sent()) ];
|
|
14981
14981
|
|
|
14982
14982
|
case 5:
|
|
14983
14983
|
return n.sent(), [ 3 /*break*/ , 6 ];
|
|
@@ -15119,7 +15119,7 @@ function ya(t, r, i) {
|
|
|
15119
15119
|
})), [ 4 /*yield*/ , Promise.all(a) ]);
|
|
15120
15120
|
|
|
15121
15121
|
case 1:
|
|
15122
|
-
return c.sent(), o.sc.
|
|
15122
|
+
return c.sent(), o.sc.Wo(u), [ 4 /*yield*/ , function(t, r) {
|
|
15123
15123
|
return e(this, void 0, void 0, (function() {
|
|
15124
15124
|
var e, i, o, u, s, a, c, l, h;
|
|
15125
15125
|
return n(this, (function(n) {
|
|
@@ -15129,11 +15129,11 @@ function ya(t, r, i) {
|
|
|
15129
15129
|
|
|
15130
15130
|
case 1:
|
|
15131
15131
|
return n.trys.push([ 1, 3, , 4 ]), [ 4 /*yield*/ , e.persistence.runTransaction("notifyLocalViewChanges", "readwrite", (function(t) {
|
|
15132
|
-
return
|
|
15133
|
-
return
|
|
15132
|
+
return _t.forEach(r, (function(n) {
|
|
15133
|
+
return _t.forEach(n.Si, (function(r) {
|
|
15134
15134
|
return e.persistence.referenceDelegate.addReference(t, n.targetId, r);
|
|
15135
15135
|
})).next((function() {
|
|
15136
|
-
return
|
|
15136
|
+
return _t.forEach(n.Di, (function(r) {
|
|
15137
15137
|
return e.persistence.referenceDelegate.removeReference(t, n.targetId, r);
|
|
15138
15138
|
}));
|
|
15139
15139
|
}));
|
|
@@ -15226,7 +15226,7 @@ function ga(t, e) {
|
|
|
15226
15226
|
return n(this, (function(n) {
|
|
15227
15227
|
switch (n.label) {
|
|
15228
15228
|
case 0:
|
|
15229
|
-
return [ 4 /*yield*/ ,
|
|
15229
|
+
return [ 4 /*yield*/ , _u((e = G(t)).localStore, r.query,
|
|
15230
15230
|
/* usePreviousResults= */ !0) ];
|
|
15231
15231
|
|
|
15232
15232
|
case 1:
|
|
@@ -15246,7 +15246,7 @@ function ba(t, r) {
|
|
|
15246
15246
|
return e(this, void 0, void 0, (function() {
|
|
15247
15247
|
var e;
|
|
15248
15248
|
return n(this, (function(n) {
|
|
15249
|
-
return [ 2 /*return*/ ,
|
|
15249
|
+
return [ 2 /*return*/ , Nu((e = G(t)).localStore, r).then((function(t) {
|
|
15250
15250
|
return ya(e, t);
|
|
15251
15251
|
})) ];
|
|
15252
15252
|
}));
|
|
@@ -15265,7 +15265,7 @@ function Ia(t, r, i, o) {
|
|
|
15265
15265
|
var n = G(t), r = G(n.mutationQueue);
|
|
15266
15266
|
return n.persistence.runTransaction("Lookup mutation documents", "readonly", (function(t) {
|
|
15267
15267
|
return r.Tn(t, e).next((function(e) {
|
|
15268
|
-
return e ? n.localDocuments.getDocuments(t, e) :
|
|
15268
|
+
return e ? n.localDocuments.getDocuments(t, e) : _t.resolve(null);
|
|
15269
15269
|
}));
|
|
15270
15270
|
}));
|
|
15271
15271
|
}((e = G(t)).localStore, r) ];
|
|
@@ -15312,17 +15312,17 @@ function Ia(t, r, i, o) {
|
|
|
15312
15312
|
|
|
15313
15313
|
/** Applies a query target change from a different tab. */
|
|
15314
15314
|
// PORTING NOTE: Multi-Tab only.
|
|
15315
|
-
function
|
|
15315
|
+
function Ta(t, r) {
|
|
15316
15316
|
return e(this, void 0, void 0, (function() {
|
|
15317
15317
|
var e, i, o, u, s, a, c, l;
|
|
15318
15318
|
return n(this, (function(n) {
|
|
15319
15319
|
switch (n.label) {
|
|
15320
15320
|
case 0:
|
|
15321
|
-
return
|
|
15322
|
-
[ 4 /*yield*/ ,
|
|
15321
|
+
return Aa(e = G(t)), Na(e), !0 !== r || !0 === e.dc ? [ 3 /*break*/ , 3 ] : (i = e.sharedClientState.getAllActiveQueryTargets(),
|
|
15322
|
+
[ 4 /*yield*/ , Ea(e, i.toArray()) ]);
|
|
15323
15323
|
|
|
15324
15324
|
case 1:
|
|
15325
|
-
return o = n.sent(), e.dc = !0, [ 4 /*yield*/ ,
|
|
15325
|
+
return o = n.sent(), e.dc = !0, [ 4 /*yield*/ , _s(e.remoteStore, !0) ];
|
|
15326
15326
|
|
|
15327
15327
|
case 2:
|
|
15328
15328
|
for (n.sent(), u = 0, s = o; u < s.length; u++) a = s[u], us(e.remoteStore, a);
|
|
@@ -15332,13 +15332,13 @@ function Ea(t, r) {
|
|
|
15332
15332
|
return !1 !== r || !1 === e.dc ? [ 3 /*break*/ , 7 ] : (c = [], l = Promise.resolve(),
|
|
15333
15333
|
e.rc.forEach((function(t, n) {
|
|
15334
15334
|
e.sharedClientState.isLocalQueryTarget(n) ? c.push(n) : l = l.then((function() {
|
|
15335
|
-
return ha(e, n),
|
|
15335
|
+
return ha(e, n), xu(e.localStore, n,
|
|
15336
15336
|
/*keepPersistedTargetData=*/ !0);
|
|
15337
15337
|
})), ss(e.remoteStore, n);
|
|
15338
15338
|
})), [ 4 /*yield*/ , l ]);
|
|
15339
15339
|
|
|
15340
15340
|
case 4:
|
|
15341
|
-
return n.sent(), [ 4 /*yield*/ ,
|
|
15341
|
+
return n.sent(), [ 4 /*yield*/ , Ea(e, c) ];
|
|
15342
15342
|
|
|
15343
15343
|
case 5:
|
|
15344
15344
|
return n.sent(),
|
|
@@ -15348,7 +15348,7 @@ function Ea(t, r) {
|
|
|
15348
15348
|
e.cc.forEach((function(t, n) {
|
|
15349
15349
|
ss(e.remoteStore, n);
|
|
15350
15350
|
})), e.ac.fs(), e.cc = new Map, e.uc = new Kt(ft.comparator);
|
|
15351
|
-
}(e), e.dc = !1, [ 4 /*yield*/ ,
|
|
15351
|
+
}(e), e.dc = !1, [ 4 /*yield*/ , _s(e.remoteStore, !1) ];
|
|
15352
15352
|
|
|
15353
15353
|
case 6:
|
|
15354
15354
|
n.sent(), n.label = 7;
|
|
@@ -15360,7 +15360,7 @@ function Ea(t, r) {
|
|
|
15360
15360
|
}));
|
|
15361
15361
|
}
|
|
15362
15362
|
|
|
15363
|
-
function
|
|
15363
|
+
function Ea(t, r, i) {
|
|
15364
15364
|
return e(this, void 0, void 0, (function() {
|
|
15365
15365
|
var e, i, o, u, s, a, c, l, h, f, d, p, v, y;
|
|
15366
15366
|
return n(this, (function(n) {
|
|
@@ -15391,7 +15391,7 @@ function Ta(t, r, i) {
|
|
|
15391
15391
|
return [ 3 /*break*/ , 11 ];
|
|
15392
15392
|
|
|
15393
15393
|
case 7:
|
|
15394
|
-
return [ 4 /*yield*/ ,
|
|
15394
|
+
return [ 4 /*yield*/ , Au(e.localStore, a) ];
|
|
15395
15395
|
|
|
15396
15396
|
case 8:
|
|
15397
15397
|
return y = n.sent(), [ 4 /*yield*/ , Du(e.localStore, y) ];
|
|
@@ -15410,7 +15410,7 @@ function Ta(t, r, i) {
|
|
|
15410
15410
|
return u++, [ 3 /*break*/ , 1 ];
|
|
15411
15411
|
|
|
15412
15412
|
case 13:
|
|
15413
|
-
return [ 2 /*return*/ , (e.sc.
|
|
15413
|
+
return [ 2 /*return*/ , (e.sc.Wo(o), i) ];
|
|
15414
15414
|
}
|
|
15415
15415
|
}));
|
|
15416
15416
|
}));
|
|
@@ -15440,7 +15440,7 @@ function Da(t) {
|
|
|
15440
15440
|
|
|
15441
15441
|
/** Applies a query target change from a different tab. */
|
|
15442
15442
|
// PORTING NOTE: Multi-Tab only.
|
|
15443
|
-
function
|
|
15443
|
+
function xa(t, r, i, o) {
|
|
15444
15444
|
return e(this, void 0, void 0, (function() {
|
|
15445
15445
|
var e, u, s, a;
|
|
15446
15446
|
return n(this, (function(n) {
|
|
@@ -15462,7 +15462,7 @@ function _a(t, r, i, o) {
|
|
|
15462
15462
|
return [ 3 /*break*/ , 6 ];
|
|
15463
15463
|
|
|
15464
15464
|
case 1:
|
|
15465
|
-
return [ 4 /*yield*/ ,
|
|
15465
|
+
return [ 4 /*yield*/ , Nu(e.localStore, mn(u[0])) ];
|
|
15466
15466
|
|
|
15467
15467
|
case 2:
|
|
15468
15468
|
return s = n.sent(), a = mr.createSynthesizedRemoteEventForCurrentChange(r, "current" === i, Zt.EMPTY_BYTE_STRING),
|
|
@@ -15472,7 +15472,7 @@ function _a(t, r, i, o) {
|
|
|
15472
15472
|
return n.sent(), [ 3 /*break*/ , 7 ];
|
|
15473
15473
|
|
|
15474
15474
|
case 4:
|
|
15475
|
-
return [ 4 /*yield*/ ,
|
|
15475
|
+
return [ 4 /*yield*/ , xu(e.localStore, r,
|
|
15476
15476
|
/* keepPersistedTargetData */ !0) ];
|
|
15477
15477
|
|
|
15478
15478
|
case 5:
|
|
@@ -15488,19 +15488,19 @@ function _a(t, r, i, o) {
|
|
|
15488
15488
|
}));
|
|
15489
15489
|
}
|
|
15490
15490
|
|
|
15491
|
-
/** Adds or removes Watch targets for queries from different tabs. */ function
|
|
15491
|
+
/** Adds or removes Watch targets for queries from different tabs. */ function _a(t, r, i) {
|
|
15492
15492
|
return e(this, void 0, void 0, (function() {
|
|
15493
15493
|
var e, o, u, s, a, c, l, h, f, d;
|
|
15494
15494
|
return n(this, (function(p) {
|
|
15495
15495
|
switch (p.label) {
|
|
15496
15496
|
case 0:
|
|
15497
|
-
if (!(e =
|
|
15497
|
+
if (!(e = Aa(t)).dc) return [ 3 /*break*/ , 10 ];
|
|
15498
15498
|
o = 0, u = r, p.label = 1;
|
|
15499
15499
|
|
|
15500
15500
|
case 1:
|
|
15501
15501
|
return o < u.length ? (s = u[o], e.rc.has(s) ? (
|
|
15502
15502
|
// A target might have been added in a previous attempt
|
|
15503
|
-
L("SyncEngine", "Adding an already active target " + s), [ 3 /*break*/ , 5 ]) : [ 4 /*yield*/ ,
|
|
15503
|
+
L("SyncEngine", "Adding an already active target " + s), [ 3 /*break*/ , 5 ]) : [ 4 /*yield*/ , Au(e.localStore, s) ]) : [ 3 /*break*/ , 6 ];
|
|
15504
15504
|
|
|
15505
15505
|
case 2:
|
|
15506
15506
|
return a = p.sent(), [ 4 /*yield*/ , Du(e.localStore, a) ];
|
|
@@ -15520,10 +15520,10 @@ function _a(t, r, i, o) {
|
|
|
15520
15520
|
return n(this, (function(n) {
|
|
15521
15521
|
switch (n.label) {
|
|
15522
15522
|
case 0:
|
|
15523
|
-
return e.rc.has(t) ? [ 4 /*yield*/ ,
|
|
15523
|
+
return e.rc.has(t) ? [ 4 /*yield*/ , xu(e.localStore, t,
|
|
15524
15524
|
/* keepPersistedTargetData */ !1).then((function() {
|
|
15525
15525
|
ss(e.remoteStore, t), ha(e, t);
|
|
15526
|
-
})).catch(
|
|
15526
|
+
})).catch(xt) ] : [ 3 /*break*/ , 2 ];
|
|
15527
15527
|
|
|
15528
15528
|
// Release queries that are still active.
|
|
15529
15529
|
case 1:
|
|
@@ -15552,14 +15552,14 @@ function _a(t, r, i, o) {
|
|
|
15552
15552
|
}));
|
|
15553
15553
|
}
|
|
15554
15554
|
|
|
15555
|
-
function
|
|
15555
|
+
function Aa(t) {
|
|
15556
15556
|
var e = G(t);
|
|
15557
15557
|
return e.remoteStore.remoteSyncer.applyRemoteEvent = ra.bind(null, e), e.remoteStore.remoteSyncer.getRemoteKeysForTarget = ga.bind(null, e),
|
|
15558
|
-
e.remoteStore.remoteSyncer.rejectListen = oa.bind(null, e), e.sc.
|
|
15558
|
+
e.remoteStore.remoteSyncer.rejectListen = oa.bind(null, e), e.sc.Wo = qs.bind(null, e.eventManager),
|
|
15559
15559
|
e.sc.wc = Us.bind(null, e.eventManager), e;
|
|
15560
15560
|
}
|
|
15561
15561
|
|
|
15562
|
-
function
|
|
15562
|
+
function Na(t) {
|
|
15563
15563
|
var e = G(t);
|
|
15564
15564
|
return e.remoteStore.remoteSyncer.applySuccessfulWrite = ua.bind(null, e), e.remoteStore.remoteSyncer.rejectFailedWrite = sa.bind(null, e),
|
|
15565
15565
|
e
|
|
@@ -15745,7 +15745,7 @@ var ka = /** @class */ function() {
|
|
|
15745
15745
|
|
|
15746
15746
|
case 2:
|
|
15747
15747
|
// Enqueue writes from a previous session
|
|
15748
|
-
return n.sent(), [ 4 /*yield*/ ,
|
|
15748
|
+
return n.sent(), [ 4 /*yield*/ , Na(this.Ac.syncEngine) ];
|
|
15749
15749
|
|
|
15750
15750
|
case 3:
|
|
15751
15751
|
// Enqueue writes from a previous session
|
|
@@ -15797,8 +15797,8 @@ var ka = /** @class */ function() {
|
|
|
15797
15797
|
case 1:
|
|
15798
15798
|
return u.sent(), i = this.Ac.syncEngine, this.sharedClientState instanceof Bu ? (this.sharedClientState.syncEngine = {
|
|
15799
15799
|
Fr: Ia.bind(null, i),
|
|
15800
|
-
$r:
|
|
15801
|
-
Br:
|
|
15800
|
+
$r: xa.bind(null, i),
|
|
15801
|
+
Br: _a.bind(null, i),
|
|
15802
15802
|
vi: Da.bind(null, i),
|
|
15803
15803
|
Mr: ba.bind(null, i)
|
|
15804
15804
|
}, [ 4 /*yield*/ , this.sharedClientState.start() ]) : [ 3 /*break*/ , 3 ];
|
|
@@ -15814,7 +15814,7 @@ var ka = /** @class */ function() {
|
|
|
15814
15814
|
return n(this, (function(e) {
|
|
15815
15815
|
switch (e.label) {
|
|
15816
15816
|
case 0:
|
|
15817
|
-
return [ 4 /*yield*/ ,
|
|
15817
|
+
return [ 4 /*yield*/ , Ta(this.Ac.syncEngine, t) ];
|
|
15818
15818
|
|
|
15819
15819
|
case 1:
|
|
15820
15820
|
return e.sent(), this.gcScheduler && (t && !this.gcScheduler.started ? this.gcScheduler.start() : t || this.gcScheduler.stop()),
|
|
@@ -15853,7 +15853,7 @@ var ka = /** @class */ function() {
|
|
|
15853
15853
|
/* startAsPrimary=*/ !t.synchronizeTabs), this.sharedClientState.onlineStateHandler = function(t) {
|
|
15854
15854
|
return ia(e.syncEngine, t, 1 /* SharedClientState */);
|
|
15855
15855
|
}, this.remoteStore.remoteSyncer.handleCredentialChange = ma.bind(null, this.syncEngine),
|
|
15856
|
-
[ 4 /*yield*/ ,
|
|
15856
|
+
[ 4 /*yield*/ , _s(this.remoteStore, this.syncEngine.isPrimaryClient) ]);
|
|
15857
15857
|
|
|
15858
15858
|
case 1:
|
|
15859
15859
|
n.sent(), n.label = 2;
|
|
@@ -15889,14 +15889,14 @@ var ka = /** @class */ function() {
|
|
|
15889
15889
|
return n(this, (function(n) {
|
|
15890
15890
|
switch (n.label) {
|
|
15891
15891
|
case 0:
|
|
15892
|
-
return e = G(t), L("RemoteStore", "RemoteStore shutting down."), e.
|
|
15892
|
+
return e = G(t), L("RemoteStore", "RemoteStore shutting down."), e._u.add(5 /* Shutdown */),
|
|
15893
15893
|
[ 4 /*yield*/ , os(e) ];
|
|
15894
15894
|
|
|
15895
15895
|
case 1:
|
|
15896
|
-
return n.sent(), e.
|
|
15896
|
+
return n.sent(), e.mu.shutdown(),
|
|
15897
15897
|
// Set the OnlineState to Unknown (rather than Offline) to avoid potentially
|
|
15898
15898
|
// triggering spurious listener events with cached data, etc.
|
|
15899
|
-
e.
|
|
15899
|
+
e.gu.set("Unknown" /* Unknown */), [ 2 /*return*/ ];
|
|
15900
15900
|
}
|
|
15901
15901
|
}));
|
|
15902
15902
|
}));
|
|
@@ -16138,7 +16138,7 @@ function Qa(t, e, n, r) {
|
|
|
16138
16138
|
if ("string" == typeof r.mockUserToken) u = r.mockUserToken, s = C.MOCK_USER; else {
|
|
16139
16139
|
// Let createMockUserToken validate first (catches common mistakes like
|
|
16140
16140
|
// invalid field "uid" and missing field "sub" / "user_id".)
|
|
16141
|
-
u =
|
|
16141
|
+
u = m(r.mockUserToken, null === (i = t._app) || void 0 === i ? void 0 : i.options.projectId);
|
|
16142
16142
|
var a = r.mockUserToken.sub || r.mockUserToken.user_id;
|
|
16143
16143
|
if (!a) throw new j(K.INVALID_ARGUMENT, "mockUserToken must contain 'sub' or 'user_id' field!");
|
|
16144
16144
|
s = new C(a);
|
|
@@ -16486,7 +16486,7 @@ function tc(t, r) {
|
|
|
16486
16486
|
this.buffer = new Uint8Array, this.vc = new TextDecoder("utf-8"),
|
|
16487
16487
|
// Read the metadata (which is the first element).
|
|
16488
16488
|
this.Vc().then((function(t) {
|
|
16489
|
-
t && t.Ou() ? n.metadata.resolve(t.
|
|
16489
|
+
t && t.Ou() ? n.metadata.resolve(t.ku.metadata) : n.metadata.reject(new Error("The first element of the bundle is not a metadata, it is\n " + JSON.stringify(null == t ? void 0 : t.ku)));
|
|
16490
16490
|
}), (function(t) {
|
|
16491
16491
|
return n.metadata.reject(t);
|
|
16492
16492
|
}));
|
|
@@ -16681,7 +16681,7 @@ function tc(t, r) {
|
|
|
16681
16681
|
},
|
|
16682
16682
|
parent: n.parent
|
|
16683
16683
|
};
|
|
16684
|
-
}(e.It, hn(r)), o = i.parent, e.
|
|
16684
|
+
}(e.It, hn(r)), o = i.parent, e.connection.co || delete i.parent, [ 4 /*yield*/ , e._o("RunAggregationQuery", o, i, /*expectedResponseCount=*/ 1) ];
|
|
16685
16685
|
|
|
16686
16686
|
case 1:
|
|
16687
16687
|
return [ 2 /*return*/ , n.sent().filter((function(t) {
|
|
@@ -16884,14 +16884,14 @@ function tc(t, r) {
|
|
|
16884
16884
|
}(), sc = /** @class */ function() {
|
|
16885
16885
|
function t(t, e, n, r, i) {
|
|
16886
16886
|
this.asyncQueue = t, this.datastore = e, this.options = n, this.updateFunction = r,
|
|
16887
|
-
this.deferred = i, this.kc = n.maxAttempts, this.
|
|
16887
|
+
this.deferred = i, this.kc = n.maxAttempts, this.xo = new Zu(this.asyncQueue, "transaction_retry" /* TransactionRetry */)
|
|
16888
16888
|
/** Runs the transaction and sets the result on deferred. */;
|
|
16889
16889
|
}
|
|
16890
16890
|
return t.prototype.run = function() {
|
|
16891
16891
|
this.kc -= 1, this.Oc();
|
|
16892
16892
|
}, t.prototype.Oc = function() {
|
|
16893
16893
|
var t = this;
|
|
16894
|
-
this.
|
|
16894
|
+
this.xo.Ro((function() {
|
|
16895
16895
|
return e(t, void 0, void 0, (function() {
|
|
16896
16896
|
var t, e, r = this;
|
|
16897
16897
|
return n(this, (function(n) {
|
|
@@ -17110,9 +17110,9 @@ function lc(t, r) {
|
|
|
17110
17110
|
// The CredentialChangeListener of the online component provider takes
|
|
17111
17111
|
// precedence over the offline component provider.
|
|
17112
17112
|
t.setCredentialChangeListener((function(t) {
|
|
17113
|
-
return
|
|
17113
|
+
return xs(r.remoteStore, t);
|
|
17114
17114
|
})), t.setAppCheckTokenChangeListener((function(t, e) {
|
|
17115
|
-
return
|
|
17115
|
+
return xs(r.remoteStore, e);
|
|
17116
17116
|
})), t.onlineComponents = r, [ 2 /*return*/ ];
|
|
17117
17117
|
}
|
|
17118
17118
|
}));
|
|
@@ -17235,7 +17235,7 @@ function gc(t) {
|
|
|
17235
17235
|
}
|
|
17236
17236
|
}), u = new Gs(on(n.path), o, {
|
|
17237
17237
|
includeMetadataChanges: !0,
|
|
17238
|
-
|
|
17238
|
+
Nu: !0
|
|
17239
17239
|
});
|
|
17240
17240
|
return Ps(t, u);
|
|
17241
17241
|
}, [ 4 /*yield*/ , gc(t) ];
|
|
@@ -17272,7 +17272,7 @@ function bc(t, r, i) {
|
|
|
17272
17272
|
}
|
|
17273
17273
|
}), u = new Gs(n, o, {
|
|
17274
17274
|
includeMetadataChanges: !0,
|
|
17275
|
-
|
|
17275
|
+
Nu: !0
|
|
17276
17276
|
});
|
|
17277
17277
|
return Ps(t, u);
|
|
17278
17278
|
}, [ 4 /*yield*/ , gc(t) ];
|
|
@@ -17309,13 +17309,13 @@ var Ic = /** @class */ function() {
|
|
|
17309
17309
|
// List of TimerIds to fast-forward delays for.
|
|
17310
17310
|
this.jc = [],
|
|
17311
17311
|
// Backoff timer used to schedule retries for retryable operations
|
|
17312
|
-
this.
|
|
17312
|
+
this.xo = new Zu(this, "async_queue_retry" /* AsyncQueueRetry */),
|
|
17313
17313
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
17314
17314
|
// operations. Meant to speed up recovery when we regain file system access
|
|
17315
17315
|
// after page comes into foreground.
|
|
17316
17316
|
this.Wc = function() {
|
|
17317
17317
|
var e = Yu();
|
|
17318
|
-
e && L("AsyncQueue", "Visibility state changed to " + e.visibilityState), t.
|
|
17318
|
+
e && L("AsyncQueue", "Visibility state changed to " + e.visibilityState), t.xo.Po();
|
|
17319
17319
|
};
|
|
17320
17320
|
var e = Yu();
|
|
17321
17321
|
e && "function" == typeof e.addEventListener && e.addEventListener("visibilitychange", this.Wc);
|
|
@@ -17381,7 +17381,7 @@ var Ic = /** @class */ function() {
|
|
|
17381
17381
|
return n.trys.push([ 1, 3, , 4 ]), [ 4 /*yield*/ , this.Lc[0]() ];
|
|
17382
17382
|
|
|
17383
17383
|
case 2:
|
|
17384
|
-
return n.sent(), this.Lc.shift(), this.
|
|
17384
|
+
return n.sent(), this.Lc.shift(), this.xo.reset(), [ 3 /*break*/ , 4 ];
|
|
17385
17385
|
|
|
17386
17386
|
case 3:
|
|
17387
17387
|
if (!Ot(t = n.sent())) throw t;
|
|
@@ -17401,7 +17401,7 @@ var Ic = /** @class */ function() {
|
|
|
17401
17401
|
// Since `backoffAndRun()` cancels an existing backoff and schedules a
|
|
17402
17402
|
// new backoff on every call, there is only ever a single additional
|
|
17403
17403
|
// operation in the queue.
|
|
17404
|
-
this.
|
|
17404
|
+
this.xo.Ro((function() {
|
|
17405
17405
|
return e.Jc();
|
|
17406
17406
|
})), n.label = 5;
|
|
17407
17407
|
|
|
@@ -17516,7 +17516,7 @@ var Ic = /** @class */ function() {
|
|
|
17516
17516
|
}, t;
|
|
17517
17517
|
}();
|
|
17518
17518
|
|
|
17519
|
-
function
|
|
17519
|
+
function Tc(t) {
|
|
17520
17520
|
/**
|
|
17521
17521
|
* Returns true if obj is an object and contains at least one of the specified
|
|
17522
17522
|
* methods.
|
|
@@ -17531,7 +17531,7 @@ function Ec(t) {
|
|
|
17531
17531
|
}(t);
|
|
17532
17532
|
}
|
|
17533
17533
|
|
|
17534
|
-
var
|
|
17534
|
+
var Ec = /** @class */ function() {
|
|
17535
17535
|
function t() {
|
|
17536
17536
|
this._progressObserver = {}, this._taskCompletionResolver = new Q, this._lastProgress = {
|
|
17537
17537
|
taskState: "Running",
|
|
@@ -17617,7 +17617,7 @@ var Tc = /** @class */ function() {
|
|
|
17617
17617
|
return this._firestoreClient ||
|
|
17618
17618
|
// The client must be initialized to ensure that all subsequent API
|
|
17619
17619
|
// usage throws an exception.
|
|
17620
|
-
|
|
17620
|
+
Nc(this), this._firestoreClient.terminate();
|
|
17621
17621
|
}, n;
|
|
17622
17622
|
}(ja);
|
|
17623
17623
|
|
|
@@ -17650,14 +17650,14 @@ var Tc = /** @class */ function() {
|
|
|
17650
17650
|
* @param databaseId - The name of database.
|
|
17651
17651
|
* @returns A newly initialized {@link Firestore} instance.
|
|
17652
17652
|
*/
|
|
17653
|
-
function
|
|
17653
|
+
function xc(t, e, n) {
|
|
17654
17654
|
n || (n = "(default)");
|
|
17655
17655
|
var r = _getProvider(t, "firestore");
|
|
17656
17656
|
if (r.isInitialized(n)) {
|
|
17657
17657
|
var i = r.getImmediate({
|
|
17658
17658
|
identifier: n
|
|
17659
17659
|
}), o = r.getOptions(n);
|
|
17660
|
-
if (
|
|
17660
|
+
if (g(o, e)) return i;
|
|
17661
17661
|
throw new j(K.FAILED_PRECONDITION, "initializeFirestore() has already been called with different options. To avoid this error, call initializeFirestore() with the same options as when it was originally called, or call getFirestore() to return the already initialized instance.");
|
|
17662
17662
|
}
|
|
17663
17663
|
if (void 0 !== e.cacheSizeBytes && -1 !== e.cacheSizeBytes && e.cacheSizeBytes < 1048576) throw new j(K.INVALID_ARGUMENT, "cacheSizeBytes must be at least 1048576");
|
|
@@ -17667,12 +17667,12 @@ function _c(t, e, n) {
|
|
|
17667
17667
|
});
|
|
17668
17668
|
}
|
|
17669
17669
|
|
|
17670
|
-
function
|
|
17670
|
+
function _c(t, e) {
|
|
17671
17671
|
var n = "object" == typeof t ? t : s(), i = "string" == typeof t ? t : e || "(default)", o = _getProvider(n, "firestore").getImmediate({
|
|
17672
17672
|
identifier: i
|
|
17673
17673
|
});
|
|
17674
17674
|
if (!o._initialized) {
|
|
17675
|
-
var u =
|
|
17675
|
+
var u = w("firestore");
|
|
17676
17676
|
u && Qa.apply(void 0, r([ o ], u));
|
|
17677
17677
|
}
|
|
17678
17678
|
return o;
|
|
@@ -17680,11 +17680,11 @@ function xc(t, e) {
|
|
|
17680
17680
|
|
|
17681
17681
|
/**
|
|
17682
17682
|
* @internal
|
|
17683
|
-
*/ function
|
|
17684
|
-
return t._firestoreClient ||
|
|
17683
|
+
*/ function Ac(t) {
|
|
17684
|
+
return t._firestoreClient || Nc(t), t._firestoreClient.verifyNotTerminated(), t._firestoreClient;
|
|
17685
17685
|
}
|
|
17686
17686
|
|
|
17687
|
-
function
|
|
17687
|
+
function Nc(t) {
|
|
17688
17688
|
var e, n = t._freezeSettings(), r = function(t, e, n, r) {
|
|
17689
17689
|
return new oe(t, e, n, r.host, r.ssl, r.experimentalForceLongPolling, r.experimentalAutoDetectLongPolling, r.useFetchStreams);
|
|
17690
17690
|
}(t._databaseId, (null === (e = t._app) || void 0 === e ? void 0 : e.options.appId) || "", t._persistenceKey, n);
|
|
@@ -17715,7 +17715,7 @@ function Ac(t) {
|
|
|
17715
17715
|
* @returns A `Promise` that represents successfully enabling persistent storage.
|
|
17716
17716
|
*/ function Cc(t, e) {
|
|
17717
17717
|
Uc(t = Ua(t, Dc));
|
|
17718
|
-
var n =
|
|
17718
|
+
var n = Ac(t), r = t._freezeSettings(), i = new Va;
|
|
17719
17719
|
return Oc(n, i, new Oa(i, r.cacheSizeBytes, null == e ? void 0 : e.forceOwnership));
|
|
17720
17720
|
}
|
|
17721
17721
|
|
|
@@ -17742,7 +17742,7 @@ function Ac(t) {
|
|
|
17742
17742
|
* storage.
|
|
17743
17743
|
*/ function kc(t) {
|
|
17744
17744
|
Uc(t = Ua(t, Dc));
|
|
17745
|
-
var e =
|
|
17745
|
+
var e = Ac(t), n = t._freezeSettings(), r = new Va;
|
|
17746
17746
|
return Oc(e, r, new Ra(r, n.cacheSizeBytes));
|
|
17747
17747
|
}
|
|
17748
17748
|
|
|
@@ -17808,7 +17808,7 @@ function Rc(t) {
|
|
|
17808
17808
|
return n(this, (function(n) {
|
|
17809
17809
|
switch (n.label) {
|
|
17810
17810
|
case 0:
|
|
17811
|
-
return
|
|
17811
|
+
return Nt.C() ? (e = t + "main", [ 4 /*yield*/ , Nt.delete(e) ]) : [ 2 /*return*/ , Promise.resolve() ];
|
|
17812
17812
|
|
|
17813
17813
|
case 1:
|
|
17814
17814
|
return n.sent(), [ 2 /*return*/ ];
|
|
@@ -17864,7 +17864,7 @@ function Vc(t) {
|
|
|
17864
17864
|
}));
|
|
17865
17865
|
}));
|
|
17866
17866
|
})), i.promise;
|
|
17867
|
-
}(
|
|
17867
|
+
}(Ac(t = Ua(t, Dc)));
|
|
17868
17868
|
}
|
|
17869
17869
|
|
|
17870
17870
|
/**
|
|
@@ -17889,14 +17889,14 @@ function Vc(t) {
|
|
|
17889
17889
|
case 2:
|
|
17890
17890
|
return r = n.sent(), [ 2 /*return*/ , (e.setNetworkEnabled(!0), function(t) {
|
|
17891
17891
|
var e = G(t);
|
|
17892
|
-
return e.
|
|
17892
|
+
return e._u.delete(0 /* UserDisabled */), is(e);
|
|
17893
17893
|
}(r)) ];
|
|
17894
17894
|
}
|
|
17895
17895
|
}));
|
|
17896
17896
|
}));
|
|
17897
17897
|
}));
|
|
17898
17898
|
}
|
|
17899
|
-
/** Disables the network connection. Pending operations will not complete. */ (
|
|
17899
|
+
/** Disables the network connection. Pending operations will not complete. */ (Ac(t = Ua(t, Dc)));
|
|
17900
17900
|
}
|
|
17901
17901
|
|
|
17902
17902
|
/**
|
|
@@ -17927,12 +17927,12 @@ function Vc(t) {
|
|
|
17927
17927
|
return n(this, (function(n) {
|
|
17928
17928
|
switch (n.label) {
|
|
17929
17929
|
case 0:
|
|
17930
|
-
return (e = G(t)).
|
|
17930
|
+
return (e = G(t))._u.add(0 /* UserDisabled */), [ 4 /*yield*/ , os(e) ];
|
|
17931
17931
|
|
|
17932
17932
|
case 1:
|
|
17933
17933
|
return n.sent(),
|
|
17934
17934
|
// Set the OnlineState to Offline so get()s return from cache, etc.
|
|
17935
|
-
e.
|
|
17935
|
+
e.gu.set("Offline" /* Offline */), [ 2 /*return*/ ];
|
|
17936
17936
|
}
|
|
17937
17937
|
}));
|
|
17938
17938
|
}));
|
|
@@ -17946,7 +17946,7 @@ function Vc(t) {
|
|
|
17946
17946
|
* Returns a Promise that resolves when all writes that were pending at the time
|
|
17947
17947
|
* this method was called received server acknowledgement. An acknowledgement
|
|
17948
17948
|
* can be either acceptance or rejection.
|
|
17949
|
-
*/ (
|
|
17949
|
+
*/ (Ac(t = Ua(t, Dc)));
|
|
17950
17950
|
}
|
|
17951
17951
|
|
|
17952
17952
|
/**
|
|
@@ -17986,7 +17986,7 @@ function Vc(t) {
|
|
|
17986
17986
|
}
|
|
17987
17987
|
|
|
17988
17988
|
function Fc(t, r) {
|
|
17989
|
-
var i =
|
|
17989
|
+
var i = Ac(t = Ua(t, Dc)), o = new Ec;
|
|
17990
17990
|
/**
|
|
17991
17991
|
* Takes an updateFunction in which a set of reads and writes can be performed
|
|
17992
17992
|
* atomically. In the updateFunction, the client can read and write values
|
|
@@ -18064,7 +18064,7 @@ function qc(t, r) {
|
|
|
18064
18064
|
}));
|
|
18065
18065
|
}));
|
|
18066
18066
|
}));
|
|
18067
|
-
}(
|
|
18067
|
+
}(Ac(t = Ua(t, Dc)), r).then((function(e) {
|
|
18068
18068
|
return e ? new Wa(t, null, e.query) : null;
|
|
18069
18069
|
}));
|
|
18070
18070
|
}
|
|
@@ -18518,7 +18518,7 @@ var nl = /** @class */ function(e) {
|
|
|
18518
18518
|
return null !== e && e.apply(this, arguments) || this;
|
|
18519
18519
|
}
|
|
18520
18520
|
return t(n, e), n.prototype._toFieldTransform = function(t) {
|
|
18521
|
-
return new Ln(t.path, new
|
|
18521
|
+
return new Ln(t.path, new _n);
|
|
18522
18522
|
}, n.prototype.isEqual = function(t) {
|
|
18523
18523
|
return t instanceof n;
|
|
18524
18524
|
}, n;
|
|
@@ -18531,7 +18531,7 @@ var nl = /** @class */ function(e) {
|
|
|
18531
18531
|
var e = el(this, t,
|
|
18532
18532
|
/*array=*/ !0), n = this._a.map((function(t) {
|
|
18533
18533
|
return cl(t, e);
|
|
18534
|
-
})), r = new
|
|
18534
|
+
})), r = new An(n);
|
|
18535
18535
|
return new Ln(t.path, r);
|
|
18536
18536
|
}, n.prototype.isEqual = function(t) {
|
|
18537
18537
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -18558,7 +18558,7 @@ var nl = /** @class */ function(e) {
|
|
|
18558
18558
|
return (r = e.call(this, t) || this).wa = n, r;
|
|
18559
18559
|
}
|
|
18560
18560
|
return t(n, e), n.prototype._toFieldTransform = function(t) {
|
|
18561
|
-
var e = new On(t.It,
|
|
18561
|
+
var e = new On(t.It, Tn(t.It, this.wa));
|
|
18562
18562
|
return new Ln(t.path, e);
|
|
18563
18563
|
}, n.prototype.isEqual = function(t) {
|
|
18564
18564
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -18687,7 +18687,7 @@ var nl = /** @class */ function(e) {
|
|
|
18687
18687
|
if (null === (t = v(t))) return {
|
|
18688
18688
|
nullValue: "NULL_VALUE"
|
|
18689
18689
|
};
|
|
18690
|
-
if ("number" == typeof t) return
|
|
18690
|
+
if ("number" == typeof t) return Tn(e.It, t);
|
|
18691
18691
|
if ("boolean" == typeof t) return {
|
|
18692
18692
|
booleanValue: t
|
|
18693
18693
|
};
|
|
@@ -18697,7 +18697,7 @@ var nl = /** @class */ function(e) {
|
|
|
18697
18697
|
if (t instanceof Date) {
|
|
18698
18698
|
var n = ut.fromDate(t);
|
|
18699
18699
|
return {
|
|
18700
|
-
timestampValue:
|
|
18700
|
+
timestampValue: Nr(e.It, n)
|
|
18701
18701
|
};
|
|
18702
18702
|
}
|
|
18703
18703
|
if (t instanceof ut) {
|
|
@@ -18706,7 +18706,7 @@ var nl = /** @class */ function(e) {
|
|
|
18706
18706
|
// truncation immediately without waiting for the backend to do that.
|
|
18707
18707
|
var r = new ut(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
|
|
18708
18708
|
return {
|
|
18709
|
-
timestampValue:
|
|
18709
|
+
timestampValue: Nr(e.It, r)
|
|
18710
18710
|
};
|
|
18711
18711
|
}
|
|
18712
18712
|
if (t instanceof Qc) return {
|
|
@@ -18962,7 +18962,7 @@ function bl(t, e) {
|
|
|
18962
18962
|
* endBefore:1}, {@link (endAt:1)}, {@link limit} or {@link limitToLast} and
|
|
18963
18963
|
* can then be passed to {@link query} to create a new query instance that
|
|
18964
18964
|
* also contains this `QueryConstraint`.
|
|
18965
|
-
*/ var
|
|
18965
|
+
*/ var Tl = function() {};
|
|
18966
18966
|
|
|
18967
18967
|
/**
|
|
18968
18968
|
* Creates a new immutable instance of {@link Query} that is extended to also include
|
|
@@ -18972,7 +18972,7 @@ function bl(t, e) {
|
|
|
18972
18972
|
* @param queryConstraints - The list of {@link QueryConstraint}s to apply.
|
|
18973
18973
|
* @throws if any of the provided query constraints cannot be combined with the
|
|
18974
18974
|
* existing or new constraints.
|
|
18975
|
-
*/ function
|
|
18975
|
+
*/ function El(t) {
|
|
18976
18976
|
for (var e = [], n = 1; n < arguments.length; n++) e[n - 1] = arguments[n];
|
|
18977
18977
|
for (var r = 0, i = e; r < i.length; r++) {
|
|
18978
18978
|
var o = i[r];
|
|
@@ -19065,7 +19065,7 @@ var Sl = /** @class */ function(e) {
|
|
|
19065
19065
|
return new nn(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
|
|
19066
19066
|
}(t._query, n));
|
|
19067
19067
|
}, n;
|
|
19068
|
-
}(
|
|
19068
|
+
}(Tl);
|
|
19069
19069
|
|
|
19070
19070
|
/**
|
|
19071
19071
|
* Creates a {@link QueryConstraint} that enforces that documents must contain the
|
|
@@ -19082,7 +19082,7 @@ var Sl = /** @class */ function(e) {
|
|
|
19082
19082
|
return new Sl(i, r, n);
|
|
19083
19083
|
}
|
|
19084
19084
|
|
|
19085
|
-
var
|
|
19085
|
+
var xl = /** @class */ function(e) {
|
|
19086
19086
|
function n(t, n) {
|
|
19087
19087
|
var r = this;
|
|
19088
19088
|
return (r = e.call(this) || this).ma = t, r.pa = n, r.type = "orderBy", r;
|
|
@@ -19106,7 +19106,7 @@ var _l = /** @class */ function(e) {
|
|
|
19106
19106
|
return new nn(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
|
|
19107
19107
|
}(t._query, e));
|
|
19108
19108
|
}, n;
|
|
19109
|
-
}(
|
|
19109
|
+
}(Tl);
|
|
19110
19110
|
|
|
19111
19111
|
/**
|
|
19112
19112
|
* Creates a {@link QueryConstraint} that sorts the query result by the
|
|
@@ -19116,13 +19116,13 @@ var _l = /** @class */ function(e) {
|
|
|
19116
19116
|
* @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
|
|
19117
19117
|
* not specified, order will be ascending.
|
|
19118
19118
|
* @returns The created {@link Query}.
|
|
19119
|
-
*/ function
|
|
19119
|
+
*/ function _l(t, e) {
|
|
19120
19120
|
void 0 === e && (e = "asc");
|
|
19121
19121
|
var n = e, r = bl("orderBy", t);
|
|
19122
|
-
return new
|
|
19122
|
+
return new xl(r, n);
|
|
19123
19123
|
}
|
|
19124
19124
|
|
|
19125
|
-
var
|
|
19125
|
+
var Al = /** @class */ function(e) {
|
|
19126
19126
|
function n(t, n, r) {
|
|
19127
19127
|
var i = this;
|
|
19128
19128
|
return (i = e.call(this) || this).type = t, i.Ia = n, i.Ta = r, i;
|
|
@@ -19130,15 +19130,15 @@ var Nl = /** @class */ function(e) {
|
|
|
19130
19130
|
return t(n, e), n.prototype._apply = function(t) {
|
|
19131
19131
|
return new Wa(t.firestore, t.converter, fn(t._query, this.Ia, this.Ta));
|
|
19132
19132
|
}, n;
|
|
19133
|
-
}(
|
|
19133
|
+
}(Tl);
|
|
19134
19134
|
|
|
19135
19135
|
/**
|
|
19136
19136
|
* Creates a {@link QueryConstraint} that only returns the first matching documents.
|
|
19137
19137
|
*
|
|
19138
19138
|
* @param limit - The maximum number of items to return.
|
|
19139
19139
|
* @returns The created {@link Query}.
|
|
19140
|
-
*/ function
|
|
19141
|
-
return Ba("limit", t), new
|
|
19140
|
+
*/ function Nl(t) {
|
|
19141
|
+
return Ba("limit", t), new Al("limit", t, "F" /* First */)
|
|
19142
19142
|
/**
|
|
19143
19143
|
* Creates a {@link QueryConstraint} that only returns the last matching documents.
|
|
19144
19144
|
*
|
|
@@ -19151,7 +19151,7 @@ var Nl = /** @class */ function(e) {
|
|
|
19151
19151
|
}
|
|
19152
19152
|
|
|
19153
19153
|
function Cl(t) {
|
|
19154
|
-
return Ba("limitToLast", t), new
|
|
19154
|
+
return Ba("limitToLast", t), new Al("limitToLast", t, "L" /* Last */);
|
|
19155
19155
|
}
|
|
19156
19156
|
|
|
19157
19157
|
var kl = /** @class */ function(e) {
|
|
@@ -19165,7 +19165,7 @@ var kl = /** @class */ function(e) {
|
|
|
19165
19165
|
return new nn(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
|
|
19166
19166
|
}(t._query, e));
|
|
19167
19167
|
}, n;
|
|
19168
|
-
}(
|
|
19168
|
+
}(Tl);
|
|
19169
19169
|
|
|
19170
19170
|
function Ol() {
|
|
19171
19171
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
@@ -19190,7 +19190,7 @@ var Vl = /** @class */ function(e) {
|
|
|
19190
19190
|
return new nn(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
|
|
19191
19191
|
}(t._query, e));
|
|
19192
19192
|
}, n;
|
|
19193
|
-
}(
|
|
19193
|
+
}(Tl);
|
|
19194
19194
|
|
|
19195
19195
|
function Ll() {
|
|
19196
19196
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
@@ -19570,9 +19570,10 @@ var Kl = /** @class */ function(e) {
|
|
|
19570
19570
|
if (t._snapshot.oldDocs.isEmpty()) {
|
|
19571
19571
|
var n = 0;
|
|
19572
19572
|
return t._snapshot.docChanges.map((function(e) {
|
|
19573
|
-
|
|
19573
|
+
var r = new zl(t._firestore, t._userDataWriter, e.doc.key, e.doc, new jl(t._snapshot.mutatedKeys.has(e.doc.key), t._snapshot.fromCache), t.query.converter);
|
|
19574
|
+
return e.doc, {
|
|
19574
19575
|
type: "added",
|
|
19575
|
-
doc:
|
|
19576
|
+
doc: r,
|
|
19576
19577
|
oldIndex: -1,
|
|
19577
19578
|
newIndex: n++
|
|
19578
19579
|
};
|
|
@@ -19674,7 +19675,7 @@ var Kl = /** @class */ function(e) {
|
|
|
19674
19675
|
*/ function Xl(t) {
|
|
19675
19676
|
t = Ua(t, za);
|
|
19676
19677
|
var e = Ua(t.firestore, Dc);
|
|
19677
|
-
return wc(
|
|
19678
|
+
return wc(Ac(e), t._key).then((function(n) {
|
|
19678
19679
|
return lh(e, t, n);
|
|
19679
19680
|
}));
|
|
19680
19681
|
}
|
|
@@ -19700,7 +19701,7 @@ var Zl = /** @class */ function(e) {
|
|
|
19700
19701
|
* current document contents.
|
|
19701
19702
|
*/ function Jl(t) {
|
|
19702
19703
|
t = Ua(t, za);
|
|
19703
|
-
var r = Ua(t.firestore, Dc), i =
|
|
19704
|
+
var r = Ua(t.firestore, Dc), i = Ac(r), o = new Zl(r);
|
|
19704
19705
|
return function(t, r) {
|
|
19705
19706
|
var i = this, o = new Q;
|
|
19706
19707
|
return t.asyncQueue.enqueueAndForget((function() {
|
|
@@ -19758,7 +19759,7 @@ var Zl = /** @class */ function(e) {
|
|
|
19758
19759
|
*/ function $l(t) {
|
|
19759
19760
|
t = Ua(t, za);
|
|
19760
19761
|
var e = Ua(t.firestore, Dc);
|
|
19761
|
-
return wc(
|
|
19762
|
+
return wc(Ac(e), t._key, {
|
|
19762
19763
|
source: "server"
|
|
19763
19764
|
}).then((function(n) {
|
|
19764
19765
|
return lh(e, t, n);
|
|
@@ -19776,7 +19777,7 @@ var Zl = /** @class */ function(e) {
|
|
|
19776
19777
|
* @returns A `Promise` that will be resolved with the results of the query.
|
|
19777
19778
|
*/ function th(t) {
|
|
19778
19779
|
t = Ua(t, Wa);
|
|
19779
|
-
var e = Ua(t.firestore, Dc), n =
|
|
19780
|
+
var e = Ua(t.firestore, Dc), n = Ac(e), r = new Zl(e);
|
|
19780
19781
|
return Il(t._query), bc(n, t._query).then((function(n) {
|
|
19781
19782
|
return new Wl(e, r, t, n);
|
|
19782
19783
|
}))
|
|
@@ -19790,7 +19791,7 @@ var Zl = /** @class */ function(e) {
|
|
|
19790
19791
|
|
|
19791
19792
|
function eh(t) {
|
|
19792
19793
|
t = Ua(t, Wa);
|
|
19793
|
-
var r = Ua(t.firestore, Dc), i =
|
|
19794
|
+
var r = Ua(t.firestore, Dc), i = Ac(r), o = new Zl(r);
|
|
19794
19795
|
return function(t, r) {
|
|
19795
19796
|
var i = this, o = new Q;
|
|
19796
19797
|
return t.asyncQueue.enqueueAndForget((function() {
|
|
@@ -19805,7 +19806,7 @@ function eh(t) {
|
|
|
19805
19806
|
return n(this, (function(n) {
|
|
19806
19807
|
switch (n.label) {
|
|
19807
19808
|
case 0:
|
|
19808
|
-
return n.trys.push([ 0, 2, , 3 ]), [ 4 /*yield*/ ,
|
|
19809
|
+
return n.trys.push([ 0, 2, , 3 ]), [ 4 /*yield*/ , _u(t, r,
|
|
19809
19810
|
/* usePreviousResults= */ !0) ];
|
|
19810
19811
|
|
|
19811
19812
|
case 1:
|
|
@@ -19841,7 +19842,7 @@ function eh(t) {
|
|
|
19841
19842
|
* @returns A `Promise` that will be resolved with the results of the query.
|
|
19842
19843
|
*/ function nh(t) {
|
|
19843
19844
|
t = Ua(t, Wa);
|
|
19844
|
-
var e = Ua(t.firestore, Dc), n =
|
|
19845
|
+
var e = Ua(t.firestore, Dc), n = Ac(e), r = new Zl(e);
|
|
19845
19846
|
return bc(n, t._query, {
|
|
19846
19847
|
source: "server"
|
|
19847
19848
|
}).then((function(n) {
|
|
@@ -19897,11 +19898,11 @@ function sh(t) {
|
|
|
19897
19898
|
var a = {
|
|
19898
19899
|
includeMetadataChanges: !1
|
|
19899
19900
|
}, c = 0;
|
|
19900
|
-
"object" != typeof u[c] ||
|
|
19901
|
+
"object" != typeof u[c] || Tc(u[c]) || (a = u[c], c++);
|
|
19901
19902
|
var l, h, f, d = {
|
|
19902
19903
|
includeMetadataChanges: a.includeMetadataChanges
|
|
19903
19904
|
};
|
|
19904
|
-
if (
|
|
19905
|
+
if (Tc(u[c])) {
|
|
19905
19906
|
var p = u[c];
|
|
19906
19907
|
u[c] = null === (r = p.next) || void 0 === r ? void 0 : r.bind(p), u[c + 1] = null === (i = p.error) || void 0 === i ? void 0 : i.bind(p),
|
|
19907
19908
|
u[c + 2] = null === (o = p.complete) || void 0 === o ? void 0 : o.bind(p);
|
|
@@ -19955,7 +19956,7 @@ function sh(t) {
|
|
|
19955
19956
|
}));
|
|
19956
19957
|
}));
|
|
19957
19958
|
};
|
|
19958
|
-
}(
|
|
19959
|
+
}(Ac(h), f, d, l);
|
|
19959
19960
|
}
|
|
19960
19961
|
|
|
19961
19962
|
function ah(t, r) {
|
|
@@ -19968,7 +19969,7 @@ function ah(t, r) {
|
|
|
19968
19969
|
switch (n.label) {
|
|
19969
19970
|
case 0:
|
|
19970
19971
|
return e = function(t, e) {
|
|
19971
|
-
G(t).
|
|
19972
|
+
G(t).Ru.add(e),
|
|
19972
19973
|
// Immediately fire an initial event, indicating all existing listeners
|
|
19973
19974
|
// are in-sync.
|
|
19974
19975
|
e.next();
|
|
@@ -19987,7 +19988,7 @@ function ah(t, r) {
|
|
|
19987
19988
|
switch (n.label) {
|
|
19988
19989
|
case 0:
|
|
19989
19990
|
return e = function(t, e) {
|
|
19990
|
-
G(t).
|
|
19991
|
+
G(t).Ru.delete(e);
|
|
19991
19992
|
}, [ 4 /*yield*/ , gc(t) ];
|
|
19992
19993
|
|
|
19993
19994
|
case 1:
|
|
@@ -19997,7 +19998,7 @@ function ah(t, r) {
|
|
|
19997
19998
|
}));
|
|
19998
19999
|
}));
|
|
19999
20000
|
};
|
|
20000
|
-
}(
|
|
20001
|
+
}(Ac(t = Ua(t, Dc)), Tc(r) ? r : {
|
|
20001
20002
|
next: r
|
|
20002
20003
|
});
|
|
20003
20004
|
}
|
|
@@ -20022,7 +20023,7 @@ function ah(t, r) {
|
|
|
20022
20023
|
}));
|
|
20023
20024
|
}));
|
|
20024
20025
|
})), o.promise;
|
|
20025
|
-
}(
|
|
20026
|
+
}(Ac(t), r);
|
|
20026
20027
|
}
|
|
20027
20028
|
|
|
20028
20029
|
/**
|
|
@@ -20061,7 +20062,7 @@ function ah(t, r) {
|
|
|
20061
20062
|
* @returns `true` if the objects are "equal", as defined above, or `false`
|
|
20062
20063
|
* otherwise.
|
|
20063
20064
|
*/ function hh(t, e) {
|
|
20064
|
-
return $a(t.query, e.query) &&
|
|
20065
|
+
return $a(t.query, e.query) && g(t.data(), e.data());
|
|
20065
20066
|
}
|
|
20066
20067
|
|
|
20067
20068
|
/**
|
|
@@ -20134,7 +20135,7 @@ function ah(t, r) {
|
|
|
20134
20135
|
}));
|
|
20135
20136
|
}));
|
|
20136
20137
|
})), u.promise;
|
|
20137
|
-
}(
|
|
20138
|
+
}(Ac(r), t, new Zl(r));
|
|
20138
20139
|
}
|
|
20139
20140
|
|
|
20140
20141
|
/**
|
|
@@ -20381,7 +20382,7 @@ function ah(t, r) {
|
|
|
20381
20382
|
}));
|
|
20382
20383
|
}));
|
|
20383
20384
|
})), u.promise;
|
|
20384
|
-
}(
|
|
20385
|
+
}(Ac(t), (function(e) {
|
|
20385
20386
|
return r(new mh(t, e));
|
|
20386
20387
|
}), o);
|
|
20387
20388
|
}
|
|
@@ -20444,7 +20445,7 @@ function ah(t, r) {
|
|
|
20444
20445
|
* @param elements - The elements to remove from the array.
|
|
20445
20446
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
20446
20447
|
* `updateDoc()`
|
|
20447
|
-
*/ function
|
|
20448
|
+
*/ function Th() {
|
|
20448
20449
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
20449
20450
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
20450
20451
|
// update() since we'd need the Firestore instance to do this.
|
|
@@ -20469,7 +20470,7 @@ function ah(t, r) {
|
|
|
20469
20470
|
* @param n - The value to increment by.
|
|
20470
20471
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
20471
20472
|
* `updateDoc()`
|
|
20472
|
-
*/ function
|
|
20473
|
+
*/ function Eh(t) {
|
|
20473
20474
|
return new ol("increment", t);
|
|
20474
20475
|
}
|
|
20475
20476
|
|
|
@@ -20500,7 +20501,7 @@ function ah(t, r) {
|
|
|
20500
20501
|
* @returns A {@link WriteBatch} that can be used to atomically execute multiple
|
|
20501
20502
|
* writes.
|
|
20502
20503
|
*/ function Sh(t) {
|
|
20503
|
-
return
|
|
20504
|
+
return Ac(t = Ua(t, Dc)), new ph(t, (function(e) {
|
|
20504
20505
|
return ch(t, e);
|
|
20505
20506
|
}))
|
|
20506
20507
|
/**
|
|
@@ -20522,7 +20523,7 @@ function ah(t, r) {
|
|
|
20522
20523
|
}
|
|
20523
20524
|
|
|
20524
20525
|
function Dh(t, i) {
|
|
20525
|
-
var o, u =
|
|
20526
|
+
var o, u = Ac(t = Ua(t, Dc));
|
|
20526
20527
|
// PORTING NOTE: We don't return an error if the user has not enabled
|
|
20527
20528
|
// persistence since `enableIndexeddbPersistence()` can fail on the Web.
|
|
20528
20529
|
if (!(null === (o = u.offlineComponents) || void 0 === o ? void 0 : o.indexBackfillerScheduler)) return P("Cannot enable indexes when persistence is disabled"),
|
|
@@ -20537,9 +20538,9 @@ function Dh(t, i) {
|
|
|
20537
20538
|
}
|
|
20538
20539
|
}(t) : t, n = [];
|
|
20539
20540
|
if (Array.isArray(e.indexes)) for (var r = 0, i = e.indexes; r < i.length; r++) {
|
|
20540
|
-
var o = i[r], u =
|
|
20541
|
+
var o = i[r], u = xh(o, "collectionGroup"), s = [];
|
|
20541
20542
|
if (Array.isArray(o.fields)) for (var a = 0, c = o.fields; a < c.length; a++) {
|
|
20542
|
-
var l = c[a], h = vl("setIndexConfiguration",
|
|
20543
|
+
var l = c[a], h = vl("setIndexConfiguration", xh(l, "fieldPath"));
|
|
20543
20544
|
"CONTAINS" === l.arrayConfig ? s.push(new mt(h, 2 /* CONTAINS */)) : "ASCENDING" === l.order ? s.push(new mt(h, 0 /* ASCENDING */)) : "DESCENDING" === l.order && s.push(new mt(h, 1 /* DESCENDING */));
|
|
20544
20545
|
}
|
|
20545
20546
|
n.push(new dt(dt.UNKNOWN_ID, u, s, wt.empty()));
|
|
@@ -20573,7 +20574,7 @@ function Dh(t, i) {
|
|
|
20573
20574
|
u.push(o.deleteFieldIndex(t, e));
|
|
20574
20575
|
}));
|
|
20575
20576
|
})).next((function() {
|
|
20576
|
-
return
|
|
20577
|
+
return _t.waitFor(u);
|
|
20577
20578
|
}));
|
|
20578
20579
|
})) ];
|
|
20579
20580
|
}));
|
|
@@ -20582,7 +20583,7 @@ function Dh(t, i) {
|
|
|
20582
20583
|
}));
|
|
20583
20584
|
}
|
|
20584
20585
|
|
|
20585
|
-
function
|
|
20586
|
+
function xh(t, e) {
|
|
20586
20587
|
if ("string" != typeof t[e]) throw new j(K.INVALID_ARGUMENT, "Missing string value for: " + e);
|
|
20587
20588
|
return t[e];
|
|
20588
20589
|
}
|
|
@@ -20599,9 +20600,9 @@ function _h(t, e) {
|
|
|
20599
20600
|
return r = Object.assign({
|
|
20600
20601
|
useFetchStreams: yh
|
|
20601
20602
|
}, r), o._setSettings(r), o;
|
|
20602
|
-
}), "PUBLIC").setMultipleInstances(!0)), u(
|
|
20603
|
+
}), "PUBLIC").setMultipleInstances(!0)), u(N, "3.7.2", void 0),
|
|
20603
20604
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
|
20604
|
-
u(
|
|
20605
|
+
u(N, "3.7.2", "esm5");
|
|
20605
20606
|
|
|
20606
|
-
export { Bl as AbstractUserDataWriter, rc as AggregateField, ic as AggregateQuerySnapshot, Bc as Bytes, Sc as CACHE_SIZE_UNLIMITED, Ha as CollectionReference, za as DocumentReference, Ql as DocumentSnapshot, Gc as FieldPath, jc as FieldValue, Dc as Firestore, j as FirestoreError, Qc as GeoPoint,
|
|
20607
|
+
export { Bl as AbstractUserDataWriter, rc as AggregateField, ic as AggregateQuerySnapshot, Bc as Bytes, Sc as CACHE_SIZE_UNLIMITED, Ha as CollectionReference, za as DocumentReference, Ql as DocumentSnapshot, Gc as FieldPath, jc as FieldValue, Dc as Firestore, j as FirestoreError, Qc as GeoPoint, Ec as LoadBundleTask, Wa as Query, Tl as QueryConstraint, zl as QueryDocumentSnapshot, Wl as QuerySnapshot, jl as SnapshotMetadata, ut as Timestamp, mh as Transaction, ph as WriteBatch, ue as _DatabaseId, ft as _DocumentKey, tt as _EmptyAppCheckTokenProvider, W as _EmptyAuthCredentialsProvider, ht as _FieldPath, Ua as _cast, B as _debugAssert, Xt as _isBase64Available, P as _logWarn, Ma as _validateIsNotUsedTogether, uh as addDoc, hh as aggregateQuerySnapshotEqual, Th as arrayRemove, Ih as arrayUnion, Rc as clearIndexedDbPersistence, Ya as collection, Xa as collectionGroup, Qa as connectFirestoreEmulator, oh as deleteDoc, wh as deleteField, Mc as disableNetwork, Za as doc, Kc as documentId, Cc as enableIndexedDbPersistence, kc as enableMultiTabIndexedDbPersistence, Lc as enableNetwork, Ml as endAt, Ll as endBefore, Ac as ensureFirestoreConfigured, ch as executeWrite, fh as getCountFromServer, Xl as getDoc, Jl as getDocFromCache, $l as getDocFromServer, th as getDocs, eh as getDocsFromCache, nh as getDocsFromServer, _c as getFirestore, Eh as increment, xc as initializeFirestore, Nl as limit, Cl as limitToLast, Fc as loadBundle, qc as namedQuery, sh as onSnapshot, ah as onSnapshotsInSync, _l as orderBy, El as query, $a as queryEqual, Ja as refEqual, gh as runTransaction, bh as serverTimestamp, rh as setDoc, Dh as setIndexConfiguration, V as setLogLevel, Yl as snapshotEqual, Rl as startAfter, Ol as startAt, Pc as terminate, ih as updateDoc, Vc as waitForPendingWrites, Dl as where, Sh as writeBatch };
|
|
20607
20608
|
//# sourceMappingURL=index.esm5.js.map
|