@firebase/firestore 3.4.2-canary.88d43ec00 → 3.4.2-canary.922e9ed9a
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 +701 -701
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +1093 -1093
- 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 +96 -96
- 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 N = "9.6.2-canary.
|
|
69
|
+
let N = "9.6.2-canary.922e9ed9a";
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* @license
|
|
@@ -736,7 +736,7 @@ function rt(t, e) {
|
|
|
736
736
|
/**
|
|
737
737
|
* Returns the immediate lexicographically-following string. This is useful to
|
|
738
738
|
* construct an inclusive range for indexeddb iterators.
|
|
739
|
-
*/ function
|
|
739
|
+
*/ function at(t) {
|
|
740
740
|
// Return the input string, with an additional NUL byte appended.
|
|
741
741
|
return t + "\0";
|
|
742
742
|
}
|
|
@@ -772,7 +772,7 @@ function rt(t, e) {
|
|
|
772
772
|
* For examples and further specifications, refer to the
|
|
773
773
|
* {@link https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto | Timestamp definition}.
|
|
774
774
|
*/
|
|
775
|
-
class
|
|
775
|
+
class ct {
|
|
776
776
|
/**
|
|
777
777
|
* Creates a new timestamp.
|
|
778
778
|
*
|
|
@@ -804,7 +804,7 @@ class at {
|
|
|
804
804
|
*
|
|
805
805
|
* @returns a new timestamp representing the current date.
|
|
806
806
|
*/ static now() {
|
|
807
|
-
return
|
|
807
|
+
return ct.fromMillis(Date.now());
|
|
808
808
|
}
|
|
809
809
|
/**
|
|
810
810
|
* Creates a new timestamp from the given date.
|
|
@@ -813,7 +813,7 @@ class at {
|
|
|
813
813
|
* @returns A new `Timestamp` representing the same point in time as the given
|
|
814
814
|
* date.
|
|
815
815
|
*/ static fromDate(t) {
|
|
816
|
-
return
|
|
816
|
+
return ct.fromMillis(t.getTime());
|
|
817
817
|
}
|
|
818
818
|
/**
|
|
819
819
|
* Creates a new timestamp from the given number of milliseconds.
|
|
@@ -824,7 +824,7 @@ class at {
|
|
|
824
824
|
* number of milliseconds.
|
|
825
825
|
*/ static fromMillis(t) {
|
|
826
826
|
const e = Math.floor(t / 1e3), n = Math.floor(1e6 * (t - 1e3 * e));
|
|
827
|
-
return new
|
|
827
|
+
return new ct(e, n);
|
|
828
828
|
}
|
|
829
829
|
/**
|
|
830
830
|
* Converts a `Timestamp` to a JavaScript `Date` object. This conversion
|
|
@@ -910,7 +910,7 @@ class at {
|
|
|
910
910
|
return new ut(t);
|
|
911
911
|
}
|
|
912
912
|
static min() {
|
|
913
|
-
return new ut(new
|
|
913
|
+
return new ut(new ct(0, 0));
|
|
914
914
|
}
|
|
915
915
|
compareTo(t) {
|
|
916
916
|
return this.timestamp._compareTo(t.timestamp);
|
|
@@ -1420,7 +1420,7 @@ function bt(t) {
|
|
|
1420
1420
|
* Returns the local time at which this timestamp was first set.
|
|
1421
1421
|
*/ function Pt(t) {
|
|
1422
1422
|
const e = Et(t.mapValue.fields.__local_write_time__.timestampValue);
|
|
1423
|
-
return new
|
|
1423
|
+
return new ct(e.seconds, e.nanos);
|
|
1424
1424
|
}
|
|
1425
1425
|
|
|
1426
1426
|
/**
|
|
@@ -2106,7 +2106,7 @@ class te extends class {} {
|
|
|
2106
2106
|
/**
|
|
2107
2107
|
* Creates a filter based on the provided arguments.
|
|
2108
2108
|
*/ static create(t, e, n) {
|
|
2109
|
-
return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.P(t, e, n) : new ne(t, e, n) : "array-contains" /* ARRAY_CONTAINS */ === e ? new oe(t, n) : "in" /* IN */ === e ? new
|
|
2109
|
+
return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.P(t, e, n) : new ne(t, e, n) : "array-contains" /* ARRAY_CONTAINS */ === e ? new oe(t, n) : "in" /* IN */ === e ? new ae(t, n) : "not-in" /* NOT_IN */ === e ? new ce(t, n) : "array-contains-any" /* ARRAY_CONTAINS_ANY */ === e ? new ue(t, n) : new te(t, e, n);
|
|
2110
2110
|
}
|
|
2111
2111
|
static P(t, e, n) {
|
|
2112
2112
|
return "in" /* IN */ === e ? new se(t, n) : new ie(t, n);
|
|
@@ -2196,7 +2196,7 @@ function re(t, e) {
|
|
|
2196
2196
|
}
|
|
2197
2197
|
}
|
|
2198
2198
|
|
|
2199
|
-
/** A Filter that implements the IN operator. */ class
|
|
2199
|
+
/** A Filter that implements the IN operator. */ class ae extends te {
|
|
2200
2200
|
constructor(t, e) {
|
|
2201
2201
|
super(t, "in" /* IN */ , e);
|
|
2202
2202
|
}
|
|
@@ -2206,7 +2206,7 @@ function re(t, e) {
|
|
|
2206
2206
|
}
|
|
2207
2207
|
}
|
|
2208
2208
|
|
|
2209
|
-
/** A Filter that implements the not-in operator. */ class
|
|
2209
|
+
/** A Filter that implements the not-in operator. */ class ce extends te {
|
|
2210
2210
|
constructor(t, e) {
|
|
2211
2211
|
super(t, "not-in" /* NOT_IN */ , e);
|
|
2212
2212
|
}
|
|
@@ -2317,16 +2317,16 @@ function _e(t, e) {
|
|
|
2317
2317
|
* Initializes a Query with a path and optional additional query constraints.
|
|
2318
2318
|
* Path must currently be empty if this is a collection group query.
|
|
2319
2319
|
*/
|
|
2320
|
-
constructor(t, e = null, n = [], s = [], i = null, r = "F" /* First */ , o = null,
|
|
2320
|
+
constructor(t, e = null, n = [], s = [], i = null, r = "F" /* First */ , o = null, a = null) {
|
|
2321
2321
|
this.path = t, this.collectionGroup = e, this.explicitOrderBy = n, this.filters = s,
|
|
2322
|
-
this.limit = i, this.limitType = r, this.startAt = o, this.endAt =
|
|
2322
|
+
this.limit = i, this.limitType = r, this.startAt = o, this.endAt = a, this.S = null,
|
|
2323
2323
|
// The corresponding `Target` of this `Query` instance.
|
|
2324
2324
|
this.D = null, this.startAt, this.endAt;
|
|
2325
2325
|
}
|
|
2326
2326
|
}
|
|
2327
2327
|
|
|
2328
|
-
/** Creates a new Query instance with the options provided. */ function ge(t, e, n, s, i, r, o,
|
|
2329
|
-
return new me(t, e, n, s, i, r, o,
|
|
2328
|
+
/** Creates a new Query instance with the options provided. */ function ge(t, e, n, s, i, r, o, a) {
|
|
2329
|
+
return new me(t, e, n, s, i, r, o, a);
|
|
2330
2330
|
}
|
|
2331
2331
|
|
|
2332
2332
|
/** Creates a new Query for a query that matches all documents at `path` */ function ye(t) {
|
|
@@ -2829,7 +2829,7 @@ class Je {
|
|
|
2829
2829
|
// must have held.
|
|
2830
2830
|
const s = t.value.clone(), i = un(t.fieldTransforms, e, n.transformResults);
|
|
2831
2831
|
s.setAll(i), e.convertToFoundDocument(n.version, s).setHasCommittedMutations();
|
|
2832
|
-
}(t, e, n) : t instanceof
|
|
2832
|
+
}(t, e, n) : t instanceof an ? function(t, e, n) {
|
|
2833
2833
|
if (!Xe(t.precondition, e))
|
|
2834
2834
|
// Since the mutation was not rejected, we know that the precondition
|
|
2835
2835
|
// matched on the backend. We therefore must not have the expected version
|
|
@@ -2837,7 +2837,7 @@ class Je {
|
|
|
2837
2837
|
// known updateTime.
|
|
2838
2838
|
return void e.convertToUnknownDocument(n.version);
|
|
2839
2839
|
const s = un(t.fieldTransforms, e, n.transformResults), i = e.data;
|
|
2840
|
-
i.setAll(
|
|
2840
|
+
i.setAll(cn(t)), i.setAll(s), e.convertToFoundDocument(n.version, i).setHasCommittedMutations();
|
|
2841
2841
|
}(t, e, n) : function(t, e, n) {
|
|
2842
2842
|
// Unlike applyToLocalView, if we're applying a mutation to a remote
|
|
2843
2843
|
// document the server has accepted the mutation so the precondition must
|
|
@@ -2878,10 +2878,10 @@ class Je {
|
|
|
2878
2878
|
* is deleted.
|
|
2879
2879
|
* * When a field is not in the mask but is in the values, the values map is
|
|
2880
2880
|
* ignored.
|
|
2881
|
-
*/ (t, e, n) : t instanceof
|
|
2881
|
+
*/ (t, e, n) : t instanceof an ? function(t, e, n) {
|
|
2882
2882
|
if (!Xe(t.precondition, e)) return;
|
|
2883
2883
|
const s = hn(t.fieldTransforms, n, e), i = e.data;
|
|
2884
|
-
i.setAll(
|
|
2884
|
+
i.setAll(cn(t)), i.setAll(s), e.convertToFoundDocument(rn(e), i).setHasLocalMutations();
|
|
2885
2885
|
}
|
|
2886
2886
|
/**
|
|
2887
2887
|
* Returns a FieldPath/Value map with the content of the PatchMutation.
|
|
@@ -2949,14 +2949,14 @@ function sn(t, e) {
|
|
|
2949
2949
|
}
|
|
2950
2950
|
}
|
|
2951
2951
|
|
|
2952
|
-
class
|
|
2952
|
+
class an extends Ze {
|
|
2953
2953
|
constructor(t, e, n, s, i = []) {
|
|
2954
2954
|
super(), this.key = t, this.data = e, this.fieldMask = n, this.precondition = s,
|
|
2955
2955
|
this.fieldTransforms = i, this.type = 1 /* Patch */;
|
|
2956
2956
|
}
|
|
2957
2957
|
}
|
|
2958
2958
|
|
|
2959
|
-
function
|
|
2959
|
+
function cn(t) {
|
|
2960
2960
|
const e = new Map;
|
|
2961
2961
|
return t.fieldMask.fields.forEach((n => {
|
|
2962
2962
|
if (!n.isEmpty()) {
|
|
@@ -2980,8 +2980,8 @@ function an(t) {
|
|
|
2980
2980
|
const s = new Map;
|
|
2981
2981
|
U(t.length === n.length);
|
|
2982
2982
|
for (let i = 0; i < n.length; i++) {
|
|
2983
|
-
const r = t[i], o = r.transform,
|
|
2984
|
-
s.set(r.field, Fe(o,
|
|
2983
|
+
const r = t[i], o = r.transform, a = e.data.field(r.field);
|
|
2984
|
+
s.set(r.field, Fe(o, a, n[i]));
|
|
2985
2985
|
}
|
|
2986
2986
|
return s;
|
|
2987
2987
|
}
|
|
@@ -3994,8 +3994,8 @@ class Ln {
|
|
|
3994
3994
|
/**
|
|
3995
3995
|
* Processes and adds the DocumentWatchChange to the current set of changes.
|
|
3996
3996
|
*/ ot(t) {
|
|
3997
|
-
for (const e of t.$) t.O && t.O.isFoundDocument() ? this.
|
|
3998
|
-
for (const e of t.removedTargetIds) this.
|
|
3997
|
+
for (const e of t.$) t.O && t.O.isFoundDocument() ? this.at(e, t.O) : this.ct(e, t.key, t.O);
|
|
3998
|
+
for (const e of t.removedTargetIds) this.ct(e, t.key, t.O);
|
|
3999
3999
|
}
|
|
4000
4000
|
/** Processes and adds the WatchTargetChange to the current set of changes. */ ut(t) {
|
|
4001
4001
|
this.forEachTarget(t, (e => {
|
|
@@ -4065,7 +4065,7 @@ class Ln {
|
|
|
4065
4065
|
// until it is resolved, essentially exposing inconsistency between
|
|
4066
4066
|
// queries.
|
|
4067
4067
|
const n = new Dt(t.path);
|
|
4068
|
-
this.
|
|
4068
|
+
this.ct(e, n, Gt.newNoDocument(n, ut.min()));
|
|
4069
4069
|
} else U(1 === n); else {
|
|
4070
4070
|
this._t(e) !== n && (
|
|
4071
4071
|
// Existence filter mismatch: We reset the mapping and raise a new
|
|
@@ -4092,7 +4092,7 @@ class Ln {
|
|
|
4092
4092
|
// instead resulting in an explicit delete message and we could
|
|
4093
4093
|
// remove this special logic.
|
|
4094
4094
|
const e = new Dt(i.target.path);
|
|
4095
|
-
null !== this.st.get(e) || this.yt(s, e) || this.
|
|
4095
|
+
null !== this.st.get(e) || this.yt(s, e) || this.ct(s, e, Gt.newNoDocument(e, t));
|
|
4096
4096
|
}
|
|
4097
4097
|
n.j && (e.set(s, n.G()), n.H());
|
|
4098
4098
|
}
|
|
@@ -4118,7 +4118,7 @@ class Ln {
|
|
|
4118
4118
|
* its document key to the given target's mapping.
|
|
4119
4119
|
*/
|
|
4120
4120
|
// Visible for testing.
|
|
4121
|
-
|
|
4121
|
+
at(t, e) {
|
|
4122
4122
|
if (!this.lt(t)) return;
|
|
4123
4123
|
const n = this.yt(t, e.key) ? 2 /* Modified */ : 0 /* Added */;
|
|
4124
4124
|
this.ht(t).J(e.key, n), this.st = this.st.insert(e.key, e), this.it = this.it.insert(e.key, this.Tt(e.key).add(t));
|
|
@@ -4131,7 +4131,7 @@ class Ln {
|
|
|
4131
4131
|
* to update the remote document cache.
|
|
4132
4132
|
*/
|
|
4133
4133
|
// Visible for testing.
|
|
4134
|
-
|
|
4134
|
+
ct(t, e, n) {
|
|
4135
4135
|
if (!this.lt(t)) return;
|
|
4136
4136
|
const s = this.ht(t);
|
|
4137
4137
|
this.yt(t, e) ? s.J(e, 1 /* Removed */) :
|
|
@@ -4186,7 +4186,7 @@ class Ln {
|
|
|
4186
4186
|
*/ ft(t) {
|
|
4187
4187
|
this.nt.set(t, new Fn);
|
|
4188
4188
|
this.et.getRemoteKeysForTarget(t).forEach((e => {
|
|
4189
|
-
this.
|
|
4189
|
+
this.ct(t, e, /*updatedDocument=*/ null);
|
|
4190
4190
|
}));
|
|
4191
4191
|
}
|
|
4192
4192
|
/**
|
|
@@ -4293,7 +4293,7 @@ function Wn(t, e) {
|
|
|
4293
4293
|
function zn(t) {
|
|
4294
4294
|
return U(!!t), ut.fromTimestamp(function(t) {
|
|
4295
4295
|
const e = Et(t);
|
|
4296
|
-
return new
|
|
4296
|
+
return new ct(e.seconds, e.nanos);
|
|
4297
4297
|
}(t));
|
|
4298
4298
|
}
|
|
4299
4299
|
|
|
@@ -4383,7 +4383,7 @@ function os(t, e) {
|
|
|
4383
4383
|
}(e.targetChange.targetChangeType || "NO_CHANGE"), i = e.targetChange.targetIds || [], r = function(t, e) {
|
|
4384
4384
|
return t.C ? (U(void 0 === e || "string" == typeof e), pt.fromBase64String(e || "")) : (U(void 0 === e || e instanceof Uint8Array),
|
|
4385
4385
|
pt.fromUint8Array(e || new Uint8Array));
|
|
4386
|
-
}(t, e.targetChange.resumeToken), o = e.targetChange.cause,
|
|
4386
|
+
}(t, e.targetChange.resumeToken), o = e.targetChange.cause, a = o && function(t) {
|
|
4387
4387
|
const e = void 0 === t.code ? j.UNKNOWN : gn(t.code);
|
|
4388
4388
|
return new Q(e, t.message || "");
|
|
4389
4389
|
}
|
|
@@ -4395,7 +4395,7 @@ function os(t, e) {
|
|
|
4395
4395
|
* our generated proto interfaces say Int32Value must be. But GRPC actually
|
|
4396
4396
|
* expects a { value: <number> } struct.
|
|
4397
4397
|
*/ (o);
|
|
4398
|
-
n = new Mn(s, i, r,
|
|
4398
|
+
n = new Mn(s, i, r, a || null);
|
|
4399
4399
|
} else if ("documentChange" in e) {
|
|
4400
4400
|
e.documentChange;
|
|
4401
4401
|
const s = e.documentChange;
|
|
@@ -4404,14 +4404,14 @@ function os(t, e) {
|
|
|
4404
4404
|
mapValue: {
|
|
4405
4405
|
fields: s.document.fields
|
|
4406
4406
|
}
|
|
4407
|
-
}),
|
|
4408
|
-
n = new $n(
|
|
4407
|
+
}), a = Gt.newFoundDocument(i, r, o), c = s.targetIds || [], u = s.removedTargetIds || [];
|
|
4408
|
+
n = new $n(c, u, a.key, a);
|
|
4409
4409
|
} else if ("documentDelete" in e) {
|
|
4410
4410
|
e.documentDelete;
|
|
4411
4411
|
const s = e.documentDelete;
|
|
4412
4412
|
s.document;
|
|
4413
|
-
const i = Xn(t, s.document), r = s.readTime ? zn(s.readTime) : ut.min(), o = Gt.newNoDocument(i, r),
|
|
4414
|
-
n = new $n([],
|
|
4413
|
+
const i = Xn(t, s.document), r = s.readTime ? zn(s.readTime) : ut.min(), o = Gt.newNoDocument(i, r), a = s.removedTargetIds || [];
|
|
4414
|
+
n = new $n([], a, o.key, o);
|
|
4415
4415
|
} else if ("documentRemove" in e) {
|
|
4416
4416
|
e.documentRemove;
|
|
4417
4417
|
const s = e.documentRemove;
|
|
@@ -4431,13 +4431,13 @@ function os(t, e) {
|
|
|
4431
4431
|
return n;
|
|
4432
4432
|
}
|
|
4433
4433
|
|
|
4434
|
-
function
|
|
4434
|
+
function as(t, e) {
|
|
4435
4435
|
let n;
|
|
4436
4436
|
if (e instanceof on) n = {
|
|
4437
4437
|
update: ss(t, e.key, e.value)
|
|
4438
4438
|
}; else if (e instanceof ln) n = {
|
|
4439
4439
|
delete: Yn(t, e.key)
|
|
4440
|
-
}; else if (e instanceof
|
|
4440
|
+
}; else if (e instanceof an) n = {
|
|
4441
4441
|
update: ss(t, e.key, e.data),
|
|
4442
4442
|
updateMask: As(e.fieldMask)
|
|
4443
4443
|
}; else {
|
|
@@ -4478,7 +4478,7 @@ function cs(t, e) {
|
|
|
4478
4478
|
}(t, e.precondition)), n;
|
|
4479
4479
|
}
|
|
4480
4480
|
|
|
4481
|
-
function
|
|
4481
|
+
function cs(t, e) {
|
|
4482
4482
|
const n = e.currentDocument ? function(t) {
|
|
4483
4483
|
return void 0 !== t.updateTime ? Ye.updateTime(zn(t.updateTime)) : void 0 !== t.exists ? Ye.exists(t.exists) : Ye.none();
|
|
4484
4484
|
}(e.currentDocument) : Ye.none(), s = e.updateTransforms ? e.updateTransforms.map((e => function(t, e) {
|
|
@@ -4505,7 +4505,7 @@ function as(t, e) {
|
|
|
4505
4505
|
const e = t.fieldPaths || [];
|
|
4506
4506
|
return new gt(e.map((t => mt.fromServerFormat(t))));
|
|
4507
4507
|
}(e.updateMask);
|
|
4508
|
-
return new
|
|
4508
|
+
return new an(i, r, t, n, s);
|
|
4509
4509
|
}
|
|
4510
4510
|
return new on(i, r, n, s);
|
|
4511
4511
|
}
|
|
@@ -4654,15 +4654,15 @@ function fs(t) {
|
|
|
4654
4654
|
// visible for testing
|
|
4655
4655
|
(t.direction));
|
|
4656
4656
|
}(t))));
|
|
4657
|
-
let
|
|
4658
|
-
n.limit && (
|
|
4657
|
+
let a = null;
|
|
4658
|
+
n.limit && (a = function(t) {
|
|
4659
4659
|
let e;
|
|
4660
4660
|
return e = "object" == typeof t ? t.value : t, vt(e) ? null : e;
|
|
4661
4661
|
}(n.limit));
|
|
4662
|
-
let
|
|
4663
|
-
n.startAt && (
|
|
4662
|
+
let c = null;
|
|
4663
|
+
n.startAt && (c = ms(n.startAt));
|
|
4664
4664
|
let u = null;
|
|
4665
|
-
return n.endAt && (u = ms(n.endAt)), ge(e, i, o, r,
|
|
4665
|
+
return n.endAt && (u = ms(n.endAt)), ge(e, i, o, r, a, "F" /* First */ , c, u);
|
|
4666
4666
|
}
|
|
4667
4667
|
|
|
4668
4668
|
function ds(t, e) {
|
|
@@ -6137,7 +6137,7 @@ function ri(t, e) {
|
|
|
6137
6137
|
}
|
|
6138
6138
|
}
|
|
6139
6139
|
|
|
6140
|
-
/** The result of applying a mutation batch to the backend. */ class
|
|
6140
|
+
/** The result of applying a mutation batch to the backend. */ class ai {
|
|
6141
6141
|
constructor(t, e, n,
|
|
6142
6142
|
/**
|
|
6143
6143
|
* A pre-computed mapping from each mutated document to the resulting
|
|
@@ -6155,7 +6155,7 @@ function ri(t, e) {
|
|
|
6155
6155
|
let s = Vn();
|
|
6156
6156
|
const i = t.mutations;
|
|
6157
6157
|
for (let t = 0; t < i.length; t++) s = s.insert(i[t].key, n[t].version);
|
|
6158
|
-
return new
|
|
6158
|
+
return new ai(t, e, n, s);
|
|
6159
6159
|
}
|
|
6160
6160
|
}
|
|
6161
6161
|
|
|
@@ -6177,7 +6177,7 @@ function ri(t, e) {
|
|
|
6177
6177
|
*/
|
|
6178
6178
|
/**
|
|
6179
6179
|
* An immutable set of metadata that the local store tracks for each target.
|
|
6180
|
-
*/ class
|
|
6180
|
+
*/ class ci {
|
|
6181
6181
|
constructor(
|
|
6182
6182
|
/** The target being listened to. */
|
|
6183
6183
|
t,
|
|
@@ -6209,19 +6209,19 @@ function ri(t, e) {
|
|
|
6209
6209
|
this.lastLimboFreeSnapshotVersion = r, this.resumeToken = o;
|
|
6210
6210
|
}
|
|
6211
6211
|
/** Creates a new target data instance with an updated sequence number. */ withSequenceNumber(t) {
|
|
6212
|
-
return new
|
|
6212
|
+
return new ci(this.target, this.targetId, this.purpose, t, this.snapshotVersion, this.lastLimboFreeSnapshotVersion, this.resumeToken);
|
|
6213
6213
|
}
|
|
6214
6214
|
/**
|
|
6215
6215
|
* Creates a new target data instance with an updated resume token and
|
|
6216
6216
|
* snapshot version.
|
|
6217
6217
|
*/ withResumeToken(t, e) {
|
|
6218
|
-
return new
|
|
6218
|
+
return new ci(this.target, this.targetId, this.purpose, this.sequenceNumber, e, this.lastLimboFreeSnapshotVersion, t);
|
|
6219
6219
|
}
|
|
6220
6220
|
/**
|
|
6221
6221
|
* Creates a new target data instance with an updated last limbo free
|
|
6222
6222
|
* snapshot version number.
|
|
6223
6223
|
*/ withLastLimboFreeSnapshotVersion(t) {
|
|
6224
|
-
return new
|
|
6224
|
+
return new ci(this.target, this.targetId, this.purpose, this.sequenceNumber, this.snapshotVersion, t, this.resumeToken);
|
|
6225
6225
|
}
|
|
6226
6226
|
}
|
|
6227
6227
|
|
|
@@ -6296,7 +6296,7 @@ function fi(t) {
|
|
|
6296
6296
|
}
|
|
6297
6297
|
|
|
6298
6298
|
function di(t) {
|
|
6299
|
-
const e = new
|
|
6299
|
+
const e = new ct(t[0], t[1]);
|
|
6300
6300
|
return ut.fromTimestamp(e);
|
|
6301
6301
|
}
|
|
6302
6302
|
|
|
@@ -6306,14 +6306,14 @@ function wi(t) {
|
|
|
6306
6306
|
}
|
|
6307
6307
|
|
|
6308
6308
|
function _i(t) {
|
|
6309
|
-
const e = new
|
|
6309
|
+
const e = new ct(t.seconds, t.nanoseconds);
|
|
6310
6310
|
return ut.fromTimestamp(e);
|
|
6311
6311
|
}
|
|
6312
6312
|
|
|
6313
6313
|
/** Encodes a batch of mutations into a DbMutationBatch for local storage. */
|
|
6314
6314
|
/** Decodes a DbMutationBatch into a MutationBatch */
|
|
6315
6315
|
function mi(t, e) {
|
|
6316
|
-
const n = (e.baseMutations || []).map((e =>
|
|
6316
|
+
const n = (e.baseMutations || []).map((e => cs(t.Gt, e)));
|
|
6317
6317
|
// Squash old transform mutations into existing patch or set mutations.
|
|
6318
6318
|
// The replacement of representing `transforms` with `update_transforms`
|
|
6319
6319
|
// on the SDK means that old `transform` mutations stored in IndexedDB need
|
|
@@ -6327,7 +6327,7 @@ function mi(t, e) {
|
|
|
6327
6327
|
++t;
|
|
6328
6328
|
}
|
|
6329
6329
|
}
|
|
6330
|
-
const s = e.mutations.map((e =>
|
|
6330
|
+
const s = e.mutations.map((e => cs(t.Gt, e))), i = ct.fromMillis(e.localWriteTimeMs);
|
|
6331
6331
|
return new oi(e.batchId, i, n, s);
|
|
6332
6332
|
}
|
|
6333
6333
|
|
|
@@ -6338,7 +6338,7 @@ function mi(t, e) {
|
|
|
6338
6338
|
return void 0 !== t.query.documents ? (U(1 === (i = t.query).documents.length),
|
|
6339
6339
|
s = be(ye(ts(i.documents[0])))) : s = function(t) {
|
|
6340
6340
|
return be(fs(t));
|
|
6341
|
-
}(t.query), new
|
|
6341
|
+
}(t.query), new ci(s, t.targetId, 0 /* Listen */ , t.lastListenSequenceNumber, e, n, pt.fromBase64String(t.resumeToken));
|
|
6342
6342
|
}
|
|
6343
6343
|
|
|
6344
6344
|
/** Encodes TargetData into a DbTarget for storage locally. */ function yi(t, e) {
|
|
@@ -6543,7 +6543,7 @@ class Ti {
|
|
|
6543
6543
|
return zs.resolve();
|
|
6544
6544
|
}
|
|
6545
6545
|
getCollectionParents(t, e) {
|
|
6546
|
-
const n = [], s = IDBKeyRange.bound([ e, "" ], [
|
|
6546
|
+
const n = [], s = IDBKeyRange.bound([ e, "" ], [ at(e), "" ],
|
|
6547
6547
|
/*lowerOpen=*/ !1,
|
|
6548
6548
|
/*upperOpen=*/ !0);
|
|
6549
6549
|
return Pi(t).Bt(s).next((t => {
|
|
@@ -6628,12 +6628,12 @@ class Vi {
|
|
|
6628
6628
|
*/
|
|
6629
6629
|
function Si(t, e, n) {
|
|
6630
6630
|
const s = t.store(Ns.store), i = t.store(ks.store), r = [], o = IDBKeyRange.only(n.batchId);
|
|
6631
|
-
let
|
|
6632
|
-
const
|
|
6631
|
+
let a = 0;
|
|
6632
|
+
const c = s.jt({
|
|
6633
6633
|
range: o
|
|
6634
|
-
}, ((t, e, n) => (
|
|
6635
|
-
r.push(
|
|
6636
|
-
U(1 ===
|
|
6634
|
+
}, ((t, e, n) => (a++, n.delete())));
|
|
6635
|
+
r.push(c.next((() => {
|
|
6636
|
+
U(1 === a);
|
|
6637
6637
|
})));
|
|
6638
6638
|
const u = [];
|
|
6639
6639
|
for (const t of n.mutations) {
|
|
@@ -6733,20 +6733,20 @@ class Ci {
|
|
|
6733
6733
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6734
6734
|
return r.add({}).next((o => {
|
|
6735
6735
|
U("number" == typeof o);
|
|
6736
|
-
const
|
|
6737
|
-
const s = n.baseMutations.map((e =>
|
|
6736
|
+
const a = new oi(o, e, n, s), c = function(t, e, n) {
|
|
6737
|
+
const s = n.baseMutations.map((e => as(t.Gt, e))), i = n.mutations.map((e => as(t.Gt, e)));
|
|
6738
6738
|
return new Ns(e, n.batchId, n.localWriteTime.toMillis(), s, i);
|
|
6739
|
-
}(this.k, this.userId,
|
|
6739
|
+
}(this.k, this.userId, a), u = [];
|
|
6740
6740
|
let h = new En(((t, e) => rt(t.canonicalString(), e.canonicalString())));
|
|
6741
6741
|
for (const t of s) {
|
|
6742
6742
|
const e = ks.key(this.userId, t.key.path, o);
|
|
6743
|
-
h = h.add(t.key.path.popLast()), u.push(r.put(
|
|
6743
|
+
h = h.add(t.key.path.popLast()), u.push(r.put(c)), u.push(i.put(e, ks.PLACEHOLDER));
|
|
6744
6744
|
}
|
|
6745
6745
|
return h.forEach((e => {
|
|
6746
6746
|
u.push(this.Jt.addToCollectionParentIndex(t, e));
|
|
6747
6747
|
})), t.addOnCommittedListener((() => {
|
|
6748
|
-
this.Yt[o] =
|
|
6749
|
-
})), zs.waitFor(u).next((() =>
|
|
6748
|
+
this.Yt[o] = a.keys();
|
|
6749
|
+
})), zs.waitFor(u).next((() => a));
|
|
6750
6750
|
}));
|
|
6751
6751
|
}
|
|
6752
6752
|
lookupMutationBatch(t, e) {
|
|
@@ -6800,7 +6800,7 @@ class Ci {
|
|
|
6800
6800
|
return xi(t).jt({
|
|
6801
6801
|
range: s
|
|
6802
6802
|
}, ((n, s, r) => {
|
|
6803
|
-
const [o,
|
|
6803
|
+
const [o, a, c] = n, u = Vs(a);
|
|
6804
6804
|
// Only consider rows matching exactly the specific key of
|
|
6805
6805
|
// interest. Note that because we order by path first, and we
|
|
6806
6806
|
// order terminators before path separators, we'll encounter all
|
|
@@ -6810,7 +6810,7 @@ class Ci {
|
|
|
6810
6810
|
// can stop as soon as we hit any such row.
|
|
6811
6811
|
if (o === this.userId && e.path.isEqual(u))
|
|
6812
6812
|
// Look up the mutation batch in the store.
|
|
6813
|
-
return ki(t).get(
|
|
6813
|
+
return ki(t).get(c).next((t => {
|
|
6814
6814
|
if (!t) throw B();
|
|
6815
6815
|
U(t.userId === this.userId), i.push(mi(this.k, t));
|
|
6816
6816
|
}));
|
|
@@ -6824,7 +6824,7 @@ class Ci {
|
|
|
6824
6824
|
const i = ks.prefixForPath(this.userId, e.path), r = IDBKeyRange.lowerBound(i), o = xi(t).jt({
|
|
6825
6825
|
range: r
|
|
6826
6826
|
}, ((t, s, i) => {
|
|
6827
|
-
const [r, o,
|
|
6827
|
+
const [r, o, a] = t, c = Vs(o);
|
|
6828
6828
|
// Only consider rows matching exactly the specific key of
|
|
6829
6829
|
// interest. Note that because we order by path first, and we
|
|
6830
6830
|
// order terminators before path separators, we'll encounter all
|
|
@@ -6832,7 +6832,7 @@ class Ci {
|
|
|
6832
6832
|
// the rows for documentKey will occur before any rows for
|
|
6833
6833
|
// documents nested in a subcollection beneath documentKey so we
|
|
6834
6834
|
// can stop as soon as we hit any such row.
|
|
6835
|
-
r === this.userId && e.path.isEqual(
|
|
6835
|
+
r === this.userId && e.path.isEqual(c) ? n = n.add(a) : i.done();
|
|
6836
6836
|
}));
|
|
6837
6837
|
s.push(o);
|
|
6838
6838
|
})), zs.waitFor(s).next((() => this.te(t, n)));
|
|
@@ -6846,14 +6846,14 @@ class Ci {
|
|
|
6846
6846
|
return xi(t).jt({
|
|
6847
6847
|
range: r
|
|
6848
6848
|
}, ((t, e, i) => {
|
|
6849
|
-
const [r,
|
|
6849
|
+
const [r, a, c] = t, u = Vs(a);
|
|
6850
6850
|
r === this.userId && n.isPrefixOf(u) ?
|
|
6851
6851
|
// Rows with document keys more than one segment longer than the
|
|
6852
6852
|
// query path can't be matches. For example, a query on 'rooms'
|
|
6853
6853
|
// can't match the document /rooms/abc/messages/xyx.
|
|
6854
6854
|
// TODO(mcg): we'll need a different scanner when we implement
|
|
6855
6855
|
// ancestor queries.
|
|
6856
|
-
u.length === s && (o = o.add(
|
|
6856
|
+
u.length === s && (o = o.add(c)) : i.done();
|
|
6857
6857
|
})).next((() => this.te(t, o)));
|
|
6858
6858
|
}
|
|
6859
6859
|
te(t, e) {
|
|
@@ -6922,8 +6922,8 @@ class Ci {
|
|
|
6922
6922
|
range: r,
|
|
6923
6923
|
Kt: !0
|
|
6924
6924
|
}, ((t, n, s) => {
|
|
6925
|
-
const [r,
|
|
6926
|
-
r === e &&
|
|
6925
|
+
const [r, a, /*batchID*/ c] = t;
|
|
6926
|
+
r === e && a === i && (o = !0), s.done();
|
|
6927
6927
|
})).next((() => o));
|
|
6928
6928
|
}
|
|
6929
6929
|
|
|
@@ -7026,29 +7026,29 @@ class Oi {
|
|
|
7026
7026
|
allocateTargetId(t) {
|
|
7027
7027
|
return this.oe(t).next((e => {
|
|
7028
7028
|
const n = new Oi(e.highestTargetId);
|
|
7029
|
-
return e.highestTargetId = n.next(), this.
|
|
7029
|
+
return e.highestTargetId = n.next(), this.ae(t, e).next((() => e.highestTargetId));
|
|
7030
7030
|
}));
|
|
7031
7031
|
}
|
|
7032
7032
|
getLastRemoteSnapshotVersion(t) {
|
|
7033
|
-
return this.oe(t).next((t => ut.fromTimestamp(new
|
|
7033
|
+
return this.oe(t).next((t => ut.fromTimestamp(new ct(t.lastRemoteSnapshotVersion.seconds, t.lastRemoteSnapshotVersion.nanoseconds))));
|
|
7034
7034
|
}
|
|
7035
7035
|
getHighestSequenceNumber(t) {
|
|
7036
7036
|
return this.oe(t).next((t => t.highestListenSequenceNumber));
|
|
7037
7037
|
}
|
|
7038
7038
|
setTargetsMetadata(t, e, n) {
|
|
7039
7039
|
return this.oe(t).next((s => (s.highestListenSequenceNumber = e, n && (s.lastRemoteSnapshotVersion = n.toTimestamp()),
|
|
7040
|
-
e > s.highestListenSequenceNumber && (s.highestListenSequenceNumber = e), this.
|
|
7040
|
+
e > s.highestListenSequenceNumber && (s.highestListenSequenceNumber = e), this.ae(t, s))));
|
|
7041
7041
|
}
|
|
7042
7042
|
addTargetData(t, e) {
|
|
7043
|
-
return this.
|
|
7044
|
-
this.
|
|
7043
|
+
return this.ce(t, e).next((() => this.oe(t).next((n => (n.targetCount += 1, this.ue(e, n),
|
|
7044
|
+
this.ae(t, n))))));
|
|
7045
7045
|
}
|
|
7046
7046
|
updateTargetData(t, e) {
|
|
7047
|
-
return this.
|
|
7047
|
+
return this.ce(t, e);
|
|
7048
7048
|
}
|
|
7049
7049
|
removeTargetData(t, e) {
|
|
7050
7050
|
return this.removeMatchingKeysForTargetId(t, e.targetId).next((() => Fi(t).delete(e.targetId))).next((() => this.oe(t))).next((e => (U(e.targetCount > 0),
|
|
7051
|
-
e.targetCount -= 1, this.
|
|
7051
|
+
e.targetCount -= 1, this.ae(t, e))));
|
|
7052
7052
|
}
|
|
7053
7053
|
/**
|
|
7054
7054
|
* Drops any targets with sequence number less than or equal to the upper bound, excepting those
|
|
@@ -7058,8 +7058,8 @@ class Oi {
|
|
|
7058
7058
|
let s = 0;
|
|
7059
7059
|
const i = [];
|
|
7060
7060
|
return Fi(t).jt(((r, o) => {
|
|
7061
|
-
const
|
|
7062
|
-
|
|
7061
|
+
const a = gi(o);
|
|
7062
|
+
a.sequenceNumber <= e && null === n.get(a.targetId) && (s++, i.push(this.removeTargetData(t, a)));
|
|
7063
7063
|
})).next((() => zs.waitFor(i))).next((() => s));
|
|
7064
7064
|
}
|
|
7065
7065
|
/**
|
|
@@ -7073,10 +7073,10 @@ class Oi {
|
|
|
7073
7073
|
oe(t) {
|
|
7074
7074
|
return Li(t).get(Bs.key).next((t => (U(null !== t), t)));
|
|
7075
7075
|
}
|
|
7076
|
-
|
|
7076
|
+
ae(t, e) {
|
|
7077
7077
|
return Li(t).put(Bs.key, e);
|
|
7078
7078
|
}
|
|
7079
|
-
|
|
7079
|
+
ce(t, e) {
|
|
7080
7080
|
return Fi(t).put(yi(this.k, e));
|
|
7081
7081
|
}
|
|
7082
7082
|
/**
|
|
@@ -7146,7 +7146,7 @@ class Oi {
|
|
|
7146
7146
|
})).next((() => i));
|
|
7147
7147
|
}
|
|
7148
7148
|
containsKey(t, e) {
|
|
7149
|
-
const n = bs(e.path), s = IDBKeyRange.bound([ n ], [
|
|
7149
|
+
const n = bs(e.path), s = IDBKeyRange.bound([ n ], [ at(n) ],
|
|
7150
7150
|
/*lowerOpen=*/ !1,
|
|
7151
7151
|
/*upperOpen=*/ !0);
|
|
7152
7152
|
let i = 0;
|
|
@@ -7328,16 +7328,16 @@ class Oi {
|
|
|
7328
7328
|
return this.ge.getCacheSize(t);
|
|
7329
7329
|
}
|
|
7330
7330
|
Te(t, e) {
|
|
7331
|
-
let n, s, i, r, o,
|
|
7331
|
+
let n, s, i, r, o, c, u;
|
|
7332
7332
|
const h = Date.now();
|
|
7333
7333
|
return this.calculateTargetCount(t, this.params.percentileToCollect).next((e => (
|
|
7334
7334
|
// Cap at the configured max
|
|
7335
7335
|
e > this.params.maximumSequenceNumbersToCollect ? (O("LruGarbageCollector", `Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${e}`),
|
|
7336
7336
|
s = this.params.maximumSequenceNumbersToCollect) : s = e, r = Date.now(), this.nthSequenceNumber(t, s)))).next((s => (n = s,
|
|
7337
|
-
o = Date.now(), this.removeTargets(t, n, e)))).next((e => (i = e,
|
|
7337
|
+
o = Date.now(), this.removeTargets(t, n, e)))).next((e => (i = e, c = Date.now(),
|
|
7338
7338
|
this.removeOrphanedDocuments(t, n)))).next((t => {
|
|
7339
7339
|
if (u = Date.now(), x() <= LogLevel.DEBUG) {
|
|
7340
|
-
O("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 ` + (
|
|
7340
|
+
O("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 ` + (c - o) + "ms\n" + `\tRemoved ${t} documents in ` + (u - c) + "ms\n" + `Total Duration: ${u - h}ms`);
|
|
7341
7341
|
}
|
|
7342
7342
|
return zs.resolve({
|
|
7343
7343
|
didRun: !0,
|
|
@@ -7834,10 +7834,10 @@ class Yi extends Hi {
|
|
|
7834
7834
|
return this.changes.forEach(((i, r) => {
|
|
7835
7835
|
const o = this.Ce.get(i);
|
|
7836
7836
|
if (r.document.isValidDocument()) {
|
|
7837
|
-
const
|
|
7837
|
+
const a = li(this.De.k, r.document, this.getReadTime(i));
|
|
7838
7838
|
s = s.add(i.path.popLast());
|
|
7839
|
-
const
|
|
7840
|
-
n +=
|
|
7839
|
+
const c = Di(a);
|
|
7840
|
+
n += c - o, e.push(this.De.addEntry(t, i, a));
|
|
7841
7841
|
} else if (n -= o, this.trackRemovals) {
|
|
7842
7842
|
// In order to track removals, we store a "sentinel delete" in the
|
|
7843
7843
|
// RemoteDocumentCache. This entry is represented by a NoDocument
|
|
@@ -8167,14 +8167,14 @@ class ir {
|
|
|
8167
8167
|
* Whether to synchronize the in-memory state of multiple tabs and share
|
|
8168
8168
|
* access to local persistence.
|
|
8169
8169
|
*/
|
|
8170
|
-
t, e, n, s, i, r, o,
|
|
8170
|
+
t, e, n, s, i, r, o, a, c,
|
|
8171
8171
|
/**
|
|
8172
8172
|
* If set to true, forcefully obtains database access. Existing tabs will
|
|
8173
8173
|
* no longer be able to access IndexedDB.
|
|
8174
8174
|
*/
|
|
8175
8175
|
u) {
|
|
8176
8176
|
if (this.allowTabSynchronization = t, this.persistenceKey = e, this.clientId = n,
|
|
8177
|
-
this.Me = i, this.window = r, this.document = o, this.Fe =
|
|
8177
|
+
this.Me = i, this.window = r, this.document = o, this.Fe = c, this.Le = u, this.Be = null,
|
|
8178
8178
|
this.Ue = !1, this.isPrimary = !1, this.networkEnabled = !0,
|
|
8179
8179
|
/** Our window.unload handler, if registered. */
|
|
8180
8180
|
this.qe = null, this.inForeground = !1,
|
|
@@ -8186,7 +8186,7 @@ class ir {
|
|
|
8186
8186
|
this.Qe = Number.NEGATIVE_INFINITY,
|
|
8187
8187
|
/** A listener to notify on primary state changes. */
|
|
8188
8188
|
this.We = t => Promise.resolve(), !ir.Pt()) throw new Q(j.UNIMPLEMENTED, "This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");
|
|
8189
|
-
this.referenceDelegate = new Wi(this, s), this.Ge = e + "main", this.k = new ui(
|
|
8189
|
+
this.referenceDelegate = new Wi(this, s), this.Ge = e + "main", this.k = new ui(a),
|
|
8190
8190
|
this.ze = new Js(this.Ge, 11, new er(this.k)), this.He = new Mi(this.referenceDelegate, this.k),
|
|
8191
8191
|
this.Jt = new bi, this.Je = function(t, e) {
|
|
8192
8192
|
return new Ji(t, e);
|
|
@@ -8264,7 +8264,7 @@ class ir {
|
|
|
8264
8264
|
if (this.isPrimary) return this.rn(t).next((t => {
|
|
8265
8265
|
t || (this.isPrimary = !1, this.Me.enqueueRetryable((() => this.We(!1))));
|
|
8266
8266
|
}));
|
|
8267
|
-
})).next((() => this.on(t))).next((e => this.isPrimary && !e ? this.
|
|
8267
|
+
})).next((() => this.on(t))).next((e => this.isPrimary && !e ? this.an(t).next((() => !1)) : !!e && this.cn(t).next((() => !0)))))).catch((t => {
|
|
8268
8268
|
if (Zs(t))
|
|
8269
8269
|
// Proceed with the existing state. Any subsequent access to
|
|
8270
8270
|
// IndexedDB will verify the lease.
|
|
@@ -8370,7 +8370,7 @@ class ir {
|
|
|
8370
8370
|
// has obtained the primary lease.
|
|
8371
8371
|
await this.ze.runTransaction("shutdown", "readwrite", [ Ds.store, qs.store ], (t => {
|
|
8372
8372
|
const e = new ii(t, nt.I);
|
|
8373
|
-
return this.
|
|
8373
|
+
return this.an(e).next((() => this.hn(e)));
|
|
8374
8374
|
})), this.ze.close(),
|
|
8375
8375
|
// Remove the entry marking the client as zombied from LocalStorage since
|
|
8376
8376
|
// we successfully deleted its metadata from IndexedDb.
|
|
@@ -8420,7 +8420,7 @@ class ir {
|
|
|
8420
8420
|
if (!e) throw M(`Failed to obtain primary lease for action '${t}'.`), this.isPrimary = !1,
|
|
8421
8421
|
this.Me.enqueueRetryable((() => this.We(!1))), new Q(j.FAILED_PRECONDITION, Ws);
|
|
8422
8422
|
return n(i);
|
|
8423
|
-
})).next((t => this.
|
|
8423
|
+
})).next((t => this.cn(i).next((() => t)))) : this.En(i).next((() => n(i)))))).then((t => (i.raiseOnCommittedEvent(),
|
|
8424
8424
|
t)));
|
|
8425
8425
|
}
|
|
8426
8426
|
/**
|
|
@@ -8437,14 +8437,14 @@ class ir {
|
|
|
8437
8437
|
/**
|
|
8438
8438
|
* Obtains or extends the new primary lease for the local client. This
|
|
8439
8439
|
* method does not verify that the client is eligible for this lease.
|
|
8440
|
-
*/
|
|
8440
|
+
*/ cn(t) {
|
|
8441
8441
|
const e = new Ds(this.clientId, this.allowTabSynchronization, Date.now());
|
|
8442
8442
|
return rr(t).put(Ds.key, e);
|
|
8443
8443
|
}
|
|
8444
8444
|
static Pt() {
|
|
8445
8445
|
return Js.Pt();
|
|
8446
8446
|
}
|
|
8447
|
-
/** Checks the primary lease and removes it if we are the current primary. */
|
|
8447
|
+
/** Checks the primary lease and removes it if we are the current primary. */ an(t) {
|
|
8448
8448
|
const e = rr(t);
|
|
8449
8449
|
return e.get(Ds.key).next((t => this.un(t) ? (O("IndexedDbPersistence", "Releasing primary lease."),
|
|
8450
8450
|
e.delete(Ds.key)) : zs.resolve()));
|
|
@@ -8542,7 +8542,7 @@ class ir {
|
|
|
8542
8542
|
/**
|
|
8543
8543
|
* Generates a string used as a prefix when storing data in IndexedDB and
|
|
8544
8544
|
* LocalStorage.
|
|
8545
|
-
*/ function
|
|
8545
|
+
*/ function ar(t, e) {
|
|
8546
8546
|
// Use two different prefix formats:
|
|
8547
8547
|
// * firestore / persistenceKey / projectID . databaseID / ...
|
|
8548
8548
|
// * firestore / persistenceKey / projectID / ...
|
|
@@ -8568,7 +8568,7 @@ class ir {
|
|
|
8568
8568
|
* See the License for the specific language governing permissions and
|
|
8569
8569
|
* limitations under the License.
|
|
8570
8570
|
*/
|
|
8571
|
-
class
|
|
8571
|
+
class cr {
|
|
8572
8572
|
constructor(t, e) {
|
|
8573
8573
|
this.progress = t, this.In = e;
|
|
8574
8574
|
}
|
|
@@ -8698,7 +8698,7 @@ class ar {
|
|
|
8698
8698
|
}
|
|
8699
8699
|
Nn(t, e, n) {
|
|
8700
8700
|
let s = Dn();
|
|
8701
|
-
for (const t of e) for (const e of t.mutations) e instanceof
|
|
8701
|
+
for (const t of e) for (const e of t.mutations) e instanceof an && null === n.get(e.key) && (s = s.add(e.key));
|
|
8702
8702
|
let i = n;
|
|
8703
8703
|
return this.Je.getEntries(t, s).next((t => (t.forEach(((t, e) => {
|
|
8704
8704
|
e.isFoundDocument() && (i = i.insert(t, e));
|
|
@@ -9016,16 +9016,16 @@ function mr(t) {
|
|
|
9016
9016
|
// Reset newTargetDataByTargetMap in case this transaction gets re-run.
|
|
9017
9017
|
i = n.qn;
|
|
9018
9018
|
const o = [];
|
|
9019
|
-
e.targetChanges.forEach(((r,
|
|
9020
|
-
const
|
|
9021
|
-
if (!
|
|
9019
|
+
e.targetChanges.forEach(((r, a) => {
|
|
9020
|
+
const c = i.get(a);
|
|
9021
|
+
if (!c) return;
|
|
9022
9022
|
// Only update the remote keys if the target is still active. This
|
|
9023
9023
|
// ensures that we can persist the updated target data along with
|
|
9024
9024
|
// the updated assignment.
|
|
9025
|
-
o.push(n.He.removeMatchingKeys(t, r.removedDocuments,
|
|
9026
|
-
let u =
|
|
9027
|
-
e.targetMismatches.has(
|
|
9028
|
-
i = i.insert(
|
|
9025
|
+
o.push(n.He.removeMatchingKeys(t, r.removedDocuments, a).next((() => n.He.addMatchingKeys(t, r.addedDocuments, a))));
|
|
9026
|
+
let u = c.withSequenceNumber(t.currentSequenceNumber);
|
|
9027
|
+
e.targetMismatches.has(a) ? u = u.withResumeToken(pt.EMPTY_BYTE_STRING, ut.min()).withLastLimboFreeSnapshotVersion(ut.min()) : r.resumeToken.approximateByteSize() > 0 && (u = u.withResumeToken(r.resumeToken, s)),
|
|
9028
|
+
i = i.insert(a, u),
|
|
9029
9029
|
// Update the target data if there are target changes (or if
|
|
9030
9030
|
// sufficient time has passed since the last update).
|
|
9031
9031
|
/**
|
|
@@ -9057,9 +9057,9 @@ function mr(t) {
|
|
|
9057
9057
|
}
|
|
9058
9058
|
/**
|
|
9059
9059
|
* Notifies local store of the changed views to locally pin documents.
|
|
9060
|
-
*/ (
|
|
9060
|
+
*/ (c, u, r) && o.push(n.He.updateTargetData(t, u));
|
|
9061
9061
|
}));
|
|
9062
|
-
let
|
|
9062
|
+
let a = Rn();
|
|
9063
9063
|
// HACK: The only reason we allow a null snapshot version is so that we
|
|
9064
9064
|
// can synthesize remote events when we get permission denied errors while
|
|
9065
9065
|
// trying to resolve the state of a locally cached document that is in
|
|
@@ -9070,12 +9070,12 @@ function mr(t) {
|
|
|
9070
9070
|
// Each loop iteration only affects its "own" doc, so it's safe to get all the remote
|
|
9071
9071
|
// documents in advance in a single call.
|
|
9072
9072
|
o.push(yr(t, r, e.documentUpdates, s, void 0).next((t => {
|
|
9073
|
-
|
|
9073
|
+
a = t;
|
|
9074
9074
|
}))), !s.isEqual(ut.min())) {
|
|
9075
9075
|
const e = n.He.getLastRemoteSnapshotVersion(t).next((e => n.He.setTargetsMetadata(t, t.currentSequenceNumber, s)));
|
|
9076
9076
|
o.push(e);
|
|
9077
9077
|
}
|
|
9078
|
-
return zs.waitFor(o).next((() => r.apply(t))).next((() => n.Wn.Vn(t,
|
|
9078
|
+
return zs.waitFor(o).next((() => r.apply(t))).next((() => n.Wn.Vn(t, a))).next((() => a));
|
|
9079
9079
|
})).then((t => (n.qn = i, t)));
|
|
9080
9080
|
}
|
|
9081
9081
|
|
|
@@ -9102,7 +9102,7 @@ i) {
|
|
|
9102
9102
|
return n.forEach((t => r = r.add(t))), e.getEntries(t, r).next((t => {
|
|
9103
9103
|
let r = Rn();
|
|
9104
9104
|
return n.forEach(((n, o) => {
|
|
9105
|
-
const
|
|
9105
|
+
const a = t.get(n), c = (null == i ? void 0 : i.get(n)) || s;
|
|
9106
9106
|
// Note: The order of the steps below is important, since we want
|
|
9107
9107
|
// to ensure that rejected limbo resolutions (which fabricate
|
|
9108
9108
|
// NoDocuments with SnapshotVersion.min()) never add documents to
|
|
@@ -9111,8 +9111,8 @@ i) {
|
|
|
9111
9111
|
// NoDocuments with SnapshotVersion.min() are used in manufactured
|
|
9112
9112
|
// events. We remove these documents from cache since we lost
|
|
9113
9113
|
// access.
|
|
9114
|
-
e.removeEntry(n,
|
|
9115
|
-
r = r.insert(n, o)) : O("LocalStore", "Ignoring outdated watch update for ", n, ". Current version:",
|
|
9114
|
+
e.removeEntry(n, c), r = r.insert(n, o)) : !a.isValidDocument() || o.version.compareTo(a.version) > 0 || 0 === o.version.compareTo(a.version) && a.hasPendingWrites ? (e.addEntry(o, c),
|
|
9115
|
+
r = r.insert(n, o)) : O("LocalStore", "Ignoring outdated watch update for ", n, ". Current version:", a.version, " Watch version:", o.version);
|
|
9116
9116
|
})), r;
|
|
9117
9117
|
}));
|
|
9118
9118
|
}
|
|
@@ -9149,7 +9149,7 @@ function Tr(t, e) {
|
|
|
9149
9149
|
// This target has been listened to previously, so reuse the
|
|
9150
9150
|
// previous targetID.
|
|
9151
9151
|
// TODO(mcg): freshen last accessed date?
|
|
9152
|
-
s = i, zs.resolve(s)) : n.He.allocateTargetId(t).next((i => (s = new
|
|
9152
|
+
s = i, zs.resolve(s)) : n.He.allocateTargetId(t).next((i => (s = new ci(e, i, 0 /* Listen */ , t.currentSequenceNumber),
|
|
9153
9153
|
n.He.addTargetData(t, s).next((() => s)))))));
|
|
9154
9154
|
})).then((t => {
|
|
9155
9155
|
// If Multi-Tab is enabled, the existing target data may be newer than
|
|
@@ -9230,10 +9230,10 @@ function Rr(t) {
|
|
|
9230
9230
|
return e.persistence.runTransaction("Get new document changes", "readonly", (t => function(t, e, n) {
|
|
9231
9231
|
const s = K(t);
|
|
9232
9232
|
let i = Rn(), r = fi(n);
|
|
9233
|
-
const o = Zi(e),
|
|
9233
|
+
const o = Zi(e), a = IDBKeyRange.lowerBound(r, !0);
|
|
9234
9234
|
return o.jt({
|
|
9235
9235
|
index: Os.readTimeIndex,
|
|
9236
|
-
range:
|
|
9236
|
+
range: a
|
|
9237
9237
|
}, ((t, e) => {
|
|
9238
9238
|
// Unlike `getEntry()` and others, `getNewDocumentChanges()` parses
|
|
9239
9239
|
// the documents directly since we want to keep sentinel deletes.
|
|
@@ -9290,12 +9290,12 @@ async function br(t) {
|
|
|
9290
9290
|
*/
|
|
9291
9291
|
async function Pr(t, e, n, s) {
|
|
9292
9292
|
const i = K(t);
|
|
9293
|
-
let r = Dn(), o = Rn(),
|
|
9293
|
+
let r = Dn(), o = Rn(), a = Vn();
|
|
9294
9294
|
for (const t of n) {
|
|
9295
9295
|
const n = e.Hn(t.metadata.name);
|
|
9296
|
-
t.document && (r = r.add(n)), o = o.insert(n, e.Jn(t)),
|
|
9296
|
+
t.document && (r = r.add(n)), o = o.insert(n, e.Jn(t)), a = a.insert(n, e.Yn(t.metadata.readTime));
|
|
9297
9297
|
}
|
|
9298
|
-
const
|
|
9298
|
+
const c = i.Qn.newChangeBuffer({
|
|
9299
9299
|
trackRemovals: !0
|
|
9300
9300
|
}), u = await Tr(i, function(t) {
|
|
9301
9301
|
// It is OK that the path used for the query is not valid, because this will
|
|
@@ -9304,7 +9304,7 @@ async function Pr(t, e, n, s) {
|
|
|
9304
9304
|
}(s));
|
|
9305
9305
|
// Allocates a target to hold all document keys from the bundle, such that
|
|
9306
9306
|
// they will not get garbage collected right away.
|
|
9307
|
-
return i.persistence.runTransaction("Apply bundle documents", "readwrite", (t => yr(t,
|
|
9307
|
+
return i.persistence.runTransaction("Apply bundle documents", "readwrite", (t => yr(t, c, o, ut.min(), a).next((e => (c.apply(t),
|
|
9308
9308
|
e))).next((e => i.He.removeMatchingKeysForTargetId(t, u.targetId).next((() => i.He.addMatchingKeys(t, r, u.targetId))).next((() => i.Wn.Vn(t, e))).next((() => e))))));
|
|
9309
9309
|
}
|
|
9310
9310
|
|
|
@@ -9807,16 +9807,16 @@ class kr extends Hi {
|
|
|
9807
9807
|
return n && (this.lastRemoteSnapshotVersion = n), e > this.As && (this.As = e),
|
|
9808
9808
|
zs.resolve();
|
|
9809
9809
|
}
|
|
9810
|
-
|
|
9810
|
+
ce(t) {
|
|
9811
9811
|
this.Is.set(t.target, t);
|
|
9812
9812
|
const e = t.targetId;
|
|
9813
9813
|
e > this.highestTargetId && (this.bs = new Oi(e), this.highestTargetId = e), t.sequenceNumber > this.As && (this.As = t.sequenceNumber);
|
|
9814
9814
|
}
|
|
9815
9815
|
addTargetData(t, e) {
|
|
9816
|
-
return this.
|
|
9816
|
+
return this.ce(e), this.targetCount += 1, zs.resolve();
|
|
9817
9817
|
}
|
|
9818
9818
|
updateTargetData(t, e) {
|
|
9819
|
-
return this.
|
|
9819
|
+
return this.ce(e), zs.resolve();
|
|
9820
9820
|
}
|
|
9821
9821
|
removeTargetData(t, e) {
|
|
9822
9822
|
return this.Is.delete(e.target), this.Rs.us(e.targetId), this.targetCount -= 1,
|
|
@@ -10333,7 +10333,7 @@ class Qr {
|
|
|
10333
10333
|
this.oi(t);
|
|
10334
10334
|
}
|
|
10335
10335
|
notifyBundleLoaded() {
|
|
10336
|
-
this.
|
|
10336
|
+
this.ai();
|
|
10337
10337
|
}
|
|
10338
10338
|
shutdown() {
|
|
10339
10339
|
this.started && (this.window.removeEventListener("storage", this.Us), this.removeItem(this.Qs),
|
|
@@ -10359,7 +10359,7 @@ class Qr {
|
|
|
10359
10359
|
if (this.started) {
|
|
10360
10360
|
if (null !== e.key) if (this.Gs.test(e.key)) {
|
|
10361
10361
|
if (null == e.newValue) {
|
|
10362
|
-
const t = this.
|
|
10362
|
+
const t = this.ci(e.key);
|
|
10363
10363
|
return this.ui(t, null);
|
|
10364
10364
|
}
|
|
10365
10365
|
{
|
|
@@ -10428,13 +10428,13 @@ class Qr {
|
|
|
10428
10428
|
const s = Br(this.persistenceKey, t), i = new qr(t, e, n);
|
|
10429
10429
|
this.setItem(s, i.Ms());
|
|
10430
10430
|
}
|
|
10431
|
-
|
|
10431
|
+
ai() {
|
|
10432
10432
|
this.setItem(this.Ys, "value-not-used");
|
|
10433
10433
|
}
|
|
10434
10434
|
/**
|
|
10435
10435
|
* Parses a client state key in WebStorage. Returns null if the key does not
|
|
10436
10436
|
* match the expected key format.
|
|
10437
|
-
*/
|
|
10437
|
+
*/ ci(t) {
|
|
10438
10438
|
const e = this.Gs.exec(t);
|
|
10439
10439
|
return e ? e[1] : null;
|
|
10440
10440
|
}
|
|
@@ -10442,7 +10442,7 @@ class Qr {
|
|
|
10442
10442
|
* Parses a client state in WebStorage. Returns 'null' if the value could not
|
|
10443
10443
|
* be parsed.
|
|
10444
10444
|
*/ hi(t, e) {
|
|
10445
|
-
const n = this.
|
|
10445
|
+
const n = this.ci(t);
|
|
10446
10446
|
return Kr.Os(n, e);
|
|
10447
10447
|
}
|
|
10448
10448
|
/**
|
|
@@ -10798,8 +10798,8 @@ class {
|
|
|
10798
10798
|
O("Connection", 'RPC "' + t + '" completed.');
|
|
10799
10799
|
}
|
|
10800
10800
|
}));
|
|
10801
|
-
const
|
|
10802
|
-
o.send(e, "POST",
|
|
10801
|
+
const a = JSON.stringify(s);
|
|
10802
|
+
o.send(e, "POST", a, n, 15);
|
|
10803
10803
|
}));
|
|
10804
10804
|
}
|
|
10805
10805
|
Qi(t, e, n) {
|
|
@@ -10844,9 +10844,9 @@ class {
|
|
|
10844
10844
|
// known to (sometimes) not include an Origin. See
|
|
10845
10845
|
// https://github.com/firebase/firebase-js-sdk/issues/1491.
|
|
10846
10846
|
isMobileCordova() || isReactNative() || isElectron() || isIE() || isUWP() || isBrowserExtension() || (o.httpHeadersOverwriteParam = "$httpHeaders");
|
|
10847
|
-
const
|
|
10848
|
-
O("Connection", "Creating WebChannel: " +
|
|
10849
|
-
const
|
|
10847
|
+
const a = s.join("");
|
|
10848
|
+
O("Connection", "Creating WebChannel: " + a, o);
|
|
10849
|
+
const c = i.createWebChannel(a, o);
|
|
10850
10850
|
// WebChannel supports sending the first message with the handshake - saving
|
|
10851
10851
|
// a network round trip. However, it will have to call send in the same
|
|
10852
10852
|
// JS event loop as open. In order to enforce this, we delay actually
|
|
@@ -10859,9 +10859,9 @@ class {
|
|
|
10859
10859
|
const l = new Yr({
|
|
10860
10860
|
Vi: t => {
|
|
10861
10861
|
h ? O("Connection", "Not sending because WebChannel is closed:", t) : (u || (O("Connection", "Opening WebChannel transport."),
|
|
10862
|
-
|
|
10862
|
+
c.open(), u = !0), O("Connection", "WebChannel sending:", t), c.send(t));
|
|
10863
10863
|
},
|
|
10864
|
-
Si: () =>
|
|
10864
|
+
Si: () => c.close()
|
|
10865
10865
|
}), y = (t, e, n) => {
|
|
10866
10866
|
// TODO(dimond): closure typing seems broken because WebChannel does
|
|
10867
10867
|
// not implement goog.events.Listenable
|
|
@@ -10879,13 +10879,13 @@ class {
|
|
|
10879
10879
|
// exception and rethrow using a setTimeout so they become visible again.
|
|
10880
10880
|
// Note that eventually this function could go away if we are confident
|
|
10881
10881
|
// enough the code is exception free.
|
|
10882
|
-
return y(
|
|
10882
|
+
return y(c, WebChannel.EventType.OPEN, (() => {
|
|
10883
10883
|
h || O("Connection", "WebChannel transport opened.");
|
|
10884
|
-
})), y(
|
|
10884
|
+
})), y(c, WebChannel.EventType.CLOSE, (() => {
|
|
10885
10885
|
h || (h = !0, O("Connection", "WebChannel transport closed"), l.Oi());
|
|
10886
|
-
})), y(
|
|
10886
|
+
})), y(c, WebChannel.EventType.ERROR, (t => {
|
|
10887
10887
|
h || (h = !0, F("Connection", "WebChannel transport errored:", t), l.Oi(new Q(j.UNAVAILABLE, "The operation could not be completed")));
|
|
10888
|
-
})), y(
|
|
10888
|
+
})), y(c, WebChannel.EventType.MESSAGE, (t => {
|
|
10889
10889
|
var e;
|
|
10890
10890
|
if (!h) {
|
|
10891
10891
|
const n = t.data[0];
|
|
@@ -10915,7 +10915,7 @@ class {
|
|
|
10915
10915
|
}(t), n = i.message;
|
|
10916
10916
|
void 0 === e && (e = j.INTERNAL, n = "Unknown error status: " + t + " with message " + i.message),
|
|
10917
10917
|
// Mark closed so no further events are propagated
|
|
10918
|
-
h = !0, l.Oi(new Q(e, n)),
|
|
10918
|
+
h = !0, l.Oi(new Q(e, n)), c.close();
|
|
10919
10919
|
} else O("Connection", "WebChannel received:", n), l.Mi(n);
|
|
10920
10920
|
}
|
|
10921
10921
|
})), y(r, Event.STAT_EVENT, (t => {
|
|
@@ -11130,15 +11130,15 @@ class no {
|
|
|
11130
11130
|
* ListenerType: The type of the listener that will be used for callbacks
|
|
11131
11131
|
*/
|
|
11132
11132
|
class so {
|
|
11133
|
-
constructor(t, e, n, s, i, r, o,
|
|
11133
|
+
constructor(t, e, n, s, i, r, o, a) {
|
|
11134
11134
|
this.Me = t, this.nr = n, this.sr = s, this.ir = i, this.authCredentialsProvider = r,
|
|
11135
|
-
this.appCheckCredentialsProvider = o, this.listener =
|
|
11135
|
+
this.appCheckCredentialsProvider = o, this.listener = a, this.state = 0 /* Initial */ ,
|
|
11136
11136
|
/**
|
|
11137
11137
|
* A close count that's incremented every time the stream is closed; used by
|
|
11138
11138
|
* getCloseGuardedDispatcher() to invalidate callbacks that happen after
|
|
11139
11139
|
* close.
|
|
11140
11140
|
*/
|
|
11141
|
-
this.rr = 0, this.
|
|
11141
|
+
this.rr = 0, this.ar = null, this.cr = null, this.stream = null, this.ur = new no(t, e);
|
|
11142
11142
|
}
|
|
11143
11143
|
/**
|
|
11144
11144
|
* Returns true if start() has been called and no error has occurred. True
|
|
@@ -11194,7 +11194,7 @@ class so {
|
|
|
11194
11194
|
*/ _r() {
|
|
11195
11195
|
// Starts the idle time if we are in state 'Open' and are not yet already
|
|
11196
11196
|
// running a timer (in which case the previous idle timeout still applies).
|
|
11197
|
-
this.lr() && null === this.
|
|
11197
|
+
this.lr() && null === this.ar && (this.ar = this.Me.enqueueAfterDelay(this.nr, 6e4, (() => this.mr())));
|
|
11198
11198
|
}
|
|
11199
11199
|
/** Sends a message to the underlying stream. */ gr(t) {
|
|
11200
11200
|
this.yr(), this.stream.send(t);
|
|
@@ -11206,10 +11206,10 @@ class so {
|
|
|
11206
11206
|
return this.close(0 /* Initial */);
|
|
11207
11207
|
}
|
|
11208
11208
|
/** Marks the stream as active again. */ yr() {
|
|
11209
|
-
this.
|
|
11209
|
+
this.ar && (this.ar.cancel(), this.ar = null);
|
|
11210
11210
|
}
|
|
11211
11211
|
/** Cancels the health check delayed operation. */ pr() {
|
|
11212
|
-
this.
|
|
11212
|
+
this.cr && (this.cr.cancel(), this.cr = null);
|
|
11213
11213
|
}
|
|
11214
11214
|
/**
|
|
11215
11215
|
* Closes the stream and cleans up as necessary:
|
|
@@ -11277,7 +11277,7 @@ class so {
|
|
|
11277
11277
|
Ir(t, e) {
|
|
11278
11278
|
const n = this.Er(this.rr);
|
|
11279
11279
|
this.stream = this.Rr(t, e), this.stream.Di((() => {
|
|
11280
|
-
n((() => (this.state = 2 /* Open */ , this.
|
|
11280
|
+
n((() => (this.state = 2 /* Open */ , this.cr = this.Me.enqueueAfterDelay(this.sr, 1e4, (() => (this.lr() && (this.state = 3 /* Healthy */),
|
|
11281
11281
|
Promise.resolve()))), this.listener.Di())));
|
|
11282
11282
|
})), this.stream.Ni((t => {
|
|
11283
11283
|
n((() => this.Ar(t)));
|
|
@@ -11434,7 +11434,7 @@ class so {
|
|
|
11434
11434
|
/** Sends a group of mutations to the Firestore backend to apply. */ Dr(t) {
|
|
11435
11435
|
const e = {
|
|
11436
11436
|
streamToken: this.lastStreamToken,
|
|
11437
|
-
writes: t.map((t =>
|
|
11437
|
+
writes: t.map((t => as(this.k, t)))
|
|
11438
11438
|
};
|
|
11439
11439
|
this.gr(e);
|
|
11440
11440
|
}
|
|
@@ -11503,7 +11503,7 @@ class oo extends class {} {
|
|
|
11503
11503
|
* then we set the OnlineState to Offline, and the client will behave as if
|
|
11504
11504
|
* it is offline (get()s will return cached data, etc.).
|
|
11505
11505
|
*/
|
|
11506
|
-
class
|
|
11506
|
+
class ao {
|
|
11507
11507
|
constructor(t, e) {
|
|
11508
11508
|
this.asyncQueue = t, this.onlineStateHandler = e,
|
|
11509
11509
|
/** The current OnlineState. */
|
|
@@ -11587,7 +11587,7 @@ class co {
|
|
|
11587
11587
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11588
11588
|
* See the License for the specific language governing permissions and
|
|
11589
11589
|
* limitations under the License.
|
|
11590
|
-
*/ class
|
|
11590
|
+
*/ class co {
|
|
11591
11591
|
constructor(
|
|
11592
11592
|
/**
|
|
11593
11593
|
* The local store, used to fill the write pipeline with outbound mutations.
|
|
@@ -11648,7 +11648,7 @@ class co {
|
|
|
11648
11648
|
e.Gr.delete(4 /* ConnectivityChange */), await uo(e);
|
|
11649
11649
|
}(this));
|
|
11650
11650
|
}));
|
|
11651
|
-
})), this.Jr = new
|
|
11651
|
+
})), this.Jr = new ao(n, s);
|
|
11652
11652
|
}
|
|
11653
11653
|
}
|
|
11654
11654
|
|
|
@@ -11807,7 +11807,7 @@ async function Io(t, e, n) {
|
|
|
11807
11807
|
// mismatch, but don't actually retain that in listenTargets. This ensures
|
|
11808
11808
|
// that we flag the first re-listen this way without impacting future
|
|
11809
11809
|
// listens of this target (that might happen e.g. on reconnect).
|
|
11810
|
-
const s = new
|
|
11810
|
+
const s = new ci(n.target, e, 1 /* ExistenceFilterMismatch */ , n.sequenceNumber);
|
|
11811
11811
|
wo(t, s);
|
|
11812
11812
|
})), t.remoteSyncer.applyRemoteEvent(n);
|
|
11813
11813
|
}(t, n);
|
|
@@ -11898,7 +11898,7 @@ async function Co(t) {
|
|
|
11898
11898
|
}
|
|
11899
11899
|
|
|
11900
11900
|
async function No(t, e, n) {
|
|
11901
|
-
const s = t.Qr.shift(), i =
|
|
11901
|
+
const s = t.Qr.shift(), i = ai.from(s, e, n);
|
|
11902
11902
|
await Ro(t, (() => t.remoteSyncer.applySuccessfulWrite(i))),
|
|
11903
11903
|
// It's possible that with the completion of this mutation another
|
|
11904
11904
|
// slot has freed up.
|
|
@@ -12253,9 +12253,9 @@ class Mo {
|
|
|
12253
12253
|
}
|
|
12254
12254
|
|
|
12255
12255
|
class Uo {
|
|
12256
|
-
constructor(t, e, n, s, i, r, o,
|
|
12256
|
+
constructor(t, e, n, s, i, r, o, a) {
|
|
12257
12257
|
this.query = t, this.docs = e, this.oldDocs = n, this.docChanges = s, this.mutatedKeys = i,
|
|
12258
|
-
this.fromCache = r, this.syncStateChanged = o, this.excludesMetadataChanges =
|
|
12258
|
+
this.fromCache = r, this.syncStateChanged = o, this.excludesMetadataChanges = a;
|
|
12259
12259
|
}
|
|
12260
12260
|
/** Returns a view snapshot as if all documents in the snapshot were added. */ static fromInitialDocuments(t, e, n, s) {
|
|
12261
12261
|
const i = [];
|
|
@@ -12374,12 +12374,12 @@ function zo(t) {
|
|
|
12374
12374
|
* It uses an Observer to dispatch events.
|
|
12375
12375
|
*/ class Ho {
|
|
12376
12376
|
constructor(t, e, n) {
|
|
12377
|
-
this.query = t, this.
|
|
12377
|
+
this.query = t, this.ao = e,
|
|
12378
12378
|
/**
|
|
12379
12379
|
* Initial snapshots (e.g. from cache) may not be propagated to the wrapped
|
|
12380
12380
|
* observer. This flag is set to true once we've actually raised an event.
|
|
12381
12381
|
*/
|
|
12382
|
-
this.
|
|
12382
|
+
this.co = !1, this.uo = null, this.onlineState = "Unknown" /* Unknown */ , this.options = n || {};
|
|
12383
12383
|
}
|
|
12384
12384
|
/**
|
|
12385
12385
|
* Applies the new ViewSnapshot to this listener, raising a user-facing event
|
|
@@ -12395,16 +12395,16 @@ function zo(t) {
|
|
|
12395
12395
|
/* excludesMetadataChanges= */ !0);
|
|
12396
12396
|
}
|
|
12397
12397
|
let e = !1;
|
|
12398
|
-
return this.
|
|
12398
|
+
return this.co ? this.ho(t) && (this.ao.next(t), e = !0) : this.lo(t, this.onlineState) && (this.fo(t),
|
|
12399
12399
|
e = !0), this.uo = t, e;
|
|
12400
12400
|
}
|
|
12401
12401
|
onError(t) {
|
|
12402
|
-
this.
|
|
12402
|
+
this.ao.error(t);
|
|
12403
12403
|
}
|
|
12404
12404
|
/** Returns whether a snapshot was raised. */ ro(t) {
|
|
12405
12405
|
this.onlineState = t;
|
|
12406
12406
|
let e = !1;
|
|
12407
|
-
return this.uo && !this.
|
|
12407
|
+
return this.uo && !this.co && this.lo(this.uo, t) && (this.fo(this.uo), e = !0),
|
|
12408
12408
|
e;
|
|
12409
12409
|
}
|
|
12410
12410
|
lo(t, e) {
|
|
@@ -12431,8 +12431,8 @@ function zo(t) {
|
|
|
12431
12431
|
// stripped out.
|
|
12432
12432
|
}
|
|
12433
12433
|
fo(t) {
|
|
12434
|
-
t = Uo.fromInitialDocuments(t.query, t.docs, t.mutatedKeys, t.fromCache), this.
|
|
12435
|
-
this.
|
|
12434
|
+
t = Uo.fromInitialDocuments(t.query, t.docs, t.mutatedKeys, t.fromCache), this.co = !0,
|
|
12435
|
+
this.ao.next(t);
|
|
12436
12436
|
}
|
|
12437
12437
|
}
|
|
12438
12438
|
|
|
@@ -12542,7 +12542,7 @@ function zo(t) {
|
|
|
12542
12542
|
*/ async complete() {
|
|
12543
12543
|
const t = await Pr(this.localStore, new Yo(this.k), this.documents, this.mo.id), e = this.po(this.documents);
|
|
12544
12544
|
for (const t of this.queries) await vr(this.localStore, t, e.get(t.name));
|
|
12545
|
-
return this.progress.taskState = "Success", new
|
|
12545
|
+
return this.progress.taskState = "Success", new cr(Object.assign({}, this.progress), t);
|
|
12546
12546
|
}
|
|
12547
12547
|
}
|
|
12548
12548
|
|
|
@@ -12579,13 +12579,13 @@ function zo(t) {
|
|
|
12579
12579
|
* See the License for the specific language governing permissions and
|
|
12580
12580
|
* limitations under the License.
|
|
12581
12581
|
*/
|
|
12582
|
-
class
|
|
12582
|
+
class ta {
|
|
12583
12583
|
constructor(t) {
|
|
12584
12584
|
this.key = t;
|
|
12585
12585
|
}
|
|
12586
12586
|
}
|
|
12587
12587
|
|
|
12588
|
-
class
|
|
12588
|
+
class ea {
|
|
12589
12589
|
constructor(t) {
|
|
12590
12590
|
this.key = t;
|
|
12591
12591
|
}
|
|
@@ -12595,7 +12595,7 @@ class ec {
|
|
|
12595
12595
|
* View is responsible for computing the final merged truth of what docs are in
|
|
12596
12596
|
* a query. It gets notified of local and remote changes to docs, and applies
|
|
12597
12597
|
* the query filters and limits to determine the most correct possible results.
|
|
12598
|
-
*/ class
|
|
12598
|
+
*/ class na {
|
|
12599
12599
|
constructor(t,
|
|
12600
12600
|
/** Documents included in the remote target */
|
|
12601
12601
|
e) {
|
|
@@ -12638,7 +12638,7 @@ class ec {
|
|
|
12638
12638
|
// deletes. So we keep this doc at the old limit to compare the updates to.
|
|
12639
12639
|
// Note that this should never get used in a refill (when previousChanges is
|
|
12640
12640
|
// set), because there will only be adds -- no deletes or updates.
|
|
12641
|
-
const
|
|
12641
|
+
const a = pe(this.query) && s.size === this.query.limit ? s.last() : null, c = Te(this.query) && s.size === this.query.limit ? s.first() : null;
|
|
12642
12642
|
// Drop documents out to meet limit/limitToLast requirement.
|
|
12643
12643
|
if (t.inorderTraversal(((t, e) => {
|
|
12644
12644
|
const u = s.get(t), h = De(this.query, e) ? e : null, l = !!u && this.mutatedKeys.has(u.key), f = !!h && (h.hasLocalMutations ||
|
|
@@ -12654,7 +12654,7 @@ class ec {
|
|
|
12654
12654
|
}), d = !0) : this.Vo(u, h) || (n.track({
|
|
12655
12655
|
type: 2 /* Modified */ ,
|
|
12656
12656
|
doc: h
|
|
12657
|
-
}), d = !0, (
|
|
12657
|
+
}), d = !0, (a && this.Ao(h, a) > 0 || c && this.Ao(h, c) < 0) && (
|
|
12658
12658
|
// This doc moved from inside the limit to outside the limit.
|
|
12659
12659
|
// That means there may be some other doc in the local cache
|
|
12660
12660
|
// that should be included instead.
|
|
@@ -12665,7 +12665,7 @@ class ec {
|
|
|
12665
12665
|
}), d = !0) : u && !h && (n.track({
|
|
12666
12666
|
type: 1 /* Removed */ ,
|
|
12667
12667
|
doc: u
|
|
12668
|
-
}), d = !0, (
|
|
12668
|
+
}), d = !0, (a || c) && (
|
|
12669
12669
|
// A doc was removed from a full limit query. We'll need to
|
|
12670
12670
|
// requery from the local cache to see if we know about some other
|
|
12671
12671
|
// doc that should be in the results.
|
|
@@ -12749,10 +12749,10 @@ class ec {
|
|
|
12749
12749
|
* See the License for the specific language governing permissions and
|
|
12750
12750
|
* limitations under the License.
|
|
12751
12751
|
*/ (t.type, e.type) || this.Ao(t.doc, e.doc))), this.So(n);
|
|
12752
|
-
const r = e ? this.Do() : [], o = 0 === this.Io.size && this.current ? 1 /* Synced */ : 0 /* Local */ ,
|
|
12753
|
-
if (this.Eo = o, 0 !== i.length ||
|
|
12752
|
+
const r = e ? this.Do() : [], o = 0 === this.Io.size && this.current ? 1 /* Synced */ : 0 /* Local */ , a = o !== this.Eo;
|
|
12753
|
+
if (this.Eo = o, 0 !== i.length || a) {
|
|
12754
12754
|
return {
|
|
12755
|
-
snapshot: new Uo(this.query, t.Ro, s, i, t.mutatedKeys, 0 /* Local */ === o,
|
|
12755
|
+
snapshot: new Uo(this.query, t.Ro, s, i, t.mutatedKeys, 0 /* Local */ === o, a,
|
|
12756
12756
|
/* excludesMetadataChanges= */ !1),
|
|
12757
12757
|
Co: r
|
|
12758
12758
|
};
|
|
@@ -12808,9 +12808,9 @@ class ec {
|
|
|
12808
12808
|
// Diff the new limbo docs with the old limbo docs.
|
|
12809
12809
|
const e = [];
|
|
12810
12810
|
return t.forEach((t => {
|
|
12811
|
-
this.Io.has(t) || e.push(new
|
|
12811
|
+
this.Io.has(t) || e.push(new ea(t));
|
|
12812
12812
|
})), this.Io.forEach((n => {
|
|
12813
|
-
t.has(n) || e.push(new
|
|
12813
|
+
t.has(n) || e.push(new ta(n));
|
|
12814
12814
|
})), e;
|
|
12815
12815
|
}
|
|
12816
12816
|
/**
|
|
@@ -12853,7 +12853,7 @@ class ec {
|
|
|
12853
12853
|
* QueryView contains all of the data that SyncEngine needs to keep track of for
|
|
12854
12854
|
* a particular query.
|
|
12855
12855
|
*/
|
|
12856
|
-
class
|
|
12856
|
+
class sa {
|
|
12857
12857
|
constructor(
|
|
12858
12858
|
/**
|
|
12859
12859
|
* The query itself.
|
|
@@ -12875,7 +12875,7 @@ class sc {
|
|
|
12875
12875
|
}
|
|
12876
12876
|
}
|
|
12877
12877
|
|
|
12878
|
-
/** Tracks a limbo resolution. */ class
|
|
12878
|
+
/** Tracks a limbo resolution. */ class ia {
|
|
12879
12879
|
constructor(t) {
|
|
12880
12880
|
this.key = t,
|
|
12881
12881
|
/**
|
|
@@ -12900,7 +12900,7 @@ class sc {
|
|
|
12900
12900
|
* the class is not exported so they are only accessible from this module.
|
|
12901
12901
|
* This is useful to implement optional features (like bundles) in free
|
|
12902
12902
|
* functions, such that they are tree-shakeable.
|
|
12903
|
-
*/ class
|
|
12903
|
+
*/ class ra {
|
|
12904
12904
|
constructor(t, e, n,
|
|
12905
12905
|
// PORTING NOTE: Manages state synchronization in multi-tab environments.
|
|
12906
12906
|
s, i, r) {
|
|
@@ -12946,8 +12946,8 @@ class sc {
|
|
|
12946
12946
|
* server. All the subsequent view snapshots or errors are sent to the
|
|
12947
12947
|
* subscribed handlers. Returns the initial snapshot.
|
|
12948
12948
|
*/
|
|
12949
|
-
async function
|
|
12950
|
-
const n = $
|
|
12949
|
+
async function oa(t, e) {
|
|
12950
|
+
const n = $a(t);
|
|
12951
12951
|
let s, i;
|
|
12952
12952
|
const r = n.Mo.get(e);
|
|
12953
12953
|
if (r)
|
|
@@ -12959,7 +12959,7 @@ async function oc(t, e) {
|
|
|
12959
12959
|
// case and calls `listen` to obtain this ID.
|
|
12960
12960
|
s = r.targetId, n.sharedClientState.addLocalQueryTarget(s), i = r.view.xo(); else {
|
|
12961
12961
|
const t = await Tr(n.localStore, be(e)), r = n.sharedClientState.addLocalQueryTarget(t.targetId);
|
|
12962
|
-
s = t.targetId, i = await
|
|
12962
|
+
s = t.targetId, i = await aa(n, e, s, "current" === r), n.isPrimaryClient && lo(n.remoteStore, t);
|
|
12963
12963
|
}
|
|
12964
12964
|
return i;
|
|
12965
12965
|
}
|
|
@@ -12967,7 +12967,7 @@ async function oc(t, e) {
|
|
|
12967
12967
|
/**
|
|
12968
12968
|
* Registers a view for a previously unknown query and computes its initial
|
|
12969
12969
|
* snapshot.
|
|
12970
|
-
*/ async function
|
|
12970
|
+
*/ async function aa(t, e, n, s) {
|
|
12971
12971
|
// PORTING NOTE: On Web only, we inject the code that registers new Limbo
|
|
12972
12972
|
// targets based on view changes. This allows us to only depend on Limbo
|
|
12973
12973
|
// changes when user code includes queries.
|
|
@@ -12981,17 +12981,17 @@ async function oc(t, e) {
|
|
|
12981
12981
|
/* usePreviousResults= */ !1).then((({documents: t}) => e.view.Po(t, i))));
|
|
12982
12982
|
const r = s && s.targetChanges.get(e.targetId), o = e.view.applyChanges(i,
|
|
12983
12983
|
/* updateLimboDocuments= */ t.isPrimaryClient, r);
|
|
12984
|
-
return
|
|
12984
|
+
return Ta(t, e.targetId, o.Co), o.snapshot;
|
|
12985
12985
|
}(t, e, n, s);
|
|
12986
12986
|
const i = await Ir(t.localStore, e,
|
|
12987
|
-
/* usePreviousResults= */ !0), r = new
|
|
12988
|
-
/* updateLimboDocuments= */ t.isPrimaryClient,
|
|
12989
|
-
|
|
12990
|
-
const u = new
|
|
12991
|
-
return t.Mo.set(e, u), t.Fo.has(n) ? t.Fo.get(n).push(e) : t.Fo.set(n, [ e ]),
|
|
12987
|
+
/* usePreviousResults= */ !0), r = new na(e, i.zn), o = r.Po(i.documents), a = xn.createSynthesizedTargetChangeForCurrentChange(n, s && "Offline" /* Offline */ !== t.onlineState), c = r.applyChanges(o,
|
|
12988
|
+
/* updateLimboDocuments= */ t.isPrimaryClient, a);
|
|
12989
|
+
Ta(t, n, c.Co);
|
|
12990
|
+
const u = new sa(e, n, r);
|
|
12991
|
+
return t.Mo.set(e, u), t.Fo.has(n) ? t.Fo.get(n).push(e) : t.Fo.set(n, [ e ]), c.snapshot;
|
|
12992
12992
|
}
|
|
12993
12993
|
|
|
12994
|
-
/** Stops listening to the query. */ async function
|
|
12994
|
+
/** Stops listening to the query. */ async function ca(t, e) {
|
|
12995
12995
|
const n = K(t), s = n.Mo.get(e), i = n.Fo.get(s.targetId);
|
|
12996
12996
|
if (i.length > 1) return n.Fo.set(s.targetId, i.filter((t => !ve(t, e)))), void n.Mo.delete(e);
|
|
12997
12997
|
// No other queries are mapped to the target, clean up the query and the target.
|
|
@@ -13002,9 +13002,9 @@ async function oc(t, e) {
|
|
|
13002
13002
|
n.sharedClientState.isActiveQueryTarget(s.targetId) || await Er(n.localStore, s.targetId,
|
|
13003
13003
|
/*keepPersistedTargetData=*/ !1).then((() => {
|
|
13004
13004
|
n.sharedClientState.clearQueryState(s.targetId), fo(n.remoteStore, s.targetId),
|
|
13005
|
-
|
|
13005
|
+
ya(n, s.targetId);
|
|
13006
13006
|
})).catch(Ui);
|
|
13007
|
-
} else
|
|
13007
|
+
} else ya(n, s.targetId), await Er(n.localStore, s.targetId,
|
|
13008
13008
|
/*keepPersistedTargetData=*/ !0);
|
|
13009
13009
|
}
|
|
13010
13010
|
|
|
@@ -13017,11 +13017,11 @@ async function oc(t, e) {
|
|
|
13017
13017
|
* have completed, *not* when the write was acked by the backend. The
|
|
13018
13018
|
* userCallback is resolved once the write was acked/rejected by the
|
|
13019
13019
|
* backend (or failed locally for any other reason).
|
|
13020
|
-
*/ async function
|
|
13021
|
-
const s =
|
|
13020
|
+
*/ async function ua(t, e, n) {
|
|
13021
|
+
const s = Oa(t);
|
|
13022
13022
|
try {
|
|
13023
13023
|
const t = await function(t, e) {
|
|
13024
|
-
const n = K(t), s =
|
|
13024
|
+
const n = K(t), s = ct.now(), i = e.reduce(((t, e) => t.add(e.key)), Dn());
|
|
13025
13025
|
let r;
|
|
13026
13026
|
return n.persistence.runTransaction("Locally write mutations", "readwrite", (t => n.Wn.vn(t, i).next((i => {
|
|
13027
13027
|
r = i;
|
|
@@ -13037,7 +13037,7 @@ async function oc(t, e) {
|
|
|
13037
13037
|
// NOTE: The base state should only be applied if there's some
|
|
13038
13038
|
// existing document to override, so use a Precondition of
|
|
13039
13039
|
// exists=true
|
|
13040
|
-
o.push(new
|
|
13040
|
+
o.push(new an(t.key, e, Wt(e.value.mapValue), Ye.exists(!0)));
|
|
13041
13041
|
}
|
|
13042
13042
|
return n.An.addMutationBatch(t, s, o, e);
|
|
13043
13043
|
})))).then((t => (t.applyToLocalDocumentSet(r), {
|
|
@@ -13053,7 +13053,7 @@ async function oc(t, e) {
|
|
|
13053
13053
|
/**
|
|
13054
13054
|
* Resolves or rejects the user callback for the given batch and then discards
|
|
13055
13055
|
* it.
|
|
13056
|
-
*/ (s, t.batchId, n), await
|
|
13056
|
+
*/ (s, t.batchId, n), await Aa(s, t.changes), await bo(s.remoteStore);
|
|
13057
13057
|
} catch (t) {
|
|
13058
13058
|
// If we can't persist the mutation, we reject the user callback and
|
|
13059
13059
|
// don't send the mutation. The user can then retry the write.
|
|
@@ -13066,7 +13066,7 @@ async function oc(t, e) {
|
|
|
13066
13066
|
* Applies one remote event to the sync engine, notifying any views of the
|
|
13067
13067
|
* changes, and releasing any pending mutation batches that would become
|
|
13068
13068
|
* visible because of the snapshot version the remote event contains.
|
|
13069
|
-
*/ async function
|
|
13069
|
+
*/ async function ha(t, e) {
|
|
13070
13070
|
const n = K(t);
|
|
13071
13071
|
try {
|
|
13072
13072
|
const t = await gr(n.localStore, e);
|
|
@@ -13079,7 +13079,7 @@ async function oc(t, e) {
|
|
|
13079
13079
|
U(t.addedDocuments.size + t.modifiedDocuments.size + t.removedDocuments.size <= 1),
|
|
13080
13080
|
t.addedDocuments.size > 0 ? s.$o = !0 : t.modifiedDocuments.size > 0 ? U(s.$o) : t.removedDocuments.size > 0 && (U(s.$o),
|
|
13081
13081
|
s.$o = !1));
|
|
13082
|
-
})), await
|
|
13082
|
+
})), await Aa(n, t, e);
|
|
13083
13083
|
} catch (t) {
|
|
13084
13084
|
await Ui(t);
|
|
13085
13085
|
}
|
|
@@ -13088,7 +13088,7 @@ async function oc(t, e) {
|
|
|
13088
13088
|
/**
|
|
13089
13089
|
* Applies an OnlineState change to the sync engine and notifies any views of
|
|
13090
13090
|
* the change.
|
|
13091
|
-
*/ function
|
|
13091
|
+
*/ function la(t, e, n) {
|
|
13092
13092
|
const s = K(t);
|
|
13093
13093
|
// If we are the secondary client, we explicitly ignore the remote store's
|
|
13094
13094
|
// online state (the local client may go offline, even though the primary
|
|
@@ -13122,7 +13122,7 @@ async function oc(t, e) {
|
|
|
13122
13122
|
* @param err - A description of the condition that has forced the rejection.
|
|
13123
13123
|
* Nearly always this will be an indication that the user is no longer
|
|
13124
13124
|
* authorized to see the data matching the target.
|
|
13125
|
-
*/ async function
|
|
13125
|
+
*/ async function fa(t, e, n) {
|
|
13126
13126
|
const s = K(t);
|
|
13127
13127
|
// PORTING NOTE: Multi-tab only.
|
|
13128
13128
|
s.sharedClientState.updateQueryState(e, "rejected", n);
|
|
@@ -13139,18 +13139,18 @@ async function oc(t, e) {
|
|
|
13139
13139
|
const n = Dn().add(r), i = new kn(ut.min(),
|
|
13140
13140
|
/* targetChanges= */ new Map,
|
|
13141
13141
|
/* targetMismatches= */ new En(rt), t, n);
|
|
13142
|
-
await
|
|
13142
|
+
await ha(s, i),
|
|
13143
13143
|
// Since this query failed, we won't want to manually unlisten to it.
|
|
13144
13144
|
// We only remove it from bookkeeping after we successfully applied the
|
|
13145
13145
|
// RemoteEvent. If `applyRemoteEvent()` throws, we want to re-listen to
|
|
13146
13146
|
// this query when the RemoteStore restarts the Watch stream, which should
|
|
13147
13147
|
// re-trigger the target failure.
|
|
13148
|
-
s.Bo = s.Bo.remove(r), s.Uo.delete(e),
|
|
13148
|
+
s.Bo = s.Bo.remove(r), s.Uo.delete(e), Ia(s);
|
|
13149
13149
|
} else await Er(s.localStore, e,
|
|
13150
|
-
/* keepPersistedTargetData */ !1).then((() =>
|
|
13150
|
+
/* keepPersistedTargetData */ !1).then((() => ya(s, e, n))).catch(Ui);
|
|
13151
13151
|
}
|
|
13152
13152
|
|
|
13153
|
-
async function
|
|
13153
|
+
async function da(t, e) {
|
|
13154
13154
|
const n = K(t), s = e.batch.batchId;
|
|
13155
13155
|
try {
|
|
13156
13156
|
const t = await _r(n.localStore, e);
|
|
@@ -13158,14 +13158,14 @@ async function dc(t, e) {
|
|
|
13158
13158
|
// raise events immediately (depending on whether the watcher is caught
|
|
13159
13159
|
// up), so we raise user callbacks first so that they consistently happen
|
|
13160
13160
|
// before listen events.
|
|
13161
|
-
|
|
13162
|
-
await
|
|
13161
|
+
ga(n, s, /*error=*/ null), ma(n, s), n.sharedClientState.updateMutationState(s, "acknowledged"),
|
|
13162
|
+
await Aa(n, t);
|
|
13163
13163
|
} catch (t) {
|
|
13164
13164
|
await Ui(t);
|
|
13165
13165
|
}
|
|
13166
13166
|
}
|
|
13167
13167
|
|
|
13168
|
-
async function
|
|
13168
|
+
async function wa(t, e, n) {
|
|
13169
13169
|
const s = K(t);
|
|
13170
13170
|
try {
|
|
13171
13171
|
const t = await function(t, e) {
|
|
@@ -13185,8 +13185,8 @@ async function wc(t, e, n) {
|
|
|
13185
13185
|
// raise events immediately (depending on whether the watcher is caught up),
|
|
13186
13186
|
// so we raise user callbacks first so that they consistently happen before
|
|
13187
13187
|
// listen events.
|
|
13188
|
-
|
|
13189
|
-
await
|
|
13188
|
+
ga(s, e, n), ma(s, e), s.sharedClientState.updateMutationState(e, "rejected", n),
|
|
13189
|
+
await Aa(s, t);
|
|
13190
13190
|
} catch (n) {
|
|
13191
13191
|
await Ui(n);
|
|
13192
13192
|
}
|
|
@@ -13195,7 +13195,7 @@ async function wc(t, e, n) {
|
|
|
13195
13195
|
/**
|
|
13196
13196
|
* Registers a user callback that resolves when all pending mutations at the moment of calling
|
|
13197
13197
|
* are acknowledged .
|
|
13198
|
-
*/ async function
|
|
13198
|
+
*/ async function _a(t, e) {
|
|
13199
13199
|
const n = K(t);
|
|
13200
13200
|
yo(n.remoteStore) || O("SyncEngine", "The network is disabled. The task returned by 'awaitPendingWrites()' will not complete until the network is enabled.");
|
|
13201
13201
|
try {
|
|
@@ -13217,13 +13217,13 @@ async function wc(t, e, n) {
|
|
|
13217
13217
|
/**
|
|
13218
13218
|
* Triggers the callbacks that are waiting for this batch id to get acknowledged by server,
|
|
13219
13219
|
* if there are any.
|
|
13220
|
-
*/ function
|
|
13220
|
+
*/ function ma(t, e) {
|
|
13221
13221
|
(t.jo.get(e) || []).forEach((t => {
|
|
13222
13222
|
t.resolve();
|
|
13223
13223
|
})), t.jo.delete(e);
|
|
13224
13224
|
}
|
|
13225
13225
|
|
|
13226
|
-
/** Reject all outstanding callbacks waiting for pending writes to complete. */ function
|
|
13226
|
+
/** Reject all outstanding callbacks waiting for pending writes to complete. */ function ga(t, e, n) {
|
|
13227
13227
|
const s = K(t);
|
|
13228
13228
|
let i = s.Ko[s.currentUser.toKey()];
|
|
13229
13229
|
// NOTE: Mutations restored from persistence won't have callbacks, so it's
|
|
@@ -13234,39 +13234,39 @@ async function wc(t, e, n) {
|
|
|
13234
13234
|
}
|
|
13235
13235
|
}
|
|
13236
13236
|
|
|
13237
|
-
function
|
|
13237
|
+
function ya(t, e, n = null) {
|
|
13238
13238
|
t.sharedClientState.removeLocalQueryTarget(e);
|
|
13239
13239
|
for (const s of t.Fo.get(e)) t.Mo.delete(s), n && t.Oo.zo(s, n);
|
|
13240
13240
|
if (t.Fo.delete(e), t.isPrimaryClient) {
|
|
13241
13241
|
t.qo.us(e).forEach((e => {
|
|
13242
13242
|
t.qo.containsKey(e) ||
|
|
13243
13243
|
// We removed the last reference for this key
|
|
13244
|
-
|
|
13244
|
+
pa(t, e);
|
|
13245
13245
|
}));
|
|
13246
13246
|
}
|
|
13247
13247
|
}
|
|
13248
13248
|
|
|
13249
|
-
function
|
|
13249
|
+
function pa(t, e) {
|
|
13250
13250
|
t.Lo.delete(e.path.canonicalString());
|
|
13251
13251
|
// It's possible that the target already got removed because the query failed. In that case,
|
|
13252
13252
|
// the key won't exist in `limboTargetsByKey`. Only do the cleanup if we still have the target.
|
|
13253
13253
|
const n = t.Bo.get(e);
|
|
13254
|
-
null !== n && (fo(t.remoteStore, n), t.Bo = t.Bo.remove(e), t.Uo.delete(n),
|
|
13254
|
+
null !== n && (fo(t.remoteStore, n), t.Bo = t.Bo.remove(e), t.Uo.delete(n), Ia(t));
|
|
13255
13255
|
}
|
|
13256
13256
|
|
|
13257
|
-
function
|
|
13258
|
-
for (const s of n) if (s instanceof
|
|
13257
|
+
function Ta(t, e, n) {
|
|
13258
|
+
for (const s of n) if (s instanceof ta) t.qo.addReference(s.key, e), Ea(t, s); else if (s instanceof ea) {
|
|
13259
13259
|
O("SyncEngine", "Document no longer in limbo: " + s.key), t.qo.removeReference(s.key, e);
|
|
13260
13260
|
t.qo.containsKey(s.key) ||
|
|
13261
13261
|
// We removed the last reference for this key
|
|
13262
|
-
|
|
13262
|
+
pa(t, s.key);
|
|
13263
13263
|
} else B();
|
|
13264
13264
|
}
|
|
13265
13265
|
|
|
13266
|
-
function
|
|
13266
|
+
function Ea(t, e) {
|
|
13267
13267
|
const n = e.key, s = n.path.canonicalString();
|
|
13268
13268
|
t.Bo.get(n) || t.Lo.has(s) || (O("SyncEngine", "New document in limbo: " + n), t.Lo.add(s),
|
|
13269
|
-
|
|
13269
|
+
Ia(t));
|
|
13270
13270
|
}
|
|
13271
13271
|
|
|
13272
13272
|
/**
|
|
@@ -13276,23 +13276,23 @@ function Ec(t, e) {
|
|
|
13276
13276
|
* Without bounding the number of concurrent resolutions, the server can fail
|
|
13277
13277
|
* with "resource exhausted" errors which can lead to pathological client
|
|
13278
13278
|
* behavior as seen in https://github.com/firebase/firebase-js-sdk/issues/2683.
|
|
13279
|
-
*/ function
|
|
13279
|
+
*/ function Ia(t) {
|
|
13280
13280
|
for (;t.Lo.size > 0 && t.Bo.size < t.maxConcurrentLimboResolutions; ) {
|
|
13281
13281
|
const e = t.Lo.values().next().value;
|
|
13282
13282
|
t.Lo.delete(e);
|
|
13283
13283
|
const n = new Dt(wt.fromString(e)), s = t.Qo.next();
|
|
13284
|
-
t.Uo.set(s, new
|
|
13284
|
+
t.Uo.set(s, new ia(n)), t.Bo = t.Bo.insert(n, s), lo(t.remoteStore, new ci(be(ye(n.path)), s, 2 /* LimboResolution */ , nt.I));
|
|
13285
13285
|
}
|
|
13286
13286
|
}
|
|
13287
13287
|
|
|
13288
|
-
async function
|
|
13288
|
+
async function Aa(t, e, n) {
|
|
13289
13289
|
const s = K(t), i = [], r = [], o = [];
|
|
13290
|
-
s.Mo.isEmpty() || (s.Mo.forEach(((t,
|
|
13291
|
-
o.push(s.Go(
|
|
13290
|
+
s.Mo.isEmpty() || (s.Mo.forEach(((t, a) => {
|
|
13291
|
+
o.push(s.Go(a, e, n).then((t => {
|
|
13292
13292
|
if (t) {
|
|
13293
|
-
s.isPrimaryClient && s.sharedClientState.updateQueryState(
|
|
13293
|
+
s.isPrimaryClient && s.sharedClientState.updateQueryState(a.targetId, t.fromCache ? "not-current" : "current"),
|
|
13294
13294
|
i.push(t);
|
|
13295
|
-
const e = hr.$n(
|
|
13295
|
+
const e = hr.$n(a.targetId, t);
|
|
13296
13296
|
r.push(e);
|
|
13297
13297
|
}
|
|
13298
13298
|
})));
|
|
@@ -13319,7 +13319,7 @@ async function Ac(t, e, n) {
|
|
|
13319
13319
|
}(s.localStore, r));
|
|
13320
13320
|
}
|
|
13321
13321
|
|
|
13322
|
-
async function
|
|
13322
|
+
async function Ra(t, e) {
|
|
13323
13323
|
const n = K(t);
|
|
13324
13324
|
if (!n.currentUser.isEqual(e)) {
|
|
13325
13325
|
O("SyncEngine", "User change. New user:", e.toKey());
|
|
@@ -13334,11 +13334,11 @@ async function Rc(t, e) {
|
|
|
13334
13334
|
})), t.jo.clear();
|
|
13335
13335
|
}(n, "'waitForPendingWrites' promise is rejected due to a user change."),
|
|
13336
13336
|
// TODO(b/114226417): Consider calling this only in the primary tab.
|
|
13337
|
-
n.sharedClientState.handleUserChange(e, t.removedBatchIds, t.addedBatchIds), await
|
|
13337
|
+
n.sharedClientState.handleUserChange(e, t.removedBatchIds, t.addedBatchIds), await Aa(n, t.Gn);
|
|
13338
13338
|
}
|
|
13339
13339
|
}
|
|
13340
13340
|
|
|
13341
|
-
function
|
|
13341
|
+
function ba(t, e) {
|
|
13342
13342
|
const n = K(t), s = n.Uo.get(e);
|
|
13343
13343
|
if (s && s.$o) return Dn().add(s.key);
|
|
13344
13344
|
{
|
|
@@ -13356,10 +13356,10 @@ function bc(t, e) {
|
|
|
13356
13356
|
/**
|
|
13357
13357
|
* Reconcile the list of synced documents in an existing view with those
|
|
13358
13358
|
* from persistence.
|
|
13359
|
-
*/ async function
|
|
13359
|
+
*/ async function Pa(t, e) {
|
|
13360
13360
|
const n = K(t), s = await Ir(n.localStore, e.query,
|
|
13361
13361
|
/* usePreviousResults= */ !0), i = e.view.ko(s);
|
|
13362
|
-
return n.isPrimaryClient &&
|
|
13362
|
+
return n.isPrimaryClient && Ta(n, e.targetId, i.Co), i;
|
|
13363
13363
|
}
|
|
13364
13364
|
|
|
13365
13365
|
/**
|
|
@@ -13367,14 +13367,14 @@ function bc(t, e) {
|
|
|
13367
13367
|
* snapshots if needed.
|
|
13368
13368
|
*/
|
|
13369
13369
|
// PORTING NOTE: Multi-Tab only.
|
|
13370
|
-
async function
|
|
13370
|
+
async function va(t) {
|
|
13371
13371
|
const e = K(t);
|
|
13372
|
-
return Rr(e.localStore).then((t =>
|
|
13372
|
+
return Rr(e.localStore).then((t => Aa(e, t)));
|
|
13373
13373
|
}
|
|
13374
13374
|
|
|
13375
13375
|
/** Applies a mutation state to an existing batch. */
|
|
13376
13376
|
// PORTING NOTE: Multi-Tab only.
|
|
13377
|
-
async function
|
|
13377
|
+
async function Va(t, e, n, s) {
|
|
13378
13378
|
const i = K(t), r = await function(t, e) {
|
|
13379
13379
|
const n = K(t), s = K(n.An);
|
|
13380
13380
|
return n.persistence.runTransaction("Lookup mutation documents", "readonly", (t => s.Zt(t, e).next((e => e ? n.Wn.vn(t, e) : zs.resolve(null)))));
|
|
@@ -13388,11 +13388,11 @@ async function Vc(t, e, n, s) {
|
|
|
13388
13388
|
await bo(i.remoteStore) : "acknowledged" === n || "rejected" === n ? (
|
|
13389
13389
|
// NOTE: Both these methods are no-ops for batches that originated from
|
|
13390
13390
|
// other clients.
|
|
13391
|
-
|
|
13391
|
+
ga(i, e, s || null), ma(i, e), function(t, e) {
|
|
13392
13392
|
K(K(t).An).ee(e);
|
|
13393
13393
|
}
|
|
13394
13394
|
// PORTING NOTE: Multi-Tab only.
|
|
13395
|
-
(i.localStore, e)) : B(), await
|
|
13395
|
+
(i.localStore, e)) : B(), await Aa(i, r)) :
|
|
13396
13396
|
// A throttled tab may not have seen the mutation before it was completed
|
|
13397
13397
|
// and removed from the mutation queue, in which case we won't have cached
|
|
13398
13398
|
// the affected documents. In this case we can safely ignore the update
|
|
@@ -13405,26 +13405,26 @@ async function Vc(t, e, n, s) {
|
|
|
13405
13405
|
|
|
13406
13406
|
/** Applies a query target change from a different tab. */
|
|
13407
13407
|
// PORTING NOTE: Multi-Tab only.
|
|
13408
|
-
async function
|
|
13408
|
+
async function Sa(t, e) {
|
|
13409
13409
|
const n = K(t);
|
|
13410
|
-
if ($
|
|
13410
|
+
if ($a(n), Oa(n), !0 === e && !0 !== n.Wo) {
|
|
13411
13411
|
// Secondary tabs only maintain Views for their local listeners and the
|
|
13412
13412
|
// Views internal state may not be 100% populated (in particular
|
|
13413
13413
|
// secondary tabs don't track syncedDocuments, the set of documents the
|
|
13414
13414
|
// server considers to be in the target). So when a secondary becomes
|
|
13415
13415
|
// primary, we need to need to make sure that all views for all targets
|
|
13416
13416
|
// match the state on disk.
|
|
13417
|
-
const t = n.sharedClientState.getAllActiveQueryTargets(), e = await
|
|
13417
|
+
const t = n.sharedClientState.getAllActiveQueryTargets(), e = await Da(n, t.toArray());
|
|
13418
13418
|
n.Wo = !0, await xo(n.remoteStore, !0);
|
|
13419
13419
|
for (const t of e) lo(n.remoteStore, t);
|
|
13420
13420
|
} else if (!1 === e && !1 !== n.Wo) {
|
|
13421
13421
|
const t = [];
|
|
13422
13422
|
let e = Promise.resolve();
|
|
13423
13423
|
n.Fo.forEach(((s, i) => {
|
|
13424
|
-
n.sharedClientState.isLocalQueryTarget(i) ? t.push(i) : e = e.then((() => (
|
|
13424
|
+
n.sharedClientState.isLocalQueryTarget(i) ? t.push(i) : e = e.then((() => (ya(n, i),
|
|
13425
13425
|
Er(n.localStore, i,
|
|
13426
13426
|
/*keepPersistedTargetData=*/ !0)))), fo(n.remoteStore, i);
|
|
13427
|
-
})), await e, await
|
|
13427
|
+
})), await e, await Da(n, t),
|
|
13428
13428
|
// PORTING NOTE: Multi-Tab only.
|
|
13429
13429
|
function(t) {
|
|
13430
13430
|
const e = K(t);
|
|
@@ -13447,7 +13447,7 @@ async function Sc(t, e) {
|
|
|
13447
13447
|
}
|
|
13448
13448
|
}
|
|
13449
13449
|
|
|
13450
|
-
async function
|
|
13450
|
+
async function Da(t, e, n) {
|
|
13451
13451
|
const s = K(t), i = [], r = [];
|
|
13452
13452
|
for (const t of e) {
|
|
13453
13453
|
let e;
|
|
@@ -13459,14 +13459,14 @@ async function Dc(t, e, n) {
|
|
|
13459
13459
|
// state (the list of syncedDocuments may have gotten out of sync).
|
|
13460
13460
|
e = await Tr(s.localStore, be(n[0]));
|
|
13461
13461
|
for (const t of n) {
|
|
13462
|
-
const e = s.Mo.get(t), n = await
|
|
13462
|
+
const e = s.Mo.get(t), n = await Pa(s, e);
|
|
13463
13463
|
n.snapshot && r.push(n.snapshot);
|
|
13464
13464
|
}
|
|
13465
13465
|
} else {
|
|
13466
13466
|
// For queries that never executed on this client, we need to
|
|
13467
13467
|
// allocate the target in LocalStore and initialize a new View.
|
|
13468
13468
|
const n = await Ar(s.localStore, t);
|
|
13469
|
-
e = await Tr(s.localStore, n), await
|
|
13469
|
+
e = await Tr(s.localStore, n), await aa(s, Ca(n), t,
|
|
13470
13470
|
/*current=*/ !1);
|
|
13471
13471
|
}
|
|
13472
13472
|
i.push(e);
|
|
@@ -13485,20 +13485,20 @@ async function Dc(t, e, n) {
|
|
|
13485
13485
|
* difference will not cause issues.
|
|
13486
13486
|
*/
|
|
13487
13487
|
// PORTING NOTE: Multi-Tab only.
|
|
13488
|
-
function
|
|
13488
|
+
function Ca(t) {
|
|
13489
13489
|
return ge(t.path, t.collectionGroup, t.orderBy, t.filters, t.limit, "F" /* First */ , t.startAt, t.endAt);
|
|
13490
13490
|
}
|
|
13491
13491
|
|
|
13492
13492
|
/** Returns the IDs of the clients that are currently active. */
|
|
13493
13493
|
// PORTING NOTE: Multi-Tab only.
|
|
13494
|
-
function
|
|
13494
|
+
function Na(t) {
|
|
13495
13495
|
const e = K(t);
|
|
13496
13496
|
return K(K(e.localStore).persistence).Tn();
|
|
13497
13497
|
}
|
|
13498
13498
|
|
|
13499
13499
|
/** Applies a query target change from a different tab. */
|
|
13500
13500
|
// PORTING NOTE: Multi-Tab only.
|
|
13501
|
-
async function
|
|
13501
|
+
async function ka(t, e, n, s) {
|
|
13502
13502
|
const i = K(t);
|
|
13503
13503
|
if (i.Wo)
|
|
13504
13504
|
// If we receive a target state notification via WebStorage, we are
|
|
@@ -13508,13 +13508,13 @@ async function kc(t, e, n, s) {
|
|
|
13508
13508
|
case "not-current":
|
|
13509
13509
|
{
|
|
13510
13510
|
const t = await Rr(i.localStore), s = kn.createSynthesizedRemoteEventForCurrentChange(e, "current" === n);
|
|
13511
|
-
await
|
|
13511
|
+
await Aa(i, t, s);
|
|
13512
13512
|
break;
|
|
13513
13513
|
}
|
|
13514
13514
|
|
|
13515
13515
|
case "rejected":
|
|
13516
13516
|
await Er(i.localStore, e,
|
|
13517
|
-
/* keepPersistedTargetData */ !0),
|
|
13517
|
+
/* keepPersistedTargetData */ !0), ya(i, e, s);
|
|
13518
13518
|
break;
|
|
13519
13519
|
|
|
13520
13520
|
default:
|
|
@@ -13522,8 +13522,8 @@ async function kc(t, e, n, s) {
|
|
|
13522
13522
|
}
|
|
13523
13523
|
}
|
|
13524
13524
|
|
|
13525
|
-
/** Adds or removes Watch targets for queries from different tabs. */ async function
|
|
13526
|
-
const s = $
|
|
13525
|
+
/** Adds or removes Watch targets for queries from different tabs. */ async function xa(t, e, n) {
|
|
13526
|
+
const s = $a(t);
|
|
13527
13527
|
if (s.Wo) {
|
|
13528
13528
|
for (const t of e) {
|
|
13529
13529
|
if (s.Fo.has(t)) {
|
|
@@ -13532,7 +13532,7 @@ async function kc(t, e, n, s) {
|
|
|
13532
13532
|
continue;
|
|
13533
13533
|
}
|
|
13534
13534
|
const e = await Ar(s.localStore, t), n = await Tr(s.localStore, e);
|
|
13535
|
-
await
|
|
13535
|
+
await aa(s, Ca(e), n.targetId,
|
|
13536
13536
|
/*current=*/ !1), lo(s.remoteStore, n);
|
|
13537
13537
|
}
|
|
13538
13538
|
for (const t of n)
|
|
@@ -13542,21 +13542,21 @@ async function kc(t, e, n, s) {
|
|
|
13542
13542
|
// Release queries that are still active.
|
|
13543
13543
|
await Er(s.localStore, t,
|
|
13544
13544
|
/* keepPersistedTargetData */ !1).then((() => {
|
|
13545
|
-
fo(s.remoteStore, t),
|
|
13545
|
+
fo(s.remoteStore, t), ya(s, t);
|
|
13546
13546
|
})).catch(Ui);
|
|
13547
13547
|
}
|
|
13548
13548
|
}
|
|
13549
13549
|
|
|
13550
|
-
function $
|
|
13550
|
+
function $a(t) {
|
|
13551
13551
|
const e = K(t);
|
|
13552
|
-
return e.remoteStore.remoteSyncer.applyRemoteEvent =
|
|
13553
|
-
e.remoteStore.remoteSyncer.rejectListen =
|
|
13552
|
+
return e.remoteStore.remoteSyncer.applyRemoteEvent = ha.bind(null, e), e.remoteStore.remoteSyncer.getRemoteKeysForTarget = ba.bind(null, e),
|
|
13553
|
+
e.remoteStore.remoteSyncer.rejectListen = fa.bind(null, e), e.Oo.br = Wo.bind(null, e.eventManager),
|
|
13554
13554
|
e.Oo.zo = Go.bind(null, e.eventManager), e;
|
|
13555
13555
|
}
|
|
13556
13556
|
|
|
13557
|
-
function
|
|
13557
|
+
function Oa(t) {
|
|
13558
13558
|
const e = K(t);
|
|
13559
|
-
return e.remoteStore.remoteSyncer.applySuccessfulWrite =
|
|
13559
|
+
return e.remoteStore.remoteSyncer.applySuccessfulWrite = da.bind(null, e), e.remoteStore.remoteSyncer.rejectFailedWrite = wa.bind(null, e),
|
|
13560
13560
|
e;
|
|
13561
13561
|
}
|
|
13562
13562
|
|
|
@@ -13567,7 +13567,7 @@ function Oc(t) {
|
|
|
13567
13567
|
* @param syncEngine - SyncEngine to use.
|
|
13568
13568
|
* @param bundleReader - Bundle to load into the SDK.
|
|
13569
13569
|
* @param task - LoadBundleTask used to update the loading progress to public API.
|
|
13570
|
-
*/ function
|
|
13570
|
+
*/ function Ma(t, e, n) {
|
|
13571
13571
|
const s = K(t);
|
|
13572
13572
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
13573
13573
|
(async function(t, e, n) {
|
|
@@ -13599,7 +13599,7 @@ function Oc(t) {
|
|
|
13599
13599
|
// TODO(b/160876443): This currently raises snapshots with
|
|
13600
13600
|
// `fromCache=false` if users already listen to some queries and bundles
|
|
13601
13601
|
// has newer version.
|
|
13602
|
-
await
|
|
13602
|
+
await Aa(t, o.In,
|
|
13603
13603
|
/* remoteEvent */ void 0),
|
|
13604
13604
|
// Save metadata, so loading the same bundle will skip.
|
|
13605
13605
|
await function(t, e) {
|
|
@@ -13638,7 +13638,7 @@ function Oc(t) {
|
|
|
13638
13638
|
}));
|
|
13639
13639
|
}
|
|
13640
13640
|
|
|
13641
|
-
class
|
|
13641
|
+
class Fa {
|
|
13642
13642
|
constructor() {
|
|
13643
13643
|
this.synchronizeTabs = !1;
|
|
13644
13644
|
}
|
|
@@ -13666,14 +13666,14 @@ class Fc {
|
|
|
13666
13666
|
|
|
13667
13667
|
/**
|
|
13668
13668
|
* Provides all components needed for Firestore with IndexedDB persistence.
|
|
13669
|
-
*/ class
|
|
13669
|
+
*/ class La extends Fa {
|
|
13670
13670
|
constructor(t, e, n) {
|
|
13671
|
-
super(), this.
|
|
13671
|
+
super(), this.ta = t, this.cacheSizeBytes = e, this.forceOwnership = n, this.synchronizeTabs = !1;
|
|
13672
13672
|
}
|
|
13673
13673
|
async initialize(t) {
|
|
13674
|
-
await super.initialize(t), await br(this.localStore), await this.
|
|
13674
|
+
await super.initialize(t), await br(this.localStore), await this.ta.initialize(this, t),
|
|
13675
13675
|
// Enqueue writes from a previous session
|
|
13676
|
-
await
|
|
13676
|
+
await Oa(this.ta.syncEngine), await bo(this.ta.remoteStore),
|
|
13677
13677
|
// NOTE: This will immediately call the listener, so we make sure to
|
|
13678
13678
|
// set it after localStore / remoteStore are started.
|
|
13679
13679
|
await this.persistence.sn((() => (this.gcScheduler && !this.gcScheduler.started && this.gcScheduler.start(this.localStore),
|
|
@@ -13687,7 +13687,7 @@ class Fc {
|
|
|
13687
13687
|
return new ji(e, t.asyncQueue);
|
|
13688
13688
|
}
|
|
13689
13689
|
Yo(t) {
|
|
13690
|
-
const e =
|
|
13690
|
+
const e = ar(t.databaseInfo.databaseId, t.databaseInfo.persistenceKey), n = void 0 !== this.cacheSizeBytes ? Vi.withCacheSize(this.cacheSizeBytes) : Vi.DEFAULT;
|
|
13691
13691
|
return new ir(this.synchronizeTabs, e, t.clientId, n, t.asyncQueue, Zr(), to(), this.k, this.sharedClientState, !!this.forceOwnership);
|
|
13692
13692
|
}
|
|
13693
13693
|
Jo(t) {
|
|
@@ -13702,30 +13702,30 @@ class Fc {
|
|
|
13702
13702
|
* In the legacy client, this provider is used to provide both multi-tab and
|
|
13703
13703
|
* non-multi-tab persistence since we cannot tell at build time whether
|
|
13704
13704
|
* `synchronizeTabs` will be enabled.
|
|
13705
|
-
*/ class
|
|
13705
|
+
*/ class Ba extends La {
|
|
13706
13706
|
constructor(t, e) {
|
|
13707
|
-
super(t, e, /* forceOwnership= */ !1), this.
|
|
13707
|
+
super(t, e, /* forceOwnership= */ !1), this.ta = t, this.cacheSizeBytes = e, this.synchronizeTabs = !0;
|
|
13708
13708
|
}
|
|
13709
13709
|
async initialize(t) {
|
|
13710
13710
|
await super.initialize(t);
|
|
13711
|
-
const e = this.
|
|
13711
|
+
const e = this.ta.syncEngine;
|
|
13712
13712
|
this.sharedClientState instanceof Wr && (this.sharedClientState.syncEngine = {
|
|
13713
|
-
mi:
|
|
13714
|
-
gi:
|
|
13715
|
-
yi:
|
|
13716
|
-
Tn:
|
|
13717
|
-
_i:
|
|
13713
|
+
mi: Va.bind(null, e),
|
|
13714
|
+
gi: ka.bind(null, e),
|
|
13715
|
+
yi: xa.bind(null, e),
|
|
13716
|
+
Tn: Na.bind(null, e),
|
|
13717
|
+
_i: va.bind(null, e)
|
|
13718
13718
|
}, await this.sharedClientState.start()),
|
|
13719
13719
|
// NOTE: This will immediately call the listener, so we make sure to
|
|
13720
13720
|
// set it after localStore / remoteStore are started.
|
|
13721
13721
|
await this.persistence.sn((async t => {
|
|
13722
|
-
await
|
|
13722
|
+
await Sa(this.ta.syncEngine, t), this.gcScheduler && (t && !this.gcScheduler.started ? this.gcScheduler.start(this.localStore) : t || this.gcScheduler.stop());
|
|
13723
13723
|
}));
|
|
13724
13724
|
}
|
|
13725
13725
|
Jo(t) {
|
|
13726
13726
|
const e = Zr();
|
|
13727
13727
|
if (!Wr.Pt(e)) throw new Q(j.UNIMPLEMENTED, "IndexedDB persistence is only available on platforms that support LocalStorage.");
|
|
13728
|
-
const n =
|
|
13728
|
+
const n = ar(t.databaseInfo.databaseId, t.databaseInfo.persistenceKey);
|
|
13729
13729
|
return new Wr(e, t.asyncQueue, n, t.clientId, t.initialUser);
|
|
13730
13730
|
}
|
|
13731
13731
|
}
|
|
@@ -13733,13 +13733,13 @@ class Fc {
|
|
|
13733
13733
|
/**
|
|
13734
13734
|
* Initializes and wires the components that are needed to interface with the
|
|
13735
13735
|
* network.
|
|
13736
|
-
*/ class
|
|
13736
|
+
*/ class Ua {
|
|
13737
13737
|
async initialize(t, e) {
|
|
13738
13738
|
this.localStore || (this.localStore = t.localStore, this.sharedClientState = t.sharedClientState,
|
|
13739
13739
|
this.datastore = this.createDatastore(e), this.remoteStore = this.createRemoteStore(e),
|
|
13740
13740
|
this.eventManager = this.createEventManager(e), this.syncEngine = this.createSyncEngine(e,
|
|
13741
|
-
/* startAsPrimary=*/ !t.synchronizeTabs), this.sharedClientState.onlineStateHandler = t =>
|
|
13742
|
-
this.remoteStore.remoteSyncer.handleCredentialChange =
|
|
13741
|
+
/* startAsPrimary=*/ !t.synchronizeTabs), this.sharedClientState.onlineStateHandler = t => la(this.syncEngine, t, 1 /* SharedClientState */),
|
|
13742
|
+
this.remoteStore.remoteSyncer.handleCredentialChange = Ra.bind(null, this.syncEngine),
|
|
13743
13743
|
await xo(this.remoteStore, this.syncEngine.isPrimaryClient));
|
|
13744
13744
|
}
|
|
13745
13745
|
createEventManager(t) {
|
|
@@ -13753,16 +13753,16 @@ class Fc {
|
|
|
13753
13753
|
}(t.authCredentials, t.appCheckCredentials, n, e);
|
|
13754
13754
|
}
|
|
13755
13755
|
createRemoteStore(t) {
|
|
13756
|
-
return e = this.localStore, n = this.datastore, s = t.asyncQueue, i = t =>
|
|
13757
|
-
r = Hr.Pt() ? new Hr : new zr, new
|
|
13756
|
+
return e = this.localStore, n = this.datastore, s = t.asyncQueue, i = t => la(this.syncEngine, t, 0 /* RemoteStore */),
|
|
13757
|
+
r = Hr.Pt() ? new Hr : new zr, new co(e, n, s, i, r);
|
|
13758
13758
|
var e, n, s, i, r;
|
|
13759
13759
|
/** Re-enables the network. Idempotent. */ }
|
|
13760
13760
|
createSyncEngine(t, e) {
|
|
13761
13761
|
return function(t, e, n,
|
|
13762
13762
|
// PORTING NOTE: Manages state synchronization in multi-tab environments.
|
|
13763
13763
|
s, i, r, o) {
|
|
13764
|
-
const
|
|
13765
|
-
return o && (
|
|
13764
|
+
const a = new ra(t, e, n, s, i, r);
|
|
13765
|
+
return o && (a.Wo = !0), a;
|
|
13766
13766
|
}(this.localStore, this.remoteStore, this.eventManager, this.sharedClientState, t.initialUser, t.maxConcurrentLimboResolutions, e);
|
|
13767
13767
|
}
|
|
13768
13768
|
terminate() {
|
|
@@ -13804,7 +13804,7 @@ class Fc {
|
|
|
13804
13804
|
* @param bytesPerRead - How many bytes each `read()` from the returned reader
|
|
13805
13805
|
* will read.
|
|
13806
13806
|
*/
|
|
13807
|
-
function
|
|
13807
|
+
function qa(t, e = 10240) {
|
|
13808
13808
|
let n = 0;
|
|
13809
13809
|
// The TypeScript definition for ReadableStreamReader changed. We use
|
|
13810
13810
|
// `any` here to allow this code to compile with different versions.
|
|
@@ -13870,7 +13870,7 @@ function qc(t, e = 10240) {
|
|
|
13870
13870
|
* asynchronously. To allow immediate silencing, a mute call is added which
|
|
13871
13871
|
* causes events scheduled to no longer be raised.
|
|
13872
13872
|
*/
|
|
13873
|
-
class
|
|
13873
|
+
class Ka {
|
|
13874
13874
|
constructor(t) {
|
|
13875
13875
|
this.observer = t,
|
|
13876
13876
|
/**
|
|
@@ -13880,15 +13880,15 @@ class Kc {
|
|
|
13880
13880
|
this.muted = !1;
|
|
13881
13881
|
}
|
|
13882
13882
|
next(t) {
|
|
13883
|
-
this.observer.next && this.
|
|
13883
|
+
this.observer.next && this.ea(this.observer.next, t);
|
|
13884
13884
|
}
|
|
13885
13885
|
error(t) {
|
|
13886
|
-
this.observer.error ? this.
|
|
13886
|
+
this.observer.error ? this.ea(this.observer.error, t) : console.error("Uncaught Error in snapshot listener:", t);
|
|
13887
13887
|
}
|
|
13888
|
-
|
|
13888
|
+
na() {
|
|
13889
13889
|
this.muted = !0;
|
|
13890
13890
|
}
|
|
13891
|
-
|
|
13891
|
+
ea(t, e) {
|
|
13892
13892
|
this.muted || setTimeout((() => {
|
|
13893
13893
|
this.muted || t(e);
|
|
13894
13894
|
}), 0);
|
|
@@ -13916,32 +13916,32 @@ class Kc {
|
|
|
13916
13916
|
*
|
|
13917
13917
|
* Takes a bundle stream or buffer, and presents abstractions to read bundled
|
|
13918
13918
|
* elements out of the underlying content.
|
|
13919
|
-
*/ class
|
|
13919
|
+
*/ class ja {
|
|
13920
13920
|
constructor(
|
|
13921
13921
|
/** The reader to read from underlying binary bundle data source. */
|
|
13922
13922
|
t, e) {
|
|
13923
|
-
this.
|
|
13923
|
+
this.sa = t, this.k = e,
|
|
13924
13924
|
/** Cached bundle metadata. */
|
|
13925
13925
|
this.metadata = new W,
|
|
13926
13926
|
/**
|
|
13927
13927
|
* Internal buffer to hold bundle content, accumulating incomplete element
|
|
13928
13928
|
* content.
|
|
13929
13929
|
*/
|
|
13930
|
-
this.buffer = new Uint8Array, this.
|
|
13930
|
+
this.buffer = new Uint8Array, this.ia = new TextDecoder("utf-8"),
|
|
13931
13931
|
// Read the metadata (which is the first element).
|
|
13932
|
-
this.
|
|
13932
|
+
this.ra().then((t => {
|
|
13933
13933
|
t && t._o() ? 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)}`));
|
|
13934
13934
|
}), (t => this.metadata.reject(t)));
|
|
13935
13935
|
}
|
|
13936
13936
|
close() {
|
|
13937
|
-
return this.
|
|
13937
|
+
return this.sa.cancel();
|
|
13938
13938
|
}
|
|
13939
13939
|
async getMetadata() {
|
|
13940
13940
|
return this.metadata.promise;
|
|
13941
13941
|
}
|
|
13942
13942
|
async Ho() {
|
|
13943
13943
|
// Makes sure metadata is read before proceeding.
|
|
13944
|
-
return await this.getMetadata(), this.
|
|
13944
|
+
return await this.getMetadata(), this.ra();
|
|
13945
13945
|
}
|
|
13946
13946
|
/**
|
|
13947
13947
|
* Reads from the head of internal buffer, and pulling more data from
|
|
@@ -13952,15 +13952,15 @@ class Kc {
|
|
|
13952
13952
|
*
|
|
13953
13953
|
* Returns either the bundled element, or null if we have reached the end of
|
|
13954
13954
|
* the stream.
|
|
13955
|
-
*/ async
|
|
13956
|
-
const t = await this.
|
|
13955
|
+
*/ async ra() {
|
|
13956
|
+
const t = await this.oa();
|
|
13957
13957
|
if (null === t) return null;
|
|
13958
|
-
const e = this.
|
|
13959
|
-
isNaN(n) && this.
|
|
13960
|
-
const s = await this.
|
|
13958
|
+
const e = this.ia.decode(t), n = Number(e);
|
|
13959
|
+
isNaN(n) && this.aa(`length string (${e}) is not valid number`);
|
|
13960
|
+
const s = await this.ca(n);
|
|
13961
13961
|
return new Jo(JSON.parse(s), t.length + n);
|
|
13962
13962
|
}
|
|
13963
|
-
/** First index of '{' from the underlying buffer. */
|
|
13963
|
+
/** First index of '{' from the underlying buffer. */ ua() {
|
|
13964
13964
|
return this.buffer.findIndex((t => t === "{".charCodeAt(0)));
|
|
13965
13965
|
}
|
|
13966
13966
|
/**
|
|
@@ -13968,17 +13968,17 @@ class Kc {
|
|
|
13968
13968
|
* return the content.
|
|
13969
13969
|
*
|
|
13970
13970
|
* If reached end of the stream, returns a null.
|
|
13971
|
-
*/ async
|
|
13972
|
-
for (;this.
|
|
13973
|
-
if (await this.
|
|
13971
|
+
*/ async oa() {
|
|
13972
|
+
for (;this.ua() < 0; ) {
|
|
13973
|
+
if (await this.ha()) break;
|
|
13974
13974
|
}
|
|
13975
13975
|
// Broke out of the loop because underlying stream is closed, and there
|
|
13976
13976
|
// happens to be no more data to process.
|
|
13977
13977
|
if (0 === this.buffer.length) return null;
|
|
13978
|
-
const t = this.
|
|
13978
|
+
const t = this.ua();
|
|
13979
13979
|
// Broke out of the loop because underlying stream is closed, but still
|
|
13980
13980
|
// cannot find an open bracket.
|
|
13981
|
-
t < 0 && this.
|
|
13981
|
+
t < 0 && this.aa("Reached the end of bundle when a length string is expected.");
|
|
13982
13982
|
const e = this.buffer.slice(0, t);
|
|
13983
13983
|
// Update the internal buffer to drop the read length.
|
|
13984
13984
|
return this.buffer = this.buffer.slice(t), e;
|
|
@@ -13988,23 +13988,23 @@ class Kc {
|
|
|
13988
13988
|
* number of bytes, pulling more data from the underlying stream if needed.
|
|
13989
13989
|
*
|
|
13990
13990
|
* Returns a string decoded from the read bytes.
|
|
13991
|
-
*/ async
|
|
13991
|
+
*/ async ca(t) {
|
|
13992
13992
|
for (;this.buffer.length < t; ) {
|
|
13993
|
-
await this.
|
|
13993
|
+
await this.ha() && this.aa("Reached the end of bundle when more is expected.");
|
|
13994
13994
|
}
|
|
13995
|
-
const e = this.
|
|
13995
|
+
const e = this.ia.decode(this.buffer.slice(0, t));
|
|
13996
13996
|
// Update the internal buffer to drop the read json string.
|
|
13997
13997
|
return this.buffer = this.buffer.slice(t), e;
|
|
13998
13998
|
}
|
|
13999
|
-
|
|
13999
|
+
aa(t) {
|
|
14000
14000
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
14001
|
-
throw this.
|
|
14001
|
+
throw this.sa.cancel(), new Error(`Invalid bundle format: ${t}`);
|
|
14002
14002
|
}
|
|
14003
14003
|
/**
|
|
14004
14004
|
* Pulls more data from underlying stream to internal buffer.
|
|
14005
14005
|
* Returns a boolean indicating whether the stream is finished.
|
|
14006
|
-
*/ async
|
|
14007
|
-
const t = await this.
|
|
14006
|
+
*/ async ha() {
|
|
14007
|
+
const t = await this.sa.read();
|
|
14008
14008
|
if (!t.done) {
|
|
14009
14009
|
const e = new Uint8Array(this.buffer.length + t.value.length);
|
|
14010
14010
|
e.set(this.buffer), e.set(t.value, this.buffer.length), this.buffer = e;
|
|
@@ -14033,7 +14033,7 @@ class Kc {
|
|
|
14033
14033
|
* Internal transaction object responsible for accumulating the mutations to
|
|
14034
14034
|
* perform and the base versions for any documents read.
|
|
14035
14035
|
*/
|
|
14036
|
-
class
|
|
14036
|
+
class Qa {
|
|
14037
14037
|
constructor(t) {
|
|
14038
14038
|
this.datastore = t,
|
|
14039
14039
|
// The version of each document that was read during this transaction.
|
|
@@ -14061,11 +14061,11 @@ class Qc {
|
|
|
14061
14061
|
const e = rs(n.k, t);
|
|
14062
14062
|
o.set(e.key.toString(), e);
|
|
14063
14063
|
}));
|
|
14064
|
-
const
|
|
14064
|
+
const a = [];
|
|
14065
14065
|
return e.forEach((t => {
|
|
14066
14066
|
const e = o.get(t.toString());
|
|
14067
|
-
U(!!e),
|
|
14068
|
-
})),
|
|
14067
|
+
U(!!e), a.push(e);
|
|
14068
|
+
})), a;
|
|
14069
14069
|
}(this.datastore, t);
|
|
14070
14070
|
return e.forEach((t => this.recordVersion(t))), e;
|
|
14071
14071
|
}
|
|
@@ -14097,7 +14097,7 @@ class Qc {
|
|
|
14097
14097
|
this.mutations.push(new fn(n, this.precondition(n)));
|
|
14098
14098
|
})), await async function(t, e) {
|
|
14099
14099
|
const n = K(t), s = es(n.k) + "/documents", i = {
|
|
14100
|
-
writes: e.map((t =>
|
|
14100
|
+
writes: e.map((t => as(n.k, t)))
|
|
14101
14101
|
};
|
|
14102
14102
|
await n.Bi("Commit", s, i);
|
|
14103
14103
|
}(this.datastore, this.mutations), this.committed = !0;
|
|
@@ -14174,29 +14174,29 @@ class Qc {
|
|
|
14174
14174
|
* TransactionRunner encapsulates the logic needed to run and retry transactions
|
|
14175
14175
|
* with backoff.
|
|
14176
14176
|
*/
|
|
14177
|
-
class
|
|
14177
|
+
class Wa {
|
|
14178
14178
|
constructor(t, e, n, s) {
|
|
14179
14179
|
this.asyncQueue = t, this.datastore = e, this.updateFunction = n, this.deferred = s,
|
|
14180
|
-
this.
|
|
14180
|
+
this.la = 5, this.ur = new no(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
|
|
14181
14181
|
}
|
|
14182
14182
|
/** Runs the transaction and sets the result on deferred. */ run() {
|
|
14183
|
-
this.
|
|
14183
|
+
this.la -= 1, this.fa();
|
|
14184
14184
|
}
|
|
14185
|
-
|
|
14185
|
+
fa() {
|
|
14186
14186
|
this.ur.Zi((async () => {
|
|
14187
|
-
const t = new
|
|
14187
|
+
const t = new Qa(this.datastore), e = this.da(t);
|
|
14188
14188
|
e && e.then((e => {
|
|
14189
14189
|
this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
|
|
14190
14190
|
this.deferred.resolve(e);
|
|
14191
14191
|
})).catch((t => {
|
|
14192
|
-
this.
|
|
14192
|
+
this.wa(t);
|
|
14193
14193
|
}))));
|
|
14194
14194
|
})).catch((t => {
|
|
14195
|
-
this.
|
|
14195
|
+
this.wa(t);
|
|
14196
14196
|
}));
|
|
14197
14197
|
}));
|
|
14198
14198
|
}
|
|
14199
|
-
|
|
14199
|
+
da(t) {
|
|
14200
14200
|
try {
|
|
14201
14201
|
const e = this.updateFunction(t);
|
|
14202
14202
|
return !vt(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
|
|
@@ -14206,11 +14206,11 @@ class Wc {
|
|
|
14206
14206
|
return this.deferred.reject(t), null;
|
|
14207
14207
|
}
|
|
14208
14208
|
}
|
|
14209
|
-
|
|
14210
|
-
this.
|
|
14209
|
+
wa(t) {
|
|
14210
|
+
this.la > 0 && this._a(t) ? (this.la -= 1, this.asyncQueue.enqueueAndForget((() => (this.fa(),
|
|
14211
14211
|
Promise.resolve())))) : this.deferred.reject(t);
|
|
14212
14212
|
}
|
|
14213
|
-
|
|
14213
|
+
_a(t) {
|
|
14214
14214
|
if ("FirebaseError" === t.name) {
|
|
14215
14215
|
// In transactions, the backend will fail outdated reads with FAILED_PRECONDITION and
|
|
14216
14216
|
// non-matching document versions with ABORTED. These errors should be retried.
|
|
@@ -14242,7 +14242,7 @@ class Wc {
|
|
|
14242
14242
|
* pieces of the client SDK architecture. It is responsible for creating the
|
|
14243
14243
|
* async queue that is shared by all of the other components in the system.
|
|
14244
14244
|
*/
|
|
14245
|
-
class
|
|
14245
|
+
class Ga {
|
|
14246
14246
|
constructor(t, e,
|
|
14247
14247
|
/**
|
|
14248
14248
|
* Asynchronous queue responsible for all of our internal processing. When
|
|
@@ -14300,7 +14300,7 @@ class Gc {
|
|
|
14300
14300
|
}
|
|
14301
14301
|
}
|
|
14302
14302
|
|
|
14303
|
-
async function
|
|
14303
|
+
async function za(t, e) {
|
|
14304
14304
|
t.asyncQueue.verifyOperationInProgress(), O("FirestoreClient", "Initializing OfflineComponentProvider");
|
|
14305
14305
|
const n = await t.getConfiguration();
|
|
14306
14306
|
await e.initialize(n);
|
|
@@ -14313,9 +14313,9 @@ async function zc(t, e) {
|
|
|
14313
14313
|
e.persistence.setDatabaseDeletedListener((() => t.terminate())), t.offlineComponents = e;
|
|
14314
14314
|
}
|
|
14315
14315
|
|
|
14316
|
-
async function
|
|
14316
|
+
async function Ha(t, e) {
|
|
14317
14317
|
t.asyncQueue.verifyOperationInProgress();
|
|
14318
|
-
const n = await
|
|
14318
|
+
const n = await Ja(t);
|
|
14319
14319
|
O("FirestoreClient", "Initializing OnlineComponentProvider");
|
|
14320
14320
|
const s = await t.getConfiguration();
|
|
14321
14321
|
await e.initialize(n, s),
|
|
@@ -14335,41 +14335,41 @@ async function Hc(t, e) {
|
|
|
14335
14335
|
}(e.remoteStore, t))), t.onlineComponents = e;
|
|
14336
14336
|
}
|
|
14337
14337
|
|
|
14338
|
-
async function
|
|
14338
|
+
async function Ja(t) {
|
|
14339
14339
|
return t.offlineComponents || (O("FirestoreClient", "Using default OfflineComponentProvider"),
|
|
14340
|
-
await
|
|
14340
|
+
await za(t, new Fa)), t.offlineComponents;
|
|
14341
14341
|
}
|
|
14342
14342
|
|
|
14343
|
-
async function
|
|
14343
|
+
async function Ya(t) {
|
|
14344
14344
|
return t.onlineComponents || (O("FirestoreClient", "Using default OnlineComponentProvider"),
|
|
14345
|
-
await
|
|
14345
|
+
await Ha(t, new Ua)), t.onlineComponents;
|
|
14346
14346
|
}
|
|
14347
14347
|
|
|
14348
|
-
function
|
|
14349
|
-
return
|
|
14348
|
+
function Xa(t) {
|
|
14349
|
+
return Ja(t).then((t => t.persistence));
|
|
14350
14350
|
}
|
|
14351
14351
|
|
|
14352
|
-
function
|
|
14353
|
-
return
|
|
14352
|
+
function Za(t) {
|
|
14353
|
+
return Ja(t).then((t => t.localStore));
|
|
14354
14354
|
}
|
|
14355
14355
|
|
|
14356
|
-
function
|
|
14357
|
-
return
|
|
14356
|
+
function tc(t) {
|
|
14357
|
+
return Ya(t).then((t => t.remoteStore));
|
|
14358
14358
|
}
|
|
14359
14359
|
|
|
14360
|
-
function
|
|
14361
|
-
return
|
|
14360
|
+
function ec(t) {
|
|
14361
|
+
return Ya(t).then((t => t.syncEngine));
|
|
14362
14362
|
}
|
|
14363
14363
|
|
|
14364
|
-
async function
|
|
14365
|
-
const e = await
|
|
14366
|
-
return n.onListen =
|
|
14364
|
+
async function nc(t) {
|
|
14365
|
+
const e = await Ya(t), n = e.eventManager;
|
|
14366
|
+
return n.onListen = oa.bind(null, e.syncEngine), n.onUnlisten = ca.bind(null, e.syncEngine),
|
|
14367
14367
|
n;
|
|
14368
14368
|
}
|
|
14369
14369
|
|
|
14370
|
-
/** Enables the network connection and re-enqueues all pending operations. */ function
|
|
14370
|
+
/** Enables the network connection and re-enqueues all pending operations. */ function sc(t) {
|
|
14371
14371
|
return t.asyncQueue.enqueue((async () => {
|
|
14372
|
-
const e = await
|
|
14372
|
+
const e = await Xa(t), n = await tc(t);
|
|
14373
14373
|
return e.setNetworkEnabled(!0), function(t) {
|
|
14374
14374
|
const e = K(t);
|
|
14375
14375
|
return e.Gr.delete(0 /* UserDisabled */), uo(e);
|
|
@@ -14377,9 +14377,9 @@ async function na(t) {
|
|
|
14377
14377
|
}));
|
|
14378
14378
|
}
|
|
14379
14379
|
|
|
14380
|
-
/** Disables the network connection. Pending operations will not complete. */ function
|
|
14380
|
+
/** Disables the network connection. Pending operations will not complete. */ function ic(t) {
|
|
14381
14381
|
return t.asyncQueue.enqueue((async () => {
|
|
14382
|
-
const e = await
|
|
14382
|
+
const e = await Xa(t), n = await tc(t);
|
|
14383
14383
|
return e.setNetworkEnabled(!1), async function(t) {
|
|
14384
14384
|
const e = K(t);
|
|
14385
14385
|
e.Gr.add(0 /* UserDisabled */), await ho(e),
|
|
@@ -14393,7 +14393,7 @@ async function na(t) {
|
|
|
14393
14393
|
* Returns a Promise that resolves when all writes that were pending at the time
|
|
14394
14394
|
* this method was called received server acknowledgement. An acknowledgement
|
|
14395
14395
|
* can be either acceptance or rejection.
|
|
14396
|
-
*/ function
|
|
14396
|
+
*/ function rc(t, e) {
|
|
14397
14397
|
const n = new W;
|
|
14398
14398
|
return t.asyncQueue.enqueueAndForget((async () => async function(t, e, n) {
|
|
14399
14399
|
try {
|
|
@@ -14410,19 +14410,19 @@ async function na(t) {
|
|
|
14410
14410
|
/**
|
|
14411
14411
|
* Retrieves a latency-compensated document from the backend via a
|
|
14412
14412
|
* SnapshotListener.
|
|
14413
|
-
*/ (await
|
|
14413
|
+
*/ (await Za(t), e, n))), n.promise;
|
|
14414
14414
|
}
|
|
14415
14415
|
|
|
14416
|
-
function
|
|
14416
|
+
function oc(t, e, n = {}) {
|
|
14417
14417
|
const s = new W;
|
|
14418
14418
|
return t.asyncQueue.enqueueAndForget((async () => function(t, e, n, s, i) {
|
|
14419
|
-
const r = new
|
|
14419
|
+
const r = new Ka({
|
|
14420
14420
|
next: r => {
|
|
14421
14421
|
// Remove query first before passing event to user to avoid
|
|
14422
14422
|
// user actions affecting the now stale query.
|
|
14423
14423
|
e.enqueueAndForget((() => Qo(t, o)));
|
|
14424
|
-
const
|
|
14425
|
-
!
|
|
14424
|
+
const a = r.docs.has(n);
|
|
14425
|
+
!a && r.fromCache ?
|
|
14426
14426
|
// TODO(dimond): If we're online and the document doesn't
|
|
14427
14427
|
// exist then we resolve with a doc.exists set to false. If
|
|
14428
14428
|
// we're offline however, we reject the Promise in this
|
|
@@ -14430,7 +14430,7 @@ function oa(t, e, n = {}) {
|
|
|
14430
14430
|
// the server so we can deliver that even when you're
|
|
14431
14431
|
// offline 2) Actually reject the Promise in the online case
|
|
14432
14432
|
// if the document doesn't exist.
|
|
14433
|
-
i.reject(new Q(j.UNAVAILABLE, "Failed to get document because the client is offline.")) :
|
|
14433
|
+
i.reject(new Q(j.UNAVAILABLE, "Failed to get document because the client is offline.")) : a && r.fromCache && s && "server" === s.source ? i.reject(new Q(j.UNAVAILABLE, 'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')) : i.resolve(r);
|
|
14434
14434
|
},
|
|
14435
14435
|
error: t => i.reject(t)
|
|
14436
14436
|
}), o = new Ho(ye(n.path), r, {
|
|
@@ -14438,15 +14438,15 @@ function oa(t, e, n = {}) {
|
|
|
14438
14438
|
wo: !0
|
|
14439
14439
|
});
|
|
14440
14440
|
return jo(t, o);
|
|
14441
|
-
}(await
|
|
14441
|
+
}(await nc(t), t.asyncQueue, e, n, s))), s.promise;
|
|
14442
14442
|
}
|
|
14443
14443
|
|
|
14444
|
-
function
|
|
14444
|
+
function ac(t, e) {
|
|
14445
14445
|
const n = new W;
|
|
14446
14446
|
return t.asyncQueue.enqueueAndForget((async () => async function(t, e, n) {
|
|
14447
14447
|
try {
|
|
14448
14448
|
const s = await Ir(t, e,
|
|
14449
|
-
/* usePreviousResults= */ !0), i = new
|
|
14449
|
+
/* usePreviousResults= */ !0), i = new na(e, s.zn), r = i.Po(s.documents), o = i.applyChanges(r,
|
|
14450
14450
|
/* updateLimboDocuments= */ !1);
|
|
14451
14451
|
n.resolve(o.snapshot);
|
|
14452
14452
|
} catch (t) {
|
|
@@ -14457,13 +14457,13 @@ function ca(t, e) {
|
|
|
14457
14457
|
/**
|
|
14458
14458
|
* Retrieves a latency-compensated query snapshot from the backend via a
|
|
14459
14459
|
* SnapshotListener.
|
|
14460
|
-
*/ (await
|
|
14460
|
+
*/ (await Za(t), e, n))), n.promise;
|
|
14461
14461
|
}
|
|
14462
14462
|
|
|
14463
|
-
function
|
|
14463
|
+
function cc(t, e, n = {}) {
|
|
14464
14464
|
const s = new W;
|
|
14465
14465
|
return t.asyncQueue.enqueueAndForget((async () => function(t, e, n, s, i) {
|
|
14466
|
-
const r = new
|
|
14466
|
+
const r = new Ka({
|
|
14467
14467
|
next: n => {
|
|
14468
14468
|
// Remove query first before passing event to user to avoid
|
|
14469
14469
|
// user actions affecting the now stale query.
|
|
@@ -14475,20 +14475,20 @@ function aa(t, e, n = {}) {
|
|
|
14475
14475
|
wo: !0
|
|
14476
14476
|
});
|
|
14477
14477
|
return jo(t, o);
|
|
14478
|
-
}(await
|
|
14478
|
+
}(await nc(t), t.asyncQueue, e, n, s))), s.promise;
|
|
14479
14479
|
}
|
|
14480
14480
|
|
|
14481
|
-
function
|
|
14482
|
-
const n = new
|
|
14481
|
+
function uc(t, e) {
|
|
14482
|
+
const n = new Ka(e);
|
|
14483
14483
|
return t.asyncQueue.enqueueAndForget((async () => function(t, e) {
|
|
14484
14484
|
K(t).io.add(e),
|
|
14485
14485
|
// Immediately fire an initial event, indicating all existing listeners
|
|
14486
14486
|
// are in-sync.
|
|
14487
14487
|
e.next();
|
|
14488
|
-
}(await
|
|
14489
|
-
n.
|
|
14488
|
+
}(await nc(t), n))), () => {
|
|
14489
|
+
n.na(), t.asyncQueue.enqueueAndForget((async () => function(t, e) {
|
|
14490
14490
|
K(t).io.delete(e);
|
|
14491
|
-
}(await
|
|
14491
|
+
}(await nc(t), n)));
|
|
14492
14492
|
};
|
|
14493
14493
|
}
|
|
14494
14494
|
|
|
@@ -14506,25 +14506,25 @@ function ua(t, e) {
|
|
|
14506
14506
|
* accessed with the transaction will not reflect local changes that have not
|
|
14507
14507
|
* been committed. For this reason, it is required that all reads are
|
|
14508
14508
|
* performed before any writes. Transactions must be performed while online.
|
|
14509
|
-
*/ function
|
|
14509
|
+
*/ function hc(t, e) {
|
|
14510
14510
|
const n = new W;
|
|
14511
14511
|
return t.asyncQueue.enqueueAndForget((async () => {
|
|
14512
14512
|
const s = await function(t) {
|
|
14513
|
-
return
|
|
14513
|
+
return Ya(t).then((t => t.datastore));
|
|
14514
14514
|
}(t);
|
|
14515
|
-
new
|
|
14515
|
+
new Wa(t.asyncQueue, s, e, n).run();
|
|
14516
14516
|
})), n.promise;
|
|
14517
14517
|
}
|
|
14518
14518
|
|
|
14519
|
-
function
|
|
14519
|
+
function lc(t, e, n, s) {
|
|
14520
14520
|
const i = function(t, e) {
|
|
14521
14521
|
let n;
|
|
14522
14522
|
n = "string" == typeof t ? (new TextEncoder).encode(t) : t;
|
|
14523
14523
|
return function(t, e) {
|
|
14524
|
-
return new
|
|
14524
|
+
return new ja(t, e);
|
|
14525
14525
|
}(function(t, e) {
|
|
14526
|
-
if (t instanceof Uint8Array) return
|
|
14527
|
-
if (t instanceof ArrayBuffer) return
|
|
14526
|
+
if (t instanceof Uint8Array) return qa(t, e);
|
|
14527
|
+
if (t instanceof ArrayBuffer) return qa(new Uint8Array(t), e);
|
|
14528
14528
|
if (t instanceof ReadableStream) return t.getReader();
|
|
14529
14529
|
throw new Error("Source of `toByteStreamReader` has to be a ArrayBuffer or ReadableStream");
|
|
14530
14530
|
}(n), e);
|
|
@@ -14546,18 +14546,18 @@ function la(t, e, n, s) {
|
|
|
14546
14546
|
* limitations under the License.
|
|
14547
14547
|
*/ (n, eo(e));
|
|
14548
14548
|
t.asyncQueue.enqueueAndForget((async () => {
|
|
14549
|
-
|
|
14549
|
+
Ma(await ec(t), i, s);
|
|
14550
14550
|
}));
|
|
14551
14551
|
}
|
|
14552
14552
|
|
|
14553
|
-
function
|
|
14553
|
+
function fc(t, e) {
|
|
14554
14554
|
return t.asyncQueue.enqueue((async () => function(t, e) {
|
|
14555
14555
|
const n = K(t);
|
|
14556
14556
|
return n.persistence.runTransaction("Get named query", "readonly", (t => n.Ye.getNamedQuery(t, e)));
|
|
14557
|
-
}(await
|
|
14557
|
+
}(await Za(t), e)));
|
|
14558
14558
|
}
|
|
14559
14559
|
|
|
14560
|
-
class
|
|
14560
|
+
class dc {
|
|
14561
14561
|
/**
|
|
14562
14562
|
* Constructs a DatabaseInfo using the provided host, databaseId and
|
|
14563
14563
|
* persistenceKey.
|
|
@@ -14575,9 +14575,9 @@ class da {
|
|
|
14575
14575
|
* @param useFetchStreams Whether to use the Fetch API instead of
|
|
14576
14576
|
* XMLHTTPRequest
|
|
14577
14577
|
*/
|
|
14578
|
-
constructor(t, e, n, s, i, r, o,
|
|
14578
|
+
constructor(t, e, n, s, i, r, o, a) {
|
|
14579
14579
|
this.databaseId = t, this.appId = e, this.persistenceKey = n, this.host = s, this.ssl = i,
|
|
14580
|
-
this.forceLongPolling = r, this.autoDetectLongPolling = o, this.useFetchStreams =
|
|
14580
|
+
this.forceLongPolling = r, this.autoDetectLongPolling = o, this.useFetchStreams = a;
|
|
14581
14581
|
}
|
|
14582
14582
|
}
|
|
14583
14583
|
|
|
@@ -14586,7 +14586,7 @@ class da {
|
|
|
14586
14586
|
* Represents the database ID a Firestore client is associated with.
|
|
14587
14587
|
* @internal
|
|
14588
14588
|
*/
|
|
14589
|
-
class
|
|
14589
|
+
class wc {
|
|
14590
14590
|
constructor(t, e) {
|
|
14591
14591
|
this.projectId = t, this.database = e || "(default)";
|
|
14592
14592
|
}
|
|
@@ -14594,7 +14594,7 @@ class wa {
|
|
|
14594
14594
|
return "(default)" === this.database;
|
|
14595
14595
|
}
|
|
14596
14596
|
isEqual(t) {
|
|
14597
|
-
return t instanceof
|
|
14597
|
+
return t instanceof wc && t.projectId === this.projectId && t.database === this.database;
|
|
14598
14598
|
}
|
|
14599
14599
|
}
|
|
14600
14600
|
|
|
@@ -14613,7 +14613,7 @@ class wa {
|
|
|
14613
14613
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14614
14614
|
* See the License for the specific language governing permissions and
|
|
14615
14615
|
* limitations under the License.
|
|
14616
|
-
*/ const
|
|
14616
|
+
*/ const _c = new Map;
|
|
14617
14617
|
|
|
14618
14618
|
/**
|
|
14619
14619
|
* An instance map that ensures only one Datastore exists per Firestore
|
|
@@ -14635,28 +14635,28 @@ class wa {
|
|
|
14635
14635
|
* See the License for the specific language governing permissions and
|
|
14636
14636
|
* limitations under the License.
|
|
14637
14637
|
*/
|
|
14638
|
-
function
|
|
14638
|
+
function mc(t, e, n) {
|
|
14639
14639
|
if (!n) throw new Q(j.INVALID_ARGUMENT, `Function ${t}() cannot be called with an empty ${e}.`);
|
|
14640
14640
|
}
|
|
14641
14641
|
|
|
14642
14642
|
/**
|
|
14643
14643
|
* Validates that two boolean options are not set at the same time.
|
|
14644
14644
|
* @internal
|
|
14645
|
-
*/ function
|
|
14645
|
+
*/ function gc(t, e, n, s) {
|
|
14646
14646
|
if (!0 === e && !0 === s) throw new Q(j.INVALID_ARGUMENT, `${t} and ${n} cannot be used together.`);
|
|
14647
14647
|
}
|
|
14648
14648
|
|
|
14649
14649
|
/**
|
|
14650
14650
|
* Validates that `path` refers to a document (indicated by the fact it contains
|
|
14651
14651
|
* an even numbers of segments).
|
|
14652
|
-
*/ function
|
|
14652
|
+
*/ function yc(t) {
|
|
14653
14653
|
if (!Dt.isDocumentKey(t)) throw new Q(j.INVALID_ARGUMENT, `Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`);
|
|
14654
14654
|
}
|
|
14655
14655
|
|
|
14656
14656
|
/**
|
|
14657
14657
|
* Validates that `path` refers to a collection (indicated by the fact it
|
|
14658
14658
|
* contains an odd numbers of segments).
|
|
14659
|
-
*/ function
|
|
14659
|
+
*/ function pc(t) {
|
|
14660
14660
|
if (Dt.isDocumentKey(t)) throw new Q(j.INVALID_ARGUMENT, `Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`);
|
|
14661
14661
|
}
|
|
14662
14662
|
|
|
@@ -14665,7 +14665,7 @@ function ma(t, e, n) {
|
|
|
14665
14665
|
* (i.e. excludes Array, Date, etc.).
|
|
14666
14666
|
*/
|
|
14667
14667
|
/** Returns a string describing the type / value of the provided input. */
|
|
14668
|
-
function
|
|
14668
|
+
function Tc(t) {
|
|
14669
14669
|
if (void 0 === t) return "undefined";
|
|
14670
14670
|
if (null === t) return "null";
|
|
14671
14671
|
if ("string" == typeof t) return t.length > 20 && (t = `${t.substring(0, 20)}...`),
|
|
@@ -14694,7 +14694,7 @@ function Ta(t) {
|
|
|
14694
14694
|
return "function" == typeof t ? "a function" : B();
|
|
14695
14695
|
}
|
|
14696
14696
|
|
|
14697
|
-
function
|
|
14697
|
+
function Ec(t,
|
|
14698
14698
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14699
14699
|
e) {
|
|
14700
14700
|
if ("_delegate" in t && (
|
|
@@ -14703,14 +14703,14 @@ e) {
|
|
|
14703
14703
|
t = t._delegate), !(t instanceof e)) {
|
|
14704
14704
|
if (e.name === t.constructor.name) throw new Q(j.INVALID_ARGUMENT, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
|
|
14705
14705
|
{
|
|
14706
|
-
const n =
|
|
14706
|
+
const n = Tc(t);
|
|
14707
14707
|
throw new Q(j.INVALID_ARGUMENT, `Expected type '${e.name}', but it was: ${n}`);
|
|
14708
14708
|
}
|
|
14709
14709
|
}
|
|
14710
14710
|
return t;
|
|
14711
14711
|
}
|
|
14712
14712
|
|
|
14713
|
-
function
|
|
14713
|
+
function Ic(t, e) {
|
|
14714
14714
|
if (e <= 0) throw new Q(j.INVALID_ARGUMENT, `Function ${t}() requires a positive number, but it was: ${e}.`);
|
|
14715
14715
|
}
|
|
14716
14716
|
|
|
@@ -14736,7 +14736,7 @@ function Ia(t, e) {
|
|
|
14736
14736
|
* user-supplied `FirestoreSettings` object. This is a separate type so that
|
|
14737
14737
|
* defaults can be supplied and the value can be checked for equality.
|
|
14738
14738
|
*/
|
|
14739
|
-
class
|
|
14739
|
+
class Ac {
|
|
14740
14740
|
constructor(t) {
|
|
14741
14741
|
var e;
|
|
14742
14742
|
if (void 0 === t.host) {
|
|
@@ -14749,7 +14749,7 @@ class Aa {
|
|
|
14749
14749
|
this.cacheSizeBytes = t.cacheSizeBytes;
|
|
14750
14750
|
}
|
|
14751
14751
|
this.experimentalForceLongPolling = !!t.experimentalForceLongPolling, this.experimentalAutoDetectLongPolling = !!t.experimentalAutoDetectLongPolling,
|
|
14752
|
-
this.useFetchStreams = !!t.useFetchStreams,
|
|
14752
|
+
this.useFetchStreams = !!t.useFetchStreams, gc("experimentalForceLongPolling", t.experimentalForceLongPolling, "experimentalAutoDetectLongPolling", t.experimentalAutoDetectLongPolling);
|
|
14753
14753
|
}
|
|
14754
14754
|
isEqual(t) {
|
|
14755
14755
|
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;
|
|
@@ -14776,18 +14776,18 @@ class Aa {
|
|
|
14776
14776
|
* The Cloud Firestore service interface.
|
|
14777
14777
|
*
|
|
14778
14778
|
* Do not call this constructor directly. Instead, use {@link getFirestore}.
|
|
14779
|
-
*/ class
|
|
14779
|
+
*/ class Rc {
|
|
14780
14780
|
/** @hideconstructor */
|
|
14781
14781
|
constructor(t, e, n) {
|
|
14782
14782
|
this._authCredentials = e, this._appCheckCredentials = n,
|
|
14783
14783
|
/**
|
|
14784
14784
|
* Whether it's a Firestore or Firestore Lite instance.
|
|
14785
14785
|
*/
|
|
14786
|
-
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new
|
|
14787
|
-
this._settingsFrozen = !1, t instanceof
|
|
14786
|
+
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new Ac({}),
|
|
14787
|
+
this._settingsFrozen = !1, t instanceof wc ? this._databaseId = t : (this._app = t,
|
|
14788
14788
|
this._databaseId = function(t) {
|
|
14789
14789
|
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new Q(j.INVALID_ARGUMENT, '"projectId" not provided in firebase.initializeApp.');
|
|
14790
|
-
return new
|
|
14790
|
+
return new wc(t.options.projectId);
|
|
14791
14791
|
}
|
|
14792
14792
|
/**
|
|
14793
14793
|
* Modify this instance to communicate with the Cloud Firestore emulator.
|
|
@@ -14818,7 +14818,7 @@ class Aa {
|
|
|
14818
14818
|
}
|
|
14819
14819
|
_setSettings(t) {
|
|
14820
14820
|
if (this._settingsFrozen) throw new Q(j.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.");
|
|
14821
|
-
this._settings = new
|
|
14821
|
+
this._settings = new Ac(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
|
|
14822
14822
|
if (!t) return new z;
|
|
14823
14823
|
switch (t.type) {
|
|
14824
14824
|
case "gapi":
|
|
@@ -14863,15 +14863,15 @@ class Aa {
|
|
|
14863
14863
|
* when the `Firestore` instance is terminated.
|
|
14864
14864
|
*/
|
|
14865
14865
|
return function(t) {
|
|
14866
|
-
const e =
|
|
14867
|
-
e && (O("ComponentProvider", "Removing Datastore"),
|
|
14866
|
+
const e = _c.get(t);
|
|
14867
|
+
e && (O("ComponentProvider", "Removing Datastore"), _c.delete(t), e.terminate());
|
|
14868
14868
|
}(this), Promise.resolve();
|
|
14869
14869
|
}
|
|
14870
14870
|
}
|
|
14871
14871
|
|
|
14872
|
-
function
|
|
14872
|
+
function bc(t, e, n, s = {}) {
|
|
14873
14873
|
var i;
|
|
14874
|
-
const r = (t =
|
|
14874
|
+
const r = (t = Ec(t, Rc))._getSettings();
|
|
14875
14875
|
if ("firestore.googleapis.com" !== r.host && r.host !== e && F("Host has been set in both settings() and useEmulator(), emulator host will be used"),
|
|
14876
14876
|
t._setSettings(Object.assign(Object.assign({}, r), {
|
|
14877
14877
|
host: `${e}:${n}`,
|
|
@@ -14910,7 +14910,7 @@ function ba(t, e, n, s = {}) {
|
|
|
14910
14910
|
* A `DocumentReference` refers to a document location in a Firestore database
|
|
14911
14911
|
* and can be used to write, read, or listen to the location. The document at
|
|
14912
14912
|
* the referenced location may or may not exist.
|
|
14913
|
-
*/ class
|
|
14913
|
+
*/ class Pc {
|
|
14914
14914
|
/** @hideconstructor */
|
|
14915
14915
|
constructor(t,
|
|
14916
14916
|
/**
|
|
@@ -14938,17 +14938,17 @@ function ba(t, e, n, s = {}) {
|
|
|
14938
14938
|
/**
|
|
14939
14939
|
* The collection this `DocumentReference` belongs to.
|
|
14940
14940
|
*/ get parent() {
|
|
14941
|
-
return new
|
|
14941
|
+
return new Vc(this.firestore, this.converter, this._key.path.popLast());
|
|
14942
14942
|
}
|
|
14943
14943
|
withConverter(t) {
|
|
14944
|
-
return new
|
|
14944
|
+
return new Pc(this.firestore, t, this._key);
|
|
14945
14945
|
}
|
|
14946
14946
|
}
|
|
14947
14947
|
|
|
14948
14948
|
/**
|
|
14949
14949
|
* A `Query` refers to a query which you can read or listen to. You can also
|
|
14950
14950
|
* construct refined `Query` objects by adding filters and ordering.
|
|
14951
|
-
*/ class
|
|
14951
|
+
*/ class vc {
|
|
14952
14952
|
// This is the lite version of the Query class in the main SDK.
|
|
14953
14953
|
/** @hideconstructor protected */
|
|
14954
14954
|
constructor(t,
|
|
@@ -14961,14 +14961,14 @@ function ba(t, e, n, s = {}) {
|
|
|
14961
14961
|
this.type = "query", this.firestore = t;
|
|
14962
14962
|
}
|
|
14963
14963
|
withConverter(t) {
|
|
14964
|
-
return new
|
|
14964
|
+
return new vc(this.firestore, t, this._query);
|
|
14965
14965
|
}
|
|
14966
14966
|
}
|
|
14967
14967
|
|
|
14968
14968
|
/**
|
|
14969
14969
|
* A `CollectionReference` object can be used for adding documents, getting
|
|
14970
14970
|
* document references, and querying for documents (using {@link query}).
|
|
14971
|
-
*/ class
|
|
14971
|
+
*/ class Vc extends vc {
|
|
14972
14972
|
/** @hideconstructor */
|
|
14973
14973
|
constructor(t, e, n) {
|
|
14974
14974
|
super(t, e, ye(n)), this._path = n,
|
|
@@ -14989,23 +14989,23 @@ function ba(t, e, n, s = {}) {
|
|
|
14989
14989
|
* subcollection. If this isn't a subcollection, the reference is null.
|
|
14990
14990
|
*/ get parent() {
|
|
14991
14991
|
const t = this._path.popLast();
|
|
14992
|
-
return t.isEmpty() ? null : new
|
|
14992
|
+
return t.isEmpty() ? null : new Pc(this.firestore,
|
|
14993
14993
|
/* converter= */ null, new Dt(t));
|
|
14994
14994
|
}
|
|
14995
14995
|
withConverter(t) {
|
|
14996
|
-
return new
|
|
14996
|
+
return new Vc(this.firestore, t, this._path);
|
|
14997
14997
|
}
|
|
14998
14998
|
}
|
|
14999
14999
|
|
|
15000
|
-
function
|
|
15001
|
-
if (t = getModularInstance(t),
|
|
15000
|
+
function Sc(t, e, ...n) {
|
|
15001
|
+
if (t = getModularInstance(t), mc("collection", "path", e), t instanceof Rc) {
|
|
15002
15002
|
const s = wt.fromString(e, ...n);
|
|
15003
|
-
return
|
|
15003
|
+
return pc(s), new Vc(t, /* converter= */ null, s);
|
|
15004
15004
|
}
|
|
15005
15005
|
{
|
|
15006
|
-
if (!(t instanceof
|
|
15006
|
+
if (!(t instanceof Pc || t instanceof Vc)) throw new Q(j.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
15007
15007
|
const s = t._path.child(wt.fromString(e, ...n));
|
|
15008
|
-
return
|
|
15008
|
+
return pc(s), new Vc(t.firestore,
|
|
15009
15009
|
/* converter= */ null, s);
|
|
15010
15010
|
}
|
|
15011
15011
|
}
|
|
@@ -15022,9 +15022,9 @@ function Sa(t, e, ...n) {
|
|
|
15022
15022
|
* collection or subcollection with this ID as the last segment of its path
|
|
15023
15023
|
* will be included. Cannot contain a slash.
|
|
15024
15024
|
* @returns The created `Query`.
|
|
15025
|
-
*/ function
|
|
15026
|
-
if (t =
|
|
15027
|
-
return new
|
|
15025
|
+
*/ function Dc(t, e) {
|
|
15026
|
+
if (t = Ec(t, Rc), mc("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new Q(j.INVALID_ARGUMENT, `Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
|
|
15027
|
+
return new vc(t,
|
|
15028
15028
|
/* converter= */ null,
|
|
15029
15029
|
/**
|
|
15030
15030
|
* Creates a new Query for a collection group query that matches all documents
|
|
@@ -15035,19 +15035,19 @@ function Sa(t, e, ...n) {
|
|
|
15035
15035
|
}(e));
|
|
15036
15036
|
}
|
|
15037
15037
|
|
|
15038
|
-
function
|
|
15038
|
+
function Cc(t, e, ...n) {
|
|
15039
15039
|
if (t = getModularInstance(t),
|
|
15040
15040
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
15041
15041
|
// 'undefined' and 'null'.
|
|
15042
|
-
1 === arguments.length && (e = it.A()),
|
|
15042
|
+
1 === arguments.length && (e = it.A()), mc("doc", "path", e), t instanceof Rc) {
|
|
15043
15043
|
const s = wt.fromString(e, ...n);
|
|
15044
|
-
return
|
|
15044
|
+
return yc(s), new Pc(t,
|
|
15045
15045
|
/* converter= */ null, new Dt(s));
|
|
15046
15046
|
}
|
|
15047
15047
|
{
|
|
15048
|
-
if (!(t instanceof
|
|
15048
|
+
if (!(t instanceof Pc || t instanceof Vc)) throw new Q(j.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
15049
15049
|
const s = t._path.child(wt.fromString(e, ...n));
|
|
15050
|
-
return
|
|
15050
|
+
return yc(s), new Pc(t.firestore, t instanceof Vc ? t.converter : null, new Dt(s));
|
|
15051
15051
|
}
|
|
15052
15052
|
}
|
|
15053
15053
|
|
|
@@ -15058,8 +15058,8 @@ function Ca(t, e, ...n) {
|
|
|
15058
15058
|
* @param right - A reference to compare.
|
|
15059
15059
|
* @returns true if the references point to the same location in the same
|
|
15060
15060
|
* Firestore database.
|
|
15061
|
-
*/ function
|
|
15062
|
-
return t = getModularInstance(t), e = getModularInstance(e), (t instanceof
|
|
15061
|
+
*/ function Nc(t, e) {
|
|
15062
|
+
return t = getModularInstance(t), e = getModularInstance(e), (t instanceof Pc || t instanceof Vc) && (e instanceof Pc || e instanceof Vc) && (t.firestore === e.firestore && t.path === e.path && t.converter === e.converter);
|
|
15063
15063
|
}
|
|
15064
15064
|
|
|
15065
15065
|
/**
|
|
@@ -15070,8 +15070,8 @@ function Ca(t, e, ...n) {
|
|
|
15070
15070
|
* @param right - A `Query` to compare.
|
|
15071
15071
|
* @returns true if the references point to the same location in the same
|
|
15072
15072
|
* Firestore database.
|
|
15073
|
-
*/ function
|
|
15074
|
-
return t = getModularInstance(t), e = getModularInstance(e), t instanceof
|
|
15073
|
+
*/ function kc(t, e) {
|
|
15074
|
+
return t = getModularInstance(t), e = getModularInstance(e), t instanceof vc && e instanceof vc && (t.firestore === e.firestore && ve(t._query, e._query) && t.converter === e.converter);
|
|
15075
15075
|
}
|
|
15076
15076
|
|
|
15077
15077
|
/**
|
|
@@ -15089,42 +15089,42 @@ function Ca(t, e, ...n) {
|
|
|
15089
15089
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15090
15090
|
* See the License for the specific language governing permissions and
|
|
15091
15091
|
* limitations under the License.
|
|
15092
|
-
*/ class
|
|
15092
|
+
*/ class xc {
|
|
15093
15093
|
constructor() {
|
|
15094
15094
|
// The last promise in the queue.
|
|
15095
|
-
this.
|
|
15095
|
+
this.ma = Promise.resolve(),
|
|
15096
15096
|
// A list of retryable operations. Retryable operations are run in order and
|
|
15097
15097
|
// retried with backoff.
|
|
15098
|
-
this.
|
|
15098
|
+
this.ga = [],
|
|
15099
15099
|
// Is this AsyncQueue being shut down? Once it is set to true, it will not
|
|
15100
15100
|
// be changed again.
|
|
15101
|
-
this.
|
|
15101
|
+
this.ya = !1,
|
|
15102
15102
|
// Operations scheduled to be queued in the future. Operations are
|
|
15103
15103
|
// automatically removed after they are run or canceled.
|
|
15104
|
-
this.
|
|
15104
|
+
this.pa = [],
|
|
15105
15105
|
// visible for testing
|
|
15106
|
-
this.
|
|
15106
|
+
this.Ta = null,
|
|
15107
15107
|
// Flag set while there's an outstanding AsyncQueue operation, used for
|
|
15108
15108
|
// assertion sanity-checks.
|
|
15109
|
-
this.
|
|
15109
|
+
this.Ea = !1,
|
|
15110
15110
|
// Enabled during shutdown on Safari to prevent future access to IndexedDB.
|
|
15111
|
-
this.
|
|
15111
|
+
this.Ia = !1,
|
|
15112
15112
|
// List of TimerIds to fast-forward delays for.
|
|
15113
|
-
this.
|
|
15113
|
+
this.Aa = [],
|
|
15114
15114
|
// Backoff timer used to schedule retries for retryable operations
|
|
15115
15115
|
this.ur = new no(this, "async_queue_retry" /* AsyncQueueRetry */),
|
|
15116
15116
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
15117
15117
|
// operations. Meant to speed up recovery when we regain file system access
|
|
15118
15118
|
// after page comes into foreground.
|
|
15119
|
-
this.
|
|
15119
|
+
this.Ra = () => {
|
|
15120
15120
|
const t = to();
|
|
15121
15121
|
t && O("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.ur.er();
|
|
15122
15122
|
};
|
|
15123
15123
|
const t = to();
|
|
15124
|
-
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.
|
|
15124
|
+
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Ra);
|
|
15125
15125
|
}
|
|
15126
15126
|
get isShuttingDown() {
|
|
15127
|
-
return this.
|
|
15127
|
+
return this.ya;
|
|
15128
15128
|
}
|
|
15129
15129
|
/**
|
|
15130
15130
|
* Adds a new operation to the queue without waiting for it to complete (i.e.
|
|
@@ -15134,44 +15134,44 @@ function Ca(t, e, ...n) {
|
|
|
15134
15134
|
this.enqueue(t);
|
|
15135
15135
|
}
|
|
15136
15136
|
enqueueAndForgetEvenWhileRestricted(t) {
|
|
15137
|
-
this.
|
|
15137
|
+
this.ba(),
|
|
15138
15138
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
15139
|
-
this.
|
|
15139
|
+
this.Pa(t);
|
|
15140
15140
|
}
|
|
15141
15141
|
enterRestrictedMode(t) {
|
|
15142
|
-
if (!this.
|
|
15143
|
-
this.
|
|
15142
|
+
if (!this.ya) {
|
|
15143
|
+
this.ya = !0, this.Ia = t || !1;
|
|
15144
15144
|
const e = to();
|
|
15145
|
-
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.
|
|
15145
|
+
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Ra);
|
|
15146
15146
|
}
|
|
15147
15147
|
}
|
|
15148
15148
|
enqueue(t) {
|
|
15149
|
-
if (this.
|
|
15149
|
+
if (this.ba(), this.ya)
|
|
15150
15150
|
// Return a Promise which never resolves.
|
|
15151
15151
|
return new Promise((() => {}));
|
|
15152
15152
|
// Create a deferred Promise that we can return to the callee. This
|
|
15153
15153
|
// allows us to return a "hanging Promise" only to the callee and still
|
|
15154
15154
|
// advance the queue even when the operation is not run.
|
|
15155
15155
|
const e = new W;
|
|
15156
|
-
return this.
|
|
15156
|
+
return this.Pa((() => this.ya && this.Ia ? Promise.resolve() : (t().then(e.resolve, e.reject),
|
|
15157
15157
|
e.promise))).then((() => e.promise));
|
|
15158
15158
|
}
|
|
15159
15159
|
enqueueRetryable(t) {
|
|
15160
|
-
this.enqueueAndForget((() => (this.
|
|
15160
|
+
this.enqueueAndForget((() => (this.ga.push(t), this.va())));
|
|
15161
15161
|
}
|
|
15162
15162
|
/**
|
|
15163
15163
|
* Runs the next operation from the retryable queue. If the operation fails,
|
|
15164
15164
|
* reschedules with backoff.
|
|
15165
|
-
*/ async
|
|
15166
|
-
if (0 !== this.
|
|
15165
|
+
*/ async va() {
|
|
15166
|
+
if (0 !== this.ga.length) {
|
|
15167
15167
|
try {
|
|
15168
|
-
await this.
|
|
15168
|
+
await this.ga[0](), this.ga.shift(), this.ur.reset();
|
|
15169
15169
|
} catch (t) {
|
|
15170
15170
|
if (!Zs(t)) throw t;
|
|
15171
15171
|
// Failure will be handled by AsyncQueue
|
|
15172
15172
|
O("AsyncQueue", "Operation failed with retryable error: " + t);
|
|
15173
15173
|
}
|
|
15174
|
-
this.
|
|
15174
|
+
this.ga.length > 0 &&
|
|
15175
15175
|
// If there are additional operations, we re-schedule `retryNextOp()`.
|
|
15176
15176
|
// This is necessary to run retryable operations that failed during
|
|
15177
15177
|
// their initial attempt since we don't know whether they are already
|
|
@@ -15182,12 +15182,12 @@ function Ca(t, e, ...n) {
|
|
|
15182
15182
|
// Since `backoffAndRun()` cancels an existing backoff and schedules a
|
|
15183
15183
|
// new backoff on every call, there is only ever a single additional
|
|
15184
15184
|
// operation in the queue.
|
|
15185
|
-
this.ur.Zi((() => this.
|
|
15185
|
+
this.ur.Zi((() => this.va()));
|
|
15186
15186
|
}
|
|
15187
15187
|
}
|
|
15188
|
-
|
|
15189
|
-
const e = this.
|
|
15190
|
-
this.
|
|
15188
|
+
Pa(t) {
|
|
15189
|
+
const e = this.ma.then((() => (this.Ea = !0, t().catch((t => {
|
|
15190
|
+
this.Ta = t, this.Ea = !1;
|
|
15191
15191
|
const e =
|
|
15192
15192
|
/**
|
|
15193
15193
|
* Chrome includes Error.message in Error.stack. Other browsers do not.
|
|
@@ -15219,38 +15219,38 @@ function Ca(t, e, ...n) {
|
|
|
15219
15219
|
// all further attempts to chain (via .then) will just short-circuit
|
|
15220
15220
|
// and return the rejected Promise.
|
|
15221
15221
|
throw M("INTERNAL UNHANDLED ERROR: ", e), t;
|
|
15222
|
-
})).then((t => (this.
|
|
15223
|
-
return this.
|
|
15222
|
+
})).then((t => (this.Ea = !1, t))))));
|
|
15223
|
+
return this.ma = e, e;
|
|
15224
15224
|
}
|
|
15225
15225
|
enqueueAfterDelay(t, e, n) {
|
|
15226
|
-
this.
|
|
15226
|
+
this.ba(),
|
|
15227
15227
|
// Fast-forward delays for timerIds that have been overriden.
|
|
15228
|
-
this.
|
|
15229
|
-
const s = Mo.createAndSchedule(this, t, e, n, (t => this.
|
|
15230
|
-
return this.
|
|
15228
|
+
this.Aa.indexOf(t) > -1 && (e = 0);
|
|
15229
|
+
const s = Mo.createAndSchedule(this, t, e, n, (t => this.Va(t)));
|
|
15230
|
+
return this.pa.push(s), s;
|
|
15231
15231
|
}
|
|
15232
|
-
|
|
15233
|
-
this.
|
|
15232
|
+
ba() {
|
|
15233
|
+
this.Ta && B();
|
|
15234
15234
|
}
|
|
15235
15235
|
verifyOperationInProgress() {}
|
|
15236
15236
|
/**
|
|
15237
15237
|
* Waits until all currently queued tasks are finished executing. Delayed
|
|
15238
15238
|
* operations are not run.
|
|
15239
|
-
*/ async
|
|
15239
|
+
*/ async Sa() {
|
|
15240
15240
|
// Operations in the queue prior to draining may have enqueued additional
|
|
15241
15241
|
// operations. Keep draining the queue until the tail is no longer advanced,
|
|
15242
15242
|
// which indicates that no more new operations were enqueued and that all
|
|
15243
15243
|
// operations were executed.
|
|
15244
15244
|
let t;
|
|
15245
15245
|
do {
|
|
15246
|
-
t = this.
|
|
15247
|
-
} while (t !== this.
|
|
15246
|
+
t = this.ma, await t;
|
|
15247
|
+
} while (t !== this.ma);
|
|
15248
15248
|
}
|
|
15249
15249
|
/**
|
|
15250
15250
|
* For Tests: Determine if a delayed operation with a particular TimerId
|
|
15251
15251
|
* exists.
|
|
15252
|
-
*/
|
|
15253
|
-
for (const e of this.
|
|
15252
|
+
*/ Da(t) {
|
|
15253
|
+
for (const e of this.pa) if (e.timerId === t) return !0;
|
|
15254
15254
|
return !1;
|
|
15255
15255
|
}
|
|
15256
15256
|
/**
|
|
@@ -15259,28 +15259,28 @@ function Ca(t, e, ...n) {
|
|
|
15259
15259
|
* @param lastTimerId - Delayed operations up to and including this TimerId
|
|
15260
15260
|
* will be drained. Pass TimerId.All to run all delayed operations.
|
|
15261
15261
|
* @returns a Promise that resolves once all operations have been run.
|
|
15262
|
-
*/
|
|
15262
|
+
*/ Ca(t) {
|
|
15263
15263
|
// Note that draining may generate more delayed ops, so we do that first.
|
|
15264
|
-
return this.
|
|
15264
|
+
return this.Sa().then((() => {
|
|
15265
15265
|
// Run ops in the same order they'd run if they ran naturally.
|
|
15266
|
-
this.
|
|
15267
|
-
for (const e of this.
|
|
15268
|
-
return this.
|
|
15266
|
+
this.pa.sort(((t, e) => t.targetTimeMs - e.targetTimeMs));
|
|
15267
|
+
for (const e of this.pa) if (e.skipDelay(), "all" /* All */ !== t && e.timerId === t) break;
|
|
15268
|
+
return this.Sa();
|
|
15269
15269
|
}));
|
|
15270
15270
|
}
|
|
15271
15271
|
/**
|
|
15272
15272
|
* For Tests: Skip all subsequent delays for a timer id.
|
|
15273
|
-
*/
|
|
15274
|
-
this.
|
|
15273
|
+
*/ Na(t) {
|
|
15274
|
+
this.Aa.push(t);
|
|
15275
15275
|
}
|
|
15276
|
-
/** Called once a DelayedOperation is run or canceled. */
|
|
15276
|
+
/** Called once a DelayedOperation is run or canceled. */ Va(t) {
|
|
15277
15277
|
// NOTE: indexOf / slice are O(n), but delayedOperations is expected to be small.
|
|
15278
|
-
const e = this.
|
|
15279
|
-
this.
|
|
15278
|
+
const e = this.pa.indexOf(t);
|
|
15279
|
+
this.pa.splice(e, 1);
|
|
15280
15280
|
}
|
|
15281
15281
|
}
|
|
15282
15282
|
|
|
15283
|
-
function $
|
|
15283
|
+
function $c(t) {
|
|
15284
15284
|
/**
|
|
15285
15285
|
* Returns true if obj is an object and contains at least one of the specified
|
|
15286
15286
|
* methods.
|
|
@@ -15315,7 +15315,7 @@ function $a(t) {
|
|
|
15315
15315
|
*/ (t, [ "next", "error", "complete" ]);
|
|
15316
15316
|
}
|
|
15317
15317
|
|
|
15318
|
-
class
|
|
15318
|
+
class Oc {
|
|
15319
15319
|
constructor() {
|
|
15320
15320
|
this._progressObserver = {}, this._taskCompletionResolver = new W, this._lastProgress = {
|
|
15321
15321
|
taskState: "Running",
|
|
@@ -15399,27 +15399,27 @@ class Oa {
|
|
|
15399
15399
|
* See the License for the specific language governing permissions and
|
|
15400
15400
|
* limitations under the License.
|
|
15401
15401
|
*/
|
|
15402
|
-
/** DOMException error code constants. */ const
|
|
15402
|
+
/** DOMException error code constants. */ const Mc = -1;
|
|
15403
15403
|
|
|
15404
15404
|
/**
|
|
15405
15405
|
* The Cloud Firestore service interface.
|
|
15406
15406
|
*
|
|
15407
15407
|
* Do not call this constructor directly. Instead, use {@link getFirestore}.
|
|
15408
15408
|
*/
|
|
15409
|
-
class
|
|
15409
|
+
class Fc extends Rc {
|
|
15410
15410
|
/** @hideconstructor */
|
|
15411
15411
|
constructor(t, e, n) {
|
|
15412
15412
|
super(t, e, n),
|
|
15413
15413
|
/**
|
|
15414
15414
|
* Whether it's a {@link Firestore} or Firestore Lite instance.
|
|
15415
15415
|
*/
|
|
15416
|
-
this.type = "firestore", this._queue = new
|
|
15416
|
+
this.type = "firestore", this._queue = new xc, this._persistenceKey = "name" in t ? t.name : "[DEFAULT]";
|
|
15417
15417
|
}
|
|
15418
15418
|
_terminate() {
|
|
15419
15419
|
return this._firestoreClient ||
|
|
15420
15420
|
// The client must be initialized to ensure that all subsequent API
|
|
15421
15421
|
// usage throws an exception.
|
|
15422
|
-
|
|
15422
|
+
qc(this), this._firestoreClient.terminate();
|
|
15423
15423
|
}
|
|
15424
15424
|
}
|
|
15425
15425
|
|
|
@@ -15433,7 +15433,7 @@ class Fa extends Ra {
|
|
|
15433
15433
|
* be associated.
|
|
15434
15434
|
* @param settings - A settings object to configure the {@link Firestore} instance.
|
|
15435
15435
|
* @returns A newly initialized {@link Firestore} instance.
|
|
15436
|
-
*/ function
|
|
15436
|
+
*/ function Lc(t, e) {
|
|
15437
15437
|
const n = _getProvider(t, "firestore");
|
|
15438
15438
|
if (n.isInitialized()) {
|
|
15439
15439
|
const t = n.getImmediate(), s = n.getOptions();
|
|
@@ -15454,22 +15454,22 @@ class Fa extends Ra {
|
|
|
15454
15454
|
* @param app - The {@link @firebase/app#FirebaseApp} instance that the returned {@link Firestore}
|
|
15455
15455
|
* instance is associated with.
|
|
15456
15456
|
* @returns The {@link Firestore} instance of the provided app.
|
|
15457
|
-
*/ function
|
|
15457
|
+
*/ function Bc(e = getApp()) {
|
|
15458
15458
|
return _getProvider(e, "firestore").getImmediate();
|
|
15459
15459
|
}
|
|
15460
15460
|
|
|
15461
15461
|
/**
|
|
15462
15462
|
* @internal
|
|
15463
|
-
*/ function
|
|
15464
|
-
return t._firestoreClient ||
|
|
15463
|
+
*/ function Uc(t) {
|
|
15464
|
+
return t._firestoreClient || qc(t), t._firestoreClient.verifyNotTerminated(), t._firestoreClient;
|
|
15465
15465
|
}
|
|
15466
15466
|
|
|
15467
|
-
function
|
|
15467
|
+
function qc(t) {
|
|
15468
15468
|
var e;
|
|
15469
15469
|
const n = t._freezeSettings(), s = function(t, e, n, s) {
|
|
15470
|
-
return new
|
|
15470
|
+
return new dc(t, e, n, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams);
|
|
15471
15471
|
}(t._databaseId, (null === (e = t._app) || void 0 === e ? void 0 : e.options.appId) || "", t._persistenceKey, n);
|
|
15472
|
-
t._firestoreClient = new
|
|
15472
|
+
t._firestoreClient = new Ga(t._authCredentials, t._appCheckCredentials, t._queue, s);
|
|
15473
15473
|
}
|
|
15474
15474
|
|
|
15475
15475
|
/**
|
|
@@ -15494,10 +15494,10 @@ function qa(t) {
|
|
|
15494
15494
|
* @param persistenceSettings - Optional settings object to configure
|
|
15495
15495
|
* persistence.
|
|
15496
15496
|
* @returns A `Promise` that represents successfully enabling persistent storage.
|
|
15497
|
-
*/ function
|
|
15498
|
-
|
|
15499
|
-
const n =
|
|
15500
|
-
return
|
|
15497
|
+
*/ function Kc(t, e) {
|
|
15498
|
+
Zc(t = Ec(t, Fc));
|
|
15499
|
+
const n = Uc(t), s = t._freezeSettings(), i = new Ua;
|
|
15500
|
+
return Qc(n, i, new La(i, s.cacheSizeBytes, null == e ? void 0 : e.forceOwnership));
|
|
15501
15501
|
}
|
|
15502
15502
|
|
|
15503
15503
|
/**
|
|
@@ -15521,10 +15521,10 @@ function qa(t) {
|
|
|
15521
15521
|
* @param firestore - The {@link Firestore} instance to enable persistence for.
|
|
15522
15522
|
* @returns A `Promise` that represents successfully enabling persistent
|
|
15523
15523
|
* storage.
|
|
15524
|
-
*/ function
|
|
15525
|
-
|
|
15526
|
-
const e =
|
|
15527
|
-
return
|
|
15524
|
+
*/ function jc(t) {
|
|
15525
|
+
Zc(t = Ec(t, Fc));
|
|
15526
|
+
const e = Uc(t), n = t._freezeSettings(), s = new Ua;
|
|
15527
|
+
return Qc(e, s, new Ba(s, n.cacheSizeBytes));
|
|
15528
15528
|
}
|
|
15529
15529
|
|
|
15530
15530
|
/**
|
|
@@ -15532,11 +15532,11 @@ function qa(t) {
|
|
|
15532
15532
|
* If the operation fails with a recoverable error (see
|
|
15533
15533
|
* `canRecoverFromIndexedDbError()` below), the returned Promise is rejected
|
|
15534
15534
|
* but the client remains usable.
|
|
15535
|
-
*/ function
|
|
15535
|
+
*/ function Qc(t, e, n) {
|
|
15536
15536
|
const s = new W;
|
|
15537
15537
|
return t.asyncQueue.enqueue((async () => {
|
|
15538
15538
|
try {
|
|
15539
|
-
await
|
|
15539
|
+
await za(t, n), await Ha(t, e), s.resolve();
|
|
15540
15540
|
} catch (t) {
|
|
15541
15541
|
if (!
|
|
15542
15542
|
/**
|
|
@@ -15590,7 +15590,7 @@ function qa(t) {
|
|
|
15590
15590
|
})).then((() => s.promise));
|
|
15591
15591
|
}
|
|
15592
15592
|
|
|
15593
|
-
function
|
|
15593
|
+
function Wc(t) {
|
|
15594
15594
|
if (t._initialized && !t._terminated) throw new Q(j.FAILED_PRECONDITION, "Persistence can only be cleared before a Firestore instance is initialized or after it is terminated.");
|
|
15595
15595
|
const e = new W;
|
|
15596
15596
|
return t._queue.enqueueAndForgetEvenWhileRestricted((async () => {
|
|
@@ -15599,7 +15599,7 @@ function Wa(t) {
|
|
|
15599
15599
|
if (!Js.Pt()) return Promise.resolve();
|
|
15600
15600
|
const e = t + "main";
|
|
15601
15601
|
await Js.delete(e);
|
|
15602
|
-
}(
|
|
15602
|
+
}(ar(t._databaseId, t._persistenceKey)), e.resolve();
|
|
15603
15603
|
} catch (t) {
|
|
15604
15604
|
e.reject(t);
|
|
15605
15605
|
}
|
|
@@ -15621,11 +15621,11 @@ function Wa(t) {
|
|
|
15621
15621
|
*
|
|
15622
15622
|
* @returns A `Promise` which resolves when all currently pending writes have been
|
|
15623
15623
|
* acknowledged by the backend.
|
|
15624
|
-
*/ function
|
|
15624
|
+
*/ function Gc(t) {
|
|
15625
15625
|
return function(t) {
|
|
15626
15626
|
const e = new W;
|
|
15627
|
-
return t.asyncQueue.enqueueAndForget((async () =>
|
|
15628
|
-
}(
|
|
15627
|
+
return t.asyncQueue.enqueueAndForget((async () => _a(await ec(t), e))), e.promise;
|
|
15628
|
+
}(Uc(t = Ec(t, Fc)));
|
|
15629
15629
|
}
|
|
15630
15630
|
|
|
15631
15631
|
/**
|
|
@@ -15633,8 +15633,8 @@ function Wa(t) {
|
|
|
15633
15633
|
* call to {@link disableNetwork}.
|
|
15634
15634
|
*
|
|
15635
15635
|
* @returns A `Promise` that is resolved once the network has been enabled.
|
|
15636
|
-
*/ function
|
|
15637
|
-
return
|
|
15636
|
+
*/ function zc(t) {
|
|
15637
|
+
return sc(Uc(t = Ec(t, Fc)));
|
|
15638
15638
|
}
|
|
15639
15639
|
|
|
15640
15640
|
/**
|
|
@@ -15644,8 +15644,8 @@ function Wa(t) {
|
|
|
15644
15644
|
* operations will be queued until the network is restored.
|
|
15645
15645
|
*
|
|
15646
15646
|
* @returns A `Promise` that is resolved once the network has been disabled.
|
|
15647
|
-
*/ function
|
|
15648
|
-
return
|
|
15647
|
+
*/ function Hc(t) {
|
|
15648
|
+
return ic(Uc(t = Ec(t, Fc)));
|
|
15649
15649
|
}
|
|
15650
15650
|
|
|
15651
15651
|
/**
|
|
@@ -15669,7 +15669,7 @@ function Wa(t) {
|
|
|
15669
15669
|
*
|
|
15670
15670
|
* @returns A `Promise` that is resolved when the instance has been successfully
|
|
15671
15671
|
* terminated.
|
|
15672
|
-
*/ function
|
|
15672
|
+
*/ function Jc(t) {
|
|
15673
15673
|
return _removeServiceInstance(t.app, "firestore"), t._delete();
|
|
15674
15674
|
}
|
|
15675
15675
|
|
|
@@ -15683,9 +15683,9 @@ function Wa(t) {
|
|
|
15683
15683
|
* @returns
|
|
15684
15684
|
* A `LoadBundleTask` object, which notifies callers with progress updates, and completion
|
|
15685
15685
|
* or error events. It can be used as a `Promise<LoadBundleTaskProgress>`.
|
|
15686
|
-
*/ function
|
|
15687
|
-
const n =
|
|
15688
|
-
return
|
|
15686
|
+
*/ function Yc(t, e) {
|
|
15687
|
+
const n = Uc(t = Ec(t, Fc)), s = new Oc;
|
|
15688
|
+
return lc(n, t._databaseId, e, s), s;
|
|
15689
15689
|
}
|
|
15690
15690
|
|
|
15691
15691
|
/**
|
|
@@ -15694,11 +15694,11 @@ function Wa(t) {
|
|
|
15694
15694
|
* The named queries are packaged into bundles on the server side (along
|
|
15695
15695
|
* with resulting documents), and loaded to local cache using `loadBundle`. Once in local
|
|
15696
15696
|
* cache, use this method to extract a {@link Query} by name.
|
|
15697
|
-
*/ function
|
|
15698
|
-
return
|
|
15697
|
+
*/ function Xc(t, e) {
|
|
15698
|
+
return fc(Uc(t = Ec(t, Fc)), e).then((e => e ? new vc(t, null, e.query) : null));
|
|
15699
15699
|
}
|
|
15700
15700
|
|
|
15701
|
-
function
|
|
15701
|
+
function Zc(t) {
|
|
15702
15702
|
if (t._initialized || t._terminated) throw new Q(j.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.");
|
|
15703
15703
|
}
|
|
15704
15704
|
|
|
@@ -15960,22 +15960,22 @@ class tu {
|
|
|
15960
15960
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
15961
15961
|
}
|
|
15962
15962
|
toMutation(t, e) {
|
|
15963
|
-
return null !== this.fieldMask ? new
|
|
15963
|
+
return null !== this.fieldMask ? new an(t, this.data, this.fieldMask, e, this.fieldTransforms) : new on(t, this.data, e, this.fieldTransforms);
|
|
15964
15964
|
}
|
|
15965
15965
|
}
|
|
15966
15966
|
|
|
15967
|
-
/** The result of parsing "update" data (i.e. for an updateData call). */ class
|
|
15967
|
+
/** The result of parsing "update" data (i.e. for an updateData call). */ class au {
|
|
15968
15968
|
constructor(t,
|
|
15969
15969
|
// The fieldMask does not include document transforms.
|
|
15970
15970
|
e, n) {
|
|
15971
15971
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
15972
15972
|
}
|
|
15973
15973
|
toMutation(t, e) {
|
|
15974
|
-
return new
|
|
15974
|
+
return new an(t, this.data, this.fieldMask, e, this.fieldTransforms);
|
|
15975
15975
|
}
|
|
15976
15976
|
}
|
|
15977
15977
|
|
|
15978
|
-
function
|
|
15978
|
+
function cu(t) {
|
|
15979
15979
|
switch (t) {
|
|
15980
15980
|
case 0 /* Set */ :
|
|
15981
15981
|
// fall through
|
|
@@ -16016,55 +16016,55 @@ function au(t) {
|
|
|
16016
16016
|
this.settings = t, this.databaseId = e, this.k = n, this.ignoreUndefinedProperties = s,
|
|
16017
16017
|
// Minor hack: If fieldTransforms is undefined, we assume this is an
|
|
16018
16018
|
// external call and we need to validate the entire path.
|
|
16019
|
-
void 0 === i && this.
|
|
16019
|
+
void 0 === i && this.ka(), this.fieldTransforms = i || [], this.fieldMask = r || [];
|
|
16020
16020
|
}
|
|
16021
16021
|
get path() {
|
|
16022
16022
|
return this.settings.path;
|
|
16023
16023
|
}
|
|
16024
|
-
get
|
|
16025
|
-
return this.settings
|
|
16024
|
+
get xa() {
|
|
16025
|
+
return this.settings.xa;
|
|
16026
16026
|
}
|
|
16027
|
-
/** Returns a new context with the specified settings overwritten. */
|
|
16027
|
+
/** Returns a new context with the specified settings overwritten. */ $a(t) {
|
|
16028
16028
|
return new uu(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.k, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
|
|
16029
16029
|
}
|
|
16030
|
-
|
|
16030
|
+
Oa(t) {
|
|
16031
16031
|
var e;
|
|
16032
|
-
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), s = this
|
|
16032
|
+
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), s = this.$a({
|
|
16033
16033
|
path: n,
|
|
16034
|
-
|
|
16034
|
+
Ma: !1
|
|
16035
16035
|
});
|
|
16036
|
-
return s.
|
|
16036
|
+
return s.Fa(t), s;
|
|
16037
16037
|
}
|
|
16038
|
-
|
|
16038
|
+
La(t) {
|
|
16039
16039
|
var e;
|
|
16040
|
-
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), s = this
|
|
16040
|
+
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), s = this.$a({
|
|
16041
16041
|
path: n,
|
|
16042
|
-
|
|
16042
|
+
Ma: !1
|
|
16043
16043
|
});
|
|
16044
|
-
return s.
|
|
16044
|
+
return s.ka(), s;
|
|
16045
16045
|
}
|
|
16046
|
-
|
|
16046
|
+
Ba(t) {
|
|
16047
16047
|
// TODO(b/34871131): We don't support array paths right now; so make path
|
|
16048
16048
|
// undefined.
|
|
16049
|
-
return this
|
|
16049
|
+
return this.$a({
|
|
16050
16050
|
path: void 0,
|
|
16051
|
-
|
|
16051
|
+
Ma: !0
|
|
16052
16052
|
});
|
|
16053
16053
|
}
|
|
16054
|
-
|
|
16055
|
-
return Su(t, this.settings.methodName, this.settings.
|
|
16054
|
+
Ua(t) {
|
|
16055
|
+
return Su(t, this.settings.methodName, this.settings.qa || !1, this.path, this.settings.Ka);
|
|
16056
16056
|
}
|
|
16057
16057
|
/** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
|
|
16058
16058
|
return void 0 !== this.fieldMask.find((e => t.isPrefixOf(e))) || void 0 !== this.fieldTransforms.find((e => t.isPrefixOf(e.field)));
|
|
16059
16059
|
}
|
|
16060
|
-
|
|
16060
|
+
ka() {
|
|
16061
16061
|
// TODO(b/34871131): Remove null check once we have proper paths for fields
|
|
16062
16062
|
// within arrays.
|
|
16063
|
-
if (this.path) for (let t = 0; t < this.path.length; t++) this.
|
|
16063
|
+
if (this.path) for (let t = 0; t < this.path.length; t++) this.Fa(this.path.get(t));
|
|
16064
16064
|
}
|
|
16065
|
-
|
|
16066
|
-
if (0 === t.length) throw this.
|
|
16067
|
-
if (
|
|
16065
|
+
Fa(t) {
|
|
16066
|
+
if (0 === t.length) throw this.Ua("Document fields must not be empty");
|
|
16067
|
+
if (cu(this.xa) && ru.test(t)) throw this.Ua('Document fields cannot begin and end with "__"');
|
|
16068
16068
|
}
|
|
16069
16069
|
}
|
|
16070
16070
|
|
|
@@ -16075,14 +16075,14 @@ function au(t) {
|
|
|
16075
16075
|
constructor(t, e, n) {
|
|
16076
16076
|
this.databaseId = t, this.ignoreUndefinedProperties = e, this.k = n || eo(t);
|
|
16077
16077
|
}
|
|
16078
|
-
/** Creates a new top-level parse context. */
|
|
16078
|
+
/** Creates a new top-level parse context. */ ja(t, e, n, s = !1) {
|
|
16079
16079
|
return new uu({
|
|
16080
|
-
|
|
16080
|
+
xa: t,
|
|
16081
16081
|
methodName: e,
|
|
16082
|
-
|
|
16082
|
+
Ka: n,
|
|
16083
16083
|
path: mt.emptyPath(),
|
|
16084
|
-
|
|
16085
|
-
|
|
16084
|
+
Ma: !1,
|
|
16085
|
+
qa: s
|
|
16086
16086
|
}, this.databaseId, this.k, this.ignoreUndefinedProperties);
|
|
16087
16087
|
}
|
|
16088
16088
|
}
|
|
@@ -16093,25 +16093,25 @@ function lu(t) {
|
|
|
16093
16093
|
}
|
|
16094
16094
|
|
|
16095
16095
|
/** Parse document data from a set() call. */ function fu(t, e, n, s, i, r = {}) {
|
|
16096
|
-
const o = t.
|
|
16096
|
+
const o = t.ja(r.merge || r.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, i);
|
|
16097
16097
|
bu("Data must be an object, but it was:", o, s);
|
|
16098
|
-
const
|
|
16099
|
-
let
|
|
16100
|
-
if (r.merge)
|
|
16098
|
+
const a = Au(s, o);
|
|
16099
|
+
let c, u;
|
|
16100
|
+
if (r.merge) c = new gt(o.fieldMask), u = o.fieldTransforms; else if (r.mergeFields) {
|
|
16101
16101
|
const t = [];
|
|
16102
16102
|
for (const s of r.mergeFields) {
|
|
16103
16103
|
const i = Pu(e, s, n);
|
|
16104
16104
|
if (!o.contains(i)) throw new Q(j.INVALID_ARGUMENT, `Field '${i}' is specified in your field mask but missing from your input data.`);
|
|
16105
16105
|
Du(t, i) || t.push(i);
|
|
16106
16106
|
}
|
|
16107
|
-
|
|
16108
|
-
} else
|
|
16109
|
-
return new ou(new Qt(
|
|
16107
|
+
c = new gt(t), u = o.fieldTransforms.filter((t => c.covers(t.field)));
|
|
16108
|
+
} else c = null, u = o.fieldTransforms;
|
|
16109
|
+
return new ou(new Qt(a), c, u);
|
|
16110
16110
|
}
|
|
16111
16111
|
|
|
16112
16112
|
class du extends su {
|
|
16113
16113
|
_toFieldTransform(t) {
|
|
16114
|
-
if (2 /* MergeSet */ !== t
|
|
16114
|
+
if (2 /* MergeSet */ !== t.xa) throw 1 /* Update */ === t.xa ? t.Ua(`${this._methodName}() can only appear at the top level of your update data`) : t.Ua(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);
|
|
16115
16115
|
// No transform to add for a delete, but we need to add it to our
|
|
16116
16116
|
// fieldMask so it gets deleted.
|
|
16117
16117
|
return t.fieldMask.push(t.path), null;
|
|
@@ -16138,10 +16138,10 @@ class du extends su {
|
|
|
16138
16138
|
* @param arrayElement - Whether or not the FieldValue has an array.
|
|
16139
16139
|
*/ function wu(t, e, n) {
|
|
16140
16140
|
return new uu({
|
|
16141
|
-
|
|
16142
|
-
|
|
16141
|
+
xa: 3 /* Argument */ ,
|
|
16142
|
+
Ka: e.settings.Ka,
|
|
16143
16143
|
methodName: t._methodName,
|
|
16144
|
-
|
|
16144
|
+
Ma: n
|
|
16145
16145
|
}, e.databaseId, e.k, e.ignoreUndefinedProperties);
|
|
16146
16146
|
}
|
|
16147
16147
|
|
|
@@ -16156,11 +16156,11 @@ class _u extends su {
|
|
|
16156
16156
|
|
|
16157
16157
|
class mu extends su {
|
|
16158
16158
|
constructor(t, e) {
|
|
16159
|
-
super(t), this.
|
|
16159
|
+
super(t), this.Qa = e;
|
|
16160
16160
|
}
|
|
16161
16161
|
_toFieldTransform(t) {
|
|
16162
16162
|
const e = wu(this, t,
|
|
16163
|
-
/*array=*/ !0), n = this.
|
|
16163
|
+
/*array=*/ !0), n = this.Qa.map((t => Iu(t, e))), s = new Ue(n);
|
|
16164
16164
|
return new ze(t.path, s);
|
|
16165
16165
|
}
|
|
16166
16166
|
isEqual(t) {
|
|
@@ -16171,11 +16171,11 @@ class mu extends su {
|
|
|
16171
16171
|
|
|
16172
16172
|
class gu extends su {
|
|
16173
16173
|
constructor(t, e) {
|
|
16174
|
-
super(t), this.
|
|
16174
|
+
super(t), this.Qa = e;
|
|
16175
16175
|
}
|
|
16176
16176
|
_toFieldTransform(t) {
|
|
16177
16177
|
const e = wu(this, t,
|
|
16178
|
-
/*array=*/ !0), n = this.
|
|
16178
|
+
/*array=*/ !0), n = this.Qa.map((t => Iu(t, e))), s = new Ke(n);
|
|
16179
16179
|
return new ze(t.path, s);
|
|
16180
16180
|
}
|
|
16181
16181
|
isEqual(t) {
|
|
@@ -16186,10 +16186,10 @@ class gu extends su {
|
|
|
16186
16186
|
|
|
16187
16187
|
class yu extends su {
|
|
16188
16188
|
constructor(t, e) {
|
|
16189
|
-
super(t), this.
|
|
16189
|
+
super(t), this.Wa = e;
|
|
16190
16190
|
}
|
|
16191
16191
|
_toFieldTransform(t) {
|
|
16192
|
-
const e = new Qe(t.k, $e(t.k, this.
|
|
16192
|
+
const e = new Qe(t.k, $e(t.k, this.Wa));
|
|
16193
16193
|
return new ze(t.path, e);
|
|
16194
16194
|
}
|
|
16195
16195
|
isEqual(t) {
|
|
@@ -16199,40 +16199,40 @@ class yu extends su {
|
|
|
16199
16199
|
}
|
|
16200
16200
|
|
|
16201
16201
|
/** Parse update data from an update() call. */ function pu(t, e, n, s) {
|
|
16202
|
-
const i = t.
|
|
16202
|
+
const i = t.ja(1 /* Update */ , e, n);
|
|
16203
16203
|
bu("Data must be an object, but it was:", i, s);
|
|
16204
16204
|
const r = [], o = Qt.empty();
|
|
16205
16205
|
lt(s, ((t, s) => {
|
|
16206
|
-
const
|
|
16206
|
+
const a = Vu(e, t, n);
|
|
16207
16207
|
// For Compat types, we have to "extract" the underlying types before
|
|
16208
16208
|
// performing validation.
|
|
16209
16209
|
s = getModularInstance(s);
|
|
16210
|
-
const
|
|
16210
|
+
const c = i.La(a);
|
|
16211
16211
|
if (s instanceof du)
|
|
16212
16212
|
// Add it to the field mask, but don't add anything to updateData.
|
|
16213
|
-
r.push(
|
|
16214
|
-
const t = Iu(s,
|
|
16215
|
-
null != t && (r.push(
|
|
16213
|
+
r.push(a); else {
|
|
16214
|
+
const t = Iu(s, c);
|
|
16215
|
+
null != t && (r.push(a), o.set(a, t));
|
|
16216
16216
|
}
|
|
16217
16217
|
}));
|
|
16218
|
-
const
|
|
16219
|
-
return new
|
|
16218
|
+
const a = new gt(r);
|
|
16219
|
+
return new au(o, a, i.fieldTransforms);
|
|
16220
16220
|
}
|
|
16221
16221
|
|
|
16222
16222
|
/** Parse update data from a list of field/value arguments. */ function Tu(t, e, n, s, i, r) {
|
|
16223
|
-
const o = t.
|
|
16223
|
+
const o = t.ja(1 /* Update */ , e, n), a = [ Pu(e, s, n) ], c = [ i ];
|
|
16224
16224
|
if (r.length % 2 != 0) throw new Q(j.INVALID_ARGUMENT, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);
|
|
16225
|
-
for (let t = 0; t < r.length; t += 2)
|
|
16225
|
+
for (let t = 0; t < r.length; t += 2) a.push(Pu(e, r[t])), c.push(r[t + 1]);
|
|
16226
16226
|
const u = [], h = Qt.empty();
|
|
16227
16227
|
// We iterate in reverse order to pick the last value for a field if the
|
|
16228
16228
|
// user specified the field multiple times.
|
|
16229
|
-
for (let t =
|
|
16230
|
-
const e =
|
|
16231
|
-
let n =
|
|
16229
|
+
for (let t = a.length - 1; t >= 0; --t) if (!Du(u, a[t])) {
|
|
16230
|
+
const e = a[t];
|
|
16231
|
+
let n = c[t];
|
|
16232
16232
|
// For Compat types, we have to "extract" the underlying types before
|
|
16233
16233
|
// performing validation.
|
|
16234
16234
|
n = getModularInstance(n);
|
|
16235
|
-
const s = o.
|
|
16235
|
+
const s = o.La(e);
|
|
16236
16236
|
if (n instanceof du)
|
|
16237
16237
|
// Add it to the field mask, but don't add anything to updateData.
|
|
16238
16238
|
u.push(e); else {
|
|
@@ -16241,7 +16241,7 @@ class yu extends su {
|
|
|
16241
16241
|
}
|
|
16242
16242
|
}
|
|
16243
16243
|
const l = new gt(u);
|
|
16244
|
-
return new
|
|
16244
|
+
return new au(h, l, o.fieldTransforms);
|
|
16245
16245
|
}
|
|
16246
16246
|
|
|
16247
16247
|
/**
|
|
@@ -16251,7 +16251,7 @@ class yu extends su {
|
|
|
16251
16251
|
* @param allowArrays - Whether the query value is an array that may directly
|
|
16252
16252
|
* contain additional arrays (e.g. the operand of an `in` query).
|
|
16253
16253
|
*/ function Eu(t, e, n, s = !1) {
|
|
16254
|
-
return Iu(n, t.
|
|
16254
|
+
return Iu(n, t.ja(s ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
|
|
16255
16255
|
}
|
|
16256
16256
|
|
|
16257
16257
|
/**
|
|
@@ -16279,8 +16279,8 @@ class yu extends su {
|
|
|
16279
16279
|
*/
|
|
16280
16280
|
return function(t, e) {
|
|
16281
16281
|
// Sentinels are only supported with writes, and not within arrays.
|
|
16282
|
-
if (!
|
|
16283
|
-
if (!e.path) throw e.
|
|
16282
|
+
if (!cu(e.xa)) throw e.Ua(`${t._methodName}() can only be used with update() and set()`);
|
|
16283
|
+
if (!e.path) throw e.Ua(`${t._methodName}() is not currently supported inside arrays`);
|
|
16284
16284
|
const n = t._toFieldTransform(e);
|
|
16285
16285
|
n && e.fieldTransforms.push(n);
|
|
16286
16286
|
}
|
|
@@ -16304,12 +16304,12 @@ class yu extends su {
|
|
|
16304
16304
|
// the set of values to be included for the IN query) that may directly
|
|
16305
16305
|
// contain additional arrays (each representing an individual field
|
|
16306
16306
|
// value), so we disable this validation.
|
|
16307
|
-
if (e.settings.
|
|
16307
|
+
if (e.settings.Ma && 4 /* ArrayArgument */ !== e.xa) throw e.Ua("Nested arrays are not supported");
|
|
16308
16308
|
return function(t, e) {
|
|
16309
16309
|
const n = [];
|
|
16310
16310
|
let s = 0;
|
|
16311
16311
|
for (const i of t) {
|
|
16312
|
-
let t = Iu(i, e.
|
|
16312
|
+
let t = Iu(i, e.Ba(s));
|
|
16313
16313
|
null == t && (
|
|
16314
16314
|
// Just include nulls in the array for fields being replaced with a
|
|
16315
16315
|
// sentinel.
|
|
@@ -16336,16 +16336,16 @@ class yu extends su {
|
|
|
16336
16336
|
stringValue: t
|
|
16337
16337
|
};
|
|
16338
16338
|
if (t instanceof Date) {
|
|
16339
|
-
const n =
|
|
16339
|
+
const n = ct.fromDate(t);
|
|
16340
16340
|
return {
|
|
16341
16341
|
timestampValue: Qn(e.k, n)
|
|
16342
16342
|
};
|
|
16343
16343
|
}
|
|
16344
|
-
if (t instanceof
|
|
16344
|
+
if (t instanceof ct) {
|
|
16345
16345
|
// Firestore backend truncates precision down to microseconds. To ensure
|
|
16346
16346
|
// offline mode works the same with regards to truncation, perform the
|
|
16347
16347
|
// truncation immediately without waiting for the backend to do that.
|
|
16348
|
-
const n = new
|
|
16348
|
+
const n = new ct(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
|
|
16349
16349
|
return {
|
|
16350
16350
|
timestampValue: Qn(e.k, n)
|
|
16351
16351
|
};
|
|
@@ -16359,14 +16359,14 @@ class yu extends su {
|
|
|
16359
16359
|
if (t instanceof nu) return {
|
|
16360
16360
|
bytesValue: Wn(e.k, t._byteString)
|
|
16361
16361
|
};
|
|
16362
|
-
if (t instanceof
|
|
16362
|
+
if (t instanceof Pc) {
|
|
16363
16363
|
const n = e.databaseId, s = t.firestore._databaseId;
|
|
16364
|
-
if (!s.isEqual(n)) throw e.
|
|
16364
|
+
if (!s.isEqual(n)) throw e.Ua(`Document reference is for database ${s.projectId}/${s.database} but should be for database ${n.projectId}/${n.database}`);
|
|
16365
16365
|
return {
|
|
16366
16366
|
referenceValue: Hn(t.firestore._databaseId || e.databaseId, t._key.path)
|
|
16367
16367
|
};
|
|
16368
16368
|
}
|
|
16369
|
-
throw e.
|
|
16369
|
+
throw e.Ua(`Unsupported field value: ${Tc(t)}`);
|
|
16370
16370
|
}
|
|
16371
16371
|
/**
|
|
16372
16372
|
* Checks whether an object looks like a JSON object that should be converted
|
|
@@ -16383,7 +16383,7 @@ function Au(t, e) {
|
|
|
16383
16383
|
// If we encounter an empty object, we explicitly add it to the update
|
|
16384
16384
|
// mask to ensure that the server creates a map entry.
|
|
16385
16385
|
e.path && e.path.length > 0 && e.fieldMask.push(e.path) : lt(t, ((t, s) => {
|
|
16386
|
-
const i = Iu(s, e.
|
|
16386
|
+
const i = Iu(s, e.Oa(t));
|
|
16387
16387
|
null != i && (n[t] = i);
|
|
16388
16388
|
})), {
|
|
16389
16389
|
mapValue: {
|
|
@@ -16393,15 +16393,15 @@ function Au(t, e) {
|
|
|
16393
16393
|
}
|
|
16394
16394
|
|
|
16395
16395
|
function Ru(t) {
|
|
16396
|
-
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof
|
|
16396
|
+
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof ct || t instanceof iu || t instanceof nu || t instanceof Pc || t instanceof su);
|
|
16397
16397
|
}
|
|
16398
16398
|
|
|
16399
16399
|
function bu(t, e, n) {
|
|
16400
16400
|
if (!Ru(n) || !function(t) {
|
|
16401
16401
|
return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
|
|
16402
16402
|
}(n)) {
|
|
16403
|
-
const s =
|
|
16404
|
-
throw "an object" === s ? e.
|
|
16403
|
+
const s = Tc(n);
|
|
16404
|
+
throw "an object" === s ? e.Ua(t + " a custom object") : e.Ua(t + " " + s);
|
|
16405
16405
|
}
|
|
16406
16406
|
}
|
|
16407
16407
|
|
|
@@ -16445,11 +16445,11 @@ function bu(t, e, n) {
|
|
|
16445
16445
|
|
|
16446
16446
|
function Su(t, e, n, s, i) {
|
|
16447
16447
|
const r = s && !s.isEmpty(), o = void 0 !== i;
|
|
16448
|
-
let
|
|
16449
|
-
n && (
|
|
16450
|
-
let
|
|
16451
|
-
return (r || o) && (
|
|
16452
|
-
|
|
16448
|
+
let a = `Function ${e}() called with invalid data`;
|
|
16449
|
+
n && (a += " (via `toFirestore()`)"), a += ". ";
|
|
16450
|
+
let c = "";
|
|
16451
|
+
return (r || o) && (c += " (found", r && (c += ` in field ${s}`), o && (c += ` in document ${i}`),
|
|
16452
|
+
c += ")"), new Q(j.INVALID_ARGUMENT, a + t + c);
|
|
16453
16453
|
}
|
|
16454
16454
|
|
|
16455
16455
|
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function Du(t, e) {
|
|
@@ -16496,7 +16496,7 @@ function Su(t, e, n, s, i) {
|
|
|
16496
16496
|
/**
|
|
16497
16497
|
* The `DocumentReference` for the document included in the `DocumentSnapshot`.
|
|
16498
16498
|
*/ get ref() {
|
|
16499
|
-
return new
|
|
16499
|
+
return new Pc(this._firestore, this._converter, this._key);
|
|
16500
16500
|
}
|
|
16501
16501
|
/**
|
|
16502
16502
|
* Signals whether or not the document at the snapshot's location exists.
|
|
@@ -16804,7 +16804,7 @@ function Fu(t) {
|
|
|
16804
16804
|
* @param right - A snapshot to compare.
|
|
16805
16805
|
* @returns true if the snapshots are equal.
|
|
16806
16806
|
*/ function Lu(t, e) {
|
|
16807
|
-
return t instanceof $u && e instanceof $u ? 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 Mu && e instanceof Mu && (t._firestore === e._firestore &&
|
|
16807
|
+
return t instanceof $u && e instanceof $u ? 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 Mu && e instanceof Mu && (t._firestore === e._firestore && kc(t.query, e.query) && t.metadata.isEqual(e.metadata) && t._snapshot.isEqual(e._snapshot));
|
|
16808
16808
|
}
|
|
16809
16809
|
|
|
16810
16810
|
/**
|
|
@@ -16850,27 +16850,27 @@ function Fu(t) {
|
|
|
16850
16850
|
|
|
16851
16851
|
class Ku extends Uu {
|
|
16852
16852
|
constructor(t, e, n) {
|
|
16853
|
-
super(), this.
|
|
16853
|
+
super(), this.Ga = t, this.za = e, this.Ha = n, this.type = "where";
|
|
16854
16854
|
}
|
|
16855
16855
|
_apply(t) {
|
|
16856
16856
|
const e = lu(t.firestore), n = function(t, e, n, s, i, r, o) {
|
|
16857
|
-
let
|
|
16857
|
+
let a;
|
|
16858
16858
|
if (i.isKeyField()) {
|
|
16859
16859
|
if ("array-contains" /* ARRAY_CONTAINS */ === r || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === r) throw new Q(j.INVALID_ARGUMENT, `Invalid Query. You can't perform '${r}' queries on documentId().`);
|
|
16860
16860
|
if ("in" /* IN */ === r || "not-in" /* NOT_IN */ === r) {
|
|
16861
16861
|
ih(o, r);
|
|
16862
16862
|
const e = [];
|
|
16863
16863
|
for (const n of o) e.push(sh(s, t, n));
|
|
16864
|
-
|
|
16864
|
+
a = {
|
|
16865
16865
|
arrayValue: {
|
|
16866
16866
|
values: e
|
|
16867
16867
|
}
|
|
16868
16868
|
};
|
|
16869
|
-
} else
|
|
16869
|
+
} else a = sh(s, t, o);
|
|
16870
16870
|
} else "in" /* IN */ !== r && "not-in" /* NOT_IN */ !== r && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== r || ih(o, r),
|
|
16871
|
-
|
|
16871
|
+
a = Eu(n, e, o,
|
|
16872
16872
|
/* allowArrays= */ "in" /* IN */ === r || "not-in" /* NOT_IN */ === r);
|
|
16873
|
-
const
|
|
16873
|
+
const c = te.create(i, r, a);
|
|
16874
16874
|
return function(t, e) {
|
|
16875
16875
|
if (e.V()) {
|
|
16876
16876
|
const n = Ie(t);
|
|
@@ -16918,9 +16918,9 @@ class Ku extends Uu {
|
|
|
16918
16918
|
if (null !== n)
|
|
16919
16919
|
// Special case when it's a duplicate op to give a slightly clearer error message.
|
|
16920
16920
|
throw n === e.op ? new Q(j.INVALID_ARGUMENT, `Invalid query. You cannot use more than one '${e.op.toString()}' filter.`) : new Q(j.INVALID_ARGUMENT, `Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`);
|
|
16921
|
-
}(t,
|
|
16922
|
-
}(t._query, "where", e, t.firestore._databaseId, this.
|
|
16923
|
-
return new
|
|
16921
|
+
}(t, c), c;
|
|
16922
|
+
}(t._query, "where", e, t.firestore._databaseId, this.Ga, this.za, this.Ha);
|
|
16923
|
+
return new vc(t.firestore, t.converter, function(t, e) {
|
|
16924
16924
|
const n = t.filters.concat([ e ]);
|
|
16925
16925
|
return new me(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
|
|
16926
16926
|
}(t._query, n));
|
|
@@ -16944,7 +16944,7 @@ class Ku extends Uu {
|
|
|
16944
16944
|
|
|
16945
16945
|
class Qu extends Uu {
|
|
16946
16946
|
constructor(t, e) {
|
|
16947
|
-
super(), this.
|
|
16947
|
+
super(), this.Ga = t, this.Ja = e, this.type = "orderBy";
|
|
16948
16948
|
}
|
|
16949
16949
|
_apply(t) {
|
|
16950
16950
|
const e = function(t, e, n) {
|
|
@@ -16969,8 +16969,8 @@ class Qu extends Uu {
|
|
|
16969
16969
|
* Will throw if the document does not contain all fields of the order by
|
|
16970
16970
|
* of the query or if any of the fields in the order by are an uncommitted
|
|
16971
16971
|
* server timestamp.
|
|
16972
|
-
*/ (t._query, this.
|
|
16973
|
-
return new
|
|
16972
|
+
*/ (t._query, this.Ga, this.Ja);
|
|
16973
|
+
return new vc(t.firestore, t.converter, function(t, e) {
|
|
16974
16974
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
16975
16975
|
const n = t.explicitOrderBy.concat([ e ]);
|
|
16976
16976
|
return new me(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
|
|
@@ -16993,10 +16993,10 @@ class Qu extends Uu {
|
|
|
16993
16993
|
|
|
16994
16994
|
class Gu extends Uu {
|
|
16995
16995
|
constructor(t, e, n) {
|
|
16996
|
-
super(), this.type = t, this.
|
|
16996
|
+
super(), this.type = t, this.Ya = e, this.Xa = n;
|
|
16997
16997
|
}
|
|
16998
16998
|
_apply(t) {
|
|
16999
|
-
return new
|
|
16999
|
+
return new vc(t.firestore, t.converter, Pe(t._query, this.Ya, this.Xa));
|
|
17000
17000
|
}
|
|
17001
17001
|
}
|
|
17002
17002
|
|
|
@@ -17006,7 +17006,7 @@ class Gu extends Uu {
|
|
|
17006
17006
|
* @param limit - The maximum number of items to return.
|
|
17007
17007
|
* @returns The created {@link Query}.
|
|
17008
17008
|
*/ function zu(t) {
|
|
17009
|
-
return
|
|
17009
|
+
return Ic("limit", t), new Gu("limit", t, "F" /* First */);
|
|
17010
17010
|
}
|
|
17011
17011
|
|
|
17012
17012
|
/**
|
|
@@ -17018,16 +17018,16 @@ class Gu extends Uu {
|
|
|
17018
17018
|
* @param limit - The maximum number of items to return.
|
|
17019
17019
|
* @returns The created {@link Query}.
|
|
17020
17020
|
*/ function Hu(t) {
|
|
17021
|
-
return
|
|
17021
|
+
return Ic("limitToLast", t), new Gu("limitToLast", t, "L" /* Last */);
|
|
17022
17022
|
}
|
|
17023
17023
|
|
|
17024
17024
|
class Ju extends Uu {
|
|
17025
17025
|
constructor(t, e, n) {
|
|
17026
|
-
super(), this.type = t, this.
|
|
17026
|
+
super(), this.type = t, this.Za = e, this.tc = n;
|
|
17027
17027
|
}
|
|
17028
17028
|
_apply(t) {
|
|
17029
|
-
const e = nh(t, this.type, this.
|
|
17030
|
-
return new
|
|
17029
|
+
const e = nh(t, this.type, this.Za, this.tc);
|
|
17030
|
+
return new vc(t.firestore, t.converter, function(t, e) {
|
|
17031
17031
|
return new me(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
|
|
17032
17032
|
}(t._query, e));
|
|
17033
17033
|
}
|
|
@@ -17044,11 +17044,11 @@ function Xu(...t) {
|
|
|
17044
17044
|
|
|
17045
17045
|
class Zu extends Uu {
|
|
17046
17046
|
constructor(t, e, n) {
|
|
17047
|
-
super(), this.type = t, this.
|
|
17047
|
+
super(), this.type = t, this.Za = e, this.tc = n;
|
|
17048
17048
|
}
|
|
17049
17049
|
_apply(t) {
|
|
17050
|
-
const e = nh(t, this.type, this.
|
|
17051
|
-
return new
|
|
17050
|
+
const e = nh(t, this.type, this.Za, this.tc);
|
|
17051
|
+
return new vc(t.firestore, t.converter, function(t, e) {
|
|
17052
17052
|
return new me(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
|
|
17053
17053
|
}(t._query, e));
|
|
17054
17054
|
}
|
|
@@ -17093,22 +17093,22 @@ function eh(...t) {
|
|
|
17093
17093
|
// Use explicit order by's because it has to match the query the user made
|
|
17094
17094
|
const o = t.explicitOrderBy;
|
|
17095
17095
|
if (i.length > o.length) throw new Q(j.INVALID_ARGUMENT, `Too many arguments provided to ${s}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);
|
|
17096
|
-
const
|
|
17096
|
+
const a = [];
|
|
17097
17097
|
for (let r = 0; r < i.length; r++) {
|
|
17098
|
-
const
|
|
17098
|
+
const c = i[r];
|
|
17099
17099
|
if (o[r].field.isKeyField()) {
|
|
17100
|
-
if ("string" != typeof
|
|
17101
|
-
if (!Ae(t) && -1 !==
|
|
17102
|
-
const n = t.path.child(wt.fromString(
|
|
17100
|
+
if ("string" != typeof c) throw new Q(j.INVALID_ARGUMENT, `Invalid query. Expected a string for document ID in ${s}(), but got a ${typeof c}`);
|
|
17101
|
+
if (!Ae(t) && -1 !== c.indexOf("/")) throw new Q(j.INVALID_ARGUMENT, `Invalid query. When querying a collection and ordering by documentId(), the value passed to ${s}() must be a plain document ID, but '${c}' contains a slash.`);
|
|
17102
|
+
const n = t.path.child(wt.fromString(c));
|
|
17103
17103
|
if (!Dt.isDocumentKey(n)) throw new Q(j.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.`);
|
|
17104
17104
|
const i = new Dt(n);
|
|
17105
|
-
|
|
17105
|
+
a.push(Ft(e, i));
|
|
17106
17106
|
} else {
|
|
17107
|
-
const t = Eu(n, s,
|
|
17108
|
-
|
|
17107
|
+
const t = Eu(n, s, c);
|
|
17108
|
+
a.push(t);
|
|
17109
17109
|
}
|
|
17110
17110
|
}
|
|
17111
|
-
return new he(
|
|
17111
|
+
return new he(a, r);
|
|
17112
17112
|
}
|
|
17113
17113
|
/**
|
|
17114
17114
|
* Parses the given `documentIdValue` into a `ReferenceValue`, throwing
|
|
@@ -17126,8 +17126,8 @@ function sh(t, e, n) {
|
|
|
17126
17126
|
if (!Dt.isDocumentKey(s)) throw new Q(j.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}).`);
|
|
17127
17127
|
return Ft(t, new Dt(s));
|
|
17128
17128
|
}
|
|
17129
|
-
if (n instanceof
|
|
17130
|
-
throw new Q(j.INVALID_ARGUMENT, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${
|
|
17129
|
+
if (n instanceof Pc) return Ft(t, n._key);
|
|
17130
|
+
throw new Q(j.INVALID_ARGUMENT, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Tc(n)}.`);
|
|
17131
17131
|
}
|
|
17132
17132
|
|
|
17133
17133
|
/**
|
|
@@ -17230,12 +17230,12 @@ function rh(t, e, n) {
|
|
|
17230
17230
|
}
|
|
17231
17231
|
convertTimestamp(t) {
|
|
17232
17232
|
const e = Et(t);
|
|
17233
|
-
return new
|
|
17233
|
+
return new ct(e.seconds, e.nanos);
|
|
17234
17234
|
}
|
|
17235
17235
|
convertDocumentKey(t, e) {
|
|
17236
17236
|
const n = wt.fromString(t);
|
|
17237
17237
|
U(Rs(n));
|
|
17238
|
-
const s = new
|
|
17238
|
+
const s = new wc(n.get(1), n.get(3)), i = new Dt(n.popFirst(5));
|
|
17239
17239
|
return s.isEqual(e) ||
|
|
17240
17240
|
// TODO(b/64130202): Somehow support foreign references.
|
|
17241
17241
|
M(`Document ${i} contains a document reference within a different database (${s.projectId}/${s.database}) which is not supported. It will be treated as a reference in the current database (${e.projectId}/${e.database}) instead.`),
|
|
@@ -17267,7 +17267,7 @@ function rh(t, e, n) {
|
|
|
17267
17267
|
* because we want to provide the user with a more specific error message if
|
|
17268
17268
|
* their `set()` or fails due to invalid data originating from a `toFirestore()`
|
|
17269
17269
|
* call.
|
|
17270
|
-
*/ function
|
|
17270
|
+
*/ function ah(t, e, n) {
|
|
17271
17271
|
let s;
|
|
17272
17272
|
// Cast to `any` in order to satisfy the union type constraint on
|
|
17273
17273
|
// toFirestore().
|
|
@@ -17276,7 +17276,7 @@ function rh(t, e, n) {
|
|
|
17276
17276
|
s;
|
|
17277
17277
|
}
|
|
17278
17278
|
|
|
17279
|
-
class
|
|
17279
|
+
class ch extends oh {
|
|
17280
17280
|
constructor(t) {
|
|
17281
17281
|
super(), this.firestore = t;
|
|
17282
17282
|
}
|
|
@@ -17285,7 +17285,7 @@ class ah extends oh {
|
|
|
17285
17285
|
}
|
|
17286
17286
|
convertReference(t) {
|
|
17287
17287
|
const e = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
17288
|
-
return new
|
|
17288
|
+
return new Pc(this.firestore, /* converter= */ null, e);
|
|
17289
17289
|
}
|
|
17290
17290
|
}
|
|
17291
17291
|
|
|
@@ -17320,7 +17320,7 @@ class ah extends oh {
|
|
|
17320
17320
|
}
|
|
17321
17321
|
set(t, e, n) {
|
|
17322
17322
|
this._verifyNotCommitted();
|
|
17323
|
-
const s = hh(t, this._firestore), i =
|
|
17323
|
+
const s = hh(t, this._firestore), i = ah(s.converter, e, n), r = fu(this._dataReader, "WriteBatch.set", s._key, i, null !== s.converter, n);
|
|
17324
17324
|
return this._mutations.push(r.toMutation(s._key, Ye.none())), this;
|
|
17325
17325
|
}
|
|
17326
17326
|
update(t, e, n, ...s) {
|
|
@@ -17420,9 +17420,9 @@ function hh(t, e) {
|
|
|
17420
17420
|
* current document contents.
|
|
17421
17421
|
*/
|
|
17422
17422
|
function lh(t) {
|
|
17423
|
-
t =
|
|
17424
|
-
const e =
|
|
17425
|
-
return
|
|
17423
|
+
t = Ec(t, Pc);
|
|
17424
|
+
const e = Ec(t.firestore, Fc);
|
|
17425
|
+
return oc(Uc(e), t._key).then((n => bh(e, t, n)));
|
|
17426
17426
|
}
|
|
17427
17427
|
|
|
17428
17428
|
class fh extends oh {
|
|
@@ -17434,7 +17434,7 @@ class fh extends oh {
|
|
|
17434
17434
|
}
|
|
17435
17435
|
convertReference(t) {
|
|
17436
17436
|
const e = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
17437
|
-
return new
|
|
17437
|
+
return new Pc(this.firestore, /* converter= */ null, e);
|
|
17438
17438
|
}
|
|
17439
17439
|
}
|
|
17440
17440
|
|
|
@@ -17445,9 +17445,9 @@ class fh extends oh {
|
|
|
17445
17445
|
* @returns A `Promise` resolved with a `DocumentSnapshot` containing the
|
|
17446
17446
|
* current document contents.
|
|
17447
17447
|
*/ function dh(t) {
|
|
17448
|
-
t =
|
|
17449
|
-
const e =
|
|
17450
|
-
return
|
|
17448
|
+
t = Ec(t, Pc);
|
|
17449
|
+
const e = Ec(t.firestore, Fc), n = Uc(e), s = new fh(e);
|
|
17450
|
+
return rc(n, t._key).then((n => new $u(e, s, t._key, n, new xu(null !== n && n.hasLocalMutations,
|
|
17451
17451
|
/* fromCache= */ !0), t.converter)));
|
|
17452
17452
|
}
|
|
17453
17453
|
|
|
@@ -17458,9 +17458,9 @@ class fh extends oh {
|
|
|
17458
17458
|
* @returns A `Promise` resolved with a `DocumentSnapshot` containing the
|
|
17459
17459
|
* current document contents.
|
|
17460
17460
|
*/ function wh(t) {
|
|
17461
|
-
t =
|
|
17462
|
-
const e =
|
|
17463
|
-
return
|
|
17461
|
+
t = Ec(t, Pc);
|
|
17462
|
+
const e = Ec(t.firestore, Fc);
|
|
17463
|
+
return oc(Uc(e), t._key, {
|
|
17464
17464
|
source: "server"
|
|
17465
17465
|
}).then((n => bh(e, t, n)));
|
|
17466
17466
|
}
|
|
@@ -17475,9 +17475,9 @@ class fh extends oh {
|
|
|
17475
17475
|
*
|
|
17476
17476
|
* @returns A `Promise` that will be resolved with the results of the query.
|
|
17477
17477
|
*/ function _h(t) {
|
|
17478
|
-
t =
|
|
17479
|
-
const e =
|
|
17480
|
-
return Bu(t._query),
|
|
17478
|
+
t = Ec(t, vc);
|
|
17479
|
+
const e = Ec(t.firestore, Fc), n = Uc(e), s = new fh(e);
|
|
17480
|
+
return Bu(t._query), cc(n, t._query).then((n => new Mu(e, s, t, n)));
|
|
17481
17481
|
}
|
|
17482
17482
|
|
|
17483
17483
|
/**
|
|
@@ -17486,9 +17486,9 @@ class fh extends oh {
|
|
|
17486
17486
|
*
|
|
17487
17487
|
* @returns A `Promise` that will be resolved with the results of the query.
|
|
17488
17488
|
*/ function mh(t) {
|
|
17489
|
-
t =
|
|
17490
|
-
const e =
|
|
17491
|
-
return
|
|
17489
|
+
t = Ec(t, vc);
|
|
17490
|
+
const e = Ec(t.firestore, Fc), n = Uc(e), s = new fh(e);
|
|
17491
|
+
return ac(n, t._query).then((n => new Mu(e, s, t, n)));
|
|
17492
17492
|
}
|
|
17493
17493
|
|
|
17494
17494
|
/**
|
|
@@ -17497,22 +17497,22 @@ class fh extends oh {
|
|
|
17497
17497
|
*
|
|
17498
17498
|
* @returns A `Promise` that will be resolved with the results of the query.
|
|
17499
17499
|
*/ function gh(t) {
|
|
17500
|
-
t =
|
|
17501
|
-
const e =
|
|
17502
|
-
return
|
|
17500
|
+
t = Ec(t, vc);
|
|
17501
|
+
const e = Ec(t.firestore, Fc), n = Uc(e), s = new fh(e);
|
|
17502
|
+
return cc(n, t._query, {
|
|
17503
17503
|
source: "server"
|
|
17504
17504
|
}).then((n => new Mu(e, s, t, n)));
|
|
17505
17505
|
}
|
|
17506
17506
|
|
|
17507
17507
|
function yh(t, e, n) {
|
|
17508
|
-
t =
|
|
17509
|
-
const s =
|
|
17508
|
+
t = Ec(t, Pc);
|
|
17509
|
+
const s = Ec(t.firestore, Fc), i = ah(t.converter, e, n);
|
|
17510
17510
|
return Rh(s, [ fu(lu(s), "setDoc", t._key, i, null !== t.converter, n).toMutation(t._key, Ye.none()) ]);
|
|
17511
17511
|
}
|
|
17512
17512
|
|
|
17513
17513
|
function ph(t, e, n, ...s) {
|
|
17514
|
-
t =
|
|
17515
|
-
const i =
|
|
17514
|
+
t = Ec(t, Pc);
|
|
17515
|
+
const i = Ec(t.firestore, Fc), r = lu(i);
|
|
17516
17516
|
let o;
|
|
17517
17517
|
o = "string" == typeof (
|
|
17518
17518
|
// For Compat types, we have to "extract" the underlying types before
|
|
@@ -17528,7 +17528,7 @@ function ph(t, e, n, ...s) {
|
|
|
17528
17528
|
* @returns A Promise resolved once the document has been successfully
|
|
17529
17529
|
* deleted from the backend (note that it won't resolve while you're offline).
|
|
17530
17530
|
*/ function Th(t) {
|
|
17531
|
-
return Rh(
|
|
17531
|
+
return Rh(Ec(t.firestore, Fc), [ new ln(t._key, Ye.none()) ]);
|
|
17532
17532
|
}
|
|
17533
17533
|
|
|
17534
17534
|
/**
|
|
@@ -17541,7 +17541,7 @@ function ph(t, e, n, ...s) {
|
|
|
17541
17541
|
* newly created document after it has been written to the backend (Note that it
|
|
17542
17542
|
* won't resolve while you're offline).
|
|
17543
17543
|
*/ function Eh(t, e) {
|
|
17544
|
-
const n =
|
|
17544
|
+
const n = Ec(t.firestore, Fc), s = Cc(t), i = ah(t.converter, e);
|
|
17545
17545
|
return Rh(n, [ fu(lu(t.firestore), "addDoc", s._key, i, null !== t.converter, {}).toMutation(s._key, Ye.exists(!1)) ]).then((() => s));
|
|
17546
17546
|
}
|
|
17547
17547
|
|
|
@@ -17551,27 +17551,27 @@ function Ih(t, ...e) {
|
|
|
17551
17551
|
let r = {
|
|
17552
17552
|
includeMetadataChanges: !1
|
|
17553
17553
|
}, o = 0;
|
|
17554
|
-
"object" != typeof e[o] || $
|
|
17555
|
-
const
|
|
17554
|
+
"object" != typeof e[o] || $c(e[o]) || (r = e[o], o++);
|
|
17555
|
+
const a = {
|
|
17556
17556
|
includeMetadataChanges: r.includeMetadataChanges
|
|
17557
17557
|
};
|
|
17558
|
-
if ($
|
|
17558
|
+
if ($c(e[o])) {
|
|
17559
17559
|
const t = e[o];
|
|
17560
17560
|
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),
|
|
17561
17561
|
e[o + 2] = null === (i = t.complete) || void 0 === i ? void 0 : i.bind(t);
|
|
17562
17562
|
}
|
|
17563
|
-
let
|
|
17564
|
-
if (t instanceof
|
|
17563
|
+
let c, u, h;
|
|
17564
|
+
if (t instanceof Pc) u = Ec(t.firestore, Fc), h = ye(t._key.path), c = {
|
|
17565
17565
|
next: n => {
|
|
17566
17566
|
e[o] && e[o](bh(u, t, n));
|
|
17567
17567
|
},
|
|
17568
17568
|
error: e[o + 1],
|
|
17569
17569
|
complete: e[o + 2]
|
|
17570
17570
|
}; else {
|
|
17571
|
-
const n =
|
|
17572
|
-
u =
|
|
17571
|
+
const n = Ec(t, vc);
|
|
17572
|
+
u = Ec(n.firestore, Fc), h = n._query;
|
|
17573
17573
|
const s = new fh(u);
|
|
17574
|
-
|
|
17574
|
+
c = {
|
|
17575
17575
|
next: t => {
|
|
17576
17576
|
e[o] && e[o](new Mu(u, s, n, t));
|
|
17577
17577
|
},
|
|
@@ -17580,15 +17580,15 @@ function Ih(t, ...e) {
|
|
|
17580
17580
|
}, Bu(t._query);
|
|
17581
17581
|
}
|
|
17582
17582
|
return function(t, e, n, s) {
|
|
17583
|
-
const i = new
|
|
17584
|
-
return t.asyncQueue.enqueueAndForget((async () => jo(await
|
|
17585
|
-
i.
|
|
17583
|
+
const i = new Ka(s), r = new Ho(e, i, n);
|
|
17584
|
+
return t.asyncQueue.enqueueAndForget((async () => jo(await nc(t), r))), () => {
|
|
17585
|
+
i.na(), t.asyncQueue.enqueueAndForget((async () => Qo(await nc(t), r)));
|
|
17586
17586
|
};
|
|
17587
|
-
}(
|
|
17587
|
+
}(Uc(u), h, a, c);
|
|
17588
17588
|
}
|
|
17589
17589
|
|
|
17590
17590
|
function Ah(t, e) {
|
|
17591
|
-
return
|
|
17591
|
+
return uc(Uc(t = Ec(t, Fc)), $c(e) ? e : {
|
|
17592
17592
|
next: e
|
|
17593
17593
|
});
|
|
17594
17594
|
}
|
|
@@ -17599,8 +17599,8 @@ function Ah(t, e) {
|
|
|
17599
17599
|
*/ function Rh(t, e) {
|
|
17600
17600
|
return function(t, e) {
|
|
17601
17601
|
const n = new W;
|
|
17602
|
-
return t.asyncQueue.enqueueAndForget((async () =>
|
|
17603
|
-
}(
|
|
17602
|
+
return t.asyncQueue.enqueueAndForget((async () => ua(await ec(t), e, n))), n.promise;
|
|
17603
|
+
}(Uc(t), e);
|
|
17604
17604
|
}
|
|
17605
17605
|
|
|
17606
17606
|
/**
|
|
@@ -17644,7 +17644,7 @@ function Ah(t, e) {
|
|
|
17644
17644
|
* @param documentRef - A reference to the document to be read.
|
|
17645
17645
|
* @returns A `DocumentSnapshot` with the read data.
|
|
17646
17646
|
*/ get(t) {
|
|
17647
|
-
const e = hh(t, this._firestore), n = new
|
|
17647
|
+
const e = hh(t, this._firestore), n = new ch(this._firestore);
|
|
17648
17648
|
return this._transaction.lookup([ e._key ]).then((t => {
|
|
17649
17649
|
if (!t || 1 !== t.length) return B();
|
|
17650
17650
|
const s = t[0];
|
|
@@ -17654,7 +17654,7 @@ function Ah(t, e) {
|
|
|
17654
17654
|
}));
|
|
17655
17655
|
}
|
|
17656
17656
|
set(t, e, n) {
|
|
17657
|
-
const s = hh(t, this._firestore), i =
|
|
17657
|
+
const s = hh(t, this._firestore), i = ah(s.converter, e, n), r = fu(this._dataReader, "Transaction.set", s._key, i, null !== s.converter, n);
|
|
17658
17658
|
return this._transaction.set(s._key, r), this;
|
|
17659
17659
|
}
|
|
17660
17660
|
update(t, e, n, ...s) {
|
|
@@ -17711,7 +17711,7 @@ function Ah(t, e) {
|
|
|
17711
17711
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
17712
17712
|
* rejected promise with the corresponding failure error is returned.
|
|
17713
17713
|
*/ function vh(t, e) {
|
|
17714
|
-
return
|
|
17714
|
+
return hc(Uc(t = Ec(t, Fc)), (n => e(new Ph(t, n))));
|
|
17715
17715
|
}
|
|
17716
17716
|
|
|
17717
17717
|
/**
|
|
@@ -17826,7 +17826,7 @@ function Ah(t, e) {
|
|
|
17826
17826
|
* @returns A {@link WriteBatch} that can be used to atomically execute multiple
|
|
17827
17827
|
* writes.
|
|
17828
17828
|
*/ function kh(t) {
|
|
17829
|
-
return
|
|
17829
|
+
return Uc(t = Ec(t, Fc)), new uh(t, (e => Rh(t, e)));
|
|
17830
17830
|
}
|
|
17831
17831
|
|
|
17832
17832
|
/**
|
|
@@ -17837,14 +17837,14 @@ function Ah(t, e) {
|
|
|
17837
17837
|
!function(t) {
|
|
17838
17838
|
N = t;
|
|
17839
17839
|
}(SDK_VERSION), _registerComponent(new Component("firestore", ((t, {options: n}) => {
|
|
17840
|
-
const s = t.getProvider("app").getImmediate(), i = new
|
|
17840
|
+
const s = t.getProvider("app").getImmediate(), i = new Fc(s, new J(t.getProvider("auth-internal")), new tt(t.getProvider("app-check-internal")));
|
|
17841
17841
|
return n = Object.assign({
|
|
17842
17842
|
useFetchStreams: e
|
|
17843
17843
|
}, n), i._setSettings(n), i;
|
|
17844
|
-
}), "PUBLIC")), registerVersion(D, "3.4.2-canary.
|
|
17844
|
+
}), "PUBLIC")), registerVersion(D, "3.4.2-canary.922e9ed9a", t),
|
|
17845
17845
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
|
17846
|
-
registerVersion(D, "3.4.2-canary.
|
|
17846
|
+
registerVersion(D, "3.4.2-canary.922e9ed9a", "esm2017");
|
|
17847
17847
|
}();
|
|
17848
17848
|
|
|
17849
|
-
export { oh as AbstractUserDataWriter, nu as Bytes,
|
|
17849
|
+
export { oh as AbstractUserDataWriter, nu as Bytes, Mc as CACHE_SIZE_UNLIMITED, Vc as CollectionReference, Pc as DocumentReference, $u as DocumentSnapshot, tu as FieldPath, su as FieldValue, Fc as Firestore, Q as FirestoreError, iu as GeoPoint, Oc as LoadBundleTask, vc as Query, Uu as QueryConstraint, Ou as QueryDocumentSnapshot, Mu as QuerySnapshot, xu as SnapshotMetadata, ct as Timestamp, Ph as Transaction, uh as WriteBatch, wc as _DatabaseId, Dt as _DocumentKey, et as _EmptyAppCheckTokenProvider, z as _EmptyAuthCredentialsProvider, mt as _FieldPath, Ec as _cast, q as _debugAssert, yt as _isBase64Available, F as _logWarn, gc as _validateIsNotUsedTogether, Eh as addDoc, Ch as arrayRemove, Dh as arrayUnion, Wc as clearIndexedDbPersistence, Sc as collection, Dc as collectionGroup, bc as connectFirestoreEmulator, Th as deleteDoc, Vh as deleteField, Hc as disableNetwork, Cc as doc, eu as documentId, Kc as enableIndexedDbPersistence, jc as enableMultiTabIndexedDbPersistence, zc as enableNetwork, eh as endAt, th as endBefore, Uc as ensureFirestoreConfigured, Rh as executeWrite, lh as getDoc, dh as getDocFromCache, wh as getDocFromServer, _h as getDocs, mh as getDocsFromCache, gh as getDocsFromServer, Bc as getFirestore, Nh as increment, Lc as initializeFirestore, zu as limit, Hu as limitToLast, Yc as loadBundle, Xc as namedQuery, Ih as onSnapshot, Ah as onSnapshotsInSync, Wu as orderBy, qu as query, kc as queryEqual, Nc as refEqual, vh as runTransaction, Sh as serverTimestamp, yh as setDoc, $ as setLogLevel, Lu as snapshotEqual, Xu as startAfter, Yu as startAt, Jc as terminate, ph as updateDoc, Gc as waitForPendingWrites, ju as where, kh as writeBatch };
|
|
17850
17850
|
//# sourceMappingURL=index.esm2017.js.map
|