@firebase/firestore 3.4.9-canary.412ff6e2a → 3.4.9-canary.8454f41b4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm2017.js +3 -3
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +3 -3
- package/dist/index.node.cjs.js +2 -2
- package/dist/index.node.mjs +2 -2
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +157 -157
- package/dist/lite/index.browser.esm2017.js +2 -2
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +2 -2
- package/dist/lite/index.node.cjs.js +2 -2
- package/dist/lite/index.node.mjs +2 -2
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +84 -84
- package/package.json +9 -9
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.8.1-canary.
|
|
73
|
+
let N = "9.8.1-canary.8454f41b4";
|
|
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);
|
|
@@ -15704,7 +15704,7 @@ async function qa(t, e) {
|
|
|
15704
15704
|
await e.initialize(n, s),
|
|
15705
15705
|
// The CredentialChangeListener of the online component provider takes
|
|
15706
15706
|
// precedence over the offline component provider.
|
|
15707
|
-
t.setCredentialChangeListener((t =>
|
|
15707
|
+
t.setCredentialChangeListener((t => Pu(e.remoteStore, t))), t.setAppCheckTokenChangeListener(((t, n) => Pu(e.remoteStore, n))),
|
|
15708
15708
|
t.onlineComponents = e;
|
|
15709
15709
|
}
|
|
15710
15710
|
|
|
@@ -15854,13 +15854,13 @@ function ec(t, e, n = {}) {
|
|
|
15854
15854
|
function nc(t, e) {
|
|
15855
15855
|
const n = new Oa(e);
|
|
15856
15856
|
return t.asyncQueue.enqueueAndForget((async () => function(t, e) {
|
|
15857
|
-
G(t).
|
|
15857
|
+
G(t).bu.add(e),
|
|
15858
15858
|
// Immediately fire an initial event, indicating all existing listeners
|
|
15859
15859
|
// are in-sync.
|
|
15860
15860
|
e.next();
|
|
15861
15861
|
}(await Ha(t), n))), () => {
|
|
15862
15862
|
n.Aa(), t.asyncQueue.enqueueAndForget((async () => function(t, e) {
|
|
15863
|
-
G(t).
|
|
15863
|
+
G(t).bu.delete(e);
|
|
15864
15864
|
}(await Ha(t), n)));
|
|
15865
15865
|
};
|
|
15866
15866
|
}
|
|
@@ -16406,7 +16406,7 @@ function Ec(t, e, ...n) {
|
|
|
16406
16406
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16407
16407
|
* See the License for the specific language governing permissions and
|
|
16408
16408
|
* limitations under the License.
|
|
16409
|
-
*/ class
|
|
16409
|
+
*/ class bc {
|
|
16410
16410
|
constructor() {
|
|
16411
16411
|
// The last promise in the queue.
|
|
16412
16412
|
this.Fa = Promise.resolve(),
|
|
@@ -16435,7 +16435,7 @@ function Ec(t, e, ...n) {
|
|
|
16435
16435
|
// after page comes into foreground.
|
|
16436
16436
|
this.Qa = () => {
|
|
16437
16437
|
const t = Wo();
|
|
16438
|
-
t && F("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.No.
|
|
16438
|
+
t && F("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.No.Po();
|
|
16439
16439
|
};
|
|
16440
16440
|
const t = Wo();
|
|
16441
16441
|
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Qa);
|
|
@@ -16484,7 +16484,7 @@ function Ec(t, e, ...n) {
|
|
|
16484
16484
|
try {
|
|
16485
16485
|
await this.$a[0](), this.$a.shift(), this.No.reset();
|
|
16486
16486
|
} catch (t) {
|
|
16487
|
-
if (!
|
|
16487
|
+
if (!bi(t)) throw t;
|
|
16488
16488
|
// Failure will be handled by AsyncQueue
|
|
16489
16489
|
F("AsyncQueue", "Operation failed with retryable error: " + t);
|
|
16490
16490
|
}
|
|
@@ -16597,7 +16597,7 @@ function Ec(t, e, ...n) {
|
|
|
16597
16597
|
}
|
|
16598
16598
|
}
|
|
16599
16599
|
|
|
16600
|
-
function
|
|
16600
|
+
function Pc(t) {
|
|
16601
16601
|
/**
|
|
16602
16602
|
* Returns true if obj is an object and contains at least one of the specified
|
|
16603
16603
|
* methods.
|
|
@@ -16730,7 +16730,7 @@ class Sc extends wc {
|
|
|
16730
16730
|
/**
|
|
16731
16731
|
* Whether it's a {@link Firestore} or Firestore Lite instance.
|
|
16732
16732
|
*/
|
|
16733
|
-
this.type = "firestore", this._queue = new
|
|
16733
|
+
this.type = "firestore", this._queue = new bc, this._persistenceKey = "name" in t ? t.name : "[DEFAULT]";
|
|
16734
16734
|
}
|
|
16735
16735
|
_terminate() {
|
|
16736
16736
|
return this._firestoreClient ||
|
|
@@ -17910,7 +17910,7 @@ function Ih(t, e, n, s, i) {
|
|
|
17910
17910
|
*/
|
|
17911
17911
|
/**
|
|
17912
17912
|
* Metadata about a snapshot, describing the state of the snapshot.
|
|
17913
|
-
*/ class
|
|
17913
|
+
*/ class bh {
|
|
17914
17914
|
/** @hideconstructor */
|
|
17915
17915
|
constructor(t, e) {
|
|
17916
17916
|
this.hasPendingWrites = t, this.fromCache = e;
|
|
@@ -17933,7 +17933,7 @@ function Ih(t, e, n, s, i) {
|
|
|
17933
17933
|
* For a `DocumentSnapshot` that points to a non-existing document, any data
|
|
17934
17934
|
* access will return 'undefined'. You can use the `exists()` method to
|
|
17935
17935
|
* explicitly verify a document's existence.
|
|
17936
|
-
*/ class
|
|
17936
|
+
*/ class Ph extends Eh {
|
|
17937
17937
|
/** @hideconstructor protected */
|
|
17938
17938
|
constructor(t, e, n, s, i, r) {
|
|
17939
17939
|
super(t, e, n, s, r), this._firestore = t, this._firestoreImpl = t, this.metadata = i;
|
|
@@ -18004,7 +18004,7 @@ function Ih(t, e, n, s, i) {
|
|
|
18004
18004
|
* `DocumentSnapshot`. Since query results contain only existing documents, the
|
|
18005
18005
|
* `exists` property will always be true and `data()` will never return
|
|
18006
18006
|
* 'undefined'.
|
|
18007
|
-
*/ class Vh extends
|
|
18007
|
+
*/ class Vh extends Ph {
|
|
18008
18008
|
/**
|
|
18009
18009
|
* Retrieves all fields in the document as an `Object`.
|
|
18010
18010
|
*
|
|
@@ -18032,7 +18032,7 @@ function Ih(t, e, n, s, i) {
|
|
|
18032
18032
|
*/ class vh {
|
|
18033
18033
|
/** @hideconstructor */
|
|
18034
18034
|
constructor(t, e, n, s) {
|
|
18035
|
-
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),
|
|
18036
18036
|
this.query = n;
|
|
18037
18037
|
}
|
|
18038
18038
|
/** An array of all the documents in the `QuerySnapshot`. */ get docs() {
|
|
@@ -18053,7 +18053,7 @@ function Ih(t, e, n, s, i) {
|
|
|
18053
18053
|
* @param thisArg - The `this` binding for the callback.
|
|
18054
18054
|
*/ forEach(t, e) {
|
|
18055
18055
|
this._snapshot.docs.forEach((n => {
|
|
18056
|
-
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));
|
|
18057
18057
|
}));
|
|
18058
18058
|
}
|
|
18059
18059
|
/**
|
|
@@ -18074,7 +18074,7 @@ function Ih(t, e, n, s, i) {
|
|
|
18074
18074
|
let e = 0;
|
|
18075
18075
|
return t._snapshot.docChanges.map((n => ({
|
|
18076
18076
|
type: "added",
|
|
18077
|
-
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),
|
|
18078
18078
|
oldIndex: -1,
|
|
18079
18079
|
newIndex: e++
|
|
18080
18080
|
})));
|
|
@@ -18084,7 +18084,7 @@ function Ih(t, e, n, s, i) {
|
|
|
18084
18084
|
// to lookup the index of a document.
|
|
18085
18085
|
let n = t._snapshot.oldDocs;
|
|
18086
18086
|
return t._snapshot.docChanges.filter((t => e || 3 /* Metadata */ !== t.type)).map((e => {
|
|
18087
|
-
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);
|
|
18088
18088
|
let i = -1, r = -1;
|
|
18089
18089
|
return 0 /* Added */ !== e.type && (i = n.indexOf(e.doc.key), n = n.delete(e.doc.key)),
|
|
18090
18090
|
1 /* Removed */ !== e.type && (n = n.add(e.doc), r = n.indexOf(e.doc.key)), {
|
|
@@ -18125,7 +18125,7 @@ function Sh(t) {
|
|
|
18125
18125
|
* @param right - A snapshot to compare.
|
|
18126
18126
|
* @returns true if the snapshots are equal.
|
|
18127
18127
|
*/ function Dh(t, e) {
|
|
18128
|
-
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));
|
|
18129
18129
|
}
|
|
18130
18130
|
|
|
18131
18131
|
/**
|
|
@@ -18398,7 +18398,7 @@ function jh(...t) {
|
|
|
18398
18398
|
// results.
|
|
18399
18399
|
for (const n of Je(t)) if (n.field.isKeyField()) r.push(Gt(e, s.key)); else {
|
|
18400
18400
|
const t = s.data.field(n.field);
|
|
18401
|
-
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.)');
|
|
18402
18402
|
if (null === t) {
|
|
18403
18403
|
const t = n.field.canonicalString();
|
|
18404
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.`);
|
|
@@ -18528,7 +18528,7 @@ class Xh {
|
|
|
18528
18528
|
return t.stringValue;
|
|
18529
18529
|
|
|
18530
18530
|
case 6 /* BlobValue */ :
|
|
18531
|
-
return this.convertBytes(
|
|
18531
|
+
return this.convertBytes(bt(t.bytesValue));
|
|
18532
18532
|
|
|
18533
18533
|
case 7 /* RefValue */ :
|
|
18534
18534
|
return this.convertReference(t.referenceValue);
|
|
@@ -18664,7 +18664,7 @@ class tl extends Xh {
|
|
|
18664
18664
|
set(t, e, n) {
|
|
18665
18665
|
this._verifyNotCommitted();
|
|
18666
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,
|
|
18667
|
+
return this._mutations.push(r.toMutation(s._key, bn.none())), this;
|
|
18668
18668
|
}
|
|
18669
18669
|
update(t, e, n, ...s) {
|
|
18670
18670
|
this._verifyNotCommitted();
|
|
@@ -18673,7 +18673,7 @@ class tl extends Xh {
|
|
|
18673
18673
|
// performing validation.
|
|
18674
18674
|
let r;
|
|
18675
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),
|
|
18676
|
-
this._mutations.push(r.toMutation(i._key,
|
|
18676
|
+
this._mutations.push(r.toMutation(i._key, bn.exists(!0))), this;
|
|
18677
18677
|
}
|
|
18678
18678
|
/**
|
|
18679
18679
|
* Deletes the document referred to by the provided {@link DocumentReference}.
|
|
@@ -18683,7 +18683,7 @@ class tl extends Xh {
|
|
|
18683
18683
|
*/ delete(t) {
|
|
18684
18684
|
this._verifyNotCommitted();
|
|
18685
18685
|
const e = nl(t, this._firestore);
|
|
18686
|
-
return this._mutations = this._mutations.concat(new $n(e._key,
|
|
18686
|
+
return this._mutations = this._mutations.concat(new $n(e._key, bn.none())), this;
|
|
18687
18687
|
}
|
|
18688
18688
|
/**
|
|
18689
18689
|
* Commits all of the writes in this write batch as a single atomic unit.
|
|
@@ -18790,7 +18790,7 @@ class il extends Xh {
|
|
|
18790
18790
|
*/ function rl(t) {
|
|
18791
18791
|
t = fc(t, gc);
|
|
18792
18792
|
const e = fc(t.firestore, Sc), n = xc(e), s = new il(e);
|
|
18793
|
-
return Xa(n, t._key).then((n => new
|
|
18793
|
+
return Xa(n, t._key).then((n => new Ph(e, s, t._key, n, new bh(null !== n && n.hasLocalMutations,
|
|
18794
18794
|
/* fromCache= */ !0), t.converter)));
|
|
18795
18795
|
}
|
|
18796
18796
|
|
|
@@ -18850,7 +18850,7 @@ class il extends Xh {
|
|
|
18850
18850
|
function hl(t, e, n) {
|
|
18851
18851
|
t = fc(t, gc);
|
|
18852
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,
|
|
18853
|
+
return ml(s, [ sh(nh(s), "setDoc", t._key, i, null !== t.converter, n).toMutation(t._key, bn.none()) ]);
|
|
18854
18854
|
}
|
|
18855
18855
|
|
|
18856
18856
|
function ll(t, e, n, ...s) {
|
|
@@ -18861,7 +18861,7 @@ function ll(t, e, n, ...s) {
|
|
|
18861
18861
|
// For Compat types, we have to "extract" the underlying types before
|
|
18862
18862
|
// performing validation.
|
|
18863
18863
|
e = I(e)) || e instanceof Qc ? lh(r, "updateDoc", t._key, e, n, s) : hh(r, "updateDoc", t._key, e);
|
|
18864
|
-
return ml(i, [ o.toMutation(t._key,
|
|
18864
|
+
return ml(i, [ o.toMutation(t._key, bn.exists(!0)) ]);
|
|
18865
18865
|
}
|
|
18866
18866
|
|
|
18867
18867
|
/**
|
|
@@ -18871,7 +18871,7 @@ function ll(t, e, n, ...s) {
|
|
|
18871
18871
|
* @returns A Promise resolved once the document has been successfully
|
|
18872
18872
|
* deleted from the backend (note that it won't resolve while you're offline).
|
|
18873
18873
|
*/ function fl(t) {
|
|
18874
|
-
return ml(fc(t.firestore, Sc), [ new $n(t._key,
|
|
18874
|
+
return ml(fc(t.firestore, Sc), [ new $n(t._key, bn.none()) ]);
|
|
18875
18875
|
}
|
|
18876
18876
|
|
|
18877
18877
|
/**
|
|
@@ -18885,7 +18885,7 @@ function ll(t, e, n, ...s) {
|
|
|
18885
18885
|
* won't resolve while you're offline).
|
|
18886
18886
|
*/ function dl(t, e) {
|
|
18887
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,
|
|
18888
|
+
return ml(n, [ sh(nh(t.firestore), "addDoc", s._key, i, null !== t.converter, {}).toMutation(s._key, bn.exists(!1)) ]).then((() => s));
|
|
18889
18889
|
}
|
|
18890
18890
|
|
|
18891
18891
|
function _l(t, ...e) {
|
|
@@ -18894,11 +18894,11 @@ function _l(t, ...e) {
|
|
|
18894
18894
|
let r = {
|
|
18895
18895
|
includeMetadataChanges: !1
|
|
18896
18896
|
}, o = 0;
|
|
18897
|
-
"object" != typeof e[o] ||
|
|
18897
|
+
"object" != typeof e[o] || Pc(e[o]) || (r = e[o], o++);
|
|
18898
18898
|
const u = {
|
|
18899
18899
|
includeMetadataChanges: r.includeMetadataChanges
|
|
18900
18900
|
};
|
|
18901
|
-
if (
|
|
18901
|
+
if (Pc(e[o])) {
|
|
18902
18902
|
const t = e[o];
|
|
18903
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),
|
|
18904
18904
|
e[o + 2] = null === (i = t.complete) || void 0 === i ? void 0 : i.bind(t);
|
|
@@ -18931,7 +18931,7 @@ function _l(t, ...e) {
|
|
|
18931
18931
|
}
|
|
18932
18932
|
|
|
18933
18933
|
function wl(t, e) {
|
|
18934
|
-
return nc(xc(t = fc(t, Sc)),
|
|
18934
|
+
return nc(xc(t = fc(t, Sc)), Pc(e) ? e : {
|
|
18935
18935
|
next: e
|
|
18936
18936
|
});
|
|
18937
18937
|
}
|
|
@@ -18951,7 +18951,7 @@ function wl(t, e) {
|
|
|
18951
18951
|
* to a {@link DocumentSnapshot}.
|
|
18952
18952
|
*/ function gl(t, e, n) {
|
|
18953
18953
|
const s = n.docs.get(e._key), i = new il(t);
|
|
18954
|
-
return new
|
|
18954
|
+
return new Ph(t, i, e._key, s, new bh(n.hasPendingWrites, n.fromCache), e.converter);
|
|
18955
18955
|
}
|
|
18956
18956
|
|
|
18957
18957
|
/**
|
|
@@ -19031,7 +19031,7 @@ function wl(t, e) {
|
|
|
19031
19031
|
* @returns A `DocumentSnapshot` with the read data.
|
|
19032
19032
|
*/ get(t) {
|
|
19033
19033
|
const e = nl(t, this._firestore), n = new il(this._firestore);
|
|
19034
|
-
return super.get(t).then((t => new
|
|
19034
|
+
return super.get(t).then((t => new Ph(this._firestore, n, e._key, t._document, new bh(
|
|
19035
19035
|
/* hasPendingWrites= */ !1,
|
|
19036
19036
|
/* fromCache= */ !1), e.converter)));
|
|
19037
19037
|
}
|
|
@@ -19173,7 +19173,7 @@ function wl(t, e) {
|
|
|
19173
19173
|
*
|
|
19174
19174
|
* @returns A {@link WriteBatch} that can be used to atomically execute multiple
|
|
19175
19175
|
* writes.
|
|
19176
|
-
*/ function
|
|
19176
|
+
*/ function bl(t) {
|
|
19177
19177
|
return xc(t = fc(t, Sc)), new el(t, (e => ml(t, e)));
|
|
19178
19178
|
}
|
|
19179
19179
|
|
|
@@ -19192,7 +19192,7 @@ function wl(t, e) {
|
|
|
19192
19192
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19193
19193
|
* See the License for the specific language governing permissions and
|
|
19194
19194
|
* limitations under the License.
|
|
19195
|
-
*/ function
|
|
19195
|
+
*/ function Pl(t, e) {
|
|
19196
19196
|
xc(t = fc(t, Sc));
|
|
19197
19197
|
const n = "string" == typeof e ? function(t) {
|
|
19198
19198
|
try {
|
|
@@ -19243,10 +19243,10 @@ function Vl(t, e) {
|
|
|
19243
19243
|
return n = Object.assign({
|
|
19244
19244
|
useFetchStreams: e
|
|
19245
19245
|
}, n), i._setSettings(n), i;
|
|
19246
|
-
}), "PUBLIC")), s(C, "3.4.9-canary.
|
|
19246
|
+
}), "PUBLIC")), s(C, "3.4.9-canary.8454f41b4", t),
|
|
19247
19247
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
|
19248
|
-
s(C, "3.4.9-canary.
|
|
19248
|
+
s(C, "3.4.9-canary.8454f41b4", "esm2017");
|
|
19249
19249
|
}("rn", /* useFetchStreams= */ !1);
|
|
19250
19250
|
|
|
19251
|
-
export { Xh as AbstractUserDataWriter, Wc as Bytes, vc as CACHE_SIZE_UNLIMITED, pc as CollectionReference, gc as DocumentReference,
|
|
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 };
|
|
19252
19252
|
//# sourceMappingURL=index.rn.js.map
|