@firebase/firestore 3.4.12-canary.39f4635eb → 3.4.12-canary.f36d627af
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm2017.js +824 -824
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +1162 -1162
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +2 -2
- package/dist/index.node.mjs +2 -2
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +3 -3
- 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.node.cjs.js +2 -2
- package/dist/lite/index.node.mjs +2 -2
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +2 -2
- package/dist/packages/firestore/dist/index.esm2017.d.ts +101 -101
- package/package.json +9 -9
package/dist/index.esm2017.js
CHANGED
|
@@ -66,7 +66,7 @@ C.MOCK_USER = new C("mock-user");
|
|
|
66
66
|
* See the License for the specific language governing permissions and
|
|
67
67
|
* limitations under the License.
|
|
68
68
|
*/
|
|
69
|
-
let x = "9.9.0-canary.
|
|
69
|
+
let x = "9.9.0-canary.f36d627af";
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* @license
|
|
@@ -870,18 +870,18 @@ class ut {
|
|
|
870
870
|
/**
|
|
871
871
|
* A version of a document in Firestore. This corresponds to the version
|
|
872
872
|
* timestamp, such as update_time or read_time.
|
|
873
|
-
*/ class
|
|
873
|
+
*/ class at {
|
|
874
874
|
constructor(t) {
|
|
875
875
|
this.timestamp = t;
|
|
876
876
|
}
|
|
877
877
|
static fromTimestamp(t) {
|
|
878
|
-
return new
|
|
878
|
+
return new at(t);
|
|
879
879
|
}
|
|
880
880
|
static min() {
|
|
881
|
-
return new
|
|
881
|
+
return new at(new ut(0, 0));
|
|
882
882
|
}
|
|
883
883
|
static max() {
|
|
884
|
-
return new
|
|
884
|
+
return new at(new ut(253402300799, 999999999));
|
|
885
885
|
}
|
|
886
886
|
compareTo(t) {
|
|
887
887
|
return this.timestamp._compareTo(t.timestamp);
|
|
@@ -920,7 +920,7 @@ class ut {
|
|
|
920
920
|
/**
|
|
921
921
|
* Path represents an ordered sequence of string segments.
|
|
922
922
|
*/
|
|
923
|
-
class
|
|
923
|
+
class ct {
|
|
924
924
|
constructor(t, e, n) {
|
|
925
925
|
void 0 === e ? e = 0 : e > t.length && L(), void 0 === n ? n = t.length - e : n > t.length - e && L(),
|
|
926
926
|
this.segments = t, this.offset = e, this.len = n;
|
|
@@ -929,11 +929,11 @@ class at {
|
|
|
929
929
|
return this.len;
|
|
930
930
|
}
|
|
931
931
|
isEqual(t) {
|
|
932
|
-
return 0 ===
|
|
932
|
+
return 0 === ct.comparator(this, t);
|
|
933
933
|
}
|
|
934
934
|
child(t) {
|
|
935
935
|
const e = this.segments.slice(this.offset, this.limit());
|
|
936
|
-
return t instanceof
|
|
936
|
+
return t instanceof ct ? t.forEach((t => {
|
|
937
937
|
e.push(t);
|
|
938
938
|
})) : e.push(t), this.construct(e);
|
|
939
939
|
}
|
|
@@ -990,7 +990,7 @@ class at {
|
|
|
990
990
|
* within Firestore.
|
|
991
991
|
*
|
|
992
992
|
* @internal
|
|
993
|
-
*/ class ht extends
|
|
993
|
+
*/ class ht extends ct {
|
|
994
994
|
construct(t, e, n) {
|
|
995
995
|
return new ht(t, e, n);
|
|
996
996
|
}
|
|
@@ -1029,7 +1029,7 @@ const lt = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
|
1029
1029
|
/**
|
|
1030
1030
|
* A dot-separated path for navigating sub-objects within a document.
|
|
1031
1031
|
* @internal
|
|
1032
|
-
*/ class ft extends
|
|
1032
|
+
*/ class ft extends ct {
|
|
1033
1033
|
construct(t, e, n) {
|
|
1034
1034
|
return new ft(t, e, n);
|
|
1035
1035
|
}
|
|
@@ -1258,7 +1258,7 @@ class gt {
|
|
|
1258
1258
|
// Unicode codepoints to generate MAX_DOCUMENT_KEY, it is much easier to use
|
|
1259
1259
|
// `(readTime + 1, DocumentKey.empty())` since `> DocumentKey.empty()` matches
|
|
1260
1260
|
// all valid document IDs.
|
|
1261
|
-
const n = t.toTimestamp().seconds, s = t.toTimestamp().nanoseconds + 1, i =
|
|
1261
|
+
const n = t.toTimestamp().seconds, s = t.toTimestamp().nanoseconds + 1, i = at.fromTimestamp(1e9 === s ? new ut(n + 1, 0) : new ut(n, s));
|
|
1262
1262
|
return new Tt(i, dt.empty(), e);
|
|
1263
1263
|
}
|
|
1264
1264
|
|
|
@@ -1288,10 +1288,10 @@ class gt {
|
|
|
1288
1288
|
this.readTime = t, this.documentKey = e, this.largestBatchId = n;
|
|
1289
1289
|
}
|
|
1290
1290
|
/** Returns an offset that sorts before all regular offsets. */ static min() {
|
|
1291
|
-
return new Tt(
|
|
1291
|
+
return new Tt(at.min(), dt.empty(), -1);
|
|
1292
1292
|
}
|
|
1293
1293
|
/** Returns an offset that sorts after all regular offsets. */ static max() {
|
|
1294
|
-
return new Tt(
|
|
1294
|
+
return new Tt(at.max(), dt.empty(), -1);
|
|
1295
1295
|
}
|
|
1296
1296
|
}
|
|
1297
1297
|
|
|
@@ -1492,9 +1492,9 @@ class Rt {
|
|
|
1492
1492
|
const i = t.length, r = new Array(i);
|
|
1493
1493
|
let o = 0;
|
|
1494
1494
|
for (let u = 0; u < i; u++) {
|
|
1495
|
-
const
|
|
1496
|
-
e(t[
|
|
1497
|
-
r[
|
|
1495
|
+
const a = u;
|
|
1496
|
+
e(t[a]).next((t => {
|
|
1497
|
+
r[a] = t, ++o, o === i && n(r);
|
|
1498
1498
|
}), (t => s(t)));
|
|
1499
1499
|
}
|
|
1500
1500
|
}));
|
|
@@ -2962,7 +2962,7 @@ function oe(t) {
|
|
|
2962
2962
|
/**
|
|
2963
2963
|
* Returns whether a value is an integer and in the safe integer range
|
|
2964
2964
|
* @param value - The value to test for being an integer and in the safe range
|
|
2965
|
-
*/ function
|
|
2965
|
+
*/ function ae(t) {
|
|
2966
2966
|
return "number" == typeof t && Number.isInteger(t) && !ue(t) && t <= Number.MAX_SAFE_INTEGER && t >= Number.MIN_SAFE_INTEGER;
|
|
2967
2967
|
}
|
|
2968
2968
|
|
|
@@ -2981,7 +2981,7 @@ function oe(t) {
|
|
|
2981
2981
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2982
2982
|
* See the License for the specific language governing permissions and
|
|
2983
2983
|
* limitations under the License.
|
|
2984
|
-
*/ const
|
|
2984
|
+
*/ const ce = {
|
|
2985
2985
|
mapValue: {
|
|
2986
2986
|
fields: {
|
|
2987
2987
|
__type__: {
|
|
@@ -3133,9 +3133,9 @@ function _e(t, e) {
|
|
|
3133
3133
|
|
|
3134
3134
|
case 10 /* ObjectValue */ :
|
|
3135
3135
|
return function(t, e) {
|
|
3136
|
-
if (t ===
|
|
3137
|
-
if (t ===
|
|
3138
|
-
if (e ===
|
|
3136
|
+
if (t === ce.mapValue && e === ce.mapValue) return 0;
|
|
3137
|
+
if (t === ce.mapValue) return 1;
|
|
3138
|
+
if (e === ce.mapValue) return -1;
|
|
3139
3139
|
const n = t.fields || {}, s = Object.keys(n), i = e.fields || {}, r = Object.keys(i);
|
|
3140
3140
|
// Even though MapValues are likely sorted correctly based on their insertion
|
|
3141
3141
|
// order (e.g. when received from the backend), local modifications can bring
|
|
@@ -3297,7 +3297,7 @@ function Ie(t) {
|
|
|
3297
3297
|
arrayValue: {}
|
|
3298
3298
|
} : "arrayValue" in t ? {
|
|
3299
3299
|
mapValue: {}
|
|
3300
|
-
} : "mapValue" in t ?
|
|
3300
|
+
} : "mapValue" in t ? ce : L();
|
|
3301
3301
|
}
|
|
3302
3302
|
|
|
3303
3303
|
function Ve(t, e) {
|
|
@@ -3474,23 +3474,23 @@ function Se(t, e) {
|
|
|
3474
3474
|
* Creates a document with no known version or data, but which can serve as
|
|
3475
3475
|
* base document for mutations.
|
|
3476
3476
|
*/ static newInvalidDocument(t) {
|
|
3477
|
-
return new xe(t, 0 /* INVALID */ ,
|
|
3477
|
+
return new xe(t, 0 /* INVALID */ , at.min(), at.min(), De.empty(), 0 /* SYNCED */);
|
|
3478
3478
|
}
|
|
3479
3479
|
/**
|
|
3480
3480
|
* Creates a new document that is known to exist with the given data at the
|
|
3481
3481
|
* given version.
|
|
3482
3482
|
*/ static newFoundDocument(t, e, n) {
|
|
3483
|
-
return new xe(t, 1 /* FOUND_DOCUMENT */ , e,
|
|
3483
|
+
return new xe(t, 1 /* FOUND_DOCUMENT */ , e, at.min(), n, 0 /* SYNCED */);
|
|
3484
3484
|
}
|
|
3485
3485
|
/** Creates a new document that is known to not exist at the given version. */ static newNoDocument(t, e) {
|
|
3486
|
-
return new xe(t, 2 /* NO_DOCUMENT */ , e,
|
|
3486
|
+
return new xe(t, 2 /* NO_DOCUMENT */ , e, at.min(), De.empty(), 0 /* SYNCED */);
|
|
3487
3487
|
}
|
|
3488
3488
|
/**
|
|
3489
3489
|
* Creates a new document that is known to exist at the given version but
|
|
3490
3490
|
* whose data is not known (e.g. a document that was updated without a known
|
|
3491
3491
|
* base document).
|
|
3492
3492
|
*/ static newUnknownDocument(t, e) {
|
|
3493
|
-
return new xe(t, 3 /* UNKNOWN_DOCUMENT */ , e,
|
|
3493
|
+
return new xe(t, 3 /* UNKNOWN_DOCUMENT */ , e, at.min(), De.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
|
|
3494
3494
|
}
|
|
3495
3495
|
/**
|
|
3496
3496
|
* Changes the document type to indicate that it exists and that its version
|
|
@@ -3518,7 +3518,7 @@ function Se(t, e) {
|
|
|
3518
3518
|
return this.documentState = 2 /* HAS_COMMITTED_MUTATIONS */ , this;
|
|
3519
3519
|
}
|
|
3520
3520
|
setHasLocalMutations() {
|
|
3521
|
-
return this.documentState = 1 /* HAS_LOCAL_MUTATIONS */ , this.version =
|
|
3521
|
+
return this.documentState = 1 /* HAS_LOCAL_MUTATIONS */ , this.version = at.min(),
|
|
3522
3522
|
this;
|
|
3523
3523
|
}
|
|
3524
3524
|
setReadTime(t) {
|
|
@@ -3715,10 +3715,10 @@ function Le(t, e, n) {
|
|
|
3715
3715
|
* Returns the value to use as the upper bound for ascending index segment at
|
|
3716
3716
|
* the provided `fieldPath` (or the lower bound for a descending segment).
|
|
3717
3717
|
*/ function Ue(t, e, n) {
|
|
3718
|
-
let s =
|
|
3718
|
+
let s = ce, i = !0;
|
|
3719
3719
|
// Process all filters to find a value for the current field segment
|
|
3720
3720
|
for (const n of Be(t, e)) {
|
|
3721
|
-
let t =
|
|
3721
|
+
let t = ce, e = !0;
|
|
3722
3722
|
switch (n.op) {
|
|
3723
3723
|
case ">=" /* GREATER_THAN_OR_EQUAL */ :
|
|
3724
3724
|
case ">" /* GREATER_THAN */ :
|
|
@@ -3737,7 +3737,7 @@ function Le(t, e, n) {
|
|
|
3737
3737
|
|
|
3738
3738
|
case "!=" /* NOT_EQUAL */ :
|
|
3739
3739
|
case "not-in" /* NOT_IN */ :
|
|
3740
|
-
t =
|
|
3740
|
+
t = ce;
|
|
3741
3741
|
// Remaining filters cannot be used as upper bounds.
|
|
3742
3742
|
}
|
|
3743
3743
|
Se({
|
|
@@ -3776,18 +3776,18 @@ function Le(t, e, n) {
|
|
|
3776
3776
|
/**
|
|
3777
3777
|
* Creates a filter based on the provided arguments.
|
|
3778
3778
|
*/ static create(t, e, n) {
|
|
3779
|
-
return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.
|
|
3779
|
+
return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.at(t, e, n) : new Ke(t, e, n) : "array-contains" /* ARRAY_CONTAINS */ === e ? new We(t, n) : "in" /* IN */ === e ? new ze(t, n) : "not-in" /* NOT_IN */ === e ? new He(t, n) : "array-contains-any" /* ARRAY_CONTAINS_ANY */ === e ? new Je(t, n) : new qe(t, e, n);
|
|
3780
3780
|
}
|
|
3781
|
-
static
|
|
3781
|
+
static at(t, e, n) {
|
|
3782
3782
|
return "in" /* IN */ === e ? new Ge(t, n) : new Qe(t, n);
|
|
3783
3783
|
}
|
|
3784
3784
|
matches(t) {
|
|
3785
3785
|
const e = t.data.field(this.field);
|
|
3786
3786
|
// Types do not have to match in NOT_EQUAL filters.
|
|
3787
|
-
return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.
|
|
3787
|
+
return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.ct(_e(e, this.value)) : null !== e && le(this.value) === le(e) && this.ct(_e(e, this.value));
|
|
3788
3788
|
// Only compare types with matching backend order (such as double and int).
|
|
3789
3789
|
}
|
|
3790
|
-
|
|
3790
|
+
ct(t) {
|
|
3791
3791
|
switch (this.op) {
|
|
3792
3792
|
case "<" /* LESS_THAN */ :
|
|
3793
3793
|
return t < 0;
|
|
@@ -3822,7 +3822,7 @@ class Ke extends qe {
|
|
|
3822
3822
|
}
|
|
3823
3823
|
matches(t) {
|
|
3824
3824
|
const e = dt.comparator(t.key, this.key);
|
|
3825
|
-
return this.
|
|
3825
|
+
return this.ct(e);
|
|
3826
3826
|
}
|
|
3827
3827
|
}
|
|
3828
3828
|
|
|
@@ -4009,7 +4009,7 @@ function un(t) {
|
|
|
4009
4009
|
return t.explicitOrderBy.length > 0 ? t.explicitOrderBy[0].field : null;
|
|
4010
4010
|
}
|
|
4011
4011
|
|
|
4012
|
-
function
|
|
4012
|
+
function an(t) {
|
|
4013
4013
|
for (const e of t.filters) if (e.ht()) return e.field;
|
|
4014
4014
|
return null;
|
|
4015
4015
|
}
|
|
@@ -4022,7 +4022,7 @@ function cn(t) {
|
|
|
4022
4022
|
* Returns whether the query matches a collection group rather than a specific
|
|
4023
4023
|
* collection.
|
|
4024
4024
|
*/
|
|
4025
|
-
function
|
|
4025
|
+
function cn(t) {
|
|
4026
4026
|
return null !== t.collectionGroup;
|
|
4027
4027
|
}
|
|
4028
4028
|
|
|
@@ -4034,7 +4034,7 @@ function an(t) {
|
|
|
4034
4034
|
const e = K(t);
|
|
4035
4035
|
if (null === e.lt) {
|
|
4036
4036
|
e.lt = [];
|
|
4037
|
-
const t =
|
|
4037
|
+
const t = an(e), n = un(e);
|
|
4038
4038
|
if (null !== t && null === n)
|
|
4039
4039
|
// In order to implicitly add key ordering, we must also add the
|
|
4040
4040
|
// inequality filter field for it to be a valid query.
|
|
@@ -4217,7 +4217,7 @@ function pn(t, e, n) {
|
|
|
4217
4217
|
* The return value is an IntegerValue if it can safely represent the value,
|
|
4218
4218
|
* otherwise a DoubleValue is returned.
|
|
4219
4219
|
*/ function En(t, e) {
|
|
4220
|
-
return
|
|
4220
|
+
return ae(e) ? Tn(e) : In(t, e);
|
|
4221
4221
|
}
|
|
4222
4222
|
|
|
4223
4223
|
/**
|
|
@@ -5012,13 +5012,13 @@ function os() {
|
|
|
5012
5012
|
|
|
5013
5013
|
const us = new qt(dt.comparator);
|
|
5014
5014
|
|
|
5015
|
-
function
|
|
5015
|
+
function as(...t) {
|
|
5016
5016
|
let e = us;
|
|
5017
5017
|
for (const n of t) e = e.insert(n.key, n);
|
|
5018
5018
|
return e;
|
|
5019
5019
|
}
|
|
5020
5020
|
|
|
5021
|
-
function
|
|
5021
|
+
function cs(t) {
|
|
5022
5022
|
let e = us;
|
|
5023
5023
|
return t.forEach(((t, n) => e = e.insert(t, n.overlayedDocument))), e;
|
|
5024
5024
|
}
|
|
@@ -5107,7 +5107,7 @@ function gs() {
|
|
|
5107
5107
|
// PORTING NOTE: Multi-tab only
|
|
5108
5108
|
static createSynthesizedRemoteEventForCurrentChange(t, e) {
|
|
5109
5109
|
const n = new Map;
|
|
5110
|
-
return n.set(t, ps.createSynthesizedTargetChangeForCurrentChange(t, e)), new ys(
|
|
5110
|
+
return n.set(t, ps.createSynthesizedTargetChangeForCurrentChange(t, e)), new ys(at.min(), n, gs(), os(), ws());
|
|
5111
5111
|
}
|
|
5112
5112
|
}
|
|
5113
5113
|
|
|
@@ -5411,7 +5411,7 @@ class Rs {
|
|
|
5411
5411
|
// until it is resolved, essentially exposing inconsistency between
|
|
5412
5412
|
// queries.
|
|
5413
5413
|
const n = new dt(t.path);
|
|
5414
|
-
this.Kt(e, n, xe.newNoDocument(n,
|
|
5414
|
+
this.Kt(e, n, xe.newNoDocument(n, at.min()));
|
|
5415
5415
|
} else U(1 === n); else {
|
|
5416
5416
|
this.Jt(e) !== n && (
|
|
5417
5417
|
// Existence filter mismatch: We reset the mapping and raise a new
|
|
@@ -5637,7 +5637,7 @@ function Cs(t, e) {
|
|
|
5637
5637
|
}
|
|
5638
5638
|
|
|
5639
5639
|
function Ns(t) {
|
|
5640
|
-
return U(!!t),
|
|
5640
|
+
return U(!!t), at.fromTimestamp(function(t) {
|
|
5641
5641
|
const e = Xt(t);
|
|
5642
5642
|
return new ut(e.seconds, e.nanos);
|
|
5643
5643
|
}(t));
|
|
@@ -5750,13 +5750,13 @@ function Qs(t, e) {
|
|
|
5750
5750
|
mapValue: {
|
|
5751
5751
|
fields: s.document.fields
|
|
5752
5752
|
}
|
|
5753
|
-
}), u = xe.newFoundDocument(i, r, o),
|
|
5754
|
-
n = new Is(
|
|
5753
|
+
}), u = xe.newFoundDocument(i, r, o), a = s.targetIds || [], c = s.removedTargetIds || [];
|
|
5754
|
+
n = new Is(a, c, u.key, u);
|
|
5755
5755
|
} else if ("documentDelete" in e) {
|
|
5756
5756
|
e.documentDelete;
|
|
5757
5757
|
const s = e.documentDelete;
|
|
5758
5758
|
s.document;
|
|
5759
|
-
const i = Fs(t, s.document), r = s.readTime ? Ns(s.readTime) :
|
|
5759
|
+
const i = Fs(t, s.document), r = s.readTime ? Ns(s.readTime) : at.min(), o = xe.newNoDocument(i, r), u = s.removedTargetIds || [];
|
|
5760
5760
|
n = new Is([], u, o.key, o);
|
|
5761
5761
|
} else if ("documentRemove" in e) {
|
|
5762
5762
|
e.documentRemove;
|
|
@@ -5870,7 +5870,7 @@ function zs(t, e) {
|
|
|
5870
5870
|
return t && t.length > 0 ? (U(void 0 !== e), t.map((t => function(t, e) {
|
|
5871
5871
|
// NOTE: Deletes don't have an updateTime.
|
|
5872
5872
|
let n = t.updateTime ? Ns(t.updateTime) : Ns(e);
|
|
5873
|
-
return n.isEqual(
|
|
5873
|
+
return n.isEqual(at.min()) && (
|
|
5874
5874
|
// The Firestore Emulator currently returns an update time of 0 for
|
|
5875
5875
|
// deletes of non-existing documents (rather than null). This breaks the
|
|
5876
5876
|
// test "get deleted doc while offline with source=cache" as NoDocuments
|
|
@@ -6013,18 +6013,18 @@ function Ys(t) {
|
|
|
6013
6013
|
let e;
|
|
6014
6014
|
return e = "object" == typeof t ? t.value : t, oe(e) ? null : e;
|
|
6015
6015
|
}(n.limit));
|
|
6016
|
-
let
|
|
6017
|
-
n.startAt && (
|
|
6016
|
+
let a = null;
|
|
6017
|
+
n.startAt && (a = function(t) {
|
|
6018
6018
|
const e = !!t.before, n = t.values || [];
|
|
6019
6019
|
return new Ye(n, e);
|
|
6020
6020
|
}(n.startAt));
|
|
6021
|
-
let
|
|
6022
|
-
return n.endAt && (
|
|
6021
|
+
let c = null;
|
|
6022
|
+
return n.endAt && (c = function(t) {
|
|
6023
6023
|
const e = !t.before, n = t.values || [];
|
|
6024
6024
|
return new Ye(n, e);
|
|
6025
6025
|
}
|
|
6026
6026
|
// visible for testing
|
|
6027
|
-
(n.endAt)), sn(e, i, o, r, u, "F" /* First */ ,
|
|
6027
|
+
(n.endAt)), sn(e, i, o, r, u, "F" /* First */ , a, c);
|
|
6028
6028
|
}
|
|
6029
6029
|
|
|
6030
6030
|
function Xs(t, e) {
|
|
@@ -6171,13 +6171,13 @@ function ui(t) {
|
|
|
6171
6171
|
/**
|
|
6172
6172
|
* Encodes a resource path into a IndexedDb-compatible string form.
|
|
6173
6173
|
*/
|
|
6174
|
-
function
|
|
6174
|
+
function ai(t) {
|
|
6175
6175
|
let e = "";
|
|
6176
|
-
for (let n = 0; n < t.length; n++) e.length > 0 && (e = hi(e)), e =
|
|
6176
|
+
for (let n = 0; n < t.length; n++) e.length > 0 && (e = hi(e)), e = ci(t.get(n), e);
|
|
6177
6177
|
return hi(e);
|
|
6178
6178
|
}
|
|
6179
6179
|
|
|
6180
|
-
/** Encodes a single segment of a resource path into the given result */ function
|
|
6180
|
+
/** Encodes a single segment of a resource path into the given result */ function ci(t, e) {
|
|
6181
6181
|
let n = e;
|
|
6182
6182
|
const s = t.length;
|
|
6183
6183
|
for (let e = 0; e < s; e++) {
|
|
@@ -6293,14 +6293,14 @@ function ci(t) {
|
|
|
6293
6293
|
* index to iterate over all at document mutations for a given path or lower.
|
|
6294
6294
|
*/
|
|
6295
6295
|
function di(t, e) {
|
|
6296
|
-
return [ t,
|
|
6296
|
+
return [ t, ai(e) ];
|
|
6297
6297
|
}
|
|
6298
6298
|
|
|
6299
6299
|
/**
|
|
6300
6300
|
* Creates a full index key of [userId, encodedPath, batchId] for inserting
|
|
6301
6301
|
* and deleting into the DbDocumentMutations index.
|
|
6302
6302
|
*/ function _i(t, e, n) {
|
|
6303
|
-
return [ t,
|
|
6303
|
+
return [ t, ai(e), n ];
|
|
6304
6304
|
}
|
|
6305
6305
|
|
|
6306
6306
|
/**
|
|
@@ -6420,7 +6420,7 @@ function Mi(t, e) {
|
|
|
6420
6420
|
// patch mutation as the overlay.
|
|
6421
6421
|
o = e.has(s.key) ? null : o;
|
|
6422
6422
|
const u = Un(r, o);
|
|
6423
|
-
null !== u && n.set(s.key, u), r.isValidDocument() || r.convertToNoDocument(
|
|
6423
|
+
null !== u && n.set(s.key, u), r.isValidDocument() || r.convertToNoDocument(at.min());
|
|
6424
6424
|
})), n;
|
|
6425
6425
|
}
|
|
6426
6426
|
keys() {
|
|
@@ -6524,11 +6524,11 @@ function Mi(t, e) {
|
|
|
6524
6524
|
*/
|
|
6525
6525
|
s,
|
|
6526
6526
|
/** The latest snapshot version seen for this target. */
|
|
6527
|
-
i =
|
|
6527
|
+
i = at.min()
|
|
6528
6528
|
/**
|
|
6529
6529
|
* The maximum snapshot version at which the associated view
|
|
6530
6530
|
* contained no limbo documents.
|
|
6531
|
-
*/ , r =
|
|
6531
|
+
*/ , r = at.min()
|
|
6532
6532
|
/**
|
|
6533
6533
|
* An opaque, server-assigned token that allows watching a target to be
|
|
6534
6534
|
* resumed after disconnecting without retransmitting all the data that
|
|
@@ -6591,7 +6591,7 @@ function Mi(t, e) {
|
|
|
6591
6591
|
}
|
|
6592
6592
|
return e.readTime && n.setReadTime(function(t) {
|
|
6593
6593
|
const e = new ut(t[0], t[1]);
|
|
6594
|
-
return
|
|
6594
|
+
return at.fromTimestamp(e);
|
|
6595
6595
|
}(e.readTime)), n;
|
|
6596
6596
|
}
|
|
6597
6597
|
|
|
@@ -6637,7 +6637,7 @@ function Qi(t) {
|
|
|
6637
6637
|
|
|
6638
6638
|
function ji(t) {
|
|
6639
6639
|
const e = new ut(t.seconds, t.nanoseconds);
|
|
6640
|
-
return
|
|
6640
|
+
return at.fromTimestamp(e);
|
|
6641
6641
|
}
|
|
6642
6642
|
|
|
6643
6643
|
/** Encodes a batch of mutations into a DbMutationBatch for local storage. */
|
|
@@ -6662,7 +6662,7 @@ function Wi(t, e) {
|
|
|
6662
6662
|
}
|
|
6663
6663
|
|
|
6664
6664
|
/** Decodes a DbTarget into TargetData */ function zi(t) {
|
|
6665
|
-
const e = ji(t.readTime), n = void 0 !== t.lastLimboFreeSnapshotVersion ? ji(t.lastLimboFreeSnapshotVersion) :
|
|
6665
|
+
const e = ji(t.readTime), n = void 0 !== t.lastLimboFreeSnapshotVersion ? ji(t.lastLimboFreeSnapshotVersion) : at.min();
|
|
6666
6666
|
let s;
|
|
6667
6667
|
var i;
|
|
6668
6668
|
return void 0 !== t.query.documents ? (U(1 === (i = t.query).documents.length),
|
|
@@ -6720,7 +6720,7 @@ function Yi(t, e) {
|
|
|
6720
6720
|
*/
|
|
6721
6721
|
function Xi(t, e) {
|
|
6722
6722
|
const n = e.path.lastSegment();
|
|
6723
|
-
return [ t,
|
|
6723
|
+
return [ t, ai(e.path.popLast()), n ];
|
|
6724
6724
|
}
|
|
6725
6725
|
|
|
6726
6726
|
function Zi(t, e, n, s) {
|
|
@@ -6729,7 +6729,7 @@ function Zi(t, e, n, s) {
|
|
|
6729
6729
|
uid: e.uid || "",
|
|
6730
6730
|
sequenceNumber: n,
|
|
6731
6731
|
readTime: Qi(s.readTime),
|
|
6732
|
-
documentKey:
|
|
6732
|
+
documentKey: ai(s.documentKey.path),
|
|
6733
6733
|
largestBatchId: s.largestBatchId
|
|
6734
6734
|
};
|
|
6735
6735
|
}
|
|
@@ -6851,7 +6851,7 @@ function Zi(t, e, n, s) {
|
|
|
6851
6851
|
removeOverlaysForBatchId(t, e, n) {
|
|
6852
6852
|
const s = new Set;
|
|
6853
6853
|
// Get the set of unique collection paths.
|
|
6854
|
-
e.forEach((t => s.add(
|
|
6854
|
+
e.forEach((t => s.add(ai(t.getCollectionPath()))));
|
|
6855
6855
|
const i = [];
|
|
6856
6856
|
return s.forEach((e => {
|
|
6857
6857
|
const s = IDBKeyRange.bound([ this.userId, e, n ], [ this.userId, e, n + 1 ],
|
|
@@ -6861,7 +6861,7 @@ function Zi(t, e, n, s) {
|
|
|
6861
6861
|
})), Pt.waitFor(i);
|
|
6862
6862
|
}
|
|
6863
6863
|
getOverlaysForCollection(t, e, n) {
|
|
6864
|
-
const s = hs(), i =
|
|
6864
|
+
const s = hs(), i = ai(e), r = IDBKeyRange.bound([ this.userId, i, n ], [ this.userId, i, Number.POSITIVE_INFINITY ],
|
|
6865
6865
|
/*lowerOpen=*/ !0);
|
|
6866
6866
|
return ir(t).K("collectionPathOverlayIndex", r).next((t => {
|
|
6867
6867
|
for (const e of t) {
|
|
@@ -6946,52 +6946,52 @@ class rr {
|
|
|
6946
6946
|
e.ue();
|
|
6947
6947
|
}
|
|
6948
6948
|
oe(t, e) {
|
|
6949
|
-
if ("nullValue" in t) this.
|
|
6950
|
-
e.
|
|
6949
|
+
if ("nullValue" in t) this.ae(e, 5); else if ("booleanValue" in t) this.ae(e, 10),
|
|
6950
|
+
e.ce(t.booleanValue ? 1 : 0); else if ("integerValue" in t) this.ae(e, 15), e.ce(Zt(t.integerValue)); else if ("doubleValue" in t) {
|
|
6951
6951
|
const n = Zt(t.doubleValue);
|
|
6952
|
-
isNaN(n) ? this.
|
|
6952
|
+
isNaN(n) ? this.ae(e, 13) : (this.ae(e, 15), ue(n) ?
|
|
6953
6953
|
// -0.0, 0 and 0.0 are all considered the same
|
|
6954
|
-
e.
|
|
6954
|
+
e.ce(0) : e.ce(n));
|
|
6955
6955
|
} else if ("timestampValue" in t) {
|
|
6956
6956
|
const n = t.timestampValue;
|
|
6957
|
-
this.
|
|
6958
|
-
} else if ("stringValue" in t) this.le(t.stringValue, e), this.fe(e); else if ("bytesValue" in t) this.
|
|
6957
|
+
this.ae(e, 20), "string" == typeof n ? e.he(n) : (e.he(`${n.seconds || ""}`), e.ce(n.nanos || 0));
|
|
6958
|
+
} else if ("stringValue" in t) this.le(t.stringValue, e), this.fe(e); else if ("bytesValue" in t) this.ae(e, 30),
|
|
6959
6959
|
e.de(te(t.bytesValue)), this.fe(e); else if ("referenceValue" in t) this._e(t.referenceValue, e); else if ("geoPointValue" in t) {
|
|
6960
6960
|
const n = t.geoPointValue;
|
|
6961
|
-
this.
|
|
6962
|
-
} else "mapValue" in t ? be(t) ? this.
|
|
6961
|
+
this.ae(e, 45), e.ce(n.latitude || 0), e.ce(n.longitude || 0);
|
|
6962
|
+
} else "mapValue" in t ? be(t) ? this.ae(e, Number.MAX_SAFE_INTEGER) : (this.we(t.mapValue, e),
|
|
6963
6963
|
this.fe(e)) : "arrayValue" in t ? (this.me(t.arrayValue, e), this.fe(e)) : L();
|
|
6964
6964
|
}
|
|
6965
6965
|
le(t, e) {
|
|
6966
|
-
this.
|
|
6966
|
+
this.ae(e, 25), this.ge(t, e);
|
|
6967
6967
|
}
|
|
6968
6968
|
ge(t, e) {
|
|
6969
6969
|
e.he(t);
|
|
6970
6970
|
}
|
|
6971
6971
|
we(t, e) {
|
|
6972
6972
|
const n = t.fields || {};
|
|
6973
|
-
this.
|
|
6973
|
+
this.ae(e, 55);
|
|
6974
6974
|
for (const t of Object.keys(n)) this.le(t, e), this.oe(n[t], e);
|
|
6975
6975
|
}
|
|
6976
6976
|
me(t, e) {
|
|
6977
6977
|
const n = t.values || [];
|
|
6978
|
-
this.
|
|
6978
|
+
this.ae(e, 50);
|
|
6979
6979
|
for (const t of n) this.oe(t, e);
|
|
6980
6980
|
}
|
|
6981
6981
|
_e(t, e) {
|
|
6982
|
-
this.
|
|
6982
|
+
this.ae(e, 37);
|
|
6983
6983
|
dt.fromName(t).path.forEach((t => {
|
|
6984
|
-
this.
|
|
6984
|
+
this.ae(e, 60), this.ge(t, e);
|
|
6985
6985
|
}));
|
|
6986
6986
|
}
|
|
6987
|
-
|
|
6988
|
-
t.
|
|
6987
|
+
ae(t, e) {
|
|
6988
|
+
t.ce(e);
|
|
6989
6989
|
}
|
|
6990
6990
|
fe(t) {
|
|
6991
6991
|
// While the SDK does not implement truncation, the truncation marker is
|
|
6992
6992
|
// used to terminate all variable length values (which are strings, bytes,
|
|
6993
6993
|
// references, arrays and maps).
|
|
6994
|
-
t.
|
|
6994
|
+
t.ce(2);
|
|
6995
6995
|
}
|
|
6996
6996
|
}
|
|
6997
6997
|
|
|
@@ -7037,7 +7037,7 @@ function ur(t) {
|
|
|
7037
7037
|
* behavior defined by the backend.
|
|
7038
7038
|
*
|
|
7039
7039
|
* The code is ported from its Java counterpart.
|
|
7040
|
-
*/ class
|
|
7040
|
+
*/ class ar {
|
|
7041
7041
|
constructor() {
|
|
7042
7042
|
this.buffer = new Uint8Array(1024), this.position = 0;
|
|
7043
7043
|
}
|
|
@@ -7171,7 +7171,7 @@ function ur(t) {
|
|
|
7171
7171
|
}
|
|
7172
7172
|
}
|
|
7173
7173
|
|
|
7174
|
-
class
|
|
7174
|
+
class cr {
|
|
7175
7175
|
constructor(t) {
|
|
7176
7176
|
this.Me = t;
|
|
7177
7177
|
}
|
|
@@ -7181,7 +7181,7 @@ class ar {
|
|
|
7181
7181
|
he(t) {
|
|
7182
7182
|
this.Me.be(t);
|
|
7183
7183
|
}
|
|
7184
|
-
|
|
7184
|
+
ce(t) {
|
|
7185
7185
|
this.Me.ve(t);
|
|
7186
7186
|
}
|
|
7187
7187
|
ue() {
|
|
@@ -7199,7 +7199,7 @@ class hr {
|
|
|
7199
7199
|
he(t) {
|
|
7200
7200
|
this.Me.Pe(t);
|
|
7201
7201
|
}
|
|
7202
|
-
|
|
7202
|
+
ce(t) {
|
|
7203
7203
|
this.Me.De(t);
|
|
7204
7204
|
}
|
|
7205
7205
|
ue() {
|
|
@@ -7212,7 +7212,7 @@ class hr {
|
|
|
7212
7212
|
* actual encoding.
|
|
7213
7213
|
*/ class lr {
|
|
7214
7214
|
constructor() {
|
|
7215
|
-
this.Me = new
|
|
7215
|
+
this.Me = new ar, this.Fe = new cr(this.Me), this.$e = new hr(this.Me);
|
|
7216
7216
|
}
|
|
7217
7217
|
seed(t) {
|
|
7218
7218
|
this.Me.seed(t);
|
|
@@ -7523,7 +7523,7 @@ class pr {
|
|
|
7523
7523
|
}));
|
|
7524
7524
|
const i = {
|
|
7525
7525
|
collectionId: n,
|
|
7526
|
-
parent:
|
|
7526
|
+
parent: ai(s)
|
|
7527
7527
|
};
|
|
7528
7528
|
return Ir(t).put(i);
|
|
7529
7529
|
}
|
|
@@ -7604,7 +7604,7 @@ class pr {
|
|
|
7604
7604
|
/**
|
|
7605
7605
|
* Returns the list of values that are used in != or NOT_IN filters. Returns
|
|
7606
7606
|
* `null` if there are no such filters.
|
|
7607
|
-
*/ (r, i),
|
|
7607
|
+
*/ (r, i), a = function(t, e) {
|
|
7608
7608
|
const n = new Map;
|
|
7609
7609
|
for (const s of mt(e)) for (const e of Be(t, s.fieldPath)) switch (e.op) {
|
|
7610
7610
|
case "==" /* EQUAL */ :
|
|
@@ -7628,7 +7628,7 @@ class pr {
|
|
|
7628
7628
|
* Returns a lower bound of field values that can be used as a starting point to
|
|
7629
7629
|
* scan the index defined by `fieldIndex`. Returns `MIN_VALUE` if no lower bound
|
|
7630
7630
|
* exists.
|
|
7631
|
-
*/ (r, i),
|
|
7631
|
+
*/ (r, i), c = function(t, e) {
|
|
7632
7632
|
const n = [];
|
|
7633
7633
|
let s = !0;
|
|
7634
7634
|
// For each segment, retrieve a lower bound if there is a suitable filter or
|
|
@@ -7653,7 +7653,7 @@ class pr {
|
|
|
7653
7653
|
n.push(e.value), s && (s = e.inclusive);
|
|
7654
7654
|
}
|
|
7655
7655
|
return new Ye(n, s);
|
|
7656
|
-
}(r, i), l = this.Ze(i, r,
|
|
7656
|
+
}(r, i), l = this.Ze(i, r, c), f = this.Ze(i, r, h), d = this.tn(i, r, a), _ = this.en(i.indexId, u, l, c.inclusive, f, h.inclusive, d);
|
|
7657
7657
|
return Pt.forEach(_, (i => n.j(i, e.limit).next((e => {
|
|
7658
7658
|
e.forEach((e => {
|
|
7659
7659
|
const n = dt.fromSegments(e.documentKey);
|
|
@@ -7679,13 +7679,13 @@ class pr {
|
|
|
7679
7679
|
// distributed normal form, but adapted for array values. We create a single
|
|
7680
7680
|
// index range per value in an ARRAY_CONTAINS or ARRAY_CONTAINS_ANY filter
|
|
7681
7681
|
// combined with the values from the query bounds.
|
|
7682
|
-
const u = (null != e ? e.length : 1) * Math.max(n.length, i.length),
|
|
7682
|
+
const u = (null != e ? e.length : 1) * Math.max(n.length, i.length), a = u / (null != e ? e.length : 1), c = [];
|
|
7683
7683
|
for (let h = 0; h < u; ++h) {
|
|
7684
|
-
const u = e ? this.nn(e[h /
|
|
7684
|
+
const u = e ? this.nn(e[h / a]) : yr, l = this.sn(t, u, n[h % a], s), f = this.rn(t, u, i[h % a], r), d = o.map((e => this.sn(t, u, e,
|
|
7685
7685
|
/* inclusive= */ !0)));
|
|
7686
|
-
|
|
7686
|
+
c.push(...this.createRange(l, f, d));
|
|
7687
7687
|
}
|
|
7688
|
-
return
|
|
7688
|
+
return c;
|
|
7689
7689
|
}
|
|
7690
7690
|
/** Generates the lower bound for `arrayValue` and `directionalValue`. */ sn(t, e, n, s) {
|
|
7691
7691
|
const i = new fr(t, dt.empty(), e, n);
|
|
@@ -7769,7 +7769,7 @@ class pr {
|
|
|
7769
7769
|
let i = 0;
|
|
7770
7770
|
for (const r of mt(t)) {
|
|
7771
7771
|
const t = n[i++];
|
|
7772
|
-
for (const n of s) if (this.
|
|
7772
|
+
for (const n of s) if (this.an(e, r.fieldPath) && Ie(t)) s = this.cn(s, r, t); else {
|
|
7773
7773
|
const e = n.Be(r.kind);
|
|
7774
7774
|
rr.ye.re(t, e);
|
|
7775
7775
|
}
|
|
@@ -7793,7 +7793,7 @@ class pr {
|
|
|
7793
7793
|
* The method appends each value to all existing encoders (e.g. filter("a",
|
|
7794
7794
|
* "==", "a1").filter("b", "in", ["b1", "b2"]) becomes ["a1,b1", "a1,b2"]). A
|
|
7795
7795
|
* list of new encoders is returned.
|
|
7796
|
-
*/
|
|
7796
|
+
*/ cn(t, e, n) {
|
|
7797
7797
|
const s = [ ...t ], i = [];
|
|
7798
7798
|
for (const t of n.arrayValue.values || []) for (const n of s) {
|
|
7799
7799
|
const s = new lr;
|
|
@@ -7801,7 +7801,7 @@ class pr {
|
|
|
7801
7801
|
}
|
|
7802
7802
|
return i;
|
|
7803
7803
|
}
|
|
7804
|
-
|
|
7804
|
+
an(t, e) {
|
|
7805
7805
|
return !!t.filters.find((t => t instanceof qe && t.field.isEqual(e) && ("in" /* IN */ === t.op || "not-in" /* NOT_IN */ === t.op)));
|
|
7806
7806
|
}
|
|
7807
7807
|
getFieldIndexes(t, e) {
|
|
@@ -7885,13 +7885,13 @@ class pr {
|
|
|
7885
7885
|
const r = [];
|
|
7886
7886
|
return function(t, e, n, s, i) {
|
|
7887
7887
|
const r = t.getIterator(), o = e.getIterator();
|
|
7888
|
-
let u = Wt(r),
|
|
7888
|
+
let u = Wt(r), a = Wt(o);
|
|
7889
7889
|
// Walk through the two sets at the same time, using the ordering defined by
|
|
7890
7890
|
// `comparator`.
|
|
7891
|
-
for (;u ||
|
|
7891
|
+
for (;u || a; ) {
|
|
7892
7892
|
let t = !1, e = !1;
|
|
7893
|
-
if (u &&
|
|
7894
|
-
const s = n(u,
|
|
7893
|
+
if (u && a) {
|
|
7894
|
+
const s = n(u, a);
|
|
7895
7895
|
s < 0 ?
|
|
7896
7896
|
// The element was removed if the next element in our ordered
|
|
7897
7897
|
// walkthrough is only in `before`.
|
|
@@ -7900,7 +7900,7 @@ class pr {
|
|
|
7900
7900
|
// is only in `after`.
|
|
7901
7901
|
t = !0);
|
|
7902
7902
|
} else null != u ? e = !0 : t = !0;
|
|
7903
|
-
t ? (s(
|
|
7903
|
+
t ? (s(a), a = Wt(o)) : e ? (i(u), u = Wt(r)) : (u = Wt(r), a = Wt(o));
|
|
7904
7904
|
}
|
|
7905
7905
|
}(s, i, dr, (
|
|
7906
7906
|
/* onAdd= */ s => {
|
|
@@ -8051,18 +8051,18 @@ class Pr {
|
|
|
8051
8051
|
function vr(t, e, n) {
|
|
8052
8052
|
const s = t.store("mutations"), i = t.store("documentMutations"), r = [], o = IDBKeyRange.only(n.batchId);
|
|
8053
8053
|
let u = 0;
|
|
8054
|
-
const
|
|
8054
|
+
const a = s.J({
|
|
8055
8055
|
range: o
|
|
8056
8056
|
}, ((t, e, n) => (u++, n.delete())));
|
|
8057
|
-
r.push(
|
|
8057
|
+
r.push(a.next((() => {
|
|
8058
8058
|
U(1 === u);
|
|
8059
8059
|
})));
|
|
8060
|
-
const
|
|
8060
|
+
const c = [];
|
|
8061
8061
|
for (const t of n.mutations) {
|
|
8062
8062
|
const s = _i(e, t.key.path, n.batchId);
|
|
8063
|
-
r.push(i.delete(s)),
|
|
8063
|
+
r.push(i.delete(s)), c.push(t.key);
|
|
8064
8064
|
}
|
|
8065
|
-
return Pt.waitFor(r).next((() =>
|
|
8065
|
+
return Pt.waitFor(r).next((() => c));
|
|
8066
8066
|
}
|
|
8067
8067
|
|
|
8068
8068
|
/**
|
|
@@ -8155,7 +8155,7 @@ class Sr {
|
|
|
8155
8155
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8156
8156
|
return r.add({}).next((o => {
|
|
8157
8157
|
U("number" == typeof o);
|
|
8158
|
-
const u = new Fi(o, e, n, s),
|
|
8158
|
+
const u = new Fi(o, e, n, s), a = function(t, e, n) {
|
|
8159
8159
|
const s = n.baseMutations.map((e => js(t.ne, e))), i = n.mutations.map((e => js(t.ne, e)));
|
|
8160
8160
|
return {
|
|
8161
8161
|
userId: e,
|
|
@@ -8164,17 +8164,17 @@ class Sr {
|
|
|
8164
8164
|
baseMutations: s,
|
|
8165
8165
|
mutations: i
|
|
8166
8166
|
};
|
|
8167
|
-
}(this.wt, this.userId, u),
|
|
8167
|
+
}(this.wt, this.userId, u), c = [];
|
|
8168
8168
|
let h = new Qt(((t, e) => it(t.canonicalString(), e.canonicalString())));
|
|
8169
8169
|
for (const t of s) {
|
|
8170
8170
|
const e = _i(this.userId, t.key.path, o);
|
|
8171
|
-
h = h.add(t.key.path.popLast()),
|
|
8171
|
+
h = h.add(t.key.path.popLast()), c.push(r.put(a)), c.push(i.put(e, wi));
|
|
8172
8172
|
}
|
|
8173
8173
|
return h.forEach((e => {
|
|
8174
|
-
|
|
8174
|
+
c.push(this.indexManager.addToCollectionParentIndex(t, e));
|
|
8175
8175
|
})), t.addOnCommittedListener((() => {
|
|
8176
8176
|
this.gn[o] = u.keys();
|
|
8177
|
-
})), Pt.waitFor(
|
|
8177
|
+
})), Pt.waitFor(c).next((() => u));
|
|
8178
8178
|
}));
|
|
8179
8179
|
}
|
|
8180
8180
|
lookupMutationBatch(t, e) {
|
|
@@ -8228,7 +8228,7 @@ class Sr {
|
|
|
8228
8228
|
return xr(t).J({
|
|
8229
8229
|
range: s
|
|
8230
8230
|
}, ((n, s, r) => {
|
|
8231
|
-
const [o, u,
|
|
8231
|
+
const [o, u, a] = n, c = li(u);
|
|
8232
8232
|
// Only consider rows matching exactly the specific key of
|
|
8233
8233
|
// interest. Note that because we order by path first, and we
|
|
8234
8234
|
// order terminators before path separators, we'll encounter all
|
|
@@ -8236,9 +8236,9 @@ class Sr {
|
|
|
8236
8236
|
// the rows for documentKey will occur before any rows for
|
|
8237
8237
|
// documents nested in a subcollection beneath documentKey so we
|
|
8238
8238
|
// can stop as soon as we hit any such row.
|
|
8239
|
-
if (o === this.userId && e.path.isEqual(
|
|
8239
|
+
if (o === this.userId && e.path.isEqual(c))
|
|
8240
8240
|
// Look up the mutation batch in the store.
|
|
8241
|
-
return Cr(t).get(
|
|
8241
|
+
return Cr(t).get(a).next((t => {
|
|
8242
8242
|
if (!t) throw L();
|
|
8243
8243
|
U(t.userId === this.userId), i.push(Wi(this.wt, t));
|
|
8244
8244
|
}));
|
|
@@ -8252,7 +8252,7 @@ class Sr {
|
|
|
8252
8252
|
const i = di(this.userId, e.path), r = IDBKeyRange.lowerBound(i), o = xr(t).J({
|
|
8253
8253
|
range: r
|
|
8254
8254
|
}, ((t, s, i) => {
|
|
8255
|
-
const [r, o, u] = t,
|
|
8255
|
+
const [r, o, u] = t, a = li(o);
|
|
8256
8256
|
// Only consider rows matching exactly the specific key of
|
|
8257
8257
|
// interest. Note that because we order by path first, and we
|
|
8258
8258
|
// order terminators before path separators, we'll encounter all
|
|
@@ -8260,7 +8260,7 @@ class Sr {
|
|
|
8260
8260
|
// the rows for documentKey will occur before any rows for
|
|
8261
8261
|
// documents nested in a subcollection beneath documentKey so we
|
|
8262
8262
|
// can stop as soon as we hit any such row.
|
|
8263
|
-
r === this.userId && e.path.isEqual(
|
|
8263
|
+
r === this.userId && e.path.isEqual(a) ? n = n.add(u) : i.done();
|
|
8264
8264
|
}));
|
|
8265
8265
|
s.push(o);
|
|
8266
8266
|
})), Pt.waitFor(s).next((() => this.pn(t, n)));
|
|
@@ -8274,14 +8274,14 @@ class Sr {
|
|
|
8274
8274
|
return xr(t).J({
|
|
8275
8275
|
range: r
|
|
8276
8276
|
}, ((t, e, i) => {
|
|
8277
|
-
const [r, u,
|
|
8278
|
-
r === this.userId && n.isPrefixOf(
|
|
8277
|
+
const [r, u, a] = t, c = li(u);
|
|
8278
|
+
r === this.userId && n.isPrefixOf(c) ?
|
|
8279
8279
|
// Rows with document keys more than one segment longer than the
|
|
8280
8280
|
// query path can't be matches. For example, a query on 'rooms'
|
|
8281
8281
|
// can't match the document /rooms/abc/messages/xyx.
|
|
8282
8282
|
// TODO(mcg): we'll need a different scanner when we implement
|
|
8283
8283
|
// ancestor queries.
|
|
8284
|
-
|
|
8284
|
+
c.length === s && (o = o.add(a)) : i.done();
|
|
8285
8285
|
})).next((() => this.pn(t, o)));
|
|
8286
8286
|
}
|
|
8287
8287
|
pn(t, e) {
|
|
@@ -8354,7 +8354,7 @@ class Sr {
|
|
|
8354
8354
|
range: r,
|
|
8355
8355
|
H: !0
|
|
8356
8356
|
}, ((t, n, s) => {
|
|
8357
|
-
const [r, u, /*batchID*/
|
|
8357
|
+
const [r, u, /*batchID*/ a] = t;
|
|
8358
8358
|
r === e && u === i && (o = !0), s.done();
|
|
8359
8359
|
})).next((() => o));
|
|
8360
8360
|
}
|
|
@@ -8462,7 +8462,7 @@ class kr {
|
|
|
8462
8462
|
}));
|
|
8463
8463
|
}
|
|
8464
8464
|
getLastRemoteSnapshotVersion(t) {
|
|
8465
|
-
return this.bn(t).next((t =>
|
|
8465
|
+
return this.bn(t).next((t => at.fromTimestamp(new ut(t.lastRemoteSnapshotVersion.seconds, t.lastRemoteSnapshotVersion.nanoseconds))));
|
|
8466
8466
|
}
|
|
8467
8467
|
getHighestSequenceNumber(t) {
|
|
8468
8468
|
return this.bn(t).next((t => t.highestListenSequenceNumber));
|
|
@@ -8545,7 +8545,7 @@ class kr {
|
|
|
8545
8545
|
// IndexedDb.
|
|
8546
8546
|
const s = [], i = $r(t);
|
|
8547
8547
|
return e.forEach((e => {
|
|
8548
|
-
const r =
|
|
8548
|
+
const r = ai(e.path);
|
|
8549
8549
|
s.push(i.put({
|
|
8550
8550
|
targetId: n,
|
|
8551
8551
|
path: r
|
|
@@ -8557,7 +8557,7 @@ class kr {
|
|
|
8557
8557
|
// IndexedDb.
|
|
8558
8558
|
const s = $r(t);
|
|
8559
8559
|
return Pt.forEach(e, (e => {
|
|
8560
|
-
const i =
|
|
8560
|
+
const i = ai(e.path);
|
|
8561
8561
|
return Pt.waitFor([ s.delete([ n, i ]), this.referenceDelegate.removeReference(t, n, e) ]);
|
|
8562
8562
|
}));
|
|
8563
8563
|
}
|
|
@@ -8581,7 +8581,7 @@ class kr {
|
|
|
8581
8581
|
})).next((() => i));
|
|
8582
8582
|
}
|
|
8583
8583
|
containsKey(t, e) {
|
|
8584
|
-
const n =
|
|
8584
|
+
const n = ai(e.path), s = IDBKeyRange.bound([ n ], [ ot(n) ],
|
|
8585
8585
|
/*lowerOpen=*/ !1,
|
|
8586
8586
|
/*upperOpen=*/ !0);
|
|
8587
8587
|
let i = 0;
|
|
@@ -8732,16 +8732,16 @@ class kr {
|
|
|
8732
8732
|
return this.On.getCacheSize(t);
|
|
8733
8733
|
}
|
|
8734
8734
|
$n(t, e) {
|
|
8735
|
-
let n, s, i, r, o,
|
|
8735
|
+
let n, s, i, r, o, a, c;
|
|
8736
8736
|
const h = Date.now();
|
|
8737
8737
|
return this.calculateTargetCount(t, this.params.percentileToCollect).next((e => (
|
|
8738
8738
|
// Cap at the configured max
|
|
8739
8739
|
e > this.params.maximumSequenceNumbersToCollect ? (M("LruGarbageCollector", `Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${e}`),
|
|
8740
8740
|
s = this.params.maximumSequenceNumbersToCollect) : s = e, r = Date.now(), this.nthSequenceNumber(t, s)))).next((s => (n = s,
|
|
8741
|
-
o = Date.now(), this.removeTargets(t, n, e)))).next((e => (i = e,
|
|
8741
|
+
o = Date.now(), this.removeTargets(t, n, e)))).next((e => (i = e, a = Date.now(),
|
|
8742
8742
|
this.removeOrphanedDocuments(t, n)))).next((t => {
|
|
8743
|
-
if (
|
|
8744
|
-
M("LruGarbageCollector", `LRU Garbage Collection\n\tCounted targets in ${r - h}ms\n\tDetermined least recently used ${s} in ` + (o - r) + "ms\n" + `\tRemoved ${i} targets in ` + (
|
|
8743
|
+
if (c = Date.now(), k() <= LogLevel.DEBUG) {
|
|
8744
|
+
M("LruGarbageCollector", `LRU Garbage Collection\n\tCounted targets in ${r - h}ms\n\tDetermined least recently used ${s} in ` + (o - r) + "ms\n" + `\tRemoved ${i} targets in ` + (a - o) + "ms\n" + `\tRemoved ${t} documents in ` + (c - a) + "ms\n" + `Total Duration: ${c - h}ms`);
|
|
8745
8745
|
}
|
|
8746
8746
|
return Pt.resolve({
|
|
8747
8747
|
didRun: !0,
|
|
@@ -8824,7 +8824,7 @@ class Kr {
|
|
|
8824
8824
|
if (!e)
|
|
8825
8825
|
// Our size accounting requires us to read all documents before
|
|
8826
8826
|
// removing them.
|
|
8827
|
-
return i++, n.getEntry(t, r).next((() => (n.removeEntry(r,
|
|
8827
|
+
return i++, n.getEntry(t, r).next((() => (n.removeEntry(r, at.min()), $r(t).delete([ 0, ai(r.path) ]))));
|
|
8828
8828
|
}));
|
|
8829
8829
|
s.push(e);
|
|
8830
8830
|
}
|
|
@@ -8881,7 +8881,7 @@ function Gr(t, e) {
|
|
|
8881
8881
|
function(t, e) {
|
|
8882
8882
|
return {
|
|
8883
8883
|
targetId: 0,
|
|
8884
|
-
path:
|
|
8884
|
+
path: ai(t.path),
|
|
8885
8885
|
sequenceNumber: e
|
|
8886
8886
|
};
|
|
8887
8887
|
}(e, t.currentSequenceNumber));
|
|
@@ -9156,7 +9156,7 @@ function Gr(t, e) {
|
|
|
9156
9156
|
const t = qi(this.wt, e);
|
|
9157
9157
|
// Whether the document is a sentinel removal and should only be used in the
|
|
9158
9158
|
// `getNewDocumentChanges()`
|
|
9159
|
-
if (!(t.isNoDocument() && t.version.isEqual(
|
|
9159
|
+
if (!(t.isNoDocument() && t.version.isEqual(at.min()))) return t;
|
|
9160
9160
|
}
|
|
9161
9161
|
return xe.newInvalidDocument(t);
|
|
9162
9162
|
}
|
|
@@ -9192,14 +9192,14 @@ function Gr(t, e) {
|
|
|
9192
9192
|
if (e.push(this.zn.removeEntry(t, i, o.readTime)), r.isValidDocument()) {
|
|
9193
9193
|
const u = Ki(this.zn.wt, r);
|
|
9194
9194
|
s = s.add(i.path.popLast());
|
|
9195
|
-
const
|
|
9196
|
-
n +=
|
|
9195
|
+
const a = Vr(u);
|
|
9196
|
+
n += a - o.size, e.push(this.zn.addEntry(t, i, u));
|
|
9197
9197
|
} else if (n -= o.size, this.trackRemovals) {
|
|
9198
9198
|
// In order to track removals, we store a "sentinel delete" in the
|
|
9199
9199
|
// RemoteDocumentCache. This entry is represented by a NoDocument
|
|
9200
9200
|
// with a version of 0 and ignored by `maybeDecodeDocument()` but
|
|
9201
9201
|
// preserved in `getNewDocumentChanges()`.
|
|
9202
|
-
const n = Ki(this.zn.wt, r.convertToNoDocument(
|
|
9202
|
+
const n = Ki(this.zn.wt, r.convertToNoDocument(at.min()));
|
|
9203
9203
|
e.push(this.zn.addEntry(t, i, n));
|
|
9204
9204
|
}
|
|
9205
9205
|
})), s.forEach((n => {
|
|
@@ -9360,7 +9360,7 @@ function Xr(t, e) {
|
|
|
9360
9360
|
*/ getLocalViewOfDocuments(t, e, n = ws()) {
|
|
9361
9361
|
const s = hs();
|
|
9362
9362
|
return this.populateOverlays(t, s, e).next((() => this.computeViews(t, e, s, n).next((t => {
|
|
9363
|
-
let e =
|
|
9363
|
+
let e = as();
|
|
9364
9364
|
return t.forEach(((t, n) => {
|
|
9365
9365
|
e = e.insert(t, n.overlayedDocument);
|
|
9366
9366
|
})), e;
|
|
@@ -9436,13 +9436,13 @@ function Xr(t, e) {
|
|
|
9436
9436
|
// Iterate in descending order of batch IDs, and skip documents that are
|
|
9437
9437
|
// already saved.
|
|
9438
9438
|
for (;o.hasNext(); ) {
|
|
9439
|
-
const s = o.getNext(), u = s.key,
|
|
9440
|
-
|
|
9439
|
+
const s = o.getNext(), u = s.key, a = s.value, c = ls();
|
|
9440
|
+
a.forEach((t => {
|
|
9441
9441
|
if (!i.has(t)) {
|
|
9442
9442
|
const s = Un(e.get(t), n.get(t));
|
|
9443
|
-
null !== s &&
|
|
9443
|
+
null !== s && c.set(t, s), i = i.add(t);
|
|
9444
9444
|
}
|
|
9445
|
-
})), r.push(this.documentOverlayCache.saveOverlays(t, u,
|
|
9445
|
+
})), r.push(this.documentOverlayCache.saveOverlays(t, u, c));
|
|
9446
9446
|
}
|
|
9447
9447
|
return Pt.waitFor(r);
|
|
9448
9448
|
})).next((() => n));
|
|
@@ -9466,7 +9466,7 @@ function Xr(t, e) {
|
|
|
9466
9466
|
*/
|
|
9467
9467
|
return function(t) {
|
|
9468
9468
|
return dt.isDocumentKey(t.path) && null === t.collectionGroup && 0 === t.filters.length;
|
|
9469
|
-
}(e) ? this.getDocumentsMatchingDocumentQuery(t, e.path) :
|
|
9469
|
+
}(e) ? this.getDocumentsMatchingDocumentQuery(t, e.path) : cn(e) ? this.getDocumentsMatchingCollectionGroupQuery(t, e, n) : this.getDocumentsMatchingCollectionQuery(t, e, n);
|
|
9470
9470
|
}
|
|
9471
9471
|
/**
|
|
9472
9472
|
* Given a collection group, returns the next documents that follow the provided offset, along
|
|
@@ -9495,20 +9495,20 @@ function Xr(t, e) {
|
|
|
9495
9495
|
u = u.insert(e, t);
|
|
9496
9496
|
}))))).next((() => this.populateOverlays(t, e, i))).next((() => this.computeViews(t, u, e, ws()))).next((t => ({
|
|
9497
9497
|
batchId: o,
|
|
9498
|
-
changes:
|
|
9498
|
+
changes: cs(t)
|
|
9499
9499
|
})))));
|
|
9500
9500
|
}));
|
|
9501
9501
|
}
|
|
9502
9502
|
getDocumentsMatchingDocumentQuery(t, e) {
|
|
9503
9503
|
// Just do a simple document lookup.
|
|
9504
9504
|
return this.getDocument(t, new dt(e)).next((t => {
|
|
9505
|
-
let e =
|
|
9505
|
+
let e = as();
|
|
9506
9506
|
return t.isFoundDocument() && (e = e.insert(t.key, t)), e;
|
|
9507
9507
|
}));
|
|
9508
9508
|
}
|
|
9509
9509
|
getDocumentsMatchingCollectionGroupQuery(t, e, n) {
|
|
9510
9510
|
const s = e.collectionGroup;
|
|
9511
|
-
let i =
|
|
9511
|
+
let i = as();
|
|
9512
9512
|
return this.indexManager.getCollectionParents(t, s).next((r => Pt.forEach(r, (r => {
|
|
9513
9513
|
const o = function(t, e) {
|
|
9514
9514
|
return new nn(e,
|
|
@@ -9533,7 +9533,7 @@ function Xr(t, e) {
|
|
|
9533
9533
|
null === s.get(n) && (s = s.insert(n, xe.newInvalidDocument(n)));
|
|
9534
9534
|
}));
|
|
9535
9535
|
// Apply the overlays and match against the query.
|
|
9536
|
-
let n =
|
|
9536
|
+
let n = as();
|
|
9537
9537
|
return s.forEach(((s, i) => {
|
|
9538
9538
|
const r = t.get(s);
|
|
9539
9539
|
void 0 !== r && Kn(r.mutation, i, zt.empty(), ut.now()),
|
|
@@ -10025,7 +10025,7 @@ class uo {
|
|
|
10025
10025
|
newChangeBuffer(t) {
|
|
10026
10026
|
// `trackRemovals` is ignores since the MemoryRemoteDocumentCache keeps
|
|
10027
10027
|
// a separate changelog and does not need special handling for removals.
|
|
10028
|
-
return new
|
|
10028
|
+
return new ao(this);
|
|
10029
10029
|
}
|
|
10030
10030
|
getSize(t) {
|
|
10031
10031
|
return Pt.resolve(this.size);
|
|
@@ -10042,7 +10042,7 @@ class uo {
|
|
|
10042
10042
|
/**
|
|
10043
10043
|
* Handles the details of adding and updating documents in the MemoryRemoteDocumentCache.
|
|
10044
10044
|
*/
|
|
10045
|
-
class
|
|
10045
|
+
class ao extends Qr {
|
|
10046
10046
|
constructor(t) {
|
|
10047
10047
|
super(), this.zn = t;
|
|
10048
10048
|
}
|
|
@@ -10075,7 +10075,7 @@ class co extends Qr {
|
|
|
10075
10075
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
10076
10076
|
* See the License for the specific language governing permissions and
|
|
10077
10077
|
* limitations under the License.
|
|
10078
|
-
*/ class
|
|
10078
|
+
*/ class co {
|
|
10079
10079
|
constructor(t) {
|
|
10080
10080
|
this.persistence = t,
|
|
10081
10081
|
/**
|
|
@@ -10083,7 +10083,7 @@ class co extends Qr {
|
|
|
10083
10083
|
*/
|
|
10084
10084
|
this.Ts = new is((t => Oe(t)), Fe),
|
|
10085
10085
|
/** The last received snapshot version. */
|
|
10086
|
-
this.lastRemoteSnapshotVersion =
|
|
10086
|
+
this.lastRemoteSnapshotVersion = at.min(),
|
|
10087
10087
|
/** The highest numbered target ID encountered. */
|
|
10088
10088
|
this.highestTargetId = 0,
|
|
10089
10089
|
/** The highest sequence number encountered. */
|
|
@@ -10191,7 +10191,7 @@ class ho {
|
|
|
10191
10191
|
*/
|
|
10192
10192
|
constructor(t, e) {
|
|
10193
10193
|
this.bs = {}, this.overlays = {}, this.Ps = new $t(0), this.vs = !1, this.vs = !0,
|
|
10194
|
-
this.referenceDelegate = t(this), this.Vs = new
|
|
10194
|
+
this.referenceDelegate = t(this), this.Vs = new co(this);
|
|
10195
10195
|
this.indexManager = new mr, this.remoteDocumentCache = function(t) {
|
|
10196
10196
|
return new uo(t);
|
|
10197
10197
|
}((t => this.referenceDelegate.Ss(t))), this.wt = new Ui(e), this.Ds = new no(this.wt);
|
|
@@ -10294,7 +10294,7 @@ class fo {
|
|
|
10294
10294
|
return Pt.forEach(this.Fs, (n => {
|
|
10295
10295
|
const s = dt.fromPath(n);
|
|
10296
10296
|
return this.$s(t, s).next((t => {
|
|
10297
|
-
t || e.removeEntry(s,
|
|
10297
|
+
t || e.removeEntry(s, at.min());
|
|
10298
10298
|
}));
|
|
10299
10299
|
})).next((() => (this.Os = null, e.apply(t))));
|
|
10300
10300
|
}
|
|
@@ -10377,7 +10377,7 @@ class fo {
|
|
|
10377
10377
|
const e = t.store("targetGlobal"), n = {
|
|
10378
10378
|
highestTargetId: 0,
|
|
10379
10379
|
highestListenSequenceNumber: 0,
|
|
10380
|
-
lastRemoteSnapshotVersion:
|
|
10380
|
+
lastRemoteSnapshotVersion: at.min().toTimestamp(),
|
|
10381
10381
|
targetCount: 0
|
|
10382
10382
|
};
|
|
10383
10383
|
return e.put("targetGlobalKey", n);
|
|
@@ -10495,11 +10495,11 @@ class fo {
|
|
|
10495
10495
|
const s = [];
|
|
10496
10496
|
return n.J(((n, i) => {
|
|
10497
10497
|
const r = new ht(n), o = function(t) {
|
|
10498
|
-
return [ 0,
|
|
10498
|
+
return [ 0, ai(t) ];
|
|
10499
10499
|
}(r);
|
|
10500
10500
|
s.push(e.get(o).next((n => n ? Pt.resolve() : (n => e.put({
|
|
10501
10501
|
targetId: 0,
|
|
10502
|
-
path:
|
|
10502
|
+
path: ai(n),
|
|
10503
10503
|
sequenceNumber: t.highestListenSequenceNumber
|
|
10504
10504
|
}))(r))));
|
|
10505
10505
|
})).next((() => Pt.waitFor(s)));
|
|
@@ -10515,7 +10515,7 @@ class fo {
|
|
|
10515
10515
|
const e = t.lastSegment(), s = t.popLast();
|
|
10516
10516
|
return n.put({
|
|
10517
10517
|
collectionId: e,
|
|
10518
|
-
parent:
|
|
10518
|
+
parent: ai(s)
|
|
10519
10519
|
});
|
|
10520
10520
|
}
|
|
10521
10521
|
};
|
|
@@ -10582,8 +10582,8 @@ class fo {
|
|
|
10582
10582
|
let s = null !== (e = n.get(t.userId)) && void 0 !== e ? e : ws();
|
|
10583
10583
|
Wi(this.wt, t).keys().forEach((t => s = s.add(t))), n.set(t.userId, s);
|
|
10584
10584
|
})), Pt.forEach(n, ((t, n) => {
|
|
10585
|
-
const r = new C(n), o = sr.se(this.wt, r), u = i.getIndexManager(r),
|
|
10586
|
-
return new eo(s,
|
|
10585
|
+
const r = new C(n), o = sr.se(this.wt, r), u = i.getIndexManager(r), a = Sr.se(r, this.wt, u, i.referenceDelegate);
|
|
10586
|
+
return new eo(s, a, o, u).recalculateAndSaveOverlaysForDocumentKeys(new Oi(e, $t.ot), t).next();
|
|
10587
10587
|
}));
|
|
10588
10588
|
}));
|
|
10589
10589
|
}
|
|
@@ -10661,14 +10661,14 @@ class go {
|
|
|
10661
10661
|
* Whether to synchronize the in-memory state of multiple tabs and share
|
|
10662
10662
|
* access to local persistence.
|
|
10663
10663
|
*/
|
|
10664
|
-
t, e, n, s, i, r, o, u,
|
|
10664
|
+
t, e, n, s, i, r, o, u, a,
|
|
10665
10665
|
/**
|
|
10666
10666
|
* If set to true, forcefully obtains database access. Existing tabs will
|
|
10667
10667
|
* no longer be able to access IndexedDB.
|
|
10668
10668
|
*/
|
|
10669
|
-
|
|
10669
|
+
c, h = 14) {
|
|
10670
10670
|
if (this.allowTabSynchronization = t, this.persistenceKey = e, this.clientId = n,
|
|
10671
|
-
this.js = i, this.window = r, this.document = o, this.Ws =
|
|
10671
|
+
this.js = i, this.window = r, this.document = o, this.Ws = a, this.zs = c, this.Hs = h,
|
|
10672
10672
|
this.Ps = null, this.vs = !1, this.isPrimary = !1, this.networkEnabled = !0,
|
|
10673
10673
|
/** Our window.unload handler, if registered. */
|
|
10674
10674
|
this.Js = null, this.inForeground = !1,
|
|
@@ -10683,7 +10683,7 @@ class go {
|
|
|
10683
10683
|
this.referenceDelegate = new Kr(this, s), this.ei = e + "main", this.wt = new Ui(u),
|
|
10684
10684
|
this.ni = new Vt(this.ei, this.Hs, new _o(this.wt)), this.Vs = new Or(this.referenceDelegate, this.wt),
|
|
10685
10685
|
this.remoteDocumentCache = Wr(this.wt), this.Ds = new tr, this.window && this.window.localStorage ? this.si = this.window.localStorage : (this.si = null,
|
|
10686
|
-
!1 ===
|
|
10686
|
+
!1 === c && F("IndexedDbPersistence", "LocalStorage is unavailable. As a result, persistence may not work reliably. In particular enablePersistence() could fail immediately after refreshing the page."));
|
|
10687
10687
|
}
|
|
10688
10688
|
/**
|
|
10689
10689
|
* Attempt to start IndexedDb persistence.
|
|
@@ -10711,7 +10711,7 @@ class go {
|
|
|
10711
10711
|
* with the current primary state.
|
|
10712
10712
|
*
|
|
10713
10713
|
* PORTING NOTE: This is only used for Web multi-tab.
|
|
10714
|
-
*/
|
|
10714
|
+
*/ ai(t) {
|
|
10715
10715
|
return this.ti = async e => {
|
|
10716
10716
|
if (this.started) return t(e);
|
|
10717
10717
|
}, t(this.isPrimary);
|
|
@@ -10752,7 +10752,7 @@ class go {
|
|
|
10752
10752
|
networkEnabled: this.networkEnabled,
|
|
10753
10753
|
inForeground: this.inForeground
|
|
10754
10754
|
}).next((() => {
|
|
10755
|
-
if (this.isPrimary) return this.
|
|
10755
|
+
if (this.isPrimary) return this.ci(t).next((t => {
|
|
10756
10756
|
t || (this.isPrimary = !1, this.js.enqueueRetryable((() => this.ti(!1))));
|
|
10757
10757
|
}));
|
|
10758
10758
|
})).next((() => this.hi(t))).next((e => this.isPrimary && !e ? this.li(t).next((() => !1)) : !!e && this.fi(t).next((() => !0)))))).catch((t => {
|
|
@@ -10767,7 +10767,7 @@ class go {
|
|
|
10767
10767
|
this.isPrimary !== t && this.js.enqueueRetryable((() => this.ti(t))), this.isPrimary = t;
|
|
10768
10768
|
}));
|
|
10769
10769
|
}
|
|
10770
|
-
|
|
10770
|
+
ci(t) {
|
|
10771
10771
|
return yo(t).get("owner").next((t => Pt.resolve(this.di(t))));
|
|
10772
10772
|
}
|
|
10773
10773
|
_i(t) {
|
|
@@ -10912,7 +10912,7 @@ class go {
|
|
|
10912
10912
|
// Do all transactions as readwrite against all object stores, since we
|
|
10913
10913
|
// are the only reader/writer.
|
|
10914
10914
|
return this.ni.runTransaction(t, s, i, (s => (o = new Oi(s, this.Ps ? this.Ps.next() : $t.ot),
|
|
10915
|
-
"readwrite-primary" === e ? this.
|
|
10915
|
+
"readwrite-primary" === e ? this.ci(o).next((t => !!t || this.hi(o))).next((e => {
|
|
10916
10916
|
if (!e) throw F(`Failed to obtain primary lease for action '${t}'.`), this.isPrimary = !1,
|
|
10917
10917
|
this.js.enqueueRetryable((() => this.ti(!1))), new Q(G.FAILED_PRECONDITION, At);
|
|
10918
10918
|
return n(o);
|
|
@@ -11165,7 +11165,7 @@ class To {
|
|
|
11165
11165
|
* Performs a query based on the target's persisted query mapping. Returns
|
|
11166
11166
|
* `null` if the mapping is not available or cannot be used.
|
|
11167
11167
|
*/ xi(t, e, n, s) {
|
|
11168
|
-
return on(e) || s.isEqual(
|
|
11168
|
+
return on(e) || s.isEqual(at.min()) ? this.Ni(t, e) : this.Di.getDocuments(t, n).next((i => {
|
|
11169
11169
|
const r = this.ki(e, i);
|
|
11170
11170
|
return this.Oi(e, r, n, s) ? this.Ni(t, e) : (k() <= LogLevel.DEBUG && M("QueryEngine", "Re-using previous result from %s to execute query: %s", s.toString(), wn(e)),
|
|
11171
11171
|
this.Mi(t, r, e, pt(s, -1)));
|
|
@@ -11411,15 +11411,15 @@ function vo(t) {
|
|
|
11411
11411
|
i = n.$i;
|
|
11412
11412
|
const o = [];
|
|
11413
11413
|
e.targetChanges.forEach(((r, u) => {
|
|
11414
|
-
const
|
|
11415
|
-
if (!
|
|
11414
|
+
const a = i.get(u);
|
|
11415
|
+
if (!a) return;
|
|
11416
11416
|
// Only update the remote keys if the target is still active. This
|
|
11417
11417
|
// ensures that we can persist the updated target data along with
|
|
11418
11418
|
// the updated assignment.
|
|
11419
11419
|
o.push(n.Vs.removeMatchingKeys(t, r.removedDocuments, u).next((() => n.Vs.addMatchingKeys(t, r.addedDocuments, u))));
|
|
11420
|
-
let
|
|
11421
|
-
e.targetMismatches.has(u) ?
|
|
11422
|
-
i = i.insert(u,
|
|
11420
|
+
let c = a.withSequenceNumber(t.currentSequenceNumber);
|
|
11421
|
+
e.targetMismatches.has(u) ? c = c.withResumeToken(Jt.EMPTY_BYTE_STRING, at.min()).withLastLimboFreeSnapshotVersion(at.min()) : r.resumeToken.approximateByteSize() > 0 && (c = c.withResumeToken(r.resumeToken, s)),
|
|
11422
|
+
i = i.insert(u, c),
|
|
11423
11423
|
// Update the target data if there are target changes (or if
|
|
11424
11424
|
// sufficient time has passed since the last update).
|
|
11425
11425
|
/**
|
|
@@ -11451,9 +11451,9 @@ function vo(t) {
|
|
|
11451
11451
|
}
|
|
11452
11452
|
/**
|
|
11453
11453
|
* Notifies local store of the changed views to locally pin documents.
|
|
11454
|
-
*/ (
|
|
11454
|
+
*/ (a, c, r) && o.push(n.Vs.updateTargetData(t, c));
|
|
11455
11455
|
}));
|
|
11456
|
-
let u = os(),
|
|
11456
|
+
let u = os(), a = ws();
|
|
11457
11457
|
// HACK: The only reason we allow a null snapshot version is so that we
|
|
11458
11458
|
// can synthesize remote events when we get permission denied errors while
|
|
11459
11459
|
// trying to resolve the state of a locally cached document that is in
|
|
@@ -11464,12 +11464,12 @@ function vo(t) {
|
|
|
11464
11464
|
// Each loop iteration only affects its "own" doc, so it's safe to get all
|
|
11465
11465
|
// the remote documents in advance in a single call.
|
|
11466
11466
|
o.push(So(t, r, e.documentUpdates).next((t => {
|
|
11467
|
-
u = t.Gi,
|
|
11468
|
-
}))), !s.isEqual(
|
|
11467
|
+
u = t.Gi, a = t.Qi;
|
|
11468
|
+
}))), !s.isEqual(at.min())) {
|
|
11469
11469
|
const e = n.Vs.getLastRemoteSnapshotVersion(t).next((e => n.Vs.setTargetsMetadata(t, t.currentSequenceNumber, s)));
|
|
11470
11470
|
o.push(e);
|
|
11471
11471
|
}
|
|
11472
|
-
return Pt.waitFor(o).next((() => r.apply(t))).next((() => n.localDocuments.getLocalViewOfDocuments(t, u,
|
|
11472
|
+
return Pt.waitFor(o).next((() => r.apply(t))).next((() => n.localDocuments.getLocalViewOfDocuments(t, u, a))).next((() => u));
|
|
11473
11473
|
})).then((t => (n.$i = i, t)));
|
|
11474
11474
|
}
|
|
11475
11475
|
|
|
@@ -11494,7 +11494,7 @@ function vo(t) {
|
|
|
11494
11494
|
// to ensure that rejected limbo resolutions (which fabricate
|
|
11495
11495
|
// NoDocuments with SnapshotVersion.min()) never add documents to
|
|
11496
11496
|
// cache.
|
|
11497
|
-
r.isNoDocument() && r.version.isEqual(
|
|
11497
|
+
r.isNoDocument() && r.version.isEqual(at.min()) ? (
|
|
11498
11498
|
// NoDocuments with SnapshotVersion.min() are used in manufactured
|
|
11499
11499
|
// events. We remove these documents from cache since we lost
|
|
11500
11500
|
// access.
|
|
@@ -11588,7 +11588,7 @@ async function xo(t, e, n) {
|
|
|
11588
11588
|
* be used to optimize this query execution.
|
|
11589
11589
|
*/ function No(t, e, n) {
|
|
11590
11590
|
const s = K(t);
|
|
11591
|
-
let i =
|
|
11591
|
+
let i = at.min(), r = ws();
|
|
11592
11592
|
return s.persistence.runTransaction("Execute query", "readonly", (t => function(t, e, n) {
|
|
11593
11593
|
const s = K(t), i = s.Bi.get(n);
|
|
11594
11594
|
return void 0 !== i ? Pt.resolve(s.$i.get(i)) : s.Vs.getTargetData(e, n);
|
|
@@ -11596,7 +11596,7 @@ async function xo(t, e, n) {
|
|
|
11596
11596
|
if (e) return i = e.lastLimboFreeSnapshotVersion, s.Vs.getMatchingKeysForTargetId(t, e.targetId).next((t => {
|
|
11597
11597
|
r = t;
|
|
11598
11598
|
}));
|
|
11599
|
-
})).next((() => s.Fi.getDocumentsMatchingQuery(t, e, n ? i :
|
|
11599
|
+
})).next((() => s.Fi.getDocumentsMatchingQuery(t, e, n ? i : at.min(), n ? r : ws()))).next((t => (Mo(s, gn(e), t),
|
|
11600
11600
|
{
|
|
11601
11601
|
documents: t,
|
|
11602
11602
|
ji: r
|
|
@@ -11617,7 +11617,7 @@ function ko(t, e) {
|
|
|
11617
11617
|
*/
|
|
11618
11618
|
// PORTING NOTE: Multi-Tab only.
|
|
11619
11619
|
function Oo(t, e) {
|
|
11620
|
-
const n = K(t), s = n.Li.get(e) ||
|
|
11620
|
+
const n = K(t), s = n.Li.get(e) || at.min();
|
|
11621
11621
|
// Get the current maximum read time for the collection. This should always
|
|
11622
11622
|
// exist, but to reduce the chance for regressions we default to
|
|
11623
11623
|
// SnapshotVersion.Min()
|
|
@@ -11629,7 +11629,7 @@ function Oo(t, e) {
|
|
|
11629
11629
|
/** Sets the collection group's maximum read time from the given documents. */
|
|
11630
11630
|
// PORTING NOTE: Multi-Tab only.
|
|
11631
11631
|
function Mo(t, e, n) {
|
|
11632
|
-
let s =
|
|
11632
|
+
let s = at.min();
|
|
11633
11633
|
n.forEach(((t, e) => {
|
|
11634
11634
|
e.readTime.compareTo(s) > 0 && (s = e.readTime);
|
|
11635
11635
|
})), t.Li.set(e, s);
|
|
@@ -11659,7 +11659,7 @@ async function Fo(t, e, n, s) {
|
|
|
11659
11659
|
}
|
|
11660
11660
|
const u = i.Ui.newChangeBuffer({
|
|
11661
11661
|
trackRemovals: !0
|
|
11662
|
-
}),
|
|
11662
|
+
}), a = await Co(i, function(t) {
|
|
11663
11663
|
// It is OK that the path used for the query is not valid, because this will
|
|
11664
11664
|
// not be read and queried.
|
|
11665
11665
|
return ln(rn(ht.fromString(`__bundle__/docs/${t}`)));
|
|
@@ -11667,7 +11667,7 @@ async function Fo(t, e, n, s) {
|
|
|
11667
11667
|
// Allocates a target to hold all document keys from the bundle, such that
|
|
11668
11668
|
// they will not get garbage collected right away.
|
|
11669
11669
|
return i.persistence.runTransaction("Apply bundle documents", "readwrite", (t => So(t, u, o).next((e => (u.apply(t),
|
|
11670
|
-
e))).next((e => i.Vs.removeMatchingKeysForTargetId(t,
|
|
11670
|
+
e))).next((e => i.Vs.removeMatchingKeysForTargetId(t, a.targetId).next((() => i.Vs.addMatchingKeys(t, r, a.targetId))).next((() => i.localDocuments.getLocalViewOfDocuments(t, e.Gi, e.Qi))).next((() => e.Gi))))));
|
|
11671
11671
|
}
|
|
11672
11672
|
|
|
11673
11673
|
/**
|
|
@@ -11816,7 +11816,7 @@ class Ko {
|
|
|
11816
11816
|
*/ static Ji(t, e) {
|
|
11817
11817
|
const n = JSON.parse(e);
|
|
11818
11818
|
let s = "object" == typeof n && n.activeTargetIds instanceof Array, i = gs();
|
|
11819
|
-
for (let t = 0; s && t < n.activeTargetIds.length; ++t) s =
|
|
11819
|
+
for (let t = 0; s && t < n.activeTargetIds.length; ++t) s = ae(n.activeTargetIds[t]),
|
|
11820
11820
|
i = i.add(n.activeTargetIds[t]);
|
|
11821
11821
|
return s ? new Go(t, i) : (F("SharedClientState", `Failed to parse client data for instance '${t}': ${e}`),
|
|
11822
11822
|
null);
|
|
@@ -11912,8 +11912,8 @@ class jo {
|
|
|
11912
11912
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11913
11913
|
* See the License for the specific language governing permissions and
|
|
11914
11914
|
* limitations under the License.
|
|
11915
|
-
*/ (this.persistenceKey), this.sr = this.sr.insert(this.tr, new jo), this.
|
|
11916
|
-
this.
|
|
11915
|
+
*/ (this.persistenceKey), this.sr = this.sr.insert(this.tr, new jo), this.ar = new RegExp(`^firestore_clients_${r}_([^_]*)$`),
|
|
11916
|
+
this.cr = new RegExp(`^firestore_mutations_${r}_(\\d+)(?:_(.*))?$`), this.hr = new RegExp(`^firestore_targets_${r}_(\\d+)$`),
|
|
11917
11917
|
this.lr =
|
|
11918
11918
|
/** Assembles the key for the online state of the primary tab. */
|
|
11919
11919
|
function(t) {
|
|
@@ -12049,7 +12049,7 @@ class jo {
|
|
|
12049
12049
|
if (M("SharedClientState", "EVENT", e.key, e.newValue), e.key === this.rr) return void F("Received WebStorage notification for local change. Another client might have garbage-collected our state");
|
|
12050
12050
|
this.js.enqueueRetryable((async () => {
|
|
12051
12051
|
if (this.started) {
|
|
12052
|
-
if (null !== e.key) if (this.
|
|
12052
|
+
if (null !== e.key) if (this.ar.test(e.key)) {
|
|
12053
12053
|
if (null == e.newValue) {
|
|
12054
12054
|
const t = this.Rr(e.key);
|
|
12055
12055
|
return this.br(t, null);
|
|
@@ -12058,7 +12058,7 @@ class jo {
|
|
|
12058
12058
|
const t = this.Pr(e.key, e.newValue);
|
|
12059
12059
|
if (t) return this.br(t.clientId, t);
|
|
12060
12060
|
}
|
|
12061
|
-
} else if (this.
|
|
12061
|
+
} else if (this.cr.test(e.key)) {
|
|
12062
12062
|
if (null !== e.newValue) {
|
|
12063
12063
|
const t = this.vr(e.key, e.newValue);
|
|
12064
12064
|
if (t) return this.Vr(t);
|
|
@@ -12131,7 +12131,7 @@ class jo {
|
|
|
12131
12131
|
* Parses a client state key in WebStorage. Returns null if the key does not
|
|
12132
12132
|
* match the expected key format.
|
|
12133
12133
|
*/ Rr(t) {
|
|
12134
|
-
const e = this.
|
|
12134
|
+
const e = this.ar.exec(t);
|
|
12135
12135
|
return e ? e[1] : null;
|
|
12136
12136
|
}
|
|
12137
12137
|
/**
|
|
@@ -12145,7 +12145,7 @@ class jo {
|
|
|
12145
12145
|
* Parses a mutation batch state in WebStorage. Returns 'null' if the value
|
|
12146
12146
|
* could not be parsed.
|
|
12147
12147
|
*/ vr(t, e) {
|
|
12148
|
-
const n = this.
|
|
12148
|
+
const n = this.cr.exec(t), s = Number(n[1]), i = void 0 !== n[2] ? n[2] : null;
|
|
12149
12149
|
return qo.Ji(new C(i), s, e);
|
|
12150
12150
|
}
|
|
12151
12151
|
/**
|
|
@@ -12425,13 +12425,13 @@ class {
|
|
|
12425
12425
|
const r = this.oo(t, e);
|
|
12426
12426
|
M("RestConnection", "Sending: ", r, n);
|
|
12427
12427
|
const o = {};
|
|
12428
|
-
return this.uo(o, s, i), this.
|
|
12428
|
+
return this.uo(o, s, i), this.ao(t, r, o, n).then((t => (M("RestConnection", "Received: ", t),
|
|
12429
12429
|
t)), (e => {
|
|
12430
12430
|
throw $("RestConnection", `${t} failed with error: `, e, "url: ", r, "request:", n),
|
|
12431
12431
|
e;
|
|
12432
12432
|
}));
|
|
12433
12433
|
}
|
|
12434
|
-
|
|
12434
|
+
co(t, e, n, s, i, r) {
|
|
12435
12435
|
// The REST API automatically aggregates all of the streamed results, so we
|
|
12436
12436
|
// can just use the normal invoke() method.
|
|
12437
12437
|
return this.ro(t, e, n, s, i);
|
|
@@ -12457,7 +12457,7 @@ class {
|
|
|
12457
12457
|
super(t), this.forceLongPolling = t.forceLongPolling, this.autoDetectLongPolling = t.autoDetectLongPolling,
|
|
12458
12458
|
this.useFetchStreams = t.useFetchStreams;
|
|
12459
12459
|
}
|
|
12460
|
-
|
|
12460
|
+
ao(t, e, n, s) {
|
|
12461
12461
|
return new Promise(((i, r) => {
|
|
12462
12462
|
const o = new XhrIo;
|
|
12463
12463
|
o.listenOnce(EventType.COMPLETE, (() => {
|
|
@@ -12545,22 +12545,22 @@ class {
|
|
|
12545
12545
|
isMobileCordova() || isReactNative() || isElectron() || isIE() || isUWP() || isBrowserExtension() || (o.httpHeadersOverwriteParam = "$httpHeaders");
|
|
12546
12546
|
const u = s.join("");
|
|
12547
12547
|
M("Connection", "Creating WebChannel: " + u, o);
|
|
12548
|
-
const
|
|
12548
|
+
const a = i.createWebChannel(u, o);
|
|
12549
12549
|
// WebChannel supports sending the first message with the handshake - saving
|
|
12550
12550
|
// a network round trip. However, it will have to call send in the same
|
|
12551
12551
|
// JS event loop as open. In order to enforce this, we delay actually
|
|
12552
12552
|
// opening the WebChannel until send is called. Whether we have called
|
|
12553
12553
|
// open is tracked with this variable.
|
|
12554
|
-
let
|
|
12554
|
+
let c = !1, h = !1;
|
|
12555
12555
|
// A flag to determine whether the stream was closed (by us or through an
|
|
12556
12556
|
// error/close event) to avoid delivering multiple close events or sending
|
|
12557
12557
|
// on a closed stream
|
|
12558
12558
|
const l = new Xo({
|
|
12559
12559
|
jr: t => {
|
|
12560
|
-
h ? M("Connection", "Not sending because WebChannel is closed:", t) : (
|
|
12561
|
-
|
|
12560
|
+
h ? M("Connection", "Not sending because WebChannel is closed:", t) : (c || (M("Connection", "Opening WebChannel transport."),
|
|
12561
|
+
a.open(), c = !0), M("Connection", "WebChannel sending:", t), a.send(t));
|
|
12562
12562
|
},
|
|
12563
|
-
Wr: () =>
|
|
12563
|
+
Wr: () => a.close()
|
|
12564
12564
|
}), y = (t, e, n) => {
|
|
12565
12565
|
// TODO(dimond): closure typing seems broken because WebChannel does
|
|
12566
12566
|
// not implement goog.events.Listenable
|
|
@@ -12578,13 +12578,13 @@ class {
|
|
|
12578
12578
|
// exception and rethrow using a setTimeout so they become visible again.
|
|
12579
12579
|
// Note that eventually this function could go away if we are confident
|
|
12580
12580
|
// enough the code is exception free.
|
|
12581
|
-
return y(
|
|
12581
|
+
return y(a, WebChannel.EventType.OPEN, (() => {
|
|
12582
12582
|
h || M("Connection", "WebChannel transport opened.");
|
|
12583
|
-
})), y(
|
|
12583
|
+
})), y(a, WebChannel.EventType.CLOSE, (() => {
|
|
12584
12584
|
h || (h = !0, M("Connection", "WebChannel transport closed"), l.eo());
|
|
12585
|
-
})), y(
|
|
12585
|
+
})), y(a, WebChannel.EventType.ERROR, (t => {
|
|
12586
12586
|
h || (h = !0, $("Connection", "WebChannel transport errored:", t), l.eo(new Q(G.UNAVAILABLE, "The operation could not be completed")));
|
|
12587
|
-
})), y(
|
|
12587
|
+
})), y(a, WebChannel.EventType.MESSAGE, (t => {
|
|
12588
12588
|
var e;
|
|
12589
12589
|
if (!h) {
|
|
12590
12590
|
const n = t.data[0];
|
|
@@ -12614,7 +12614,7 @@ class {
|
|
|
12614
12614
|
}(t), n = i.message;
|
|
12615
12615
|
void 0 === e && (e = G.INTERNAL, n = "Unknown error status: " + t + " with message " + i.message),
|
|
12616
12616
|
// Mark closed so no further events are propagated
|
|
12617
|
-
h = !0, l.eo(new Q(e, n)),
|
|
12617
|
+
h = !0, l.eo(new Q(e, n)), a.close();
|
|
12618
12618
|
} else M("Connection", "WebChannel received:", n), l.no(n);
|
|
12619
12619
|
}
|
|
12620
12620
|
})), y(r, Event.STAT_EVENT, (t => {
|
|
@@ -13031,9 +13031,9 @@ class iu {
|
|
|
13031
13031
|
// We have only reached a consistent snapshot for the entire stream if there
|
|
13032
13032
|
// is a read_time set and it applies to all targets (i.e. the list of
|
|
13033
13033
|
// targets is empty). The backend is guaranteed to send such responses.
|
|
13034
|
-
if (!("targetChange" in t)) return
|
|
13034
|
+
if (!("targetChange" in t)) return at.min();
|
|
13035
13035
|
const e = t.targetChange;
|
|
13036
|
-
return e.targetIds && e.targetIds.length ?
|
|
13036
|
+
return e.targetIds && e.targetIds.length ? at.min() : e.readTime ? Ns(e.readTime) : at.min();
|
|
13037
13037
|
}(t);
|
|
13038
13038
|
return this.listener.Go(e, n);
|
|
13039
13039
|
}
|
|
@@ -13051,7 +13051,7 @@ class iu {
|
|
|
13051
13051
|
documents: Hs(t, s)
|
|
13052
13052
|
} : {
|
|
13053
13053
|
query: Js(t, s)
|
|
13054
|
-
}, n.targetId = e.targetId, e.resumeToken.approximateByteSize() > 0 ? n.resumeToken = Cs(t, e.resumeToken) : e.snapshotVersion.compareTo(
|
|
13054
|
+
}, n.targetId = e.targetId, e.resumeToken.approximateByteSize() > 0 ? n.resumeToken = Cs(t, e.resumeToken) : e.snapshotVersion.compareTo(at.min()) > 0 && (
|
|
13055
13055
|
// TODO(wuandy): Consider removing above check because it is most likely true.
|
|
13056
13056
|
// Right now, many tests depend on this behaviour though (leaving min() out
|
|
13057
13057
|
// of serialization).
|
|
@@ -13178,8 +13178,8 @@ class uu extends class {} {
|
|
|
13178
13178
|
this.appCheckCredentials.invalidateToken()), t) : new Q(G.UNKNOWN, t.toString());
|
|
13179
13179
|
}));
|
|
13180
13180
|
}
|
|
13181
|
-
/** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */
|
|
13182
|
-
return this.tu(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([i, r]) => this.bo.
|
|
13181
|
+
/** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ co(t, e, n, s) {
|
|
13182
|
+
return this.tu(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([i, r]) => this.bo.co(t, e, n, i, r, s))).catch((t => {
|
|
13183
13183
|
throw "FirebaseError" === t.name ? (t.code === G.UNAUTHENTICATED && (this.authCredentials.invalidateToken(),
|
|
13184
13184
|
this.appCheckCredentials.invalidateToken()), t) : new Q(G.UNKNOWN, t.toString());
|
|
13185
13185
|
}));
|
|
@@ -13202,7 +13202,7 @@ class uu extends class {} {
|
|
|
13202
13202
|
* then we set the OnlineState to Offline, and the client will behave as if
|
|
13203
13203
|
* it is offline (get()s will return cached data, etc.).
|
|
13204
13204
|
*/
|
|
13205
|
-
class
|
|
13205
|
+
class au {
|
|
13206
13206
|
constructor(t, e) {
|
|
13207
13207
|
this.asyncQueue = t, this.onlineStateHandler = e,
|
|
13208
13208
|
/** The current OnlineState. */
|
|
@@ -13244,7 +13244,7 @@ class cu {
|
|
|
13244
13244
|
* actually transition to the 'Offline' state.
|
|
13245
13245
|
*/ uu(t) {
|
|
13246
13246
|
"Online" /* Online */ === this.state ? this.ru("Unknown" /* Unknown */) : (this.eu++,
|
|
13247
|
-
this.eu >= 1 && (this.
|
|
13247
|
+
this.eu >= 1 && (this.au(), this.ou(`Connection failed 1 times. Most recent error: ${t.toString()}`),
|
|
13248
13248
|
this.ru("Offline" /* Offline */)));
|
|
13249
13249
|
}
|
|
13250
13250
|
/**
|
|
@@ -13254,7 +13254,7 @@ class cu {
|
|
|
13254
13254
|
* Offline heuristics, so must not be used in place of
|
|
13255
13255
|
* handleWatchStreamStart() and handleWatchStreamFailure().
|
|
13256
13256
|
*/ set(t) {
|
|
13257
|
-
this.
|
|
13257
|
+
this.au(), this.eu = 0, "Online" /* Online */ === t && (
|
|
13258
13258
|
// We've connected to watch at least once. Don't warn the developer
|
|
13259
13259
|
// about being offline going forward.
|
|
13260
13260
|
this.su = !1), this.ru(t);
|
|
@@ -13266,7 +13266,7 @@ class cu {
|
|
|
13266
13266
|
const 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.`;
|
|
13267
13267
|
this.su ? (F(e), this.su = !1) : M("OnlineStateTracker", e);
|
|
13268
13268
|
}
|
|
13269
|
-
|
|
13269
|
+
au() {
|
|
13270
13270
|
null !== this.nu && (this.nu.cancel(), this.nu = null);
|
|
13271
13271
|
}
|
|
13272
13272
|
}
|
|
@@ -13286,7 +13286,7 @@ class cu {
|
|
|
13286
13286
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13287
13287
|
* See the License for the specific language governing permissions and
|
|
13288
13288
|
* limitations under the License.
|
|
13289
|
-
*/ class
|
|
13289
|
+
*/ class cu {
|
|
13290
13290
|
constructor(
|
|
13291
13291
|
/**
|
|
13292
13292
|
* The local store, used to fill the write pipeline with outbound mutations.
|
|
@@ -13312,7 +13312,7 @@ class cu {
|
|
|
13312
13312
|
* purely based on order, and so we can just shift() writes from the front of
|
|
13313
13313
|
* the writePipeline as we receive responses.
|
|
13314
13314
|
*/
|
|
13315
|
-
this.
|
|
13315
|
+
this.cu = [],
|
|
13316
13316
|
/**
|
|
13317
13317
|
* A mapping of watched targets that the client cares about tracking and the
|
|
13318
13318
|
* user has explicitly called a 'listen' for this target.
|
|
@@ -13347,7 +13347,7 @@ class cu {
|
|
|
13347
13347
|
e.lu.delete(4 /* ConnectivityChange */), await hu(e);
|
|
13348
13348
|
}(this));
|
|
13349
13349
|
}));
|
|
13350
|
-
})), this._u = new
|
|
13350
|
+
})), this._u = new au(n, s);
|
|
13351
13351
|
}
|
|
13352
13352
|
}
|
|
13353
13353
|
|
|
@@ -13467,7 +13467,7 @@ async function Eu(t, e, n) {
|
|
|
13467
13467
|
M("RemoteStore", "Failed to remove targets %s: %s ", e.targetIds.join(","), n),
|
|
13468
13468
|
await Au(t, n);
|
|
13469
13469
|
} else if (e instanceof Is ? t.wu.Ut(e) : e instanceof Ts ? t.wu.zt(e) : t.wu.Gt(e),
|
|
13470
|
-
!n.isEqual(
|
|
13470
|
+
!n.isEqual(at.min())) try {
|
|
13471
13471
|
const e = await vo(t.localStore);
|
|
13472
13472
|
n.compareTo(e) >= 0 &&
|
|
13473
13473
|
// We have received a target change with a global snapshot if the snapshot
|
|
@@ -13548,11 +13548,11 @@ async function Eu(t, e, n) {
|
|
|
13548
13548
|
|
|
13549
13549
|
async function bu(t) {
|
|
13550
13550
|
const e = K(t), n = Fu(e);
|
|
13551
|
-
let s = e.
|
|
13551
|
+
let s = e.cu.length > 0 ? e.cu[e.cu.length - 1].batchId : -1;
|
|
13552
13552
|
for (;Pu(e); ) try {
|
|
13553
13553
|
const t = await Do(e.localStore, s);
|
|
13554
13554
|
if (null === t) {
|
|
13555
|
-
0 === e.
|
|
13555
|
+
0 === e.cu.length && n.ko();
|
|
13556
13556
|
break;
|
|
13557
13557
|
}
|
|
13558
13558
|
s = t.batchId, vu(e, t);
|
|
@@ -13566,20 +13566,20 @@ async function bu(t) {
|
|
|
13566
13566
|
* Returns true if we can add to the write pipeline (i.e. the network is
|
|
13567
13567
|
* enabled and the write pipeline is not full).
|
|
13568
13568
|
*/ function Pu(t) {
|
|
13569
|
-
return yu(t) && t.
|
|
13569
|
+
return yu(t) && t.cu.length < 10;
|
|
13570
13570
|
}
|
|
13571
13571
|
|
|
13572
13572
|
/**
|
|
13573
13573
|
* Queues additional writes to be sent to the write stream, sending them
|
|
13574
13574
|
* immediately if the write stream is established.
|
|
13575
13575
|
*/ function vu(t, e) {
|
|
13576
|
-
t.
|
|
13576
|
+
t.cu.push(e);
|
|
13577
13577
|
const n = Fu(t);
|
|
13578
13578
|
n.Co() && n.zo && n.Ho(e.mutations);
|
|
13579
13579
|
}
|
|
13580
13580
|
|
|
13581
13581
|
function Vu(t) {
|
|
13582
|
-
return yu(t) && !Fu(t).Do() && t.
|
|
13582
|
+
return yu(t) && !Fu(t).Do() && t.cu.length > 0;
|
|
13583
13583
|
}
|
|
13584
13584
|
|
|
13585
13585
|
function Su(t) {
|
|
@@ -13593,11 +13593,11 @@ async function Du(t) {
|
|
|
13593
13593
|
async function Cu(t) {
|
|
13594
13594
|
const e = Fu(t);
|
|
13595
13595
|
// Send the write pipeline now that the stream is established.
|
|
13596
|
-
for (const n of t.
|
|
13596
|
+
for (const n of t.cu) e.Ho(n.mutations);
|
|
13597
13597
|
}
|
|
13598
13598
|
|
|
13599
13599
|
async function xu(t, e, n) {
|
|
13600
|
-
const s = t.
|
|
13600
|
+
const s = t.cu.shift(), i = $i.from(s, e, n);
|
|
13601
13601
|
await Ru(t, (() => t.remoteSyncer.applySuccessfulWrite(i))),
|
|
13602
13602
|
// It's possible that with the completion of this mutation another
|
|
13603
13603
|
// slot has freed up.
|
|
@@ -13615,7 +13615,7 @@ async function Nu(t, e) {
|
|
|
13615
13615
|
if (n = e.code, ns(n) && n !== G.ABORTED) {
|
|
13616
13616
|
// This was a permanent error, the request itself was the problem
|
|
13617
13617
|
// so it's not going to succeed if we resend it.
|
|
13618
|
-
const n = t.
|
|
13618
|
+
const n = t.cu.shift();
|
|
13619
13619
|
// In this case it's also unlikely that the server itself is melting
|
|
13620
13620
|
// down -- this was just a bad request so inhibit backoff on the next
|
|
13621
13621
|
// restart.
|
|
@@ -13712,8 +13712,8 @@ async function ku(t, e) {
|
|
|
13712
13712
|
}), t.fu.push((async e => {
|
|
13713
13713
|
e ? (t.gu.No(),
|
|
13714
13714
|
// This will start the write stream if necessary.
|
|
13715
|
-
await bu(t)) : (await t.gu.stop(), t.
|
|
13716
|
-
t.
|
|
13715
|
+
await bu(t)) : (await t.gu.stop(), t.cu.length > 0 && (M("RemoteStore", `Stopping write stream with ${t.cu.length} pending writes`),
|
|
13716
|
+
t.cu = []));
|
|
13717
13717
|
}))), t.gu;
|
|
13718
13718
|
}
|
|
13719
13719
|
|
|
@@ -13836,7 +13836,7 @@ class $u {
|
|
|
13836
13836
|
// We are adding document key comparator to the end as it's the only
|
|
13837
13837
|
// guaranteed unique property of a document.
|
|
13838
13838
|
this.comparator = t ? (e, n) => t(e, n) || dt.comparator(e.key, n.key) : (t, e) => dt.comparator(t.key, e.key),
|
|
13839
|
-
this.keyedMap =
|
|
13839
|
+
this.keyedMap = as(), this.sortedSet = new qt(this.comparator);
|
|
13840
13840
|
}
|
|
13841
13841
|
/**
|
|
13842
13842
|
* Returns an empty copy of the existing DocumentSet, using the same
|
|
@@ -14223,7 +14223,7 @@ function Hu(t) {
|
|
|
14223
14223
|
/** Batched documents to be saved into storage */
|
|
14224
14224
|
this.documents = [],
|
|
14225
14225
|
/** The collection groups affected by this bundle. */
|
|
14226
|
-
this.collectionGroups = new Set, this.progress =
|
|
14226
|
+
this.collectionGroups = new Set, this.progress = ta(t);
|
|
14227
14227
|
}
|
|
14228
14228
|
/**
|
|
14229
14229
|
* Adds an element from the bundle to the loader.
|
|
@@ -14271,7 +14271,7 @@ function Hu(t) {
|
|
|
14271
14271
|
/**
|
|
14272
14272
|
* Returns a `LoadBundleTaskProgress` representing the initial progress of
|
|
14273
14273
|
* loading a bundle.
|
|
14274
|
-
*/ function
|
|
14274
|
+
*/ function ta(t) {
|
|
14275
14275
|
return {
|
|
14276
14276
|
taskState: "Running",
|
|
14277
14277
|
documentsLoaded: 0,
|
|
@@ -14301,13 +14301,13 @@ function Hu(t) {
|
|
|
14301
14301
|
* See the License for the specific language governing permissions and
|
|
14302
14302
|
* limitations under the License.
|
|
14303
14303
|
*/
|
|
14304
|
-
class
|
|
14304
|
+
class ea {
|
|
14305
14305
|
constructor(t) {
|
|
14306
14306
|
this.key = t;
|
|
14307
14307
|
}
|
|
14308
14308
|
}
|
|
14309
14309
|
|
|
14310
|
-
class
|
|
14310
|
+
class na {
|
|
14311
14311
|
constructor(t) {
|
|
14312
14312
|
this.key = t;
|
|
14313
14313
|
}
|
|
@@ -14317,7 +14317,7 @@ class nc {
|
|
|
14317
14317
|
* View is responsible for computing the final merged truth of what docs are in
|
|
14318
14318
|
* a query. It gets notified of local and remote changes to docs, and applies
|
|
14319
14319
|
* the query filters and limits to determine the most correct possible results.
|
|
14320
|
-
*/ class
|
|
14320
|
+
*/ class sa {
|
|
14321
14321
|
constructor(t,
|
|
14322
14322
|
/** Documents included in the remote target */
|
|
14323
14323
|
e) {
|
|
@@ -14360,34 +14360,34 @@ class nc {
|
|
|
14360
14360
|
// deletes. So we keep this doc at the old limit to compare the updates to.
|
|
14361
14361
|
// Note that this should never get used in a refill (when previousChanges is
|
|
14362
14362
|
// set), because there will only be adds -- no deletes or updates.
|
|
14363
|
-
const u = "F" /* First */ === this.query.limitType && s.size === this.query.limit ? s.last() : null,
|
|
14363
|
+
const u = "F" /* First */ === this.query.limitType && s.size === this.query.limit ? s.last() : null, a = "L" /* Last */ === this.query.limitType && s.size === this.query.limit ? s.first() : null;
|
|
14364
14364
|
// Drop documents out to meet limit/limitToLast requirement.
|
|
14365
14365
|
if (t.inorderTraversal(((t, e) => {
|
|
14366
|
-
const
|
|
14366
|
+
const c = s.get(t), h = mn(this.query, e) ? e : null, l = !!c && this.mutatedKeys.has(c.key), f = !!h && (h.hasLocalMutations ||
|
|
14367
14367
|
// We only consider committed mutations for documents that were
|
|
14368
14368
|
// mutated during the lifetime of the view.
|
|
14369
14369
|
this.mutatedKeys.has(h.key) && h.hasCommittedMutations);
|
|
14370
14370
|
let d = !1;
|
|
14371
14371
|
// Calculate change
|
|
14372
|
-
if (
|
|
14373
|
-
|
|
14372
|
+
if (c && h) {
|
|
14373
|
+
c.data.isEqual(h.data) ? l !== f && (n.track({
|
|
14374
14374
|
type: 3 /* Metadata */ ,
|
|
14375
14375
|
doc: h
|
|
14376
|
-
}), d = !0) : this.Qu(
|
|
14376
|
+
}), d = !0) : this.Qu(c, h) || (n.track({
|
|
14377
14377
|
type: 2 /* Modified */ ,
|
|
14378
14378
|
doc: h
|
|
14379
|
-
}), d = !0, (u && this.Lu(h, u) > 0 ||
|
|
14379
|
+
}), d = !0, (u && this.Lu(h, u) > 0 || a && this.Lu(h, a) < 0) && (
|
|
14380
14380
|
// This doc moved from inside the limit to outside the limit.
|
|
14381
14381
|
// That means there may be some other doc in the local cache
|
|
14382
14382
|
// that should be included instead.
|
|
14383
14383
|
o = !0));
|
|
14384
|
-
} else !
|
|
14384
|
+
} else !c && h ? (n.track({
|
|
14385
14385
|
type: 0 /* Added */ ,
|
|
14386
14386
|
doc: h
|
|
14387
|
-
}), d = !0) :
|
|
14387
|
+
}), d = !0) : c && !h && (n.track({
|
|
14388
14388
|
type: 1 /* Removed */ ,
|
|
14389
|
-
doc:
|
|
14390
|
-
}), d = !0, (u ||
|
|
14389
|
+
doc: c
|
|
14390
|
+
}), d = !0, (u || a) && (
|
|
14391
14391
|
// A doc was removed from a full limit query. We'll need to
|
|
14392
14392
|
// requery from the local cache to see if we know about some other
|
|
14393
14393
|
// doc that should be in the results.
|
|
@@ -14530,9 +14530,9 @@ class nc {
|
|
|
14530
14530
|
// Diff the new limbo docs with the old limbo docs.
|
|
14531
14531
|
const e = [];
|
|
14532
14532
|
return t.forEach((t => {
|
|
14533
|
-
this.Bu.has(t) || e.push(new
|
|
14533
|
+
this.Bu.has(t) || e.push(new na(t));
|
|
14534
14534
|
})), this.Bu.forEach((n => {
|
|
14535
|
-
t.has(n) || e.push(new
|
|
14535
|
+
t.has(n) || e.push(new ea(n));
|
|
14536
14536
|
})), e;
|
|
14537
14537
|
}
|
|
14538
14538
|
/**
|
|
@@ -14575,7 +14575,7 @@ class nc {
|
|
|
14575
14575
|
* QueryView contains all of the data that SyncEngine needs to keep track of for
|
|
14576
14576
|
* a particular query.
|
|
14577
14577
|
*/
|
|
14578
|
-
class
|
|
14578
|
+
class ia {
|
|
14579
14579
|
constructor(
|
|
14580
14580
|
/**
|
|
14581
14581
|
* The query itself.
|
|
@@ -14597,7 +14597,7 @@ class ic {
|
|
|
14597
14597
|
}
|
|
14598
14598
|
}
|
|
14599
14599
|
|
|
14600
|
-
/** Tracks a limbo resolution. */ class
|
|
14600
|
+
/** Tracks a limbo resolution. */ class ra {
|
|
14601
14601
|
constructor(t) {
|
|
14602
14602
|
this.key = t,
|
|
14603
14603
|
/**
|
|
@@ -14622,13 +14622,13 @@ class ic {
|
|
|
14622
14622
|
* the class is not exported so they are only accessible from this module.
|
|
14623
14623
|
* This is useful to implement optional features (like bundles) in free
|
|
14624
14624
|
* functions, such that they are tree-shakeable.
|
|
14625
|
-
*/ class
|
|
14625
|
+
*/ class oa {
|
|
14626
14626
|
constructor(t, e, n,
|
|
14627
14627
|
// PORTING NOTE: Manages state synchronization in multi-tab environments.
|
|
14628
14628
|
s, i, r) {
|
|
14629
14629
|
this.localStore = t, this.remoteStore = e, this.eventManager = n, this.sharedClientState = s,
|
|
14630
|
-
this.currentUser = i, this.maxConcurrentLimboResolutions = r, this.Zu = {}, this.
|
|
14631
|
-
this.
|
|
14630
|
+
this.currentUser = i, this.maxConcurrentLimboResolutions = r, this.Zu = {}, this.ta = new is((t => _n(t)), dn),
|
|
14631
|
+
this.ea = new Map,
|
|
14632
14632
|
/**
|
|
14633
14633
|
* The keys of documents that are in limbo for which we haven't yet started a
|
|
14634
14634
|
* limbo resolution query. The strings in this set are the result of calling
|
|
@@ -14638,28 +14638,28 @@ class ic {
|
|
|
14638
14638
|
* of arbitrary elements and it also maintains insertion order, providing the
|
|
14639
14639
|
* desired queue-like FIFO semantics.
|
|
14640
14640
|
*/
|
|
14641
|
-
this.
|
|
14641
|
+
this.na = new Set,
|
|
14642
14642
|
/**
|
|
14643
14643
|
* Keeps track of the target ID for each document that is in limbo with an
|
|
14644
14644
|
* active target.
|
|
14645
14645
|
*/
|
|
14646
|
-
this.
|
|
14646
|
+
this.sa = new qt(dt.comparator),
|
|
14647
14647
|
/**
|
|
14648
14648
|
* Keeps track of the information about an active limbo resolution for each
|
|
14649
14649
|
* active target ID that was started for the purpose of limbo resolution.
|
|
14650
14650
|
*/
|
|
14651
|
-
this.
|
|
14651
|
+
this.ia = new Map, this.ra = new io,
|
|
14652
14652
|
/** Stores user completion handlers, indexed by User and BatchId. */
|
|
14653
|
-
this.
|
|
14653
|
+
this.oa = {},
|
|
14654
14654
|
/** Stores user callbacks waiting for all pending writes to be acknowledged. */
|
|
14655
|
-
this.
|
|
14655
|
+
this.ua = new Map, this.aa = kr.Rn(), this.onlineState = "Unknown" /* Unknown */ ,
|
|
14656
14656
|
// The primary state is set to `true` or `false` immediately after Firestore
|
|
14657
14657
|
// startup. In the interim, a client should only be considered primary if
|
|
14658
14658
|
// `isPrimary` is true.
|
|
14659
|
-
this.
|
|
14659
|
+
this.ca = void 0;
|
|
14660
14660
|
}
|
|
14661
14661
|
get isPrimaryClient() {
|
|
14662
|
-
return !0 === this.
|
|
14662
|
+
return !0 === this.ca;
|
|
14663
14663
|
}
|
|
14664
14664
|
}
|
|
14665
14665
|
|
|
@@ -14668,10 +14668,10 @@ class ic {
|
|
|
14668
14668
|
* server. All the subsequent view snapshots or errors are sent to the
|
|
14669
14669
|
* subscribed handlers. Returns the initial snapshot.
|
|
14670
14670
|
*/
|
|
14671
|
-
async function
|
|
14672
|
-
const n =
|
|
14671
|
+
async function ua(t, e) {
|
|
14672
|
+
const n = Ma(t);
|
|
14673
14673
|
let s, i;
|
|
14674
|
-
const r = n.
|
|
14674
|
+
const r = n.ta.get(e);
|
|
14675
14675
|
if (r)
|
|
14676
14676
|
// PORTING NOTE: With Multi-Tab Web, it is possible that a query view
|
|
14677
14677
|
// already exists when EventManager calls us for the first time. This
|
|
@@ -14683,7 +14683,7 @@ async function uc(t, e) {
|
|
|
14683
14683
|
const t = await Co(n.localStore, ln(e));
|
|
14684
14684
|
n.isPrimaryClient && fu(n.remoteStore, t);
|
|
14685
14685
|
const r = n.sharedClientState.addLocalQueryTarget(t.targetId);
|
|
14686
|
-
s = t.targetId, i = await
|
|
14686
|
+
s = t.targetId, i = await aa(n, e, s, "current" === r);
|
|
14687
14687
|
}
|
|
14688
14688
|
return i;
|
|
14689
14689
|
}
|
|
@@ -14691,11 +14691,11 @@ async function uc(t, e) {
|
|
|
14691
14691
|
/**
|
|
14692
14692
|
* Registers a view for a previously unknown query and computes its initial
|
|
14693
14693
|
* snapshot.
|
|
14694
|
-
*/ async function
|
|
14694
|
+
*/ async function aa(t, e, n, s) {
|
|
14695
14695
|
// PORTING NOTE: On Web only, we inject the code that registers new Limbo
|
|
14696
14696
|
// targets based on view changes. This allows us to only depend on Limbo
|
|
14697
14697
|
// changes when user code includes queries.
|
|
14698
|
-
t.
|
|
14698
|
+
t.ha = (e, n, s) => async function(t, e, n, s) {
|
|
14699
14699
|
let i = e.view.Ku(n);
|
|
14700
14700
|
i.Oi && (
|
|
14701
14701
|
// The query has a limit and some docs were removed, so we need
|
|
@@ -14705,19 +14705,19 @@ async function uc(t, e) {
|
|
|
14705
14705
|
/* usePreviousResults= */ !1).then((({documents: t}) => e.view.Ku(t, i))));
|
|
14706
14706
|
const r = s && s.targetChanges.get(e.targetId), o = e.view.applyChanges(i,
|
|
14707
14707
|
/* updateLimboDocuments= */ t.isPrimaryClient, r);
|
|
14708
|
-
return
|
|
14708
|
+
return Ta(t, e.targetId, o.zu), o.snapshot;
|
|
14709
14709
|
}(t, e, n, s);
|
|
14710
14710
|
const i = await No(t.localStore, e,
|
|
14711
|
-
/* usePreviousResults= */ !0), r = new
|
|
14711
|
+
/* usePreviousResults= */ !0), r = new sa(e, i.ji), o = r.Ku(i.documents), u = ps.createSynthesizedTargetChangeForCurrentChange(n, s && "Offline" /* Offline */ !== t.onlineState), a = r.applyChanges(o,
|
|
14712
14712
|
/* updateLimboDocuments= */ t.isPrimaryClient, u);
|
|
14713
|
-
|
|
14714
|
-
const
|
|
14715
|
-
return t.
|
|
14713
|
+
Ta(t, n, a.zu);
|
|
14714
|
+
const c = new ia(e, n, r);
|
|
14715
|
+
return t.ta.set(e, c), t.ea.has(n) ? t.ea.get(n).push(e) : t.ea.set(n, [ e ]), a.snapshot;
|
|
14716
14716
|
}
|
|
14717
14717
|
|
|
14718
|
-
/** Stops listening to the query. */ async function
|
|
14719
|
-
const n = K(t), s = n.
|
|
14720
|
-
if (i.length > 1) return n.
|
|
14718
|
+
/** Stops listening to the query. */ async function ca(t, e) {
|
|
14719
|
+
const n = K(t), s = n.ta.get(e), i = n.ea.get(s.targetId);
|
|
14720
|
+
if (i.length > 1) return n.ea.set(s.targetId, i.filter((t => !dn(t, e)))), void n.ta.delete(e);
|
|
14721
14721
|
// No other queries are mapped to the target, clean up the query and the target.
|
|
14722
14722
|
if (n.isPrimaryClient) {
|
|
14723
14723
|
// We need to remove the local query target first to allow us to verify
|
|
@@ -14726,9 +14726,9 @@ async function uc(t, e) {
|
|
|
14726
14726
|
n.sharedClientState.isActiveQueryTarget(s.targetId) || await xo(n.localStore, s.targetId,
|
|
14727
14727
|
/*keepPersistedTargetData=*/ !1).then((() => {
|
|
14728
14728
|
n.sharedClientState.clearQueryState(s.targetId), du(n.remoteStore, s.targetId),
|
|
14729
|
-
|
|
14729
|
+
pa(n, s.targetId);
|
|
14730
14730
|
})).catch(bt);
|
|
14731
|
-
} else
|
|
14731
|
+
} else pa(n, s.targetId), await xo(n.localStore, s.targetId,
|
|
14732
14732
|
/*keepPersistedTargetData=*/ !0);
|
|
14733
14733
|
}
|
|
14734
14734
|
|
|
@@ -14741,8 +14741,8 @@ async function uc(t, e) {
|
|
|
14741
14741
|
* have completed, *not* when the write was acked by the backend. The
|
|
14742
14742
|
* userCallback is resolved once the write was acked/rejected by the
|
|
14743
14743
|
* backend (or failed locally for any other reason).
|
|
14744
|
-
*/ async function
|
|
14745
|
-
const s =
|
|
14744
|
+
*/ async function ha(t, e, n) {
|
|
14745
|
+
const s = Fa(t);
|
|
14746
14746
|
try {
|
|
14747
14747
|
const t = await function(t, e) {
|
|
14748
14748
|
const n = K(t), s = ut.now(), i = e.reduce(((t, e) => t.add(e.key)), ws());
|
|
@@ -14754,10 +14754,10 @@ async function uc(t, e) {
|
|
|
14754
14754
|
// TODO(Overlay): Is there a better way to determine this? Using the
|
|
14755
14755
|
// document version does not work because local mutations set them back
|
|
14756
14756
|
// to 0.
|
|
14757
|
-
let u = os(),
|
|
14757
|
+
let u = os(), a = ws();
|
|
14758
14758
|
return n.Ui.getEntries(t, i).next((t => {
|
|
14759
14759
|
u = t, u.forEach(((t, e) => {
|
|
14760
|
-
e.isValidDocument() || (
|
|
14760
|
+
e.isValidDocument() || (a = a.add(t));
|
|
14761
14761
|
}));
|
|
14762
14762
|
})).next((() => n.localDocuments.getOverlayedDocuments(t, u))).next((i => {
|
|
14763
14763
|
r = i;
|
|
@@ -14778,23 +14778,23 @@ async function uc(t, e) {
|
|
|
14778
14778
|
return n.mutationQueue.addMutationBatch(t, s, o, e);
|
|
14779
14779
|
})).next((e => {
|
|
14780
14780
|
o = e;
|
|
14781
|
-
const s = e.applyToLocalDocumentSet(r,
|
|
14781
|
+
const s = e.applyToLocalDocumentSet(r, a);
|
|
14782
14782
|
return n.documentOverlayCache.saveOverlays(t, e.batchId, s);
|
|
14783
14783
|
}));
|
|
14784
14784
|
})).then((() => ({
|
|
14785
14785
|
batchId: o.batchId,
|
|
14786
|
-
changes:
|
|
14786
|
+
changes: cs(r)
|
|
14787
14787
|
})));
|
|
14788
14788
|
}(s.localStore, e);
|
|
14789
14789
|
s.sharedClientState.addPendingMutation(t.batchId), function(t, e, n) {
|
|
14790
|
-
let s = t.
|
|
14790
|
+
let s = t.oa[t.currentUser.toKey()];
|
|
14791
14791
|
s || (s = new qt(it));
|
|
14792
|
-
s = s.insert(e, n), t.
|
|
14792
|
+
s = s.insert(e, n), t.oa[t.currentUser.toKey()] = s;
|
|
14793
14793
|
}
|
|
14794
14794
|
/**
|
|
14795
14795
|
* Resolves or rejects the user callback for the given batch and then discards
|
|
14796
14796
|
* it.
|
|
14797
|
-
*/ (s, t.batchId, n), await
|
|
14797
|
+
*/ (s, t.batchId, n), await Ra(s, t.changes), await bu(s.remoteStore);
|
|
14798
14798
|
} catch (t) {
|
|
14799
14799
|
// If we can't persist the mutation, we reject the user callback and
|
|
14800
14800
|
// don't send the mutation. The user can then retry the write.
|
|
@@ -14807,20 +14807,20 @@ async function uc(t, e) {
|
|
|
14807
14807
|
* Applies one remote event to the sync engine, notifying any views of the
|
|
14808
14808
|
* changes, and releasing any pending mutation batches that would become
|
|
14809
14809
|
* visible because of the snapshot version the remote event contains.
|
|
14810
|
-
*/ async function
|
|
14810
|
+
*/ async function la(t, e) {
|
|
14811
14811
|
const n = K(t);
|
|
14812
14812
|
try {
|
|
14813
14813
|
const t = await Vo(n.localStore, e);
|
|
14814
14814
|
// Update `receivedDocument` as appropriate for any limbo targets.
|
|
14815
14815
|
e.targetChanges.forEach(((t, e) => {
|
|
14816
|
-
const s = n.
|
|
14816
|
+
const s = n.ia.get(e);
|
|
14817
14817
|
s && (
|
|
14818
14818
|
// Since this is a limbo resolution lookup, it's for a single document
|
|
14819
14819
|
// and it could be added, modified, or removed, but not a combination.
|
|
14820
14820
|
U(t.addedDocuments.size + t.modifiedDocuments.size + t.removedDocuments.size <= 1),
|
|
14821
14821
|
t.addedDocuments.size > 0 ? s.Xu = !0 : t.modifiedDocuments.size > 0 ? U(s.Xu) : t.removedDocuments.size > 0 && (U(s.Xu),
|
|
14822
14822
|
s.Xu = !1));
|
|
14823
|
-
})), await
|
|
14823
|
+
})), await Ra(n, t, e);
|
|
14824
14824
|
} catch (t) {
|
|
14825
14825
|
await bt(t);
|
|
14826
14826
|
}
|
|
@@ -14829,7 +14829,7 @@ async function uc(t, e) {
|
|
|
14829
14829
|
/**
|
|
14830
14830
|
* Applies an OnlineState change to the sync engine and notifies any views of
|
|
14831
14831
|
* the change.
|
|
14832
|
-
*/ function
|
|
14832
|
+
*/ function fa(t, e, n) {
|
|
14833
14833
|
const s = K(t);
|
|
14834
14834
|
// If we are the secondary client, we explicitly ignore the remote store's
|
|
14835
14835
|
// online state (the local client may go offline, even though the primary
|
|
@@ -14837,7 +14837,7 @@ async function uc(t, e) {
|
|
|
14837
14837
|
// SharedClientState.
|
|
14838
14838
|
if (s.isPrimaryClient && 0 /* RemoteStore */ === n || !s.isPrimaryClient && 1 /* SharedClientState */ === n) {
|
|
14839
14839
|
const t = [];
|
|
14840
|
-
s.
|
|
14840
|
+
s.ta.forEach(((n, s) => {
|
|
14841
14841
|
const i = s.view.Eu(e);
|
|
14842
14842
|
i.snapshot && t.push(i.snapshot);
|
|
14843
14843
|
})), function(t, e) {
|
|
@@ -14863,11 +14863,11 @@ async function uc(t, e) {
|
|
|
14863
14863
|
* @param err - A description of the condition that has forced the rejection.
|
|
14864
14864
|
* Nearly always this will be an indication that the user is no longer
|
|
14865
14865
|
* authorized to see the data matching the target.
|
|
14866
|
-
*/ async function
|
|
14866
|
+
*/ async function da(t, e, n) {
|
|
14867
14867
|
const s = K(t);
|
|
14868
14868
|
// PORTING NOTE: Multi-tab only.
|
|
14869
14869
|
s.sharedClientState.updateQueryState(e, "rejected", n);
|
|
14870
|
-
const i = s.
|
|
14870
|
+
const i = s.ia.get(e), r = i && i.key;
|
|
14871
14871
|
if (r) {
|
|
14872
14872
|
// TODO(klimt): We really only should do the following on permission
|
|
14873
14873
|
// denied errors, but we don't have the cause code here.
|
|
@@ -14879,22 +14879,22 @@ async function uc(t, e) {
|
|
|
14879
14879
|
// TODO(b/217189216): This limbo document should ideally have a read time,
|
|
14880
14880
|
// so that it is picked up by any read-time based scans. The backend,
|
|
14881
14881
|
// however, does not send a read time for target removals.
|
|
14882
|
-
t = t.insert(r, xe.newNoDocument(r,
|
|
14883
|
-
const n = ws().add(r), i = new ys(
|
|
14882
|
+
t = t.insert(r, xe.newNoDocument(r, at.min()));
|
|
14883
|
+
const n = ws().add(r), i = new ys(at.min(),
|
|
14884
14884
|
/* targetChanges= */ new Map,
|
|
14885
14885
|
/* targetMismatches= */ new Qt(it), t, n);
|
|
14886
|
-
await
|
|
14886
|
+
await la(s, i),
|
|
14887
14887
|
// Since this query failed, we won't want to manually unlisten to it.
|
|
14888
14888
|
// We only remove it from bookkeeping after we successfully applied the
|
|
14889
14889
|
// RemoteEvent. If `applyRemoteEvent()` throws, we want to re-listen to
|
|
14890
14890
|
// this query when the RemoteStore restarts the Watch stream, which should
|
|
14891
14891
|
// re-trigger the target failure.
|
|
14892
|
-
s.
|
|
14892
|
+
s.sa = s.sa.remove(r), s.ia.delete(e), Aa(s);
|
|
14893
14893
|
} else await xo(s.localStore, e,
|
|
14894
|
-
/* keepPersistedTargetData */ !1).then((() =>
|
|
14894
|
+
/* keepPersistedTargetData */ !1).then((() => pa(s, e, n))).catch(bt);
|
|
14895
14895
|
}
|
|
14896
14896
|
|
|
14897
|
-
async function
|
|
14897
|
+
async function _a(t, e) {
|
|
14898
14898
|
const n = K(t), s = e.batch.batchId;
|
|
14899
14899
|
try {
|
|
14900
14900
|
const t = await Po(n.localStore, e);
|
|
@@ -14902,14 +14902,14 @@ async function _c(t, e) {
|
|
|
14902
14902
|
// raise events immediately (depending on whether the watcher is caught
|
|
14903
14903
|
// up), so we raise user callbacks first so that they consistently happen
|
|
14904
14904
|
// before listen events.
|
|
14905
|
-
|
|
14906
|
-
await
|
|
14905
|
+
ya(n, s, /*error=*/ null), ga(n, s), n.sharedClientState.updateMutationState(s, "acknowledged"),
|
|
14906
|
+
await Ra(n, t);
|
|
14907
14907
|
} catch (t) {
|
|
14908
14908
|
await bt(t);
|
|
14909
14909
|
}
|
|
14910
14910
|
}
|
|
14911
14911
|
|
|
14912
|
-
async function
|
|
14912
|
+
async function wa(t, e, n) {
|
|
14913
14913
|
const s = K(t);
|
|
14914
14914
|
try {
|
|
14915
14915
|
const t = await function(t, e) {
|
|
@@ -14930,8 +14930,8 @@ async function wc(t, e, n) {
|
|
|
14930
14930
|
// raise events immediately (depending on whether the watcher is caught up),
|
|
14931
14931
|
// so we raise user callbacks first so that they consistently happen before
|
|
14932
14932
|
// listen events.
|
|
14933
|
-
|
|
14934
|
-
await
|
|
14933
|
+
ya(s, e, n), ga(s, e), s.sharedClientState.updateMutationState(e, "rejected", n),
|
|
14934
|
+
await Ra(s, t);
|
|
14935
14935
|
} catch (n) {
|
|
14936
14936
|
await bt(n);
|
|
14937
14937
|
}
|
|
@@ -14940,7 +14940,7 @@ async function wc(t, e, n) {
|
|
|
14940
14940
|
/**
|
|
14941
14941
|
* Registers a user callback that resolves when all pending mutations at the moment of calling
|
|
14942
14942
|
* are acknowledged .
|
|
14943
|
-
*/ async function
|
|
14943
|
+
*/ async function ma(t, e) {
|
|
14944
14944
|
const n = K(t);
|
|
14945
14945
|
yu(n.remoteStore) || M("SyncEngine", "The network is disabled. The task returned by 'awaitPendingWrites()' will not complete until the network is enabled.");
|
|
14946
14946
|
try {
|
|
@@ -14951,8 +14951,8 @@ async function wc(t, e, n) {
|
|
|
14951
14951
|
if (-1 === t)
|
|
14952
14952
|
// Trigger the callback right away if there is no pending writes at the moment.
|
|
14953
14953
|
return void e.resolve();
|
|
14954
|
-
const s = n.
|
|
14955
|
-
s.push(e), n.
|
|
14954
|
+
const s = n.ua.get(t) || [];
|
|
14955
|
+
s.push(e), n.ua.set(t, s);
|
|
14956
14956
|
} catch (t) {
|
|
14957
14957
|
const n = Bu(t, "Initialization of waitForPendingWrites() operation failed");
|
|
14958
14958
|
e.reject(n);
|
|
@@ -14962,56 +14962,56 @@ async function wc(t, e, n) {
|
|
|
14962
14962
|
/**
|
|
14963
14963
|
* Triggers the callbacks that are waiting for this batch id to get acknowledged by server,
|
|
14964
14964
|
* if there are any.
|
|
14965
|
-
*/ function
|
|
14966
|
-
(t.
|
|
14965
|
+
*/ function ga(t, e) {
|
|
14966
|
+
(t.ua.get(e) || []).forEach((t => {
|
|
14967
14967
|
t.resolve();
|
|
14968
|
-
})), t.
|
|
14968
|
+
})), t.ua.delete(e);
|
|
14969
14969
|
}
|
|
14970
14970
|
|
|
14971
|
-
/** Reject all outstanding callbacks waiting for pending writes to complete. */ function
|
|
14971
|
+
/** Reject all outstanding callbacks waiting for pending writes to complete. */ function ya(t, e, n) {
|
|
14972
14972
|
const s = K(t);
|
|
14973
|
-
let i = s.
|
|
14973
|
+
let i = s.oa[s.currentUser.toKey()];
|
|
14974
14974
|
// NOTE: Mutations restored from persistence won't have callbacks, so it's
|
|
14975
14975
|
// okay for there to be no callback for this ID.
|
|
14976
14976
|
if (i) {
|
|
14977
14977
|
const t = i.get(e);
|
|
14978
|
-
t && (n ? t.reject(n) : t.resolve(), i = i.remove(e)), s.
|
|
14978
|
+
t && (n ? t.reject(n) : t.resolve(), i = i.remove(e)), s.oa[s.currentUser.toKey()] = i;
|
|
14979
14979
|
}
|
|
14980
14980
|
}
|
|
14981
14981
|
|
|
14982
|
-
function
|
|
14982
|
+
function pa(t, e, n = null) {
|
|
14983
14983
|
t.sharedClientState.removeLocalQueryTarget(e);
|
|
14984
|
-
for (const s of t.
|
|
14985
|
-
if (t.
|
|
14986
|
-
t.
|
|
14987
|
-
t.
|
|
14984
|
+
for (const s of t.ea.get(e)) t.ta.delete(s), n && t.Zu.la(s, n);
|
|
14985
|
+
if (t.ea.delete(e), t.isPrimaryClient) {
|
|
14986
|
+
t.ra.us(e).forEach((e => {
|
|
14987
|
+
t.ra.containsKey(e) ||
|
|
14988
14988
|
// We removed the last reference for this key
|
|
14989
|
-
|
|
14989
|
+
Ia(t, e);
|
|
14990
14990
|
}));
|
|
14991
14991
|
}
|
|
14992
14992
|
}
|
|
14993
14993
|
|
|
14994
|
-
function
|
|
14995
|
-
t.
|
|
14994
|
+
function Ia(t, e) {
|
|
14995
|
+
t.na.delete(e.path.canonicalString());
|
|
14996
14996
|
// It's possible that the target already got removed because the query failed. In that case,
|
|
14997
14997
|
// the key won't exist in `limboTargetsByKey`. Only do the cleanup if we still have the target.
|
|
14998
|
-
const n = t.
|
|
14999
|
-
null !== n && (du(t.remoteStore, n), t.
|
|
14998
|
+
const n = t.sa.get(e);
|
|
14999
|
+
null !== n && (du(t.remoteStore, n), t.sa = t.sa.remove(e), t.ia.delete(n), Aa(t));
|
|
15000
15000
|
}
|
|
15001
15001
|
|
|
15002
|
-
function
|
|
15003
|
-
for (const s of n) if (s instanceof
|
|
15004
|
-
M("SyncEngine", "Document no longer in limbo: " + s.key), t.
|
|
15005
|
-
t.
|
|
15002
|
+
function Ta(t, e, n) {
|
|
15003
|
+
for (const s of n) if (s instanceof ea) t.ra.addReference(s.key, e), Ea(t, s); else if (s instanceof na) {
|
|
15004
|
+
M("SyncEngine", "Document no longer in limbo: " + s.key), t.ra.removeReference(s.key, e);
|
|
15005
|
+
t.ra.containsKey(s.key) ||
|
|
15006
15006
|
// We removed the last reference for this key
|
|
15007
|
-
|
|
15007
|
+
Ia(t, s.key);
|
|
15008
15008
|
} else L();
|
|
15009
15009
|
}
|
|
15010
15010
|
|
|
15011
|
-
function
|
|
15011
|
+
function Ea(t, e) {
|
|
15012
15012
|
const n = e.key, s = n.path.canonicalString();
|
|
15013
|
-
t.
|
|
15014
|
-
|
|
15013
|
+
t.sa.get(n) || t.na.has(s) || (M("SyncEngine", "New document in limbo: " + n), t.na.add(s),
|
|
15014
|
+
Aa(t));
|
|
15015
15015
|
}
|
|
15016
15016
|
|
|
15017
15017
|
/**
|
|
@@ -15021,19 +15021,19 @@ function Ec(t, e) {
|
|
|
15021
15021
|
* Without bounding the number of concurrent resolutions, the server can fail
|
|
15022
15022
|
* with "resource exhausted" errors which can lead to pathological client
|
|
15023
15023
|
* behavior as seen in https://github.com/firebase/firebase-js-sdk/issues/2683.
|
|
15024
|
-
*/ function
|
|
15025
|
-
for (;t.
|
|
15026
|
-
const e = t.
|
|
15027
|
-
t.
|
|
15028
|
-
const n = new dt(ht.fromString(e)), s = t.
|
|
15029
|
-
t.
|
|
15024
|
+
*/ function Aa(t) {
|
|
15025
|
+
for (;t.na.size > 0 && t.sa.size < t.maxConcurrentLimboResolutions; ) {
|
|
15026
|
+
const e = t.na.values().next().value;
|
|
15027
|
+
t.na.delete(e);
|
|
15028
|
+
const n = new dt(ht.fromString(e)), s = t.aa.next();
|
|
15029
|
+
t.ia.set(s, new ra(n)), t.sa = t.sa.insert(n, s), fu(t.remoteStore, new Li(ln(rn(n.path)), s, 2 /* LimboResolution */ , $t.ot));
|
|
15030
15030
|
}
|
|
15031
15031
|
}
|
|
15032
15032
|
|
|
15033
|
-
async function
|
|
15033
|
+
async function Ra(t, e, n) {
|
|
15034
15034
|
const s = K(t), i = [], r = [], o = [];
|
|
15035
|
-
s.
|
|
15036
|
-
o.push(s.
|
|
15035
|
+
s.ta.isEmpty() || (s.ta.forEach(((t, u) => {
|
|
15036
|
+
o.push(s.ha(u, e, n).then((t => {
|
|
15037
15037
|
if (t) {
|
|
15038
15038
|
s.isPrimaryClient && s.sharedClientState.updateQueryState(u.targetId, t.fromCache ? "not-current" : "current"),
|
|
15039
15039
|
i.push(t);
|
|
@@ -15064,7 +15064,7 @@ async function Rc(t, e, n) {
|
|
|
15064
15064
|
}(s.localStore, r));
|
|
15065
15065
|
}
|
|
15066
15066
|
|
|
15067
|
-
async function
|
|
15067
|
+
async function ba(t, e) {
|
|
15068
15068
|
const n = K(t);
|
|
15069
15069
|
if (!n.currentUser.isEqual(e)) {
|
|
15070
15070
|
M("SyncEngine", "User change. New user:", e.toKey());
|
|
@@ -15072,26 +15072,26 @@ async function bc(t, e) {
|
|
|
15072
15072
|
n.currentUser = e,
|
|
15073
15073
|
// Fails tasks waiting for pending writes requested by previous user.
|
|
15074
15074
|
function(t, e) {
|
|
15075
|
-
t.
|
|
15075
|
+
t.ua.forEach((t => {
|
|
15076
15076
|
t.forEach((t => {
|
|
15077
15077
|
t.reject(new Q(G.CANCELLED, e));
|
|
15078
15078
|
}));
|
|
15079
|
-
})), t.
|
|
15079
|
+
})), t.ua.clear();
|
|
15080
15080
|
}(n, "'waitForPendingWrites' promise is rejected due to a user change."),
|
|
15081
15081
|
// TODO(b/114226417): Consider calling this only in the primary tab.
|
|
15082
|
-
n.sharedClientState.handleUserChange(e, t.removedBatchIds, t.addedBatchIds), await
|
|
15082
|
+
n.sharedClientState.handleUserChange(e, t.removedBatchIds, t.addedBatchIds), await Ra(n, t.Ki);
|
|
15083
15083
|
}
|
|
15084
15084
|
}
|
|
15085
15085
|
|
|
15086
|
-
function
|
|
15087
|
-
const n = K(t), s = n.
|
|
15086
|
+
function Pa(t, e) {
|
|
15087
|
+
const n = K(t), s = n.ia.get(e);
|
|
15088
15088
|
if (s && s.Xu) return ws().add(s.key);
|
|
15089
15089
|
{
|
|
15090
15090
|
let t = ws();
|
|
15091
|
-
const s = n.
|
|
15091
|
+
const s = n.ea.get(e);
|
|
15092
15092
|
if (!s) return t;
|
|
15093
15093
|
for (const e of s) {
|
|
15094
|
-
const s = n.
|
|
15094
|
+
const s = n.ta.get(e);
|
|
15095
15095
|
t = t.unionWith(s.view.qu);
|
|
15096
15096
|
}
|
|
15097
15097
|
return t;
|
|
@@ -15101,10 +15101,10 @@ function Pc(t, e) {
|
|
|
15101
15101
|
/**
|
|
15102
15102
|
* Reconcile the list of synced documents in an existing view with those
|
|
15103
15103
|
* from persistence.
|
|
15104
|
-
*/ async function
|
|
15104
|
+
*/ async function va(t, e) {
|
|
15105
15105
|
const n = K(t), s = await No(n.localStore, e.query,
|
|
15106
15106
|
/* usePreviousResults= */ !0), i = e.view.Ju(s);
|
|
15107
|
-
return n.isPrimaryClient &&
|
|
15107
|
+
return n.isPrimaryClient && Ta(n, e.targetId, i.zu), i;
|
|
15108
15108
|
}
|
|
15109
15109
|
|
|
15110
15110
|
/**
|
|
@@ -15112,14 +15112,14 @@ function Pc(t, e) {
|
|
|
15112
15112
|
* snapshots if needed.
|
|
15113
15113
|
*/
|
|
15114
15114
|
// PORTING NOTE: Multi-Tab only.
|
|
15115
|
-
async function
|
|
15115
|
+
async function Va(t, e) {
|
|
15116
15116
|
const n = K(t);
|
|
15117
|
-
return Oo(n.localStore, e).then((t =>
|
|
15117
|
+
return Oo(n.localStore, e).then((t => Ra(n, t)));
|
|
15118
15118
|
}
|
|
15119
15119
|
|
|
15120
15120
|
/** Applies a mutation state to an existing batch. */
|
|
15121
15121
|
// PORTING NOTE: Multi-Tab only.
|
|
15122
|
-
async function
|
|
15122
|
+
async function Sa(t, e, n, s) {
|
|
15123
15123
|
const i = K(t), r = await function(t, e) {
|
|
15124
15124
|
const n = K(t), s = K(n.mutationQueue);
|
|
15125
15125
|
return n.persistence.runTransaction("Lookup mutation documents", "readonly", (t => s.yn(t, e).next((e => e ? n.localDocuments.getDocuments(t, e) : Pt.resolve(null)))));
|
|
@@ -15133,11 +15133,11 @@ async function Sc(t, e, n, s) {
|
|
|
15133
15133
|
await bu(i.remoteStore) : "acknowledged" === n || "rejected" === n ? (
|
|
15134
15134
|
// NOTE: Both these methods are no-ops for batches that originated from
|
|
15135
15135
|
// other clients.
|
|
15136
|
-
|
|
15136
|
+
ya(i, e, s || null), ga(i, e), function(t, e) {
|
|
15137
15137
|
K(K(t).mutationQueue).In(e);
|
|
15138
15138
|
}
|
|
15139
15139
|
// PORTING NOTE: Multi-Tab only.
|
|
15140
|
-
(i.localStore, e)) : L(), await
|
|
15140
|
+
(i.localStore, e)) : L(), await Ra(i, r)) :
|
|
15141
15141
|
// A throttled tab may not have seen the mutation before it was completed
|
|
15142
15142
|
// and removed from the mutation queue, in which case we won't have cached
|
|
15143
15143
|
// the affected documents. In this case we can safely ignore the update
|
|
@@ -15150,32 +15150,32 @@ async function Sc(t, e, n, s) {
|
|
|
15150
15150
|
|
|
15151
15151
|
/** Applies a query target change from a different tab. */
|
|
15152
15152
|
// PORTING NOTE: Multi-Tab only.
|
|
15153
|
-
async function
|
|
15153
|
+
async function Da(t, e) {
|
|
15154
15154
|
const n = K(t);
|
|
15155
|
-
if (
|
|
15155
|
+
if (Ma(n), Fa(n), !0 === e && !0 !== n.ca) {
|
|
15156
15156
|
// Secondary tabs only maintain Views for their local listeners and the
|
|
15157
15157
|
// Views internal state may not be 100% populated (in particular
|
|
15158
15158
|
// secondary tabs don't track syncedDocuments, the set of documents the
|
|
15159
15159
|
// server considers to be in the target). So when a secondary becomes
|
|
15160
15160
|
// primary, we need to need to make sure that all views for all targets
|
|
15161
15161
|
// match the state on disk.
|
|
15162
|
-
const t = n.sharedClientState.getAllActiveQueryTargets(), e = await
|
|
15163
|
-
n.
|
|
15162
|
+
const t = n.sharedClientState.getAllActiveQueryTargets(), e = await Ca(n, t.toArray());
|
|
15163
|
+
n.ca = !0, await Ou(n.remoteStore, !0);
|
|
15164
15164
|
for (const t of e) fu(n.remoteStore, t);
|
|
15165
|
-
} else if (!1 === e && !1 !== n.
|
|
15165
|
+
} else if (!1 === e && !1 !== n.ca) {
|
|
15166
15166
|
const t = [];
|
|
15167
15167
|
let e = Promise.resolve();
|
|
15168
|
-
n.
|
|
15169
|
-
n.sharedClientState.isLocalQueryTarget(i) ? t.push(i) : e = e.then((() => (
|
|
15168
|
+
n.ea.forEach(((s, i) => {
|
|
15169
|
+
n.sharedClientState.isLocalQueryTarget(i) ? t.push(i) : e = e.then((() => (pa(n, i),
|
|
15170
15170
|
xo(n.localStore, i,
|
|
15171
15171
|
/*keepPersistedTargetData=*/ !0)))), du(n.remoteStore, i);
|
|
15172
|
-
})), await e, await
|
|
15172
|
+
})), await e, await Ca(n, t),
|
|
15173
15173
|
// PORTING NOTE: Multi-Tab only.
|
|
15174
15174
|
function(t) {
|
|
15175
15175
|
const e = K(t);
|
|
15176
|
-
e.
|
|
15176
|
+
e.ia.forEach(((t, n) => {
|
|
15177
15177
|
du(e.remoteStore, n);
|
|
15178
|
-
})), e.
|
|
15178
|
+
})), e.ra.cs(), e.ia = new Map, e.sa = new qt(dt.comparator);
|
|
15179
15179
|
}
|
|
15180
15180
|
/**
|
|
15181
15181
|
* Reconcile the query views of the provided query targets with the state from
|
|
@@ -15188,15 +15188,15 @@ async function Dc(t, e) {
|
|
|
15188
15188
|
* tab to a primary tab
|
|
15189
15189
|
*/
|
|
15190
15190
|
// PORTING NOTE: Multi-Tab only.
|
|
15191
|
-
(n), n.
|
|
15191
|
+
(n), n.ca = !1, await Ou(n.remoteStore, !1);
|
|
15192
15192
|
}
|
|
15193
15193
|
}
|
|
15194
15194
|
|
|
15195
|
-
async function
|
|
15195
|
+
async function Ca(t, e, n) {
|
|
15196
15196
|
const s = K(t), i = [], r = [];
|
|
15197
15197
|
for (const t of e) {
|
|
15198
15198
|
let e;
|
|
15199
|
-
const n = s.
|
|
15199
|
+
const n = s.ea.get(t);
|
|
15200
15200
|
if (n && 0 !== n.length) {
|
|
15201
15201
|
// For queries that have a local View, we fetch their current state
|
|
15202
15202
|
// from LocalStore (as the resume token and the snapshot version
|
|
@@ -15204,14 +15204,14 @@ async function Cc(t, e, n) {
|
|
|
15204
15204
|
// state (the list of syncedDocuments may have gotten out of sync).
|
|
15205
15205
|
e = await Co(s.localStore, ln(n[0]));
|
|
15206
15206
|
for (const t of n) {
|
|
15207
|
-
const e = s.
|
|
15207
|
+
const e = s.ta.get(t), n = await va(s, e);
|
|
15208
15208
|
n.snapshot && r.push(n.snapshot);
|
|
15209
15209
|
}
|
|
15210
15210
|
} else {
|
|
15211
15211
|
// For queries that never executed on this client, we need to
|
|
15212
15212
|
// allocate the target in LocalStore and initialize a new View.
|
|
15213
15213
|
const n = await ko(s.localStore, t);
|
|
15214
|
-
e = await Co(s.localStore, n), await
|
|
15214
|
+
e = await Co(s.localStore, n), await aa(s, xa(n), t,
|
|
15215
15215
|
/*current=*/ !1);
|
|
15216
15216
|
}
|
|
15217
15217
|
i.push(e);
|
|
@@ -15230,38 +15230,38 @@ async function Cc(t, e, n) {
|
|
|
15230
15230
|
* difference will not cause issues.
|
|
15231
15231
|
*/
|
|
15232
15232
|
// PORTING NOTE: Multi-Tab only.
|
|
15233
|
-
function
|
|
15233
|
+
function xa(t) {
|
|
15234
15234
|
return sn(t.path, t.collectionGroup, t.orderBy, t.filters, t.limit, "F" /* First */ , t.startAt, t.endAt);
|
|
15235
15235
|
}
|
|
15236
15236
|
|
|
15237
15237
|
/** Returns the IDs of the clients that are currently active. */
|
|
15238
15238
|
// PORTING NOTE: Multi-Tab only.
|
|
15239
|
-
function
|
|
15239
|
+
function Na(t) {
|
|
15240
15240
|
const e = K(t);
|
|
15241
15241
|
return K(K(e.localStore).persistence).Ri();
|
|
15242
15242
|
}
|
|
15243
15243
|
|
|
15244
15244
|
/** Applies a query target change from a different tab. */
|
|
15245
15245
|
// PORTING NOTE: Multi-Tab only.
|
|
15246
|
-
async function
|
|
15246
|
+
async function ka(t, e, n, s) {
|
|
15247
15247
|
const i = K(t);
|
|
15248
|
-
if (i.
|
|
15248
|
+
if (i.ca)
|
|
15249
15249
|
// If we receive a target state notification via WebStorage, we are
|
|
15250
15250
|
// either already secondary or another tab has taken the primary lease.
|
|
15251
15251
|
return void M("SyncEngine", "Ignoring unexpected query state notification.");
|
|
15252
|
-
const r = i.
|
|
15252
|
+
const r = i.ea.get(e);
|
|
15253
15253
|
if (r && r.length > 0) switch (n) {
|
|
15254
15254
|
case "current":
|
|
15255
15255
|
case "not-current":
|
|
15256
15256
|
{
|
|
15257
15257
|
const t = await Oo(i.localStore, gn(r[0])), s = ys.createSynthesizedRemoteEventForCurrentChange(e, "current" === n);
|
|
15258
|
-
await
|
|
15258
|
+
await Ra(i, t, s);
|
|
15259
15259
|
break;
|
|
15260
15260
|
}
|
|
15261
15261
|
|
|
15262
15262
|
case "rejected":
|
|
15263
15263
|
await xo(i.localStore, e,
|
|
15264
|
-
/* keepPersistedTargetData */ !0),
|
|
15264
|
+
/* keepPersistedTargetData */ !0), pa(i, e, s);
|
|
15265
15265
|
break;
|
|
15266
15266
|
|
|
15267
15267
|
default:
|
|
@@ -15269,41 +15269,41 @@ async function kc(t, e, n, s) {
|
|
|
15269
15269
|
}
|
|
15270
15270
|
}
|
|
15271
15271
|
|
|
15272
|
-
/** Adds or removes Watch targets for queries from different tabs. */ async function
|
|
15273
|
-
const s =
|
|
15274
|
-
if (s.
|
|
15272
|
+
/** Adds or removes Watch targets for queries from different tabs. */ async function Oa(t, e, n) {
|
|
15273
|
+
const s = Ma(t);
|
|
15274
|
+
if (s.ca) {
|
|
15275
15275
|
for (const t of e) {
|
|
15276
|
-
if (s.
|
|
15276
|
+
if (s.ea.has(t)) {
|
|
15277
15277
|
// A target might have been added in a previous attempt
|
|
15278
15278
|
M("SyncEngine", "Adding an already active target " + t);
|
|
15279
15279
|
continue;
|
|
15280
15280
|
}
|
|
15281
15281
|
const e = await ko(s.localStore, t), n = await Co(s.localStore, e);
|
|
15282
|
-
await
|
|
15282
|
+
await aa(s, xa(e), n.targetId,
|
|
15283
15283
|
/*current=*/ !1), fu(s.remoteStore, n);
|
|
15284
15284
|
}
|
|
15285
15285
|
for (const t of n)
|
|
15286
15286
|
// Check that the target is still active since the target might have been
|
|
15287
15287
|
// removed if it has been rejected by the backend.
|
|
15288
|
-
s.
|
|
15288
|
+
s.ea.has(t) &&
|
|
15289
15289
|
// Release queries that are still active.
|
|
15290
15290
|
await xo(s.localStore, t,
|
|
15291
15291
|
/* keepPersistedTargetData */ !1).then((() => {
|
|
15292
|
-
du(s.remoteStore, t),
|
|
15292
|
+
du(s.remoteStore, t), pa(s, t);
|
|
15293
15293
|
})).catch(bt);
|
|
15294
15294
|
}
|
|
15295
15295
|
}
|
|
15296
15296
|
|
|
15297
|
-
function
|
|
15297
|
+
function Ma(t) {
|
|
15298
15298
|
const e = K(t);
|
|
15299
|
-
return e.remoteStore.remoteSyncer.applyRemoteEvent =
|
|
15300
|
-
e.remoteStore.remoteSyncer.rejectListen =
|
|
15301
|
-
e.Zu.
|
|
15299
|
+
return e.remoteStore.remoteSyncer.applyRemoteEvent = la.bind(null, e), e.remoteStore.remoteSyncer.getRemoteKeysForTarget = Pa.bind(null, e),
|
|
15300
|
+
e.remoteStore.remoteSyncer.rejectListen = da.bind(null, e), e.Zu.Go = Wu.bind(null, e.eventManager),
|
|
15301
|
+
e.Zu.la = zu.bind(null, e.eventManager), e;
|
|
15302
15302
|
}
|
|
15303
15303
|
|
|
15304
|
-
function
|
|
15304
|
+
function Fa(t) {
|
|
15305
15305
|
const e = K(t);
|
|
15306
|
-
return e.remoteStore.remoteSyncer.applySuccessfulWrite =
|
|
15306
|
+
return e.remoteStore.remoteSyncer.applySuccessfulWrite = _a.bind(null, e), e.remoteStore.remoteSyncer.rejectFailedWrite = wa.bind(null, e),
|
|
15307
15307
|
e;
|
|
15308
15308
|
}
|
|
15309
15309
|
|
|
@@ -15314,7 +15314,7 @@ function Fc(t) {
|
|
|
15314
15314
|
* @param syncEngine - SyncEngine to use.
|
|
15315
15315
|
* @param bundleReader - Bundle to load into the SDK.
|
|
15316
15316
|
* @param task - LoadBundleTask used to update the loading progress to public API.
|
|
15317
|
-
*/ function $
|
|
15317
|
+
*/ function $a(t, e, n) {
|
|
15318
15318
|
const s = K(t);
|
|
15319
15319
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
15320
15320
|
(
|
|
@@ -15337,15 +15337,15 @@ function Fc(t) {
|
|
|
15337
15337
|
totalBytes: t.totalBytes
|
|
15338
15338
|
};
|
|
15339
15339
|
}(s)), Promise.resolve(new Set);
|
|
15340
|
-
n._updateProgress(
|
|
15340
|
+
n._updateProgress(ta(s));
|
|
15341
15341
|
const i = new Zu(s, t.localStore, e.wt);
|
|
15342
|
-
let r = await e.
|
|
15342
|
+
let r = await e.fa();
|
|
15343
15343
|
for (;r; ) {
|
|
15344
15344
|
const t = await i.Nu(r);
|
|
15345
|
-
t && n._updateProgress(t), r = await e.
|
|
15345
|
+
t && n._updateProgress(t), r = await e.fa();
|
|
15346
15346
|
}
|
|
15347
15347
|
const o = await i.complete();
|
|
15348
|
-
return await
|
|
15348
|
+
return await Ra(t, o.Mu,
|
|
15349
15349
|
/* remoteEvent */ void 0),
|
|
15350
15350
|
// Save metadata, so loading the same bundle will skip.
|
|
15351
15351
|
await function(t, e) {
|
|
@@ -15384,28 +15384,28 @@ function Fc(t) {
|
|
|
15384
15384
|
}));
|
|
15385
15385
|
}
|
|
15386
15386
|
|
|
15387
|
-
class
|
|
15387
|
+
class Ba {
|
|
15388
15388
|
constructor() {
|
|
15389
15389
|
this.synchronizeTabs = !1;
|
|
15390
15390
|
}
|
|
15391
15391
|
async initialize(t) {
|
|
15392
|
-
this.wt = nu(t.databaseInfo.databaseId), this.sharedClientState = this.
|
|
15393
|
-
await this.persistence.start(), this.localStore = this.
|
|
15394
|
-
this.indexBackfillerScheduler = this.
|
|
15392
|
+
this.wt = nu(t.databaseInfo.databaseId), this.sharedClientState = this.da(t), this.persistence = this._a(t),
|
|
15393
|
+
await this.persistence.start(), this.localStore = this.wa(t), this.gcScheduler = this.ma(t, this.localStore),
|
|
15394
|
+
this.indexBackfillerScheduler = this.ga(t, this.localStore);
|
|
15395
15395
|
}
|
|
15396
|
-
|
|
15396
|
+
ma(t, e) {
|
|
15397
15397
|
return null;
|
|
15398
15398
|
}
|
|
15399
|
-
|
|
15399
|
+
ga(t, e) {
|
|
15400
15400
|
return null;
|
|
15401
15401
|
}
|
|
15402
|
-
|
|
15402
|
+
wa(t) {
|
|
15403
15403
|
return Ro(this.persistence, new Eo, t.initialUser, this.wt);
|
|
15404
15404
|
}
|
|
15405
|
-
|
|
15405
|
+
_a(t) {
|
|
15406
15406
|
return new ho(fo.Ms, this.wt);
|
|
15407
15407
|
}
|
|
15408
|
-
|
|
15408
|
+
da(t) {
|
|
15409
15409
|
return new zo;
|
|
15410
15410
|
}
|
|
15411
15411
|
async terminate() {
|
|
@@ -15416,36 +15416,36 @@ class Bc {
|
|
|
15416
15416
|
|
|
15417
15417
|
/**
|
|
15418
15418
|
* Provides all components needed for Firestore with IndexedDB persistence.
|
|
15419
|
-
*/ class
|
|
15419
|
+
*/ class La extends Ba {
|
|
15420
15420
|
constructor(t, e, n) {
|
|
15421
|
-
super(), this.
|
|
15421
|
+
super(), this.ya = t, this.cacheSizeBytes = e, this.forceOwnership = n, this.synchronizeTabs = !1;
|
|
15422
15422
|
}
|
|
15423
15423
|
async initialize(t) {
|
|
15424
|
-
await super.initialize(t), await this.
|
|
15424
|
+
await super.initialize(t), await this.ya.initialize(this, t),
|
|
15425
15425
|
// Enqueue writes from a previous session
|
|
15426
|
-
await
|
|
15426
|
+
await Fa(this.ya.syncEngine), await bu(this.ya.remoteStore),
|
|
15427
15427
|
// NOTE: This will immediately call the listener, so we make sure to
|
|
15428
15428
|
// set it after localStore / remoteStore are started.
|
|
15429
|
-
await this.persistence.
|
|
15429
|
+
await this.persistence.ai((() => (this.gcScheduler && !this.gcScheduler.started && this.gcScheduler.start(),
|
|
15430
15430
|
this.indexBackfillerScheduler && !this.indexBackfillerScheduler.started && this.indexBackfillerScheduler.start(),
|
|
15431
15431
|
Promise.resolve())));
|
|
15432
15432
|
}
|
|
15433
|
-
|
|
15433
|
+
wa(t) {
|
|
15434
15434
|
return Ro(this.persistence, new Eo, t.initialUser, this.wt);
|
|
15435
15435
|
}
|
|
15436
|
-
|
|
15436
|
+
ma(t, e) {
|
|
15437
15437
|
const n = this.persistence.referenceDelegate.garbageCollector;
|
|
15438
15438
|
return new Ur(n, t.asyncQueue, e);
|
|
15439
15439
|
}
|
|
15440
|
-
|
|
15440
|
+
ga(t, e) {
|
|
15441
15441
|
const n = new Ft(e, this.persistence);
|
|
15442
15442
|
return new Mt(t.asyncQueue, n);
|
|
15443
15443
|
}
|
|
15444
|
-
|
|
15444
|
+
_a(t) {
|
|
15445
15445
|
const e = Io(t.databaseInfo.databaseId, t.databaseInfo.persistenceKey), n = void 0 !== this.cacheSizeBytes ? Pr.withCacheSize(this.cacheSizeBytes) : Pr.DEFAULT;
|
|
15446
15446
|
return new go(this.synchronizeTabs, e, t.clientId, n, t.asyncQueue, tu(), eu(), this.wt, this.sharedClientState, !!this.forceOwnership);
|
|
15447
15447
|
}
|
|
15448
|
-
|
|
15448
|
+
da(t) {
|
|
15449
15449
|
return new zo;
|
|
15450
15450
|
}
|
|
15451
15451
|
}
|
|
@@ -15457,28 +15457,28 @@ class Bc {
|
|
|
15457
15457
|
* In the legacy client, this provider is used to provide both multi-tab and
|
|
15458
15458
|
* non-multi-tab persistence since we cannot tell at build time whether
|
|
15459
15459
|
* `synchronizeTabs` will be enabled.
|
|
15460
|
-
*/ class
|
|
15460
|
+
*/ class Ua extends La {
|
|
15461
15461
|
constructor(t, e) {
|
|
15462
|
-
super(t, e, /* forceOwnership= */ !1), this.
|
|
15462
|
+
super(t, e, /* forceOwnership= */ !1), this.ya = t, this.cacheSizeBytes = e, this.synchronizeTabs = !0;
|
|
15463
15463
|
}
|
|
15464
15464
|
async initialize(t) {
|
|
15465
15465
|
await super.initialize(t);
|
|
15466
|
-
const e = this.
|
|
15466
|
+
const e = this.ya.syncEngine;
|
|
15467
15467
|
this.sharedClientState instanceof Wo && (this.sharedClientState.syncEngine = {
|
|
15468
|
-
kr:
|
|
15469
|
-
Or:
|
|
15470
|
-
Mr:
|
|
15471
|
-
Ri:
|
|
15472
|
-
Nr:
|
|
15468
|
+
kr: Sa.bind(null, e),
|
|
15469
|
+
Or: ka.bind(null, e),
|
|
15470
|
+
Mr: Oa.bind(null, e),
|
|
15471
|
+
Ri: Na.bind(null, e),
|
|
15472
|
+
Nr: Va.bind(null, e)
|
|
15473
15473
|
}, await this.sharedClientState.start()),
|
|
15474
15474
|
// NOTE: This will immediately call the listener, so we make sure to
|
|
15475
15475
|
// set it after localStore / remoteStore are started.
|
|
15476
|
-
await this.persistence.
|
|
15477
|
-
await
|
|
15476
|
+
await this.persistence.ai((async t => {
|
|
15477
|
+
await Da(this.ya.syncEngine, t), this.gcScheduler && (t && !this.gcScheduler.started ? this.gcScheduler.start() : t || this.gcScheduler.stop()),
|
|
15478
15478
|
this.indexBackfillerScheduler && (t && !this.indexBackfillerScheduler.started ? this.indexBackfillerScheduler.start() : t || this.indexBackfillerScheduler.stop());
|
|
15479
15479
|
}));
|
|
15480
15480
|
}
|
|
15481
|
-
|
|
15481
|
+
da(t) {
|
|
15482
15482
|
const e = tu();
|
|
15483
15483
|
if (!Wo.V(e)) throw new Q(G.UNIMPLEMENTED, "IndexedDB persistence is only available on platforms that support LocalStorage.");
|
|
15484
15484
|
const n = Io(t.databaseInfo.databaseId, t.databaseInfo.persistenceKey);
|
|
@@ -15489,13 +15489,13 @@ class Bc {
|
|
|
15489
15489
|
/**
|
|
15490
15490
|
* Initializes and wires the components that are needed to interface with the
|
|
15491
15491
|
* network.
|
|
15492
|
-
*/ class
|
|
15492
|
+
*/ class qa {
|
|
15493
15493
|
async initialize(t, e) {
|
|
15494
15494
|
this.localStore || (this.localStore = t.localStore, this.sharedClientState = t.sharedClientState,
|
|
15495
15495
|
this.datastore = this.createDatastore(e), this.remoteStore = this.createRemoteStore(e),
|
|
15496
15496
|
this.eventManager = this.createEventManager(e), this.syncEngine = this.createSyncEngine(e,
|
|
15497
|
-
/* startAsPrimary=*/ !t.synchronizeTabs), this.sharedClientState.onlineStateHandler = t =>
|
|
15498
|
-
this.remoteStore.remoteSyncer.handleCredentialChange =
|
|
15497
|
+
/* startAsPrimary=*/ !t.synchronizeTabs), this.sharedClientState.onlineStateHandler = t => fa(this.syncEngine, t, 1 /* SharedClientState */),
|
|
15498
|
+
this.remoteStore.remoteSyncer.handleCredentialChange = ba.bind(null, this.syncEngine),
|
|
15499
15499
|
await Ou(this.remoteStore, this.syncEngine.isPrimaryClient));
|
|
15500
15500
|
}
|
|
15501
15501
|
createEventManager(t) {
|
|
@@ -15509,16 +15509,16 @@ class Bc {
|
|
|
15509
15509
|
}(t.authCredentials, t.appCheckCredentials, n, e);
|
|
15510
15510
|
}
|
|
15511
15511
|
createRemoteStore(t) {
|
|
15512
|
-
return e = this.localStore, n = this.datastore, s = t.asyncQueue, i = t =>
|
|
15513
|
-
r = Jo.V() ? new Jo : new Ho, new
|
|
15512
|
+
return e = this.localStore, n = this.datastore, s = t.asyncQueue, i = t => fa(this.syncEngine, t, 0 /* RemoteStore */),
|
|
15513
|
+
r = Jo.V() ? new Jo : new Ho, new cu(e, n, s, i, r);
|
|
15514
15514
|
var e, n, s, i, r;
|
|
15515
15515
|
/** Re-enables the network. Idempotent. */ }
|
|
15516
15516
|
createSyncEngine(t, e) {
|
|
15517
15517
|
return function(t, e, n,
|
|
15518
15518
|
// PORTING NOTE: Manages state synchronization in multi-tab environments.
|
|
15519
15519
|
s, i, r, o) {
|
|
15520
|
-
const u = new
|
|
15521
|
-
return o && (u.
|
|
15520
|
+
const u = new oa(t, e, n, s, i, r);
|
|
15521
|
+
return o && (u.ca = !0), u;
|
|
15522
15522
|
}(this.localStore, this.remoteStore, this.eventManager, this.sharedClientState, t.initialUser, t.maxConcurrentLimboResolutions, e);
|
|
15523
15523
|
}
|
|
15524
15524
|
terminate() {
|
|
@@ -15560,7 +15560,7 @@ class Bc {
|
|
|
15560
15560
|
* @param bytesPerRead - How many bytes each `read()` from the returned reader
|
|
15561
15561
|
* will read.
|
|
15562
15562
|
*/
|
|
15563
|
-
function
|
|
15563
|
+
function Ka(t, e = 10240) {
|
|
15564
15564
|
let n = 0;
|
|
15565
15565
|
// The TypeScript definition for ReadableStreamReader changed. We use
|
|
15566
15566
|
// `any` here to allow this code to compile with different versions.
|
|
@@ -15626,7 +15626,7 @@ function Kc(t, e = 10240) {
|
|
|
15626
15626
|
* asynchronously. To allow immediate silencing, a mute call is added which
|
|
15627
15627
|
* causes events scheduled to no longer be raised.
|
|
15628
15628
|
*/
|
|
15629
|
-
class
|
|
15629
|
+
class Ga {
|
|
15630
15630
|
constructor(t) {
|
|
15631
15631
|
this.observer = t,
|
|
15632
15632
|
/**
|
|
@@ -15636,15 +15636,15 @@ class Gc {
|
|
|
15636
15636
|
this.muted = !1;
|
|
15637
15637
|
}
|
|
15638
15638
|
next(t) {
|
|
15639
|
-
this.observer.next && this.
|
|
15639
|
+
this.observer.next && this.pa(this.observer.next, t);
|
|
15640
15640
|
}
|
|
15641
15641
|
error(t) {
|
|
15642
|
-
this.observer.error ? this.
|
|
15642
|
+
this.observer.error ? this.pa(this.observer.error, t) : console.error("Uncaught Error in snapshot listener:", t);
|
|
15643
15643
|
}
|
|
15644
|
-
|
|
15644
|
+
Ia() {
|
|
15645
15645
|
this.muted = !0;
|
|
15646
15646
|
}
|
|
15647
|
-
|
|
15647
|
+
pa(t, e) {
|
|
15648
15648
|
this.muted || setTimeout((() => {
|
|
15649
15649
|
this.muted || t(e);
|
|
15650
15650
|
}), 0);
|
|
@@ -15672,32 +15672,32 @@ class Gc {
|
|
|
15672
15672
|
*
|
|
15673
15673
|
* Takes a bundle stream or buffer, and presents abstractions to read bundled
|
|
15674
15674
|
* elements out of the underlying content.
|
|
15675
|
-
*/ class
|
|
15675
|
+
*/ class Qa {
|
|
15676
15676
|
constructor(
|
|
15677
15677
|
/** The reader to read from underlying binary bundle data source. */
|
|
15678
15678
|
t, e) {
|
|
15679
|
-
this.
|
|
15679
|
+
this.Ta = t, this.wt = e,
|
|
15680
15680
|
/** Cached bundle metadata. */
|
|
15681
15681
|
this.metadata = new j,
|
|
15682
15682
|
/**
|
|
15683
15683
|
* Internal buffer to hold bundle content, accumulating incomplete element
|
|
15684
15684
|
* content.
|
|
15685
15685
|
*/
|
|
15686
|
-
this.buffer = new Uint8Array, this.
|
|
15686
|
+
this.buffer = new Uint8Array, this.Ea = new TextDecoder("utf-8"),
|
|
15687
15687
|
// Read the metadata (which is the first element).
|
|
15688
|
-
this.
|
|
15688
|
+
this.Aa().then((t => {
|
|
15689
15689
|
t && t.Cu() ? this.metadata.resolve(t.payload.metadata) : this.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)}`));
|
|
15690
15690
|
}), (t => this.metadata.reject(t)));
|
|
15691
15691
|
}
|
|
15692
15692
|
close() {
|
|
15693
|
-
return this.
|
|
15693
|
+
return this.Ta.cancel();
|
|
15694
15694
|
}
|
|
15695
15695
|
async getMetadata() {
|
|
15696
15696
|
return this.metadata.promise;
|
|
15697
15697
|
}
|
|
15698
|
-
async
|
|
15698
|
+
async fa() {
|
|
15699
15699
|
// Makes sure metadata is read before proceeding.
|
|
15700
|
-
return await this.getMetadata(), this.
|
|
15700
|
+
return await this.getMetadata(), this.Aa();
|
|
15701
15701
|
}
|
|
15702
15702
|
/**
|
|
15703
15703
|
* Reads from the head of internal buffer, and pulling more data from
|
|
@@ -15708,15 +15708,15 @@ class Gc {
|
|
|
15708
15708
|
*
|
|
15709
15709
|
* Returns either the bundled element, or null if we have reached the end of
|
|
15710
15710
|
* the stream.
|
|
15711
|
-
*/ async
|
|
15712
|
-
const t = await this.
|
|
15711
|
+
*/ async Aa() {
|
|
15712
|
+
const t = await this.Ra();
|
|
15713
15713
|
if (null === t) return null;
|
|
15714
|
-
const e = this.
|
|
15715
|
-
isNaN(n) && this.
|
|
15716
|
-
const s = await this.
|
|
15714
|
+
const e = this.Ea.decode(t), n = Number(e);
|
|
15715
|
+
isNaN(n) && this.ba(`length string (${e}) is not valid number`);
|
|
15716
|
+
const s = await this.Pa(n);
|
|
15717
15717
|
return new Yu(JSON.parse(s), t.length + n);
|
|
15718
15718
|
}
|
|
15719
|
-
/** First index of '{' from the underlying buffer. */
|
|
15719
|
+
/** First index of '{' from the underlying buffer. */ va() {
|
|
15720
15720
|
return this.buffer.findIndex((t => t === "{".charCodeAt(0)));
|
|
15721
15721
|
}
|
|
15722
15722
|
/**
|
|
@@ -15724,17 +15724,17 @@ class Gc {
|
|
|
15724
15724
|
* return the content.
|
|
15725
15725
|
*
|
|
15726
15726
|
* If reached end of the stream, returns a null.
|
|
15727
|
-
*/ async
|
|
15728
|
-
for (;this.
|
|
15729
|
-
if (await this.
|
|
15727
|
+
*/ async Ra() {
|
|
15728
|
+
for (;this.va() < 0; ) {
|
|
15729
|
+
if (await this.Va()) break;
|
|
15730
15730
|
}
|
|
15731
15731
|
// Broke out of the loop because underlying stream is closed, and there
|
|
15732
15732
|
// happens to be no more data to process.
|
|
15733
15733
|
if (0 === this.buffer.length) return null;
|
|
15734
|
-
const t = this.
|
|
15734
|
+
const t = this.va();
|
|
15735
15735
|
// Broke out of the loop because underlying stream is closed, but still
|
|
15736
15736
|
// cannot find an open bracket.
|
|
15737
|
-
t < 0 && this.
|
|
15737
|
+
t < 0 && this.ba("Reached the end of bundle when a length string is expected.");
|
|
15738
15738
|
const e = this.buffer.slice(0, t);
|
|
15739
15739
|
// Update the internal buffer to drop the read length.
|
|
15740
15740
|
return this.buffer = this.buffer.slice(t), e;
|
|
@@ -15744,23 +15744,23 @@ class Gc {
|
|
|
15744
15744
|
* number of bytes, pulling more data from the underlying stream if needed.
|
|
15745
15745
|
*
|
|
15746
15746
|
* Returns a string decoded from the read bytes.
|
|
15747
|
-
*/ async
|
|
15747
|
+
*/ async Pa(t) {
|
|
15748
15748
|
for (;this.buffer.length < t; ) {
|
|
15749
|
-
await this.
|
|
15749
|
+
await this.Va() && this.ba("Reached the end of bundle when more is expected.");
|
|
15750
15750
|
}
|
|
15751
|
-
const e = this.
|
|
15751
|
+
const e = this.Ea.decode(this.buffer.slice(0, t));
|
|
15752
15752
|
// Update the internal buffer to drop the read json string.
|
|
15753
15753
|
return this.buffer = this.buffer.slice(t), e;
|
|
15754
15754
|
}
|
|
15755
|
-
|
|
15755
|
+
ba(t) {
|
|
15756
15756
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
15757
|
-
throw this.
|
|
15757
|
+
throw this.Ta.cancel(), new Error(`Invalid bundle format: ${t}`);
|
|
15758
15758
|
}
|
|
15759
15759
|
/**
|
|
15760
15760
|
* Pulls more data from underlying stream to internal buffer.
|
|
15761
15761
|
* Returns a boolean indicating whether the stream is finished.
|
|
15762
|
-
*/ async
|
|
15763
|
-
const t = await this.
|
|
15762
|
+
*/ async Va() {
|
|
15763
|
+
const t = await this.Ta.read();
|
|
15764
15764
|
if (!t.done) {
|
|
15765
15765
|
const e = new Uint8Array(this.buffer.length + t.value.length);
|
|
15766
15766
|
e.set(this.buffer), e.set(t.value, this.buffer.length), this.buffer = e;
|
|
@@ -15789,7 +15789,7 @@ class Gc {
|
|
|
15789
15789
|
* Internal transaction object responsible for accumulating the mutations to
|
|
15790
15790
|
* perform and the base versions for any documents read.
|
|
15791
15791
|
*/
|
|
15792
|
-
class
|
|
15792
|
+
class ja {
|
|
15793
15793
|
constructor(t) {
|
|
15794
15794
|
this.datastore = t,
|
|
15795
15795
|
// The version of each document that was read during this transaction.
|
|
@@ -15812,7 +15812,7 @@ class jc {
|
|
|
15812
15812
|
const e = await async function(t, e) {
|
|
15813
15813
|
const n = K(t), s = Ls(n.wt) + "/documents", i = {
|
|
15814
15814
|
documents: e.map((t => Ms(n.wt, t)))
|
|
15815
|
-
}, r = await n.
|
|
15815
|
+
}, r = await n.co("BatchGetDocuments", s, i, e.length), o = new Map;
|
|
15816
15816
|
r.forEach((t => {
|
|
15817
15817
|
const e = Gs(n.wt, t);
|
|
15818
15818
|
o.set(e.key.toString(), e);
|
|
@@ -15863,7 +15863,7 @@ class jc {
|
|
|
15863
15863
|
if (t.isFoundDocument()) e = t.version; else {
|
|
15864
15864
|
if (!t.isNoDocument()) throw L();
|
|
15865
15865
|
// For deleted docs, we must use baseVersion 0 when we overwrite them.
|
|
15866
|
-
e =
|
|
15866
|
+
e = at.min();
|
|
15867
15867
|
}
|
|
15868
15868
|
const n = this.readVersions.get(t.key.toString());
|
|
15869
15869
|
if (n) {
|
|
@@ -15886,7 +15886,7 @@ class jc {
|
|
|
15886
15886
|
// The first time a document is written, we want to take into account the
|
|
15887
15887
|
// read time and existence
|
|
15888
15888
|
if (!this.writtenDocs.has(t.toString()) && e) {
|
|
15889
|
-
if (e.isEqual(
|
|
15889
|
+
if (e.isEqual(at.min()))
|
|
15890
15890
|
// The document doesn't exist, so fail the transaction.
|
|
15891
15891
|
// This has to be validated locally because you can't send a
|
|
15892
15892
|
// precondition that a document does not exist without changing the
|
|
@@ -15929,29 +15929,29 @@ class jc {
|
|
|
15929
15929
|
/**
|
|
15930
15930
|
* TransactionRunner encapsulates the logic needed to run and retry transactions
|
|
15931
15931
|
* with backoff.
|
|
15932
|
-
*/ class
|
|
15932
|
+
*/ class Wa {
|
|
15933
15933
|
constructor(t, e, n, s, i) {
|
|
15934
15934
|
this.asyncQueue = t, this.datastore = e, this.options = n, this.updateFunction = s,
|
|
15935
|
-
this.deferred = i, this.
|
|
15935
|
+
this.deferred = i, this.Sa = n.maxAttempts, this.So = new su(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
|
|
15936
15936
|
}
|
|
15937
15937
|
/** Runs the transaction and sets the result on deferred. */ run() {
|
|
15938
|
-
this.
|
|
15938
|
+
this.Sa -= 1, this.Da();
|
|
15939
15939
|
}
|
|
15940
|
-
|
|
15940
|
+
Da() {
|
|
15941
15941
|
this.So.Io((async () => {
|
|
15942
|
-
const t = new
|
|
15942
|
+
const t = new ja(this.datastore), e = this.Ca(t);
|
|
15943
15943
|
e && e.then((e => {
|
|
15944
15944
|
this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
|
|
15945
15945
|
this.deferred.resolve(e);
|
|
15946
15946
|
})).catch((t => {
|
|
15947
|
-
this.
|
|
15947
|
+
this.xa(t);
|
|
15948
15948
|
}))));
|
|
15949
15949
|
})).catch((t => {
|
|
15950
|
-
this.
|
|
15950
|
+
this.xa(t);
|
|
15951
15951
|
}));
|
|
15952
15952
|
}));
|
|
15953
15953
|
}
|
|
15954
|
-
|
|
15954
|
+
Ca(t) {
|
|
15955
15955
|
try {
|
|
15956
15956
|
const e = this.updateFunction(t);
|
|
15957
15957
|
return !oe(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
|
|
@@ -15961,11 +15961,11 @@ class jc {
|
|
|
15961
15961
|
return this.deferred.reject(t), null;
|
|
15962
15962
|
}
|
|
15963
15963
|
}
|
|
15964
|
-
|
|
15965
|
-
this.
|
|
15964
|
+
xa(t) {
|
|
15965
|
+
this.Sa > 0 && this.Na(t) ? (this.Sa -= 1, this.asyncQueue.enqueueAndForget((() => (this.Da(),
|
|
15966
15966
|
Promise.resolve())))) : this.deferred.reject(t);
|
|
15967
15967
|
}
|
|
15968
|
-
|
|
15968
|
+
Na(t) {
|
|
15969
15969
|
if ("FirebaseError" === t.name) {
|
|
15970
15970
|
// In transactions, the backend will fail outdated reads with FAILED_PRECONDITION and
|
|
15971
15971
|
// non-matching document versions with ABORTED. These errors should be retried.
|
|
@@ -15997,7 +15997,7 @@ class jc {
|
|
|
15997
15997
|
* pieces of the client SDK architecture. It is responsible for creating the
|
|
15998
15998
|
* async queue that is shared by all of the other components in the system.
|
|
15999
15999
|
*/
|
|
16000
|
-
class
|
|
16000
|
+
class za {
|
|
16001
16001
|
constructor(t, e,
|
|
16002
16002
|
/**
|
|
16003
16003
|
* Asynchronous queue responsible for all of our internal processing. When
|
|
@@ -16057,7 +16057,7 @@ class zc {
|
|
|
16057
16057
|
}
|
|
16058
16058
|
}
|
|
16059
16059
|
|
|
16060
|
-
async function
|
|
16060
|
+
async function Ha(t, e) {
|
|
16061
16061
|
t.asyncQueue.verifyOperationInProgress(), M("FirestoreClient", "Initializing OfflineComponentProvider");
|
|
16062
16062
|
const n = await t.getConfiguration();
|
|
16063
16063
|
await e.initialize(n);
|
|
@@ -16070,9 +16070,9 @@ async function Hc(t, e) {
|
|
|
16070
16070
|
e.persistence.setDatabaseDeletedListener((() => t.terminate())), t.offlineComponents = e;
|
|
16071
16071
|
}
|
|
16072
16072
|
|
|
16073
|
-
async function
|
|
16073
|
+
async function Ja(t, e) {
|
|
16074
16074
|
t.asyncQueue.verifyOperationInProgress();
|
|
16075
|
-
const n = await
|
|
16075
|
+
const n = await Ya(t);
|
|
16076
16076
|
M("FirestoreClient", "Initializing OnlineComponentProvider");
|
|
16077
16077
|
const s = await t.getConfiguration();
|
|
16078
16078
|
await e.initialize(n, s),
|
|
@@ -16082,41 +16082,41 @@ async function Jc(t, e) {
|
|
|
16082
16082
|
t.onlineComponents = e;
|
|
16083
16083
|
}
|
|
16084
16084
|
|
|
16085
|
-
async function
|
|
16085
|
+
async function Ya(t) {
|
|
16086
16086
|
return t.offlineComponents || (M("FirestoreClient", "Using default OfflineComponentProvider"),
|
|
16087
|
-
await
|
|
16087
|
+
await Ha(t, new Ba)), t.offlineComponents;
|
|
16088
16088
|
}
|
|
16089
16089
|
|
|
16090
|
-
async function
|
|
16090
|
+
async function Xa(t) {
|
|
16091
16091
|
return t.onlineComponents || (M("FirestoreClient", "Using default OnlineComponentProvider"),
|
|
16092
|
-
await
|
|
16092
|
+
await Ja(t, new qa)), t.onlineComponents;
|
|
16093
16093
|
}
|
|
16094
16094
|
|
|
16095
|
-
function
|
|
16096
|
-
return
|
|
16095
|
+
function Za(t) {
|
|
16096
|
+
return Ya(t).then((t => t.persistence));
|
|
16097
16097
|
}
|
|
16098
16098
|
|
|
16099
|
-
function
|
|
16100
|
-
return
|
|
16099
|
+
function tc(t) {
|
|
16100
|
+
return Ya(t).then((t => t.localStore));
|
|
16101
16101
|
}
|
|
16102
16102
|
|
|
16103
|
-
function
|
|
16104
|
-
return
|
|
16103
|
+
function ec(t) {
|
|
16104
|
+
return Xa(t).then((t => t.remoteStore));
|
|
16105
16105
|
}
|
|
16106
16106
|
|
|
16107
|
-
function
|
|
16108
|
-
return
|
|
16107
|
+
function nc(t) {
|
|
16108
|
+
return Xa(t).then((t => t.syncEngine));
|
|
16109
16109
|
}
|
|
16110
16110
|
|
|
16111
|
-
async function
|
|
16112
|
-
const e = await
|
|
16113
|
-
return n.onListen =
|
|
16111
|
+
async function sc(t) {
|
|
16112
|
+
const e = await Xa(t), n = e.eventManager;
|
|
16113
|
+
return n.onListen = ua.bind(null, e.syncEngine), n.onUnlisten = ca.bind(null, e.syncEngine),
|
|
16114
16114
|
n;
|
|
16115
16115
|
}
|
|
16116
16116
|
|
|
16117
|
-
/** Enables the network connection and re-enqueues all pending operations. */ function
|
|
16117
|
+
/** Enables the network connection and re-enqueues all pending operations. */ function ic(t) {
|
|
16118
16118
|
return t.asyncQueue.enqueue((async () => {
|
|
16119
|
-
const e = await
|
|
16119
|
+
const e = await Za(t), n = await ec(t);
|
|
16120
16120
|
return e.setNetworkEnabled(!0), function(t) {
|
|
16121
16121
|
const e = K(t);
|
|
16122
16122
|
return e.lu.delete(0 /* UserDisabled */), hu(e);
|
|
@@ -16124,9 +16124,9 @@ async function sa(t) {
|
|
|
16124
16124
|
}));
|
|
16125
16125
|
}
|
|
16126
16126
|
|
|
16127
|
-
/** Disables the network connection. Pending operations will not complete. */ function
|
|
16127
|
+
/** Disables the network connection. Pending operations will not complete. */ function rc(t) {
|
|
16128
16128
|
return t.asyncQueue.enqueue((async () => {
|
|
16129
|
-
const e = await
|
|
16129
|
+
const e = await Za(t), n = await ec(t);
|
|
16130
16130
|
return e.setNetworkEnabled(!1), async function(t) {
|
|
16131
16131
|
const e = K(t);
|
|
16132
16132
|
e.lu.add(0 /* UserDisabled */), await lu(e),
|
|
@@ -16140,7 +16140,7 @@ async function sa(t) {
|
|
|
16140
16140
|
* Returns a Promise that resolves when all writes that were pending at the time
|
|
16141
16141
|
* this method was called received server acknowledgement. An acknowledgement
|
|
16142
16142
|
* can be either acceptance or rejection.
|
|
16143
|
-
*/ function
|
|
16143
|
+
*/ function oc(t, e) {
|
|
16144
16144
|
const n = new j;
|
|
16145
16145
|
return t.asyncQueue.enqueueAndForget((async () => async function(t, e, n) {
|
|
16146
16146
|
try {
|
|
@@ -16157,13 +16157,13 @@ async function sa(t) {
|
|
|
16157
16157
|
/**
|
|
16158
16158
|
* Retrieves a latency-compensated document from the backend via a
|
|
16159
16159
|
* SnapshotListener.
|
|
16160
|
-
*/ (await
|
|
16160
|
+
*/ (await tc(t), e, n))), n.promise;
|
|
16161
16161
|
}
|
|
16162
16162
|
|
|
16163
|
-
function
|
|
16163
|
+
function uc(t, e, n = {}) {
|
|
16164
16164
|
const s = new j;
|
|
16165
16165
|
return t.asyncQueue.enqueueAndForget((async () => function(t, e, n, s, i) {
|
|
16166
|
-
const r = new
|
|
16166
|
+
const r = new Ga({
|
|
16167
16167
|
next: r => {
|
|
16168
16168
|
// Remove query first before passing event to user to avoid
|
|
16169
16169
|
// user actions affecting the now stale query.
|
|
@@ -16185,15 +16185,15 @@ function ua(t, e, n = {}) {
|
|
|
16185
16185
|
Du: !0
|
|
16186
16186
|
});
|
|
16187
16187
|
return Qu(t, o);
|
|
16188
|
-
}(await
|
|
16188
|
+
}(await sc(t), t.asyncQueue, e, n, s))), s.promise;
|
|
16189
16189
|
}
|
|
16190
16190
|
|
|
16191
|
-
function
|
|
16191
|
+
function ac(t, e) {
|
|
16192
16192
|
const n = new j;
|
|
16193
16193
|
return t.asyncQueue.enqueueAndForget((async () => async function(t, e, n) {
|
|
16194
16194
|
try {
|
|
16195
16195
|
const s = await No(t, e,
|
|
16196
|
-
/* usePreviousResults= */ !0), i = new
|
|
16196
|
+
/* usePreviousResults= */ !0), i = new sa(e, s.ji), r = i.Ku(s.documents), o = i.applyChanges(r,
|
|
16197
16197
|
/* updateLimboDocuments= */ !1);
|
|
16198
16198
|
n.resolve(o.snapshot);
|
|
16199
16199
|
} catch (t) {
|
|
@@ -16204,13 +16204,13 @@ function ca(t, e) {
|
|
|
16204
16204
|
/**
|
|
16205
16205
|
* Retrieves a latency-compensated query snapshot from the backend via a
|
|
16206
16206
|
* SnapshotListener.
|
|
16207
|
-
*/ (await
|
|
16207
|
+
*/ (await tc(t), e, n))), n.promise;
|
|
16208
16208
|
}
|
|
16209
16209
|
|
|
16210
|
-
function
|
|
16210
|
+
function cc(t, e, n = {}) {
|
|
16211
16211
|
const s = new j;
|
|
16212
16212
|
return t.asyncQueue.enqueueAndForget((async () => function(t, e, n, s, i) {
|
|
16213
|
-
const r = new
|
|
16213
|
+
const r = new Ga({
|
|
16214
16214
|
next: n => {
|
|
16215
16215
|
// Remove query first before passing event to user to avoid
|
|
16216
16216
|
// user actions affecting the now stale query.
|
|
@@ -16222,20 +16222,20 @@ function aa(t, e, n = {}) {
|
|
|
16222
16222
|
Du: !0
|
|
16223
16223
|
});
|
|
16224
16224
|
return Qu(t, o);
|
|
16225
|
-
}(await
|
|
16225
|
+
}(await sc(t), t.asyncQueue, e, n, s))), s.promise;
|
|
16226
16226
|
}
|
|
16227
16227
|
|
|
16228
|
-
function
|
|
16229
|
-
const n = new
|
|
16228
|
+
function hc(t, e) {
|
|
16229
|
+
const n = new Ga(e);
|
|
16230
16230
|
return t.asyncQueue.enqueueAndForget((async () => function(t, e) {
|
|
16231
16231
|
K(t).Tu.add(e),
|
|
16232
16232
|
// Immediately fire an initial event, indicating all existing listeners
|
|
16233
16233
|
// are in-sync.
|
|
16234
16234
|
e.next();
|
|
16235
|
-
}(await
|
|
16236
|
-
n.
|
|
16235
|
+
}(await sc(t), n))), () => {
|
|
16236
|
+
n.Ia(), t.asyncQueue.enqueueAndForget((async () => function(t, e) {
|
|
16237
16237
|
K(t).Tu.delete(e);
|
|
16238
|
-
}(await
|
|
16238
|
+
}(await sc(t), n)));
|
|
16239
16239
|
};
|
|
16240
16240
|
}
|
|
16241
16241
|
|
|
@@ -16253,25 +16253,25 @@ function ha(t, e) {
|
|
|
16253
16253
|
* accessed with the transaction will not reflect local changes that have not
|
|
16254
16254
|
* been committed. For this reason, it is required that all reads are
|
|
16255
16255
|
* performed before any writes. Transactions must be performed while online.
|
|
16256
|
-
*/ function
|
|
16256
|
+
*/ function lc(t, e, n) {
|
|
16257
16257
|
const s = new j;
|
|
16258
16258
|
return t.asyncQueue.enqueueAndForget((async () => {
|
|
16259
16259
|
const i = await function(t) {
|
|
16260
|
-
return
|
|
16260
|
+
return Xa(t).then((t => t.datastore));
|
|
16261
16261
|
}(t);
|
|
16262
|
-
new
|
|
16262
|
+
new Wa(t.asyncQueue, i, n, e, s).run();
|
|
16263
16263
|
})), s.promise;
|
|
16264
16264
|
}
|
|
16265
16265
|
|
|
16266
|
-
function
|
|
16266
|
+
function fc(t, e, n, s) {
|
|
16267
16267
|
const i = function(t, e) {
|
|
16268
16268
|
let n;
|
|
16269
16269
|
n = "string" == typeof t ? (new TextEncoder).encode(t) : t;
|
|
16270
16270
|
return function(t, e) {
|
|
16271
|
-
return new
|
|
16271
|
+
return new Qa(t, e);
|
|
16272
16272
|
}(function(t, e) {
|
|
16273
|
-
if (t instanceof Uint8Array) return
|
|
16274
|
-
if (t instanceof ArrayBuffer) return
|
|
16273
|
+
if (t instanceof Uint8Array) return Ka(t, e);
|
|
16274
|
+
if (t instanceof ArrayBuffer) return Ka(new Uint8Array(t), e);
|
|
16275
16275
|
if (t instanceof ReadableStream) return t.getReader();
|
|
16276
16276
|
throw new Error("Source of `toByteStreamReader` has to be a ArrayBuffer or ReadableStream");
|
|
16277
16277
|
}(n), e);
|
|
@@ -16293,18 +16293,18 @@ function fa(t, e, n, s) {
|
|
|
16293
16293
|
* limitations under the License.
|
|
16294
16294
|
*/ (n, nu(e));
|
|
16295
16295
|
t.asyncQueue.enqueueAndForget((async () => {
|
|
16296
|
-
$
|
|
16296
|
+
$a(await nc(t), i, s);
|
|
16297
16297
|
}));
|
|
16298
16298
|
}
|
|
16299
16299
|
|
|
16300
|
-
function
|
|
16300
|
+
function dc(t, e) {
|
|
16301
16301
|
return t.asyncQueue.enqueue((async () => function(t, e) {
|
|
16302
16302
|
const n = K(t);
|
|
16303
16303
|
return n.persistence.runTransaction("Get named query", "readonly", (t => n.Ds.getNamedQuery(t, e)));
|
|
16304
|
-
}(await
|
|
16304
|
+
}(await tc(t), e)));
|
|
16305
16305
|
}
|
|
16306
16306
|
|
|
16307
|
-
const
|
|
16307
|
+
const _c = new Map;
|
|
16308
16308
|
|
|
16309
16309
|
/**
|
|
16310
16310
|
* An instance map that ensures only one Datastore exists per Firestore
|
|
@@ -16326,28 +16326,28 @@ const _a = new Map;
|
|
|
16326
16326
|
* See the License for the specific language governing permissions and
|
|
16327
16327
|
* limitations under the License.
|
|
16328
16328
|
*/
|
|
16329
|
-
function
|
|
16329
|
+
function wc(t, e, n) {
|
|
16330
16330
|
if (!n) throw new Q(G.INVALID_ARGUMENT, `Function ${t}() cannot be called with an empty ${e}.`);
|
|
16331
16331
|
}
|
|
16332
16332
|
|
|
16333
16333
|
/**
|
|
16334
16334
|
* Validates that two boolean options are not set at the same time.
|
|
16335
16335
|
* @internal
|
|
16336
|
-
*/ function
|
|
16336
|
+
*/ function mc(t, e, n, s) {
|
|
16337
16337
|
if (!0 === e && !0 === s) throw new Q(G.INVALID_ARGUMENT, `${t} and ${n} cannot be used together.`);
|
|
16338
16338
|
}
|
|
16339
16339
|
|
|
16340
16340
|
/**
|
|
16341
16341
|
* Validates that `path` refers to a document (indicated by the fact it contains
|
|
16342
16342
|
* an even numbers of segments).
|
|
16343
|
-
*/ function
|
|
16343
|
+
*/ function gc(t) {
|
|
16344
16344
|
if (!dt.isDocumentKey(t)) throw new Q(G.INVALID_ARGUMENT, `Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`);
|
|
16345
16345
|
}
|
|
16346
16346
|
|
|
16347
16347
|
/**
|
|
16348
16348
|
* Validates that `path` refers to a collection (indicated by the fact it
|
|
16349
16349
|
* contains an odd numbers of segments).
|
|
16350
|
-
*/ function
|
|
16350
|
+
*/ function yc(t) {
|
|
16351
16351
|
if (dt.isDocumentKey(t)) throw new Q(G.INVALID_ARGUMENT, `Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`);
|
|
16352
16352
|
}
|
|
16353
16353
|
|
|
@@ -16356,7 +16356,7 @@ function wa(t, e, n) {
|
|
|
16356
16356
|
* (i.e. excludes Array, Date, etc.).
|
|
16357
16357
|
*/
|
|
16358
16358
|
/** Returns a string describing the type / value of the provided input. */
|
|
16359
|
-
function
|
|
16359
|
+
function pc(t) {
|
|
16360
16360
|
if (void 0 === t) return "undefined";
|
|
16361
16361
|
if (null === t) return "null";
|
|
16362
16362
|
if ("string" == typeof t) return t.length > 20 && (t = `${t.substring(0, 20)}...`),
|
|
@@ -16385,7 +16385,7 @@ function pa(t) {
|
|
|
16385
16385
|
return "function" == typeof t ? "a function" : L();
|
|
16386
16386
|
}
|
|
16387
16387
|
|
|
16388
|
-
function
|
|
16388
|
+
function Ic(t,
|
|
16389
16389
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16390
16390
|
e) {
|
|
16391
16391
|
if ("_delegate" in t && (
|
|
@@ -16394,14 +16394,14 @@ e) {
|
|
|
16394
16394
|
t = t._delegate), !(t instanceof e)) {
|
|
16395
16395
|
if (e.name === t.constructor.name) throw new Q(G.INVALID_ARGUMENT, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
|
|
16396
16396
|
{
|
|
16397
|
-
const n =
|
|
16397
|
+
const n = pc(t);
|
|
16398
16398
|
throw new Q(G.INVALID_ARGUMENT, `Expected type '${e.name}', but it was: ${n}`);
|
|
16399
16399
|
}
|
|
16400
16400
|
}
|
|
16401
16401
|
return t;
|
|
16402
16402
|
}
|
|
16403
16403
|
|
|
16404
|
-
function
|
|
16404
|
+
function Tc(t, e) {
|
|
16405
16405
|
if (e <= 0) throw new Q(G.INVALID_ARGUMENT, `Function ${t}() requires a positive number, but it was: ${e}.`);
|
|
16406
16406
|
}
|
|
16407
16407
|
|
|
@@ -16427,7 +16427,7 @@ function Ta(t, e) {
|
|
|
16427
16427
|
* user-supplied `FirestoreSettings` object. This is a separate type so that
|
|
16428
16428
|
* defaults can be supplied and the value can be checked for equality.
|
|
16429
16429
|
*/
|
|
16430
|
-
class
|
|
16430
|
+
class Ec {
|
|
16431
16431
|
constructor(t) {
|
|
16432
16432
|
var e;
|
|
16433
16433
|
if (void 0 === t.host) {
|
|
@@ -16440,7 +16440,7 @@ class Ea {
|
|
|
16440
16440
|
this.cacheSizeBytes = t.cacheSizeBytes;
|
|
16441
16441
|
}
|
|
16442
16442
|
this.experimentalForceLongPolling = !!t.experimentalForceLongPolling, this.experimentalAutoDetectLongPolling = !!t.experimentalAutoDetectLongPolling,
|
|
16443
|
-
this.useFetchStreams = !!t.useFetchStreams,
|
|
16443
|
+
this.useFetchStreams = !!t.useFetchStreams, mc("experimentalForceLongPolling", t.experimentalForceLongPolling, "experimentalAutoDetectLongPolling", t.experimentalAutoDetectLongPolling);
|
|
16444
16444
|
}
|
|
16445
16445
|
isEqual(t) {
|
|
16446
16446
|
return this.host === t.host && this.ssl === t.ssl && this.credentials === t.credentials && this.cacheSizeBytes === t.cacheSizeBytes && this.experimentalForceLongPolling === t.experimentalForceLongPolling && this.experimentalAutoDetectLongPolling === t.experimentalAutoDetectLongPolling && this.ignoreUndefinedProperties === t.ignoreUndefinedProperties && this.useFetchStreams === t.useFetchStreams;
|
|
@@ -16467,14 +16467,14 @@ class Ea {
|
|
|
16467
16467
|
* The Cloud Firestore service interface.
|
|
16468
16468
|
*
|
|
16469
16469
|
* Do not call this constructor directly. Instead, use {@link getFirestore}.
|
|
16470
|
-
*/ class
|
|
16470
|
+
*/ class Ac {
|
|
16471
16471
|
/** @hideconstructor */
|
|
16472
16472
|
constructor(t, e, n) {
|
|
16473
16473
|
this._authCredentials = e, this._appCheckCredentials = n,
|
|
16474
16474
|
/**
|
|
16475
16475
|
* Whether it's a Firestore or Firestore Lite instance.
|
|
16476
16476
|
*/
|
|
16477
|
-
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new
|
|
16477
|
+
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new Ec({}),
|
|
16478
16478
|
this._settingsFrozen = !1, t instanceof re ? this._databaseId = t : (this._app = t,
|
|
16479
16479
|
this._databaseId = function(t) {
|
|
16480
16480
|
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new Q(G.INVALID_ARGUMENT, '"projectId" not provided in firebase.initializeApp.');
|
|
@@ -16509,7 +16509,7 @@ class Ea {
|
|
|
16509
16509
|
}
|
|
16510
16510
|
_setSettings(t) {
|
|
16511
16511
|
if (this._settingsFrozen) throw new Q(G.FAILED_PRECONDITION, "Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");
|
|
16512
|
-
this._settings = new
|
|
16512
|
+
this._settings = new Ec(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
|
|
16513
16513
|
if (!t) return new z;
|
|
16514
16514
|
switch (t.type) {
|
|
16515
16515
|
case "gapi":
|
|
@@ -16554,15 +16554,15 @@ class Ea {
|
|
|
16554
16554
|
* when the `Firestore` instance is terminated.
|
|
16555
16555
|
*/
|
|
16556
16556
|
return function(t) {
|
|
16557
|
-
const e =
|
|
16558
|
-
e && (M("ComponentProvider", "Removing Datastore"),
|
|
16557
|
+
const e = _c.get(t);
|
|
16558
|
+
e && (M("ComponentProvider", "Removing Datastore"), _c.delete(t), e.terminate());
|
|
16559
16559
|
}(this), Promise.resolve();
|
|
16560
16560
|
}
|
|
16561
16561
|
}
|
|
16562
16562
|
|
|
16563
|
-
function
|
|
16563
|
+
function Rc(t, e, n, s = {}) {
|
|
16564
16564
|
var i;
|
|
16565
|
-
const r = (t =
|
|
16565
|
+
const r = (t = Ic(t, Ac))._getSettings();
|
|
16566
16566
|
if ("firestore.googleapis.com" !== r.host && r.host !== e && $("Host has been set in both settings() and useEmulator(), emulator host will be used"),
|
|
16567
16567
|
t._setSettings(Object.assign(Object.assign({}, r), {
|
|
16568
16568
|
host: `${e}:${n}`,
|
|
@@ -16601,7 +16601,7 @@ function Ra(t, e, n, s = {}) {
|
|
|
16601
16601
|
* A `DocumentReference` refers to a document location in a Firestore database
|
|
16602
16602
|
* and can be used to write, read, or listen to the location. The document at
|
|
16603
16603
|
* the referenced location may or may not exist.
|
|
16604
|
-
*/ class
|
|
16604
|
+
*/ class bc {
|
|
16605
16605
|
/** @hideconstructor */
|
|
16606
16606
|
constructor(t,
|
|
16607
16607
|
/**
|
|
@@ -16629,17 +16629,17 @@ function Ra(t, e, n, s = {}) {
|
|
|
16629
16629
|
/**
|
|
16630
16630
|
* The collection this `DocumentReference` belongs to.
|
|
16631
16631
|
*/ get parent() {
|
|
16632
|
-
return new
|
|
16632
|
+
return new vc(this.firestore, this.converter, this._key.path.popLast());
|
|
16633
16633
|
}
|
|
16634
16634
|
withConverter(t) {
|
|
16635
|
-
return new
|
|
16635
|
+
return new bc(this.firestore, t, this._key);
|
|
16636
16636
|
}
|
|
16637
16637
|
}
|
|
16638
16638
|
|
|
16639
16639
|
/**
|
|
16640
16640
|
* A `Query` refers to a query which you can read or listen to. You can also
|
|
16641
16641
|
* construct refined `Query` objects by adding filters and ordering.
|
|
16642
|
-
*/ class
|
|
16642
|
+
*/ class Pc {
|
|
16643
16643
|
// This is the lite version of the Query class in the main SDK.
|
|
16644
16644
|
/** @hideconstructor protected */
|
|
16645
16645
|
constructor(t,
|
|
@@ -16652,14 +16652,14 @@ function Ra(t, e, n, s = {}) {
|
|
|
16652
16652
|
this.type = "query", this.firestore = t;
|
|
16653
16653
|
}
|
|
16654
16654
|
withConverter(t) {
|
|
16655
|
-
return new
|
|
16655
|
+
return new Pc(this.firestore, t, this._query);
|
|
16656
16656
|
}
|
|
16657
16657
|
}
|
|
16658
16658
|
|
|
16659
16659
|
/**
|
|
16660
16660
|
* A `CollectionReference` object can be used for adding documents, getting
|
|
16661
16661
|
* document references, and querying for documents (using {@link query}).
|
|
16662
|
-
*/ class
|
|
16662
|
+
*/ class vc extends Pc {
|
|
16663
16663
|
/** @hideconstructor */
|
|
16664
16664
|
constructor(t, e, n) {
|
|
16665
16665
|
super(t, e, rn(n)), this._path = n,
|
|
@@ -16680,23 +16680,23 @@ function Ra(t, e, n, s = {}) {
|
|
|
16680
16680
|
* subcollection. If this isn't a subcollection, the reference is null.
|
|
16681
16681
|
*/ get parent() {
|
|
16682
16682
|
const t = this._path.popLast();
|
|
16683
|
-
return t.isEmpty() ? null : new
|
|
16683
|
+
return t.isEmpty() ? null : new bc(this.firestore,
|
|
16684
16684
|
/* converter= */ null, new dt(t));
|
|
16685
16685
|
}
|
|
16686
16686
|
withConverter(t) {
|
|
16687
|
-
return new
|
|
16687
|
+
return new vc(this.firestore, t, this._path);
|
|
16688
16688
|
}
|
|
16689
16689
|
}
|
|
16690
16690
|
|
|
16691
|
-
function
|
|
16692
|
-
if (t = getModularInstance(t),
|
|
16691
|
+
function Vc(t, e, ...n) {
|
|
16692
|
+
if (t = getModularInstance(t), wc("collection", "path", e), t instanceof Ac) {
|
|
16693
16693
|
const s = ht.fromString(e, ...n);
|
|
16694
|
-
return
|
|
16694
|
+
return yc(s), new vc(t, /* converter= */ null, s);
|
|
16695
16695
|
}
|
|
16696
16696
|
{
|
|
16697
|
-
if (!(t instanceof
|
|
16697
|
+
if (!(t instanceof bc || t instanceof vc)) throw new Q(G.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
16698
16698
|
const s = t._path.child(ht.fromString(e, ...n));
|
|
16699
|
-
return
|
|
16699
|
+
return yc(s), new vc(t.firestore,
|
|
16700
16700
|
/* converter= */ null, s);
|
|
16701
16701
|
}
|
|
16702
16702
|
}
|
|
@@ -16713,9 +16713,9 @@ function Va(t, e, ...n) {
|
|
|
16713
16713
|
* collection or subcollection with this ID as the last segment of its path
|
|
16714
16714
|
* will be included. Cannot contain a slash.
|
|
16715
16715
|
* @returns The created `Query`.
|
|
16716
|
-
*/ function
|
|
16717
|
-
if (t =
|
|
16718
|
-
return new
|
|
16716
|
+
*/ function Sc(t, e) {
|
|
16717
|
+
if (t = Ic(t, Ac), wc("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new Q(G.INVALID_ARGUMENT, `Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
|
|
16718
|
+
return new Pc(t,
|
|
16719
16719
|
/* converter= */ null,
|
|
16720
16720
|
/**
|
|
16721
16721
|
* Creates a new Query for a collection group query that matches all documents
|
|
@@ -16726,19 +16726,19 @@ function Va(t, e, ...n) {
|
|
|
16726
16726
|
}(e));
|
|
16727
16727
|
}
|
|
16728
16728
|
|
|
16729
|
-
function
|
|
16729
|
+
function Dc(t, e, ...n) {
|
|
16730
16730
|
if (t = getModularInstance(t),
|
|
16731
16731
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
16732
16732
|
// 'undefined' and 'null'.
|
|
16733
|
-
1 === arguments.length && (e = st.I()),
|
|
16733
|
+
1 === arguments.length && (e = st.I()), wc("doc", "path", e), t instanceof Ac) {
|
|
16734
16734
|
const s = ht.fromString(e, ...n);
|
|
16735
|
-
return
|
|
16735
|
+
return gc(s), new bc(t,
|
|
16736
16736
|
/* converter= */ null, new dt(s));
|
|
16737
16737
|
}
|
|
16738
16738
|
{
|
|
16739
|
-
if (!(t instanceof
|
|
16739
|
+
if (!(t instanceof bc || t instanceof vc)) throw new Q(G.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
16740
16740
|
const s = t._path.child(ht.fromString(e, ...n));
|
|
16741
|
-
return
|
|
16741
|
+
return gc(s), new bc(t.firestore, t instanceof vc ? t.converter : null, new dt(s));
|
|
16742
16742
|
}
|
|
16743
16743
|
}
|
|
16744
16744
|
|
|
@@ -16749,8 +16749,8 @@ function Da(t, e, ...n) {
|
|
|
16749
16749
|
* @param right - A reference to compare.
|
|
16750
16750
|
* @returns true if the references point to the same location in the same
|
|
16751
16751
|
* Firestore database.
|
|
16752
|
-
*/ function
|
|
16753
|
-
return t = getModularInstance(t), e = getModularInstance(e), (t instanceof
|
|
16752
|
+
*/ function Cc(t, e) {
|
|
16753
|
+
return t = getModularInstance(t), e = getModularInstance(e), (t instanceof bc || t instanceof vc) && (e instanceof bc || e instanceof vc) && (t.firestore === e.firestore && t.path === e.path && t.converter === e.converter);
|
|
16754
16754
|
}
|
|
16755
16755
|
|
|
16756
16756
|
/**
|
|
@@ -16761,8 +16761,8 @@ function Da(t, e, ...n) {
|
|
|
16761
16761
|
* @param right - A `Query` to compare.
|
|
16762
16762
|
* @returns true if the references point to the same location in the same
|
|
16763
16763
|
* Firestore database.
|
|
16764
|
-
*/ function
|
|
16765
|
-
return t = getModularInstance(t), e = getModularInstance(e), t instanceof
|
|
16764
|
+
*/ function xc(t, e) {
|
|
16765
|
+
return t = getModularInstance(t), e = getModularInstance(e), t instanceof Pc && e instanceof Pc && (t.firestore === e.firestore && dn(t._query, e._query) && t.converter === e.converter);
|
|
16766
16766
|
}
|
|
16767
16767
|
|
|
16768
16768
|
/**
|
|
@@ -16780,42 +16780,42 @@ function Da(t, e, ...n) {
|
|
|
16780
16780
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16781
16781
|
* See the License for the specific language governing permissions and
|
|
16782
16782
|
* limitations under the License.
|
|
16783
|
-
*/ class
|
|
16783
|
+
*/ class Nc {
|
|
16784
16784
|
constructor() {
|
|
16785
16785
|
// The last promise in the queue.
|
|
16786
|
-
this.
|
|
16786
|
+
this.ka = Promise.resolve(),
|
|
16787
16787
|
// A list of retryable operations. Retryable operations are run in order and
|
|
16788
16788
|
// retried with backoff.
|
|
16789
|
-
this.
|
|
16789
|
+
this.Oa = [],
|
|
16790
16790
|
// Is this AsyncQueue being shut down? Once it is set to true, it will not
|
|
16791
16791
|
// be changed again.
|
|
16792
|
-
this.
|
|
16792
|
+
this.Ma = !1,
|
|
16793
16793
|
// Operations scheduled to be queued in the future. Operations are
|
|
16794
16794
|
// automatically removed after they are run or canceled.
|
|
16795
|
-
this
|
|
16795
|
+
this.Fa = [],
|
|
16796
16796
|
// visible for testing
|
|
16797
|
-
this
|
|
16797
|
+
this.$a = null,
|
|
16798
16798
|
// Flag set while there's an outstanding AsyncQueue operation, used for
|
|
16799
16799
|
// assertion sanity-checks.
|
|
16800
|
-
this.
|
|
16800
|
+
this.Ba = !1,
|
|
16801
16801
|
// Enabled during shutdown on Safari to prevent future access to IndexedDB.
|
|
16802
|
-
this.
|
|
16802
|
+
this.La = !1,
|
|
16803
16803
|
// List of TimerIds to fast-forward delays for.
|
|
16804
|
-
this.
|
|
16804
|
+
this.Ua = [],
|
|
16805
16805
|
// Backoff timer used to schedule retries for retryable operations
|
|
16806
16806
|
this.So = new su(this, "async_queue_retry" /* AsyncQueueRetry */),
|
|
16807
16807
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
16808
16808
|
// operations. Meant to speed up recovery when we regain file system access
|
|
16809
16809
|
// after page comes into foreground.
|
|
16810
|
-
this.
|
|
16810
|
+
this.qa = () => {
|
|
16811
16811
|
const t = eu();
|
|
16812
16812
|
t && M("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.So.Eo();
|
|
16813
16813
|
};
|
|
16814
16814
|
const t = eu();
|
|
16815
|
-
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.
|
|
16815
|
+
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.qa);
|
|
16816
16816
|
}
|
|
16817
16817
|
get isShuttingDown() {
|
|
16818
|
-
return this.
|
|
16818
|
+
return this.Ma;
|
|
16819
16819
|
}
|
|
16820
16820
|
/**
|
|
16821
16821
|
* Adds a new operation to the queue without waiting for it to complete (i.e.
|
|
@@ -16825,44 +16825,44 @@ function Da(t, e, ...n) {
|
|
|
16825
16825
|
this.enqueue(t);
|
|
16826
16826
|
}
|
|
16827
16827
|
enqueueAndForgetEvenWhileRestricted(t) {
|
|
16828
|
-
this.
|
|
16828
|
+
this.Ka(),
|
|
16829
16829
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
16830
|
-
this.
|
|
16830
|
+
this.Ga(t);
|
|
16831
16831
|
}
|
|
16832
16832
|
enterRestrictedMode(t) {
|
|
16833
|
-
if (!this.
|
|
16834
|
-
this.
|
|
16833
|
+
if (!this.Ma) {
|
|
16834
|
+
this.Ma = !0, this.La = t || !1;
|
|
16835
16835
|
const e = eu();
|
|
16836
|
-
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.
|
|
16836
|
+
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.qa);
|
|
16837
16837
|
}
|
|
16838
16838
|
}
|
|
16839
16839
|
enqueue(t) {
|
|
16840
|
-
if (this.
|
|
16840
|
+
if (this.Ka(), this.Ma)
|
|
16841
16841
|
// Return a Promise which never resolves.
|
|
16842
16842
|
return new Promise((() => {}));
|
|
16843
16843
|
// Create a deferred Promise that we can return to the callee. This
|
|
16844
16844
|
// allows us to return a "hanging Promise" only to the callee and still
|
|
16845
16845
|
// advance the queue even when the operation is not run.
|
|
16846
16846
|
const e = new j;
|
|
16847
|
-
return this.
|
|
16847
|
+
return this.Ga((() => this.Ma && this.La ? Promise.resolve() : (t().then(e.resolve, e.reject),
|
|
16848
16848
|
e.promise))).then((() => e.promise));
|
|
16849
16849
|
}
|
|
16850
16850
|
enqueueRetryable(t) {
|
|
16851
|
-
this.enqueueAndForget((() => (this.
|
|
16851
|
+
this.enqueueAndForget((() => (this.Oa.push(t), this.Qa())));
|
|
16852
16852
|
}
|
|
16853
16853
|
/**
|
|
16854
16854
|
* Runs the next operation from the retryable queue. If the operation fails,
|
|
16855
16855
|
* reschedules with backoff.
|
|
16856
|
-
*/ async
|
|
16857
|
-
if (0 !== this.
|
|
16856
|
+
*/ async Qa() {
|
|
16857
|
+
if (0 !== this.Oa.length) {
|
|
16858
16858
|
try {
|
|
16859
|
-
await this.
|
|
16859
|
+
await this.Oa[0](), this.Oa.shift(), this.So.reset();
|
|
16860
16860
|
} catch (t) {
|
|
16861
16861
|
if (!Ct(t)) throw t;
|
|
16862
16862
|
// Failure will be handled by AsyncQueue
|
|
16863
16863
|
M("AsyncQueue", "Operation failed with retryable error: " + t);
|
|
16864
16864
|
}
|
|
16865
|
-
this.
|
|
16865
|
+
this.Oa.length > 0 &&
|
|
16866
16866
|
// If there are additional operations, we re-schedule `retryNextOp()`.
|
|
16867
16867
|
// This is necessary to run retryable operations that failed during
|
|
16868
16868
|
// their initial attempt since we don't know whether they are already
|
|
@@ -16873,12 +16873,12 @@ function Da(t, e, ...n) {
|
|
|
16873
16873
|
// Since `backoffAndRun()` cancels an existing backoff and schedules a
|
|
16874
16874
|
// new backoff on every call, there is only ever a single additional
|
|
16875
16875
|
// operation in the queue.
|
|
16876
|
-
this.So.Io((() => this.
|
|
16876
|
+
this.So.Io((() => this.Qa()));
|
|
16877
16877
|
}
|
|
16878
16878
|
}
|
|
16879
|
-
|
|
16880
|
-
const e = this.
|
|
16881
|
-
this
|
|
16879
|
+
Ga(t) {
|
|
16880
|
+
const e = this.ka.then((() => (this.Ba = !0, t().catch((t => {
|
|
16881
|
+
this.$a = t, this.Ba = !1;
|
|
16882
16882
|
const e =
|
|
16883
16883
|
/**
|
|
16884
16884
|
* Chrome includes Error.message in Error.stack. Other browsers do not.
|
|
@@ -16910,38 +16910,38 @@ function Da(t, e, ...n) {
|
|
|
16910
16910
|
// all further attempts to chain (via .then) will just short-circuit
|
|
16911
16911
|
// and return the rejected Promise.
|
|
16912
16912
|
throw F("INTERNAL UNHANDLED ERROR: ", e), t;
|
|
16913
|
-
})).then((t => (this.
|
|
16914
|
-
return this.
|
|
16913
|
+
})).then((t => (this.Ba = !1, t))))));
|
|
16914
|
+
return this.ka = e, e;
|
|
16915
16915
|
}
|
|
16916
16916
|
enqueueAfterDelay(t, e, n) {
|
|
16917
|
-
this.
|
|
16917
|
+
this.Ka(),
|
|
16918
16918
|
// Fast-forward delays for timerIds that have been overriden.
|
|
16919
|
-
this.
|
|
16920
|
-
const s = $u.createAndSchedule(this, t, e, n, (t => this.
|
|
16921
|
-
return this
|
|
16919
|
+
this.Ua.indexOf(t) > -1 && (e = 0);
|
|
16920
|
+
const s = $u.createAndSchedule(this, t, e, n, (t => this.ja(t)));
|
|
16921
|
+
return this.Fa.push(s), s;
|
|
16922
16922
|
}
|
|
16923
|
-
|
|
16924
|
-
this
|
|
16923
|
+
Ka() {
|
|
16924
|
+
this.$a && L();
|
|
16925
16925
|
}
|
|
16926
16926
|
verifyOperationInProgress() {}
|
|
16927
16927
|
/**
|
|
16928
16928
|
* Waits until all currently queued tasks are finished executing. Delayed
|
|
16929
16929
|
* operations are not run.
|
|
16930
|
-
*/ async
|
|
16930
|
+
*/ async Wa() {
|
|
16931
16931
|
// Operations in the queue prior to draining may have enqueued additional
|
|
16932
16932
|
// operations. Keep draining the queue until the tail is no longer advanced,
|
|
16933
16933
|
// which indicates that no more new operations were enqueued and that all
|
|
16934
16934
|
// operations were executed.
|
|
16935
16935
|
let t;
|
|
16936
16936
|
do {
|
|
16937
|
-
t = this.
|
|
16938
|
-
} while (t !== this.
|
|
16937
|
+
t = this.ka, await t;
|
|
16938
|
+
} while (t !== this.ka);
|
|
16939
16939
|
}
|
|
16940
16940
|
/**
|
|
16941
16941
|
* For Tests: Determine if a delayed operation with a particular TimerId
|
|
16942
16942
|
* exists.
|
|
16943
|
-
*/
|
|
16944
|
-
for (const e of this
|
|
16943
|
+
*/ za(t) {
|
|
16944
|
+
for (const e of this.Fa) if (e.timerId === t) return !0;
|
|
16945
16945
|
return !1;
|
|
16946
16946
|
}
|
|
16947
16947
|
/**
|
|
@@ -16950,28 +16950,28 @@ function Da(t, e, ...n) {
|
|
|
16950
16950
|
* @param lastTimerId - Delayed operations up to and including this TimerId
|
|
16951
16951
|
* will be drained. Pass TimerId.All to run all delayed operations.
|
|
16952
16952
|
* @returns a Promise that resolves once all operations have been run.
|
|
16953
|
-
*/
|
|
16953
|
+
*/ Ha(t) {
|
|
16954
16954
|
// Note that draining may generate more delayed ops, so we do that first.
|
|
16955
|
-
return this.
|
|
16955
|
+
return this.Wa().then((() => {
|
|
16956
16956
|
// Run ops in the same order they'd run if they ran naturally.
|
|
16957
|
-
this
|
|
16958
|
-
for (const e of this
|
|
16959
|
-
return this.
|
|
16957
|
+
this.Fa.sort(((t, e) => t.targetTimeMs - e.targetTimeMs));
|
|
16958
|
+
for (const e of this.Fa) if (e.skipDelay(), "all" /* All */ !== t && e.timerId === t) break;
|
|
16959
|
+
return this.Wa();
|
|
16960
16960
|
}));
|
|
16961
16961
|
}
|
|
16962
16962
|
/**
|
|
16963
16963
|
* For Tests: Skip all subsequent delays for a timer id.
|
|
16964
|
-
*/
|
|
16965
|
-
this.
|
|
16964
|
+
*/ Ja(t) {
|
|
16965
|
+
this.Ua.push(t);
|
|
16966
16966
|
}
|
|
16967
|
-
/** Called once a DelayedOperation is run or canceled. */
|
|
16967
|
+
/** Called once a DelayedOperation is run or canceled. */ ja(t) {
|
|
16968
16968
|
// NOTE: indexOf / slice are O(n), but delayedOperations is expected to be small.
|
|
16969
|
-
const e = this
|
|
16970
|
-
this
|
|
16969
|
+
const e = this.Fa.indexOf(t);
|
|
16970
|
+
this.Fa.splice(e, 1);
|
|
16971
16971
|
}
|
|
16972
16972
|
}
|
|
16973
16973
|
|
|
16974
|
-
function
|
|
16974
|
+
function kc(t) {
|
|
16975
16975
|
/**
|
|
16976
16976
|
* Returns true if obj is an object and contains at least one of the specified
|
|
16977
16977
|
* methods.
|
|
@@ -17006,7 +17006,7 @@ function ka(t) {
|
|
|
17006
17006
|
*/ (t, [ "next", "error", "complete" ]);
|
|
17007
17007
|
}
|
|
17008
17008
|
|
|
17009
|
-
class
|
|
17009
|
+
class Oc {
|
|
17010
17010
|
constructor() {
|
|
17011
17011
|
this._progressObserver = {}, this._taskCompletionResolver = new j, this._lastProgress = {
|
|
17012
17012
|
taskState: "Running",
|
|
@@ -17090,27 +17090,27 @@ class Oa {
|
|
|
17090
17090
|
* See the License for the specific language governing permissions and
|
|
17091
17091
|
* limitations under the License.
|
|
17092
17092
|
*/
|
|
17093
|
-
/** DOMException error code constants. */ const
|
|
17093
|
+
/** DOMException error code constants. */ const Mc = -1;
|
|
17094
17094
|
|
|
17095
17095
|
/**
|
|
17096
17096
|
* The Cloud Firestore service interface.
|
|
17097
17097
|
*
|
|
17098
17098
|
* Do not call this constructor directly. Instead, use {@link getFirestore}.
|
|
17099
17099
|
*/
|
|
17100
|
-
class
|
|
17100
|
+
class Fc extends Ac {
|
|
17101
17101
|
/** @hideconstructor */
|
|
17102
17102
|
constructor(t, e, n) {
|
|
17103
17103
|
super(t, e, n),
|
|
17104
17104
|
/**
|
|
17105
17105
|
* Whether it's a {@link Firestore} or Firestore Lite instance.
|
|
17106
17106
|
*/
|
|
17107
|
-
this.type = "firestore", this._queue = new
|
|
17107
|
+
this.type = "firestore", this._queue = new Nc, this._persistenceKey = "name" in t ? t.name : "[DEFAULT]";
|
|
17108
17108
|
}
|
|
17109
17109
|
_terminate() {
|
|
17110
17110
|
return this._firestoreClient ||
|
|
17111
17111
|
// The client must be initialized to ensure that all subsequent API
|
|
17112
17112
|
// usage throws an exception.
|
|
17113
|
-
|
|
17113
|
+
Uc(this), this._firestoreClient.terminate();
|
|
17114
17114
|
}
|
|
17115
17115
|
}
|
|
17116
17116
|
|
|
@@ -17124,7 +17124,7 @@ class Fa extends Aa {
|
|
|
17124
17124
|
* be associated.
|
|
17125
17125
|
* @param settings - A settings object to configure the {@link Firestore} instance.
|
|
17126
17126
|
* @returns A newly initialized {@link Firestore} instance.
|
|
17127
|
-
*/ function $
|
|
17127
|
+
*/ function $c(t, e) {
|
|
17128
17128
|
const n = _getProvider(t, "firestore");
|
|
17129
17129
|
if (n.isInitialized()) {
|
|
17130
17130
|
const t = n.getImmediate(), s = n.getOptions();
|
|
@@ -17145,22 +17145,22 @@ class Fa extends Aa {
|
|
|
17145
17145
|
* @param app - The {@link @firebase/app#FirebaseApp} instance that the returned {@link Firestore}
|
|
17146
17146
|
* instance is associated with.
|
|
17147
17147
|
* @returns The {@link Firestore} instance of the provided app.
|
|
17148
|
-
*/ function
|
|
17148
|
+
*/ function Bc(e = getApp()) {
|
|
17149
17149
|
return _getProvider(e, "firestore").getImmediate();
|
|
17150
17150
|
}
|
|
17151
17151
|
|
|
17152
17152
|
/**
|
|
17153
17153
|
* @internal
|
|
17154
|
-
*/ function
|
|
17155
|
-
return t._firestoreClient ||
|
|
17154
|
+
*/ function Lc(t) {
|
|
17155
|
+
return t._firestoreClient || Uc(t), t._firestoreClient.verifyNotTerminated(), t._firestoreClient;
|
|
17156
17156
|
}
|
|
17157
17157
|
|
|
17158
|
-
function
|
|
17158
|
+
function Uc(t) {
|
|
17159
17159
|
var e;
|
|
17160
17160
|
const n = t._freezeSettings(), s = function(t, e, n, s) {
|
|
17161
17161
|
return new ie(t, e, n, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams);
|
|
17162
17162
|
}(t._databaseId, (null === (e = t._app) || void 0 === e ? void 0 : e.options.appId) || "", t._persistenceKey, n);
|
|
17163
|
-
t._firestoreClient = new
|
|
17163
|
+
t._firestoreClient = new za(t._authCredentials, t._appCheckCredentials, t._queue, s);
|
|
17164
17164
|
}
|
|
17165
17165
|
|
|
17166
17166
|
/**
|
|
@@ -17185,10 +17185,10 @@ function Ua(t) {
|
|
|
17185
17185
|
* @param persistenceSettings - Optional settings object to configure
|
|
17186
17186
|
* persistence.
|
|
17187
17187
|
* @returns A `Promise` that represents successfully enabling persistent storage.
|
|
17188
|
-
*/ function
|
|
17189
|
-
|
|
17190
|
-
const n =
|
|
17191
|
-
return
|
|
17188
|
+
*/ function qc(t, e) {
|
|
17189
|
+
Xc(t = Ic(t, Fc));
|
|
17190
|
+
const n = Lc(t), s = t._freezeSettings(), i = new qa;
|
|
17191
|
+
return Gc(n, i, new La(i, s.cacheSizeBytes, null == e ? void 0 : e.forceOwnership));
|
|
17192
17192
|
}
|
|
17193
17193
|
|
|
17194
17194
|
/**
|
|
@@ -17212,10 +17212,10 @@ function Ua(t) {
|
|
|
17212
17212
|
* @param firestore - The {@link Firestore} instance to enable persistence for.
|
|
17213
17213
|
* @returns A `Promise` that represents successfully enabling persistent
|
|
17214
17214
|
* storage.
|
|
17215
|
-
*/ function
|
|
17216
|
-
|
|
17217
|
-
const e =
|
|
17218
|
-
return
|
|
17215
|
+
*/ function Kc(t) {
|
|
17216
|
+
Xc(t = Ic(t, Fc));
|
|
17217
|
+
const e = Lc(t), n = t._freezeSettings(), s = new qa;
|
|
17218
|
+
return Gc(e, s, new Ua(s, n.cacheSizeBytes));
|
|
17219
17219
|
}
|
|
17220
17220
|
|
|
17221
17221
|
/**
|
|
@@ -17223,11 +17223,11 @@ function Ua(t) {
|
|
|
17223
17223
|
* If the operation fails with a recoverable error (see
|
|
17224
17224
|
* `canRecoverFromIndexedDbError()` below), the returned Promise is rejected
|
|
17225
17225
|
* but the client remains usable.
|
|
17226
|
-
*/ function
|
|
17226
|
+
*/ function Gc(t, e, n) {
|
|
17227
17227
|
const s = new j;
|
|
17228
17228
|
return t.asyncQueue.enqueue((async () => {
|
|
17229
17229
|
try {
|
|
17230
|
-
await
|
|
17230
|
+
await Ha(t, n), await Ja(t, e), s.resolve();
|
|
17231
17231
|
} catch (t) {
|
|
17232
17232
|
const e = t;
|
|
17233
17233
|
if (!
|
|
@@ -17282,7 +17282,7 @@ function Ua(t) {
|
|
|
17282
17282
|
})).then((() => s.promise));
|
|
17283
17283
|
}
|
|
17284
17284
|
|
|
17285
|
-
function
|
|
17285
|
+
function Qc(t) {
|
|
17286
17286
|
if (t._initialized && !t._terminated) throw new Q(G.FAILED_PRECONDITION, "Persistence can only be cleared before a Firestore instance is initialized or after it is terminated.");
|
|
17287
17287
|
const e = new j;
|
|
17288
17288
|
return t._queue.enqueueAndForgetEvenWhileRestricted((async () => {
|
|
@@ -17313,11 +17313,11 @@ function Qa(t) {
|
|
|
17313
17313
|
*
|
|
17314
17314
|
* @returns A `Promise` which resolves when all currently pending writes have been
|
|
17315
17315
|
* acknowledged by the backend.
|
|
17316
|
-
*/ function
|
|
17316
|
+
*/ function jc(t) {
|
|
17317
17317
|
return function(t) {
|
|
17318
17318
|
const e = new j;
|
|
17319
|
-
return t.asyncQueue.enqueueAndForget((async () =>
|
|
17320
|
-
}(
|
|
17319
|
+
return t.asyncQueue.enqueueAndForget((async () => ma(await nc(t), e))), e.promise;
|
|
17320
|
+
}(Lc(t = Ic(t, Fc)));
|
|
17321
17321
|
}
|
|
17322
17322
|
|
|
17323
17323
|
/**
|
|
@@ -17325,8 +17325,8 @@ function Qa(t) {
|
|
|
17325
17325
|
* call to {@link disableNetwork}.
|
|
17326
17326
|
*
|
|
17327
17327
|
* @returns A `Promise` that is resolved once the network has been enabled.
|
|
17328
|
-
*/ function
|
|
17329
|
-
return
|
|
17328
|
+
*/ function Wc(t) {
|
|
17329
|
+
return ic(Lc(t = Ic(t, Fc)));
|
|
17330
17330
|
}
|
|
17331
17331
|
|
|
17332
17332
|
/**
|
|
@@ -17336,8 +17336,8 @@ function Qa(t) {
|
|
|
17336
17336
|
* operations will be queued until the network is restored.
|
|
17337
17337
|
*
|
|
17338
17338
|
* @returns A `Promise` that is resolved once the network has been disabled.
|
|
17339
|
-
*/ function
|
|
17340
|
-
return
|
|
17339
|
+
*/ function zc(t) {
|
|
17340
|
+
return rc(Lc(t = Ic(t, Fc)));
|
|
17341
17341
|
}
|
|
17342
17342
|
|
|
17343
17343
|
/**
|
|
@@ -17361,7 +17361,7 @@ function Qa(t) {
|
|
|
17361
17361
|
*
|
|
17362
17362
|
* @returns A `Promise` that is resolved when the instance has been successfully
|
|
17363
17363
|
* terminated.
|
|
17364
|
-
*/ function
|
|
17364
|
+
*/ function Hc(t) {
|
|
17365
17365
|
return _removeServiceInstance(t.app, "firestore"), t._delete();
|
|
17366
17366
|
}
|
|
17367
17367
|
|
|
@@ -17375,9 +17375,9 @@ function Qa(t) {
|
|
|
17375
17375
|
* @returns A `LoadBundleTask` object, which notifies callers with progress
|
|
17376
17376
|
* updates, and completion or error events. It can be used as a
|
|
17377
17377
|
* `Promise<LoadBundleTaskProgress>`.
|
|
17378
|
-
*/ function
|
|
17379
|
-
const n =
|
|
17380
|
-
return
|
|
17378
|
+
*/ function Jc(t, e) {
|
|
17379
|
+
const n = Lc(t = Ic(t, Fc)), s = new Oc;
|
|
17380
|
+
return fc(n, t._databaseId, e, s), s;
|
|
17381
17381
|
}
|
|
17382
17382
|
|
|
17383
17383
|
/**
|
|
@@ -17391,11 +17391,11 @@ function Qa(t) {
|
|
|
17391
17391
|
* @param firestore - The {@link Firestore} instance to read the query from.
|
|
17392
17392
|
* @param name - The name of the query.
|
|
17393
17393
|
* @returns A `Promise` that is resolved with the Query or `null`.
|
|
17394
|
-
*/ function
|
|
17395
|
-
return
|
|
17394
|
+
*/ function Yc(t, e) {
|
|
17395
|
+
return dc(Lc(t = Ic(t, Fc)), e).then((e => e ? new Pc(t, null, e.query) : null));
|
|
17396
17396
|
}
|
|
17397
17397
|
|
|
17398
|
-
function
|
|
17398
|
+
function Xc(t) {
|
|
17399
17399
|
if (t._initialized || t._terminated) throw new Q(G.FAILED_PRECONDITION, "Firestore has already been started and persistence can no longer be enabled. You can only enable persistence before calling any other methods on a Firestore object.");
|
|
17400
17400
|
}
|
|
17401
17401
|
|
|
@@ -17439,7 +17439,7 @@ function Xa(t) {
|
|
|
17439
17439
|
* Create a `FieldPath` by providing field names. If more than one field
|
|
17440
17440
|
* name is provided, the path will point to a nested field in a document.
|
|
17441
17441
|
*/
|
|
17442
|
-
class
|
|
17442
|
+
class Zc {
|
|
17443
17443
|
/**
|
|
17444
17444
|
* Creates a `FieldPath` from the provided field names. If more than one field
|
|
17445
17445
|
* name is provided, the path will point to a nested field in a document.
|
|
@@ -17464,7 +17464,7 @@ class Za {
|
|
|
17464
17464
|
* Returns a special sentinel `FieldPath` to refer to the ID of a document.
|
|
17465
17465
|
* It can be used in queries to sort or filter by the document ID.
|
|
17466
17466
|
*/ function th() {
|
|
17467
|
-
return new
|
|
17467
|
+
return new Zc("__name__");
|
|
17468
17468
|
}
|
|
17469
17469
|
|
|
17470
17470
|
/**
|
|
@@ -17690,7 +17690,7 @@ function uh(t) {
|
|
|
17690
17690
|
}
|
|
17691
17691
|
}
|
|
17692
17692
|
|
|
17693
|
-
/** A "context" object passed around while parsing user data. */ class
|
|
17693
|
+
/** A "context" object passed around while parsing user data. */ class ah {
|
|
17694
17694
|
/**
|
|
17695
17695
|
* Initializes a ParseContext with the given source and path.
|
|
17696
17696
|
*
|
|
@@ -17713,102 +17713,102 @@ function uh(t) {
|
|
|
17713
17713
|
this.settings = t, this.databaseId = e, this.wt = n, this.ignoreUndefinedProperties = s,
|
|
17714
17714
|
// Minor hack: If fieldTransforms is undefined, we assume this is an
|
|
17715
17715
|
// external call and we need to validate the entire path.
|
|
17716
|
-
void 0 === i && this.
|
|
17716
|
+
void 0 === i && this.Ya(), this.fieldTransforms = i || [], this.fieldMask = r || [];
|
|
17717
17717
|
}
|
|
17718
17718
|
get path() {
|
|
17719
17719
|
return this.settings.path;
|
|
17720
17720
|
}
|
|
17721
|
-
get
|
|
17722
|
-
return this.settings.
|
|
17721
|
+
get Xa() {
|
|
17722
|
+
return this.settings.Xa;
|
|
17723
17723
|
}
|
|
17724
|
-
/** Returns a new context with the specified settings overwritten. */
|
|
17725
|
-
return new
|
|
17724
|
+
/** Returns a new context with the specified settings overwritten. */ Za(t) {
|
|
17725
|
+
return new ah(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.wt, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
|
|
17726
17726
|
}
|
|
17727
|
-
|
|
17727
|
+
tc(t) {
|
|
17728
17728
|
var e;
|
|
17729
|
-
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), s = this.
|
|
17729
|
+
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), s = this.Za({
|
|
17730
17730
|
path: n,
|
|
17731
|
-
|
|
17731
|
+
ec: !1
|
|
17732
17732
|
});
|
|
17733
|
-
return s.
|
|
17733
|
+
return s.nc(t), s;
|
|
17734
17734
|
}
|
|
17735
|
-
|
|
17735
|
+
sc(t) {
|
|
17736
17736
|
var e;
|
|
17737
|
-
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), s = this.
|
|
17737
|
+
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), s = this.Za({
|
|
17738
17738
|
path: n,
|
|
17739
|
-
|
|
17739
|
+
ec: !1
|
|
17740
17740
|
});
|
|
17741
|
-
return s.
|
|
17741
|
+
return s.Ya(), s;
|
|
17742
17742
|
}
|
|
17743
|
-
|
|
17743
|
+
ic(t) {
|
|
17744
17744
|
// TODO(b/34871131): We don't support array paths right now; so make path
|
|
17745
17745
|
// undefined.
|
|
17746
|
-
return this.
|
|
17746
|
+
return this.Za({
|
|
17747
17747
|
path: void 0,
|
|
17748
|
-
|
|
17748
|
+
ec: !0
|
|
17749
17749
|
});
|
|
17750
17750
|
}
|
|
17751
|
-
|
|
17752
|
-
return Vh(t, this.settings.methodName, this.settings.
|
|
17751
|
+
rc(t) {
|
|
17752
|
+
return Vh(t, this.settings.methodName, this.settings.oc || !1, this.path, this.settings.uc);
|
|
17753
17753
|
}
|
|
17754
17754
|
/** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
|
|
17755
17755
|
return void 0 !== this.fieldMask.find((e => t.isPrefixOf(e))) || void 0 !== this.fieldTransforms.find((e => t.isPrefixOf(e.field)));
|
|
17756
17756
|
}
|
|
17757
|
-
|
|
17757
|
+
Ya() {
|
|
17758
17758
|
// TODO(b/34871131): Remove null check once we have proper paths for fields
|
|
17759
17759
|
// within arrays.
|
|
17760
|
-
if (this.path) for (let t = 0; t < this.path.length; t++) this.
|
|
17760
|
+
if (this.path) for (let t = 0; t < this.path.length; t++) this.nc(this.path.get(t));
|
|
17761
17761
|
}
|
|
17762
|
-
|
|
17763
|
-
if (0 === t.length) throw this.
|
|
17764
|
-
if (uh(this.
|
|
17762
|
+
nc(t) {
|
|
17763
|
+
if (0 === t.length) throw this.rc("Document fields must not be empty");
|
|
17764
|
+
if (uh(this.Xa) && ih.test(t)) throw this.rc('Document fields cannot begin and end with "__"');
|
|
17765
17765
|
}
|
|
17766
17766
|
}
|
|
17767
17767
|
|
|
17768
17768
|
/**
|
|
17769
17769
|
* Helper for parsing raw user input (provided via the API) into internal model
|
|
17770
17770
|
* classes.
|
|
17771
|
-
*/ class
|
|
17771
|
+
*/ class ch {
|
|
17772
17772
|
constructor(t, e, n) {
|
|
17773
17773
|
this.databaseId = t, this.ignoreUndefinedProperties = e, this.wt = n || nu(t);
|
|
17774
17774
|
}
|
|
17775
|
-
/** Creates a new top-level parse context. */
|
|
17776
|
-
return new
|
|
17777
|
-
|
|
17775
|
+
/** Creates a new top-level parse context. */ ac(t, e, n, s = !1) {
|
|
17776
|
+
return new ah({
|
|
17777
|
+
Xa: t,
|
|
17778
17778
|
methodName: e,
|
|
17779
|
-
|
|
17779
|
+
uc: n,
|
|
17780
17780
|
path: ft.emptyPath(),
|
|
17781
|
-
|
|
17782
|
-
|
|
17781
|
+
ec: !1,
|
|
17782
|
+
oc: s
|
|
17783
17783
|
}, this.databaseId, this.wt, this.ignoreUndefinedProperties);
|
|
17784
17784
|
}
|
|
17785
17785
|
}
|
|
17786
17786
|
|
|
17787
17787
|
function hh(t) {
|
|
17788
17788
|
const e = t._freezeSettings(), n = nu(t._databaseId);
|
|
17789
|
-
return new
|
|
17789
|
+
return new ch(t._databaseId, !!e.ignoreUndefinedProperties, n);
|
|
17790
17790
|
}
|
|
17791
17791
|
|
|
17792
17792
|
/** Parse document data from a set() call. */ function lh(t, e, n, s, i, r = {}) {
|
|
17793
|
-
const o = t.
|
|
17793
|
+
const o = t.ac(r.merge || r.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, i);
|
|
17794
17794
|
Rh("Data must be an object, but it was:", o, s);
|
|
17795
17795
|
const u = Eh(s, o);
|
|
17796
|
-
let
|
|
17797
|
-
if (r.merge)
|
|
17796
|
+
let a, c;
|
|
17797
|
+
if (r.merge) a = new zt(o.fieldMask), c = o.fieldTransforms; else if (r.mergeFields) {
|
|
17798
17798
|
const t = [];
|
|
17799
17799
|
for (const s of r.mergeFields) {
|
|
17800
17800
|
const i = bh(e, s, n);
|
|
17801
17801
|
if (!o.contains(i)) throw new Q(G.INVALID_ARGUMENT, `Field '${i}' is specified in your field mask but missing from your input data.`);
|
|
17802
17802
|
Sh(t, i) || t.push(i);
|
|
17803
17803
|
}
|
|
17804
|
-
|
|
17805
|
-
} else
|
|
17806
|
-
return new rh(new De(u),
|
|
17804
|
+
a = new zt(t), c = o.fieldTransforms.filter((t => a.covers(t.field)));
|
|
17805
|
+
} else a = null, c = o.fieldTransforms;
|
|
17806
|
+
return new rh(new De(u), a, c);
|
|
17807
17807
|
}
|
|
17808
17808
|
|
|
17809
17809
|
class fh extends nh {
|
|
17810
17810
|
_toFieldTransform(t) {
|
|
17811
|
-
if (2 /* MergeSet */ !== t.
|
|
17811
|
+
if (2 /* MergeSet */ !== t.Xa) throw 1 /* Update */ === t.Xa ? t.rc(`${this._methodName}() can only appear at the top level of your update data`) : t.rc(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);
|
|
17812
17812
|
// No transform to add for a delete, but we need to add it to our
|
|
17813
17813
|
// fieldMask so it gets deleted.
|
|
17814
17814
|
return t.fieldMask.push(t.path), null;
|
|
@@ -17834,11 +17834,11 @@ class fh extends nh {
|
|
|
17834
17834
|
* @param context - The parent context.
|
|
17835
17835
|
* @param arrayElement - Whether or not the FieldValue has an array.
|
|
17836
17836
|
*/ function dh(t, e, n) {
|
|
17837
|
-
return new
|
|
17838
|
-
|
|
17839
|
-
|
|
17837
|
+
return new ah({
|
|
17838
|
+
Xa: 3 /* Argument */ ,
|
|
17839
|
+
uc: e.settings.uc,
|
|
17840
17840
|
methodName: t._methodName,
|
|
17841
|
-
|
|
17841
|
+
ec: n
|
|
17842
17842
|
}, e.databaseId, e.wt, e.ignoreUndefinedProperties);
|
|
17843
17843
|
}
|
|
17844
17844
|
|
|
@@ -17853,11 +17853,11 @@ class _h extends nh {
|
|
|
17853
17853
|
|
|
17854
17854
|
class wh extends nh {
|
|
17855
17855
|
constructor(t, e) {
|
|
17856
|
-
super(t), this.
|
|
17856
|
+
super(t), this.cc = e;
|
|
17857
17857
|
}
|
|
17858
17858
|
_toFieldTransform(t) {
|
|
17859
17859
|
const e = dh(this, t,
|
|
17860
|
-
/*array=*/ !0), n = this.
|
|
17860
|
+
/*array=*/ !0), n = this.cc.map((t => Th(t, e))), s = new Vn(n);
|
|
17861
17861
|
return new On(t.path, s);
|
|
17862
17862
|
}
|
|
17863
17863
|
isEqual(t) {
|
|
@@ -17868,11 +17868,11 @@ class wh extends nh {
|
|
|
17868
17868
|
|
|
17869
17869
|
class mh extends nh {
|
|
17870
17870
|
constructor(t, e) {
|
|
17871
|
-
super(t), this.
|
|
17871
|
+
super(t), this.cc = e;
|
|
17872
17872
|
}
|
|
17873
17873
|
_toFieldTransform(t) {
|
|
17874
17874
|
const e = dh(this, t,
|
|
17875
|
-
/*array=*/ !0), n = this.
|
|
17875
|
+
/*array=*/ !0), n = this.cc.map((t => Th(t, e))), s = new Dn(n);
|
|
17876
17876
|
return new On(t.path, s);
|
|
17877
17877
|
}
|
|
17878
17878
|
isEqual(t) {
|
|
@@ -17883,10 +17883,10 @@ class mh extends nh {
|
|
|
17883
17883
|
|
|
17884
17884
|
class gh extends nh {
|
|
17885
17885
|
constructor(t, e) {
|
|
17886
|
-
super(t), this.
|
|
17886
|
+
super(t), this.hc = e;
|
|
17887
17887
|
}
|
|
17888
17888
|
_toFieldTransform(t) {
|
|
17889
|
-
const e = new xn(t.wt, En(t.wt, this.
|
|
17889
|
+
const e = new xn(t.wt, En(t.wt, this.hc));
|
|
17890
17890
|
return new On(t.path, e);
|
|
17891
17891
|
}
|
|
17892
17892
|
isEqual(t) {
|
|
@@ -17896,7 +17896,7 @@ class gh extends nh {
|
|
|
17896
17896
|
}
|
|
17897
17897
|
|
|
17898
17898
|
/** Parse update data from an update() call. */ function yh(t, e, n, s) {
|
|
17899
|
-
const i = t.
|
|
17899
|
+
const i = t.ac(1 /* Update */ , e, n);
|
|
17900
17900
|
Rh("Data must be an object, but it was:", i, s);
|
|
17901
17901
|
const r = [], o = De.empty();
|
|
17902
17902
|
Lt(s, ((t, s) => {
|
|
@@ -17904,11 +17904,11 @@ class gh extends nh {
|
|
|
17904
17904
|
// For Compat types, we have to "extract" the underlying types before
|
|
17905
17905
|
// performing validation.
|
|
17906
17906
|
s = getModularInstance(s);
|
|
17907
|
-
const
|
|
17907
|
+
const a = i.sc(u);
|
|
17908
17908
|
if (s instanceof fh)
|
|
17909
17909
|
// Add it to the field mask, but don't add anything to updateData.
|
|
17910
17910
|
r.push(u); else {
|
|
17911
|
-
const t = Th(s,
|
|
17911
|
+
const t = Th(s, a);
|
|
17912
17912
|
null != t && (r.push(u), o.set(u, t));
|
|
17913
17913
|
}
|
|
17914
17914
|
}));
|
|
@@ -17917,27 +17917,27 @@ class gh extends nh {
|
|
|
17917
17917
|
}
|
|
17918
17918
|
|
|
17919
17919
|
/** Parse update data from a list of field/value arguments. */ function ph(t, e, n, s, i, r) {
|
|
17920
|
-
const o = t.
|
|
17920
|
+
const o = t.ac(1 /* Update */ , e, n), u = [ bh(e, s, n) ], a = [ i ];
|
|
17921
17921
|
if (r.length % 2 != 0) throw new Q(G.INVALID_ARGUMENT, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);
|
|
17922
|
-
for (let t = 0; t < r.length; t += 2) u.push(bh(e, r[t])),
|
|
17923
|
-
const
|
|
17922
|
+
for (let t = 0; t < r.length; t += 2) u.push(bh(e, r[t])), a.push(r[t + 1]);
|
|
17923
|
+
const c = [], h = De.empty();
|
|
17924
17924
|
// We iterate in reverse order to pick the last value for a field if the
|
|
17925
17925
|
// user specified the field multiple times.
|
|
17926
|
-
for (let t = u.length - 1; t >= 0; --t) if (!Sh(
|
|
17926
|
+
for (let t = u.length - 1; t >= 0; --t) if (!Sh(c, u[t])) {
|
|
17927
17927
|
const e = u[t];
|
|
17928
|
-
let n =
|
|
17928
|
+
let n = a[t];
|
|
17929
17929
|
// For Compat types, we have to "extract" the underlying types before
|
|
17930
17930
|
// performing validation.
|
|
17931
17931
|
n = getModularInstance(n);
|
|
17932
|
-
const s = o.
|
|
17932
|
+
const s = o.sc(e);
|
|
17933
17933
|
if (n instanceof fh)
|
|
17934
17934
|
// Add it to the field mask, but don't add anything to updateData.
|
|
17935
|
-
|
|
17935
|
+
c.push(e); else {
|
|
17936
17936
|
const t = Th(n, s);
|
|
17937
|
-
null != t && (
|
|
17937
|
+
null != t && (c.push(e), h.set(e, t));
|
|
17938
17938
|
}
|
|
17939
17939
|
}
|
|
17940
|
-
const l = new zt(
|
|
17940
|
+
const l = new zt(c);
|
|
17941
17941
|
return new oh(h, l, o.fieldTransforms);
|
|
17942
17942
|
}
|
|
17943
17943
|
|
|
@@ -17948,7 +17948,7 @@ class gh extends nh {
|
|
|
17948
17948
|
* @param allowArrays - Whether the query value is an array that may directly
|
|
17949
17949
|
* contain additional arrays (e.g. the operand of an `in` query).
|
|
17950
17950
|
*/ function Ih(t, e, n, s = !1) {
|
|
17951
|
-
return Th(n, t.
|
|
17951
|
+
return Th(n, t.ac(s ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
|
|
17952
17952
|
}
|
|
17953
17953
|
|
|
17954
17954
|
/**
|
|
@@ -17976,8 +17976,8 @@ class gh extends nh {
|
|
|
17976
17976
|
*/
|
|
17977
17977
|
return function(t, e) {
|
|
17978
17978
|
// Sentinels are only supported with writes, and not within arrays.
|
|
17979
|
-
if (!uh(e.
|
|
17980
|
-
if (!e.path) throw e.
|
|
17979
|
+
if (!uh(e.Xa)) throw e.rc(`${t._methodName}() can only be used with update() and set()`);
|
|
17980
|
+
if (!e.path) throw e.rc(`${t._methodName}() is not currently supported inside arrays`);
|
|
17981
17981
|
const n = t._toFieldTransform(e);
|
|
17982
17982
|
n && e.fieldTransforms.push(n);
|
|
17983
17983
|
}
|
|
@@ -18001,12 +18001,12 @@ class gh extends nh {
|
|
|
18001
18001
|
// the set of values to be included for the IN query) that may directly
|
|
18002
18002
|
// contain additional arrays (each representing an individual field
|
|
18003
18003
|
// value), so we disable this validation.
|
|
18004
|
-
if (e.settings.
|
|
18004
|
+
if (e.settings.ec && 4 /* ArrayArgument */ !== e.Xa) throw e.rc("Nested arrays are not supported");
|
|
18005
18005
|
return function(t, e) {
|
|
18006
18006
|
const n = [];
|
|
18007
18007
|
let s = 0;
|
|
18008
18008
|
for (const i of t) {
|
|
18009
|
-
let t = Th(i, e.
|
|
18009
|
+
let t = Th(i, e.ic(s));
|
|
18010
18010
|
null == t && (
|
|
18011
18011
|
// Just include nulls in the array for fields being replaced with a
|
|
18012
18012
|
// sentinel.
|
|
@@ -18056,14 +18056,14 @@ class gh extends nh {
|
|
|
18056
18056
|
if (t instanceof eh) return {
|
|
18057
18057
|
bytesValue: Cs(e.wt, t._byteString)
|
|
18058
18058
|
};
|
|
18059
|
-
if (t instanceof
|
|
18059
|
+
if (t instanceof bc) {
|
|
18060
18060
|
const n = e.databaseId, s = t.firestore._databaseId;
|
|
18061
|
-
if (!s.isEqual(n)) throw e.
|
|
18061
|
+
if (!s.isEqual(n)) throw e.rc(`Document reference is for database ${s.projectId}/${s.database} but should be for database ${n.projectId}/${n.database}`);
|
|
18062
18062
|
return {
|
|
18063
18063
|
referenceValue: ks(t.firestore._databaseId || e.databaseId, t._key.path)
|
|
18064
18064
|
};
|
|
18065
18065
|
}
|
|
18066
|
-
throw e.
|
|
18066
|
+
throw e.rc(`Unsupported field value: ${pc(t)}`);
|
|
18067
18067
|
}
|
|
18068
18068
|
/**
|
|
18069
18069
|
* Checks whether an object looks like a JSON object that should be converted
|
|
@@ -18080,7 +18080,7 @@ function Eh(t, e) {
|
|
|
18080
18080
|
// If we encounter an empty object, we explicitly add it to the update
|
|
18081
18081
|
// mask to ensure that the server creates a map entry.
|
|
18082
18082
|
e.path && e.path.length > 0 && e.fieldMask.push(e.path) : Lt(t, ((t, s) => {
|
|
18083
|
-
const i = Th(s, e.
|
|
18083
|
+
const i = Th(s, e.tc(t));
|
|
18084
18084
|
null != i && (n[t] = i);
|
|
18085
18085
|
})), {
|
|
18086
18086
|
mapValue: {
|
|
@@ -18090,15 +18090,15 @@ function Eh(t, e) {
|
|
|
18090
18090
|
}
|
|
18091
18091
|
|
|
18092
18092
|
function Ah(t) {
|
|
18093
|
-
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof ut || t instanceof sh || t instanceof eh || t instanceof
|
|
18093
|
+
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof ut || t instanceof sh || t instanceof eh || t instanceof bc || t instanceof nh);
|
|
18094
18094
|
}
|
|
18095
18095
|
|
|
18096
18096
|
function Rh(t, e, n) {
|
|
18097
18097
|
if (!Ah(n) || !function(t) {
|
|
18098
18098
|
return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
|
|
18099
18099
|
}(n)) {
|
|
18100
|
-
const s =
|
|
18101
|
-
throw "an object" === s ? e.
|
|
18100
|
+
const s = pc(n);
|
|
18101
|
+
throw "an object" === s ? e.rc(t + " a custom object") : e.rc(t + " " + s);
|
|
18102
18102
|
}
|
|
18103
18103
|
}
|
|
18104
18104
|
|
|
@@ -18108,7 +18108,7 @@ function Rh(t, e, n) {
|
|
|
18108
18108
|
if ((
|
|
18109
18109
|
// If required, replace the FieldPath Compat class with with the firestore-exp
|
|
18110
18110
|
// FieldPath.
|
|
18111
|
-
e = getModularInstance(e)) instanceof
|
|
18111
|
+
e = getModularInstance(e)) instanceof Zc) return e._internalPath;
|
|
18112
18112
|
if ("string" == typeof e) return vh(t, e);
|
|
18113
18113
|
throw Vh("Field path arguments must be of type string or ", t,
|
|
18114
18114
|
/* hasConverter= */ !1,
|
|
@@ -18132,7 +18132,7 @@ function Rh(t, e, n) {
|
|
|
18132
18132
|
/* hasConverter= */ !1,
|
|
18133
18133
|
/* path= */ void 0, n);
|
|
18134
18134
|
try {
|
|
18135
|
-
return new
|
|
18135
|
+
return new Zc(...e.split("."))._internalPath;
|
|
18136
18136
|
} catch (s) {
|
|
18137
18137
|
throw Vh(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t,
|
|
18138
18138
|
/* hasConverter= */ !1,
|
|
@@ -18144,9 +18144,9 @@ function Vh(t, e, n, s, i) {
|
|
|
18144
18144
|
const r = s && !s.isEmpty(), o = void 0 !== i;
|
|
18145
18145
|
let u = `Function ${e}() called with invalid data`;
|
|
18146
18146
|
n && (u += " (via `toFirestore()`)"), u += ". ";
|
|
18147
|
-
let
|
|
18148
|
-
return (r || o) && (
|
|
18149
|
-
|
|
18147
|
+
let a = "";
|
|
18148
|
+
return (r || o) && (a += " (found", r && (a += ` in field ${s}`), o && (a += ` in document ${i}`),
|
|
18149
|
+
a += ")"), new Q(G.INVALID_ARGUMENT, u + t + a);
|
|
18150
18150
|
}
|
|
18151
18151
|
|
|
18152
18152
|
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function Sh(t, e) {
|
|
@@ -18193,7 +18193,7 @@ function Vh(t, e, n, s, i) {
|
|
|
18193
18193
|
/**
|
|
18194
18194
|
* The `DocumentReference` for the document included in the `DocumentSnapshot`.
|
|
18195
18195
|
*/ get ref() {
|
|
18196
|
-
return new
|
|
18196
|
+
return new bc(this._firestore, this._converter, this._key);
|
|
18197
18197
|
}
|
|
18198
18198
|
/**
|
|
18199
18199
|
* Signals whether or not the document at the snapshot's location exists.
|
|
@@ -18264,7 +18264,7 @@ function Vh(t, e, n, s, i) {
|
|
|
18264
18264
|
/**
|
|
18265
18265
|
* Helper that calls `fromDotSeparatedString()` but wraps any error thrown.
|
|
18266
18266
|
*/ function xh(t, e) {
|
|
18267
|
-
return "string" == typeof e ? vh(t, e) : e instanceof
|
|
18267
|
+
return "string" == typeof e ? vh(t, e) : e instanceof Zc ? e._internalPath : e._delegate._internalPath;
|
|
18268
18268
|
}
|
|
18269
18269
|
|
|
18270
18270
|
/**
|
|
@@ -18500,7 +18500,7 @@ function Fh(t) {
|
|
|
18500
18500
|
* @param right - A snapshot to compare.
|
|
18501
18501
|
* @returns true if the snapshots are equal.
|
|
18502
18502
|
*/ function $h(t, e) {
|
|
18503
|
-
return t instanceof kh && e instanceof kh ? t._firestore === e._firestore && t._key.isEqual(e._key) && (null === t._document ? null === e._document : t._document.isEqual(e._document)) && t._converter === e._converter : t instanceof Mh && e instanceof Mh && (t._firestore === e._firestore &&
|
|
18503
|
+
return t instanceof kh && e instanceof kh ? t._firestore === e._firestore && t._key.isEqual(e._key) && (null === t._document ? null === e._document : t._document.isEqual(e._document)) && t._converter === e._converter : t instanceof Mh && e instanceof Mh && (t._firestore === e._firestore && xc(t.query, e.query) && t.metadata.isEqual(e.metadata) && t._snapshot.isEqual(e._snapshot));
|
|
18504
18504
|
}
|
|
18505
18505
|
|
|
18506
18506
|
/**
|
|
@@ -18546,7 +18546,7 @@ function Fh(t) {
|
|
|
18546
18546
|
|
|
18547
18547
|
class qh extends Lh {
|
|
18548
18548
|
constructor(t, e, n) {
|
|
18549
|
-
super(), this.
|
|
18549
|
+
super(), this.lc = t, this.fc = e, this.dc = n, this.type = "where";
|
|
18550
18550
|
}
|
|
18551
18551
|
_apply(t) {
|
|
18552
18552
|
const e = hh(t.firestore), n = function(t, e, n, s, i, r, o) {
|
|
@@ -18566,10 +18566,10 @@ class qh extends Lh {
|
|
|
18566
18566
|
} else "in" /* IN */ !== r && "not-in" /* NOT_IN */ !== r && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== r || sl(o, r),
|
|
18567
18567
|
u = Ih(n, e, o,
|
|
18568
18568
|
/* allowArrays= */ "in" /* IN */ === r || "not-in" /* NOT_IN */ === r);
|
|
18569
|
-
const
|
|
18569
|
+
const a = qe.create(i, r, u);
|
|
18570
18570
|
return function(t, e) {
|
|
18571
18571
|
if (e.ht()) {
|
|
18572
|
-
const n =
|
|
18572
|
+
const n = an(t);
|
|
18573
18573
|
if (null !== n && !n.isEqual(e.field)) throw new Q(G.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()}'`);
|
|
18574
18574
|
const s = un(t);
|
|
18575
18575
|
null !== s && il(t, e.field, s);
|
|
@@ -18614,9 +18614,9 @@ class qh extends Lh {
|
|
|
18614
18614
|
if (null !== n)
|
|
18615
18615
|
// Special case when it's a duplicate op to give a slightly clearer error message.
|
|
18616
18616
|
throw n === e.op ? new Q(G.INVALID_ARGUMENT, `Invalid query. You cannot use more than one '${e.op.toString()}' filter.`) : new Q(G.INVALID_ARGUMENT, `Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`);
|
|
18617
|
-
}(t,
|
|
18618
|
-
}(t._query, "where", e, t.firestore._databaseId, this.
|
|
18619
|
-
return new
|
|
18617
|
+
}(t, a), a;
|
|
18618
|
+
}(t._query, "where", e, t.firestore._databaseId, this.lc, this.fc, this.dc);
|
|
18619
|
+
return new Pc(t.firestore, t.converter, function(t, e) {
|
|
18620
18620
|
const n = t.filters.concat([ e ]);
|
|
18621
18621
|
return new nn(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
|
|
18622
18622
|
}(t._query, n));
|
|
@@ -18640,7 +18640,7 @@ class qh extends Lh {
|
|
|
18640
18640
|
|
|
18641
18641
|
class Gh extends Lh {
|
|
18642
18642
|
constructor(t, e) {
|
|
18643
|
-
super(), this.
|
|
18643
|
+
super(), this.lc = t, this._c = e, this.type = "orderBy";
|
|
18644
18644
|
}
|
|
18645
18645
|
_apply(t) {
|
|
18646
18646
|
const e = function(t, e, n) {
|
|
@@ -18650,7 +18650,7 @@ class Gh extends Lh {
|
|
|
18650
18650
|
return function(t, e) {
|
|
18651
18651
|
if (null === un(t)) {
|
|
18652
18652
|
// This is the first order by. It must match any inequality.
|
|
18653
|
-
const n =
|
|
18653
|
+
const n = an(t);
|
|
18654
18654
|
null !== n && il(t, n, e.field);
|
|
18655
18655
|
}
|
|
18656
18656
|
}(t, s), s;
|
|
@@ -18665,8 +18665,8 @@ class Gh extends Lh {
|
|
|
18665
18665
|
* Will throw if the document does not contain all fields of the order by
|
|
18666
18666
|
* of the query or if any of the fields in the order by are an uncommitted
|
|
18667
18667
|
* server timestamp.
|
|
18668
|
-
*/ (t._query, this.
|
|
18669
|
-
return new
|
|
18668
|
+
*/ (t._query, this.lc, this._c);
|
|
18669
|
+
return new Pc(t.firestore, t.converter, function(t, e) {
|
|
18670
18670
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
18671
18671
|
const n = t.explicitOrderBy.concat([ e ]);
|
|
18672
18672
|
return new nn(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
|
|
@@ -18689,10 +18689,10 @@ class Gh extends Lh {
|
|
|
18689
18689
|
|
|
18690
18690
|
class jh extends Lh {
|
|
18691
18691
|
constructor(t, e, n) {
|
|
18692
|
-
super(), this.type = t, this.
|
|
18692
|
+
super(), this.type = t, this.wc = e, this.mc = n;
|
|
18693
18693
|
}
|
|
18694
18694
|
_apply(t) {
|
|
18695
|
-
return new
|
|
18695
|
+
return new Pc(t.firestore, t.converter, fn(t._query, this.wc, this.mc));
|
|
18696
18696
|
}
|
|
18697
18697
|
}
|
|
18698
18698
|
|
|
@@ -18702,7 +18702,7 @@ class jh extends Lh {
|
|
|
18702
18702
|
* @param limit - The maximum number of items to return.
|
|
18703
18703
|
* @returns The created {@link Query}.
|
|
18704
18704
|
*/ function Wh(t) {
|
|
18705
|
-
return
|
|
18705
|
+
return Tc("limit", t), new jh("limit", t, "F" /* First */);
|
|
18706
18706
|
}
|
|
18707
18707
|
|
|
18708
18708
|
/**
|
|
@@ -18714,16 +18714,16 @@ class jh extends Lh {
|
|
|
18714
18714
|
* @param limit - The maximum number of items to return.
|
|
18715
18715
|
* @returns The created {@link Query}.
|
|
18716
18716
|
*/ function zh(t) {
|
|
18717
|
-
return
|
|
18717
|
+
return Tc("limitToLast", t), new jh("limitToLast", t, "L" /* Last */);
|
|
18718
18718
|
}
|
|
18719
18719
|
|
|
18720
18720
|
class Hh extends Lh {
|
|
18721
18721
|
constructor(t, e, n) {
|
|
18722
|
-
super(), this.type = t, this.
|
|
18722
|
+
super(), this.type = t, this.gc = e, this.yc = n;
|
|
18723
18723
|
}
|
|
18724
18724
|
_apply(t) {
|
|
18725
|
-
const e = el(t, this.type, this.
|
|
18726
|
-
return new
|
|
18725
|
+
const e = el(t, this.type, this.gc, this.yc);
|
|
18726
|
+
return new Pc(t.firestore, t.converter, function(t, e) {
|
|
18727
18727
|
return new nn(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
|
|
18728
18728
|
}(t._query, e));
|
|
18729
18729
|
}
|
|
@@ -18741,11 +18741,11 @@ function Yh(...t) {
|
|
|
18741
18741
|
|
|
18742
18742
|
class Xh extends Lh {
|
|
18743
18743
|
constructor(t, e, n) {
|
|
18744
|
-
super(), this.type = t, this.
|
|
18744
|
+
super(), this.type = t, this.gc = e, this.yc = n;
|
|
18745
18745
|
}
|
|
18746
18746
|
_apply(t) {
|
|
18747
|
-
const e = el(t, this.type, this.
|
|
18748
|
-
return new
|
|
18747
|
+
const e = el(t, this.type, this.gc, this.yc);
|
|
18748
|
+
return new Pc(t.firestore, t.converter, function(t, e) {
|
|
18749
18749
|
return new nn(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
|
|
18750
18750
|
}(t._query, e));
|
|
18751
18751
|
}
|
|
@@ -18793,16 +18793,16 @@ function tl(...t) {
|
|
|
18793
18793
|
if (i.length > o.length) throw new Q(G.INVALID_ARGUMENT, `Too many arguments provided to ${s}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);
|
|
18794
18794
|
const u = [];
|
|
18795
18795
|
for (let r = 0; r < i.length; r++) {
|
|
18796
|
-
const
|
|
18796
|
+
const a = i[r];
|
|
18797
18797
|
if (o[r].field.isKeyField()) {
|
|
18798
|
-
if ("string" != typeof
|
|
18799
|
-
if (!
|
|
18800
|
-
const n = t.path.child(ht.fromString(
|
|
18798
|
+
if ("string" != typeof a) throw new Q(G.INVALID_ARGUMENT, `Invalid query. Expected a string for document ID in ${s}(), but got a ${typeof a}`);
|
|
18799
|
+
if (!cn(t) && -1 !== a.indexOf("/")) throw new Q(G.INVALID_ARGUMENT, `Invalid query. When querying a collection and ordering by documentId(), the value passed to ${s}() must be a plain document ID, but '${a}' contains a slash.`);
|
|
18800
|
+
const n = t.path.child(ht.fromString(a));
|
|
18801
18801
|
if (!dt.isDocumentKey(n)) throw new Q(G.INVALID_ARGUMENT, `Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${s}() must result in a valid document path, but '${n}' is not because it contains an odd number of segments.`);
|
|
18802
18802
|
const i = new dt(n);
|
|
18803
18803
|
u.push(ye(e, i));
|
|
18804
18804
|
} else {
|
|
18805
|
-
const t = Ih(n, s,
|
|
18805
|
+
const t = Ih(n, s, a);
|
|
18806
18806
|
u.push(t);
|
|
18807
18807
|
}
|
|
18808
18808
|
}
|
|
@@ -18819,13 +18819,13 @@ function tl(...t) {
|
|
|
18819
18819
|
function nl(t, e, n) {
|
|
18820
18820
|
if ("string" == typeof (n = getModularInstance(n))) {
|
|
18821
18821
|
if ("" === n) throw new Q(G.INVALID_ARGUMENT, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
|
|
18822
|
-
if (!
|
|
18822
|
+
if (!cn(e) && -1 !== n.indexOf("/")) throw new Q(G.INVALID_ARGUMENT, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);
|
|
18823
18823
|
const s = e.path.child(ht.fromString(n));
|
|
18824
18824
|
if (!dt.isDocumentKey(s)) throw new Q(G.INVALID_ARGUMENT, `Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${s}' is not because it has an odd number of segments (${s.length}).`);
|
|
18825
18825
|
return ye(t, new dt(s));
|
|
18826
18826
|
}
|
|
18827
|
-
if (n instanceof
|
|
18828
|
-
throw new Q(G.INVALID_ARGUMENT, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${
|
|
18827
|
+
if (n instanceof bc) return ye(t, n._key);
|
|
18828
|
+
throw new Q(G.INVALID_ARGUMENT, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${pc(n)}.`);
|
|
18829
18829
|
}
|
|
18830
18830
|
|
|
18831
18831
|
/**
|
|
@@ -18994,7 +18994,7 @@ class ol {
|
|
|
18994
18994
|
s;
|
|
18995
18995
|
}
|
|
18996
18996
|
|
|
18997
|
-
class
|
|
18997
|
+
class al extends ol {
|
|
18998
18998
|
constructor(t) {
|
|
18999
18999
|
super(), this.firestore = t;
|
|
19000
19000
|
}
|
|
@@ -19003,7 +19003,7 @@ class cl extends ol {
|
|
|
19003
19003
|
}
|
|
19004
19004
|
convertReference(t) {
|
|
19005
19005
|
const e = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
19006
|
-
return new
|
|
19006
|
+
return new bc(this.firestore, /* converter= */ null, e);
|
|
19007
19007
|
}
|
|
19008
19008
|
}
|
|
19009
19009
|
|
|
@@ -19030,7 +19030,7 @@ class cl extends ol {
|
|
|
19030
19030
|
* provides methods for adding writes to the write batch. None of the writes
|
|
19031
19031
|
* will be committed (or visible locally) until {@link WriteBatch.commit} is
|
|
19032
19032
|
* called.
|
|
19033
|
-
*/ class
|
|
19033
|
+
*/ class cl {
|
|
19034
19034
|
/** @hideconstructor */
|
|
19035
19035
|
constructor(t, e) {
|
|
19036
19036
|
this._firestore = t, this._commitHandler = e, this._mutations = [], this._committed = !1,
|
|
@@ -19047,7 +19047,7 @@ class cl extends ol {
|
|
|
19047
19047
|
// For Compat types, we have to "extract" the underlying types before
|
|
19048
19048
|
// performing validation.
|
|
19049
19049
|
let r;
|
|
19050
|
-
return r = "string" == typeof (e = getModularInstance(e)) || e instanceof
|
|
19050
|
+
return r = "string" == typeof (e = getModularInstance(e)) || e instanceof Zc ? ph(this._dataReader, "WriteBatch.update", i._key, e, n, s) : yh(this._dataReader, "WriteBatch.update", i._key, e),
|
|
19051
19051
|
this._mutations.push(r.toMutation(i._key, $n.exists(!0))), this;
|
|
19052
19052
|
}
|
|
19053
19053
|
/**
|
|
@@ -19138,9 +19138,9 @@ function hl(t, e) {
|
|
|
19138
19138
|
* current document contents.
|
|
19139
19139
|
*/
|
|
19140
19140
|
function ll(t) {
|
|
19141
|
-
t =
|
|
19142
|
-
const e =
|
|
19143
|
-
return
|
|
19141
|
+
t = Ic(t, bc);
|
|
19142
|
+
const e = Ic(t.firestore, Fc);
|
|
19143
|
+
return uc(Lc(e), t._key).then((n => bl(e, t, n)));
|
|
19144
19144
|
}
|
|
19145
19145
|
|
|
19146
19146
|
class fl extends ol {
|
|
@@ -19152,7 +19152,7 @@ class fl extends ol {
|
|
|
19152
19152
|
}
|
|
19153
19153
|
convertReference(t) {
|
|
19154
19154
|
const e = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
19155
|
-
return new
|
|
19155
|
+
return new bc(this.firestore, /* converter= */ null, e);
|
|
19156
19156
|
}
|
|
19157
19157
|
}
|
|
19158
19158
|
|
|
@@ -19163,9 +19163,9 @@ class fl extends ol {
|
|
|
19163
19163
|
* @returns A `Promise` resolved with a `DocumentSnapshot` containing the
|
|
19164
19164
|
* current document contents.
|
|
19165
19165
|
*/ function dl(t) {
|
|
19166
|
-
t =
|
|
19167
|
-
const e =
|
|
19168
|
-
return
|
|
19166
|
+
t = Ic(t, bc);
|
|
19167
|
+
const e = Ic(t.firestore, Fc), n = Lc(e), s = new fl(e);
|
|
19168
|
+
return oc(n, t._key).then((n => new kh(e, s, t._key, n, new Nh(null !== n && n.hasLocalMutations,
|
|
19169
19169
|
/* fromCache= */ !0), t.converter)));
|
|
19170
19170
|
}
|
|
19171
19171
|
|
|
@@ -19176,9 +19176,9 @@ class fl extends ol {
|
|
|
19176
19176
|
* @returns A `Promise` resolved with a `DocumentSnapshot` containing the
|
|
19177
19177
|
* current document contents.
|
|
19178
19178
|
*/ function _l(t) {
|
|
19179
|
-
t =
|
|
19180
|
-
const e =
|
|
19181
|
-
return
|
|
19179
|
+
t = Ic(t, bc);
|
|
19180
|
+
const e = Ic(t.firestore, Fc);
|
|
19181
|
+
return uc(Lc(e), t._key, {
|
|
19182
19182
|
source: "server"
|
|
19183
19183
|
}).then((n => bl(e, t, n)));
|
|
19184
19184
|
}
|
|
@@ -19193,9 +19193,9 @@ class fl extends ol {
|
|
|
19193
19193
|
*
|
|
19194
19194
|
* @returns A `Promise` that will be resolved with the results of the query.
|
|
19195
19195
|
*/ function wl(t) {
|
|
19196
|
-
t =
|
|
19197
|
-
const e =
|
|
19198
|
-
return Bh(t._query),
|
|
19196
|
+
t = Ic(t, Pc);
|
|
19197
|
+
const e = Ic(t.firestore, Fc), n = Lc(e), s = new fl(e);
|
|
19198
|
+
return Bh(t._query), cc(n, t._query).then((n => new Mh(e, s, t, n)));
|
|
19199
19199
|
}
|
|
19200
19200
|
|
|
19201
19201
|
/**
|
|
@@ -19204,9 +19204,9 @@ class fl extends ol {
|
|
|
19204
19204
|
*
|
|
19205
19205
|
* @returns A `Promise` that will be resolved with the results of the query.
|
|
19206
19206
|
*/ function ml(t) {
|
|
19207
|
-
t =
|
|
19208
|
-
const e =
|
|
19209
|
-
return
|
|
19207
|
+
t = Ic(t, Pc);
|
|
19208
|
+
const e = Ic(t.firestore, Fc), n = Lc(e), s = new fl(e);
|
|
19209
|
+
return ac(n, t._query).then((n => new Mh(e, s, t, n)));
|
|
19210
19210
|
}
|
|
19211
19211
|
|
|
19212
19212
|
/**
|
|
@@ -19215,27 +19215,27 @@ class fl extends ol {
|
|
|
19215
19215
|
*
|
|
19216
19216
|
* @returns A `Promise` that will be resolved with the results of the query.
|
|
19217
19217
|
*/ function gl(t) {
|
|
19218
|
-
t =
|
|
19219
|
-
const e =
|
|
19220
|
-
return
|
|
19218
|
+
t = Ic(t, Pc);
|
|
19219
|
+
const e = Ic(t.firestore, Fc), n = Lc(e), s = new fl(e);
|
|
19220
|
+
return cc(n, t._query, {
|
|
19221
19221
|
source: "server"
|
|
19222
19222
|
}).then((n => new Mh(e, s, t, n)));
|
|
19223
19223
|
}
|
|
19224
19224
|
|
|
19225
19225
|
function yl(t, e, n) {
|
|
19226
|
-
t =
|
|
19227
|
-
const s =
|
|
19226
|
+
t = Ic(t, bc);
|
|
19227
|
+
const s = Ic(t.firestore, Fc), i = ul(t.converter, e, n);
|
|
19228
19228
|
return Rl(s, [ lh(hh(s), "setDoc", t._key, i, null !== t.converter, n).toMutation(t._key, $n.none()) ]);
|
|
19229
19229
|
}
|
|
19230
19230
|
|
|
19231
19231
|
function pl(t, e, n, ...s) {
|
|
19232
|
-
t =
|
|
19233
|
-
const i =
|
|
19232
|
+
t = Ic(t, bc);
|
|
19233
|
+
const i = Ic(t.firestore, Fc), r = hh(i);
|
|
19234
19234
|
let o;
|
|
19235
19235
|
o = "string" == typeof (
|
|
19236
19236
|
// For Compat types, we have to "extract" the underlying types before
|
|
19237
19237
|
// performing validation.
|
|
19238
|
-
e = getModularInstance(e)) || e instanceof
|
|
19238
|
+
e = getModularInstance(e)) || e instanceof Zc ? ph(r, "updateDoc", t._key, e, n, s) : yh(r, "updateDoc", t._key, e);
|
|
19239
19239
|
return Rl(i, [ o.toMutation(t._key, $n.exists(!0)) ]);
|
|
19240
19240
|
}
|
|
19241
19241
|
|
|
@@ -19246,7 +19246,7 @@ function pl(t, e, n, ...s) {
|
|
|
19246
19246
|
* @returns A Promise resolved once the document has been successfully
|
|
19247
19247
|
* deleted from the backend (note that it won't resolve while you're offline).
|
|
19248
19248
|
*/ function Il(t) {
|
|
19249
|
-
return Rl(
|
|
19249
|
+
return Rl(Ic(t.firestore, Fc), [ new Yn(t._key, $n.none()) ]);
|
|
19250
19250
|
}
|
|
19251
19251
|
|
|
19252
19252
|
/**
|
|
@@ -19259,7 +19259,7 @@ function pl(t, e, n, ...s) {
|
|
|
19259
19259
|
* newly created document after it has been written to the backend (Note that it
|
|
19260
19260
|
* won't resolve while you're offline).
|
|
19261
19261
|
*/ function Tl(t, e) {
|
|
19262
|
-
const n =
|
|
19262
|
+
const n = Ic(t.firestore, Fc), s = Dc(t), i = ul(t.converter, e);
|
|
19263
19263
|
return Rl(n, [ lh(hh(t.firestore), "addDoc", s._key, i, null !== t.converter, {}).toMutation(s._key, $n.exists(!1)) ]).then((() => s));
|
|
19264
19264
|
}
|
|
19265
19265
|
|
|
@@ -19269,44 +19269,44 @@ function El(t, ...e) {
|
|
|
19269
19269
|
let r = {
|
|
19270
19270
|
includeMetadataChanges: !1
|
|
19271
19271
|
}, o = 0;
|
|
19272
|
-
"object" != typeof e[o] ||
|
|
19272
|
+
"object" != typeof e[o] || kc(e[o]) || (r = e[o], o++);
|
|
19273
19273
|
const u = {
|
|
19274
19274
|
includeMetadataChanges: r.includeMetadataChanges
|
|
19275
19275
|
};
|
|
19276
|
-
if (
|
|
19276
|
+
if (kc(e[o])) {
|
|
19277
19277
|
const t = e[o];
|
|
19278
19278
|
e[o] = null === (n = t.next) || void 0 === n ? void 0 : n.bind(t), e[o + 1] = null === (s = t.error) || void 0 === s ? void 0 : s.bind(t),
|
|
19279
19279
|
e[o + 2] = null === (i = t.complete) || void 0 === i ? void 0 : i.bind(t);
|
|
19280
19280
|
}
|
|
19281
|
-
let
|
|
19282
|
-
if (t instanceof
|
|
19281
|
+
let a, c, h;
|
|
19282
|
+
if (t instanceof bc) c = Ic(t.firestore, Fc), h = rn(t._key.path), a = {
|
|
19283
19283
|
next: n => {
|
|
19284
|
-
e[o] && e[o](bl(
|
|
19284
|
+
e[o] && e[o](bl(c, t, n));
|
|
19285
19285
|
},
|
|
19286
19286
|
error: e[o + 1],
|
|
19287
19287
|
complete: e[o + 2]
|
|
19288
19288
|
}; else {
|
|
19289
|
-
const n =
|
|
19290
|
-
|
|
19291
|
-
const s = new fl(
|
|
19292
|
-
|
|
19289
|
+
const n = Ic(t, Pc);
|
|
19290
|
+
c = Ic(n.firestore, Fc), h = n._query;
|
|
19291
|
+
const s = new fl(c);
|
|
19292
|
+
a = {
|
|
19293
19293
|
next: t => {
|
|
19294
|
-
e[o] && e[o](new Mh(
|
|
19294
|
+
e[o] && e[o](new Mh(c, s, n, t));
|
|
19295
19295
|
},
|
|
19296
19296
|
error: e[o + 1],
|
|
19297
19297
|
complete: e[o + 2]
|
|
19298
19298
|
}, Bh(t._query);
|
|
19299
19299
|
}
|
|
19300
19300
|
return function(t, e, n, s) {
|
|
19301
|
-
const i = new
|
|
19302
|
-
return t.asyncQueue.enqueueAndForget((async () => Qu(await
|
|
19303
|
-
i.
|
|
19301
|
+
const i = new Ga(s), r = new Ju(e, i, n);
|
|
19302
|
+
return t.asyncQueue.enqueueAndForget((async () => Qu(await sc(t), r))), () => {
|
|
19303
|
+
i.Ia(), t.asyncQueue.enqueueAndForget((async () => ju(await sc(t), r)));
|
|
19304
19304
|
};
|
|
19305
|
-
}(
|
|
19305
|
+
}(Lc(c), h, u, a);
|
|
19306
19306
|
}
|
|
19307
19307
|
|
|
19308
19308
|
function Al(t, e) {
|
|
19309
|
-
return
|
|
19309
|
+
return hc(Lc(t = Ic(t, Fc)), kc(e) ? e : {
|
|
19310
19310
|
next: e
|
|
19311
19311
|
});
|
|
19312
19312
|
}
|
|
@@ -19317,8 +19317,8 @@ function Al(t, e) {
|
|
|
19317
19317
|
*/ function Rl(t, e) {
|
|
19318
19318
|
return function(t, e) {
|
|
19319
19319
|
const n = new j;
|
|
19320
|
-
return t.asyncQueue.enqueueAndForget((async () =>
|
|
19321
|
-
}(
|
|
19320
|
+
return t.asyncQueue.enqueueAndForget((async () => ha(await nc(t), e, n))), n.promise;
|
|
19321
|
+
}(Lc(t), e);
|
|
19322
19322
|
}
|
|
19323
19323
|
|
|
19324
19324
|
/**
|
|
@@ -19362,7 +19362,7 @@ function Al(t, e) {
|
|
|
19362
19362
|
* @param documentRef - A reference to the document to be read.
|
|
19363
19363
|
* @returns A `DocumentSnapshot` with the read data.
|
|
19364
19364
|
*/ get(t) {
|
|
19365
|
-
const e = hl(t, this._firestore), n = new
|
|
19365
|
+
const e = hl(t, this._firestore), n = new al(this._firestore);
|
|
19366
19366
|
return this._transaction.lookup([ e._key ]).then((t => {
|
|
19367
19367
|
if (!t || 1 !== t.length) return L();
|
|
19368
19368
|
const s = t[0];
|
|
@@ -19380,7 +19380,7 @@ function Al(t, e) {
|
|
|
19380
19380
|
// For Compat types, we have to "extract" the underlying types before
|
|
19381
19381
|
// performing validation.
|
|
19382
19382
|
let r;
|
|
19383
|
-
return r = "string" == typeof (e = getModularInstance(e)) || e instanceof
|
|
19383
|
+
return r = "string" == typeof (e = getModularInstance(e)) || e instanceof Zc ? ph(this._dataReader, "Transaction.update", i._key, e, n, s) : yh(this._dataReader, "Transaction.update", i._key, e),
|
|
19384
19384
|
this._transaction.update(i._key, r), this;
|
|
19385
19385
|
}
|
|
19386
19386
|
/**
|
|
@@ -19431,12 +19431,12 @@ function Al(t, e) {
|
|
|
19431
19431
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
19432
19432
|
* rejected promise with the corresponding failure error is returned.
|
|
19433
19433
|
*/ function vl(t, e, n) {
|
|
19434
|
-
t =
|
|
19434
|
+
t = Ic(t, Fc);
|
|
19435
19435
|
const s = Object.assign(Object.assign({}, rl), n);
|
|
19436
19436
|
!function(t) {
|
|
19437
19437
|
if (t.maxAttempts < 1) throw new Q(G.INVALID_ARGUMENT, "Max attempts must be at least 1");
|
|
19438
19438
|
}(s);
|
|
19439
|
-
return
|
|
19439
|
+
return lc(Lc(t), (n => e(new Pl(t, n))), s);
|
|
19440
19440
|
}
|
|
19441
19441
|
|
|
19442
19442
|
/**
|
|
@@ -19551,7 +19551,7 @@ function Al(t, e) {
|
|
|
19551
19551
|
* @returns A {@link WriteBatch} that can be used to atomically execute multiple
|
|
19552
19552
|
* writes.
|
|
19553
19553
|
*/ function Nl(t) {
|
|
19554
|
-
return
|
|
19554
|
+
return Lc(t = Ic(t, Fc)), new cl(t, (e => Rl(t, e)));
|
|
19555
19555
|
}
|
|
19556
19556
|
|
|
19557
19557
|
/**
|
|
@@ -19570,7 +19570,7 @@ function Al(t, e) {
|
|
|
19570
19570
|
* See the License for the specific language governing permissions and
|
|
19571
19571
|
* limitations under the License.
|
|
19572
19572
|
*/ function kl(t, e) {
|
|
19573
|
-
|
|
19573
|
+
Lc(t = Ic(t, Fc));
|
|
19574
19574
|
const n = "string" == typeof e ? function(t) {
|
|
19575
19575
|
var e;
|
|
19576
19576
|
try {
|
|
@@ -19606,14 +19606,14 @@ function Ol(t, e) {
|
|
|
19606
19606
|
!function(t) {
|
|
19607
19607
|
x = t;
|
|
19608
19608
|
}(SDK_VERSION), _registerComponent(new Component("firestore", ((t, {options: n}) => {
|
|
19609
|
-
const s = t.getProvider("app").getImmediate(), i = new
|
|
19609
|
+
const s = t.getProvider("app").getImmediate(), i = new Fc(s, new J(t.getProvider("auth-internal")), new tt(t.getProvider("app-check-internal")));
|
|
19610
19610
|
return n = Object.assign({
|
|
19611
19611
|
useFetchStreams: e
|
|
19612
19612
|
}, n), i._setSettings(n), i;
|
|
19613
|
-
}), "PUBLIC")), registerVersion(D, "3.4.12-canary.
|
|
19613
|
+
}), "PUBLIC")), registerVersion(D, "3.4.12-canary.f36d627af", t),
|
|
19614
19614
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
|
19615
|
-
registerVersion(D, "3.4.12-canary.
|
|
19615
|
+
registerVersion(D, "3.4.12-canary.f36d627af", "esm2017");
|
|
19616
19616
|
}();
|
|
19617
19617
|
|
|
19618
|
-
export { ol as AbstractUserDataWriter, eh as Bytes,
|
|
19618
|
+
export { ol as AbstractUserDataWriter, eh as Bytes, Mc as CACHE_SIZE_UNLIMITED, vc as CollectionReference, bc as DocumentReference, kh as DocumentSnapshot, Zc as FieldPath, nh as FieldValue, Fc as Firestore, Q as FirestoreError, sh as GeoPoint, Oc as LoadBundleTask, Pc as Query, Lh as QueryConstraint, Oh as QueryDocumentSnapshot, Mh as QuerySnapshot, Nh as SnapshotMetadata, ut as Timestamp, Pl as Transaction, cl as WriteBatch, re as _DatabaseId, dt as _DocumentKey, et as _EmptyAppCheckTokenProvider, z as _EmptyAuthCredentialsProvider, ft as _FieldPath, Ic as _cast, q as _debugAssert, Ht as _isBase64Available, $ as _logWarn, kl as _setIndexConfiguration, mc as _validateIsNotUsedTogether, Tl as addDoc, Cl as arrayRemove, Dl as arrayUnion, Qc as clearIndexedDbPersistence, Vc as collection, Sc as collectionGroup, Rc as connectFirestoreEmulator, Il as deleteDoc, Vl as deleteField, zc as disableNetwork, Dc as doc, th as documentId, qc as enableIndexedDbPersistence, Kc as enableMultiTabIndexedDbPersistence, Wc as enableNetwork, tl as endAt, Zh as endBefore, Lc as ensureFirestoreConfigured, Rl as executeWrite, ll as getDoc, dl as getDocFromCache, _l as getDocFromServer, wl as getDocs, ml as getDocsFromCache, gl as getDocsFromServer, Bc as getFirestore, xl as increment, $c as initializeFirestore, Wh as limit, zh as limitToLast, Jc as loadBundle, Yc as namedQuery, El as onSnapshot, Al as onSnapshotsInSync, Qh as orderBy, Uh as query, xc as queryEqual, Cc as refEqual, vl as runTransaction, Sl as serverTimestamp, yl as setDoc, O as setLogLevel, $h as snapshotEqual, Yh as startAfter, Jh as startAt, Hc as terminate, pl as updateDoc, jc as waitForPendingWrites, Kh as where, Nl as writeBatch };
|
|
19619
19619
|
//# sourceMappingURL=index.esm2017.js.map
|