@firebase/firestore 3.4.7-canary.e9e5f6b3c → 3.4.8
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 +10 -0
- package/dist/firestore/src/local/indexeddb_remote_document_cache.d.ts +9 -0
- package/dist/firestore/src/local/simple_db.d.ts +2 -0
- package/dist/firestore/test/unit/local/test_remote_document_cache.d.ts +0 -4
- package/dist/index.esm2017.js +153 -146
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +69 -65
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +26 -9
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +26 -9
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +14 -7
- package/dist/index.rn.js.map +1 -1
- package/dist/lite/firestore/src/local/indexeddb_remote_document_cache.d.ts +9 -0
- package/dist/lite/firestore/src/local/simple_db.d.ts +2 -0
- package/dist/lite/firestore/test/unit/local/test_remote_document_cache.d.ts +0 -4
- package/dist/lite/index.browser.esm2017.js +73 -73
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +8 -8
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +2 -2
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +2 -2
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +1112 -1112
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +18 -18
- package/dist/lite/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +9 -0
- package/dist/lite/packages/firestore/src/local/simple_db.d.ts +2 -0
- package/dist/lite/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +0 -4
- package/dist/packages/firestore/dist/index.esm2017.d.ts +8 -8
- package/dist/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +9 -0
- package/dist/packages/firestore/src/local/simple_db.d.ts +2 -0
- package/dist/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +0 -4
- package/package.json +9 -9
package/dist/index.esm2017.js
CHANGED
|
@@ -66,7 +66,7 @@ C.MOCK_USER = new C("mock-user");
|
|
|
66
66
|
* See the License for the specific language governing permissions and
|
|
67
67
|
* limitations under the License.
|
|
68
68
|
*/
|
|
69
|
-
let x = "9.6.
|
|
69
|
+
let x = "9.6.11";
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* @license
|
|
@@ -1421,14 +1421,14 @@ const It = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1421
1421
|
* Preserving the previous values allows the user to display the last resoled
|
|
1422
1422
|
* value until the backend responds with the timestamp.
|
|
1423
1423
|
*/
|
|
1424
|
-
function
|
|
1424
|
+
function Pt(t) {
|
|
1425
1425
|
const e = t.mapValue.fields.__previous_value__;
|
|
1426
|
-
return Rt(e) ?
|
|
1426
|
+
return Rt(e) ? Pt(e) : e;
|
|
1427
1427
|
}
|
|
1428
1428
|
|
|
1429
1429
|
/**
|
|
1430
1430
|
* Returns the local time at which this timestamp was first set.
|
|
1431
|
-
*/ function
|
|
1431
|
+
*/ function bt(t) {
|
|
1432
1432
|
const e = Tt(t.mapValue.fields.__local_write_time__.timestampValue);
|
|
1433
1433
|
return new at(e.seconds, e.nanos);
|
|
1434
1434
|
}
|
|
@@ -1639,7 +1639,7 @@ function Mt(t) {
|
|
|
1639
1639
|
return t.booleanValue === e.booleanValue;
|
|
1640
1640
|
|
|
1641
1641
|
case 4 /* ServerTimestampValue */ :
|
|
1642
|
-
return
|
|
1642
|
+
return bt(t).isEqual(bt(e));
|
|
1643
1643
|
|
|
1644
1644
|
case 3 /* TimestampValue */ :
|
|
1645
1645
|
return function(t, e) {
|
|
@@ -1721,7 +1721,7 @@ function $t(t, e) {
|
|
|
1721
1721
|
return Bt(t.timestampValue, e.timestampValue);
|
|
1722
1722
|
|
|
1723
1723
|
case 4 /* ServerTimestampValue */ :
|
|
1724
|
-
return Bt(
|
|
1724
|
+
return Bt(bt(t), bt(e));
|
|
1725
1725
|
|
|
1726
1726
|
case 5 /* StringValue */ :
|
|
1727
1727
|
return rt(t.stringValue, e.stringValue);
|
|
@@ -2499,7 +2499,7 @@ class Te extends class {} {
|
|
|
2499
2499
|
/**
|
|
2500
2500
|
* Creates a filter based on the provided arguments.
|
|
2501
2501
|
*/ static create(t, e, n) {
|
|
2502
|
-
return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.V(t, e, n) : new Ee(t, e, n) : "array-contains" /* ARRAY_CONTAINS */ === e ? new
|
|
2502
|
+
return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.V(t, e, n) : new Ee(t, e, n) : "array-contains" /* ARRAY_CONTAINS */ === e ? new be(t, n) : "in" /* IN */ === e ? new Ve(t, n) : "not-in" /* NOT_IN */ === e ? new ve(t, n) : "array-contains-any" /* ARRAY_CONTAINS_ANY */ === e ? new Se(t, n) : new Te(t, e, n);
|
|
2503
2503
|
}
|
|
2504
2504
|
static V(t, e, n) {
|
|
2505
2505
|
return "in" /* IN */ === e ? new Ae(t, n) : new Re(t, n);
|
|
@@ -2551,7 +2551,7 @@ class Ee extends Te {
|
|
|
2551
2551
|
|
|
2552
2552
|
/** Filter that matches on key fields within an array. */ class Ae extends Te {
|
|
2553
2553
|
constructor(t, e) {
|
|
2554
|
-
super(t, "in" /* IN */ , e), this.keys =
|
|
2554
|
+
super(t, "in" /* IN */ , e), this.keys = Pe("in" /* IN */ , e);
|
|
2555
2555
|
}
|
|
2556
2556
|
matches(t) {
|
|
2557
2557
|
return this.keys.some((e => e.isEqual(t.key)));
|
|
@@ -2560,19 +2560,19 @@ class Ee extends Te {
|
|
|
2560
2560
|
|
|
2561
2561
|
/** Filter that matches on key fields not present within an array. */ class Re extends Te {
|
|
2562
2562
|
constructor(t, e) {
|
|
2563
|
-
super(t, "not-in" /* NOT_IN */ , e), this.keys =
|
|
2563
|
+
super(t, "not-in" /* NOT_IN */ , e), this.keys = Pe("not-in" /* NOT_IN */ , e);
|
|
2564
2564
|
}
|
|
2565
2565
|
matches(t) {
|
|
2566
2566
|
return !this.keys.some((e => e.isEqual(t.key)));
|
|
2567
2567
|
}
|
|
2568
2568
|
}
|
|
2569
2569
|
|
|
2570
|
-
function
|
|
2570
|
+
function Pe(t, e) {
|
|
2571
2571
|
var n;
|
|
2572
2572
|
return ((null === (n = e.arrayValue) || void 0 === n ? void 0 : n.values) || []).map((t => xt.fromName(t.referenceValue)));
|
|
2573
2573
|
}
|
|
2574
2574
|
|
|
2575
|
-
/** A Filter that implements the array-contains operator. */ class
|
|
2575
|
+
/** A Filter that implements the array-contains operator. */ class be extends Te {
|
|
2576
2576
|
constructor(t, e) {
|
|
2577
2577
|
super(t, "array-contains" /* ARRAY_CONTAINS */ , e);
|
|
2578
2578
|
}
|
|
@@ -3244,7 +3244,7 @@ class gn {
|
|
|
3244
3244
|
* of the document.
|
|
3245
3245
|
* @param mutationResult - The result of applying the mutation from the backend.
|
|
3246
3246
|
*/ function Tn(t, e, n) {
|
|
3247
|
-
t instanceof
|
|
3247
|
+
t instanceof bn ? function(t, e, n) {
|
|
3248
3248
|
// Unlike setMutationApplyToLocalView, if we're applying a mutation to a
|
|
3249
3249
|
// remote document the server has accepted the mutation so the precondition
|
|
3250
3250
|
// must have held.
|
|
@@ -3279,13 +3279,13 @@ class gn {
|
|
|
3279
3279
|
* @param localWriteTime - A timestamp indicating the local write time of the
|
|
3280
3280
|
* batch this mutation is a part of.
|
|
3281
3281
|
*/ function En(t, e, n) {
|
|
3282
|
-
t instanceof
|
|
3282
|
+
t instanceof bn ? function(t, e, n) {
|
|
3283
3283
|
if (!pn(t.precondition, e))
|
|
3284
3284
|
// The mutation failed to apply (e.g. a document ID created with add()
|
|
3285
3285
|
// caused a name collision).
|
|
3286
3286
|
return;
|
|
3287
3287
|
const s = t.value.clone(), i = Dn(t.fieldTransforms, n, e);
|
|
3288
|
-
s.setAll(i), e.convertToFoundDocument(
|
|
3288
|
+
s.setAll(i), e.convertToFoundDocument(Pn(e), s).setHasLocalMutations();
|
|
3289
3289
|
}
|
|
3290
3290
|
/**
|
|
3291
3291
|
* A mutation that modifies fields of the document at the given key with the
|
|
@@ -3302,7 +3302,7 @@ class gn {
|
|
|
3302
3302
|
*/ (t, e, n) : t instanceof Vn ? function(t, e, n) {
|
|
3303
3303
|
if (!pn(t.precondition, e)) return;
|
|
3304
3304
|
const s = Dn(t.fieldTransforms, n, e), i = e.data;
|
|
3305
|
-
i.setAll(vn(t)), i.setAll(s), e.convertToFoundDocument(
|
|
3305
|
+
i.setAll(vn(t)), i.setAll(s), e.convertToFoundDocument(Pn(e), i).setHasLocalMutations();
|
|
3306
3306
|
}
|
|
3307
3307
|
/**
|
|
3308
3308
|
* Returns a FieldPath/Value map with the content of the PatchMutation.
|
|
@@ -3356,14 +3356,14 @@ function Rn(t, e) {
|
|
|
3356
3356
|
* mutation. Mutations are defined to return the version of the base document
|
|
3357
3357
|
* only if it is an existing document. Deleted and unknown documents have a
|
|
3358
3358
|
* post-mutation version of SnapshotVersion.min().
|
|
3359
|
-
*/ function
|
|
3359
|
+
*/ function Pn(t) {
|
|
3360
3360
|
return t.isFoundDocument() ? t.version : ct.min();
|
|
3361
3361
|
}
|
|
3362
3362
|
|
|
3363
3363
|
/**
|
|
3364
3364
|
* A mutation that creates or replaces the document at the given key with the
|
|
3365
3365
|
* object value contents.
|
|
3366
|
-
*/ class
|
|
3366
|
+
*/ class bn extends In {
|
|
3367
3367
|
constructor(t, e, n, s = []) {
|
|
3368
3368
|
super(), this.key = t, this.value = e, this.precondition = n, this.fieldTransforms = s,
|
|
3369
3369
|
this.type = 0 /* Set */;
|
|
@@ -4857,14 +4857,14 @@ function Rs(t) {
|
|
|
4857
4857
|
return U(t.length > 4 && "documents" === t.get(4)), t.popFirst(5);
|
|
4858
4858
|
}
|
|
4859
4859
|
|
|
4860
|
-
/** Creates a Document proto from key and fields (but no create/update time) */ function
|
|
4860
|
+
/** Creates a Document proto from key and fields (but no create/update time) */ function Ps(t, e, n) {
|
|
4861
4861
|
return {
|
|
4862
4862
|
name: ps(t, e),
|
|
4863
4863
|
fields: n.value.mapValue.fields
|
|
4864
4864
|
};
|
|
4865
4865
|
}
|
|
4866
4866
|
|
|
4867
|
-
function
|
|
4867
|
+
function bs(t, e, n) {
|
|
4868
4868
|
const s = Is(t, e.name), i = ms(e.updateTime), r = new te({
|
|
4869
4869
|
mapValue: {
|
|
4870
4870
|
fields: e.fields
|
|
@@ -4950,12 +4950,12 @@ function vs(t, e) {
|
|
|
4950
4950
|
|
|
4951
4951
|
function Ss(t, e) {
|
|
4952
4952
|
let n;
|
|
4953
|
-
if (e instanceof
|
|
4954
|
-
update:
|
|
4953
|
+
if (e instanceof bn) n = {
|
|
4954
|
+
update: Ps(t, e.key, e.value)
|
|
4955
4955
|
}; else if (e instanceof Cn) n = {
|
|
4956
4956
|
delete: ps(t, e.key)
|
|
4957
4957
|
}; else if (e instanceof Vn) n = {
|
|
4958
|
-
update:
|
|
4958
|
+
update: Ps(t, e.key, e.data),
|
|
4959
4959
|
updateMask: Ks(e.fieldMask)
|
|
4960
4960
|
}; else {
|
|
4961
4961
|
if (!(e instanceof xn)) return L();
|
|
@@ -5024,7 +5024,7 @@ function Ds(t, e) {
|
|
|
5024
5024
|
}(e.updateMask);
|
|
5025
5025
|
return new Vn(i, r, t, n, s);
|
|
5026
5026
|
}
|
|
5027
|
-
return new
|
|
5027
|
+
return new bn(i, r, n, s);
|
|
5028
5028
|
}
|
|
5029
5029
|
if (e.delete) {
|
|
5030
5030
|
const s = Is(t, e.delete);
|
|
@@ -5687,7 +5687,7 @@ class Ii {
|
|
|
5687
5687
|
t && this.At.reject(t), this.aborted || (O("SimpleDb", "Aborting transaction:", t ? t.message : "Client-initiated abort"),
|
|
5688
5688
|
this.aborted = !0, this.transaction.abort());
|
|
5689
5689
|
}
|
|
5690
|
-
|
|
5690
|
+
Pt() {
|
|
5691
5691
|
// If the browser supports V3 IndexedDB, we invoke commit() explicitly to
|
|
5692
5692
|
// speed up index DB processing if the event loop remains blocks.
|
|
5693
5693
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -5704,7 +5704,7 @@ class Ii {
|
|
|
5704
5704
|
* correct, but they allow type safety through the rest of the consuming code.
|
|
5705
5705
|
*/ store(t) {
|
|
5706
5706
|
const e = this.transaction.objectStore(t);
|
|
5707
|
-
return new
|
|
5707
|
+
return new Pi(e);
|
|
5708
5708
|
}
|
|
5709
5709
|
}
|
|
5710
5710
|
|
|
@@ -5725,7 +5725,7 @@ class Ii {
|
|
|
5725
5725
|
* objectstores.
|
|
5726
5726
|
*/
|
|
5727
5727
|
constructor(t, e, n) {
|
|
5728
|
-
this.name = t, this.version = e, this.
|
|
5728
|
+
this.name = t, this.version = e, this.bt = n;
|
|
5729
5729
|
// NOTE: According to https://bugs.webkit.org/show_bug.cgi?id=197050, the
|
|
5730
5730
|
// bug we're checking for should exist in iOS >= 12.2 and < 13, but for
|
|
5731
5731
|
// whatever reason it's much harder to hit after 12.2 so we only proactively
|
|
@@ -5733,7 +5733,7 @@ class Ii {
|
|
|
5733
5733
|
12.2 === Ti.Vt(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.");
|
|
5734
5734
|
}
|
|
5735
5735
|
/** Deletes the specified database. */ static delete(t) {
|
|
5736
|
-
return O("SimpleDb", "Removing database:", t),
|
|
5736
|
+
return O("SimpleDb", "Removing database:", t), bi(window.indexedDB.deleteDatabase(t)).toPromise();
|
|
5737
5737
|
}
|
|
5738
5738
|
/** Returns true if IndexedDB is available in the current environment. */ static vt() {
|
|
5739
5739
|
if (!isIndexedDBAvailable()) return !1;
|
|
@@ -5799,7 +5799,7 @@ class Ii {
|
|
|
5799
5799
|
}, s.onupgradeneeded = t => {
|
|
5800
5800
|
O("SimpleDb", 'Database "' + this.name + '" requires upgrade from version:', t.oldVersion);
|
|
5801
5801
|
const e = t.target.result;
|
|
5802
|
-
this.
|
|
5802
|
+
this.bt.kt(e, s.transaction, t.oldVersion, this.version).next((() => {
|
|
5803
5803
|
O("SimpleDb", "Database upgrade to version " + this.version + " complete");
|
|
5804
5804
|
}));
|
|
5805
5805
|
};
|
|
@@ -5815,7 +5815,7 @@ class Ii {
|
|
|
5815
5815
|
++r;
|
|
5816
5816
|
try {
|
|
5817
5817
|
this.db = await this.Nt(t);
|
|
5818
|
-
const e = Ii.open(this.db, t, i ? "readonly" : "readwrite", n), r = s(e).next((t => (e.
|
|
5818
|
+
const e = Ii.open(this.db, t, i ? "readonly" : "readwrite", n), r = s(e).next((t => (e.Pt(),
|
|
5819
5819
|
t))).catch((t => (
|
|
5820
5820
|
// Abort the transaction if there was an error.
|
|
5821
5821
|
e.abort(t), pi.reject(t)))).toPromise();
|
|
@@ -5876,7 +5876,7 @@ class Ii {
|
|
|
5876
5876
|
*
|
|
5877
5877
|
* NOTE: You CANNOT do this with a keysOnly query.
|
|
5878
5878
|
*/ delete() {
|
|
5879
|
-
return
|
|
5879
|
+
return bi(this.Ft.delete());
|
|
5880
5880
|
}
|
|
5881
5881
|
}
|
|
5882
5882
|
|
|
@@ -5901,14 +5901,14 @@ class Ii {
|
|
|
5901
5901
|
* method return a PersistencePromise instead.
|
|
5902
5902
|
* 3) Provides a higher-level API to avoid needing to do excessive wrapping of
|
|
5903
5903
|
* intermediate IndexedDB types (IDBCursorWithValue, etc.)
|
|
5904
|
-
*/ class
|
|
5904
|
+
*/ class Pi {
|
|
5905
5905
|
constructor(t) {
|
|
5906
5906
|
this.store = t;
|
|
5907
5907
|
}
|
|
5908
5908
|
put(t, e) {
|
|
5909
5909
|
let n;
|
|
5910
5910
|
return void 0 !== e ? (O("SimpleDb", "PUT", this.store.name, t, e), n = this.store.put(e, t)) : (O("SimpleDb", "PUT", this.store.name, "<auto-key>", t),
|
|
5911
|
-
n = this.store.put(t)),
|
|
5911
|
+
n = this.store.put(t)), bi(n);
|
|
5912
5912
|
}
|
|
5913
5913
|
/**
|
|
5914
5914
|
* Adds a new value into an Object Store and returns the new key. Similar to
|
|
@@ -5918,7 +5918,7 @@ class Ii {
|
|
|
5918
5918
|
* @returns The key of the value to add.
|
|
5919
5919
|
*/ add(t) {
|
|
5920
5920
|
O("SimpleDb", "ADD", this.store.name, t, t);
|
|
5921
|
-
return
|
|
5921
|
+
return bi(this.store.add(t));
|
|
5922
5922
|
}
|
|
5923
5923
|
/**
|
|
5924
5924
|
* Gets the object with the specified key from the specified store, or null
|
|
@@ -5929,13 +5929,13 @@ class Ii {
|
|
|
5929
5929
|
*/ get(t) {
|
|
5930
5930
|
// We're doing an unsafe cast to ValueType.
|
|
5931
5931
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5932
|
-
return
|
|
5932
|
+
return bi(this.store.get(t)).next((e => (
|
|
5933
5933
|
// Normalize nonexistence to null.
|
|
5934
5934
|
void 0 === e && (e = null), O("SimpleDb", "GET", this.store.name, t, e), e)));
|
|
5935
5935
|
}
|
|
5936
5936
|
delete(t) {
|
|
5937
5937
|
O("SimpleDb", "DELETE", this.store.name, t);
|
|
5938
|
-
return
|
|
5938
|
+
return bi(this.store.delete(t));
|
|
5939
5939
|
}
|
|
5940
5940
|
/**
|
|
5941
5941
|
* If we ever need more of the count variants, we can add overloads. For now,
|
|
@@ -5944,7 +5944,7 @@ class Ii {
|
|
|
5944
5944
|
* Returns the number of rows in the store.
|
|
5945
5945
|
*/ count() {
|
|
5946
5946
|
O("SimpleDb", "COUNT", this.store.name);
|
|
5947
|
-
return
|
|
5947
|
+
return bi(this.store.count());
|
|
5948
5948
|
}
|
|
5949
5949
|
qt(t, e) {
|
|
5950
5950
|
const n = this.options(t, e);
|
|
@@ -6051,7 +6051,7 @@ class Ii {
|
|
|
6051
6051
|
/**
|
|
6052
6052
|
* Wraps an IDBRequest in a PersistencePromise, using the onsuccess / onerror
|
|
6053
6053
|
* handlers to resolve / reject the PersistencePromise as appropriate.
|
|
6054
|
-
*/ function
|
|
6054
|
+
*/ function bi(t) {
|
|
6055
6055
|
return new pi(((e, n) => {
|
|
6056
6056
|
t.onsuccess = t => {
|
|
6057
6057
|
const n = t.target.result;
|
|
@@ -6341,7 +6341,7 @@ function Di(t, e) {
|
|
|
6341
6341
|
|
|
6342
6342
|
/** Decodes a remote document from storage locally to a Document. */ function Oi(t, e) {
|
|
6343
6343
|
let n;
|
|
6344
|
-
if (e.document) n =
|
|
6344
|
+
if (e.document) n = bs(t.Jt, e.document, !!e.hasCommittedMutations); else if (e.noDocument) {
|
|
6345
6345
|
const t = xt.fromSegments(e.noDocument.path), s = Li(e.noDocument.readTime);
|
|
6346
6346
|
n = ne.newNoDocument(t, s), e.hasCommittedMutations && n.setHasCommittedMutations();
|
|
6347
6347
|
} else {
|
|
@@ -6842,8 +6842,8 @@ function tr(t) {
|
|
|
6842
6842
|
/**
|
|
6843
6843
|
* Writes the "infinity" byte sequence that sorts after all other byte
|
|
6844
6844
|
* sequences written in ascending order.
|
|
6845
|
-
*/
|
|
6846
|
-
this.
|
|
6845
|
+
*/ Pe() {
|
|
6846
|
+
this.be(255), this.be(255);
|
|
6847
6847
|
}
|
|
6848
6848
|
/**
|
|
6849
6849
|
* Writes the "infinity" byte sequence that sorts before all other byte
|
|
@@ -6885,19 +6885,19 @@ function tr(t) {
|
|
|
6885
6885
|
}
|
|
6886
6886
|
/** Writes a single byte ascending to the buffer. */ _e(t) {
|
|
6887
6887
|
const e = 255 & t;
|
|
6888
|
-
0 === e ? (this.
|
|
6888
|
+
0 === e ? (this.be(0), this.be(255)) : 255 === e ? (this.be(255), this.be(0)) : this.be(e);
|
|
6889
6889
|
}
|
|
6890
6890
|
/** Writes a single byte descending to the buffer. */ ge(t) {
|
|
6891
6891
|
const e = 255 & t;
|
|
6892
6892
|
0 === e ? (this.ve(0), this.ve(255)) : 255 === e ? (this.ve(255), this.ve(0)) : this.ve(t);
|
|
6893
6893
|
}
|
|
6894
6894
|
we() {
|
|
6895
|
-
this.
|
|
6895
|
+
this.be(0), this.be(1);
|
|
6896
6896
|
}
|
|
6897
6897
|
ye() {
|
|
6898
6898
|
this.ve(0), this.ve(1);
|
|
6899
6899
|
}
|
|
6900
|
-
|
|
6900
|
+
be(t) {
|
|
6901
6901
|
this.Ae(1), this.buffer[this.position++] = t;
|
|
6902
6902
|
}
|
|
6903
6903
|
ve(t) {
|
|
@@ -6931,7 +6931,7 @@ class nr {
|
|
|
6931
6931
|
this.De.Te(t);
|
|
6932
6932
|
}
|
|
6933
6933
|
ee() {
|
|
6934
|
-
this.De.
|
|
6934
|
+
this.De.Pe();
|
|
6935
6935
|
}
|
|
6936
6936
|
}
|
|
6937
6937
|
|
|
@@ -8045,7 +8045,7 @@ class Tr {
|
|
|
8045
8045
|
// PORTING NOTE: Multi-tab only (state is held in memory in other clients).
|
|
8046
8046
|
/** Returns the mutation queue's metadata from IndexedDb. */
|
|
8047
8047
|
wn(t) {
|
|
8048
|
-
return
|
|
8048
|
+
return Pr(t).get(this.userId).next((t => t || {
|
|
8049
8049
|
userId: this.userId,
|
|
8050
8050
|
lastAcknowledgedBatchId: -1,
|
|
8051
8051
|
lastStreamToken: ""
|
|
@@ -8084,7 +8084,7 @@ function Ar(t) {
|
|
|
8084
8084
|
|
|
8085
8085
|
/**
|
|
8086
8086
|
* Helper to get a typed SimpleDbStore for the mutationQueues object store.
|
|
8087
|
-
*/ function
|
|
8087
|
+
*/ function Pr(t) {
|
|
8088
8088
|
return Di(t, "mutationQueues");
|
|
8089
8089
|
}
|
|
8090
8090
|
|
|
@@ -8119,7 +8119,7 @@ function Ar(t) {
|
|
|
8119
8119
|
* generate in-memory target IDs that are transient and can be reused after a
|
|
8120
8120
|
* restart.
|
|
8121
8121
|
*/
|
|
8122
|
-
class
|
|
8122
|
+
class br {
|
|
8123
8123
|
constructor(t) {
|
|
8124
8124
|
this.mn = t;
|
|
8125
8125
|
}
|
|
@@ -8131,11 +8131,11 @@ class Pr {
|
|
|
8131
8131
|
// as there is no differentiation in the protocol layer between an unset
|
|
8132
8132
|
// number and the number '0'. If we were to sent a target with target ID
|
|
8133
8133
|
// '0', the backend would consider it unset and replace it with its own ID.
|
|
8134
|
-
return new
|
|
8134
|
+
return new br(0);
|
|
8135
8135
|
}
|
|
8136
8136
|
static yn() {
|
|
8137
8137
|
// Sync engine assigns target IDs for limbo document detection.
|
|
8138
|
-
return new
|
|
8138
|
+
return new br(-1);
|
|
8139
8139
|
}
|
|
8140
8140
|
}
|
|
8141
8141
|
|
|
@@ -8166,7 +8166,7 @@ class Pr {
|
|
|
8166
8166
|
// out to have a meaningful performance impact.
|
|
8167
8167
|
allocateTargetId(t) {
|
|
8168
8168
|
return this.pn(t).next((e => {
|
|
8169
|
-
const n = new
|
|
8169
|
+
const n = new br(e.highestTargetId);
|
|
8170
8170
|
return e.highestTargetId = n.next(), this.In(t, e).next((() => e.highestTargetId));
|
|
8171
8171
|
}));
|
|
8172
8172
|
}
|
|
@@ -8394,11 +8394,11 @@ class Pr {
|
|
|
8394
8394
|
constructor(t) {
|
|
8395
8395
|
this.An = t, this.buffer = new qn(xr), this.Rn = 0;
|
|
8396
8396
|
}
|
|
8397
|
-
|
|
8397
|
+
Pn() {
|
|
8398
8398
|
return ++this.Rn;
|
|
8399
8399
|
}
|
|
8400
|
-
|
|
8401
|
-
const e = [ t, this.
|
|
8400
|
+
bn(t) {
|
|
8401
|
+
const e = [ t, this.Pn() ];
|
|
8402
8402
|
if (this.buffer.size < this.An) this.buffer = this.buffer.add(e); else {
|
|
8403
8403
|
const t = this.buffer.last();
|
|
8404
8404
|
xr(e, t) < 0 && (this.buffer = this.buffer.delete(t).add(e));
|
|
@@ -8455,7 +8455,7 @@ class Pr {
|
|
|
8455
8455
|
nthSequenceNumber(t, e) {
|
|
8456
8456
|
if (0 === e) return pi.resolve(nt.A);
|
|
8457
8457
|
const n = new Nr(e);
|
|
8458
|
-
return this.Dn.forEachTarget(t, (t => n.
|
|
8458
|
+
return this.Dn.forEachTarget(t, (t => n.bn(t.sequenceNumber))).next((() => this.Dn.xn(t, (t => n.bn(t))))).next((() => n.maxValue));
|
|
8459
8459
|
}
|
|
8460
8460
|
removeTargets(t, e, n) {
|
|
8461
8461
|
return this.Dn.removeTargets(t, e, n);
|
|
@@ -8552,7 +8552,7 @@ class Or {
|
|
|
8552
8552
|
*/ On(t, e) {
|
|
8553
8553
|
return function(t, e) {
|
|
8554
8554
|
let n = !1;
|
|
8555
|
-
return
|
|
8555
|
+
return Pr(t).zt((s => Er(t, s, e).next((t => (t && (n = !0), pi.resolve(!t)))))).next((() => n));
|
|
8556
8556
|
}(t, e);
|
|
8557
8557
|
}
|
|
8558
8558
|
removeOrphanedDocuments(t, e) {
|
|
@@ -8998,11 +8998,18 @@ function Gr(t, e) {
|
|
|
8998
8998
|
|
|
8999
8999
|
/**
|
|
9000
9000
|
* Comparator that compares document keys according to the primary key sorting
|
|
9001
|
-
* used by the `DbRemoteDocumentDocument` store (by
|
|
9002
|
-
* document ID).
|
|
9001
|
+
* used by the `DbRemoteDocumentDocument` store (by prefix path, collection id
|
|
9002
|
+
* and then document ID).
|
|
9003
|
+
*
|
|
9004
|
+
* Visible for testing.
|
|
9003
9005
|
*/ function Qr(t, e) {
|
|
9004
|
-
const n = t.path.
|
|
9005
|
-
|
|
9006
|
+
const n = t.path.toArray(), s = e.path.toArray();
|
|
9007
|
+
// The ordering is based on https://chromium.googlesource.com/chromium/blink/+/fe5c21fef94dae71c1c3344775b8d8a7f7e6d9ec/Source/modules/indexeddb/IDBKey.cpp#74
|
|
9008
|
+
let i = 0;
|
|
9009
|
+
for (let t = 0; t < n.length - 2 && t < s.length - 2; ++t) if (i = rt(n[t], s[t]),
|
|
9010
|
+
i) return i;
|
|
9011
|
+
return i = rt(n.length, s.length), i || (i = rt(n[n.length - 2], s[s.length - 2]),
|
|
9012
|
+
i || rt(n[n.length - 1], s[s.length - 1]));
|
|
9006
9013
|
}
|
|
9007
9014
|
|
|
9008
9015
|
/**
|
|
@@ -9456,7 +9463,7 @@ class Hr {
|
|
|
9456
9463
|
if (this.isPrimary) return this.Es(t).next((t => {
|
|
9457
9464
|
t || (this.isPrimary = !1, this.Yn.enqueueRetryable((() => this.cs(!1))));
|
|
9458
9465
|
}));
|
|
9459
|
-
})).next((() => this.As(t))).next((e => this.isPrimary && !e ? this.Rs(t).next((() => !1)) : !!e && this.
|
|
9466
|
+
})).next((() => this.As(t))).next((e => this.isPrimary && !e ? this.Rs(t).next((() => !1)) : !!e && this.Ps(t).next((() => !0)))))).catch((t => {
|
|
9460
9467
|
if (Ri(t))
|
|
9461
9468
|
// Proceed with the existing state. Any subsequent access to
|
|
9462
9469
|
// IndexedDB will verify the lease.
|
|
@@ -9469,7 +9476,7 @@ class Hr {
|
|
|
9469
9476
|
}));
|
|
9470
9477
|
}
|
|
9471
9478
|
Es(t) {
|
|
9472
|
-
return Jr(t).get("owner").next((t => pi.resolve(this.
|
|
9479
|
+
return Jr(t).get("owner").next((t => pi.resolve(this.bs(t))));
|
|
9473
9480
|
}
|
|
9474
9481
|
Vs(t) {
|
|
9475
9482
|
return Yr(t).delete(this.clientId);
|
|
@@ -9503,7 +9510,7 @@ class Hr {
|
|
|
9503
9510
|
*/ Is() {
|
|
9504
9511
|
this.os = this.Yn.enqueueAfterDelay("client_metadata_refresh" /* ClientMetadataRefresh */ , 4e3, (() => this.gs().then((() => this.vs())).then((() => this.Is()))));
|
|
9505
9512
|
}
|
|
9506
|
-
/** Checks whether `client` is the local client. */
|
|
9513
|
+
/** Checks whether `client` is the local client. */ bs(t) {
|
|
9507
9514
|
return !!t && t.ownerId === this.clientId;
|
|
9508
9515
|
}
|
|
9509
9516
|
/**
|
|
@@ -9525,8 +9532,8 @@ class Hr {
|
|
|
9525
9532
|
// the foreground.
|
|
9526
9533
|
// - the `forceOwningTab` setting was passed in.
|
|
9527
9534
|
if (null !== e && this.Ss(e.leaseTimestampMs, 5e3) && !this.xs(e.ownerId)) {
|
|
9528
|
-
if (this.
|
|
9529
|
-
if (!this.
|
|
9535
|
+
if (this.bs(e) && this.networkEnabled) return !0;
|
|
9536
|
+
if (!this.bs(e)) {
|
|
9530
9537
|
if (!e.allowTabSynchronization)
|
|
9531
9538
|
// Fail the `canActAsPrimary` check if the current leaseholder has
|
|
9532
9539
|
// not opted into multi-tab synchronization. If this happens at
|
|
@@ -9617,7 +9624,7 @@ class Hr {
|
|
|
9617
9624
|
if (!e) throw F(`Failed to obtain primary lease for action '${t}'.`), this.isPrimary = !1,
|
|
9618
9625
|
this.Yn.enqueueRetryable((() => this.cs(!1))), new Q(G.FAILED_PRECONDITION, gi);
|
|
9619
9626
|
return n(o);
|
|
9620
|
-
})).next((t => this.
|
|
9627
|
+
})).next((t => this.Ps(o).next((() => t)))) : this.$s(o).next((() => n(o)))))).then((t => (o.raiseOnCommittedEvent(),
|
|
9621
9628
|
t)));
|
|
9622
9629
|
}
|
|
9623
9630
|
/**
|
|
@@ -9628,13 +9635,13 @@ class Hr {
|
|
|
9628
9635
|
// be turned off.
|
|
9629
9636
|
$s(t) {
|
|
9630
9637
|
return Jr(t).get("owner").next((t => {
|
|
9631
|
-
if (null !== t && this.Ss(t.leaseTimestampMs, 5e3) && !this.xs(t.ownerId) && !this.
|
|
9638
|
+
if (null !== t && this.Ss(t.leaseTimestampMs, 5e3) && !this.xs(t.ownerId) && !this.bs(t) && !(this.Zn || this.allowTabSynchronization && t.allowTabSynchronization)) throw new Q(G.FAILED_PRECONDITION, zr);
|
|
9632
9639
|
}));
|
|
9633
9640
|
}
|
|
9634
9641
|
/**
|
|
9635
9642
|
* Obtains or extends the new primary lease for the local client. This
|
|
9636
9643
|
* method does not verify that the client is eligible for this lease.
|
|
9637
|
-
*/
|
|
9644
|
+
*/ Ps(t) {
|
|
9638
9645
|
const e = {
|
|
9639
9646
|
ownerId: this.clientId,
|
|
9640
9647
|
allowTabSynchronization: this.allowTabSynchronization,
|
|
@@ -9647,7 +9654,7 @@ class Hr {
|
|
|
9647
9654
|
}
|
|
9648
9655
|
/** Checks the primary lease and removes it if we are the current primary. */ Rs(t) {
|
|
9649
9656
|
const e = Jr(t);
|
|
9650
|
-
return e.get("owner").next((t => this.
|
|
9657
|
+
return e.get("owner").next((t => this.bs(t) ? (O("IndexedDbPersistence", "Releasing primary lease."),
|
|
9651
9658
|
e.delete("owner")) : pi.resolve()));
|
|
9652
9659
|
}
|
|
9653
9660
|
/** Verifies that `updateTimeMs` is within `maxAgeMs`. */ Ss(t, e) {
|
|
@@ -10655,13 +10662,13 @@ async function yo(t, e, n = Xn()) {
|
|
|
10655
10662
|
/**
|
|
10656
10663
|
* Clears all references with a given ID. Calls removeRef() for each key
|
|
10657
10664
|
* removed.
|
|
10658
|
-
*/
|
|
10665
|
+
*/ Pi(t) {
|
|
10659
10666
|
const e = new xt(new _t([])), n = new Eo(e, t), s = new Eo(e, t + 1), i = [];
|
|
10660
10667
|
return this.Ii.forEachInRange([ n, s ], (t => {
|
|
10661
10668
|
this.Ai(t), i.push(t.key);
|
|
10662
10669
|
})), i;
|
|
10663
10670
|
}
|
|
10664
|
-
|
|
10671
|
+
bi() {
|
|
10665
10672
|
this.yi.forEach((t => this.Ai(t)));
|
|
10666
10673
|
}
|
|
10667
10674
|
Ai(t) {
|
|
@@ -10946,7 +10953,7 @@ class Ro {
|
|
|
10946
10953
|
newChangeBuffer(t) {
|
|
10947
10954
|
// `trackRemovals` is ignores since the MemoryRemoteDocumentCache keeps
|
|
10948
10955
|
// a separate changelog and does not need special handling for removals.
|
|
10949
|
-
return new
|
|
10956
|
+
return new Po(this);
|
|
10950
10957
|
}
|
|
10951
10958
|
getSize(t) {
|
|
10952
10959
|
return pi.resolve(this.size);
|
|
@@ -10963,7 +10970,7 @@ class Ro {
|
|
|
10963
10970
|
/**
|
|
10964
10971
|
* Handles the details of adding and updating documents in the MemoryRemoteDocumentCache.
|
|
10965
10972
|
*/
|
|
10966
|
-
class
|
|
10973
|
+
class Po extends $r {
|
|
10967
10974
|
constructor(t) {
|
|
10968
10975
|
super(), this.Kn = t;
|
|
10969
10976
|
}
|
|
@@ -10996,7 +11003,7 @@ class bo extends $r {
|
|
|
10996
11003
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
10997
11004
|
* See the License for the specific language governing permissions and
|
|
10998
11005
|
* limitations under the License.
|
|
10999
|
-
*/ class
|
|
11006
|
+
*/ class bo {
|
|
11000
11007
|
constructor(t) {
|
|
11001
11008
|
this.persistence = t,
|
|
11002
11009
|
/**
|
|
@@ -11013,7 +11020,7 @@ class bo extends $r {
|
|
|
11013
11020
|
* A ordered bidirectional mapping between documents and the remote target
|
|
11014
11021
|
* IDs.
|
|
11015
11022
|
*/
|
|
11016
|
-
this.Bi = new To, this.targetCount = 0, this.Li =
|
|
11023
|
+
this.Bi = new To, this.targetCount = 0, this.Li = br.gn();
|
|
11017
11024
|
}
|
|
11018
11025
|
forEachTarget(t, e) {
|
|
11019
11026
|
return this.Fi.forEach(((t, n) => e(n))), pi.resolve();
|
|
@@ -11034,7 +11041,7 @@ class bo extends $r {
|
|
|
11034
11041
|
Tn(t) {
|
|
11035
11042
|
this.Fi.set(t.target, t);
|
|
11036
11043
|
const e = t.targetId;
|
|
11037
|
-
e > this.highestTargetId && (this.Li = new
|
|
11044
|
+
e > this.highestTargetId && (this.Li = new br(e), this.highestTargetId = e), t.sequenceNumber > this.$i && (this.$i = t.sequenceNumber);
|
|
11038
11045
|
}
|
|
11039
11046
|
addTargetData(t, e) {
|
|
11040
11047
|
return this.Tn(e), this.targetCount += 1, pi.resolve();
|
|
@@ -11043,7 +11050,7 @@ class bo extends $r {
|
|
|
11043
11050
|
return this.Tn(e), pi.resolve();
|
|
11044
11051
|
}
|
|
11045
11052
|
removeTargetData(t, e) {
|
|
11046
|
-
return this.Fi.delete(e.target), this.Bi.
|
|
11053
|
+
return this.Fi.delete(e.target), this.Bi.Pi(e.targetId), this.targetCount -= 1,
|
|
11047
11054
|
pi.resolve();
|
|
11048
11055
|
}
|
|
11049
11056
|
removeTargets(t, e, n) {
|
|
@@ -11072,7 +11079,7 @@ class bo extends $r {
|
|
|
11072
11079
|
})), pi.waitFor(i);
|
|
11073
11080
|
}
|
|
11074
11081
|
removeMatchingKeysForTargetId(t, e) {
|
|
11075
|
-
return this.Bi.
|
|
11082
|
+
return this.Bi.Pi(e), pi.resolve();
|
|
11076
11083
|
}
|
|
11077
11084
|
getMatchingKeysForTargetId(t, e) {
|
|
11078
11085
|
const n = this.Bi.Vi(e);
|
|
@@ -11112,7 +11119,7 @@ class Vo {
|
|
|
11112
11119
|
*/
|
|
11113
11120
|
constructor(t, e) {
|
|
11114
11121
|
this.Ui = {}, this.overlays = {}, this.es = new nt(0), this.ns = !1, this.ns = !0,
|
|
11115
|
-
this.referenceDelegate = t(this), this.fs = new
|
|
11122
|
+
this.referenceDelegate = t(this), this.fs = new bo(this);
|
|
11116
11123
|
this.indexManager = new cr, this.ds = function(t) {
|
|
11117
11124
|
return new Ro(t);
|
|
11118
11125
|
}((t => this.referenceDelegate.qi(t))), this.M = new Mi(e), this._s = new po(this.M);
|
|
@@ -11200,7 +11207,7 @@ class So {
|
|
|
11200
11207
|
return this.Hi.add(e.toString()), pi.resolve();
|
|
11201
11208
|
}
|
|
11202
11209
|
removeTarget(t, e) {
|
|
11203
|
-
this.ji.
|
|
11210
|
+
this.ji.Pi(e.targetId).forEach((t => this.Hi.add(t.toString())));
|
|
11204
11211
|
const n = this.persistence.getTargetCache();
|
|
11205
11212
|
return n.getMatchingKeysForTargetId(t, e.targetId).next((t => {
|
|
11206
11213
|
t.forEach((t => this.Hi.add(t.toString())));
|
|
@@ -11589,12 +11596,12 @@ class Fo {
|
|
|
11589
11596
|
if (this.started) {
|
|
11590
11597
|
if (null !== e.key) if (this.cr.test(e.key)) {
|
|
11591
11598
|
if (null == e.newValue) {
|
|
11592
|
-
const t = this.
|
|
11593
|
-
return this.
|
|
11599
|
+
const t = this.Pr(e.key);
|
|
11600
|
+
return this.br(t, null);
|
|
11594
11601
|
}
|
|
11595
11602
|
{
|
|
11596
11603
|
const t = this.Vr(e.key, e.newValue);
|
|
11597
|
-
if (t) return this.
|
|
11604
|
+
if (t) return this.br(t.clientId, t);
|
|
11598
11605
|
}
|
|
11599
11606
|
} else if (this.hr.test(e.key)) {
|
|
11600
11607
|
if (null !== e.newValue) {
|
|
@@ -11668,7 +11675,7 @@ class Fo {
|
|
|
11668
11675
|
/**
|
|
11669
11676
|
* Parses a client state key in WebStorage. Returns null if the key does not
|
|
11670
11677
|
* match the expected key format.
|
|
11671
|
-
*/
|
|
11678
|
+
*/ Pr(t) {
|
|
11672
11679
|
const e = this.cr.exec(t);
|
|
11673
11680
|
return e ? e[1] : null;
|
|
11674
11681
|
}
|
|
@@ -11676,7 +11683,7 @@ class Fo {
|
|
|
11676
11683
|
* Parses a client state in WebStorage. Returns 'null' if the value could not
|
|
11677
11684
|
* be parsed.
|
|
11678
11685
|
*/ Vr(t, e) {
|
|
11679
|
-
const n = this.
|
|
11686
|
+
const n = this.Pr(t);
|
|
11680
11687
|
return Mo.Yi(n, e);
|
|
11681
11688
|
}
|
|
11682
11689
|
/**
|
|
@@ -11709,7 +11716,7 @@ class Fo {
|
|
|
11709
11716
|
Cr(t) {
|
|
11710
11717
|
return this.syncEngine.Or(t.targetId, t.state, t.error);
|
|
11711
11718
|
}
|
|
11712
|
-
|
|
11719
|
+
br(t, e) {
|
|
11713
11720
|
const n = e ? this.ir.insert(t, e) : this.ir.remove(t), s = this.yr(this.ir), i = this.yr(n), r = [], o = [];
|
|
11714
11721
|
return i.forEach((t => {
|
|
11715
11722
|
s.has(t) || r.push(t);
|
|
@@ -12368,7 +12375,7 @@ class zo {
|
|
|
12368
12375
|
*/
|
|
12369
12376
|
class Ho {
|
|
12370
12377
|
constructor(t, e, n, s, i, r, o, u) {
|
|
12371
|
-
this.Yn = t, this.Ro = n, this.
|
|
12378
|
+
this.Yn = t, this.Ro = n, this.Po = s, this.bo = i, this.authCredentialsProvider = r,
|
|
12372
12379
|
this.appCheckCredentialsProvider = o, this.listener = u, this.state = 0 /* Initial */ ,
|
|
12373
12380
|
/**
|
|
12374
12381
|
* A close count that's incremented every time the stream is closed; used by
|
|
@@ -12514,7 +12521,7 @@ class Ho {
|
|
|
12514
12521
|
qo(t, e) {
|
|
12515
12522
|
const n = this.Uo(this.Vo);
|
|
12516
12523
|
this.stream = this.Go(t, e), this.stream.Hr((() => {
|
|
12517
|
-
n((() => (this.state = 2 /* Open */ , this.So = this.Yn.enqueueAfterDelay(this.
|
|
12524
|
+
n((() => (this.state = 2 /* Open */ , this.So = this.Yn.enqueueAfterDelay(this.Po, 1e4, (() => (this.xo() && (this.state = 3 /* Healthy */),
|
|
12518
12525
|
Promise.resolve()))), this.listener.Hr())));
|
|
12519
12526
|
})), this.stream.Yr((t => {
|
|
12520
12527
|
n((() => this.Ko(t)));
|
|
@@ -12560,7 +12567,7 @@ class Ho {
|
|
|
12560
12567
|
this.M = i;
|
|
12561
12568
|
}
|
|
12562
12569
|
Go(t, e) {
|
|
12563
|
-
return this.
|
|
12570
|
+
return this.bo.lo("Listen", t, e);
|
|
12564
12571
|
}
|
|
12565
12572
|
onMessage(t) {
|
|
12566
12573
|
// A successful response means the stream is healthy
|
|
@@ -12642,7 +12649,7 @@ class Ho {
|
|
|
12642
12649
|
this.zo && this.Jo([]);
|
|
12643
12650
|
}
|
|
12644
12651
|
Go(t, e) {
|
|
12645
|
-
return this.
|
|
12652
|
+
return this.bo.lo("Write", t, e);
|
|
12646
12653
|
}
|
|
12647
12654
|
onMessage(t) {
|
|
12648
12655
|
if (
|
|
@@ -12704,20 +12711,20 @@ class Ho {
|
|
|
12704
12711
|
*/
|
|
12705
12712
|
class Xo extends class {} {
|
|
12706
12713
|
constructor(t, e, n, s) {
|
|
12707
|
-
super(), this.authCredentials = t, this.appCheckCredentials = e, this.
|
|
12714
|
+
super(), this.authCredentials = t, this.appCheckCredentials = e, this.bo = n, this.M = s,
|
|
12708
12715
|
this.tu = !1;
|
|
12709
12716
|
}
|
|
12710
12717
|
eu() {
|
|
12711
12718
|
if (this.tu) throw new Q(G.FAILED_PRECONDITION, "The client has already been terminated.");
|
|
12712
12719
|
}
|
|
12713
12720
|
/** Invokes the provided RPC with auth and AppCheck tokens. */ oo(t, e, n) {
|
|
12714
|
-
return this.eu(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([s, i]) => this.
|
|
12721
|
+
return this.eu(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([s, i]) => this.bo.oo(t, e, n, s, i))).catch((t => {
|
|
12715
12722
|
throw "FirebaseError" === t.name ? (t.code === G.UNAUTHENTICATED && (this.authCredentials.invalidateToken(),
|
|
12716
12723
|
this.appCheckCredentials.invalidateToken()), t) : new Q(G.UNKNOWN, t.toString());
|
|
12717
12724
|
}));
|
|
12718
12725
|
}
|
|
12719
12726
|
/** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ ho(t, e, n) {
|
|
12720
|
-
return this.eu(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([s, i]) => this.
|
|
12727
|
+
return this.eu(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([s, i]) => this.bo.ho(t, e, n, s, i))).catch((t => {
|
|
12721
12728
|
throw "FirebaseError" === t.name ? (t.code === G.UNAUTHENTICATED && (this.authCredentials.invalidateToken(),
|
|
12722
12729
|
this.appCheckCredentials.invalidateToken()), t) : new Q(G.UNKNOWN, t.toString());
|
|
12723
12730
|
}));
|
|
@@ -13169,7 +13176,7 @@ async function Ru(t, e) {
|
|
|
13169
13176
|
pu(t) && Iu(t);
|
|
13170
13177
|
}
|
|
13171
13178
|
|
|
13172
|
-
async function
|
|
13179
|
+
async function Pu(t, e) {
|
|
13173
13180
|
const n = K(t);
|
|
13174
13181
|
n.asyncQueue.verifyOperationInProgress(), O("RemoteStore", "RemoteStore received new credentials");
|
|
13175
13182
|
const s = cu(n);
|
|
@@ -13184,7 +13191,7 @@ async function bu(t, e) {
|
|
|
13184
13191
|
|
|
13185
13192
|
/**
|
|
13186
13193
|
* Toggles the network state when the client gains or loses its primary lease.
|
|
13187
|
-
*/ async function
|
|
13194
|
+
*/ async function bu(t, e) {
|
|
13188
13195
|
const n = K(t);
|
|
13189
13196
|
e ? (n.fu.delete(2 /* IsSecondary */), await eu(n)) : e || (n.fu.add(2 /* IsSecondary */),
|
|
13190
13197
|
await nu(n), n.wu.set("Unknown" /* Unknown */));
|
|
@@ -13202,7 +13209,7 @@ async function bu(t, e) {
|
|
|
13202
13209
|
// Create stream (but note that it is not started yet).
|
|
13203
13210
|
t.gu = function(t, e, n) {
|
|
13204
13211
|
const s = K(t);
|
|
13205
|
-
return s.eu(), new Jo(e, s.
|
|
13212
|
+
return s.eu(), new Jo(e, s.bo, s.authCredentials, s.appCheckCredentials, s.M, n);
|
|
13206
13213
|
}
|
|
13207
13214
|
/**
|
|
13208
13215
|
* @license
|
|
@@ -13241,7 +13248,7 @@ async function bu(t, e) {
|
|
|
13241
13248
|
// Create stream (but note that it is not started yet).
|
|
13242
13249
|
t.yu = function(t, e, n) {
|
|
13243
13250
|
const s = K(t);
|
|
13244
|
-
return s.eu(), new Yo(e, s.
|
|
13251
|
+
return s.eu(), new Yo(e, s.bo, s.authCredentials, s.appCheckCredentials, s.M, n);
|
|
13245
13252
|
}(t.datastore, t.asyncQueue, {
|
|
13246
13253
|
Hr: Tu.bind(null, t),
|
|
13247
13254
|
Yr: Ru.bind(null, t),
|
|
@@ -13623,12 +13630,12 @@ function Lu(t) {
|
|
|
13623
13630
|
* It uses an Observer to dispatch events.
|
|
13624
13631
|
*/ class Uu {
|
|
13625
13632
|
constructor(t, e, n) {
|
|
13626
|
-
this.query = t, this.
|
|
13633
|
+
this.query = t, this.Pu = e,
|
|
13627
13634
|
/**
|
|
13628
13635
|
* Initial snapshots (e.g. from cache) may not be propagated to the wrapped
|
|
13629
13636
|
* observer. This flag is set to true once we've actually raised an event.
|
|
13630
13637
|
*/
|
|
13631
|
-
this.
|
|
13638
|
+
this.bu = !1, this.Vu = null, this.onlineState = "Unknown" /* Unknown */ , this.options = n || {};
|
|
13632
13639
|
}
|
|
13633
13640
|
/**
|
|
13634
13641
|
* Applies the new ViewSnapshot to this listener, raising a user-facing event
|
|
@@ -13644,16 +13651,16 @@ function Lu(t) {
|
|
|
13644
13651
|
/* excludesMetadataChanges= */ !0);
|
|
13645
13652
|
}
|
|
13646
13653
|
let e = !1;
|
|
13647
|
-
return this.
|
|
13654
|
+
return this.bu ? this.vu(t) && (this.Pu.next(t), e = !0) : this.Su(t, this.onlineState) && (this.Du(t),
|
|
13648
13655
|
e = !0), this.Vu = t, e;
|
|
13649
13656
|
}
|
|
13650
13657
|
onError(t) {
|
|
13651
|
-
this.
|
|
13658
|
+
this.Pu.error(t);
|
|
13652
13659
|
}
|
|
13653
13660
|
/** Returns whether a snapshot was raised. */ Au(t) {
|
|
13654
13661
|
this.onlineState = t;
|
|
13655
13662
|
let e = !1;
|
|
13656
|
-
return this.Vu && !this.
|
|
13663
|
+
return this.Vu && !this.bu && this.Su(this.Vu, t) && (this.Du(this.Vu), e = !0),
|
|
13657
13664
|
e;
|
|
13658
13665
|
}
|
|
13659
13666
|
Su(t, e) {
|
|
@@ -13680,8 +13687,8 @@ function Lu(t) {
|
|
|
13680
13687
|
// stripped out.
|
|
13681
13688
|
}
|
|
13682
13689
|
Du(t) {
|
|
13683
|
-
t = Nu.fromInitialDocuments(t.query, t.docs, t.mutatedKeys, t.fromCache), this.
|
|
13684
|
-
this.
|
|
13690
|
+
t = Nu.fromInitialDocuments(t.query, t.docs, t.mutatedKeys, t.fromCache), this.bu = !0,
|
|
13691
|
+
this.Pu.next(t);
|
|
13685
13692
|
}
|
|
13686
13693
|
}
|
|
13687
13694
|
|
|
@@ -13743,7 +13750,7 @@ function Lu(t) {
|
|
|
13743
13750
|
/**
|
|
13744
13751
|
* Converts a BundleDocument to a MutableDocument.
|
|
13745
13752
|
*/ di(t) {
|
|
13746
|
-
return t.metadata.exists ?
|
|
13753
|
+
return t.metadata.exists ? bs(this.M, t.document, !1) : ne.newNoDocument(this.fi(t.metadata.name), this._i(t.metadata.readTime));
|
|
13747
13754
|
}
|
|
13748
13755
|
_i(t) {
|
|
13749
13756
|
return ms(t);
|
|
@@ -14190,7 +14197,7 @@ class Hu {
|
|
|
14190
14197
|
/** Stores user completion handlers, indexed by User and BatchId. */
|
|
14191
14198
|
this.ua = {},
|
|
14192
14199
|
/** Stores user callbacks waiting for all pending writes to be acknowledged. */
|
|
14193
|
-
this.aa = new Map, this.ca =
|
|
14200
|
+
this.aa = new Map, this.ca = br.yn(), this.onlineState = "Unknown" /* Unknown */ ,
|
|
14194
14201
|
// The primary state is set to `true` or `false` immediately after Firestore
|
|
14195
14202
|
// startup. In the interim, a client should only be considered primary if
|
|
14196
14203
|
// `isPrimary` is true.
|
|
@@ -14503,7 +14510,7 @@ function ha(t, e, n = null) {
|
|
|
14503
14510
|
t.sharedClientState.removeLocalQueryTarget(e);
|
|
14504
14511
|
for (const s of t.na.get(e)) t.ea.delete(s), n && t.ta.fa(s, n);
|
|
14505
14512
|
if (t.na.delete(e), t.isPrimaryClient) {
|
|
14506
|
-
t.oa.
|
|
14513
|
+
t.oa.Pi(e).forEach((e => {
|
|
14507
14514
|
t.oa.containsKey(e) ||
|
|
14508
14515
|
// We removed the last reference for this key
|
|
14509
14516
|
la(t, e);
|
|
@@ -14680,7 +14687,7 @@ async function Ta(t, e) {
|
|
|
14680
14687
|
// primary, we need to need to make sure that all views for all targets
|
|
14681
14688
|
// match the state on disk.
|
|
14682
14689
|
const t = n.sharedClientState.getAllActiveQueryTargets(), e = await Ea(n, t.toArray());
|
|
14683
|
-
n.ha = !0, await
|
|
14690
|
+
n.ha = !0, await bu(n.remoteStore, !0);
|
|
14684
14691
|
for (const t of e) su(n.remoteStore, t);
|
|
14685
14692
|
} else if (!1 === e && !1 !== n.ha) {
|
|
14686
14693
|
const t = [];
|
|
@@ -14695,7 +14702,7 @@ async function Ta(t, e) {
|
|
|
14695
14702
|
const e = K(t);
|
|
14696
14703
|
e.ra.forEach(((t, n) => {
|
|
14697
14704
|
iu(e.remoteStore, n);
|
|
14698
|
-
})), e.oa.
|
|
14705
|
+
})), e.oa.bi(), e.ra = new Map, e.ia = new Bn(xt.comparator);
|
|
14699
14706
|
}
|
|
14700
14707
|
/**
|
|
14701
14708
|
* Reconcile the query views of the provided query targets with the state from
|
|
@@ -14708,7 +14715,7 @@ async function Ta(t, e) {
|
|
|
14708
14715
|
* tab to a primary tab
|
|
14709
14716
|
*/
|
|
14710
14717
|
// PORTING NOTE: Multi-Tab only.
|
|
14711
|
-
(n), n.ha = !1, await
|
|
14718
|
+
(n), n.ha = !1, await bu(n.remoteStore, !1);
|
|
14712
14719
|
}
|
|
14713
14720
|
}
|
|
14714
14721
|
|
|
@@ -14763,7 +14770,7 @@ function Ra(t) {
|
|
|
14763
14770
|
|
|
14764
14771
|
/** Applies a query target change from a different tab. */
|
|
14765
14772
|
// PORTING NOTE: Multi-Tab only.
|
|
14766
|
-
async function
|
|
14773
|
+
async function Pa(t, e, n, s) {
|
|
14767
14774
|
const i = K(t);
|
|
14768
14775
|
if (i.ha)
|
|
14769
14776
|
// If we receive a target state notification via WebStorage, we are
|
|
@@ -14789,7 +14796,7 @@ async function ba(t, e, n, s) {
|
|
|
14789
14796
|
}
|
|
14790
14797
|
}
|
|
14791
14798
|
|
|
14792
|
-
/** Adds or removes Watch targets for queries from different tabs. */ async function
|
|
14799
|
+
/** Adds or removes Watch targets for queries from different tabs. */ async function ba(t, e, n) {
|
|
14793
14800
|
const s = Va(t);
|
|
14794
14801
|
if (s.ha) {
|
|
14795
14802
|
for (const t of e) {
|
|
@@ -14977,8 +14984,8 @@ class Da {
|
|
|
14977
14984
|
const e = this.ya.syncEngine;
|
|
14978
14985
|
this.sharedClientState instanceof $o && (this.sharedClientState.syncEngine = {
|
|
14979
14986
|
Mr: Ia.bind(null, e),
|
|
14980
|
-
Or:
|
|
14981
|
-
Fr:
|
|
14987
|
+
Or: Pa.bind(null, e),
|
|
14988
|
+
Fr: ba.bind(null, e),
|
|
14982
14989
|
Fs: Ra.bind(null, e),
|
|
14983
14990
|
kr: pa.bind(null, e)
|
|
14984
14991
|
}, await this.sharedClientState.start()),
|
|
@@ -15006,7 +15013,7 @@ class Da {
|
|
|
15006
15013
|
this.eventManager = this.createEventManager(e), this.syncEngine = this.createSyncEngine(e,
|
|
15007
15014
|
/* startAsPrimary=*/ !t.synchronizeTabs), this.sharedClientState.onlineStateHandler = t => sa(this.syncEngine, t, 1 /* SharedClientState */),
|
|
15008
15015
|
this.remoteStore.remoteSyncer.handleCredentialChange = ma.bind(null, this.syncEngine),
|
|
15009
|
-
await
|
|
15016
|
+
await bu(this.remoteStore, this.syncEngine.isPrimaryClient));
|
|
15010
15017
|
}
|
|
15011
15018
|
createEventManager(t) {
|
|
15012
15019
|
return new Mu;
|
|
@@ -15222,8 +15229,8 @@ class Ma {
|
|
|
15222
15229
|
const t = await this.Ra();
|
|
15223
15230
|
if (null === t) return null;
|
|
15224
15231
|
const e = this.Ea.decode(t), n = Number(e);
|
|
15225
|
-
isNaN(n) && this.
|
|
15226
|
-
const s = await this.
|
|
15232
|
+
isNaN(n) && this.Pa(`length string (${e}) is not valid number`);
|
|
15233
|
+
const s = await this.ba(n);
|
|
15227
15234
|
return new qu(JSON.parse(s), t.length + n);
|
|
15228
15235
|
}
|
|
15229
15236
|
/** First index of '{' from the underlying buffer. */ Va() {
|
|
@@ -15244,7 +15251,7 @@ class Ma {
|
|
|
15244
15251
|
const t = this.Va();
|
|
15245
15252
|
// Broke out of the loop because underlying stream is closed, but still
|
|
15246
15253
|
// cannot find an open bracket.
|
|
15247
|
-
t < 0 && this.
|
|
15254
|
+
t < 0 && this.Pa("Reached the end of bundle when a length string is expected.");
|
|
15248
15255
|
const e = this.buffer.slice(0, t);
|
|
15249
15256
|
// Update the internal buffer to drop the read length.
|
|
15250
15257
|
return this.buffer = this.buffer.slice(t), e;
|
|
@@ -15254,15 +15261,15 @@ class Ma {
|
|
|
15254
15261
|
* number of bytes, pulling more data from the underlying stream if needed.
|
|
15255
15262
|
*
|
|
15256
15263
|
* Returns a string decoded from the read bytes.
|
|
15257
|
-
*/ async
|
|
15264
|
+
*/ async ba(t) {
|
|
15258
15265
|
for (;this.buffer.length < t; ) {
|
|
15259
|
-
await this.va() && this.
|
|
15266
|
+
await this.va() && this.Pa("Reached the end of bundle when more is expected.");
|
|
15260
15267
|
}
|
|
15261
15268
|
const e = this.Ea.decode(this.buffer.slice(0, t));
|
|
15262
15269
|
// Update the internal buffer to drop the read json string.
|
|
15263
15270
|
return this.buffer = this.buffer.slice(t), e;
|
|
15264
15271
|
}
|
|
15265
|
-
|
|
15272
|
+
Pa(t) {
|
|
15266
15273
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
15267
15274
|
throw this.Ta.cancel(), new Error(`Invalid bundle format: ${t}`);
|
|
15268
15275
|
}
|
|
@@ -15589,7 +15596,7 @@ async function Ua(t, e) {
|
|
|
15589
15596
|
await e.initialize(n, s),
|
|
15590
15597
|
// The CredentialChangeListener of the online component provider takes
|
|
15591
15598
|
// precedence over the offline component provider.
|
|
15592
|
-
t.setCredentialChangeListener((t =>
|
|
15599
|
+
t.setCredentialChangeListener((t => Pu(e.remoteStore, t))), t.setAppCheckTokenChangeListener(((t, n) => Pu(e.remoteStore, n))),
|
|
15593
15600
|
t.onlineComponents = e;
|
|
15594
15601
|
}
|
|
15595
15602
|
|
|
@@ -16482,7 +16489,7 @@ function Tc(t, e, ...n) {
|
|
|
16482
16489
|
}
|
|
16483
16490
|
}
|
|
16484
16491
|
|
|
16485
|
-
function
|
|
16492
|
+
function Pc(t) {
|
|
16486
16493
|
/**
|
|
16487
16494
|
* Returns true if obj is an object and contains at least one of the specified
|
|
16488
16495
|
* methods.
|
|
@@ -16517,7 +16524,7 @@ function bc(t) {
|
|
|
16517
16524
|
*/ (t, [ "next", "error", "complete" ]);
|
|
16518
16525
|
}
|
|
16519
16526
|
|
|
16520
|
-
class
|
|
16527
|
+
class bc {
|
|
16521
16528
|
constructor() {
|
|
16522
16529
|
this._progressObserver = {}, this._taskCompletionResolver = new j, this._lastProgress = {
|
|
16523
16530
|
taskState: "Running",
|
|
@@ -16886,7 +16893,7 @@ function Oc(t) {
|
|
|
16886
16893
|
* updates, and completion or error events. It can be used as a
|
|
16887
16894
|
* `Promise<LoadBundleTaskProgress>`.
|
|
16888
16895
|
*/ function Uc(t, e) {
|
|
16889
|
-
const n = Cc(t = lc(t, vc)), s = new
|
|
16896
|
+
const n = Cc(t = lc(t, vc)), s = new bc;
|
|
16890
16897
|
return sc(n, t._databaseId, e, s), s;
|
|
16891
16898
|
}
|
|
16892
16899
|
|
|
@@ -17167,7 +17174,7 @@ class Gc {
|
|
|
17167
17174
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
17168
17175
|
}
|
|
17169
17176
|
toMutation(t, e) {
|
|
17170
|
-
return null !== this.fieldMask ? new Vn(t, this.data, this.fieldMask, e, this.fieldTransforms) : new
|
|
17177
|
+
return null !== this.fieldMask ? new Vn(t, this.data, this.fieldMask, e, this.fieldTransforms) : new bn(t, this.data, e, this.fieldTransforms);
|
|
17171
17178
|
}
|
|
17172
17179
|
}
|
|
17173
17180
|
|
|
@@ -17818,7 +17825,7 @@ function ph(t, e, n, s, i) {
|
|
|
17818
17825
|
* For a `DocumentSnapshot` that points to a non-existing document, any data
|
|
17819
17826
|
* access will return 'undefined'. You can use the `exists()` method to
|
|
17820
17827
|
* explicitly verify a document's existence.
|
|
17821
|
-
*/ class
|
|
17828
|
+
*/ class Ph extends Th {
|
|
17822
17829
|
/** @hideconstructor protected */
|
|
17823
17830
|
constructor(t, e, n, s, i, r) {
|
|
17824
17831
|
super(t, e, n, s, r), this._firestore = t, this._firestoreImpl = t, this.metadata = i;
|
|
@@ -17846,7 +17853,7 @@ function ph(t, e, n, s, i) {
|
|
|
17846
17853
|
if (this._converter) {
|
|
17847
17854
|
// We only want to use the converter and create a new DocumentSnapshot
|
|
17848
17855
|
// if a converter has been provided.
|
|
17849
|
-
const e = new
|
|
17856
|
+
const e = new bh(this._firestore, this._userDataWriter, this._key, this._document, this.metadata,
|
|
17850
17857
|
/* converter= */ null);
|
|
17851
17858
|
return this._converter.fromFirestore(e, t);
|
|
17852
17859
|
}
|
|
@@ -17889,7 +17896,7 @@ function ph(t, e, n, s, i) {
|
|
|
17889
17896
|
* `DocumentSnapshot`. Since query results contain only existing documents, the
|
|
17890
17897
|
* `exists` property will always be true and `data()` will never return
|
|
17891
17898
|
* 'undefined'.
|
|
17892
|
-
*/ class
|
|
17899
|
+
*/ class bh extends Ph {
|
|
17893
17900
|
/**
|
|
17894
17901
|
* Retrieves all fields in the document as an `Object`.
|
|
17895
17902
|
*
|
|
@@ -17938,7 +17945,7 @@ function ph(t, e, n, s, i) {
|
|
|
17938
17945
|
* @param thisArg - The `this` binding for the callback.
|
|
17939
17946
|
*/ forEach(t, e) {
|
|
17940
17947
|
this._snapshot.docs.forEach((n => {
|
|
17941
|
-
t.call(e, new
|
|
17948
|
+
t.call(e, new bh(this._firestore, this._userDataWriter, n.key, n, new Rh(this._snapshot.mutatedKeys.has(n.key), this._snapshot.fromCache), this.query.converter));
|
|
17942
17949
|
}));
|
|
17943
17950
|
}
|
|
17944
17951
|
/**
|
|
@@ -17959,7 +17966,7 @@ function ph(t, e, n, s, i) {
|
|
|
17959
17966
|
let e = 0;
|
|
17960
17967
|
return t._snapshot.docChanges.map((n => ({
|
|
17961
17968
|
type: "added",
|
|
17962
|
-
doc: new
|
|
17969
|
+
doc: new bh(t._firestore, t._userDataWriter, n.doc.key, n.doc, new Rh(t._snapshot.mutatedKeys.has(n.doc.key), t._snapshot.fromCache), t.query.converter),
|
|
17963
17970
|
oldIndex: -1,
|
|
17964
17971
|
newIndex: e++
|
|
17965
17972
|
})));
|
|
@@ -17969,7 +17976,7 @@ function ph(t, e, n, s, i) {
|
|
|
17969
17976
|
// to lookup the index of a document.
|
|
17970
17977
|
let n = t._snapshot.oldDocs;
|
|
17971
17978
|
return t._snapshot.docChanges.filter((t => e || 3 /* Metadata */ !== t.type)).map((e => {
|
|
17972
|
-
const s = new
|
|
17979
|
+
const s = new bh(t._firestore, t._userDataWriter, e.doc.key, e.doc, new Rh(t._snapshot.mutatedKeys.has(e.doc.key), t._snapshot.fromCache), t.query.converter);
|
|
17973
17980
|
let i = -1, r = -1;
|
|
17974
17981
|
return 0 /* Added */ !== e.type && (i = n.indexOf(e.doc.key), n = n.delete(e.doc.key)),
|
|
17975
17982
|
1 /* Removed */ !== e.type && (n = n.add(e.doc), r = n.indexOf(e.doc.key)), {
|
|
@@ -18010,7 +18017,7 @@ function vh(t) {
|
|
|
18010
18017
|
* @param right - A snapshot to compare.
|
|
18011
18018
|
* @returns true if the snapshots are equal.
|
|
18012
18019
|
*/ function Sh(t, e) {
|
|
18013
|
-
return t instanceof
|
|
18020
|
+
return t instanceof Ph && e instanceof Ph ? t._firestore === e._firestore && t._key.isEqual(e._key) && (null === t._document ? null === e._document : t._document.isEqual(e._document)) && t._converter === e._converter : t instanceof Vh && e instanceof Vh && (t._firestore === e._firestore && Ac(t.query, e.query) && t.metadata.isEqual(e.metadata) && t._snapshot.isEqual(e._snapshot));
|
|
18014
18021
|
}
|
|
18015
18022
|
|
|
18016
18023
|
/**
|
|
@@ -18426,11 +18433,11 @@ function Hh(t, e, n) {
|
|
|
18426
18433
|
convertServerTimestamp(t, e) {
|
|
18427
18434
|
switch (e) {
|
|
18428
18435
|
case "previous":
|
|
18429
|
-
const n =
|
|
18436
|
+
const n = Pt(t);
|
|
18430
18437
|
return null == n ? null : this.convertValue(n, e);
|
|
18431
18438
|
|
|
18432
18439
|
case "estimate":
|
|
18433
|
-
return this.convertTimestamp(
|
|
18440
|
+
return this.convertTimestamp(bt(t));
|
|
18434
18441
|
|
|
18435
18442
|
default:
|
|
18436
18443
|
return null;
|
|
@@ -18655,7 +18662,7 @@ class nl extends Jh {
|
|
|
18655
18662
|
*/ function sl(t) {
|
|
18656
18663
|
t = lc(t, mc);
|
|
18657
18664
|
const e = lc(t.firestore, vc), n = Cc(e), s = new nl(e);
|
|
18658
|
-
return Ya(n, t._key).then((n => new
|
|
18665
|
+
return Ya(n, t._key).then((n => new Ph(e, s, t._key, n, new Rh(null !== n && n.hasLocalMutations,
|
|
18659
18666
|
/* fromCache= */ !0), t.converter)));
|
|
18660
18667
|
}
|
|
18661
18668
|
|
|
@@ -18759,11 +18766,11 @@ function fl(t, ...e) {
|
|
|
18759
18766
|
let r = {
|
|
18760
18767
|
includeMetadataChanges: !1
|
|
18761
18768
|
}, o = 0;
|
|
18762
|
-
"object" != typeof e[o] ||
|
|
18769
|
+
"object" != typeof e[o] || Pc(e[o]) || (r = e[o], o++);
|
|
18763
18770
|
const u = {
|
|
18764
18771
|
includeMetadataChanges: r.includeMetadataChanges
|
|
18765
18772
|
};
|
|
18766
|
-
if (
|
|
18773
|
+
if (Pc(e[o])) {
|
|
18767
18774
|
const t = e[o];
|
|
18768
18775
|
e[o] = null === (n = t.next) || void 0 === n ? void 0 : n.bind(t), e[o + 1] = null === (s = t.error) || void 0 === s ? void 0 : s.bind(t),
|
|
18769
18776
|
e[o + 2] = null === (i = t.complete) || void 0 === i ? void 0 : i.bind(t);
|
|
@@ -18796,7 +18803,7 @@ function fl(t, ...e) {
|
|
|
18796
18803
|
}
|
|
18797
18804
|
|
|
18798
18805
|
function dl(t, e) {
|
|
18799
|
-
return ec(Cc(t = lc(t, vc)),
|
|
18806
|
+
return ec(Cc(t = lc(t, vc)), Pc(e) ? e : {
|
|
18800
18807
|
next: e
|
|
18801
18808
|
});
|
|
18802
18809
|
}
|
|
@@ -18816,7 +18823,7 @@ function dl(t, e) {
|
|
|
18816
18823
|
* to a {@link DocumentSnapshot}.
|
|
18817
18824
|
*/ function wl(t, e, n) {
|
|
18818
18825
|
const s = n.docs.get(e._key), i = new nl(t);
|
|
18819
|
-
return new
|
|
18826
|
+
return new Ph(t, i, e._key, s, new Rh(n.hasPendingWrites, n.fromCache), e.converter);
|
|
18820
18827
|
}
|
|
18821
18828
|
|
|
18822
18829
|
/**
|
|
@@ -18896,7 +18903,7 @@ function dl(t, e) {
|
|
|
18896
18903
|
* @returns A `DocumentSnapshot` with the read data.
|
|
18897
18904
|
*/ get(t) {
|
|
18898
18905
|
const e = tl(t, this._firestore), n = new nl(this._firestore);
|
|
18899
|
-
return super.get(t).then((t => new
|
|
18906
|
+
return super.get(t).then((t => new Ph(this._firestore, n, e._key, t._document, new Rh(
|
|
18900
18907
|
/* hasPendingWrites= */ !1,
|
|
18901
18908
|
/* fromCache= */ !1), e.converter)));
|
|
18902
18909
|
}
|
|
@@ -19064,9 +19071,9 @@ function dl(t, e) {
|
|
|
19064
19071
|
// PORTING NOTE: We don't return an error if the user has not enabled
|
|
19065
19072
|
// persistence since `enableIndexeddbPersistence()` can fail on the Web.
|
|
19066
19073
|
if (Array.isArray(n.indexes)) for (const t of n.indexes) {
|
|
19067
|
-
const e =
|
|
19074
|
+
const e = Pl(t, "collectionGroup"), n = [];
|
|
19068
19075
|
if (Array.isArray(t.fields)) for (const e of t.fields) {
|
|
19069
|
-
const t = yh("setIndexConfiguration",
|
|
19076
|
+
const t = yh("setIndexConfiguration", Pl(e, "fieldPath"));
|
|
19070
19077
|
"CONTAINS" === e.arrayConfig ? n.push(new oe(t, 2 /* CONTAINS */)) : "ASCENDING" === e.order ? n.push(new oe(t, 0 /* ASCENDING */)) : "DESCENDING" === e.order && n.push(new oe(t, 1 /* DESCENDING */));
|
|
19071
19078
|
}
|
|
19072
19079
|
s.push(new se(se.UNKNOWN_ID, e, n, ue.empty()));
|
|
@@ -19075,7 +19082,7 @@ function dl(t, e) {
|
|
|
19075
19082
|
return Promise.resolve();
|
|
19076
19083
|
}
|
|
19077
19084
|
|
|
19078
|
-
function
|
|
19085
|
+
function Pl(t, e) {
|
|
19079
19086
|
if ("string" != typeof t[e]) throw new Q(G.INVALID_ARGUMENT, "Missing string value for: " + e);
|
|
19080
19087
|
return t[e];
|
|
19081
19088
|
}
|
|
@@ -19092,10 +19099,10 @@ function bl(t, e) {
|
|
|
19092
19099
|
return n = Object.assign({
|
|
19093
19100
|
useFetchStreams: e
|
|
19094
19101
|
}, n), i._setSettings(n), i;
|
|
19095
|
-
}), "PUBLIC")), registerVersion(D, "3.4.
|
|
19102
|
+
}), "PUBLIC")), registerVersion(D, "3.4.8", t),
|
|
19096
19103
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
|
19097
|
-
registerVersion(D, "3.4.
|
|
19104
|
+
registerVersion(D, "3.4.8", "esm2017");
|
|
19098
19105
|
}();
|
|
19099
19106
|
|
|
19100
|
-
export { Jh as AbstractUserDataWriter, jc as Bytes, Vc as CACHE_SIZE_UNLIMITED, yc as CollectionReference, mc as DocumentReference,
|
|
19107
|
+
export { Jh as AbstractUserDataWriter, jc as Bytes, Vc as CACHE_SIZE_UNLIMITED, yc as CollectionReference, mc as DocumentReference, Ph as DocumentSnapshot, Gc as FieldPath, Wc as FieldValue, vc as Firestore, Q as FirestoreError, zc as GeoPoint, bc as LoadBundleTask, gc as Query, Ch as QueryConstraint, bh as QueryDocumentSnapshot, Vh as QuerySnapshot, Rh as SnapshotMetadata, at as Timestamp, ml as Transaction, Zh as WriteBatch, vt as _DatabaseId, xt as _DocumentKey, et as _EmptyAppCheckTokenProvider, z as _EmptyAuthCredentialsProvider, mt as _FieldPath, lc as _cast, q as _debugAssert, yt as _isBase64Available, $ as _logWarn, Rl as _setIndexConfiguration, uc as _validateIsNotUsedTogether, ll as addDoc, Tl as arrayRemove, Il as arrayUnion, Oc as clearIndexedDbPersistence, pc as collection, Ic as collectionGroup, wc as connectFirestoreEmulator, hl as deleteDoc, yl as deleteField, Bc as disableNetwork, Tc as doc, Qc as documentId, Nc as enableIndexedDbPersistence, kc as enableMultiTabIndexedDbPersistence, $c as enableNetwork, Qh as endAt, Gh as endBefore, Cc as ensureFirestoreConfigured, _l as executeWrite, el as getDoc, sl as getDocFromCache, il as getDocFromServer, rl as getDocs, ol as getDocsFromCache, ul as getDocsFromServer, Dc as getFirestore, El as increment, Sc as initializeFirestore, $h as limit, Bh as limitToLast, Uc as loadBundle, qc as namedQuery, fl as onSnapshot, dl as onSnapshotsInSync, Oh as orderBy, xh as query, Ac as queryEqual, Ec as refEqual, gl as runTransaction, pl as serverTimestamp, al as setDoc, M as setLogLevel, Sh as snapshotEqual, qh as startAfter, Uh as startAt, Lc as terminate, cl as updateDoc, Fc as waitForPendingWrites, kh as where, Al as writeBatch };
|
|
19101
19108
|
//# sourceMappingURL=index.esm2017.js.map
|