@firebase/firestore 3.4.8-canary.69baecadd → 3.4.8-canary.6ceff4db0
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/firestore/lite/index.d.ts +1 -0
- package/dist/firestore/src/api/transaction.d.ts +2 -1
- package/dist/firestore/src/api/transaction_options.d.ts +17 -0
- package/dist/firestore/src/api.d.ts +1 -0
- package/dist/firestore/src/core/firestore_client.d.ts +2 -1
- package/dist/firestore/src/core/transaction_options.d.ts +25 -0
- package/dist/firestore/src/core/transaction_runner.d.ts +3 -2
- package/dist/firestore/src/lite-api/transaction.d.ts +2 -1
- package/dist/firestore/src/lite-api/transaction_options.d.ts +23 -0
- package/dist/index.d.ts +24 -1
- package/dist/index.esm2017.js +95 -71
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +105 -82
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +36 -9
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +36 -9
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +241 -217
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +25 -1
- package/dist/lite/firestore/lite/index.d.ts +1 -0
- package/dist/lite/firestore/src/api/transaction.d.ts +2 -1
- package/dist/lite/firestore/src/api/transaction_options.d.ts +17 -0
- package/dist/lite/firestore/src/api.d.ts +1 -0
- package/dist/lite/firestore/src/core/firestore_client.d.ts +2 -1
- package/dist/lite/firestore/src/core/transaction_options.d.ts +25 -0
- package/dist/lite/firestore/src/core/transaction_runner.d.ts +3 -2
- package/dist/lite/firestore/src/lite-api/transaction.d.ts +2 -1
- package/dist/lite/firestore/src/lite-api/transaction_options.d.ts +23 -0
- package/dist/lite/index.browser.esm2017.js +180 -157
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +112 -110
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.d.ts +24 -1
- package/dist/lite/index.node.cjs.js +34 -7
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +34 -7
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +204 -181
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +25 -1
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +13 -13
- package/dist/lite/packages/firestore/lite/index.d.ts +1 -0
- package/dist/lite/packages/firestore/src/api/transaction.d.ts +2 -1
- package/dist/lite/packages/firestore/src/api/transaction_options.d.ts +17 -0
- package/dist/lite/packages/firestore/src/api.d.ts +1 -0
- package/dist/lite/packages/firestore/src/core/firestore_client.d.ts +2 -1
- package/dist/lite/packages/firestore/src/core/transaction_options.d.ts +25 -0
- package/dist/lite/packages/firestore/src/core/transaction_runner.d.ts +3 -2
- package/dist/lite/packages/firestore/src/lite-api/transaction.d.ts +2 -1
- package/dist/lite/packages/firestore/src/lite-api/transaction_options.d.ts +23 -0
- package/dist/lite/private.d.ts +25 -1
- package/dist/packages/firestore/dist/index.esm2017.d.ts +30 -29
- package/dist/packages/firestore/lite/index.d.ts +1 -0
- package/dist/packages/firestore/src/api/transaction.d.ts +2 -1
- package/dist/packages/firestore/src/api/transaction_options.d.ts +17 -0
- package/dist/packages/firestore/src/api.d.ts +1 -0
- package/dist/packages/firestore/src/core/firestore_client.d.ts +2 -1
- package/dist/packages/firestore/src/core/transaction_options.d.ts +25 -0
- package/dist/packages/firestore/src/core/transaction_runner.d.ts +3 -2
- package/dist/packages/firestore/src/lite-api/transaction.d.ts +2 -1
- package/dist/packages/firestore/src/lite-api/transaction_options.d.ts +23 -0
- package/dist/private.d.ts +25 -1
- package/package.json +10 -10
package/dist/index.rn.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Logger as o, LogLevel as u } from "@firebase/logger";
|
|
|
6
6
|
|
|
7
7
|
import { FirebaseError as a, base64 as c, getUA as h, isIndexedDBAvailable as l, isSafari as f, isMobileCordova as d, isReactNative as _, isElectron as w, isIE as m, isUWP as g, isBrowserExtension as y, createMockUserToken as p, getModularInstance as I, deepEqual as T } from "@firebase/util";
|
|
8
8
|
|
|
9
|
-
import { XhrIo as E, EventType as A, ErrorCode as R, createWebChannelTransport as
|
|
9
|
+
import { XhrIo as E, EventType as A, ErrorCode as R, createWebChannelTransport as b, getStatEventTarget as P, FetchXmlHttpFactory as V, WebChannel as v, Event as S, Stat as D } from "@firebase/webchannel-wrapper";
|
|
10
10
|
|
|
11
11
|
const C = "@firebase/firestore";
|
|
12
12
|
|
|
@@ -70,7 +70,7 @@ x.MOCK_USER = new x("mock-user");
|
|
|
70
70
|
* See the License for the specific language governing permissions and
|
|
71
71
|
* limitations under the License.
|
|
72
72
|
*/
|
|
73
|
-
let N = "9.7.0-canary.
|
|
73
|
+
let N = "9.7.0-canary.6ceff4db0";
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* @license
|
|
@@ -1387,7 +1387,7 @@ const Et = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1387
1387
|
return "number" == typeof t ? t : "string" == typeof t ? Number(t) : 0;
|
|
1388
1388
|
}
|
|
1389
1389
|
|
|
1390
|
-
/** Converts the possible Proto types for Blobs into a ByteString. */ function
|
|
1390
|
+
/** Converts the possible Proto types for Blobs into a ByteString. */ function bt(t) {
|
|
1391
1391
|
return "string" == typeof t ? Tt.fromBase64String(t) : Tt.fromUint8Array(t);
|
|
1392
1392
|
}
|
|
1393
1393
|
|
|
@@ -1424,7 +1424,7 @@ const Et = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1424
1424
|
* FieldValueOptions to value().
|
|
1425
1425
|
* - With respect to other ServerTimestampValues, they sort by their
|
|
1426
1426
|
* localWriteTime.
|
|
1427
|
-
*/ function
|
|
1427
|
+
*/ function Pt(t) {
|
|
1428
1428
|
var e, n;
|
|
1429
1429
|
return "server_timestamp" === (null === (n = ((null === (e = null == t ? void 0 : t.mapValue) || void 0 === e ? void 0 : e.fields) || {}).__type__) || void 0 === n ? void 0 : n.stringValue);
|
|
1430
1430
|
}
|
|
@@ -1440,7 +1440,7 @@ const Et = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1440
1440
|
*/
|
|
1441
1441
|
function Vt(t) {
|
|
1442
1442
|
const e = t.mapValue.fields.__previous_value__;
|
|
1443
|
-
return
|
|
1443
|
+
return Pt(e) ? Vt(e) : e;
|
|
1444
1444
|
}
|
|
1445
1445
|
|
|
1446
1446
|
/**
|
|
@@ -1640,7 +1640,7 @@ function Ct(t) {
|
|
|
1640
1640
|
|
|
1641
1641
|
/** Extracts the backend's type order for the provided value. */
|
|
1642
1642
|
function Ft(t) {
|
|
1643
|
-
return "nullValue" in t ? 0 /* NullValue */ : "booleanValue" in t ? 1 /* BooleanValue */ : "integerValue" in t || "doubleValue" in t ? 2 /* NumberValue */ : "timestampValue" in t ? 3 /* TimestampValue */ : "stringValue" in t ? 5 /* StringValue */ : "bytesValue" in t ? 6 /* BlobValue */ : "referenceValue" in t ? 7 /* RefValue */ : "geoPointValue" in t ? 8 /* GeoPointValue */ : "arrayValue" in t ? 9 /* ArrayValue */ : "mapValue" in t ?
|
|
1643
|
+
return "nullValue" in t ? 0 /* NullValue */ : "booleanValue" in t ? 1 /* BooleanValue */ : "integerValue" in t || "doubleValue" in t ? 2 /* NumberValue */ : "timestampValue" in t ? 3 /* TimestampValue */ : "stringValue" in t ? 5 /* StringValue */ : "bytesValue" in t ? 6 /* BlobValue */ : "referenceValue" in t ? 7 /* RefValue */ : "geoPointValue" in t ? 8 /* GeoPointValue */ : "arrayValue" in t ? 9 /* ArrayValue */ : "mapValue" in t ? Pt(t) ? 4 /* ServerTimestampValue */ : Yt(t) ? 9007199254740991 /* MaxValue */ : 10 /* ObjectValue */ : U();
|
|
1644
1644
|
}
|
|
1645
1645
|
|
|
1646
1646
|
/** Tests `left` and `right` for equality based on the backend semantics. */ function $t(t, e) {
|
|
@@ -1672,7 +1672,7 @@ function Ft(t) {
|
|
|
1672
1672
|
|
|
1673
1673
|
case 6 /* BlobValue */ :
|
|
1674
1674
|
return function(t, e) {
|
|
1675
|
-
return
|
|
1675
|
+
return bt(t.bytesValue).isEqual(bt(e.bytesValue));
|
|
1676
1676
|
}(t, e);
|
|
1677
1677
|
|
|
1678
1678
|
case 7 /* RefValue */ :
|
|
@@ -1745,7 +1745,7 @@ function Lt(t, e) {
|
|
|
1745
1745
|
|
|
1746
1746
|
case 6 /* BlobValue */ :
|
|
1747
1747
|
return function(t, e) {
|
|
1748
|
-
const n =
|
|
1748
|
+
const n = bt(t), s = bt(e);
|
|
1749
1749
|
return n.compareTo(s);
|
|
1750
1750
|
}(t.bytesValue, e.bytesValue);
|
|
1751
1751
|
|
|
@@ -1819,7 +1819,7 @@ function Kt(t) {
|
|
|
1819
1819
|
return "nullValue" in t ? "null" : "booleanValue" in t ? "" + t.booleanValue : "integerValue" in t ? "" + t.integerValue : "doubleValue" in t ? "" + t.doubleValue : "timestampValue" in t ? function(t) {
|
|
1820
1820
|
const e = At(t);
|
|
1821
1821
|
return `time(${e.seconds},${e.nanos})`;
|
|
1822
|
-
}(t.timestampValue) : "stringValue" in t ? t.stringValue : "bytesValue" in t ?
|
|
1822
|
+
}(t.timestampValue) : "stringValue" in t ? t.stringValue : "bytesValue" in t ? bt(t.bytesValue).toBase64() : "referenceValue" in t ? (n = t.referenceValue,
|
|
1823
1823
|
kt.fromName(n).toString()) : "geoPointValue" in t ? `geo(${(e = t.geoPointValue).latitude},${e.longitude})` : "arrayValue" in t ? function(t) {
|
|
1824
1824
|
let e = "[", n = !0;
|
|
1825
1825
|
for (const s of t.values || []) n ? n = !1 : e += ",", e += Kt(s);
|
|
@@ -2889,11 +2889,11 @@ function Re(t, e) {
|
|
|
2889
2889
|
return t.collectionGroup === e.collectionGroup && (!!t.path.isEqual(e.path) && (!!qe(t.startAt, e.startAt) && qe(t.endAt, e.endAt)));
|
|
2890
2890
|
}
|
|
2891
2891
|
|
|
2892
|
-
function
|
|
2892
|
+
function be(t) {
|
|
2893
2893
|
return kt.isDocumentKey(t.path) && null === t.collectionGroup && 0 === t.filters.length;
|
|
2894
2894
|
}
|
|
2895
2895
|
|
|
2896
|
-
/** Returns the field filters that target the given field path. */ function
|
|
2896
|
+
/** Returns the field filters that target the given field path. */ function Pe(t, e) {
|
|
2897
2897
|
return t.filters.filter((t => t instanceof Se && t.field.isEqual(e)));
|
|
2898
2898
|
}
|
|
2899
2899
|
|
|
@@ -2908,7 +2908,7 @@ function Pe(t) {
|
|
|
2908
2908
|
function Ve(t, e, n) {
|
|
2909
2909
|
let s = Ot, i = !0;
|
|
2910
2910
|
// Process all filters to find a value for the current field segment
|
|
2911
|
-
for (const n of
|
|
2911
|
+
for (const n of Pe(t, e)) {
|
|
2912
2912
|
let t = Ot, e = !0;
|
|
2913
2913
|
switch (n.op) {
|
|
2914
2914
|
case "<" /* LESS_THAN */ :
|
|
@@ -2966,7 +2966,7 @@ function Ve(t, e, n) {
|
|
|
2966
2966
|
*/ function ve(t, e, n) {
|
|
2967
2967
|
let s = Mt, i = !0;
|
|
2968
2968
|
// Process all filters to find a value for the current field segment
|
|
2969
|
-
for (const n of
|
|
2969
|
+
for (const n of Pe(t, e)) {
|
|
2970
2970
|
let t = Mt, e = !0;
|
|
2971
2971
|
switch (n.op) {
|
|
2972
2972
|
case ">=" /* GREATER_THAN_OR_EQUAL */ :
|
|
@@ -3689,18 +3689,18 @@ class Rn {
|
|
|
3689
3689
|
* Encodes a precondition for a mutation. This follows the model that the
|
|
3690
3690
|
* backend accepts with the special case of an explicit "empty" precondition
|
|
3691
3691
|
* (meaning no precondition).
|
|
3692
|
-
*/ class
|
|
3692
|
+
*/ class bn {
|
|
3693
3693
|
constructor(t, e) {
|
|
3694
3694
|
this.updateTime = t, this.exists = e;
|
|
3695
3695
|
}
|
|
3696
3696
|
/** Creates a new empty Precondition. */ static none() {
|
|
3697
|
-
return new
|
|
3697
|
+
return new bn;
|
|
3698
3698
|
}
|
|
3699
3699
|
/** Creates a new Precondition with an exists flag. */ static exists(t) {
|
|
3700
|
-
return new
|
|
3700
|
+
return new bn(void 0, t);
|
|
3701
3701
|
}
|
|
3702
3702
|
/** Creates a new Precondition based on a version a document exists at. */ static updateTime(t) {
|
|
3703
|
-
return new
|
|
3703
|
+
return new bn(t);
|
|
3704
3704
|
}
|
|
3705
3705
|
/** Returns whether this Precondition is empty. */ get isNone() {
|
|
3706
3706
|
return void 0 === this.updateTime && void 0 === this.exists;
|
|
@@ -3710,7 +3710,7 @@ class Rn {
|
|
|
3710
3710
|
}
|
|
3711
3711
|
}
|
|
3712
3712
|
|
|
3713
|
-
/** Returns true if the preconditions is valid for the given document. */ function
|
|
3713
|
+
/** Returns true if the preconditions is valid for the given document. */ function Pn(t, e) {
|
|
3714
3714
|
return void 0 !== t.updateTime ? e.isFoundDocument() && e.version.isEqual(t.updateTime) : void 0 === t.exists || t.exists === e.isFoundDocument();
|
|
3715
3715
|
}
|
|
3716
3716
|
|
|
@@ -3778,7 +3778,7 @@ class Rn {
|
|
|
3778
3778
|
const s = t.value.clone(), i = On(t.fieldTransforms, e, n.transformResults);
|
|
3779
3779
|
s.setAll(i), e.convertToFoundDocument(n.version, s).setHasCommittedMutations();
|
|
3780
3780
|
}(t, e, n) : t instanceof kn ? function(t, e, n) {
|
|
3781
|
-
if (!
|
|
3781
|
+
if (!Pn(t.precondition, e))
|
|
3782
3782
|
// Since the mutation was not rejected, we know that the precondition
|
|
3783
3783
|
// matched on the backend. We therefore must not have the expected version
|
|
3784
3784
|
// of the document in our cache and convert to an UnknownDocument with a
|
|
@@ -3807,7 +3807,7 @@ class Rn {
|
|
|
3807
3807
|
* batch this mutation is a part of.
|
|
3808
3808
|
*/ function Sn(t, e, n) {
|
|
3809
3809
|
t instanceof Nn ? function(t, e, n) {
|
|
3810
|
-
if (!
|
|
3810
|
+
if (!Pn(t.precondition, e))
|
|
3811
3811
|
// The mutation failed to apply (e.g. a document ID created with add()
|
|
3812
3812
|
// caused a name collision).
|
|
3813
3813
|
return;
|
|
@@ -3827,14 +3827,14 @@ class Rn {
|
|
|
3827
3827
|
* * When a field is not in the mask but is in the values, the values map is
|
|
3828
3828
|
* ignored.
|
|
3829
3829
|
*/ (t, e, n) : t instanceof kn ? function(t, e, n) {
|
|
3830
|
-
if (!
|
|
3830
|
+
if (!Pn(t.precondition, e)) return;
|
|
3831
3831
|
const s = Fn(t.fieldTransforms, n, e), i = e.data;
|
|
3832
3832
|
i.setAll(Mn(t)), i.setAll(s), e.convertToFoundDocument(xn(e), i).setHasLocalMutations();
|
|
3833
3833
|
}
|
|
3834
3834
|
/**
|
|
3835
3835
|
* Returns a FieldPath/Value map with the content of the PatchMutation.
|
|
3836
3836
|
*/ (t, e, n) : function(t, e) {
|
|
3837
|
-
|
|
3837
|
+
Pn(t.precondition, e) &&
|
|
3838
3838
|
// We don't call `setHasLocalMutations()` since we want to be backwards
|
|
3839
3839
|
// compatible with the existing SDK behavior.
|
|
3840
3840
|
e.convertToNoDocument(ht.min());
|
|
@@ -4623,7 +4623,7 @@ class as {
|
|
|
4623
4623
|
const e = t.targetId, n = t.$.count, s = this.wt(e);
|
|
4624
4624
|
if (s) {
|
|
4625
4625
|
const t = s.target;
|
|
4626
|
-
if (
|
|
4626
|
+
if (be(t)) if (0 === n) {
|
|
4627
4627
|
// The existence filter told us the document does not exist. We deduce
|
|
4628
4628
|
// that this document does not exist and apply a deleted document to
|
|
4629
4629
|
// our updates. Without applying this deleted document there might be
|
|
@@ -4648,7 +4648,7 @@ class as {
|
|
|
4648
4648
|
this.st.forEach(((n, s) => {
|
|
4649
4649
|
const i = this.wt(s);
|
|
4650
4650
|
if (i) {
|
|
4651
|
-
if (n.current &&
|
|
4651
|
+
if (n.current && be(i.target)) {
|
|
4652
4652
|
// Document queries for document that don't exist can produce an empty
|
|
4653
4653
|
// result set. To update our local cache, we synthesize a document
|
|
4654
4654
|
// delete if we have not previously received the document. This
|
|
@@ -4882,7 +4882,7 @@ function Ts(t, e) {
|
|
|
4882
4882
|
const n = ps(e);
|
|
4883
4883
|
if (n.get(1) !== t.databaseId.projectId) throw new j(Q.INVALID_ARGUMENT, "Tried to deserialize key from different project: " + n.get(1) + " vs " + t.databaseId.projectId);
|
|
4884
4884
|
if (n.get(3) !== t.databaseId.database) throw new j(Q.INVALID_ARGUMENT, "Tried to deserialize key from different database: " + n.get(3) + " vs " + t.databaseId.database);
|
|
4885
|
-
return new kt(
|
|
4885
|
+
return new kt(bs(n));
|
|
4886
4886
|
}
|
|
4887
4887
|
|
|
4888
4888
|
function Es(t, e) {
|
|
@@ -4895,18 +4895,18 @@ function As(t) {
|
|
|
4895
4895
|
// "/documents". In v1 all resource paths contain "/documents". Preserve the
|
|
4896
4896
|
// ability to read the v1beta1 form for compatibility with queries persisted
|
|
4897
4897
|
// in the local target cache.
|
|
4898
|
-
return 4 === e.length ? wt.emptyPath() :
|
|
4898
|
+
return 4 === e.length ? wt.emptyPath() : bs(e);
|
|
4899
4899
|
}
|
|
4900
4900
|
|
|
4901
4901
|
function Rs(t) {
|
|
4902
4902
|
return new wt([ "projects", t.databaseId.projectId, "databases", t.databaseId.database ]).canonicalString();
|
|
4903
4903
|
}
|
|
4904
4904
|
|
|
4905
|
-
function
|
|
4905
|
+
function bs(t) {
|
|
4906
4906
|
return q(t.length > 4 && "documents" === t.get(4)), t.popFirst(5);
|
|
4907
4907
|
}
|
|
4908
4908
|
|
|
4909
|
-
/** Creates a Document proto from key and fields (but no create/update time) */ function
|
|
4909
|
+
/** Creates a Document proto from key and fields (but no create/update time) */ function Ps(t, e, n) {
|
|
4910
4910
|
return {
|
|
4911
4911
|
name: Is(t, e),
|
|
4912
4912
|
fields: n.value.mapValue.fields
|
|
@@ -5000,11 +5000,11 @@ function Ss(t, e) {
|
|
|
5000
5000
|
function Ds(t, e) {
|
|
5001
5001
|
let n;
|
|
5002
5002
|
if (e instanceof Nn) n = {
|
|
5003
|
-
update:
|
|
5003
|
+
update: Ps(t, e.key, e.value)
|
|
5004
5004
|
}; else if (e instanceof $n) n = {
|
|
5005
5005
|
delete: Is(t, e.key)
|
|
5006
5006
|
}; else if (e instanceof kn) n = {
|
|
5007
|
-
update:
|
|
5007
|
+
update: Ps(t, e.key, e.data),
|
|
5008
5008
|
updateMask: Gs(e.fieldMask)
|
|
5009
5009
|
}; else {
|
|
5010
5010
|
if (!(e instanceof Bn)) return U();
|
|
@@ -5046,8 +5046,8 @@ function Ds(t, e) {
|
|
|
5046
5046
|
|
|
5047
5047
|
function Cs(t, e) {
|
|
5048
5048
|
const n = e.currentDocument ? function(t) {
|
|
5049
|
-
return void 0 !== t.updateTime ?
|
|
5050
|
-
}(e.currentDocument) :
|
|
5049
|
+
return void 0 !== t.updateTime ? bn.updateTime(gs(t.updateTime)) : void 0 !== t.exists ? bn.exists(t.exists) : bn.none();
|
|
5050
|
+
}(e.currentDocument) : bn.none(), s = e.updateTransforms ? e.updateTransforms.map((e => function(t, e) {
|
|
5051
5051
|
let n = null;
|
|
5052
5052
|
if ("setToServerValue" in e) q("REQUEST_TIME" === e.setToServerValue), n = new _n; else if ("appendMissingElements" in e) {
|
|
5053
5053
|
const t = e.appendMissingElements.values || [];
|
|
@@ -5736,7 +5736,7 @@ class Ti {
|
|
|
5736
5736
|
t && this.At.reject(t), this.aborted || (F("SimpleDb", "Aborting transaction:", t ? t.message : "Client-initiated abort"),
|
|
5737
5737
|
this.aborted = !0, this.transaction.abort());
|
|
5738
5738
|
}
|
|
5739
|
-
|
|
5739
|
+
bt() {
|
|
5740
5740
|
// If the browser supports V3 IndexedDB, we invoke commit() explicitly to
|
|
5741
5741
|
// speed up index DB processing if the event loop remains blocks.
|
|
5742
5742
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -5753,7 +5753,7 @@ class Ti {
|
|
|
5753
5753
|
* correct, but they allow type safety through the rest of the consuming code.
|
|
5754
5754
|
*/ store(t) {
|
|
5755
5755
|
const e = this.transaction.objectStore(t);
|
|
5756
|
-
return new
|
|
5756
|
+
return new Pi(e);
|
|
5757
5757
|
}
|
|
5758
5758
|
}
|
|
5759
5759
|
|
|
@@ -5774,7 +5774,7 @@ class Ti {
|
|
|
5774
5774
|
* objectstores.
|
|
5775
5775
|
*/
|
|
5776
5776
|
constructor(t, e, n) {
|
|
5777
|
-
this.name = t, this.version = e, this.
|
|
5777
|
+
this.name = t, this.version = e, this.Pt = n;
|
|
5778
5778
|
// NOTE: According to https://bugs.webkit.org/show_bug.cgi?id=197050, the
|
|
5779
5779
|
// bug we're checking for should exist in iOS >= 12.2 and < 13, but for
|
|
5780
5780
|
// whatever reason it's much harder to hit after 12.2 so we only proactively
|
|
@@ -5848,7 +5848,7 @@ class Ti {
|
|
|
5848
5848
|
}, s.onupgradeneeded = t => {
|
|
5849
5849
|
F("SimpleDb", 'Database "' + this.name + '" requires upgrade from version:', t.oldVersion);
|
|
5850
5850
|
const e = t.target.result;
|
|
5851
|
-
this.
|
|
5851
|
+
this.Pt.kt(e, s.transaction, t.oldVersion, this.version).next((() => {
|
|
5852
5852
|
F("SimpleDb", "Database upgrade to version " + this.version + " complete");
|
|
5853
5853
|
}));
|
|
5854
5854
|
};
|
|
@@ -5864,7 +5864,7 @@ class Ti {
|
|
|
5864
5864
|
++r;
|
|
5865
5865
|
try {
|
|
5866
5866
|
this.db = await this.Nt(t);
|
|
5867
|
-
const e = Ti.open(this.db, t, i ? "readonly" : "readwrite", n), r = s(e).next((t => (e.
|
|
5867
|
+
const e = Ti.open(this.db, t, i ? "readonly" : "readwrite", n), r = s(e).next((t => (e.bt(),
|
|
5868
5868
|
t))).catch((t => (
|
|
5869
5869
|
// Abort the transaction if there was an error.
|
|
5870
5870
|
e.abort(t), Ii.reject(t)))).toPromise();
|
|
@@ -5935,7 +5935,7 @@ class Ti {
|
|
|
5935
5935
|
}
|
|
5936
5936
|
}
|
|
5937
5937
|
|
|
5938
|
-
/** Verifies whether `e` is an IndexedDbTransactionError. */ function
|
|
5938
|
+
/** Verifies whether `e` is an IndexedDbTransactionError. */ function bi(t) {
|
|
5939
5939
|
// Use name equality, as instanceof checks on errors don't work with errors
|
|
5940
5940
|
// that wrap other errors.
|
|
5941
5941
|
return "IndexedDbTransactionError" === t.name;
|
|
@@ -5950,7 +5950,7 @@ class Ti {
|
|
|
5950
5950
|
* method return a PersistencePromise instead.
|
|
5951
5951
|
* 3) Provides a higher-level API to avoid needing to do excessive wrapping of
|
|
5952
5952
|
* intermediate IndexedDB types (IDBCursorWithValue, etc.)
|
|
5953
|
-
*/ class
|
|
5953
|
+
*/ class Pi {
|
|
5954
5954
|
constructor(t) {
|
|
5955
5955
|
this.store = t;
|
|
5956
5956
|
}
|
|
@@ -6485,7 +6485,7 @@ function qi(t, e) {
|
|
|
6485
6485
|
/** Encodes TargetData into a DbTarget for storage locally. */ function Gi(t, e) {
|
|
6486
6486
|
const n = Li(e.snapshotVersion), s = Li(e.lastLimboFreeSnapshotVersion);
|
|
6487
6487
|
let i;
|
|
6488
|
-
i =
|
|
6488
|
+
i = be(e.target) ? Ns(t.Jt, e.target) : ks(t.Jt, e.target);
|
|
6489
6489
|
// We can't store the resumeToken as a ByteString in IndexedDb, so we
|
|
6490
6490
|
// convert it to a base64 string for storage.
|
|
6491
6491
|
const r = e.resumeToken.toBase64();
|
|
@@ -6751,7 +6751,7 @@ class Zi {
|
|
|
6751
6751
|
const n = t.timestampValue;
|
|
6752
6752
|
this.ne(e, 20), "string" == typeof n ? e.ie(n) : (e.ie(`${n.seconds || ""}`), e.se(n.nanos || 0));
|
|
6753
6753
|
} else if ("stringValue" in t) this.re(t.stringValue, e), this.oe(e); else if ("bytesValue" in t) this.ne(e, 30),
|
|
6754
|
-
e.ue(
|
|
6754
|
+
e.ue(bt(t.bytesValue)), this.oe(e); else if ("referenceValue" in t) this.ae(t.referenceValue, e); else if ("geoPointValue" in t) {
|
|
6755
6755
|
const n = t.geoPointValue;
|
|
6756
6756
|
this.ne(e, 45), e.se(n.latitude || 0), e.se(n.longitude || 0);
|
|
6757
6757
|
} else "mapValue" in t ? Yt(t) ? this.ne(e, Number.MAX_SAFE_INTEGER) : (this.ce(t.mapValue, e),
|
|
@@ -6891,8 +6891,8 @@ function er(t) {
|
|
|
6891
6891
|
/**
|
|
6892
6892
|
* Writes the "infinity" byte sequence that sorts after all other byte
|
|
6893
6893
|
* sequences written in ascending order.
|
|
6894
|
-
*/
|
|
6895
|
-
this.
|
|
6894
|
+
*/ be() {
|
|
6895
|
+
this.Pe(255), this.Pe(255);
|
|
6896
6896
|
}
|
|
6897
6897
|
/**
|
|
6898
6898
|
* Writes the "infinity" byte sequence that sorts before all other byte
|
|
@@ -6934,19 +6934,19 @@ function er(t) {
|
|
|
6934
6934
|
}
|
|
6935
6935
|
/** Writes a single byte ascending to the buffer. */ _e(t) {
|
|
6936
6936
|
const e = 255 & t;
|
|
6937
|
-
0 === e ? (this.
|
|
6937
|
+
0 === e ? (this.Pe(0), this.Pe(255)) : 255 === e ? (this.Pe(255), this.Pe(0)) : this.Pe(e);
|
|
6938
6938
|
}
|
|
6939
6939
|
/** Writes a single byte descending to the buffer. */ ge(t) {
|
|
6940
6940
|
const e = 255 & t;
|
|
6941
6941
|
0 === e ? (this.ve(0), this.ve(255)) : 255 === e ? (this.ve(255), this.ve(0)) : this.ve(t);
|
|
6942
6942
|
}
|
|
6943
6943
|
we() {
|
|
6944
|
-
this.
|
|
6944
|
+
this.Pe(0), this.Pe(1);
|
|
6945
6945
|
}
|
|
6946
6946
|
ye() {
|
|
6947
6947
|
this.ve(0), this.ve(1);
|
|
6948
6948
|
}
|
|
6949
|
-
|
|
6949
|
+
Pe(t) {
|
|
6950
6950
|
this.Ae(1), this.buffer[this.position++] = t;
|
|
6951
6951
|
}
|
|
6952
6952
|
ve(t) {
|
|
@@ -6980,7 +6980,7 @@ class sr {
|
|
|
6980
6980
|
this.De.Te(t);
|
|
6981
6981
|
}
|
|
6982
6982
|
ee() {
|
|
6983
|
-
this.De.
|
|
6983
|
+
this.De.be();
|
|
6984
6984
|
}
|
|
6985
6985
|
}
|
|
6986
6986
|
|
|
@@ -7375,7 +7375,7 @@ class dr {
|
|
|
7375
7375
|
const u = function(t, e) {
|
|
7376
7376
|
const n = oe(e);
|
|
7377
7377
|
if (void 0 === n) return null;
|
|
7378
|
-
for (const e of
|
|
7378
|
+
for (const e of Pe(t, n.fieldPath)) switch (e.op) {
|
|
7379
7379
|
case "array-contains-any" /* ARRAY_CONTAINS_ANY */ :
|
|
7380
7380
|
return e.value.arrayValue.values || [];
|
|
7381
7381
|
|
|
@@ -7390,7 +7390,7 @@ class dr {
|
|
|
7390
7390
|
* `null` if there are no such filters.
|
|
7391
7391
|
*/ (r, i), a = function(t, e) {
|
|
7392
7392
|
const n = new Map;
|
|
7393
|
-
for (const s of ue(e)) for (const e of
|
|
7393
|
+
for (const s of ue(e)) for (const e of Pe(t, s.fieldPath)) switch (e.op) {
|
|
7394
7394
|
case "==" /* EQUAL */ :
|
|
7395
7395
|
case "in" /* IN */ :
|
|
7396
7396
|
// Encode equality prefix, which is encoded in the index value before
|
|
@@ -7926,7 +7926,7 @@ class Er {
|
|
|
7926
7926
|
})).next((() => e));
|
|
7927
7927
|
}
|
|
7928
7928
|
addMutationBatch(t, e, n, s) {
|
|
7929
|
-
const i =
|
|
7929
|
+
const i = br(t), r = Rr(t);
|
|
7930
7930
|
// The IndexedDb implementation in Chrome (and Firefox) does not handle
|
|
7931
7931
|
// compound indices that include auto-generated keys correctly. To ensure
|
|
7932
7932
|
// that the index entry is added correctly in all browsers, we perform two
|
|
@@ -8008,7 +8008,7 @@ class Er {
|
|
|
8008
8008
|
// Scan the document-mutation index starting with a prefix starting with
|
|
8009
8009
|
// the given documentKey.
|
|
8010
8010
|
const n = Ys(this.userId, e.path), s = IDBKeyRange.lowerBound(n), i = [];
|
|
8011
|
-
return
|
|
8011
|
+
return br(t).Wt({
|
|
8012
8012
|
range: s
|
|
8013
8013
|
}, ((n, s, r) => {
|
|
8014
8014
|
const [o, u, a] = n, c = Hs(u);
|
|
@@ -8032,7 +8032,7 @@ class Er {
|
|
|
8032
8032
|
let n = new ge(ot);
|
|
8033
8033
|
const s = [];
|
|
8034
8034
|
return e.forEach((e => {
|
|
8035
|
-
const i = Ys(this.userId, e.path), r = IDBKeyRange.lowerBound(i), o =
|
|
8035
|
+
const i = Ys(this.userId, e.path), r = IDBKeyRange.lowerBound(i), o = br(t).Wt({
|
|
8036
8036
|
range: r
|
|
8037
8037
|
}, ((t, s, i) => {
|
|
8038
8038
|
const [r, o, u] = t, a = Hs(o);
|
|
@@ -8054,7 +8054,7 @@ class Er {
|
|
|
8054
8054
|
// SortedSet to accumulate batch IDs so they can be traversed in order in a
|
|
8055
8055
|
// scan of the main table.
|
|
8056
8056
|
let o = new ge(ot);
|
|
8057
|
-
return
|
|
8057
|
+
return br(t).Wt({
|
|
8058
8058
|
range: r
|
|
8059
8059
|
}, ((t, e, i) => {
|
|
8060
8060
|
const [r, u, a] = t, c = Hs(u);
|
|
@@ -8101,7 +8101,7 @@ class Er {
|
|
|
8101
8101
|
// the queue is empty.
|
|
8102
8102
|
const n = IDBKeyRange.lowerBound([ this.userId ]);
|
|
8103
8103
|
const s = [];
|
|
8104
|
-
return
|
|
8104
|
+
return br(t).Wt({
|
|
8105
8105
|
range: n
|
|
8106
8106
|
}, ((t, e, n) => {
|
|
8107
8107
|
if (t[0] === this.userId) {
|
|
@@ -8119,7 +8119,7 @@ class Er {
|
|
|
8119
8119
|
// PORTING NOTE: Multi-tab only (state is held in memory in other clients).
|
|
8120
8120
|
/** Returns the mutation queue's metadata from IndexedDb. */
|
|
8121
8121
|
wn(t) {
|
|
8122
|
-
return
|
|
8122
|
+
return Pr(t).get(this.userId).next((t => t || {
|
|
8123
8123
|
userId: this.userId,
|
|
8124
8124
|
lastAcknowledgedBatchId: -1,
|
|
8125
8125
|
lastStreamToken: ""
|
|
@@ -8133,7 +8133,7 @@ class Er {
|
|
|
8133
8133
|
*/ function Ar(t, e, n) {
|
|
8134
8134
|
const s = Ys(e, n.path), i = s[1], r = IDBKeyRange.lowerBound(s);
|
|
8135
8135
|
let o = !1;
|
|
8136
|
-
return
|
|
8136
|
+
return br(t).Wt({
|
|
8137
8137
|
range: r,
|
|
8138
8138
|
jt: !0
|
|
8139
8139
|
}, ((t, n, s) => {
|
|
@@ -8152,13 +8152,13 @@ function Rr(t) {
|
|
|
8152
8152
|
|
|
8153
8153
|
/**
|
|
8154
8154
|
* Helper to get a typed SimpleDbStore for the mutationQueues object store.
|
|
8155
|
-
*/ function
|
|
8155
|
+
*/ function br(t) {
|
|
8156
8156
|
return Ci(t, "documentMutations");
|
|
8157
8157
|
}
|
|
8158
8158
|
|
|
8159
8159
|
/**
|
|
8160
8160
|
* Helper to get a typed SimpleDbStore for the mutationQueues object store.
|
|
8161
|
-
*/ function
|
|
8161
|
+
*/ function Pr(t) {
|
|
8162
8162
|
return Ci(t, "mutationQueues");
|
|
8163
8163
|
}
|
|
8164
8164
|
|
|
@@ -8468,11 +8468,11 @@ class Vr {
|
|
|
8468
8468
|
constructor(t) {
|
|
8469
8469
|
this.An = t, this.buffer = new ge(Nr), this.Rn = 0;
|
|
8470
8470
|
}
|
|
8471
|
-
|
|
8471
|
+
bn() {
|
|
8472
8472
|
return ++this.Rn;
|
|
8473
8473
|
}
|
|
8474
|
-
|
|
8475
|
-
const e = [ t, this.
|
|
8474
|
+
Pn(t) {
|
|
8475
|
+
const e = [ t, this.bn() ];
|
|
8476
8476
|
if (this.buffer.size < this.An) this.buffer = this.buffer.add(e); else {
|
|
8477
8477
|
const t = this.buffer.last();
|
|
8478
8478
|
Nr(e, t) < 0 && (this.buffer = this.buffer.delete(t).add(e));
|
|
@@ -8512,7 +8512,7 @@ class Vr {
|
|
|
8512
8512
|
try {
|
|
8513
8513
|
await t.collectGarbage(this.garbageCollector);
|
|
8514
8514
|
} catch (t) {
|
|
8515
|
-
|
|
8515
|
+
bi(t) ? F("LruGarbageCollector", "Ignoring IndexedDB error during garbage collection: ", t) : await xr(t);
|
|
8516
8516
|
}
|
|
8517
8517
|
await this.Sn(t);
|
|
8518
8518
|
}));
|
|
@@ -8529,7 +8529,7 @@ class Vr {
|
|
|
8529
8529
|
nthSequenceNumber(t, e) {
|
|
8530
8530
|
if (0 === e) return Ii.resolve(st.A);
|
|
8531
8531
|
const n = new kr(e);
|
|
8532
|
-
return this.Dn.forEachTarget(t, (t => n.
|
|
8532
|
+
return this.Dn.forEachTarget(t, (t => n.Pn(t.sequenceNumber))).next((() => this.Dn.xn(t, (t => n.Pn(t))))).next((() => n.maxValue));
|
|
8533
8533
|
}
|
|
8534
8534
|
removeTargets(t, e, n) {
|
|
8535
8535
|
return this.Dn.removeTargets(t, e, n);
|
|
@@ -8626,7 +8626,7 @@ class Fr {
|
|
|
8626
8626
|
*/ On(t, e) {
|
|
8627
8627
|
return function(t, e) {
|
|
8628
8628
|
let n = !1;
|
|
8629
|
-
return
|
|
8629
|
+
return Pr(t).zt((s => Ar(t, s, e).next((t => (t && (n = !0), Ii.resolve(!t)))))).next((() => n));
|
|
8630
8630
|
}(t, e);
|
|
8631
8631
|
}
|
|
8632
8632
|
removeOrphanedDocuments(t, e) {
|
|
@@ -9537,8 +9537,8 @@ class Jr {
|
|
|
9537
9537
|
if (this.isPrimary) return this.Es(t).next((t => {
|
|
9538
9538
|
t || (this.isPrimary = !1, this.Yn.enqueueRetryable((() => this.cs(!1))));
|
|
9539
9539
|
}));
|
|
9540
|
-
})).next((() => this.As(t))).next((e => this.isPrimary && !e ? this.Rs(t).next((() => !1)) : !!e && this.
|
|
9541
|
-
if (
|
|
9540
|
+
})).next((() => this.As(t))).next((e => this.isPrimary && !e ? this.Rs(t).next((() => !1)) : !!e && this.bs(t).next((() => !0)))))).catch((t => {
|
|
9541
|
+
if (bi(t))
|
|
9542
9542
|
// Proceed with the existing state. Any subsequent access to
|
|
9543
9543
|
// IndexedDB will verify the lease.
|
|
9544
9544
|
return F("IndexedDbPersistence", "Failed to extend owner lease: ", t), this.isPrimary;
|
|
@@ -9550,7 +9550,7 @@ class Jr {
|
|
|
9550
9550
|
}));
|
|
9551
9551
|
}
|
|
9552
9552
|
Es(t) {
|
|
9553
|
-
return Yr(t).get("owner").next((t => Ii.resolve(this.
|
|
9553
|
+
return Yr(t).get("owner").next((t => Ii.resolve(this.Ps(t))));
|
|
9554
9554
|
}
|
|
9555
9555
|
Vs(t) {
|
|
9556
9556
|
return Xr(t).delete(this.clientId);
|
|
@@ -9584,7 +9584,7 @@ class Jr {
|
|
|
9584
9584
|
*/ Is() {
|
|
9585
9585
|
this.os = this.Yn.enqueueAfterDelay("client_metadata_refresh" /* ClientMetadataRefresh */ , 4e3, (() => this.gs().then((() => this.vs())).then((() => this.Is()))));
|
|
9586
9586
|
}
|
|
9587
|
-
/** Checks whether `client` is the local client. */
|
|
9587
|
+
/** Checks whether `client` is the local client. */ Ps(t) {
|
|
9588
9588
|
return !!t && t.ownerId === this.clientId;
|
|
9589
9589
|
}
|
|
9590
9590
|
/**
|
|
@@ -9606,8 +9606,8 @@ class Jr {
|
|
|
9606
9606
|
// the foreground.
|
|
9607
9607
|
// - the `forceOwningTab` setting was passed in.
|
|
9608
9608
|
if (null !== e && this.Ss(e.leaseTimestampMs, 5e3) && !this.xs(e.ownerId)) {
|
|
9609
|
-
if (this.
|
|
9610
|
-
if (!this.
|
|
9609
|
+
if (this.Ps(e) && this.networkEnabled) return !0;
|
|
9610
|
+
if (!this.Ps(e)) {
|
|
9611
9611
|
if (!e.allowTabSynchronization)
|
|
9612
9612
|
// Fail the `canActAsPrimary` check if the current leaseholder has
|
|
9613
9613
|
// not opted into multi-tab synchronization. If this happens at
|
|
@@ -9698,7 +9698,7 @@ class Jr {
|
|
|
9698
9698
|
if (!e) throw $(`Failed to obtain primary lease for action '${t}'.`), this.isPrimary = !1,
|
|
9699
9699
|
this.Yn.enqueueRetryable((() => this.cs(!1))), new j(Q.FAILED_PRECONDITION, yi);
|
|
9700
9700
|
return n(o);
|
|
9701
|
-
})).next((t => this.
|
|
9701
|
+
})).next((t => this.bs(o).next((() => t)))) : this.$s(o).next((() => n(o)))))).then((t => (o.raiseOnCommittedEvent(),
|
|
9702
9702
|
t)));
|
|
9703
9703
|
}
|
|
9704
9704
|
/**
|
|
@@ -9709,13 +9709,13 @@ class Jr {
|
|
|
9709
9709
|
// be turned off.
|
|
9710
9710
|
$s(t) {
|
|
9711
9711
|
return Yr(t).get("owner").next((t => {
|
|
9712
|
-
if (null !== t && this.Ss(t.leaseTimestampMs, 5e3) && !this.xs(t.ownerId) && !this.
|
|
9712
|
+
if (null !== t && this.Ss(t.leaseTimestampMs, 5e3) && !this.xs(t.ownerId) && !this.Ps(t) && !(this.Zn || this.allowTabSynchronization && t.allowTabSynchronization)) throw new j(Q.FAILED_PRECONDITION, Hr);
|
|
9713
9713
|
}));
|
|
9714
9714
|
}
|
|
9715
9715
|
/**
|
|
9716
9716
|
* Obtains or extends the new primary lease for the local client. This
|
|
9717
9717
|
* method does not verify that the client is eligible for this lease.
|
|
9718
|
-
*/
|
|
9718
|
+
*/ bs(t) {
|
|
9719
9719
|
const e = {
|
|
9720
9720
|
ownerId: this.clientId,
|
|
9721
9721
|
allowTabSynchronization: this.allowTabSynchronization,
|
|
@@ -9728,7 +9728,7 @@ class Jr {
|
|
|
9728
9728
|
}
|
|
9729
9729
|
/** Checks the primary lease and removes it if we are the current primary. */ Rs(t) {
|
|
9730
9730
|
const e = Yr(t);
|
|
9731
|
-
return e.get("owner").next((t => this.
|
|
9731
|
+
return e.get("owner").next((t => this.Ps(t) ? (F("IndexedDbPersistence", "Releasing primary lease."),
|
|
9732
9732
|
e.delete("owner")) : Ii.resolve()));
|
|
9733
9733
|
}
|
|
9734
9734
|
/** Verifies that `updateTimeMs` is within `maxAgeMs`. */ Ss(t, e) {
|
|
@@ -10462,7 +10462,7 @@ async function fo(t, e, n) {
|
|
|
10462
10462
|
try {
|
|
10463
10463
|
n || await s.persistence.runTransaction("Release target", r, (t => s.persistence.referenceDelegate.removeTarget(t, i)));
|
|
10464
10464
|
} catch (t) {
|
|
10465
|
-
if (!
|
|
10465
|
+
if (!bi(t)) throw t;
|
|
10466
10466
|
// All `releaseTarget` does is record the final metadata state for the
|
|
10467
10467
|
// target, but we've been recording this periodically during target
|
|
10468
10468
|
// activity. If we lose this write this could cause a very slight
|
|
@@ -10756,14 +10756,14 @@ async function po(t, e, n = Zn()) {
|
|
|
10756
10756
|
const n = new Ao(t, e);
|
|
10757
10757
|
this.Ti = this.Ti.add(n), this.Ai = this.Ai.add(n);
|
|
10758
10758
|
}
|
|
10759
|
-
/** Add references to the given document keys for the given ID. */
|
|
10759
|
+
/** Add references to the given document keys for the given ID. */ bi(t, e) {
|
|
10760
10760
|
t.forEach((t => this.addReference(t, e)));
|
|
10761
10761
|
}
|
|
10762
10762
|
/**
|
|
10763
10763
|
* Removes a reference to the given document key for the given
|
|
10764
10764
|
* ID.
|
|
10765
10765
|
*/ removeReference(t, e) {
|
|
10766
|
-
this.
|
|
10766
|
+
this.Pi(new Ao(t, e));
|
|
10767
10767
|
}
|
|
10768
10768
|
Vi(t, e) {
|
|
10769
10769
|
t.forEach((t => this.removeReference(t, e)));
|
|
@@ -10774,13 +10774,13 @@ async function po(t, e, n = Zn()) {
|
|
|
10774
10774
|
*/ vi(t) {
|
|
10775
10775
|
const e = new kt(new wt([])), n = new Ao(e, t), s = new Ao(e, t + 1), i = [];
|
|
10776
10776
|
return this.Ai.forEachInRange([ n, s ], (t => {
|
|
10777
|
-
this.
|
|
10777
|
+
this.Pi(t), i.push(t.key);
|
|
10778
10778
|
})), i;
|
|
10779
10779
|
}
|
|
10780
10780
|
Si() {
|
|
10781
|
-
this.Ti.forEach((t => this.
|
|
10781
|
+
this.Ti.forEach((t => this.Pi(t)));
|
|
10782
10782
|
}
|
|
10783
|
-
|
|
10783
|
+
Pi(t) {
|
|
10784
10784
|
this.Ti = this.Ti.delete(t), this.Ai = this.Ai.delete(t);
|
|
10785
10785
|
}
|
|
10786
10786
|
Di(t) {
|
|
@@ -10991,7 +10991,7 @@ class Ao {
|
|
|
10991
10991
|
* The memory-only RemoteDocumentCache for IndexedDb. To construct, invoke
|
|
10992
10992
|
* `newMemoryRemoteDocumentCache()`.
|
|
10993
10993
|
*/
|
|
10994
|
-
class
|
|
10994
|
+
class bo {
|
|
10995
10995
|
/**
|
|
10996
10996
|
* @param sizer - Used to assess the size of a document. For eager GC, this is
|
|
10997
10997
|
* expected to just return 0 to avoid unnecessarily doing the work of
|
|
@@ -11062,7 +11062,7 @@ class Po {
|
|
|
11062
11062
|
newChangeBuffer(t) {
|
|
11063
11063
|
// `trackRemovals` is ignores since the MemoryRemoteDocumentCache keeps
|
|
11064
11064
|
// a separate changelog and does not need special handling for removals.
|
|
11065
|
-
return new
|
|
11065
|
+
return new Po(this);
|
|
11066
11066
|
}
|
|
11067
11067
|
getSize(t) {
|
|
11068
11068
|
return Ii.resolve(this.size);
|
|
@@ -11079,7 +11079,7 @@ class Po {
|
|
|
11079
11079
|
/**
|
|
11080
11080
|
* Handles the details of adding and updating documents in the MemoryRemoteDocumentCache.
|
|
11081
11081
|
*/
|
|
11082
|
-
class
|
|
11082
|
+
class Po extends Br {
|
|
11083
11083
|
constructor(t) {
|
|
11084
11084
|
super(), this.Kn = t;
|
|
11085
11085
|
}
|
|
@@ -11178,7 +11178,7 @@ class bo extends Br {
|
|
|
11178
11178
|
return Ii.resolve(n);
|
|
11179
11179
|
}
|
|
11180
11180
|
addMatchingKeys(t, e, n) {
|
|
11181
|
-
return this.qi.
|
|
11181
|
+
return this.qi.bi(e, n), Ii.resolve();
|
|
11182
11182
|
}
|
|
11183
11183
|
removeMatchingKeys(t, e, n) {
|
|
11184
11184
|
this.qi.Vi(e, n);
|
|
@@ -11230,7 +11230,7 @@ class vo {
|
|
|
11230
11230
|
this.Gi = {}, this.overlays = {}, this.es = new st(0), this.ns = !1, this.ns = !0,
|
|
11231
11231
|
this.referenceDelegate = t(this), this.fs = new Vo(this);
|
|
11232
11232
|
this.indexManager = new hr, this.ds = function(t) {
|
|
11233
|
-
return new
|
|
11233
|
+
return new bo(t);
|
|
11234
11234
|
}((t => this.referenceDelegate.Qi(t))), this.M = new Oi(e), this._s = new Io(this.M);
|
|
11235
11235
|
}
|
|
11236
11236
|
start() {
|
|
@@ -11666,7 +11666,7 @@ class $o {
|
|
|
11666
11666
|
this.removeItem(No(this.persistenceKey, t));
|
|
11667
11667
|
}
|
|
11668
11668
|
updateQueryState(t, e, n) {
|
|
11669
|
-
this.
|
|
11669
|
+
this.br(t, e, n);
|
|
11670
11670
|
}
|
|
11671
11671
|
handleUserChange(t, e, n) {
|
|
11672
11672
|
e.forEach((t => {
|
|
@@ -11676,7 +11676,7 @@ class $o {
|
|
|
11676
11676
|
}));
|
|
11677
11677
|
}
|
|
11678
11678
|
setOnlineState(t) {
|
|
11679
|
-
this.
|
|
11679
|
+
this.Pr(t);
|
|
11680
11680
|
}
|
|
11681
11681
|
notifyBundleLoaded(t) {
|
|
11682
11682
|
this.Vr(t);
|
|
@@ -11766,14 +11766,14 @@ class $o {
|
|
|
11766
11766
|
const e = xo(this.persistenceKey, this.currentUser, t);
|
|
11767
11767
|
this.removeItem(e);
|
|
11768
11768
|
}
|
|
11769
|
-
|
|
11769
|
+
Pr(t) {
|
|
11770
11770
|
const e = {
|
|
11771
11771
|
clientId: this.ir,
|
|
11772
11772
|
onlineState: t
|
|
11773
11773
|
};
|
|
11774
11774
|
this.storage.setItem(this.mr, JSON.stringify(e));
|
|
11775
11775
|
}
|
|
11776
|
-
|
|
11776
|
+
br(t, e, n) {
|
|
11777
11777
|
const s = No(this.persistenceKey, t), i = new Mo(t, e, n);
|
|
11778
11778
|
this.setItem(s, i.er());
|
|
11779
11779
|
}
|
|
@@ -12156,7 +12156,7 @@ class {
|
|
|
12156
12156
|
}));
|
|
12157
12157
|
}
|
|
12158
12158
|
wo(t, e, n) {
|
|
12159
|
-
const s = [ this.uo, "/", "google.firestore.v1.Firestore", "/", t, "/channel" ], i =
|
|
12159
|
+
const s = [ this.uo, "/", "google.firestore.v1.Firestore", "/", t, "/channel" ], i = b(), r = P(), o = {
|
|
12160
12160
|
// Required for backend stickiness, routing behavior is based on this
|
|
12161
12161
|
// parameter.
|
|
12162
12162
|
httpSessionIdParam: "gsessionid",
|
|
@@ -12414,7 +12414,7 @@ class Ho {
|
|
|
12414
12414
|
this.cancel();
|
|
12415
12415
|
// First schedule using the current base (which may be 0 and should be
|
|
12416
12416
|
// honored as such).
|
|
12417
|
-
const e = Math.floor(this.Io + this.
|
|
12417
|
+
const e = Math.floor(this.Io + this.bo()), n = Math.max(0, Date.now() - this.Eo), s = Math.max(0, e - n);
|
|
12418
12418
|
// Guard against lastAttemptTime being in the future due to a clock change.
|
|
12419
12419
|
s > 0 && F("ExponentialBackoff", `Backing off for ${s} ms (base delay: ${this.Io} ms, delay with jitter: ${e} ms, last attempt: ${n} ms ago)`),
|
|
12420
12420
|
this.To = this.Yn.enqueueAfterDelay(this.timerId, s, (() => (this.Eo = Date.now(),
|
|
@@ -12423,13 +12423,13 @@ class Ho {
|
|
|
12423
12423
|
// bounds.
|
|
12424
12424
|
this.Io *= this.yo, this.Io < this.mo && (this.Io = this.mo), this.Io > this.po && (this.Io = this.po);
|
|
12425
12425
|
}
|
|
12426
|
-
|
|
12426
|
+
Po() {
|
|
12427
12427
|
null !== this.To && (this.To.skipDelay(), this.To = null);
|
|
12428
12428
|
}
|
|
12429
12429
|
cancel() {
|
|
12430
12430
|
null !== this.To && (this.To.cancel(), this.To = null);
|
|
12431
12431
|
}
|
|
12432
|
-
/** Returns a random value in the range [-currentBaseMs/2, currentBaseMs/2] */
|
|
12432
|
+
/** Returns a random value in the range [-currentBaseMs/2, currentBaseMs/2] */ bo() {
|
|
12433
12433
|
return (Math.random() - .5) * this.Io;
|
|
12434
12434
|
}
|
|
12435
12435
|
}
|
|
@@ -12701,7 +12701,7 @@ class Jo {
|
|
|
12701
12701
|
e.database = Rs(this.M), e.addTarget = function(t, e) {
|
|
12702
12702
|
let n;
|
|
12703
12703
|
const s = e.target;
|
|
12704
|
-
return n =
|
|
12704
|
+
return n = be(s) ? {
|
|
12705
12705
|
documents: Ns(t, s)
|
|
12706
12706
|
} : {
|
|
12707
12707
|
query: ks(t, s)
|
|
@@ -13178,7 +13178,7 @@ async function _u(t, e, n) {
|
|
|
13178
13178
|
* The returned Promise is resolved once the network is disabled and before
|
|
13179
13179
|
* any retry attempt.
|
|
13180
13180
|
*/ async function wu(t, e, n) {
|
|
13181
|
-
if (!
|
|
13181
|
+
if (!bi(e)) throw e;
|
|
13182
13182
|
t.wu.add(1 /* IndexedDbFailed */),
|
|
13183
13183
|
// Disable network and raise offline snapshots
|
|
13184
13184
|
await su(t), t.yu.set("Offline" /* Offline */), n || (
|
|
@@ -13258,7 +13258,7 @@ async function Ru(t, e, n) {
|
|
|
13258
13258
|
await gu(t);
|
|
13259
13259
|
}
|
|
13260
13260
|
|
|
13261
|
-
async function
|
|
13261
|
+
async function bu(t, e) {
|
|
13262
13262
|
// If the write stream closed after the write handshake completes, a write
|
|
13263
13263
|
// operation failed and we fail the pending operation.
|
|
13264
13264
|
e && Su(t).Xo &&
|
|
@@ -13285,7 +13285,7 @@ async function Pu(t, e) {
|
|
|
13285
13285
|
Iu(t) && Tu(t);
|
|
13286
13286
|
}
|
|
13287
13287
|
|
|
13288
|
-
async function
|
|
13288
|
+
async function Pu(t, e) {
|
|
13289
13289
|
const n = G(t);
|
|
13290
13290
|
n.asyncQueue.verifyOperationInProgress(), F("RemoteStore", "RemoteStore received new credentials");
|
|
13291
13291
|
const s = hu(n);
|
|
@@ -13360,7 +13360,7 @@ async function bu(t, e) {
|
|
|
13360
13360
|
return s.iu(), new Xo(e, s.So, s.authCredentials, s.appCheckCredentials, s.M, n);
|
|
13361
13361
|
}(t.datastore, t.asyncQueue, {
|
|
13362
13362
|
Xr: Eu.bind(null, t),
|
|
13363
|
-
eo:
|
|
13363
|
+
eo: bu.bind(null, t),
|
|
13364
13364
|
eu: Au.bind(null, t),
|
|
13365
13365
|
tu: Ru.bind(null, t)
|
|
13366
13366
|
}), t.mu.push((async e => {
|
|
@@ -13459,7 +13459,7 @@ class Du {
|
|
|
13459
13459
|
* Returns a FirestoreError that can be surfaced to the user if the provided
|
|
13460
13460
|
* error is an IndexedDbTransactionError. Re-throws the error otherwise.
|
|
13461
13461
|
*/ function Cu(t, e) {
|
|
13462
|
-
if ($("AsyncQueue", `${e}: ${t}`),
|
|
13462
|
+
if ($("AsyncQueue", `${e}: ${t}`), bi(t)) return new j(Q.UNAVAILABLE, `${e}: ${t}`);
|
|
13463
13463
|
throw t;
|
|
13464
13464
|
}
|
|
13465
13465
|
|
|
@@ -13673,7 +13673,7 @@ class ku {
|
|
|
13673
13673
|
class Ou {
|
|
13674
13674
|
constructor() {
|
|
13675
13675
|
this.queries = new Qn((t => tn(t)), Ze), this.onlineState = "Unknown" /* Unknown */ ,
|
|
13676
|
-
this.
|
|
13676
|
+
this.bu = new Set;
|
|
13677
13677
|
}
|
|
13678
13678
|
}
|
|
13679
13679
|
|
|
@@ -13688,7 +13688,7 @@ async function Fu(t, e) {
|
|
|
13688
13688
|
}
|
|
13689
13689
|
if (n.queries.set(s, r), r.listeners.push(e),
|
|
13690
13690
|
// Run global snapshot listeners if a consistent snapshot has been emitted.
|
|
13691
|
-
e.
|
|
13691
|
+
e.Pu(n.onlineState), r.Ru) {
|
|
13692
13692
|
e.Vu(r.Ru) && Uu(n);
|
|
13693
13693
|
}
|
|
13694
13694
|
}
|
|
@@ -13727,7 +13727,7 @@ function Lu(t, e, n) {
|
|
|
13727
13727
|
|
|
13728
13728
|
// Call all global snapshot listeners that have been set.
|
|
13729
13729
|
function Uu(t) {
|
|
13730
|
-
t.
|
|
13730
|
+
t.bu.forEach((t => {
|
|
13731
13731
|
t.next();
|
|
13732
13732
|
}));
|
|
13733
13733
|
}
|
|
@@ -13766,7 +13766,7 @@ function Uu(t) {
|
|
|
13766
13766
|
onError(t) {
|
|
13767
13767
|
this.vu.error(t);
|
|
13768
13768
|
}
|
|
13769
|
-
/** Returns whether a snapshot was raised. */
|
|
13769
|
+
/** Returns whether a snapshot was raised. */ Pu(t) {
|
|
13770
13770
|
this.onlineState = t;
|
|
13771
13771
|
let e = !1;
|
|
13772
13772
|
return this.Du && !this.Su && this.xu(this.Du, t) && (this.Nu(this.Du), e = !0),
|
|
@@ -14141,7 +14141,7 @@ class zu {
|
|
|
14141
14141
|
/**
|
|
14142
14142
|
* Applies an OnlineState change to the view, potentially generating a
|
|
14143
14143
|
* ViewChange if the view's syncState changes as a result.
|
|
14144
|
-
*/
|
|
14144
|
+
*/ Pu(t) {
|
|
14145
14145
|
return this.current && "Offline" /* Offline */ === t ? (
|
|
14146
14146
|
// If we're offline, set `current` to false and then call applyChanges()
|
|
14147
14147
|
// to refresh our syncState and generate a ViewChange as appropriate. We
|
|
@@ -14415,7 +14415,7 @@ async function Zu(t, e) {
|
|
|
14415
14415
|
// NOTE: The base state should only be applied if there's some
|
|
14416
14416
|
// existing document to override, so use a Precondition of
|
|
14417
14417
|
// exists=true
|
|
14418
|
-
o.push(new kn(t.key, e, se(e.value.mapValue),
|
|
14418
|
+
o.push(new kn(t.key, e, se(e.value.mapValue), bn.exists(!0)));
|
|
14419
14419
|
}
|
|
14420
14420
|
return n.Bs.addMutationBatch(t, s, o, e);
|
|
14421
14421
|
})))).then((t => (t.applyToLocalDocumentSet(r), {
|
|
@@ -14475,7 +14475,7 @@ async function Zu(t, e) {
|
|
|
14475
14475
|
if (s.isPrimaryClient && 0 /* RemoteStore */ === n || !s.isPrimaryClient && 1 /* SharedClientState */ === n) {
|
|
14476
14476
|
const t = [];
|
|
14477
14477
|
s.ia.forEach(((n, s) => {
|
|
14478
|
-
const i = s.view.
|
|
14478
|
+
const i = s.view.Pu(e);
|
|
14479
14479
|
i.snapshot && t.push(i.snapshot);
|
|
14480
14480
|
})), function(t, e) {
|
|
14481
14481
|
const n = G(t);
|
|
@@ -14484,7 +14484,7 @@ async function Zu(t, e) {
|
|
|
14484
14484
|
n.queries.forEach(((t, n) => {
|
|
14485
14485
|
for (const t of n.listeners)
|
|
14486
14486
|
// Run global snapshot listeners if a consistent snapshot has been emitted.
|
|
14487
|
-
t.
|
|
14487
|
+
t.Pu(e) && (s = !0);
|
|
14488
14488
|
})), s && Uu(n);
|
|
14489
14489
|
}(s.eventManager, e), t.length && s.sa.zo(t), s.onlineState = e, s.isPrimaryClient && s.sharedClientState.setOnlineState(e);
|
|
14490
14490
|
}
|
|
@@ -14682,7 +14682,7 @@ async function ma(t, e, n) {
|
|
|
14682
14682
|
try {
|
|
14683
14683
|
await n.persistence.runTransaction("notifyLocalViewChanges", "readwrite", (t => Ii.forEach(e, (e => Ii.forEach(e.Hs, (s => n.persistence.referenceDelegate.addReference(t, e.targetId, s))).next((() => Ii.forEach(e.Js, (s => n.persistence.referenceDelegate.removeReference(t, e.targetId, s)))))))));
|
|
14684
14684
|
} catch (t) {
|
|
14685
|
-
if (!
|
|
14685
|
+
if (!bi(t)) throw t;
|
|
14686
14686
|
// If `notifyLocalViewChanges` fails, we did not advance the sequence
|
|
14687
14687
|
// number for the documents that were included in this transaction.
|
|
14688
14688
|
// This might trigger them to be deleted earlier than they otherwise
|
|
@@ -14872,14 +14872,14 @@ function Ra(t) {
|
|
|
14872
14872
|
|
|
14873
14873
|
/** Returns the IDs of the clients that are currently active. */
|
|
14874
14874
|
// PORTING NOTE: Multi-Tab only.
|
|
14875
|
-
function
|
|
14875
|
+
function ba(t) {
|
|
14876
14876
|
const e = G(t);
|
|
14877
14877
|
return G(G(e.localStore).persistence).Fs();
|
|
14878
14878
|
}
|
|
14879
14879
|
|
|
14880
14880
|
/** Applies a query target change from a different tab. */
|
|
14881
14881
|
// PORTING NOTE: Multi-Tab only.
|
|
14882
|
-
async function
|
|
14882
|
+
async function Pa(t, e, n, s) {
|
|
14883
14883
|
const i = G(t);
|
|
14884
14884
|
if (i.da)
|
|
14885
14885
|
// If we receive a target state notification via WebStorage, we are
|
|
@@ -15093,9 +15093,9 @@ class Ca {
|
|
|
15093
15093
|
const e = this.Ta.syncEngine;
|
|
15094
15094
|
this.sharedClientState instanceof Bo && (this.sharedClientState.syncEngine = {
|
|
15095
15095
|
$r: Ta.bind(null, e),
|
|
15096
|
-
Br:
|
|
15096
|
+
Br: Pa.bind(null, e),
|
|
15097
15097
|
Lr: Va.bind(null, e),
|
|
15098
|
-
Fs:
|
|
15098
|
+
Fs: ba.bind(null, e),
|
|
15099
15099
|
Fr: Ia.bind(null, e)
|
|
15100
15100
|
}, await this.sharedClientState.start()),
|
|
15101
15101
|
// NOTE: This will immediately call the listener, so we make sure to
|
|
@@ -15309,9 +15309,9 @@ class Oa {
|
|
|
15309
15309
|
* Internal buffer to hold bundle content, accumulating incomplete element
|
|
15310
15310
|
* content.
|
|
15311
15311
|
*/
|
|
15312
|
-
this.buffer = new Uint8Array, this.
|
|
15312
|
+
this.buffer = new Uint8Array, this.ba = new TextDecoder("utf-8"),
|
|
15313
15313
|
// Read the metadata (which is the first element).
|
|
15314
|
-
this.
|
|
15314
|
+
this.Pa().then((t => {
|
|
15315
15315
|
t && t.Mu() ? 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)}`));
|
|
15316
15316
|
}), (t => this.metadata.reject(t)));
|
|
15317
15317
|
}
|
|
@@ -15323,7 +15323,7 @@ class Oa {
|
|
|
15323
15323
|
}
|
|
15324
15324
|
async ma() {
|
|
15325
15325
|
// Makes sure metadata is read before proceeding.
|
|
15326
|
-
return await this.getMetadata(), this.
|
|
15326
|
+
return await this.getMetadata(), this.Pa();
|
|
15327
15327
|
}
|
|
15328
15328
|
/**
|
|
15329
15329
|
* Reads from the head of internal buffer, and pulling more data from
|
|
@@ -15334,10 +15334,10 @@ class Oa {
|
|
|
15334
15334
|
*
|
|
15335
15335
|
* Returns either the bundled element, or null if we have reached the end of
|
|
15336
15336
|
* the stream.
|
|
15337
|
-
*/ async
|
|
15337
|
+
*/ async Pa() {
|
|
15338
15338
|
const t = await this.Va();
|
|
15339
15339
|
if (null === t) return null;
|
|
15340
|
-
const e = this.
|
|
15340
|
+
const e = this.ba.decode(t), n = Number(e);
|
|
15341
15341
|
isNaN(n) && this.va(`length string (${e}) is not valid number`);
|
|
15342
15342
|
const s = await this.Sa(n);
|
|
15343
15343
|
return new Ku(JSON.parse(s), t.length + n);
|
|
@@ -15374,7 +15374,7 @@ class Oa {
|
|
|
15374
15374
|
for (;this.buffer.length < t; ) {
|
|
15375
15375
|
await this.Ca() && this.va("Reached the end of bundle when more is expected.");
|
|
15376
15376
|
}
|
|
15377
|
-
const e = this.
|
|
15377
|
+
const e = this.ba.decode(this.buffer.slice(0, t));
|
|
15378
15378
|
// Update the internal buffer to drop the read json string.
|
|
15379
15379
|
return this.buffer = this.buffer.slice(t), e;
|
|
15380
15380
|
}
|
|
@@ -15503,7 +15503,7 @@ class $a {
|
|
|
15503
15503
|
* as a precondition, or no precondition if it was not read.
|
|
15504
15504
|
*/ precondition(t) {
|
|
15505
15505
|
const e = this.readVersions.get(t.toString());
|
|
15506
|
-
return !this.writtenDocs.has(t.toString()) && e ?
|
|
15506
|
+
return !this.writtenDocs.has(t.toString()) && e ? bn.updateTime(e) : bn.none();
|
|
15507
15507
|
}
|
|
15508
15508
|
/**
|
|
15509
15509
|
* Returns the precondition for a document if the operation is an update.
|
|
@@ -15524,11 +15524,11 @@ class $a {
|
|
|
15524
15524
|
// transaction.
|
|
15525
15525
|
throw new j(Q.INVALID_ARGUMENT, "Can't update a document that doesn't exist.");
|
|
15526
15526
|
// Document exists, base precondition on document update time.
|
|
15527
|
-
return
|
|
15527
|
+
return bn.updateTime(e);
|
|
15528
15528
|
}
|
|
15529
15529
|
// Document was not read, so we just use the preconditions for a blind
|
|
15530
15530
|
// update.
|
|
15531
|
-
return
|
|
15531
|
+
return bn.exists(!0);
|
|
15532
15532
|
}
|
|
15533
15533
|
write(t) {
|
|
15534
15534
|
this.ensureCommitNotCalled(), this.mutations.push(t);
|
|
@@ -15555,11 +15555,10 @@ class $a {
|
|
|
15555
15555
|
/**
|
|
15556
15556
|
* TransactionRunner encapsulates the logic needed to run and retry transactions
|
|
15557
15557
|
* with backoff.
|
|
15558
|
-
*/
|
|
15559
|
-
|
|
15560
|
-
|
|
15561
|
-
this.
|
|
15562
|
-
this.xa = 5, this.No = new Ho(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
|
|
15558
|
+
*/ class Ba {
|
|
15559
|
+
constructor(t, e, n, s, i) {
|
|
15560
|
+
this.asyncQueue = t, this.datastore = e, this.options = n, this.updateFunction = s,
|
|
15561
|
+
this.deferred = i, this.xa = n.maxAttempts, this.No = new Ho(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
|
|
15563
15562
|
}
|
|
15564
15563
|
/** Runs the transaction and sets the result on deferred. */ run() {
|
|
15565
15564
|
this.xa -= 1, this.Na();
|
|
@@ -15705,7 +15704,7 @@ async function qa(t, e) {
|
|
|
15705
15704
|
await e.initialize(n, s),
|
|
15706
15705
|
// The CredentialChangeListener of the online component provider takes
|
|
15707
15706
|
// precedence over the offline component provider.
|
|
15708
|
-
t.setCredentialChangeListener((t =>
|
|
15707
|
+
t.setCredentialChangeListener((t => Pu(e.remoteStore, t))), t.setAppCheckTokenChangeListener(((t, n) => Pu(e.remoteStore, n))),
|
|
15709
15708
|
t.onlineComponents = e;
|
|
15710
15709
|
}
|
|
15711
15710
|
|
|
@@ -15855,13 +15854,13 @@ function ec(t, e, n = {}) {
|
|
|
15855
15854
|
function nc(t, e) {
|
|
15856
15855
|
const n = new Oa(e);
|
|
15857
15856
|
return t.asyncQueue.enqueueAndForget((async () => function(t, e) {
|
|
15858
|
-
G(t).
|
|
15857
|
+
G(t).bu.add(e),
|
|
15859
15858
|
// Immediately fire an initial event, indicating all existing listeners
|
|
15860
15859
|
// are in-sync.
|
|
15861
15860
|
e.next();
|
|
15862
15861
|
}(await Ha(t), n))), () => {
|
|
15863
15862
|
n.Aa(), t.asyncQueue.enqueueAndForget((async () => function(t, e) {
|
|
15864
|
-
G(t).
|
|
15863
|
+
G(t).bu.delete(e);
|
|
15865
15864
|
}(await Ha(t), n)));
|
|
15866
15865
|
};
|
|
15867
15866
|
}
|
|
@@ -15880,14 +15879,14 @@ function nc(t, e) {
|
|
|
15880
15879
|
* accessed with the transaction will not reflect local changes that have not
|
|
15881
15880
|
* been committed. For this reason, it is required that all reads are
|
|
15882
15881
|
* performed before any writes. Transactions must be performed while online.
|
|
15883
|
-
*/ function sc(t, e) {
|
|
15884
|
-
const
|
|
15882
|
+
*/ function sc(t, e, n) {
|
|
15883
|
+
const s = new W;
|
|
15885
15884
|
return t.asyncQueue.enqueueAndForget((async () => {
|
|
15886
|
-
const
|
|
15885
|
+
const i = await function(t) {
|
|
15887
15886
|
return Ga(t).then((t => t.datastore));
|
|
15888
15887
|
}(t);
|
|
15889
|
-
new Ba(t.asyncQueue,
|
|
15890
|
-
})),
|
|
15888
|
+
new Ba(t.asyncQueue, i, n, e, s).run();
|
|
15889
|
+
})), s.promise;
|
|
15891
15890
|
}
|
|
15892
15891
|
|
|
15893
15892
|
function ic(t, e, n, s) {
|
|
@@ -16407,7 +16406,7 @@ function Ec(t, e, ...n) {
|
|
|
16407
16406
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16408
16407
|
* See the License for the specific language governing permissions and
|
|
16409
16408
|
* limitations under the License.
|
|
16410
|
-
*/ class
|
|
16409
|
+
*/ class bc {
|
|
16411
16410
|
constructor() {
|
|
16412
16411
|
// The last promise in the queue.
|
|
16413
16412
|
this.Fa = Promise.resolve(),
|
|
@@ -16436,7 +16435,7 @@ function Ec(t, e, ...n) {
|
|
|
16436
16435
|
// after page comes into foreground.
|
|
16437
16436
|
this.Qa = () => {
|
|
16438
16437
|
const t = Wo();
|
|
16439
|
-
t && F("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.No.
|
|
16438
|
+
t && F("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.No.Po();
|
|
16440
16439
|
};
|
|
16441
16440
|
const t = Wo();
|
|
16442
16441
|
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Qa);
|
|
@@ -16485,7 +16484,7 @@ function Ec(t, e, ...n) {
|
|
|
16485
16484
|
try {
|
|
16486
16485
|
await this.$a[0](), this.$a.shift(), this.No.reset();
|
|
16487
16486
|
} catch (t) {
|
|
16488
|
-
if (!
|
|
16487
|
+
if (!bi(t)) throw t;
|
|
16489
16488
|
// Failure will be handled by AsyncQueue
|
|
16490
16489
|
F("AsyncQueue", "Operation failed with retryable error: " + t);
|
|
16491
16490
|
}
|
|
@@ -16598,7 +16597,7 @@ function Ec(t, e, ...n) {
|
|
|
16598
16597
|
}
|
|
16599
16598
|
}
|
|
16600
16599
|
|
|
16601
|
-
function
|
|
16600
|
+
function Pc(t) {
|
|
16602
16601
|
/**
|
|
16603
16602
|
* Returns true if obj is an object and contains at least one of the specified
|
|
16604
16603
|
* methods.
|
|
@@ -16731,7 +16730,7 @@ class Sc extends wc {
|
|
|
16731
16730
|
/**
|
|
16732
16731
|
* Whether it's a {@link Firestore} or Firestore Lite instance.
|
|
16733
16732
|
*/
|
|
16734
|
-
this.type = "firestore", this._queue = new
|
|
16733
|
+
this.type = "firestore", this._queue = new bc, this._persistenceKey = "name" in t ? t.name : "[DEFAULT]";
|
|
16735
16734
|
}
|
|
16736
16735
|
_terminate() {
|
|
16737
16736
|
return this._firestoreClient ||
|
|
@@ -17911,7 +17910,7 @@ function Ih(t, e, n, s, i) {
|
|
|
17911
17910
|
*/
|
|
17912
17911
|
/**
|
|
17913
17912
|
* Metadata about a snapshot, describing the state of the snapshot.
|
|
17914
|
-
*/ class
|
|
17913
|
+
*/ class bh {
|
|
17915
17914
|
/** @hideconstructor */
|
|
17916
17915
|
constructor(t, e) {
|
|
17917
17916
|
this.hasPendingWrites = t, this.fromCache = e;
|
|
@@ -17934,7 +17933,7 @@ function Ih(t, e, n, s, i) {
|
|
|
17934
17933
|
* For a `DocumentSnapshot` that points to a non-existing document, any data
|
|
17935
17934
|
* access will return 'undefined'. You can use the `exists()` method to
|
|
17936
17935
|
* explicitly verify a document's existence.
|
|
17937
|
-
*/ class
|
|
17936
|
+
*/ class Ph extends Eh {
|
|
17938
17937
|
/** @hideconstructor protected */
|
|
17939
17938
|
constructor(t, e, n, s, i, r) {
|
|
17940
17939
|
super(t, e, n, s, r), this._firestore = t, this._firestoreImpl = t, this.metadata = i;
|
|
@@ -18005,7 +18004,7 @@ function Ih(t, e, n, s, i) {
|
|
|
18005
18004
|
* `DocumentSnapshot`. Since query results contain only existing documents, the
|
|
18006
18005
|
* `exists` property will always be true and `data()` will never return
|
|
18007
18006
|
* 'undefined'.
|
|
18008
|
-
*/ class Vh extends
|
|
18007
|
+
*/ class Vh extends Ph {
|
|
18009
18008
|
/**
|
|
18010
18009
|
* Retrieves all fields in the document as an `Object`.
|
|
18011
18010
|
*
|
|
@@ -18033,7 +18032,7 @@ function Ih(t, e, n, s, i) {
|
|
|
18033
18032
|
*/ class vh {
|
|
18034
18033
|
/** @hideconstructor */
|
|
18035
18034
|
constructor(t, e, n, s) {
|
|
18036
|
-
this._firestore = t, this._userDataWriter = e, this._snapshot = s, this.metadata = new
|
|
18035
|
+
this._firestore = t, this._userDataWriter = e, this._snapshot = s, this.metadata = new bh(s.hasPendingWrites, s.fromCache),
|
|
18037
18036
|
this.query = n;
|
|
18038
18037
|
}
|
|
18039
18038
|
/** An array of all the documents in the `QuerySnapshot`. */ get docs() {
|
|
@@ -18054,7 +18053,7 @@ function Ih(t, e, n, s, i) {
|
|
|
18054
18053
|
* @param thisArg - The `this` binding for the callback.
|
|
18055
18054
|
*/ forEach(t, e) {
|
|
18056
18055
|
this._snapshot.docs.forEach((n => {
|
|
18057
|
-
t.call(e, new Vh(this._firestore, this._userDataWriter, n.key, n, new
|
|
18056
|
+
t.call(e, new Vh(this._firestore, this._userDataWriter, n.key, n, new bh(this._snapshot.mutatedKeys.has(n.key), this._snapshot.fromCache), this.query.converter));
|
|
18058
18057
|
}));
|
|
18059
18058
|
}
|
|
18060
18059
|
/**
|
|
@@ -18075,7 +18074,7 @@ function Ih(t, e, n, s, i) {
|
|
|
18075
18074
|
let e = 0;
|
|
18076
18075
|
return t._snapshot.docChanges.map((n => ({
|
|
18077
18076
|
type: "added",
|
|
18078
|
-
doc: new Vh(t._firestore, t._userDataWriter, n.doc.key, n.doc, new
|
|
18077
|
+
doc: new Vh(t._firestore, t._userDataWriter, n.doc.key, n.doc, new bh(t._snapshot.mutatedKeys.has(n.doc.key), t._snapshot.fromCache), t.query.converter),
|
|
18079
18078
|
oldIndex: -1,
|
|
18080
18079
|
newIndex: e++
|
|
18081
18080
|
})));
|
|
@@ -18085,7 +18084,7 @@ function Ih(t, e, n, s, i) {
|
|
|
18085
18084
|
// to lookup the index of a document.
|
|
18086
18085
|
let n = t._snapshot.oldDocs;
|
|
18087
18086
|
return t._snapshot.docChanges.filter((t => e || 3 /* Metadata */ !== t.type)).map((e => {
|
|
18088
|
-
const s = new Vh(t._firestore, t._userDataWriter, e.doc.key, e.doc, new
|
|
18087
|
+
const s = new Vh(t._firestore, t._userDataWriter, e.doc.key, e.doc, new bh(t._snapshot.mutatedKeys.has(e.doc.key), t._snapshot.fromCache), t.query.converter);
|
|
18089
18088
|
let i = -1, r = -1;
|
|
18090
18089
|
return 0 /* Added */ !== e.type && (i = n.indexOf(e.doc.key), n = n.delete(e.doc.key)),
|
|
18091
18090
|
1 /* Removed */ !== e.type && (n = n.add(e.doc), r = n.indexOf(e.doc.key)), {
|
|
@@ -18126,7 +18125,7 @@ function Sh(t) {
|
|
|
18126
18125
|
* @param right - A snapshot to compare.
|
|
18127
18126
|
* @returns true if the snapshots are equal.
|
|
18128
18127
|
*/ function Dh(t, e) {
|
|
18129
|
-
return t instanceof
|
|
18128
|
+
return t instanceof Ph && e instanceof Ph ? 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 vh && e instanceof vh && (t._firestore === e._firestore && Rc(t.query, e.query) && t.metadata.isEqual(e.metadata) && t._snapshot.isEqual(e._snapshot));
|
|
18130
18129
|
}
|
|
18131
18130
|
|
|
18132
18131
|
/**
|
|
@@ -18399,7 +18398,7 @@ function jh(...t) {
|
|
|
18399
18398
|
// results.
|
|
18400
18399
|
for (const n of Je(t)) if (n.field.isKeyField()) r.push(Gt(e, s.key)); else {
|
|
18401
18400
|
const t = s.data.field(n.field);
|
|
18402
|
-
if (
|
|
18401
|
+
if (Pt(t)) throw new j(Q.INVALID_ARGUMENT, 'Invalid query. You are trying to start or end a query using a document for which the field "' + n.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');
|
|
18403
18402
|
if (null === t) {
|
|
18404
18403
|
const t = n.field.canonicalString();
|
|
18405
18404
|
throw new j(Q.INVALID_ARGUMENT, `Invalid query. You are trying to start or end a query using a document for which the field '${t}' (used as the orderBy) does not exist.`);
|
|
@@ -18466,6 +18465,25 @@ function Jh(t, e, n) {
|
|
|
18466
18465
|
if (!n.isEqual(e)) throw new j(Q.INVALID_ARGUMENT, `Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${e.toString()}' and so you must also use '${e.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${n.toString()}' instead.`);
|
|
18467
18466
|
}
|
|
18468
18467
|
|
|
18468
|
+
/**
|
|
18469
|
+
* @license
|
|
18470
|
+
* Copyright 2022 Google LLC
|
|
18471
|
+
*
|
|
18472
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
18473
|
+
* you may not use this file except in compliance with the License.
|
|
18474
|
+
* You may obtain a copy of the License at
|
|
18475
|
+
*
|
|
18476
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
18477
|
+
*
|
|
18478
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
18479
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
18480
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18481
|
+
* See the License for the specific language governing permissions and
|
|
18482
|
+
* limitations under the License.
|
|
18483
|
+
*/ const Yh = {
|
|
18484
|
+
maxAttempts: 5
|
|
18485
|
+
};
|
|
18486
|
+
|
|
18469
18487
|
/**
|
|
18470
18488
|
* @license
|
|
18471
18489
|
* Copyright 2020 Google LLC
|
|
@@ -18487,7 +18505,8 @@ function Jh(t, e, n) {
|
|
|
18487
18505
|
* to the user.
|
|
18488
18506
|
*
|
|
18489
18507
|
* @internal
|
|
18490
|
-
*/
|
|
18508
|
+
*/
|
|
18509
|
+
class Xh {
|
|
18491
18510
|
convertValue(t, e = "none") {
|
|
18492
18511
|
switch (Ft(t)) {
|
|
18493
18512
|
case 0 /* NullValue */ :
|
|
@@ -18509,7 +18528,7 @@ function Jh(t, e, n) {
|
|
|
18509
18528
|
return t.stringValue;
|
|
18510
18529
|
|
|
18511
18530
|
case 6 /* BlobValue */ :
|
|
18512
|
-
return this.convertBytes(
|
|
18531
|
+
return this.convertBytes(bt(t.bytesValue));
|
|
18513
18532
|
|
|
18514
18533
|
case 7 /* RefValue */ :
|
|
18515
18534
|
return this.convertReference(t.referenceValue);
|
|
@@ -18591,7 +18610,7 @@ function Jh(t, e, n) {
|
|
|
18591
18610
|
* because we want to provide the user with a more specific error message if
|
|
18592
18611
|
* their `set()` or fails due to invalid data originating from a `toFirestore()`
|
|
18593
18612
|
* call.
|
|
18594
|
-
*/ function
|
|
18613
|
+
*/ function Zh(t, e, n) {
|
|
18595
18614
|
let s;
|
|
18596
18615
|
// Cast to `any` in order to satisfy the union type constraint on
|
|
18597
18616
|
// toFirestore().
|
|
@@ -18600,7 +18619,7 @@ function Jh(t, e, n) {
|
|
|
18600
18619
|
s;
|
|
18601
18620
|
}
|
|
18602
18621
|
|
|
18603
|
-
class
|
|
18622
|
+
class tl extends Xh {
|
|
18604
18623
|
constructor(t) {
|
|
18605
18624
|
super(), this.firestore = t;
|
|
18606
18625
|
}
|
|
@@ -18636,7 +18655,7 @@ class Zh extends Yh {
|
|
|
18636
18655
|
* provides methods for adding writes to the write batch. None of the writes
|
|
18637
18656
|
* will be committed (or visible locally) until {@link WriteBatch.commit} is
|
|
18638
18657
|
* called.
|
|
18639
|
-
*/ class
|
|
18658
|
+
*/ class el {
|
|
18640
18659
|
/** @hideconstructor */
|
|
18641
18660
|
constructor(t, e) {
|
|
18642
18661
|
this._firestore = t, this._commitHandler = e, this._mutations = [], this._committed = !1,
|
|
@@ -18644,17 +18663,17 @@ class Zh extends Yh {
|
|
|
18644
18663
|
}
|
|
18645
18664
|
set(t, e, n) {
|
|
18646
18665
|
this._verifyNotCommitted();
|
|
18647
|
-
const s =
|
|
18648
|
-
return this._mutations.push(r.toMutation(s._key,
|
|
18666
|
+
const s = nl(t, this._firestore), i = Zh(s.converter, e, n), r = sh(this._dataReader, "WriteBatch.set", s._key, i, null !== s.converter, n);
|
|
18667
|
+
return this._mutations.push(r.toMutation(s._key, bn.none())), this;
|
|
18649
18668
|
}
|
|
18650
18669
|
update(t, e, n, ...s) {
|
|
18651
18670
|
this._verifyNotCommitted();
|
|
18652
|
-
const i =
|
|
18671
|
+
const i = nl(t, this._firestore);
|
|
18653
18672
|
// For Compat types, we have to "extract" the underlying types before
|
|
18654
18673
|
// performing validation.
|
|
18655
18674
|
let r;
|
|
18656
18675
|
return r = "string" == typeof (e = I(e)) || e instanceof Qc ? lh(this._dataReader, "WriteBatch.update", i._key, e, n, s) : hh(this._dataReader, "WriteBatch.update", i._key, e),
|
|
18657
|
-
this._mutations.push(r.toMutation(i._key,
|
|
18676
|
+
this._mutations.push(r.toMutation(i._key, bn.exists(!0))), this;
|
|
18658
18677
|
}
|
|
18659
18678
|
/**
|
|
18660
18679
|
* Deletes the document referred to by the provided {@link DocumentReference}.
|
|
@@ -18663,8 +18682,8 @@ class Zh extends Yh {
|
|
|
18663
18682
|
* @returns This `WriteBatch` instance. Used for chaining method calls.
|
|
18664
18683
|
*/ delete(t) {
|
|
18665
18684
|
this._verifyNotCommitted();
|
|
18666
|
-
const e =
|
|
18667
|
-
return this._mutations = this._mutations.concat(new $n(e._key,
|
|
18685
|
+
const e = nl(t, this._firestore);
|
|
18686
|
+
return this._mutations = this._mutations.concat(new $n(e._key, bn.none())), this;
|
|
18668
18687
|
}
|
|
18669
18688
|
/**
|
|
18670
18689
|
* Commits all of the writes in this write batch as a single atomic unit.
|
|
@@ -18685,7 +18704,7 @@ class Zh extends Yh {
|
|
|
18685
18704
|
}
|
|
18686
18705
|
}
|
|
18687
18706
|
|
|
18688
|
-
function
|
|
18707
|
+
function nl(t, e) {
|
|
18689
18708
|
if ((t = I(t)).firestore !== e) throw new j(Q.INVALID_ARGUMENT, "Provided document reference is from a different Firestore instance.");
|
|
18690
18709
|
return t;
|
|
18691
18710
|
}
|
|
@@ -18743,13 +18762,13 @@ function el(t, e) {
|
|
|
18743
18762
|
* @returns A Promise resolved with a `DocumentSnapshot` containing the
|
|
18744
18763
|
* current document contents.
|
|
18745
18764
|
*/
|
|
18746
|
-
function
|
|
18765
|
+
function sl(t) {
|
|
18747
18766
|
t = fc(t, gc);
|
|
18748
18767
|
const e = fc(t.firestore, Sc);
|
|
18749
|
-
return Za(xc(e), t._key).then((n =>
|
|
18768
|
+
return Za(xc(e), t._key).then((n => gl(e, t, n)));
|
|
18750
18769
|
}
|
|
18751
18770
|
|
|
18752
|
-
class
|
|
18771
|
+
class il extends Xh {
|
|
18753
18772
|
constructor(t) {
|
|
18754
18773
|
super(), this.firestore = t;
|
|
18755
18774
|
}
|
|
@@ -18768,10 +18787,10 @@ class sl extends Yh {
|
|
|
18768
18787
|
*
|
|
18769
18788
|
* @returns A `Promise` resolved with a `DocumentSnapshot` containing the
|
|
18770
18789
|
* current document contents.
|
|
18771
|
-
*/ function
|
|
18790
|
+
*/ function rl(t) {
|
|
18772
18791
|
t = fc(t, gc);
|
|
18773
|
-
const e = fc(t.firestore, Sc), n = xc(e), s = new
|
|
18774
|
-
return Xa(n, t._key).then((n => new
|
|
18792
|
+
const e = fc(t.firestore, Sc), n = xc(e), s = new il(e);
|
|
18793
|
+
return Xa(n, t._key).then((n => new Ph(e, s, t._key, n, new bh(null !== n && n.hasLocalMutations,
|
|
18775
18794
|
/* fromCache= */ !0), t.converter)));
|
|
18776
18795
|
}
|
|
18777
18796
|
|
|
@@ -18781,12 +18800,12 @@ class sl extends Yh {
|
|
|
18781
18800
|
*
|
|
18782
18801
|
* @returns A `Promise` resolved with a `DocumentSnapshot` containing the
|
|
18783
18802
|
* current document contents.
|
|
18784
|
-
*/ function
|
|
18803
|
+
*/ function ol(t) {
|
|
18785
18804
|
t = fc(t, gc);
|
|
18786
18805
|
const e = fc(t.firestore, Sc);
|
|
18787
18806
|
return Za(xc(e), t._key, {
|
|
18788
18807
|
source: "server"
|
|
18789
|
-
}).then((n =>
|
|
18808
|
+
}).then((n => gl(e, t, n)));
|
|
18790
18809
|
}
|
|
18791
18810
|
|
|
18792
18811
|
/**
|
|
@@ -18798,9 +18817,9 @@ class sl extends Yh {
|
|
|
18798
18817
|
* invoke {@link getDocsFromCache} or {@link getDocsFromServer}.
|
|
18799
18818
|
*
|
|
18800
18819
|
* @returns A `Promise` that will be resolved with the results of the query.
|
|
18801
|
-
*/ function
|
|
18820
|
+
*/ function ul(t) {
|
|
18802
18821
|
t = fc(t, yc);
|
|
18803
|
-
const e = fc(t.firestore, Sc), n = xc(e), s = new
|
|
18822
|
+
const e = fc(t.firestore, Sc), n = xc(e), s = new il(e);
|
|
18804
18823
|
return Ch(t._query), ec(n, t._query).then((n => new vh(e, s, t, n)));
|
|
18805
18824
|
}
|
|
18806
18825
|
|
|
@@ -18809,9 +18828,9 @@ class sl extends Yh {
|
|
|
18809
18828
|
* Returns an error if the document is not currently cached.
|
|
18810
18829
|
*
|
|
18811
18830
|
* @returns A `Promise` that will be resolved with the results of the query.
|
|
18812
|
-
*/ function
|
|
18831
|
+
*/ function al(t) {
|
|
18813
18832
|
t = fc(t, yc);
|
|
18814
|
-
const e = fc(t.firestore, Sc), n = xc(e), s = new
|
|
18833
|
+
const e = fc(t.firestore, Sc), n = xc(e), s = new il(e);
|
|
18815
18834
|
return tc(n, t._query).then((n => new vh(e, s, t, n)));
|
|
18816
18835
|
}
|
|
18817
18836
|
|
|
@@ -18820,21 +18839,21 @@ class sl extends Yh {
|
|
|
18820
18839
|
* server. Returns an error if the network is not available.
|
|
18821
18840
|
*
|
|
18822
18841
|
* @returns A `Promise` that will be resolved with the results of the query.
|
|
18823
|
-
*/ function
|
|
18842
|
+
*/ function cl(t) {
|
|
18824
18843
|
t = fc(t, yc);
|
|
18825
|
-
const e = fc(t.firestore, Sc), n = xc(e), s = new
|
|
18844
|
+
const e = fc(t.firestore, Sc), n = xc(e), s = new il(e);
|
|
18826
18845
|
return ec(n, t._query, {
|
|
18827
18846
|
source: "server"
|
|
18828
18847
|
}).then((n => new vh(e, s, t, n)));
|
|
18829
18848
|
}
|
|
18830
18849
|
|
|
18831
|
-
function
|
|
18850
|
+
function hl(t, e, n) {
|
|
18832
18851
|
t = fc(t, gc);
|
|
18833
|
-
const s = fc(t.firestore, Sc), i =
|
|
18834
|
-
return
|
|
18852
|
+
const s = fc(t.firestore, Sc), i = Zh(t.converter, e, n);
|
|
18853
|
+
return ml(s, [ sh(nh(s), "setDoc", t._key, i, null !== t.converter, n).toMutation(t._key, bn.none()) ]);
|
|
18835
18854
|
}
|
|
18836
18855
|
|
|
18837
|
-
function
|
|
18856
|
+
function ll(t, e, n, ...s) {
|
|
18838
18857
|
t = fc(t, gc);
|
|
18839
18858
|
const i = fc(t.firestore, Sc), r = nh(i);
|
|
18840
18859
|
let o;
|
|
@@ -18842,7 +18861,7 @@ function hl(t, e, n, ...s) {
|
|
|
18842
18861
|
// For Compat types, we have to "extract" the underlying types before
|
|
18843
18862
|
// performing validation.
|
|
18844
18863
|
e = I(e)) || e instanceof Qc ? lh(r, "updateDoc", t._key, e, n, s) : hh(r, "updateDoc", t._key, e);
|
|
18845
|
-
return
|
|
18864
|
+
return ml(i, [ o.toMutation(t._key, bn.exists(!0)) ]);
|
|
18846
18865
|
}
|
|
18847
18866
|
|
|
18848
18867
|
/**
|
|
@@ -18851,8 +18870,8 @@ function hl(t, e, n, ...s) {
|
|
|
18851
18870
|
* @param reference - A reference to the document to delete.
|
|
18852
18871
|
* @returns A Promise resolved once the document has been successfully
|
|
18853
18872
|
* deleted from the backend (note that it won't resolve while you're offline).
|
|
18854
|
-
*/ function
|
|
18855
|
-
return
|
|
18873
|
+
*/ function fl(t) {
|
|
18874
|
+
return ml(fc(t.firestore, Sc), [ new $n(t._key, bn.none()) ]);
|
|
18856
18875
|
}
|
|
18857
18876
|
|
|
18858
18877
|
/**
|
|
@@ -18864,22 +18883,22 @@ function hl(t, e, n, ...s) {
|
|
|
18864
18883
|
* @returns A `Promise` resolved with a `DocumentReference` pointing to the
|
|
18865
18884
|
* newly created document after it has been written to the backend (Note that it
|
|
18866
18885
|
* won't resolve while you're offline).
|
|
18867
|
-
*/ function
|
|
18868
|
-
const n = fc(t.firestore, Sc), s = Ec(t), i =
|
|
18869
|
-
return
|
|
18886
|
+
*/ function dl(t, e) {
|
|
18887
|
+
const n = fc(t.firestore, Sc), s = Ec(t), i = Zh(t.converter, e);
|
|
18888
|
+
return ml(n, [ sh(nh(t.firestore), "addDoc", s._key, i, null !== t.converter, {}).toMutation(s._key, bn.exists(!1)) ]).then((() => s));
|
|
18870
18889
|
}
|
|
18871
18890
|
|
|
18872
|
-
function
|
|
18891
|
+
function _l(t, ...e) {
|
|
18873
18892
|
var n, s, i;
|
|
18874
18893
|
t = I(t);
|
|
18875
18894
|
let r = {
|
|
18876
18895
|
includeMetadataChanges: !1
|
|
18877
18896
|
}, o = 0;
|
|
18878
|
-
"object" != typeof e[o] ||
|
|
18897
|
+
"object" != typeof e[o] || Pc(e[o]) || (r = e[o], o++);
|
|
18879
18898
|
const u = {
|
|
18880
18899
|
includeMetadataChanges: r.includeMetadataChanges
|
|
18881
18900
|
};
|
|
18882
|
-
if (
|
|
18901
|
+
if (Pc(e[o])) {
|
|
18883
18902
|
const t = e[o];
|
|
18884
18903
|
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),
|
|
18885
18904
|
e[o + 2] = null === (i = t.complete) || void 0 === i ? void 0 : i.bind(t);
|
|
@@ -18887,14 +18906,14 @@ function dl(t, ...e) {
|
|
|
18887
18906
|
let a, c, h;
|
|
18888
18907
|
if (t instanceof gc) c = fc(t.firestore, Sc), h = Qe(t._key.path), a = {
|
|
18889
18908
|
next: n => {
|
|
18890
|
-
e[o] && e[o](
|
|
18909
|
+
e[o] && e[o](gl(c, t, n));
|
|
18891
18910
|
},
|
|
18892
18911
|
error: e[o + 1],
|
|
18893
18912
|
complete: e[o + 2]
|
|
18894
18913
|
}; else {
|
|
18895
18914
|
const n = fc(t, yc);
|
|
18896
18915
|
c = fc(n.firestore, Sc), h = n._query;
|
|
18897
|
-
const s = new
|
|
18916
|
+
const s = new il(c);
|
|
18898
18917
|
a = {
|
|
18899
18918
|
next: t => {
|
|
18900
18919
|
e[o] && e[o](new vh(c, s, n, t));
|
|
@@ -18911,8 +18930,8 @@ function dl(t, ...e) {
|
|
|
18911
18930
|
}(xc(c), h, u, a);
|
|
18912
18931
|
}
|
|
18913
18932
|
|
|
18914
|
-
function
|
|
18915
|
-
return nc(xc(t = fc(t, Sc)),
|
|
18933
|
+
function wl(t, e) {
|
|
18934
|
+
return nc(xc(t = fc(t, Sc)), Pc(e) ? e : {
|
|
18916
18935
|
next: e
|
|
18917
18936
|
});
|
|
18918
18937
|
}
|
|
@@ -18920,7 +18939,7 @@ function _l(t, e) {
|
|
|
18920
18939
|
/**
|
|
18921
18940
|
* Locally writes `mutations` on the async queue.
|
|
18922
18941
|
* @internal
|
|
18923
|
-
*/ function
|
|
18942
|
+
*/ function ml(t, e) {
|
|
18924
18943
|
return function(t, e) {
|
|
18925
18944
|
const n = new W;
|
|
18926
18945
|
return t.asyncQueue.enqueueAndForget((async () => na(await za(t), e, n))), n.promise;
|
|
@@ -18930,9 +18949,9 @@ function _l(t, e) {
|
|
|
18930
18949
|
/**
|
|
18931
18950
|
* Converts a {@link ViewSnapshot} that contains the single document specified by `ref`
|
|
18932
18951
|
* to a {@link DocumentSnapshot}.
|
|
18933
|
-
*/ function
|
|
18934
|
-
const s = n.docs.get(e._key), i = new
|
|
18935
|
-
return new
|
|
18952
|
+
*/ function gl(t, e, n) {
|
|
18953
|
+
const s = n.docs.get(e._key), i = new il(t);
|
|
18954
|
+
return new Ph(t, i, e._key, s, new bh(n.hasPendingWrites, n.fromCache), e.converter);
|
|
18936
18955
|
}
|
|
18937
18956
|
|
|
18938
18957
|
/**
|
|
@@ -18957,7 +18976,7 @@ function _l(t, e) {
|
|
|
18957
18976
|
* The `Transaction` object passed to a transaction's `updateFunction` provides
|
|
18958
18977
|
* the methods to read and write data within the transaction context. See
|
|
18959
18978
|
* {@link runTransaction}.
|
|
18960
|
-
*/ class
|
|
18979
|
+
*/ class yl extends class {
|
|
18961
18980
|
/** @hideconstructor */
|
|
18962
18981
|
constructor(t, e) {
|
|
18963
18982
|
this._firestore = t, this._transaction = e, this._dataReader = nh(t);
|
|
@@ -18968,7 +18987,7 @@ function _l(t, e) {
|
|
|
18968
18987
|
* @param documentRef - A reference to the document to be read.
|
|
18969
18988
|
* @returns A `DocumentSnapshot` with the read data.
|
|
18970
18989
|
*/ get(t) {
|
|
18971
|
-
const e =
|
|
18990
|
+
const e = nl(t, this._firestore), n = new tl(this._firestore);
|
|
18972
18991
|
return this._transaction.lookup([ e._key ]).then((t => {
|
|
18973
18992
|
if (!t || 1 !== t.length) return U();
|
|
18974
18993
|
const s = t[0];
|
|
@@ -18978,11 +18997,11 @@ function _l(t, e) {
|
|
|
18978
18997
|
}));
|
|
18979
18998
|
}
|
|
18980
18999
|
set(t, e, n) {
|
|
18981
|
-
const s =
|
|
19000
|
+
const s = nl(t, this._firestore), i = Zh(s.converter, e, n), r = sh(this._dataReader, "Transaction.set", s._key, i, null !== s.converter, n);
|
|
18982
19001
|
return this._transaction.set(s._key, r), this;
|
|
18983
19002
|
}
|
|
18984
19003
|
update(t, e, n, ...s) {
|
|
18985
|
-
const i =
|
|
19004
|
+
const i = nl(t, this._firestore);
|
|
18986
19005
|
// For Compat types, we have to "extract" the underlying types before
|
|
18987
19006
|
// performing validation.
|
|
18988
19007
|
let r;
|
|
@@ -18995,7 +19014,7 @@ function _l(t, e) {
|
|
|
18995
19014
|
* @param documentRef - A reference to the document to be deleted.
|
|
18996
19015
|
* @returns This `Transaction` instance. Used for chaining method calls.
|
|
18997
19016
|
*/ delete(t) {
|
|
18998
|
-
const e =
|
|
19017
|
+
const e = nl(t, this._firestore);
|
|
18999
19018
|
return this._transaction.delete(e._key), this;
|
|
19000
19019
|
}
|
|
19001
19020
|
} {
|
|
@@ -19011,8 +19030,8 @@ function _l(t, e) {
|
|
|
19011
19030
|
* @param documentRef - A reference to the document to be read.
|
|
19012
19031
|
* @returns A `DocumentSnapshot` with the read data.
|
|
19013
19032
|
*/ get(t) {
|
|
19014
|
-
const e =
|
|
19015
|
-
return super.get(t).then((t => new
|
|
19033
|
+
const e = nl(t, this._firestore), n = new il(this._firestore);
|
|
19034
|
+
return super.get(t).then((t => new Ph(this._firestore, n, e._key, t._document, new bh(
|
|
19016
19035
|
/* hasPendingWrites= */ !1,
|
|
19017
19036
|
/* fromCache= */ !1), e.converter)));
|
|
19018
19037
|
}
|
|
@@ -19034,8 +19053,13 @@ function _l(t, e) {
|
|
|
19034
19053
|
* (the `updateFunction` returned a failed promise), the promise returned by the
|
|
19035
19054
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
19036
19055
|
* rejected promise with the corresponding failure error is returned.
|
|
19037
|
-
*/ function
|
|
19038
|
-
|
|
19056
|
+
*/ function pl(t, e, n) {
|
|
19057
|
+
t = fc(t, Sc);
|
|
19058
|
+
const s = Object.assign(Object.assign({}, Yh), n);
|
|
19059
|
+
!function(t) {
|
|
19060
|
+
if (t.maxAttempts < 1) throw new j(Q.INVALID_ARGUMENT, "Max attempts must be at least 1");
|
|
19061
|
+
}(s);
|
|
19062
|
+
return sc(xc(t), (n => e(new yl(t, n))), s);
|
|
19039
19063
|
}
|
|
19040
19064
|
|
|
19041
19065
|
/**
|
|
@@ -19057,14 +19081,14 @@ function _l(t, e) {
|
|
|
19057
19081
|
/**
|
|
19058
19082
|
* Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or
|
|
19059
19083
|
* {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion.
|
|
19060
|
-
*/ function
|
|
19084
|
+
*/ function Il() {
|
|
19061
19085
|
return new ih("deleteField");
|
|
19062
19086
|
}
|
|
19063
19087
|
|
|
19064
19088
|
/**
|
|
19065
19089
|
* Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
|
|
19066
19090
|
* include a server-generated timestamp in the written data.
|
|
19067
|
-
*/ function
|
|
19091
|
+
*/ function Tl() {
|
|
19068
19092
|
return new oh("serverTimestamp");
|
|
19069
19093
|
}
|
|
19070
19094
|
|
|
@@ -19079,7 +19103,7 @@ function _l(t, e) {
|
|
|
19079
19103
|
* @param elements - The elements to union into the array.
|
|
19080
19104
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
19081
19105
|
* `updateDoc()`.
|
|
19082
|
-
*/ function
|
|
19106
|
+
*/ function El(...t) {
|
|
19083
19107
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
19084
19108
|
// update() since we'd need the Firestore instance to do this.
|
|
19085
19109
|
return new uh("arrayUnion", t);
|
|
@@ -19095,7 +19119,7 @@ function _l(t, e) {
|
|
|
19095
19119
|
* @param elements - The elements to remove from the array.
|
|
19096
19120
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
19097
19121
|
* `updateDoc()`
|
|
19098
|
-
*/ function
|
|
19122
|
+
*/ function Al(...t) {
|
|
19099
19123
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
19100
19124
|
// update() since we'd need the Firestore instance to do this.
|
|
19101
19125
|
return new ah("arrayRemove", t);
|
|
@@ -19119,7 +19143,7 @@ function _l(t, e) {
|
|
|
19119
19143
|
* @param n - The value to increment by.
|
|
19120
19144
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
19121
19145
|
* `updateDoc()`
|
|
19122
|
-
*/ function
|
|
19146
|
+
*/ function Rl(t) {
|
|
19123
19147
|
return new ch("increment", t);
|
|
19124
19148
|
}
|
|
19125
19149
|
|
|
@@ -19149,8 +19173,8 @@ function _l(t, e) {
|
|
|
19149
19173
|
*
|
|
19150
19174
|
* @returns A {@link WriteBatch} that can be used to atomically execute multiple
|
|
19151
19175
|
* writes.
|
|
19152
|
-
*/ function
|
|
19153
|
-
return xc(t = fc(t, Sc)), new
|
|
19176
|
+
*/ function bl(t) {
|
|
19177
|
+
return xc(t = fc(t, Sc)), new el(t, (e => ml(t, e)));
|
|
19154
19178
|
}
|
|
19155
19179
|
|
|
19156
19180
|
/**
|
|
@@ -19180,9 +19204,9 @@ function _l(t, e) {
|
|
|
19180
19204
|
// PORTING NOTE: We don't return an error if the user has not enabled
|
|
19181
19205
|
// persistence since `enableIndexeddbPersistence()` can fail on the Web.
|
|
19182
19206
|
if (Array.isArray(n.indexes)) for (const t of n.indexes) {
|
|
19183
|
-
const e =
|
|
19207
|
+
const e = Vl(t, "collectionGroup"), n = [];
|
|
19184
19208
|
if (Array.isArray(t.fields)) for (const e of t.fields) {
|
|
19185
|
-
const t = ph("setIndexConfiguration",
|
|
19209
|
+
const t = ph("setIndexConfiguration", Vl(e, "fieldPath"));
|
|
19186
19210
|
"CONTAINS" === e.arrayConfig ? n.push(new ae(t, 2 /* CONTAINS */)) : "ASCENDING" === e.order ? n.push(new ae(t, 0 /* ASCENDING */)) : "DESCENDING" === e.order && n.push(new ae(t, 1 /* DESCENDING */));
|
|
19187
19211
|
}
|
|
19188
19212
|
s.push(new re(re.UNKNOWN_ID, e, n, ce.empty()));
|
|
@@ -19191,7 +19215,7 @@ function _l(t, e) {
|
|
|
19191
19215
|
return Promise.resolve();
|
|
19192
19216
|
}
|
|
19193
19217
|
|
|
19194
|
-
function
|
|
19218
|
+
function Vl(t, e) {
|
|
19195
19219
|
if ("string" != typeof t[e]) throw new j(Q.INVALID_ARGUMENT, "Missing string value for: " + e);
|
|
19196
19220
|
return t[e];
|
|
19197
19221
|
}
|
|
@@ -19219,10 +19243,10 @@ function bl(t, e) {
|
|
|
19219
19243
|
return n = Object.assign({
|
|
19220
19244
|
useFetchStreams: e
|
|
19221
19245
|
}, n), i._setSettings(n), i;
|
|
19222
|
-
}), "PUBLIC")), s(C, "3.4.8-canary.
|
|
19246
|
+
}), "PUBLIC")), s(C, "3.4.8-canary.6ceff4db0", t),
|
|
19223
19247
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
|
19224
|
-
s(C, "3.4.8-canary.
|
|
19248
|
+
s(C, "3.4.8-canary.6ceff4db0", "esm2017");
|
|
19225
19249
|
}("rn", /* useFetchStreams= */ !1);
|
|
19226
19250
|
|
|
19227
|
-
export {
|
|
19251
|
+
export { Xh as AbstractUserDataWriter, Wc as Bytes, vc as CACHE_SIZE_UNLIMITED, pc as CollectionReference, gc as DocumentReference, Ph as DocumentSnapshot, Qc as FieldPath, zc as FieldValue, Sc as Firestore, j as FirestoreError, Hc as GeoPoint, Vc as LoadBundleTask, yc as Query, xh as QueryConstraint, Vh as QueryDocumentSnapshot, vh as QuerySnapshot, bh as SnapshotMetadata, ct as Timestamp, yl as Transaction, el as WriteBatch, Dt as _DatabaseId, kt as _DocumentKey, nt as _EmptyAppCheckTokenProvider, H as _EmptyAuthCredentialsProvider, gt as _FieldPath, fc as _cast, K as _debugAssert, It as _isBase64Available, B as _logWarn, Pl as _setIndexConfiguration, ac as _validateIsNotUsedTogether, dl as addDoc, Al as arrayRemove, El as arrayUnion, Fc as clearIndexedDbPersistence, Ic as collection, Tc as collectionGroup, mc as connectFirestoreEmulator, fl as deleteDoc, Il as deleteField, Lc as disableNetwork, Ec as doc, jc as documentId, kc as enableIndexedDbPersistence, Mc as enableMultiTabIndexedDbPersistence, Bc as enableNetwork, jh as endAt, Qh as endBefore, xc as ensureFirestoreConfigured, ml as executeWrite, sl as getDoc, rl as getDocFromCache, ol as getDocFromServer, ul as getDocs, al as getDocsFromCache, cl as getDocsFromServer, Cc as getFirestore, Rl as increment, Dc as initializeFirestore, Bh as limit, Lh as limitToLast, qc as loadBundle, Kc as namedQuery, _l as onSnapshot, wl as onSnapshotsInSync, Fh as orderBy, Nh as query, Rc as queryEqual, Ac as refEqual, pl as runTransaction, Tl as serverTimestamp, hl as setDoc, O as setLogLevel, Dh as snapshotEqual, Kh as startAfter, qh as startAt, Uc as terminate, ll as updateDoc, $c as waitForPendingWrites, Mh as where, bl as writeBatch };
|
|
19228
19252
|
//# sourceMappingURL=index.rn.js.map
|