@firebase/firestore 3.7.1 → 3.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/index.esm2017.js +234 -231
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +622 -621
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +36 -35
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +3 -2
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +234 -231
- package/dist/index.rn.js.map +1 -1
- package/dist/lite/index.browser.esm2017.js +134 -134
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +257 -257
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +2 -2
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +2 -2
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +134 -134
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +17 -17
- package/dist/packages/firestore/dist/index.esm2017.d.ts +1 -1
- package/package.json +10 -10
- package/dist/firestore/test/integration/api_internal/aggregation.test.d.ts +0 -17
- package/dist/lite/firestore/test/integration/api_internal/aggregation.test.d.ts +0 -17
- package/dist/lite/packages/firestore/test/integration/api_internal/aggregation.test.d.ts +0 -17
- package/dist/packages/firestore/test/integration/api_internal/aggregation.test.d.ts +0 -17
|
@@ -66,7 +66,7 @@ w.MOCK_USER = new w("mock-user");
|
|
|
66
66
|
* See the License for the specific language governing permissions and
|
|
67
67
|
* limitations under the License.
|
|
68
68
|
*/
|
|
69
|
-
let m = "9.
|
|
69
|
+
let m = "9.13.0";
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* @license
|
|
@@ -3630,26 +3630,26 @@ class sn {
|
|
|
3630
3630
|
*/
|
|
3631
3631
|
class on extends class {} {
|
|
3632
3632
|
constructor(t, e, n, r) {
|
|
3633
|
-
super(), this.authCredentials = t, this.appCheckCredentials = e, this.
|
|
3634
|
-
this.
|
|
3633
|
+
super(), this.authCredentials = t, this.appCheckCredentials = e, this.connection = n,
|
|
3634
|
+
this.L = r, this.tt = !1;
|
|
3635
3635
|
}
|
|
3636
|
-
|
|
3637
|
-
if (this.
|
|
3636
|
+
et() {
|
|
3637
|
+
if (this.tt) throw new j(q, "The client has already been terminated.");
|
|
3638
3638
|
}
|
|
3639
3639
|
/** Invokes the provided RPC with auth and AppCheck tokens. */ I(t, e, n) {
|
|
3640
|
-
return this.
|
|
3640
|
+
return this.et(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.connection.I(t, e, n, r, s))).catch((t => {
|
|
3641
3641
|
throw "FirebaseError" === t.name ? (t.code === S && (this.authCredentials.invalidateToken(),
|
|
3642
3642
|
this.appCheckCredentials.invalidateToken()), t) : new j(P, t.toString());
|
|
3643
3643
|
}));
|
|
3644
3644
|
}
|
|
3645
3645
|
/** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ P(t, e, n, r) {
|
|
3646
|
-
return this.
|
|
3646
|
+
return this.et(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([s, i]) => this.connection.P(t, e, n, s, i, r))).catch((t => {
|
|
3647
3647
|
throw "FirebaseError" === t.name ? (t.code === S && (this.authCredentials.invalidateToken(),
|
|
3648
3648
|
this.appCheckCredentials.invalidateToken()), t) : new j(P, t.toString());
|
|
3649
3649
|
}));
|
|
3650
3650
|
}
|
|
3651
3651
|
terminate() {
|
|
3652
|
-
this.
|
|
3652
|
+
this.tt = !0;
|
|
3653
3653
|
}
|
|
3654
3654
|
}
|
|
3655
3655
|
|
|
@@ -3705,7 +3705,7 @@ async function hn(t, e) {
|
|
|
3705
3705
|
parent: n.parent
|
|
3706
3706
|
};
|
|
3707
3707
|
}(n.L, be(e)), s = r.parent;
|
|
3708
|
-
n.
|
|
3708
|
+
n.connection.v || delete r.parent;
|
|
3709
3709
|
return (await n.P("RunAggregationQuery", s, r, /*expectedResponseCount=*/ 1)).filter((t => !!t.result)).map((t => t.result.aggregateFields));
|
|
3710
3710
|
}
|
|
3711
3711
|
|
|
@@ -4547,55 +4547,55 @@ function Cn(t) {
|
|
|
4547
4547
|
this.settings = t, this.databaseId = e, this.L = n, this.ignoreUndefinedProperties = r,
|
|
4548
4548
|
// Minor hack: If fieldTransforms is undefined, we assume this is an
|
|
4549
4549
|
// external call and we need to validate the entire path.
|
|
4550
|
-
void 0 === s && this.
|
|
4550
|
+
void 0 === s && this.nt(), this.fieldTransforms = s || [], this.fieldMask = i || [];
|
|
4551
4551
|
}
|
|
4552
4552
|
get path() {
|
|
4553
4553
|
return this.settings.path;
|
|
4554
4554
|
}
|
|
4555
|
-
get
|
|
4556
|
-
return this.settings.
|
|
4555
|
+
get rt() {
|
|
4556
|
+
return this.settings.rt;
|
|
4557
4557
|
}
|
|
4558
|
-
/** Returns a new context with the specified settings overwritten. */
|
|
4558
|
+
/** Returns a new context with the specified settings overwritten. */ st(t) {
|
|
4559
4559
|
return new Ln(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.L, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
|
|
4560
4560
|
}
|
|
4561
|
-
|
|
4561
|
+
it(t) {
|
|
4562
4562
|
var e;
|
|
4563
|
-
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.
|
|
4563
|
+
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.st({
|
|
4564
4564
|
path: n,
|
|
4565
|
-
|
|
4565
|
+
ot: !1
|
|
4566
4566
|
});
|
|
4567
|
-
return r.
|
|
4567
|
+
return r.ut(t), r;
|
|
4568
4568
|
}
|
|
4569
|
-
|
|
4569
|
+
ct(t) {
|
|
4570
4570
|
var e;
|
|
4571
|
-
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.
|
|
4571
|
+
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.st({
|
|
4572
4572
|
path: n,
|
|
4573
|
-
|
|
4573
|
+
ot: !1
|
|
4574
4574
|
});
|
|
4575
|
-
return r.
|
|
4575
|
+
return r.nt(), r;
|
|
4576
4576
|
}
|
|
4577
|
-
|
|
4577
|
+
at(t) {
|
|
4578
4578
|
// TODO(b/34871131): We don't support array paths right now; so make path
|
|
4579
4579
|
// undefined.
|
|
4580
|
-
return this.
|
|
4580
|
+
return this.st({
|
|
4581
4581
|
path: void 0,
|
|
4582
|
-
|
|
4582
|
+
ot: !0
|
|
4583
4583
|
});
|
|
4584
4584
|
}
|
|
4585
|
-
|
|
4586
|
-
return ir(t, this.settings.methodName, this.settings.
|
|
4585
|
+
ht(t) {
|
|
4586
|
+
return ir(t, this.settings.methodName, this.settings.lt || !1, this.path, this.settings.ft);
|
|
4587
4587
|
}
|
|
4588
4588
|
/** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
|
|
4589
4589
|
return void 0 !== this.fieldMask.find((e => t.isPrefixOf(e))) || void 0 !== this.fieldTransforms.find((e => t.isPrefixOf(e.field)));
|
|
4590
4590
|
}
|
|
4591
|
-
|
|
4591
|
+
nt() {
|
|
4592
4592
|
// TODO(b/34871131): Remove null check once we have proper paths for fields
|
|
4593
4593
|
// within arrays.
|
|
4594
|
-
if (this.path) for (let t = 0; t < this.path.length; t++) this.
|
|
4594
|
+
if (this.path) for (let t = 0; t < this.path.length; t++) this.ut(this.path.get(t));
|
|
4595
4595
|
}
|
|
4596
|
-
|
|
4597
|
-
if (0 === t.length) throw this.
|
|
4598
|
-
if (Cn(this.
|
|
4596
|
+
ut(t) {
|
|
4597
|
+
if (0 === t.length) throw this.ht("Document fields must not be empty");
|
|
4598
|
+
if (Cn(this.rt) && qn.test(t)) throw this.ht('Document fields cannot begin and end with "__"');
|
|
4599
4599
|
}
|
|
4600
4600
|
}
|
|
4601
4601
|
|
|
@@ -4606,14 +4606,14 @@ function Cn(t) {
|
|
|
4606
4606
|
constructor(t, e, n) {
|
|
4607
4607
|
this.databaseId = t, this.ignoreUndefinedProperties = e, this.L = n || rn(t);
|
|
4608
4608
|
}
|
|
4609
|
-
/** Creates a new top-level parse context. */
|
|
4609
|
+
/** Creates a new top-level parse context. */ dt(t, e, n, r = !1) {
|
|
4610
4610
|
return new Ln({
|
|
4611
|
-
|
|
4611
|
+
rt: t,
|
|
4612
4612
|
methodName: e,
|
|
4613
|
-
|
|
4613
|
+
ft: n,
|
|
4614
4614
|
path: rt.emptyPath(),
|
|
4615
|
-
|
|
4616
|
-
|
|
4615
|
+
ot: !1,
|
|
4616
|
+
lt: r
|
|
4617
4617
|
}, this.databaseId, this.L, this.ignoreUndefinedProperties);
|
|
4618
4618
|
}
|
|
4619
4619
|
}
|
|
@@ -4624,7 +4624,7 @@ function Un(t) {
|
|
|
4624
4624
|
}
|
|
4625
4625
|
|
|
4626
4626
|
/** Parse document data from a set() call. */ function jn(t, e, n, r, s, i = {}) {
|
|
4627
|
-
const o = t.
|
|
4627
|
+
const o = t.dt(i.merge || i.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, s);
|
|
4628
4628
|
er("Data must be an object, but it was:", o, r);
|
|
4629
4629
|
const u = Zn(r, o);
|
|
4630
4630
|
let c, a;
|
|
@@ -4642,7 +4642,7 @@ function Un(t) {
|
|
|
4642
4642
|
|
|
4643
4643
|
class Bn extends Sn {
|
|
4644
4644
|
_toFieldTransform(t) {
|
|
4645
|
-
if (2 /* MergeSet */ !== t.
|
|
4645
|
+
if (2 /* MergeSet */ !== t.rt) throw 1 /* Update */ === t.rt ? t.ht(`${this._methodName}() can only appear at the top level of your update data`) : t.ht(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);
|
|
4646
4646
|
// No transform to add for a delete, but we need to add it to our
|
|
4647
4647
|
// fieldMask so it gets deleted.
|
|
4648
4648
|
return t.fieldMask.push(t.path), null;
|
|
@@ -4669,10 +4669,10 @@ class Bn extends Sn {
|
|
|
4669
4669
|
* @param arrayElement - Whether or not the FieldValue has an array.
|
|
4670
4670
|
*/ function Qn(t, e, n) {
|
|
4671
4671
|
return new Ln({
|
|
4672
|
-
|
|
4673
|
-
|
|
4672
|
+
rt: 3 /* Argument */ ,
|
|
4673
|
+
ft: e.settings.ft,
|
|
4674
4674
|
methodName: t._methodName,
|
|
4675
|
-
|
|
4675
|
+
ot: n
|
|
4676
4676
|
}, e.databaseId, e.L, e.ignoreUndefinedProperties);
|
|
4677
4677
|
}
|
|
4678
4678
|
|
|
@@ -4687,11 +4687,11 @@ class zn extends Sn {
|
|
|
4687
4687
|
|
|
4688
4688
|
class Wn extends Sn {
|
|
4689
4689
|
constructor(t, e) {
|
|
4690
|
-
super(t), this.
|
|
4690
|
+
super(t), this.wt = e;
|
|
4691
4691
|
}
|
|
4692
4692
|
_toFieldTransform(t) {
|
|
4693
4693
|
const e = Qn(this, t,
|
|
4694
|
-
/*array=*/ !0), n = this.
|
|
4694
|
+
/*array=*/ !0), n = this.wt.map((t => Xn(t, e))), r = new Re(n);
|
|
4695
4695
|
return new Ne(t.path, r);
|
|
4696
4696
|
}
|
|
4697
4697
|
isEqual(t) {
|
|
@@ -4702,11 +4702,11 @@ class Wn extends Sn {
|
|
|
4702
4702
|
|
|
4703
4703
|
class Gn extends Sn {
|
|
4704
4704
|
constructor(t, e) {
|
|
4705
|
-
super(t), this.
|
|
4705
|
+
super(t), this.wt = e;
|
|
4706
4706
|
}
|
|
4707
4707
|
_toFieldTransform(t) {
|
|
4708
4708
|
const e = Qn(this, t,
|
|
4709
|
-
/*array=*/ !0), n = this.
|
|
4709
|
+
/*array=*/ !0), n = this.wt.map((t => Xn(t, e))), r = new Pe(n);
|
|
4710
4710
|
return new Ne(t.path, r);
|
|
4711
4711
|
}
|
|
4712
4712
|
isEqual(t) {
|
|
@@ -4717,10 +4717,10 @@ class Gn extends Sn {
|
|
|
4717
4717
|
|
|
4718
4718
|
class Kn extends Sn {
|
|
4719
4719
|
constructor(t, e) {
|
|
4720
|
-
super(t), this.
|
|
4720
|
+
super(t), this.yt = e;
|
|
4721
4721
|
}
|
|
4722
4722
|
_toFieldTransform(t) {
|
|
4723
|
-
const e = new Ve(t.L, Ie(t.L, this.
|
|
4723
|
+
const e = new Ve(t.L, Ie(t.L, this.yt));
|
|
4724
4724
|
return new Ne(t.path, e);
|
|
4725
4725
|
}
|
|
4726
4726
|
isEqual(t) {
|
|
@@ -4730,7 +4730,7 @@ class Kn extends Sn {
|
|
|
4730
4730
|
}
|
|
4731
4731
|
|
|
4732
4732
|
/** Parse update data from an update() call. */ function Yn(t, e, n, r) {
|
|
4733
|
-
const s = t.
|
|
4733
|
+
const s = t.dt(1 /* Update */ , e, n);
|
|
4734
4734
|
er("Data must be an object, but it was:", s, r);
|
|
4735
4735
|
const i = [], o = Zt.empty();
|
|
4736
4736
|
At(r, ((t, r) => {
|
|
@@ -4738,7 +4738,7 @@ class Kn extends Sn {
|
|
|
4738
4738
|
// For Compat types, we have to "extract" the underlying types before
|
|
4739
4739
|
// performing validation.
|
|
4740
4740
|
r = f(r);
|
|
4741
|
-
const c = s.
|
|
4741
|
+
const c = s.ct(u);
|
|
4742
4742
|
if (r instanceof Bn)
|
|
4743
4743
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4744
4744
|
i.push(u); else {
|
|
@@ -4751,7 +4751,7 @@ class Kn extends Sn {
|
|
|
4751
4751
|
}
|
|
4752
4752
|
|
|
4753
4753
|
/** Parse update data from a list of field/value arguments. */ function Hn(t, e, n, r, s, i) {
|
|
4754
|
-
const o = t.
|
|
4754
|
+
const o = t.dt(1 /* Update */ , e, n), u = [ nr(e, r, n) ], c = [ s ];
|
|
4755
4755
|
if (i.length % 2 != 0) throw new j(V, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);
|
|
4756
4756
|
for (let t = 0; t < i.length; t += 2) u.push(nr(e, i[t])), c.push(i[t + 1]);
|
|
4757
4757
|
const a = [], h = Zt.empty();
|
|
@@ -4763,7 +4763,7 @@ class Kn extends Sn {
|
|
|
4763
4763
|
// For Compat types, we have to "extract" the underlying types before
|
|
4764
4764
|
// performing validation.
|
|
4765
4765
|
n = f(n);
|
|
4766
|
-
const r = o.
|
|
4766
|
+
const r = o.ct(e);
|
|
4767
4767
|
if (n instanceof Bn)
|
|
4768
4768
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4769
4769
|
a.push(e); else {
|
|
@@ -4782,7 +4782,7 @@ class Kn extends Sn {
|
|
|
4782
4782
|
* @param allowArrays - Whether the query value is an array that may directly
|
|
4783
4783
|
* contain additional arrays (e.g. the operand of an `in` query).
|
|
4784
4784
|
*/ function Jn(t, e, n, r = !1) {
|
|
4785
|
-
return Xn(n, t.
|
|
4785
|
+
return Xn(n, t.dt(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
|
|
4786
4786
|
}
|
|
4787
4787
|
|
|
4788
4788
|
/**
|
|
@@ -4810,8 +4810,8 @@ class Kn extends Sn {
|
|
|
4810
4810
|
*/
|
|
4811
4811
|
return function(t, e) {
|
|
4812
4812
|
// Sentinels are only supported with writes, and not within arrays.
|
|
4813
|
-
if (!Cn(e.
|
|
4814
|
-
if (!e.path) throw e.
|
|
4813
|
+
if (!Cn(e.rt)) throw e.ht(`${t._methodName}() can only be used with update() and set()`);
|
|
4814
|
+
if (!e.path) throw e.ht(`${t._methodName}() is not currently supported inside arrays`);
|
|
4815
4815
|
const n = t._toFieldTransform(e);
|
|
4816
4816
|
n && e.fieldTransforms.push(n);
|
|
4817
4817
|
}
|
|
@@ -4835,12 +4835,12 @@ class Kn extends Sn {
|
|
|
4835
4835
|
// the set of values to be included for the IN query) that may directly
|
|
4836
4836
|
// contain additional arrays (each representing an individual field
|
|
4837
4837
|
// value), so we disable this validation.
|
|
4838
|
-
if (e.settings.
|
|
4838
|
+
if (e.settings.ot && 4 /* ArrayArgument */ !== e.rt) throw e.ht("Nested arrays are not supported");
|
|
4839
4839
|
return function(t, e) {
|
|
4840
4840
|
const n = [];
|
|
4841
4841
|
let r = 0;
|
|
4842
4842
|
for (const s of t) {
|
|
4843
|
-
let t = Xn(s, e.
|
|
4843
|
+
let t = Xn(s, e.at(r));
|
|
4844
4844
|
null == t && (
|
|
4845
4845
|
// Just include nulls in the array for fields being replaced with a
|
|
4846
4846
|
// sentinel.
|
|
@@ -4892,12 +4892,12 @@ class Kn extends Sn {
|
|
|
4892
4892
|
};
|
|
4893
4893
|
if (t instanceof En) {
|
|
4894
4894
|
const n = e.databaseId, r = t.firestore._databaseId;
|
|
4895
|
-
if (!r.isEqual(n)) throw e.
|
|
4895
|
+
if (!r.isEqual(n)) throw e.ht(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);
|
|
4896
4896
|
return {
|
|
4897
4897
|
referenceValue: Be(t.firestore._databaseId || e.databaseId, t._key.path)
|
|
4898
4898
|
};
|
|
4899
4899
|
}
|
|
4900
|
-
throw e.
|
|
4900
|
+
throw e.ht(`Unsupported field value: ${ct(t)}`);
|
|
4901
4901
|
}
|
|
4902
4902
|
/**
|
|
4903
4903
|
* Checks whether an object looks like a JSON object that should be converted
|
|
@@ -4914,7 +4914,7 @@ function Zn(t, e) {
|
|
|
4914
4914
|
for (const e in t) if (Object.prototype.hasOwnProperty.call(t, e)) return !1;
|
|
4915
4915
|
return !0;
|
|
4916
4916
|
}(t) ? At(t, ((t, r) => {
|
|
4917
|
-
const s = Xn(r, e.
|
|
4917
|
+
const s = Xn(r, e.it(t));
|
|
4918
4918
|
null != s && (n[t] = s);
|
|
4919
4919
|
})) :
|
|
4920
4920
|
// If we encounter an empty object, we explicitly add it to the update
|
|
@@ -4935,7 +4935,7 @@ function er(t, e, n) {
|
|
|
4935
4935
|
return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
|
|
4936
4936
|
}(n)) {
|
|
4937
4937
|
const r = ct(n);
|
|
4938
|
-
throw "an object" === r ? e.
|
|
4938
|
+
throw "an object" === r ? e.ht(t + " a custom object") : e.ht(t + " " + r);
|
|
4939
4939
|
}
|
|
4940
4940
|
}
|
|
4941
4941
|
|
|
@@ -5186,7 +5186,7 @@ class fr {}
|
|
|
5186
5186
|
|
|
5187
5187
|
class wr extends fr {
|
|
5188
5188
|
constructor(t, e, n) {
|
|
5189
|
-
super(), this.
|
|
5189
|
+
super(), this.gt = t, this._t = e, this.vt = n, this.type = "where";
|
|
5190
5190
|
}
|
|
5191
5191
|
_apply(t) {
|
|
5192
5192
|
const e = Un(t.firestore), n = function(t, e, n, r, s, i, o) {
|
|
@@ -5255,7 +5255,7 @@ class wr extends fr {
|
|
|
5255
5255
|
// Special case when it's a duplicate op to give a slightly clearer error message.
|
|
5256
5256
|
throw n === e.op ? new j(V, `Invalid query. You cannot use more than one '${e.op.toString()}' filter.`) : new j(V, `Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`);
|
|
5257
5257
|
}(t, c), c;
|
|
5258
|
-
}(t._query, "where", e, t.firestore._databaseId, this.
|
|
5258
|
+
}(t._query, "where", e, t.firestore._databaseId, this.gt, this._t, this.vt);
|
|
5259
5259
|
return new In(t.firestore, t.converter, function(t, e) {
|
|
5260
5260
|
const n = t.filters.concat([ e ]);
|
|
5261
5261
|
return new pe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
|
|
@@ -5280,7 +5280,7 @@ class wr extends fr {
|
|
|
5280
5280
|
|
|
5281
5281
|
class pr extends fr {
|
|
5282
5282
|
constructor(t, e) {
|
|
5283
|
-
super(), this.
|
|
5283
|
+
super(), this.gt = t, this.bt = e, this.type = "orderBy";
|
|
5284
5284
|
}
|
|
5285
5285
|
_apply(t) {
|
|
5286
5286
|
const e = function(t, e, n) {
|
|
@@ -5305,7 +5305,7 @@ class pr extends fr {
|
|
|
5305
5305
|
* Will throw if the document does not contain all fields of the order by
|
|
5306
5306
|
* of the query or if any of the fields in the order by are an uncommitted
|
|
5307
5307
|
* server timestamp.
|
|
5308
|
-
*/ (t._query, this.
|
|
5308
|
+
*/ (t._query, this.gt, this.bt);
|
|
5309
5309
|
return new In(t.firestore, t.converter, function(t, e) {
|
|
5310
5310
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
5311
5311
|
const n = t.explicitOrderBy.concat([ e ]);
|
|
@@ -5329,12 +5329,12 @@ class pr extends fr {
|
|
|
5329
5329
|
|
|
5330
5330
|
class gr extends fr {
|
|
5331
5331
|
constructor(t, e, n) {
|
|
5332
|
-
super(), this.type = t, this.
|
|
5332
|
+
super(), this.type = t, this.Et = e, this.It = n;
|
|
5333
5333
|
}
|
|
5334
5334
|
_apply(t) {
|
|
5335
5335
|
return new In(t.firestore, t.converter, function(t, e, n) {
|
|
5336
5336
|
return new pe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
|
|
5337
|
-
}(t._query, this.
|
|
5337
|
+
}(t._query, this.Et, this.It));
|
|
5338
5338
|
}
|
|
5339
5339
|
}
|
|
5340
5340
|
|
|
@@ -5361,10 +5361,10 @@ class gr extends fr {
|
|
|
5361
5361
|
|
|
5362
5362
|
class br extends fr {
|
|
5363
5363
|
constructor(t, e, n) {
|
|
5364
|
-
super(), this.type = t, this.
|
|
5364
|
+
super(), this.type = t, this.Tt = e, this.At = n;
|
|
5365
5365
|
}
|
|
5366
5366
|
_apply(t) {
|
|
5367
|
-
const e = Pr(t, this.type, this.
|
|
5367
|
+
const e = Pr(t, this.type, this.Tt, this.At);
|
|
5368
5368
|
return new In(t.firestore, t.converter, function(t, e) {
|
|
5369
5369
|
return new pe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
|
|
5370
5370
|
}(t._query, e));
|
|
@@ -5383,10 +5383,10 @@ function Ir(...t) {
|
|
|
5383
5383
|
|
|
5384
5384
|
class Tr extends fr {
|
|
5385
5385
|
constructor(t, e, n) {
|
|
5386
|
-
super(), this.type = t, this.
|
|
5386
|
+
super(), this.type = t, this.Tt = e, this.At = n;
|
|
5387
5387
|
}
|
|
5388
5388
|
_apply(t) {
|
|
5389
|
-
const e = Pr(t, this.type, this.
|
|
5389
|
+
const e = Pr(t, this.type, this.Tt, this.At);
|
|
5390
5390
|
return new In(t.firestore, t.converter, function(t, e) {
|
|
5391
5391
|
return new pe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
|
|
5392
5392
|
}(t._query, e));
|
|
@@ -6116,26 +6116,26 @@ function Gr(t, e) {
|
|
|
6116
6116
|
class Jr {
|
|
6117
6117
|
constructor(t, e, n, r, s) {
|
|
6118
6118
|
this.asyncQueue = t, this.datastore = e, this.options = n, this.updateFunction = r,
|
|
6119
|
-
this.deferred = s, this.
|
|
6119
|
+
this.deferred = s, this.Rt = n.maxAttempts, this.Pt = new sn(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
|
|
6120
6120
|
}
|
|
6121
6121
|
/** Runs the transaction and sets the result on deferred. */ run() {
|
|
6122
|
-
this.
|
|
6122
|
+
this.Rt -= 1, this.Vt();
|
|
6123
6123
|
}
|
|
6124
|
-
|
|
6125
|
-
this.
|
|
6126
|
-
const t = new Yr(this.datastore), e = this
|
|
6124
|
+
Vt() {
|
|
6125
|
+
this.Pt.J((async () => {
|
|
6126
|
+
const t = new Yr(this.datastore), e = this.Nt(t);
|
|
6127
6127
|
e && e.then((e => {
|
|
6128
6128
|
this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
|
|
6129
6129
|
this.deferred.resolve(e);
|
|
6130
6130
|
})).catch((t => {
|
|
6131
|
-
this
|
|
6131
|
+
this.$t(t);
|
|
6132
6132
|
}))));
|
|
6133
6133
|
})).catch((t => {
|
|
6134
|
-
this
|
|
6134
|
+
this.$t(t);
|
|
6135
6135
|
}));
|
|
6136
6136
|
}));
|
|
6137
6137
|
}
|
|
6138
|
-
|
|
6138
|
+
Nt(t) {
|
|
6139
6139
|
try {
|
|
6140
6140
|
const e = this.updateFunction(t);
|
|
6141
6141
|
return !lt(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
|
|
@@ -6145,11 +6145,11 @@ class Jr {
|
|
|
6145
6145
|
return this.deferred.reject(t), null;
|
|
6146
6146
|
}
|
|
6147
6147
|
}
|
|
6148
|
-
|
|
6149
|
-
this.
|
|
6148
|
+
$t(t) {
|
|
6149
|
+
this.Rt > 0 && this.Dt(t) ? (this.Rt -= 1, this.asyncQueue.enqueueAndForget((() => (this.Vt(),
|
|
6150
6150
|
Promise.resolve())))) : this.deferred.reject(t);
|
|
6151
6151
|
}
|
|
6152
|
-
|
|
6152
|
+
Dt(t) {
|
|
6153
6153
|
if ("FirebaseError" === t.name) {
|
|
6154
6154
|
// In transactions, the backend will fail outdated reads with FAILED_PRECONDITION and
|
|
6155
6155
|
// non-matching document versions with ABORTED. These errors should be retried.
|
|
@@ -6320,39 +6320,39 @@ class Jr {
|
|
|
6320
6320
|
*/ class ts {
|
|
6321
6321
|
constructor() {
|
|
6322
6322
|
// The last promise in the queue.
|
|
6323
|
-
this.
|
|
6323
|
+
this.xt = Promise.resolve(),
|
|
6324
6324
|
// A list of retryable operations. Retryable operations are run in order and
|
|
6325
6325
|
// retried with backoff.
|
|
6326
|
-
this.
|
|
6326
|
+
this.St = [],
|
|
6327
6327
|
// Is this AsyncQueue being shut down? Once it is set to true, it will not
|
|
6328
6328
|
// be changed again.
|
|
6329
|
-
this.
|
|
6329
|
+
this.Ft = !1,
|
|
6330
6330
|
// Operations scheduled to be queued in the future. Operations are
|
|
6331
6331
|
// automatically removed after they are run or canceled.
|
|
6332
|
-
this.
|
|
6332
|
+
this.qt = [],
|
|
6333
6333
|
// visible for testing
|
|
6334
|
-
this.
|
|
6334
|
+
this.Ot = null,
|
|
6335
6335
|
// Flag set while there's an outstanding AsyncQueue operation, used for
|
|
6336
6336
|
// assertion sanity-checks.
|
|
6337
|
-
this.
|
|
6337
|
+
this.kt = !1,
|
|
6338
6338
|
// Enabled during shutdown on Safari to prevent future access to IndexedDB.
|
|
6339
|
-
this.
|
|
6339
|
+
this.Ct = !1,
|
|
6340
6340
|
// List of TimerIds to fast-forward delays for.
|
|
6341
|
-
this.
|
|
6341
|
+
this.Lt = [],
|
|
6342
6342
|
// Backoff timer used to schedule retries for retryable operations
|
|
6343
|
-
this.
|
|
6343
|
+
this.Pt = new sn(this, "async_queue_retry" /* AsyncQueueRetry */),
|
|
6344
6344
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
6345
6345
|
// operations. Meant to speed up recovery when we regain file system access
|
|
6346
6346
|
// after page comes into foreground.
|
|
6347
|
-
this.
|
|
6347
|
+
this.Mt = () => {
|
|
6348
6348
|
const t = Xr();
|
|
6349
|
-
t && g("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.
|
|
6349
|
+
t && g("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.Pt.Z();
|
|
6350
6350
|
};
|
|
6351
6351
|
const t = Xr();
|
|
6352
|
-
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.
|
|
6352
|
+
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Mt);
|
|
6353
6353
|
}
|
|
6354
6354
|
get isShuttingDown() {
|
|
6355
|
-
return this.
|
|
6355
|
+
return this.Ft;
|
|
6356
6356
|
}
|
|
6357
6357
|
/**
|
|
6358
6358
|
* Adds a new operation to the queue without waiting for it to complete (i.e.
|
|
@@ -6362,38 +6362,38 @@ class Jr {
|
|
|
6362
6362
|
this.enqueue(t);
|
|
6363
6363
|
}
|
|
6364
6364
|
enqueueAndForgetEvenWhileRestricted(t) {
|
|
6365
|
-
this.
|
|
6365
|
+
this.Ut(),
|
|
6366
6366
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
6367
|
-
this.
|
|
6367
|
+
this.jt(t);
|
|
6368
6368
|
}
|
|
6369
6369
|
enterRestrictedMode(t) {
|
|
6370
|
-
if (!this.
|
|
6371
|
-
this.
|
|
6370
|
+
if (!this.Ft) {
|
|
6371
|
+
this.Ft = !0, this.Ct = t || !1;
|
|
6372
6372
|
const e = Xr();
|
|
6373
|
-
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.
|
|
6373
|
+
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Mt);
|
|
6374
6374
|
}
|
|
6375
6375
|
}
|
|
6376
6376
|
enqueue(t) {
|
|
6377
|
-
if (this.
|
|
6377
|
+
if (this.Ut(), this.Ft)
|
|
6378
6378
|
// Return a Promise which never resolves.
|
|
6379
6379
|
return new Promise((() => {}));
|
|
6380
6380
|
// Create a deferred Promise that we can return to the callee. This
|
|
6381
6381
|
// allows us to return a "hanging Promise" only to the callee and still
|
|
6382
6382
|
// advance the queue even when the operation is not run.
|
|
6383
6383
|
const e = new B;
|
|
6384
|
-
return this.
|
|
6384
|
+
return this.jt((() => this.Ft && this.Ct ? Promise.resolve() : (t().then(e.resolve, e.reject),
|
|
6385
6385
|
e.promise))).then((() => e.promise));
|
|
6386
6386
|
}
|
|
6387
6387
|
enqueueRetryable(t) {
|
|
6388
|
-
this.enqueueAndForget((() => (this.
|
|
6388
|
+
this.enqueueAndForget((() => (this.St.push(t), this.Bt())));
|
|
6389
6389
|
}
|
|
6390
6390
|
/**
|
|
6391
6391
|
* Runs the next operation from the retryable queue. If the operation fails,
|
|
6392
6392
|
* reschedules with backoff.
|
|
6393
|
-
*/ async
|
|
6394
|
-
if (0 !== this.
|
|
6393
|
+
*/ async Bt() {
|
|
6394
|
+
if (0 !== this.St.length) {
|
|
6395
6395
|
try {
|
|
6396
|
-
await this.
|
|
6396
|
+
await this.St[0](), this.St.shift(), this.Pt.reset();
|
|
6397
6397
|
} catch (t) {
|
|
6398
6398
|
if (!
|
|
6399
6399
|
/**
|
|
@@ -6437,7 +6437,7 @@ class Jr {
|
|
|
6437
6437
|
// Failure will be handled by AsyncQueue
|
|
6438
6438
|
g("AsyncQueue", "Operation failed with retryable error: " + t);
|
|
6439
6439
|
}
|
|
6440
|
-
this.
|
|
6440
|
+
this.St.length > 0 &&
|
|
6441
6441
|
// If there are additional operations, we re-schedule `retryNextOp()`.
|
|
6442
6442
|
// This is necessary to run retryable operations that failed during
|
|
6443
6443
|
// their initial attempt since we don't know whether they are already
|
|
@@ -6448,12 +6448,12 @@ class Jr {
|
|
|
6448
6448
|
// Since `backoffAndRun()` cancels an existing backoff and schedules a
|
|
6449
6449
|
// new backoff on every call, there is only ever a single additional
|
|
6450
6450
|
// operation in the queue.
|
|
6451
|
-
this.
|
|
6451
|
+
this.Pt.J((() => this.Bt()));
|
|
6452
6452
|
}
|
|
6453
6453
|
}
|
|
6454
|
-
|
|
6455
|
-
const e = this.
|
|
6456
|
-
this.
|
|
6454
|
+
jt(t) {
|
|
6455
|
+
const e = this.xt.then((() => (this.kt = !0, t().catch((t => {
|
|
6456
|
+
this.Ot = t, this.kt = !1;
|
|
6457
6457
|
const e =
|
|
6458
6458
|
/**
|
|
6459
6459
|
* Chrome includes Error.message in Error.stack. Other browsers do not.
|
|
@@ -6494,38 +6494,38 @@ class Jr {
|
|
|
6494
6494
|
// all further attempts to chain (via .then) will just short-circuit
|
|
6495
6495
|
// and return the rejected Promise.
|
|
6496
6496
|
throw _("INTERNAL UNHANDLED ERROR: ", e), t;
|
|
6497
|
-
})).then((t => (this.
|
|
6498
|
-
return this.
|
|
6497
|
+
})).then((t => (this.kt = !1, t))))));
|
|
6498
|
+
return this.xt = e, e;
|
|
6499
6499
|
}
|
|
6500
6500
|
enqueueAfterDelay(t, e, n) {
|
|
6501
|
-
this.
|
|
6501
|
+
this.Ut(),
|
|
6502
6502
|
// Fast-forward delays for timerIds that have been overriden.
|
|
6503
|
-
this.
|
|
6504
|
-
const r = Zr.createAndSchedule(this, t, e, n, (t => this.
|
|
6505
|
-
return this.
|
|
6503
|
+
this.Lt.indexOf(t) > -1 && (e = 0);
|
|
6504
|
+
const r = Zr.createAndSchedule(this, t, e, n, (t => this.Qt(t)));
|
|
6505
|
+
return this.qt.push(r), r;
|
|
6506
6506
|
}
|
|
6507
|
-
|
|
6508
|
-
this.
|
|
6507
|
+
Ut() {
|
|
6508
|
+
this.Ot && E();
|
|
6509
6509
|
}
|
|
6510
6510
|
verifyOperationInProgress() {}
|
|
6511
6511
|
/**
|
|
6512
6512
|
* Waits until all currently queued tasks are finished executing. Delayed
|
|
6513
6513
|
* operations are not run.
|
|
6514
|
-
*/ async
|
|
6514
|
+
*/ async zt() {
|
|
6515
6515
|
// Operations in the queue prior to draining may have enqueued additional
|
|
6516
6516
|
// operations. Keep draining the queue until the tail is no longer advanced,
|
|
6517
6517
|
// which indicates that no more new operations were enqueued and that all
|
|
6518
6518
|
// operations were executed.
|
|
6519
6519
|
let t;
|
|
6520
6520
|
do {
|
|
6521
|
-
t = this.
|
|
6522
|
-
} while (t !== this.
|
|
6521
|
+
t = this.xt, await t;
|
|
6522
|
+
} while (t !== this.xt);
|
|
6523
6523
|
}
|
|
6524
6524
|
/**
|
|
6525
6525
|
* For Tests: Determine if a delayed operation with a particular TimerId
|
|
6526
6526
|
* exists.
|
|
6527
|
-
*/
|
|
6528
|
-
for (const e of this.
|
|
6527
|
+
*/ Wt(t) {
|
|
6528
|
+
for (const e of this.qt) if (e.timerId === t) return !0;
|
|
6529
6529
|
return !1;
|
|
6530
6530
|
}
|
|
6531
6531
|
/**
|
|
@@ -6534,24 +6534,24 @@ class Jr {
|
|
|
6534
6534
|
* @param lastTimerId - Delayed operations up to and including this TimerId
|
|
6535
6535
|
* will be drained. Pass TimerId.All to run all delayed operations.
|
|
6536
6536
|
* @returns a Promise that resolves once all operations have been run.
|
|
6537
|
-
*/
|
|
6537
|
+
*/ Gt(t) {
|
|
6538
6538
|
// Note that draining may generate more delayed ops, so we do that first.
|
|
6539
|
-
return this.
|
|
6539
|
+
return this.zt().then((() => {
|
|
6540
6540
|
// Run ops in the same order they'd run if they ran naturally.
|
|
6541
|
-
this.
|
|
6542
|
-
for (const e of this.
|
|
6543
|
-
return this.
|
|
6541
|
+
this.qt.sort(((t, e) => t.targetTimeMs - e.targetTimeMs));
|
|
6542
|
+
for (const e of this.qt) if (e.skipDelay(), "all" /* All */ !== t && e.timerId === t) break;
|
|
6543
|
+
return this.zt();
|
|
6544
6544
|
}));
|
|
6545
6545
|
}
|
|
6546
6546
|
/**
|
|
6547
6547
|
* For Tests: Skip all subsequent delays for a timer id.
|
|
6548
|
-
*/
|
|
6549
|
-
this.
|
|
6548
|
+
*/ Kt(t) {
|
|
6549
|
+
this.Lt.push(t);
|
|
6550
6550
|
}
|
|
6551
|
-
/** Called once a DelayedOperation is run or canceled. */
|
|
6551
|
+
/** Called once a DelayedOperation is run or canceled. */ Qt(t) {
|
|
6552
6552
|
// NOTE: indexOf / slice are O(n), but delayedOperations is expected to be small.
|
|
6553
|
-
const e = this.
|
|
6554
|
-
this.
|
|
6553
|
+
const e = this.qt.indexOf(t);
|
|
6554
|
+
this.qt.splice(e, 1);
|
|
6555
6555
|
}
|
|
6556
6556
|
}
|
|
6557
6557
|
|
|
@@ -6658,7 +6658,7 @@ class es {
|
|
|
6658
6658
|
return n && s._setSettings(n), s;
|
|
6659
6659
|
}), "PUBLIC").setMultipleInstances(!0)),
|
|
6660
6660
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
6661
|
-
r("firestore-lite", "3.7.
|
|
6661
|
+
r("firestore-lite", "3.7.2", "rn"), r("firestore-lite", "3.7.2", "esm2017");
|
|
6662
6662
|
|
|
6663
6663
|
export { _n as AggregateField, vn as AggregateQuerySnapshot, $n as Bytes, Tn as CollectionReference, En as DocumentReference, ur as DocumentSnapshot, Dn as FieldPath, Sn as FieldValue, wn as Firestore, j as FirestoreError, Fn as GeoPoint, In as Query, fr as QueryConstraint, cr as QueryDocumentSnapshot, ar as QuerySnapshot, Et as Timestamp, es as Transaction, Wr as WriteBatch, Cr as addDoc, Mr as aggregateQuerySnapshotEqual, Qr as arrayRemove, Br as arrayUnion, An as collection, Rn as collectionGroup, yn as connectFirestoreEmulator, kr as deleteDoc, Ur as deleteField, Pn as doc, xn as documentId, Rr as endAt, Ar as endBefore, Lr as getCount, Sr as getDoc, Fr as getDocs, pn as getFirestore, zr as increment, mn as initializeFirestore, _r as limit, vr as limitToLast, yr as orderBy, dr as query, Nn as queryEqual, Vn as refEqual, ns as runTransaction, jr as serverTimestamp, qr as setDoc, y as setLogLevel, hr as snapshotEqual, Ir as startAfter, Er as startAt, gn as terminate, Or as updateDoc, mr as where, Kr as writeBatch };
|
|
6664
6664
|
//# sourceMappingURL=index.rn.esm2017.js.map
|