@firebase/firestore 3.3.1-canary.dc6b447ba → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/index.esm2017.js +154 -154
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +63 -63
- package/dist/index.esm5.js.map +1 -1
- 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 +170 -170
- package/dist/index.rn.js.map +1 -1
- 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.browser.esm5.js.map +1 -1
- 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 +59 -59
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/packages/firestore/dist/index.esm2017.d.ts +21 -21
- package/package.json +9 -9
package/dist/index.rn.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Logger as o, LogLevel as c } from "@firebase/logger";
|
|
|
6
6
|
|
|
7
7
|
import { base64 as a, getUA as u, isIndexedDBAvailable as h, isSafari as l, isMobileCordova as f, isReactNative as d, isElectron as w, isIE as _, isUWP as m, isBrowserExtension as g, createMockUserToken as y, getModularInstance as p, deepEqual as T } from "@firebase/util";
|
|
8
8
|
|
|
9
|
-
import { XhrIo as E, EventType as I, ErrorCode as A, createWebChannelTransport as R, getStatEventTarget as
|
|
9
|
+
import { XhrIo as E, EventType as I, ErrorCode as A, createWebChannelTransport as R, getStatEventTarget as P, FetchXmlHttpFactory as b, WebChannel as v, Event as V, Stat as S } from "@firebase/webchannel-wrapper";
|
|
10
10
|
|
|
11
11
|
const D = "@firebase/firestore";
|
|
12
12
|
|
|
@@ -70,7 +70,7 @@ C.MOCK_USER = new C("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.
|
|
73
|
+
let N = "9.6.0";
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* @license
|
|
@@ -1404,7 +1404,7 @@ const Et = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1404
1404
|
* FieldValueOptions to value().
|
|
1405
1405
|
* - With respect to other ServerTimestampValues, they sort by their
|
|
1406
1406
|
* localWriteTime.
|
|
1407
|
-
*/ function
|
|
1407
|
+
*/ function Pt(t) {
|
|
1408
1408
|
var e, n;
|
|
1409
1409
|
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);
|
|
1410
1410
|
}
|
|
@@ -1418,9 +1418,9 @@ const Et = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1418
1418
|
* Preserving the previous values allows the user to display the last resoled
|
|
1419
1419
|
* value until the backend responds with the timestamp.
|
|
1420
1420
|
*/
|
|
1421
|
-
function
|
|
1421
|
+
function bt(t) {
|
|
1422
1422
|
const e = t.mapValue.fields.__previous_value__;
|
|
1423
|
-
return
|
|
1423
|
+
return Pt(e) ? bt(e) : e;
|
|
1424
1424
|
}
|
|
1425
1425
|
|
|
1426
1426
|
/**
|
|
@@ -1537,7 +1537,7 @@ function Vt(t) {
|
|
|
1537
1537
|
* limitations under the License.
|
|
1538
1538
|
*/
|
|
1539
1539
|
/** Extracts the backend's type order for the provided value. */ function Nt(t) {
|
|
1540
|
-
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 ?
|
|
1540
|
+
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 */ : 10 /* ObjectValue */ : B();
|
|
1541
1541
|
}
|
|
1542
1542
|
|
|
1543
1543
|
/** Tests `left` and `right` for equality based on the backend semantics. */ function kt(t, e) {
|
|
@@ -2376,7 +2376,7 @@ function Re(t) {
|
|
|
2376
2376
|
* Returns the implicit order by constraint that is used to execute the Query,
|
|
2377
2377
|
* which can be different from the order by constraints the user provided (e.g.
|
|
2378
2378
|
* the SDK and backend always orders by `__name__`).
|
|
2379
|
-
*/ function
|
|
2379
|
+
*/ function Pe(t) {
|
|
2380
2380
|
const e = K(t);
|
|
2381
2381
|
if (null === e.S) {
|
|
2382
2382
|
e.S = [];
|
|
@@ -2401,12 +2401,12 @@ function Re(t) {
|
|
|
2401
2401
|
|
|
2402
2402
|
/**
|
|
2403
2403
|
* Converts this `Query` instance to it's corresponding `Target` representation.
|
|
2404
|
-
*/ function
|
|
2404
|
+
*/ function be(t) {
|
|
2405
2405
|
const e = K(t);
|
|
2406
|
-
if (!e.D) if ("F" /* First */ === e.limitType) e.D = Jt(e.path, e.collectionGroup,
|
|
2406
|
+
if (!e.D) if ("F" /* First */ === e.limitType) e.D = Jt(e.path, e.collectionGroup, Pe(e), e.filters, e.limit, e.startAt, e.endAt); else {
|
|
2407
2407
|
// Flip the orderBy directions since we want the last results
|
|
2408
2408
|
const t = [];
|
|
2409
|
-
for (const n of
|
|
2409
|
+
for (const n of Pe(e)) {
|
|
2410
2410
|
const e = "desc" /* DESCENDING */ === n.dir ? "asc" /* ASCENDING */ : "desc" /* DESCENDING */;
|
|
2411
2411
|
t.push(new de(n.field, e));
|
|
2412
2412
|
}
|
|
@@ -2423,18 +2423,18 @@ function ve(t, e, n) {
|
|
|
2423
2423
|
}
|
|
2424
2424
|
|
|
2425
2425
|
function Ve(t, e) {
|
|
2426
|
-
return Zt(
|
|
2426
|
+
return Zt(be(t), be(e)) && t.limitType === e.limitType;
|
|
2427
2427
|
}
|
|
2428
2428
|
|
|
2429
2429
|
// TODO(b/29183165): This is used to get a unique string from a query to, for
|
|
2430
2430
|
// example, use as a dictionary key, but the implementation is subject to
|
|
2431
2431
|
// collisions. Make it collision-free.
|
|
2432
2432
|
function Se(t) {
|
|
2433
|
-
return `${Yt(
|
|
2433
|
+
return `${Yt(be(t))}|lt:${t.limitType}`;
|
|
2434
2434
|
}
|
|
2435
2435
|
|
|
2436
2436
|
function De(t) {
|
|
2437
|
-
return `Query(target=${Xt(
|
|
2437
|
+
return `Query(target=${Xt(be(t))}; limitType=${t.limitType})`;
|
|
2438
2438
|
}
|
|
2439
2439
|
|
|
2440
2440
|
/** Returns whether `doc` matches the constraints of `query`. */ function Ce(t, e) {
|
|
@@ -2455,8 +2455,8 @@ function De(t) {
|
|
|
2455
2455
|
return !0;
|
|
2456
2456
|
}
|
|
2457
2457
|
/** Makes sure a document is within the bounds, if provided. */ (t, e) && function(t, e) {
|
|
2458
|
-
if (t.startAt && !_e(t.startAt,
|
|
2459
|
-
if (t.endAt && _e(t.endAt,
|
|
2458
|
+
if (t.startAt && !_e(t.startAt, Pe(t), e)) return !1;
|
|
2459
|
+
if (t.endAt && _e(t.endAt, Pe(t), e)) return !1;
|
|
2460
2460
|
return !0;
|
|
2461
2461
|
}
|
|
2462
2462
|
/**
|
|
@@ -2468,7 +2468,7 @@ function De(t) {
|
|
|
2468
2468
|
function Ne(t) {
|
|
2469
2469
|
return (e, n) => {
|
|
2470
2470
|
let s = !1;
|
|
2471
|
-
for (const i of
|
|
2471
|
+
for (const i of Pe(t)) {
|
|
2472
2472
|
const t = ke(i, e, n);
|
|
2473
2473
|
if (0 !== t) return t;
|
|
2474
2474
|
s = s || i.field.isKeyField();
|
|
@@ -3680,14 +3680,14 @@ class An {
|
|
|
3680
3680
|
* limitations under the License.
|
|
3681
3681
|
*/ const Rn = new pn(Ct.comparator);
|
|
3682
3682
|
|
|
3683
|
-
function
|
|
3683
|
+
function Pn() {
|
|
3684
3684
|
return Rn;
|
|
3685
3685
|
}
|
|
3686
3686
|
|
|
3687
|
-
const
|
|
3687
|
+
const bn = new pn(Ct.comparator);
|
|
3688
3688
|
|
|
3689
3689
|
function vn() {
|
|
3690
|
-
return
|
|
3690
|
+
return bn;
|
|
3691
3691
|
}
|
|
3692
3692
|
|
|
3693
3693
|
const Vn = new pn(Ct.comparator);
|
|
@@ -3766,7 +3766,7 @@ function kn() {
|
|
|
3766
3766
|
// PORTING NOTE: Multi-tab only
|
|
3767
3767
|
static createSynthesizedRemoteEventForCurrentChange(t, e) {
|
|
3768
3768
|
const n = new Map;
|
|
3769
|
-
return n.set(t, $n.createSynthesizedTargetChangeForCurrentChange(t, e)), new xn(ut.min(), n, kn(),
|
|
3769
|
+
return n.set(t, $n.createSynthesizedTargetChangeForCurrentChange(t, e)), new xn(ut.min(), n, kn(), Pn(), Cn());
|
|
3770
3770
|
}
|
|
3771
3771
|
}
|
|
3772
3772
|
|
|
@@ -3986,7 +3986,7 @@ class Bn {
|
|
|
3986
3986
|
/** The internal state of all tracked targets. */
|
|
3987
3987
|
this.nt = new Map,
|
|
3988
3988
|
/** Keeps track of the documents to update since the last raised snapshot. */
|
|
3989
|
-
this.st =
|
|
3989
|
+
this.st = Pn(),
|
|
3990
3990
|
/** A mapping of document keys to their set of target IDs. */
|
|
3991
3991
|
this.it = Un(),
|
|
3992
3992
|
/**
|
|
@@ -4116,7 +4116,7 @@ class Bn {
|
|
|
4116
4116
|
})), s && (n = n.add(t));
|
|
4117
4117
|
}));
|
|
4118
4118
|
const s = new xn(t, e, this.rt, this.st, n);
|
|
4119
|
-
return this.st =
|
|
4119
|
+
return this.st = Pn(), this.it = Un(), this.rt = new In(rt), s;
|
|
4120
4120
|
}
|
|
4121
4121
|
/**
|
|
4122
4122
|
* Adds the provided document to the internal list of document updates and
|
|
@@ -4310,7 +4310,7 @@ function Jn(t, e) {
|
|
|
4310
4310
|
|
|
4311
4311
|
function Yn(t) {
|
|
4312
4312
|
const e = wt.fromString(t);
|
|
4313
|
-
return U(
|
|
4313
|
+
return U(Ps(e)), e;
|
|
4314
4314
|
}
|
|
4315
4315
|
|
|
4316
4316
|
function Xn(t, e) {
|
|
@@ -4803,7 +4803,7 @@ function Rs(t) {
|
|
|
4803
4803
|
};
|
|
4804
4804
|
}
|
|
4805
4805
|
|
|
4806
|
-
function
|
|
4806
|
+
function Ps(t) {
|
|
4807
4807
|
// Resource names have at least 4 components (project ID, database ID)
|
|
4808
4808
|
return t.length >= 4 && "projects" === t.get(0) && "databases" === t.get(2);
|
|
4809
4809
|
}
|
|
@@ -4827,7 +4827,7 @@ function bs(t) {
|
|
|
4827
4827
|
/**
|
|
4828
4828
|
* Encodes a resource path into a IndexedDb-compatible string form.
|
|
4829
4829
|
*/
|
|
4830
|
-
function
|
|
4830
|
+
function bs(t) {
|
|
4831
4831
|
let e = "";
|
|
4832
4832
|
for (let n = 0; n < t.length; n++) e.length > 0 && (e = Vs(e)), e = vs(t.get(n), e);
|
|
4833
4833
|
return Vs(e);
|
|
@@ -5091,13 +5091,13 @@ class xs {
|
|
|
5091
5091
|
* Creates a [userId, encodedPath] key for use in the DbDocumentMutations
|
|
5092
5092
|
* index to iterate over all at document mutations for a given path or lower.
|
|
5093
5093
|
*/ static prefixForPath(t, e) {
|
|
5094
|
-
return [ t,
|
|
5094
|
+
return [ t, bs(e) ];
|
|
5095
5095
|
}
|
|
5096
5096
|
/**
|
|
5097
5097
|
* Creates a full index key of [userId, encodedPath, batchId] for inserting
|
|
5098
5098
|
* and deleting into the DbDocumentMutations index.
|
|
5099
5099
|
*/ static key(t, e, n) {
|
|
5100
|
-
return [ t,
|
|
5100
|
+
return [ t, bs(e), n ];
|
|
5101
5101
|
}
|
|
5102
5102
|
}
|
|
5103
5103
|
|
|
@@ -5708,12 +5708,12 @@ class Js {
|
|
|
5708
5708
|
// bug we're checking for should exist in iOS >= 12.2 and < 13, but for
|
|
5709
5709
|
// whatever reason it's much harder to hit after 12.2 so we only proactively
|
|
5710
5710
|
// log on 12.2.
|
|
5711
|
-
12.2 === Ys.
|
|
5711
|
+
12.2 === Ys.Pt(u()) && O("Firestore persistence suffers from a bug in iOS 12.2 Safari that may cause your app to stop working. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.");
|
|
5712
5712
|
}
|
|
5713
5713
|
/** Deletes the specified database. */ static delete(t) {
|
|
5714
5714
|
return F("SimpleDb", "Removing database:", t), ni(window.indexedDB.deleteDatabase(t)).toPromise();
|
|
5715
5715
|
}
|
|
5716
|
-
/** Returns true if IndexedDB is available in the current environment. */ static
|
|
5716
|
+
/** Returns true if IndexedDB is available in the current environment. */ static bt() {
|
|
5717
5717
|
if (!h()) return !1;
|
|
5718
5718
|
if (Ys.vt()) return !0;
|
|
5719
5719
|
// We extensively use indexed array values and compound keys,
|
|
@@ -5723,7 +5723,7 @@ class Js {
|
|
|
5723
5723
|
// For tracking support of this feature, see here:
|
|
5724
5724
|
// https://developer.microsoft.com/en-us/microsoft-edge/platform/status/indexeddbarraysandmultientrysupport/
|
|
5725
5725
|
// Check the UA string to find out the browser.
|
|
5726
|
-
const t = u(), e = Ys.
|
|
5726
|
+
const t = u(), e = Ys.Pt(t), n = 0 < e && e < 10, s = Ys.Vt(t), i = 0 < s && s < 4.5;
|
|
5727
5727
|
// IE 10
|
|
5728
5728
|
// ua = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)';
|
|
5729
5729
|
// IE 11
|
|
@@ -5746,7 +5746,7 @@ class Js {
|
|
|
5746
5746
|
}
|
|
5747
5747
|
// visible for testing
|
|
5748
5748
|
/** Parse User Agent to determine iOS version. Returns -1 if not found. */
|
|
5749
|
-
static
|
|
5749
|
+
static Pt(t) {
|
|
5750
5750
|
const e = t.match(/i(?:phone|pad|pod) os ([\d_]+)/i), n = e ? e[1].split("_").slice(0, 2).join(".") : "-1";
|
|
5751
5751
|
return Number(n);
|
|
5752
5752
|
}
|
|
@@ -6016,7 +6016,7 @@ class Js {
|
|
|
6016
6016
|
let si = !1;
|
|
6017
6017
|
|
|
6018
6018
|
function ii(t) {
|
|
6019
|
-
const e = Ys.
|
|
6019
|
+
const e = Ys.Pt(u());
|
|
6020
6020
|
if (e >= 12.2 && e < 13) {
|
|
6021
6021
|
const e = "An internal error was encountered in the Indexed Database server";
|
|
6022
6022
|
if (t.message.indexOf(e) >= 0) {
|
|
@@ -6341,8 +6341,8 @@ function gi(t, e) {
|
|
|
6341
6341
|
let s;
|
|
6342
6342
|
var i;
|
|
6343
6343
|
return void 0 !== t.query.documents ? (U(1 === (i = t.query).documents.length),
|
|
6344
|
-
s =
|
|
6345
|
-
return
|
|
6344
|
+
s = be(pe(es(i.documents[0])))) : s = function(t) {
|
|
6345
|
+
return be(ds(t));
|
|
6346
6346
|
}(t.query), new ui(s, t.targetId, 0 /* Listen */ , t.lastListenSequenceNumber, e, n, Tt.fromBase64String(t.resumeToken));
|
|
6347
6347
|
}
|
|
6348
6348
|
|
|
@@ -6464,7 +6464,7 @@ class Ei {
|
|
|
6464
6464
|
* An in-memory implementation of IndexManager.
|
|
6465
6465
|
*/ class Ri {
|
|
6466
6466
|
constructor() {
|
|
6467
|
-
this.zt = new
|
|
6467
|
+
this.zt = new Pi;
|
|
6468
6468
|
}
|
|
6469
6469
|
addToCollectionParentIndex(t, e) {
|
|
6470
6470
|
return this.zt.add(e), Hs.resolve();
|
|
@@ -6478,7 +6478,7 @@ class Ei {
|
|
|
6478
6478
|
* Internal implementation of the collection-parent index exposed by MemoryIndexManager.
|
|
6479
6479
|
* Also used for in-memory caching by IndexedDbIndexManager and initial index population
|
|
6480
6480
|
* in indexeddb_schema.ts
|
|
6481
|
-
*/ class
|
|
6481
|
+
*/ class Pi {
|
|
6482
6482
|
constructor() {
|
|
6483
6483
|
this.index = {};
|
|
6484
6484
|
}
|
|
@@ -6514,7 +6514,7 @@ class Ei {
|
|
|
6514
6514
|
*/
|
|
6515
6515
|
/**
|
|
6516
6516
|
* A persisted implementation of IndexManager.
|
|
6517
|
-
*/ class
|
|
6517
|
+
*/ class bi {
|
|
6518
6518
|
constructor() {
|
|
6519
6519
|
/**
|
|
6520
6520
|
* An in-memory copy of the index entries we've already written since the SDK
|
|
@@ -6523,7 +6523,7 @@ class Ei {
|
|
|
6523
6523
|
* This is *NOT* a complete cache of what's in persistence and so can never be used to
|
|
6524
6524
|
* satisfy reads.
|
|
6525
6525
|
*/
|
|
6526
|
-
this.Ht = new
|
|
6526
|
+
this.Ht = new Pi;
|
|
6527
6527
|
}
|
|
6528
6528
|
/**
|
|
6529
6529
|
* Adds a new entry to the collection parent index.
|
|
@@ -6541,7 +6541,7 @@ class Ei {
|
|
|
6541
6541
|
}));
|
|
6542
6542
|
const i = {
|
|
6543
6543
|
collectionId: n,
|
|
6544
|
-
parent:
|
|
6544
|
+
parent: bs(s)
|
|
6545
6545
|
};
|
|
6546
6546
|
return vi(t).put(i);
|
|
6547
6547
|
}
|
|
@@ -7118,7 +7118,7 @@ class Oi {
|
|
|
7118
7118
|
// IndexedDb.
|
|
7119
7119
|
const s = [], i = Ui(t);
|
|
7120
7120
|
return e.forEach((e => {
|
|
7121
|
-
const r =
|
|
7121
|
+
const r = bs(e.path);
|
|
7122
7122
|
s.push(i.put(new Bs(n, r))), s.push(this.referenceDelegate.addReference(t, n, e));
|
|
7123
7123
|
})), Hs.waitFor(s);
|
|
7124
7124
|
}
|
|
@@ -7127,7 +7127,7 @@ class Oi {
|
|
|
7127
7127
|
// IndexedDb.
|
|
7128
7128
|
const s = Ui(t);
|
|
7129
7129
|
return Hs.forEach(e, (e => {
|
|
7130
|
-
const i =
|
|
7130
|
+
const i = bs(e.path);
|
|
7131
7131
|
return Hs.waitFor([ s.delete([ n, i ]), this.referenceDelegate.removeReference(t, n, e) ]);
|
|
7132
7132
|
}));
|
|
7133
7133
|
}
|
|
@@ -7151,7 +7151,7 @@ class Oi {
|
|
|
7151
7151
|
})).next((() => i));
|
|
7152
7152
|
}
|
|
7153
7153
|
containsKey(t, e) {
|
|
7154
|
-
const n =
|
|
7154
|
+
const n = bs(e.path), s = IDBKeyRange.bound([ n ], [ ct(n) ],
|
|
7155
7155
|
/*lowerOpen=*/ !1,
|
|
7156
7156
|
/*upperOpen=*/ !0);
|
|
7157
7157
|
let i = 0;
|
|
@@ -7425,7 +7425,7 @@ class Gi {
|
|
|
7425
7425
|
if (!e)
|
|
7426
7426
|
// Our size accounting requires us to read all documents before
|
|
7427
7427
|
// removing them.
|
|
7428
|
-
return i++, n.getEntry(t, r).next((() => (n.removeEntry(r), Ui(t).delete([ 0,
|
|
7428
|
+
return i++, n.getEntry(t, r).next((() => (n.removeEntry(r), Ui(t).delete([ 0, bs(r.path) ]))));
|
|
7429
7429
|
}));
|
|
7430
7430
|
s.push(e);
|
|
7431
7431
|
}
|
|
@@ -7480,7 +7480,7 @@ function zi(t, e) {
|
|
|
7480
7480
|
* store.
|
|
7481
7481
|
*/
|
|
7482
7482
|
function(t, e) {
|
|
7483
|
-
return new Bs(0,
|
|
7483
|
+
return new Bs(0, bs(t.path), e);
|
|
7484
7484
|
}(e, t.currentSequenceNumber));
|
|
7485
7485
|
}
|
|
7486
7486
|
|
|
@@ -7699,23 +7699,23 @@ function zi(t, e) {
|
|
|
7699
7699
|
return this.getMetadata(t).next((n => (n.byteSize += e, this.Re(t, n))));
|
|
7700
7700
|
}
|
|
7701
7701
|
getEntry(t, e) {
|
|
7702
|
-
return tr(t).get(er(e)).next((t => this.
|
|
7702
|
+
return tr(t).get(er(e)).next((t => this.Pe(e, t)));
|
|
7703
7703
|
}
|
|
7704
7704
|
/**
|
|
7705
7705
|
* Looks up an entry in the cache.
|
|
7706
7706
|
*
|
|
7707
7707
|
* @param documentKey - The key of the entry to look up.
|
|
7708
7708
|
* @returns The cached document entry and its size.
|
|
7709
|
-
*/
|
|
7709
|
+
*/ be(t, e) {
|
|
7710
7710
|
return tr(t).get(er(e)).next((t => ({
|
|
7711
|
-
document: this.
|
|
7711
|
+
document: this.Pe(e, t),
|
|
7712
7712
|
size: Ci(t)
|
|
7713
7713
|
})));
|
|
7714
7714
|
}
|
|
7715
7715
|
getEntries(t, e) {
|
|
7716
|
-
let n =
|
|
7716
|
+
let n = Pn();
|
|
7717
7717
|
return this.ve(t, e, ((t, e) => {
|
|
7718
|
-
const s = this.
|
|
7718
|
+
const s = this.Pe(t, e);
|
|
7719
7719
|
n = n.insert(t, s);
|
|
7720
7720
|
})).next((() => n));
|
|
7721
7721
|
}
|
|
@@ -7726,9 +7726,9 @@ function zi(t, e) {
|
|
|
7726
7726
|
* @returns A map of documents indexed by key and a map of sizes indexed by
|
|
7727
7727
|
* key (zero if the document does not exist).
|
|
7728
7728
|
*/ Ve(t, e) {
|
|
7729
|
-
let n =
|
|
7729
|
+
let n = Pn(), s = new pn(Ct.comparator);
|
|
7730
7730
|
return this.ve(t, e, ((t, e) => {
|
|
7731
|
-
const i = this.
|
|
7731
|
+
const i = this.Pe(t, e);
|
|
7732
7732
|
n = n.insert(t, i), s = s.insert(t, Ci(e));
|
|
7733
7733
|
})).next((() => ({
|
|
7734
7734
|
documents: n,
|
|
@@ -7757,7 +7757,7 @@ function zi(t, e) {
|
|
|
7757
7757
|
}));
|
|
7758
7758
|
}
|
|
7759
7759
|
getDocumentsMatchingQuery(t, e, n) {
|
|
7760
|
-
let s =
|
|
7760
|
+
let s = Pn();
|
|
7761
7761
|
const i = e.path.length + 1, r = {};
|
|
7762
7762
|
if (n.isEqual(ut.min())) {
|
|
7763
7763
|
// Documents are ordered by key, so we can use a prefix scan to narrow
|
|
@@ -7798,7 +7798,7 @@ function zi(t, e) {
|
|
|
7798
7798
|
/**
|
|
7799
7799
|
* Decodes `remoteDoc` and returns the document (or null, if the document
|
|
7800
7800
|
* corresponds to the format used for sentinel deletes).
|
|
7801
|
-
*/
|
|
7801
|
+
*/ Pe(t, e) {
|
|
7802
7802
|
if (e) {
|
|
7803
7803
|
const t = li(this.k, e);
|
|
7804
7804
|
// Whether the document is a sentinel removal and should only be used in the
|
|
@@ -7857,7 +7857,7 @@ class Xi extends Ji {
|
|
|
7857
7857
|
}
|
|
7858
7858
|
getFromCache(t, e) {
|
|
7859
7859
|
// Record the size of everything we load from the cache so we can compute a delta later.
|
|
7860
|
-
return this.De.
|
|
7860
|
+
return this.De.be(t, e).next((t => (this.Ce.set(e, t.size), t.document)));
|
|
7861
7861
|
}
|
|
7862
7862
|
getAllFromCache(t, e) {
|
|
7863
7863
|
// Record the size of everything we load from the cache so we can compute
|
|
@@ -8057,9 +8057,9 @@ function er(t) {
|
|
|
8057
8057
|
const s = [];
|
|
8058
8058
|
return n.jt(((n, i) => {
|
|
8059
8059
|
const r = new wt(n), o = function(t) {
|
|
8060
|
-
return [ 0,
|
|
8060
|
+
return [ 0, bs(t) ];
|
|
8061
8061
|
}(r);
|
|
8062
|
-
s.push(e.get(o).next((n => n ? Hs.resolve() : (n => e.put(new Bs(0,
|
|
8062
|
+
s.push(e.get(o).next((n => n ? Hs.resolve() : (n => e.put(new Bs(0, bs(n), t.highestListenSequenceNumber)))(r))));
|
|
8063
8063
|
})).next((() => Hs.waitFor(s)));
|
|
8064
8064
|
}));
|
|
8065
8065
|
}
|
|
@@ -8068,12 +8068,12 @@ function er(t) {
|
|
|
8068
8068
|
t.createObjectStore(qs.store, {
|
|
8069
8069
|
keyPath: qs.keyPath
|
|
8070
8070
|
});
|
|
8071
|
-
const n = e.store(qs.store), s = new
|
|
8071
|
+
const n = e.store(qs.store), s = new Pi, i = t => {
|
|
8072
8072
|
if (s.add(t)) {
|
|
8073
8073
|
const e = t.lastSegment(), s = t.popLast();
|
|
8074
8074
|
return n.put({
|
|
8075
8075
|
collectionId: e,
|
|
8076
|
-
parent:
|
|
8076
|
+
parent: bs(s)
|
|
8077
8077
|
});
|
|
8078
8078
|
}
|
|
8079
8079
|
};
|
|
@@ -8190,10 +8190,10 @@ class rr {
|
|
|
8190
8190
|
/** The last time we garbage collected the client metadata object store. */
|
|
8191
8191
|
this.Qe = Number.NEGATIVE_INFINITY,
|
|
8192
8192
|
/** A listener to notify on primary state changes. */
|
|
8193
|
-
this.We = t => Promise.resolve(), !rr.
|
|
8193
|
+
this.We = t => Promise.resolve(), !rr.bt()) throw new Q(j.UNIMPLEMENTED, "This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");
|
|
8194
8194
|
this.referenceDelegate = new Gi(this, s), this.Ge = e + "main", this.k = new hi(c),
|
|
8195
8195
|
this.ze = new Ys(this.Ge, 11, new nr(this.k)), this.He = new Mi(this.referenceDelegate, this.k),
|
|
8196
|
-
this.Jt = new
|
|
8196
|
+
this.Jt = new bi, this.Je = function(t, e) {
|
|
8197
8197
|
return new Yi(t, e);
|
|
8198
8198
|
}
|
|
8199
8199
|
/**
|
|
@@ -8446,8 +8446,8 @@ class rr {
|
|
|
8446
8446
|
const e = new Cs(this.clientId, this.allowTabSynchronization, Date.now());
|
|
8447
8447
|
return or(t).put(Cs.key, e);
|
|
8448
8448
|
}
|
|
8449
|
-
static
|
|
8450
|
-
return Ys.
|
|
8449
|
+
static bt() {
|
|
8450
|
+
return Ys.bt();
|
|
8451
8451
|
}
|
|
8452
8452
|
/** Checks the primary lease and removes it if we are the current primary. */ cn(t) {
|
|
8453
8453
|
const e = or(t);
|
|
@@ -8610,9 +8610,9 @@ class ur {
|
|
|
8610
8610
|
* @returns Local view of the document or null if we don't have any cached
|
|
8611
8611
|
* state for it.
|
|
8612
8612
|
*/ Rn(t, e) {
|
|
8613
|
-
return this.An.getAllMutationBatchesAffectingDocumentKey(t, e).next((n => this.
|
|
8613
|
+
return this.An.getAllMutationBatchesAffectingDocumentKey(t, e).next((n => this.Pn(t, e, n)));
|
|
8614
8614
|
}
|
|
8615
|
-
/** Internal version of `getDocument` that allows reusing batches. */
|
|
8615
|
+
/** Internal version of `getDocument` that allows reusing batches. */ Pn(t, e, n) {
|
|
8616
8616
|
return this.Je.getEntry(t, e).next((t => {
|
|
8617
8617
|
for (const e of n) e.applyToLocalView(t);
|
|
8618
8618
|
return t;
|
|
@@ -8620,7 +8620,7 @@ class ur {
|
|
|
8620
8620
|
}
|
|
8621
8621
|
// Returns the view of the given `docs` as they would appear after applying
|
|
8622
8622
|
// all mutations in the given `batches`.
|
|
8623
|
-
|
|
8623
|
+
bn(t, e) {
|
|
8624
8624
|
t.forEach(((t, n) => {
|
|
8625
8625
|
for (const t of e) t.applyToLocalView(n);
|
|
8626
8626
|
}));
|
|
@@ -8637,7 +8637,7 @@ class ur {
|
|
|
8637
8637
|
* Applies the local view the given `baseDocs` without retrieving documents
|
|
8638
8638
|
* from the local store.
|
|
8639
8639
|
*/ Vn(t, e) {
|
|
8640
|
-
return this.An.getAllMutationBatchesAffectingDocumentKeys(t, e).next((t => this.
|
|
8640
|
+
return this.An.getAllMutationBatchesAffectingDocumentKeys(t, e).next((t => this.bn(e, t)));
|
|
8641
8641
|
}
|
|
8642
8642
|
/**
|
|
8643
8643
|
* Performs a query against the local view of all documents.
|
|
@@ -9067,7 +9067,7 @@ function gr(t) {
|
|
|
9067
9067
|
*/ (c, u, e) && o.push(n.He.updateTargetData(t, u));
|
|
9068
9068
|
}
|
|
9069
9069
|
}));
|
|
9070
|
-
let c =
|
|
9070
|
+
let c = Pn();
|
|
9071
9071
|
// HACK: The only reason we allow a null snapshot version is so that we
|
|
9072
9072
|
// can synthesize remote events when we get permission denied errors while
|
|
9073
9073
|
// trying to resolve the state of a locally cached document that is in
|
|
@@ -9108,7 +9108,7 @@ function gr(t) {
|
|
|
9108
9108
|
i) {
|
|
9109
9109
|
let r = Cn();
|
|
9110
9110
|
return n.forEach((t => r = r.add(t))), e.getEntries(t, r).next((t => {
|
|
9111
|
-
let r =
|
|
9111
|
+
let r = Pn();
|
|
9112
9112
|
return n.forEach(((n, o) => {
|
|
9113
9113
|
const c = t.get(n), a = (null == i ? void 0 : i.get(n)) || s;
|
|
9114
9114
|
// Note: The order of the steps below is important, since we want
|
|
@@ -9210,7 +9210,7 @@ async function Ir(t, e, n) {
|
|
|
9210
9210
|
return s.persistence.runTransaction("Execute query", "readonly", (t => function(t, e, n) {
|
|
9211
9211
|
const s = K(t), i = s.Kn.get(n);
|
|
9212
9212
|
return void 0 !== i ? Hs.resolve(s.qn.get(i)) : s.He.getTargetData(e, n);
|
|
9213
|
-
}(s, t,
|
|
9213
|
+
}(s, t, be(e)).next((e => {
|
|
9214
9214
|
if (e) return i = e.lastLimboFreeSnapshotVersion, s.He.getMatchingKeysForTargetId(t, e.targetId).next((t => {
|
|
9215
9215
|
r = t;
|
|
9216
9216
|
}));
|
|
@@ -9233,11 +9233,11 @@ function Rr(t, e) {
|
|
|
9233
9233
|
* since the prior call.
|
|
9234
9234
|
*/
|
|
9235
9235
|
// PORTING NOTE: Multi-Tab only.
|
|
9236
|
-
function
|
|
9236
|
+
function Pr(t) {
|
|
9237
9237
|
const e = K(t);
|
|
9238
9238
|
return e.persistence.runTransaction("Get new document changes", "readonly", (t => function(t, e, n) {
|
|
9239
9239
|
const s = K(t);
|
|
9240
|
-
let i =
|
|
9240
|
+
let i = Pn(), r = di(n);
|
|
9241
9241
|
const o = tr(e), c = IDBKeyRange.lowerBound(r, !0);
|
|
9242
9242
|
return o.jt({
|
|
9243
9243
|
index: Os.readTimeIndex,
|
|
@@ -9266,7 +9266,7 @@ function br(t) {
|
|
|
9266
9266
|
* only return changes that happened after client initialization.
|
|
9267
9267
|
*/
|
|
9268
9268
|
// PORTING NOTE: Multi-Tab only.
|
|
9269
|
-
async function
|
|
9269
|
+
async function br(t) {
|
|
9270
9270
|
const e = K(t);
|
|
9271
9271
|
return e.persistence.runTransaction("Synchronize last document change read time", "readonly", (t => function(t) {
|
|
9272
9272
|
const e = tr(t);
|
|
@@ -9298,7 +9298,7 @@ async function Pr(t) {
|
|
|
9298
9298
|
*/
|
|
9299
9299
|
async function vr(t, e, n, s) {
|
|
9300
9300
|
const i = K(t);
|
|
9301
|
-
let r = Cn(), o =
|
|
9301
|
+
let r = Cn(), o = Pn(), c = Sn();
|
|
9302
9302
|
for (const t of n) {
|
|
9303
9303
|
const n = e.Hn(t.metadata.name);
|
|
9304
9304
|
t.document && (r = r.add(n)), o = o.insert(n, e.Jn(t)), c = c.insert(n, e.Yn(t.metadata.readTime));
|
|
@@ -9308,7 +9308,7 @@ async function vr(t, e, n, s) {
|
|
|
9308
9308
|
}), u = await Er(i, function(t) {
|
|
9309
9309
|
// It is OK that the path used for the query is not valid, because this will
|
|
9310
9310
|
// not be read and queried.
|
|
9311
|
-
return
|
|
9311
|
+
return be(pe(wt.fromString(`__bundle__/docs/${t}`)));
|
|
9312
9312
|
}(s));
|
|
9313
9313
|
// Allocates a target to hold all document keys from the bundle, such that
|
|
9314
9314
|
// they will not get garbage collected right away.
|
|
@@ -9329,7 +9329,7 @@ async function Vr(t, e, n = Cn()) {
|
|
|
9329
9329
|
// NOTE: this also means if no corresponding target exists, the new target
|
|
9330
9330
|
// will remain active and will not get collected, unless users happen to
|
|
9331
9331
|
// unlisten the query somehow.
|
|
9332
|
-
const s = await Er(t,
|
|
9332
|
+
const s = await Er(t, be(Ti(e.bundledQuery))), i = K(t);
|
|
9333
9333
|
return i.persistence.runTransaction("Save named query", "readwrite", (t => {
|
|
9334
9334
|
const r = Hn(e.readTime);
|
|
9335
9335
|
// Simply save the query itself if it is older than what the SDK already
|
|
@@ -9705,14 +9705,14 @@ class kr {
|
|
|
9705
9705
|
return Hs.resolve(n ? n.document.clone() : zt.newInvalidDocument(e));
|
|
9706
9706
|
}
|
|
9707
9707
|
getEntries(t, e) {
|
|
9708
|
-
let n =
|
|
9708
|
+
let n = Pn();
|
|
9709
9709
|
return e.forEach((t => {
|
|
9710
9710
|
const e = this.docs.get(t);
|
|
9711
9711
|
n = n.insert(t, e ? e.document.clone() : zt.newInvalidDocument(t));
|
|
9712
9712
|
})), Hs.resolve(n);
|
|
9713
9713
|
}
|
|
9714
9714
|
getDocumentsMatchingQuery(t, e, n) {
|
|
9715
|
-
let s =
|
|
9715
|
+
let s = Pn();
|
|
9716
9716
|
// Documents are ordered by key, so we can use a prefix scan to narrow down
|
|
9717
9717
|
// the documents we need to match the query against.
|
|
9718
9718
|
const i = new Ct(e.path.child("")), r = this.docs.getIteratorFrom(i);
|
|
@@ -9797,7 +9797,7 @@ class xr extends Ji {
|
|
|
9797
9797
|
* A ordered bidirectional mapping between documents and the remote target
|
|
9798
9798
|
* IDs.
|
|
9799
9799
|
*/
|
|
9800
|
-
this.Rs = new Dr, this.targetCount = 0, this.
|
|
9800
|
+
this.Rs = new Dr, this.targetCount = 0, this.Ps = Oi.ie();
|
|
9801
9801
|
}
|
|
9802
9802
|
forEachTarget(t, e) {
|
|
9803
9803
|
return this.Is.forEach(((t, n) => e(n))), Hs.resolve();
|
|
@@ -9809,7 +9809,7 @@ class xr extends Ji {
|
|
|
9809
9809
|
return Hs.resolve(this.As);
|
|
9810
9810
|
}
|
|
9811
9811
|
allocateTargetId(t) {
|
|
9812
|
-
return this.highestTargetId = this.
|
|
9812
|
+
return this.highestTargetId = this.Ps.next(), Hs.resolve(this.highestTargetId);
|
|
9813
9813
|
}
|
|
9814
9814
|
setTargetsMetadata(t, e, n) {
|
|
9815
9815
|
return n && (this.lastRemoteSnapshotVersion = n), e > this.As && (this.As = e),
|
|
@@ -9818,7 +9818,7 @@ class xr extends Ji {
|
|
|
9818
9818
|
ae(t) {
|
|
9819
9819
|
this.Is.set(t.target, t);
|
|
9820
9820
|
const e = t.targetId;
|
|
9821
|
-
e > this.highestTargetId && (this.
|
|
9821
|
+
e > this.highestTargetId && (this.Ps = new Oi(e), this.highestTargetId = e), t.sequenceNumber > this.As && (this.As = t.sequenceNumber);
|
|
9822
9822
|
}
|
|
9823
9823
|
addTargetData(t, e) {
|
|
9824
9824
|
return this.ae(e), this.targetCount += 1, Hs.resolve();
|
|
@@ -9895,7 +9895,7 @@ class Fr {
|
|
|
9895
9895
|
* checked or asserted on every access.
|
|
9896
9896
|
*/
|
|
9897
9897
|
constructor(t, e) {
|
|
9898
|
-
this.
|
|
9898
|
+
this.bs = {}, this.Be = new nt(0), this.Ue = !1, this.Ue = !0, this.referenceDelegate = t(this),
|
|
9899
9899
|
this.He = new $r(this);
|
|
9900
9900
|
this.Jt = new Ri, this.Je = function(t, e) {
|
|
9901
9901
|
return new kr(t, e);
|
|
@@ -9921,8 +9921,8 @@ class Fr {
|
|
|
9921
9921
|
return this.Jt;
|
|
9922
9922
|
}
|
|
9923
9923
|
getMutationQueue(t) {
|
|
9924
|
-
let e = this.
|
|
9925
|
-
return e || (e = new Nr(this.Jt, this.referenceDelegate), this.
|
|
9924
|
+
let e = this.bs[t.toKey()];
|
|
9925
|
+
return e || (e = new Nr(this.Jt, this.referenceDelegate), this.bs[t.toKey()] = e),
|
|
9926
9926
|
e;
|
|
9927
9927
|
}
|
|
9928
9928
|
getTargetCache() {
|
|
@@ -9941,7 +9941,7 @@ class Fr {
|
|
|
9941
9941
|
t)));
|
|
9942
9942
|
}
|
|
9943
9943
|
Ds(t, e) {
|
|
9944
|
-
return Hs.or(Object.values(this.
|
|
9944
|
+
return Hs.or(Object.values(this.bs).map((n => () => n.containsKey(t, e))));
|
|
9945
9945
|
}
|
|
9946
9946
|
}
|
|
9947
9947
|
|
|
@@ -10254,7 +10254,7 @@ class Wr {
|
|
|
10254
10254
|
// mutations but before we observe WebStorage events.
|
|
10255
10255
|
this.window.addEventListener("storage", this.Us);
|
|
10256
10256
|
}
|
|
10257
|
-
/** Returns 'true' if WebStorage is available in the current environment. */ static
|
|
10257
|
+
/** Returns 'true' if WebStorage is available in the current environment. */ static bt(t) {
|
|
10258
10258
|
return !(!t || !t.localStorage);
|
|
10259
10259
|
}
|
|
10260
10260
|
async start() {
|
|
@@ -10600,10 +10600,10 @@ class zr {
|
|
|
10600
10600
|
*/
|
|
10601
10601
|
class Jr {
|
|
10602
10602
|
constructor() {
|
|
10603
|
-
this.Ii = () => this.Ai(), this.Ri = () => this.
|
|
10603
|
+
this.Ii = () => this.Ai(), this.Ri = () => this.Pi(), this.bi = [], this.vi();
|
|
10604
10604
|
}
|
|
10605
10605
|
Ei(t) {
|
|
10606
|
-
this.
|
|
10606
|
+
this.bi.push(t);
|
|
10607
10607
|
}
|
|
10608
10608
|
shutdown() {
|
|
10609
10609
|
window.removeEventListener("online", this.Ii), window.removeEventListener("offline", this.Ri);
|
|
@@ -10613,16 +10613,16 @@ class Jr {
|
|
|
10613
10613
|
}
|
|
10614
10614
|
Ai() {
|
|
10615
10615
|
F("ConnectivityMonitor", "Network connectivity changed: AVAILABLE");
|
|
10616
|
-
for (const t of this.
|
|
10616
|
+
for (const t of this.bi) t(0 /* AVAILABLE */);
|
|
10617
10617
|
}
|
|
10618
|
-
|
|
10618
|
+
Pi() {
|
|
10619
10619
|
F("ConnectivityMonitor", "Network connectivity changed: UNAVAILABLE");
|
|
10620
|
-
for (const t of this.
|
|
10620
|
+
for (const t of this.bi) t(1 /* UNAVAILABLE */);
|
|
10621
10621
|
}
|
|
10622
10622
|
// TODO(chenbrian): Consider passing in window either into this component or
|
|
10623
10623
|
// here for testing via FakeWindow.
|
|
10624
10624
|
/** Checks that all used attributes of window are available. */
|
|
10625
|
-
static
|
|
10625
|
+
static bt() {
|
|
10626
10626
|
return "undefined" != typeof window && void 0 !== window.addEventListener && void 0 !== window.removeEventListener;
|
|
10627
10627
|
}
|
|
10628
10628
|
}
|
|
@@ -10811,7 +10811,7 @@ class {
|
|
|
10811
10811
|
}));
|
|
10812
10812
|
}
|
|
10813
10813
|
Qi(t, e, n) {
|
|
10814
|
-
const s = [ this.Mi, "/", "google.firestore.v1.Firestore", "/", t, "/channel" ], i = R(), r =
|
|
10814
|
+
const s = [ this.Mi, "/", "google.firestore.v1.Firestore", "/", t, "/channel" ], i = R(), r = P(), o = {
|
|
10815
10815
|
// Required for backend stickiness, routing behavior is based on this
|
|
10816
10816
|
// parameter.
|
|
10817
10817
|
httpSessionIdParam: "gsessionid",
|
|
@@ -10835,7 +10835,7 @@ class {
|
|
|
10835
10835
|
forceLongPolling: this.forceLongPolling,
|
|
10836
10836
|
detectBufferingProxy: this.autoDetectLongPolling
|
|
10837
10837
|
};
|
|
10838
|
-
this.useFetchStreams && (o.xmlHttpFactory = new
|
|
10838
|
+
this.useFetchStreams && (o.xmlHttpFactory = new b({})), this.qi(o.initMessageHeaders, e, n),
|
|
10839
10839
|
// Sending the custom headers we just added to request.initMessageHeaders
|
|
10840
10840
|
// (Authorization, etc.) will trigger the browser to make a CORS preflight
|
|
10841
10841
|
// request because the XHR will no longer meet the criteria for a "simple"
|
|
@@ -11344,14 +11344,14 @@ class io {
|
|
|
11344
11344
|
const e = t.targetChange;
|
|
11345
11345
|
return e.targetIds && e.targetIds.length ? ut.min() : e.readTime ? Hn(e.readTime) : ut.min();
|
|
11346
11346
|
}(t);
|
|
11347
|
-
return this.listener.
|
|
11347
|
+
return this.listener.Pr(e, n);
|
|
11348
11348
|
}
|
|
11349
11349
|
/**
|
|
11350
11350
|
* Registers interest in the results of the given target. If the target
|
|
11351
11351
|
* includes a resumeToken it will be included in the request. Results that
|
|
11352
11352
|
* affect the target will be streamed back as WatchChange messages that
|
|
11353
11353
|
* reference the targetId.
|
|
11354
|
-
*/
|
|
11354
|
+
*/ br(t) {
|
|
11355
11355
|
const e = {};
|
|
11356
11356
|
e.database = ns(this.k), e.addTarget = function(t, e) {
|
|
11357
11357
|
let n;
|
|
@@ -11700,7 +11700,7 @@ function fo(t, e) {
|
|
|
11700
11700
|
* We need to increment the the expected number of pending responses we're due
|
|
11701
11701
|
* from watch so we wait for the ack to process any messages from this target.
|
|
11702
11702
|
*/ function _o(t, e) {
|
|
11703
|
-
t.Yr.X(e.targetId), Fo(t).
|
|
11703
|
+
t.Yr.X(e.targetId), Fo(t).br(e);
|
|
11704
11704
|
}
|
|
11705
11705
|
|
|
11706
11706
|
/**
|
|
@@ -11851,11 +11851,11 @@ async function Ao(t, e, n) {
|
|
|
11851
11851
|
/**
|
|
11852
11852
|
* Executes `op`. If `op` fails, takes the network offline until `op`
|
|
11853
11853
|
* succeeds. Returns after the first attempt.
|
|
11854
|
-
*/ function
|
|
11854
|
+
*/ function Po(t, e) {
|
|
11855
11855
|
return e().catch((n => Ro(t, n, e)));
|
|
11856
11856
|
}
|
|
11857
11857
|
|
|
11858
|
-
async function
|
|
11858
|
+
async function bo(t) {
|
|
11859
11859
|
const e = K(t), n = Oo(e);
|
|
11860
11860
|
let s = e.Qr.length > 0 ? e.Qr[e.Qr.length - 1].batchId : -1;
|
|
11861
11861
|
for (;vo(e); ) try {
|
|
@@ -11907,10 +11907,10 @@ async function No(t) {
|
|
|
11907
11907
|
|
|
11908
11908
|
async function ko(t, e, n) {
|
|
11909
11909
|
const s = t.Qr.shift(), i = ai.from(s, e, n);
|
|
11910
|
-
await
|
|
11910
|
+
await Po(t, (() => t.remoteSyncer.applySuccessfulWrite(i))),
|
|
11911
11911
|
// It's possible that with the completion of this mutation another
|
|
11912
11912
|
// slot has freed up.
|
|
11913
|
-
await
|
|
11913
|
+
await bo(t);
|
|
11914
11914
|
}
|
|
11915
11915
|
|
|
11916
11916
|
async function xo(t, e) {
|
|
@@ -11928,10 +11928,10 @@ async function xo(t, e) {
|
|
|
11928
11928
|
// In this case it's also unlikely that the server itself is melting
|
|
11929
11929
|
// down -- this was just a bad request so inhibit backoff on the next
|
|
11930
11930
|
// restart.
|
|
11931
|
-
Oo(t).wr(), await
|
|
11931
|
+
Oo(t).wr(), await Po(t, (() => t.remoteSyncer.rejectFailedWrite(n.batchId, e))),
|
|
11932
11932
|
// It's possible that with the completion of this mutation
|
|
11933
11933
|
// another slot has freed up.
|
|
11934
|
-
await
|
|
11934
|
+
await bo(t);
|
|
11935
11935
|
}
|
|
11936
11936
|
var n;
|
|
11937
11937
|
}(t, e),
|
|
@@ -11981,7 +11981,7 @@ async function $o(t, e) {
|
|
|
11981
11981
|
*/ (t.datastore, t.asyncQueue, {
|
|
11982
11982
|
Di: Eo.bind(null, t),
|
|
11983
11983
|
Ni: Io.bind(null, t),
|
|
11984
|
-
|
|
11984
|
+
Pr: Ao.bind(null, t)
|
|
11985
11985
|
}), t.zr.push((async e => {
|
|
11986
11986
|
e ? (t.Xr.wr(), yo(t) ? go(t) : t.Jr.set("Unknown" /* Unknown */)) : (await t.Xr.stop(),
|
|
11987
11987
|
To(t));
|
|
@@ -12009,7 +12009,7 @@ async function $o(t, e) {
|
|
|
12009
12009
|
}), t.zr.push((async e => {
|
|
12010
12010
|
e ? (t.Zr.wr(),
|
|
12011
12011
|
// This will start the write stream if necessary.
|
|
12012
|
-
await
|
|
12012
|
+
await bo(t)) : (await t.Zr.stop(), t.Qr.length > 0 && (F("RemoteStore", `Stopping write stream with ${t.Qr.length} pending writes`),
|
|
12013
12013
|
t.Qr = []));
|
|
12014
12014
|
}))), t.Zr;
|
|
12015
12015
|
}
|
|
@@ -12623,7 +12623,7 @@ class nc {
|
|
|
12623
12623
|
/**
|
|
12624
12624
|
* The set of remote documents that the server has told us belongs to the target associated with
|
|
12625
12625
|
* this view.
|
|
12626
|
-
*/ get
|
|
12626
|
+
*/ get Po() {
|
|
12627
12627
|
return this.To;
|
|
12628
12628
|
}
|
|
12629
12629
|
/**
|
|
@@ -12635,7 +12635,7 @@ class nc {
|
|
|
12635
12635
|
* @param previousChanges - If this is being called with a refill, then start
|
|
12636
12636
|
* with this set of docs and changes instead of the current view.
|
|
12637
12637
|
* @returns a new set of docs, changes, and refill flag.
|
|
12638
|
-
*/
|
|
12638
|
+
*/ bo(t, e) {
|
|
12639
12639
|
const n = e ? e.vo : new Uo, s = e ? e.Ro : this.Ro;
|
|
12640
12640
|
let i = e ? e.mutatedKeys : this.mutatedKeys, r = s, o = !1;
|
|
12641
12641
|
// Track the last doc in a (full) limit. This is necessary, because some
|
|
@@ -12843,7 +12843,7 @@ class nc {
|
|
|
12843
12843
|
// PORTING NOTE: Multi-tab only.
|
|
12844
12844
|
ko(t) {
|
|
12845
12845
|
this.To = t.zn, this.Io = Cn();
|
|
12846
|
-
const e = this.
|
|
12846
|
+
const e = this.bo(t.documents);
|
|
12847
12847
|
return this.applyChanges(e, /*updateLimboDocuments=*/ !0);
|
|
12848
12848
|
}
|
|
12849
12849
|
/**
|
|
@@ -12966,7 +12966,7 @@ async function cc(t, e) {
|
|
|
12966
12966
|
// to the query. EventManager will not have an assigned target ID in this
|
|
12967
12967
|
// case and calls `listen` to obtain this ID.
|
|
12968
12968
|
s = r.targetId, n.sharedClientState.addLocalQueryTarget(s), i = r.view.xo(); else {
|
|
12969
|
-
const t = await Er(n.localStore,
|
|
12969
|
+
const t = await Er(n.localStore, be(e)), r = n.sharedClientState.addLocalQueryTarget(t.targetId);
|
|
12970
12970
|
s = t.targetId, i = await ac(n, e, s, "current" === r), n.isPrimaryClient && fo(n.remoteStore, t);
|
|
12971
12971
|
}
|
|
12972
12972
|
return i;
|
|
@@ -12980,19 +12980,19 @@ async function cc(t, e) {
|
|
|
12980
12980
|
// targets based on view changes. This allows us to only depend on Limbo
|
|
12981
12981
|
// changes when user code includes queries.
|
|
12982
12982
|
t.Go = (e, n, s) => async function(t, e, n, s) {
|
|
12983
|
-
let i = e.view.
|
|
12983
|
+
let i = e.view.bo(n);
|
|
12984
12984
|
i.Bn && (
|
|
12985
12985
|
// The query has a limit and some docs were removed, so we need
|
|
12986
12986
|
// to re-run the query against the local store to make sure we
|
|
12987
12987
|
// didn't lose any good docs that had been past the limit.
|
|
12988
12988
|
i = await Ar(t.localStore, e.query,
|
|
12989
|
-
/* usePreviousResults= */ !1).then((({documents: t}) => e.view.
|
|
12989
|
+
/* usePreviousResults= */ !1).then((({documents: t}) => e.view.bo(t, i))));
|
|
12990
12990
|
const r = s && s.targetChanges.get(e.targetId), o = e.view.applyChanges(i,
|
|
12991
12991
|
/* updateLimboDocuments= */ t.isPrimaryClient, r);
|
|
12992
12992
|
return Ec(t, e.targetId, o.Co), o.snapshot;
|
|
12993
12993
|
}(t, e, n, s);
|
|
12994
12994
|
const i = await Ar(t.localStore, e,
|
|
12995
|
-
/* usePreviousResults= */ !0), r = new sc(e, i.zn), o = r.
|
|
12995
|
+
/* usePreviousResults= */ !0), r = new sc(e, i.zn), o = r.bo(i.documents), c = $n.createSynthesizedTargetChangeForCurrentChange(n, s && "Offline" /* Offline */ !== t.onlineState), a = r.applyChanges(o,
|
|
12996
12996
|
/* updateLimboDocuments= */ t.isPrimaryClient, c);
|
|
12997
12997
|
Ec(t, n, a.Co);
|
|
12998
12998
|
const u = new ic(e, n, r);
|
|
@@ -13061,7 +13061,7 @@ async function cc(t, e) {
|
|
|
13061
13061
|
/**
|
|
13062
13062
|
* Resolves or rejects the user callback for the given batch and then discards
|
|
13063
13063
|
* it.
|
|
13064
|
-
*/ (s, t.batchId, n), await Rc(s, t.changes), await
|
|
13064
|
+
*/ (s, t.batchId, n), await Rc(s, t.changes), await bo(s.remoteStore);
|
|
13065
13065
|
} catch (t) {
|
|
13066
13066
|
// If we can't persist the mutation, we reject the user callback and
|
|
13067
13067
|
// don't send the mutation. The user can then retry the write.
|
|
@@ -13116,7 +13116,7 @@ async function cc(t, e) {
|
|
|
13116
13116
|
// Run global snapshot listeners if a consistent snapshot has been emitted.
|
|
13117
13117
|
t.ro(e) && (s = !0);
|
|
13118
13118
|
})), s && Ho(n);
|
|
13119
|
-
}(s.eventManager, e), t.length && s.Fo.
|
|
13119
|
+
}(s.eventManager, e), t.length && s.Fo.Pr(t), s.onlineState = e, s.isPrimaryClient && s.sharedClientState.setOnlineState(e);
|
|
13120
13120
|
}
|
|
13121
13121
|
}
|
|
13122
13122
|
|
|
@@ -13289,7 +13289,7 @@ function Ic(t, e) {
|
|
|
13289
13289
|
const e = t.Lo.values().next().value;
|
|
13290
13290
|
t.Lo.delete(e);
|
|
13291
13291
|
const n = new Ct(wt.fromString(e)), s = t.Qo.next();
|
|
13292
|
-
t.Uo.set(s, new rc(n)), t.Bo = t.Bo.insert(n, s), fo(t.remoteStore, new ui(
|
|
13292
|
+
t.Uo.set(s, new rc(n)), t.Bo = t.Bo.insert(n, s), fo(t.remoteStore, new ui(be(pe(n.path)), s, 2 /* LimboResolution */ , nt.I));
|
|
13293
13293
|
}
|
|
13294
13294
|
}
|
|
13295
13295
|
|
|
@@ -13304,7 +13304,7 @@ async function Rc(t, e, n) {
|
|
|
13304
13304
|
r.push(e);
|
|
13305
13305
|
}
|
|
13306
13306
|
})));
|
|
13307
|
-
})), await Promise.all(o), s.Fo.
|
|
13307
|
+
})), await Promise.all(o), s.Fo.Pr(i), await async function(t, e) {
|
|
13308
13308
|
const n = K(t);
|
|
13309
13309
|
try {
|
|
13310
13310
|
await n.persistence.runTransaction("notifyLocalViewChanges", "readwrite", (t => Hs.forEach(e, (e => Hs.forEach(e.kn, (s => n.persistence.referenceDelegate.addReference(t, e.targetId, s))).next((() => Hs.forEach(e.xn, (s => n.persistence.referenceDelegate.removeReference(t, e.targetId, s)))))))));
|
|
@@ -13327,7 +13327,7 @@ async function Rc(t, e, n) {
|
|
|
13327
13327
|
}(s.localStore, r));
|
|
13328
13328
|
}
|
|
13329
13329
|
|
|
13330
|
-
async function
|
|
13330
|
+
async function Pc(t, e) {
|
|
13331
13331
|
const n = K(t);
|
|
13332
13332
|
if (!n.currentUser.isEqual(e)) {
|
|
13333
13333
|
F("SyncEngine", "User change. New user:", e.toKey());
|
|
@@ -13346,7 +13346,7 @@ async function bc(t, e) {
|
|
|
13346
13346
|
}
|
|
13347
13347
|
}
|
|
13348
13348
|
|
|
13349
|
-
function
|
|
13349
|
+
function bc(t, e) {
|
|
13350
13350
|
const n = K(t), s = n.Uo.get(e);
|
|
13351
13351
|
if (s && s.$o) return Cn().add(s.key);
|
|
13352
13352
|
{
|
|
@@ -13355,7 +13355,7 @@ function Pc(t, e) {
|
|
|
13355
13355
|
if (!s) return t;
|
|
13356
13356
|
for (const e of s) {
|
|
13357
13357
|
const s = n.Oo.get(e);
|
|
13358
|
-
t = t.unionWith(s.view.
|
|
13358
|
+
t = t.unionWith(s.view.Po);
|
|
13359
13359
|
}
|
|
13360
13360
|
return t;
|
|
13361
13361
|
}
|
|
@@ -13377,7 +13377,7 @@ function Pc(t, e) {
|
|
|
13377
13377
|
// PORTING NOTE: Multi-Tab only.
|
|
13378
13378
|
async function Vc(t) {
|
|
13379
13379
|
const e = K(t);
|
|
13380
|
-
return
|
|
13380
|
+
return Pr(e.localStore).then((t => Rc(e, t)));
|
|
13381
13381
|
}
|
|
13382
13382
|
|
|
13383
13383
|
/** Applies a mutation state to an existing batch. */
|
|
@@ -13393,7 +13393,7 @@ async function Sc(t, e, n, s) {
|
|
|
13393
13393
|
// If we are the primary client, we need to send this write to the
|
|
13394
13394
|
// backend. Secondary clients will ignore these writes since their remote
|
|
13395
13395
|
// connection is disabled.
|
|
13396
|
-
await
|
|
13396
|
+
await bo(i.remoteStore) : "acknowledged" === n || "rejected" === n ? (
|
|
13397
13397
|
// NOTE: Both these methods are no-ops for batches that originated from
|
|
13398
13398
|
// other clients.
|
|
13399
13399
|
yc(i, e, s || null), gc(i, e), function(t, e) {
|
|
@@ -13465,7 +13465,7 @@ async function Cc(t, e, n) {
|
|
|
13465
13465
|
// from LocalStore (as the resume token and the snapshot version
|
|
13466
13466
|
// might have changed) and reconcile their views with the persisted
|
|
13467
13467
|
// state (the list of syncedDocuments may have gotten out of sync).
|
|
13468
|
-
e = await Er(s.localStore,
|
|
13468
|
+
e = await Er(s.localStore, be(n[0]));
|
|
13469
13469
|
for (const t of n) {
|
|
13470
13470
|
const e = s.Oo.get(t), n = await vc(s, e);
|
|
13471
13471
|
n.snapshot && r.push(n.snapshot);
|
|
@@ -13479,7 +13479,7 @@ async function Cc(t, e, n) {
|
|
|
13479
13479
|
}
|
|
13480
13480
|
i.push(e);
|
|
13481
13481
|
}
|
|
13482
|
-
return s.Fo.
|
|
13482
|
+
return s.Fo.Pr(r), i;
|
|
13483
13483
|
}
|
|
13484
13484
|
|
|
13485
13485
|
/**
|
|
@@ -13515,7 +13515,7 @@ async function xc(t, e, n, s) {
|
|
|
13515
13515
|
case "current":
|
|
13516
13516
|
case "not-current":
|
|
13517
13517
|
{
|
|
13518
|
-
const t = await
|
|
13518
|
+
const t = await Pr(i.localStore), s = xn.createSynthesizedRemoteEventForCurrentChange(e, "current" === n);
|
|
13519
13519
|
await Rc(i, t, s);
|
|
13520
13520
|
break;
|
|
13521
13521
|
}
|
|
@@ -13557,8 +13557,8 @@ async function xc(t, e, n, s) {
|
|
|
13557
13557
|
|
|
13558
13558
|
function Fc(t) {
|
|
13559
13559
|
const e = K(t);
|
|
13560
|
-
return e.remoteStore.remoteSyncer.applyRemoteEvent = lc.bind(null, e), e.remoteStore.remoteSyncer.getRemoteKeysForTarget =
|
|
13561
|
-
e.remoteStore.remoteSyncer.rejectListen = dc.bind(null, e), e.Fo.
|
|
13560
|
+
return e.remoteStore.remoteSyncer.applyRemoteEvent = lc.bind(null, e), e.remoteStore.remoteSyncer.getRemoteKeysForTarget = bc.bind(null, e),
|
|
13561
|
+
e.remoteStore.remoteSyncer.rejectListen = dc.bind(null, e), e.Fo.Pr = Go.bind(null, e.eventManager),
|
|
13562
13562
|
e.Fo.zo = zo.bind(null, e.eventManager), e;
|
|
13563
13563
|
}
|
|
13564
13564
|
|
|
@@ -13679,9 +13679,9 @@ class Lc {
|
|
|
13679
13679
|
super(), this.tc = t, this.cacheSizeBytes = e, this.forceOwnership = n, this.synchronizeTabs = !1;
|
|
13680
13680
|
}
|
|
13681
13681
|
async initialize(t) {
|
|
13682
|
-
await super.initialize(t), await
|
|
13682
|
+
await super.initialize(t), await br(this.localStore), await this.tc.initialize(this, t),
|
|
13683
13683
|
// Enqueue writes from a previous session
|
|
13684
|
-
await Oc(this.tc.syncEngine), await
|
|
13684
|
+
await Oc(this.tc.syncEngine), await bo(this.tc.remoteStore),
|
|
13685
13685
|
// NOTE: This will immediately call the listener, so we make sure to
|
|
13686
13686
|
// set it after localStore / remoteStore are started.
|
|
13687
13687
|
await this.persistence.sn((() => (this.gcScheduler && !this.gcScheduler.started && this.gcScheduler.start(this.localStore),
|
|
@@ -13732,7 +13732,7 @@ class Lc {
|
|
|
13732
13732
|
}
|
|
13733
13733
|
Jo(t) {
|
|
13734
13734
|
const e = to();
|
|
13735
|
-
if (!Gr.
|
|
13735
|
+
if (!Gr.bt(e)) throw new Q(j.UNIMPLEMENTED, "IndexedDB persistence is only available on platforms that support LocalStorage.");
|
|
13736
13736
|
const n = ar(t.databaseInfo.databaseId, t.databaseInfo.persistenceKey);
|
|
13737
13737
|
return new Gr(e, t.asyncQueue, n, t.clientId, t.initialUser);
|
|
13738
13738
|
}
|
|
@@ -13747,7 +13747,7 @@ class Lc {
|
|
|
13747
13747
|
this.datastore = this.createDatastore(e), this.remoteStore = this.createRemoteStore(e),
|
|
13748
13748
|
this.eventManager = this.createEventManager(e), this.syncEngine = this.createSyncEngine(e,
|
|
13749
13749
|
/* startAsPrimary=*/ !t.synchronizeTabs), this.sharedClientState.onlineStateHandler = t => fc(this.syncEngine, t, 1 /* SharedClientState */),
|
|
13750
|
-
this.remoteStore.remoteSyncer.handleCredentialChange =
|
|
13750
|
+
this.remoteStore.remoteSyncer.handleCredentialChange = Pc.bind(null, this.syncEngine),
|
|
13751
13751
|
await $o(this.remoteStore, this.syncEngine.isPrimaryClient));
|
|
13752
13752
|
}
|
|
13753
13753
|
createEventManager(t) {
|
|
@@ -13762,7 +13762,7 @@ class Lc {
|
|
|
13762
13762
|
}
|
|
13763
13763
|
createRemoteStore(t) {
|
|
13764
13764
|
return e = this.localStore, n = this.datastore, s = t.asyncQueue, i = t => fc(this.syncEngine, t, 0 /* RemoteStore */),
|
|
13765
|
-
r = Jr.
|
|
13765
|
+
r = Jr.bt() ? new Jr : new Hr, new uo(e, n, s, i, r);
|
|
13766
13766
|
var e, n, s, i, r;
|
|
13767
13767
|
/** Re-enables the network. Idempotent. */ }
|
|
13768
13768
|
createSyncEngine(t, e) {
|
|
@@ -14454,7 +14454,7 @@ function aa(t, e) {
|
|
|
14454
14454
|
return t.asyncQueue.enqueueAndForget((async () => async function(t, e, n) {
|
|
14455
14455
|
try {
|
|
14456
14456
|
const s = await Ar(t, e,
|
|
14457
|
-
/* usePreviousResults= */ !0), i = new sc(e, s.zn), r = i.
|
|
14457
|
+
/* usePreviousResults= */ !0), i = new sc(e, s.zn), r = i.bo(s.documents), o = i.applyChanges(r,
|
|
14458
14458
|
/* updateLimboDocuments= */ !1);
|
|
14459
14459
|
n.resolve(o.snapshot);
|
|
14460
14460
|
} catch (t) {
|
|
@@ -14784,7 +14784,7 @@ class Ra {
|
|
|
14784
14784
|
* The Cloud Firestore service interface.
|
|
14785
14785
|
*
|
|
14786
14786
|
* Do not call this constructor directly. Instead, use {@link getFirestore}.
|
|
14787
|
-
*/ class
|
|
14787
|
+
*/ class Pa {
|
|
14788
14788
|
/** @hideconstructor */
|
|
14789
14789
|
constructor(t, e, n) {
|
|
14790
14790
|
this._authCredentials = e, this._appCheckCredentials = n,
|
|
@@ -14877,9 +14877,9 @@ class Ra {
|
|
|
14877
14877
|
}
|
|
14878
14878
|
}
|
|
14879
14879
|
|
|
14880
|
-
function
|
|
14880
|
+
function ba(t, e, n, s = {}) {
|
|
14881
14881
|
var i;
|
|
14882
|
-
const r = (t = Ia(t,
|
|
14882
|
+
const r = (t = Ia(t, Pa))._getSettings();
|
|
14883
14883
|
if ("firestore.googleapis.com" !== r.host && r.host !== e && M("Host has been set in both settings() and useEmulator(), emulator host will be used"),
|
|
14884
14884
|
t._setSettings(Object.assign(Object.assign({}, r), {
|
|
14885
14885
|
host: `${e}:${n}`,
|
|
@@ -15006,7 +15006,7 @@ function Pa(t, e, n, s = {}) {
|
|
|
15006
15006
|
}
|
|
15007
15007
|
|
|
15008
15008
|
function Da(t, e, ...n) {
|
|
15009
|
-
if (t = p(t), ga("collection", "path", e), t instanceof
|
|
15009
|
+
if (t = p(t), ga("collection", "path", e), t instanceof Pa) {
|
|
15010
15010
|
const s = wt.fromString(e, ...n);
|
|
15011
15011
|
return Ta(s), new Sa(t, /* converter= */ null, s);
|
|
15012
15012
|
}
|
|
@@ -15031,7 +15031,7 @@ function Da(t, e, ...n) {
|
|
|
15031
15031
|
* will be included. Cannot contain a slash.
|
|
15032
15032
|
* @returns The created `Query`.
|
|
15033
15033
|
*/ function Ca(t, e) {
|
|
15034
|
-
if (t = Ia(t,
|
|
15034
|
+
if (t = Ia(t, Pa), ga("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new Q(j.INVALID_ARGUMENT, `Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
|
|
15035
15035
|
return new Va(t,
|
|
15036
15036
|
/* converter= */ null,
|
|
15037
15037
|
/**
|
|
@@ -15047,7 +15047,7 @@ function Na(t, e, ...n) {
|
|
|
15047
15047
|
if (t = p(t),
|
|
15048
15048
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
15049
15049
|
// 'undefined' and 'null'.
|
|
15050
|
-
1 === arguments.length && (e = it.A()), ga("doc", "path", e), t instanceof
|
|
15050
|
+
1 === arguments.length && (e = it.A()), ga("doc", "path", e), t instanceof Pa) {
|
|
15051
15051
|
const s = wt.fromString(e, ...n);
|
|
15052
15052
|
return pa(s), new va(t,
|
|
15053
15053
|
/* converter= */ null, new Ct(s));
|
|
@@ -15124,12 +15124,12 @@ function Na(t, e, ...n) {
|
|
|
15124
15124
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
15125
15125
|
// operations. Meant to speed up recovery when we regain file system access
|
|
15126
15126
|
// after page comes into foreground.
|
|
15127
|
-
this.
|
|
15127
|
+
this.Pc = () => {
|
|
15128
15128
|
const t = eo();
|
|
15129
15129
|
t && F("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.ur.er();
|
|
15130
15130
|
};
|
|
15131
15131
|
const t = eo();
|
|
15132
|
-
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.
|
|
15132
|
+
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Pc);
|
|
15133
15133
|
}
|
|
15134
15134
|
get isShuttingDown() {
|
|
15135
15135
|
return this.yc;
|
|
@@ -15142,7 +15142,7 @@ function Na(t, e, ...n) {
|
|
|
15142
15142
|
this.enqueue(t);
|
|
15143
15143
|
}
|
|
15144
15144
|
enqueueAndForgetEvenWhileRestricted(t) {
|
|
15145
|
-
this.
|
|
15145
|
+
this.bc(),
|
|
15146
15146
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
15147
15147
|
this.vc(t);
|
|
15148
15148
|
}
|
|
@@ -15150,11 +15150,11 @@ function Na(t, e, ...n) {
|
|
|
15150
15150
|
if (!this.yc) {
|
|
15151
15151
|
this.yc = !0, this.Ac = t || !1;
|
|
15152
15152
|
const e = eo();
|
|
15153
|
-
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.
|
|
15153
|
+
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Pc);
|
|
15154
15154
|
}
|
|
15155
15155
|
}
|
|
15156
15156
|
enqueue(t) {
|
|
15157
|
-
if (this.
|
|
15157
|
+
if (this.bc(), this.yc)
|
|
15158
15158
|
// Return a Promise which never resolves.
|
|
15159
15159
|
return new Promise((() => {}));
|
|
15160
15160
|
// Create a deferred Promise that we can return to the callee. This
|
|
@@ -15231,13 +15231,13 @@ function Na(t, e, ...n) {
|
|
|
15231
15231
|
return this.mc = e, e;
|
|
15232
15232
|
}
|
|
15233
15233
|
enqueueAfterDelay(t, e, n) {
|
|
15234
|
-
this.
|
|
15234
|
+
this.bc(),
|
|
15235
15235
|
// Fast-forward delays for timerIds that have been overriden.
|
|
15236
15236
|
this.Rc.indexOf(t) > -1 && (e = 0);
|
|
15237
15237
|
const s = Mo.createAndSchedule(this, t, e, n, (t => this.Sc(t)));
|
|
15238
15238
|
return this.Tc.push(s), s;
|
|
15239
15239
|
}
|
|
15240
|
-
|
|
15240
|
+
bc() {
|
|
15241
15241
|
this.Ec && B();
|
|
15242
15242
|
}
|
|
15243
15243
|
verifyOperationInProgress() {}
|
|
@@ -15414,7 +15414,7 @@ class Oa {
|
|
|
15414
15414
|
*
|
|
15415
15415
|
* Do not call this constructor directly. Instead, use {@link getFirestore}.
|
|
15416
15416
|
*/
|
|
15417
|
-
class La extends
|
|
15417
|
+
class La extends Pa {
|
|
15418
15418
|
/** @hideconstructor */
|
|
15419
15419
|
constructor(t, e, n) {
|
|
15420
15420
|
super(t, e, n),
|
|
@@ -15604,7 +15604,7 @@ function Ga(t) {
|
|
|
15604
15604
|
return t._queue.enqueueAndForgetEvenWhileRestricted((async () => {
|
|
15605
15605
|
try {
|
|
15606
15606
|
await async function(t) {
|
|
15607
|
-
if (!Ys.
|
|
15607
|
+
if (!Ys.bt()) return Promise.resolve();
|
|
15608
15608
|
const e = t + "main";
|
|
15609
15609
|
await Ys.delete(e);
|
|
15610
15610
|
}(ar(t._databaseId, t._persistenceKey)), e.resolve();
|
|
@@ -16102,7 +16102,7 @@ function fu(t) {
|
|
|
16102
16102
|
|
|
16103
16103
|
/** Parse document data from a set() call. */ function du(t, e, n, s, i, r = {}) {
|
|
16104
16104
|
const o = t.Qc(r.merge || r.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, i);
|
|
16105
|
-
|
|
16105
|
+
bu("Data must be an object, but it was:", o, s);
|
|
16106
16106
|
const c = Ru(s, o);
|
|
16107
16107
|
let a, u;
|
|
16108
16108
|
if (r.merge) a = new gt(o.fieldMask), u = o.fieldTransforms; else if (r.mergeFields) {
|
|
@@ -16208,7 +16208,7 @@ class pu extends iu {
|
|
|
16208
16208
|
|
|
16209
16209
|
/** Parse update data from an update() call. */ function Tu(t, e, n, s) {
|
|
16210
16210
|
const i = t.Qc(1 /* Update */ , e, n);
|
|
16211
|
-
|
|
16211
|
+
bu("Data must be an object, but it was:", i, s);
|
|
16212
16212
|
const r = [], o = Wt.empty();
|
|
16213
16213
|
lt(s, ((t, s) => {
|
|
16214
16214
|
const c = Su(e, t, n);
|
|
@@ -16271,10 +16271,10 @@ class pu extends iu {
|
|
|
16271
16271
|
* @returns The parsed value, or null if the value was a FieldValue sentinel
|
|
16272
16272
|
* that should not be included in the resulting parsed data.
|
|
16273
16273
|
*/ function Au(t, e) {
|
|
16274
|
-
if (
|
|
16274
|
+
if (Pu(
|
|
16275
16275
|
// Unwrap the API type from the Compat SDK. This will return the API type
|
|
16276
16276
|
// from firestore-exp.
|
|
16277
|
-
t = p(t))) return
|
|
16277
|
+
t = p(t))) return bu("Unsupported field value:", e, t), Ru(t, e);
|
|
16278
16278
|
if (t instanceof iu)
|
|
16279
16279
|
// FieldValues usually parse into transforms (except FieldValue.delete())
|
|
16280
16280
|
// in which case we do not want to include this field in our parsed data
|
|
@@ -16400,12 +16400,12 @@ function Ru(t, e) {
|
|
|
16400
16400
|
};
|
|
16401
16401
|
}
|
|
16402
16402
|
|
|
16403
|
-
function
|
|
16403
|
+
function Pu(t) {
|
|
16404
16404
|
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof at || t instanceof ru || t instanceof su || t instanceof va || t instanceof iu);
|
|
16405
16405
|
}
|
|
16406
16406
|
|
|
16407
|
-
function
|
|
16408
|
-
if (!
|
|
16407
|
+
function bu(t, e, n) {
|
|
16408
|
+
if (!Pu(n) || !function(t) {
|
|
16409
16409
|
return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
|
|
16410
16410
|
}(n)) {
|
|
16411
16411
|
const s = Ea(n);
|
|
@@ -17081,9 +17081,9 @@ function nh(...t) {
|
|
|
17081
17081
|
// the provided document. Without the key (by using the explicit sort
|
|
17082
17082
|
// orders), multiple documents could match the position, yielding duplicate
|
|
17083
17083
|
// results.
|
|
17084
|
-
for (const n of
|
|
17084
|
+
for (const n of Pe(t)) if (n.field.isKeyField()) r.push(Lt(e, s.key)); else {
|
|
17085
17085
|
const t = s.data.field(n.field);
|
|
17086
|
-
if (
|
|
17086
|
+
if (Pt(t)) throw new Q(j.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.)');
|
|
17087
17087
|
if (null === t) {
|
|
17088
17088
|
const t = n.field.canonicalString();
|
|
17089
17089
|
throw new Q(j.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.`);
|
|
@@ -17226,7 +17226,7 @@ function oh(t, e, n) {
|
|
|
17226
17226
|
convertServerTimestamp(t, e) {
|
|
17227
17227
|
switch (e) {
|
|
17228
17228
|
case "previous":
|
|
17229
|
-
const n =
|
|
17229
|
+
const n = bt(t);
|
|
17230
17230
|
return null == n ? null : this.convertValue(n, e);
|
|
17231
17231
|
|
|
17232
17232
|
case "estimate":
|
|
@@ -17242,7 +17242,7 @@ function oh(t, e, n) {
|
|
|
17242
17242
|
}
|
|
17243
17243
|
convertDocumentKey(t, e) {
|
|
17244
17244
|
const n = wt.fromString(t);
|
|
17245
|
-
U(
|
|
17245
|
+
U(Ps(n));
|
|
17246
17246
|
const s = new _a(n.get(1), n.get(3)), i = new Ct(n.popFirst(5));
|
|
17247
17247
|
return s.isEqual(e) ||
|
|
17248
17248
|
// TODO(b/64130202): Somehow support foreign references.
|
|
@@ -17430,7 +17430,7 @@ function lh(t, e) {
|
|
|
17430
17430
|
function fh(t) {
|
|
17431
17431
|
t = Ia(t, va);
|
|
17432
17432
|
const e = Ia(t.firestore, La);
|
|
17433
|
-
return ca(qa(e), t._key).then((n =>
|
|
17433
|
+
return ca(qa(e), t._key).then((n => bh(e, t, n)));
|
|
17434
17434
|
}
|
|
17435
17435
|
|
|
17436
17436
|
class dh extends ch {
|
|
@@ -17470,7 +17470,7 @@ class dh extends ch {
|
|
|
17470
17470
|
const e = Ia(t.firestore, La);
|
|
17471
17471
|
return ca(qa(e), t._key, {
|
|
17472
17472
|
source: "server"
|
|
17473
|
-
}).then((n =>
|
|
17473
|
+
}).then((n => bh(e, t, n)));
|
|
17474
17474
|
}
|
|
17475
17475
|
|
|
17476
17476
|
/**
|
|
@@ -17515,7 +17515,7 @@ class dh extends ch {
|
|
|
17515
17515
|
function ph(t, e, n) {
|
|
17516
17516
|
t = Ia(t, va);
|
|
17517
17517
|
const s = Ia(t.firestore, La), i = ah(t.converter, e, n);
|
|
17518
|
-
return
|
|
17518
|
+
return Ph(s, [ du(fu(s), "setDoc", t._key, i, null !== t.converter, n).toMutation(t._key, Xe.none()) ]);
|
|
17519
17519
|
}
|
|
17520
17520
|
|
|
17521
17521
|
function Th(t, e, n, ...s) {
|
|
@@ -17526,7 +17526,7 @@ function Th(t, e, n, ...s) {
|
|
|
17526
17526
|
// For Compat types, we have to "extract" the underlying types before
|
|
17527
17527
|
// performing validation.
|
|
17528
17528
|
e = p(e)) || e instanceof eu ? Eu(r, "updateDoc", t._key, e, n, s) : Tu(r, "updateDoc", t._key, e);
|
|
17529
|
-
return
|
|
17529
|
+
return Ph(i, [ o.toMutation(t._key, Xe.exists(!0)) ]);
|
|
17530
17530
|
}
|
|
17531
17531
|
|
|
17532
17532
|
/**
|
|
@@ -17536,7 +17536,7 @@ function Th(t, e, n, ...s) {
|
|
|
17536
17536
|
* @returns A Promise resolved once the document has been successfully
|
|
17537
17537
|
* deleted from the backend (note that it won't resolve while you're offline).
|
|
17538
17538
|
*/ function Eh(t) {
|
|
17539
|
-
return
|
|
17539
|
+
return Ph(Ia(t.firestore, La), [ new fn(t._key, Xe.none()) ]);
|
|
17540
17540
|
}
|
|
17541
17541
|
|
|
17542
17542
|
/**
|
|
@@ -17550,7 +17550,7 @@ function Th(t, e, n, ...s) {
|
|
|
17550
17550
|
* won't resolve while you're offline).
|
|
17551
17551
|
*/ function Ih(t, e) {
|
|
17552
17552
|
const n = Ia(t.firestore, La), s = Na(t), i = ah(t.converter, e);
|
|
17553
|
-
return
|
|
17553
|
+
return Ph(n, [ du(fu(t.firestore), "addDoc", s._key, i, null !== t.converter, {}).toMutation(s._key, Xe.exists(!1)) ]).then((() => s));
|
|
17554
17554
|
}
|
|
17555
17555
|
|
|
17556
17556
|
function Ah(t, ...e) {
|
|
@@ -17571,7 +17571,7 @@ function Ah(t, ...e) {
|
|
|
17571
17571
|
let a, u, h;
|
|
17572
17572
|
if (t instanceof va) u = Ia(t.firestore, La), h = pe(t._key.path), a = {
|
|
17573
17573
|
next: n => {
|
|
17574
|
-
e[o] && e[o](
|
|
17574
|
+
e[o] && e[o](bh(u, t, n));
|
|
17575
17575
|
},
|
|
17576
17576
|
error: e[o + 1],
|
|
17577
17577
|
complete: e[o + 2]
|
|
@@ -17604,7 +17604,7 @@ function Rh(t, e) {
|
|
|
17604
17604
|
/**
|
|
17605
17605
|
* Locally writes `mutations` on the async queue.
|
|
17606
17606
|
* @internal
|
|
17607
|
-
*/ function
|
|
17607
|
+
*/ function Ph(t, e) {
|
|
17608
17608
|
return function(t, e) {
|
|
17609
17609
|
const n = new W;
|
|
17610
17610
|
return t.asyncQueue.enqueueAndForget((async () => hc(await na(t), e, n))), n.promise;
|
|
@@ -17614,7 +17614,7 @@ function Rh(t, e) {
|
|
|
17614
17614
|
/**
|
|
17615
17615
|
* Converts a {@link ViewSnapshot} that contains the single document specified by `ref`
|
|
17616
17616
|
* to a {@link DocumentSnapshot}.
|
|
17617
|
-
*/ function
|
|
17617
|
+
*/ function bh(t, e, n) {
|
|
17618
17618
|
const s = n.docs.get(e._key), i = new dh(t);
|
|
17619
17619
|
return new Fu(t, i, e._key, s, new $u(n.hasPendingWrites, n.fromCache), e.converter);
|
|
17620
17620
|
}
|
|
@@ -17834,7 +17834,7 @@ function Rh(t, e) {
|
|
|
17834
17834
|
* @returns A {@link WriteBatch} that can be used to atomically execute multiple
|
|
17835
17835
|
* writes.
|
|
17836
17836
|
*/ function xh(t) {
|
|
17837
|
-
return qa(t = Ia(t, La)), new hh(t, (e =>
|
|
17837
|
+
return qa(t = Ia(t, La)), new hh(t, (e => Ph(t, e)));
|
|
17838
17838
|
}
|
|
17839
17839
|
|
|
17840
17840
|
/**
|
|
@@ -17860,10 +17860,10 @@ function Rh(t, e) {
|
|
|
17860
17860
|
return n = Object.assign({
|
|
17861
17861
|
useFetchStreams: e
|
|
17862
17862
|
}, n), i._setSettings(n), i;
|
|
17863
|
-
}), "PUBLIC" /* PUBLIC */)), s(D, "3.
|
|
17863
|
+
}), "PUBLIC" /* PUBLIC */)), s(D, "3.4.0", t),
|
|
17864
17864
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
|
17865
|
-
s(D, "3.
|
|
17865
|
+
s(D, "3.4.0", "esm2017");
|
|
17866
17866
|
}("rn", /* useFetchStreams= */ !1);
|
|
17867
17867
|
|
|
17868
|
-
export { ch as AbstractUserDataWriter, su as Bytes, Ma as CACHE_SIZE_UNLIMITED, Sa as CollectionReference, va as DocumentReference, Fu as DocumentSnapshot, eu as FieldPath, iu as FieldValue, La as Firestore, Q as FirestoreError, ru as GeoPoint, Oa as LoadBundleTask, Va as Query, qu as QueryConstraint, Ou as QueryDocumentSnapshot, Mu as QuerySnapshot, $u as SnapshotMetadata, at as Timestamp, vh as Transaction, hh as WriteBatch, _a as _DatabaseId, Ct as _DocumentKey, et as _EmptyAppCheckTokenProvider, z as _EmptyAuthCredentialsProvider, mt as _FieldPath, Ia as _cast, q as _debugAssert, pt as _isBase64Available, M as _logWarn, ya as _validateIsNotUsedTogether, Ih as addDoc, Nh as arrayRemove, Ch as arrayUnion, Ga as clearIndexedDbPersistence, Da as collection, Ca as collectionGroup,
|
|
17868
|
+
export { ch as AbstractUserDataWriter, su as Bytes, Ma as CACHE_SIZE_UNLIMITED, Sa as CollectionReference, va as DocumentReference, Fu as DocumentSnapshot, eu as FieldPath, iu as FieldValue, La as Firestore, Q as FirestoreError, ru as GeoPoint, Oa as LoadBundleTask, Va as Query, qu as QueryConstraint, Ou as QueryDocumentSnapshot, Mu as QuerySnapshot, $u as SnapshotMetadata, at as Timestamp, vh as Transaction, hh as WriteBatch, _a as _DatabaseId, Ct as _DocumentKey, et as _EmptyAppCheckTokenProvider, z as _EmptyAuthCredentialsProvider, mt as _FieldPath, Ia as _cast, q as _debugAssert, pt as _isBase64Available, M as _logWarn, ya as _validateIsNotUsedTogether, Ih as addDoc, Nh as arrayRemove, Ch as arrayUnion, Ga as clearIndexedDbPersistence, Da as collection, Ca as collectionGroup, ba as connectFirestoreEmulator, Eh as deleteDoc, Sh as deleteField, Ja as disableNetwork, Na as doc, nu as documentId, ja as enableIndexedDbPersistence, Qa as enableMultiTabIndexedDbPersistence, Ha as enableNetwork, nh as endAt, eh as endBefore, qa as ensureFirestoreConfigured, Ph as executeWrite, fh as getDoc, wh as getDocFromCache, _h as getDocFromServer, mh as getDocs, gh as getDocsFromCache, yh as getDocsFromServer, Ua as getFirestore, kh as increment, Ba as initializeFirestore, Hu as limit, Ju as limitToLast, Xa as loadBundle, Za as namedQuery, Ah as onSnapshot, Rh as onSnapshotsInSync, Gu as orderBy, Ku as query, xa as queryEqual, ka as refEqual, Vh as runTransaction, Dh as serverTimestamp, ph as setDoc, $ as setLogLevel, Bu as snapshotEqual, Zu as startAfter, Xu as startAt, Ya as terminate, Th as updateDoc, za as waitForPendingWrites, Qu as where, xh as writeBatch };
|
|
17869
17869
|
//# sourceMappingURL=index.rn.js.map
|