@firebase/firestore 3.1.1 → 3.2.0-canary.477bdef13
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/firestore/src/register.d.ts +1 -1
- package/dist/firestore/src/remote/persistent_stream.d.ts +5 -1
- package/dist/firestore/src/util/async_queue.d.ts +4 -2
- package/dist/index.esm2017.js +534 -526
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +757 -748
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +7049 -9102
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/{index.node.cjs.esm2017.js → index.node.mjs} +51 -20
- package/dist/index.node.mjs.map +1 -0
- package/dist/index.rn.js +534 -526
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +4 -2
- package/dist/lite/firestore/src/register.d.ts +1 -1
- package/dist/lite/firestore/src/remote/persistent_stream.d.ts +5 -1
- package/dist/lite/firestore/src/util/async_queue.d.ts +4 -2
- package/dist/lite/index.browser.esm2017.js +2 -2
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +2 -2
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +1804 -2261
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/{index.node.esm2017.js → index.node.mjs} +3 -3
- package/dist/lite/index.node.mjs.map +1 -0
- package/dist/lite/index.rn.esm2017.js +69 -69
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +4 -2
- package/dist/lite/packages/firestore/src/register.d.ts +1 -1
- package/dist/lite/packages/firestore/src/remote/persistent_stream.d.ts +5 -1
- package/dist/lite/packages/firestore/src/util/async_queue.d.ts +4 -2
- package/dist/lite/private.d.ts +4 -2
- package/dist/packages/firestore/dist/index.esm2017.d.ts +38 -38
- package/dist/packages/firestore/src/register.d.ts +1 -1
- package/dist/packages/firestore/src/remote/persistent_stream.d.ts +5 -1
- package/dist/packages/firestore/src/util/async_queue.d.ts +4 -2
- package/dist/private.d.ts +4 -2
- package/lite/package.json +1 -1
- package/package.json +20 -14
- package/dist/index.node.cjs.esm2017.js.map +0 -1
- package/dist/lite/firestore/dist/lite/index.node.esm2017.d.ts +0 -1195
- package/dist/lite/index.node.esm2017.js.map +0 -1
- package/dist/packages/firestore/dist/index.node.cjs.esm2017.d.ts +0 -1844
package/dist/index.esm5.js
CHANGED
|
@@ -70,7 +70,7 @@ O.MOCK_USER = new O("mock-user");
|
|
|
70
70
|
* See the License for the specific language governing permissions and
|
|
71
71
|
* limitations under the License.
|
|
72
72
|
*/
|
|
73
|
-
var P = "9.
|
|
73
|
+
var P = "9.2.0-canary.477bdef13", F = new h("@firebase/firestore");
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* @license
|
|
@@ -112,7 +112,7 @@ function M() {
|
|
|
112
112
|
function q(t) {
|
|
113
113
|
for (var n = [], r = 1; r < arguments.length; r++) n[r - 1] = arguments[r];
|
|
114
114
|
if (F.logLevel <= f.DEBUG) {
|
|
115
|
-
var i = n.map(
|
|
115
|
+
var i = n.map(j);
|
|
116
116
|
F.debug.apply(F, e([ "Firestore (" + P + "): " + t ], i));
|
|
117
117
|
}
|
|
118
118
|
}
|
|
@@ -120,7 +120,7 @@ function q(t) {
|
|
|
120
120
|
function U(t) {
|
|
121
121
|
for (var n = [], r = 1; r < arguments.length; r++) n[r - 1] = arguments[r];
|
|
122
122
|
if (F.logLevel <= f.ERROR) {
|
|
123
|
-
var i = n.map(
|
|
123
|
+
var i = n.map(j);
|
|
124
124
|
F.error.apply(F, e([ "Firestore (" + P + "): " + t ], i));
|
|
125
125
|
}
|
|
126
126
|
}
|
|
@@ -130,14 +130,14 @@ function U(t) {
|
|
|
130
130
|
*/ function B(t) {
|
|
131
131
|
for (var n = [], r = 1; r < arguments.length; r++) n[r - 1] = arguments[r];
|
|
132
132
|
if (F.logLevel <= f.WARN) {
|
|
133
|
-
var i = n.map(
|
|
133
|
+
var i = n.map(j);
|
|
134
134
|
F.warn.apply(F, e([ "Firestore (" + P + "): " + t ], i));
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
/**
|
|
139
139
|
* Converts an additional log parameter to a string representation.
|
|
140
|
-
*/ function
|
|
140
|
+
*/ function j(t) {
|
|
141
141
|
if ("string" == typeof t) return t;
|
|
142
142
|
try {
|
|
143
143
|
return e = t, JSON.stringify(e);
|
|
@@ -187,7 +187,7 @@ function U(t) {
|
|
|
187
187
|
* Returns `never` and can be used in expressions:
|
|
188
188
|
* @example
|
|
189
189
|
* let futureVar = fail('not implemented yet');
|
|
190
|
-
*/ function
|
|
190
|
+
*/ function K(t) {
|
|
191
191
|
void 0 === t && (t = "Unexpected state");
|
|
192
192
|
// Log the failure in addition to throw an exception, just in case the
|
|
193
193
|
// exception is swallowed.
|
|
@@ -205,7 +205,7 @@ function U(t) {
|
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
function z(t, e) {
|
|
208
|
-
t ||
|
|
208
|
+
t || K();
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
/**
|
|
@@ -218,7 +218,7 @@ function z(t, e) {
|
|
|
218
218
|
*
|
|
219
219
|
* @internal
|
|
220
220
|
*/ function G(t, e) {
|
|
221
|
-
t ||
|
|
221
|
+
t || K();
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
/**
|
|
@@ -398,7 +398,7 @@ e) {
|
|
|
398
398
|
return e(O.UNAUTHENTICATED);
|
|
399
399
|
}));
|
|
400
400
|
}, t.prototype.shutdown = function() {}, t;
|
|
401
|
-
}(),
|
|
401
|
+
}(), Z = /** @class */ function() {
|
|
402
402
|
function t(t) {
|
|
403
403
|
this.token = t,
|
|
404
404
|
/**
|
|
@@ -420,7 +420,7 @@ e) {
|
|
|
420
420
|
}, t.prototype.shutdown = function() {
|
|
421
421
|
this.changeListener = null;
|
|
422
422
|
}, t;
|
|
423
|
-
}(),
|
|
423
|
+
}(), $ = /** @class */ function() {
|
|
424
424
|
function t(t) {
|
|
425
425
|
this.t = t,
|
|
426
426
|
/** Tracks the current User. */
|
|
@@ -870,7 +870,7 @@ function lt(t) {
|
|
|
870
870
|
* Path represents an ordered sequence of string segments.
|
|
871
871
|
*/ var dt = /** @class */ function() {
|
|
872
872
|
function t(t, e, n) {
|
|
873
|
-
void 0 === e ? e = 0 : e > t.length &&
|
|
873
|
+
void 0 === e ? e = 0 : e > t.length && K(), void 0 === n ? n = t.length - e : n > t.length - e && K(),
|
|
874
874
|
this.segments = t, this.offset = e, this.len = n;
|
|
875
875
|
}
|
|
876
876
|
return Object.defineProperty(t.prototype, "length", {
|
|
@@ -1334,7 +1334,7 @@ var bt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1334
1334
|
* limitations under the License.
|
|
1335
1335
|
*/
|
|
1336
1336
|
/** Extracts the backend's type order for the provided value. */ function xt(t) {
|
|
1337
|
-
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 ? St(t) ? 4 /* ServerTimestampValue */ : 10 /* ObjectValue */ :
|
|
1337
|
+
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 ? St(t) ? 4 /* ServerTimestampValue */ : 10 /* ObjectValue */ : K();
|
|
1338
1338
|
}
|
|
1339
1339
|
|
|
1340
1340
|
/** Tests `left` and `right` for equality based on the backend semantics. */ function Lt(t, e) {
|
|
@@ -1397,7 +1397,7 @@ var bt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1397
1397
|
}(t, e);
|
|
1398
1398
|
|
|
1399
1399
|
default:
|
|
1400
|
-
return
|
|
1400
|
+
return K();
|
|
1401
1401
|
}
|
|
1402
1402
|
}
|
|
1403
1403
|
|
|
@@ -1482,7 +1482,7 @@ function Ot(t, e) {
|
|
|
1482
1482
|
}(t.mapValue, e.mapValue);
|
|
1483
1483
|
|
|
1484
1484
|
default:
|
|
1485
|
-
throw
|
|
1485
|
+
throw K();
|
|
1486
1486
|
}
|
|
1487
1487
|
}
|
|
1488
1488
|
|
|
@@ -1515,7 +1515,7 @@ function Mt(t) {
|
|
|
1515
1515
|
n ? n = !1 : e += ",", e += o + ":" + Mt(t.fields[o]);
|
|
1516
1516
|
}
|
|
1517
1517
|
return e + "}";
|
|
1518
|
-
}(t.mapValue) :
|
|
1518
|
+
}(t.mapValue) : K();
|
|
1519
1519
|
var e, n;
|
|
1520
1520
|
}
|
|
1521
1521
|
|
|
@@ -1538,11 +1538,11 @@ function Vt(t, e) {
|
|
|
1538
1538
|
return !!t && "nullValue" in t;
|
|
1539
1539
|
}
|
|
1540
1540
|
|
|
1541
|
-
/** Returns true if `value` is NaN. */ function
|
|
1541
|
+
/** Returns true if `value` is NaN. */ function jt(t) {
|
|
1542
1542
|
return !!t && "doubleValue" in t && isNaN(Number(t.doubleValue));
|
|
1543
1543
|
}
|
|
1544
1544
|
|
|
1545
|
-
/** Returns true if `value` is a MapValue. */ function
|
|
1545
|
+
/** Returns true if `value` is a MapValue. */ function Kt(t) {
|
|
1546
1546
|
return !!t && "mapValue" in t;
|
|
1547
1547
|
}
|
|
1548
1548
|
|
|
@@ -1610,7 +1610,7 @@ function Vt(t, e) {
|
|
|
1610
1610
|
*/
|
|
1611
1611
|
t.prototype.field = function(t) {
|
|
1612
1612
|
if (t.isEmpty()) return this.value;
|
|
1613
|
-
for (var e = this.value, n = 0; n < t.length - 1; ++n) if (!
|
|
1613
|
+
for (var e = this.value, n = 0; n < t.length - 1; ++n) if (!Kt(e = (e.mapValue.fields || {})[t.get(n)])) return null;
|
|
1614
1614
|
return (e = (e.mapValue.fields || {})[t.lastSegment()]) || null;
|
|
1615
1615
|
},
|
|
1616
1616
|
/**
|
|
@@ -1648,7 +1648,7 @@ function Vt(t, e) {
|
|
|
1648
1648
|
*/
|
|
1649
1649
|
t.prototype.delete = function(t) {
|
|
1650
1650
|
var e = this.field(t.popLast());
|
|
1651
|
-
|
|
1651
|
+
Kt(e) && e.mapValue.fields && delete e.mapValue.fields[t.lastSegment()];
|
|
1652
1652
|
}, t.prototype.isEqual = function(t) {
|
|
1653
1653
|
return Lt(this.value, t.value);
|
|
1654
1654
|
},
|
|
@@ -1663,7 +1663,7 @@ function Vt(t, e) {
|
|
|
1663
1663
|
});
|
|
1664
1664
|
for (var n = 0; n < t.length; ++n) {
|
|
1665
1665
|
var r = e.mapValue.fields[t.get(n)];
|
|
1666
|
-
|
|
1666
|
+
Kt(r) && r.mapValue.fields || (r = {
|
|
1667
1667
|
mapValue: {
|
|
1668
1668
|
fields: {}
|
|
1669
1669
|
}
|
|
@@ -1694,7 +1694,7 @@ function Vt(t, e) {
|
|
|
1694
1694
|
var e = [];
|
|
1695
1695
|
return ft(t.fields, (function(t, n) {
|
|
1696
1696
|
var r = new vt([ t ]);
|
|
1697
|
-
if (
|
|
1697
|
+
if (Kt(n)) {
|
|
1698
1698
|
var i = Qt(n.mapValue).fields;
|
|
1699
1699
|
if (0 === i.length)
|
|
1700
1700
|
// Preserve the empty map by adding it to the FieldMask.
|
|
@@ -1903,11 +1903,11 @@ function Xt(t, e) {
|
|
|
1903
1903
|
return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!de(t.startAt, e.startAt) && de(t.endAt, e.endAt);
|
|
1904
1904
|
}
|
|
1905
1905
|
|
|
1906
|
-
function
|
|
1906
|
+
function Zt(t) {
|
|
1907
1907
|
return Ct.isDocumentKey(t.path) && null === t.collectionGroup && 0 === t.filters.length;
|
|
1908
1908
|
}
|
|
1909
1909
|
|
|
1910
|
-
var
|
|
1910
|
+
var $t = /** @class */ function(e) {
|
|
1911
1911
|
function n(t, n, r) {
|
|
1912
1912
|
var i = this;
|
|
1913
1913
|
return (i = e.call(this) || this).field = t, i.op = n, i.value = r, i;
|
|
@@ -1944,7 +1944,7 @@ var Zt = /** @class */ function(e) {
|
|
|
1944
1944
|
return t >= 0;
|
|
1945
1945
|
|
|
1946
1946
|
default:
|
|
1947
|
-
return
|
|
1947
|
+
return K();
|
|
1948
1948
|
}
|
|
1949
1949
|
}, n.prototype.v = function() {
|
|
1950
1950
|
return [ "<" /* LESS_THAN */ , "<=" /* LESS_THAN_OR_EQUAL */ , ">" /* GREATER_THAN */ , ">=" /* GREATER_THAN_OR_EQUAL */ , "!=" /* NOT_EQUAL */ , "not-in" /* NOT_IN */ ].indexOf(this.op) >= 0;
|
|
@@ -1961,7 +1961,7 @@ var te = /** @class */ function(e) {
|
|
|
1961
1961
|
var e = Ct.comparator(t.key, this.key);
|
|
1962
1962
|
return this.P(e);
|
|
1963
1963
|
}, n;
|
|
1964
|
-
}(
|
|
1964
|
+
}($t), ee = /** @class */ function(e) {
|
|
1965
1965
|
function n(t, n) {
|
|
1966
1966
|
var r = this;
|
|
1967
1967
|
return (r = e.call(this, t, "in" /* IN */ , n) || this).keys = re("in" /* IN */ , n),
|
|
@@ -1972,7 +1972,7 @@ var te = /** @class */ function(e) {
|
|
|
1972
1972
|
return e.isEqual(t.key);
|
|
1973
1973
|
}));
|
|
1974
1974
|
}, n;
|
|
1975
|
-
}(
|
|
1975
|
+
}($t), ne = /** @class */ function(e) {
|
|
1976
1976
|
function n(t, n) {
|
|
1977
1977
|
var r = this;
|
|
1978
1978
|
return (r = e.call(this, t, "not-in" /* NOT_IN */ , n) || this).keys = re("not-in" /* NOT_IN */ , n),
|
|
@@ -1983,7 +1983,7 @@ var te = /** @class */ function(e) {
|
|
|
1983
1983
|
return e.isEqual(t.key);
|
|
1984
1984
|
}));
|
|
1985
1985
|
}, n;
|
|
1986
|
-
}(
|
|
1986
|
+
}($t);
|
|
1987
1987
|
|
|
1988
1988
|
/** Filter that matches on key fields within an array. */ function re(t, e) {
|
|
1989
1989
|
var n;
|
|
@@ -2000,7 +2000,7 @@ var te = /** @class */ function(e) {
|
|
|
2000
2000
|
var e = t.data.field(this.field);
|
|
2001
2001
|
return Ut(e) && Rt(e.arrayValue, this.value);
|
|
2002
2002
|
}, n;
|
|
2003
|
-
}(
|
|
2003
|
+
}($t), oe = /** @class */ function(e) {
|
|
2004
2004
|
function n(t, n) {
|
|
2005
2005
|
return e.call(this, t, "in" /* IN */ , n) || this;
|
|
2006
2006
|
}
|
|
@@ -2008,7 +2008,7 @@ var te = /** @class */ function(e) {
|
|
|
2008
2008
|
var e = t.data.field(this.field);
|
|
2009
2009
|
return null !== e && Rt(this.value.arrayValue, e);
|
|
2010
2010
|
}, n;
|
|
2011
|
-
}(
|
|
2011
|
+
}($t), se = /** @class */ function(e) {
|
|
2012
2012
|
function n(t, n) {
|
|
2013
2013
|
return e.call(this, t, "not-in" /* NOT_IN */ , n) || this;
|
|
2014
2014
|
}
|
|
@@ -2019,7 +2019,7 @@ var te = /** @class */ function(e) {
|
|
|
2019
2019
|
var e = t.data.field(this.field);
|
|
2020
2020
|
return null !== e && !Rt(this.value.arrayValue, e);
|
|
2021
2021
|
}, n;
|
|
2022
|
-
}(
|
|
2022
|
+
}($t), ae = /** @class */ function(e) {
|
|
2023
2023
|
function n(t, n) {
|
|
2024
2024
|
return e.call(this, t, "array-contains-any" /* ARRAY_CONTAINS_ANY */ , n) || this;
|
|
2025
2025
|
}
|
|
@@ -2029,7 +2029,7 @@ var te = /** @class */ function(e) {
|
|
|
2029
2029
|
return Rt(e.value.arrayValue, t);
|
|
2030
2030
|
}));
|
|
2031
2031
|
}, n;
|
|
2032
|
-
}(
|
|
2032
|
+
}($t), ue = function(t, e) {
|
|
2033
2033
|
this.position = t, this.before = e;
|
|
2034
2034
|
};
|
|
2035
2035
|
|
|
@@ -2266,7 +2266,7 @@ function ke(t) {
|
|
|
2266
2266
|
function Ce(t, e, n) {
|
|
2267
2267
|
var r = t.field.isKeyField() ? Ct.comparator(e.key, n.key) : function(t, e, n) {
|
|
2268
2268
|
var r = e.data.field(t), i = n.data.field(t);
|
|
2269
|
-
return null !== r && null !== i ? Ot(r, i) :
|
|
2269
|
+
return null !== r && null !== i ? Ot(r, i) : K();
|
|
2270
2270
|
}(t.field, e, n);
|
|
2271
2271
|
switch (t.dir) {
|
|
2272
2272
|
case "asc" /* ASCENDING */ :
|
|
@@ -2276,7 +2276,7 @@ function Ce(t, e, n) {
|
|
|
2276
2276
|
return -1 * r;
|
|
2277
2277
|
|
|
2278
2278
|
default:
|
|
2279
|
-
return
|
|
2279
|
+
return K();
|
|
2280
2280
|
}
|
|
2281
2281
|
}
|
|
2282
2282
|
|
|
@@ -2375,7 +2375,7 @@ function Ce(t, e, n) {
|
|
|
2375
2375
|
return e && (n.fields.__previous_value__ = e), {
|
|
2376
2376
|
mapValue: n
|
|
2377
2377
|
};
|
|
2378
|
-
}(n, e) : t instanceof qe ? Ue(t, e) : t instanceof Be ?
|
|
2378
|
+
}(n, e) : t instanceof qe ? Ue(t, e) : t instanceof Be ? je(t, e) : function(t, e) {
|
|
2379
2379
|
// PORTING NOTE: Since JavaScript's integer arithmetic is limited to 53 bit
|
|
2380
2380
|
// precision and resolves overflows by reducing precision, we do not
|
|
2381
2381
|
// manually cap overflows at 2^63.
|
|
@@ -2391,7 +2391,7 @@ function Ce(t, e, n) {
|
|
|
2391
2391
|
// The server just sends null as the transform result for array operations,
|
|
2392
2392
|
// so we have to calculate a result the same as we do for local
|
|
2393
2393
|
// applications.
|
|
2394
|
-
return t instanceof qe ? Ue(t, e) : t instanceof Be ?
|
|
2394
|
+
return t instanceof qe ? Ue(t, e) : t instanceof Be ? je(t, e) : n;
|
|
2395
2395
|
}
|
|
2396
2396
|
|
|
2397
2397
|
/**
|
|
@@ -2409,7 +2409,7 @@ function Ce(t, e, n) {
|
|
|
2409
2409
|
* @returns a base value to store along with the mutation, or null for
|
|
2410
2410
|
* idempotent transforms.
|
|
2411
2411
|
*/ function Me(t, e) {
|
|
2412
|
-
return t instanceof
|
|
2412
|
+
return t instanceof Ke ? qt(n = e) || function(t) {
|
|
2413
2413
|
return !!t && "doubleValue" in t;
|
|
2414
2414
|
}(n) ? e : {
|
|
2415
2415
|
integerValue: 0
|
|
@@ -2453,7 +2453,7 @@ function Ce(t, e, n) {
|
|
|
2453
2453
|
return t(n, e), n;
|
|
2454
2454
|
}(Oe);
|
|
2455
2455
|
|
|
2456
|
-
function
|
|
2456
|
+
function je(t, e) {
|
|
2457
2457
|
for (var n = Ge(e), r = function(t) {
|
|
2458
2458
|
n = n.filter((function(e) {
|
|
2459
2459
|
return !Lt(e, t);
|
|
@@ -2473,7 +2473,7 @@ function Ke(t, e) {
|
|
|
2473
2473
|
* transforms. Converts all field values to integers or doubles, but unlike the
|
|
2474
2474
|
* backend does not cap integer values at 2^63. Instead, JavaScript number
|
|
2475
2475
|
* arithmetic is used and precision loss can occur for values greater than 2^53.
|
|
2476
|
-
*/ var
|
|
2476
|
+
*/ var Ke = /** @class */ function(e) {
|
|
2477
2477
|
function n(t, n) {
|
|
2478
2478
|
var r = this;
|
|
2479
2479
|
return (r = e.call(this) || this).N = t, r.C = n, r;
|
|
@@ -2651,7 +2651,7 @@ e) {
|
|
|
2651
2651
|
* of the document.
|
|
2652
2652
|
* @param localWriteTime - A timestamp indicating the local write time of the
|
|
2653
2653
|
* batch this mutation is a part of.
|
|
2654
|
-
*/ function
|
|
2654
|
+
*/ function Ze(t, e, n) {
|
|
2655
2655
|
t instanceof nn ? function(t, e, n) {
|
|
2656
2656
|
if (Ye(t.precondition, e)) {
|
|
2657
2657
|
var r = t.value.clone(), i = an(t.fieldTransforms, n, e);
|
|
@@ -2685,7 +2685,7 @@ e) {
|
|
|
2685
2685
|
*
|
|
2686
2686
|
* @returns a base value to store along with the mutation, or null for
|
|
2687
2687
|
* idempotent mutations.
|
|
2688
|
-
*/ function
|
|
2688
|
+
*/ function $e(t, e) {
|
|
2689
2689
|
for (var n = null, r = 0, i = t.fieldTransforms; r < i.length; r++) {
|
|
2690
2690
|
var o = i[r], s = e.data.field(o.field), a = Me(o.transform, s || null);
|
|
2691
2691
|
null != a && (null == n && (n = Gt.empty()), n.set(o.field, a));
|
|
@@ -2698,7 +2698,7 @@ function tn(t, e) {
|
|
|
2698
2698
|
return void 0 === t && void 0 === e || !(!t || !e) && st(t, e, (function(t, e) {
|
|
2699
2699
|
return function(t, e) {
|
|
2700
2700
|
return t.field.isEqual(e.field) && function(t, e) {
|
|
2701
|
-
return t instanceof qe && e instanceof qe || t instanceof Be && e instanceof Be ? st(t.elements, e.elements, Lt) : t instanceof
|
|
2701
|
+
return t instanceof qe && e instanceof qe || t instanceof Be && e instanceof Be ? st(t.elements, e.elements, Lt) : t instanceof Ke && e instanceof Ke ? Lt(t.C, e.C) : t instanceof Ve && e instanceof Ve;
|
|
2702
2702
|
}(t.transform, e.transform);
|
|
2703
2703
|
}(t, e);
|
|
2704
2704
|
}));
|
|
@@ -2814,7 +2814,7 @@ function(t) {
|
|
|
2814
2814
|
function dn(t) {
|
|
2815
2815
|
switch (t) {
|
|
2816
2816
|
default:
|
|
2817
|
-
return
|
|
2817
|
+
return K();
|
|
2818
2818
|
|
|
2819
2819
|
case H.CANCELLED:
|
|
2820
2820
|
case H.UNKNOWN:
|
|
@@ -2919,7 +2919,7 @@ function dn(t) {
|
|
|
2919
2919
|
return H.DATA_LOSS;
|
|
2920
2920
|
|
|
2921
2921
|
default:
|
|
2922
|
-
return
|
|
2922
|
+
return K();
|
|
2923
2923
|
}
|
|
2924
2924
|
}
|
|
2925
2925
|
|
|
@@ -3173,10 +3173,10 @@ var yn = /** @class */ function() {
|
|
|
3173
3173
|
// In a balanced RB tree, the black-depth (number of black nodes) from root to
|
|
3174
3174
|
// leaves is equal on both sides. This function verifies that or asserts.
|
|
3175
3175
|
t.prototype.check = function() {
|
|
3176
|
-
if (this.isRed() && this.left.isRed()) throw
|
|
3177
|
-
if (this.right.isRed()) throw
|
|
3176
|
+
if (this.isRed() && this.left.isRed()) throw K();
|
|
3177
|
+
if (this.right.isRed()) throw K();
|
|
3178
3178
|
var t = this.left.check();
|
|
3179
|
-
if (t !== this.right.check()) throw
|
|
3179
|
+
if (t !== this.right.check()) throw K();
|
|
3180
3180
|
return t + (this.isRed() ? 0 : 1);
|
|
3181
3181
|
}, t;
|
|
3182
3182
|
}();
|
|
@@ -3194,31 +3194,31 @@ mn.EMPTY = new (/** @class */ function() {
|
|
|
3194
3194
|
}
|
|
3195
3195
|
return Object.defineProperty(t.prototype, "key", {
|
|
3196
3196
|
get: function() {
|
|
3197
|
-
throw
|
|
3197
|
+
throw K();
|
|
3198
3198
|
},
|
|
3199
3199
|
enumerable: !1,
|
|
3200
3200
|
configurable: !0
|
|
3201
3201
|
}), Object.defineProperty(t.prototype, "value", {
|
|
3202
3202
|
get: function() {
|
|
3203
|
-
throw
|
|
3203
|
+
throw K();
|
|
3204
3204
|
},
|
|
3205
3205
|
enumerable: !1,
|
|
3206
3206
|
configurable: !0
|
|
3207
3207
|
}), Object.defineProperty(t.prototype, "color", {
|
|
3208
3208
|
get: function() {
|
|
3209
|
-
throw
|
|
3209
|
+
throw K();
|
|
3210
3210
|
},
|
|
3211
3211
|
enumerable: !1,
|
|
3212
3212
|
configurable: !0
|
|
3213
3213
|
}), Object.defineProperty(t.prototype, "left", {
|
|
3214
3214
|
get: function() {
|
|
3215
|
-
throw
|
|
3215
|
+
throw K();
|
|
3216
3216
|
},
|
|
3217
3217
|
enumerable: !1,
|
|
3218
3218
|
configurable: !0
|
|
3219
3219
|
}), Object.defineProperty(t.prototype, "right", {
|
|
3220
3220
|
get: function() {
|
|
3221
|
-
throw
|
|
3221
|
+
throw K();
|
|
3222
3222
|
},
|
|
3223
3223
|
enumerable: !1,
|
|
3224
3224
|
configurable: !0
|
|
@@ -3618,7 +3618,7 @@ n
|
|
|
3618
3618
|
break;
|
|
3619
3619
|
|
|
3620
3620
|
default:
|
|
3621
|
-
|
|
3621
|
+
K();
|
|
3622
3622
|
}
|
|
3623
3623
|
})), new xn(this.L, this.B, t, e, n);
|
|
3624
3624
|
},
|
|
@@ -3707,7 +3707,7 @@ n
|
|
|
3707
3707
|
break;
|
|
3708
3708
|
|
|
3709
3709
|
default:
|
|
3710
|
-
|
|
3710
|
+
K();
|
|
3711
3711
|
}
|
|
3712
3712
|
}));
|
|
3713
3713
|
},
|
|
@@ -3731,7 +3731,7 @@ n
|
|
|
3731
3731
|
var e = t.targetId, n = t.O.count, r = this.dt(e);
|
|
3732
3732
|
if (r) {
|
|
3733
3733
|
var i = r.target;
|
|
3734
|
-
if (
|
|
3734
|
+
if (Zt(i)) if (0 === n) {
|
|
3735
3735
|
// The existence filter told us the document does not exist. We deduce
|
|
3736
3736
|
// that this document does not exist and apply a deleted document to
|
|
3737
3737
|
// our updates. Without applying this deleted document there might be
|
|
@@ -3755,7 +3755,7 @@ n
|
|
|
3755
3755
|
this.et.forEach((function(r, i) {
|
|
3756
3756
|
var o = e.dt(i);
|
|
3757
3757
|
if (o) {
|
|
3758
|
-
if (r.current &&
|
|
3758
|
+
if (r.current && Zt(o.target)) {
|
|
3759
3759
|
// Document queries for document that don't exist can produce an empty
|
|
3760
3760
|
// result set. To update our local cache, we synthesize a document
|
|
3761
3761
|
// delete if we have not previously received the document. This
|
|
@@ -3939,7 +3939,7 @@ function Vn() {
|
|
|
3939
3939
|
/**
|
|
3940
3940
|
* Returns a value for a Date that's appropriate to put into a proto.
|
|
3941
3941
|
*/
|
|
3942
|
-
function
|
|
3942
|
+
function jn(t, e) {
|
|
3943
3943
|
return t.D ? new Date(1e3 * e.seconds).toISOString().replace(/\.\d*/, "").replace("Z", "") + "." + ("000000000" + e.nanoseconds).slice(-9) + "Z" : {
|
|
3944
3944
|
seconds: "" + e.seconds,
|
|
3945
3945
|
nanos: e.nanoseconds
|
|
@@ -3950,14 +3950,14 @@ function Kn(t, e) {
|
|
|
3950
3950
|
* Returns a value for bytes that's appropriate to put in a proto.
|
|
3951
3951
|
*
|
|
3952
3952
|
* Visible for testing.
|
|
3953
|
-
*/ function
|
|
3953
|
+
*/ function Kn(t, e) {
|
|
3954
3954
|
return t.D ? e.toBase64() : e.toUint8Array();
|
|
3955
3955
|
}
|
|
3956
3956
|
|
|
3957
3957
|
/**
|
|
3958
3958
|
* Returns a ByteString based on the proto string value.
|
|
3959
3959
|
*/ function zn(t, e) {
|
|
3960
|
-
return
|
|
3960
|
+
return jn(t, e.toTimestamp());
|
|
3961
3961
|
}
|
|
3962
3962
|
|
|
3963
3963
|
function Gn(t) {
|
|
@@ -3986,7 +3986,7 @@ function Yn(t, e) {
|
|
|
3986
3986
|
var n = Hn(e);
|
|
3987
3987
|
if (n.get(1) !== t.databaseId.projectId) throw new W(H.INVALID_ARGUMENT, "Tried to deserialize key from different project: " + n.get(1) + " vs " + t.databaseId.projectId);
|
|
3988
3988
|
if (n.get(3) !== t.databaseId.database) throw new W(H.INVALID_ARGUMENT, "Tried to deserialize key from different database: " + n.get(3) + " vs " + t.databaseId.database);
|
|
3989
|
-
return new Ct(
|
|
3989
|
+
return new Ct($n(n));
|
|
3990
3990
|
}
|
|
3991
3991
|
|
|
3992
3992
|
function Jn(t, e) {
|
|
@@ -3999,14 +3999,14 @@ function Xn(t) {
|
|
|
3999
3999
|
// "/documents". In v1 all resource paths contain "/documents". Preserve the
|
|
4000
4000
|
// ability to read the v1beta1 form for compatibility with queries persisted
|
|
4001
4001
|
// in the local target cache.
|
|
4002
|
-
return 4 === e.length ? pt.emptyPath() :
|
|
4002
|
+
return 4 === e.length ? pt.emptyPath() : $n(e);
|
|
4003
4003
|
}
|
|
4004
4004
|
|
|
4005
|
-
function
|
|
4005
|
+
function Zn(t) {
|
|
4006
4006
|
return new pt([ "projects", t.databaseId.projectId, "databases", t.databaseId.database ]).canonicalString();
|
|
4007
4007
|
}
|
|
4008
4008
|
|
|
4009
|
-
function
|
|
4009
|
+
function $n(t) {
|
|
4010
4010
|
return z(t.length > 4 && "documents" === t.get(4)), t.popFirst(5)
|
|
4011
4011
|
/** Creates a Document proto from key and fields (but no create/update time) */;
|
|
4012
4012
|
}
|
|
@@ -4037,7 +4037,7 @@ function nr(t, e) {
|
|
|
4037
4037
|
update: tr(t, e.key, e.data),
|
|
4038
4038
|
updateMask: vr(e.fieldMask)
|
|
4039
4039
|
}; else {
|
|
4040
|
-
if (!(e instanceof fn)) return
|
|
4040
|
+
if (!(e instanceof fn)) return K();
|
|
4041
4041
|
n = {
|
|
4042
4042
|
verify: Wn(t, e.key)
|
|
4043
4043
|
};
|
|
@@ -4061,18 +4061,18 @@ function nr(t, e) {
|
|
|
4061
4061
|
values: n.elements
|
|
4062
4062
|
}
|
|
4063
4063
|
};
|
|
4064
|
-
if (n instanceof
|
|
4064
|
+
if (n instanceof Ke) return {
|
|
4065
4065
|
fieldPath: e.field.canonicalString(),
|
|
4066
4066
|
increment: n.C
|
|
4067
4067
|
};
|
|
4068
|
-
throw
|
|
4068
|
+
throw K();
|
|
4069
4069
|
}(0, t);
|
|
4070
4070
|
}))), e.precondition.isNone || (n.currentDocument = function(t, e) {
|
|
4071
4071
|
return void 0 !== e.updateTime ? {
|
|
4072
4072
|
updateTime: zn(t, e.updateTime)
|
|
4073
4073
|
} : void 0 !== e.exists ? {
|
|
4074
4074
|
exists: e.exists
|
|
4075
|
-
} :
|
|
4075
|
+
} : K();
|
|
4076
4076
|
}(t, e.precondition)), n;
|
|
4077
4077
|
}
|
|
4078
4078
|
|
|
@@ -4088,7 +4088,7 @@ function rr(t, e) {
|
|
|
4088
4088
|
} else if ("removeAllFromArray" in e) {
|
|
4089
4089
|
var i = e.removeAllFromArray.values || [];
|
|
4090
4090
|
n = new Be(i);
|
|
4091
|
-
} else "increment" in e ? n = new
|
|
4091
|
+
} else "increment" in e ? n = new Ke(t, e.increment) : K();
|
|
4092
4092
|
var o = vt.fromServerFormat(e.fieldPath);
|
|
4093
4093
|
return new Qe(o, n);
|
|
4094
4094
|
}(t, e);
|
|
@@ -4119,7 +4119,7 @@ function rr(t, e) {
|
|
|
4119
4119
|
var u = Yn(t, e.verify);
|
|
4120
4120
|
return new fn(u, n);
|
|
4121
4121
|
}
|
|
4122
|
-
return
|
|
4122
|
+
return K();
|
|
4123
4123
|
}
|
|
4124
4124
|
|
|
4125
4125
|
function ir(t, e) {
|
|
@@ -4145,7 +4145,7 @@ function or(t, e) {
|
|
|
4145
4145
|
// visible for testing
|
|
4146
4146
|
return function(t) {
|
|
4147
4147
|
if ("==" /* EQUAL */ === t.op) {
|
|
4148
|
-
if (
|
|
4148
|
+
if (jt(t.value)) return {
|
|
4149
4149
|
unaryFilter: {
|
|
4150
4150
|
field: lr(t.field),
|
|
4151
4151
|
op: "IS_NAN"
|
|
@@ -4158,7 +4158,7 @@ function or(t, e) {
|
|
|
4158
4158
|
}
|
|
4159
4159
|
};
|
|
4160
4160
|
} else if ("!=" /* NOT_EQUAL */ === t.op) {
|
|
4161
|
-
if (
|
|
4161
|
+
if (jt(t.value)) return {
|
|
4162
4162
|
unaryFilter: {
|
|
4163
4163
|
field: lr(t.field),
|
|
4164
4164
|
op: "IS_NOT_NAN"
|
|
@@ -4254,7 +4254,7 @@ function ar(t) {
|
|
|
4254
4254
|
return ar(t);
|
|
4255
4255
|
})).reduce((function(t, e) {
|
|
4256
4256
|
return t.concat(e);
|
|
4257
|
-
})) :
|
|
4257
|
+
})) : K() : [];
|
|
4258
4258
|
}
|
|
4259
4259
|
|
|
4260
4260
|
function ur(t) {
|
|
@@ -4289,7 +4289,7 @@ function dr(t) {
|
|
|
4289
4289
|
}
|
|
4290
4290
|
|
|
4291
4291
|
function pr(t) {
|
|
4292
|
-
return
|
|
4292
|
+
return $t.create(dr(t.fieldFilter.field), function(t) {
|
|
4293
4293
|
switch (t) {
|
|
4294
4294
|
case "EQUAL":
|
|
4295
4295
|
return "==" /* EQUAL */;
|
|
@@ -4322,7 +4322,7 @@ function pr(t) {
|
|
|
4322
4322
|
return "array-contains-any" /* ARRAY_CONTAINS_ANY */;
|
|
4323
4323
|
|
|
4324
4324
|
default:
|
|
4325
|
-
return
|
|
4325
|
+
return K();
|
|
4326
4326
|
}
|
|
4327
4327
|
}(t.fieldFilter.op), t.fieldFilter.value);
|
|
4328
4328
|
}
|
|
@@ -4331,30 +4331,30 @@ function yr(t) {
|
|
|
4331
4331
|
switch (t.unaryFilter.op) {
|
|
4332
4332
|
case "IS_NAN":
|
|
4333
4333
|
var e = dr(t.unaryFilter.field);
|
|
4334
|
-
return
|
|
4334
|
+
return $t.create(e, "==" /* EQUAL */ , {
|
|
4335
4335
|
doubleValue: NaN
|
|
4336
4336
|
});
|
|
4337
4337
|
|
|
4338
4338
|
case "IS_NULL":
|
|
4339
4339
|
var n = dr(t.unaryFilter.field);
|
|
4340
|
-
return
|
|
4340
|
+
return $t.create(n, "==" /* EQUAL */ , {
|
|
4341
4341
|
nullValue: "NULL_VALUE"
|
|
4342
4342
|
});
|
|
4343
4343
|
|
|
4344
4344
|
case "IS_NOT_NAN":
|
|
4345
4345
|
var r = dr(t.unaryFilter.field);
|
|
4346
|
-
return
|
|
4346
|
+
return $t.create(r, "!=" /* NOT_EQUAL */ , {
|
|
4347
4347
|
doubleValue: NaN
|
|
4348
4348
|
});
|
|
4349
4349
|
|
|
4350
4350
|
case "IS_NOT_NULL":
|
|
4351
4351
|
var i = dr(t.unaryFilter.field);
|
|
4352
|
-
return
|
|
4352
|
+
return $t.create(i, "!=" /* NOT_EQUAL */ , {
|
|
4353
4353
|
nullValue: "NULL_VALUE"
|
|
4354
4354
|
});
|
|
4355
4355
|
|
|
4356
4356
|
default:
|
|
4357
|
-
return
|
|
4357
|
+
return K();
|
|
4358
4358
|
}
|
|
4359
4359
|
}
|
|
4360
4360
|
|
|
@@ -4434,7 +4434,7 @@ function mr(t) {
|
|
|
4434
4434
|
// The last two characters of a valid encoded path must be a separator, so
|
|
4435
4435
|
// there must be an end to this segment.
|
|
4436
4436
|
var s = t.indexOf("", o);
|
|
4437
|
-
switch ((s < 0 || s > n) &&
|
|
4437
|
+
switch ((s < 0 || s > n) && K(), t.charAt(s + 1)) {
|
|
4438
4438
|
case "":
|
|
4439
4439
|
var a = t.substring(o, s), u = void 0;
|
|
4440
4440
|
0 === i.length ?
|
|
@@ -4453,7 +4453,7 @@ function mr(t) {
|
|
|
4453
4453
|
break;
|
|
4454
4454
|
|
|
4455
4455
|
default:
|
|
4456
|
-
|
|
4456
|
+
K();
|
|
4457
4457
|
}
|
|
4458
4458
|
o = s + 2;
|
|
4459
4459
|
}
|
|
@@ -5026,7 +5026,7 @@ var Vr = e(e([], e(e([], e(e([], e(e([], [ Sr.store, Nr.store, _r.store, kr.stor
|
|
|
5026
5026
|
return this.next(void 0, t);
|
|
5027
5027
|
}, t.prototype.next = function(e, n) {
|
|
5028
5028
|
var r = this;
|
|
5029
|
-
return this.callbackAttached &&
|
|
5029
|
+
return this.callbackAttached && K(), this.callbackAttached = !0, this.isDone ? this.error ? this.wrapFailure(n, this.error) : this.wrapSuccess(e, this.result) : new t((function(t, i) {
|
|
5030
5030
|
r.nextCallback = function(n) {
|
|
5031
5031
|
r.wrapSuccess(e, n).next(t, i);
|
|
5032
5032
|
}, r.catchCallback = function(e) {
|
|
@@ -5097,7 +5097,7 @@ var Vr = e(e([], e(e([], e(e([], e(e([], [ Sr.store, Nr.store, _r.store, kr.stor
|
|
|
5097
5097
|
r.push(e.call(n, t, i));
|
|
5098
5098
|
})), this.waitFor(r);
|
|
5099
5099
|
}, t;
|
|
5100
|
-
}(),
|
|
5100
|
+
}(), jr = /** @class */ function() {
|
|
5101
5101
|
function t(t, e) {
|
|
5102
5102
|
var n = this;
|
|
5103
5103
|
this.action = t, this.transaction = e, this.aborted = !1,
|
|
@@ -5142,7 +5142,7 @@ var Vr = e(e([], e(e([], e(e([], e(e([], [ Sr.store, Nr.store, _r.store, kr.stor
|
|
|
5142
5142
|
var e = this.transaction.objectStore(t);
|
|
5143
5143
|
return new Hr(e);
|
|
5144
5144
|
}, t;
|
|
5145
|
-
}(),
|
|
5145
|
+
}(), Kr = /** @class */ function() {
|
|
5146
5146
|
/*
|
|
5147
5147
|
* Creates a new SimpleDb wrapper for IndexedDb database `name`.
|
|
5148
5148
|
*
|
|
@@ -5275,7 +5275,7 @@ var Vr = e(e([], e(e([], e(e([], e(e([], [ Sr.store, Nr.store, _r.store, kr.stor
|
|
|
5275
5275
|
// Wait for the transaction to complete (i.e. IndexedDb's onsuccess event to
|
|
5276
5276
|
// fire), but still return the original transactionFnResult back to the
|
|
5277
5277
|
// caller.
|
|
5278
|
-
return u.db = r.sent(), e =
|
|
5278
|
+
return u.db = r.sent(), e = jr.open(u.db, t, n ? "readonly" : "readwrite", i), a = o(e).catch((function(t) {
|
|
5279
5279
|
// Abort the transaction if there was an error.
|
|
5280
5280
|
return e.abort(t), Br.reject(t);
|
|
5281
5281
|
})).toPromise(), c = {}, a.catch((function() {})), [ 4 /*yield*/ , e.It ];
|
|
@@ -5538,7 +5538,7 @@ var Vr = e(e([], e(e([], e(e([], e(e([], [ Sr.store, Nr.store, _r.store, kr.stor
|
|
|
5538
5538
|
var Yr = !1;
|
|
5539
5539
|
|
|
5540
5540
|
function Jr(t) {
|
|
5541
|
-
var e =
|
|
5541
|
+
var e = Kr.Rt(l());
|
|
5542
5542
|
if (e >= 12.2 && e < 13) {
|
|
5543
5543
|
var n = "An internal error was encountered in the Indexed Database server";
|
|
5544
5544
|
if (t.message.indexOf(n) >= 0) {
|
|
@@ -5578,9 +5578,9 @@ function Jr(t) {
|
|
|
5578
5578
|
return t(n, e), n;
|
|
5579
5579
|
}(Ur);
|
|
5580
5580
|
|
|
5581
|
-
function
|
|
5581
|
+
function Zr(t, e) {
|
|
5582
5582
|
var n = Q(t);
|
|
5583
|
-
return
|
|
5583
|
+
return Kr.St(n.Qt, e);
|
|
5584
5584
|
}
|
|
5585
5585
|
|
|
5586
5586
|
/**
|
|
@@ -5601,7 +5601,7 @@ function $r(t, e) {
|
|
|
5601
5601
|
*/
|
|
5602
5602
|
/**
|
|
5603
5603
|
* A batch of mutations that will be sent as one unit to the backend.
|
|
5604
|
-
*/ var
|
|
5604
|
+
*/ var $r = /** @class */ function() {
|
|
5605
5605
|
/**
|
|
5606
5606
|
* @param batchId - The unique ID of this mutation batch.
|
|
5607
5607
|
* @param localWriteTime - The original write time of this mutation.
|
|
@@ -5641,12 +5641,12 @@ function $r(t, e) {
|
|
|
5641
5641
|
// transform against a consistent set of values.
|
|
5642
5642
|
for (var e = 0, n = this.baseMutations; e < n.length; e++) {
|
|
5643
5643
|
var r = n[e];
|
|
5644
|
-
r.key.isEqual(t.key) &&
|
|
5644
|
+
r.key.isEqual(t.key) && Ze(r, t, this.localWriteTime);
|
|
5645
5645
|
}
|
|
5646
5646
|
// Second, apply all user-provided mutations.
|
|
5647
5647
|
for (var i = 0, o = this.mutations; i < o.length; i++) {
|
|
5648
5648
|
var s = o[i];
|
|
5649
|
-
s.key.isEqual(t.key) &&
|
|
5649
|
+
s.key.isEqual(t.key) && Ze(s, t, this.localWriteTime);
|
|
5650
5650
|
}
|
|
5651
5651
|
},
|
|
5652
5652
|
/**
|
|
@@ -5758,7 +5758,7 @@ function $r(t, e) {
|
|
|
5758
5758
|
var o = Ct.fromSegments(e.unknownDocument.path), s = ui(e.unknownDocument.version);
|
|
5759
5759
|
return Ht.newUnknownDocument(o, s);
|
|
5760
5760
|
}
|
|
5761
|
-
return
|
|
5761
|
+
return K();
|
|
5762
5762
|
}
|
|
5763
5763
|
|
|
5764
5764
|
/** Encodes a document for storage locally. */ function ii(t, e, n) {
|
|
@@ -5768,7 +5768,7 @@ function $r(t, e) {
|
|
|
5768
5768
|
return {
|
|
5769
5769
|
name: Wn(t, e.key),
|
|
5770
5770
|
fields: e.data.value.mapValue.fields,
|
|
5771
|
-
updateTime:
|
|
5771
|
+
updateTime: jn(t, e.version.toTimestamp())
|
|
5772
5772
|
};
|
|
5773
5773
|
}(t.Wt, e), s = e.hasCommittedMutations;
|
|
5774
5774
|
return new kr(
|
|
@@ -5788,7 +5788,7 @@ function $r(t, e) {
|
|
|
5788
5788
|
/* document= */ null,
|
|
5789
5789
|
/* hasCommittedMutations= */ !0, r, i);
|
|
5790
5790
|
}
|
|
5791
|
-
return
|
|
5791
|
+
return K();
|
|
5792
5792
|
}
|
|
5793
5793
|
|
|
5794
5794
|
function oi(t) {
|
|
@@ -5831,7 +5831,7 @@ function ui(t) {
|
|
|
5831
5831
|
var s = e.mutations.map((function(e) {
|
|
5832
5832
|
return rr(t.Wt, e);
|
|
5833
5833
|
})), a = ut.fromMillis(e.localWriteTimeMs);
|
|
5834
|
-
return new
|
|
5834
|
+
return new $r(e.batchId, a, n, s);
|
|
5835
5835
|
}
|
|
5836
5836
|
|
|
5837
5837
|
/** Decodes a DbTarget into TargetData */ function hi(t) {
|
|
@@ -5845,7 +5845,7 @@ function ui(t) {
|
|
|
5845
5845
|
|
|
5846
5846
|
function fi(t, e) {
|
|
5847
5847
|
var n, r = ai(e.snapshotVersion), i = ai(e.lastLimboFreeSnapshotVersion);
|
|
5848
|
-
n =
|
|
5848
|
+
n = Zt(e.target) ? ir(t.Wt, e.target) : or(t.Wt, e.target);
|
|
5849
5849
|
// We can't store the resumeToken as a ByteString in IndexedDb, so we
|
|
5850
5850
|
// convert it to a base64 string for storage.
|
|
5851
5851
|
var o = e.resumeToken.toBase64();
|
|
@@ -5926,13 +5926,13 @@ function fi(t, e) {
|
|
|
5926
5926
|
/**
|
|
5927
5927
|
* Helper to get a typed SimpleDbStore for the bundles object store.
|
|
5928
5928
|
*/ function pi(t) {
|
|
5929
|
-
return
|
|
5929
|
+
return Zr(t, Fr.store);
|
|
5930
5930
|
}
|
|
5931
5931
|
|
|
5932
5932
|
/**
|
|
5933
5933
|
* Helper to get a typed SimpleDbStore for the namedQueries object store.
|
|
5934
5934
|
*/ function yi(t) {
|
|
5935
|
-
return
|
|
5935
|
+
return Zr(t, Mr.store);
|
|
5936
5936
|
}
|
|
5937
5937
|
|
|
5938
5938
|
/**
|
|
@@ -6038,7 +6038,7 @@ function fi(t, e) {
|
|
|
6038
6038
|
* document store.
|
|
6039
6039
|
*/
|
|
6040
6040
|
function wi(t) {
|
|
6041
|
-
return
|
|
6041
|
+
return Zr(t, Or.store);
|
|
6042
6042
|
}
|
|
6043
6043
|
|
|
6044
6044
|
/**
|
|
@@ -6122,7 +6122,7 @@ function Ti(t, e, n) {
|
|
|
6122
6122
|
if (!t) return 0;
|
|
6123
6123
|
var e;
|
|
6124
6124
|
if (t.document) e = t.document; else if (t.unknownDocument) e = t.unknownDocument; else {
|
|
6125
|
-
if (!t.noDocument) throw
|
|
6125
|
+
if (!t.noDocument) throw K();
|
|
6126
6126
|
e = t.noDocument;
|
|
6127
6127
|
}
|
|
6128
6128
|
return JSON.stringify(e).length;
|
|
@@ -6204,7 +6204,7 @@ var Si = /** @class */ function() {
|
|
|
6204
6204
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6205
6205
|
return s.add({}).next((function(a) {
|
|
6206
6206
|
z("number" == typeof a);
|
|
6207
|
-
for (var u = new
|
|
6207
|
+
for (var u = new $r(a, e, n, r), c = function(t, e, n) {
|
|
6208
6208
|
var r = n.baseMutations.map((function(e) {
|
|
6209
6209
|
return nr(t.Wt, e);
|
|
6210
6210
|
})), i = n.mutations.map((function(e) {
|
|
@@ -6293,7 +6293,7 @@ var Si = /** @class */ function() {
|
|
|
6293
6293
|
if (a === n.userId && e.path.isEqual(h))
|
|
6294
6294
|
// Look up the mutation batch in the store.
|
|
6295
6295
|
return _i(t).get(c).next((function(t) {
|
|
6296
|
-
if (!t) throw
|
|
6296
|
+
if (!t) throw K();
|
|
6297
6297
|
z(t.userId === n.userId), o.push(ci(n.N, t));
|
|
6298
6298
|
}));
|
|
6299
6299
|
s.done();
|
|
@@ -6341,7 +6341,7 @@ var Si = /** @class */ function() {
|
|
|
6341
6341
|
// TODO(rockwood): Implement this using iterate.
|
|
6342
6342
|
return e.forEach((function(e) {
|
|
6343
6343
|
i.push(_i(t).get(e).next((function(t) {
|
|
6344
|
-
if (null === t) throw
|
|
6344
|
+
if (null === t) throw K();
|
|
6345
6345
|
z(t.userId === n.userId), r.push(ci(n.N, t));
|
|
6346
6346
|
})));
|
|
6347
6347
|
})), Br.waitFor(i).next((function() {
|
|
@@ -6421,19 +6421,19 @@ var Si = /** @class */ function() {
|
|
|
6421
6421
|
/**
|
|
6422
6422
|
* Helper to get a typed SimpleDbStore for the mutations object store.
|
|
6423
6423
|
*/ function _i(t) {
|
|
6424
|
-
return
|
|
6424
|
+
return Zr(t, Nr.store);
|
|
6425
6425
|
}
|
|
6426
6426
|
|
|
6427
6427
|
/**
|
|
6428
6428
|
* Helper to get a typed SimpleDbStore for the mutationQueues object store.
|
|
6429
6429
|
*/ function Di(t) {
|
|
6430
|
-
return
|
|
6430
|
+
return Zr(t, _r.store);
|
|
6431
6431
|
}
|
|
6432
6432
|
|
|
6433
6433
|
/**
|
|
6434
6434
|
* Helper to get a typed SimpleDbStore for the mutationQueues object store.
|
|
6435
6435
|
*/ function Ai(t) {
|
|
6436
|
-
return
|
|
6436
|
+
return Zr(t, Sr.store);
|
|
6437
6437
|
}
|
|
6438
6438
|
|
|
6439
6439
|
/**
|
|
@@ -6684,19 +6684,19 @@ var Si = /** @class */ function() {
|
|
|
6684
6684
|
* Helper to get a typed SimpleDbStore for the queries object store.
|
|
6685
6685
|
*/
|
|
6686
6686
|
function xi(t) {
|
|
6687
|
-
return
|
|
6687
|
+
return Zr(t, xr.store);
|
|
6688
6688
|
}
|
|
6689
6689
|
|
|
6690
6690
|
/**
|
|
6691
6691
|
* Helper to get a typed SimpleDbStore for the target globals object store.
|
|
6692
6692
|
*/ function Li(t) {
|
|
6693
|
-
return
|
|
6693
|
+
return Zr(t, Rr.store);
|
|
6694
6694
|
}
|
|
6695
6695
|
|
|
6696
6696
|
/**
|
|
6697
6697
|
* Helper to get a typed SimpleDbStore for the document target object store.
|
|
6698
6698
|
*/ function Ri(t) {
|
|
6699
|
-
return
|
|
6699
|
+
return Zr(t, Lr.store);
|
|
6700
6700
|
}
|
|
6701
6701
|
|
|
6702
6702
|
/**
|
|
@@ -7087,7 +7087,7 @@ function xi(t) {
|
|
|
7087
7087
|
}, t.prototype.isEmpty = function() {
|
|
7088
7088
|
return lt(this.inner);
|
|
7089
7089
|
}, t;
|
|
7090
|
-
}(),
|
|
7090
|
+
}(), ji = /** @class */ function() {
|
|
7091
7091
|
function t() {
|
|
7092
7092
|
// A mapping of document key to the new cache entry that should be written (or null if any
|
|
7093
7093
|
// existing cache entry should be removed).
|
|
@@ -7163,7 +7163,7 @@ function xi(t) {
|
|
|
7163
7163
|
},
|
|
7164
7164
|
/** Helper to assert this.changes is not null */ t.prototype.assertNotApplied = function() {},
|
|
7165
7165
|
t;
|
|
7166
|
-
}(),
|
|
7166
|
+
}(), Ki = /** @class */ function() {
|
|
7167
7167
|
/**
|
|
7168
7168
|
* @param serializer - The document serializer.
|
|
7169
7169
|
* @param indexManager - The query indexes that need to be maintained.
|
|
@@ -7378,7 +7378,7 @@ function xi(t) {
|
|
|
7378
7378
|
})), e;
|
|
7379
7379
|
}));
|
|
7380
7380
|
}, n;
|
|
7381
|
-
}(
|
|
7381
|
+
}(ji);
|
|
7382
7382
|
|
|
7383
7383
|
/**
|
|
7384
7384
|
* @license
|
|
@@ -7410,13 +7410,13 @@ function xi(t) {
|
|
|
7410
7410
|
* If byte-counting ends up being needed on the other platforms, consider
|
|
7411
7411
|
* porting this class as part of that implementation work.
|
|
7412
7412
|
*/ function Gi(t) {
|
|
7413
|
-
return
|
|
7413
|
+
return Zr(t, Cr.store);
|
|
7414
7414
|
}
|
|
7415
7415
|
|
|
7416
7416
|
/**
|
|
7417
7417
|
* Helper to get a typed SimpleDbStore for the remoteDocuments object store.
|
|
7418
7418
|
*/ function Qi(t) {
|
|
7419
|
-
return
|
|
7419
|
+
return Zr(t, kr.store);
|
|
7420
7420
|
}
|
|
7421
7421
|
|
|
7422
7422
|
function Hi(t) {
|
|
@@ -7452,7 +7452,7 @@ function Hi(t) {
|
|
|
7452
7452
|
*/ return t.prototype.Ct = function(t, e, n, r) {
|
|
7453
7453
|
var i = this;
|
|
7454
7454
|
z(n < r && n >= 0 && r <= 11);
|
|
7455
|
-
var o = new
|
|
7455
|
+
var o = new jr("createOrUpgrade", e);
|
|
7456
7456
|
n < 1 && r >= 1 && (function(t) {
|
|
7457
7457
|
t.createObjectStore(Er.store);
|
|
7458
7458
|
}(t), function(t) {
|
|
@@ -7680,9 +7680,9 @@ var Ji = "Failed to obtain exclusive access to the persistence layer. To allow s
|
|
|
7680
7680
|
return Promise.resolve();
|
|
7681
7681
|
}, !t.bt()) throw new W(H.UNIMPLEMENTED, "This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");
|
|
7682
7682
|
this.referenceDelegate = new qi(this, i), this.We = n + "main", this.N = new ni(u),
|
|
7683
|
-
this.Ge = new
|
|
7683
|
+
this.Ge = new Kr(this.We, 11, new Wi(this.N)), this.ze = new Ci(this.referenceDelegate, this.N),
|
|
7684
7684
|
this.Ht = new gi, this.He = function(t, e) {
|
|
7685
|
-
return new
|
|
7685
|
+
return new Ki(t, e);
|
|
7686
7686
|
}(this.N, this.Ht), this.Je = new di, this.window && this.window.localStorage ? this.Ye = this.window.localStorage : (this.Ye = null,
|
|
7687
7687
|
!1 === h && U("IndexedDbPersistence", "LocalStorage is unavailable. As a result, persistence may not work reliably. In particular enablePersistence() could fail immediately after refreshing the page."));
|
|
7688
7688
|
}
|
|
@@ -7790,7 +7790,7 @@ var Ji = "Failed to obtain exclusive access to the persistence layer. To allow s
|
|
|
7790
7790
|
t.prototype.Xe = function() {
|
|
7791
7791
|
var t = this;
|
|
7792
7792
|
return this.runTransaction("updateClientMetadataAndTryBecomePrimary", "readwrite", (function(e) {
|
|
7793
|
-
return
|
|
7793
|
+
return $i(e).put(new Pr(t.clientId, Date.now(), t.networkEnabled, t.inForeground)).next((function() {
|
|
7794
7794
|
if (t.isPrimary) return t.sn(e).next((function(e) {
|
|
7795
7795
|
e || (t.isPrimary = !1, t.Oe.enqueueRetryable((function() {
|
|
7796
7796
|
return t.Qe(!1);
|
|
@@ -7820,11 +7820,11 @@ var Ji = "Failed to obtain exclusive access to the persistence layer. To allow s
|
|
|
7820
7820
|
}));
|
|
7821
7821
|
}, t.prototype.sn = function(t) {
|
|
7822
7822
|
var e = this;
|
|
7823
|
-
return
|
|
7823
|
+
return Zi(t).get(Er.key).next((function(t) {
|
|
7824
7824
|
return Br.resolve(e.cn(t));
|
|
7825
7825
|
}));
|
|
7826
7826
|
}, t.prototype.un = function(t) {
|
|
7827
|
-
return
|
|
7827
|
+
return $i(t).delete(this.clientId);
|
|
7828
7828
|
},
|
|
7829
7829
|
/**
|
|
7830
7830
|
* If the garbage collection threshold has passed, prunes the
|
|
@@ -7839,7 +7839,7 @@ var Ji = "Failed to obtain exclusive access to the persistence layer. To allow s
|
|
|
7839
7839
|
case 0:
|
|
7840
7840
|
return !this.isPrimary || this.ln(this.je, 18e5) ? [ 3 /*break*/ , 2 ] : (this.je = Date.now(),
|
|
7841
7841
|
[ 4 /*yield*/ , this.runTransaction("maybeGarbageCollectMultiClientState", "readwrite-primary", (function(t) {
|
|
7842
|
-
var e =
|
|
7842
|
+
var e = Zr(t, Pr.store);
|
|
7843
7843
|
return e.Lt().next((function(t) {
|
|
7844
7844
|
var n = o.fn(t, 18e5), r = t.filter((function(t) {
|
|
7845
7845
|
return -1 === n.indexOf(t);
|
|
@@ -7896,7 +7896,7 @@ var Ji = "Failed to obtain exclusive access to the persistence layer. To allow s
|
|
|
7896
7896
|
*/
|
|
7897
7897
|
t.prototype.rn = function(t) {
|
|
7898
7898
|
var e = this;
|
|
7899
|
-
return this.Me ? Br.resolve(!0) :
|
|
7899
|
+
return this.Me ? Br.resolve(!0) : Zi(t).get(Er.key).next((function(n) {
|
|
7900
7900
|
// A client is eligible for the primary lease if:
|
|
7901
7901
|
// - its network is enabled and the client's tab is in the foreground.
|
|
7902
7902
|
// - its network is enabled and no other client's tab is in the
|
|
@@ -7925,7 +7925,7 @@ var Ji = "Failed to obtain exclusive access to the persistence layer. To allow s
|
|
|
7925
7925
|
return !1;
|
|
7926
7926
|
}
|
|
7927
7927
|
}
|
|
7928
|
-
return !(!e.networkEnabled || !e.inForeground) ||
|
|
7928
|
+
return !(!e.networkEnabled || !e.inForeground) || $i(t).Lt().next((function(t) {
|
|
7929
7929
|
return void 0 === e.fn(t, 5e3).find((function(t) {
|
|
7930
7930
|
if (e.clientId !== t.clientId) {
|
|
7931
7931
|
var n = !e.networkEnabled && t.networkEnabled, r = !e.inForeground && t.inForeground, i = e.networkEnabled === t.networkEnabled;
|
|
@@ -7989,7 +7989,7 @@ var Ji = "Failed to obtain exclusive access to the persistence layer. To allow s
|
|
|
7989
7989
|
t.prototype.pn = function() {
|
|
7990
7990
|
var t = this;
|
|
7991
7991
|
return this.runTransaction("getActiveClients", "readonly", (function(e) {
|
|
7992
|
-
return
|
|
7992
|
+
return $i(e).Lt().next((function(e) {
|
|
7993
7993
|
return t.fn(e, 18e5).map((function(t) {
|
|
7994
7994
|
return t.clientId;
|
|
7995
7995
|
}));
|
|
@@ -8045,7 +8045,7 @@ var Ji = "Failed to obtain exclusive access to the persistence layer. To allow s
|
|
|
8045
8045
|
// be turned off.
|
|
8046
8046
|
t.prototype.Tn = function(t) {
|
|
8047
8047
|
var e = this;
|
|
8048
|
-
return
|
|
8048
|
+
return Zi(t).get(Er.key).next((function(t) {
|
|
8049
8049
|
if (null !== t && e.ln(t.leaseTimestampMs, 5e3) && !e.wn(t.ownerId) && !e.cn(t) && !(e.Me || e.allowTabSynchronization && t.allowTabSynchronization)) throw new W(H.FAILED_PRECONDITION, Ji);
|
|
8050
8050
|
}));
|
|
8051
8051
|
},
|
|
@@ -8055,12 +8055,12 @@ var Ji = "Failed to obtain exclusive access to the persistence layer. To allow s
|
|
|
8055
8055
|
*/
|
|
8056
8056
|
t.prototype.an = function(t) {
|
|
8057
8057
|
var e = new Er(this.clientId, this.allowTabSynchronization, Date.now());
|
|
8058
|
-
return
|
|
8058
|
+
return Zi(t).put(Er.key, e);
|
|
8059
8059
|
}, t.bt = function() {
|
|
8060
|
-
return
|
|
8060
|
+
return Kr.bt();
|
|
8061
8061
|
},
|
|
8062
8062
|
/** Checks the primary lease and removes it if we are the current primary. */ t.prototype.on = function(t) {
|
|
8063
|
-
var e = this, n =
|
|
8063
|
+
var e = this, n = Zi(t);
|
|
8064
8064
|
return n.get(Er.key).next((function(t) {
|
|
8065
8065
|
return e.cn(t) ? (q("IndexedDbPersistence", "Releasing primary lease."), n.delete(Er.key)) : Br.resolve();
|
|
8066
8066
|
}));
|
|
@@ -8199,14 +8199,14 @@ var Ji = "Failed to obtain exclusive access to the persistence layer. To allow s
|
|
|
8199
8199
|
/**
|
|
8200
8200
|
* Helper to get a typed SimpleDbStore for the primary client object store.
|
|
8201
8201
|
*/
|
|
8202
|
-
function
|
|
8203
|
-
return
|
|
8202
|
+
function Zi(t) {
|
|
8203
|
+
return Zr(t, Er.store);
|
|
8204
8204
|
}
|
|
8205
8205
|
|
|
8206
8206
|
/**
|
|
8207
8207
|
* Helper to get a typed SimpleDbStore for the client metadata object store.
|
|
8208
|
-
*/ function
|
|
8209
|
-
return
|
|
8208
|
+
*/ function $i(t) {
|
|
8209
|
+
return Zr(t, Pr.store);
|
|
8210
8210
|
}
|
|
8211
8211
|
|
|
8212
8212
|
/**
|
|
@@ -8348,7 +8348,7 @@ var eo = function(t, e) {
|
|
|
8348
8348
|
var u = a[s], c = u.key, h = r.get(c);
|
|
8349
8349
|
null == h && (
|
|
8350
8350
|
// Create invalid document to apply mutations on top of
|
|
8351
|
-
h = Ht.newInvalidDocument(c), r = r.insert(c, h)),
|
|
8351
|
+
h = Ht.newInvalidDocument(c), r = r.insert(c, h)), Ze(u, h, o.localWriteTime), h.isFoundDocument() || (r = r.remove(c));
|
|
8352
8352
|
}
|
|
8353
8353
|
}));
|
|
8354
8354
|
})).next((function() {
|
|
@@ -9173,7 +9173,7 @@ function wo(t) {
|
|
|
9173
9173
|
}, t.prototype.addMutationBatch = function(t, e, n, r) {
|
|
9174
9174
|
var i = this.fs;
|
|
9175
9175
|
this.fs++, this.In.length > 0 && this.In[this.In.length - 1];
|
|
9176
|
-
var o = new
|
|
9176
|
+
var o = new $r(i, e, n, r);
|
|
9177
9177
|
this.In.push(o);
|
|
9178
9178
|
// Track references by document key and index collection parents.
|
|
9179
9179
|
for (var s = 0, a = r; s < a.length; s++) {
|
|
@@ -9370,7 +9370,7 @@ function wo(t) {
|
|
|
9370
9370
|
}, n.prototype.getAllFromCache = function(t, e) {
|
|
9371
9371
|
return this.Se.getEntries(t, e);
|
|
9372
9372
|
}, n;
|
|
9373
|
-
}(
|
|
9373
|
+
}(ji), Ao = /** @class */ function() {
|
|
9374
9374
|
function t(t) {
|
|
9375
9375
|
this.persistence = t,
|
|
9376
9376
|
/**
|
|
@@ -9524,7 +9524,7 @@ function wo(t) {
|
|
|
9524
9524
|
}, Object.defineProperty(t.prototype, "xs", {
|
|
9525
9525
|
get: function() {
|
|
9526
9526
|
if (this.Cs) return this.Cs;
|
|
9527
|
-
throw
|
|
9527
|
+
throw K();
|
|
9528
9528
|
},
|
|
9529
9529
|
enumerable: !1,
|
|
9530
9530
|
configurable: !0
|
|
@@ -10031,14 +10031,14 @@ var Po = /** @class */ function() {
|
|
|
10031
10031
|
t.prototype.notifyBundleLoaded = function() {
|
|
10032
10032
|
// No op.
|
|
10033
10033
|
}, t;
|
|
10034
|
-
}(),
|
|
10034
|
+
}(), jo = /** @class */ function() {
|
|
10035
10035
|
function t() {}
|
|
10036
10036
|
return t.prototype.Ti = function(t) {
|
|
10037
10037
|
// No-op.
|
|
10038
10038
|
}, t.prototype.shutdown = function() {
|
|
10039
10039
|
// No-op.
|
|
10040
10040
|
}, t;
|
|
10041
|
-
}(),
|
|
10041
|
+
}(), Ko = /** @class */ function() {
|
|
10042
10042
|
function t() {
|
|
10043
10043
|
var t = this;
|
|
10044
10044
|
this.Ei = function() {
|
|
@@ -10139,7 +10139,7 @@ var Po = /** @class */ function() {
|
|
|
10139
10139
|
break;
|
|
10140
10140
|
|
|
10141
10141
|
default:
|
|
10142
|
-
|
|
10142
|
+
K();
|
|
10143
10143
|
}
|
|
10144
10144
|
} finally {
|
|
10145
10145
|
q("Connection", 'RPC "' + t + '" completed.');
|
|
@@ -10466,15 +10466,15 @@ function Ho() {
|
|
|
10466
10466
|
return (Math.random() - .5) * this.zi;
|
|
10467
10467
|
}, t;
|
|
10468
10468
|
}(), Xo = /** @class */ function() {
|
|
10469
|
-
function t(t, e, n, r, i, o) {
|
|
10470
|
-
this.Oe = t, this.er = n, this.nr = r, this.
|
|
10471
|
-
this.state = 0 /* Initial */ ,
|
|
10469
|
+
function t(t, e, n, r, i, o, s) {
|
|
10470
|
+
this.Oe = t, this.er = n, this.nr = r, this.sr = i, this.credentialsProvider = o,
|
|
10471
|
+
this.listener = s, this.state = 0 /* Initial */ ,
|
|
10472
10472
|
/**
|
|
10473
10473
|
* A close count that's incremented every time the stream is closed; used by
|
|
10474
10474
|
* getCloseGuardedDispatcher() to invalidate callbacks that happen after
|
|
10475
10475
|
* close.
|
|
10476
10476
|
*/
|
|
10477
|
-
this.
|
|
10477
|
+
this.ir = 0, this.rr = null, this.ar = null, this.stream = null, this.cr = new Jo(t, e)
|
|
10478
10478
|
/**
|
|
10479
10479
|
* Returns true if start() has been called and no error has occurred. True
|
|
10480
10480
|
* indicates the stream is open or in the process of opening (which
|
|
@@ -10483,15 +10483,15 @@ function Ho() {
|
|
|
10483
10483
|
* outbound requests.
|
|
10484
10484
|
*/;
|
|
10485
10485
|
}
|
|
10486
|
-
return t.prototype.
|
|
10487
|
-
return 1 /* Starting */ === this.state ||
|
|
10486
|
+
return t.prototype.ur = function() {
|
|
10487
|
+
return 1 /* Starting */ === this.state || 5 /* Backoff */ === this.state || this.hr();
|
|
10488
10488
|
},
|
|
10489
10489
|
/**
|
|
10490
10490
|
* Returns true if the underlying RPC is open (the onOpen() listener has been
|
|
10491
10491
|
* called) and the stream is ready for outbound requests.
|
|
10492
10492
|
*/
|
|
10493
|
-
t.prototype.
|
|
10494
|
-
return 2 /* Open */ === this.state;
|
|
10493
|
+
t.prototype.hr = function() {
|
|
10494
|
+
return 2 /* Open */ === this.state || 3 /* Healthy */ === this.state;
|
|
10495
10495
|
},
|
|
10496
10496
|
/**
|
|
10497
10497
|
* Starts the RPC. Only allowed if isStarted() returns false. The stream is
|
|
@@ -10501,7 +10501,7 @@ function Ho() {
|
|
|
10501
10501
|
* When start returns, isStarted() will return true.
|
|
10502
10502
|
*/
|
|
10503
10503
|
t.prototype.start = function() {
|
|
10504
|
-
|
|
10504
|
+
4 /* Error */ !== this.state ? this.auth() : this.lr();
|
|
10505
10505
|
},
|
|
10506
10506
|
/**
|
|
10507
10507
|
* Stops the RPC. This call is idempotent and allowed regardless of the
|
|
@@ -10514,7 +10514,7 @@ function Ho() {
|
|
|
10514
10514
|
return r(this, (function(t) {
|
|
10515
10515
|
switch (t.label) {
|
|
10516
10516
|
case 0:
|
|
10517
|
-
return this.
|
|
10517
|
+
return this.ur() ? [ 4 /*yield*/ , this.close(0 /* Initial */) ] : [ 3 /*break*/ , 2 ];
|
|
10518
10518
|
|
|
10519
10519
|
case 1:
|
|
10520
10520
|
t.sent(), t.label = 2;
|
|
@@ -10533,8 +10533,8 @@ function Ho() {
|
|
|
10533
10533
|
* Each error will call the onClose() listener. That function can decide to
|
|
10534
10534
|
* inhibit backoff if required.
|
|
10535
10535
|
*/
|
|
10536
|
-
t.prototype.
|
|
10537
|
-
this.state = 0 /* Initial */ , this.
|
|
10536
|
+
t.prototype.dr = function() {
|
|
10537
|
+
this.state = 0 /* Initial */ , this.cr.reset();
|
|
10538
10538
|
},
|
|
10539
10539
|
/**
|
|
10540
10540
|
* Marks this stream as idle. If no further actions are performed on the
|
|
@@ -10546,26 +10546,29 @@ function Ho() {
|
|
|
10546
10546
|
* Only streams that are in state 'Open' can be marked idle, as all other
|
|
10547
10547
|
* states imply pending network operations.
|
|
10548
10548
|
*/
|
|
10549
|
-
t.prototype.
|
|
10549
|
+
t.prototype.wr = function() {
|
|
10550
10550
|
var t = this;
|
|
10551
10551
|
// Starts the idle time if we are in state 'Open' and are not yet already
|
|
10552
10552
|
// running a timer (in which case the previous idle timeout still applies).
|
|
10553
|
-
this.
|
|
10554
|
-
return t.
|
|
10553
|
+
this.hr() && null === this.rr && (this.rr = this.Oe.enqueueAfterDelay(this.er, 6e4, (function() {
|
|
10554
|
+
return t._r();
|
|
10555
10555
|
})));
|
|
10556
10556
|
},
|
|
10557
|
-
/** Sends a message to the underlying stream. */ t.prototype.
|
|
10558
|
-
this.
|
|
10557
|
+
/** Sends a message to the underlying stream. */ t.prototype.mr = function(t) {
|
|
10558
|
+
this.gr(), this.stream.send(t);
|
|
10559
10559
|
},
|
|
10560
|
-
/** Called by the idle timer when the stream should close due to inactivity. */ t.prototype.
|
|
10560
|
+
/** Called by the idle timer when the stream should close due to inactivity. */ t.prototype._r = function() {
|
|
10561
10561
|
return n(this, void 0, void 0, (function() {
|
|
10562
10562
|
return r(this, (function(t) {
|
|
10563
|
-
return this.
|
|
10563
|
+
return this.hr() ? [ 2 /*return*/ , this.close(0 /* Initial */) ] : [ 2 /*return*/ ];
|
|
10564
10564
|
}));
|
|
10565
10565
|
}));
|
|
10566
10566
|
},
|
|
10567
|
-
/** Marks the stream as active again. */ t.prototype.
|
|
10568
|
-
this.
|
|
10567
|
+
/** Marks the stream as active again. */ t.prototype.gr = function() {
|
|
10568
|
+
this.rr && (this.rr.cancel(), this.rr = null);
|
|
10569
|
+
},
|
|
10570
|
+
/** Cancels the health check delayed operation. */ t.prototype.yr = function() {
|
|
10571
|
+
this.ar && (this.ar.cancel(), this.ar = null);
|
|
10569
10572
|
},
|
|
10570
10573
|
/**
|
|
10571
10574
|
* Closes the stream and cleans up as necessary:
|
|
@@ -10587,20 +10590,24 @@ function Ho() {
|
|
|
10587
10590
|
case 0:
|
|
10588
10591
|
// Notify the listener that the stream closed.
|
|
10589
10592
|
// Cancel any outstanding timers (they're guaranteed not to execute).
|
|
10590
|
-
return this.
|
|
10593
|
+
return this.gr(), this.yr(), this.cr.cancel(),
|
|
10591
10594
|
// Invalidates any stream-related callbacks (e.g. from auth or the
|
|
10592
10595
|
// underlying stream), guaranteeing they won't execute.
|
|
10593
|
-
this.
|
|
10596
|
+
this.ir++, 4 /* Error */ !== t ?
|
|
10594
10597
|
// If this is an intentional close ensure we don't delay our next connection attempt.
|
|
10595
|
-
this.
|
|
10598
|
+
this.cr.reset() : e && e.code === H.RESOURCE_EXHAUSTED ? (
|
|
10596
10599
|
// Log the error. (Probably either 'quota exceeded' or 'max queue length reached'.)
|
|
10597
10600
|
U(e.toString()), U("Using maximum backoff delay to prevent overloading the backend."),
|
|
10598
|
-
this.
|
|
10599
|
-
// "unauthenticated" error means the token was rejected.
|
|
10600
|
-
//
|
|
10601
|
+
this.cr.Yi()) : e && e.code === H.UNAUTHENTICATED && 3 /* Healthy */ !== this.state &&
|
|
10602
|
+
// "unauthenticated" error means the token was rejected. This should rarely
|
|
10603
|
+
// happen since both Auth and AppCheck ensure a sufficient TTL when we
|
|
10604
|
+
// request a token. If a user manually resets their system clock this can
|
|
10605
|
+
// fail, however. In this case, we should get a Code.UNAUTHENTICATED error
|
|
10606
|
+
// before we received the first message and we need to invalidate the token
|
|
10607
|
+
// to ensure that we fetch a new token.
|
|
10601
10608
|
this.credentialsProvider.invalidateToken(),
|
|
10602
10609
|
// Clean up the underlying stream because we are no longer interested in events.
|
|
10603
|
-
null !== this.stream && (this.
|
|
10610
|
+
null !== this.stream && (this.pr(), this.stream.close(), this.stream = null),
|
|
10604
10611
|
// This state must be assigned before calling onClose() to allow the callback to
|
|
10605
10612
|
// inhibit backoff or otherwise manipulate the state in its non-started state.
|
|
10606
10613
|
this.state = t, [ 4 /*yield*/ , this.listener.Ci(e) ];
|
|
@@ -10617,45 +10624,47 @@ function Ho() {
|
|
|
10617
10624
|
* Can be overridden to perform additional cleanup before the stream is closed.
|
|
10618
10625
|
* Calling super.tearDown() is not required.
|
|
10619
10626
|
*/
|
|
10620
|
-
t.prototype.
|
|
10627
|
+
t.prototype.pr = function() {}, t.prototype.auth = function() {
|
|
10621
10628
|
var t = this;
|
|
10622
10629
|
this.state = 1 /* Starting */;
|
|
10623
|
-
var e = this.
|
|
10630
|
+
var e = this.Tr(this.ir), n = this.ir;
|
|
10624
10631
|
// TODO(mikelehen): Just use dispatchIfNotClosed, but see TODO below.
|
|
10625
10632
|
this.credentialsProvider.getToken().then((function(e) {
|
|
10626
10633
|
// Stream can be stopped while waiting for authentication.
|
|
10627
10634
|
// TODO(mikelehen): We really should just use dispatchIfNotClosed
|
|
10628
10635
|
// and let this dispatch onto the queue, but that opened a spec test can
|
|
10629
10636
|
// of worms that I don't want to deal with in this PR.
|
|
10630
|
-
t.
|
|
10637
|
+
t.ir === n &&
|
|
10631
10638
|
// Normally we'd have to schedule the callback on the AsyncQueue.
|
|
10632
10639
|
// However, the following calls are safe to be called outside the
|
|
10633
10640
|
// AsyncQueue since they don't chain asynchronous calls
|
|
10634
|
-
t.
|
|
10641
|
+
t.Er(e);
|
|
10635
10642
|
}), (function(n) {
|
|
10636
10643
|
e((function() {
|
|
10637
10644
|
var e = new W(H.UNKNOWN, "Fetching auth token failed: " + n.message);
|
|
10638
|
-
return t.
|
|
10645
|
+
return t.Ir(e);
|
|
10639
10646
|
}));
|
|
10640
10647
|
}));
|
|
10641
|
-
}, t.prototype.
|
|
10642
|
-
var e = this, n = this.
|
|
10643
|
-
this.stream = this.
|
|
10648
|
+
}, t.prototype.Er = function(t) {
|
|
10649
|
+
var e = this, n = this.Tr(this.ir);
|
|
10650
|
+
this.stream = this.Ar(t), this.stream.Si((function() {
|
|
10644
10651
|
n((function() {
|
|
10645
|
-
return e.state = 2 /* Open */ , e.
|
|
10652
|
+
return e.state = 2 /* Open */ , e.ar = e.Oe.enqueueAfterDelay(e.nr, 1e4, (function() {
|
|
10653
|
+
return e.hr() && (e.state = 3 /* Healthy */), Promise.resolve();
|
|
10654
|
+
})), e.listener.Si();
|
|
10646
10655
|
}));
|
|
10647
10656
|
})), this.stream.Ci((function(t) {
|
|
10648
10657
|
n((function() {
|
|
10649
|
-
return e.
|
|
10658
|
+
return e.Ir(t);
|
|
10650
10659
|
}));
|
|
10651
10660
|
})), this.stream.onMessage((function(t) {
|
|
10652
10661
|
n((function() {
|
|
10653
10662
|
return e.onMessage(t);
|
|
10654
10663
|
}));
|
|
10655
10664
|
}));
|
|
10656
|
-
}, t.prototype.
|
|
10665
|
+
}, t.prototype.lr = function() {
|
|
10657
10666
|
var t = this;
|
|
10658
|
-
this.state =
|
|
10667
|
+
this.state = 5 /* Backoff */ , this.cr.Xi((function() {
|
|
10659
10668
|
return n(t, void 0, void 0, (function() {
|
|
10660
10669
|
return r(this, (function(t) {
|
|
10661
10670
|
return this.state = 0 /* Initial */ , this.start(), [ 2 /*return*/ ];
|
|
@@ -10664,12 +10673,12 @@ function Ho() {
|
|
|
10664
10673
|
}));
|
|
10665
10674
|
},
|
|
10666
10675
|
// Visible for tests
|
|
10667
|
-
t.prototype.
|
|
10676
|
+
t.prototype.Ir = function(t) {
|
|
10668
10677
|
// In theory the stream could close cleanly, however, in our current model
|
|
10669
10678
|
// we never expect this to happen because if we stop a stream ourselves,
|
|
10670
10679
|
// this callback will never be called. To prevent cases where we retry
|
|
10671
10680
|
// without a backoff accidentally, we set the stream to error in all cases.
|
|
10672
|
-
return q("PersistentStream", "close with error: " + t), this.stream = null, this.close(
|
|
10681
|
+
return q("PersistentStream", "close with error: " + t), this.stream = null, this.close(4 /* Error */ , t);
|
|
10673
10682
|
},
|
|
10674
10683
|
/**
|
|
10675
10684
|
* Returns a "dispatcher" function that dispatches operations onto the
|
|
@@ -10677,26 +10686,26 @@ function Ho() {
|
|
|
10677
10686
|
* us to turn auth / stream callbacks into no-ops if the stream is closed /
|
|
10678
10687
|
* re-opened, etc.
|
|
10679
10688
|
*/
|
|
10680
|
-
t.prototype.
|
|
10689
|
+
t.prototype.Tr = function(t) {
|
|
10681
10690
|
var e = this;
|
|
10682
10691
|
return function(n) {
|
|
10683
10692
|
e.Oe.enqueueAndForget((function() {
|
|
10684
|
-
return e.
|
|
10693
|
+
return e.ir === t ? n() : (q("PersistentStream", "stream callback skipped by getCloseGuardedDispatcher."),
|
|
10685
10694
|
Promise.resolve());
|
|
10686
10695
|
}));
|
|
10687
10696
|
};
|
|
10688
10697
|
}, t;
|
|
10689
|
-
}(),
|
|
10698
|
+
}(), Zo = /** @class */ function(e) {
|
|
10690
10699
|
function n(t, n, r, i, o) {
|
|
10691
10700
|
var s = this;
|
|
10692
|
-
return (s = e.call(this, t, "listen_stream_connection_backoff" /* ListenStreamConnectionBackoff */ , "listen_stream_idle" /* ListenStreamIdle */ , n, r, o) || this).N = i,
|
|
10701
|
+
return (s = e.call(this, t, "listen_stream_connection_backoff" /* ListenStreamConnectionBackoff */ , "listen_stream_idle" /* ListenStreamIdle */ , "health_check_timeout" /* HealthCheckTimeout */ , n, r, o) || this).N = i,
|
|
10693
10702
|
s;
|
|
10694
10703
|
}
|
|
10695
|
-
return t(n, e), n.prototype.
|
|
10696
|
-
return this.
|
|
10704
|
+
return t(n, e), n.prototype.Ar = function(t) {
|
|
10705
|
+
return this.sr.ji("Listen", t);
|
|
10697
10706
|
}, n.prototype.onMessage = function(t) {
|
|
10698
10707
|
// A successful response means the stream is healthy
|
|
10699
|
-
this.
|
|
10708
|
+
this.cr.reset();
|
|
10700
10709
|
var e = function(t, e) {
|
|
10701
10710
|
var n;
|
|
10702
10711
|
if ("targetChange" in e) {
|
|
@@ -10704,7 +10713,7 @@ function Ho() {
|
|
|
10704
10713
|
// proto3 default value is unset in JSON (undefined), so use 'NO_CHANGE'
|
|
10705
10714
|
// if unset
|
|
10706
10715
|
var r = function(t) {
|
|
10707
|
-
return "NO_CHANGE" === t ? 0 /* NoChange */ : "ADD" === t ? 1 /* Added */ : "REMOVE" === t ? 2 /* Removed */ : "CURRENT" === t ? 3 /* Current */ : "RESET" === t ? 4 /* Reset */ :
|
|
10716
|
+
return "NO_CHANGE" === t ? 0 /* NoChange */ : "ADD" === t ? 1 /* Added */ : "REMOVE" === t ? 2 /* Removed */ : "CURRENT" === t ? 3 /* Current */ : "RESET" === t ? 4 /* Reset */ : K();
|
|
10708
10717
|
}(e.targetChange.targetChangeType || "NO_CHANGE"), i = e.targetChange.targetIds || [], o = function(t, e) {
|
|
10709
10718
|
return t.D ? (z(void 0 === e || "string" == typeof e), wt.fromBase64String(e || "")) : (z(void 0 === e || e instanceof Uint8Array),
|
|
10710
10719
|
wt.fromUint8Array(e || new Uint8Array));
|
|
@@ -10736,7 +10745,7 @@ function Ho() {
|
|
|
10736
10745
|
var I = Yn(t, b.document), T = b.removedTargetIds || [];
|
|
10737
10746
|
n = new Ln([], T, I, null);
|
|
10738
10747
|
} else {
|
|
10739
|
-
if (!("filter" in e)) return
|
|
10748
|
+
if (!("filter" in e)) return K();
|
|
10740
10749
|
e.filter;
|
|
10741
10750
|
var E = e.filter;
|
|
10742
10751
|
E.targetId;
|
|
@@ -10752,7 +10761,7 @@ function Ho() {
|
|
|
10752
10761
|
var e = t.targetChange;
|
|
10753
10762
|
return e.targetIds && e.targetIds.length ? ct.min() : e.readTime ? Gn(e.readTime) : ct.min();
|
|
10754
10763
|
}(t);
|
|
10755
|
-
return this.listener.
|
|
10764
|
+
return this.listener.Rr(e, n);
|
|
10756
10765
|
},
|
|
10757
10766
|
/**
|
|
10758
10767
|
* Registers interest in the results of the given target. If the target
|
|
@@ -10760,19 +10769,19 @@ function Ho() {
|
|
|
10760
10769
|
* affect the target will be streamed back as WatchChange messages that
|
|
10761
10770
|
* reference the targetId.
|
|
10762
10771
|
*/
|
|
10763
|
-
n.prototype.
|
|
10772
|
+
n.prototype.br = function(t) {
|
|
10764
10773
|
var e = {};
|
|
10765
|
-
e.database =
|
|
10774
|
+
e.database = Zn(this.N), e.addTarget = function(t, e) {
|
|
10766
10775
|
var n, r = e.target;
|
|
10767
|
-
return (n =
|
|
10776
|
+
return (n = Zt(r) ? {
|
|
10768
10777
|
documents: ir(t, r)
|
|
10769
10778
|
} : {
|
|
10770
10779
|
query: or(t, r)
|
|
10771
|
-
}).targetId = e.targetId, e.resumeToken.approximateByteSize() > 0 ? n.resumeToken =
|
|
10780
|
+
}).targetId = e.targetId, e.resumeToken.approximateByteSize() > 0 ? n.resumeToken = Kn(t, e.resumeToken) : e.snapshotVersion.compareTo(ct.min()) > 0 && (
|
|
10772
10781
|
// TODO(wuandy): Consider removing above check because it is most likely true.
|
|
10773
10782
|
// Right now, many tests depend on this behaviour though (leaving min() out
|
|
10774
10783
|
// of serialization).
|
|
10775
|
-
n.readTime =
|
|
10784
|
+
n.readTime = jn(t, e.snapshotVersion.toTimestamp())), n;
|
|
10776
10785
|
}(this.N, t);
|
|
10777
10786
|
var n = function(t, e) {
|
|
10778
10787
|
var n = function(t, e) {
|
|
@@ -10787,55 +10796,55 @@ function Ho() {
|
|
|
10787
10796
|
return "limbo-document";
|
|
10788
10797
|
|
|
10789
10798
|
default:
|
|
10790
|
-
return
|
|
10799
|
+
return K();
|
|
10791
10800
|
}
|
|
10792
10801
|
}(0, e.purpose);
|
|
10793
10802
|
return null == n ? null : {
|
|
10794
10803
|
"goog-listen-tags": n
|
|
10795
10804
|
};
|
|
10796
10805
|
}(this.N, t);
|
|
10797
|
-
n && (e.labels = n), this.
|
|
10806
|
+
n && (e.labels = n), this.mr(e);
|
|
10798
10807
|
},
|
|
10799
10808
|
/**
|
|
10800
10809
|
* Unregisters interest in the results of the target associated with the
|
|
10801
10810
|
* given targetId.
|
|
10802
10811
|
*/
|
|
10803
|
-
n.prototype.
|
|
10812
|
+
n.prototype.Pr = function(t) {
|
|
10804
10813
|
var e = {};
|
|
10805
|
-
e.database =
|
|
10814
|
+
e.database = Zn(this.N), e.removeTarget = t, this.mr(e);
|
|
10806
10815
|
}, n;
|
|
10807
|
-
}(Xo),
|
|
10816
|
+
}(Xo), $o = /** @class */ function(e) {
|
|
10808
10817
|
function n(t, n, r, i, o) {
|
|
10809
10818
|
var s = this;
|
|
10810
|
-
return (s = e.call(this, t, "write_stream_connection_backoff" /* WriteStreamConnectionBackoff */ , "write_stream_idle" /* WriteStreamIdle */ , n, r, o) || this).N = i,
|
|
10811
|
-
s.
|
|
10819
|
+
return (s = e.call(this, t, "write_stream_connection_backoff" /* WriteStreamConnectionBackoff */ , "write_stream_idle" /* WriteStreamIdle */ , "health_check_timeout" /* HealthCheckTimeout */ , n, r, o) || this).N = i,
|
|
10820
|
+
s.vr = !1, s;
|
|
10812
10821
|
}
|
|
10813
|
-
return t(n, e), Object.defineProperty(n.prototype, "
|
|
10822
|
+
return t(n, e), Object.defineProperty(n.prototype, "Vr", {
|
|
10814
10823
|
/**
|
|
10815
10824
|
* Tracks whether or not a handshake has been successfully exchanged and
|
|
10816
10825
|
* the stream is ready to accept mutations.
|
|
10817
10826
|
*/
|
|
10818
10827
|
get: function() {
|
|
10819
|
-
return this.
|
|
10828
|
+
return this.vr;
|
|
10820
10829
|
},
|
|
10821
10830
|
enumerable: !1,
|
|
10822
10831
|
configurable: !0
|
|
10823
10832
|
}),
|
|
10824
10833
|
// Override of PersistentStream.start
|
|
10825
10834
|
n.prototype.start = function() {
|
|
10826
|
-
this.
|
|
10827
|
-
}, n.prototype.
|
|
10828
|
-
this.
|
|
10829
|
-
}, n.prototype.
|
|
10830
|
-
return this.
|
|
10835
|
+
this.vr = !1, this.lastStreamToken = void 0, e.prototype.start.call(this);
|
|
10836
|
+
}, n.prototype.pr = function() {
|
|
10837
|
+
this.vr && this.Sr([]);
|
|
10838
|
+
}, n.prototype.Ar = function(t) {
|
|
10839
|
+
return this.sr.ji("Write", t);
|
|
10831
10840
|
}, n.prototype.onMessage = function(t) {
|
|
10832
10841
|
if (
|
|
10833
10842
|
// Always capture the last stream token.
|
|
10834
|
-
z(!!t.streamToken), this.lastStreamToken = t.streamToken, this.
|
|
10843
|
+
z(!!t.streamToken), this.lastStreamToken = t.streamToken, this.vr) {
|
|
10835
10844
|
// A successful first write response means the stream is healthy,
|
|
10836
10845
|
// Note, that we could consider a successful handshake healthy, however,
|
|
10837
10846
|
// the write itself might be causing an error we want to back off from.
|
|
10838
|
-
this.
|
|
10847
|
+
this.cr.reset();
|
|
10839
10848
|
var e = function(t, e) {
|
|
10840
10849
|
return t && t.length > 0 ? (z(void 0 !== e), t.map((function(t) {
|
|
10841
10850
|
return function(t, e) {
|
|
@@ -10851,45 +10860,45 @@ function Ho() {
|
|
|
10851
10860
|
}(t, e);
|
|
10852
10861
|
}))) : [];
|
|
10853
10862
|
}(t.writeResults, t.commitTime), n = Gn(t.commitTime);
|
|
10854
|
-
return this.listener.
|
|
10863
|
+
return this.listener.Dr(n, e);
|
|
10855
10864
|
}
|
|
10856
10865
|
// The first response is always the handshake response
|
|
10857
|
-
return z(!t.writeResults || 0 === t.writeResults.length), this.
|
|
10858
|
-
this.listener.
|
|
10866
|
+
return z(!t.writeResults || 0 === t.writeResults.length), this.vr = !0,
|
|
10867
|
+
this.listener.Cr();
|
|
10859
10868
|
},
|
|
10860
10869
|
/**
|
|
10861
10870
|
* Sends an initial streamToken to the server, performing the handshake
|
|
10862
10871
|
* required to make the StreamingWrite RPC work. Subsequent
|
|
10863
10872
|
* calls should wait until onHandshakeComplete was called.
|
|
10864
10873
|
*/
|
|
10865
|
-
n.prototype.
|
|
10874
|
+
n.prototype.Nr = function() {
|
|
10866
10875
|
// TODO(dimond): Support stream resumption. We intentionally do not set the
|
|
10867
10876
|
// stream token on the handshake, ignoring any stream token we might have.
|
|
10868
10877
|
var t = {};
|
|
10869
|
-
t.database =
|
|
10878
|
+
t.database = Zn(this.N), this.mr(t);
|
|
10870
10879
|
},
|
|
10871
|
-
/** Sends a group of mutations to the Firestore backend to apply. */ n.prototype.
|
|
10880
|
+
/** Sends a group of mutations to the Firestore backend to apply. */ n.prototype.Sr = function(t) {
|
|
10872
10881
|
var e = this, n = {
|
|
10873
10882
|
streamToken: this.lastStreamToken,
|
|
10874
10883
|
writes: t.map((function(t) {
|
|
10875
10884
|
return nr(e.N, t);
|
|
10876
10885
|
}))
|
|
10877
10886
|
};
|
|
10878
|
-
this.
|
|
10887
|
+
this.mr(n);
|
|
10879
10888
|
}, n;
|
|
10880
10889
|
}(Xo), ts = /** @class */ function(e) {
|
|
10881
10890
|
function n(t, n, r) {
|
|
10882
10891
|
var i = this;
|
|
10883
|
-
return (i = e.call(this) || this).credentials = t, i.
|
|
10892
|
+
return (i = e.call(this) || this).credentials = t, i.sr = n, i.N = r, i.kr = !1,
|
|
10884
10893
|
i;
|
|
10885
10894
|
}
|
|
10886
|
-
return t(n, e), n.prototype
|
|
10887
|
-
if (this.
|
|
10895
|
+
return t(n, e), n.prototype.$r = function() {
|
|
10896
|
+
if (this.kr) throw new W(H.FAILED_PRECONDITION, "The client has already been terminated.");
|
|
10888
10897
|
},
|
|
10889
10898
|
/** Gets an auth token and invokes the provided RPC. */ n.prototype.Li = function(t, e, n) {
|
|
10890
10899
|
var r = this;
|
|
10891
|
-
return this
|
|
10892
|
-
return r.
|
|
10900
|
+
return this.$r(), this.credentials.getToken().then((function(i) {
|
|
10901
|
+
return r.sr.Li(t, e, n, i);
|
|
10893
10902
|
})).catch((function(t) {
|
|
10894
10903
|
throw "FirebaseError" === t.name ? (t.code === H.UNAUTHENTICATED && r.credentials.invalidateToken(),
|
|
10895
10904
|
t) : new W(H.UNKNOWN, t.toString());
|
|
@@ -10897,14 +10906,14 @@ function Ho() {
|
|
|
10897
10906
|
},
|
|
10898
10907
|
/** Gets an auth token and invokes the provided RPC with streamed results. */ n.prototype.Ki = function(t, e, n) {
|
|
10899
10908
|
var r = this;
|
|
10900
|
-
return this
|
|
10901
|
-
return r.
|
|
10909
|
+
return this.$r(), this.credentials.getToken().then((function(i) {
|
|
10910
|
+
return r.sr.Ki(t, e, n, i);
|
|
10902
10911
|
})).catch((function(t) {
|
|
10903
10912
|
throw "FirebaseError" === t.name ? (t.code === H.UNAUTHENTICATED && r.credentials.invalidateToken(),
|
|
10904
10913
|
t) : new W(H.UNKNOWN, t.toString());
|
|
10905
10914
|
}));
|
|
10906
10915
|
}, n.prototype.terminate = function() {
|
|
10907
|
-
this.
|
|
10916
|
+
this.kr = !0;
|
|
10908
10917
|
}, n;
|
|
10909
10918
|
}((function() {})), es = /** @class */ function() {
|
|
10910
10919
|
function t(t, e) {
|
|
@@ -10916,19 +10925,19 @@ function Ho() {
|
|
|
10916
10925
|
* maximum defined by MAX_WATCH_STREAM_FAILURES, we'll set the OnlineState to
|
|
10917
10926
|
* Offline.
|
|
10918
10927
|
*/
|
|
10919
|
-
this.
|
|
10928
|
+
this.Or = 0,
|
|
10920
10929
|
/**
|
|
10921
10930
|
* A timer that elapses after ONLINE_STATE_TIMEOUT_MS, at which point we
|
|
10922
10931
|
* transition from OnlineState.Unknown to OnlineState.Offline without waiting
|
|
10923
10932
|
* for the stream to actually fail (MAX_WATCH_STREAM_FAILURES times).
|
|
10924
10933
|
*/
|
|
10925
|
-
this.
|
|
10934
|
+
this.Fr = null,
|
|
10926
10935
|
/**
|
|
10927
10936
|
* Whether the client should log a warning message if it fails to connect to
|
|
10928
10937
|
* the backend (initially true, cleared after a successful stream, or if we've
|
|
10929
10938
|
* logged the message already).
|
|
10930
10939
|
*/
|
|
10931
|
-
this
|
|
10940
|
+
this.Mr = !0
|
|
10932
10941
|
/**
|
|
10933
10942
|
* Called by RemoteStore when a watch stream is started (including on each
|
|
10934
10943
|
* backoff attempt).
|
|
@@ -10937,10 +10946,10 @@ function Ho() {
|
|
|
10937
10946
|
* the onlineStateTimer.
|
|
10938
10947
|
*/;
|
|
10939
10948
|
}
|
|
10940
|
-
return t.prototype.
|
|
10949
|
+
return t.prototype.Lr = function() {
|
|
10941
10950
|
var t = this;
|
|
10942
|
-
0 === this.
|
|
10943
|
-
return t.
|
|
10951
|
+
0 === this.Or && (this.Br("Unknown" /* Unknown */), this.Fr = this.asyncQueue.enqueueAfterDelay("online_state_timeout" /* OnlineStateTimeout */ , 1e4, (function() {
|
|
10952
|
+
return t.Fr = null, t.Ur("Backend didn't respond within 10 seconds."), t.Br("Offline" /* Offline */),
|
|
10944
10953
|
Promise.resolve();
|
|
10945
10954
|
})));
|
|
10946
10955
|
},
|
|
@@ -10950,10 +10959,10 @@ function Ho() {
|
|
|
10950
10959
|
* allow multiple failures (based on MAX_WATCH_STREAM_FAILURES) before we
|
|
10951
10960
|
* actually transition to the 'Offline' state.
|
|
10952
10961
|
*/
|
|
10953
|
-
t.prototype.
|
|
10954
|
-
"Online" /* Online */ === this.state ? this.
|
|
10955
|
-
this.
|
|
10956
|
-
this.
|
|
10962
|
+
t.prototype.qr = function(t) {
|
|
10963
|
+
"Online" /* Online */ === this.state ? this.Br("Unknown" /* Unknown */) : (this.Or++,
|
|
10964
|
+
this.Or >= 1 && (this.Kr(), this.Ur("Connection failed 1 times. Most recent error: " + t.toString()),
|
|
10965
|
+
this.Br("Offline" /* Offline */)));
|
|
10957
10966
|
},
|
|
10958
10967
|
/**
|
|
10959
10968
|
* Explicitly sets the OnlineState to the specified state.
|
|
@@ -10963,17 +10972,17 @@ function Ho() {
|
|
|
10963
10972
|
* handleWatchStreamStart() and handleWatchStreamFailure().
|
|
10964
10973
|
*/
|
|
10965
10974
|
t.prototype.set = function(t) {
|
|
10966
|
-
this.
|
|
10975
|
+
this.Kr(), this.Or = 0, "Online" /* Online */ === t && (
|
|
10967
10976
|
// We've connected to watch at least once. Don't warn the developer
|
|
10968
10977
|
// about being offline going forward.
|
|
10969
|
-
this
|
|
10970
|
-
}, t.prototype.
|
|
10978
|
+
this.Mr = !1), this.Br(t);
|
|
10979
|
+
}, t.prototype.Br = function(t) {
|
|
10971
10980
|
t !== this.state && (this.state = t, this.onlineStateHandler(t));
|
|
10972
|
-
}, t.prototype.
|
|
10981
|
+
}, t.prototype.Ur = function(t) {
|
|
10973
10982
|
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.";
|
|
10974
|
-
this
|
|
10975
|
-
}, t.prototype.
|
|
10976
|
-
null !== this.
|
|
10983
|
+
this.Mr ? (U(e), this.Mr = !1) : q("OnlineStateTracker", e);
|
|
10984
|
+
}, t.prototype.Kr = function() {
|
|
10985
|
+
null !== this.Fr && (this.Fr.cancel(), this.Fr = null);
|
|
10977
10986
|
}, t;
|
|
10978
10987
|
}(), ns = function(
|
|
10979
10988
|
/**
|
|
@@ -11001,7 +11010,7 @@ e, i, o, s) {
|
|
|
11001
11010
|
* purely based on order, and so we can just shift() writes from the front of
|
|
11002
11011
|
* the writePipeline as we receive responses.
|
|
11003
11012
|
*/
|
|
11004
|
-
this.
|
|
11013
|
+
this.jr = [],
|
|
11005
11014
|
/**
|
|
11006
11015
|
* A mapping of watched targets that the client cares about tracking and the
|
|
11007
11016
|
* user has explicitly called a 'listen' for this target.
|
|
@@ -11011,12 +11020,12 @@ e, i, o, s) {
|
|
|
11011
11020
|
* to the server. The targets removed with unlistens are removed eagerly
|
|
11012
11021
|
* without waiting for confirmation from the listen stream.
|
|
11013
11022
|
*/
|
|
11014
|
-
this.
|
|
11023
|
+
this.Qr = new Map,
|
|
11015
11024
|
/**
|
|
11016
11025
|
* A set of reasons for why the RemoteStore may be offline. If empty, the
|
|
11017
11026
|
* RemoteStore may start its network connections.
|
|
11018
11027
|
*/
|
|
11019
|
-
this.
|
|
11028
|
+
this.Wr = new Set,
|
|
11020
11029
|
/**
|
|
11021
11030
|
* Event handlers that get called when the network is disabled or enabled.
|
|
11022
11031
|
*
|
|
@@ -11024,7 +11033,7 @@ e, i, o, s) {
|
|
|
11024
11033
|
* underlying streams (to support tree-shakeable streams). On Android and iOS,
|
|
11025
11034
|
* the streams are created during construction of RemoteStore.
|
|
11026
11035
|
*/
|
|
11027
|
-
this.
|
|
11036
|
+
this.Gr = [], this.zr = s, this.zr.Ti((function(t) {
|
|
11028
11037
|
i.enqueueAndForget((function() {
|
|
11029
11038
|
return n(a, void 0, void 0, (function() {
|
|
11030
11039
|
return r(this, (function(t) {
|
|
@@ -11037,10 +11046,10 @@ e, i, o, s) {
|
|
|
11037
11046
|
return r(this, (function(n) {
|
|
11038
11047
|
switch (n.label) {
|
|
11039
11048
|
case 0:
|
|
11040
|
-
return (e = Q(t)).
|
|
11049
|
+
return (e = Q(t)).Wr.add(4 /* ConnectivityChange */), [ 4 /*yield*/ , is(e) ];
|
|
11041
11050
|
|
|
11042
11051
|
case 1:
|
|
11043
|
-
return n.sent(), e.
|
|
11052
|
+
return n.sent(), e.Hr.set("Unknown" /* Unknown */), e.Wr.delete(4 /* ConnectivityChange */),
|
|
11044
11053
|
[ 4 /*yield*/ , rs(e) ];
|
|
11045
11054
|
|
|
11046
11055
|
case 2:
|
|
@@ -11059,7 +11068,7 @@ e, i, o, s) {
|
|
|
11059
11068
|
}));
|
|
11060
11069
|
}));
|
|
11061
11070
|
}));
|
|
11062
|
-
})), this.
|
|
11071
|
+
})), this.Hr = new es(i, o);
|
|
11063
11072
|
};
|
|
11064
11073
|
|
|
11065
11074
|
/**
|
|
@@ -11116,7 +11125,7 @@ e, i, o, s) {
|
|
|
11116
11125
|
switch (r.label) {
|
|
11117
11126
|
case 0:
|
|
11118
11127
|
if (!fs(t)) return [ 3 /*break*/ , 4 ];
|
|
11119
|
-
e = 0, n = t.
|
|
11128
|
+
e = 0, n = t.Gr, r.label = 1;
|
|
11120
11129
|
|
|
11121
11130
|
case 1:
|
|
11122
11131
|
return e < n.length ? [ 4 /*yield*/ , (0, n[e])(/* enabled= */ !0) ] : [ 3 /*break*/ , 4 ];
|
|
@@ -11143,7 +11152,7 @@ e, i, o, s) {
|
|
|
11143
11152
|
return r(this, (function(r) {
|
|
11144
11153
|
switch (r.label) {
|
|
11145
11154
|
case 0:
|
|
11146
|
-
e = 0, n = t.
|
|
11155
|
+
e = 0, n = t.Gr, r.label = 1;
|
|
11147
11156
|
|
|
11148
11157
|
case 1:
|
|
11149
11158
|
return e < n.length ? [ 4 /*yield*/ , (0, n[e])(/* enabled= */ !1) ] : [ 3 /*break*/ , 4 ];
|
|
@@ -11166,11 +11175,11 @@ e, i, o, s) {
|
|
|
11166
11175
|
* is a no-op if the target of given `TargetData` is already being listened to.
|
|
11167
11176
|
*/ function os(t, e) {
|
|
11168
11177
|
var n = Q(t);
|
|
11169
|
-
n.
|
|
11178
|
+
n.Qr.has(e.targetId) || (
|
|
11170
11179
|
// Mark this as something the client is currently listening for.
|
|
11171
|
-
n.
|
|
11180
|
+
n.Qr.set(e.targetId, e), hs(n) ?
|
|
11172
11181
|
// The listen will be sent in onWatchStreamOpen
|
|
11173
|
-
cs(n) : _s(n).
|
|
11182
|
+
cs(n) : _s(n).hr() && as(n, e));
|
|
11174
11183
|
}
|
|
11175
11184
|
|
|
11176
11185
|
/**
|
|
@@ -11178,18 +11187,18 @@ e, i, o, s) {
|
|
|
11178
11187
|
* not being listened to.
|
|
11179
11188
|
*/ function ss(t, e) {
|
|
11180
11189
|
var n = Q(t), r = _s(n);
|
|
11181
|
-
n.
|
|
11190
|
+
n.Qr.delete(e), r.hr() && us(n, e), 0 === n.Qr.size && (r.hr() ? r.wr() : fs(n) &&
|
|
11182
11191
|
// Revert to OnlineState.Unknown if the watch stream is not open and we
|
|
11183
11192
|
// have no listeners, since without any listens to send we cannot
|
|
11184
11193
|
// confirm if the stream is healthy and upgrade to OnlineState.Online.
|
|
11185
|
-
n.
|
|
11194
|
+
n.Hr.set("Unknown" /* Unknown */));
|
|
11186
11195
|
}
|
|
11187
11196
|
|
|
11188
11197
|
/**
|
|
11189
11198
|
* We need to increment the the expected number of pending responses we're due
|
|
11190
11199
|
* from watch so we wait for the ack to process any messages from this target.
|
|
11191
11200
|
*/ function as(t, e) {
|
|
11192
|
-
t.
|
|
11201
|
+
t.Jr.Y(e.targetId), _s(t).br(e)
|
|
11193
11202
|
/**
|
|
11194
11203
|
* We need to increment the expected number of pending responses we're due
|
|
11195
11204
|
* from watch so we wait for the removal on the server before we process any
|
|
@@ -11198,18 +11207,18 @@ e, i, o, s) {
|
|
|
11198
11207
|
}
|
|
11199
11208
|
|
|
11200
11209
|
function us(t, e) {
|
|
11201
|
-
t.
|
|
11210
|
+
t.Jr.Y(e), _s(t).Pr(e);
|
|
11202
11211
|
}
|
|
11203
11212
|
|
|
11204
11213
|
function cs(t) {
|
|
11205
|
-
t.
|
|
11214
|
+
t.Jr = new Fn({
|
|
11206
11215
|
getRemoteKeysForTarget: function(e) {
|
|
11207
11216
|
return t.remoteSyncer.getRemoteKeysForTarget(e);
|
|
11208
11217
|
},
|
|
11209
11218
|
Tt: function(e) {
|
|
11210
|
-
return t.
|
|
11219
|
+
return t.Qr.get(e) || null;
|
|
11211
11220
|
}
|
|
11212
|
-
}), _s(t).start(), t.
|
|
11221
|
+
}), _s(t).start(), t.Hr.Lr()
|
|
11213
11222
|
/**
|
|
11214
11223
|
* Returns whether the watch stream should be started because it's necessary
|
|
11215
11224
|
* and has not yet been started.
|
|
@@ -11217,21 +11226,21 @@ function cs(t) {
|
|
|
11217
11226
|
}
|
|
11218
11227
|
|
|
11219
11228
|
function hs(t) {
|
|
11220
|
-
return fs(t) && !_s(t).
|
|
11229
|
+
return fs(t) && !_s(t).ur() && t.Qr.size > 0;
|
|
11221
11230
|
}
|
|
11222
11231
|
|
|
11223
11232
|
function fs(t) {
|
|
11224
|
-
return 0 === Q(t).
|
|
11233
|
+
return 0 === Q(t).Wr.size;
|
|
11225
11234
|
}
|
|
11226
11235
|
|
|
11227
11236
|
function ls(t) {
|
|
11228
|
-
t.
|
|
11237
|
+
t.Jr = void 0;
|
|
11229
11238
|
}
|
|
11230
11239
|
|
|
11231
11240
|
function ds(t) {
|
|
11232
11241
|
return n(this, void 0, void 0, (function() {
|
|
11233
11242
|
return r(this, (function(e) {
|
|
11234
|
-
return t.
|
|
11243
|
+
return t.Qr.forEach((function(e, n) {
|
|
11235
11244
|
as(t, e);
|
|
11236
11245
|
})), [ 2 /*return*/ ];
|
|
11237
11246
|
}));
|
|
@@ -11243,11 +11252,11 @@ function ps(t, e) {
|
|
|
11243
11252
|
return r(this, (function(n) {
|
|
11244
11253
|
return ls(t),
|
|
11245
11254
|
// If we still need the watch stream, retry the connection.
|
|
11246
|
-
hs(t) ? (t.
|
|
11255
|
+
hs(t) ? (t.Hr.qr(e), cs(t)) :
|
|
11247
11256
|
// No need to restart watch stream because there are no active targets.
|
|
11248
11257
|
// The online state is set to unknown because there is no active attempt
|
|
11249
11258
|
// at establishing a connection
|
|
11250
|
-
t.
|
|
11259
|
+
t.Hr.set("Unknown" /* Unknown */), [ 2 /*return*/ ];
|
|
11251
11260
|
}));
|
|
11252
11261
|
}));
|
|
11253
11262
|
}
|
|
@@ -11258,7 +11267,7 @@ function ys(t, e, i) {
|
|
|
11258
11267
|
return r(this, (function(u) {
|
|
11259
11268
|
switch (u.label) {
|
|
11260
11269
|
case 0:
|
|
11261
|
-
if (t.
|
|
11270
|
+
if (t.Hr.set("Online" /* Online */), !(e instanceof On && 2 /* Removed */ === e.state && e.cause))
|
|
11262
11271
|
// Mark the client as online since we got a message from the server
|
|
11263
11272
|
return [ 3 /*break*/ , 6 ];
|
|
11264
11273
|
u.label = 1;
|
|
@@ -11275,10 +11284,10 @@ function ys(t, e, i) {
|
|
|
11275
11284
|
n = e.cause, i = 0, o = e.targetIds, r.label = 1;
|
|
11276
11285
|
|
|
11277
11286
|
case 1:
|
|
11278
|
-
return i < o.length ? (s = o[i], t.
|
|
11287
|
+
return i < o.length ? (s = o[i], t.Qr.has(s) ? [ 4 /*yield*/ , t.remoteSyncer.rejectListen(s, n) ] : [ 3 /*break*/ , 3 ]) : [ 3 /*break*/ , 5 ];
|
|
11279
11288
|
|
|
11280
11289
|
case 2:
|
|
11281
|
-
r.sent(), t.
|
|
11290
|
+
r.sent(), t.Qr.delete(s), t.Jr.removeTarget(s), r.label = 3;
|
|
11282
11291
|
|
|
11283
11292
|
case 3:
|
|
11284
11293
|
r.label = 4;
|
|
@@ -11307,7 +11316,7 @@ function ys(t, e, i) {
|
|
|
11307
11316
|
return [ 3 /*break*/ , 13 ];
|
|
11308
11317
|
|
|
11309
11318
|
case 6:
|
|
11310
|
-
if (e instanceof Ln ? t.
|
|
11319
|
+
if (e instanceof Ln ? t.Jr.rt(e) : e instanceof Rn ? t.Jr.ft(e) : t.Jr.ct(e), i.isEqual(ct.min())) return [ 3 /*break*/ , 13 ];
|
|
11311
11320
|
u.label = 7;
|
|
11312
11321
|
|
|
11313
11322
|
case 7:
|
|
@@ -11321,24 +11330,24 @@ function ys(t, e, i) {
|
|
|
11321
11330
|
* SyncEngine.
|
|
11322
11331
|
*/
|
|
11323
11332
|
function(t, e) {
|
|
11324
|
-
var n = t.
|
|
11333
|
+
var n = t.Jr._t(e);
|
|
11325
11334
|
// Update in-memory resume tokens. LocalStore will update the
|
|
11326
11335
|
// persistent view of these when applying the completed RemoteEvent.
|
|
11327
11336
|
return n.targetChanges.forEach((function(n, r) {
|
|
11328
11337
|
if (n.resumeToken.approximateByteSize() > 0) {
|
|
11329
|
-
var i = t.
|
|
11338
|
+
var i = t.Qr.get(r);
|
|
11330
11339
|
// A watched target might have been removed already.
|
|
11331
|
-
i && t.
|
|
11340
|
+
i && t.Qr.set(r, i.withResumeToken(n.resumeToken, e));
|
|
11332
11341
|
}
|
|
11333
11342
|
})),
|
|
11334
11343
|
// Re-establish listens for the targets that have been invalidated by
|
|
11335
11344
|
// existence filter mismatches.
|
|
11336
11345
|
n.targetMismatches.forEach((function(e) {
|
|
11337
|
-
var n = t.
|
|
11346
|
+
var n = t.Qr.get(e);
|
|
11338
11347
|
if (n) {
|
|
11339
11348
|
// Clear the resume token for the target, since we're in a known mismatch
|
|
11340
11349
|
// state.
|
|
11341
|
-
t.
|
|
11350
|
+
t.Qr.set(e, n.withResumeToken(wt.EMPTY_BYTE_STRING, n.snapshotVersion)),
|
|
11342
11351
|
// Cause a hard reset by unwatching and rewatching immediately, but
|
|
11343
11352
|
// deliberately don't send a resume token so that we get a full update.
|
|
11344
11353
|
us(t, e);
|
|
@@ -11391,11 +11400,11 @@ function ys(t, e, i) {
|
|
|
11391
11400
|
case 0:
|
|
11392
11401
|
if (!Qr(e)) throw e;
|
|
11393
11402
|
// Disable network and raise offline snapshots
|
|
11394
|
-
return t.
|
|
11403
|
+
return t.Wr.add(1 /* IndexedDbFailed */), [ 4 /*yield*/ , is(t) ];
|
|
11395
11404
|
|
|
11396
11405
|
case 1:
|
|
11397
11406
|
// Disable network and raise offline snapshots
|
|
11398
|
-
return s.sent(), t.
|
|
11407
|
+
return s.sent(), t.Hr.set("Offline" /* Offline */), i || (
|
|
11399
11408
|
// Use a simple read operation to determine if IndexedDB recovered.
|
|
11400
11409
|
// Ideally, we would expose a health check directly on SimpleDb, but
|
|
11401
11410
|
// RemoteStore only has access to persistence through LocalStore.
|
|
@@ -11411,7 +11420,7 @@ function ys(t, e, i) {
|
|
|
11411
11420
|
return q("RemoteStore", "Retrying IndexedDB access"), [ 4 /*yield*/ , i() ];
|
|
11412
11421
|
|
|
11413
11422
|
case 1:
|
|
11414
|
-
return e.sent(), t.
|
|
11423
|
+
return e.sent(), t.Wr.delete(1 /* IndexedDbFailed */), [ 4 /*yield*/ , rs(t) ];
|
|
11415
11424
|
|
|
11416
11425
|
case 2:
|
|
11417
11426
|
return e.sent(), [ 2 /*return*/ ];
|
|
@@ -11439,7 +11448,7 @@ function gs(t) {
|
|
|
11439
11448
|
return r(this, (function(r) {
|
|
11440
11449
|
switch (r.label) {
|
|
11441
11450
|
case 0:
|
|
11442
|
-
e = Q(t), n = Ds(e), i = e.
|
|
11451
|
+
e = Q(t), n = Ds(e), i = e.jr.length > 0 ? e.jr[e.jr.length - 1].batchId : -1, r.label = 1;
|
|
11443
11452
|
|
|
11444
11453
|
case 1:
|
|
11445
11454
|
if (!
|
|
@@ -11448,7 +11457,7 @@ function gs(t) {
|
|
|
11448
11457
|
* enabled and the write pipeline is not full).
|
|
11449
11458
|
*/
|
|
11450
11459
|
function(t) {
|
|
11451
|
-
return fs(t) && t.
|
|
11460
|
+
return fs(t) && t.jr.length < 10;
|
|
11452
11461
|
}
|
|
11453
11462
|
/**
|
|
11454
11463
|
* Queues additional writes to be sent to the write stream, sending them
|
|
@@ -11460,11 +11469,11 @@ function gs(t) {
|
|
|
11460
11469
|
return r.trys.push([ 2, 4, , 6 ]), [ 4 /*yield*/ , lo(e.localStore, i) ];
|
|
11461
11470
|
|
|
11462
11471
|
case 3:
|
|
11463
|
-
return null === (o = r.sent()) ? (0 === e.
|
|
11472
|
+
return null === (o = r.sent()) ? (0 === e.jr.length && n.wr(), [ 3 /*break*/ , 7 ]) : (i = o.batchId,
|
|
11464
11473
|
function(t, e) {
|
|
11465
|
-
t.
|
|
11474
|
+
t.jr.push(e);
|
|
11466
11475
|
var n = Ds(t);
|
|
11467
|
-
n.
|
|
11476
|
+
n.hr() && n.Vr && n.Sr(e.mutations);
|
|
11468
11477
|
}(e, o), [ 3 /*break*/ , 6 ]);
|
|
11469
11478
|
|
|
11470
11479
|
case 4:
|
|
@@ -11484,7 +11493,7 @@ function gs(t) {
|
|
|
11484
11493
|
}
|
|
11485
11494
|
|
|
11486
11495
|
function ws(t) {
|
|
11487
|
-
return fs(t) && !Ds(t).
|
|
11496
|
+
return fs(t) && !Ds(t).ur() && t.jr.length > 0;
|
|
11488
11497
|
}
|
|
11489
11498
|
|
|
11490
11499
|
function bs(t) {
|
|
@@ -11494,7 +11503,7 @@ function bs(t) {
|
|
|
11494
11503
|
function Is(t) {
|
|
11495
11504
|
return n(this, void 0, void 0, (function() {
|
|
11496
11505
|
return r(this, (function(e) {
|
|
11497
|
-
return Ds(t).
|
|
11506
|
+
return Ds(t).Nr(), [ 2 /*return*/ ];
|
|
11498
11507
|
}));
|
|
11499
11508
|
}));
|
|
11500
11509
|
}
|
|
@@ -11504,7 +11513,7 @@ function Ts(t) {
|
|
|
11504
11513
|
var e, n, i, o;
|
|
11505
11514
|
return r(this, (function(r) {
|
|
11506
11515
|
// Send the write pipeline now that the stream is established.
|
|
11507
|
-
for (e = Ds(t), n = 0, i = t.
|
|
11516
|
+
for (e = Ds(t), n = 0, i = t.jr; n < i.length; n++) o = i[n], e.Sr(o.mutations);
|
|
11508
11517
|
return [ 2 /*return*/ ];
|
|
11509
11518
|
}));
|
|
11510
11519
|
}));
|
|
@@ -11516,7 +11525,7 @@ function Es(t, e, i) {
|
|
|
11516
11525
|
return r(this, (function(r) {
|
|
11517
11526
|
switch (r.label) {
|
|
11518
11527
|
case 0:
|
|
11519
|
-
return n = t.
|
|
11528
|
+
return n = t.jr.shift(), o = ti.from(n, e, i), [ 4 /*yield*/ , ms(t, (function() {
|
|
11520
11529
|
return t.remoteSyncer.applySuccessfulWrite(o);
|
|
11521
11530
|
})) ];
|
|
11522
11531
|
|
|
@@ -11539,17 +11548,17 @@ function Ss(t, e) {
|
|
|
11539
11548
|
return r(this, (function(i) {
|
|
11540
11549
|
switch (i.label) {
|
|
11541
11550
|
case 0:
|
|
11542
|
-
return e && Ds(t).
|
|
11551
|
+
return e && Ds(t).Vr ? [ 4 /*yield*/ , function(t, e) {
|
|
11543
11552
|
return n(this, void 0, void 0, (function() {
|
|
11544
11553
|
var n, i;
|
|
11545
11554
|
return r(this, (function(r) {
|
|
11546
11555
|
switch (r.label) {
|
|
11547
11556
|
case 0:
|
|
11548
|
-
return dn(i = e.code) && i !== H.ABORTED ? (n = t.
|
|
11557
|
+
return dn(i = e.code) && i !== H.ABORTED ? (n = t.jr.shift(),
|
|
11549
11558
|
// In this case it's also unlikely that the server itself is melting
|
|
11550
11559
|
// down -- this was just a bad request so inhibit backoff on the next
|
|
11551
11560
|
// restart.
|
|
11552
|
-
Ds(t).
|
|
11561
|
+
Ds(t).dr(), [ 4 /*yield*/ , ms(t, (function() {
|
|
11553
11562
|
return t.remoteSyncer.rejectFailedWrite(n.batchId, e);
|
|
11554
11563
|
})) ]) : [ 3 /*break*/ , 3 ];
|
|
11555
11564
|
|
|
@@ -11597,16 +11606,16 @@ function Ss(t, e) {
|
|
|
11597
11606
|
return r(this, (function(r) {
|
|
11598
11607
|
switch (r.label) {
|
|
11599
11608
|
case 0:
|
|
11600
|
-
return n = Q(t), e ? (n.
|
|
11609
|
+
return n = Q(t), e ? (n.Wr.delete(2 /* IsSecondary */), [ 4 /*yield*/ , rs(n) ]) : [ 3 /*break*/ , 2 ];
|
|
11601
11610
|
|
|
11602
11611
|
case 1:
|
|
11603
11612
|
return r.sent(), [ 3 /*break*/ , 5 ];
|
|
11604
11613
|
|
|
11605
11614
|
case 2:
|
|
11606
|
-
return e ? [ 3 /*break*/ , 4 ] : (n.
|
|
11615
|
+
return e ? [ 3 /*break*/ , 4 ] : (n.Wr.add(2 /* IsSecondary */), [ 4 /*yield*/ , is(n) ]);
|
|
11607
11616
|
|
|
11608
11617
|
case 3:
|
|
11609
|
-
r.sent(), n.
|
|
11618
|
+
r.sent(), n.Hr.set("Unknown" /* Unknown */), r.label = 4;
|
|
11610
11619
|
|
|
11611
11620
|
case 4:
|
|
11612
11621
|
r.label = 5;
|
|
@@ -11627,24 +11636,24 @@ function Ss(t, e) {
|
|
|
11627
11636
|
* This is not done on Web to allow it to be tree-shaken.
|
|
11628
11637
|
*/ function _s(t) {
|
|
11629
11638
|
var e = this;
|
|
11630
|
-
return t.
|
|
11639
|
+
return t.Yr || (
|
|
11631
11640
|
// Create stream (but note that it is not started yet).
|
|
11632
|
-
t.
|
|
11641
|
+
t.Yr = function(t, e, n) {
|
|
11633
11642
|
var r = Q(t);
|
|
11634
|
-
return r
|
|
11643
|
+
return r.$r(), new Zo(e, r.sr, r.credentials, r.N, n);
|
|
11635
11644
|
}(t.datastore, t.asyncQueue, {
|
|
11636
11645
|
Si: ds.bind(null, t),
|
|
11637
11646
|
Ci: ps.bind(null, t),
|
|
11638
|
-
|
|
11639
|
-
}), t.
|
|
11647
|
+
Rr: ys.bind(null, t)
|
|
11648
|
+
}), t.Gr.push((function(i) {
|
|
11640
11649
|
return n(e, void 0, void 0, (function() {
|
|
11641
11650
|
return r(this, (function(e) {
|
|
11642
11651
|
switch (e.label) {
|
|
11643
11652
|
case 0:
|
|
11644
|
-
return i ? (t.
|
|
11653
|
+
return i ? (t.Yr.dr(), hs(t) ? cs(t) : t.Hr.set("Unknown" /* Unknown */), [ 3 /*break*/ , 3 ]) : [ 3 /*break*/ , 1 ];
|
|
11645
11654
|
|
|
11646
11655
|
case 1:
|
|
11647
|
-
return [ 4 /*yield*/ , t.
|
|
11656
|
+
return [ 4 /*yield*/ , t.Yr.stop() ];
|
|
11648
11657
|
|
|
11649
11658
|
case 2:
|
|
11650
11659
|
e.sent(), ls(t), e.label = 3;
|
|
@@ -11654,7 +11663,7 @@ function Ss(t, e) {
|
|
|
11654
11663
|
}
|
|
11655
11664
|
}));
|
|
11656
11665
|
}));
|
|
11657
|
-
}))), t.
|
|
11666
|
+
}))), t.Yr
|
|
11658
11667
|
/**
|
|
11659
11668
|
* If not yet initialized, registers the WriteStream and its network state
|
|
11660
11669
|
* callback with `remoteStoreImpl`. Returns the existing stream if one is
|
|
@@ -11667,40 +11676,40 @@ function Ss(t, e) {
|
|
|
11667
11676
|
|
|
11668
11677
|
function Ds(t) {
|
|
11669
11678
|
var e = this;
|
|
11670
|
-
return t.
|
|
11679
|
+
return t.Xr || (
|
|
11671
11680
|
// Create stream (but note that it is not started yet).
|
|
11672
|
-
t.
|
|
11681
|
+
t.Xr = function(t, e, n) {
|
|
11673
11682
|
var r = Q(t);
|
|
11674
|
-
return r
|
|
11683
|
+
return r.$r(), new $o(e, r.sr, r.credentials, r.N, n);
|
|
11675
11684
|
}(t.datastore, t.asyncQueue, {
|
|
11676
11685
|
Si: Is.bind(null, t),
|
|
11677
11686
|
Ci: Ss.bind(null, t),
|
|
11678
|
-
|
|
11679
|
-
|
|
11680
|
-
}), t.
|
|
11687
|
+
Cr: Ts.bind(null, t),
|
|
11688
|
+
Dr: Es.bind(null, t)
|
|
11689
|
+
}), t.Gr.push((function(i) {
|
|
11681
11690
|
return n(e, void 0, void 0, (function() {
|
|
11682
11691
|
return r(this, (function(e) {
|
|
11683
11692
|
switch (e.label) {
|
|
11684
11693
|
case 0:
|
|
11685
|
-
return i ? (t.
|
|
11694
|
+
return i ? (t.Xr.dr(), [ 4 /*yield*/ , gs(t) ]) : [ 3 /*break*/ , 2 ];
|
|
11686
11695
|
|
|
11687
11696
|
case 1:
|
|
11688
11697
|
// This will start the write stream if necessary.
|
|
11689
11698
|
return e.sent(), [ 3 /*break*/ , 4 ];
|
|
11690
11699
|
|
|
11691
11700
|
case 2:
|
|
11692
|
-
return [ 4 /*yield*/ , t.
|
|
11701
|
+
return [ 4 /*yield*/ , t.Xr.stop() ];
|
|
11693
11702
|
|
|
11694
11703
|
case 3:
|
|
11695
|
-
e.sent(), t.
|
|
11696
|
-
t.
|
|
11704
|
+
e.sent(), t.jr.length > 0 && (q("RemoteStore", "Stopping write stream with " + t.jr.length + " pending writes"),
|
|
11705
|
+
t.jr = []), e.label = 4;
|
|
11697
11706
|
|
|
11698
11707
|
case 4:
|
|
11699
11708
|
return [ 2 /*return*/ ];
|
|
11700
11709
|
}
|
|
11701
11710
|
}));
|
|
11702
11711
|
}));
|
|
11703
|
-
}))), t.
|
|
11712
|
+
}))), t.Xr
|
|
11704
11713
|
/**
|
|
11705
11714
|
* @license
|
|
11706
11715
|
* Copyright 2017 Google LLC
|
|
@@ -11899,25 +11908,25 @@ var As = /** @class */ function() {
|
|
|
11899
11908
|
}, t;
|
|
11900
11909
|
}(), xs = /** @class */ function() {
|
|
11901
11910
|
function t() {
|
|
11902
|
-
this.
|
|
11911
|
+
this.Zr = new yn(Ct.comparator);
|
|
11903
11912
|
}
|
|
11904
11913
|
return t.prototype.track = function(t) {
|
|
11905
|
-
var e = t.doc.key, n = this.
|
|
11914
|
+
var e = t.doc.key, n = this.Zr.get(e);
|
|
11906
11915
|
n ?
|
|
11907
11916
|
// Merge the new change with the existing change.
|
|
11908
|
-
0 /* Added */ !== t.type && 3 /* Metadata */ === n.type ? this.
|
|
11917
|
+
0 /* Added */ !== t.type && 3 /* Metadata */ === n.type ? this.Zr = this.Zr.insert(e, t) : 3 /* Metadata */ === t.type && 1 /* Removed */ !== n.type ? this.Zr = this.Zr.insert(e, {
|
|
11909
11918
|
type: n.type,
|
|
11910
11919
|
doc: t.doc
|
|
11911
|
-
}) : 2 /* Modified */ === t.type && 2 /* Modified */ === n.type ? this.
|
|
11920
|
+
}) : 2 /* Modified */ === t.type && 2 /* Modified */ === n.type ? this.Zr = this.Zr.insert(e, {
|
|
11912
11921
|
type: 2 /* Modified */ ,
|
|
11913
11922
|
doc: t.doc
|
|
11914
|
-
}) : 2 /* Modified */ === t.type && 0 /* Added */ === n.type ? this.
|
|
11923
|
+
}) : 2 /* Modified */ === t.type && 0 /* Added */ === n.type ? this.Zr = this.Zr.insert(e, {
|
|
11915
11924
|
type: 0 /* Added */ ,
|
|
11916
11925
|
doc: t.doc
|
|
11917
|
-
}) : 1 /* Removed */ === t.type && 0 /* Added */ === n.type ? this.
|
|
11926
|
+
}) : 1 /* Removed */ === t.type && 0 /* Added */ === n.type ? this.Zr = this.Zr.remove(e) : 1 /* Removed */ === t.type && 2 /* Modified */ === n.type ? this.Zr = this.Zr.insert(e, {
|
|
11918
11927
|
type: 1 /* Removed */ ,
|
|
11919
11928
|
doc: n.doc
|
|
11920
|
-
}) : 0 /* Added */ === t.type && 1 /* Removed */ === n.type ? this.
|
|
11929
|
+
}) : 0 /* Added */ === t.type && 1 /* Removed */ === n.type ? this.Zr = this.Zr.insert(e, {
|
|
11921
11930
|
type: 2 /* Modified */ ,
|
|
11922
11931
|
doc: t.doc
|
|
11923
11932
|
}) :
|
|
@@ -11928,10 +11937,10 @@ var As = /** @class */ function() {
|
|
|
11928
11937
|
// Removed->Modified
|
|
11929
11938
|
// Metadata->Added
|
|
11930
11939
|
// Removed->Metadata
|
|
11931
|
-
|
|
11932
|
-
}, t.prototype.
|
|
11940
|
+
K() : this.Zr = this.Zr.insert(e, t);
|
|
11941
|
+
}, t.prototype.eo = function() {
|
|
11933
11942
|
var t = [];
|
|
11934
|
-
return this.
|
|
11943
|
+
return this.Zr.inorderTraversal((function(e, n) {
|
|
11935
11944
|
t.push(n);
|
|
11936
11945
|
})), t;
|
|
11937
11946
|
}, t;
|
|
@@ -11965,11 +11974,11 @@ var As = /** @class */ function() {
|
|
|
11965
11974
|
return !0;
|
|
11966
11975
|
}, t;
|
|
11967
11976
|
}(), Rs = function() {
|
|
11968
|
-
this.
|
|
11977
|
+
this.no = void 0, this.listeners = [];
|
|
11969
11978
|
}, Os = function() {
|
|
11970
11979
|
this.queries = new Bi((function(t) {
|
|
11971
11980
|
return _e(t);
|
|
11972
|
-
}), Ne), this.onlineState = "Unknown" /* Unknown */ , this.
|
|
11981
|
+
}), Ne), this.onlineState = "Unknown" /* Unknown */ , this.so = new Set;
|
|
11973
11982
|
};
|
|
11974
11983
|
|
|
11975
11984
|
/**
|
|
@@ -12005,7 +12014,7 @@ var As = /** @class */ function() {
|
|
|
12005
12014
|
return r.trys.push([ 1, 3, , 4 ]), a = s, [ 4 /*yield*/ , n.onListen(i) ];
|
|
12006
12015
|
|
|
12007
12016
|
case 2:
|
|
12008
|
-
return a.
|
|
12017
|
+
return a.no = r.sent(), [ 3 /*break*/ , 4 ];
|
|
12009
12018
|
|
|
12010
12019
|
case 3:
|
|
12011
12020
|
return u = r.sent(), c = ks(u, "Initialization of query '" + De(e.query) + "' failed"),
|
|
@@ -12014,7 +12023,7 @@ var As = /** @class */ function() {
|
|
|
12014
12023
|
case 4:
|
|
12015
12024
|
return n.queries.set(i, s), s.listeners.push(e),
|
|
12016
12025
|
// Run global snapshot listeners if a consistent snapshot has been emitted.
|
|
12017
|
-
e.
|
|
12026
|
+
e.io(n.onlineState), s.no && e.ro(s.no) && qs(n), [ 2 /*return*/ ];
|
|
12018
12027
|
}
|
|
12019
12028
|
}));
|
|
12020
12029
|
}));
|
|
@@ -12035,9 +12044,9 @@ function Ms(t, e) {
|
|
|
12035
12044
|
var s = o[i], a = s.query, u = n.queries.get(a);
|
|
12036
12045
|
if (u) {
|
|
12037
12046
|
for (var c = 0, h = u.listeners; c < h.length; c++) {
|
|
12038
|
-
h[c].
|
|
12047
|
+
h[c].ro(s) && (r = !0);
|
|
12039
12048
|
}
|
|
12040
|
-
u.
|
|
12049
|
+
u.no = s;
|
|
12041
12050
|
}
|
|
12042
12051
|
}
|
|
12043
12052
|
r && qs(n);
|
|
@@ -12055,7 +12064,7 @@ function Vs(t, e, n) {
|
|
|
12055
12064
|
|
|
12056
12065
|
// Call all global snapshot listeners that have been set.
|
|
12057
12066
|
function qs(t) {
|
|
12058
|
-
t.
|
|
12067
|
+
t.so.forEach((function(t) {
|
|
12059
12068
|
t.next();
|
|
12060
12069
|
}));
|
|
12061
12070
|
}
|
|
@@ -12067,12 +12076,12 @@ function qs(t) {
|
|
|
12067
12076
|
* It uses an Observer to dispatch events.
|
|
12068
12077
|
*/ var Us = /** @class */ function() {
|
|
12069
12078
|
function t(t, e, n) {
|
|
12070
|
-
this.query = t, this.
|
|
12079
|
+
this.query = t, this.oo = e,
|
|
12071
12080
|
/**
|
|
12072
12081
|
* Initial snapshots (e.g. from cache) may not be propagated to the wrapped
|
|
12073
12082
|
* observer. This flag is set to true once we've actually raised an event.
|
|
12074
12083
|
*/
|
|
12075
|
-
this.
|
|
12084
|
+
this.ao = !1, this.co = null, this.onlineState = "Unknown" /* Unknown */ , this.options = n || {}
|
|
12076
12085
|
/**
|
|
12077
12086
|
* Applies the new ViewSnapshot to this listener, raising a user-facing event
|
|
12078
12087
|
* if applicable (depending on what changed, whether the user has opted into
|
|
@@ -12080,7 +12089,7 @@ function qs(t) {
|
|
|
12080
12089
|
* indeed raised.
|
|
12081
12090
|
*/;
|
|
12082
12091
|
}
|
|
12083
|
-
return t.prototype.
|
|
12092
|
+
return t.prototype.ro = function(t) {
|
|
12084
12093
|
if (!this.options.includeMetadataChanges) {
|
|
12085
12094
|
for (
|
|
12086
12095
|
// Remove the metadata only changes.
|
|
@@ -12092,17 +12101,17 @@ function qs(t) {
|
|
|
12092
12101
|
/* excludesMetadataChanges= */ !0);
|
|
12093
12102
|
}
|
|
12094
12103
|
var o = !1;
|
|
12095
|
-
return this.
|
|
12096
|
-
o = !0), this.
|
|
12104
|
+
return this.ao ? this.uo(t) && (this.oo.next(t), o = !0) : this.ho(t, this.onlineState) && (this.lo(t),
|
|
12105
|
+
o = !0), this.co = t, o;
|
|
12097
12106
|
}, t.prototype.onError = function(t) {
|
|
12098
|
-
this.
|
|
12107
|
+
this.oo.error(t);
|
|
12099
12108
|
},
|
|
12100
|
-
/** Returns whether a snapshot was raised. */ t.prototype.
|
|
12109
|
+
/** Returns whether a snapshot was raised. */ t.prototype.io = function(t) {
|
|
12101
12110
|
this.onlineState = t;
|
|
12102
12111
|
var e = !1;
|
|
12103
|
-
return this.
|
|
12112
|
+
return this.co && !this.ao && this.ho(this.co, t) && (this.lo(this.co), e = !0),
|
|
12104
12113
|
e;
|
|
12105
|
-
}, t.prototype.
|
|
12114
|
+
}, t.prototype.ho = function(t, e) {
|
|
12106
12115
|
// Always raise the first event when we're synced
|
|
12107
12116
|
if (!t.fromCache) return !0;
|
|
12108
12117
|
// NOTE: We consider OnlineState.Unknown as online (it should become Offline
|
|
@@ -12110,22 +12119,22 @@ function qs(t) {
|
|
|
12110
12119
|
var n = "Offline" /* Offline */ !== e;
|
|
12111
12120
|
// Don't raise the event if we're online, aren't synced yet (checked
|
|
12112
12121
|
// above) and are waiting for a sync.
|
|
12113
|
-
return !(this.options.
|
|
12122
|
+
return !(this.options.fo && n || t.docs.isEmpty() && "Offline" /* Offline */ !== e);
|
|
12114
12123
|
// Raise data from cache if we have any documents or we are offline
|
|
12115
|
-
}, t.prototype.
|
|
12124
|
+
}, t.prototype.uo = function(t) {
|
|
12116
12125
|
// We don't need to handle includeDocumentMetadataChanges here because
|
|
12117
12126
|
// the Metadata only changes have already been stripped out if needed.
|
|
12118
12127
|
// At this point the only changes we will see are the ones we should
|
|
12119
12128
|
// propagate.
|
|
12120
12129
|
if (t.docChanges.length > 0) return !0;
|
|
12121
|
-
var e = this.
|
|
12130
|
+
var e = this.co && this.co.hasPendingWrites !== t.hasPendingWrites;
|
|
12122
12131
|
return !(!t.syncStateChanged && !e) && !0 === this.options.includeMetadataChanges;
|
|
12123
12132
|
// Generally we should have hit one of the cases above, but it's possible
|
|
12124
12133
|
// to get here if there were only metadata docChanges and they got
|
|
12125
12134
|
// stripped out.
|
|
12126
|
-
}, t.prototype.
|
|
12127
|
-
t = Ls.fromInitialDocuments(t.query, t.docs, t.mutatedKeys, t.fromCache), this.
|
|
12128
|
-
this.
|
|
12135
|
+
}, t.prototype.lo = function(t) {
|
|
12136
|
+
t = Ls.fromInitialDocuments(t.query, t.docs, t.mutatedKeys, t.fromCache), this.ao = !0,
|
|
12137
|
+
this.oo.next(t);
|
|
12129
12138
|
}, t;
|
|
12130
12139
|
}(), Bs = /** @class */ function() {
|
|
12131
12140
|
function t(t,
|
|
@@ -12133,10 +12142,10 @@ function qs(t) {
|
|
|
12133
12142
|
e) {
|
|
12134
12143
|
this.payload = t, this.byteLength = e;
|
|
12135
12144
|
}
|
|
12136
|
-
return t.prototype.
|
|
12145
|
+
return t.prototype.wo = function() {
|
|
12137
12146
|
return "metadata" in this.payload;
|
|
12138
12147
|
}, t;
|
|
12139
|
-
}(),
|
|
12148
|
+
}(), js = /** @class */ function() {
|
|
12140
12149
|
function t(t) {
|
|
12141
12150
|
this.N = t;
|
|
12142
12151
|
}
|
|
@@ -12151,9 +12160,9 @@ function qs(t) {
|
|
|
12151
12160
|
}, t.prototype.Jn = function(t) {
|
|
12152
12161
|
return Gn(t);
|
|
12153
12162
|
}, t;
|
|
12154
|
-
}(),
|
|
12163
|
+
}(), Ks = /** @class */ function() {
|
|
12155
12164
|
function t(t, e, n) {
|
|
12156
|
-
this.
|
|
12165
|
+
this._o = t, this.localStore = e, this.N = n,
|
|
12157
12166
|
/** Batched queries to be saved into storage */
|
|
12158
12167
|
this.queries = [],
|
|
12159
12168
|
/** Batched documents to be saved into storage */
|
|
@@ -12165,7 +12174,7 @@ function qs(t) {
|
|
|
12165
12174
|
* otherwise returns null.
|
|
12166
12175
|
*/;
|
|
12167
12176
|
}
|
|
12168
|
-
return t.prototype.
|
|
12177
|
+
return t.prototype.mo = function(t) {
|
|
12169
12178
|
this.progress.bytesLoaded += t.byteLength;
|
|
12170
12179
|
var e = this.progress.documentsLoaded;
|
|
12171
12180
|
return t.payload.namedQuery ? this.queries.push(t.payload.namedQuery) : t.payload.documentMetadata ? (this.documents.push({
|
|
@@ -12173,8 +12182,8 @@ function qs(t) {
|
|
|
12173
12182
|
}), t.payload.documentMetadata.exists || ++e) : t.payload.document && (this.documents[this.documents.length - 1].document = t.payload.document,
|
|
12174
12183
|
++e), e !== this.progress.documentsLoaded ? (this.progress.documentsLoaded = e,
|
|
12175
12184
|
Object.assign({}, this.progress)) : null;
|
|
12176
|
-
}, t.prototype.
|
|
12177
|
-
for (var e = new Map, n = new
|
|
12185
|
+
}, t.prototype.yo = function(t) {
|
|
12186
|
+
for (var e = new Map, n = new js(this.N), r = 0, i = t; r < i.length; r++) {
|
|
12178
12187
|
var o = i[r];
|
|
12179
12188
|
if (o.metadata.queries) for (var s = n.zn(o.metadata.name), a = 0, u = o.metadata.queries; a < u.length; a++) {
|
|
12180
12189
|
var c = u[a], h = (e.get(c) || Dn()).add(s);
|
|
@@ -12192,10 +12201,10 @@ function qs(t) {
|
|
|
12192
12201
|
return r(this, (function(r) {
|
|
12193
12202
|
switch (r.label) {
|
|
12194
12203
|
case 0:
|
|
12195
|
-
return [ 4 /*yield*/ , bo(this.localStore, new
|
|
12204
|
+
return [ 4 /*yield*/ , bo(this.localStore, new js(this.N), this.documents, this._o.id) ];
|
|
12196
12205
|
|
|
12197
12206
|
case 1:
|
|
12198
|
-
t = r.sent(), e = this.
|
|
12207
|
+
t = r.sent(), e = this.yo(this.documents), n = 0, i = this.queries, r.label = 2;
|
|
12199
12208
|
|
|
12200
12209
|
case 2:
|
|
12201
12210
|
return n < i.length ? (o = i[n], [ 4 /*yield*/ , Io(this.localStore, o, e.get(o.name)) ]) : [ 3 /*break*/ , 5 ];
|
|
@@ -12275,7 +12284,7 @@ function zs(t) {
|
|
|
12275
12284
|
function t(t,
|
|
12276
12285
|
/** Documents included in the remote target */
|
|
12277
12286
|
e) {
|
|
12278
|
-
this.query = t, this.
|
|
12287
|
+
this.query = t, this.po = e, this.To = null,
|
|
12279
12288
|
/**
|
|
12280
12289
|
* A flag whether the view is current with the backend. A view is considered
|
|
12281
12290
|
* current after it has seen the current flag from the backend and did not
|
|
@@ -12284,17 +12293,17 @@ function zs(t) {
|
|
|
12284
12293
|
*/
|
|
12285
12294
|
this.current = !1,
|
|
12286
12295
|
/** Documents in the view but not in the remote target */
|
|
12287
|
-
this.
|
|
12296
|
+
this.Eo = Dn(),
|
|
12288
12297
|
/** Document Keys that have local changes */
|
|
12289
|
-
this.mutatedKeys = Dn(), this.
|
|
12298
|
+
this.mutatedKeys = Dn(), this.Io = ke(t), this.Ao = new Cs(this.Io);
|
|
12290
12299
|
}
|
|
12291
|
-
return Object.defineProperty(t.prototype, "
|
|
12300
|
+
return Object.defineProperty(t.prototype, "Ro", {
|
|
12292
12301
|
/**
|
|
12293
12302
|
* The set of remote documents that the server has told us belongs to the target associated with
|
|
12294
12303
|
* this view.
|
|
12295
12304
|
*/
|
|
12296
12305
|
get: function() {
|
|
12297
|
-
return this.
|
|
12306
|
+
return this.po;
|
|
12298
12307
|
},
|
|
12299
12308
|
enumerable: !1,
|
|
12300
12309
|
configurable: !0
|
|
@@ -12309,8 +12318,8 @@ function zs(t) {
|
|
|
12309
12318
|
* with this set of docs and changes instead of the current view.
|
|
12310
12319
|
* @returns a new set of docs, changes, and refill flag.
|
|
12311
12320
|
*/
|
|
12312
|
-
t.prototype.
|
|
12313
|
-
var n = this, r = e ? e.
|
|
12321
|
+
t.prototype.bo = function(t, e) {
|
|
12322
|
+
var n = this, r = e ? e.Po : new xs, i = e ? e.Ao : this.Ao, o = e ? e.mutatedKeys : this.mutatedKeys, s = i, a = !1, u = me(this.query) && i.size === this.query.limit ? i.last() : null, c = ge(this.query) && i.size === this.query.limit ? i.first() : null;
|
|
12314
12323
|
// Drop documents out to meet limit/limitToLast requirement.
|
|
12315
12324
|
if (t.inorderTraversal((function(t, e) {
|
|
12316
12325
|
var h = i.get(t), f = Ae(n.query, e) ? e : null, l = !!h && n.mutatedKeys.has(h.key), d = !!f && (f.hasLocalMutations ||
|
|
@@ -12321,10 +12330,10 @@ function zs(t) {
|
|
|
12321
12330
|
h && f ? h.data.isEqual(f.data) ? l !== d && (r.track({
|
|
12322
12331
|
type: 3 /* Metadata */ ,
|
|
12323
12332
|
doc: f
|
|
12324
|
-
}), p = !0) : n.
|
|
12333
|
+
}), p = !0) : n.vo(h, f) || (r.track({
|
|
12325
12334
|
type: 2 /* Modified */ ,
|
|
12326
12335
|
doc: f
|
|
12327
|
-
}), p = !0, (u && n.
|
|
12336
|
+
}), p = !0, (u && n.Io(f, u) > 0 || c && n.Io(f, c) < 0) && (
|
|
12328
12337
|
// This doc moved from inside the limit to outside the limit.
|
|
12329
12338
|
// That means there may be some other doc in the local cache
|
|
12330
12339
|
// that should be included instead.
|
|
@@ -12348,12 +12357,12 @@ function zs(t) {
|
|
|
12348
12357
|
});
|
|
12349
12358
|
}
|
|
12350
12359
|
return {
|
|
12351
|
-
|
|
12352
|
-
|
|
12360
|
+
Ao: s,
|
|
12361
|
+
Po: r,
|
|
12353
12362
|
Ln: a,
|
|
12354
12363
|
mutatedKeys: o
|
|
12355
12364
|
};
|
|
12356
|
-
}, t.prototype.
|
|
12365
|
+
}, t.prototype.vo = function(t, e) {
|
|
12357
12366
|
// We suppress the initial change event for documents that were modified as
|
|
12358
12367
|
// part of a write acknowledgment (e.g. when the value of a server transform
|
|
12359
12368
|
// is applied) as Watch will send us the same document again.
|
|
@@ -12375,10 +12384,10 @@ function zs(t) {
|
|
|
12375
12384
|
*/
|
|
12376
12385
|
// PORTING NOTE: The iOS/Android clients always compute limbo document changes.
|
|
12377
12386
|
t.prototype.applyChanges = function(t, e, n) {
|
|
12378
|
-
var r = this, i = this.
|
|
12379
|
-
this.
|
|
12387
|
+
var r = this, i = this.Ao;
|
|
12388
|
+
this.Ao = t.Ao, this.mutatedKeys = t.mutatedKeys;
|
|
12380
12389
|
// Sort changes based on type and query comparator
|
|
12381
|
-
var o = t.
|
|
12390
|
+
var o = t.Po.eo();
|
|
12382
12391
|
o.sort((function(t, e) {
|
|
12383
12392
|
return function(t, e) {
|
|
12384
12393
|
var n = function(t) {
|
|
@@ -12397,19 +12406,19 @@ function zs(t) {
|
|
|
12397
12406
|
return 0;
|
|
12398
12407
|
|
|
12399
12408
|
default:
|
|
12400
|
-
return
|
|
12409
|
+
return K();
|
|
12401
12410
|
}
|
|
12402
12411
|
};
|
|
12403
12412
|
return n(t) - n(e);
|
|
12404
|
-
}(t.type, e.type) || r.
|
|
12405
|
-
})), this.
|
|
12406
|
-
var s = e ? this.
|
|
12407
|
-
return this.
|
|
12408
|
-
snapshot: new Ls(this.query, t.
|
|
12413
|
+
}(t.type, e.type) || r.Io(t.doc, e.doc);
|
|
12414
|
+
})), this.Vo(n);
|
|
12415
|
+
var s = e ? this.So() : [], a = 0 === this.Eo.size && this.current ? 1 /* Synced */ : 0 /* Local */ , u = a !== this.To;
|
|
12416
|
+
return this.To = a, 0 !== o.length || u ? {
|
|
12417
|
+
snapshot: new Ls(this.query, t.Ao, i, o, t.mutatedKeys, 0 /* Local */ === a, u,
|
|
12409
12418
|
/* excludesMetadataChanges= */ !1),
|
|
12410
|
-
|
|
12419
|
+
Do: s
|
|
12411
12420
|
} : {
|
|
12412
|
-
|
|
12421
|
+
Do: s
|
|
12413
12422
|
};
|
|
12414
12423
|
// no changes
|
|
12415
12424
|
},
|
|
@@ -12417,57 +12426,57 @@ function zs(t) {
|
|
|
12417
12426
|
* Applies an OnlineState change to the view, potentially generating a
|
|
12418
12427
|
* ViewChange if the view's syncState changes as a result.
|
|
12419
12428
|
*/
|
|
12420
|
-
t.prototype.
|
|
12429
|
+
t.prototype.io = function(t) {
|
|
12421
12430
|
return this.current && "Offline" /* Offline */ === t ? (
|
|
12422
12431
|
// If we're offline, set `current` to false and then call applyChanges()
|
|
12423
12432
|
// to refresh our syncState and generate a ViewChange as appropriate. We
|
|
12424
12433
|
// are guaranteed to get a new TargetChange that sets `current` back to
|
|
12425
12434
|
// true once the client is back online.
|
|
12426
12435
|
this.current = !1, this.applyChanges({
|
|
12427
|
-
|
|
12428
|
-
|
|
12436
|
+
Ao: this.Ao,
|
|
12437
|
+
Po: new xs,
|
|
12429
12438
|
mutatedKeys: this.mutatedKeys,
|
|
12430
12439
|
Ln: !1
|
|
12431
12440
|
},
|
|
12432
12441
|
/* updateLimboDocuments= */ !1)) : {
|
|
12433
|
-
|
|
12442
|
+
Do: []
|
|
12434
12443
|
};
|
|
12435
12444
|
},
|
|
12436
12445
|
/**
|
|
12437
12446
|
* Returns whether the doc for the given key should be in limbo.
|
|
12438
12447
|
*/
|
|
12439
|
-
t.prototype.
|
|
12448
|
+
t.prototype.Co = function(t) {
|
|
12440
12449
|
// If the remote end says it's part of this query, it's not in limbo.
|
|
12441
|
-
return !this.
|
|
12450
|
+
return !this.po.has(t) &&
|
|
12442
12451
|
// The local store doesn't think it's a result, so it shouldn't be in limbo.
|
|
12443
|
-
!!this.
|
|
12452
|
+
!!this.Ao.has(t) && !this.Ao.get(t).hasLocalMutations;
|
|
12444
12453
|
},
|
|
12445
12454
|
/**
|
|
12446
12455
|
* Updates syncedDocuments, current, and limbo docs based on the given change.
|
|
12447
12456
|
* Returns the list of changes to which docs are in limbo.
|
|
12448
12457
|
*/
|
|
12449
|
-
t.prototype.
|
|
12458
|
+
t.prototype.Vo = function(t) {
|
|
12450
12459
|
var e = this;
|
|
12451
12460
|
t && (t.addedDocuments.forEach((function(t) {
|
|
12452
|
-
return e.
|
|
12461
|
+
return e.po = e.po.add(t);
|
|
12453
12462
|
})), t.modifiedDocuments.forEach((function(t) {})), t.removedDocuments.forEach((function(t) {
|
|
12454
|
-
return e.
|
|
12463
|
+
return e.po = e.po.delete(t);
|
|
12455
12464
|
})), this.current = t.current);
|
|
12456
|
-
}, t.prototype.
|
|
12465
|
+
}, t.prototype.So = function() {
|
|
12457
12466
|
var t = this;
|
|
12458
12467
|
// We can only determine limbo documents when we're in-sync with the server.
|
|
12459
12468
|
if (!this.current) return [];
|
|
12460
12469
|
// TODO(klimt): Do this incrementally so that it's not quadratic when
|
|
12461
12470
|
// updating many documents.
|
|
12462
|
-
var e = this.
|
|
12463
|
-
this.
|
|
12464
|
-
t.
|
|
12471
|
+
var e = this.Eo;
|
|
12472
|
+
this.Eo = Dn(), this.Ao.forEach((function(e) {
|
|
12473
|
+
t.Co(e.key) && (t.Eo = t.Eo.add(e.key));
|
|
12465
12474
|
}));
|
|
12466
12475
|
// Diff the new limbo docs with the old limbo docs.
|
|
12467
12476
|
var n = [];
|
|
12468
12477
|
return e.forEach((function(e) {
|
|
12469
|
-
t.
|
|
12470
|
-
})), this.
|
|
12478
|
+
t.Eo.has(e) || n.push(new Qs(e));
|
|
12479
|
+
})), this.Eo.forEach((function(t) {
|
|
12471
12480
|
e.has(t) || n.push(new Gs(t));
|
|
12472
12481
|
})), n;
|
|
12473
12482
|
},
|
|
@@ -12491,9 +12500,9 @@ function zs(t) {
|
|
|
12491
12500
|
* @returns The ViewChange that resulted from this synchronization.
|
|
12492
12501
|
*/
|
|
12493
12502
|
// PORTING NOTE: Multi-tab only.
|
|
12494
|
-
t.prototype.
|
|
12495
|
-
this.
|
|
12496
|
-
var e = this.
|
|
12503
|
+
t.prototype.No = function(t) {
|
|
12504
|
+
this.po = t.Gn, this.Eo = Dn();
|
|
12505
|
+
var e = this.bo(t.documents);
|
|
12497
12506
|
return this.applyChanges(e, /*updateLimboDocuments=*/ !0);
|
|
12498
12507
|
},
|
|
12499
12508
|
/**
|
|
@@ -12502,8 +12511,8 @@ function zs(t) {
|
|
|
12502
12511
|
* `hasPendingWrites` status of the already established view.
|
|
12503
12512
|
*/
|
|
12504
12513
|
// PORTING NOTE: Multi-tab only.
|
|
12505
|
-
t.prototype.
|
|
12506
|
-
return Ls.fromInitialDocuments(this.query, this.
|
|
12514
|
+
t.prototype.xo = function() {
|
|
12515
|
+
return Ls.fromInitialDocuments(this.query, this.Ao, this.mutatedKeys, 0 /* Local */ === this.To);
|
|
12507
12516
|
}, t;
|
|
12508
12517
|
}(), Ws = function(
|
|
12509
12518
|
/**
|
|
@@ -12531,15 +12540,15 @@ n) {
|
|
|
12531
12540
|
* decide whether it needs to manufacture a delete event for the target once
|
|
12532
12541
|
* the target is CURRENT.
|
|
12533
12542
|
*/
|
|
12534
|
-
this.
|
|
12543
|
+
this.ko = !1;
|
|
12535
12544
|
}, Js = /** @class */ function() {
|
|
12536
12545
|
function t(t, e, n,
|
|
12537
12546
|
// PORTING NOTE: Manages state synchronization in multi-tab environments.
|
|
12538
12547
|
r, i, o) {
|
|
12539
12548
|
this.localStore = t, this.remoteStore = e, this.eventManager = n, this.sharedClientState = r,
|
|
12540
|
-
this.currentUser = i, this.maxConcurrentLimboResolutions = o, this
|
|
12549
|
+
this.currentUser = i, this.maxConcurrentLimboResolutions = o, this.$o = {}, this.Oo = new Bi((function(t) {
|
|
12541
12550
|
return _e(t);
|
|
12542
|
-
}), Ne), this.
|
|
12551
|
+
}), Ne), this.Fo = new Map,
|
|
12543
12552
|
/**
|
|
12544
12553
|
* The keys of documents that are in limbo for which we haven't yet started a
|
|
12545
12554
|
* limbo resolution query. The strings in this set are the result of calling
|
|
@@ -12549,29 +12558,29 @@ n) {
|
|
|
12549
12558
|
* of arbitrary elements and it also maintains insertion order, providing the
|
|
12550
12559
|
* desired queue-like FIFO semantics.
|
|
12551
12560
|
*/
|
|
12552
|
-
this
|
|
12561
|
+
this.Mo = new Set,
|
|
12553
12562
|
/**
|
|
12554
12563
|
* Keeps track of the target ID for each document that is in limbo with an
|
|
12555
12564
|
* active target.
|
|
12556
12565
|
*/
|
|
12557
|
-
this.
|
|
12566
|
+
this.Lo = new yn(Ct.comparator),
|
|
12558
12567
|
/**
|
|
12559
12568
|
* Keeps track of the information about an active limbo resolution for each
|
|
12560
12569
|
* active target ID that was started for the purpose of limbo resolution.
|
|
12561
12570
|
*/
|
|
12562
|
-
this.
|
|
12571
|
+
this.Bo = new Map, this.Uo = new Eo,
|
|
12563
12572
|
/** Stores user completion handlers, indexed by User and BatchId. */
|
|
12564
|
-
this.
|
|
12573
|
+
this.qo = {},
|
|
12565
12574
|
/** Stores user callbacks waiting for all pending writes to be acknowledged. */
|
|
12566
|
-
this.
|
|
12575
|
+
this.Ko = new Map, this.jo = ki.ie(), this.onlineState = "Unknown" /* Unknown */ ,
|
|
12567
12576
|
// The primary state is set to `true` or `false` immediately after Firestore
|
|
12568
12577
|
// startup. In the interim, a client should only be considered primary if
|
|
12569
12578
|
// `isPrimary` is true.
|
|
12570
|
-
this.
|
|
12579
|
+
this.Qo = void 0;
|
|
12571
12580
|
}
|
|
12572
12581
|
return Object.defineProperty(t.prototype, "isPrimaryClient", {
|
|
12573
12582
|
get: function() {
|
|
12574
|
-
return !0 === this.
|
|
12583
|
+
return !0 === this.Qo;
|
|
12575
12584
|
},
|
|
12576
12585
|
enumerable: !1,
|
|
12577
12586
|
configurable: !0
|
|
@@ -12589,21 +12598,21 @@ function Xs(t, e) {
|
|
|
12589
12598
|
return r(this, (function(r) {
|
|
12590
12599
|
switch (r.label) {
|
|
12591
12600
|
case 0:
|
|
12592
|
-
return n = _a(t), (s = n.
|
|
12601
|
+
return n = _a(t), (s = n.Oo.get(e)) ? (
|
|
12593
12602
|
// PORTING NOTE: With Multi-Tab Web, it is possible that a query view
|
|
12594
12603
|
// already exists when EventManager calls us for the first time. This
|
|
12595
12604
|
// happens when the primary tab is already listening to this query on
|
|
12596
12605
|
// behalf of another tab and the user of the primary also starts listening
|
|
12597
12606
|
// to the query. EventManager will not have an assigned target ID in this
|
|
12598
12607
|
// case and calls `listen` to obtain this ID.
|
|
12599
|
-
i = s.targetId, n.sharedClientState.addLocalQueryTarget(i), o = s.view.
|
|
12608
|
+
i = s.targetId, n.sharedClientState.addLocalQueryTarget(i), o = s.view.xo(), [ 3 /*break*/ , 4 ]) : [ 3 /*break*/ , 1 ];
|
|
12600
12609
|
|
|
12601
12610
|
case 1:
|
|
12602
12611
|
return [ 4 /*yield*/ , po(n.localStore, Ee(e)) ];
|
|
12603
12612
|
|
|
12604
12613
|
case 2:
|
|
12605
12614
|
return a = r.sent(), u = n.sharedClientState.addLocalQueryTarget(a.targetId), i = a.targetId,
|
|
12606
|
-
[ 4 /*yield*/ ,
|
|
12615
|
+
[ 4 /*yield*/ , Zs(n, e, i, "current" === u) ];
|
|
12607
12616
|
|
|
12608
12617
|
case 3:
|
|
12609
12618
|
o = r.sent(), n.isPrimaryClient && os(n.remoteStore, a), r.label = 4;
|
|
@@ -12618,7 +12627,7 @@ function Xs(t, e) {
|
|
|
12618
12627
|
/**
|
|
12619
12628
|
* Registers a view for a previously unknown query and computes its initial
|
|
12620
12629
|
* snapshot.
|
|
12621
|
-
*/ function
|
|
12630
|
+
*/ function Zs(t, e, i, o) {
|
|
12622
12631
|
return n(this, void 0, void 0, (function() {
|
|
12623
12632
|
var s, a, u, c, h, f;
|
|
12624
12633
|
return r(this, (function(l) {
|
|
@@ -12627,17 +12636,17 @@ function Xs(t, e) {
|
|
|
12627
12636
|
// PORTING NOTE: On Web only, we inject the code that registers new Limbo
|
|
12628
12637
|
// targets based on view changes. This allows us to only depend on Limbo
|
|
12629
12638
|
// changes when user code includes queries.
|
|
12630
|
-
return t.
|
|
12639
|
+
return t.Wo = function(e, i, o) {
|
|
12631
12640
|
return function(t, e, i, o) {
|
|
12632
12641
|
return n(this, void 0, void 0, (function() {
|
|
12633
12642
|
var n, s, a;
|
|
12634
12643
|
return r(this, (function(r) {
|
|
12635
12644
|
switch (r.label) {
|
|
12636
12645
|
case 0:
|
|
12637
|
-
return n = e.view.
|
|
12646
|
+
return n = e.view.bo(i), n.Ln ? [ 4 /*yield*/ , vo(t.localStore, e.query,
|
|
12638
12647
|
/* usePreviousResults= */ !1).then((function(t) {
|
|
12639
12648
|
var r = t.documents;
|
|
12640
|
-
return e.view.
|
|
12649
|
+
return e.view.bo(r, n);
|
|
12641
12650
|
})) ] : [ 3 /*break*/ , 2 ];
|
|
12642
12651
|
|
|
12643
12652
|
case 1:
|
|
@@ -12648,7 +12657,7 @@ function Xs(t, e) {
|
|
|
12648
12657
|
|
|
12649
12658
|
case 2:
|
|
12650
12659
|
return s = o && o.targetChanges.get(e.targetId), a = e.view.applyChanges(n,
|
|
12651
|
-
/* updateLimboDocuments= */ t.isPrimaryClient, s), [ 2 /*return*/ , (fa(t, e.targetId, a.
|
|
12660
|
+
/* updateLimboDocuments= */ t.isPrimaryClient, s), [ 2 /*return*/ , (fa(t, e.targetId, a.Do),
|
|
12652
12661
|
a.snapshot) ];
|
|
12653
12662
|
}
|
|
12654
12663
|
}));
|
|
@@ -12658,25 +12667,25 @@ function Xs(t, e) {
|
|
|
12658
12667
|
/* usePreviousResults= */ !0) ];
|
|
12659
12668
|
|
|
12660
12669
|
case 1:
|
|
12661
|
-
return s = l.sent(), a = new Hs(e, s.Gn), u = a.
|
|
12670
|
+
return s = l.sent(), a = new Hs(e, s.Gn), u = a.bo(s.documents), c = xn.createSynthesizedTargetChangeForCurrentChange(i, o && "Offline" /* Offline */ !== t.onlineState),
|
|
12662
12671
|
h = a.applyChanges(u,
|
|
12663
|
-
/* updateLimboDocuments= */ t.isPrimaryClient, c), fa(t, i, h.
|
|
12664
|
-
[ 2 /*return*/ , (t.
|
|
12672
|
+
/* updateLimboDocuments= */ t.isPrimaryClient, c), fa(t, i, h.Do), f = new Ws(e, i, a),
|
|
12673
|
+
[ 2 /*return*/ , (t.Oo.set(e, f), t.Fo.has(i) ? t.Fo.get(i).push(e) : t.Fo.set(i, [ e ]),
|
|
12665
12674
|
h.snapshot) ];
|
|
12666
12675
|
}
|
|
12667
12676
|
}));
|
|
12668
12677
|
}));
|
|
12669
12678
|
}
|
|
12670
12679
|
|
|
12671
|
-
/** Stops listening to the query. */ function
|
|
12680
|
+
/** Stops listening to the query. */ function $s(t, e) {
|
|
12672
12681
|
return n(this, void 0, void 0, (function() {
|
|
12673
12682
|
var n, i, o;
|
|
12674
12683
|
return r(this, (function(r) {
|
|
12675
12684
|
switch (r.label) {
|
|
12676
12685
|
case 0:
|
|
12677
|
-
return n = Q(t), i = n.
|
|
12686
|
+
return n = Q(t), i = n.Oo.get(e), (o = n.Fo.get(i.targetId)).length > 1 ? [ 2 /*return*/ , (n.Fo.set(i.targetId, o.filter((function(t) {
|
|
12678
12687
|
return !Ne(t, e);
|
|
12679
|
-
}))), void n.
|
|
12688
|
+
}))), void n.Oo.delete(e)) ] : n.isPrimaryClient ? (
|
|
12680
12689
|
// We need to remove the local query target first to allow us to verify
|
|
12681
12690
|
// whether any other client is still interested in this target.
|
|
12682
12691
|
n.sharedClientState.removeLocalQueryTarget(i.targetId), n.sharedClientState.isActiveQueryTarget(i.targetId) ? [ 3 /*break*/ , 2 ] : [ 4 /*yield*/ , yo(n.localStore, i.targetId,
|
|
@@ -12737,7 +12746,7 @@ function Xs(t, e) {
|
|
|
12737
12746
|
// even if the backend sends us an update that already includes our
|
|
12738
12747
|
// transform.
|
|
12739
12748
|
var s = [], a = 0, u = e; a < u.length; a++) {
|
|
12740
|
-
var c = u[a], h =
|
|
12749
|
+
var c = u[a], h = $e(c, n.get(c.key));
|
|
12741
12750
|
null != h &&
|
|
12742
12751
|
// NOTE: The base state should only be applied if there's some
|
|
12743
12752
|
// existing document to override, so use a Precondition of
|
|
@@ -12756,8 +12765,8 @@ function Xs(t, e) {
|
|
|
12756
12765
|
|
|
12757
12766
|
case 2:
|
|
12758
12767
|
return o = r.sent(), n.sharedClientState.addPendingMutation(o.batchId), function(t, e, n) {
|
|
12759
|
-
var r = t.
|
|
12760
|
-
r || (r = new yn(ot)), r = r.insert(e, n), t.
|
|
12768
|
+
var r = t.qo[t.currentUser.toKey()];
|
|
12769
|
+
r || (r = new yn(ot)), r = r.insert(e, n), t.qo[t.currentUser.toKey()] = r;
|
|
12761
12770
|
}(n, o.batchId, i), [ 4 /*yield*/ , pa(n, o.changes) ];
|
|
12762
12771
|
|
|
12763
12772
|
case 3:
|
|
@@ -12795,13 +12804,13 @@ function Xs(t, e) {
|
|
|
12795
12804
|
return i = r.sent(),
|
|
12796
12805
|
// Update `receivedDocument` as appropriate for any limbo targets.
|
|
12797
12806
|
e.targetChanges.forEach((function(t, e) {
|
|
12798
|
-
var r = n.
|
|
12807
|
+
var r = n.Bo.get(e);
|
|
12799
12808
|
r && (
|
|
12800
12809
|
// Since this is a limbo resolution lookup, it's for a single document
|
|
12801
12810
|
// and it could be added, modified, or removed, but not a combination.
|
|
12802
12811
|
z(t.addedDocuments.size + t.modifiedDocuments.size + t.removedDocuments.size <= 1),
|
|
12803
|
-
t.addedDocuments.size > 0 ? r.
|
|
12804
|
-
r.
|
|
12812
|
+
t.addedDocuments.size > 0 ? r.ko = !0 : t.modifiedDocuments.size > 0 ? z(r.ko) : t.removedDocuments.size > 0 && (z(r.ko),
|
|
12813
|
+
r.ko = !1));
|
|
12805
12814
|
})), [ 4 /*yield*/ , pa(n, i, e) ];
|
|
12806
12815
|
|
|
12807
12816
|
case 3:
|
|
@@ -12832,8 +12841,8 @@ function Xs(t, e) {
|
|
|
12832
12841
|
// SharedClientState.
|
|
12833
12842
|
if (r.isPrimaryClient && 0 /* RemoteStore */ === n || !r.isPrimaryClient && 1 /* SharedClientState */ === n) {
|
|
12834
12843
|
var i = [];
|
|
12835
|
-
r.
|
|
12836
|
-
var r = n.view.
|
|
12844
|
+
r.Oo.forEach((function(t, n) {
|
|
12845
|
+
var r = n.view.io(e);
|
|
12837
12846
|
r.snapshot && i.push(r.snapshot);
|
|
12838
12847
|
})), function(t, e) {
|
|
12839
12848
|
var n = Q(t);
|
|
@@ -12842,10 +12851,10 @@ function Xs(t, e) {
|
|
|
12842
12851
|
n.queries.forEach((function(t, n) {
|
|
12843
12852
|
for (var i = 0, o = n.listeners; i < o.length; i++) {
|
|
12844
12853
|
// Run global snapshot listeners if a consistent snapshot has been emitted.
|
|
12845
|
-
o[i].
|
|
12854
|
+
o[i].io(e) && (r = !0);
|
|
12846
12855
|
}
|
|
12847
12856
|
})), r && qs(n);
|
|
12848
|
-
}(r.eventManager, e), i.length && r.
|
|
12857
|
+
}(r.eventManager, e), i.length && r.$o.Rr(i), r.onlineState = e, r.isPrimaryClient && r.sharedClientState.setOnlineState(e);
|
|
12849
12858
|
}
|
|
12850
12859
|
}
|
|
12851
12860
|
|
|
@@ -12866,7 +12875,7 @@ function Xs(t, e) {
|
|
|
12866
12875
|
switch (r.label) {
|
|
12867
12876
|
case 0:
|
|
12868
12877
|
// PORTING NOTE: Multi-tab only.
|
|
12869
|
-
return (n = Q(t)).sharedClientState.updateQueryState(e, "rejected", i), o = n.
|
|
12878
|
+
return (n = Q(t)).sharedClientState.updateQueryState(e, "rejected", i), o = n.Bo.get(e),
|
|
12870
12879
|
(s = o && o.key) ? (a = (a = new yn(Ct.comparator)).insert(s, Ht.newNoDocument(s, ct.min())),
|
|
12871
12880
|
u = Dn().add(s), c = new Cn(ct.min(),
|
|
12872
12881
|
/* targetChanges= */ new Map,
|
|
@@ -12879,7 +12888,7 @@ function Xs(t, e) {
|
|
|
12879
12888
|
// RemoteEvent. If `applyRemoteEvent()` throws, we want to re-listen to
|
|
12880
12889
|
// this query when the RemoteStore restarts the Watch stream, which should
|
|
12881
12890
|
// re-trigger the target failure.
|
|
12882
|
-
n.
|
|
12891
|
+
n.Lo = n.Lo.remove(s), n.Bo.delete(e), da(n), [ 3 /*break*/ , 4 ];
|
|
12883
12892
|
|
|
12884
12893
|
case 2:
|
|
12885
12894
|
return [ 4 /*yield*/ , yo(n.localStore, e,
|
|
@@ -13010,8 +13019,8 @@ function oa(t, e, i) {
|
|
|
13010
13019
|
}(n.localStore) ];
|
|
13011
13020
|
|
|
13012
13021
|
case 2:
|
|
13013
|
-
return -1 === (i = r.sent()) ? [ 2 /*return*/ , void e.resolve() ] : ((o = n.
|
|
13014
|
-
n.
|
|
13022
|
+
return -1 === (i = r.sent()) ? [ 2 /*return*/ , void e.resolve() ] : ((o = n.Ko.get(i) || []).push(e),
|
|
13023
|
+
n.Ko.set(i, o), [ 3 /*break*/ , 4 ]);
|
|
13015
13024
|
|
|
13016
13025
|
case 3:
|
|
13017
13026
|
return s = r.sent(), a = ks(s, "Initialization of waitForPendingWrites() operation failed"),
|
|
@@ -13028,56 +13037,56 @@ function oa(t, e, i) {
|
|
|
13028
13037
|
* Triggers the callbacks that are waiting for this batch id to get acknowledged by server,
|
|
13029
13038
|
* if there are any.
|
|
13030
13039
|
*/ function aa(t, e) {
|
|
13031
|
-
(t.
|
|
13040
|
+
(t.Ko.get(e) || []).forEach((function(t) {
|
|
13032
13041
|
t.resolve();
|
|
13033
|
-
})), t.
|
|
13042
|
+
})), t.Ko.delete(e)
|
|
13034
13043
|
/** Reject all outstanding callbacks waiting for pending writes to complete. */;
|
|
13035
13044
|
}
|
|
13036
13045
|
|
|
13037
13046
|
function ua(t, e, n) {
|
|
13038
|
-
var r = Q(t), i = r.
|
|
13047
|
+
var r = Q(t), i = r.qo[r.currentUser.toKey()];
|
|
13039
13048
|
// NOTE: Mutations restored from persistence won't have callbacks, so it's
|
|
13040
13049
|
// okay for there to be no callback for this ID.
|
|
13041
13050
|
if (i) {
|
|
13042
13051
|
var o = i.get(e);
|
|
13043
|
-
o && (n ? o.reject(n) : o.resolve(), i = i.remove(e)), r.
|
|
13052
|
+
o && (n ? o.reject(n) : o.resolve(), i = i.remove(e)), r.qo[r.currentUser.toKey()] = i;
|
|
13044
13053
|
}
|
|
13045
13054
|
}
|
|
13046
13055
|
|
|
13047
13056
|
function ca(t, e, n) {
|
|
13048
13057
|
void 0 === n && (n = null), t.sharedClientState.removeLocalQueryTarget(e);
|
|
13049
|
-
for (var r = 0, i = t.
|
|
13058
|
+
for (var r = 0, i = t.Fo.get(e); r < i.length; r++) {
|
|
13050
13059
|
var o = i[r];
|
|
13051
|
-
t.
|
|
13060
|
+
t.Oo.delete(o), n && t.$o.Go(o, n);
|
|
13052
13061
|
}
|
|
13053
|
-
t.
|
|
13054
|
-
t.
|
|
13062
|
+
t.Fo.delete(e), t.isPrimaryClient && t.Uo.cs(e).forEach((function(e) {
|
|
13063
|
+
t.Uo.containsKey(e) ||
|
|
13055
13064
|
// We removed the last reference for this key
|
|
13056
13065
|
ha(t, e);
|
|
13057
13066
|
}));
|
|
13058
13067
|
}
|
|
13059
13068
|
|
|
13060
13069
|
function ha(t, e) {
|
|
13061
|
-
t
|
|
13070
|
+
t.Mo.delete(e.path.canonicalString());
|
|
13062
13071
|
// It's possible that the target already got removed because the query failed. In that case,
|
|
13063
13072
|
// the key won't exist in `limboTargetsByKey`. Only do the cleanup if we still have the target.
|
|
13064
|
-
var n = t.
|
|
13065
|
-
null !== n && (ss(t.remoteStore, n), t.
|
|
13073
|
+
var n = t.Lo.get(e);
|
|
13074
|
+
null !== n && (ss(t.remoteStore, n), t.Lo = t.Lo.remove(e), t.Bo.delete(n), da(t));
|
|
13066
13075
|
}
|
|
13067
13076
|
|
|
13068
13077
|
function fa(t, e, n) {
|
|
13069
13078
|
for (var r = 0, i = n; r < i.length; r++) {
|
|
13070
13079
|
var o = i[r];
|
|
13071
|
-
o instanceof Gs ? (t.
|
|
13072
|
-
t.
|
|
13080
|
+
o instanceof Gs ? (t.Uo.addReference(o.key, e), la(t, o)) : o instanceof Qs ? (q("SyncEngine", "Document no longer in limbo: " + o.key),
|
|
13081
|
+
t.Uo.removeReference(o.key, e), t.Uo.containsKey(o.key) ||
|
|
13073
13082
|
// We removed the last reference for this key
|
|
13074
|
-
ha(t, o.key)) :
|
|
13083
|
+
ha(t, o.key)) : K();
|
|
13075
13084
|
}
|
|
13076
13085
|
}
|
|
13077
13086
|
|
|
13078
13087
|
function la(t, e) {
|
|
13079
13088
|
var n = e.key, r = n.path.canonicalString();
|
|
13080
|
-
t.
|
|
13089
|
+
t.Lo.get(n) || t.Mo.has(r) || (q("SyncEngine", "New document in limbo: " + n), t.Mo.add(r),
|
|
13081
13090
|
da(t));
|
|
13082
13091
|
}
|
|
13083
13092
|
|
|
@@ -13089,11 +13098,11 @@ function la(t, e) {
|
|
|
13089
13098
|
* with "resource exhausted" errors which can lead to pathological client
|
|
13090
13099
|
* behavior as seen in https://github.com/firebase/firebase-js-sdk/issues/2683.
|
|
13091
13100
|
*/ function da(t) {
|
|
13092
|
-
for (;t
|
|
13093
|
-
var e = t
|
|
13094
|
-
t
|
|
13095
|
-
var n = new Ct(pt.fromString(e)), r = t.
|
|
13096
|
-
t.
|
|
13101
|
+
for (;t.Mo.size > 0 && t.Lo.size < t.maxConcurrentLimboResolutions; ) {
|
|
13102
|
+
var e = t.Mo.values().next().value;
|
|
13103
|
+
t.Mo.delete(e);
|
|
13104
|
+
var n = new Ct(pt.fromString(e)), r = t.jo.next();
|
|
13105
|
+
t.Bo.set(r, new Ys(n)), t.Lo = t.Lo.insert(n, r), os(t.remoteStore, new ei(Ee(ve(n.path)), r, 2 /* LimboResolution */ , nt.T));
|
|
13097
13106
|
}
|
|
13098
13107
|
}
|
|
13099
13108
|
|
|
@@ -13103,8 +13112,8 @@ function pa(t, e, i) {
|
|
|
13103
13112
|
return r(this, (function(c) {
|
|
13104
13113
|
switch (c.label) {
|
|
13105
13114
|
case 0:
|
|
13106
|
-
return o = Q(t), s = [], a = [], u = [], o.
|
|
13107
|
-
u.push(o.
|
|
13115
|
+
return o = Q(t), s = [], a = [], u = [], o.Oo.isEmpty() ? [ 3 /*break*/ , 3 ] : (o.Oo.forEach((function(t, n) {
|
|
13116
|
+
u.push(o.Wo(n, e, i).then((function(t) {
|
|
13108
13117
|
if (t) {
|
|
13109
13118
|
o.isPrimaryClient && o.sharedClientState.updateQueryState(n.targetId, t.fromCache ? "not-current" : "current"),
|
|
13110
13119
|
s.push(t);
|
|
@@ -13115,7 +13124,7 @@ function pa(t, e, i) {
|
|
|
13115
13124
|
})), [ 4 /*yield*/ , Promise.all(u) ]);
|
|
13116
13125
|
|
|
13117
13126
|
case 1:
|
|
13118
|
-
return c.sent(), o.
|
|
13127
|
+
return c.sent(), o.$o.Rr(s), [ 4 /*yield*/ , function(t, e) {
|
|
13119
13128
|
return n(this, void 0, void 0, (function() {
|
|
13120
13129
|
var n, i, o, s, a, u, c, h, f;
|
|
13121
13130
|
return r(this, (function(r) {
|
|
@@ -13182,11 +13191,11 @@ function ya(t, e) {
|
|
|
13182
13191
|
return i = r.sent(), n.currentUser = e,
|
|
13183
13192
|
// Fails tasks waiting for pending writes requested by previous user.
|
|
13184
13193
|
function(t, e) {
|
|
13185
|
-
t.
|
|
13194
|
+
t.Ko.forEach((function(t) {
|
|
13186
13195
|
t.forEach((function(t) {
|
|
13187
13196
|
t.reject(new W(H.CANCELLED, "'waitForPendingWrites' promise is rejected due to a user change."));
|
|
13188
13197
|
}));
|
|
13189
|
-
})), t.
|
|
13198
|
+
})), t.Ko.clear();
|
|
13190
13199
|
}(n),
|
|
13191
13200
|
// TODO(b/114226417): Consider calling this only in the primary tab.
|
|
13192
13201
|
n.sharedClientState.handleUserChange(e, i.removedBatchIds, i.addedBatchIds), [ 4 /*yield*/ , pa(n, i.Wn) ];
|
|
@@ -13202,13 +13211,13 @@ function ya(t, e) {
|
|
|
13202
13211
|
}
|
|
13203
13212
|
|
|
13204
13213
|
function va(t, e) {
|
|
13205
|
-
var n = Q(t), r = n.
|
|
13206
|
-
if (r && r.
|
|
13207
|
-
var i = Dn(), o = n.
|
|
13214
|
+
var n = Q(t), r = n.Bo.get(e);
|
|
13215
|
+
if (r && r.ko) return Dn().add(r.key);
|
|
13216
|
+
var i = Dn(), o = n.Fo.get(e);
|
|
13208
13217
|
if (!o) return i;
|
|
13209
13218
|
for (var s = 0, a = o; s < a.length; s++) {
|
|
13210
|
-
var u = a[s], c = n.
|
|
13211
|
-
i = i.unionWith(c.view.
|
|
13219
|
+
var u = a[s], c = n.Oo.get(u);
|
|
13220
|
+
i = i.unionWith(c.view.Ro);
|
|
13212
13221
|
}
|
|
13213
13222
|
return i;
|
|
13214
13223
|
}
|
|
@@ -13226,7 +13235,7 @@ function va(t, e) {
|
|
|
13226
13235
|
/* usePreviousResults= */ !0) ];
|
|
13227
13236
|
|
|
13228
13237
|
case 1:
|
|
13229
|
-
return i = r.sent(), o = e.view.
|
|
13238
|
+
return i = r.sent(), o = e.view.No(i), [ 2 /*return*/ , (n.isPrimaryClient && fa(n, e.targetId, o.Do),
|
|
13230
13239
|
o) ];
|
|
13231
13240
|
}
|
|
13232
13241
|
}));
|
|
@@ -13281,7 +13290,7 @@ function wa(t, e, i, o) {
|
|
|
13281
13290
|
// other clients.
|
|
13282
13291
|
ua(n, e, o || null), aa(n, e), function(t, e) {
|
|
13283
13292
|
Q(Q(t).In).te(e);
|
|
13284
|
-
}(n.localStore, e)) :
|
|
13293
|
+
}(n.localStore, e)) : K(), r.label = 4;
|
|
13285
13294
|
|
|
13286
13295
|
case 4:
|
|
13287
13296
|
return [ 4 /*yield*/ , pa(n, s) ];
|
|
@@ -13314,19 +13323,19 @@ function ba(t, e) {
|
|
|
13314
13323
|
return r(this, (function(r) {
|
|
13315
13324
|
switch (r.label) {
|
|
13316
13325
|
case 0:
|
|
13317
|
-
return _a(n = Q(t)), Da(n), !0 !== e || !0 === n.
|
|
13326
|
+
return _a(n = Q(t)), Da(n), !0 !== e || !0 === n.Qo ? [ 3 /*break*/ , 3 ] : (i = n.sharedClientState.getAllActiveQueryTargets(),
|
|
13318
13327
|
[ 4 /*yield*/ , Ia(n, i.toArray()) ]);
|
|
13319
13328
|
|
|
13320
13329
|
case 1:
|
|
13321
|
-
return o = r.sent(), n.
|
|
13330
|
+
return o = r.sent(), n.Qo = !0, [ 4 /*yield*/ , Ns(n.remoteStore, !0) ];
|
|
13322
13331
|
|
|
13323
13332
|
case 2:
|
|
13324
13333
|
for (r.sent(), s = 0, a = o; s < a.length; s++) u = a[s], os(n.remoteStore, u);
|
|
13325
13334
|
return [ 3 /*break*/ , 7 ];
|
|
13326
13335
|
|
|
13327
13336
|
case 3:
|
|
13328
|
-
return !1 !== e || !1 === n.
|
|
13329
|
-
n.
|
|
13337
|
+
return !1 !== e || !1 === n.Qo ? [ 3 /*break*/ , 7 ] : (c = [], h = Promise.resolve(),
|
|
13338
|
+
n.Fo.forEach((function(t, e) {
|
|
13330
13339
|
n.sharedClientState.isLocalQueryTarget(e) ? c.push(e) : h = h.then((function() {
|
|
13331
13340
|
return ca(n, e), yo(n.localStore, e,
|
|
13332
13341
|
/*keepPersistedTargetData=*/ !0);
|
|
@@ -13341,10 +13350,10 @@ function ba(t, e) {
|
|
|
13341
13350
|
// PORTING NOTE: Multi-Tab only.
|
|
13342
13351
|
function(t) {
|
|
13343
13352
|
var e = Q(t);
|
|
13344
|
-
e.
|
|
13353
|
+
e.Bo.forEach((function(t, n) {
|
|
13345
13354
|
ss(e.remoteStore, n);
|
|
13346
|
-
})), e.
|
|
13347
|
-
}(n), n.
|
|
13355
|
+
})), e.Uo.us(), e.Bo = new Map, e.Lo = new yn(Ct.comparator);
|
|
13356
|
+
}(n), n.Qo = !1, [ 4 /*yield*/ , Ns(n.remoteStore, !1) ];
|
|
13348
13357
|
|
|
13349
13358
|
case 6:
|
|
13350
13359
|
r.sent(), r.label = 7;
|
|
@@ -13365,7 +13374,7 @@ function Ia(t, e, i) {
|
|
|
13365
13374
|
n = Q(t), i = [], o = [], s = 0, a = e, r.label = 1;
|
|
13366
13375
|
|
|
13367
13376
|
case 1:
|
|
13368
|
-
return s < a.length ? (u = a[s], c = void 0, (h = n.
|
|
13377
|
+
return s < a.length ? (u = a[s], c = void 0, (h = n.Fo.get(u)) && 0 !== h.length ? [ 4 /*yield*/ , po(n.localStore, Ee(h[0])) ] : [ 3 /*break*/ , 7 ]) : [ 3 /*break*/ , 13 ];
|
|
13369
13378
|
|
|
13370
13379
|
case 2:
|
|
13371
13380
|
// For queries that have a local View, we fetch their current state
|
|
@@ -13375,7 +13384,7 @@ function Ia(t, e, i) {
|
|
|
13375
13384
|
c = r.sent(), f = 0, l = h, r.label = 3;
|
|
13376
13385
|
|
|
13377
13386
|
case 3:
|
|
13378
|
-
return f < l.length ? (d = l[f], p = n.
|
|
13387
|
+
return f < l.length ? (d = l[f], p = n.Oo.get(d), [ 4 /*yield*/ , ma(n, p) ]) : [ 3 /*break*/ , 6 ];
|
|
13379
13388
|
|
|
13380
13389
|
case 4:
|
|
13381
13390
|
(y = r.sent()).snapshot && o.push(y.snapshot), r.label = 5;
|
|
@@ -13393,7 +13402,7 @@ function Ia(t, e, i) {
|
|
|
13393
13402
|
return v = r.sent(), [ 4 /*yield*/ , po(n.localStore, v) ];
|
|
13394
13403
|
|
|
13395
13404
|
case 9:
|
|
13396
|
-
return c = r.sent(), [ 4 /*yield*/ ,
|
|
13405
|
+
return c = r.sent(), [ 4 /*yield*/ , Zs(n, Ta(v), u,
|
|
13397
13406
|
/*current=*/ !1) ];
|
|
13398
13407
|
|
|
13399
13408
|
case 10:
|
|
@@ -13406,7 +13415,7 @@ function Ia(t, e, i) {
|
|
|
13406
13415
|
return s++, [ 3 /*break*/ , 1 ];
|
|
13407
13416
|
|
|
13408
13417
|
case 13:
|
|
13409
|
-
return [ 2 /*return*/ , (n.
|
|
13418
|
+
return [ 2 /*return*/ , (n.$o.Rr(o), i) ];
|
|
13410
13419
|
}
|
|
13411
13420
|
}));
|
|
13412
13421
|
}));
|
|
@@ -13442,13 +13451,13 @@ function Sa(t, e, i, o) {
|
|
|
13442
13451
|
return r(this, (function(r) {
|
|
13443
13452
|
switch (r.label) {
|
|
13444
13453
|
case 0:
|
|
13445
|
-
return (n = Q(t)).
|
|
13454
|
+
return (n = Q(t)).Qo ? (
|
|
13446
13455
|
// If we receive a target state notification via WebStorage, we are
|
|
13447
13456
|
// either already secondary or another tab has taken the primary lease.
|
|
13448
13457
|
q("SyncEngine", "Ignoring unexpected query state notification."), [ 3 /*break*/ , 8 ]) : [ 3 /*break*/ , 1 ];
|
|
13449
13458
|
|
|
13450
13459
|
case 1:
|
|
13451
|
-
if (!n.
|
|
13460
|
+
if (!n.Fo.has(e)) return [ 3 /*break*/ , 8 ];
|
|
13452
13461
|
switch (i) {
|
|
13453
13462
|
case "current":
|
|
13454
13463
|
case "not-current":
|
|
@@ -13477,7 +13486,7 @@ function Sa(t, e, i, o) {
|
|
|
13477
13486
|
return r.sent(), ca(n, e, o), [ 3 /*break*/ , 8 ];
|
|
13478
13487
|
|
|
13479
13488
|
case 7:
|
|
13480
|
-
|
|
13489
|
+
K(), r.label = 8;
|
|
13481
13490
|
|
|
13482
13491
|
case 8:
|
|
13483
13492
|
return [ 2 /*return*/ ];
|
|
@@ -13492,11 +13501,11 @@ function Sa(t, e, i, o) {
|
|
|
13492
13501
|
return r(this, (function(p) {
|
|
13493
13502
|
switch (p.label) {
|
|
13494
13503
|
case 0:
|
|
13495
|
-
if (!(n = _a(t)).
|
|
13504
|
+
if (!(n = _a(t)).Qo) return [ 3 /*break*/ , 10 ];
|
|
13496
13505
|
o = 0, s = e, p.label = 1;
|
|
13497
13506
|
|
|
13498
13507
|
case 1:
|
|
13499
|
-
return o < s.length ? (a = s[o], n.
|
|
13508
|
+
return o < s.length ? (a = s[o], n.Fo.has(a) ? (
|
|
13500
13509
|
// A target might have been added in a previous attempt
|
|
13501
13510
|
q("SyncEngine", "Adding an already active target " + a), [ 3 /*break*/ , 5 ]) : [ 4 /*yield*/ , mo(n.localStore, a) ]) : [ 3 /*break*/ , 6 ];
|
|
13502
13511
|
|
|
@@ -13504,7 +13513,7 @@ function Sa(t, e, i, o) {
|
|
|
13504
13513
|
return u = p.sent(), [ 4 /*yield*/ , po(n.localStore, u) ];
|
|
13505
13514
|
|
|
13506
13515
|
case 3:
|
|
13507
|
-
return c = p.sent(), [ 4 /*yield*/ ,
|
|
13516
|
+
return c = p.sent(), [ 4 /*yield*/ , Zs(n, Ta(u), c.targetId,
|
|
13508
13517
|
/*current=*/ !1) ];
|
|
13509
13518
|
|
|
13510
13519
|
case 4:
|
|
@@ -13518,7 +13527,7 @@ function Sa(t, e, i, o) {
|
|
|
13518
13527
|
return r(this, (function(e) {
|
|
13519
13528
|
switch (e.label) {
|
|
13520
13529
|
case 0:
|
|
13521
|
-
return n.
|
|
13530
|
+
return n.Fo.has(t) ? [ 4 /*yield*/ , yo(n.localStore, t,
|
|
13522
13531
|
/* keepPersistedTargetData */ !1).then((function() {
|
|
13523
13532
|
ss(n.remoteStore, t), ca(n, t);
|
|
13524
13533
|
})).catch(Oi) ] : [ 3 /*break*/ , 2 ];
|
|
@@ -13553,8 +13562,8 @@ function Sa(t, e, i, o) {
|
|
|
13553
13562
|
function _a(t) {
|
|
13554
13563
|
var e = Q(t);
|
|
13555
13564
|
return e.remoteStore.remoteSyncer.applyRemoteEvent = ea.bind(null, e), e.remoteStore.remoteSyncer.getRemoteKeysForTarget = va.bind(null, e),
|
|
13556
|
-
e.remoteStore.remoteSyncer.rejectListen = ra.bind(null, e), e.
|
|
13557
|
-
e.
|
|
13565
|
+
e.remoteStore.remoteSyncer.rejectListen = ra.bind(null, e), e.$o.Rr = Ms.bind(null, e.eventManager),
|
|
13566
|
+
e.$o.Go = Vs.bind(null, e.eventManager), e;
|
|
13558
13567
|
}
|
|
13559
13568
|
|
|
13560
13569
|
function Da(t) {
|
|
@@ -13607,16 +13616,16 @@ function Aa(t, e, i) {
|
|
|
13607
13616
|
}(n))) ];
|
|
13608
13617
|
|
|
13609
13618
|
case 4:
|
|
13610
|
-
return i._updateProgress(zs(n)), o = new
|
|
13619
|
+
return i._updateProgress(zs(n)), o = new Ks(n, t.localStore, e.N), [ 4 /*yield*/ , e.zo() ];
|
|
13611
13620
|
|
|
13612
13621
|
case 5:
|
|
13613
13622
|
s = r.sent(), r.label = 6;
|
|
13614
13623
|
|
|
13615
13624
|
case 6:
|
|
13616
|
-
return s ? [ 4 /*yield*/ , o.
|
|
13625
|
+
return s ? [ 4 /*yield*/ , o.mo(s) ] : [ 3 /*break*/ , 10 ];
|
|
13617
13626
|
|
|
13618
13627
|
case 7:
|
|
13619
|
-
return (a = r.sent()) && i._updateProgress(a), [ 4 /*yield*/ , e.
|
|
13628
|
+
return (a = r.sent()) && i._updateProgress(a), [ 4 /*yield*/ , e.zo() ];
|
|
13620
13629
|
|
|
13621
13630
|
case 8:
|
|
13622
13631
|
s = r.sent(), r.label = 9;
|
|
@@ -13696,21 +13705,21 @@ var ka = /** @class */ function() {
|
|
|
13696
13705
|
return r(this, (function(e) {
|
|
13697
13706
|
switch (e.label) {
|
|
13698
13707
|
case 0:
|
|
13699
|
-
return this.N = Yo(t.databaseInfo.databaseId), this.sharedClientState = this.
|
|
13700
|
-
this.persistence = this.
|
|
13708
|
+
return this.N = Yo(t.databaseInfo.databaseId), this.sharedClientState = this.Ho(t),
|
|
13709
|
+
this.persistence = this.Jo(t), [ 4 /*yield*/ , this.persistence.start() ];
|
|
13701
13710
|
|
|
13702
13711
|
case 1:
|
|
13703
|
-
return e.sent(), this.gcScheduler = this.
|
|
13712
|
+
return e.sent(), this.gcScheduler = this.Yo(t), this.localStore = this.Xo(t), [ 2 /*return*/ ];
|
|
13704
13713
|
}
|
|
13705
13714
|
}));
|
|
13706
13715
|
}));
|
|
13707
|
-
}, t.prototype.
|
|
13716
|
+
}, t.prototype.Yo = function(t) {
|
|
13708
13717
|
return null;
|
|
13709
|
-
}, t.prototype.
|
|
13718
|
+
}, t.prototype.Xo = function(t) {
|
|
13710
13719
|
return so(this.persistence, new io, t.initialUser, this.N);
|
|
13711
|
-
}, t.prototype.
|
|
13720
|
+
}, t.prototype.Jo = function(t) {
|
|
13712
13721
|
return new ko(xo.Ns, this.N);
|
|
13713
|
-
}, t.prototype.
|
|
13722
|
+
}, t.prototype.Ho = function(t) {
|
|
13714
13723
|
return new Bo;
|
|
13715
13724
|
}, t.prototype.terminate = function() {
|
|
13716
13725
|
return n(this, void 0, void 0, (function() {
|
|
@@ -13731,7 +13740,7 @@ var ka = /** @class */ function() {
|
|
|
13731
13740
|
}(), Ca = /** @class */ function(e) {
|
|
13732
13741
|
function i(t, n, r) {
|
|
13733
13742
|
var i = this;
|
|
13734
|
-
return (i = e.call(this) || this).
|
|
13743
|
+
return (i = e.call(this) || this).Zo = t, i.cacheSizeBytes = n, i.forceOwnership = r,
|
|
13735
13744
|
i.synchronizeTabs = !1, i;
|
|
13736
13745
|
}
|
|
13737
13746
|
return t(i, e), i.prototype.initialize = function(t) {
|
|
@@ -13746,15 +13755,15 @@ var ka = /** @class */ function() {
|
|
|
13746
13755
|
return r.sent(), [ 4 /*yield*/ , wo(this.localStore) ];
|
|
13747
13756
|
|
|
13748
13757
|
case 2:
|
|
13749
|
-
return r.sent(), [ 4 /*yield*/ , this.
|
|
13758
|
+
return r.sent(), [ 4 /*yield*/ , this.Zo.initialize(this, t) ];
|
|
13750
13759
|
|
|
13751
13760
|
case 3:
|
|
13752
13761
|
// Enqueue writes from a previous session
|
|
13753
|
-
return r.sent(), [ 4 /*yield*/ , Da(this.
|
|
13762
|
+
return r.sent(), [ 4 /*yield*/ , Da(this.Zo.syncEngine) ];
|
|
13754
13763
|
|
|
13755
13764
|
case 4:
|
|
13756
13765
|
// Enqueue writes from a previous session
|
|
13757
|
-
return r.sent(), [ 4 /*yield*/ , gs(this.
|
|
13766
|
+
return r.sent(), [ 4 /*yield*/ , gs(this.Zo.remoteStore) ];
|
|
13758
13767
|
|
|
13759
13768
|
case 5:
|
|
13760
13769
|
// NOTE: This will immediately call the listener, so we make sure to
|
|
@@ -13771,21 +13780,21 @@ var ka = /** @class */ function() {
|
|
|
13771
13780
|
}
|
|
13772
13781
|
}));
|
|
13773
13782
|
}));
|
|
13774
|
-
}, i.prototype.
|
|
13783
|
+
}, i.prototype.Xo = function(t) {
|
|
13775
13784
|
return so(this.persistence, new io, t.initialUser, this.N);
|
|
13776
|
-
}, i.prototype.
|
|
13785
|
+
}, i.prototype.Yo = function(t) {
|
|
13777
13786
|
var e = this.persistence.referenceDelegate.garbageCollector;
|
|
13778
13787
|
return new Mi(e, t.asyncQueue);
|
|
13779
|
-
}, i.prototype.
|
|
13788
|
+
}, i.prototype.Jo = function(t) {
|
|
13780
13789
|
var e = to(t.databaseInfo.databaseId, t.databaseInfo.persistenceKey), n = void 0 !== this.cacheSizeBytes ? Ii.withCacheSize(this.cacheSizeBytes) : Ii.DEFAULT;
|
|
13781
13790
|
return new Xi(this.synchronizeTabs, e, t.clientId, n, t.asyncQueue, Ho(), Wo(), this.N, this.sharedClientState, !!this.forceOwnership);
|
|
13782
|
-
}, i.prototype.
|
|
13791
|
+
}, i.prototype.Ho = function(t) {
|
|
13783
13792
|
return new Bo;
|
|
13784
13793
|
}, i;
|
|
13785
13794
|
}(ka), xa = /** @class */ function(e) {
|
|
13786
13795
|
function i(t, n) {
|
|
13787
13796
|
var r = this;
|
|
13788
|
-
return (r = e.call(this, t, n, /* forceOwnership= */ !1) || this).
|
|
13797
|
+
return (r = e.call(this, t, n, /* forceOwnership= */ !1) || this).Zo = t, r.cacheSizeBytes = n,
|
|
13789
13798
|
r.synchronizeTabs = !0, r;
|
|
13790
13799
|
}
|
|
13791
13800
|
return t(i, e), i.prototype.initialize = function(t) {
|
|
@@ -13797,7 +13806,7 @@ var ka = /** @class */ function() {
|
|
|
13797
13806
|
return [ 4 /*yield*/ , e.prototype.initialize.call(this, t) ];
|
|
13798
13807
|
|
|
13799
13808
|
case 1:
|
|
13800
|
-
return s.sent(), i = this.
|
|
13809
|
+
return s.sent(), i = this.Zo.syncEngine, this.sharedClientState instanceof Uo ? (this.sharedClientState.syncEngine = {
|
|
13801
13810
|
_i: wa.bind(null, i),
|
|
13802
13811
|
mi: Sa.bind(null, i),
|
|
13803
13812
|
gi: Na.bind(null, i),
|
|
@@ -13816,7 +13825,7 @@ var ka = /** @class */ function() {
|
|
|
13816
13825
|
return r(this, (function(e) {
|
|
13817
13826
|
switch (e.label) {
|
|
13818
13827
|
case 0:
|
|
13819
|
-
return [ 4 /*yield*/ , ba(this.
|
|
13828
|
+
return [ 4 /*yield*/ , ba(this.Zo.syncEngine, t) ];
|
|
13820
13829
|
|
|
13821
13830
|
case 1:
|
|
13822
13831
|
return e.sent(), this.gcScheduler && (t && !this.gcScheduler.started ? this.gcScheduler.start(this.localStore) : t || this.gcScheduler.stop()),
|
|
@@ -13833,7 +13842,7 @@ var ka = /** @class */ function() {
|
|
|
13833
13842
|
}
|
|
13834
13843
|
}));
|
|
13835
13844
|
}));
|
|
13836
|
-
}, i.prototype.
|
|
13845
|
+
}, i.prototype.Ho = function(t) {
|
|
13837
13846
|
var e = Ho();
|
|
13838
13847
|
if (!Uo.bt(e)) throw new W(H.UNIMPLEMENTED, "IndexedDB persistence is only available on platforms that support LocalStorage.");
|
|
13839
13848
|
var n = to(t.databaseInfo.databaseId, t.databaseInfo.persistenceKey);
|
|
@@ -13875,13 +13884,13 @@ var ka = /** @class */ function() {
|
|
|
13875
13884
|
var e, n, r, i, o, s = this;
|
|
13876
13885
|
return e = this.localStore, n = this.datastore, r = t.asyncQueue, i = function(t) {
|
|
13877
13886
|
return na(s.syncEngine, t, 0 /* RemoteStore */);
|
|
13878
|
-
}, o =
|
|
13887
|
+
}, o = Ko.bt() ? new Ko : new jo, new ns(e, n, r, i, o);
|
|
13879
13888
|
}, t.prototype.createSyncEngine = function(t, e) {
|
|
13880
13889
|
return function(t, e, n,
|
|
13881
13890
|
// PORTING NOTE: Manages state synchronization in multi-tab environments.
|
|
13882
13891
|
r, i, o, s) {
|
|
13883
13892
|
var a = new Js(t, e, n, r, i, o);
|
|
13884
|
-
return s && (a.
|
|
13893
|
+
return s && (a.Qo = !0), a;
|
|
13885
13894
|
}(this.localStore, this.remoteStore, this.eventManager, this.sharedClientState, t.initialUser, t.maxConcurrentLimboResolutions, e);
|
|
13886
13895
|
}, t.prototype.terminate = function() {
|
|
13887
13896
|
return function(t) {
|
|
@@ -13890,14 +13899,14 @@ var ka = /** @class */ function() {
|
|
|
13890
13899
|
return r(this, (function(n) {
|
|
13891
13900
|
switch (n.label) {
|
|
13892
13901
|
case 0:
|
|
13893
|
-
return e = Q(t), q("RemoteStore", "RemoteStore shutting down."), e.
|
|
13902
|
+
return e = Q(t), q("RemoteStore", "RemoteStore shutting down."), e.Wr.add(5 /* Shutdown */),
|
|
13894
13903
|
[ 4 /*yield*/ , is(e) ];
|
|
13895
13904
|
|
|
13896
13905
|
case 1:
|
|
13897
|
-
return n.sent(), e.
|
|
13906
|
+
return n.sent(), e.zr.shutdown(),
|
|
13898
13907
|
// Set the OnlineState to Unknown (rather than Offline) to avoid potentially
|
|
13899
13908
|
// triggering spurious listener events with cached data, etc.
|
|
13900
|
-
e.
|
|
13909
|
+
e.Hr.set("Unknown" /* Unknown */), [ 2 /*return*/ ];
|
|
13901
13910
|
}
|
|
13902
13911
|
}));
|
|
13903
13912
|
}));
|
|
@@ -14018,12 +14027,12 @@ function Ra(t, e) {
|
|
|
14018
14027
|
this.muted = !1;
|
|
14019
14028
|
}
|
|
14020
14029
|
return t.prototype.next = function(t) {
|
|
14021
|
-
this.observer.next && this.
|
|
14030
|
+
this.observer.next && this.ta(this.observer.next, t);
|
|
14022
14031
|
}, t.prototype.error = function(t) {
|
|
14023
|
-
this.observer.error ? this.
|
|
14024
|
-
}, t.prototype.
|
|
14032
|
+
this.observer.error ? this.ta(this.observer.error, t) : console.error("Uncaught Error in snapshot listener:", t);
|
|
14033
|
+
}, t.prototype.ea = function() {
|
|
14025
14034
|
this.muted = !0;
|
|
14026
|
-
}, t.prototype.
|
|
14035
|
+
}, t.prototype.ta = function(t, e) {
|
|
14027
14036
|
var n = this;
|
|
14028
14037
|
this.muted || setTimeout((function() {
|
|
14029
14038
|
n.muted || t(e);
|
|
@@ -14034,30 +14043,30 @@ function Ra(t, e) {
|
|
|
14034
14043
|
/** The reader to read from underlying binary bundle data source. */
|
|
14035
14044
|
t, e) {
|
|
14036
14045
|
var n = this;
|
|
14037
|
-
this.
|
|
14046
|
+
this.na = t, this.N = e,
|
|
14038
14047
|
/** Cached bundle metadata. */
|
|
14039
14048
|
this.metadata = new Y,
|
|
14040
14049
|
/**
|
|
14041
14050
|
* Internal buffer to hold bundle content, accumulating incomplete element
|
|
14042
14051
|
* content.
|
|
14043
14052
|
*/
|
|
14044
|
-
this.buffer = new Uint8Array, this.
|
|
14053
|
+
this.buffer = new Uint8Array, this.sa = new TextDecoder("utf-8"),
|
|
14045
14054
|
// Read the metadata (which is the first element).
|
|
14046
|
-
this.
|
|
14047
|
-
t && t.
|
|
14055
|
+
this.ia().then((function(t) {
|
|
14056
|
+
t && t.wo() ? n.metadata.resolve(t.payload.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.payload)));
|
|
14048
14057
|
}), (function(t) {
|
|
14049
14058
|
return n.metadata.reject(t);
|
|
14050
14059
|
}));
|
|
14051
14060
|
}
|
|
14052
14061
|
return t.prototype.close = function() {
|
|
14053
|
-
return this.
|
|
14062
|
+
return this.na.cancel();
|
|
14054
14063
|
}, t.prototype.getMetadata = function() {
|
|
14055
14064
|
return n(this, void 0, void 0, (function() {
|
|
14056
14065
|
return r(this, (function(t) {
|
|
14057
14066
|
return [ 2 /*return*/ , this.metadata.promise ];
|
|
14058
14067
|
}));
|
|
14059
14068
|
}));
|
|
14060
|
-
}, t.prototype.
|
|
14069
|
+
}, t.prototype.zo = function() {
|
|
14061
14070
|
return n(this, void 0, void 0, (function() {
|
|
14062
14071
|
return r(this, (function(t) {
|
|
14063
14072
|
switch (t.label) {
|
|
@@ -14066,7 +14075,7 @@ function Ra(t, e) {
|
|
|
14066
14075
|
|
|
14067
14076
|
case 1:
|
|
14068
14077
|
// Makes sure metadata is read before proceeding.
|
|
14069
|
-
return [ 2 /*return*/ , (t.sent(), this.
|
|
14078
|
+
return [ 2 /*return*/ , (t.sent(), this.ia()) ];
|
|
14070
14079
|
}
|
|
14071
14080
|
}));
|
|
14072
14081
|
}));
|
|
@@ -14081,18 +14090,18 @@ function Ra(t, e) {
|
|
|
14081
14090
|
* Returns either the bundled element, or null if we have reached the end of
|
|
14082
14091
|
* the stream.
|
|
14083
14092
|
*/
|
|
14084
|
-
t.prototype.
|
|
14093
|
+
t.prototype.ia = function() {
|
|
14085
14094
|
return n(this, void 0, void 0, (function() {
|
|
14086
14095
|
var t, e, n, i;
|
|
14087
14096
|
return r(this, (function(r) {
|
|
14088
14097
|
switch (r.label) {
|
|
14089
14098
|
case 0:
|
|
14090
|
-
return [ 4 /*yield*/ , this.
|
|
14099
|
+
return [ 4 /*yield*/ , this.ra() ];
|
|
14091
14100
|
|
|
14092
14101
|
case 1:
|
|
14093
|
-
return null === (t = r.sent()) ? [ 2 /*return*/ , null ] : (e = this.
|
|
14094
|
-
n = Number(e), isNaN(n) && this.
|
|
14095
|
-
[ 4 /*yield*/ , this.
|
|
14102
|
+
return null === (t = r.sent()) ? [ 2 /*return*/ , null ] : (e = this.sa.decode(t),
|
|
14103
|
+
n = Number(e), isNaN(n) && this.oa("length string (" + e + ") is not valid number"),
|
|
14104
|
+
[ 4 /*yield*/ , this.aa(n) ]);
|
|
14096
14105
|
|
|
14097
14106
|
case 2:
|
|
14098
14107
|
return i = r.sent(), [ 2 /*return*/ , new Bs(JSON.parse(i), t.length + n) ];
|
|
@@ -14100,7 +14109,7 @@ function Ra(t, e) {
|
|
|
14100
14109
|
}));
|
|
14101
14110
|
}));
|
|
14102
14111
|
},
|
|
14103
|
-
/** First index of '{' from the underlying buffer. */ t.prototype.
|
|
14112
|
+
/** First index of '{' from the underlying buffer. */ t.prototype.ca = function() {
|
|
14104
14113
|
return this.buffer.findIndex((function(t) {
|
|
14105
14114
|
return t === "{".charCodeAt(0);
|
|
14106
14115
|
}));
|
|
@@ -14111,13 +14120,13 @@ function Ra(t, e) {
|
|
|
14111
14120
|
*
|
|
14112
14121
|
* If reached end of the stream, returns a null.
|
|
14113
14122
|
*/
|
|
14114
|
-
t.prototype.
|
|
14123
|
+
t.prototype.ra = function() {
|
|
14115
14124
|
return n(this, void 0, void 0, (function() {
|
|
14116
14125
|
var t, e;
|
|
14117
14126
|
return r(this, (function(n) {
|
|
14118
14127
|
switch (n.label) {
|
|
14119
14128
|
case 0:
|
|
14120
|
-
return this.
|
|
14129
|
+
return this.ca() < 0 ? [ 4 /*yield*/ , this.ua() ] : [ 3 /*break*/ , 3 ];
|
|
14121
14130
|
|
|
14122
14131
|
case 1:
|
|
14123
14132
|
if (n.sent()) return [ 3 /*break*/ , 3 ];
|
|
@@ -14132,7 +14141,7 @@ function Ra(t, e) {
|
|
|
14132
14141
|
return 0 === this.buffer.length ? [ 2 /*return*/ , null ] : (
|
|
14133
14142
|
// Broke out of the loop because underlying stream is closed, but still
|
|
14134
14143
|
// cannot find an open bracket.
|
|
14135
|
-
(t = this.
|
|
14144
|
+
(t = this.ca()) < 0 && this.oa("Reached the end of bundle when a length string is expected."),
|
|
14136
14145
|
e = this.buffer.slice(0, t), [ 2 /*return*/ , (this.buffer = this.buffer.slice(t),
|
|
14137
14146
|
e) ]);
|
|
14138
14147
|
}
|
|
@@ -14145,42 +14154,42 @@ function Ra(t, e) {
|
|
|
14145
14154
|
*
|
|
14146
14155
|
* Returns a string decoded from the read bytes.
|
|
14147
14156
|
*/
|
|
14148
|
-
t.prototype.
|
|
14157
|
+
t.prototype.aa = function(t) {
|
|
14149
14158
|
return n(this, void 0, void 0, (function() {
|
|
14150
14159
|
var e;
|
|
14151
14160
|
return r(this, (function(n) {
|
|
14152
14161
|
switch (n.label) {
|
|
14153
14162
|
case 0:
|
|
14154
|
-
return this.buffer.length < t ? [ 4 /*yield*/ , this.
|
|
14163
|
+
return this.buffer.length < t ? [ 4 /*yield*/ , this.ua() ] : [ 3 /*break*/ , 3 ];
|
|
14155
14164
|
|
|
14156
14165
|
case 1:
|
|
14157
|
-
n.sent() && this.
|
|
14166
|
+
n.sent() && this.oa("Reached the end of bundle when more is expected."), n.label = 2;
|
|
14158
14167
|
|
|
14159
14168
|
case 2:
|
|
14160
14169
|
return [ 3 /*break*/ , 0 ];
|
|
14161
14170
|
|
|
14162
14171
|
case 3:
|
|
14163
14172
|
// Update the internal buffer to drop the read json string.
|
|
14164
|
-
return e = this.
|
|
14173
|
+
return e = this.sa.decode(this.buffer.slice(0, t)), [ 2 /*return*/ , (this.buffer = this.buffer.slice(t),
|
|
14165
14174
|
e) ];
|
|
14166
14175
|
}
|
|
14167
14176
|
}));
|
|
14168
14177
|
}));
|
|
14169
|
-
}, t.prototype.
|
|
14178
|
+
}, t.prototype.oa = function(t) {
|
|
14170
14179
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
14171
|
-
throw this.
|
|
14180
|
+
throw this.na.cancel(), new Error("Invalid bundle format: " + t);
|
|
14172
14181
|
},
|
|
14173
14182
|
/**
|
|
14174
14183
|
* Pulls more data from underlying stream to internal buffer.
|
|
14175
14184
|
* Returns a boolean indicating whether the stream is finished.
|
|
14176
14185
|
*/
|
|
14177
|
-
t.prototype.
|
|
14186
|
+
t.prototype.ua = function() {
|
|
14178
14187
|
return n(this, void 0, void 0, (function() {
|
|
14179
14188
|
var t, e;
|
|
14180
14189
|
return r(this, (function(n) {
|
|
14181
14190
|
switch (n.label) {
|
|
14182
14191
|
case 0:
|
|
14183
|
-
return [ 4 /*yield*/ , this.
|
|
14192
|
+
return [ 4 /*yield*/ , this.na.read() ];
|
|
14184
14193
|
|
|
14185
14194
|
case 1:
|
|
14186
14195
|
return (t = n.sent()).done || ((e = new Uint8Array(this.buffer.length + t.value.length)).set(this.buffer),
|
|
@@ -14220,7 +14229,7 @@ function Ra(t, e) {
|
|
|
14220
14229
|
return r(this, (function(r) {
|
|
14221
14230
|
switch (r.label) {
|
|
14222
14231
|
case 0:
|
|
14223
|
-
return n = Q(t), i =
|
|
14232
|
+
return n = Q(t), i = Zn(n.N) + "/documents", o = {
|
|
14224
14233
|
documents: e.map((function(t) {
|
|
14225
14234
|
return Wn(n.N, t);
|
|
14226
14235
|
}))
|
|
@@ -14241,7 +14250,7 @@ function Ra(t, e) {
|
|
|
14241
14250
|
z(!!e.missing), z(!!e.readTime);
|
|
14242
14251
|
var n = Yn(t, e.missing), r = Gn(e.readTime);
|
|
14243
14252
|
return Ht.newNoDocument(n, r);
|
|
14244
|
-
}(t, e) :
|
|
14253
|
+
}(t, e) : K();
|
|
14245
14254
|
}(n.N, t);
|
|
14246
14255
|
a.set(e.key.toString(), e);
|
|
14247
14256
|
})), u = [], [ 2 /*return*/ , (e.forEach((function(t) {
|
|
@@ -14294,7 +14303,7 @@ function Ra(t, e) {
|
|
|
14294
14303
|
return r(this, (function(r) {
|
|
14295
14304
|
switch (r.label) {
|
|
14296
14305
|
case 0:
|
|
14297
|
-
return n = Q(t), i =
|
|
14306
|
+
return n = Q(t), i = Zn(n.N) + "/documents", o = {
|
|
14298
14307
|
writes: e.map((function(t) {
|
|
14299
14308
|
return nr(n.N, t);
|
|
14300
14309
|
}))
|
|
@@ -14316,7 +14325,7 @@ function Ra(t, e) {
|
|
|
14316
14325
|
}, t.prototype.recordVersion = function(t) {
|
|
14317
14326
|
var e;
|
|
14318
14327
|
if (t.isFoundDocument()) e = t.version; else {
|
|
14319
|
-
if (!t.isNoDocument()) throw
|
|
14328
|
+
if (!t.isNoDocument()) throw K();
|
|
14320
14329
|
// For deleted docs, we must use baseVersion 0 when we overwrite them.
|
|
14321
14330
|
e = ct.min();
|
|
14322
14331
|
}
|
|
@@ -14366,32 +14375,32 @@ function Ra(t, e) {
|
|
|
14366
14375
|
}(), Ma = /** @class */ function() {
|
|
14367
14376
|
function t(t, e, n, r) {
|
|
14368
14377
|
this.asyncQueue = t, this.datastore = e, this.updateFunction = n, this.deferred = r,
|
|
14369
|
-
this.
|
|
14378
|
+
this.ha = 5, this.cr = new Jo(this.asyncQueue, "transaction_retry" /* TransactionRetry */)
|
|
14370
14379
|
/** Runs the transaction and sets the result on deferred. */;
|
|
14371
14380
|
}
|
|
14372
14381
|
return t.prototype.run = function() {
|
|
14373
|
-
this.
|
|
14374
|
-
}, t.prototype.
|
|
14382
|
+
this.ha -= 1, this.la();
|
|
14383
|
+
}, t.prototype.la = function() {
|
|
14375
14384
|
var t = this;
|
|
14376
|
-
this.
|
|
14385
|
+
this.cr.Xi((function() {
|
|
14377
14386
|
return n(t, void 0, void 0, (function() {
|
|
14378
14387
|
var t, e, n = this;
|
|
14379
14388
|
return r(this, (function(r) {
|
|
14380
|
-
return t = new Fa(this.datastore), (e = this.
|
|
14389
|
+
return t = new Fa(this.datastore), (e = this.fa(t)) && e.then((function(e) {
|
|
14381
14390
|
n.asyncQueue.enqueueAndForget((function() {
|
|
14382
14391
|
return t.commit().then((function() {
|
|
14383
14392
|
n.deferred.resolve(e);
|
|
14384
14393
|
})).catch((function(t) {
|
|
14385
|
-
n.
|
|
14394
|
+
n.da(t);
|
|
14386
14395
|
}));
|
|
14387
14396
|
}));
|
|
14388
14397
|
})).catch((function(t) {
|
|
14389
|
-
n.
|
|
14398
|
+
n.da(t);
|
|
14390
14399
|
})), [ 2 /*return*/ ];
|
|
14391
14400
|
}));
|
|
14392
14401
|
}));
|
|
14393
14402
|
}));
|
|
14394
|
-
}, t.prototype.
|
|
14403
|
+
}, t.prototype.fa = function(t) {
|
|
14395
14404
|
try {
|
|
14396
14405
|
var e = this.updateFunction(t);
|
|
14397
14406
|
return !Dt(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
|
|
@@ -14400,12 +14409,12 @@ function Ra(t, e) {
|
|
|
14400
14409
|
// Do not retry errors thrown by user provided updateFunction.
|
|
14401
14410
|
return this.deferred.reject(t), null;
|
|
14402
14411
|
}
|
|
14403
|
-
}, t.prototype.
|
|
14412
|
+
}, t.prototype.da = function(t) {
|
|
14404
14413
|
var e = this;
|
|
14405
|
-
this.
|
|
14406
|
-
return e.
|
|
14414
|
+
this.ha > 0 && this.wa(t) ? (this.ha -= 1, this.asyncQueue.enqueueAndForget((function() {
|
|
14415
|
+
return e.la(), Promise.resolve();
|
|
14407
14416
|
}))) : this.deferred.reject(t);
|
|
14408
|
-
}, t.prototype.
|
|
14417
|
+
}, t.prototype.wa = function(t) {
|
|
14409
14418
|
if ("FirebaseError" === t.name) {
|
|
14410
14419
|
// In transactions, the backend will fail outdated reads with FAILED_PRECONDITION and
|
|
14411
14420
|
// non-matching document versions with ABORTED. These errors should be retried.
|
|
@@ -14595,15 +14604,15 @@ function Ua(t, e) {
|
|
|
14595
14604
|
// Tear down and re-create our network streams. This will ensure we get a
|
|
14596
14605
|
// fresh auth token for the new user and re-fill the write pipeline with
|
|
14597
14606
|
// new mutations from the LocalStore (since mutations are per-user).
|
|
14598
|
-
n.
|
|
14607
|
+
n.Wr.add(3 /* CredentialChange */), [ 4 /*yield*/ , is(n) ];
|
|
14599
14608
|
|
|
14600
14609
|
case 1:
|
|
14601
14610
|
return r.sent(), i &&
|
|
14602
14611
|
// Don't set the network status to Unknown if we are offline.
|
|
14603
|
-
n.
|
|
14612
|
+
n.Hr.set("Unknown" /* Unknown */), [ 4 /*yield*/ , n.remoteSyncer.handleCredentialChange(e) ];
|
|
14604
14613
|
|
|
14605
14614
|
case 2:
|
|
14606
|
-
return r.sent(), n.
|
|
14615
|
+
return r.sent(), n.Wr.delete(3 /* CredentialChange */), [ 4 /*yield*/ , rs(n) ];
|
|
14607
14616
|
|
|
14608
14617
|
case 3:
|
|
14609
14618
|
// Tear down and re-create our network streams. This will ensure we get a
|
|
@@ -14638,7 +14647,7 @@ function Ba(t) {
|
|
|
14638
14647
|
}));
|
|
14639
14648
|
}
|
|
14640
14649
|
|
|
14641
|
-
function
|
|
14650
|
+
function ja(t) {
|
|
14642
14651
|
return n(this, void 0, void 0, (function() {
|
|
14643
14652
|
return r(this, (function(e) {
|
|
14644
14653
|
switch (e.label) {
|
|
@@ -14656,7 +14665,7 @@ function Ka(t) {
|
|
|
14656
14665
|
}));
|
|
14657
14666
|
}
|
|
14658
14667
|
|
|
14659
|
-
function
|
|
14668
|
+
function Ka(t) {
|
|
14660
14669
|
return Ba(t).then((function(t) {
|
|
14661
14670
|
return t.persistence;
|
|
14662
14671
|
}));
|
|
@@ -14669,13 +14678,13 @@ function za(t) {
|
|
|
14669
14678
|
}
|
|
14670
14679
|
|
|
14671
14680
|
function Ga(t) {
|
|
14672
|
-
return
|
|
14681
|
+
return ja(t).then((function(t) {
|
|
14673
14682
|
return t.remoteStore;
|
|
14674
14683
|
}));
|
|
14675
14684
|
}
|
|
14676
14685
|
|
|
14677
14686
|
function Qa(t) {
|
|
14678
|
-
return
|
|
14687
|
+
return ja(t).then((function(t) {
|
|
14679
14688
|
return t.syncEngine;
|
|
14680
14689
|
}));
|
|
14681
14690
|
}
|
|
@@ -14686,11 +14695,11 @@ function Ha(t) {
|
|
|
14686
14695
|
return r(this, (function(r) {
|
|
14687
14696
|
switch (r.label) {
|
|
14688
14697
|
case 0:
|
|
14689
|
-
return [ 4 /*yield*/ ,
|
|
14698
|
+
return [ 4 /*yield*/ , ja(t) ];
|
|
14690
14699
|
|
|
14691
14700
|
case 1:
|
|
14692
14701
|
return e = r.sent(), [ 2 /*return*/ , ((n = e.eventManager).onListen = Xs.bind(null, e.syncEngine),
|
|
14693
|
-
n.onUnlisten =
|
|
14702
|
+
n.onUnlisten = $s.bind(null, e.syncEngine), n) ];
|
|
14694
14703
|
}
|
|
14695
14704
|
}));
|
|
14696
14705
|
}));
|
|
@@ -14730,7 +14739,7 @@ function Ha(t) {
|
|
|
14730
14739
|
}
|
|
14731
14740
|
}), s = new Us(ve(n.path), o, {
|
|
14732
14741
|
includeMetadataChanges: !0,
|
|
14733
|
-
|
|
14742
|
+
fo: !0
|
|
14734
14743
|
});
|
|
14735
14744
|
return Ps(t, s);
|
|
14736
14745
|
}, [ 4 /*yield*/ , Ha(t) ];
|
|
@@ -14767,7 +14776,7 @@ function Ya(t, e, i) {
|
|
|
14767
14776
|
}
|
|
14768
14777
|
}), s = new Us(n, o, {
|
|
14769
14778
|
includeMetadataChanges: !0,
|
|
14770
|
-
|
|
14779
|
+
fo: !0
|
|
14771
14780
|
});
|
|
14772
14781
|
return Ps(t, s);
|
|
14773
14782
|
}, [ 4 /*yield*/ , Ha(t) ];
|
|
@@ -14814,7 +14823,7 @@ function(t, e, n, r, i, o, s, a) {
|
|
|
14814
14823
|
}), t.prototype.isEqual = function(e) {
|
|
14815
14824
|
return e instanceof t && e.projectId === this.projectId && e.database === this.database;
|
|
14816
14825
|
}, t;
|
|
14817
|
-
}(),
|
|
14826
|
+
}(), Za = new Map;
|
|
14818
14827
|
|
|
14819
14828
|
/** The default database name for a project. */
|
|
14820
14829
|
/**
|
|
@@ -14841,7 +14850,7 @@ function(t, e, n, r, i, o, s, a) {
|
|
|
14841
14850
|
* See the License for the specific language governing permissions and
|
|
14842
14851
|
* limitations under the License.
|
|
14843
14852
|
*/
|
|
14844
|
-
function
|
|
14853
|
+
function $a(t, e, n) {
|
|
14845
14854
|
if (!n) throw new W(H.INVALID_ARGUMENT, "Function " + t + "() cannot be called with an empty " + e + ".");
|
|
14846
14855
|
}
|
|
14847
14856
|
|
|
@@ -14885,7 +14894,7 @@ function Za(t, e, n) {
|
|
|
14885
14894
|
}(t);
|
|
14886
14895
|
return e ? "a custom " + e + " object" : "an object";
|
|
14887
14896
|
}
|
|
14888
|
-
return "function" == typeof t ? "a function" :
|
|
14897
|
+
return "function" == typeof t ? "a function" : K();
|
|
14889
14898
|
}
|
|
14890
14899
|
|
|
14891
14900
|
function iu(t,
|
|
@@ -15026,8 +15035,8 @@ function ou(t, e) {
|
|
|
15026
15035
|
* Removes all components associated with the provided instance. Must be called
|
|
15027
15036
|
* when the `Firestore` instance is terminated.
|
|
15028
15037
|
*/
|
|
15029
|
-
return t = this, (e =
|
|
15030
|
-
|
|
15038
|
+
return t = this, (e = Za.get(t)) && (q("ComponentProvider", "Removing Datastore"),
|
|
15039
|
+
Za.delete(t), e.terminate()), Promise.resolve();
|
|
15031
15040
|
var t, e;
|
|
15032
15041
|
}, t;
|
|
15033
15042
|
}();
|
|
@@ -15070,7 +15079,7 @@ function ou(t, e) {
|
|
|
15070
15079
|
if (!u) throw new W(H.INVALID_ARGUMENT, "mockUserToken must contain 'sub' or 'user_id' field!");
|
|
15071
15080
|
a = new O(u);
|
|
15072
15081
|
}
|
|
15073
|
-
t._credentials = new
|
|
15082
|
+
t._credentials = new Z(new J(s, a));
|
|
15074
15083
|
}
|
|
15075
15084
|
}
|
|
15076
15085
|
|
|
@@ -15203,7 +15212,7 @@ function ou(t, e) {
|
|
|
15203
15212
|
* construct refined `Query` objects by adding filters and ordering.
|
|
15204
15213
|
*/ function lu(t, n) {
|
|
15205
15214
|
for (var r = [], i = 2; i < arguments.length; i++) r[i - 2] = arguments[i];
|
|
15206
|
-
if (t = b(t),
|
|
15215
|
+
if (t = b(t), $a("collection", "path", n), t instanceof au) {
|
|
15207
15216
|
var o = pt.fromString.apply(pt, e([ n ], r));
|
|
15208
15217
|
return nu(o), new fu(t, /* converter= */ null, o);
|
|
15209
15218
|
}
|
|
@@ -15226,7 +15235,7 @@ function ou(t, e) {
|
|
|
15226
15235
|
* will be included. Cannot contain a slash.
|
|
15227
15236
|
* @returns The created `Query`.
|
|
15228
15237
|
*/ function du(t, e) {
|
|
15229
|
-
if (t = iu(t, au),
|
|
15238
|
+
if (t = iu(t, au), $a("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new W(H.INVALID_ARGUMENT, "Invalid collection ID '" + e + "' passed to function collectionGroup(). Collection IDs must not contain '/'.");
|
|
15230
15239
|
return new hu(t,
|
|
15231
15240
|
/* converter= */ null,
|
|
15232
15241
|
/**
|
|
@@ -15243,7 +15252,7 @@ function pu(t, n) {
|
|
|
15243
15252
|
if (t = b(t),
|
|
15244
15253
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
15245
15254
|
// 'undefined' and 'null'.
|
|
15246
|
-
1 === arguments.length && (n = it.I()),
|
|
15255
|
+
1 === arguments.length && (n = it.I()), $a("doc", "path", n), t instanceof au) {
|
|
15247
15256
|
var o = pt.fromString.apply(pt, e([ n ], r));
|
|
15248
15257
|
return eu(o), new cu(t,
|
|
15249
15258
|
/* converter= */ null, new Ct(o));
|
|
@@ -15297,40 +15306,40 @@ var mu = /** @class */ function() {
|
|
|
15297
15306
|
function t() {
|
|
15298
15307
|
var t = this;
|
|
15299
15308
|
// The last promise in the queue.
|
|
15300
|
-
this.
|
|
15309
|
+
this._a = Promise.resolve(),
|
|
15301
15310
|
// A list of retryable operations. Retryable operations are run in order and
|
|
15302
15311
|
// retried with backoff.
|
|
15303
|
-
this.
|
|
15312
|
+
this.ma = [],
|
|
15304
15313
|
// Is this AsyncQueue being shut down? Once it is set to true, it will not
|
|
15305
15314
|
// be changed again.
|
|
15306
|
-
this.
|
|
15315
|
+
this.ga = !1,
|
|
15307
15316
|
// Operations scheduled to be queued in the future. Operations are
|
|
15308
15317
|
// automatically removed after they are run or canceled.
|
|
15309
|
-
this.
|
|
15318
|
+
this.ya = [],
|
|
15310
15319
|
// visible for testing
|
|
15311
|
-
this.
|
|
15320
|
+
this.pa = null,
|
|
15312
15321
|
// Flag set while there's an outstanding AsyncQueue operation, used for
|
|
15313
15322
|
// assertion sanity-checks.
|
|
15314
|
-
this.
|
|
15323
|
+
this.Ta = !1,
|
|
15315
15324
|
// Enabled during shutdown on Safari to prevent future access to IndexedDB.
|
|
15316
|
-
this.
|
|
15325
|
+
this.Ea = !1,
|
|
15317
15326
|
// List of TimerIds to fast-forward delays for.
|
|
15318
|
-
this.
|
|
15327
|
+
this.Ia = [],
|
|
15319
15328
|
// Backoff timer used to schedule retries for retryable operations
|
|
15320
|
-
this.
|
|
15329
|
+
this.cr = new Jo(this, "async_queue_retry" /* AsyncQueueRetry */),
|
|
15321
15330
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
15322
15331
|
// operations. Meant to speed up recovery when we regain file system access
|
|
15323
15332
|
// after page comes into foreground.
|
|
15324
|
-
this.
|
|
15333
|
+
this.Aa = function() {
|
|
15325
15334
|
var e = Wo();
|
|
15326
|
-
e && q("AsyncQueue", "Visibility state changed to " + e.visibilityState), t.
|
|
15335
|
+
e && q("AsyncQueue", "Visibility state changed to " + e.visibilityState), t.cr.tr();
|
|
15327
15336
|
};
|
|
15328
15337
|
var e = Wo();
|
|
15329
|
-
e && "function" == typeof e.addEventListener && e.addEventListener("visibilitychange", this.
|
|
15338
|
+
e && "function" == typeof e.addEventListener && e.addEventListener("visibilitychange", this.Aa);
|
|
15330
15339
|
}
|
|
15331
15340
|
return Object.defineProperty(t.prototype, "isShuttingDown", {
|
|
15332
15341
|
get: function() {
|
|
15333
|
-
return this.
|
|
15342
|
+
return this.ga;
|
|
15334
15343
|
},
|
|
15335
15344
|
enumerable: !1,
|
|
15336
15345
|
configurable: !0
|
|
@@ -15343,53 +15352,53 @@ var mu = /** @class */ function() {
|
|
|
15343
15352
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
15344
15353
|
this.enqueue(t);
|
|
15345
15354
|
}, t.prototype.enqueueAndForgetEvenWhileRestricted = function(t) {
|
|
15346
|
-
this.
|
|
15355
|
+
this.Ra(),
|
|
15347
15356
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
15348
|
-
this.
|
|
15357
|
+
this.ba(t);
|
|
15349
15358
|
}, t.prototype.enterRestrictedMode = function(t) {
|
|
15350
|
-
if (!this.
|
|
15351
|
-
this.
|
|
15359
|
+
if (!this.ga) {
|
|
15360
|
+
this.ga = !0, this.Ea = t || !1;
|
|
15352
15361
|
var e = Wo();
|
|
15353
|
-
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.
|
|
15362
|
+
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Aa);
|
|
15354
15363
|
}
|
|
15355
15364
|
}, t.prototype.enqueue = function(t) {
|
|
15356
15365
|
var e = this;
|
|
15357
|
-
if (this.
|
|
15366
|
+
if (this.Ra(), this.ga)
|
|
15358
15367
|
// Return a Promise which never resolves.
|
|
15359
15368
|
return new Promise((function() {}));
|
|
15360
15369
|
// Create a deferred Promise that we can return to the callee. This
|
|
15361
15370
|
// allows us to return a "hanging Promise" only to the callee and still
|
|
15362
15371
|
// advance the queue even when the operation is not run.
|
|
15363
15372
|
var n = new Y;
|
|
15364
|
-
return this.
|
|
15365
|
-
return e.
|
|
15373
|
+
return this.ba((function() {
|
|
15374
|
+
return e.ga && e.Ea ? Promise.resolve() : (t().then(n.resolve, n.reject), n.promise);
|
|
15366
15375
|
})).then((function() {
|
|
15367
15376
|
return n.promise;
|
|
15368
15377
|
}));
|
|
15369
15378
|
}, t.prototype.enqueueRetryable = function(t) {
|
|
15370
15379
|
var e = this;
|
|
15371
15380
|
this.enqueueAndForget((function() {
|
|
15372
|
-
return e.
|
|
15381
|
+
return e.ma.push(t), e.Pa();
|
|
15373
15382
|
}));
|
|
15374
15383
|
},
|
|
15375
15384
|
/**
|
|
15376
15385
|
* Runs the next operation from the retryable queue. If the operation fails,
|
|
15377
15386
|
* reschedules with backoff.
|
|
15378
15387
|
*/
|
|
15379
|
-
t.prototype.
|
|
15388
|
+
t.prototype.Pa = function() {
|
|
15380
15389
|
return n(this, void 0, void 0, (function() {
|
|
15381
15390
|
var t, e = this;
|
|
15382
15391
|
return r(this, (function(n) {
|
|
15383
15392
|
switch (n.label) {
|
|
15384
15393
|
case 0:
|
|
15385
|
-
if (0 === this.
|
|
15394
|
+
if (0 === this.ma.length) return [ 3 /*break*/ , 5 ];
|
|
15386
15395
|
n.label = 1;
|
|
15387
15396
|
|
|
15388
15397
|
case 1:
|
|
15389
|
-
return n.trys.push([ 1, 3, , 4 ]), [ 4 /*yield*/ , this.
|
|
15398
|
+
return n.trys.push([ 1, 3, , 4 ]), [ 4 /*yield*/ , this.ma[0]() ];
|
|
15390
15399
|
|
|
15391
15400
|
case 2:
|
|
15392
|
-
return n.sent(), this.
|
|
15401
|
+
return n.sent(), this.ma.shift(), this.cr.reset(), [ 3 /*break*/ , 4 ];
|
|
15393
15402
|
|
|
15394
15403
|
case 3:
|
|
15395
15404
|
if (!Qr(t = n.sent())) throw t;
|
|
@@ -15398,7 +15407,7 @@ var mu = /** @class */ function() {
|
|
|
15398
15407
|
[ 3 /*break*/ , 4 ];
|
|
15399
15408
|
|
|
15400
15409
|
case 4:
|
|
15401
|
-
this.
|
|
15410
|
+
this.ma.length > 0 &&
|
|
15402
15411
|
// If there are additional operations, we re-schedule `retryNextOp()`.
|
|
15403
15412
|
// This is necessary to run retryable operations that failed during
|
|
15404
15413
|
// their initial attempt since we don't know whether they are already
|
|
@@ -15409,8 +15418,8 @@ var mu = /** @class */ function() {
|
|
|
15409
15418
|
// Since `backoffAndRun()` cancels an existing backoff and schedules a
|
|
15410
15419
|
// new backoff on every call, there is only ever a single additional
|
|
15411
15420
|
// operation in the queue.
|
|
15412
|
-
this.
|
|
15413
|
-
return e.
|
|
15421
|
+
this.cr.Xi((function() {
|
|
15422
|
+
return e.Pa();
|
|
15414
15423
|
})), n.label = 5;
|
|
15415
15424
|
|
|
15416
15425
|
case 5:
|
|
@@ -15418,10 +15427,10 @@ var mu = /** @class */ function() {
|
|
|
15418
15427
|
}
|
|
15419
15428
|
}));
|
|
15420
15429
|
}));
|
|
15421
|
-
}, t.prototype.
|
|
15422
|
-
var e = this, n = this.
|
|
15423
|
-
return e.
|
|
15424
|
-
e.
|
|
15430
|
+
}, t.prototype.ba = function(t) {
|
|
15431
|
+
var e = this, n = this._a.then((function() {
|
|
15432
|
+
return e.Ta = !0, t().catch((function(t) {
|
|
15433
|
+
e.pa = t, e.Ta = !1;
|
|
15425
15434
|
var n =
|
|
15426
15435
|
/**
|
|
15427
15436
|
* Chrome includes Error.message in Error.stack. Other browsers do not.
|
|
@@ -15438,39 +15447,39 @@ var mu = /** @class */ function() {
|
|
|
15438
15447
|
// and return the rejected Promise.
|
|
15439
15448
|
throw U("INTERNAL UNHANDLED ERROR: ", n), t;
|
|
15440
15449
|
})).then((function(t) {
|
|
15441
|
-
return e.
|
|
15450
|
+
return e.Ta = !1, t;
|
|
15442
15451
|
}));
|
|
15443
15452
|
}));
|
|
15444
|
-
return this.
|
|
15453
|
+
return this._a = n, n;
|
|
15445
15454
|
}, t.prototype.enqueueAfterDelay = function(t, e, n) {
|
|
15446
15455
|
var r = this;
|
|
15447
|
-
this.
|
|
15456
|
+
this.Ra(),
|
|
15448
15457
|
// Fast-forward delays for timerIds that have been overriden.
|
|
15449
|
-
this.
|
|
15458
|
+
this.Ia.indexOf(t) > -1 && (e = 0);
|
|
15450
15459
|
var i = As.createAndSchedule(this, t, e, n, (function(t) {
|
|
15451
|
-
return r.
|
|
15460
|
+
return r.va(t);
|
|
15452
15461
|
}));
|
|
15453
|
-
return this.
|
|
15454
|
-
}, t.prototype.
|
|
15455
|
-
this.
|
|
15462
|
+
return this.ya.push(i), i;
|
|
15463
|
+
}, t.prototype.Ra = function() {
|
|
15464
|
+
this.pa && K();
|
|
15456
15465
|
}, t.prototype.verifyOperationInProgress = function() {},
|
|
15457
15466
|
/**
|
|
15458
15467
|
* Waits until all currently queued tasks are finished executing. Delayed
|
|
15459
15468
|
* operations are not run.
|
|
15460
15469
|
*/
|
|
15461
|
-
t.prototype.
|
|
15470
|
+
t.prototype.Va = function() {
|
|
15462
15471
|
return n(this, void 0, void 0, (function() {
|
|
15463
15472
|
var t;
|
|
15464
15473
|
return r(this, (function(e) {
|
|
15465
15474
|
switch (e.label) {
|
|
15466
15475
|
case 0:
|
|
15467
|
-
return [ 4 /*yield*/ , t = this.
|
|
15476
|
+
return [ 4 /*yield*/ , t = this._a ];
|
|
15468
15477
|
|
|
15469
15478
|
case 1:
|
|
15470
15479
|
e.sent(), e.label = 2;
|
|
15471
15480
|
|
|
15472
15481
|
case 2:
|
|
15473
|
-
if (t !== this.
|
|
15482
|
+
if (t !== this._a) return [ 3 /*break*/ , 0 ];
|
|
15474
15483
|
e.label = 3;
|
|
15475
15484
|
|
|
15476
15485
|
case 3:
|
|
@@ -15483,8 +15492,8 @@ var mu = /** @class */ function() {
|
|
|
15483
15492
|
* For Tests: Determine if a delayed operation with a particular TimerId
|
|
15484
15493
|
* exists.
|
|
15485
15494
|
*/
|
|
15486
|
-
t.prototype.
|
|
15487
|
-
for (var e = 0, n = this.
|
|
15495
|
+
t.prototype.Sa = function(t) {
|
|
15496
|
+
for (var e = 0, n = this.ya; e < n.length; e++) {
|
|
15488
15497
|
if (n[e].timerId === t) return !0;
|
|
15489
15498
|
}
|
|
15490
15499
|
return !1;
|
|
@@ -15496,31 +15505,31 @@ var mu = /** @class */ function() {
|
|
|
15496
15505
|
* will be drained. Pass TimerId.All to run all delayed operations.
|
|
15497
15506
|
* @returns a Promise that resolves once all operations have been run.
|
|
15498
15507
|
*/
|
|
15499
|
-
t.prototype.
|
|
15508
|
+
t.prototype.Da = function(t) {
|
|
15500
15509
|
var e = this;
|
|
15501
15510
|
// Note that draining may generate more delayed ops, so we do that first.
|
|
15502
|
-
return this.
|
|
15511
|
+
return this.Va().then((function() {
|
|
15503
15512
|
// Run ops in the same order they'd run if they ran naturally.
|
|
15504
|
-
e.
|
|
15513
|
+
e.ya.sort((function(t, e) {
|
|
15505
15514
|
return t.targetTimeMs - e.targetTimeMs;
|
|
15506
15515
|
}));
|
|
15507
|
-
for (var n = 0, r = e.
|
|
15516
|
+
for (var n = 0, r = e.ya; n < r.length; n++) {
|
|
15508
15517
|
var i = r[n];
|
|
15509
15518
|
if (i.skipDelay(), "all" /* All */ !== t && i.timerId === t) break;
|
|
15510
15519
|
}
|
|
15511
|
-
return e.
|
|
15520
|
+
return e.Va();
|
|
15512
15521
|
}));
|
|
15513
15522
|
},
|
|
15514
15523
|
/**
|
|
15515
15524
|
* For Tests: Skip all subsequent delays for a timer id.
|
|
15516
15525
|
*/
|
|
15517
|
-
t.prototype.
|
|
15518
|
-
this.
|
|
15526
|
+
t.prototype.Ca = function(t) {
|
|
15527
|
+
this.Ia.push(t);
|
|
15519
15528
|
},
|
|
15520
|
-
/** Called once a DelayedOperation is run or canceled. */ t.prototype.
|
|
15529
|
+
/** Called once a DelayedOperation is run or canceled. */ t.prototype.va = function(t) {
|
|
15521
15530
|
// NOTE: indexOf / slice are O(n), but delayedOperations is expected to be small.
|
|
15522
|
-
var e = this.
|
|
15523
|
-
this.
|
|
15531
|
+
var e = this.ya.indexOf(t);
|
|
15532
|
+
this.ya.splice(e, 1);
|
|
15524
15533
|
}, t;
|
|
15525
15534
|
}();
|
|
15526
15535
|
|
|
@@ -15812,7 +15821,7 @@ function ku(t) {
|
|
|
15812
15821
|
return r(this, (function(n) {
|
|
15813
15822
|
switch (n.label) {
|
|
15814
15823
|
case 0:
|
|
15815
|
-
return
|
|
15824
|
+
return Kr.bt() ? (e = t + "main", [ 4 /*yield*/ , Kr.delete(e) ]) : [ 2 /*return*/ , Promise.resolve() ];
|
|
15816
15825
|
|
|
15817
15826
|
case 1:
|
|
15818
15827
|
return n.sent(), [ 2 /*return*/ ];
|
|
@@ -15885,7 +15894,7 @@ function Cu(t) {
|
|
|
15885
15894
|
return r(this, (function(r) {
|
|
15886
15895
|
switch (r.label) {
|
|
15887
15896
|
case 0:
|
|
15888
|
-
return [ 4 /*yield*/ ,
|
|
15897
|
+
return [ 4 /*yield*/ , Ka(t) ];
|
|
15889
15898
|
|
|
15890
15899
|
case 1:
|
|
15891
15900
|
return e = r.sent(), [ 4 /*yield*/ , Ga(t) ];
|
|
@@ -15893,7 +15902,7 @@ function Cu(t) {
|
|
|
15893
15902
|
case 2:
|
|
15894
15903
|
return n = r.sent(), [ 2 /*return*/ , (e.setNetworkEnabled(!0), function(t) {
|
|
15895
15904
|
var e = Q(t);
|
|
15896
|
-
return e.
|
|
15905
|
+
return e.Wr.delete(0 /* UserDisabled */), rs(e);
|
|
15897
15906
|
}(n)) ];
|
|
15898
15907
|
}
|
|
15899
15908
|
}));
|
|
@@ -15919,7 +15928,7 @@ function Cu(t) {
|
|
|
15919
15928
|
return r(this, (function(o) {
|
|
15920
15929
|
switch (o.label) {
|
|
15921
15930
|
case 0:
|
|
15922
|
-
return [ 4 /*yield*/ ,
|
|
15931
|
+
return [ 4 /*yield*/ , Ka(t) ];
|
|
15923
15932
|
|
|
15924
15933
|
case 1:
|
|
15925
15934
|
return e = o.sent(), [ 4 /*yield*/ , Ga(t) ];
|
|
@@ -15931,12 +15940,12 @@ function Cu(t) {
|
|
|
15931
15940
|
return r(this, (function(n) {
|
|
15932
15941
|
switch (n.label) {
|
|
15933
15942
|
case 0:
|
|
15934
|
-
return (e = Q(t)).
|
|
15943
|
+
return (e = Q(t)).Wr.add(0 /* UserDisabled */), [ 4 /*yield*/ , is(e) ];
|
|
15935
15944
|
|
|
15936
15945
|
case 1:
|
|
15937
15946
|
return n.sent(),
|
|
15938
15947
|
// Set the OnlineState to Offline so get()s return from cache, etc.
|
|
15939
|
-
e.
|
|
15948
|
+
e.Hr.set("Offline" /* Offline */), [ 2 /*return*/ ];
|
|
15940
15949
|
}
|
|
15941
15950
|
}));
|
|
15942
15951
|
}));
|
|
@@ -16261,7 +16270,7 @@ function(t) {
|
|
|
16261
16270
|
t.prototype._compareTo = function(t) {
|
|
16262
16271
|
return ot(this._lat, t._lat) || ot(this._long, t._long);
|
|
16263
16272
|
}, t;
|
|
16264
|
-
}(),
|
|
16273
|
+
}(), ju = /^__.*__$/, Ku = /** @class */ function() {
|
|
16265
16274
|
function t(t, e, n) {
|
|
16266
16275
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
16267
16276
|
}
|
|
@@ -16312,7 +16321,7 @@ function(t) {
|
|
|
16312
16321
|
return !1;
|
|
16313
16322
|
|
|
16314
16323
|
default:
|
|
16315
|
-
throw
|
|
16324
|
+
throw K();
|
|
16316
16325
|
}
|
|
16317
16326
|
}
|
|
16318
16327
|
|
|
@@ -16339,7 +16348,7 @@ function(t) {
|
|
|
16339
16348
|
this.settings = t, this.databaseId = e, this.N = n, this.ignoreUndefinedProperties = r,
|
|
16340
16349
|
// Minor hack: If fieldTransforms is undefined, we assume this is an
|
|
16341
16350
|
// external call and we need to validate the entire path.
|
|
16342
|
-
void 0 === i && this.
|
|
16351
|
+
void 0 === i && this.Na(), this.fieldTransforms = i || [], this.fieldMask = o || [];
|
|
16343
16352
|
}
|
|
16344
16353
|
return Object.defineProperty(t.prototype, "path", {
|
|
16345
16354
|
get: function() {
|
|
@@ -16347,36 +16356,36 @@ function(t) {
|
|
|
16347
16356
|
},
|
|
16348
16357
|
enumerable: !1,
|
|
16349
16358
|
configurable: !0
|
|
16350
|
-
}), Object.defineProperty(t.prototype, "
|
|
16359
|
+
}), Object.defineProperty(t.prototype, "xa", {
|
|
16351
16360
|
get: function() {
|
|
16352
|
-
return this.settings.
|
|
16361
|
+
return this.settings.xa;
|
|
16353
16362
|
},
|
|
16354
16363
|
enumerable: !1,
|
|
16355
16364
|
configurable: !0
|
|
16356
16365
|
}),
|
|
16357
|
-
/** Returns a new context with the specified settings overwritten. */ t.prototype.
|
|
16366
|
+
/** Returns a new context with the specified settings overwritten. */ t.prototype.ka = function(e) {
|
|
16358
16367
|
return new t(Object.assign(Object.assign({}, this.settings), e), this.databaseId, this.N, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
|
|
16359
|
-
}, t.prototype
|
|
16360
|
-
var e, n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.
|
|
16368
|
+
}, t.prototype.$a = function(t) {
|
|
16369
|
+
var e, n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.ka({
|
|
16361
16370
|
path: n,
|
|
16362
|
-
|
|
16371
|
+
Oa: !1
|
|
16363
16372
|
});
|
|
16364
|
-
return r.
|
|
16365
|
-
}, t.prototype
|
|
16366
|
-
var e, n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.
|
|
16373
|
+
return r.Fa(t), r;
|
|
16374
|
+
}, t.prototype.Ma = function(t) {
|
|
16375
|
+
var e, n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.ka({
|
|
16367
16376
|
path: n,
|
|
16368
|
-
|
|
16377
|
+
Oa: !1
|
|
16369
16378
|
});
|
|
16370
|
-
return r.
|
|
16371
|
-
}, t.prototype.
|
|
16379
|
+
return r.Na(), r;
|
|
16380
|
+
}, t.prototype.La = function(t) {
|
|
16372
16381
|
// TODO(b/34871131): We don't support array paths right now; so make path
|
|
16373
16382
|
// undefined.
|
|
16374
|
-
return this.
|
|
16383
|
+
return this.ka({
|
|
16375
16384
|
path: void 0,
|
|
16376
|
-
|
|
16385
|
+
Oa: !0
|
|
16377
16386
|
});
|
|
16378
|
-
}, t.prototype.
|
|
16379
|
-
return lc(t, this.settings.methodName, this.settings.
|
|
16387
|
+
}, t.prototype.Ba = function(t) {
|
|
16388
|
+
return lc(t, this.settings.methodName, this.settings.Ua || !1, this.path, this.settings.qa);
|
|
16380
16389
|
},
|
|
16381
16390
|
/** Returns 'true' if 'fieldPath' was traversed when creating this context. */ t.prototype.contains = function(t) {
|
|
16382
16391
|
return void 0 !== this.fieldMask.find((function(e) {
|
|
@@ -16384,27 +16393,27 @@ function(t) {
|
|
|
16384
16393
|
})) || void 0 !== this.fieldTransforms.find((function(e) {
|
|
16385
16394
|
return t.isPrefixOf(e.field);
|
|
16386
16395
|
}));
|
|
16387
|
-
}, t.prototype.
|
|
16396
|
+
}, t.prototype.Na = function() {
|
|
16388
16397
|
// TODO(b/34871131): Remove null check once we have proper paths for fields
|
|
16389
16398
|
// within arrays.
|
|
16390
|
-
if (this.path) for (var t = 0; t < this.path.length; t++) this.
|
|
16391
|
-
}, t.prototype.
|
|
16392
|
-
if (0 === t.length) throw this.
|
|
16393
|
-
if (Gu(this.
|
|
16399
|
+
if (this.path) for (var t = 0; t < this.path.length; t++) this.Fa(this.path.get(t));
|
|
16400
|
+
}, t.prototype.Fa = function(t) {
|
|
16401
|
+
if (0 === t.length) throw this.Ba("Document fields must not be empty");
|
|
16402
|
+
if (Gu(this.xa) && ju.test(t)) throw this.Ba('Document fields cannot begin and end with "__"');
|
|
16394
16403
|
}, t;
|
|
16395
16404
|
}(), Hu = /** @class */ function() {
|
|
16396
16405
|
function t(t, e, n) {
|
|
16397
16406
|
this.databaseId = t, this.ignoreUndefinedProperties = e, this.N = n || Yo(t)
|
|
16398
16407
|
/** Creates a new top-level parse context. */;
|
|
16399
16408
|
}
|
|
16400
|
-
return t.prototype.
|
|
16409
|
+
return t.prototype.Ka = function(t, e, n, r) {
|
|
16401
16410
|
return void 0 === r && (r = !1), new Qu({
|
|
16402
|
-
|
|
16411
|
+
xa: t,
|
|
16403
16412
|
methodName: e,
|
|
16404
|
-
|
|
16413
|
+
qa: n,
|
|
16405
16414
|
path: vt.emptyPath(),
|
|
16406
|
-
|
|
16407
|
-
|
|
16415
|
+
Oa: !1,
|
|
16416
|
+
Ua: r
|
|
16408
16417
|
}, this.databaseId, this.N, this.ignoreUndefinedProperties);
|
|
16409
16418
|
}, t;
|
|
16410
16419
|
}();
|
|
@@ -16419,7 +16428,7 @@ function(t) {
|
|
|
16419
16428
|
|
|
16420
16429
|
/** Parse document data from a set() call. */ function Yu(t, e, n, r, i, o) {
|
|
16421
16430
|
void 0 === o && (o = {});
|
|
16422
|
-
var s = t.
|
|
16431
|
+
var s = t.Ka(o.merge || o.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, i);
|
|
16423
16432
|
uc("Data must be an object, but it was:", s, r);
|
|
16424
16433
|
var a, u, c = sc(r, s);
|
|
16425
16434
|
if (o.merge) a = new mt(s.fieldMask), u = s.fieldTransforms; else if (o.mergeFields) {
|
|
@@ -16432,7 +16441,7 @@ function(t) {
|
|
|
16432
16441
|
return a.covers(t.field);
|
|
16433
16442
|
}));
|
|
16434
16443
|
} else a = null, u = s.fieldTransforms;
|
|
16435
|
-
return new
|
|
16444
|
+
return new Ku(new Gt(c), a, u);
|
|
16436
16445
|
}
|
|
16437
16446
|
|
|
16438
16447
|
var Ju = /** @class */ function(e) {
|
|
@@ -16440,7 +16449,7 @@ var Ju = /** @class */ function(e) {
|
|
|
16440
16449
|
return null !== e && e.apply(this, arguments) || this;
|
|
16441
16450
|
}
|
|
16442
16451
|
return t(n, e), n.prototype._toFieldTransform = function(t) {
|
|
16443
|
-
if (2 /* MergeSet */ !== t.
|
|
16452
|
+
if (2 /* MergeSet */ !== t.xa) throw 1 /* Update */ === t.xa ? t.Ba(this._methodName + "() can only appear at the top level of your update data") : t.Ba(this._methodName + "() cannot be used with set() unless you pass {merge:true}");
|
|
16444
16453
|
// No transform to add for a delete, but we need to add it to our
|
|
16445
16454
|
// fieldMask so it gets deleted.
|
|
16446
16455
|
return t.fieldMask.push(t.path), null;
|
|
@@ -16466,14 +16475,14 @@ var Ju = /** @class */ function(e) {
|
|
|
16466
16475
|
* @param arrayElement - Whether or not the FieldValue has an array.
|
|
16467
16476
|
*/ function Xu(t, e, n) {
|
|
16468
16477
|
return new Qu({
|
|
16469
|
-
|
|
16470
|
-
|
|
16478
|
+
xa: 3 /* Argument */ ,
|
|
16479
|
+
qa: e.settings.qa,
|
|
16471
16480
|
methodName: t._methodName,
|
|
16472
|
-
|
|
16481
|
+
Oa: n
|
|
16473
16482
|
}, e.databaseId, e.N, e.ignoreUndefinedProperties);
|
|
16474
16483
|
}
|
|
16475
16484
|
|
|
16476
|
-
var
|
|
16485
|
+
var Zu = /** @class */ function(e) {
|
|
16477
16486
|
function n() {
|
|
16478
16487
|
return null !== e && e.apply(this, arguments) || this;
|
|
16479
16488
|
}
|
|
@@ -16482,14 +16491,14 @@ var $u = /** @class */ function(e) {
|
|
|
16482
16491
|
}, n.prototype.isEqual = function(t) {
|
|
16483
16492
|
return t instanceof n;
|
|
16484
16493
|
}, n;
|
|
16485
|
-
}(Uu),
|
|
16494
|
+
}(Uu), $u = /** @class */ function(e) {
|
|
16486
16495
|
function n(t, n) {
|
|
16487
16496
|
var r = this;
|
|
16488
|
-
return (r = e.call(this, t) || this).
|
|
16497
|
+
return (r = e.call(this, t) || this).ja = n, r;
|
|
16489
16498
|
}
|
|
16490
16499
|
return t(n, e), n.prototype._toFieldTransform = function(t) {
|
|
16491
16500
|
var e = Xu(this, t,
|
|
16492
|
-
/*array=*/ !0), n = this.
|
|
16501
|
+
/*array=*/ !0), n = this.ja.map((function(t) {
|
|
16493
16502
|
return oc(t, e);
|
|
16494
16503
|
})), r = new qe(n);
|
|
16495
16504
|
return new Qe(t.path, r);
|
|
@@ -16500,11 +16509,11 @@ var $u = /** @class */ function(e) {
|
|
|
16500
16509
|
}(Uu), tc = /** @class */ function(e) {
|
|
16501
16510
|
function n(t, n) {
|
|
16502
16511
|
var r = this;
|
|
16503
|
-
return (r = e.call(this, t) || this).
|
|
16512
|
+
return (r = e.call(this, t) || this).ja = n, r;
|
|
16504
16513
|
}
|
|
16505
16514
|
return t(n, e), n.prototype._toFieldTransform = function(t) {
|
|
16506
16515
|
var e = Xu(this, t,
|
|
16507
|
-
/*array=*/ !0), n = this.
|
|
16516
|
+
/*array=*/ !0), n = this.ja.map((function(t) {
|
|
16508
16517
|
return oc(t, e);
|
|
16509
16518
|
})), r = new Be(n);
|
|
16510
16519
|
return new Qe(t.path, r);
|
|
@@ -16515,10 +16524,10 @@ var $u = /** @class */ function(e) {
|
|
|
16515
16524
|
}(Uu), ec = /** @class */ function(e) {
|
|
16516
16525
|
function n(t, n) {
|
|
16517
16526
|
var r = this;
|
|
16518
|
-
return (r = e.call(this, t) || this).
|
|
16527
|
+
return (r = e.call(this, t) || this).Qa = n, r;
|
|
16519
16528
|
}
|
|
16520
16529
|
return t(n, e), n.prototype._toFieldTransform = function(t) {
|
|
16521
|
-
var e = new
|
|
16530
|
+
var e = new Ke(t.N, Re(t.N, this.Qa));
|
|
16522
16531
|
return new Qe(t.path, e);
|
|
16523
16532
|
}, n.prototype.isEqual = function(t) {
|
|
16524
16533
|
// TODO(mrschmidt): Implement isEquals
|
|
@@ -16527,7 +16536,7 @@ var $u = /** @class */ function(e) {
|
|
|
16527
16536
|
}(Uu);
|
|
16528
16537
|
|
|
16529
16538
|
/** Parse update data from an update() call. */ function nc(t, e, n, r) {
|
|
16530
|
-
var i = t.
|
|
16539
|
+
var i = t.Ka(1 /* Update */ , e, n);
|
|
16531
16540
|
uc("Data must be an object, but it was:", i, r);
|
|
16532
16541
|
var o = [], s = Gt.empty();
|
|
16533
16542
|
ft(r, (function(t, r) {
|
|
@@ -16535,7 +16544,7 @@ var $u = /** @class */ function(e) {
|
|
|
16535
16544
|
// For Compat types, we have to "extract" the underlying types before
|
|
16536
16545
|
// performing validation.
|
|
16537
16546
|
r = b(r);
|
|
16538
|
-
var u = i
|
|
16547
|
+
var u = i.Ma(a);
|
|
16539
16548
|
if (r instanceof Ju)
|
|
16540
16549
|
// Add it to the field mask, but don't add anything to updateData.
|
|
16541
16550
|
o.push(a); else {
|
|
@@ -16548,7 +16557,7 @@ var $u = /** @class */ function(e) {
|
|
|
16548
16557
|
}
|
|
16549
16558
|
|
|
16550
16559
|
/** Parse update data from a list of field/value arguments. */ function rc(t, e, n, r, i, o) {
|
|
16551
|
-
var s = t.
|
|
16560
|
+
var s = t.Ka(1 /* Update */ , e, n), a = [ cc(e, r, n) ], u = [ i ];
|
|
16552
16561
|
if (o.length % 2 != 0) throw new W(H.INVALID_ARGUMENT, "Function " + e + "() needs to be called with an even number of arguments that alternate between field names and values.");
|
|
16553
16562
|
for (var c = 0; c < o.length; c += 2) a.push(cc(e, o[c])), u.push(o[c + 1]);
|
|
16554
16563
|
// We iterate in reverse order to pick the last value for a field if the
|
|
@@ -16558,7 +16567,7 @@ var $u = /** @class */ function(e) {
|
|
|
16558
16567
|
// For Compat types, we have to "extract" the underlying types before
|
|
16559
16568
|
// performing validation.
|
|
16560
16569
|
p = b(p);
|
|
16561
|
-
var y = s
|
|
16570
|
+
var y = s.Ma(d);
|
|
16562
16571
|
if (p instanceof Ju)
|
|
16563
16572
|
// Add it to the field mask, but don't add anything to updateData.
|
|
16564
16573
|
h.push(d); else {
|
|
@@ -16577,7 +16586,7 @@ var $u = /** @class */ function(e) {
|
|
|
16577
16586
|
* @param allowArrays - Whether the query value is an array that may directly
|
|
16578
16587
|
* contain additional arrays (e.g. the operand of an `in` query).
|
|
16579
16588
|
*/ function ic(t, e, n, r) {
|
|
16580
|
-
return void 0 === r && (r = !1), oc(n, t.
|
|
16589
|
+
return void 0 === r && (r = !1), oc(n, t.Ka(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
|
|
16581
16590
|
}
|
|
16582
16591
|
|
|
16583
16592
|
/**
|
|
@@ -16605,8 +16614,8 @@ var $u = /** @class */ function(e) {
|
|
|
16605
16614
|
*/
|
|
16606
16615
|
return function(t, e) {
|
|
16607
16616
|
// Sentinels are only supported with writes, and not within arrays.
|
|
16608
|
-
if (!Gu(e.
|
|
16609
|
-
if (!e.path) throw e.
|
|
16617
|
+
if (!Gu(e.xa)) throw e.Ba(t._methodName + "() can only be used with update() and set()");
|
|
16618
|
+
if (!e.path) throw e.Ba(t._methodName + "() is not currently supported inside arrays");
|
|
16610
16619
|
var n = t._toFieldTransform(e);
|
|
16611
16620
|
n && e.fieldTransforms.push(n);
|
|
16612
16621
|
}(t, e), null;
|
|
@@ -16625,10 +16634,10 @@ var $u = /** @class */ function(e) {
|
|
|
16625
16634
|
// the set of values to be included for the IN query) that may directly
|
|
16626
16635
|
// contain additional arrays (each representing an individual field
|
|
16627
16636
|
// value), so we disable this validation.
|
|
16628
|
-
if (e.settings.
|
|
16637
|
+
if (e.settings.Oa && 4 /* ArrayArgument */ !== e.xa) throw e.Ba("Nested arrays are not supported");
|
|
16629
16638
|
return function(t, e) {
|
|
16630
16639
|
for (var n = [], r = 0, i = 0, o = t; i < o.length; i++) {
|
|
16631
|
-
var s = oc(o[i], e.
|
|
16640
|
+
var s = oc(o[i], e.La(r));
|
|
16632
16641
|
null == s && (
|
|
16633
16642
|
// Just include nulls in the array for fields being replaced with a
|
|
16634
16643
|
// sentinel.
|
|
@@ -16657,7 +16666,7 @@ var $u = /** @class */ function(e) {
|
|
|
16657
16666
|
if (t instanceof Date) {
|
|
16658
16667
|
var n = ut.fromDate(t);
|
|
16659
16668
|
return {
|
|
16660
|
-
timestampValue:
|
|
16669
|
+
timestampValue: jn(e.N, n)
|
|
16661
16670
|
};
|
|
16662
16671
|
}
|
|
16663
16672
|
if (t instanceof ut) {
|
|
@@ -16666,7 +16675,7 @@ var $u = /** @class */ function(e) {
|
|
|
16666
16675
|
// truncation immediately without waiting for the backend to do that.
|
|
16667
16676
|
var r = new ut(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
|
|
16668
16677
|
return {
|
|
16669
|
-
timestampValue:
|
|
16678
|
+
timestampValue: jn(e.N, r)
|
|
16670
16679
|
};
|
|
16671
16680
|
}
|
|
16672
16681
|
if (t instanceof Bu) return {
|
|
@@ -16676,16 +16685,16 @@ var $u = /** @class */ function(e) {
|
|
|
16676
16685
|
}
|
|
16677
16686
|
};
|
|
16678
16687
|
if (t instanceof qu) return {
|
|
16679
|
-
bytesValue:
|
|
16688
|
+
bytesValue: Kn(e.N, t._byteString)
|
|
16680
16689
|
};
|
|
16681
16690
|
if (t instanceof cu) {
|
|
16682
16691
|
var i = e.databaseId, o = t.firestore._databaseId;
|
|
16683
|
-
if (!o.isEqual(i)) throw e.
|
|
16692
|
+
if (!o.isEqual(i)) throw e.Ba("Document reference is for database " + o.projectId + "/" + o.database + " but should be for database " + i.projectId + "/" + i.database);
|
|
16684
16693
|
return {
|
|
16685
16694
|
referenceValue: Qn(t.firestore._databaseId || e.databaseId, t._key.path)
|
|
16686
16695
|
};
|
|
16687
16696
|
}
|
|
16688
|
-
throw e.
|
|
16697
|
+
throw e.Ba("Unsupported field value: " + ru(t));
|
|
16689
16698
|
}(t, e);
|
|
16690
16699
|
}
|
|
16691
16700
|
|
|
@@ -16695,7 +16704,7 @@ function sc(t, e) {
|
|
|
16695
16704
|
// If we encounter an empty object, we explicitly add it to the update
|
|
16696
16705
|
// mask to ensure that the server creates a map entry.
|
|
16697
16706
|
e.path && e.path.length > 0 && e.fieldMask.push(e.path) : ft(t, (function(t, r) {
|
|
16698
|
-
var i = oc(r, e
|
|
16707
|
+
var i = oc(r, e.$a(t));
|
|
16699
16708
|
null != i && (n[t] = i);
|
|
16700
16709
|
})), {
|
|
16701
16710
|
mapValue: {
|
|
@@ -16713,7 +16722,7 @@ function uc(t, e, n) {
|
|
|
16713
16722
|
return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
|
|
16714
16723
|
}(n)) {
|
|
16715
16724
|
var r = ru(n);
|
|
16716
|
-
throw "an object" === r ? e.
|
|
16725
|
+
throw "an object" === r ? e.Ba(t + " a custom object") : e.Ba(t + " " + r);
|
|
16717
16726
|
}
|
|
16718
16727
|
}
|
|
16719
16728
|
|
|
@@ -17118,7 +17127,7 @@ function vc(t, e) {
|
|
|
17118
17127
|
return "removed";
|
|
17119
17128
|
|
|
17120
17129
|
default:
|
|
17121
|
-
return
|
|
17130
|
+
return K();
|
|
17122
17131
|
}
|
|
17123
17132
|
}
|
|
17124
17133
|
|
|
@@ -17182,7 +17191,7 @@ function vc(t, e) {
|
|
|
17182
17191
|
var _c = /** @class */ function(e) {
|
|
17183
17192
|
function n(t, n, r) {
|
|
17184
17193
|
var i = this;
|
|
17185
|
-
return (i = e.call(this) || this).
|
|
17194
|
+
return (i = e.call(this) || this).Wa = t, i.Ga = n, i.za = r, i.type = "where",
|
|
17186
17195
|
i;
|
|
17187
17196
|
}
|
|
17188
17197
|
return t(n, e), n.prototype._apply = function(t) {
|
|
@@ -17205,13 +17214,13 @@ var _c = /** @class */ function(e) {
|
|
|
17205
17214
|
} else "in" /* IN */ !== o && "not-in" /* NOT_IN */ !== o && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== o || Bc(s, o),
|
|
17206
17215
|
a = ic(n, "where", s,
|
|
17207
17216
|
/* allowArrays= */ "in" /* IN */ === o || "not-in" /* NOT_IN */ === o);
|
|
17208
|
-
var l =
|
|
17217
|
+
var l = $t.create(i, o, a);
|
|
17209
17218
|
return function(t, e) {
|
|
17210
17219
|
if (e.v()) {
|
|
17211
17220
|
var n = be(t);
|
|
17212
17221
|
if (null !== n && !n.isEqual(e.field)) throw new W(H.INVALID_ARGUMENT, "Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '" + n.toString() + "' and '" + e.field.toString() + "'");
|
|
17213
17222
|
var r = we(t);
|
|
17214
|
-
null !== r &&
|
|
17223
|
+
null !== r && jc(t, e.field, r);
|
|
17215
17224
|
}
|
|
17216
17225
|
var i = function(t, e) {
|
|
17217
17226
|
for (var n = 0, r = t.filters; n < r.length; n++) {
|
|
@@ -17257,7 +17266,7 @@ var _c = /** @class */ function(e) {
|
|
|
17257
17266
|
// Special case when it's a duplicate op to give a slightly clearer error message.
|
|
17258
17267
|
throw i === e.op ? new W(H.INVALID_ARGUMENT, "Invalid query. You cannot use more than one '" + e.op.toString() + "' filter.") : new W(H.INVALID_ARGUMENT, "Invalid query. You cannot use '" + e.op.toString() + "' filters with '" + i.toString() + "' filters.");
|
|
17259
17268
|
}(t, l), l;
|
|
17260
|
-
}(t._query, 0, e, t.firestore._databaseId, this.
|
|
17269
|
+
}(t._query, 0, e, t.firestore._databaseId, this.Wa, this.Ga, this.za);
|
|
17261
17270
|
return new hu(t.firestore, t.converter, function(t, e) {
|
|
17262
17271
|
var n = t.filters.concat([ e ]);
|
|
17263
17272
|
return new pe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
|
|
@@ -17283,7 +17292,7 @@ var _c = /** @class */ function(e) {
|
|
|
17283
17292
|
var Ac = /** @class */ function(e) {
|
|
17284
17293
|
function n(t, n) {
|
|
17285
17294
|
var r = this;
|
|
17286
|
-
return (r = e.call(this) || this).
|
|
17295
|
+
return (r = e.call(this) || this).Wa = t, r.Ha = n, r.type = "orderBy", r;
|
|
17287
17296
|
}
|
|
17288
17297
|
return t(n, e), n.prototype._apply = function(t) {
|
|
17289
17298
|
var e = function(t, e, n) {
|
|
@@ -17294,10 +17303,10 @@ var Ac = /** @class */ function(e) {
|
|
|
17294
17303
|
if (null === we(t)) {
|
|
17295
17304
|
// This is the first order by. It must match any inequality.
|
|
17296
17305
|
var n = be(t);
|
|
17297
|
-
null !== n &&
|
|
17306
|
+
null !== n && jc(t, n, e.field);
|
|
17298
17307
|
}
|
|
17299
17308
|
}(t, r), r;
|
|
17300
|
-
}(t._query, this.
|
|
17309
|
+
}(t._query, this.Wa, this.Ha);
|
|
17301
17310
|
return new hu(t.firestore, t.converter, function(t, e) {
|
|
17302
17311
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
17303
17312
|
var n = t.explicitOrderBy.concat([ e ]);
|
|
@@ -17323,10 +17332,10 @@ var Ac = /** @class */ function(e) {
|
|
|
17323
17332
|
var Cc = /** @class */ function(e) {
|
|
17324
17333
|
function n(t, n, r) {
|
|
17325
17334
|
var i = this;
|
|
17326
|
-
return (i = e.call(this) || this).type = t, i.
|
|
17335
|
+
return (i = e.call(this) || this).type = t, i.Ja = n, i.Ya = r, i;
|
|
17327
17336
|
}
|
|
17328
17337
|
return t(n, e), n.prototype._apply = function(t) {
|
|
17329
|
-
return new hu(t.firestore, t.converter, Se(t._query, this.
|
|
17338
|
+
return new hu(t.firestore, t.converter, Se(t._query, this.Ja, this.Ya));
|
|
17330
17339
|
}, n;
|
|
17331
17340
|
}(Sc);
|
|
17332
17341
|
|
|
@@ -17355,10 +17364,10 @@ function Lc(t) {
|
|
|
17355
17364
|
var Rc = /** @class */ function(e) {
|
|
17356
17365
|
function n(t, n, r) {
|
|
17357
17366
|
var i = this;
|
|
17358
|
-
return (i = e.call(this) || this).type = t, i.
|
|
17367
|
+
return (i = e.call(this) || this).type = t, i.Xa = n, i.Za = r, i;
|
|
17359
17368
|
}
|
|
17360
17369
|
return t(n, e), n.prototype._apply = function(t) {
|
|
17361
|
-
var e = qc(t, this.type, this.
|
|
17370
|
+
var e = qc(t, this.type, this.Xa, this.Za);
|
|
17362
17371
|
return new hu(t.firestore, t.converter, function(t, e) {
|
|
17363
17372
|
return new pe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
|
|
17364
17373
|
}(t._query, e));
|
|
@@ -17379,10 +17388,10 @@ function Pc() {
|
|
|
17379
17388
|
var Fc = /** @class */ function(e) {
|
|
17380
17389
|
function n(t, n, r) {
|
|
17381
17390
|
var i = this;
|
|
17382
|
-
return (i = e.call(this) || this).type = t, i.
|
|
17391
|
+
return (i = e.call(this) || this).type = t, i.Xa = n, i.Za = r, i;
|
|
17383
17392
|
}
|
|
17384
17393
|
return t(n, e), n.prototype._apply = function(t) {
|
|
17385
|
-
var e = qc(t, this.type, this.
|
|
17394
|
+
var e = qc(t, this.type, this.Xa, this.Za);
|
|
17386
17395
|
return new hu(t.firestore, t.converter, function(t, e) {
|
|
17387
17396
|
return new pe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
|
|
17388
17397
|
}(t._query, e));
|
|
@@ -17466,7 +17475,7 @@ function Uc(t, e, n) {
|
|
|
17466
17475
|
if (t.length > 10) throw new W(H.INVALID_ARGUMENT, "Invalid Query. '" + e.toString() + "' filters support a maximum of 10 elements in the value array.");
|
|
17467
17476
|
}
|
|
17468
17477
|
|
|
17469
|
-
function
|
|
17478
|
+
function jc(t, e, n) {
|
|
17470
17479
|
if (!n.isEqual(e)) throw new W(H.INVALID_ARGUMENT, "Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '" + e.toString() + "' and so you must also use '" + e.toString() + "' as your first argument to orderBy(), but your first orderBy() is on field '" + n.toString() + "' instead.");
|
|
17471
17480
|
}
|
|
17472
17481
|
|
|
@@ -17491,7 +17500,7 @@ function Kc(t, e, n) {
|
|
|
17491
17500
|
* to the user.
|
|
17492
17501
|
*
|
|
17493
17502
|
* @internal
|
|
17494
|
-
*/ var
|
|
17503
|
+
*/ var Kc = /** @class */ function() {
|
|
17495
17504
|
function t() {}
|
|
17496
17505
|
return t.prototype.convertValue = function(t, e) {
|
|
17497
17506
|
switch (void 0 === e && (e = "none"), xt(t)) {
|
|
@@ -17529,7 +17538,7 @@ function Kc(t, e, n) {
|
|
|
17529
17538
|
return this.convertObject(t.mapValue, e);
|
|
17530
17539
|
|
|
17531
17540
|
default:
|
|
17532
|
-
throw
|
|
17541
|
+
throw K();
|
|
17533
17542
|
}
|
|
17534
17543
|
}, t.prototype.convertObject = function(t, e) {
|
|
17535
17544
|
var n = this, r = {};
|
|
@@ -17611,7 +17620,7 @@ var Gc = /** @class */ function(e) {
|
|
|
17611
17620
|
var e = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
17612
17621
|
return new cu(this.firestore, /* converter= */ null, e);
|
|
17613
17622
|
}, n;
|
|
17614
|
-
}(
|
|
17623
|
+
}(Kc), Qc = /** @class */ function() {
|
|
17615
17624
|
/** @hideconstructor */
|
|
17616
17625
|
function t(t, e) {
|
|
17617
17626
|
this._firestore = t, this._commitHandler = e, this._mutations = [], this._committed = !1,
|
|
@@ -17759,7 +17768,7 @@ var Yc = /** @class */ function(e) {
|
|
|
17759
17768
|
var e = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
17760
17769
|
return new cu(this.firestore, /* converter= */ null, e);
|
|
17761
17770
|
}, n;
|
|
17762
|
-
}(
|
|
17771
|
+
}(Kc);
|
|
17763
17772
|
|
|
17764
17773
|
/**
|
|
17765
17774
|
* Reads the document referred to by this `DocumentReference` from cache.
|
|
@@ -17843,7 +17852,7 @@ var Yc = /** @class */ function(e) {
|
|
|
17843
17852
|
* invoke {@link getDocsFromCache} or {@link getDocsFromServer}.
|
|
17844
17853
|
*
|
|
17845
17854
|
* @returns A `Promise` that will be resolved with the results of the query.
|
|
17846
|
-
*/ function
|
|
17855
|
+
*/ function Zc(t) {
|
|
17847
17856
|
t = iu(t, hu);
|
|
17848
17857
|
var e = iu(t.firestore, Iu), n = Su(e), r = new Yc(e);
|
|
17849
17858
|
return Ec(t._query), Ya(n, t._query).then((function(n) {
|
|
@@ -17857,7 +17866,7 @@ var Yc = /** @class */ function(e) {
|
|
|
17857
17866
|
*/;
|
|
17858
17867
|
}
|
|
17859
17868
|
|
|
17860
|
-
function
|
|
17869
|
+
function $c(t) {
|
|
17861
17870
|
t = iu(t, hu);
|
|
17862
17871
|
var e = iu(t.firestore, Iu), i = Su(e), o = new Yc(e);
|
|
17863
17872
|
return function(t, e) {
|
|
@@ -17878,7 +17887,7 @@ function Zc(t) {
|
|
|
17878
17887
|
/* usePreviousResults= */ !0) ];
|
|
17879
17888
|
|
|
17880
17889
|
case 1:
|
|
17881
|
-
return n = r.sent(), o = new Hs(e, n.Gn), s = o.
|
|
17890
|
+
return n = r.sent(), o = new Hs(e, n.Gn), s = o.bo(n.documents), a = o.applyChanges(s,
|
|
17882
17891
|
/* updateLimboDocuments= */ !1), i.resolve(a.snapshot), [ 3 /*break*/ , 3 ];
|
|
17883
17892
|
|
|
17884
17893
|
case 2:
|
|
@@ -18009,7 +18018,7 @@ function oh(t) {
|
|
|
18009
18018
|
}));
|
|
18010
18019
|
}));
|
|
18011
18020
|
})), function() {
|
|
18012
|
-
a.
|
|
18021
|
+
a.ea(), t.asyncQueue.enqueueAndForget((function() {
|
|
18013
18022
|
return n(s, void 0, void 0, (function() {
|
|
18014
18023
|
var e;
|
|
18015
18024
|
return r(this, (function(n) {
|
|
@@ -18037,7 +18046,7 @@ function sh(t, e) {
|
|
|
18037
18046
|
switch (n.label) {
|
|
18038
18047
|
case 0:
|
|
18039
18048
|
return e = function(t, e) {
|
|
18040
|
-
Q(t).
|
|
18049
|
+
Q(t).so.add(e),
|
|
18041
18050
|
// Immediately fire an initial event, indicating all existing listeners
|
|
18042
18051
|
// are in-sync.
|
|
18043
18052
|
e.next();
|
|
@@ -18049,14 +18058,14 @@ function sh(t, e) {
|
|
|
18049
18058
|
}));
|
|
18050
18059
|
}));
|
|
18051
18060
|
})), function() {
|
|
18052
|
-
o.
|
|
18061
|
+
o.ea(), t.asyncQueue.enqueueAndForget((function() {
|
|
18053
18062
|
return n(i, void 0, void 0, (function() {
|
|
18054
18063
|
var e;
|
|
18055
18064
|
return r(this, (function(n) {
|
|
18056
18065
|
switch (n.label) {
|
|
18057
18066
|
case 0:
|
|
18058
18067
|
return e = function(t, e) {
|
|
18059
|
-
Q(t).
|
|
18068
|
+
Q(t).so.delete(e);
|
|
18060
18069
|
}, [ 4 /*yield*/ , Ha(t) ];
|
|
18061
18070
|
|
|
18062
18071
|
case 1:
|
|
@@ -18139,7 +18148,7 @@ function sh(t, e) {
|
|
|
18139
18148
|
* The `Transaction` object passed to a transaction's `updateFunction` provides
|
|
18140
18149
|
* the methods to read and write data within the transaction context. See
|
|
18141
18150
|
* {@link runTransaction}.
|
|
18142
|
-
*/ var ch = /** @class */ function(e) {
|
|
18151
|
+
*/ var ch, hh = /** @class */ function(e) {
|
|
18143
18152
|
// This class implements the same logic as the Transaction API in the Lite SDK
|
|
18144
18153
|
// but is subclassed in order to return its own DocumentSnapshot types.
|
|
18145
18154
|
/** @hideconstructor */
|
|
@@ -18174,11 +18183,11 @@ function sh(t, e) {
|
|
|
18174
18183
|
return t.prototype.get = function(t) {
|
|
18175
18184
|
var e = this, n = Hc(t, this._firestore), r = new Gc(this._firestore);
|
|
18176
18185
|
return this._transaction.lookup([ n._key ]).then((function(t) {
|
|
18177
|
-
if (!t || 1 !== t.length) return
|
|
18186
|
+
if (!t || 1 !== t.length) return K();
|
|
18178
18187
|
var i = t[0];
|
|
18179
18188
|
if (i.isFoundDocument()) return new pc(e._firestore, r, i.key, i, n.converter);
|
|
18180
18189
|
if (i.isNoDocument()) return new pc(e._firestore, r, n._key, null, n.converter);
|
|
18181
|
-
throw
|
|
18190
|
+
throw K();
|
|
18182
18191
|
}));
|
|
18183
18192
|
}, t.prototype.set = function(t, e, n) {
|
|
18184
18193
|
var r = Hc(t, this._firestore), i = zc(r.converter, e, n), o = Yu(this._dataReader, "Transaction.set", r._key, i, null !== r.converter, n);
|
|
@@ -18219,7 +18228,7 @@ function sh(t, e) {
|
|
|
18219
18228
|
* (the `updateFunction` returned a failed promise), the promise returned by the
|
|
18220
18229
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
18221
18230
|
* rejected promise with the corresponding failure error is returned.
|
|
18222
|
-
*/ function
|
|
18231
|
+
*/ function fh(t, e) {
|
|
18223
18232
|
return function(t, e) {
|
|
18224
18233
|
var i = this, o = new Y;
|
|
18225
18234
|
return t.asyncQueue.enqueueAndForget((function() {
|
|
@@ -18229,7 +18238,7 @@ function sh(t, e) {
|
|
|
18229
18238
|
switch (r.label) {
|
|
18230
18239
|
case 0:
|
|
18231
18240
|
return [ 4 /*yield*/ , function(t) {
|
|
18232
|
-
return
|
|
18241
|
+
return ja(t).then((function(t) {
|
|
18233
18242
|
return t.datastore;
|
|
18234
18243
|
}));
|
|
18235
18244
|
}(t) ];
|
|
@@ -18240,8 +18249,8 @@ function sh(t, e) {
|
|
|
18240
18249
|
}));
|
|
18241
18250
|
}));
|
|
18242
18251
|
})), o.promise;
|
|
18243
|
-
}(Su(t), (function(n) {
|
|
18244
|
-
return e(new
|
|
18252
|
+
}(Su(t = iu(t, Iu)), (function(n) {
|
|
18253
|
+
return e(new hh(t, n));
|
|
18245
18254
|
}));
|
|
18246
18255
|
}
|
|
18247
18256
|
|
|
@@ -18264,15 +18273,15 @@ function sh(t, e) {
|
|
|
18264
18273
|
/**
|
|
18265
18274
|
* Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or
|
|
18266
18275
|
* {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion.
|
|
18267
|
-
*/ function
|
|
18276
|
+
*/ function lh() {
|
|
18268
18277
|
return new Ju("deleteField");
|
|
18269
18278
|
}
|
|
18270
18279
|
|
|
18271
18280
|
/**
|
|
18272
18281
|
* Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
|
|
18273
18282
|
* include a server-generated timestamp in the written data.
|
|
18274
|
-
*/ function
|
|
18275
|
-
return new
|
|
18283
|
+
*/ function dh() {
|
|
18284
|
+
return new Zu("serverTimestamp");
|
|
18276
18285
|
}
|
|
18277
18286
|
|
|
18278
18287
|
/**
|
|
@@ -18286,11 +18295,11 @@ function sh(t, e) {
|
|
|
18286
18295
|
* @param elements - The elements to union into the array.
|
|
18287
18296
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
18288
18297
|
* `updateDoc()`.
|
|
18289
|
-
*/ function
|
|
18298
|
+
*/ function ph() {
|
|
18290
18299
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
18291
18300
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
18292
18301
|
// update() since we'd need the Firestore instance to do this.
|
|
18293
|
-
return new
|
|
18302
|
+
return new $u("arrayUnion", t);
|
|
18294
18303
|
}
|
|
18295
18304
|
|
|
18296
18305
|
/**
|
|
@@ -18303,7 +18312,7 @@ function sh(t, e) {
|
|
|
18303
18312
|
* @param elements - The elements to remove from the array.
|
|
18304
18313
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
18305
18314
|
* `updateDoc()`
|
|
18306
|
-
*/ function
|
|
18315
|
+
*/ function yh() {
|
|
18307
18316
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
18308
18317
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
18309
18318
|
// update() since we'd need the Firestore instance to do this.
|
|
@@ -18328,7 +18337,7 @@ function sh(t, e) {
|
|
|
18328
18337
|
* @param n - The value to increment by.
|
|
18329
18338
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
18330
18339
|
* `updateDoc()`
|
|
18331
|
-
*/ function
|
|
18340
|
+
*/ function vh(t) {
|
|
18332
18341
|
return new ec("increment", t);
|
|
18333
18342
|
}
|
|
18334
18343
|
|
|
@@ -18358,7 +18367,7 @@ function sh(t, e) {
|
|
|
18358
18367
|
*
|
|
18359
18368
|
* @returns A {@link WriteBatch} that can be used to atomically execute multiple
|
|
18360
18369
|
* writes.
|
|
18361
|
-
*/ function
|
|
18370
|
+
*/ function mh(t) {
|
|
18362
18371
|
return Su(t = iu(t, Iu)), new Qc(t, (function(e) {
|
|
18363
18372
|
return ah(t, e);
|
|
18364
18373
|
}))
|
|
@@ -18369,14 +18378,14 @@ function sh(t, e) {
|
|
|
18369
18378
|
*/;
|
|
18370
18379
|
}
|
|
18371
18380
|
|
|
18372
|
-
P = i, o(new c("firestore", (function(t, e) {
|
|
18373
|
-
var n = e.options, r = t.getProvider("app").getImmediate(), i = new Iu(r, new
|
|
18381
|
+
void 0 === ch && (ch = !0), P = i, o(new c("firestore", (function(t, e) {
|
|
18382
|
+
var n = e.options, r = t.getProvider("app").getImmediate(), i = new Iu(r, new $(t.getProvider("auth-internal")));
|
|
18374
18383
|
return n = Object.assign({
|
|
18375
|
-
useFetchStreams:
|
|
18384
|
+
useFetchStreams: ch
|
|
18376
18385
|
}, n), i._setSettings(n), i;
|
|
18377
|
-
}), "PUBLIC" /* PUBLIC */)), s(R, "3.
|
|
18386
|
+
}), "PUBLIC" /* PUBLIC */)), s(R, "3.2.0-canary.477bdef13", void 0),
|
|
18378
18387
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
|
18379
|
-
s(R, "3.
|
|
18388
|
+
s(R, "3.2.0-canary.477bdef13", "esm5");
|
|
18380
18389
|
|
|
18381
|
-
export {
|
|
18390
|
+
export { Kc as AbstractUserDataWriter, qu as Bytes, bu as CACHE_SIZE_UNLIMITED, fu as CollectionReference, cu as DocumentReference, gc as DocumentSnapshot, Mu as FieldPath, Uu as FieldValue, Iu as Firestore, W as FirestoreError, Bu as GeoPoint, wu as LoadBundleTask, hu as Query, Sc as QueryConstraint, wc as QueryDocumentSnapshot, bc as QuerySnapshot, mc as SnapshotMetadata, ut as Timestamp, hh as Transaction, Qc as WriteBatch, Xa as _DatabaseId, Ct as _DocumentKey, X as _EmptyCredentialsProvider, vt as _FieldPath, iu as _cast, G as _debugAssert, gt as _isBase64Available, B as _logWarn, tu as _validateIsNotUsedTogether, ih as addDoc, yh as arrayRemove, ph as arrayUnion, ku as clearIndexedDbPersistence, lu as collection, du as collectionGroup, uu as connectFirestoreEmulator, rh as deleteDoc, lh as deleteField, Lu as disableNetwork, pu as doc, Vu as documentId, _u as enableIndexedDbPersistence, Du as enableMultiTabIndexedDbPersistence, xu as enableNetwork, Vc as endAt, Mc as endBefore, Su as ensureFirestoreConfigured, ah as executeWrite, Wc as getDoc, Jc as getDocFromCache, Xc as getDocFromServer, Zc as getDocs, $c as getDocsFromCache, th as getDocsFromServer, Eu as getFirestore, vh as increment, Tu as initializeFirestore, xc as limit, Lc as limitToLast, Ou as loadBundle, Pu as namedQuery, oh as onSnapshot, sh as onSnapshotsInSync, kc as orderBy, Nc as query, vu as queryEqual, yu as refEqual, fh as runTransaction, dh as serverTimestamp, eh as setDoc, V as setLogLevel, Tc as snapshotEqual, Pc as startAfter, Oc as startAt, Ru as terminate, nh as updateDoc, Cu as waitForPendingWrites, Dc as where, mh as writeBatch };
|
|
18382
18391
|
//# sourceMappingURL=index.esm5.js.map
|