@firebase/firestore 3.4.9-canary.2cd1cc76f → 3.4.9-canary.2d6a4143d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm2017.js +3 -3
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +3 -3
- package/dist/index.node.cjs.js +2 -2
- package/dist/index.node.mjs +2 -2
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +832 -832
- package/dist/lite/index.browser.esm2017.js +2 -2
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +2 -2
- package/dist/lite/index.node.cjs.js +2 -2
- package/dist/lite/index.node.mjs +2 -2
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +2 -2
- package/package.json +12 -12
package/dist/index.rn.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Component as r } from "@firebase/component";
|
|
|
4
4
|
|
|
5
5
|
import { Logger as o, LogLevel as u } from "@firebase/logger";
|
|
6
6
|
|
|
7
|
-
import { FirebaseError as
|
|
7
|
+
import { FirebaseError as a, base64 as c, getUA as h, isIndexedDBAvailable as l, isSafari as f, isMobileCordova as d, isReactNative as _, isElectron as w, isIE as m, isUWP as g, isBrowserExtension as y, createMockUserToken as p, getModularInstance as I, deepEqual as T } from "@firebase/util";
|
|
8
8
|
|
|
9
9
|
import { XhrIo as E, EventType as A, ErrorCode as R, createWebChannelTransport as P, getStatEventTarget as b, FetchXmlHttpFactory as V, WebChannel as v, Event as S, Stat as D } from "@firebase/webchannel-wrapper";
|
|
10
10
|
|
|
@@ -70,7 +70,7 @@ x.MOCK_USER = new x("mock-user");
|
|
|
70
70
|
* See the License for the specific language governing permissions and
|
|
71
71
|
* limitations under the License.
|
|
72
72
|
*/
|
|
73
|
-
let N = "9.8.2-canary.
|
|
73
|
+
let N = "9.8.2-canary.2d6a4143d";
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* @license
|
|
@@ -356,7 +356,7 @@ e) {
|
|
|
356
356
|
DATA_LOSS: "data-loss"
|
|
357
357
|
};
|
|
358
358
|
|
|
359
|
-
/** An error returned by a Firestore operation. */ class j extends
|
|
359
|
+
/** An error returned by a Firestore operation. */ class j extends a {
|
|
360
360
|
/** @hideconstructor */
|
|
361
361
|
constructor(
|
|
362
362
|
/**
|
|
@@ -745,7 +745,7 @@ function ot(t, e) {
|
|
|
745
745
|
/**
|
|
746
746
|
* Returns the immediate lexicographically-following string. This is useful to
|
|
747
747
|
* construct an inclusive range for indexeddb iterators.
|
|
748
|
-
*/ function
|
|
748
|
+
*/ function at(t) {
|
|
749
749
|
// Return the input string, with an additional NUL byte appended.
|
|
750
750
|
return t + "\0";
|
|
751
751
|
}
|
|
@@ -781,7 +781,7 @@ function ot(t, e) {
|
|
|
781
781
|
* For examples and further specifications, refer to the
|
|
782
782
|
* {@link https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto | Timestamp definition}.
|
|
783
783
|
*/
|
|
784
|
-
class
|
|
784
|
+
class ct {
|
|
785
785
|
/**
|
|
786
786
|
* Creates a new timestamp.
|
|
787
787
|
*
|
|
@@ -813,7 +813,7 @@ class at {
|
|
|
813
813
|
*
|
|
814
814
|
* @returns a new timestamp representing the current date.
|
|
815
815
|
*/ static now() {
|
|
816
|
-
return
|
|
816
|
+
return ct.fromMillis(Date.now());
|
|
817
817
|
}
|
|
818
818
|
/**
|
|
819
819
|
* Creates a new timestamp from the given date.
|
|
@@ -822,7 +822,7 @@ class at {
|
|
|
822
822
|
* @returns A new `Timestamp` representing the same point in time as the given
|
|
823
823
|
* date.
|
|
824
824
|
*/ static fromDate(t) {
|
|
825
|
-
return
|
|
825
|
+
return ct.fromMillis(t.getTime());
|
|
826
826
|
}
|
|
827
827
|
/**
|
|
828
828
|
* Creates a new timestamp from the given number of milliseconds.
|
|
@@ -833,7 +833,7 @@ class at {
|
|
|
833
833
|
* number of milliseconds.
|
|
834
834
|
*/ static fromMillis(t) {
|
|
835
835
|
const e = Math.floor(t / 1e3), n = Math.floor(1e6 * (t - 1e3 * e));
|
|
836
|
-
return new
|
|
836
|
+
return new ct(e, n);
|
|
837
837
|
}
|
|
838
838
|
/**
|
|
839
839
|
* Converts a `Timestamp` to a JavaScript `Date` object. This conversion
|
|
@@ -919,10 +919,10 @@ class at {
|
|
|
919
919
|
return new ht(t);
|
|
920
920
|
}
|
|
921
921
|
static min() {
|
|
922
|
-
return new ht(new
|
|
922
|
+
return new ht(new ct(0, 0));
|
|
923
923
|
}
|
|
924
924
|
static max() {
|
|
925
|
-
return new ht(new
|
|
925
|
+
return new ht(new ct(253402300799, 999999999));
|
|
926
926
|
}
|
|
927
927
|
compareTo(t) {
|
|
928
928
|
return this.timestamp._compareTo(t.timestamp);
|
|
@@ -1723,7 +1723,7 @@ function Pt(t) {
|
|
|
1723
1723
|
// We use `decodeStringToByteArray()` instead of `decodeString()` since
|
|
1724
1724
|
// `decodeString()` returns Unicode strings, which doesn't match the values
|
|
1725
1725
|
// returned by `atob()`'s Latin1 representation.
|
|
1726
|
-
|
|
1726
|
+
c.decodeStringToByteArray(t, false));
|
|
1727
1727
|
}
|
|
1728
1728
|
|
|
1729
1729
|
/** Converts a binary string to a Base64 encoded string. */
|
|
@@ -1797,7 +1797,7 @@ function bt() {
|
|
|
1797
1797
|
return function(t) {
|
|
1798
1798
|
const e = [];
|
|
1799
1799
|
for (let n = 0; n < t.length; n++) e[n] = t.charCodeAt(n);
|
|
1800
|
-
return
|
|
1800
|
+
return c.encodeByteArray(e, !1);
|
|
1801
1801
|
}(this.binaryString);
|
|
1802
1802
|
}
|
|
1803
1803
|
toUint8Array() {
|
|
@@ -1939,7 +1939,7 @@ function Nt(t) {
|
|
|
1939
1939
|
* Returns the local time at which this timestamp was first set.
|
|
1940
1940
|
*/ function kt(t) {
|
|
1941
1941
|
const e = St(t.mapValue.fields.__local_write_time__.timestampValue);
|
|
1942
|
-
return new
|
|
1942
|
+
return new ct(e.seconds, e.nanos);
|
|
1943
1943
|
}
|
|
1944
1944
|
|
|
1945
1945
|
/**
|
|
@@ -2466,12 +2466,12 @@ function ue(t, e) {
|
|
|
2466
2466
|
/**
|
|
2467
2467
|
* An ObjectValue represents a MapValue in the Firestore Proto and offers the
|
|
2468
2468
|
* ability to add and remove fields (via the ObjectValueBuilder).
|
|
2469
|
-
*/ class
|
|
2469
|
+
*/ class ae {
|
|
2470
2470
|
constructor(t) {
|
|
2471
2471
|
this.value = t;
|
|
2472
2472
|
}
|
|
2473
2473
|
static empty() {
|
|
2474
|
-
return new
|
|
2474
|
+
return new ae({
|
|
2475
2475
|
mapValue: {}
|
|
2476
2476
|
});
|
|
2477
2477
|
}
|
|
@@ -2552,18 +2552,18 @@ function ue(t, e) {
|
|
|
2552
2552
|
for (const e of n) delete t[e];
|
|
2553
2553
|
}
|
|
2554
2554
|
clone() {
|
|
2555
|
-
return new
|
|
2555
|
+
return new ae(ne(this.value));
|
|
2556
2556
|
}
|
|
2557
2557
|
}
|
|
2558
2558
|
|
|
2559
2559
|
/**
|
|
2560
2560
|
* Returns a FieldMask built from all fields in a MapValue.
|
|
2561
|
-
*/ function
|
|
2561
|
+
*/ function ce(t) {
|
|
2562
2562
|
const e = [];
|
|
2563
2563
|
return ft(t.fields, ((t, n) => {
|
|
2564
2564
|
const s = new At([ t ]);
|
|
2565
2565
|
if (ee(n)) {
|
|
2566
|
-
const t =
|
|
2566
|
+
const t = ce(n.mapValue).fields;
|
|
2567
2567
|
if (0 === t.length)
|
|
2568
2568
|
// Preserve the empty map by adding it to the FieldMask.
|
|
2569
2569
|
e.push(s); else
|
|
@@ -2611,7 +2611,7 @@ function ue(t, e) {
|
|
|
2611
2611
|
* Creates a document with no known version or data, but which can serve as
|
|
2612
2612
|
* base document for mutations.
|
|
2613
2613
|
*/ static newInvalidDocument(t) {
|
|
2614
|
-
return new he(t, 0 /* INVALID */ , ht.min(), ht.min(),
|
|
2614
|
+
return new he(t, 0 /* INVALID */ , ht.min(), ht.min(), ae.empty(), 0 /* SYNCED */);
|
|
2615
2615
|
}
|
|
2616
2616
|
/**
|
|
2617
2617
|
* Creates a new document that is known to exist with the given data at the
|
|
@@ -2620,14 +2620,14 @@ function ue(t, e) {
|
|
|
2620
2620
|
return new he(t, 1 /* FOUND_DOCUMENT */ , e, ht.min(), n, 0 /* SYNCED */);
|
|
2621
2621
|
}
|
|
2622
2622
|
/** Creates a new document that is known to not exist at the given version. */ static newNoDocument(t, e) {
|
|
2623
|
-
return new he(t, 2 /* NO_DOCUMENT */ , e, ht.min(),
|
|
2623
|
+
return new he(t, 2 /* NO_DOCUMENT */ , e, ht.min(), ae.empty(), 0 /* SYNCED */);
|
|
2624
2624
|
}
|
|
2625
2625
|
/**
|
|
2626
2626
|
* Creates a new document that is known to exist at the given version but
|
|
2627
2627
|
* whose data is not known (e.g. a document that was updated without a known
|
|
2628
2628
|
* base document).
|
|
2629
2629
|
*/ static newUnknownDocument(t, e) {
|
|
2630
|
-
return new he(t, 3 /* UNKNOWN_DOCUMENT */ , e, ht.min(),
|
|
2630
|
+
return new he(t, 3 /* UNKNOWN_DOCUMENT */ , e, ht.min(), ae.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
|
|
2631
2631
|
}
|
|
2632
2632
|
/**
|
|
2633
2633
|
* Changes the document type to indicate that it exists and that its version
|
|
@@ -2640,7 +2640,7 @@ function ue(t, e) {
|
|
|
2640
2640
|
* Changes the document type to indicate that it doesn't exist at the given
|
|
2641
2641
|
* version.
|
|
2642
2642
|
*/ convertToNoDocument(t) {
|
|
2643
|
-
return this.version = t, this.documentType = 2 /* NO_DOCUMENT */ , this.data =
|
|
2643
|
+
return this.version = t, this.documentType = 2 /* NO_DOCUMENT */ , this.data = ae.empty(),
|
|
2644
2644
|
this.documentState = 0 /* SYNCED */ , this;
|
|
2645
2645
|
}
|
|
2646
2646
|
/**
|
|
@@ -2648,7 +2648,7 @@ function ue(t, e) {
|
|
|
2648
2648
|
* that its data is not known (e.g. a document that was updated without a known
|
|
2649
2649
|
* base document).
|
|
2650
2650
|
*/ convertToUnknownDocument(t) {
|
|
2651
|
-
return this.version = t, this.documentType = 3 /* UNKNOWN_DOCUMENT */ , this.data =
|
|
2651
|
+
return this.version = t, this.documentType = 3 /* UNKNOWN_DOCUMENT */ , this.data = ae.empty(),
|
|
2652
2652
|
this.documentState = 2 /* HAS_COMMITTED_MUTATIONS */ , this;
|
|
2653
2653
|
}
|
|
2654
2654
|
setHasCommittedMutations() {
|
|
@@ -2780,7 +2780,7 @@ class _e {
|
|
|
2780
2780
|
// Unicode codepoints to generate MAX_DOCUMENT_KEY, it is much easier to use
|
|
2781
2781
|
// `(readTime + 1, DocumentKey.empty())` since `> DocumentKey.empty()` matches
|
|
2782
2782
|
// all valid document IDs.
|
|
2783
|
-
const n = t.toTimestamp().seconds, s = t.toTimestamp().nanoseconds + 1, i = ht.fromTimestamp(1e9 === s ? new
|
|
2783
|
+
const n = t.toTimestamp().seconds, s = t.toTimestamp().nanoseconds + 1, i = ht.fromTimestamp(1e9 === s ? new ct(n + 1, 0) : new ct(n, s));
|
|
2784
2784
|
return new ye(i, Lt.empty(), e);
|
|
2785
2785
|
}
|
|
2786
2786
|
|
|
@@ -3488,7 +3488,7 @@ function on(t, e, n) {
|
|
|
3488
3488
|
|
|
3489
3489
|
/**
|
|
3490
3490
|
* Returns an IntegerValue for `value`.
|
|
3491
|
-
*/ function
|
|
3491
|
+
*/ function an(t) {
|
|
3492
3492
|
return {
|
|
3493
3493
|
integerValue: "" + t
|
|
3494
3494
|
};
|
|
@@ -3498,8 +3498,8 @@ function on(t, e, n) {
|
|
|
3498
3498
|
* Returns a value for a number that's appropriate to put into a proto.
|
|
3499
3499
|
* The return value is an IntegerValue if it can safely represent the value,
|
|
3500
3500
|
* otherwise a DoubleValue is returned.
|
|
3501
|
-
*/ function
|
|
3502
|
-
return Bt(e) ?
|
|
3501
|
+
*/ function cn(t, e) {
|
|
3502
|
+
return Bt(e) ? an(e) : un(t, e);
|
|
3503
3503
|
}
|
|
3504
3504
|
|
|
3505
3505
|
/**
|
|
@@ -3552,7 +3552,7 @@ function on(t, e, n) {
|
|
|
3552
3552
|
// precision and resolves overflows by reducing precision, we do not
|
|
3553
3553
|
// manually cap overflows at 2^63.
|
|
3554
3554
|
const n = dn(t, e), s = In(n) + In(t.k);
|
|
3555
|
-
return Yt(n) && Yt(t.k) ?
|
|
3555
|
+
return Yt(n) && Yt(t.k) ? an(s) : un(t.O, s);
|
|
3556
3556
|
}(t, e);
|
|
3557
3557
|
}
|
|
3558
3558
|
|
|
@@ -3781,7 +3781,7 @@ class Rn {
|
|
|
3781
3781
|
// mask is null when sets or deletes are applied to the current document.
|
|
3782
3782
|
if (null === e) return t.isNoDocument() ? new $n(t.key, Pn.none()) : new Nn(t.key, t.data, Pn.none());
|
|
3783
3783
|
{
|
|
3784
|
-
const n = t.data, s =
|
|
3784
|
+
const n = t.data, s = ae.empty();
|
|
3785
3785
|
let i = new gt(At.comparator);
|
|
3786
3786
|
for (let t of e.fields) if (!i.has(t)) {
|
|
3787
3787
|
let e = n.field(t);
|
|
@@ -3914,7 +3914,7 @@ class Rn {
|
|
|
3914
3914
|
let n = null;
|
|
3915
3915
|
for (const s of t.fieldTransforms) {
|
|
3916
3916
|
const t = e.data.field(s.field), i = dn(s.transform, t || null);
|
|
3917
|
-
null != i && (null === n && (n =
|
|
3917
|
+
null != i && (null === n && (n = ae.empty()), n.set(s.field, i));
|
|
3918
3918
|
}
|
|
3919
3919
|
return n || null;
|
|
3920
3920
|
}
|
|
@@ -4481,7 +4481,7 @@ class us {
|
|
|
4481
4481
|
}
|
|
4482
4482
|
}
|
|
4483
4483
|
|
|
4484
|
-
class
|
|
4484
|
+
class as {
|
|
4485
4485
|
constructor(
|
|
4486
4486
|
/** What kind of change occurred to the watch target. */
|
|
4487
4487
|
t,
|
|
@@ -4499,7 +4499,7 @@ class cs {
|
|
|
4499
4499
|
}
|
|
4500
4500
|
}
|
|
4501
4501
|
|
|
4502
|
-
/** Tracks the internal state of a Watch target. */ class
|
|
4502
|
+
/** Tracks the internal state of a Watch target. */ class cs {
|
|
4503
4503
|
constructor() {
|
|
4504
4504
|
/**
|
|
4505
4505
|
* The number of pending responses (adds or removes) that we are waiting on.
|
|
@@ -4617,8 +4617,8 @@ class hs {
|
|
|
4617
4617
|
/**
|
|
4618
4618
|
* Processes and adds the DocumentWatchChange to the current set of changes.
|
|
4619
4619
|
*/ ut(t) {
|
|
4620
|
-
for (const e of t.M) t.F && t.F.isFoundDocument() ? this.
|
|
4621
|
-
for (const e of t.removedTargetIds) this.
|
|
4620
|
+
for (const e of t.M) t.F && t.F.isFoundDocument() ? this.at(e, t.F) : this.ct(e, t.key, t.F);
|
|
4621
|
+
for (const e of t.removedTargetIds) this.ct(e, t.key, t.F);
|
|
4622
4622
|
}
|
|
4623
4623
|
/** Processes and adds the WatchTargetChange to the current set of changes. */ ht(t) {
|
|
4624
4624
|
this.forEachTarget(t, (e => {
|
|
@@ -4688,7 +4688,7 @@ class hs {
|
|
|
4688
4688
|
// until it is resolved, essentially exposing inconsistency between
|
|
4689
4689
|
// queries.
|
|
4690
4690
|
const n = new Lt(t.path);
|
|
4691
|
-
this.
|
|
4691
|
+
this.ct(e, n, he.newNoDocument(n, ht.min()));
|
|
4692
4692
|
} else q(1 === n); else {
|
|
4693
4693
|
this.gt(e) !== n && (
|
|
4694
4694
|
// Existence filter mismatch: We reset the mapping and raise a new
|
|
@@ -4715,7 +4715,7 @@ class hs {
|
|
|
4715
4715
|
// instead resulting in an explicit delete message and we could
|
|
4716
4716
|
// remove this special logic.
|
|
4717
4717
|
const e = new Lt(i.target.path);
|
|
4718
|
-
null !== this.it.get(e) || this.It(s, e) || this.
|
|
4718
|
+
null !== this.it.get(e) || this.It(s, e) || this.ct(s, e, he.newNoDocument(e, t));
|
|
4719
4719
|
}
|
|
4720
4720
|
n.j && (e.set(s, n.H()), n.J());
|
|
4721
4721
|
}
|
|
@@ -4741,7 +4741,7 @@ class hs {
|
|
|
4741
4741
|
* its document key to the given target's mapping.
|
|
4742
4742
|
*/
|
|
4743
4743
|
// Visible for testing.
|
|
4744
|
-
|
|
4744
|
+
at(t, e) {
|
|
4745
4745
|
if (!this.ft(t)) return;
|
|
4746
4746
|
const n = this.It(t, e.key) ? 2 /* Modified */ : 0 /* Added */;
|
|
4747
4747
|
this.lt(t).Y(e.key, n), this.it = this.it.insert(e.key, e), this.rt = this.rt.insert(e.key, this.Tt(e.key).add(t));
|
|
@@ -4754,7 +4754,7 @@ class hs {
|
|
|
4754
4754
|
* to update the remote document cache.
|
|
4755
4755
|
*/
|
|
4756
4756
|
// Visible for testing.
|
|
4757
|
-
|
|
4757
|
+
ct(t, e, n) {
|
|
4758
4758
|
if (!this.ft(t)) return;
|
|
4759
4759
|
const s = this.lt(t);
|
|
4760
4760
|
this.It(t, e) ? s.Y(e, 1 /* Removed */) :
|
|
@@ -4781,7 +4781,7 @@ class hs {
|
|
|
4781
4781
|
}
|
|
4782
4782
|
lt(t) {
|
|
4783
4783
|
let e = this.st.get(t);
|
|
4784
|
-
return e || (e = new
|
|
4784
|
+
return e || (e = new cs, this.st.set(t, e)), e;
|
|
4785
4785
|
}
|
|
4786
4786
|
Tt(t) {
|
|
4787
4787
|
let e = this.rt.get(t);
|
|
@@ -4807,9 +4807,9 @@ class hs {
|
|
|
4807
4807
|
* 'current' to false, clears the resume token and removes its target mapping
|
|
4808
4808
|
* from all documents).
|
|
4809
4809
|
*/ dt(t) {
|
|
4810
|
-
this.st.set(t, new
|
|
4810
|
+
this.st.set(t, new cs);
|
|
4811
4811
|
this.nt.getRemoteKeysForTarget(t).forEach((e => {
|
|
4812
|
-
this.
|
|
4812
|
+
this.ct(t, e, /*updatedDocument=*/ null);
|
|
4813
4813
|
}));
|
|
4814
4814
|
}
|
|
4815
4815
|
/**
|
|
@@ -4916,7 +4916,7 @@ function gs(t, e) {
|
|
|
4916
4916
|
function ps(t) {
|
|
4917
4917
|
return q(!!t), ht.fromTimestamp(function(t) {
|
|
4918
4918
|
const e = St(t);
|
|
4919
|
-
return new
|
|
4919
|
+
return new ct(e.seconds, e.nanos);
|
|
4920
4920
|
}(t));
|
|
4921
4921
|
}
|
|
4922
4922
|
|
|
@@ -4971,7 +4971,7 @@ function Vs(t) {
|
|
|
4971
4971
|
}
|
|
4972
4972
|
|
|
4973
4973
|
function Ss(t, e, n) {
|
|
4974
|
-
const s = As(t, e.name), i = ps(e.updateTime), r = new
|
|
4974
|
+
const s = As(t, e.name), i = ps(e.updateTime), r = new ae({
|
|
4975
4975
|
mapValue: {
|
|
4976
4976
|
fields: e.fields
|
|
4977
4977
|
}
|
|
@@ -4982,7 +4982,7 @@ function Ss(t, e, n) {
|
|
|
4982
4982
|
function Ds(t, e) {
|
|
4983
4983
|
return "found" in e ? function(t, e) {
|
|
4984
4984
|
q(!!e.found), e.found.name, e.found.updateTime;
|
|
4985
|
-
const n = As(t, e.found.name), s = ps(e.found.updateTime), i = new
|
|
4985
|
+
const n = As(t, e.found.name), s = ps(e.found.updateTime), i = new ae({
|
|
4986
4986
|
mapValue: {
|
|
4987
4987
|
fields: e.found.fields
|
|
4988
4988
|
}
|
|
@@ -5018,17 +5018,17 @@ function Cs(t, e) {
|
|
|
5018
5018
|
* our generated proto interfaces say Int32Value must be. But GRPC actually
|
|
5019
5019
|
* expects a { value: <number> } struct.
|
|
5020
5020
|
*/ (o);
|
|
5021
|
-
n = new
|
|
5021
|
+
n = new as(s, i, r, u || null);
|
|
5022
5022
|
} else if ("documentChange" in e) {
|
|
5023
5023
|
e.documentChange;
|
|
5024
5024
|
const s = e.documentChange;
|
|
5025
5025
|
s.document, s.document.name, s.document.updateTime;
|
|
5026
|
-
const i = As(t, s.document.name), r = ps(s.document.updateTime), o = new
|
|
5026
|
+
const i = As(t, s.document.name), r = ps(s.document.updateTime), o = new ae({
|
|
5027
5027
|
mapValue: {
|
|
5028
5028
|
fields: s.document.fields
|
|
5029
5029
|
}
|
|
5030
|
-
}), u = he.newFoundDocument(i, r, o),
|
|
5031
|
-
n = new os(
|
|
5030
|
+
}), u = he.newFoundDocument(i, r, o), a = s.targetIds || [], c = s.removedTargetIds || [];
|
|
5031
|
+
n = new os(a, c, u.key, u);
|
|
5032
5032
|
} else if ("documentDelete" in e) {
|
|
5033
5033
|
e.documentDelete;
|
|
5034
5034
|
const s = e.documentDelete;
|
|
@@ -5118,7 +5118,7 @@ function Ns(t, e) {
|
|
|
5118
5118
|
}(t, e))) : [];
|
|
5119
5119
|
if (e.update) {
|
|
5120
5120
|
e.update.name;
|
|
5121
|
-
const i = As(t, e.update.name), r = new
|
|
5121
|
+
const i = As(t, e.update.name), r = new ae({
|
|
5122
5122
|
mapValue: {
|
|
5123
5123
|
fields: e.update.fields
|
|
5124
5124
|
}
|
|
@@ -5290,18 +5290,18 @@ function Fs(t) {
|
|
|
5290
5290
|
let e;
|
|
5291
5291
|
return e = "object" == typeof t ? t.value : t, Ft(e) ? null : e;
|
|
5292
5292
|
}(n.limit));
|
|
5293
|
-
let
|
|
5294
|
-
n.startAt && (
|
|
5293
|
+
let a = null;
|
|
5294
|
+
n.startAt && (a = function(t) {
|
|
5295
5295
|
const e = !!t.before, n = t.values || [];
|
|
5296
5296
|
return new $e(n, e);
|
|
5297
5297
|
}(n.startAt));
|
|
5298
|
-
let
|
|
5299
|
-
return n.endAt && (
|
|
5298
|
+
let c = null;
|
|
5299
|
+
return n.endAt && (c = function(t) {
|
|
5300
5300
|
const e = !t.before, n = t.values || [];
|
|
5301
5301
|
return new $e(n, e);
|
|
5302
5302
|
}
|
|
5303
5303
|
// visible for testing
|
|
5304
|
-
(n.endAt)), Ge(e, i, o, r, u, "F" /* First */ ,
|
|
5304
|
+
(n.endAt)), Ge(e, i, o, r, u, "F" /* First */ , a, c);
|
|
5305
5305
|
}
|
|
5306
5306
|
|
|
5307
5307
|
function $s(t, e) {
|
|
@@ -5585,7 +5585,7 @@ function Zs(t, e) {
|
|
|
5585
5585
|
* there is no useful information to store as the value. The raw (unencoded)
|
|
5586
5586
|
* path cannot be stored because IndexedDb doesn't store prototype
|
|
5587
5587
|
* information.
|
|
5588
|
-
*/ const ei = {}, ni = [ "prefixPath", "collectionGroup", "readTime", "documentId" ], si = [ "prefixPath", "collectionGroup", "documentId" ], ii = [ "collectionGroup", "readTime", "prefixPath", "documentId" ], ri = [ "canonicalId", "targetId" ], oi = [ "targetId", "path" ], ui = [ "path", "targetId" ],
|
|
5588
|
+
*/ const ei = {}, ni = [ "prefixPath", "collectionGroup", "readTime", "documentId" ], si = [ "prefixPath", "collectionGroup", "documentId" ], ii = [ "collectionGroup", "readTime", "prefixPath", "documentId" ], ri = [ "canonicalId", "targetId" ], oi = [ "targetId", "path" ], ui = [ "path", "targetId" ], ai = [ "collectionId", "parent" ], ci = [ "indexId", "uid" ], hi = [ "uid", "sequenceNumber" ], li = [ "indexId", "uid", "arrayValue", "directionalValue", "orderedDocumentKey", "documentKey" ], fi = [ "indexId", "uid", "orderedDocumentKey" ], di = [ "userId", "collectionPath", "documentId" ], _i = [ "userId", "collectionPath", "largestBatchId" ], wi = [ "userId", "collectionGroup", "largestBatchId" ], mi = [ ...[ ...[ ...[ ...[ "mutationQueues", "mutations", "documentMutations", "remoteDocuments", "targets", "owner", "targetGlobal", "targetDocuments" ], "clientMetadata" ], "remoteDocumentGlobal" ], "collectionParents" ], "bundles", "namedQueries" ], gi = [ ...mi, "documentOverlays" ], yi = [ "mutationQueues", "mutations", "documentMutations", "remoteDocumentsV14", "targets", "owner", "targetGlobal", "targetDocuments", "clientMetadata", "remoteDocumentGlobal", "collectionParents", "bundles", "namedQueries", "documentOverlays" ], pi = yi, Ii = [ ...pi, "indexConfiguration", "indexState", "indexEntries" ];
|
|
5589
5589
|
|
|
5590
5590
|
/**
|
|
5591
5591
|
* @license
|
|
@@ -6469,7 +6469,7 @@ function ki(t, e) {
|
|
|
6469
6469
|
}
|
|
6470
6470
|
}
|
|
6471
6471
|
return e.readTime && n.setReadTime(function(t) {
|
|
6472
|
-
const e = new
|
|
6472
|
+
const e = new ct(t[0], t[1]);
|
|
6473
6473
|
return ht.fromTimestamp(e);
|
|
6474
6474
|
}(e.readTime)), n;
|
|
6475
6475
|
}
|
|
@@ -6515,7 +6515,7 @@ function Ki(t) {
|
|
|
6515
6515
|
}
|
|
6516
6516
|
|
|
6517
6517
|
function Gi(t) {
|
|
6518
|
-
const e = new
|
|
6518
|
+
const e = new ct(t.seconds, t.nanoseconds);
|
|
6519
6519
|
return ht.fromTimestamp(e);
|
|
6520
6520
|
}
|
|
6521
6521
|
|
|
@@ -6536,7 +6536,7 @@ function Qi(t, e) {
|
|
|
6536
6536
|
++t;
|
|
6537
6537
|
}
|
|
6538
6538
|
}
|
|
6539
|
-
const s = e.mutations.map((e => Ns(t.Jt, e))), i =
|
|
6539
|
+
const s = e.mutations.map((e => Ns(t.Jt, e))), i = ct.fromMillis(e.localWriteTimeMs);
|
|
6540
6540
|
return new Oi(e.batchId, i, n, s);
|
|
6541
6541
|
}
|
|
6542
6542
|
|
|
@@ -6827,10 +6827,10 @@ class nr {
|
|
|
6827
6827
|
const n = t.timestampValue;
|
|
6828
6828
|
this.ne(e, 20), "string" == typeof n ? e.ie(n) : (e.ie(`${n.seconds || ""}`), e.se(n.nanos || 0));
|
|
6829
6829
|
} else if ("stringValue" in t) this.re(t.stringValue, e), this.oe(e); else if ("bytesValue" in t) this.ne(e, 30),
|
|
6830
|
-
e.ue(Ct(t.bytesValue)), this.oe(e); else if ("referenceValue" in t) this.
|
|
6830
|
+
e.ue(Ct(t.bytesValue)), this.oe(e); else if ("referenceValue" in t) this.ae(t.referenceValue, e); else if ("geoPointValue" in t) {
|
|
6831
6831
|
const n = t.geoPointValue;
|
|
6832
6832
|
this.ne(e, 45), e.se(n.latitude || 0), e.se(n.longitude || 0);
|
|
6833
|
-
} else "mapValue" in t ? se(t) ? this.ne(e, Number.MAX_SAFE_INTEGER) : (this.
|
|
6833
|
+
} else "mapValue" in t ? se(t) ? this.ne(e, Number.MAX_SAFE_INTEGER) : (this.ce(t.mapValue, e),
|
|
6834
6834
|
this.oe(e)) : "arrayValue" in t ? (this.he(t.arrayValue, e), this.oe(e)) : U();
|
|
6835
6835
|
}
|
|
6836
6836
|
re(t, e) {
|
|
@@ -6839,7 +6839,7 @@ class nr {
|
|
|
6839
6839
|
le(t, e) {
|
|
6840
6840
|
e.ie(t);
|
|
6841
6841
|
}
|
|
6842
|
-
|
|
6842
|
+
ce(t, e) {
|
|
6843
6843
|
const n = t.fields || {};
|
|
6844
6844
|
this.ne(e, 55);
|
|
6845
6845
|
for (const t of Object.keys(n)) this.re(t, e), this.te(n[t], e);
|
|
@@ -6849,7 +6849,7 @@ class nr {
|
|
|
6849
6849
|
this.ne(e, 50);
|
|
6850
6850
|
for (const t of n) this.te(t, e);
|
|
6851
6851
|
}
|
|
6852
|
-
|
|
6852
|
+
ae(t, e) {
|
|
6853
6853
|
this.ne(e, 37);
|
|
6854
6854
|
Lt.fromName(t).path.forEach((t => {
|
|
6855
6855
|
this.ne(e, 60), this.le(t, e);
|
|
@@ -7081,7 +7081,7 @@ class ur {
|
|
|
7081
7081
|
/**
|
|
7082
7082
|
* Implements `DirectionalIndexByteEncoder` using `OrderedCodeWriter` for the
|
|
7083
7083
|
* actual encoding.
|
|
7084
|
-
*/ class
|
|
7084
|
+
*/ class ar {
|
|
7085
7085
|
constructor() {
|
|
7086
7086
|
this.De = new rr, this.Ce = new or(this.De), this.xe = new ur(this.De);
|
|
7087
7087
|
}
|
|
@@ -7115,7 +7115,7 @@ class ur {
|
|
|
7115
7115
|
* See the License for the specific language governing permissions and
|
|
7116
7116
|
* limitations under the License.
|
|
7117
7117
|
*/
|
|
7118
|
-
/** Represents an index entry saved by the SDK in persisted storage. */ class
|
|
7118
|
+
/** Represents an index entry saved by the SDK in persisted storage. */ class cr {
|
|
7119
7119
|
constructor(t, e, n, s) {
|
|
7120
7120
|
this.indexId = t, this.documentKey = e, this.arrayValue = n, this.directionalValue = s;
|
|
7121
7121
|
}
|
|
@@ -7125,7 +7125,7 @@ class ur {
|
|
|
7125
7125
|
*/ ke() {
|
|
7126
7126
|
const t = this.directionalValue.length, e = 0 === t || 255 === this.directionalValue[t - 1] ? t + 1 : t, n = new Uint8Array(e);
|
|
7127
7127
|
return n.set(this.directionalValue, 0), e !== t ? n.set([ 0 ], this.directionalValue.length) : ++n[n.length - 1],
|
|
7128
|
-
new
|
|
7128
|
+
new cr(this.indexId, this.documentKey, this.arrayValue, n);
|
|
7129
7129
|
}
|
|
7130
7130
|
}
|
|
7131
7131
|
|
|
@@ -7398,7 +7398,7 @@ class mr {
|
|
|
7398
7398
|
return Ai.resolve();
|
|
7399
7399
|
}
|
|
7400
7400
|
getCollectionParents(t, e) {
|
|
7401
|
-
const n = [], s = IDBKeyRange.bound([ e, "" ], [
|
|
7401
|
+
const n = [], s = IDBKeyRange.bound([ e, "" ], [ at(e), "" ],
|
|
7402
7402
|
/*lowerOpen=*/ !1,
|
|
7403
7403
|
/*upperOpen=*/ !0);
|
|
7404
7404
|
return gr(t).qt(s).next((t => {
|
|
@@ -7464,7 +7464,7 @@ class mr {
|
|
|
7464
7464
|
/**
|
|
7465
7465
|
* Returns the list of values that are used in != or NOT_IN filters. Returns
|
|
7466
7466
|
* `null` if there are no such filters.
|
|
7467
|
-
*/ (r, i),
|
|
7467
|
+
*/ (r, i), a = function(t, e) {
|
|
7468
7468
|
const n = new Map;
|
|
7469
7469
|
for (const s of de(e)) for (const e of be(t, s.fieldPath)) switch (e.op) {
|
|
7470
7470
|
case "==" /* EQUAL */ :
|
|
@@ -7488,7 +7488,7 @@ class mr {
|
|
|
7488
7488
|
* Returns a lower bound of field values that can be used as a starting point to
|
|
7489
7489
|
* scan the index defined by `fieldIndex`. Returns `MIN_VALUE` if no lower bound
|
|
7490
7490
|
* exists.
|
|
7491
|
-
*/ (r, i),
|
|
7491
|
+
*/ (r, i), c = function(t, e) {
|
|
7492
7492
|
const n = [];
|
|
7493
7493
|
let s = !0;
|
|
7494
7494
|
// For each segment, retrieve a lower bound if there is a suitable filter or
|
|
@@ -7513,7 +7513,7 @@ class mr {
|
|
|
7513
7513
|
n.push(e.value), s && (s = e.inclusive);
|
|
7514
7514
|
}
|
|
7515
7515
|
return new $e(n, s);
|
|
7516
|
-
}(r, i), l = this.We(i, r,
|
|
7516
|
+
}(r, i), l = this.We(i, r, c), f = this.We(i, r, h), d = this.ze(i, r, a), _ = this.He(i.indexId, u, l, c.inclusive, f, h.inclusive, d);
|
|
7517
7517
|
return Ai.forEach(_, (i => n.Gt(i, e.limit).next((e => {
|
|
7518
7518
|
e.forEach((e => {
|
|
7519
7519
|
const n = Lt.fromSegments(e.documentKey);
|
|
@@ -7539,20 +7539,20 @@ class mr {
|
|
|
7539
7539
|
// distributed normal form, but adapted for array values. We create a single
|
|
7540
7540
|
// index range per value in an ARRAY_CONTAINS or ARRAY_CONTAINS_ANY filter
|
|
7541
7541
|
// combined with the values from the query bounds.
|
|
7542
|
-
const u = (null != e ? e.length : 1) * Math.max(n.length, i.length),
|
|
7542
|
+
const u = (null != e ? e.length : 1) * Math.max(n.length, i.length), a = u / (null != e ? e.length : 1), c = [];
|
|
7543
7543
|
for (let h = 0; h < u; ++h) {
|
|
7544
|
-
const u = e ? this.Je(e[h /
|
|
7544
|
+
const u = e ? this.Je(e[h / a]) : wr, l = this.Ye(t, u, n[h % a], s), f = this.Xe(t, u, i[h % a], r), d = o.map((e => this.Ye(t, u, e,
|
|
7545
7545
|
/* inclusive= */ !0)));
|
|
7546
|
-
|
|
7546
|
+
c.push(...this.createRange(l, f, d));
|
|
7547
7547
|
}
|
|
7548
|
-
return
|
|
7548
|
+
return c;
|
|
7549
7549
|
}
|
|
7550
7550
|
/** Generates the lower bound for `arrayValue` and `directionalValue`. */ Ye(t, e, n, s) {
|
|
7551
|
-
const i = new
|
|
7551
|
+
const i = new cr(t, Lt.empty(), e, n);
|
|
7552
7552
|
return s ? i : i.ke();
|
|
7553
7553
|
}
|
|
7554
7554
|
/** Generates the upper bound for `arrayValue` and `directionalValue`. */ Xe(t, e, n, s) {
|
|
7555
|
-
const i = new
|
|
7555
|
+
const i = new cr(t, Lt.empty(), e, n);
|
|
7556
7556
|
return s ? i.ke() : i;
|
|
7557
7557
|
}
|
|
7558
7558
|
je(t, e) {
|
|
@@ -7596,7 +7596,7 @@ class mr {
|
|
|
7596
7596
|
* Returns `null` if the document does not have all fields specified in the
|
|
7597
7597
|
* index.
|
|
7598
7598
|
*/ Ze(t, e) {
|
|
7599
|
-
const n = new
|
|
7599
|
+
const n = new ar;
|
|
7600
7600
|
for (const s of de(t)) {
|
|
7601
7601
|
const t = e.data.field(s.fieldPath);
|
|
7602
7602
|
if (null == t) return null;
|
|
@@ -7606,14 +7606,14 @@ class mr {
|
|
|
7606
7606
|
return n.Se();
|
|
7607
7607
|
}
|
|
7608
7608
|
/** Encodes a single value to the ascending index format. */ Je(t) {
|
|
7609
|
-
const e = new
|
|
7609
|
+
const e = new ar;
|
|
7610
7610
|
return nr.fe.Zt(t, e.Ne(0 /* ASCENDING */)), e.Se();
|
|
7611
7611
|
}
|
|
7612
7612
|
/**
|
|
7613
7613
|
* Returns an encoded form of the document key that sorts based on the key
|
|
7614
7614
|
* ordering of the field index.
|
|
7615
7615
|
*/ tn(t, e) {
|
|
7616
|
-
const n = new
|
|
7616
|
+
const n = new ar;
|
|
7617
7617
|
return nr.fe.Zt(Jt(this.databaseId, e), n.Ne(function(t) {
|
|
7618
7618
|
const e = de(t);
|
|
7619
7619
|
return 0 === e.length ? 0 /* ASCENDING */ : e[e.length - 1].kind;
|
|
@@ -7625,7 +7625,7 @@ class mr {
|
|
|
7625
7625
|
*/ ze(t, e, n) {
|
|
7626
7626
|
if (null === n) return [];
|
|
7627
7627
|
let s = [];
|
|
7628
|
-
s.push(new
|
|
7628
|
+
s.push(new ar);
|
|
7629
7629
|
let i = 0;
|
|
7630
7630
|
for (const r of de(t)) {
|
|
7631
7631
|
const t = n[i++];
|
|
@@ -7656,7 +7656,7 @@ class mr {
|
|
|
7656
7656
|
*/ nn(t, e, n) {
|
|
7657
7657
|
const s = [ ...t ], i = [];
|
|
7658
7658
|
for (const t of n.arrayValue.values || []) for (const n of s) {
|
|
7659
|
-
const s = new
|
|
7659
|
+
const s = new ar;
|
|
7660
7660
|
s.seed(n.Se()), nr.fe.Zt(t, s.Ne(e.kind)), i.push(s);
|
|
7661
7661
|
}
|
|
7662
7662
|
return i;
|
|
@@ -7707,11 +7707,11 @@ class mr {
|
|
|
7707
7707
|
return (i ? Ai.resolve(i) : this.getFieldIndexes(t, e.collectionGroup)).next((i => (n.set(e.collectionGroup, i),
|
|
7708
7708
|
Ai.forEach(i, (n => this.on(t, e, n).next((e => {
|
|
7709
7709
|
const i = this.un(s, n);
|
|
7710
|
-
return e.isEqual(i) ? Ai.resolve() : this.
|
|
7710
|
+
return e.isEqual(i) ? Ai.resolve() : this.an(t, s, n, e, i);
|
|
7711
7711
|
})))))));
|
|
7712
7712
|
}));
|
|
7713
7713
|
}
|
|
7714
|
-
|
|
7714
|
+
cn(t, e, n, s) {
|
|
7715
7715
|
return yr(t).put({
|
|
7716
7716
|
indexId: s.indexId,
|
|
7717
7717
|
uid: this.uid,
|
|
@@ -7731,7 +7731,7 @@ class mr {
|
|
|
7731
7731
|
index: "documentKeyIndex",
|
|
7732
7732
|
range: IDBKeyRange.only([ n.indexId, this.uid, this.tn(n, e) ])
|
|
7733
7733
|
}, ((t, s) => {
|
|
7734
|
-
i = i.add(new
|
|
7734
|
+
i = i.add(new cr(n.indexId, e, s.arrayValue, s.directionalValue));
|
|
7735
7735
|
})).next((() => i));
|
|
7736
7736
|
}
|
|
7737
7737
|
/** Creates the index entries for the given document. */ un(t, e) {
|
|
@@ -7741,26 +7741,26 @@ class mr {
|
|
|
7741
7741
|
const i = fe(e);
|
|
7742
7742
|
if (null != i) {
|
|
7743
7743
|
const r = t.data.field(i.fieldPath);
|
|
7744
|
-
if (Xt(r)) for (const i of r.arrayValue.values || []) n = n.add(new
|
|
7745
|
-
} else n = n.add(new
|
|
7744
|
+
if (Xt(r)) for (const i of r.arrayValue.values || []) n = n.add(new cr(e.indexId, t.key, this.Je(i), s));
|
|
7745
|
+
} else n = n.add(new cr(e.indexId, t.key, wr, s));
|
|
7746
7746
|
return n;
|
|
7747
7747
|
}
|
|
7748
7748
|
/**
|
|
7749
7749
|
* Updates the index entries for the provided document by deleting entries
|
|
7750
7750
|
* that are no longer referenced in `newEntries` and adding all newly added
|
|
7751
7751
|
* entries.
|
|
7752
|
-
*/
|
|
7752
|
+
*/ an(t, e, n, s, i) {
|
|
7753
7753
|
F("IndexedDbIndexManager", "Updating index entries for document '%s'", e.key);
|
|
7754
7754
|
const r = [];
|
|
7755
7755
|
return function(t, e, n, s, i) {
|
|
7756
7756
|
const r = t.getIterator(), o = e.getIterator();
|
|
7757
|
-
let u = pt(r),
|
|
7757
|
+
let u = pt(r), a = pt(o);
|
|
7758
7758
|
// Walk through the two sets at the same time, using the ordering defined by
|
|
7759
7759
|
// `comparator`.
|
|
7760
|
-
for (;u ||
|
|
7760
|
+
for (;u || a; ) {
|
|
7761
7761
|
let t = !1, e = !1;
|
|
7762
|
-
if (u &&
|
|
7763
|
-
const s = n(u,
|
|
7762
|
+
if (u && a) {
|
|
7763
|
+
const s = n(u, a);
|
|
7764
7764
|
s < 0 ?
|
|
7765
7765
|
// The element was removed if the next element in our ordered
|
|
7766
7766
|
// walkthrough is only in `before`.
|
|
@@ -7769,11 +7769,11 @@ class mr {
|
|
|
7769
7769
|
// is only in `after`.
|
|
7770
7770
|
t = !0);
|
|
7771
7771
|
} else null != u ? e = !0 : t = !0;
|
|
7772
|
-
t ? (s(
|
|
7772
|
+
t ? (s(a), a = pt(o)) : e ? (i(u), u = pt(r)) : (u = pt(r), a = pt(o));
|
|
7773
7773
|
}
|
|
7774
7774
|
}(s, i, hr, (
|
|
7775
7775
|
/* onAdd= */ s => {
|
|
7776
|
-
r.push(this.
|
|
7776
|
+
r.push(this.cn(t, e, n, s));
|
|
7777
7777
|
}), (
|
|
7778
7778
|
/* onRemove= */ s => {
|
|
7779
7779
|
r.push(this.hn(t, e, n, s));
|
|
@@ -7910,18 +7910,18 @@ class Er {
|
|
|
7910
7910
|
function Ar(t, e, n) {
|
|
7911
7911
|
const s = t.store("mutations"), i = t.store("documentMutations"), r = [], o = IDBKeyRange.only(n.batchId);
|
|
7912
7912
|
let u = 0;
|
|
7913
|
-
const
|
|
7913
|
+
const a = s.Wt({
|
|
7914
7914
|
range: o
|
|
7915
7915
|
}, ((t, e, n) => (u++, n.delete())));
|
|
7916
|
-
r.push(
|
|
7916
|
+
r.push(a.next((() => {
|
|
7917
7917
|
q(1 === u);
|
|
7918
7918
|
})));
|
|
7919
|
-
const
|
|
7919
|
+
const c = [];
|
|
7920
7920
|
for (const t of n.mutations) {
|
|
7921
7921
|
const s = ti(e, t.key.path, n.batchId);
|
|
7922
|
-
r.push(i.delete(s)),
|
|
7922
|
+
r.push(i.delete(s)), c.push(t.key);
|
|
7923
7923
|
}
|
|
7924
|
-
return Ai.waitFor(r).next((() =>
|
|
7924
|
+
return Ai.waitFor(r).next((() => c));
|
|
7925
7925
|
}
|
|
7926
7926
|
|
|
7927
7927
|
/**
|
|
@@ -8014,7 +8014,7 @@ class Pr {
|
|
|
8014
8014
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8015
8015
|
return r.add({}).next((o => {
|
|
8016
8016
|
q("number" == typeof o);
|
|
8017
|
-
const u = new Oi(o, e, n, s),
|
|
8017
|
+
const u = new Oi(o, e, n, s), a = function(t, e, n) {
|
|
8018
8018
|
const s = n.baseMutations.map((e => xs(t.Jt, e))), i = n.mutations.map((e => xs(t.Jt, e)));
|
|
8019
8019
|
return {
|
|
8020
8020
|
userId: e,
|
|
@@ -8023,17 +8023,17 @@ class Pr {
|
|
|
8023
8023
|
baseMutations: s,
|
|
8024
8024
|
mutations: i
|
|
8025
8025
|
};
|
|
8026
|
-
}(this.O, this.userId, u),
|
|
8026
|
+
}(this.O, this.userId, u), c = [];
|
|
8027
8027
|
let h = new gt(((t, e) => ot(t.canonicalString(), e.canonicalString())));
|
|
8028
8028
|
for (const t of s) {
|
|
8029
8029
|
const e = ti(this.userId, t.key.path, o);
|
|
8030
|
-
h = h.add(t.key.path.popLast()),
|
|
8030
|
+
h = h.add(t.key.path.popLast()), c.push(r.put(a)), c.push(i.put(e, ei));
|
|
8031
8031
|
}
|
|
8032
8032
|
return h.forEach((e => {
|
|
8033
|
-
|
|
8033
|
+
c.push(this.indexManager.addToCollectionParentIndex(t, e));
|
|
8034
8034
|
})), t.addOnCommittedListener((() => {
|
|
8035
8035
|
this.ln[o] = u.keys();
|
|
8036
|
-
})), Ai.waitFor(
|
|
8036
|
+
})), Ai.waitFor(c).next((() => u));
|
|
8037
8037
|
}));
|
|
8038
8038
|
}
|
|
8039
8039
|
lookupMutationBatch(t, e) {
|
|
@@ -8087,7 +8087,7 @@ class Pr {
|
|
|
8087
8087
|
return vr(t).Wt({
|
|
8088
8088
|
range: s
|
|
8089
8089
|
}, ((n, s, r) => {
|
|
8090
|
-
const [o, u,
|
|
8090
|
+
const [o, u, a] = n, c = Ys(u);
|
|
8091
8091
|
// Only consider rows matching exactly the specific key of
|
|
8092
8092
|
// interest. Note that because we order by path first, and we
|
|
8093
8093
|
// order terminators before path separators, we'll encounter all
|
|
@@ -8095,9 +8095,9 @@ class Pr {
|
|
|
8095
8095
|
// the rows for documentKey will occur before any rows for
|
|
8096
8096
|
// documents nested in a subcollection beneath documentKey so we
|
|
8097
8097
|
// can stop as soon as we hit any such row.
|
|
8098
|
-
if (o === this.userId && e.path.isEqual(
|
|
8098
|
+
if (o === this.userId && e.path.isEqual(c))
|
|
8099
8099
|
// Look up the mutation batch in the store.
|
|
8100
|
-
return Vr(t).get(
|
|
8100
|
+
return Vr(t).get(a).next((t => {
|
|
8101
8101
|
if (!t) throw U();
|
|
8102
8102
|
q(t.userId === this.userId), i.push(Qi(this.O, t));
|
|
8103
8103
|
}));
|
|
@@ -8111,7 +8111,7 @@ class Pr {
|
|
|
8111
8111
|
const i = Zs(this.userId, e.path), r = IDBKeyRange.lowerBound(i), o = vr(t).Wt({
|
|
8112
8112
|
range: r
|
|
8113
8113
|
}, ((t, s, i) => {
|
|
8114
|
-
const [r, o, u] = t,
|
|
8114
|
+
const [r, o, u] = t, a = Ys(o);
|
|
8115
8115
|
// Only consider rows matching exactly the specific key of
|
|
8116
8116
|
// interest. Note that because we order by path first, and we
|
|
8117
8117
|
// order terminators before path separators, we'll encounter all
|
|
@@ -8119,7 +8119,7 @@ class Pr {
|
|
|
8119
8119
|
// the rows for documentKey will occur before any rows for
|
|
8120
8120
|
// documents nested in a subcollection beneath documentKey so we
|
|
8121
8121
|
// can stop as soon as we hit any such row.
|
|
8122
|
-
r === this.userId && e.path.isEqual(
|
|
8122
|
+
r === this.userId && e.path.isEqual(a) ? n = n.add(u) : i.done();
|
|
8123
8123
|
}));
|
|
8124
8124
|
s.push(o);
|
|
8125
8125
|
})), Ai.waitFor(s).next((() => this.dn(t, n)));
|
|
@@ -8133,14 +8133,14 @@ class Pr {
|
|
|
8133
8133
|
return vr(t).Wt({
|
|
8134
8134
|
range: r
|
|
8135
8135
|
}, ((t, e, i) => {
|
|
8136
|
-
const [r, u,
|
|
8137
|
-
r === this.userId && n.isPrefixOf(
|
|
8136
|
+
const [r, u, a] = t, c = Ys(u);
|
|
8137
|
+
r === this.userId && n.isPrefixOf(c) ?
|
|
8138
8138
|
// Rows with document keys more than one segment longer than the
|
|
8139
8139
|
// query path can't be matches. For example, a query on 'rooms'
|
|
8140
8140
|
// can't match the document /rooms/abc/messages/xyx.
|
|
8141
8141
|
// TODO(mcg): we'll need a different scanner when we implement
|
|
8142
8142
|
// ancestor queries.
|
|
8143
|
-
|
|
8143
|
+
c.length === s && (o = o.add(a)) : i.done();
|
|
8144
8144
|
})).next((() => this.dn(t, o)));
|
|
8145
8145
|
}
|
|
8146
8146
|
dn(t, e) {
|
|
@@ -8213,7 +8213,7 @@ class Pr {
|
|
|
8213
8213
|
range: r,
|
|
8214
8214
|
jt: !0
|
|
8215
8215
|
}, ((t, n, s) => {
|
|
8216
|
-
const [r, u, /*batchID*/
|
|
8216
|
+
const [r, u, /*batchID*/ a] = t;
|
|
8217
8217
|
r === e && u === i && (o = !0), s.done();
|
|
8218
8218
|
})).next((() => o));
|
|
8219
8219
|
}
|
|
@@ -8321,7 +8321,7 @@ class Dr {
|
|
|
8321
8321
|
}));
|
|
8322
8322
|
}
|
|
8323
8323
|
getLastRemoteSnapshotVersion(t) {
|
|
8324
|
-
return this.pn(t).next((t => ht.fromTimestamp(new
|
|
8324
|
+
return this.pn(t).next((t => ht.fromTimestamp(new ct(t.lastRemoteSnapshotVersion.seconds, t.lastRemoteSnapshotVersion.nanoseconds))));
|
|
8325
8325
|
}
|
|
8326
8326
|
getHighestSequenceNumber(t) {
|
|
8327
8327
|
return this.pn(t).next((t => t.highestListenSequenceNumber));
|
|
@@ -8440,7 +8440,7 @@ class Dr {
|
|
|
8440
8440
|
})).next((() => i));
|
|
8441
8441
|
}
|
|
8442
8442
|
containsKey(t, e) {
|
|
8443
|
-
const n = zs(e.path), s = IDBKeyRange.bound([ n ], [
|
|
8443
|
+
const n = zs(e.path), s = IDBKeyRange.bound([ n ], [ at(n) ],
|
|
8444
8444
|
/*lowerOpen=*/ !1,
|
|
8445
8445
|
/*upperOpen=*/ !0);
|
|
8446
8446
|
let i = 0;
|
|
@@ -8622,16 +8622,16 @@ class Dr {
|
|
|
8622
8622
|
return this.Dn.getCacheSize(t);
|
|
8623
8623
|
}
|
|
8624
8624
|
Nn(t, e) {
|
|
8625
|
-
let n, s, i, r, o,
|
|
8625
|
+
let n, s, i, r, o, a, c;
|
|
8626
8626
|
const h = Date.now();
|
|
8627
8627
|
return this.calculateTargetCount(t, this.params.percentileToCollect).next((e => (
|
|
8628
8628
|
// Cap at the configured max
|
|
8629
8629
|
e > this.params.maximumSequenceNumbersToCollect ? (F("LruGarbageCollector", `Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${e}`),
|
|
8630
8630
|
s = this.params.maximumSequenceNumbersToCollect) : s = e, r = Date.now(), this.nthSequenceNumber(t, s)))).next((s => (n = s,
|
|
8631
|
-
o = Date.now(), this.removeTargets(t, n, e)))).next((e => (i = e,
|
|
8631
|
+
o = Date.now(), this.removeTargets(t, n, e)))).next((e => (i = e, a = Date.now(),
|
|
8632
8632
|
this.removeOrphanedDocuments(t, n)))).next((t => {
|
|
8633
|
-
if (
|
|
8634
|
-
F("LruGarbageCollector", `LRU Garbage Collection\n\tCounted targets in ${r - h}ms\n\tDetermined least recently used ${s} in ` + (o - r) + "ms\n" + `\tRemoved ${i} targets in ` + (
|
|
8633
|
+
if (c = Date.now(), O() <= u.DEBUG) {
|
|
8634
|
+
F("LruGarbageCollector", `LRU Garbage Collection\n\tCounted targets in ${r - h}ms\n\tDetermined least recently used ${s} in ` + (o - r) + "ms\n" + `\tRemoved ${i} targets in ` + (a - o) + "ms\n" + `\tRemoved ${t} documents in ` + (c - a) + "ms\n" + `Total Duration: ${c - h}ms`);
|
|
8635
8635
|
}
|
|
8636
8636
|
return Ai.resolve({
|
|
8637
8637
|
didRun: !0,
|
|
@@ -9082,8 +9082,8 @@ function Ur(t, e) {
|
|
|
9082
9082
|
if (e.push(this.Kn.removeEntry(t, i, o.readTime)), r.isValidDocument()) {
|
|
9083
9083
|
const u = Ui(this.Kn.O, r);
|
|
9084
9084
|
s = s.add(i.path.popLast());
|
|
9085
|
-
const
|
|
9086
|
-
n +=
|
|
9085
|
+
const a = Rr(u);
|
|
9086
|
+
n += a - o.size, e.push(this.Kn.addEntry(t, i, u));
|
|
9087
9087
|
} else if (n -= o.size, this.trackRemovals) {
|
|
9088
9088
|
// In order to track removals, we store a "sentinel delete" in the
|
|
9089
9089
|
// RemoteDocumentCache. This entry is represented by a NoDocument
|
|
@@ -9244,7 +9244,7 @@ class Yr {
|
|
|
9244
9244
|
* state for it.
|
|
9245
9245
|
*/ zn(t, e) {
|
|
9246
9246
|
let n = null;
|
|
9247
|
-
return this.Wn.getOverlay(t, e).next((s => (n = s, this.Hn(t, e, n)))).next((t => (null !== n && Dn(n.mutation, t, Rt.empty(),
|
|
9247
|
+
return this.Wn.getOverlay(t, e).next((s => (n = s, this.Hn(t, e, n)))).next((t => (null !== n && Dn(n.mutation, t, Rt.empty(), ct.now()),
|
|
9248
9248
|
t)));
|
|
9249
9249
|
}
|
|
9250
9250
|
/**
|
|
@@ -9318,7 +9318,7 @@ class Yr {
|
|
|
9318
9318
|
// might be a patch mutation whose precondition does not match before the
|
|
9319
9319
|
// change (hence overlay is undefined), but would now match.
|
|
9320
9320
|
s.has(e.key) && (void 0 === o || o.mutation instanceof kn) ? i = i.insert(e.key, e) : void 0 !== o && (r.set(e.key, o.mutation.getFieldMask()),
|
|
9321
|
-
Dn(o.mutation, e, o.mutation.getFieldMask(),
|
|
9321
|
+
Dn(o.mutation, e, o.mutation.getFieldMask(), ct.now()));
|
|
9322
9322
|
})), this.es(t, i).next((t => (t.forEach(((t, e) => r.set(t, e))), e.forEach(((t, e) => {
|
|
9323
9323
|
var n;
|
|
9324
9324
|
return o.set(t, new Yr(e, null !== (n = r.get(t)) && void 0 !== n ? n : null));
|
|
@@ -9342,13 +9342,13 @@ class Yr {
|
|
|
9342
9342
|
// Iterate in descending order of batch IDs, and skip documents that are
|
|
9343
9343
|
// already saved.
|
|
9344
9344
|
for (;o.hasNext(); ) {
|
|
9345
|
-
const s = o.getNext(), u = s.key,
|
|
9346
|
-
|
|
9345
|
+
const s = o.getNext(), u = s.key, a = s.value, c = Yn();
|
|
9346
|
+
a.forEach((t => {
|
|
9347
9347
|
if (!i.has(t)) {
|
|
9348
9348
|
const s = vn(e.get(t), n.get(t));
|
|
9349
|
-
null !== s &&
|
|
9349
|
+
null !== s && c.set(t, s), i = i.add(t);
|
|
9350
9350
|
}
|
|
9351
|
-
})), r.push(this.Wn.saveOverlays(t, u,
|
|
9351
|
+
})), r.push(this.Wn.saveOverlays(t, u, c));
|
|
9352
9352
|
}
|
|
9353
9353
|
return Ai.waitFor(r);
|
|
9354
9354
|
})).next((() => n));
|
|
@@ -9410,7 +9410,7 @@ class Yr {
|
|
|
9410
9410
|
let n = Hn();
|
|
9411
9411
|
return s.forEach(((s, i) => {
|
|
9412
9412
|
const r = t.get(s);
|
|
9413
|
-
void 0 !== r && Dn(r.mutation, i, Rt.empty(),
|
|
9413
|
+
void 0 !== r && Dn(r.mutation, i, Rt.empty(), ct.now()),
|
|
9414
9414
|
// Finally, insert the documents that still match the query
|
|
9415
9415
|
nn(e, i) && (n = n.insert(s, i));
|
|
9416
9416
|
})), n;
|
|
@@ -10112,7 +10112,7 @@ class uo {
|
|
|
10112
10112
|
}
|
|
10113
10113
|
runTransaction(t, e, n) {
|
|
10114
10114
|
F("MemoryPersistence", "Starting transaction:", t);
|
|
10115
|
-
const s = new
|
|
10115
|
+
const s = new ao(this.Fs.next());
|
|
10116
10116
|
return this.referenceDelegate.qs(), n(s).next((t => this.referenceDelegate.Ks(s).next((() => t)))).toPromise().then((t => (s.raiseOnCommittedEvent(),
|
|
10117
10117
|
t)));
|
|
10118
10118
|
}
|
|
@@ -10124,13 +10124,13 @@ class uo {
|
|
|
10124
10124
|
/**
|
|
10125
10125
|
* Memory persistence is not actually transactional, but future implementations
|
|
10126
10126
|
* may have transaction-scoped state.
|
|
10127
|
-
*/ class
|
|
10127
|
+
*/ class ao extends Ei {
|
|
10128
10128
|
constructor(t) {
|
|
10129
10129
|
super(), this.currentSequenceNumber = t;
|
|
10130
10130
|
}
|
|
10131
10131
|
}
|
|
10132
10132
|
|
|
10133
|
-
class
|
|
10133
|
+
class co {
|
|
10134
10134
|
constructor(t) {
|
|
10135
10135
|
this.persistence = t,
|
|
10136
10136
|
/** Tracks all documents that are active in Query views. */
|
|
@@ -10139,7 +10139,7 @@ class ao {
|
|
|
10139
10139
|
this.js = null;
|
|
10140
10140
|
}
|
|
10141
10141
|
static Ws(t) {
|
|
10142
|
-
return new
|
|
10142
|
+
return new co(t);
|
|
10143
10143
|
}
|
|
10144
10144
|
get zs() {
|
|
10145
10145
|
if (this.js) return this.js;
|
|
@@ -10329,7 +10329,7 @@ class ao {
|
|
|
10329
10329
|
unique: !1
|
|
10330
10330
|
});
|
|
10331
10331
|
t.createObjectStore("indexState", {
|
|
10332
|
-
keyPath:
|
|
10332
|
+
keyPath: ci
|
|
10333
10333
|
}).createIndex("sequenceNumberIndex", hi, {
|
|
10334
10334
|
unique: !1
|
|
10335
10335
|
});
|
|
@@ -10384,7 +10384,7 @@ class ao {
|
|
|
10384
10384
|
Zs(t, e) {
|
|
10385
10385
|
// Create the index.
|
|
10386
10386
|
t.createObjectStore("collectionParents", {
|
|
10387
|
-
keyPath:
|
|
10387
|
+
keyPath: ai
|
|
10388
10388
|
});
|
|
10389
10389
|
const n = e.store("collectionParents"), s = new _r, i = t => {
|
|
10390
10390
|
if (s.add(t)) {
|
|
@@ -10450,7 +10450,7 @@ class ao {
|
|
|
10450
10450
|
})).next((() => Ai.waitFor(s)));
|
|
10451
10451
|
}
|
|
10452
10452
|
ni(t, e) {
|
|
10453
|
-
const n = e.store("mutations"), s = Gr(this.O), i = new uo(
|
|
10453
|
+
const n = e.store("mutations"), s = Gr(this.O), i = new uo(co.Ws, this.O.Jt), r = [], o = new Map;
|
|
10454
10454
|
return n.qt().next((t => {
|
|
10455
10455
|
t.forEach((t => {
|
|
10456
10456
|
var e;
|
|
@@ -10459,7 +10459,7 @@ class ao {
|
|
|
10459
10459
|
}));
|
|
10460
10460
|
})).next((() => {
|
|
10461
10461
|
o.forEach(((t, n) => {
|
|
10462
|
-
const o = new x(n), u = tr.Yt(this.O, o),
|
|
10462
|
+
const o = new x(n), u = tr.Yt(this.O, o), a = i.getIndexManager(o), c = Pr.Yt(o, this.O, a, i.referenceDelegate), h = new Xr(s, c, u, a);
|
|
10463
10463
|
r.push(h.ns(new Ni(e, st.A), t));
|
|
10464
10464
|
}));
|
|
10465
10465
|
})).next((() => Ai.waitFor(r)));
|
|
@@ -10538,21 +10538,21 @@ class _o {
|
|
|
10538
10538
|
* Whether to synchronize the in-memory state of multiple tabs and share
|
|
10539
10539
|
* access to local persistence.
|
|
10540
10540
|
*/
|
|
10541
|
-
t, e, n, s, i, r, o, u,
|
|
10541
|
+
t, e, n, s, i, r, o, u, a,
|
|
10542
10542
|
/**
|
|
10543
10543
|
* If set to true, forcefully obtains database access. Existing tabs will
|
|
10544
10544
|
* no longer be able to access IndexedDB.
|
|
10545
10545
|
*/
|
|
10546
|
-
|
|
10546
|
+
c, h = 14) {
|
|
10547
10547
|
if (this.allowTabSynchronization = t, this.persistenceKey = e, this.clientId = n,
|
|
10548
|
-
this.si = i, this.window = r, this.document = o, this.ii =
|
|
10548
|
+
this.si = i, this.window = r, this.document = o, this.ii = a, this.ri = c, this.oi = h,
|
|
10549
10549
|
this.Fs = null, this.$s = !1, this.isPrimary = !1, this.networkEnabled = !0,
|
|
10550
10550
|
/** Our window.unload handler, if registered. */
|
|
10551
10551
|
this.ui = null, this.inForeground = !1,
|
|
10552
10552
|
/** Our 'visibilitychange' listener if registered. */
|
|
10553
|
-
this.ci = null,
|
|
10554
|
-
/** The client metadata refresh task. */
|
|
10555
10553
|
this.ai = null,
|
|
10554
|
+
/** The client metadata refresh task. */
|
|
10555
|
+
this.ci = null,
|
|
10556
10556
|
/** The last time we garbage collected the client metadata object store. */
|
|
10557
10557
|
this.hi = Number.NEGATIVE_INFINITY,
|
|
10558
10558
|
/** A listener to notify on primary state changes. */
|
|
@@ -10560,7 +10560,7 @@ class _o {
|
|
|
10560
10560
|
this.referenceDelegate = new Lr(this, s), this.fi = e + "main", this.O = new Bi(u),
|
|
10561
10561
|
this.di = new Pi(this.fi, this.oi, new ho(this.O)), this.Bs = new Cr(this.referenceDelegate, this.O),
|
|
10562
10562
|
this.Qn = Gr(this.O), this.Us = new Yi, this.window && this.window.localStorage ? this._i = this.window.localStorage : (this._i = null,
|
|
10563
|
-
!1 ===
|
|
10563
|
+
!1 === c && $("IndexedDbPersistence", "LocalStorage is unavailable. As a result, persistence may not work reliably. In particular enablePersistence() could fail immediately after refreshing the page."));
|
|
10564
10564
|
}
|
|
10565
10565
|
/**
|
|
10566
10566
|
* Attempt to start IndexedDb persistence.
|
|
@@ -10677,7 +10677,7 @@ class _o {
|
|
|
10677
10677
|
* Schedules a recurring timer to update the client metadata and to either
|
|
10678
10678
|
* extend or acquire the primary lease if the client is eligible.
|
|
10679
10679
|
*/ yi() {
|
|
10680
|
-
this.
|
|
10680
|
+
this.ci = this.si.enqueueAfterDelay("client_metadata_refresh" /* ClientMetadataRefresh */ , 4e3, (() => this.wi().then((() => this.bi())).then((() => this.yi()))));
|
|
10681
10681
|
}
|
|
10682
10682
|
/** Checks whether `client` is the local client. */ Ri(t) {
|
|
10683
10683
|
return !!t && t.ownerId === this.clientId;
|
|
@@ -10732,7 +10732,7 @@ class _o {
|
|
|
10732
10732
|
async shutdown() {
|
|
10733
10733
|
// The shutdown() operations are idempotent and can be called even when
|
|
10734
10734
|
// start() aborted (e.g. because it couldn't acquire the persistence lease).
|
|
10735
|
-
this.$s = !1, this.Ci(), this.
|
|
10735
|
+
this.$s = !1, this.Ci(), this.ci && (this.ci.cancel(), this.ci = null), this.xi(),
|
|
10736
10736
|
this.Ni(),
|
|
10737
10737
|
// Use `SimpleDb.runTransaction` directly to avoid failing if another tab
|
|
10738
10738
|
// has obtained the primary lease.
|
|
@@ -10832,13 +10832,13 @@ class _o {
|
|
|
10832
10832
|
!1));
|
|
10833
10833
|
}
|
|
10834
10834
|
mi() {
|
|
10835
|
-
null !== this.document && "function" == typeof this.document.addEventListener && (this.
|
|
10835
|
+
null !== this.document && "function" == typeof this.document.addEventListener && (this.ai = () => {
|
|
10836
10836
|
this.si.enqueueAndForget((() => (this.inForeground = "visible" === this.document.visibilityState,
|
|
10837
10837
|
this.wi())));
|
|
10838
|
-
}, this.document.addEventListener("visibilitychange", this.
|
|
10838
|
+
}, this.document.addEventListener("visibilitychange", this.ai), this.inForeground = "visible" === this.document.visibilityState);
|
|
10839
10839
|
}
|
|
10840
10840
|
xi() {
|
|
10841
|
-
this.
|
|
10841
|
+
this.ai && (this.document.removeEventListener("visibilitychange", this.ai), this.ai = null);
|
|
10842
10842
|
}
|
|
10843
10843
|
/**
|
|
10844
10844
|
* Attaches a window.unload handler that will synchronously write our
|
|
@@ -11288,15 +11288,15 @@ function Ro(t) {
|
|
|
11288
11288
|
i = n.Hi;
|
|
11289
11289
|
const o = [];
|
|
11290
11290
|
e.targetChanges.forEach(((r, u) => {
|
|
11291
|
-
const
|
|
11292
|
-
if (!
|
|
11291
|
+
const a = i.get(u);
|
|
11292
|
+
if (!a) return;
|
|
11293
11293
|
// Only update the remote keys if the target is still active. This
|
|
11294
11294
|
// ensures that we can persist the updated target data along with
|
|
11295
11295
|
// the updated assignment.
|
|
11296
11296
|
o.push(n.Bs.removeMatchingKeys(t, r.removedDocuments, u).next((() => n.Bs.addMatchingKeys(t, r.addedDocuments, u))));
|
|
11297
|
-
let
|
|
11298
|
-
e.targetMismatches.has(u) ?
|
|
11299
|
-
i = i.insert(u,
|
|
11297
|
+
let c = a.withSequenceNumber(t.currentSequenceNumber);
|
|
11298
|
+
e.targetMismatches.has(u) ? c = c.withResumeToken(Vt.EMPTY_BYTE_STRING, ht.min()).withLastLimboFreeSnapshotVersion(ht.min()) : r.resumeToken.approximateByteSize() > 0 && (c = c.withResumeToken(r.resumeToken, s)),
|
|
11299
|
+
i = i.insert(u, c),
|
|
11300
11300
|
// Update the target data if there are target changes (or if
|
|
11301
11301
|
// sufficient time has passed since the last update).
|
|
11302
11302
|
/**
|
|
@@ -11328,9 +11328,9 @@ function Ro(t) {
|
|
|
11328
11328
|
}
|
|
11329
11329
|
/**
|
|
11330
11330
|
* Notifies local store of the changed views to locally pin documents.
|
|
11331
|
-
*/ (
|
|
11331
|
+
*/ (a, c, r) && o.push(n.Bs.updateTargetData(t, c));
|
|
11332
11332
|
}));
|
|
11333
|
-
let u = Wn(),
|
|
11333
|
+
let u = Wn(), a = es();
|
|
11334
11334
|
// HACK: The only reason we allow a null snapshot version is so that we
|
|
11335
11335
|
// can synthesize remote events when we get permission denied errors while
|
|
11336
11336
|
// trying to resolve the state of a locally cached document that is in
|
|
@@ -11341,12 +11341,12 @@ function Ro(t) {
|
|
|
11341
11341
|
// Each loop iteration only affects its "own" doc, so it's safe to get all
|
|
11342
11342
|
// the remote documents in advance in a single call.
|
|
11343
11343
|
o.push(bo(t, r, e.documentUpdates).next((t => {
|
|
11344
|
-
u = t.nr,
|
|
11344
|
+
u = t.nr, a = t.sr;
|
|
11345
11345
|
}))), !s.isEqual(ht.min())) {
|
|
11346
11346
|
const e = n.Bs.getLastRemoteSnapshotVersion(t).next((e => n.Bs.setTargetsMetadata(t, t.currentSequenceNumber, s)));
|
|
11347
11347
|
o.push(e);
|
|
11348
11348
|
}
|
|
11349
|
-
return Ai.waitFor(o).next((() => r.apply(t))).next((() => n.tr.Yn(t, u,
|
|
11349
|
+
return Ai.waitFor(o).next((() => r.apply(t))).next((() => n.tr.Yn(t, u, a))).next((() => u));
|
|
11350
11350
|
})).then((t => (n.Hi = i, t)));
|
|
11351
11351
|
}
|
|
11352
11352
|
|
|
@@ -11532,11 +11532,11 @@ async function ko(t, e, n, s) {
|
|
|
11532
11532
|
const n = e.rr(t.metadata.name);
|
|
11533
11533
|
t.document && (r = r.add(n));
|
|
11534
11534
|
const s = e.ur(t);
|
|
11535
|
-
s.setReadTime(e.
|
|
11535
|
+
s.setReadTime(e.ar(t.metadata.readTime)), o = o.insert(n, s);
|
|
11536
11536
|
}
|
|
11537
11537
|
const u = i.Xi.newChangeBuffer({
|
|
11538
11538
|
trackRemovals: !0
|
|
11539
|
-
}),
|
|
11539
|
+
}), a = await vo(i, function(t) {
|
|
11540
11540
|
// It is OK that the path used for the query is not valid, because this will
|
|
11541
11541
|
// not be read and queried.
|
|
11542
11542
|
return Ye(Qe(Tt.fromString(`__bundle__/docs/${t}`)));
|
|
@@ -11544,7 +11544,7 @@ async function ko(t, e, n, s) {
|
|
|
11544
11544
|
// Allocates a target to hold all document keys from the bundle, such that
|
|
11545
11545
|
// they will not get garbage collected right away.
|
|
11546
11546
|
return i.persistence.runTransaction("Apply bundle documents", "readwrite", (t => bo(t, u, o).next((e => (u.apply(t),
|
|
11547
|
-
e))).next((e => i.Bs.removeMatchingKeysForTargetId(t,
|
|
11547
|
+
e))).next((e => i.Bs.removeMatchingKeysForTargetId(t, a.targetId).next((() => i.Bs.addMatchingKeys(t, r, a.targetId))).next((() => i.tr.Yn(t, e.nr, e.sr))).next((() => e.nr))))));
|
|
11548
11548
|
}
|
|
11549
11549
|
|
|
11550
11550
|
/**
|
|
@@ -11630,7 +11630,7 @@ class Bo {
|
|
|
11630
11630
|
/**
|
|
11631
11631
|
* Parses a MutationMetadata from its JSON representation in WebStorage.
|
|
11632
11632
|
* Logs a warning and returns null if the format of the data is not valid.
|
|
11633
|
-
*/ static
|
|
11633
|
+
*/ static cr(t, e, n) {
|
|
11634
11634
|
const s = JSON.parse(n);
|
|
11635
11635
|
let i, r = "object" == typeof s && -1 !== [ "pending", "acknowledged", "rejected" ].indexOf(s.state) && (void 0 === s.error || "object" == typeof s.error);
|
|
11636
11636
|
return r && s.error && (r = "string" == typeof s.error.message && "string" == typeof s.error.code,
|
|
@@ -11661,7 +11661,7 @@ class Lo {
|
|
|
11661
11661
|
/**
|
|
11662
11662
|
* Parses a QueryTargetMetadata from its JSON representation in WebStorage.
|
|
11663
11663
|
* Logs a warning and returns null if the format of the data is not valid.
|
|
11664
|
-
*/ static
|
|
11664
|
+
*/ static cr(t, e) {
|
|
11665
11665
|
const n = JSON.parse(e);
|
|
11666
11666
|
let s, i = "object" == typeof n && -1 !== [ "not-current", "current", "rejected" ].indexOf(n.state) && (void 0 === n.error || "object" == typeof n.error);
|
|
11667
11667
|
return i && n.error && (i = "string" == typeof n.error.message && "string" == typeof n.error.code,
|
|
@@ -11690,7 +11690,7 @@ class Lo {
|
|
|
11690
11690
|
/**
|
|
11691
11691
|
* Parses a RemoteClientState from the JSON representation in WebStorage.
|
|
11692
11692
|
* Logs a warning and returns null if the format of the data is not valid.
|
|
11693
|
-
*/ static
|
|
11693
|
+
*/ static cr(t, e) {
|
|
11694
11694
|
const n = JSON.parse(e);
|
|
11695
11695
|
let s = "object" == typeof n && n.activeTargetIds instanceof Array, i = ss();
|
|
11696
11696
|
for (let t = 0; s && t < n.activeTargetIds.length; ++t) s = Bt(n.activeTargetIds[t]),
|
|
@@ -11711,7 +11711,7 @@ class Lo {
|
|
|
11711
11711
|
/**
|
|
11712
11712
|
* Parses a SharedOnlineState from its JSON representation in WebStorage.
|
|
11713
11713
|
* Logs a warning and returns null if the format of the data is not valid.
|
|
11714
|
-
*/ static
|
|
11714
|
+
*/ static cr(t) {
|
|
11715
11715
|
const e = JSON.parse(t);
|
|
11716
11716
|
return "object" == typeof e && -1 !== [ "Unknown", "Online", "Offline" ].indexOf(e.onlineState) && "string" == typeof e.clientId ? new qo(e.clientId, e.onlineState) : ($("SharedClientState", `Failed to parse online state: ${t}`),
|
|
11717
11717
|
null);
|
|
@@ -11826,7 +11826,7 @@ class Ko {
|
|
|
11826
11826
|
if (e === this._r) continue;
|
|
11827
11827
|
const t = this.getItem(Mo(this.persistenceKey, e));
|
|
11828
11828
|
if (t) {
|
|
11829
|
-
const n = Uo.
|
|
11829
|
+
const n = Uo.cr(e, t);
|
|
11830
11830
|
n && (this.gr = this.gr.insert(n.clientId, n));
|
|
11831
11831
|
}
|
|
11832
11832
|
}
|
|
@@ -11873,7 +11873,7 @@ class Ko {
|
|
|
11873
11873
|
if (this.isActiveQueryTarget(t)) {
|
|
11874
11874
|
const n = this.storage.getItem($o(this.persistenceKey, t));
|
|
11875
11875
|
if (n) {
|
|
11876
|
-
const s = Lo.
|
|
11876
|
+
const s = Lo.cr(t, n);
|
|
11877
11877
|
s && (e = s.state);
|
|
11878
11878
|
}
|
|
11879
11879
|
}
|
|
@@ -12016,27 +12016,27 @@ class Ko {
|
|
|
12016
12016
|
* be parsed.
|
|
12017
12017
|
*/ Br(t, e) {
|
|
12018
12018
|
const n = this.Fr(t);
|
|
12019
|
-
return Uo.
|
|
12019
|
+
return Uo.cr(n, e);
|
|
12020
12020
|
}
|
|
12021
12021
|
/**
|
|
12022
12022
|
* Parses a mutation batch state in WebStorage. Returns 'null' if the value
|
|
12023
12023
|
* could not be parsed.
|
|
12024
12024
|
*/ Lr(t, e) {
|
|
12025
12025
|
const n = this.Er.exec(t), s = Number(n[1]), i = void 0 !== n[2] ? n[2] : null;
|
|
12026
|
-
return Bo.
|
|
12026
|
+
return Bo.cr(new x(i), s, e);
|
|
12027
12027
|
}
|
|
12028
12028
|
/**
|
|
12029
12029
|
* Parses a query target state from WebStorage. Returns 'null' if the value
|
|
12030
12030
|
* could not be parsed.
|
|
12031
12031
|
*/ qr(t, e) {
|
|
12032
12032
|
const n = this.Ar.exec(t), s = Number(n[1]);
|
|
12033
|
-
return Lo.
|
|
12033
|
+
return Lo.cr(s, e);
|
|
12034
12034
|
}
|
|
12035
12035
|
/**
|
|
12036
12036
|
* Parses an online state from WebStorage. Returns 'null' if the value
|
|
12037
12037
|
* could not be parsed.
|
|
12038
12038
|
*/ Vr(t) {
|
|
12039
|
-
return qo.
|
|
12039
|
+
return qo.cr(t);
|
|
12040
12040
|
}
|
|
12041
12041
|
Gr(t) {
|
|
12042
12042
|
return JSON.parse(t);
|
|
@@ -12247,9 +12247,9 @@ class Ho {
|
|
|
12247
12247
|
this.ro = t.ro, this.oo = t.oo;
|
|
12248
12248
|
}
|
|
12249
12249
|
uo(t) {
|
|
12250
|
-
this.
|
|
12250
|
+
this.ao = t;
|
|
12251
12251
|
}
|
|
12252
|
-
|
|
12252
|
+
co(t) {
|
|
12253
12253
|
this.ho = t;
|
|
12254
12254
|
}
|
|
12255
12255
|
onMessage(t) {
|
|
@@ -12262,7 +12262,7 @@ class Ho {
|
|
|
12262
12262
|
this.ro(t);
|
|
12263
12263
|
}
|
|
12264
12264
|
fo() {
|
|
12265
|
-
this.
|
|
12265
|
+
this.ao();
|
|
12266
12266
|
}
|
|
12267
12267
|
_o(t) {
|
|
12268
12268
|
this.ho(t);
|
|
@@ -12422,22 +12422,22 @@ class {
|
|
|
12422
12422
|
d() || _() || w() || m() || g() || y() || (o.httpHeadersOverwriteParam = "$httpHeaders");
|
|
12423
12423
|
const u = s.join("");
|
|
12424
12424
|
F("Connection", "Creating WebChannel: " + u, o);
|
|
12425
|
-
const
|
|
12425
|
+
const a = i.createWebChannel(u, o);
|
|
12426
12426
|
// WebChannel supports sending the first message with the handshake - saving
|
|
12427
12427
|
// a network round trip. However, it will have to call send in the same
|
|
12428
12428
|
// JS event loop as open. In order to enforce this, we delay actually
|
|
12429
12429
|
// opening the WebChannel until send is called. Whether we have called
|
|
12430
12430
|
// open is tracked with this variable.
|
|
12431
|
-
let
|
|
12431
|
+
let c = !1, h = !1;
|
|
12432
12432
|
// A flag to determine whether the stream was closed (by us or through an
|
|
12433
12433
|
// error/close event) to avoid delivering multiple close events or sending
|
|
12434
12434
|
// on a closed stream
|
|
12435
12435
|
const l = new Ho({
|
|
12436
12436
|
ro: t => {
|
|
12437
|
-
h ? F("Connection", "Not sending because WebChannel is closed:", t) : (
|
|
12438
|
-
|
|
12437
|
+
h ? F("Connection", "Not sending because WebChannel is closed:", t) : (c || (F("Connection", "Opening WebChannel transport."),
|
|
12438
|
+
a.open(), c = !0), F("Connection", "WebChannel sending:", t), a.send(t));
|
|
12439
12439
|
},
|
|
12440
|
-
oo: () =>
|
|
12440
|
+
oo: () => a.close()
|
|
12441
12441
|
}), f = (t, e, n) => {
|
|
12442
12442
|
// TODO(dimond): closure typing seems broken because WebChannel does
|
|
12443
12443
|
// not implement goog.events.Listenable
|
|
@@ -12455,13 +12455,13 @@ class {
|
|
|
12455
12455
|
// exception and rethrow using a setTimeout so they become visible again.
|
|
12456
12456
|
// Note that eventually this function could go away if we are confident
|
|
12457
12457
|
// enough the code is exception free.
|
|
12458
|
-
return f(
|
|
12458
|
+
return f(a, v.EventType.OPEN, (() => {
|
|
12459
12459
|
h || F("Connection", "WebChannel transport opened.");
|
|
12460
|
-
})), f(
|
|
12460
|
+
})), f(a, v.EventType.CLOSE, (() => {
|
|
12461
12461
|
h || (h = !0, F("Connection", "WebChannel transport closed"), l._o());
|
|
12462
|
-
})), f(
|
|
12462
|
+
})), f(a, v.EventType.ERROR, (t => {
|
|
12463
12463
|
h || (h = !0, B("Connection", "WebChannel transport errored:", t), l._o(new j(Q.UNAVAILABLE, "The operation could not be completed")));
|
|
12464
|
-
})), f(
|
|
12464
|
+
})), f(a, v.EventType.MESSAGE, (t => {
|
|
12465
12465
|
var e;
|
|
12466
12466
|
if (!h) {
|
|
12467
12467
|
const n = t.data[0];
|
|
@@ -12491,7 +12491,7 @@ class {
|
|
|
12491
12491
|
}(t), n = i.message;
|
|
12492
12492
|
void 0 === e && (e = Q.INTERNAL, n = "Unknown error status: " + t + " with message " + i.message),
|
|
12493
12493
|
// Mark closed so no further events are propagated
|
|
12494
|
-
h = !0, l._o(new j(e, n)),
|
|
12494
|
+
h = !0, l._o(new j(e, n)), a.close();
|
|
12495
12495
|
} else F("Connection", "WebChannel received:", n), l.wo(n);
|
|
12496
12496
|
}
|
|
12497
12497
|
})), f(r, S.STAT_EVENT, (t => {
|
|
@@ -12823,7 +12823,7 @@ class eu {
|
|
|
12823
12823
|
// inhibit backoff or otherwise manipulate the state in its non-started state.
|
|
12824
12824
|
this.state = t,
|
|
12825
12825
|
// Notify the listener that the stream closed.
|
|
12826
|
-
await this.listener.
|
|
12826
|
+
await this.listener.co(e);
|
|
12827
12827
|
}
|
|
12828
12828
|
/**
|
|
12829
12829
|
* Can be overridden to perform additional cleanup before the stream is closed.
|
|
@@ -12855,7 +12855,7 @@ class eu {
|
|
|
12855
12855
|
this.stream = this.eu(t, e), this.stream.uo((() => {
|
|
12856
12856
|
n((() => (this.state = 2 /* Open */ , this.Lo = this.si.enqueueAfterDelay(this.Mo, 1e4, (() => (this.Ko() && (this.state = 3 /* Healthy */),
|
|
12857
12857
|
Promise.resolve()))), this.listener.uo())));
|
|
12858
|
-
})), this.stream.
|
|
12858
|
+
})), this.stream.co((t => {
|
|
12859
12859
|
n((() => this.tu(t)));
|
|
12860
12860
|
})), this.stream.onMessage((t => {
|
|
12861
12861
|
n((() => this.onMessage(t)));
|
|
@@ -12992,10 +12992,10 @@ class eu {
|
|
|
12992
12992
|
// the write itself might be causing an error we want to back off from.
|
|
12993
12993
|
this.Uo.reset();
|
|
12994
12994
|
const e = ks(t.writeResults, t.commitTime), n = ps(t.commitTime);
|
|
12995
|
-
return this.listener.
|
|
12995
|
+
return this.listener.au(n, e);
|
|
12996
12996
|
}
|
|
12997
12997
|
// The first response is always the handshake response
|
|
12998
|
-
return q(!t.writeResults || 0 === t.writeResults.length), this.ru = !0, this.listener.
|
|
12998
|
+
return q(!t.writeResults || 0 === t.writeResults.length), this.ru = !0, this.listener.cu();
|
|
12999
12999
|
}
|
|
13000
13000
|
/**
|
|
13001
13001
|
* Sends an initial streamToken to the server, performing the handshake
|
|
@@ -13220,7 +13220,7 @@ class ru {
|
|
|
13220
13220
|
wu(this) && (F("RemoteStore", "Restarting streams for network reachability change."),
|
|
13221
13221
|
await async function(t) {
|
|
13222
13222
|
const e = G(t);
|
|
13223
|
-
e.Au.add(4 /* ConnectivityChange */), await
|
|
13223
|
+
e.Au.add(4 /* ConnectivityChange */), await au(e), e.bu.set("Unknown" /* Unknown */),
|
|
13224
13224
|
e.Au.delete(4 /* ConnectivityChange */), await uu(e);
|
|
13225
13225
|
}(this));
|
|
13226
13226
|
}));
|
|
@@ -13235,7 +13235,7 @@ async function uu(t) {
|
|
|
13235
13235
|
/**
|
|
13236
13236
|
* Temporarily disables the network. The network can be re-enabled using
|
|
13237
13237
|
* enableNetwork().
|
|
13238
|
-
*/ async function
|
|
13238
|
+
*/ async function au(t) {
|
|
13239
13239
|
for (const e of t.Ru) await e(/* enabled= */ !1);
|
|
13240
13240
|
}
|
|
13241
13241
|
|
|
@@ -13243,7 +13243,7 @@ async function uu(t) {
|
|
|
13243
13243
|
* Starts new listen for the given target. Uses resume token if provided. It
|
|
13244
13244
|
* is a no-op if the target of given `TargetData` is already being listened to.
|
|
13245
13245
|
*/
|
|
13246
|
-
function
|
|
13246
|
+
function cu(t, e) {
|
|
13247
13247
|
const n = G(t);
|
|
13248
13248
|
n.Eu.has(e.targetId) || (
|
|
13249
13249
|
// Mark this as something the client is currently listening for.
|
|
@@ -13320,7 +13320,7 @@ async function yu(t, e) {
|
|
|
13320
13320
|
async function pu(t, e, n) {
|
|
13321
13321
|
if (
|
|
13322
13322
|
// Mark the client as online since we got a message from the server
|
|
13323
|
-
t.bu.set("Online" /* Online */), e instanceof
|
|
13323
|
+
t.bu.set("Online" /* Online */), e instanceof as && 2 /* Removed */ === e.state && e.cause)
|
|
13324
13324
|
// There was an error on a target, don't wait for a consistent snapshot
|
|
13325
13325
|
// to raise events
|
|
13326
13326
|
try {
|
|
@@ -13404,7 +13404,7 @@ async function pu(t, e, n) {
|
|
|
13404
13404
|
if (!vi(e)) throw e;
|
|
13405
13405
|
t.Au.add(1 /* IndexedDbFailed */),
|
|
13406
13406
|
// Disable network and raise offline snapshots
|
|
13407
|
-
await
|
|
13407
|
+
await au(t), t.bu.set("Offline" /* Offline */), n || (
|
|
13408
13408
|
// Use a simple read operation to determine if IndexedDB recovered.
|
|
13409
13409
|
// Ideally, we would expose a health check directly on SimpleDb, but
|
|
13410
13410
|
// RemoteStore only has access to persistence through LocalStore.
|
|
@@ -13515,7 +13515,7 @@ async function Cu(t, e) {
|
|
|
13515
13515
|
// Tear down and re-create our network streams. This will ensure we get a
|
|
13516
13516
|
// fresh auth token for the new user and re-fill the write pipeline with
|
|
13517
13517
|
// new mutations from the LocalStore (since mutations are per-user).
|
|
13518
|
-
n.Au.add(3 /* CredentialChange */), await
|
|
13518
|
+
n.Au.add(3 /* CredentialChange */), await au(n), s &&
|
|
13519
13519
|
// Don't set the network status to Unknown if we are offline.
|
|
13520
13520
|
n.bu.set("Unknown" /* Unknown */), await n.remoteSyncer.handleCredentialChange(e),
|
|
13521
13521
|
n.Au.delete(3 /* CredentialChange */), await uu(n);
|
|
@@ -13526,7 +13526,7 @@ async function Cu(t, e) {
|
|
|
13526
13526
|
*/ async function xu(t, e) {
|
|
13527
13527
|
const n = G(t);
|
|
13528
13528
|
e ? (n.Au.delete(2 /* IsSecondary */), await uu(n)) : e || (n.Au.add(2 /* IsSecondary */),
|
|
13529
|
-
await
|
|
13529
|
+
await au(n), n.bu.set("Unknown" /* Unknown */));
|
|
13530
13530
|
}
|
|
13531
13531
|
|
|
13532
13532
|
/**
|
|
@@ -13560,7 +13560,7 @@ async function Cu(t, e) {
|
|
|
13560
13560
|
* limitations under the License.
|
|
13561
13561
|
*/ (t.datastore, t.asyncQueue, {
|
|
13562
13562
|
uo: gu.bind(null, t),
|
|
13563
|
-
|
|
13563
|
+
co: yu.bind(null, t),
|
|
13564
13564
|
nu: pu.bind(null, t)
|
|
13565
13565
|
}), t.Ru.push((async e => {
|
|
13566
13566
|
e ? (t.vu.Qo(), _u(t) ? du(t) : t.bu.set("Unknown" /* Unknown */)) : (await t.vu.stop(),
|
|
@@ -13583,9 +13583,9 @@ async function Cu(t, e) {
|
|
|
13583
13583
|
return s.fu(), new su(e, s.Fo, s.authCredentials, s.appCheckCredentials, s.O, n);
|
|
13584
13584
|
}(t.datastore, t.asyncQueue, {
|
|
13585
13585
|
uo: Vu.bind(null, t),
|
|
13586
|
-
|
|
13587
|
-
|
|
13588
|
-
|
|
13586
|
+
co: Du.bind(null, t),
|
|
13587
|
+
cu: vu.bind(null, t),
|
|
13588
|
+
au: Su.bind(null, t)
|
|
13589
13589
|
}), t.Ru.push((async e => {
|
|
13590
13590
|
e ? (t.Su.Qo(),
|
|
13591
13591
|
// This will start the write stream if necessary.
|
|
@@ -14082,9 +14082,9 @@ function ju(t) {
|
|
|
14082
14082
|
/**
|
|
14083
14083
|
* Converts a BundleDocument to a MutableDocument.
|
|
14084
14084
|
*/ ur(t) {
|
|
14085
|
-
return t.metadata.exists ? Ss(this.O, t.document, !1) : he.newNoDocument(this.rr(t.metadata.name), this.
|
|
14085
|
+
return t.metadata.exists ? Ss(this.O, t.document, !1) : he.newNoDocument(this.rr(t.metadata.name), this.ar(t.metadata.readTime));
|
|
14086
14086
|
}
|
|
14087
|
-
|
|
14087
|
+
ar(t) {
|
|
14088
14088
|
return ps(t);
|
|
14089
14089
|
}
|
|
14090
14090
|
}
|
|
@@ -14194,7 +14194,7 @@ class Zu {
|
|
|
14194
14194
|
* View is responsible for computing the final merged truth of what docs are in
|
|
14195
14195
|
* a query. It gets notified of local and remote changes to docs, and applies
|
|
14196
14196
|
* the query filters and limits to determine the most correct possible results.
|
|
14197
|
-
*/ class
|
|
14197
|
+
*/ class ta {
|
|
14198
14198
|
constructor(t,
|
|
14199
14199
|
/** Documents included in the remote target */
|
|
14200
14200
|
e) {
|
|
@@ -14214,7 +14214,7 @@ class Zu {
|
|
|
14214
14214
|
/**
|
|
14215
14215
|
* The set of remote documents that the server has told us belongs to the target associated with
|
|
14216
14216
|
* this view.
|
|
14217
|
-
*/ get
|
|
14217
|
+
*/ get ta() {
|
|
14218
14218
|
return this.Hu;
|
|
14219
14219
|
}
|
|
14220
14220
|
/**
|
|
@@ -14226,8 +14226,8 @@ class Zu {
|
|
|
14226
14226
|
* @param previousChanges - If this is being called with a refill, then start
|
|
14227
14227
|
* with this set of docs and changes instead of the current view.
|
|
14228
14228
|
* @returns a new set of docs, changes, and refill flag.
|
|
14229
|
-
*/
|
|
14230
|
-
const n = e ? e.
|
|
14229
|
+
*/ ea(t, e) {
|
|
14230
|
+
const n = e ? e.na : new $u, s = e ? e.Zu : this.Zu;
|
|
14231
14231
|
let i = e ? e.mutatedKeys : this.mutatedKeys, r = s, o = !1;
|
|
14232
14232
|
// Track the last doc in a (full) limit. This is necessary, because some
|
|
14233
14233
|
// update (a delete, or an update moving a doc past the old limit) might
|
|
@@ -14237,34 +14237,34 @@ class Zu {
|
|
|
14237
14237
|
// deletes. So we keep this doc at the old limit to compare the updates to.
|
|
14238
14238
|
// Note that this should never get used in a refill (when previousChanges is
|
|
14239
14239
|
// set), because there will only be adds -- no deletes or updates.
|
|
14240
|
-
const u = "F" /* First */ === this.query.limitType && s.size === this.query.limit ? s.last() : null,
|
|
14240
|
+
const u = "F" /* First */ === this.query.limitType && s.size === this.query.limit ? s.last() : null, a = "L" /* Last */ === this.query.limitType && s.size === this.query.limit ? s.first() : null;
|
|
14241
14241
|
// Drop documents out to meet limit/limitToLast requirement.
|
|
14242
14242
|
if (t.inorderTraversal(((t, e) => {
|
|
14243
|
-
const
|
|
14243
|
+
const c = s.get(t), h = nn(this.query, e) ? e : null, l = !!c && this.mutatedKeys.has(c.key), f = !!h && (h.hasLocalMutations ||
|
|
14244
14244
|
// We only consider committed mutations for documents that were
|
|
14245
14245
|
// mutated during the lifetime of the view.
|
|
14246
14246
|
this.mutatedKeys.has(h.key) && h.hasCommittedMutations);
|
|
14247
14247
|
let d = !1;
|
|
14248
14248
|
// Calculate change
|
|
14249
|
-
if (
|
|
14250
|
-
|
|
14249
|
+
if (c && h) {
|
|
14250
|
+
c.data.isEqual(h.data) ? l !== f && (n.track({
|
|
14251
14251
|
type: 3 /* Metadata */ ,
|
|
14252
14252
|
doc: h
|
|
14253
|
-
}), d = !0) : this.
|
|
14253
|
+
}), d = !0) : this.sa(c, h) || (n.track({
|
|
14254
14254
|
type: 2 /* Modified */ ,
|
|
14255
14255
|
doc: h
|
|
14256
|
-
}), d = !0, (u && this.Xu(h, u) > 0 ||
|
|
14256
|
+
}), d = !0, (u && this.Xu(h, u) > 0 || a && this.Xu(h, a) < 0) && (
|
|
14257
14257
|
// This doc moved from inside the limit to outside the limit.
|
|
14258
14258
|
// That means there may be some other doc in the local cache
|
|
14259
14259
|
// that should be included instead.
|
|
14260
14260
|
o = !0));
|
|
14261
|
-
} else !
|
|
14261
|
+
} else !c && h ? (n.track({
|
|
14262
14262
|
type: 0 /* Added */ ,
|
|
14263
14263
|
doc: h
|
|
14264
|
-
}), d = !0) :
|
|
14264
|
+
}), d = !0) : c && !h && (n.track({
|
|
14265
14265
|
type: 1 /* Removed */ ,
|
|
14266
|
-
doc:
|
|
14267
|
-
}), d = !0, (u ||
|
|
14266
|
+
doc: c
|
|
14267
|
+
}), d = !0, (u || a) && (
|
|
14268
14268
|
// A doc was removed from a full limit query. We'll need to
|
|
14269
14269
|
// requery from the local cache to see if we know about some other
|
|
14270
14270
|
// doc that should be in the results.
|
|
@@ -14279,12 +14279,12 @@ class Zu {
|
|
|
14279
14279
|
}
|
|
14280
14280
|
return {
|
|
14281
14281
|
Zu: r,
|
|
14282
|
-
|
|
14282
|
+
na: n,
|
|
14283
14283
|
ji: o,
|
|
14284
14284
|
mutatedKeys: i
|
|
14285
14285
|
};
|
|
14286
14286
|
}
|
|
14287
|
-
|
|
14287
|
+
sa(t, e) {
|
|
14288
14288
|
// We suppress the initial change event for documents that were modified as
|
|
14289
14289
|
// part of a write acknowledgment (e.g. when the value of a server transform
|
|
14290
14290
|
// is applied) as Watch will send us the same document again.
|
|
@@ -14309,7 +14309,7 @@ class Zu {
|
|
|
14309
14309
|
const s = this.Zu;
|
|
14310
14310
|
this.Zu = t.Zu, this.mutatedKeys = t.mutatedKeys;
|
|
14311
14311
|
// Sort changes based on type and query comparator
|
|
14312
|
-
const i = t.
|
|
14312
|
+
const i = t.na.Cu();
|
|
14313
14313
|
i.sort(((t, e) => function(t, e) {
|
|
14314
14314
|
const n = t => {
|
|
14315
14315
|
switch (t) {
|
|
@@ -14347,18 +14347,18 @@ class Zu {
|
|
|
14347
14347
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14348
14348
|
* See the License for the specific language governing permissions and
|
|
14349
14349
|
* limitations under the License.
|
|
14350
|
-
*/ (t.type, e.type) || this.Xu(t.doc, e.doc))), this.
|
|
14351
|
-
const r = e ? this.
|
|
14350
|
+
*/ (t.type, e.type) || this.Xu(t.doc, e.doc))), this.ia(n);
|
|
14351
|
+
const r = e ? this.ra() : [], o = 0 === this.Yu.size && this.current ? 1 /* Synced */ : 0 /* Local */ , u = o !== this.Ju;
|
|
14352
14352
|
if (this.Ju = o, 0 !== i.length || u) {
|
|
14353
14353
|
return {
|
|
14354
14354
|
snapshot: new Bu(this.query, t.Zu, s, i, t.mutatedKeys, 0 /* Local */ === o, u,
|
|
14355
14355
|
/* excludesMetadataChanges= */ !1),
|
|
14356
|
-
|
|
14356
|
+
oa: r
|
|
14357
14357
|
};
|
|
14358
14358
|
}
|
|
14359
14359
|
// no changes
|
|
14360
14360
|
return {
|
|
14361
|
-
|
|
14361
|
+
oa: r
|
|
14362
14362
|
};
|
|
14363
14363
|
}
|
|
14364
14364
|
/**
|
|
@@ -14372,17 +14372,17 @@ class Zu {
|
|
|
14372
14372
|
// true once the client is back online.
|
|
14373
14373
|
this.current = !1, this.applyChanges({
|
|
14374
14374
|
Zu: this.Zu,
|
|
14375
|
-
|
|
14375
|
+
na: new $u,
|
|
14376
14376
|
mutatedKeys: this.mutatedKeys,
|
|
14377
14377
|
ji: !1
|
|
14378
14378
|
},
|
|
14379
14379
|
/* updateLimboDocuments= */ !1)) : {
|
|
14380
|
-
|
|
14380
|
+
oa: []
|
|
14381
14381
|
};
|
|
14382
14382
|
}
|
|
14383
14383
|
/**
|
|
14384
14384
|
* Returns whether the doc for the given key should be in limbo.
|
|
14385
|
-
*/
|
|
14385
|
+
*/ ua(t) {
|
|
14386
14386
|
// If the remote end says it's part of this query, it's not in limbo.
|
|
14387
14387
|
return !this.Hu.has(t) && (
|
|
14388
14388
|
// The local store doesn't think it's a result, so it shouldn't be in limbo.
|
|
@@ -14391,18 +14391,18 @@ class Zu {
|
|
|
14391
14391
|
/**
|
|
14392
14392
|
* Updates syncedDocuments, current, and limbo docs based on the given change.
|
|
14393
14393
|
* Returns the list of changes to which docs are in limbo.
|
|
14394
|
-
*/
|
|
14394
|
+
*/ ia(t) {
|
|
14395
14395
|
t && (t.addedDocuments.forEach((t => this.Hu = this.Hu.add(t))), t.modifiedDocuments.forEach((t => {})),
|
|
14396
14396
|
t.removedDocuments.forEach((t => this.Hu = this.Hu.delete(t))), this.current = t.current);
|
|
14397
14397
|
}
|
|
14398
|
-
|
|
14398
|
+
ra() {
|
|
14399
14399
|
// We can only determine limbo documents when we're in-sync with the server.
|
|
14400
14400
|
if (!this.current) return [];
|
|
14401
14401
|
// TODO(klimt): Do this incrementally so that it's not quadratic when
|
|
14402
14402
|
// updating many documents.
|
|
14403
14403
|
const t = this.Yu;
|
|
14404
14404
|
this.Yu = es(), this.Zu.forEach((t => {
|
|
14405
|
-
this.
|
|
14405
|
+
this.ua(t.key) && (this.Yu = this.Yu.add(t.key));
|
|
14406
14406
|
}));
|
|
14407
14407
|
// Diff the new limbo docs with the old limbo docs.
|
|
14408
14408
|
const e = [];
|
|
@@ -14432,9 +14432,9 @@ class Zu {
|
|
|
14432
14432
|
* @returns The ViewChange that resulted from this synchronization.
|
|
14433
14433
|
*/
|
|
14434
14434
|
// PORTING NOTE: Multi-tab only.
|
|
14435
|
-
|
|
14435
|
+
aa(t) {
|
|
14436
14436
|
this.Hu = t.ir, this.Yu = es();
|
|
14437
|
-
const e = this.
|
|
14437
|
+
const e = this.ea(t.documents);
|
|
14438
14438
|
return this.applyChanges(e, /*updateLimboDocuments=*/ !0);
|
|
14439
14439
|
}
|
|
14440
14440
|
/**
|
|
@@ -14443,7 +14443,7 @@ class Zu {
|
|
|
14443
14443
|
* `hasPendingWrites` status of the already established view.
|
|
14444
14444
|
*/
|
|
14445
14445
|
// PORTING NOTE: Multi-tab only.
|
|
14446
|
-
|
|
14446
|
+
ca() {
|
|
14447
14447
|
return Bu.fromInitialDocuments(this.query, this.Zu, this.mutatedKeys, 0 /* Local */ === this.Ju);
|
|
14448
14448
|
}
|
|
14449
14449
|
}
|
|
@@ -14452,7 +14452,7 @@ class Zu {
|
|
|
14452
14452
|
* QueryView contains all of the data that SyncEngine needs to keep track of for
|
|
14453
14453
|
* a particular query.
|
|
14454
14454
|
*/
|
|
14455
|
-
class
|
|
14455
|
+
class ea {
|
|
14456
14456
|
constructor(
|
|
14457
14457
|
/**
|
|
14458
14458
|
* The query itself.
|
|
@@ -14474,7 +14474,7 @@ class ec {
|
|
|
14474
14474
|
}
|
|
14475
14475
|
}
|
|
14476
14476
|
|
|
14477
|
-
/** Tracks a limbo resolution. */ class
|
|
14477
|
+
/** Tracks a limbo resolution. */ class na {
|
|
14478
14478
|
constructor(t) {
|
|
14479
14479
|
this.key = t,
|
|
14480
14480
|
/**
|
|
@@ -14483,7 +14483,7 @@ class ec {
|
|
|
14483
14483
|
* decide whether it needs to manufacture a delete event for the target once
|
|
14484
14484
|
* the target is CURRENT.
|
|
14485
14485
|
*/
|
|
14486
|
-
this.
|
|
14486
|
+
this.ha = !1;
|
|
14487
14487
|
}
|
|
14488
14488
|
}
|
|
14489
14489
|
|
|
@@ -14499,13 +14499,13 @@ class ec {
|
|
|
14499
14499
|
* the class is not exported so they are only accessible from this module.
|
|
14500
14500
|
* This is useful to implement optional features (like bundles) in free
|
|
14501
14501
|
* functions, such that they are tree-shakeable.
|
|
14502
|
-
*/ class
|
|
14502
|
+
*/ class sa {
|
|
14503
14503
|
constructor(t, e, n,
|
|
14504
14504
|
// PORTING NOTE: Manages state synchronization in multi-tab environments.
|
|
14505
14505
|
s, i, r) {
|
|
14506
14506
|
this.localStore = t, this.remoteStore = e, this.eventManager = n, this.sharedClientState = s,
|
|
14507
|
-
this.currentUser = i, this.maxConcurrentLimboResolutions = r, this.
|
|
14508
|
-
this.
|
|
14507
|
+
this.currentUser = i, this.maxConcurrentLimboResolutions = r, this.la = {}, this.fa = new Qn((t => tn(t)), Ze),
|
|
14508
|
+
this.da = new Map,
|
|
14509
14509
|
/**
|
|
14510
14510
|
* The keys of documents that are in limbo for which we haven't yet started a
|
|
14511
14511
|
* limbo resolution query. The strings in this set are the result of calling
|
|
@@ -14515,28 +14515,28 @@ class ec {
|
|
|
14515
14515
|
* of arbitrary elements and it also maintains insertion order, providing the
|
|
14516
14516
|
* desired queue-like FIFO semantics.
|
|
14517
14517
|
*/
|
|
14518
|
-
this.
|
|
14518
|
+
this._a = new Set,
|
|
14519
14519
|
/**
|
|
14520
14520
|
* Keeps track of the target ID for each document that is in limbo with an
|
|
14521
14521
|
* active target.
|
|
14522
14522
|
*/
|
|
14523
|
-
this.
|
|
14523
|
+
this.wa = new _t(Lt.comparator),
|
|
14524
14524
|
/**
|
|
14525
14525
|
* Keeps track of the information about an active limbo resolution for each
|
|
14526
14526
|
* active target ID that was started for the purpose of limbo resolution.
|
|
14527
14527
|
*/
|
|
14528
|
-
this.
|
|
14528
|
+
this.ma = new Map, this.ga = new eo,
|
|
14529
14529
|
/** Stores user completion handlers, indexed by User and BatchId. */
|
|
14530
|
-
this.
|
|
14530
|
+
this.ya = {},
|
|
14531
14531
|
/** Stores user callbacks waiting for all pending writes to be acknowledged. */
|
|
14532
|
-
this.
|
|
14532
|
+
this.pa = new Map, this.Ia = Dr.yn(), this.onlineState = "Unknown" /* Unknown */ ,
|
|
14533
14533
|
// The primary state is set to `true` or `false` immediately after Firestore
|
|
14534
14534
|
// startup. In the interim, a client should only be considered primary if
|
|
14535
14535
|
// `isPrimary` is true.
|
|
14536
|
-
this.
|
|
14536
|
+
this.Ta = void 0;
|
|
14537
14537
|
}
|
|
14538
14538
|
get isPrimaryClient() {
|
|
14539
|
-
return !0 === this.
|
|
14539
|
+
return !0 === this.Ta;
|
|
14540
14540
|
}
|
|
14541
14541
|
}
|
|
14542
14542
|
|
|
@@ -14545,10 +14545,10 @@ class ec {
|
|
|
14545
14545
|
* server. All the subsequent view snapshots or errors are sent to the
|
|
14546
14546
|
* subscribed handlers. Returns the initial snapshot.
|
|
14547
14547
|
*/
|
|
14548
|
-
async function
|
|
14549
|
-
const n =
|
|
14548
|
+
async function ia(t, e) {
|
|
14549
|
+
const n = Na(t);
|
|
14550
14550
|
let s, i;
|
|
14551
|
-
const r = n.
|
|
14551
|
+
const r = n.fa.get(e);
|
|
14552
14552
|
if (r)
|
|
14553
14553
|
// PORTING NOTE: With Multi-Tab Web, it is possible that a query view
|
|
14554
14554
|
// already exists when EventManager calls us for the first time. This
|
|
@@ -14556,11 +14556,11 @@ async function ic(t, e) {
|
|
|
14556
14556
|
// behalf of another tab and the user of the primary also starts listening
|
|
14557
14557
|
// to the query. EventManager will not have an assigned target ID in this
|
|
14558
14558
|
// case and calls `listen` to obtain this ID.
|
|
14559
|
-
s = r.targetId, n.sharedClientState.addLocalQueryTarget(s), i = r.view.
|
|
14559
|
+
s = r.targetId, n.sharedClientState.addLocalQueryTarget(s), i = r.view.ca(); else {
|
|
14560
14560
|
const t = await vo(n.localStore, Ye(e));
|
|
14561
|
-
n.isPrimaryClient &&
|
|
14561
|
+
n.isPrimaryClient && cu(n.remoteStore, t);
|
|
14562
14562
|
const r = n.sharedClientState.addLocalQueryTarget(t.targetId);
|
|
14563
|
-
s = t.targetId, i = await
|
|
14563
|
+
s = t.targetId, i = await ra(n, e, s, "current" === r);
|
|
14564
14564
|
}
|
|
14565
14565
|
return i;
|
|
14566
14566
|
}
|
|
@@ -14568,33 +14568,33 @@ async function ic(t, e) {
|
|
|
14568
14568
|
/**
|
|
14569
14569
|
* Registers a view for a previously unknown query and computes its initial
|
|
14570
14570
|
* snapshot.
|
|
14571
|
-
*/ async function
|
|
14571
|
+
*/ async function ra(t, e, n, s) {
|
|
14572
14572
|
// PORTING NOTE: On Web only, we inject the code that registers new Limbo
|
|
14573
14573
|
// targets based on view changes. This allows us to only depend on Limbo
|
|
14574
14574
|
// changes when user code includes queries.
|
|
14575
|
-
t.
|
|
14576
|
-
let i = e.view.
|
|
14575
|
+
t.Ea = (e, n, s) => async function(t, e, n, s) {
|
|
14576
|
+
let i = e.view.ea(n);
|
|
14577
14577
|
i.ji && (
|
|
14578
14578
|
// The query has a limit and some docs were removed, so we need
|
|
14579
14579
|
// to re-run the query against the local store to make sure we
|
|
14580
14580
|
// didn't lose any good docs that had been past the limit.
|
|
14581
14581
|
i = await Do(t.localStore, e.query,
|
|
14582
|
-
/* usePreviousResults= */ !1).then((({documents: t}) => e.view.
|
|
14582
|
+
/* usePreviousResults= */ !1).then((({documents: t}) => e.view.ea(t, i))));
|
|
14583
14583
|
const r = s && s.targetChanges.get(e.targetId), o = e.view.applyChanges(i,
|
|
14584
14584
|
/* updateLimboDocuments= */ t.isPrimaryClient, r);
|
|
14585
|
-
return
|
|
14585
|
+
return ya(t, e.targetId, o.oa), o.snapshot;
|
|
14586
14586
|
}(t, e, n, s);
|
|
14587
14587
|
const i = await Do(t.localStore, e,
|
|
14588
|
-
/* usePreviousResults= */ !0), r = new
|
|
14588
|
+
/* usePreviousResults= */ !0), r = new ta(e, i.ir), o = r.ea(i.documents), u = rs.createSynthesizedTargetChangeForCurrentChange(n, s && "Offline" /* Offline */ !== t.onlineState), a = r.applyChanges(o,
|
|
14589
14589
|
/* updateLimboDocuments= */ t.isPrimaryClient, u);
|
|
14590
|
-
|
|
14591
|
-
const
|
|
14592
|
-
return t.
|
|
14590
|
+
ya(t, n, a.oa);
|
|
14591
|
+
const c = new ea(e, n, r);
|
|
14592
|
+
return t.fa.set(e, c), t.da.has(n) ? t.da.get(n).push(e) : t.da.set(n, [ e ]), a.snapshot;
|
|
14593
14593
|
}
|
|
14594
14594
|
|
|
14595
|
-
/** Stops listening to the query. */ async function
|
|
14596
|
-
const n = G(t), s = n.
|
|
14597
|
-
if (i.length > 1) return n.
|
|
14595
|
+
/** Stops listening to the query. */ async function oa(t, e) {
|
|
14596
|
+
const n = G(t), s = n.fa.get(e), i = n.da.get(s.targetId);
|
|
14597
|
+
if (i.length > 1) return n.da.set(s.targetId, i.filter((t => !Ze(t, e)))), void n.fa.delete(e);
|
|
14598
14598
|
// No other queries are mapped to the target, clean up the query and the target.
|
|
14599
14599
|
if (n.isPrimaryClient) {
|
|
14600
14600
|
// We need to remove the local query target first to allow us to verify
|
|
@@ -14603,9 +14603,9 @@ async function ic(t, e) {
|
|
|
14603
14603
|
n.sharedClientState.isActiveQueryTarget(s.targetId) || await So(n.localStore, s.targetId,
|
|
14604
14604
|
/*keepPersistedTargetData=*/ !1).then((() => {
|
|
14605
14605
|
n.sharedClientState.clearQueryState(s.targetId), hu(n.remoteStore, s.targetId),
|
|
14606
|
-
|
|
14606
|
+
ma(n, s.targetId);
|
|
14607
14607
|
})).catch(Or);
|
|
14608
|
-
} else
|
|
14608
|
+
} else ma(n, s.targetId), await So(n.localStore, s.targetId,
|
|
14609
14609
|
/*keepPersistedTargetData=*/ !0);
|
|
14610
14610
|
}
|
|
14611
14611
|
|
|
@@ -14618,11 +14618,11 @@ async function ic(t, e) {
|
|
|
14618
14618
|
* have completed, *not* when the write was acked by the backend. The
|
|
14619
14619
|
* userCallback is resolved once the write was acked/rejected by the
|
|
14620
14620
|
* backend (or failed locally for any other reason).
|
|
14621
|
-
*/ async function
|
|
14622
|
-
const s =
|
|
14621
|
+
*/ async function ua(t, e, n) {
|
|
14622
|
+
const s = ka(t);
|
|
14623
14623
|
try {
|
|
14624
14624
|
const t = await function(t, e) {
|
|
14625
|
-
const n = G(t), s =
|
|
14625
|
+
const n = G(t), s = ct.now(), i = e.reduce(((t, e) => t.add(e.key)), es());
|
|
14626
14626
|
let r, o;
|
|
14627
14627
|
return n.persistence.runTransaction("Locally write mutations", "readwrite", (t => {
|
|
14628
14628
|
// Figure out which keys do not have a remote version in the cache, this
|
|
@@ -14631,10 +14631,10 @@ async function ic(t, e) {
|
|
|
14631
14631
|
// TODO(Overlay): Is there a better way to determine this? Using the
|
|
14632
14632
|
// document version does not work because local mutations set them back
|
|
14633
14633
|
// to 0.
|
|
14634
|
-
let u = Wn(),
|
|
14634
|
+
let u = Wn(), a = es();
|
|
14635
14635
|
return n.Xi.getEntries(t, i).next((t => {
|
|
14636
14636
|
u = t, u.forEach(((t, e) => {
|
|
14637
|
-
e.isValidDocument() || (
|
|
14637
|
+
e.isValidDocument() || (a = a.add(t));
|
|
14638
14638
|
}));
|
|
14639
14639
|
})).next((() => n.tr.ts(t, u))).next((i => {
|
|
14640
14640
|
r = i;
|
|
@@ -14650,12 +14650,12 @@ async function ic(t, e) {
|
|
|
14650
14650
|
// NOTE: The base state should only be applied if there's some
|
|
14651
14651
|
// existing document to override, so use a Precondition of
|
|
14652
14652
|
// exists=true
|
|
14653
|
-
o.push(new kn(t.key, e,
|
|
14653
|
+
o.push(new kn(t.key, e, ce(e.value.mapValue), Pn.exists(!0)));
|
|
14654
14654
|
}
|
|
14655
14655
|
return n.jn.addMutationBatch(t, s, o, e);
|
|
14656
14656
|
})).next((e => {
|
|
14657
14657
|
o = e;
|
|
14658
|
-
const s = e.applyToLocalDocumentSet(r,
|
|
14658
|
+
const s = e.applyToLocalDocumentSet(r, a);
|
|
14659
14659
|
return n.Wn.saveOverlays(t, e.batchId, s);
|
|
14660
14660
|
}));
|
|
14661
14661
|
})).then((() => {
|
|
@@ -14667,14 +14667,14 @@ async function ic(t, e) {
|
|
|
14667
14667
|
}));
|
|
14668
14668
|
}(s.localStore, e);
|
|
14669
14669
|
s.sharedClientState.addPendingMutation(t.batchId), function(t, e, n) {
|
|
14670
|
-
let s = t.
|
|
14670
|
+
let s = t.ya[t.currentUser.toKey()];
|
|
14671
14671
|
s || (s = new _t(ot));
|
|
14672
|
-
s = s.insert(e, n), t.
|
|
14672
|
+
s = s.insert(e, n), t.ya[t.currentUser.toKey()] = s;
|
|
14673
14673
|
}
|
|
14674
14674
|
/**
|
|
14675
14675
|
* Resolves or rejects the user callback for the given batch and then discards
|
|
14676
14676
|
* it.
|
|
14677
|
-
*/ (s, t.batchId, n), await
|
|
14677
|
+
*/ (s, t.batchId, n), await Ta(s, t.changes), await Eu(s.remoteStore);
|
|
14678
14678
|
} catch (t) {
|
|
14679
14679
|
// If we can't persist the mutation, we reject the user callback and
|
|
14680
14680
|
// don't send the mutation. The user can then retry the write.
|
|
@@ -14687,20 +14687,20 @@ async function ic(t, e) {
|
|
|
14687
14687
|
* Applies one remote event to the sync engine, notifying any views of the
|
|
14688
14688
|
* changes, and releasing any pending mutation batches that would become
|
|
14689
14689
|
* visible because of the snapshot version the remote event contains.
|
|
14690
|
-
*/ async function
|
|
14690
|
+
*/ async function aa(t, e) {
|
|
14691
14691
|
const n = G(t);
|
|
14692
14692
|
try {
|
|
14693
14693
|
const t = await Po(n.localStore, e);
|
|
14694
14694
|
// Update `receivedDocument` as appropriate for any limbo targets.
|
|
14695
14695
|
e.targetChanges.forEach(((t, e) => {
|
|
14696
|
-
const s = n.
|
|
14696
|
+
const s = n.ma.get(e);
|
|
14697
14697
|
s && (
|
|
14698
14698
|
// Since this is a limbo resolution lookup, it's for a single document
|
|
14699
14699
|
// and it could be added, modified, or removed, but not a combination.
|
|
14700
14700
|
q(t.addedDocuments.size + t.modifiedDocuments.size + t.removedDocuments.size <= 1),
|
|
14701
|
-
t.addedDocuments.size > 0 ? s.
|
|
14702
|
-
s.
|
|
14703
|
-
})), await
|
|
14701
|
+
t.addedDocuments.size > 0 ? s.ha = !0 : t.modifiedDocuments.size > 0 ? q(s.ha) : t.removedDocuments.size > 0 && (q(s.ha),
|
|
14702
|
+
s.ha = !1));
|
|
14703
|
+
})), await Ta(n, t, e);
|
|
14704
14704
|
} catch (t) {
|
|
14705
14705
|
await Or(t);
|
|
14706
14706
|
}
|
|
@@ -14709,7 +14709,7 @@ async function ic(t, e) {
|
|
|
14709
14709
|
/**
|
|
14710
14710
|
* Applies an OnlineState change to the sync engine and notifies any views of
|
|
14711
14711
|
* the change.
|
|
14712
|
-
*/ function
|
|
14712
|
+
*/ function ca(t, e, n) {
|
|
14713
14713
|
const s = G(t);
|
|
14714
14714
|
// If we are the secondary client, we explicitly ignore the remote store's
|
|
14715
14715
|
// online state (the local client may go offline, even though the primary
|
|
@@ -14717,7 +14717,7 @@ async function ic(t, e) {
|
|
|
14717
14717
|
// SharedClientState.
|
|
14718
14718
|
if (s.isPrimaryClient && 0 /* RemoteStore */ === n || !s.isPrimaryClient && 1 /* SharedClientState */ === n) {
|
|
14719
14719
|
const t = [];
|
|
14720
|
-
s.
|
|
14720
|
+
s.fa.forEach(((n, s) => {
|
|
14721
14721
|
const i = s.view.ku(e);
|
|
14722
14722
|
i.snapshot && t.push(i.snapshot);
|
|
14723
14723
|
})), function(t, e) {
|
|
@@ -14729,7 +14729,7 @@ async function ic(t, e) {
|
|
|
14729
14729
|
// Run global snapshot listeners if a consistent snapshot has been emitted.
|
|
14730
14730
|
t.ku(e) && (s = !0);
|
|
14731
14731
|
})), s && ju(n);
|
|
14732
|
-
}(s.eventManager, e), t.length && s.
|
|
14732
|
+
}(s.eventManager, e), t.length && s.la.nu(t), s.onlineState = e, s.isPrimaryClient && s.sharedClientState.setOnlineState(e);
|
|
14733
14733
|
}
|
|
14734
14734
|
}
|
|
14735
14735
|
|
|
@@ -14743,11 +14743,11 @@ async function ic(t, e) {
|
|
|
14743
14743
|
* @param err - A description of the condition that has forced the rejection.
|
|
14744
14744
|
* Nearly always this will be an indication that the user is no longer
|
|
14745
14745
|
* authorized to see the data matching the target.
|
|
14746
|
-
*/ async function
|
|
14746
|
+
*/ async function ha(t, e, n) {
|
|
14747
14747
|
const s = G(t);
|
|
14748
14748
|
// PORTING NOTE: Multi-tab only.
|
|
14749
14749
|
s.sharedClientState.updateQueryState(e, "rejected", n);
|
|
14750
|
-
const i = s.
|
|
14750
|
+
const i = s.ma.get(e), r = i && i.key;
|
|
14751
14751
|
if (r) {
|
|
14752
14752
|
// TODO(klimt): We really only should do the following on permission
|
|
14753
14753
|
// denied errors, but we don't have the cause code here.
|
|
@@ -14763,18 +14763,18 @@ async function ic(t, e) {
|
|
|
14763
14763
|
const n = es().add(r), i = new is(ht.min(),
|
|
14764
14764
|
/* targetChanges= */ new Map,
|
|
14765
14765
|
/* targetMismatches= */ new gt(ot), t, n);
|
|
14766
|
-
await
|
|
14766
|
+
await aa(s, i),
|
|
14767
14767
|
// Since this query failed, we won't want to manually unlisten to it.
|
|
14768
14768
|
// We only remove it from bookkeeping after we successfully applied the
|
|
14769
14769
|
// RemoteEvent. If `applyRemoteEvent()` throws, we want to re-listen to
|
|
14770
14770
|
// this query when the RemoteStore restarts the Watch stream, which should
|
|
14771
14771
|
// re-trigger the target failure.
|
|
14772
|
-
s.
|
|
14772
|
+
s.wa = s.wa.remove(r), s.ma.delete(e), Ia(s);
|
|
14773
14773
|
} else await So(s.localStore, e,
|
|
14774
|
-
/* keepPersistedTargetData */ !1).then((() =>
|
|
14774
|
+
/* keepPersistedTargetData */ !1).then((() => ma(s, e, n))).catch(Or);
|
|
14775
14775
|
}
|
|
14776
14776
|
|
|
14777
|
-
async function
|
|
14777
|
+
async function la(t, e) {
|
|
14778
14778
|
const n = G(t), s = e.batch.batchId;
|
|
14779
14779
|
try {
|
|
14780
14780
|
const t = await Ao(n.localStore, e);
|
|
@@ -14782,14 +14782,14 @@ async function lc(t, e) {
|
|
|
14782
14782
|
// raise events immediately (depending on whether the watcher is caught
|
|
14783
14783
|
// up), so we raise user callbacks first so that they consistently happen
|
|
14784
14784
|
// before listen events.
|
|
14785
|
-
|
|
14786
|
-
await
|
|
14785
|
+
wa(n, s, /*error=*/ null), _a(n, s), n.sharedClientState.updateMutationState(s, "acknowledged"),
|
|
14786
|
+
await Ta(n, t);
|
|
14787
14787
|
} catch (t) {
|
|
14788
14788
|
await Or(t);
|
|
14789
14789
|
}
|
|
14790
14790
|
}
|
|
14791
14791
|
|
|
14792
|
-
async function
|
|
14792
|
+
async function fa(t, e, n) {
|
|
14793
14793
|
const s = G(t);
|
|
14794
14794
|
try {
|
|
14795
14795
|
const t = await function(t, e) {
|
|
@@ -14809,8 +14809,8 @@ async function fc(t, e, n) {
|
|
|
14809
14809
|
// raise events immediately (depending on whether the watcher is caught up),
|
|
14810
14810
|
// so we raise user callbacks first so that they consistently happen before
|
|
14811
14811
|
// listen events.
|
|
14812
|
-
|
|
14813
|
-
await
|
|
14812
|
+
wa(s, e, n), _a(s, e), s.sharedClientState.updateMutationState(e, "rejected", n),
|
|
14813
|
+
await Ta(s, t);
|
|
14814
14814
|
} catch (n) {
|
|
14815
14815
|
await Or(n);
|
|
14816
14816
|
}
|
|
@@ -14819,7 +14819,7 @@ async function fc(t, e, n) {
|
|
|
14819
14819
|
/**
|
|
14820
14820
|
* Registers a user callback that resolves when all pending mutations at the moment of calling
|
|
14821
14821
|
* are acknowledged .
|
|
14822
|
-
*/ async function
|
|
14822
|
+
*/ async function da(t, e) {
|
|
14823
14823
|
const n = G(t);
|
|
14824
14824
|
wu(n.remoteStore) || F("SyncEngine", "The network is disabled. The task returned by 'awaitPendingWrites()' will not complete until the network is enabled.");
|
|
14825
14825
|
try {
|
|
@@ -14830,8 +14830,8 @@ async function fc(t, e, n) {
|
|
|
14830
14830
|
if (-1 === t)
|
|
14831
14831
|
// Trigger the callback right away if there is no pending writes at the moment.
|
|
14832
14832
|
return void e.resolve();
|
|
14833
|
-
const s = n.
|
|
14834
|
-
s.push(e), n.
|
|
14833
|
+
const s = n.pa.get(t) || [];
|
|
14834
|
+
s.push(e), n.pa.set(t, s);
|
|
14835
14835
|
} catch (t) {
|
|
14836
14836
|
const n = Mu(t, "Initialization of waitForPendingWrites() operation failed");
|
|
14837
14837
|
e.reject(n);
|
|
@@ -14841,56 +14841,56 @@ async function fc(t, e, n) {
|
|
|
14841
14841
|
/**
|
|
14842
14842
|
* Triggers the callbacks that are waiting for this batch id to get acknowledged by server,
|
|
14843
14843
|
* if there are any.
|
|
14844
|
-
*/ function
|
|
14845
|
-
(t.
|
|
14844
|
+
*/ function _a(t, e) {
|
|
14845
|
+
(t.pa.get(e) || []).forEach((t => {
|
|
14846
14846
|
t.resolve();
|
|
14847
|
-
})), t.
|
|
14847
|
+
})), t.pa.delete(e);
|
|
14848
14848
|
}
|
|
14849
14849
|
|
|
14850
|
-
/** Reject all outstanding callbacks waiting for pending writes to complete. */ function
|
|
14850
|
+
/** Reject all outstanding callbacks waiting for pending writes to complete. */ function wa(t, e, n) {
|
|
14851
14851
|
const s = G(t);
|
|
14852
|
-
let i = s.
|
|
14852
|
+
let i = s.ya[s.currentUser.toKey()];
|
|
14853
14853
|
// NOTE: Mutations restored from persistence won't have callbacks, so it's
|
|
14854
14854
|
// okay for there to be no callback for this ID.
|
|
14855
14855
|
if (i) {
|
|
14856
14856
|
const t = i.get(e);
|
|
14857
|
-
t && (n ? t.reject(n) : t.resolve(), i = i.remove(e)), s.
|
|
14857
|
+
t && (n ? t.reject(n) : t.resolve(), i = i.remove(e)), s.ya[s.currentUser.toKey()] = i;
|
|
14858
14858
|
}
|
|
14859
14859
|
}
|
|
14860
14860
|
|
|
14861
|
-
function
|
|
14861
|
+
function ma(t, e, n = null) {
|
|
14862
14862
|
t.sharedClientState.removeLocalQueryTarget(e);
|
|
14863
|
-
for (const s of t.
|
|
14864
|
-
if (t.
|
|
14865
|
-
t.
|
|
14866
|
-
t.
|
|
14863
|
+
for (const s of t.da.get(e)) t.fa.delete(s), n && t.la.Aa(s, n);
|
|
14864
|
+
if (t.da.delete(e), t.isPrimaryClient) {
|
|
14865
|
+
t.ga.Is(e).forEach((e => {
|
|
14866
|
+
t.ga.containsKey(e) ||
|
|
14867
14867
|
// We removed the last reference for this key
|
|
14868
|
-
|
|
14868
|
+
ga(t, e);
|
|
14869
14869
|
}));
|
|
14870
14870
|
}
|
|
14871
14871
|
}
|
|
14872
14872
|
|
|
14873
|
-
function
|
|
14874
|
-
t.
|
|
14873
|
+
function ga(t, e) {
|
|
14874
|
+
t._a.delete(e.path.canonicalString());
|
|
14875
14875
|
// It's possible that the target already got removed because the query failed. In that case,
|
|
14876
14876
|
// the key won't exist in `limboTargetsByKey`. Only do the cleanup if we still have the target.
|
|
14877
|
-
const n = t.
|
|
14878
|
-
null !== n && (hu(t.remoteStore, n), t.
|
|
14877
|
+
const n = t.wa.get(e);
|
|
14878
|
+
null !== n && (hu(t.remoteStore, n), t.wa = t.wa.remove(e), t.ma.delete(n), Ia(t));
|
|
14879
14879
|
}
|
|
14880
14880
|
|
|
14881
|
-
function
|
|
14882
|
-
for (const s of n) if (s instanceof Xu) t.
|
|
14883
|
-
F("SyncEngine", "Document no longer in limbo: " + s.key), t.
|
|
14884
|
-
t.
|
|
14881
|
+
function ya(t, e, n) {
|
|
14882
|
+
for (const s of n) if (s instanceof Xu) t.ga.addReference(s.key, e), pa(t, s); else if (s instanceof Zu) {
|
|
14883
|
+
F("SyncEngine", "Document no longer in limbo: " + s.key), t.ga.removeReference(s.key, e);
|
|
14884
|
+
t.ga.containsKey(s.key) ||
|
|
14885
14885
|
// We removed the last reference for this key
|
|
14886
|
-
|
|
14886
|
+
ga(t, s.key);
|
|
14887
14887
|
} else U();
|
|
14888
14888
|
}
|
|
14889
14889
|
|
|
14890
|
-
function
|
|
14890
|
+
function pa(t, e) {
|
|
14891
14891
|
const n = e.key, s = n.path.canonicalString();
|
|
14892
|
-
t.
|
|
14893
|
-
|
|
14892
|
+
t.wa.get(n) || t._a.has(s) || (F("SyncEngine", "New document in limbo: " + n), t._a.add(s),
|
|
14893
|
+
Ia(t));
|
|
14894
14894
|
}
|
|
14895
14895
|
|
|
14896
14896
|
/**
|
|
@@ -14900,19 +14900,19 @@ function pc(t, e) {
|
|
|
14900
14900
|
* Without bounding the number of concurrent resolutions, the server can fail
|
|
14901
14901
|
* with "resource exhausted" errors which can lead to pathological client
|
|
14902
14902
|
* behavior as seen in https://github.com/firebase/firebase-js-sdk/issues/2683.
|
|
14903
|
-
*/ function
|
|
14904
|
-
for (;t.
|
|
14905
|
-
const e = t.
|
|
14906
|
-
t.
|
|
14907
|
-
const n = new Lt(Tt.fromString(e)), s = t.
|
|
14908
|
-
t.
|
|
14903
|
+
*/ function Ia(t) {
|
|
14904
|
+
for (;t._a.size > 0 && t.wa.size < t.maxConcurrentLimboResolutions; ) {
|
|
14905
|
+
const e = t._a.values().next().value;
|
|
14906
|
+
t._a.delete(e);
|
|
14907
|
+
const n = new Lt(Tt.fromString(e)), s = t.Ia.next();
|
|
14908
|
+
t.ma.set(s, new na(n)), t.wa = t.wa.insert(n, s), cu(t.remoteStore, new $i(Ye(Qe(n.path)), s, 2 /* LimboResolution */ , st.A));
|
|
14909
14909
|
}
|
|
14910
14910
|
}
|
|
14911
14911
|
|
|
14912
|
-
async function
|
|
14912
|
+
async function Ta(t, e, n) {
|
|
14913
14913
|
const s = G(t), i = [], r = [], o = [];
|
|
14914
|
-
s.
|
|
14915
|
-
o.push(s.
|
|
14914
|
+
s.fa.isEmpty() || (s.fa.forEach(((t, u) => {
|
|
14915
|
+
o.push(s.Ea(u, e, n).then((t => {
|
|
14916
14916
|
if (t) {
|
|
14917
14917
|
s.isPrimaryClient && s.sharedClientState.updateQueryState(u.targetId, t.fromCache ? "not-current" : "current"),
|
|
14918
14918
|
i.push(t);
|
|
@@ -14920,7 +14920,7 @@ async function Tc(t, e, n) {
|
|
|
14920
14920
|
r.push(e);
|
|
14921
14921
|
}
|
|
14922
14922
|
})));
|
|
14923
|
-
})), await Promise.all(o), s.
|
|
14923
|
+
})), await Promise.all(o), s.la.nu(i), await async function(t, e) {
|
|
14924
14924
|
const n = G(t);
|
|
14925
14925
|
try {
|
|
14926
14926
|
await n.persistence.runTransaction("notifyLocalViewChanges", "readwrite", (t => Ai.forEach(e, (e => Ai.forEach(e.Fi, (s => n.persistence.referenceDelegate.addReference(t, e.targetId, s))).next((() => Ai.forEach(e.$i, (s => n.persistence.referenceDelegate.removeReference(t, e.targetId, s)))))))));
|
|
@@ -14943,7 +14943,7 @@ async function Tc(t, e, n) {
|
|
|
14943
14943
|
}(s.localStore, r));
|
|
14944
14944
|
}
|
|
14945
14945
|
|
|
14946
|
-
async function
|
|
14946
|
+
async function Ea(t, e) {
|
|
14947
14947
|
const n = G(t);
|
|
14948
14948
|
if (!n.currentUser.isEqual(e)) {
|
|
14949
14949
|
F("SyncEngine", "User change. New user:", e.toKey());
|
|
@@ -14951,27 +14951,27 @@ async function Ec(t, e) {
|
|
|
14951
14951
|
n.currentUser = e,
|
|
14952
14952
|
// Fails tasks waiting for pending writes requested by previous user.
|
|
14953
14953
|
function(t, e) {
|
|
14954
|
-
t.
|
|
14954
|
+
t.pa.forEach((t => {
|
|
14955
14955
|
t.forEach((t => {
|
|
14956
14956
|
t.reject(new j(Q.CANCELLED, e));
|
|
14957
14957
|
}));
|
|
14958
|
-
})), t.
|
|
14958
|
+
})), t.pa.clear();
|
|
14959
14959
|
}(n, "'waitForPendingWrites' promise is rejected due to a user change."),
|
|
14960
14960
|
// TODO(b/114226417): Consider calling this only in the primary tab.
|
|
14961
|
-
n.sharedClientState.handleUserChange(e, t.removedBatchIds, t.addedBatchIds), await
|
|
14961
|
+
n.sharedClientState.handleUserChange(e, t.removedBatchIds, t.addedBatchIds), await Ta(n, t.er);
|
|
14962
14962
|
}
|
|
14963
14963
|
}
|
|
14964
14964
|
|
|
14965
|
-
function
|
|
14966
|
-
const n = G(t), s = n.
|
|
14967
|
-
if (s && s.
|
|
14965
|
+
function Aa(t, e) {
|
|
14966
|
+
const n = G(t), s = n.ma.get(e);
|
|
14967
|
+
if (s && s.ha) return es().add(s.key);
|
|
14968
14968
|
{
|
|
14969
14969
|
let t = es();
|
|
14970
|
-
const s = n.
|
|
14970
|
+
const s = n.da.get(e);
|
|
14971
14971
|
if (!s) return t;
|
|
14972
14972
|
for (const e of s) {
|
|
14973
|
-
const s = n.
|
|
14974
|
-
t = t.unionWith(s.view.
|
|
14973
|
+
const s = n.fa.get(e);
|
|
14974
|
+
t = t.unionWith(s.view.ta);
|
|
14975
14975
|
}
|
|
14976
14976
|
return t;
|
|
14977
14977
|
}
|
|
@@ -14980,10 +14980,10 @@ function Ac(t, e) {
|
|
|
14980
14980
|
/**
|
|
14981
14981
|
* Reconcile the list of synced documents in an existing view with those
|
|
14982
14982
|
* from persistence.
|
|
14983
|
-
*/ async function
|
|
14983
|
+
*/ async function Ra(t, e) {
|
|
14984
14984
|
const n = G(t), s = await Do(n.localStore, e.query,
|
|
14985
|
-
/* usePreviousResults= */ !0), i = e.view.
|
|
14986
|
-
return n.isPrimaryClient &&
|
|
14985
|
+
/* usePreviousResults= */ !0), i = e.view.aa(s);
|
|
14986
|
+
return n.isPrimaryClient && ya(n, e.targetId, i.oa), i;
|
|
14987
14987
|
}
|
|
14988
14988
|
|
|
14989
14989
|
/**
|
|
@@ -14991,14 +14991,14 @@ function Ac(t, e) {
|
|
|
14991
14991
|
* snapshots if needed.
|
|
14992
14992
|
*/
|
|
14993
14993
|
// PORTING NOTE: Multi-Tab only.
|
|
14994
|
-
async function
|
|
14994
|
+
async function Pa(t, e) {
|
|
14995
14995
|
const n = G(t);
|
|
14996
|
-
return xo(n.localStore, e).then((t =>
|
|
14996
|
+
return xo(n.localStore, e).then((t => Ta(n, t)));
|
|
14997
14997
|
}
|
|
14998
14998
|
|
|
14999
14999
|
/** Applies a mutation state to an existing batch. */
|
|
15000
15000
|
// PORTING NOTE: Multi-Tab only.
|
|
15001
|
-
async function
|
|
15001
|
+
async function ba(t, e, n, s) {
|
|
15002
15002
|
const i = G(t), r = await function(t, e) {
|
|
15003
15003
|
const n = G(t), s = G(n.jn);
|
|
15004
15004
|
return n.persistence.runTransaction("Lookup mutation documents", "readonly", (t => s.fn(t, e).next((e => e ? n.tr.Jn(t, e) : Ai.resolve(null)))));
|
|
@@ -15012,11 +15012,11 @@ async function bc(t, e, n, s) {
|
|
|
15012
15012
|
await Eu(i.remoteStore) : "acknowledged" === n || "rejected" === n ? (
|
|
15013
15013
|
// NOTE: Both these methods are no-ops for batches that originated from
|
|
15014
15014
|
// other clients.
|
|
15015
|
-
|
|
15015
|
+
wa(i, e, s || null), _a(i, e), function(t, e) {
|
|
15016
15016
|
G(G(t).jn)._n(e);
|
|
15017
15017
|
}
|
|
15018
15018
|
// PORTING NOTE: Multi-Tab only.
|
|
15019
|
-
(i.localStore, e)) : U(), await
|
|
15019
|
+
(i.localStore, e)) : U(), await Ta(i, r)) :
|
|
15020
15020
|
// A throttled tab may not have seen the mutation before it was completed
|
|
15021
15021
|
// and removed from the mutation queue, in which case we won't have cached
|
|
15022
15022
|
// the affected documents. In this case we can safely ignore the update
|
|
@@ -15029,32 +15029,32 @@ async function bc(t, e, n, s) {
|
|
|
15029
15029
|
|
|
15030
15030
|
/** Applies a query target change from a different tab. */
|
|
15031
15031
|
// PORTING NOTE: Multi-Tab only.
|
|
15032
|
-
async function
|
|
15032
|
+
async function Va(t, e) {
|
|
15033
15033
|
const n = G(t);
|
|
15034
|
-
if (
|
|
15034
|
+
if (Na(n), ka(n), !0 === e && !0 !== n.Ta) {
|
|
15035
15035
|
// Secondary tabs only maintain Views for their local listeners and the
|
|
15036
15036
|
// Views internal state may not be 100% populated (in particular
|
|
15037
15037
|
// secondary tabs don't track syncedDocuments, the set of documents the
|
|
15038
15038
|
// server considers to be in the target). So when a secondary becomes
|
|
15039
15039
|
// primary, we need to need to make sure that all views for all targets
|
|
15040
15040
|
// match the state on disk.
|
|
15041
|
-
const t = n.sharedClientState.getAllActiveQueryTargets(), e = await
|
|
15042
|
-
n.
|
|
15043
|
-
for (const t of e)
|
|
15044
|
-
} else if (!1 === e && !1 !== n.
|
|
15041
|
+
const t = n.sharedClientState.getAllActiveQueryTargets(), e = await va(n, t.toArray());
|
|
15042
|
+
n.Ta = !0, await xu(n.remoteStore, !0);
|
|
15043
|
+
for (const t of e) cu(n.remoteStore, t);
|
|
15044
|
+
} else if (!1 === e && !1 !== n.Ta) {
|
|
15045
15045
|
const t = [];
|
|
15046
15046
|
let e = Promise.resolve();
|
|
15047
|
-
n.
|
|
15048
|
-
n.sharedClientState.isLocalQueryTarget(i) ? t.push(i) : e = e.then((() => (
|
|
15047
|
+
n.da.forEach(((s, i) => {
|
|
15048
|
+
n.sharedClientState.isLocalQueryTarget(i) ? t.push(i) : e = e.then((() => (ma(n, i),
|
|
15049
15049
|
So(n.localStore, i,
|
|
15050
15050
|
/*keepPersistedTargetData=*/ !0)))), hu(n.remoteStore, i);
|
|
15051
|
-
})), await e, await
|
|
15051
|
+
})), await e, await va(n, t),
|
|
15052
15052
|
// PORTING NOTE: Multi-Tab only.
|
|
15053
15053
|
function(t) {
|
|
15054
15054
|
const e = G(t);
|
|
15055
|
-
e.
|
|
15055
|
+
e.ma.forEach(((t, n) => {
|
|
15056
15056
|
hu(e.remoteStore, n);
|
|
15057
|
-
})), e.
|
|
15057
|
+
})), e.ga.Ts(), e.ma = new Map, e.wa = new _t(Lt.comparator);
|
|
15058
15058
|
}
|
|
15059
15059
|
/**
|
|
15060
15060
|
* Reconcile the query views of the provided query targets with the state from
|
|
@@ -15067,15 +15067,15 @@ async function Vc(t, e) {
|
|
|
15067
15067
|
* tab to a primary tab
|
|
15068
15068
|
*/
|
|
15069
15069
|
// PORTING NOTE: Multi-Tab only.
|
|
15070
|
-
(n), n.
|
|
15070
|
+
(n), n.Ta = !1, await xu(n.remoteStore, !1);
|
|
15071
15071
|
}
|
|
15072
15072
|
}
|
|
15073
15073
|
|
|
15074
|
-
async function
|
|
15074
|
+
async function va(t, e, n) {
|
|
15075
15075
|
const s = G(t), i = [], r = [];
|
|
15076
15076
|
for (const t of e) {
|
|
15077
15077
|
let e;
|
|
15078
|
-
const n = s.
|
|
15078
|
+
const n = s.da.get(t);
|
|
15079
15079
|
if (n && 0 !== n.length) {
|
|
15080
15080
|
// For queries that have a local View, we fetch their current state
|
|
15081
15081
|
// from LocalStore (as the resume token and the snapshot version
|
|
@@ -15083,19 +15083,19 @@ async function vc(t, e, n) {
|
|
|
15083
15083
|
// state (the list of syncedDocuments may have gotten out of sync).
|
|
15084
15084
|
e = await vo(s.localStore, Ye(n[0]));
|
|
15085
15085
|
for (const t of n) {
|
|
15086
|
-
const e = s.
|
|
15086
|
+
const e = s.fa.get(t), n = await Ra(s, e);
|
|
15087
15087
|
n.snapshot && r.push(n.snapshot);
|
|
15088
15088
|
}
|
|
15089
15089
|
} else {
|
|
15090
15090
|
// For queries that never executed on this client, we need to
|
|
15091
15091
|
// allocate the target in LocalStore and initialize a new View.
|
|
15092
15092
|
const n = await Co(s.localStore, t);
|
|
15093
|
-
e = await vo(s.localStore, n), await
|
|
15093
|
+
e = await vo(s.localStore, n), await ra(s, Sa(n), t,
|
|
15094
15094
|
/*current=*/ !1);
|
|
15095
15095
|
}
|
|
15096
15096
|
i.push(e);
|
|
15097
15097
|
}
|
|
15098
|
-
return s.
|
|
15098
|
+
return s.la.nu(r), i;
|
|
15099
15099
|
}
|
|
15100
15100
|
|
|
15101
15101
|
/**
|
|
@@ -15109,38 +15109,38 @@ async function vc(t, e, n) {
|
|
|
15109
15109
|
* difference will not cause issues.
|
|
15110
15110
|
*/
|
|
15111
15111
|
// PORTING NOTE: Multi-Tab only.
|
|
15112
|
-
function
|
|
15112
|
+
function Sa(t) {
|
|
15113
15113
|
return Ge(t.path, t.collectionGroup, t.orderBy, t.filters, t.limit, "F" /* First */ , t.startAt, t.endAt);
|
|
15114
15114
|
}
|
|
15115
15115
|
|
|
15116
15116
|
/** Returns the IDs of the clients that are currently active. */
|
|
15117
15117
|
// PORTING NOTE: Multi-Tab only.
|
|
15118
|
-
function
|
|
15118
|
+
function Da(t) {
|
|
15119
15119
|
const e = G(t);
|
|
15120
15120
|
return G(G(e.localStore).persistence).Oi();
|
|
15121
15121
|
}
|
|
15122
15122
|
|
|
15123
15123
|
/** Applies a query target change from a different tab. */
|
|
15124
15124
|
// PORTING NOTE: Multi-Tab only.
|
|
15125
|
-
async function
|
|
15125
|
+
async function Ca(t, e, n, s) {
|
|
15126
15126
|
const i = G(t);
|
|
15127
|
-
if (i.
|
|
15127
|
+
if (i.Ta)
|
|
15128
15128
|
// If we receive a target state notification via WebStorage, we are
|
|
15129
15129
|
// either already secondary or another tab has taken the primary lease.
|
|
15130
15130
|
return void F("SyncEngine", "Ignoring unexpected query state notification.");
|
|
15131
|
-
const r = i.
|
|
15131
|
+
const r = i.da.get(e);
|
|
15132
15132
|
if (r && r.length > 0) switch (n) {
|
|
15133
15133
|
case "current":
|
|
15134
15134
|
case "not-current":
|
|
15135
15135
|
{
|
|
15136
15136
|
const t = await xo(i.localStore, sn(r[0])), s = is.createSynthesizedRemoteEventForCurrentChange(e, "current" === n);
|
|
15137
|
-
await
|
|
15137
|
+
await Ta(i, t, s);
|
|
15138
15138
|
break;
|
|
15139
15139
|
}
|
|
15140
15140
|
|
|
15141
15141
|
case "rejected":
|
|
15142
15142
|
await So(i.localStore, e,
|
|
15143
|
-
/* keepPersistedTargetData */ !0),
|
|
15143
|
+
/* keepPersistedTargetData */ !0), ma(i, e, s);
|
|
15144
15144
|
break;
|
|
15145
15145
|
|
|
15146
15146
|
default:
|
|
@@ -15148,41 +15148,41 @@ async function Cc(t, e, n, s) {
|
|
|
15148
15148
|
}
|
|
15149
15149
|
}
|
|
15150
15150
|
|
|
15151
|
-
/** Adds or removes Watch targets for queries from different tabs. */ async function
|
|
15152
|
-
const s =
|
|
15153
|
-
if (s.
|
|
15151
|
+
/** Adds or removes Watch targets for queries from different tabs. */ async function xa(t, e, n) {
|
|
15152
|
+
const s = Na(t);
|
|
15153
|
+
if (s.Ta) {
|
|
15154
15154
|
for (const t of e) {
|
|
15155
|
-
if (s.
|
|
15155
|
+
if (s.da.has(t)) {
|
|
15156
15156
|
// A target might have been added in a previous attempt
|
|
15157
15157
|
F("SyncEngine", "Adding an already active target " + t);
|
|
15158
15158
|
continue;
|
|
15159
15159
|
}
|
|
15160
15160
|
const e = await Co(s.localStore, t), n = await vo(s.localStore, e);
|
|
15161
|
-
await
|
|
15162
|
-
/*current=*/ !1),
|
|
15161
|
+
await ra(s, Sa(e), n.targetId,
|
|
15162
|
+
/*current=*/ !1), cu(s.remoteStore, n);
|
|
15163
15163
|
}
|
|
15164
15164
|
for (const t of n)
|
|
15165
15165
|
// Check that the target is still active since the target might have been
|
|
15166
15166
|
// removed if it has been rejected by the backend.
|
|
15167
|
-
s.
|
|
15167
|
+
s.da.has(t) &&
|
|
15168
15168
|
// Release queries that are still active.
|
|
15169
15169
|
await So(s.localStore, t,
|
|
15170
15170
|
/* keepPersistedTargetData */ !1).then((() => {
|
|
15171
|
-
hu(s.remoteStore, t),
|
|
15171
|
+
hu(s.remoteStore, t), ma(s, t);
|
|
15172
15172
|
})).catch(Or);
|
|
15173
15173
|
}
|
|
15174
15174
|
}
|
|
15175
15175
|
|
|
15176
|
-
function
|
|
15176
|
+
function Na(t) {
|
|
15177
15177
|
const e = G(t);
|
|
15178
|
-
return e.remoteStore.remoteSyncer.applyRemoteEvent =
|
|
15179
|
-
e.remoteStore.remoteSyncer.rejectListen =
|
|
15180
|
-
e.
|
|
15178
|
+
return e.remoteStore.remoteSyncer.applyRemoteEvent = aa.bind(null, e), e.remoteStore.remoteSyncer.getRemoteKeysForTarget = Aa.bind(null, e),
|
|
15179
|
+
e.remoteStore.remoteSyncer.rejectListen = ha.bind(null, e), e.la.nu = Gu.bind(null, e.eventManager),
|
|
15180
|
+
e.la.Aa = Qu.bind(null, e.eventManager), e;
|
|
15181
15181
|
}
|
|
15182
15182
|
|
|
15183
|
-
function
|
|
15183
|
+
function ka(t) {
|
|
15184
15184
|
const e = G(t);
|
|
15185
|
-
return e.remoteStore.remoteSyncer.applySuccessfulWrite =
|
|
15185
|
+
return e.remoteStore.remoteSyncer.applySuccessfulWrite = la.bind(null, e), e.remoteStore.remoteSyncer.rejectFailedWrite = fa.bind(null, e),
|
|
15186
15186
|
e;
|
|
15187
15187
|
}
|
|
15188
15188
|
|
|
@@ -15193,7 +15193,7 @@ function kc(t) {
|
|
|
15193
15193
|
* @param syncEngine - SyncEngine to use.
|
|
15194
15194
|
* @param bundleReader - Bundle to load into the SDK.
|
|
15195
15195
|
* @param task - LoadBundleTask used to update the loading progress to public API.
|
|
15196
|
-
*/ function
|
|
15196
|
+
*/ function Oa(t, e, n) {
|
|
15197
15197
|
const s = G(t);
|
|
15198
15198
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
15199
15199
|
(
|
|
@@ -15218,13 +15218,13 @@ function kc(t) {
|
|
|
15218
15218
|
}(s)), Promise.resolve(new Set);
|
|
15219
15219
|
n._updateProgress(Yu(s));
|
|
15220
15220
|
const i = new Ju(s, t.localStore, e.O);
|
|
15221
|
-
let r = await e.
|
|
15221
|
+
let r = await e.Ra();
|
|
15222
15222
|
for (;r; ) {
|
|
15223
15223
|
const t = await i.Qu(r);
|
|
15224
|
-
t && n._updateProgress(t), r = await e.
|
|
15224
|
+
t && n._updateProgress(t), r = await e.Ra();
|
|
15225
15225
|
}
|
|
15226
15226
|
const o = await i.complete();
|
|
15227
|
-
return await
|
|
15227
|
+
return await Ta(t, o.zu,
|
|
15228
15228
|
/* remoteEvent */ void 0),
|
|
15229
15229
|
// Save metadata, so loading the same bundle will skip.
|
|
15230
15230
|
await function(t, e) {
|
|
@@ -15263,24 +15263,24 @@ function kc(t) {
|
|
|
15263
15263
|
}));
|
|
15264
15264
|
}
|
|
15265
15265
|
|
|
15266
|
-
class
|
|
15266
|
+
class Ma {
|
|
15267
15267
|
constructor() {
|
|
15268
15268
|
this.synchronizeTabs = !1;
|
|
15269
15269
|
}
|
|
15270
15270
|
async initialize(t) {
|
|
15271
|
-
this.O = Zo(t.databaseInfo.databaseId), this.sharedClientState = this.
|
|
15272
|
-
await this.persistence.start(), this.gcScheduler = this.
|
|
15271
|
+
this.O = Zo(t.databaseInfo.databaseId), this.sharedClientState = this.Pa(t), this.persistence = this.ba(t),
|
|
15272
|
+
await this.persistence.start(), this.gcScheduler = this.Va(t), this.localStore = this.va(t);
|
|
15273
15273
|
}
|
|
15274
|
-
|
|
15274
|
+
Va(t) {
|
|
15275
15275
|
return null;
|
|
15276
15276
|
}
|
|
15277
|
-
|
|
15277
|
+
va(t) {
|
|
15278
15278
|
return To(this.persistence, new po, t.initialUser, this.O);
|
|
15279
15279
|
}
|
|
15280
|
-
|
|
15281
|
-
return new uo(
|
|
15280
|
+
ba(t) {
|
|
15281
|
+
return new uo(co.Ws, this.O);
|
|
15282
15282
|
}
|
|
15283
|
-
|
|
15283
|
+
Pa(t) {
|
|
15284
15284
|
return new Qo;
|
|
15285
15285
|
}
|
|
15286
15286
|
async terminate() {
|
|
@@ -15291,31 +15291,31 @@ class Mc {
|
|
|
15291
15291
|
|
|
15292
15292
|
/**
|
|
15293
15293
|
* Provides all components needed for Firestore with IndexedDB persistence.
|
|
15294
|
-
*/ class
|
|
15294
|
+
*/ class Fa extends Ma {
|
|
15295
15295
|
constructor(t, e, n) {
|
|
15296
|
-
super(), this.
|
|
15296
|
+
super(), this.Sa = t, this.cacheSizeBytes = e, this.forceOwnership = n, this.synchronizeTabs = !1;
|
|
15297
15297
|
}
|
|
15298
15298
|
async initialize(t) {
|
|
15299
|
-
await super.initialize(t), await this.
|
|
15299
|
+
await super.initialize(t), await this.Sa.initialize(this, t),
|
|
15300
15300
|
// Enqueue writes from a previous session
|
|
15301
|
-
await
|
|
15301
|
+
await ka(this.Sa.syncEngine), await Eu(this.Sa.remoteStore),
|
|
15302
15302
|
// NOTE: This will immediately call the listener, so we make sure to
|
|
15303
15303
|
// set it after localStore / remoteStore are started.
|
|
15304
15304
|
await this.persistence.pi((() => (this.gcScheduler && !this.gcScheduler.started && this.gcScheduler.start(this.localStore),
|
|
15305
15305
|
Promise.resolve())));
|
|
15306
15306
|
}
|
|
15307
|
-
|
|
15307
|
+
va(t) {
|
|
15308
15308
|
return To(this.persistence, new po, t.initialUser, this.O);
|
|
15309
15309
|
}
|
|
15310
|
-
|
|
15310
|
+
Va(t) {
|
|
15311
15311
|
const e = this.persistence.referenceDelegate.garbageCollector;
|
|
15312
15312
|
return new $r(e, t.asyncQueue);
|
|
15313
15313
|
}
|
|
15314
|
-
|
|
15314
|
+
ba(t) {
|
|
15315
15315
|
const e = go(t.databaseInfo.databaseId, t.databaseInfo.persistenceKey), n = void 0 !== this.cacheSizeBytes ? Er.withCacheSize(this.cacheSizeBytes) : Er.DEFAULT;
|
|
15316
15316
|
return new _o(this.synchronizeTabs, e, t.clientId, n, t.asyncQueue, Yo(), Xo(), this.O, this.sharedClientState, !!this.forceOwnership);
|
|
15317
15317
|
}
|
|
15318
|
-
|
|
15318
|
+
Pa(t) {
|
|
15319
15319
|
return new Qo;
|
|
15320
15320
|
}
|
|
15321
15321
|
}
|
|
@@ -15327,27 +15327,27 @@ class Mc {
|
|
|
15327
15327
|
* In the legacy client, this provider is used to provide both multi-tab and
|
|
15328
15328
|
* non-multi-tab persistence since we cannot tell at build time whether
|
|
15329
15329
|
* `synchronizeTabs` will be enabled.
|
|
15330
|
-
*/ class $
|
|
15330
|
+
*/ class $a extends Fa {
|
|
15331
15331
|
constructor(t, e) {
|
|
15332
|
-
super(t, e, /* forceOwnership= */ !1), this.
|
|
15332
|
+
super(t, e, /* forceOwnership= */ !1), this.Sa = t, this.cacheSizeBytes = e, this.synchronizeTabs = !0;
|
|
15333
15333
|
}
|
|
15334
15334
|
async initialize(t) {
|
|
15335
15335
|
await super.initialize(t);
|
|
15336
|
-
const e = this.
|
|
15336
|
+
const e = this.Sa.syncEngine;
|
|
15337
15337
|
this.sharedClientState instanceof Go && (this.sharedClientState.syncEngine = {
|
|
15338
|
-
jr:
|
|
15339
|
-
Wr:
|
|
15340
|
-
zr:
|
|
15341
|
-
Oi:
|
|
15342
|
-
Qr:
|
|
15338
|
+
jr: ba.bind(null, e),
|
|
15339
|
+
Wr: Ca.bind(null, e),
|
|
15340
|
+
zr: xa.bind(null, e),
|
|
15341
|
+
Oi: Da.bind(null, e),
|
|
15342
|
+
Qr: Pa.bind(null, e)
|
|
15343
15343
|
}, await this.sharedClientState.start()),
|
|
15344
15344
|
// NOTE: This will immediately call the listener, so we make sure to
|
|
15345
15345
|
// set it after localStore / remoteStore are started.
|
|
15346
15346
|
await this.persistence.pi((async t => {
|
|
15347
|
-
await
|
|
15347
|
+
await Va(this.Sa.syncEngine, t), this.gcScheduler && (t && !this.gcScheduler.started ? this.gcScheduler.start(this.localStore) : t || this.gcScheduler.stop());
|
|
15348
15348
|
}));
|
|
15349
15349
|
}
|
|
15350
|
-
|
|
15350
|
+
Pa(t) {
|
|
15351
15351
|
const e = Yo();
|
|
15352
15352
|
if (!Go.vt(e)) throw new j(Q.UNIMPLEMENTED, "IndexedDB persistence is only available on platforms that support LocalStorage.");
|
|
15353
15353
|
const n = go(t.databaseInfo.databaseId, t.databaseInfo.persistenceKey);
|
|
@@ -15358,13 +15358,13 @@ class Mc {
|
|
|
15358
15358
|
/**
|
|
15359
15359
|
* Initializes and wires the components that are needed to interface with the
|
|
15360
15360
|
* network.
|
|
15361
|
-
*/ class
|
|
15361
|
+
*/ class Ba {
|
|
15362
15362
|
async initialize(t, e) {
|
|
15363
15363
|
this.localStore || (this.localStore = t.localStore, this.sharedClientState = t.sharedClientState,
|
|
15364
15364
|
this.datastore = this.createDatastore(e), this.remoteStore = this.createRemoteStore(e),
|
|
15365
15365
|
this.eventManager = this.createEventManager(e), this.syncEngine = this.createSyncEngine(e,
|
|
15366
|
-
/* startAsPrimary=*/ !t.synchronizeTabs), this.sharedClientState.onlineStateHandler = t =>
|
|
15367
|
-
this.remoteStore.remoteSyncer.handleCredentialChange =
|
|
15366
|
+
/* startAsPrimary=*/ !t.synchronizeTabs), this.sharedClientState.onlineStateHandler = t => ca(this.syncEngine, t, 1 /* SharedClientState */),
|
|
15367
|
+
this.remoteStore.remoteSyncer.handleCredentialChange = Ea.bind(null, this.syncEngine),
|
|
15368
15368
|
await xu(this.remoteStore, this.syncEngine.isPrimaryClient));
|
|
15369
15369
|
}
|
|
15370
15370
|
createEventManager(t) {
|
|
@@ -15378,7 +15378,7 @@ class Mc {
|
|
|
15378
15378
|
}(t.authCredentials, t.appCheckCredentials, n, e);
|
|
15379
15379
|
}
|
|
15380
15380
|
createRemoteStore(t) {
|
|
15381
|
-
return e = this.localStore, n = this.datastore, s = t.asyncQueue, i = t =>
|
|
15381
|
+
return e = this.localStore, n = this.datastore, s = t.asyncQueue, i = t => ca(this.syncEngine, t, 0 /* RemoteStore */),
|
|
15382
15382
|
r = Wo.vt() ? new Wo : new jo, new ou(e, n, s, i, r);
|
|
15383
15383
|
var e, n, s, i, r;
|
|
15384
15384
|
/** Re-enables the network. Idempotent. */ }
|
|
@@ -15386,14 +15386,14 @@ class Mc {
|
|
|
15386
15386
|
return function(t, e, n,
|
|
15387
15387
|
// PORTING NOTE: Manages state synchronization in multi-tab environments.
|
|
15388
15388
|
s, i, r, o) {
|
|
15389
|
-
const u = new
|
|
15390
|
-
return o && (u.
|
|
15389
|
+
const u = new sa(t, e, n, s, i, r);
|
|
15390
|
+
return o && (u.Ta = !0), u;
|
|
15391
15391
|
}(this.localStore, this.remoteStore, this.eventManager, this.sharedClientState, t.initialUser, t.maxConcurrentLimboResolutions, e);
|
|
15392
15392
|
}
|
|
15393
15393
|
terminate() {
|
|
15394
15394
|
return async function(t) {
|
|
15395
15395
|
const e = G(t);
|
|
15396
|
-
F("RemoteStore", "RemoteStore shutting down."), e.Au.add(5 /* Shutdown */), await
|
|
15396
|
+
F("RemoteStore", "RemoteStore shutting down."), e.Au.add(5 /* Shutdown */), await au(e),
|
|
15397
15397
|
e.Pu.shutdown(),
|
|
15398
15398
|
// Set the OnlineState to Unknown (rather than Offline) to avoid potentially
|
|
15399
15399
|
// triggering spurious listener events with cached data, etc.
|
|
@@ -15429,7 +15429,7 @@ class Mc {
|
|
|
15429
15429
|
* @param bytesPerRead - How many bytes each `read()` from the returned reader
|
|
15430
15430
|
* will read.
|
|
15431
15431
|
*/
|
|
15432
|
-
function
|
|
15432
|
+
function La(t, e = 10240) {
|
|
15433
15433
|
let n = 0;
|
|
15434
15434
|
// The TypeScript definition for ReadableStreamReader changed. We use
|
|
15435
15435
|
// `any` here to allow this code to compile with different versions.
|
|
@@ -15495,7 +15495,7 @@ function Lc(t, e = 10240) {
|
|
|
15495
15495
|
* asynchronously. To allow immediate silencing, a mute call is added which
|
|
15496
15496
|
* causes events scheduled to no longer be raised.
|
|
15497
15497
|
*/
|
|
15498
|
-
class
|
|
15498
|
+
class Ua {
|
|
15499
15499
|
constructor(t) {
|
|
15500
15500
|
this.observer = t,
|
|
15501
15501
|
/**
|
|
@@ -15505,15 +15505,15 @@ class Uc {
|
|
|
15505
15505
|
this.muted = !1;
|
|
15506
15506
|
}
|
|
15507
15507
|
next(t) {
|
|
15508
|
-
this.observer.next && this.
|
|
15508
|
+
this.observer.next && this.Da(this.observer.next, t);
|
|
15509
15509
|
}
|
|
15510
15510
|
error(t) {
|
|
15511
|
-
this.observer.error ? this.
|
|
15511
|
+
this.observer.error ? this.Da(this.observer.error, t) : console.error("Uncaught Error in snapshot listener:", t);
|
|
15512
15512
|
}
|
|
15513
|
-
|
|
15513
|
+
Ca() {
|
|
15514
15514
|
this.muted = !0;
|
|
15515
15515
|
}
|
|
15516
|
-
|
|
15516
|
+
Da(t, e) {
|
|
15517
15517
|
this.muted || setTimeout((() => {
|
|
15518
15518
|
this.muted || t(e);
|
|
15519
15519
|
}), 0);
|
|
@@ -15541,32 +15541,32 @@ class Uc {
|
|
|
15541
15541
|
*
|
|
15542
15542
|
* Takes a bundle stream or buffer, and presents abstractions to read bundled
|
|
15543
15543
|
* elements out of the underlying content.
|
|
15544
|
-
*/ class
|
|
15544
|
+
*/ class qa {
|
|
15545
15545
|
constructor(
|
|
15546
15546
|
/** The reader to read from underlying binary bundle data source. */
|
|
15547
15547
|
t, e) {
|
|
15548
|
-
this.
|
|
15548
|
+
this.xa = t, this.O = e,
|
|
15549
15549
|
/** Cached bundle metadata. */
|
|
15550
15550
|
this.metadata = new W,
|
|
15551
15551
|
/**
|
|
15552
15552
|
* Internal buffer to hold bundle content, accumulating incomplete element
|
|
15553
15553
|
* content.
|
|
15554
15554
|
*/
|
|
15555
|
-
this.buffer = new Uint8Array, this.
|
|
15555
|
+
this.buffer = new Uint8Array, this.Na = new TextDecoder("utf-8"),
|
|
15556
15556
|
// Read the metadata (which is the first element).
|
|
15557
|
-
this.
|
|
15557
|
+
this.ka().then((t => {
|
|
15558
15558
|
t && t.Ku() ? this.metadata.resolve(t.payload.metadata) : this.metadata.reject(new Error(`The first element of the bundle is not a metadata, it is\n ${JSON.stringify(null == t ? void 0 : t.payload)}`));
|
|
15559
15559
|
}), (t => this.metadata.reject(t)));
|
|
15560
15560
|
}
|
|
15561
15561
|
close() {
|
|
15562
|
-
return this.
|
|
15562
|
+
return this.xa.cancel();
|
|
15563
15563
|
}
|
|
15564
15564
|
async getMetadata() {
|
|
15565
15565
|
return this.metadata.promise;
|
|
15566
15566
|
}
|
|
15567
|
-
async
|
|
15567
|
+
async Ra() {
|
|
15568
15568
|
// Makes sure metadata is read before proceeding.
|
|
15569
|
-
return await this.getMetadata(), this.
|
|
15569
|
+
return await this.getMetadata(), this.ka();
|
|
15570
15570
|
}
|
|
15571
15571
|
/**
|
|
15572
15572
|
* Reads from the head of internal buffer, and pulling more data from
|
|
@@ -15577,15 +15577,15 @@ class Uc {
|
|
|
15577
15577
|
*
|
|
15578
15578
|
* Returns either the bundled element, or null if we have reached the end of
|
|
15579
15579
|
* the stream.
|
|
15580
|
-
*/ async
|
|
15581
|
-
const t = await this.
|
|
15580
|
+
*/ async ka() {
|
|
15581
|
+
const t = await this.Oa();
|
|
15582
15582
|
if (null === t) return null;
|
|
15583
|
-
const e = this.
|
|
15584
|
-
isNaN(n) && this.
|
|
15585
|
-
const s = await this
|
|
15583
|
+
const e = this.Na.decode(t), n = Number(e);
|
|
15584
|
+
isNaN(n) && this.Ma(`length string (${e}) is not valid number`);
|
|
15585
|
+
const s = await this.Fa(n);
|
|
15586
15586
|
return new zu(JSON.parse(s), t.length + n);
|
|
15587
15587
|
}
|
|
15588
|
-
/** First index of '{' from the underlying buffer. */
|
|
15588
|
+
/** First index of '{' from the underlying buffer. */ $a() {
|
|
15589
15589
|
return this.buffer.findIndex((t => t === "{".charCodeAt(0)));
|
|
15590
15590
|
}
|
|
15591
15591
|
/**
|
|
@@ -15593,17 +15593,17 @@ class Uc {
|
|
|
15593
15593
|
* return the content.
|
|
15594
15594
|
*
|
|
15595
15595
|
* If reached end of the stream, returns a null.
|
|
15596
|
-
*/ async
|
|
15597
|
-
for (;this
|
|
15598
|
-
if (await this.
|
|
15596
|
+
*/ async Oa() {
|
|
15597
|
+
for (;this.$a() < 0; ) {
|
|
15598
|
+
if (await this.Ba()) break;
|
|
15599
15599
|
}
|
|
15600
15600
|
// Broke out of the loop because underlying stream is closed, and there
|
|
15601
15601
|
// happens to be no more data to process.
|
|
15602
15602
|
if (0 === this.buffer.length) return null;
|
|
15603
|
-
const t = this
|
|
15603
|
+
const t = this.$a();
|
|
15604
15604
|
// Broke out of the loop because underlying stream is closed, but still
|
|
15605
15605
|
// cannot find an open bracket.
|
|
15606
|
-
t < 0 && this.
|
|
15606
|
+
t < 0 && this.Ma("Reached the end of bundle when a length string is expected.");
|
|
15607
15607
|
const e = this.buffer.slice(0, t);
|
|
15608
15608
|
// Update the internal buffer to drop the read length.
|
|
15609
15609
|
return this.buffer = this.buffer.slice(t), e;
|
|
@@ -15613,23 +15613,23 @@ class Uc {
|
|
|
15613
15613
|
* number of bytes, pulling more data from the underlying stream if needed.
|
|
15614
15614
|
*
|
|
15615
15615
|
* Returns a string decoded from the read bytes.
|
|
15616
|
-
*/ async
|
|
15616
|
+
*/ async Fa(t) {
|
|
15617
15617
|
for (;this.buffer.length < t; ) {
|
|
15618
|
-
await this.
|
|
15618
|
+
await this.Ba() && this.Ma("Reached the end of bundle when more is expected.");
|
|
15619
15619
|
}
|
|
15620
|
-
const e = this.
|
|
15620
|
+
const e = this.Na.decode(this.buffer.slice(0, t));
|
|
15621
15621
|
// Update the internal buffer to drop the read json string.
|
|
15622
15622
|
return this.buffer = this.buffer.slice(t), e;
|
|
15623
15623
|
}
|
|
15624
|
-
|
|
15624
|
+
Ma(t) {
|
|
15625
15625
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
15626
|
-
throw this.
|
|
15626
|
+
throw this.xa.cancel(), new Error(`Invalid bundle format: ${t}`);
|
|
15627
15627
|
}
|
|
15628
15628
|
/**
|
|
15629
15629
|
* Pulls more data from underlying stream to internal buffer.
|
|
15630
15630
|
* Returns a boolean indicating whether the stream is finished.
|
|
15631
|
-
*/ async
|
|
15632
|
-
const t = await this.
|
|
15631
|
+
*/ async Ba() {
|
|
15632
|
+
const t = await this.xa.read();
|
|
15633
15633
|
if (!t.done) {
|
|
15634
15634
|
const e = new Uint8Array(this.buffer.length + t.value.length);
|
|
15635
15635
|
e.set(this.buffer), e.set(t.value, this.buffer.length), this.buffer = e;
|
|
@@ -15658,7 +15658,7 @@ class Uc {
|
|
|
15658
15658
|
* Internal transaction object responsible for accumulating the mutations to
|
|
15659
15659
|
* perform and the base versions for any documents read.
|
|
15660
15660
|
*/
|
|
15661
|
-
class
|
|
15661
|
+
class Ka {
|
|
15662
15662
|
constructor(t) {
|
|
15663
15663
|
this.datastore = t,
|
|
15664
15664
|
// The version of each document that was read during this transaction.
|
|
@@ -15798,29 +15798,29 @@ class Kc {
|
|
|
15798
15798
|
/**
|
|
15799
15799
|
* TransactionRunner encapsulates the logic needed to run and retry transactions
|
|
15800
15800
|
* with backoff.
|
|
15801
|
-
*/ class
|
|
15801
|
+
*/ class Ga {
|
|
15802
15802
|
constructor(t, e, n, s, i) {
|
|
15803
15803
|
this.asyncQueue = t, this.datastore = e, this.options = n, this.updateFunction = s,
|
|
15804
|
-
this.deferred = i, this.
|
|
15804
|
+
this.deferred = i, this.La = n.maxAttempts, this.Uo = new tu(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
|
|
15805
15805
|
}
|
|
15806
15806
|
/** Runs the transaction and sets the result on deferred. */ run() {
|
|
15807
|
-
this.
|
|
15807
|
+
this.La -= 1, this.Ua();
|
|
15808
15808
|
}
|
|
15809
|
-
|
|
15809
|
+
Ua() {
|
|
15810
15810
|
this.Uo.xo((async () => {
|
|
15811
|
-
const t = new
|
|
15811
|
+
const t = new Ka(this.datastore), e = this.qa(t);
|
|
15812
15812
|
e && e.then((e => {
|
|
15813
15813
|
this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
|
|
15814
15814
|
this.deferred.resolve(e);
|
|
15815
15815
|
})).catch((t => {
|
|
15816
|
-
this.
|
|
15816
|
+
this.Ka(t);
|
|
15817
15817
|
}))));
|
|
15818
15818
|
})).catch((t => {
|
|
15819
|
-
this.
|
|
15819
|
+
this.Ka(t);
|
|
15820
15820
|
}));
|
|
15821
15821
|
}));
|
|
15822
15822
|
}
|
|
15823
|
-
|
|
15823
|
+
qa(t) {
|
|
15824
15824
|
try {
|
|
15825
15825
|
const e = this.updateFunction(t);
|
|
15826
15826
|
return !Ft(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
|
|
@@ -15830,11 +15830,11 @@ class Kc {
|
|
|
15830
15830
|
return this.deferred.reject(t), null;
|
|
15831
15831
|
}
|
|
15832
15832
|
}
|
|
15833
|
-
|
|
15834
|
-
this.
|
|
15833
|
+
Ka(t) {
|
|
15834
|
+
this.La > 0 && this.Ga(t) ? (this.La -= 1, this.asyncQueue.enqueueAndForget((() => (this.Ua(),
|
|
15835
15835
|
Promise.resolve())))) : this.deferred.reject(t);
|
|
15836
15836
|
}
|
|
15837
|
-
|
|
15837
|
+
Ga(t) {
|
|
15838
15838
|
if ("FirebaseError" === t.name) {
|
|
15839
15839
|
// In transactions, the backend will fail outdated reads with FAILED_PRECONDITION and
|
|
15840
15840
|
// non-matching document versions with ABORTED. These errors should be retried.
|
|
@@ -15866,7 +15866,7 @@ class Kc {
|
|
|
15866
15866
|
* pieces of the client SDK architecture. It is responsible for creating the
|
|
15867
15867
|
* async queue that is shared by all of the other components in the system.
|
|
15868
15868
|
*/
|
|
15869
|
-
class
|
|
15869
|
+
class Qa {
|
|
15870
15870
|
constructor(t, e,
|
|
15871
15871
|
/**
|
|
15872
15872
|
* Asynchronous queue responsible for all of our internal processing. When
|
|
@@ -15926,7 +15926,7 @@ class Qc {
|
|
|
15926
15926
|
}
|
|
15927
15927
|
}
|
|
15928
15928
|
|
|
15929
|
-
async function
|
|
15929
|
+
async function ja(t, e) {
|
|
15930
15930
|
t.asyncQueue.verifyOperationInProgress(), F("FirestoreClient", "Initializing OfflineComponentProvider");
|
|
15931
15931
|
const n = await t.getConfiguration();
|
|
15932
15932
|
await e.initialize(n);
|
|
@@ -15939,9 +15939,9 @@ async function jc(t, e) {
|
|
|
15939
15939
|
e.persistence.setDatabaseDeletedListener((() => t.terminate())), t.offlineComponents = e;
|
|
15940
15940
|
}
|
|
15941
15941
|
|
|
15942
|
-
async function
|
|
15942
|
+
async function Wa(t, e) {
|
|
15943
15943
|
t.asyncQueue.verifyOperationInProgress();
|
|
15944
|
-
const n = await
|
|
15944
|
+
const n = await za(t);
|
|
15945
15945
|
F("FirestoreClient", "Initializing OnlineComponentProvider");
|
|
15946
15946
|
const s = await t.getConfiguration();
|
|
15947
15947
|
await e.initialize(n, s),
|
|
@@ -15951,41 +15951,41 @@ async function Wc(t, e) {
|
|
|
15951
15951
|
t.onlineComponents = e;
|
|
15952
15952
|
}
|
|
15953
15953
|
|
|
15954
|
-
async function
|
|
15954
|
+
async function za(t) {
|
|
15955
15955
|
return t.offlineComponents || (F("FirestoreClient", "Using default OfflineComponentProvider"),
|
|
15956
|
-
await
|
|
15956
|
+
await ja(t, new Ma)), t.offlineComponents;
|
|
15957
15957
|
}
|
|
15958
15958
|
|
|
15959
|
-
async function
|
|
15959
|
+
async function Ha(t) {
|
|
15960
15960
|
return t.onlineComponents || (F("FirestoreClient", "Using default OnlineComponentProvider"),
|
|
15961
|
-
await
|
|
15961
|
+
await Wa(t, new Ba)), t.onlineComponents;
|
|
15962
15962
|
}
|
|
15963
15963
|
|
|
15964
|
-
function
|
|
15965
|
-
return
|
|
15964
|
+
function Ja(t) {
|
|
15965
|
+
return za(t).then((t => t.persistence));
|
|
15966
15966
|
}
|
|
15967
15967
|
|
|
15968
|
-
function
|
|
15969
|
-
return
|
|
15968
|
+
function Ya(t) {
|
|
15969
|
+
return za(t).then((t => t.localStore));
|
|
15970
15970
|
}
|
|
15971
15971
|
|
|
15972
|
-
function
|
|
15973
|
-
return
|
|
15972
|
+
function Xa(t) {
|
|
15973
|
+
return Ha(t).then((t => t.remoteStore));
|
|
15974
15974
|
}
|
|
15975
15975
|
|
|
15976
|
-
function
|
|
15977
|
-
return
|
|
15976
|
+
function Za(t) {
|
|
15977
|
+
return Ha(t).then((t => t.syncEngine));
|
|
15978
15978
|
}
|
|
15979
15979
|
|
|
15980
|
-
async function
|
|
15981
|
-
const e = await
|
|
15982
|
-
return n.onListen =
|
|
15980
|
+
async function tc(t) {
|
|
15981
|
+
const e = await Ha(t), n = e.eventManager;
|
|
15982
|
+
return n.onListen = ia.bind(null, e.syncEngine), n.onUnlisten = oa.bind(null, e.syncEngine),
|
|
15983
15983
|
n;
|
|
15984
15984
|
}
|
|
15985
15985
|
|
|
15986
|
-
/** Enables the network connection and re-enqueues all pending operations. */ function
|
|
15986
|
+
/** Enables the network connection and re-enqueues all pending operations. */ function ec(t) {
|
|
15987
15987
|
return t.asyncQueue.enqueue((async () => {
|
|
15988
|
-
const e = await
|
|
15988
|
+
const e = await Ja(t), n = await Xa(t);
|
|
15989
15989
|
return e.setNetworkEnabled(!0), function(t) {
|
|
15990
15990
|
const e = G(t);
|
|
15991
15991
|
return e.Au.delete(0 /* UserDisabled */), uu(e);
|
|
@@ -15993,12 +15993,12 @@ async function ta(t) {
|
|
|
15993
15993
|
}));
|
|
15994
15994
|
}
|
|
15995
15995
|
|
|
15996
|
-
/** Disables the network connection. Pending operations will not complete. */ function
|
|
15996
|
+
/** Disables the network connection. Pending operations will not complete. */ function nc(t) {
|
|
15997
15997
|
return t.asyncQueue.enqueue((async () => {
|
|
15998
|
-
const e = await
|
|
15998
|
+
const e = await Ja(t), n = await Xa(t);
|
|
15999
15999
|
return e.setNetworkEnabled(!1), async function(t) {
|
|
16000
16000
|
const e = G(t);
|
|
16001
|
-
e.Au.add(0 /* UserDisabled */), await
|
|
16001
|
+
e.Au.add(0 /* UserDisabled */), await au(e),
|
|
16002
16002
|
// Set the OnlineState to Offline so get()s return from cache, etc.
|
|
16003
16003
|
e.bu.set("Offline" /* Offline */);
|
|
16004
16004
|
}(n);
|
|
@@ -16009,7 +16009,7 @@ async function ta(t) {
|
|
|
16009
16009
|
* Returns a Promise that resolves when all writes that were pending at the time
|
|
16010
16010
|
* this method was called received server acknowledgement. An acknowledgement
|
|
16011
16011
|
* can be either acceptance or rejection.
|
|
16012
|
-
*/ function
|
|
16012
|
+
*/ function sc(t, e) {
|
|
16013
16013
|
const n = new W;
|
|
16014
16014
|
return t.asyncQueue.enqueueAndForget((async () => async function(t, e, n) {
|
|
16015
16015
|
try {
|
|
@@ -16026,13 +16026,13 @@ async function ta(t) {
|
|
|
16026
16026
|
/**
|
|
16027
16027
|
* Retrieves a latency-compensated document from the backend via a
|
|
16028
16028
|
* SnapshotListener.
|
|
16029
|
-
*/ (await
|
|
16029
|
+
*/ (await Ya(t), e, n))), n.promise;
|
|
16030
16030
|
}
|
|
16031
16031
|
|
|
16032
|
-
function
|
|
16032
|
+
function ic(t, e, n = {}) {
|
|
16033
16033
|
const s = new W;
|
|
16034
16034
|
return t.asyncQueue.enqueueAndForget((async () => function(t, e, n, s, i) {
|
|
16035
|
-
const r = new
|
|
16035
|
+
const r = new Ua({
|
|
16036
16036
|
next: r => {
|
|
16037
16037
|
// Remove query first before passing event to user to avoid
|
|
16038
16038
|
// user actions affecting the now stale query.
|
|
@@ -16054,15 +16054,15 @@ function ia(t, e, n = {}) {
|
|
|
16054
16054
|
qu: !0
|
|
16055
16055
|
});
|
|
16056
16056
|
return qu(t, o);
|
|
16057
|
-
}(await
|
|
16057
|
+
}(await tc(t), t.asyncQueue, e, n, s))), s.promise;
|
|
16058
16058
|
}
|
|
16059
16059
|
|
|
16060
|
-
function
|
|
16060
|
+
function rc(t, e) {
|
|
16061
16061
|
const n = new W;
|
|
16062
16062
|
return t.asyncQueue.enqueueAndForget((async () => async function(t, e, n) {
|
|
16063
16063
|
try {
|
|
16064
16064
|
const s = await Do(t, e,
|
|
16065
|
-
/* usePreviousResults= */ !0), i = new
|
|
16065
|
+
/* usePreviousResults= */ !0), i = new ta(e, s.ir), r = i.ea(s.documents), o = i.applyChanges(r,
|
|
16066
16066
|
/* updateLimboDocuments= */ !1);
|
|
16067
16067
|
n.resolve(o.snapshot);
|
|
16068
16068
|
} catch (t) {
|
|
@@ -16073,13 +16073,13 @@ function ra(t, e) {
|
|
|
16073
16073
|
/**
|
|
16074
16074
|
* Retrieves a latency-compensated query snapshot from the backend via a
|
|
16075
16075
|
* SnapshotListener.
|
|
16076
|
-
*/ (await
|
|
16076
|
+
*/ (await Ya(t), e, n))), n.promise;
|
|
16077
16077
|
}
|
|
16078
16078
|
|
|
16079
|
-
function
|
|
16079
|
+
function oc(t, e, n = {}) {
|
|
16080
16080
|
const s = new W;
|
|
16081
16081
|
return t.asyncQueue.enqueueAndForget((async () => function(t, e, n, s, i) {
|
|
16082
|
-
const r = new
|
|
16082
|
+
const r = new Ua({
|
|
16083
16083
|
next: n => {
|
|
16084
16084
|
// Remove query first before passing event to user to avoid
|
|
16085
16085
|
// user actions affecting the now stale query.
|
|
@@ -16091,20 +16091,20 @@ function oa(t, e, n = {}) {
|
|
|
16091
16091
|
qu: !0
|
|
16092
16092
|
});
|
|
16093
16093
|
return qu(t, o);
|
|
16094
|
-
}(await
|
|
16094
|
+
}(await tc(t), t.asyncQueue, e, n, s))), s.promise;
|
|
16095
16095
|
}
|
|
16096
16096
|
|
|
16097
|
-
function
|
|
16098
|
-
const n = new
|
|
16097
|
+
function uc(t, e) {
|
|
16098
|
+
const n = new Ua(e);
|
|
16099
16099
|
return t.asyncQueue.enqueueAndForget((async () => function(t, e) {
|
|
16100
16100
|
G(t).Nu.add(e),
|
|
16101
16101
|
// Immediately fire an initial event, indicating all existing listeners
|
|
16102
16102
|
// are in-sync.
|
|
16103
16103
|
e.next();
|
|
16104
|
-
}(await
|
|
16105
|
-
n.
|
|
16104
|
+
}(await tc(t), n))), () => {
|
|
16105
|
+
n.Ca(), t.asyncQueue.enqueueAndForget((async () => function(t, e) {
|
|
16106
16106
|
G(t).Nu.delete(e);
|
|
16107
|
-
}(await
|
|
16107
|
+
}(await tc(t), n)));
|
|
16108
16108
|
};
|
|
16109
16109
|
}
|
|
16110
16110
|
|
|
@@ -16122,25 +16122,25 @@ function ua(t, e) {
|
|
|
16122
16122
|
* accessed with the transaction will not reflect local changes that have not
|
|
16123
16123
|
* been committed. For this reason, it is required that all reads are
|
|
16124
16124
|
* performed before any writes. Transactions must be performed while online.
|
|
16125
|
-
*/ function
|
|
16125
|
+
*/ function ac(t, e, n) {
|
|
16126
16126
|
const s = new W;
|
|
16127
16127
|
return t.asyncQueue.enqueueAndForget((async () => {
|
|
16128
16128
|
const i = await function(t) {
|
|
16129
|
-
return
|
|
16129
|
+
return Ha(t).then((t => t.datastore));
|
|
16130
16130
|
}(t);
|
|
16131
|
-
new
|
|
16131
|
+
new Ga(t.asyncQueue, i, n, e, s).run();
|
|
16132
16132
|
})), s.promise;
|
|
16133
16133
|
}
|
|
16134
16134
|
|
|
16135
|
-
function
|
|
16135
|
+
function cc(t, e, n, s) {
|
|
16136
16136
|
const i = function(t, e) {
|
|
16137
16137
|
let n;
|
|
16138
16138
|
n = "string" == typeof t ? (new TextEncoder).encode(t) : t;
|
|
16139
16139
|
return function(t, e) {
|
|
16140
|
-
return new
|
|
16140
|
+
return new qa(t, e);
|
|
16141
16141
|
}(function(t, e) {
|
|
16142
|
-
if (t instanceof Uint8Array) return
|
|
16143
|
-
if (t instanceof ArrayBuffer) return
|
|
16142
|
+
if (t instanceof Uint8Array) return La(t, e);
|
|
16143
|
+
if (t instanceof ArrayBuffer) return La(new Uint8Array(t), e);
|
|
16144
16144
|
if (t instanceof ReadableStream) return t.getReader();
|
|
16145
16145
|
throw new Error("Source of `toByteStreamReader` has to be a ArrayBuffer or ReadableStream");
|
|
16146
16146
|
}(n), e);
|
|
@@ -16162,18 +16162,18 @@ function aa(t, e, n, s) {
|
|
|
16162
16162
|
* limitations under the License.
|
|
16163
16163
|
*/ (n, Zo(e));
|
|
16164
16164
|
t.asyncQueue.enqueueAndForget((async () => {
|
|
16165
|
-
|
|
16165
|
+
Oa(await Za(t), i, s);
|
|
16166
16166
|
}));
|
|
16167
16167
|
}
|
|
16168
16168
|
|
|
16169
|
-
function
|
|
16169
|
+
function hc(t, e) {
|
|
16170
16170
|
return t.asyncQueue.enqueue((async () => function(t, e) {
|
|
16171
16171
|
const n = G(t);
|
|
16172
16172
|
return n.persistence.runTransaction("Get named query", "readonly", (t => n.Us.getNamedQuery(t, e)));
|
|
16173
|
-
}(await
|
|
16173
|
+
}(await Ya(t), e)));
|
|
16174
16174
|
}
|
|
16175
16175
|
|
|
16176
|
-
const
|
|
16176
|
+
const lc = new Map;
|
|
16177
16177
|
|
|
16178
16178
|
/**
|
|
16179
16179
|
* An instance map that ensures only one Datastore exists per Firestore
|
|
@@ -16195,28 +16195,28 @@ const la = new Map;
|
|
|
16195
16195
|
* See the License for the specific language governing permissions and
|
|
16196
16196
|
* limitations under the License.
|
|
16197
16197
|
*/
|
|
16198
|
-
function
|
|
16198
|
+
function fc(t, e, n) {
|
|
16199
16199
|
if (!n) throw new j(Q.INVALID_ARGUMENT, `Function ${t}() cannot be called with an empty ${e}.`);
|
|
16200
16200
|
}
|
|
16201
16201
|
|
|
16202
16202
|
/**
|
|
16203
16203
|
* Validates that two boolean options are not set at the same time.
|
|
16204
16204
|
* @internal
|
|
16205
|
-
*/ function
|
|
16205
|
+
*/ function dc(t, e, n, s) {
|
|
16206
16206
|
if (!0 === e && !0 === s) throw new j(Q.INVALID_ARGUMENT, `${t} and ${n} cannot be used together.`);
|
|
16207
16207
|
}
|
|
16208
16208
|
|
|
16209
16209
|
/**
|
|
16210
16210
|
* Validates that `path` refers to a document (indicated by the fact it contains
|
|
16211
16211
|
* an even numbers of segments).
|
|
16212
|
-
*/ function
|
|
16212
|
+
*/ function _c(t) {
|
|
16213
16213
|
if (!Lt.isDocumentKey(t)) throw new j(Q.INVALID_ARGUMENT, `Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`);
|
|
16214
16214
|
}
|
|
16215
16215
|
|
|
16216
16216
|
/**
|
|
16217
16217
|
* Validates that `path` refers to a collection (indicated by the fact it
|
|
16218
16218
|
* contains an odd numbers of segments).
|
|
16219
|
-
*/ function
|
|
16219
|
+
*/ function wc(t) {
|
|
16220
16220
|
if (Lt.isDocumentKey(t)) throw new j(Q.INVALID_ARGUMENT, `Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`);
|
|
16221
16221
|
}
|
|
16222
16222
|
|
|
@@ -16225,7 +16225,7 @@ function fa(t, e, n) {
|
|
|
16225
16225
|
* (i.e. excludes Array, Date, etc.).
|
|
16226
16226
|
*/
|
|
16227
16227
|
/** Returns a string describing the type / value of the provided input. */
|
|
16228
|
-
function
|
|
16228
|
+
function mc(t) {
|
|
16229
16229
|
if (void 0 === t) return "undefined";
|
|
16230
16230
|
if (null === t) return "null";
|
|
16231
16231
|
if ("string" == typeof t) return t.length > 20 && (t = `${t.substring(0, 20)}...`),
|
|
@@ -16254,7 +16254,7 @@ function ma(t) {
|
|
|
16254
16254
|
return "function" == typeof t ? "a function" : U();
|
|
16255
16255
|
}
|
|
16256
16256
|
|
|
16257
|
-
function
|
|
16257
|
+
function gc(t,
|
|
16258
16258
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16259
16259
|
e) {
|
|
16260
16260
|
if ("_delegate" in t && (
|
|
@@ -16263,14 +16263,14 @@ e) {
|
|
|
16263
16263
|
t = t._delegate), !(t instanceof e)) {
|
|
16264
16264
|
if (e.name === t.constructor.name) throw new j(Q.INVALID_ARGUMENT, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
|
|
16265
16265
|
{
|
|
16266
|
-
const n =
|
|
16266
|
+
const n = mc(t);
|
|
16267
16267
|
throw new j(Q.INVALID_ARGUMENT, `Expected type '${e.name}', but it was: ${n}`);
|
|
16268
16268
|
}
|
|
16269
16269
|
}
|
|
16270
16270
|
return t;
|
|
16271
16271
|
}
|
|
16272
16272
|
|
|
16273
|
-
function
|
|
16273
|
+
function yc(t, e) {
|
|
16274
16274
|
if (e <= 0) throw new j(Q.INVALID_ARGUMENT, `Function ${t}() requires a positive number, but it was: ${e}.`);
|
|
16275
16275
|
}
|
|
16276
16276
|
|
|
@@ -16296,7 +16296,7 @@ function ya(t, e) {
|
|
|
16296
16296
|
* user-supplied `FirestoreSettings` object. This is a separate type so that
|
|
16297
16297
|
* defaults can be supplied and the value can be checked for equality.
|
|
16298
16298
|
*/
|
|
16299
|
-
class
|
|
16299
|
+
class pc {
|
|
16300
16300
|
constructor(t) {
|
|
16301
16301
|
var e;
|
|
16302
16302
|
if (void 0 === t.host) {
|
|
@@ -16309,7 +16309,7 @@ class pa {
|
|
|
16309
16309
|
this.cacheSizeBytes = t.cacheSizeBytes;
|
|
16310
16310
|
}
|
|
16311
16311
|
this.experimentalForceLongPolling = !!t.experimentalForceLongPolling, this.experimentalAutoDetectLongPolling = !!t.experimentalAutoDetectLongPolling,
|
|
16312
|
-
this.useFetchStreams = !!t.useFetchStreams,
|
|
16312
|
+
this.useFetchStreams = !!t.useFetchStreams, dc("experimentalForceLongPolling", t.experimentalForceLongPolling, "experimentalAutoDetectLongPolling", t.experimentalAutoDetectLongPolling);
|
|
16313
16313
|
}
|
|
16314
16314
|
isEqual(t) {
|
|
16315
16315
|
return this.host === t.host && this.ssl === t.ssl && this.credentials === t.credentials && this.cacheSizeBytes === t.cacheSizeBytes && this.experimentalForceLongPolling === t.experimentalForceLongPolling && this.experimentalAutoDetectLongPolling === t.experimentalAutoDetectLongPolling && this.ignoreUndefinedProperties === t.ignoreUndefinedProperties && this.useFetchStreams === t.useFetchStreams;
|
|
@@ -16336,14 +16336,14 @@ class pa {
|
|
|
16336
16336
|
* The Cloud Firestore service interface.
|
|
16337
16337
|
*
|
|
16338
16338
|
* Do not call this constructor directly. Instead, use {@link getFirestore}.
|
|
16339
|
-
*/ class
|
|
16339
|
+
*/ class Ic {
|
|
16340
16340
|
/** @hideconstructor */
|
|
16341
16341
|
constructor(t, e, n) {
|
|
16342
16342
|
this._authCredentials = e, this._appCheckCredentials = n,
|
|
16343
16343
|
/**
|
|
16344
16344
|
* Whether it's a Firestore or Firestore Lite instance.
|
|
16345
16345
|
*/
|
|
16346
|
-
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new
|
|
16346
|
+
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new pc({}),
|
|
16347
16347
|
this._settingsFrozen = !1, t instanceof Mt ? this._databaseId = t : (this._app = t,
|
|
16348
16348
|
this._databaseId = function(t) {
|
|
16349
16349
|
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new j(Q.INVALID_ARGUMENT, '"projectId" not provided in firebase.initializeApp.');
|
|
@@ -16378,7 +16378,7 @@ class pa {
|
|
|
16378
16378
|
}
|
|
16379
16379
|
_setSettings(t) {
|
|
16380
16380
|
if (this._settingsFrozen) throw new j(Q.FAILED_PRECONDITION, "Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");
|
|
16381
|
-
this._settings = new
|
|
16381
|
+
this._settings = new pc(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
|
|
16382
16382
|
if (!t) return new H;
|
|
16383
16383
|
switch (t.type) {
|
|
16384
16384
|
case "gapi":
|
|
@@ -16423,15 +16423,15 @@ class pa {
|
|
|
16423
16423
|
* when the `Firestore` instance is terminated.
|
|
16424
16424
|
*/
|
|
16425
16425
|
return function(t) {
|
|
16426
|
-
const e =
|
|
16427
|
-
e && (F("ComponentProvider", "Removing Datastore"),
|
|
16426
|
+
const e = lc.get(t);
|
|
16427
|
+
e && (F("ComponentProvider", "Removing Datastore"), lc.delete(t), e.terminate());
|
|
16428
16428
|
}(this), Promise.resolve();
|
|
16429
16429
|
}
|
|
16430
16430
|
}
|
|
16431
16431
|
|
|
16432
|
-
function
|
|
16432
|
+
function Tc(t, e, n, s = {}) {
|
|
16433
16433
|
var i;
|
|
16434
|
-
const r = (t =
|
|
16434
|
+
const r = (t = gc(t, Ic))._getSettings();
|
|
16435
16435
|
if ("firestore.googleapis.com" !== r.host && r.host !== e && B("Host has been set in both settings() and useEmulator(), emulator host will be used"),
|
|
16436
16436
|
t._setSettings(Object.assign(Object.assign({}, r), {
|
|
16437
16437
|
host: `${e}:${n}`,
|
|
@@ -16470,7 +16470,7 @@ function Ta(t, e, n, s = {}) {
|
|
|
16470
16470
|
* A `DocumentReference` refers to a document location in a Firestore database
|
|
16471
16471
|
* and can be used to write, read, or listen to the location. The document at
|
|
16472
16472
|
* the referenced location may or may not exist.
|
|
16473
|
-
*/ class
|
|
16473
|
+
*/ class Ec {
|
|
16474
16474
|
/** @hideconstructor */
|
|
16475
16475
|
constructor(t,
|
|
16476
16476
|
/**
|
|
@@ -16498,17 +16498,17 @@ function Ta(t, e, n, s = {}) {
|
|
|
16498
16498
|
/**
|
|
16499
16499
|
* The collection this `DocumentReference` belongs to.
|
|
16500
16500
|
*/ get parent() {
|
|
16501
|
-
return new
|
|
16501
|
+
return new Rc(this.firestore, this.converter, this._key.path.popLast());
|
|
16502
16502
|
}
|
|
16503
16503
|
withConverter(t) {
|
|
16504
|
-
return new
|
|
16504
|
+
return new Ec(this.firestore, t, this._key);
|
|
16505
16505
|
}
|
|
16506
16506
|
}
|
|
16507
16507
|
|
|
16508
16508
|
/**
|
|
16509
16509
|
* A `Query` refers to a query which you can read or listen to. You can also
|
|
16510
16510
|
* construct refined `Query` objects by adding filters and ordering.
|
|
16511
|
-
*/ class
|
|
16511
|
+
*/ class Ac {
|
|
16512
16512
|
// This is the lite version of the Query class in the main SDK.
|
|
16513
16513
|
/** @hideconstructor protected */
|
|
16514
16514
|
constructor(t,
|
|
@@ -16521,14 +16521,14 @@ function Ta(t, e, n, s = {}) {
|
|
|
16521
16521
|
this.type = "query", this.firestore = t;
|
|
16522
16522
|
}
|
|
16523
16523
|
withConverter(t) {
|
|
16524
|
-
return new
|
|
16524
|
+
return new Ac(this.firestore, t, this._query);
|
|
16525
16525
|
}
|
|
16526
16526
|
}
|
|
16527
16527
|
|
|
16528
16528
|
/**
|
|
16529
16529
|
* A `CollectionReference` object can be used for adding documents, getting
|
|
16530
16530
|
* document references, and querying for documents (using {@link query}).
|
|
16531
|
-
*/ class
|
|
16531
|
+
*/ class Rc extends Ac {
|
|
16532
16532
|
/** @hideconstructor */
|
|
16533
16533
|
constructor(t, e, n) {
|
|
16534
16534
|
super(t, e, Qe(n)), this._path = n,
|
|
@@ -16549,23 +16549,23 @@ function Ta(t, e, n, s = {}) {
|
|
|
16549
16549
|
* subcollection. If this isn't a subcollection, the reference is null.
|
|
16550
16550
|
*/ get parent() {
|
|
16551
16551
|
const t = this._path.popLast();
|
|
16552
|
-
return t.isEmpty() ? null : new
|
|
16552
|
+
return t.isEmpty() ? null : new Ec(this.firestore,
|
|
16553
16553
|
/* converter= */ null, new Lt(t));
|
|
16554
16554
|
}
|
|
16555
16555
|
withConverter(t) {
|
|
16556
|
-
return new
|
|
16556
|
+
return new Rc(this.firestore, t, this._path);
|
|
16557
16557
|
}
|
|
16558
16558
|
}
|
|
16559
16559
|
|
|
16560
|
-
function
|
|
16561
|
-
if (t = I(t),
|
|
16560
|
+
function Pc(t, e, ...n) {
|
|
16561
|
+
if (t = I(t), fc("collection", "path", e), t instanceof Ic) {
|
|
16562
16562
|
const s = Tt.fromString(e, ...n);
|
|
16563
|
-
return
|
|
16563
|
+
return wc(s), new Rc(t, /* converter= */ null, s);
|
|
16564
16564
|
}
|
|
16565
16565
|
{
|
|
16566
|
-
if (!(t instanceof
|
|
16566
|
+
if (!(t instanceof Ec || t instanceof Rc)) throw new j(Q.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
16567
16567
|
const s = t._path.child(Tt.fromString(e, ...n));
|
|
16568
|
-
return
|
|
16568
|
+
return wc(s), new Rc(t.firestore,
|
|
16569
16569
|
/* converter= */ null, s);
|
|
16570
16570
|
}
|
|
16571
16571
|
}
|
|
@@ -16582,9 +16582,9 @@ function Pa(t, e, ...n) {
|
|
|
16582
16582
|
* collection or subcollection with this ID as the last segment of its path
|
|
16583
16583
|
* will be included. Cannot contain a slash.
|
|
16584
16584
|
* @returns The created `Query`.
|
|
16585
|
-
*/ function
|
|
16586
|
-
if (t =
|
|
16587
|
-
return new
|
|
16585
|
+
*/ function bc(t, e) {
|
|
16586
|
+
if (t = gc(t, Ic), fc("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new j(Q.INVALID_ARGUMENT, `Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
|
|
16587
|
+
return new Ac(t,
|
|
16588
16588
|
/* converter= */ null,
|
|
16589
16589
|
/**
|
|
16590
16590
|
* Creates a new Query for a collection group query that matches all documents
|
|
@@ -16595,19 +16595,19 @@ function Pa(t, e, ...n) {
|
|
|
16595
16595
|
}(e));
|
|
16596
16596
|
}
|
|
16597
16597
|
|
|
16598
|
-
function
|
|
16598
|
+
function Vc(t, e, ...n) {
|
|
16599
16599
|
if (t = I(t),
|
|
16600
16600
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
16601
16601
|
// 'undefined' and 'null'.
|
|
16602
|
-
1 === arguments.length && (e = rt.R()),
|
|
16602
|
+
1 === arguments.length && (e = rt.R()), fc("doc", "path", e), t instanceof Ic) {
|
|
16603
16603
|
const s = Tt.fromString(e, ...n);
|
|
16604
|
-
return
|
|
16604
|
+
return _c(s), new Ec(t,
|
|
16605
16605
|
/* converter= */ null, new Lt(s));
|
|
16606
16606
|
}
|
|
16607
16607
|
{
|
|
16608
|
-
if (!(t instanceof
|
|
16608
|
+
if (!(t instanceof Ec || t instanceof Rc)) throw new j(Q.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
16609
16609
|
const s = t._path.child(Tt.fromString(e, ...n));
|
|
16610
|
-
return
|
|
16610
|
+
return _c(s), new Ec(t.firestore, t instanceof Rc ? t.converter : null, new Lt(s));
|
|
16611
16611
|
}
|
|
16612
16612
|
}
|
|
16613
16613
|
|
|
@@ -16618,8 +16618,8 @@ function Va(t, e, ...n) {
|
|
|
16618
16618
|
* @param right - A reference to compare.
|
|
16619
16619
|
* @returns true if the references point to the same location in the same
|
|
16620
16620
|
* Firestore database.
|
|
16621
|
-
*/ function
|
|
16622
|
-
return t = I(t), e = I(e), (t instanceof
|
|
16621
|
+
*/ function vc(t, e) {
|
|
16622
|
+
return t = I(t), e = I(e), (t instanceof Ec || t instanceof Rc) && (e instanceof Ec || e instanceof Rc) && (t.firestore === e.firestore && t.path === e.path && t.converter === e.converter);
|
|
16623
16623
|
}
|
|
16624
16624
|
|
|
16625
16625
|
/**
|
|
@@ -16630,8 +16630,8 @@ function Va(t, e, ...n) {
|
|
|
16630
16630
|
* @param right - A `Query` to compare.
|
|
16631
16631
|
* @returns true if the references point to the same location in the same
|
|
16632
16632
|
* Firestore database.
|
|
16633
|
-
*/ function
|
|
16634
|
-
return t = I(t), e = I(e), t instanceof
|
|
16633
|
+
*/ function Sc(t, e) {
|
|
16634
|
+
return t = I(t), e = I(e), t instanceof Ac && e instanceof Ac && (t.firestore === e.firestore && Ze(t._query, e._query) && t.converter === e.converter);
|
|
16635
16635
|
}
|
|
16636
16636
|
|
|
16637
16637
|
/**
|
|
@@ -16649,42 +16649,42 @@ function Va(t, e, ...n) {
|
|
|
16649
16649
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16650
16650
|
* See the License for the specific language governing permissions and
|
|
16651
16651
|
* limitations under the License.
|
|
16652
|
-
*/ class
|
|
16652
|
+
*/ class Dc {
|
|
16653
16653
|
constructor() {
|
|
16654
16654
|
// The last promise in the queue.
|
|
16655
|
-
this.
|
|
16655
|
+
this.Qa = Promise.resolve(),
|
|
16656
16656
|
// A list of retryable operations. Retryable operations are run in order and
|
|
16657
16657
|
// retried with backoff.
|
|
16658
|
-
this.
|
|
16658
|
+
this.ja = [],
|
|
16659
16659
|
// Is this AsyncQueue being shut down? Once it is set to true, it will not
|
|
16660
16660
|
// be changed again.
|
|
16661
|
-
this.
|
|
16661
|
+
this.Wa = !1,
|
|
16662
16662
|
// Operations scheduled to be queued in the future. Operations are
|
|
16663
16663
|
// automatically removed after they are run or canceled.
|
|
16664
|
-
this.
|
|
16664
|
+
this.za = [],
|
|
16665
16665
|
// visible for testing
|
|
16666
|
-
this.
|
|
16666
|
+
this.Ha = null,
|
|
16667
16667
|
// Flag set while there's an outstanding AsyncQueue operation, used for
|
|
16668
16668
|
// assertion sanity-checks.
|
|
16669
|
-
this.
|
|
16669
|
+
this.Ja = !1,
|
|
16670
16670
|
// Enabled during shutdown on Safari to prevent future access to IndexedDB.
|
|
16671
|
-
this.
|
|
16671
|
+
this.Ya = !1,
|
|
16672
16672
|
// List of TimerIds to fast-forward delays for.
|
|
16673
|
-
this.
|
|
16673
|
+
this.Xa = [],
|
|
16674
16674
|
// Backoff timer used to schedule retries for retryable operations
|
|
16675
16675
|
this.Uo = new tu(this, "async_queue_retry" /* AsyncQueueRetry */),
|
|
16676
16676
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
16677
16677
|
// operations. Meant to speed up recovery when we regain file system access
|
|
16678
16678
|
// after page comes into foreground.
|
|
16679
|
-
this.
|
|
16679
|
+
this.Za = () => {
|
|
16680
16680
|
const t = Xo();
|
|
16681
16681
|
t && F("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.Uo.ko();
|
|
16682
16682
|
};
|
|
16683
16683
|
const t = Xo();
|
|
16684
|
-
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.
|
|
16684
|
+
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Za);
|
|
16685
16685
|
}
|
|
16686
16686
|
get isShuttingDown() {
|
|
16687
|
-
return this.
|
|
16687
|
+
return this.Wa;
|
|
16688
16688
|
}
|
|
16689
16689
|
/**
|
|
16690
16690
|
* Adds a new operation to the queue without waiting for it to complete (i.e.
|
|
@@ -16694,44 +16694,44 @@ function Va(t, e, ...n) {
|
|
|
16694
16694
|
this.enqueue(t);
|
|
16695
16695
|
}
|
|
16696
16696
|
enqueueAndForgetEvenWhileRestricted(t) {
|
|
16697
|
-
this.
|
|
16697
|
+
this.tc(),
|
|
16698
16698
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
16699
|
-
this.
|
|
16699
|
+
this.ec(t);
|
|
16700
16700
|
}
|
|
16701
16701
|
enterRestrictedMode(t) {
|
|
16702
|
-
if (!this.
|
|
16703
|
-
this.
|
|
16702
|
+
if (!this.Wa) {
|
|
16703
|
+
this.Wa = !0, this.Ya = t || !1;
|
|
16704
16704
|
const e = Xo();
|
|
16705
|
-
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.
|
|
16705
|
+
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Za);
|
|
16706
16706
|
}
|
|
16707
16707
|
}
|
|
16708
16708
|
enqueue(t) {
|
|
16709
|
-
if (this.
|
|
16709
|
+
if (this.tc(), this.Wa)
|
|
16710
16710
|
// Return a Promise which never resolves.
|
|
16711
16711
|
return new Promise((() => {}));
|
|
16712
16712
|
// Create a deferred Promise that we can return to the callee. This
|
|
16713
16713
|
// allows us to return a "hanging Promise" only to the callee and still
|
|
16714
16714
|
// advance the queue even when the operation is not run.
|
|
16715
16715
|
const e = new W;
|
|
16716
|
-
return this.
|
|
16716
|
+
return this.ec((() => this.Wa && this.Ya ? Promise.resolve() : (t().then(e.resolve, e.reject),
|
|
16717
16717
|
e.promise))).then((() => e.promise));
|
|
16718
16718
|
}
|
|
16719
16719
|
enqueueRetryable(t) {
|
|
16720
|
-
this.enqueueAndForget((() => (this.
|
|
16720
|
+
this.enqueueAndForget((() => (this.ja.push(t), this.nc())));
|
|
16721
16721
|
}
|
|
16722
16722
|
/**
|
|
16723
16723
|
* Runs the next operation from the retryable queue. If the operation fails,
|
|
16724
16724
|
* reschedules with backoff.
|
|
16725
|
-
*/ async
|
|
16726
|
-
if (0 !== this.
|
|
16725
|
+
*/ async nc() {
|
|
16726
|
+
if (0 !== this.ja.length) {
|
|
16727
16727
|
try {
|
|
16728
|
-
await this.
|
|
16728
|
+
await this.ja[0](), this.ja.shift(), this.Uo.reset();
|
|
16729
16729
|
} catch (t) {
|
|
16730
16730
|
if (!vi(t)) throw t;
|
|
16731
16731
|
// Failure will be handled by AsyncQueue
|
|
16732
16732
|
F("AsyncQueue", "Operation failed with retryable error: " + t);
|
|
16733
16733
|
}
|
|
16734
|
-
this.
|
|
16734
|
+
this.ja.length > 0 &&
|
|
16735
16735
|
// If there are additional operations, we re-schedule `retryNextOp()`.
|
|
16736
16736
|
// This is necessary to run retryable operations that failed during
|
|
16737
16737
|
// their initial attempt since we don't know whether they are already
|
|
@@ -16742,12 +16742,12 @@ function Va(t, e, ...n) {
|
|
|
16742
16742
|
// Since `backoffAndRun()` cancels an existing backoff and schedules a
|
|
16743
16743
|
// new backoff on every call, there is only ever a single additional
|
|
16744
16744
|
// operation in the queue.
|
|
16745
|
-
this.Uo.xo((() => this.
|
|
16745
|
+
this.Uo.xo((() => this.nc()));
|
|
16746
16746
|
}
|
|
16747
16747
|
}
|
|
16748
|
-
|
|
16749
|
-
const e = this.
|
|
16750
|
-
this.
|
|
16748
|
+
ec(t) {
|
|
16749
|
+
const e = this.Qa.then((() => (this.Ja = !0, t().catch((t => {
|
|
16750
|
+
this.Ha = t, this.Ja = !1;
|
|
16751
16751
|
const e =
|
|
16752
16752
|
/**
|
|
16753
16753
|
* Chrome includes Error.message in Error.stack. Other browsers do not.
|
|
@@ -16779,38 +16779,38 @@ function Va(t, e, ...n) {
|
|
|
16779
16779
|
// all further attempts to chain (via .then) will just short-circuit
|
|
16780
16780
|
// and return the rejected Promise.
|
|
16781
16781
|
throw $("INTERNAL UNHANDLED ERROR: ", e), t;
|
|
16782
|
-
})).then((t => (this.
|
|
16783
|
-
return this.
|
|
16782
|
+
})).then((t => (this.Ja = !1, t))))));
|
|
16783
|
+
return this.Qa = e, e;
|
|
16784
16784
|
}
|
|
16785
16785
|
enqueueAfterDelay(t, e, n) {
|
|
16786
|
-
this.
|
|
16786
|
+
this.tc(),
|
|
16787
16787
|
// Fast-forward delays for timerIds that have been overriden.
|
|
16788
|
-
this.
|
|
16789
|
-
const s = Ou.createAndSchedule(this, t, e, n, (t => this.
|
|
16790
|
-
return this.
|
|
16788
|
+
this.Xa.indexOf(t) > -1 && (e = 0);
|
|
16789
|
+
const s = Ou.createAndSchedule(this, t, e, n, (t => this.sc(t)));
|
|
16790
|
+
return this.za.push(s), s;
|
|
16791
16791
|
}
|
|
16792
|
-
|
|
16793
|
-
this.
|
|
16792
|
+
tc() {
|
|
16793
|
+
this.Ha && U();
|
|
16794
16794
|
}
|
|
16795
16795
|
verifyOperationInProgress() {}
|
|
16796
16796
|
/**
|
|
16797
16797
|
* Waits until all currently queued tasks are finished executing. Delayed
|
|
16798
16798
|
* operations are not run.
|
|
16799
|
-
*/ async
|
|
16799
|
+
*/ async ic() {
|
|
16800
16800
|
// Operations in the queue prior to draining may have enqueued additional
|
|
16801
16801
|
// operations. Keep draining the queue until the tail is no longer advanced,
|
|
16802
16802
|
// which indicates that no more new operations were enqueued and that all
|
|
16803
16803
|
// operations were executed.
|
|
16804
16804
|
let t;
|
|
16805
16805
|
do {
|
|
16806
|
-
t = this.
|
|
16807
|
-
} while (t !== this.
|
|
16806
|
+
t = this.Qa, await t;
|
|
16807
|
+
} while (t !== this.Qa);
|
|
16808
16808
|
}
|
|
16809
16809
|
/**
|
|
16810
16810
|
* For Tests: Determine if a delayed operation with a particular TimerId
|
|
16811
16811
|
* exists.
|
|
16812
|
-
*/
|
|
16813
|
-
for (const e of this.
|
|
16812
|
+
*/ rc(t) {
|
|
16813
|
+
for (const e of this.za) if (e.timerId === t) return !0;
|
|
16814
16814
|
return !1;
|
|
16815
16815
|
}
|
|
16816
16816
|
/**
|
|
@@ -16819,28 +16819,28 @@ function Va(t, e, ...n) {
|
|
|
16819
16819
|
* @param lastTimerId - Delayed operations up to and including this TimerId
|
|
16820
16820
|
* will be drained. Pass TimerId.All to run all delayed operations.
|
|
16821
16821
|
* @returns a Promise that resolves once all operations have been run.
|
|
16822
|
-
*/
|
|
16822
|
+
*/ oc(t) {
|
|
16823
16823
|
// Note that draining may generate more delayed ops, so we do that first.
|
|
16824
|
-
return this.
|
|
16824
|
+
return this.ic().then((() => {
|
|
16825
16825
|
// Run ops in the same order they'd run if they ran naturally.
|
|
16826
|
-
this.
|
|
16827
|
-
for (const e of this.
|
|
16828
|
-
return this.
|
|
16826
|
+
this.za.sort(((t, e) => t.targetTimeMs - e.targetTimeMs));
|
|
16827
|
+
for (const e of this.za) if (e.skipDelay(), "all" /* All */ !== t && e.timerId === t) break;
|
|
16828
|
+
return this.ic();
|
|
16829
16829
|
}));
|
|
16830
16830
|
}
|
|
16831
16831
|
/**
|
|
16832
16832
|
* For Tests: Skip all subsequent delays for a timer id.
|
|
16833
|
-
*/
|
|
16834
|
-
this.
|
|
16833
|
+
*/ uc(t) {
|
|
16834
|
+
this.Xa.push(t);
|
|
16835
16835
|
}
|
|
16836
|
-
/** Called once a DelayedOperation is run or canceled. */
|
|
16836
|
+
/** Called once a DelayedOperation is run or canceled. */ sc(t) {
|
|
16837
16837
|
// NOTE: indexOf / slice are O(n), but delayedOperations is expected to be small.
|
|
16838
|
-
const e = this.
|
|
16839
|
-
this.
|
|
16838
|
+
const e = this.za.indexOf(t);
|
|
16839
|
+
this.za.splice(e, 1);
|
|
16840
16840
|
}
|
|
16841
16841
|
}
|
|
16842
16842
|
|
|
16843
|
-
function
|
|
16843
|
+
function Cc(t) {
|
|
16844
16844
|
/**
|
|
16845
16845
|
* Returns true if obj is an object and contains at least one of the specified
|
|
16846
16846
|
* methods.
|
|
@@ -16875,7 +16875,7 @@ function Ca(t) {
|
|
|
16875
16875
|
*/ (t, [ "next", "error", "complete" ]);
|
|
16876
16876
|
}
|
|
16877
16877
|
|
|
16878
|
-
class
|
|
16878
|
+
class xc {
|
|
16879
16879
|
constructor() {
|
|
16880
16880
|
this._progressObserver = {}, this._taskCompletionResolver = new W, this._lastProgress = {
|
|
16881
16881
|
taskState: "Running",
|
|
@@ -16959,27 +16959,27 @@ class xa {
|
|
|
16959
16959
|
* See the License for the specific language governing permissions and
|
|
16960
16960
|
* limitations under the License.
|
|
16961
16961
|
*/
|
|
16962
|
-
/** DOMException error code constants. */ const
|
|
16962
|
+
/** DOMException error code constants. */ const Nc = -1;
|
|
16963
16963
|
|
|
16964
16964
|
/**
|
|
16965
16965
|
* The Cloud Firestore service interface.
|
|
16966
16966
|
*
|
|
16967
16967
|
* Do not call this constructor directly. Instead, use {@link getFirestore}.
|
|
16968
16968
|
*/
|
|
16969
|
-
class
|
|
16969
|
+
class kc extends Ic {
|
|
16970
16970
|
/** @hideconstructor */
|
|
16971
16971
|
constructor(t, e, n) {
|
|
16972
16972
|
super(t, e, n),
|
|
16973
16973
|
/**
|
|
16974
16974
|
* Whether it's a {@link Firestore} or Firestore Lite instance.
|
|
16975
16975
|
*/
|
|
16976
|
-
this.type = "firestore", this._queue = new
|
|
16976
|
+
this.type = "firestore", this._queue = new Dc, this._persistenceKey = "name" in t ? t.name : "[DEFAULT]";
|
|
16977
16977
|
}
|
|
16978
16978
|
_terminate() {
|
|
16979
16979
|
return this._firestoreClient ||
|
|
16980
16980
|
// The client must be initialized to ensure that all subsequent API
|
|
16981
16981
|
// usage throws an exception.
|
|
16982
|
-
$
|
|
16982
|
+
$c(this), this._firestoreClient.terminate();
|
|
16983
16983
|
}
|
|
16984
16984
|
}
|
|
16985
16985
|
|
|
@@ -16993,7 +16993,7 @@ class ka extends Ia {
|
|
|
16993
16993
|
* be associated.
|
|
16994
16994
|
* @param settings - A settings object to configure the {@link Firestore} instance.
|
|
16995
16995
|
* @returns A newly initialized {@link Firestore} instance.
|
|
16996
|
-
*/ function
|
|
16996
|
+
*/ function Oc(t, e) {
|
|
16997
16997
|
const n = _getProvider(t, "firestore");
|
|
16998
16998
|
if (n.isInitialized()) {
|
|
16999
16999
|
const t = n.getImmediate(), s = n.getOptions();
|
|
@@ -17014,22 +17014,22 @@ class ka extends Ia {
|
|
|
17014
17014
|
* @param app - The {@link @firebase/app#FirebaseApp} instance that the returned {@link Firestore}
|
|
17015
17015
|
* instance is associated with.
|
|
17016
17016
|
* @returns The {@link Firestore} instance of the provided app.
|
|
17017
|
-
*/ function
|
|
17017
|
+
*/ function Mc(e = t()) {
|
|
17018
17018
|
return _getProvider(e, "firestore").getImmediate();
|
|
17019
17019
|
}
|
|
17020
17020
|
|
|
17021
17021
|
/**
|
|
17022
17022
|
* @internal
|
|
17023
|
-
*/ function
|
|
17024
|
-
return t._firestoreClient || $
|
|
17023
|
+
*/ function Fc(t) {
|
|
17024
|
+
return t._firestoreClient || $c(t), t._firestoreClient.verifyNotTerminated(), t._firestoreClient;
|
|
17025
17025
|
}
|
|
17026
17026
|
|
|
17027
|
-
function $
|
|
17027
|
+
function $c(t) {
|
|
17028
17028
|
var e;
|
|
17029
17029
|
const n = t._freezeSettings(), s = function(t, e, n, s) {
|
|
17030
17030
|
return new Ot(t, e, n, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams);
|
|
17031
17031
|
}(t._databaseId, (null === (e = t._app) || void 0 === e ? void 0 : e.options.appId) || "", t._persistenceKey, n);
|
|
17032
|
-
t._firestoreClient = new
|
|
17032
|
+
t._firestoreClient = new Qa(t._authCredentials, t._appCheckCredentials, t._queue, s);
|
|
17033
17033
|
}
|
|
17034
17034
|
|
|
17035
17035
|
/**
|
|
@@ -17054,10 +17054,10 @@ function $a(t) {
|
|
|
17054
17054
|
* @param persistenceSettings - Optional settings object to configure
|
|
17055
17055
|
* persistence.
|
|
17056
17056
|
* @returns A `Promise` that represents successfully enabling persistent storage.
|
|
17057
|
-
*/ function
|
|
17058
|
-
|
|
17059
|
-
const n =
|
|
17060
|
-
return
|
|
17057
|
+
*/ function Bc(t, e) {
|
|
17058
|
+
Hc(t = gc(t, kc));
|
|
17059
|
+
const n = Fc(t), s = t._freezeSettings(), i = new Ba;
|
|
17060
|
+
return Uc(n, i, new Fa(i, s.cacheSizeBytes, null == e ? void 0 : e.forceOwnership));
|
|
17061
17061
|
}
|
|
17062
17062
|
|
|
17063
17063
|
/**
|
|
@@ -17081,10 +17081,10 @@ function $a(t) {
|
|
|
17081
17081
|
* @param firestore - The {@link Firestore} instance to enable persistence for.
|
|
17082
17082
|
* @returns A `Promise` that represents successfully enabling persistent
|
|
17083
17083
|
* storage.
|
|
17084
|
-
*/ function
|
|
17085
|
-
|
|
17086
|
-
const e =
|
|
17087
|
-
return
|
|
17084
|
+
*/ function Lc(t) {
|
|
17085
|
+
Hc(t = gc(t, kc));
|
|
17086
|
+
const e = Fc(t), n = t._freezeSettings(), s = new Ba;
|
|
17087
|
+
return Uc(e, s, new $a(s, n.cacheSizeBytes));
|
|
17088
17088
|
}
|
|
17089
17089
|
|
|
17090
17090
|
/**
|
|
@@ -17092,11 +17092,11 @@ function $a(t) {
|
|
|
17092
17092
|
* If the operation fails with a recoverable error (see
|
|
17093
17093
|
* `canRecoverFromIndexedDbError()` below), the returned Promise is rejected
|
|
17094
17094
|
* but the client remains usable.
|
|
17095
|
-
*/ function
|
|
17095
|
+
*/ function Uc(t, e, n) {
|
|
17096
17096
|
const s = new W;
|
|
17097
17097
|
return t.asyncQueue.enqueue((async () => {
|
|
17098
17098
|
try {
|
|
17099
|
-
await
|
|
17099
|
+
await ja(t, n), await Wa(t, e), s.resolve();
|
|
17100
17100
|
} catch (t) {
|
|
17101
17101
|
if (!
|
|
17102
17102
|
/**
|
|
@@ -17150,7 +17150,7 @@ function $a(t) {
|
|
|
17150
17150
|
})).then((() => s.promise));
|
|
17151
17151
|
}
|
|
17152
17152
|
|
|
17153
|
-
function
|
|
17153
|
+
function qc(t) {
|
|
17154
17154
|
if (t._initialized && !t._terminated) throw new j(Q.FAILED_PRECONDITION, "Persistence can only be cleared before a Firestore instance is initialized or after it is terminated.");
|
|
17155
17155
|
const e = new W;
|
|
17156
17156
|
return t._queue.enqueueAndForgetEvenWhileRestricted((async () => {
|
|
@@ -17181,11 +17181,11 @@ function qa(t) {
|
|
|
17181
17181
|
*
|
|
17182
17182
|
* @returns A `Promise` which resolves when all currently pending writes have been
|
|
17183
17183
|
* acknowledged by the backend.
|
|
17184
|
-
*/ function
|
|
17184
|
+
*/ function Kc(t) {
|
|
17185
17185
|
return function(t) {
|
|
17186
17186
|
const e = new W;
|
|
17187
|
-
return t.asyncQueue.enqueueAndForget((async () =>
|
|
17188
|
-
}(
|
|
17187
|
+
return t.asyncQueue.enqueueAndForget((async () => da(await Za(t), e))), e.promise;
|
|
17188
|
+
}(Fc(t = gc(t, kc)));
|
|
17189
17189
|
}
|
|
17190
17190
|
|
|
17191
17191
|
/**
|
|
@@ -17193,8 +17193,8 @@ function qa(t) {
|
|
|
17193
17193
|
* call to {@link disableNetwork}.
|
|
17194
17194
|
*
|
|
17195
17195
|
* @returns A `Promise` that is resolved once the network has been enabled.
|
|
17196
|
-
*/ function
|
|
17197
|
-
return
|
|
17196
|
+
*/ function Gc(t) {
|
|
17197
|
+
return ec(Fc(t = gc(t, kc)));
|
|
17198
17198
|
}
|
|
17199
17199
|
|
|
17200
17200
|
/**
|
|
@@ -17204,8 +17204,8 @@ function qa(t) {
|
|
|
17204
17204
|
* operations will be queued until the network is restored.
|
|
17205
17205
|
*
|
|
17206
17206
|
* @returns A `Promise` that is resolved once the network has been disabled.
|
|
17207
|
-
*/ function
|
|
17208
|
-
return
|
|
17207
|
+
*/ function Qc(t) {
|
|
17208
|
+
return nc(Fc(t = gc(t, kc)));
|
|
17209
17209
|
}
|
|
17210
17210
|
|
|
17211
17211
|
/**
|
|
@@ -17229,7 +17229,7 @@ function qa(t) {
|
|
|
17229
17229
|
*
|
|
17230
17230
|
* @returns A `Promise` that is resolved when the instance has been successfully
|
|
17231
17231
|
* terminated.
|
|
17232
|
-
*/ function
|
|
17232
|
+
*/ function jc(t) {
|
|
17233
17233
|
return e(t.app, "firestore"), t._delete();
|
|
17234
17234
|
}
|
|
17235
17235
|
|
|
@@ -17243,9 +17243,9 @@ function qa(t) {
|
|
|
17243
17243
|
* @returns A `LoadBundleTask` object, which notifies callers with progress
|
|
17244
17244
|
* updates, and completion or error events. It can be used as a
|
|
17245
17245
|
* `Promise<LoadBundleTaskProgress>`.
|
|
17246
|
-
*/ function
|
|
17247
|
-
const n =
|
|
17248
|
-
return
|
|
17246
|
+
*/ function Wc(t, e) {
|
|
17247
|
+
const n = Fc(t = gc(t, kc)), s = new xc;
|
|
17248
|
+
return cc(n, t._databaseId, e, s), s;
|
|
17249
17249
|
}
|
|
17250
17250
|
|
|
17251
17251
|
/**
|
|
@@ -17259,11 +17259,11 @@ function qa(t) {
|
|
|
17259
17259
|
* @param firestore - The {@link Firestore} instance to read the query from.
|
|
17260
17260
|
* @param name - The name of the query.
|
|
17261
17261
|
* @returns A `Promise` that is resolved with the Query or `null`.
|
|
17262
|
-
*/ function
|
|
17263
|
-
return
|
|
17262
|
+
*/ function zc(t, e) {
|
|
17263
|
+
return hc(Fc(t = gc(t, kc)), e).then((e => e ? new Ac(t, null, e.query) : null));
|
|
17264
17264
|
}
|
|
17265
17265
|
|
|
17266
|
-
function
|
|
17266
|
+
function Hc(t) {
|
|
17267
17267
|
if (t._initialized || t._terminated) throw new j(Q.FAILED_PRECONDITION, "Firestore has already been started and persistence can no longer be enabled. You can only enable persistence before calling any other methods on a Firestore object.");
|
|
17268
17268
|
}
|
|
17269
17269
|
|
|
@@ -17307,7 +17307,7 @@ function Ha(t) {
|
|
|
17307
17307
|
* Create a `FieldPath` by providing field names. If more than one field
|
|
17308
17308
|
* name is provided, the path will point to a nested field in a document.
|
|
17309
17309
|
*/
|
|
17310
|
-
class
|
|
17310
|
+
class Jc {
|
|
17311
17311
|
/**
|
|
17312
17312
|
* Creates a `FieldPath` from the provided field names. If more than one field
|
|
17313
17313
|
* name is provided, the path will point to a nested field in a document.
|
|
@@ -17331,8 +17331,8 @@ class Ja {
|
|
|
17331
17331
|
/**
|
|
17332
17332
|
* Returns a special sentinel `FieldPath` to refer to the ID of a document.
|
|
17333
17333
|
* It can be used in queries to sort or filter by the document ID.
|
|
17334
|
-
*/ function
|
|
17335
|
-
return new
|
|
17334
|
+
*/ function Yc() {
|
|
17335
|
+
return new Jc("__name__");
|
|
17336
17336
|
}
|
|
17337
17337
|
|
|
17338
17338
|
/**
|
|
@@ -17353,7 +17353,7 @@ class Ja {
|
|
|
17353
17353
|
*/
|
|
17354
17354
|
/**
|
|
17355
17355
|
* An immutable object representing an array of bytes.
|
|
17356
|
-
*/ class
|
|
17356
|
+
*/ class Xc {
|
|
17357
17357
|
/** @hideconstructor */
|
|
17358
17358
|
constructor(t) {
|
|
17359
17359
|
this._byteString = t;
|
|
@@ -17365,7 +17365,7 @@ class Ja {
|
|
|
17365
17365
|
* @param base64 - The Base64 string used to create the `Bytes` object.
|
|
17366
17366
|
*/ static fromBase64String(t) {
|
|
17367
17367
|
try {
|
|
17368
|
-
return new
|
|
17368
|
+
return new Xc(Vt.fromBase64String(t));
|
|
17369
17369
|
} catch (t) {
|
|
17370
17370
|
throw new j(Q.INVALID_ARGUMENT, "Failed to construct data from Base64 string: " + t);
|
|
17371
17371
|
}
|
|
@@ -17375,7 +17375,7 @@ class Ja {
|
|
|
17375
17375
|
*
|
|
17376
17376
|
* @param array - The Uint8Array used to create the `Bytes` object.
|
|
17377
17377
|
*/ static fromUint8Array(t) {
|
|
17378
|
-
return new
|
|
17378
|
+
return new Xc(Vt.fromUint8Array(t));
|
|
17379
17379
|
}
|
|
17380
17380
|
/**
|
|
17381
17381
|
* Returns the underlying bytes as a Base64-encoded string.
|
|
@@ -17427,7 +17427,7 @@ class Ja {
|
|
|
17427
17427
|
/**
|
|
17428
17428
|
* Sentinel values that can be used when writing document fields with `set()`
|
|
17429
17429
|
* or `update()`.
|
|
17430
|
-
*/ class
|
|
17430
|
+
*/ class Zc {
|
|
17431
17431
|
/**
|
|
17432
17432
|
* @param _methodName - The public API endpoint that returns this class.
|
|
17433
17433
|
* @hideconstructor
|
|
@@ -17581,55 +17581,55 @@ function ih(t) {
|
|
|
17581
17581
|
this.settings = t, this.databaseId = e, this.O = n, this.ignoreUndefinedProperties = s,
|
|
17582
17582
|
// Minor hack: If fieldTransforms is undefined, we assume this is an
|
|
17583
17583
|
// external call and we need to validate the entire path.
|
|
17584
|
-
void 0 === i && this.
|
|
17584
|
+
void 0 === i && this.ac(), this.fieldTransforms = i || [], this.fieldMask = r || [];
|
|
17585
17585
|
}
|
|
17586
17586
|
get path() {
|
|
17587
17587
|
return this.settings.path;
|
|
17588
17588
|
}
|
|
17589
|
-
get
|
|
17590
|
-
return this.settings.
|
|
17589
|
+
get cc() {
|
|
17590
|
+
return this.settings.cc;
|
|
17591
17591
|
}
|
|
17592
|
-
/** Returns a new context with the specified settings overwritten. */
|
|
17592
|
+
/** Returns a new context with the specified settings overwritten. */ hc(t) {
|
|
17593
17593
|
return new rh(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.O, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
|
|
17594
17594
|
}
|
|
17595
|
-
|
|
17595
|
+
lc(t) {
|
|
17596
17596
|
var e;
|
|
17597
|
-
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), s = this.
|
|
17597
|
+
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), s = this.hc({
|
|
17598
17598
|
path: n,
|
|
17599
|
-
|
|
17599
|
+
fc: !1
|
|
17600
17600
|
});
|
|
17601
|
-
return s.
|
|
17601
|
+
return s.dc(t), s;
|
|
17602
17602
|
}
|
|
17603
|
-
|
|
17603
|
+
_c(t) {
|
|
17604
17604
|
var e;
|
|
17605
|
-
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), s = this.
|
|
17605
|
+
const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), s = this.hc({
|
|
17606
17606
|
path: n,
|
|
17607
|
-
|
|
17607
|
+
fc: !1
|
|
17608
17608
|
});
|
|
17609
|
-
return s.
|
|
17609
|
+
return s.ac(), s;
|
|
17610
17610
|
}
|
|
17611
|
-
|
|
17611
|
+
wc(t) {
|
|
17612
17612
|
// TODO(b/34871131): We don't support array paths right now; so make path
|
|
17613
17613
|
// undefined.
|
|
17614
|
-
return this.
|
|
17614
|
+
return this.hc({
|
|
17615
17615
|
path: void 0,
|
|
17616
|
-
|
|
17616
|
+
fc: !0
|
|
17617
17617
|
});
|
|
17618
17618
|
}
|
|
17619
|
-
|
|
17620
|
-
return Ph(t, this.settings.methodName, this.settings.
|
|
17619
|
+
mc(t) {
|
|
17620
|
+
return Ph(t, this.settings.methodName, this.settings.gc || !1, this.path, this.settings.yc);
|
|
17621
17621
|
}
|
|
17622
17622
|
/** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
|
|
17623
17623
|
return void 0 !== this.fieldMask.find((e => t.isPrefixOf(e))) || void 0 !== this.fieldTransforms.find((e => t.isPrefixOf(e.field)));
|
|
17624
17624
|
}
|
|
17625
|
-
|
|
17625
|
+
ac() {
|
|
17626
17626
|
// TODO(b/34871131): Remove null check once we have proper paths for fields
|
|
17627
17627
|
// within arrays.
|
|
17628
|
-
if (this.path) for (let t = 0; t < this.path.length; t++) this.
|
|
17628
|
+
if (this.path) for (let t = 0; t < this.path.length; t++) this.dc(this.path.get(t));
|
|
17629
17629
|
}
|
|
17630
|
-
|
|
17631
|
-
if (0 === t.length) throw this.
|
|
17632
|
-
if (ih(this.
|
|
17630
|
+
dc(t) {
|
|
17631
|
+
if (0 === t.length) throw this.mc("Document fields must not be empty");
|
|
17632
|
+
if (ih(this.cc) && eh.test(t)) throw this.mc('Document fields cannot begin and end with "__"');
|
|
17633
17633
|
}
|
|
17634
17634
|
}
|
|
17635
17635
|
|
|
@@ -17640,14 +17640,14 @@ function ih(t) {
|
|
|
17640
17640
|
constructor(t, e, n) {
|
|
17641
17641
|
this.databaseId = t, this.ignoreUndefinedProperties = e, this.O = n || Zo(t);
|
|
17642
17642
|
}
|
|
17643
|
-
/** Creates a new top-level parse context. */
|
|
17643
|
+
/** Creates a new top-level parse context. */ Ic(t, e, n, s = !1) {
|
|
17644
17644
|
return new rh({
|
|
17645
|
-
|
|
17645
|
+
cc: t,
|
|
17646
17646
|
methodName: e,
|
|
17647
|
-
|
|
17647
|
+
yc: n,
|
|
17648
17648
|
path: At.emptyPath(),
|
|
17649
|
-
|
|
17650
|
-
|
|
17649
|
+
fc: !1,
|
|
17650
|
+
gc: s
|
|
17651
17651
|
}, this.databaseId, this.O, this.ignoreUndefinedProperties);
|
|
17652
17652
|
}
|
|
17653
17653
|
}
|
|
@@ -17657,32 +17657,32 @@ function uh(t) {
|
|
|
17657
17657
|
return new oh(t._databaseId, !!e.ignoreUndefinedProperties, n);
|
|
17658
17658
|
}
|
|
17659
17659
|
|
|
17660
|
-
/** Parse document data from a set() call. */ function
|
|
17661
|
-
const o = t.
|
|
17660
|
+
/** Parse document data from a set() call. */ function ah(t, e, n, s, i, r = {}) {
|
|
17661
|
+
const o = t.Ic(r.merge || r.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, i);
|
|
17662
17662
|
Th("Data must be an object, but it was:", o, s);
|
|
17663
17663
|
const u = ph(s, o);
|
|
17664
|
-
let
|
|
17665
|
-
if (r.merge)
|
|
17664
|
+
let a, c;
|
|
17665
|
+
if (r.merge) a = new Rt(o.fieldMask), c = o.fieldTransforms; else if (r.mergeFields) {
|
|
17666
17666
|
const t = [];
|
|
17667
17667
|
for (const s of r.mergeFields) {
|
|
17668
17668
|
const i = Eh(e, s, n);
|
|
17669
17669
|
if (!o.contains(i)) throw new j(Q.INVALID_ARGUMENT, `Field '${i}' is specified in your field mask but missing from your input data.`);
|
|
17670
17670
|
bh(t, i) || t.push(i);
|
|
17671
17671
|
}
|
|
17672
|
-
|
|
17673
|
-
} else
|
|
17674
|
-
return new nh(new
|
|
17672
|
+
a = new Rt(t), c = o.fieldTransforms.filter((t => a.covers(t.field)));
|
|
17673
|
+
} else a = null, c = o.fieldTransforms;
|
|
17674
|
+
return new nh(new ae(u), a, c);
|
|
17675
17675
|
}
|
|
17676
17676
|
|
|
17677
|
-
class
|
|
17677
|
+
class ch extends Zc {
|
|
17678
17678
|
_toFieldTransform(t) {
|
|
17679
|
-
if (2 /* MergeSet */ !== t.
|
|
17679
|
+
if (2 /* MergeSet */ !== t.cc) throw 1 /* Update */ === t.cc ? t.mc(`${this._methodName}() can only appear at the top level of your update data`) : t.mc(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);
|
|
17680
17680
|
// No transform to add for a delete, but we need to add it to our
|
|
17681
17681
|
// fieldMask so it gets deleted.
|
|
17682
17682
|
return t.fieldMask.push(t.path), null;
|
|
17683
17683
|
}
|
|
17684
17684
|
isEqual(t) {
|
|
17685
|
-
return t instanceof
|
|
17685
|
+
return t instanceof ch;
|
|
17686
17686
|
}
|
|
17687
17687
|
}
|
|
17688
17688
|
|
|
@@ -17703,14 +17703,14 @@ class ah extends Za {
|
|
|
17703
17703
|
* @param arrayElement - Whether or not the FieldValue has an array.
|
|
17704
17704
|
*/ function hh(t, e, n) {
|
|
17705
17705
|
return new rh({
|
|
17706
|
-
|
|
17707
|
-
|
|
17706
|
+
cc: 3 /* Argument */ ,
|
|
17707
|
+
yc: e.settings.yc,
|
|
17708
17708
|
methodName: t._methodName,
|
|
17709
|
-
|
|
17709
|
+
fc: n
|
|
17710
17710
|
}, e.databaseId, e.O, e.ignoreUndefinedProperties);
|
|
17711
17711
|
}
|
|
17712
17712
|
|
|
17713
|
-
class lh extends
|
|
17713
|
+
class lh extends Zc {
|
|
17714
17714
|
_toFieldTransform(t) {
|
|
17715
17715
|
return new En(t.path, new _n);
|
|
17716
17716
|
}
|
|
@@ -17719,13 +17719,13 @@ class lh extends Za {
|
|
|
17719
17719
|
}
|
|
17720
17720
|
}
|
|
17721
17721
|
|
|
17722
|
-
class fh extends
|
|
17722
|
+
class fh extends Zc {
|
|
17723
17723
|
constructor(t, e) {
|
|
17724
|
-
super(t), this.
|
|
17724
|
+
super(t), this.Tc = e;
|
|
17725
17725
|
}
|
|
17726
17726
|
_toFieldTransform(t) {
|
|
17727
17727
|
const e = hh(this, t,
|
|
17728
|
-
/*array=*/ !0), n = this.
|
|
17728
|
+
/*array=*/ !0), n = this.Tc.map((t => yh(t, e))), s = new wn(n);
|
|
17729
17729
|
return new En(t.path, s);
|
|
17730
17730
|
}
|
|
17731
17731
|
isEqual(t) {
|
|
@@ -17734,13 +17734,13 @@ class fh extends Za {
|
|
|
17734
17734
|
}
|
|
17735
17735
|
}
|
|
17736
17736
|
|
|
17737
|
-
class dh extends
|
|
17737
|
+
class dh extends Zc {
|
|
17738
17738
|
constructor(t, e) {
|
|
17739
|
-
super(t), this.
|
|
17739
|
+
super(t), this.Tc = e;
|
|
17740
17740
|
}
|
|
17741
17741
|
_toFieldTransform(t) {
|
|
17742
17742
|
const e = hh(this, t,
|
|
17743
|
-
/*array=*/ !0), n = this.
|
|
17743
|
+
/*array=*/ !0), n = this.Tc.map((t => yh(t, e))), s = new gn(n);
|
|
17744
17744
|
return new En(t.path, s);
|
|
17745
17745
|
}
|
|
17746
17746
|
isEqual(t) {
|
|
@@ -17749,12 +17749,12 @@ class dh extends Za {
|
|
|
17749
17749
|
}
|
|
17750
17750
|
}
|
|
17751
17751
|
|
|
17752
|
-
class _h extends
|
|
17752
|
+
class _h extends Zc {
|
|
17753
17753
|
constructor(t, e) {
|
|
17754
|
-
super(t), this.
|
|
17754
|
+
super(t), this.Ec = e;
|
|
17755
17755
|
}
|
|
17756
17756
|
_toFieldTransform(t) {
|
|
17757
|
-
const e = new pn(t.O,
|
|
17757
|
+
const e = new pn(t.O, cn(t.O, this.Ec));
|
|
17758
17758
|
return new En(t.path, e);
|
|
17759
17759
|
}
|
|
17760
17760
|
isEqual(t) {
|
|
@@ -17764,19 +17764,19 @@ class _h extends Za {
|
|
|
17764
17764
|
}
|
|
17765
17765
|
|
|
17766
17766
|
/** Parse update data from an update() call. */ function wh(t, e, n, s) {
|
|
17767
|
-
const i = t.
|
|
17767
|
+
const i = t.Ic(1 /* Update */ , e, n);
|
|
17768
17768
|
Th("Data must be an object, but it was:", i, s);
|
|
17769
|
-
const r = [], o =
|
|
17769
|
+
const r = [], o = ae.empty();
|
|
17770
17770
|
ft(s, ((t, s) => {
|
|
17771
17771
|
const u = Rh(e, t, n);
|
|
17772
17772
|
// For Compat types, we have to "extract" the underlying types before
|
|
17773
17773
|
// performing validation.
|
|
17774
17774
|
s = I(s);
|
|
17775
|
-
const
|
|
17776
|
-
if (s instanceof
|
|
17775
|
+
const a = i._c(u);
|
|
17776
|
+
if (s instanceof ch)
|
|
17777
17777
|
// Add it to the field mask, but don't add anything to updateData.
|
|
17778
17778
|
r.push(u); else {
|
|
17779
|
-
const t = yh(s,
|
|
17779
|
+
const t = yh(s, a);
|
|
17780
17780
|
null != t && (r.push(u), o.set(u, t));
|
|
17781
17781
|
}
|
|
17782
17782
|
}));
|
|
@@ -17785,27 +17785,27 @@ class _h extends Za {
|
|
|
17785
17785
|
}
|
|
17786
17786
|
|
|
17787
17787
|
/** Parse update data from a list of field/value arguments. */ function mh(t, e, n, s, i, r) {
|
|
17788
|
-
const o = t.
|
|
17788
|
+
const o = t.Ic(1 /* Update */ , e, n), u = [ Eh(e, s, n) ], a = [ i ];
|
|
17789
17789
|
if (r.length % 2 != 0) throw new j(Q.INVALID_ARGUMENT, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);
|
|
17790
|
-
for (let t = 0; t < r.length; t += 2) u.push(Eh(e, r[t])),
|
|
17791
|
-
const
|
|
17790
|
+
for (let t = 0; t < r.length; t += 2) u.push(Eh(e, r[t])), a.push(r[t + 1]);
|
|
17791
|
+
const c = [], h = ae.empty();
|
|
17792
17792
|
// We iterate in reverse order to pick the last value for a field if the
|
|
17793
17793
|
// user specified the field multiple times.
|
|
17794
|
-
for (let t = u.length - 1; t >= 0; --t) if (!bh(
|
|
17794
|
+
for (let t = u.length - 1; t >= 0; --t) if (!bh(c, u[t])) {
|
|
17795
17795
|
const e = u[t];
|
|
17796
|
-
let n =
|
|
17796
|
+
let n = a[t];
|
|
17797
17797
|
// For Compat types, we have to "extract" the underlying types before
|
|
17798
17798
|
// performing validation.
|
|
17799
17799
|
n = I(n);
|
|
17800
|
-
const s = o.
|
|
17801
|
-
if (n instanceof
|
|
17800
|
+
const s = o._c(e);
|
|
17801
|
+
if (n instanceof ch)
|
|
17802
17802
|
// Add it to the field mask, but don't add anything to updateData.
|
|
17803
|
-
|
|
17803
|
+
c.push(e); else {
|
|
17804
17804
|
const t = yh(n, s);
|
|
17805
|
-
null != t && (
|
|
17805
|
+
null != t && (c.push(e), h.set(e, t));
|
|
17806
17806
|
}
|
|
17807
17807
|
}
|
|
17808
|
-
const l = new Rt(
|
|
17808
|
+
const l = new Rt(c);
|
|
17809
17809
|
return new sh(h, l, o.fieldTransforms);
|
|
17810
17810
|
}
|
|
17811
17811
|
|
|
@@ -17816,7 +17816,7 @@ class _h extends Za {
|
|
|
17816
17816
|
* @param allowArrays - Whether the query value is an array that may directly
|
|
17817
17817
|
* contain additional arrays (e.g. the operand of an `in` query).
|
|
17818
17818
|
*/ function gh(t, e, n, s = !1) {
|
|
17819
|
-
return yh(n, t.
|
|
17819
|
+
return yh(n, t.Ic(s ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
|
|
17820
17820
|
}
|
|
17821
17821
|
|
|
17822
17822
|
/**
|
|
@@ -17832,7 +17832,7 @@ class _h extends Za {
|
|
|
17832
17832
|
// Unwrap the API type from the Compat SDK. This will return the API type
|
|
17833
17833
|
// from firestore-exp.
|
|
17834
17834
|
t = I(t))) return Th("Unsupported field value:", e, t), ph(t, e);
|
|
17835
|
-
if (t instanceof
|
|
17835
|
+
if (t instanceof Zc)
|
|
17836
17836
|
// FieldValues usually parse into transforms (except deleteField())
|
|
17837
17837
|
// in which case we do not want to include this field in our parsed data
|
|
17838
17838
|
// (as doing so will overwrite the field directly prior to the transform
|
|
@@ -17844,8 +17844,8 @@ class _h extends Za {
|
|
|
17844
17844
|
*/
|
|
17845
17845
|
return function(t, e) {
|
|
17846
17846
|
// Sentinels are only supported with writes, and not within arrays.
|
|
17847
|
-
if (!ih(e.
|
|
17848
|
-
if (!e.path) throw e.
|
|
17847
|
+
if (!ih(e.cc)) throw e.mc(`${t._methodName}() can only be used with update() and set()`);
|
|
17848
|
+
if (!e.path) throw e.mc(`${t._methodName}() is not currently supported inside arrays`);
|
|
17849
17849
|
const n = t._toFieldTransform(e);
|
|
17850
17850
|
n && e.fieldTransforms.push(n);
|
|
17851
17851
|
}
|
|
@@ -17869,12 +17869,12 @@ class _h extends Za {
|
|
|
17869
17869
|
// the set of values to be included for the IN query) that may directly
|
|
17870
17870
|
// contain additional arrays (each representing an individual field
|
|
17871
17871
|
// value), so we disable this validation.
|
|
17872
|
-
if (e.settings.
|
|
17872
|
+
if (e.settings.fc && 4 /* ArrayArgument */ !== e.cc) throw e.mc("Nested arrays are not supported");
|
|
17873
17873
|
return function(t, e) {
|
|
17874
17874
|
const n = [];
|
|
17875
17875
|
let s = 0;
|
|
17876
17876
|
for (const i of t) {
|
|
17877
|
-
let t = yh(i, e.
|
|
17877
|
+
let t = yh(i, e.wc(s));
|
|
17878
17878
|
null == t && (
|
|
17879
17879
|
// Just include nulls in the array for fields being replaced with a
|
|
17880
17880
|
// sentinel.
|
|
@@ -17893,7 +17893,7 @@ class _h extends Za {
|
|
|
17893
17893
|
if (null === (t = I(t))) return {
|
|
17894
17894
|
nullValue: "NULL_VALUE"
|
|
17895
17895
|
};
|
|
17896
|
-
if ("number" == typeof t) return
|
|
17896
|
+
if ("number" == typeof t) return cn(e.O, t);
|
|
17897
17897
|
if ("boolean" == typeof t) return {
|
|
17898
17898
|
booleanValue: t
|
|
17899
17899
|
};
|
|
@@ -17901,16 +17901,16 @@ class _h extends Za {
|
|
|
17901
17901
|
stringValue: t
|
|
17902
17902
|
};
|
|
17903
17903
|
if (t instanceof Date) {
|
|
17904
|
-
const n =
|
|
17904
|
+
const n = ct.fromDate(t);
|
|
17905
17905
|
return {
|
|
17906
17906
|
timestampValue: ms(e.O, n)
|
|
17907
17907
|
};
|
|
17908
17908
|
}
|
|
17909
|
-
if (t instanceof
|
|
17909
|
+
if (t instanceof ct) {
|
|
17910
17910
|
// Firestore backend truncates precision down to microseconds. To ensure
|
|
17911
17911
|
// offline mode works the same with regards to truncation, perform the
|
|
17912
17912
|
// truncation immediately without waiting for the backend to do that.
|
|
17913
|
-
const n = new
|
|
17913
|
+
const n = new ct(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
|
|
17914
17914
|
return {
|
|
17915
17915
|
timestampValue: ms(e.O, n)
|
|
17916
17916
|
};
|
|
@@ -17921,17 +17921,17 @@ class _h extends Za {
|
|
|
17921
17921
|
longitude: t.longitude
|
|
17922
17922
|
}
|
|
17923
17923
|
};
|
|
17924
|
-
if (t instanceof
|
|
17924
|
+
if (t instanceof Xc) return {
|
|
17925
17925
|
bytesValue: gs(e.O, t._byteString)
|
|
17926
17926
|
};
|
|
17927
|
-
if (t instanceof
|
|
17927
|
+
if (t instanceof Ec) {
|
|
17928
17928
|
const n = e.databaseId, s = t.firestore._databaseId;
|
|
17929
|
-
if (!s.isEqual(n)) throw e.
|
|
17929
|
+
if (!s.isEqual(n)) throw e.mc(`Document reference is for database ${s.projectId}/${s.database} but should be for database ${n.projectId}/${n.database}`);
|
|
17930
17930
|
return {
|
|
17931
17931
|
referenceValue: Is(t.firestore._databaseId || e.databaseId, t._key.path)
|
|
17932
17932
|
};
|
|
17933
17933
|
}
|
|
17934
|
-
throw e.
|
|
17934
|
+
throw e.mc(`Unsupported field value: ${mc(t)}`);
|
|
17935
17935
|
}
|
|
17936
17936
|
/**
|
|
17937
17937
|
* Checks whether an object looks like a JSON object that should be converted
|
|
@@ -17948,7 +17948,7 @@ function ph(t, e) {
|
|
|
17948
17948
|
// If we encounter an empty object, we explicitly add it to the update
|
|
17949
17949
|
// mask to ensure that the server creates a map entry.
|
|
17950
17950
|
e.path && e.path.length > 0 && e.fieldMask.push(e.path) : ft(t, ((t, s) => {
|
|
17951
|
-
const i = yh(s, e.
|
|
17951
|
+
const i = yh(s, e.lc(t));
|
|
17952
17952
|
null != i && (n[t] = i);
|
|
17953
17953
|
})), {
|
|
17954
17954
|
mapValue: {
|
|
@@ -17958,15 +17958,15 @@ function ph(t, e) {
|
|
|
17958
17958
|
}
|
|
17959
17959
|
|
|
17960
17960
|
function Ih(t) {
|
|
17961
|
-
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof
|
|
17961
|
+
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof ct || t instanceof th || t instanceof Xc || t instanceof Ec || t instanceof Zc);
|
|
17962
17962
|
}
|
|
17963
17963
|
|
|
17964
17964
|
function Th(t, e, n) {
|
|
17965
17965
|
if (!Ih(n) || !function(t) {
|
|
17966
17966
|
return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
|
|
17967
17967
|
}(n)) {
|
|
17968
|
-
const s =
|
|
17969
|
-
throw "an object" === s ? e.
|
|
17968
|
+
const s = mc(n);
|
|
17969
|
+
throw "an object" === s ? e.mc(t + " a custom object") : e.mc(t + " " + s);
|
|
17970
17970
|
}
|
|
17971
17971
|
}
|
|
17972
17972
|
|
|
@@ -17976,7 +17976,7 @@ function Th(t, e, n) {
|
|
|
17976
17976
|
if ((
|
|
17977
17977
|
// If required, replace the FieldPath Compat class with with the firestore-exp
|
|
17978
17978
|
// FieldPath.
|
|
17979
|
-
e = I(e)) instanceof
|
|
17979
|
+
e = I(e)) instanceof Jc) return e._internalPath;
|
|
17980
17980
|
if ("string" == typeof e) return Rh(t, e);
|
|
17981
17981
|
throw Ph("Field path arguments must be of type string or ", t,
|
|
17982
17982
|
/* hasConverter= */ !1,
|
|
@@ -18000,7 +18000,7 @@ function Th(t, e, n) {
|
|
|
18000
18000
|
/* hasConverter= */ !1,
|
|
18001
18001
|
/* path= */ void 0, n);
|
|
18002
18002
|
try {
|
|
18003
|
-
return new
|
|
18003
|
+
return new Jc(...e.split("."))._internalPath;
|
|
18004
18004
|
} catch (s) {
|
|
18005
18005
|
throw Ph(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t,
|
|
18006
18006
|
/* hasConverter= */ !1,
|
|
@@ -18012,9 +18012,9 @@ function Ph(t, e, n, s, i) {
|
|
|
18012
18012
|
const r = s && !s.isEmpty(), o = void 0 !== i;
|
|
18013
18013
|
let u = `Function ${e}() called with invalid data`;
|
|
18014
18014
|
n && (u += " (via `toFirestore()`)"), u += ". ";
|
|
18015
|
-
let
|
|
18016
|
-
return (r || o) && (
|
|
18017
|
-
|
|
18015
|
+
let a = "";
|
|
18016
|
+
return (r || o) && (a += " (found", r && (a += ` in field ${s}`), o && (a += ` in document ${i}`),
|
|
18017
|
+
a += ")"), new j(Q.INVALID_ARGUMENT, u + t + a);
|
|
18018
18018
|
}
|
|
18019
18019
|
|
|
18020
18020
|
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function bh(t, e) {
|
|
@@ -18061,7 +18061,7 @@ function Ph(t, e, n, s, i) {
|
|
|
18061
18061
|
/**
|
|
18062
18062
|
* The `DocumentReference` for the document included in the `DocumentSnapshot`.
|
|
18063
18063
|
*/ get ref() {
|
|
18064
|
-
return new
|
|
18064
|
+
return new Ec(this._firestore, this._converter, this._key);
|
|
18065
18065
|
}
|
|
18066
18066
|
/**
|
|
18067
18067
|
* Signals whether or not the document at the snapshot's location exists.
|
|
@@ -18132,7 +18132,7 @@ function Ph(t, e, n, s, i) {
|
|
|
18132
18132
|
/**
|
|
18133
18133
|
* Helper that calls `fromDotSeparatedString()` but wraps any error thrown.
|
|
18134
18134
|
*/ function Sh(t, e) {
|
|
18135
|
-
return "string" == typeof e ? Rh(t, e) : e instanceof
|
|
18135
|
+
return "string" == typeof e ? Rh(t, e) : e instanceof Jc ? e._internalPath : e._delegate._internalPath;
|
|
18136
18136
|
}
|
|
18137
18137
|
|
|
18138
18138
|
/**
|
|
@@ -18368,7 +18368,7 @@ function kh(t) {
|
|
|
18368
18368
|
* @param right - A snapshot to compare.
|
|
18369
18369
|
* @returns true if the snapshots are equal.
|
|
18370
18370
|
*/ function Oh(t, e) {
|
|
18371
|
-
return t instanceof Ch && e instanceof Ch ? 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 Nh && e instanceof Nh && (t._firestore === e._firestore &&
|
|
18371
|
+
return t instanceof Ch && e instanceof Ch ? 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 Nh && e instanceof Nh && (t._firestore === e._firestore && Sc(t.query, e.query) && t.metadata.isEqual(e.metadata) && t._snapshot.isEqual(e._snapshot));
|
|
18372
18372
|
}
|
|
18373
18373
|
|
|
18374
18374
|
/**
|
|
@@ -18414,7 +18414,7 @@ function kh(t) {
|
|
|
18414
18414
|
|
|
18415
18415
|
class Bh extends Fh {
|
|
18416
18416
|
constructor(t, e, n) {
|
|
18417
|
-
super(), this.
|
|
18417
|
+
super(), this.Ac = t, this.Rc = e, this.Pc = n, this.type = "where";
|
|
18418
18418
|
}
|
|
18419
18419
|
_apply(t) {
|
|
18420
18420
|
const e = uh(t.firestore), n = function(t, e, n, s, i, r, o) {
|
|
@@ -18434,7 +18434,7 @@ class Bh extends Fh {
|
|
|
18434
18434
|
} else "in" /* IN */ !== r && "not-in" /* NOT_IN */ !== r && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== r || tl(o, r),
|
|
18435
18435
|
u = gh(n, e, o,
|
|
18436
18436
|
/* allowArrays= */ "in" /* IN */ === r || "not-in" /* NOT_IN */ === r);
|
|
18437
|
-
const
|
|
18437
|
+
const a = Se.create(i, r, u);
|
|
18438
18438
|
return function(t, e) {
|
|
18439
18439
|
if (e.S()) {
|
|
18440
18440
|
const n = ze(t);
|
|
@@ -18482,9 +18482,9 @@ class Bh extends Fh {
|
|
|
18482
18482
|
if (null !== n)
|
|
18483
18483
|
// Special case when it's a duplicate op to give a slightly clearer error message.
|
|
18484
18484
|
throw n === e.op ? new j(Q.INVALID_ARGUMENT, `Invalid query. You cannot use more than one '${e.op.toString()}' filter.`) : new j(Q.INVALID_ARGUMENT, `Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`);
|
|
18485
|
-
}(t,
|
|
18486
|
-
}(t._query, "where", e, t.firestore._databaseId, this.
|
|
18487
|
-
return new
|
|
18485
|
+
}(t, a), a;
|
|
18486
|
+
}(t._query, "where", e, t.firestore._databaseId, this.Ac, this.Rc, this.Pc);
|
|
18487
|
+
return new Ac(t.firestore, t.converter, function(t, e) {
|
|
18488
18488
|
const n = t.filters.concat([ e ]);
|
|
18489
18489
|
return new Ke(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
|
|
18490
18490
|
}(t._query, n));
|
|
@@ -18508,7 +18508,7 @@ class Bh extends Fh {
|
|
|
18508
18508
|
|
|
18509
18509
|
class Uh extends Fh {
|
|
18510
18510
|
constructor(t, e) {
|
|
18511
|
-
super(), this.
|
|
18511
|
+
super(), this.Ac = t, this.bc = e, this.type = "orderBy";
|
|
18512
18512
|
}
|
|
18513
18513
|
_apply(t) {
|
|
18514
18514
|
const e = function(t, e, n) {
|
|
@@ -18533,8 +18533,8 @@ class Uh extends Fh {
|
|
|
18533
18533
|
* Will throw if the document does not contain all fields of the order by
|
|
18534
18534
|
* of the query or if any of the fields in the order by are an uncommitted
|
|
18535
18535
|
* server timestamp.
|
|
18536
|
-
*/ (t._query, this.
|
|
18537
|
-
return new
|
|
18536
|
+
*/ (t._query, this.Ac, this.bc);
|
|
18537
|
+
return new Ac(t.firestore, t.converter, function(t, e) {
|
|
18538
18538
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
18539
18539
|
const n = t.explicitOrderBy.concat([ e ]);
|
|
18540
18540
|
return new Ke(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
|
|
@@ -18557,10 +18557,10 @@ class Uh extends Fh {
|
|
|
18557
18557
|
|
|
18558
18558
|
class Kh extends Fh {
|
|
18559
18559
|
constructor(t, e, n) {
|
|
18560
|
-
super(), this.type = t, this.
|
|
18560
|
+
super(), this.type = t, this.Vc = e, this.vc = n;
|
|
18561
18561
|
}
|
|
18562
18562
|
_apply(t) {
|
|
18563
|
-
return new
|
|
18563
|
+
return new Ac(t.firestore, t.converter, Xe(t._query, this.Vc, this.vc));
|
|
18564
18564
|
}
|
|
18565
18565
|
}
|
|
18566
18566
|
|
|
@@ -18570,7 +18570,7 @@ class Kh extends Fh {
|
|
|
18570
18570
|
* @param limit - The maximum number of items to return.
|
|
18571
18571
|
* @returns The created {@link Query}.
|
|
18572
18572
|
*/ function Gh(t) {
|
|
18573
|
-
return
|
|
18573
|
+
return yc("limit", t), new Kh("limit", t, "F" /* First */);
|
|
18574
18574
|
}
|
|
18575
18575
|
|
|
18576
18576
|
/**
|
|
@@ -18582,16 +18582,16 @@ class Kh extends Fh {
|
|
|
18582
18582
|
* @param limit - The maximum number of items to return.
|
|
18583
18583
|
* @returns The created {@link Query}.
|
|
18584
18584
|
*/ function Qh(t) {
|
|
18585
|
-
return
|
|
18585
|
+
return yc("limitToLast", t), new Kh("limitToLast", t, "L" /* Last */);
|
|
18586
18586
|
}
|
|
18587
18587
|
|
|
18588
18588
|
class jh extends Fh {
|
|
18589
18589
|
constructor(t, e, n) {
|
|
18590
|
-
super(), this.type = t, this.
|
|
18590
|
+
super(), this.type = t, this.Sc = e, this.Dc = n;
|
|
18591
18591
|
}
|
|
18592
18592
|
_apply(t) {
|
|
18593
|
-
const e = Xh(t, this.type, this.
|
|
18594
|
-
return new
|
|
18593
|
+
const e = Xh(t, this.type, this.Sc, this.Dc);
|
|
18594
|
+
return new Ac(t.firestore, t.converter, function(t, e) {
|
|
18595
18595
|
return new Ke(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
|
|
18596
18596
|
}(t._query, e));
|
|
18597
18597
|
}
|
|
@@ -18609,11 +18609,11 @@ function zh(...t) {
|
|
|
18609
18609
|
|
|
18610
18610
|
class Hh extends Fh {
|
|
18611
18611
|
constructor(t, e, n) {
|
|
18612
|
-
super(), this.type = t, this.
|
|
18612
|
+
super(), this.type = t, this.Sc = e, this.Dc = n;
|
|
18613
18613
|
}
|
|
18614
18614
|
_apply(t) {
|
|
18615
|
-
const e = Xh(t, this.type, this.
|
|
18616
|
-
return new
|
|
18615
|
+
const e = Xh(t, this.type, this.Sc, this.Dc);
|
|
18616
|
+
return new Ac(t.firestore, t.converter, function(t, e) {
|
|
18617
18617
|
return new Ke(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
|
|
18618
18618
|
}(t._query, e));
|
|
18619
18619
|
}
|
|
@@ -18661,16 +18661,16 @@ function Yh(...t) {
|
|
|
18661
18661
|
if (i.length > o.length) throw new j(Q.INVALID_ARGUMENT, `Too many arguments provided to ${s}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);
|
|
18662
18662
|
const u = [];
|
|
18663
18663
|
for (let r = 0; r < i.length; r++) {
|
|
18664
|
-
const
|
|
18664
|
+
const a = i[r];
|
|
18665
18665
|
if (o[r].field.isKeyField()) {
|
|
18666
|
-
if ("string" != typeof
|
|
18667
|
-
if (!He(t) && -1 !==
|
|
18668
|
-
const n = t.path.child(Tt.fromString(
|
|
18666
|
+
if ("string" != typeof a) throw new j(Q.INVALID_ARGUMENT, `Invalid query. Expected a string for document ID in ${s}(), but got a ${typeof a}`);
|
|
18667
|
+
if (!He(t) && -1 !== a.indexOf("/")) throw new j(Q.INVALID_ARGUMENT, `Invalid query. When querying a collection and ordering by documentId(), the value passed to ${s}() must be a plain document ID, but '${a}' contains a slash.`);
|
|
18668
|
+
const n = t.path.child(Tt.fromString(a));
|
|
18669
18669
|
if (!Lt.isDocumentKey(n)) throw new j(Q.INVALID_ARGUMENT, `Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${s}() must result in a valid document path, but '${n}' is not because it contains an odd number of segments.`);
|
|
18670
18670
|
const i = new Lt(n);
|
|
18671
18671
|
u.push(Jt(e, i));
|
|
18672
18672
|
} else {
|
|
18673
|
-
const t = gh(n, s,
|
|
18673
|
+
const t = gh(n, s, a);
|
|
18674
18674
|
u.push(t);
|
|
18675
18675
|
}
|
|
18676
18676
|
}
|
|
@@ -18692,8 +18692,8 @@ function Zh(t, e, n) {
|
|
|
18692
18692
|
if (!Lt.isDocumentKey(s)) throw new j(Q.INVALID_ARGUMENT, `Invalid query. When querying a collection group by 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}).`);
|
|
18693
18693
|
return Jt(t, new Lt(s));
|
|
18694
18694
|
}
|
|
18695
|
-
if (n instanceof
|
|
18696
|
-
throw new j(Q.INVALID_ARGUMENT, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${
|
|
18695
|
+
if (n instanceof Ec) return Jt(t, n._key);
|
|
18696
|
+
throw new j(Q.INVALID_ARGUMENT, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${mc(n)}.`);
|
|
18697
18697
|
}
|
|
18698
18698
|
|
|
18699
18699
|
/**
|
|
@@ -18816,7 +18816,7 @@ class sl {
|
|
|
18816
18816
|
}
|
|
18817
18817
|
convertTimestamp(t) {
|
|
18818
18818
|
const e = St(t);
|
|
18819
|
-
return new
|
|
18819
|
+
return new ct(e.seconds, e.nanos);
|
|
18820
18820
|
}
|
|
18821
18821
|
convertDocumentKey(t, e) {
|
|
18822
18822
|
const n = Tt.fromString(t);
|
|
@@ -18867,11 +18867,11 @@ class rl extends sl {
|
|
|
18867
18867
|
super(), this.firestore = t;
|
|
18868
18868
|
}
|
|
18869
18869
|
convertBytes(t) {
|
|
18870
|
-
return new
|
|
18870
|
+
return new Xc(t);
|
|
18871
18871
|
}
|
|
18872
18872
|
convertReference(t) {
|
|
18873
18873
|
const e = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
18874
|
-
return new
|
|
18874
|
+
return new Ec(this.firestore, /* converter= */ null, e);
|
|
18875
18875
|
}
|
|
18876
18876
|
}
|
|
18877
18877
|
|
|
@@ -18906,7 +18906,7 @@ class rl extends sl {
|
|
|
18906
18906
|
}
|
|
18907
18907
|
set(t, e, n) {
|
|
18908
18908
|
this._verifyNotCommitted();
|
|
18909
|
-
const s = ul(t, this._firestore), i = il(s.converter, e, n), r =
|
|
18909
|
+
const s = ul(t, this._firestore), i = il(s.converter, e, n), r = ah(this._dataReader, "WriteBatch.set", s._key, i, null !== s.converter, n);
|
|
18910
18910
|
return this._mutations.push(r.toMutation(s._key, Pn.none())), this;
|
|
18911
18911
|
}
|
|
18912
18912
|
update(t, e, n, ...s) {
|
|
@@ -18915,7 +18915,7 @@ class rl extends sl {
|
|
|
18915
18915
|
// For Compat types, we have to "extract" the underlying types before
|
|
18916
18916
|
// performing validation.
|
|
18917
18917
|
let r;
|
|
18918
|
-
return r = "string" == typeof (e = I(e)) || e instanceof
|
|
18918
|
+
return r = "string" == typeof (e = I(e)) || e instanceof Jc ? mh(this._dataReader, "WriteBatch.update", i._key, e, n, s) : wh(this._dataReader, "WriteBatch.update", i._key, e),
|
|
18919
18919
|
this._mutations.push(r.toMutation(i._key, Pn.exists(!0))), this;
|
|
18920
18920
|
}
|
|
18921
18921
|
/**
|
|
@@ -19005,22 +19005,22 @@ function ul(t, e) {
|
|
|
19005
19005
|
* @returns A Promise resolved with a `DocumentSnapshot` containing the
|
|
19006
19006
|
* current document contents.
|
|
19007
19007
|
*/
|
|
19008
|
-
function
|
|
19009
|
-
t =
|
|
19010
|
-
const e =
|
|
19011
|
-
return
|
|
19008
|
+
function al(t) {
|
|
19009
|
+
t = gc(t, Ec);
|
|
19010
|
+
const e = gc(t.firestore, kc);
|
|
19011
|
+
return ic(Fc(e), t._key).then((n => El(e, t, n)));
|
|
19012
19012
|
}
|
|
19013
19013
|
|
|
19014
|
-
class
|
|
19014
|
+
class cl extends sl {
|
|
19015
19015
|
constructor(t) {
|
|
19016
19016
|
super(), this.firestore = t;
|
|
19017
19017
|
}
|
|
19018
19018
|
convertBytes(t) {
|
|
19019
|
-
return new
|
|
19019
|
+
return new Xc(t);
|
|
19020
19020
|
}
|
|
19021
19021
|
convertReference(t) {
|
|
19022
19022
|
const e = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
19023
|
-
return new
|
|
19023
|
+
return new Ec(this.firestore, /* converter= */ null, e);
|
|
19024
19024
|
}
|
|
19025
19025
|
}
|
|
19026
19026
|
|
|
@@ -19031,9 +19031,9 @@ class al extends sl {
|
|
|
19031
19031
|
* @returns A `Promise` resolved with a `DocumentSnapshot` containing the
|
|
19032
19032
|
* current document contents.
|
|
19033
19033
|
*/ function hl(t) {
|
|
19034
|
-
t =
|
|
19035
|
-
const e =
|
|
19036
|
-
return
|
|
19034
|
+
t = gc(t, Ec);
|
|
19035
|
+
const e = gc(t.firestore, kc), n = Fc(e), s = new cl(e);
|
|
19036
|
+
return sc(n, t._key).then((n => new Ch(e, s, t._key, n, new Dh(null !== n && n.hasLocalMutations,
|
|
19037
19037
|
/* fromCache= */ !0), t.converter)));
|
|
19038
19038
|
}
|
|
19039
19039
|
|
|
@@ -19044,9 +19044,9 @@ class al extends sl {
|
|
|
19044
19044
|
* @returns A `Promise` resolved with a `DocumentSnapshot` containing the
|
|
19045
19045
|
* current document contents.
|
|
19046
19046
|
*/ function ll(t) {
|
|
19047
|
-
t =
|
|
19048
|
-
const e =
|
|
19049
|
-
return
|
|
19047
|
+
t = gc(t, Ec);
|
|
19048
|
+
const e = gc(t.firestore, kc);
|
|
19049
|
+
return ic(Fc(e), t._key, {
|
|
19050
19050
|
source: "server"
|
|
19051
19051
|
}).then((n => El(e, t, n)));
|
|
19052
19052
|
}
|
|
@@ -19061,9 +19061,9 @@ class al extends sl {
|
|
|
19061
19061
|
*
|
|
19062
19062
|
* @returns A `Promise` that will be resolved with the results of the query.
|
|
19063
19063
|
*/ function fl(t) {
|
|
19064
|
-
t =
|
|
19065
|
-
const e =
|
|
19066
|
-
return Mh(t._query),
|
|
19064
|
+
t = gc(t, Ac);
|
|
19065
|
+
const e = gc(t.firestore, kc), n = Fc(e), s = new cl(e);
|
|
19066
|
+
return Mh(t._query), oc(n, t._query).then((n => new Nh(e, s, t, n)));
|
|
19067
19067
|
}
|
|
19068
19068
|
|
|
19069
19069
|
/**
|
|
@@ -19072,9 +19072,9 @@ class al extends sl {
|
|
|
19072
19072
|
*
|
|
19073
19073
|
* @returns A `Promise` that will be resolved with the results of the query.
|
|
19074
19074
|
*/ function dl(t) {
|
|
19075
|
-
t =
|
|
19076
|
-
const e =
|
|
19077
|
-
return
|
|
19075
|
+
t = gc(t, Ac);
|
|
19076
|
+
const e = gc(t.firestore, kc), n = Fc(e), s = new cl(e);
|
|
19077
|
+
return rc(n, t._query).then((n => new Nh(e, s, t, n)));
|
|
19078
19078
|
}
|
|
19079
19079
|
|
|
19080
19080
|
/**
|
|
@@ -19083,27 +19083,27 @@ class al extends sl {
|
|
|
19083
19083
|
*
|
|
19084
19084
|
* @returns A `Promise` that will be resolved with the results of the query.
|
|
19085
19085
|
*/ function _l(t) {
|
|
19086
|
-
t =
|
|
19087
|
-
const e =
|
|
19088
|
-
return
|
|
19086
|
+
t = gc(t, Ac);
|
|
19087
|
+
const e = gc(t.firestore, kc), n = Fc(e), s = new cl(e);
|
|
19088
|
+
return oc(n, t._query, {
|
|
19089
19089
|
source: "server"
|
|
19090
19090
|
}).then((n => new Nh(e, s, t, n)));
|
|
19091
19091
|
}
|
|
19092
19092
|
|
|
19093
19093
|
function wl(t, e, n) {
|
|
19094
|
-
t =
|
|
19095
|
-
const s =
|
|
19096
|
-
return Tl(s, [
|
|
19094
|
+
t = gc(t, Ec);
|
|
19095
|
+
const s = gc(t.firestore, kc), i = il(t.converter, e, n);
|
|
19096
|
+
return Tl(s, [ ah(uh(s), "setDoc", t._key, i, null !== t.converter, n).toMutation(t._key, Pn.none()) ]);
|
|
19097
19097
|
}
|
|
19098
19098
|
|
|
19099
19099
|
function ml(t, e, n, ...s) {
|
|
19100
|
-
t =
|
|
19101
|
-
const i =
|
|
19100
|
+
t = gc(t, Ec);
|
|
19101
|
+
const i = gc(t.firestore, kc), r = uh(i);
|
|
19102
19102
|
let o;
|
|
19103
19103
|
o = "string" == typeof (
|
|
19104
19104
|
// For Compat types, we have to "extract" the underlying types before
|
|
19105
19105
|
// performing validation.
|
|
19106
|
-
e = I(e)) || e instanceof
|
|
19106
|
+
e = I(e)) || e instanceof Jc ? mh(r, "updateDoc", t._key, e, n, s) : wh(r, "updateDoc", t._key, e);
|
|
19107
19107
|
return Tl(i, [ o.toMutation(t._key, Pn.exists(!0)) ]);
|
|
19108
19108
|
}
|
|
19109
19109
|
|
|
@@ -19114,7 +19114,7 @@ function ml(t, e, n, ...s) {
|
|
|
19114
19114
|
* @returns A Promise resolved once the document has been successfully
|
|
19115
19115
|
* deleted from the backend (note that it won't resolve while you're offline).
|
|
19116
19116
|
*/ function gl(t) {
|
|
19117
|
-
return Tl(
|
|
19117
|
+
return Tl(gc(t.firestore, kc), [ new $n(t._key, Pn.none()) ]);
|
|
19118
19118
|
}
|
|
19119
19119
|
|
|
19120
19120
|
/**
|
|
@@ -19127,8 +19127,8 @@ function ml(t, e, n, ...s) {
|
|
|
19127
19127
|
* newly created document after it has been written to the backend (Note that it
|
|
19128
19128
|
* won't resolve while you're offline).
|
|
19129
19129
|
*/ function yl(t, e) {
|
|
19130
|
-
const n =
|
|
19131
|
-
return Tl(n, [
|
|
19130
|
+
const n = gc(t.firestore, kc), s = Vc(t), i = il(t.converter, e);
|
|
19131
|
+
return Tl(n, [ ah(uh(t.firestore), "addDoc", s._key, i, null !== t.converter, {}).toMutation(s._key, Pn.exists(!1)) ]).then((() => s));
|
|
19132
19132
|
}
|
|
19133
19133
|
|
|
19134
19134
|
function pl(t, ...e) {
|
|
@@ -19137,44 +19137,44 @@ function pl(t, ...e) {
|
|
|
19137
19137
|
let r = {
|
|
19138
19138
|
includeMetadataChanges: !1
|
|
19139
19139
|
}, o = 0;
|
|
19140
|
-
"object" != typeof e[o] ||
|
|
19140
|
+
"object" != typeof e[o] || Cc(e[o]) || (r = e[o], o++);
|
|
19141
19141
|
const u = {
|
|
19142
19142
|
includeMetadataChanges: r.includeMetadataChanges
|
|
19143
19143
|
};
|
|
19144
|
-
if (
|
|
19144
|
+
if (Cc(e[o])) {
|
|
19145
19145
|
const t = e[o];
|
|
19146
19146
|
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),
|
|
19147
19147
|
e[o + 2] = null === (i = t.complete) || void 0 === i ? void 0 : i.bind(t);
|
|
19148
19148
|
}
|
|
19149
|
-
let
|
|
19150
|
-
if (t instanceof
|
|
19149
|
+
let a, c, h;
|
|
19150
|
+
if (t instanceof Ec) c = gc(t.firestore, kc), h = Qe(t._key.path), a = {
|
|
19151
19151
|
next: n => {
|
|
19152
|
-
e[o] && e[o](El(
|
|
19152
|
+
e[o] && e[o](El(c, t, n));
|
|
19153
19153
|
},
|
|
19154
19154
|
error: e[o + 1],
|
|
19155
19155
|
complete: e[o + 2]
|
|
19156
19156
|
}; else {
|
|
19157
|
-
const n =
|
|
19158
|
-
|
|
19159
|
-
const s = new
|
|
19160
|
-
|
|
19157
|
+
const n = gc(t, Ac);
|
|
19158
|
+
c = gc(n.firestore, kc), h = n._query;
|
|
19159
|
+
const s = new cl(c);
|
|
19160
|
+
a = {
|
|
19161
19161
|
next: t => {
|
|
19162
|
-
e[o] && e[o](new Nh(
|
|
19162
|
+
e[o] && e[o](new Nh(c, s, n, t));
|
|
19163
19163
|
},
|
|
19164
19164
|
error: e[o + 1],
|
|
19165
19165
|
complete: e[o + 2]
|
|
19166
19166
|
}, Mh(t._query);
|
|
19167
19167
|
}
|
|
19168
19168
|
return function(t, e, n, s) {
|
|
19169
|
-
const i = new
|
|
19170
|
-
return t.asyncQueue.enqueueAndForget((async () => qu(await
|
|
19171
|
-
i.
|
|
19169
|
+
const i = new Ua(s), r = new Wu(e, i, n);
|
|
19170
|
+
return t.asyncQueue.enqueueAndForget((async () => qu(await tc(t), r))), () => {
|
|
19171
|
+
i.Ca(), t.asyncQueue.enqueueAndForget((async () => Ku(await tc(t), r)));
|
|
19172
19172
|
};
|
|
19173
|
-
}(
|
|
19173
|
+
}(Fc(c), h, u, a);
|
|
19174
19174
|
}
|
|
19175
19175
|
|
|
19176
19176
|
function Il(t, e) {
|
|
19177
|
-
return
|
|
19177
|
+
return uc(Fc(t = gc(t, kc)), Cc(e) ? e : {
|
|
19178
19178
|
next: e
|
|
19179
19179
|
});
|
|
19180
19180
|
}
|
|
@@ -19185,15 +19185,15 @@ function Il(t, e) {
|
|
|
19185
19185
|
*/ function Tl(t, e) {
|
|
19186
19186
|
return function(t, e) {
|
|
19187
19187
|
const n = new W;
|
|
19188
|
-
return t.asyncQueue.enqueueAndForget((async () =>
|
|
19189
|
-
}(
|
|
19188
|
+
return t.asyncQueue.enqueueAndForget((async () => ua(await Za(t), e, n))), n.promise;
|
|
19189
|
+
}(Fc(t), e);
|
|
19190
19190
|
}
|
|
19191
19191
|
|
|
19192
19192
|
/**
|
|
19193
19193
|
* Converts a {@link ViewSnapshot} that contains the single document specified by `ref`
|
|
19194
19194
|
* to a {@link DocumentSnapshot}.
|
|
19195
19195
|
*/ function El(t, e, n) {
|
|
19196
|
-
const s = n.docs.get(e._key), i = new
|
|
19196
|
+
const s = n.docs.get(e._key), i = new cl(t);
|
|
19197
19197
|
return new Ch(t, i, e._key, s, new Dh(n.hasPendingWrites, n.fromCache), e.converter);
|
|
19198
19198
|
}
|
|
19199
19199
|
|
|
@@ -19240,7 +19240,7 @@ function Il(t, e) {
|
|
|
19240
19240
|
}));
|
|
19241
19241
|
}
|
|
19242
19242
|
set(t, e, n) {
|
|
19243
|
-
const s = ul(t, this._firestore), i = il(s.converter, e, n), r =
|
|
19243
|
+
const s = ul(t, this._firestore), i = il(s.converter, e, n), r = ah(this._dataReader, "Transaction.set", s._key, i, null !== s.converter, n);
|
|
19244
19244
|
return this._transaction.set(s._key, r), this;
|
|
19245
19245
|
}
|
|
19246
19246
|
update(t, e, n, ...s) {
|
|
@@ -19248,7 +19248,7 @@ function Il(t, e) {
|
|
|
19248
19248
|
// For Compat types, we have to "extract" the underlying types before
|
|
19249
19249
|
// performing validation.
|
|
19250
19250
|
let r;
|
|
19251
|
-
return r = "string" == typeof (e = I(e)) || e instanceof
|
|
19251
|
+
return r = "string" == typeof (e = I(e)) || e instanceof Jc ? mh(this._dataReader, "Transaction.update", i._key, e, n, s) : wh(this._dataReader, "Transaction.update", i._key, e),
|
|
19252
19252
|
this._transaction.update(i._key, r), this;
|
|
19253
19253
|
}
|
|
19254
19254
|
/**
|
|
@@ -19273,7 +19273,7 @@ function Il(t, e) {
|
|
|
19273
19273
|
* @param documentRef - A reference to the document to be read.
|
|
19274
19274
|
* @returns A `DocumentSnapshot` with the read data.
|
|
19275
19275
|
*/ get(t) {
|
|
19276
|
-
const e = ul(t, this._firestore), n = new
|
|
19276
|
+
const e = ul(t, this._firestore), n = new cl(this._firestore);
|
|
19277
19277
|
return super.get(t).then((t => new Ch(this._firestore, n, e._key, t._document, new Dh(
|
|
19278
19278
|
/* hasPendingWrites= */ !1,
|
|
19279
19279
|
/* fromCache= */ !1), e.converter)));
|
|
@@ -19299,12 +19299,12 @@ function Il(t, e) {
|
|
|
19299
19299
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
19300
19300
|
* rejected promise with the corresponding failure error is returned.
|
|
19301
19301
|
*/ function Rl(t, e, n) {
|
|
19302
|
-
t =
|
|
19302
|
+
t = gc(t, kc);
|
|
19303
19303
|
const s = Object.assign(Object.assign({}, nl), n);
|
|
19304
19304
|
!function(t) {
|
|
19305
19305
|
if (t.maxAttempts < 1) throw new j(Q.INVALID_ARGUMENT, "Max attempts must be at least 1");
|
|
19306
19306
|
}(s);
|
|
19307
|
-
return
|
|
19307
|
+
return ac(Fc(t), (n => e(new Al(t, n))), s);
|
|
19308
19308
|
}
|
|
19309
19309
|
|
|
19310
19310
|
/**
|
|
@@ -19327,7 +19327,7 @@ function Il(t, e) {
|
|
|
19327
19327
|
* Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or
|
|
19328
19328
|
* {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion.
|
|
19329
19329
|
*/ function Pl() {
|
|
19330
|
-
return new
|
|
19330
|
+
return new ch("deleteField");
|
|
19331
19331
|
}
|
|
19332
19332
|
|
|
19333
19333
|
/**
|
|
@@ -19419,7 +19419,7 @@ function Il(t, e) {
|
|
|
19419
19419
|
* @returns A {@link WriteBatch} that can be used to atomically execute multiple
|
|
19420
19420
|
* writes.
|
|
19421
19421
|
*/ function Dl(t) {
|
|
19422
|
-
return
|
|
19422
|
+
return Fc(t = gc(t, kc)), new ol(t, (e => Tl(t, e)));
|
|
19423
19423
|
}
|
|
19424
19424
|
|
|
19425
19425
|
/**
|
|
@@ -19438,7 +19438,7 @@ function Il(t, e) {
|
|
|
19438
19438
|
* See the License for the specific language governing permissions and
|
|
19439
19439
|
* limitations under the License.
|
|
19440
19440
|
*/ function Cl(t, e) {
|
|
19441
|
-
|
|
19441
|
+
Fc(t = gc(t, kc));
|
|
19442
19442
|
const n = "string" == typeof e ? function(t) {
|
|
19443
19443
|
try {
|
|
19444
19444
|
return JSON.parse(t);
|
|
@@ -19484,14 +19484,14 @@ function xl(t, e) {
|
|
|
19484
19484
|
!function(t) {
|
|
19485
19485
|
N = t;
|
|
19486
19486
|
}(i), n(new r("firestore", ((t, {options: n}) => {
|
|
19487
|
-
const s = t.getProvider("app").getImmediate(), i = new
|
|
19487
|
+
const s = t.getProvider("app").getImmediate(), i = new kc(s, new Y(t.getProvider("auth-internal")), new et(t.getProvider("app-check-internal")));
|
|
19488
19488
|
return n = Object.assign({
|
|
19489
19489
|
useFetchStreams: e
|
|
19490
19490
|
}, n), i._setSettings(n), i;
|
|
19491
|
-
}), "PUBLIC")), s(C, "3.4.9-canary.
|
|
19491
|
+
}), "PUBLIC")), s(C, "3.4.9-canary.2d6a4143d", t),
|
|
19492
19492
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
|
19493
|
-
s(C, "3.4.9-canary.
|
|
19493
|
+
s(C, "3.4.9-canary.2d6a4143d", "esm2017");
|
|
19494
19494
|
}("rn", /* useFetchStreams= */ !1);
|
|
19495
19495
|
|
|
19496
|
-
export { sl as AbstractUserDataWriter,
|
|
19496
|
+
export { sl as AbstractUserDataWriter, Xc as Bytes, Nc as CACHE_SIZE_UNLIMITED, Rc as CollectionReference, Ec as DocumentReference, Ch as DocumentSnapshot, Jc as FieldPath, Zc as FieldValue, kc as Firestore, j as FirestoreError, th as GeoPoint, xc as LoadBundleTask, Ac as Query, Fh as QueryConstraint, xh as QueryDocumentSnapshot, Nh as QuerySnapshot, Dh as SnapshotMetadata, ct as Timestamp, Al as Transaction, ol as WriteBatch, Mt as _DatabaseId, Lt as _DocumentKey, nt as _EmptyAppCheckTokenProvider, H as _EmptyAuthCredentialsProvider, At as _FieldPath, gc as _cast, K as _debugAssert, bt as _isBase64Available, B as _logWarn, Cl as _setIndexConfiguration, dc as _validateIsNotUsedTogether, yl as addDoc, vl as arrayRemove, Vl as arrayUnion, qc as clearIndexedDbPersistence, Pc as collection, bc as collectionGroup, Tc as connectFirestoreEmulator, gl as deleteDoc, Pl as deleteField, Qc as disableNetwork, Vc as doc, Yc as documentId, Bc as enableIndexedDbPersistence, Lc as enableMultiTabIndexedDbPersistence, Gc as enableNetwork, Yh as endAt, Jh as endBefore, Fc as ensureFirestoreConfigured, Tl as executeWrite, al as getDoc, hl as getDocFromCache, ll as getDocFromServer, fl as getDocs, dl as getDocsFromCache, _l as getDocsFromServer, Mc as getFirestore, Sl as increment, Oc as initializeFirestore, Gh as limit, Qh as limitToLast, Wc as loadBundle, zc as namedQuery, pl as onSnapshot, Il as onSnapshotsInSync, qh as orderBy, $h as query, Sc as queryEqual, vc as refEqual, Rl as runTransaction, bl as serverTimestamp, wl as setDoc, M as setLogLevel, Oh as snapshotEqual, zh as startAfter, Wh as startAt, jc as terminate, ml as updateDoc, Kc as waitForPendingWrites, Lh as where, Dl as writeBatch };
|
|
19497
19497
|
//# sourceMappingURL=index.rn.js.map
|