@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
|
@@ -63,7 +63,7 @@ d.MOCK_USER = new d("mock-user");
|
|
|
63
63
|
* See the License for the specific language governing permissions and
|
|
64
64
|
* limitations under the License.
|
|
65
65
|
*/
|
|
66
|
-
let w = "9.
|
|
66
|
+
let w = "9.13.0";
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* @license
|
|
@@ -3614,26 +3614,26 @@ class nn {
|
|
|
3614
3614
|
*/
|
|
3615
3615
|
class rn extends class {} {
|
|
3616
3616
|
constructor(t, e, n, r) {
|
|
3617
|
-
super(), this.authCredentials = t, this.appCheckCredentials = e, this.
|
|
3618
|
-
this.
|
|
3617
|
+
super(), this.authCredentials = t, this.appCheckCredentials = e, this.connection = n,
|
|
3618
|
+
this.L = r, this.tt = !1;
|
|
3619
3619
|
}
|
|
3620
|
-
|
|
3621
|
-
if (this.
|
|
3620
|
+
et() {
|
|
3621
|
+
if (this.tt) throw new U(S, "The client has already been terminated.");
|
|
3622
3622
|
}
|
|
3623
3623
|
/** Invokes the provided RPC with auth and AppCheck tokens. */ I(t, e, n) {
|
|
3624
|
-
return this.
|
|
3624
|
+
return this.et(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.connection.I(t, e, n, r, s))).catch((t => {
|
|
3625
3625
|
throw "FirebaseError" === t.name ? (t.code === x && (this.authCredentials.invalidateToken(),
|
|
3626
3626
|
this.appCheckCredentials.invalidateToken()), t) : new U(R, t.toString());
|
|
3627
3627
|
}));
|
|
3628
3628
|
}
|
|
3629
3629
|
/** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ P(t, e, n, r) {
|
|
3630
|
-
return this.
|
|
3630
|
+
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 => {
|
|
3631
3631
|
throw "FirebaseError" === t.name ? (t.code === x && (this.authCredentials.invalidateToken(),
|
|
3632
3632
|
this.appCheckCredentials.invalidateToken()), t) : new U(R, t.toString());
|
|
3633
3633
|
}));
|
|
3634
3634
|
}
|
|
3635
3635
|
terminate() {
|
|
3636
|
-
this.
|
|
3636
|
+
this.tt = !0;
|
|
3637
3637
|
}
|
|
3638
3638
|
}
|
|
3639
3639
|
|
|
@@ -3689,7 +3689,7 @@ async function cn(t, e) {
|
|
|
3689
3689
|
parent: n.parent
|
|
3690
3690
|
};
|
|
3691
3691
|
}(n.L, ge(e)), s = r.parent;
|
|
3692
|
-
n.
|
|
3692
|
+
n.connection.v || delete r.parent;
|
|
3693
3693
|
return (await n.P("RunAggregationQuery", s, r, /*expectedResponseCount=*/ 1)).filter((t => !!t.result)).map((t => t.result.aggregateFields));
|
|
3694
3694
|
}
|
|
3695
3695
|
|
|
@@ -4531,55 +4531,55 @@ function On(t) {
|
|
|
4531
4531
|
this.settings = t, this.databaseId = e, this.L = n, this.ignoreUndefinedProperties = r,
|
|
4532
4532
|
// Minor hack: If fieldTransforms is undefined, we assume this is an
|
|
4533
4533
|
// external call and we need to validate the entire path.
|
|
4534
|
-
void 0 === s && this.
|
|
4534
|
+
void 0 === s && this.nt(), this.fieldTransforms = s || [], this.fieldMask = i || [];
|
|
4535
4535
|
}
|
|
4536
4536
|
get path() {
|
|
4537
4537
|
return this.settings.path;
|
|
4538
4538
|
}
|
|
4539
|
-
get
|
|
4540
|
-
return this.settings.
|
|
4539
|
+
get rt() {
|
|
4540
|
+
return this.settings.rt;
|
|
4541
4541
|
}
|
|
4542
|
-
/** Returns a new context with the specified settings overwritten. */
|
|
4542
|
+
/** Returns a new context with the specified settings overwritten. */ st(t) {
|
|
4543
4543
|
return new kn(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.L, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
|
|
4544
4544
|
}
|
|
4545
|
-
|
|
4545
|
+
it(t) {
|
|
4546
4546
|
var e;
|
|
4547
|
-
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.
|
|
4547
|
+
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.st({
|
|
4548
4548
|
path: n,
|
|
4549
|
-
|
|
4549
|
+
ot: !1
|
|
4550
4550
|
});
|
|
4551
|
-
return r.
|
|
4551
|
+
return r.ut(t), r;
|
|
4552
4552
|
}
|
|
4553
|
-
|
|
4553
|
+
ct(t) {
|
|
4554
4554
|
var e;
|
|
4555
|
-
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.
|
|
4555
|
+
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.st({
|
|
4556
4556
|
path: n,
|
|
4557
|
-
|
|
4557
|
+
ot: !1
|
|
4558
4558
|
});
|
|
4559
|
-
return r.
|
|
4559
|
+
return r.nt(), r;
|
|
4560
4560
|
}
|
|
4561
|
-
|
|
4561
|
+
at(t) {
|
|
4562
4562
|
// TODO(b/34871131): We don't support array paths right now; so make path
|
|
4563
4563
|
// undefined.
|
|
4564
|
-
return this.
|
|
4564
|
+
return this.st({
|
|
4565
4565
|
path: void 0,
|
|
4566
|
-
|
|
4566
|
+
ot: !0
|
|
4567
4567
|
});
|
|
4568
4568
|
}
|
|
4569
|
-
|
|
4570
|
-
return rr(t, this.settings.methodName, this.settings.
|
|
4569
|
+
ht(t) {
|
|
4570
|
+
return rr(t, this.settings.methodName, this.settings.lt || !1, this.path, this.settings.ft);
|
|
4571
4571
|
}
|
|
4572
4572
|
/** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
|
|
4573
4573
|
return void 0 !== this.fieldMask.find((e => t.isPrefixOf(e))) || void 0 !== this.fieldTransforms.find((e => t.isPrefixOf(e.field)));
|
|
4574
4574
|
}
|
|
4575
|
-
|
|
4575
|
+
nt() {
|
|
4576
4576
|
// TODO(b/34871131): Remove null check once we have proper paths for fields
|
|
4577
4577
|
// within arrays.
|
|
4578
|
-
if (this.path) for (let t = 0; t < this.path.length; t++) this.
|
|
4578
|
+
if (this.path) for (let t = 0; t < this.path.length; t++) this.ut(this.path.get(t));
|
|
4579
4579
|
}
|
|
4580
|
-
|
|
4581
|
-
if (0 === t.length) throw this.
|
|
4582
|
-
if (On(this.
|
|
4580
|
+
ut(t) {
|
|
4581
|
+
if (0 === t.length) throw this.ht("Document fields must not be empty");
|
|
4582
|
+
if (On(this.rt) && Fn.test(t)) throw this.ht('Document fields cannot begin and end with "__"');
|
|
4583
4583
|
}
|
|
4584
4584
|
}
|
|
4585
4585
|
|
|
@@ -4590,14 +4590,14 @@ function On(t) {
|
|
|
4590
4590
|
constructor(t, e, n) {
|
|
4591
4591
|
this.databaseId = t, this.ignoreUndefinedProperties = e, this.L = n || en(t);
|
|
4592
4592
|
}
|
|
4593
|
-
/** Creates a new top-level parse context. */
|
|
4593
|
+
/** Creates a new top-level parse context. */ dt(t, e, n, r = !1) {
|
|
4594
4594
|
return new kn({
|
|
4595
|
-
|
|
4595
|
+
rt: t,
|
|
4596
4596
|
methodName: e,
|
|
4597
|
-
|
|
4597
|
+
ft: n,
|
|
4598
4598
|
path: nt.emptyPath(),
|
|
4599
|
-
|
|
4600
|
-
|
|
4599
|
+
ot: !1,
|
|
4600
|
+
lt: r
|
|
4601
4601
|
}, this.databaseId, this.L, this.ignoreUndefinedProperties);
|
|
4602
4602
|
}
|
|
4603
4603
|
}
|
|
@@ -4608,7 +4608,7 @@ function Ln(t) {
|
|
|
4608
4608
|
}
|
|
4609
4609
|
|
|
4610
4610
|
/** Parse document data from a set() call. */ function Mn(t, e, n, r, s, i = {}) {
|
|
4611
|
-
const o = t.
|
|
4611
|
+
const o = t.dt(i.merge || i.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, s);
|
|
4612
4612
|
Zn("Data must be an object, but it was:", o, r);
|
|
4613
4613
|
const u = Jn(r, o);
|
|
4614
4614
|
let c, a;
|
|
@@ -4626,7 +4626,7 @@ function Ln(t) {
|
|
|
4626
4626
|
|
|
4627
4627
|
class Un extends $n {
|
|
4628
4628
|
_toFieldTransform(t) {
|
|
4629
|
-
if (2 /* MergeSet */ !== t.
|
|
4629
|
+
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}`);
|
|
4630
4630
|
// No transform to add for a delete, but we need to add it to our
|
|
4631
4631
|
// fieldMask so it gets deleted.
|
|
4632
4632
|
return t.fieldMask.push(t.path), null;
|
|
@@ -4653,10 +4653,10 @@ class Un extends $n {
|
|
|
4653
4653
|
* @param arrayElement - Whether or not the FieldValue has an array.
|
|
4654
4654
|
*/ function jn(t, e, n) {
|
|
4655
4655
|
return new kn({
|
|
4656
|
-
|
|
4657
|
-
|
|
4656
|
+
rt: 3 /* Argument */ ,
|
|
4657
|
+
ft: e.settings.ft,
|
|
4658
4658
|
methodName: t._methodName,
|
|
4659
|
-
|
|
4659
|
+
ot: n
|
|
4660
4660
|
}, e.databaseId, e.L, e.ignoreUndefinedProperties);
|
|
4661
4661
|
}
|
|
4662
4662
|
|
|
@@ -4671,11 +4671,11 @@ class Bn extends $n {
|
|
|
4671
4671
|
|
|
4672
4672
|
class Qn extends $n {
|
|
4673
4673
|
constructor(t, e) {
|
|
4674
|
-
super(t), this.
|
|
4674
|
+
super(t), this.wt = e;
|
|
4675
4675
|
}
|
|
4676
4676
|
_toFieldTransform(t) {
|
|
4677
4677
|
const e = jn(this, t,
|
|
4678
|
-
/*array=*/ !0), n = this.
|
|
4678
|
+
/*array=*/ !0), n = this.wt.map((t => Hn(t, e))), r = new Te(n);
|
|
4679
4679
|
return new Pe(t.path, r);
|
|
4680
4680
|
}
|
|
4681
4681
|
isEqual(t) {
|
|
@@ -4686,11 +4686,11 @@ class Qn extends $n {
|
|
|
4686
4686
|
|
|
4687
4687
|
class zn extends $n {
|
|
4688
4688
|
constructor(t, e) {
|
|
4689
|
-
super(t), this.
|
|
4689
|
+
super(t), this.wt = e;
|
|
4690
4690
|
}
|
|
4691
4691
|
_toFieldTransform(t) {
|
|
4692
4692
|
const e = jn(this, t,
|
|
4693
|
-
/*array=*/ !0), n = this.
|
|
4693
|
+
/*array=*/ !0), n = this.wt.map((t => Hn(t, e))), r = new Ae(n);
|
|
4694
4694
|
return new Pe(t.path, r);
|
|
4695
4695
|
}
|
|
4696
4696
|
isEqual(t) {
|
|
@@ -4701,10 +4701,10 @@ class zn extends $n {
|
|
|
4701
4701
|
|
|
4702
4702
|
class Gn extends $n {
|
|
4703
4703
|
constructor(t, e) {
|
|
4704
|
-
super(t), this.
|
|
4704
|
+
super(t), this.yt = e;
|
|
4705
4705
|
}
|
|
4706
4706
|
_toFieldTransform(t) {
|
|
4707
|
-
const e = new Re(t.L, be(t.L, this.
|
|
4707
|
+
const e = new Re(t.L, be(t.L, this.yt));
|
|
4708
4708
|
return new Pe(t.path, e);
|
|
4709
4709
|
}
|
|
4710
4710
|
isEqual(t) {
|
|
@@ -4714,7 +4714,7 @@ class Gn extends $n {
|
|
|
4714
4714
|
}
|
|
4715
4715
|
|
|
4716
4716
|
/** Parse update data from an update() call. */ function Wn(t, e, n, r) {
|
|
4717
|
-
const s = t.
|
|
4717
|
+
const s = t.dt(1 /* Update */ , e, n);
|
|
4718
4718
|
Zn("Data must be an object, but it was:", s, r);
|
|
4719
4719
|
const i = [], o = Jt.empty();
|
|
4720
4720
|
Tt(r, ((t, r) => {
|
|
@@ -4722,7 +4722,7 @@ class Gn extends $n {
|
|
|
4722
4722
|
// For Compat types, we have to "extract" the underlying types before
|
|
4723
4723
|
// performing validation.
|
|
4724
4724
|
r = getModularInstance(r);
|
|
4725
|
-
const c = s.
|
|
4725
|
+
const c = s.ct(u);
|
|
4726
4726
|
if (r instanceof Un)
|
|
4727
4727
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4728
4728
|
i.push(u); else {
|
|
@@ -4735,7 +4735,7 @@ class Gn extends $n {
|
|
|
4735
4735
|
}
|
|
4736
4736
|
|
|
4737
4737
|
/** Parse update data from a list of field/value arguments. */ function Kn(t, e, n, r, s, i) {
|
|
4738
|
-
const o = t.
|
|
4738
|
+
const o = t.dt(1 /* Update */ , e, n), u = [ tr(e, r, n) ], c = [ s ];
|
|
4739
4739
|
if (i.length % 2 != 0) throw new U(P, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);
|
|
4740
4740
|
for (let t = 0; t < i.length; t += 2) u.push(tr(e, i[t])), c.push(i[t + 1]);
|
|
4741
4741
|
const a = [], h = Jt.empty();
|
|
@@ -4747,7 +4747,7 @@ class Gn extends $n {
|
|
|
4747
4747
|
// For Compat types, we have to "extract" the underlying types before
|
|
4748
4748
|
// performing validation.
|
|
4749
4749
|
n = getModularInstance(n);
|
|
4750
|
-
const r = o.
|
|
4750
|
+
const r = o.ct(e);
|
|
4751
4751
|
if (n instanceof Un)
|
|
4752
4752
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4753
4753
|
a.push(e); else {
|
|
@@ -4766,7 +4766,7 @@ class Gn extends $n {
|
|
|
4766
4766
|
* @param allowArrays - Whether the query value is an array that may directly
|
|
4767
4767
|
* contain additional arrays (e.g. the operand of an `in` query).
|
|
4768
4768
|
*/ function Yn(t, e, n, r = !1) {
|
|
4769
|
-
return Hn(n, t.
|
|
4769
|
+
return Hn(n, t.dt(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
|
|
4770
4770
|
}
|
|
4771
4771
|
|
|
4772
4772
|
/**
|
|
@@ -4794,8 +4794,8 @@ class Gn extends $n {
|
|
|
4794
4794
|
*/
|
|
4795
4795
|
return function(t, e) {
|
|
4796
4796
|
// Sentinels are only supported with writes, and not within arrays.
|
|
4797
|
-
if (!On(e.
|
|
4798
|
-
if (!e.path) throw e.
|
|
4797
|
+
if (!On(e.rt)) throw e.ht(`${t._methodName}() can only be used with update() and set()`);
|
|
4798
|
+
if (!e.path) throw e.ht(`${t._methodName}() is not currently supported inside arrays`);
|
|
4799
4799
|
const n = t._toFieldTransform(e);
|
|
4800
4800
|
n && e.fieldTransforms.push(n);
|
|
4801
4801
|
}
|
|
@@ -4819,12 +4819,12 @@ class Gn extends $n {
|
|
|
4819
4819
|
// the set of values to be included for the IN query) that may directly
|
|
4820
4820
|
// contain additional arrays (each representing an individual field
|
|
4821
4821
|
// value), so we disable this validation.
|
|
4822
|
-
if (e.settings.
|
|
4822
|
+
if (e.settings.ot && 4 /* ArrayArgument */ !== e.rt) throw e.ht("Nested arrays are not supported");
|
|
4823
4823
|
return function(t, e) {
|
|
4824
4824
|
const n = [];
|
|
4825
4825
|
let r = 0;
|
|
4826
4826
|
for (const s of t) {
|
|
4827
|
-
let t = Hn(s, e.
|
|
4827
|
+
let t = Hn(s, e.at(r));
|
|
4828
4828
|
null == t && (
|
|
4829
4829
|
// Just include nulls in the array for fields being replaced with a
|
|
4830
4830
|
// sentinel.
|
|
@@ -4876,12 +4876,12 @@ class Gn extends $n {
|
|
|
4876
4876
|
};
|
|
4877
4877
|
if (t instanceof vn) {
|
|
4878
4878
|
const n = e.databaseId, r = t.firestore._databaseId;
|
|
4879
|
-
if (!r.isEqual(n)) throw e.
|
|
4879
|
+
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}`);
|
|
4880
4880
|
return {
|
|
4881
4881
|
referenceValue: Ue(t.firestore._databaseId || e.databaseId, t._key.path)
|
|
4882
4882
|
};
|
|
4883
4883
|
}
|
|
4884
|
-
throw e.
|
|
4884
|
+
throw e.ht(`Unsupported field value: ${ut(t)}`);
|
|
4885
4885
|
}
|
|
4886
4886
|
/**
|
|
4887
4887
|
* Checks whether an object looks like a JSON object that should be converted
|
|
@@ -4898,7 +4898,7 @@ function Jn(t, e) {
|
|
|
4898
4898
|
for (const e in t) if (Object.prototype.hasOwnProperty.call(t, e)) return !1;
|
|
4899
4899
|
return !0;
|
|
4900
4900
|
}(t) ? Tt(t, ((t, r) => {
|
|
4901
|
-
const s = Hn(r, e.
|
|
4901
|
+
const s = Hn(r, e.it(t));
|
|
4902
4902
|
null != s && (n[t] = s);
|
|
4903
4903
|
})) :
|
|
4904
4904
|
// If we encounter an empty object, we explicitly add it to the update
|
|
@@ -4919,7 +4919,7 @@ function Zn(t, e, n) {
|
|
|
4919
4919
|
return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
|
|
4920
4920
|
}(n)) {
|
|
4921
4921
|
const r = ut(n);
|
|
4922
|
-
throw "an object" === r ? e.
|
|
4922
|
+
throw "an object" === r ? e.ht(t + " a custom object") : e.ht(t + " " + r);
|
|
4923
4923
|
}
|
|
4924
4924
|
}
|
|
4925
4925
|
|
|
@@ -5170,7 +5170,7 @@ class hr {}
|
|
|
5170
5170
|
|
|
5171
5171
|
class fr extends hr {
|
|
5172
5172
|
constructor(t, e, n) {
|
|
5173
|
-
super(), this.
|
|
5173
|
+
super(), this._t = t, this.gt = e, this.vt = n, this.type = "where";
|
|
5174
5174
|
}
|
|
5175
5175
|
_apply(t) {
|
|
5176
5176
|
const e = Ln(t.firestore), n = function(t, e, n, r, s, i, o) {
|
|
@@ -5239,7 +5239,7 @@ class fr extends hr {
|
|
|
5239
5239
|
// Special case when it's a duplicate op to give a slightly clearer error message.
|
|
5240
5240
|
throw n === e.op ? new U(P, `Invalid query. You cannot use more than one '${e.op.toString()}' filter.`) : new U(P, `Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`);
|
|
5241
5241
|
}(t, c), c;
|
|
5242
|
-
}(t._query, "where", e, t.firestore._databaseId, this.
|
|
5242
|
+
}(t._query, "where", e, t.firestore._databaseId, this._t, this.gt, this.vt);
|
|
5243
5243
|
return new bn(t.firestore, t.converter, function(t, e) {
|
|
5244
5244
|
const n = t.filters.concat([ e ]);
|
|
5245
5245
|
return new we(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
|
|
@@ -5264,7 +5264,7 @@ class fr extends hr {
|
|
|
5264
5264
|
|
|
5265
5265
|
class wr extends hr {
|
|
5266
5266
|
constructor(t, e) {
|
|
5267
|
-
super(), this.
|
|
5267
|
+
super(), this._t = t, this.bt = e, this.type = "orderBy";
|
|
5268
5268
|
}
|
|
5269
5269
|
_apply(t) {
|
|
5270
5270
|
const e = function(t, e, n) {
|
|
@@ -5289,7 +5289,7 @@ class wr extends hr {
|
|
|
5289
5289
|
* Will throw if the document does not contain all fields of the order by
|
|
5290
5290
|
* of the query or if any of the fields in the order by are an uncommitted
|
|
5291
5291
|
* server timestamp.
|
|
5292
|
-
*/ (t._query, this.
|
|
5292
|
+
*/ (t._query, this._t, this.bt);
|
|
5293
5293
|
return new bn(t.firestore, t.converter, function(t, e) {
|
|
5294
5294
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
5295
5295
|
const n = t.explicitOrderBy.concat([ e ]);
|
|
@@ -5313,12 +5313,12 @@ class wr extends hr {
|
|
|
5313
5313
|
|
|
5314
5314
|
class pr extends hr {
|
|
5315
5315
|
constructor(t, e, n) {
|
|
5316
|
-
super(), this.type = t, this.
|
|
5316
|
+
super(), this.type = t, this.Et = e, this.It = n;
|
|
5317
5317
|
}
|
|
5318
5318
|
_apply(t) {
|
|
5319
5319
|
return new bn(t.firestore, t.converter, function(t, e, n) {
|
|
5320
5320
|
return new we(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
|
|
5321
|
-
}(t._query, this.
|
|
5321
|
+
}(t._query, this.Et, this.It));
|
|
5322
5322
|
}
|
|
5323
5323
|
}
|
|
5324
5324
|
|
|
@@ -5345,10 +5345,10 @@ class pr extends hr {
|
|
|
5345
5345
|
|
|
5346
5346
|
class gr extends hr {
|
|
5347
5347
|
constructor(t, e, n) {
|
|
5348
|
-
super(), this.type = t, this.
|
|
5348
|
+
super(), this.type = t, this.Tt = e, this.At = n;
|
|
5349
5349
|
}
|
|
5350
5350
|
_apply(t) {
|
|
5351
|
-
const e = Ar(t, this.type, this.
|
|
5351
|
+
const e = Ar(t, this.type, this.Tt, this.At);
|
|
5352
5352
|
return new bn(t.firestore, t.converter, function(t, e) {
|
|
5353
5353
|
return new we(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
|
|
5354
5354
|
}(t._query, e));
|
|
@@ -5367,10 +5367,10 @@ function br(...t) {
|
|
|
5367
5367
|
|
|
5368
5368
|
class Er extends hr {
|
|
5369
5369
|
constructor(t, e, n) {
|
|
5370
|
-
super(), this.type = t, this.
|
|
5370
|
+
super(), this.type = t, this.Tt = e, this.At = n;
|
|
5371
5371
|
}
|
|
5372
5372
|
_apply(t) {
|
|
5373
|
-
const e = Ar(t, this.type, this.
|
|
5373
|
+
const e = Ar(t, this.type, this.Tt, this.At);
|
|
5374
5374
|
return new bn(t.firestore, t.converter, function(t, e) {
|
|
5375
5375
|
return new we(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
|
|
5376
5376
|
}(t._query, e));
|
|
@@ -6100,26 +6100,26 @@ function zr(t, e) {
|
|
|
6100
6100
|
class Yr {
|
|
6101
6101
|
constructor(t, e, n, r, s) {
|
|
6102
6102
|
this.asyncQueue = t, this.datastore = e, this.options = n, this.updateFunction = r,
|
|
6103
|
-
this.deferred = s, this.
|
|
6103
|
+
this.deferred = s, this.Rt = n.maxAttempts, this.Pt = new nn(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
|
|
6104
6104
|
}
|
|
6105
6105
|
/** Runs the transaction and sets the result on deferred. */ run() {
|
|
6106
|
-
this.
|
|
6106
|
+
this.Rt -= 1, this.Vt();
|
|
6107
6107
|
}
|
|
6108
|
-
|
|
6109
|
-
this.
|
|
6110
|
-
const t = new Wr(this.datastore), e = this.
|
|
6108
|
+
Vt() {
|
|
6109
|
+
this.Pt.J((async () => {
|
|
6110
|
+
const t = new Wr(this.datastore), e = this.Nt(t);
|
|
6111
6111
|
e && e.then((e => {
|
|
6112
6112
|
this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
|
|
6113
6113
|
this.deferred.resolve(e);
|
|
6114
6114
|
})).catch((t => {
|
|
6115
|
-
this
|
|
6115
|
+
this.Dt(t);
|
|
6116
6116
|
}))));
|
|
6117
6117
|
})).catch((t => {
|
|
6118
|
-
this
|
|
6118
|
+
this.Dt(t);
|
|
6119
6119
|
}));
|
|
6120
6120
|
}));
|
|
6121
6121
|
}
|
|
6122
|
-
|
|
6122
|
+
Nt(t) {
|
|
6123
6123
|
try {
|
|
6124
6124
|
const e = this.updateFunction(t);
|
|
6125
6125
|
return !ht(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
|
|
@@ -6129,11 +6129,11 @@ class Yr {
|
|
|
6129
6129
|
return this.deferred.reject(t), null;
|
|
6130
6130
|
}
|
|
6131
6131
|
}
|
|
6132
|
-
|
|
6133
|
-
this.
|
|
6132
|
+
Dt(t) {
|
|
6133
|
+
this.Rt > 0 && this.$t(t) ? (this.Rt -= 1, this.asyncQueue.enqueueAndForget((() => (this.Vt(),
|
|
6134
6134
|
Promise.resolve())))) : this.deferred.reject(t);
|
|
6135
6135
|
}
|
|
6136
|
-
|
|
6136
|
+
$t(t) {
|
|
6137
6137
|
if ("FirebaseError" === t.name) {
|
|
6138
6138
|
// In transactions, the backend will fail outdated reads with FAILED_PRECONDITION and
|
|
6139
6139
|
// non-matching document versions with ABORTED. These errors should be retried.
|
|
@@ -6304,39 +6304,39 @@ class Yr {
|
|
|
6304
6304
|
*/ class Xr {
|
|
6305
6305
|
constructor() {
|
|
6306
6306
|
// The last promise in the queue.
|
|
6307
|
-
this.
|
|
6307
|
+
this.xt = Promise.resolve(),
|
|
6308
6308
|
// A list of retryable operations. Retryable operations are run in order and
|
|
6309
6309
|
// retried with backoff.
|
|
6310
|
-
this.
|
|
6310
|
+
this.Ft = [],
|
|
6311
6311
|
// Is this AsyncQueue being shut down? Once it is set to true, it will not
|
|
6312
6312
|
// be changed again.
|
|
6313
|
-
this.
|
|
6313
|
+
this.St = !1,
|
|
6314
6314
|
// Operations scheduled to be queued in the future. Operations are
|
|
6315
6315
|
// automatically removed after they are run or canceled.
|
|
6316
|
-
this.
|
|
6316
|
+
this.qt = [],
|
|
6317
6317
|
// visible for testing
|
|
6318
|
-
this.
|
|
6318
|
+
this.Ot = null,
|
|
6319
6319
|
// Flag set while there's an outstanding AsyncQueue operation, used for
|
|
6320
6320
|
// assertion sanity-checks.
|
|
6321
|
-
this.
|
|
6321
|
+
this.kt = !1,
|
|
6322
6322
|
// Enabled during shutdown on Safari to prevent future access to IndexedDB.
|
|
6323
|
-
this.
|
|
6323
|
+
this.Ct = !1,
|
|
6324
6324
|
// List of TimerIds to fast-forward delays for.
|
|
6325
|
-
this.
|
|
6325
|
+
this.Lt = [],
|
|
6326
6326
|
// Backoff timer used to schedule retries for retryable operations
|
|
6327
|
-
this.
|
|
6327
|
+
this.Pt = new nn(this, "async_queue_retry" /* AsyncQueueRetry */),
|
|
6328
6328
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
6329
6329
|
// operations. Meant to speed up recovery when we regain file system access
|
|
6330
6330
|
// after page comes into foreground.
|
|
6331
|
-
this.
|
|
6331
|
+
this.Mt = () => {
|
|
6332
6332
|
const t = Hr();
|
|
6333
|
-
t && y("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.
|
|
6333
|
+
t && y("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.Pt.Z();
|
|
6334
6334
|
};
|
|
6335
6335
|
const t = Hr();
|
|
6336
|
-
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.
|
|
6336
|
+
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Mt);
|
|
6337
6337
|
}
|
|
6338
6338
|
get isShuttingDown() {
|
|
6339
|
-
return this.
|
|
6339
|
+
return this.St;
|
|
6340
6340
|
}
|
|
6341
6341
|
/**
|
|
6342
6342
|
* Adds a new operation to the queue without waiting for it to complete (i.e.
|
|
@@ -6346,38 +6346,38 @@ class Yr {
|
|
|
6346
6346
|
this.enqueue(t);
|
|
6347
6347
|
}
|
|
6348
6348
|
enqueueAndForgetEvenWhileRestricted(t) {
|
|
6349
|
-
this.
|
|
6349
|
+
this.Ut(),
|
|
6350
6350
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
6351
|
-
this.
|
|
6351
|
+
this.jt(t);
|
|
6352
6352
|
}
|
|
6353
6353
|
enterRestrictedMode(t) {
|
|
6354
|
-
if (!this.
|
|
6355
|
-
this.
|
|
6354
|
+
if (!this.St) {
|
|
6355
|
+
this.St = !0, this.Ct = t || !1;
|
|
6356
6356
|
const e = Hr();
|
|
6357
|
-
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.
|
|
6357
|
+
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Mt);
|
|
6358
6358
|
}
|
|
6359
6359
|
}
|
|
6360
6360
|
enqueue(t) {
|
|
6361
|
-
if (this.
|
|
6361
|
+
if (this.Ut(), this.St)
|
|
6362
6362
|
// Return a Promise which never resolves.
|
|
6363
6363
|
return new Promise((() => {}));
|
|
6364
6364
|
// Create a deferred Promise that we can return to the callee. This
|
|
6365
6365
|
// allows us to return a "hanging Promise" only to the callee and still
|
|
6366
6366
|
// advance the queue even when the operation is not run.
|
|
6367
6367
|
const e = new j;
|
|
6368
|
-
return this.
|
|
6368
|
+
return this.jt((() => this.St && this.Ct ? Promise.resolve() : (t().then(e.resolve, e.reject),
|
|
6369
6369
|
e.promise))).then((() => e.promise));
|
|
6370
6370
|
}
|
|
6371
6371
|
enqueueRetryable(t) {
|
|
6372
|
-
this.enqueueAndForget((() => (this.
|
|
6372
|
+
this.enqueueAndForget((() => (this.Ft.push(t), this.Bt())));
|
|
6373
6373
|
}
|
|
6374
6374
|
/**
|
|
6375
6375
|
* Runs the next operation from the retryable queue. If the operation fails,
|
|
6376
6376
|
* reschedules with backoff.
|
|
6377
|
-
*/ async
|
|
6378
|
-
if (0 !== this.
|
|
6377
|
+
*/ async Bt() {
|
|
6378
|
+
if (0 !== this.Ft.length) {
|
|
6379
6379
|
try {
|
|
6380
|
-
await this.
|
|
6380
|
+
await this.Ft[0](), this.Ft.shift(), this.Pt.reset();
|
|
6381
6381
|
} catch (t) {
|
|
6382
6382
|
if (!
|
|
6383
6383
|
/**
|
|
@@ -6421,7 +6421,7 @@ class Yr {
|
|
|
6421
6421
|
// Failure will be handled by AsyncQueue
|
|
6422
6422
|
y("AsyncQueue", "Operation failed with retryable error: " + t);
|
|
6423
6423
|
}
|
|
6424
|
-
this.
|
|
6424
|
+
this.Ft.length > 0 &&
|
|
6425
6425
|
// If there are additional operations, we re-schedule `retryNextOp()`.
|
|
6426
6426
|
// This is necessary to run retryable operations that failed during
|
|
6427
6427
|
// their initial attempt since we don't know whether they are already
|
|
@@ -6432,12 +6432,12 @@ class Yr {
|
|
|
6432
6432
|
// Since `backoffAndRun()` cancels an existing backoff and schedules a
|
|
6433
6433
|
// new backoff on every call, there is only ever a single additional
|
|
6434
6434
|
// operation in the queue.
|
|
6435
|
-
this.
|
|
6435
|
+
this.Pt.J((() => this.Bt()));
|
|
6436
6436
|
}
|
|
6437
6437
|
}
|
|
6438
|
-
|
|
6439
|
-
const e = this.
|
|
6440
|
-
this.
|
|
6438
|
+
jt(t) {
|
|
6439
|
+
const e = this.xt.then((() => (this.kt = !0, t().catch((t => {
|
|
6440
|
+
this.Ot = t, this.kt = !1;
|
|
6441
6441
|
const e =
|
|
6442
6442
|
/**
|
|
6443
6443
|
* Chrome includes Error.message in Error.stack. Other browsers do not.
|
|
@@ -6478,38 +6478,38 @@ class Yr {
|
|
|
6478
6478
|
// all further attempts to chain (via .then) will just short-circuit
|
|
6479
6479
|
// and return the rejected Promise.
|
|
6480
6480
|
throw _("INTERNAL UNHANDLED ERROR: ", e), t;
|
|
6481
|
-
})).then((t => (this.
|
|
6482
|
-
return this.
|
|
6481
|
+
})).then((t => (this.kt = !1, t))))));
|
|
6482
|
+
return this.xt = e, e;
|
|
6483
6483
|
}
|
|
6484
6484
|
enqueueAfterDelay(t, e, n) {
|
|
6485
|
-
this.
|
|
6485
|
+
this.Ut(),
|
|
6486
6486
|
// Fast-forward delays for timerIds that have been overriden.
|
|
6487
|
-
this.
|
|
6488
|
-
const r = Jr.createAndSchedule(this, t, e, n, (t => this.
|
|
6489
|
-
return this.
|
|
6487
|
+
this.Lt.indexOf(t) > -1 && (e = 0);
|
|
6488
|
+
const r = Jr.createAndSchedule(this, t, e, n, (t => this.Qt(t)));
|
|
6489
|
+
return this.qt.push(r), r;
|
|
6490
6490
|
}
|
|
6491
|
-
|
|
6492
|
-
this.
|
|
6491
|
+
Ut() {
|
|
6492
|
+
this.Ot && b();
|
|
6493
6493
|
}
|
|
6494
6494
|
verifyOperationInProgress() {}
|
|
6495
6495
|
/**
|
|
6496
6496
|
* Waits until all currently queued tasks are finished executing. Delayed
|
|
6497
6497
|
* operations are not run.
|
|
6498
|
-
*/ async
|
|
6498
|
+
*/ async zt() {
|
|
6499
6499
|
// Operations in the queue prior to draining may have enqueued additional
|
|
6500
6500
|
// operations. Keep draining the queue until the tail is no longer advanced,
|
|
6501
6501
|
// which indicates that no more new operations were enqueued and that all
|
|
6502
6502
|
// operations were executed.
|
|
6503
6503
|
let t;
|
|
6504
6504
|
do {
|
|
6505
|
-
t = this.
|
|
6506
|
-
} while (t !== this.
|
|
6505
|
+
t = this.xt, await t;
|
|
6506
|
+
} while (t !== this.xt);
|
|
6507
6507
|
}
|
|
6508
6508
|
/**
|
|
6509
6509
|
* For Tests: Determine if a delayed operation with a particular TimerId
|
|
6510
6510
|
* exists.
|
|
6511
|
-
*/
|
|
6512
|
-
for (const e of this.
|
|
6511
|
+
*/ Gt(t) {
|
|
6512
|
+
for (const e of this.qt) if (e.timerId === t) return !0;
|
|
6513
6513
|
return !1;
|
|
6514
6514
|
}
|
|
6515
6515
|
/**
|
|
@@ -6518,24 +6518,24 @@ class Yr {
|
|
|
6518
6518
|
* @param lastTimerId - Delayed operations up to and including this TimerId
|
|
6519
6519
|
* will be drained. Pass TimerId.All to run all delayed operations.
|
|
6520
6520
|
* @returns a Promise that resolves once all operations have been run.
|
|
6521
|
-
*/
|
|
6521
|
+
*/ Wt(t) {
|
|
6522
6522
|
// Note that draining may generate more delayed ops, so we do that first.
|
|
6523
|
-
return this.
|
|
6523
|
+
return this.zt().then((() => {
|
|
6524
6524
|
// Run ops in the same order they'd run if they ran naturally.
|
|
6525
|
-
this.
|
|
6526
|
-
for (const e of this.
|
|
6527
|
-
return this.
|
|
6525
|
+
this.qt.sort(((t, e) => t.targetTimeMs - e.targetTimeMs));
|
|
6526
|
+
for (const e of this.qt) if (e.skipDelay(), "all" /* All */ !== t && e.timerId === t) break;
|
|
6527
|
+
return this.zt();
|
|
6528
6528
|
}));
|
|
6529
6529
|
}
|
|
6530
6530
|
/**
|
|
6531
6531
|
* For Tests: Skip all subsequent delays for a timer id.
|
|
6532
|
-
*/
|
|
6533
|
-
this.
|
|
6532
|
+
*/ Kt(t) {
|
|
6533
|
+
this.Lt.push(t);
|
|
6534
6534
|
}
|
|
6535
|
-
/** Called once a DelayedOperation is run or canceled. */
|
|
6535
|
+
/** Called once a DelayedOperation is run or canceled. */ Qt(t) {
|
|
6536
6536
|
// NOTE: indexOf / slice are O(n), but delayedOperations is expected to be small.
|
|
6537
|
-
const e = this.
|
|
6538
|
-
this.
|
|
6537
|
+
const e = this.qt.indexOf(t);
|
|
6538
|
+
this.qt.splice(e, 1);
|
|
6539
6539
|
}
|
|
6540
6540
|
}
|
|
6541
6541
|
|
|
@@ -6642,7 +6642,7 @@ class Zr {
|
|
|
6642
6642
|
return n && s._setSettings(n), s;
|
|
6643
6643
|
}), "PUBLIC").setMultipleInstances(!0)),
|
|
6644
6644
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
6645
|
-
registerVersion("firestore-lite", "3.7.
|
|
6645
|
+
registerVersion("firestore-lite", "3.7.2", ""), registerVersion("firestore-lite", "3.7.2", "esm2017");
|
|
6646
6646
|
|
|
6647
6647
|
export { yn as AggregateField, _n as AggregateQuerySnapshot, Vn as Bytes, En as CollectionReference, vn as DocumentReference, ir as DocumentSnapshot, Nn as FieldPath, $n as FieldValue, fn as Firestore, U as FirestoreError, xn as GeoPoint, bn as Query, hr as QueryConstraint, or as QueryDocumentSnapshot, ur as QuerySnapshot, bt as Timestamp, Zr as Transaction, Qr as WriteBatch, Or as addDoc, Cr as aggregateQuerySnapshotEqual, jr as arrayRemove, Ur as arrayUnion, In as collection, Tn as collectionGroup, mn as connectFirestoreEmulator, qr as deleteDoc, Lr as deleteField, An as doc, Dn as documentId, Tr as endAt, Ir as endBefore, kr as getCount, $r as getDoc, xr as getDocs, wn as getFirestore, Br as increment, dn as initializeFirestore, yr as limit, _r as limitToLast, mr as orderBy, lr as query, Pn as queryEqual, Rn as refEqual, ts as runTransaction, Mr as serverTimestamp, Fr as setDoc, p as setLogLevel, cr as snapshotEqual, br as startAfter, vr as startAt, pn as terminate, Sr as updateDoc, dr as where, Gr as writeBatch };
|
|
6648
6648
|
//# sourceMappingURL=index.browser.esm2017.js.map
|