@firebase/firestore 3.4.1-2021118224937 → 3.4.1-canary.3d8109ca3
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 +4 -2
- package/dist/firestore/src/index/directional_index_byte_encoder.d.ts +24 -0
- package/dist/firestore/src/index/firestore_index_value_writer.d.ts +33 -0
- package/dist/firestore/src/index/index_byte_encoder.d.ts +14 -0
- package/dist/firestore/src/index/ordered_code_writer.d.ts +14 -0
- package/dist/firestore/src/lite-api/reference.d.ts +4 -2
- package/dist/firestore/src/lite-api/reference_impl.d.ts +5 -0
- package/dist/firestore/src/lite-api/transaction.d.ts +4 -0
- package/dist/firestore/src/lite-api/write_batch.d.ts +3 -0
- package/dist/firestore/src/local/indexeddb_remote_document_cache.d.ts +5 -0
- package/dist/firestore/src/model/collections.d.ts +0 -4
- package/dist/firestore/src/model/document.d.ts +3 -1
- package/dist/firestore/src/model/values.d.ts +3 -0
- package/dist/index.d.ts +11 -2
- package/dist/index.esm2017.js +161 -159
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +70 -68
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +13 -7
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +13 -7
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +720 -718
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +15 -3
- package/dist/lite/firestore/src/index/directional_index_byte_encoder.d.ts +24 -0
- package/dist/lite/firestore/src/index/firestore_index_value_writer.d.ts +33 -0
- package/dist/lite/firestore/src/index/index_byte_encoder.d.ts +14 -0
- package/dist/lite/firestore/src/index/ordered_code_writer.d.ts +14 -0
- package/dist/lite/firestore/src/lite-api/reference.d.ts +4 -2
- package/dist/lite/firestore/src/lite-api/reference_impl.d.ts +5 -0
- package/dist/lite/firestore/src/lite-api/transaction.d.ts +4 -0
- package/dist/lite/firestore/src/lite-api/write_batch.d.ts +3 -0
- package/dist/lite/firestore/src/local/indexeddb_remote_document_cache.d.ts +5 -0
- package/dist/lite/firestore/src/model/collections.d.ts +0 -4
- package/dist/lite/firestore/src/model/document.d.ts +3 -1
- package/dist/lite/firestore/src/model/values.d.ts +3 -0
- package/dist/lite/index.browser.esm2017.js +6 -3
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +6 -3
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.d.ts +16 -2
- package/dist/lite/index.node.cjs.js +10 -3
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +10 -3
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +63 -60
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +83 -2
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +1 -0
- package/dist/lite/packages/firestore/src/index/directional_index_byte_encoder.d.ts +24 -0
- package/dist/lite/packages/firestore/src/index/firestore_index_value_writer.d.ts +33 -0
- package/dist/lite/packages/firestore/src/index/index_byte_encoder.d.ts +14 -0
- package/dist/lite/packages/firestore/src/index/ordered_code_writer.d.ts +14 -0
- package/dist/lite/packages/firestore/src/lite-api/reference.d.ts +4 -2
- package/dist/lite/packages/firestore/src/lite-api/reference_impl.d.ts +5 -0
- package/dist/lite/packages/firestore/src/lite-api/transaction.d.ts +4 -0
- package/dist/lite/packages/firestore/src/lite-api/write_batch.d.ts +3 -0
- package/dist/lite/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +5 -0
- package/dist/lite/packages/firestore/src/model/collections.d.ts +0 -4
- package/dist/lite/packages/firestore/src/model/document.d.ts +3 -1
- package/dist/lite/packages/firestore/src/model/values.d.ts +3 -0
- package/dist/lite/private.d.ts +83 -2
- package/dist/packages/firestore/dist/index.esm2017.d.ts +21 -21
- package/dist/packages/firestore/src/index/directional_index_byte_encoder.d.ts +24 -0
- package/dist/packages/firestore/src/index/firestore_index_value_writer.d.ts +33 -0
- package/dist/packages/firestore/src/index/index_byte_encoder.d.ts +14 -0
- package/dist/packages/firestore/src/index/ordered_code_writer.d.ts +14 -0
- package/dist/packages/firestore/src/lite-api/reference.d.ts +4 -2
- package/dist/packages/firestore/src/lite-api/reference_impl.d.ts +5 -0
- package/dist/packages/firestore/src/lite-api/transaction.d.ts +4 -0
- package/dist/packages/firestore/src/lite-api/write_batch.d.ts +3 -0
- package/dist/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +5 -0
- package/dist/packages/firestore/src/model/collections.d.ts +0 -4
- package/dist/packages/firestore/src/model/document.d.ts +3 -1
- package/dist/packages/firestore/src/model/values.d.ts +3 -0
- package/dist/private.d.ts +15 -3
- package/package.json +9 -9
package/dist/index.esm2017.js
CHANGED
|
@@ -66,7 +66,7 @@ D.MOCK_USER = new D("mock-user");
|
|
|
66
66
|
* See the License for the specific language governing permissions and
|
|
67
67
|
* limitations under the License.
|
|
68
68
|
*/
|
|
69
|
-
let C = "9.6.1-
|
|
69
|
+
let C = "9.6.1-canary.3d8109ca3";
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* @license
|
|
@@ -1408,7 +1408,7 @@ function Rt(t) {
|
|
|
1408
1408
|
|
|
1409
1409
|
/**
|
|
1410
1410
|
* Returns the local time at which this timestamp was first set.
|
|
1411
|
-
*/ function
|
|
1411
|
+
*/ function bt(t) {
|
|
1412
1412
|
const e = Tt(t.mapValue.fields.__local_write_time__.timestampValue);
|
|
1413
1413
|
return new at(e.seconds, e.nanos);
|
|
1414
1414
|
}
|
|
@@ -1433,7 +1433,7 @@ function Rt(t) {
|
|
|
1433
1433
|
/**
|
|
1434
1434
|
* Returns whether a variable is either undefined or null.
|
|
1435
1435
|
*/
|
|
1436
|
-
function
|
|
1436
|
+
function Pt(t) {
|
|
1437
1437
|
return null == t;
|
|
1438
1438
|
}
|
|
1439
1439
|
|
|
@@ -1524,6 +1524,7 @@ function bt(t) {
|
|
|
1524
1524
|
}
|
|
1525
1525
|
|
|
1526
1526
|
/** Tests `left` and `right` for equality based on the backend semantics. */ function Ct(t, e) {
|
|
1527
|
+
if (t === e) return !0;
|
|
1527
1528
|
const n = Dt(t);
|
|
1528
1529
|
if (n !== Dt(e)) return !1;
|
|
1529
1530
|
switch (n) {
|
|
@@ -1534,7 +1535,7 @@ function bt(t) {
|
|
|
1534
1535
|
return t.booleanValue === e.booleanValue;
|
|
1535
1536
|
|
|
1536
1537
|
case 4 /* ServerTimestampValue */ :
|
|
1537
|
-
return
|
|
1538
|
+
return bt(t).isEqual(bt(e));
|
|
1538
1539
|
|
|
1539
1540
|
case 3 /* TimestampValue */ :
|
|
1540
1541
|
return function(t, e) {
|
|
@@ -1593,6 +1594,7 @@ function Nt(t, e) {
|
|
|
1593
1594
|
}
|
|
1594
1595
|
|
|
1595
1596
|
function kt(t, e) {
|
|
1597
|
+
if (t === e) return 0;
|
|
1596
1598
|
const n = Dt(t), s = Dt(e);
|
|
1597
1599
|
if (n !== s) return it(n, s);
|
|
1598
1600
|
switch (n) {
|
|
@@ -1614,7 +1616,7 @@ function kt(t, e) {
|
|
|
1614
1616
|
return xt(t.timestampValue, e.timestampValue);
|
|
1615
1617
|
|
|
1616
1618
|
case 4 /* ServerTimestampValue */ :
|
|
1617
|
-
return xt(
|
|
1619
|
+
return xt(bt(t), bt(e));
|
|
1618
1620
|
|
|
1619
1621
|
case 5 /* StringValue */ :
|
|
1620
1622
|
return it(t.stringValue, e.stringValue);
|
|
@@ -1997,7 +1999,7 @@ function Lt(t) {
|
|
|
1997
1999
|
isEqual(t) {
|
|
1998
2000
|
return t instanceof Wt && this.key.isEqual(t.key) && this.version.isEqual(t.version) && this.documentType === t.documentType && this.documentState === t.documentState && this.data.isEqual(t.data);
|
|
1999
2001
|
}
|
|
2000
|
-
|
|
2002
|
+
mutableCopy() {
|
|
2001
2003
|
return new Wt(this.key, this.documentType, this.version, this.data.clone(), this.documentState);
|
|
2002
2004
|
}
|
|
2003
2005
|
toString() {
|
|
@@ -2052,7 +2054,7 @@ function Ht(t) {
|
|
|
2052
2054
|
t += "|ob:", t += e.orderBy.map((t => function(t) {
|
|
2053
2055
|
// TODO(b/29183165): Make this collision robust.
|
|
2054
2056
|
return t.field.canonicalString() + t.dir;
|
|
2055
|
-
}(t))).join(","),
|
|
2057
|
+
}(t))).join(","), Pt(e.limit) || (t += "|l:", t += e.limit), e.startAt && (t += "|lb:",
|
|
2056
2058
|
t += he(e.startAt)), e.endAt && (t += "|ub:", t += he(e.endAt)), e.R = t;
|
|
2057
2059
|
}
|
|
2058
2060
|
return e.R;
|
|
@@ -2066,7 +2068,7 @@ function Jt(t) {
|
|
|
2066
2068
|
/** Returns a debug description for `filter`. */
|
|
2067
2069
|
var e;
|
|
2068
2070
|
/** Filter that matches on key fields (i.e. '__name__'). */ })).join(", ")}]`),
|
|
2069
|
-
|
|
2071
|
+
Pt(t.limit) || (e += ", limit: " + t.limit), t.orderBy.length > 0 && (e += `, orderBy: [${t.orderBy.map((t => function(t) {
|
|
2070
2072
|
return `${t.field.canonicalString()} (${t.dir})`;
|
|
2071
2073
|
}(t))).join(", ")}]`), t.startAt && (e += ", startAt: " + he(t.startAt)), t.endAt && (e += ", endAt: " + he(t.endAt)),
|
|
2072
2074
|
`Target(${e})`;
|
|
@@ -2327,11 +2329,11 @@ function we(t, e) {
|
|
|
2327
2329
|
* we have to split the query into a set of collection queries at multiple
|
|
2328
2330
|
* paths.
|
|
2329
2331
|
*/ function ye(t) {
|
|
2330
|
-
return !
|
|
2332
|
+
return !Pt(t.limit) && "F" /* First */ === t.limitType;
|
|
2331
2333
|
}
|
|
2332
2334
|
|
|
2333
2335
|
function pe(t) {
|
|
2334
|
-
return !
|
|
2336
|
+
return !Pt(t.limit) && "L" /* Last */ === t.limitType;
|
|
2335
2337
|
}
|
|
2336
2338
|
|
|
2337
2339
|
function Te(t) {
|
|
@@ -2401,11 +2403,11 @@ function Ie(t) {
|
|
|
2401
2403
|
return e.D;
|
|
2402
2404
|
}
|
|
2403
2405
|
|
|
2404
|
-
function
|
|
2406
|
+
function be(t, e, n) {
|
|
2405
2407
|
return new _e(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
|
|
2406
2408
|
}
|
|
2407
2409
|
|
|
2408
|
-
function
|
|
2410
|
+
function Pe(t, e) {
|
|
2409
2411
|
return Yt(Re(t), Re(e)) && t.limitType === e.limitType;
|
|
2410
2412
|
}
|
|
2411
2413
|
|
|
@@ -3669,14 +3671,14 @@ function An() {
|
|
|
3669
3671
|
|
|
3670
3672
|
const Rn = new gn(St.comparator);
|
|
3671
3673
|
|
|
3672
|
-
function
|
|
3674
|
+
function bn() {
|
|
3673
3675
|
return Rn;
|
|
3674
3676
|
}
|
|
3675
3677
|
|
|
3676
|
-
const
|
|
3678
|
+
const Pn = new gn(St.comparator);
|
|
3677
3679
|
|
|
3678
3680
|
function vn() {
|
|
3679
|
-
return
|
|
3681
|
+
return Pn;
|
|
3680
3682
|
}
|
|
3681
3683
|
|
|
3682
3684
|
const Vn = new Tn(St.comparator);
|
|
@@ -4601,7 +4603,7 @@ function hs(t, e) {
|
|
|
4601
4603
|
}(e.orderBy);
|
|
4602
4604
|
r && (n.structuredQuery.orderBy = r);
|
|
4603
4605
|
const o = function(t, e) {
|
|
4604
|
-
return t.C ||
|
|
4606
|
+
return t.C || Pt(e) ? e : {
|
|
4605
4607
|
value: e
|
|
4606
4608
|
};
|
|
4607
4609
|
}
|
|
@@ -4645,7 +4647,7 @@ function ls(t) {
|
|
|
4645
4647
|
let a = null;
|
|
4646
4648
|
n.limit && (a = function(t) {
|
|
4647
4649
|
let e;
|
|
4648
|
-
return e = "object" == typeof t ? t.value : t,
|
|
4650
|
+
return e = "object" == typeof t ? t.value : t, Pt(e) ? null : e;
|
|
4649
4651
|
}(n.limit));
|
|
4650
4652
|
let c = null;
|
|
4651
4653
|
n.startAt && (c = _s(n.startAt));
|
|
@@ -4812,11 +4814,11 @@ function As(t) {
|
|
|
4812
4814
|
*/
|
|
4813
4815
|
function Rs(t) {
|
|
4814
4816
|
let e = "";
|
|
4815
|
-
for (let n = 0; n < t.length; n++) e.length > 0 && (e =
|
|
4816
|
-
return
|
|
4817
|
+
for (let n = 0; n < t.length; n++) e.length > 0 && (e = Ps(e)), e = bs(t.get(n), e);
|
|
4818
|
+
return Ps(e);
|
|
4817
4819
|
}
|
|
4818
4820
|
|
|
4819
|
-
/** Encodes a single segment of a resource path into the given result */ function
|
|
4821
|
+
/** Encodes a single segment of a resource path into the given result */ function bs(t, e) {
|
|
4820
4822
|
let n = e;
|
|
4821
4823
|
const s = t.length;
|
|
4822
4824
|
for (let e = 0; e < s; e++) {
|
|
@@ -4837,7 +4839,7 @@ function Rs(t) {
|
|
|
4837
4839
|
return n;
|
|
4838
4840
|
}
|
|
4839
4841
|
|
|
4840
|
-
/** Encodes a path separator into the given result */ function
|
|
4842
|
+
/** Encodes a path separator into the given result */ function Ps(t) {
|
|
4841
4843
|
return t + "";
|
|
4842
4844
|
}
|
|
4843
4845
|
|
|
@@ -5691,12 +5693,12 @@ class zs {
|
|
|
5691
5693
|
// bug we're checking for should exist in iOS >= 12.2 and < 13, but for
|
|
5692
5694
|
// whatever reason it's much harder to hit after 12.2 so we only proactively
|
|
5693
5695
|
// log on 12.2.
|
|
5694
|
-
12.2 === Hs.
|
|
5696
|
+
12.2 === Hs.bt(getUA()) && F("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.");
|
|
5695
5697
|
}
|
|
5696
5698
|
/** Deletes the specified database. */ static delete(t) {
|
|
5697
5699
|
return $("SimpleDb", "Removing database:", t), ti(window.indexedDB.deleteDatabase(t)).toPromise();
|
|
5698
5700
|
}
|
|
5699
|
-
/** Returns true if IndexedDB is available in the current environment. */ static
|
|
5701
|
+
/** Returns true if IndexedDB is available in the current environment. */ static Pt() {
|
|
5700
5702
|
if (!isIndexedDBAvailable()) return !1;
|
|
5701
5703
|
if (Hs.vt()) return !0;
|
|
5702
5704
|
// We extensively use indexed array values and compound keys,
|
|
@@ -5706,7 +5708,7 @@ class zs {
|
|
|
5706
5708
|
// For tracking support of this feature, see here:
|
|
5707
5709
|
// https://developer.microsoft.com/en-us/microsoft-edge/platform/status/indexeddbarraysandmultientrysupport/
|
|
5708
5710
|
// Check the UA string to find out the browser.
|
|
5709
|
-
const t = getUA(), e = Hs.
|
|
5711
|
+
const t = getUA(), e = Hs.bt(t), n = 0 < e && e < 10, s = Hs.Vt(t), i = 0 < s && s < 4.5;
|
|
5710
5712
|
// IE 10
|
|
5711
5713
|
// ua = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)';
|
|
5712
5714
|
// IE 11
|
|
@@ -5729,7 +5731,7 @@ class zs {
|
|
|
5729
5731
|
}
|
|
5730
5732
|
// visible for testing
|
|
5731
5733
|
/** Parse User Agent to determine iOS version. Returns -1 if not found. */
|
|
5732
|
-
static
|
|
5734
|
+
static bt(t) {
|
|
5733
5735
|
const e = t.match(/i(?:phone|pad|pod) os ([\d_]+)/i), n = e ? e[1].split("_").slice(0, 2).join(".") : "-1";
|
|
5734
5736
|
return Number(n);
|
|
5735
5737
|
}
|
|
@@ -5999,7 +6001,7 @@ class zs {
|
|
|
5999
6001
|
let ei = !1;
|
|
6000
6002
|
|
|
6001
6003
|
function ni(t) {
|
|
6002
|
-
const e = Hs.
|
|
6004
|
+
const e = Hs.bt(getUA());
|
|
6003
6005
|
if (e >= 12.2 && e < 13) {
|
|
6004
6006
|
const e = "An internal error was encountered in the Indexed Database server";
|
|
6005
6007
|
if (t.message.indexOf(e) >= 0) {
|
|
@@ -6354,7 +6356,7 @@ function yi(t) {
|
|
|
6354
6356
|
parent: t.parent,
|
|
6355
6357
|
structuredQuery: t.structuredQuery
|
|
6356
6358
|
});
|
|
6357
|
-
return "LAST" === t.limitType ?
|
|
6359
|
+
return "LAST" === t.limitType ? be(e, e.limit, "L" /* Last */) : e;
|
|
6358
6360
|
}
|
|
6359
6361
|
|
|
6360
6362
|
/** Encodes a NamedQuery proto object to a NamedQuery model object. */
|
|
@@ -6526,7 +6528,7 @@ class pi {
|
|
|
6526
6528
|
collectionId: n,
|
|
6527
6529
|
parent: Rs(s)
|
|
6528
6530
|
};
|
|
6529
|
-
return
|
|
6531
|
+
return bi(t).put(i);
|
|
6530
6532
|
}
|
|
6531
6533
|
return Gs.resolve();
|
|
6532
6534
|
}
|
|
@@ -6534,7 +6536,7 @@ class pi {
|
|
|
6534
6536
|
const n = [], s = IDBKeyRange.bound([ e, "" ], [ ot(e), "" ],
|
|
6535
6537
|
/*lowerOpen=*/ !1,
|
|
6536
6538
|
/*upperOpen=*/ !0);
|
|
6537
|
-
return
|
|
6539
|
+
return bi(t).Bt(s).next((t => {
|
|
6538
6540
|
for (const s of t) {
|
|
6539
6541
|
// This collectionId guard shouldn't be necessary (and isn't as long
|
|
6540
6542
|
// as we're running in a real browser), but there's a bug in
|
|
@@ -6551,7 +6553,7 @@ class pi {
|
|
|
6551
6553
|
/**
|
|
6552
6554
|
* Helper to get a typed SimpleDbStore for the collectionParents
|
|
6553
6555
|
* document store.
|
|
6554
|
-
*/ function
|
|
6556
|
+
*/ function bi(t) {
|
|
6555
6557
|
return ii(t, Bs.store);
|
|
6556
6558
|
}
|
|
6557
6559
|
|
|
@@ -6570,7 +6572,7 @@ class pi {
|
|
|
6570
6572
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
6571
6573
|
* See the License for the specific language governing permissions and
|
|
6572
6574
|
* limitations under the License.
|
|
6573
|
-
*/ const
|
|
6575
|
+
*/ const Pi = {
|
|
6574
6576
|
didRun: !1,
|
|
6575
6577
|
sequenceNumbersCollected: 0,
|
|
6576
6578
|
targetsRemoved: 0,
|
|
@@ -7309,8 +7311,8 @@ class $i {
|
|
|
7309
7311
|
}
|
|
7310
7312
|
collect(t, e) {
|
|
7311
7313
|
return -1 === this.params.cacheSizeCollectionThreshold ? ($("LruGarbageCollector", "Garbage collection skipped; disabled"),
|
|
7312
|
-
Gs.resolve(
|
|
7313
|
-
|
|
7314
|
+
Gs.resolve(Pi)) : this.getCacheSize(t).next((n => n < this.params.cacheSizeCollectionThreshold ? ($("LruGarbageCollector", `Garbage collection skipped; Cache size ${n} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),
|
|
7315
|
+
Pi) : this.Te(t, e)));
|
|
7314
7316
|
}
|
|
7315
7317
|
getCacheSize(t) {
|
|
7316
7318
|
return this.ge.getCacheSize(t);
|
|
@@ -7682,23 +7684,23 @@ function Wi(t, e) {
|
|
|
7682
7684
|
return this.getMetadata(t).next((n => (n.byteSize += e, this.Re(t, n))));
|
|
7683
7685
|
}
|
|
7684
7686
|
getEntry(t, e) {
|
|
7685
|
-
return Xi(t).get(Zi(e)).next((t => this.
|
|
7687
|
+
return Xi(t).get(Zi(e)).next((t => this.be(e, t)));
|
|
7686
7688
|
}
|
|
7687
7689
|
/**
|
|
7688
7690
|
* Looks up an entry in the cache.
|
|
7689
7691
|
*
|
|
7690
7692
|
* @param documentKey - The key of the entry to look up.
|
|
7691
7693
|
* @returns The cached document entry and its size.
|
|
7692
|
-
*/
|
|
7694
|
+
*/ Pe(t, e) {
|
|
7693
7695
|
return Xi(t).get(Zi(e)).next((t => ({
|
|
7694
|
-
document: this.
|
|
7696
|
+
document: this.be(e, t),
|
|
7695
7697
|
size: Si(t)
|
|
7696
7698
|
})));
|
|
7697
7699
|
}
|
|
7698
7700
|
getEntries(t, e) {
|
|
7699
7701
|
let n = An();
|
|
7700
7702
|
return this.ve(t, e, ((t, e) => {
|
|
7701
|
-
const s = this.
|
|
7703
|
+
const s = this.be(t, e);
|
|
7702
7704
|
n = n.insert(t, s);
|
|
7703
7705
|
})).next((() => n));
|
|
7704
7706
|
}
|
|
@@ -7711,7 +7713,7 @@ function Wi(t, e) {
|
|
|
7711
7713
|
*/ Ve(t, e) {
|
|
7712
7714
|
let n = An(), s = new gn(St.comparator);
|
|
7713
7715
|
return this.ve(t, e, ((t, e) => {
|
|
7714
|
-
const i = this.
|
|
7716
|
+
const i = this.be(t, e);
|
|
7715
7717
|
n = n.insert(t, i), s = s.insert(t, Si(e));
|
|
7716
7718
|
})).next((() => ({
|
|
7717
7719
|
documents: n,
|
|
@@ -7781,7 +7783,7 @@ function Wi(t, e) {
|
|
|
7781
7783
|
/**
|
|
7782
7784
|
* Decodes `remoteDoc` and returns the document (or null, if the document
|
|
7783
7785
|
* corresponds to the format used for sentinel deletes).
|
|
7784
|
-
*/
|
|
7786
|
+
*/ be(t, e) {
|
|
7785
7787
|
if (e) {
|
|
7786
7788
|
const t = ui(this.k, e);
|
|
7787
7789
|
// Whether the document is a sentinel removal and should only be used in the
|
|
@@ -7840,7 +7842,7 @@ class Ji extends zi {
|
|
|
7840
7842
|
}
|
|
7841
7843
|
getFromCache(t, e) {
|
|
7842
7844
|
// Record the size of everything we load from the cache so we can compute a delta later.
|
|
7843
|
-
return this.De.
|
|
7845
|
+
return this.De.Pe(t, e).next((t => (this.Ce.set(e, t.size), t.document)));
|
|
7844
7846
|
}
|
|
7845
7847
|
getAllFromCache(t, e) {
|
|
7846
7848
|
// Record the size of everything we load from the cache so we can compute
|
|
@@ -8173,7 +8175,7 @@ class sr {
|
|
|
8173
8175
|
/** The last time we garbage collected the client metadata object store. */
|
|
8174
8176
|
this.Qe = Number.NEGATIVE_INFINITY,
|
|
8175
8177
|
/** A listener to notify on primary state changes. */
|
|
8176
|
-
this.We = t => Promise.resolve(), !sr.
|
|
8178
|
+
this.We = t => Promise.resolve(), !sr.Pt()) throw new j(K.UNIMPLEMENTED, "This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");
|
|
8177
8179
|
this.referenceDelegate = new Qi(this, s), this.Ge = e + "main", this.k = new ci(a),
|
|
8178
8180
|
this.ze = new Hs(this.Ge, 11, new tr(this.k)), this.He = new Fi(this.referenceDelegate, this.k),
|
|
8179
8181
|
this.Jt = new Ri, this.Je = function(t, e) {
|
|
@@ -8429,8 +8431,8 @@ class sr {
|
|
|
8429
8431
|
const e = new Ss(this.clientId, this.allowTabSynchronization, Date.now());
|
|
8430
8432
|
return ir(t).put(Ss.key, e);
|
|
8431
8433
|
}
|
|
8432
|
-
static
|
|
8433
|
-
return Hs.
|
|
8434
|
+
static Pt() {
|
|
8435
|
+
return Hs.Pt();
|
|
8434
8436
|
}
|
|
8435
8437
|
/** Checks the primary lease and removes it if we are the current primary. */ an(t) {
|
|
8436
8438
|
const e = ir(t);
|
|
@@ -8593,9 +8595,9 @@ class ar {
|
|
|
8593
8595
|
* @returns Local view of the document or null if we don't have any cached
|
|
8594
8596
|
* state for it.
|
|
8595
8597
|
*/ Rn(t, e) {
|
|
8596
|
-
return this.An.getAllMutationBatchesAffectingDocumentKey(t, e).next((n => this.
|
|
8598
|
+
return this.An.getAllMutationBatchesAffectingDocumentKey(t, e).next((n => this.bn(t, e, n)));
|
|
8597
8599
|
}
|
|
8598
|
-
/** Internal version of `getDocument` that allows reusing batches. */
|
|
8600
|
+
/** Internal version of `getDocument` that allows reusing batches. */ bn(t, e, n) {
|
|
8599
8601
|
return this.Je.getEntry(t, e).next((t => {
|
|
8600
8602
|
for (const e of n) e.applyToLocalView(t);
|
|
8601
8603
|
return t;
|
|
@@ -8603,7 +8605,7 @@ class ar {
|
|
|
8603
8605
|
}
|
|
8604
8606
|
// Returns the view of the given `docs` as they would appear after applying
|
|
8605
8607
|
// all mutations in the given `batches`.
|
|
8606
|
-
|
|
8608
|
+
Pn(t, e) {
|
|
8607
8609
|
t.forEach(((t, n) => {
|
|
8608
8610
|
for (const t of e) t.applyToLocalView(n);
|
|
8609
8611
|
}));
|
|
@@ -8620,7 +8622,7 @@ class ar {
|
|
|
8620
8622
|
* Applies the local view the given `baseDocs` without retrieving documents
|
|
8621
8623
|
* from the local store.
|
|
8622
8624
|
*/ Vn(t, e) {
|
|
8623
|
-
return this.An.getAllMutationBatchesAffectingDocumentKeys(t, e).next((t => this.
|
|
8625
|
+
return this.An.getAllMutationBatchesAffectingDocumentKeys(t, e).next((t => this.Pn(e, t)));
|
|
8624
8626
|
}
|
|
8625
8627
|
/**
|
|
8626
8628
|
* Performs a query against the local view of all documents.
|
|
@@ -8641,13 +8643,13 @@ class ar {
|
|
|
8641
8643
|
Sn(t, e) {
|
|
8642
8644
|
// Just do a simple document lookup.
|
|
8643
8645
|
return this.Rn(t, new St(e)).next((t => {
|
|
8644
|
-
let e =
|
|
8646
|
+
let e = bn();
|
|
8645
8647
|
return t.isFoundDocument() && (e = e.insert(t.key, t)), e;
|
|
8646
8648
|
}));
|
|
8647
8649
|
}
|
|
8648
8650
|
Dn(t, e, n) {
|
|
8649
8651
|
const s = e.collectionGroup;
|
|
8650
|
-
let i =
|
|
8652
|
+
let i = bn();
|
|
8651
8653
|
return this.Jt.getCollectionParents(t, s).next((r => Gs.forEach(r, (r => {
|
|
8652
8654
|
const o = function(t, e) {
|
|
8653
8655
|
return new _e(e,
|
|
@@ -9279,7 +9281,7 @@ async function Rr(t) {
|
|
|
9279
9281
|
* LocalDocuments are re-calculated if there are remaining mutations in the
|
|
9280
9282
|
* queue.
|
|
9281
9283
|
*/
|
|
9282
|
-
async function
|
|
9284
|
+
async function br(t, e, n, s) {
|
|
9283
9285
|
const i = q(t);
|
|
9284
9286
|
let r = Sn(), o = An(), a = vn();
|
|
9285
9287
|
for (const t of n) {
|
|
@@ -9306,7 +9308,7 @@ async function Pr(t, e, n, s) {
|
|
|
9306
9308
|
/**
|
|
9307
9309
|
* Saves the given `NamedQuery` to local persistence.
|
|
9308
9310
|
*/
|
|
9309
|
-
async function
|
|
9311
|
+
async function Pr(t, e, n = Sn()) {
|
|
9310
9312
|
// Allocate a target for the named query such that it can be resumed
|
|
9311
9313
|
// from associated read time if users use it to listen.
|
|
9312
9314
|
// NOTE: this also means if no corresponding target exists, the new target
|
|
@@ -9669,7 +9671,7 @@ class Cr {
|
|
|
9669
9671
|
*/ addEntry(t, e, n) {
|
|
9670
9672
|
const s = e.key, i = this.docs.get(s), r = i ? i.size : 0, o = this.Ts(e);
|
|
9671
9673
|
return this.docs = this.docs.insert(s, {
|
|
9672
|
-
document: e.
|
|
9674
|
+
document: e.mutableCopy(),
|
|
9673
9675
|
size: o,
|
|
9674
9676
|
readTime: n
|
|
9675
9677
|
}), this.size += o - r, this.Jt.addToCollectionParentIndex(t, s.path.popLast());
|
|
@@ -9685,13 +9687,13 @@ class Cr {
|
|
|
9685
9687
|
}
|
|
9686
9688
|
getEntry(t, e) {
|
|
9687
9689
|
const n = this.docs.get(e);
|
|
9688
|
-
return Gs.resolve(n ? n.document.
|
|
9690
|
+
return Gs.resolve(n ? n.document.mutableCopy() : Wt.newInvalidDocument(e));
|
|
9689
9691
|
}
|
|
9690
9692
|
getEntries(t, e) {
|
|
9691
9693
|
let n = An();
|
|
9692
9694
|
return e.forEach((t => {
|
|
9693
9695
|
const e = this.docs.get(t);
|
|
9694
|
-
n = n.insert(t, e ? e.document.
|
|
9696
|
+
n = n.insert(t, e ? e.document.mutableCopy() : Wt.newInvalidDocument(t));
|
|
9695
9697
|
})), Gs.resolve(n);
|
|
9696
9698
|
}
|
|
9697
9699
|
getDocumentsMatchingQuery(t, e, n) {
|
|
@@ -9702,7 +9704,7 @@ class Cr {
|
|
|
9702
9704
|
for (;r.hasNext(); ) {
|
|
9703
9705
|
const {key: t, value: {document: i, readTime: o}} = r.getNext();
|
|
9704
9706
|
if (!e.path.isPrefixOf(t.path)) break;
|
|
9705
|
-
o.compareTo(n) <= 0 || Se(e, i) && (s = s.insert(i.key, i.
|
|
9707
|
+
o.compareTo(n) <= 0 || Se(e, i) && (s = s.insert(i.key, i.mutableCopy()));
|
|
9706
9708
|
}
|
|
9707
9709
|
return Gs.resolve(s);
|
|
9708
9710
|
}
|
|
@@ -9780,7 +9782,7 @@ class Nr extends zi {
|
|
|
9780
9782
|
* A ordered bidirectional mapping between documents and the remote target
|
|
9781
9783
|
* IDs.
|
|
9782
9784
|
*/
|
|
9783
|
-
this.Rs = new Vr, this.targetCount = 0, this.
|
|
9785
|
+
this.Rs = new Vr, this.targetCount = 0, this.bs = $i.ie();
|
|
9784
9786
|
}
|
|
9785
9787
|
forEachTarget(t, e) {
|
|
9786
9788
|
return this.Is.forEach(((t, n) => e(n))), Gs.resolve();
|
|
@@ -9792,7 +9794,7 @@ class Nr extends zi {
|
|
|
9792
9794
|
return Gs.resolve(this.As);
|
|
9793
9795
|
}
|
|
9794
9796
|
allocateTargetId(t) {
|
|
9795
|
-
return this.highestTargetId = this.
|
|
9797
|
+
return this.highestTargetId = this.bs.next(), Gs.resolve(this.highestTargetId);
|
|
9796
9798
|
}
|
|
9797
9799
|
setTargetsMetadata(t, e, n) {
|
|
9798
9800
|
return n && (this.lastRemoteSnapshotVersion = n), e > this.As && (this.As = e),
|
|
@@ -9801,7 +9803,7 @@ class Nr extends zi {
|
|
|
9801
9803
|
ce(t) {
|
|
9802
9804
|
this.Is.set(t.target, t);
|
|
9803
9805
|
const e = t.targetId;
|
|
9804
|
-
e > this.highestTargetId && (this.
|
|
9806
|
+
e > this.highestTargetId && (this.bs = new $i(e), this.highestTargetId = e), t.sequenceNumber > this.As && (this.As = t.sequenceNumber);
|
|
9805
9807
|
}
|
|
9806
9808
|
addTargetData(t, e) {
|
|
9807
9809
|
return this.ce(e), this.targetCount += 1, Gs.resolve();
|
|
@@ -9878,7 +9880,7 @@ class xr {
|
|
|
9878
9880
|
* checked or asserted on every access.
|
|
9879
9881
|
*/
|
|
9880
9882
|
constructor(t, e) {
|
|
9881
|
-
this.
|
|
9883
|
+
this.Ps = {}, this.Be = new et(0), this.Ue = !1, this.Ue = !0, this.referenceDelegate = t(this),
|
|
9882
9884
|
this.He = new kr(this);
|
|
9883
9885
|
this.Jt = new Ii, this.Je = function(t, e) {
|
|
9884
9886
|
return new Cr(t, e);
|
|
@@ -9904,8 +9906,8 @@ class xr {
|
|
|
9904
9906
|
return this.Jt;
|
|
9905
9907
|
}
|
|
9906
9908
|
getMutationQueue(t) {
|
|
9907
|
-
let e = this.
|
|
9908
|
-
return e || (e = new Dr(this.Jt, this.referenceDelegate), this.
|
|
9909
|
+
let e = this.Ps[t.toKey()];
|
|
9910
|
+
return e || (e = new Dr(this.Jt, this.referenceDelegate), this.Ps[t.toKey()] = e),
|
|
9909
9911
|
e;
|
|
9910
9912
|
}
|
|
9911
9913
|
getTargetCache() {
|
|
@@ -9924,7 +9926,7 @@ class xr {
|
|
|
9924
9926
|
t)));
|
|
9925
9927
|
}
|
|
9926
9928
|
Ds(t, e) {
|
|
9927
|
-
return Gs.or(Object.values(this.
|
|
9929
|
+
return Gs.or(Object.values(this.Ps).map((n => () => n.containsKey(t, e))));
|
|
9928
9930
|
}
|
|
9929
9931
|
}
|
|
9930
9932
|
|
|
@@ -10237,7 +10239,7 @@ class jr {
|
|
|
10237
10239
|
// mutations but before we observe WebStorage events.
|
|
10238
10240
|
this.window.addEventListener("storage", this.Us);
|
|
10239
10241
|
}
|
|
10240
|
-
/** Returns 'true' if WebStorage is available in the current environment. */ static
|
|
10242
|
+
/** Returns 'true' if WebStorage is available in the current environment. */ static Pt(t) {
|
|
10241
10243
|
return !(!t || !t.localStorage);
|
|
10242
10244
|
}
|
|
10243
10245
|
async start() {
|
|
@@ -10583,10 +10585,10 @@ class Wr {
|
|
|
10583
10585
|
*/
|
|
10584
10586
|
class zr {
|
|
10585
10587
|
constructor() {
|
|
10586
|
-
this.Ii = () => this.Ai(), this.Ri = () => this.
|
|
10588
|
+
this.Ii = () => this.Ai(), this.Ri = () => this.bi(), this.Pi = [], this.vi();
|
|
10587
10589
|
}
|
|
10588
10590
|
Ei(t) {
|
|
10589
|
-
this.
|
|
10591
|
+
this.Pi.push(t);
|
|
10590
10592
|
}
|
|
10591
10593
|
shutdown() {
|
|
10592
10594
|
window.removeEventListener("online", this.Ii), window.removeEventListener("offline", this.Ri);
|
|
@@ -10596,16 +10598,16 @@ class zr {
|
|
|
10596
10598
|
}
|
|
10597
10599
|
Ai() {
|
|
10598
10600
|
$("ConnectivityMonitor", "Network connectivity changed: AVAILABLE");
|
|
10599
|
-
for (const t of this.
|
|
10601
|
+
for (const t of this.Pi) t(0 /* AVAILABLE */);
|
|
10600
10602
|
}
|
|
10601
|
-
|
|
10603
|
+
bi() {
|
|
10602
10604
|
$("ConnectivityMonitor", "Network connectivity changed: UNAVAILABLE");
|
|
10603
|
-
for (const t of this.
|
|
10605
|
+
for (const t of this.Pi) t(1 /* UNAVAILABLE */);
|
|
10604
10606
|
}
|
|
10605
10607
|
// TODO(chenbrian): Consider passing in window either into this component or
|
|
10606
10608
|
// here for testing via FakeWindow.
|
|
10607
10609
|
/** Checks that all used attributes of window are available. */
|
|
10608
|
-
static
|
|
10610
|
+
static Pt() {
|
|
10609
10611
|
return "undefined" != typeof window && void 0 !== window.addEventListener && void 0 !== window.removeEventListener;
|
|
10610
10612
|
}
|
|
10611
10613
|
}
|
|
@@ -11327,14 +11329,14 @@ class no {
|
|
|
11327
11329
|
const e = t.targetChange;
|
|
11328
11330
|
return e.targetIds && e.targetIds.length ? ct.min() : e.readTime ? Gn(e.readTime) : ct.min();
|
|
11329
11331
|
}(t);
|
|
11330
|
-
return this.listener.
|
|
11332
|
+
return this.listener.br(e, n);
|
|
11331
11333
|
}
|
|
11332
11334
|
/**
|
|
11333
11335
|
* Registers interest in the results of the given target. If the target
|
|
11334
11336
|
* includes a resumeToken it will be included in the request. Results that
|
|
11335
11337
|
* affect the target will be streamed back as WatchChange messages that
|
|
11336
11338
|
* reference the targetId.
|
|
11337
|
-
*/
|
|
11339
|
+
*/ Pr(t) {
|
|
11338
11340
|
const e = {};
|
|
11339
11341
|
e.database = ts(this.k), e.addTarget = function(t, e) {
|
|
11340
11342
|
let n;
|
|
@@ -11683,7 +11685,7 @@ function ho(t, e) {
|
|
|
11683
11685
|
* We need to increment the the expected number of pending responses we're due
|
|
11684
11686
|
* from watch so we wait for the ack to process any messages from this target.
|
|
11685
11687
|
*/ function fo(t, e) {
|
|
11686
|
-
t.Yr.X(e.targetId), xo(t).
|
|
11688
|
+
t.Yr.X(e.targetId), xo(t).Pr(e);
|
|
11687
11689
|
}
|
|
11688
11690
|
|
|
11689
11691
|
/**
|
|
@@ -11841,13 +11843,13 @@ async function Eo(t, e, n) {
|
|
|
11841
11843
|
async function Ro(t) {
|
|
11842
11844
|
const e = q(t), n = $o(e);
|
|
11843
11845
|
let s = e.Qr.length > 0 ? e.Qr[e.Qr.length - 1].batchId : -1;
|
|
11844
|
-
for (;
|
|
11846
|
+
for (;bo(e); ) try {
|
|
11845
11847
|
const t = await yr(e.localStore, s);
|
|
11846
11848
|
if (null === t) {
|
|
11847
11849
|
0 === e.Qr.length && n._r();
|
|
11848
11850
|
break;
|
|
11849
11851
|
}
|
|
11850
|
-
s = t.batchId,
|
|
11852
|
+
s = t.batchId, Po(e, t);
|
|
11851
11853
|
} catch (t) {
|
|
11852
11854
|
await Io(e, t);
|
|
11853
11855
|
}
|
|
@@ -11857,14 +11859,14 @@ async function Ro(t) {
|
|
|
11857
11859
|
/**
|
|
11858
11860
|
* Returns true if we can add to the write pipeline (i.e. the network is
|
|
11859
11861
|
* enabled and the write pipeline is not full).
|
|
11860
|
-
*/ function
|
|
11862
|
+
*/ function bo(t) {
|
|
11861
11863
|
return go(t) && t.Qr.length < 10;
|
|
11862
11864
|
}
|
|
11863
11865
|
|
|
11864
11866
|
/**
|
|
11865
11867
|
* Queues additional writes to be sent to the write stream, sending them
|
|
11866
11868
|
* immediately if the write stream is established.
|
|
11867
|
-
*/ function
|
|
11869
|
+
*/ function Po(t, e) {
|
|
11868
11870
|
t.Qr.push(e);
|
|
11869
11871
|
const n = $o(t);
|
|
11870
11872
|
n.lr() && n.Sr && n.Dr(e.mutations);
|
|
@@ -11964,7 +11966,7 @@ async function ko(t, e) {
|
|
|
11964
11966
|
*/ (t.datastore, t.asyncQueue, {
|
|
11965
11967
|
Di: po.bind(null, t),
|
|
11966
11968
|
Ni: To.bind(null, t),
|
|
11967
|
-
|
|
11969
|
+
br: Eo.bind(null, t)
|
|
11968
11970
|
}), t.zr.push((async e => {
|
|
11969
11971
|
e ? (t.Xr.wr(), mo(t) ? _o(t) : t.Jr.set("Unknown" /* Unknown */)) : (await t.Xr.stop(),
|
|
11970
11972
|
yo(t));
|
|
@@ -12116,7 +12118,7 @@ class Fo {
|
|
|
12116
12118
|
// We are adding document key comparator to the end as it's the only
|
|
12117
12119
|
// guaranteed unique property of a document.
|
|
12118
12120
|
this.comparator = t ? (e, n) => t(e, n) || St.comparator(e.key, n.key) : (t, e) => St.comparator(t.key, e.key),
|
|
12119
|
-
this.keyedMap =
|
|
12121
|
+
this.keyedMap = bn(), this.sortedSet = new gn(this.comparator);
|
|
12120
12122
|
}
|
|
12121
12123
|
/**
|
|
12122
12124
|
* Returns an empty copy of the existing DocumentSet, using the same
|
|
@@ -12263,7 +12265,7 @@ class Bo {
|
|
|
12263
12265
|
return !this.mutatedKeys.isEmpty();
|
|
12264
12266
|
}
|
|
12265
12267
|
isEqual(t) {
|
|
12266
|
-
if (!(this.fromCache === t.fromCache && this.syncStateChanged === t.syncStateChanged && this.mutatedKeys.isEqual(t.mutatedKeys) &&
|
|
12268
|
+
if (!(this.fromCache === t.fromCache && this.syncStateChanged === t.syncStateChanged && this.mutatedKeys.isEqual(t.mutatedKeys) && Pe(this.query, t.query) && this.docs.isEqual(t.docs) && this.oldDocs.isEqual(t.oldDocs))) return !1;
|
|
12267
12269
|
const e = this.docChanges, n = t.docChanges;
|
|
12268
12270
|
if (e.length !== n.length) return !1;
|
|
12269
12271
|
for (let t = 0; t < e.length; t++) if (e[t].type !== n[t].type || !e[t].doc.isEqual(n[t].doc)) return !1;
|
|
@@ -12298,7 +12300,7 @@ class Bo {
|
|
|
12298
12300
|
|
|
12299
12301
|
class qo {
|
|
12300
12302
|
constructor() {
|
|
12301
|
-
this.queries = new Gi((t => ve(t)),
|
|
12303
|
+
this.queries = new Gi((t => ve(t)), Pe), this.onlineState = "Unknown" /* Unknown */ ,
|
|
12302
12304
|
this.io = new Set;
|
|
12303
12305
|
}
|
|
12304
12306
|
}
|
|
@@ -12531,8 +12533,8 @@ function Go(t) {
|
|
|
12531
12533
|
/**
|
|
12532
12534
|
* Update the progress to 'Success' and return the updated progress.
|
|
12533
12535
|
*/ async complete() {
|
|
12534
|
-
const t = await
|
|
12535
|
-
for (const t of this.queries) await
|
|
12536
|
+
const t = await br(this.localStore, new Jo(this.k), this.documents, this.mo.id), e = this.po(this.documents);
|
|
12537
|
+
for (const t of this.queries) await Pr(this.localStore, t, e.get(t.name));
|
|
12536
12538
|
return this.progress.taskState = "Success", new ar(Object.assign({}, this.progress), t);
|
|
12537
12539
|
}
|
|
12538
12540
|
}
|
|
@@ -12606,7 +12608,7 @@ class ta {
|
|
|
12606
12608
|
/**
|
|
12607
12609
|
* The set of remote documents that the server has told us belongs to the target associated with
|
|
12608
12610
|
* this view.
|
|
12609
|
-
*/ get
|
|
12611
|
+
*/ get bo() {
|
|
12610
12612
|
return this.To;
|
|
12611
12613
|
}
|
|
12612
12614
|
/**
|
|
@@ -12618,7 +12620,7 @@ class ta {
|
|
|
12618
12620
|
* @param previousChanges - If this is being called with a refill, then start
|
|
12619
12621
|
* with this set of docs and changes instead of the current view.
|
|
12620
12622
|
* @returns a new set of docs, changes, and refill flag.
|
|
12621
|
-
*/
|
|
12623
|
+
*/ Po(t, e) {
|
|
12622
12624
|
const n = e ? e.vo : new Lo, s = e ? e.Ro : this.Ro;
|
|
12623
12625
|
let i = e ? e.mutatedKeys : this.mutatedKeys, r = s, o = !1;
|
|
12624
12626
|
// Track the last doc in a (full) limit. This is necessary, because some
|
|
@@ -12826,7 +12828,7 @@ class ta {
|
|
|
12826
12828
|
// PORTING NOTE: Multi-tab only.
|
|
12827
12829
|
ko(t) {
|
|
12828
12830
|
this.To = t.zn, this.Io = Sn();
|
|
12829
|
-
const e = this.
|
|
12831
|
+
const e = this.Po(t.documents);
|
|
12830
12832
|
return this.applyChanges(e, /*updateLimboDocuments=*/ !0);
|
|
12831
12833
|
}
|
|
12832
12834
|
/**
|
|
@@ -12896,7 +12898,7 @@ class na {
|
|
|
12896
12898
|
// PORTING NOTE: Manages state synchronization in multi-tab environments.
|
|
12897
12899
|
s, i, r) {
|
|
12898
12900
|
this.localStore = t, this.remoteStore = e, this.eventManager = n, this.sharedClientState = s,
|
|
12899
|
-
this.currentUser = i, this.maxConcurrentLimboResolutions = r, this.Fo = {}, this.Oo = new Gi((t => ve(t)),
|
|
12901
|
+
this.currentUser = i, this.maxConcurrentLimboResolutions = r, this.Fo = {}, this.Oo = new Gi((t => ve(t)), Pe),
|
|
12900
12902
|
this.Mo = new Map,
|
|
12901
12903
|
/**
|
|
12902
12904
|
* The keys of documents that are in limbo for which we haven't yet started a
|
|
@@ -12963,19 +12965,19 @@ async function ra(t, e) {
|
|
|
12963
12965
|
// targets based on view changes. This allows us to only depend on Limbo
|
|
12964
12966
|
// changes when user code includes queries.
|
|
12965
12967
|
t.Go = (e, n, s) => async function(t, e, n, s) {
|
|
12966
|
-
let i = e.view.
|
|
12968
|
+
let i = e.view.Po(n);
|
|
12967
12969
|
i.Bn && (
|
|
12968
12970
|
// The query has a limit and some docs were removed, so we need
|
|
12969
12971
|
// to re-run the query against the local store to make sure we
|
|
12970
12972
|
// didn't lose any good docs that had been past the limit.
|
|
12971
12973
|
i = await Er(t.localStore, e.query,
|
|
12972
|
-
/* usePreviousResults= */ !1).then((({documents: t}) => e.view.
|
|
12974
|
+
/* usePreviousResults= */ !1).then((({documents: t}) => e.view.Po(t, i))));
|
|
12973
12975
|
const r = s && s.targetChanges.get(e.targetId), o = e.view.applyChanges(i,
|
|
12974
12976
|
/* updateLimboDocuments= */ t.isPrimaryClient, r);
|
|
12975
12977
|
return pa(t, e.targetId, o.Co), o.snapshot;
|
|
12976
12978
|
}(t, e, n, s);
|
|
12977
12979
|
const i = await Er(t.localStore, e,
|
|
12978
|
-
/* usePreviousResults= */ !0), r = new ea(e, i.zn), o = r.
|
|
12980
|
+
/* usePreviousResults= */ !0), r = new ea(e, i.zn), o = r.Po(i.documents), a = kn.createSynthesizedTargetChangeForCurrentChange(n, s && "Offline" /* Offline */ !== t.onlineState), c = r.applyChanges(o,
|
|
12979
12981
|
/* updateLimboDocuments= */ t.isPrimaryClient, a);
|
|
12980
12982
|
pa(t, n, c.Co);
|
|
12981
12983
|
const u = new na(e, n, r);
|
|
@@ -12984,7 +12986,7 @@ async function ra(t, e) {
|
|
|
12984
12986
|
|
|
12985
12987
|
/** Stops listening to the query. */ async function aa(t, e) {
|
|
12986
12988
|
const n = q(t), s = n.Oo.get(e), i = n.Mo.get(s.targetId);
|
|
12987
|
-
if (i.length > 1) return n.Mo.set(s.targetId, i.filter((t => !
|
|
12989
|
+
if (i.length > 1) return n.Mo.set(s.targetId, i.filter((t => !Pe(t, e)))), void n.Oo.delete(e);
|
|
12988
12990
|
// No other queries are mapped to the target, clean up the query and the target.
|
|
12989
12991
|
if (n.isPrimaryClient) {
|
|
12990
12992
|
// We need to remove the local query target first to allow us to verify
|
|
@@ -13099,7 +13101,7 @@ async function ra(t, e) {
|
|
|
13099
13101
|
// Run global snapshot listeners if a consistent snapshot has been emitted.
|
|
13100
13102
|
t.ro(e) && (s = !0);
|
|
13101
13103
|
})), s && Go(n);
|
|
13102
|
-
}(s.eventManager, e), t.length && s.Fo.
|
|
13104
|
+
}(s.eventManager, e), t.length && s.Fo.br(t), s.onlineState = e, s.isPrimaryClient && s.sharedClientState.setOnlineState(e);
|
|
13103
13105
|
}
|
|
13104
13106
|
}
|
|
13105
13107
|
|
|
@@ -13287,7 +13289,7 @@ async function Ia(t, e, n) {
|
|
|
13287
13289
|
r.push(e);
|
|
13288
13290
|
}
|
|
13289
13291
|
})));
|
|
13290
|
-
})), await Promise.all(o), s.Fo.
|
|
13292
|
+
})), await Promise.all(o), s.Fo.br(i), await async function(t, e) {
|
|
13291
13293
|
const n = q(t);
|
|
13292
13294
|
try {
|
|
13293
13295
|
await n.persistence.runTransaction("notifyLocalViewChanges", "readwrite", (t => Gs.forEach(e, (e => Gs.forEach(e.kn, (s => n.persistence.referenceDelegate.addReference(t, e.targetId, s))).next((() => Gs.forEach(e.xn, (s => n.persistence.referenceDelegate.removeReference(t, e.targetId, s)))))))));
|
|
@@ -13338,7 +13340,7 @@ function Ra(t, e) {
|
|
|
13338
13340
|
if (!s) return t;
|
|
13339
13341
|
for (const e of s) {
|
|
13340
13342
|
const s = n.Oo.get(e);
|
|
13341
|
-
t = t.unionWith(s.view.
|
|
13343
|
+
t = t.unionWith(s.view.bo);
|
|
13342
13344
|
}
|
|
13343
13345
|
return t;
|
|
13344
13346
|
}
|
|
@@ -13347,7 +13349,7 @@ function Ra(t, e) {
|
|
|
13347
13349
|
/**
|
|
13348
13350
|
* Reconcile the list of synced documents in an existing view with those
|
|
13349
13351
|
* from persistence.
|
|
13350
|
-
*/ async function
|
|
13352
|
+
*/ async function ba(t, e) {
|
|
13351
13353
|
const n = q(t), s = await Er(n.localStore, e.query,
|
|
13352
13354
|
/* usePreviousResults= */ !0), i = e.view.ko(s);
|
|
13353
13355
|
return n.isPrimaryClient && pa(n, e.targetId, i.Co), i;
|
|
@@ -13358,7 +13360,7 @@ function Ra(t, e) {
|
|
|
13358
13360
|
* snapshots if needed.
|
|
13359
13361
|
*/
|
|
13360
13362
|
// PORTING NOTE: Multi-Tab only.
|
|
13361
|
-
async function
|
|
13363
|
+
async function Pa(t) {
|
|
13362
13364
|
const e = q(t);
|
|
13363
13365
|
return Ar(e.localStore).then((t => Ia(e, t)));
|
|
13364
13366
|
}
|
|
@@ -13450,7 +13452,7 @@ async function Sa(t, e, n) {
|
|
|
13450
13452
|
// state (the list of syncedDocuments may have gotten out of sync).
|
|
13451
13453
|
e = await pr(s.localStore, Re(n[0]));
|
|
13452
13454
|
for (const t of n) {
|
|
13453
|
-
const e = s.Oo.get(t), n = await
|
|
13455
|
+
const e = s.Oo.get(t), n = await ba(s, e);
|
|
13454
13456
|
n.snapshot && r.push(n.snapshot);
|
|
13455
13457
|
}
|
|
13456
13458
|
} else {
|
|
@@ -13462,7 +13464,7 @@ async function Sa(t, e, n) {
|
|
|
13462
13464
|
}
|
|
13463
13465
|
i.push(e);
|
|
13464
13466
|
}
|
|
13465
|
-
return s.Fo.
|
|
13467
|
+
return s.Fo.br(r), i;
|
|
13466
13468
|
}
|
|
13467
13469
|
|
|
13468
13470
|
/**
|
|
@@ -13541,7 +13543,7 @@ async function Na(t, e, n, s) {
|
|
|
13541
13543
|
function xa(t) {
|
|
13542
13544
|
const e = q(t);
|
|
13543
13545
|
return e.remoteStore.remoteSyncer.applyRemoteEvent = ua.bind(null, e), e.remoteStore.remoteSyncer.getRemoteKeysForTarget = Ra.bind(null, e),
|
|
13544
|
-
e.remoteStore.remoteSyncer.rejectListen = la.bind(null, e), e.Fo.
|
|
13546
|
+
e.remoteStore.remoteSyncer.rejectListen = la.bind(null, e), e.Fo.br = Qo.bind(null, e.eventManager),
|
|
13545
13547
|
e.Fo.zo = Wo.bind(null, e.eventManager), e;
|
|
13546
13548
|
}
|
|
13547
13549
|
|
|
@@ -13705,7 +13707,7 @@ class Oa {
|
|
|
13705
13707
|
gi: Na.bind(null, e),
|
|
13706
13708
|
yi: ka.bind(null, e),
|
|
13707
13709
|
Tn: Ca.bind(null, e),
|
|
13708
|
-
_i:
|
|
13710
|
+
_i: Pa.bind(null, e)
|
|
13709
13711
|
}, await this.sharedClientState.start()),
|
|
13710
13712
|
// NOTE: This will immediately call the listener, so we make sure to
|
|
13711
13713
|
// set it after localStore / remoteStore are started.
|
|
@@ -13715,7 +13717,7 @@ class Oa {
|
|
|
13715
13717
|
}
|
|
13716
13718
|
Jo(t) {
|
|
13717
13719
|
const e = Xr();
|
|
13718
|
-
if (!Qr.
|
|
13720
|
+
if (!Qr.Pt(e)) throw new j(K.UNIMPLEMENTED, "IndexedDB persistence is only available on platforms that support LocalStorage.");
|
|
13719
13721
|
const n = or(t.databaseInfo.databaseId, t.databaseInfo.persistenceKey);
|
|
13720
13722
|
return new Qr(e, t.asyncQueue, n, t.clientId, t.initialUser);
|
|
13721
13723
|
}
|
|
@@ -13745,7 +13747,7 @@ class Oa {
|
|
|
13745
13747
|
}
|
|
13746
13748
|
createRemoteStore(t) {
|
|
13747
13749
|
return e = this.localStore, n = this.datastore, s = t.asyncQueue, i = t => ha(this.syncEngine, t, 0 /* RemoteStore */),
|
|
13748
|
-
r = zr.
|
|
13750
|
+
r = zr.Pt() ? new zr : new Gr, new ao(e, n, s, i, r);
|
|
13749
13751
|
var e, n, s, i, r;
|
|
13750
13752
|
/** Re-enables the network. Idempotent. */ }
|
|
13751
13753
|
createSyncEngine(t, e) {
|
|
@@ -14190,7 +14192,7 @@ class Qa {
|
|
|
14190
14192
|
da(t) {
|
|
14191
14193
|
try {
|
|
14192
14194
|
const e = this.updateFunction(t);
|
|
14193
|
-
return !
|
|
14195
|
+
return !Pt(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
|
|
14194
14196
|
null);
|
|
14195
14197
|
} catch (t) {
|
|
14196
14198
|
// Do not retry errors thrown by user provided updateFunction.
|
|
@@ -14437,7 +14439,7 @@ function oc(t, e) {
|
|
|
14437
14439
|
return t.asyncQueue.enqueueAndForget((async () => async function(t, e, n) {
|
|
14438
14440
|
try {
|
|
14439
14441
|
const s = await Er(t, e,
|
|
14440
|
-
/* usePreviousResults= */ !0), i = new ea(e, s.zn), r = i.
|
|
14442
|
+
/* usePreviousResults= */ !0), i = new ea(e, s.zn), r = i.Po(s.documents), o = i.applyChanges(r,
|
|
14441
14443
|
/* updateLimboDocuments= */ !1);
|
|
14442
14444
|
n.resolve(o.snapshot);
|
|
14443
14445
|
} catch (t) {
|
|
@@ -14901,7 +14903,7 @@ function Rc(t, e, n, s = {}) {
|
|
|
14901
14903
|
* A `DocumentReference` refers to a document location in a Firestore database
|
|
14902
14904
|
* and can be used to write, read, or listen to the location. The document at
|
|
14903
14905
|
* the referenced location may or may not exist.
|
|
14904
|
-
*/ class
|
|
14906
|
+
*/ class bc {
|
|
14905
14907
|
/** @hideconstructor */
|
|
14906
14908
|
constructor(t,
|
|
14907
14909
|
/**
|
|
@@ -14932,14 +14934,14 @@ function Rc(t, e, n, s = {}) {
|
|
|
14932
14934
|
return new vc(this.firestore, this.converter, this._key.path.popLast());
|
|
14933
14935
|
}
|
|
14934
14936
|
withConverter(t) {
|
|
14935
|
-
return new
|
|
14937
|
+
return new bc(this.firestore, t, this._key);
|
|
14936
14938
|
}
|
|
14937
14939
|
}
|
|
14938
14940
|
|
|
14939
14941
|
/**
|
|
14940
14942
|
* A `Query` refers to a query which you can read or listen to. You can also
|
|
14941
14943
|
* construct refined `Query` objects by adding filters and ordering.
|
|
14942
|
-
*/ class
|
|
14944
|
+
*/ class Pc {
|
|
14943
14945
|
// This is the lite version of the Query class in the main SDK.
|
|
14944
14946
|
/** @hideconstructor protected */
|
|
14945
14947
|
constructor(t,
|
|
@@ -14952,14 +14954,14 @@ function Rc(t, e, n, s = {}) {
|
|
|
14952
14954
|
this.type = "query", this.firestore = t;
|
|
14953
14955
|
}
|
|
14954
14956
|
withConverter(t) {
|
|
14955
|
-
return new
|
|
14957
|
+
return new Pc(this.firestore, t, this._query);
|
|
14956
14958
|
}
|
|
14957
14959
|
}
|
|
14958
14960
|
|
|
14959
14961
|
/**
|
|
14960
14962
|
* A `CollectionReference` object can be used for adding documents, getting
|
|
14961
14963
|
* document references, and querying for documents (using {@link query}).
|
|
14962
|
-
*/ class vc extends
|
|
14964
|
+
*/ class vc extends Pc {
|
|
14963
14965
|
/** @hideconstructor */
|
|
14964
14966
|
constructor(t, e, n) {
|
|
14965
14967
|
super(t, e, ge(n)), this._path = n,
|
|
@@ -14980,7 +14982,7 @@ function Rc(t, e, n, s = {}) {
|
|
|
14980
14982
|
* subcollection. If this isn't a subcollection, the reference is null.
|
|
14981
14983
|
*/ get parent() {
|
|
14982
14984
|
const t = this._path.popLast();
|
|
14983
|
-
return t.isEmpty() ? null : new
|
|
14985
|
+
return t.isEmpty() ? null : new bc(this.firestore,
|
|
14984
14986
|
/* converter= */ null, new St(t));
|
|
14985
14987
|
}
|
|
14986
14988
|
withConverter(t) {
|
|
@@ -14994,7 +14996,7 @@ function Vc(t, e, ...n) {
|
|
|
14994
14996
|
return yc(s), new vc(t, /* converter= */ null, s);
|
|
14995
14997
|
}
|
|
14996
14998
|
{
|
|
14997
|
-
if (!(t instanceof
|
|
14999
|
+
if (!(t instanceof bc || t instanceof vc)) throw new j(K.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
14998
15000
|
const s = t._path.child(dt.fromString(e, ...n));
|
|
14999
15001
|
return yc(s), new vc(t.firestore,
|
|
15000
15002
|
/* converter= */ null, s);
|
|
@@ -15015,7 +15017,7 @@ function Vc(t, e, ...n) {
|
|
|
15015
15017
|
* @returns The created `Query`.
|
|
15016
15018
|
*/ function Sc(t, e) {
|
|
15017
15019
|
if (t = Tc(t, Ac), _c("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new j(K.INVALID_ARGUMENT, `Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
|
|
15018
|
-
return new
|
|
15020
|
+
return new Pc(t,
|
|
15019
15021
|
/* converter= */ null,
|
|
15020
15022
|
/**
|
|
15021
15023
|
* Creates a new Query for a collection group query that matches all documents
|
|
@@ -15032,13 +15034,13 @@ function Dc(t, e, ...n) {
|
|
|
15032
15034
|
// 'undefined' and 'null'.
|
|
15033
15035
|
1 === arguments.length && (e = st.A()), _c("doc", "path", e), t instanceof Ac) {
|
|
15034
15036
|
const s = dt.fromString(e, ...n);
|
|
15035
|
-
return gc(s), new
|
|
15037
|
+
return gc(s), new bc(t,
|
|
15036
15038
|
/* converter= */ null, new St(s));
|
|
15037
15039
|
}
|
|
15038
15040
|
{
|
|
15039
|
-
if (!(t instanceof
|
|
15041
|
+
if (!(t instanceof bc || t instanceof vc)) throw new j(K.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
15040
15042
|
const s = t._path.child(dt.fromString(e, ...n));
|
|
15041
|
-
return gc(s), new
|
|
15043
|
+
return gc(s), new bc(t.firestore, t instanceof vc ? t.converter : null, new St(s));
|
|
15042
15044
|
}
|
|
15043
15045
|
}
|
|
15044
15046
|
|
|
@@ -15050,7 +15052,7 @@ function Dc(t, e, ...n) {
|
|
|
15050
15052
|
* @returns true if the references point to the same location in the same
|
|
15051
15053
|
* Firestore database.
|
|
15052
15054
|
*/ function Cc(t, e) {
|
|
15053
|
-
return t = getModularInstance(t), e = getModularInstance(e), (t instanceof
|
|
15055
|
+
return t = getModularInstance(t), e = getModularInstance(e), (t instanceof bc || t instanceof vc) && (e instanceof bc || e instanceof vc) && (t.firestore === e.firestore && t.path === e.path && t.converter === e.converter);
|
|
15054
15056
|
}
|
|
15055
15057
|
|
|
15056
15058
|
/**
|
|
@@ -15062,7 +15064,7 @@ function Dc(t, e, ...n) {
|
|
|
15062
15064
|
* @returns true if the references point to the same location in the same
|
|
15063
15065
|
* Firestore database.
|
|
15064
15066
|
*/ function Nc(t, e) {
|
|
15065
|
-
return t = getModularInstance(t), e = getModularInstance(e), t instanceof
|
|
15067
|
+
return t = getModularInstance(t), e = getModularInstance(e), t instanceof Pc && e instanceof Pc && (t.firestore === e.firestore && Pe(t._query, e._query) && t.converter === e.converter);
|
|
15066
15068
|
}
|
|
15067
15069
|
|
|
15068
15070
|
/**
|
|
@@ -15125,9 +15127,9 @@ function Dc(t, e, ...n) {
|
|
|
15125
15127
|
this.enqueue(t);
|
|
15126
15128
|
}
|
|
15127
15129
|
enqueueAndForgetEvenWhileRestricted(t) {
|
|
15128
|
-
this.
|
|
15130
|
+
this.ba(),
|
|
15129
15131
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
15130
|
-
this.
|
|
15132
|
+
this.Pa(t);
|
|
15131
15133
|
}
|
|
15132
15134
|
enterRestrictedMode(t) {
|
|
15133
15135
|
if (!this.ya) {
|
|
@@ -15137,14 +15139,14 @@ function Dc(t, e, ...n) {
|
|
|
15137
15139
|
}
|
|
15138
15140
|
}
|
|
15139
15141
|
enqueue(t) {
|
|
15140
|
-
if (this.
|
|
15142
|
+
if (this.ba(), this.ya)
|
|
15141
15143
|
// Return a Promise which never resolves.
|
|
15142
15144
|
return new Promise((() => {}));
|
|
15143
15145
|
// Create a deferred Promise that we can return to the callee. This
|
|
15144
15146
|
// allows us to return a "hanging Promise" only to the callee and still
|
|
15145
15147
|
// advance the queue even when the operation is not run.
|
|
15146
15148
|
const e = new Q;
|
|
15147
|
-
return this.
|
|
15149
|
+
return this.Pa((() => this.ya && this.Ia ? Promise.resolve() : (t().then(e.resolve, e.reject),
|
|
15148
15150
|
e.promise))).then((() => e.promise));
|
|
15149
15151
|
}
|
|
15150
15152
|
enqueueRetryable(t) {
|
|
@@ -15176,7 +15178,7 @@ function Dc(t, e, ...n) {
|
|
|
15176
15178
|
this.ur.Zi((() => this.va()));
|
|
15177
15179
|
}
|
|
15178
15180
|
}
|
|
15179
|
-
|
|
15181
|
+
Pa(t) {
|
|
15180
15182
|
const e = this.ma.then((() => (this.Ea = !0, t().catch((t => {
|
|
15181
15183
|
this.Ta = t, this.Ea = !1;
|
|
15182
15184
|
const e =
|
|
@@ -15214,13 +15216,13 @@ function Dc(t, e, ...n) {
|
|
|
15214
15216
|
return this.ma = e, e;
|
|
15215
15217
|
}
|
|
15216
15218
|
enqueueAfterDelay(t, e, n) {
|
|
15217
|
-
this.
|
|
15219
|
+
this.ba(),
|
|
15218
15220
|
// Fast-forward delays for timerIds that have been overriden.
|
|
15219
15221
|
this.Aa.indexOf(t) > -1 && (e = 0);
|
|
15220
15222
|
const s = Fo.createAndSchedule(this, t, e, n, (t => this.Va(t)));
|
|
15221
15223
|
return this.pa.push(s), s;
|
|
15222
15224
|
}
|
|
15223
|
-
|
|
15225
|
+
ba() {
|
|
15224
15226
|
this.Ta && L();
|
|
15225
15227
|
}
|
|
15226
15228
|
verifyOperationInProgress() {}
|
|
@@ -15587,7 +15589,7 @@ function Qc(t) {
|
|
|
15587
15589
|
return t._queue.enqueueAndForgetEvenWhileRestricted((async () => {
|
|
15588
15590
|
try {
|
|
15589
15591
|
await async function(t) {
|
|
15590
|
-
if (!Hs.
|
|
15592
|
+
if (!Hs.Pt()) return Promise.resolve();
|
|
15591
15593
|
const e = t + "main";
|
|
15592
15594
|
await Hs.delete(e);
|
|
15593
15595
|
}(or(t._databaseId, t._persistenceKey)), e.resolve();
|
|
@@ -15686,7 +15688,7 @@ function Qc(t) {
|
|
|
15686
15688
|
* with resulting documents), and loaded to local cache using `loadBundle`. Once in local
|
|
15687
15689
|
* cache, use this method to extract a {@link Query} by name.
|
|
15688
15690
|
*/ function Yc(t, e) {
|
|
15689
|
-
return lc(Bc(t = Tc(t, Oc)), e).then((e => e ? new
|
|
15691
|
+
return lc(Bc(t = Tc(t, Oc)), e).then((e => e ? new Pc(t, null, e.query) : null));
|
|
15690
15692
|
}
|
|
15691
15693
|
|
|
15692
15694
|
function Xc(t) {
|
|
@@ -16091,7 +16093,7 @@ function hu(t) {
|
|
|
16091
16093
|
if (r.merge) c = new mt(o.fieldMask), u = o.fieldTransforms; else if (r.mergeFields) {
|
|
16092
16094
|
const t = [];
|
|
16093
16095
|
for (const s of r.mergeFields) {
|
|
16094
|
-
const i =
|
|
16096
|
+
const i = bu(e, s, n);
|
|
16095
16097
|
if (!o.contains(i)) throw new j(K.INVALID_ARGUMENT, `Field '${i}' is specified in your field mask but missing from your input data.`);
|
|
16096
16098
|
Su(t, i) || t.push(i);
|
|
16097
16099
|
}
|
|
@@ -16211,9 +16213,9 @@ class gu extends nu {
|
|
|
16211
16213
|
}
|
|
16212
16214
|
|
|
16213
16215
|
/** Parse update data from a list of field/value arguments. */ function pu(t, e, n, s, i, r) {
|
|
16214
|
-
const o = t.ja(1 /* Update */ , e, n), a = [
|
|
16216
|
+
const o = t.ja(1 /* Update */ , e, n), a = [ bu(e, s, n) ], c = [ i ];
|
|
16215
16217
|
if (r.length % 2 != 0) throw new j(K.INVALID_ARGUMENT, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);
|
|
16216
|
-
for (let t = 0; t < r.length; t += 2) a.push(
|
|
16218
|
+
for (let t = 0; t < r.length; t += 2) a.push(bu(e, r[t])), c.push(r[t + 1]);
|
|
16217
16219
|
const u = [], h = jt.empty();
|
|
16218
16220
|
// We iterate in reverse order to pick the last value for a field if the
|
|
16219
16221
|
// user specified the field multiple times.
|
|
@@ -16350,7 +16352,7 @@ class gu extends nu {
|
|
|
16350
16352
|
if (t instanceof eu) return {
|
|
16351
16353
|
bytesValue: Qn(e.k, t._byteString)
|
|
16352
16354
|
};
|
|
16353
|
-
if (t instanceof
|
|
16355
|
+
if (t instanceof bc) {
|
|
16354
16356
|
const n = e.databaseId, s = t.firestore._databaseId;
|
|
16355
16357
|
if (!s.isEqual(n)) throw e.Ua(`Document reference is for database ${s.projectId}/${s.database} but should be for database ${n.projectId}/${n.database}`);
|
|
16356
16358
|
return {
|
|
@@ -16384,7 +16386,7 @@ function Iu(t, e) {
|
|
|
16384
16386
|
}
|
|
16385
16387
|
|
|
16386
16388
|
function Au(t) {
|
|
16387
|
-
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof at || t instanceof su || t instanceof eu || t instanceof
|
|
16389
|
+
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof at || t instanceof su || t instanceof eu || t instanceof bc || t instanceof nu);
|
|
16388
16390
|
}
|
|
16389
16391
|
|
|
16390
16392
|
function Ru(t, e, n) {
|
|
@@ -16398,7 +16400,7 @@ function Ru(t, e, n) {
|
|
|
16398
16400
|
|
|
16399
16401
|
/**
|
|
16400
16402
|
* Helper that calls fromDotSeparatedString() but wraps any error thrown.
|
|
16401
|
-
*/ function
|
|
16403
|
+
*/ function bu(t, e, n) {
|
|
16402
16404
|
if ((
|
|
16403
16405
|
// If required, replace the FieldPath Compat class with with the firestore-exp
|
|
16404
16406
|
// FieldPath.
|
|
@@ -16411,7 +16413,7 @@ function Ru(t, e, n) {
|
|
|
16411
16413
|
|
|
16412
16414
|
/**
|
|
16413
16415
|
* Matches any characters in a field path string that are reserved.
|
|
16414
|
-
*/ const
|
|
16416
|
+
*/ const Pu = new RegExp("[~\\*/\\[\\]]");
|
|
16415
16417
|
|
|
16416
16418
|
/**
|
|
16417
16419
|
* Wraps fromDotSeparatedString with an error message about the method that
|
|
@@ -16422,7 +16424,7 @@ function Ru(t, e, n) {
|
|
|
16422
16424
|
* @param targetDoc - The document against which the field path will be
|
|
16423
16425
|
* evaluated.
|
|
16424
16426
|
*/ function vu(t, e, n) {
|
|
16425
|
-
if (e.search(
|
|
16427
|
+
if (e.search(Pu) >= 0) throw Vu(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`, t,
|
|
16426
16428
|
/* hasConverter= */ !1,
|
|
16427
16429
|
/* path= */ void 0, n);
|
|
16428
16430
|
try {
|
|
@@ -16487,7 +16489,7 @@ function Vu(t, e, n, s, i) {
|
|
|
16487
16489
|
/**
|
|
16488
16490
|
* The `DocumentReference` for the document included in the `DocumentSnapshot`.
|
|
16489
16491
|
*/ get ref() {
|
|
16490
|
-
return new
|
|
16492
|
+
return new bc(this._firestore, this._converter, this._key);
|
|
16491
16493
|
}
|
|
16492
16494
|
/**
|
|
16493
16495
|
* Signals whether or not the document at the snapshot's location exists.
|
|
@@ -16911,7 +16913,7 @@ class qu extends Bu {
|
|
|
16911
16913
|
throw n === e.op ? new j(K.INVALID_ARGUMENT, `Invalid query. You cannot use more than one '${e.op.toString()}' filter.`) : new j(K.INVALID_ARGUMENT, `Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`);
|
|
16912
16914
|
}(t, c), c;
|
|
16913
16915
|
}(t._query, "where", e, t.firestore._databaseId, this.Ga, this.za, this.Ha);
|
|
16914
|
-
return new
|
|
16916
|
+
return new Pc(t.firestore, t.converter, function(t, e) {
|
|
16915
16917
|
const n = t.filters.concat([ e ]);
|
|
16916
16918
|
return new _e(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
|
|
16917
16919
|
}(t._query, n));
|
|
@@ -16961,7 +16963,7 @@ class ju extends Bu {
|
|
|
16961
16963
|
* of the query or if any of the fields in the order by are an uncommitted
|
|
16962
16964
|
* server timestamp.
|
|
16963
16965
|
*/ (t._query, this.Ga, this.Ja);
|
|
16964
|
-
return new
|
|
16966
|
+
return new Pc(t.firestore, t.converter, function(t, e) {
|
|
16965
16967
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
16966
16968
|
const n = t.explicitOrderBy.concat([ e ]);
|
|
16967
16969
|
return new _e(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
|
|
@@ -16987,7 +16989,7 @@ class Wu extends Bu {
|
|
|
16987
16989
|
super(), this.type = t, this.Ya = e, this.Xa = n;
|
|
16988
16990
|
}
|
|
16989
16991
|
_apply(t) {
|
|
16990
|
-
return new
|
|
16992
|
+
return new Pc(t.firestore, t.converter, be(t._query, this.Ya, this.Xa));
|
|
16991
16993
|
}
|
|
16992
16994
|
}
|
|
16993
16995
|
|
|
@@ -17018,7 +17020,7 @@ class Hu extends Bu {
|
|
|
17018
17020
|
}
|
|
17019
17021
|
_apply(t) {
|
|
17020
17022
|
const e = eh(t, this.type, this.Za, this.tc);
|
|
17021
|
-
return new
|
|
17023
|
+
return new Pc(t.firestore, t.converter, function(t, e) {
|
|
17022
17024
|
return new _e(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
|
|
17023
17025
|
}(t._query, e));
|
|
17024
17026
|
}
|
|
@@ -17039,7 +17041,7 @@ class Xu extends Bu {
|
|
|
17039
17041
|
}
|
|
17040
17042
|
_apply(t) {
|
|
17041
17043
|
const e = eh(t, this.type, this.Za, this.tc);
|
|
17042
|
-
return new
|
|
17044
|
+
return new Pc(t.firestore, t.converter, function(t, e) {
|
|
17043
17045
|
return new _e(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
|
|
17044
17046
|
}(t._query, e));
|
|
17045
17047
|
}
|
|
@@ -17117,7 +17119,7 @@ function nh(t, e, n) {
|
|
|
17117
17119
|
if (!St.isDocumentKey(s)) throw new j(K.INVALID_ARGUMENT, `Invalid query. When querying a collection group by FieldPath.documentId(), the value provided must result in a valid document path, but '${s}' is not because it has an odd number of segments (${s.length}).`);
|
|
17118
17120
|
return Ot(t, new St(s));
|
|
17119
17121
|
}
|
|
17120
|
-
if (n instanceof
|
|
17122
|
+
if (n instanceof bc) return Ot(t, n._key);
|
|
17121
17123
|
throw new j(K.INVALID_ARGUMENT, `Invalid query. When querying with FieldPath.documentId(), you must provide a valid string or a DocumentReference, but it was: ${pc(n)}.`);
|
|
17122
17124
|
}
|
|
17123
17125
|
|
|
@@ -17213,7 +17215,7 @@ function ih(t, e, n) {
|
|
|
17213
17215
|
return null == n ? null : this.convertValue(n, e);
|
|
17214
17216
|
|
|
17215
17217
|
case "estimate":
|
|
17216
|
-
return this.convertTimestamp(
|
|
17218
|
+
return this.convertTimestamp(bt(t));
|
|
17217
17219
|
|
|
17218
17220
|
default:
|
|
17219
17221
|
return null;
|
|
@@ -17276,7 +17278,7 @@ class ah extends rh {
|
|
|
17276
17278
|
}
|
|
17277
17279
|
convertReference(t) {
|
|
17278
17280
|
const e = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
17279
|
-
return new
|
|
17281
|
+
return new bc(this.firestore, /* converter= */ null, e);
|
|
17280
17282
|
}
|
|
17281
17283
|
}
|
|
17282
17284
|
|
|
@@ -17411,7 +17413,7 @@ function uh(t, e) {
|
|
|
17411
17413
|
* current document contents.
|
|
17412
17414
|
*/
|
|
17413
17415
|
function hh(t) {
|
|
17414
|
-
t = Tc(t,
|
|
17416
|
+
t = Tc(t, bc);
|
|
17415
17417
|
const e = Tc(t.firestore, Oc);
|
|
17416
17418
|
return rc(Bc(e), t._key).then((n => Rh(e, t, n)));
|
|
17417
17419
|
}
|
|
@@ -17425,7 +17427,7 @@ class lh extends rh {
|
|
|
17425
17427
|
}
|
|
17426
17428
|
convertReference(t) {
|
|
17427
17429
|
const e = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
17428
|
-
return new
|
|
17430
|
+
return new bc(this.firestore, /* converter= */ null, e);
|
|
17429
17431
|
}
|
|
17430
17432
|
}
|
|
17431
17433
|
|
|
@@ -17436,7 +17438,7 @@ class lh extends rh {
|
|
|
17436
17438
|
* @returns A `Promise` resolved with a `DocumentSnapshot` containing the
|
|
17437
17439
|
* current document contents.
|
|
17438
17440
|
*/ function fh(t) {
|
|
17439
|
-
t = Tc(t,
|
|
17441
|
+
t = Tc(t, bc);
|
|
17440
17442
|
const e = Tc(t.firestore, Oc), n = Bc(e), s = new lh(e);
|
|
17441
17443
|
return ic(n, t._key).then((n => new xu(e, s, t._key, n, new ku(null !== n && n.hasLocalMutations,
|
|
17442
17444
|
/* fromCache= */ !0), t.converter)));
|
|
@@ -17449,7 +17451,7 @@ class lh extends rh {
|
|
|
17449
17451
|
* @returns A `Promise` resolved with a `DocumentSnapshot` containing the
|
|
17450
17452
|
* current document contents.
|
|
17451
17453
|
*/ function dh(t) {
|
|
17452
|
-
t = Tc(t,
|
|
17454
|
+
t = Tc(t, bc);
|
|
17453
17455
|
const e = Tc(t.firestore, Oc);
|
|
17454
17456
|
return rc(Bc(e), t._key, {
|
|
17455
17457
|
source: "server"
|
|
@@ -17466,7 +17468,7 @@ class lh extends rh {
|
|
|
17466
17468
|
*
|
|
17467
17469
|
* @returns A `Promise` that will be resolved with the results of the query.
|
|
17468
17470
|
*/ function wh(t) {
|
|
17469
|
-
t = Tc(t,
|
|
17471
|
+
t = Tc(t, Pc);
|
|
17470
17472
|
const e = Tc(t.firestore, Oc), n = Bc(e), s = new lh(e);
|
|
17471
17473
|
return Lu(t._query), ac(n, t._query).then((n => new Fu(e, s, t, n)));
|
|
17472
17474
|
}
|
|
@@ -17477,7 +17479,7 @@ class lh extends rh {
|
|
|
17477
17479
|
*
|
|
17478
17480
|
* @returns A `Promise` that will be resolved with the results of the query.
|
|
17479
17481
|
*/ function _h(t) {
|
|
17480
|
-
t = Tc(t,
|
|
17482
|
+
t = Tc(t, Pc);
|
|
17481
17483
|
const e = Tc(t.firestore, Oc), n = Bc(e), s = new lh(e);
|
|
17482
17484
|
return oc(n, t._query).then((n => new Fu(e, s, t, n)));
|
|
17483
17485
|
}
|
|
@@ -17488,7 +17490,7 @@ class lh extends rh {
|
|
|
17488
17490
|
*
|
|
17489
17491
|
* @returns A `Promise` that will be resolved with the results of the query.
|
|
17490
17492
|
*/ function mh(t) {
|
|
17491
|
-
t = Tc(t,
|
|
17493
|
+
t = Tc(t, Pc);
|
|
17492
17494
|
const e = Tc(t.firestore, Oc), n = Bc(e), s = new lh(e);
|
|
17493
17495
|
return ac(n, t._query, {
|
|
17494
17496
|
source: "server"
|
|
@@ -17496,13 +17498,13 @@ class lh extends rh {
|
|
|
17496
17498
|
}
|
|
17497
17499
|
|
|
17498
17500
|
function gh(t, e, n) {
|
|
17499
|
-
t = Tc(t,
|
|
17501
|
+
t = Tc(t, bc);
|
|
17500
17502
|
const s = Tc(t.firestore, Oc), i = oh(t.converter, e, n);
|
|
17501
17503
|
return Ah(s, [ lu(hu(s), "setDoc", t._key, i, null !== t.converter, n).toMutation(t._key, Je.none()) ]);
|
|
17502
17504
|
}
|
|
17503
17505
|
|
|
17504
17506
|
function yh(t, e, n, ...s) {
|
|
17505
|
-
t = Tc(t,
|
|
17507
|
+
t = Tc(t, bc);
|
|
17506
17508
|
const i = Tc(t.firestore, Oc), r = hu(i);
|
|
17507
17509
|
let o;
|
|
17508
17510
|
o = "string" == typeof (
|
|
@@ -17552,14 +17554,14 @@ function Eh(t, ...e) {
|
|
|
17552
17554
|
e[o + 2] = null === (i = t.complete) || void 0 === i ? void 0 : i.bind(t);
|
|
17553
17555
|
}
|
|
17554
17556
|
let c, u, h;
|
|
17555
|
-
if (t instanceof
|
|
17557
|
+
if (t instanceof bc) u = Tc(t.firestore, Oc), h = ge(t._key.path), c = {
|
|
17556
17558
|
next: n => {
|
|
17557
17559
|
e[o] && e[o](Rh(u, t, n));
|
|
17558
17560
|
},
|
|
17559
17561
|
error: e[o + 1],
|
|
17560
17562
|
complete: e[o + 2]
|
|
17561
17563
|
}; else {
|
|
17562
|
-
const n = Tc(t,
|
|
17564
|
+
const n = Tc(t, Pc);
|
|
17563
17565
|
u = Tc(n.firestore, Oc), h = n._query;
|
|
17564
17566
|
const s = new lh(u);
|
|
17565
17567
|
c = {
|
|
@@ -17624,7 +17626,7 @@ function Ih(t, e) {
|
|
|
17624
17626
|
* The `Transaction` object passed to a transaction's `updateFunction` provides
|
|
17625
17627
|
* the methods to read and write data within the transaction context. See
|
|
17626
17628
|
* {@link runTransaction}.
|
|
17627
|
-
*/ class
|
|
17629
|
+
*/ class bh extends class {
|
|
17628
17630
|
/** @hideconstructor */
|
|
17629
17631
|
constructor(t, e) {
|
|
17630
17632
|
this._firestore = t, this._transaction = e, this._dataReader = hu(t);
|
|
@@ -17701,8 +17703,8 @@ function Ih(t, e) {
|
|
|
17701
17703
|
* (the `updateFunction` returned a failed promise), the promise returned by the
|
|
17702
17704
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
17703
17705
|
* rejected promise with the corresponding failure error is returned.
|
|
17704
|
-
*/ function
|
|
17705
|
-
return uc(Bc(t = Tc(t, Oc)), (n => e(new
|
|
17706
|
+
*/ function Ph(t, e) {
|
|
17707
|
+
return uc(Bc(t = Tc(t, Oc)), (n => e(new bh(t, n))));
|
|
17706
17708
|
}
|
|
17707
17709
|
|
|
17708
17710
|
/**
|
|
@@ -17832,10 +17834,10 @@ function Ih(t, e) {
|
|
|
17832
17834
|
return n = Object.assign({
|
|
17833
17835
|
useFetchStreams: e
|
|
17834
17836
|
}, n), i._setSettings(n), i;
|
|
17835
|
-
}), "PUBLIC")), registerVersion(S, "3.4.1-
|
|
17837
|
+
}), "PUBLIC")), registerVersion(S, "3.4.1-canary.3d8109ca3", t),
|
|
17836
17838
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
|
17837
|
-
registerVersion(S, "3.4.1-
|
|
17839
|
+
registerVersion(S, "3.4.1-canary.3d8109ca3", "esm2017");
|
|
17838
17840
|
}();
|
|
17839
17841
|
|
|
17840
|
-
export { rh as AbstractUserDataWriter, eu as Bytes, Fc as CACHE_SIZE_UNLIMITED, vc as CollectionReference,
|
|
17842
|
+
export { rh as AbstractUserDataWriter, eu as Bytes, Fc as CACHE_SIZE_UNLIMITED, vc as CollectionReference, bc as DocumentReference, xu as DocumentSnapshot, Zc as FieldPath, nu as FieldValue, Oc as Firestore, j as FirestoreError, su as GeoPoint, $c as LoadBundleTask, Pc as Query, Bu as QueryConstraint, $u as QueryDocumentSnapshot, Fu as QuerySnapshot, ku as SnapshotMetadata, at as Timestamp, bh as Transaction, ch as WriteBatch, dc as _DatabaseId, St as _DocumentKey, tt as _EmptyAppCheckTokenProvider, G as _EmptyAuthCredentialsProvider, _t as _FieldPath, Tc as _cast, U as _debugAssert, gt as _isBase64Available, O as _logWarn, mc as _validateIsNotUsedTogether, Th as addDoc, Dh as arrayRemove, Sh as arrayUnion, Qc as clearIndexedDbPersistence, Vc as collection, Sc as collectionGroup, Rc as connectFirestoreEmulator, ph as deleteDoc, vh as deleteField, zc as disableNetwork, Dc as doc, tu as documentId, qc as enableIndexedDbPersistence, Kc as enableMultiTabIndexedDbPersistence, Gc as enableNetwork, th as endAt, Zu as endBefore, Bc as ensureFirestoreConfigured, Ah as executeWrite, hh as getDoc, fh as getDocFromCache, dh as getDocFromServer, wh as getDocs, _h as getDocsFromCache, mh as getDocsFromServer, Lc as getFirestore, Ch as increment, Mc as initializeFirestore, Gu as limit, zu as limitToLast, Jc as loadBundle, Yc as namedQuery, Eh as onSnapshot, Ih as onSnapshotsInSync, Qu as orderBy, Uu as query, Nc as queryEqual, Cc as refEqual, Ph as runTransaction, Vh as serverTimestamp, gh as setDoc, x as setLogLevel, Mu as snapshotEqual, Yu as startAfter, Ju as startAt, Hc as terminate, yh as updateDoc, Wc as waitForPendingWrites, Ku as where, Nh as writeBatch };
|
|
17841
17843
|
//# sourceMappingURL=index.esm2017.js.map
|